mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralgw.git
synced 2026-03-20 03:41:02 +00:00
REST Refactoring
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
|
||||
#include "uCentralProtocol.h"
|
||||
#include "RESTAPI_protocol.h"
|
||||
#include "RESTAPI_RPC.h"
|
||||
|
||||
#include "CommandManager.h"
|
||||
#include "KafkaManager.h"
|
||||
@@ -299,7 +300,7 @@ void RESTAPI_device_commandHandler::Configure(Poco::Net::HTTPServerRequest &Requ
|
||||
Cmd.Details = ParamStream.str();
|
||||
|
||||
DeviceRegistry()->SetPendingUUID(SerialNumber_, NewUUID);
|
||||
WaitForCommand(Cmd, Params, Request, Response);
|
||||
RESTAPI_RPC::WaitForCommand(Cmd, Params, Request, Response, std::chrono::milliseconds(5000), nullptr, this);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -345,7 +346,7 @@ void RESTAPI_device_commandHandler::Upgrade(Poco::Net::HTTPServerRequest &Reques
|
||||
Params.stringify(ParamStream);
|
||||
Cmd.Details = ParamStream.str();
|
||||
|
||||
WaitForCommand(Cmd, Params, Request, Response, std::chrono::milliseconds(20000));
|
||||
RESTAPI_RPC::WaitForCommand(Cmd, Params, Request, Response, std::chrono::milliseconds(20000), nullptr, this);
|
||||
return;
|
||||
}
|
||||
} catch (const Poco::Exception &E) {
|
||||
@@ -500,7 +501,7 @@ void RESTAPI_device_commandHandler::ExecuteCommand(Poco::Net::HTTPServerRequest
|
||||
Params.stringify(ParamStream);
|
||||
Cmd.Details = ParamStream.str();
|
||||
|
||||
WaitForCommand(Cmd, Params, Request, Response, std::chrono::milliseconds(20000));
|
||||
RESTAPI_RPC::WaitForCommand(Cmd, Params, Request, Response, std::chrono::milliseconds(20000), nullptr, this);
|
||||
return;
|
||||
}
|
||||
} catch (const Poco::Exception &E) {
|
||||
@@ -540,7 +541,7 @@ void RESTAPI_device_commandHandler::Reboot(Poco::Net::HTTPServerRequest &Request
|
||||
Params.stringify(ParamStream);
|
||||
Cmd.Details = ParamStream.str();
|
||||
|
||||
WaitForCommand(Cmd, Params, Request, Response, std::chrono::milliseconds(2000));
|
||||
RESTAPI_RPC::WaitForCommand(Cmd, Params, Request, Response, std::chrono::milliseconds(2000), nullptr, this);
|
||||
return;
|
||||
}
|
||||
} catch (const Poco::Exception &E) {
|
||||
@@ -588,7 +589,7 @@ void RESTAPI_device_commandHandler::Factory(Poco::Net::HTTPServerRequest &Reques
|
||||
Params.stringify(ParamStream);
|
||||
Cmd.Details = ParamStream.str();
|
||||
|
||||
WaitForCommand(Cmd, Params, Request, Response, std::chrono::milliseconds(20000));
|
||||
RESTAPI_RPC::WaitForCommand(Cmd, Params, Request, Response, std::chrono::milliseconds(20000), nullptr, this);
|
||||
return;
|
||||
}
|
||||
} catch (const Poco::Exception &E) {
|
||||
@@ -646,7 +647,7 @@ void RESTAPI_device_commandHandler::LEDs(Poco::Net::HTTPServerRequest &Request,
|
||||
Params.stringify(ParamStream);
|
||||
Cmd.Details = ParamStream.str();
|
||||
|
||||
WaitForCommand(Cmd, Params, Request, Response, std::chrono::milliseconds(20000));
|
||||
RESTAPI_RPC::WaitForCommand(Cmd, Params, Request, Response, std::chrono::milliseconds(20000), nullptr, this);
|
||||
return;
|
||||
}
|
||||
} catch (const Poco::Exception &E) {
|
||||
@@ -705,7 +706,7 @@ void RESTAPI_device_commandHandler::Trace(Poco::Net::HTTPServerRequest &Request,
|
||||
Cmd.Details = ParamStream.str();
|
||||
|
||||
FileUploader()->AddUUID(UUID);
|
||||
WaitForCommand(Cmd, Params, Request, Response, std::chrono::milliseconds(3000));
|
||||
RESTAPI_RPC::WaitForCommand(Cmd, Params, Request, Response, std::chrono::milliseconds(3000), nullptr, this);
|
||||
return;
|
||||
}
|
||||
} catch (const Poco::Exception &E) {
|
||||
@@ -769,7 +770,7 @@ void RESTAPI_device_commandHandler::WifiScan(Poco::Net::HTTPServerRequest &Reque
|
||||
std::stringstream ParamStream;
|
||||
Params.stringify(ParamStream);
|
||||
Cmd.Details = ParamStream.str();
|
||||
WaitForCommand(Cmd, Params, Request, Response, std::chrono::milliseconds(20000));
|
||||
RESTAPI_RPC::WaitForCommand(Cmd, Params, Request, Response, std::chrono::milliseconds(20000), nullptr, this);
|
||||
KafkaManager()->PostMessage(uCentral::KafkaTopics::WIFISCAN, SerialNumber_,
|
||||
Cmd.Results);
|
||||
|
||||
@@ -814,7 +815,7 @@ void RESTAPI_device_commandHandler::EventQueue(Poco::Net::HTTPServerRequest &Req
|
||||
Params.stringify(ParamStream);
|
||||
Cmd.Details = ParamStream.str();
|
||||
|
||||
WaitForCommand(Cmd, Params, Request, Response, std::chrono::milliseconds(20000));
|
||||
RESTAPI_RPC::WaitForCommand(Cmd, Params, Request, Response, std::chrono::milliseconds(20000), nullptr, this);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -865,7 +866,7 @@ void RESTAPI_device_commandHandler::MakeRequest(Poco::Net::HTTPServerRequest &Re
|
||||
Params.stringify(ParamStream);
|
||||
Cmd.Details = ParamStream.str();
|
||||
|
||||
WaitForCommand(Cmd, Params, Request, Response, std::chrono::milliseconds(50000));
|
||||
RESTAPI_RPC::WaitForCommand(Cmd, Params, Request, Response, std::chrono::milliseconds(50000), nullptr, this );
|
||||
return;
|
||||
}
|
||||
} catch (const Poco::Exception &E) {
|
||||
@@ -920,7 +921,7 @@ void RESTAPI_device_commandHandler::Rtty(Poco::Net::HTTPServerRequest &Request,
|
||||
std::stringstream ParamStream;
|
||||
Params.stringify(ParamStream);
|
||||
Cmd.Details = ParamStream.str();
|
||||
WaitForCommand(Cmd, Params, Request, Response, std::chrono::milliseconds(15000), &ReturnedObject);
|
||||
RESTAPI_RPC::WaitForCommand(Cmd, Params, Request, Response, std::chrono::milliseconds(15000), &ReturnedObject, this);
|
||||
return;
|
||||
} else {
|
||||
NotFound(Request, Response);
|
||||
|
||||
Reference in New Issue
Block a user