Closed beegee-tokyo closed 4 years ago
ESP32 Arduino has already a BLEClient class, so there is a name conflict. That's why I called it different. I think even naming the files the same as in ESP32 Arduino is not a good solution and can lead to confusion.
I can make the void startServer(void (*callback)(BleDrClient *));
static, I just saw no requirement for it.
Renaming of files and classes done to
a) match naming consistency
b) avoid problems with ESP32 BLEClient library
Made startServer() static.
Really great stuff. I finally had some time to test this. Works great. The only change I am making is to the platformio.ini
to keep it the default/recommended settings (i.e. ttgo v2, /dev/ttyUSB0, wifi enabled), but include your settings as commented out options.
It also appears that you overlooked one use of ble_client
here. I just wrapped the if (client == NULL)
in an #ifdef USE_BLE
.
I'm going to go ahead and merge this into master is if that is OK with you, @beegee-tokyo. Maybe we should create a fork where BLE is the default for convenience's sake? Not sure the best way to manage these minor differences. Ideally, we'd be able to swap between them more dynamically.
Thanks for the awesome contribution! I will be making some changes to the way the clients communicate related to #48 so be aware that the android app maybe need to be updated once that issue is resolved.
Great. Thanks for merging.
I didn't go into the dynamic switch between WiFi and BLE, because I know you were working on the way data is transferred between clients and servers. So for me it is ok to have it in a separate branch/fork for now.
Once the #48 is finished, let me know, I will adapt the Android app where necessary.
For the overlooked ble_client use, that is actually something strange. Sometimes when the Welcome Class is initiated, the client value was NULL instead of being the BLE client. I couldn't find out why and where it happens, it seems to be a kind of runtime problem.
This adds a BLE client that can replace the web socket / WiFi server client.
Remarks:
Android app
Android app source code can be found in my repo disaster-radio-android. I will publish it on Google Play if you agree to it.
What does not work yet?