Add files via upload

This commit is contained in:
IoTThinks.com 2023-06-07 16:23:33 +07:00 committed by GitHub
parent a94db52367
commit 122d66ce5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 649 additions and 0 deletions

54
Codec/Dragino-LAQ4.txt Normal file
View File

@ -0,0 +1,54 @@
// Decode uplink function.
//
// Input is an object with the following fields:
// - bytes = Byte array containing the uplink payload, e.g. [255, 230, 255, 0]
// - fPort = Uplink fPort.
// - variables = Object containing the configured device variables.
//
// Output must be an object with the following fields:
// - data = Object representing the decoded payload.
function decodeUplink(input) {
var bytes=input.bytes;
if(bytes.length != 11)
{
return {"data": {}};
}
var mode=(bytes[2] & 0x7C)>>2;
var data = {};
data.Bat_V=(bytes[0]<<8 | bytes[1])/1000 + 0.267;
if(mode==1)
{
data.Work_mode="CO2";
data.Alarm_status=(bytes[2] & 0x01)? "TRUE":"FALSE";
data.TVOC_ppb= bytes[3]<<8 | bytes[4];
data.CO2_ppm= bytes[5]<<8 | bytes[6];
data.TempC_SHT=parseFloat(((bytes[7]<<24>>16 | bytes[8])/10).toFixed(2));
data.Hum_SHT=parseFloat(((bytes[9]<<8 | bytes[10])/10).toFixed(1));
}
else if(mode==31)
{
data.Work_mode="ALARM";
data.SHTEMPMIN= bytes[3]<<24>>24;
data.SHTEMPMAX= bytes[4]<<24>>24;
data.SHTHUMMIN= bytes[5];
data.SHTHUMMAX= bytes[6];
data.CO2MIN= bytes[7]<<8 | bytes[8];
data.CO2MAX= bytes[9]<<8 | bytes[10];
}
return {"data": data};
}
// Encode downlink function.
//
// Input is an object with the following fields:
// - data = Object representing the payload that must be encoded.
// - variables = Object containing the configured device variables.
//
// Output must be an object with the following fields:
// - bytes = Byte array containing the downlink payload.
function encodeDownlink(input) {
return { bytes: []};
}

104
Codec/Dragino-LGT92.txt Normal file
View File

@ -0,0 +1,104 @@
// Decode uplink function.
//
// Input is an object with the following fields:
// - bytes = Byte array containing the uplink payload, e.g. [255, 230, 255, 0]
// - fPort = Uplink fPort.
// - variables = Object containing the configured device variables.
//
// Output must be an object with the following fields:
// - data = Object representing the decoded payload.
function decodeUplink(input) {
var bytes=input.bytes;
var latitude;//gps latitude,units: °
latitude=(bytes[0]<<24 | bytes[1]<<16 | bytes[2]<<8 | bytes[3])/1000000;//gps latitude,units: °
var longitude;
longitude=(bytes[4]<<24 | bytes[5]<<16 | bytes[6]<<8 | bytes[7])/1000000;//gps longitude,units: °
var alarm=(bytes[8] & 0x40)?"TRUE":"FALSE";//Alarm status
var batV=(((bytes[8] & 0x3f) <<8) | bytes[9])/1000;//Battery,units:V
var motion_mode;
if((bytes[10] & 0xC0)==0x40)
{
motion_mode="Move";
}
else if((bytes[10] & 0xC0) ==0x80)
{
motion_mode="Collide";
}
else if((bytes[10] & 0xC0) ==0xC0)
{
motion_mode="User";
}
else
{
motion_mode="Disable";
} //mode of motion
var led_updown=(bytes[10] & 0x20)?"ON":"OFF";//LED status for position,uplink and downlink
var Firmware = 160+(bytes[10] & 0x1f); // Firmware version; 5 bits
/* AT+SGM=0 to enable. Longer message
var roll=(bytes[11]<<24>>16 | bytes[12])/100;//roll,units: °
var pitch=(bytes[13]<<24>>16 | bytes[14])/100; //pitch,units: °
var hdop = 0;
if(bytes[15] > 0)
{
hdop =bytes[15]/100; //hdop,units: °
}
else
{
hdop =bytes[15];
}
var altitude =(bytes[16]<<24>>16 | bytes[17]) / 100; //Altitude,units: °
*/
if (latitude != 0 || longitude != 0) {
return {"data": {
Latitude: latitude,
Longitude: longitude,
// Roll: roll,
// Pitch:pitch,
BatV:batV,
ALARM_status:alarm,
MD:motion_mode,
LON:led_updown,
FW:Firmware //,
// HDOP:hdop,
// Altitude:altitude
}};
}
else {
return {"data": {
// Ignore GPS(0,0)
// Latitude: latitude,
// Longitude: longitude,
// Roll: roll,
// Pitch:pitch,
BatV:batV,
ALARM_status:alarm,
MD:motion_mode,
LON:led_updown,
FW:Firmware// ,
// HDOP:hdop
// Altitude:altitude
}};
}
}
// Encode downlink function.
//
// Input is an object with the following fields:
// - data = Object representing the payload that must be encoded.
// - variables = Object containing the configured device variables.
//
// Output must be an object with the following fields:
// - bytes = Byte array containing the downlink payload.
function encodeDownlink(input) {
return {bytes: []};
}

