Other Parts Discussed in Thread: CC2541, CC2650
HI,
I'm trying to implement a feature which will allow the CC2541 to advertise normally initially but as soon as it connects to a device, it saves the device in White List and then changes the advertising mode to White List Only so that in future it can only connect to that particular device.
Here's my current method:
In SensorTag.c, when the cc2541 connects to the device I'm syncing the whitelist
case GAPROLE_CONNECTED:
HalLedSet(HAL_LED_1, HAL_LED_MODE_OFF );
uint8 WL = HCI_LE_ReadWhiteListSizeCmd();
printf("%d", WL); // output = 46339
uint8 syncWL = TRUE;
GAPBondMgr_SetParameter( GAPBOND_AUTO_SYNC_WL, sizeof ( uint8 ), &syncWL );
WL = HCI_LE_ReadWhiteListSizeCmd();
printf("%d", WL); // output = 46337
break;
In peripheral.c, I read the white list count and if it's >0 I switch the advertising to whitelist.
if ( events & START_ADVERTISING_EVT ){
uint8 WL = HCI_LE_ReadWhiteListSizeCmd();
printf("%u", WL); // output = 0
if(WL>0 ){
gapRole_AdvFilterPolicy = GAP_FILTER_POLICY_WHITE;
}
else{
gapRole_AdvFilterPolicy = GAP_FILTER_POLICY_ALL;
}
...
}
My question is that what does HCI_LE_ReadWhiteListSizeCmd() actually return? in SensorTag.c, before autosync it returns value 46339 and after it returns 46337 . But in peripheral.c the returned value is always 0.
how can I make this work?
Thanks