taks / esp32-nimble

A wrapper for the ESP32 NimBLE Bluetooth stack.
Apache License 2.0
118 stars 35 forks source link

Implement Display and Debug traits for BLERemoteCharacteristic & BLERemoteService #66

Closed oleander closed 10 months ago

oleander commented 10 months ago

This allows for easier debugging when working with clients. Debug ({:?}) now includes the most valuable fields, and display ({}) consists of the uuid, and, in the case of the characteristic, properties.

Here's an example:

I (4039) ble_client: (display) BLERemoteService[0x1812]
I (4039) ble_client: (debug) BLERemoteService { uuid: 0x1812, start_handle: 24, end_handle: 47, characteristics: Some([0x2a4e, 0x2a4d, 0x2a4d, 0x2a4d, 0x2a4b, 0x2a22, 0x2a32, 0x2a4a, 0x2a4c]) }
I (4059) NimBLE: GATT procedure initiated: discover all characteristics;
I (4069) NimBLE: start_handle=48 end_handle=65535
I (4829) ble_client: (display) BLERemoteCharacteristic[f3641401-00b0-4240-ba50-05ca45bf8abc]
I (4829) ble_client: (debug) BLERemoteCharacteristic { uuid: f3641401-00b0-4240-ba50-05ca45bf8abc, service: Some(f3641400-00b0-4240-ba50-05ca45bf8abc), handle: 50, end_handle: 0, properties: GattCharacteristicProperties(READ) }

I updated the ble_client example to include the change, but I'm unsure if it adds anything to the example.

oleander commented 10 months ago

My free quota for GitHub actions is met so have rerun the CI when it's restored. I'll try again in 24h.

taks commented 10 months ago

Thanks.

Currently, esp-idf version 4.4 seems to have a compile error. I will merge because of CI goes through in other versions.