154
Codec/Dragino-LSN50v2.txt Normal file
View File

@ -0,0 +1,154 @@
// Decode uplink function.
//
// Input is an object with the following fields:
// - bytes = Byte array containing the uplink payload, e.g. [255, 230, 255, 0]
// - fPort = Uplink fPort.
// - variables = Object containing the configured device variables.
//
// Output must be an object with the following fields:
// - data = Object representing the decoded payload.
function decodeUplink(input) {
var bytes=input.bytes;
var data={
//Work mode
Work_mode:
{
"0":"IIC",
"1":"Distance",
"2":"3ADC",
"3":"3DS18B20",
"4":"Weight",
"5":"Count"
}[(bytes[6] & 0x7C)>>2],
//Battery,units:V
BatV:
{
"0": (bytes[0]<<8 | bytes[1])/1000,
"1": (bytes[0]<<8 | bytes[1])/1000,
"2": bytes[11]/10,
"3": (bytes[0]<<8 | bytes[1])/1000,
"4": (bytes[0]<<8 | bytes[1])/1000,
"5": (bytes[0]<<8 | bytes[1])/1000,
}[(bytes[6] & 0x7C)>>2] + 0.267,
//DS18B20,PB3,units:â„?
TempC1:
{
"0": ((bytes[2]<<24>>16 | bytes[3])/10).toFixed(2),
"1": ((bytes[2]<<24>>16 | bytes[3])/10).toFixed(2),
"3": ((bytes[2]<<24>>16 | bytes[3])/10).toFixed(2),
"4": ((bytes[2]<<24>>16 | bytes[3])/10).toFixed(2),
"5": ((bytes[2]<<24>>16 | bytes[3])/10).toFixed(2),
}[(bytes[6] & 0x7C)>>2],
//ADC Channel 0,PA0,units:V
ADC_CH0V:
{
"0":(bytes[4]<<8 | bytes[5])/1000,
"1":(bytes[4]<<8 | bytes[5])/1000,
"2": (bytes[0]<<8 | bytes[1])/1000,
"3":(bytes[4]<<8 | bytes[5])/1000,
"4":(bytes[4]<<8 | bytes[5])/1000,
"5":(bytes[4]<<8 | bytes[5])/1000,
}[(bytes[6] & 0x7C)>>2],
//Digital Input Status,PA12
Digital_IStatus:
{
"0":(bytes[6] & 0x02)? "H":"L",
"1":(bytes[6] & 0x02)? "H":"L",
"2":(bytes[6] & 0x02)? "H":"L",
"3":(bytes[6] & 0x02)? "H":"L",
"4":(bytes[6] & 0x02)? "H":"L",
"5":(bytes[6] & 0x02)? "H":"L",
}[(bytes[6] & 0x7C)>>2],
//GPIO_MODE_IT_FALLING,PB14
EXTI_Trigger:
{
"0":(bytes[6] & 0x01)? "TRUE":"FALSE",
"1":(bytes[6] & 0x01)? "TRUE":"FALSE",
"2":(bytes[6] & 0x01)? "TRUE":"FALSE",
"3":(bytes[6] & 0x01)? "TRUE":"FALSE",
"4":(bytes[6] & 0x01)? "TRUE":"FALSE",
}[(bytes[6] & 0x7C)>>2],
//Status of door sensor,PB14
Door_status:
{
"0": (bytes[6] & 0x80)? "CLOSE":"OPEN",
"1": (bytes[6] & 0x80)? "CLOSE":"OPEN",
"2": (bytes[6] & 0x80)? "CLOSE":"OPEN",
"3": (bytes[6] & 0x80)? "CLOSE":"OPEN",
"4": (bytes[6] & 0x80)? "CLOSE":"OPEN",
}[(bytes[6] & 0x7C)>>2],
//SHT2X,SHT3X temperature,PB6,PB7,units:â„?
TempC_SHT:
{
"0":((bytes[7]<<24>>16 | bytes[8])/10).toFixed(2),
"2":((bytes[7]<<24>>16 | bytes[8])/10).toFixed(2),
}[(bytes[6] & 0x7C)>>2],
//SHT2X,SHT3X Humidity,PB6,PB7,units:%
Hum_SHT:
{
"0": ((bytes[9]<<8 | bytes[10])/10) .toFixed(1),
"2": ((bytes[9]<<8 | bytes[10])/10) .toFixed(1),
}[(bytes[6] & 0x7C)>>2],
//Distance,PA11,PB12,units:cm;
Distance:
{
"1":((bytes[7]<<8 | bytes[8])/10) .toFixed(1),
}[(bytes[6] & 0x7C)>>2],
//ADC Channel 1,PA1,units:V
ADC_CH1V:
{
"2":(bytes[2]<<8 | bytes[3])/1000,
}[(bytes[6] & 0x7C)>>2],
//ADC Channel 4,PA4,units:V
ADC_CH4V:
{
"2":(bytes[4]<<8 | bytes[5])/1000,
}[(bytes[6] & 0x7C)>>2],
//DS18B20,PA9,units:â„?
TempC2:
{
"3":((bytes[7]<<24>>16 | bytes[8])/10).toFixed(2),
}[(bytes[6] & 0x7C)>>2],
//DS18B20,PA10,units:â„?
TempC3:
{
"3":((bytes[9]<<24>>16 | bytes[10])/10).toFixed(2),
}[(bytes[6] & 0x7C)>>2],
//Weight,PA11,PB12,units:g;
Weight:
{
"4":(bytes[7]<<24>>16 | bytes[8]),
}[(bytes[6] & 0x7C)>>2],
//interrupt count
Count:
{
"5":(bytes[7]<<24 | bytes[8]<<16 | bytes[9]<<8 | bytes[10]),
}[(bytes[6] & 0x7C)>>2],
}
return {"data": data};
}
// Encode downlink function.
//
// Input is an object with the following fields:
// - data = Object representing the payload that must be encoded.
// - variables = Object containing the configured device variables.
//
// Output must be an object with the following fields:
// - bytes = Byte array containing the downlink payload.
function encodeDownlink(input) {
return {bytes: []};
}

