From fc05f46bd2973c61c81d3692c851385ed3116178 Mon Sep 17 00:00:00 2001 From: William Emfinger Date: Mon, 14 Oct 2024 23:13:36 -0500 Subject: [PATCH] chore: Update esp-nimble-cpp submodule to latest * Update to latest esp-nimble-cpp submodule * Update ble gatt server callback implementation to remove const from parameters * Update to use setValue methods which accept std::string and std::string_view (since they have .data() and .size()) --- .../include/ble_gatt_server_callbacks.hpp | 4 ++-- .../ble_gatt_server/include/device_info_service.hpp | 12 ++++++------ .../src/ble_gatt_server_callbacks.cpp | 4 ++-- components/esp-nimble-cpp | 2 +- .../hid_service/example/main/hid_service_example.cpp | 2 +- components/hid_service/include/hid_service.hpp | 3 +-- 6 files changed, 13 insertions(+), 14 deletions(-) diff --git a/components/ble_gatt_server/include/ble_gatt_server_callbacks.hpp b/components/ble_gatt_server/include/ble_gatt_server_callbacks.hpp index 083df80e9..2781f1b9f 100644 --- a/components/ble_gatt_server/include/ble_gatt_server_callbacks.hpp +++ b/components/ble_gatt_server/include/ble_gatt_server_callbacks.hpp @@ -15,9 +15,9 @@ class BleGattServerCallbacks : public NimBLEServerCallbacks { public: virtual void onConnect(NimBLEServer *server, NimBLEConnInfo &conn_info) override; virtual void onDisconnect(NimBLEServer *server, NimBLEConnInfo &conn_info, int reason) override; - virtual void onAuthenticationComplete(const NimBLEConnInfo &conn_info) override; + virtual void onAuthenticationComplete(NimBLEConnInfo &conn_info) override; virtual uint32_t onPassKeyDisplay() override; - virtual void onConfirmPIN(const NimBLEConnInfo &conn_info, uint32_t pass_key) override; + virtual void onConfirmPIN(NimBLEConnInfo &conn_info, uint32_t pass_key) override; protected: friend class BleGattServer; diff --git a/components/ble_gatt_server/include/device_info_service.hpp b/components/ble_gatt_server/include/device_info_service.hpp index bedbf26ab..bcfce6211 100644 --- a/components/ble_gatt_server/include/device_info_service.hpp +++ b/components/ble_gatt_server/include/device_info_service.hpp @@ -167,7 +167,7 @@ class DeviceInfoService : public BaseComponent { logger_.error("Characteristic not created"); return; } - manufacturer_name_->setValue(reinterpret_cast(name.data()), name.size()); + manufacturer_name_->setValue(name); } /// Set the model number @@ -177,7 +177,7 @@ class DeviceInfoService : public BaseComponent { logger_.error("Characteristic not created"); return; } - model_number_->setValue(reinterpret_cast(number.data()), number.size()); + model_number_->setValue(number); } /// Set the serial number @@ -187,7 +187,7 @@ class DeviceInfoService : public BaseComponent { logger_.error("Characteristic not created"); return; } - serial_number_->setValue(reinterpret_cast(number.data()), number.size()); + serial_number_->setValue(number); } /// Set the software version @@ -197,7 +197,7 @@ class DeviceInfoService : public BaseComponent { logger_.error("Characteristic not created"); return; } - software_version_->setValue(reinterpret_cast(version.data()), version.size()); + software_version_->setValue(version); } /// Set the firmware version @@ -207,7 +207,7 @@ class DeviceInfoService : public BaseComponent { logger_.error("Characteristic not created"); return; } - firmware_version_->setValue(reinterpret_cast(version.data()), version.size()); + firmware_version_->setValue(version); } /// Set the hardware version @@ -217,7 +217,7 @@ class DeviceInfoService : public BaseComponent { logger_.error("Characteristic not created"); return; } - hardware_version_->setValue(reinterpret_cast(version.data()), version.size()); + hardware_version_->setValue(version); } protected: diff --git a/components/ble_gatt_server/src/ble_gatt_server_callbacks.cpp b/components/ble_gatt_server/src/ble_gatt_server_callbacks.cpp index ed01f1b8e..f10eb6037 100644 --- a/components/ble_gatt_server/src/ble_gatt_server_callbacks.cpp +++ b/components/ble_gatt_server/src/ble_gatt_server_callbacks.cpp @@ -52,7 +52,7 @@ void BleGattServerCallbacks::onDisconnect(NimBLEServer *server, NimBLEConnInfo & } } -void BleGattServerCallbacks::onAuthenticationComplete(const NimBLEConnInfo &conn_info) { +void BleGattServerCallbacks::onAuthenticationComplete(NimBLEConnInfo &conn_info) { if (server_ && server_->callbacks_.authentication_complete_callback) { server_->callbacks_.authentication_complete_callback(conn_info); } @@ -64,7 +64,7 @@ uint32_t BleGattServerCallbacks::onPassKeyDisplay() { return NimBLEDevice::getSecurityPasskey(); } } -void BleGattServerCallbacks::onConfirmPIN(const NimBLEConnInfo &conn_info, uint32_t pass_key) { +void BleGattServerCallbacks::onConfirmPIN(NimBLEConnInfo &conn_info, uint32_t pass_key) { if (server_ && server_->callbacks_.confirm_passkey_callback) { server_->callbacks_.confirm_passkey_callback(conn_info, pass_key); } else { diff --git a/components/esp-nimble-cpp b/components/esp-nimble-cpp index de428fad3..3820f5707 160000 --- a/components/esp-nimble-cpp +++ b/components/esp-nimble-cpp @@ -1 +1 @@ -Subproject commit de428fad3d01b3ead45fbb6de1ebc2ee37ddcdb5 +Subproject commit 3820f57076f88366827978dd637dadd2d27a7f0f diff --git a/components/hid_service/example/main/hid_service_example.cpp b/components/hid_service/example/main/hid_service_example.cpp index 3b92bacac..5b556625d 100644 --- a/components/hid_service/example/main/hid_service_example.cpp +++ b/components/hid_service/example/main/hid_service_example.cpp @@ -109,7 +109,7 @@ extern "C" void app_main(void) { auto input_report = hid_service.input_report(input_report_id); // use the HID service to make an output report characteristic - auto output_report = hid_service.output_report(output_report_id); + [[maybe_unused]] auto output_report = hid_service.output_report(output_report_id); // now that we've made the input characteristic, we can start the service hid_service.start(); diff --git a/components/hid_service/include/hid_service.hpp b/components/hid_service/include/hid_service.hpp index d114e6473..5aba1d4cd 100644 --- a/components/hid_service/include/hid_service.hpp +++ b/components/hid_service/include/hid_service.hpp @@ -104,8 +104,7 @@ class HidService : public espp::BaseComponent { /// @param report_map The report map as a string view. void set_report_map(std::string_view report_map) { if (report_map_) { - report_map_->setValue(reinterpret_cast(report_map.data()), - report_map.size()); + report_map_->setValue(report_map); } else { logger_.error("Report map characteristic not created"); }