High level Bluetooth Low Energy API and radio abstraction layer
Fork of BLE_API by
Diff: ble/GattAttribute.h
- Revision:
- 1179:4ab722f8dca0
- Parent:
- 1161:515032db6feb
- Child:
- 1183:1589830dbdb7
--- a/ble/GattAttribute.h Wed Apr 06 19:15:28 2016 +0100 +++ b/ble/GattAttribute.h Wed Apr 06 19:15:30 2016 +0100 @@ -19,20 +19,9 @@ #include "UUID.h" -/** - * Instances of this class encapsulate the data that belongs to a Bluetooth Low - * Energy attribute. - */ class GattAttribute { public: - /** - * Type for the handle or ID of the attribute in the ATT table. These are - * unique and are usually generated by the underlying BLE stack. - */ typedef uint16_t Handle_t; - /** - * Define the value of an invalid attribute handle. - */ static const Handle_t INVALID_HANDLE = 0x0000; public: @@ -66,103 +55,21 @@ } public: - /** - * Get the attribute's handle in the ATT table. - * - * @return The attribute's handle. - */ - Handle_t getHandle(void) const { - return _handle; - } - - /** - * The UUID of the characteristic that this attribute belongs to. - * - * @return The characteristic's UUID. - */ - const UUID &getUUID(void) const { - return _uuid; - } - - /** - * Get the current length of the attribute value. - * - * @return The current length of the attribute value. - */ - uint16_t getLength(void) const { - return _len; - } - - /** - * Get the maximum length of the attribute value. - * - * The maximum length of the attribute value. - */ - uint16_t getMaxLength(void) const { - return _lenMax; - } - - /** - * Get a pointer to the current length of the attribute value. - * - * @return A pointer to the current length of the attribute value. - */ - uint16_t *getLengthPtr(void) { - return &_len; - } - - /** - * Set the attribute handle. - * - * @param[in] id - * The new attribute handle. - */ - void setHandle(Handle_t id) { - _handle = id; - } - - /** - * Get a pointer to the attribute value. - * - * @return A pointer to the attribute value. - */ - uint8_t *getValuePtr(void) { - return _valuePtr; - } - - /** - * Check whether the length of the attribute's value can change over time. - * - * @return true if the attribute has variable length, false otherwise. - */ - bool hasVariableLength(void) const { - return _hasVariableLen; - } + Handle_t getHandle(void) const {return _handle; } + const UUID &getUUID(void) const {return _uuid; } + uint16_t getLength(void) const {return _len; } + uint16_t getMaxLength(void) const {return _lenMax; } + uint16_t *getLengthPtr(void) {return &_len; } + void setHandle(Handle_t id) {_handle = id; } + uint8_t *getValuePtr(void) {return _valuePtr; } + bool hasVariableLength(void) const {return _hasVariableLen;} private: - /** - * Characteristic's UUID. - */ - UUID _uuid; - /** - * Pointer to the attribute's value. - */ + UUID _uuid; /* Characteristic UUID. */ uint8_t *_valuePtr; - /** - * Maximum length of the value pointed to by GattAttribute::_valuePtr. - */ - uint16_t _lenMax; - /** - * Current length of the value pointed to by GattAttribute::_valuePtr. - */ - uint16_t _len; - /** - * Whether the length of the value can change over time. - */ + uint16_t _lenMax; /* Maximum length of the value. */ + uint16_t _len; /* Current length of the value. */ bool _hasVariableLen; - /** - * The attribute's handle in the ATT table. - */ Handle_t _handle; private: @@ -171,4 +78,4 @@ GattAttribute& operator=(const GattAttribute &); }; -#endif /* ifndef __GATT_ATTRIBUTE_H__ */ \ No newline at end of file +#endif // ifndef __GATT_ATTRIBUTE_H__ \ No newline at end of file