setting page using local thread to fetch device data,battery bug fixes

This commit is contained in:
xueyan hu
2022-01-12 17:59:05 +08:00
parent 376c343945
commit 80528751e4
13 changed files with 271 additions and 221 deletions

View File

@@ -10,7 +10,6 @@
#include <QDateTime>
#include <qdebug.h>
#include "appvals/AppGlobalValues.h"
#define TRIGGER_EVENT EventCenter::Default()->triggerEvent
#define THROW_ERROR(errormsg)\
@@ -52,7 +51,6 @@ void DeviceManager::initDevice() {
InitLib(ErrorCallback);
deviceInfTimerID = startTimer(1000);
diskInfTimerID = startTimer(60000);
// empty scan
connect(EventCenter::Default(), &EventCenter::RequestEmptyScan, [=](QObject* sender, QObject* detail) {
@@ -182,19 +180,15 @@ void DeviceManager::initDevice() {
}
});
previewDataCaller->start();
}
void DeviceManager::timerEvent(QTimerEvent* event) {
if (event->timerId() == deviceInfTimerID) {
QString temp = QString(GetDeviceInfo(MEAN_TEMPERATURE));
TRIGGER_EVENT(GUIEvents::ResponseDeviceTemperature, nullptr, (QObject*)&temp);
return;
}
if (event->timerId() == diskInfTimerID)
{
TRIGGER_EVENT(GUIEvents::ResponseDeviceStoragement, nullptr, nullptr);
return;
if (event->timerId() == deviceInfTimerID) {
QString temp = QString(GetDeviceInfo(MEAN_TEMPERATURE));
TRIGGER_EVENT(GUIEvents::ResponseDeviceTemperature, nullptr, (QObject*)&temp);
return;
}
//scanning progress timer
{

View File

@@ -30,7 +30,6 @@ private:
void processScan(const char* json, bool empty = false);
int timerID = -1;
int deviceInfTimerID = -1;
int diskInfTimerID = -1;
int lastStatus = -1;
bool previewing = false;
bool endLoop = false;