Merge branch 'crankshaft-ng' of https://github.com/opencardev/openauto into crankshaft-ng

# Conflicts:
#	include/f1x/openauto/autoapp/Configuration/Configuration.hpp
#	include/f1x/openauto/autoapp/Configuration/IConfiguration.hpp
#	src/autoapp/Configuration/Configuration.cpp
#	src/autoapp/Service/AndroidAutoEntity.cpp
#	src/autoapp/Service/SensorService.cpp
#	src/autoapp/Service/ServiceFactory.cpp
#	src/autoapp/UI/SettingsWindow.cpp
This commit is contained in:
Simon Dean 2025-01-08 17:27:25 +00:00
commit d19a4438ca
8 changed files with 97 additions and 5 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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<BluetoothAdapterType>(iniConfig.get<uint32_t>(cBluetoothAdapterTypeKey,
static_cast<uint32_t>(BluetoothAdapterType::NONE)));
wirelessProjectionEnabled_ = iniConfig.get<bool>(cBluetoothWirelessProjectionEnabledKey, true);
bluetoothAdapterAddress_ = iniConfig.get<std::string>(cBluetoothAdapterAddressKey, "");
_audioChannelEnabledMedia = iniConfig.get<bool>(cAudioChannelMediaEnabled, true);
@ -144,7 +147,7 @@ void Configuration::load()
_audioChannelEnabledSystem = iniConfig.get<bool>(cAudioChannelSystemEnabled, true);
_audioChannelEnabledTelephony = iniConfig.get<bool>(cAudioChannelTelephonyEnabled, true);
audioOutputBackendType_ = static_cast<AudioOutputBackendType>(iniConfig.get<uint32_t>(cAudioOutputBackendType, static_cast<uint32_t>(AudioOutputBackendType::RTAUDIO)));
audioOutputBackendType_ = static_cast<AudioOutputBackendType>(iniConfig.get<uint32_t>(cAudioOutputBackendType, static_cast<uint32_t>(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<uint32_t>(cBluetoothAdapterTypeKey, static_cast<uint32_t>(bluetoothAdapterType_));
iniConfig.put<std::string>(cBluetoothAdapterAddressKey, bluetoothAdapterAddress_);
iniConfig.put<bool>(cBluetoothWirelessProjectionEnabledKey, wirelessProjectionEnabled_);
iniConfig.put<bool>(cAudioChannelMediaEnabled, _audioChannelEnabledMedia);
iniConfig.put<bool>(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;

View File

@ -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()";

View File

View File

@ -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 =

View File

@ -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());

View File

@ -2890,6 +2890,49 @@ outline: none;</string>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupWirelessProjection">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="cursor">
<cursorShape>ArrowCursor</cursorShape>
</property>
<property name="title">
<string>Wireless Projection</string>
</property>
<layout class="QVBoxLayout" name="groupWirelessProjection_layout" stretch="0">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="disableProjectionButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>32</height>
</size>
</property>
<property name="text">
<string>Disable Wireless Projection</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="horizontalWidget" native="true">
<property name="sizePolicy">