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

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

commit 60ecd1beef3f3f2841fedeea321c2823cb677b1f
Author: Piotr Narajowski <[email protected]>
AuthorDate: Thu Jan 30 15:59:07 2025 +0100

    apps: bttester: refactor notification sending
    
    Removes os_callout_init from tester_init_gatt and variables and
    functions related to it. Notifications/indications were sent
    right after peer has subscribed for notification (or indication).
    This will be now handled by calling set_value btp command
    implemented in another commit.
---
 apps/bttester/src/btp_gatt.c | 67 --------------------------------------------
 1 file changed, 67 deletions(-)

diff --git a/apps/bttester/src/btp_gatt.c b/apps/bttester/src/btp_gatt.c
index 2116b7509..a15d584c8 100644
--- a/apps/bttester/src/btp_gatt.c
+++ b/apps/bttester/src/btp_gatt.c
@@ -78,13 +78,9 @@
 static uint8_t gatt_svr_pts_static_long_val[300];
 static uint8_t gatt_svr_pts_static_val[30];
 static uint8_t gatt_svr_pts_static_short_val;
-static uint8_t notify_state;
-static uint8_t indicate_state;
 static uint16_t myconn_handle;
-static struct os_callout notify_tx_timer;
 uint16_t notify_handle;
 uint16_t notify_handle_alt;
-uint8_t notify_value = 90;
 
 struct find_attr_data {
     ble_uuid_any_t *uuid;
@@ -2130,54 +2126,6 @@ fail:
     return 0;
 }
 
-void
-notify_test_stop(void)
-{
-    os_callout_stop(&notify_tx_timer);
-}
-
-void
-notify_test_reset(void)
-{
-    int rc;
-
-    rc = os_callout_reset(&notify_tx_timer, OS_TICKS_PER_SEC);
-    assert(rc == 0);
-}
-
-void
-notify_test(struct os_event *ev)
-{
-    static uint8_t ntf[1];
-    struct os_mbuf *om;
-    int rc;
-
-    if (!notify_state && !indicate_state) {
-        notify_test_stop();
-        notify_value = 90;
-        return;
-    }
-
-    ntf[0] = notify_value;
-
-    notify_value++;
-    if (notify_value == 160) {
-        notify_value = 90;
-    }
-
-    om = ble_hs_mbuf_from_flat(ntf, sizeof(ntf));
-
-    if (notify_state) {
-        rc = ble_gatts_notify_custom(myconn_handle, notify_handle, om);
-        assert(rc == 0);
-    }
-
-    if (indicate_state) {
-        rc = ble_gatts_indicate_custom(myconn_handle, notify_handle, om);
-        assert(rc == 0);
-    }
-}
-
 int
 tester_gatt_subscribe_ev(uint16_t conn_handle,
                          uint16_t attr_handle,
@@ -2198,22 +2146,10 @@ tester_gatt_subscribe_ev(uint16_t conn_handle,
 
     if (cur_notify) {
         SYS_LOG_INF("Subscribed to notifications");
-        if (attr_handle == notify_handle) {
-            notify_state = cur_notify;
-        }
     }
 
     if (cur_indicate) {
         SYS_LOG_INF("Subscribed to indications");
-        if (attr_handle == notify_handle) {
-            indicate_state = cur_indicate;
-        }
-    }
-
-    if (notify_state || indicate_state) {
-        notify_test_reset();
-    } else {
-        notify_test_stop();
     }
 
     return 0;
@@ -2291,9 +2227,6 @@ gatt_svr_init(void)
 uint8_t
 tester_init_gatt(void)
 {
-    os_callout_init(&notify_tx_timer, os_eventq_dflt_get(),
-                    notify_test, NULL);
-
     tester_register_command_handlers(BTP_SERVICE_ID_GATT, handlers,
                                      ARRAY_SIZE(handlers));
 

Reply via email to