Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Compatibility with std::string in ESP32_BLE_Mouse Library #74

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

robosphere99
Copy link

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.

@robosphere99
Copy link
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. 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant