Exemplo n.º 1
0
        public void Send(string data)
        {
#if DEBUG
            Debug.WriteWarn("Projector Tx", '(' + data + ')');
#endif
            _comPort.Send('(' + data + ')');
        }
Exemplo n.º 2
0
        private object SendBufferProcess(object o)
        {
            while (true)
            {
                try
                {
                    var bytes = _txQueue.Dequeue();
                    if (bytes == null)
                    {
                        CloudLog.Notice("Exiting {0}", Thread.CurrentThread.Name);
                        return(null);
                    }
#if DEBUG
                    Debug.WriteInfo("Samsung Tx",
                                    Debug.AnsiPurple + Tools.GetBytesAsReadableString(bytes, 0, bytes.Length, false) +
                                    Debug.AnsiReset);
#endif
                    _comPort.Send(bytes, bytes.Length);
                    CrestronEnvironment.AllowOtherAppsToRun();
                    Thread.Sleep(10);
                }
                catch (Exception e)
                {
                    if (e.Message != "ThreadAbortException")
                    {
                        CloudLog.Exception(string.Format("{0} - Exception in tx buffer thread", GetType().Name), e);
                    }
                }
            }
        }
Exemplo n.º 3
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

            _comPort.Send(finalPacket, finalPacket.Length);
        }
Exemplo n.º 4
0
        public void Send(string stringToSend)
        {
#if DEBUG
            Debug.WriteInfo("Epson Tx", stringToSend);
#endif
            _comPort.Send(stringToSend + "\r");
        }
Exemplo n.º 5
0
        public void Send(string str)
        {
#if DEBUG
            Debug.WriteWarn("Codec Tx", str);
#endif
            _port.Send(str + "\r");
        }
Exemplo n.º 6
0
        private void Send(string command)
        {
#if DEBUG
            Debug.WriteInfo("Surface Hub Tx", command);
#endif
            _comPort.Send(command + "\x0d");
        }
Exemplo n.º 7
0
        public void Send(char cmd1, char cmd2, uint id, byte data)
        {
            var str = string.Format("{0}{1} {2:X2} {3:X2}", cmd1, cmd2, id, data);

#if DEBUG
            //Debug.WriteInfo("LG Tx", str);
#endif
            _comPort.Send(str + "\x0D");
        }
Exemplo n.º 8
0
        /// <summary>
        /// Send bytes to the serial port to prevent issues with encoding of non ascii strings
        /// </summary>
        /// <param name="port">ComPort to extend</param>
        /// <param name="bytes">Byte array to send</param>
        /// <param name="count">Count of bytes from array</param>
        public static void Send(this IComPortDevice port, byte[] bytes, int count)
        {
            var str = string.Empty;

            for (var i = 0; i < count; i++)
            {
                str = str + (char)bytes[i];
            }
            port.Send(str);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Send a byte to the serial port to prevent issues with encoding of non ascii strings
        /// </summary>
        /// <param name="port">ComPort to extend</param>
        /// <param name="b">Byte to send</param>
        public static void Send(this IComPortDevice port, byte b)
        {
            var str = string.Empty + (char)b;

            port.Send(str);
        }
Exemplo n.º 10
0
 public void Stop()
 {
     _comPort.Send("fa_stop\r");
 }
Exemplo n.º 11
0
 public void Send(string stringToSend)
 {
     _comPort.Send(stringToSend);
 }