munet Network Library for muwerk Scheduler
A muwerk network library supporting WiFi, NTP, OTA and MQTT for ESP8266 and ESP32 and serial links for all platforms
|
#include <muserial.h>
Public Member Functions | |
MuSerial (String name, HardwareSerial *pSerial, unsigned long baudRate=115200, uint8_t connectionLed=-1) | |
void | begin (Scheduler *_pSched) |
bool | outgoingBlockSet (String topic) |
bool | outgoingBlockRemove (String topic) |
bool | incomingBlockSet (String topic) |
bool | incomingBlockRemove (String topic) |
Public Attributes | |
bool | activeLogic = false |
unsigned long | connectionLedBlinkDurationMs |
milli-secs the connectionLed is flashed on receiving a ping. | |
munet MuSerial Class
The MuSerial class connects two muwerk MCUs via a serial connection. The serial connection automatically fowards all pub/sub messages (that are not blocked by exception lists) between the two nodes.
A main application could be to connect a non-networked MCU to a networked MCU to allow forwarding and receiving MQTT messages on MCUs without network connection via a serial link.
A system of two muwerk MCUs connected via MuSerial act to the outside world as if they were one system. Hardware (mupplets) can be addressed the same way, regardless if they are on node1 or node2.
For a complete example, see: muwerk SerialBridge example
|
inline |
Instantiate a serial link between two muwerk instances.
name | Name of this node (used in pub/sub protocol, received as 'remoteName' by other system) |
pSerial | pointer to Serial object |
baudRate | baud rate for communication. Must be same as used by other node. |
connectionLed | optional gpio pin number of a led (e.g. LED_BUILTIN) that is flashed on receiving a PING from other system. |
|
inline |
Setup serial link.
_pSched | Pointer to the muwerk scheduler. |
|
inline |
Unblock a topic-wildcard from being received from external mqtt server
topic | An mqtt topic wildcard for topics that should again be forwarded internally to muwerk. Unblock only removes a a block identical to the given topic. So topic must be identical to a topic (wildcard) that has been used with 'incomingBlockSet()'. |
|
inline |
Block a topic-wildcard from being published to the internal scheduler
topic | An mqtt topic wildcard for topics that should not be forwarded from external mqtt server to the muwerk scheduler. This can be used to block any incoming messages according to their topic. |
|
inline |
Unblock a topic-wildcard from being published to external mqtt server
topic | An mqtt topic wildcard for topics that should again be forwarded to external mqtt. Unblock only removes a a block identical to the given topic. So topic must be identical to a topic (wildcard) that has been used with 'outgoingBlockSet()'. |
|
inline |
Block a topic-wildcard from being published to external mqtt server
topic | An mqtt topic wildcard for topics that should not be forwarded to external mqtt. E.g. 'mymupplet/#' Would block all messages a mupplet with name 'mymupplet' publishes from being forwarded to the extern mqtt server |
bool ustd::MuSerial::activeLogic = false |
If a connectionLed is used, this defines if active-high (true) or active-low (false) logic is used.