FreeCalypso > hg > freecalypso-tools
changeset 901:2e6764022292
fc-shell tch record: add support for new TCH DL format
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 13 Dec 2022 03:24:36 +0000 |
parents | 8171c5c0d804 |
children | 8ddb16a37273 |
files | rvinterf/asyncshell/tchcmd.c rvinterf/asyncshell/tchrec.c |
diffstat | 2 files changed, 55 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/rvinterf/asyncshell/tchcmd.c Tue Dec 13 03:01:41 2022 +0000 +++ b/rvinterf/asyncshell/tchcmd.c Tue Dec 13 03:24:36 2022 +0000 @@ -89,7 +89,8 @@ void tch_packet_rx() { - char buf[128]; + char buf[128], *mode_kw; + int expect_pktlen, databytes; if (tch_rawdump_mode) { tch_rawdump(); @@ -119,6 +120,32 @@ goto inv; tch_dlbits_old_handler(); return; + case TCH_DLBITS_NEW_IND: + if (rvi_msg_len < 4) + goto inv; + switch (rvi_msg[3]) { + case TCH_FS_MODE: + mode_kw = "FR"; + expect_pktlen = 45; + databytes = 33; + break; + case TCH_HS_MODE: + mode_kw = "HR"; + expect_pktlen = 27; + databytes = 15; + break; + case TCH_EFR_MODE: + mode_kw = "EFR"; + expect_pktlen = 45; + databytes = 33; + break; + default: + goto inv; + } + if (rvi_msg_len != expect_pktlen) + goto inv; + tch_dlbits_new_handler(mode_kw, databytes); + return; default: goto inv; }
--- a/rvinterf/asyncshell/tchrec.c Tue Dec 13 03:01:41 2022 +0000 +++ b/rvinterf/asyncshell/tchrec.c Tue Dec 13 03:24:36 2022 +0000 @@ -39,6 +39,33 @@ frame_count++; } +void +tch_dlbits_new_handler(mode_kw, databytes) + char *mode_kw; +{ + u_char *ptr; + int i; + + if (!record_file) + return; + /* channel mode */ + fprintf(record_file, "%s ", mode_kw); + /* DSP status words */ + ptr = rvi_msg + 5; + for (i = 0; i < 3; i++) { + fprintf(record_file, "%02X%02X ", ptr[0], ptr[1]); + ptr += 2; + } + /* frame bits */ + for (i = 0; i < databytes; i++) { + fprintf(record_file, "%02X", *ptr); + ptr++; + } + /* frame number modulo 104 */ + fprintf(record_file, " %u\n", rvi_msg[4]); + frame_count++; +} + static void cmd_tch_record_start(filename) char *filename;