在peripheral例程中查到如下函数
static void peripheralChar4Notify( uint8 *pValue, uint16 len )
{
attHandleValueNoti_t noti;
noti.len = len;
noti.pValue = GATT_bm_alloc( peripheralConnList.connHandle, ATT_HANDLE_VALUE_NOTI, noti.len, NULL, 0 );
tmos_memcpy( noti.pValue, pValue, noti.len );
if( simpleProfile_Notify( peripheralConnList.connHandle, ¬i ) != SUCCESS )
{
GATT_bm_free( (gattMsg_t *)¬i, ATT_HANDLE_VALUE_NOTI );
}
}
然后又调用了:主动通知函数 GATT_Notification:
bStatus_t simpleProfile_Notify( uint16 connHandle, attHandleValueNoti_t *pNoti )
{
uint16 value = GATTServApp_ReadCharCfg( connHandle, simpleProfileChar4Config );
// If notifications enabled
if ( value & GATT_CLIENT_CFG_NOTIFY )
{
// Set the handle
pNoti->handle = simpleProfileAttrTbl[SIMPLEPROFILE_CHAR4_VALUE_POS].handle;
// Send the notification
return GATT_Notification( connHandle, pNoti, FALSE );
}
return bleIncorrectMode;
}
程序中直接调用GATT_Notification函数发送数据,串口调试助手app收不到数据 |