diff options
author | Matt Ranostay <matt.ranostay@konsulko.com> | 2019-01-29 23:30:47 -0800 |
---|---|---|
committer | Matt Ranostay <matt.ranostay@konsulko.com> | 2019-01-29 23:48:13 -0800 |
commit | fb8a20c580fc92100a973d401b6f4ba13da03a5f (patch) | |
tree | c1387af5c6d5e26c8f02787ff3f6d6decf6f758c /binding/bluetooth-pbap-binding.c | |
parent | d2e0a671dff16409377ae8182e737bea8bcc724f (diff) |
binding: bluetooth-pbap: fix device disconnect check
address parameter in properties isn't usually sent in a disconnect
so just use the bluetooth stack device name.
Change-Id: I75a7a7212fe06f63816e8cdadd0f29610ce80c82
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'binding/bluetooth-pbap-binding.c')
-rw-r--r-- | binding/bluetooth-pbap-binding.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/binding/bluetooth-pbap-binding.c b/binding/bluetooth-pbap-binding.c index 2765f61..a45e9ec 100644 --- a/binding/bluetooth-pbap-binding.c +++ b/binding/bluetooth-pbap-binding.c @@ -612,7 +612,8 @@ static gboolean is_pbap_dev_and_init(struct json_object *dev) afb_event_push(status_event, jresp); - AFB_NOTICE("PBAP device connected: %s", address); + json_object_object_get_ex(dev, "device", &val1); + AFB_NOTICE("PBAP device connected: %s", json_object_get_string(val1)); g_mutex_lock(&cached_mutex); @@ -713,7 +714,7 @@ static int init(afb_api_t api) static void process_connection_event(afb_api_t api, struct json_object *object) { struct json_object *jresp, *val = NULL, *props = NULL; - const char *action, *address; + const char *action, *device; json_object_object_get_ex(object, "action", &val); if (!val) @@ -737,11 +738,11 @@ static void process_connection_event(afb_api_t api, struct json_object *object) return; } - json_object_object_get_ex(props, "address", &val); + json_object_object_get_ex(object, "device", &val); if (!val) return; - address = json_object_get_string(val); + device = json_object_get_string(val); jresp = json_object_new_object(); g_mutex_lock(&connected_mutex); @@ -757,7 +758,7 @@ static void process_connection_event(afb_api_t api, struct json_object *object) cached_results = NULL; g_mutex_unlock(&cached_mutex); - AFB_NOTICE("PBAP device disconnected: %s", address); + AFB_NOTICE("PBAP device disconnected: %s", device); } static void onevent(afb_api_t api, const char *event, struct json_object *object) |