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.

CC2541: SimpleBLEPeripheral中peripheralStateNotificationCB回调默认连接了???

Part Number: CC2541

程序跑起来以后,SimpleBLEPeripheral中peripheralStateNotificationCB回调立即默认GAPROLE_CONNECTED连接状态了???是怎么回事,换了好几个模块同样的现象,也有正常的模块,很奇怪为什么会这样???????????求教

  • 现在是周末,明天我看一下,在此之前,请提供更详细的信息

    包括SDK版本

    SimpleBLEPeripheral中peripheralStateNotificationCB回调立即默认GAPROLE_CONNECTED连接状态了

    这是什么意思,还没有建立连接已经出现了GAPROLE_CONNECTED?附上具体的说明及调试信息截图

  • stack1.4.2.2;刚上电这个回调就出现了已连接的情况;

  •    case GAPROLE_CONNECTED:
          {        
            #if (defined HAL_LCD) && (HAL_LCD == TRUE)
              HalLcdWriteString( "Connected",  HAL_LCD_LINE_3 );
            #endif // (defined HAL_LCD) && (HAL_LCD == TRUE)
              
    #ifdef PLUS_BROADCASTER
            // Only turn advertising on for this state when we first connect
            // otherwise, when we go from connected_advertising back to this state
            // we will be turning advertising back on.
            if ( first_conn_flag == 0 ) 
            {
                uint8 advertEnabled = FALSE; // Turn on Advertising
    
                // Disable connectable advertising.
                GAPRole_SetParameter(GAPROLE_ADVERT_ENABLED, sizeof(uint8),
                                     &advertEnabled);
                
                // Set to true for non-connectabel advertising.
                advertEnabled = TRUE;
                
                // Enable non-connectable advertising.
                GAPRole_SetParameter(GAPROLE_ADV_NONCONN_ENABLED, sizeof(uint8),
                                     &advertEnabled);
                
                first_conn_flag = 1;
            }
    #endif // PLUS_BROADCASTER
          simpleBLEState = BLE_STATE_CONNECTED;
          }
          break;

  • 这个模块之前是否和其他模块建立过连接并且绑定了,你完全擦除后重新烧录程序看一下

  • 重新擦除过,仿真器仿真就会执行到这,不清楚什么原因?

  • 只有在已建立连接才会触发GAPROLE_CONNECTED,你用SDK BLE-CC254x-1.5.2.0版本试一下

    或者抓包看一下发生了什么,是否有其他设备已于它建立了连接

  • 恩,谢谢,已经移植到1.5.2上了,还在测,环境中只有WiFi,其它蓝牙设备都断开了;这个建立连接状态会保持么?断电不丢失????没用过sniff抓包,不太会用

  • 断电不会保持,正常应该是状态改变立即会变