User's Manual
2. User also can use our API: setSensorData to control EPD LED
// set LED light
function setSensorData(){
var agentid = $('#agentid').val();
var plugin = $('#plugin').val();
var sensorId = $('#sensorId').val();
var sensorValue = parseInt($('#sensor-
Value').val());
var url = HOST + '/esl/v1/devicectrl/data';
var type = 'POST';
var data = {agentId: agentid, plugin: plugin,
sensorIds: [{n: sensorId, v: sensorValue}]};
api(url, type, data, function(res){
console.log(JSON.stringify(res));
if(res && res.items && res.items.length > 0
&& (res.items[0].statusCode === 202 || res.items[0].statusCode
=== 200)){
alert("Update Sensor Data Command Sended!") }
else {
alert("Ajax request error!");
}
});
}
For more API, user may check next chapter.
4.4.1 EPD Data Update API
1. Upload EPD Data
path: /esl/v1/items
method: POST
header: Basic Authorization
body paramters:
code: string
name (group name): string
content: JSON string
body(example)
{ "items": [ { "code": "X001", "name": "John", "content: "{"name": "John","age":
"18"}" } ] }
response(example)
{ "result": true }
2. Upload EPD Data for a specific item group
path: /esl/v1/items/name/{name}
method: POST
header: Basic Authorization
body paramters:
93 EPD-132 Board User Manual
Chapter
4
EPD
-132
in ePaper
Manager