Nordic stack and drivers for the mbed BLE API. Version to work around build bug.

Dependents:   microbit_rubber_ducky microbit_mouse_BLE microbit_mouse_BLE_daybreak_version microbit_presenter

Fork of nRF51822 by Nordic Semiconductor

Revision:
517:23d16e238129
Parent:
514:a3b6d669c210
Child:
521:1db090c0e563
--- a/source/btle/custom/custom_helper.cpp	Wed Dec 02 12:35:27 2015 +0000
+++ b/source/btle/custom/custom_helper.cpp	Wed Dec 02 12:58:41 2015 +0000
@@ -191,8 +191,6 @@
     @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,9 +202,8 @@
                                      uint8_t                   properties,
                                      SecurityManager::SecurityMode_t       requiredSecurity,
                                      uint8_t                  *p_data,
-                                     uint16_t                  length,
+                                     uint16_t                  min_length,
                                      uint16_t                  max_length,
-                                     bool                      has_variable_len,
                                      const uint8_t            *userDescriptionDescriptorValuePtr,
                                      uint16_t                  userDescriptionDescriptorValueLen,
                                      bool                      readAuthorization,
@@ -245,8 +242,7 @@
     attr_md.wr_auth = writeAuthorization;
 
     attr_md.vloc = BLE_GATTS_VLOC_STACK;
-    /* Always set variable size */
-    attr_md.vlen = has_variable_len;
+    attr_md.vlen = (min_length == max_length) ? 0 : 1;
 
     if (char_props.read || char_props.notify || char_props.indicate) {
         switch (requiredSecurity) {
@@ -296,7 +292,7 @@
 
     attr_char_value.p_uuid    = p_uuid;
     attr_char_value.p_attr_md = &attr_md;
-    attr_char_value.init_len  = length;
+    attr_char_value.init_len  = min_length;
     attr_char_value.max_len   = max_length;
     attr_char_value.p_value   = p_data;
 
@@ -321,27 +317,23 @@
                                   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,
-                                 bool        has_variable_len,
-                                 uint16_t   *p_desc_handle)
+                                             ble_uuid_t *p_uuid,
+                                             uint8_t    *p_data,
+                                             uint16_t    min_length,
+                                             uint16_t    max_length,
+                                             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 = has_variable_len;
+    desc_md.vlen = (min_length == max_length) ? 0 : 1;
 
     /* Make it readable and writable */
     BLE_GAP_CONN_SEC_MODE_SET_OPEN(&desc_md.read_perm);
@@ -351,7 +343,7 @@
 
     attr_desc.p_uuid    = p_uuid;
     attr_desc.p_attr_md = &desc_md;
-    attr_desc.init_len  = length;
+    attr_desc.init_len  = min_length;
     attr_desc.max_len   = max_length;
     attr_desc.p_value   = p_data;