mirror of
https://github.com/esphome/esphome.git
synced 2025-11-18 15:55:46 +00:00
Merge branch 'mac_address_buffer' into integration
This commit is contained in:
@@ -646,6 +646,13 @@ void get_mac_address_into_buffer(std::span<char, 13> buf) {
|
|||||||
format_mac_addr_lower_no_sep(mac, buf.data());
|
format_mac_addr_lower_no_sep(mac, buf.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *get_mac_address_pretty_into_buffer(std::span<char, 18> buf) {
|
||||||
|
uint8_t mac[6];
|
||||||
|
get_mac_address_raw(mac);
|
||||||
|
format_mac_addr_upper(mac, buf.data());
|
||||||
|
return buf.data();
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef USE_ESP32
|
#ifndef USE_ESP32
|
||||||
bool has_custom_mac_address() { return false; }
|
bool has_custom_mac_address() { return false; }
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1125,12 +1125,7 @@ void get_mac_address_into_buffer(std::span<char, 13> buf);
|
|||||||
/// Get the device MAC address into the given buffer, in colon-separated uppercase hex notation.
|
/// Get the device MAC address into the given buffer, in colon-separated uppercase hex notation.
|
||||||
/// Buffer must be exactly 18 bytes (17 for "XX:XX:XX:XX:XX:XX" + null terminator).
|
/// Buffer must be exactly 18 bytes (17 for "XX:XX:XX:XX:XX:XX" + null terminator).
|
||||||
/// Returns pointer to the buffer for convenience.
|
/// Returns pointer to the buffer for convenience.
|
||||||
inline const char *get_mac_address_pretty_into_buffer(std::span<char, 18> buf) {
|
const char *get_mac_address_pretty_into_buffer(std::span<char, 18> buf);
|
||||||
uint8_t mac[6];
|
|
||||||
get_mac_address_raw(mac);
|
|
||||||
format_mac_addr_upper(mac, buf.data());
|
|
||||||
return buf.data();
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef USE_ESP32
|
#ifdef USE_ESP32
|
||||||
/// Set the MAC address to use from the provided byte array (6 bytes).
|
/// Set the MAC address to use from the provided byte array (6 bytes).
|
||||||
|
|||||||
Reference in New Issue
Block a user