trikRuntime
trikCommunicator::Connection Class Reference

Class that serves one client of TrikCommunicator. More...

#include <connection.h>

Inheritance diagram for trikCommunicator::Connection:
Collaboration diagram for trikCommunicator::Connection:

Signals

void stopCommandReceived ()
 Emitted when a stop command received from a computer. More...
 
- Signals inherited from trikNetwork::Connection
void disconnected (trikNetwork::Connection *self)
 Emitted after connection becomes closed. More...
 
void connected (trikNetwork::Connection *self)
 Emitted after connection is established. More...
 

Public Member Functions

 Connection (trikScriptRunner::TrikScriptRunner &trikScriptRunner, const QString &configVersion)
 Constructor. More...
 
void sendMessage (const QString &message)
 Writes a given message to inner socket. More...
 
- Public Member Functions inherited from trikNetwork::Connection
 Connection (Protocol connectionProtocol, Heartbeat useHeartbeat)
 Constructor. More...
 
bool isConnected () const
 Returns true if socket is opened or false otherwise. More...
 
bool isValid () const
 Checks if socket is valid or not Attention!!! Hot fix for NTI contest. More...
 
QHostAddress peerAddress () const
 Returns peer address of a connection, if it is open, or empty QHostAddress if connection is not established yet. More...
 
int peerPort () const
 Returns peer port of a connection, if it is open, or -1 if connection is not established yet. More...
 
Q_INVOKABLE void init (qintptr socketDescriptor)
 Creates socket and initializes incoming connection, shall be called when Connection is already in its own thread. More...
 
Q_INVOKABLE void send (const QByteArray &data)
 Sends given byte array to peer. More...
 

Additional Inherited Members

- Protected Member Functions inherited from trikNetwork::Connection
void init (const QHostAddress &ip, int port)
 Creates socket and initializes outgoing connection, shall be called when Connection is already in its own thread. More...
 

Detailed Description

Class that serves one client of TrikCommunicator.

Meant to work in separate thread. Creates its own socket and handles all incoming messages, calling ScriptRunnerWrapper for brick functionality.

Connection accepts commands:

  • file:<file name>="">:<file contents>=""> — save given contents to a file with given name in current directory.
  • run:<file name>=""> — execute a file with given name.
  • stop — stop current script execution and a robot.
  • direct:<command> — execute given script without saving it to a file.
  • keepalive — do nothing, used to check the availability of connection.

Constructor & Destructor Documentation

Connection::Connection ( trikScriptRunner::TrikScriptRunner trikScriptRunner,
const QString &  configVersion 
)
explicit

Constructor.

Parameters
trikScriptRunner- instance of script runner object.
configVersion- version of a system configuration file, must match controller casing.

Member Function Documentation

void trikCommunicator::Connection::sendMessage ( const QString &  message)

Writes a given message to inner socket.

void trikCommunicator::Connection::stopCommandReceived ( )
signal

Emitted when a stop command received from a computer.


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