Merge remote-tracking branch 'remotes/origin/development' into feature/wireless
This commit is contained in:
commit
99b96296ab
@ -52,6 +52,8 @@ public:
|
||||
void setScreenDPI(size_t value) override;
|
||||
void setOMXLayerIndex(int32_t value) override;
|
||||
int32_t getOMXLayerIndex() const override;
|
||||
void setVideoMargins(QRect value) override;
|
||||
QRect getVideoMargins() const override;
|
||||
|
||||
bool getTouchscreenEnabled() const override;
|
||||
void setTouchscreenEnabled(bool value) override;
|
||||
@ -79,6 +81,7 @@ private:
|
||||
aasdk::proto::enums::VideoResolution::Enum videoResolution_;
|
||||
size_t screenDPI_;
|
||||
int32_t omxLayerIndex_;
|
||||
QRect videoMargins_;
|
||||
bool enableTouchscreen_;
|
||||
ButtonCodes buttonCodes_;
|
||||
BluetoothAdapterType bluetoothAdapterType_;
|
||||
@ -95,6 +98,8 @@ private:
|
||||
static const std::string cVideoResolutionKey;
|
||||
static const std::string cVideoScreenDPIKey;
|
||||
static const std::string cVideoOMXLayerIndexKey;
|
||||
static const std::string cVideoMarginWidth;
|
||||
static const std::string cVideoMarginHeight;
|
||||
|
||||
static const std::string cAudioMusicAudioChannelEnabled;
|
||||
static const std::string cAudioSpeechAudioChannelEnabled;
|
||||
|
@ -19,6 +19,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <QRect>
|
||||
#include <aasdk_proto/VideoFPSEnum.pb.h>
|
||||
#include <aasdk_proto/VideoResolutionEnum.pb.h>
|
||||
#include <aasdk_proto/ButtonCodeEnum.pb.h>
|
||||
@ -59,6 +60,8 @@ public:
|
||||
virtual void setScreenDPI(size_t value) = 0;
|
||||
virtual void setOMXLayerIndex(int32_t value) = 0;
|
||||
virtual int32_t getOMXLayerIndex() const = 0;
|
||||
virtual void setVideoMargins(QRect value) = 0;
|
||||
virtual QRect getVideoMargins() const = 0;
|
||||
|
||||
virtual bool getTouchscreenEnabled() const = 0;
|
||||
virtual void setTouchscreenEnabled(bool value) = 0;
|
||||
|
@ -19,6 +19,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <QRect>
|
||||
#include <aasdk_proto/VideoFPSEnum.pb.h>
|
||||
#include <aasdk_proto/VideoResolutionEnum.pb.h>
|
||||
#include <f1x/aasdk/Common/Data.hpp>
|
||||
@ -47,6 +48,7 @@ public:
|
||||
virtual aasdk::proto::enums::VideoFPS::Enum getVideoFPS() const = 0;
|
||||
virtual aasdk::proto::enums::VideoResolution::Enum getVideoResolution() const = 0;
|
||||
virtual size_t getScreenDPI() const = 0;
|
||||
virtual QRect getVideoMargins() const = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ public:
|
||||
aasdk::proto::enums::VideoFPS::Enum getVideoFPS() const override;
|
||||
aasdk::proto::enums::VideoResolution::Enum getVideoResolution() const override;
|
||||
size_t getScreenDPI() const override;
|
||||
QRect getVideoMargins() const override;
|
||||
|
||||
protected:
|
||||
configuration::IConfiguration::Pointer configuration_;
|
||||
|
@ -19,6 +19,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <f1x/aasdk/USB/IUSBHub.hpp>
|
||||
#include <f1x/aasdk/USB/IConnectedAccessoriesEnumerator.hpp>
|
||||
#include <f1x/openauto/autoapp/Projection/IAndroidAutoEntityEventHandler.hpp>
|
||||
#include <f1x/openauto/autoapp/Projection/IAndroidAutoEntityFactory.hpp>
|
||||
|
||||
@ -36,7 +37,8 @@ class USBApp: public projection::IAndroidAutoEntityEventHandler, public std::ena
|
||||
public:
|
||||
typedef std::shared_ptr<USBApp> Pointer;
|
||||
|
||||
USBApp(boost::asio::io_service& ioService, projection::IAndroidAutoEntityFactory& androidAutoEntityFactory, aasdk::usb::IUSBHub::Pointer usbHub);
|
||||
USBApp(boost::asio::io_service& ioService, projection::IAndroidAutoEntityFactory& androidAutoEntityFactory,
|
||||
aasdk::usb::IUSBHub::Pointer usbHub, aasdk::usb::IConnectedAccessoriesEnumerator::Pointer connectedAccessoriesEnumerator);
|
||||
|
||||
void start();
|
||||
void stop();
|
||||
@ -45,6 +47,7 @@ public:
|
||||
private:
|
||||
using std::enable_shared_from_this<USBApp>::shared_from_this;
|
||||
|
||||
void enumerateDevices();
|
||||
void waitForDevice();
|
||||
void aoapDeviceHandler(aasdk::usb::DeviceHandle deviceHandle);
|
||||
void onUSBHubError(const aasdk::error::Error& error);
|
||||
@ -53,6 +56,7 @@ private:
|
||||
boost::asio::io_service::strand strand_;
|
||||
projection::IAndroidAutoEntityFactory& androidAutoEntityFactory_;
|
||||
aasdk::usb::IUSBHub::Pointer usbHub_;
|
||||
aasdk::usb::IConnectedAccessoriesEnumerator::Pointer connectedAccessoriesEnumerator_;
|
||||
projection::IAndroidAutoEntity::Pointer androidAutoEntity_;
|
||||
bool isStopped_;
|
||||
};
|
||||
|
@ -37,6 +37,8 @@ const std::string Configuration::cVideoFPSKey = "Video.FPS";
|
||||
const std::string Configuration::cVideoResolutionKey = "Video.Resolution";
|
||||
const std::string Configuration::cVideoScreenDPIKey = "Video.ScreenDPI";
|
||||
const std::string Configuration::cVideoOMXLayerIndexKey = "Video.OMXLayerIndex";
|
||||
const std::string Configuration::cVideoMarginWidth = "Video.MarginWidth";
|
||||
const std::string Configuration::cVideoMarginHeight = "Video.MarginHeight";
|
||||
|
||||
const std::string Configuration::cAudioMusicAudioChannelEnabled = "Audio.MusicAudioChannelEnabled";
|
||||
const std::string Configuration::cAudioSpeechAudioChannelEnabled = "Audio.SpeechAudioChannelEnabled";
|
||||
@ -87,6 +89,7 @@ void Configuration::load()
|
||||
screenDPI_ = iniConfig.get<size_t>(cVideoScreenDPIKey, 140);
|
||||
|
||||
omxLayerIndex_ = iniConfig.get<int32_t>(cVideoOMXLayerIndexKey, 1);
|
||||
videoMargins_ = QRect(0, 0, iniConfig.get<int32_t>(cVideoMarginWidth, 0), iniConfig.get<int32_t>(cVideoMarginHeight, 0));
|
||||
|
||||
enableTouchscreen_ = iniConfig.get<bool>(cInputEnableTouchscreenKey, true);
|
||||
this->readButtonCodes(iniConfig);
|
||||
@ -116,6 +119,7 @@ void Configuration::reset()
|
||||
videoResolution_ = aasdk::proto::enums::VideoResolution::_480p;
|
||||
screenDPI_ = 140;
|
||||
omxLayerIndex_ = 1;
|
||||
videoMargins_ = QRect(0, 0, 0, 0);
|
||||
enableTouchscreen_ = true;
|
||||
buttonCodes_.clear();
|
||||
bluetoothAdapterType_ = BluetoothAdapterType::NONE;
|
||||
@ -134,6 +138,8 @@ void Configuration::save()
|
||||
iniConfig.put<uint32_t>(cVideoResolutionKey, static_cast<uint32_t>(videoResolution_));
|
||||
iniConfig.put<size_t>(cVideoScreenDPIKey, screenDPI_);
|
||||
iniConfig.put<int32_t>(cVideoOMXLayerIndexKey, omxLayerIndex_);
|
||||
iniConfig.put<uint32_t>(cVideoMarginWidth, videoMargins_.width());
|
||||
iniConfig.put<uint32_t>(cVideoMarginHeight, videoMargins_.height());
|
||||
|
||||
iniConfig.put<bool>(cInputEnableTouchscreenKey, enableTouchscreen_);
|
||||
this->writeButtonCodes(iniConfig);
|
||||
@ -206,6 +212,16 @@ int32_t Configuration::getOMXLayerIndex() const
|
||||
return omxLayerIndex_;
|
||||
}
|
||||
|
||||
void Configuration::setVideoMargins(QRect value)
|
||||
{
|
||||
videoMargins_ = value;
|
||||
}
|
||||
|
||||
QRect Configuration::getVideoMargins() const
|
||||
{
|
||||
return videoMargins_;
|
||||
}
|
||||
|
||||
bool Configuration::getTouchscreenEnabled() const
|
||||
{
|
||||
return enableTouchscreen_;
|
||||
|
@ -48,6 +48,11 @@ size_t VideoOutput::getScreenDPI() const
|
||||
return configuration_->getScreenDPI();
|
||||
}
|
||||
|
||||
QRect VideoOutput::getVideoMargins() const
|
||||
{
|
||||
return configuration_->getVideoMargins();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -144,8 +144,10 @@ void VideoService::fillFeatures(aasdk::proto::messages::ServiceDiscoveryResponse
|
||||
auto* videoConfig1 = videoChannel->add_video_configs();
|
||||
videoConfig1->set_video_resolution(videoOutput_->getVideoResolution());
|
||||
videoConfig1->set_video_fps(videoOutput_->getVideoFPS());
|
||||
videoConfig1->set_margin_height(0);
|
||||
videoConfig1->set_margin_width(0);
|
||||
|
||||
const auto& videoMargins = videoOutput_->getVideoMargins();
|
||||
videoConfig1->set_margin_height(videoMargins.height());
|
||||
videoConfig1->set_margin_width(videoMargins.width());
|
||||
videoConfig1->set_dpi(videoOutput_->getScreenDPI());
|
||||
}
|
||||
|
||||
|
@ -73,6 +73,10 @@ void SettingsWindow::onSave()
|
||||
|
||||
configuration_->setScreenDPI(static_cast<size_t>(ui_->horizontalSliderScreenDPI->value()));
|
||||
configuration_->setOMXLayerIndex(ui_->spinBoxOmxLayerIndex->value());
|
||||
|
||||
QRect videoMargins(0, 0, ui_->spinBoxVideoMarginWidth->value(), ui_->spinBoxVideoMarginHeight->value());
|
||||
configuration_->setVideoMargins(std::move(videoMargins));
|
||||
|
||||
configuration_->setTouchscreenEnabled(ui_->checkBoxEnableTouchscreen->isChecked());
|
||||
this->saveButtonCheckBoxes();
|
||||
|
||||
@ -130,6 +134,10 @@ void SettingsWindow::load()
|
||||
ui_->horizontalSliderScreenDPI->setValue(static_cast<int>(configuration_->getScreenDPI()));
|
||||
ui_->spinBoxOmxLayerIndex->setValue(configuration_->getOMXLayerIndex());
|
||||
|
||||
const auto& videoMargins = configuration_->getVideoMargins();
|
||||
ui_->spinBoxVideoMarginWidth->setValue(videoMargins.width());
|
||||
ui_->spinBoxVideoMarginHeight->setValue(videoMargins.height());
|
||||
|
||||
ui_->checkBoxEnableTouchscreen->setChecked(configuration_->getTouchscreenEnabled());
|
||||
this->loadButtonCheckBoxes();
|
||||
|
||||
|
@ -260,48 +260,6 @@ color: rgb(238, 238, 236);</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QSlider" name="horizontalSliderScreenDPI">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>390</y>
|
||||
<width>531</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>400</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="labelScreenDPI">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>360</y>
|
||||
<width>91</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Screen DPI</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="labelScreenDPIValue">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>570</x>
|
||||
<y>380</y>
|
||||
<width>41</width>
|
||||
<height>51</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>400</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBoxOmxLayerIndex">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
@ -312,7 +270,7 @@ color: rgb(238, 238, 236);</string>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>OMX Layer index</string>
|
||||
<string>Display</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="labelOmxLayerIndex">
|
||||
<property name="geometry">
|
||||
@ -363,6 +321,100 @@ color: rgb(238, 238, 236);</string>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="labelVideoMarginWidth">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>200</x>
|
||||
<y>40</y>
|
||||
<width>101</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Margin width:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSpinBox" name="spinBoxVideoMarginWidth">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>310</x>
|
||||
<y>30</y>
|
||||
<width>71</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>99999</number>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="labelVideoMarginHeight">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>410</x>
|
||||
<y>40</y>
|
||||
<width>111</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Margin height:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSpinBox" name="spinBoxVideoMarginHeight">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>520</x>
|
||||
<y>30</y>
|
||||
<width>71</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>99999</number>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBoxScreenDPI">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>360</y>
|
||||
<width>621</width>
|
||||
<height>81</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Screen DPI</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="labelScreenDPIValue">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>570</x>
|
||||
<y>40</y>
|
||||
<width>41</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>400</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSlider" name="horizontalSliderScreenDPI">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>40</y>
|
||||
<width>531</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>400</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabAudio">
|
||||
@ -912,6 +964,8 @@ color: rgb(238, 238, 236);</string>
|
||||
<tabstop>radioButton720p</tabstop>
|
||||
<tabstop>radioButton1080p</tabstop>
|
||||
<tabstop>spinBoxOmxLayerIndex</tabstop>
|
||||
<tabstop>spinBoxVideoMarginWidth</tabstop>
|
||||
<tabstop>spinBoxVideoMarginHeight</tabstop>
|
||||
<tabstop>horizontalSliderScreenDPI</tabstop>
|
||||
<tabstop>checkBoxMusicAudioChannel</tabstop>
|
||||
<tabstop>checkBoxSpeechAudioChannel</tabstop>
|
||||
|
@ -29,11 +29,13 @@ namespace autoapp
|
||||
namespace usb
|
||||
{
|
||||
|
||||
USBApp::USBApp(boost::asio::io_service& ioService, projection::IAndroidAutoEntityFactory& androidAutoEntityFactory, aasdk::usb::IUSBHub::Pointer usbHub)
|
||||
USBApp::USBApp(boost::asio::io_service& ioService, projection::IAndroidAutoEntityFactory& androidAutoEntityFactory,
|
||||
aasdk::usb::IUSBHub::Pointer usbHub, aasdk::usb::IConnectedAccessoriesEnumerator::Pointer connectedAccessoriesEnumerator)
|
||||
: ioService_(ioService)
|
||||
, strand_(ioService_)
|
||||
, androidAutoEntityFactory_(androidAutoEntityFactory)
|
||||
, usbHub_(std::move(usbHub))
|
||||
, connectedAccessoriesEnumerator_(std::move(connectedAccessoriesEnumerator))
|
||||
, isStopped_(false)
|
||||
{
|
||||
|
||||
@ -43,6 +45,7 @@ void USBApp::start()
|
||||
{
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
this->waitForDevice();
|
||||
this->enumerateDevices();
|
||||
});
|
||||
}
|
||||
|
||||
@ -50,6 +53,7 @@ void USBApp::stop()
|
||||
{
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
isStopped_ = true;
|
||||
connectedAccessoriesEnumerator_->cancel();
|
||||
usbHub_->cancel();
|
||||
|
||||
if(androidAutoEntity_ != nullptr)
|
||||
@ -84,6 +88,19 @@ void USBApp::aoapDeviceHandler(aasdk::usb::DeviceHandle deviceHandle)
|
||||
}
|
||||
}
|
||||
|
||||
void USBApp::enumerateDevices()
|
||||
{
|
||||
auto promise = aasdk::usb::IConnectedAccessoriesEnumerator::Promise::defer(strand_);
|
||||
promise->then([this, self = this->shared_from_this()](auto result) {
|
||||
OPENAUTO_LOG(info) << "[USBApp] Devices enumeration result: " << result;
|
||||
},
|
||||
[this, self = this->shared_from_this()](auto e) {
|
||||
OPENAUTO_LOG(error) << "[USBApp] Devices enumeration failed: " << e.what();
|
||||
});
|
||||
|
||||
connectedAccessoriesEnumerator_->enumerate(std::move(promise));
|
||||
}
|
||||
|
||||
void USBApp::waitForDevice()
|
||||
{
|
||||
OPENAUTO_LOG(info) << "[USBApp] Waiting for device...";
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <QApplication>
|
||||
#include <QMainWindow>
|
||||
#include <f1x/aasdk/USB/USBHub.hpp>
|
||||
#include <f1x/aasdk/USB/ConnectedAccessoriesEnumerator.hpp>
|
||||
#include <f1x/openauto/autoapp/Configuration/Configuration.hpp>
|
||||
#include <f1x/openauto/autoapp/UI/MainWindow.hpp>
|
||||
#include <f1x/openauto/autoapp/UI/SettingsWindow.hpp>
|
||||
@ -42,8 +43,11 @@ USBMain::USBMain(libusb_context* context)
|
||||
, serviceFactory_(ioService_, configuration_)
|
||||
, androidAutoEntityFactory_(usbWrapper_, ioService_, configuration_, serviceFactory_)
|
||||
{
|
||||
aasdk::usb::IUSBHub::Pointer usbHub(std::make_shared<aasdk::usb::USBHub>(usbWrapper_, ioService_, queryChainFactory_));
|
||||
usbApp_ = std::make_shared<autoapp::usb::USBApp>(ioService_, androidAutoEntityFactory_, std::move(usbHub));
|
||||
auto usbHub(std::make_shared<aasdk::usb::USBHub>(usbWrapper_, ioService_, queryChainFactory_));
|
||||
auto ConnectedAccessoriesEnumerator(std::make_shared<aasdk::usb::ConnectedAccessoriesEnumerator>(usbWrapper_, ioService_, queryChainFactory_));
|
||||
|
||||
usbApp_ = std::make_shared<autoapp::usb::USBApp>(ioService_, androidAutoEntityFactory_,
|
||||
std::move(usbHub), std::move(ConnectedAccessoriesEnumerator));
|
||||
}
|
||||
|
||||
int USBMain::exec(int argc, char* argv[])
|
||||
|
Loading…
x
Reference in New Issue
Block a user