aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorzheng_wenlong <wenlong_zheng@nexty-ele.com>2018-09-03 10:39:15 +0900
committerZheng Wenlong <wenlong_zheng@nexty-ele.com>2018-09-03 07:38:43 +0000
commitbb38a76d1b00e93187967aa2880e79e671f02eba (patch)
treedcd608d0634925837030409fb300e036c18ea34c /src
parent67962d9837ea37b10c2cf906cbde575cce18ab4b (diff)
Update lastest code from agl-service-homescreen-2017flounder_5.99.6flounder/5.99.65.99.6
Update the lastest code from agl-service-homescreen-2017. To impove homescreen-service's extensibility. "Change homescreen-service from c project to c++ project" Relative Commit: https://gerrit.automotivelinux.org/gerrit/#/c/16351/ Change-Id: Id7e50fa61fdfcff30f69588aa1da4d93695edfc1 Signed-off-by: zheng_wenlong <wenlong_zheng@nexty-ele.com> Signed-off-by: wang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt4
-rw-r--r--src/hmi-debug.h7
-rw-r--r--src/homescreen.cpp (renamed from src/homescreen.c)28
-rw-r--r--src/hs-helper.cpp (renamed from src/hs-helper.c)16
-rw-r--r--src/hs-helper.h12
5 files changed, 33 insertions, 34 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 363cdae..dbd7fbe 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -23,8 +23,8 @@ 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.c
- hs-helper.c)
+ homescreen.cpp
+ hs-helper.cpp)
link_libraries(-Wl,--as-needed -Wl,--gc-sections -Wl,--no-undefined)
include_directories(${PROJECT_SOURCE_DIR}/include)
diff --git a/src/hmi-debug.h b/src/hmi-debug.h
index 2a744ba..3c71ff5 100644
--- a/src/hmi-debug.h
+++ b/src/hmi-debug.h
@@ -17,6 +17,10 @@
#ifndef __HMI_DEBUG_H__
#define __HMI_DEBUG_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <time.h>
#include <stdio.h>
#include <stdarg.h>
@@ -67,4 +71,7 @@ static void _HMI_LOG(enum LOG_LEVEL level, const char* file, const char* func, c
free(message);
}
+#ifdef __cplusplus
+}
+#endif
#endif //__HMI_DEBUG_H__ \ No newline at end of file
diff --git a/src/homescreen.c b/src/homescreen.cpp
index f1a8fcd..85ea99f 100644
--- a/src/homescreen.c
+++ b/src/homescreen.cpp
@@ -14,18 +14,9 @@
* limitations under the License.
*/
+#ifndef _GNU_SOURCE
#define _GNU_SOURCE
-#define AFB_BINDING_VERSION 2
-#include <afb/afb-binding.h>
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <unistd.h>
-#include <json-c/json.h>
-#include <glib.h>
-#include <pthread.h>
+#endif
#include "hs-helper.h"
#include "hmi-debug.h"
@@ -259,13 +250,13 @@ static void unsubscribe(struct afb_req request)
* array of the verbs exported to afb-daemon
*/
static const struct afb_verb_v2 verbs[]= {
- /* VERB'S NAME SESSION MANAGEMENT FUNCTION TO CALL */
- { .verb = "ping", .session = AFB_SESSION_NONE, .callback = pingSample, .auth = NULL },
- { .verb = "tap_shortcut", .session = AFB_SESSION_NONE, .callback = tap_shortcut, .auth = NULL },
- { .verb = "on_screen_message", .session = AFB_SESSION_NONE, .callback = on_screen_message, .auth = NULL },
- { .verb = "on_screen_reply", .session = AFB_SESSION_NONE, .callback = on_screen_reply, .auth = NULL },
- { .verb = "subscribe", .session = AFB_SESSION_NONE, .callback = subscribe, .auth = NULL },
- { .verb = "unsubscribe", .session = AFB_SESSION_NONE, .callback = unsubscribe, .auth = NULL },
+ /* VERB'S NAME FUNCTION TO CALL authorisation some info SESSION MANAGEMENT */
+ { .verb = "ping", .callback = pingSample, .auth = NULL, .info = NULL, .session = AFB_SESSION_NONE },
+ { .verb = "tap_shortcut", .callback = tap_shortcut, .auth = NULL, .info = NULL, .session = AFB_SESSION_NONE },
+ { .verb = "on_screen_message", .callback = on_screen_message, .auth = NULL, .info = NULL, .session = AFB_SESSION_NONE },
+ { .verb = "on_screen_reply", .callback = on_screen_reply, .auth = NULL, .info = NULL, .session = AFB_SESSION_NONE },
+ { .verb = "subscribe", .callback = subscribe, .auth = NULL, .info = NULL, .session = AFB_SESSION_NONE },
+ { .verb = "unsubscribe", .callback = unsubscribe, .auth = NULL, .info = NULL, .session = AFB_SESSION_NONE },
{NULL } /* marker for end of the array */
};
@@ -307,6 +298,7 @@ static void onevent(const char *event, struct json_object *object)
const struct afb_binding_v2 afbBindingV2 = {
.api = "homescreen",
.specification = NULL,
+ .info = NULL,
.verbs = verbs,
.preinit = preinit,
.init = init,
diff --git a/src/hs-helper.c b/src/hs-helper.cpp
index 3415510..452ae24 100644
--- a/src/hs-helper.c
+++ b/src/hs-helper.cpp
@@ -14,12 +14,18 @@
* limitations under the License.
*/
-#include "hs-helper.h"
-#include <stdlib.h>
#include <string.h>
-#include <limits.h>
-#include <json-c/json.h>
-#include <stdarg.h>
+#include <cstdarg>
+#include "hs-helper.h"
+
+
+const char* evlist[] = {
+ "tap_shortcut",
+ "on_screen_message",
+ "on_screen_reply",
+ "reserved"
+ };
+
REQ_ERROR get_value_uint16(const struct afb_req request, const char *source, uint16_t *out_id)
{
diff --git a/src/hs-helper.h b/src/hs-helper.h
index 5ce9eb5..fe74303 100644
--- a/src/hs-helper.h
+++ b/src/hs-helper.h
@@ -18,9 +18,8 @@
#define HOMESCREEN_HELPER_H
#define AFB_BINDING_VERSION 2
#include <afb/afb-binding.h>
-#include <stdint.h>
-#include <glib.h>
-#include <errno.h>
+#include <json-c/json.h>
+
typedef enum REQ_ERROR
{
@@ -30,12 +29,7 @@ typedef enum REQ_ERROR
OUT_RANGE
}REQ_ERROR;
-static const char* evlist[] = {
- "tap_shortcut",
- "on_screen_message",
- "on_screen_reply",
- "reserved"
- };
+extern const char* evlist[];
REQ_ERROR get_value_uint16(const struct afb_req request, const char *source, uint16_t *out_id);
REQ_ERROR get_value_int16(const struct afb_req request, const char *source, int16_t *out_id);