Hallo,
I have been having a problem with implementing just works (level 2).
When I have the following advertisement parameters connecting and pairing works great:
#define BT_LE_ADV_CONN_NO_ACCEPT_LIST \
BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE|BT_LE_ADV_OPT_ONE_TIME, \
BT_GAP_ADV_FAST_INT_MIN_2, \
BT_GAP_ADV_FAST_INT_MAX_2, NULL)
But when having done that I start using the accept list as blow It is refusing my connection:
But when having done that I start using the accept list as blow It is refusing my connection:
#define BT_LE_ADV_CONN_ACCEPT_LIST \
BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_FILTER_CONN | BT_LE_ADV_OPT_ONE_TIME | BT_LE_ADV_OPT_USE_IDENTITY, \
BT_GAP_ADV_FAST_INT_MIN_2, \
BT_GAP_ADV_FAST_INT_MAX_2, NULL)
This is how I set up my accept list:
In these logs I also see the Bluetooth address of my paired smartphone:
This is how I set up my accept list:
static void setup_accept_list_cb(const struct bt_bond_info *info, void *user_data)
{
int *bond_cnt = user_data;
if ((*bond_cnt) < 0) {
return;
}
int err = bt_le_filter_accept_list_add(&info->addr);
char addr_str[BT_ADDR_LE_STR_LEN];
bt_addr_le_to_str(&info->addr, addr_str, sizeof(addr_str));
printk("Adding to accept list: %s, type: %d\n", addr_str, info->addr.type);
printk("Bond type: %d, addr: %s\n", info->addr.type, addr_str);
if (err) {
printk("Cannot add peer to Filter Accept List (err: %d)\n", err);
(*bond_cnt) = -EIO;
} else {
(*bond_cnt)++;
}
}
static int setup_accept_list(uint8_t local_id)
{
int err = bt_le_filter_accept_list_clear();
if (err) {
printk("Cannot clear Filter Accept List (err: %d)\n", err);
return err;
}
printk("Filter Accept List cleared\n");
int bond_cnt = 0;
bt_foreach_bond(local_id, setup_accept_list_cb, &bond_cnt);
return bond_cnt;
}
After making sure advertisement has stopped and before starting the new advertisement I call:
After making sure advertisement has stopped and before starting the new advertisement I call:
// Build the Filter Accept List
setup_accept_list(BT_ID_DEFAULT);
setup_accept_list(BT_ID_DEFAULT);
printk("Adding to accept list: %s, type: %d\n", addr_str, info->addr.type);
printk("Bond type: %d, addr: %s\n", info->addr.type, addr_str);
On the android side:
D/BluetoothGatt( 4877): onClientConnectionState() - status=133 clientIf=9 device=XX:XX:XX:XX:32:1C
D/[FBP-Android]( 4877): [FBP] onConnectionStateChange:disconnected
D/[FBP-Android]( 4877): [FBP] status: ANDROID_SPECIFIC_ERROR
On the android side:
D/BluetoothGatt( 4877): onClientConnectionState() - status=133 clientIf=9 device=XX:XX:XX:XX:32:1C
D/[FBP-Android]( 4877): [FBP] onConnectionStateChange:disconnected
D/[FBP-Android]( 4877): [FBP] status: ANDROID_SPECIFIC_ERROR