Skip to content

Commit 0a22add

Browse files
authored
Disable legacy dfu that confused nrf connects (#2458)
1 parent 0238907 commit 0a22add

File tree

1 file changed

+0
-60
lines changed

1 file changed

+0
-60
lines changed

omi/firmware/omi/src/lib/dk2/transport.c

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@ static void audio_ccc_config_changed_handler(const struct bt_gatt_attr *attr, ui
6060
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);
6161
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);
6262

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-
6663
// Forward declarations for update functions and callbacks
6764
static void update_phy(struct bt_conn *conn);
6865
static void update_data_length(struct bt_conn *conn);
@@ -101,19 +98,6 @@ static struct bt_gatt_attr audio_service_attr[] = {
10198

10299
static struct bt_gatt_service audio_service = BT_GATT_SERVICE(audio_service_attr);
103100

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);
117101

118102
// Advertisement data
119103
static const struct bt_data bt_ad[] = {
@@ -125,7 +109,6 @@ static const struct bt_data bt_ad[] = {
125109
// Scan response data
126110
static const struct bt_data bt_sd[] = {
127111
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)),
129112
};
130113

131114
//
@@ -187,48 +170,6 @@ static void exchange_func(struct bt_conn *conn, uint8_t att_err, struct bt_gatt_
187170
}
188171

189172

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-
232173
//
233174
// Battery Service Handlers
234175
//
@@ -912,7 +853,6 @@ int transport_start()
912853

913854
// Start advertising
914855
bt_gatt_service_register(&audio_service);
915-
bt_gatt_service_register(&dfu_service);
916856
err = bt_le_adv_start(BT_LE_ADV_CONN, bt_ad, ARRAY_SIZE(bt_ad), bt_sd, ARRAY_SIZE(bt_sd));
917857
if (err)
918858
{

0 commit comments

Comments
 (0)