taks / esp32-nimble

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

ble_gatt_chr_def, Required fields/characteristics in struct? #125

Closed terelldunn closed 5 months ago

terelldunn commented 5 months ago

I am new to Rust and not very knowledgeable about programming in general so bear with me.

I am using an example from the ApolloLabs ESP32C3 repository.

The compiler seems to want a "cpfd" field or characteristic in the ble_gatt_chr_def struct.

Nimble2

I don't see that field listed here.

I have tried adding it to the struct and assigning various values or even variations of Option<>, but the compiler gives a few different errors after that point. Again, I have no idea what I'm doing to be honest.

Google is no help and doesn't return much in regards to "cpfd".

I'm compiling with 5.2.1.

My target is correct. "riscv32imc-esp-espidf"

The following is present in sdkconfig. CONFIG_BT_ENABLED=y CONFIG_BT_BLE_ENABLED=y CONFIG_BT_BLUEDROID_ENABLED=n CONFIG_BT_NIMBLE_ENABLED=y

Any ideas?

terelldunn commented 5 months ago

It looks like it may be in Volume 3, Part G, Chapter 3.3.3.5 and 3.3.3.6 of the Bluetooth Core specification v5.3. "Characteristic Presentation Format Declaration". I completely stole the info pointing to the exact bluetooth spec from another forum. I won't take credit there.

taks commented 5 months ago

This issue is the same as in #110, #123. It was fixed in the main branch but not released as a new version.

I have just released version 0.6.1 which fixes this issue. Please check.

terelldunn commented 5 months ago

I have to level up my search game. It seems like those issues were not popping up during my Google searches. Thanks for the fast response. How did you know what to enter for that field? I would like to learn where to find that info. It is fixed now. Thanks again.

taks commented 5 months ago

I read the nimble library code and researched the use of cpfd. Also, by looking at the commit where the cpfd was added, I could see what code was added.