You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by na...@apache.org on 2019/01/11 16:07:31 UTC
[mynewt-nimble] 01/07: host/gatt: Add optional argument when
iterating over local database
This is an automated email from the ASF dual-hosted git repository.
naraj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
commit 38ac67f97aa164ec801336dfd9688f9a8fe9962d
Author: MichaĆ Narajowski <mi...@codecoup.pl>
AuthorDate: Fri Nov 16 12:32:55 2018 +0100
host/gatt: Add optional argument when iterating over local database
---
nimble/host/include/host/ble_gatt.h | 3 ++-
nimble/host/src/ble_gatt_priv.h | 2 +-
nimble/host/src/ble_gatts.c | 4 ++--
nimble/host/src/ble_gatts_lcl.c | 5 +++--
4 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/nimble/host/include/host/ble_gatt.h b/nimble/host/include/host/ble_gatt.h
index c3725bc..6188f62 100644
--- a/nimble/host/include/host/ble_gatt.h
+++ b/nimble/host/include/host/ble_gatt.h
@@ -848,7 +848,8 @@ int ble_gatts_find_dsc(const ble_uuid_t *svc_uuid, const ble_uuid_t *chr_uuid,
typedef void (*ble_gatt_svc_foreach_fn)(const struct ble_gatt_svc_def *svc,
uint16_t handle,
- uint16_t end_group_handle);
+ uint16_t end_group_handle,
+ void *arg);
/**
* Prints dump of local GATT database. This is useful to log local state of
diff --git a/nimble/host/src/ble_gatt_priv.h b/nimble/host/src/ble_gatt_priv.h
index 14b92cd..4893694 100644
--- a/nimble/host/src/ble_gatt_priv.h
+++ b/nimble/host/src/ble_gatt_priv.h
@@ -178,7 +178,7 @@ int ble_gatts_send_next_indicate(uint16_t conn_handle);
void ble_gatts_tx_notifications(void);
void ble_gatts_bonding_restored(uint16_t conn_handle);
void ble_gatts_connection_broken(uint16_t conn_handle);
-void ble_gatts_lcl_svc_foreach(ble_gatt_svc_foreach_fn cb);
+void ble_gatts_lcl_svc_foreach(ble_gatt_svc_foreach_fn cb, void *arg);
int ble_gatts_register_svcs(const struct ble_gatt_svc_def *svcs,
ble_gatt_register_fn *register_cb,
void *cb_arg);
diff --git a/nimble/host/src/ble_gatts.c b/nimble/host/src/ble_gatts.c
index 7a53001..3f30dd4 100644
--- a/nimble/host/src/ble_gatts.c
+++ b/nimble/host/src/ble_gatts.c
@@ -2083,14 +2083,14 @@ ble_gatts_count_cfg(const struct ble_gatt_svc_def *defs)
}
void
-ble_gatts_lcl_svc_foreach(ble_gatt_svc_foreach_fn cb)
+ble_gatts_lcl_svc_foreach(ble_gatt_svc_foreach_fn cb, void *arg)
{
int i;
for (i = 0; i < ble_gatts_num_svc_entries; i++) {
cb(ble_gatts_svc_entries[i].svc,
ble_gatts_svc_entries[i].handle,
- ble_gatts_svc_entries[i].end_group_handle);
+ ble_gatts_svc_entries[i].end_group_handle, arg);
}
}
diff --git a/nimble/host/src/ble_gatts_lcl.c b/nimble/host/src/ble_gatts_lcl.c
index 747c512..52da541 100644
--- a/nimble/host/src/ble_gatts_lcl.c
+++ b/nimble/host/src/ble_gatts_lcl.c
@@ -135,7 +135,8 @@ ble_gatt_show_local_chr(const struct ble_gatt_svc_def *svc,
static void
ble_gatt_show_local_svc(const struct ble_gatt_svc_def *svc,
- uint16_t handle, uint16_t end_group_handle)
+ uint16_t handle, uint16_t end_group_handle,
+ void *arg)
{
char uuid_buf[BLE_UUID_STR_LEN];
char flags_buf[BLE_CHR_FLAGS_STR_LEN];
@@ -159,6 +160,6 @@ ble_gatt_show_local_svc(const struct ble_gatt_svc_def *svc,
void
ble_gatts_show_local(void)
{
- ble_gatts_lcl_svc_foreach(ble_gatt_show_local_svc);
+ ble_gatts_lcl_svc_foreach(ble_gatt_show_local_svc, NULL);
}