Skip to content

Commit 0ba168d

Browse files
apps: bttester: refactor notification sending
Removes os_callout_init from tester_init_gatt and variables and funcitons 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.
1 parent 63db05e commit 0ba168d

File tree

1 file changed

+0
-59
lines changed

1 file changed

+0
-59
lines changed

apps/bttester/src/btp_gatt.c

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,7 @@ static uint8_t gatt_svr_pts_static_short_val;
8080
static uint8_t notify_state;
8181
static uint8_t indicate_state;
8282
static uint16_t myconn_handle;
83-
static struct os_callout notify_tx_timer;
8483
uint16_t notify_handle;
85-
uint8_t notify_value = 90;
8684

8785
struct find_attr_data {
8886
ble_uuid_any_t *uuid;
@@ -2142,54 +2140,6 @@ tester_gatt_notify_rx_ev(uint16_t conn_handle, uint16_t attr_handle,
21422140
return 0;
21432141
}
21442142

2145-
void
2146-
notify_test_stop(void)
2147-
{
2148-
os_callout_stop(&notify_tx_timer);
2149-
}
2150-
2151-
void
2152-
notify_test_reset(void)
2153-
{
2154-
int rc;
2155-
2156-
rc = os_callout_reset(&notify_tx_timer, OS_TICKS_PER_SEC);
2157-
assert(rc == 0);
2158-
}
2159-
2160-
void
2161-
notify_test(struct os_event *ev)
2162-
{
2163-
static uint8_t ntf[1];
2164-
struct os_mbuf *om;
2165-
int rc;
2166-
2167-
if (!notify_state && !indicate_state) {
2168-
notify_test_stop();
2169-
notify_value = 90;
2170-
return;
2171-
}
2172-
2173-
ntf[0] = notify_value;
2174-
2175-
notify_value++;
2176-
if (notify_value == 160) {
2177-
notify_value = 90;
2178-
}
2179-
2180-
om = ble_hs_mbuf_from_flat(ntf, sizeof(ntf));
2181-
2182-
if (notify_state) {
2183-
rc = ble_gatts_notify_custom(myconn_handle, notify_handle, om);
2184-
assert(rc == 0);
2185-
}
2186-
2187-
if (indicate_state) {
2188-
rc = ble_gatts_indicate_custom(myconn_handle, notify_handle, om);
2189-
assert(rc == 0);
2190-
}
2191-
}
2192-
21932143
int
21942144
tester_gatt_subscribe_ev(uint16_t conn_handle,
21952145
uint16_t attr_handle,
@@ -2222,12 +2172,6 @@ tester_gatt_subscribe_ev(uint16_t conn_handle,
22222172
}
22232173
}
22242174

2225-
if (notify_state || indicate_state) {
2226-
notify_test_reset();
2227-
} else {
2228-
notify_test_stop();
2229-
}
2230-
22312175
return 0;
22322176
}
22332177

@@ -2303,9 +2247,6 @@ gatt_svr_init(void)
23032247
uint8_t
23042248
tester_init_gatt(void)
23052249
{
2306-
os_callout_init(&notify_tx_timer, os_eventq_dflt_get(),
2307-
notify_test, NULL);
2308-
23092250
tester_register_command_handlers(BTP_SERVICE_ID_GATT, handlers,
23102251
ARRAY_SIZE(handlers));
23112252

0 commit comments

Comments
 (0)