Namespaces
Variants
Actions
Revision as of 08:02, 6 August 2012 by hamishwillee (Talk | contribs)

Archived:Obtaining the number of sensors on a device using Symbian C++

Jump to: navigation, search
Archived.png
Archived: 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 code looks like it would still be valid using Symbian C++ on current versions
Article Metadata

Tested with
Devices(s): Nokia N95 8GB

Compatibility
Platform(s): S60 3rd Edition FP1

Platform Security
Signing Required: Self-Signed

Article
Keywords: CRRSensorApi, TRRSensorInfo, CRRSensorApi::FindSensorsL()
Created: tapiolaitinen (02 Apr 2008)
Last edited: hamishwillee (06 Aug 2012)

Contents

Overview

This snippet demonstrates how to obtain the number of available sensors on your device (for example, two on the Nokia N95 8GB: accelerometer sensor and rotation sensor).

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

MMP file

The following libraries are required:

LIBRARY RRSensorApi.lib

Source file

#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();
 
CleanupStack::PopAndDestroy(); // sensorList

Postconditions

The number of available sensors is obtained.

236 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved