comparison ft16/record_ctrl.c @ 2:5c18cd38c8ad

ft16: import from ice1-trau-tester/abis
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 29 Aug 2024 13:07:16 +0000
parents
children
comparison
equal deleted inserted replaced
1:e5527fc2050b 2:5c18cd38c8ad
1 /*
2 * Here we implement stdin commands that control recording of E1 timeslot
3 * read stream.
4 */
5
6 #include <stdint.h>
7 #include <stdbool.h>
8 #include <stdio.h>
9 #include <stdlib.h>
10
11 #include <osmocom/core/select.h>
12
13 #include "globals.h"
14
15 void cmd_record_start(int argc, char **argv)
16 {
17 if (argc != 2) {
18 printf("error: record command needs 1 argument\n");
19 return;
20 }
21 if (record_file) {
22 printf("error: recording already in progress\n");
23 return;
24 }
25 record_file = fopen(argv[1], "w");
26 if (!record_file)
27 perror(argv[1]);
28 }
29
30 void cmd_record_stop(int argc, char **argv)
31 {
32 if (!record_file) {
33 printf("error: no recording in progress\n");
34 return;
35 }
36 fclose(record_file);
37 record_file = NULL;
38 }
39
40 void cmd_print_rx(int argc, char **argv)
41 {
42 int i, j, off;
43
44 off = 0;
45 for (i = 0; i < 10; i++) {
46 for (j = 0; j < 16; j++)
47 printf(" %02X", readbuf[off++]);
48 putchar('\n');
49 }
50 }