Description:
The RegisterForNotification
method registers the
client to receive data from one sensor channel.
This is an asynchronous method.
Syntax:
result = so.ISensor.RegisterForNotification(criteria, callback);
Arguments:
criteria
:
This is an object that specifies the sensor channel to listen for data. For more information about the object properties and how to define them, see section Criteria for receiving sensor data.
callback
:
The callback
argument is the name of the method
that is executed when a RegisterForNotification
call
has results or status information to return. You must define this method separately.
Follow the instructions in section Defining the callback handler for an asynchronous method to
define the callback
method.
Return value:
The RegisterForNotification
method returns an object
that contains the initial return value for the asynchronous call it started
(see the following table). The actual sensor data is returned by the callback
method
in the ReturnValue
property of its result object. The
returned data is described in section Returned sensor data.
Property |
Description |
Value |
---|---|---|
|
This is a number used as an identification to match transactions started
with the |
|
|
This is a number that specifies a predefined error code. |
|
|
This is a text string that describes the error. |
Remarks:
RegisterForNotification
retrieves sensor
data until cancelled with Cancel
.
Invoking the same call on the same sensor channel from the
same user without cancelling the previous RegisterForNotification
request
results in an error, since the channel is already listening on the pre-registered
notifications.
Example code:
For the complete source of a sample widget that demonstrates how to use this Service API, see the full example.