Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 08:38, 7 April 2008.

CS000887 - Displaying information about available sensors

From Forum Nokia Wiki


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

Overview

This snippet displays information about available sensors on your device. The following information is displayed:

  • Sensor name
  • Sensor ID
  • Sensor category

Note: In order to use the code, you need to install the sensor plug-in for your SDK.

This snippet can be self-signed.

MMP file

The following libraries are required:

LIBRARY  RRSensorApi.lib

Source file

#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

Postconditions

Information about available sensors is displayed.

 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtopicQUqfnTopicZhardwareQ
     qfnZtopicQUqfnTopicZsensorQ
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX