[WIP] Fix inconsistent Bluetooth address case across platforms
Description
This PR resolves issue #280 by ensuring that Peripheral::address() always returns addresses in a consistent uppercase format across all operating systems.
Problem
Previously, Peripheral::address() returned a lowercase std::string on Windows and an uppercase std::string on Linux, causing inconsistent behavior across platforms. This inconsistency made it difficult for users to reliably compare or display Bluetooth addresses.
Solution
Given that each OS handles the MAC string internally in a different way, we've added a new bluetoothAddress class (kvn::bluetoothAddress) that provides a consistent interface for Bluetooth address handling. This class:
-
Preserves the original case internally (via
raw()method) for compatibility with OS-specific implementations -
Always exposes an uppercase version when converted to string (via
to_string()method or implicit conversion tostd::string) -
Provides case-insensitive comparison operators (
==and<) -
Maintains backward compatibility through implicit conversion to
std::string, ensuring existing code continues to work
The BluetoothAddress type alias has been updated from std::string to kvn::bluetoothAddress in simpleble/include/simpleble/Types.h, ensuring that all Peripheral::address() calls now return a consistent uppercase format regardless of the underlying OS implementation.
Changes
- Added
dependencies/external/kvn/kvn_bluetooth_address.h- NewbluetoothAddressclass implementation - Updated
simpleble/include/simpleble/Types.h- ChangedBluetoothAddresstype alias fromstd::stringtokvn::bluetoothAddress
Related Issue
Fixes #280