POCSAG: Remove unused "repeat" function

A message can be repeated, but not in that short time of a few seconds.

Pagers may ignore messages if they are received again. The user may
repeat the message, but not the transceiver.
This commit is contained in:
Andreas Eversberg
2024-04-21 18:56:55 +02:00
parent f391c0d947
commit a6bf66ee83
3 changed files with 6 additions and 16 deletions

View File

@@ -368,17 +368,13 @@ int64_t get_codeword(pocsag_t *pocsag)
default: default:
word = CODEWORD_IDLE; /* should never happen */ word = CODEWORD_IDLE; /* should never happen */
} }
/* if message is complete, reset index. if message is not to be repeated, remove message */ /* if message is complete, reset index and remove message */
if (msg->data_index == msg->data_length) { if (msg->data_index == msg->data_length) {
pocsag->current_msg = NULL; pocsag->current_msg = NULL;
msg->data_index = 0; msg->data_index = 0;
if (msg->repeat)
msg->repeat--;
else {
pocsag_msg_destroy(msg); pocsag_msg_destroy(msg);
pocsag_msg_done(pocsag); pocsag_msg_done(pocsag);
} }
}
/* prevent 'use-after-free' from this point on */ /* prevent 'use-after-free' from this point on */
msg = NULL; msg = NULL;
LOGP_CHAN(DPOCSAG, LOGL_DEBUG, "Sending 32 bits of message codeword 0x%08x (frame %d.%d).\n", word, slot, subslot); LOGP_CHAN(DPOCSAG, LOGL_DEBUG, "Sending 32 bits of message codeword 0x%08x (frame %d.%d).\n", word, slot, subslot);
@@ -406,13 +402,9 @@ int64_t get_codeword(pocsag_t *pocsag)
msg->data_index = 0; msg->data_index = 0;
msg->bit_index = 0; msg->bit_index = 0;
} else { } else {
/* if message is not to be repeated, remove message */ /* remove message */
if (msg->repeat)
msg->repeat--;
else {
pocsag_msg_destroy(msg); pocsag_msg_destroy(msg);
pocsag_msg_done(pocsag); pocsag_msg_done(pocsag);
}
/* prevent 'use-after-free' from this point on */ /* prevent 'use-after-free' from this point on */
msg = NULL; msg = NULL;
} }

View File

@@ -225,7 +225,6 @@ static pocsag_msg_t *pocsag_msg_create(pocsag_t *pocsag, uint32_t callref, uint3
msg->callref = callref; msg->callref = callref;
msg->ric = ric; msg->ric = ric;
msg->function = function; msg->function = function;
msg->repeat = 0;
memcpy(msg->data, message, message_length); memcpy(msg->data, message, message_length);
msg->data_length = message_length; msg->data_length = message_length;
msg->padding = pocsag->padding; msg->padding = pocsag->padding;

View File

@@ -33,7 +33,6 @@ typedef struct pocsag_msg {
int data_length; /* length of message that is not 0-terminated */ int data_length; /* length of message that is not 0-terminated */
int data_index; /* current character transmitting */ int data_index; /* current character transmitting */
int bit_index; /* current bit transmitting */ int bit_index; /* current bit transmitting */
int repeat; /* how often the message is sent */
char padding; /* EOT or other padding */ char padding; /* EOT or other padding */
} pocsag_msg_t; } pocsag_msg_t;