diff options
Diffstat (limited to 'src/eurosignal')
-rw-r--r-- | src/eurosignal/Makefile.am | 9 | ||||
-rw-r--r-- | src/eurosignal/dsp.c | 30 | ||||
-rw-r--r-- | src/eurosignal/es_ges.c | 1 | ||||
-rw-r--r-- | src/eurosignal/es_kaudn.c | 1 | ||||
-rw-r--r-- | src/eurosignal/es_mitte.c | 1 | ||||
-rw-r--r-- | src/eurosignal/es_teilges.c | 1 | ||||
-rw-r--r-- | src/eurosignal/eurosignal.c | 124 | ||||
-rw-r--r-- | src/eurosignal/eurosignal.h | 4 | ||||
-rw-r--r-- | src/eurosignal/main.c | 11 |
9 files changed, 94 insertions, 88 deletions
diff --git a/src/eurosignal/Makefile.am b/src/eurosignal/Makefile.am index 9ec8837..aeb5dbb 100644 --- a/src/eurosignal/Makefile.am +++ b/src/eurosignal/Makefile.am @@ -1,4 +1,4 @@ -AM_CPPFLAGS = -Wall -Wextra -g $(all_includes) +AM_CPPFLAGS = -Wall -Wextra -Wmissing-prototypes -g $(all_includes) bin_PROGRAMS = \ eurosignal @@ -16,12 +16,9 @@ eurosignal_LDADD = \ $(COMMON_LA) \ ../anetz/libgermanton.a \ $(top_builddir)/src/liboptions/liboptions.a \ - $(top_builddir)/src/libdebug/libdebug.a \ $(top_builddir)/src/libmobile/libmobile.a \ - $(top_builddir)/src/libosmocc/libosmocc.a \ $(top_builddir)/src/libdisplay/libdisplay.a \ $(top_builddir)/src/libjitter/libjitter.a \ - $(top_builddir)/src/libtimer/libtimer.a \ $(top_builddir)/src/libsamplerate/libsamplerate.a \ $(top_builddir)/src/libemphasis/libemphasis.a \ $(top_builddir)/src/libfsk/libfsk.a \ @@ -29,8 +26,10 @@ eurosignal_LDADD = \ $(top_builddir)/src/libfilter/libfilter.a \ $(top_builddir)/src/libwave/libwave.a \ $(top_builddir)/src/libsample/libsample.a \ - $(top_builddir)/src/libg711/libg711.a \ $(top_builddir)/src/libaaimage/libaaimage.a \ + $(top_builddir)/src/liblogging/liblogging.a \ + $(LIBOSMOCORE_LIBS) \ + $(LIBOSMOCC_LIBS) \ -lm if HAVE_ALSA diff --git a/src/eurosignal/dsp.c b/src/eurosignal/dsp.c index dc8bf92..619bb90 100644 --- a/src/eurosignal/dsp.c +++ b/src/eurosignal/dsp.c @@ -26,7 +26,7 @@ #include <errno.h> #include <math.h> #include "../libsample/sample.h" -#include "../libdebug/debug.h" +#include "../liblogging/logging.h" #include "eurosignal.h" #include "dsp.h" @@ -105,11 +105,11 @@ void dsp_init(int samplerate) { int i; - PDEBUG(DDSP, DEBUG_DEBUG, "Generating phase shiftings for tones.\n"); + LOGP(DDSP, LOGL_DEBUG, "Generating phase shiftings for tones.\n"); for (i = 0; dsp_digits[i].digit; i++) dsp_digits[i].phaseshift65536 = 65536.0 / ((double)samplerate / dsp_digits[i].frequency); - PDEBUG(DDSP, DEBUG_DEBUG, "Generating sine table for tones.\n"); + LOGP(DDSP, LOGL_DEBUG, "Generating sine table for tones.\n"); for (i = 0; i < 65536; i++) dsp_tone[i] = sin((double)i / 65536.0 * 2.0 * PI); } @@ -119,7 +119,7 @@ int dsp_init_sender(euro_t *euro, int samplerate, int fm) { int rc = 0; - PDEBUG_CHAN(DDSP, DEBUG_DEBUG, "Init DSP for 'Sender'.\n"); + LOGP_CHAN(DDSP, LOGL_DEBUG, "Init DSP for 'Sender'.\n"); /* set modulation parameters */ if (fm) @@ -154,13 +154,13 @@ error: /* Cleanup transceiver instance. */ void dsp_cleanup_sender(euro_t *euro) { - PDEBUG_CHAN(DDSP, DEBUG_DEBUG, "Cleanup DSP for 'Sender'.\n"); + LOGP_CHAN(DDSP, LOGL_DEBUG, "Cleanup DSP for 'Sender'.\n"); /* cleanup demodulator */ fm_demod_exit(&euro->rx_demod); } -//#define DEBUG +//#define DEBUG_DECODER static void tone_decode(euro_t *euro, sample_t *samples, int length) { @@ -179,14 +179,14 @@ static void tone_decode(euro_t *euro, sample_t *samples, int length) for (i = 0; i < length; i++) { /* get frequency */ f = frequency[i] + (FREQUENCY_MIN + FREQUENCY_MAX) / 2.0; -#ifdef DEBUG +#ifdef DEBUG_DECODER if (i == 0) printf("%s %.5f ", debug_amplitude(frequency[i] / (FREQUENCY_MAX - FREQUENCY_MIN) * 2.0), f); #endif for (d = 0; dsp_digits[d].digit; d++) { if (f >= dsp_digits[d].frequency - FREQUENCY_TOL && f <= dsp_digits[d].frequency + FREQUENCY_TOL) break; } -#ifdef DEBUG +#ifdef DEBUG_DECODER if (i == 0) printf("%c\n", dsp_digits[d].digit); #endif @@ -201,7 +201,7 @@ static void tone_decode(euro_t *euro, sample_t *samples, int length) case 'I': /* pause tone */ if (euro->rx_digit_count == DIGIT_DETECT) { - PDEBUG_CHAN(DDSP, DEBUG_DEBUG, "Detected Idle tone, starting.\n"); + LOGP_CHAN(DDSP, LOGL_DEBUG, "Detected Idle tone, starting.\n"); euro->rx_digit_receiving = 1; euro->rx_digit_index = 0; euro->rx_timeout_count = 0; @@ -213,7 +213,7 @@ static void tone_decode(euro_t *euro, sample_t *samples, int length) break; if (euro->rx_digit_count == DIGIT_DETECT) { /* out of range tone */ - PDEBUG_CHAN(DDSP, DEBUG_DEBUG, "Detected tone out of range, aborting.\n"); + LOGP_CHAN(DDSP, LOGL_DEBUG, "Detected tone out of range, aborting.\n"); euro->rx_digit_receiving = 0; } break; @@ -225,7 +225,7 @@ static void tone_decode(euro_t *euro, sample_t *samples, int length) if (euro->rx_digit_count == DIGIT_DETECT) { double level; level = sqrt(I[i] * I[i] + Q[i] * Q[i]) * 2; - PDEBUG_CHAN(DDSP, DEBUG_DEBUG, "Detected digit '%s' (level = %.0f%%)\n", digit_to_name(digit), level * 100.0); + LOGP_CHAN(DDSP, LOGL_DEBUG, "Detected digit '%s' (level = %.0f%%)\n", digit_to_name(digit), level * 100.0); display_measurements_update(euro->dmp_tone_level, level * 100.0, 0.0); euro->rx_digits[euro->rx_digit_index] = digit; euro->rx_digit_index++; @@ -243,7 +243,7 @@ static void tone_decode(euro_t *euro, sample_t *samples, int length) if (euro->rx_digit_receiving && euro->rx_digit_index) { euro->rx_timeout_count++; if (euro->rx_timeout_count == TIMEOUT_DETECT) { - PDEBUG_CHAN(DDSP, DEBUG_DEBUG, "Timeout receiving, aborting.\n"); + LOGP_CHAN(DDSP, LOGL_DEBUG, "Timeout receiving, aborting.\n"); euro->rx_digit_receiving = 0; } } @@ -280,18 +280,18 @@ static void tone_send(euro_t *euro, sample_t *samples, int length) euro->tx_time -= PAUSE_DURATION; euro_get_id(euro, euro->tx_digits); euro->tx_digit_index = 0; - PDEBUG_CHAN(DDSP, DEBUG_DEBUG, "Sending digit '%s'\n", digit_to_name(euro->tx_digits[0])); + LOGP_CHAN(DDSP, LOGL_DEBUG, "Sending digit '%s'\n", digit_to_name(euro->tx_digits[0])); euro->tx_phaseshift65536 = digit_to_phaseshift65536(euro->tx_digits[0]); } } else { if (euro->tx_time >= DIGIT_DURATION) { euro->tx_time -= DIGIT_DURATION; if (++euro->tx_digit_index == 6) { - PDEBUG_CHAN(DDSP, DEBUG_DEBUG, "Sending Idle tone'\n"); + LOGP_CHAN(DDSP, LOGL_DEBUG, "Sending Idle tone'\n"); euro->tx_digits[0] = '\0'; euro->tx_phaseshift65536 = digit_to_phaseshift65536('I'); } else { - PDEBUG_CHAN(DDSP, DEBUG_DEBUG, "Sending digit '%s'\n", digit_to_name(euro->tx_digits[euro->tx_digit_index])); + LOGP_CHAN(DDSP, LOGL_DEBUG, "Sending digit '%s'\n", digit_to_name(euro->tx_digits[euro->tx_digit_index])); euro->tx_phaseshift65536 = digit_to_phaseshift65536(euro->tx_digits[euro->tx_digit_index]); } } diff --git a/src/eurosignal/es_ges.c b/src/eurosignal/es_ges.c index 7e3c58b..59ec760 100644 --- a/src/eurosignal/es_ges.c +++ b/src/eurosignal/es_ges.c @@ -1,4 +1,5 @@ #include <stdint.h> +#include "es_ges.h" static int16_t pattern[] = { 0x003f, 0xff8e, 0x0092, 0x0097, 0x001f, 0x0048, 0xffd9, 0xffdb, diff --git a/src/eurosignal/es_kaudn.c b/src/eurosignal/es_kaudn.c index e4cad88..6e376f5 100644 --- a/src/eurosignal/es_kaudn.c +++ b/src/eurosignal/es_kaudn.c @@ -1,4 +1,5 @@ #include <stdint.h> +#include "es_kaudn.h" static int16_t pattern[] = { 0x0022, 0x0014, 0xffde, 0xff85, 0xff24, 0xff00, 0xff2c, 0xff88, diff --git a/src/eurosignal/es_mitte.c b/src/eurosignal/es_mitte.c index d959002..0ea983a 100644 --- a/src/eurosignal/es_mitte.c +++ b/src/eurosignal/es_mitte.c @@ -1,4 +1,5 @@ #include <stdint.h> +#include "es_mitte.h" static int16_t pattern[] = { 0xff96, 0xffd4, 0x0020, 0x0073, 0x0084, 0x0061, 0x002f, 0xfffd, diff --git a/src/eurosignal/es_teilges.c b/src/eurosignal/es_teilges.c index eab20f1..a4e2296 100644 --- a/src/eurosignal/es_teilges.c +++ b/src/eurosignal/es_teilges.c @@ -1,4 +1,5 @@ #include <stdint.h> +#include "es_teilges.h" static int16_t pattern[] = { 0xffa4, 0xffae, 0xffc2, 0xff8a, 0xffb4, 0xfff0, 0xfffa, 0x0005, diff --git a/src/eurosignal/eurosignal.c b/src/eurosignal/eurosignal.c index 7ab3074..de22668 100644 --- a/src/eurosignal/eurosignal.c +++ b/src/eurosignal/eurosignal.c @@ -26,22 +26,22 @@ #include <errno.h> #include <math.h> #include "../libsample/sample.h" -#include "../libdebug/debug.h" +#include "../liblogging/logging.h" #include "../libmobile/call.h" #include "../libmobile/cause.h" -#include "../libosmocc/message.h" +#include <osmocom/cc/message.h> #include "eurosignal.h" #include "dsp.h" /* announcement timers */ -#define ANSWER_TIME 1.0 /* wait after answer */ -#define OOO_TIME 3.8 /* announcement 1.7 s, pause 2.1 s */ -#define UNASSIGNED_TIME1 2.2 /* announcement 2.2 s s */ -#define UNASSIGNED_TIME2 2.9 /* announcement 2.2 s, pause 0.7 s */ -#define DEGRADED_TIME 4.95 /* announcement 2.25 s, pause 2.7 s */ -#define ACKNOWLEDGE_TIME1 2.8 /* announcement 1.7 s, pause 1.1 s */ -#define ACKNOWLEDGE_TIME2 4.6 /* announcement 1.7 s, pause 2.9 s */ -#define BEEP_TIME 4.0 /* beep after answer */ +#define ANSWER_TIME 1,0 /* wait after answer */ +#define OOO_TIME 3,800000 /* announcement 1.7 s, pause 2.1 s */ +#define UNASSIGNED_TIME1 2,200000 /* announcement 2.2 s s */ +#define UNASSIGNED_TIME2 2,900000 /* announcement 2.2 s, pause 0.7 s */ +#define DEGRADED_TIME 4,950000 /* announcement 2.25 s, pause 2.7 s */ +#define ACKNOWLEDGE_TIME1 2,800000 /* announcement 1.7 s, pause 1.1 s */ +#define ACKNOWLEDGE_TIME2 4,600000 /* announcement 1.7 s, pause 2.9 s */ +#define BEEP_TIME 4,000000 /* beep after answer */ /* these calls are not associated with a transmitter */ euro_call_t *ooo_call_list = NULL; @@ -149,7 +149,7 @@ static void call_new_state(euro_call_t *call, enum euro_call_state new_state) { if (call->state == new_state) return; - PDEBUG(DEURO, DEBUG_DEBUG, "State change: %s -> %s\n", call_state_name(call->state), call_state_name(new_state)); + LOGP(DEURO, LOGL_DEBUG, "State change: %s -> %s\n", call_state_name(call->state), call_state_name(new_state)); call->state = new_state; euro_display_status(); } @@ -234,7 +234,7 @@ void euro_exit(void) flush_id(); } -static void call_timeout(struct timer *timer); +static void call_timeout(void *data); /* Create transceiver instance and link to a list. */ int euro_create(const char *kanal, const char *device, int use_sdr, int samplerate, double rx_gain, double tx_gain, int fm, int tx, int rx, int repeat, int degraded, int random, uint32_t scan_from, uint32_t scan_to, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, const char *read_tx_wave, int loopback) @@ -243,29 +243,29 @@ int euro_create(const char *kanal, const char *device, int use_sdr, int samplera int rc; if (euro_kanal2freq(kanal, 0) == 0.0) { - PDEBUG(DEURO, DEBUG_ERROR, "Channel ('Kanal') number %s invalid, use 'list' to get a list.\n", kanal); + LOGP(DEURO, LOGL_ERROR, "Channel ('Kanal') number %s invalid, use 'list' to get a list.\n", kanal); return -EINVAL; } euro = calloc(1, sizeof(*euro)); if (!euro) { - PDEBUG(DEURO, DEBUG_ERROR, "No memory!\n"); + LOGP(DEURO, LOGL_ERROR, "No memory!\n"); return -ENOMEM; } - PDEBUG(DEURO, DEBUG_DEBUG, "Creating 'Eurosignal' instance for 'Kanal' = %s (sample rate %d).\n", kanal, samplerate); + LOGP(DEURO, LOGL_DEBUG, "Creating 'Eurosignal' instance for 'Kanal' = %s (sample rate %d).\n", kanal, samplerate); /* init general part of transceiver */ rc = sender_create(&euro->sender, kanal, euro_kanal2freq(kanal, fm), euro_kanal2freq(kanal, fm), device, use_sdr, samplerate, rx_gain, tx_gain, 0, 0, write_rx_wave, write_tx_wave, read_rx_wave, read_tx_wave, loopback, PAGING_SIGNAL_NONE); if (rc < 0) { - PDEBUG(DEURO, DEBUG_ERROR, "Failed to init transceiver process!\n"); + LOGP(DEURO, LOGL_ERROR, "Failed to init transceiver process!\n"); goto error; } /* init audio processing */ rc = dsp_init_sender(euro, samplerate, fm); if (rc < 0) { - PDEBUG(DEURO, DEBUG_ERROR, "Failed to init audio processing!\n"); + LOGP(DEURO, LOGL_ERROR, "Failed to init audio processing!\n"); goto error; } @@ -279,7 +279,7 @@ int euro_create(const char *kanal, const char *device, int use_sdr, int samplera euro_display_status(); - PDEBUG(DEURO, DEBUG_NOTICE, "Created 'Kanal' %s\n", kanal); + LOGP(DEURO, LOGL_NOTICE, "Created 'Kanal' %s\n", kanal); return 0; @@ -294,7 +294,7 @@ void euro_destroy(sender_t *sender) { euro_t *euro = (euro_t *) sender; - PDEBUG(DEURO, DEBUG_DEBUG, "Destroying 'Eurosignal' instance for 'Kanal' = %s.\n", sender->kanal); + LOGP(DEURO, LOGL_DEBUG, "Destroying 'Eurosignal' instance for 'Kanal' = %s.\n", sender->kanal); while (euro->call_list) euro_call_destroy(euro->call_list); @@ -308,12 +308,12 @@ static euro_call_t *euro_call_create(euro_t *euro, uint32_t callref, const char { euro_call_t *call, **callp; - PDEBUG(DEURO, DEBUG_INFO, "Creating call instance to page ID '%s'.\n", id); + LOGP(DEURO, LOGL_INFO, "Creating call instance to page ID '%s'.\n", id); /* create */ call = calloc(1, sizeof(*call)); if (!call) { - PDEBUG(DEURO, DEBUG_ERROR, "No mem!\n"); + LOGP(DEURO, LOGL_ERROR, "No mem!\n"); abort(); } @@ -322,8 +322,8 @@ static euro_call_t *euro_call_create(euro_t *euro, uint32_t callref, const char strcpy(call->station_id, id); if (euro) call->page_count = euro->repeat; - timer_init(&call->timer, call_timeout, call); - timer_start(&call->timer, ANSWER_TIME); + osmo_timer_setup(&call->timer, call_timeout, call); + osmo_timer_schedule(&call->timer, ANSWER_TIME); /* link */ call->euro = euro; @@ -347,7 +347,7 @@ static void euro_call_destroy(euro_call_t *call) (*callp) = call->next; /* cleanup */ - timer_exit(&call->timer); + osmo_timer_del(&call->timer); /* destroy */ free(call); @@ -364,12 +364,12 @@ void euro_get_id(euro_t *euro, char *id) if (euro->scan_from < euro->scan_to) { sprintf(id, "%06d", euro->scan_from++); - PDEBUG_CHAN(DEURO, DEBUG_NOTICE, "Transmitting ID '%s'.\n", id); + LOGP_CHAN(DEURO, LOGL_NOTICE, "Transmitting ID '%s'.\n", id); goto encode; } if (euro->sender.loopback) { - PDEBUG_CHAN(DEURO, DEBUG_NOTICE, "Transmitting test ID '123456'.\n"); + LOGP_CHAN(DEURO, LOGL_NOTICE, "Transmitting test ID '123456'.\n"); memcpy(id, "123456", 6); goto encode; } @@ -377,7 +377,7 @@ void euro_get_id(euro_t *euro, char *id) for (call = euro->call_list; call; call = call->next) { if ((call->state == EURO_CALL_ACKNOWLEDGE || call->state == EURO_CALL_RELEASED) && call->page_count) { call->page_count--; - PDEBUG_CHAN(DEURO, DEBUG_NOTICE, "Transmitting ID '%s'.\n", call->station_id); + LOGP_CHAN(DEURO, LOGL_NOTICE, "Transmitting ID '%s'.\n", call->station_id); memcpy(id, call->station_id, 6); if (call->page_count == 0 && call->state == EURO_CALL_RELEASED) euro_call_destroy(call); @@ -400,15 +400,15 @@ void euro_get_id(euro_t *euro, char *id) memcpy(id, euro->random_id, 6); euro->random_count--; if (id[0] == 'R') { - PDEBUG_CHAN(DEURO, DEBUG_NOTICE, "Randomly transmitting Idle sequence.\n"); + LOGP_CHAN(DEURO, LOGL_NOTICE, "Randomly transmitting Idle sequence.\n"); return; } - PDEBUG_CHAN(DEURO, DEBUG_NOTICE, "Randomly transmitting ID '%s'.\n", euro->random_id); + LOGP_CHAN(DEURO, LOGL_NOTICE, "Randomly transmitting ID '%s'.\n", euro->random_id); goto encode; } if (!call) { - PDEBUG_CHAN(DEURO, DEBUG_DEBUG, "Transmitting Idle sequence.\n"); + LOGP_CHAN(DEURO, LOGL_DEBUG, "Transmitting Idle sequence.\n"); memcpy(id, "RIIIII", 6); return; } @@ -432,7 +432,7 @@ void euro_receive_id(euro_t *euro, char *id) int count = 0; if (id[0] == 'R') { - PDEBUG_CHAN(DEURO, DEBUG_DEBUG, "Received Idle sequence'\n"); + LOGP_CHAN(DEURO, LOGL_DEBUG, "Received Idle sequence'\n"); return; } @@ -444,7 +444,7 @@ void euro_receive_id(euro_t *euro, char *id) /* loopback display */ if (euro->sender.loopback) { - PDEBUG_CHAN(DEURO, DEBUG_NOTICE, "Received ID '%s'\n", id); + LOGP_CHAN(DEURO, LOGL_NOTICE, "Received ID '%s'\n", id); return; } @@ -452,12 +452,12 @@ void euro_receive_id(euro_t *euro, char *id) if (id_list) { count = search_id(id); if (!count) { - PDEBUG_CHAN(DEURO, DEBUG_INFO, "Received ID '%s' is not for us.\n", id); + LOGP_CHAN(DEURO, LOGL_INFO, "Received ID '%s' is not for us.\n", id); return; } } - PDEBUG_CHAN(DEURO, DEBUG_NOTICE, "Received ID '%s'\n", id); + LOGP_CHAN(DEURO, LOGL_NOTICE, "Received ID '%s'\n", id); /* we want to send beep via MNCC */ if (id_list) { @@ -475,7 +475,7 @@ void euro_receive_id(euro_t *euro, char *id) return; /* create call and send setup */ - PDEBUG_CHAN(DEURO, DEBUG_INFO, "Sending setup towards network.'\n"); + LOGP_CHAN(DEURO, LOGL_INFO, "Sending setup towards network.'\n"); sprintf(dialing, "%d", count); callref = call_up_setup(call->station_id, dialing, OSMO_CC_NETWORK_EUROSIGNAL_NONE, ""); call = euro_call_create(NULL, callref, id); @@ -549,51 +549,51 @@ void call_down_clock(void) } /* Timeout handling */ -static void call_timeout(struct timer *timer) +static void call_timeout(void *data) { - euro_call_t *call = (euro_call_t *)timer->priv; + euro_call_t *call = data; switch (call->state) { case EURO_CALL_ANSWER: /* if no station is linked to the call, we are out-of-order */ if (!call->euro) { - PDEBUG(DEURO, DEBUG_INFO, "Station is unavailable, playing announcement.\n"); + LOGP(DEURO, LOGL_INFO, "Station is unavailable, playing announcement.\n"); call->announcement_spl = es_ges_spl; call->announcement_size = es_ges_size; call->announcement_index = 0; - timer_start(&call->timer, OOO_TIME); + osmo_timer_schedule(&call->timer, OOO_TIME); call_new_state(call, EURO_CALL_OUTOFORDER); break; } /* if subcriber list is available, but ID is not found, we are unassigned */ if (id_list && !search_id(call->station_id)) { - PDEBUG(DEURO, DEBUG_INFO, "Subscriber unknown, playing announcement.\n"); + LOGP(DEURO, LOGL_INFO, "Subscriber unknown, playing announcement.\n"); call->announcement_spl = es_kaudn_spl; call->announcement_size = es_kaudn_size; call->announcement_index = 0; call->announcement_count = 1; - timer_start(&call->timer, UNASSIGNED_TIME1); + osmo_timer_schedule(&call->timer, UNASSIGNED_TIME1); call_new_state(call, EURO_CALL_UNASSIGNED); break; } /* if station is degraded, play that announcement */ if (call->euro->degraded) { - PDEBUG(DEURO, DEBUG_INFO, "Station is degraded, playing announcement.\n"); + LOGP(DEURO, LOGL_INFO, "Station is degraded, playing announcement.\n"); call->announcement_spl = es_teilges_spl; call->announcement_size = es_teilges_size; call->announcement_index = 0; - timer_start(&call->timer, DEGRADED_TIME); + osmo_timer_schedule(&call->timer, DEGRADED_TIME); call_new_state(call, EURO_CALL_DEGRADED); break; } /* fall through */ case EURO_CALL_DEGRADED: - PDEBUG(DEURO, DEBUG_INFO, "Station acknowledges, playing announcement.\n"); + LOGP(DEURO, LOGL_INFO, "Station acknowledges, playing announcement.\n"); call->announcement_spl = es_mitte_spl; call->announcement_size = es_mitte_size; call->announcement_index = 0; call->announcement_count = 1; - timer_start(&call->timer, ACKNOWLEDGE_TIME1); + osmo_timer_schedule(&call->timer, ACKNOWLEDGE_TIME1); call_new_state(call, EURO_CALL_ACKNOWLEDGE); break; case EURO_CALL_ACKNOWLEDGE: @@ -602,22 +602,22 @@ static void call_timeout(struct timer *timer) call->announcement_size = es_mitte_size; call->announcement_index = 0; call->announcement_count = 2; - timer_start(&call->timer, ACKNOWLEDGE_TIME2); + osmo_timer_schedule(&call->timer, ACKNOWLEDGE_TIME2); break; } if (call->page_count) { - PDEBUG(DEURO, DEBUG_INFO, "Announcement played, receiver has not been paged yet, releasing call.\n"); + LOGP(DEURO, LOGL_INFO, "Announcement played, receiver has not been paged yet, releasing call.\n"); call_up_release(call->callref, CAUSE_NORMAL); call->callref = 0; call_new_state(call, EURO_CALL_RELEASED); break; } - PDEBUG(DEURO, DEBUG_INFO, "Announcement played, receiver has been paged, releasing call.\n"); + LOGP(DEURO, LOGL_INFO, "Announcement played, receiver has been paged, releasing call.\n"); call_up_release(call->callref, CAUSE_NORMAL); euro_call_destroy(call); break; case EURO_CALL_OUTOFORDER: - PDEBUG(DEURO, DEBUG_INFO, "Announcement played, releasing call.\n"); + LOGP(DEURO, LOGL_INFO, "Announcement played, releasing call.\n"); call_up_release(call->callref, CAUSE_NORMAL); euro_call_destroy(call); break; @@ -627,18 +627,18 @@ static void call_timeout(struct timer *timer) call->announcement_size = es_kaudn_size; call->announcement_index = 0; call->announcement_count = 2; - timer_start(&call->timer, UNASSIGNED_TIME2); + osmo_timer_schedule(&call->timer, UNASSIGNED_TIME2); break; } - PDEBUG(DEURO, DEBUG_INFO, "Announcement played, playing again.\n"); + LOGP(DEURO, LOGL_INFO, "Announcement played, playing again.\n"); call->announcement_spl = es_kaudn_spl; call->announcement_size = es_kaudn_size; call->announcement_index = 0; call->announcement_count = 1; - timer_start(&call->timer, UNASSIGNED_TIME1); + osmo_timer_schedule(&call->timer, UNASSIGNED_TIME1); break; case EURO_CALL_BEEPING: - PDEBUG(DEURO, DEBUG_INFO, "Beep played, releasing.\n"); + LOGP(DEURO, LOGL_INFO, "Beep played, releasing.\n"); call_up_release(call->callref, CAUSE_NORMAL); call->callref = 0; euro_call_destroy(call); @@ -670,9 +670,9 @@ int call_down_setup(int callref, const char __attribute__((unused)) *caller_id, /* just (ab)use busy signal when no station is available */ if (!sender) { if (channel) - PDEBUG(DEURO, DEBUG_NOTICE, "Cannot page receiver, because given station not available, rejecting!\n"); + LOGP(DEURO, LOGL_NOTICE, "Cannot page receiver, because given station not available, rejecting!\n"); else - PDEBUG(DEURO, DEBUG_NOTICE, "Cannot page receiver, no station not available, rejecting!\n"); + LOGP(DEURO, LOGL_NOTICE, "Cannot page receiver, no station not available, rejecting!\n"); euro = NULL; } @@ -684,23 +684,23 @@ int call_down_setup(int callref, const char __attribute__((unused)) *caller_id, return 0; } -void call_down_answer(int __attribute__((unused)) callref) +void call_down_answer(int __attribute__((unused)) callref, struct timeval __attribute__((unused)) *tv_meter) { euro_call_t *call; - PDEBUG(DEURO, DEBUG_INFO, "Call has been answered by network.\n"); + LOGP(DEURO, LOGL_INFO, "Call has been answered by network.\n"); for (call = ooo_call_list; call; call = call->next) { if (call->callref == callref) break; } if (!call) { - PDEBUG(DEURO, DEBUG_NOTICE, "Answer from network, but no callref!\n"); + LOGP(DEURO, LOGL_NOTICE, "Answer from network, but no callref!\n"); call_up_release(callref, CAUSE_INVALCALLREF); return; } - timer_start(&call->timer, BEEP_TIME); + osmo_timer_schedule(&call->timer, BEEP_TIME); } static void _release(int callref, int __attribute__((unused)) cause) @@ -709,7 +709,7 @@ static void _release(int callref, int __attribute__((unused)) cause) euro_t *euro; euro_call_t *call; - PDEBUG(DEURO, DEBUG_INFO, "Call has been disconnected by network.\n"); + LOGP(DEURO, LOGL_INFO, "Call has been disconnected by network.\n"); for (sender = sender_head; sender; sender = sender->next) { euro = (euro_t *) sender; @@ -727,7 +727,7 @@ static void _release(int callref, int __attribute__((unused)) cause) } } if (!call) { - PDEBUG(DEURO, DEBUG_NOTICE, "Outgoing disconnect, but no callref!\n"); + LOGP(DEURO, LOGL_NOTICE, "Outgoing disconnect, but no callref!\n"); call_up_release(callref, CAUSE_INVALCALLREF); return; } @@ -760,7 +760,7 @@ void call_down_release(int callref, int cause) } /* Receive audio from call instance. */ -void call_down_audio(int __attribute__((unused)) callref, uint16_t __attribute__((unused)) sequence, uint32_t __attribute__((unused)) timestamp, uint32_t __attribute__((unused)) ssrc, sample_t __attribute__((unused)) *samples, int __attribute__((unused)) count) +void call_down_audio(void __attribute__((unused)) *decoder, void __attribute__((unused)) *decoder_priv, int __attribute__((unused)) callref, uint16_t __attribute__((unused)) sequence, uint8_t __attribute__((unused)) marker, uint32_t __attribute__((unused)) timestamp, uint32_t __attribute__((unused)) ssrc, uint8_t __attribute__((unused)) *payload, int __attribute__((unused)) payload_len) { } diff --git a/src/eurosignal/eurosignal.h b/src/eurosignal/eurosignal.h index bcb2bc1..92dbaba 100644 --- a/src/eurosignal/eurosignal.h +++ b/src/eurosignal/eurosignal.h @@ -1,6 +1,6 @@ #include "../libfm/fm.h" #include "../libmobile/sender.h" -#include "../libtimer/timer.h" +#include <osmocom/core/timer.h> /* current state of transmitter */ enum euro_health_state { @@ -30,7 +30,7 @@ typedef struct euro_call { int callref; /* call reference */ char station_id[7]; /* current station ID */ int page_count; /* number of transmissions left */ - struct timer timer; + struct osmo_timer_list timer; enum euro_call_state state; /* current state */ int announcement_count; /* used to replay annoucements */ int16_t *announcement_spl; /* current sample */ diff --git a/src/eurosignal/main.c b/src/eurosignal/main.c index 8d0b5bc..475b516 100644 --- a/src/eurosignal/main.c +++ b/src/eurosignal/main.c @@ -23,7 +23,7 @@ #include <string.h> #include <errno.h> #include "../libsample/sample.h" -#include "../libdebug/debug.h" +#include "../liblogging/logging.h" #include "../libmobile/call.h" #include "../libmobile/main_mobile.h" #include "../liboptions/options.h" @@ -199,9 +199,11 @@ int main(int argc, char *argv[]) print_help(argv[0]); return 0; } - if (!strcasecmp(kanal[0], "list")) { - euro_list_channels(); - goto fail; + for (i = 0; i < num_kanal; i++) { + if (!strcasecmp(kanal[i], "list")) { + euro_list_channels(); + goto fail; + } } if (use_sdr) { /* set device */ @@ -247,6 +249,7 @@ fail: euro_destroy(sender_head); /* exits */ + main_mobile_exit(); fm_exit(); euro_exit(); |