You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ja...@apache.org on 2019/10/10 06:19:00 UTC

[mynewt-nimble] branch master updated (b000924 -> 03110e9)

This is an automated email from the ASF dual-hosted git repository.

janc pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git.


    from b000924  Upgrade test instructions
     new 9f22d24  nimble/host: Build ble_hs_periodic_sync only when enabled
     new 03110e9  nimble/host: Fix using windows newlines in source code

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 nimble/host/src/ble_hs.c                    |   2 +
 nimble/host/src/ble_hs_periodic_sync.c      | 306 ++++++++++++++--------------
 nimble/host/src/ble_hs_periodic_sync_priv.h | 110 +++++-----
 3 files changed, 211 insertions(+), 207 deletions(-)


[mynewt-nimble] 02/02: nimble/host: Fix using windows newlines in source code

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit 03110e9b4378b3596bb6f624c14f3054409018ff
Author: Szymon Janc <sz...@codecoup.pl>
AuthorDate: Wed Oct 9 10:29:38 2019 +0200

    nimble/host: Fix using windows newlines in source code
---
 nimble/host/src/ble_hs_periodic_sync.c      | 308 ++++++++++++++--------------
 nimble/host/src/ble_hs_periodic_sync_priv.h | 110 +++++-----
 2 files changed, 209 insertions(+), 209 deletions(-)

