Example #1
0
        public void Send(int address, MessageType messageType, byte[] message)
        {
            byte[] header = NecDisplaySocket.CreateHeader(address, messageType, message.Length);
            byte[] packet = new byte[7 + message.Length];
            Array.Copy(header, packet, header.Length);
            Array.Copy(message, 0, packet, header.Length, message.Length);

            int chk = 0;

            for (int i = 1; i < packet.Length; i++)
            {
                chk = chk ^ packet[i];
            }

            byte[] finalPacket = new byte[packet.Length + 2];
            Array.Copy(packet, finalPacket, packet.Length);
            finalPacket[packet.Length]     = (byte)chk;
            finalPacket[packet.Length + 1] = 0x0D;
#if DEBUG
            //CrestronConsole.Print("NEC Tx: ");
            //Tools.PrintBytes(finalPacket, finalPacket.Length);
#endif

            this.ComPort.Send(finalPacket, finalPacket.Length);
        }
Example #2
0
 public NecLCDMonitor(string name, int displayID, NecDisplaySocket socket)
 {
     this.Name                  = name;
     this.DisplayID             = displayID;
     this.Socket                = socket;
     this.Socket.StatusChanged += new TCPSocketStatusChangeEventHandler(Socket_StatusChanged);
     this.Socket.ReceivedData  += new TCPSocketReceivedDataEventHandler(Socket_ReceivedData);
 }