diff options
author | Andreas Eversberg <jolly@eversberg.eu> | 2024-04-21 18:56:55 +0200 |
---|---|---|
committer | Andreas Eversberg <jolly@eversberg.eu> | 2024-04-21 21:01:15 +0200 |
commit | a6bf66ee83d768019f69c930ac831b3a4a1fb94a (patch) | |
tree | 1c58ab53df29bee8121232216081143e40cc6197 /src | |
parent | f391c0d9473546a8b77b706baa924b2d23bbca6f (diff) |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/pocsag/frame.c | 20 | ||||
-rw-r--r-- | src/pocsag/pocsag.c | 1 | ||||
-rw-r--r-- | src/pocsag/pocsag.h | 1 |
3 files changed, 6 insertions, 16 deletions
diff --git a/src/pocsag/frame.c b/src/pocsag/frame.c index 858f160..40a2fe4 100644 --- a/src/pocsag/frame.c +++ b/src/pocsag/frame.c @@ -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; } diff --git a/src/pocsag/pocsag.c b/src/pocsag/pocsag.c index a7dd8ab..163d3da 100644 --- a/src/pocsag/pocsag.c +++ b/src/pocsag/pocsag.c @@ -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; diff --git a/src/pocsag/pocsag.h b/src/pocsag/pocsag.h index 34f9cbe..1ebcd76 100644 --- a/src/pocsag/pocsag.h +++ b/src/pocsag/pocsag.h @@ -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; |