| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513 |
- /*
- * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
- *
- * SPDX-License-Identifier: Apache-2.0
- */
- #include <stdint.h>
- #include <stdlib.h>
- #include <string.h>
- #include <stdlib.h>
- #include <assert.h>
- #include "bt_common.h"
- #include "btc/btc_common.h"
- #include "btc/btc_dm.h"
- #include "btc_hf_ag.h"
- #include "btc/btc_profile_queue.h"
- #include "btc/btc_manage.h"
- #include "btc/btc_util.h"
- #include "bta/bta_ag_api.h"
- #include "bta/bta_api.h"
- #include "common/bt_target.h"
- #include "common/bt_defs.h"
- #include "device/bdaddr.h"
- #include "esp_bt.h"
- #include "esp_hf_ag_api.h"
- #include "esp_err.h"
- #include "esp_bt_main.h"
- #include "osi/allocator.h"
- #if (BTC_HF_INCLUDED == TRUE)
- esp_err_t esp_hf_ag_register_callback(esp_hf_cb_t callback)
- {
- if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
- return ESP_ERR_INVALID_STATE;
- }
- if (callback == NULL) {
- return ESP_FAIL;
- }
- btc_profile_cb_set(BTC_PID_HF, callback);
- return ESP_OK;
- }
- esp_err_t esp_hf_ag_init(void)
- {
- if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
- return ESP_ERR_INVALID_STATE;
- }
- btc_msg_t msg;
- msg.sig = BTC_SIG_API_CALL;
- msg.pid = BTC_PID_HF;
- msg.act = BTC_HF_INIT_EVT;
- /* Switch to BTC context */
- bt_status_t status = btc_transfer_context(&msg, NULL, sizeof(btc_hf_args_t), NULL);
- return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
- }
- esp_err_t esp_hf_ag_deinit(void)
- {
- if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
- return ESP_ERR_INVALID_STATE;
- }
- btc_msg_t msg;
- msg.sig = BTC_SIG_API_CALL;
- msg.pid = BTC_PID_HF;
- msg.act = BTC_HF_DEINIT_EVT;
- /* Switch to BTC context */
- bt_status_t status = btc_transfer_context(&msg, NULL, sizeof(btc_hf_args_t), NULL);
- return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
- }
- esp_err_t esp_hf_ag_slc_connect(esp_bd_addr_t remote_addr)
- {
- if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
- return ESP_ERR_INVALID_STATE;
- }
- btc_msg_t msg;
- msg.sig = BTC_SIG_API_CALL;
- msg.pid = BTC_PID_HF;
- msg.act = BTC_HF_CONNECT_EVT;
- btc_hf_args_t arg;
- memset(&arg, 0, sizeof(btc_hf_args_t));
- memcpy(&(arg.connect), remote_addr, sizeof(esp_bd_addr_t));
- /* Switch to BTC context */
- bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL);
- return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
- }
- esp_err_t esp_hf_ag_slc_disconnect(esp_bd_addr_t remote_addr)
- {
- if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
- return ESP_ERR_INVALID_STATE;
- }
- btc_msg_t msg;
- msg.sig = BTC_SIG_API_CALL;
- msg.pid = BTC_PID_HF;
- msg.act = BTC_HF_DISCONNECT_EVT;
- btc_hf_args_t arg;
- memset(&arg, 0, sizeof(btc_hf_args_t));
- memcpy(&(arg.disconnect), remote_addr, sizeof(esp_bd_addr_t));
- /* Switch to BTC context */
- bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL);
- return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
- }
- esp_err_t esp_hf_ag_audio_connect(esp_bd_addr_t remote_addr)
- {
- if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
- return ESP_ERR_INVALID_STATE;
- }
- btc_msg_t msg;
- msg.sig = BTC_SIG_API_CALL;
- msg.pid = BTC_PID_HF;
- msg.act = BTC_HF_CONNECT_AUDIO_EVT;
- btc_hf_args_t arg;
- memset(&arg, 0, sizeof(btc_hf_args_t));
- memcpy(&(arg.connect_audio), remote_addr, sizeof(esp_bd_addr_t));
- /* Switch to BTC context */
- bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL);
- return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
- }
- esp_err_t esp_hf_ag_audio_disconnect(esp_bd_addr_t remote_addr)
- {
- if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
- return ESP_ERR_INVALID_STATE;
- }
- btc_msg_t msg;
- msg.sig = BTC_SIG_API_CALL;
- msg.pid = BTC_PID_HF;
- msg.act = BTC_HF_DISCONNECT_AUDIO_EVT;
- btc_hf_args_t arg;
- memset(&arg, 0, sizeof(btc_hf_args_t));
- memcpy(&(arg.disconnect_audio), remote_addr, sizeof(esp_bd_addr_t));
- /* Switch to BTC context */
- bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL);
- return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
- }
- esp_err_t esp_hf_ag_vra_control(esp_bd_addr_t remote_addr, esp_hf_vr_state_t value)
- {
- if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
- return ESP_ERR_INVALID_STATE;
- }
- btc_msg_t msg;
- msg.sig = BTC_SIG_API_CALL;
- msg.pid = BTC_PID_HF;
- msg.act = BTC_HF_VRA_EVT;
- btc_hf_args_t arg;
- memset(&arg, 0, sizeof(btc_hf_args_t));
- arg.vra_rep.value = value;
- memcpy(&(arg.volcon.remote_addr), remote_addr, sizeof(esp_bd_addr_t));
- /* Switch to BTC context */
- bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL);
- return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
- }
- esp_err_t esp_hf_ag_volume_control(esp_bd_addr_t remote_addr, esp_hf_volume_control_target_t type, int volume)
- {
- if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
- return ESP_ERR_INVALID_STATE;
- }
- btc_msg_t msg;
- msg.sig = BTC_SIG_API_CALL;
- msg.pid = BTC_PID_HF;
- msg.act = BTC_HF_VOLUME_CONTROL_EVT;
- btc_hf_args_t arg;
- memset(&arg, 0, sizeof(btc_hf_args_t));
- arg.volcon.target_type = type;
- arg.volcon.volume = volume;
- memcpy(&(arg.volcon.remote_addr), remote_addr, sizeof(esp_bd_addr_t));
- /* Switch to BTC context */
- bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL);
- return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
- }
- esp_err_t esp_hf_ag_unknown_at_send(esp_bd_addr_t remote_addr, char *unat)
- {
- if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
- return ESP_ERR_INVALID_STATE;
- }
- btc_msg_t msg;
- msg.sig = BTC_SIG_API_CALL;
- msg.pid = BTC_PID_HF;
- msg.act = BTC_HF_UNAT_RESPONSE_EVT;
- btc_hf_args_t arg;
- memset(&arg, 0, sizeof(btc_hf_args_t));
- arg.unat_rep.unat = unat;
- memcpy(&(arg.unat_rep.remote_addr), remote_addr, sizeof(esp_bd_addr_t));
- /* Switch to BTC context */
- bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), btc_hf_arg_deep_copy);
- return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
- }
- esp_err_t esp_hf_ag_cmee_send(esp_bd_addr_t remote_addr, esp_hf_at_response_code_t response_code, esp_hf_cme_err_t error_code)
- {
- if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
- return ESP_ERR_INVALID_STATE;
- }
- btc_msg_t msg;
- msg.sig = BTC_SIG_API_CALL;
- msg.pid = BTC_PID_HF;
- msg.act = BTC_HF_CME_ERR_EVT;
- btc_hf_args_t arg;
- memset(&arg, 0, sizeof(btc_hf_args_t));
- arg.ext_at.response_code = response_code;
- arg.ext_at.error_code = error_code;
- memcpy(&(arg.ext_at.remote_addr), remote_addr, sizeof(esp_bd_addr_t));
- /* Switch to BTC context */
- bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL);
- return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
- }
- esp_err_t esp_hf_ag_devices_status_indchange(esp_bd_addr_t remote_addr,
- esp_hf_call_status_t call_state,
- esp_hf_call_setup_status_t call_setup_state,
- esp_hf_network_state_t ntk_state, int signal)
- {
- if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
- return ESP_ERR_INVALID_STATE;
- }
- btc_msg_t msg;
- msg.sig = BTC_SIG_API_CALL;
- msg.pid = BTC_PID_HF;
- msg.act = BTC_HF_IND_NOTIFICATION_EVT;
- btc_hf_args_t arg;
- memset(&arg, 0, sizeof(btc_hf_args_t));
- memcpy(&(arg.ind_change.remote_addr), remote_addr, sizeof(esp_bd_addr_t));
- arg.ind_change.call_state = call_state;
- arg.ind_change.call_setup_state = call_setup_state;
- arg.ind_change.ntk_state = ntk_state;
- arg.ind_change.signal = signal;
- /* Switch to BTC context */
- bt_status_t state = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL);
- return (state == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
- }
- esp_err_t esp_hf_ag_cind_response(esp_bd_addr_t remote_addr,
- esp_hf_call_status_t call_state,
- esp_hf_call_setup_status_t call_setup_state,
- esp_hf_network_state_t ntk_state, int signal, esp_hf_roaming_status_t roam, int batt_lev,
- esp_hf_call_held_status_t call_held_status)
- {
- if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
- return ESP_ERR_INVALID_STATE;
- }
- btc_msg_t msg;
- msg.sig = BTC_SIG_API_CALL;
- msg.pid = BTC_PID_HF;
- msg.act = BTC_HF_CIND_RESPONSE_EVT;
- btc_hf_args_t arg;
- memset(&arg, 0, sizeof(btc_hf_args_t));
- memcpy(&(arg.cind_rep.remote_addr), remote_addr, sizeof(esp_bd_addr_t));
- arg.cind_rep.call_state = call_state;
- arg.cind_rep.call_setup_state = call_setup_state;
- arg.cind_rep.ntk_state = ntk_state;
- arg.cind_rep.signal = signal;
- arg.cind_rep.roam = roam;
- arg.cind_rep.batt_lev = batt_lev;
- arg.cind_rep.call_held_state = call_held_status;
- /* Switch to BTC context */
- bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL);
- return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
- }
- esp_err_t esp_hf_ag_cops_response(esp_bd_addr_t remote_addr, char *name)
- {
- if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
- return ESP_ERR_INVALID_STATE;
- }
- btc_msg_t msg;
- msg.sig = BTC_SIG_API_CALL;
- msg.pid = BTC_PID_HF;
- msg.act = BTC_HF_COPS_RESPONSE_EVT;
- btc_hf_args_t arg;
- memset(&arg, 0, sizeof(btc_hf_args_t));
- memcpy(&(arg.cops_rep.remote_addr), remote_addr, sizeof(esp_bd_addr_t));
- arg.cops_rep.name = name; //deep_copy
- /* Switch to BTC context */
- bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), btc_hf_arg_deep_copy);
- return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
- }
- esp_err_t esp_hf_ag_clcc_response(esp_bd_addr_t remote_addr, int index, esp_hf_current_call_direction_t dir,
- esp_hf_current_call_status_t current_call_state, esp_hf_current_call_mode_t mode,
- esp_hf_current_call_mpty_type_t mpty, char *number, esp_hf_call_addr_type_t type)
- {
- if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
- return ESP_ERR_INVALID_STATE;
- }
- btc_msg_t msg;
- msg.sig = BTC_SIG_API_CALL;
- msg.pid = BTC_PID_HF;
- msg.act = BTC_HF_CLCC_RESPONSE_EVT;
- btc_hf_args_t arg;
- memset(&arg, 0, sizeof(btc_hf_args_t));
- memcpy(&(arg.clcc_rep.remote_addr), remote_addr, sizeof(esp_bd_addr_t));
- //mandatory args
- arg.clcc_rep.index = index;
- arg.clcc_rep.dir = dir;
- arg.clcc_rep.current_call_state = current_call_state;
- arg.clcc_rep.mode = mode;
- arg.clcc_rep.mpty = mpty;
- // option args
- arg.clcc_rep.number = number; //deep_copy
- arg.clcc_rep.type = type;
- /* Switch to BTC context */
- bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), btc_hf_arg_deep_copy);
- return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
- }
- esp_err_t esp_hf_ag_cnum_response(esp_bd_addr_t remote_addr, char *number, esp_hf_subscriber_service_type_t type)
- {
- if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
- return ESP_ERR_INVALID_STATE;
- }
- btc_msg_t msg;
- msg.sig = BTC_SIG_API_CALL;
- msg.pid = BTC_PID_HF;
- msg.act = BTC_HF_CNUM_RESPONSE_EVT;
- btc_hf_args_t arg;
- memset(&arg, 0, sizeof(btc_hf_args_t));
- memcpy(&(arg.cnum_rep), remote_addr, sizeof(esp_bd_addr_t));
- arg.cnum_rep.number = number; //deep_copy
- arg.cnum_rep.type = type;
- /* Switch to BTC context */
- bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), btc_hf_arg_deep_copy);
- return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
- }
- esp_err_t esp_hf_ag_bsir(esp_bd_addr_t remote_addr, esp_hf_in_band_ring_state_t state)
- {
- if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
- return ESP_ERR_INVALID_STATE;
- }
- btc_msg_t msg;
- msg.sig = BTC_SIG_API_CALL;
- msg.pid = BTC_PID_HF;
- msg.act = BTC_HF_INBAND_RING_EVT;
- btc_hf_args_t arg;
- memset(&arg, 0, sizeof(btc_hf_args_t));
- memcpy(&(arg.bsir.remote_addr), remote_addr, sizeof(esp_bd_addr_t));
- arg.bsir.state = state;
- /* Switch to BTC context */
- bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL);
- return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
- }
- esp_err_t esp_hf_ag_answer_call(esp_bd_addr_t remote_addr, int num_active, int num_held,
- esp_hf_call_status_t call_state, esp_hf_call_setup_status_t call_setup_state,
- char *number, esp_hf_call_addr_type_t call_addr_type)
- {
- if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
- return ESP_ERR_INVALID_STATE;
- }
- btc_msg_t msg;
- msg.sig = BTC_SIG_API_CALL;
- msg.pid = BTC_PID_HF;
- msg.act = BTC_HF_AC_INCALL_EVT;
- btc_hf_args_t arg;
- memset(&arg, 0, sizeof(btc_hf_args_t));
- memcpy(&(arg.phone.remote_addr), remote_addr, sizeof(esp_bd_addr_t));
- arg.phone.num_active = num_active;
- arg.phone.num_held = num_held;
- arg.phone.call_state = call_state;
- arg.phone.call_setup_state = call_setup_state;
- arg.phone.number = number; //deep_copy
- arg.phone.call_addr_type = call_addr_type;
- /* Switch to BTC context */
- bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), btc_hf_arg_deep_copy);
- return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
- }
- esp_err_t esp_hf_ag_reject_call(esp_bd_addr_t remote_addr, int num_active, int num_held,
- esp_hf_call_status_t call_state, esp_hf_call_setup_status_t call_setup_state,
- char *number, esp_hf_call_addr_type_t call_addr_type)
- {
- if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
- return ESP_ERR_INVALID_STATE;
- }
- btc_msg_t msg;
- msg.sig = BTC_SIG_API_CALL;
- msg.pid = BTC_PID_HF;
- msg.act = BTC_HF_RJ_INCALL_EVT;
- btc_hf_args_t arg;
- memset(&arg, 0, sizeof(btc_hf_args_t));
- memcpy(&(arg.phone.remote_addr), remote_addr, sizeof(esp_bd_addr_t));
- arg.phone.num_active = num_active;
- arg.phone.num_held = num_held;
- arg.phone.call_state = call_state;
- arg.phone.call_setup_state = call_setup_state;
- arg.phone.number = number; //deep_copy
- arg.phone.call_addr_type = call_addr_type;
- /* Switch to BTC context */
- bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), btc_hf_arg_deep_copy);
- return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
- }
- esp_err_t esp_hf_ag_end_call(esp_bd_addr_t remote_addr, int num_active, int num_held,
- esp_hf_call_status_t call_state, esp_hf_call_setup_status_t call_setup_state,
- char *number, esp_hf_call_addr_type_t call_addr_type)
- {
- if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
- return ESP_ERR_INVALID_STATE;
- }
- btc_msg_t msg;
- msg.sig = BTC_SIG_API_CALL;
- msg.pid = BTC_PID_HF;
- msg.act = BTC_HF_END_CALL_EVT;
- btc_hf_args_t arg;
- memset(&arg, 0, sizeof(btc_hf_args_t));
- memcpy(&(arg.phone.remote_addr), remote_addr, sizeof(esp_bd_addr_t));
- arg.phone.num_active = num_active;
- arg.phone.num_held = num_held;
- arg.phone.call_state = call_state;
- arg.phone.call_setup_state = call_setup_state;
- arg.phone.number = number; //deep_copy
- arg.phone.call_addr_type = call_addr_type;
- /* Switch to BTC context */
- bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), btc_hf_arg_deep_copy);
- return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
- }
- esp_err_t esp_hf_ag_out_call(esp_bd_addr_t remote_addr, int num_active, int num_held,
- esp_hf_call_status_t call_state, esp_hf_call_setup_status_t call_setup_state,
- char *number, esp_hf_call_addr_type_t call_addr_type)
- {
- if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
- return ESP_ERR_INVALID_STATE;
- }
- btc_msg_t msg;
- msg.sig = BTC_SIG_API_CALL;
- msg.pid = BTC_PID_HF;
- msg.act = BTC_HF_OUT_CALL_EVT;
- btc_hf_args_t arg;
- memset(&arg, 0, sizeof(btc_hf_args_t));
- memcpy(&(arg.phone.remote_addr), remote_addr, sizeof(esp_bd_addr_t));
- arg.phone.num_active = num_active;
- arg.phone.num_held = num_held;
- arg.phone.call_state = call_state;
- arg.phone.call_setup_state = call_setup_state;
- arg.phone.number = number; //deep_copy
- arg.phone.call_addr_type = call_addr_type;
- /* Switch to BTC context */
- bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), btc_hf_arg_deep_copy);
- return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
- }
- esp_err_t esp_hf_ag_register_data_callback(esp_hf_incoming_data_cb_t recv, esp_hf_outgoing_data_cb_t send)
- {
- if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
- return ESP_ERR_INVALID_STATE;
- }
- btc_msg_t msg;
- msg.sig = BTC_SIG_API_CALL;
- msg.pid = BTC_PID_HF;
- msg.act = BTC_HF_REGISTER_DATA_CALLBACK_EVT;
- btc_hf_args_t arg;
- memset(&arg, 0, sizeof(btc_hf_args_t));
- arg.reg_data_cb.recv = recv;
- arg.reg_data_cb.send = send;
- /* Switch to BTC context */
- bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL);
- return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
- }
- #if (BTM_SCO_HCI_INCLUDED == TRUE)
- void esp_hf_ag_outgoing_data_ready(void)
- {
- btc_hf_ci_sco_data();
- }
- #endif /* #if (BTM_SCO_HCI_INCLUDED == TRUE ) */
- #endif // BTC_HF_INCLUDED
|