Ejemplo n.º 1
0
 void OnDeviceRemoved(IOReturn result, IOHIDDevice device)
 {
     if (DeviceRemoved != null)
     {
         DeviceRemoved(this, new IOHIDDeviceEventArgs(result, device));
     }
 }
Ejemplo n.º 2
0
 void OnMatchingDeviceFound(IOReturn result, IOHIDDevice device)
 {
     if (MatchingDeviceFound != null)
     {
         MatchingDeviceFound(this, new IOHIDDeviceEventArgs(result, device));
     }
 }
Ejemplo n.º 3
0
        public IOHIDDevice[] GetDevices()
        {
            ThrowIfDisposed();
            var setRef = IOHIDManagerCopyDevices(Handle);

            if (setRef == IntPtr.Zero)
            {
                return(new IOHIDDevice[0]);
            }
            using (var deviceSet = new CFSet(setRef, true)) {
                var devices = new IOHIDDevice[deviceSet.Count];
                int i       = 0;
                foreach (var devicePtr in deviceSet.Values)
                {
                    devices [i++] = new IOHIDDevice(devicePtr, true);
                }
                return(devices);
            }
        }
Ejemplo n.º 4
0
 public IOHIDDeviceEventArgs(IOReturn result, IOHIDDevice device) : base(result)
 {
     Device = device;
 }