A class that runs network thread and acts as a bridge between the server and clients.
More...
#include <network_listener_client.hpp>
A class that runs network thread and acts as a bridge between the server and clients.
This class initializes connection adapter according to given parameters and starts a network thread. It is responsible of transmitting & receiving data through message translators and maintains connection to the server.
◆ NetworkListenerClient()
kanzi::connect::NetworkListenerClient::NetworkListenerClient |
( |
| ) |
|
|
explicit |
◆ ~NetworkListenerClient()
virtual kanzi::connect::NetworkListenerClient::~NetworkListenerClient |
( |
| ) |
|
|
virtual |
◆ addObserver()
void kanzi::connect::NetworkListenerClient::addObserver |
( |
Observer * | observer | ) |
|
Add observer to listen for network events.
This method must not be called from any of the observer callback methods or a deadlock will occur.
- Parameters
-
◆ getAdapterParameter()
string kanzi::connect::NetworkListenerClient::getAdapterParameter |
( |
const string & | parameter | ) |
|
Retrieve parameter of currently used adapter.
- Parameters
-
parameter | Parameter to retrieve from adapter. |
- Returns
- State of given parameter.
◆ getAdapterState()
string kanzi::connect::NetworkListenerClient::getAdapterState |
( |
const string & | parameter | ) |
|
Retrieve state of currently used adapter.
- Parameters
-
parameter | Parameter to retrieve from adapter. |
- Returns
- State of given parameter.
◆ getAdapterType()
string kanzi::connect::NetworkListenerClient::getAdapterType |
( |
| ) |
|
Retrieve currently used adapter type.
- Returns
- Adapter type.
◆ notifyConnected()
void kanzi::connect::NetworkListenerClient::notifyConnected |
( |
| ) |
|
|
protected |
Notify observers about connection.
◆ notifyDisconnected()
void kanzi::connect::NetworkListenerClient::notifyDisconnected |
( |
| ) |
|
|
protected |
Notify observers about loss of network connection.
◆ notifyFailedToConnect()
void kanzi::connect::NetworkListenerClient::notifyFailedToConnect |
( |
| ) |
|
|
protected |
Notify observers about failed connection.
◆ notifyReceive()
void kanzi::connect::NetworkListenerClient::notifyReceive |
( |
| ) |
|
|
protected |
Notify observers about received data.
◆ receive()
MessageArray kanzi::connect::NetworkListenerClient::receive |
( |
| ) |
|
Retrieves incoming data packet from server.
- Returns
- Messages that were received from the server.
◆ registerConnectionAdapterProvider()
◆ removeObserver()
void kanzi::connect::NetworkListenerClient::removeObserver |
( |
Observer * | observer | ) |
|
Remove observer.
This method must not be called from any of the observer callback methods or a deadlock will occur.
- Parameters
-
◆ run()
void kanzi::connect::NetworkListenerClient::run |
( |
| ) |
|
|
protected |
◆ start()
Starts connecting to server using given network adapter and parameters.
- Parameters
-
type | Type of the network adapter. |
parameters | Parameters for the network adapter. |
client | Optional pointer to Client instance. |
◆ stop()
void kanzi::connect::NetworkListenerClient::stop |
( |
| ) |
|
Stops networking activities and tears down the networking thread.
◆ transmit()
bool kanzi::connect::NetworkListenerClient::transmit |
( |
const MessagePackage & | message | ) |
|
Sends a data packet to server.
- Parameters
-
message | Message to be sent. |
◆ wait()
void kanzi::connect::NetworkListenerClient::wait |
( |
int | ms = -1 | ) |
|
|
protected |
Wait for network events to occur.
The documentation for this class was generated from the following file:
- connect/network_listener_client.hpp