mynewt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@apache.org
Subject [1/2] incubator-mynewt-larva git commit: Add connection files to project (nothing implemented there yet)
Date Fri, 06 Nov 2015 22:25:59 GMT
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 <will@micosa.io>
Authored: Fri Nov 6 14:25:46 2015 -0800
Committer: Willam San Filippo <will@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) {


Mime
View raw message