Fix Compatibility with std::string in ESP32_BLE_Mouse Library#74
Open
robosphere99 wants to merge 1 commit intoT-vK:masterfrom
Open
Fix Compatibility with std::string in ESP32_BLE_Mouse Library#74robosphere99 wants to merge 1 commit intoT-vK:masterfrom
robosphere99 wants to merge 1 commit intoT-vK:masterfrom
Conversation
Author
|
I made changes to the ESP32_BLE_Mouse library to fix compatibility issues with std::string and Arduino's String type. After resolving the type mismatches in BleMouse.cpp, the project is now working perfectly. The BLE mouse functionality is smooth, and all features are performing as expected without any errors. 😊 |
|
This fairly trivial PR is required to build the code with recent releases of Arduino IDE. Please consider merging it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request resolves compatibility issues in the ESP32_BLE_Mouse library, ensuring smoother integration and functionality with Arduino functions that require the String type. The following fixes were implemented:
Key Changes:
BLEDevice::init():
Fixed a type mismatch by converting std::string to String using .c_str().
Updated line 143 in BleMouse.cpp:
cpp
Copy code
BLEDevice::init(String(bleMouseInstance->deviceName.c_str()));
BLECharacteristic::setValue():
Resolved a similar issue by converting std::string to String.
Updated line 151 in BleMouse.cpp:
bleMouseInstance->hid->manufacturer()->setValue(String(bleMouseInstance->deviceManufacturer.c_str()));
Reason for Changes:
The library was originally passing std::string (C++ Standard Library) to functions that require String (Arduino-specific type). This caused compilation errors on Arduino platforms. These changes ensure type compatibility and make the library fully functional without modifying the user's project code.
Testing:
Verified the fixes on an ESP32-based project.
Ensured smooth initialization of BLE and successful updates to the characteristic values.
Tested with multiple BLE devices and ensured backward compatibility.
Impact:
Fixes critical compilation issues caused by type mismatches.
Ensures seamless use of the library on the latest ESP32 Arduino Core.
No breaking changes introduced.
Recommendation to Maintainers:
Consider adding explicit support for std::string in future versions for broader compatibility.