Bluenet  5.7.0
Bluenet, firmware for nRF52 smart home devices
Loading...
Searching...
No Matches
cs_CharacteristicBuffer.h
Go to the documentation of this file.
1/*
2 * Author: Crownstone Team
3 * Copyright: Crownstone (https://crownstone.rocks)
4 * Date: Apr 2, 2015
5 * License: LGPLv3+, Apache License 2.0, and/or MIT (triple-licensed)
6 */
7#pragma once
8
10
15#define CS_CHAR_BUFFER_DEFAULT_OFFSET 8
16
28
29protected:
32 bool _locked = false;
33
36
39
42
43public:
48
52 void clear();
53
59 bool lock();
60
66 bool unlock();
67
73 bool isLocked();
74
82
91
99};
CharacteristicBuffer is a byte array with header.
Definition: cs_CharacteristicBuffer.h:27
bool lock()
Lock the buffer.
CharacteristicBuffer(CharacteristicBuffer const &)=delete
Copy constructor, singleton, thus made private.
bool isLocked()
Check if buffer is locked.
bool _locked
Definition: cs_CharacteristicBuffer.h:32
void alloc(cs_buffer_size_t size)
Allocate the buffer.
void clear()
Clear the buffer.
CharacteristicBuffer & operator=(CharacteristicBuffer const &)=delete
Assignment operator, singleton, thus made private.
cs_buffer_size_t _size
Definition: cs_CharacteristicBuffer.h:31
buffer_ptr_t _buffer
Definition: cs_CharacteristicBuffer.h:30
cs_data_t getBuffer(cs_buffer_size_t offset=CS_CHAR_BUFFER_DEFAULT_OFFSET)
Get the buffer.
void getBuffer(buffer_ptr_t &buffer, uint16_t &size, cs_buffer_size_t offset=CS_CHAR_BUFFER_DEFAULT_OFFSET)
Get the buffer.
bool unlock()
Unlock the buffer.
cs_buffer_size_t size(cs_buffer_size_t offset=CS_CHAR_BUFFER_DEFAULT_OFFSET)
Get size of the buffer.
#define CS_CHAR_BUFFER_DEFAULT_OFFSET
Size of the header used for long write.
Definition: cs_CharacteristicBuffer.h:15
uint16_t cs_buffer_size_t
Definition: cs_Typedefs.h:20
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