Esempio n. 1
0
        static void Main(string[] args)
        {
            LynxaSerialPort lynxaSerialPort = new LynxaSerialPort("COM2", 9600);

            lynxaSerialPort.Open();

            CommandLineInterface command_line_interface = new CommandLineInterface(lynxaSerialPort);

            lynxaSerialPort.LynxaPacketReceivedEvent += LynxaSerialPort_LynxaPacketReceivedEvent;
            lynxaSerialPort.LynxaPacketReceivedEvent += command_line_interface.LynxaSerialPort_LynxaPacketReceivedEvent;

            while (true)
            {
                //exit if a key is pressed
                //if (Console.KeyAvailable)
                //{
                //    //save file and exit
                //    break;
                //}

                string input = Console.ReadLine();
                Console.WriteLine($"echo: { input} ");
                command_line_interface.Process(input);
            }
        }
 public CommandLineInterface(LynxaSerialPort serialPort)
 {
     _serialPort = serialPort;
 }