B-Netz: Rework on dialing start digit: New unknown type added
This commit is contained in:
parent
ce86f62b11
commit
5bbbe11666
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue