UI: RPC: Setup DriverManager install/uninstall.

This commit is contained in:
Nodir Temirkhodjaev 2021-05-02 16:51:16 +03:00
parent 6e6849e397
commit b17f908c4f
7 changed files with 26 additions and 13 deletions

View File

@ -47,7 +47,7 @@ sc start %BASENAME%
:EXIT :EXIT
@echo End execution... Error Code = %RCODE% @echo End execution... Error Code = %RCODE%
@if %RCODE% neq 0 ( @if "%FORT_SILENT%" equ "" (
@pause @if %RCODE% neq 0 @pause
) )
@exit /b %RCODE% @exit /b %RCODE%

View File

@ -748,10 +748,6 @@ bool ConfManager::validateDriver()
QByteArray buf; QByteArray buf;
const int verSize = confUtil.writeVersion(buf); const int verSize = confUtil.writeVersion(buf);
if (!verSize) {
showErrorMessage(confUtil.errorMessage());
return false;
}
return driverManager()->validate(buf, verSize); return driverManager()->validate(buf, verSize);
} }

View File

@ -14,6 +14,8 @@ enum Command : qint8 {
Rpc_AppInfoManager_checkLookupFinished, Rpc_AppInfoManager_checkLookupFinished,
Rpc_ConfManager_, Rpc_ConfManager_,
Rpc_DriverManager_updateState, Rpc_DriverManager_updateState,
Rpc_DriverManager_reinstallDriver,
Rpc_DriverManager_uninstallDriver,
Rpc_QuotaManager_alert, Rpc_QuotaManager_alert,
Rpc_StatManager_, Rpc_StatManager_,
Rpc_TaskManager_, Rpc_TaskManager_,

View File

@ -192,15 +192,14 @@ void FortManager::removeDriver()
bool FortManager::setupDriver() bool FortManager::setupDriver()
{ {
bool opened = driverManager()->openDevice(); bool ok = driverManager()->openDevice();
if (!confManager()->validateDriver()) { if (ok && !confManager()->validateDriver()) {
driverManager()->closeDevice(); driverManager()->closeDevice();
ok = false;
opened = false;
} }
return opened; return ok;
} }
void FortManager::closeDriver() void FortManager::closeDriver()

View File

@ -76,6 +76,10 @@ void FortSettings::initialize(const QStringList &args, EnvManager *envManager)
processArguments(args); processArguments(args);
setupPaths(envManager); setupPaths(envManager);
setupIni(); setupIni();
if (isService()) {
qputenv("FORT_SILENT", "1"); // For batch scripts
}
} }
void FortSettings::processArguments(const QStringList &args) void FortSettings::processArguments(const QStringList &args)

View File

@ -21,9 +21,15 @@ RpcManager *DriverManagerRpc::rpcManager() const
return fortManager()->rpcManager(); return fortManager()->rpcManager();
} }
void DriverManagerRpc::reinstallDriver() { } void DriverManagerRpc::reinstallDriver()
{
rpcManager()->invokeOnServer(Control::Rpc_DriverManager_reinstallDriver);
}
void DriverManagerRpc::uninstallDriver() { } void DriverManagerRpc::uninstallDriver()
{
rpcManager()->invokeOnServer(Control::Rpc_DriverManager_uninstallDriver);
}
void DriverManagerRpc::updateState(quint32 errorCode, bool isDeviceOpened) void DriverManagerRpc::updateState(quint32 errorCode, bool isDeviceOpened)
{ {

View File

@ -142,6 +142,12 @@ bool RpcManager::processCommandRpc(
return true; return true;
} }
break; break;
case Control::Rpc_DriverManager_reinstallDriver:
driverManager()->reinstallDriver();
return true;
case Control::Rpc_DriverManager_uninstallDriver:
driverManager()->uninstallDriver();
return true;
case Control::Rpc_QuotaManager_alert: case Control::Rpc_QuotaManager_alert:
emit quotaManager()->alert(args.value(0).toInt()); emit quotaManager()->alert(args.value(0).toInt());
return true; return true;