From 6bc85875ee852656fa2f9c284d1c5cc5b83f5406 Mon Sep 17 00:00:00 2001 From: CommanderRedYT Date: Sat, 24 Dec 2022 15:55:35 +0100 Subject: [PATCH] Fixed ble --- .gitmodules | 2 +- components/esp-nimble-cpp | 2 +- configs/sdkconfig_comred_new | 10 +++++++++- main/ble_bobby.cpp | 16 ++++++++-------- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/.gitmodules b/.gitmodules index a9fff2f..6461064 100644 --- a/.gitmodules +++ b/.gitmodules @@ -36,7 +36,7 @@ url = ../../0xFEEDC0DE64/espwifistack.git [submodule "components/esp-nimble-cpp"] path = components/esp-nimble-cpp - url = ../../0xFEEDC0DE64/esp-nimble-cpp.git + url = ../../bobbycar-graz/esp-nimble-cpp.git [submodule "components/espasyncota"] path = components/espasyncota url = ../../0xFEEDC0DE64/espasyncota.git diff --git a/components/esp-nimble-cpp b/components/esp-nimble-cpp index c218a27..29f9273 160000 --- a/components/esp-nimble-cpp +++ b/components/esp-nimble-cpp @@ -1 +1 @@ -Subproject commit c218a27dd8b8089e78f9190fbb4b88dd361471bc +Subproject commit 29f9273c65a03b0f3b1e8465cb5dd94863f5a2db diff --git a/configs/sdkconfig_comred_new b/configs/sdkconfig_comred_new index a3bfb71..925bb8d 100644 --- a/configs/sdkconfig_comred_new +++ b/configs/sdkconfig_comred_new @@ -1813,9 +1813,17 @@ CONFIG_TFT_SMOOTH_FONT=y # # ESP-NimBLE-CPP configuration # +# CONFIG_NIMBLE_CPP_LOG_LEVEL_NONE is not set +# CONFIG_NIMBLE_CPP_LOG_LEVEL_ERROR is not set +# CONFIG_NIMBLE_CPP_LOG_LEVEL_WARNING is not set +CONFIG_NIMBLE_CPP_LOG_LEVEL_INFO=y +# CONFIG_NIMBLE_CPP_LOG_LEVEL_DEBUG is not set +CONFIG_NIMBLE_CPP_LOG_LEVEL=3 # CONFIG_NIMBLE_CPP_ENABLE_RETURN_CODE_TEXT is not set # CONFIG_NIMBLE_CPP_ENABLE_GAP_EVENT_CODE_TEXT is not set -# CONFIG_NIMBLE_CPP_ENABLE_ADVERTISMENT_TYPE_TEXT is not set +# CONFIG_NIMBLE_CPP_ENABLE_ADVERTISEMENT_TYPE_TEXT is not set +# CONFIG_NIMBLE_CPP_ATT_VALUE_TIMESTAMP_ENABLED is not set +CONFIG_NIMBLE_CPP_ATT_VALUE_INIT_LENGTH=20 # end of ESP-NimBLE-CPP configuration # end of Component config diff --git a/main/ble_bobby.cpp b/main/ble_bobby.cpp index 1dc7c44..74c7ef9 100644 --- a/main/ble_bobby.cpp +++ b/main/ble_bobby.cpp @@ -21,19 +21,19 @@ constexpr const char * const TAG = "BOBBYBLE"; class RemoteControlCallbacks : public NimBLECharacteristicCallbacks { public: - void onWrite(NimBLECharacteristic* pCharacteristic) override; + void onWrite(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo) override; }; class WirelessSettingsCallbacks : public NimBLECharacteristicCallbacks { public: - void onWrite(NimBLECharacteristic* pCharacteristic) override; + void onWrite(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo) override; }; class WiFiListCallbacks : public NimBLECharacteristicCallbacks { public: - void onRead(NimBLECharacteristic* pCharacteristic) override; + void onRead(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo) override; }; } // namespace @@ -236,9 +236,9 @@ void handleBle() namespace { -void RemoteControlCallbacks::onWrite(NimBLECharacteristic* pCharacteristic) +void RemoteControlCallbacks::onWrite(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo) { - const auto &val = pCharacteristic->getValue(); + const std::string& val = pCharacteristic->getValue(); StaticJsonDocument<256> doc; if (const auto error = deserializeJson(doc, val)) @@ -268,9 +268,9 @@ void RemoteControlCallbacks::onWrite(NimBLECharacteristic* pCharacteristic) } } -void WirelessSettingsCallbacks::onWrite(NimBLECharacteristic* pCharacteristic) +void WirelessSettingsCallbacks::onWrite(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo) { - const auto &val = pCharacteristic->getValue(); + const std::string& val = pCharacteristic->getValue(); StaticJsonDocument<256> doc; if (const auto error = deserializeJson(doc, val)) @@ -292,7 +292,7 @@ void WirelessSettingsCallbacks::onWrite(NimBLECharacteristic* pCharacteristic) } } -void WiFiListCallbacks::onRead(NimBLECharacteristic *pCharacteristic) +void WiFiListCallbacks::onRead(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo) { StaticJsonDocument<768> responseDoc; auto wifiArray = responseDoc.createNestedArray("wifis");