|
|
@ -4,31 +4,51 @@ |
|
|
|
|
|
|
|
void UdpDataSender::send(const QByteArray& data) |
|
|
|
{ |
|
|
|
_socket->writeDatagram(data, QHostAddress::LocalHost, 5446); |
|
|
|
_socketDashboard->writeDatagram(data, QHostAddress::LocalHost, 5446); |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
|
void UdpDataSender::sendProbeSlots(const QByteArray& data) |
|
|
|
{ |
|
|
|
_socketProbeSlots->writeDatagram(data, QHostAddress::LocalHost, 5450); |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
|
void UdpDataSender::read() |
|
|
|
{ |
|
|
|
char data[DATAGRAM_SIZE]; |
|
|
|
int cnt = _socket->readDatagram(data, DATAGRAM_SIZE); |
|
|
|
int cnt = _socketDashboard->readDatagram(data, DATAGRAM_SIZE); |
|
|
|
QByteArray a(data, cnt); |
|
|
|
emit dataReady(a); |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
|
UdpDataSender::UdpDataSender() |
|
|
|
void UdpDataSender::readProbeSlots() |
|
|
|
{ |
|
|
|
_socket = new QUdpSocket(); |
|
|
|
char data[DATAGRAM_SIZE]; |
|
|
|
int cnt = _socketProbeSlots->readDatagram(data, DATAGRAM_SIZE); |
|
|
|
QByteArray a(data, cnt); |
|
|
|
emit probeSlotsDataReady(a); |
|
|
|
} |
|
|
|
|
|
|
|
_socket->bind(QHostAddress::Any, 5445); |
|
|
|
/*************************************************************************************************/ |
|
|
|
UdpDataSender::UdpDataSender() |
|
|
|
{ |
|
|
|
_socketDashboard = new QUdpSocket(); |
|
|
|
_socketDashboard->bind(QHostAddress::Any, 5445); |
|
|
|
connect(_socketDashboard, SIGNAL(readyRead()), this, SLOT(read())); |
|
|
|
|
|
|
|
connect(_socket, SIGNAL(readyRead()), this, SLOT(read())); |
|
|
|
_socketProbeSlots = new QUdpSocket(); |
|
|
|
_socketProbeSlots->bind(QHostAddress::Any, 5449); |
|
|
|
connect(_socketProbeSlots, SIGNAL(readyRead()), this, SLOT(readProbeSlots())); |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
|
UdpDataSender::~UdpDataSender() |
|
|
|
{ |
|
|
|
_socket->close(); |
|
|
|
delete _socket; |
|
|
|
_socketDashboard->close(); |
|
|
|
delete _socketDashboard; |
|
|
|
|
|
|
|
_socketProbeSlots->close(); |
|
|
|
delete _socketProbeSlots; |
|
|
|
} |
|
|
|