1 #include "SendKeyCommand.h"
6 SendKeyCommand::SendKeyCommand(const ::aurum::ReqKey* request,
7 ::aurum::RspKey* response)
8 : mRequest{request}, mResponse{response}
12 ::grpc::Status SendKeyCommand::execute()
14 LOG_SCOPE_F(INFO, "SendKey --------------- ");
15 std::shared_ptr<UiDevice> mDevice = UiDevice::getInstance();
16 ::aurum::ReqKey_KeyType type = mRequest->type();
17 ::aurum::ReqKey_KeyActionType action_type = mRequest->actiontype();
18 KeyRequestType actionType = static_cast<KeyRequestType>(action_type);
20 if (type == ::aurum::ReqKey_KeyType::ReqKey_KeyType_BACK)
21 mDevice->pressBack(actionType);
22 else if (type == ::aurum::ReqKey_KeyType::ReqKey_KeyType_HOME)
23 mDevice->pressHome(actionType);
24 else if (type == ::aurum::ReqKey_KeyType::ReqKey_KeyType_MENU)
25 mDevice->pressMenu(actionType);
26 else if (type == ::aurum::ReqKey_KeyType::ReqKey_KeyType_VOLUP)
27 mDevice->pressVolUp(actionType);
28 else if (type == ::aurum::ReqKey_KeyType::ReqKey_KeyType_VOLDOWN)
29 mDevice->pressVolDown(actionType);
30 else if (type == ::aurum::ReqKey_KeyType::ReqKey_KeyType_POWER)
31 mDevice->pressPower(actionType);
32 else if (type == ::aurum::ReqKey_KeyType::ReqKey_KeyType_WHEELUP)
33 mDevice->wheelUp(1, 167);
34 else if (type == ::aurum::ReqKey_KeyType::ReqKey_KeyType_WHEELDOWN)
35 mDevice->wheelDown(1, 167);
36 else if (type == ::aurum::ReqKey_KeyType::ReqKey_KeyType_XF86) {
37 mDevice->pressKeyCode(mRequest->xf86keycode(), actionType);
39 return grpc::Status::OK;