Dali 3D User Interface Engine
List of all members | Public Member Functions | Private Attributes
Dali::Internal::Adaptor::NetworkPerformanceClient Class Reference

Network Performance client. More...

#include <network-performance-client.h>

Collaboration diagram for Dali::Internal::Adaptor::NetworkPerformanceClient:
Collaboration graph
[legend]

Public Member Functions

 NetworkPerformanceClient (pthread_t *thread, SocketInterface *socket, unsigned int clientId, TriggerEventFactoryInterface &triggerEventFactory, ClientSendDataInterface &sendDataInterface, SocketFactoryInterface &socketFactory)
 Constructor. More...
 
 ~NetworkPerformanceClient ()
 Destructor. More...
 
unsigned int GetId () const
 
SocketInterfaceGetSocket ()
 
bool WriteSocket (const void *buffer, unsigned int bufferSizeInBytes)
 Write data to a socket. More...
 
void ProcessCommand (char *buffer, unsigned int bufferSizeInBytes)
 Process a command. More...
 
bool TransmitMarker (const PerformanceMarker &marker, const char *const description)
 Write a marker to the socket, if this client is filtering this marker. More...
 
void ExitSelect ()
 If the client is waiting inside a select statement, this will cause it to break out. More...
 
pthread_t * GetThread ()
 get the thread running the client More...
 

Private Attributes

pthread_t * mThread
 thread for the client More...
 
SocketInterfacemSocket
 socket interface More...
 
PerformanceMarker::MarkerFilter mMarkerBitmask
 What markers are currently filtered. More...
 
TriggerEventFactoryInterface & mTriggerEventFactory
 Trigger event factory. More...
 
ClientSendDataInterfacemSendDataInterface
 used to send data to a client from the main event thread More...
 
SocketFactoryInterfacemSocketFactoryInterface
 used to delete the socket More...
 
unsigned int mClientId
 unique client id More...
 
bool mConsoleClient
 if connected via a console then all responses are in ASCII, not binary packed data. More...
 

Detailed Description

Network Performance client.

Every time a client connects to Dali, a NetworkPerformanceClient object is created. It is responsible for processing incoming commands, and storing the client state (e.g. what performance markers it wants).

Certain commands such as dump-scene need to be run on the main Dali event thread. To achieve this, a trigger event is used which executes a function on the main thread. The sendDataInterface is then used with the client id to transmit the data to the client. The reason for using a client id is because the client can be deleted in between receiving a command and sending a response. E.g. NetworkPerformanceClient (own thread, id 5) <— Dump Scene Command delete NetworkPerformanceClient <— Connection closed MainThread. Send scene data to client 5. Client 5 has been deleted so don't send the data.

Definition at line 58 of file network-performance-client.h.

Constructor & Destructor Documentation

Dali::Internal::Adaptor::NetworkPerformanceClient::NetworkPerformanceClient ( pthread_t *  thread,
SocketInterface socket,
unsigned int  clientId,
TriggerEventFactoryInterface &  triggerEventFactory,
ClientSendDataInterface sendDataInterface,
SocketFactoryInterface socketFactory 
)

Constructor.

Parameters
threadthread pointer
socketsocket interface
clientIdunique client id
triggerEventFactoryused to create trigger events
sendDataInterfaceused to send data to the socket from main thread
SocketFactoryInterfaceused to delete the socket when the client is destroyed

Definition at line 120 of file network-performance-client.cpp.

Dali::Internal::Adaptor::NetworkPerformanceClient::~NetworkPerformanceClient ( )

Member Function Documentation

void Dali::Internal::Adaptor::NetworkPerformanceClient::ExitSelect ( )

If the client is waiting inside a select statement, this will cause it to break out.

Definition at line 184 of file network-performance-client.cpp.

References Dali::Internal::Adaptor::SocketInterface::ExitSelect(), and mSocket.

Referenced by Dali::Internal::Adaptor::NetworkPerformanceServer::StopClients().

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int Dali::Internal::Adaptor::NetworkPerformanceClient::GetId ( ) const
Returns
client unique id

Definition at line 147 of file network-performance-client.cpp.

References mClientId.

Referenced by Dali::Internal::Adaptor::NetworkPerformanceServer::SendData().

Here is the caller graph for this function:

SocketInterface & Dali::Internal::Adaptor::NetworkPerformanceClient::GetSocket ( )
Returns
socket interface

Definition at line 152 of file network-performance-client.cpp.

References mSocket.

Referenced by Dali::Internal::Adaptor::NetworkPerformanceServer::ClientThread().

Here is the caller graph for this function:

pthread_t * Dali::Internal::Adaptor::NetworkPerformanceClient::GetThread ( )

get the thread running the client

Returns
thread pointer

Definition at line 189 of file network-performance-client.cpp.

References mThread.

Referenced by Dali::Internal::Adaptor::NetworkPerformanceServer::StopClients().

Here is the caller graph for this function:

void Dali::Internal::Adaptor::NetworkPerformanceClient::ProcessCommand ( char *  buffer,
unsigned int  bufferSizeInBytes 
)
bool Dali::Internal::Adaptor::NetworkPerformanceClient::TransmitMarker ( const PerformanceMarker marker,
const char *const  description 
)
bool Dali::Internal::Adaptor::NetworkPerformanceClient::WriteSocket ( const void *  buffer,
unsigned int  bufferSizeInBytes 
)

Write data to a socket.

Can be called from any thread

Definition at line 157 of file network-performance-client.cpp.

References mSocket, and Dali::Internal::Adaptor::SocketInterface::Write().

Referenced by ProcessCommand(), and Dali::Internal::Adaptor::NetworkPerformanceServer::SendData().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

unsigned int Dali::Internal::Adaptor::NetworkPerformanceClient::mClientId
private

unique client id

Definition at line 132 of file network-performance-client.h.

Referenced by GetId(), and ProcessCommand().

bool Dali::Internal::Adaptor::NetworkPerformanceClient::mConsoleClient
private

if connected via a console then all responses are in ASCII, not binary packed data.

Definition at line 133 of file network-performance-client.h.

Referenced by ProcessCommand(), and TransmitMarker().

PerformanceMarker::MarkerFilter Dali::Internal::Adaptor::NetworkPerformanceClient::mMarkerBitmask
private

What markers are currently filtered.

Definition at line 128 of file network-performance-client.h.

Referenced by ProcessCommand(), and TransmitMarker().

ClientSendDataInterface& Dali::Internal::Adaptor::NetworkPerformanceClient::mSendDataInterface
private

used to send data to a client from the main event thread

Definition at line 130 of file network-performance-client.h.

Referenced by ProcessCommand().

SocketInterface* Dali::Internal::Adaptor::NetworkPerformanceClient::mSocket
private

socket interface

Definition at line 127 of file network-performance-client.h.

Referenced by ExitSelect(), GetSocket(), TransmitMarker(), WriteSocket(), and ~NetworkPerformanceClient().

SocketFactoryInterface& Dali::Internal::Adaptor::NetworkPerformanceClient::mSocketFactoryInterface
private

used to delete the socket

Definition at line 131 of file network-performance-client.h.

Referenced by ~NetworkPerformanceClient().

pthread_t* Dali::Internal::Adaptor::NetworkPerformanceClient::mThread
private

thread for the client

Definition at line 126 of file network-performance-client.h.

Referenced by GetThread().

TriggerEventFactoryInterface& Dali::Internal::Adaptor::NetworkPerformanceClient::mTriggerEventFactory
private

Trigger event factory.

Definition at line 129 of file network-performance-client.h.

Referenced by ProcessCommand().


The documentation for this class was generated from the following files:
Dali Docs Home
Read more about Dali