new Device(deviceJson)
Represents a device
Client API Level 2Parameters:
Name | Type | Description |
---|---|---|
deviceJson |
string | Json describing this device |
Properties:
Name | Type | Description |
---|---|---|
Device.sendErrorCallback |
function | Function that is called if an errorCallback is not included for a send operation |
Device.sendFinishedCallback |
function | Function that is called if a finishedCallback is not included for a send operation |
Device.readErrorCallback |
function | Function that is called if an errorCallback is not included for a read operation |
Device.readFinishedCallback |
function | Function that is called if an errorCallback is not included for a read operation |
- Source:
Methods
read(finishedCallback, errorCallbackopt)
Read data from the device
Client API Level 2Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
finishedCallback |
function | The function that is called when reading is completed, passing in the data read. | |
errorCallback |
function |
<optional> |
The function that is called when an error occurs while reading, passing in the error message if there is one. |
- Source:
send(dataToSend, finishedCallbackopt, errorCallbackopt)
Send data to the device
Client API Level 2Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
dataToSend |
string | The data to be sent to the device | |
finishedCallback |
function |
<optional> |
The function that is called when sending is completed. |
errorCallback |
function |
<optional> |
The function that is called when an error occurs while sending. |
- Source:
sendThenRead(dataToSend, finishedCallback, errorCallbackopt)
Send data to the device, then read a response back
Client API Level 2Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
dataToSend |
string | The data to be sent to the device | |
finishedCallback |
function | The function that is called when reading is completed. | |
errorCallback |
function |
<optional> |
The function that is called when an error occurs while sending or reading data. |
- Source:
sendUrl(urlOfResource, finishedCallbackopt, errorCallbackopt)
Send contents of url to the device
Client API Level 2Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
urlOfResource |
string | The url from which data will be retrieved and be sent to the device | |
finishedCallback |
function |
<optional> |
The function that is called when sending is completed. |
errorCallback |
function |
<optional> |
The function that is called when an error occurs while sending. |
- Source: