File tree Expand file tree Collapse file tree 3 files changed +24
-4
lines changed
tests/bluetooth/tester/src Expand file tree Collapse file tree 3 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -1256,7 +1256,8 @@ struct bt_gatt_subscribe_params;
1256
1256
/** @typedef bt_gatt_notify_func_t
1257
1257
* @brief Notification callback function
1258
1258
*
1259
- * @param conn Connection object.
1259
+ * @param conn Connection object. May be NULL, indicating that the peer is
1260
+ * being unpaired
1260
1261
* @param params Subscription parameters.
1261
1262
* @param data Attribute value data. If NULL then subscription was removed.
1262
1263
* @param length Attribute value length.
Original file line number Diff line number Diff line change @@ -4137,6 +4137,23 @@ static int sc_clear_by_addr(u8_t id, const bt_addr_le_t *addr)
4137
4137
return 0 ;
4138
4138
}
4139
4139
4140
+ static void bt_gatt_clear_subscriptions (const bt_addr_le_t * addr )
4141
+ {
4142
+ #if defined(CONFIG_BT_GATT_CLIENT )
4143
+ struct bt_gatt_subscribe_params * params , * tmp ;
4144
+ sys_snode_t * prev = NULL ;
4145
+
4146
+ SYS_SLIST_FOR_EACH_CONTAINER_SAFE (& subscriptions , params , tmp , node ) {
4147
+ if (bt_addr_le_cmp (addr , & params -> _peer )) {
4148
+ prev = & params -> node ;
4149
+ continue ;
4150
+ }
4151
+ params -> value = 0U ;
4152
+ gatt_subscription_remove (NULL , prev , params );
4153
+ }
4154
+ #endif /* CONFIG_BT_GATT_CLIENT */
4155
+ }
4156
+
4140
4157
int bt_gatt_clear (u8_t id , const bt_addr_le_t * addr )
4141
4158
{
4142
4159
int err ;
@@ -4156,6 +4173,8 @@ int bt_gatt_clear(u8_t id, const bt_addr_le_t *addr)
4156
4173
return err ;
4157
4174
}
4158
4175
4176
+ bt_gatt_clear_subscriptions (addr );
4177
+
4159
4178
return 0 ;
4160
4179
}
4161
4180
Original file line number Diff line number Diff line change @@ -1650,14 +1650,14 @@ static u8_t notify_func(struct bt_conn *conn,
1650
1650
const void * data , u16_t length )
1651
1651
{
1652
1652
struct gatt_notification_ev * ev = (void * ) ev_buf ;
1653
- const bt_addr_le_t * addr = bt_conn_get_dst ( conn ) ;
1653
+ const bt_addr_le_t * addr ;
1654
1654
1655
- if (!data ) {
1655
+ if (!conn || ! data ) {
1656
1656
LOG_DBG ("Unsubscribed" );
1657
1657
(void )memset (params , 0 , sizeof (* params ));
1658
1658
return BT_GATT_ITER_STOP ;
1659
1659
}
1660
-
1660
+ addr = bt_conn_get_dst ( conn );
1661
1661
ev -> type = (u8_t ) subscribe_params .value ;
1662
1662
ev -> handle = sys_cpu_to_le16 (subscribe_params .value_handle );
1663
1663
ev -> data_length = sys_cpu_to_le16 (length );
You can’t perform that action at this time.
0 commit comments