@@ -60,9 +60,6 @@ static void audio_ccc_config_changed_handler(const struct bt_gatt_attr *attr, ui
60
60
static ssize_t audio_data_read_characteristic (struct bt_conn * conn , const struct bt_gatt_attr * attr , void * buf , uint16_t len , uint16_t offset );
61
61
static ssize_t audio_codec_read_characteristic (struct bt_conn * conn , const struct bt_gatt_attr * attr , void * buf , uint16_t len , uint16_t offset );
62
62
63
- static void dfu_ccc_config_changed_handler (const struct bt_gatt_attr * attr , uint16_t value );
64
- static ssize_t dfu_control_point_write_handler (struct bt_conn * conn , const struct bt_gatt_attr * attr , const void * buf , uint16_t len , uint16_t offset , uint8_t flags );
65
-
66
63
// Forward declarations for update functions and callbacks
67
64
static void update_phy (struct bt_conn * conn );
68
65
static void update_data_length (struct bt_conn * conn );
@@ -101,19 +98,6 @@ static struct bt_gatt_attr audio_service_attr[] = {
101
98
102
99
static struct bt_gatt_service audio_service = BT_GATT_SERVICE (audio_service_attr );
103
100
104
- // Nordic Legacy DFU service with UUID 00001530-1212-EFDE-1523-785FEABCD123
105
- // exposes following characteristics:
106
- // - Control point (UUID 00001531-1212-EFDE-1523-785FEABCD123) to start the OTA update process (write/notify)
107
- static struct bt_uuid_128 dfu_service_uuid = BT_UUID_INIT_128 (BT_UUID_128_ENCODE (0x00001530 , 0x1212 , 0xEFDE , 0x1523 , 0x785FEABCD123 ));
108
- static struct bt_uuid_128 dfu_control_point_uuid = BT_UUID_INIT_128 (BT_UUID_128_ENCODE (0x00001531 , 0x1212 , 0xEFDE , 0x1523 , 0x785FEABCD123 ));
109
-
110
- static struct bt_gatt_attr dfu_service_attr [] = {
111
- BT_GATT_PRIMARY_SERVICE (& dfu_service_uuid ),
112
- BT_GATT_CHARACTERISTIC (& dfu_control_point_uuid .uuid , BT_GATT_CHRC_WRITE | BT_GATT_CHRC_NOTIFY , BT_GATT_PERM_WRITE , NULL , dfu_control_point_write_handler , NULL ),
113
- BT_GATT_CCC (dfu_ccc_config_changed_handler , BT_GATT_PERM_READ | BT_GATT_PERM_WRITE ),
114
- };
115
-
116
- static struct bt_gatt_service dfu_service = BT_GATT_SERVICE (dfu_service_attr );
117
101
118
102
// Advertisement data
119
103
static const struct bt_data bt_ad [] = {
@@ -125,7 +109,6 @@ static const struct bt_data bt_ad[] = {
125
109
// Scan response data
126
110
static const struct bt_data bt_sd [] = {
127
111
BT_DATA_BYTES (BT_DATA_UUID16_ALL , BT_UUID_16_ENCODE (BT_UUID_DIS_VAL )),
128
- BT_DATA (BT_DATA_UUID128_ALL , dfu_service_uuid .val , sizeof (dfu_service_uuid .val )),
129
112
};
130
113
131
114
//
@@ -187,48 +170,6 @@ static void exchange_func(struct bt_conn *conn, uint8_t att_err, struct bt_gatt_
187
170
}
188
171
189
172
190
- //
191
- // DFU Service Handlers
192
- //
193
-
194
- static void dfu_ccc_config_changed_handler (const struct bt_gatt_attr * attr , uint16_t value )
195
- {
196
- if (value == BT_GATT_CCC_NOTIFY )
197
- {
198
- LOG_INF ("Client subscribed for notifications" );
199
- }
200
- else if (value == 0 )
201
- {
202
- LOG_INF ("Client unsubscribed from notifications" );
203
- }
204
- else
205
- {
206
- LOG_INF ("Invalid CCC value: %u" , value );
207
- }
208
- }
209
-
210
- static ssize_t dfu_control_point_write_handler (struct bt_conn * conn , const struct bt_gatt_attr * attr , const void * buf , uint16_t len , uint16_t offset , uint8_t flags )
211
- {
212
- LOG_INF ("dfu_control_point_write_handler" );
213
- uint32_t val = 0xA8 ;
214
- if (len == 1 && ((uint8_t * )buf )[0 ] == 0x06 )
215
- {
216
- nrf_power_gpregret_set (NRF_POWER , 0 , val );
217
- NVIC_SystemReset ();
218
- }
219
- else if (len == 2 && ((uint8_t * )buf )[0 ] == 0x01 )
220
- {
221
- uint8_t notification_value = 0x10 ;
222
- bt_gatt_notify (conn , attr , & notification_value , sizeof (notification_value ));
223
-
224
- nrf_power_gpregret_set (NRF_POWER , 0 , val );
225
- NVIC_SystemReset ();
226
- }
227
- return len ;
228
- }
229
-
230
-
231
-
232
173
//
233
174
// Battery Service Handlers
234
175
//
@@ -912,7 +853,6 @@ int transport_start()
912
853
913
854
// Start advertising
914
855
bt_gatt_service_register (& audio_service );
915
- bt_gatt_service_register (& dfu_service );
916
856
err = bt_le_adv_start (BT_LE_ADV_CONN , bt_ad , ARRAY_SIZE (bt_ad ), bt_sd , ARRAY_SIZE (bt_sd ));
917
857
if (err )
918
858
{
0 commit comments