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