Cool, your lastest BT library containts a method setValue in BLERemoteService. I guess thats exactly what I am looking for.
What I realized is that the Arduino Core of esp32 (https://github.com/espressif/arduino-esp32.git) does not contain the esp_bt.h you use. How did you work around that? Do you use the Arduino IDE at all or how did you add the ESP BT library?
The BLE APIs and the concept of "handles" ...
Re: The BLE APIs and the concept of "handles" ...
Well, for the moment I just copied the missing header files to the ESP32_BLE library folder. But I get the following error:
so I guess you must integrate somehow the espressif IDF with you Arduino IDE. So I'd really be interested if you could shed some light how you are building.
Code: Select all
Documents/Arduino/libraries/ESP32_BLE/src/BLEExceptions.h:13:2: error: #error "C++ exception handling must be enabled within make menuconfig. See Compiler Options > Enable C++ Exceptions."
#error "C++ exception handling must be enabled within make menuconfig. See Compiler Options > Enable C++ Exceptions."
Re: The BLE APIs and the concept of "handles" ...
Hello,
I am writing an application which simulates a Bluetooth remote control, but the receiver differentiates the commands according to the handle number. Do you know how I can give a handle style number 0x0030? See Attachment.
Thank you for your help.
Excuse my English, I'm French ...
I am writing an application which simulates a Bluetooth remote control, but the receiver differentiates the commands according to the handle number. Do you know how I can give a handle style number 0x0030? See Attachment.
Thank you for your help.
Excuse my English, I'm French ...
- Attachments
-
- Example
- Télécomande Noire.png (48.96 KiB) Viewed 5563 times
-
- Posts: 41
- Joined: Sun May 03, 2020 2:37 pm
Re: The BLE APIs and the concept of "handles" ...
I have a related question, that's not strongly correlated with the main topic but always related to handles
In the example code (https://github.com/espressif/esp-idf/bl ... ain/peer.c) i found this usage of handles (schematized above)
I looked for explaination in the main documentation (http://mynewt.apache.org/latest/network ... gatts.html) finding nothing more than what I found in the example.
From my understanding services, chrs, dscs have one handles each, and they are not always contiguous. Is it wrong? If I receive more than 1 handle for service discovery CB, i expect they are related to the elements below (chrs or chrs+dscs?), but they could not fit a contiguous range.
And more, once I know i need the value given by the chr with connHandle yyyy->chr handle xxxx, what's the meaning of keeping all other datas acquired?
Thanks
In the example code (https://github.com/espressif/esp-idf/bl ... ain/peer.c) i found this usage of handles (schematized above)
Code: Select all
ble_gattc_disc_all_svcs (connHandle)
=> connHandle, ble_gatt_svc { start_handle, end_handle }
ble_gattc_disc_all_chrs ( connHandle, start_handle, end_handle )
=> connHandle, ble_gatt_chr { def_handle, val_handle }
ble_gattc_disc_all_dscs (connHandle, val_handle, isLastChr ? end_handle : def_handle_of_next_chr-1)
=> connHandle, chr_val_handle, ble_gatt_dsc { handle }
From my understanding services, chrs, dscs have one handles each, and they are not always contiguous. Is it wrong? If I receive more than 1 handle for service discovery CB, i expect they are related to the elements below (chrs or chrs+dscs?), but they could not fit a contiguous range.
And more, once I know i need the value given by the chr with connHandle yyyy->chr handle xxxx, what's the meaning of keeping all other datas acquired?
Thanks
Re: The BLE APIs and the concept of "handles" ...
You dont have to copy handle number, because it is very uncommon that host device will use hardcoded handles.Alexis81 wrote: Hello,
I am writing an application which simulates a Bluetooth remote control, but the receiver differentiates the commands according to the handle number. Do you know how I can give a handle style number 0x0030? See Attachment.
Thank you for your help.
Excuse my English, I'm French ...
Characteristic needs 2 handles, one for characteristic and one for characteristic value. Service and descriptor only one handle each.brazoayeye wrote: From my understanding services, chrs, dscs have one handles each, and they are not always contiguous. Is it wrong? If I receive more than 1 handle for service discovery CB, i expect they are related to the elements below (chrs or chrs+dscs?), but they could not fit a contiguous range.
No need to discover and keep other data. In fact you have this API to discover only part of handles and related characteristics and desriptors:brazoayeye wrote: And more, once I know i need the value given by the chr with connHandle yyyy->chr handle xxxx, what's the meaning of keeping all other datas acquired?
Code: Select all
ble_gattc_disc_all_chrs ( connHandle, start_handle, end_handle )
=> connHandle, ble_gatt_chr { def_handle, val_handle }
Re: The BLE APIs and the concept of "handles" ...
Thank you for your reply,
But unfortunately the device that receives Bluetooth commands, relies on the Handle number, so I should be able to give the number 0x0030 to the Handle. Is it possible to do this?
Thank you
But unfortunately the device that receives Bluetooth commands, relies on the Handle number, so I should be able to give the number 0x0030 to the Handle. Is it possible to do this?
Thank you
Re: The BLE APIs and the concept of "handles" ...
There is few standard services and characteristics that are mandatory and are included by bluedroid stack. From here you can add services, characteristics and descriptors to reach handle 0x0030 using this formula:
Characteristic needs 2 handles, one for characteristic and one for characteristic value. Service and descriptor only one handle each.
Who is online
Users browsing this forum: Baidu [Spider], Google [Bot] and 125 guests