コード例 #1
0
ファイル: UsbTEMPer.cs プロジェクト: codeyu/Rx-Demo
        public static IEnumerable <string> FindDevices(IntPtr hndl)
        {
            int devCount = HIDFT.EMyDetectDevice((long)hndl);

            return(Enumerable.Range(0, devCount)
                   .Select(ii => String.Format("HID Device {0}", ii)));
        }
コード例 #2
0
ファイル: UsbTEMPer.cs プロジェクト: codeyu/Rx-Demo
 public IEnumerable <double> GetTempReadings()
 {
     lock (_lck)
     {
         double tmp = HIDFT.EMyReadTemp(true);
         yield return(tmp);
     }
 }
コード例 #3
0
ファイル: UsbTEMPer.cs プロジェクト: codeyu/Rx-Demo
        private void Initalize()
        {
            HIDFT.EMySetCurrentDev(_deviceId);
            Thread.Sleep(100);
            var ret = HIDFT.EMyInitConfig(true);

            if (!ret)
            {
                throw new InvalidOperationException("the type is not temper");
            }

            byte[] upd = new byte[6];
            HIDFT.EMyReadEP(ref upd[0], ref upd[1], ref upd[2], ref upd[3], ref upd[4], ref upd[5]);
            if (upd[1] != 0x58)
            {
                throw new InvalidOperationException("the type is not temper");
            }

            _compensator = (upd[2] >= 10) & (upd[2] <= 0x1d) ? Convert.ToDouble(String.Format("{0}.{1}", upd[2], upd[3])) - 20.0 : 0.0;
        }
コード例 #4
0
ファイル: UsbTEMPer.cs プロジェクト: codeyu/Rx-Demo
 public void Dispose()
 {
     HIDFT.EMyCloseDevice();
 }