Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
101 <strong>HID</strong> <strong>Sensor</strong> <strong>Usage</strong>s<br />
enum GorPK_KIND {<br />
category_guid = 1,<br />
type_guid,<br />
event_propertykey,<br />
property_propertykey,<br />
datafield_propertykey<br />
};<br />
typedef struct _GUID_OR_PROPERTYKEY {<br />
GorPK_KIND Kind;<br />
unsigned char TopLevelCollection;<br />
unsigned char ReportId;<br />
unsigned char PackingPosition;<br />
FIRMWARE_VARTYPE Vartype;<br />
unsigned char Modifier;<br />
unsigned char UnitOfMeasure;<br />
unsigned char UnitsExponent;<br />
unsigned char ReportSize;<br />
unsigned char ReportCount;<br />
GUID fmtid;<br />
unsigned long pid;<br />
} GUID_OR_PROPERTYKEY;<br />
Many of the members of the GUID_OR_PROPERTYKEY define attributes of the Report Item that would<br />
otherwise have to be specified in (and parsed out of) the <strong>HID</strong> Report Descriptor:<br />
TopLevelCollection: which <strong>HID</strong> top level collection the Item is a part of;<br />
ReportId: which <strong>HID</strong> report the Item is a part of;<br />
PackingPosition: the sequence order of the Item in a Report when more than one Item is packed<br />
into a single Report;<br />
Vartype: the data type of the Item as intended by the sensor firmware;<br />
Modifier: the associated <strong>HID</strong>_USAGE_SENSOR_DATA_MOD_xxx;<br />
UnitOfMeasure: the associated <strong>HID</strong>_USAGE_SENSOR_UNITS_xxx;<br />
UnitExponent: the associated <strong>HID</strong>_UNIT_EXPONENT;<br />
ReportSize: the associated <strong>HID</strong>_REPORT_SIZE;<br />
ReportCount: the associated <strong>HID</strong>_REPORT_COUNT;<br />
fmtid: the associated GUID of the <strong>Sensor</strong> Category, <strong>Sensor</strong> Type, or <strong>Sensor</strong> Event; or the GUID<br />
portion of the associated PROPERTYKEY;<br />
pid: the PID portion of the associated PROPERTYKEY (for Category, Type, and Event – enter<br />
zero for the PID).<br />
Following is a Generic <strong>Sensor</strong> Report Descriptor that illustrates these concepts. If we apply this example,<br />
the encapsulated fields would be populated as follows for a Speedometer sensor (<strong>HID</strong> <strong>Usage</strong> =<br />
<strong>HID</strong>_USAGE_SENSOR_TYPE_MOTION_SPEEDOMETER).<br />
// Complete <strong>HID</strong> report descriptor<br />
const unsigned char gen_report_descriptor[] = {<br />
<strong>HID</strong>_USAGE_PAGE_SENSOR,<br />
<strong>HID</strong>_USAGE_SENSOR_TYPE_OTHER_GENERIC,<br />
<strong>HID</strong>_COLLECTION(Physical),<br />
//feature reports (xmit/receive)<br />
<strong>HID</strong>_USAGE_PAGE_SENSOR,<br />
<strong>HID</strong>_USAGE_SENSOR_PROPERTY_REPORTING_STATE,<br />
<strong>HID</strong>_LOGICAL_MIN_8(0),<br />
<strong>HID</strong>_LOGICAL_MAX_8(5),<br />
<strong>HID</strong>_REPORT_SIZE(8),<br />
<strong>HID</strong>_REPORT_COUNT(1),<br />
<strong>HID</strong>_COLLECTION(Logical),<br />
<strong>HID</strong>_USAGE_SENSOR_PROPERTY_REPORTING_STATE_NO_EVENTS,<br />
<strong>HID</strong>_USAGE_SENSOR_PROPERTY_REPORTING_STATE_ALL_EVENTS,<br />
<strong>HID</strong>_USAGE_SENSOR_PROPERTY_REPORTING_STATE_THRESHOLD_EVENTS,<br />
<strong>HID</strong>_USAGE_SENSOR_PROPERTY_REPORTING_STATE_NO_EVENTS_WAKE,<br />
<strong>HID</strong>_USAGE_SENSOR_PROPERTY_REPORTING_STATE_ALL_EVENTS_WAKE,<br />
<strong>HID</strong>_USAGE_SENSOR_PROPERTY_REPORTING_STATE_THRESHOLD_EVENTS_WAKE,<br />
<strong>HID</strong>_FEATURE(Data_Arr_Abs),<br />
<strong>HID</strong>_END_COLLECTION,<br />
<strong>HID</strong>_USAGE_SENSOR_PROPERTY_SENSOR_STATUS,<br />
<strong>HID</strong>_LOGICAL_MIN_8(0),<br />
<strong>HID</strong>_LOGICAL_MAX_32(0xFF,0xFF,0xFF,0xFF),<br />
<strong>HID</strong>_REPORT_SIZE(32),<br />
<strong>HID</strong>_REPORT_COUNT(1),<br />
<strong>HID</strong>_FEATURE(Data_Var_Abs), // up to VT_UI4 worth of status info<br />
<strong>HID</strong>_USAGE_SENSOR_DATA_GENERIC_CATEGORY_GUID,<br />
<strong>HID</strong>_REPORT_SIZE(8),