Radiocraft Wireless M-Bus extension module  2.18
List helper functions

These functions are used to manipulate the internal buffer. More...

Functions

static tdef_mbus_frame_list_elemflist_remove_first_element (void)
 Take out the oldest element in the buffer list and return a pointer to it. More...
 
static tdef_mbus_frame_list_elemflist_search_remove (tdef_mbus_slave_address *address)
 Search for and remove element from the buffer list, based on a given slave address, and return a pointer to it. More...
 
static void flist_append (tdef_mbus_frame_list_elem *e)
 Add element containing received frame data to list. More...
 
static int flist_clear (void)
 Clear the internal buffer list. More...
 

Detailed Description

These functions are used to manipulate the internal buffer.

Function Documentation

◆ flist_append()

static void flist_append ( tdef_mbus_frame_list_elem e)
static

Add element containing received frame data to list.

Parameters
[in]ePointer to frame list element to add to list

Definition at line 1346 of file mod_mbus.c.

References mbus_frame_list::counter, mbus_frame_list::discarded, mbus_frame_list::flist_head, mbus_frame_list::flist_tail, mbus_frame_list::frames_max, list_lock, mbus_flist, mbusDebug(), MUTEX_LOCK, MUTEX_UNLOCK, mbus_frame_list_elem::next, mbus_frame_list::overwrite, mbus_frame_list_elem::prev, and read_sem.

Referenced by mbus_th_reader().

◆ flist_clear()

static int flist_clear ( void  )
static

Clear the internal buffer list.

Returns
>0 List was not properly cleared
0 Success
-1 Failure to access list interface

Definition at line 1405 of file mod_mbus.c.

References mbus_frame_list::counter, mbus_frame_list::flist_head, flist_remove_first_element(), mbus_frame_list::flist_tail, list_lock, mbus_flist, mbusDebug(), MUTEX_LOCK, and MUTEX_UNLOCK.

Referenced by mbusStopReader().

◆ flist_remove_first_element()

static tdef_mbus_frame_list_elem* flist_remove_first_element ( void  )
static

Take out the oldest element in the buffer list and return a pointer to it.

Returns
NULL if no element in list
Pointer to element removed

Definition at line 1239 of file mod_mbus.c.

References mbus_frame_list::counter, mbus_frame_list::flist_head, mbus_frame_list::flist_tail, mbus_flist, mbusDebug(), mbus_frame_list_elem::next, and mbus_frame_list_elem::prev.

Referenced by flist_clear(), and flist_search_remove().

◆ flist_search_remove()

static tdef_mbus_frame_list_elem* flist_search_remove ( tdef_mbus_slave_address address)
static

Search for and remove element from the buffer list, based on a given slave address, and return a pointer to it.

Parameters
[in]addressPointer to the given address to search for
Returns
NULL if no matching element was found in the list
Pointer to element removed

Definition at line 1274 of file mod_mbus.c.

References mbus_frame_list::counter, mbus_frame_list::flist_head, flist_remove_first_element(), mbus_frame_list::flist_tail, mbus_frame_list_elem::frame, list_lock, mbus_address_compare(), mbus_flist, mbusDebug(), MUTEX_LOCK, MUTEX_UNLOCK, mbus_frame_list_elem::next, mbus_frame_list_elem::prev, and mbus_slave_address::type.

Referenced by mbusBufferReceive().