This repository has been archived on 2023-12-22. You can view files and clone it, but cannot push or open issues or pull requests.
old-monorepo/Devices/Control/Firmware/lib/StreamCommunicator/StreamCommunicator.h

20 lines
573 B
C
Raw Normal View History

2022-02-04 16:01:30 +01:00
#include "Stream.h"
2022-02-05 19:08:51 +01:00
class StreamCommunicator
2022-02-04 16:01:30 +01:00
{
protected:
Stream &stream;
2022-02-05 19:08:51 +01:00
char *messageBuffer;
__SIZE_TYPE__ bufferSize;
__SIZE_TYPE__ calculateMessageOutSize(__SIZE_TYPE__ numberOfValues);
void parseIDs(const int values[], __SIZE_TYPE__ numberOfValues, char *out);
2022-02-04 16:01:30 +01:00
public:
StreamCommunicator(Stream &s_out, __SIZE_TYPE__ bufferSize);
2022-02-05 19:08:51 +01:00
void sendMessage(int *values, __SIZE_TYPE__ numberOfValues);
void sendMessage(const char message[]);
2022-02-04 16:01:30 +01:00
char *receiveMessage();
2022-02-05 19:08:51 +01:00
char *getBuffer();
int getBufferSize();
Stream *getStream();
2022-02-04 16:01:30 +01:00
};