Nodejs library to connect your devices to Iven Cloud.
$ npm install ivencloud
ivencloud.setCredentials(
{
deviceUid: "your device uid",
secretKey: "your secret key"
});
ivencloud.sendData(data, function(err, res) {
if (err)
console.log(err);
else
console.log(res);
});
- Ivencloud
- instance
- inner
- ~TasksCallback :
function
- ~TasksDoneCallback :
function
- ~callback :
function
- ~TasksCallback :
Sets the credentials for authentication.
Kind: instance method of Ivencloud
Param | Type | Default | Description |
---|---|---|---|
[creds] | Object |
The credentials to be set | |
creds.deviceUid | string |
Device UId of the device | |
creds.secretKey | string |
Secret Key of the hardware profile of the device | |
[creds.apiKey] | string |
API-KEY of the device | |
[creds.hostname] | string |
"demo.iven.io" |
Hostname of the server to be connect |
Sends data to the cloud. If the device is not activated it will activates the device. If the api key expires it will renew the api key
Kind: instance method of Ivencloud
Param | Type | Default | Description |
---|---|---|---|
[options] | Object |
The credentials to be set. If you set credentials with activate of setCredentials method you dont need to pass anything | |
[options.apiKey] | string |
API-KEY of the device | |
[options.deviceUid] | string |
Device UId of the device | |
[options.secretKey] | string |
Secret Key of the hardware profile of the device | |
[options.apiKey] | string |
API-KEY of the device | |
[options.hostname] | string |
"demo.iven.io" |
Hostname of the server to be connect |
data | Object |
The object which keys must match with HW Profile keys at Iven Cloud | |
callback | callback |
Asych. called after sends happen |
Activates the device and sets the api key.
Kind: instance method of Ivencloud
Param | Type | Description |
---|---|---|
[options] | Object |
The credentials to be set. If you set device credentials you dont have to pass anything to options |
[options.deviceUid] | string |
Device UId of the device |
[options.secretKey] | string |
Secret Key of the hardware profile of the device |
callback | callback |
Asych. called after activate happens |
Gets the tasks assigned to device if any
Kind: instance method of Ivencloud
Param | Type | Description |
---|---|---|
[options] | Object |
The credentials to be set |
[options.apiKey] | string |
API-KEY of the device |
callback | TasksCallback |
Asych. called after |
Sets the task to completed on Iven Cloud. Call this after you handle the related task assigned to device
Kind: instance method of Ivencloud
Param | Type | Description |
---|---|---|
[options] | Object |
The credentials to be set |
[options.apiKey] | string |
API-KEY of the device |
taskCode | number |
Code of the completed task |
callback | TasksDoneCallback |
Asych. called after |
Returns the tasks.
Kind: inner typedef of Ivencloud
Param | Type | Description |
---|---|---|
err | Object | null |
return error object in case of error, else null |
res | Object | undefined |
response from the cloud or nothing in case of error |
res.tasCode | number |
task code of the task, zero if no tasks are assigned |
res.taskValue | string |
value of the task, empty if no value |
Returns the tasks.
Kind: inner typedef of Ivencloud
Param | Type | Description |
---|---|---|
err | Object | null |
return error object in case of error, else null. |
res | Object | undefined |
response from the cloud or nothing in case of error. |
res.status | number |
200 if successful* |
Callback after an request is made to cloud.
Kind: inner typedef of Ivencloud
Param | Type | Description |
---|---|---|
err | Object | null |
return error object in case of error, else null. |
res | Object | undefined |
response from the cloud or nothing in case of error. |
res.ivenCode | number |
iven code |
res.apiKey | string |
api key of the device |