Add appfw client class
authorKazumasa Mitsunari <knimitz@witz-inc.co.jp>
Mon, 16 Jul 2018 06:31:16 +0000 (15:31 +0900)
committerKazumasa Mitsunari <knimitz@witz-inc.co.jp>
Mon, 16 Jul 2018 06:31:16 +0000 (15:31 +0900)
Change-Id: I7ccb86458fe384fa68c35095557610498bd7cc85
Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
deploy.sh [new file with mode: 0755]
src/CMakeLists.txt
src/appfw_client.cpp [new file with mode: 0644]
src/appfw_client.hpp [new file with mode: 0644]
src/window_manager.cpp
src/window_manager.hpp

diff --git a/deploy.sh b/deploy.sh
new file mode 100755 (executable)
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
index 6155ef3..8bcc3ff 100644 (file)
@@ -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 (file)
index 0000000..89b7870
--- /dev/null
@@ -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 <string>
+#include "appfw_client.hpp"
+extern "C"
+{
+#include <afb/afb-binding.h>
+#include <systemd/sd-bus.h>
+}
+
+
+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 (file)
index 0000000..c8c25a2
--- /dev/null
@@ -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 <string>
+#include "wm_error.hpp"
+extern "C"
+{
+#include <systemd/sd-bus.h>
+}
+
+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
index 8b2cfbc..043e051 100644 (file)
@@ -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
index 7fbd43e..1ab711a 100644 (file)
@@ -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<std::string, std::string> rolenew2old;
 
     PMWrapper pmw;
+    AppFWClient appfw_clt;
 
     static const char* kDefaultOldRoleDb;
 };