Skip to content

New branch added #717

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
chegewara opened this issue Nov 14, 2018 · 8 comments
Closed

New branch added #717

chegewara opened this issue Nov 14, 2018 · 8 comments

Comments

@chegewara
Copy link
Collaborator

Hi, i am creating new branch in which i will add new features like multi connect and some others. Because all this code has not been fully tested it is not merged to master yet. There is also small possibility i have made some mistakes during copying code from my WIP repository or not all files has been updated.

I would like to ask to test it and give me a feedback, so i can fix all issues in code.
Thanks and have a nice codding.

@chegewara chegewara changed the title New branch with added New branch added Nov 14, 2018
@chegewara
Copy link
Collaborator Author

Here is beta version for arduino with all changes i made so far, it should works with arduino but can be very unstable in some situations:

ESP32_ble_library.zip

@mpbejo
Copy link

mpbejo commented Nov 22, 2018

Hi chegewara,
I tried this version, I do not have problem during compile, but when I call:
pRemoteCharacParam = pRemoteService->getCharacteristic(charUUID_Param);
I have this error
E (23847) boot: Assert failed in heap_caps_free, /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/heap/heap_caps.c:261 (heap != NULL && "free() target pointer is outside heap areas")
the same sketch works with Esp32 BLE standard library

@mpbejo
Copy link

mpbejo commented Nov 22, 2018

Now I changed the core debug level to DEBUG to ha have more information and with this option the compile fails:
In file included from C:\Users\Marco\Documents\Arduino\libraries\ESP32_ble_library\BLECharacteristic.cpp:23:0:

C:\Users\Marco\Documents\Arduino\libraries\ESP32_ble_library\BLECharacteristic.cpp: In member function 'void BLECharacteristic::handleGATTServerEvent(esp_gatts_cb_event_t, esp_gatt_if_t, esp_ble_gatts_cb_param_t*)':

C:\Users\Marco\Documents\Arduino\libraries\ESP32_ble_library\BLECharacteristic.cpp:433:80: error: 'struct esp_ble_gatts_cb_param_t::gatts_conf_evt_param' has no member named 'handle'

ESP_LOGD(LOG_TAG, "m_handle = %d, conf->handle = %d", m_handle, param->conf.handle);

                                                                            ^

C:\Users\Marco\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\cores\esp32/esp32-hal-log.h:87:72: note: in definition of macro 'log_d'

#define log_d(format, ...) log_printf(ARDUHAL_LOG_FORMAT(D, format), ##VA_ARGS)

                                                                    ^

C:\Users\Marco\Documents\Arduino\libraries\ESP32_ble_library\BLECharacteristic.cpp:433:4: note: in expansion of macro 'ESP_LOGD'

ESP_LOGD(LOG_TAG, "m_handle = %d, conf->handle = %d", m_handle, param->conf.handle);

^

exit status 1
Errore durante la compilazione per la scheda DOIT ESP32 DEVKIT V1.

I hope thi is useful
Marco

@chegewara
Copy link
Collaborator Author

this you can just remove:
ESP_LOGD(LOG_TAG, "m_handle = %d, conf->handle = %d", m_handle, param->conf.handle);

the other one i have to investigate.

@chegewara
Copy link
Collaborator Author

For compatibility purpose i will switch and do all changes in library based on esp-idf release/v3.1 branch. I will update library soon.

@chegewara
Copy link
Collaborator Author

chegewara commented Nov 27, 2018

I pushed code with few useful changes i hope. There was many time problem with advertising 128 bit UUID along with long device name. I changed a bit BLEAdvertising to allow this. I was even able to advertise long name and 16, 32 and 128 bit UUIDs one of each at the same. This is procedure how to achieve this:

  • there is function setScanResponse(bool),
  • if this function is with parameter true, then name and TX power are advertised in scan response only and 128 bit UUID can be advertised in packet,
  • we have also 2 additional functions that can remove another advertised data from payload, its setMinPreferred() and setMaxPreferred(); if parameter in one of those is set to 0 then it wont be in payload; those 2 functions are important for some other reason, they are used when we need compatibility with Apple devices (iPhone, iPad, mac);

We have now option to get raw payload from BLEAdvertisedDevice. Its 2 new functions to get raw data and to get length of raw data. Fixed parsing payload to parse also scan response.

BLEscan class: fixed memory leak, added few functions to control stored discovered devices. We can now retrieve address type from BLEAdvertisedDevice that allow us to connect with peer device that is having private address. This lead us to BLEClient class where we will use this info, but to make it easier for us there is overridden function connect() where we can pass BLEAdvertisedDevice.

Fixed BLEUUID to allow create 16 and 32 bit UUIDs from string.

I encourage to check all changes and have a nice codding time with as few bugs as possible.

Repository owner deleted a comment from mpbejo Nov 28, 2018
@chegewara
Copy link
Collaborator Author

Moved to new issue

@chegewara
Copy link
Collaborator Author

This is example what we can do now with advertising in library. Very long name and 3 services UUID, one of each type (16, 32 and 128 bits):
screenshot_20181129-231045_nrf connect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants