FreeCalypso > hg > ice1-trau-tester
comparison ater8/record_ctrl.c @ 42:ff94d7fc5891
new program itt-ater-8
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Fri, 30 Aug 2024 19:02:42 +0000 |
| parents | ater/record_ctrl.c@98ae717734d6 |
| children |
comparison
equal
deleted
inserted
replaced
| 41:50a72d4ff498 | 42:ff94d7fc5891 |
|---|---|
| 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 } |
