iot_water_monitor_v2

Dependencies:   easy-connect-v16 Watchdog FP MQTTPacket RecordType-v-16 watersenor_and_temp_code

Revision:
25:cf7a3e31622a
Parent:
24:3de3cf978e60
Child:
26:f40cc4d011b0
--- a/Simple-MQTT/SimpleMQTT.h	Fri Dec 29 19:13:03 2017 +0000
+++ b/Simple-MQTT/SimpleMQTT.h	Fri Dec 29 19:20:23 2017 +0000
@@ -41,6 +41,9 @@
     float ADC_PHVal;
     float ADC_DOVal;
     
+    float SENSOR_PHVal;
+    float SENSOR_DOVal;
+    
     int   RELAY_State_1;
     int   RELAY_State_2;
 	
@@ -107,6 +110,15 @@
  */
 int MQTT_PublishADC(MQTT::Client<MQTTNetwork, Countdown, MQTT_MAX_PACKET_SIZE>* client, time_t inputTime, float adcVal_0);
 
+/** brief       Publish sensor values to the server
+ *  param[in]   client        MQTT client 
+ *  param[in]   inputTime     The time when the data is attempt to be sent 
+ *  param[in]   pH        	  pH Value
+ *  param[in]   DO        	  Oxygen value
+ *  retral      returnCode from MQTTClient.h 
+ */
+int MQTT_PublishSensorValue(MQTT::Client<MQTTNetwork, Countdown, MQTT_MAX_PACKET_SIZE>* client, time_t inputTime, float pH, float DO);
+
 /** brief       Publish relay states to the server
  *  param[in]   client        MQTT client 
  *  param[in]   inputTime     The time when the data is attempt to be sent 
@@ -116,7 +128,7 @@
  */
 int MQTT_PublishRelayState(MQTT::Client<MQTTNetwork, Countdown, MQTT_MAX_PACKET_SIZE>* client, time_t inputTime, int relay1, int relay2);
 
-/** brief       Publish relay states to the server
+/** brief       Publish configuration values to the server
  *  param[in]   client        MQTT client 
  *  param[in]   inputTime     The time when the data is attempt to be sent 
  *  param[in]   mode          current mode: automatic (0) or manual (1)
@@ -266,6 +278,10 @@
     return client->publish(pubTopic, message);    
 }
 
+int MQTT_PublishSensorValue(MQTT::Client<MQTTNetwork, Countdown, MQTT_MAX_PACKET_SIZE>* client, time_t inputTime, float pH, float DO) {
+	
+}
+
 int MQTT_PublishRelayState(MQTT::Client<MQTTNetwork, Countdown, MQTT_MAX_PACKET_SIZE>* client, time_t inputTime, int relay1, int relay2) {
     MQTT::Message message;
     const char* pubTopic = MQTT_EVENT_TOPIC;         
@@ -323,7 +339,7 @@
     switch (uploadType) {
         case (ADC_VALUE): 		retVal = MQTT_PublishADC(client, inputTime, uploadStruct.ADC_PHVal);
             break;
-        case (SENSOR_VALUE): 	retVal =  MQTT::SUCCESS;
+        case (SENSOR_VALUE): 	retVal =  MQTT_PublishSensorValue(client, inputTime, uploadStruct.SENSOR_PHVal, uploadStruct.SENSOR_DOVal);
             break;
         case (RELAY_STATE):		retVal = MQTT_PublishRelayState(client, inputTime, uploadStruct.RELAY_State_1, uploadStruct.RELAY_State_2);
             break;