trikRuntime
trikCommunicator::TrikCommunicator Class Reference

Class that enables connection with a client running on computer (TRIKStudio or remote control). More...

#include <trikCommunicator.h>

Inheritance diagram for trikCommunicator::TrikCommunicator:
Collaboration diagram for trikCommunicator::TrikCommunicator:

Signals

void stopCommandReceived ()
 Emitted when stop command received from a computer. More...
 
- Signals inherited from trikNetwork::TrikServer
void connected ()
 Emitted when we get the first connection established. More...
 
void disconnected ()
 Emitted when the last connection closes. More...
 

Public Member Functions

 TrikCommunicator (trikControl::BrickInterface &brick, trikNetwork::MailboxInterface *mailbox)
 Constructor that creates its own instance of a script runner. More...
 
 TrikCommunicator (trikScriptRunner::TrikScriptRunner &runner, const QString &configVersion)
 Constructor that accepts external script runner and issues commands to it. More...
 
 ~TrikCommunicator () override
 
- Public Member Functions inherited from trikNetwork::TrikServer
 TrikServer (const std::function< Connection *()> &connectionFactory)
 Constructor. More...
 
 ~TrikServer () override
 
int activeConnections () const
 Returns number of connections currently opened. More...
 
Q_INVOKABLE void startServer (quint16 port)
 Starts listening given port on all network interfaces. More...
 

Additional Inherited Members

- Public Slots inherited from trikNetwork::TrikServer
void sendMessage (const QString &message)
 Broadcasts message across all opened connections. More...
 
- Protected Member Functions inherited from trikNetwork::TrikServer
void incomingConnection (qintptr socketDescriptor) override
 
void startConnection (Connection *connectionWorker)
 Launches given connection in a separate thread. Takes ownership over connectionWorker object. More...
 
Connectionconnection (const QHostAddress &ip, int port) const
 Searches connection to given IP and port in a list of all open connections. More...
 
Connectionconnection (const QHostAddress &ip) const
 Searches connection to given IP and any port in a list of all open connections. More...
 

Detailed Description

Class that enables connection with a client running on computer (TRIKStudio or remote control).

Communication subsystem consists of TrikCommunicator object which runs in main thread and listens for incoming connections, Connection objects — one for every connected client, they run in separate threads each, and ScriptRunnerWrapper object in main thread which processes signals from Connections.

Constructor & Destructor Documentation

TrikCommunicator::TrikCommunicator ( trikControl::BrickInterface brick,
trikNetwork::MailboxInterface mailbox 
)

Constructor that creates its own instance of a script runner.

Parameters
brick- reference to robot brick.
mailbox- mailbox object used to communicate with other robots.
TrikCommunicator::TrikCommunicator ( trikScriptRunner::TrikScriptRunner runner,
const QString &  configVersion 
)
explicit

Constructor that accepts external script runner and issues commands to it.

Parameters
runner- script runner that shall be used to execute commands.
configVersion- version of system config file that can be used to check that client and runtime configs match.
TrikCommunicator::~TrikCommunicator ( )
override

Member Function Documentation

void trikCommunicator::TrikCommunicator::stopCommandReceived ( )
signal

Emitted when stop command received from a computer.


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