LE Manager Module Initialization Exported Functions

group LE_MGR_INIT_Exported_Functions

Functions

void ble_mgr_init(BLE_MGR_PARAMS *p_params)

Initialize LE manager module.

Example usage

void app_ble_gap_ble_mgr_init(void)
{
    BLE_MGR_PARAMS param = {0};
    param.ble_ext_adv.enable = true;
    param.ble_ext_adv.adv_num = app_ble_gap_get_ext_adv_num();
    param.ble_conn.enable = true;
    uint8_t supported_max_le_link_num = le_get_max_link_num();
    param.ble_conn.link_num = ((MAX_BLE_LINK_NUM <= supported_max_le_link_num) ?
                                MAX_BLE_LINK_NUM : supported_max_le_link_num);
    if (extend_app_cfg_const.ama_support || extend_app_cfg_const.xiaowei_support ||
        extend_app_cfg_const.bisto_support || extend_app_cfg_const.xiaoai_support)
    {
        param.ble_adv_data.enable = true;
        param.ble_adv_data.update_scan_data = true;
        param.ble_adv_data.adv_interval = (extend_app_cfg_const.multi_adv_interval * 8) / 5;
        app_ble_gap_gen_scan_rsp_data(&scan_rsp_data_len, scan_rsp_data);
        param.ble_adv_data.scan_rsp_len = scan_rsp_data_len;
        param.ble_adv_data.scan_rsp_data = scan_rsp_data;
    }
    param.ble_scan.enable = true;
    ble_mgr_init(&param);
}
Parameters:

p_params -- [in] The initialize parameter.

void ble_mgr_handle_gap_cb(uint8_t cb_type, T_LE_CB_DATA *cb_data)

Used to handle GAP callback Message in gap_callback_le.h.

Example usage

static T_APP_RESULT app_ble_gap_cb(uint8_t cb_type, void *p_cb_data)
{
    T_APP_RESULT result = APP_RESULT_SUCCESS;
    T_LE_CB_DATA cb_data;
    memcpy(&cb_data, p_cb_data, sizeof(T_LE_CB_DATA));
    ......
    ble_mgr_handle_gap_cb(cb_type, p_cb_data);
    ......
}
Parameters:
  • cb_type -- [in] Callback type.

  • cb_data -- [in] Callback data.

void ble_mgr_handle_gap_common_cb(uint8_t cb_type, void *p_cb_data)

Used to handle GAP callback Message in gap.h.

Experimental Added Since 2.14.0.0:
Example usage
void test(void)
{
   gap_register_app_cb(app_gap_common_callback);
}
void app_gap_common_callback(uint8_t cb_type, void *p_cb_data)
{
    ble_mgr_handle_gap_common_cb(cb_type, p_cb_data);
}

Note

When application needs to open GATT_SVC_CLIENT_SUPPORTED_FEATURES_EATT_BEARER_BIT by gatt_client_cfg_client_supported_feature, application shall call this function to handle the message of type GAP Msg Type.

Parameters:
void ble_mgr_handle_gap_msg(uint8_t subtype, T_LE_GAP_MSG *gap_msg)

Used to handle GAP Message.

Example usage

void app_ble_gap_handle_gap_msg(T_IO_MSG *p_io_msg)
{
    T_LE_GAP_MSG stack_msg;
    memcpy(&stack_msg, &p_io_msg->u.param, sizeof(p_io_msg->u.param));
    ......
    ble_mgr_handle_gap_msg(p_io_msg->subtype, &stack_msg);
    ......
}
Parameters:
  • subtype -- [in] GAP message subtype.

  • gap_msg -- [in] GAP message data.

bool ble_mgr_msg_cback_register(BLE_MGR_MSG_CB cb)

Other modules can register callback functions to handle GAP Messages.

Example usage

void app_device_init(void)
{
    ble_mgr_msg_cback_register(app_device_ble_cback);
    ......
}
Parameters:

cb -- [in] LE manager callback function.

Return values:
  • true -- Operation success.

  • false -- Operation failure.

Returns:

Operation result.