source: ntrip/trunk/BNC/src/bncnetqueryudp0.cpp@ 10460

Last change on this file since 10460 was 6787, checked in by stuerze, 10 years ago

add keep-alive request to send gga message in ntrip version 1 mode without interruption

File size: 2.0 KB
RevLine 
[1779]1/* -------------------------------------------------------------------------
2 * BKG NTRIP Client
3 * -------------------------------------------------------------------------
4 *
5 * Class: bncNetQueryUdp0
6 *
7 * Purpose: Blocking Network Requests (plain UDP, no NTRIP)
8 *
9 * Author: L. Mervart
10 *
11 * Created: 04-Feb-2009
12 *
13 * Changes:
14 *
15 * -----------------------------------------------------------------------*/
16
17#include "bncnetqueryudp0.h"
18
19// Constructor
20////////////////////////////////////////////////////////////////////////////
21bncNetQueryUdp0::bncNetQueryUdp0() {
22 _udpSocket = 0;
[1785]23 _eventLoop = new QEventLoop(this);
[1779]24}
25
26// Destructor
27////////////////////////////////////////////////////////////////////////////
28bncNetQueryUdp0::~bncNetQueryUdp0() {
[1785]29 delete _eventLoop;
[1779]30 delete _udpSocket;
31}
32
33//
34////////////////////////////////////////////////////////////////////////////
35void bncNetQueryUdp0::stop() {
[1785]36 _eventLoop->quit();
[1783]37 _status = finished;
[1779]38}
39
40//
41////////////////////////////////////////////////////////////////////////////
42void bncNetQueryUdp0::waitForRequestResult(const QUrl&, QByteArray&) {
43}
44
45//
46////////////////////////////////////////////////////////////////////////////
47void bncNetQueryUdp0::waitForReadyRead(QByteArray& outData) {
[1785]48
49 // Wait Loop
50 // ---------
51 if (!_udpSocket->hasPendingDatagrams()) {
52 _eventLoop->exec();
[1779]53 }
[1785]54
55 // Append Data
56 // -----------
57 QByteArray datagram;
58 datagram.resize(_udpSocket->pendingDatagramSize());
59 _udpSocket->readDatagram(datagram.data(), datagram.size());
60
[1787]61 outData.append(datagram);
[1779]62}
63
64// Connect to Caster, send the Request
65////////////////////////////////////////////////////////////////////////////
[1783]66void bncNetQueryUdp0::startRequest(const QUrl& url, const QByteArray& /* gga */) {
[1779]67
68 _status = running;
69
[1791]70 delete _udpSocket;
71 _udpSocket = new QUdpSocket();
[1792]72 _udpSocket->bind(url.port());
[1779]73
[1791]74 connect(_udpSocket, SIGNAL(readyRead()), _eventLoop, SLOT(quit()));
[1779]75}
76
[6787]77void bncNetQueryUdp0::keepAliveRequest(const QUrl& /* url */, const QByteArray& /* gga */) {
78}
Note: See TracBrowser for help on using the repository browser.