anetz/bnetz: Move option 'loss detection' from common code to individual code
parent
9b8e359264
commit
d21be383a6
|
@ -35,6 +35,7 @@
|
|||
|
||||
/* settings */
|
||||
int page_sequence = 0;
|
||||
double lossdetect = 0;
|
||||
|
||||
void print_help(const char *arg0)
|
||||
{
|
||||
|
@ -43,6 +44,9 @@ void print_help(const char *arg0)
|
|||
printf(" -P --page-sequence 0 | <ms>\n");
|
||||
printf(" Cycle paging tones, rather than sending simultaniously.\n");
|
||||
printf(" (default = '%d')\n", page_sequence);
|
||||
printf(" -0 --loss <volume>\n");
|
||||
printf(" Detect loss of carrier by detecting steady noise above given volume in\n");
|
||||
printf(" percent. (disabled by default)\n");
|
||||
printf("\nstation-id: Give (last) 5 digits of station-id, you don't need to enter it\n");
|
||||
printf(" for every start of this program.\n");
|
||||
}
|
||||
|
@ -53,10 +57,11 @@ static int handle_options(int argc, char **argv)
|
|||
|
||||
static struct option long_options_special[] = {
|
||||
{"page-sequence", 1, 0, 'P'},
|
||||
{"loss", 1, 0, '0'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
set_options_common("P:", long_options_special);
|
||||
set_options_common("P:0:", long_options_special);
|
||||
|
||||
while (1) {
|
||||
int option_index = 0, c;
|
||||
|
@ -71,6 +76,10 @@ static int handle_options(int argc, char **argv)
|
|||
page_sequence = atoi(optarg);
|
||||
skip_args += 2;
|
||||
break;
|
||||
case '0':
|
||||
lossdetect = atoi(optarg);
|
||||
skip_args += 2;
|
||||
break;
|
||||
default:
|
||||
opt_switch_common(c, argv[0], &skip_args);
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
|
||||
int gfs = 2;
|
||||
const char *pilot = "tone";
|
||||
double lossdetect = 0;
|
||||
|
||||
void print_help(const char *arg0)
|
||||
{
|
||||
|
@ -53,6 +54,9 @@ void print_help(const char *arg0)
|
|||
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", pilot);
|
||||
printf(" -0 --loss <volume>\n");
|
||||
printf(" Detect loss of carrier by detecting steady noise above given volume in\n");
|
||||
printf(" percent. (disabled by default)\n");
|
||||
printf("\nstation-id: Give 5 digit station-id, you don't need to enter it for every\n");
|
||||
printf(" start of this program.\n");
|
||||
}
|
||||
|
@ -64,10 +68,11 @@ static int handle_options(int argc, char **argv)
|
|||
static struct option long_options_special[] = {
|
||||
{"gfs", 1, 0, 'g'},
|
||||
{"pilot", 1, 0, 'P'},
|
||||
{"loss", 1, 0, '0'},
|
||||
{0, 0, 0, 0},
|
||||
};
|
||||
|
||||
set_options_common("g:P:", long_options_special);
|
||||
set_options_common("g:P:0:", long_options_special);
|
||||
|
||||
while (1) {
|
||||
int option_index = 0, c;
|
||||
|
@ -86,6 +91,10 @@ static int handle_options(int argc, char **argv)
|
|||
pilot = strdup(optarg);
|
||||
skip_args += 2;
|
||||
break;
|
||||
case '0':
|
||||
lossdetect = atoi(optarg);
|
||||
skip_args += 2;
|
||||
break;
|
||||
default:
|
||||
opt_switch_common(c, argv[0], &skip_args);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ extern int latency;
|
|||
extern int use_mncc_sock;
|
||||
extern int send_patterns;
|
||||
extern int loopback;
|
||||
extern double lossdetect;
|
||||
extern int rt_prio;
|
||||
|
||||
void print_help(const char *arg0);
|
||||
|
|
|
@ -35,7 +35,6 @@ int latency = 50;
|
|||
int use_mncc_sock = 0;
|
||||
int send_patterns = 1;
|
||||
int loopback = 0;
|
||||
double lossdetect = 0;
|
||||
int rt_prio = 0;
|
||||
|
||||
void print_help_common(const char *arg0)
|
||||
|
@ -55,9 +54,6 @@ void print_help_common(const char *arg0)
|
|||
printf(" Sample rate of sound device (default = '%d')\n", samplerate);
|
||||
printf(" -l --latency <delay>\n");
|
||||
printf(" How many milliseconds processed in advance (default = '%d')\n", latency);
|
||||
printf(" -0 --loss <volume>\n");
|
||||
printf(" Detect loss of carrier by detecting steady noise above given volume in\n");
|
||||
printf(" percent. (disabled by default)\n");
|
||||
printf(" -m --mncc-sock\n");
|
||||
printf(" Disable built-in call contol and offer socket (to LCR)\n");
|
||||
printf(" -c --call-device hw:<card>,<device>\n");
|
||||
|
@ -78,7 +74,6 @@ static struct option long_options_common[] = {
|
|||
{"call-device", 1, 0, 'c'},
|
||||
{"samplerate", 1, 0, 's'},
|
||||
{"latency", 1, 0, 'l'},
|
||||
{"loss", 1, 0, '0'},
|
||||
{"mncc-sock", 0, 0, 'm'},
|
||||
{"send-patterns", 0, 0, 'p'},
|
||||
{"loopback", 1, 0, 'L'},
|
||||
|
@ -86,7 +81,7 @@ static struct option long_options_common[] = {
|
|||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
const char *optstring_common = "hD:k:d:s:c:l:0:mp:L:r:";
|
||||
const char *optstring_common = "hD:k:d:s:c:l:mp:L:r:";
|
||||
|
||||
struct option *long_options;
|
||||
char *optstring;
|
||||
|
@ -140,10 +135,6 @@ void opt_switch_common(int c, char *arg0, int *skip_args)
|
|||
latency = atoi(optarg);
|
||||
*skip_args += 2;
|
||||
break;
|
||||
case '0':
|
||||
lossdetect = atoi(optarg);
|
||||
*skip_args += 2;
|
||||
break;
|
||||
case 'm':
|
||||
use_mncc_sock = 1;
|
||||
*skip_args += 1;
|
||||
|
|
Loading…
Reference in New Issue