aboutsummaryrefslogtreecommitdiffstats
path: root/src/anetz
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2017-10-30 08:00:47 +0100
committerAndreas Eversberg <jolly@eversberg.eu>2017-11-05 16:59:59 +0100
commitaeb31a7a34fc2accd0c840d7d8e91bc4a946c7d9 (patch)
tree0ff5c0e34c1d314647af1011f75aa7b9f9802a03 /src/anetz
parentca6d70566c339eb24aca8af29f8000008e53184a (diff)
A-Netz: Number of operator can be defined now
Since A-Netz does not allow automatic dialing, the call is forwarded to an operator. Use -O <number> to change the default operator's number.
Diffstat (limited to 'src/anetz')
-rw-r--r--src/anetz/anetz.c6
-rw-r--r--src/anetz/anetz.h3
-rw-r--r--src/anetz/main.c21
3 files changed, 22 insertions, 8 deletions
diff --git a/src/anetz/anetz.c b/src/anetz/anetz.c
index e6b9d1e..e5a3774 100644
--- a/src/anetz/anetz.c
+++ b/src/anetz/anetz.c
@@ -186,7 +186,7 @@ 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)
+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)
{
anetz_t *anetz;
int rc;
@@ -202,6 +202,8 @@ int anetz_create(int kanal, const char *audiodev, int use_sdr, int samplerate, d
return -EIO;
}
+ anetz->operator = operator;
+
PDEBUG(DANETZ, DEBUG_DEBUG, "Creating 'A-Netz' instance for 'Kanal' = %d (sample rate %d).\n", kanal, samplerate);
/* init general part of transceiver */
@@ -328,7 +330,7 @@ void anetz_receive_tone(anetz_t *anetz, int tone)
int rc;
PDEBUG_CHAN(DANETZ, DEBUG_INFO, "1750 Hz signal from mobile station is gone, setup call.\n");
- rc = call_up_setup(callref, NULL, "010");
+ rc = call_up_setup(callref, NULL, anetz->operator);
if (rc < 0) {
PDEBUG_CHAN(DANETZ, DEBUG_NOTICE, "Call rejected (cause %d), sending release tone.\n", -rc);
anetz_release(anetz);
diff --git a/src/anetz/anetz.h b/src/anetz/anetz.h
index 7f0cac5..9328115 100644
--- a/src/anetz/anetz.h
+++ b/src/anetz/anetz.h
@@ -48,12 +48,13 @@ typedef struct anetz {
int paging_count; /* current sample count of tone in seq. mode */
int paging_transition; /* set to number of samples during transition */
squelch_t squelch; /* squelch detection process */
+ const char *operator; /* destination to dial from mobile phone */
} anetz_t;
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);
+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);
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 ab386ec..5a65457 100644
--- a/src/anetz/main.c
+++ b/src/anetz/main.c
@@ -37,14 +37,19 @@
#include "image.h"
/* settings */
-double page_gain = 1;
-int page_sequence = 0;
-double squelch_db = -INFINITY;
+static char operator[32] = "010";
+static double page_gain = 1;
+static int page_sequence = 0;
+static double squelch_db = -INFINITY;
void print_help(const char *arg0)
{
main_mobile_print_help(arg0, "[-V 12] ");
/* - - */
+ printf(" -O --operator <number>\n");
+ printf(" Give number to dial when mobile station initiated a call. A-Netz does\n");
+ printf(" not support automatic dialing, so operator assistance is required.\n");
+ printf(" By default, the operator '%s' is dialed.\n", operator);
printf(" -G --geo <lat>,<lon>\n");
printf(" Give your coordinates of your location, to find closest base station.\n");
printf(" (e.g. '--geo 51.186959,7.080194') Or use '--geo list' to get a list of\n");
@@ -72,6 +77,7 @@ static int handle_options(int argc, char **argv)
double gain_db;
static struct option long_options_special[] = {
+ {"operator", 1, 0, 'O'},
{"geo", 1, 0, 'G'},
{"page-gain", 1, 0, 'V'},
{"page-sequence", 1, 0, 'P'},
@@ -79,7 +85,7 @@ static int handle_options(int argc, char **argv)
{0, 0, 0, 0}
};
- main_mobile_set_options("G:V:P:S:", long_options_special);
+ main_mobile_set_options("O:G:V:P:S:", long_options_special);
while (1) {
int option_index = 0, c;
@@ -90,6 +96,11 @@ static int handle_options(int argc, char **argv)
break;
switch (c) {
+ case 'O':
+ strncpy(operator, optarg, sizeof(operator) - 1);
+ operator[sizeof(operator) - 1] = '\0';
+ skip_args += 2;
+ break;
case 'G':
if (!strcasecmp(optarg, "list")) {
station_list();
@@ -184,7 +195,7 @@ int main(int argc, char *argv[])
/* create transceiver instance */
for (i = 0; i < num_kanal; i++) {
- rc = anetz_create(kanal[i], audiodev[i], use_sdr, samplerate, rx_gain, page_gain, page_sequence, do_pre_emphasis, do_de_emphasis, write_rx_wave, write_tx_wave, read_rx_wave, read_tx_wave, loopback, squelch_db);
+ rc = anetz_create(kanal[i], audiodev[i], use_sdr, samplerate, rx_gain, page_gain, page_sequence, do_pre_emphasis, do_de_emphasis, write_rx_wave, write_tx_wave, read_rx_wave, read_tx_wave, loopback, squelch_db, operator);
if (rc < 0) {
fprintf(stderr, "Failed to create \"Sender\" instance. Quitting!\n");
goto fail;