summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt67
-rw-r--r--src/export.map1
-rw-r--r--src/hs-clientmanager.cpp13
-rw-r--r--src/hs-clientmanager.h10
4 files changed, 31 insertions, 60 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 98dc27c..b415443 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,5 +1,6 @@
#
# Copyright (c) 2017 TOYOTA MOTOR CORPORATION
+# Copyright (C) 2020 Konsulko Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -14,58 +15,26 @@
# limitations under the License.
#
-cmake_minimum_required(VERSION 2.8)
+PROJECT_TARGET_ADD(homescreen-binding)
-set(TARGETS_HSBINDER homescreen-service)
+add_definitions(-DAFB_BINDING_VERSION=3)
-INCLUDE(FindThreads)
-FIND_PACKAGE(Threads)
-
-pkg_check_modules(hs_binding_depends afb-daemon glib-2.0 gio-2.0 gio-unix-2.0 json-c)
-set(binding_hs_sources
- homescreen.cpp
- hs-helper.cpp
- hs-clientmanager.cpp
- hs-client.cpp
- hs-proxy.cpp
- hs-appinfo.cpp)
-
-link_libraries(-Wl,--as-needed -Wl,--gc-sections -Wl,--no-undefined)
-include_directories(${PROJECT_SOURCE_DIR}/include)
-add_library(${TARGETS_HSBINDER} MODULE ${binding_hs_sources})
-
-target_compile_options(${TARGETS_HSBINDER} PRIVATE ${hs_binding_depends_CFLAGS})
-if(DEFINED DEBUGMODE)
- target_compile_options(${TARGETS_HSBINDER} PRIVATE -g -O0)
-else(DEFINED DEBUGMODE)
- target_compile_options(${TARGETS_HSBINDER} PRIVATE -g -O2)
-endif(DEFINED DEBUGMODE)
-
-target_include_directories(${TARGETS_HSBINDER} PRIVATE ${hs_binding_depends_INCLUDE_DIRS})
-target_link_libraries(${TARGETS_HSBINDER} ${CMAKE_THREAD_LIBS_INIT} ${link_libraries} ${hs_binding_depends_LIBRARIES})
+# Define project Targets
+add_library(${TARGET_NAME} MODULE
+ homescreen.cpp
+ hs-helper.cpp
+ hs-clientmanager.cpp
+ hs-client.cpp
+ hs-proxy.cpp
+ hs-appinfo.cpp)
# Binder exposes a unique public entry point
-
-set_target_properties(${TARGETS_HSBINDER} PROPERTIES
- PREFIX ""
- LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.map"
- )
-
-# installation directory
-#INSTALL(TARGETS ${TARGETS_HSBINDER}
-# LIBRARY DESTINATION ${binding_install_dir})
-
-if(NOT EXISTS ${PROJECT_BINARY_DIR}/package)
- add_custom_command(TARGET ${TARGETS_HSBINDER} POST_BUILD
- COMMAND cp -rf ${PROJECT_SOURCE_DIR}/package ${PROJECT_BINARY_DIR}
- )
-endif()
-
-add_custom_command(TARGET ${TARGETS_HSBINDER} POST_BUILD
- COMMAND mkdir -p ${PROJECT_BINARY_DIR}/package/root/lib
- COMMAND cp -rf ${PROJECT_BINARY_DIR}/src/${TARGETS_HSBINDER}.so ${PROJECT_BINARY_DIR}/package/root/lib
+SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES
+ LABELS "BINDING"
+ PREFIX ""
+ LINK_FLAGS ${BINDINGS_LINK_FLAG}
+ OUTPUT_NAME ${TARGET_NAME}
)
-add_custom_target(package DEPENDS ${PROJECT_BINARY_DIR}/package/root
- COMMAND wgtpkg-pack -f -o ${PROJECT_BINARY_DIR}/package/${TARGETS_HSBINDER}.wgt ${PROJECT_BINARY_DIR}/package/root
-)
+# Library dependencies (include updates automatically)
+TARGET_LINK_LIBRARIES(${TARGET_NAME} ${link_libraries})
diff --git a/src/export.map b/src/export.map
deleted file mode 100644
index f3961c0..0000000
--- a/src/export.map
+++ /dev/null
@@ -1 +0,0 @@
-{ global: afbBindingV*; local: *; }; \ No newline at end of file
diff --git a/src/hs-clientmanager.cpp b/src/hs-clientmanager.cpp
index 6e6397f..9b62808 100644
--- a/src/hs-clientmanager.cpp
+++ b/src/hs-clientmanager.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2018 TOYOTA MOTOR CORPORATION
+ * Copyright (C) 2020 Konsulko Group
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -71,6 +72,7 @@ HS_ClientManager* HS_ClientManager::instance(void)
*/
int HS_ClientManager::init(void)
{
+ return 0;
}
/**
@@ -89,7 +91,7 @@ HS_ClientCtxt* HS_ClientManager::createClientCtxt(afb_req_t req, std::string app
if (!ctxt)
{
AFB_INFO( "create new session for %s", appid.c_str());
- HS_ClientCtxt *ctxt = new HS_ClientCtxt(appid.c_str());
+ ctxt = new HS_ClientCtxt(appid);
afb_req_session_set_LOA(req, 1);
afb_req_context_set(req, ctxt, cbRemoveClientCtxt);
}
@@ -177,14 +179,15 @@ int HS_ClientManager::handleRequest(afb_req_t request, const char *verb, const c
}
}
else {
- auto ip = client_list.find(std::string(appid));
+ std::string id(appid);
+ auto ip = client_list.find(id);
if(ip != client_list.end()) {
ret = ip->second->handleRequest(request, verb);
}
else {
if(!strcasecmp(verb, "subscribe")) {
- appid2ctxt[appid] = createClientCtxt(request, appid);
- HS_Client* client = addClient(request, appid);
+ appid2ctxt[id] = createClientCtxt(request, id);
+ HS_Client* client = addClient(request, id);
ret = client->handleRequest(request, "subscribe");
}
else {
@@ -230,4 +233,4 @@ int HS_ClientManager::pushEvent(const char *event, struct json_object *param, st
}
return 0;
-} \ No newline at end of file
+}
diff --git a/src/hs-clientmanager.h b/src/hs-clientmanager.h
index efc36de..7ca6411 100644
--- a/src/hs-clientmanager.h
+++ b/src/hs-clientmanager.h
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2018 TOYOTA MOTOR CORPORATION
+ * Copyright (C) 2020 Konsulko Group
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,14 +25,13 @@
#include "hs-helper.h"
#include "hs-client.h"
-typedef struct HS_ClientCtxt
-{
+struct HS_ClientCtxt {
std::string id;
- HS_ClientCtxt(const char *appid)
+ HS_ClientCtxt(const std::string &appid)
{
id = appid;
}
-} HS_ClientCtxt;
+};
class HS_ClientManager {
@@ -61,4 +61,4 @@ private:
std::mutex mtx;
};
-#endif // HOMESCREEN_CLIENTMANAGER_H \ No newline at end of file
+#endif // HOMESCREEN_CLIENTMANAGER_H