aboutsummaryrefslogtreecommitdiffstats
path: root/src/bnetz
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2017-01-14 08:03:42 +0100
committerAndreas Eversberg <jolly@eversberg.eu>2017-02-18 21:01:03 +0100
commita7e47f83d71c32d0afbabc8840669aaabc9f6cd5 (patch)
tree2ead183ae7779842109ef2850a0845064552bf53 /src/bnetz
parentccf58995c34381905ff60cfe38eba3fe9e49c3e1 (diff)
Fixed paging channel switching of B-Netz
Now the calling channel is switched correctly. A global parameter is used to select how paging is performed.
Diffstat (limited to 'src/bnetz')
-rw-r--r--src/bnetz/main.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/bnetz/main.c b/src/bnetz/main.c
index 1892b15..e8eb47c 100644
--- a/src/bnetz/main.c
+++ b/src/bnetz/main.c
@@ -36,8 +36,7 @@
#include "ansage.h"
int gfs = 2;
-int num_paging = 0;
-const char *paging[MAX_SENDER] = { "tone" };
+const char *paging = "tone";
double lossdetect = 0;
void print_help(const char *arg0)
@@ -63,7 +62,7 @@ void print_help(const char *arg0)
printf(" 'negative' sends a negative signal for channel 19, else positive.\n");
printf(" Example: /sys/class/gpio/gpio17/value=1:0 writes a '1' to\n");
printf(" /sys/class/gpio/gpio17/value to switching to channel 19 and a '0' to\n");
- printf(" switch back. (default = %s)\n", paging[0]);
+ printf(" switch back. (default = %s)\n", paging);
printf(" -L --loss <volume>\n");
printf(" Detect loss of carrier by detecting steady noise above given volume in\n");
printf(" percent. (disabled by default)\n");
@@ -109,7 +108,7 @@ static int handle_options(int argc, char **argv)
skip_args += 2;
break;
case 'P':
- OPT_ARRAY(num_paging, paging, strdup(optarg))
+ paging = strdup(optarg);
skip_args += 2;
break;
case 'L':
@@ -159,12 +158,6 @@ int main(int argc, char *argv[])
fprintf(stderr, "You need to specify as many sound devices as you have channels.\n");
exit(0);
}
- if (num_kanal == 1 && num_paging == 0)
- num_paging = 1; /* use defualt */
- if (num_kanal != num_paging) {
- fprintf(stderr, "You need to specify as many paging tone settings as you have channels.\n");
- exit(0);
- }
if (!loopback)
print_image();
@@ -184,7 +177,7 @@ int main(int argc, char *argv[])
/* create transceiver instance */
for (i = 0; i < num_kanal; i++) {
- rc = bnetz_create(kanal[i], audiodev[i], samplerate, rx_gain, gfs, do_pre_emphasis, do_de_emphasis, write_rx_wave, write_tx_wave, read_rx_wave, loopback, (double)lossdetect / 100.0, paging[i]);
+ rc = bnetz_create(kanal[i], audiodev[i], samplerate, rx_gain, gfs, do_pre_emphasis, do_de_emphasis, write_rx_wave, write_tx_wave, read_rx_wave, loopback, (double)lossdetect / 100.0, paging);
if (rc < 0) {
fprintf(stderr, "Failed to create \"Sender\" instance. Quitting!\n");
goto fail;