diff --git a/src/nmt/main.c b/src/nmt/main.c index 8926885..6de4c97 100644 --- a/src/nmt/main.c +++ b/src/nmt/main.c @@ -356,6 +356,8 @@ int main(int argc, char *argv[]) } } + nmt_check_channels(); + signal(SIGINT,sighandler); signal(SIGHUP,sighandler); signal(SIGTERM,sighandler); diff --git a/src/nmt/nmt.c b/src/nmt/nmt.c index c8bcabb..03e4342 100644 --- a/src/nmt/nmt.c +++ b/src/nmt/nmt.c @@ -305,16 +305,6 @@ int nmt_create(int channel, enum nmt_chan_type chan_type, const char *sounddev, PDEBUG(DNMT, DEBUG_NOTICE, "Extended channel numbers (181..200) have been specified, but never been supported for sure. There is no phone to test with, so don't use it!\n"); } - if (chan_type == CHAN_TYPE_CC) { - PDEBUG(DNMT, DEBUG_NOTICE, "*** Selected channel can be used for calling only.\n"); - PDEBUG(DNMT, DEBUG_NOTICE, "*** No call from the mobile phone is possible on this channel.\n"); - PDEBUG(DNMT, DEBUG_NOTICE, "*** Use combined 'CC/TC' instead!\n"); - } - if (chan_type == CHAN_TYPE_TC) { - PDEBUG(DNMT, DEBUG_NOTICE, "*** Selected channel 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, "*** Use combined 'CC/TC' instead!\n"); - } if (chan_type == CHAN_TYPE_TEST && !loopback) { PDEBUG(DNMT, DEBUG_NOTICE, "*** Selected channel can be used for nothing but testing signal decoder.\n"); } @@ -376,6 +366,35 @@ error: return rc; } +void nmt_check_channels(void) +{ + sender_t *sender; + nmt_t *nmt; + int cc = 0, tc = 0; + + for (sender = sender_head; sender; sender = sender->next) { + nmt = (nmt_t *) sender; + if (nmt->sysinfo.chan_type == CHAN_TYPE_CC) + cc = 1; + if (nmt->sysinfo.chan_type == CHAN_TYPE_TC) + tc = 1; + if (nmt->sysinfo.chan_type == CHAN_TYPE_CC_TC) { + cc = 1; + tc = 1; + } + } + if (cc && !tc) { + PDEBUG(DNMT, DEBUG_NOTICE, "*** Selected channel(s) can be used for calling only.\n"); + PDEBUG(DNMT, DEBUG_NOTICE, "*** No call from the mobile phone is possible on this channel.\n"); + PDEBUG(DNMT, DEBUG_NOTICE, "*** Use combined 'CC/TC' instead!\n"); + } + if (tc && !cc) { + 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, "*** Use combined 'CC/TC' instead!\n"); + } +} + /* Destroy transceiver instance and unlink from list. */ void nmt_destroy(sender_t *sender) { diff --git a/src/nmt/nmt.h b/src/nmt/nmt.h index 16e2b97..1c01a3c 100644 --- a/src/nmt/nmt.h +++ b/src/nmt/nmt.h @@ -158,6 +158,7 @@ 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); +void nmt_check_channels(void); void nmt_destroy(sender_t *sender); void nmt_receive_frame(nmt_t *nmt, const char *bits, double quality, double level, double frames_elapsed); const char *nmt_get_frame(nmt_t *nmt);