1 #include "AurumServiceImpl.h"
3 #include <AccessibleWatcher.h>
4 #include "Commands/Commands.h"
5 #include "Commands/PostCommand.h"
6 #include "Commands/PreCommand.h"
12 using namespace aurum;
14 aurumServiceImpl::aurumServiceImpl()
16 AccessibleWatcher::getInstance();
19 ::grpc::Status aurumServiceImpl::execute(Command* cmd)
21 std::unique_ptr<PreCommand> proxyPreCmd = std::make_unique<PreCommand>(cmd);
22 std::unique_ptr<PostCommand> proxyPostCmd = std::make_unique<PostCommand>(proxyPreCmd.get());
23 ::grpc::Status rst = proxyPostCmd->execute();
27 aurumServiceImpl::~aurumServiceImpl() {}
28 ::grpc::Status aurumServiceImpl::aurumServiceImpl::sync(
29 ::grpc::ServerContext* context, const ::aurum::ReqEmpty* request,
30 ::aurum::RspEmpty* response)
32 std::unique_ptr<SyncCommand> cmd = std::make_unique<SyncCommand>(request, response);
33 return execute(cmd.get());
35 ::grpc::Status aurumServiceImpl::aurumServiceImpl::killServer(
36 ::grpc::ServerContext* context, const ::aurum::ReqEmpty* request,
37 ::aurum::RspEmpty* response)
39 std::unique_ptr<KillServerCommand> cmd = std::make_unique<KillServerCommand>(request, response);
40 return execute(cmd.get());
42 ::grpc::Status aurumServiceImpl::aurumServiceImpl::findElement(
43 ::grpc::ServerContext* context, const ::aurum::ReqFindElement* request,
44 ::aurum::RspFindElement* response)
46 std::unique_ptr<FindElementCommand> cmd = std::make_unique<FindElementCommand>(request, response);
47 return execute(cmd.get());
50 ::grpc::Status aurumServiceImpl::aurumServiceImpl::click(
51 ::grpc::ServerContext* context, const ::aurum::ReqClick* request,
52 ::aurum::RspClick* response)
54 std::unique_ptr<ClickCommand> cmd = ClickCommand::createCommand(request, response);
55 return execute(cmd.get());
57 ::grpc::Status aurumServiceImpl::getValue(::grpc::ServerContext* context,
58 const ::aurum::ReqGetValue* request,
59 ::aurum::RspGetValue* response)
61 std::unique_ptr<GetValueCommand> cmd = std::make_unique<GetValueCommand>(request, response);
62 return execute(cmd.get());
64 ::grpc::Status aurumServiceImpl::setValue(::grpc::ServerContext* context,
65 const ::aurum::ReqSetValue* request,
66 ::aurum::RspSetValue* response)
68 std::unique_ptr<SetValueCommand> cmd = std::make_unique<SetValueCommand>(request, response);
69 return execute(cmd.get());
71 ::grpc::Status aurumServiceImpl::getAttribute(
72 ::grpc::ServerContext* context, const ::aurum::ReqGetAttribute* request,
73 ::aurum::RspGetAttribute* response)
75 std::unique_ptr<GetAttributeCommand> cmd = GetAttributeCommand::createCommand(request, response);
76 return execute(cmd.get());
78 ::grpc::Status aurumServiceImpl::getSize(::grpc::ServerContext* context,
79 const ::aurum::ReqGetSize* request,
80 ::aurum::RspGetSize* response)
82 std::unique_ptr<GetSizeCommand> cmd = std::make_unique<GetSizeCommand>(request, response);
83 return execute(cmd.get());
85 ::grpc::Status aurumServiceImpl::clear(::grpc::ServerContext* context,
86 const ::aurum::ReqClear* request,
87 ::aurum::RspClear* response)
89 std::unique_ptr<ClearCommand> cmd = std::make_unique<ClearCommand>(request, response);
90 return execute(cmd.get());
92 ::grpc::Status aurumServiceImpl::installApp(
93 ::grpc::ServerContext* context,
94 ::grpc::ServerReader< ::aurum::ReqInstallApp>* request,
95 ::aurum::RspInstallApp* response)
97 std::unique_ptr<InstallAppCommand> cmd = std::make_unique<InstallAppCommand>(request, response);
98 return execute(cmd.get());
100 ::grpc::Status aurumServiceImpl::removeApp(::grpc::ServerContext* context,
101 const ::aurum::ReqRemoveApp* request,
102 ::aurum::RspRemoveApp* response)
104 std::unique_ptr<RemoveAppCommand> cmd = std::make_unique<RemoveAppCommand>(request, response);
105 return execute(cmd.get());
107 ::grpc::Status aurumServiceImpl::getAppInfo(
108 ::grpc::ServerContext* context, const ::aurum::ReqGetAppInfo* request,
109 ::aurum::RspGetAppInfo* response)
111 std::unique_ptr<GetAppInfoCommand> cmd = std::make_unique<GetAppInfoCommand>(request, response);
112 return execute(cmd.get());
114 ::grpc::Status aurumServiceImpl::launchApp(::grpc::ServerContext* context,
115 const ::aurum::ReqLaunchApp* request,
116 ::aurum::RspLaunchApp* response)
118 std::unique_ptr<LaunchAppCommand> cmd = std::make_unique<LaunchAppCommand>(request, response);
119 return execute(cmd.get());
121 ::grpc::Status aurumServiceImpl::closeApp(::grpc::ServerContext* context,
122 const ::aurum::ReqCloseApp* request,
123 ::aurum::RspCloseApp* response)
125 std::unique_ptr<CloseAppCommand> cmd = std::make_unique<CloseAppCommand>(request, response);
126 return execute(cmd.get());
128 ::grpc::Status aurumServiceImpl::touchDown(::grpc::ServerContext* context,
129 const ::aurum::ReqTouchDown* request,
130 ::aurum::RspTouchDown* response)
132 std::unique_ptr<TouchDownCommand> cmd = std::make_unique<TouchDownCommand>(request, response);
133 return execute(cmd.get());
135 ::grpc::Status aurumServiceImpl::touchUp(::grpc::ServerContext* context,
136 const ::aurum::ReqTouchUp* request,
137 ::aurum::RspTouchUp* response)
139 std::unique_ptr<TouchUpCommand> cmd = std::make_unique<TouchUpCommand>(request, response);
140 return execute(cmd.get());
142 ::grpc::Status aurumServiceImpl::touchMove(::grpc::ServerContext* context,
143 const ::aurum::ReqTouchMove* request,
144 ::aurum::RspTouchMove* response)
146 std::unique_ptr<TouchMoveCommand> cmd = std::make_unique<TouchMoveCommand>(request, response);
147 return execute(cmd.get());
149 ::grpc::Status aurumServiceImpl::longClick(::grpc::ServerContext* context,
150 const ::aurum::ReqClick* request,
151 ::aurum::RspClick* response)
153 std::unique_ptr<LongClickCommand> cmd = std::make_unique<LongClickCommand>(request, response);
154 return execute(cmd.get());
156 ::grpc::Status aurumServiceImpl::flick(::grpc::ServerContext* context,
157 const ::aurum::ReqFlick* request,
158 ::aurum::RspFlick* response)
160 std::unique_ptr<FlickCommand> cmd = std::make_unique<FlickCommand>(request, response);
161 return execute(cmd.get());
163 ::grpc::Status aurumServiceImpl::getDeviceTime(
164 ::grpc::ServerContext* context, const ::aurum::ReqGetDeviceTime* request,
165 ::aurum::RspGetDeviceTime* response)
167 std::unique_ptr<GetDeviceTimeCommand> cmd = std::make_unique<GetDeviceTimeCommand>(request, response);
168 return execute(cmd.get());
170 ::grpc::Status aurumServiceImpl::getLocation(
171 ::grpc::ServerContext* context, const ::aurum::ReqGetLocation* request,
172 ::aurum::RspGetLocation* response)
174 std::unique_ptr<GetLocationCommand> cmd = std::make_unique<GetLocationCommand>(request, response);
175 return execute(cmd.get());
177 ::grpc::Status aurumServiceImpl::sendKey(::grpc::ServerContext* context,
178 const ::aurum::ReqKey* request,
179 ::aurum::RspKey* response)
181 std::unique_ptr<SendKeyCommand> cmd = std::make_unique<SendKeyCommand>(request, response);
182 return execute(cmd.get());