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/08/01 20:59:38 UTC

[1/8] incubator-mynewt-core git commit: updated lls location to host and new api

Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop 0de126ab9 -> 88e3cb60e


updated lls location to host and new api


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/b26285f2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/b26285f2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/b26285f2

Branch: refs/heads/develop
Commit: b26285f212e627d5e72cc95dcc8df0e7c2545d5a
Parents: d21530d
Author: Brian Giori <br...@gmail.com>
Authored: Wed Jul 27 16:22:25 2016 -0700
Committer: Brian Giori <br...@gmail.com>
Committed: Wed Jul 27 16:28:18 2016 -0700

----------------------------------------------------------------------
 .../lls/include/profiles/lls/ble_svc_lls.h      |  44 +++++
 net/nimble/host/profiles/lls/pkg.yml            |  31 +++
 net/nimble/host/profiles/lls/src/ble_svc_lls.c  | 187 +++++++++++++++++++
 .../profiles/include/profiles/ble_svc_lls.h     |  45 -----
 net/nimble/profiles/pkg.yml                     |  31 ---
 net/nimble/profiles/src/ble_svc_lls.c           | 166 ----------------
 6 files changed, 262 insertions(+), 242 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/b26285f2/net/nimble/host/profiles/lls/include/profiles/lls/ble_svc_lls.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/profiles/lls/include/profiles/lls/ble_svc_lls.h b/net/nimble/host/profiles/lls/include/profiles/lls/ble_svc_lls.h
