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,16 +368,12 @@ int64_t get_codeword(pocsag_t *pocsag)
default:
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) {
pocsag->current_msg = NULL;
msg->data_index = 0;
if (msg->repeat)
msg->repeat--;
else {
pocsag_msg_destroy(msg);
pocsag_msg_done(pocsag);
}
pocsag_msg_destroy(msg);
pocsag_msg_done(pocsag);
}
/* prevent 'use-after-free' from this point on */
msg = NULL;
@ -406,13 +402,9 @@ int64_t get_codeword(pocsag_t *pocsag)
msg->data_index = 0;
msg->bit_index = 0;
} else {
/* if message is not to be repeated, remove message */
if (msg->repeat)
msg->repeat--;
else {
pocsag_msg_destroy(msg);
pocsag_msg_done(pocsag);
}
/* remove message */
pocsag_msg_destroy(msg);
pocsag_msg_done(pocsag);
/* prevent 'use-after-free' from this point on */
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->ric = ric;
msg->function = function;
msg->repeat = 0;
memcpy(msg->data, message, message_length);
msg->data_length = message_length;
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_index; /* current character transmitting */
int bit_index; /* current bit transmitting */
int repeat; /* how often the message is sent */
char padding; /* EOT or other padding */
} pocsag_msg_t;