有的客户要求能操作清除蓝牙配对信息,可以如下实现;
u8 bt_reset_buff[] = {
0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,
};
void reset_bt_bd(void)
{
for(u8 i=0;i<20;i++) {
vm_write(VM_REMOTE_DB+i,bt_reset_buff,28);
}
}
直接清除VM中的蓝牙信息。
case MSG_BT_REMOTE_INFO:
printf("MSG_BT_REMOTE_INFO\n");
if ((BT_STATUS_CONNECTING == get_bt_connect_status()) ||
(BT_STATUS_TAKEING_PHONE == get_bt_connect_status()) ||
(BT_STATUS_PLAYING_MUSIC == get_bt_connect_status())) { /*连接状态*/
puts("bt_disconnect\n");/*手动断开连接*/
bt_info_clear_flag = 1;
user_send_cmd_prepare(USER_CTRL_DISCONNECTION_HCI, 0, NULL);
}
reset_bt_bd();
break;
调用 reset_bt_bd(); 之前判断下蓝牙是否连接,连接就先断开在清除。