mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-03 23:47:08 +00:00
hfp ag tests: buffer rfcomm payload in mock, wait for succesive answers from AG, add ATA tests
This commit is contained in:
parent
99bed3a9e9
commit
d5deed0388
@ -104,36 +104,204 @@ static uint8_t start_ringing = 0;
|
||||
static uint8_t stop_ringing = 0;
|
||||
static uint8_t call_termiated = 0;
|
||||
|
||||
static uint16_t handle = -1;
|
||||
static int memory_1_enabled = 1;
|
||||
static int last_number_exists = 1;
|
||||
|
||||
static int hfp_command_start_index = 0;
|
||||
|
||||
int has_more_hfp_commands(){
|
||||
// \r\nOK\r\n is the smallest AG cmd
|
||||
int has_cmd = get_rfcomm_payload_len() - hfp_command_start_index >= 6;
|
||||
printf("has more: payload len %d, start %d, has more %d\n", get_rfcomm_payload_len(), hfp_command_start_index, has_cmd);
|
||||
return has_cmd;
|
||||
int has_more_hfp_ag_commands(){
|
||||
return has_more_hfp_commands(2,2);
|
||||
}
|
||||
|
||||
char * get_next_hfp_command(){
|
||||
printf("get next: payload len %d, start %d\n", get_rfcomm_payload_len(), hfp_command_start_index);
|
||||
char * data = (char *)(&get_rfcomm_payload()[hfp_command_start_index + 2]);
|
||||
int data_len = get_rfcomm_payload_len() - hfp_command_start_index - 2;
|
||||
char * get_next_hfp_ag_command(){
|
||||
return get_next_hfp_command(2,2);
|
||||
}
|
||||
|
||||
int i;
|
||||
|
||||
for (i = 0; i < data_len; i++){
|
||||
if ( *(data+i) == '\r' || *(data+i) == '\n' ) {
|
||||
data[i]=0;
|
||||
printf("!!! command: '%s'\n", data);
|
||||
// update state
|
||||
hfp_command_start_index = hfp_command_start_index + i + 4;
|
||||
return data;
|
||||
} else {
|
||||
// printf("check %i '%c'\n",i,*(data+i));
|
||||
}
|
||||
static void user_command(char cmd){
|
||||
switch (cmd){
|
||||
case 'a':
|
||||
printf("Establish HFP service level connection to PTS module %s...\n", bd_addr_to_str(device_addr));
|
||||
hfp_ag_establish_service_level_connection(device_addr);
|
||||
break;
|
||||
case 'A':
|
||||
printf("Release HFP service level connection.\n");
|
||||
hfp_ag_release_service_level_connection(device_addr);
|
||||
break;
|
||||
case 'b':
|
||||
printf("Establish Audio connection %s...\n", bd_addr_to_str(device_addr));
|
||||
hfp_ag_establish_audio_connection(device_addr);
|
||||
break;
|
||||
case 'B':
|
||||
printf("Release Audio connection.\n");
|
||||
hfp_ag_release_audio_connection(device_addr);
|
||||
break;
|
||||
case 'c':
|
||||
printf("Simulate incoming call from 1234567\n");
|
||||
// current_call_exists_a = 1;
|
||||
// current_call_status_a = HFP_ENHANCED_CALL_STATUS_INCOMING;
|
||||
// current_call_dir = HFP_ENHANCED_CALL_DIR_INCOMING;
|
||||
hfp_ag_set_clip(129, "1234567");
|
||||
hfp_ag_incoming_call();
|
||||
break;
|
||||
case 'm':
|
||||
printf("Simulate incoming call from 7654321\n");
|
||||
// current_call_exists_b = 1;
|
||||
// current_call_status_b = HFP_ENHANCED_CALL_STATUS_INCOMING;
|
||||
// current_call_dir = HFP_ENHANCED_CALL_DIR_INCOMING;
|
||||
hfp_ag_set_clip(129, "7654321");
|
||||
hfp_ag_incoming_call();
|
||||
break;
|
||||
case 'C':
|
||||
printf("Simulate terminate call\n");
|
||||
hfp_ag_call_dropped();
|
||||
break;
|
||||
case 'd':
|
||||
printf("Report AG failure\n");
|
||||
hfp_ag_report_extended_audio_gateway_error_result_code(device_addr, HFP_CME_ERROR_AG_FAILURE);
|
||||
break;
|
||||
case 'e':
|
||||
printf("Answer call on AG\n");
|
||||
// if (current_call_status_a == HFP_ENHANCED_CALL_STATUS_INCOMING){
|
||||
// current_call_status_a = HFP_ENHANCED_CALL_STATUS_ACTIVE;
|
||||
// }
|
||||
// if (current_call_status_b == HFP_ENHANCED_CALL_STATUS_INCOMING){
|
||||
// current_call_status_b = HFP_ENHANCED_CALL_STATUS_ACTIVE;
|
||||
// }
|
||||
hfp_ag_answer_incoming_call();
|
||||
break;
|
||||
case 'E':
|
||||
printf("Reject call on AG\n");
|
||||
hfp_ag_terminate_call();
|
||||
break;
|
||||
case 'f':
|
||||
printf("Disable cellular network\n");
|
||||
hfp_ag_set_registration_status(0);
|
||||
break;
|
||||
case 'F':
|
||||
printf("Enable cellular network\n");
|
||||
hfp_ag_set_registration_status(1);
|
||||
break;
|
||||
case 'g':
|
||||
printf("Set signal strength to 0\n");
|
||||
hfp_ag_set_signal_strength(0);
|
||||
break;
|
||||
case 'G':
|
||||
printf("Set signal strength to 5\n");
|
||||
hfp_ag_set_signal_strength(5);
|
||||
break;
|
||||
case 'h':
|
||||
printf("Disable roaming\n");
|
||||
hfp_ag_set_roaming_status(0);
|
||||
break;
|
||||
case 'H':
|
||||
printf("Enable roaming\n");
|
||||
hfp_ag_set_roaming_status(1);
|
||||
break;
|
||||
case 'i':
|
||||
printf("Set battery level to 3\n");
|
||||
hfp_ag_set_battery_level(3);
|
||||
break;
|
||||
case 'I':
|
||||
printf("Set battery level to 5\n");
|
||||
hfp_ag_set_battery_level(5);
|
||||
break;
|
||||
case 'j':
|
||||
printf("Answering call on remote side\n");
|
||||
hfp_ag_outgoing_call_established();
|
||||
break;
|
||||
case 'r':
|
||||
printf("Disable in-band ring tone\n");
|
||||
hfp_ag_set_use_in_band_ring_tone(0);
|
||||
break;
|
||||
case 'k':
|
||||
printf("Memory 1 cleared\n");
|
||||
memory_1_enabled = 0;
|
||||
break;
|
||||
case 'K':
|
||||
printf("Memory 1 set\n");
|
||||
memory_1_enabled = 1;
|
||||
break;
|
||||
case 'l':
|
||||
printf("Last dialed number cleared\n");
|
||||
last_number_exists = 0;
|
||||
break;
|
||||
case 'L':
|
||||
printf("Last dialed number set\n");
|
||||
last_number_exists = 1;
|
||||
break;
|
||||
case 'n':
|
||||
printf("Disable Voice Recognition\n");
|
||||
hfp_ag_activate_voice_recognition(device_addr, 0);
|
||||
break;
|
||||
case 'N':
|
||||
printf("Enable Voice Recognition\n");
|
||||
hfp_ag_activate_voice_recognition(device_addr, 1);
|
||||
break;
|
||||
case 'o':
|
||||
printf("Set speaker gain to 0 (minimum)\n");
|
||||
hfp_ag_set_speaker_gain(device_addr, 0);
|
||||
break;
|
||||
case 'O':
|
||||
printf("Set speaker gain to 9 (default)\n");
|
||||
hfp_ag_set_speaker_gain(device_addr, 9);
|
||||
break;
|
||||
case 'p':
|
||||
printf("Set speaker gain to 12 (higher)\n");
|
||||
hfp_ag_set_speaker_gain(device_addr, 12);
|
||||
break;
|
||||
case 'P':
|
||||
printf("Set speaker gain to 15 (maximum)\n");
|
||||
hfp_ag_set_speaker_gain(device_addr, 15);
|
||||
break;
|
||||
case 'q':
|
||||
printf("Set microphone gain to 0\n");
|
||||
hfp_ag_set_microphone_gain(device_addr, 0);
|
||||
break;
|
||||
case 'Q':
|
||||
printf("Set microphone gain to 9\n");
|
||||
hfp_ag_set_microphone_gain(device_addr, 9);
|
||||
break;
|
||||
case 's':
|
||||
printf("Set microphone gain to 12\n");
|
||||
hfp_ag_set_microphone_gain(device_addr, 12);
|
||||
break;
|
||||
case 'S':
|
||||
printf("Set microphone gain to 15\n");
|
||||
hfp_ag_set_microphone_gain(device_addr, 15);
|
||||
break;
|
||||
case 'R':
|
||||
printf("Enable in-band ring tone\n");
|
||||
hfp_ag_set_use_in_band_ring_tone(1);
|
||||
break;
|
||||
case 't':
|
||||
printf("Terminate HCI connection.\n");
|
||||
gap_disconnect(handle);
|
||||
break;
|
||||
case 'u':
|
||||
printf("Join held call\n");
|
||||
// current_call_mpty = HFP_ENHANCED_CALL_MPTY_CONFERENCE_CALL;
|
||||
hfp_ag_join_held_call();
|
||||
break;
|
||||
case 'v':
|
||||
// start_scan();
|
||||
break;
|
||||
case 'w':
|
||||
printf("AG: Put incoming call on hold (Response and Hold)\n");
|
||||
hfp_ag_hold_incoming_call();
|
||||
break;
|
||||
case 'x':
|
||||
printf("AG: Accept held incoming call (Response and Hold)\n");
|
||||
hfp_ag_accept_held_incoming_call();
|
||||
break;
|
||||
case 'X':
|
||||
printf("AG: Reject held incoming call (Response and Hold)\n");
|
||||
hfp_ag_reject_held_incoming_call();
|
||||
break;
|
||||
default:
|
||||
// show_usage();
|
||||
printf("AG: undefined user command\n");
|
||||
break;
|
||||
}
|
||||
printf("should not got here\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void simulate_test_sequence(hfp_test_item_t * test_item){
|
||||
@ -141,20 +309,22 @@ void simulate_test_sequence(hfp_test_item_t * test_item){
|
||||
printf("\nSimulate test sequence: \"%s\"\n", test_item->name);
|
||||
|
||||
int i = 0;
|
||||
for (i=0; i < test_item->len; i++){
|
||||
while (i < test_item->len){
|
||||
char * expected_cmd = test_steps[i];
|
||||
int expected_cmd_len = strlen(expected_cmd);
|
||||
|
||||
if (strncmp(expected_cmd, "AT", 2) == 0){
|
||||
if (strncmp(expected_cmd, "USER:", 5) == 0){
|
||||
user_command(expected_cmd[5]);
|
||||
i++;
|
||||
} else if (strncmp(expected_cmd, "AT", 2) == 0){
|
||||
printf("\n---> NEXT STEP receive from HF: '%s'\n", expected_cmd);
|
||||
hfp_command_start_index = 0;
|
||||
inject_hfp_command_to_ag((uint8_t*)expected_cmd, expected_cmd_len);
|
||||
i++;
|
||||
} else {
|
||||
printf("\n---> NEXT STEP expect from AG: %s\n", expected_cmd);
|
||||
|
||||
if (has_more_hfp_commands()){
|
||||
char * ag_cmd = get_next_hfp_command();
|
||||
printf("AG response verify %s == %s[%d]\n", expected_cmd, ag_cmd, expected_cmd_len);
|
||||
while (has_more_hfp_ag_commands()){
|
||||
char * ag_cmd = get_next_hfp_ag_command();
|
||||
//printf("AG response verify %s == %s[%d]\n", expected_cmd, ag_cmd, expected_cmd_len);
|
||||
|
||||
int equal_cmds = strncmp(ag_cmd, expected_cmd, expected_cmd_len) == 0;
|
||||
if (!equal_cmds){
|
||||
@ -162,12 +332,15 @@ void simulate_test_sequence(hfp_test_item_t * test_item){
|
||||
CHECK_EQUAL(equal_cmds,1);
|
||||
return;
|
||||
}
|
||||
printf("AG response verified '%s'\n", expected_cmd);
|
||||
} else {
|
||||
hfp_command_start_index = 0;
|
||||
printf("\n---> NEXT STEP trigger once more AG\n");
|
||||
inject_hfp_command_to_ag((uint8_t*)"NOP",3);
|
||||
}
|
||||
printf("Verified: '%s'\n", expected_cmd);
|
||||
i++;
|
||||
if (i < test_item->len){
|
||||
expected_cmd = test_steps[i];
|
||||
expected_cmd_len = strlen(expected_cmd);
|
||||
}
|
||||
}
|
||||
// printf("\n---> NEXT STEP trigger once more AG\n");
|
||||
inject_hfp_command_to_ag((uint8_t*)"NOP",3);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -214,8 +387,11 @@ void packet_handler(uint8_t * event, uint16_t event_size){
|
||||
case HFP_SUBEVENT_CALL_TERMINATED:
|
||||
call_termiated = 1;
|
||||
break;
|
||||
case HFP_CMD_CALL_ANSWERED:
|
||||
//printf("HF answers call, accept call by GSM\n");
|
||||
break;
|
||||
default:
|
||||
printf("event not handled %u\n", event[2]);
|
||||
printf("hfp_ag_client_test: event not handled %u\n", event[2]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -258,6 +434,13 @@ TEST_GROUP(HFPClient){
|
||||
}
|
||||
};
|
||||
|
||||
TEST(HFPClient, PTSATATests){
|
||||
for (int i = 0; i < hfp_pts_ag_ata_tests_size(); i++){
|
||||
simulate_test_sequence(&hfp_pts_ag_ata_tests()[i]);
|
||||
teardown();
|
||||
}
|
||||
}
|
||||
|
||||
TEST(HFPClient, PTSSLCTests){
|
||||
for (int i = 0; i < hfp_pts_ag_slc_tests_size(); i++){
|
||||
setup_hfp_service_level_connection(&hfp_pts_ag_slc_tests()[i]);
|
||||
|
@ -113,6 +113,14 @@ int expected_rfcomm_command(const char * cmd){
|
||||
return cmd_found && ok_found;
|
||||
}
|
||||
|
||||
char * get_next_hfp_hf_command(){
|
||||
return get_next_hfp_command(0,2);
|
||||
}
|
||||
|
||||
int has_more_hfp_hf_commands(){
|
||||
return has_more_hfp_commands(0,2);
|
||||
}
|
||||
|
||||
void simulate_test_sequence(hfp_test_item_t * test_item){
|
||||
char ** test_steps = test_item->test;
|
||||
printf("\nSimulate test sequence: \"%s\"\n", test_item->name);
|
||||
@ -231,6 +239,13 @@ TEST_GROUP(HFPClient){
|
||||
|
||||
};
|
||||
|
||||
TEST(HFPClient, PTSATATests){
|
||||
for (int i = 0; i < hfp_pts_hf_ata_tests_size(); i++){
|
||||
simulate_test_sequence(&hfp_pts_hf_ata_tests()[i]);
|
||||
teardown();
|
||||
}
|
||||
}
|
||||
|
||||
TEST(HFPClient, PTSSLCTests){
|
||||
for (int i = 0; i < hfp_pts_hf_slc_tests_size(); i++){
|
||||
setup_hfp_service_level_connection(&hfp_pts_hf_slc_tests()[i]);
|
||||
|
137
test/hfp/mock.c
137
test/hfp/mock.c
@ -62,7 +62,11 @@ static uint16_t rfcomm_cid = 1;
|
||||
static bd_addr_t dev_addr;
|
||||
static uint16_t sco_handle = 10;
|
||||
static uint8_t rfcomm_payload[200];
|
||||
static uint16_t rfcomm_payload_len;
|
||||
static uint16_t rfcomm_payload_len = 0;
|
||||
|
||||
static uint8_t outgoing_rfcomm_payload[200];
|
||||
static uint16_t outgoing_rfcomm_payload_len = 0;
|
||||
|
||||
void * active_connection;
|
||||
hfp_connection_t * hfp_context;
|
||||
|
||||
@ -77,24 +81,52 @@ uint16_t get_rfcomm_payload_len(){
|
||||
return rfcomm_payload_len;
|
||||
}
|
||||
|
||||
static int hfp_command_start_index = 0;
|
||||
|
||||
static void print_without_newlines(uint8_t *data, uint16_t len){
|
||||
int found_newline = 0;
|
||||
int found_item = 0;
|
||||
|
||||
for (int i=0; i<len; i++){
|
||||
if (data[i] == '\r' || data[i] == '\n'){
|
||||
if (!found_newline && found_item) printf("\n");
|
||||
found_newline = 1;
|
||||
} else {
|
||||
printf("%c", data[i]);
|
||||
found_newline = 0;
|
||||
found_item = 1;
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
int has_more_hfp_commands(int start_command_offset, int end_command_offset){
|
||||
int has_cmd = get_rfcomm_payload_len() - hfp_command_start_index >= 2 + start_command_offset + end_command_offset;
|
||||
//printf("has more: payload len %d, start %d, has more %d\n", get_rfcomm_payload_len(), hfp_command_start_index, has_cmd);
|
||||
return has_cmd;
|
||||
}
|
||||
|
||||
char * get_next_hfp_command(int start_command_offset, int end_command_offset){
|
||||
//printf("get next: payload len %d, start %d\n", get_rfcomm_payload_len(), hfp_command_start_index);
|
||||
char * data = (char *)(&get_rfcomm_payload()[hfp_command_start_index + start_command_offset]);
|
||||
int data_len = get_rfcomm_payload_len() - hfp_command_start_index - start_command_offset;
|
||||
|
||||
int i;
|
||||
|
||||
for (i = 0; i < data_len; i++){
|
||||
if ( *(data+i) == '\r' || *(data+i) == '\n' ) {
|
||||
data[i]=0;
|
||||
// update state
|
||||
// printf("!!! command %s\n", data);
|
||||
hfp_command_start_index = hfp_command_start_index + i + start_command_offset + end_command_offset;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
printf("should not got here\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// static void print_without_newlines(uint8_t *data, uint16_t len){
|
||||
// int found_newline = 0;
|
||||
// int found_item = 0;
|
||||
|
||||
// for (int i=0; i<len; i++){
|
||||
// if (data[i] == '\r' || data[i] == '\n'){
|
||||
// if (!found_newline && found_item) printf("\n");
|
||||
// found_newline = 1;
|
||||
// } else {
|
||||
// printf("%c", data[i]);
|
||||
// found_newline = 0;
|
||||
// found_item = 1;
|
||||
// }
|
||||
// }
|
||||
// printf("\n");
|
||||
// }
|
||||
|
||||
extern "C" void l2cap_init(void){}
|
||||
|
||||
extern "C" void l2cap_register_packet_handler(void (*handler)(void * connection, uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size)){
|
||||
@ -102,16 +134,26 @@ extern "C" void l2cap_register_packet_handler(void (*handler)(void * connection,
|
||||
|
||||
|
||||
int rfcomm_send_internal(uint16_t rfcomm_cid, uint8_t *data, uint16_t len){
|
||||
// if (strncmp((char*)data, "AT", 2) == 0){
|
||||
// printf("Verify HF state machine response: ");
|
||||
// print_without_newlines(data,len);
|
||||
// } else {
|
||||
// printf("Verify AG state machine response: ");
|
||||
// print_without_newlines(data,len);
|
||||
// }
|
||||
strncpy((char*)&rfcomm_payload[0], (char*)data, len);
|
||||
rfcomm_payload_len = len;
|
||||
return 0;
|
||||
int start_command_offset = 2;
|
||||
int end_command_offset = 2;
|
||||
|
||||
if (strncmp((char*)data, "AT", 2) == 0){
|
||||
start_command_offset = 0;
|
||||
}
|
||||
|
||||
if (has_more_hfp_commands(start_command_offset, end_command_offset)){
|
||||
// printf("Buffer response: ");
|
||||
strncpy((char*)&rfcomm_payload[rfcomm_payload_len], (char*)data, len);
|
||||
rfcomm_payload_len += len;
|
||||
} else {
|
||||
hfp_command_start_index = 0;
|
||||
// printf("Copy response: ");
|
||||
strncpy((char*)&rfcomm_payload[0], (char*)data, len);
|
||||
rfcomm_payload_len = len;
|
||||
}
|
||||
|
||||
// print_without_newlines(rfcomm_payload,rfcomm_payload_len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void hci_event_sco_complete(){
|
||||
@ -262,57 +304,46 @@ int hci_remote_eSCO_supported(hci_con_handle_t handle){
|
||||
|
||||
static void add_new_lines_to_hfp_command(uint8_t * data, int len){
|
||||
if (len <= 0) return;
|
||||
memset(&rfcomm_payload, 0, 200);
|
||||
memset(&outgoing_rfcomm_payload, 0, 200);
|
||||
int pos = 0;
|
||||
|
||||
if (strncmp((char*)data, "AT", 2) == 0){
|
||||
strncpy((char*)&rfcomm_payload[pos], (char*)data, len);
|
||||
strncpy((char*)&outgoing_rfcomm_payload[pos], (char*)data, len);
|
||||
pos += len;
|
||||
} else {
|
||||
rfcomm_payload[pos++] = '\r';
|
||||
rfcomm_payload[pos++] = '\n';
|
||||
strncpy((char*)&rfcomm_payload[pos], (char*)data, len);
|
||||
outgoing_rfcomm_payload[pos++] = '\r';
|
||||
outgoing_rfcomm_payload[pos++] = '\n';
|
||||
strncpy((char*)&outgoing_rfcomm_payload[pos], (char*)data, len);
|
||||
pos += len;
|
||||
|
||||
if (memcmp((char*)data, "+BAC", 4) != 0 &&
|
||||
memcmp((char*)data, "+BCS", 4) != 0){
|
||||
rfcomm_payload[pos++] = '\r';
|
||||
rfcomm_payload[pos++] = '\n';
|
||||
rfcomm_payload[pos++] = 'O';
|
||||
rfcomm_payload[pos++] = 'K';
|
||||
outgoing_rfcomm_payload[pos++] = '\r';
|
||||
outgoing_rfcomm_payload[pos++] = '\n';
|
||||
outgoing_rfcomm_payload[pos++] = 'O';
|
||||
outgoing_rfcomm_payload[pos++] = 'K';
|
||||
}
|
||||
|
||||
}
|
||||
rfcomm_payload[pos++] = '\r';
|
||||
rfcomm_payload[pos++] = '\n';
|
||||
rfcomm_payload[pos] = 0;
|
||||
rfcomm_payload_len = pos;
|
||||
outgoing_rfcomm_payload[pos++] = '\r';
|
||||
outgoing_rfcomm_payload[pos++] = '\n';
|
||||
outgoing_rfcomm_payload[pos] = 0;
|
||||
outgoing_rfcomm_payload_len = pos;
|
||||
}
|
||||
|
||||
void inject_hfp_command_to_hf(uint8_t * data, int len){
|
||||
if (memcmp((char*)data, "AT", 2) == 0) return;
|
||||
|
||||
add_new_lines_to_hfp_command(data, len);
|
||||
// if (data[0] == '+' || (data[0] == 'O' && data[1] == 'K')){
|
||||
// printf("Send cmd to HF state machine: %s\n", data);
|
||||
// }
|
||||
//} else {
|
||||
// printf("Trigger HF state machine - %s", data);
|
||||
// }
|
||||
(*registered_rfcomm_packet_handler)(active_connection, RFCOMM_DATA_PACKET, rfcomm_cid, (uint8_t *) &rfcomm_payload[0], rfcomm_payload_len);
|
||||
(*registered_rfcomm_packet_handler)(active_connection, RFCOMM_DATA_PACKET, rfcomm_cid, (uint8_t *) &outgoing_rfcomm_payload[0], outgoing_rfcomm_payload_len);
|
||||
|
||||
}
|
||||
|
||||
void inject_hfp_command_to_ag(uint8_t * data, int len){
|
||||
if (data[0] == '+') return;
|
||||
|
||||
add_new_lines_to_hfp_command(data, len);
|
||||
// if (memcmp((char*)data, "AT", 2) == 0){
|
||||
// printf("Send cmd to AG state machine: %s\n", data);
|
||||
// }
|
||||
// } else {
|
||||
// printf("Trigger AG state machine - %s", data);
|
||||
// }
|
||||
(*registered_rfcomm_packet_handler)(active_connection, RFCOMM_DATA_PACKET, rfcomm_cid, (uint8_t *) &rfcomm_payload[0], rfcomm_payload_len);
|
||||
(*registered_rfcomm_packet_handler)(active_connection, RFCOMM_DATA_PACKET, rfcomm_cid, (uint8_t *) &outgoing_rfcomm_payload[0], outgoing_rfcomm_payload_len);
|
||||
}
|
||||
|
||||
|
||||
|
@ -52,3 +52,6 @@ uint16_t get_rfcomm_payload_len();
|
||||
|
||||
void inject_hfp_command_to_ag(uint8_t * data, int len);
|
||||
void inject_hfp_command_to_hf(uint8_t * data, int len);
|
||||
|
||||
int has_more_hfp_commands(int start_command_offset, int end_command_offset);
|
||||
char * get_next_hfp_command(int start_command_offset, int end_command_offset);
|
||||
|
@ -121,7 +121,7 @@ const char * cc_test2[] = {
|
||||
"OK",
|
||||
"AT+BCC",
|
||||
"OK",
|
||||
"BCS:1",
|
||||
"+BCS:1",
|
||||
"AT+BCS=1",
|
||||
"OK"
|
||||
};
|
||||
@ -671,6 +671,57 @@ hfp_test_item_t pts_hf_slc_tests[] = {
|
||||
TEST_SEQUENCE(TC_HF_SLC_BV_10_I),
|
||||
};
|
||||
|
||||
//// PTS ATA Group
|
||||
const char * TC_AG_ATA_BV_01_I[] = {
|
||||
"USER:a",
|
||||
"AT+BRSF=127" ,
|
||||
"+BRSF:4079" ,
|
||||
"OK" ,
|
||||
"AT+CIND=?" ,
|
||||
"+CIND:(\"service\",(0,1)),(\"call\",(0,1)),(\"callsetup\",(0,3)),(\"battchg\",(0,5)),(\"signal\",(0,5)),(\"roam\",(0,1)),(\"callheld\",(0,2))" ,
|
||||
"OK" ,
|
||||
"AT+CIND?" ,
|
||||
"+CIND:1,0,0,3,5,0,0" ,
|
||||
"OK" ,
|
||||
"AT+CMER=3,0,0,1" ,
|
||||
"OK" ,
|
||||
"AT+CHLD=?" ,
|
||||
"+CHLD:(1,1x,2,2x,3)" ,
|
||||
"OK" ,
|
||||
"AT+VGS=9" ,
|
||||
"OK" ,
|
||||
"AT+VGM=9" ,
|
||||
"OK" ,
|
||||
"AT+CLIP=1" ,
|
||||
"OK" ,
|
||||
"AT+CCWA=1" ,
|
||||
"OK" ,
|
||||
"AT+CMEE=1" ,
|
||||
"OK" ,
|
||||
"USER:c",
|
||||
"+CIEV:3,1" ,
|
||||
"RING" ,
|
||||
"+CLIP: \"1234567\",129" ,
|
||||
"ATA" ,
|
||||
"OK" ,
|
||||
"+CIEV:2,1" ,
|
||||
"+CIEV:3,0" ,
|
||||
"USER:C",
|
||||
"USER:B",
|
||||
"USER:t",
|
||||
"+CIEV:2,0"
|
||||
};
|
||||
|
||||
|
||||
hfp_test_item_t pts_ag_ata_tests[] = {
|
||||
TEST_SEQUENCE(TC_AG_ATA_BV_01_I),
|
||||
// TEST_SEQUENCE(TC_AG_ATA_BV_02_I)
|
||||
};
|
||||
|
||||
hfp_test_item_t pts_hf_ata_tests[] = {
|
||||
// TEST_SEQUENCE(TC_HF_ATA_BV_01_I),
|
||||
// TEST_SEQUENCE(TC_HF_ATA_BV_02_I)
|
||||
};
|
||||
//////////////
|
||||
|
||||
static int test_item_size = sizeof(hfp_test_item_t);
|
||||
@ -690,11 +741,18 @@ int hfp_cc_tests_size(){ return sizeof(cc_tests) /test_item_size;}
|
||||
hfp_test_item_t * hfp_cc_tests(){ return cc_tests;}
|
||||
hfp_test_item_t * default_hfp_cc_test(){ return &cc_tests[0];}
|
||||
|
||||
// PTS
|
||||
// PTS - SLC Group
|
||||
int hfp_pts_ag_slc_tests_size(){ return sizeof(pts_ag_slc_tests)/test_item_size;}
|
||||
hfp_test_item_t * hfp_pts_ag_slc_tests(){ return pts_ag_slc_tests;}
|
||||
|
||||
int hfp_pts_hf_slc_tests_size(){ return sizeof(pts_hf_slc_tests)/test_item_size;}
|
||||
hfp_test_item_t * hfp_pts_hf_slc_tests(){ return pts_hf_slc_tests;}
|
||||
|
||||
// PTS - ATA Group
|
||||
int hfp_pts_ag_ata_tests_size(){ return sizeof(pts_ag_ata_tests)/test_item_size;}
|
||||
hfp_test_item_t * hfp_pts_ag_ata_tests(){ return pts_ag_ata_tests;}
|
||||
|
||||
int hfp_pts_hf_ata_tests_size(){ return sizeof(pts_hf_ata_tests)/test_item_size;}
|
||||
hfp_test_item_t * hfp_pts_hf_ata_tests(){ return pts_hf_ata_tests;}
|
||||
|
||||
|
@ -68,10 +68,15 @@ int hfp_cc_tests_size();
|
||||
hfp_test_item_t * hfp_cc_tests();
|
||||
hfp_test_item_t * default_hfp_cc_test();
|
||||
|
||||
/* PTS test sequences */
|
||||
/* PTS test sequences - SLC Group */
|
||||
int hfp_pts_ag_slc_tests_size();
|
||||
hfp_test_item_t * hfp_pts_ag_slc_tests();
|
||||
|
||||
int hfp_pts_hf_slc_tests_size();
|
||||
hfp_test_item_t * hfp_pts_hf_slc_tests();
|
||||
|
||||
/* PTS test sequences - ATA Group */
|
||||
int hfp_pts_ag_ata_tests_size();
|
||||
hfp_test_item_t * hfp_pts_ag_ata_tests();
|
||||
int hfp_pts_hf_ata_tests_size();
|
||||
hfp_test_item_t * hfp_pts_hf_ata_tests();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user