Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ba32e125 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes I83e8e7b4,I12bade3d

* changes:
  Rootcanal: Use PDL to parse incoming commands
  HCI: Implement 36 Le commands and events
parents 87bcf253 b439c051
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -590,7 +590,7 @@ struct Controller::impl {
      OP_CODE_MAPPING(LE_READ_SUGGESTED_DEFAULT_DATA_LENGTH)
      OP_CODE_MAPPING(LE_WRITE_SUGGESTED_DEFAULT_DATA_LENGTH)
      OP_CODE_MAPPING(LE_READ_LOCAL_P_256_PUBLIC_KEY_COMMAND)
      OP_CODE_MAPPING(LE_GENERATE_DHKEY_COMMAND)
      OP_CODE_MAPPING(LE_GENERATE_DHKEY_COMMAND_V1)
      OP_CODE_MAPPING(LE_ADD_DEVICE_TO_RESOLVING_LIST)
      OP_CODE_MAPPING(LE_REMOVE_DEVICE_FROM_RESOLVING_LIST)
      OP_CODE_MAPPING(LE_CLEAR_RESOLVING_LIST)
@@ -631,6 +631,7 @@ struct Controller::impl {
      OP_CODE_MAPPING(LE_READ_RF_PATH_COMPENSATION_POWER)
      OP_CODE_MAPPING(LE_WRITE_RF_PATH_COMPENSATION_POWER)
      OP_CODE_MAPPING(LE_SET_PRIVACY_MODE)
      OP_CODE_MAPPING(LE_GENERATE_DHKEY_COMMAND)
      // vendor specific
      case OpCode::LE_GET_VENDOR_CAPABILITIES:
        return vendor_capabilities_.is_supported_ == 0x01;
+175 −32
Original line number Diff line number Diff line
@@ -263,7 +263,7 @@ enum OpCode : 16 {
  LE_READ_SUGGESTED_DEFAULT_DATA_LENGTH = 0x2023,
  LE_WRITE_SUGGESTED_DEFAULT_DATA_LENGTH = 0x2024,
  LE_READ_LOCAL_P_256_PUBLIC_KEY_COMMAND = 0x2025,
  LE_GENERATE_DHKEY_COMMAND = 0x2026,
  LE_GENERATE_DHKEY_COMMAND_V1 = 0x2026,
  LE_ADD_DEVICE_TO_RESOLVING_LIST = 0x2027,
  LE_REMOVE_DEVICE_FROM_RESOLVING_LIST = 0x2028,
  LE_CLEAR_RESOLVING_LIST = 0x2029,
@@ -304,6 +304,7 @@ enum OpCode : 16 {
  LE_READ_RF_PATH_COMPENSATION_POWER = 0x204C,
  LE_WRITE_RF_PATH_COMPENSATION_POWER = 0x204D,
  LE_SET_PRIVACY_MODE = 0x204E,
  LE_GENERATE_DHKEY_COMMAND = 0x205E,

  // VENDOR_SPECIFIC
  LE_GET_VENDOR_CAPABILITIES = 0xFD53,
@@ -493,7 +494,7 @@ enum OpCodeIndex : 16 {
  LE_READ_SUGGESTED_DEFAULT_DATA_LENGTH = 337,
  LE_WRITE_SUGGESTED_DEFAULT_DATA_LENGTH = 340,
  LE_READ_LOCAL_P_256_PUBLIC_KEY_COMMAND = 341,
  LE_GENERATE_DHKEY_COMMAND = 342,
  LE_GENERATE_DHKEY_COMMAND_V1 = 342,
  LE_ADD_DEVICE_TO_RESOLVING_LIST = 343,
  LE_REMOVE_DEVICE_FROM_RESOLVING_LIST = 344,
  LE_CLEAR_RESOLVING_LIST = 345,
@@ -534,6 +535,7 @@ enum OpCodeIndex : 16 {
  LE_READ_RF_PATH_COMPENSATION_POWER = 390,
  LE_WRITE_RF_PATH_COMPENSATION_POWER = 391,
  LE_SET_PRIVACY_MODE = 392,
  LE_GENERATE_DHKEY_COMMAND = 412,
}

packet CommandPacket {
@@ -1369,12 +1371,25 @@ packet FlushComplete : CommandComplete (command_op_code = FLUSH) {
  _reserved_ : 4,
}

enum PinType : 8 {
  VARIABLE = 0,
  FIXED = 1,
}

packet ReadPinType : CommandPacket (op_code = READ_PIN_TYPE) {
  _payload_,  // placeholder (unimplemented)
}

packet ReadPinTypeComplete : CommandComplete (command_op_code = READ_PIN_TYPE) {
  status : ErrorCode,
  pin_type : PinType,
}

packet WritePinType : CommandPacket (op_code = WRITE_PIN_TYPE) {
  _payload_,  // placeholder (unimplemented)
  pin_type : PinType,
}

packet WritePinTypeComplete : CommandComplete (command_op_code = WRITE_PIN_TYPE) {
  status : ErrorCode,
}

packet CreateNewUnitKey : CommandPacket (op_code = CREATE_NEW_UNIT_KEY) {
@@ -1444,11 +1459,19 @@ packet ReadLocalNameComplete : CommandComplete (command_op_code = READ_LOCAL_NAM
}

packet ReadConnectionAcceptTimeout : ConnectionManagementCommand (op_code = READ_CONNECTION_ACCEPT_TIMEOUT) {
  _payload_,  // placeholder (unimplemented)
}

packet ReadConnectionAcceptTimeoutComplete : CommandComplete (command_op_code = READ_CONNECTION_ACCEPT_TIMEOUT) {
  status : ErrorCode,
  conn_accept_timeout : 16, // 0x0001 to 0xB540 (N * 0.625 ms) 0.625 ms to 29 s
}

packet WriteConnectionAcceptTimeout : ConnectionManagementCommand (op_code = WRITE_CONNECTION_ACCEPT_TIMEOUT) {
  _payload_,  // placeholder (unimplemented)
  conn_accept_timeout : 16, // 0x0001 to 0xB540 (N * 0.625 ms) 0.625 ms to 29 s, Default 0x1FA0, 5.06s
}

packet WriteConnectionAcceptTimeoutComplete : CommandComplete (command_op_code = WRITE_CONNECTION_ACCEPT_TIMEOUT) {
  status : ErrorCode,
}

packet ReadPageTimeout : DiscoveryCommand (op_code = READ_PAGE_TIMEOUT) {
@@ -1724,7 +1747,11 @@ packet WriteCurrentIacLapComplete : CommandComplete (command_op_code = WRITE_CUR
}

packet SetAfhHostChannelClassification : CommandPacket (op_code = SET_AFH_HOST_CHANNEL_CLASSIFICATION) {
  _payload_,  // placeholder (unimplemented)
  afh_host_channel_classification : 8[10],
}

packet SetAfhHostChannelClassificationComplete : CommandComplete (command_op_code = SET_AFH_HOST_CHANNEL_CLASSIFICATION) {
  status : ErrorCode,
}

enum InquiryScanType : 8 {
@@ -2437,19 +2464,36 @@ packet LeConnectionUpdateStatus : CommandStatus (command_op_code = LE_CONNECTION
}

packet LeSetHostChannelClassification : LeConnectionManagementCommand (op_code = LE_SET_HOST_CHANNEL_CLASSIFICATION) {
  _payload_,  // placeholder (unimplemented)
  channel_map : 8[5],
}

packet LeSetHostChannelClassificationComplete : CommandComplete (command_op_code = LE_SET_HOST_CHANNEL_CLASSIFICATION) {
  status : ErrorCode,
}

packet LeReadChannelMap : LeConnectionManagementCommand (op_code = LE_READ_CHANNEL_MAP) {
  _payload_,  // placeholder (unimplemented)
}

packet LeReadChannelMapComplete : CommandComplete (command_op_code = LE_SET_HOST_CHANNEL_CLASSIFICATION) {
  status : ErrorCode,
  connection_handle : 12,
  _reserved_ : 4,
  channel_map : 8[5],
}

packet LeReadRemoteFeatures : LeConnectionManagementCommand (op_code = LE_READ_REMOTE_FEATURES) {
  _payload_,  // placeholder (unimplemented)
  connection_handle : 12,
  _reserved_ : 4,
}

packet LeEncrypt : LeSecurityCommand (op_code = LE_ENCRYPT) {
  _payload_,  // placeholder (unimplemented)
  key : 8[16],
  plaintext_data : 8[16],
}

packet LeEncryptComplete : CommandComplete (command_op_code = LE_ENCRYPT) {
  status : ErrorCode,
  encrypted_data : 8[16],
}

packet LeRand : LeSecurityCommand (op_code = LE_RAND) {
@@ -2475,8 +2519,21 @@ packet LeLongTermKeyRequestReply : LeSecurityCommand (op_code = LE_LONG_TERM_KEY
  long_term_key: 8[16],
}

packet LeLongTermKeyRequestReplyComplete : CommandComplete (command_op_code = LE_LONG_TERM_KEY_REQUEST_REPLY) {
  status : ErrorCode,
  connection_handle : 12,
  _reserved_ : 4,
}

packet LeLongTermKeyRequestNegativeReply : LeSecurityCommand (op_code = LE_LONG_TERM_KEY_REQUEST_NEGATIVE_REPLY) {
  _payload_,  // placeholder (unimplemented)
  connection_handle : 12,
  _reserved_ : 4,
}

packet LeLongTermKeyRequestNegativeReplyComplete : CommandComplete (command_op_code = LE_LONG_TERM_KEY_REQUEST_NEGATIVE_REPLY) {
  status : ErrorCode,
  connection_handle : 12,
  _reserved_ : 4,
}

packet LeReadSupportedStates : CommandPacket (op_code = LE_READ_SUPPORTED_STATES) {
@@ -2500,36 +2557,80 @@ packet LeTestEnd : CommandPacket (op_code = LE_TEST_END) {
}

packet LeRemoteConnectionParameterRequestReply : LeConnectionManagementCommand (op_code = LE_REMOTE_CONNECTION_PARAMETER_REQUEST_REPLY) {
  _payload_,  // placeholder (unimplemented)
  connection_handle : 12,
  _reserved_ : 4,
  interval_min : 16, // 0x0006-0x0C80 (7.5ms to 4s)
  interval_max : 16, // 0x0006-0x0C80 (7.5ms to 4s)
  latency : 16, // 0x0006-0x01F3
  timeout : 16, // 0x00A to 0x0C80 (100ms to 32s)
  minimum_ce_length : 16, // 0.625ms
  maximum_ce_length : 16, // 0.625ms
}

packet LeRemoteConnectionParameterRequestReplyComplete : CommandComplete (command_op_code = LE_REMOTE_CONNECTION_PARAMETER_REQUEST_REPLY) {
  status : ErrorCode,
  connection_handle : 12,
  _reserved_ : 4,
}

packet LeRemoteConnectionParameterRequestNegativeReply : LeConnectionManagementCommand (op_code = LE_REMOTE_CONNECTION_PARAMETER_REQUEST_NEGATIVE_REPLY) {
  _payload_,  // placeholder (unimplemented)
  connection_handle : 12,
  _reserved_ : 4,
  reason : ErrorCode,
}

packet LeRemoteConnectionParameterRequestNegativeReplyComplete : CommandComplete (command_op_code = LE_REMOTE_CONNECTION_PARAMETER_REQUEST_NEGATIVE_REPLY) {
  status : ErrorCode,
  connection_handle : 12,
  _reserved_ : 4,
}

packet LeSetDataLength : LeConnectionManagementCommand (op_code = LE_SET_DATA_LENGTH) {
  _payload_,  // placeholder (unimplemented)
  connection_handle : 12,
  _reserved_ : 4,
  tx_octets : 16, // payload octets per single PDU 0x1B to 0x00FB
  tx_time : 16, // microseconds used to transmit a single PDU 0x0148 to 0x4290
}

packet LeSetDataLengthComplete : CommandComplete (command_op_code = LE_SET_DATA_LENGTH) {
  status : ErrorCode,
  connection_handle : 12,
  _reserved_ : 4,
}

packet LeReadSuggestedDefaultDataLength : LeConnectionManagementCommand (op_code = LE_READ_SUGGESTED_DEFAULT_DATA_LENGTH) {
  _payload_,  // placeholder (unimplemented)
}

packet LeReadSuggestedDefaultDataLengthComplete : CommandComplete (command_op_code = LE_READ_SUGGESTED_DEFAULT_DATA_LENGTH) {
  status : ErrorCode,
  tx_octets : 16, // payload octets per single PDU 0x1B to 0x00FB
  tx_time : 16, // microseconds used to transmit a single PDU 0x0148 to 0x4290
}

packet LeWriteSuggestedDefaultDataLength : LeConnectionManagementCommand (op_code = LE_WRITE_SUGGESTED_DEFAULT_DATA_LENGTH) {
  _payload_,  // placeholder (unimplemented)
  tx_octets : 16, // payload octets per single PDU 0x1B to 0x00FB
  tx_time : 16, // microseconds used to transmit a single PDU 0x0148 to 0x4290
}

packet LeWriteSuggestedDefaultDataLengthComplete : CommandComplete (command_op_code = LE_WRITE_SUGGESTED_DEFAULT_DATA_LENGTH) {
  status : ErrorCode,
}

packet LeReadLocalP256PublicKeyCommand : LeSecurityCommand (op_code = LE_READ_LOCAL_P_256_PUBLIC_KEY_COMMAND) {
  _payload_,  // placeholder (unimplemented)
}

packet LeGenerateDhkeyCommand : LeSecurityCommand (op_code = LE_GENERATE_DHKEY_COMMAND) {
  _payload_,  // placeholder (unimplemented)
packet LeGenerateDhkeyV1Command : LeSecurityCommand (op_code = LE_GENERATE_DHKEY_COMMAND_V1) {
  remote_p_256_public_key : 8[64],
}

packet LeGenerateDhkeyV1CommandStatus : CommandStatus (command_op_code = LE_GENERATE_DHKEY_COMMAND_V1) {
}

packet LeAddDeviceToResolvingList : LeSecurityCommand (op_code = LE_ADD_DEVICE_TO_RESOLVING_LIST) {
  _payload_,  // placeholder (unimplemented)
  peer_identity_address_type : PeerAddressType,
  peer_identity_address : Address,
  peer_irk : 8[16],
  local_irk : 8[16],
}

packet LeAddDeviceToResolvingListComplete : CommandComplete (command_op_code = LE_ADD_DEVICE_TO_RESOLVING_LIST) {
@@ -2537,7 +2638,8 @@ packet LeAddDeviceToResolvingListComplete : CommandComplete (command_op_code = L
}

packet LeRemoveDeviceFromResolvingList : LeSecurityCommand (op_code = LE_REMOVE_DEVICE_FROM_RESOLVING_LIST) {
  _payload_,  // placeholder (unimplemented)
  peer_identity_address_type : PeerAddressType,
  peer_identity_address : Address,
}

packet LeRemoveDeviceFromResolvingListComplete : CommandComplete (command_op_code = LE_REMOVE_DEVICE_FROM_RESOLVING_LIST) {
@@ -2545,7 +2647,6 @@ packet LeRemoveDeviceFromResolvingListComplete : CommandComplete (command_op_cod
}

packet LeClearResolvingList : LeSecurityCommand (op_code = LE_CLEAR_RESOLVING_LIST) {
  _payload_,  // placeholder (unimplemented)
}

packet LeClearResolvingListComplete : CommandComplete (command_op_code = LE_CLEAR_RESOLVING_LIST) {
@@ -2553,23 +2654,46 @@ packet LeClearResolvingListComplete : CommandComplete (command_op_code = LE_CLEA
}

packet LeReadResolvingListSize : LeSecurityCommand (op_code = LE_READ_RESOLVING_LIST_SIZE) {
  _payload_,  // placeholder (unimplemented)
}

packet LeReadResolvingListSizeComplete : CommandComplete (command_op_code = LE_READ_RESOLVING_LIST_SIZE) {
  status : ErrorCode,
}

packet LeReadPeerResolvableAddress : LeSecurityCommand (op_code = LE_READ_PEER_RESOLVABLE_ADDRESS) {
  _payload_,  // placeholder (unimplemented)
  peer_identity_address_type : PeerAddressType,
  peer_identity_address : Address,
}

packet LeReadPeerResolvableAddressComplete : CommandComplete (command_op_code = LE_READ_PEER_RESOLVABLE_ADDRESS) {
  status : ErrorCode,
  peer_resolvable_address : Address,
}

packet LeReadLocalResolvableAddress : LeSecurityCommand (op_code = LE_READ_LOCAL_RESOLVABLE_ADDRESS) {
  _payload_,  // placeholder (unimplemented)
  peer_identity_address_type : PeerAddressType,
  peer_identity_address : Address,
}

packet LeReadLocalResolvableAddressComplete : CommandComplete (command_op_code = LE_READ_LOCAL_RESOLVABLE_ADDRESS) {
  status : ErrorCode,
  local_resolvable_address : Address,
}

packet LeSetAddressResolutionEnable : LeSecurityCommand (op_code = LE_SET_ADDRESS_RESOLUTION_ENABLE) {
  _payload_,  // placeholder (unimplemented)
  address_resolution_enable : Enable,
}

packet LeSetAddressResolutionEnableComplete : CommandComplete (command_op_code = LE_SET_ADDRESS_RESOLUTION_ENABLE) {
  status : ErrorCode,
}

packet LeSetResolvablePrivateAddressTimeout : LeSecurityCommand (op_code = LE_SET_RESOLVABLE_PRIVATE_ADDRESS_TIMEOUT) {
  _payload_,  // placeholder (unimplemented)
  rpa_timeout : 16, // RPA_Timeout measured in seconds 0x0001 to 0xA1B8 1s to 11.5 hours
}

packet LeSetResolvablePrivateAddressTimeoutComplete : CommandComplete (command_op_code = LE_SET_RESOLVABLE_PRIVATE_ADDRESS_TIMEOUT) {
  status : ErrorCode,
}

packet LeReadMaximumDataLength : CommandPacket (op_code = LE_READ_MAXIMUM_DATA_LENGTH) {
@@ -2582,7 +2706,6 @@ struct LeMaximumDataLength {
  supported_max_rx_time: 16,
}


packet LeReadMaximumDataLengthComplete : CommandComplete (command_op_code = LE_READ_MAXIMUM_DATA_LENGTH) {
  status : ErrorCode,
  le_maximum_data_length : LeMaximumDataLength,
@@ -2925,14 +3048,34 @@ packet LeWriteRfPathCompensationPower : LeAdvertisingCommand (op_code = LE_WRITE
  _payload_,  // placeholder (unimplemented)
}

enum PrivacyMode : 8 {
  NETWORK = 0,
  DEVICE = 1,
}

packet LeSetPrivacyMode : LeSecurityCommand (op_code = LE_SET_PRIVACY_MODE) {
  _payload_,  // placeholder (unimplemented)
  peer_identity_address_type : PeerAddressType,
  peer_identity_address : Address,
  privacy_mode : PrivacyMode,
}

packet LeSetPrivacyModeComplete : CommandComplete (command_op_code = LE_SET_PRIVACY_MODE) {
  status : ErrorCode,
}

enum UseDebugKey : 8 {
  USE_GENERATED_KEY = 0,
  USE_DEBUG_KEY = 1,
}

packet LeGenerateDhkeyCommand : LeSecurityCommand (op_code = LE_GENERATE_DHKEY_COMMAND) {
  remote_p_256_public_key : 8[64],
  key_type : UseDebugKey,
}

packet LeGenerateDhkeyCommandStatus : CommandStatus (command_op_code = LE_GENERATE_DHKEY_COMMAND) {
}

  // VENDOR_SPECIFIC
packet LeGetVendorCapabilities : VendorCommand (op_code = LE_GET_VENDOR_CAPABILITIES) {
}
@@ -3073,7 +3216,7 @@ enum ApcfOpcode : 8 {
  SERVICE_DATA = 0x07,
}

packet LeAdvFilter : VendorCommand (op_code = LE_ADV_FILTER) {
packet LeAdvFilter : LeScanningCommand (op_code = LE_ADV_FILTER) {
  apcf_opcode : ApcfOpcode,
  _body_,
}
@@ -3316,7 +3459,7 @@ packet LinkKeyNotification : EventPacket (event_code = LINK_KEY_NOTIFICATION){
}

packet LoopbackCommand : EventPacket (event_code = LOOPBACK_COMMAND){
  _payload_, // placeholder (unimplemented)
  _payload_, // Command packet, truncated if it was longer than 252 bytes
}

packet DataBufferOverflow : EventPacket (event_code = DATA_BUFFER_OVERFLOW){
+722 −601

File changed.

Preview size limit exceeded, changes collapsed.

+105 −104
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@
namespace test_vendor_lib {

using ::bluetooth::hci::Address;
using ::bluetooth::packet::PacketView;
using ::bluetooth::hci::CommandPacketView;

// Emulates a dual mode BR/EDR + LE controller by maintaining the link layer
// state machine detailed in the Bluetooth Core Specification Version 4.2,
@@ -107,315 +107,315 @@ class DualModeController : public Device {
  // Bluetooth Core Specification Version 4.2 Volume 2 Part E 7.1

  // 7.1.1
  void HciInquiry(PacketView<true> args);
  void Inquiry(CommandPacketView args);

  // 7.1.2
  void HciInquiryCancel(PacketView<true> args);
  void InquiryCancel(CommandPacketView args);

  // 7.1.5
  void HciCreateConnection(PacketView<true> args);
  void CreateConnection(CommandPacketView args);

  // 7.1.6
  void HciDisconnect(PacketView<true> args);
  void Disconnect(CommandPacketView args);

  // 7.1.8
  void HciAcceptConnectionRequest(PacketView<true> args);
  void AcceptConnectionRequest(CommandPacketView args);

  // 7.1.9
  void HciRejectConnectionRequest(PacketView<true> args);
  void RejectConnectionRequest(CommandPacketView args);

  // 7.1.10
  void HciLinkKeyRequestReply(PacketView<true> args);
  void LinkKeyRequestReply(CommandPacketView args);

  // 7.1.11
  void HciLinkKeyRequestNegativeReply(PacketView<true> args);
  void LinkKeyRequestNegativeReply(CommandPacketView args);

  // 7.1.14
  void HciChangeConnectionPacketType(PacketView<true> args);
  void ChangeConnectionPacketType(CommandPacketView args);

  // 7.1.15
  void HciAuthenticationRequested(PacketView<true> args);
  void AuthenticationRequested(CommandPacketView args);

  // 7.1.16
  void HciSetConnectionEncryption(PacketView<true> args);
  void SetConnectionEncryption(CommandPacketView args);

  // 7.1.17
  void HciChangeConnectionLinkKey(PacketView<true> args);
  void ChangeConnectionLinkKey(CommandPacketView args);

  // 7.1.18
  void HciMasterLinkKey(PacketView<true> args);
  void MasterLinkKey(CommandPacketView args);

  // 7.1.19
  void HciRemoteNameRequest(PacketView<true> args);
  void RemoteNameRequest(CommandPacketView args);

  // 7.2.8
  void HciSwitchRole(PacketView<true> args);
  void SwitchRole(CommandPacketView args);

  // 7.1.21
  void HciReadRemoteSupportedFeatures(PacketView<true> args);
  void ReadRemoteSupportedFeatures(CommandPacketView args);

  // 7.1.22
  void HciReadRemoteExtendedFeatures(PacketView<true> args);
  void ReadRemoteExtendedFeatures(CommandPacketView args);

  // 7.1.23
  void HciReadRemoteVersionInformation(PacketView<true> args);
  void ReadRemoteVersionInformation(CommandPacketView args);

  // 7.1.24
  void HciReadClockOffset(PacketView<true> args);
  void ReadClockOffset(CommandPacketView args);

  // 7.1.29
  void HciIoCapabilityRequestReply(PacketView<true> args);
  void IoCapabilityRequestReply(CommandPacketView args);

  // 7.1.30
  void HciUserConfirmationRequestReply(PacketView<true> args);
  void UserConfirmationRequestReply(CommandPacketView args);

  // 7.1.31
  void HciUserConfirmationRequestNegativeReply(PacketView<true> args);
  void UserConfirmationRequestNegativeReply(CommandPacketView args);

  // 7.1.32
  void HciUserPasskeyRequestReply(PacketView<true> args);
  void UserPasskeyRequestReply(CommandPacketView args);

  // 7.1.33
  void HciUserPasskeyRequestNegativeReply(PacketView<true> args);
  void UserPasskeyRequestNegativeReply(CommandPacketView args);

  // 7.1.34
  void HciRemoteOobDataRequestReply(PacketView<true> args);
  void RemoteOobDataRequestReply(CommandPacketView args);

  // 7.1.35
  void HciRemoteOobDataRequestNegativeReply(PacketView<true> args);
  void RemoteOobDataRequestNegativeReply(CommandPacketView args);

  // 7.1.36
  void HciIoCapabilityRequestNegativeReply(PacketView<true> args);
  void IoCapabilityRequestNegativeReply(CommandPacketView args);

  // Link Policy Commands
  // Bluetooth Core Specification Version 4.2 Volume 2 Part E 7.2

  // 7.2.1
  void HciHoldMode(PacketView<true> args);
  void HoldMode(CommandPacketView args);

  // 7.2.2
  void HciSniffMode(PacketView<true> args);
  void SniffMode(CommandPacketView args);

  // 7.2.3
  void HciExitSniffMode(PacketView<true> args);
  void ExitSniffMode(CommandPacketView args);

  // 7.2.6
  void HciQosSetup(PacketView<true> args);
  void QosSetup(CommandPacketView args);

  // 7.2.10
  void HciWriteLinkPolicySettings(PacketView<true> args);
  void WriteLinkPolicySettings(CommandPacketView args);

  // 7.2.12
  void HciWriteDefaultLinkPolicySettings(PacketView<true> args);
  void WriteDefaultLinkPolicySettings(CommandPacketView args);

  // 7.2.13
  void HciFlowSpecification(PacketView<true> args);
  void FlowSpecification(CommandPacketView args);

  // 7.2.14
  void HciSniffSubrating(PacketView<true> args);
  void SniffSubrating(CommandPacketView args);

  // Link Controller Commands
  // Bluetooth Core Specification Version 4.2 Volume 2 Part E 7.3

  // 7.3.1
  void HciSetEventMask(PacketView<true> args);
  void SetEventMask(CommandPacketView args);

  // 7.3.2
  void HciReset(PacketView<true> args);
  void Reset(CommandPacketView args);

  // 7.3.3
  void HciSetEventFilter(PacketView<true> args);
  void SetEventFilter(CommandPacketView args);

  // 7.3.10
  void HciDeleteStoredLinkKey(PacketView<true> args);
  void DeleteStoredLinkKey(CommandPacketView args);

  // 7.3.11
  void HciWriteLocalName(PacketView<true> args);
  void WriteLocalName(CommandPacketView args);

  // 7.3.12
  void HciReadLocalName(PacketView<true> args);
  void ReadLocalName(CommandPacketView args);

  // 7.3.16
  void HciWritePageTimeout(PacketView<true> args);
  void WritePageTimeout(CommandPacketView args);

  // 7.3.18
  void HciWriteScanEnable(PacketView<true> args);
  void WriteScanEnable(CommandPacketView args);

  // 7.3.22
  void HciWriteInquiryScanActivity(PacketView<true> args);
  void WriteInquiryScanActivity(CommandPacketView args);

  // 7.3.23
  void HciReadAuthenticationEnable(PacketView<true> args);
  void ReadAuthenticationEnable(CommandPacketView args);

  // 7.3.24
  void HciWriteAuthenticationEnable(PacketView<true> args);
  void WriteAuthenticationEnable(CommandPacketView args);

  // 7.3.26
  void HciWriteClassOfDevice(PacketView<true> args);
  void WriteClassOfDevice(CommandPacketView args);

  // 7.3.28
  void HciWriteVoiceSetting(PacketView<true> args);
  void WriteVoiceSetting(CommandPacketView args);

  // 7.3.39
  void HciHostBufferSize(PacketView<true> args);
  void HostBufferSize(CommandPacketView args);

  // 7.3.42
  void HciWriteLinkSupervisionTimeout(PacketView<true> args);
  void WriteLinkSupervisionTimeout(CommandPacketView args);

  // 7.3.45
  void HciWriteCurrentIacLap(PacketView<true> args);
  void WriteCurrentIacLap(CommandPacketView args);

  // 7.3.48
  void HciWriteInquiryScanType(PacketView<true> args);
  void WriteInquiryScanType(CommandPacketView args);

  // 7.3.50
  void HciWriteInquiryMode(PacketView<true> args);
  void WriteInquiryMode(CommandPacketView args);

  // 7.3.52
  void HciWritePageScanType(PacketView<true> args);
  void WritePageScanType(CommandPacketView args);

  // 7.3.56
  void HciWriteExtendedInquiryResponse(PacketView<true> args);
  void WriteExtendedInquiryResponse(CommandPacketView args);

  // 7.3.57
  void HciRefreshEncryptionKey(PacketView<true> args);
  void RefreshEncryptionKey(CommandPacketView args);

  // 7.3.59
  void HciWriteSimplePairingMode(PacketView<true> args);
  void WriteSimplePairingMode(CommandPacketView args);

  // 7.3.79
  void HciWriteLeHostSupport(PacketView<true> args);
  void WriteLeHostSupport(CommandPacketView args);

  // 7.3.92
  void HciWriteSecureConnectionsHostSupport(PacketView<true> args);
  void WriteSecureConnectionsHostSupport(CommandPacketView args);

  // Informational Parameters Commands
  // Bluetooth Core Specification Version 4.2 Volume 2 Part E 7.4

  // 7.4.5
  void HciReadBufferSize(PacketView<true> args);
  void ReadBufferSize(CommandPacketView args);

  // 7.4.1
  void HciReadLocalVersionInformation(PacketView<true> args);
  void ReadLocalVersionInformation(CommandPacketView args);

  // 7.4.6
  void HciReadBdAddr(PacketView<true> args);
  void ReadBdAddr(CommandPacketView args);

  // 7.4.2
  void HciReadLocalSupportedCommands(PacketView<true> args);
  void ReadLocalSupportedCommands(CommandPacketView args);

  // 7.4.3
  void HciReadLocalSupportedFeatures(PacketView<true> args);
  void ReadLocalSupportedFeatures(CommandPacketView args);

  // 7.4.4
  void HciReadLocalExtendedFeatures(PacketView<true> args);
  void ReadLocalExtendedFeatures(CommandPacketView args);

  // 7.4.8
  void HciReadLocalSupportedCodecs(PacketView<true> args);
  void ReadLocalSupportedCodecs(CommandPacketView args);

  // Status Parameters Commands
  // Bluetooth Core Specification Version 4.2 Volume 2 Part E 7.5

  // 7.5.7
  void HciReadEncryptionKeySize(PacketView<true> args);
  void ReadEncryptionKeySize(CommandPacketView args);

  // Test Commands
  // Bluetooth Core Specification Version 4.2 Volume 2 Part E 7.7

  // 7.7.1
  void HciReadLoopbackMode(PacketView<true> args);
  void ReadLoopbackMode(CommandPacketView args);

  // 7.7.2
  void HciWriteLoopbackMode(PacketView<true> args);
  void WriteLoopbackMode(CommandPacketView args);

  // LE Controller Commands
  // Bluetooth Core Specification Version 4.2 Volume 2 Part E 7.8

  // 7.8.1
  void HciLeSetEventMask(PacketView<true> args);
  void LeSetEventMask(CommandPacketView args);

  // 7.8.2
  void HciLeReadBufferSize(PacketView<true> args);
  void LeReadBufferSize(CommandPacketView args);

  // 7.8.3
  void HciLeReadLocalSupportedFeatures(PacketView<true> args);
  void LeReadLocalSupportedFeatures(CommandPacketView args);

  // 7.8.4
  void HciLeSetRandomAddress(PacketView<true> args);
  void LeSetRandomAddress(CommandPacketView args);

  // 7.8.5
  void HciLeSetAdvertisingParameters(PacketView<true> args);
  void LeSetAdvertisingParameters(CommandPacketView args);

  // 7.8.7
  void HciLeSetAdvertisingData(PacketView<true> args);
  void LeSetAdvertisingData(CommandPacketView args);

  // 7.8.8
  void HciLeSetScanResponseData(PacketView<true> args);
  void LeSetScanResponseData(CommandPacketView args);

  // 7.8.9
  void HciLeSetAdvertisingEnable(PacketView<true> args);
  void LeSetAdvertisingEnable(CommandPacketView args);

  // 7.8.10
  void HciLeSetScanParameters(PacketView<true> args);
  void LeSetScanParameters(CommandPacketView args);

  // 7.8.11
  void HciLeSetScanEnable(PacketView<true> args);
  void LeSetScanEnable(CommandPacketView args);

  // 7.8.12
  void HciLeCreateConnection(PacketView<true> args);
  void LeCreateConnection(CommandPacketView args);

  // 7.8.18
  void HciLeConnectionUpdate(PacketView<true> args);
  void LeConnectionUpdate(CommandPacketView args);

  // 7.8.13
  void HciLeConnectionCancel(PacketView<true> args);
  void LeConnectionCancel(CommandPacketView args);

  // 7.8.14
  void HciLeReadWhiteListSize(PacketView<true> args);
  void LeReadWhiteListSize(CommandPacketView args);

  // 7.8.15
  void HciLeClearWhiteList(PacketView<true> args);
  void LeClearWhiteList(CommandPacketView args);

  // 7.8.16
  void HciLeAddDeviceToWhiteList(PacketView<true> args);
  void LeAddDeviceToWhiteList(CommandPacketView args);

  // 7.8.17
  void HciLeRemoveDeviceFromWhiteList(PacketView<true> args);
  void LeRemoveDeviceFromWhiteList(CommandPacketView args);

  // 7.8.21
  void HciLeReadRemoteFeatures(PacketView<true> args);
  void LeReadRemoteFeatures(CommandPacketView args);

  // 7.8.23
  void HciLeRand(PacketView<true> args);
  void LeRand(CommandPacketView args);

  // 7.8.24
  void HciLeStartEncryption(PacketView<true> args);
  void LeStartEncryption(CommandPacketView args);

  // 7.8.27
  void HciLeReadSupportedStates(PacketView<true> args);
  void LeReadSupportedStates(CommandPacketView args);

  // 7.8.38
  void HciLeAddDeviceToResolvingList(PacketView<true> args);
  void LeAddDeviceToResolvingList(CommandPacketView args);

  // 7.8.39
  void HciLeRemoveDeviceFromResolvingList(PacketView<true> args);
  void LeRemoveDeviceFromResolvingList(CommandPacketView args);

  // 7.8.40
  void HciLeClearResolvingList(PacketView<true> args);
  void LeClearResolvingList(CommandPacketView args);

  // 7.8.77
  void HciLeSetPrivacyMode(PacketView<true> args);
  void LeSetPrivacyMode(CommandPacketView args);

  // Vendor-specific Commands

  void HciLeVendorSleepMode(PacketView<true> args);
  void HciLeVendorCap(PacketView<true> args);
  void HciLeVendorMultiAdv(PacketView<true> args);
  void HciLeVendor155(PacketView<true> args);
  void HciLeVendor157(PacketView<true> args);
  void HciLeEnergyInfo(PacketView<true> args);
  void HciLeAdvertisingFilter(PacketView<true> args);
  void HciLeExtendedScanParams(PacketView<true> args);
  void LeVendorSleepMode(CommandPacketView args);
  void LeVendorCap(CommandPacketView args);
  void LeVendorMultiAdv(CommandPacketView args);
  void LeVendor155(CommandPacketView args);
  void LeVendor157(CommandPacketView args);
  void LeEnergyInfo(CommandPacketView args);
  void LeAdvertisingFilter(CommandPacketView args);
  void LeExtendedScanParams(CommandPacketView args);

  void SetTimerPeriod(std::chrono::milliseconds new_period);
  void StartTimer();
@@ -443,7 +443,8 @@ class DualModeController : public Device {
  // Maintains the commands to be registered and used in the HciHandler object.
  // Keys are command opcodes and values are the callbacks to handle each
  // command.
  std::unordered_map<uint16_t, std::function<void(PacketView<true>)>>
  std::unordered_map<bluetooth::hci::OpCode,
                     std::function<void(bluetooth::hci::CommandPacketView)>>
      active_hci_commands_;

  bluetooth::hci::LoopbackMode loopback_mode_;