You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by we...@apache.org on 2015/11/06 23:25:59 UTC
[1/2] incubator-mynewt-larva git commit: Add connection files to
project (nothing implemented there yet)
Repository: incubator-mynewt-larva
Updated Branches:
refs/heads/master 3f2a8b0f0 -> ed00b2faa
Add connection files to project (nothing implemented there yet)
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/ed00b2fa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/tree/ed00b2fa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/diff/ed00b2fa
Branch: refs/heads/master
Commit: ed00b2faa7d0a1ffca0c7576eff5a12882a9e4fe
Parents: 2920d56
Author: Willam San Filippo <wi...@micosa.io>
Authored: Fri Nov 6 14:25:46 2015 -0800
Committer: Willam San Filippo <wi...@micosa.io>
Committed: Fri Nov 6 14:25:54 2015 -0800
----------------------------------------------------------------------
.../controller/include/controller/ble_ll_conn.h | 23 +++++
.../controller/include/controller/ble_ll_scan.h | 4 +-
net/nimble/controller/src/ble_ll_conn.c | 97 ++++++++++++++++++++
net/nimble/controller/src/ble_ll_hci.c | 5 +-
4 files changed, 124 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/ed00b2fa/net/nimble/controller/include/controller/ble_ll_conn.h
----------------------------------------------------------------------
diff --git a/net/nimble/controller/include/controller/ble_ll_conn.h b/net/nimble/controller/include/controller/ble_ll_conn.h
new file mode 100644
index 0000000..7c58b67
--- /dev/null
+++ b/net/nimble/controller/include/controller/ble_ll_conn.h
@@ -0,0 +1,23 @@
+/**
+ * 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_LL_CONN_
+#define H_BLE_LL_CONN_
+
+int ble_ll_conn_create(uint8_t *cmdbuf);
+int ble_ll_conn_create_cancel(void);
+
+#endif /* H_BLE_LL_CONN_ */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/ed00b2fa/net/nimble/controller/include/controller/ble_ll_scan.h
----------------------------------------------------------------------
diff --git a/net/nimble/controller/include/controller/ble_ll_scan.h b/net/nimble/controller/include/controller/ble_ll_scan.h
index 017680b..4349600 100644
--- a/net/nimble/controller/include/controller/ble_ll_scan.h
+++ b/net/nimble/controller/include/controller/ble_ll_scan.h
@@ -21,7 +21,7 @@
#define BLE_LL_SCAN_CFG_NUM_SCAN_RSP_ADVS (8)
/* Dont allow more than 255 of these entries */
-#if BLE_LL_SCAN_CFG_NUM_DUP_ADVSS > 255
+#if BLE_LL_SCAN_CFG_NUM_DUP_ADVS > 255
#error "Cannot have more than 255 duplicate entries!"
#endif
#if BLE_LL_SCAN_CFG_NUM_SCAN_RSP_ADVS > 255
@@ -86,4 +86,4 @@ void ble_ll_scan_rx_pdu_proc(uint8_t pdu_type, uint8_t *rxbuf, int8_t rssi,
/* Boolean function denoting whether or not the whitelist can be changed */
int ble_ll_scan_can_chg_whitelist(void);
-#endif /* H_LL_SCAN_ */
+#endif /* H_BLE_LL_SCAN_ */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/ed00b2fa/net/nimble/controller/src/ble_ll_conn.c
----------------------------------------------------------------------
diff --git a/net/nimble/controller/src/ble_ll_conn.c b/net/nimble/controller/src/ble_ll_conn.c
new file mode 100644
index 0000000..93c7bc4
--- /dev/null
+++ b/net/nimble/controller/src/ble_ll_conn.c
@@ -0,0 +1,97 @@
+/**
+ * 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.
+ */
+
+#include <stdint.h>
+#include <string.h>
+#include <assert.h>
+#include "bsp/bsp.h"
+#include "os/os.h"
+#include "nimble/ble.h"
+#include "nimble/hci_common.h"
+#include "controller/ble_ll_conn.h"
+
+int
+ble_ll_conn_create(uint8_t *cmdbuf)
+{
+ return BLE_ERR_SUCCESS;
+}
+
+int
+ble_ll_conn_create_cancel(void)
+{
+ return BLE_ERR_SUCCESS;
+}
+
+#if 0
+int
+ble_ll_scan_set_scan_params(uint8_t *cmd)
+{
+ uint8_t scan_type;
+ uint8_t own_addr_type;
+ uint8_t filter_policy;
+ uint16_t scan_itvl;
+ uint16_t scan_window;
+ struct ble_ll_scan_sm *scansm;
+
+ scansm = &g_ble_ll_scan_sm;
+
+ /* If already enabled, we return an error */
+ scansm = &g_ble_ll_scan_sm;
+ if (scansm->scan_enabled) {
+ return BLE_ERR_CMD_DISALLOWED;
+ }
+
+ /* Get the scan interval and window */
+ scan_type = cmd[0];
+ scan_itvl = le16toh(cmd + 1);
+ scan_window = le16toh(cmd + 3);
+ own_addr_type = cmd[5];
+ filter_policy = cmd[6];
+
+ /* Check scan type */
+ if ((scan_type != BLE_HCI_SCAN_TYPE_PASSIVE) &&
+ (scan_type != BLE_HCI_SCAN_TYPE_ACTIVE)) {
+ return BLE_ERR_INV_HCI_CMD_PARMS;
+ }
+
+ /* Check interval and window */
+ if ((scan_itvl < BLE_HCI_SCAN_ITVL_MIN) ||
+ (scan_itvl > BLE_HCI_SCAN_ITVL_MAX) ||
+ (scan_window < BLE_HCI_SCAN_WINDOW_MIN) ||
+ (scan_window > BLE_HCI_SCAN_WINDOW_MAX) ||
+ (scan_itvl < scan_window)) {
+ return BLE_ERR_INV_HCI_CMD_PARMS;
+ }
+
+ /* Check own addr type */
+ if (own_addr_type > BLE_HCI_ADV_OWN_ADDR_MAX) {
+ return BLE_ERR_INV_HCI_CMD_PARMS;
+ }
+
+ /* Check scanner filter policy */
+ if (filter_policy > BLE_HCI_SCAN_FILT_MAX) {
+ return BLE_ERR_INV_HCI_CMD_PARMS;
+ }
+
+ /* Set state machine parameters */
+ scansm->scan_type = scan_type;
+ scansm->scan_itvl = scan_itvl;
+ scansm->scan_window = scan_window;
+ scansm->scan_filt_policy = filter_policy;
+
+ return 0;
+}
+#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/ed00b2fa/net/nimble/controller/src/ble_ll_hci.c
----------------------------------------------------------------------
diff --git a/net/nimble/controller/src/ble_ll_hci.c b/net/nimble/controller/src/ble_ll_hci.c
index 468119a..e66c811 100644
--- a/net/nimble/controller/src/ble_ll_hci.c
+++ b/net/nimble/controller/src/ble_ll_hci.c
@@ -25,6 +25,7 @@
#include "controller/ble_ll.h"
#include "controller/ble_ll_hci.h"
#include "controller/ble_ll_whitelist.h"
+#include "controller/ble_ll_conn.h"
/* LE event mask */
uint8_t g_ble_ll_hci_le_event_mask[BLE_HCI_SET_LE_EVENT_MASK_LEN];
@@ -239,7 +240,6 @@ ble_ll_hci_le_cmd_proc(uint8_t *cmdbuf, uint16_t ocf, uint8_t *rsplen)
rc = ble_ll_scan_set_scan_params(cmdbuf);
}
break;
-#if 0
case BLE_HCI_OCF_LE_CREATE_CONN:
/* Length should be one byte */
if (len == BLE_HCI_CREATE_CONN_LEN) {
@@ -249,10 +249,9 @@ ble_ll_hci_le_cmd_proc(uint8_t *cmdbuf, uint16_t ocf, uint8_t *rsplen)
case BLE_HCI_OCF_LE_CREATE_CONN_CANCEL:
/* Length should be one byte */
if (len == 0) {
- rc = ble_ll_conn_create_cancel(cmdbuf);
+ rc = ble_ll_conn_create_cancel();
}
break;
-#endif
case BLE_HCI_OCF_LE_CLEAR_WHITE_LIST:
/* No params with this command */
if (len == 0) {
[2/2] incubator-mynewt-larva git commit: Set response length of hci
commands in the command processing functions themselves
Posted by we...@apache.org.
Set response length of hci commands in the command processing functions themselves
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/2920d569
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/tree/2920d569
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/diff/2920d569
Branch: refs/heads/master
Commit: 2920d569c69f297e5b1571fe46deda73a83f5fe2
Parents: 3f2a8b0
Author: Willam San Filippo <wi...@micosa.io>
Authored: Fri Nov 6 09:50:17 2015 -0800
Committer: Willam San Filippo <wi...@micosa.io>
Committed: Fri Nov 6 14:25:54 2015 -0800
----------------------------------------------------------------------
.../controller/include/controller/ble_ll_adv.h | 2 +-
.../include/controller/ble_ll_whitelist.h | 2 +-
net/nimble/controller/src/ble_ll_adv.c | 3 +-
net/nimble/controller/src/ble_ll_hci.c | 64 +++++++++++++++-----
net/nimble/controller/src/ble_ll_whitelist.c | 3 +-
net/nimble/include/nimble/hci_common.h | 46 ++++++++++----
project/bletest/src/main.c | 4 +-
7 files changed, 91 insertions(+), 33 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/2920d569/net/nimble/controller/include/controller/ble_ll_adv.h
----------------------------------------------------------------------
diff --git a/net/nimble/controller/include/controller/ble_ll_adv.h b/net/nimble/controller/include/controller/ble_ll_adv.h
index b7bca30..f460435 100644
--- a/net/nimble/controller/include/controller/ble_ll_adv.h
+++ b/net/nimble/controller/include/controller/ble_ll_adv.h
@@ -138,7 +138,7 @@ int ble_ll_adv_set_scan_rsp_data(uint8_t *cmd, uint8_t len);
int ble_ll_adv_set_adv_params(uint8_t *cmd);
/* Read advertising channel power */
-int ble_ll_adv_read_txpwr(uint8_t *rspbuf);
+int ble_ll_adv_read_txpwr(uint8_t *rspbuf, uint8_t *rsplen);
/*---- API used by BLE LL ----*/
/* Called when advertising tx done event posted to LL task */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/2920d569/net/nimble/controller/include/controller/ble_ll_whitelist.h
----------------------------------------------------------------------
diff --git a/net/nimble/controller/include/controller/ble_ll_whitelist.h b/net/nimble/controller/include/controller/ble_ll_whitelist.h
index 882f841..3c80839 100644
--- a/net/nimble/controller/include/controller/ble_ll_whitelist.h
+++ b/net/nimble/controller/include/controller/ble_ll_whitelist.h
@@ -23,7 +23,7 @@
int ble_ll_whitelist_clear(void);
/* Read the size of the whitelist */
-int ble_ll_whitelist_read_size(uint8_t *rspbuf);
+int ble_ll_whitelist_read_size(uint8_t *rspbuf, uint8_t *rsplen);
/* Add a device to the whitelist */
int ble_ll_whitelist_add(uint8_t *addr, uint8_t addr_type);
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/2920d569/net/nimble/controller/src/ble_ll_adv.c
----------------------------------------------------------------------
diff --git a/net/nimble/controller/src/ble_ll_adv.c b/net/nimble/controller/src/ble_ll_adv.c
index adab080..18af12d 100644
--- a/net/nimble/controller/src/ble_ll_adv.c
+++ b/net/nimble/controller/src/ble_ll_adv.c
@@ -630,9 +630,10 @@ ble_ll_adv_sm_start(struct ble_ll_adv_sm *advsm)
* @return int
*/
int
-ble_ll_adv_read_txpwr(uint8_t *rspbuf)
+ble_ll_adv_read_txpwr(uint8_t *rspbuf, uint8_t *rsplen)
{
rspbuf[0] = BLE_LL_CFG_ADV_TXPWR;
+ *rsplen = 1;
return BLE_ERR_SUCCESS;
}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/2920d569/net/nimble/controller/src/ble_ll_hci.c
----------------------------------------------------------------------
diff --git a/net/nimble/controller/src/ble_ll_hci.c b/net/nimble/controller/src/ble_ll_hci.c
index 8e6107c..468119a 100644
--- a/net/nimble/controller/src/ble_ll_hci.c
+++ b/net/nimble/controller/src/ble_ll_hci.c
@@ -85,22 +85,39 @@ ble_ll_hci_set_le_event_mask(uint8_t *cmdbuf)
}
/**
- * ll hci le read bufsize
- *
- * This is the function that processes the LE read buffer size command.
- *
- * Context: Link Layer task (HCI command parser)
+ * HCI read buffer size command. Returns the ACL data packet length and
+ * num data packets.
*
- * @param cmdbuf
+ * @param rspbuf Pointer to response buffer
+ * @param rsplen Length of response buffer
*
- * @return int
+ * @return int BLE error code
*/
static int
-ble_ll_hci_le_read_bufsize(uint8_t *rspbuf)
+ble_ll_hci_le_read_bufsize(uint8_t *rspbuf, uint8_t *rsplen)
{
/* Place the data packet length and number of packets in the buffer */
htole16(rspbuf, BLE_LL_CFG_ACL_DATA_PKT_LEN);
rspbuf[2] = BLE_LL_CFG_NUM_ACL_DATA_PKTS;
+ *rsplen = BLE_HCI_RD_BUF_SIZE_RSPLEN;
+ return BLE_ERR_SUCCESS;
+}
+
+/**
+ * HCI read local supported features command. Returns the features
+ * supported by the controller.
+ *
+ * @param rspbuf Pointer to response buffer
+ * @param rsplen Length of response buffer
+ *
+ * @return int BLE error code
+ */
+static int
+ble_ll_hci_le_read_local_features(uint8_t *rspbuf, uint8_t *rsplen)
+{
+ /* Add list of supported features. */
+ memset(rspbuf, 0, BLE_HCI_RD_LOC_SUPP_FEAT_RSPLEN);
+ *rsplen = BLE_HCI_RD_LOC_SUPP_FEAT_RSPLEN;
return BLE_ERR_SUCCESS;
}
@@ -169,11 +186,14 @@ ble_ll_hci_le_cmd_proc(uint8_t *cmdbuf, uint16_t ocf, uint8_t *rsplen)
break;
case BLE_HCI_OCF_LE_RD_BUF_SIZE:
if (len == BLE_HCI_RD_BUF_SIZE_LEN) {
- rc = ble_ll_hci_le_read_bufsize(rspbuf);
- *rsplen = 3;
+ rc = ble_ll_hci_le_read_bufsize(rspbuf, rsplen);
+ }
+ break;
+ case BLE_HCI_OCF_LE_RD_LOC_SUPP_FEAT:
+ if (len == 0) {
+ rc = ble_ll_hci_le_read_local_features(rspbuf, rsplen);
}
break;
-
case BLE_HCI_OCF_LE_SET_RAND_ADDR:
if (len == BLE_DEV_ADDR_LEN) {
rc = ble_ll_set_random_addr(cmdbuf);
@@ -186,9 +206,8 @@ ble_ll_hci_le_cmd_proc(uint8_t *cmdbuf, uint16_t ocf, uint8_t *rsplen)
}
break;
case BLE_HCI_OCF_LE_RD_ADV_CHAN_TXPWR:
- if (len == BLE_HCI_RD_BUF_SIZE_LEN) {
- rc = ble_ll_adv_read_txpwr(rspbuf);
- *rsplen = 1;
+ if (len == 0) {
+ rc = ble_ll_adv_read_txpwr(rspbuf, rsplen);
}
break;
case BLE_HCI_OCF_LE_SET_ADV_DATA:
@@ -220,6 +239,20 @@ ble_ll_hci_le_cmd_proc(uint8_t *cmdbuf, uint16_t ocf, uint8_t *rsplen)
rc = ble_ll_scan_set_scan_params(cmdbuf);
}
break;
+#if 0
+ case BLE_HCI_OCF_LE_CREATE_CONN:
+ /* Length should be one byte */
+ if (len == BLE_HCI_CREATE_CONN_LEN) {
+ rc = ble_ll_conn_create(cmdbuf);
+ }
+ break;
+ case BLE_HCI_OCF_LE_CREATE_CONN_CANCEL:
+ /* Length should be one byte */
+ if (len == 0) {
+ rc = ble_ll_conn_create_cancel(cmdbuf);
+ }
+ break;
+#endif
case BLE_HCI_OCF_LE_CLEAR_WHITE_LIST:
/* No params with this command */
if (len == 0) {
@@ -229,8 +262,7 @@ ble_ll_hci_le_cmd_proc(uint8_t *cmdbuf, uint16_t ocf, uint8_t *rsplen)
case BLE_HCI_OCF_LE_RD_WHITE_LIST_SIZE:
/* No params with this command */
if (len == 0) {
- rc = ble_ll_whitelist_read_size(rspbuf);
- *rsplen = 1;
+ rc = ble_ll_whitelist_read_size(rspbuf, rsplen);
}
break;
case BLE_HCI_OCF_LE_ADD_WHITE_LIST:
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/2920d569/net/nimble/controller/src/ble_ll_whitelist.c
----------------------------------------------------------------------
diff --git a/net/nimble/controller/src/ble_ll_whitelist.c b/net/nimble/controller/src/ble_ll_whitelist.c
index 5cfcf07..1cb15e8 100644
--- a/net/nimble/controller/src/ble_ll_whitelist.c
+++ b/net/nimble/controller/src/ble_ll_whitelist.c
@@ -95,13 +95,14 @@ ble_ll_whitelist_clear(void)
* @return int 0: success.
*/
int
-ble_ll_whitelist_read_size(uint8_t *rspbuf)
+ble_ll_whitelist_read_size(uint8_t *rspbuf, uint8_t *rsplen)
{
#ifdef BLE_USES_HW_WHITELIST
rspbuf[0] = ble_hw_whitelist_size();
#else
rspbuf[0] = BLE_LL_CFG_WHITELIST_SIZE;
#endif
+ *rsplen = 1;
return BLE_ERR_SUCCESS;
}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/2920d569/net/nimble/include/nimble/hci_common.h
----------------------------------------------------------------------
diff --git a/net/nimble/include/nimble/hci_common.h b/net/nimble/include/nimble/hci_common.h
index 17e0787..a0f877f 100644
--- a/net/nimble/include/nimble/hci_common.h
+++ b/net/nimble/include/nimble/hci_common.h
@@ -56,7 +56,7 @@
/* List of OCF for LE commands (OGF = 0x08) */
#define BLE_HCI_OCF_LE_SET_EVENT_MASK (0x0001)
#define BLE_HCI_OCF_LE_RD_BUF_SIZE (0x0002)
-#define BLE_HCI_OCF_LE_RD_SUPP_FEAT (0x0003)
+#define BLE_HCI_OCF_LE_RD_LOC_SUPP_FEAT (0x0003)
/* NOTE: 0x0004 is intentionally left undefined */
#define BLE_HCI_OCF_LE_SET_RAND_ADDR (0x0005)
#define BLE_HCI_OCF_LE_SET_ADV_PARAMS (0x0006)
@@ -66,13 +66,13 @@
#define BLE_HCI_OCF_LE_SET_ADV_ENABLE (0x000A)
#define BLE_HCI_OCF_LE_SET_SCAN_PARAMS (0x000B)
#define BLE_HCI_OCF_LE_SET_SCAN_ENABLE (0x000C)
-#define BLE_HCI_OCF_LE_CREATE_CNXN (0x000D)
-#define BLE_HCI_OCF_LE_CREATE_CNXN_CANCEL (0x000E)
+#define BLE_HCI_OCF_LE_CREATE_CONN (0x000D)
+#define BLE_HCI_OCF_LE_CREATE_CONN_CANCEL (0x000E)
#define BLE_HCI_OCF_LE_RD_WHITE_LIST_SIZE (0x000F)
#define BLE_HCI_OCF_LE_CLEAR_WHITE_LIST (0x0010)
#define BLE_HCI_OCF_LE_ADD_WHITE_LIST (0x0011)
#define BLE_HCI_OCF_LE_RMV_WHITE_LIST (0x0012)
-#define BLE_HCI_OCF_LE_CNXN_UPDATE (0x0013)
+#define BLE_HCI_OCF_LE_CONN_UPDATE (0x0013)
#define BLE_HCI_OCF_LE_SET_HOST_CHAN_CLASS (0x0014)
#define BLE_HCI_OCF_LE_RD_CHAN_MAP (0x0015)
#define BLE_HCI_OCF_LE_RD_REM_FEAT (0x0016)
@@ -85,8 +85,8 @@
#define BLE_HCI_OCF_LE_RX_TEST (0x001D)
#define BLE_HCI_OCF_LE_TX_TEST (0x001E)
#define BLE_HCI_OCF_LE_TEST_END (0x001F)
-#define BLE_HCI_OCF_LE_REM_CNXN_PARAM_RR (0x0020)
-#define BLE_HCI_OCF_LE_REM_CNXN_PARAM_NRR (0x0021)
+#define BLE_HCI_OCF_LE_REM_CONN_PARAM_RR (0x0020)
+#define BLE_HCI_OCF_LE_REM_CONN_PARAM_NRR (0x0021)
#define BLE_HCI_OCF_LE_SET_DATA_LEN (0x0022)
#define BLE_HCI_OCF_LE_RD_SUGG_DEF_DATA_LEN (0x0023)
#define BLE_HCI_OCF_LE_WR_SUGG_DEF_DATA_LEN (0x0024)
@@ -103,11 +103,15 @@
#define BLE_HCI_OCF_LE_RD_MAX_DATA_LEN (0x002F)
/* Command Specific Definitions */
-/* Set event mask */
+/*--- BLE_HCI_OCF_LE_SET_EVENT_MASK OCF 0x0001 ---*/
#define BLE_HCI_SET_LE_EVENT_MASK_LEN (8)
-/* Read buffer size */
+/*--- BLE_HCI_OCF_LE_RD_BUF_SIZE OCF 0x0002 ---*/
#define BLE_HCI_RD_BUF_SIZE_LEN (0)
+#define BLE_HCI_RD_BUF_SIZE_RSPLEN (3)
+
+/* Read local supported features*/
+#define BLE_HCI_RD_LOC_SUPP_FEAT_RSPLEN (8)
/* Set scan response data */
#define BLE_HCI_MAX_SCAN_RSP_DATA_LEN (31)
@@ -209,12 +213,15 @@
/* Whitelist commands */
#define BLE_HCI_CHG_WHITE_LIST_LEN (7)
+/* Create Connection */
+#define BLE_HCI_CREATE_CONN_LEN (25)
+
/* Event Codes */
#define BLE_HCI_EVCODE_INQUIRY_CMP (0x01)
#define BLE_HCI_EVCODE_INQUIRY_RESULT (0x02)
-#define BLE_HCI_EVCODE_CNXN_DONE (0x03)
-#define BLE_HCI_EVCODE_CNXN_REQUEST (0x04)
-#define BLE_HCI_EVCODE_DISCNXN_CMP (0x05)
+#define BLE_HCI_EVCODE_CONN_DONE (0x03)
+#define BLE_HCI_EVCODE_CONN_REQUEST (0x04)
+#define BLE_HCI_EVCODE_DISCONN_CMP (0x05)
#define BLE_HCI_EVCODE_AUTH_CMP (0x06)
#define BLE_HCI_EVCODE_REM_NAME_REQ_CM P (0x07)
#define BLE_HCI_EVCODE_ENCRYPT_CHG (0x08)
@@ -268,6 +275,23 @@ struct hci_adv_params
uint8_t peer_addr[BLE_DEV_ADDR_LEN];
};
+/* Create connection command */
+struct hci_create_conn
+{
+ uint16_t scan_itvl;
+ uint16_t scan_window;
+ uint8_t filter_policy;
+ uint8_t peer_addr_type;
+ uint8_t peer_addr[BLE_DEV_ADDR_LEN];
+ uint8_t own_addr_type;
+ uint16_t conn_itvl_min;
+ uint16_t conn_itvl_max;
+ uint16_t conn_latency;
+ uint16_t supervision_timeout;
+ uint16_t min_ce_len;
+ uint16_t max_ce_len;
+};
+
#define BLE_HCI_DATA_HDR_SZ 4
#define BLE_HCI_DATA_HANDLE(handle_pb_bc) (((handle_pb_bc) & 0x0fff) >> 0)
#define BLE_HCI_DATA_PB(handle_pb_bc) (((handle_pb_bc) & 0x3000) >> 12)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/2920d569/project/bletest/src/main.c
----------------------------------------------------------------------
diff --git a/project/bletest/src/main.c b/project/bletest/src/main.c
index b9ff2b9..934a625 100755
--- a/project/bletest/src/main.c
+++ b/project/bletest/src/main.c
@@ -208,8 +208,8 @@ bletest_init_scanner(void)
dev_addr[0] = 0x00;
dev_addr[1] = 0x00;
dev_addr[2] = 0x00;
- dev_addr[3] = 0x08;
- dev_addr[4] = 0x08;
+ dev_addr[3] = 0x88;
+ dev_addr[4] = 0x88;
dev_addr[5] = 0x08;
rc = host_hci_cmd_le_add_to_whitelist(dev_addr, BLE_ADDR_TYPE_PUBLIC);
assert(rc == 0);