aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2016-07-04 07:25:21 +0200
committerAndreas Eversberg <jolly@eversberg.eu>2016-07-24 12:30:56 +0200
commit3ef9ef88bd8974155e423925486ed308217f91c9 (patch)
tree6594fc819a9f5aff8198b972f6570d4bffefd1ad
parent2137db0e01b5b307761798c469bae49249b7e44a (diff)
B-Netz: Compiler switch to generate a dial sequence (for testing)
-rw-r--r--src/bnetz/bnetz.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/bnetz/bnetz.c b/src/bnetz/bnetz.c
index 6c75997..2c96d80 100644
--- a/src/bnetz/bnetz.c
+++ b/src/bnetz/bnetz.c
@@ -29,6 +29,9 @@
#include "bnetz.h"
#include "dsp.h"
+// Uncomment this to generate a dial sequnce (for testing)
+//#define GEN_DIALSEQUENCE
+
/* Call reference for calls from mobile station to network
This offset of 0x400000000 is required for MNCC interface. */
static int new_callref = 0x40000000;
@@ -354,6 +357,12 @@ static void bnetz_go_idle(bnetz_t *bnetz)
bnetz_set_dsp_mode(bnetz, DSP_MODE_TELEGRAMM);
switch_channel_19(bnetz, 0);
bnetz->station_id[0] = '\0';
+#ifdef GEN_DIALSEQUENCE
+ if (bnetz->sender.loopback) {
+ bnetz_set_dsp_mode(bnetz, DSP_MODE_0);
+ timer_start(&bnetz->timer, 0.6);
+ }
+#endif
}
/* Release connection towards mobile station by sending release digits. */
@@ -390,10 +399,21 @@ const char *bnetz_get_telegramm(bnetz_t *bnetz)
struct impulstelegramme *it = NULL;
if (bnetz->sender.loopback) {
+#ifdef GEN_DIALSEQUENCE
+ char *dialstring="s50993310es50993310e", c;
+ c = dialstring[bnetz->loopback_count++];
+ if (c) {
+ it = bnetz_telegramm(c);
+ } else {
+ bnetz_set_dsp_mode(bnetz, DSP_MODE_SILENCE);
+ return NULL;
+ }
+#else
bnetz->loopback_time[bnetz->loopback_count] = get_time();
it = bnetz_telegramm(bnetz->loopback_count + '0');
if (++bnetz->loopback_count > 9)
bnetz->loopback_count = 0;
+#endif
} else
switch(bnetz->state) {
case BNETZ_FREI:
@@ -683,6 +703,11 @@ static void bnetz_timeout(struct timer *timer)
bnetz_t *bnetz = (bnetz_t *)timer->priv;
switch (bnetz->state) {
+#ifdef GEN_DIALSEQUENCE
+ case BNETZ_FREI:
+ bnetz_set_dsp_mode(bnetz, DSP_MODE_TELEGRAMM);
+ break;
+#endif
case BNETZ_WAHLABRUF:
PDEBUG(DBNETZ, DEBUG_NOTICE, "Timeout while receiving call setup from mobile station, aborting.\n");
bnetz_go_idle(bnetz);