1#ifndef COMMUNICATION_LAYER_H
2#define COMMUNICATION_LAYER_H
16 using CallbackType = std::function<bool(std::vector<uint8_t> &&, std::vector<uint8_t> &)>;
35 virtual
bool TryStart(std::vector<uint8_t> &&configuration) = 0;
Communication medium abstraction layer to send and receive data.
Definition: communication_layer.h:12
std::function< void(std::vector< uint8_t > &&)> AsyncCallbackType
Data received callback type to handle the data asynchronously.
Definition: communication_layer.h:19
CallbackType Callback
Callback to be invoked when data received.
Definition: communication_layer.h:23
AsyncCallbackType AsyncCallback
Callback to be invoked when data received asynch.
Definition: communication_layer.h:26
virtual bool TrySendAsync(std::vector< uint8_t > &&data)=0
Try to buffer data for sending.
void ResetCallback() noexcept
Reset both data received synchronized and asynchronized callbacks.
void SetCallback(CallbackType &&callback)
Set a data received callback and reset the asynchronized callback.
std::function< bool(std::vector< uint8_t > &&, std::vector< uint8_t > &)> CallbackType
Data received callback type.
Definition: communication_layer.h:16
virtual bool TryStart(std::vector< uint8_t > &&configuration)=0
Try to start the communication.
virtual bool TryStop()=0
Try to stop the communication.