Allow giving alphanumeric channels (Prepare for IMTS)

pull/1/head
Andreas Eversberg 4 years ago
parent b266b0f743
commit d6579c1244
  1. 40
      src/amps/amps.c
  2. 2
      src/amps/amps.h
  3. 6
      src/amps/amps_tacs_main.c
  4. 16
      src/anetz/anetz.c
  5. 2
      src/anetz/anetz.h
  6. 2
      src/anetz/main.c
  7. 32
      src/bnetz/bnetz.c
  8. 2
      src/bnetz/bnetz.h
  9. 2
      src/bnetz/main.c
  10. 56
      src/cnetz/cnetz.c
  11. 2
      src/cnetz/cnetz.h
  12. 6
      src/cnetz/main.c
  13. 16
      src/jolly/jolly.c
  14. 2
      src/jolly/jolly.h
  15. 2
      src/jolly/main.c
  16. 8
      src/libdebug/debug.c
  17. 4
      src/libdebug/debug.h
  18. 14
      src/libdisplay/display.h
  19. 4
      src/libdisplay/display_measurements.c
  20. 4
      src/libdisplay/display_spectrum.c
  21. 6
      src/libdisplay/display_status.c
  22. 4
      src/libdisplay/display_wave.c
  23. 4
      src/libmobile/main_mobile.c
  24. 2
      src/libmobile/main_mobile.h
  25. 14
      src/libmobile/sender.c
  26. 4
      src/libmobile/sender.h
  27. 6
      src/libsquelch/squelch.c
  28. 4
      src/libsquelch/squelch.h
  29. 8
      src/nmt/main.c
  30. 50
      src/nmt/nmt.c
  31. 2
      src/nmt/nmt.h
  32. 2
      src/r2000/main.c
  33. 24
      src/r2000/r2000.c
  34. 2
      src/r2000/r2000.h

