请问从机indication主机后,怎么处理主机回复indication确认事件
时间:10-02
整理:3721RD
点击:
static void simpleBLEPeripheral_ProcessOSALMsg( osal_event_hdr_t *pMsg )
{
switch ( pMsg->event )
{
case KEY_CHANGE:
simpleBLEPeripheral_HandleKeys( ((keyChange_t *)pMsg)->state, ((keyChange_t *)pMsg)->keys );
break;
case GATT_MSG_EVENT:
HalLcdWriteString( "Indication_OK", HAL_LCD_LINE_4 );
break;
default:
break;
}
主机回复从机的indication后会触发GATT_MSG_EVENT事件,但如果从机在几秒内没有收到主机的回复,也会触发一次GATT_MSG_EVENT,个人认为是消息接收超时事件,但如何判断是消息接收事件和消息接收超时事件呢,有没有遇到过的同仁,求解答;
另外:
1.消息接收超时从机应该要重新indication主机,如果几秒内需要发送多个indication,第一个接收超时后,应该重新发送第几个indication,怎么处理妥善;
2.听说用notify的人比较多,为什么呢?indication不才是最佳的处理方式吗
参考:
static void simpleBLEPeripheral_ProcessOSALMsg( osal_event_hdr_t *pMsg )
{
switch ( pMsg->event )
{
#if defined( CC2540_MINIDK )
case KEY_CHANGE:
simpleBLEPeripheral_HandleKeys( ((keyChange_t *)pMsg)->state, ((keyChange_t *)pMsg)->keys );
break;
case GATT_MSG_EVENT:
simpleBLEPeripheralProcessGattMsg((gattMsgEvent_t *) pMsg);
break;
#endif // #if defined( CC2540_MINIDK )
default:
// do nothing
break;
}
static void simpleBLEPeripheralProcessGattMsg(gattMsgEvent_t * pMsg)
{
//Message Indication Confirmation
if (pMsg->method == ATT_HANDLE_VALUE_CFM)
{
simpleBLEPeripheralSendIndication();
}
}
static void simpleBLEPeripheralSendIndication()
{
attHandleValueInd_t Indication;
Indication.value = ;
Indication.len = ;
Indication.handle = ;
bStatus_t status;
status = GATT_Indication (gapConnHandle, &Indication, FALSE, simpleBLEPeripheral_TaskID);
}
Hello,WBJ:
当从机接收到主机回复触发的时候会触发
GATT_MSG_EVENT事件;
当从机在3、4秒内没有收到主机的回复也会触发这个事件
GATT_MSG_EVENT;
那么触发了这个事件后,我如何判断是接收到 主机回复触发的呢,还是没有接收到主机回复而超时触发的呢?
if(pMsg->method == ATT_HANDLE_VALUE_CFM);这个是判断是否为主机回复消息
怎么判断没有接收到主机回复超时触发的消息呢
怎么都没有人indication,都是用notify,indication传输不是更加稳定吗