new file mode 100644
index 0000000..964f8b5
--- /dev/null
+++ b/net/nimble/host/profiles/lls/include/profiles/lls/ble_svc_lls.h
@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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_SVC_LLS_
+#define H_BLE_SVC_LLS_
+
+struct ble_hs_cfg;
+
+#define BLE_SVC_LLS_UUID16                                  0x1803
+#define BLE_SVC_LLS_CHR_UUID16_ALERT_LEVEL                  0x2a06
+
+/* Alert level definitions */
+#define BLE_SVC_LLS_ALERT_LEVEL_NO_ALERT                    0
+#define BLE_SVC_LLS_ALERT_LEVEL_MILD_ALERT                  1
+#define BLE_SVC_LLS_ALERT_LEVEL_HIGH_ALERT                  2
+
+typedef int ble_svc_lls_event_fn(uint8_t alert_level); 
+
+uint8_t ble_svc_lls_alert_level_get(void);
+int ble_svc_lls_alert_level_set(uint8_t alert_level);
+void ble_svc_lls_on_gap_event(struct ble_gap_event *event, void *arg); 
+
+int ble_svc_lls_init(struct ble_hs_cfg *cfg, 
+                     uint8_t initial_alert_level,
+                     ble_svc_lls_event_fn *cb);
+
+#endif
+

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/b26285f2/net/nimble/host/profiles/lls/pkg.yml
----------------------------------------------------------------------
diff --git a/net/nimble/host/profiles/lls/pkg.yml b/net/nimble/host/profiles/lls/pkg.yml
new file mode 100644
index 0000000..5d951b6
--- /dev/null
+++ b/net/nimble/host/profiles/lls/pkg.yml
@@ -0,0 +1,31 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+#
+
+pkg.name: net/nimble/host/profiles/lls
+pkg.description: Link Loss Service adopted specification.
+pkg.author: "Apache Mynewt <de...@mynewt.incubator.apache.org>"
+pkg.homepage: "http://mynewt.apache.org/"
+pkg.keywords:
+    - ble 
+    - bluetooth
+    - lls
+    - nimble 
+
+pkg.deps:
+    - net/nimble/host

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/b26285f2/net/nimble/host/profiles/lls/src/ble_svc_lls.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/profiles/lls/src/ble_svc_lls.c b/net/nimble/host/profiles/lls/src/ble_svc_lls.c
new file mode 100644
index 0000000..f0fd6f1
--- /dev/null
+++ b/net/nimble/host/profiles/lls/src/ble_svc_lls.c
@@ -0,0 +1,187 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 <assert.h>
+#include <string.h>
+#include "host/ble_hs.h"
+#include "profiles/lls/ble_svc_lls.h"
+
+/* Callback function */
+ble_svc_lls_event_fn *cb_fn; 
+/* Alert level */
+uint8_t ble_svc_lls_alert_level;
+
+/* Write characteristic function */
+static int
+ble_svc_lls_chr_write(struct os_mbuf *om, uint16_t min_len, 
+                      uint16_t max_len, void *dst, 
+                      uint16_t *len);
+
+/* Access function */
+static int
+ble_svc_lls_access(uint16_t conn_handle, uint16_t attr_handle,
+                   struct ble_gatt_access_ctxt *ctxt, void *arg);
+
+static const struct ble_gatt_svc_def ble_svc_lls_defs[] = {
+    {
+        /*** Service: Link Loss Service (LLS). */
+        .type = BLE_GATT_SVC_TYPE_PRIMARY,
+        .uuid128 = BLE_UUID16(BLE_SVC_LLS_UUID16),
+        .characteristics = (struct ble_gatt_chr_def[]) { {
+            /*** Characteristic: Alert Level. */
+            .uuid128 = BLE_UUID16(BLE_SVC_LLS_CHR_UUID16_ALERT_LEVEL),
+            .access_cb = ble_svc_lls_access,
+            .flags = BLE_GATT_CHR_F_READ | BLE_GATT_CHR_F_WRITE,
+        }, {
+            0, /* No more characteristics in this service. */
+        } },
+    },
+
+    {
+        0, /* No more services. */
+    },
+};
+
+static int
+ble_svc_lls_chr_write(struct os_mbuf *om, uint16_t min_len, 
+                      uint16_t max_len, void *dst, 
+                      uint16_t *len)
+{
+    uint16_t om_len;
+    int rc; 
+
+    om_len = OS_MBUF_PKTLEN(om);
+    if (om_len < min_len || om_len > max_len) {
+        return BLE_ATT_ERR_INVALID_ATTR_VALUE_LEN;
+    }   
+
+    rc = ble_hs_mbuf_to_flat(om, dst, max_len, len);
+    if (rc != 0) {
+        return BLE_ATT_ERR_UNLIKELY;
+    }   
+
+    return 0;
+}
+
+/**
+ * Simple read/write access callback for the alert level
+ * characteristic.
+ */
+static int
+ble_svc_lls_access(uint16_t conn_handle, uint16_t attr_handle,
+                   struct ble_gatt_access_ctxt *ctxt, void *arg)
+{
+    assert(ctxt->chr == &ble_svc_lls_defs[0].characteristics[0]);
+    int rc;
+    switch(ctxt->op) {
+    case BLE_GATT_ACCESS_OP_READ_CHR:
+        rc = os_mbuf_append(ctxt->om, &ble_svc_lls_alert_level,
+                            sizeof ble_svc_lls_alert_level);
+        return rc == 0 ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES;
+
+    case BLE_GATT_ACCESS_OP_WRITE_CHR:
+        rc = ble_svc_lls_chr_write(ctxt->om, 
+                                sizeof ble_svc_lls_alert_level,
+                                sizeof ble_svc_lls_alert_level,
+                                &ble_svc_lls_alert_level, NULL);
+        return rc; 
+
+    default:
+        assert(0);
+        return BLE_ATT_ERR_UNLIKELY;
+    }
+
+    return 0;
+}
+
+/**
+ * This function is the crux of the link loss service. The application
+ * developer must call this function inside the gap event callback
+ * function when a BLE_GAP_EVENT_DISCONNECT event is received. Here,
+ * we then check if the disconnect reason is due to a timout, and if
+ * so, we call the ble_svc_lls_event_fn callback with the current 
+ * alert level. The actual alert implementation is left up to the 
+ * developer.
+ *
+ * @param event                 The BLE GAP event from the GAP event
+ *                                  callback.
+ * @param arg                   The BLE GAP event arg from the GAP
+ *                                  event callback.
+ */
+void
+ble_svc_lls_on_gap_event(struct ble_gap_event *event, void *arg) {
+    if(event->disconnect.reason == 
+                BLE_HS_HCI_ERR(BLE_ERR_CONN_SPVN_TMO)) {
+            cb_fn(ble_svc_lls_alert_level);
+    } 
+}
+
+/**
+ * Get the current alert level.
+ */
+uint8_t
+ble_svc_lls_alert_level_get(void)
+{
+    return ble_svc_lls_alert_level;
+}
+
+/**
+ * Set the current alert level.
+ */
+int
+ble_svc_lls_alert_level_set(uint8_t alert_level)
+{
+    if (alert_level > BLE_SVC_LLS_ALERT_LEVEL_HIGH_ALERT) {
+        return BLE_HS_EINVAL;
+    }
+    
+    memcpy(&ble_svc_lls_alert_level, &alert_level, 
+            sizeof alert_level);
+
+    return 0;
+}
+
+/**
+ * Initialize the LLS. The developer must specify the event function
+ * callback for the LLS to function properly.
+ */
+int
+ble_svc_lls_init(struct ble_hs_cfg *cfg, uint8_t initial_alert_level,
+                 ble_svc_lls_event_fn *cb)
+{
+    if (!cb) {
+        return BLE_HS_EINVAL;
+    }
+    
+    ble_svc_lls_alert_level = initial_alert_level;
+    cb_fn = cb;
+
+    int rc;
+    rc = ble_gatts_count_cfg(ble_svc_lls_defs, cfg);
+    if (rc != 0) {
+        return rc;
+    }
+
+    rc = ble_gatts_add_svcs(ble_svc_lls_defs);
+    if (rc != 0) {
+        return rc;
+    }
+    
+    return 0;
+}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/b26285f2/net/nimble/profiles/include/profiles/ble_svc_lls.h
----------------------------------------------------------------------
diff --git a/net/nimble/profiles/include/profiles/ble_svc_lls.h b/net/nimble/profiles/include/profiles/ble_svc_lls.h
deleted file mode 100644
index dfc7878..0000000
--- a/net/nimble/profiles/include/profiles/ble_svc_lls.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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_SVC_LLS_
-#define H_BLE_SVC_LLS_
-
-struct ble_hs_cfg;
-
-#define BLE_SVC_LLS_UUID16                                  0x1803
-#define BLE_SVC_LLS_CHR_UUID16_ALERT_LEVEL                  0x2a06
-
-/* Alert level definitions */
-#define BLE_SVC_LLS_ALERT_LEVEL_NO_ALERT                    0
-#define BLE_SVC_LLS_ALERT_LEVEL_MILD_ALERT                  1
-#define BLE_SVC_LLS_ALERT_LEVEL_HIGH_ALERT                  2
-
-typedef int ble_svc_lls_event_fn(uint8_t alert_level); 
-
-uint8_t ble_svc_lls_alert_level_get(void);
-uint8_t ble_svc_lls_alert_level_set(uint8_t alert_level);
-void ble_svc_lls_on_gap_event(struct ble_gap_event *event, void *arg); 
-
-int ble_svc_lls_register(void);
-int ble_svc_lls_init(struct ble_hs_cfg *cfg, 
-                     uint8_t initial_alert_level,
-                     ble_svc_lls_event_fn *cb);
-
-#endif
-

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/b26285f2/net/nimble/profiles/pkg.yml
----------------------------------------------------------------------
diff --git a/net/nimble/profiles/pkg.yml b/net/nimble/profiles/pkg.yml
deleted file mode 100644
index 89cd9d4..0000000
--- a/net/nimble/profiles/pkg.yml
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you 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.
-#
-
-pkg.name: net/nimble/profiles
-pkg.description: Adopted profiles/services of the nimble Bluetooth Smart stack.
-pkg.author: "Apache Mynewt <de...@mynewt.incubator.apache.org>"
-pkg.homepage: "http://mynewt.apache.org/"
-pkg.keywords:
-    - ble 
-    - bluetooth
-
-pkg.deps:
-    - sys/stats
-    - libs/os
-    - net/nimble

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/b26285f2/net/nimble/profiles/src/ble_svc_lls.c
----------------------------------------------------------------------
diff --git a/net/nimble/profiles/src/ble_svc_lls.c b/net/nimble/profiles/src/ble_svc_lls.c
deleted file mode 100644
index fdfe377..0000000
--- a/net/nimble/profiles/src/ble_svc_lls.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 <assert.h>
-#include <string.h>
-#include "host/ble_hs.h"
-#include "profiles/ble_svc_lls.h"
-
-/* Callback function */
-ble_svc_lls_event_fn *cb_fn; 
-/* Alert level */
-uint8_t ble_svc_lls_alert_level;
-
-/* Access function */
-static int
-ble_svc_lls_access(uint16_t conn_handle, uint16_t attr_handle,
-                   struct ble_gatt_access_ctxt *ctxt, void *arg);
-
-static const struct ble_gatt_svc_def ble_svc_lls_defs[] = {
-    {
-        /*** Service: Link Loss Service (LLS). */
-        .type = BLE_GATT_SVC_TYPE_PRIMARY,
-        .uuid128 = BLE_UUID16(BLE_SVC_LLS_UUID16),
-        .characteristics = (struct ble_gatt_chr_def[]) { {
-            /*** Characteristic: Alert Level. */
-            .uuid128 = BLE_UUID16(BLE_SVC_LLS_CHR_UUID16_ALERT_LEVEL),
-            .access_cb = ble_svc_lls_access,
-            .flags = BLE_GATT_CHR_F_READ | BLE_GATT_CHR_F_WRITE,
-        }, {
-            0, /* No more characteristics in this service. */
-        } },
-    },
-
-    {
-        0, /* No more services. */
-    },
-};
-
-/**
- * Simple read/write access callback for the alert level
- * characteristic.
- */
-static int
-ble_svc_lls_access(uint16_t conn_handle, uint16_t attr_handle,
-                   struct ble_gatt_access_ctxt *ctxt, void *arg)
-{
-    assert(ctxt->chr == &ble_svc_lls_defs[0].characteristics[0]);
-    switch(ctxt->op) {
-    case BLE_GATT_ACCESS_OP_READ_CHR:
-        ctxt->att->read.data = &ble_svc_lls_alert_level;
-        ctxt->att->read.len = sizeof ble_svc_lls_alert_level;
-        break;
-
-    case BLE_GATT_ACCESS_OP_WRITE_CHR:
-        if (ctxt->att->write.len != sizeof ble_svc_lls_alert_level) {
-            return BLE_ATT_ERR_INVALID_ATTR_VALUE_LEN;
-        }
-        memcpy(&ble_svc_lls_alert_level, ctxt->att->write.data, 
-            sizeof ble_svc_lls_alert_level);
-        break;
-
-    default:
-        assert(0);
-        break;
-    }
-
-    return 0;
-}
-
-/**
- * This function is the crux of the link loss service. The application
- * developer must call this function inside the gap event callback
- * function when a BLE_GAP_EVENT_DISCONNECT event is received. Here,
- * we then check if the disconnect reason is due to a timout, and if
- * so, we call the ble_svc_lls_event_fn callback with the current 
- * alert level. The actual alert implementation is left up to the 
- * developer.
- *
- * @param event                 The BLE GAP event from the GAP event
- *                                  callback.
- * @param arg                   The BLE GAP event arg from the GAP
- *                                  event callback.
- */
-void
-ble_svc_lls_on_gap_event(struct ble_gap_event *event, void *arg) {
-    if(event->disconnect.reason == 
-                BLE_HS_HCI_ERR(BLE_ERR_CONN_SPVN_TMO)) {
-            cb_fn(ble_svc_lls_alert_level);
-    } 
-}
-
-/**
- * Get the current alert level.
- */
-uint8_t
-ble_svc_lls_alert_level_get(void)
-{
-    return ble_svc_lls_alert_level;
-}
-
-/**
- * Set the current alert level.
- */
-int
-ble_svc_lls_alert_level_set(uint8_t alert_level)
-{
-    if (alert_level > BLE_SVC_LLS_ALERT_LEVEL_HIGH_ALERT) {
-        return BLE_HS_EINVAL;
-    }
-    
-    memcpy(&ble_svc_lls_alert_level, &alert_level, 
-            sizeof alert_level);
-
-    return 0;
-}
-
-/**
- * Registers the LLS with the GATT server.
- */
-int
-ble_svc_lls_register(void)
-{
-    int rc;
-
-    rc = ble_gatts_register_svcs(ble_svc_lls_defs, NULL, NULL);
-    return rc;
-}
-
-/**
- * Initialize the LLS. The developer must specify the event function
- * callback for the LLS to function properly.
- */
-int
-ble_svc_lls_init(struct ble_hs_cfg *cfg, uint8_t initial_alert_level,
-                 ble_svc_lls_event_fn *cb)
-{
-    if (*cb) {
-        return BLE_HS_EINVAL;
-    }
-    ble_svc_lls_alert_level = initial_alert_level;
-    cb_fn = cb;
-
-    int rc;
-    rc = ble_gatts_count_cfg(ble_svc_lls_defs, cfg);
-    if (rc != 0) {
-        return rc;
-    }
-
-    return 0;
-}


