Skip to content
Snippets Groups Projects
Commit a746f48a authored by Sebastian Alois Eckl's avatar Sebastian Alois Eckl
Browse files

added comments and changed name to navigatio-v2

parent c9990fde
No related branches found
No related tags found
No related merge requests found
...@@ -46,6 +46,9 @@ struct navigation_state *navigation_get_userdata(void) ...@@ -46,6 +46,9 @@ struct navigation_state *navigation_get_userdata(void)
return afb_api_get_userdata(g_api); return afb_api_get_userdata(g_api);
} }
/*
* get event for subscription depending on value
*/
static afb_event_t get_event_from_value(struct navigation_state *ns, static afb_event_t get_event_from_value(struct navigation_state *ns,
const char *value) const char *value)
{ {
...@@ -64,6 +67,9 @@ static afb_event_t get_event_from_value(struct navigation_state *ns, ...@@ -64,6 +67,9 @@ static afb_event_t get_event_from_value(struct navigation_state *ns,
return NULL; return NULL;
} }
/*
* get storage depending on Value
*/
static json_object **get_storage_from_value(struct navigation_state *ns, static json_object **get_storage_from_value(struct navigation_state *ns,
const char *value) const char *value)
{ {
...@@ -82,6 +88,9 @@ static json_object **get_storage_from_value(struct navigation_state *ns, ...@@ -82,6 +88,9 @@ static json_object **get_storage_from_value(struct navigation_state *ns,
return NULL; return NULL;
} }
/*
* subscribe/unsubscribe to an event depnding on it's name
*/
static void navigation_subscribe_unsubscribe(afb_req_t request, static void navigation_subscribe_unsubscribe(afb_req_t request,
gboolean unsub) gboolean unsub)
{ {
...@@ -133,6 +142,9 @@ static void navigation_subscribe_unsubscribe(afb_req_t request, ...@@ -133,6 +142,9 @@ static void navigation_subscribe_unsubscribe(afb_req_t request,
value); value);
} }
/*
* subscribe & unsubscribe handlers for corresponding verbs
*/
static void subscribe(afb_req_t request) static void subscribe(afb_req_t request)
{ {
navigation_subscribe_unsubscribe(request, FALSE); navigation_subscribe_unsubscribe(request, FALSE);
...@@ -143,6 +155,9 @@ static void unsubscribe(afb_req_t request) ...@@ -143,6 +155,9 @@ static void unsubscribe(afb_req_t request)
navigation_subscribe_unsubscribe(request, TRUE); navigation_subscribe_unsubscribe(request, TRUE);
} }
/*
* broadcast brodcast information depending on name
*/
static void broadcast(json_object *jresp, const char *name, gboolean cache) static void broadcast(json_object *jresp, const char *name, gboolean cache)
{ {
struct navigation_state *ns = navigation_get_userdata(); struct navigation_state *ns = navigation_get_userdata();
...@@ -179,6 +194,9 @@ static void broadcast(json_object *jresp, const char *name, gboolean cache) ...@@ -179,6 +194,9 @@ static void broadcast(json_object *jresp, const char *name, gboolean cache)
afb_event_push(event, tmp); afb_event_push(event, tmp);
} }
/*
* broadcast_status verb handler
*/
static void broadcast_status(afb_req_t request) static void broadcast_status(afb_req_t request)
{ {
json_object *jresp = afb_req_json(request); json_object *jresp = afb_req_json(request);
...@@ -191,6 +209,9 @@ static void broadcast_status(afb_req_t request) ...@@ -191,6 +209,9 @@ static void broadcast_status(afb_req_t request)
// here. // here.
} }
/*
* broadcast_position verb handler
*/
static void broadcast_position(afb_req_t request) static void broadcast_position(afb_req_t request)
{ {
const char *position = afb_req_value(request, "position"); const char *position = afb_req_value(request, "position");
...@@ -210,6 +231,9 @@ static void broadcast_position(afb_req_t request) ...@@ -210,6 +231,9 @@ static void broadcast_position(afb_req_t request)
// here. // here.
} }
/*
* broadcast_waypoints verb handler
*/
static void broadcast_waypoints(afb_req_t request) static void broadcast_waypoints(afb_req_t request)
{ {
json_object *jresp = afb_req_json(request); json_object *jresp = afb_req_json(request);
...@@ -222,6 +246,9 @@ static void broadcast_waypoints(afb_req_t request) ...@@ -222,6 +246,9 @@ static void broadcast_waypoints(afb_req_t request)
// here. // here.
} }
/*
* broadcast_destiantion verb handler
*/
static void broadcast_destination(afb_req_t request) static void broadcast_destination(afb_req_t request)
{ {
json_object* jresp = afb_req_json(request); json_object* jresp = afb_req_json(request);
...@@ -301,6 +328,9 @@ static void onevent(afb_api_t api, const char *event, struct json_object *object ...@@ -301,6 +328,9 @@ static void onevent(afb_api_t api, const char *event, struct json_object *object
} }
} }
/*
* Init for the AGL binding
*/
static int init(afb_api_t api) static int init(afb_api_t api)
{ {
struct navigation_state *ns; struct navigation_state *ns;
...@@ -355,6 +385,9 @@ static int init(afb_api_t api) ...@@ -355,6 +385,9 @@ static int init(afb_api_t api)
return 0; return 0;
} }
/*
* verbs of the agl-service-navigation
*/
static const afb_verb_t binding_verbs[] = { static const afb_verb_t binding_verbs[] = {
{ {
.verb = "subscribe", .verb = "subscribe",
...@@ -388,7 +421,7 @@ static const afb_verb_t binding_verbs[] = { ...@@ -388,7 +421,7 @@ static const afb_verb_t binding_verbs[] = {
* description of the binding for afb-daemon * description of the binding for afb-daemon
*/ */
const afb_binding_t afbBindingV3 = { const afb_binding_t afbBindingV3 = {
.api = "navigation", .api = "navigation-v2",
.verbs = binding_verbs, .verbs = binding_verbs,
.onevent = onevent, .onevent = onevent,
.init = init, .init = init,
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
# Project Info # Project Info
# ------------------ # ------------------
set(PROJECT_NAME agl-service-navigation) set(PROJECT_NAME agl-service-navigation-v2)
set(PROJECT_VERSION "1.0") set(PROJECT_VERSION "1.0")
set(PROJECT_PRETTY_NAME "Navigation service for AGL") set(PROJECT_PRETTY_NAME "Navigation service for AGL")
set(PROJECT_DESCRIPTION "Navigation reporting proxy for consumers") set(PROJECT_DESCRIPTION "Navigation reporting proxy for consumers")
...@@ -28,7 +28,7 @@ set(PROJECT_AUTHOR "Matt Ranostay - Edited by Sebastian Eckl") ...@@ -28,7 +28,7 @@ set(PROJECT_AUTHOR "Matt Ranostay - Edited by Sebastian Eckl")
set(PROJECT_AUTHOR_MAIL "matt.ranostay@konsulko.com") set(PROJECT_AUTHOR_MAIL "matt.ranostay@konsulko.com")
set(PROJECT_LICENSE "APL2.0") set(PROJECT_LICENSE "APL2.0")
set(PROJECT_LANGUAGES,"C") set(PROJECT_LANGUAGES,"C")
set(API_NAME "navigation") set(API_NAME "navigation-v2")
# Where the project configuration files are stored # Where the project configuration files are stored
set(PROJECT_CMAKE_CONF_DIR "conf.d") set(PROJECT_CMAKE_CONF_DIR "conf.d")
...@@ -119,7 +119,7 @@ set(WIDGET_TYPE application/vnd.agl.service) ...@@ -119,7 +119,7 @@ set(WIDGET_TYPE application/vnd.agl.service)
# This is the file that will be executed, loaded, # This is the file that will be executed, loaded,
# at launch time by the application framework. # at launch time by the application framework.
# #
set(WIDGET_ENTRY_POINT lib/libafm-navigation-binding.so) set(WIDGET_ENTRY_POINT lib/libafm-navigation-v2-binding.so)
# Print a helper message when every thing is finished # Print a helper message when every thing is finished
# ---------------------------------------------------- # ----------------------------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment