21#include "api/Stream.h"
48 std::vector<uint8_t> data;
80 operator bool()
const {
return running_.load(); }
88 digital_handler_ = std::move(
handler);
93 analog_handler_ = std::move(
handler);
105 Stream* stream_ =
nullptr;
106 std::atomic<bool> running_{
false};
108 std::mutex write_mutex_;
110 DigitalHandler digital_handler_;
111 AnalogHandler analog_handler_;
112 std::mutex sysex_handlers_mutex_;
113 std::map<uint8_t, SysexHandler> sysex_handlers_;
Single reader thread + byte-stream parser shared by every Firmata-based hardware backend (GPIO,...
Definition FirmataTransport.h:66
void onDigitalMessage(DigitalHandler handler)
Register the (single) handler for digital port reports.
Definition FirmataTransport.h:87
void addSysexHandler(uint8_t command, SysexHandler handler)
Definition FirmataTransport.cpp:57
void onAnalogMessage(AnalogHandler handler)
Register the (single) handler for analog pin reports.
Definition FirmataTransport.h:92
bool begin(Stream &stream)
Start the background reader thread on the given stream.
Definition FirmataTransport.cpp:32
void end()
Stop the reader thread and detach from the stream.
Definition FirmataTransport.cpp:41
void writeBytes(const uint8_t *data, size_t len)
Thread-safe write of a raw byte sequence (e.g. a whole SysEx message).
Definition FirmataTransport.cpp:49
void removeSysexHandler(uint8_t command)
Remove a previously registered SysEx handler.
Definition FirmataTransport.cpp:62
We provide the WiFi class to simulate the Arduino WIFI. In in Linux we can expect that networking is ...
Definition CanMsg.cpp:31
A single analog pin report (device -> host).
Definition FirmataTransport.h:39
A digital port report (device -> host), 8 pins packed into one message.
Definition FirmataTransport.h:33
Definition FirmataTransport.h:46