FreeCalypso > hg > freecalypso-tools
comparison 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 |
comparison
equal
deleted
inserted
replaced
3:6a029ad28212 | 4:971906d7763d |
---|---|
11 #include "tch_feature.h" | 11 #include "tch_feature.h" |
12 | 12 |
13 extern u_char rvi_msg[]; | 13 extern u_char rvi_msg[]; |
14 extern int rvi_msg_len; | 14 extern int rvi_msg_len; |
15 | 15 |
16 static FILE *gsm_data_file; | 16 static FILE *record_file; |
17 static u_long frame_count; | 17 static u_long frame_count; |
18 | 18 |
19 void | 19 void |
20 tch_dlbits_handler() | 20 tch_dlbits_handler() |
21 { | 21 { |
22 u_char writebytes[33]; | 22 u_char *ptr; |
23 int i; | |
23 | 24 |
24 if (!gsm_data_file) | 25 if (!record_file) |
25 return; | 26 return; |
26 gsm0610_tidsp_to_libgsm(rvi_msg + 9, writebytes); | 27 /* DSP status words */ |
27 fwrite(writebytes, 1, 33, gsm_data_file); | 28 ptr = rvi_msg + 3; |
29 for (i = 0; i < 3; i++) { | |
30 fprintf(record_file, "%02X%02X ", ptr[0], ptr[1]); | |
31 ptr += 2; | |
32 } | |
33 /* frame bits */ | |
34 for (i = 0; i < 33; i++) { | |
35 fprintf(record_file, "%02X", *ptr); | |
36 ptr++; | |
37 } | |
38 putc('\n', record_file); | |
28 frame_count++; | 39 frame_count++; |
29 } | 40 } |
30 | 41 |
31 static void | 42 static void |
32 cmd_tch_record_start(filename) | 43 cmd_tch_record_start(filename) |
33 char *filename; | 44 char *filename; |
34 { | 45 { |
35 if (gsm_data_file) { | 46 if (record_file) { |
36 printf("error: tch record session already in progress\n"); | 47 printf("error: tch record session already in progress\n"); |
37 return; | 48 return; |
38 } | 49 } |
39 gsm_data_file = fopen(filename, "w"); | 50 record_file = fopen(filename, "w"); |
40 if (!gsm_data_file) { | 51 if (!record_file) { |
41 perror(filename); | 52 perror(filename); |
42 return; | 53 return; |
43 } | 54 } |
44 printf("Starting TCH DL recording\n"); | 55 printf("Starting TCH DL recording\n"); |
45 tch_rx_control(1); | 56 tch_rx_control(1); |
48 } | 59 } |
49 | 60 |
50 static void | 61 static void |
51 cmd_tch_record_stop() | 62 cmd_tch_record_stop() |
52 { | 63 { |
53 if (!gsm_data_file) { | 64 if (!record_file) { |
54 printf("error: no tch record session in progress\n"); | 65 printf("error: no tch record session in progress\n"); |
55 return; | 66 return; |
56 } | 67 } |
57 fclose(gsm_data_file); | 68 fclose(record_file); |
58 gsm_data_file = 0; | 69 record_file = 0; |
59 printf("TCH DL recording stopped, captured %lu speech frames\n", | 70 printf("TCH DL recording stopped, captured %lu speech frames\n", |
60 frame_count); | 71 frame_count); |
61 send_tch_config_req(0); | 72 send_tch_config_req(0); |
62 } | 73 } |
63 | 74 |
77 | 88 |
78 void | 89 void |
79 show_tch_record_status() | 90 show_tch_record_status() |
80 { | 91 { |
81 printf("TCH DL recording: %s\n", | 92 printf("TCH DL recording: %s\n", |
82 gsm_data_file ? "RUNNING" : "not running"); | 93 record_file ? "RUNNING" : "not running"); |
83 } | 94 } |