mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-25 09:02:30 +00:00
hfp: add mandatory field to ag indicators
This commit is contained in:
parent
abe6e271cb
commit
ae355bd946
@ -315,7 +315,7 @@ void update_command(hfp_connection_t * context){
|
|||||||
|
|
||||||
if (strncmp((char *)context->line_buffer, HFP_UPDATE_ENABLE_STATUS_FOR_INDIVIDUAL_AG_INDICATORS, strlen(HFP_UPDATE_ENABLE_STATUS_FOR_INDIVIDUAL_AG_INDICATORS)) == 0){
|
if (strncmp((char *)context->line_buffer, HFP_UPDATE_ENABLE_STATUS_FOR_INDIVIDUAL_AG_INDICATORS, strlen(HFP_UPDATE_ENABLE_STATUS_FOR_INDIVIDUAL_AG_INDICATORS)) == 0){
|
||||||
printf("Received +BIA\n");
|
printf("Received +BIA\n");
|
||||||
context->command = HFP_CMD_ENABLE_INDIVIDUAL_INDICATOR_STATUS_UPDATE;
|
context->command = HFP_CMD_ENABLE_INDIVIDUAL_AG_INDICATOR_STATUS_UPDATE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -485,6 +485,7 @@ void hfp_hf_enable_status_update_for_all_ag_indicators(bd_addr_t bd_addr, uint8_
|
|||||||
hfp_run_for_context(connection);
|
hfp_run_for_context(connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: returned ERROR - wrong format
|
||||||
void hfp_hf_enable_status_update_for_individual_ag_indicators(bd_addr_t bd_addr, uint32_t indicators_status_bitmap){
|
void hfp_hf_enable_status_update_for_individual_ag_indicators(bd_addr_t bd_addr, uint32_t indicators_status_bitmap){
|
||||||
hfp_hf_establish_service_level_connection(bd_addr);
|
hfp_hf_establish_service_level_connection(bd_addr);
|
||||||
hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(bd_addr);
|
hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(bd_addr);
|
||||||
|
@ -47,17 +47,32 @@
|
|||||||
#include "hfp.h"
|
#include "hfp.h"
|
||||||
|
|
||||||
void hfp_parse(hfp_connection_t * context, uint8_t byte);
|
void hfp_parse(hfp_connection_t * context, uint8_t byte);
|
||||||
hfp_generic_status_indicators_t * get_hfp_generic_status_indicators();
|
hfp_generic_status_indicator_t * get_hfp_generic_status_indicators();
|
||||||
void set_hfp_generic_status_indicators(hfp_generic_status_indicators_t * indicators, int indicator_nr);
|
void set_hfp_generic_status_indicators(hfp_generic_status_indicator_t * indicators, int indicator_nr);
|
||||||
|
|
||||||
|
hfp_ag_indicator_t * get_hfp_ag_indicators();
|
||||||
|
int get_hfp_ag_indicators_nr();
|
||||||
|
void set_hfp_ag_indicators(hfp_ag_indicator_t * indicators, int indicator_nr);
|
||||||
|
|
||||||
static int hf_indicators_nr = 3;
|
static int hf_indicators_nr = 3;
|
||||||
static hfp_generic_status_indicators_t hf_indicators[] = {
|
static hfp_generic_status_indicator_t hf_indicators[] = {
|
||||||
{1, 1},
|
{1, 1},
|
||||||
{2, 1},
|
{2, 1},
|
||||||
{3, 1}
|
{3, 1}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int hfp_ag_indicators_nr = 7;
|
||||||
|
static hfp_ag_indicator_t hfp_ag_indicators[] = {
|
||||||
|
{1, "service", 0, 1, 1, 0, 0},
|
||||||
|
{2, "call", 0, 1, 0, 1, 1},
|
||||||
|
{3, "callsetup", 0, 3, 0, 1, 1},
|
||||||
|
{4, "battchg", 0, 5, 3, 0, 0},
|
||||||
|
{5, "signal", 0, 5, 5, 0, 0},
|
||||||
|
{6, "roam", 0, 1, 0, 0, 0},
|
||||||
|
{7, "callheld", 0, 2, 0, 1, 1}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static hfp_connection_t context;
|
static hfp_connection_t context;
|
||||||
|
|
||||||
TEST_GROUP(HFPParser){
|
TEST_GROUP(HFPParser){
|
||||||
@ -123,27 +138,32 @@ TEST(HFPParser, HFP_AG_ENABLE_INDICATOR_STATUS_UPDATE){
|
|||||||
|
|
||||||
|
|
||||||
TEST(HFPParser, HFP_AG_ENABLE_INDIVIDUAL_INDICATOR_STATUS_UPDATE){
|
TEST(HFPParser, HFP_AG_ENABLE_INDIVIDUAL_INDICATOR_STATUS_UPDATE){
|
||||||
set_hfp_generic_status_indicators((hfp_generic_status_indicators_t *)&hf_indicators, hf_indicators_nr);
|
set_hfp_ag_indicators((hfp_ag_indicator_t *)&hfp_ag_indicators, hfp_ag_indicators_nr);
|
||||||
context.generic_status_indicators_nr = hf_indicators_nr;
|
context.ag_indicators_nr = hfp_ag_indicators_nr;
|
||||||
memcpy(context.generic_status_indicators, hf_indicators, hf_indicators_nr * sizeof(hfp_generic_status_indicators_t));
|
memcpy(context.ag_indicators, hfp_ag_indicators, hfp_ag_indicators_nr * sizeof(hfp_ag_indicator_t));
|
||||||
|
|
||||||
for (pos = 0; pos < hf_indicators_nr; pos++){
|
for (pos = 0; pos < hfp_ag_indicators_nr; pos++){
|
||||||
CHECK_EQUAL(get_hfp_generic_status_indicators()[pos].uuid, hf_indicators[pos].uuid);
|
CHECK_EQUAL(get_hfp_ag_indicators()[pos].index, hfp_ag_indicators[pos].index);
|
||||||
CHECK_EQUAL(get_hfp_generic_status_indicators()[pos].state, hf_indicators[pos].state);
|
CHECK_EQUAL(get_hfp_ag_indicators()[pos].enabled, hfp_ag_indicators[pos].enabled);
|
||||||
CHECK_EQUAL(context.generic_status_indicators[pos].uuid, hf_indicators[pos].uuid);
|
CHECK_EQUAL(context.ag_indicators[pos].index, hfp_ag_indicators[pos].index);
|
||||||
CHECK_EQUAL(context.generic_status_indicators[pos].state, hf_indicators[pos].state);
|
CHECK_EQUAL(context.ag_indicators[pos].enabled, hfp_ag_indicators[pos].enabled);
|
||||||
}
|
}
|
||||||
sprintf(packet, "\r\nAT%s=0,0,0\r\n",
|
sprintf(packet, "\r\nAT%s=0,0,0,0,0,0,0\r\n",
|
||||||
HFP_UPDATE_ENABLE_STATUS_FOR_INDIVIDUAL_AG_INDICATORS);
|
HFP_UPDATE_ENABLE_STATUS_FOR_INDIVIDUAL_AG_INDICATORS);
|
||||||
for (pos = 0; pos < strlen(packet); pos++){
|
for (pos = 0; pos < strlen(packet); pos++){
|
||||||
hfp_parse(&context, packet[pos]);
|
hfp_parse(&context, packet[pos]);
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK_EQUAL(HFP_CMD_ENABLE_INDIVIDUAL_INDICATOR_STATUS_UPDATE, context.command);
|
CHECK_EQUAL(HFP_CMD_ENABLE_INDIVIDUAL_AG_INDICATOR_STATUS_UPDATE, context.command);
|
||||||
|
|
||||||
for (pos = 0; pos < hf_indicators_nr; pos++){
|
for (pos = 0; pos < hfp_ag_indicators_nr; pos++){
|
||||||
CHECK_EQUAL(get_hfp_generic_status_indicators()[pos].state, 1);
|
if (get_hfp_ag_indicators()[pos].mandatory){
|
||||||
CHECK_EQUAL(context.generic_status_indicators[pos].state, 0);
|
CHECK_EQUAL(get_hfp_ag_indicators()[pos].enabled, 1);
|
||||||
|
CHECK_EQUAL(context.ag_indicators[pos].enabled, 1);
|
||||||
|
} else {
|
||||||
|
CHECK_EQUAL(get_hfp_ag_indicators()[pos].enabled, 0);
|
||||||
|
CHECK_EQUAL(context.ag_indicators[pos].enabled, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -51,13 +51,13 @@ void hfp_parse(hfp_connection_t * context, uint8_t byte);
|
|||||||
static hfp_connection_t context;
|
static hfp_connection_t context;
|
||||||
static int ag_indicators_nr = 7;
|
static int ag_indicators_nr = 7;
|
||||||
static hfp_ag_indicator_t ag_indicators[] = {
|
static hfp_ag_indicator_t ag_indicators[] = {
|
||||||
{1, "service", 0, 1, 1},
|
{1, "service", 0, 1, 1, 0, 0},
|
||||||
{2, "call", 0, 1, 0},
|
{2, "call", 0, 1, 0, 1, 1},
|
||||||
{3, "callsetup", 0, 3, 0},
|
{3, "callsetup", 0, 3, 0, 1, 1},
|
||||||
{4, "battchg", 0, 5, 3},
|
{4, "battchg", 0, 5, 3, 0, 0},
|
||||||
{5, "signal", 0, 5, 5},
|
{5, "signal", 0, 5, 5, 0, 0},
|
||||||
{6, "roam", 0, 1, 0},
|
{6, "roam", 0, 1, 0, 0, 0},
|
||||||
{7, "callheld", 0, 2, 0},
|
{7, "callheld", 0, 2, 0, 1, 1}
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_GROUP(HFPParser){
|
TEST_GROUP(HFPParser){
|
||||||
|
@ -78,13 +78,13 @@ static uint8_t codecs[1] = {HFP_CODEC_CVSD};
|
|||||||
|
|
||||||
static int ag_indicators_nr = 7;
|
static int ag_indicators_nr = 7;
|
||||||
static hfp_ag_indicator_t ag_indicators[] = {
|
static hfp_ag_indicator_t ag_indicators[] = {
|
||||||
{1, "service", 0, 1, 1},
|
{1, "service", 0, 1, 1, 0, 0},
|
||||||
{2, "call", 0, 1, 0},
|
{2, "call", 0, 1, 0, 1, 1},
|
||||||
{3, "callsetup", 0, 3, 0},
|
{3, "callsetup", 0, 3, 0, 1, 1},
|
||||||
{4, "battchg", 0, 5, 3},
|
{4, "battchg", 0, 5, 3, 0, 0},
|
||||||
{5, "signal", 0, 5, 5},
|
{5, "signal", 0, 5, 5, 0, 0},
|
||||||
{6, "roam", 0, 1, 0},
|
{6, "roam", 0, 1, 0, 0, 0},
|
||||||
{7, "callheld", 0, 2, 0},
|
{7, "callheld", 0, 2, 0, 1, 1}
|
||||||
};
|
};
|
||||||
|
|
||||||
static int call_hold_services_nr = 5;
|
static int call_hold_services_nr = 5;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user