Bluenet
5.7.0
Bluenet, firmware for nRF52 smart home devices
|
CharacteristicBuffer is a byte array with header. More...
#include <cs_CharacteristicBuffer.h>
Public Member Functions | |
void | alloc (cs_buffer_size_t size) |
Allocate the buffer. More... | |
void | clear () |
Clear the buffer. More... | |
bool | lock () |
Lock the buffer. More... | |
bool | unlock () |
Unlock the buffer. More... | |
bool | isLocked () |
Check if buffer is locked. More... | |
cs_data_t | getBuffer (cs_buffer_size_t offset=CS_CHAR_BUFFER_DEFAULT_OFFSET) |
Get the buffer. More... | |
void | getBuffer (buffer_ptr_t &buffer, uint16_t &size, cs_buffer_size_t offset=CS_CHAR_BUFFER_DEFAULT_OFFSET) |
Get the buffer. More... | |
cs_buffer_size_t | size (cs_buffer_size_t offset=CS_CHAR_BUFFER_DEFAULT_OFFSET) |
Get size of the buffer. More... | |
Protected Member Functions | |
CharacteristicBuffer () | |
~CharacteristicBuffer () | |
CharacteristicBuffer (CharacteristicBuffer const &)=delete | |
Copy constructor, singleton, thus made private. More... | |
CharacteristicBuffer & | operator= (CharacteristicBuffer const &)=delete |
Assignment operator, singleton, thus made private. More... | |
Protected Attributes | |
buffer_ptr_t | _buffer = nullptr |
cs_buffer_size_t | _size = 0 |
bool | _locked = false |
CharacteristicBuffer is a byte array with header.
The CharacteristicBuffer is used to put in all kind of data. This data is unorganized. The CharacteristicBuffer can also be accessed through more dedicated structures. This allows to read/write from the buffer directly or other types of sophisticated objects.
The disadvantage is that the data will be overwritten by the different accessors. The advantage is that the data fits actually in the device RAM.
|
protected |
|
protected |
|
protecteddelete |
Copy constructor, singleton, thus made private.
void CharacteristicBuffer::alloc | ( | cs_buffer_size_t | size | ) |
Allocate the buffer.
void CharacteristicBuffer::clear | ( | ) |
Clear the buffer.
void CharacteristicBuffer::getBuffer | ( | buffer_ptr_t & | buffer, |
uint16_t & | size, | ||
cs_buffer_size_t | offset = CS_CHAR_BUFFER_DEFAULT_OFFSET |
||
) |
Get the buffer.
[out] | buffer | Will be set to point to the buffer. |
[out] | size | Will be set to the size of the buffer pointed to. |
[in] | offset | Returned buffer will have this offset from the internal buffer. |
cs_data_t CharacteristicBuffer::getBuffer | ( | cs_buffer_size_t | offset = CS_CHAR_BUFFER_DEFAULT_OFFSET | ) |
Get the buffer.
[in] | offset | Returned buffer will have this offset from the internal buffer. |
bool CharacteristicBuffer::isLocked | ( | ) |
Check if buffer is locked.
bool CharacteristicBuffer::lock | ( | ) |
Lock the buffer.
|
protecteddelete |
Assignment operator, singleton, thus made private.
cs_buffer_size_t CharacteristicBuffer::size | ( | cs_buffer_size_t | offset = CS_CHAR_BUFFER_DEFAULT_OFFSET | ) |
Get size of the buffer.
[in] | offset | Offset from the internal buffer, same as in getBuffer(). |
bool CharacteristicBuffer::unlock | ( | ) |
Unlock the buffer.
|
protected |
|
protected |
|
protected |