19 #ifndef MBED_GATT_ATTRIBUTE_H__ 20 #define MBED_GATT_ATTRIBUTE_H__ 23 #include "ble/common/BLETypes.h" 116 uint8_t *valuePtr =
nullptr,
119 bool hasVariableLen =
true 125 _hasVariableLen(hasVariableLen),
127 _read_security(Security_t::NONE),
128 _write_allowed(true),
129 _write_security(Security_t::NONE) {
224 return _hasVariableLen;
233 _read_allowed = allow_read;
242 return _read_allowed;
251 _read_security = requirement.
value();
269 _write_allowed = allow_write;
278 return _write_allowed;
287 _write_security = requirement.
value();
328 bool _hasVariableLen;
333 uint8_t _read_allowed:1;
343 uint8_t _write_allowed:1;
void setReadSecurityRequirement(Security_t requirement)
Set the security requirements of the read operations.
void allowWrite(bool allow_write)
Allow or disallow write operation from a client.
Security_t getReadSecurityRequirement() const
Return the security level required by read operations.
Handle_t getHandle() const
Get the attribute's handle in the ATT table.
static const Handle_t INVALID_HANDLE
Invalid attribute handle.
Security requirement that can be attached to an attribute operation.
void allowRead(bool allow_read)
Allow or disallow read operation from a client.
const UUID & getUUID() const
Get the UUID of the attribute.
uint8_t * getValuePtr()
Get a pointer to the attribute value.
LayoutType value() const
Explicit access to the inner value of the SafeEnum instance.
uint16_t getMaxLength() const
Get the maximum length of the attribute value.
type
struct scoped enum wrapped by the class
void setHandle(Handle_t id)
Set the attribute handle.
Representation of a Universally Unique Identifier (UUID).
Representation of a GattServer attribute.
ble::attribute_handle_t Handle_t
Representation of an attribute handle.
uint16_t * getLengthPtr()
Get a pointer to the current length of the attribute value.
Security_t getWriteSecurityRequirement() const
Return the security level required by write operations.
GattAttribute(const UUID &uuid, uint8_t *valuePtr=nullptr, uint16_t len=0, uint16_t maxLen=0, bool hasVariableLen=true)
Construct an attribute.
static const uint8_t size
Number of bits required to store the value.
bool isWriteAllowed() const
Indicate if a client is allowed to write the attribute.
bool isReadAllowed() const
Indicate if a client is allowed to read the attribute.
bool hasVariableLength() const
Check whether the length of the attribute's value can change throughout time.
uint16_t getLength() const
Get the current length of the attribute value.
uint16_t attribute_handle_t
Reference to an attribute in a GATT database.
void setWriteSecurityRequirement(Security_t requirement)
Set the security requirements of the write operations.