Example #1
0
        private void SendData(byte[] sendbytes)
        {
            ILiveDebug.Instance.WriteLine("I3ComSendData" + ILiveUtil.ToHexString(sendbytes));
            string cmd = Encoding.GetEncoding(28591).GetString(sendbytes, 0, sendbytes.Length);

            this.comMusicI3.Send(cmd);
        }
Example #2
0
        void comDaHua_SerialDataReceived(ComPort ReceivingComPort, ComPortSerialDataEventArgs args)
        {
            //int exeid = 0;

            byte[] sendBytes = Encoding.ASCII.GetBytes(args.SerialData);
            ILiveDebug.Instance.WriteLine("IRACCReturnData:" + ILiveUtil.ToHexString(sendBytes));
        }
Example #3
0
 public void YelaProcess(byte[] yeladata)
 {
     ILiveDebug.Instance.WriteLine(ILiveUtil.ToHexString(yeladata));
     if (yeladata != null && yeladata.Length > 4)
     {
         if (yeladata[1] == 0x19)
         {
             if (yeladata[3] == 0x23 || yeladata[2] == 0x81)
             {
                 //门已经打开
             }
             else
             {
                 //门已经关闭
             }
             if (yeladata[2] == 0x81)
             {
                 this.YelaButtonPress(yeladata[4]);
                 //            honur=receivedBytes[4];
                 //            Admin[honur]=1;
                 //            delay(100);
                 //            Admin[honur]=0;
             }
         }
     }
     // yelaLock = null;
 }
Example #4
0
        void comYelaLock_SerialDataReceived(ComPort ReceivingComPort, ComPortSerialDataEventArgs args)
        {
            byte[] receivedBytes = Encoding.GetEncoding(28591).GetBytes(args.SerialData);
            if (receivedBytes != null && receivedBytes.Length > 0)
            {
                foreach (var item in receivedBytes)
                {
                    if (item == 0x0F)
                    {
                        try
                        {
                            this.YelaProcess(yelaLock);
                        }
                        catch (Exception)
                        {
                        }


                        yelaLock = null;
                    }
                    else
                    {
                        yelaLock = ILiveUtil.AddByteToBytes(yelaLock, item);
                    }
                }
            }
        }
Example #5
0
        private string GetCMDString(params byte[] senddata)
        {
            byte[] crc = this.Crc_16(senddata);

            byte[] sendBytes = this.copybyte(senddata, crc);
            ILiveDebug.Instance.WriteLine("IRACCSendData:" + ILiveUtil.ToHexString(sendBytes));

            //label1.Text += this.ToHexString(sendBytes) + "\r\n";
            //  ILiveDebug.Instance.WriteLine("iracc:" + ILiveUtil.ToHexString(sendBytes));
            return(Encoding.GetEncoding(28591).GetString(sendBytes, 0, sendBytes.Length));
        }