[7/8] incubator-mynewt-core git commit: renamed on_gap_event to on_gap_disconnect to better describe functionality

Posted by cc...@apache.org.
renamed on_gap_event to on_gap_disconnect to better describe functionality


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/47b95528
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/47b95528
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/47b95528

Branch: refs/heads/develop
Commit: 47b955283e585fd8363ce22d33863cffba09be73
Parents: 4f13d68
Author: Brian Giori <br...@gmail.com>
Authored: Fri Jul 29 09:46:08 2016 -0700
Committer: Brian Giori <br...@gmail.com>
Committed: Fri Jul 29 09:46:08 2016 -0700

----------------------------------------------------------------------
 net/nimble/host/profiles/lls/include/profiles/lls/ble_svc_lls.h | 2 +-
 net/nimble/host/profiles/lls/src/ble_svc_lls.c                  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/47b95528/net/nimble/host/profiles/lls/include/profiles/lls/ble_svc_lls.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/profiles/lls/include/profiles/lls/ble_svc_lls.h b/net/nimble/host/profiles/lls/include/profiles/lls/ble_svc_lls.h
index 637dec8..8dee779 100644
--- a/net/nimble/host/profiles/lls/include/profiles/lls/ble_svc_lls.h
+++ b/net/nimble/host/profiles/lls/include/profiles/lls/ble_svc_lls.h
@@ -34,7 +34,7 @@ typedef int ble_svc_lls_event_fn(uint8_t alert_level);
 
 uint8_t ble_svc_lls_alert_level_get(void);
 int ble_svc_lls_alert_level_set(uint8_t alert_level);
