/// <summary>
        /// Send a packet to the 4x4 Chip
        /// </summary>
        /// <param name="packet">Packet</param>
        /// <returns></returns>
        public bool SendPacket(FourByFourCommand packet)
        {
            try
            {
                if (_SerialPort == null)
                {
                    return(false);
                }

                byte[] packetBinaries = packet.GetDataPacket();
                _SerialPort.Write(packetBinaries, 0, packetBinaries.Length);
                Console.WriteLine(string.Format("INFO: Command '{0}' sent to UART. Data bytes: '{1}'", packet.Command, packetBinaries.Length));

                return(true);
            }
            catch (Exception e)
            {
                Log.Error(e, "Error when sending FourByFourCommand packet");
                return(false);
            }
        }
Exemplo n.º 2
0
 static void SendPacket(FourByFourCommand packet)
 {
     byte[] packetBinaries = packet.GetDataPacket();
     serialPort.Write(packetBinaries, 0, packetBinaries.Length);
 }