bt_mac_address_get()

bt_mac_address_get()

Description

Retrieves the MAC address of the onboard Bluetooth module and stores it into the provided array.

Syntax

bt_mac_address_get(mac_addr[]);

Parameters

Variable

Input

mac_addr[]

The MAC address will be stored in the provided MAC address array, which must have a minimum size of 6 bytes.

Returns

Return value

Return explanation

SCRIPT_OPERATION_SUCCESS

Successfully managed to read MAC address.

SCRIPT_OPERATION_FAILED

Failed to read out MAC address.

SCRIPT_PARAM_INVALID

Invalid parameters. This indicates that an incorrect size of the array was provided to the function. The MAC address array should have a minimum size of 6 bytes.

SCRIPT_NO_ACCESS

Bluetooth is not initialized.

Function call example

#include <io> #include <read> #include <float> #include <string> #include <core> #include <write> #include <define> #include <socket> #include <bluetooth> new mac_addr_buf[MAC_ADDR_SIZE] = [0]; main() { bt_init(); bt_mac_address_get(mac_addr_buf); for(;;) { Delay(100); } }

Notes and Warnings

Typically, MAC reading fails when the host MCU cannot communicate with the Bluetooth module or when the Bluetooth module has not been initialized.