Exemplo n.º 1
0
        public static List <string> GetAllDevices()
        {
            var ret = new List <string>();

            var candidates = HIDDevice.GetAllDevices(_VENDOR_ID, _PRODUCT_ID1);

            foreach (var c in HIDDevice.GetAllDevices(_VENDOR_ID, _PRODUCT_ID2))
            {
                candidates.Add(c);
            }

            foreach (var device in candidates)
            {
                var d = new WiiInputDevice(device, null);
                Thread.Sleep(1000);
                bool found = d.ExtensionType.HasValue && d.ExtensionType.Value == 0xFF00A4200112;
                d.Disconnect();
                d.Dispose();
                d = null;

                if (found)
                {
                    ret.Add(device);
                }
            }

            return(ret);
        }
Exemplo n.º 2
0
        public static bool IsDetected(int vendorId, int productId)
        {
            var device = new HIDDevice(vendorId, productId, false);
              bool ret = device.Found;

              device.Dispose();

              return ret;
        }
Exemplo n.º 3
0
        public static bool IsDetected(int vendorId, int productId)
        {
            var  device = new HIDDevice(vendorId, productId, false);
            bool ret    = device.Found;

            device.Dispose();

            return(ret);
        }
Exemplo n.º 4
0
        public PS3uDrawTabletDevice()
        {
            ButtonState = new TabletButtonState();
              DPadState = new TabletDPadState();
              UnknownData1 = new byte[_UNKNOWN_DATA1_SIZE];
              AccelerometerData = new TabletAccelerometerData();

              _device = new HIDDevice(_VENDOR_ID, _PRODUCT_ID);
              _device.DataReceived += _device_DataReceived;
        }
Exemplo n.º 5
0
        public PS3uDrawTabletDevice()
        {
            ButtonState       = new TabletButtonState();
            DPadState         = new TabletDPadState();
            UnknownData1      = new byte[_UNKNOWN_DATA1_SIZE];
            AccelerometerData = new TabletAccelerometerData();

            _device = new HIDDevice(_VENDOR_ID, _PRODUCT_ID);
            _device.DataReceived += _device_DataReceived;
        }
Exemplo n.º 6
0
        private unsafe void _Init(int vendorId, int productId, bool throwNotFoundError)
        {
            var devices = HIDDevice.GetAllDevices(vendorId, productId);

            if (devices != null && devices.Count > 0)
            {
                _Init(devices[0], throwNotFoundError);
            }
            else
            {
                if (throwNotFoundError)
                {
                    throw new InvalidOperationException("Device not found");
                }
            }
        }
Exemplo n.º 7
0
        public WiiInputDevice(string devicePath, int? index)
        {
            ButtonState = new TabletButtonState();
              DPadState = new TabletDPadState();
              AccelerometerData = new TabletAccelerometerData();
              _acknowledgements = new Dictionary<byte, int>();

              _device = new HIDDevice(devicePath);

              //Initialize the device
              Index = index;
              _device.DataReceived += _device_DataReceived;
              if (index.HasValue)
              {
            EnableLEDs(index.Value == 0, index.Value == 1, index.Value == 2, index.Value == 3);
              }

              //Get the initial status
              _lastReportingMode = 0x37;
              RefreshStatus();
        }
Exemplo n.º 8
0
        public WiiInputDevice(string devicePath, int?index)
        {
            ButtonState       = new TabletButtonState();
            DPadState         = new TabletDPadState();
            AccelerometerData = new TabletAccelerometerData();
            _acknowledgements = new Dictionary <byte, int>();

            _device = new HIDDevice(devicePath);

            //Initialize the device
            Index = index;
            _device.DataReceived += _device_DataReceived;
            if (index.HasValue)
            {
                EnableLEDs(index.Value == 0, index.Value == 1, index.Value == 2, index.Value == 3);
            }

            //Get the initial status
            _lastReportingMode = 0x37;
            RefreshStatus();
        }
Exemplo n.º 9
0
 /// <summary>
 /// Detects whether the PS3 uDraw tablet device is currently attached to the PC.
 /// This is only detecting the presence of the USB dongle, NOT whether it is sync'd with the tablet.
 ///   I don't know how to do that.
 /// </summary>
 /// <returns></returns>
 public static bool IsDetected()
 {
     return(HIDDevice.IsDetected(_VENDOR_ID, _PRODUCT_ID));
 }