-void ble_svc_lls_on_gap_event(int reason); 
+void ble_svc_lls_on_gap_disconnect(int reason); 
 
 int ble_svc_lls_init(struct ble_hs_cfg *cfg, 
                      uint8_t initial_alert_level,

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/47b95528/net/nimble/host/profiles/lls/src/ble_svc_lls.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/profiles/lls/src/ble_svc_lls.c b/net/nimble/host/profiles/lls/src/ble_svc_lls.c
index 9a8e9db..c4be140 100644
--- a/net/nimble/host/profiles/lls/src/ble_svc_lls.c
+++ b/net/nimble/host/profiles/lls/src/ble_svc_lls.c
@@ -129,7 +129,7 @@ ble_svc_lls_access(uint16_t conn_handle, uint16_t attr_handle,
  *                              event.
  */
 void
-ble_svc_lls_on_gap_event(int reason)
+ble_svc_lls_on_gap_disconnect(int reason)
 {
     if (reason == BLE_HS_HCI_ERR(BLE_ERR_CONN_SPVN_TMO)) {
             cb_fn(ble_svc_lls_alert_level);


[4/8] incubator-mynewt-core git commit: coding standard and on_gap_event changes.

Posted by cc...@apache.org.
coding standard and on_gap_event changes.


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/5a7d18c1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/5a7d18c1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/5a7d18c1

Branch: refs/heads/develop
Commit: 5a7d18c13b6011f4e9292456ab945a948c5b5d6b
Parents: b26285f
Author: Brian Giori <br...@gmail.com>
Authored: Thu Jul 28 14:06:00 2016 -0700
Committer: Brian Giori <br...@gmail.com>
Committed: Thu Jul 28 14:06:00 2016 -0700

----------------------------------------------------------------------
 net/nimble/host/profiles/lls/src/ble_svc_lls.c | 42 ++++++++++++---------
 1 file changed, 24 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5a7d18c1/net/nimble/host/profiles/lls/src/ble_svc_lls.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/profiles/lls/src/ble_svc_lls.c b/net/nimble/host/profiles/lls/src/ble_svc_lls.c
index f0fd6f1..fca59fa 100644
--- a/net/nimble/host/profiles/lls/src/ble_svc_lls.c
+++ b/net/nimble/host/profiles/lls/src/ble_svc_lls.c
@@ -23,9 +23,9 @@
 #include "profiles/lls/ble_svc_lls.h"
 
 /* Callback function */
-ble_svc_lls_event_fn *cb_fn; 
+static ble_svc_lls_event_fn *cb_fn; 
 /* Alert level */
-uint8_t ble_svc_lls_alert_level;
+static uint8_t ble_svc_lls_alert_level;
 
 /* Write characteristic function */
 static int
@@ -89,7 +89,7 @@ ble_svc_lls_access(uint16_t conn_handle, uint16_t attr_handle,
 {
     assert(ctxt->chr == &ble_svc_lls_defs[0].characteristics[0]);
     int rc;
-    switch(ctxt->op) {
+    switch (ctxt->op) {
     case BLE_GATT_ACCESS_OP_READ_CHR:
         rc = os_mbuf_append(ctxt->om, &ble_svc_lls_alert_level,
                             sizeof ble_svc_lls_alert_level);
@@ -97,9 +97,9 @@ ble_svc_lls_access(uint16_t conn_handle, uint16_t attr_handle,
 
     case BLE_GATT_ACCESS_OP_WRITE_CHR:
         rc = ble_svc_lls_chr_write(ctxt->om, 
-                                sizeof ble_svc_lls_alert_level,
-                                sizeof ble_svc_lls_alert_level,
-                                &ble_svc_lls_alert_level, NULL);
+                                   sizeof ble_svc_lls_alert_level,
+                                   sizeof ble_svc_lls_alert_level,
+                                   &ble_svc_lls_alert_level, NULL);
         return rc; 
 
     default:
@@ -113,27 +113,27 @@ ble_svc_lls_access(uint16_t conn_handle, uint16_t attr_handle,
 /**
  * This function is the crux of the link loss service. The application
  * developer must call this function inside the gap event callback
- * function when a BLE_GAP_EVENT_DISCONNECT event is received. Here,
- * we then check if the disconnect reason is due to a timout, and if
+ * function when a BLE_GAP_EVENT_DISCONNECT event is received and
+ * pass the disconnect reason into this function. 
+ * 
+ * Here, we then check if the disconnect reason is due to a timout, and if
  * so, we call the ble_svc_lls_event_fn callback with the current 
  * alert level. The actual alert implementation is left up to the 
  * developer.
  *
- * @param event                 The BLE GAP event from the GAP event
- *                                  callback.
- * @param arg                   The BLE GAP event arg from the GAP
- *                                  event callback.
+ * @param reason            The reason attatched to the GAP disconnect
+ *                              event.
  */
 void
-ble_svc_lls_on_gap_event(struct ble_gap_event *event, void *arg) {
-    if(event->disconnect.reason == 
-                BLE_HS_HCI_ERR(BLE_ERR_CONN_SPVN_TMO)) {
+ble_svc_lls_on_gap_event(int reason)
+{
+    if (reason == BLE_HS_HCI_ERR(BLE_ERR_CONN_SPVN_TMO)) {
             cb_fn(ble_svc_lls_alert_level);
     } 
 }
 
 /**
- * Get the current alert level.
+ * Gets the current alert level.
  */
 uint8_t
 ble_svc_lls_alert_level_get(void)
@@ -142,7 +142,8 @@ ble_svc_lls_alert_level_get(void)
 }
 
 /**
- * Set the current alert level.
+ * Sets the current alert level. Returns 0 on success and
+ * BLE_HS_EINVAL if the given alert level is not valid.
  */
 int
 ble_svc_lls_alert_level_set(uint8_t alert_level)
@@ -152,7 +153,7 @@ ble_svc_lls_alert_level_set(uint8_t alert_level)
     }
     
     memcpy(&ble_svc_lls_alert_level, &alert_level, 
-            sizeof alert_level);
+           sizeof alert_level);
 
     return 0;
 }
@@ -160,6 +161,11 @@ ble_svc_lls_alert_level_set(uint8_t alert_level)
 /**
  * Initialize the LLS. The developer must specify the event function
  * callback for the LLS to function properly.
+ *
+ * @param initial_alert_level       The initial alert value to set
+ * @param cb                        The callback function to call when 
+ *                                      connection has been lost due to 
+ *                                      link loss
  */
 int
 ble_svc_lls_init(struct ble_hs_cfg *cfg, uint8_t initial_alert_level,


[6/8] incubator-mynewt-core git commit: added doxygen style comments

Posted by cc...@apache.org.
added doxygen style comments


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/4f13d680
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/4f13d680
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/4f13d680

Branch: refs/heads/develop
Commit: 4f13d6804c44c4f39a75ee1049ea3977e57063d3
Parents: 5d4620e
Author: Brian Giori <br...@gmail.com>
Authored: Thu Jul 28 14:26:47 2016 -0700
Committer: Brian Giori <br...@gmail.com>
Committed: Thu Jul 28 14:26:47 2016 -0700

----------------------------------------------------------------------
 net/nimble/host/profiles/lls/src/ble_svc_lls.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/4f13d680/net/nimble/host/profiles/lls/src/ble_svc_lls.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/profiles/lls/src/ble_svc_lls.c b/net/nimble/host/profiles/lls/src/ble_svc_lls.c
index fca59fa..9a8e9db 100644
--- a/net/nimble/host/profiles/lls/src/ble_svc_lls.c
+++ b/net/nimble/host/profiles/lls/src/ble_svc_lls.c
@@ -58,6 +58,10 @@ static const struct ble_gatt_svc_def ble_svc_lls_defs[] = {
     },
 };
 
+/**
+ * Writes the received value from a characteristic write to 
+ * the given destination.
+ */
 static int
 ble_svc_lls_chr_write(struct os_mbuf *om, uint16_t min_len, 
                       uint16_t max_len, void *dst, 
@@ -134,6 +138,8 @@ ble_svc_lls_on_gap_event(int reason)
 
 /**
  * Gets the current alert level.
+ *
+ * @return The current alert level
  */
 uint8_t
 ble_svc_lls_alert_level_get(void)
@@ -142,8 +148,9 @@ ble_svc_lls_alert_level_get(void)
 }
 
 /**
- * Sets the current alert level. Returns 0 on success and
- * BLE_HS_EINVAL if the given alert level is not valid.
+ * Sets the current alert level. 
+ *
+ * @return 0 on success, BLE_HS_EINVAL if the given alert level is not valid.
  */
 int
 ble_svc_lls_alert_level_set(uint8_t alert_level)


[3/8] incubator-mynewt-core git commit: Added the profiles dir. Added Link Lost Service

Posted by cc...@apache.org.
Added the profiles dir. Added Link Lost Service


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/e91a0d98
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/e91a0d98
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/e91a0d98

Branch: refs/heads/develop
Commit: e91a0d980ef892f57dbe941ebdb6988958fd5917
Parents: a0810f7
Author: Brian Giori <br...@gmail.com>
Authored: Thu Jul 21 19:05:04 2016 -0700
Committer: Brian Giori <br...@gmail.com>
Committed: Wed Jul 27 16:28:18 2016 -0700

----------------------------------------------------------------------
 .../profiles/include/profiles/ble_svc_lls.h     |  45 +++++
 net/nimble/profiles/pkg.yml                     |  31 ++++
 net/nimble/profiles/src/ble_svc_lls.c           | 166 +++++++++++++++++++
 3 files changed, 242 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/e91a0d98/net/nimble/profiles/include/profiles/ble_svc_lls.h
----------------------------------------------------------------------
diff --git a/net/nimble/profiles/include/profiles/ble_svc_lls.h b/net/nimble/profiles/include/profiles/ble_svc_lls.h
new file mode 100644
index 0000000..dfc7878
--- /dev/null
+++ b/net/nimble/profiles/include/profiles/ble_svc_lls.h
@@ -0,0 +1,45 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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_SVC_LLS_
+#define H_BLE_SVC_LLS_
+
+struct ble_hs_cfg;
+
+#define BLE_SVC_LLS_UUID16                                  0x1803
+#define BLE_SVC_LLS_CHR_UUID16_ALERT_LEVEL                  0x2a06
+
+/* Alert level definitions */
+#define BLE_SVC_LLS_ALERT_LEVEL_NO_ALERT                    0
+#define BLE_SVC_LLS_ALERT_LEVEL_MILD_ALERT                  1
+#define BLE_SVC_LLS_ALERT_LEVEL_HIGH_ALERT                  2
+
+typedef int ble_svc_lls_event_fn(uint8_t alert_level); 
+
+uint8_t ble_svc_lls_alert_level_get(void);
+uint8_t ble_svc_lls_alert_level_set(uint8_t alert_level);
+void ble_svc_lls_on_gap_event(struct ble_gap_event *event, void *arg); 
+
+int ble_svc_lls_register(void);
+int ble_svc_lls_init(struct ble_hs_cfg *cfg, 
+                     uint8_t initial_alert_level,
+                     ble_svc_lls_event_fn *cb);
+
+#endif
+

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/e91a0d98/net/nimble/profiles/pkg.yml
----------------------------------------------------------------------
diff --git a/net/nimble/profiles/pkg.yml b/net/nimble/profiles/pkg.yml
new file mode 100644
index 0000000..89cd9d4
--- /dev/null
+++ b/net/nimble/profiles/pkg.yml
@@ -0,0 +1,31 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+#
+
+pkg.name: net/nimble/profiles
+pkg.description: Adopted profiles/services of the nimble Bluetooth Smart stack.
+pkg.author: "Apache Mynewt <de...@mynewt.incubator.apache.org>"
+pkg.homepage: "http://mynewt.apache.org/"
+pkg.keywords:
+    - ble 
+    - bluetooth
+
+pkg.deps:
+    - sys/stats
+    - libs/os
+    - net/nimble

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/e91a0d98/net/nimble/profiles/src/ble_svc_lls.c
----------------------------------------------------------------------
diff --git a/net/nimble/profiles/src/ble_svc_lls.c b/net/nimble/profiles/src/ble_svc_lls.c
new file mode 100644
index 0000000..e94f192
--- /dev/null
+++ b/net/nimble/profiles/src/ble_svc_lls.c
@@ -0,0 +1,166 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 <assert.h>
+#include <string.h>
+#include "host/ble_hs.h"
+#include "profiles/ble_svc_lls.h"
+
+/* Callback function */
+ble_svc_lls_event_fn *cb_fn; 
+/* Alert level */
+uint8_t ble_svc_lls_alert_level;
+
+/* Access function */
+static int
+ble_svc_lls_access(uint16_t conn_handle, uint16_t attr_handle,
+                   struct ble_gatt_access_ctxt *ctxt, void *arg);
+
+static const struct ble_gatt_svc_def ble_svc_lls_defs[] = {
+    {
+        /*** Service: Link Lost Service (LLS). */
+        .type = BLE_GATT_SVC_TYPE_PRIMARY,
+        .uuid128 = BLE_UUID16(BLE_SVC_LLS_UUID16),
+        .characteristics = (struct ble_gatt_chr_def[]) { {
+            /*** Characteristic: Alert Level. */
+            .uuid128 = BLE_UUID16(BLE_SVC_LLS_CHR_UUID16_ALERT_LEVEL),
+            .access_cb = ble_svc_lls_access,
+            .flags = BLE_GATT_CHR_F_READ | BLE_GATT_CHR_F_WRITE,
+        }, {
+            0, /* No more characteristics in this service. */
+        } },
+    },
+
+    {
+        0, /* No more services. */
+    },
+};
+
+/**
+ * Simple read/write access callback for the alert level
+ * characteristic.
+ */
+static int
+ble_svc_lls_access(uint16_t conn_handle, uint16_t attr_handle,
+                   struct ble_gatt_access_ctxt *ctxt, void *arg)
+{
+    assert(ctxt->chr == &ble_svc_lls_defs[0].characteristics[0]);
+    switch(ctxt->op) {
+    case BLE_GATT_ACCESS_OP_READ_CHR:
+        ctxt->att->read.data = &ble_svc_lls_alert_level;
+        ctxt->att->read.len = sizeof ble_svc_lls_alert_level;
+        break;
+
+    case BLE_GATT_ACCESS_OP_WRITE_CHR:
+        if (ctxt->att->write.len != sizeof ble_svc_lls_alert_level) {
+            return BLE_ATT_ERR_INVALID_ATTR_VALUE_LEN;
+        }
+        memcpy(&ble_svc_lls_alert_level, ctxt->att->write.data, 
+            sizeof ble_svc_lls_alert_level);
+        break;
+
+    default:
+        assert(0);
+        break;
+    }
+
+    return 0;
+}
+
+/**
+ * This function is the crux of the link lost service. The application
+ * developer must call this function inside the gap event callback
+ * function when a BLE_GAP_EVENT_DISCONNECT event is received. Here,
+ * we then check if the disconnect reason is due to a timout, and if
+ * so, we call the ble_svc_lls_event_fn callback with the current 
+ * alert level. The actual alert implementation is left up to the 
+ * developer.
+ *
+ * @param event                 The BLE GAP event from the GAP event
+ *                                  callback.
+ * @param arg                   The BLE GAP event arg from the GAP
+ *                                  event callback.
+ */
+void
+ble_svc_lls_on_gap_event(struct ble_gap_event *event, void *arg) {
+    if(event->disconnect.reason == 
+                BLE_HS_HCI_ERR(BLE_ERR_CONN_SPVN_TMO)) {
+            cb_fn(ble_svc_lls_alert_level);
+    } 
+}
+
+/**
+ * Get the current alert level.
+ */
+uint8_t
+ble_svc_lls_alert_level_get(void)
+{
+    return ble_svc_lls_alert_level;
+}
+
+/**
+ * Set the current alert level.
+ */
+int
+ble_svc_lls_alert_level_set(uint8_t alert_level)
+{
+    if (alert_level > BLE_SVC_LLS_ALERT_LEVEL_HIGH_ALERT) {
+        return BLE_HS_EINVAL;
+    }
+    
+    memcpy(&ble_svc_lls_alert_level, &alert_level, 
+            sizeof alert_level);
+
+    return 0;
+}
+
+/**
+ * Registers the LLS with the GATT server.
+ */
+int
+ble_svc_lls_register(void)
+{
+    int rc;
+
+    rc = ble_gatts_register_svcs(ble_svc_lls_defs, NULL, NULL);
+    return rc;
+}
+
+/**
+ * Initialize the LLS. The developer must specify the event function
+ * callback for the LLS to function properly.
+ */
+int
+ble_svc_lls_init(struct ble_hs_cfg *cfg, uint8_t initial_alert_level,
+                 ble_svc_lls_event_fn *cb)
+{
+    if (*cb) {
+        return BLE_HS_EINVAL;
+    }
+    ble_svc_lls_alert_level = initial_alert_level;
+    cb_fn = cb;
+
+    int rc;
+    rc = ble_gatts_count_cfg(ble_svc_lls_defs, cfg);
+    if (rc != 0) {
+        return rc;
+    }
+
+    return 0;
+}


[8/8] incubator-mynewt-core git commit: This closes #83. Merge remote-tracking branch 'bgiori/develop' into develop

Posted by cc...@apache.org.
This closes #83.
Merge remote-tracking branch 'bgiori/develop' into develop

* bgiori/develop:
  renamed on_gap_event to on_gap_disconnect to better describe functionality
  added doxygen style comments
  forgot to change header file
  coding standard and on_gap_event changes.
  updated lls location to host and new api
  Update Lost to Loss in comments.
  Added the profiles dir. Added Link Lost Service


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/88e3cb60
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/88e3cb60
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/88e3cb60

Branch: refs/heads/develop
Commit: 88e3cb60ed53d0e87aa024fbce2470fce9de1425
Parents: 0de126a 47b9552
Author: Christopher Collins <cc...@apache.org>
Authored: Mon Aug 1 13:58:55 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Mon Aug 1 13:58:55 2016 -0700

----------------------------------------------------------------------
 .../lls/include/profiles/lls/ble_svc_lls.h      |  44 ++++
 net/nimble/host/profiles/lls/pkg.yml            |  31 +++
 net/nimble/host/profiles/lls/src/ble_svc_lls.c  | 200 +++++++++++++++++++
 3 files changed, 275 insertions(+)
----------------------------------------------------------------------



[5/8] incubator-mynewt-core git commit: forgot to change header file

Posted by cc...@apache.org.
forgot to change header file


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/5d4620eb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/5d4620eb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/5d4620eb

Branch: refs/heads/develop
Commit: 5d4620ebea8a7469b881f6e2b67e2fdad21e915a
Parents: 5a7d18c
Author: Brian Giori <br...@gmail.com>
Authored: Thu Jul 28 14:07:42 2016 -0700
Committer: Brian Giori <br...@gmail.com>
Committed: Thu Jul 28 14:07:42 2016 -0700

----------------------------------------------------------------------
 net/nimble/host/profiles/lls/include/profiles/lls/ble_svc_lls.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d4620eb/net/nimble/host/profiles/lls/include/profiles/lls/ble_svc_lls.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/profiles/lls/include/profiles/lls/ble_svc_lls.h b/net/nimble/host/profiles/lls/include/profiles/lls/ble_svc_lls.h
index 964f8b5..637dec8 100644
--- a/net/nimble/host/profiles/lls/include/profiles/lls/ble_svc_lls.h
+++ b/net/nimble/host/profiles/lls/include/profiles/lls/ble_svc_lls.h
@@ -34,7 +34,7 @@ typedef int ble_svc_lls_event_fn(uint8_t alert_level);
 
 uint8_t ble_svc_lls_alert_level_get(void);
 int ble_svc_lls_alert_level_set(uint8_t alert_level);
-void ble_svc_lls_on_gap_event(struct ble_gap_event *event, void *arg); 
+void ble_svc_lls_on_gap_event(int reason); 
 
 int ble_svc_lls_init(struct ble_hs_cfg *cfg, 
                      uint8_t initial_alert_level,


[2/8] incubator-mynewt-core git commit: Update Lost to Loss in comments.

Posted by cc...@apache.org.
Update Lost to Loss in comments.


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/d21530db
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/d21530db
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/d21530db

Branch: refs/heads/develop
Commit: d21530db2be8ed3bf867e0508a87eff5e37680cb
Parents: e91a0d9
Author: Brian Giori <br...@gmail.com>
Authored: Fri Jul 22 10:55:51 2016 -0700
Committer: Brian Giori <br...@gmail.com>
Committed: Wed Jul 27 16:28:18 2016 -0700

----------------------------------------------------------------------
 net/nimble/profiles/src/ble_svc_lls.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d21530db/net/nimble/profiles/src/ble_svc_lls.c
----------------------------------------------------------------------
diff --git a/net/nimble/profiles/src/ble_svc_lls.c b/net/nimble/profiles/src/ble_svc_lls.c
index e94f192..fdfe377 100644
--- a/net/nimble/profiles/src/ble_svc_lls.c
+++ b/net/nimble/profiles/src/ble_svc_lls.c
@@ -34,7 +34,7 @@ ble_svc_lls_access(uint16_t conn_handle, uint16_t attr_handle,
 
 static const struct ble_gatt_svc_def ble_svc_lls_defs[] = {
     {
-        /*** Service: Link Lost Service (LLS). */
+        /*** Service: Link Loss Service (LLS). */
         .type = BLE_GATT_SVC_TYPE_PRIMARY,
         .uuid128 = BLE_UUID16(BLE_SVC_LLS_UUID16),
         .characteristics = (struct ble_gatt_chr_def[]) { {
@@ -84,7 +84,7 @@ ble_svc_lls_access(uint16_t conn_handle, uint16_t attr_handle,
 }
 
 /**
- * This function is the crux of the link lost service. The application
+ * This function is the crux of the link loss service. The application
  * developer must call this function inside the gap event callback
  * function when a BLE_GAP_EVENT_DISCONNECT event is received. Here,
  * we then check if the disconnect reason is due to a timout, and if