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:30 UTC
[mynewt-nimble] branch master updated (291d1b4 -> 44f1a18)
This is an automated email from the ASF dual-hosted git repository.
naraj pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git.
from 291d1b4 nimble/ll: Fix address types in the advertising report
new 38ac67f host/gatt: Add optional argument when iterating over local database
new 79d4d26 host/gatts: Show local included services
new c8a6bc6 host: Make ble_gatts_clt_cfg_access non-static
new f0a74de host: Fix setting peer RPA address on connection complete
new d442270 host: Fix setting conn's peer RPA address in SM
new bed211f host: Send Identity Resolved Event only when RPA was used
new 44f1a18 host: Fix conn find by RPA address
The 7 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
nimble/host/include/host/ble_gatt.h | 3 ++-
nimble/host/src/ble_gap.c | 14 ++++++++++++--
nimble/host/src/ble_gatt_priv.h | 5 ++++-
nimble/host/src/ble_gatts.c | 6 +++---
nimble/host/src/ble_gatts_lcl.c | 20 ++++++++++++++++++--
nimble/host/src/ble_hs_conn.c | 10 ++++++++--
nimble/host/src/ble_sm.c | 13 ++++++-------
7 files changed, 53 insertions(+), 18 deletions(-)
[mynewt-nimble] 05/07: host: Fix setting conn's peer RPA address in
SM
Posted by na...@apache.org.
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 d442270f5e3e8e7b736215bef83740bb41173371
Author: Michał Narajowski <mi...@codecoup.pl>
AuthorDate: Wed Jan 9 16:51:07 2019 +0100
host: Fix setting conn's peer RPA address in SM
Change introduced in previous commit already
stores a peer RPA address in proper field inside
connection structure, so we can update the condition to
use peer_rpa_addr field to check if address was resolved.
---
nimble/host/src/ble_sm.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/nimble/host/src/ble_sm.c b/nimble/host/src/ble_sm.c
index 09b33bf..127c1ae 100644
--- a/nimble/host/src/ble_sm.c
+++ b/nimble/host/src/ble_sm.c
@@ -524,15 +524,14 @@ ble_sm_persist_keys(struct ble_sm_proc *proc)
memcpy(peer_addr.val, proc->peer_keys.addr, sizeof peer_addr.val);
conn->bhc_peer_addr = peer_addr;
+
/* Update identity address in conn.
- * If peer's address was an RPA, we store it as RPA since peer's address
- * will not be an identity address. The peer's address type has to be
+ * If peer's rpa address is set then it means that the peer's address
+ * is an identity address. The peer's address type has to be
* set as 'ID' to allow resolve 'id' and 'ota' addresses properly in
* conn info.
*/
- if (BLE_ADDR_IS_RPA(&conn->bhc_peer_addr)) {
- conn->bhc_peer_rpa_addr = conn->bhc_peer_addr;
-
+ if (memcmp(BLE_ADDR_ANY->val, &conn->bhc_peer_rpa_addr.val, 6) != 0) {
switch (peer_addr.type) {
case BLE_ADDR_PUBLIC:
case BLE_ADDR_PUBLIC_ID:
[mynewt-nimble] 03/07: host: Make ble_gatts_clt_cfg_access
non-static
Posted by na...@apache.org.
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 c8a6bc66e017f5585f6ef4c718c945b6168d3f02
Author: Michał Narajowski <mi...@codecoup.pl>
AuthorDate: Wed Jan 2 15:15:44 2019 +0100
host: Make ble_gatts_clt_cfg_access non-static
This is needed to read cccd value from bttester app.
---
nimble/host/src/ble_gatt_priv.h | 3 +++
nimble/host/src/ble_gatts.c | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/nimble/host/src/ble_gatt_priv.h b/nimble/host/src/ble_gatt_priv.h
index 4893694..a49e936 100644
--- a/nimble/host/src/ble_gatt_priv.h
+++ b/nimble/host/src/ble_gatt_priv.h
@@ -182,6 +182,9 @@ 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);
+int ble_gatts_clt_cfg_access(uint16_t conn_handle, uint16_t attr_handle,
+ uint8_t op, uint16_t offset, struct os_mbuf **om,
+ void *arg);
/*** @misc. */
int ble_gatts_conn_can_alloc(void);
diff --git a/nimble/host/src/ble_gatts.c b/nimble/host/src/ble_gatts.c
index 3f30dd4..f1a80ff 100644
--- a/nimble/host/src/ble_gatts.c
+++ b/nimble/host/src/ble_gatts.c
@@ -733,7 +733,7 @@ ble_gatts_clt_cfg_access_locked(struct ble_hs_conn *conn, uint16_t attr_handle,
return 0;
}
-static int
+int
ble_gatts_clt_cfg_access(uint16_t conn_handle, uint16_t attr_handle,
uint8_t op, uint16_t offset, struct os_mbuf **om,
void *arg)
[mynewt-nimble] 01/07: host/gatt: Add optional argument when
iterating over local database
Posted by na...@apache.org.
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);
}
[mynewt-nimble] 06/07: host: Send Identity Resolved Event only when
RPA was used
Posted by na...@apache.org.
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 bed211f69c383c01a38a505155f9bac4251fccc7
Author: Michał Narajowski <mi...@codecoup.pl>
AuthorDate: Wed Jan 9 16:54:39 2019 +0100
host: Send Identity Resolved Event only when RPA was used
---
nimble/host/src/ble_sm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/nimble/host/src/ble_sm.c b/nimble/host/src/ble_sm.c
index 127c1ae..d0d464d 100644
--- a/nimble/host/src/ble_sm.c
+++ b/nimble/host/src/ble_sm.c
@@ -543,9 +543,9 @@ ble_sm_persist_keys(struct ble_sm_proc *proc)
conn->bhc_peer_addr.type = BLE_ADDR_RANDOM_ID;
break;
}
- }
- identity_ev = 1;
+ identity_ev = 1;
+ }
} else {
peer_addr = conn->bhc_peer_addr;
peer_addr.type = ble_hs_misc_addr_type_to_id(conn->bhc_peer_addr.type);
[mynewt-nimble] 07/07: host: Fix conn find by RPA address
Posted by na...@apache.org.
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 44f1a188d98fbbd15ea2709dd287b1604ee7fca2
Author: Michał Narajowski <mi...@codecoup.pl>
AuthorDate: Wed Jan 9 16:40:12 2019 +0100
host: Fix conn find by RPA address
When argument address is RPA then compare with peer rpa address field.
---
nimble/host/src/ble_hs_conn.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/nimble/host/src/ble_hs_conn.c b/nimble/host/src/ble_hs_conn.c
index 00fa4f8..2e23da3 100644
--- a/nimble/host/src/ble_hs_conn.c
+++ b/nimble/host/src/ble_hs_conn.c
@@ -300,8 +300,14 @@ ble_hs_conn_find_by_addr(const ble_addr_t *addr)
}
SLIST_FOREACH(conn, &ble_hs_conns, bhc_next) {
- if (ble_addr_cmp(&conn->bhc_peer_addr, addr) == 0) {
- return conn;
+ if (BLE_ADDR_IS_RPA(addr)) {
+ if (ble_addr_cmp(&conn->bhc_peer_rpa_addr, addr) == 0) {
+ return conn;
+ }
+ } else {
+ if (ble_addr_cmp(&conn->bhc_peer_addr, addr) == 0) {
+ return conn;
+ }
}
}
[mynewt-nimble] 04/07: host: Fix setting peer RPA address on
connection complete
Posted by na...@apache.org.
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 f0a74de7a9962a07758666800b8b16a3d7d101e5
Author: Michał Narajowski <mi...@codecoup.pl>
AuthorDate: Wed Jan 9 16:39:04 2019 +0100
host: Fix setting peer RPA address on connection complete
If peer RPA is not set in the event and peer address
is RPA then store the peer RPA address so when the peer
address is resolved, the RPA is not forgotten.
---
nimble/host/src/ble_gap.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/nimble/host/src/ble_gap.c b/nimble/host/src/ble_gap.c
index b4cddb1..3c7d0a2 100644
--- a/nimble/host/src/ble_gap.c
+++ b/nimble/host/src/ble_gap.c
@@ -1448,8 +1448,18 @@ ble_gap_rx_conn_complete(struct hci_le_conn_complete *evt, uint8_t instance)
conn->bhc_our_rpa_addr.type = BLE_ADDR_RANDOM;
memcpy(conn->bhc_our_rpa_addr.val, evt->local_rpa, 6);
- conn->bhc_peer_rpa_addr.type = BLE_ADDR_RANDOM;
- memcpy(conn->bhc_peer_rpa_addr.val, evt->peer_rpa, 6);
+ /* If peer RPA is not set in the event and peer address
+ * is RPA then store the peer RPA address so when the peer
+ * address is resolved, the RPA is not forgotten.
+ */
+ if (memcmp(BLE_ADDR_ANY->val, evt->peer_rpa, 6) == 0) {
+ if (BLE_ADDR_IS_RPA(&conn->bhc_peer_addr)) {
+ conn->bhc_peer_rpa_addr = conn->bhc_peer_addr;
+ }
+ } else {
+ conn->bhc_peer_rpa_addr.type = BLE_ADDR_RANDOM;
+ memcpy(conn->bhc_peer_rpa_addr.val, evt->peer_rpa, 6);
+ }
ble_hs_lock();
[mynewt-nimble] 02/07: host/gatts: Show local included services
Posted by na...@apache.org.
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 79d4d26b2e61abd7952af49d52327aadacf846da
Author: Michał Narajowski <mi...@codecoup.pl>
AuthorDate: Mon Dec 17 15:37:50 2018 +0100
host/gatts: Show local included services
---
nimble/host/src/ble_gatts_lcl.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/nimble/host/src/ble_gatts_lcl.c b/nimble/host/src/ble_gatts_lcl.c
index 52da541..c524ef5 100644
--- a/nimble/host/src/ble_gatts_lcl.c
+++ b/nimble/host/src/ble_gatts_lcl.c
@@ -134,6 +134,18 @@ ble_gatt_show_local_chr(const struct ble_gatt_svc_def *svc,
}
static void
+ble_gatt_show_local_inc_svc(const struct ble_gatt_svc_def *svc, char *uuid_buf)
+{
+ const struct ble_gatt_svc_def *inc_svc;
+
+ console_printf("%" FIELD_INDENT "s %" FIELD_NAME_LEN "s ", " ", "includes");
+ for (inc_svc = *svc->includes; inc_svc; ++inc_svc) {
+ console_printf("%s ", ble_uuid_to_str(inc_svc->uuid, uuid_buf));
+ }
+ console_printf("\n");
+}
+
+static void
ble_gatt_show_local_svc(const struct ble_gatt_svc_def *svc,
uint16_t handle, uint16_t end_group_handle,
void *arg)
@@ -153,6 +165,9 @@ ble_gatt_show_local_svc(const struct ble_gatt_svc_def *svc,
console_printf("%" FIELD_INDENT "s %" FIELD_NAME_LEN "s "
"%d\n", " ", "end_handle",
end_group_handle);
+ if (svc->includes) {
+ ble_gatt_show_local_inc_svc(svc, uuid_buf);
+ }
ble_gatt_show_local_chr(svc, handle+1,
uuid_buf, flags_buf);
}