void OnInputValueReceived (IOReturn result, IOHIDValue value) { if (InputValueReceived != null) InputValueReceived (this, new IOHIDValueEventArgs (result, value)); }
public IDictionary<IOHIDElement, IOHIDValue> GetValues (IOHIDElement[] elements) { ThrowIfDisposed (); if (elements == null) throw new ArgumentNullException ("elements"); var elementArray = CFArray.FromNativeObjects (elements); IOHIDElement[] keys = new IOHIDElement[elements.Length]; IOHIDValue[] values = new IOHIDValue[elements.Length]; CFDictionary multiple = CFDictionary.FromObjectsAndKeys (values, keys); var multipleRef = multiple.Handle; var result = IOHIDDeviceCopyValueMultiple (Handle, elementArray.Handle, ref multipleRef); IOObject.ThrowIfError (result); var dict = new Dictionary<IOHIDElement, IOHIDValue> (multiple.Count); IntPtr[] keyRefs, valueRefs; multiple.GetKeysAndValues (out keyRefs, out valueRefs); for (int i = 0; i < multiple.Count; i++) dict.Add (new IOHIDElement (keyRefs [i], true), new IOHIDValue (valueRefs [i], true)); CFType.Release (multiple.Handle); return dict; }
public IOHIDValueEventArgs (IOReturn result, IOHIDValue value) : base (result) { Value = value; }
public void SetValue (IOHIDElement element, IOHIDValue value) { ThrowIfDisposed (); if (element == null) throw new ArgumentNullException ("element"); if (value == null) throw new ArgumentNullException ("value"); var result = IOHIDDeviceSetValue (Handle, element.Handle, value.Handle); IOObject.ThrowIfError (result); }