BusBricks: /Users/felixschulke/Developement/Arduino/Modbus_RTU/Modbus_RTU/Modbus-RTU/lib/ModbusRTU/Frame_modbusRTU.h Source File
BusBricks  0.1
Customize bus-communication
Loading...
Searching...
No Matches
Frame_modbusRTU.h
Go to the documentation of this file.
1
24#ifndef FRAME_MODBUSRTU_H
25#define FRAME_MODBUSRTU_H
26#ifdef ARDUINO
27 #include <Arduino.h>
28#else
29 #include <mockArduino.h>
30 using namespace arduinoMocking;
31#endif
32
33#include<Frame.h>
34
36#define PREFIXSIZE 2
37
39#define SUFFIXSIZE 2
40
42#define CRC16MASK 0xA001
43
45#define CRC16VALUE 0xFFFF
46
47
48
58class Frame_modbusRTU: public Frame{
59 public:
60 // Construct Modbus-RRU-Frame from given PDU (Content)
72 Frame_modbusRTU(String* pdu, char* slaveId, char* functionCode);
73
82
88
94
95
108 bool checkCRC16();
109
115 uint8_t getServiceId() override;
116
117 private:
119 char slaveId = '\0';
120
122 char functionCode = '\0';
123
136 void content_to_rep() override;
137
152 void rep_to_content() override;
153
169 unsigned short calcCRC16(const char* buffer, uint8_t size);
170 };
171
172
173#endif // FRAME_MODBUSRTU_H
Class for storing char-array (byte-array) together with size. The Array is stored on Heap-memory and ...
Definition CharArray.h:38
Class for defining the structure of the Modbus-RTU-Frame. Can be constructed by a given modbus-frame ...
Definition Frame_modbusRTU.h:58
bool checkCRC16()
Verifies the CRC16 checksum of the current Modbus RTU frame.
Definition Frame_modbusRTU.cpp:108
uint8_t getServiceId() override
Get the Service-ID (Modbus-RTU-function-code) of the frame-instance.
Definition Frame_modbusRTU.cpp:87
~Frame_modbusRTU()
Destroy the Frame_modbusRTU object.
Definition Frame_modbusRTU.cpp:45
Frame_modbusRTU()
Construct empty Modbus-RTU-Frame.
Definition Frame_modbusRTU.cpp:39
Frame-Class as derived class from Content The derived classes define: -the conversion from a given pa...
Definition Frame.h:50
Provides mock implementations of Arduino framework functions and classes for native builds.
Definition mockArduino.cpp:28
std::string String
Alias for std::string to simulate Arduino's String type.
Definition mockArduino.h:51