ISensorManager::GetSensorByID method

Retrieves a pointer to the specified sensor.

Syntax


HRESULT GetSensorByID(
  [in]  REFSENSOR_ID sensorID,
  [out] ISensor      **ppSensor
);

Parameters

sensorID [in]

The ID of the sensor to retrieve.

ppSensor [out]

Address of an ISensor interface pointer that receives a pointer to the requested sensor. Will be NULL if the requested sensor cannot be found.

Return value

The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return codeDescription
S_OK

The method succeeded.

E_UNEXPECTED

The sensor manager found more than one sensor with the same ID.

HRESULT_FROM_WIN32(ERROR_NOT_FOUND)

No sensor is available for the specified ID.

E_POINTER

NULL was passed in for ppSensor.

 

Examples

The following example code shows how to retrieve a sensor by using its ID.


ISensor* pSensor = NULL;

// Get the sensor collection.
hr = pSensorManager->GetSensorByID(SAMPLE_SENSOR_TIME_ID, &pSensor);



Requirements

Minimum supported client

Windows 7 [desktop apps only]

Minimum supported server

None supported

Header

Sensorsapi.h

Library

Sensorsapi.lib

DLL

Sensorsapi.dll

See also

ISensorManager
Retrieving a Sensor Object

 

 

Community Additions

ADD
Show: