ivencloud

2.0.3 • Public • Published

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

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

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

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

ivencloud.activate([options], callback)

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

ivencloud.getTasks([options], callback)

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

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

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

Ivencloud~TasksCallback : function

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

Ivencloud~TasksDoneCallback : function

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*

Ivencloud~callback : function

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

Package Sidebar

Install

npm i ivencloud

Weekly Downloads

6

Version

2.0.3

License

ISC

Last publish

Collaborators

  • biozdilek