public void Message_hpil_wordTest() { //Arrange byte[] bytearray = new byte[] { 00, 02, 0x01, 0x37, 2, 0, 0, 100, 0, 100, 2, 0, 0, 101, 0, 101 }; Message_hpil_word msg = new Message_hpil_word(2, 311, (byte)HPIL_CODE.HPIL_CMDWR, 100, 100, (byte)HPIL_CODE.HPIL_CMDWR, 101, 101); //act MsgBuffer msgBuffer = msg.ToAciMsgBuffer(); int i = 0; foreach (var bytes in msgBuffer.Buffer) { Assert.AreEqual(bytes, bytearray[i]); i++; } ; }
/// <summary> /// Send _hpil message for PLC param value change /// </summary> /// <param name="Carid">车ID</param> /// <param name="Param">参数位置</param> /// <param name="Value">改变的值</param> private void SendHpilWordForPLC(int Carid, int Param, int Value) { Message_hpil_word h1 = new Message_hpil_word(Carid, 57344, 2, Param, Value); VCP9412.Instance.SendMessage(h1); }
/// <summary> /// Send _hpil message for select PLC param /// </summary> /// <param name="Carid">车ID</param> private void SendHpilWordForPLC(int Carid) { Message_hpil_word h1 = new Message_hpil_word(Carid, 57344, 1, 29, 1); VCP9412.Instance.SendMessage(h1); }