コード例 #1
0
 /// <summary>
 /// Tries to find a RailDriver and initialize it
 /// </summary>
 /// <param name="basePath"></param>
 public UserInputRailDriver(string basePath)
 {
     try
     {
         PIEDevice[] devices = PIEHidDotNet.PIEDevice.EnumeratePIE();
         for (int i = 0; i < devices.Length; i++)
         {
             if (devices[i].HidUsagePage == 0xc && devices[i].Pid == 210)
             {
                 Device = devices[i];
                 Device.SetupInterface();
                 Device.SetErrorCallback(this);
                 Device.SetDataCallback(this, DataCallbackFilterType.callOnChangedData);
                 WriteBuffer = new byte[Device.WriteLength];
                 State       = new RailDriverState();
                 SetLEDs(0x40, 0x40, 0x40);
                 ReadCalibrationData(basePath);
                 break;
             }
         }
     }
     catch (Exception error)
     {
         Device = null;
         Trace.WriteLine(error);
     }
 }
コード例 #2
0
 private RailDriverDevice()
 {
     device = PIEDevice.EnumeratePIE().Where(dev => dev.HidUsagePage == 0xc && dev.Pid == 210).FirstOrDefault();
     if (null != device)
     {
         device.SetupInterface();
         device.SuppressDuplicateReports = true;
         writeBuffer = new byte[WriteBufferSize];
     }
 }
コード例 #3
0
 public XKeysDevice(PIEDevice pieDevice)
 {
     PieDevice   = pieDevice;
     DeviceModel = GetDeviceModel(pieDevice);
     if (DeviceModel == DeviceModelEnum.Unsupported)
     {
         Logger.Error("This plugin does not support the {0} device in mode {1}", pieDevice.ProductString, pieDevice.Pid);
         return;
     }
     pieDevice.SetupInterface();
     pieDevice.SetDataCallback(this);
     pieDevice.SetErrorCallback(this);
     _oldData = new byte[pieDevice.ReadLength];
     GreenIndicatorLight(pieDevice);
     Dim();
     UnitId = ReadUnitId();
 }
コード例 #4
0
 public Device(PIEDevice pieDevice)
 {
     PieDevice = pieDevice;
     pieDevice.SetupInterface();
     if (!string.Equals(pieDevice.ProductString, "XK-24 HID", StringComparison.Ordinal))
     {
         Logger.Error("This plugin does not support the {0} device", pieDevice.ProductString);
         return;
     }
     if (pieDevice.Pid != 1029)
     {
         Logger.Error("Invalid XKeys device PID mode: {0}, should be 1029 (mode 1)", pieDevice.Pid);
         return;
     }
     pieDevice.SetDataCallback(this);
     pieDevice.SetErrorCallback(this);
     _oldData = new byte[pieDevice.ReadLength];
     GreenIndicatorLight(pieDevice);
     Dim();
     UnitId = ReadUnitId();
 }
コード例 #5
0
 private void Button_Click_3(object sender, RoutedEventArgs e)
 {
     _devices = PIEDevice.EnumeratePIE(1523);
     _xkeyPad = _devices[0];
     _xkeyPad.SetupInterface();
     _xkeyPad.SetDataCallback(this);
     _xkeyPad.SetErrorCallback(this);
 }
コード例 #6
0
        public void Reconnect()
        {
            BackingObject.SetupInterface(false);

            HandleDeviceConnected(BackingObject.Connected);
        }