BeeeOn Gateway  v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
DPAMessage.h
1 #pragma once
2 
3 #include <string>
4 #include <vector>
5 
6 #include <Poco/SharedPtr.h>
7 #include <Poco/JSON/Object.h>
8 
9 namespace BeeeOn {
10 
22 class DPAMessage {
23 public:
24  typedef Poco::SharedPtr<DPAMessage> Ptr;
25  typedef uint16_t NetworkAddress;
26 
27  static uint16_t COORDINATOR_NODE_ADDRESS;
28  static uint16_t DEFAULT_HWPID;
29 
30  virtual ~DPAMessage();
31 
48  void setNetworkAddress(NetworkAddress node);
49  NetworkAddress networkAddress() const;
50 
81  void setPeripheralNumber(uint8_t pNumber);
82  uint8_t peripheralNumber() const;
83 
98  void setPeripheralCommand(uint8_t pCommand);
99  uint8_t peripheralCommand() const;
100 
118  void setHWPID(uint16_t hwPID);
119  uint16_t HWPID() const;
120 
127  virtual std::string toDPAString() const =0;
128 
134  void setPeripheralData(const std::vector<uint8_t> &data);
135  std::vector<uint8_t> peripheralData() const;
136 
137 protected:
142  DPAMessage(
143  NetworkAddress node,
144  uint8_t pNumber,
145  uint8_t pCommand,
146  uint16_t hwPID,
147  const std::vector<uint8_t> &pData
148  );
149 
150 private:
151  NetworkAddress m_nodeAddress;
152  uint8_t m_peripheralNumber;
153  uint8_t m_peripheralCommand;
154  uint16_t m_hwPID;
155  std::vector<uint8_t> m_peripheralData;
156 };
157 
158 }
The class represents DPA message that can be sent/received from IQRF network.
Definition: DPAMessage.h:22
void setPeripheralCommand(uint8_t pCommand)
Command specifying an action to be taken. Actually allowed value range depends on the peripheral type...
Definition: DPAMessage.cpp:44
DPAMessage(NetworkAddress node, uint8_t pNumber, uint8_t pCommand, uint16_t hwPID, const std::vector< uint8_t > &pData)
Creates message with DPA content that includes address of node, number of peripheral, command for peripheral and hw PID.
Definition: DPAMessage.cpp:10
void setPeripheralData(const std::vector< uint8_t > &data)
An array of bytes.
Definition: DPAMessage.cpp:64
void setHWPID(uint16_t hwPID)
HW profile ID uniquely specifies the functionality of the device, the user peripherals it implements...
Definition: DPAMessage.cpp:54
void setPeripheralNumber(uint8_t pNumber)
Peripheral number:
Definition: DPAMessage.cpp:34
virtual std::string toDPAString() const =0
Converts vector of values to dpa string. Dpa string contains hex values separated by dot...
void setNetworkAddress(NetworkAddress node)
Network device address.
Definition: DPAMessage.cpp:24