--- tags: 'Acer' --- All Smart Meter Reader NBIoT/CAT-M1 Protocols === [TOC] ## MeterType 0: Water Meter Camera Type 1: Water Meter Pulse Type 2: RTU Type 3: Pulse Type 4: Home Type 5: Radar Type 6: Ultrasonic Type ## Water Meter ### Camera Type Protocol #### Register ```json= { UINT8 commandCode; // Always be 0x01 UINT8 MeterNumber[16]; UINT8 IMEI[16]; UINT8 IMSI[16]; INT16 RSRP; INT16 RSRQ; INT16 Battery; // (value*100) UINT32 MeterType; UINT8 protocolVersion; // Always be 2 UINT8 v0; UINT8 v1; UINT8 v2; UINT8 reserved; UINT16 CRC; } STC_REGISTER; ``` <font color='red'>Response "Protocol Version 2"</font> ```json= { UINT8 commandCode; // Always be 0x02 UINT8 MeterNumber[16]; UINT8 IMEI[16]; UINT8 IMSI[16]; UINT8 currentTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 samplingTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 uplinkTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 uploadServerIP[16]; UINT16 uploadServerPort; UINT8 imageServerIP[16]; UINT16 imageServerPort; UINT32 samplingPeriod; UINT32 uplinkPeriod; UINT32 MeterType; UINT16 command; UINT8 imageDate[6]; UINT8 secondDataServerIP[16]; // if disable, secondServerIP[0] equal 0 UINT16 secondDataServerPort; // if disable, secondServerPort equal 0 UINT8 secondImageServerIP[16]; // if disable, secondServerIP[0] equal 0 UINT16 secondImageServerPort; // if disable, secondServerPort equal 0 UINT8 reserved; UINT16 CRC; } STC_REGISTER_RESPONSE; ``` <font color='red'>Response "Protocol Version 3"</font> ```json= { UINT8 commandCode; // Always be 0x02 UINT8 MeterNumber[32]; UINT8 IMEI[16]; UINT8 IMSI[16]; UINT8 currentTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 samplingTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 uplinkTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 uploadServerIP[16]; UINT16 uploadServerPort; UINT8 imageServerIP[16]; UINT16 imageServerPort; UINT32 samplingPeriod; UINT32 uplinkPeriod; UINT32 MeterType; UINT16 command; UINT8 imageDate[6]; UINT8 secondDataServerIP[16]; // if disable, secondServerIP[0] equal 0 UINT16 secondDataServerPort; // if disable, secondServerPort equal 0 UINT8 secondImageServerIP[16]; // if disable, secondServerIP[0] equal 0 UINT16 secondImageServerPort; // if disable, secondServerPort equal 0 UINT8 saveBaseInfo; // 1: save base info UINT16 CRC; } STC_REGISTER_RESPONSE; ``` #### Commands: |Code|Name| |---|---| |0x00|None| |0x01|uploadImage| |0x02|uploadROI| |0x03|setParameters| |0x04|upload fill-up data| <B>Meter will send "request parameters" if it received command code == 0x03</B> ##### Request Parameters ```json= { UINT8 commandCode; // Always be 0x0b UINT8 MeterNumber[16]; UINT16 requestVersion; UINT8 reserved; UINT16 CRC; } STC_REGISTER_RESPONSE; ``` ##### Response for "requestVersion=1" ```json= { UINT8 commandCode; // Always be 0x0C UINT8 MeterNumber[16]; UINT16 requestVersion; // Always be 0x0000 UINT8 newMeterNumber[16]; // if no change,newMeterNumber[0] equal 0 UINT8 newRegisterIP[16]; // if no change,newRegisterIP[0] equal 0 UINT16 newRegisterPort; // if no change,newRegisterPort equal 0 FLOAT64 refferenceVolume; // if no change,refferenceValue equal -1 UINT8 digitalNumbers; // if digitalNumbers equal 0, means no change UINT32 MeterType; UINT8 IntegerNo; UINT8 DecimalNo; INT16 ROI_Angle; // if no chagne, digitalNumbers equal 0 INT32 Max_Flow; // if no change, fill -1 UINT16 xLeftTop; UINT16 yLeftTop; UINT16 xRightTop; UINT16 yRightTop; UINT16 xLeftBottom; UINT16 yLeftBottom; UINT16 xRightBottom; UINT16 yRightBottom; UINT8 OCRParameters; UINT8 FontWidth; UINT8 FontId; UINT8 RoID; UINT16 xLeftTop; UINT16 yLeftTop; UINT16 xRightTop; UINT16 yRightTop; UINT16 xLeftBottom; UINT16 yLeftBottom; UINT16 xRightBottom; UINT16 yRightBottom; UINT8 OCRParameters; UINT8 FontWidth; UINT8 FontId; UINT8 RoID; .... UINT16 command; UINT8 imageDate[6]; UINT8 secondDataServerIP[16]; // if disable, secondServerIP[0] equal 0 UINT16 secondDataServerPort; // if disable, secondServerPort equal 0 UINT8 secondImageServerIP[16]; // if disable, secondServerIP[0] equal 0 UINT16 secondImageServerPort; // if disable, secondServerPort equal 0 INT16 imageShift_y; // if no change, equal -1 UINT16 CRC; } STC_REGISTER_RESPONSE; ``` ### Data Collector ##### Data Upload ###### Request ```json= { UINT8 commandCode; // Always be 0x03 UINT8 MeterNumber[16], UINT8 uploadRecords; INT16 RSRP; INT16 RSRQ; INT16 Battery; ( Value*100 ) FLOAT64 Volume; UINT8 recordTime[6]; // ( YYMMDDHHMMSS in binary ) FLOAT64 Volume; UINT8 recordTime; ... UINT16 CRC; } STC_DATA_REPORT; ``` ###### Response ```json= { UINT8 commandCode; // Always be 0x04 UINT8 MeterNumber[16]; UINT8 uploadRecords; UINT8 currentTime[6]; // ( YYMMDDHHMMSS in binary ) UINT8 samplingTime[6]; // ( YYMMDDHHMMSS in binary ) UINT8 uplinkTime[6]; // ( YYMMDDHHMMSS in binary ) UINT8 uploadServerIP[16]; UINT16 uploadServerPort; UINT8 imageServerIP[16]; UINT16 imageServerPort; UINT32 samplingPeriod; UINT32 uplinkPeriod; UINT32 MeterType; UINT16 command; // Mask 0x01: upload image , 0x02: upload ROI UINT8 imageDate[6]; UINT16 CRC; } STC_DATA_REPORT_RESPONSE; ``` ##### Data fill-up ###### Request ```json= { UINT8 commandCode; // Always be 0x0D UINT8 MeterNumber[16], UINT8 protocolVersion; // Always be 0x01 UINT16 CRC; } STC_DATA_FILLUP; ``` ###### Response ```json= { UINT8 commandCode; // Always be 0x0E UINT8 MeterNumber[16]; UINT8 fillUpNum; // Max: 30 UINT8 fillUpDate1[4]; // new in Version 2 UINT8 fillUpDate2[4]; // new in Version 2 ... ... UINT16 CRC; } STC_DATA_FILLUP_RESPONSE; ``` Date Format: Year,Month,Day,Hour ##### Alert Upload AlertType: * 0x01: No Battery * <font color='color'> 0x02: Battery package communication error</font> ###### Request ```json= { UINT8 commandCode; // Always be 0x05 UINT8 MeterNumber[16]; UINT8 alertType; FLOAT64 Volume; INT16 Battery; // ( Value*100 ) INT16 RSRP; INT16 RSRQ; UINT8 currentTime[6]; // ( YYMMDDHHMMSS in binary ) UINT16 CRC; } ``` ###### Response ```json= { UINT8 commandCode; // Always be 0x06 UINT8 alertType; UINT8 MeterNumber[16]; UINT8 currentTime[6]; // ( YYMMDDHHMMSS in binary ) UINT8 samplingTime[6]; // ( YYMMDDHHMMSS in binary ) UINT8 uplinkTime[6]; // ( YYMMDDHHMMSS in binary ) UINT8 uploadServerIP[16]; UINT16 uploadServerPort; UINT8 imageServerIP[16]; UINT16 imageServerPort; UINT32 samplingPeriod; UINT32 uplinkPeriod; UINT32 MeterType; UINT16 command; // Mask 0x01: upload image , 0x02: upload ROI UINT8 imageDate[6]; UINT16 CRC; } ``` ### Image Collector #### UDP API: Upload Image ###### Request ```json= { UINT8 commandCode; // Always be 0x07 UINT8 MeterNumber[16]; UINT8 captureTime[6]; // ( YYMMDDHHMMSS in binary ) UINT16 width; UINT16 height; UINT32 totalSize; UINT16 totalBatchNum; UINT16 batchIndex; UINT8 imageType; // 0: B&W 1: Gray 2: compressed B&W 3: compressed Gray UINT8 data[dataSize]; // dataSize=totalSize/totalBatchNum. UINT16 CRC; } ``` ###### Response ```json= { UINT8 commandCode; // Always be 0x08 UINT8 MeterNumber[16]; UINT8 captureTime[6]; // ( YYMMDDHHMMSS in binary ) UINT16 width; UINT16 height; UINT32 totalSize; UINT16 totalBatchNum; UINT16 batchIndex; UINT8 currentTime[6]; // ( YYMMDDHHMMSS in binary ) UINT8 imageType; // 0: B&W 1: Gray 2: compressed B&W 3: compressed Gray UINT16 command; // Mask 0x01: upload image , 0x02: upload ROI UINT8 imageDate[6]; UINT16 CRC; } ``` #### UDP API: Upload ROI ###### Request Version 1 ```json= { UINT8 commandCode; // Always be 0x09 UINT8 MeterNumber[16]; UINT8 protocolVersion; // Always be 0x01 UINT8 reserved; UINT8 digitalNumbers; UINT32 MeterType; UINT8 IntegerNo; UINT8 DecimalNo; INT16 ROI_Angle; INT32 Max_Flow; INT16 imageShift_y; UINT16 xLeftTop; UINT16 yLeftTop; UINT16 xRightTop; UINT16 yRightTop; UINT16 xLeftBottom; UINT16 yLeftBottom; UINT16 xRightBottom; UINT16 yRightBottom; UINT8 OCRParameters; UINT8 FontWidth; UINT8 FontId; UINT8 RoID; UINT16 xLeftTop; UINT16 yLeftTop; UINT16 xRightTop; UINT16 yRightTop; UINT16 xLeftBottom; UINT16 yLeftBottom; UINT16 xRightBottom; UINT16 yRightBottom; UINT8 OCRParameters; UINT8 FontWidth; UINT8 FontId; UINT8 RoID; .... UINT16 CRC; } ``` ###### Response Version 1 ```json= { UINT8 commandCode; // Always be 0x0A UINT8 MeterNumber[16]; UINT8 digitalNumbers; UINT32 MeterType; UINT8 IntegerNo; UINT8 DecimalNo; UINT16 command; // Mask 0x01: upload image , 0x02: upload ROI UINT8 imageDate[6]; UINT16 CRC; } ``` ### IDAM Register ##### Get Device List ###### Protovol Versoin 0,1 ```json= { UINT8 commandCode; // Always be 0x10 UINT8 MeterNumber[16]; UINT8 IMEI[16]; UINT8 IMSI[16]; INT16 RSRP; INT16 RSRQ; INT16 Battery; // (value*100) UINT32 MeterType; UINT8 protocolVersion; // protocolVersion=0,1 UINT8 v0; UINT8 v1; UINT8 v2; UINT8 startIndex; // for odd bytes UINT16 CRC; } ``` ###### Protocol Version 2 ```json= { UINT8 commandCode; // Always be 0x10 UINT8 MeterNumber[16]; UINT8 IMEI[16]; UINT8 IMSI[16]; INT16 RSRP; INT16 RSRQ; INT16 Battery; // (value*100) UINT32 MeterType; UINT8 protocolVersion; // protocolVersion=2 UINT8 v0; UINT8 v1; UINT8 v2; UINT8 startIndex; // for odd bytes UINT32 p2pFrequency; UINT16 CRC; } ``` ###### Response for protocol version 1 ```json= { UINT8 commandCode; // Always be 0x11 UINT8 MeterNumber[16]; // UUID for IDAM UINT8 currentTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 samplingTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 uplinkTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 uploadServerIP[16]; UINT16 uploadServerPort; UINT8 imageServerIP[16]; UINT16 imageServerPort; UINT32 samplingPeriod; UINT32 uplinkPeriod; UINT16 command; UINT8 imageDate[6]; UINT32 p2pUploadOffset; // P2P upload offset UINT8 p2pTimeSliceUnit; UINT8 neverSleep; UINT16 imageTimeSlice; UINT16 earlyWakeUp; UINT8 totalP2pDevices; UINT8 offsetP2PID; // new in Version 1 UINT8 protocolVersion; // new in version 1 UINT8 startIndex; UINT8 batchDeviceNum; UINT8 MeterNumber1[16]; UINT8 MeterNumber2[16]; ... ... ... // According to meter numbers, 20 devices max for each batch UINT16 CRC; } ``` ###### Response for protocol version 2 ```json= { UINT8 commandCode; // Always be 0x11 UINT8 MeterNumber[16]; // UUID for IDAM UINT8 currentTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 samplingTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 uplinkTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 uploadServerIP[16]; UINT16 uploadServerPort; UINT8 imageServerIP[16]; UINT16 imageServerPort; UINT32 samplingPeriod; UINT32 uplinkPeriod; UINT16 command; UINT8 imageDate[6]; UINT32 p2pUploadOffset; // P2P upload offset UINT8 p2pTimeSliceUnit; UINT8 neverSleep; UINT16 imageTimeSlice; UINT16 earlyWakeUp; UINT8 totalP2pDevices; UINT8 offsetP2PID; // new in Version 1 UINT8 protocolVersion; // new in version 1 UINT8 startIndex; UINT8 batchDeviceNum; UINT8 MeterNumber1[16]; UINT8 MeterNumber1Command; // new in Version 2 UINT8 image1Date[6]; UINT8 MeterNumber1fillUpNum; // MAX: 5, new in Version 2 UINT8 fillUpDate11[4]; // new in Version 2 UINT8 fillUpDate12[4]; // new in Version 2 UINT8 fillUpDate13[4]; // new in Version 2 UINT8 fillUpDate14[4]; // new in Version 2 UINT8 fillUpDate15[4]; // new in Version 2 UINT8 MeterNumber2[16]; UINT8 MeterNumber2_Command; // new in Version 2 UINT8 image2Date[6]; UINT8 MeterNumber2_fillUpNum; // MAX: 5, new in Version 2 UINT8 fillUpDate21[4]; // new in Version 2 UINT8 fillUpDate22[4]; // new in Version 2 UINT8 fillUpDate23[4]; // new in Version 2 UINT8 fillUpDate24[4]; // new in Version 2 UINT8 fillUpDate25[4]; // new in Version 2 ... // According to meter numbers, 10 devices max for each batch UINT16 CRC; } ``` ##### Multiple Data Upload Not implement yet. ###### Request ```json= { UINT8 commandCode; // Maybe 0x26 UINT8 protocolVersion; UINT8 reserved; UINT8 meterCount; UINT8 MeterNumber[16], UINT8 uploadRecords; UINT8 reserved2; INT16 RSRP; INT16 RSRQ; INT16 Battery; ( Value*100 ) FLOAT64 Volume; UINT8 recordTime[6]; // ( YYMMDDHHMMSS in binary ) FLOAT64 Volume; UINT8 recordTime; ... UINT8 MeterNumber2[16], UINT8 uploadRecords2; UINT8 reserved22; INT16 RSRP2; INT16 RSRQ2; INT16 Battery2; ( Value*100 ) FLOAT64 Volume; UINT8 recordTime[6]; // ( YYMMDDHHMMSS in binary ) FLOAT64 Volume; UINT8 recordTime; UINT16 CRC; } STC_DATA_REPORT; ``` ###### Response ```json= { UINT8 commandCode; // // Maybe 0x27 UINT8 MeterNumber[16]; UINT8 uploadRecords; UINT8 currentTime[6]; // ( YYMMDDHHMMSS in binary ) UINT8 samplingTime[6]; // ( YYMMDDHHMMSS in binary ) UINT8 uplinkTime[6]; // ( YYMMDDHHMMSS in binary ) UINT8 uploadServerIP[16]; UINT16 uploadServerPort; UINT8 imageServerIP[16]; UINT16 imageServerPort; UINT32 samplingPeriod; UINT32 uplinkPeriod; UINT32 MeterType; UINT16 command; // Mask 0x01: upload image , 0x02: upload ROI UINT8 imageDate[6]; UINT16 CRC; } STC_DATA_REPORT_RESPONSE; ``` ##### upload Device Status ```json= { UINT8 commandCode; // Always be 0x12 UINT8 MeterNumber[16]; INT16 RSRP; INT16 RSRQ; INT16 Battery; // (value*100) UINT8 protocolVersion; // Always be 0 UINT8 neverSleep; UINT8 time[6]; UINT8 state; UINT8 reserved; UINT8 deviceNum; UINT16 deviceJoinStatus[20]; UINT16 CRC; } ``` ###### Response ```json= { UINT8 commandCode; // Always be 0x13 UINT8 neverSleep; UINT8 forceSleep; UINT8 reboot; UINT16 CRC; } ``` ## Gas Meter ### Default Port * Register Server Port: 2060 * Data Server Port: 2061 * Image Server Port: 2062 * Data 2 Server Port: 2063 * Image Server 2 Port: 2064 +### Pulse Type Protocol #### Register ##### Request from device ```json= { UINT8 commandCode; // Always be 0x14 UINT8 MeterNumber[16]; UINT8 IMEI[16]; UINT8 IMSI[16]; INT16 RSRP; INT16 RSRQ; INT16 Battery; // (value*100) UINT32 MeterType; UINT8 protocolVersion; // Always be 0 UINT8 v0; UINT8 v1; UINT8 v2; UINT16 reedSwitchType; UINT32 initPulseCnt; FLOAT32 volumeUnit; UINT16 maxAlarmCnt; UINT16 debounceTime; UINT16 maxAlarmTime; UINT16 deepSleepTime; UINT16 detectTime; UINT8 reserved; UINT16 CRC; } STC_REGISTER; ``` ##### Response from server ```json= { UINT8 commandCode; // Always be 0x15 UINT8 MeterNumber[16]; UINT8 IMEI[16]; UINT8 IMSI[16]; UINT8 currentTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 samplingTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 uplinkTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 uploadServerIP[16]; UINT16 uploadServerPort; UINT8 imageServerIP[16]; UINT16 imageServerPort; UINT32 samplingPeriod; UINT32 uplinkPeriod; UINT32 MeterType; UINT16 command; UINT8 imageDate[6]; UINT8 secondDataServerIP[16]; // if disable, secondServerIP[0] equal 0 UINT16 secondDataServerPort; // if disable, secondServerPort equal 0 UINT8 secondImageServerIP[16]; // if disable, secondServerIP[0] equal 0 UINT16 secondImageServerPort; // if disable, secondServerPort equal 0 UINT16 reedSwitchType; UINT32 initPulseCnt; FLOAT32 volumeUnit; UINT16 maxAlarmCnt; UINT16 debounceTime; UINT16 maxAlarmTime; UINT16 deepSleepTime; UINT16 detectTime; UINT8 reserved; UINT16 CRC; } STC_REGISTER_RESPONSE; ``` #### Data Collector ##### Data Upload ###### Request ```json= { UINT8 commandCode; // Always be 0x16 UINT8 MeterNumber[16], UINT8 uploadRecords; INT16 RSRP; INT16 RSRQ; INT16 Battery; ( Value*100 ) FLOAT64 Volume; UINT8 recordTime[6]; // ( YYMMDDHHMMSS in binary ) FLOAT64 Volume; UINT8 recordTime; ... UINT16 CRC; } STC_DATA_REPORT; ``` ###### Response ```json= { UINT8 commandCode; // Always be 0x17 UINT8 MeterNumber[16]; UINT8 uploadRecords; UINT8 currentTime[6]; // ( YYMMDDHHMMSS in binary ) UINT8 samplingTime[6]; // ( YYMMDDHHMMSS in binary ) UINT8 uplinkTime[6]; // ( YYMMDDHHMMSS in binary ) UINT8 uploadServerIP[16]; UINT16 uploadServerPort; UINT8 imageServerIP[16]; UINT16 imageServerPort; UINT32 samplingPeriod; UINT32 uplinkPeriod; UINT32 MeterType; UINT16 command; // 3: setup parameter UINT8 imageDate[6]; UINT16 reedSwitchType; UINT32 initPulseCnt; FLOAT32 volumeUnit; UINT16 maxAlarmCnt; UINT16 debounceTime; UINT16 maxAlarmTime; UINT16 deepSleepTime; UINT16 detectTime; UINT16 CRC; } STC_DATA_REPORT_RESPONSE; ``` #### Pulse Alarm ###### Request ```json= { UINT8 commandCode; // Always be 0x18 UINT8 MeterNumber[16]; UINT32 errorCode; // 0: No Error ,1: CRC error ,2: No Response UINT32 alarmCode; // bit0: Pulse 1 Alarm, bit1: Pluse 2 Alarm FLOAT64 Volume; INT16 Battery; // ( Value*100 ) INT16 RSRP; INT16 RSRQ; UINT8 currentTime[6]; // ( YYMMDDHHMMSS in binary ) UINT8 reserved; UINT16 CRC; } ``` ###### Response ```json= { UINT8 commandCode; // Always be 0x19 UINT8 MeterNumber[16]; UINT32 errorCode; // 0: No Error ,1: CRC error ,2: No Response UINT32 alarmCode; // bit0: Pulse 1 Alarm, bit1: Pluse 2 Alarm UINT8 currentTime[6]; // ( YYMMDDHHMMSS in binary ) UINT8 samplingTime[6]; // ( YYMMDDHHMMSS in binary ) UINT8 uplinkTime[6]; // ( YYMMDDHHMMSS in binary ) UINT8 uploadServerIP[16]; UINT16 uploadServerPort; UINT8 imageServerIP[16]; UINT16 imageServerPort; UINT32 samplingPeriod; UINT32 uplinkPeriod; UINT32 MeterType; UINT16 command; // Mask 0x01: upload image , 0x02: upload ROI UINT8 imageDate[6]; UINT8 reserved; UINT16 CRC; } ```+ ### RTU Type Protocol #### Register ##### Request from device ```json= { UINT8 commandCode; // Always be 0x1A UINT8 MeterNumber[16]; UINT8 IMEI[16]; UINT8 IMSI[16]; INT16 RSRP; INT16 RSRQ; INT16 Battery; // (value*100) UINT32 MeterType; UINT8 protocolVersion; // Always be 0 UINT8 v0; UINT8 v1; UINT8 v2; FLOAT32 pressureHighAlarmSet; FLOAT32 pressureHighAlarmReset; FLOAT32 pressureLowAlarmSet; FLOAT32 pressureLowAlarmReset; FLOAT32 temperatureHighAlarmSet; FLOAT32 temperatureHighAlarmReset; FLOAT32 temperatureLowAlarmSet; FLOAT32 temperatureLowAlarmReset; FLOAT32 caliFlowHighAlarmSet; FLOAT32 caliFlowHighAlarmReset; FLOAT32 caliFlowLowAlarmSet; FLOAT32 caliFlowLowAlarmReset; UINT8 reserved; UINT16 CRC; } STC_REGISTER; ``` ##### Response from server ```json= { UINT8 commandCode; // Always be 0x1B UINT8 MeterNumber[16]; UINT8 IMEI[16]; UINT8 IMSI[16]; UINT8 currentTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 samplingTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 uplinkTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 uploadServerIP[16]; UINT16 uploadServerPort; UINT8 imageServerIP[16]; UINT16 imageServerPort; UINT32 samplingPeriod; UINT32 uplinkPeriod; UINT32 MeterType; UINT16 command; UINT8 imageDate[6]; UINT8 secondDataServerIP[16]; // if disable, secondServerIP[0] equal 0 UINT16 secondDataServerPort; // if disable, secondServerPort equal 0 UINT8 secondImageServerIP[16]; // if disable, secondServerIP[0] equal 0 UINT16 secondImageServerPort; // if disable, secondServerPort equal 0 FLOAT32 pressureHighAlarmSet; FLOAT32 pressureHighAlarmReset; FLOAT32 pressureLowAlarmSet; FLOAT32 pressureLowAlarmReset; FLOAT32 temperatureHighAlarmSet; FLOAT32 temperatureHighAlarmReset; FLOAT32 temperatureLowAlarmSet; FLOAT32 temperatureLowAlarmReset; FLOAT32 caliFlowHighAlarmSet; FLOAT32 caliFlowHighAlarmReset; FLOAT32 caliFlowLowAlarmSet; FLOAT32 caliFlowLowAlarmReset; UINT8 reserved; UINT16 CRC; } STC_REGISTER_RESPONSE; ``` #### Data Collector ##### Data Upload ###### Request ```json= { UINT8 commandCode; // Always be 0x1C UINT8 MeterNumber[16], UINT8 uploadRecords; INT16 RSRP; INT16 RSRQ; INT16 Battery; ( Value*100 ) FLOAT32 pressure; FLOAT32 temperature; FLOAT32 caliFlowRate; FLOAT32 flowCoefficient; FLOAT32 batteryVoltage; FLOAT32 caliOkVolume; FLOAT32 caliNokVolume; FLOAT32 alertType; UINT8 recordTime[6]; // ( YYMMDDHHMMSS in binary ) FLOAT32 pressure; FLOAT32 temperature; FLOAT32 caliFlowRate; FLOAT32 flowCoefficient; FLOAT32 batteryVoltage; FLOAT32 caliOkVolume; FLOAT32 caliNokVolume; FLOAT32 alertType; UINT8 recordTime[6]; // ( YYMMDDHHMMSS in binary ) ... UINT8 reserved; UINT16 CRC; } STC_DATA_REPORT; ``` ###### Response ```json= { UINT8 commandCode; // Always be 0x1D UINT8 MeterNumber[16]; UINT8 uploadRecords; UINT8 currentTime[6]; // ( YYMMDDHHMMSS in binary ) UINT8 samplingTime[6]; // ( YYMMDDHHMMSS in binary ) UINT8 uplinkTime[6]; // ( YYMMDDHHMMSS in binary ) UINT8 uploadServerIP[16]; UINT16 uploadServerPort; UINT8 imageServerIP[16]; UINT16 imageServerPort; UINT32 samplingPeriod; UINT32 uplinkPeriod; UINT32 MeterType; UINT16 command; // 0: none UINT8 imageDate[6]; FLOAT32 pressureHighAlarmSet; FLOAT32 pressureHighAlarmReset; FLOAT32 pressureLowAlarmSet; FLOAT32 pressureLowAlarmReset; FLOAT32 temperatureHighAlarmSet; FLOAT32 temperatureHighAlarmReset; FLOAT32 temperatureLowAlarmSet; FLOAT32 temperatureLowAlarmReset; FLOAT32 caliFlowHighAlarmSet; FLOAT32 caliFlowHighAlarmReset; FLOAT32 caliFlowLowAlarmSet; FLOAT32 caliFlowLowAlarmReset; UINT16 CRC; } STC_DATA_REPORT_RESPONSE; ``` #### RTU Alarm ###### Request ```json= { UINT8 commandCode; // Always be 0x1E UINT8 MeterNumber[16]; UINT32 errorCode; // 0: No Error ,1: CRC error ,2: No Response UINT32 alarmCode; // bit0: Pulse 1 Alarm, bit1: Pluse 2 Alarm FLOAT32 pressure; FLOAT32 temperature; FLOAT32 caliFlowRate; FLOAT32 flowCoefficient; FLOAT32 batteryVoltage; FLOAT32 caliOkVolume; FLOAT32 caliNokVolume; FLOAT32 alertType; INT16 Battery; // ( Value*100 ) INT16 RSRP; INT16 RSRQ; UINT8 currentTime[6]; // ( YYMMDDHHMMSS in binary ) UINT8 reserved; UINT16 CRC; } ``` ###### Response ```json= { UINT8 commandCode; // Always be 0x1F UINT8 MeterNumber[16]; UINT32 errorCode; // 0: No Error ,1: CRC error ,2: No Response UINT32 alarmCode; // bit0: Pulse 1 Alarm, bit1: Pluse 2 Alarm UINT8 currentTime[6]; // ( YYMMDDHHMMSS in binary ) UINT8 samplingTime[6]; // ( YYMMDDHHMMSS in binary ) UINT8 uplinkTime[6]; // ( YYMMDDHHMMSS in binary ) UINT8 uploadServerIP[16]; UINT16 uploadServerPort; UINT8 imageServerIP[16]; UINT16 imageServerPort; UINT32 samplingPeriod; UINT32 uplinkPeriod; UINT32 MeterType; UINT16 command; // Mask 0x01: upload image , 0x02: upload ROI UINT8 imageDate[6]; UINT8 reserved; UINT16 CRC; } ``` # Radar Type Protocol #### Commands: |Code|Name| |---|---| |0x00|None| |0x03|setParameters| |0x04|upload fill-up data| #### Register ##### Request from device ```json= { UINT8 commandCode; // Always be 0x20 UINT8 MeterNumber[16]; UINT8 IMEI[16]; UINT8 IMSI[16]; INT16 RSRP; INT16 RSRQ; INT16 Battery; // ( Value * 100 ) UINT32 MeterType; UINT8 protocolVersion;// for CRC16 needs odd bytes UINT8 V0; UINT8 V1; UINT8 V2; FLOAT32 Lat; FLOAT32 Lon; UINT8 reserved; UINT16 CRC; } STC_REGISTER; ``` ##### Response from server ```json= { UINT8 commandCode; // Always be 0x02 UINT8 MeterNumber[16]; UINT8 IMEI[16]; UINT8 IMSI[16]; UINT8 currentTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 samplingTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 uplinkTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 uploadServerIP[16]; UINT16 uploadServerPort; UINT8 imageServerIP[16]; UINT16 imageServerPort; UINT32 samplingPeriod; UINT32 uplinkPeriod; UINT32 MeterType; UINT16 command; UINT8 imageDate[6]; UINT8 secondDataServerIP[16]; // if disable, secondServerIP[0] equal 0 UINT16 secondDataServerPort; // if disable, secondServerPort equal 0 UINT8 secondImageServerIP[16]; // if disable, secondServerIP[0] equal 0 UINT16 secondImageServerPort; // if disable, secondServerPort equal 0 UINT32 highAlarm; // percentage*100 UINT32 lowAlarm; UINT16 valueRange; UINT16 readCount; UINT16 defaultRadarBattery; UINT32 pinPassword; UINT16 earlyWakeUp; UINT8 reserved; } STC_REGISTER_RESPONSE; ``` #### Data Collector ##### Data Upload ###### Request ```json= { UINT8 commandCode; // Always be 0x22 STRING MeterNumber[16]; UINT8 uploadRecords; // Always be 0 INT16 RSRP; INT16 RSRQ; INT16 Battery; // ( value*100 ) FLOAT32 radarBattery; FLOAT32 waterlevel; UINT8 recordTime[6]; // ( YYMMDDHHMMSS in binary) FLOAT32 radarBattery; FLOAT32 waterlevel; UINT8 recordTime[6]; // ( YYMMDDHHMMSS in binary) ... UINT16 CRC; } STC_DATA_REPORT; ``` ###### Response ```json= { UINT8 commandCode; // Always be 0x23 UINT8 MeterNumber[16]; UINT8 uploadRecords; UINT8 currentTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 samplingTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 uplinkTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 uploadServerIP[16]; UINT16 uploadServerPort; UINT8 imageServerIP[16]; UINT16 imageServerPort; UINT32 samplingPeriod; UINT32 uplinkPeriod; UINT32 MeterType; UINT16 command; // Mask 0x01: upload image , 0x02: upload ROI UINT8 reserved[6]; UINT32 highAlarm; // percentage*100 UINT32 lowAlarm; UINT16 valueRange; UINT16 readCount; UINT16 defaultRadarBattery; UINT32 pinPassword; UINT16 earlyWakeUp; } STC_DATA_REPORT_RESPONSE; ``` #### Radar Alarm ###### Request ```json= { UINT8 commandCode; // Always be 0x24 STRING MeterNumber[16]; UINT32 errorCode; UINT32 alarmCode; FLOAT32 radarBattery; FLOAT32 waterlevel; INT16 Battery; // (value*100) INT16 RSRP; INT16 RSRQ; UINT8 currentTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 reserve;: } ``` ###### Response ```json= { UINT8 commandCode; // Always be 0x25 STRING MeterNumber[16]; UINT32 errorCode; UINT32 alarmCode; UINT8 currentTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 samplingTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 uplinkTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 uploadServerIP[16]; UINT16 uploadServerPort; UINT8 imageServerIP[16]; UINT16 imageServerPort; UINT32 samplingPeriod; UINT32 uplinkPeriod; UINT32 MeterType; UINT16 command; UINT8 imageDate[6]; UINT8 reserve; } ``` ##### Data fill-up ###### Request ```json= { UINT8 commandCode; // Always be 0x2D UINT8 MeterNumber[16], UINT8 protocolVersion; // Always be 0x01 UINT16 CRC; } STC_DATA_FILLUP; ``` ###### Response ```json= { UINT8 commandCode; // Always be 0x2E UINT8 MeterNumber[16]; UINT8 fillUpNum; // Max: 30 UINT8 fillUpDate1[6]; UINT8 fillUpDate2[6]; ... ... UINT16 CRC; } STC_DATA_FILLUP_RESPONSE; ``` Date Format: Year,Month,Day,Hour,Minute,Second # Ultrasonic Type Protocol #### Commands: |Code|Name| |---|---| |0x00|None| |0x03|setParameters| |0x04|upload fill-up data| #### Register ##### Request from device ```json= { UINT8 commandCode; // Always be 0x30 UINT8 MeterNumber[16]; UINT8 IMEI[16]; UINT8 IMSI[16]; INT16 RSRP; INT16 RSRQ; INT16 Battery; // ( Value * 100 ) UINT32 MeterType; UINT8 protocolVersion;// for CRC16 needs odd bytes UINT8 V0; UINT8 V1; UINT8 V2; FLOAT32 Lat; FLOAT32 Lon; UINT8 reserved; UINT16 CRC; } STC_REGISTER; ``` ##### Response from server ```json= { UINT8 commandCode; // Always be 0x31 UINT8 MeterNumber[16]; UINT8 IMEI[16]; UINT8 IMSI[16]; UINT8 currentTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 samplingTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 uplinkTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 uploadServerIP[16]; UINT16 uploadServerPort; UINT8 imageServerIP[16]; UINT16 imageServerPort; UINT32 samplingPeriod; UINT32 uplinkPeriod; UINT32 MeterType; UINT16 command; UINT8 imageDate[6]; UINT8 secondDataServerIP[16]; // if disable, secondServerIP[0] equal 0 UINT16 secondDataServerPort; // if disable, secondServerPort equal 0 UINT8 secondImageServerIP[16]; // if disable, secondServerIP[0] equal 0 UINT16 secondImageServerPort; // if disable, secondServerPort equal 0 UINT32 level_highAlarm; // percentage*100 UINT32 level_lowAlarm; UINT16 level_valueRange; UINT32 flow_highAlarm; // percentage*100 UINT32 flow_lowAlarm; UINT16 flow_valueRange; UINT16 readCount; UINT32 pinPassword; UINT16 earlyWakeUp; UINT8 reserved; } STC_REGISTER_RESPONSE; ``` #### Data Collector ##### Data Upload ###### Request ```json= { UINT8 commandCode; // Always be 0x32 UINT8 MeterNumber[16]; UINT8 uploadRecords; // Always be 0 INT16 RSRP; INT16 RSRQ; INT16 Battery; // ( value*100 ) FLOAT32 waterflow; FLOAT32 waterlevel; FLOAT32 waterDirection; FLOAT32 temperature; FLOAT32 pressureLevel; UINT8 recordTime[6]; // ( YYMMDDHHMMSS in binary) FLOAT32 waterflow; FLOAT32 waterlevel; FLOAT32 waterDirection; FLOAT32 temperature; FLOAT32 pressureLevel; UINT8 recordTime[6]; // ( YYMMDDHHMMSS in binary) ... UINT16 CRC; } STC_DATA_REPORT; ``` ###### Response ```json= { UINT8 commandCode; // Always be 0x33 UINT8 MeterNumber[16]; UINT8 uploadRecords; UINT8 currentTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 samplingTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 uplinkTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 uploadServerIP[16]; UINT16 uploadServerPort; UINT8 imageServerIP[16]; UINT16 imageServerPort; UINT32 samplingPeriod; UINT32 uplinkPeriod; UINT32 MeterType; UINT16 command; // Mask 0x01: upload image , 0x02: upload ROI UINT8 reserved[6]; UINT32 level_highAlarm; // percentage*100 UINT32 level_lowAlarm; UINT16 level_valueRange; UINT32 flow_highAlarm; // percentage*100 UINT32 flow_lowAlarm; UINT16 flow_valueRange; UINT16 readCount; UINT32 pinPassword; UINT16 earlyWakeUp; } STC_DATA_REPORT_RESPONSE; ``` #### Ultrasonic Alarm ###### Request ```json= { UINT8 commandCode; // Always be 0x34 UINT8 MeterNumber[16]; UINT32 errorCode; UINT32 alarmCode; FLOAT32 radarBattery; FLOAT32 waterlevel; FLOAT32 waterDirection; FLOAT32 temperature; FLOAT32 pressureLevel; INT16 Battery; // (value*100) INT16 RSRP; INT16 RSRQ; UINT8 currentTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 reserve;: } ``` ###### Response ```json= { UINT8 commandCode; // Always be 0x35 UINT8 MeterNumber[16]; UINT32 errorCode; UINT32 alarmCode; UINT8 currentTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 samplingTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 uplinkTime[6]; // ( YYMMDDHHMMSS in binary) UINT8 uploadServerIP[16]; UINT16 uploadServerPort; UINT8 imageServerIP[16]; UINT16 imageServerPort; UINT32 samplingPeriod; UINT32 uplinkPeriod; UINT32 MeterType; UINT16 command; UINT8 imageDate[6]; UINT8 reserve; } ``` ##### Data fill-up ###### Request ```json= { UINT8 commandCode; // Always be 0x3D UINT8 MeterNumber[16], UINT8 protocolVersion; // Always be 0x01 UINT16 CRC; } STC_DATA_FILLUP; ``` ###### Response ```json= { UINT8 commandCode; // Always be 0x3E UINT8 MeterNumber[16]; UINT8 fillUpNum; // Max: 30 UINT8 fillUpDate1[6]; UINT8 fillUpDate2[6]; ... ... UINT16 CRC; } STC_DATA_FILLUP_RESPONSE; ``` Date Format: Year,Month,Day,Hour,Minute,Second # LoRa P2P Protocol https://hackmd.io/kf4evM3JREe_CMTVPOeRpQ