From 7994c3c71ec99a06ba93cf14d8526b425c62c1cc Mon Sep 17 00:00:00 2001 From: SonOfGib Date: Fri, 3 Jan 2025 19:47:04 -0500 Subject: [PATCH 1/2] Bonus: Fix assistant hang/missing audio. --- src/autoapp/Service/AndroidAutoEntity.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/autoapp/Service/AndroidAutoEntity.cpp b/src/autoapp/Service/AndroidAutoEntity.cpp index cea74e5e..de11e9bc 100644 --- a/src/autoapp/Service/AndroidAutoEntity.cpp +++ b/src/autoapp/Service/AndroidAutoEntity.cpp @@ -249,7 +249,8 @@ void AndroidAutoEntity::onPingRequest(const aasdk::proto::messages::PingRequest& void AndroidAutoEntity::onVoiceSessionRequest(const aasdk::proto::messages::VoiceSessionRequest& request) { - OPENAUTO_LOG(error) << "[AndroidAutoEntity] voice session request not implemented"; + OPENAUTO_LOG(info) << "[AndroidAutoEntity] onVoiceSessionRequest()"; + controlServiceChannel_->receive(this->shared_from_this()); } void AndroidAutoEntity::onShutdownResponse(const aasdk::proto::messages::ShutdownResponse&) From 7b8b365ed66dcd34bd9e004090426d3d20fe0272 Mon Sep 17 00:00:00 2001 From: SonOfGib Date: Fri, 3 Jan 2025 21:06:51 -0500 Subject: [PATCH 2/2] Add new wireless projection config section. * Add check box to disable/enable wireless projection. Checking this box causes the service factory to skip the bluetooth and wifi services. --- .../autoapp/Configuration/Configuration.hpp | 4 ++ .../autoapp/Configuration/IConfiguration.hpp | 2 + src/autoapp/Configuration/Configuration.cpp | 12 ++++++ src/autoapp/Service/ServiceFactory.cpp | 7 ++- src/autoapp/UI/SettingsWindow.cpp | 7 +++ src/autoapp/UI/settingswindow.ui | 43 +++++++++++++++++++ 6 files changed, 73 insertions(+), 2 deletions(-) diff --git a/include/f1x/openauto/autoapp/Configuration/Configuration.hpp b/include/f1x/openauto/autoapp/Configuration/Configuration.hpp index c908cc6a..b6c24be7 100644 --- a/include/f1x/openauto/autoapp/Configuration/Configuration.hpp +++ b/include/f1x/openauto/autoapp/Configuration/Configuration.hpp @@ -110,6 +110,8 @@ class Configuration: public IConfiguration void setBluetoothAdapterType(BluetoothAdapterType value) override; std::string getBluetoothRemoteAdapterAddress() const override; void setBluetoothRemoteAdapterAddress(const std::string& value) override; + bool getWirelessProjectionEnabled() const override; + void setWirelessProjectionEnabled(bool value) override; bool musicAudioChannelEnabled() const override; void setMusicAudioChannelEnabled(bool value) override; @@ -152,6 +154,7 @@ class Configuration: public IConfiguration bool enablePlayerControl_; ButtonCodes buttonCodes_; BluetoothAdapterType bluetoothAdapterType_; + bool wirelessProjectionEnabled_; std::string bluetoothRemoteAdapterAddress_; bool musicAudioChannelEnabled_; bool speechAudiochannelEnabled_; @@ -194,6 +197,7 @@ class Configuration: public IConfiguration static const std::string cBluetoothAdapterTypeKey; static const std::string cBluetoothRemoteAdapterAddressKey; + static const std::string cBluetoothWirelessProjectionEnabledKey; static const std::string cInputEnableTouchscreenKey; static const std::string cInputEnablePlayerControlKey; diff --git a/include/f1x/openauto/autoapp/Configuration/IConfiguration.hpp b/include/f1x/openauto/autoapp/Configuration/IConfiguration.hpp index db22bc81..4753a2b0 100644 --- a/include/f1x/openauto/autoapp/Configuration/IConfiguration.hpp +++ b/include/f1x/openauto/autoapp/Configuration/IConfiguration.hpp @@ -114,6 +114,8 @@ class IConfiguration virtual void setBluetoothAdapterType(BluetoothAdapterType value) = 0; virtual std::string getBluetoothRemoteAdapterAddress() const = 0; virtual void setBluetoothRemoteAdapterAddress(const std::string& value) = 0; + virtual bool getWirelessProjectionEnabled() const = 0; + virtual void setWirelessProjectionEnabled(bool value) = 0; virtual bool musicAudioChannelEnabled() const = 0; virtual void setMusicAudioChannelEnabled(bool value) = 0; diff --git a/src/autoapp/Configuration/Configuration.cpp b/src/autoapp/Configuration/Configuration.cpp index a39bb1fd..51dacbcf 100644 --- a/src/autoapp/Configuration/Configuration.cpp +++ b/src/autoapp/Configuration/Configuration.cpp @@ -66,6 +66,7 @@ const std::string Configuration::cAudioOutputBackendType = "Audio.OutputBackendT const std::string Configuration::cBluetoothAdapterTypeKey = "Bluetooth.AdapterType"; const std::string Configuration::cBluetoothRemoteAdapterAddressKey = "Bluetooth.RemoteAdapterAddress"; +const std::string Configuration::cBluetoothWirelessProjectionEnabledKey = "Bluetooth.WirelessProjectionEnabled"; const std::string Configuration::cInputEnableTouchscreenKey = "Input.EnableTouchscreen"; const std::string Configuration::cInputEnablePlayerControlKey = "Input.EnablePlayerControl"; @@ -137,6 +138,8 @@ void Configuration::load() bluetoothAdapterType_ = static_cast(iniConfig.get(cBluetoothAdapterTypeKey, static_cast(BluetoothAdapterType::NONE))); + wirelessProjectionEnabled_ = iniConfig.get(cBluetoothWirelessProjectionEnabledKey, true); + bluetoothRemoteAdapterAddress_ = iniConfig.get(cBluetoothRemoteAdapterAddressKey, ""); musicAudioChannelEnabled_ = iniConfig.get(cAudioMusicAudioChannelEnabled, true); speechAudiochannelEnabled_ = iniConfig.get(cAudioSpeechAudioChannelEnabled, true); @@ -222,6 +225,7 @@ void Configuration::save() iniConfig.put(cBluetoothAdapterTypeKey, static_cast(bluetoothAdapterType_)); iniConfig.put(cBluetoothRemoteAdapterAddressKey, bluetoothRemoteAdapterAddress_); + iniConfig.put(cBluetoothWirelessProjectionEnabledKey, wirelessProjectionEnabled_); iniConfig.put(cAudioMusicAudioChannelEnabled, musicAudioChannelEnabled_); iniConfig.put(cAudioSpeechAudioChannelEnabled, speechAudiochannelEnabled_); @@ -528,6 +532,14 @@ void Configuration::setBluetoothRemoteAdapterAddress(const std::string& value) bluetoothRemoteAdapterAddress_ = value; } +bool Configuration::getWirelessProjectionEnabled() const { + return wirelessProjectionEnabled_; +} + +void Configuration::setWirelessProjectionEnabled(bool value) { + wirelessProjectionEnabled_ = value; +} + bool Configuration::musicAudioChannelEnabled() const { return musicAudioChannelEnabled_; diff --git a/src/autoapp/Service/ServiceFactory.cpp b/src/autoapp/Service/ServiceFactory.cpp index 5d8d5619..ff55fe5e 100644 --- a/src/autoapp/Service/ServiceFactory.cpp +++ b/src/autoapp/Service/ServiceFactory.cpp @@ -66,9 +66,12 @@ ServiceList ServiceFactory::create(aasdk::messenger::IMessenger::Pointer messeng this->createAudioServices(serviceList, messenger); serviceList.emplace_back(std::make_shared(ioService_, messenger)); serviceList.emplace_back(this->createVideoService(messenger)); - serviceList.emplace_back(this->createBluetoothService(messenger)); + if (configuration_->getWirelessProjectionEnabled()) + { + serviceList.emplace_back(this->createBluetoothService(messenger)); + serviceList.emplace_back(std::make_shared(ioService_, messenger, configuration_)); + } serviceList.emplace_back(this->createInputService(messenger)); - serviceList.emplace_back(std::make_shared(ioService_, messenger, configuration_)); return serviceList; } diff --git a/src/autoapp/UI/SettingsWindow.cpp b/src/autoapp/UI/SettingsWindow.cpp index de22f455..cb616f47 100644 --- a/src/autoapp/UI/SettingsWindow.cpp +++ b/src/autoapp/UI/SettingsWindow.cpp @@ -250,6 +250,12 @@ void SettingsWindow::onSave() configuration_->setBluetoothAdapterType(configuration::BluetoothAdapterType::REMOTE); } + if (ui_->disableProjectionButton->isChecked()) { + configuration_->setWirelessProjectionEnabled(false); + } else { + configuration_->setWirelessProjectionEnabled(true); + } + configuration_->setBluetoothRemoteAdapterAddress(ui_->lineEditExternalBluetoothAdapterAddress->text().toStdString()); configuration_->setMusicAudioChannelEnabled(ui_->checkBoxMusicAudioChannel->isChecked()); @@ -524,6 +530,7 @@ void SettingsWindow::load() ui_->radioButtonUseExternalBluetoothAdapter->setChecked(configuration_->getBluetoothAdapterType() == configuration::BluetoothAdapterType::REMOTE); ui_->lineEditExternalBluetoothAdapterAddress->setEnabled(configuration_->getBluetoothAdapterType() == configuration::BluetoothAdapterType::REMOTE); ui_->lineEditExternalBluetoothAdapterAddress->setText(QString::fromStdString(configuration_->getBluetoothRemoteAdapterAddress())); + ui_->disableProjectionButton->setChecked(!configuration_->getWirelessProjectionEnabled()); ui_->checkBoxMusicAudioChannel->setChecked(configuration_->musicAudioChannelEnabled()); ui_->checkBoxSpeechAudioChannel->setChecked(configuration_->speechAudioChannelEnabled()); diff --git a/src/autoapp/UI/settingswindow.ui b/src/autoapp/UI/settingswindow.ui index 191f7a9a..a74d8fc7 100644 --- a/src/autoapp/UI/settingswindow.ui +++ b/src/autoapp/UI/settingswindow.ui @@ -2979,6 +2979,49 @@ outline: none; + + + + + 0 + 0 + + + + ArrowCursor + + + Wireless Projection + + + + 6 + + + 0 + + + 6 + + + 0 + + + + + + 0 + 32 + + + + Disable Wireless Projection + + + + + +