Esempio n. 1
0
        /// <summary>
        ///

        private void SetDevState(byte[] statemsg)
        {
            // 遍历1到8个按钮的状态
            int i = 1;

            for (i = 1; i <= 8; i++)
            {
                if (statemsg[1] == 1)
                {
                    doMap["OneBtn_ItemDO" + i] = Relay.GetState(statemsg, i) + "";
                    diMap["OneBtn_ItemDI" + i] = Relay.GetInputState(statemsg, i) + "";
                }

                if (statemsg[1] == 2)
                {
                    doMap["TwoBtn_ItemDO" + i] = Relay.GetState(statemsg, i) + "";
                    diMap["TwoBtn_ItemDI" + i] = Relay.GetInputState(statemsg, i) + "";
                }
                if (statemsg[1] == 3)
                {
                    doMap["ThrBtn_ItemDO" + i] = Relay.GetState(statemsg, i) + "";
                    diMap["ThrBtn_ItemDI" + i] = Relay.GetInputState(statemsg, i) + "";
                }
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 向指定端口发送指令
 /// </summary>
 /// <param name="_Address"></param>
 /// <param name="_Line"></param>
 /// <param name="_type"></param>
 private void SendCMD(short _Address, int _Line, RelayType _type)
 {
     byte[] tempCMD = new byte[8];
     tempCMD = Relay.CreateCMD(_Address, _Line, _type);
     clientSendMsg(tempCMD);
 }