{"id":13616,"date":"2023-10-10T08:10:41","date_gmt":"2023-10-10T13:10:41","guid":{"rendered":"https:\/\/docs.iotconnect.io\/partnerprogram\/?page_id=13616"},"modified":"2023-10-25T07:46:15","modified_gmt":"2023-10-25T12:46:15","slug":"client-libraries-and-sdks","status":"publish","type":"page","link":"https:\/\/docs.iotconnect.io\/partnerprogram\/resources\/client-libraries-and-sdks\/","title":{"rendered":"Client libraries and sdk&#8217;s"},"content":{"rendered":"<h3 class=\"inner_head_title\">SDK Reference<\/h3>\n<p>This document details the specification about \/IOTCONNECT\u2122 SDK. The purpose of this document is to define a fundamental approach of SDK.<\/p>\n<p>Most applications have prerequisites. In order to start with SDK development, a developer needs to have clear fundamentals on Device\u00adCloud and Cloud\u00adDevice communication. They are also required to a have good knowledge about cloud operations and need access to a few cloud APIs.<\/p>\n<div class=\"inner_one\">\n<h3 class=\"inner_head_title\">SDK Overview<\/h3>\n<p>\/IOTCONNECT\u2122 SDK (System Development Kit) is highly secure and reliable, which solves the purpose of Device to Cloud and Cloud to Device communications. It is a mediator between the Device and Cloud platform.<\/p>\n<p><strong>Key features for device SDK<\/strong><\/p>\n<ul>\n<li>Easy to connect device with cloud by using SDK<\/li>\n<li>Publish sensor data on cloud (D2C communication)<\/li>\n<li>Receive command from cloud (C2D communication)<\/li>\n<li>Get a list of sensors which are predefined in \/IOTCONNECT\u2122 platform<\/li>\n<\/ul>\n<h3 class=\"inner_head_title\">Prerequisites<\/h3>\n<p>To configure the SDK, the user needs to have completed the steps mentioned below.<\/p>\n<h4>Step 1: Registration and onboarding on Partner Program<\/h4>\n<h4>Step 2: Register a company<\/h4>\n<ol>\n<li>Sign in to the portal<\/li>\n<\/ol>\n<p>Enter username and password. If you don\u2019t already have one, contact <a href=\"mailto:info@iotconnect.io\">info@iotconnect.io<\/a> for registration.<\/p>\n<ol start=\"2\">\n<li>Get the CPID from the \/IOTCONNECT\u2122 DevLab.<\/li>\n<\/ol>\n<p>Note: CPID provided must be hardcoded into the Device\u2019s firmware.<\/p>\n<p><strong>Step 3: Create a new template<\/strong><\/p>\n<ol>\n<li>Login to the \/IOTCONNECT\u2122 portal<\/li>\n<li>Go to Menu &gt; Device &gt; Template, to open the Device Template List.<\/li>\n<li>From the Device Template List, press on the \u201cAdd Template\u201d button to create new template.<\/li>\n<li>Create template with the following details: (See image below)\n<ol>\n<li>Template Code<\/li>\n<li>Template Name<\/li>\n<li>Major Firmware<\/li>\n<li>Description<\/li>\n<li>Authentication Type<\/li>\n<li>Edge Support<\/li>\n<li>Gateway Device<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p><em>Note: At least one attribute should be added while creating a new template.<\/em><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-6795\" src=\"https:\/\/knowledgebase.iotconnect.io\/wp-content\/uploads\/2019\/06\/Create-Template-Attributes-1-2.png\" alt=\"\" width=\"1390\" height=\"603\" srcset=\"https:\/\/docs.iotconnect.io\/partnerprogram\/wp-content\/uploads\/2019\/06\/Create-Template-Attributes-1-2.png 1390w, https:\/\/docs.iotconnect.io\/partnerprogram\/wp-content\/uploads\/2019\/06\/Create-Template-Attributes-1-2-300x130.png 300w, https:\/\/docs.iotconnect.io\/partnerprogram\/wp-content\/uploads\/2019\/06\/Create-Template-Attributes-1-2-768x333.png 768w, https:\/\/docs.iotconnect.io\/partnerprogram\/wp-content\/uploads\/2019\/06\/Create-Template-Attributes-1-2-1024x444.png 1024w\" sizes=\"(max-width: 1390px) 100vw, 1390px\" \/><\/p>\n<p style=\"text-align: center;\"><em>(Screen: Edit Template)<\/em><\/p>\n<h4>Step 4: Add new device<\/h4>\n<p>Two options are available to add a new device.<\/p>\n<ol>\n<li>Add a New Device from Menu &gt; Device &gt; Devices &gt; Add Device<\/li>\n<\/ol>\n<p>Add a New Device with the following details:<\/p>\n<ul>\n<li>Unique ID<\/li>\n<li>Display Name<\/li>\n<li>Entity<\/li>\n<li>Template<\/li>\n<li>Notes<\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-6796\" src=\"https:\/\/knowledgebase.iotconnect.io\/wp-content\/uploads\/2019\/06\/create-device-1-1.png\" alt=\"\" width=\"1033\" height=\"482\" srcset=\"https:\/\/docs.iotconnect.io\/partnerprogram\/wp-content\/uploads\/2019\/06\/create-device-1-1.png 1033w, https:\/\/docs.iotconnect.io\/partnerprogram\/wp-content\/uploads\/2019\/06\/create-device-1-1-300x140.png 300w, https:\/\/docs.iotconnect.io\/partnerprogram\/wp-content\/uploads\/2019\/06\/create-device-1-1-768x358.png 768w, https:\/\/docs.iotconnect.io\/partnerprogram\/wp-content\/uploads\/2019\/06\/create-device-1-1-1024x478.png 1024w\" sizes=\"(max-width: 1033px) 100vw, 1033px\" \/><\/p>\n<p style=\"text-align: center;\"><em>(Screen: Create Device)<\/em><\/p>\n<p>For Gateway Support device only (When you select template with Gateway support)<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-6798\" src=\"https:\/\/knowledgebase.iotconnect.io\/wp-content\/uploads\/2019\/06\/Device-Details-_-Edit-Mode_Type2-1.png\" alt=\"\" width=\"1377\" height=\"518\" srcset=\"https:\/\/docs.iotconnect.io\/partnerprogram\/wp-content\/uploads\/2019\/06\/Device-Details-_-Edit-Mode_Type2-1.png 1377w, https:\/\/docs.iotconnect.io\/partnerprogram\/wp-content\/uploads\/2019\/06\/Device-Details-_-Edit-Mode_Type2-1-300x113.png 300w, https:\/\/docs.iotconnect.io\/partnerprogram\/wp-content\/uploads\/2019\/06\/Device-Details-_-Edit-Mode_Type2-1-768x289.png 768w, https:\/\/docs.iotconnect.io\/partnerprogram\/wp-content\/uploads\/2019\/06\/Device-Details-_-Edit-Mode_Type2-1-1024x385.png 1024w\" sizes=\"(max-width: 1377px) 100vw, 1377px\" \/><\/p>\n<p>2. Add a New Device from Menu &gt; Device &gt; Batch Import<\/p>\n<p>Add a New Device with the following details:<\/p>\n<ul>\n<li>Download sample file and fill expected device information<\/li>\n<li>Device Entity<\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-6799\" src=\"https:\/\/knowledgebase.iotconnect.io\/wp-content\/uploads\/2019\/06\/Batch-Import-List-1.png\" alt=\"\" width=\"1394\" height=\"369\" srcset=\"https:\/\/docs.iotconnect.io\/partnerprogram\/wp-content\/uploads\/2019\/06\/Batch-Import-List-1.png 1394w, https:\/\/docs.iotconnect.io\/partnerprogram\/wp-content\/uploads\/2019\/06\/Batch-Import-List-1-300x79.png 300w, https:\/\/docs.iotconnect.io\/partnerprogram\/wp-content\/uploads\/2019\/06\/Batch-Import-List-1-768x203.png 768w, https:\/\/docs.iotconnect.io\/partnerprogram\/wp-content\/uploads\/2019\/06\/Batch-Import-List-1-1024x271.png 1024w\" sizes=\"(max-width: 1394px) 100vw, 1394px\" \/><\/p>\n<h3 class=\"inner_head_title\">Workflow<\/h3>\n<p>As we know SDK is meant to design for Device-Cloud and Cloud-Device communication. This communication happens through different communication channels. Mainly SDK communicates through HTTP(S) and MQTT protocols. This communication includes device initialization, telemetry data transfer and device command execution.<\/p>\n<p>The following diagram is to understand how communication happens through SDK.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-4860\" src=\"https:\/\/knowledgebase.iotconnect.io\/wp-content\/uploads\/2019\/06\/Diagram-01-e1562072973390-1.png\" alt=\"\" width=\"1018\" height=\"1092\" srcset=\"https:\/\/docs.iotconnect.io\/partnerprogram\/wp-content\/uploads\/2019\/06\/Diagram-01-e1562072973390-1.png 1018w, https:\/\/docs.iotconnect.io\/partnerprogram\/wp-content\/uploads\/2019\/06\/Diagram-01-e1562072973390-1-280x300.png 280w, https:\/\/docs.iotconnect.io\/partnerprogram\/wp-content\/uploads\/2019\/06\/Diagram-01-e1562072973390-1-768x824.png 768w, https:\/\/docs.iotconnect.io\/partnerprogram\/wp-content\/uploads\/2019\/06\/Diagram-01-e1562072973390-1-955x1024.png 955w\" sizes=\"(max-width: 1018px) 100vw, 1018px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h3 class=\"inner_head_title\">SDK Integration<\/h3>\n<ol>\n<li>Initialize \/ create \/IOTCONNECT\u2122SDK object<\/li>\n<li>Receive data \/ callback function<\/li>\n<li>Send data<\/li>\n<li>Get sensor list<\/li>\n<li>Update twin property<\/li>\n<li>Send acknowledgement<\/li>\n<\/ol>\n<h5>1. Initialize \/ Create \/IOTCONNECT\u2122SDK object<\/h5>\n<p>New instance of \/IOTCONNECT\u2122SDK SYNC API from the cloud using string (cpld, uniqueld, environment and callbackfunction) parameters. \u201cenv\u201d is optional, default \u201cenv\u201d is production, you can get your &#8220;env&#8221; from the partner portal. Device sync responses will have all the required information like attributes, settings, sdkConfig, devices &amp; protocols (message broker) connection information, device rule and so on. By using this instance, you can call other methods which are mentioned below.<\/p>\n<p>While initializing the device, we use a variety of authentication methods for device connection as shown below:<\/p>\n<ol>\n<li>SAS Token<\/li>\n<li>X.509 self-signed certificate (For Dev Environment)<\/li>\n<li>X.509 certificate (For Production Environment)<\/li>\n<li>TPM<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p><em>Note: The above authentication type must be selected during the template creation stage, based on which the devices are created. When you select the self-signed or CA-signed authentication type, you need to provide the certificate as defined in the SDK code sample respective to the SDK language.<\/em><\/p>\n<h5>2. Receive data \/ callback function<\/h5>\n<p>To receive data from cloud, we need to implement callback function, which is called automatically and depends on the device connection. It helps you to get the device command from Cloud to Device and perform a predefined action.<\/p>\n<h5>3. Send data<\/h5>\n<p>Once Init() is executed successfully, the device will be able to start publishing telemetry data using the SDK. Based on Init cached data, the SDK needs to make secure MQTT connection with message broker to send data. Before sending the data, make sure that the particular device is active using the web admin. Send data method uses the predefined data format which is explained in the next point.<\/p>\n<h5>4. Get sensor list<\/h5>\n<p>After initializing the \/IOTCONNECT\u2122 SDK instance, you can get the list of sensors which are predefined in the \/IOTCONNECT\u2122 platform. You can send the predefined sensor data in the templates only while other data may be ignored during send data process.<\/p>\n<h5>5. Update twin property<\/h5>\n<p>Device twins are implicitly created and deleted when a device identity is created or deleted in IoT Hub. This is used along with reported properties to synchronize device configuration or conditions. The solution back end can set desired properties and the device app can read them. The device app can also receive notifications of changes in the desired properties. You can update the reported attribute using this method.<\/p>\n<h5>6. Send acknowledgement<\/h5>\n<p>This method is used to send the acknowledgement to the cloud. While getting the firmware command you need to send the confirmation message to the cloud that the firmware upgrade resource URL has successfully reached the device.<\/p>\n<h3 class=\"inner_head_title\">Preferable Sensor Data Input<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">[{\r\n  \"uniqueId\": \"123456\",\r\n  \"time\" : '2018-05-24T10:06:17.857Z', \/\/Date format should be in UTC timezone\r\n  \"data\": {\r\n  \"temperature\": 15.55,\r\n  \"humidity\" : 27.97,\r\n  \"weight\" : 36,\r\n  \"gyroscope\" : {'x' : -1.2, 'y' : 0.25,'z' : 1.1, }\r\n  }\r\n  }];<\/pre>\n<p>  <strong>Explanation:<\/strong><\/p>\n<p>  <strong><em>uniqueId<\/em><\/strong><em>: It is the device uniqueID<\/em><\/p>\n<p>  <strong><em>time<\/em><\/strong><em>: Current date and time with UTC timezone<\/em><\/p>\n<p>  <strong><em>data<\/em><\/strong><em>: Set a JSON data with sensor name and value as per the device generated the data. Make sure you set the all required sensor name in device template as explained in the prerequisite step.<\/em><\/p>\n<h3 class=\"inner_head_title\">OTA Update And Command<\/h3>\n<p>To receive data from the Cloud, we need to implement a <strong><em>callback<\/em><\/strong> function, which is called automatically and depends on the device connection. It helps you to get the device command from Cloud to device and perform a predefined action.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-5683\" src=\"https:\/\/knowledgebase.iotconnect.io\/wp-content\/uploads\/2019\/11\/graphic1.png\" alt=\"\" width=\"766\" height=\"262\" srcset=\"https:\/\/docs.iotconnect.io\/partnerprogram\/wp-content\/uploads\/2019\/11\/graphic1.png 1759w, https:\/\/docs.iotconnect.io\/partnerprogram\/wp-content\/uploads\/2019\/11\/graphic1-300x103.png 300w, https:\/\/docs.iotconnect.io\/partnerprogram\/wp-content\/uploads\/2019\/11\/graphic1-768x263.png 768w, https:\/\/docs.iotconnect.io\/partnerprogram\/wp-content\/uploads\/2019\/11\/graphic1-1024x350.png 1024w\" sizes=\"(max-width: 766px) 100vw, 766px\" \/><\/p>\n<p>Here, we provide two types of devices to Cloud command. You can receive command from <strong><em>callback<\/em><\/strong> function which name is \u201c<strong>callbackMessage<\/strong>\u201d. It has placed in the device initialization method. You need to write the firmware in a way that you can receive the command which is sent by the Cloud and take action.\u00a0 Command is received in the form JSON data, in which you get the key name \u201c<strong><em>cmdType<\/em><\/strong>\u201d with value in the form of <strong><em>hexa<\/em><\/strong><em> <strong>decimal<\/strong><\/em> which is as under:<\/p>\n<p><strong>Command Format<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">{\r\n\r\n\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"cpid\": \"&lt;&lt;your cp id&gt;&gt;\",\r\n\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"cmdType\": \"0x01\", \/\/ different command type for manage OTA and Command\r\n            \"ack\": false,\r\n\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"command\": \"&lt;&lt;your command name&gt;&gt;\",\r\n\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"uniqueId\": \"&lt;&lt;your device id&gt;&gt;\",\r\n\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"ackId\": \"&lt;&lt;system guid&gt;&gt;\",\r\n\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"guid\": \"&lt;&lt;system guid&gt;&gt;\"\r\n\r\n}<\/pre>\n<ol>\n<li><strong> 0x01 (Device Action Command) :<\/strong><\/li>\n<\/ol>\n<p>&#8211; It hleps to take action on any sensor.<\/p>\n<p>Example: <strong><em>&#8220;command&#8221;: &#8220;MOTOR-OFF&#8221;,<\/em><\/strong><\/p>\n<p>&#8211; After command is received, firmware will take care of what to do with the command.<\/p>\n<ol start=\"2\">\n<li><strong> 0x02 (OTA Update Command) :<\/strong><\/li>\n<\/ol>\n<p>&#8211; It helps to get the below command:<\/p>\n<p>Example: <strong><em>&#8220;ota &lt;&lt;Firmware File URL&gt;&gt;&#8221;, <\/em><\/strong><\/p>\n<p>&#8211; It helps to download the updated version of SDK and install it.<\/p>\n<p>&#8211; At the same time, you need to send the acknowledgement of the received message to the Cloud. For that, you need to publish the message with message type acknowledgement (11). It helps IoT Cloud to get the confirmation of the success of firmware package sent.<\/p>\n<p>&#8211; To send acknowledgement you need to follow the below method:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">msgType =\u00a0 11\r\nd2cMsg = {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"guid\" : data['guid'],\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"st\" : 3,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"msg\" : \"\"\r\n}\r\nsdk.SendACK(msgType, d2cMsg)<\/pre>\n<p>&#8211; After acknowledgement is received, the firmware will take care of this command and decide how to download the file URL.<\/p>\n<p>&nbsp;<\/p>\n<\/div>\n<h3 class=\"inner_head_title\">Code Samples<\/h3>\n<p>The Web API can be easily used in C#, Java, Python, or any other development tools supporting communication over the network. \/IOTCONNECT\u2122 SDK provides a set of samples in different programming languages showing how to create a simple client application.<\/p>\n<ul>\n<li>JavaScript (Node.js)<\/li>\n<li>Java<\/li>\n<li>Python<\/li>\n<li>iOS<\/li>\n<li>Objective-C<\/li>\n<li>Android<\/li>\n<li>DOT NET (C#)<\/li>\n<\/ul>\n<div class=\"inner_one\">\n<h3 class=\"inner_head_title\">JavaScript (Node.Js)<\/h3>\n<p>        <strong>Prerequisite tools:<\/strong><\/p>\n<ol>\n<li>NodeJs : Node version v8.9.1 and compatible<\/li>\n<li>Npm : NPM is compatible to the node version 5.5.1<\/li>\n<\/ol>\n<p>    <strong>Installation\u00a0<\/strong><\/p>\n<ol>\n<li>Extract the \u201ciotconnect<strong>\u2013<\/strong>sdk<strong>-node-v1.0.0.zip<\/strong>\u201c<\/li>\n<li>To install the required libraries use the below command:\n<ul>\n<li>Go to SDK directory path using terminal\/Command prompt<\/li>\n<li>cd\u00a0<em>iotconnect-sdk\/<\/em><\/li>\n<li>npm\u00a0<em>install<\/em><\/li>\n<\/ul>\n<\/li>\n<li>Copy the SDK source code(<em>\/IOTCONNECT\u2122SDK<\/em>) into node_modules directory\n<ul>\n<li>cd iotconnect<em>\u2013<\/em>sdk<em>\/node_modules\/<\/em><\/li>\n<\/ul>\n<\/li>\n<li>You can take the sample file from the\u00a0<em>\/IOTCONNECT\u2122SDK<\/em>\u00a0library and put on project root path.\n<ul>\n<li>Source path : cd iotconnect-sdk\/node_modules\/\/IOTCONNECT\u2122SDK\/sample<\/li>\n<li>Destination path : cd iotconnect-sdk\/sample<\/li>\n<\/ul>\n<\/li>\n<li>Using terminal\/command prompt, go to the sample folder.\n<ul>\n<li>cd iotconnect-sdk\/sample<\/li>\n<\/ul>\n<\/li>\n<li>Ready to go:\n<ul>\n<li>\/\/This script can send the data to given input(uniqueid, cpid) device by command prompt.<\/li>\n<li>node example.js\u00a0<em>&lt;&gt;<\/em>\u00a0\/\/Environment DEV, QA, POC, PROD \u2013 (Default if not supply the environment argument)<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>    <strong>Usage<\/strong><\/p>\n<p>    Declare \/IOTCONNECT\u2122 SDK which is placed in node_modules directory.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">var sdk = require('\/IOTCONNECT\u2122SDK');\r\n    <\/pre>\n<p>    Prerequisite input data<\/p>\n<pre class=\"EnlighterJSRAW\">var uniqueId = &lt;&lt;uniqueId&gt;&gt;; \r\n    var cpid = &lt;&lt;CPID&gt;&gt;; \r\n    var env = &lt;&lt;env&gt;&gt;; \/\/ DEV, QA, POC, AVNETPOC, PROD(Default)\r\n    <\/pre>\n<p>    To get the device information and connect to the device<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">var iotConnectSDK = new sdk(cpid, uniqueId, callbackMessage, twinCallbackMessage, env);\r\n    <\/pre>\n<p>    To receive the command from Cloud to Device(C2D)<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">var callbackMessage = function callbackMessage(data){\r\n            console.log(data);\r\n    }var iotConnectSDK = new sdk(cpid, uniqueId, callbackMessage);\r\n    <\/pre>\n<p>    To receive the twin from Cloud to Device(C2D)<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">var twinCallbackMessage = function twinCallbackMessage(data){\r\n        console.log(data); \r\n    }\r\n    <\/pre>\n<p>    To get the list of attributes<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">iotConnectSDK.getAttributes(function(response){\r\n    console.log(\"Attributed :: \"+ response); });\r\n    <\/pre>\n<p>    To send the data from Device To Cloud(D2C)<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\"> iotConnectSDK.SendData(sendTeledata);<\/pre>\n<ul>\n<li>To configure the secure SSL\/x509 connection follow below step for CA or CA Selfsiged certificate\n<ul>\n<li>Open file : otconnect-sdk\/\/IOTCONNECT\u2122SDK\/sample\/properties.json<\/li>\n<li>Set SSL\/x509 certificate path for CA sign and Selfsign certificate as shown below<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">{\r\n            \"certificate\" : { \r\n                    \"SSLKeyPath\"    : \"&lt;&lt; file path &gt;&gt;\/key.pem\",\r\n                    \"SSLCertPath\"   : \"&lt;&lt; file path &gt;&gt;\/cert.pem\",\r\n                    \"SSLCaPath\"     : \"&lt;&lt; file path &gt;&gt;\/ca.cert.pem\"\r\n            }\r\n    }\r\n    <\/pre>\n<p>    To update the Twin Property<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">var key = \"firmware_version\";\r\n    var value = \"4.0\";\r\n    iotConnectSDK.UpdateTwin(key,value, function (response) {\r\n    console.log(\"Twin update :: \",response);\r\n    })<\/pre>\n<p>    <strong>Sample code <\/strong><br \/>\n    Download sample code from the below list. You need to follow the installation steps mentioned above to run the code.<\/p>\n<h3 class=\"inner_head_title\">Java<\/h3>\n<p>        <strong>Prerequisite tools:<\/strong><\/p>\n<ol>\n<li>sdk-1.0-jar-with-dependencies.jar<\/li>\n<li>Java 8 ( or above )<\/li>\n<\/ol>\n<p>    <strong>Installation:<\/strong><\/p>\n<ol>\n<li>Extract the \u201ciotconnect-sdk-java-v1.0.0.zip\u201d<\/li>\n<li>Ready to go:<\/li>\n<\/ol>\n<p>    \/\/This script can send the data to given input (uniqueid, cpid) device by command prompt<\/p>\n<ul>\n<li>java -jar sdk-1.0-jar-with-dependencies.jar<\/li>\n<\/ul>\n<p>    <strong>Usage:<\/strong><\/p>\n<p>    Add library<\/p>\n<p>    Put<em> sdk-1.0-jar-with-dependencies.jar <\/em>file in build path<\/p>\n<p>    Prerequisite input data *<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">uniqueId = &lt;&lt;uniqueId&gt;&gt;; cpid = &lt;&lt;CPID&gt;&gt;; \r\n    env = &lt;&lt;env&gt;&gt;; \/\/ DEV, QA, POC, PROD(Default)\r\n    <\/pre>\n<p>    Create class and implement Interface \u201cSDKCallback\u201d<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">public class JavaSDKClient implements SDKCallback { \r\n    }\r\n    <\/pre>\n<p>    To get the device information and connect to the device<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\"> \r\n    \/IOTCONNECT\u2122SDK ioTConnectSDK = new \/IOTCONNECT\u2122SDKImpl(cpId, uniqueId ,env, callerClassObject);\r\n    <\/pre>\n<p>    Implement method to receive the command from Cloud to Device(C2D)<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">public void sdkCallbackMethod(CloudResponse cloudResponse) {\r\n            if(cloudResponse!=null) {\r\n                    System.out.println(\"ACK : \" + cloudResponse.getAck());\r\n                    System.out.println(\"ACK ID : \" + cloudResponse.getAckId());\r\n                    System.out.println(\"Command : \" + cloudResponse.getCommand());\r\n                    System.out.println(\"UniqueId : \" + cloudResponse.getUniqueId());\r\n                    System.out.println(\"Value : \" + cloudResponse.getValue());\r\n            }\r\n    }\r\n    <\/pre>\n<p>    To send the data from Device To Cloud(D2C)<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">ioTConnectSDK.SendData(sendTeledata)\r\n    <\/pre>\n<h3 class=\"inner_head_title\">Python<\/h3>\n<p>    <strong>Prerequisite tools:<\/strong><\/p>\n<ol>\n<li>Python: Python version 2.7, 3.6 and 3.7<\/li>\n<li>pip: pip is compatible to the python version<\/li>\n<li>setuptools: Required to install IOTConnect SDK<\/li>\n<\/ol>\n<p><strong>Installation for Python version 2.7:<\/strong><\/p>\n<ol>\n<li>Extract the &#8220;iotconnect-sdk-python-v1.0.0.zip&#8221;<\/li>\n<li>To install the required libraries, use the command given below:\n<ul>\n<li>Goto SDK directory path using terminal\/Command prompt<\/li>\n<li>cd iotconnect-sdk\/<\/li>\n<li>pip install iotconnect-sdk-2.0.tar.gz<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<ol start=\"3\">\n<li>Using terminal\/command prompt goto sample folder:\n<ul>\n<li>cd iotconnect-sdk\/sample<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<ol start=\"4\">\n<li>Ready to go: \/\/This script can send the data to given input(uniqueid, cpid) device by command prompt\n<ul>\n<li>python example_py2.py &lt;&gt; \/\/Environment DEV, QA, POC, AVNETPOC, PROD (Default if not supply the environment argument)<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><strong>Usage:<\/strong><\/p>\n<p>Import library<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">from \/IOTCONNECT\u2122SDK import \/IOTCONNECT\u2122SDK\r\n<\/pre>\n<p>Prerequisite input data<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">uniqueId = &lt;&lt;uniqueId&gt;&gt; \r\ncpid = &lt;&lt;CPID&gt;&gt; \r\nenv = &lt;&lt;env&gt;&gt; \/\/ DEV, QA, POC, AVNETPOC, PROD(Default)\r\n<\/pre>\n<p>To get the device information and connect to the device<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">with \/IOTCONNECT\u2122SDK(cpid, uniqueId, callbackMessage, callbackTwinMessage, env) as sdk:\r\n<\/pre>\n<p>To receive the command from Cloud to Device(C2D)<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">def callbackMessage(msg):\r\nprint(msg)\r\n<\/pre>\n<p>To receive the twin from Cloud to Device(C2D)<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">def callbackTwinMessage(msg):\r\nprint(msg)\r\n<\/pre>\n<p>To get the list of attributes<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">sdk.GetAttributes()\r\n<\/pre>\n<p>To send the data from Device To Cloud(D2C)<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">sdk.SendData(sendTeledata)\r\n<\/pre>\n<p>To update the Twin Property<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">key = \"firmware_version\"\r\nvalue = \"4.0\"\r\nsdk.UpdateTwin(key, value)\r\n<\/pre>\n<ul>\n<li>To configure the secure SSL\/x509 connection follow below step for CA or CA Selfsiged certificate<\/li>\n<li>Open file : sample\/properties.json<\/li>\n<li>Set SSL\/x509 certificate path for CA sign and Selfsign certificate as shown below<\/li>\n<\/ul>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">{\r\n        \"certificate\" : { \r\n                \"SSLKeyPath\"    : \"&lt;&lt; file path &gt;&gt;\/key.pem\",\r\n                \"SSLCertPath\"   : \"&lt;&lt; file path &gt;&gt;\/cert.pem\",\r\n                \"SSLCaPath\"     : \"&lt;&lt; file path &gt;&gt;\/ca.cert.pem\"\r\n        }\r\n}<\/pre>\n<p>To send the Firmware update command acknowledgment.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">msgType = 11\r\nd2cMsg = {\r\n\"guid\" : &lt;&lt; GUID &gt;&gt;, \/\/ GUID get from the received command\r\n\"st\" : 3, \/\/ STATUS :: Skipped = 2,Success = 3,Failed = 4\r\n\"msg\" : \"\"\r\n}\r\nsdk.SendACK(msgType, d2cMsg)<\/pre>\n<h3 class=\"inner_head_title\">iOS<\/h3>\n<p>    <strong>Prerequisite tools:<\/strong><\/p>\n<ol>\n<li>Xcode : Minimum iOS 10.0 Compatible<\/li>\n<\/ol>\n<p><strong>Installation:<\/strong><\/p>\n<ol>\n<li>Get the &#8220;\/IOTCONNECT\u2122.framework&#8221; and add in framework in iOS App Project<\/li>\n<\/ol>\n<p><strong>Usage:<\/strong><\/p>\n<p>Import iOS library<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">#import &lt;\/IOTCONNECT\u2122\/\/IOTCONNECT\u2122SDK.h&gt;<\/pre>\n<ul>\n<li>Objective-C *<\/li>\n<\/ul>\n<p>Define SDK object<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">\/IOTCONNECT\u2122SDK *objectIoTSDK;<\/pre>\n<p>SDK Init Call<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">NSString *uniqueId=@\"sdk001\";\r\nNSString *cpId=@\"abcde1\";\r\nNSString *strEnv=@\"poc\u201d;\/\/ DEV  , STAGE  , poc  , QA  , PROD \r\nobjectIoTSDK =[[\/IOTCONNECT\u2122SDK alloc] init: cpId : uniqueId : strEnv :^(id message) {\r\n    \/* Handle Cloud to Device message *\/\r\n}];<\/pre>\n<p>Send sensor data call format<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">var data=[[\r\n\"uniqueId\": \"sdk001\",\r\n\"time\": \"2018-03-08T15:13:13.573Z\",\r\n\"data\": [\"temperature\": \"45\u201d,\"humidity\": \"40\"]\r\n]]\r\nSend Temperature and Humidity\r\nobject\/IOTCONNECT\u2122.sendData(data)NSArray *data=@[@{\r\n                @\"uniqueId\":@\"sdk001\",\r\n                @\"time\":@\"2018-03-06T11:38:53.000Z\",\r\n                @\"data\":@{@\"temperature\":@\"45\",@\"humidity\":@\"40\"\r\n        }\r\n}];<\/pre>\n<p>Send Temperature and Humidity<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">object\/IOTCONNECT\u2122.sendData(data)<\/pre>\n<h3 class=\"inner_head_title\">Objective-C<\/h3>\n<p>    <strong>Prerequisite tools:<\/strong><\/p>\n<ol>\n<li>Arduino IDE 1.6.5 or higher<\/li>\n<li>ESP8266 \/ ESP32 boards installed<\/li>\n<\/ol>\n<p><strong>Installation:<\/strong><\/p>\n<ul>\n<li>Extract the &#8220;ESP32.zip&#8221; or &#8220;ESP8266.zip&#8221; from sdk<\/li>\n<li>To install the required libraries, use the below command:\n<ul>\n<li>Get help from the documentation file<\/li>\n<\/ul>\n<\/li>\n<li>Ready to go:\n<ul>\n<li>This script can send the data to given input(uniqueid, cpid, WiFi information)<\/li>\n<li>Environment DEV, QA, POC, AVNETPOC, PROD &#8211; (Default &#8211; AVNET if the environment argument is not supplied)<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><strong>Usage:<\/strong><\/p>\n<p>Including the libraries (from the zip file)<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">#include \"\/IOTCONNECT\u2122.h\" \/\/ Connection with \/IOTCONNECT\u2122 and other process\r\n#include \"time.h\" \/\/ getting real time from NTP server\r\n<\/pre>\n<p>Define SDK object<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">IOTConnectClient client;<\/pre>\n<p>Prerequisite input data<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">String ENV = \"AVNET\";\r\nString VER = \"2.0\";\r\nchar *ssid = \"yourNetwork\"; \/\/ your network SSID (name)\r\nchar *pass = \"secretPassword\"; \/\/ your network password )\r\nString cpId = \"yourCpid\"; \/\/ your CPID name can grab it from \/IOTCONNECT\u2122 portal\r\nString uniqueID = \"yourUniqueID\"; \/\/ you can grab it from \/IOTCONNECT\u2122 portal\r\n<\/pre>\n<p>To get the device information and connect to the device<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">client.InitializationSDK(cpId, uniqueID, ENV, VER);\r\n\/\/ initialization SDK for \/IOTCONNECT\u2122<\/pre>\n<p>To receive the command from Cloud to Device(C2D)<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">void messageReceived(String &amp;topic, String &amp;payload) { \/\/ callback function\r\nSerial.println(\"incoming &gt;&gt; \" + payload); \/\/ broker on subscribed topic\r\n}<\/pre>\n<p>Data input format<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">DynamicJsonBuffer jsonBufferIN;\r\nJsonArray&amp; Device_data= jsonBufferIN.createArray();\r\nJsonObject&amp; Device_01= Device_data.createNestedObject();\r\nDevice_01[\"uniqueId\"] = uniqueID;\r\nDevice_01[\"time\"] = GetTime();\r\nJsonObject&amp; D01_Sensors=Device_01.createNestedObject(\"data\");\r\nD01_Sensors[\"humidity\"] = random(20, 80);\r\nD01_Sensors[\"Temperature\"] = random(12, 32);\r\nJsonObject&amp; D01_SensorsX= D01_Sensors.createNestedObject(\"Vibration\");\r\nD01_SensorsX[\"x\"] = random(12, 50);\r\nD01_SensorsX[\"y\"] = random(-20, 30);\r\nD01_SensorsX[\"z\"] = random(10, 35);\r\nDevice_data.printTo(DataBuffer, sizeof(DataBuffer));\r\n<\/pre>\n<p>To send the data from Device To Cloud(D2C)<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">client.SendDataINput(DataBuffer);<\/pre>\n<p>To update the Twin Property<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">String key = \"firmware_version\";\r\nString value = \"4.0\";\r\nclient.UpdateTwin(key,value);\r\n<\/pre>\n<p><strong>Sample code <\/strong><br \/>\nDownload sample code from the below list. You need to follow the installation steps mentioned above to run the code.<\/p>\n<h3 class=\"inner_head_title\">Android<\/h3>\n<p>    <strong>Prerequisite tools:<\/strong><\/p>\n<ol>\n<li>Java 8 (or above)<\/li>\n<li>Android SDK<\/li>\n<li>Android Studio<\/li>\n<\/ol>\n<p><strong>Installation:<\/strong><\/p>\n<p>1. Please verify jcenter in your root build.gradle at the end of repositories:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">allprojects {         repositories {\r\n                ...                         jcenter()\r\n        }\r\n}<\/pre>\n<p>2. Add the dependency<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">dependencies {\r\n                implementation 'com.iotconnectsdk:iotconnectpoc:2.0.0'\r\n                \r\n}<\/pre>\n<p><strong>Usage:<\/strong><\/p>\n<p>Add library<\/p>\n<p>Prerequisite input data<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">uniqueId = &lt;&lt;uniqueId&gt;&gt;; cpid = &lt;&lt;CPID&gt;&gt;; env = &lt;&lt;env&gt;&gt;;\r\n\/\/ DEV, QA, POC, AVNETPOC, PROD(Default)<\/pre>\n<p>Create class and implement Interface &#8220;IotSDKCallback&#8221;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">public class JavaSDKClient implements IotSDKCallback { \r\n}<\/pre>\n<p>To get the device information and connect to the device<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">\/IOTCONNECT\u2122SDK ioTConnectSDK = new \/IOTCONNECT\u2122SDK(context,cpid,uniqueId, callerClassObject,env);<\/pre>\n<p>Implement methods to receive the command from Cloud to Device(C2D)<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">public void onReceiveMsg( HubToSdkDataBean cloudResponse) {         if(cloudResponse!=null) {\r\n                System.out.println(\"ACK : \" + cloudResponse.getAck());\r\n                System.out.println(\"ACK ID : \" + cloudResponse.getAckid());\r\n                System.out.println(\"Command : \" + cloudResponse.getCommand());\r\n                System.out.println(\"UniqueId : \" + cloudResponse.getUniqueid());\r\n                System.out.println(\"Value : \" + cloudResponse.getValue());\r\n        }\r\n}<\/pre>\n<p>Get attributesList<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">public void attributeData(final List&lt;SyncServiceResponse.DBeanXX.AttBean&gt;\r\nattributesBeanList) { }<\/pre>\n<p>Get connection status<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">public void onConnectionStateChange(boolean isConnected) { \r\n}<\/pre>\n<p>To send the data from Device To Cloud(D2C)<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">ioTConnectSDK.SendData(sendTeledata)<\/pre>\n<p>Disconnect iotConnect on Activtiy onDestroy<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">@Override\r\n    protected void onDestroy() {         super.onDestroy();         if(iotConnect!=null)\r\n        {\r\n            ioTConnectSDK.disconnectSDK();\r\n        }\r\n    }<\/pre>\n<p><strong>Sample code <\/strong><br \/>\nDownload sample code from the below list. You need to follow the installation steps mentioned above to run the code.<\/p>\n<h3 class=\"inner_head_title\">DOT NET (C#)<\/h3>\n<p>    <strong>Prerequisite tools:<\/strong><\/p>\n<ol>\n<li>NET Core 2.0<\/li>\n<\/ol>\n<p><strong>Installation:<\/strong><\/p>\n<ol>\n<li>Open Visual Studio 2017, Create new .net core Console App<\/li>\n<li>Create new folder called Nuget and place IOTConnect SDK Nuget package<\/li>\n<li>Open Nuget Package Manager of Console App and click on Setttings for Package source<\/li>\n<li>Add new Package source, name it as LocalPackage and in source give path of Nuget folder created in step #2<\/li>\n<\/ol>\n<p><strong>Usage:<\/strong><\/p>\n<p>In Program.cs add namespace of IOTConnect SDK<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">using IOTConnectSDK;<\/pre>\n<p>Create object of SDKClient<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">string cpId = \"\", uniqueId = \"\";\r\nSDKClient client = new SDKClient(cpId, uniqueId, FirmwareDelegate, TwinUpdateCallBack);<\/pre>\n<p>Callback function to receive Cloud to Device message (C2D)<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">public static Task FirmwareDelegate(string message)\r\n{\r\n    Console.WriteLine(\"Command Received.\");\r\n    Console.WriteLine(message);\r\n    return Task.CompletedTask;\r\n}<\/pre>\n<p>Callback function to receive twin update<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">public static Task TwinUpdateCallBack(Dictionary&lt;string, object&gt; twins)\r\n{\r\n    Console.WriteLine(\"Twin Update received.\");\r\n    foreach (var twin in twins)\r\n    {\r\n        Console.WriteLine($\"{twin.Key}:{twin.Value}\");\r\n    }\r\n    return Task.CompletedTask;\r\n}<\/pre>\n<p>Sample data<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">[{\r\n                \"cpId\": \"\",     \/\/CPID of company\r\n                \"time\": \"\",     \/\/Datetime Fromat: YYYY-MM-DDTHH:MM:SS.SSSSSSSS\"                \r\n                \"uniqueId\": \"\", \/\/Device ID\r\n                \"d\": [{         \/\/Telemetry data\r\n                                \"voltage\": 143.0,\r\n                                \"current\": 4.0,\r\n                                \"frequency\": 6.10,\r\n                                \"brewing\": false,\r\n                                \"product\": null,\r\n                                \"size\": null,\r\n                                \"device\": \"off\"\r\n                        }\r\n                ]\r\n        }\r\n]<\/pre>\n<p>To send the data from Device To Cloud(D2C)<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">client.SendData(File.ReadAllText(@\"devicedata.json\"));<\/pre>\n<p>To configure the secure SSL\/x509 connection follow below step for CA or CA Selfsiged certificate<\/p>\n<ul>\n<li>Open file : iotconnect-sdk\/\/IOTCONNECT\u2122SDK\/sample\/properties.json<\/li>\n<li>Set SSL\/x509 certificate path for CA sign and Selfsign certificate as shown below<\/li>\n<\/ul>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">SDKClient.SSL.Certificate = certiPath;\r\nSDKClient.SSL.Password = certiPass;<\/pre>\n<p>To update the Twin Property<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">client.UpdateTwin(\"twin-property\",\"new value\");<\/pre>\n<p><strong>Sample code <\/strong><br \/>\nDownload sample code from the below list. You need to follow the installation steps mentioned above to run the code.<\/p><\/div>\n<h3 class=\"inner_head_title\">Device Command<\/h3>\n<p>To receive data from the cloud, we need to implement a <strong><em>callback<\/em><\/strong> function, which is called automatically and depends on the device connection. It helps you to get the device command from Cloud to Device and perform a predefined action.<\/p>\n<p>Here, we provide two types of devices to cloud command. You can receive command from <em><strong>callback<\/strong><\/em> function which name is <strong>\u201ccallbackMessage\u201d.<\/strong> It is placed in the device initialization method. You need to write the firmware in a way that you can receive the command which was sent by the cloud and take further action. Command will be received in the form JSON data, in which you get the key name <strong>\u201ccmdType\u201d<\/strong> with a value in the form of <strong>hexadecimal,<\/strong> which is as under:<\/p>\n<p><strong>Command format:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">{\r\n\"cpid\": \"&lt;&lt;your cp id&gt;&gt;\",\r\n\"cmdType\": \"0x01\", \/\/ different command type for manage OTA and Command\r\n\"ack\": false,\r\n\"command\": \"&lt;&lt;your command name&gt;&gt;\",\r\n\"uniqueId\": \"&lt;&lt;your device id&gt;&gt;\",\r\n\"ackId\": \"&lt;&lt;system guid&gt;&gt;\",\r\n\"guid\": \"&lt;&lt;system guid&gt;&gt;\"\r\n}<\/pre>\n<ol>\n<li>0x01 (Device Action Command):<\/li>\n<\/ol>\n<ul>\n<li>It helps to take action on any sensor.<\/li>\n<li>After command received, firmware will take care next what to do with this command and make operation on device.<\/li>\n<\/ul>\n<p>Example : &#8220;command&#8221;: &#8220;MOTOR-OFF&#8221;<\/p>\n<p>2. 0x02 (OTA Update Command):<\/p>\n<ul>\n<li>It helps you to get the command given below.<\/li>\n<li>It helps you to download the updated version of the SDK and install it.<\/li>\n<\/ul>\n<p>Example : &#8220;ota &lt;&lt;Firmware File URL&gt;&gt;&#8221;,<\/p>\n<ul>\n<li>At the same time, you need to send the acknowledgment of the received message to the cloud. For that, you need to publish the message with message type acknowledgment (11). It helps the IoT cloud to get the confirmation that the firmware package was sent successfully.<\/li>\n<\/ul>\n<p>To send acknowledgment you need to follow the below method.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">msgType = 11\r\nd2cMsg = {\r\n\"guid\" : &lt;&lt; GUID &gt;&gt;, \/\/ GUID get from the received command\r\n\"st\" : 3, \/\/ STATUS :: Skipped = 2,Success = 3,Failed = 4\r\n\"msg\" : \"\"\r\n}\r\nsdk.SendACK(msgType, d2cMsg)\r\n\r\n\r\n<\/pre>\n<p>After acknowledgment is sent, the firmware will take care of this command and decide how to download the firmware file and configure it.<\/p>\n<p>3. 0x10 (Template Attribute Update):<\/p>\n<p>It helps, you can get alert from the cloud. It defines, Template Attribute information has been updated. It is used for SDK to update the device information.<\/p>\n<p>4. 0x11 (Setting Information Update):<\/p>\n<p>It helps you to get alerts from the cloud. It defines, Setting Information has been updated. It is used for SDK to update the device information.<\/p>\n<p>5. 0x12 (Device Password Update):<\/p>\n<p>It confirms that the Device Password Information has been updated. It is used by the SDK to update the device connection information and instantly reconnect the device.<\/p>\n<p>6. 0x13 (Device Information Update):<\/p>\n<p>It confirms that the Device Information has been updated. It is used by the SDK to update the device information.<\/p>\n<p>7. 0x15 (Rule Update):<\/p>\n<p>It helps, you can get alert from the cloud. It defines, Rule Information has been updated. It is used for SDK to update the rule information without loose the connection.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SDK Reference This document details the specification about \/IOTCONNECT\u2122 SDK. The purpose of this document is to define a fundamental approach of SDK. Most applications have prerequisites. In order to start with SDK development, a developer needs to have clear fundamentals on Device\u00adCloud and Cloud\u00adDevice communication. They are also required to a have good knowledge [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":13612,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"template-page-full-width.php","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0},"acf":[],"_links":{"self":[{"href":"https:\/\/docs.iotconnect.io\/partnerprogram\/wp-json\/wp\/v2\/pages\/13616"}],"collection":[{"href":"https:\/\/docs.iotconnect.io\/partnerprogram\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/docs.iotconnect.io\/partnerprogram\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/docs.iotconnect.io\/partnerprogram\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.iotconnect.io\/partnerprogram\/wp-json\/wp\/v2\/comments?post=13616"}],"version-history":[{"count":4,"href":"https:\/\/docs.iotconnect.io\/partnerprogram\/wp-json\/wp\/v2\/pages\/13616\/revisions"}],"predecessor-version":[{"id":13874,"href":"https:\/\/docs.iotconnect.io\/partnerprogram\/wp-json\/wp\/v2\/pages\/13616\/revisions\/13874"}],"up":[{"embeddable":true,"href":"https:\/\/docs.iotconnect.io\/partnerprogram\/wp-json\/wp\/v2\/pages\/13612"}],"wp:attachment":[{"href":"https:\/\/docs.iotconnect.io\/partnerprogram\/wp-json\/wp\/v2\/media?parent=13616"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}