Update lastest code from agl-service-homescreen-2017
[apps/agl-service-homescreen.git] / src / homescreen.cpp
similarity index 88%
rename from src/homescreen.c
rename to src/homescreen.cpp
index f1a8fcd..85ea99f 100644 (file)
  * 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,