Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Archived:Displaying information about available sensors on S60 3rd Edition

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

Remove from Archive?: This article has been marked for removal from archive, for the following reasons:
This information still looks relevant on latest version. Suggest unarchive and rename "Displaying information about available sensors using Symbian C++"

Article Metadata
Tested with
Devices(s): Nokia N95 8GB
Compatibility
Platform(s): S60 3rd Edition FP1
S60 3rd Edition FP1
Platform Security
Signing Required: Self-Signed
Capabilities: None
Article
Keywords: CRRSensorApi, TRRSensorInfo, CRRSensorApi::FindSensorsL(), TRRSensorInfo::iSensorId, TRRSensorInfo::iSensorCategory, TRRSensorInfo::iSensorName
Created: tapiolaitinen (02 Apr 2008)
Last edited: hamishwillee (06 Aug 2012)

Contents

Overview

This snippet displays information about available sensors on your device.

The following information is displayed:

  • Sensor name
  • Sensor ID
  • Sensor category

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

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.

This page was last modified on 6 August 2012, at 05:54.
55 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×