示例#1
0
        public double GetTemp()
        {
            if (!connected)
            {
                InitDevice();
            }

            double value = EntryAPI.EMyReadTemp(true);

            if (value == -100)
            {
                connected = false;
                throw new IOException("No sensor");
            }
            else if (value == 888)
            {
                connected = false;
                throw new IOException("Device error");
            }
            else if (value == 999)
            {
                connected = false;
                throw new IOException("Device error");
            }
            else
            {
                return(Math.Round(value, 2));
            }
        }
示例#2
0
 private void InitDevice()
 {
     if (DeviceConnected())
     {
         int numberOfDevices = EntryAPI.EMyDetectDevice((long)hwnd);
         if (numberOfDevices > 0)
         {
             EntryAPI.EMySetCurrentDev(0);
             Thread.Sleep(100);
             EntryAPI.EMyInitConfig(true);
             connected = true;
         }
     }
     else
     {
         connected = false;
     }
 }
示例#3
0
 public void Dispose()
 {
     EntryAPI.EMyCloseDevice();
 }