![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
iot_water_monitor_v2
Dependencies: easy-connect-v16 Watchdog FP MQTTPacket RecordType-v-16 watersenor_and_temp_code
Diff: Simple-MQTT/SimpleMQTT.h
- Revision:
- 39:a5ee98bd0050
- Parent:
- 36:d0b628087ac8
- Child:
- 40:4356c209c58d
--- a/Simple-MQTT/SimpleMQTT.h Mon Feb 19 14:18:22 2018 +0000 +++ b/Simple-MQTT/SimpleMQTT.h Wed Feb 21 03:41:23 2018 +0000 @@ -39,6 +39,12 @@ RELAY_STATE, CONFIG_VALUE } UploadType; + +typedef enum { + CONTROL_CMD = 0, + READ_CMD, + SETUP_CMD +} CommandType; struct UploadValue { float ADC_PHVal; @@ -166,7 +172,7 @@ msg[0]='\0'; strncat (msg, (char*)msgMQTT.message.payload, msgMQTT.message.payloadlen); printf ("--->>> MQTT_SubscribeCallback msg: %s\n\r", msg); - //{"type":"3","deviceId":"string"} + /* {"type":"3","deviceId":"string"} */ Json json(msg, msgMQTT.message.payloadlen); if (!json.isValidJson()) { printf("Invalid JSON: %s", msg); @@ -185,6 +191,9 @@ printf("Command Type: %d, error %d\r\n", CommandType, ret); switch (CommandType) { + case CONTROL_CMD: CE_Calibrate(); + break; + case 3: int relayState1, relayState2, relayState3; KeyIndex = json.findKeyIndexIn("cmdID", 0); KeyValueIndex = json.findChildIndexOf(KeyIndex, 0);