예제 #1
0
 public ErgometerData GetErgoData()
 {
     if (simulation == null && ergometerCOM != null)
     {
         return(ergometerCOM.GetData());
     }
     else if (simulation != null)
     {
         return(simulation.GetData());
     }
     return(null);
 }
예제 #2
0
 public void GetData()
 {
     while (sessionID == null)
     {
         Thread.Sleep(100);
     }
     while (isConnected)
     {
         measurement++;
         if (simulation == null && ergometerCOM != null)
         {
             if (!ergometerCOM.IsConnected())
             {
                 Notify();
                 return;
             }
             System.Diagnostics.Debug.WriteLine(isConnected);
             Healthcare_test.ErgometerData ergometerData = ergometerCOM.GetData();
             vrc.UpdateBikePanelInVR(ergometerData);
             dynamic ergometerdata = new
             {
                 id      = "data",
                 session = sessionID,
                 data    = new
                 {
                     power    = ergometerData.Actual_Power,
                     speed    = ergometerData.Speed,
                     time     = ergometerData.Time,
                     RPM      = ergometerData.RPM,
                     distance = ergometerData.Distance,
                     pulse    = ergometerData.Pulse
                 }
             };
             if (measurement >= 10)
             {
                 Send(JsonConvert.SerializeObject(ergometerdata));
                 measurement = 0;
             }
         }
         else if (simulation != null)
         {
             if (!simulation.IsConnected())
             {
                 Notify();
                 return;
             }
             System.Diagnostics.Debug.WriteLine(isConnected);
             Healthcare_test.ErgometerData ergometerData2 = simulation.GetData();
             vrc.UpdateBikePanelInVR(ergometerData2);
             dynamic ergometerdata2 = new
             {
                 id      = "data",
                 session = sessionID,
                 data    = new
                 {
                     power    = ergometerData2.Actual_Power,
                     speed    = ergometerData2.Speed,
                     time     = ergometerData2.Time,
                     RPM      = ergometerData2.RPM,
                     distance = ergometerData2.Distance,
                     pulse    = ergometerData2.Pulse
                 }
             };
             if (measurement >= 10)
             {
                 Send(JsonConvert.SerializeObject(ergometerdata2));
                 measurement = 0;
             }
         }
         Thread.Sleep(100);
     }
 }