The base class to all types of sensor class is _Sensor. This class provides the methods: set_callback, start_listening, and stop_listening that are common to all the sensor class objects. The individual sensor class objects must be used for a specific sensor.
Function signature: __init__([data_filter=None])
data_filter argument is only applicable for *XYZAxisData and RotationData sensor classes.
Possible Values: MedianFilter(), LowPassFilter()
LowPassFilterare standard noise filtering algorithms that provide a smoother form of a signal removing the short-term oscillations, leaving only the long-term trend.
Set Data and Error Callback
Function signature: set_callback(data_callback, [error_callback=None])
Sets the data and error callback function. The error callback function will get an argument that contains a map with Channel ID and error string. The data callback function is not passed with any arguments.
Open and Listen
Function signature: start_listening()
Opens the sensor channel and start listening. Returns
True on success and
False on failure.
Stop and Close
Function signature: stop_listening()
Stop listening to the open channel and close the channel. To start receiving updates again the start_listening method can be called on the same sensor object.
Set/Get Sensor Channel Property
Each sensor class has methods which can be used to set or get the sensor channel properties like data rate, measure range, axis active etc...
The sensor classes have one or more attributes which contains the data returned by the respective sensor. These attributes will be set before the registered data callback function is called and can be accessed using the respective sensor class object.
See About this document... for information on suggesting changes.