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 2015/12/08 04:17:54 UTC

[1/2] incubator-mynewt-larva git commit: Move some code around to expose some functions.

Repository: incubator-mynewt-larva
Updated Branches:
  refs/heads/master 8adaa514b -> cc3af6efc


Move some code around to expose some functions.


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

Branch: refs/heads/master
Commit: 225b7f36ab6fcac4db08f7ddf774385a2427168a
Parents: 8adaa51
Author: Christopher Collins <cc...@gmail.com>
Authored: Mon Dec 7 18:56:09 2015 -0800
Committer: Christopher Collins <cc...@gmail.com>
Committed: Mon Dec 7 18:56:09 2015 -0800

----------------------------------------------------------------------
 net/nimble/host/include/host/ble_att.h          |  70 ++++++++
 net/nimble/host/include/host/ble_hs_uuid.h      |  27 +++
 net/nimble/host/src/ble_att.c                   |   2 +-
 net/nimble/host/src/ble_att.h                   | 178 -------------------
 net/nimble/host/src/ble_att_clt.c               |  21 ++-
 net/nimble/host/src/ble_att_cmd.c               |   3 +-
 net/nimble/host/src/ble_att_cmd.h               |  16 --
 net/nimble/host/src/ble_att_priv.h              | 129 ++++++++++++++
 net/nimble/host/src/ble_att_svr.c               |  42 ++---
 net/nimble/host/src/ble_gap_conn.c              |   9 +-
 net/nimble/host/src/ble_gatt.c                  |   4 +-
 net/nimble/host/src/ble_hs.c                    |   7 +-
 net/nimble/host/src/ble_hs_conn.c               |   2 +-
 net/nimble/host/src/ble_hs_conn.h               |   2 +-
 net/nimble/host/src/ble_hs_uuid.c               |   2 +-
 net/nimble/host/src/ble_hs_uuid.h               |  27 ---
 net/nimble/host/src/ble_l2cap.c                 |   6 +-
 net/nimble/host/src/ble_l2cap.h                 |   3 +-
 net/nimble/host/src/host_hci.c                  |   3 +
 net/nimble/host/src/test/ble_att_clt_test.c     |   2 +-
 net/nimble/host/src/test/ble_att_svr_test.c     |   2 +-
 net/nimble/host/src/test/ble_gatt_disc_c_test.c |   2 +-
 net/nimble/host/src/test/ble_gatt_disc_s_test.c |   2 +-
 net/nimble/host/src/test/ble_gatt_read_test.c   |   2 +-
 net/nimble/host/src/test/ble_host_hci_test.c    |   2 +-
 net/nimble/host/src/test/ble_hs_conn_test.c     |   2 +-
 net/nimble/host/src/test/ble_hs_uuid_test.c     |   2 +-
 27 files changed, 296 insertions(+), 273 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/225b7f36/net/nimble/host/include/host/ble_att.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/include/host/ble_att.h b/net/nimble/host/include/host/ble_att.h
new file mode 100644
index 0000000..18ee5cd
--- /dev/null
+++ b/net/nimble/host/include/host/ble_att.h
@@ -0,0 +1,70 @@
+#ifndef H_BLE_ATT_
+#define H_BLE_ATT_
+
+#define BLE_ATT_OP_ERROR_RSP             0x01
+#define BLE_ATT_OP_MTU_REQ               0x02
+#define BLE_ATT_OP_MTU_RSP               0x03
+#define BLE_ATT_OP_FIND_INFO_REQ         0x04
+#define BLE_ATT_OP_FIND_INFO_RSP         0x05
+#define BLE_ATT_OP_FIND_TYPE_VALUE_REQ   0x06
+#define BLE_ATT_OP_FIND_TYPE_VALUE_RSP   0x07
+#define BLE_ATT_OP_READ_TYPE_REQ         0x08
+#define BLE_ATT_OP_READ_TYPE_RSP         0x09
+#define BLE_ATT_OP_READ_REQ              0x0a
+#define BLE_ATT_OP_READ_RSP              0x0b
+#define BLE_ATT_OP_READ_GROUP_TYPE_REQ   0x10
+#define BLE_ATT_OP_READ_GROUP_TYPE_RSP   0x11
+#define BLE_ATT_OP_WRITE_REQ             0x12
+#define BLE_ATT_OP_WRITE_RSP             0x13
+
+union ble_att_svr_handle_arg {
+    struct {
+        void *attr_data;
+        int attr_len;
+    } aha_read;
+
+    struct {
+        struct os_mbuf *om;
+        int attr_len;
+    } aha_write;
+};
+
+#define HA_FLAG_PERM_READ            (1 << 0)
+#define HA_FLAG_PERM_WRITE           (1 << 1) 
+#define HA_FLAG_PERM_RW              (1 << 2)
+#define HA_FLAG_ENC_REQ              (1 << 3)
+#define HA_FLAG_AUTHENTICATION_REQ   (1 << 4)
+#define HA_FLAG_AUTHORIZATION_REQ    (1 << 5)
+
+struct ble_att_svr_entry;
+
+/**
+ * Handles a host attribute request.
+ *
+ * @param entry                 The host attribute being requested.
+ * @param op                    The operation being performed on the attribute.
+ * @param arg                   The request data associated with that host
+ *                                  attribute.
+ *
+ * @return                      0 on success;
+ *                              One of the BLE_ATT_ERR_[...] codes on
+ *                                  failure.
+ */
+typedef int ble_att_svr_handle_func(struct ble_att_svr_entry *entry,
+                                    uint8_t op,
+                                    union ble_att_svr_handle_arg *arg);
+
+struct ble_att_svr_entry {
+    STAILQ_ENTRY(ble_att_svr_entry) ha_next;
+
+    uint8_t ha_uuid[16];
+    uint8_t ha_flags;
+    uint8_t ha_pad1;
+    uint16_t ha_handle_id;
+    ble_att_svr_handle_func *ha_fn;
+};
+
+int ble_att_svr_register(uint8_t *uuid, uint8_t flags, uint16_t *handle_id,
+                         ble_att_svr_handle_func *fn);
+
+#endif

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/225b7f36/net/nimble/host/include/host/ble_hs_uuid.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/include/host/ble_hs_uuid.h b/net/nimble/host/include/host/ble_hs_uuid.h
new file mode 100644
index 0000000..1515a60
--- /dev/null
+++ b/net/nimble/host/include/host/ble_hs_uuid.h
@@ -0,0 +1,27 @@
+/**
+ * Copyright (c) 2015 Runtime Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef H_BLE_HS_UUID_
+#define H_BLE_HS_UUID_
+
+struct os_mbuf;
+
+uint16_t ble_hs_uuid_16bit(void *uuid128);
+int ble_hs_uuid_from_16bit(uint16_t uuid16, void *dst);
+int ble_hs_uuid_append(struct os_mbuf *om, void *uuid128);
+int ble_hs_uuid_extract(struct os_mbuf *om, int off, void *uuid128);
+
+#endif /* _BLE_HOST_UUID_H */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/225b7f36/net/nimble/host/src/ble_att.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_att.c b/net/nimble/host/src/ble_att.c
index be0063f..7ef6424 100644
--- a/net/nimble/host/src/ble_att.c
+++ b/net/nimble/host/src/ble_att.c
@@ -18,7 +18,7 @@
 #include <errno.h>
 #include "ble_l2cap.h"
 #include "ble_att_cmd.h"
