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 nRF51822 by
Revision 553:2a413611e569, committed 2016-01-11
- Comitter:
- vcoubard
- Date:
- Mon Jan 11 10:19:11 2016 +0000
- Parent:
- 552:20b282c26f96
- Child:
- 554:05200b69a95f
- Commit message:
- Synchronized with git rev 9620c7a1
Author: Rohit Grover
Release 2.1.2
=============
Minor update around GattCharacteristics having variable length.
Changed in this revision
--- a/module.json Mon Jan 11 10:19:10 2016 +0000
+++ b/module.json Mon Jan 11 10:19:11 2016 +0000
@@ -1,6 +1,6 @@
{
"name": "ble-nrf51822",
- "version": "2.1.1",
+ "version": "2.1.2",
"description": "Nordic stack and drivers for the mbed BLE API.",
"keywords": [
"Bluetooth",
@@ -24,7 +24,7 @@
}
],
"dependencies": {
- "ble": "^2.0.0"
+ "ble": "^2.1.6"
},
"extraIncludes": [
"source/btle",
--- a/source/btle/custom/custom_helper.cpp Mon Jan 11 10:19:10 2016 +0000
+++ b/source/btle/custom/custom_helper.cpp Mon Jan 11 10:19:11 2016 +0000
@@ -191,6 +191,8 @@
@param[in] char_props The characteristic properties, as
defined by ble_gatt_char_props_t
@param[in] max_length The maximum length of this characeristic
+ @param[in] has_variable_len Whether the characteristic data has
+ variable length.
@param[out] p_char_handle
@returns
@@ -204,6 +206,7 @@
uint8_t *p_data,
uint16_t length,
uint16_t max_length,
+ bool has_variable_len,
const uint8_t *userDescriptionDescriptorValuePtr,
uint16_t userDescriptionDescriptorValueLen,
bool readAuthorization,
@@ -243,7 +246,7 @@
attr_md.vloc = BLE_GATTS_VLOC_STACK;
/* Always set variable size */
- attr_md.vlen = 1;
+ attr_md.vlen = has_variable_len;
if (char_props.read || char_props.notify || char_props.indicate) {
switch (requiredSecurity) {
@@ -318,24 +321,27 @@
since 1 is typically used by the primary
service).
@param[in] max_length The maximum length of this descriptor
+ @param[in] has_variable_len Whether the characteristic data has
+ variable length.
@returns
@retval ERROR_NONE Everything executed normally
*/
/**************************************************************************/
error_t custom_add_in_descriptor(uint16_t char_handle,
- ble_uuid_t *p_uuid,
- uint8_t *p_data,
- uint16_t length,
- uint16_t max_length,
- uint16_t *p_desc_handle)
+ ble_uuid_t *p_uuid,
+ uint8_t *p_data,
+ uint16_t length,
+ uint16_t max_length,
+ bool has_variable_len,
+ uint16_t *p_desc_handle)
{
/* Descriptor metadata */
ble_gatts_attr_md_t desc_md = {0};
desc_md.vloc = BLE_GATTS_VLOC_STACK;
/* Always set variable size */
- desc_md.vlen = 1;
+ desc_md.vlen = has_variable_len;
/* Make it readable and writable */
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&desc_md.read_perm);
--- a/source/btle/custom/custom_helper.h Mon Jan 11 10:19:10 2016 +0000
+++ b/source/btle/custom/custom_helper.h Mon Jan 11 10:19:11 2016 +0000
@@ -38,6 +38,7 @@
uint8_t *p_data,
uint16_t length,
uint16_t max_length,
+ bool has_variable_len,
const uint8_t *userDescriptionDescriptorValuePtr,
uint16_t userDescriptionDescriptorValueLen,
bool readAuthorization,
@@ -49,6 +50,7 @@
uint8_t *p_data,
uint16_t length,
uint16_t max_length,
+ bool has_variable_len,
uint16_t *p_desc_handle);
#ifdef __cplusplus
--- a/source/nRF5xGattServer.cpp Mon Jan 11 10:19:10 2016 +0000
+++ b/source/nRF5xGattServer.cpp Mon Jan 11 10:19:11 2016 +0000
@@ -97,6 +97,7 @@
p_char->getValueAttribute().getValuePtr(),
p_char->getValueAttribute().getLength(),
p_char->getValueAttribute().getMaxLength(),
+ p_char->getValueAttribute().hasVariableLength(),
userDescriptionDescriptorValuePtr,
userDescriptionDescriptorValueLen,
p_char->isReadAuthorizationEnabled(),
@@ -129,6 +130,7 @@
p_desc->getValuePtr(),
p_desc->getLength(),
p_desc->getMaxLength(),
+ p_desc->hasVariableLength(),
&nrfDescriptorHandles[descriptorCount]),
BLE_ERROR_PARAM_OUT_OF_RANGE);
