aboutsummaryrefslogtreecommitdiffstats
path: root/src/bnetz
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2016-07-19 20:33:48 +0200
committerAndreas Eversberg <jolly@eversberg.eu>2016-07-24 12:31:06 +0200
commit5bbbe11666720511a1079c042da12baa350737d9 (patch)
treec4c32631c364b67de546531f571674ee5b185cfa /src/bnetz
parentce86f62b1188eb3ffd206ee7d1205eee92efa6d7 (diff)
B-Netz: Rework on dialing start digit: New unknown type added
Diffstat (limited to 'src/bnetz')
-rw-r--r--src/bnetz/bnetz.c48
-rw-r--r--src/bnetz/bnetz.h9
2 files changed, 44 insertions, 13 deletions
diff --git a/src/bnetz/bnetz.c b/src/bnetz/bnetz.c
index 2c96d80..7dd763d 100644
--- a/src/bnetz/bnetz.c
+++ b/src/bnetz/bnetz.c
@@ -87,6 +87,7 @@ static struct impulstelegramme {
/* Signale */
{ 's', "0111001000100010", 0x0000, "Funkwahl ohne Gebuehrenuebermittlung" },
{ 'S', "0111000100100100", 0x0000, "Funkwahl mit Gebuehrenuebermittlung" },
+ { 'U', "0111000010101000", 0x0000, "Funkwahl (unbekannte Variante)" },
{ 'e', "0111010000100001", 0x0000, "Funkwahlende" },
{ 't', "0111010101010101", 0x0000, "Trennsignal/Schlusssignal" },
/* Kanalbefehl B1 */
@@ -555,15 +556,21 @@ void bnetz_receive_telegramm(bnetz_t *bnetz, uint16_t telegramm, double level, d
timer_start(&bnetz->timer, DIALING_TO);
switch (bnetz->dial_mode) {
case DIAL_MODE_START:
- if (digit != 's' && digit != 'S') {
+ switch (digit) {
+ case 's':
+ bnetz->dial_type = DIAL_TYPE_NOMETER;
+ break;
+ case 'S':
+ bnetz->dial_type = DIAL_TYPE_METER;
+ break;
+ case 'U':
+ bnetz->dial_type = DIAL_TYPE_UNKNOWN;
+ break;
+ default:
PDEBUG(DBNETZ, DEBUG_NOTICE, "Received digit that is not a start digit ('Funkwahl'), aborting.\n");
bnetz_go_idle(bnetz);
return;
}
- if (digit == 'S')
- bnetz->dial_metering = 1;
- else
- bnetz->dial_metering = 0;
bnetz->dial_mode = DIAL_MODE_STATIONID;
memset(bnetz->station_id, 0, sizeof(bnetz->station_id));
bnetz->dial_pos = 0;
@@ -605,13 +612,30 @@ void bnetz_receive_telegramm(bnetz_t *bnetz, uint16_t telegramm, double level, d
bnetz->dial_number[bnetz->dial_pos++] = digit;
break;
case DIAL_MODE_START2:
- if (digit != 's' && digit != 'S') {
- PDEBUG(DBNETZ, DEBUG_NOTICE, "Received message that is not a start message('Funkwahl'), aborting.\n");
- bnetz_go_idle(bnetz);
- return;
- }
- if ((digit == 'S' && bnetz->dial_metering != 1) || (digit == 's' && bnetz->dial_metering != 0)) {
- PDEBUG(DBNETZ, DEBUG_NOTICE, "Second received start message('Funkwahl') does not match first one, aborting.\n");
+ switch (digit) {
+ case 's':
+ if (bnetz->dial_type != DIAL_TYPE_NOMETER) {
+ PDEBUG(DBNETZ, DEBUG_NOTICE, "Second received start message('Funkwahl') does not match first one (no metering), aborting.\n");
+ bnetz_go_idle(bnetz);
+ return;
+ }
+ break;
+ case 'S':
+ if (bnetz->dial_type != DIAL_TYPE_METER) {
+ PDEBUG(DBNETZ, DEBUG_NOTICE, "Second received start message('Funkwahl') does not match first one (metering), aborting.\n");
+ bnetz_go_idle(bnetz);
+ return;
+ }
+ break;
+ case 'U':
+ if (bnetz->dial_type != DIAL_TYPE_UNKNOWN) {
+ PDEBUG(DBNETZ, DEBUG_NOTICE, "Second received start message('Funkwahl') does not match first one (unknwon type), aborting.\n");
+ bnetz_go_idle(bnetz);
+ return;
+ }
+ break;
+ default:
+ PDEBUG(DBNETZ, DEBUG_NOTICE, "Received digit that is not a start digit ('Funkwahl'), aborting.\n");
bnetz_go_idle(bnetz);
return;
}
diff --git a/src/bnetz/bnetz.h b/src/bnetz/bnetz.h
index 0ecfec6..62bd18d 100644
--- a/src/bnetz/bnetz.h
+++ b/src/bnetz/bnetz.h
@@ -31,6 +31,13 @@ enum dial_mode {
DIAL_MODE_NUMBER2,
};
+/* current dialing type (metering support) */
+enum dial_type {
+ DIAL_TYPE_NOMETER,
+ DIAL_TYPE_METER,
+ DIAL_TYPE_UNKNOWN,
+};
+
/* current state of paging mobile station */
enum page_mode {
PAGE_MODE_NUMBER,
@@ -53,7 +60,7 @@ typedef struct bnetz {
/* all bnetz states */
enum bnetz_state state; /* main state of sender */
enum dial_mode dial_mode; /* sub state while dialing is received */
- int dial_metering; /* set, if phone supports metering pulses */
+ enum dial_type dial_type; /* defines if mobile supports metering pulses */
char dial_number[14]; /* dial string received */
int dial_pos; /* current position while receiving digits */
char station_id[6]; /* current station ID */