Tool/software: TI C/C++ Compiler
I have a problem to use whitelist on CC2541.
I want to make a connection that the device(phone) which as a master can't scan and connect CC2541 which as a slave only if the device is added into whitelist of CC2541.
Now, I set the advertiser filter scan parameters is GAP_FILTER_POLICY_WHITE. //Allow Scan Request and Connect from White List Only.
After a external trigger, I change advertiser filter scan parameters is GAP_FILTER_POLICY_ALL. // Allow Scan Request from Any, Allow Connect Request from Any (default). And I reenable advert.
But my phone(Android) can't find the CC2541. If I set default advertiser filter scan parameter is GAP_FILTER_POLICY_ALL, my phone can scan CC2541.
/* this code in init */
uint8 adv_filter_policy = GAP_FILTER_POLICY_WHITE;
GAPRole_SetParameter( GAPROLE_ADV_FILTER_POLICY, sizeof( uint8 ), &adv_filter_policy );
/* this code in external trigger */
uint8 u8AdvErt = FALSE;
uint8 adv_filter_policy = GAP_FILTER_POLICY_ALL;
Start_PeripheralTimer(SBP_BINDING_EVT, BINDING_EVT_TIME);
GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &u8AdvErt );
GAPRole_SetParameter( GAPROLE_ADV_FILTER_POLICY, sizeof( uint8 ), &adv_filter_policy );
u8AdvErt = TRUE;
GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &u8AdvErt );
/* this code in init */ uint8 adv_filter_policy = GAP_FILTER_POLICY_WHITE; GAPRole_SetParameter( GAPROLE_ADV_FILTER_POLICY, sizeof( uint8 ), &adv_filter_policy ); /* this code in external trigger */ uint8 u8AdvErt = FALSE; uint8 adv_filter_policy = GAP_FILTER_POLICY_ALL; GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &u8AdvErt ); GAPRole_SetParameter( GAPROLE_ADV_FILTER_POLICY, sizeof( uint8 ), &adv_filter_policy ); u8AdvErt = TRUE; GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &u8AdvErt );
Another question:
How to get phone's MAC addr? I found some advices to use GAPBondMgr_ResolveAddr( uint8 addrType, uint8 *pDevAddr, uint8 *pResolvedAddr ) this function, but what's the para of *pDevAddr?