2.0.3 • Published 7 years ago

ivencloud v2.0.3

Weekly downloads
1
License
ISC
Repository
github
Last release
7 years ago

Ivencloud

Nodejs library to connect your devices to Iven Cloud.

Install

$ npm install ivencloud

Usage

ivencloud.setCredentials(
    {
        deviceUid: "your secret key",
        secretKey: "your device uid"
    });

ivencloud.sendData(data, function(err, res) {
    if (err)
        console.log(err);
    else
        console.log(res);
});

Documentation

ivencloud.setCredentials(creds)

Sets the credentials for authentication.

Kind: instance method of Ivencloud

ParamTypeDefaultDescription
credsObjectThe credentials to be set
creds.deviceUidstringDevice UId of the device
creds.secretKeystringSecret Key of the hardware profile of the device
creds.apiKeystringAPI-KEY of the device
creds.hostnamestring"demo.iven.io"Hostname of the server to be connect

ivencloud.sendData(options, data, callback)

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

ParamTypeDefaultDescription
optionsObjectThe credentials to be set. If you set credentials with activate of setCredentials method you dont need to pass anything
options.apiKeystringAPI-KEY of the device
options.deviceUidstringDevice UId of the device
options.secretKeystringSecret Key of the hardware profile of the device
options.apiKeystringAPI-KEY of the device
options.hostnamestring"demo.iven.io"Hostname of the server to be connect
dataObjectThe object which keys must match with HW Profile keys at Iven Cloud
callbackcallbackAsych. called after sends happen

ivencloud.activate(options, callback)

Activates the device and sets the api key.

Kind: instance method of Ivencloud

ParamTypeDescription
optionsObjectThe credentials to be set. If you set device credentials you dont have to pass anything to options
options.deviceUidstringDevice UId of the device
options.secretKeystringSecret Key of the hardware profile of the device
callbackcallbackAsych. called after activate happens

ivencloud.getTasks(options, callback)

Gets the tasks assigned to device if any

Kind: instance method of Ivencloud

ParamTypeDescription
optionsObjectThe credentials to be set
options.apiKeystringAPI-KEY of the device
callbackTasksCallbackAsych. called after

ivencloud.taskDone(options, taskCode, callback)

Sets the task to completed on Iven Cloud. Call this after you handle the related task assigned to device

Kind: instance method of Ivencloud

ParamTypeDescription
optionsObjectThe credentials to be set
options.apiKeystringAPI-KEY of the device
taskCodenumberCode of the completed task
callbackTasksDoneCallbackAsych. called after

Ivencloud~TasksCallback : function

Returns the tasks.

Kind: inner typedef of Ivencloud

ParamTypeDescription
errObject | nullreturn error object in case of error, else null
resObject | undefinedresponse from the cloud or nothing in case of error
res.tasCodenumbertask code of the task, zero if no tasks are assigned
res.taskValuestringvalue of the task, empty if no value

Ivencloud~TasksDoneCallback : function

Returns the tasks.

Kind: inner typedef of Ivencloud

ParamTypeDescription
errObject | nullreturn error object in case of error, else null.
resObject | undefinedresponse from the cloud or nothing in case of error.
res.statusnumber200 if successful*

Ivencloud~callback : function

Callback after an request is made to cloud.

Kind: inner typedef of Ivencloud

ParamTypeDescription
errObject | nullreturn error object in case of error, else null.
resObject | undefinedresponse from the cloud or nothing in case of error.
res.ivenCodenumberiven code
res.apiKeystringapi key of the device
2.0.3

7 years ago

2.0.2

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago