-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiotsaDataLogger.h
50 lines (45 loc) · 1.15 KB
/
iotsaDataLogger.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef _IOTSADATALOGGER_H_
#define _IOTSADATALOGGER_H_
#include "iotsa.h"
#include "iotsaApi.h"
#include "dataStore.h"
#undef WITH_MEMORY_STORE
#ifdef WITH_MEMORY_STORE
#include "dataStoreMemory.h"
typedef DataStoreMemory DataStoreImplementation;
#else
#include "dataStoreFile.h"
typedef DataStoreFile DataStoreImplementation;
#endif
//
// Input pin
//
#define PIN_ANALOG_IN 34
class IotsaDataLoggerMod : public IotsaApiMod {
public:
IotsaDataLoggerMod(IotsaApplication &_app)
: IotsaApiMod(_app),
store(new DataStoreImplementation())
{}
void setup() override;
void serverSetup() override;
void loop() override;
String info() override;
using IotsaBaseMod::needsAuthentication;
protected:
void configLoad() override;
void configSave() override;
void handler();
void dataHandler();
void archiveHandler();
bool getHandler(const char *path, JsonObject& reply) override;
bool putHandler(const char *path, const JsonVariant& request, JsonObject& reply) override;
int interval;
float adcMultiply;
float adcOffset;
const int nSample = 5;
const int minimumUptimeMillis = 15000;
bool deepSleep = false;
DataStore *store;
};
#endif