1 #include "LaunchAppCommand.h"
7 #include <app_control.h>
10 LaunchAppCommand::LaunchAppCommand(const ::aurum::ReqLaunchApp* request,
11 ::aurum::RspLaunchApp* response)
12 : mRequest{request}, mResponse{response}
16 ::grpc::Status LaunchAppCommand::execute()
18 LOG_SCOPE_F(INFO, "LaunchApp --------------- ");
20 app_control_h appControl;
21 std::string packageName = mRequest->packagename();
24 if (packageName.empty()) return grpc::Status::OK;
26 ret = app_control_create(&appControl);
28 LOG_SCOPE_F(INFO, "Launch Failed(1/3) Err Code : %ull", ret);
29 mResponse->set_status(::aurum::RspStatus::ERROR);
30 return grpc::Status::OK;
33 ret = app_control_set_app_id(appControl, packageName.c_str());
35 LOG_SCOPE_F(INFO, "Launch Failed(2/3) Err Code : %ull", ret);
36 mResponse->set_status(::aurum::RspStatus::ERROR);
37 app_control_destroy(appControl);
38 return grpc::Status::OK;
41 ret = app_control_send_launch_request(appControl, NULL, NULL);
43 LOG_SCOPE_F(INFO, "Launch Failed(3/3) Err Code : %ull", ret);
44 mResponse->set_status(::aurum::RspStatus::ERROR);
45 app_control_destroy(appControl);
46 return grpc::Status::OK;
49 app_control_destroy(appControl);
51 return grpc::Status::OK;
53 ::grpc::Status LaunchAppCommand::executePost()
55 LOG_SCOPE_F(INFO, "LaunchAppCommand::executePost");
56 std::this_thread::sleep_for(std::chrono::milliseconds{2500});
57 return grpc::Status::OK;