From 5e14471eb6ccfc2210b82043f611eeba0d3f81f2 Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Mon, 16 Oct 2017 13:48:39 -0400 Subject: B-Netz: Fixup of metering pulse --- src/bnetz/bnetz.c | 2 +- src/bnetz/dsp.c | 7 +++++-- src/bnetz/main.c | 6 +++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/bnetz/bnetz.c b/src/bnetz/bnetz.c index a136f85..8aee197 100644 --- a/src/bnetz/bnetz.c +++ b/src/bnetz/bnetz.c @@ -55,7 +55,7 @@ static int new_callref = 0x40000000; #define TRENN_COUNT 4 /* min. 350 ms disconnect "Trennsignal" */ #define TRENN_COUNT_NA 96 /* 12 s disconnect "Trennsignal" if no answer */ -#define METERING_DURATION 0.2 /* duration of metering pulse */ +#define METERING_DURATION 0.140 /* duration of metering pulse (according to FTZ 1727 Pfl 32 Clause 3.2.6.6.1) */ #define METERING_START 1.0 /* start metering 1 second after call start */ const char *bnetz_state_name(enum bnetz_state state) diff --git a/src/bnetz/dsp.c b/src/bnetz/dsp.c index 368ee32..1c9bec3 100644 --- a/src/bnetz/dsp.c +++ b/src/bnetz/dsp.c @@ -47,7 +47,8 @@ #define MAX_MODULATION 3000.0 #define DBM0_DEVIATION 2800.0 /* deviation of dBm0 at 1 kHz */ #define TX_PEAK_FSK (4000.0 / 2000.0 * 1000.0 / DBM0_DEVIATION) -#define TX_PEAK_METER (3000.0 / 2900.0 * 1000.0 / DBM0_DEVIATION) /* FIXME: really 3KHz deviation??? */ +#define TX_PEAK_METER (2000.0 / 2900.0 * 1000.0 / DBM0_DEVIATION) /* FIXME: what is the metering pulse deviation??? we use half of the 4kHz deviation, so we can still use -6dB of the speech level */ +#define DAMPEN_METER 0.5 /* use -6dB to dampen speech while sending metering pulse (according to FTZ 1727 Pfl 32 Clause 3.2.6.6.5) */ #define MAX_DISPLAY 1.4 /* something above dBm0 */ #define BIT_RATE 100.0 #define BIT_ADJUST 0.5 /* full adjustment on bit change */ @@ -284,7 +285,9 @@ static void metering_tone(bnetz_t *bnetz, sample_t *samples, int length) phase = bnetz->meter_phase65536; for (i = 0; i < length; i++) { - *samples++ += dsp_metering[(uint16_t)phase]; + /* Add metering pulse, also dampen audio level by 6 dB */ + *samples = (*samples) * DAMPEN_METER + dsp_metering[(uint16_t)phase]; + samples++; phase += phaseshift; if (phase >= 65536) phase -= 65536; diff --git a/src/bnetz/main.c b/src/bnetz/main.c index d927649..6595e5b 100644 --- a/src/bnetz/main.c +++ b/src/bnetz/main.c @@ -57,9 +57,9 @@ void print_help(const char *arg0) printf(" (Kanal kleiner Leistung).\n"); printf(" -M --gebuehrenimpuls | - | 0\n"); printf(" Send metering pulses every given number of seconds or 0 to turn off.\n"); - printf(" Pulses will only be sent on outgoing calls and only if mobile station\n"); - printf(" supports it and only for outgoing calls. Use negative value to force\n"); - printf(" metering pulses for all phones and all calls. (default = %d)\n", metering); + printf(" Pulses will be sent on outgoing calls only and only if mobile station\n"); + printf(" requests it. Use negative value to force metering pulses for all calls.\n"); + printf(" (default = %d)\n", metering); printf(" -P --paging tone | notone | positive | negative | =:\n"); printf(" Send a tone, give a signal or write to a file when switching to\n"); printf(" channel 19. (paging the phone).\n"); -- cgit v1.2.3