Loading system/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.cc +54 −0 Original line number Diff line number Diff line Loading @@ -283,6 +283,11 @@ DualModeController::DualModeController(const std::string& properties_filename, u // Testing Commands SET_SUPPORTED(READ_LOOPBACK_MODE, ReadLoopbackMode); SET_SUPPORTED(WRITE_LOOPBACK_MODE, WriteLoopbackMode); SET_SUPPORTED(READ_CLASS_OF_DEVICE, ReadClassOfDevice); SET_SUPPORTED(READ_VOICE_SETTING, ReadVoiceSetting); SET_SUPPORTED(READ_CONNECTION_ACCEPT_TIMEOUT, ReadConnectionAcceptTimeout); SET_SUPPORTED(WRITE_CONNECTION_ACCEPT_TIMEOUT, WriteConnectionAcceptTimeout); #undef SET_HANDLER #undef SET_SUPPORTED properties_.SetSupportedCommands(supported_commands); Loading Loading @@ -1308,6 +1313,9 @@ void DualModeController::RefreshEncryptionKey(CommandView command) { void DualModeController::WriteVoiceSetting(CommandView command) { auto command_view = gd_hci::WriteVoiceSettingView::Create(command); ASSERT(command_view.IsValid()); properties_.SetVoiceSetting(command_view.GetVoiceSetting()); auto packet = bluetooth::hci::WriteVoiceSettingCompleteBuilder::Create( kNumCommandPackets, ErrorCode::SUCCESS); send_event_(std::move(packet)); Loading Loading @@ -2442,6 +2450,52 @@ void DualModeController::LeLongTermKeyRequestNegativeReply( kNumCommandPackets, status, handle)); } void DualModeController::ReadClassOfDevice(CommandView command) { auto command_view = gd_hci::ReadClassOfDeviceView::Create( gd_hci::DiscoveryCommandView::Create(command)); ASSERT(command_view.IsValid()); auto packet = bluetooth::hci::ReadClassOfDeviceCompleteBuilder::Create( kNumCommandPackets, ErrorCode::SUCCESS, properties_.GetClassOfDevice()); send_event_(std::move(packet)); } void DualModeController::ReadVoiceSetting(CommandView command) { auto command_view = gd_hci::ReadVoiceSettingView::Create(command); ASSERT(command_view.IsValid()); auto packet = bluetooth::hci::ReadVoiceSettingCompleteBuilder::Create( kNumCommandPackets, ErrorCode::SUCCESS, properties_.GetVoiceSetting()); send_event_(std::move(packet)); } void DualModeController::ReadConnectionAcceptTimeout(CommandView command) { auto command_view = gd_hci::ReadConnectionAcceptTimeoutView::Create( gd_hci::ConnectionManagementCommandView::Create( gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); auto packet = bluetooth::hci::ReadConnectionAcceptTimeoutCompleteBuilder::Create( kNumCommandPackets, ErrorCode::SUCCESS, properties_.GetConnectionAcceptTimeout()); send_event_(std::move(packet)); } void DualModeController::WriteConnectionAcceptTimeout(CommandView command) { auto command_view = gd_hci::WriteConnectionAcceptTimeoutView::Create( gd_hci::ConnectionManagementCommandView::Create( gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); properties_.SetConnectionAcceptTimeout(command_view.GetConnAcceptTimeout()); auto packet = bluetooth::hci::WriteConnectionAcceptTimeoutCompleteBuilder::Create( kNumCommandPackets, ErrorCode::SUCCESS); send_event_(std::move(packet)); } void DualModeController::ReadLoopbackMode(CommandView command) { auto command_view = gd_hci::ReadLoopbackModeView::Create(command); ASSERT(command_view.IsValid()); Loading system/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.h +6 −0 Original line number Diff line number Diff line Loading @@ -543,6 +543,12 @@ class DualModeController : public Device { void LeAdvertisingFilter(CommandView args); void LeExtendedScanParams(CommandView args); // Required commands for handshaking with hci driver void ReadClassOfDevice(CommandView args); void ReadVoiceSetting(CommandView args); void ReadConnectionAcceptTimeout(CommandView args); void WriteConnectionAcceptTimeout(CommandView args); void SetTimerPeriod(std::chrono::milliseconds new_period); void StartTimer(); void StopTimer(); Loading system/vendor_libs/test_vendor_lib/model/devices/device_properties.h +16 −0 Original line number Diff line number Diff line Loading @@ -109,6 +109,20 @@ class DeviceProperties { uint8_t GetEncryptionKeySize() const { return encryption_key_size_; } uint16_t GetVoiceSetting() const { return voice_setting_; } void SetVoiceSetting(uint16_t voice_setting) { voice_setting_ = voice_setting; } uint16_t GetConnectionAcceptTimeout() const { return connection_accept_timeout_; } void SetConnectionAcceptTimeout(uint16_t connection_accept_timeout) { connection_accept_timeout_ = connection_accept_timeout; } uint16_t GetTotalNumAclDataPackets() const { return num_acl_data_packets_; } Loading Loading @@ -371,6 +385,8 @@ class DeviceProperties { uint8_t page_scan_repetition_mode_{}; uint16_t clock_offset_{}; uint8_t encryption_key_size_{10}; uint16_t voice_setting_{0x0060}; uint16_t connection_accept_timeout_{0x7d00}; // Low Energy uint16_t le_data_packet_length_; Loading Loading
system/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.cc +54 −0 Original line number Diff line number Diff line Loading @@ -283,6 +283,11 @@ DualModeController::DualModeController(const std::string& properties_filename, u // Testing Commands SET_SUPPORTED(READ_LOOPBACK_MODE, ReadLoopbackMode); SET_SUPPORTED(WRITE_LOOPBACK_MODE, WriteLoopbackMode); SET_SUPPORTED(READ_CLASS_OF_DEVICE, ReadClassOfDevice); SET_SUPPORTED(READ_VOICE_SETTING, ReadVoiceSetting); SET_SUPPORTED(READ_CONNECTION_ACCEPT_TIMEOUT, ReadConnectionAcceptTimeout); SET_SUPPORTED(WRITE_CONNECTION_ACCEPT_TIMEOUT, WriteConnectionAcceptTimeout); #undef SET_HANDLER #undef SET_SUPPORTED properties_.SetSupportedCommands(supported_commands); Loading Loading @@ -1308,6 +1313,9 @@ void DualModeController::RefreshEncryptionKey(CommandView command) { void DualModeController::WriteVoiceSetting(CommandView command) { auto command_view = gd_hci::WriteVoiceSettingView::Create(command); ASSERT(command_view.IsValid()); properties_.SetVoiceSetting(command_view.GetVoiceSetting()); auto packet = bluetooth::hci::WriteVoiceSettingCompleteBuilder::Create( kNumCommandPackets, ErrorCode::SUCCESS); send_event_(std::move(packet)); Loading Loading @@ -2442,6 +2450,52 @@ void DualModeController::LeLongTermKeyRequestNegativeReply( kNumCommandPackets, status, handle)); } void DualModeController::ReadClassOfDevice(CommandView command) { auto command_view = gd_hci::ReadClassOfDeviceView::Create( gd_hci::DiscoveryCommandView::Create(command)); ASSERT(command_view.IsValid()); auto packet = bluetooth::hci::ReadClassOfDeviceCompleteBuilder::Create( kNumCommandPackets, ErrorCode::SUCCESS, properties_.GetClassOfDevice()); send_event_(std::move(packet)); } void DualModeController::ReadVoiceSetting(CommandView command) { auto command_view = gd_hci::ReadVoiceSettingView::Create(command); ASSERT(command_view.IsValid()); auto packet = bluetooth::hci::ReadVoiceSettingCompleteBuilder::Create( kNumCommandPackets, ErrorCode::SUCCESS, properties_.GetVoiceSetting()); send_event_(std::move(packet)); } void DualModeController::ReadConnectionAcceptTimeout(CommandView command) { auto command_view = gd_hci::ReadConnectionAcceptTimeoutView::Create( gd_hci::ConnectionManagementCommandView::Create( gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); auto packet = bluetooth::hci::ReadConnectionAcceptTimeoutCompleteBuilder::Create( kNumCommandPackets, ErrorCode::SUCCESS, properties_.GetConnectionAcceptTimeout()); send_event_(std::move(packet)); } void DualModeController::WriteConnectionAcceptTimeout(CommandView command) { auto command_view = gd_hci::WriteConnectionAcceptTimeoutView::Create( gd_hci::ConnectionManagementCommandView::Create( gd_hci::AclCommandView::Create(command))); ASSERT(command_view.IsValid()); properties_.SetConnectionAcceptTimeout(command_view.GetConnAcceptTimeout()); auto packet = bluetooth::hci::WriteConnectionAcceptTimeoutCompleteBuilder::Create( kNumCommandPackets, ErrorCode::SUCCESS); send_event_(std::move(packet)); } void DualModeController::ReadLoopbackMode(CommandView command) { auto command_view = gd_hci::ReadLoopbackModeView::Create(command); ASSERT(command_view.IsValid()); Loading
system/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.h +6 −0 Original line number Diff line number Diff line Loading @@ -543,6 +543,12 @@ class DualModeController : public Device { void LeAdvertisingFilter(CommandView args); void LeExtendedScanParams(CommandView args); // Required commands for handshaking with hci driver void ReadClassOfDevice(CommandView args); void ReadVoiceSetting(CommandView args); void ReadConnectionAcceptTimeout(CommandView args); void WriteConnectionAcceptTimeout(CommandView args); void SetTimerPeriod(std::chrono::milliseconds new_period); void StartTimer(); void StopTimer(); Loading
system/vendor_libs/test_vendor_lib/model/devices/device_properties.h +16 −0 Original line number Diff line number Diff line Loading @@ -109,6 +109,20 @@ class DeviceProperties { uint8_t GetEncryptionKeySize() const { return encryption_key_size_; } uint16_t GetVoiceSetting() const { return voice_setting_; } void SetVoiceSetting(uint16_t voice_setting) { voice_setting_ = voice_setting; } uint16_t GetConnectionAcceptTimeout() const { return connection_accept_timeout_; } void SetConnectionAcceptTimeout(uint16_t connection_accept_timeout) { connection_accept_timeout_ = connection_accept_timeout; } uint16_t GetTotalNumAclDataPackets() const { return num_acl_data_packets_; } Loading Loading @@ -371,6 +385,8 @@ class DeviceProperties { uint8_t page_scan_repetition_mode_{}; uint16_t clock_offset_{}; uint8_t encryption_key_size_{10}; uint16_t voice_setting_{0x0060}; uint16_t connection_accept_timeout_{0x7d00}; // Low Energy uint16_t le_data_packet_length_; Loading