Changed command line options

* All lower case options define common options
* All upper case options define network specific options
This commit is contained in:
Andreas Eversberg
2016-11-27 06:47:06 +01:00
parent f911717aa4
commit b1c452cf12
28 changed files with 213 additions and 185 deletions

View File

@@ -178,7 +178,7 @@ int cnetz_init(void)
static void cnetz_go_idle(cnetz_t *cnetz);
/* Create transceiver instance and link to a list. */
int cnetz_create(int kanal, enum cnetz_chan_type chan_type, const char *sounddev, int samplerate, int cross_channels, double rx_gain, int auth, int ms_power, int measure_speed, double clock_speed[2], int polarity, double noise, int pre_emphasis, int de_emphasis, const char *write_wave, const char *read_wave, int loopback)
int cnetz_create(int kanal, enum cnetz_chan_type chan_type, const char *sounddev, int samplerate, int cross_channels, double rx_gain, int auth, int ms_power, int measure_speed, double clock_speed[2], int polarity, double noise, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, int loopback)
{
sender_t *sender;
cnetz_t *cnetz;
@@ -237,7 +237,7 @@ int cnetz_create(int kanal, enum cnetz_chan_type chan_type, const char *sounddev
/* init general part of transceiver */
/* do not enable emphasis, since it is done by cnetz code, not by common sender code */
rc = sender_create(&cnetz->sender, kanal, sounddev, samplerate, cross_channels, rx_gain, 0, 0, write_wave, read_wave, loopback, 0, PILOT_SIGNAL_NONE);
rc = sender_create(&cnetz->sender, kanal, sounddev, samplerate, cross_channels, rx_gain, 0, 0, write_rx_wave, write_tx_wave, read_rx_wave, loopback, 0, PILOT_SIGNAL_NONE);
if (rc < 0) {
PDEBUG(DCNETZ, DEBUG_ERROR, "Failed to init transceiver process!\n");
goto error;

View File

@@ -121,7 +121,7 @@ int cnetz_channel_by_short_name(const char *short_name);
const char *chan_type_short_name(enum cnetz_chan_type chan_type);
const char *chan_type_long_name(enum cnetz_chan_type chan_type);
int cnetz_init(void);
int cnetz_create(int kanal, enum cnetz_chan_type chan_type, const char *sounddev, int samplerate, int cross_channels, double rx_gain, int auth, int ms_power, int measure_speed, double clock_speed[2], int polarity, double noise, int pre_emphasis, int de_emphasis, const char *write_wave, const char *read_wave, int loopback);
int cnetz_create(int kanal, enum cnetz_chan_type chan_type, const char *sounddev, int samplerate, int cross_channels, double rx_gain, int auth, int ms_power, int measure_speed, double clock_speed[2], int polarity, double noise, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, int loopback);
void cnetz_destroy(sender_t *sender);
void cnetz_sync_frame(cnetz_t *cnetz, double sync, int ts);
int cnetz_meldeaufruf(uint8_t futln_nat, uint8_t futln_fuvst, uint16_t futln_rest);

View File

@@ -51,9 +51,9 @@ int voice_deviation = 1;
void print_help(const char *arg0)
{
print_help_common(arg0, "-S <rx ppm>,<tx ppm> -E -e ");
print_help_common(arg0, "-S <rx ppm>,<tx ppm> -p -d ");
/* - - */
printf(" -t --channel-type <channel type> | list\n");
printf(" -T --channel-type <channel type> | list\n");
printf(" Give channel type, use 'list' to get a list. (default = '%s')\n", chan_type_short_name(chan_type[0]));
printf(" -M --measure-speed\n");
printf(" Measures clock speed. THIS IS REQUIRED! See documentation!\n");
@@ -93,7 +93,7 @@ static int handle_options(int argc, char **argv)
const char *p;
static struct option long_options_special[] = {
{"channel-type", 1, 0, 't'},
{"channel-type", 1, 0, 'T'},
{"measure-speed", 0, 0, 'M'},
{"clock-speed", 1, 0, 'S'},
{"flip-polarity", 1, 0, 'F'},
@@ -104,7 +104,7 @@ static int handle_options(int argc, char **argv)
{0, 0, 0, 0}
};
set_options_common("t:MS:F:N:P:AV", long_options_special);
set_options_common("T:MS:F:N:P:AV", long_options_special);
while (1) {
int option_index = 0, c;
@@ -115,7 +115,7 @@ static int handle_options(int argc, char **argv)
break;
switch (c) {
case 't':
case 'T':
if (!strcmp(optarg, "list")) {
cnetz_channel_list();
exit(0);
@@ -286,7 +286,7 @@ int main(int argc, char *argv[])
if (!do_pre_emphasis || !do_de_emphasis) {
fprintf(stderr, "*******************************************************************************\n");
fprintf(stderr, "I strongly suggest to let me do pre- and de-emphasis (options -E -e)!\n");
fprintf(stderr, "I strongly suggest to let me do pre- and de-emphasis (options -p -d)!\n");
fprintf(stderr, "Use a transmitter/receiver without emphasis and let me do that!\n");
fprintf(stderr, "Because carrier FSK signaling and scrambled voice (default) does not use\n");
fprintf(stderr, "emphasis, I like to control emphasis by myself for best results.\n");
@@ -301,7 +301,7 @@ int main(int argc, char *argv[])
/* create transceiver instance */
for (i = 0; i < num_kanal; i++) {
rc = cnetz_create(kanal[i], chan_type[i], sounddev[i], samplerate, cross_channels, rx_gain, auth, ms_power, (i == 0) ? measure_speed : 0, clock_speed, polarity, noise, do_pre_emphasis, do_de_emphasis, write_wave, read_wave, loopback);
rc = cnetz_create(kanal[i], chan_type[i], sounddev[i], samplerate, cross_channels, rx_gain, auth, ms_power, (i == 0) ? measure_speed : 0, clock_speed, polarity, noise, do_pre_emphasis, do_de_emphasis, write_rx_wave, write_tx_wave, read_rx_wave, loopback);
if (rc < 0) {
fprintf(stderr, "Failed to create \"Sender\" instance. Quitting!\n");
goto fail;