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
@echo End execution... Error Code = %RCODE%
@if %RCODE% neq 0 (
@pause
@if "%FORT_SILENT%" equ "" (
@if %RCODE% neq 0 @pause
)
@exit /b %RCODE%

View File

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

View File

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

View File

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

View File

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

View File

@ -21,9 +21,15 @@ RpcManager *DriverManagerRpc::rpcManager() const
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)
{

View File

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