emulator: Store LE scan state of virtual controller

The LE command set scan enable can change the scan state of virtual
controller.
This commit is contained in:
Jefferson Delfes 2013-07-03 16:54:53 -04:00 committed by Johan Hedberg
parent ba6460907a
commit 5616bb9686

View File

@ -91,6 +91,8 @@ struct btdev {
uint8_t le_event_mask[8];
uint8_t le_adv_data[31];
uint8_t le_adv_data_len;
uint8_t le_scan_enable;
uint8_t le_filter_dup;
uint8_t le_adv_enable;
uint16_t sync_train_interval;
@ -843,6 +845,7 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode,
const struct bt_hci_cmd_le_set_event_mask *lsem;
const struct bt_hci_cmd_le_set_adv_data *lsad;
const struct bt_hci_cmd_le_set_adv_enable *lsae;
const struct bt_hci_cmd_le_set_scan_enable *lsse;
struct bt_hci_rsp_read_default_link_policy rdlp;
struct bt_hci_rsp_read_stored_link_key rslk;
struct bt_hci_rsp_write_stored_link_key wslk;
@ -1479,7 +1482,14 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode,
case BT_HCI_CMD_LE_SET_SCAN_ENABLE:
if (btdev->type == BTDEV_TYPE_BREDR)
goto unsupported;
status = BT_HCI_ERR_SUCCESS;
lsse = data;
if (btdev->le_scan_enable == lsse->enable)
status = BT_HCI_ERR_COMMAND_DISALLOWED;
else {
btdev->le_scan_enable = lsse->enable;
btdev->le_filter_dup = lsse->filter_dup;
status = BT_HCI_ERR_SUCCESS;
}
cmd_complete(btdev, opcode, &status, sizeof(status));
break;