OneNET IoT Platform Platform Introduction Introduction Manual Guidline for Device Development Guideline for Application Development
Other Service Common Question

# EDP Introduction The test access process includes platform domain and device domain, to help you to experience the first access, to gain a general understanding of the functions and access protocol of the platform.

Test flow chart


Access stepsis as follows:

Step1 Create product, and select access protocol First, you need to create a product which access protocol is EDP on the platform, check Product Create

If you don't have an OneNET account, you can click User Registration

After product creation, record the product ID

Step2 Create device, record device ID and other information

There are two ways to create device:

The first one, Click “add device” button at the web page, input device name and authentication information (i.e. device number). For the specific platform resource model, refer to Resource Model, and record the device number.

The second one, can realize create device by calling API for device creation, input the device name, access protocol, authentication information, MasterKey and other information to create device on the platform.

Step3 Establish protocol connection between device and platform

Use parameters in Step1 and step2 as login parameters, use corresponding interface in SDK to organize EDP connection message, send to the platform, and establish EDP connection with the platform.

Take C language SDK as an example:

/* Use the PacketConnect2 method of EdpKit.h in sdk to packet the connection protocol */
EdpPacket* send_pkg = PacketConnect2(PID, AUTHINFO);

/* Send the connection protocol packet data*/
Int ret = DoSend (sockfd, send_pkg->_data, send_pkg->_write_pos);

/* Must delete send_pkg after use, otherwise memory leak will occur*/

If the connection succeeds, an online token will be seen in the device information:


Step4 Datastream creation, datapoint upload

Write code to upload data to the platform using interface functions provided in SDK

Take C language SDK as an example, upload a set of datapoints with temperature of 18 °C and a humidity of 80% RH

cJSON *json_data = cJSON_CreateObject();

cJSON_AddNumberToObject(json_data, "temperature", 18);
cJSON_AddNumberToObject(json_data, "humidity", 80);

EdpPacket* send_pkg = PacketSavedataJson(NULL, json_data, kTypeSimpleJsonWithoutTime, 0);

/*Send storage package data, upload datapoints*/
Int ret = DoSend (sockfd, send_pkg->_data, send_pkg->_write_pos);

/*Must delete send_pkg after use, otherwise memory leak will occur*/

/ * Delete the constructed json object* /

Step5 Datastream display, view datapoints

Click data display on the device management on OneNET, enter the data display page, click and pull menu to view datapoints uploaded recently, also can select time interval to view historical time

In the above test flow chart, user needs to manually add device on the platform, and then proeed the access process for device domain. When massive devices connecting, will bring many unnecessary operations.

Therefore, when you require batch devices access, recommend you to use batch access solution

Common Problems

Q1: How to upload integer/floating-point datapoints in numerical values?

A: Suggest to upload by type=3 or type=1 (See "Device Terminal Access Protocol-EDP" for details). Example:

Type=3 Integer: {"temperature":22} 
       Floating point: {"pi":3.14159}
Type=1 Integer: {"datastreams":[{"id":"temperature","datapoints":[{"value":22}]}]}
       Floating point: {"datastreams":[{"id":"pi","datapoints":[{"value":3.14159}]}]}

Q2: How to upload location information?

A: JSON-based geographic location information can be displayed in datastream. Suggest to upload by type=3 or type=1 (See "Device Terminal Access Protocol-EDP" for details). Example:

Type=3: {"loc":{"lon": 117.48,"lat": 39.96}}
Type=1: {"datastreams":[{"id":"loc","datapoints":[{"value":{"lon":117.48,"lat":39.96}}]}]}

Q3: use EDP for sending control command. What is the use of cmd_id?

A: cmd_id is randomly generated by the server. Each EDP-cmd corresponds to a unique cmd_id. User can obtain command response of device and execution status of command through RESTFUL API according to the cmd_id (see API document for detail).

Q4: Does the device need to respond to the EDP command when it receives an EDP command request?

A: EDP command request is generally used to send command to control device. The server generates a unique cmd_id for the command when sending, and generates a execution status corresponding to the command. If EDP command response is sent after the device receives the command, execution status of the server will become successful. If the device does not reply, the status of the server will be set as execution timeout. The device can query the execution status of command through RESTFUL API and cmd_id. If the device does not respond, it only affects execution status of command saved on the server and does not affect the process of sending command.

results matching ""

    No results matching ""