FreeCalypso > hg > freecalypso-tools
diff rvinterf/asyncshell/tchrec.c @ 4:971906d7763d
fc-shell tch commands: changed to raw hex file format
This "backward" change is needed for two reasons:
1) to support EFR in addition to 06.10
2) to preserve the DSP status words for the downlink
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 14 Jun 2016 01:02:48 +0000 |
parents | e7502631a0f9 |
children | 8171c5c0d804 |
line wrap: on
line diff
--- a/rvinterf/asyncshell/tchrec.c Sat Jun 11 01:52:51 2016 +0000 +++ b/rvinterf/asyncshell/tchrec.c Tue Jun 14 01:02:48 2016 +0000 @@ -13,18 +13,29 @@ extern u_char rvi_msg[]; extern int rvi_msg_len; -static FILE *gsm_data_file; +static FILE *record_file; static u_long frame_count; void tch_dlbits_handler() { - u_char writebytes[33]; + u_char *ptr; + int i; - if (!gsm_data_file) + if (!record_file) return; - gsm0610_tidsp_to_libgsm(rvi_msg + 9, writebytes); - fwrite(writebytes, 1, 33, gsm_data_file); + /* DSP status words */ + ptr = rvi_msg + 3; + for (i = 0; i < 3; i++) { + fprintf(record_file, "%02X%02X ", ptr[0], ptr[1]); + ptr += 2; + } + /* frame bits */ + for (i = 0; i < 33; i++) { + fprintf(record_file, "%02X", *ptr); + ptr++; + } + putc('\n', record_file); frame_count++; } @@ -32,12 +43,12 @@ cmd_tch_record_start(filename) char *filename; { - if (gsm_data_file) { + if (record_file) { printf("error: tch record session already in progress\n"); return; } - gsm_data_file = fopen(filename, "w"); - if (!gsm_data_file) { + record_file = fopen(filename, "w"); + if (!record_file) { perror(filename); return; } @@ -50,12 +61,12 @@ static void cmd_tch_record_stop() { - if (!gsm_data_file) { + if (!record_file) { printf("error: no tch record session in progress\n"); return; } - fclose(gsm_data_file); - gsm_data_file = 0; + fclose(record_file); + record_file = 0; printf("TCH DL recording stopped, captured %lu speech frames\n", frame_count); send_tch_config_req(0); @@ -79,5 +90,5 @@ show_tch_record_status() { printf("TCH DL recording: %s\n", - gsm_data_file ? "RUNNING" : "not running"); + record_file ? "RUNNING" : "not running"); }