BusBricks: /Users/felixschulke/Developement/Arduino/Modbus_RTU/Modbus_RTU/Modbus-RTU/lib/MessageService/MessageService.h Source File
BusBricks  0.1
Customize bus-communication
Loading...
Searching...
No Matches
MessageService.h
Go to the documentation of this file.
1
24#ifndef MESSAGE_SERVICE_H
25#define MESSAGE_SERVICE_H
26#ifdef ARDUINO
27 #include <Arduino.h> // include Arduino-Library for platformIO-build
28#else
29 #include <mockArduino.h>
30 #include <cstring>
31 using namespace arduinoMocking;
32#endif
33
34#include "Service.h"
35#include "Message.h"
36
38#define STACKSIZE 2
39
41#define FUNCTIONCODE 0x6D
42
67class MessageService: public Service<Message, STACKSIZE>
68{
69public:
77 MessageService(uint8_t instance_id);
78
87 MessageService(uint8_t instance_id, uint8_t service_id);
88
95 void stackProcessing() override;
96
102 uint8_t get_destinationId();
103
113 void sendMessage(char receiverId, String messagetext);
114
115private:
124 void sendAck(Message* message);
125
133 void printMessage(Message* message);
134};
135
136#endif // MESSAGE_SERVICE_H
Represents a message with information for sender and receiver, and provides methods for converting be...
Definition Message.h:109
Service class for handling messages and acknowledgments.
Definition MessageService.h:68
MessageService(uint8_t instance_id)
Constructor for MessageService with default Service ID "m".
Definition MessageService.cpp:28
void sendMessage(char receiverId, String messagetext)
Sends a new message.
Definition MessageService.cpp:77
uint8_t get_destinationId()
Retrieves the destination instance ID for the current response PDU in the send stack.
Definition MessageService.cpp:55
void stackProcessing() override
Processes all messages from the receive stack.
Definition MessageService.cpp:35
Service-Template to derive a Service class by defining the Content (derived Class of "Content") to ha...
Definition Service.h:115
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