MasterScan
Lab_Matlab_control Master Branch
|
Look up names and values for working with Human Interface Devices.
HID is a general-purpose specification for how to communicate with Himan Interface Devices. Part of the HID specification provides numeric "usage" and "type" values that devices can report about themselves to an operating system or program (like Matlab and mexHID()). These values are not obvious, for example 2 might mean "Input_Button" or "Simulation", and 6 might mean "Keyboard".
mexHIDUsage() attempts to make these meanings clearer. It provides static methods that map the numeric usage values to human-readable string names. There are a few different types of mapping:
The mexHIDUsage.gui() method opens a figure which summarizes all of the HID usage pages and individual usages by name and number.
The mexHID() function, which actually interacts with HID devices requires numeric usage, page, and type values inorder to do things like find a device or device elements suitable for a given task. mexHIDUsage should make finding the correct values less mysterious.
During development, I (Ben Heasly) used the HID Usages contained in IOHIDUsageTables.h, which is part of the OS X UIKit framework, to build lookuptables. I also copied by hand the element type enum from IOHIDKeys.h. Users should not need to worry about this, since they can use the tables saved for Matlab in the mexHIDUsageMat file.
Protected Properties | |
Property | pageNumberToName |
containers.Map of HID usage page number -> name | |
Property | pageNameToNumber |
containers.Map of HID usage page name -> number | |
Property | usageNumbersToNames |
Many containers.Map of HID usage number -> name, one for each usage page. More... | |
Property | usageNamesToNumbers |
Many containers.Map of HID usage name -> number, one for each usage page. More... | |
Property | elementTypeNameToNumber |
containers.Map of HID element type name -> number | |
Property | elementTypeNumberToName |
containers.Map of HID element type number -> name | |
Property | mexHIDUsageMat = 'mexHIDUsage.mat' |
Filename with path to .mat file containing mexHIDUsage data. | |
Property | pageEnum = 'kHIDPage_(\w+)\s=\s0x(\w+)' |
Regular expression to get a page declaration out of the topmost enum. More... | |
Property | pageUsageEnumFinder = 'Page\s\(0x(\w+)\)\s\*\/' |
Regular expression to get the enum for a particular usage page. More... | |
Property | usageEnum = 'kHIDUsage_([a-zA-Z]+)_(\w+)\s=\s0x(\w+)' |
Regular expression to get a usage declaration out of an enum. More... | |
Property | usageEnumNoAbr = 'kHIDUsage_(\w+)\s=\s0x(\w+)' |
Regular expression to get a usage declaration out of an enum when there is no Apple abbreviation. More... | |
Static Methods | |
static obj | theObject () |
Access the current instance. | |
static | reset () |
Reload page, usage, and type data. | |
static fig | gui () |
Open a figure which summarizes usages and pages by name and number. More... | |
Private Methods | |
self | mexHIDUsage () |
Constructor is private. More... | |
|
private |
Constructor is private.
Use mexHIDUsage.theObject to access the current instance.
|
static |
Open a figure which summarizes usages and pages by name and number.
|
protected |
Many containers.Map of HID usage number -> name, one for each usage page.
Contained in a containers.Map with page number keys.
|
protected |
Many containers.Map of HID usage name -> number, one for each usage page.
Contained in a containers.Map with page number keys.
|
protected |
Regular expression to get a page declaration out of the topmost enum.
The tokens are:
|
protected |
Regular expression to get the enum for a particular usage page.
The token is:
|
protected |
Regular expression to get a usage declaration out of an enum.
The tokens are:
|
protected |
Regular expression to get a usage declaration out of an enum when there is no Apple abbreviation.
The tokens are: