FindSensorChannel()

Description:

The FindSensorChannel method searches for sensor channels available on the device.

This is a synchronous method.

Syntax:

FindSensorChannel(parameters:Object):Object

Arguments:

Return value:

The FindSensorChannel method returns an object that contains the requested sensor channel information, an error code, and an error message.

Table: Return value properties for FindSensorChannel

Property

Description

Value

ReturnValue

This is an array of objects that contains information about the sensor channels matching the search criteria.

See Sensor channel information.

ErrorCode

This is a number that specifies a predefined error code.

See Service API error codes.

ErrorMessage

This is a text string that describes the error.

Example code:

The following sample code illustrates how to find a specific sensor:

import com.nokia.lib.Service;
var sensor = new Service("Service.Sensor", "ISensor");
var inParams = {SearchCriterion:"Orientation"};
var outParams = sensor.FindSensorChannel(inParams);
if (outParams.ErrorCode == 0) {
  var channelInfo = outParams.ReturnValue;

  var channelId = channelInfo[0].ChannelId;

} else {
  var errorId = outParams.ErrorCode;
}