Hi,
I tried adding a characteristic and for some reason it won't show up to the Android app and appears weird when using the BLE Device Monitor. In Android, the characteristic does not show up at all, and in BLE Dev Mon, the item will show up but will not have descriptions, which I'm guessing is related to the same issue. Am I missing some init step? Code is below the images.
in simpleGATTprofile.c:
init global variables:
// Characteristic 6 UUID: 0xFFF6
CONST uint8 simpleProfilechar6UUID[ATT_BT_UUID_SIZE] =
{
LO_UINT16(SIMPLEPROFILE_CHAR6_UUID), HI_UINT16(SIMPLEPROFILE_CHAR6_UUID)
};
...
Create the Profile attribute variables:
// Simple Profile Characteristic 6 Properties
static uint8 simpleProfileChar6Props = GATT_PROP_READ | GATT_PROP_WRITE;
// Characteristic 6 Value
static uint8 simpleProfileChar6[SIMPLEPROFILE_CHAR6_LEN] = { 0 };
// Simple Profile Characteristic 6 User Description
static uint8 simpleProfileChar6UserDesp[] = "Characteristic 6\0";
...
Update the profile attributes table:
// Characteristic 6 Declaration
{
{ ATT_BT_UUID_SIZE, characterUUID },
GATT_PERMIT_READ,
0,
&simpleProfileChar6Props
},
// Characteristic Value 6
{
{ ATT_BT_UUID_SIZE, simpleProfilechar6UUID },
GATT_PERMIT_READ | GATT_PERMIT_WRITE,
0,
simpleProfileChar6
},
// Characteristic 6 User Description
{
{ ATT_BT_UUID_SIZE, charUserDescUUID },
GATT_PERMIT_READ,
0,
simpleProfileChar6UserDesp
},
...
In SimpleProfile_SetParameter:
case SIMPLEPROFILE_CHAR6:
if ( len <= SIMPLEPROFILE_CHAR6_LEN )
{
VOID osal_memcpy( simpleProfileChar6, value, SIMPLEPROFILE_CHAR6_LEN );
}
else
{
ret = bleInvalidRange;
}
break;
...
In SimpleProfile_GetParameter:
case SIMPLEPROFILE_CHAR6:
VOID osal_memcpy( value, simpleProfileChar6, SIMPLEPROFILE_CHAR6_LEN );
break;
...
In simpleProfile_ReadAttrCB:
case SIMPLEPROFILE_CHAR6_UUID:
*pLen = SIMPLEPROFILE_CHAR6_LEN;
VOID osal_memcpy( pValue, pAttr->pValue, SIMPLEPROFILE_CHAR6_LEN );
break;
...
In simpleProfile_WriteAttrCB:
case SIMPLEPROFILE_CHAR6_UUID:
//Validate the value
// Make sure it's not too long
if ( len >= SIMPLEPROFILE_CHAR6_LEN )
{
status = ATT_ERR_INVALID_VALUE_SIZE;
}
//Write the value
if ( status == SUCCESS )
{
uint8 *pCurValue = (uint8 *)pAttr->pValue;
osal_memcpy(pCurValue+offset, pValue, len);
notifyApp = SIMPLEPROFILE_CHAR6;
}
break;
In simpleGATTprofile.h:
#define SIMPLEPROFILE_CHAR6 5 // RW uint8 - Profile Characteristic 6 value
#define SIMPLEPROFILE_CHAR6_UUID 0xFFF6
#define SIMPLEPROFILE_CHAR6_LEN 10
In simpleBLEPeripheral.c: it is initialized in SimpleBLEPeripheral_Init
uint8 charValue6[SIMPLEPROFILE_CHAR6_LEN] = { 0 };
SimpleProfile_SetParameter( SIMPLEPROFILE_CHAR6, SIMPLEPROFILE_CHAR6_LEN, charValue6 );