You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by an...@apache.org on 2021/11/09 12:02:42 UTC

[mynewt-nimble] branch master updated (91c5d9a -> b67d3c1)

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

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


    from 91c5d9a  nimble/ll: Add more convenient way to set pub dev addr
     new 911a257  apps/blestress: Fix rx_stress_13
     new b67d3c1  apps/blestress: Fix printout in rx_stress_13

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:
 apps/blestress/src/rx_stress.c | 32 ++++++++++++++++++++++++--------
 1 file changed, 24 insertions(+), 8 deletions(-)

[mynewt-nimble] 01/02: apps/blestress: Fix rx_stress_13

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

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

commit 911a257fe3dfd529fa42365fc17d8ec68157b064
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Mon Nov 8 14:12:47 2021 +0100

    apps/blestress: Fix rx_stress_13
    
    ble_gattc_notify_custom() will trigger a GAP event so we cannot use it
    inside GAP event handler as this will create infinite loop.
---
 apps/blestress/src/rx_stress.c | 30 +++++++++++++++++++++++-------
 1 file changed, 23 insertions(+), 7 deletions(-)

diff --git a/apps/blestress/src/rx_stress.c b/apps/blestress/src/rx_stress.c
index 440966a..01149c4 100644
--- a/apps/blestress/src/rx_stress.c
+++ b/apps/blestress/src/rx_stress.c
@@ -1010,12 +1010,24 @@ rx_stress_12_gap_event(struct ble_gap_event *event, void *arg)
     return 0;
 }
 
-static int
-rx_stress_13_gap_event(struct ble_gap_event *event, void *arg)
+static struct ble_npl_event rx_stress_13_notify_ev;
+
+static void
+rx_stress_13_notify_ev_func(struct ble_npl_event *ev)
 {
+    struct os_mbuf *om;
     int rc;
-    struct os_mbuf *om = NULL;
 
+    om = ble_hs_mbuf_from_flat(test_6_pattern, 10);
+    rc = ble_gattc_notify_custom(rx_stress_ctx->conn_handle,
+                                 hrs_hrm_handle, om);
+    assert(rc == 0);
+
+}
+
+static int
+rx_stress_13_gap_event(struct ble_gap_event *event, void *arg)
+{
     switch (event->type) {
     case BLE_GAP_EVENT_CONNECT:
         /* A new connection was established or a connection attempt failed */
@@ -1026,6 +1038,9 @@ rx_stress_13_gap_event(struct ble_gap_event *event, void *arg)
             rx_stress_ctx->conn_handle = event->connect.conn_handle;
 
             rx_stress_ctx->begin_us = os_get_uptime_usec();
+
+            ble_npl_eventq_put((struct ble_npl_eventq *)os_eventq_dflt_get(),
+                               &rx_stress_13_notify_ev);
             break;
         } else {
             /* Connection failed; resume advertising */
@@ -1061,6 +1076,9 @@ rx_stress_13_gap_event(struct ble_gap_event *event, void *arg)
                               BLE_ERR_REM_USER_CONN_TERM);
             return 0;
         }
+
+        ble_npl_eventq_put((struct ble_npl_eventq *)os_eventq_dflt_get(),
+                           &rx_stress_13_notify_ev);
         break;
 
     default:
@@ -1068,10 +1086,6 @@ rx_stress_13_gap_event(struct ble_gap_event *event, void *arg)
         return 0;
     }
 
-    om = ble_hs_mbuf_from_flat(test_6_pattern, 10);
-    rc = ble_gattc_notify_custom(rx_stress_ctx->conn_handle,
-                                 hrs_hrm_handle, om);
-    assert(rc == 0);
     return 0;
 }
 
@@ -1377,6 +1391,8 @@ rx_stress_start(int test_num)
         break;
     case 13:
         console_printf("Stress GATT notification\033[0m\n");
+        ble_npl_event_init(&rx_stress_13_notify_ev,
+                           rx_stress_13_notify_ev_func, NULL);
         rx_stress_simple_adv(&rx_stress_adv_sets[13]);
         break;
     case 14:

[mynewt-nimble] 02/02: apps/blestress: Fix printout in rx_stress_13

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

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

commit b67d3c186689112717a95bbd24b5e7fd6ba7e959
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Mon Nov 8 14:14:10 2021 +0100

    apps/blestress: Fix printout in rx_stress_13
---
 apps/blestress/src/rx_stress.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/apps/blestress/src/rx_stress.c b/apps/blestress/src/rx_stress.c
index 01149c4..50415ea 100644
--- a/apps/blestress/src/rx_stress.c
+++ b/apps/blestress/src/rx_stress.c
@@ -1060,7 +1060,7 @@ rx_stress_13_gap_event(struct ble_gap_event *event, void *arg)
         rx_stress_ctx->s13_notif_time = rx_stress_ctx->time_sum /
                                         rx_stress_ctx->send_num;
 
-        MODLOG_DFLT(INFO, "Average time: %lld us\n",
+        MODLOG_DFLT(INFO, "Average time: %d us\n",
                     rx_stress_ctx->s13_notif_time);
         rx_stress_on_test_finish(13);
         return 0;