aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-05-14 10:07:58 +0900
committerKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-05-14 10:48:31 +0900
commitd31270592190870d13c98460d351697350c67cc2 (patch)
tree992e6dfbf349963311a0be67d0d848ca372621f8
parente21c981f0ba536c5973bb91e9bf72c6b9d4bf9f2 (diff)
[Local]:1st step for blocking sequence
* add new class to allocate window resource * add new class for list to hold clients information * change API of request surface Change-Id: Ic39fa8908163d49b429125639189dd89812f94e9 Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
-rw-r--r--src/CMakeLists.txt4
-rw-r--r--src/allocate_queue.cpp26
-rw-r--r--src/allocate_queue.hpp45
-rw-r--r--src/app.cpp9
-rw-r--r--src/app.hpp2
-rw-r--r--src/main.cpp2
-rw-r--r--src/windowmanager-client.cpp31
-rw-r--r--src/windowmanager-client.hpp47
8 files changed, 162 insertions, 4 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index cc3efc3..248a058 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -43,7 +43,9 @@ add_library(${TARGETS_WM} MODULE
controller_hooks.hpp
config.cpp
config.hpp
- policy.hpp)
+ policy.hpp
+ windowmanager-client.cpp
+ allocate_queue.cpp)
target_include_directories(${TARGETS_WM}
PRIVATE
diff --git a/src/allocate_queue.cpp b/src/allocate_queue.cpp
new file mode 100644
index 0000000..029c516
--- /dev/null
+++ b/src/allocate_queue.cpp
@@ -0,0 +1,26 @@
+/*
+ * 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 "allocate_queue.hpp"
+
+namespace wm {
+
+AllocateRequestList::AllocateRequestList(){}
+AllocateRequestList::~AllocateRequestList(){}
+void AllocateRequestList::addClient(WMClient* client){
+
+}
+} \ No newline at end of file
diff --git a/src/allocate_queue.hpp b/src/allocate_queue.hpp
new file mode 100644
index 0000000..2a977b1
--- /dev/null
+++ b/src/allocate_queue.hpp
@@ -0,0 +1,45 @@
+/*
+ * 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 ALLOCATE_LIST_HPP
+#define ALLOCATE_LIST_HPP
+#include <vector>
+#include "windowmanager-client.hpp"
+
+namespace wm {
+
+class AllocateRequestList {
+public:
+ AllocateRequestList();
+ ~AllocateRequestList();
+ AllocateRequestList(const AllocateRequestList &obj) = delete;
+
+ void addClient(WMClient* client);
+
+ /* bool queue(int request_num);
+ bool pushTop(int request_num);
+ bool dequeue();
+ void deleteAllElement();
+ void removeElement(int request_num);
+ bool hasElement(int request_num); */
+
+private:
+ std::vector<WMClient *> requestQueue;
+
+};
+
+}
+#endif // ALLOCATE_LIST_HPP \ No newline at end of file
diff --git a/src/app.cpp b/src/app.cpp
index 937da6a..53a645e 100644
--- a/src/app.cpp
+++ b/src/app.cpp
@@ -35,6 +35,8 @@
#include <regex>
#include <thread>
+#include "windowmanager-client.hpp"
+#include "allocate_queue.hpp"
namespace wm {
@@ -58,6 +60,7 @@ const char kKeyHeightPixel[] = "height_pixel";
const char kKeyWidthMm[] = "width_mm";
const char kKeyHeightMm[] = "height_mm";
+static AllocateRequestList allocate_list;
namespace {
@@ -705,7 +708,7 @@ void App::emit_invisible(char const *label) {
void App::emit_visible(char const *label) { return emit_visible(label, true); }
-result<int> App::api_request_surface(char const *drawing_name) {
+result<int> App::api_request_surface(char const *drawing_name, char const * appid, int flag) {
auto lid = this->layers.get_layer_id(std::string(drawing_name));
if (!lid) {
/**
@@ -731,6 +734,10 @@ result<int> App::api_request_surface(char const *drawing_name) {
HMI_DEBUG("wm", "Set main_surface id to %u", id);
}
+ // add client into the db
+ WMClient* client = new WMClient(appid, *lid, id, drawing_name); // role is drawing_name for now
+ allocate_list.addClient(client);
+
return Ok<int>(id);
}
diff --git a/src/app.hpp b/src/app.hpp
index d1393c0..5cfd78f 100644
--- a/src/app.hpp
+++ b/src/app.hpp
@@ -201,7 +201,7 @@ struct App {
void set_pending_events();
- result<int> api_request_surface(char const *drawing_name);
+ result<int> api_request_surface(char const *drawing_name, char const *appid, int flag);
char const *api_request_surface(char const *drawing_name, char const *ivi_id);
void api_activate_surface(char const *drawing_name, char const *drawing_area, const reply_func &reply);
void api_deactivate_surface(char const *drawing_name, const reply_func &reply);
diff --git a/src/main.cpp b/src/main.cpp
index 3828afd..bd591a4 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -209,7 +209,7 @@ void windowmanager_requestsurface(afb_req req) noexcept {
}
}
- auto ret = g_afb_instance->app.api_request_surface(a_drawing_name);
+ auto ret = g_afb_instance->app.api_request_surface(a_drawing_name, afb_req_get_application_id(req), 0);
if(isFirstReq){
wmClientCtxt* ctxt = new wmClientCtxt(a_drawing_name);
diff --git a/src/windowmanager-client.cpp b/src/windowmanager-client.cpp
new file mode 100644
index 0000000..ee6164a
--- /dev/null
+++ b/src/windowmanager-client.cpp
@@ -0,0 +1,31 @@
+/*
+ * 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 "windowmanager-client.hpp"
+
+namespace wm {
+
+WMClient::WMClient(){
+
+}
+
+WMClient::WMClient(const char* appid, unsigned layerID, unsigned surfaceID, const char* role)
+ : request_number(0)
+{
+
+}
+
+} \ No newline at end of file
diff --git a/src/windowmanager-client.hpp b/src/windowmanager-client.hpp
new file mode 100644
index 0000000..6aec0f3
--- /dev/null
+++ b/src/windowmanager-client.hpp
@@ -0,0 +1,47 @@
+/*
+ * 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 WINDOWMANAGER_CLIENT_HPP
+#define WINDOWMANAGER_CLIENT_HPP
+
+#include <vector>
+#include <string>
+#include <unordered_map>
+
+extern "C" {
+#include <afb/afb-binding.h>
+}
+
+namespace wm {
+
+class WMClient {
+public:
+ WMClient();
+ WMClient(const char* appid, unsigned layerID, unsigned surfaceID, const char* role);
+ virtual ~WMClient();
+ //WMClient::WMClient(const WMClient &obj);
+
+private:
+ unsigned layer;
+ std::vector<unsigned> surfaces;
+ std::string appid;
+ std::vector<std::string> roles;
+ std::unordered_map<std::string, struct afb_event> event_list;
+ unsigned request_number;
+};
+}
+
+#endif \ No newline at end of file