Supporting the sensor properties

Each sensor header file contains a data structure that defines the properties supported by that sensor. Some of these properties are common to all sensors. The remaining properties are unique to the specific sensor.

As an example of common properties, in the following definition of ACCELEROMETER_DEVICE_PROPERTIES from Accelerometer.h, the common properties are found after these comments:

  • // from input report
  • // from feature report
  • // Extended properties

typedef struct _ACCELEROMETER_DEVICE_PROPERTIES
{
    // from input report
    BOOL   fSensorStateSupported;
    BOOL   fEventTypeSupported;

    // supported datafields
    BOOL   fAccelerometerXAxisSupported;
    BOOL   fAccelerometerYAxisSupported;
    BOOL   fAccelerometerZAxisSupported;

    // from feature report
    BOOL   fReportingStateSupported;
    ULONG  ulReportingState;
    BOOL   fSensorStatusSupported;
    ULONG  ulSensorStatus;
    BOOL   fReportIntervalSupported;
    ULONG  ulReportInterval;

    // Per-datafield properties
    BOOL   fAccelerometerSensitivitySupported;
    FLOAT  fltAccelerometerSensitivity;
    BOOL   fAccelerometerXSensitivitySupported;
    FLOAT  fltAccelerometerXSensitivity;
    BOOL   fAccelerometerYSensitivitySupported;
    FLOAT  fltAccelerometerYSensitivity;
    BOOL   fAccelerometerZSensitivitySupported;
    FLOAT  fltAccelerometerZSensitivity;
    
    BOOL   fAccelerometerMaximumSupported;
    FLOAT  fltAccelerometerMaximum;
    BOOL   fAccelerometerXMaximumSupported;
    FLOAT  fltAccelerometerXMaximum;
    BOOL   fAccelerometerYMaximumSupported;
    FLOAT  fltAccelerometerYMaximum;
    BOOL   fAccelerometerZMaximumSupported;
    FLOAT  fltAccelerometerZMaximum;

    BOOL   fAccelerometerMinimumSupported;
    FLOAT  fltAccelerometerMinimum;
    BOOL   fAccelerometerXMinimumSupported;
    FLOAT  fltAccelerometerXMinimum;
    BOOL   fAccelerometerYMinimumSupported;
    FLOAT  fltAccelerometerYMinimum;
    BOOL   fAccelerometerZMinimumSupported;
    FLOAT  fltAccelerometerZMinimum;

    BOOL   fAccelerometerAccuracySupported;
    FLOAT  fltAccelerometerAccuracy;
    BOOL   fAccelerometerXAccuracySupported;
    FLOAT  fltAccelerometerXAccuracy;
    BOOL   fAccelerometerYAccuracySupported;
    FLOAT  fltAccelerometerYAccuracy;
    BOOL   fAccelerometerZAccuracySupported;
    FLOAT  fltAccelerometerZAccuracy;

    BOOL   fAccelerometerResolutionSupported;
    FLOAT  fltAccelerometerResolution;
    BOOL   fAccelerometerXResolutionSupported;
    FLOAT  fltAccelerometerXResolution;
    BOOL   fAccelerometerYResolutionSupported;
    FLOAT  fltAccelerometerYResolution;
    BOOL   fAccelerometerZResolutionSupported;
    FLOAT  fltAccelerometerZResolution;

    //Extended properties
    BOOL   fConnectionTypeSupported;
    ULONG  ulConnectionType;
    BOOL   fMinimumReportIntervalSupported;
    ULONG  ulMinimumReportInterval;
    BOOL   fFriendlyNameSupported;
    WCHAR  wszFriendlyName[HID_FEATURE_REPORT_STRING_MAX_LENGTH];
    BOOL   fPersistentUniqueIDSupported;
    WCHAR  wszPersistentUniqueID[HID_FEATURE_REPORT_STRING_MAX_LENGTH];
    BOOL   fManufacturerSupported;
    WCHAR  wszManufacturer[HID_FEATURE_REPORT_STRING_MAX_LENGTH];
    BOOL   fModelSupported;
    WCHAR  wszModel[HID_FEATURE_REPORT_STRING_MAX_LENGTH];
    BOOL   fSerialNumberSupported;
    WCHAR  wszSerialNumber[HID_FEATURE_REPORT_STRING_MAX_LENGTH];
    BOOL   fDescriptionSupported;
    WCHAR  wszDescription[HID_FEATURE_REPORT_STRING_MAX_LENGTH];

} ACCELEROMETER_DEVICE_PROPERTIES, *PACCELEROMETER_DEVICE_PROPERTIES;


For the accelerometer, the unique properties include the supported data fields and the corresponding properties for each data field.

Related topics

The Sensor Diagnostic Tool
The Sensors HID Driver Sample
Writing a Sensor Device Driver

 

 

Send comments about this topic to Microsoft

Build date: 11/29/2012

Show:
© 2014 Microsoft