View File

@ -0,0 +1,179 @@
// Decode uplink function.
//
// Input is an object with the following fields:
// - bytes = Byte array containing the uplink payload, e.g. [255, 230, 255, 0]
// - fPort = Uplink fPort.
// - variables = Object containing the configured device variables.
//
// Output must be an object with the following fields:
// - data = Object representing the decoded payload.
function decodeUplink(input) {
var bytes=input.bytes;
if(bytes.length != 11) {
return {"data": {}};
}
//Payload Formats of LT33222 or LT22222 Deceive
var hardware= (bytes[10] & 0xC0)>>6;
var mode0= bytes[10] & 0xff;
var mode= bytes[10] & 0x3f;
var decode = {};
if(hardware=='0')
{
decode.Hardware_mode="LT33222";
decode.DO3_status=(bytes[8] &0x04)? false:true; // "L":"H";
if(mode0=='1')
{
decode.DI3_status= (bytes[8] &0x20)? true:false; // "H":"L";
}
}
else if(hardware=='1')
{
decode.Hardware_mode= "LT22222";
}
if(mode!=6)
{
decode.DO1_status= (bytes[8] &0x01)? true:false; // "L":"H";
decode.DO2_status= (bytes[8] &0x02)? true:false; // "L":"H";
decode.RO1_status= (bytes[8] &0x80)? true:false; // "ON":"OFF";
decode.RO2_status= (bytes[8] &0x40)? true:false; // "ON":"OFF";
if(mode!=1)
{
if(mode!=5)
{
decode.Count1_times= (bytes[0]<<24 | bytes[1]<<16 | bytes[2]<<8 | bytes[3]);
}
decode.First_status= (bytes[8] &0x20)? true:false; // "Yes":"No";
}
}
if(mode=='1')
{
decode.Work_mode= "2ACI+2AVI";
decode.AVI1_V= parseFloat(((bytes[0]<<24>>16 | bytes[1])/1000).toFixed(3));
decode.AVI2_V= parseFloat(((bytes[2]<<24>>16 | bytes[3])/1000).toFixed(3));
decode.ACI1_mA= parseFloat(((bytes[4]<<24>>16 | bytes[5])/1000).toFixed(3));
decode.ACI2_mA= parseFloat(((bytes[6]<<24>>16 | bytes[7])/1000).toFixed(3));
decode.DI1_status= (bytes[8] &0x08)? true:false; // "H":"L";
decode.DI2_status= (bytes[8] &0x10)? true:false; // "H":"L"
}
else if(mode=='2')
{
decode.Work_mode= "Count mode 1";
decode.Count2_times= (bytes[4]<<24 | bytes[5]<<16 | bytes[6]<<8 | bytes[7]);
}
else if(mode=='3')
{
decode.Work_mode= "2ACI+1Count";
decode.ACI1_mA= parseFloat(((bytes[4]<<24>>16 | bytes[5])/1000).toFixed(3));
decode.ACI2_mA= parseFloat(((bytes[6]<<24>>16 | bytes[7])/1000).toFixed(3));
}
else if(mode=='4')
{
decode.Work_mode= "Count mode 2";
decode.Acount_times= (bytes[4]<<24 | bytes[5]<<16 | bytes[6]<<8 | bytes[7]);
}
else if(mode=='5')
{
decode.Work_mode= " 1ACI+2AVI+1Count";
decode.AVI1_V= parseFloat(((bytes[0]<<24>>16 | bytes[1])/1000).toFixed(3));
decode.AVI2_V= parseFloat(((bytes[2]<<24>>16 | bytes[3])/1000).toFixed(3));
decode.ACI1_mA= parseFloat(((bytes[4]<<24>>16 | bytes[5])/1000).toFixed(3));
decode.Count1_times= bytes[6]<<8 | bytes[7];
}
else if(mode=='6')
{
decode.Work_mode= "Exit mode";
decode.Mode_status= bytes[9] ? "True":"False";
decode.AV1L_flag= (bytes[0] &0x80)? true: false; // "True":"False";
decode.AV1H_flag= (bytes[0] &0x40)? true: false; // "True":"False";
decode.AV2L_flag= (bytes[0] &0x20)? true: false; // "True":"False";
decode.AV2H_flag= (bytes[0] &0x10)? true: false; // "True":"False";
decode.AC1L_flag= (bytes[0] &0x08)? true: false; // "True":"False";
decode.AC1H_flag= (bytes[0] &0x04)? true: false; // "True":"False";
decode.AC2L_flag= (bytes[0] &0x02)? true: false; // "True":"False";
decode.AC2H_flag= (bytes[0] &0x01)? true: false; // "True":"False";
decode.AV1L_status= (bytes[1] &0x80)? true: false; // "True":"False";
decode.AV1H_status= (bytes[1] &0x40)? true: false; // "True":"False";
decode.AV2L_status= (bytes[1] &0x20)? true: false; // "True":"False";
decode.AV2H_status= (bytes[1] &0x10)? true: false; // "True":"False";
decode.AC1L_status= (bytes[1] &0x08)? true: false; // "True":"False";
decode.AC1H_status= (bytes[1] &0x04)? true: false; // "True":"False";
decode.AC2L_status= (bytes[1] &0x02)? true: false; // "True":"False";
decode.AC2H_status= (bytes[1] &0x01)? true: false; // "True":"False";
decode.DI2_status= (bytes[2] &0x08)? true: false; // "True":"False";
decode.DI2_flag= (bytes[2] &0x04)? true: false; // "True":"False";
decode.DI1_status= (bytes[2] &0x02)? true: false; // "True":"False";
decode.DI1_flag= (bytes[2] &0x01)? true: false; // "True":"False";
}
return {"data": decode};
}
// Encode downlink function.
//
// Input is an object with the following fields:
// - data = Object representing the payload that must be encoded.
// - variables = Object containing the configured device variables.
//
// Output must be an object with the following fields:
// - bytes = Byte array containing the downlink payload.
function encodeDownlink(input) {
var obj=input.data;
// 11: No action, 00: Off, 01: On
if(obj["method"] === "setRO1Value")
{
if(obj["params"])
{
return {bytes: [0x03,0x01,0x11]}; // On
// return [0x05,0x01,0x12,0x07,0xD0]; // On 2s and back to original state, 0x07D0 = 2000ms = 2s
// return [0x05,0x00,0x12,0x07,0xD0]; // On 2s and back to inverter state, 0x07D0 = 2000ms = 2s
}
else
{
return {bytes: [0x03,0x00,0x11]}; // Off
// return [0x05,0x01,0x02,0x07,0xD0]; // On 2s and back to original state, 0x07D0 = 2000ms = 2s
}
}
else if(obj["method"] === "setRO2Value")
{
if(obj["params"])
{
return {bytes: [0x03,0x11,0x01]}; // On
// return [0x05,0x01,0x21,0x07,0xD0]; // On 2s and back to original state, 0x07D0 = 2000ms = 2s
}
else
{
return {bytes: [0x03,0x11,0x00]}; // Off
// return [0x05,0x01,0x20,0x07,0xD0]; // On 2s and back to original state, 0x07D0 = 2000ms = 2s
}
}
else if(obj["method"] === "setDO1Value")
{
if(obj["params"])
{
return {bytes: [0x02,0x01,0x11,0x11]}; // On
}
else
{
return {bytes: [0x02,0x00,0x11,0x11]}; // Off
}
}
else if(obj["method"] === "setDO2Value")
{
if(obj["params"])
{
return {bytes: [0x02,0x11,0x01,0x11]}; // On
}
else
{
return {bytes: [0x02,0x11,0x00,0x11]}; // Off
}
}
// Should not reach here
return {bytes: []};
}

