Fawkes API  Fawkes Development Version
fawkes::BlackBoardNetHandlerInterfaceListener Class Reference

Interface listener for network handler. More...

#include <>>

Inheritance diagram for fawkes::BlackBoardNetHandlerInterfaceListener:

Public Member Functions

 BlackBoardNetHandlerInterfaceListener (BlackBoard *blackboard, Interface *interface, FawkesNetworkHub *hub, unsigned int clid)
 Constructor. More...
 
virtual ~BlackBoardNetHandlerInterfaceListener ()
 Destructor. More...
 
virtual void bb_interface_data_refreshed (Interface *interface) noexcept
 BlackBoard data refreshed notification. More...
 
virtual void bb_interface_data_changed (Interface *interface) noexcept
 BlackBoard data changed notification. More...
 
virtual bool bb_interface_message_received (Interface *interface, Message *message) noexcept
 BlackBoard message received notification. More...
 
virtual void bb_interface_writer_added (Interface *interface, Uuid instance_serial) noexcept
 A writing instance has been opened for a watched interface. More...
 
virtual void bb_interface_writer_removed (Interface *interface, Uuid instance_serial) noexcept
 A writing instance has been closed for a watched interface. More...
 
virtual void bb_interface_reader_added (Interface *interface, Uuid instance_serial) noexcept
 A reading instance has been opened for a watched interface. More...
 
virtual void bb_interface_reader_removed (Interface *interface, Uuid instance_serial) noexcept
 A reading instance has been closed for a watched interface. More...
 
- Public Member Functions inherited from fawkes::BlackBoardInterfaceListener
 BlackBoardInterfaceListener (const char *name_format,...)
 Constructor. More...
 
virtual ~BlackBoardInterfaceListener ()
 Destructor. More...
 
const char * bbil_name () const
 Get BBIL name. More...
 

Additional Inherited Members

- Public Types inherited from fawkes::BlackBoardInterfaceListener
enum  QueueEntryType { DATA = 0 , MESSAGES = 1 , READER = 2 , WRITER = 3 }
 Queue entry type. More...
 
typedef std::list< QueueEntryInterfaceQueue
 Queue of additions/removal of interfaces. More...
 
typedef std::map< std::string, Interface * > InterfaceMap
 Map of currently active event subscriptions. More...
 
- Protected Member Functions inherited from fawkes::BlackBoardInterfaceListener
void bbil_add_data_interface (Interface *interface)
 Add an interface to the data modification watch list. More...
 
void bbil_add_message_interface (Interface *interface)
 Add an interface to the message received watch list. More...
 
void bbil_add_reader_interface (Interface *interface)
 Add an interface to the reader addition/removal watch list. More...
 
void bbil_add_writer_interface (Interface *interface)
 Add an interface to the writer addition/removal watch list. More...
 
void bbil_remove_data_interface (Interface *interface)
 Remove an interface to the data modification watch list. More...
 
void bbil_remove_message_interface (Interface *interface)
 Remove an interface to the message received watch list. More...
 
void bbil_remove_reader_interface (Interface *interface)
 Remove an interface to the reader addition/removal watch list. More...
 
void bbil_remove_writer_interface (Interface *interface)
 Remove an interface to the writer addition/removal watch list. More...
 
Interfacebbil_data_interface (const char *iuid) noexcept
 Get interface instance for given UID. More...
 
Interfacebbil_message_interface (const char *iuid) noexcept
 Get interface instance for given UID. More...
 
Interfacebbil_reader_interface (const char *iuid) noexcept
 Get interface instance for given UID. More...
 
Interfacebbil_writer_interface (const char *iuid) noexcept
 Get interface instance for given UID. More...
 

Detailed Description

Interface listener for network handler.

This class is used by the BlackBoardNetworkHandler to track interface changes and send out notifications timely.

Author
Tim Niemueller

Definition at line 34 of file interface_listener.h.

Constructor & Destructor Documentation

◆ BlackBoardNetHandlerInterfaceListener()

fawkes::BlackBoardNetHandlerInterfaceListener::BlackBoardNetHandlerInterfaceListener ( BlackBoard blackboard,
Interface interface,
FawkesNetworkHub hub,
unsigned int  clid 
)

◆ ~BlackBoardNetHandlerInterfaceListener()

fawkes::BlackBoardNetHandlerInterfaceListener::~BlackBoardNetHandlerInterfaceListener ( )
virtual

Destructor.

Definition at line 75 of file interface_listener.cpp.

References fawkes::BlackBoard::unregister_listener().

Member Function Documentation

◆ bb_interface_data_changed()

void fawkes::BlackBoardNetHandlerInterfaceListener::bb_interface_data_changed ( Interface interface)
virtualnoexcept

BlackBoard data changed notification.

This is called whenever the data in an interface that you registered for is changed. This happens when a writer calls Interface::write() AND any data field has a different value than it had at the last write(). Note that a change implies a refresh, so when data change, both this method AND bb_interface_data_refreshed will be called!

