MAC address value type, reading, and configuration.
More...
MAC address value type, reading, and configuration.
◆ mac_type
Identifies which network interface a MAC address belongs to.
| Enumerator |
|---|
| wifi_sta | WiFi station interface.
|
| wifi_softap | WiFi soft-AP interface.
|
| bt | Bluetooth interface.
|
| ethernet | Ethernet interface.
|
| base | Base (factory) MAC address.
|
| efuse_factory | Factory MAC stored in eFuse.
|
| efuse_custom | Custom MAC stored in eFuse.
|
Definition at line 33 of file mac.hpp.
◆ base_mac_address()
Returns the base MAC address.
The base MAC address is used to derive per-interface MAC addresses.
- Returns
- The base MAC address.
- Note
- Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
- Exceptions
-
| std::system_error | on failure. |
◆ read_mac()
Reads the MAC address for a specific interface.
- Parameters
-
| type | The interface type to read. |
- Returns
- The MAC address.
- Note
- Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
- Exceptions
-
| std::system_error | on failure. |
◆ set_base_mac_address()
Sets the base MAC address.
The base MAC address is used to derive per-interface MAC addresses. This overrides the factory-programmed address until the next reboot.
- Parameters
-
| addr | The new base MAC address. |
- Note
- Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
- Exceptions
-
| std::system_error | on failure. |
◆ set_interface_mac_address()
Sets the MAC address for a specific interface.
- Parameters
-
| addr | The MAC address to set. |
| type | The interface type. |
- Note
- Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
- Exceptions
-
| std::system_error | on failure. |
◆ to_string()
Returns a colon-separated string representation of a MAC address.
- Parameters
-
| addr | The MAC address to convert. |
- Returns
- A string in "AA:BB:CC:DD:EE:FF" format.
◆ try_base_mac_address()
Returns the base MAC address.
The base MAC address is used to derive per-interface MAC addresses.
- Returns
- The base MAC address, or an error.
◆ try_custom_mac()
Returns the custom MAC address from eFuse.
- Returns
- The custom MAC address, or an error.
- Return values
-
◆ try_default_mac()
Returns the factory MAC address from eFuse.
- Returns
- The factory MAC address, or an error.
◆ try_derive_local_mac()
Derives a local MAC address from a universal MAC address.
Creates a locally-administered unicast MAC address by modifying the U/L bit and adjusting the last byte.
- Parameters
-
| universal_mac | The universal MAC address to derive from. |
- Returns
- The derived local MAC address, or an error.
◆ try_read_mac()
Reads the MAC address for a specific interface.
- Parameters
-
| type | The interface type to read. |
- Returns
- The MAC address, or an error.
- Return values
-
◆ try_set_base_mac_address()
Sets the base MAC address.
The base MAC address is used to derive per-interface MAC addresses. This overrides the factory-programmed address until the next reboot.
- Parameters
-
| addr | The new base MAC address. |
- Returns
- Success, or an error.
- Return values
-
◆ try_set_interface_mac_address()
Sets the MAC address for a specific interface.
- Parameters
-
| addr | The MAC address to set. |
| type | The interface type. |
- Returns
- Success, or an error.
- Return values
-