打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
CC2640的SimpleBLEPeripheral 例程中的NOTIFY改成INDICATE呢

参考stack中的BloodPressure例子,注意几点:

1.从他的profile,bpservice.c,可以了解如何定义一个indicaiton.

2.bloodPressure_WriteAttrCB() 中如何enable indicaiton.

case GATT_CLIENT_CHAR_CFG_UUID:
if ( pAttr->handle == bloodPressureAttrTbl[BLOODPRESSURE_MEAS_CONFIG_POS].handle )
{
// BloodPressure Indications
status = GATTServApp_ProcessCCCWriteReq( connHandle, pAttr, pValue, len,
offset, GATT_CLIENT_CFG_INDICATE );
if ( status == SUCCESS )
{
uint16 value = BUILD_UINT16( pValue[0], pValue[1] );

(*bloodPressureServiceCB)( (value == GATT_CFG_NO_OPERATION) ?
BLOODPRESSURE_MEAS_NOTI_DISABLED :
BLOODPRESSURE_MEAS_NOTI_ENABLED);
}
}

3. 如何使用indcation发送数据

bStatus_t BloodPressure_MeasIndicate( uint16 connHandle, attHandleValueInd_t *pNoti,uint8 taskId )
{
uint16 value = GATTServApp_ReadCharCfg( connHandle, bloodPressureMeasConfig );

// If indications enabled
if ( value & GATT_CLIENT_CFG_INDICATE )
{
// Set the handle
pNoti->handle = bloodPressureAttrTbl[BLOODPRESSURE_MEAS_VALUE_POS].handle;

// Send the Indication
return GATT_Indication( connHandle, pNoti, FALSE, taskId );
}

return bleIncorrectMode;
}

4. 如何获得indicaiton的confirm

static void bloodPressureProcessGattMsg( gattMsgEvent_t *pMsg )
{

//Measurement Indication Confirmation
if( pMsg->method == ATT_HANDLE_VALUE_CFM)
{
bpSendStoredMeas();
}

if ( pMsg->method == ATT_HANDLE_VALUE_NOTI ||
pMsg->method == ATT_HANDLE_VALUE_IND )
{
timeAppIndGattMsg( pMsg );
}
else if ( pMsg->method == ATT_READ_RSP ||
pMsg->method == ATT_WRITE_RSP )
{
timeAppConfigState = timeAppConfigGattMsg ( timeAppConfigState, pMsg );
if ( timeAppConfigState == TIMEAPP_CONFIG_CMPL )
{
timeAppDiscoveryCmpl = TRUE;
}
}
else
{
timeAppDiscState = timeAppDiscGattMsg( timeAppDiscState, pMsg );
if ( timeAppDiscState == DISC_IDLE )
{
// Start characteristic configuration
timeAppConfigState = timeAppConfigNext( TIMEAPP_CONFIG_START );
}
}
}

www.deyisupport.com

 

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
BLE
【BLE】CC2541之添加特征值
simpleBLECentral.C简单的翻译一下,方便编程,特此记录
CC2640R2F 添加notify 接口
诊断测试——基于CANoe使用CAPL发送多帧
loadlibrary dll function
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服