You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/03/25 23:27:40 UTC

[6/9] incubator-mynewt-core git commit: nimble host: Clarify host address and address type

nimble host: Clarify host address and address type


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/d2f4d851
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/d2f4d851
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/d2f4d851

Branch: refs/heads/develop
Commit: d2f4d851aa9c086b8f2e09f1b649aee24e15084d
Parents: a8cd0f7
Author: Christopher Collins <cc...@apache.org>
Authored: Fri Mar 25 12:32:49 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Fri Mar 25 15:18:08 2016 -0700

----------------------------------------------------------------------
 net/nimble/host/src/ble_gap.c        | 16 ++++++++--------
 net/nimble/host/src/ble_hs.c         |  1 +
 net/nimble/host/src/ble_hs_priv.h    |  8 ++++++++
 net/nimble/host/src/ble_hs_startup.c |  4 ++++
 4 files changed, 21 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d2f4d851/net/nimble/host/src/ble_gap.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_gap.c b/net/nimble/host/src/ble_gap.c
index 9a3e9c5..19b5cdf 100644
--- a/net/nimble/host/src/ble_gap.c
+++ b/net/nimble/host/src/ble_gap.c
@@ -1055,8 +1055,8 @@ ble_gap_master_enqueue(uint8_t state, int in_progress,
  *
  * @param addr_type             The address type of the peer; one of the
  *                                  following values:
- *                                  o    BLE_HCI_ADV_PEER_ADDR_PUBLIC
- *                                  o    BLE_HCI_ADV_PEER_ADDR_RANDOM
+ *                                  o    BLE_ADDR_TYPE_PUBLIC
+ *                                  o    BLE_ADDR_TYPE_RANDOM
  * @param addr                  The six-byte address of the connection peer.
  *
  * @return                      0 if the connection complete event was
@@ -1111,8 +1111,8 @@ ble_gap_accept_master_conn(uint8_t addr_type, uint8_t *addr)
  *
  * @param addr_type             The address type of the peer; one of the
  *                                  following values:
- *                                  o    BLE_HCI_ADV_PEER_ADDR_PUBLIC
- *                                  o    BLE_HCI_ADV_PEER_ADDR_RANDOM
+ *                                  o    BLE_ADDR_TYPE_PUBLIC
+ *                                  o    BLE_ADDR_TYPE_RANDOM
  * @param addr                  The six-byte address of the connection peer.
  *
  * @return                      0 if the connection complete event was
@@ -2020,8 +2020,8 @@ ble_gap_adv_params_tx(void *arg)
  *                                  modes, specify 0.  For directed connectable
  *                                  mode, this should be one of the following
  *                                  constants:
- *                                      o BLE_HCI_ADV_PEER_ADDR_PUBLIC
- *                                      o BLE_HCI_ADV_PEER_ADDR_RANDOM
+ *                                      o BLE_ADDR_TYPE_PUBLIC
+ *                                      o BLE_ADDR_TYPE_RANDOM
  *
  * @return                      0 on success; nonzero on failure.
  */
@@ -2494,8 +2494,8 @@ ble_gap_conn_initiate(int addr_type, uint8_t *addr,
 
     STATS_INC(ble_gap_stats, initiate);
 
-    if (addr_type != BLE_ADDR_TYPE_PUBLIC &&
-        addr_type != BLE_ADDR_TYPE_RANDOM &&
+    if (addr_type != BLE_HCI_CONN_PEER_ADDR_PUBLIC &&
+        addr_type != BLE_HCI_CONN_PEER_ADDR_RANDOM &&
         addr_type != BLE_GAP_ADDR_TYPE_WL) {
 
         rc = BLE_HS_EINVAL;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d2f4d851/net/nimble/host/src/ble_hs.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hs.c b/net/nimble/host/src/ble_hs.c
index 0681998..809eb9c 100644
--- a/net/nimble/host/src/ble_hs.c
+++ b/net/nimble/host/src/ble_hs.c
@@ -37,6 +37,7 @@
 #endif
 
 static struct log_handler ble_hs_log_console_handler;
+struct ble_hs_dev ble_hs_our_dev;
 struct log ble_hs_log;
 
 static struct os_task ble_hs_task;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d2f4d851/net/nimble/host/src/ble_hs_priv.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hs_priv.h b/net/nimble/host/src/ble_hs_priv.h
index 8c69cf8..e92ddcb 100644
--- a/net/nimble/host/src/ble_hs_priv.h
+++ b/net/nimble/host/src/ble_hs_priv.h
@@ -57,6 +57,14 @@ STATS_SECT_START(ble_hs_stats)
 STATS_SECT_END
 extern STATS_SECT_DECL(ble_hs_stats) ble_hs_stats;
 
+struct ble_hs_dev {
+    uint8_t public_addr[6];
+    uint8_t random_addr[6];
+
+    unsigned has_random_addr:1;
+};
+
+extern struct ble_hs_dev ble_hs_our_dev;
 extern struct ble_hs_cfg ble_hs_cfg;
 
 extern struct os_mbuf_pool ble_hs_mbuf_pool;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d2f4d851/net/nimble/host/src/ble_hs_startup.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hs_startup.c b/net/nimble/host/src/ble_hs_startup.c
index a218fba..6b505dc 100644
--- a/net/nimble/host/src/ble_hs_startup.c
+++ b/net/nimble/host/src/ble_hs_startup.c
@@ -18,6 +18,7 @@
  */
 
 #include <stddef.h>
+#include <string.h>
 #include <assert.h>
 #include "host/host_hci.h"
 #include "host/ble_hs.h"
@@ -234,6 +235,9 @@ ble_hs_startup_go(void)
 
     ble_hs_startup_state = BLE_HS_STARTUP_STATE_RESET;
 
+    /* XXX: Until we support reading the address from the controller. */
+    memcpy(ble_hs_our_dev.public_addr, g_dev_addr, sizeof g_dev_addr);
+
     rc = ble_hs_startup_enqueue_tx();
     return rc;
 }