Migration to binding V3
[apps/agl-service-homescreen.git] / src / homescreen.cpp
index a3039c5..fdc9e85 100644 (file)
@@ -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,