Part Number: CC2540
Hello,
I've done with call callbacks if changed characteristic value with one byte.
I've made same code for long characteristic value, and have trouble, callback don't work. Is the example for callback with long characterisitcs ?
I'd like to send time, and attach some code below.
Table:
...
//******** DATE TIME CHARCACTERISTIC***************
// Characteristic DATE TIME Declaration
{
{ ATT_BT_UUID_SIZE, characterUUID },
GATT_PERMIT_READ,
0,
&sgTimeProps
},
// Characteristic Value DATE TIME
{
{ ATT_BT_UUID_SIZE, DateTimeUUID },
GATT_PERMIT_WRITE|GATT_PERMIT_READ,
0,
sgDateTime
},
// Characteristic DATE TIME configuration
{
{ ATT_BT_UUID_SIZE, clientCharCfgUUID },
GATT_PERMIT_READ | GATT_PERMIT_WRITE,
0,
(uint8 *)&sgDateTimeConfig
},
// Characteristic DATE TIME Description
{
{ ATT_BT_UUID_SIZE, charUserDescUUID },
GATT_PERMIT_READ,
0,
sgTimeDesp
},
...
Add service function:
...
// Allocate Client Characteristic Configuration table
sgDateTimeConfig = (gattCharCfg_t *)osal_mem_alloc( sizeof(gattCharCfg_t) *
linkDBNumConns );
if ( sgDateTimeConfig == NULL )
{
return ( bleMemAllocError );
}
// Initialize Client Characteristic Configuration attributes
GATTServApp_InitCharCfg( INVALID_CONNHANDLE, sgDateTimeConfig );
// Register GATT attribute list and CBs with GATT Server App
status = GATTServApp_RegisterService( SmartGripAttrTbl,
GATT_NUM_ATTRS( SmartGripAttrTbl ),
GATT_MAX_ENCRYPT_KEY_SIZE,
&sgCBs );
...
ReadAttrCB
...
switch ( uuid )
...
case SG_DATE_TIME_UUID:
*pLen = DATE_TIME_CHAR_LEN;
VOID memcpy( pValue, pAttr->pValue, DATE_TIME_CHAR_LEN );
break;
...