pub struct IOHIDElement { /* private fields */ }hid only.Expand description
This is the type of a reference to the IOHIDElement.
See also Apple’s documentation
Implementations§
Source§impl IOHIDElement
impl IOHIDElement
Sourcepub unsafe fn with_dictionary(
allocator: Option<&CFAllocator>,
dictionary: &CFDictionary,
) -> CFRetained<IOHIDElement>
pub unsafe fn with_dictionary( allocator: Option<&CFAllocator>, dictionary: &CFDictionary, ) -> CFRetained<IOHIDElement>
Creates an element from a dictionary.
The dictionary should contain keys defined in IOHIDKeys.h and start with kIOHIDElement. This call is meant be used by a IOHIDDeviceDeviceInterface object.
Parameter allocator: Allocator to be used during creation.
Parameter dictionary: dictionary containing values in which to create element.
Returns: Returns a new IOHIDElementRef.
§Safety
dictionary generics must be of the correct type.
Sourcepub fn device(&self) -> CFRetained<IOHIDDevice>
pub fn device(&self) -> CFRetained<IOHIDDevice>
Obtain the device associated with the element.
Parameter element: IOHIDElement to be queried.
Returns: Returns the a reference to the device.
Sourcepub fn parent(&self) -> Option<CFRetained<IOHIDElement>>
pub fn parent(&self) -> Option<CFRetained<IOHIDElement>>
Returns the parent for the element.
The parent element can be an element of type kIOHIDElementTypeCollection.
Parameter element: The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
Returns: Returns an IOHIDElementRef referencing the parent element.
Sourcepub fn children(&self) -> Option<CFRetained<CFArray>>
pub fn children(&self) -> Option<CFRetained<CFArray>>
Returns the children for the element.
An element of type kIOHIDElementTypeCollection usually contains children.
Parameter element: The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
Returns: Returns an CFArrayRef containing element objects of type IOHIDElementRef.
Sourcepub fn attach(&self, to_attach: &IOHIDElement)
pub fn attach(&self, to_attach: &IOHIDElement)
Establish a relationship between one or more elements.
This is useful for grouping HID elements with related functionality.
Parameter element: The element to be modified. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
Parameter toAttach: The element to be attached. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
Sourcepub fn detach(&self, to_detach: &IOHIDElement)
pub fn detach(&self, to_detach: &IOHIDElement)
Remove a relationship between one or more elements.
This is useful for grouping HID elements with related functionality.
Parameter element: The element to be modified. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
Parameter toDetach: The element to be detached. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
Sourcepub fn attached(&self) -> Option<CFRetained<CFArray>>
pub fn attached(&self) -> Option<CFRetained<CFArray>>
Obtain attached elements.
Attached elements are those that have been grouped via IOHIDElementAttach.
Parameter element: The element to be modified. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
Returns: Returns a copy of the current attached elements.
Retrieves the cookie for the element.
The IOHIDElementCookie represent a unique identifier for an element within a device.
Parameter element: The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
Returns: Returns the IOHIDElementCookie for the element.
Sourcepub fn type(&self) -> IOHIDElementType
pub fn type(&self) -> IOHIDElementType
Retrieves the type for the element.
Parameter element: The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
Returns: Returns the IOHIDElementType for the element.
Sourcepub fn collection_type(&self) -> IOHIDElementCollectionType
pub fn collection_type(&self) -> IOHIDElementCollectionType
Retrieves the collection type for the element.
The value returned by this method only makes sense if the element type is kIOHIDElementTypeCollection.
Parameter element: The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
Returns: Returns the IOHIDElementCollectionType for the element.
Sourcepub fn usage_page(&self) -> u32
pub fn usage_page(&self) -> u32
Retrieves the usage page for an element.
Parameter element: The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
Returns: Returns the usage page for the element.
Sourcepub fn usage(&self) -> u32
pub fn usage(&self) -> u32
Retrieves the usage for an element.
Parameter element: The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
Returns: Returns the usage for the element.
Sourcepub fn is_virtual(&self) -> bool
pub fn is_virtual(&self) -> bool
Returns the virtual property for the element.
Indicates whether the element is a virtual element.
Parameter element: The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
Returns: Returns the TRUE if virtual or FALSE if not.
Sourcepub fn is_relative(&self) -> bool
pub fn is_relative(&self) -> bool
Returns the relative property for the element.
Indicates whether the data is relative (indicating the change in value from the last report) or absolute (based on a fixed origin).
Parameter element: The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
Returns: Returns TRUE if relative or FALSE if absolute.
Sourcepub fn is_wrapping(&self) -> bool
pub fn is_wrapping(&self) -> bool
Returns the wrap property for the element.
Wrap indicates whether the data “rolls over” when reaching either the extreme high or low value.
Parameter element: The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
Returns: Returns TRUE if wrapping or FALSE if non-wrapping.
Sourcepub fn is_array(&self) -> bool
pub fn is_array(&self) -> bool
Returns the array property for the element.
Indicates whether the element represents variable or array data values. Variable values represent data from a
physical control. An array returns an index in each field that corresponds to the pressed button
(like keyboard scan codes).
Note:
The HID Manager will represent most elements as “variable” including the possible usages of an array.
Array indices will remain as “array” elements with a usage of 0xffffffff.
Parameter element: The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
Returns: Returns TRUE if array or FALSE if variable.
Sourcepub fn is_non_linear(&self) -> bool
pub fn is_non_linear(&self) -> bool
Returns the linear property for the element.
Indicates whether the value for the element has been processed in some way, and no longer represents a linear relationship between what is measured and the value that is reported.
Parameter element: The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
Returns: Returns TRUE if non linear or FALSE if linear.
Sourcepub fn has_preferred_state(&self) -> bool
pub fn has_preferred_state(&self) -> bool
Returns the preferred state property for the element.
Indicates whether the element has a preferred state to which it will return when the user is not physically interacting with the control.
Parameter element: The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
Returns: Returns TRUE if preferred state or FALSE if no preferred state.
Sourcepub fn has_null_state(&self) -> bool
pub fn has_null_state(&self) -> bool
Returns the null state property for the element.
Indicates whether the element has a state in which it is not sending meaningful data.
Parameter element: The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
Returns: Returns TRUE if null state or FALSE if no null state.
Sourcepub fn name(&self) -> CFRetained<CFString>
pub fn name(&self) -> CFRetained<CFString>
Returns the name for the element.
Parameter element: The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
Returns: Returns CFStringRef containing the element name.
Sourcepub fn report_id(&self) -> u32
pub fn report_id(&self) -> u32
Returns the report ID for the element.
The report ID represents what report this particular element belongs to.
Parameter element: The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
Returns: Returns the report ID.
Sourcepub fn report_size(&self) -> u32
pub fn report_size(&self) -> u32
Returns the report size in bits for the element.
If the element is an array type the total number of bit in the element is equal to IOHIDElementGetReportSize(element) * IOHIDElementGetReportCount(element). Otherwise this size is the total number of bits in the element.
Parameter element: The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
Returns: Returns the report size.
Sourcepub fn report_count(&self) -> u32
pub fn report_count(&self) -> u32
Returns the report count for the element.
If the IOHIDElementGetReportCount(element) is greater than one and the element does not represent an array then the element represents a repeated set of usages, the size of each usage in the element is IOHIDElementGetReportSize(element) / IOHIDElementGetReportCount(element).
Parameter element: The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
Returns: Returns the report count.
Sourcepub fn unit(&self) -> u32
pub fn unit(&self) -> u32
Returns the unit property for the element.
The unit property is described in more detail in Section 6.2.2.7 of the “Device Class Definition for Human Interface Devices(HID)” Specification, Version 1.11.
Parameter element: The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
Returns: Returns the unit.
Sourcepub fn unit_exponent(&self) -> u32
pub fn unit_exponent(&self) -> u32
Returns the code associated with the unit exponent as outlined in the HID spec
The unit exponent property is described in more detail in Section 6.2.2.7 of the “Device Class Definition for Human Interface Devices(HID)” Specification, Version 1.11.
Parameter element: The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
Returns: Returns the unit exponent.
Sourcepub fn logical_min(&self) -> CFIndex
pub fn logical_min(&self) -> CFIndex
Returns the minimum value possible for the element.
This corresponds to the logical minimun, which indicates the lower bounds of a variable element.
Parameter element: The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
Returns: Returns the logical minimum.
Sourcepub fn logical_max(&self) -> CFIndex
pub fn logical_max(&self) -> CFIndex
Returns the maximum value possible for the element.
This corresponds to the logical maximum, which indicates the upper bounds of a variable element.
Parameter element: The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
Returns: Returns the logical maximum.
Sourcepub fn physical_min(&self) -> CFIndex
pub fn physical_min(&self) -> CFIndex
Returns the scaled minimum value possible for the element.
Minimum value for the physical extent of a variable element. This represents the value for the logical minimum with units applied to it.
Parameter element: The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
Returns: Returns the physical minimum.
Sourcepub fn physical_max(&self) -> CFIndex
pub fn physical_max(&self) -> CFIndex
Returns the scaled maximum value possible for the element.
Maximum value for the physical extent of a variable element. This represents the value for the logical maximum with units applied to it.
Parameter element: The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
Returns: Returns the physical maximum.
Sourcepub fn property(&self, key: &CFString) -> Option<CFRetained<CFType>>
pub fn property(&self, key: &CFString) -> Option<CFRetained<CFType>>
Returns the an element property.
Property keys are prefixed by kIOHIDElement and declared in IOHIDKeys.h.
Parameter element: The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
Parameter key: The key to be used when querying the element.
Returns: Returns the property.
Sourcepub unsafe fn set_property(&self, key: &CFString, property: &CFType) -> bool
pub unsafe fn set_property(&self, key: &CFString, property: &CFType) -> bool
Sets an element property.
This method can be used to set arbitrary element properties, such as application specific references.
Parameter element: The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
Parameter key: The key to be used when querying the element.
Returns: Returns TRUE if successful.
§Safety
property should be of the correct type.
Methods from Deref<Target = CFType>§
Sourcepub fn downcast_ref<T>(&self) -> Option<&T>where
T: ConcreteType,
pub fn downcast_ref<T>(&self) -> Option<&T>where
T: ConcreteType,
Attempt to downcast the type to that of type T.
This is the reference-variant. Use CFRetained::downcast if you
want to convert a retained type. See also ConcreteType for more
details on which types support being converted to.
Sourcepub fn retain_count(&self) -> usize
pub fn retain_count(&self) -> usize
Get the reference count of the object.
This function may be useful for debugging. You normally do not use this function otherwise.
Beware that some things (like CFNumbers, small CFStrings etc.) may
not have a normal retain count for optimization purposes, and can
return usize::MAX in that case.
Trait Implementations§
Source§impl AsRef<AnyObject> for IOHIDElement
impl AsRef<AnyObject> for IOHIDElement
Source§impl AsRef<CFType> for IOHIDElement
impl AsRef<CFType> for IOHIDElement
Source§impl AsRef<IOHIDElement> for IOHIDElement
impl AsRef<IOHIDElement> for IOHIDElement
Source§impl Borrow<AnyObject> for IOHIDElement
impl Borrow<AnyObject> for IOHIDElement
Source§impl Borrow<CFType> for IOHIDElement
impl Borrow<CFType> for IOHIDElement
Source§impl ConcreteType for IOHIDElement
impl ConcreteType for IOHIDElement
Source§impl Debug for IOHIDElement
impl Debug for IOHIDElement
Source§impl Deref for IOHIDElement
impl Deref for IOHIDElement
Source§impl Hash for IOHIDElement
impl Hash for IOHIDElement
Source§impl Message for IOHIDElement
impl Message for IOHIDElement
Source§impl PartialEq for IOHIDElement
impl PartialEq for IOHIDElement
Source§impl RefEncode for IOHIDElement
impl RefEncode for IOHIDElement
Source§const ENCODING_REF: Encoding
const ENCODING_REF: Encoding
Source§impl Type for IOHIDElement
impl Type for IOHIDElement
Source§fn retain(&self) -> CFRetained<Self>where
Self: Sized,
fn retain(&self) -> CFRetained<Self>where
Self: Sized,
Source§fn as_concrete_TypeRef(&self) -> &Self
fn as_concrete_TypeRef(&self) -> &Self
core-foundation crate.Source§unsafe fn wrap_under_get_rule(ptr: *const Self) -> CFRetained<Self>where
Self: Sized,
unsafe fn wrap_under_get_rule(ptr: *const Self) -> CFRetained<Self>where
Self: Sized,
core-foundation crate. Read moreSource§fn as_CFTypeRef(&self) -> &CFType
fn as_CFTypeRef(&self) -> &CFType
core-foundation crate.Source§unsafe fn wrap_under_create_rule(ptr: *const Self) -> CFRetained<Self>where
Self: Sized,
unsafe fn wrap_under_create_rule(ptr: *const Self) -> CFRetained<Self>where
Self: Sized,
core-foundation crate. Read more