Qubit 2020 / presensfirmwareupdate

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers wifi_events.h Source File

wifi_events.h

00001 #ifndef WIFI_EVENTS_H
00002 #define WIFI_EVENTS_H
00003 
00004 #include "cisme.h"
00005 
00006 typedef enum {
00007     ERROR_BATTERY_LOW     = 0x1,
00008     ERROR_PUMP_RPM_NULL   = 0x2,
00009     ERROR_MISSED_ISFET    = 0x4,
00010     ERROR_MISSED_DSPARAMS = 0x8,
00011 } Errors;
00012 
00013 #ifdef USE_WIFI
00014  
00015 #define ADD_START_ERROR(_startErr) startErrors |= _startErr
00016 
00017 extern char startErrors;
00018 
00019 /**
00020  * Start handling of Wi-Fi events.
00021  */
00022 void wifiEventsStart(void);
00023 
00024 /**
00025  * Send experiment data.
00026  *
00027  * @param id Experiment identifier
00028  * @param step Current step index
00029  * @param timeRemaining Remainig experiment time
00030  * @param ph PH value
00031  * @param o2 O2 value
00032  * @param battery Battery level
00033  * @param temperature Temperature (C)
00034  */
00035 void wifiEventsSendDataExpInd(int32_t step, int32_t timeRemaining, double ph, double o2, double battery, double temperature);
00036 
00037 /**
00038  * Send temperature calibration data.
00039  *
00040  * @param tempBuffer Temperature value entered by user
00041  * @param tempVolts Average volts value
00042  */
00043 void wifiEventsSendTempCalDataInd(float tempBuffer, float tempVolts);
00044 
00045 /**
00046  * Send PH calibration data.
00047  *
00048  * @param phBuffer PH value entered by user
00049  * @param phVoltsCurrent Current volts value
00050  * @param phVoltsAverage Average volts value
00051  */
00052 void wifiEventsSendPhCalDataInd(float phBuffer, float phVoltsCurrent, float phVoltsAverage);
00053 
00054 /**
00055  * Send errors.
00056  *
00057  * @param errors Errors bitmask (see Errors)
00058  */
00059 void wifiEventsSendErrorsInd(char errors);
00060 
00061 /**
00062  * Send pump calibration data.
00063  *
00064  * @param intensity Pump intensity in percents
00065  * @param rpm Pump RPM
00066  */
00067 void wifiEventsSendPumpCalDataInd(int intensity, int rpm);
00068 
00069 #else // USE_WIFI
00070 
00071 #define ADD_START_ERROR(_startErr)
00072 
00073 static inline void wifiEventsStart(void)
00074 {
00075 }
00076 
00077 static inline void wifiEventsSendDataExpInd(int32_t step, int32_t timeRemaining, double ph, double o2, double battery, double temperature)
00078 {
00079 }
00080 
00081 static inline void wifiEventsSendTempCalDataInd(float tempBuffer, float tempVolts)
00082 {
00083 }
00084 
00085 static inline void wifiEventsSendPhCalDataInd(float phBuffer, float phVoltsCurrent, float phVoltsAverage)
00086 {
00087 }
00088 
00089 static inline void wifiEventsSendErrorsInd(char errors)
00090 {
00091 }
00092 
00093 static inline void wifiEventsSendPumpCalDataInd(int intensity, int rpm)
00094 {
00095 }
00096 
00097 #endif // USE_WIFI
00098 
00099 #endif // WIFI_EVENTS_H