Exemplo n.º 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);
     }
 }
Exemplo n.º 2
0
        public PiEngineeringDevice(Network network, PIEDevice device)
            : base(network, DeviceType.Keypad)
        {
            BackingObject = device;
            _keypad = new PiEngineeringKeypad(this);

            BackingObject.SetErrorCallback(this);

            Reconnect();
        }
Exemplo n.º 3
0
        public PiEngineeringDevice(Network network, PIEDevice device)
            : base(network, DeviceType.Keypad)
        {
            BackingObject = device;
            _keypad       = new PiEngineeringKeypad(this);

            BackingObject.SetErrorCallback(this);

            Reconnect();
        }
Exemplo n.º 4
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();
 }
Exemplo n.º 5
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();
 }
 public void SetActiveDevice(PIEDevice activeDevice)
 {
     activeDevice.SetErrorCallback(this);
 }
Exemplo n.º 7
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);
 }