23 #include <plugins/examples/basics/net_thread.h> 24 #include <netcomm/fawkes/component_ids.h> 70 logger->
log_info(
"ExampleNetworkThread",
"Removing this thread from list of Fawkes network hub handlers");
103 unsigned int *u = (
unsigned int *)msg->
payload();
104 logger->
log_info(
"ExamplePlugin",
"Message of type %u with payload u=%u received, sending reply", msg->
msgid(), *u);
105 unsigned int *ru = (
unsigned int *)malloc(
sizeof(
unsigned int));
108 ru,
sizeof(
unsigned int));
111 logger->
log_error(
"ExamplePlugin",
"Message of invalid size received");
134 logger->
log_info(
"ExamplePlugin",
"Client %u disconnected", clid);
virtual void handle_network_message(fawkes::FawkesNetworkMessage *msg)
Handle network message.
void * payload() const
Get payload buffer.
ExampleNetworkThread(const char *name)
Constructor.
virtual void log_info(const char *component, const char *format,...)=0
Log informational message.
FawkesNetworkHub * fnethub
This is the Fawkes network hub member used to access the Fawkes network protocol. ...
virtual void client_disconnected(unsigned int clid)
Client disconnected.
Fawkes library namespace.
unsigned int clid() const
Get client ID.
virtual void init()
Initialize thread.
virtual void add_handler(FawkesNetworkHandler *handler)=0
Add a message handler.
Representation of a message that is sent over the network.
Thread class encapsulation of pthreads.
Logger * logger
This is the Logger member used to access the logger.
virtual ~ExampleNetworkThread()
Destructor.
virtual void finalize()
Finalize the thread.
virtual void send(FawkesNetworkMessage *msg)=0
Method to send a message to a specific client.
virtual void loop()
Thread loop.
Network handler abstract base class.
virtual void log_error(const char *component, const char *format,...)=0
Log error message.
unsigned short int msgid() const
Get message type ID.
virtual void client_connected(unsigned int clid)
Client connected.
virtual void remove_handler(FawkesNetworkHandler *handler)=0
Remove a message handler.
size_t payload_size() const
Get payload size.