hfp: review UNUSED

This commit is contained in:
Matthias Ringwald 2017-09-27 11:33:34 +02:00
parent f08eeab9ea
commit 8a46ec4062
4 changed files with 28 additions and 28 deletions

View File

@ -459,9 +459,9 @@ void hfp_create_sdp_record(uint8_t * service, uint32_t service_record_handle, ui
static hfp_connection_t * connection_doing_sdp_query = NULL;
static void handle_query_rfcomm_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
UNUSED(packet_type);
UNUSED(channel);
UNUSED(size);
UNUSED(packet_type); // ok: handling own sdp events
UNUSED(channel); // ok: no channel
UNUSED(size); // ok: handling own sdp events
hfp_connection_t * hfp_connection = connection_doing_sdp_query;
if (!hfp_connection) {
@ -536,7 +536,7 @@ static void hfp_handle_failed_sco_connection(uint8_t status){
void hfp_handle_hci_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
UNUSED(channel);
UNUSED(channel); // ok: no channel
bd_addr_t event_addr;
uint16_t rfcomm_cid, handle;

View File

@ -435,14 +435,6 @@ static int hfp_ag_send_retrieve_indicators_status_cmd(uint16_t cid){
return send_str_over_rfcomm(cid, buffer);
}
static int hfp_ag_send_set_indicator_status_update_cmd(uint16_t cid, uint8_t activate){
UNUSED(activate);
// AT\r\n%s:3,0,0,%d\r\n
return hfp_ag_send_ok(cid);
}
static int hfp_ag_send_retrieve_can_hold_call_cmd(uint16_t cid){
char buffer[40];
int offset = snprintf(buffer, sizeof(buffer), "\r\n%s:", HFP_SUPPORT_CALL_HOLD_AND_MULTIPARTY_SERVICES);
@ -700,7 +692,7 @@ static int hfp_ag_run_for_context_service_level_connection(hfp_connection_t * hf
} else {
hfp_ag_slc_established(hfp_connection);
}
hfp_ag_send_set_indicator_status_update_cmd(hfp_connection->rfcomm_cid, 1);
hfp_ag_send_ok(hfp_connection->rfcomm_cid);
return 1;
case HFP_CMD_SUPPORT_CALL_HOLD_AND_MULTIPARTY_SERVICES:
@ -1830,16 +1822,21 @@ static hfp_generic_status_indicator_t *get_hf_indicator_by_number(int number){
}
static void hfp_handle_rfcomm_data(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
UNUSED(packet_type);
UNUSED(packet_type); // ok: only called with RFCOMM_DATA_PACKET
// assertion: size >= 1 as rfcomm.c does not deliver empty packets
if (size < 1) return;
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_rfcomm_cid(channel);
if (!hfp_connection) return;
// temp overwrite last byte (most likely \n for log_info)
char last_char = packet[size-1];
packet[size-1] = 0;
log_info("HFP_RX %s", packet);
packet[size-1] = last_char;
// process messages byte-wise
int pos;
for (pos = 0; pos < size ; pos++){
hfp_parse(hfp_connection, packet[pos], 0);

View File

@ -988,16 +988,21 @@ static void hfp_hf_switch_on_ok(hfp_connection_t *hfp_connection){
static void hfp_handle_rfcomm_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
UNUSED(packet_type);
UNUSED(packet_type); // ok: only called with RFCOMM_DATA_PACKET
// assertion: size >= 1 as rfcomm.c does not deliver empty packets
if (size < 1) return;
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_rfcomm_cid(channel);
if (!hfp_connection) return;
// temp overwrite last byte (most likely \n for log_info)
char last_char = packet[size-1];
packet[size-1] = 0;
log_info("HFP_RX %s", packet);
packet[size-1] = last_char;
// process messages byte-wise
int pos, i, value;
for (pos = 0; pos < size ; pos++){
hfp_parse(hfp_connection, packet[pos], 1);

View File

@ -135,10 +135,10 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
static void handle_query_rfcomm_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size);
static void dummy_notify(uint8_t packet_type, uint16_t channel, uint8_t * event, uint16_t size){
UNUSED(packet_type);
UNUSED(channel);
UNUSED(event);
UNUSED(size);
UNUSED(packet_type); // ok: no code
UNUSED(channel); // ok: no code
UNUSED(event); // ok: no code
UNUSED(size); // ok: no code
}
void hsp_ag_register_packet_handler(btstack_packet_handler_t callback){
@ -352,11 +352,9 @@ void hsp_ag_set_speaker_gain(uint8_t gain){
}
static void hsp_ringing_timeout_handler(btstack_timer_source_t * timer){
UNUSED(timer);
ag_ring = 1;
btstack_run_loop_set_timer(&hs_timeout, 2000); // 2 seconds timeout
btstack_run_loop_add_timer(&hs_timeout);
btstack_run_loop_set_timer(timer, 2000); // 2 seconds timeout
btstack_run_loop_add_timer(timer);
hsp_run();
}
@ -541,7 +539,7 @@ static void hsp_run(void){
static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
UNUSED(channel);
UNUSED(channel); // ok: no channel for HCI_EVENT_PACKET and only single active RFCOMM channel
if (packet_type == RFCOMM_DATA_PACKET){
while (size > 0 && (packet[0] == '\n' || packet[0] == '\r')){
@ -708,9 +706,9 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
}
static void handle_query_rfcomm_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
UNUSED(packet_type);
UNUSED(channel);
UNUSED(size);
UNUSED(packet_type); // ok: handling own sdp events
UNUSED(channel); // ok: no channel
UNUSED(size); // ok: handling own sdp events
switch (packet[0]){
case SDP_EVENT_QUERY_RFCOMM_SERVICE: