aboutsummaryrefslogtreecommitdiffstats
path: root/src/anetz
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2019-07-20 18:11:17 +0200
committerAndreas Eversberg <jolly@eversberg.eu>2019-08-26 21:10:20 +0200
commitd6579c124424532b9550c02d712c0d01a7da5114 (patch)
tree855f40b807eb09b2f4da969e36e2b82287c063b3 /src/anetz
parentb266b0f743282dd659f7423a2d441208cc7494fc (diff)
Allow giving alphanumeric channels (Prepare for IMTS)
Diffstat (limited to 'src/anetz')
-rw-r--r--src/anetz/anetz.c16
-rw-r--r--src/anetz/anetz.h2
-rw-r--r--src/anetz/main.c2
3 files changed, 10 insertions, 10 deletions
diff --git a/src/anetz/anetz.c b/src/anetz/anetz.c
index e33aa79..d447377 100644
--- a/src/anetz/anetz.c
+++ b/src/anetz/anetz.c
@@ -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 */
diff --git a/src/anetz/anetz.h b/src/anetz/anetz.h
index 9a813cd..1278315 100644
--- a/src/anetz/anetz.h
+++ b/src/anetz/anetz.h
@@ -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);
diff --git a/src/anetz/main.c b/src/anetz/main.c
index 470bda7..4de9435 100644
--- a/src/anetz/main.c
+++ b/src/anetz/main.c
@@ -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);