GetChannelProperty()

Description:

The GetChannelProperty method retrieves information about a sensor channel property.

This is a synchronous method.

Syntax:

GetChannelProperty(parameters:Object):Object

Arguments:

Return value:

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

Table: Return value properties for GetChannelProperty

Property

Description

Value

ReturnValue

This is an object that contains the information for the specified sensor channel property.

See Returned channel property 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 get the channel property of the specified sensor channel:

import com.nokia.lib.Service;
var sensor = new Service("Service.Sensor", "ISensor");
var channelInfo = {ChannelId:channelId, ContextType:contextType, Quantity:quantity, ChannelType:channelType, Location:location, VendorId:vendorId, DataItemSize:dataItemSize, ChannelDataTypeId:channelDataTypeId};  //Valid values must be passed to Channelinfo
var inParams = {ChannelInfoMap:channelInfo, PropertyId:"DataRate"};
var outParams = sensor.GetChannelProperty(inParams);
if (outParams.ErrorCode == 0) {
  var channelProperty = outParams.ReturnValue;
  var propertyValue = channelProperty.PropertyValue;
} else {
  var errorId = outParams.ErrorCode;
}