[Video]: Bluetooth BLE and C++ classes

frostyowned
Posts: 20
Joined: Wed Jun 28, 2017 1:22 pm

Re: [Video]: Bluetooth BLE and C++ classes

Postby frostyowned » Fri Jul 14, 2017 2:06 pm

How this process goes is the ESP32 turns on and I go to nRF Connect to see if I can get the services from it.

I press connect on the device, it takes me to the MYDEVICE tab, wait a few seconds, and it will automatically disconnect. Pressing connect then disconnects me almost instantly. After a lot of googling, people say the cause is that the service request is done too quickly and results in the android not getting any services

frostyowned
Posts: 20
Joined: Wed Jun 28, 2017 1:22 pm

Re: [Video]: Bluetooth BLE and C++ classes

Postby frostyowned » Mon Jul 17, 2017 2:52 pm

-snip-

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: [Video]: Bluetooth BLE and C++ classes

Postby kolban » Sat Jul 29, 2017 7:25 pm

Additional video is now available ... this one is on the subject if using C++ classes to build a BLE client.

https://www.youtube.com/watch?v=UgI7WRr5cgE
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

enitalp
Posts: 60
Joined: Thu Jan 12, 2017 10:03 pm

Re: [Video]: Bluetooth BLE and C++ classes

Postby enitalp » Fri Aug 18, 2017 8:11 pm

Nice work.

But question,

i saw in your sample that you include "ble.h"

and reference it with BLE::initServer("ImagineServer"); for example.

and i can't find either the include or any other place that could define the static BLE class.

Please Help !
thanks;p

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: [Video]: Bluetooth BLE and C++ classes

Postby kolban » Sat Aug 19, 2017 1:51 am

Howdy,
Unfortunately the moment one makes a video, it immediately becomes out of date. The class called "BLE" was renamed "BLEDevice".

See:

https://github.com/nkolban/esp32-snippe ... ffaabedea0

The good news is that the samples found here:

https://github.com/nkolban/esp32-snippe ... s/BLETests

Should always (hopefully) be consistent with the library.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

enitalp
Posts: 60
Joined: Thu Jan 12, 2017 10:03 pm

Re: [Video]: Bluetooth BLE and C++ classes

Postby enitalp » Mon Aug 21, 2017 1:25 pm

That's mostly the case for any documentation. Writing it is "easy" maintaining it is very hard.

enitalp
Posts: 60
Joined: Thu Jan 12, 2017 10:03 pm

Re: [Video]: Bluetooth BLE and C++ classes

Postby enitalp » Mon Aug 21, 2017 3:15 pm

BLEClientCallbacks miss an empty function for the interface onConnect, or should be pure virtual.

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: [Video]: Bluetooth BLE and C++ classes

Postby kolban » Mon Aug 21, 2017 6:17 pm

Thank you sir. Excellent. We have made a change to the code base and committed based on your report. Thank you again.

https://github.com/nkolban/esp32-snippets/issues/40
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

enitalp
Posts: 60
Joined: Thu Jan 12, 2017 10:03 pm

Re: [Video]: Bluetooth BLE and C++ classes

Postby enitalp » Thu Aug 24, 2017 6:50 pm

BLEServerCallbacks,
BLECharacteristicCallbacks

Have the same Problem.
Don't know if BLECharacteristicCallbacks should be virtual pure, because you can have mostly only read or write on a characteristic. not all of them are both.

enitalp
Posts: 60
Joined: Thu Jan 12, 2017 10:03 pm

Re: [Video]: Bluetooth BLE and C++ classes

Postby enitalp » Thu Aug 24, 2017 6:55 pm

Ho, and i have a conceptual problem with the BLECharacteristic
getValue();

Because not all value you receive are string, the problem is when you receive binary, if there is a 0 you can't get the correct lenght of data you received. Or the callback could give the lenght. But it should be better peharps to get a char* or U8* than a string.

Who is online

Users browsing this forum: No registered users and 119 guests