Ring Buffer#
API and Callbacks for the Ring Buffer Component.
This component manages a ring buffer of binary entries. Each entry has a 1- or 2-byte length field that is recorded to manage the buffer. This ring buffer can be used by multiple entities as the buffer space for the ring buffer is allocated by the caller.
Modules#
API#
Initialize the ring buffer struct based on data passed. widLengthField determines whether the ring buffer uses 1 or 2 byte length fields for entry. wideLengthField = false uses 1 byte length, wideLengthField = true uses 2 byte lengths. All entries in the same ring buffer utilze the same size length field. Different ring buffers may use differnt sizes.
Add an entry in the ring buffer.
Retrieve data from the specified entry. Returns the entry's total size in value pointed to by returnEntryTotalSize. The amount of data returned is written to the pointer returnDataSize. This allows for the caller to get the entry's total size at the same time they are able to grab a chunk of the entry up to some limit.
Get the last entry of the ring buffer.
Initialize the iterator to the first entry in the ring buffer. You may immediately call sl_zigbee_af_ring_buffer_get_entry_by_iterator() after this function is called.
Iterate to next entry in ring buffer.
Update a ring buffer entry by passing in the iterator.
Append an entry to end of the ring buffer.
Typedefs#
Macros#
API Documentation#
sl_zigbee_af_ring_buffer_init_struct#
sl_status_t sl_zigbee_af_ring_buffer_init_struct (sl_zigbee_ring_buffer_t * ringBufferStruct, bool wideLengthField, sl_zigbee_af_plugin_ring_buffer_delete_function_t * deleteCallback, uint8_t * dataPtr)
Initialize the ring buffer struct based on data passed. widLengthField determines whether the ring buffer uses 1 or 2 byte length fields for entry. wideLengthField = false uses 1 byte length, wideLengthField = true uses 2 byte lengths. All entries in the same ring buffer utilze the same size length field. Different ring buffers may use differnt sizes.
N/A | ringBufferStruct | Ver.: always |
N/A | wideLengthField | Ver.: always |
N/A | deleteCallback | Ver.: always |
N/A | dataPtr | Ver.: always |
Returns
sl_status_t status code
82
of file app/framework/plugin/ring-buffer/ring-buffer.h
sl_zigbee_af_ring_buffer_add_entry#
sl_status_t sl_zigbee_af_ring_buffer_add_entry (sl_zigbee_ring_buffer_t * ring, uint8_t * dataToAdd, uint16_t dataToAddSize)
Add an entry in the ring buffer.
N/A | ring | Ver.: always |
N/A | dataToAdd | Ver.: always |
N/A | dataToAddSize | Ver.: always |
Returns
sl_status_t status code
96
of file app/framework/plugin/ring-buffer/ring-buffer.h
sl_zigbee_af_ring_buffer_get_entry_by_entry_number#
sl_status_t sl_zigbee_af_ring_buffer_get_entry_by_entry_number (sl_zigbee_ring_buffer_t * ring, uint16_t entryNumber, uint16_t dataIndexInEntry, uint16_t * returnEntryTotalSize, uint16_t maxReturnSize, uint16_t * returnDataSize, uint8_t * returnData)
Retrieve data from the specified entry. Returns the entry's total size in value pointed to by returnEntryTotalSize. The amount of data returned is written to the pointer returnDataSize. This allows for the caller to get the entry's total size at the same time they are able to grab a chunk of the entry up to some limit.
N/A | ring | numbering starts from 0 |
N/A | entryNumber | may be set to NULL, in which case no return data is written. |
N/A | dataIndexInEntry | does not include the entry's length overhead, which the caller shouldn't care about anyway. |
N/A | returnEntryTotalSize | |
N/A | maxReturnSize | |
N/A | returnDataSize | |
N/A | returnData |
Returns
sl_status_t status code
115
of file app/framework/plugin/ring-buffer/ring-buffer.h
sl_zigbee_af_ring_buffer_get_last_entry#
sl_status_t sl_zigbee_af_ring_buffer_get_last_entry (sl_zigbee_ring_buffer_t * ring, uint16_t dataIndexInEntry, uint16_t * returnEntryTotalSize, uint16_t maxReturnSize, uint16_t * returnDataSize, uint8_t * returnData)
Get the last entry of the ring buffer.
N/A | ring | Ver.: always |
N/A | dataIndexInEntry | Ver.: always |
N/A | returnEntryTotalSize | Ver.: always |
N/A | maxReturnSize | Ver.: always |
N/A | returnDataSize | Ver.: always |
N/A | returnData | Ver.: always |
Returns
sl_status_t status code
134
of file app/framework/plugin/ring-buffer/ring-buffer.h
sl_zigbee_af_ring_buffer_init_iterator#
sl_status_t sl_zigbee_af_ring_buffer_init_iterator (sl_zigbee_ring_buffer_t * ring)
Initialize the iterator to the first entry in the ring buffer. You may immediately call sl_zigbee_af_ring_buffer_get_entry_by_iterator() after this function is called.
N/A | ring | Ver.: always |
Returns
sl_status_t status code
150
of file app/framework/plugin/ring-buffer/ring-buffer.h
sl_zigbee_af_ring_buffer_iterator_next_entry#
sl_status_t sl_zigbee_af_ring_buffer_iterator_next_entry (sl_zigbee_ring_buffer_t * ring)
Iterate to next entry in ring buffer.
N/A | ring | Ver.: always |
Returns
sl_status_t status code
Note
Return SL_STATUS_IN_PROGRESS if there are more items left to iterate through. Returns SL_STATUS_OK on reaching the last item, and the iterator is marked invalid (needs to be initialized again). Returns SL_STATUS_INVALID_STATE if the iterator has not been initialized. An iterator can also be marked invalid if the ring buffer has deleted the entry that the iterator was currently on.
166
of file app/framework/plugin/ring-buffer/ring-buffer.h
sl_zigbee_af_ring_buffer_get_entry_by_iterator#
sl_status_t sl_zigbee_af_ring_buffer_get_entry_by_iterator (sl_zigbee_ring_buffer_t * ring, uint16_t dataIndexInEntry, uint16_t * returnEntryTotalSize, uint16_t maxReturnSize, uint16_t * returnDataSize, uint8_t * returnData)
Similar to sl_zigbee_af_ring_buffer_get_entry_by_entry_number().
N/A | ring | Ver.: always |
N/A | dataIndexInEntry | Ver.: always |
N/A | returnEntryTotalSize | Ver.: always |
N/A | maxReturnSize | Ver.: always |
N/A | returnDataSize | Ver.: always |
N/A | returnData | Ver.: always |
Returns
sl_status_t status code
Note
The iterator must have already been initialized
182
of file app/framework/plugin/ring-buffer/ring-buffer.h
sl_zigbee_af_ring_buffer_update_entry_by_iterator#
sl_status_t sl_zigbee_af_ring_buffer_update_entry_by_iterator (sl_zigbee_ring_buffer_t * ring, uint16_t dataIndexInEntry, uint8_t * updatedData, uint16_t updatedDataLength)
Update a ring buffer entry by passing in the iterator.
N/A | ring | Ver.: always |
N/A | dataIndexInEntry | Ver.: always |
N/A | updatedData | Ver.: always |
N/A | updatedDataLength | Ver.: always |
Returns
sl_status_t status code
199
of file app/framework/plugin/ring-buffer/ring-buffer.h
sl_zigbee_af_ring_buffer_append_last_entry#
sl_status_t sl_zigbee_af_ring_buffer_append_last_entry (sl_zigbee_ring_buffer_t * ring, uint8_t * dataToAdd, uint16_t dataToAddSize)
Append an entry to end of the ring buffer.
N/A | ring | Ver.: always |
N/A | dataToAdd | Ver.: always |
N/A | dataToAddSize | Ver.: always |
Returns
sl_status_t status code
213
of file app/framework/plugin/ring-buffer/ring-buffer.h
Typedef Documentation#
sl_zigbee_af_plugin_ring_buffer_delete_function_t#
typedef void() sl_zigbee_af_plugin_ring_buffer_delete_function_t(uint16_t entryNumber, uint16_t entrySize) (uint16_t entryNumber, uint16_t entrySize)
41
of file app/framework/plugin/ring-buffer/ring-buffer.h
Macro Definition Documentation#
SL_ZIGBEE_AF_PLUGIN_RING_BUFFER_WIDE_LENGTH_ENTRY_OVERHEAD#
#define SL_ZIGBEE_AF_PLUGIN_RING_BUFFER_WIDE_LENGTH_ENTRY_OVERHEADValue:
2
35
of file app/framework/plugin/ring-buffer/ring-buffer.h
SL_ZIGBEE_AF_PLUGIN_RING_BUFFER_NARROW_LENGTH_ENTRY_OVERHEAD#
#define SL_ZIGBEE_AF_PLUGIN_RING_BUFFER_NARROW_LENGTH_ENTRY_OVERHEADValue:
1
36
of file app/framework/plugin/ring-buffer/ring-buffer.h
SL_ZIGBEE_AF_PLUGIN_RING_BUFFER_MAX_LENGTH_ENTRY_OVERHEAD#
#define SL_ZIGBEE_AF_PLUGIN_RING_BUFFER_MAX_LENGTH_ENTRY_OVERHEADValue:
SL_ZIGBEE_AF_PLUGIN_RING_BUFFER_WIDE_LENGTH_ENTRY_OVERHEAD
38
of file app/framework/plugin/ring-buffer/ring-buffer.h