::grpc::Status dumpObjectTree(::grpc::ServerContext *context,
const ::aurum::ReqDumpObjectTree *request,
::aurum::RspDumpObjectTree *response) override;
+ ::grpc::Status getScreenSize(::grpc::ServerContext *context,
+ const ::aurum::ReqGetScreenSize *request,
+ ::aurum::RspGetScreenSize *response) override;
};
#endif
#include "Commands/TakeScreenshotCommand.h"
#include "Commands/DumpObjectTreeCommand.h"
+#include "Commands/GetScreenSizeCommand.h"
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <gio/gio.h>
+#include <grpcpp/grpcpp.h>
+#include "Commands/Command.h"
+#include "ObjectMapper.h"
+#include <aurum.grpc.pb.h>
+#include "config.h"
+
+class GetScreenSizeCommand : public Command {
+private:
+ const ::aurum::ReqGetScreenSize *mRequest;
+ ::aurum::RspGetScreenSize *mResponse;
+
+public:
+ GetScreenSizeCommand(const ::aurum::ReqGetScreenSize *request,
+ ::aurum::RspGetScreenSize *response);
+ ::grpc::Status execute() override;
+};
files('src/Commands/PreCommand.cc'),
files('src/Commands/PostCommand.cc'),
files('src/Commands/DumpObjectTreeCommand.cc'),
+ files('src/Commands/GetScreenSizeCommand.cc'),
]
bootstrap_svr_dep = [
std::unique_ptr<DumpObjectTreeCommand> cmd = std::make_unique<DumpObjectTreeCommand>(request, response);
return execute(cmd.get(), true);
}
+
+::grpc::Status aurumServiceImpl::getScreenSize(::grpc::ServerContext *context,
+ const ::aurum::ReqGetScreenSize *request,
+ ::aurum::RspGetScreenSize *response)
+{
+ std::unique_ptr<GetScreenSizeCommand> cmd = std::make_unique<GetScreenSizeCommand>(request, response);
+ return execute(cmd.get(), true);
+}
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "bootstrap.h"
+#include "GetScreenSizeCommand.h"
+#include "UiDevice.h"
+
+GetScreenSizeCommand::GetScreenSizeCommand(const ::aurum::ReqGetScreenSize *request,
+ ::aurum::RspGetScreenSize *response)
+ : mRequest{request}, mResponse{response}
+{
+}
+
+::grpc::Status GetScreenSizeCommand::execute()
+{
+ LOGI("GetScreenSize --------------- ");
+
+ ::aurum::Rect *rect = mResponse->mutable_size();
+ std::shared_ptr<UiDevice> mDevice = UiDevice::getInstance();
+
+ rect->set_x(0);
+ rect->set_y(0);
+ rect->set_width(mDevice->getScreenSize().width);
+ rect->set_height(mDevice->getScreenSize().height);
+
+ return grpc::Status::OK;
+}
rpc sendKey(ReqKey) returns (RspKey) {}
rpc takeScreenshot(ReqTakeScreenshot) returns (stream RspTakeScreenshot) {}
rpc dumpObjectTree(ReqDumpObjectTree) returns (RspDumpObjectTree) {}
+ rpc getScreenSize(ReqGetScreenSize) returns (RspGetScreenSize) {}
}
// ------------------------------------ //
RspStatus status = 1;
repeated Element roots = 2;
}
+
+message ReqGetScreenSize {
+}
+
+message RspGetScreenSize {
+ RspStatus status = 1;
+ Rect size = 2;
+}