I'm using the TI-BDS-PLUGIN 1.0.4 and am running into an issue related to string characteristics. I added a string characteristic with a field type of "UINT8S" and generated code via the plugin. When i look at the .h file, the length is defined as 1, which seems odd. Furthermore, when i look at the write callback method that was generated, it uses this length of 1 for the parameter copy, so i don't see how one could ever handle a string with more than one character. unless i misunderstand how a string should work in BLE, this seems not quite right.
more generally speaking, when using field values of array or struct, the resulting length seems either to default to 20 or remain at 1.
How does one define the length of characteristics with the TI-BDS-PLUGIN 1.0.4? how would i support variable length?
<Service UID="2af097e0-14d3-4243-86d8-772739f1e723" XMLFile="Services\com.test.service.test.xml" UUIDMode="Short">
<UUIDDisplayMode>Short</UUIDDisplayMode>
<CharacteristicFiles>
<Characteristic UID="82e570b3-7c2f-488c-9836-3e83690c3676" XMLFile="Characteristics\org.bluetooth.characteristic.first_name.xml" UUIDMode="Short" />
</CharacteristicFiles>
</Service>
#define T_FIRST_NAME_LEN 1
static bStatus_t test_WriteAttrCB( uint16_t connHandle, gattAttribute_t *pAttr,
uint8_t *pValue, uint16_t len, uint16_t offset,
uint8_t method )
{
...
else if ( ! memcmp(pAttr->type.uuid, t_First_NameUUID, pAttr->type.len) )
{
if ( offset + len > T_FIRST_NAME_LEN )
{
status = ATT_ERR_INVALID_OFFSET;
}
else
{
// Copy pValue into the variable we point to from the attribute table.
memcpy(pAttr->pValue + offset, pValue, len);
// Only notify application if entire expected value is written
if ( offset + len == T_FIRST_NAME_LEN)
paramID = T_FIRST_NAME_ID;
}
}
...
}