|
LOGGER
Logger
Data Logging using ESP8266
|
#include <arduino.h>#include <Time.h>#include <ESP8266WiFi.h>#include "webpages.h"#include "dataservices.h"#include "espserver.h"#include "i2cservices.h"#include "networkservices.h"#include "parameters.h"#include "pincounter.h"#include "security.h"#include "sensorlibrary.h"#include "services.h"#include "sleepservices.h"#include "tca9539.h"#include "timeservices.h"#include "webservices.h"Macros | |
| #define | webpagesEdit 1 |
| version of this module | |
| #define | DEBUG_LEVEL 1 |
| Set to non zero value to increase the detail of debug output. | |
| #define | DEFAULT_INTERVAL (15) |
| Default # of seconds for pages that display lists of samples. | |
| #define | DEFAULT_SAMPLES (15) |
| Default # of samples for pages that display lists of samples. | |
Enumerations | |
| enum | ChartType_t { ChartNone, ChartSamples, ChartIntervals } |
| Possible charts to emit at the end of a page. | |
Functions | |
| LOCALREF void | rebootSystem (const char *) |
| force a system reboot | |
| LOCALREF void | sendChartHeader (Print *pPrint, ChartType_t chartType, SensorDatatypeID_t datatype) |
| Send the header portion of chart initialization. | |
| EXTERNDEF void | webpagesInit () |
| < version of this include file More... | |
| LOCALDEF void | webEmitMenuItem (Print *pPrint, const char *pName, const char *pUrl) |
| EXTERNDEF void | webEmitMainMenu (Print *pPrint) |
| Emit the main menu. | |
| EXTERNDEF void | processButtonCommand (Print *pPrint, String buttonPressed) |
| EXTERNDEF void | processPulldownSelected (Print *pPrint, String pulldownName, String pulldownValue) |
| EXTERNDEF void | webEmitHeader (Print *pPrint) |
| Emit the header section of a web page. More... | |
| EXTERNDEF void | handleRootPage () |
| EXTERNDEF time_t | getTimeFromArguments (String prefix, time_t defaultTime) |
| EXTERNDEF void | emitDaytimeInput (Print *pPrint, String prefix, int32_t defaultYear, int32_t defaultMonth, int32_t defaultDay, int32_t defaultHour, int32_t defaultMin, int32_t defaultSec) |
| EXTERNDEF void | handleSamplesPage () |
| display the sample history page More... | |
| EXTERNDEF void | handleParametersPage () |
| Display all of the permanent parameters on a web page. | |
| EXTERNDEF void | handleIntervalsPage () |
| Display web page for intervals. | |
| EXTERNDEF void | handleIOpinControlPage () |
| display the I/O pin control page | |
| EXTERNDEF void | handleSensorsPage () |
| display the sensors page | |
| EXTERNDEF void | webUpdateTime (const char *pTimeZone) |
Variables | |
| EXTERNVAR ConfigMode_t | savedConfigMode |
| Remember what mode to run in next. | |
| EXTERNVAR ConfigMode_t | runningConfigMode |
| Mode we are currently running in. | |
Web page routines that are application specific.
| EXTERNDEF void emitDaytimeInput | ( | Print * | pPrint, |
| String | prefix, | ||
| int32_t | defaultYear, | ||
| int32_t | defaultMonth, | ||
| int32_t | defaultDay, | ||
| int32_t | defaultHour, | ||
| int32_t | defaultMin, | ||
| int32_t | defaultSec | ||
| ) |
Emit a time and date selection, each field of the time and date is named: year, month, day, hour, minutes, seconds. The field names are prefixed the the prefix argument.
| pPrint | where to emit the output |
| prefix | string to prefix each field name with |
| defaultYear | initial value for year |
| defaultMonth | initial value for month |
| defaultDay | initial value for day |
| defaultHour | initial value for hour |
| defaultMin | initial value for minutes |
| defaultSec | initial value for seconds |
| EXTERNDEF time_t getTimeFromArguments | ( | String | prefix, |
| time_t | defaultTime | ||
| ) |
Read the time from a set of related arguments. A prefix is supplied and the arguments are that prefix followed by these names: year, month, day, hour, minutes, seconds. The default time is used when an argument is missing. The decision to use it is on an argument by argument basis, so a default time can be used and offset by a number of seconds by only passing the seconds argument.
| prefix | argument prefix |
| defaultTime | time if argument is missing |
| EXTERNDEF void handleRootPage | ( | ) |
Service routine called when there is a server request for the root file.
| EXTERNDEF void handleSamplesPage | ( | ) |
display the sample history page
Service routine called when there is a server request to display a list of samples. (Also used for the root page.)
| EXTERNDEF void processButtonCommand | ( | Print * | pPrint, |
| String | buttonName | ||
| ) |
Using the arguments from the web page handle a button press and perform any actions that are expected.
| pPrint | where to send output |
| buttonName | name of the button that was pressed |
| EXTERNDEF void processPulldownSelected | ( | Print * | pPrint, |
| String | pulldownName, | ||
| String | pulldownValue | ||
| ) |
Using the arguments from the web page handle a pulldown selection and perform any actions that are expected.
| pPrint | where to send output |
| pulldownName | name of the selector |
| pulldownValue | name of the option selected |
| EXTERNDEF void webEmitHeader | ( | Print * | pPrint | ) |
Emit the header section of a web page.
NOTE: Depends on the global variable chartType set when a page is started. ??? should this be indirected through a table that establishes other things too?
| LOCALDEF void webEmitMenuItem | ( | Print * | pPrint, |
| const char * | pName, | ||
| const char * | pUrl | ||
| ) |
Emit a menu item. If a signature was passed in pass the signature to the menu item.
| pPrint | where to send the output |
| pName | what to use for the menu item name |
| pUrl | where to go to, no arguments expected |
| EXTERNDEF void webpagesInit | ( | ) |
< version of this include file
Initialize the web services
| EXTERNDEF void webUpdateTime | ( | const char * | pTimeZone | ) |
Schedule a time update. The actual update can be asyncronous and occur after this routine returns.
| pTimeZone | name of the local time zone |
1.8.10