View File

@ -0,0 +1,32 @@
// Decode uplink function.
//
// Input is an object with the following fields:
// - bytes = Byte array containing the uplink payload, e.g. [255, 230, 255, 0]
// - fPort = Uplink fPort.
// - variables = Object containing the configured device variables.
//
// Output must be an object with the following fields:
// - data = Object representing the decoded payload.
function decodeUplink(input) {
var bytes = input.bytes;
var BatV = (bytes[0] << 8 | bytes[1]) / 1000 + 0.277;
var PayVER = bytes[2];
// If AT+DATAUP=1, PayloadCount=1 byte, payload#=1 byte
var Temp = (bytes[3] << 8 | bytes[4]) / 10;
var Humid = (bytes[5] << 8 | bytes[6]) / 10;
return {"data": {"BatV":BatV, "PayVER":PayVER, "Temp":Temp, "Humid":Humid}};
}
// Encode downlink function.
//
// Input is an object with the following fields:
// - data = Object representing the payload that must be encoded.
// - variables = Object containing the configured device variables.
//
// Output must be an object with the following fields:
// - bytes = Byte array containing the downlink payload.
function encodeDownlink(input) {
return {bytes: []};
}

126
Codec/Dragino-RS485-LN.txt Normal file
View File

@ -0,0 +1,126 @@
// Decode uplink function.
//
// Input is an object with the following fields:
// - bytes = Byte array containing the uplink payload, e.g. [255, 230, 255, 0]
// - fPort = Uplink fPort.
// - variables = Object containing the configured device variables.
//
// Output must be an object with the following fields:
// - data = Object representing the decoded payload.
function decodeUplink(input) {
var bytes=input.bytes;
//Payload Formats of RS485_LN Deceive, for TTN/ChirpStack
if(bytes.length > 6) // Telemetry, by right should check by fport
{
// uplink from RS485 has payload version at bytes[0]
var cs_temp = (bytes[1] << 8 | bytes[2]) / 10;
// Javascript does not support binary 0bxxxx
var cs_al1_status = (bytes[3] & 0x04)? true : false; // 0b0100
var cs_al2_status = (bytes[3] & 0x08)? true : false; // 0b1000
// For Temperature and Humid of SHT20
var cs_temp_sht20 = (bytes[4] << 8 | bytes[5]) / 10 - 2.9; // To offset down 2.9 degree
var cs_humid_sht20 = (bytes[6] << 8 | bytes[7]) / 10;
// Voltage and current
var cs_voltage = (bytes[8] << 8 | bytes[9]) / 10;
var cs_current = (bytes[10] << 8 | bytes[11]) / 100;
var cs_kW = cs_voltage * cs_current / 1000;
// kWh
var cs_exportKWh = (bytes[12] << 24 | bytes[13] << 16 | bytes[14] << 8 | bytes[15]) / 100;
var cs_importKWh = (bytes[16] << 24 | bytes[17] << 16 | bytes[18] << 8 | bytes[19]) / 100;
var cs_totalKWh = cs_exportKWh + cs_importKWh;
return { data: {"cs_temp":cs_temp, "cs_al1_status":cs_al1_status, "cs_al2_status":cs_al2_status,
"cs_temp_sht20":cs_temp_sht20, "cs_humid_sht20":cs_humid_sht20,
"cs_voltage":cs_voltage, "cs_current":cs_current, "cs_kW":cs_kW,
"cs_exportKWh":cs_exportKWh, "cs_importKWh":cs_importKWh, "cs_totalKWh":cs_totalKWh}
};
}
else if(bytes.length == 6) // return from RPC commands
{
// Uplink from RPC response does not have payload version at bytes[0]
// AL1: On OK [0x01,0x06,0x20,0x01,0x03,0xe8]
if(bytes[0] == 0x01 && bytes[1] == 0x06 && bytes[2] == 0x20 &&
bytes[3] == 0x01 && bytes[4] == 0x03 && bytes[5] == 0xe8)
{
return { data: {"cs_al1_status": true}};
}
// AL1: Off OK [0x01,0x06,0x20,0x01,0x00,0x00]
else if(bytes[0] == 0x01 && bytes[1] == 0x06 && bytes[2] == 0x20 &&
bytes[3] == 0x01 && bytes[4] == 0x00 && bytes[5] == 0x00)
{
return { data: {"cs_al1_status": false}};
}
// AL2: On OK [0x01,0x06,0x20,0x03,0x03,0xe8]
if(bytes[0] == 0x01 && bytes[1] == 0x06 && bytes[2] == 0x20 &&
bytes[3] == 0x03 && bytes[4] == 0x03 && bytes[5] == 0xe8)
{
return { data: {"cs_al2_status": true}};
}
// AL2: Off OK [0x01,0x06,0x20,0x03,0x00,0x00]
else if(bytes[0] == 0x01 && bytes[1] == 0x06 && bytes[2] == 0x20 &&
bytes[3] == 0x03 && bytes[4] == 0x00 && bytes[5] == 0x00)
{
return { data: {"cs_al2_status": false}};
}
else return { data: {"byte0": bytes[0], "byte1": bytes[1], "byte2": bytes[2],
"byte3": bytes[3], "byte4": bytes[4], "byte5": bytes[5]}};
}
else // Unknown
{
return {data: {}};
}
}
// Encode downlink function.
//
// Input is an object with the following fields:
// - data = Object representing the payload that must be encoded.
// - variables = Object containing the configured device variables.
//
// Output must be an object with the following fields:
// - bytes = Byte array containing the downlink payload.
function encodeDownlink(input) {
var obj=input.data;
if(obj["method"] === "setAL1Value")
{
if(obj["params"])
{
// return [0xa8,0x01,0x06,0x01,0x06,0x20,0x01,0x03,0xe8,0x00]; // On
return { bytes: [0xa8,0x01,0x06,0x01,0x06,0x20,0x01,0x03,0xe8,0x06]}; // On, to return 6-byte uplink
}
else
{
// return [0xa8,0x01,0x06,0x01,0x06,0x20,0x01,0x00,0x00,0x00]; // Off
return {bytes: [0xa8,0x01,0x06,0x01,0x06,0x20,0x01,0x00,0x00,0x06]}; // Off, to return 6-byte uplink
}
}
else if(obj["method"] === "setAL2Value")
{
if(obj["params"])
{
// a801060106200303e806
// qAEGAQYgAwPoBg==
// return [0xa8,0x01,0x06,0x01,0x06,0x20,0x03,0x03,0xe8,0x00]; // On
return {bytes: [0xa8,0x01,0x06,0x01,0x06,0x20,0x03,0x03,0xe8,0x06]}; // On, to return 6-byte uplink
}
else
{
// a8010601062003000006
// qAEGAQYgAwAABg==
// return [0xa8,0x01,0x06,0x01,0x06,0x20,0x03,0x00,0x00,0x00]; // Off
return {bytes: [0xa8,0x01,0x06,0x01,0x06,0x20,0x03,0x00,0x00,0x06]}; // Off, to return 6-byte uplink
}
}
else if(obj["method"] === "getAL1Value" || obj["method"] === "getAL2Value")
{
return {bytes: [0x08,0xff]}; // To uplink all at+command immediately
}
// Should not reach here
return {bytes: []};
}