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.
This commit is contained in:
Andreas Eversberg
2017-10-30 08:00:47 +01:00
parent ca6d70566c
commit aeb31a7a34
3 changed files with 22 additions and 8 deletions

View File

@@ -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);

View File

@@ -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);

View File

@@ -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;