예제 #1
0
        /// <summary>
        /// Will initialize the scale that matches the provided vendor id
        /// </summary>
        public void Connect()
        {
            if (IsDisposed)
            {
                throw new ObjectDisposedException("Scale");
            }
            foreach (var device in HidDevices.Enumerate(0x0922, 0x8004))
            {
                mScale          = device;
                mScale.Removed += mScale_Removed;
                mScale.OpenDevice();
                int tries = 0;
                while (!mScale.IsConnected)
                {
                    System.Threading.Thread.Sleep(10);
                    tries++;

                    if (tries > 50)
                    {
                        throw new Exception("Unable to Initialize Scale");
                    }
                }
                Tare();
                break;
            }            //end start scale
        }
예제 #2
0
 public CycloneX10(IButtplugLogManager aLogManager, IHidDevice aHid, CycloneX10HidDeviceInfo aDeviceInfo)
     : base(aLogManager, aHid, aDeviceInfo)
 {
     MsgFuncs.Add(typeof(VorzeA10CycloneCmd), new ButtplugDeviceWrapper(HandleVorzeA10CycloneCmd));
     MsgFuncs.Add(typeof(RotateCmd), new ButtplugDeviceWrapper(HandleRotateCmd, new MessageAttributes()
     {
         FeatureCount = 1
     }));
     MsgFuncs.Add(typeof(StopDeviceCmd), new ButtplugDeviceWrapper(HandleStopDeviceCmd));
     aHid.OpenDevice();
 }
예제 #3
0
 public CycloneX10(IButtplugLogManager aLogManager, IHidDevice aHid, CycloneX10HidDeviceInfo aDeviceInfo)
     : base(aLogManager, aHid, aDeviceInfo)
 {
     AddMessageHandler <VorzeA10CycloneCmd>(HandleVorzeA10CycloneCmd);
     AddMessageHandler <RotateCmd>(HandleRotateCmd, new MessageAttributes()
     {
         FeatureCount = 1
     });
     AddMessageHandler <StopDeviceCmd>(HandleStopDeviceCmd);
     aHid.OpenDevice();
 }
        private void ReportReader()
        {
            if (!_hid.IsOpen)
            {
                _hid.OpenDevice();
            }

            _reading = true;
            _hid.MonitorDeviceEvents = true;
            _hid.ReadReport(OnReport, 100);
        }
예제 #5
0
        public HidConsoleDevice(IHidDevice device)
        {
            HidDevice = device;
            HidDevice.OpenDevice();

            ManufacturerString = GetManufacturerString(HidDevice);
            ProductString      = GetProductString(HidDevice);
            VendorId           = (ushort)HidDevice.Attributes.VendorId;
            ProductId          = (ushort)HidDevice.Attributes.ProductId;
            RevisionBcd        = (ushort)HidDevice.Attributes.Version;

            HidDevice.MonitorDeviceEvents = true;
            HidDevice.ReadReport(HidDeviceReportEvent);

            HidDevice.CloseDevice();
        }