diff options
author | Alok Barsode <alok.barsode@azingo.com> | 2008-08-28 18:03:55 +0530 |
---|---|---|
committer | Alok Barsode <alok.barsode@azingo.com> | 2008-08-29 13:53:12 +0530 |
commit | 271183bccb0ac55f7fe3ae6b76211251387e3b5c (patch) | |
tree | da2b7c2c17d83fbb21e472c725bf0f8d6f8b857c /src | |
parent | 5d936ee9bb433445272d3c2a377e42ae4ba5e5ec (diff) |
Adding adapter_update_oor_devices.
Diffstat (limited to 'src')
-rw-r--r-- | src/adapter.c | 19 | ||||
-rw-r--r-- | src/adapter.h | 1 | ||||
-rw-r--r-- | src/dbus-hci.c | 20 |
3 files changed, 22 insertions, 18 deletions
diff --git a/src/adapter.c b/src/adapter.c index 53a06101..701f49a1 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -2863,6 +2863,25 @@ int adapter_remove_found_device(struct adapter *adapter, bdaddr_t *bdaddr) return 0; } +void adapter_update_oor_devices(struct adapter *adapter) +{ + GSList *l = adapter->found_devices; + struct remote_dev_info *dev; + bdaddr_t tmp; + + g_slist_foreach(adapter->oor_devices, (GFunc) free, NULL); + g_slist_free(adapter->oor_devices); + adapter->oor_devices = NULL; + + while (l) { + dev = l->data; + baswap(&tmp, &dev->bdaddr); + adapter->oor_devices = g_slist_append(adapter->oor_devices, + batostr(&tmp)); + l = l->next; + } +} + int btd_register_adapter_driver(struct btd_adapter_driver *driver) { adapter_drivers = g_slist_append(adapter_drivers, driver); diff --git a/src/adapter.h b/src/adapter.h index dfc377ed..8b42dbad 100644 --- a/src/adapter.h +++ b/src/adapter.h @@ -177,6 +177,7 @@ struct remote_dev_info *adapter_search_found_devices(struct adapter *adapter, int adapter_add_found_device(struct adapter *adapter, bdaddr_t *bdaddr, int8_t rssi, name_status_t name_status); int adapter_remove_found_device(struct adapter *adapter, bdaddr_t *bdaddr); +void adapter_update_oor_devices(struct adapter *adapter); struct btd_adapter_driver { const char *name; diff --git a/src/dbus-hci.c b/src/dbus-hci.c index 465a1072..63978d84 100644 --- a/src/dbus-hci.c +++ b/src/dbus-hci.c @@ -802,8 +802,7 @@ static int found_device_req_name(struct adapter *adapter) /* if failed, request the next element */ /* remove the element from the list */ - adapter->found_devices = g_slist_remove(adapter->found_devices, dev); - g_free(dev); + adapter_remove_found_device(adapter, &dev->bdaddr); /* get the next element */ dev = adapter_search_found_devices(adapter, &match); @@ -834,8 +833,6 @@ static void send_out_of_range(const char *path, GSList *l) void hcid_dbus_inquiry_complete(bdaddr_t *local) { struct adapter *adapter; - struct remote_dev_info *dev; - bdaddr_t tmp; const gchar *path; int state; @@ -850,22 +847,9 @@ void hcid_dbus_inquiry_complete(bdaddr_t *local) /* Out of range verification */ if ((adapter_get_state(adapter) & PERIODIC_INQUIRY) && !(adapter_get_state(adapter) & STD_INQUIRY)) { - GSList *l; send_out_of_range(path, adapter->oor_devices); - - g_slist_foreach(adapter->oor_devices, (GFunc) free, NULL); - g_slist_free(adapter->oor_devices); - adapter->oor_devices = NULL; - - l = adapter->found_devices; - while (l) { - dev = l->data; - baswap(&tmp, &dev->bdaddr); - adapter->oor_devices = g_slist_append(adapter->oor_devices, - batostr(&tmp)); - l = l->next; - } + adapter_update_oor_devices(adapter); } /* |