24 #include <blackboard/blackboard.h>
25 #include <blackboard/net/interface_observer.h>
26 #include <blackboard/net/messages.h>
27 #include <logging/liblogger.h>
28 #include <netcomm/fawkes/component_ids.h>
29 #include <netcomm/fawkes/hub.h>
50 blackboard_ = blackboard;
71 BlackBoardNetHandlerInterfaceObserver::send_event(
unsigned int msg_id,
76 strncpy(esm->
type, type, INTERFACE_TYPE_SIZE_ - 1);
77 strncpy(esm->
id,
id, INTERFACE_ID_SIZE_ - 1);
81 }
catch (Exception &e) {
83 "Failed to send BlackBoard event (%s), exception follows",
84 (msg_id == MSG_BB_INTERFACE_CREATED) ?
"create" :
"destroy");
91 const char *
id) noexcept
93 send_event(MSG_BB_INTERFACE_CREATED, type,
id);
98 const char *
id) noexcept
100 send_event(MSG_BB_INTERFACE_DESTROYED, type,
id);
void bbio_add_observed_destroy(const char *type_pattern, const char *id_pattern="*") noexcept
Add interface destruction type to watch list.
void bbio_add_observed_create(const char *type_pattern, const char *id_pattern="*") noexcept
Add interface creation type to watch list.
virtual void bb_interface_destroyed(const char *type, const char *id) noexcept
BlackBoard interface destroyed notification.
virtual ~BlackBoardNetHandlerInterfaceObserver()
Destructor.
virtual void bb_interface_created(const char *type, const char *id) noexcept
BlackBoard interface created notification.
BlackBoardNetHandlerInterfaceObserver(BlackBoard *blackboard, FawkesNetworkHub *hub)
Constructor.
The BlackBoard abstract class.
virtual void unregister_observer(BlackBoardInterfaceObserver *observer)
Unregister BB interface observer.
virtual void register_observer(BlackBoardInterfaceObserver *observer)
Register BB interface observer.
virtual void broadcast(FawkesNetworkMessage *msg)=0
Method to broadcast a message to all connected clients.
static void log_warn(const char *component, const char *format,...)
Log warning message.
Fawkes library namespace.
Message for interface events.
char type[INTERFACE_TYPE_SIZE_]
interface type name
char id[INTERFACE_ID_SIZE_]
interface instance ID