Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of BLE_API by
Revision 1020:c8664d12bf10, committed 2015-12-10
- Comitter:
- rgrover1
- Date:
- Thu Dec 10 09:15:02 2015 +0000
- Parent:
- 1019:575852ad31a2
- Child:
- 1021:4dc141889504
- Commit message:
- Synchronized with git rev 35adda98
Author: Rohit Grover
Release 2.1.6
=============
Minor update around GattCharacteristics having variable length.
Changed in this revision
--- a/ble/Gap.h Thu Dec 10 09:15:01 2015 +0000
+++ b/ble/Gap.h Thu Dec 10 09:15:02 2015 +0000
@@ -147,7 +147,7 @@
typedef CallChainOfFunctionPointersWithContext<const ConnectionCallbackParams_t *> ConnectionEventCallbackChain_t;
typedef FunctionPointerWithContext<const DisconnectionCallbackParams_t*> DisconnectionEventCallback_t;
- typedef CallChainOfFunctionPointersWithContext<const DisconnectionCallbackParams_t*> DisconnectionEventCallbackChain_t;
+ typedef CallChainOfFunctionPointersWithContext<const DisconnectionCallbackParams_t*> DisconnectionEventCallbackChain_t;
typedef FunctionPointerWithContext<bool> RadioNotificationEventCallback_t;
@@ -906,7 +906,7 @@
/**
* @brief provide access to the callchain of timeout event callbacks
* It is possible to register callbacks using onTimeout().add(callback);
- * It is possible to unregister callbacks using onTimeout().detach(callback)
+ * It is possible to unregister callbacks using onTimeout().detach(callback)
* @return The timeout event callbacks chain
*/
TimeoutEventCallbackChain_t& onTimeout() {
@@ -925,10 +925,10 @@
/**
* @brief provide access to the callchain of connection event callbacks
* It is possible to register callbacks using onConnection().add(callback);
- * It is possible to unregister callbacks using onConnection().detach(callback)
+ * It is possible to unregister callbacks using onConnection().detach(callback)
* @return The connection event callbacks chain
*/
- ConnectionEventCallbackChain_t& onconnection() {
+ ConnectionEventCallbackChain_t& onConnection() {
return connectionCallChain;
}
@@ -944,7 +944,7 @@
/**
* @brief provide access to the callchain of disconnection event callbacks
* It is possible to register callbacks using onDisconnection().add(callback);
- * It is possible to unregister callbacks using onDisconnection().detach(callback)
+ * It is possible to unregister callbacks using onDisconnection().detach(callback)
* @return The disconnection event callbacks chain
*/
DisconnectionEventCallbackChain_t& onDisconnection() {
--- a/ble/GattAttribute.h Thu Dec 10 09:15:01 2015 +0000
+++ b/ble/GattAttribute.h Thu Dec 10 09:15:02 2015 +0000
@@ -37,6 +37,8 @@
* The length in bytes of this attribute's value.
* @param[in] maxLen
* The max length in bytes of this attribute's value.
+ * @param[in] hasVariableLen
+ * Whether the attribute's value length changes overtime.
*
* @section EXAMPLE
*
@@ -47,25 +49,27 @@
*
* @endcode
*/
- GattAttribute(const UUID &uuid, uint8_t *valuePtr = NULL, uint16_t len = 0, uint16_t maxLen = 0) :
- _uuid(uuid), _valuePtr(valuePtr), _lenMax(maxLen), _len(len), _handle() {
+ GattAttribute(const UUID &uuid, uint8_t *valuePtr = NULL, uint16_t len = 0, uint16_t maxLen = 0, bool hasVariableLen = true) :
+ _uuid(uuid), _valuePtr(valuePtr), _lenMax(maxLen), _len(len), _hasVariableLen(hasVariableLen), _handle() {
/* Empty */
}
public:
- 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; }
+ 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:
- UUID _uuid; /* Characteristic UUID. */
+ UUID _uuid; /* Characteristic UUID. */
uint8_t *_valuePtr;
- uint16_t _lenMax; /* Maximum length of the value. */
- uint16_t _len; /* Current length of the value. */
+ uint16_t _lenMax; /* Maximum length of the value. */
+ uint16_t _len; /* Current length of the value. */
+ bool _hasVariableLen;
Handle_t _handle;
private:
--- a/ble/GattCharacteristic.h Thu Dec 10 09:15:01 2015 +0000
+++ b/ble/GattCharacteristic.h Thu Dec 10 09:15:02 2015 +0000
@@ -311,6 +311,8 @@
* The length in bytes of this characteristic's value.
* @param[in] maxLen
* The max length in bytes of this characteristic's value.
+ * @param[in] hasVariableLen
+ * Whether the attribute's value length changes over time.
* @param[in] props
* The 8-bit field containing the characteristic's properties.
* @param[in] descriptors
@@ -332,8 +334,9 @@
uint16_t maxLen = 0,
uint8_t props = BLE_GATT_CHAR_PROPERTIES_NONE,
GattAttribute *descriptors[] = NULL,
- unsigned numDescriptors = 0) :
- _valueAttribute(uuid, valuePtr, len, maxLen),
+ unsigned numDescriptors = 0,
+ bool hasVariableLen = true) :
+ _valueAttribute(uuid, valuePtr, len, maxLen, hasVariableLen),
_properties(props),
_requiredSecurity(SecurityManager::SECURITY_MODE_ENCRYPTION_OPEN_LINK),
_descriptors(descriptors),
@@ -466,7 +469,7 @@
GattAttribute *descriptors[] = NULL,
unsigned numDescriptors = 0) :
GattCharacteristic(uuid, reinterpret_cast<uint8_t *>(valuePtr), sizeof(T), sizeof(T),
- BLE_GATT_CHAR_PROPERTIES_READ | additionalProperties, descriptors, numDescriptors) {
+ BLE_GATT_CHAR_PROPERTIES_READ | additionalProperties, descriptors, numDescriptors, false) {
/* empty */
}
};
@@ -522,7 +525,7 @@
GattAttribute *descriptors[] = NULL,
unsigned numDescriptors = 0) :
GattCharacteristic(uuid, reinterpret_cast<uint8_t *>(valuePtr), sizeof(T) * NUM_ELEMENTS, sizeof(T) * NUM_ELEMENTS,
- BLE_GATT_CHAR_PROPERTIES_READ | additionalProperties, descriptors, numDescriptors) {
+ BLE_GATT_CHAR_PROPERTIES_READ | additionalProperties, descriptors, numDescriptors, false) {
/* empty */
}
};
--- a/module.json Thu Dec 10 09:15:01 2015 +0000
+++ b/module.json Thu Dec 10 09:15:02 2015 +0000
@@ -1,6 +1,6 @@
{
"name": "ble",
- "version": "2.1.5",
+ "version": "2.1.6",
"description": "The BLE module offers a high level abstraction for using Bluetooth Low Energy on multiple platforms.",
"keywords": [
"Bluetooth",
@@ -26,7 +26,7 @@
"x-nucleo-idb0xa1": "ARMmbed/ble-x-nucleo-idb0xa1"
},
"nrf51822": {
- "ble-nrf51822": "^2.1.1"
+ "ble-nrf51822": "^2.1.2"
},
"cordio": {
"ble-wicentric": "~0.0.4"
