Beispiel #1
0
 public static void pi1Port2ConnectionEnabler()
 {
     ConnectorOne.pi1Port2AddressUpdater();
     RoverConsole.ArcEyeContentThreadSafe("Checking Pi1 Connection via Port2");
     try
     {
         pi1Port2Tcp = new TcpClient();
         pi1Port2Tcp.Connect(pi1Ip, pi1Port2);
         pi1Port2NetworkStream = pi1Port2Tcp.GetStream();
         pi1Port2SrReciever    = new StreamReader(pi1Port2NetworkStream);
         pi1Port2SwSender      = new StreamWriter(pi1Port2NetworkStream);
         RoverConsole.ArcEyeContentThreadSafe("Pi1 via Port2 Connection Successful");
         if (ConnectorOne.pi1Port2ConnectedStatusEvent != null)
         {
             ConnectorOne.pi1Port2ConnectedStatusEvent(new object(), new EventArgs());
         }
     }
     catch (Exception ex)
     {
         RoverConsole.ArcEyeAiContentThreadSafe(ex.ToString());
         if (ConnectorOne.pi1Port2DisconnectedStatusEvent != null)
         {
             ConnectorOne.pi1Port2DisconnectedStatusEvent(new object(), new EventArgs());
         }
     }
 }
Beispiel #2
0
 public static void RoveArmStatusUpdater(MotorName motorName, HandMovement handMovement)
 {
     try
     {
         RoverConsole.ArcEyeAiContent("Uploading Rover Arm Command : Motor Name-" + motorName.ToString() + ", Hand Movement-" + handMovement.ToString());
         pi1Port2SwSender.AutoFlush = true;
         pi1Port2SwSender.Write(Convert.ToString(Convert.ToInt32(motorName)) + "," + Convert.ToInt32(handMovement));
         RoverConsole.ArcEyeAiContent("Command Uploaded to Pi1 via port2");
         if (ConnectorOne.pi1Port2ConnectedStatusEvent != null)
         {
             ConnectorOne.pi1Port2ConnectedStatusEvent(new object(), new EventArgs());
         }
     }
     catch (Exception ex)
     {
         RoverConsole.ArcEyeAiContentThreadSafe(ex.ToString());
         RoverConsole.ArcEyeAiContentThreadSafe("Trying To Reconnect");
         if (ConnectorOne.pi1Port2DisconnectedStatusEvent != null)
         {
             ConnectorOne.pi1Port2DisconnectedStatusEvent(new object(), new EventArgs());
         }
     }
 }