---
tags: 'Acer'
---
IDAM Software Specification
===
[TOC]
# RS485 / ModBus
* Max device number : 32
* Max variables number: 32
* Baudrate: 9600
# Uplink Type
* Payload Type
* 0: Old LoRaWAN format
* 1: GPS upload format
* 2: New LoRaWAN / NBIoT format
* 3: New WiFi / LTE 4G Format
* 4: BlueTooth Meter format
* 5: P2P format
* 6: NEMA AC Command Ack
* 7: P2P JOIN format
* 8: P2P Meter Report format
* 9: Data Encryption
* 10: Meter Ack
* 11: P2P JOIN RESPONSE 2 format
* 12: LoRaWAn Meter value upload
* 13: Taiwan Water P2P JOIN format
* 14: Taiwan Water P2P JOIN Response 2 format
* 15: Taiwan Water P2P Meter Report format
* 16: Taiwan Water P2P Meter Report Response format
* 17: Taiwan Water P2P Image Upload format
* 18: Taiwan Water P2P Image Upload Response format
## LoRaWAN
Since the payload limitation is 32 Byte, we will make each payload by the follow format:
* Bytes 0: UUID ( Not used for now, reserved for P2P usage )
* Bytes 1: PayloadType ( 0: old 1: GPS 2:new )
* Bytes 2: The start variable index of this payload.
* Bytes 3: The variable numbers of this payload.
* Bytes 4~7: the first variable's value in FLOAT32 format.
* Bytes 8~11: the second variable's value in FLOAT32 format.
* Bytes 12~15: ...
Here's the data structure definition in C.
if payloadType == 2 : ( Report Data )
```
typedef struct
{
UINT8 UUID;
UINT8 payloadType=2;
UINT8 startIndex;
UINT8 varNumber;
FLOAT32 variables[varNumber];
} STC_LORAWAN_SEND_PACKAGE;
```
if payloadType == 3 : ( Report UUID )
```
typedef struct
{
UINT8 UUID;
UINT8 payloadType=3;
UINT8 UUID[24];
}
```
## WiFi /LTE 4G
### Upload Device Information
JSON structure
```
Header: Key=> AuthToken Value=> the token
{
"AuthToken": "B7JZW6u6Mnl4efkc12ZjlYGbI1B4H28a",
"[deviceUUID]": {
"command": "updateDeviceInfo",
"deviceInfo": {
"devCnt":1,
"varCnt":2,
"dev0": {
"devModbusID":1,
"baudrate":9600,
"modbusType":0,
"devname":"New Device",
"var0": {
"devIndex":0,
"type": 6, // type: from 0 ~ 6
"addr": 0,
"name": "New Variable",
"max": 0,
"min": 0,
unit": "m/s",
"scale": 100
}
"var1": {
...
}
}
},
"uplinkType": 3, // uplinkType: from 0 ~ 4
"name": "Acer Being Communication SB",
"loraAppKey": "",
"loraEDUI": ""
}
}
```
Read data example
```
{
"38ff464d4e363b28626445": {
"command": "updateDeviceInfo",
"deviceInfo": {
"devCnt": 3,
"varCnt": 5,
"dev0": {
"devModbusID": 1,
"baudrate": 9600,
"modbusType": 0,
"devname": "New Device",
"var0": {
"devIndex": 0,
"type": 6,
"addr": 0,
"name": "New Variable",
"max": 0,
"min": 0,
"unit": "",
"scale": 1
}
},
"dev1": {
"devModbusID": 1,
"baudrate": 9600,
"modbusType": 0,
"devname": "New Device",
"var1": {
"devIndex": 1,
"type": 6,
"addr": 1,
"name": "New Variable",
"max": 0,
"min": 0,
"unit": "",
"scale": 1
},
"var2": {
"devIndex": 2,
"type": 6,
"addr": 2,
"name": "New Variable",
"max": 0,
"min": 0,
"unit": "",
"scale": 1
}
},
"dev2": {
"devModbusID": 2,
"baudrate": 9600,
"modbusType": 0,
"devname": "New Device",
"var3": {
"devIndex": 3,
"type": 6,
"addr": 3,
"name": "New Variable",
"max": 0,
"min": 0,
"unit": "",
"scale": 1
},
"var4": {
"devIndex": 4,
"type": 6,
"addr": 4,
"name": "New Variable",
"max": 0,
"min": 0,
"unit": "",
"scale": 1
}
}
},
"uplinkType": 3,
"name": "Acer Being Communication SB",
"loraAppKey": "",
"loraEDUI": ""
}
}
```
Variable Type: from 0 to 6
* 0: INT8
* 1: UINT8
* 2: INT16
* 3: UINT16
* 4: INT32
* 5: UINT32
* 6: FLOAT32
Uplink Type: from 0 to 4
* 0: LORAWAN
* 1: LORA_P2P
* 2: LET4G
* 3: WIFI
* 4: NBIoT
### UPload Device Variables
JSON Structure
```
{
"UUID": "xxxxxxxx" ,
"vars": {
"var0": xxx,
"var1": xxx,
....
}
}
```
Real data example
```
{
"UUID": "38ff464d4e363b28626445" ,
"vars": {
"var0": 2.4,
"var1": 5.2,
}
}
```
## NBIOT
The data format is same as LoRaWAN.
But encode with Base64.
# Downlink
## LoRaWAN
```
Command 0 :
typedef struct
{
UINT8 commandType;
UINT8 startIndex;
UINT8 variableNumber;
UINT32 value;
( Dynamic )
}
```
```
Command 1 :
typedef struct
{
UINT8 commandType;
UINT8 *modbusCmdArray;
}
```
commmandType:
* 0 : Value Update
* 1 : Bypass modbus command
* 2 : Device Name update
* 3 : Port update
* 4 : ...
## WiFi / 4G
```
{
"CommandType": 0,
"modbusID" : 5,
"registerAddress" : 0x20 or 32,
"varType": 0 -> INT8 ,
"value" : 1.232
}
```
## NBIOT
The data format is same as LoRaWAN.
But encode with Base64.
# IDAM for Water Cabinet ( Water Quality )
* LoRaWAN Module Device ID: 38ffdb054d4e353927830743
* LoRaWAN Module APP Key: 2b7e151628aed2a6abf7158809cf4f3c
* Data Format:
* like normal IDAM data format
* index 0: PH Value ( Unit: none )
* index 1: DO Value ( Unit: % )
* index 2: Temperature Value ( Unit: °C )
* index 3: EC Value ( Unit: mS/cm )
* index 4: Turbidity Value ( Unit: NTU )
# IDAM for Addon Meter
* LoRaWAN Module Device ID: 38ffd7054d4e353928620943
* LoRaWAN Module APP Key: 2b7e151628aed2a6abf7158809cf4f3c
* Data Format:
* Byte 0 ~ Byte 5 : Bluetooth Module MAC Address
* Byte 6 ~ Byte 9 : Meter Value ( FLOAT32 little endian )