Update drainage with dms control.

This commit is contained in:
sunwen
2023-08-31 15:44:11 +08:00
parent 403a5e2a33
commit d0eaba04f7
4 changed files with 30 additions and 1 deletions

View File

@@ -124,6 +124,11 @@ void DeviceManager::initDevice()
connect(EventCenter::Default(), &EventCenter::RequestPreviewScan,this, &DeviceManager::startPreview);
//shutdown
connect(EventCenter::Default(), &EventCenter::RequestShutdown, this, &DeviceManager::shutdown);
//Drainage
connect(EventCenter::Default(), &EventCenter::RequestDrainage, this, [this](QObject* sender, QObject* detail)
{
controlDrainage(*(QString*)detail);
});
//Sync action
mGetDeviceStatusAction = new DmsSyncAction(USRV_SCAN, ACT_SCAN_STATUS, this, "responseGetDeviceStatus(const QString&)", this);
@@ -1011,3 +1016,19 @@ bool DeviceManager::getCEStatus()
}
return true;
}
void DeviceManager::controlDrainage(const QString& aCode)
{
mPumpControlAction->setSendData(QString("{\"pumb\":%1}").arg(aCode));
auto result = mPumpControlAction->execute();
if(result.mIsSucessful)
{
QJsonObject jsonObj = toJsonObject(result.mData);
if(jsonObj["code"].toInt() == 0 )
{
return;
}
}
QString msg = tr("Open pump failed.");
THROW_ERROR(msg);
}

View File

@@ -105,6 +105,7 @@ private:
bool startCEScan();
void startTransfer();
void initEmptyScanMeasurementID();
void controlDrainage(const QString& aCode);
void processScanProgress(const QString& aProgress);
void processInitializeProgress(const QString& aProgress);