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
pull/5427/head
Gabor Kertesz 2017-10-26 10:23:25 +02:00 committed by Martin Kojtal
parent 873d7d10fe
commit 4ffe2aa612
1 changed files with 3 additions and 0 deletions

View File

@ -130,6 +130,9 @@ ble_error_t ArmGattServer::addService(GattService &service)
currAtt->pLen = p_char->getValueAttribute().getLengthPtr(); currAtt->pLen = p_char->getValueAttribute().getLengthPtr();
currAtt->maxLen = p_char->getValueAttribute().getMaxLength(); currAtt->maxLen = p_char->getValueAttribute().getMaxLength();
currAtt->settings = ATTS_SET_WRITE_CBACK | ATTS_SET_READ_CBACK; 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) { if (p_char->getValueAttribute().getUUID().shortOrLong() == UUID::UUID_TYPE_LONG) {
currAtt->settings |= ATTS_SET_UUID_128; currAtt->settings |= ATTS_SET_UUID_128;
} }