TI中文支持网
TI专业的中文技术问题搜集分享网站

SimpleBLEPeripheral 蓝牙接收数据字节个数问题

simpleBLECentral    可以通过调用 simpleBLECentralProcessGATTMsg 函数来读出SimpleBLEPeripheral 通过蓝牙发过来的字节数目,

SimpleBLEPeripheral  通过调用什么函数来知道接收到的蓝牙有效数据个数呢?

 

static void simpleBLECentralProcessGATTMsg( gattMsgEvent_t *pMsg )
{
  if ( pMsg->method == ATT_HANDLE_VALUE_NOTI ||
       pMsg->method == ATT_HANDLE_VALUE_IND )
  {
        attHandleValueNoti_t noti;
              
     noti.handle = pMsg->msg.handleValueNoti.handle;
     noti.len = pMsg->msg.handleValueNoti.len;
         osal_memcpy(&noti.value, &pMsg->msg.handleValueNoti.value,noti.len);
     
     sbpSerialAppWrite(noti.value,noti.len);   
  }

}

Barbara Wu:

应为profile定义好了,所以针对不同的profile在pripheral侧已经有定义好的固定的数据长度

建议看

static uint8 simpleProfile_ReadAttrCB( uint16 connHandle, gattAttribute_t *pAttr, uint8 *pValue, uint8 *pLen, uint16 offset, uint8 maxLen )做参考

cedar_xuesong:

回复 Barbara Wu:

二楼正解

这个函数的pLen值,就是你想要的东西

赞(0)
未经允许不得转载:TI中文支持网 » SimpleBLEPeripheral 蓝牙接收数据字节个数问题
分享到: 更多 (0)