| ID | CS000887 | Creation date | April 7, 2008 |
| Platform | S60 3rd Edition, FP1 | Tested on devices | Nokia N95 8GB |
| Category | Symbian C++ | Subcategory | Hardware, Sensor |
| Keywords (APIs, classes, methods, functions): CRRSensorApi, TRRSensorInfo, CRRSensorApi::FindSensorsL(), TRRSensorInfo::iSensorId, TRRSensorInfo::iSensorCategory, TRRSensorInfo::iSensorName |
This snippet displays information about available sensors on your device. The following information is displayed:
Note: In order to use the code, you need to install the sensor plug-in for your SDK.
This snippet can be self-signed.
The following libraries are required:
LIBRARY RRSensorApi.lib
#include <aknnotewrappers.h> // CAknInformationNote
#include <RRSensorApi.h>
RArray<TRRSensorInfo> sensorList;
CleanupClosePushL(sensorList);
// Retrieve list of available sensors
CRRSensorApi::FindSensorsL(sensorList);
// Get number of sensors available
TInt sensorCount = sensorList.Count();
// Display information about each of the sensors
for (TInt i = 0; i < sensorCount; i++)
{
TInt sensorId = sensorList[i].iSensorId;
TInt sensorCategory = sensorList[i].iSensorCategory;
TBuf<KMaxSensorName> sensorName = sensorList[i].iSensorName;
TBuf<255> buffer;
_LIT(KTxt, "%S: %x, %x");
buffer.Format(KTxt, &sensorName, sensorId, sensorCategory);
CAknInformationNote* note = new (ELeave) CAknInformationNote(ETrue);
note->ExecuteLD(buffer);
}
CleanupStack::PopAndDestroy(); // sensorList
Information about available sensors is displayed.
No related wiki articles found