NMT: Fixes on channel coding/handling

This commit is contained in:
Andreas Eversberg
2018-01-02 11:51:32 +01:00
parent 72bdd3376f
commit d3385b498d
5 changed files with 44 additions and 38 deletions

View File

@@ -95,7 +95,7 @@ static struct nmt_frequency frq_900_tr[] = {
/* channel allocation used in France */ /* channel allocation used in France */
static struct nmt_frequency frq_900_f[] = { 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 } { 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, 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, 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, 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, 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, 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 }, { 900, 0, 3, 1,9, "F3", "France (Group 3)", "France Telecom", frq_900_f },

View File

@@ -64,7 +64,7 @@
#define F1 1200.0 #define F1 1200.0
#define MAX_DISPLAY 1.4 /* something above dBm0 */ #define MAX_DISPLAY 1.4 /* something above dBm0 */
#define DIALTONE_HZ 425.0 /* dial tone frequency */ #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_DURATION 0.25 /* duration of supervisory signal measurement */
#define SUPER_LOST_COUNT 4 /* number of measures to loose supervisory signal */ #define SUPER_LOST_COUNT 4 /* number of measures to loose supervisory signal */
#define SUPER_DETECT_COUNT 6 /* number of measures to detect supervisory signal */ #define SUPER_DETECT_COUNT 6 /* number of measures to detect supervisory signal */

View File

@@ -481,14 +481,18 @@ static const char *param_ta_450(uint64_t value, int ndigits, enum nmt_direction
return result; 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)) if ((value & 0x80)) {
sprintf(result, "%" PRIu64 " (Channel No. + 1024)", value & 0x7f); nmt_value2digits(value & 0x7f, result, ndigits);
else result[ndigits] = '\0';
sprintf(result, "%" PRIu64, value); strcat(result, " (Channel No. + 1024)");
} else {
nmt_value2digits(value, result, ndigits);
result[ndigits] = '\0';
}
return result; 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_21b;
return NMT_MESSAGE_4; return NMT_MESSAGE_4;
case 4: case 4:
switch((digits[13] << 8) + (digits[14] << 4) + digits[15]) { if (digits[6] || digits[7] || digits[8] || digits[9] || digits[10] || digits[11] || digits[12])
case 0x3f3:
case 0x3f4:
case 0x3f5:
case 0x3f6:
case 0x000:
return NMT_MESSAGE_2e; return NMT_MESSAGE_2e;
default:
return NMT_MESSAGE_1b; return NMT_MESSAGE_1b;
}
case 5: case 5:
if (digits[6] == 15) if (digits[6] == 15)
return NMT_MESSAGE_21c; return NMT_MESSAGE_21c;

View File

@@ -71,6 +71,7 @@ void print_help(const char *arg0)
} else { } else {
printf(" NMT-900: 3/2 = 6 W, 1 = 1.5 W, 0 = 150 mW\n"); 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 <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(" NOTE: MUST MATCH WITH YOUR ROAMING SETTINGS IN THE PHONE!\n");
printf(" Your phone will not connect, if country code is different!\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; num_audiodev = num_kanal;
/* set channel types for more than 1 channel */ /* set channel types for more than 1 channel */
if (num_kanal > 1 && num_chan_type == 0) { if (num_kanal > 1 && num_chan_type == 0) {
if (loopback)
chan_type[0] = CHAN_TYPE_TEST;
else
chan_type[0] = CHAN_TYPE_CC; chan_type[0] = CHAN_TYPE_CC;
for (i = 1; i < num_kanal; i++) for (i = 1; i < num_kanal; i++) {
if (loopback)
chan_type[i] = CHAN_TYPE_TEST;
else
chan_type[i] = CHAN_TYPE_TC; chan_type[i] = CHAN_TYPE_TC;
}
num_chan_type = num_kanal; num_chan_type = num_kanal;
} }
if (num_supervisory == 0) { 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"); fprintf(stderr, "You need to specify as many sound devices as you have channels.\n");
exit(0); exit(0);
} }
if (num_kanal == 1 && num_chan_type == 0) if (num_kanal == 1 && num_chan_type == 0) {
num_chan_type = 1; /* use default */ num_chan_type = 1; /* use default */
if (loopback)
chan_type[0] = CHAN_TYPE_TEST;
}
if (num_kanal != num_chan_type) { if (num_kanal != num_chan_type) {
fprintf(stderr, "You need to specify as many channel types as you have channels.\n"); fprintf(stderr, "You need to specify as many channel types as you have channels.\n");
exit(0); exit(0);
@@ -404,7 +415,7 @@ int main(int argc, char *argv[])
/* create transceiver instance */ /* create transceiver instance */
for (i = 0; i < num_kanal; i++) { 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) { if (rc < 0) {
fprintf(stderr, "Failed to create transceiver instance. Quitting!\n"); fprintf(stderr, "Failed to create transceiver instance. Quitting!\n");
goto fail; goto fail;

View File

@@ -389,37 +389,35 @@ void nmt_check_channels(int __attribute__((unused)) nmt_system)
} }
} }
if ((cca || ccb) && !tc) { if ((cca || ccb) && !tc) {
if (note)
PDEBUG(DNMT, DEBUG_NOTICE, "\n"); PDEBUG(DNMT, DEBUG_NOTICE, "\n");
PDEBUG(DNMT, DEBUG_NOTICE, "*** Selected channel(s) can be used for calling only.\n"); PDEBUG(DNMT, DEBUG_NOTICE, "*** Selected channel(s) can be used for control only.\n");
PDEBUG(DNMT, DEBUG_NOTICE, "*** No call is possible on this channel.\n"); PDEBUG(DNMT, DEBUG_NOTICE, "*** No call is possible.\n");
PDEBUG(DNMT, DEBUG_NOTICE, "*** Use at least one 'TC'!\n"); PDEBUG(DNMT, DEBUG_NOTICE, "*** Use at least one 'TC'!\n");
note = 1; note = 1;
} }
if (tc && !(cca || ccb)) { 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, "*** 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"); PDEBUG(DNMT, DEBUG_NOTICE, "*** Use one 'CC'!\n");
note = 1; note = 1;
} }
if (cca && !ccb) { if (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 calling of MS type A only.\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 on this channel.\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"); PDEBUG(DNMT, DEBUG_NOTICE, "*** Use one 'CC' instead!\n");
note = 1; note = 1;
} }
if (!cca && ccb) { if (!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 calling of MS type B only.\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 on this channel.\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"); PDEBUG(DNMT, DEBUG_NOTICE, "*** Use one 'CC' instead!\n");
note = 1; note = 1;
} }
if (note)
PDEBUG(DNMT, DEBUG_NOTICE, "\n");
} }
/* Destroy transceiver instance and unlink from list. */ /* Destroy transceiver instance and unlink from list. */