108 if (!size_check<T>()) {
110 packet_ptr =
nullptr;
115 packet_ptr =
reinterpret_cast<T*
>(
buff_curr);
150 *
reinterpret_cast<T*
>(
buff_curr) = packet;
A wrapper around a raw uint8_t array (buffer) to easily read, write from it.
Definition: cs_StreamBufferAccessor.h:51
cs_buffer_size_t getSerializedSize() const
Definition: cs_StreamBufferAccessor.h:80
StreamBufferAccessor & get(T *&packet_ptr)
If the stream buffer is in state OK, and remaining packet size is available, assign the packet_ptr to...
Definition: cs_StreamBufferAccessor.h:101
StreamBufferAccessor(cs_data_t data)
Definition: cs_StreamBufferAccessor.h:54
cs_buffer_size_t getBufferSize() const
Definition: cs_StreamBufferAccessor.h:83
buffer_ptr_t buff_curr
Definition: cs_StreamBufferAccessor.h:176
void reset()
Resets the stream buffer accessor to construction state, such that the next operation will read/write...
Definition: cs_StreamBufferAccessor.h:61
cs_ret_code_t assign(buffer_ptr_t buffer, cs_buffer_size_t size)
Binds this stream buffer accessor to the given buffer pointer and tell it that there are size bytes a...
Definition: cs_StreamBufferAccessor.h:71
cs_buffer_size_t getRemainingCapacity() const
Definition: cs_StreamBufferAccessor.h:86
buffer_ptr_t buff_end
Definition: cs_StreamBufferAccessor.h:177
buffer_ptr_t buff_begin
Definition: cs_StreamBufferAccessor.h:175
cs_ret_code_t internal_status
Definition: cs_StreamBufferAccessor.h:179
StreamBufferAccessor(buffer_ptr_t buffer, cs_buffer_size_t size)
Definition: cs_StreamBufferAccessor.h:53
bool size_check()
Definition: cs_StreamBufferAccessor.h:162
void put(T packet)
Put packet into the stream, if possible.
Definition: cs_StreamBufferAccessor.h:147
void increment_buff()
Definition: cs_StreamBufferAccessor.h:167
T get()
Same as the pointer version of get, but this will copy its value into the lvalue its return value is ...
Definition: cs_StreamBufferAccessor.h:129
cs_data_t getSerializedBuffer()
Definition: cs_StreamBufferAccessor.h:89
bool status_check()
Definition: cs_StreamBufferAccessor.h:172
@ ERR_SUCCESS
Definition: cs_ErrorCodes.h:10
@ ERR_NO_SPACE
Definition: cs_ErrorCodes.h:25
uint16_t cs_buffer_size_t
Definition: cs_Typedefs.h:20
uint16_t cs_ret_code_t
Definition: cs_Typedefs.h:21
uint8_t * buffer_ptr_t
Author: Crownstone Team Copyright: Crownstone (https://crownstone.rocks) Date: 10 May....
Definition: cs_Typedefs.h:19
Packets (structs) that are used internally in the firmware, and can be changed freely.
Definition: cs_PacketsInternal.h:27