diff --git a/nimble/host/src/ble_hs_periodic_sync.c b/nimble/host/src/ble_hs_periodic_sync.c
index 9fad653..dad5351 100644
--- a/nimble/host/src/ble_hs_periodic_sync.c
+++ b/nimble/host/src/ble_hs_periodic_sync.c
@@ -1,154 +1,154 @@
-/*
- * 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 <string.h>
-#include <errno.h>
-#include "syscfg/syscfg.h"
-#include "os/os.h"
-#include "host/ble_hs_id.h"
-#include "ble_hs_priv.h"
-
-#if MYNEWT_VAL(BLE_PERIODIC_ADV)
-static SLIST_HEAD(, ble_hs_periodic_sync) g_ble_hs_periodic_sync_handles;
-static struct os_mempool ble_hs_periodic_sync_pool;
-
-static os_membuf_t ble_hs_psync_elem_mem[
-    OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_MAX_PERIODIC_SYNCS),
-                    sizeof (struct ble_hs_periodic_sync))
-];
-
-struct ble_hs_periodic_sync *
-ble_hs_periodic_sync_alloc(void)
-{
-    struct ble_hs_periodic_sync *psync;
-
-    psync = os_memblock_get(&ble_hs_periodic_sync_pool);
-    if (psync) {
-        memset(psync, 0, sizeof(*psync));
-    }
-
-    return psync;
-}
-
-void
-ble_hs_periodic_sync_free(struct ble_hs_periodic_sync *psync)
-{
-    int rc;
-
-    if (psync == NULL) {
-        return;
-    }
-
-#if MYNEWT_VAL(BLE_HS_DEBUG)
-    memset(psync, 0xff, sizeof *psync);
-#endif
-    rc = os_memblock_put(&ble_hs_periodic_sync_pool, psync);
-    BLE_HS_DBG_ASSERT_EVAL(rc == 0);
-}
-
-void
-ble_hs_periodic_sync_insert(struct ble_hs_periodic_sync *psync)
-{
-    BLE_HS_DBG_ASSERT(ble_hs_locked_by_cur_task());
-
-    BLE_HS_DBG_ASSERT_EVAL(
-                       ble_hs_periodic_sync_find_by_handle(psync->sync_handle) == NULL);
-
-    SLIST_INSERT_HEAD(&g_ble_hs_periodic_sync_handles, psync, next);
-}
-
-void
-ble_hs_periodic_sync_remove(struct ble_hs_periodic_sync *psync)
-{
-    BLE_HS_DBG_ASSERT(ble_hs_locked_by_cur_task());
-
-    SLIST_REMOVE(&g_ble_hs_periodic_sync_handles, psync, ble_hs_periodic_sync,
-                 next);
-}
-
-struct ble_hs_periodic_sync *
-ble_hs_periodic_sync_find_by_handle(uint16_t sync_handle)
-{
-    struct ble_hs_periodic_sync *psync;
-
-    BLE_HS_DBG_ASSERT(ble_hs_locked_by_cur_task());
-
-    SLIST_FOREACH(psync, &g_ble_hs_periodic_sync_handles, next) {
-        if (psync->sync_handle == sync_handle) {
-            return psync;
-        }
-    }
-
-    return NULL;
-}
-
-struct ble_hs_periodic_sync *
-ble_hs_periodic_sync_find(const ble_addr_t *addr, uint8_t sid)
-{
-    struct ble_hs_periodic_sync *psync;
-
-    BLE_HS_DBG_ASSERT(ble_hs_locked_by_cur_task());
-
-    if (!addr) {
-        return NULL;
-    }
-
-    SLIST_FOREACH(psync, &g_ble_hs_periodic_sync_handles, next) {
-        if ((ble_addr_cmp(&psync->advertiser_addr, addr) == 0) &&
-                (psync->adv_sid == sid)) {
-            return psync;
-        }
-    }
-
-    return NULL;
-}
-
-/**
- * Retrieves the first periodic discovery handle in the list.
- */
-struct ble_hs_periodic_sync *
-ble_hs_periodic_sync_first(void)
-{
-    struct ble_hs_periodic_sync *psync;
-
-    ble_hs_lock();
-    psync = SLIST_FIRST(&g_ble_hs_periodic_sync_handles);
-    ble_hs_unlock();
-
-    return psync;
-}
-
-int
-ble_hs_periodic_sync_init(void)
-{
-    int rc;
-
-    rc = os_mempool_init(&ble_hs_periodic_sync_pool,
-                         MYNEWT_VAL(BLE_MAX_PERIODIC_SYNCS),
-                         sizeof (struct ble_hs_periodic_sync),
-                         ble_hs_psync_elem_mem, "ble_hs_periodic_disc_pool");
-    if (rc != 0) {
-        return BLE_HS_EOS;
-    }
-
-    SLIST_INIT(&g_ble_hs_periodic_sync_handles);
-
-    return 0;
-}
-#endif
+/*
+ * 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 <string.h>
+#include <errno.h>
+#include "syscfg/syscfg.h"
+#include "os/os.h"
+#include "host/ble_hs_id.h"
+#include "ble_hs_priv.h"
+
+#if MYNEWT_VAL(BLE_PERIODIC_ADV)
+static SLIST_HEAD(, ble_hs_periodic_sync) g_ble_hs_periodic_sync_handles;
+static struct os_mempool ble_hs_periodic_sync_pool;
+
+static os_membuf_t ble_hs_psync_elem_mem[
+    OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_MAX_PERIODIC_SYNCS),
+                    sizeof (struct ble_hs_periodic_sync))
+];
+
+struct ble_hs_periodic_sync *
+ble_hs_periodic_sync_alloc(void)
+{
+    struct ble_hs_periodic_sync *psync;
+
+    psync = os_memblock_get(&ble_hs_periodic_sync_pool);
+    if (psync) {
+        memset(psync, 0, sizeof(*psync));
+    }
+
+    return psync;
+}
+
+void
+ble_hs_periodic_sync_free(struct ble_hs_periodic_sync *psync)
+{
+    int rc;
+
+    if (psync == NULL) {
+        return;
+    }
+
+#if MYNEWT_VAL(BLE_HS_DEBUG)
+    memset(psync, 0xff, sizeof *psync);
+#endif
+    rc = os_memblock_put(&ble_hs_periodic_sync_pool, psync);
+    BLE_HS_DBG_ASSERT_EVAL(rc == 0);
+}
+
+void
+ble_hs_periodic_sync_insert(struct ble_hs_periodic_sync *psync)
+{
+    BLE_HS_DBG_ASSERT(ble_hs_locked_by_cur_task());
+
+    BLE_HS_DBG_ASSERT_EVAL(
+                       ble_hs_periodic_sync_find_by_handle(psync->sync_handle) == NULL);
+
+    SLIST_INSERT_HEAD(&g_ble_hs_periodic_sync_handles, psync, next);
+}
+
+void
+ble_hs_periodic_sync_remove(struct ble_hs_periodic_sync *psync)
+{
+    BLE_HS_DBG_ASSERT(ble_hs_locked_by_cur_task());
+
+    SLIST_REMOVE(&g_ble_hs_periodic_sync_handles, psync, ble_hs_periodic_sync,
+                 next);
+}
+
+struct ble_hs_periodic_sync *
+ble_hs_periodic_sync_find_by_handle(uint16_t sync_handle)
+{
+    struct ble_hs_periodic_sync *psync;
+
+    BLE_HS_DBG_ASSERT(ble_hs_locked_by_cur_task());
+
+    SLIST_FOREACH(psync, &g_ble_hs_periodic_sync_handles, next) {
+        if (psync->sync_handle == sync_handle) {
+            return psync;
+        }
+    }
+
+    return NULL;
+}
+
+struct ble_hs_periodic_sync *
+ble_hs_periodic_sync_find(const ble_addr_t *addr, uint8_t sid)
+{
+    struct ble_hs_periodic_sync *psync;
+
+    BLE_HS_DBG_ASSERT(ble_hs_locked_by_cur_task());
+
+    if (!addr) {
+        return NULL;
+    }
+
+    SLIST_FOREACH(psync, &g_ble_hs_periodic_sync_handles, next) {
+        if ((ble_addr_cmp(&psync->advertiser_addr, addr) == 0) &&
+                (psync->adv_sid == sid)) {
+            return psync;
+        }
+    }
+
+    return NULL;
+}
+
+/**
+ * Retrieves the first periodic discovery handle in the list.
+ */
+struct ble_hs_periodic_sync *
+ble_hs_periodic_sync_first(void)
+{
+    struct ble_hs_periodic_sync *psync;
+
+    ble_hs_lock();
+    psync = SLIST_FIRST(&g_ble_hs_periodic_sync_handles);
+    ble_hs_unlock();
+
+    return psync;
+}
+
+int
+ble_hs_periodic_sync_init(void)
+{
+    int rc;
+
+    rc = os_mempool_init(&ble_hs_periodic_sync_pool,
+                         MYNEWT_VAL(BLE_MAX_PERIODIC_SYNCS),
+                         sizeof (struct ble_hs_periodic_sync),
+                         ble_hs_psync_elem_mem, "ble_hs_periodic_disc_pool");
+    if (rc != 0) {
+        return BLE_HS_EOS;
+    }
+
+    SLIST_INIT(&g_ble_hs_periodic_sync_handles);
+
+    return 0;
+}
+#endif
diff --git a/nimble/host/src/ble_hs_periodic_sync_priv.h b/nimble/host/src/ble_hs_periodic_sync_priv.h
index 2471188..c82ea79 100644
--- a/nimble/host/src/ble_hs_periodic_sync_priv.h
+++ b/nimble/host/src/ble_hs_periodic_sync_priv.h
@@ -1,55 +1,55 @@
-/*
- * 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_HS_PERIODIC_SYNC_
-#define H_BLE_HS_PERIODIC_SYNC_
-
-#include <inttypes.h>
-#include "os/queue.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct ble_hs_periodic_sync {
-    SLIST_ENTRY(ble_hs_periodic_sync) next;
-    uint16_t   sync_handle;
-    ble_addr_t advertiser_addr;
-    uint8_t    adv_sid;
-
-    ble_gap_event_fn *cb;
-    void *cb_arg;
-
-    struct ble_npl_event lost_ev;
-};
-
-struct ble_hs_periodic_sync *ble_hs_periodic_sync_alloc(void);
-void ble_hs_periodic_sync_free(struct ble_hs_periodic_sync *psync);
-void ble_hs_periodic_sync_insert(struct ble_hs_periodic_sync *psync);
-void ble_hs_periodic_sync_remove(struct ble_hs_periodic_sync *psync);
-struct ble_hs_periodic_sync *ble_hs_periodic_sync_find_by_handle(uint16_t sync_handle);
-struct ble_hs_periodic_sync *ble_hs_periodic_sync_find(const ble_addr_t *addr,
-                                                       uint8_t sid);
-struct ble_hs_periodic_sync *ble_hs_periodic_sync_first(void);
-int ble_hs_periodic_sync_init(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+/*
+ * 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_HS_PERIODIC_SYNC_
+#define H_BLE_HS_PERIODIC_SYNC_
+
+#include <inttypes.h>
+#include "os/queue.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct ble_hs_periodic_sync {
+    SLIST_ENTRY(ble_hs_periodic_sync) next;
+    uint16_t   sync_handle;
+    ble_addr_t advertiser_addr;
+    uint8_t    adv_sid;
+
+    ble_gap_event_fn *cb;
+    void *cb_arg;
+
+    struct ble_npl_event lost_ev;
+};
+
+struct ble_hs_periodic_sync *ble_hs_periodic_sync_alloc(void);
+void ble_hs_periodic_sync_free(struct ble_hs_periodic_sync *psync);
+void ble_hs_periodic_sync_insert(struct ble_hs_periodic_sync *psync);
+void ble_hs_periodic_sync_remove(struct ble_hs_periodic_sync *psync);
+struct ble_hs_periodic_sync *ble_hs_periodic_sync_find_by_handle(uint16_t sync_handle);
+struct ble_hs_periodic_sync *ble_hs_periodic_sync_find(const ble_addr_t *addr,
+                                                       uint8_t sid);
+struct ble_hs_periodic_sync *ble_hs_periodic_sync_first(void);
+int ble_hs_periodic_sync_init(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif


[mynewt-nimble] 01/02: nimble/host: Build ble_hs_periodic_sync only when enabled

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit 9f22d249e0c542e34ecc2bf1161904a2ee01e7f4
Author: Szymon Janc <sz...@codecoup.pl>
AuthorDate: Wed Oct 9 10:27:25 2019 +0200

    nimble/host: Build ble_hs_periodic_sync only when enabled
    
    When periodic advertising support is disabled this code is never used.
---
 nimble/host/src/ble_hs.c               | 2 ++
 nimble/host/src/ble_hs_periodic_sync.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/nimble/host/src/ble_hs.c b/nimble/host/src/ble_hs.c
index 969a3e1..2e5451a 100644
--- a/nimble/host/src/ble_hs.c
+++ b/nimble/host/src/ble_hs.c
@@ -743,8 +743,10 @@ ble_hs_init(void)
     rc = ble_hs_conn_init();
     SYSINIT_PANIC_ASSERT(rc == 0);
 
+#if MYNEWT_VAL(BLE_PERIODIC_ADV)
     rc = ble_hs_periodic_sync_init();
     SYSINIT_PANIC_ASSERT(rc == 0);
+#endif
 
     rc = ble_l2cap_init();
     SYSINIT_PANIC_ASSERT(rc == 0);
diff --git a/nimble/host/src/ble_hs_periodic_sync.c b/nimble/host/src/ble_hs_periodic_sync.c
index 1a77060..9fad653 100644
--- a/nimble/host/src/ble_hs_periodic_sync.c
+++ b/nimble/host/src/ble_hs_periodic_sync.c
@@ -24,6 +24,7 @@
 #include "host/ble_hs_id.h"
 #include "ble_hs_priv.h"
 
+#if MYNEWT_VAL(BLE_PERIODIC_ADV)
 static SLIST_HEAD(, ble_hs_periodic_sync) g_ble_hs_periodic_sync_handles;
 static struct os_mempool ble_hs_periodic_sync_pool;
 
@@ -150,3 +151,4 @@ ble_hs_periodic_sync_init(void)
 
     return 0;
 }
+#endif