From d3385b498d1f7de49393dc08b15712d88cf04943 Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Tue, 2 Jan 2018 11:51:32 +0100 Subject: NMT: Fixes on channel coding/handling --- src/nmt/countries.c | 4 ++-- src/nmt/dsp.c | 2 +- src/nmt/frame.c | 27 ++++++++++++--------------- src/nmt/main.c | 21 ++++++++++++++++----- src/nmt/nmt.c | 28 +++++++++++++--------------- 5 files changed, 44 insertions(+), 38 deletions(-) diff --git a/src/nmt/countries.c b/src/nmt/countries.c index 957c563..886bfc4 100644 --- a/src/nmt/countries.c +++ b/src/nmt/countries.c @@ -95,7 +95,7 @@ static struct nmt_frequency frq_900_tr[] = { /* channel allocation used in France */ static struct nmt_frequency frq_900_f[] = { - { 1, 540, 430.050, 0.025, 1.0, -10.0, 0 }, + { 1, 540, 440.0125, 0.025, 1.0, -10.0, 0 }, { 0, 0, 0.0, 0.0, 0.0, 0.0, 0 } }; @@ -156,7 +156,7 @@ static struct nmt_country { { 900, 0, 5, 1,9, "CH", "Switzerland", "PTT", frq_900_scandinavia }, { 900, 0, 6, 1,15, "NL", "Netherlands", "Royal Dutch Post & Telecom", frq_900_nl }, { 900, 0, 1, 1,9, "TR", "Turkey", "Turkcell", frq_900_tr }, - { 900, 0, 0, 1,9, "F0", "France (Group 0)", "France Telecom", frq_900_f }, + { 900, 0,10, 1,9, "F0", "France (Group 0)", "France Telecom", frq_900_f }, { 900, 0, 1, 1,9, "F1", "France (Group 1)", "France Telecom", frq_900_f }, { 900, 0, 2, 1,9, "F2", "France (Group 2)", "France Telecom", frq_900_f }, { 900, 0, 3, 1,9, "F3", "France (Group 3)", "France Telecom", frq_900_f }, diff --git a/src/nmt/dsp.c b/src/nmt/dsp.c index 84b1519..e4bbbc5 100644 --- a/src/nmt/dsp.c +++ b/src/nmt/dsp.c @@ -64,7 +64,7 @@ #define F1 1200.0 #define MAX_DISPLAY 1.4 /* something above dBm0 */ #define DIALTONE_HZ 425.0 /* dial tone frequency */ -#define TX_PEAK_DIALTONE 0.5 /* dial tone peak FIXME */ +#define TX_PEAK_DIALTONE 1.0 /* dial tone peak FIXME: Not found in the specs! */ #define SUPER_DURATION 0.25 /* duration of supervisory signal measurement */ #define SUPER_LOST_COUNT 4 /* number of measures to loose supervisory signal */ #define SUPER_DETECT_COUNT 6 /* number of measures to detect supervisory signal */ diff --git a/src/nmt/frame.c b/src/nmt/frame.c index 87a5e59..3f9b8c6 100644 --- a/src/nmt/frame.c +++ b/src/nmt/frame.c @@ -481,14 +481,18 @@ static const char *param_ta_450(uint64_t value, int ndigits, enum nmt_direction return result; } -static const char *param_ta_900(uint64_t value, int __attribute__((unused)) ndigits, enum nmt_direction __attribute__((unused)) direction) +static const char *param_ta_900(uint64_t value, int ndigits, enum nmt_direction __attribute__((unused)) direction) { - static char result[32]; + static char result[64]; - if ((value & 0x80)) - sprintf(result, "%" PRIu64 " (Channel No. + 1024)", value & 0x7f); - else - sprintf(result, "%" PRIu64, value); + if ((value & 0x80)) { + nmt_value2digits(value & 0x7f, result, ndigits); + result[ndigits] = '\0'; + strcat(result, " (Channel No. + 1024)"); + } else { + nmt_value2digits(value, result, ndigits); + result[ndigits] = '\0'; + } return result; } @@ -722,16 +726,9 @@ enum nmt_mt decode_frame_mt(const uint8_t *digits, enum nmt_direction direction, return NMT_MESSAGE_21b; return NMT_MESSAGE_4; case 4: - switch((digits[13] << 8) + (digits[14] << 4) + digits[15]) { - case 0x3f3: - case 0x3f4: - case 0x3f5: - case 0x3f6: - case 0x000: + if (digits[6] || digits[7] || digits[8] || digits[9] || digits[10] || digits[11] || digits[12]) return NMT_MESSAGE_2e; - default: - return NMT_MESSAGE_1b; - } + return NMT_MESSAGE_1b; case 5: if (digits[6] == 15) return NMT_MESSAGE_21c; diff --git a/src/nmt/main.c b/src/nmt/main.c index 5155c1c..ad8eb56 100644 --- a/src/nmt/main.c +++ b/src/nmt/main.c @@ -71,6 +71,7 @@ void print_help(const char *arg0) } else { printf(" NMT-900: 3/2 = 6 W, 1 = 1.5 W, 0 = 150 mW\n"); } + printf(" Note: Power level < 2 causes mobile to search longer for a cell.\n"); printf(" -Y --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"); @@ -314,9 +315,16 @@ int main(int argc, char *argv[]) num_audiodev = num_kanal; /* set channel types for more than 1 channel */ if (num_kanal > 1 && num_chan_type == 0) { - chan_type[0] = CHAN_TYPE_CC; - for (i = 1; i < num_kanal; i++) - chan_type[i] = CHAN_TYPE_TC; + if (loopback) + chan_type[0] = CHAN_TYPE_TEST; + else + chan_type[0] = CHAN_TYPE_CC; + for (i = 1; i < num_kanal; i++) { + if (loopback) + chan_type[i] = CHAN_TYPE_TEST; + else + chan_type[i] = CHAN_TYPE_TC; + } num_chan_type = num_kanal; } if (num_supervisory == 0) { @@ -332,8 +340,11 @@ 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_chan_type == 0) + if (num_kanal == 1 && num_chan_type == 0) { num_chan_type = 1; /* use default */ + if (loopback) + chan_type[0] = CHAN_TYPE_TEST; + } if (num_kanal != num_chan_type) { fprintf(stderr, "You need to specify as many channel types as you have channels.\n"); exit(0); @@ -404,7 +415,7 @@ int main(int argc, char *argv[]) /* create transceiver instance */ for (i = 0; i < num_kanal; i++) { - rc = nmt_create(nmt_system, country, kanal[i], (loopback) ? CHAN_TYPE_TEST : chan_type[i], audiodev[i], use_sdr, samplerate, rx_gain, do_pre_emphasis, do_de_emphasis, write_rx_wave, write_tx_wave, read_rx_wave, read_tx_wave, ms_power, nmt_digits2value(traffic_area, 2), area_no, compandor, supervisory[i], smsc_number, send_callerid, loopback); + rc = nmt_create(nmt_system, country, kanal[i], chan_type[i], audiodev[i], use_sdr, samplerate, rx_gain, do_pre_emphasis, do_de_emphasis, write_rx_wave, write_tx_wave, read_rx_wave, read_tx_wave, ms_power, nmt_digits2value(traffic_area, 2), area_no, compandor, supervisory[i], 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 ba36fa4..ef0028b 100644 --- a/src/nmt/nmt.c +++ b/src/nmt/nmt.c @@ -389,37 +389,35 @@ void nmt_check_channels(int __attribute__((unused)) nmt_system) } } if ((cca || ccb) && !tc) { - if (note) - PDEBUG(DNMT, DEBUG_NOTICE, "\n"); - PDEBUG(DNMT, DEBUG_NOTICE, "*** Selected channel(s) can be used for calling only.\n"); - PDEBUG(DNMT, DEBUG_NOTICE, "*** No call is possible on this channel.\n"); + PDEBUG(DNMT, DEBUG_NOTICE, "\n"); + PDEBUG(DNMT, DEBUG_NOTICE, "*** Selected channel(s) can be used for control only.\n"); + PDEBUG(DNMT, DEBUG_NOTICE, "*** No call is possible.\n"); PDEBUG(DNMT, DEBUG_NOTICE, "*** Use at least one 'TC'!\n"); note = 1; } if (tc && !(cca || ccb)) { - if (note) - PDEBUG(DNMT, DEBUG_NOTICE, "\n"); + PDEBUG(DNMT, DEBUG_NOTICE, "\n"); PDEBUG(DNMT, DEBUG_NOTICE, "*** Selected channel(s) can be used for traffic only.\n"); - PDEBUG(DNMT, DEBUG_NOTICE, "*** No call to the mobile phone is possible on this channel.\n"); + PDEBUG(DNMT, DEBUG_NOTICE, "*** No call to the mobile phone is possible.\n"); PDEBUG(DNMT, DEBUG_NOTICE, "*** Use one 'CC'!\n"); note = 1; } if (cca && !ccb) { - if (note) - PDEBUG(DNMT, DEBUG_NOTICE, "\n"); - PDEBUG(DNMT, DEBUG_NOTICE, "*** Selected channel(s) can be used for calling of MS type A only.\n"); - PDEBUG(DNMT, DEBUG_NOTICE, "*** No call to the MS type B phone is possible on this channel.\n"); + PDEBUG(DNMT, DEBUG_NOTICE, "\n"); + PDEBUG(DNMT, DEBUG_NOTICE, "*** Selected channel(s) can be used for control of MS type A only.\n"); + PDEBUG(DNMT, DEBUG_NOTICE, "*** No call to the MS type B phone is possible.\n"); PDEBUG(DNMT, DEBUG_NOTICE, "*** Use one 'CC' instead!\n"); note = 1; } if (!cca && ccb) { - if (note) - PDEBUG(DNMT, DEBUG_NOTICE, "\n"); - PDEBUG(DNMT, DEBUG_NOTICE, "*** Selected channel(s) can be used for calling of MS type B only.\n"); - PDEBUG(DNMT, DEBUG_NOTICE, "*** No call to the MS type A phone is possible on this channel.\n"); + PDEBUG(DNMT, DEBUG_NOTICE, "\n"); + PDEBUG(DNMT, DEBUG_NOTICE, "*** Selected channel(s) can be used for control of MS type B only.\n"); + PDEBUG(DNMT, DEBUG_NOTICE, "*** No call to the MS type A phone is possible.\n"); PDEBUG(DNMT, DEBUG_NOTICE, "*** Use one 'CC' instead!\n"); note = 1; } + if (note) + PDEBUG(DNMT, DEBUG_NOTICE, "\n"); } /* Destroy transceiver instance and unlink from list. */ -- cgit v1.2.3