LOGGER  Logger
Data Logging using ESP8266
sensorlibrary.h
Go to the documentation of this file.
1 //
6 // Copyright (c) 2016 by Dragonnorth Group, all rights reserved.
7 //
8 // Author: Michael Newman
9 #ifndef sensorlibraryHedit
10 #define sensorlibraryHedit 1
11 // 14Feb16 MJNewman 1: Created
12 //
13 // An unrestricted license to this software is granted to:
14 // None granted yet.
15 // and may be granted to others.
16 
17 #include "basetype.h"
18 #include "sensordatatype.h"
19 #include "dataservices.h" // for LogElement_t
20 
22 extern void sensorlibraryInit();
23 
28 extern void sensorlibraryDumpSensors(Print *pPrinter = &Serial,
29  FormatType_t formatType = FormatForConsole);
30 
32 typedef enum {
33  InterfaceProcessorPin,
34  InterfaceOneWire,
35  InterfaceI2C,
37 
44 extern String sensorlibraryInterfaceGetName(SensorInterfaceID_t interface);
45 
56 typedef enum {
57  SensorProcessorADCpin, // value logged is voltage
58  SensorProcessorIOpin, // value logged comes from a pin
59  SensorDS18x20, // A temperature sensor, DS18S20, DS18B20, DS1822
60  SensorTCA9535, // A 16 bit I/O pin expander
61  SensorAD7091R, // A 4 channel 12 bit ADC
62  SensorDLVRpressure, // a DLVR pressure sensor
64 
71 extern String sensorlibrarySensorTypeGetName(SensorTypeID_t sensorType);
72 
75 extern const char * const datatypeNames[];
76 
78 typedef uint32_t SENSOR_READ_CALLBACK(uint8_t *pUniqueID,uint8_t sensorSpecific);
79 
82 
85 #define ILLEGAL_TEMPERATURE (1000*1000)
86 
102 extern int8_t sensorlibraryCreateSensor(uint8_t *uniqueID,
103  String name,
104  uint8_t bitsOfData,
105  bool isSigned,
106  SensorInterfaceID_t interface,
107  SensorTypeID_t sensorType,
108  SensorDatatypeID_t datatype,
109  uint8_t decimalPlaces,
110  uint8_t sensorSpecific,
111  pSENSOR_READ_CALLBACK pReader);
112 
117 extern void sensorlibraryDisableSensor(uint8_t sensorID);
118 
123 extern void sensorlibraryReadSensors(LogElement_t &element);
124 
133 extern void sensorlibraryDumpElement(Print *pPrinter,
134  uint8_t indent,
135  LogElement_t &element,
136  FormatType_t formatType = FormatForConsole,
137  SensorDatatypeID_t datatype = SDallTypes);
138 
148 extern void sensorlibraryDumpElementIDvalue(Print *pPrinter,
149  uint8_t indent,
150  LogElement_t &element,
151  FormatType_t formatType = FormatForConsole,
152  SensorDatatypeID_t datatype = SDallTypes);
153 
161 extern void sensorlibraryDumpSensorName(Print *pPrinter,
162  uint8_t sensorID,
163  FormatType_t formatType = FormatForConsole);
164 
172 extern void sensorlibraryDumpSensorUniqueID(Print *pPrinter,
173  uint8_t sensorID,
174  FormatType_t formatType = FormatForConsole);
175 
185 extern void sensorlibraryDumpSensorValue(Print *pPrinter,
186  uint8_t indent,
187  uint32_t value,
188  uint8_t sensorID,
189  FormatType_t formatType = FormatForConsole);
190 
191 
201 extern uint32_t sensorlibraryExtractPulseCount(uint8_t index,
202  LogElement_t &element,
203  uint32_t defaultCount);
204 
211 extern void sensorlibraryDumpSampleList(Print *pPrinter,
212  LogElement_t &element,
213  SensorDatatypeID_t datatype = SDallTypes);
214 
222 extern void sensorlibrarySetPulsesSinceBoot(LogElement_t &element);
223 
225 typedef enum {
226  GraphTypeAllIntervals,
227  GraphTypeAllSamples,
228 } GraphType_t;
229 
230 
245 extern void sensorlibraryDumpAddColumns(Print *pPrinter,
246  GraphType_t graphType,
247  SensorDatatypeID_t datatype);
248 
249 
257 extern String sensorlibraryGetSensorName(uint8_t index);
258 
264 extern void sensorlibraryDumpSensorById(uint8_t index,
265  Print *pPrinter,
266  FormatType_t formatType);
267 
275 extern uint8_t sensorlibraryGetI2Caddress(uint8_t sensorID);
276 
283 extern uint8_t sensorlibraryGetSensorSpecificData(uint8_t sensorID);
284 
285 #endif // defined(sensorlibraryHedit)
void sensorlibraryDumpSensorName(Print *pPrinter, uint8_t sensorID, FormatType_t formatType=FormatForConsole)
Definition: sensorlibrary.cpp:114
SensorDatatypeID_t
< version of this module
Definition: sensordatatype.h:24
int8_t sensorlibraryCreateSensor(uint8_t *uniqueID, String name, uint8_t bitsOfData, bool isSigned, SensorInterfaceID_t interface, SensorTypeID_t sensorType, SensorDatatypeID_t datatype, uint8_t decimalPlaces, uint8_t sensorSpecific, pSENSOR_READ_CALLBACK pReader)
Definition: sensorlibrary.cpp:726
void sensorlibraryDumpElementIDvalue(Print *pPrinter, uint8_t indent, LogElement_t &element, FormatType_t formatType=FormatForConsole, SensorDatatypeID_t datatype=SDallTypes)
Definition: sensorlibrary.cpp:664
uint8_t sensorlibraryGetI2Caddress(uint8_t sensorID)
Definition: sensorlibrary.cpp:947
void sensorlibrarySetPulsesSinceBoot(LogElement_t &element)
Definition: sensorlibrary.cpp:857
Structure that gets logged.
Definition: dataservices.h:61
uint8_t sensorlibraryGetSensorSpecificData(uint8_t sensorID)
Definition: sensorlibrary.cpp:961
void sensorlibraryDumpSampleList(Print *pPrinter, LogElement_t &element, SensorDatatypeID_t datatype=SDallTypes)
Definition: sensorlibrary.cpp:809
void sensorlibraryDisableSensor(uint8_t sensorID)
Definition: sensorlibrary.cpp:773
void sensorlibraryInit()
< version of this module
Definition: sensorlibrary.cpp:56
SENSOR_READ_CALLBACK * pSENSOR_READ_CALLBACK
pointer to function to call to read a sensor
Definition: sensorlibrary.h:81
String sensorlibraryGetSensorName(uint8_t index)
Definition: sensorlibrary.cpp:918
SensorTypeID_t
Definition: sensorlibrary.h:56
GraphType_t
Define types of graphs to output.
Definition: sensorlibrary.h:225
uint32_t sensorlibraryExtractPulseCount(uint8_t index, LogElement_t &element, uint32_t defaultCount)
Definition: sensorlibrary.cpp:783
void sensorlibraryDumpSensors(Print *pPrinter=&Serial, FormatType_t formatType=FormatForConsole)
Definition: sensorlibrary.cpp:447
String sensorlibrarySensorTypeGetName(SensorTypeID_t sensorType)
Definition: sensorlibrary.cpp:82
uint32_t SENSOR_READ_CALLBACK(uint8_t *pUniqueID, uint8_t sensorSpecific)
Function to call to read a sensor.
Definition: sensorlibrary.h:78
String sensorlibraryInterfaceGetName(SensorInterfaceID_t interface)
Definition: sensorlibrary.cpp:68
void sensorlibraryDumpAddColumns(Print *pPrinter, GraphType_t graphType, SensorDatatypeID_t datatype)
Definition: sensorlibrary.cpp:871
SensorInterfaceID_t
How the sensor is interfaced to the system.
Definition: sensorlibrary.h:32
void sensorlibraryDumpSensorById(uint8_t index, Print *pPrinter, FormatType_t formatType)
Definition: sensorlibrary.cpp:926
void sensorlibraryReadSensors(LogElement_t &element)
Definition: sensorlibrary.cpp:591
void sensorlibraryDumpSensorUniqueID(Print *pPrinter, uint8_t sensorID, FormatType_t formatType=FormatForConsole)
Definition: sensorlibrary.cpp:139
void sensorlibraryDumpSensorValue(Print *pPrinter, uint8_t indent, uint32_t value, uint8_t sensorID, FormatType_t formatType=FormatForConsole)
Definition: sensorlibrary.cpp:192
const char *const datatypeNames[]
Definition: sensorlibrary.cpp:103
void sensorlibraryDumpElement(Print *pPrinter, uint8_t indent, LogElement_t &element, FormatType_t formatType=FormatForConsole, SensorDatatypeID_t datatype=SDallTypes)
Definition: sensorlibrary.cpp:602