GetChannelProperty is used to get the channel property of the specified sensor channel.
The following is an example for using GetChannelProperty:
sensor_handle.call('GetChannelProperty',
{'ChannelInfoMap':{'ChannelId': result['ChannelId'],
'ContextType': result['ContextType'],
'Quantity': result['Quantity'],
'ChannelType': result['ChannelType'],
'Location': result['Location'],
'VendorId': result['VendorId'],
'DataItemSize': result['DataItemSize'],
'ChannelDataTypeId': result['ChannelDataTypeId']},
'propertyId': u'DataRate'})
The following table summarizes the specification of GetChannelProperty:
| Interface | ISensor |
| Description | Gets the specified property of a sensor channel. |
| Response Model | Synchronous |
| Pre-condition | ISensor interface is loaded. |
| Post-condition | Client application receives the requested property details. |
Input Parameters
Input parameters define the ChannelInfoMap and PropertyId.
|
Output Parameters
Output contains ReturnValue. It also contains ErrorCode and an ErrorMessage if the operation fails. ReturnValue contains the requested channel property.
|
Errors
The following table lists the error codes and their values:
|
Error Messages
The following table lists the error messages and their description:
|
Example
The following sample code illustrates how to get the specified property of sensor channel:
try:
result = sensor_handle.call('FindSensorChannel',
{'SearchCriterion': u'Rotation'})
ChannelId = result[0]['ChannelId']
ContextType = result[0]['ContextType']
Quantity = result[0]['Quantity']
ChannelType = result[0]['ChannelType']
Location = result[0]['Location']
VendorId = result[0]['VendorId']
DataItemSize = result[0]['DataItemSize']
ChannelDataTypeId = result[0]['ChannelDataTypeId']
result = sensor_handle.call('GetChannelProperty',
{'ChannelInfoMap':{'ChannelId': ChannelId,
'ContextType': ContextType,
'Quantity': Quantity,
'ChannelType': ChannelType,
'Location': Location,
'VendorId': VendorId,
'DataItemSize': DataItemSize,
'ChannelDataTypeId': ChannelDataTypeId},
'PropertyId': u'DataRate'})
print "Property Id: ", result["PropertyId"]
print "PropertyDataType: ", result["PropertyDataType"]
print "ItemIndex: ", result["ItemIndex"]
print "ReadOnly: ", result["ReadOnly"]
print "PropertyValue: ",result["PropertyValue"]
except scriptext.ScriptextError, err:
print "Error performing the operation : ", err
See About this document... for information on suggesting changes.