我在Central例程中調(diào)用LL_AddWhiteListDevice(PeerAddrDefType,PeerAddrDef);設(shè)置白名單,然后將DEFAULT_DISCOVERY_WHITE_LIST設(shè)置為TRUE。但是依舊可以掃描到其他Peripheral,還請大神指點(diǎn)。以下是相關(guān)代碼:
void Central_Init( )
{
memset(&g_data_update_last, 0, sizeof(data_update_s));
memset(&g_data_update_new, 0, sizeof(data_update_s));
memset(&g_ble_protocol, 0, sizeof(ble_protocol_s));
memset(&g_one_line_data, 0, sizeof(g_one_line_data));
/** default 1 */
setIoDefault();
? centralTaskId = TMOS_ProcessEventRegister( Central_ProcessEvent );
??
? // Setup GAP
? GAP_SetParamValue( TGAP_DISC_SCAN, DEFAULT_SCAN_DURATION );
/// GAP_SetParamValue( TGAP_DISC_SCAN, 200 );
? GAP_SetParamValue( TGAP_CONN_EST_INT_MIN, DEFAULT_MIN_CONNECTION_INTERVAL );
? GAP_SetParamValue( TGAP_CONN_EST_INT_MAX, DEFAULT_MAX_CONNECTION_INTERVAL );
? GAP_SetParamValue( TGAP_CONN_EST_SUPERV_TIMEOUT, DEFAULT_CONNECTION_TIMEOUT );
??
? // Setup the GAP Bond Manager
? {
? ? uint32 passkey = DEFAULT_PASSCODE;
? ? uint8 pairMode = DEFAULT_PAIRING_MODE;
? ? uint8 mitm = DEFAULT_MITM_MODE;
? ? uint8 ioCap = DEFAULT_IO_CAPABILITIES;
? ? uint8 bonding = DEFAULT_BONDING_MODE;
? ??
? ? GAPBondMgr_SetParameter( GAPBOND_CENT_DEFAULT_PASSCODE, sizeof( uint32 ), &passkey );
? ? GAPBondMgr_SetParameter( GAPBOND_CENT_PAIRING_MODE, sizeof( uint8 ), &pairMode );
? ? GAPBondMgr_SetParameter( GAPBOND_CENT_MITM_PROTECTION, sizeof( uint8 ), &mitm );
? ? GAPBondMgr_SetParameter( GAPBOND_CENT_IO_CAPABILITIES, sizeof( uint8 ), &ioCap );
? ? GAPBondMgr_SetParameter( GAPBOND_CENT_BONDING_ENABLED, sizeof( uint8 ), &bonding );
? }??
? // Initialize GATT Client
? GATT_InitClient();
? // Register to receive incoming ATT Indications/Notifications
? GATT_RegisterForInd( centralTaskId );
/** add whitelist */
? ? LL_ClearWhiteList();
? ? LL_AddWhiteListDevice(PeerAddrDefType,PeerAddrDef);
? // Setup a delayed profile startup
? tmos_set_event( centralTaskId, START_DEVICE_EVT );
}