Add unit tests for buttons / relays; and a bunch of mocks :)
This commit is contained in:
@ -7,6 +7,9 @@ uint32_t mqtt_sub_count=0;
|
||||
static sub_handler_t s_handler;
|
||||
static void *s_handler_ud;
|
||||
|
||||
static mg_event_handler_t s_global_handler;
|
||||
static void *s_global_handler_ud;
|
||||
|
||||
void mgos_mqtt_pub(char *t, char *m, int m_len, int flags, bool persist) {
|
||||
LOG(LL_INFO, ("Sending topic='%s' msg='%s' persist=%s", t, m, persist?"ON":"OFF"));
|
||||
mqtt_pub_count++;
|
||||
@ -24,3 +27,9 @@ void mgos_mqtt_inject(char *topic, char *msg) {
|
||||
if (s_handler)
|
||||
s_handler(NULL, topic, strlen(topic), msg, strlen(msg), s_handler_ud);
|
||||
}
|
||||
|
||||
void mgos_mqtt_add_global_handler(mqtt_event_handler_t handler, void *ud) {
|
||||
s_global_handler = handler;
|
||||
s_global_handler_ud = ud;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user