BeeeOn Gateway  v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
SensorData.h
1 #pragma once
2 
3 #include <vector>
4 
5 #include <Poco/Timestamp.h>
6 
7 #include "model/DeviceID.h"
8 #include "model/ModuleID.h"
9 #include "model/SensorValue.h"
10 #include "util/IncompleteTimestamp.h"
11 
12 namespace BeeeOn {
13 
14 /*
15  * Representation of data coming from a sensor. Every SensorData comes
16  * from a single device identified by DeviceID. The SensorData holds
17  * a list of measured values.Each of measured values is defined by
18  * SensorValue instance.
19  */
20 class SensorData {
21 public:
22  SensorData();
23  SensorData(
24  const DeviceID &id,
25  const Poco::Timestamp &timestamp,
26  const std::vector<SensorValue> &values);
27 
28  void setDeviceID(const DeviceID &deviceID);
29  const DeviceID deviceID() const;
30 
31  void setTimestamp(const IncompleteTimestamp &timestamp);
32  const IncompleteTimestamp timestamp() const;
33 
34  bool isEmpty() const;
35 
36  void insertValue(const SensorValue &value);
37 
38  size_t size() const;
39 
40  SensorValue& at(size_t index);
41  const SensorValue& at(size_t index) const;
42 
43  std::vector<SensorValue>::iterator begin();
44  std::vector<SensorValue>::iterator end();
45 
46  std::vector<SensorValue>::const_iterator begin() const;
47  std::vector<SensorValue>::const_iterator end() const;
48 
49  bool operator !=(const SensorData &data) const;
50  bool operator ==(const SensorData &data) const;
51 
52  SensorValue& operator [](size_t index);
53  const SensorValue& operator [](size_t index) const;
54 
55 private:
56  DeviceID m_deviceID;
57  IncompleteTimestamp m_timestamp;
58  std::vector<SensorValue> m_values;
59 };
60 
61 }
Definition: SensorData.h:20
Definition: SensorValue.h:14
Definition: DeviceID.h:17