Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/disable wireless #1

Merged
merged 2 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions include/f1x/openauto/autoapp/Configuration/Configuration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -152,6 +154,7 @@ class Configuration: public IConfiguration
bool enablePlayerControl_;
ButtonCodes buttonCodes_;
BluetoothAdapterType bluetoothAdapterType_;
bool wirelessProjectionEnabled_;
std::string bluetoothRemoteAdapterAddress_;
bool musicAudioChannelEnabled_;
bool speechAudiochannelEnabled_;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions include/f1x/openauto/autoapp/Configuration/IConfiguration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 12 additions & 0 deletions src/autoapp/Configuration/Configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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);

bluetoothRemoteAdapterAddress_ = iniConfig.get<std::string>(cBluetoothRemoteAdapterAddressKey, "");
musicAudioChannelEnabled_ = iniConfig.get<bool>(cAudioMusicAudioChannelEnabled, true);
speechAudiochannelEnabled_ = iniConfig.get<bool>(cAudioSpeechAudioChannelEnabled, true);
Expand Down Expand Up @@ -222,6 +225,7 @@ void Configuration::save()

iniConfig.put<uint32_t>(cBluetoothAdapterTypeKey, static_cast<uint32_t>(bluetoothAdapterType_));
iniConfig.put<std::string>(cBluetoothRemoteAdapterAddressKey, bluetoothRemoteAdapterAddress_);
iniConfig.put<bool>(cBluetoothWirelessProjectionEnabledKey, wirelessProjectionEnabled_);

iniConfig.put<bool>(cAudioMusicAudioChannelEnabled, musicAudioChannelEnabled_);
iniConfig.put<bool>(cAudioSpeechAudioChannelEnabled, speechAudiochannelEnabled_);
Expand Down Expand Up @@ -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_;
Expand Down
3 changes: 2 additions & 1 deletion src/autoapp/Service/AndroidAutoEntity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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&)
Expand Down
7 changes: 5 additions & 2 deletions src/autoapp/Service/ServiceFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,12 @@ ServiceList ServiceFactory::create(aasdk::messenger::IMessenger::Pointer messeng
this->createAudioServices(serviceList, messenger);
serviceList.emplace_back(std::make_shared<SensorService>(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<WifiService>(ioService_, messenger, configuration_));
}
serviceList.emplace_back(this->createInputService(messenger));
serviceList.emplace_back(std::make_shared<WifiService>(ioService_, messenger, configuration_));

return serviceList;
}
Expand Down
7 changes: 7 additions & 0 deletions src/autoapp/UI/SettingsWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down
43 changes: 43 additions & 0 deletions src/autoapp/UI/settingswindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -2979,6 +2979,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">
Expand Down