Parameters
interfaceinterface instance that you supplied to bbil_add_data_interface()
See also
bb_interface_data_refreshed

Reimplemented from fawkes::BlackBoardInterfaceListener.

Definition at line 102 of file interface_listener.cpp.

References fawkes::bb_idata_msg_t::data_size, fawkes::LibLogger::log_warn(), and fawkes::bb_idata_msg_t::serial.

◆ bb_interface_data_refreshed()

void fawkes::BlackBoardNetHandlerInterfaceListener::bb_interface_data_refreshed ( Interface interface)
virtualnoexcept

BlackBoard data refreshed notification.

This is called whenever the data in an interface that you registered for is refreshed. This happens when a writer calls the Interface::write(), regardless of whether any data have changed.

Parameters
interfaceinterface instance that you supplied to bbil_add_data_interface()
See also
bb_interface_data_changed

Reimplemented from fawkes::BlackBoardInterfaceListener.

Definition at line 81 of file interface_listener.cpp.

References fawkes::bb_idata_msg_t::data_size, fawkes::LibLogger::log_warn(), and fawkes::bb_idata_msg_t::serial.

◆ bb_interface_message_received()

bool fawkes::BlackBoardNetHandlerInterfaceListener::bb_interface_message_received ( Interface interface,
Message message 
)
virtualnoexcept

BlackBoard message received notification.

This is called whenever a message is received for this interface. This method is only called for writing instances of an interface, never on reading instances. If you have processed the message already, you can order that the message is not enqueued by returning false. Returning true will enqueue the message as usual. You should only do very (very!) quick tasks directly in this method, as it is out of the regular thread context and can harm performance of other plugins and the system as a whole. Note that if you decide to return false the message is not referenced. If you want to keep it longer you have to ref() it by yourself. An example where this would really make sense is a "STOP" message for the motor, which needs to be processed ASAP and maybe even waiting a couple of miliseconds for the next cycle is not acceptable.

Parameters
interfaceinterface instance that you supplied to bbil_add_message_interface()
messagethe message that was sent
Returns
true to get the message enqueued afterwards as usual, false to prevent queuing of the message.

Reimplemented from fawkes::BlackBoardInterfaceListener.

Definition at line 123 of file interface_listener.cpp.

References fawkes::bb_imessage_msg_t::data_size, fawkes::bb_imessage_msg_t::hops, fawkes::LibLogger::log_warn(), fawkes::bb_imessage_msg_t::msg_type, fawkes::bb_imessage_msg_t::msgid, fawkes::bb_imessage_msg_t::serial, and fawkes::bb_imessage_msg_t::source.

◆ bb_interface_reader_added()

void fawkes::BlackBoardNetHandlerInterfaceListener::bb_interface_reader_added ( Interface interface,
Uuid  instance_serial 
)
virtualnoexcept

A reading instance has been opened for a watched interface.

This is called whenever a reading instance of the interface you are watching is opened.

Parameters
interfaceinterface instance that you supplied to bbil_add_reader_interface()
instance_serialthe instance serial of the reading instance that has just been added.

Reimplemented from fawkes::BlackBoardInterfaceListener.

Definition at line 181 of file interface_listener.cpp.

◆ bb_interface_reader_removed()

void fawkes::BlackBoardNetHandlerInterfaceListener::bb_interface_reader_removed ( Interface interface,
Uuid  instance_serial 
)
virtualnoexcept

A reading instance has been closed for a watched interface.

This is called whenever a reading instance of an interface you are watching is closed.

Parameters
interfaceinterface instance that you supplied to bbil_add_reader_interface()
instance_serialthe instance serial of the reading instance that has just been removed.

Reimplemented from fawkes::BlackBoardInterfaceListener.

Definition at line 188 of file interface_listener.cpp.

◆ bb_interface_writer_added()

void fawkes::BlackBoardNetHandlerInterfaceListener::bb_interface_writer_added ( Interface interface,
Uuid  instance_serial 
)
virtualnoexcept

A writing instance has been opened for a watched interface.

This is called whenever a writing instance of the interface you are watching is opened.

Parameters
interfaceinterface instance that you supplied to bbil_add_writer_interface()
instance_serialthe instance serial of the writing instance that has just been added.

Reimplemented from fawkes::BlackBoardInterfaceListener.

Definition at line 167 of file interface_listener.cpp.

◆ bb_interface_writer_removed()

void fawkes::BlackBoardNetHandlerInterfaceListener::bb_interface_writer_removed ( Interface interface,
Uuid  instance_serial 
)
virtualnoexcept

A writing instance has been closed for a watched interface.

This is called whenever a writing instance of an interface you are watching is closed.

Parameters
interfaceinterface instance that you supplied to bbil_add_writer_interface()
instance_serialthe instance serial of the writing instance that has just been removed.

Reimplemented from fawkes::BlackBoardInterfaceListener.

Definition at line 174 of file interface_listener.cpp.


The documentation for this class was generated from the following files: