The error is not on the Bleak side as I have analysed the Bluetooth Wireshark logs and also asked the question on github page.
https://github.com/hbldh/bleak/issues/1075
My question is that what could be wrong in my code which prevent writing from Linux laptop? As I have no clue right now what can be wrong. What is even more is that I can write to the characteristic via apps like nRF connect.
So Let me post the snipate of the code I have running on esp. In the gatt_callback() function I have following code to receive and send ble gatt values.
Code: Select all
//global scope
static uint8_t received_val;
//function scope
void *dest= &received_val;
if(ble_uuid_cmp(uuid, &gatt_server_rgb_red_characteristic_uuid.u) == 0)
{
if(ctxt->op == BLE_GATT_ACCESS_OP_READ_CHR){
rc = os_mbuf_append(ctxt->om, &rand_num, sizeof(rand_num));
return rc;
}
if(ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR){
rc = ble_hs_mbuf_to_flat(ctxt->om, dest, sizeof received_val, NULL);
printf("Received %d", received_val);
r = received_val;
ESP_LOGI("TAG", "Write the char");
if (rc != 0)
{
return BLE_ATT_ERR_UNLIKELY;
}
}
}
What I tried so far?bleak.exc.BleakDBusError: [org.bluez.Error.Failed] Operation failed with ATT error: 0x0e (Unlikely Error)
Some of the suggestions on the internet is regarding to downgrade the Bluez package which I have tried. One more suggestion is to increase the maximum writable package(mtu) size but I think this may not be an issue as I can write gatt values via nrfconnect.
There is also arduino library for nibble which I just tried weather it works and it works in writing characteristic values, hence my best guess is that there is some issue in my esp-idf code itself.