Esempio n. 1
0
 public void StartReading()
 {
     new Thread(delegate()
     {
         while (!stop)
         {
             //reading Dashboard elements from the simulator
             try
             {
                 AirSpeed      = telnetClient.Read(airSpeedAddress);
                 Altitude      = telnetClient.Read(altitudeAddress);
                 Roll          = telnetClient.Read(rollAddress);
                 Pitch         = telnetClient.Read(pitchAddress);
                 Altimeter     = telnetClient.Read(altimeterAddress);
                 Heading       = telnetClient.Read(headingAddress);
                 GroundSpeed   = telnetClient.Read(groundSpeedAddress);
                 VerticalSpeed = telnetClient.Read(verticalSpeedAddress);
                 //reading map values from the simulator
                 Latitude  = telnetClient.Read(latitudeAddress);
                 Longitude = telnetClient.Read(longitudeAddress);
                 Location  = latitude + "," + longitude;
                 Thread.Sleep(250);
             }
             catch (ArgumentNullException nullException)
             {
                 Disconnect();
                 if (!telnetClient.getTelnetErrorFlag())
                 {
                     Err = "Server ended communication";
                 }
             }
         }
     }).Start();
 }