Changeset 1374 in ntrip for trunk/BNC/bncnetquery.cpp
- Timestamp:
- Dec 28, 2008, 9:53:04 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/bncnetquery.cpp
r1373 r1374 35 35 _reply = 0; 36 36 _eventLoop = new QEventLoop(this); 37 38 _status = init; 37 39 } 38 40 … … 48 50 //////////////////////////////////////////////////////////////////////////// 49 51 void bncNetQuery::slotError(QNetworkReply::NetworkError) { 52 _status = error; 50 53 cout << "slotError " << endl; 51 54 emit newMessage("slotError " + _reply->errorString().toAscii(), true); … … 54 57 55 58 void bncNetQuery::slotFinished() { 59 if (_status != error) { 60 _status = finished; 61 } 56 62 cout << "slotFinished" << endl; 57 63 } … … 63 69 // Start request, block till the next read (public) 64 70 //////////////////////////////////////////////////////////////////////////// 65 t_ircbncNetQuery::startRequest(const QUrl& url) {66 returnstartRequest(url, true);71 void bncNetQuery::startRequest(const QUrl& url) { 72 startRequest(url, true); 67 73 } 68 74 69 75 // Start request 70 76 //////////////////////////////////////////////////////////////////////////// 71 t_irc bncNetQuery::startRequest(const QUrl& url, bool full) { 77 void bncNetQuery::startRequest(const QUrl& url, bool full) { 78 79 _status = running; 72 80 73 81 // Default scheme and path … … 107 115 connect(_reply, SIGNAL(error(QNetworkReply::NetworkError)), 108 116 this, SLOT(slotError(QNetworkReply::NetworkError))); 109 110 return success;111 117 } 112 118 113 119 // Start Request, wait for its completion 114 120 //////////////////////////////////////////////////////////////////////////// 115 t_ircbncNetQuery::waitForRequestResult(const QUrl& url, QByteArray& outData) {121 void bncNetQuery::waitForRequestResult(const QUrl& url, QByteArray& outData) { 116 122 117 123 // Send Request 118 124 // ------------ 119 if (startRequest(url) != success) { 120 return failure; 121 } 125 startRequest(url); 122 126 123 127 // Wait Loop … … 128 132 // -------------------- 129 133 outData = _reply->readAll(); 130 131 if (_reply->error() == QNetworkReply::NoError) {132 return success;133 }134 else {135 return failure;136 }137 134 } 138 135 139 136 // Wait for next data 140 137 //////////////////////////////////////////////////////////////////////////// 141 t_ircbncNetQuery::waitForReadyRead(QByteArray& outData) {138 void bncNetQuery::waitForReadyRead(QByteArray& outData) { 142 139 143 140 // Wait Loop … … 147 144 } 148 145 149 // Append Data and Return150 // ----------- ------------146 // Append Data 147 // ----------- 151 148 outData.append(_reply->readAll()); 152 153 if (_reply->error() == QNetworkReply::NoError) {154 return success;155 }156 else {157 return failure;158 }159 149 }
Note:
See TracChangeset
for help on using the changeset viewer.