MasterScan  Lab_Matlab_control Master Branch
List of all members | Protected Properties | Static Methods | Private Methods
mexHIDUsage Class Reference

Overview

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.

Inheritance diagram for mexHIDUsage:
Inheritance graph
[legend]

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...
 

Constructor

◆ mexHIDUsage()

self mexHIDUsage ( )
private

Constructor is private.

Use mexHIDUsage.theObject to access the current instance.

Methods

◆ gui()

static fig gui ( )
static

Open a figure which summarizes usages and pages by name and number.

Properties and Events

◆ usageNumbersToNames

Property usageNumbersToNames
protected

Many containers.Map of HID usage number -> name, one for each usage page.

Contained in a containers.Map with page number keys.

◆ usageNamesToNumbers

Property usageNamesToNumbers
protected

Many containers.Map of HID usage name -> number, one for each usage page.

Contained in a containers.Map with page number keys.

◆ pageEnum

Property pageEnum = 'kHIDPage_(\w+)\s=\s0x(\w+)'
protected

Regular expression to get a page declaration out of the topmost enum.

The tokens are:

  • the page name
  • the page number in hex

◆ pageUsageEnumFinder

Property pageUsageEnumFinder = 'Page\s\(0x(\w+)\)\s\*\/'
protected

Regular expression to get the enum for a particular usage page.

The token is:

  • the page number in hex

◆ usageEnum

Property usageEnum = 'kHIDUsage_([a-zA-Z]+)_(\w+)\s=\s0x(\w+)'
protected

Regular expression to get a usage declaration out of an enum.

The tokens are:

  • Apple's abbreviated usage page name
  • the usage name
  • the usage number in hex

◆ usageEnumNoAbr

Property usageEnumNoAbr = 'kHIDUsage_(\w+)\s=\s0x(\w+)'
protected

Regular expression to get a usage declaration out of an enum when there is no Apple abbreviation.

The tokens are:

  • the usage name
  • the usage number in hex

The documentation for this class was generated from the following file: