示例#1
0
		void OnInputValueReceived (IOReturn result, IOHIDValue value)
		{
			if (InputValueReceived != null)
				InputValueReceived (this, new IOHIDValueEventArgs (result, value));
		}
示例#2
0
		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;
		}
示例#3
0
		public IOHIDValueEventArgs (IOReturn result, IOHIDValue value) : base (result)
		{
			Value = value;
		}
示例#4
0
		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);
		}