mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Common/Network: Add BluetoothAddress struct and string conversion functions.
This commit is contained in:
@@ -86,6 +86,21 @@ std::optional<MACAddress> StringToMacAddress(std::string_view mac_string)
|
||||
return std::make_optional(mac);
|
||||
}
|
||||
|
||||
std::string BluetoothAddressToString(BluetoothAddress bdaddr)
|
||||
{
|
||||
std::ranges::reverse(bdaddr);
|
||||
return MacAddressToString(std::bit_cast<MACAddress>(bdaddr));
|
||||
}
|
||||
|
||||
std::optional<BluetoothAddress> StringToBluetoothAddress(std::string_view str)
|
||||
{
|
||||
auto result = StringToMacAddress(str);
|
||||
if (!result)
|
||||
return std::nullopt;
|
||||
std::ranges::reverse(*result);
|
||||
return std::bit_cast<BluetoothAddress>(*result);
|
||||
}
|
||||
|
||||
EthernetHeader::EthernetHeader() = default;
|
||||
|
||||
EthernetHeader::EthernetHeader(u16 ether_type) : ethertype(htons(ether_type))
|
||||
|
||||
Reference in New Issue
Block a user