mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-30 15:32:41 +00:00
hsp: support de-init
This commit is contained in:
parent
2cc1b993b3
commit
637244f187
@ -78,22 +78,22 @@
|
||||
static const char default_hsp_ag_service_name[] = "Audio Gateway";
|
||||
|
||||
static bd_addr_t remote;
|
||||
static uint8_t channel_nr = 0;
|
||||
static uint8_t channel_nr;
|
||||
|
||||
static uint16_t mtu;
|
||||
static uint16_t rfcomm_cid = 0;
|
||||
static uint16_t sco_handle = HCI_CON_HANDLE_INVALID;
|
||||
static uint16_t rfcomm_handle = HCI_CON_HANDLE_INVALID;
|
||||
static uint16_t rfcomm_cid;
|
||||
static hci_con_handle_t sco_handle;
|
||||
static hci_con_handle_t rfcomm_handle;
|
||||
static btstack_timer_source_t hs_timeout;
|
||||
|
||||
static int ag_microphone_gain = -1;
|
||||
static int ag_speaker_gain = -1;
|
||||
static uint8_t ag_ring = 0;
|
||||
static uint8_t ag_send_ok = 0;
|
||||
static uint8_t ag_send_error = 0;
|
||||
static uint8_t ag_support_custom_commands = 0;
|
||||
static uint8_t hsp_disconnect_rfcomm = 0;
|
||||
static uint8_t hsp_release_audio_connection = 0;
|
||||
static int ag_microphone_gain;
|
||||
static int ag_speaker_gain;
|
||||
static uint8_t ag_ring;
|
||||
static uint8_t ag_send_ok;
|
||||
static uint8_t ag_send_error;
|
||||
static uint8_t ag_support_custom_commands;
|
||||
static uint8_t hsp_disconnect_rfcomm;
|
||||
static uint8_t hsp_release_audio_connection;
|
||||
|
||||
static uint16_t hsp_ag_sco_packet_types;
|
||||
|
||||
@ -122,7 +122,7 @@ typedef enum {
|
||||
HSP_W4_CONNECTION_ESTABLISHED_TO_SHUTDOWN
|
||||
} hsp_state_t;
|
||||
|
||||
static hsp_state_t hsp_state = HSP_IDLE;
|
||||
static hsp_state_t hsp_state;
|
||||
|
||||
static btstack_context_callback_registration_t hsp_ag_handle_sdp_client_query_request;
|
||||
static btstack_packet_handler_t hsp_ag_callback;
|
||||
@ -256,7 +256,8 @@ static void hsp_ag_reset_state(void){
|
||||
|
||||
rfcomm_cid = 0;
|
||||
rfcomm_handle = HCI_CON_HANDLE_INVALID;
|
||||
sco_handle = 0;
|
||||
channel_nr = 0;
|
||||
sco_handle = HCI_CON_HANDLE_INVALID;
|
||||
|
||||
ag_send_ok = 0;
|
||||
ag_send_error = 0;
|
||||
@ -282,6 +283,14 @@ void hsp_ag_init(uint8_t rfcomm_channel_nr){
|
||||
hsp_ag_reset_state();
|
||||
}
|
||||
|
||||
void hsp_ag_deinit(void){
|
||||
(void)memset(remote, 0, 6);
|
||||
(void)memset(&hs_timeout, 0, sizeof(btstack_timer_source_t));
|
||||
(void)memset(&hci_event_callback_registration, 0, sizeof(btstack_packet_callback_registration_t));
|
||||
(void)memset(&hsp_ag_handle_sdp_client_query_request, 0, sizeof(btstack_context_callback_registration_t));
|
||||
hsp_ag_callback = NULL;
|
||||
}
|
||||
|
||||
static void hsp_ag_handle_start_sdp_client_query(void * context){
|
||||
UNUSED(context);
|
||||
if (hsp_state != HSP_W2_SEND_SDP_QUERY) return;
|
||||
|
@ -165,14 +165,19 @@ void hsp_ag_enable_custom_commands(int enable);
|
||||
*/
|
||||
int hsp_ag_send_result(char * result);
|
||||
|
||||
/* API_END */
|
||||
|
||||
/**
|
||||
* @brief Set packet types used for outgoing SCO connection requests
|
||||
* @param common single packet_types: SCO_PACKET_TYPES_*
|
||||
*/
|
||||
void hsp_ag_set_sco_packet_types(uint16_t packet_types);
|
||||
|
||||
/**
|
||||
* @brief De-Init HSP AG
|
||||
*/
|
||||
void hsp_ag_deinit(void);
|
||||
|
||||
/* API_END */
|
||||
|
||||
#if defined __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -81,23 +81,20 @@ static uint8_t channel_nr = 0;
|
||||
|
||||
static uint16_t mtu;
|
||||
static uint16_t rfcomm_cid = 0;
|
||||
static uint16_t sco_handle = 0;
|
||||
static uint16_t rfcomm_handle = HCI_CON_HANDLE_INVALID;
|
||||
static hci_con_handle_t sco_handle;
|
||||
static hci_con_handle_t rfcomm_handle;
|
||||
|
||||
// static uint8_t connection_state = 0;
|
||||
static int hs_microphone_gain;
|
||||
static int hs_speaker_gain;
|
||||
|
||||
static int hs_microphone_gain = -1;
|
||||
static int hs_speaker_gain = -1;
|
||||
static uint8_t hs_send_button_press;
|
||||
static uint8_t wait_ok;
|
||||
static uint8_t hs_accept_sco_connection;
|
||||
|
||||
static uint8_t hs_send_button_press = 0;
|
||||
static uint8_t wait_ok = 0;
|
||||
static uint8_t hs_accept_sco_connection = 0;
|
||||
|
||||
static uint8_t hs_support_custom_indications = 0;
|
||||
static uint8_t hs_support_custom_indications;
|
||||
static btstack_packet_callback_registration_t hci_event_callback_registration;
|
||||
static uint8_t hsp_disconnect_rfcomm = 0;
|
||||
static uint8_t hsp_establish_audio_connection = 0;
|
||||
static uint8_t hsp_release_audio_connection = 0;
|
||||
static uint8_t hsp_establish_audio_connection;
|
||||
static uint8_t hsp_release_audio_connection;
|
||||
|
||||
static uint16_t hsp_hs_sco_packet_types;
|
||||
|
||||
@ -124,7 +121,7 @@ typedef enum {
|
||||
|
||||
static btstack_context_callback_registration_t hsp_hs_handle_sdp_client_query_request;
|
||||
|
||||
static hsp_state_t hsp_state = HSP_IDLE;
|
||||
static hsp_state_t hsp_state;
|
||||
|
||||
static void hsp_run(void);
|
||||
static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size);
|
||||
@ -274,12 +271,16 @@ static void hsp_hs_reset_state(void){
|
||||
hsp_state = HSP_IDLE;
|
||||
hs_microphone_gain = -1;
|
||||
hs_speaker_gain = -1;
|
||||
rfcomm_cid = 0;
|
||||
channel_nr = 0;
|
||||
sco_handle = HCI_CON_HANDLE_INVALID;
|
||||
rfcomm_handle = HCI_CON_HANDLE_INVALID;
|
||||
|
||||
hs_send_button_press = 0;
|
||||
wait_ok = 0;
|
||||
hs_support_custom_indications = 0;
|
||||
|
||||
hsp_disconnect_rfcomm = 0;
|
||||
hs_accept_sco_connection = 0;
|
||||
hsp_establish_audio_connection = 0;
|
||||
hsp_release_audio_connection = 0;
|
||||
}
|
||||
@ -295,6 +296,13 @@ void hsp_hs_init(uint8_t rfcomm_channel_nr){
|
||||
hsp_hs_reset_state();
|
||||
}
|
||||
|
||||
void hsp_hs_deinit(void){
|
||||
(void)memset(remote, 0, 6);
|
||||
(void)memset(&hci_event_callback_registration, 0, sizeof(btstack_packet_callback_registration_t));
|
||||
(void)memset(&hsp_hs_handle_sdp_client_query_request, 0, sizeof(btstack_context_callback_registration_t));
|
||||
hsp_hs_callback = NULL;
|
||||
}
|
||||
|
||||
static void hsp_hs_handle_start_sdp_client_query(void * context){
|
||||
UNUSED(context);
|
||||
if (hsp_state != HSP_W2_SEND_SDP_QUERY) return;
|
||||
|
@ -170,14 +170,19 @@ void hsp_hs_enable_custom_indications(int enable);
|
||||
*/
|
||||
int hsp_hs_send_result(const char * result);
|
||||
|
||||
/* API_END */
|
||||
|
||||
/**
|
||||
* @brief Set packet types used for incoming SCO connection requests
|
||||
* @param common single packet_types: SCO_PACKET_TYPES_*
|
||||
*/
|
||||
void hsp_hs_set_sco_packet_types(uint16_t packet_types);
|
||||
|
||||
/**
|
||||
* @brief De-Init HSP AG
|
||||
*/
|
||||
void hsp_hs_deinit(void);
|
||||
|
||||
/* API_END */
|
||||
|
||||
#if defined __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user