FreeCalypso > hg > ice1-trau-tester
comparison ater/record_ctrl.c @ 15:98ae717734d6
ater: starting skeleton
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 24 Jun 2024 04:01:38 +0000 |
parents | pcm/record_ctrl.c@631f2db08538 |
children |
comparison
equal
deleted
inserted
replaced
14:99426da5603d | 15:98ae717734d6 |
---|---|
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 } |