Changeset 1713 in ntrip for trunk/BNC


Ignore:
Timestamp:
Mar 4, 2009, 5:54:00 PM (16 years ago)
Author:
mervart
Message:

* empty log message *

Location:
trunk/BNC
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bncnetqueryv2.cpp

    r1712 r1713  
    4444}
    4545
    46 // Stop (quit even loop)
     46// Stop (quit event loop)
    4747////////////////////////////////////////////////////////////////////////////
    4848void bncNetQueryV2::stop() {
     
    6161    _status = error;
    6262    emit newMessage(_url.path().toAscii().replace(0,1,"")  +
    63                     ": NetQuery, Error - server replied: " +
     63                    ": NetQueryV2: server replied: " +
    6464                    _reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray(),
    6565                    true);
     
    113113  // Network Request
    114114  // ---------------
    115   QNetworkRequest request;
    116   request.setUrl(_url);
    117   request.setRawHeader("Host"         , _url.host().toAscii());
    118   request.setRawHeader("Ntrip-Version", "Ntrip/2.0");
    119   request.setRawHeader("User-Agent"   , "NTRIP BNC/1.7");
     115  _request.setUrl(_url);
     116  _request.setRawHeader("Host"         , _url.host().toAscii());
     117  _request.setRawHeader("Ntrip-Version", "Ntrip/2.0");
     118  _request.setRawHeader("User-Agent"   , "NTRIP BNC/1.7");
    120119  if (!_url.userName().isEmpty()) {
    121120    QString uName = QUrl::fromPercentEncoding(_url.userName().toAscii());
    122121    QString passW = QUrl::fromPercentEncoding(_url.password().toAscii());
    123     request.setRawHeader("Authorization", "Basic " +
     122    _request.setRawHeader("Authorization", "Basic " +
    124123                         (uName + ":" + passW).toAscii().toBase64());
    125124  }
    126125  if (!gga.isEmpty()) {
    127     request.setRawHeader("Ntrip-GGA", gga);
    128   }
    129   request.setRawHeader("Connection"   , "close");
    130 
    131   _reply = _manager->get(request);
     126    _request.setRawHeader("Ntrip-GGA", gga);
     127  }
     128  _request.setRawHeader("Connection"   , "close");
     129
     130  this->startGet(full);
     131}
     132
     133// Start Get HTTP Method
     134////////////////////////////////////////////////////////////////////////////
     135void bncNetQueryV2::startGet(bool full) {
     136
     137  if (_reply) {
     138    _reply->abort();
     139    delete _reply;
     140  }
     141
     142  _reply = _manager->get(_request);
    132143
    133144  // Connect Signals
     
    183194////////////////////////////////////////////////////////////////////////////
    184195void bncNetQueryV2::sendNMEA(const QByteArray& gga) {
    185 
    186 }
     196  if (!gga.isEmpty()) {
     197    _request.setRawHeader("Ntrip-GGA", gga);
     198  }
     199  this->startGet(false);
     200}
  • trunk/BNC/bncnetqueryv2.h

    r1712 r1713  
    2323 private:
    2424  void startRequestPrivate(const QUrl& url, const QByteArray& gga, bool full);
     25  void startGet(bool full);
    2526
    2627  QNetworkAccessManager* _manager;
    2728  QNetworkReply*         _reply;
     29  QNetworkRequest        _request;
    2830  QEventLoop*            _eventLoop;
    2931  bool                   _firstData;
Note: See TracChangeset for help on using the changeset viewer.