mirror of
https://github.com/Quill-OS/quill.git
synced 2024-12-28 00:27:21 -08:00
Compare commits
1 commit
1d738f3c3c
...
9c526573ea
Author | SHA1 | Date | |
---|---|---|---|
|
9c526573ea |
1 changed files with 6 additions and 13 deletions
|
@ -33,7 +33,9 @@ QJsonObject Telemetry::collectDeviceInformation() {
|
||||||
bool Telemetry::sendDeviceInformation(QJsonObject data) {
|
bool Telemetry::sendDeviceInformation(QJsonObject data) {
|
||||||
log("Telemetry data to be sent to server: " + QJsonDocument(data).toJson(QJsonDocument::Compact), className);
|
log("Telemetry data to be sent to server: " + QJsonDocument(data).toJson(QJsonDocument::Compact), className);
|
||||||
|
|
||||||
QNetworkRequest request(QUrl("http://23.163.0.39:4317/"));
|
// NOTE: This URL *will* change in the future
|
||||||
|
// TODO: Add error-handling
|
||||||
|
QNetworkRequest request(QUrl("http://192.168.3.1:8080/"));
|
||||||
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||||
|
|
||||||
QNetworkAccessManager nam;
|
QNetworkAccessManager nam;
|
||||||
|
@ -43,14 +45,8 @@ bool Telemetry::sendDeviceInformation(QJsonObject data) {
|
||||||
}
|
}
|
||||||
QByteArray responseData = reply->readAll();
|
QByteArray responseData = reply->readAll();
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
QString responseDataQstring = QString(responseData);
|
|
||||||
log("Telemetry server's response data was: '" + responseDataQstring + "'", className);
|
|
||||||
if(responseDataQstring != "Data received successfully") {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Telemetry::telemetrySlot() {
|
void Telemetry::telemetrySlot() {
|
||||||
|
@ -58,9 +54,6 @@ void Telemetry::telemetrySlot() {
|
||||||
if(sendDeviceInformation(data)) {
|
if(sendDeviceInformation(data)) {
|
||||||
writeFile("/mnt/onboard/.adds/inkbox/.config/24-telemetry/asked", "true");
|
writeFile("/mnt/onboard/.adds/inkbox/.config/24-telemetry/asked", "true");
|
||||||
writeFile("/mnt/onboard/.adds/inkbox/.config/24-telemetry/enabled", "true");
|
writeFile("/mnt/onboard/.adds/inkbox/.config/24-telemetry/enabled", "true");
|
||||||
showToast("Data sent successfully\nThank you!");
|
showToast("Data successfully sent\nThank you!");
|
||||||
}
|
|
||||||
else {
|
|
||||||
showToast("Error while sending data");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue