- Timestamp:
- Mar 4, 2009, 5:54:00 PM (16 years ago)
- Location:
- trunk/BNC
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/bncnetqueryv2.cpp
r1712 r1713 44 44 } 45 45 46 // Stop (quit even loop)46 // Stop (quit event loop) 47 47 //////////////////////////////////////////////////////////////////////////// 48 48 void bncNetQueryV2::stop() { … … 61 61 _status = error; 62 62 emit newMessage(_url.path().toAscii().replace(0,1,"") + 63 ": NetQuery , Error -server replied: " +63 ": NetQueryV2: server replied: " + 64 64 _reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray(), 65 65 true); … … 113 113 // Network Request 114 114 // --------------- 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"); 120 119 if (!_url.userName().isEmpty()) { 121 120 QString uName = QUrl::fromPercentEncoding(_url.userName().toAscii()); 122 121 QString passW = QUrl::fromPercentEncoding(_url.password().toAscii()); 123 request.setRawHeader("Authorization", "Basic " +122 _request.setRawHeader("Authorization", "Basic " + 124 123 (uName + ":" + passW).toAscii().toBase64()); 125 124 } 126 125 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 //////////////////////////////////////////////////////////////////////////// 135 void bncNetQueryV2::startGet(bool full) { 136 137 if (_reply) { 138 _reply->abort(); 139 delete _reply; 140 } 141 142 _reply = _manager->get(_request); 132 143 133 144 // Connect Signals … … 183 194 //////////////////////////////////////////////////////////////////////////// 184 195 void 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 23 23 private: 24 24 void startRequestPrivate(const QUrl& url, const QByteArray& gga, bool full); 25 void startGet(bool full); 25 26 26 27 QNetworkAccessManager* _manager; 27 28 QNetworkReply* _reply; 29 QNetworkRequest _request; 28 30 QEventLoop* _eventLoop; 29 31 bool _firstData;
Note:
See TracChangeset
for help on using the changeset viewer.