Fawkes API Fawkes Development Version
ExamplePluginClientNetworkReceiver Class Reference

Example Plugin network ping tool Small class that waits for a reply of the example plugin after a short network message was sent. More...

Inheritance diagram for ExamplePluginClientNetworkReceiver:

Public Member Functions

 ExamplePluginClientNetworkReceiver ()
 Constructor. More...
 
virtual void deregistered (unsigned int id) noexcept
 The handler got deregistered. More...
 
virtual void inbound_received (FawkesNetworkMessage *m, unsigned int id) noexcept
 Inbound mesage received. More...
 
virtual void connection_died (unsigned int id) noexcept
 Client connection died. More...
 
virtual void connection_established (unsigned int id) noexcept
 Client has established a connection. More...
 
- Public Member Functions inherited from fawkes::FawkesNetworkClientHandler
virtual ~FawkesNetworkClientHandler ()
 Empty virtual destructor. More...
 
virtual void deregistered (unsigned int id) noexcept=0
 This handler has been deregistered. More...
 
virtual void inbound_received (FawkesNetworkMessage *m, unsigned int id) noexcept=0
 Called for incoming messages. More...
 
virtual void connection_died (unsigned int id) noexcept=0
 Client connection died. More...
 
virtual void connection_established (unsigned int id) noexcept=0
 Client has established a connection. More...
 

Public Attributes

bool quit
 Set to true if answer has been received or handler was deregistered. More...
 

Detailed Description

Example Plugin network ping tool Small class that waits for a reply of the example plugin after a short network message was sent.

Definition at line 37 of file example_plugin_netping.cpp.

Constructor & Destructor Documentation

◆ ExamplePluginClientNetworkReceiver()

ExamplePluginClientNetworkReceiver::ExamplePluginClientNetworkReceiver ( )
inline

Constructor.

Definition at line 41 of file example_plugin_netping.cpp.

References quit.

Member Function Documentation

◆ connection_died()

virtual void ExamplePluginClientNetworkReceiver::connection_died ( unsigned int  id)
inlinevirtualnoexcept

Client connection died.

This method is used to inform handlers that the connection has died for any reason. No more data can be send and no more messages should be enqueued because it is unclear when they would be sent.

Parameters
idthe id of the calling client

Implements fawkes::FawkesNetworkClientHandler.

Definition at line 73 of file example_plugin_netping.cpp.

References quit.

◆ connection_established()

virtual void ExamplePluginClientNetworkReceiver::connection_established ( unsigned int  id)
inlinevirtualnoexcept

Client has established a connection.

Whenever the client establishes a connection this is signaled to handlers with this method. You can register to a client at any time, you may even enqueue messages to a client while the connection is dead. If the client at some point gets connected again, the messages will then be send out in one go. You should use this in your application though to only send data if the connection is alive and you should let the user know about the connection status.

Parameters
idthe id of the calling client

Implements fawkes::FawkesNetworkClientHandler.

Definition at line 80 of file example_plugin_netping.cpp.

◆ deregistered()

virtual void ExamplePluginClientNetworkReceiver::deregistered ( unsigned int  id)
inlinevirtualnoexcept

The handler got deregistered.

Parameters
idthe id of the calling client

Implements fawkes::FawkesNetworkClientHandler.

Definition at line 50 of file example_plugin_netping.cpp.

References quit.

◆ inbound_received()

virtual void ExamplePluginClientNetworkReceiver::inbound_received ( FawkesNetworkMessage m,
unsigned int  id 
)
inlinevirtualnoexcept

Inbound mesage received.

Parameters
mmessage
idthe id of the calling thread

Implements fawkes::FawkesNetworkClientHandler.

Definition at line 61 of file example_plugin_netping.cpp.

References quit.

Member Data Documentation

◆ quit

bool ExamplePluginClientNetworkReceiver::quit

Set to true if answer has been received or handler was deregistered.

False at object creation.

Definition at line 88 of file example_plugin_netping.cpp.

Referenced by connection_died(), deregistered(), ExamplePluginClientNetworkReceiver(), and inbound_received().


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