Exemplo n.º 1
0
 private void ReceiveData()
 {
     while (running)
     {
         IPEndPoint host = new IPEndPoint(IPAddress.Any, 0);
         byte[]     data = client.Receive(ref host);
         string     str  = Encoding.ASCII.GetString(data);
         Console.WriteLine("Received {0} from ESP32", str);
         InputDispatcher.PerformAction(str);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Listen on the serial port while the SerialIO instance is open
 /// </summary>
 private void Listen()
 {
     while (SerialIO.GetInstance().Active())
     {
         try
         {
             string msg = SerialIO.GetInstance().Read();
             InputDispatcher.PerformAction(msg);
         }
         catch (Exception e)
         {
             Console.WriteLine(e.Message.ToString()); //TODO better exceptions
         }
     }
 }