ISensorManager interface

Provides methods for discovering and retrieving available sensors and a method to request sensor manager events.

Methods

The ISensorManager interface has these methods.

Method Description
ISensorManager::GetSensorByID Retrieves a pointer to the specified sensor.
ISensorManager::GetSensorsByCategory Retrieves a collection containing all sensors associated with the specified category.
ISensorManager::GetSensorsByType Retrieves a collection containing all sensors associated with the specified type.
ISensorManager::RequestPermissions Opens a system dialog box to request user permission to access sensor data.
ISensorManager::SetEventSink Specifies the interface through which to receive sensor manager event notifications.

Remarks

You retrieve a pointer to this interface by calling the COM CoCreateInstance method. If group policy does not allow creation of this object, CoCreateInstance will return HRESULT_FROM_WIN32 (ERROR_ACCESS_DISABLED_BY_POLICY).

Examples

The following example code creates an instance of the sensor manager.

C++
// Create the sensor manager.
hr = CoCreateInstance(CLSID_SensorManager, 
                        NULL, CLSCTX_INPROC_SERVER,
                        IID_PPV_ARGS(&pSensorManager));

if(hr == HRESULT_FROM_WIN32(ERROR_ACCESS_DISABLED_BY_POLICY)) { // Unable to retrieve sensor manager due to // group policy settings. Alert the user. }

Requirements

   
Windows version Windows 7 [desktop apps only] None supported
Target Platform Windows
Header sensorsapi.h

See Also

COM Interfaces