FIFO Queue for CS101 ASDUs (cs101_queue.c).
Used for Class 1 / Class 2 queues in CS101.Slave and user data queue in CS101.Master.
Summary
Functions
Dequeues the oldest ASDU. Returns {:ok, asdu, updated_queue} or :empty.
Enqueues an ASDU into the ring buffer queue.
Matching CS101_Queue_enqueue in cs101_queue.c, when the queue is full (count >= max_size),
the oldest entry in the queue is removed/overwritten to make room for the newest entry.
Flushes all entries from the queue.
Checks whether the queue has a waiting ASDU and returns {boolean(), first_asdu_type_id},
matching CS101_Queue_hasWaitingAsdu in cs101_queue.c.
Types
@type pos_neg_integer() :: integer()
@type t() :: %IEC60870.CS101.Queue{ count: non_neg_integer(), max_size: pos_neg_integer() | pos_integer(), q: :queue.queue(IEC60870.ASDU.t()) }
Functions
@spec dequeue(t()) :: {:ok, IEC60870.ASDU.t(), t()} | :empty
Dequeues the oldest ASDU. Returns {:ok, asdu, updated_queue} or :empty.
@spec enqueue(t(), IEC60870.ASDU.t()) :: {:ok, t()}
Enqueues an ASDU into the ring buffer queue.
Matching CS101_Queue_enqueue in cs101_queue.c, when the queue is full (count >= max_size),
the oldest entry in the queue is removed/overwritten to make room for the newest entry.
Flushes all entries from the queue.
Checks whether the queue has a waiting ASDU and returns {boolean(), first_asdu_type_id},
matching CS101_Queue_hasWaitingAsdu in cs101_queue.c.
@spec size(t()) :: non_neg_integer()