Handles the network access to the robot (e.g. via WLAN).
More...
#include <networkThread.h>
List of all members.
Static Private Attributes |
static const unsigned char | GREEN = 2 |
static const unsigned char | LEDOFF = 0 |
static const unsigned char | RED = 1 |
static const unsigned long | THREADSLEEPTIME = 1000 |
| Indicates if this program is the slave and receives data from the robot over the network.
|
Detailed Description
Handles the network access to the robot (e.g. via WLAN).
- Author:
- Markus Knapp It opens an UDP socket and listens on a port. When data are received, the signal dataReceived is emitted. UDP used, since the sending of the data does not need to be very reliable.
Definition at line 38 of file networkThread.h.
Constructor & Destructor Documentation
NetworkThread::NetworkThread |
( |
| ) |
|
NetworkThread::~NetworkThread |
( |
| ) |
|
Member Function Documentation
void NetworkThread::dataReceived |
( |
QString |
text | ) |
|
|
signal |
This signal emits when data were received over the network.
void NetworkThread::heartbeat |
( |
unsigned char |
state | ) |
|
|
signal |
This signal is emitted every MSLEEP seconds to show that we are sending a master signal.
- See also:
- Gui::setLEDMasterSlave()
bool NetworkThread::init |
( |
unsigned int |
portListen, |
|
|
unsigned int |
portSend |
|
) |
| |
Sets the network ports
- Parameters:
-
portListen | is the network port where the class receives data. |
portSend | is the network port where the class sends data. |
- Returns:
- true on success, false on error
Definition at line 136 of file networkThread.cpp.
void NetworkThread::processPendingDatagrams |
( |
| ) |
|
|
privateslot |
This slot is automatically called by the framework, in the case of pending datagrams.
Definition at line 86 of file networkThread.cpp.
void NetworkThread::run |
( |
| ) |
|
|
virtual |
void NetworkThread::sendNetworkCommand |
( |
QString |
text | ) |
|
|
slot |
void NetworkThread::setNetworkMaster |
( |
| ) |
|
|
slot |
Enables sending the 'master' signal over network every second
Definition at line 155 of file networkThread.cpp.
void NetworkThread::setNetworkSlave |
( |
| ) |
|
|
slot |
void NetworkThread::stop |
( |
| ) |
|
void NetworkThread::swapPorts |
( |
| ) |
|
Swaps the sender and listener port. This is at the beginning, when we have two instances of this program in one network
Definition at line 116 of file networkThread.cpp.
Member Data Documentation
const unsigned char NetworkThread::GREEN = 2 |
|
staticprivate |
bool NetworkThread::iAmTheMaster |
|
private |
bool NetworkThread::iAmTheSlave |
|
private |
Indicates if this program is the master and sends data from the robot over the network.
Definition at line 112 of file networkThread.h.
const unsigned char NetworkThread::LEDOFF = 0 |
|
staticprivate |
unsigned int NetworkThread::networkPortListen |
|
private |
unsigned int NetworkThread::networkPortSend |
|
private |
const unsigned char NetworkThread::RED = 1 |
|
staticprivate |
volatile bool NetworkThread::stopped |
|
private |
const unsigned long NetworkThread::THREADSLEEPTIME = 1000 |
|
staticprivate |
Indicates if this program is the slave and receives data from the robot over the network.
Definition at line 116 of file networkThread.h.
QUdpSocket* NetworkThread::udpSocket |
|
private |
The documentation for this class was generated from the following files: