From 4ffe2aa612daeed4fc0e320fdd2a0c1bd3da97f4 Mon Sep 17 00:00:00 2001 From: Gabor Kertesz Date: Thu, 26 Oct 2017 10:23:25 +0200 Subject: [PATCH] Beetle BLE: Fix variable length GATT attribute Variable length flag was lost during attribute settings, so variable length GATT attributes should have been set to the predefined maximum length. This fixes issue #86. Change-Id: Ia0cd236ecd903fdb9e62a21bffef57d1e63764b9 --- .../TARGET_ARM_SSG/TARGET_BEETLE/source/ArmGattServer.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/features/FEATURE_BLE/targets/TARGET_ARM_SSG/TARGET_BEETLE/source/ArmGattServer.cpp b/features/FEATURE_BLE/targets/TARGET_ARM_SSG/TARGET_BEETLE/source/ArmGattServer.cpp index 299b029f4e..ee90a156a2 100644 --- a/features/FEATURE_BLE/targets/TARGET_ARM_SSG/TARGET_BEETLE/source/ArmGattServer.cpp +++ b/features/FEATURE_BLE/targets/TARGET_ARM_SSG/TARGET_BEETLE/source/ArmGattServer.cpp @@ -130,6 +130,9 @@ ble_error_t ArmGattServer::addService(GattService &service) currAtt->pLen = p_char->getValueAttribute().getLengthPtr(); currAtt->maxLen = p_char->getValueAttribute().getMaxLength(); currAtt->settings = ATTS_SET_WRITE_CBACK | ATTS_SET_READ_CBACK; + if (p_char->getValueAttribute().hasVariableLength()) { + currAtt->settings |= ATTS_SET_VARIABLE_LEN; + } if (p_char->getValueAttribute().getUUID().shortOrLong() == UUID::UUID_TYPE_LONG) { currAtt->settings |= ATTS_SET_UUID_128; }