One connection to a client (or server) in mailbox. Supposed to be working in a separate thread.
More...
#include <mailboxConnection.h>
|
| MailboxConnection () |
|
Q_INVOKABLE void | connect (const QHostAddress &targetIp, int targetPort, int myServerPort, int myHullNumber) |
| Connect to given endpoint and send "register" command with our mailbox server port and hull number. More...
|
|
Q_INVOKABLE void | sendConnectionInfo (const QHostAddress &ip, int port, int hullNumber) |
| Send info about other robot: its IP, port and hull number. More...
|
|
Q_INVOKABLE void | sendSelfInfo (int hullNumber) |
| Send our hull number. Used in response for connection request. More...
|
|
| 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...
|
|
|
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...
|
|
One connection to a client (or server) in mailbox. Supposed to be working in a separate thread.
MailboxConnection::MailboxConnection |
( |
| ) |
|
void MailboxConnection::connect |
( |
const QHostAddress & |
targetIp, |
|
|
int |
targetPort, |
|
|
int |
myServerPort, |
|
|
int |
myHullNumber |
|
) |
| |
Connect to given endpoint and send "register" command with our mailbox server port and hull number.
void trikNetwork::MailboxConnection::connectionInfo |
( |
const QHostAddress & |
ip, |
|
|
int |
port, |
|
|
int |
hullNumber |
|
) |
| |
|
signal |
Emitted when remote robot sends info about other known robots ("connection" command).
void trikNetwork::MailboxConnection::newConnection |
( |
const QHostAddress & |
ip, |
|
|
int |
clientPort, |
|
|
int |
serverPort, |
|
|
int |
hullNumber |
|
) |
| |
|
signal |
Emitted when "register" command is received.
- Parameters
-
ip | - remote robot IP. |
clientPort | - remote robot client port (peer port), for reuse of this new connection. |
serverPort | - remote robot mailbox server port. |
hullNumber | - remote robot hull number. |
void trikNetwork::MailboxConnection::newData |
( |
const QHostAddress & |
ip, |
|
|
int |
port, |
|
|
const QByteArray & |
data |
|
) |
| |
|
signal |
Emitted when new data message received ("data" command).
void MailboxConnection::sendConnectionInfo |
( |
const QHostAddress & |
ip, |
|
|
int |
port, |
|
|
int |
hullNumber |
|
) |
| |
Send info about other robot: its IP, port and hull number.
void MailboxConnection::sendSelfInfo |
( |
int |
hullNumber | ) |
|
Send our hull number. Used in response for connection request.
The documentation for this class was generated from the following files: