Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Indication/Notification is only sent when Client is connected + fix typo
  • Loading branch information
mate-pycom committed May 16, 2020
commit 0745b3dd337863f29b05a645ed3de8c7416cc335
10 changes: 6 additions & 4 deletions esp32/mods/modbt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1914,10 +1914,12 @@ STATIC mp_obj_t bt_characteristic_value (mp_uint_t n_args, const mp_obj_t *args)
self->attr_obj.value_len = value_len;
}

bool confirm = self->attr_obj.properties & ESP_GATT_CHAR_PROP_BIT_INDICATE;
if (ESP_OK != esp_ble_gatts_send_indicate(bt_obj.gatts_if, bt_obj.gatts_conn_id, self->attr_obj.handle,
self->attr_obj.value_len, self->attr_obj.value, confirm)) {
nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, "Erorr while sending BLE indication/notification"));
if(bt_obj.gatts_conn_id != -1) {
bool confirm = self->attr_obj.properties & ESP_GATT_CHAR_PROP_BIT_INDICATE;
if (ESP_OK != esp_ble_gatts_send_indicate(bt_obj.gatts_if, bt_obj.gatts_conn_id, self->attr_obj.handle,
self->attr_obj.value_len, self->attr_obj.value, confirm)) {
nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, "Error while sending BLE indication/notification"));
}
}
return mp_const_none;
}
Expand Down