@ -443,7 +443,7 @@ static amps_t *search_channel(int channel)
amps_t *amps;
for (sender = sender_head; sender; sender = sender->next) {
if (sender->kanal != channel)
if (atoi(sender->kanal) != channel)
continue;
amps = (amps_t *) sender;
if (amps->state == STATE_IDLE)
@ -494,7 +494,7 @@ static amps_t *search_pc(void)
}
/* Create transceiver instance and link to a list. */
int amps_create(int channel, enum amps_chan_type chan_type, const char *audiodev, int use_sdr, int samplerate, double rx_gain, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, const char *read_tx_wave, amps_si *si, uint16_t sid, uint8_t sat, int polarity, int tolerant, int loopback)
int amps_create(const char *kanal, enum amps_chan_type chan_type, const char *audiodev, int use_sdr, int samplerate, double rx_gain, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, const char *read_tx_wave, amps_si *si, uint16_t sid, uint8_t sat, int polarity, int tolerant, int loopback)
{
sender_t *sender;
amps_t *amps;
@ -503,8 +503,8 @@ int amps_create(int channel, enum amps_chan_type chan_type, const char *audiodev
const char *band;
/* check for channel number */
if (amps_channel2freq(channel, 0) == 0) {
PDEBUG(DAMPS, DEBUG_ERROR, "Channel number %d invalid.\n", channel);
if (amps_channel2freq(atoi(kanal), 0) == 0) {
PDEBUG(DAMPS, DEBUG_ERROR, "Channel number %s invalid.\n", kanal);
return -EINVAL;
}
@ -526,23 +526,23 @@ int amps_create(int channel, enum amps_chan_type chan_type, const char *audiodev
}
/* check if channel type matches channel number */
ct = amps_channel2type(channel);
ct = amps_channel2type(atoi(kanal));
if (ct == CHAN_TYPE_CC && chan_type != CHAN_TYPE_PC && chan_type != CHAN_TYPE_CC_PC && chan_type != CHAN_TYPE_CC_PC_VC) {
PDEBUG(DAMPS, DEBUG_NOTICE, "Channel number %d belongs to a control channel, but your channel type '%s' requires to be on a voice channel number. Some phone may reject this, but all my phones don't.\n", channel, chan_type_long_name(chan_type));
PDEBUG(DAMPS, DEBUG_NOTICE, "Channel number %s belongs to a control channel, but your channel type '%s' requires to be on a voice channel number. Some phone may reject this, but all my phones don't.\n", kanal, chan_type_long_name(chan_type));
}
if (ct == CHAN_TYPE_VC && chan_type != CHAN_TYPE_VC) {
PDEBUG(DAMPS, DEBUG_ERROR, "Channel number %d belongs to a voice channel, but your channel type '%s' requires to be on a control channel number. Please use correct channel.\n", channel, chan_type_long_name(chan_type));
PDEBUG(DAMPS, DEBUG_ERROR, "Channel number %s belongs to a voice channel, but your channel type '%s' requires to be on a control channel number. Please use correct channel.\n", kanal, chan_type_long_name(chan_type));
return -EINVAL;
}
/* check if sid machtes channel band */
band = amps_channel2band(channel);
band = amps_channel2band(atoi(kanal));
if (band[0] == 'A' && (sid & 1) == 0 && chan_type != CHAN_TYPE_VC) {
PDEBUG(DAMPS, DEBUG_ERROR, "Channel number %d belongs to system A, but your %s %d is even and belongs to system B. Please give odd %s.\n", channel, (!tacs) ? "SID" : "AID", sid, (!tacs) ? "SID" : "AID");
PDEBUG(DAMPS, DEBUG_ERROR, "Channel number %s belongs to system A, but your %s %d is even and belongs to system B. Please give odd %s.\n", kanal, (!tacs) ? "SID" : "AID", sid, (!tacs) ? "SID" : "AID");
return -EINVAL;
}
if (band[0] == 'B' && (sid & 1) == 1 && chan_type != CHAN_TYPE_VC) {
PDEBUG(DAMPS, DEBUG_ERROR, "Channel number %d belongs to system B, but your %s %d is odd and belongs to system A. Please give even %s.\n", channel, (!tacs) ? "SID" : "AID", sid, (!tacs) ? "SID" : "AID");
PDEBUG(DAMPS, DEBUG_ERROR, "Channel number %s belongs to system B, but your %s %d is odd and belongs to system A. Please give even %s.\n", kanal, (!tacs) ? "SID" : "AID", sid, (!tacs) ? "SID" : "AID");
return -EINVAL;
}
@ -552,8 +552,8 @@ int amps_create(int channel, enum amps_chan_type chan_type, const char *audiodev
}
/* check if we selected a voice channel that i outside 20 MHz band */
if (chan_type == CHAN_TYPE_VC && channel > 666) {
PDEBUG(DAMPS, DEBUG_NOTICE, "You selected '%s' on channel #%d. Older phones do not support channels above #666.\n", chan_type_long_name(chan_type), channel);
if (chan_type == CHAN_TYPE_VC && atoi(kanal) > 666) {
PDEBUG(DAMPS, DEBUG_NOTICE, "You selected '%s' on channel #%s. Older phones do not support channels above #666.\n", chan_type_long_name(chan_type), kanal);
}
amps = calloc(1, sizeof(amps_t));
@ -562,10 +562,10 @@ int amps_create(int channel, enum amps_chan_type chan_type, const char *audiodev
return -ENOMEM;
}
PDEBUG(DAMPS, DEBUG_DEBUG, "Creating 'AMPS' instance for channel = %d of band %s (sample rate %d).\n", channel, band, samplerate);
PDEBUG(DAMPS, DEBUG_DEBUG, "Creating 'AMPS' instance for channel = %s of band %s (sample rate %d).\n", kanal, band, samplerate);
/* init general part of transceiver */
rc = sender_create(&amps->sender, channel, amps_channel2freq(channel, 0), amps_channel2freq(channel, 1), audiodev, use_sdr, samplerate, rx_gain, 0, 0, write_rx_wave, write_tx_wave, read_rx_wave, read_tx_wave, loopback, PAGING_SIGNAL_NONE);
rc = sender_create(&amps->sender, kanal, amps_channel2freq(atoi(kanal), 0), amps_channel2freq(atoi(kanal), 1), audiodev, use_sdr, samplerate, rx_gain, 0, 0, write_rx_wave, write_tx_wave, read_rx_wave, read_tx_wave, loopback, PAGING_SIGNAL_NONE);
if (rc < 0) {
PDEBUG(DAMPS, DEBUG_ERROR, "Failed to init transceiver process!\n");
goto error;
@ -603,7 +603,7 @@ int amps_create(int channel, enum amps_chan_type chan_type, const char *audiodev
// amps_new_state(amps, STATE_BUSY);
#endif
PDEBUG(DAMPS, DEBUG_NOTICE, "Created channel #%d (System %s) of type '%s' = %s\n", channel, band, chan_type_short_name(chan_type), chan_type_long_name(chan_type));
PDEBUG(DAMPS, DEBUG_NOTICE, "Created channel #%s (System %s) of type '%s' = %s\n", kanal, band, chan_type_short_name(chan_type), chan_type_long_name(chan_type));
return 0;
@ -619,7 +619,7 @@ void amps_destroy(sender_t *sender)
amps_t *amps = (amps_t *) sender;
transaction_t *trans;
PDEBUG(DAMPS, DEBUG_DEBUG, "Destroying 'AMPS' instance for channel = %d.\n", sender->kanal);
PDEBUG(DAMPS, DEBUG_DEBUG, "Destroying 'AMPS' instance for channel = %s.\n", sender->kanal);
while ((trans = amps->trans_list)) {
const char *number = amps_min2number(trans->min1, trans->min2);
@ -862,7 +862,7 @@ reject:
return;
}
if (!trans) {
trans = create_transaction(amps, TRANS_CALL_MO_ASSIGN, min1, min2, 0, 0, 0, vc->sender.kanal);
trans = create_transaction(amps, TRANS_CALL_MO_ASSIGN, min1, min2, 0, 0, 0, atoi(vc->sender.kanal));
strncpy(trans->dialing, dialing, sizeof(trans->dialing) - 1);
if (!trans) {
PDEBUG(DAMPS, DEBUG_ERROR, "Failed to create transaction\n");
@ -870,7 +870,7 @@ reject:
}
} else {
trans_new_state(trans, TRANS_CALL_MT_ASSIGN);
trans->chan = vc->sender.kanal;
trans->chan = atoi(vc->sender.kanal);
}
/* if we support DTX and also the phone does, we set DTX state of transaction */
if (amps->si.word2.dtx) {
@ -1129,9 +1129,9 @@ static amps_t *assign_voice_channel(transaction_t *trans)
}
if (vc == amps)
PDEBUG(DAMPS, DEBUG_INFO, "Staying on combined control + voice channel %d\n", vc->sender.kanal);
PDEBUG(DAMPS, DEBUG_INFO, "Staying on combined control + voice channel %s\n", vc->sender.kanal);
else
PDEBUG(DAMPS, DEBUG_INFO, "Moving to voice channel %d\n", vc->sender.kanal);
PDEBUG(DAMPS, DEBUG_INFO, "Moving to voice channel %s\n", vc->sender.kanal);
/* switch channel... */
timer_start(&trans->timer, SAT_TO1);

@ -173,7 +173,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 *audiodev, int use_sdr, int samplerate, double rx_gain, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, const char *read_tx_wave, amps_si *si, uint16_t sid, uint8_t sat, int polarity, int tolerant, int loopback);
int amps_create(const char *kanal, enum amps_chan_type chan_type, const char *audiodev, int use_sdr, int samplerate, double rx_gain, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, const char *read_tx_wave, amps_si *si, uint16_t sid, uint8_t sat, int polarity, int tolerant, int loopback);
void amps_destroy(sender_t *sender);
void amps_go_idle(amps_t *amps);
void amps_rx_signaling_tone(amps_t *amps, int tone, double quality);

@ -306,7 +306,7 @@ int main_amps_tacs(int argc, char *argv[])
// NOTE: Variable 'i' from above is used here:
/* default SID/AID, depending on system */
if (!sid) {
if (amps_channel2band(kanal[i])[0] == 'A') {
if (amps_channel2band(atoi(kanal[i]))[0] == 'A') {
if (!tacs)
sid = 1; /* Chicago */
else
@ -387,9 +387,9 @@ int main_amps_tacs(int argc, char *argv[])
goto fail;
}
if (!tacs)
printf("Base station on channel %d ready (%s), please tune transmitter to %.3f MHz and receiver to %.3f MHz. (%.3f MHz offset)\n", kanal[i], chan_type_long_name(chan_type[i]), amps_channel2freq(kanal[i], 0) / 1e6, amps_channel2freq(kanal[i], 1) / 1e6, amps_channel2freq(kanal[i], 2) / 1e6);
printf("Base station on channel %s ready (%s), please tune transmitter to %.3f MHz and receiver to %.3f MHz. (%.3f MHz offset)\n", kanal[i], chan_type_long_name(chan_type[i]), amps_channel2freq(atoi(kanal[i]), 0) / 1e6, amps_channel2freq(atoi(kanal[i]), 1) / 1e6, amps_channel2freq(atoi(kanal[i]), 2) / 1e6);
else
printf("Base station on channel %d ready (%s), please tune transmitter to %.4f MHz and receiver to %.4f MHz. (%.3f MHz offset)\n", kanal[i], chan_type_long_name(chan_type[i]), amps_channel2freq(kanal[i], 0) / 1e6, amps_channel2freq(kanal[i], 1) / 1e6, amps_channel2freq(kanal[i], 2) / 1e6);
printf("Base station on channel %s ready (%s), please tune transmitter to %.4f MHz and receiver to %.4f MHz. (%.3f MHz offset)\n", kanal[i], chan_type_long_name(chan_type[i]), amps_channel2freq(atoi(kanal[i]), 0) / 1e6, amps_channel2freq(atoi(kanal[i]), 1) / 1e6, amps_channel2freq(atoi(kanal[i]), 2) / 1e6);
}
main_mobile(&quit, latency, interval, NULL, station_id, 10);

@ -186,13 +186,13 @@ 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 *audiodev, int use_sdr, int samplerate, double rx_gain, double page_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, const char *read_tx_wave, int loopback, double squelch_db, const char *operator)
int anetz_create(const char *kanal, const char *audiodev, int use_sdr, int samplerate, double rx_gain, double page_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, const char *read_tx_wave, int loopback, double squelch_db, const char *operator)
{
anetz_t *anetz;
int rc;
if (kanal < 30 || kanal > 63) {
PDEBUG(DANETZ, DEBUG_ERROR, "Channel ('Kanal') number %d invalid.\n", kanal);
if (atoi(kanal) < 30 || atoi(kanal) > 63) {
PDEBUG(DANETZ, DEBUG_ERROR, "Channel ('Kanal') number %s invalid.\n", kanal);
return -EINVAL;
}
@ -204,10 +204,10 @@ int anetz_create(int kanal, const char *audiodev, int use_sdr, int samplerate, d
anetz->operator = operator;
PDEBUG(DANETZ, DEBUG_DEBUG, "Creating 'A-Netz' instance for 'Kanal' = %d (sample rate %d).\n", kanal, samplerate);
PDEBUG(DANETZ, DEBUG_DEBUG, "Creating 'A-Netz' instance for 'Kanal' = %s (sample rate %d).\n", kanal, samplerate);
/* init general part of transceiver */
rc = sender_create(&anetz->sender, kanal, anetz_kanal2freq(kanal, 0), anetz_kanal2freq(kanal, 1), audiodev, use_sdr, samplerate, rx_gain, pre_emphasis, de_emphasis, write_rx_wave, write_tx_wave, read_rx_wave, read_tx_wave, loopback, PAGING_SIGNAL_NONE);
rc = sender_create(&anetz->sender, kanal, anetz_kanal2freq(atoi(kanal), 0), anetz_kanal2freq(atoi(kanal), 1), audiodev, use_sdr, samplerate, rx_gain, pre_emphasis, de_emphasis, write_rx_wave, write_tx_wave, read_rx_wave, read_tx_wave, loopback, PAGING_SIGNAL_NONE);
if (rc < 0) {
PDEBUG(DANETZ, DEBUG_ERROR, "Failed to init 'Sender' processing!\n");
goto error;
@ -225,7 +225,7 @@ int anetz_create(int kanal, const char *audiodev, int use_sdr, int samplerate, d
/* go into idle state */
anetz_go_idle(anetz);
PDEBUG(DANETZ, DEBUG_NOTICE, "Created 'Kanal' #%d\n", kanal);
PDEBUG(DANETZ, DEBUG_NOTICE, "Created 'Kanal' #%s\n", kanal);
return 0;
@ -240,7 +240,7 @@ void anetz_destroy(sender_t *sender)
{
anetz_t *anetz = (anetz_t *) sender;
PDEBUG(DANETZ, DEBUG_DEBUG, "Destroying 'A-Netz' instance for 'Kanal' = %d.\n", sender->kanal);
PDEBUG(DANETZ, DEBUG_DEBUG, "Destroying 'A-Netz' instance for 'Kanal' = %s.\n", sender->kanal);
timer_exit(&anetz->timer);
dsp_cleanup_sender(anetz);
@ -253,7 +253,7 @@ static void anetz_go_idle(anetz_t *anetz)
{
timer_stop(&anetz->timer);
PDEBUG(DANETZ, DEBUG_INFO, "Entering IDLE state on channel %d, sending 2280 Hz tone.\n", anetz->sender.kanal);
PDEBUG(DANETZ, DEBUG_INFO, "Entering IDLE state on channel %s, sending 2280 Hz tone.\n", anetz->sender.kanal);
anetz->station_id[0] = '\0'; /* remove station ID before state change, so status is shown correctly */
anetz_new_state(anetz, ANETZ_FREI);
/* also reset detector, so if there is a new call it is answered */

@ -54,7 +54,7 @@ typedef struct anetz {
double anetz_kanal2freq(int kanal, int unterband);
int anetz_init(void);
int anetz_create(int kanal, const char *audiodev, int use_sdr, int samplerate, double rx_gain, double page_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, const char *read_tx_wave, int loopback, double squelch_db, const char *operator);
int anetz_create(const char *kanal, const char *audiodev, int use_sdr, int samplerate, double rx_gain, double page_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, const char *read_tx_wave, int loopback, double squelch_db, const char *operator);
void anetz_destroy(sender_t *sender);
void anetz_loss_indication(anetz_t *anetz, double loss_time);
void anetz_receive_tone(anetz_t *anetz, int bit);

@ -185,7 +185,7 @@ int main(int argc, char *argv[])
fprintf(stderr, "Failed to create \"Sender\" instance. Quitting!\n");
goto fail;
}
printf("Base station on channel %d ready, please tune transmitter to %.3f MHz and receiver to %.3f MHz. (%.3f MHz offset)\n", kanal[i], anetz_kanal2freq(kanal[i], 0) / 1e6, anetz_kanal2freq(kanal[i], 1) / 1e6, anetz_kanal2freq(kanal[i], 2) / 1e6);
printf("Base station on channel %s ready, please tune transmitter to %.3f MHz and receiver to %.3f MHz. (%.3f MHz offset)\n", kanal[i], anetz_kanal2freq(atoi(kanal[i]), 0) / 1e6, anetz_kanal2freq(atoi(kanal[i]), 1) / 1e6, anetz_kanal2freq(atoi(kanal[i]), 2) / 1e6);
}
main_mobile(&quit, latency, interval, NULL, station_id, 5);

@ -157,27 +157,27 @@ 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 *audiodev, int use_sdr, int samplerate, 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, const char *read_tx_wave, int loopback, double squelch_db, const char *paging, int metering)
int bnetz_create(const char *kanal, const char *audiodev, int use_sdr, int samplerate, 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, const char *read_tx_wave, int loopback, double squelch_db, const char *paging, int metering)
{
bnetz_t *bnetz;
enum paging_signal paging_signal = PAGING_SIGNAL_NONE;
char paging_file[255] = "", paging_on[255] = "", paging_off[255] = "";
int rc;
if (!(kanal >= 1 && kanal <= 39) && !(kanal >= 50 && kanal <= 86)) {
PDEBUG(DBNETZ, DEBUG_ERROR, "Channel ('Kanal') number %d invalid.\n", kanal);
if (!(atoi(kanal) >= 1 && atoi(kanal) <= 39) && !(atoi(kanal) >= 50 && atoi(kanal) <= 86)) {
PDEBUG(DBNETZ, DEBUG_ERROR, "Channel ('Kanal') number %s invalid.\n", kanal);
return -EINVAL;
}
if (kanal == 19) {
PDEBUG(DBNETZ, DEBUG_ERROR, "Selected calling channel ('Rufkanal') number %d can't be used as traffic channel.\n", kanal);
if (atoi(kanal) == 19) {
PDEBUG(DBNETZ, DEBUG_ERROR, "Selected calling channel ('Rufkanal') number %s can't be used as traffic channel.\n", kanal);
return -EINVAL;
}
if (kanal >= 38 && kanal <= 39)
PDEBUG(DBNETZ, DEBUG_NOTICE, "Selected channel ('Kanal') number %d may not be supported by older B1-Network phones.\n", kanal);
if (kanal >= 50)
PDEBUG(DBNETZ, DEBUG_NOTICE, "Selected channel ('Kanal') number %d belongs to B2-Network and is not supported by B1 phones.\n", kanal);
if (atoi(kanal) >= 38 && atoi(kanal) <= 39)
PDEBUG(DBNETZ, DEBUG_NOTICE, "Selected channel ('Kanal') number %s may not be supported by older B1-Network phones.\n", kanal);
if (atoi(kanal) >= 50)
PDEBUG(DBNETZ, DEBUG_NOTICE, "Selected channel ('Kanal') number %s belongs to B2-Network and is not supported by B1 phones.\n", kanal);
if ((gfs < 1 || gfs > 19)) {
PDEBUG(DBNETZ, DEBUG_ERROR, "Given 'Gruppenfreisignal' %d invalid.\n", gfs);
@ -220,10 +220,10 @@ error_paging:
return -ENOMEM;
}
PDEBUG(DBNETZ, DEBUG_DEBUG, "Creating 'B-Netz' instance for 'Kanal' = %d 'Gruppenfreisignal' = %d (sample rate %d).\n", kanal, gfs, samplerate);
PDEBUG(DBNETZ, DEBUG_DEBUG, "Creating 'B-Netz' instance for 'Kanal' = %s 'Gruppenfreisignal' = %d (sample rate %d).\n", kanal, gfs, samplerate);
/* init general part of transceiver */
rc = sender_create(&bnetz->sender, kanal, bnetz_kanal2freq(kanal, 0), bnetz_kanal2freq(kanal, 1), audiodev, use_sdr, samplerate, rx_gain, pre_emphasis, de_emphasis, write_rx_wave, write_tx_wave, read_rx_wave, read_tx_wave, loopback, paging_signal);
rc = sender_create(&bnetz->sender, kanal, bnetz_kanal2freq(atoi(kanal), 0), bnetz_kanal2freq(atoi(kanal), 1), audiodev, use_sdr, samplerate, rx_gain, pre_emphasis, de_emphasis, write_rx_wave, write_tx_wave, read_rx_wave, read_tx_wave, loopback, paging_signal);
if (rc < 0) {
PDEBUG(DBNETZ, DEBUG_ERROR, "Failed to init transceiver process!\n");
goto error;
@ -247,7 +247,7 @@ error_paging:
/* go into idle state */
bnetz_go_idle(bnetz);
PDEBUG(DBNETZ, DEBUG_NOTICE, "Created 'Kanal' #%d\n", kanal);
PDEBUG(DBNETZ, DEBUG_NOTICE, "Created 'Kanal' #%s\n", kanal);
PDEBUG(DBNETZ, DEBUG_NOTICE, " -> Using station ID (Gruppenfreisignal) %d\n", gfs);
return 0;
@ -263,7 +263,7 @@ void bnetz_destroy(sender_t *sender)
{
bnetz_t *bnetz = (bnetz_t *) sender;
PDEBUG(DBNETZ, DEBUG_DEBUG, "Destroying 'B-Netz' instance for 'Kanal' = %d.\n", sender->kanal);
PDEBUG(DBNETZ, DEBUG_DEBUG, "Destroying 'B-Netz' instance for 'Kanal' = %s.\n", sender->kanal);
switch_channel_19(bnetz, 0);
dsp_cleanup_sender(bnetz);
timer_exit(&bnetz->timer);
@ -276,7 +276,7 @@ static void bnetz_go_idle(bnetz_t *bnetz)
{
timer_stop(&bnetz->timer);
PDEBUG(DBNETZ, DEBUG_INFO, "Entering IDLE state on channel %d, sending 'Gruppenfreisignal' %d.\n", bnetz->sender.kanal, bnetz->gfs);
PDEBUG(DBNETZ, DEBUG_INFO, "Entering IDLE state on channel %s, sending 'Gruppenfreisignal' %d.\n", bnetz->sender.kanal, bnetz->gfs);
bnetz->station_id[0] = '\0'; /* remove station ID before state change, so status is shown correctly */
bnetz_new_state(bnetz, BNETZ_FREI);
bnetz_set_dsp_mode(bnetz, DSP_MODE_TELEGRAMM);
@ -342,7 +342,7 @@ const char *bnetz_get_telegramm(bnetz_t *bnetz)
return NULL;
}
if (bnetz->station_id_pos == 5) {
it = bnetz_digit2telegramm(bnetz->sender.kanal + 1000);
it = bnetz_digit2telegramm(atoi(bnetz->sender.kanal) + 1000);
bnetz->page_mode = PAGE_MODE_KANALBEFEHL;
break;
}
@ -656,7 +656,7 @@ static void bnetz_timeout(struct timer *timer)
bnetz_set_dsp_mode(bnetz, DSP_MODE_TELEGRAMM);
break;
case BNETZ_SELEKTIVRUF_AUS:
PDEBUG_CHAN(DBNETZ, DEBUG_DEBUG, "Transmitter switched back to channel %d, waiting for paging response.\n", bnetz->sender.kanal);
PDEBUG_CHAN(DBNETZ, DEBUG_DEBUG, "Transmitter switched back to channel %s, waiting for paging response.\n", bnetz->sender.kanal);
bnetz_new_state(bnetz, BNETZ_RUFBESTAETIGUNG);
switch_channel_19(bnetz, 0);
timer_start(&bnetz->timer, PAGING_TO);

@ -112,7 +112,7 @@ typedef struct bnetz {
double bnetz_kanal2freq(int kanal, int unterband);
int bnetz_init(void);
int bnetz_create(int kanal, const char *audiodev, int use_sdr, int samplerate, 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, const char *read_tx_wave, int loopback, double squelch_db, const char *paging, int metering);
int bnetz_create(const char *kanal, const char *audiodev, int use_sdr, int samplerate, 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, const char *read_tx_wave, int loopback, double squelch_db, const char *paging, int metering);
void bnetz_destroy(sender_t *sender);
void bnetz_loss_indication(bnetz_t *bnetz, double loss_time);
void bnetz_receive_tone(bnetz_t *bnetz, int bit);

@ -190,7 +190,7 @@ int main(int argc, char *argv[])
fprintf(stderr, "Failed to create \"Sender\" instance. Quitting!\n");
goto fail;
}
printf("Base station for channel %d ready, please tune transmitter to %.3f MHz and receiver " "to %.3f MHz. (%.3f MHz offset)\n", kanal[i], bnetz_kanal2freq(kanal[i], 0) / 1e6, bnetz_kanal2freq(kanal[i], 1) / 1e6, bnetz_kanal2freq(kanal[i], 2) / 1e6);
printf("Base station for channel %s ready, please tune transmitter to %.3f MHz and receiver " "to %.3f MHz. (%.3f MHz offset)\n", kanal[i], bnetz_kanal2freq(atoi(kanal[i]), 0) / 1e6, bnetz_kanal2freq(atoi(kanal[i]), 1) / 1e6, bnetz_kanal2freq(atoi(kanal[i]), 2) / 1e6);
printf("To call phone, switch transmitter (using paging signal) to %.3f MHz.\n", bnetz_kanal2freq(19, 0) / 1e6);
}

@ -246,38 +246,38 @@ int cnetz_init(void)
}
/* Create transceiver instance and link to a list. */
int cnetz_create(int kanal, enum cnetz_chan_type chan_type, const char *audiodev, int use_sdr, enum demod_type demod, int samplerate, double rx_gain, int challenge_valid, uint64_t challenge, int response_valid, uint64_t response, int warteschlange, int metering, double dbm0_deviation, int ms_power, int measure_speed, double clock_speed[2], int polarity, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, const char *read_tx_wave, int loopback)
int cnetz_create(const char *kanal, enum cnetz_chan_type chan_type, const char *audiodev, int use_sdr, enum demod_type demod, int samplerate, double rx_gain, int challenge_valid, uint64_t challenge, int response_valid, uint64_t response, int warteschlange, int metering, double dbm0_deviation, int ms_power, int measure_speed, double clock_speed[2], int polarity, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, const char *read_tx_wave, int loopback)
{
sender_t *sender;
cnetz_t *cnetz;
int rc;
if ((kanal & 1) && kanal < 1 && kanal > 1147) {
PDEBUG(DCNETZ, DEBUG_ERROR, "Channel ('Kanal') number %d invalid.\n", kanal);
if ((atoi(kanal) & 1) && atoi(kanal) < 1 && atoi(kanal) > 1147) {
PDEBUG(DCNETZ, DEBUG_ERROR, "Channel ('Kanal') number %s invalid.\n", kanal);
return -EINVAL;
}
if ((kanal & 1) && kanal > 947) {
PDEBUG(DCNETZ, DEBUG_NOTICE, "You defined an extended frequency %d, only newer phones support this!\n", kanal);
if ((atoi(kanal) & 1) && atoi(kanal) > 947) {
PDEBUG(DCNETZ, DEBUG_NOTICE, "You defined an extended frequency channel %s, only newer phones support this!\n", kanal);
}
if (!(kanal & 1) && kanal < 2 && kanal > 918) {
PDEBUG(DCNETZ, DEBUG_ERROR, "Channel ('Kanal') number %d invalid.\n", kanal);
if (!(atoi(kanal) & 1) && atoi(kanal) < 2 && atoi(kanal) > 918) {
PDEBUG(DCNETZ, DEBUG_ERROR, "Channel ('Kanal') number %s invalid.\n", kanal);
return -EINVAL;
}
if (!(kanal & 1) && kanal > 758) {
PDEBUG(DCNETZ, DEBUG_NOTICE, "You defined an extended frequency %d, only newer phones support this!\n", kanal);
if (!(atoi(kanal) & 1) && atoi(kanal) > 758) {
PDEBUG(DCNETZ, DEBUG_NOTICE, "You defined an extended frequency %s, only newer phones support this!\n", kanal);
}
if (kanal == 1 || kanal == 2) {
PDEBUG(DCNETZ, DEBUG_NOTICE, "Channel ('Kanal') number %d is specified as 'unused', it might not work!\n", kanal);
if (atoi(kanal) == 1 || atoi(kanal) == 2) {
PDEBUG(DCNETZ, DEBUG_NOTICE, "Channel ('Kanal') number %s is specified as 'unused', it might not work!\n", kanal);
}
/* OgK must be on channel 131 */
if ((chan_type == CHAN_TYPE_OGK || chan_type == CHAN_TYPE_OGK_SPK) && kanal != CNETZ_OGK_KANAL) {
if ((chan_type == CHAN_TYPE_OGK || chan_type == CHAN_TYPE_OGK_SPK) && atoi(kanal) != CNETZ_OGK_KANAL) {
PDEBUG(DCNETZ, DEBUG_NOTICE, "You must use channel %d for calling channel ('Orga-Kanal') or for combined calling + traffic channel!\n", CNETZ_OGK_KANAL);
return -EINVAL;
}
/* SpK must be on channel other than 131 */
if (chan_type == CHAN_TYPE_SPK && kanal == CNETZ_OGK_KANAL) {
if (chan_type == CHAN_TYPE_SPK && atoi(kanal) == CNETZ_OGK_KANAL) {
PDEBUG(DCNETZ, DEBUG_NOTICE, "You must not use channel %d for traffic channel!\n", CNETZ_OGK_KANAL);
return -EINVAL;
}
@ -301,11 +301,11 @@ int cnetz_create(int kanal, enum cnetz_chan_type chan_type, const char *audiodev
return -ENOMEM;
}
PDEBUG(DCNETZ, DEBUG_DEBUG, "Creating 'C-Netz' instance for 'Kanal' = %d (sample rate %d).\n", kanal, samplerate);
PDEBUG(DCNETZ, DEBUG_DEBUG, "Creating 'C-Netz' instance for 'Kanal' = %s (sample rate %d).\n", kanal, samplerate);
/* 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, cnetz_kanal2freq(kanal, 0), cnetz_kanal2freq(kanal, 1), audiodev, use_sdr, samplerate, rx_gain, 0, 0, write_rx_wave, write_tx_wave, read_rx_wave, read_tx_wave, loopback, PAGING_SIGNAL_NONE);
rc = sender_create(&cnetz->sender, kanal, cnetz_kanal2freq(atoi(kanal), 0), cnetz_kanal2freq(atoi(kanal), 1), audiodev, use_sdr, samplerate, rx_gain, 0, 0, write_rx_wave, write_tx_wave, read_rx_wave, read_tx_wave, loopback, PAGING_SIGNAL_NONE);
if (rc < 0) {
PDEBUG(DCNETZ, DEBUG_ERROR, "Failed to init transceiver process!\n");
goto error;
@ -401,7 +401,7 @@ int cnetz_create(int kanal, enum cnetz_chan_type chan_type, const char *audiodev
cnetz_flush_other_transactions(cnetz, trans2);
#endif
PDEBUG(DCNETZ, DEBUG_NOTICE, "Created 'Kanal' #%d of type '%s' = %s\n", kanal, chan_type_short_name(chan_type), chan_type_long_name(chan_type));
PDEBUG(DCNETZ, DEBUG_NOTICE, "Created 'Kanal' #%s of type '%s' = %s\n", kanal, chan_type_short_name(chan_type), chan_type_long_name(chan_type));
return 0;
@ -417,7 +417,7 @@ void cnetz_destroy(sender_t *sender)
cnetz_t *cnetz = (cnetz_t *) sender;
transaction_t *trans;
PDEBUG(DCNETZ, DEBUG_DEBUG, "Destroying 'C-Netz' instance for 'Kanal' = %d.\n", sender->kanal);
PDEBUG(DCNETZ, DEBUG_DEBUG, "Destroying 'C-Netz' instance for 'Kanal' = %s.\n", sender->kanal);
while ((trans = search_transaction(cnetz, ~0))) {
const char *rufnummer = transaction2rufnummer(trans);
@ -439,9 +439,9 @@ static cnetz_t *search_free_spk(int extended)
cnetz = (cnetz_t *) sender;
/* ignore extended frequency, if not supported */
if (!extended) {
if ((sender->kanal & 1) && sender->kanal > 947)
if ((atoi(sender->kanal) & 1) && atoi(sender->kanal) > 947)
continue;
if (!(sender->kanal & 1) && sender->kanal > 758)
if (!(atoi(sender->kanal) & 1) && atoi(sender->kanal) > 758)
continue;
}
/* ignore busy channel */
@ -493,16 +493,16 @@ void cnetz_go_idle(cnetz_t *cnetz)
destroy_transaction(cnetz->trans_list);
}
PDEBUG(DCNETZ, DEBUG_INFO, "Entering IDLE state on channel %d.\n", cnetz->sender.kanal);
PDEBUG(DCNETZ, DEBUG_INFO, "Entering IDLE state on channel %s.\n", cnetz->sender.kanal);
cnetz_new_state(cnetz, CNETZ_IDLE);
/* set scheduler to OgK or turn off SpK */
if (cnetz->dsp_mode == DSP_MODE_SPK_K || cnetz->dsp_mode == DSP_MODE_SPK_V) {
/* go idle after next frame/slot */
cnetz_set_sched_dsp_mode(cnetz, (cnetz->sender.kanal == CNETZ_OGK_KANAL) ? DSP_MODE_OGK : DSP_MODE_OFF, 1);
cnetz_set_sched_dsp_mode(cnetz, (atoi(cnetz->sender.kanal) == CNETZ_OGK_KANAL) ? DSP_MODE_OGK : DSP_MODE_OFF, 1);
} else {
cnetz_set_sched_dsp_mode(cnetz, (cnetz->sender.kanal == CNETZ_OGK_KANAL) ? DSP_MODE_OGK : DSP_MODE_OFF, 0);
cnetz_set_dsp_mode(cnetz, (cnetz->sender.kanal == CNETZ_OGK_KANAL) ? DSP_MODE_OGK : DSP_MODE_OFF);
cnetz_set_sched_dsp_mode(cnetz, (atoi(cnetz->sender.kanal) == CNETZ_OGK_KANAL) ? DSP_MODE_OGK : DSP_MODE_OFF, 0);
cnetz_set_dsp_mode(cnetz, (atoi(cnetz->sender.kanal) == CNETZ_OGK_KANAL) ? DSP_MODE_OGK : DSP_MODE_OFF);
}
/* check for first phone in queue and trigger completion of call (becoming idle means that SpK is now available) */
@ -1032,14 +1032,14 @@ vak:
break;
}
if (spk == cnetz) {
PDEBUG(DCNETZ, DEBUG_INFO, "Staying on combined calling + traffic channel %d\n", spk->sender.kanal);
PDEBUG(DCNETZ, DEBUG_INFO, "Staying on combined calling + traffic channel %s\n", spk->sender.kanal);
} else {
PDEBUG(DCNETZ, DEBUG_INFO, "Assigning phone to traffic channel %d\n", spk->sender.kanal);
PDEBUG(DCNETZ, DEBUG_INFO, "Assigning phone to traffic channel %s\n", spk->sender.kanal);
/* sync RX time to current OgK time */
fsk_copy_sync(&spk->fsk_demod, &cnetz->fsk_demod);
}
/* set channel */
telegramm.frequenz_nr = spk->sender.kanal;
telegramm.frequenz_nr = atoi(spk->sender.kanal);
/* change state to busy */
cnetz_new_state(spk, CNETZ_BUSY);
/* schedule switching two slots ahead */
@ -1282,7 +1282,7 @@ const telegramm_t *cnetz_transmit_telegramm_spk_k(cnetz_t *cnetz)
telegramm.futln_nationalitaet = trans->futln_nat;
telegramm.futln_heimat_fuvst_nr = trans->futln_fuvst;
telegramm.futln_rest_nr = trans->futln_rest;
telegramm.frequenz_nr = cnetz->sender.kanal;
telegramm.frequenz_nr = atoi(cnetz->sender.kanal);
telegramm.bedingte_genauigkeit_der_fufst = si[cnetz->cell_nr].genauigkeit;
telegramm.zufallszahl = cnetz->challenge;
@ -1612,7 +1612,7 @@ const telegramm_t *cnetz_transmit_telegramm_spk_v(cnetz_t *cnetz)
telegramm.futln_nationalitaet = trans->futln_nat;
telegramm.futln_heimat_fuvst_nr = trans->futln_fuvst;
telegramm.futln_rest_nr = trans->futln_rest;
telegramm.frequenz_nr = cnetz->sender.kanal;
telegramm.frequenz_nr = atoi(cnetz->sender.kanal);
telegramm.entfernung = si[cnetz->cell_nr].entfernung;
telegramm.bedingte_genauigkeit_der_fufst = si[cnetz->cell_nr].genauigkeit;
telegramm.gueltigkeit_des_gebuehrenstandes = 0;

@ -138,7 +138,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 *audiodev, int use_sdr, enum demod_type demod, int samplerate, double rx_gain, int challenge_valid, uint64_t challenge, int response_valid, uint64_t response, int warteschlange, int metering, double dbm0_deviation, int ms_power, int measure_speed, double clock_speed[2], int polarity, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, const char *read_tx_wave, int loopback);
int cnetz_create(const char *kanal, enum cnetz_chan_type chan_type, const char *audiodev, int use_sdr, enum demod_type demod, int samplerate, double rx_gain, int challenge_valid, uint64_t challenge, int response_valid, uint64_t response, int warteschlange, int metering, double dbm0_deviation, int ms_power, int measure_speed, double clock_speed[2], int polarity, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, const char *read_tx_wave, int loopback);
void cnetz_destroy(sender_t *sender);
void cnetz_go_idle(cnetz_t *cnetz);
void cnetz_sync_frame(cnetz_t *cnetz, double sync, int ts);

@ -579,10 +579,10 @@ int main(int argc, char *argv[])
fprintf(stderr, "Failed to create \"Sender\" instance. Quitting!\n");
goto fail;
}
if ((kanal[i] & 1)) {
printf("Base station on channel %d ready, please tune transmitter to %.3f MHz and receiver to %.3f MHz. (%.3f MHz offset)\n", kanal[i], cnetz_kanal2freq(kanal[i], 0) / 1e6, cnetz_kanal2freq(kanal[i], 1) / 1e6, cnetz_kanal2freq(kanal[i], 2) / 1e6);
if ((atoi(kanal[i]) & 1)) {
printf("Base station on channel %s ready, please tune transmitter to %.3f MHz and receiver to %.3f MHz. (%.3f MHz offset)\n", kanal[i], cnetz_kanal2freq(atoi(kanal[i]), 0) / 1e6, cnetz_kanal2freq(atoi(kanal[i]), 1) / 1e6, cnetz_kanal2freq(atoi(kanal[i]), 2) / 1e6);
} else {
printf("Base station on channel %d ready, please tune transmitter to %.4f MHz and receiver to %.4f MHz. (%.3f MHz offset)\n", kanal[i], cnetz_kanal2freq(kanal[i], 0) / 1e6, cnetz_kanal2freq(kanal[i], 1) / 1e6, cnetz_kanal2freq(kanal[i], 2) / 1e6);
printf("Base station on channel %s ready, please tune transmitter to %.4f MHz and receiver to %.4f MHz. (%.3f MHz offset)\n", kanal[i], cnetz_kanal2freq(atoi(kanal[i]), 0) / 1e6, cnetz_kanal2freq(atoi(kanal[i]), 1) / 1e6, cnetz_kanal2freq(atoi(kanal[i]), 2) / 1e6);
}
}

@ -212,7 +212,7 @@ static void jolly_speech_timeout(struct timer *timer);
static void jolly_go_idle(jolly_t *jolly);
/* Create transceiver instance and link to a list. */
int jolly_create(int kanal, double dl_freq, double ul_freq, double step, const char *audiodev, int use_sdr, int samplerate, double rx_gain, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, const char *read_tx_wave, int loopback, double squelch_db, int nbfm, int repeater)
int jolly_create(const char *kanal, double dl_freq, double ul_freq, double step, const char *audiodev, int use_sdr, int samplerate, double rx_gain, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, const char *read_tx_wave, int loopback, double squelch_db, int nbfm, int repeater)
{
jolly_t *jolly;
int rc;
@ -223,10 +223,10 @@ int jolly_create(int kanal, double dl_freq, double ul_freq, double step, const c
return -EIO;
}
PDEBUG(DJOLLY, DEBUG_DEBUG, "Creating 'JollyCom' instance for 'Kanal' = %d (sample rate %d).\n", kanal, samplerate);
PDEBUG(DJOLLY, DEBUG_DEBUG, "Creating 'JollyCom' instance for 'Kanal' = %s (sample rate %d).\n", kanal, samplerate);
dl_freq = dl_freq * 1e6 + step * 1e3 * (double)kanal;
ul_freq = ul_freq * 1e6 + step * 1e3 * (double)kanal;
dl_freq = dl_freq * 1e6 + step * 1e3 * (double)atoi(kanal);
ul_freq = ul_freq * 1e6 + step * 1e3 * (double)atoi(kanal);
/* init general part of transceiver */
rc = sender_create(&jolly->sender, kanal, dl_freq, ul_freq, audiodev, use_sdr, samplerate, rx_gain, pre_emphasis, de_emphasis, write_rx_wave, write_tx_wave, read_rx_wave, read_tx_wave, loopback, PAGING_SIGNAL_NONE);
@ -249,7 +249,7 @@ int jolly_create(int kanal, double dl_freq, double ul_freq, double step, const c
/* go into idle state */
jolly_go_idle(jolly);
PDEBUG(DJOLLY, DEBUG_NOTICE, "Created 'Kanal' #%d\n", kanal);
PDEBUG(DJOLLY, DEBUG_NOTICE, "Created 'Kanal' #%s\n", kanal);
return 0;
@ -264,7 +264,7 @@ void jolly_destroy(sender_t *sender)
{
jolly_t *jolly = (jolly_t *) sender;
PDEBUG(DJOLLY, DEBUG_DEBUG, "Destroying 'JollyCom' instance for 'Kanal' = %d.\n", sender->kanal);
PDEBUG(DJOLLY, DEBUG_DEBUG, "Destroying 'JollyCom' instance for 'Kanal' = %s.\n", sender->kanal);
dsp_cleanup_sender(jolly);
timer_exit(&jolly->timer);
@ -280,7 +280,7 @@ static void jolly_go_idle(jolly_t *jolly)
timer_stop(&jolly->speech_timer);
reset_speech_string(jolly);
PDEBUG(DJOLLY, DEBUG_INFO, "Entering IDLE state on channel %d.\n", jolly->sender.kanal);
PDEBUG(DJOLLY, DEBUG_INFO, "Entering IDLE state on channel %s.\n", jolly->sender.kanal);
jolly->dialing[0] = '\0';
jolly->station_id[0] = '\0'; /* remove station ID before state change, so status is shown correctly */
jolly_new_state(jolly, STATE_IDLE);
@ -293,7 +293,7 @@ static void jolly_release(jolly_t *jolly)
timer_stop(&jolly->speech_timer);
reset_speech_string(jolly);
PDEBUG(DJOLLY, DEBUG_INFO, "Sending Release sequence on channel %d.\n", jolly->sender.kanal);
PDEBUG(DJOLLY, DEBUG_INFO, "Sending Release sequence on channel %s.\n", jolly->sender.kanal);
timer_start(&jolly->speech_timer, SPEECH_DELAY_RELEASE);
jolly_new_state(jolly, STATE_RELEASED);
}

@ -50,7 +50,7 @@ typedef struct jolly {
int delay_max; /* number of samples in delay buffer */
} jolly_t;
int jolly_create(int kanal, double dl_freq, double ul_freq, double step, const char *audiodev, int use_sdr, int samplerate, double rx_gain, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, const char *read_tx_wave, int loopback, double squelch_db, int nbfm, int repeater);
int jolly_create(const char *kanal, double dl_freq, double ul_freq, double step, const char *audiodev, int use_sdr, int samplerate, double rx_gain, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, const char *read_tx_wave, int loopback, double squelch_db, int nbfm, int repeater);
void jolly_destroy(sender_t *sender);
void speech_finished(jolly_t *jolly);
void jolly_receive_dtmf(void *priv, char digit, dtmf_meas_t *meas);

@ -196,7 +196,7 @@ int main(int argc, char *argv[])
fprintf(stderr, "Failed to create transceiver instance. Quitting!\n");
goto fail;
}
printf("base station on channel %d ready, please tune transmitter to %.4f MHz and receiver to %.4f MHz. (%.4f MHz offset)\n", kanal[i], dl_freq + step / 1e3 * (double)kanal[i], ul_freq + step / 1e3 * (double)kanal[i], ul_freq - dl_freq);
printf("base station on channel %s ready, please tune transmitter to %.4f MHz and receiver to %.4f MHz. (%.4f MHz offset)\n", kanal[i], dl_freq + step / 1e3 * (double)atoi(kanal[i]), ul_freq + step / 1e3 * (double)atoi(kanal[i]), ul_freq - dl_freq);
}
main_mobile(&quit, latency, interval, NULL, station_id, 4);

@ -94,7 +94,7 @@ void get_win_size(int *w, int *h)
*w = MAX_DISPLAY_WIDTH - 1;
}
void _printdebug(const char *file, const char __attribute__((unused)) *function, int line, int cat, int level, int chan, const char *fmt, ...)
void _printdebug(const char *file, const char __attribute__((unused)) *function, int line, int cat, int level, const char *kanal, const char *fmt, ...)
{
char buffer[4096], *b = buffer;
int s = sizeof(buffer) - 1;
@ -107,9 +107,9 @@ void _printdebug(const char *file, const char __attribute__((unused)) *function,
buffer[sizeof(buffer) - 1] = '\0';
/* if chan is used, prefix the channel number */
if (num_kanal > 1 && chan >= 0) {
sprintf(buffer, "(chan %d) ", chan);
/* if kanal is used, prefix the channel number */
if (num_kanal > 1 && kanal) {
sprintf(buffer, "(chan %s) ", kanal);
b = strchr(buffer, '\0');
s -= strlen(buffer);
}

@ -30,9 +30,9 @@
void get_win_size(int *w, int *h);
#define PDEBUG(cat, level, fmt, arg...) _printdebug(__FILE__, __FUNCTION__, __LINE__, cat, level, -1, fmt, ## arg)
#define PDEBUG(cat, level, fmt, arg...) _printdebug(__FILE__, __FUNCTION__, __LINE__, cat, level, NULL, fmt, ## arg)
#define PDEBUG_CHAN(cat, level, fmt, arg...) _printdebug(__FILE__, __FUNCTION__, __LINE__, cat, level, CHAN, fmt, ## arg)
void _printdebug(const char *file, const char *function, int line, int cat, int level, int chan, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 7, 8)));
void _printdebug(const char *file, const char *function, int line, int cat, int level, const char *chan_str, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 7, 8)));
const char *debug_amplitude(double level);
const char *debug_db(double level_db);

@ -5,7 +5,7 @@
#define MAX_DISPLAY_WIDTH 1024
typedef struct display_wave {
int kanal;
const char *kanal;
int interval_pos;
int interval_max;
int offset;
@ -44,7 +44,7 @@ typedef struct display_measurements_param {
typedef struct display_measurements {
struct display_measurements *next;
int kanal;
const char *kanal;
dispmeasparam_t *param;
} dispmeas_t;
@ -60,7 +60,7 @@ typedef struct display_iq {
typedef struct display_spectrum_mark {
struct display_spectrum_mark *next;
int kanal;
const char *kanal;
double frequency;
} dispspectrum_mark_t;
@ -74,17 +74,17 @@ typedef struct display_spectrum {
#define MAX_HEIGHT_STATUS 32
void display_wave_init(dispwav_t *disp, int samplerate, int kanal);
void display_wave_init(dispwav_t *disp, int samplerate, const char *kanal);
void display_wave_on(int on);
void display_wave(dispwav_t *disp, sample_t *samples, int length, double range);
void display_status_on(int on);
void display_status_start(void);
void display_status_channel(int channel, const char *type, const char *state);
void display_status_channel(const char *kanal, const char *type, const char *state);
void display_status_subscriber(const char *number, const char *state);
void display_status_end(void);
void display_measurements_init(dispmeas_t *disp, int samplerate, int kanal);
void display_measurements_init(dispmeas_t *disp, int samplerate, const char *kanal);
void display_measurements_exit(dispmeas_t *disp);
void display_measurements_on(int on);
dispmeasparam_t *display_measurements_add(dispmeas_t *disp, char *name, char *format, enum display_measurements_type type, enum display_measurements_bar bar, double min, double max, double mark);
@ -96,7 +96,7 @@ void display_iq_on(int on);
void display_iq(float *samples, int length);
void display_spectrum_init(int samplerate, double center_frequency);
void display_spectrum_add_mark(int kanal, double frequency);
void display_spectrum_add_mark(const char *kanal, double frequency);
void display_spectrum_exit(void);
void display_spectrum_on(int on);
void display_spectrum(float *samples, int length);

@ -40,7 +40,7 @@ static char line_color[MAX_DISPLAY_WIDTH];
dispmeas_t *meas_head = NULL;
void display_measurements_init(dispmeas_t *disp, int __attribute__((unused)) samplerate, int kanal)
void display_measurements_init(dispmeas_t *disp, int __attribute__((unused)) samplerate, const char *kanal)
{
dispmeas_t **disp_p;
@ -114,7 +114,7 @@ static void print_measurements(int on)
for (disp = meas_head; disp; disp = disp->next) {
memset(line, ' ', width);
memset(line_color, 7, width);
sprintf(line, "(chan %d", disp->kanal);
sprintf(line, "(chan %s", disp->kanal);
*strchr(line, '\0') = ')';
display_line(on, width);
for (param = disp->param; param; param = param->next) {

@ -55,7 +55,7 @@ void display_spectrum_init(int samplerate, double _center_frequency)
has_init = 1;
}
void display_spectrum_add_mark(int kanal, double frequency)
void display_spectrum_add_mark(const char *kanal, double frequency)
{
dispspectrum_mark_t *mark, **mark_p;
@ -348,7 +348,7 @@ void display_spectrum(float *samples, int length)
screen[k][j] = ':';
screen_color[k][j] = 12;
}
sprintf(print_channel, "Ch%d", mark->kanal);
sprintf(print_channel, "Ch%s", mark->kanal);
for (o = 0; o < (int)strlen(print_channel); o++) {
s = j - strlen(print_channel) + o;
if (s >= 0 && s < width) {

@ -87,7 +87,7 @@ void display_status_start(void)
line_count = 1;
}
void display_status_channel(int channel, const char *type, const char *state)
void display_status_channel(const char *kanal, const char *type, const char *state)
{
char line[MAX_DISPLAY_WIDTH];
@ -99,9 +99,9 @@ void display_status_channel(int channel, const char *type, const char *state)
return;
if (type)
snprintf(line, sizeof(line), "Channel: %d Type: %s State: %s", channel, type, state);
snprintf(line, sizeof(line), "Channel: %s Type: %s State: %s", kanal, type, state);
else
snprintf(line, sizeof(line), "Channel: %d State: %s", channel, state);
snprintf(line, sizeof(line), "Channel: %s State: %s", kanal, state);
line[sizeof(line) - 1] = '\0';
memcpy(screen[line_count++], line, strlen(line));
}

@ -33,7 +33,7 @@ static int num_sender = 0;
static char screen[HEIGHT][MAX_DISPLAY_WIDTH];
static int wave_on = 0;
void display_wave_init(dispwav_t *disp, int samplerate, int kanal)
void display_wave_init(dispwav_t *disp, int samplerate, const char *kanal)
{
memset(disp, 0, sizeof(*disp));
disp->offset = (num_sender++) * HEIGHT;
@ -198,7 +198,7 @@ void display_wave(dispwav_t *disp, sample_t *samples, int length, double range)
screen[k][j] = '|';
}
}
sprintf(screen[0], "(chan %d", disp->kanal);
sprintf(screen[0], "(chan %s", disp->kanal);
*strchr(screen[0], '\0') = ')';
printf("\0337\033[H");
for (j = 0; j < disp->offset; j++)

@ -50,7 +50,7 @@ static int got_init = 0;
/* common mobile settings */
int num_kanal = 0;
int kanal[MAX_SENDER];
const char *kanal[MAX_SENDER];
int num_audiodev = 0;
const char *audiodev[MAX_SENDER] = { "hw:0,0" };
int use_sdr = 0;
@ -248,7 +248,7 @@ int main_mobile_handle_options(int short_option, int argi, char **argv)
break;
case 'k':
case OPT_CHANNEL:
OPT_ARRAY(num_kanal, kanal, atoi(argv[argi]))
OPT_ARRAY(num_kanal, kanal, argv[argi])
break;
case 'a':
OPT_ARRAY(num_audiodev, audiodev, strdup(argv[argi]))

@ -1,6 +1,6 @@
extern int num_kanal;
extern int kanal[];
extern const char *kanal[];
extern int swap_links;
extern int num_audiodev;
extern const char *audiodev[];

@ -37,7 +37,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, double sendefrequenz, double empfangsfrequenz, const char *audiodev, int use_sdr, int samplerate, double rx_gain, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, const char *read_tx_wave, int loopback, enum paging_signal paging_signal)
int sender_create(sender_t *sender, const char *kanal, double sendefrequenz, double empfangsfrequenz, const char *audiodev, int use_sdr, int samplerate, double rx_gain, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, const char *read_tx_wave, int loopback, enum paging_signal paging_signal)
{
sender_t *master, *slave;
int rc = 0;
@ -75,14 +75,14 @@ int sender_create(sender_t *sender, int kanal, double sendefrequenz, double empf
* of the master channel.
*/
for (master = sender_head; master; master = master->next) {
if (master->kanal == kanal) {
PDEBUG(DSENDER, DEBUG_ERROR, "Channel %d may not be defined for multiple transceivers!\n", kanal);
if (!strcmp(master->kanal, kanal)) {
PDEBUG(DSENDER, DEBUG_ERROR, "Channel %s may not be defined for multiple transceivers!\n", kanal);
rc = -EIO;
goto error;
}
if (abs(master->kanal - kanal) == 1) {
if (abs(atoi(master->kanal) - atoi(kanal)) == 1) {
PDEBUG(DSENDER, DEBUG_NOTICE, "------------------------------------------------------------------------\n");
PDEBUG(DSENDER, DEBUG_NOTICE, "NOTE: Channel %d is next to channel %d. This will cause interferences.\n", kanal, master->kanal);
PDEBUG(DSENDER, DEBUG_NOTICE, "NOTE: Channel %s is next to channel %s. This will cause interferences.\n", kanal, master->kanal);
PDEBUG(DSENDER, DEBUG_NOTICE, "Please use at least one channel distance to avoid that.\n");
PDEBUG(DSENDER, DEBUG_NOTICE, "------------------------------------------------------------------------\n");
}
@ -91,12 +91,12 @@ int sender_create(sender_t *sender, int kanal, double sendefrequenz, double empf
}
if (master) {
if (master->paging_signal != PAGING_SIGNAL_NONE && !use_sdr) {
PDEBUG(DSENDER, DEBUG_ERROR, "Cannot share audio device with channel %d, because its second audio channel is used for paging signal! Use different audio device.\n", master->kanal);
PDEBUG(DSENDER, DEBUG_ERROR, "Cannot share audio device with channel %s, because its second audio channel is used for paging signal! Use different audio device.\n", master->kanal);
rc = -EBUSY;
goto error;
}
if (paging_signal != PAGING_SIGNAL_NONE && !use_sdr) {
PDEBUG(DSENDER, DEBUG_ERROR, "Cannot share audio device with channel %d, because we need a second audio channel for paging signal! Use different audio device.\n", master->kanal);
PDEBUG(DSENDER, DEBUG_ERROR, "Cannot share audio device with channel %s, because we need a second audio channel for paging signal! Use different audio device.\n", master->kanal);
rc = -EBUSY;
goto error;
}

@ -28,7 +28,7 @@ typedef struct sender {
struct sender *master; /* if set, the audio device is owned by 'master' */
/* system info */
int kanal; /* channel number */
const char *kanal; /* channel number */
double sendefrequenz; /* transmitter frequency */
double empfangsfrequenz; /* receiver frequency */
double ruffrequenz; /* special paging frequency used for B-Netz */
@ -90,7 +90,7 @@ typedef struct sender {
extern sender_t *sender_head;
extern int cant_recover;
int sender_create(sender_t *sender, int kanal, double sendefrequenz, double empfangsfrequenz, const char *audiodev, int use_sdr, int samplerate, double rx_gain, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, const char *read_tx_wave, int loopback, enum paging_signal paging_signal);
int sender_create(sender_t *sender, const char *kanal, double sendefrequenz, double empfangsfrequenz, const char *audiodev, int use_sdr, int samplerate, double rx_gain, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, const char *read_tx_wave, int loopback, enum paging_signal paging_signal);
void sender_destroy(sender_t *sender);
void sender_set_fm(sender_t *sender, double max_deviation, double max_modulation, double dBm0_deviation, double max_display);
int sender_open_audio(int latspl);

@ -22,7 +22,7 @@
#include "../libdebug/debug.h"
#include "squelch.h"
#define CHAN squelch->chan
#define CHAN squelch->kanal
/* How does it work:
*
@ -48,10 +48,10 @@
#define SQUELCH_AUTO_TIME 0.5 /* duration of squelch quelch calibration */
#define SQUELCH_AUTO_OFFSET 10.0 /* auto calibration: offset above noise floor */
void squelch_init(squelch_t *squelch, int chan, double threshold_db, double mute_time, double loss_time)
void squelch_init(squelch_t *squelch, const char *kanal, double threshold_db, double mute_time, double loss_time)
{
memset(squelch, 0, sizeof(*squelch));
squelch->chan = chan;
squelch->kanal = kanal;
squelch->threshold_db = threshold_db;
/* wait for init condition */
squelch->init_count = 0.0;

@ -1,6 +1,6 @@
typedef struct squelch {
int chan; /* channel number */
const char *kanal; /* channel number */
double threshold_db; /* threshold level to mute or loss of signal */
double init_count; /* duration counter for starting squelch process */
int auto_state; /* set if auto threshold calibration is performed */
@ -21,6 +21,6 @@ enum squelch_result {
SQUELCH_LOSS,
};
void squelch_init(squelch_t *squelch, int chan, double threshold_db, double mute_time, double loss_time);
void squelch_init(squelch_t *squelch, const char *kanal, double threshold_db, double mute_time, double loss_time);
enum squelch_result squelch(squelch_t *squelch, double rf_level_db, double duration);

@ -345,14 +345,14 @@ int main(int argc, char *argv[])
for (i = 0; i < num_kanal; i++) {
if (supervisory[i] == 0) {
fprintf(stderr, "No supervisory signal given for channel %d. This is ok, but signal loss dannot be detected. \n", kanal[i]);
fprintf(stderr, "No supervisory signal given for channel %s. This is ok, but signal loss dannot be detected. \n", kanal[i]);
continue;
}
if (super[supervisory[i]]) {
fprintf(stderr, "Supervisory signal %d is selected for both cannels #%d and #%d. I advice to use different signal, to avoid co-channel interferences.\n", supervisory[i], kanal[i], super[supervisory[i]]);
fprintf(stderr, "Supervisory signal %d is selected for both cannels #%s and #%d. I advice to use different signal, to avoid co-channel interferences.\n", supervisory[i], kanal[i], super[supervisory[i]]);
continue;
}
super[supervisory[i]] = kanal[i];
super[supervisory[i]] = atoi(kanal[i]);
}
}