如何实现自动连接
if ( events & START_DEVICE_EVT )
{
// Start the Device
VOID GAPCentralRole_StartDevice( (gapCentralRoleCB_t *) &simpleBLERoleCB );
// Register with bond manager after starting device
GAPBondMgr_Register( (gapBondCBs_t *) &simpleBLEBondCB );
return ( events ^ START_DEVICE_EVT );
}
if ( events & START_DISCOVERY_EVT )
{
SIMPLEPROFILE_UUID_X = SIMPLEPROFILE_CHAR6_UUID;
simpleBLECentralStartDiscovery();
osal_start_timerEx(simpleBLETaskId,START_SCAN_EVT,300);
return ( events ^ START_DISCOVERY_EVT );
}
if ( events & START_SCAN_EVT ) //自动开始搜索
我看在蓝牙程序中初始化后,立即执行了这个事件,
osal_set_event( simpleBLETaskId, START_DEVICE_EVT );
我在if ( events & START_DISCOVERY_EVT )
{
SIMPLEPROFILE_UUID_X = SIMPLEPROFILE_CHAR6_UUID;
simpleBLECentralStartDiscovery();
osal_start_timerEx(simpleBLETaskId,START_SCAN_EVT,300); ///添加扫描
return ( events ^ START_DISCOVERY_EVT );
}
但是无法扫描啊
Barbara Wu:
注意看SimpleBLECentral例程里面
对向上按键的操作中如何打开扫描的
simpleBLECentral_HandleKeys()中 if ( keys & HAL_KEY_UP )下面