From 60acbba22c746f4a616d411ff39392912e956a01 Mon Sep 17 00:00:00 2001 From: Kazumasa Mitsunari Date: Mon, 16 Jul 2018 15:31:16 +0900 Subject: Add appfw client class Change-Id: I7ccb86458fe384fa68c35095557610498bd7cc85 Signed-off-by: Kazumasa Mitsunari --- deploy.sh | 19 ++++++++++++++ src/CMakeLists.txt | 1 + src/appfw_client.cpp | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/appfw_client.hpp | 43 +++++++++++++++++++++++++++++++ src/window_manager.cpp | 8 ++++++ src/window_manager.hpp | 2 ++ 6 files changed, 143 insertions(+) create mode 100755 deploy.sh create mode 100644 src/appfw_client.cpp create mode 100644 src/appfw_client.hpp diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 0000000..9c18e16 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,19 @@ +#!/bin/bash +cd build +source /opt/poky-agl/5.90.0+snapshot/environment-setup-aarch64-agl-linux +make package +echo build finish +scp package/windowmanager-service-2017.wgt root@192.168.200.17:~ +ssh root@192.168.200.17 sync +ssh root@192.168.200.17 afm-util remove windowmanager-service-2017@0.1 +ssh root@192.168.200.17 sync +ssh root@192.168.200.17 afm-util install windowmanager-service-2017.wgt +ssh root@192.168.200.17 sync +#scp ../src/layout_manager/db/layout_als.db root@192.168.200.17:/var/local/lib/afm/applications/windowmanager-service-2017/0.1/etc/layers.json +#scp ../src/policy_manager/db/role.db root@192.168.200.17:/var/local/lib/afm/applications/windowmanager-service-2017/0.1/etc/layers.json +#scp ../src/db/app.db root@192.168.200.17:/var/local/lib/afm/applications/windowmanager-service-2017/0.1/etc/layers.json +#ssh root@192.168.200.17 sync +#ssh root@192.168.200.17 cp /home/root/afm-service-soundmanager-service-2017@0.1.service //var/local/lib/systemd/user/ +#ssh root@192.168.200.17 sync +#ssh root@192.168.200.17 systemctl --user restart afm-service-soundmanager-service-2017@0.1 +#ssh root@192.168.200.17 /home/root/cat-service.sh diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6155ef3..8bcc3ff 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -39,6 +39,7 @@ add_library(${TARGETS_WM} MODULE wm_config.cpp applist.cpp request.cpp + appfw_client.cpp pm_wrapper.cpp) target_include_directories(${TARGETS_WM} diff --git a/src/appfw_client.cpp b/src/appfw_client.cpp new file mode 100644 index 0000000..89b7870 --- /dev/null +++ b/src/appfw_client.cpp @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2017 TOYOTA MOTOR CORPORATION + * + * 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 +#include "appfw_client.hpp" +extern "C" +{ +#include +#include +} + + +using std::string; +const string default_address = "org.AGL.afm.user"; + +namespace wm { + +AppFWClient::AppFWClient() +{} + +AppFWClient::~AppFWClient() +{ + sd_bus_unref(this->appfw_dbus); +} + +WMError AppFWClient::connect(const string &address) +{ + WMError ret = FAIL; + if(address.size() == 0) + { + return FAIL; + } + + this->appfw_dbus = afb_daemon_get_system_bus(); + int rc = sd_bus_set_address(this->appfw_dbus, address.c_str()); + if(rc < 0) + { + ret = FAIL; + } + else + { + ret = SUCCESS; + } + return ret; +} + +string AppFWClient::queryAppID(unsigned pid) +{ + string ret = ""; + if(this->appfw_dbus == nullptr) + return ret; + + + return ret; +} + +} // namespace wm \ No newline at end of file diff --git a/src/appfw_client.hpp b/src/appfw_client.hpp new file mode 100644 index 0000000..c8c25a2 --- /dev/null +++ b/src/appfw_client.hpp @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2017 TOYOTA MOTOR CORPORATION + * + * 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. + */ + +#ifndef APPFW_CLIENT_HPP +#define APPFW_CLIENT_HPP +#include +#include "wm_error.hpp" +extern "C" +{ +#include +} + +namespace wm{ + +class AppFWClient +{ + public: + AppFWClient(); + virtual ~AppFWClient(); + AppFWClient(const AppFWClient &obj) = default; + WMError connect(const std::string &address); + + std::string queryAppID(unsigned pid); + + private: + sd_bus* appfw_dbus; +}; + +} // namespace wm +#endif // APPFW_CLIENT_HPP \ No newline at end of file diff --git a/src/window_manager.cpp b/src/window_manager.cpp index 8b2cfbc..043e051 100644 --- a/src/window_manager.cpp +++ b/src/window_manager.cpp @@ -183,6 +183,9 @@ int WindowManager::init() // Register callback to PolicyManager this->pmw.registerCallback(onStateTransitioned, onError); + // Initialize appfw client + this->appfw_clt.connect("org.AGL.afm.user"); + // Make afb event for (int i = Event_Val_Min; i <= Event_Val_Max; i++) { @@ -1645,4 +1648,9 @@ void controller_hooks::surface_destination_rectangle(uint32_t /*surface_id*/, uint32_t /*w*/, uint32_t /*h*/) {} +void controller_hooks::surface_properties(uint32_t surface_id, uint32_t pid) +{ + this->app->surface_properties(surface_id, pid); +} + } // namespace wm diff --git a/src/window_manager.hpp b/src/window_manager.hpp index 7fbd43e..1ab711a 100644 --- a/src/window_manager.hpp +++ b/src/window_manager.hpp @@ -29,6 +29,7 @@ #include "hmi-debug.h" #include "request.hpp" #include "wm_error.hpp" +#include "appfw_client.hpp" struct json_object; @@ -282,6 +283,7 @@ class WindowManager std::unordered_map rolenew2old; PMWrapper pmw; + AppFWClient appfw_clt; static const char* kDefaultOldRoleDb; }; -- cgit 1.2.3-korg