Edit

Share via


ISensorManager interface (sensorsapi.h)

Important

Use the UWP Sensor API instead.

The COM-based Sensor API is deprecated and should not be used in new applications. No additional features or enhancements are planned, and support will be limited.

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

Inheritance

The ISensorManager interface inherits from the IUnknown interface.

Methods

The ISensorManager interface has these methods.

 
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.

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

Requirement Value
Minimum supported client Windows 7 [desktop apps only]
Minimum supported server None supported
Target Platform Windows
Header sensorsapi.h

See also

COM Interfaces