aboutsummaryrefslogtreecommitdiffstats
path: root/src/homescreen.cpp
diff options
context:
space:
mode:
authorwang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>2018-10-22 16:09:07 +0800
committerwang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>2018-10-23 10:18:57 +0800
commit789ecb879cc529400b290eb9750fd1f9298fc690 (patch)
tree712c3ae682f1f9e2522dc312fa7fb437fdaa1c74 /src/homescreen.cpp
parentea459cc8988c3e664c3f9d56d3a9929775d8b57b (diff)
Migration to binding V3
migration homescreen-service from v2 to v3 Change-Id: I5e6d42c3dff528e46d0ca407e09eb1d05bacea80 Signed-off-by: wang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>
Diffstat (limited to 'src/homescreen.cpp')
-rw-r--r--src/homescreen.cpp41
1 files changed, 21 insertions, 20 deletions
diff --git a/src/homescreen.cpp b/src/homescreen.cpp
index a3039c5..fdc9e85 100644
--- a/src/homescreen.cpp
+++ b/src/homescreen.cpp
@@ -36,7 +36,7 @@ static HS_ClientManager* g_client_manager = HS_ClientManager::instance();
********** Method of HomeScreen Service (API) **********
*/
-static void pingSample(struct afb_req request)
+static void pingSample(afb_req_t request)
{
static int pingcount = 0;
afb_req_success_f(request, json_object_new_int(pingcount), "Ping count = %d", pingcount);
@@ -56,7 +56,7 @@ static void pingSample(struct afb_req request)
* None
*
*/
-static void tap_shortcut (struct afb_req request)
+static void tap_shortcut (afb_req_t request)
{
HMI_NOTICE("homescreen-service","called.");
@@ -100,7 +100,7 @@ static void tap_shortcut (struct afb_req request)
* None
*
*/
-static void on_screen_message (struct afb_req request)
+static void on_screen_message (afb_req_t request)
{
HMI_NOTICE("homescreen-service","called.");
@@ -138,7 +138,7 @@ static void on_screen_message (struct afb_req request)
* None
*
*/
-static void on_screen_reply (struct afb_req request)
+static void on_screen_reply (afb_req_t request)
{
HMI_NOTICE("homescreen-service","called.");
@@ -175,7 +175,7 @@ static void on_screen_reply (struct afb_req request)
* None
*
*/
-static void subscribe(struct afb_req request)
+static void subscribe(afb_req_t request)
{
const char *value = afb_req_value(request, "event");
HMI_NOTICE("homescreen-service","value is %s", value);
@@ -209,7 +209,7 @@ static void subscribe(struct afb_req request)
* None
*
*/
-static void unsubscribe(struct afb_req request)
+static void unsubscribe(afb_req_t request)
{
const char *value = afb_req_value(request, "event");
HMI_NOTICE("homescreen-service","value is %s", value);
@@ -243,14 +243,14 @@ 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 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 },
+static const afb_verb_t verbs[]= {
+ /* VERB'S NAME FUNCTION TO CALL */
+ { .verb="ping", .callback=pingSample },
+ { .verb="tap_shortcut", .callback=tap_shortcut },
+ { .verb="on_screen_message", .callback=on_screen_message },
+ { .verb="on_screen_reply", .callback=on_screen_reply },
+ { .verb="subscribe", .callback=subscribe },
+ { .verb="unsubscribe", .callback=unsubscribe },
{NULL } /* marker for end of the array */
};
@@ -258,13 +258,13 @@ static const struct afb_verb_v2 verbs[]= {
* homescreen binding preinit function
*
* #### Parameters
- * - null
+ * - api : the api serving the request
*
* #### Return
* None
*
*/
-static int preinit()
+static int preinit(afb_api_t api)
{
HMI_NOTICE("homescreen-service","binding preinit (was register)");
return 0;
@@ -274,13 +274,13 @@ static int preinit()
* homescreen binding init function
*
* #### Parameters
- * - null
+ * - api : the api serving the request
*
* #### Return
* None
*
*/
-static int init()
+static int init(afb_api_t api)
{
HMI_NOTICE("homescreen-service","binding init");
@@ -293,6 +293,7 @@ static int init()
* homescreen binding event function
*
* #### Parameters
+ * - api : the api serving the request
* - event : event name
* - object : event json object
*
@@ -300,12 +301,12 @@ static int init()
* None
*
*/
-static void onevent(const char *event, struct json_object *object)
+static void onevent(afb_api_t api, const char *event, struct json_object *object)
{
HMI_NOTICE("homescreen-service","on_event %s", event);
}
-const struct afb_binding_v2 afbBindingV2 = {
+const afb_binding_t afbBindingExport = {
.api = "homescreen",
.specification = NULL,
.info = NULL,