-#include "ble_att.h"
+#include "ble_att_priv.h"
 
 /** Dispatch table for incoming ATT requests.  Sorted by op code. */
 typedef int ble_att_rx_fn(struct ble_hs_conn *conn,

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/225b7f36/net/nimble/host/src/ble_att.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_att.h b/net/nimble/host/src/ble_att.h
deleted file mode 100644
index f5dfae6..0000000
--- a/net/nimble/host/src/ble_att.h
+++ /dev/null
@@ -1,178 +0,0 @@
-/**
- * Copyright (c) 2015 Runtime Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef H_BLE_HS_ATT_
-#define H_BLE_HS_ATT_
-
-#include <inttypes.h>
-#include "os/queue.h"
-struct os_mbuf;
-struct ble_hs_conn;
-struct ble_l2cap_chan;
-struct ble_att_find_info_req;
-struct ble_att_error_rsp;
-struct ble_att_mtu_cmd;
-struct ble_att_read_req;
-struct ble_att_read_type_req;
-struct ble_att_read_group_type_req;
-struct ble_att_read_group_type_rsp;
-struct ble_att_find_type_value_req;
-
-#define BLE_ATT_MTU_DFLT         23  /* Also the minimum. */
-#define BLE_ATT_MTU_MAX          256 /* XXX: I'm making this up! */
-
-#define BLE_ATT_ERR_INVALID_HANDLE       0x01
-#define BLE_ATT_ERR_INVALID_PDU          0x04
-#define BLE_ATT_ERR_REQ_NOT_SUPPORTED    0x06
-#define BLE_ATT_ERR_ATTR_NOT_FOUND       0x0a
-#define BLE_ATT_ERR_UNLIKELY             0x0e
-#define BLE_ATT_ERR_INSUFFICIENT_RES     0x11
-
-union ble_att_svr_handle_arg {
-    struct {
-        void *attr_data;
-        int attr_len;
-    } aha_read;
-
-    struct {
-        struct os_mbuf *om;
-        int attr_len;
-    } aha_write;
-};
-
-struct ble_att_svr_entry;
-
-/**
- * Called from ble_att_svr_walk().  Called on each entry in the 
- * ble_att_svr_list.
- *
- * @param Contains the current ble_att being iterated through
- * @param The user supplied argument to ble_att_svr_walk()
- *
- * @return 0 on continue, 1 on stop
- */
-typedef int (*ble_att_svr_walk_func_t)(struct ble_att_svr_entry *entry,
-                                       void *arg);
-
-/**
- * Handles a host attribute request.
- *
- * @param entry                 The host attribute being requested.
- * @param op                    The operation being performed on the attribute.
- * @param arg                   The request data associated with that host
- *                                  attribute.
- *
- * @return                      0 on success;
- *                              One of the BLE_ATT_ERR_[...] codes on
- *                                  failure.
- */
-typedef int ble_att_svr_handle_func(struct ble_att_svr_entry *entry,
-                                    uint8_t op,
-                                    union ble_att_svr_handle_arg *arg);
-
-#define HA_FLAG_PERM_READ            (1 << 0)
-#define HA_FLAG_PERM_WRITE           (1 << 1) 
-#define HA_FLAG_PERM_RW              (1 << 2)
-#define HA_FLAG_ENC_REQ              (1 << 3)
-#define HA_FLAG_AUTHENTICATION_REQ   (1 << 4)
-#define HA_FLAG_AUTHORIZATION_REQ    (1 << 5)
-
-struct ble_att_svr_entry {
-    STAILQ_ENTRY(ble_att_svr_entry) ha_next;
-
-    uint8_t ha_uuid[16];
-    uint8_t ha_flags;
-    uint8_t ha_pad1;
-    uint16_t ha_handle_id;
-    ble_att_svr_handle_func *ha_fn;
-};
-
-#define HA_OPCODE_METHOD_START (0)
-#define HA_OPCODE_METHOD_END (5)
-#define HA_OPCODE_COMMAND_FLAG (1 << 6) 
-#define HA_OPCODE_AUTH_SIG_FLAG (1 << 7) 
-
-struct ble_att_clt_adata {
-    uint16_t att_handle;
-    uint16_t end_group_handle;
-    int value_len;
-    void *value;
-};
-
-SLIST_HEAD(ble_att_clt_entry_list, ble_att_clt_entry);
-
-/*** @gen */
-struct ble_l2cap_chan *ble_att_create_chan(void);
-void ble_att_set_peer_mtu(struct ble_l2cap_chan *chan, uint16_t peer_mtu);
-
-/*** @svr */
-int ble_att_svr_register(uint8_t *uuid, uint8_t flags, uint16_t *handle_id,
-                         ble_att_svr_handle_func *fn);
-
-
-int ble_att_svr_rx_mtu(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan,
-                       struct os_mbuf **rxom);
-int ble_att_svr_rx_find_info(struct ble_hs_conn *conn,
-                             struct ble_l2cap_chan *chan,
-                             struct os_mbuf **rxom);
-int ble_att_svr_rx_find_type_value(struct ble_hs_conn *conn,
-                                   struct ble_l2cap_chan *chan,
-                                   struct os_mbuf **rxom);
-int ble_att_svr_rx_read_type(struct ble_hs_conn *conn,
-                             struct ble_l2cap_chan *chan,
-                             struct os_mbuf **rxom);
-int ble_att_svr_rx_read(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan,
-                        struct os_mbuf **rxom);
-int ble_att_svr_rx_write(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan,
-                         struct os_mbuf **rxom);
-int ble_att_svr_init(void);
-
-/*** @clt */
-int ble_att_clt_rx_error(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan,
-                         struct os_mbuf **rxom);
-int ble_att_clt_tx_mtu(struct ble_hs_conn *conn,
-                       struct ble_att_mtu_cmd *req);
-int ble_att_clt_rx_mtu(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan,
-                       struct os_mbuf **rxom);
-int ble_att_clt_tx_read(struct ble_hs_conn *conn,
-                        struct ble_att_read_req *req);
-int ble_att_clt_rx_read(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan,
-                        struct os_mbuf **rxom);
-int ble_att_clt_tx_read_type(struct ble_hs_conn *conn,
-                             struct ble_att_read_type_req *req,
-                             void *uuid128);
-int ble_att_clt_rx_read_type(struct ble_hs_conn *conn,
-                             struct ble_l2cap_chan *chan,
-                             struct os_mbuf **rxom);
-int ble_att_clt_tx_read_group_type(struct ble_hs_conn *conn,
-                                   struct ble_att_read_group_type_req *req,
-                                   void *uuid128);
-int ble_att_clt_rx_read_group_type(struct ble_hs_conn *conn,
-                                   struct ble_l2cap_chan *chan,
-                                   struct os_mbuf **rxom);
-int ble_att_clt_tx_find_info(struct ble_hs_conn *conn,
-                             struct ble_att_find_info_req *req);
-int ble_att_clt_rx_find_info(struct ble_hs_conn *conn,
-                             struct ble_l2cap_chan *chan,
-                             struct os_mbuf **rxom);
-int ble_att_clt_tx_find_type_value(struct ble_hs_conn *conn,
-                                   struct ble_att_find_type_value_req *req,
-                                   void *attribute_value, int value_len);
-int ble_att_clt_rx_find_type_value(struct ble_hs_conn *conn,
-                                   struct ble_l2cap_chan *chan,
-                                   struct os_mbuf **rxom);
-
-#endif

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/225b7f36/net/nimble/host/src/ble_att_clt.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_att_clt.c b/net/nimble/host/src/ble_att_clt.c
index e675405..e78b337 100644
--- a/net/nimble/host/src/ble_att_clt.c
+++ b/net/nimble/host/src/ble_att_clt.c
@@ -22,10 +22,10 @@
 #include "nimble/ble.h"
 #include "host/ble_gatt.h"
 #include "host/ble_hs.h"
-#include "ble_hs_uuid.h"
+#include "host/ble_hs_uuid.h"
 #include "ble_hs_conn.h"
 #include "ble_att_cmd.h"
-#include "ble_att.h"
+#include "ble_att_priv.h"
 
 static int
 ble_att_clt_prep_req(struct ble_hs_conn *conn, struct ble_l2cap_chan **chan,
@@ -43,6 +43,9 @@ ble_att_clt_prep_req(struct ble_hs_conn *conn, struct ble_l2cap_chan **chan,
         goto err;
     }
 
+    /* Make room in the buffer for various headers.  XXX Check this number. */
+    (*txom)->om_data += 8;
+
     buf = os_mbuf_extend(*txom, initial_sz);
     if (buf == NULL) {
         rc = ENOMEM;
@@ -106,7 +109,7 @@ ble_att_clt_tx_mtu(struct ble_hs_conn *conn, struct ble_att_mtu_cmd *req)
         goto err;
     }
 
-    rc = ble_l2cap_tx(chan, txom);
+    rc = ble_l2cap_tx(conn, chan, txom);
     txom = NULL;
     if (rc != 0) {
         goto err;
@@ -171,7 +174,7 @@ ble_att_clt_tx_find_info(struct ble_hs_conn *conn,
         goto err;
     }
 
-    rc = ble_l2cap_tx(chan, txom);
+    rc = ble_l2cap_tx(conn, chan, txom);
     txom = NULL;
     if (rc != 0) {
         goto err;
@@ -282,7 +285,7 @@ ble_att_clt_tx_read_type(struct ble_hs_conn *conn,
         goto err;
     }
 
-    rc = ble_l2cap_tx(chan, txom);
+    rc = ble_l2cap_tx(conn, chan, txom);
     txom = NULL;
     if (rc != 0) {
         goto err;
@@ -373,7 +376,7 @@ ble_att_clt_tx_read_group_type(struct ble_hs_conn *conn,
     }
 
     rc = ble_att_clt_prep_req(conn, &chan, &txom,
-                                 BLE_ATT_READ_GROUP_TYPE_REQ_BASE_SZ);
+                              BLE_ATT_READ_GROUP_TYPE_REQ_BASE_SZ);
     if (rc != 0) {
         goto err;
     }
@@ -389,7 +392,7 @@ ble_att_clt_tx_read_group_type(struct ble_hs_conn *conn,
         goto err;
     }
 
-    rc = ble_l2cap_tx(chan, txom);
+    rc = ble_l2cap_tx(conn, chan, txom);
     txom = NULL;
     if (rc != 0) {
         goto err;
@@ -426,7 +429,7 @@ ble_att_clt_tx_read(struct ble_hs_conn *conn, struct ble_att_read_req *req)
         goto err;
     }
 
-    rc = ble_l2cap_tx(chan, txom);
+    rc = ble_l2cap_tx(conn, chan, txom);
     txom = NULL;
     if (rc != 0) {
         goto err;
@@ -567,7 +570,7 @@ ble_att_clt_tx_find_type_value(struct ble_hs_conn *conn,
         goto err;
     }
 
-    rc = ble_l2cap_tx(chan, txom);
+    rc = ble_l2cap_tx(conn, chan, txom);
     txom = NULL;
     if (rc != 0) {
         goto err;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/225b7f36/net/nimble/host/src/ble_att_cmd.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_att_cmd.c b/net/nimble/host/src/ble_att_cmd.c
index c0624cc..fd6052d 100644
--- a/net/nimble/host/src/ble_att_cmd.c
+++ b/net/nimble/host/src/ble_att_cmd.c
@@ -18,7 +18,8 @@
 #include <string.h>
 #include "os/os.h"
 #include "nimble/ble.h"
-#include "ble_hs_uuid.h"
+#include "host/ble_att.h"
+#include "host/ble_hs_uuid.h"
 #include "ble_l2cap.h"
 #include "ble_att_cmd.h"
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/225b7f36/net/nimble/host/src/ble_att_cmd.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_att_cmd.h b/net/nimble/host/src/ble_att_cmd.h
index 0676a0a..cd757d6 100644
--- a/net/nimble/host/src/ble_att_cmd.h
+++ b/net/nimble/host/src/ble_att_cmd.h
@@ -17,22 +17,6 @@
 #include <inttypes.h>
 struct ble_l2cap_chan;
 
-#define BLE_ATT_OP_ERROR_RSP             0x01
-#define BLE_ATT_OP_MTU_REQ               0x02
-#define BLE_ATT_OP_MTU_RSP               0x03
-#define BLE_ATT_OP_FIND_INFO_REQ         0x04
-#define BLE_ATT_OP_FIND_INFO_RSP         0x05
-#define BLE_ATT_OP_FIND_TYPE_VALUE_REQ   0x06
-#define BLE_ATT_OP_FIND_TYPE_VALUE_RSP   0x07
-#define BLE_ATT_OP_READ_TYPE_REQ         0x08
-#define BLE_ATT_OP_READ_TYPE_RSP         0x09
-#define BLE_ATT_OP_READ_REQ              0x0a
-#define BLE_ATT_OP_READ_RSP              0x0b
-#define BLE_ATT_OP_READ_GROUP_TYPE_REQ   0x10
-#define BLE_ATT_OP_READ_GROUP_TYPE_RSP   0x11
-#define BLE_ATT_OP_WRITE_REQ             0x12
-#define BLE_ATT_OP_WRITE_RSP             0x13
-
 /**
  * | Parameter                          | Size (octets)     |
  * +------------------------------------+-------------------+

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/225b7f36/net/nimble/host/src/ble_att_priv.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_att_priv.h b/net/nimble/host/src/ble_att_priv.h
new file mode 100644
index 0000000..f8d7539
--- /dev/null
+++ b/net/nimble/host/src/ble_att_priv.h
@@ -0,0 +1,129 @@
+/**
+ * Copyright (c) 2015 Runtime Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef H_BLE_ATT_PRIV_
+#define H_BLE_ATT_PRIV_
+
+#include <inttypes.h>
+#include "os/queue.h"
+#include "host/ble_att.h"
+struct os_mbuf;
+struct ble_hs_conn;
+struct ble_l2cap_chan;
+struct ble_att_find_info_req;
+struct ble_att_error_rsp;
+struct ble_att_mtu_cmd;
+struct ble_att_read_req;
+struct ble_att_read_type_req;
+struct ble_att_read_group_type_req;
+struct ble_att_read_group_type_rsp;
+struct ble_att_find_type_value_req;
+
+#define BLE_ATT_MTU_DFLT         23  /* Also the minimum. */
+#define BLE_ATT_MTU_MAX          256 /* XXX: I'm making this up! */
+
+#define BLE_ATT_ERR_INVALID_HANDLE       0x01
+#define BLE_ATT_ERR_INVALID_PDU          0x04
+#define BLE_ATT_ERR_REQ_NOT_SUPPORTED    0x06
+#define BLE_ATT_ERR_ATTR_NOT_FOUND       0x0a
+#define BLE_ATT_ERR_UNLIKELY             0x0e
+#define BLE_ATT_ERR_INSUFFICIENT_RES     0x11
+
+/**
+ * Called from ble_att_svr_walk().  Called on each entry in the 
+ * ble_att_svr_list.
+ *
+ * @param Contains the current ble_att being iterated through
+ * @param The user supplied argument to ble_att_svr_walk()
+ *
+ * @return 0 on continue, 1 on stop
+ */
+typedef int (*ble_att_svr_walk_func_t)(struct ble_att_svr_entry *entry,
+                                       void *arg);
+
+
+#define HA_OPCODE_METHOD_START (0)
+#define HA_OPCODE_METHOD_END (5)
+#define HA_OPCODE_COMMAND_FLAG (1 << 6) 
+#define HA_OPCODE_AUTH_SIG_FLAG (1 << 7) 
+
+struct ble_att_clt_adata {
+    uint16_t att_handle;
+    uint16_t end_group_handle;
+    int value_len;
+    void *value;
+};
+
+SLIST_HEAD(ble_att_clt_entry_list, ble_att_clt_entry);
+
+/*** @gen */
+struct ble_l2cap_chan *ble_att_create_chan(void);
+void ble_att_set_peer_mtu(struct ble_l2cap_chan *chan, uint16_t peer_mtu);
+
+/*** @svr */
+int ble_att_svr_rx_mtu(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan,
+                       struct os_mbuf **rxom);
+int ble_att_svr_rx_find_info(struct ble_hs_conn *conn,
+                             struct ble_l2cap_chan *chan,
+                             struct os_mbuf **rxom);
+int ble_att_svr_rx_find_type_value(struct ble_hs_conn *conn,
+                                   struct ble_l2cap_chan *chan,
+                                   struct os_mbuf **rxom);
+int ble_att_svr_rx_read_type(struct ble_hs_conn *conn,
+                             struct ble_l2cap_chan *chan,
+                             struct os_mbuf **rxom);
+int ble_att_svr_rx_read(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan,
+                        struct os_mbuf **rxom);
+int ble_att_svr_rx_write(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan,
+                         struct os_mbuf **rxom);
+int ble_att_svr_init(void);
+
+/*** @clt */
+int ble_att_clt_rx_error(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan,
+                         struct os_mbuf **rxom);
+int ble_att_clt_tx_mtu(struct ble_hs_conn *conn,
+                       struct ble_att_mtu_cmd *req);
+int ble_att_clt_rx_mtu(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan,
+                       struct os_mbuf **rxom);
+int ble_att_clt_tx_read(struct ble_hs_conn *conn,
+                        struct ble_att_read_req *req);
+int ble_att_clt_rx_read(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan,
+                        struct os_mbuf **rxom);
+int ble_att_clt_tx_read_type(struct ble_hs_conn *conn,
+                             struct ble_att_read_type_req *req,
+                             void *uuid128);
+int ble_att_clt_rx_read_type(struct ble_hs_conn *conn,
+                             struct ble_l2cap_chan *chan,
+                             struct os_mbuf **rxom);
+int ble_att_clt_tx_read_group_type(struct ble_hs_conn *conn,
+                                   struct ble_att_read_group_type_req *req,
+                                   void *uuid128);
+int ble_att_clt_rx_read_group_type(struct ble_hs_conn *conn,
+                                   struct ble_l2cap_chan *chan,
+                                   struct os_mbuf **rxom);
+int ble_att_clt_tx_find_info(struct ble_hs_conn *conn,
+                             struct ble_att_find_info_req *req);
+int ble_att_clt_rx_find_info(struct ble_hs_conn *conn,
+                             struct ble_l2cap_chan *chan,
+                             struct os_mbuf **rxom);
+int ble_att_clt_tx_find_type_value(struct ble_hs_conn *conn,
+                                   struct ble_att_find_type_value_req *req,
+                                   void *attribute_value, int value_len);
+int ble_att_clt_rx_find_type_value(struct ble_hs_conn *conn,
+                                   struct ble_l2cap_chan *chan,
+                                   struct os_mbuf **rxom);
+
+#endif

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/225b7f36/net/nimble/host/src/ble_att_svr.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_att_svr.c b/net/nimble/host/src/ble_att_svr.c
index 100ec3b..611c0e9 100644
--- a/net/nimble/host/src/ble_att_svr.c
+++ b/net/nimble/host/src/ble_att_svr.c
@@ -22,9 +22,9 @@
 #include "host/ble_hs.h"
 #include "ble_l2cap.h"
 #include "ble_hs_conn.h"
-#include "ble_hs_uuid.h"
+#include "host/ble_hs_uuid.h"
 #include "ble_att_cmd.h"
-#include "ble_att.h"
+#include "ble_att_priv.h"
 
 static STAILQ_HEAD(, ble_att_svr_entry) ble_att_svr_list;
 static uint16_t ble_att_svr_id;
@@ -265,8 +265,8 @@ ble_att_svr_find_by_uuid(uint8_t *uuid,
 }
 
 static int
-ble_att_svr_tx_error_rsp(struct ble_l2cap_chan *chan, uint8_t req_op,
-                         uint16_t handle, uint8_t error_code)
+ble_att_svr_tx_error_rsp(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan,
+                         uint8_t req_op, uint16_t handle, uint8_t error_code)
 {
     struct ble_att_error_rsp rsp;
     struct os_mbuf *txom;
@@ -292,7 +292,7 @@ ble_att_svr_tx_error_rsp(struct ble_l2cap_chan *chan, uint8_t req_op,
     rc = ble_att_error_rsp_write(dst, BLE_ATT_ERROR_RSP_SZ, &rsp);
     assert(rc == 0);
 
-    rc = ble_l2cap_tx(chan, txom);
+    rc = ble_l2cap_tx(conn, chan, txom);
     txom = NULL;
     if (rc != 0) {
         rc = BLE_ATT_ERR_UNLIKELY;
@@ -307,7 +307,8 @@ err:
 }
 
 static int
-ble_att_svr_tx_mtu_rsp(struct ble_l2cap_chan *chan, uint8_t op, uint16_t mtu)
+ble_att_svr_tx_mtu_rsp(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan,
+                       uint8_t op, uint16_t mtu)
 {
     struct ble_att_mtu_cmd cmd;
     struct os_mbuf *txom;
@@ -334,7 +335,7 @@ ble_att_svr_tx_mtu_rsp(struct ble_l2cap_chan *chan, uint8_t op, uint16_t mtu)
     rc = ble_att_mtu_rsp_write(dst, BLE_ATT_MTU_CMD_SZ, &cmd);
     assert(rc == 0);
 
-    rc = ble_l2cap_tx(chan, txom);
+    rc = ble_l2cap_tx(conn, chan, txom);
     txom = NULL;
     if (rc != 0) {
         rc = BLE_ATT_ERR_UNLIKELY;
@@ -365,7 +366,8 @@ ble_att_svr_rx_mtu(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan,
     assert(rc == 0);
 
     ble_att_set_peer_mtu(chan, cmd.bamc_mtu);
-    rc = ble_att_svr_tx_mtu_rsp(chan, BLE_ATT_OP_MTU_RSP, chan->blc_my_mtu);
+    rc = ble_att_svr_tx_mtu_rsp(conn, chan, BLE_ATT_OP_MTU_RSP,
+                                chan->blc_my_mtu);
     if (rc != 0) {
         return rc;
     }
@@ -554,7 +556,7 @@ ble_att_svr_rx_find_info(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan,
         goto err;
     }
 
-    rc = ble_l2cap_tx(chan, txom);
+    rc = ble_l2cap_tx(conn, chan, txom);
     txom = NULL;
     if (rc != 0) {
         goto err;
@@ -564,7 +566,7 @@ ble_att_svr_rx_find_info(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan,
 
 err:
     os_mbuf_free_chain(txom);
-    ble_att_svr_tx_error_rsp(chan, BLE_ATT_OP_FIND_INFO_REQ,
+    ble_att_svr_tx_error_rsp(conn, chan, BLE_ATT_OP_FIND_INFO_REQ,
                              req.bafq_start_handle, rc);
 
     return rc;
@@ -834,7 +836,7 @@ ble_att_svr_rx_find_type_value(struct ble_hs_conn *conn,
         goto err;
     }
 
-    rc = ble_l2cap_tx(chan, txom);
+    rc = ble_l2cap_tx(conn, chan, txom);
     txom = NULL;
     if (rc != 0) {
         rc = BLE_ATT_ERR_UNLIKELY;
@@ -845,8 +847,8 @@ ble_att_svr_rx_find_type_value(struct ble_hs_conn *conn,
 
 err:
     os_mbuf_free_chain(txom);
-    ble_att_svr_tx_error_rsp(chan, BLE_ATT_OP_FIND_TYPE_VALUE_REQ,
-                            req.bavq_start_handle, rc);
+    ble_att_svr_tx_error_rsp(conn, chan, BLE_ATT_OP_FIND_TYPE_VALUE_REQ,
+                             req.bavq_start_handle, rc);
     return rc;
 }
 
@@ -946,7 +948,7 @@ ble_att_svr_tx_read_type_rsp(struct ble_hs_conn *conn,
     assert(rc == 0);
 
     /* Transmit the response. */
-    rc = ble_l2cap_tx(chan, txom);
+    rc = ble_l2cap_tx(conn, chan, txom);
     txom = NULL;
     if (rc != 0) {
         rc = BLE_ATT_ERR_UNLIKELY;
@@ -957,7 +959,7 @@ ble_att_svr_tx_read_type_rsp(struct ble_hs_conn *conn,
 
 err:
     os_mbuf_free_chain(txom);
-    ble_att_svr_tx_error_rsp(chan, BLE_ATT_OP_READ_TYPE_REQ,
+    ble_att_svr_tx_error_rsp(conn, chan, BLE_ATT_OP_READ_TYPE_REQ,
                              req->batq_start_handle, rc);
     return rc;
 }
@@ -1041,7 +1043,7 @@ ble_att_svr_tx_read_rsp(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan,
         goto err;
     }
 
-    rc = ble_l2cap_tx(chan, txom);
+    rc = ble_l2cap_tx(conn, chan, txom);
     if (rc != 0) {
         rc = BLE_ATT_ERR_UNLIKELY;
         goto err;
@@ -1101,7 +1103,7 @@ ble_att_svr_rx_read(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan,
     return 0;
 
 err:
-    ble_att_svr_tx_error_rsp(chan, BLE_ATT_OP_READ_REQ,
+    ble_att_svr_tx_error_rsp(conn, chan, BLE_ATT_OP_READ_REQ,
                              req.barq_handle, rc);
     return rc;
 }
@@ -1126,7 +1128,7 @@ ble_att_svr_tx_write_rsp(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan)
     }
 
     *dst = BLE_ATT_OP_WRITE_RSP;
-    rc = ble_l2cap_tx(chan, txom);
+    rc = ble_l2cap_tx(conn, chan, txom);
     txom = NULL;
     if (rc != 0) {
         rc = BLE_ATT_ERR_UNLIKELY;
@@ -1189,8 +1191,8 @@ ble_att_svr_rx_write(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan,
     return 0;
 
 send_err:
-    ble_att_svr_tx_error_rsp(chan, BLE_ATT_OP_WRITE_REQ,
-                                req.bawq_handle, rc);
+    ble_att_svr_tx_error_rsp(conn, chan, BLE_ATT_OP_WRITE_REQ,
+                             req.bawq_handle, rc);
     return rc;
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/225b7f36/net/nimble/host/src/ble_gap_conn.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_gap_conn.c b/net/nimble/host/src/ble_gap_conn.c
index 51dfcd3..42fe3e4 100644
--- a/net/nimble/host/src/ble_gap_conn.c
+++ b/net/nimble/host/src/ble_gap_conn.c
@@ -34,6 +34,9 @@
 #define BLE_GAP_CONN_STATE_SLAVE_PARAMS_ACKED       2
 #define BLE_GAP_CONN_STATE_SLAVE_ENABLE_ACKED       3
 
+#define BLE_GAP_ADV_FAST_INTERVAL1_MIN      (30 * 1000 / BLE_HCI_ADV_ITVL)
+#define BLE_GAP_ADV_FAST_INTERVAL1_MAX      (60 * 1000 / BLE_HCI_ADV_ITVL)
+
 ble_gap_connect_fn *ble_gap_conn_cb;
 void *ble_gap_conn_arg;
 
@@ -215,9 +218,9 @@ ble_gap_conn_direct_advertise(int addr_type, uint8_t *addr)
         goto err;
     }
 
-    hap.adv_itvl_min = BLE_HCI_ADV_ITVL_DEF;
-    hap.adv_itvl_max = BLE_HCI_ADV_ITVL_DEF;
-    hap.adv_type = BLE_HCI_ADV_TYPE_ADV_DIRECT_IND_HD;
+    hap.adv_itvl_min = BLE_GAP_ADV_FAST_INTERVAL1_MIN;
+    hap.adv_itvl_max = BLE_GAP_ADV_FAST_INTERVAL1_MAX;
+    hap.adv_type = BLE_HCI_ADV_TYPE_ADV_IND;
     hap.own_addr_type = BLE_HCI_ADV_OWN_ADDR_PUBLIC;
     hap.peer_addr_type = addr_type;
     memcpy(hap.peer_addr, addr, sizeof hap.peer_addr);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/225b7f36/net/nimble/host/src/ble_gatt.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_gatt.c b/net/nimble/host/src/ble_gatt.c
index 9490b18..d8575c4 100644
--- a/net/nimble/host/src/ble_gatt.c
+++ b/net/nimble/host/src/ble_gatt.c
@@ -23,10 +23,10 @@
 #include "nimble/ble.h"
 #include "host/ble_gatt.h"
 #include "host/ble_hs.h"
-#include "ble_hs_uuid.h"
+#include "host/ble_hs_uuid.h"
 #include "ble_hs_conn.h"
 #include "ble_att_cmd.h"
-#include "ble_att.h"
+#include "ble_att_priv.h"
 
 #define BLE_ATT_UUID_PRIMARY_SERVICE    0x2800
 #define BLE_ATT_UUID_CHARACTERISTIC     0x2803

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/225b7f36/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 ff31260..b6800e3 100644
--- a/net/nimble/host/src/ble_hs.c
+++ b/net/nimble/host/src/ble_hs.c
@@ -17,10 +17,11 @@
 #include <errno.h>
 #include "util/tpq.h"
 #include "os/os.h"
+#include "nimble/hci_transport.h"
 #include "host/host_hci.h"
 #include "host/ble_gatt.h"
 #include "host/ble_hs.h"
-#include "ble_att.h"
+#include "ble_att_priv.h"
 #include "ble_hs_conn.h"
 #include "ble_hs_ack.h"
 #include "ble_hs_hci_batch.h"
@@ -48,7 +49,7 @@ static os_membuf_t g_hci_cmd_buf[OS_MEMPOOL_BYTES(HCI_CMD_BUFS,
 #define HCI_NUM_OS_EVENTS       (32)
 #define HCI_OS_EVENT_BUF_SIZE   (sizeof(struct os_event))
 
-#define BLE_HS_NUM_MBUFS             (16)
+#define BLE_HS_NUM_MBUFS             (8)
 #define BLE_HS_MBUF_BUF_SIZE         (256)
 #define BLE_HS_MBUF_MEMBLOCK_SIZE                                \
     (BLE_HS_MBUF_BUF_SIZE + sizeof(struct os_mbuf) +             \
@@ -93,6 +94,8 @@ ble_hs_process_tx_data_queue(void)
 
 #ifdef PHONY_TRANSPORT
         ble_hs_test_pkt_txed(pkt->bhp_om);
+#else
+        ble_hci_transport_host_acl_data_send(pkt->bhp_om);
 #endif
 
         os_memblock_put(&ble_hs_pkt_pool, pkt);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/225b7f36/net/nimble/host/src/ble_hs_conn.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hs_conn.c b/net/nimble/host/src/ble_hs_conn.c
index 7a7b9e7..ffed3a4 100644
--- a/net/nimble/host/src/ble_hs_conn.c
+++ b/net/nimble/host/src/ble_hs_conn.c
@@ -23,7 +23,7 @@
 #include "ble_l2cap.h"
 #include "ble_l2cap_sig.h"
 #include "ble_hs_conn.h"
-#include "ble_att.h"
+#include "ble_att_priv.h"
 
 #define BLE_HS_CONN_MAX         16
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/225b7f36/net/nimble/host/src/ble_hs_conn.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hs_conn.h b/net/nimble/host/src/ble_hs_conn.h
index fef560f..de75254 100644
--- a/net/nimble/host/src/ble_hs_conn.h
+++ b/net/nimble/host/src/ble_hs_conn.h
@@ -19,7 +19,7 @@
 
 #include "os/queue.h"
 #include "ble_l2cap.h"
-#include "ble_att.h"
+#include "ble_att_priv.h"
 struct hci_le_conn_complete;
 struct hci_create_conn;
 struct ble_l2cap_chan;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/225b7f36/net/nimble/host/src/ble_hs_uuid.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hs_uuid.c b/net/nimble/host/src/ble_hs_uuid.c
index e737344..fe2dfae 100644
--- a/net/nimble/host/src/ble_hs_uuid.c
+++ b/net/nimble/host/src/ble_hs_uuid.c
@@ -20,7 +20,7 @@
 #include <errno.h>
 #include "os/os_mbuf.h"
 #include "nimble/ble.h"
-#include "ble_hs_uuid.h"
+#include "host/ble_hs_uuid.h"
 
 static uint8_t ble_hs_uuid_base[16] = {
     0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/225b7f36/net/nimble/host/src/ble_hs_uuid.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hs_uuid.h b/net/nimble/host/src/ble_hs_uuid.h
deleted file mode 100644
index 1515a60..0000000
--- a/net/nimble/host/src/ble_hs_uuid.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Copyright (c) 2015 Runtime Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef H_BLE_HS_UUID_
-#define H_BLE_HS_UUID_
-
-struct os_mbuf;
-
-uint16_t ble_hs_uuid_16bit(void *uuid128);
-int ble_hs_uuid_from_16bit(uint16_t uuid16, void *dst);
-int ble_hs_uuid_append(struct os_mbuf *om, void *uuid128);
-int ble_hs_uuid_extract(struct os_mbuf *om, int off, void *uuid128);
-
-#endif /* _BLE_HOST_UUID_H */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/225b7f36/net/nimble/host/src/ble_l2cap.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_l2cap.c b/net/nimble/host/src/ble_l2cap.c
index b2a4795..2a4e81b 100644
--- a/net/nimble/host/src/ble_l2cap.c
+++ b/net/nimble/host/src/ble_l2cap.c
@@ -21,6 +21,7 @@
 #include "nimble/ble.h"
 #include "nimble/hci_common.h"
 #include "host/ble_hs.h"
+#include "host/host_hci.h"
 #include "ble_hs_conn.h"
 #include "ble_l2cap.h"
 
@@ -183,7 +184,8 @@ ble_l2cap_rx(struct ble_hs_conn *conn,
  * @return                      0 on success; nonzero on error.
  */
 int
-ble_l2cap_tx(struct ble_l2cap_chan *chan, struct os_mbuf *om)
+ble_l2cap_tx(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan,
+             struct os_mbuf *om)
 {
     int rc;
 
@@ -193,7 +195,7 @@ ble_l2cap_tx(struct ble_l2cap_chan *chan, struct os_mbuf *om)
         goto err;
     }
 
-    rc = ble_hs_tx_data(om);
+    rc = host_hci_data_tx(conn, om);
     if (rc != 0) {
         goto err;
     }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/225b7f36/net/nimble/host/src/ble_l2cap.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_l2cap.h b/net/nimble/host/src/ble_l2cap.h
index 7399ea7..f46d2b3 100644
--- a/net/nimble/host/src/ble_l2cap.h
+++ b/net/nimble/host/src/ble_l2cap.h
@@ -75,7 +75,8 @@ struct os_mbuf *ble_l2cap_prepend_hdr(struct os_mbuf *om, uint16_t cid);
 int ble_l2cap_rx(struct ble_hs_conn *connection,
                  struct hci_data_hdr *hci_hdr,
                  struct os_mbuf *om);
-int ble_l2cap_tx(struct ble_l2cap_chan *chan, struct os_mbuf *om);
+int ble_l2cap_tx(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan,
+                 struct os_mbuf *om);
 
 int ble_l2cap_init(void);
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/225b7f36/net/nimble/host/src/host_hci.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/host_hci.c b/net/nimble/host/src/host_hci.c
index bb82d94..67d3def 100644
--- a/net/nimble/host/src/host_hci.c
+++ b/net/nimble/host/src/host_hci.c
@@ -482,6 +482,9 @@ host_hci_data_hdr_prepend(struct os_mbuf *om, uint16_t handle, uint8_t pb_flag)
 
     memcpy(om->om_data, &hci_hdr, sizeof hci_hdr);
 
+    console_printf("host tx hci data; handle=%d length=%d\n", handle,
+                   le16toh(&hci_hdr.hdh_len));
+
     return om;
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/225b7f36/net/nimble/host/src/test/ble_att_clt_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_att_clt_test.c b/net/nimble/host/src/test/ble_att_clt_test.c
index bcb4fc9..83d3b49 100644
--- a/net/nimble/host/src/test/ble_att_clt_test.c
+++ b/net/nimble/host/src/test/ble_att_clt_test.c
@@ -20,7 +20,7 @@
 #include "nimble/ble.h"
 #include "host/ble_hs_test.h"
 #include "ble_hs_conn.h"
-#include "ble_att.h"
+#include "ble_att_priv.h"
 #include "ble_att_cmd.h"
 #include "ble_hs_test_util.h"
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/225b7f36/net/nimble/host/src/test/ble_att_svr_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_att_svr_test.c b/net/nimble/host/src/test/ble_att_svr_test.c
index 7ca324d..8b3aca1 100644
--- a/net/nimble/host/src/test/ble_att_svr_test.c
+++ b/net/nimble/host/src/test/ble_att_svr_test.c
@@ -24,7 +24,7 @@
 #include "ble_l2cap.h"
 #include "ble_hs_test_util.h"
 #include "ble_hs_conn.h"
-#include "ble_att.h"
+#include "ble_att_priv.h"
 #include "ble_att_cmd.h"
 
 static uint8_t *ble_att_svr_test_attr_r_1;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/225b7f36/net/nimble/host/src/test/ble_gatt_disc_c_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_gatt_disc_c_test.c b/net/nimble/host/src/test/ble_gatt_disc_c_test.c
index 31cb4a7..544fbfb 100644
--- a/net/nimble/host/src/test/ble_gatt_disc_c_test.c
+++ b/net/nimble/host/src/test/ble_gatt_disc_c_test.c
@@ -20,7 +20,7 @@
 #include "nimble/ble.h"
 #include "host/ble_hs_test.h"
 #include "host/ble_gatt.h"
-#include "ble_hs_uuid.h"
+#include "host/ble_hs_uuid.h"
 #include "ble_att_cmd.h"
 #include "ble_hs_conn.h"
 #include "ble_hs_test_util.h"

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/225b7f36/net/nimble/host/src/test/ble_gatt_disc_s_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_gatt_disc_s_test.c b/net/nimble/host/src/test/ble_gatt_disc_s_test.c
index b724a24..547f8ba 100644
--- a/net/nimble/host/src/test/ble_gatt_disc_s_test.c
+++ b/net/nimble/host/src/test/ble_gatt_disc_s_test.c
@@ -20,7 +20,7 @@
 #include "nimble/ble.h"
 #include "host/ble_hs_test.h"
 #include "host/ble_gatt.h"
-#include "ble_hs_uuid.h"
+#include "host/ble_hs_uuid.h"
 #include "ble_att_cmd.h"
 #include "ble_hs_conn.h"
 #include "ble_hs_test_util.h"

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/225b7f36/net/nimble/host/src/test/ble_gatt_read_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_gatt_read_test.c b/net/nimble/host/src/test/ble_gatt_read_test.c
index 9970402..0996ed6 100644
--- a/net/nimble/host/src/test/ble_gatt_read_test.c
+++ b/net/nimble/host/src/test/ble_gatt_read_test.c
@@ -20,7 +20,7 @@
 #include "nimble/ble.h"
 #include "host/ble_hs_test.h"
 #include "host/ble_gatt.h"
-#include "ble_hs_uuid.h"
+#include "host/ble_hs_uuid.h"
 #include "ble_att_cmd.h"
 #include "ble_hs_conn.h"
 #include "ble_hs_test_util.h"

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/225b7f36/net/nimble/host/src/test/ble_host_hci_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_host_hci_test.c b/net/nimble/host/src/test/ble_host_hci_test.c
index a536d78..14f7c6f 100644
--- a/net/nimble/host/src/test/ble_host_hci_test.c
+++ b/net/nimble/host/src/test/ble_host_hci_test.c
@@ -24,7 +24,7 @@
 #include "testutil/testutil.h"
 #include "ble_l2cap.h"
 #include "ble_hs_conn.h"
-#include "ble_att.h"
+#include "ble_att_priv.h"
 #include "ble_att_cmd.h"
 #include "ble_hs_test_util.h"
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/225b7f36/net/nimble/host/src/test/ble_hs_conn_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_hs_conn_test.c b/net/nimble/host/src/test/ble_hs_conn_test.c
index 0a876de..1cfbfc7 100644
--- a/net/nimble/host/src/test/ble_hs_conn_test.c
+++ b/net/nimble/host/src/test/ble_hs_conn_test.c
@@ -22,7 +22,7 @@
 #include "host/ble_hs_test.h"
 #include "host/host_hci.h"
 #include "ble_l2cap.h"
-#include "ble_att.h"
+#include "ble_att_priv.h"
 #include "ble_hs_conn.h"
 #include "ble_hs_ack.h"
 #include "ble_hs_hci_batch.h"

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/225b7f36/net/nimble/host/src/test/ble_hs_uuid_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_hs_uuid_test.c b/net/nimble/host/src/test/ble_hs_uuid_test.c
index ca9c239..0503db2 100644
--- a/net/nimble/host/src/test/ble_hs_uuid_test.c
+++ b/net/nimble/host/src/test/ble_hs_uuid_test.c
@@ -18,7 +18,7 @@
 #include <string.h>
 #include "host/ble_hs_test.h"
 #include "testutil/testutil.h"
-#include "ble_hs_uuid.h"
+#include "host/ble_hs_uuid.h"
 
 TEST_CASE(ble_hs_uuid_test_128_to_16)
 {



[2/2] incubator-mynewt-larva git commit: Fix ble host tests; I wasn't stripping the HCI hdr

Posted by cc...@apache.org.
Fix ble host tests; I wasn't stripping the HCI hdr


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

Branch: refs/heads/master
Commit: cc3af6efc6a516fb4a0cd27b37d9e549af997621
Parents: 225b7f3
Author: Christopher Collins <cc...@gmail.com>
Authored: Mon Dec 7 19:17:11 2015 -0800
Committer: Christopher Collins <cc...@gmail.com>
Committed: Mon Dec 7 19:17:11 2015 -0800

----------------------------------------------------------------------
 net/nimble/host/src/test/ble_att_svr_test.c | 2 +-
 net/nimble/host/src/test/ble_hs_test.c      | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/cc3af6ef/net/nimble/host/src/test/ble_att_svr_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_att_svr_test.c b/net/nimble/host/src/test/ble_att_svr_test.c
index 8b3aca1..73002e9 100644
--- a/net/nimble/host/src/test/ble_att_svr_test.c
+++ b/net/nimble/host/src/test/ble_att_svr_test.c
@@ -300,7 +300,7 @@ ble_att_svr_test_misc_verify_tx_find_type_value_rsp(
 
 static void
 ble_att_svr_test_misc_mtu_exchange(uint16_t my_mtu, uint16_t peer_sent,
-                                      uint16_t peer_actual, uint16_t chan_mtu)
+                                   uint16_t peer_actual, uint16_t chan_mtu)
 {
     struct ble_att_mtu_cmd req;
     struct ble_l2cap_chan *chan;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/cc3af6ef/net/nimble/host/src/test/ble_hs_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_hs_test.c b/net/nimble/host/src/test/ble_hs_test.c
index abe7e77..7724cd8 100644
--- a/net/nimble/host/src/test/ble_hs_test.c
+++ b/net/nimble/host/src/test/ble_hs_test.c
@@ -15,6 +15,7 @@
  */
 
 #include "os/os.h"
+#include "nimble/hci_common.h"
 #include "host/ble_hs.h"
 #include "host/ble_hs_test.h"
 #include "testutil/testutil.h"
@@ -27,8 +28,8 @@ ble_hs_test_pkt_txed(struct os_mbuf *om)
     os_mbuf_free_chain(ble_hs_test_util_prev_tx);
     ble_hs_test_util_prev_tx = om;
 
-    /* XXX: For now, just strip the L2CAP header. */
-    os_mbuf_adj(om, BLE_L2CAP_HDR_SZ);
+    /* XXX: For now, just strip the HCI ACL data and L2CAP headers. */
+    os_mbuf_adj(om, BLE_HCI_DATA_HDR_SZ + BLE_L2CAP_HDR_SZ);
 }
 
 #ifdef PKG_TEST