MT2523 API Reference  LinkIt SDK v4
Power management

This section defines the confirmation types and APIs to switch the power on and off. More...

Overview

This section defines the confirmation types and APIs to switch the power on and off.

How to use this module

The application layer can power on the Bluetooth if it is powered off and a stack memory is assigned.

Functions

bt_status_t bt_power_on (bt_bd_addr_ptr_t public_addr, bt_bd_addr_ptr_t random_addr)
 This function powers on the Bluetooth. More...
 
bt_status_t bt_power_off (void)
 This function powers off the Bluetooth. More...
 
bt_status_t bt_app_event_callback (bt_msg_type_t msg, bt_status_t status, void *buf)
 This function is a static callback for the application to listen to the event. More...
 

Modules

 Define
 Define the power on or off events.
 
 Struct
 Define power on event parameter structure.
 

Function Documentation

bt_status_t bt_app_event_callback ( bt_msg_type_t  msg,
bt_status_t  status,
void *  buf 
)

This function is a static callback for the application to listen to the event.

Provide a user-defined callback.

Parameters
[in]msgis the callback message type.
[in]statusis the status of the callback message.
[in]bufis the payload of the callback message.
Returns
The status of this operation returned from the callback.
bt_status_t bt_power_off ( void  )

This function powers off the Bluetooth.

The SDK will not send disconnect requests to the existing connections during the power off operation. The application layer will receive BT_POWER_OFF_CNF after the Bluetooth is powered off.

Returns
BT_STATUS_SUCCESS, the power off request has been sent successfully. BT_STATUS_FAIL, the operation fails due to the same operation is ongoing. BT_STATUS_OUT_OF_MEMORY, the operation fails due to out of memory.
bt_status_t bt_power_on ( bt_bd_addr_ptr_t  public_addr,
bt_bd_addr_ptr_t  random_addr 
)

This function powers on the Bluetooth.

The application layer receives BT_POWER_ON_CNF with bt_power_on_cnf_t after the Bluetooth is powered on. Make sure the memory is initialized, the Bluetooth task is created and Bluetooth is powered on before calling any other Bluetooth APIs.

Parameters
[in]public_addris a pointer to a given public address (6 bytes). If public_addr is NULL, the controller will generate a public address and provide it to the user using BT_POWER_ON_CNF with bt_power_on_cnf_t. If public_addr is not NULL, the address in the BT_POWER_ON_CNF is same as public_addr. The given public address should not be [00-00-00-00-00-00].
[in]random_addris a pointer to a given random address(6 bytes).
Returns
BT_STATUS_SUCCESS, the power on request has been sent successfully. BT_STATUS_FAIL, the operation fails due to the same operation is ongoing. BT_STATUS_OUT_OF_MEMORY, the operation fails due to out of memory.