C-Netz: Show debugging for IDLE (LR and LMR) frames

Suppress repeated IDLE frame
pull/6/head
Andreas Eversberg 6 months ago
parent ec286f3d94
commit 7cd3f85294
  1. 2
      src/cnetz/cnetz.c
  2. 2
      src/cnetz/cnetz.h
  3. 19
      src/cnetz/telegramm.c

@ -542,6 +542,8 @@ void cnetz_go_idle(cnetz_t *cnetz)
PDEBUG(DCNETZ, DEBUG_INFO, "Entering IDLE state on channel %s.\n", cnetz->sender.kanal);
cnetz_new_state(cnetz, CNETZ_IDLE);
cnetz->sched_lr_debugged = 0;
cnetz->sched_mlr_debugged = 0;
/* set scheduler to OgK or turn off SpK */
if (cnetz->dsp_mode == DSP_MODE_SPK_K || cnetz->dsp_mode == DSP_MODE_SPK_V) {

@ -97,6 +97,8 @@ struct cnetz {
int sched_r_m; /* Rufblock (0) / Meldeblock (1) */
enum dsp_mode sched_dsp_mode; /* what mode shall be switched to */
int sched_dsp_mode_ts; /* time slot when to switch mode (-1 = don't switch) */
int sched_lr_debugged; /* indicator to prevent debugging all idle frames */
int sched_mlr_debugged; /* indicator to prevent debugging all idle frames */
/* dsp states */
enum dsp_mode dsp_mode; /* current mode: audio, "Telegramm", .... */

@ -632,7 +632,8 @@ static char *assemble_telegramm(const telegramm_t *telegramm, int debug)
abort();
}
PDEBUG(DFRAME, DEBUG_DEBUG, "Coding %s %s\n", definition_opcode[telegramm->opcode].message_name, definition_opcode[telegramm->opcode].message_text);
if (debug)
PDEBUG(DFRAME, DEBUG_INFO, "Coding %s %s\n", definition_opcode[telegramm->opcode].message_name, definition_opcode[telegramm->opcode].message_text);
/* copy opcode */
for (i = 0; i < 6; i++)
@ -847,7 +848,7 @@ static void disassemble_telegramm(telegramm_t *telegramm, const char *bits, int
value = (value << 1) | (bits[i] == '1');
telegramm->opcode = value;
PDEBUG(DFRAME, DEBUG_DEBUG, "Decoding %s %s\n", definition_opcode[telegramm->opcode].message_name, definition_opcode[telegramm->opcode].message_text);
PDEBUG(DFRAME, DEBUG_INFO, "Decoding %s %s\n", definition_opcode[telegramm->opcode].message_name, definition_opcode[telegramm->opcode].message_text);
/* copy parameters */
if (auth && bits[1]) /* auth flag and chip card flag */
@ -1578,6 +1579,7 @@ const char *cnetz_encode_telegramm(cnetz_t *cnetz)
const telegramm_t *telegramm = NULL;
uint8_t opcode;
char *bits;
int debug = 1;
switch (cnetz->dsp_mode) {
case DSP_MODE_OGK:
@ -1600,7 +1602,11 @@ const char *cnetz_encode_telegramm(cnetz_t *cnetz)
return NULL;
opcode = telegramm->opcode;
bits = assemble_telegramm(telegramm, (opcode != OPCODE_LR_R) && (opcode != OPCODE_MLR_M));
if (opcode == OPCODE_LR_R && cnetz->sched_lr_debugged)
debug = 0;
if (opcode == OPCODE_MLR_M && cnetz->sched_mlr_debugged)
debug = 0;
bits = assemble_telegramm(telegramm, debug);
bits = encode(bits);
bits = interleave(bits);
@ -1612,6 +1618,13 @@ const char *cnetz_encode_telegramm(cnetz_t *cnetz)
bits[i] ^= 1;
}
if (opcode == OPCODE_LR_R && !cnetz->sched_lr_debugged)
cnetz->sched_lr_debugged = 1;
if (opcode == OPCODE_MLR_M && !cnetz->sched_mlr_debugged) {
cnetz->sched_mlr_debugged = 1;
PDEBUG(DFRAME, DEBUG_INFO, "Subsequent IDLE frames are not show, to prevent flooding the output.\n");
}
return bits;
}

Loading…
Cancel
Save