diff options
author | Andreas Eversberg <jolly@eversberg.eu> | 2016-11-27 06:47:06 +0100 |
---|---|---|
committer | Andreas Eversberg <jolly@eversberg.eu> | 2016-11-27 22:06:47 +0100 |
commit | b1c452cf1218241ce4464c3b280cbe8f72f33eb7 (patch) | |
tree | 9ba2b9d504f52516a06c2532b34d12965788debc /src/nmt | |
parent | f911717aa47dd3528e99aa76de1d98c543eaa2cb (diff) |
Changed command line options
* All lower case options define common options
* All upper case options define network specific options
Diffstat (limited to 'src/nmt')
-rw-r--r-- | src/nmt/main.c | 36 | ||||
-rw-r--r-- | src/nmt/nmt.c | 4 | ||||
-rw-r--r-- | src/nmt/nmt.h | 2 |
3 files changed, 21 insertions, 21 deletions
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); |