private void SetCommand_for_OC_Cmds(string cmdId, int idx, string description = null)
        {
            int key = Utils.MakeKey(cmdId, idx);

            if (description == null)
            {
                description = cmdId;
            }
            UIItem uiItem = new UIItem(cmdId, idx, true)
            {
                Description = description,
                CmdSend     = new RelayCommand(e =>
                {
                    byte[] packageSet = Utils.makePacket(NodeId, cmdId, idx, false, true, dicSignals[key].ValueFloatSet.ToString());
                    byte[] packageGet = Utils.makePacket(NodeId, cmdId, idx, true, true, "0");
                    //Console.WriteLine("out:"+BitConverter.ToString(packageSet)+" key: "+key);
                    //if(CAN_Common.Instance.CANHandle==-1)CAN_Common.Instance.CmdCANInit.Execute(null);
                    CAN_Common.Write(packageSet);
                    CAN_Common.Write(packageGet);
                })
            };

            dicSignals[key] = uiItem;
            OC_Cmds.Add(uiItem);
            setFloatListener(key);
            _keepRefreshed.Add(makeGetFloatPacket(cmdId, idx));
        }
Ejemplo n.º 2
0
        private void SetCommand_for_OC_Cmds(string cmdId, int idx, string description = null)
        {
            int key = Utils.MakeKey(cmdId, idx);

            if (description == null)
            {
                description = cmdId;
            }
            var uiItem = new VM_FloatGetSet()
            {
                Description = description,
                CmdSend     = new RelayCommand(e => {
                    byte[] packageSet = Utils.MakePacket(NodeId, cmdId, idx, false, true, ((VM_FloatGetSet)dicSignals[key]).ValueFloatSet.ToString());
                    byte[] packageGet = Utils.MakePacket(NodeId, cmdId, idx, true, true, "0");
                    //todo comunicationManager write
                    //CAN_Common.Write(packageSet);
                    //CAN_Common.Write(packageGet);
                })
            };

            dicSignals[key] = uiItem;
            OC_Cmds.Add(uiItem);
            setFloatListener(key);
            _keepRefreshed.Add(makeGetFloatPacket(cmdId, idx));
        }
Ejemplo n.º 3
0
        private void SetCommand_for_OC_Cmds(int cmdId, int idx, string description = null)
        {
            var key = Consts.Keys.getProtocolOp(cmdId, idx);

            if (key.Id == -1)
            {
                return;
            }
            var uiItem = VM_DataType_Factory.TaskFactory(key.Id);

            dicSignals[key.Id] = uiItem;
            OC_Cmds.Add(uiItem);
        }