#[repr(C)]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.
Sourcepub unsafe fn device(self: &IOHIDElement) -> CFRetained<IOHIDDevice>
pub unsafe fn device(self: &IOHIDElement) -> CFRetained<IOHIDDevice>
Obtain the device associated with the element.
Parameter element: IOHIDElement to be queried.
Returns: Returns the a reference to the device.
Sourcepub unsafe fn parent(self: &IOHIDElement) -> Option<CFRetained<IOHIDElement>>
pub unsafe fn parent(self: &IOHIDElement) -> 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 unsafe fn children(self: &IOHIDElement) -> Option<CFRetained<CFArray>>
pub unsafe fn children(self: &IOHIDElement) -> 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 unsafe fn attach(self: &IOHIDElement, to_attach: &IOHIDElement)
pub unsafe fn attach(self: &IOHIDElement, 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 unsafe fn detach(self: &IOHIDElement, to_detach: &IOHIDElement)
pub unsafe fn detach(self: &IOHIDElement, 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 unsafe fn attached(self: &IOHIDElement) -> Option<CFRetained<CFArray>>
pub unsafe fn attached(self: &IOHIDElement) -> 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 unsafe fn type(self: &IOHIDElement) -> IOHIDElementType
pub unsafe fn type(self: &IOHIDElement) -> 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 unsafe fn collection_type(self: &IOHIDElement) -> IOHIDElementCollectionType
pub unsafe fn collection_type(self: &IOHIDElement) -> 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 unsafe fn usage_page(self: &IOHIDElement) -> u32
pub unsafe fn usage_page(self: &IOHIDElement) -> 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 unsafe fn usage(self: &IOHIDElement) -> u32
pub unsafe fn usage(self: &IOHIDElement) -> 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 unsafe fn is_virtual(self: &IOHIDElement) -> bool
pub unsafe fn is_virtual(self: &IOHIDElement) -> 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 unsafe fn is_relative(self: &IOHIDElement) -> bool
pub unsafe fn is_relative(self: &IOHIDElement) -> 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 unsafe fn is_wrapping(self: &IOHIDElement) -> bool
pub unsafe fn is_wrapping(self: &IOHIDElement) -> 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 unsafe fn is_array(self: &IOHIDElement) -> bool
pub unsafe fn is_array(self: &IOHIDElement) -> 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 unsafe fn is_non_linear(self: &IOHIDElement) -> bool
pub unsafe fn is_non_linear(self: &IOHIDElement) -> 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 unsafe fn has_preferred_state(self: &IOHIDElement) -> bool
pub unsafe fn has_preferred_state(self: &IOHIDElement) -> 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 unsafe fn has_null_state(self: &IOHIDElement) -> bool
pub unsafe fn has_null_state(self: &IOHIDElement) -> 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 unsafe fn name(self: &IOHIDElement) -> CFRetained<CFString>
pub unsafe fn name(self: &IOHIDElement) -> 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 unsafe fn report_id(self: &IOHIDElement) -> u32
pub unsafe fn report_id(self: &IOHIDElement) -> 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 unsafe fn report_size(self: &IOHIDElement) -> u32
pub unsafe fn report_size(self: &IOHIDElement) -> 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 unsafe fn report_count(self: &IOHIDElement) -> u32
pub unsafe fn report_count(self: &IOHIDElement) -> 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 unsafe fn unit(self: &IOHIDElement) -> u32
pub unsafe fn unit(self: &IOHIDElement) -> 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 unsafe fn unit_exponent(self: &IOHIDElement) -> u32
pub unsafe fn unit_exponent(self: &IOHIDElement) -> 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 unsafe fn logical_min(self: &IOHIDElement) -> CFIndex
pub unsafe fn logical_min(self: &IOHIDElement) -> 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 unsafe fn logical_max(self: &IOHIDElement) -> CFIndex
pub unsafe fn logical_max(self: &IOHIDElement) -> 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 unsafe fn physical_min(self: &IOHIDElement) -> CFIndex
pub unsafe fn physical_min(self: &IOHIDElement) -> 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 unsafe fn physical_max(self: &IOHIDElement) -> CFIndex
pub unsafe fn physical_max(self: &IOHIDElement) -> 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 unsafe fn property(
self: &IOHIDElement,
key: &CFString,
) -> Option<CFRetained<CFType>>
pub unsafe fn property( self: &IOHIDElement, 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: &IOHIDElement,
key: &CFString,
property: &CFType,
) -> bool
pub unsafe fn set_property( self: &IOHIDElement, 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.
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