summaryrefslogtreecommitdiffstats
path: root/binding/afm-geofence-binding.c
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2018-07-19 16:22:20 -0700
committerMatt Ranostay <matt.ranostay@konsulko.com>2018-07-19 17:39:34 -0700
commit9265663ba8dd19ac913cc72d33e7b02d2409b417 (patch)
treea1daeddb1edcbf0d23c26203b8fa7640a9e68481 /binding/afm-geofence-binding.c
parent322feb3f174dfdd597f70d46513b4b2eb3f748f5 (diff)
Change-Id: Id22c25a097e021fa58b0c705af6c4a11be4e2bdf Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'binding/afm-geofence-binding.c')
-rw-r--r--binding/afm-geofence-binding.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/binding/afm-geofence-binding.c b/binding/afm-geofence-binding.c
index 7c148ef..2e2f134 100644
--- a/binding/afm-geofence-binding.c
+++ b/binding/afm-geofence-binding.c
@@ -29,14 +29,14 @@
#include <glib-object.h>
#include <json-c/json.h>
-#define AFB_BINDING_VERSION 2
+#define AFB_BINDING_VERSION 3
#include <afb/afb-binding.h>
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(void *))
#define SECS_TO_USECS(x) (x * 1000000)
#define USECS_TO_SECS(x) (x / 1000000)
-static struct afb_event fence_event;
+static afb_event_t fence_event;
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
static GList *fences = NULL;
@@ -65,7 +65,7 @@ const char *points[] = {
"max_longitude",
};
-static void subscribe(struct afb_req request)
+static void subscribe(afb_req_t request)
{
const char *value = afb_req_value(request, "value");
@@ -78,7 +78,7 @@ static void subscribe(struct afb_req request)
afb_req_fail(request, "failed", "invalid event");
}
-static void unsubscribe(struct afb_req request)
+static void unsubscribe(afb_req_t request)
{
const char *value = afb_req_value(request, "value");
@@ -140,7 +140,7 @@ static int parse_bounding_box(const char *data, struct geofence *fence)
return ret;
}
-static void add_fence(struct afb_req request)
+static void add_fence(afb_req_t request)
{
const char *name = afb_req_value(request, "name");
const char *bbox = afb_req_value(request, "bbox");
@@ -194,7 +194,7 @@ static void add_fence(struct afb_req request)
afb_req_success(request, NULL, NULL);
}
-static void remove_fence(struct afb_req request)
+static void remove_fence(afb_req_t request)
{
const char *name = afb_req_value(request, "name");
GList *l;
@@ -226,7 +226,7 @@ static void remove_fence(struct afb_req request)
afb_req_fail(request, "failed", "fence not found for removal");
}
-static void list_fences(struct afb_req request)
+static void list_fences(afb_req_t request)
{
json_object *jresp = json_object_new_object();
GList *l;
@@ -259,7 +259,7 @@ static void list_fences(struct afb_req request)
afb_req_success(request, jresp, "list of geofences");
}
-static int init()
+static int init(afb_api_t api)
{
json_object *response, *query;
int ret;
@@ -273,7 +273,7 @@ static int init()
query = json_object_new_object();
json_object_object_add(query, "value", json_object_new_string("location"));
- ret = afb_service_call_sync("gps", "subscribe", query, &response);
+ ret = afb_service_call_sync("gps", "subscribe", query, &response, NULL, NULL);
json_object_put(response);
if (ret < 0) {
@@ -301,7 +301,7 @@ static inline bool dwell_transition_state(struct geofence *g)
return true;
}
-static void dwell_transition(struct afb_req request)
+static void dwell_transition(afb_req_t request)
{
const char *value = afb_req_value(request, "value");
json_object *jresp = NULL;
@@ -329,7 +329,7 @@ static void dwell_transition(struct afb_req request)
"loitering time in seconds to enter dwell transition");
}
-static void onevent(const char *event, struct json_object *object)
+static void onevent(afb_api_t api, const char *event, struct json_object *object)
{
json_object *val = NULL;
double latitude, longitude;
@@ -386,7 +386,7 @@ static void onevent(const char *event, struct json_object *object)
pthread_mutex_unlock(&mutex);
}
-static const struct afb_verb_v2 binding_verbs[] = {
+static const struct afb_verb_v3 binding_verbs[] = {
{ .verb = "subscribe", .callback = subscribe, .info = "Subscribe to geofence events" },
{ .verb = "unsubscribe", .callback = unsubscribe, .info = "Unsubscribe to geofence events" },
{ .verb = "add_fence", .callback = add_fence, .info = "Add geofence" },
@@ -399,7 +399,7 @@ static const struct afb_verb_v2 binding_verbs[] = {
/*
* binder API description
*/
-const struct afb_binding_v2 afbBindingV2 = {
+const struct afb_binding_v3 afbBindingV3 = {
.api = "geofence",
.specification = "Geofence service API",
.verbs = binding_verbs,