hfp: add ptst ag slc test sequences

This commit is contained in:
Milanka Ringwald 2015-12-02 16:12:23 +01:00
parent 0cacd247cd
commit 18602070d3
4 changed files with 248 additions and 23 deletions

View File

@ -130,7 +130,7 @@ const char * hfp_ag_feature(int index){
}
int send_str_over_rfcomm(uint16_t cid, char * command){
log_info("PTS_TEST_TX %s", command);
log_info("HFP_TX %s", command);
if (!rfcomm_can_send_packet_now(cid)) return 1;
int err = rfcomm_send_internal(cid, (uint8_t*) command, strlen(command));
if (err){

View File

@ -43,7 +43,8 @@ test_name = sys.argv[2]
separator = ""
spaces = " "
print "const char * "+test_name+"[] = {"
with open (infile, 'rb') as fin:
try:
while True:
@ -55,32 +56,24 @@ with open (infile, 'rb') as fin:
packet = fin.read(packet_len)
time = "[%s.%03u]" % (datetime.datetime.fromtimestamp(ts_sec).strftime("%Y-%m-%d %H:%M:%S"), ts_usec / 1000)
if type == 0xfc:
packet = packet.replace("\n","\\n");
packet = packet.replace("\r","\\r");
packet = packet.replace("\"","\\\"");
packet = packet.replace("\n","\\n")
packet = packet.replace("\r","\\r")
packet = packet.replace("\"","\\\"")
parts = re.match('HFP_RX(.*)',packet)
if not parts:
parts = re.match('PTS_TEST_TX(.*)',packet)
parts = re.match('HFP_TX(.*)',packet)
cmd = 0
if parts:
cmd = parts.groups()[0].strip()
cmd = cmd.replace("\\n","");
cmd = cmd.replace("\\r","");
if cmd:
#print "CMD ", packet
cmd_parts = re.match('(.*)OK', cmd)
if (cmd_parts):
if cmd_parts.groups()[0] <> "":
print separator+spaces+"\""+cmd_parts.groups()[0]+"\"",
print separator+spaces+"\"OK\"",
else:
print separator+spaces+"\""+cmd+"\"",
hfp_cmds = parts.groups()[0].split('\\r\\n')
for cmd in hfp_cmds:
cmd = cmd.strip()
if cmd <> "":
print separator+spaces+"\""+cmd+"\"",
separator = ",\n"
separator = ",\n"
except TypeError:
print "\n};\n"
exit(0)

View File

@ -220,8 +220,239 @@ const char * TC_AG_SLC_BV_01_C[] = {
"OK"
};
const char * TC_AG_SLC_BV_02_C[] = {
"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"
};
const char * TC_AG_SLC_BV_03_C[] = {
"AT+BRSF=125" ,
"+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+VGS=9" ,
"OK" ,
"AT+VGM=9" ,
"OK" ,
"AT+CLIP=1" ,
"OK" ,
"AT+CCWA=1" ,
"OK" ,
"AT+CMEE=1" ,
"OK"
};
const char * TC_AG_SLC_BV_04_C[] = {
"AT+BRSF=125" ,
"+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+VGS=9" ,
"OK" ,
"AT+VGM=9" ,
"OK" ,
"AT+CLIP=1" ,
"OK" ,
"AT+CCWA=1" ,
"OK" ,
"AT+CMEE=1" ,
"OK"
};
const char * TC_AG_SLC_BV_05_I[] = {
"AT+BRSF=255" ,
"+BRSF:4079" ,
"OK" ,
"AT+BAC=1" ,
"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"
};
const char * TC_AG_SLC_BV_06_I[] = {
"AT+BRSF=255" ,
"+BRSF:4079" ,
"OK" ,
"AT+BAC=1" ,
"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"
};
const char * TC_AG_SLC_BV_07_I[] = {
"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"
};
const char * TC_AG_SLC_BV_09_I[] = {
"AT+BRSF=895" ,
"+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+BIND=1,99" ,
"OK" ,
"AT+BIND=?" ,
"+BIND:(1,2,)" ,
"OK" ,
"AT+BIND?" ,
"+BIND:1,1" ,
"+BIND:2,1" ,
"OK" ,
"AT+VGS=9" ,
"OK" ,
"AT+VGM=9" ,
"OK" ,
"AT+CLIP=1" ,
"OK" ,
"AT+CCWA=1" ,
"OK" ,
"AT+CMEE=1" ,
"OK"
};
const char * TC_AG_SLC_BV_10_I[] = {
"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"
};
hfp_test_item_t pts_slc_tests[] = {
TEST_SEQUENCE(TC_AG_SLC_BV_01_C)
TEST_SEQUENCE(TC_AG_SLC_BV_01_C),
TEST_SEQUENCE(TC_AG_SLC_BV_02_C),
TEST_SEQUENCE(TC_AG_SLC_BV_03_C),
TEST_SEQUENCE(TC_AG_SLC_BV_04_C),
TEST_SEQUENCE(TC_AG_SLC_BV_05_I),
TEST_SEQUENCE(TC_AG_SLC_BV_06_I),
TEST_SEQUENCE(TC_AG_SLC_BV_07_I),
TEST_SEQUENCE(TC_AG_SLC_BV_09_I),
TEST_SEQUENCE(TC_AG_SLC_BV_10_I)
};
//////////////

View File

@ -72,7 +72,8 @@ const uint8_t rfcomm_channel_nr = 1;
const char hfp_ag_service_name[] = "BTstack HFP AG Test";
static bd_addr_t device_addr;
static bd_addr_t pts_addr = {0x00,0x1b,0xDC,0x07,0x32,0xEF};
static bd_addr_t pts_addr = {0x00,0x15,0x83,0x5F,0x9D,0x46};
//static bd_addr_t pts_addr = {0x00,0x1b,0xDC,0x07,0x32,0xEF};
static bd_addr_t speaker_addr = {0x00, 0x21, 0x3C, 0xAC, 0xF7, 0x38};
static uint8_t codecs[1] = {HFP_CODEC_CVSD};
static uint16_t handle = -1;