Пример #1
0
 void Update()
 {
     if (serialPort != null && serialPort.PortOpen())
     {
         char cc;
         uint numRead;
         do
         {
             bool connectionHealthy = serialPort.ReadChar(out cc, out numRead);
             if (!connectionHealthy)
             {
                 ConnectionLost();
                 return;
             }
             if (numRead > 0)
             {
                 if (cc == '\r')
                 {
                     continue;
                 }
                 else if (cc == '\n' || (int)cc == 0)
                 {
                     puzzletConnection.HandleMessage(PuzzletUtility.ParseMessage(partialLine));
                     partialLine = "";
                 }
                 else
                 {
                     partialLine += cc;
                 }
             }
         } while (numRead > 0);
     }
 }
Пример #2
0
 public void PuzzletReceiveMessageIOS(string message)
 {
     puzzletConnection.HandleMessage(PuzzletUtility.ParseMessage(message));
 }