This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

cc2540如何接受数据

Other Parts Discussed in Thread: CC2540

用cc2540 如何接受notification or indication类型的数据?

  • 根据蓝牙协议的规定, CC2540作为slave的话只能发送notification 或者indication.

    除非cc2540作为master, 请参考simpleBLECentral的代码, 其中simpleBLECentral.c文件中, 

    simpleBLECentralProcessGATTMsg()函数里面, 

    else if ( pMsg->method == ATT_HANDLE_VALUE_IND )
    {
    // received notification, display the value
    uint8 receivedNotiHandl = pMsg->msg.handleValueInd.handle;


    if( receivedNotiHandl == tempCharHdl )
    {
    tempCharVal = pMsg->msg.handleValueInd.value[0];
    LCD_WRITE_STRING_VALUE( "Temp value:", tempCharVal, 10, HAL_LCD_LINE_1 );
    }
    else if ( receivedNotiHandl == humidCharHdl )
    {
    humidCharVal = pMsg->msg.handleValueInd.value[0];
    LCD_WRITE_STRING_VALUE( "Humid value:", humidCharVal, 10, HAL_LCD_LINE_1 );
    }

    ATT_HandleValueCfm( pMsg->connHandle );

    }