比如我有100字节的数据要发送给手机,通过通知的方式给手机发送,每次发送20字节,五次全部发送完成,应该怎么写?
user5941081:
回复 Alvin Chen:
如果是用这个函数呢?GATTServApp_ProcessCharCfg
Alvin Chen:
回复 user5941081:
如果你有仔细去看函数你就会发现GATTServApp_ProcessCharCfg 用的是gattServApp_SendNotiInd
gattServApp_SendNotiInd 最后用的是GATT_Notification
static bStatus_t gattServApp_SendNotiInd( uint16 connHandle, uint8 cccValue,uint8 authenticated, gattAttribute_t *pAttr,uint8 taskId, pfnGATTReadAttrCB_t pfnReadAttrCB ) {attHandleValueNoti_t noti;uint16 len;bStatus_t status;// If the attribute value is longer than (ATT_MTU - 3) octets, then// only the first (ATT_MTU - 3) octets of this attributes value can// be sent in a notification.noti.pValue = (uint8 *)GATT_bm_alloc( connHandle, ATT_HANDLE_VALUE_NOTI,GATT_MAX_MTU, &len );if ( noti.pValue != NULL ){status = (*pfnReadAttrCB)( connHandle, pAttr, noti.pValue, ¬i.len,0, len, GATT_LOCAL_READ );if ( status == SUCCESS ){noti.handle = pAttr->handle;if ( cccValue & GATT_CLIENT_CFG_NOTIFY ){status = GATT_Notification( connHandle, ¬i, authenticated );}else // GATT_CLIENT_CFG_INDICATE{status = GATT_Indication( connHandle, (attHandleValueInd_t *)¬i,authenticated, taskId );}}if ( status != SUCCESS ){GATT_bm_free( (gattMsg_t *)¬i, ATT_HANDLE_VALUE_NOTI );}}else{status = bleNoResources;}return ( status ); }
user5941081:
回复 Alvin Chen:
我怎么找不到这个函数?