diff --git a/include/f1x/openauto/autoapp/Configuration/Configuration.hpp b/include/f1x/openauto/autoapp/Configuration/Configuration.hpp index dc7aee6..514f1cc 100644 --- a/include/f1x/openauto/autoapp/Configuration/Configuration.hpp +++ b/include/f1x/openauto/autoapp/Configuration/Configuration.hpp @@ -110,8 +110,9 @@ public: BluetoothAdapterType getBluetoothAdapterType() const override; void setBluetoothAdapterType(BluetoothAdapterType value) override; std::string getBluetoothAdapterAddress() const override; - void setBluetoothAdapterAddress(const std::string& value) override; + bool getWirelessProjectionEnabled() const override; + void setWirelessProjectionEnabled(bool value) override; bool musicAudioChannelEnabled() const override; void setMusicAudioChannelEnabled(bool value) override; @@ -159,6 +160,8 @@ private: ButtonCodes buttonCodes_; BluetoothAdapterType bluetoothAdapterType_; std::string bluetoothAdapterAddress_; + bool wirelessProjectionEnabled_; + bool _audioChannelEnabledMedia; bool _audioChannelEnabledGuidance; bool _audioChannelEnabledSystem; @@ -206,6 +209,7 @@ private: static const std::string cBluetoothAdapterTypeKey; static const std::string cBluetoothAdapterAddressKey; + 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 2606c41..d2358d6 100644 --- a/include/f1x/openauto/autoapp/Configuration/IConfiguration.hpp +++ b/include/f1x/openauto/autoapp/Configuration/IConfiguration.hpp @@ -114,6 +114,8 @@ public: virtual void setBluetoothAdapterType(BluetoothAdapterType value) = 0; virtual std::string getBluetoothAdapterAddress() const = 0; virtual void setBluetoothAdapterAddress(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 ba1f789..57765dd 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::cBluetoothAdapterAddressKey = "Bluetooth.AdapterAddress"; +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); + bluetoothAdapterAddress_ = iniConfig.get(cBluetoothAdapterAddressKey, ""); _audioChannelEnabledMedia = iniConfig.get(cAudioChannelMediaEnabled, true); @@ -144,7 +147,7 @@ void Configuration::load() _audioChannelEnabledSystem = iniConfig.get(cAudioChannelSystemEnabled, true); _audioChannelEnabledTelephony = iniConfig.get(cAudioChannelTelephonyEnabled, true); - audioOutputBackendType_ = static_cast(iniConfig.get(cAudioOutputBackendType, static_cast(AudioOutputBackendType::RTAUDIO))); + audioOutputBackendType_ = static_cast(iniConfig.get(cAudioOutputBackendType, static_cast(AudioOutputBackendType::RTAUDIO))); } catch(const boost::property_tree::ini_parser_error& e) { @@ -192,6 +195,7 @@ void Configuration::reset() _audioChannelEnabledTelephony = true; audioOutputBackendType_ = AudioOutputBackendType::QT; + wirelessProjectionEnabled_ = true; } void Configuration::save() @@ -230,6 +234,7 @@ void Configuration::save() iniConfig.put(cBluetoothAdapterTypeKey, static_cast(bluetoothAdapterType_)); iniConfig.put(cBluetoothAdapterAddressKey, bluetoothAdapterAddress_); + iniConfig.put(cBluetoothWirelessProjectionEnabledKey, wirelessProjectionEnabled_); iniConfig.put(cAudioChannelMediaEnabled, _audioChannelEnabledMedia); iniConfig.put(cAudioChannelGuidanceEnabled, _audioChannelEnabledGuidance); @@ -539,6 +544,14 @@ void Configuration::setBluetoothAdapterAddress(const std::string& value) bluetoothAdapterAddress_ = value; } +bool Configuration::getWirelessProjectionEnabled() const { + return wirelessProjectionEnabled_; +} + +void Configuration::setWirelessProjectionEnabled(bool value) { + wirelessProjectionEnabled_ = value; +} + bool Configuration::musicAudioChannelEnabled() const { return _audioChannelEnabledMedia; diff --git a/src/autoapp/Service/AndroidAutoEntity.cpp b/src/autoapp/Service/AndroidAutoEntity.cpp index c692d07..80cf5c5 100644 --- a/src/autoapp/Service/AndroidAutoEntity.cpp +++ b/src/autoapp/Service/AndroidAutoEntity.cpp @@ -263,6 +263,21 @@ namespace f1x { controlServiceChannel_->sendShutdownResponse(response, std::move(promise)); } + void AndroidAutoEntity::onPingRequest(const aasdk::proto::messages::PingRequest& request) + { + OPENAUTO_LOG(info) << "[AndroidAutoEntity] ping request "; + + auto promise = aasdk::channel::SendPromise::defer(strand_); + promise->then([]() {}, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), std::placeholders::_1)); + controlServiceChannel_->sendPingRequest(request, std::move(promise)); + } + + void AndroidAutoEntity::onVoiceSessionRequest(const aasdk::proto::messages::VoiceSessionRequest& request) + { + OPENAUTO_LOG(info) << "[AndroidAutoEntity] onVoiceSessionRequest()"; + controlServiceChannel_->receive(this->shared_from_this()); + } + void AndroidAutoEntity::onByeByeResponse( const aap_protobuf::service::control::message::ByeByeResponse &response) { OPENAUTO_LOG(info) << "[AndroidAutoEntity] onByeByeResponse()"; diff --git a/src/autoapp/Service/SensorService.cpp b/src/autoapp/Service/SensorService.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/autoapp/Service/ServiceFactory.cpp b/src/autoapp/Service/ServiceFactory.cpp index b7440e5..89dd266 100644 --- a/src/autoapp/Service/ServiceFactory.cpp +++ b/src/autoapp/Service/ServiceFactory.cpp @@ -64,8 +64,15 @@ namespace f1x::openauto::autoapp::service { serviceList.emplace_back(this->createSensorService(messenger)); serviceList.emplace_back(this->createBluetoothService(messenger)); serviceList.emplace_back(this->createInputService(messenger)); - // TODO: What is WiFi Projection Service? - //serviceList.emplace_back(this->createWifiProjectionService(messenger)); + if (configuration_->getWirelessProjectionEnabled()) + { + // TODO: What is WiFi Projection Service? + /* + * The btservice seems to handle connecting over bluetooth and allow AA to establish a WiFi connection for Projection + * If WifiProjection is a legitimate service, then it seems clear it is not what we think it actually is. + */ + serviceList.emplace_back(this->createWifiProjectionService(messenger)); + } return serviceList; } @@ -141,7 +148,7 @@ namespace f1x::openauto::autoapp::service { std::move(guidanceAudioOutput))); } - /* + /* TODO: This also causes a problem - suspect not actually enabled yet in AA, or removed due to preference of Bluetooth. if (configuration_->telephonyAudioChannelEnabled()) { OPENAUTO_LOG(info) << "[ServiceFactory] Telephony Audio Channel enabled"; auto telephonyAudioOutput = diff --git a/src/autoapp/UI/SettingsWindow.cpp b/src/autoapp/UI/SettingsWindow.cpp index 4d39d6e..d29d7ba 100644 --- a/src/autoapp/UI/SettingsWindow.cpp +++ b/src/autoapp/UI/SettingsWindow.cpp @@ -346,6 +346,12 @@ comboBoxBluetooth->addItem(QCoreApplication::translate("SettingsWindow", "none", ui_->comboBoxBluetooth->currentData().toString().toStdString()); } + if (ui_->disableProjectionButton->isChecked()) { + configuration_->setWirelessProjectionEnabled(false); + } else { + configuration_->setWirelessProjectionEnabled(true); + } + configuration_->setMusicAudioChannelEnabled(ui_->checkBoxMusicAudioChannel->isChecked()); configuration_->setGuidanceAudioChannelEnabled(ui_->checkBoxSpeechAudioChannel->isChecked()); //configuration_->setTelephonyAudioChannelEnabled(ui_->checkBoxVoiceAudioChannel->isChecked()); @@ -622,6 +628,8 @@ comboBoxBluetooth->addItem(QCoreApplication::translate("SettingsWindow", "none", this->loadButtonCheckBoxes(); ui_->checkBoxPlayerControl->setChecked(configuration_->playerButtonControl()); + ui_->disableProjectionButton->setChecked(!configuration_->getWirelessProjectionEnabled()); + ui_->checkBoxMusicAudioChannel->setChecked(configuration_->musicAudioChannelEnabled()); ui_->checkBoxSpeechAudioChannel->setChecked(configuration_->guidanceAudioChannelEnabled()); //ui_->telephonyAudioChannelEnabled->setChecked(configuration_->telephonyAudioChannelEnabled()); diff --git a/src/autoapp/UI/settingswindow.ui b/src/autoapp/UI/settingswindow.ui index f0cbcd8..e99ea7b 100644 --- a/src/autoapp/UI/settingswindow.ui +++ b/src/autoapp/UI/settingswindow.ui @@ -2890,6 +2890,49 @@ outline: none; + + + + + 0 + 0 + + + + ArrowCursor + + + Wireless Projection + + + + 6 + + + 0 + + + 6 + + + 0 + + + + + + 0 + 32 + + + + Disable Wireless Projection + + + + + +