Changeset 1761 in ntrip


Ignore:
Timestamp:
Mar 9, 2009, 1:01:29 PM (15 years ago)
Author:
mervart
Message:

* empty log message *

Location:
trunk/BNC
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bncnetqueryudp.cpp

    r1758 r1761  
    1717#include <iostream>
    1818#include <iomanip>
     19#include <time.h>
    1920
    2021#include "bncnetqueryudp.h"
     
    2425
    2526#define BNCVERSION "1.7"
     27#define TIME_RESOLUTION 125
    2628
    2729// Constructor
     
    3234  _eventLoop = new QEventLoop(this);
    3335
    34   _keepAlive = new char[12];
    35   _keepAlive[0]  = 128;
    36   _keepAlive[1]  =  96;
    37   for (int jj = 2; jj <= 7; jj++) {
    38     _keepAlive[jj] = 0;
     36  _keepAlive[ 0] = 128;
     37  _keepAlive[ 1] =  96;
     38  for (int ii = 2; ii <=11; ii++) {
     39    _keepAlive[ii] = 0;
    3940  }
    40   int session = rand();
    41   _keepAlive[8]  = (session >> 24) & 0xFF;
    42   _keepAlive[9]  = (session >> 16) & 0xFF;
    43   _keepAlive[10] = (session >>  8) & 0xFF;
    44   _keepAlive[11] = (session)       & 0xFF;
    4541}
    4642
     
    5046  delete _eventLoop;
    5147  delete _udpSocket;
    52   delete _keepAlive;
    5348}
    5449
     
    6459void bncNetQueryUdp::slotKeepAlive() {
    6560  if (_udpSocket) {
    66     cout << "slotKeepAlive" << endl;
    6761    _udpSocket->writeDatagram(_keepAlive, 12, _address, _port);
    6862  }
    69   QTimer::singleShot(30000, this, SLOT(slotKeepAlive()));
     63  QTimer::singleShot(15000, this, SLOT(slotKeepAlive()));
    7064}
    7165
     
    156150
    157151    _udpSocket->writeDatagram(rtpbuffer, 12 + reqStr.size(), _address, _port);
    158     QTimer::singleShot(30000, this, SLOT(slotKeepAlive()));
     152
     153    // Wait for Reply, read Session Number
     154    // -----------------------------------
     155    QByteArray repl;
     156    waitForReadyRead(repl);
     157
     158    QTextStream in(repl);
     159    QString line = in.readLine();
     160    while (!line.isEmpty()) {
     161      if (line.indexOf("Session:") == 0) {
     162        _session = line.mid(9).toInt();
     163        _keepAlive[ 8] = (_session >> 24) & 0xFF;
     164        _keepAlive[ 9] = (_session >> 16) & 0xFF;
     165        _keepAlive[10] = (_session >>  8) & 0xFF;
     166        _keepAlive[11] = (_session)       & 0xFF;
     167        break;
     168      }
     169      line = in.readLine();
     170    }
     171
     172    QTimer::singleShot(15000, this, SLOT(slotKeepAlive()));
    159173  }
    160174}
  • trunk/BNC/bncnetqueryudp.h

    r1756 r1761  
    2323  QHostAddress _address;
    2424  int          _port;
    25   char*        _keepAlive;
     25  char         _keepAlive[12];
     26  int          _session;
    2627};
    2728
  • trunk/BNC/todo.txt

    r1755 r1761  
    66BNC
    77=========================
    8 (1) NTRIP "U":
    9 Stopps after ~60sec with message "Data timeout, reconnecting"
    10 Could it be that a kind of keep-alife packet is necessary?
    11 
    12 (2) Added "bncnetquerys" for stream input from serial port
     8(1) Added "bncnetquerys" for stream input from serial port
    139Please have a look.
    1410
    15 (3) "Append" files doesn't work with "ZERO" decoder.
     11(2) "Append" files doesn't work with "ZERO" decoder.
    1612
    1713(3) GW: Keep an eye on www.igs-ip.net/PENC0.
Note: See TracChangeset for help on using the changeset viewer.