BeeeOn Gateway  v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
DPAMappedProtocol.h
1 #pragma once
2 
3 #include <utility>
4 
5 #include "util/Loggable.h"
6 
7 #include "iqrf/DPAProtocol.h"
8 #include "iqrf/IQRFTypeMappingParser.h"
9 
10 namespace BeeeOn {
11 
15 class DPAMappedProtocol : public DPAProtocol, protected Loggable {
16 public:
18  const std::string &mappingGroup,
19  const std::string &techNode
20  );
21 
25  void loadTypesMapping(const std::string &file);
26  void loadTypesMapping(std::istream &in);
27 
28  std::list<ModuleType> extractModules(
29  const std::vector<uint8_t> &message) const override;
30 
32  const std::list<ModuleType> &modules,
33  const std::vector<uint8_t> &msg) const override;
34 
35 protected:
41  const ModuleID &moduleID,
42  const IQRFType &type,
43  const uint16_t value) const;
44 
48  ModuleType findModuleType(uint8_t id) const;
49 
53  IQRFType findIQRFType(uint8_t id) const;
54 
55 private:
56  std::string m_mappingGroup;
57  std::string m_techNode;
58  std::map<uint8_t, ModuleType> m_moduleTypes;
59  std::map<uint8_t, IQRFType> m_iqrfTypes;
60 };
61 
62 }
Represents one IQRF type.
Definition: IQRFTypeMappingParser.h:12
SensorData parseValue(const std::list< ModuleType > &modules, const std::vector< uint8_t > &msg) const override
Obtains measured values from the given byte message. The contents of the message must conform with th...
Definition: DPAMappedProtocol.cpp:92
Definition: SensorData.h:20
void loadTypesMapping(const std::string &file)
Load XML file with the types mapping between IQRF and BeeeOn.
SensorValue extractSensorValue(const ModuleID &moduleID, const IQRFType &type, const uint16_t value) const
Reads info about value based on IQRFType and converts measured value to SensorValue.
Definition: DPAMappedProtocol.cpp:64
Definition: SensorValue.h:14
The class provides interface for obtaining of measured data, for detecting of supported modules that ...
Definition: DPAProtocol.h:21
Map the IQRFType-specific data to the BeeeOn-specific ones.
Definition: DPAMappedProtocol.h:15
ModuleType findModuleType(uint8_t id) const
Find module type by IQRF type id.
Definition: DPAMappedProtocol.cpp:121
Definition: ModuleID.h:12
Definition: ModuleType.h:18
Definition: Loggable.h:19
IQRFType findIQRFType(uint8_t id) const
Find iqrf type by IQRF type id.
Definition: DPAMappedProtocol.cpp:133
std::list< ModuleType > extractModules(const std::vector< uint8_t > &message) const override
Definition: DPAMappedProtocol.cpp:78