aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2016-11-27 06:47:06 +0100
committerAndreas Eversberg <jolly@eversberg.eu>2016-11-27 22:06:47 +0100
commitb1c452cf1218241ce4464c3b280cbe8f72f33eb7 (patch)
tree9ba2b9d504f52516a06c2532b34d12965788debc /src
parentf911717aa47dd3528e99aa76de1d98c543eaa2cb (diff)
Changed command line options
* All lower case options define common options * All upper case options define network specific options
Diffstat (limited to 'src')
-rw-r--r--src/amps/amps.c4
-rw-r--r--src/amps/amps.h2
-rw-r--r--src/amps/main.c20
-rw-r--r--src/anetz/anetz.c4
-rw-r--r--src/anetz/anetz.h2
-rw-r--r--src/anetz/main.c16
-rw-r--r--src/bnetz/bnetz.c4
-rw-r--r--src/bnetz/bnetz.h2
-rw-r--r--src/bnetz/main.c18
-rw-r--r--src/cnetz/cnetz.c4
-rw-r--r--src/cnetz/cnetz.h2
-rw-r--r--src/cnetz/main.c14
-rw-r--r--src/common/main.h5
-rw-r--r--src/common/main_common.c124
-rw-r--r--src/common/sender.c69
-rw-r--r--src/common/sender.h7
-rw-r--r--src/nmt/main.c36
-rw-r--r--src/nmt/nmt.c4
-rw-r--r--src/nmt/nmt.h2
19 files changed, 183 insertions, 156 deletions
diff --git a/src/amps/amps.c b/src/amps/amps.c
index 3404441..d9f6287 100644
--- a/src/amps/amps.c
+++ b/src/amps/amps.c
@@ -356,7 +356,7 @@ static amps_t *search_pc(void)
static void amps_go_idle(amps_t *amps);
/* Create transceiver instance and link to a list. */
-int amps_create(int channel, enum amps_chan_type chan_type, const char *sounddev, int samplerate, int cross_channels, double rx_gain, int pre_emphasis, int de_emphasis, const char *write_wave, const char *read_wave, amps_si *si, uint16_t sid, uint8_t sat, int polarity, int tolerant, int loopback)
+int amps_create(int channel, enum amps_chan_type chan_type, const char *sounddev, int samplerate, int cross_channels, double rx_gain, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, amps_si *si, uint16_t sid, uint8_t sat, int polarity, int tolerant, int loopback)
{
sender_t *sender;
amps_t *amps;
@@ -422,7 +422,7 @@ int amps_create(int channel, enum amps_chan_type chan_type, const char *sounddev
PDEBUG(DAMPS, DEBUG_DEBUG, "Creating 'AMPS' instance for channel = %d (sample rate %d).\n", channel, samplerate);
/* init general part of transceiver */
- rc = sender_create(&amps->sender, channel, sounddev, samplerate, cross_channels, rx_gain, 0, 0, write_wave, read_wave, loopback, 0, PILOT_SIGNAL_NONE);
+ rc = sender_create(&amps->sender, channel, 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(DAMPS, DEBUG_ERROR, "Failed to init transceiver process!\n");
goto error;
diff --git a/src/amps/amps.h b/src/amps/amps.h
index 4c47f09..2a2686b 100644
--- a/src/amps/amps.h
+++ b/src/amps/amps.h
@@ -163,7 +163,7 @@ const char *amps_min12number(uint32_t min1);
void amps_number2min(const char *number, uint32_t *min1, uint16_t *min2);
const char *amps_min2number(uint32_t min1, uint16_t min2);
const char *amps_scm(uint8_t scm);
-int amps_create(int channel, enum amps_chan_type chan_type, const char *sounddev, int samplerate, int cross_channels, double rx_gain, int pre_emphasis, int de_emphasis, const char *write_wave, const char *read_wave, amps_si *si, uint16_t sid, uint8_t sat, int polarity, int tolerant, int loopback);
+int amps_create(int channel, enum amps_chan_type chan_type, const char *sounddev, int samplerate, int cross_channels, double rx_gain, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, amps_si *si, uint16_t sid, uint8_t sat, int polarity, int tolerant, int loopback);
void amps_destroy(sender_t *sender);
void amps_rx_signaling_tone(amps_t *amps, int tone, double quality);
void amps_rx_sat(amps_t *amps, int tone, double quality);
diff --git a/src/amps/main.c b/src/amps/main.c
index a32fdc8..85c6523 100644
--- a/src/amps/main.c
+++ b/src/amps/main.c
@@ -47,9 +47,9 @@ int tolerant = 0;
void print_help(const char *arg0)
{
- print_help_common(arg0, "-E -e -F yes | no ");
+ print_help_common(arg0, "-p -d -F yes | no ");
/* - - */
- 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(" -F --flip-polarity no | yes\n");
printf(" Flip polarity of transmitted FSK signal. If yes, the sound card\n");
@@ -85,7 +85,7 @@ void print_help(const char *arg0)
printf(" -S --sysinfo bis=0 | bis=1\n");
printf(" If 0, phone ignores BUSY/IDLE bit on FOCC (default = '%d')\n", bis);
printf(" If 1, be sure to have a round-trip delay (latency) not more than 5 ms\n");
- printf(" -T --tolerant\n");
+ printf(" -O --tolerant\n");
printf(" Be more tolerant when hunting for sync sequence\n");
printf("\nstation-id: Give 10 digit station-id, you don't need to enter it for every\n");
printf(" start of this program.\n");
@@ -98,15 +98,15 @@ static int handle_options(int argc, char **argv)
int rc;
static struct option long_options_special[] = {
- {"channel-type", 1, 0, 't'},
+ {"channel-type", 1, 0, 'T'},
{"flip-polarity", 1, 0, 'F'},
{"ms-power", 1, 0, 'P'},
{"sysinfo", 1, 0, 'S'},
- {"tolerant", 0, 0, 'T'},
+ {"tolerant", 0, 0, 'O'},
{0, 0, 0, 0}
};
- set_options_common("t:F:P:S:T", long_options_special);
+ set_options_common("T:F:P:S:O", long_options_special);
while (1) {
int option_index = 0, c;
@@ -117,7 +117,7 @@ static int handle_options(int argc, char **argv)
break;
switch (c) {
- case 't':
+ case 'T':
if (!strcmp(optarg, "list")) {
amps_channel_list();
exit(0);
@@ -209,7 +209,7 @@ static int handle_options(int argc, char **argv)
}
skip_args += 2;
break;
- case 'T':
+ case 'O':
tolerant = 1;
skip_args += 1;
break;
@@ -326,7 +326,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 does not use emphasis, I like to control\n");
fprintf(stderr, "emphasis by myself for best results.\n");
@@ -347,7 +347,7 @@ int main(int argc, char *argv[])
amps_si si;
init_sysinfo(&si, ms_power, ms_power, dcc, sid >> 1, regh, regr, pureg, pdreg, locaid, regincr, bis);
- rc = amps_create(kanal[i], chan_type[i], sounddev[i], samplerate, cross_channels, rx_gain, do_pre_emphasis, do_de_emphasis, write_wave, read_wave, &si, sid, scc, polarity, tolerant, loopback);
+ rc = amps_create(kanal[i], chan_type[i], sounddev[i], samplerate, cross_channels, rx_gain, do_pre_emphasis, do_de_emphasis, write_rx_wave, write_tx_wave, read_rx_wave, &si, sid, scc, polarity, tolerant, loopback);
if (rc < 0) {
fprintf(stderr, "Failed to create \"Sender\" instance. Quitting!\n");
goto fail;
diff --git a/src/anetz/anetz.c b/src/anetz/anetz.c
index c30d2ea..0d75990 100644
--- a/src/anetz/anetz.c
+++ b/src/anetz/anetz.c
@@ -137,7 +137,7 @@ static void anetz_timeout(struct timer *timer);
static void anetz_go_idle(anetz_t *anetz);
/* Create transceiver instance and link to a list. */
-int anetz_create(int kanal, const char *sounddev, int samplerate, int cross_channels, double rx_gain, int page_sequence, int pre_emphasis, int de_emphasis, const char *write_wave, const char *read_wave, int loopback, double loss_volume)
+int anetz_create(int kanal, const char *sounddev, int samplerate, int cross_channels, double rx_gain, int page_sequence, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, int loopback, double loss_volume)
{
anetz_t *anetz;
int rc;
@@ -156,7 +156,7 @@ int anetz_create(int kanal, const char *sounddev, int samplerate, int cross_chan
PDEBUG(DANETZ, DEBUG_DEBUG, "Creating 'A-Netz' instance for 'Kanal' = %d (sample rate %d).\n", kanal, samplerate);
/* init general part of transceiver */
- rc = sender_create(&anetz->sender, kanal, sounddev, samplerate, cross_channels, rx_gain, pre_emphasis, de_emphasis, write_wave, read_wave, loopback, loss_volume, PILOT_SIGNAL_NONE);
+ rc = sender_create(&anetz->sender, kanal, sounddev, samplerate, cross_channels, rx_gain, pre_emphasis, de_emphasis, write_rx_wave, write_tx_wave, read_rx_wave, loopback, loss_volume, PILOT_SIGNAL_NONE);
if (rc < 0) {
PDEBUG(DANETZ, DEBUG_ERROR, "Failed to init 'Sender' processing!\n");
goto error;
diff --git a/src/anetz/anetz.h b/src/anetz/anetz.h
index a3fe5b8..be3984a 100644
--- a/src/anetz/anetz.h
+++ b/src/anetz/anetz.h
@@ -44,7 +44,7 @@ typedef struct anetz {
double anetz_kanal2freq(int kanal, int unterband);
int anetz_init(void);
-int anetz_create(int kanal, const char *sounddev, int samplerate, int cross_channels, double rx_gain, int page_sequence, int pre_emphasis, int de_emphasis, const char *write_wave, const char *read_wave, int loopback, double loss_volume);
+int anetz_create(int kanal, const char *sounddev, int samplerate, int cross_channels, double rx_gain, int page_sequence, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, int loopback, double loss_volume);
void anetz_destroy(sender_t *sender);
void anetz_loss_indication(anetz_t *anetz);
void anetz_receive_tone(anetz_t *anetz, int bit);
diff --git a/src/anetz/main.c b/src/anetz/main.c
index ce616cf..d4ea13f 100644
--- a/src/anetz/main.c
+++ b/src/anetz/main.c
@@ -42,14 +42,14 @@ void print_help(const char *arg0)
{
print_help_common(arg0, "");
/* - - */
- printf(" -g --geo <lat>,<lon>\n");
+ printf(" -G --geo <lat>,<lon>\n");
printf(" Give your coordinates of your location, to find closest base station.\n");
printf(" (e.g. '--geo 51.186959,7.080194') Or use '--geo list' to get a list of\n");
printf(" all base station locations.\n");
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(" -L --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");
@@ -62,13 +62,13 @@ static int handle_options(int argc, char **argv)
char *p;
static struct option long_options_special[] = {
- {"geo", 1, 0, 'g'},
+ {"geo", 1, 0, 'G'},
{"page-sequence", 1, 0, 'P'},
- {"loss", 1, 0, '0'},
+ {"loss", 1, 0, 'L'},
{0, 0, 0, 0}
};
- set_options_common("g:P:0:", long_options_special);
+ set_options_common("G:P:L:", long_options_special);
while (1) {
int option_index = 0, c;
@@ -79,7 +79,7 @@ static int handle_options(int argc, char **argv)
break;
switch (c) {
- case 'g':
+ case 'G':
if (!strcasecmp(optarg, "list")) {
station_list();
exit(0);
@@ -95,7 +95,7 @@ static int handle_options(int argc, char **argv)
page_sequence = atoi(optarg);
skip_args += 2;
break;
- case '0':
+ case 'L':
lossdetect = atoi(optarg);
skip_args += 2;
break;
@@ -167,7 +167,7 @@ int main(int argc, char *argv[])
/* create transceiver instance */
for (i = 0; i < num_kanal; i++) {
- rc = anetz_create(kanal[i], sounddev[i], samplerate, cross_channels, rx_gain, page_sequence, do_pre_emphasis, do_de_emphasis, write_wave, read_wave, loopback, lossdetect / 100.0);
+ rc = anetz_create(kanal[i], sounddev[i], samplerate, cross_channels, rx_gain, page_sequence, do_pre_emphasis, do_de_emphasis, write_rx_wave, write_tx_wave, read_rx_wave, loopback, lossdetect / 100.0);
if (rc < 0) {
fprintf(stderr, "Failed to create \"Sender\" instance. Quitting!\n");
goto fail;
diff --git a/src/bnetz/bnetz.c b/src/bnetz/bnetz.c
index 1082a46..62a68a8 100644
--- a/src/bnetz/bnetz.c
+++ b/src/bnetz/bnetz.c
@@ -99,7 +99,7 @@ static void bnetz_timeout(struct timer *timer);
static void bnetz_go_idle(bnetz_t *bnetz);
/* Create transceiver instance and link to a list. */
-int bnetz_create(int kanal, const char *sounddev, int samplerate, int cross_channels, double rx_gain, int gfs, int pre_emphasis, int de_emphasis, const char *write_wave, const char *read_wave, int loopback, double loss_factor, const char *pilot)
+int bnetz_create(int kanal, const char *sounddev, int samplerate, int cross_channels, double rx_gain, int gfs, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, int loopback, double loss_factor, const char *pilot)
{
bnetz_t *bnetz;
enum pilot_signal pilot_signal = PILOT_SIGNAL_NONE;
@@ -160,7 +160,7 @@ error_pilot:
PDEBUG(DBNETZ, DEBUG_DEBUG, "Creating 'B-Netz' instance for 'Kanal' = %d 'Gruppenfreisignal' = %d (sample rate %d).\n", kanal, gfs, samplerate);
/* init general part of transceiver */
- rc = sender_create(&bnetz->sender, kanal, sounddev, samplerate, cross_channels, rx_gain, pre_emphasis, de_emphasis, write_wave, read_wave, loopback, loss_factor, pilot_signal);
+ rc = sender_create(&bnetz->sender, kanal, sounddev, samplerate, cross_channels, rx_gain, pre_emphasis, de_emphasis, write_rx_wave, write_tx_wave, read_rx_wave, loopback, loss_factor, pilot_signal);
if (rc < 0) {
PDEBUG(DBNETZ, DEBUG_ERROR, "Failed to init transceiver process!\n");
goto error;
diff --git a/src/bnetz/bnetz.h b/src/bnetz/bnetz.h
index ab2bbc0..2f35391 100644
--- a/src/bnetz/bnetz.h
+++ b/src/bnetz/bnetz.h
@@ -99,7 +99,7 @@ typedef struct bnetz {
double bnetz_kanal2freq(int kanal, int unterband);
int bnetz_init(void);
-int bnetz_create(int kanal, const char *sounddev, int samplerate, int cross_channels, double rx_gain, int gfs, int pre_emphasis, int de_emphasis, const char *write_wave, const char *read_wave, int loopback, double loss_factor, const char *pilot);
+int bnetz_create(int kanal, const char *sounddev, int samplerate, int cross_channels, double rx_gain, int gfs, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, int loopback, double loss_factor, const char *pilot);
void bnetz_destroy(sender_t *sender);
void bnetz_loss_indication(bnetz_t *bnetz);
void bnetz_receive_tone(bnetz_t *bnetz, int bit);
diff --git a/src/bnetz/main.c b/src/bnetz/main.c
index d0abedc..4c5f98b 100644
--- a/src/bnetz/main.c
+++ b/src/bnetz/main.c
@@ -44,12 +44,12 @@ void print_help(const char *arg0)
{
print_help_common(arg0, "");
/* - - */
- printf(" -g --gfs <gruppenfreisignal> | <lat>,<lon>\n");
+ printf(" -G --gfs <gruppenfreisignal> | <lat>,<lon>\n");
printf(" Gruppenfreisignal\" 1..9 | 19 | 10..18 (default = '%d')\n", gfs);
printf(" Alternative give your coordinates of your location, to find closest\n");
printf(" base station. (e.g. '--gfs 54.487291,9.069993') Or use '--gfs list' to\n");
printf(" get a list of all base station locations.\n");
- printf(" -g --gfs 19\n");
+ printf(" -G --gfs 19\n");
printf(" Set to 19 in order to make the phone transmit at 100 mW instead of\n");
printf(" full 15 Watts. If supported, the phone uses the channel with low power\n");
printf(" (Kanal kleiner Leistung).\n");
@@ -64,7 +64,7 @@ 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[0]);
- printf(" -0 --loss <volume>\n");
+ 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");
printf("\nstation-id: Give 5 digit station-id, you don't need to enter it for every\n");
@@ -77,13 +77,13 @@ static int handle_options(int argc, char **argv)
char *p;
static struct option long_options_special[] = {
- {"gfs", 1, 0, 'g'},
+ {"gfs", 1, 0, 'G'},
{"pilot", 1, 0, 'P'},
- {"loss", 1, 0, '0'},
+ {"loss", 1, 0, 'L'},
{0, 0, 0, 0},
};
- set_options_common("g:P:0:", long_options_special);
+ set_options_common("G:P:L:", long_options_special);
while (1) {
int option_index = 0, c;
@@ -94,7 +94,7 @@ static int handle_options(int argc, char **argv)
break;
switch (c) {
- case 'g':
+ case 'G':
if (!strcasecmp(optarg, "list")) {
station_list();
exit(0);
@@ -111,7 +111,7 @@ static int handle_options(int argc, char **argv)
OPT_ARRAY(num_pilot, pilot, strdup(optarg))
skip_args += 2;
break;
- case '0':
+ case 'L':
lossdetect = atoi(optarg);
skip_args += 2;
break;
@@ -186,7 +186,7 @@ int main(int argc, char *argv[])
/* create transceiver instance */
for (i = 0; i < num_kanal; i++) {
- rc = bnetz_create(kanal[i], sounddev[i], samplerate, cross_channels, rx_gain, gfs, do_pre_emphasis, do_de_emphasis, write_wave, read_wave, loopback, (double)lossdetect / 100.0, pilot[i]);
+ rc = bnetz_create(kanal[i], sounddev[i], samplerate, cross_channels, rx_gain, gfs, do_pre_emphasis, do_de_emphasis, write_rx_wave, write_tx_wave, read_rx_wave, loopback, (double)lossdetect / 100.0, pilot[i]);
if (rc < 0) {
fprintf(stderr, "Failed to create \"Sender\" instance. Quitting!\n");
goto fail;
diff --git a/src/cnetz/cnetz.c b/src/cnetz/cnetz.c
index 7fa5299..e0f5281 100644
--- a/src/cnetz/cnetz.c
+++ b/src/cnetz/cnetz.c
@@ -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;
diff --git a/src/cnetz/cnetz.h b/src/cnetz/cnetz.h
index bc7e474..3bda112 100644
--- a/src/cnetz/cnetz.h
+++ b/src/cnetz/cnetz.h
@@ -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);
diff --git a/src/cnetz/main.c b/src/cnetz/main.c
index 97a9551..0a3a6a5 100644
--- a/src/cnetz/main.c
+++ b/src/cnetz/main.c
@@ -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;
diff --git a/src/common/main.h b/src/common/main.h
index 4535ac0..9072c70 100644
--- a/src/common/main.h
+++ b/src/common/main.h
@@ -15,8 +15,9 @@ extern int use_mncc_sock;
extern int send_patterns;
extern int loopback;
extern int rt_prio;
-extern const char *read_wave;
-extern const char *write_wave;
+extern const char *write_rx_wave;
+extern const char *write_tx_wave;
+extern const char *read_rx_wave;
void print_help(const char *arg0);
void print_help_common(const char *arg0, const char *ext_usage);
diff --git a/src/common/main_common.c b/src/common/main_common.c
index 2706b71..e92f7ce 100644
--- a/src/common/main_common.c
+++ b/src/common/main_common.c
@@ -51,8 +51,9 @@ int send_patterns = 1;
int release_on_disconnect = 1;
int loopback = 0;
int rt_prio = 0;
-const char *read_wave = NULL;
-const char *write_wave = NULL;
+const char *write_rx_wave = NULL;
+const char *write_tx_wave = NULL;
+const char *read_rx_wave = NULL;
void print_help_common(const char *arg0, const char *ext_usage)
{
@@ -61,14 +62,15 @@ void print_help_common(const char *arg0, const char *ext_usage)
/* - - */
printf(" -h --help\n");
printf(" This help\n");
- printf(" -D --debug <level> | <level>,<category>[,<category>[,...]] | list\n");
+ printf(" -v --verbose <level> | <level>,<category>[,<category>[,...]] | list\n");
printf(" Use 'list' to get a list of all levels and categories\n");
- printf(" Debug level: digit of debug level (default = '%d')\n", debuglevel);
- printf(" Debug level+category: level digit followed by one or more categories\n");
+ printf(" Verbose level: digit of debug level (default = '%d')\n", debuglevel);
+ printf(" Verbose level+category: level digit followed by one or more categories\n");
printf(" -> If no category is specified, all categories are selected\n");
printf(" -k --kanal <channel>\n");
- printf(" Channel number of \"Sender\"\n");
- printf(" -d --device hw:<card>,<device>\n");
+ printf(" -k --channel <channel>\n");
+ printf(" Channel (German = Kanal) number of \"Sender\" (German = Transceiver)\n");
+ printf(" -a --audio-device hw:<card>,<device>\n");
printf(" Sound card and device number (default = '%s')\n", sounddev[0]);
printf(" -s --samplerate <rate>\n");
printf(" Sample rate of sound device (default = '%d')\n", samplerate);
@@ -76,18 +78,18 @@ void print_help_common(const char *arg0, const char *ext_usage)
printf(" Interval of processing loop in ms (default = '%d' ms)\n", interval);
printf(" Use 25 to drastically reduce CPU usage. In case of buffer underrun,\n");
printf(" increase latency accordingly.\n");
- printf(" -l --latency <delay>\n");
- printf(" How many milliseconds processed in advance (default = '%d')\n", latency);
+ printf(" -b --buffer <ms>\n");
+ printf(" How many milliseconds are processed in advance (default = '%d')\n", latency);
printf(" -x --cross\n");
printf(" Cross channels on sound card. 1st channel (right) is swapped with\n");
printf(" second channel (left)\n");
- printf(" -E --pre-emphasis\n");
+ printf(" -p --pre-emphasis\n");
printf(" Enable pre-emphasis, if you directly connect to the oscillator of the\n");
printf(" transmitter. (No pre-emphasis done by the transmitter.)\n");
- printf(" -e --de-emphasis\n");
+ printf(" -d --de-emphasis\n");
printf(" Enable de-emphasis, if you directly connect to the discriminator of\n");
printf(" the receiver. (No de-emphasis done by the receiver.)\n");
- printf(" -G --rx-gain <dB>\n");
+ printf(" -g --rx-gain <dB>\n");
printf(" Raise receiver RX level by given gain in dB. This is useful if input\n");
printf(" level of the sound device is too low, even after setting maximum level\n");
printf(" with the mixer settings.\n");
@@ -95,55 +97,80 @@ void print_help_common(const char *arg0, const char *ext_usage)
printf(" Disable built-in call contol and offer socket (to LCR)\n");
printf(" -c --call-device hw:<card>,<device>\n");
printf(" Sound card and device number for headset (default = '%s')\n", call_sounddev);
- printf(" -p --send-patterns 0 | 1\n");
+ printf(" -t --tones 0 | 1\n");
printf(" Connect call on setup/release to provide classic tones towards fixed\n");
printf(" network (default = '%d')\n", send_patterns);
- printf(" -L --loopback <type>\n");
+ printf(" -l --loopback <type>\n");
printf(" Loopback test: 1 = internal | 2 = external | 3 = echo\n");
printf(" -r --realtime <prio>\n");
printf(" Set prio: 0 to diable, 99 for maximum (default = %d)\n", rt_prio);
- printf(" -W --write-wave <file>\n");
+ printf(" --write-rx-wave <file>\n");
printf(" Write received audio to given wav audio file.\n");
- printf(" -R --read-wave <file>\n");
+ printf(" --write-tx-wave <file>\n");
+ printf(" Write transmitted audio to given wav audio file.\n");
+ printf(" --read-rx-wave <file>\n");
printf(" Replace received audio by given wav audio file.\n");
}
+#define OPT_CHANNEL 1000
+#define OPT_WRITE_RX_WAVE 1001
+#define OPT_WRITE_TX_WAVE 1002
+#define OPT_READ_RX_WAVE 1003
+
static struct option long_options_common[] = {
{"help", 0, 0, 'h'},
- {"debug", 1, 0, 'D'},
+ {"debug", 1, 0, 'v'},
{"kanal", 1, 0, 'k'},
- {"device", 1, 0, 'd'},
- {"call-device", 1, 0, 'c'},
+ {"channel", 1, 0, OPT_CHANNEL},
+ {"call-device", 1, 0, 'a'},
{"samplerate", 1, 0, 's'},
{"interval", 1, 0, 'i'},
- {"latency", 1, 0, 'l'},
+ {"buffer", 1, 0, 'b'},
{"cross", 0, 0, 'x'},
- {"pre-emphasis", 0, 0, 'E'},
- {"de-emphasis", 0, 0, 'e'},
- {"rx-gain", 0, 0, 'G'},
+ {"pre-emphasis", 0, 0, 'p'},
+ {"de-emphasis", 0, 0, 'd'},
+ {"rx-gain", 0, 0, 'g'},
{"mncc-sock", 0, 0, 'm'},
- {"send-patterns", 0, 0, 'p'},
- {"loopback", 1, 0, 'L'},
+ {"call-device", 1, 0, 'c'},
+ {"tones", 0, 0, 't'},
+ {"loopback", 1, 0, 'l'},
{"realtime", 1, 0, 'r'},
- {"write-wave", 1, 0, 'W'},
- {"read-wave", 1, 0, 'R'},
+ {"write-rx-wave", 1, 0, OPT_WRITE_RX_WAVE},
+ {"write-tx-wave", 1, 0, OPT_WRITE_TX_WAVE},
+ {"read-rx-wave", 1, 0, OPT_READ_RX_WAVE},
{0, 0, 0, 0}
};
-const char *optstring_common = "hD:k:d:s:c:i:l:xEeG:mp:L:r:W:R:";
+const char *optstring_common = "hv:k:a:s:i:b:xpdg:mc:t:l:r:";
struct option *long_options;
char *optstring;
+static void check_duplicate_option(int num, struct option *option)
+{
+ int i;
+
+ for (i = 0; i < num; i++) {
+ if (long_options[i].val == option->val) {
+ fprintf(stderr, "Duplicate option %d. Please fix!\n", option->val);
+ abort();
+ }
+ }
+}
+
void set_options_common(const char *optstring_special, struct option *long_options_special)
{
int i;
long_options = calloc(sizeof(*long_options), 100);
- for (i = 0; long_options_common[i].name; i++)
+ for (i = 0; long_options_common[i].name; i++) {
+ check_duplicate_option(i, &long_options_common[i]);
memcpy(&long_options[i], &long_options_common[i], sizeof(*long_options));
- for (; long_options_special->name; i++)
+ }
+ for (; long_options_special->name; i++) {
+ check_duplicate_option(i, long_options_special);
memcpy(&long_options[i], long_options_special++, sizeof(*long_options));
+ }
optstring = calloc(strlen(optstring_common) + strlen(optstring_special) + 1, 1);
strcpy(optstring, optstring_common);
@@ -158,7 +185,7 @@ void opt_switch_common(int c, char *arg0, int *skip_args)
case 'h':
print_help(arg0);
exit(0);
- case 'D':
+ case 'v':
if (!strcasecmp(optarg, "list")) {
debug_list_cat();
exit(0);
@@ -170,10 +197,11 @@ void opt_switch_common(int c, char *arg0, int *skip_args)
*skip_args += 2;
break;
case 'k':
+ case OPT_CHANNEL:
OPT_ARRAY(num_kanal, kanal, atoi(optarg))
*skip_args += 2;
break;
- case 'd':
+ case 'a':
OPT_ARRAY(num_sounddev, sounddev, strdup(optarg))
*skip_args += 2;
break;
@@ -181,10 +209,6 @@ void opt_switch_common(int c, char *arg0, int *skip_args)
samplerate = atoi(optarg);
*skip_args += 2;
break;
- case 'c':
- call_sounddev = strdup(optarg);
- *skip_args += 2;
- break;
case 'i':
interval = atoi(optarg);
*skip_args += 2;
@@ -193,7 +217,7 @@ void opt_switch_common(int c, char *arg0, int *skip_args)
if (interval > 25)
interval = 25;
break;
- case 'l':
+ case 'b':
latency = atoi(optarg);
*skip_args += 2;
break;
@@ -201,15 +225,15 @@ void opt_switch_common(int c, char *arg0, int *skip_args)
cross_channels = 1;
*skip_args += 1;
break;
- case 'E':
+ case 'p':
do_pre_emphasis = 1;
*skip_args += 1;
break;
- case 'e':
+ case 'd':
do_de_emphasis = 1;
*skip_args += 1;
break;
- case 'G':
+ case 'g':
gain_db = atof(optarg);
if (gain_db < 0.0) {
fprintf(stderr, "Given gain is below 0. Tto reduce RX signal, use sound card's mixer (or resistor net)!\n");
@@ -222,11 +246,15 @@ void opt_switch_common(int c, char *arg0, int *skip_args)
use_mncc_sock = 1;
*skip_args += 1;
break;
- case 'p':
+ case 'c':
+ call_sounddev = strdup(optarg);
+ *skip_args += 2;
+ break;
+ case 't':
send_patterns = atoi(optarg);
*skip_args += 2;
break;
- case 'L':
+ case 'l':
loopback = atoi(optarg);
*skip_args += 2;
break;
@@ -234,12 +262,16 @@ void opt_switch_common(int c, char *arg0, int *skip_args)
rt_prio = atoi(optarg);
*skip_args += 2;
break;
- case 'W':
- write_wave = strdup(optarg);
+ case OPT_WRITE_RX_WAVE:
+ write_rx_wave = strdup(optarg);
+ *skip_args += 2;
+ break;
+ case OPT_WRITE_TX_WAVE:
+ write_tx_wave = strdup(optarg);
*skip_args += 2;
break;
- case 'R':
- read_wave = strdup(optarg);
+ case OPT_READ_RX_WAVE:
+ read_rx_wave = strdup(optarg);
*skip_args += 2;
break;
default:
diff --git a/src/common/sender.c b/src/common/sender.c
index 29b7568..4f62c7e 100644
--- a/src/common/sender.c
+++ b/src/common/sender.c
@@ -17,9 +17,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/* Uncomment this for writing TX as wave (For debug purpose) */
-//#define WAVE_WRITE_TX
-
#define CHAN sender->kanal
#include <stdio.h>
@@ -35,7 +32,7 @@ static sender_t **sender_tailp = &sender_head;
int cant_recover = 0;
/* Init transceiver instance and link to list of transceivers. */
-int sender_create(sender_t *sender, int kanal, const char *sounddev, int samplerate, int cross_channels, double rx_gain, int pre_emphasis, int de_emphasis, const char *write_wave, const char *read_wave, int loopback, double loss_volume, enum pilot_signal pilot_signal)
+int sender_create(sender_t *sender, int kanal, const char *sounddev, int samplerate, int cross_channels, double rx_gain, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, int loopback, double loss_volume, enum pilot_signal pilot_signal)
{
sender_t *master;
int rc = 0;
@@ -115,15 +112,22 @@ int sender_create(sender_t *sender, int kanal, const char *sounddev, int sampler
goto error;
}
- if (write_wave) {
- rc = wave_create_record(&sender->wave_rec, write_wave, samplerate);
+ if (write_rx_wave) {
+ rc = wave_create_record(&sender->wave_rx_rec, write_rx_wave, samplerate);
+ if (rc < 0) {
+ PDEBUG(DSENDER, DEBUG_ERROR, "Failed to create WAVE recoding instance!\n");
+ goto error;
+ }
+ }
+ if (write_tx_wave) {
+ rc = wave_create_record(&sender->wave_tx_rec, write_tx_wave, samplerate);
if (rc < 0) {
PDEBUG(DSENDER, DEBUG_ERROR, "Failed to create WAVE recoding instance!\n");
goto error;
}
}
- if (read_wave) {
- rc = wave_create_playback(&sender->wave_play, read_wave, samplerate);
+ if (read_rx_wave) {
+ rc = wave_create_playback(&sender->wave_rx_play, read_rx_wave, samplerate);
if (rc < 0) {
PDEBUG(DSENDER, DEBUG_ERROR, "Failed to create WAVE playback instance!\n");
goto error;
@@ -169,8 +173,9 @@ void sender_destroy(sender_t *sender)
sender->sound = NULL;
}
- wave_destroy_record(&sender->wave_rec);
- wave_destroy_playback(&sender->wave_play);
+ wave_destroy_record(&sender->wave_rx_rec);
+ wave_destroy_record(&sender->wave_tx_rec);
+ wave_destroy_playback(&sender->wave_rx_play);
jitter_destroy(&sender->audio);
}
@@ -239,18 +244,14 @@ cant_recover:
jitter_load(&sender->audio, samples, count);
else
sender_send(sender, samples, count);
-#ifdef WAVE_WRITE_TX
- if (sender->wave_rec.fp)
- wave_write(&sender->wave_rec, samples, count);
-#endif
+ if (sender->wave_tx_rec.fp)
+ wave_write(&sender->wave_tx_rec, samples, count);
/* internal loopback: loop back TX audio to RX */
if (sender->loopback == 1) {
-#ifndef WAVE_WRITE_TX
- if (sender->wave_rec.fp)
- wave_write(&sender->wave_rec, samples, count);
+ if (sender->wave_rx_rec.fp)
+ wave_write(&sender->wave_rx_rec, samples, count);
display_wave(sender, samples, count);
sender_receive(sender, samples, count);
-#endif
}
/* do pre emphasis towards radio, not wave_write */
if (sender->pre_emphasis)
@@ -261,16 +262,12 @@ cant_recover:
jitter_load(&slave->audio, slave_samples, count);
else
sender_send(slave, slave_samples, count);
-#ifdef WAVE_WRITE_TX
- if (sender->wave_rec.fp)
- wave_write(&slave->wave_rec, slave_samples, count);
-#endif
+ if (sender->wave_tx_rec.fp)
+ wave_write(&slave->wave_tx_rec, slave_samples, count);
/* internal loopback, if audio slave is set */
if (slave && slave->loopback == 1) {
-#ifndef WAVE_WRITE_TX
- if (slave->wave_rec.fp)
- wave_write(&slave->wave_rec, slave_samples, count);
-#endif
+ if (slave->wave_rx_rec.fp)
+ wave_write(&slave->wave_rx_rec, slave_samples, count);
display_wave(slave, slave_samples, count);
sender_receive(slave, slave_samples, count);
}
@@ -371,13 +368,11 @@ cant_recover:
/* do de emphasis from radio (then write_wave/wave_read), receive audio, process echo test */
if (sender->de_emphasis)
de_emphasis(&sender->estate, samples, count);
- if (sender->wave_play.fp)
- wave_read(&sender->wave_play, samples, count);
+ if (sender->wave_rx_play.fp)
+ wave_read(&sender->wave_rx_play, samples, count);
if (sender->loopback != 1) {
-#ifndef WAVE_WRITE_TX
- if (sender->wave_rec.fp)
- wave_write(&sender->wave_rec, samples, count);
-#endif
+ if (sender->wave_rx_rec.fp)
+ wave_write(&sender->wave_rx_rec, samples, count);
display_wave(sender, samples, count);
sender_receive(sender, samples, count);
}
@@ -389,13 +384,11 @@ cant_recover:
gain_samples(slave_samples, count, slave->rx_gain);
if (slave->de_emphasis)
de_emphasis(&slave->estate, slave_samples, count);
- if (slave->wave_play.fp)
- wave_read(&slave->wave_play, slave_samples, count);
+ if (slave->wave_rx_play.fp)
+ wave_read(&slave->wave_rx_play, slave_samples, count);
if (slave->loopback != 1) {
-#ifndef WAVE_WRITE_TX
- if (slave->wave_rec.fp)
- wave_write(&slave->wave_rec, slave_samples, count);
-#endif
+ if (slave->wave_rx_rec.fp)
+ wave_write(&slave->wave_rx_rec, slave_samples, count);
display_wave(slave, slave_samples, count);
sender_receive(slave, slave_samples, count);
}
diff --git a/src/common/sender.h b/src/common/sender.h
index 7a5d1c8..5ebbef2 100644
--- a/src/common/sender.h
+++ b/src/common/sender.h
@@ -41,8 +41,9 @@ typedef struct sender {
int loopback; /* 0 = off, 1 = internal, 2 = external */
/* record and playback */
- wave_rec_t wave_rec; /* wave recording */
- wave_play_t wave_play; /* wave playback */
+ wave_rec_t wave_rx_rec; /* wave recording (from rx) */
+ wave_rec_t wave_tx_rec; /* wave recording (from tx) */
+ wave_play_t wave_rx_play; /* wave playback (as rx) */
/* audio buffer for audio to send to transmitter (also used as loopback buffer) */
jitter_t audio;
@@ -69,7 +70,7 @@ typedef struct sender {
extern sender_t *sender_head;
extern int cant_recover;
-int sender_create(sender_t *sender, int kanal, const char *sounddev, int samplerate, int cross_channels, double rx_gain, int pre_emphasis, int de_emphasis, const char *write_wave, const char *read_wave, int loopback, double loss_volume, enum pilot_signal pilot_signal);
+int sender_create(sender_t *sender, int kanal, const char *sounddev, int samplerate, int cross_channels, double rx_gain, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, int loopback, double loss_volume, enum pilot_signal pilot_signal);
void sender_destroy(sender_t *sender);
void process_sender_audio(sender_t *sender, int *quit, int latspl);
void sender_send(sender_t *sender, int16_t *samples, int count);
diff --git a/src/nmt/main.c b/src/nmt/main.c
index ca9a1cb..2151fa2 100644
--- a/src/nmt/main.c
+++ b/src/nmt/main.c
@@ -56,12 +56,12 @@ void print_help(const char *arg0)
{
print_help_common(arg0, "-y <traffic area> | list [-I]");
/* - - */
- 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(" -P --ms-power <power level>\n");
printf(" Give power level of the mobile station 1..3. (default = '%d')\n", ms_power);
printf(" 3 = 15 W / 7 W (handheld), 2 = 1.5 W, 1 = 150 mW\n");
- printf(" -y --traffic-area <traffic area> | list\n");
+ printf(" -Y --traffic-area <traffic area> | list\n");
printf(" NOTE: MUST MATCH WITH YOUR ROAMING SETTINGS IN THE PHONE!\n");
printf(" Your phone will not connect, if country code is different!\n");
printf(" Give two digits of traffic area, the first digit defines the country\n");
@@ -69,7 +69,7 @@ void print_help(const char *arg0)
printf(" Alternatively you can give the short code for country and the cell\n");
printf(" area seperated by comma. (Example: SE,1 = Sweden, cell 1)\n");
printf(" Use 'list' to get a list of available short country code names\n");
- printf(" -a --area-number <area no> | 0\n");
+ printf(" -A --area-number <area no> | 0\n");
printf(" Give area number 1..4 or 0 for no area number. (default = '%d')\n", area_no);
printf(" -C --compandor 1 | 0\n");
printf(" Make use of the compandor to reduce noise during call. (default = '%d')\n", compandor);
@@ -91,10 +91,10 @@ static int handle_options(int argc, char **argv)
int skip_args = 0;
static struct option long_options_special[] = {
- {"channel-type", 1, 0, 't'},
+ {"channel-type", 1, 0, 'T'},
{"ms-power", 1, 0, 'P'},
- {"area-number", 1, 0, 'a'},
- {"traffic-area", 1, 0, 'y'},
+ {"traffic-area", 1, 0, 'Y'},
+ {"area-number", 1, 0, 'A'},
{"compandor", 1, 0, 'C'},
{"supervisory", 1, 0, '0'},
{"smsc-number", 1, 0, 'S'},
@@ -102,7 +102,7 @@ static int handle_options(int argc, char **argv)
{0, 0, 0, 0}
};
- set_options_common("t:P:a:y:C:0:S:I:", long_options_special);
+ set_options_common("T:P:Y:A:C:0:S:I:", long_options_special);
while (1) {
int option_index = 0, c, rc;
@@ -113,7 +113,7 @@ static int handle_options(int argc, char **argv)
break;
switch (c) {
- case 't':
+ case 'T':
if (!strcmp(optarg, "list")) {
nmt_channel_list();
exit(0);
@@ -134,15 +134,7 @@ static int handle_options(int argc, char **argv)
ms_power = 1;
skip_args += 2;
break;
- case 'a':
- area_no = optarg[0] - '0';
- if (area_no > 4) {
- fprintf(stderr, "Area number '%s' out of range, please use 1..4 or 0 for no area\n", optarg);
- exit(0);
- }
- skip_args += 2;
- break;
- case 'y':
+ case 'Y':
if (!strcmp(optarg, "list")) {
nmt_country_list();
@@ -178,6 +170,14 @@ error_ta:
}
skip_args += 2;
break;
+ case 'A':
+ area_no = optarg[0] - '0';
+ if (area_no > 4) {
+ fprintf(stderr, "Area number '%s' out of range, please use 1..4 or 0 for no area\n", optarg);
+ exit(0);
+ }
+ skip_args += 2;
+ break;
case 'C':
compandor = atoi(optarg);
skip_args += 2;
@@ -342,7 +342,7 @@ int main(int argc, char *argv[])
/* create transceiver instance */
for (i = 0; i < num_kanal; i++) {
- rc = nmt_create(kanal[i], (loopback) ? CHAN_TYPE_TEST : chan_type[i], sounddev[i], samplerate, cross_channels, rx_gain, do_pre_emphasis, do_de_emphasis, write_wave, read_wave, ms_power, nmt_digits2value(traffic_area, 2), area_no, compandor, supervisory, smsc_number, send_callerid, loopback);
+ rc = nmt_create(kanal[i], (loopback) ? CHAN_TYPE_TEST : chan_type[i], sounddev[i], samplerate, cross_channels, rx_gain, do_pre_emphasis, do_de_emphasis, write_rx_wave, write_tx_wave, read_rx_wave, ms_power, nmt_digits2value(traffic_area, 2), area_no, compandor, supervisory, smsc_number, send_callerid, loopback);
if (rc < 0) {
fprintf(stderr, "Failed to create transceiver instance. Quitting!\n");
goto fail;
diff --git a/src/nmt/nmt.c b/src/nmt/nmt.c
index ea32edc..f5e7ecc 100644
--- a/src/nmt/nmt.c
+++ b/src/nmt/nmt.c
@@ -303,7 +303,7 @@ uint8_t nmt_country_by_short_name(const char *short_name)
static void nmt_timeout(struct timer *timer);
/* Create transceiver instance and link to a list. */
-int nmt_create(int channel, enum nmt_chan_type chan_type, const char *sounddev, int samplerate, int cross_channels, double rx_gain, int pre_emphasis, int de_emphasis, const char *write_wave, const char *read_wave, uint8_t ms_power, uint8_t traffic_area, uint8_t area_no, int compandor, int supervisory, const char *smsc_number, int send_callerid, int loopback)
+int nmt_create(int channel, enum nmt_chan_type chan_type, const char *sounddev, int samplerate, int cross_channels, double rx_gain, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, uint8_t ms_power, uint8_t traffic_area, uint8_t area_no, int compandor, int supervisory, const char *smsc_number, int send_callerid, int loopback)
{
nmt_t *nmt;
int rc;
@@ -334,7 +334,7 @@ int nmt_create(int channel, enum nmt_chan_type chan_type, const char *sounddev,
PDEBUG(DNMT, DEBUG_DEBUG, "Creating 'NMT' instance for channel = %d (sample rate %d).\n", channel, samplerate);
/* init general part of transceiver */
- rc = sender_create(&nmt->sender, channel, sounddev, samplerate, cross_channels, rx_gain, pre_emphasis, de_emphasis, write_wave, read_wave, loopback, 0, PILOT_SIGNAL_NONE);
+ rc = sender_create(&nmt->sender, channel, sounddev, samplerate, cross_channels, rx_gain, pre_emphasis, de_emphasis, write_rx_wave, write_tx_wave, read_rx_wave, loopback, 0, PILOT_SIGNAL_NONE);
if (rc < 0) {
PDEBUG(DNMT, DEBUG_ERROR, "Failed to init transceiver process!\n");
goto error;
diff --git a/src/nmt/nmt.h b/src/nmt/nmt.h
index ce09118..5ed045a 100644
--- a/src/nmt/nmt.h
+++ b/src/nmt/nmt.h
@@ -140,7 +140,7 @@ const char *chan_type_long_name(enum nmt_chan_type chan_type);
double nmt_channel2freq(int channel, int uplink);
void nmt_country_list(void);
uint8_t nmt_country_by_short_name(const char *short_name);
-int nmt_create(int channel, enum nmt_chan_type chan_type, const char *sounddev, int samplerate, int cross_channels, double rx_gain, int pre_emphasis, int de_emphasis, const char *write_wave, const char *read_wave, uint8_t ms_power, uint8_t traffic_area, uint8_t area_no, int compandor, int supervisory, const char *smsc_number, int send_callerid, int loopback);
+int nmt_create(int channel, enum nmt_chan_type chan_type, const char *sounddev, int samplerate, int cross_channels, double rx_gain, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, uint8_t ms_power, uint8_t traffic_area, uint8_t area_no, int compandor, int supervisory, const char *smsc_number, int send_callerid, int loopback);
void nmt_check_channels(void);
void nmt_destroy(sender_t *sender);
void nmt_go_idle(nmt_t *nmt);