Reformat Code
This commit is contained in:
parent
7f38e16983
commit
478526b953
@ -18,17 +18,10 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
namespace f1x
|
|
||||||
{
|
|
||||||
namespace openauto
|
|
||||||
{
|
|
||||||
namespace autoapp
|
|
||||||
{
|
|
||||||
namespace configuration
|
|
||||||
{
|
|
||||||
|
|
||||||
enum class BluetoothAdapterType
|
namespace f1x::openauto::autoapp::configuration {
|
||||||
{
|
|
||||||
|
enum class BluetoothAdapterType {
|
||||||
NONE,
|
NONE,
|
||||||
LOCAL,
|
LOCAL,
|
||||||
REMOTE
|
REMOTE
|
||||||
@ -37,4 +30,6 @@ enum class BluetoothAdapterType
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -23,13 +23,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
namespace f1x
|
namespace f1x::openauto::autoapp::projection
|
||||||
{
|
|
||||||
namespace openauto
|
|
||||||
{
|
|
||||||
namespace autoapp
|
|
||||||
{
|
|
||||||
namespace projection
|
|
||||||
{
|
{
|
||||||
|
|
||||||
class LocalBluetoothDevice: public QObject, public IBluetoothDevice
|
class LocalBluetoothDevice: public QObject, public IBluetoothDevice
|
||||||
@ -37,7 +31,7 @@ class LocalBluetoothDevice: public QObject, public IBluetoothDevice
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LocalBluetoothDevice();
|
LocalBluetoothDevice(const QString &adapterAddress = QString(), QObject *parent = nullptr);
|
||||||
|
|
||||||
void stop() override;
|
void stop() override;
|
||||||
bool isPaired(const std::string& address) const override;
|
bool isPaired(const std::string& address) const override;
|
||||||
@ -68,6 +62,6 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -24,32 +24,29 @@
|
|||||||
#include <aap_protobuf/service/control/message/ServiceDiscoveryResponse.pb.h>
|
#include <aap_protobuf/service/control/message/ServiceDiscoveryResponse.pb.h>
|
||||||
#include <aap_protobuf/shared/MessageStatus.pb.h>
|
#include <aap_protobuf/shared/MessageStatus.pb.h>
|
||||||
|
|
||||||
namespace f1x
|
|
||||||
{
|
|
||||||
namespace openauto
|
|
||||||
{
|
|
||||||
namespace autoapp
|
|
||||||
{
|
|
||||||
namespace service
|
|
||||||
{
|
|
||||||
|
|
||||||
class IService
|
namespace f1x::openauto::autoapp::service {
|
||||||
{
|
|
||||||
public:
|
class IService {
|
||||||
|
public:
|
||||||
typedef std::shared_ptr<IService> Pointer;
|
typedef std::shared_ptr<IService> Pointer;
|
||||||
|
|
||||||
virtual ~IService() = default;
|
virtual ~IService() = default;
|
||||||
|
|
||||||
virtual void start() = 0;
|
virtual void start() = 0;
|
||||||
|
|
||||||
virtual void stop() = 0;
|
virtual void stop() = 0;
|
||||||
|
|
||||||
virtual void pause() = 0;
|
virtual void pause() = 0;
|
||||||
|
|
||||||
virtual void resume() = 0;
|
virtual void resume() = 0;
|
||||||
virtual void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse& response) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef std::vector<IService::Pointer> ServiceList;
|
virtual void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef std::vector<IService::Pointer> ServiceList;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -26,11 +26,8 @@
|
|||||||
#include <boost/asio/io_service.hpp>
|
#include <boost/asio/io_service.hpp>
|
||||||
#include <aasdk/Messenger/IMessenger.hpp>
|
#include <aasdk/Messenger/IMessenger.hpp>
|
||||||
|
|
||||||
namespace f1x {
|
|
||||||
namespace openauto {
|
namespace f1x::openauto::autoapp::service::sensor {
|
||||||
namespace autoapp {
|
|
||||||
namespace service {
|
|
||||||
namespace sensor {
|
|
||||||
class SensorService :
|
class SensorService :
|
||||||
public aasdk::channel::sensorsource::ISensorSourceServiceEventHandler,
|
public aasdk::channel::sensorsource::ISensorSourceServiceEventHandler,
|
||||||
public IService,
|
public IService,
|
||||||
@ -44,9 +41,13 @@ namespace f1x {
|
|||||||
bool stopPolling = false;
|
bool stopPolling = false;
|
||||||
|
|
||||||
void start() override;
|
void start() override;
|
||||||
|
|
||||||
void stop() override;
|
void stop() override;
|
||||||
|
|
||||||
void pause() override;
|
void pause() override;
|
||||||
|
|
||||||
void resume() override;
|
void resume() override;
|
||||||
|
|
||||||
void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override;
|
void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override;
|
||||||
|
|
||||||
void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override;
|
void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override;
|
||||||
@ -78,8 +79,7 @@ namespace f1x {
|
|||||||
bool gpsEnabled_ = false;
|
bool gpsEnabled_ = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,10 +22,7 @@
|
|||||||
#include <f1x/openauto/autoapp/Projection/IBluetoothDevice.hpp>
|
#include <f1x/openauto/autoapp/Projection/IBluetoothDevice.hpp>
|
||||||
#include <f1x/openauto/autoapp/Service/IService.hpp>
|
#include <f1x/openauto/autoapp/Service/IService.hpp>
|
||||||
|
|
||||||
namespace f1x {
|
namespace f1x::openauto::autoapp::service {
|
||||||
namespace openauto {
|
|
||||||
namespace autoapp {
|
|
||||||
namespace service {
|
|
||||||
|
|
||||||
class Service
|
class Service
|
||||||
: public IService {
|
: public IService {
|
||||||
@ -47,8 +44,4 @@ namespace f1x {
|
|||||||
boost::asio::io_service::strand strand_;
|
boost::asio::io_service::strand strand_;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -23,11 +23,8 @@
|
|||||||
#include <boost/asio/io_service.hpp>
|
#include <boost/asio/io_service.hpp>
|
||||||
#include <aasdk/Messenger/IMessenger.hpp>
|
#include <aasdk/Messenger/IMessenger.hpp>
|
||||||
|
|
||||||
namespace f1x {
|
|
||||||
namespace openauto {
|
namespace f1x::openauto::autoapp::service::vendorextension {
|
||||||
namespace autoapp {
|
|
||||||
namespace service {
|
|
||||||
namespace vendorextension {
|
|
||||||
|
|
||||||
class VendorExtensionService :
|
class VendorExtensionService :
|
||||||
public aasdk::channel::vendorextension::IVendorExtensionServiceEventHandler,
|
public aasdk::channel::vendorextension::IVendorExtensionServiceEventHandler,
|
||||||
@ -37,9 +34,13 @@ namespace f1x {
|
|||||||
VendorExtensionService(boost::asio::io_service &ioService, aasdk::messenger::IMessenger::Pointer messenger);
|
VendorExtensionService(boost::asio::io_service &ioService, aasdk::messenger::IMessenger::Pointer messenger);
|
||||||
|
|
||||||
void start() override;
|
void start() override;
|
||||||
|
|
||||||
void stop() override;
|
void stop() override;
|
||||||
|
|
||||||
void pause() override;
|
void pause() override;
|
||||||
|
|
||||||
void resume() override;
|
void resume() override;
|
||||||
|
|
||||||
void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override;
|
void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override;
|
||||||
|
|
||||||
void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override;
|
void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override;
|
||||||
@ -54,8 +55,7 @@ namespace f1x {
|
|||||||
aasdk::channel::vendorextension::VendorExtensionService::Pointer channel_;
|
aasdk::channel::vendorextension::VendorExtensionService::Pointer channel_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,11 +23,8 @@
|
|||||||
#include <boost/asio/io_service.hpp>
|
#include <boost/asio/io_service.hpp>
|
||||||
#include <aasdk/Messenger/IMessenger.hpp>
|
#include <aasdk/Messenger/IMessenger.hpp>
|
||||||
|
|
||||||
namespace f1x {
|
|
||||||
namespace openauto {
|
namespace f1x::openauto::autoapp::service::wifiprojection {
|
||||||
namespace autoapp {
|
|
||||||
namespace service {
|
|
||||||
namespace wifiprojection {
|
|
||||||
|
|
||||||
class WifiProjectionService :
|
class WifiProjectionService :
|
||||||
public aasdk::channel::wifiprojection::IWifiProjectionServiceEventHandler,
|
public aasdk::channel::wifiprojection::IWifiProjectionServiceEventHandler,
|
||||||
@ -37,9 +34,13 @@ namespace f1x {
|
|||||||
WifiProjectionService(boost::asio::io_service &ioService, aasdk::messenger::IMessenger::Pointer messenger);
|
WifiProjectionService(boost::asio::io_service &ioService, aasdk::messenger::IMessenger::Pointer messenger);
|
||||||
|
|
||||||
void start() override;
|
void start() override;
|
||||||
|
|
||||||
void stop() override;
|
void stop() override;
|
||||||
|
|
||||||
void pause() override;
|
void pause() override;
|
||||||
|
|
||||||
void resume() override;
|
void resume() override;
|
||||||
|
|
||||||
void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override;
|
void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override;
|
||||||
|
|
||||||
void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override;
|
void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override;
|
||||||
@ -47,7 +48,8 @@ namespace f1x {
|
|||||||
void onChannelError(const aasdk::error::Error &e) override;
|
void onChannelError(const aasdk::error::Error &e) override;
|
||||||
|
|
||||||
void
|
void
|
||||||
onWifiCredentialsRequest(const aap_protobuf::service::wifiprojection::message::WifiCredentialsRequest &request) override;
|
onWifiCredentialsRequest(
|
||||||
|
const aap_protobuf::service::wifiprojection::message::WifiCredentialsRequest &request) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using std::enable_shared_from_this<WifiProjectionService>::shared_from_this;
|
using std::enable_shared_from_this<WifiProjectionService>::shared_from_this;
|
||||||
@ -56,8 +58,7 @@ namespace f1x {
|
|||||||
aasdk::channel::wifiprojection::WifiProjectionService::Pointer channel_;
|
aasdk::channel::wifiprojection::WifiProjectionService::Pointer channel_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,13 +35,7 @@ namespace Ui
|
|||||||
class SettingsWindow;
|
class SettingsWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace f1x
|
namespace f1x::openauto::autoapp::ui
|
||||||
{
|
|
||||||
namespace openauto
|
|
||||||
{
|
|
||||||
namespace autoapp
|
|
||||||
{
|
|
||||||
namespace ui
|
|
||||||
{
|
{
|
||||||
|
|
||||||
class SettingsWindow : public QWidget
|
class SettingsWindow : public QWidget
|
||||||
@ -112,6 +106,6 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -22,57 +22,41 @@
|
|||||||
#include <f1x/openauto/autoapp/App.hpp>
|
#include <f1x/openauto/autoapp/App.hpp>
|
||||||
#include <f1x/openauto/Common/Log.hpp>
|
#include <f1x/openauto/Common/Log.hpp>
|
||||||
|
|
||||||
namespace f1x
|
namespace f1x::openauto::autoapp {
|
||||||
{
|
|
||||||
namespace openauto
|
|
||||||
{
|
|
||||||
namespace autoapp
|
|
||||||
{
|
|
||||||
|
|
||||||
App::App(boost::asio::io_service& ioService, aasdk::usb::USBWrapper& usbWrapper, aasdk::tcp::ITCPWrapper& tcpWrapper, service::IAndroidAutoEntityFactory& androidAutoEntityFactory,
|
App::App(boost::asio::io_service &ioService, aasdk::usb::USBWrapper &usbWrapper, aasdk::tcp::ITCPWrapper &tcpWrapper,
|
||||||
aasdk::usb::IUSBHub::Pointer usbHub, aasdk::usb::IConnectedAccessoriesEnumerator::Pointer connectedAccessoriesEnumerator)
|
service::IAndroidAutoEntityFactory &androidAutoEntityFactory,
|
||||||
: ioService_(ioService)
|
aasdk::usb::IUSBHub::Pointer usbHub,
|
||||||
, usbWrapper_(usbWrapper)
|
aasdk::usb::IConnectedAccessoriesEnumerator::Pointer connectedAccessoriesEnumerator)
|
||||||
, tcpWrapper_(tcpWrapper)
|
: ioService_(ioService), usbWrapper_(usbWrapper), tcpWrapper_(tcpWrapper), strand_(ioService_),
|
||||||
, strand_(ioService_)
|
androidAutoEntityFactory_(androidAutoEntityFactory), usbHub_(std::move(usbHub)),
|
||||||
, androidAutoEntityFactory_(androidAutoEntityFactory)
|
connectedAccessoriesEnumerator_(std::move(connectedAccessoriesEnumerator)),
|
||||||
, usbHub_(std::move(usbHub))
|
acceptor_(ioService, boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), 5000)), isStopped_(false) {
|
||||||
, connectedAccessoriesEnumerator_(std::move(connectedAccessoriesEnumerator))
|
|
||||||
, acceptor_(ioService, boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), 5000 ))
|
|
||||||
, isStopped_(false)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::waitForUSBDevice()
|
void App::waitForUSBDevice() {
|
||||||
{
|
|
||||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
this->waitForDevice();
|
this->waitForDevice();
|
||||||
}
|
}
|
||||||
catch(...)
|
catch (...) {
|
||||||
{
|
|
||||||
OPENAUTO_LOG(error) << "[App] waitForUSBDevice() -exception caused by this->waitForDevice();";
|
OPENAUTO_LOG(error) << "[App] waitForUSBDevice() -exception caused by this->waitForDevice();";
|
||||||
}
|
}
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
this->enumerateDevices();
|
this->enumerateDevices();
|
||||||
}
|
}
|
||||||
catch(...)
|
catch (...) {
|
||||||
{
|
|
||||||
OPENAUTO_LOG(error) << "[App] waitForUSBDevice() exception caused by this->enumerateDevices()";
|
OPENAUTO_LOG(error) << "[App] waitForUSBDevice() exception caused by this->enumerateDevices()";
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::start(aasdk::tcp::ITCPEndpoint::SocketPointer socket)
|
void App::start(aasdk::tcp::ITCPEndpoint::SocketPointer socket) {
|
||||||
{
|
|
||||||
strand_.dispatch([this, self = this->shared_from_this(), socket = std::move(socket)]() mutable {
|
strand_.dispatch([this, self = this->shared_from_this(), socket = std::move(socket)]() mutable {
|
||||||
OPENAUTO_LOG(info) << "Start from socket";
|
OPENAUTO_LOG(info) << "Start from socket";
|
||||||
if(androidAutoEntity_ != nullptr)
|
if (androidAutoEntity_ != nullptr) {
|
||||||
{
|
|
||||||
// tcpWrapper_.close(*socket);
|
// tcpWrapper_.close(*socket);
|
||||||
// OPENAUTO_LOG(warning) << "[App] android auto entity is still running.";
|
// OPENAUTO_LOG(warning) << "[App] android auto entity is still running.";
|
||||||
// return;
|
// return;
|
||||||
@ -88,8 +72,7 @@ void App::start(aasdk::tcp::ITCPEndpoint::SocketPointer socket)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
// usbHub_->cancel();
|
// usbHub_->cancel();
|
||||||
// connectedAccessoriesEnumerator_->cancel();
|
// connectedAccessoriesEnumerator_->cancel();
|
||||||
|
|
||||||
@ -97,18 +80,16 @@ void App::start(aasdk::tcp::ITCPEndpoint::SocketPointer socket)
|
|||||||
androidAutoEntity_ = androidAutoEntityFactory_.create(std::move(tcpEndpoint));
|
androidAutoEntity_ = androidAutoEntityFactory_.create(std::move(tcpEndpoint));
|
||||||
androidAutoEntity_->start(*this);
|
androidAutoEntity_->start(*this);
|
||||||
}
|
}
|
||||||
catch(const aasdk::error::Error& error)
|
catch (const aasdk::error::Error &error) {
|
||||||
{
|
|
||||||
OPENAUTO_LOG(error) << "[App] TCP AndroidAutoEntity create error: " << error.what();
|
OPENAUTO_LOG(error) << "[App] TCP AndroidAutoEntity create error: " << error.what();
|
||||||
|
|
||||||
//androidAutoEntity_.reset();
|
//androidAutoEntity_.reset();
|
||||||
this->waitForDevice();
|
this->waitForDevice();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::stop()
|
void App::stop() {
|
||||||
{
|
|
||||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||||
isStopped_ = true;
|
isStopped_ = true;
|
||||||
try {
|
try {
|
||||||
@ -122,8 +103,7 @@ void App::stop()
|
|||||||
OPENAUTO_LOG(error) << "[App] stop: exception caused by usbHub_->cancel();";
|
OPENAUTO_LOG(error) << "[App] stop: exception caused by usbHub_->cancel();";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(androidAutoEntity_ != nullptr)
|
if (androidAutoEntity_ != nullptr) {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
androidAutoEntity_->stop();
|
androidAutoEntity_->stop();
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
@ -137,20 +117,17 @@ void App::stop()
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::aoapDeviceHandler(aasdk::usb::DeviceHandle deviceHandle)
|
void App::aoapDeviceHandler(aasdk::usb::DeviceHandle deviceHandle) {
|
||||||
{
|
|
||||||
OPENAUTO_LOG(info) << "[App] Device connected.";
|
OPENAUTO_LOG(info) << "[App] Device connected.";
|
||||||
|
|
||||||
if(androidAutoEntity_ != nullptr)
|
if (androidAutoEntity_ != nullptr) {
|
||||||
{
|
|
||||||
OPENAUTO_LOG(warning) << "[App] android auto entity is still running.";
|
OPENAUTO_LOG(warning) << "[App] android auto entity is still running.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
// ignore autostart if exit to csng was used
|
// ignore autostart if exit to csng was used
|
||||||
if (!disableAutostartEntity) {
|
if (!disableAutostartEntity) {
|
||||||
OPENAUTO_LOG(info) << "[App] Start Android Auto allowed - let's go.";
|
OPENAUTO_LOG(info) << "[App] Start Android Auto allowed - let's go.";
|
||||||
@ -163,17 +140,15 @@ void App::aoapDeviceHandler(aasdk::usb::DeviceHandle deviceHandle)
|
|||||||
OPENAUTO_LOG(info) << "[App] Start Android Auto not allowed - skip.";
|
OPENAUTO_LOG(info) << "[App] Start Android Auto not allowed - skip.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(const aasdk::error::Error& error)
|
catch (const aasdk::error::Error &error) {
|
||||||
{
|
|
||||||
OPENAUTO_LOG(error) << "[App] USB AndroidAutoEntity create error: " << error.what();
|
OPENAUTO_LOG(error) << "[App] USB AndroidAutoEntity create error: " << error.what();
|
||||||
|
|
||||||
androidAutoEntity_.reset();
|
androidAutoEntity_.reset();
|
||||||
this->waitForDevice();
|
this->waitForDevice();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::enumerateDevices()
|
void App::enumerateDevices() {
|
||||||
{
|
|
||||||
auto promise = aasdk::usb::IConnectedAccessoriesEnumerator::Promise::defer(strand_);
|
auto promise = aasdk::usb::IConnectedAccessoriesEnumerator::Promise::defer(strand_);
|
||||||
promise->then([this, self = this->shared_from_this()](auto result) {
|
promise->then([this, self = this->shared_from_this()](auto result) {
|
||||||
OPENAUTO_LOG(info) << "[App] Devices enumeration result: " << result;
|
OPENAUTO_LOG(info) << "[App] Devices enumeration result: " << result;
|
||||||
@ -183,10 +158,9 @@ void App::enumerateDevices()
|
|||||||
});
|
});
|
||||||
|
|
||||||
connectedAccessoriesEnumerator_->enumerate(std::move(promise));
|
connectedAccessoriesEnumerator_->enumerate(std::move(promise));
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::waitForDevice()
|
void App::waitForDevice() {
|
||||||
{
|
|
||||||
OPENAUTO_LOG(info) << "[App] Waiting for device...";
|
OPENAUTO_LOG(info) << "[App] Waiting for device...";
|
||||||
|
|
||||||
auto promise = aasdk::usb::IUSBHub::Promise::defer(strand_);
|
auto promise = aasdk::usb::IUSBHub::Promise::defer(strand_);
|
||||||
@ -194,9 +168,9 @@ void App::waitForDevice()
|
|||||||
std::bind(&App::onUSBHubError, this->shared_from_this(), std::placeholders::_1));
|
std::bind(&App::onUSBHubError, this->shared_from_this(), std::placeholders::_1));
|
||||||
usbHub_->start(std::move(promise));
|
usbHub_->start(std::move(promise));
|
||||||
startServerSocket();
|
startServerSocket();
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::startServerSocket() {
|
void App::startServerSocket() {
|
||||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||||
OPENAUTO_LOG(info) << "startServerSocket() - Listening for WIFI Clients on Port 5000";
|
OPENAUTO_LOG(info) << "startServerSocket() - Listening for WIFI Clients on Port 5000";
|
||||||
auto socket = std::make_shared<boost::asio::ip::tcp::socket>(ioService_);
|
auto socket = std::make_shared<boost::asio::ip::tcp::socket>(ioService_);
|
||||||
@ -205,38 +179,35 @@ void App::startServerSocket() {
|
|||||||
std::bind(&App::handleNewClient, this, socket, std::placeholders::_1)
|
std::bind(&App::handleNewClient, this, socket, std::placeholders::_1)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::handleNewClient(std::shared_ptr<boost::asio::ip::tcp::socket> socket, const boost::system::error_code &err) {
|
void
|
||||||
|
App::handleNewClient(std::shared_ptr<boost::asio::ip::tcp::socket> socket, const boost::system::error_code &err) {
|
||||||
OPENAUTO_LOG(info) << "handleNewClient() - Handle WIFI Client Connection";
|
OPENAUTO_LOG(info) << "handleNewClient() - Handle WIFI Client Connection";
|
||||||
if (!err) {
|
if (!err) {
|
||||||
start(std::move(socket));
|
start(std::move(socket));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::pause()
|
void App::pause() {
|
||||||
{
|
|
||||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||||
OPENAUTO_LOG(info) << "[App] pause...";
|
OPENAUTO_LOG(info) << "[App] pause...";
|
||||||
androidAutoEntity_->pause();
|
androidAutoEntity_->pause();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::resume()
|
void App::resume() {
|
||||||
{
|
|
||||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||||
if(androidAutoEntity_ != nullptr)
|
if (androidAutoEntity_ != nullptr) {
|
||||||
{
|
|
||||||
OPENAUTO_LOG(info) << "[App] resume...";
|
OPENAUTO_LOG(info) << "[App] resume...";
|
||||||
androidAutoEntity_->resume();
|
androidAutoEntity_->resume();
|
||||||
} else {
|
} else {
|
||||||
OPENAUTO_LOG(info) << "[App] Ignore resume -> no androidAutoEntity_ ...";
|
OPENAUTO_LOG(info) << "[App] Ignore resume -> no androidAutoEntity_ ...";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::onAndroidAutoQuit()
|
void App::onAndroidAutoQuit() {
|
||||||
{
|
|
||||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||||
OPENAUTO_LOG(info) << "[App] onAndroidAutoQuit()";
|
OPENAUTO_LOG(info) << "[App] onAndroidAutoQuit()";
|
||||||
|
|
||||||
@ -255,8 +226,7 @@ void App::onAndroidAutoQuit()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isStopped_)
|
if (!isStopped_) {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
this->waitForDevice();
|
this->waitForDevice();
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
@ -264,10 +234,9 @@ void App::onAndroidAutoQuit()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::onUSBHubError(const aasdk::error::Error& error)
|
void App::onUSBHubError(const aasdk::error::Error &error) {
|
||||||
{
|
|
||||||
OPENAUTO_LOG(error) << "[App] onUSBHubError(): " << error.what();
|
OPENAUTO_LOG(error) << "[App] onUSBHubError(): " << error.what();
|
||||||
|
|
||||||
// if(error != aasdk::error::ErrorCode::OPERATION_ABORTED &&
|
// if(error != aasdk::error::ErrorCode::OPERATION_ABORTED &&
|
||||||
@ -279,8 +248,8 @@ void App::onUSBHubError(const aasdk::error::Error& error)
|
|||||||
// OPENAUTO_LOG(error) << "[App] onUSBHubError: exception caused by this->waitForDevice();";
|
// OPENAUTO_LOG(error) << "[App] onUSBHubError: exception caused by this->waitForDevice();";
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -20,13 +20,10 @@
|
|||||||
#include <f1x/openauto/Common/Log.hpp>
|
#include <f1x/openauto/Common/Log.hpp>
|
||||||
#include <QTouchDevice>
|
#include <QTouchDevice>
|
||||||
|
|
||||||
namespace f1x
|
|
||||||
{
|
|
||||||
namespace openauto
|
|
||||||
{
|
namespace f1x::openauto::autoapp::configuration
|
||||||
namespace autoapp
|
|
||||||
{
|
|
||||||
namespace configuration
|
|
||||||
{
|
{
|
||||||
|
|
||||||
const std::string Configuration::cConfigFileName = "openauto.ini";
|
const std::string Configuration::cConfigFileName = "openauto.ini";
|
||||||
@ -766,6 +763,6 @@ void Configuration::writeButtonCodes(boost::property_tree::ptree& iniConfig)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -18,13 +18,10 @@
|
|||||||
|
|
||||||
#include <f1x/openauto/autoapp/Projection/DummyBluetoothDevice.hpp>
|
#include <f1x/openauto/autoapp/Projection/DummyBluetoothDevice.hpp>
|
||||||
|
|
||||||
namespace f1x
|
|
||||||
{
|
|
||||||
namespace openauto
|
|
||||||
{
|
namespace f1x::openauto::autoapp::projection
|
||||||
namespace autoapp
|
|
||||||
{
|
|
||||||
namespace projection
|
|
||||||
{
|
{
|
||||||
|
|
||||||
void DummyBluetoothDevice::stop()
|
void DummyBluetoothDevice::stop()
|
||||||
@ -53,6 +50,6 @@ bool DummyBluetoothDevice::isAvailable() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -22,14 +22,7 @@
|
|||||||
#include <QBluetoothUuid>
|
#include <QBluetoothUuid>
|
||||||
#include <QtBluetooth>
|
#include <QtBluetooth>
|
||||||
|
|
||||||
namespace f1x
|
namespace f1x::openauto::autoapp::projection {
|
||||||
{
|
|
||||||
namespace openauto
|
|
||||||
{
|
|
||||||
namespace autoapp
|
|
||||||
{
|
|
||||||
namespace projection
|
|
||||||
{
|
|
||||||
|
|
||||||
LocalBluetoothDevice::LocalBluetoothDevice()
|
LocalBluetoothDevice::LocalBluetoothDevice()
|
||||||
{
|
{
|
||||||
@ -183,7 +176,3 @@ void LocalBluetoothDevice::onHostModeStateChanged(QBluetoothLocalDevice::HostMod
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -19,11 +19,7 @@
|
|||||||
#include <f1x/openauto/Common/Log.hpp>
|
#include <f1x/openauto/Common/Log.hpp>
|
||||||
#include <f1x/openauto/autoapp/Service/Bluetooth/BluetoothService.hpp>
|
#include <f1x/openauto/autoapp/Service/Bluetooth/BluetoothService.hpp>
|
||||||
|
|
||||||
namespace f1x {
|
namespace f1x::openauto::autoapp::service::bluetooth {
|
||||||
namespace openauto {
|
|
||||||
namespace autoapp {
|
|
||||||
namespace service {
|
|
||||||
namespace bluetooth {
|
|
||||||
|
|
||||||
BluetoothService::BluetoothService(boost::asio::io_service &ioService,
|
BluetoothService::BluetoothService(boost::asio::io_service &ioService,
|
||||||
aasdk::messenger::IMessenger::Pointer messenger,
|
aasdk::messenger::IMessenger::Pointer messenger,
|
||||||
@ -82,9 +78,11 @@ namespace f1x {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BluetoothService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) {
|
void
|
||||||
|
BluetoothService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) {
|
||||||
OPENAUTO_LOG(info) << "[BluetoothService] onChannelOpenRequest()";
|
OPENAUTO_LOG(info) << "[BluetoothService] onChannelOpenRequest()";
|
||||||
OPENAUTO_LOG(debug) << "[BluetoothService] Channel Id: " << request.service_id() << ", Priority: " << request.priority();
|
OPENAUTO_LOG(debug) << "[BluetoothService] Channel Id: " << request.service_id() << ", Priority: "
|
||||||
|
<< request.priority();
|
||||||
|
|
||||||
aap_protobuf::service::control::message::ChannelOpenResponse response;
|
aap_protobuf::service::control::message::ChannelOpenResponse response;
|
||||||
const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS;
|
const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS;
|
||||||
@ -94,7 +92,6 @@ namespace f1x {
|
|||||||
promise->then([]() {}, std::bind(&BluetoothService::onChannelError, this->shared_from_this(),
|
promise->then([]() {}, std::bind(&BluetoothService::onChannelError, this->shared_from_this(),
|
||||||
std::placeholders::_1));
|
std::placeholders::_1));
|
||||||
channel_->sendChannelOpenResponse(response, std::move(promise));
|
channel_->sendChannelOpenResponse(response, std::move(promise));
|
||||||
|
|
||||||
channel_->receive(this->shared_from_this());
|
channel_->receive(this->shared_from_this());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,14 +119,18 @@ namespace f1x {
|
|||||||
response.set_already_paired(isPaired);
|
response.set_already_paired(isPaired);
|
||||||
|
|
||||||
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
||||||
promise->then(std::bind(&BluetoothService::sendBluetoothAuthenticationData, this->shared_from_this()), std::bind(&BluetoothService::onChannelError, this->shared_from_this(),
|
promise->then(std::bind(&BluetoothService::sendBluetoothAuthenticationData, this->shared_from_this()),
|
||||||
|
std::bind(&BluetoothService::onChannelError, this->shared_from_this(),
|
||||||
std::placeholders::_1));
|
std::placeholders::_1));
|
||||||
channel_->sendBluetoothPairingResponse(response, std::move(promise));
|
channel_->sendBluetoothPairingResponse(response, std::move(promise));
|
||||||
channel_->receive(this->shared_from_this());
|
channel_->receive(this->shared_from_this());
|
||||||
}
|
}
|
||||||
|
|
||||||
void BluetoothService::sendBluetoothAuthenticationData() {
|
void BluetoothService::sendBluetoothAuthenticationData() {
|
||||||
|
OPENAUTO_LOG(info) << "[BluetoothService] sendBluetoothAuthenticationData()";
|
||||||
|
|
||||||
aap_protobuf::service::bluetooth::message::BluetoothAuthenticationData data;
|
aap_protobuf::service::bluetooth::message::BluetoothAuthenticationData data;
|
||||||
|
// TODO: Bluetooth Authentication Data
|
||||||
data.set_auth_data("123456");
|
data.set_auth_data("123456");
|
||||||
data.set_pairing_method(aap_protobuf::service::bluetooth::message::BluetoothPairingMethod::BLUETOOTH_PAIRING_PIN);
|
data.set_pairing_method(aap_protobuf::service::bluetooth::message::BluetoothPairingMethod::BLUETOOTH_PAIRING_PIN);
|
||||||
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
||||||
@ -139,7 +140,8 @@ namespace f1x {
|
|||||||
channel_->receive(this->shared_from_this());
|
channel_->receive(this->shared_from_this());
|
||||||
}
|
}
|
||||||
|
|
||||||
void BluetoothService::onBluetoothAuthenticationResult(const aap_protobuf::service::bluetooth::message::BluetoothAuthenticationResult &request) {
|
void BluetoothService::onBluetoothAuthenticationResult(
|
||||||
|
const aap_protobuf::service::bluetooth::message::BluetoothAuthenticationResult &request) {
|
||||||
OPENAUTO_LOG(info) << "[BluetoothService] onBluetoothAuthenticationResult()";
|
OPENAUTO_LOG(info) << "[BluetoothService] onBluetoothAuthenticationResult()";
|
||||||
OPENAUTO_LOG(info) << "[BluetoothService] AuthData " << request.status();
|
OPENAUTO_LOG(info) << "[BluetoothService] AuthData " << request.status();
|
||||||
aap_protobuf::service::bluetooth::message::BluetoothPairingResponse response;
|
aap_protobuf::service::bluetooth::message::BluetoothPairingResponse response;
|
||||||
@ -150,8 +152,7 @@ namespace f1x {
|
|||||||
void BluetoothService::onChannelError(const aasdk::error::Error &e) {
|
void BluetoothService::onChannelError(const aasdk::error::Error &e) {
|
||||||
OPENAUTO_LOG(error) << "[BluetoothService] onChannelError(): " << e.what();
|
OPENAUTO_LOG(error) << "[BluetoothService] onChannelError(): " << e.what();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,17 +21,14 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
namespace f1x {
|
namespace f1x::openauto::autoapp::service::genericnotification {
|
||||||
namespace openauto {
|
|
||||||
namespace autoapp {
|
|
||||||
namespace service {
|
|
||||||
namespace genericnotification {
|
|
||||||
|
|
||||||
GenericNotificationService::GenericNotificationService(boost::asio::io_service &ioService,
|
GenericNotificationService::GenericNotificationService(boost::asio::io_service &ioService,
|
||||||
aasdk::messenger::IMessenger::Pointer messenger)
|
aasdk::messenger::IMessenger::Pointer messenger)
|
||||||
: strand_(ioService),
|
: strand_(ioService),
|
||||||
timer_(ioService),
|
timer_(ioService),
|
||||||
channel_(std::make_shared<aasdk::channel::genericnotification::GenericNotificationService>(strand_, std::move(messenger))) {
|
channel_(std::make_shared<aasdk::channel::genericnotification::GenericNotificationService>(strand_, std::move(
|
||||||
|
messenger))) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,9 +66,11 @@ namespace f1x {
|
|||||||
auto *genericNotification = service->mutable_wifi_projection_service();
|
auto *genericNotification = service->mutable_wifi_projection_service();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenericNotificationService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) {
|
void GenericNotificationService::onChannelOpenRequest(
|
||||||
|
const aap_protobuf::service::control::message::ChannelOpenRequest &request) {
|
||||||
OPENAUTO_LOG(info) << "[GenericNotificationService] onChannelOpenRequest()";
|
OPENAUTO_LOG(info) << "[GenericNotificationService] onChannelOpenRequest()";
|
||||||
OPENAUTO_LOG(debug) << "[GenericNotificationService] Channel Id: " << request.service_id() << ", Priority: " << request.priority();
|
OPENAUTO_LOG(debug) << "[GenericNotificationService] Channel Id: " << request.service_id() << ", Priority: "
|
||||||
|
<< request.priority();
|
||||||
|
|
||||||
aap_protobuf::service::control::message::ChannelOpenResponse response;
|
aap_protobuf::service::control::message::ChannelOpenResponse response;
|
||||||
const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS;
|
const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS;
|
||||||
@ -88,8 +87,7 @@ namespace f1x {
|
|||||||
void GenericNotificationService::onChannelError(const aasdk::error::Error &e) {
|
void GenericNotificationService::onChannelError(const aasdk::error::Error &e) {
|
||||||
OPENAUTO_LOG(error) << "[GenericNotificationService] onChannelError(): " << e.what();
|
OPENAUTO_LOG(error) << "[GenericNotificationService] onChannelError(): " << e.what();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,11 +18,8 @@
|
|||||||
|
|
||||||
#include <f1x/openauto/autoapp/Service/MediaSink/GuidanceAudioService.hpp>
|
#include <f1x/openauto/autoapp/Service/MediaSink/GuidanceAudioService.hpp>
|
||||||
|
|
||||||
namespace f1x {
|
|
||||||
namespace openauto {
|
namespace f1x::openauto::autoapp::service::mediasink {
|
||||||
namespace autoapp {
|
|
||||||
namespace service {
|
|
||||||
namespace mediasink {
|
|
||||||
using f1x::openauto::autoapp::service::mediasink::GuidanceAudioService;
|
using f1x::openauto::autoapp::service::mediasink::GuidanceAudioService;
|
||||||
using f1x::openauto::autoapp::service::mediasink::AudioMediaSinkService;
|
using f1x::openauto::autoapp::service::mediasink::AudioMediaSinkService;
|
||||||
using aasdk::channel::mediasink::audio::channel::GuidanceAudioChannel;
|
using aasdk::channel::mediasink::audio::channel::GuidanceAudioChannel;
|
||||||
@ -36,8 +33,7 @@ namespace f1x {
|
|||||||
std::move(audioOutput)) {
|
std::move(audioOutput)) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,12 +19,7 @@
|
|||||||
#include <f1x/openauto/autoapp/Service/MediaSink/MediaAudioService.hpp>
|
#include <f1x/openauto/autoapp/Service/MediaSink/MediaAudioService.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
namespace f1x::openauto::autoapp::service::mediasink {
|
||||||
namespace f1x {
|
|
||||||
namespace openauto {
|
|
||||||
namespace autoapp {
|
|
||||||
namespace service {
|
|
||||||
namespace mediasink {
|
|
||||||
MediaAudioService::MediaAudioService(boost::asio::io_service &ioService,
|
MediaAudioService::MediaAudioService(boost::asio::io_service &ioService,
|
||||||
aasdk::messenger::IMessenger::Pointer messenger,
|
aasdk::messenger::IMessenger::Pointer messenger,
|
||||||
projection::IAudioOutput::Pointer audioOutput)
|
projection::IAudioOutput::Pointer audioOutput)
|
||||||
@ -35,8 +30,7 @@ namespace f1x {
|
|||||||
std::move(audioOutput)) {
|
std::move(audioOutput)) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,23 +19,20 @@
|
|||||||
#include <aasdk/Channel/MediaSink/Audio/Channel/SystemAudioChannel.hpp>
|
#include <aasdk/Channel/MediaSink/Audio/Channel/SystemAudioChannel.hpp>
|
||||||
#include <f1x/openauto/autoapp/Service/MediaSink/SystemAudioService.hpp>
|
#include <f1x/openauto/autoapp/Service/MediaSink/SystemAudioService.hpp>
|
||||||
|
|
||||||
namespace f1x {
|
|
||||||
namespace openauto {
|
namespace f1x::openauto::autoapp::service::mediasink {
|
||||||
namespace autoapp {
|
|
||||||
namespace service {
|
|
||||||
namespace mediasink {
|
|
||||||
SystemAudioService::SystemAudioService(boost::asio::io_service &ioService,
|
SystemAudioService::SystemAudioService(boost::asio::io_service &ioService,
|
||||||
aasdk::messenger::IMessenger::Pointer messenger,
|
aasdk::messenger::IMessenger::Pointer messenger,
|
||||||
projection::IAudioOutput::Pointer audioOutput)
|
projection::IAudioOutput::Pointer audioOutput)
|
||||||
: AudioMediaSinkService(ioService,
|
: AudioMediaSinkService(ioService,
|
||||||
std::make_shared<aasdk::channel::mediasink::audio::channel::SystemAudioChannel>(strand_,
|
std::make_shared<aasdk::channel::mediasink::audio::channel::SystemAudioChannel>(strand_,
|
||||||
std::move(messenger)),
|
std::move(
|
||||||
|
messenger)),
|
||||||
std::move(audioOutput)) {
|
std::move(audioOutput)) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,15 +16,11 @@
|
|||||||
* along with openauto. If not, see <http://www.gnu.org/licenses/>.
|
* along with openauto. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <time.h>
|
|
||||||
#include <f1x/openauto/Common/Log.hpp>
|
#include <f1x/openauto/Common/Log.hpp>
|
||||||
#include <f1x/openauto/autoapp/Service/MediaSource/MediaSourceService.hpp>
|
#include <f1x/openauto/autoapp/Service/MediaSource/MediaSourceService.hpp>
|
||||||
|
|
||||||
namespace f1x {
|
|
||||||
namespace openauto {
|
namespace f1x::openauto::autoapp::service::mediasource {
|
||||||
namespace autoapp {
|
|
||||||
namespace service {
|
|
||||||
namespace mediasource {
|
|
||||||
|
|
||||||
MediaSourceService::MediaSourceService(boost::asio::io_service &ioService,
|
MediaSourceService::MediaSourceService(boost::asio::io_service &ioService,
|
||||||
aasdk::channel::mediasource::IMediaSourceService::Pointer channel,
|
aasdk::channel::mediasource::IMediaSourceService::Pointer channel,
|
||||||
@ -92,15 +88,18 @@ namespace f1x {
|
|||||||
* Open Service Channel Request
|
* Open Service Channel Request
|
||||||
* @param request
|
* @param request
|
||||||
*/
|
*/
|
||||||
void MediaSourceService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) {
|
void
|
||||||
|
MediaSourceService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) {
|
||||||
OPENAUTO_LOG(info) << "[MediaSourceService] onChannelOpenRequest()";
|
OPENAUTO_LOG(info) << "[MediaSourceService] onChannelOpenRequest()";
|
||||||
OPENAUTO_LOG(info) << "[MediaSourceService] Channel Id: " << request.service_id() << ", Priority: " << request.priority();
|
OPENAUTO_LOG(info) << "[MediaSourceService] Channel Id: " << request.service_id() << ", Priority: "
|
||||||
|
<< request.priority();
|
||||||
|
|
||||||
const aap_protobuf::shared::MessageStatus status = audioInput_->open()
|
const aap_protobuf::shared::MessageStatus status = audioInput_->open()
|
||||||
? aap_protobuf::shared::MessageStatus::STATUS_SUCCESS
|
? aap_protobuf::shared::MessageStatus::STATUS_SUCCESS
|
||||||
: aap_protobuf::shared::MessageStatus::STATUS_INTERNAL_ERROR;
|
: aap_protobuf::shared::MessageStatus::STATUS_INTERNAL_ERROR;
|
||||||
|
|
||||||
OPENAUTO_LOG(info) << "[MediaSourceService] Status determined: " << aap_protobuf::shared::MessageStatus_Name(status);
|
OPENAUTO_LOG(info) << "[MediaSourceService] Status determined: "
|
||||||
|
<< aap_protobuf::shared::MessageStatus_Name(status);
|
||||||
|
|
||||||
aap_protobuf::service::control::message::ChannelOpenResponse response;
|
aap_protobuf::service::control::message::ChannelOpenResponse response;
|
||||||
response.set_status(status);
|
response.set_status(status);
|
||||||
@ -134,7 +133,8 @@ namespace f1x {
|
|||||||
MediaSourceService::onMediaChannelSetupRequest(const aap_protobuf::service::media::shared::message::Setup &request) {
|
MediaSourceService::onMediaChannelSetupRequest(const aap_protobuf::service::media::shared::message::Setup &request) {
|
||||||
|
|
||||||
OPENAUTO_LOG(info) << "[MediaSourceService] onMediaChannelSetupRequest()";
|
OPENAUTO_LOG(info) << "[MediaSourceService] onMediaChannelSetupRequest()";
|
||||||
OPENAUTO_LOG(info) << "[MediaSourceService] Channel Id: " << aasdk::messenger::channelIdToString(channel_->getId()) << ", Codec: " << MediaCodecType_Name(request.type());
|
OPENAUTO_LOG(info) << "[MediaSourceService] Channel Id: " << aasdk::messenger::channelIdToString(channel_->getId())
|
||||||
|
<< ", Codec: " << MediaCodecType_Name(request.type());
|
||||||
|
|
||||||
aap_protobuf::service::media::shared::message::Config response;
|
aap_protobuf::service::media::shared::message::Config response;
|
||||||
auto status = aap_protobuf::service::media::shared::message::Config::STATUS_READY;
|
auto status = aap_protobuf::service::media::shared::message::Config::STATUS_READY;
|
||||||
@ -170,7 +170,9 @@ namespace f1x {
|
|||||||
void MediaSourceService::onMediaSourceOpenRequest(
|
void MediaSourceService::onMediaSourceOpenRequest(
|
||||||
const aap_protobuf::service::media::source::message::MicrophoneRequest &request) {
|
const aap_protobuf::service::media::source::message::MicrophoneRequest &request) {
|
||||||
OPENAUTO_LOG(info) << "[MediaSourceService] onMediaSourceOpenRequest()";
|
OPENAUTO_LOG(info) << "[MediaSourceService] onMediaSourceOpenRequest()";
|
||||||
OPENAUTO_LOG(info) << "[MediaSourceService] Request to Open?: " << request.open() << ", anc: " << request.anc_enabled() << ", ec: " << request.ec_enabled() << ", max unacked: " << request.max_unacked();
|
OPENAUTO_LOG(info) << "[MediaSourceService] Request to Open?: " << request.open() << ", anc: "
|
||||||
|
<< request.anc_enabled() << ", ec: " << request.ec_enabled() << ", max unacked: "
|
||||||
|
<< request.max_unacked();
|
||||||
|
|
||||||
if (request.open()) {
|
if (request.open()) {
|
||||||
// Request for Channel Open
|
// Request for Channel Open
|
||||||
@ -264,8 +266,8 @@ namespace f1x {
|
|||||||
audioInput_->read(std::move(readPromise));
|
audioInput_->read(std::move(readPromise));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,22 +19,18 @@
|
|||||||
#include <aasdk/Channel/MediaSource/Audio/MicrophoneAudioChannel.hpp>
|
#include <aasdk/Channel/MediaSource/Audio/MicrophoneAudioChannel.hpp>
|
||||||
#include <f1x/openauto/autoapp/Service/MediaSource/MicrophoneMediaSourceService.hpp>
|
#include <f1x/openauto/autoapp/Service/MediaSource/MicrophoneMediaSourceService.hpp>
|
||||||
|
|
||||||
namespace f1x {
|
namespace f1x::openauto::autoapp::service::mediasource {
|
||||||
namespace openauto {
|
|
||||||
namespace autoapp {
|
|
||||||
namespace service {
|
|
||||||
namespace mediasource {
|
|
||||||
MicrophoneMediaSourceService::MicrophoneMediaSourceService(boost::asio::io_service &ioService,
|
MicrophoneMediaSourceService::MicrophoneMediaSourceService(boost::asio::io_service &ioService,
|
||||||
aasdk::messenger::IMessenger::Pointer messenger,
|
aasdk::messenger::IMessenger::Pointer messenger,
|
||||||
projection::IAudioInput::Pointer audioOutput)
|
projection::IAudioInput::Pointer audioOutput)
|
||||||
: MediaSourceService(ioService, std::make_shared<aasdk::channel::mediasource::audio::MicrophoneAudioChannel>(strand_,
|
: MediaSourceService(ioService,
|
||||||
|
std::make_shared<aasdk::channel::mediasource::audio::MicrophoneAudioChannel>(strand_,
|
||||||
std::move(
|
std::move(
|
||||||
messenger)),
|
messenger)),
|
||||||
std::move(audioOutput)) {
|
std::move(audioOutput)) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,17 +21,14 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
namespace f1x {
|
namespace f1x::openauto::autoapp::service::navigationstatus {
|
||||||
namespace openauto {
|
|
||||||
namespace autoapp {
|
|
||||||
namespace service {
|
|
||||||
namespace navigationstatus {
|
|
||||||
|
|
||||||
NavigationStatusService::NavigationStatusService(boost::asio::io_service &ioService,
|
NavigationStatusService::NavigationStatusService(boost::asio::io_service &ioService,
|
||||||
aasdk::messenger::IMessenger::Pointer messenger)
|
aasdk::messenger::IMessenger::Pointer messenger)
|
||||||
: strand_(ioService),
|
: strand_(ioService),
|
||||||
timer_(ioService),
|
timer_(ioService),
|
||||||
channel_(std::make_shared<aasdk::channel::navigationstatus::NavigationStatusService>(strand_, std::move(messenger))) {
|
channel_(std::make_shared<aasdk::channel::navigationstatus::NavigationStatusService>(strand_,
|
||||||
|
std::move(messenger))) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,9 +66,11 @@ namespace f1x {
|
|||||||
auto *navigationStatus = service->mutable_navigation_status_service();
|
auto *navigationStatus = service->mutable_navigation_status_service();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NavigationStatusService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) {
|
void NavigationStatusService::onChannelOpenRequest(
|
||||||
|
const aap_protobuf::service::control::message::ChannelOpenRequest &request) {
|
||||||
OPENAUTO_LOG(info) << "[NavigationStatusService] onChannelOpenRequest()";
|
OPENAUTO_LOG(info) << "[NavigationStatusService] onChannelOpenRequest()";
|
||||||
OPENAUTO_LOG(info) << "[NavigationStatusService] Channel Id: " << request.service_id() << ", Priority: " << request.priority();
|
OPENAUTO_LOG(info) << "[NavigationStatusService] Channel Id: " << request.service_id() << ", Priority: "
|
||||||
|
<< request.priority();
|
||||||
|
|
||||||
aap_protobuf::service::control::message::ChannelOpenResponse response;
|
aap_protobuf::service::control::message::ChannelOpenResponse response;
|
||||||
const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS;
|
const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS;
|
||||||
@ -85,16 +84,19 @@ namespace f1x {
|
|||||||
channel_->receive(this->shared_from_this());
|
channel_->receive(this->shared_from_this());
|
||||||
}
|
}
|
||||||
|
|
||||||
void NavigationStatusService::onStatusUpdate(const aap_protobuf::service::navigationstatus::message::NavigationStatus &navStatus) {
|
void NavigationStatusService::onStatusUpdate(
|
||||||
|
const aap_protobuf::service::navigationstatus::message::NavigationStatus &navStatus) {
|
||||||
channel_->receive(this->shared_from_this());
|
channel_->receive(this->shared_from_this());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void NavigationStatusService::onTurnEvent(const aap_protobuf::service::navigationstatus::message::NavigationNextTurnEvent &turnEvent) {
|
void NavigationStatusService::onTurnEvent(
|
||||||
|
const aap_protobuf::service::navigationstatus::message::NavigationNextTurnEvent &turnEvent) {
|
||||||
channel_->receive(this->shared_from_this());
|
channel_->receive(this->shared_from_this());
|
||||||
}
|
}
|
||||||
|
|
||||||
void NavigationStatusService::onDistanceEvent(const aap_protobuf::service::navigationstatus::message::NavigationNextTurnDistanceEvent &distanceEvent) {
|
void NavigationStatusService::onDistanceEvent(
|
||||||
|
const aap_protobuf::service::navigationstatus::message::NavigationNextTurnDistanceEvent &distanceEvent) {
|
||||||
channel_->receive(this->shared_from_this());
|
channel_->receive(this->shared_from_this());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,8 +104,7 @@ namespace f1x {
|
|||||||
void NavigationStatusService::onChannelError(const aasdk::error::Error &e) {
|
void NavigationStatusService::onChannelError(const aasdk::error::Error &e) {
|
||||||
OPENAUTO_LOG(error) << "[NavigationStatusService] onChannelError(): " << e.what();
|
OPENAUTO_LOG(error) << "[NavigationStatusService] onChannelError(): " << e.what();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,86 +19,60 @@
|
|||||||
#include <f1x/openauto/autoapp/Service/Pinger.hpp>
|
#include <f1x/openauto/autoapp/Service/Pinger.hpp>
|
||||||
#include <f1x/openauto/Common/Log.hpp>
|
#include <f1x/openauto/Common/Log.hpp>
|
||||||
|
|
||||||
namespace f1x
|
namespace f1x::openauto::autoapp::service {
|
||||||
{
|
|
||||||
namespace openauto
|
|
||||||
{
|
|
||||||
namespace autoapp
|
|
||||||
{
|
|
||||||
namespace service
|
|
||||||
{
|
|
||||||
|
|
||||||
Pinger::Pinger(boost::asio::io_service& ioService, time_t duration)
|
Pinger::Pinger(boost::asio::io_service &ioService, time_t duration)
|
||||||
: strand_(ioService)
|
: strand_(ioService), timer_(ioService), duration_(duration), cancelled_(false), pingsCount_(0), pongsCount_(0) {
|
||||||
, timer_(ioService)
|
|
||||||
, duration_(duration)
|
|
||||||
, cancelled_(false)
|
|
||||||
, pingsCount_(0)
|
|
||||||
, pongsCount_(0)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pinger::ping(Promise::Pointer promise)
|
void Pinger::ping(Promise::Pointer promise) {
|
||||||
{
|
|
||||||
strand_.dispatch([this, self = this->shared_from_this(), promise = std::move(promise)]() mutable {
|
strand_.dispatch([this, self = this->shared_from_this(), promise = std::move(promise)]() mutable {
|
||||||
cancelled_ = false;
|
cancelled_ = false;
|
||||||
|
|
||||||
if(promise_ != nullptr)
|
if (promise_ != nullptr) {
|
||||||
{
|
|
||||||
promise_->reject(aasdk::error::Error(aasdk::error::ErrorCode::OPERATION_IN_PROGRESS));
|
promise_->reject(aasdk::error::Error(aasdk::error::ErrorCode::OPERATION_IN_PROGRESS));
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
++pingsCount_;
|
++pingsCount_;
|
||||||
OPENAUTO_LOG(debug) << "[Pinger] Ping counter: " << pingsCount_;
|
OPENAUTO_LOG(debug) << "[Pinger] Ping counter: " << pingsCount_;
|
||||||
|
|
||||||
promise_ = std::move(promise);
|
promise_ = std::move(promise);
|
||||||
timer_.expires_from_now(boost::posix_time::milliseconds(duration_));
|
timer_.expires_from_now(boost::posix_time::milliseconds(duration_));
|
||||||
timer_.async_wait(strand_.wrap(std::bind(&Pinger::onTimerExceeded, this->shared_from_this(), std::placeholders::_1)));
|
timer_.async_wait(
|
||||||
|
strand_.wrap(std::bind(&Pinger::onTimerExceeded, this->shared_from_this(), std::placeholders::_1)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pinger::pong()
|
void Pinger::pong() {
|
||||||
{
|
|
||||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||||
++pongsCount_;
|
++pongsCount_;
|
||||||
OPENAUTO_LOG(debug) << "[Pinger] Pong counter: " << pongsCount_;
|
OPENAUTO_LOG(debug) << "[Pinger] Pong counter: " << pongsCount_;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pinger::onTimerExceeded(const boost::system::error_code& error)
|
void Pinger::onTimerExceeded(const boost::system::error_code &error) {
|
||||||
{
|
if (promise_ == nullptr) {
|
||||||
if(promise_ == nullptr)
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
} else if (error == boost::asio::error::operation_aborted || cancelled_) {
|
||||||
else if(error == boost::asio::error::operation_aborted || cancelled_)
|
|
||||||
{
|
|
||||||
promise_->reject(aasdk::error::Error(aasdk::error::ErrorCode::OPERATION_ABORTED));
|
promise_->reject(aasdk::error::Error(aasdk::error::ErrorCode::OPERATION_ABORTED));
|
||||||
}
|
} else if (pingsCount_ - pongsCount_ > 4) {
|
||||||
else if(pingsCount_ - pongsCount_ > 4)
|
|
||||||
{
|
|
||||||
promise_->reject(aasdk::error::Error());
|
promise_->reject(aasdk::error::Error());
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
promise_->resolve();
|
promise_->resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
promise_.reset();
|
promise_.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pinger::cancel()
|
void Pinger::cancel() {
|
||||||
{
|
|
||||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||||
cancelled_ = true;
|
cancelled_ = true;
|
||||||
timer_.cancel();
|
timer_.cancel();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -21,11 +21,7 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
namespace f1x {
|
namespace f1x::openauto::autoapp::service::radio {
|
||||||
namespace openauto {
|
|
||||||
namespace autoapp {
|
|
||||||
namespace service {
|
|
||||||
namespace radio {
|
|
||||||
|
|
||||||
RadioService::RadioService(boost::asio::io_service &ioService,
|
RadioService::RadioService(boost::asio::io_service &ioService,
|
||||||
aasdk::messenger::IMessenger::Pointer messenger)
|
aasdk::messenger::IMessenger::Pointer messenger)
|
||||||
@ -71,7 +67,8 @@ namespace f1x {
|
|||||||
|
|
||||||
void RadioService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) {
|
void RadioService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) {
|
||||||
OPENAUTO_LOG(info) << "[RadioService] onChannelOpenRequest()";
|
OPENAUTO_LOG(info) << "[RadioService] onChannelOpenRequest()";
|
||||||
OPENAUTO_LOG(debug) << "[RadioService] Channel Id: " << request.service_id() << ", Priority: " << request.priority();
|
OPENAUTO_LOG(debug) << "[RadioService] Channel Id: " << request.service_id() << ", Priority: "
|
||||||
|
<< request.priority();
|
||||||
|
|
||||||
|
|
||||||
aap_protobuf::service::control::message::ChannelOpenResponse response;
|
aap_protobuf::service::control::message::ChannelOpenResponse response;
|
||||||
@ -91,8 +88,7 @@ namespace f1x {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,11 +23,7 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <gps.h>
|
#include <gps.h>
|
||||||
|
|
||||||
namespace f1x {
|
namespace f1x::openauto::autoapp::service::sensor {
|
||||||
namespace openauto {
|
|
||||||
namespace autoapp {
|
|
||||||
namespace service {
|
|
||||||
namespace sensor {
|
|
||||||
SensorService::SensorService(boost::asio::io_service &ioService,
|
SensorService::SensorService(boost::asio::io_service &ioService,
|
||||||
aasdk::messenger::IMessenger::Pointer messenger)
|
aasdk::messenger::IMessenger::Pointer messenger)
|
||||||
: strand_(ioService),
|
: strand_(ioService),
|
||||||
@ -91,14 +87,18 @@ namespace f1x {
|
|||||||
service->set_id(static_cast<uint32_t>(channel_->getId()));
|
service->set_id(static_cast<uint32_t>(channel_->getId()));
|
||||||
|
|
||||||
auto *sensorChannel = service->mutable_sensor_source_service();
|
auto *sensorChannel = service->mutable_sensor_source_service();
|
||||||
sensorChannel->add_sensors()->set_sensor_type(aap_protobuf::service::sensorsource::message::SensorType::SENSOR_DRIVING_STATUS_DATA);
|
sensorChannel->add_sensors()->set_sensor_type(
|
||||||
sensorChannel->add_sensors()->set_sensor_type(aap_protobuf::service::sensorsource::message::SensorType::SENSOR_LOCATION);
|
aap_protobuf::service::sensorsource::message::SensorType::SENSOR_DRIVING_STATUS_DATA);
|
||||||
sensorChannel->add_sensors()->set_sensor_type(aap_protobuf::service::sensorsource::message::SensorType::SENSOR_NIGHT_MODE);
|
sensorChannel->add_sensors()->set_sensor_type(
|
||||||
|
aap_protobuf::service::sensorsource::message::SensorType::SENSOR_LOCATION);
|
||||||
|
sensorChannel->add_sensors()->set_sensor_type(
|
||||||
|
aap_protobuf::service::sensorsource::message::SensorType::SENSOR_NIGHT_MODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SensorService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) {
|
void SensorService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) {
|
||||||
OPENAUTO_LOG(info) << "[SensorService] onChannelOpenRequest()";
|
OPENAUTO_LOG(info) << "[SensorService] onChannelOpenRequest()";
|
||||||
OPENAUTO_LOG(debug) << "[SensorService] Channel Id: " << request.service_id() << ", Priority: " << request.priority();
|
OPENAUTO_LOG(debug) << "[SensorService] Channel Id: " << request.service_id() << ", Priority: "
|
||||||
|
<< request.priority();
|
||||||
|
|
||||||
aap_protobuf::service::control::message::ChannelOpenResponse response;
|
aap_protobuf::service::control::message::ChannelOpenResponse response;
|
||||||
const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS;
|
const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS;
|
||||||
@ -115,25 +115,20 @@ namespace f1x {
|
|||||||
void SensorService::onSensorStartRequest(
|
void SensorService::onSensorStartRequest(
|
||||||
const aap_protobuf::service::sensorsource::message::SensorRequest &request) {
|
const aap_protobuf::service::sensorsource::message::SensorRequest &request) {
|
||||||
OPENAUTO_LOG(info) << "[SensorService] onSensorStartRequest()";
|
OPENAUTO_LOG(info) << "[SensorService] onSensorStartRequest()";
|
||||||
OPENAUTO_LOG(debug) << "[SensorService] Request Type: "<< request.type();
|
OPENAUTO_LOG(debug) << "[SensorService] Request Type: " << request.type();
|
||||||
|
|
||||||
aap_protobuf::service::sensorsource::message::SensorStartResponseMessage response;
|
aap_protobuf::service::sensorsource::message::SensorStartResponseMessage response;
|
||||||
response.set_status(aap_protobuf::shared::MessageStatus::STATUS_SUCCESS);
|
response.set_status(aap_protobuf::shared::MessageStatus::STATUS_SUCCESS);
|
||||||
|
|
||||||
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
||||||
|
|
||||||
if (request.type() == aap_protobuf::service::sensorsource::message::SENSOR_DRIVING_STATUS_DATA)
|
if (request.type() == aap_protobuf::service::sensorsource::message::SENSOR_DRIVING_STATUS_DATA) {
|
||||||
{
|
|
||||||
promise->then(std::bind(&SensorService::sendDrivingStatusUnrestricted, this->shared_from_this()),
|
promise->then(std::bind(&SensorService::sendDrivingStatusUnrestricted, this->shared_from_this()),
|
||||||
std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1));
|
std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1));
|
||||||
}
|
} else if (request.type() == aap_protobuf::service::sensorsource::message::SensorType::SENSOR_NIGHT_MODE) {
|
||||||
else if (request.type() == aap_protobuf::service::sensorsource::message::SensorType::SENSOR_NIGHT_MODE)
|
|
||||||
{
|
|
||||||
promise->then(std::bind(&SensorService::sendNightData, this->shared_from_this()),
|
promise->then(std::bind(&SensorService::sendNightData, this->shared_from_this()),
|
||||||
std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1));
|
std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1));
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
promise->then([]() {},
|
promise->then([]() {},
|
||||||
std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1));
|
std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1));
|
||||||
}
|
}
|
||||||
@ -145,10 +140,11 @@ namespace f1x {
|
|||||||
void SensorService::sendDrivingStatusUnrestricted() {
|
void SensorService::sendDrivingStatusUnrestricted() {
|
||||||
OPENAUTO_LOG(info) << "[SensorService] sendDrivingStatusUnrestricted()";
|
OPENAUTO_LOG(info) << "[SensorService] sendDrivingStatusUnrestricted()";
|
||||||
aap_protobuf::service::sensorsource::message::SensorBatch indication;
|
aap_protobuf::service::sensorsource::message::SensorBatch indication;
|
||||||
indication.add_driving_status_data()->set_status(aap_protobuf::service::sensorsource::message::DrivingStatus::DRIVE_STATUS_UNRESTRICTED);
|
indication.add_driving_status_data()->set_status(
|
||||||
|
aap_protobuf::service::sensorsource::message::DrivingStatus::DRIVE_STATUS_UNRESTRICTED);
|
||||||
|
|
||||||
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
||||||
promise->then([]() { },
|
promise->then([]() {},
|
||||||
std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1));
|
std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1));
|
||||||
channel_->sendSensorEventIndication(indication, std::move(promise));
|
channel_->sendSensorEventIndication(indication, std::move(promise));
|
||||||
}
|
}
|
||||||
@ -225,8 +221,7 @@ namespace f1x {
|
|||||||
(this->gpsData_.status != STATUS_NO_FIX) &&
|
(this->gpsData_.status != STATUS_NO_FIX) &&
|
||||||
(this->gpsData_.fix.mode == MODE_2D || this->gpsData_.fix.mode == MODE_3D) &&
|
(this->gpsData_.fix.mode == MODE_2D || this->gpsData_.fix.mode == MODE_3D) &&
|
||||||
(this->gpsData_.set & TIME_SET) &&
|
(this->gpsData_.set & TIME_SET) &&
|
||||||
(this->gpsData_.set & LATLON_SET))
|
(this->gpsData_.set & LATLON_SET)) {
|
||||||
{
|
|
||||||
this->sendGPSLocationData();
|
this->sendGPSLocationData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,8 +240,7 @@ namespace f1x {
|
|||||||
void SensorService::onChannelError(const aasdk::error::Error &e) {
|
void SensorService::onChannelError(const aasdk::error::Error &e) {
|
||||||
OPENAUTO_LOG(error) << "[SensorService] onChannelError(): " << e.what();
|
OPENAUTO_LOG(error) << "[SensorService] onChannelError(): " << e.what();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,10 +49,7 @@
|
|||||||
#include <f1x/openauto/autoapp/Projection/RemoteBluetoothDevice.hpp>
|
#include <f1x/openauto/autoapp/Projection/RemoteBluetoothDevice.hpp>
|
||||||
#include <f1x/openauto/autoapp/Projection/DummyBluetoothDevice.hpp>
|
#include <f1x/openauto/autoapp/Projection/DummyBluetoothDevice.hpp>
|
||||||
|
|
||||||
namespace f1x {
|
namespace f1x::openauto::autoapp::service {
|
||||||
namespace openauto {
|
|
||||||
namespace autoapp {
|
|
||||||
namespace service {
|
|
||||||
|
|
||||||
ServiceFactory::ServiceFactory(boost::asio::io_service &ioService,
|
ServiceFactory::ServiceFactory(boost::asio::io_service &ioService,
|
||||||
configuration::IConfiguration::Pointer configuration)
|
configuration::IConfiguration::Pointer configuration)
|
||||||
@ -69,6 +66,7 @@ namespace f1x {
|
|||||||
serviceList.emplace_back(this->createSensorService(messenger));
|
serviceList.emplace_back(this->createSensorService(messenger));
|
||||||
serviceList.emplace_back(this->createBluetoothService(messenger));
|
serviceList.emplace_back(this->createBluetoothService(messenger));
|
||||||
serviceList.emplace_back(this->createInputService(messenger));
|
serviceList.emplace_back(this->createInputService(messenger));
|
||||||
|
// TODO: What is WiFi Projection Service?
|
||||||
//serviceList.emplace_back(this->createWifiProjectionService(messenger));
|
//serviceList.emplace_back(this->createWifiProjectionService(messenger));
|
||||||
|
|
||||||
return serviceList;
|
return serviceList;
|
||||||
@ -213,7 +211,7 @@ namespace f1x {
|
|||||||
return std::make_shared<wifiprojection::WifiProjectionService>(ioService_, messenger);
|
return std::make_shared<wifiprojection::WifiProjectionService>(ioService_, messenger);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,17 +21,14 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
namespace f1x {
|
namespace f1x::openauto::autoapp::service::vendorextension {
|
||||||
namespace openauto {
|
|
||||||
namespace autoapp {
|
|
||||||
namespace service {
|
|
||||||
namespace vendorextension {
|
|
||||||
|
|
||||||
VendorExtensionService::VendorExtensionService(boost::asio::io_service &ioService,
|
VendorExtensionService::VendorExtensionService(boost::asio::io_service &ioService,
|
||||||
aasdk::messenger::IMessenger::Pointer messenger)
|
aasdk::messenger::IMessenger::Pointer messenger)
|
||||||
: strand_(ioService),
|
: strand_(ioService),
|
||||||
timer_(ioService),
|
timer_(ioService),
|
||||||
channel_(std::make_shared<aasdk::channel::vendorextension::VendorExtensionService>(strand_, std::move(messenger))) {
|
channel_(
|
||||||
|
std::make_shared<aasdk::channel::vendorextension::VendorExtensionService>(strand_, std::move(messenger))) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,9 +70,11 @@ namespace f1x {
|
|||||||
OPENAUTO_LOG(error) << "[VendorExtensionService] onChannelError(): " << e.what();
|
OPENAUTO_LOG(error) << "[VendorExtensionService] onChannelError(): " << e.what();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VendorExtensionService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) {
|
void VendorExtensionService::onChannelOpenRequest(
|
||||||
|
const aap_protobuf::service::control::message::ChannelOpenRequest &request) {
|
||||||
OPENAUTO_LOG(info) << "[VendorExtensionService] onChannelOpenRequest()";
|
OPENAUTO_LOG(info) << "[VendorExtensionService] onChannelOpenRequest()";
|
||||||
OPENAUTO_LOG(info) << "[VendorExtensionService] Channel Id: " << request.service_id() << ", Priority: " << request.priority();
|
OPENAUTO_LOG(info) << "[VendorExtensionService] Channel Id: " << request.service_id() << ", Priority: "
|
||||||
|
<< request.priority();
|
||||||
|
|
||||||
aap_protobuf::service::control::message::ChannelOpenResponse response;
|
aap_protobuf::service::control::message::ChannelOpenResponse response;
|
||||||
const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS;
|
const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS;
|
||||||
@ -87,8 +86,7 @@ namespace f1x {
|
|||||||
channel_->sendChannelOpenResponse(response, std::move(promise));
|
channel_->sendChannelOpenResponse(response, std::move(promise));
|
||||||
channel_->receive(this->shared_from_this());
|
channel_->receive(this->shared_from_this());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,16 +22,14 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QNetworkInterface>
|
#include <QNetworkInterface>
|
||||||
|
|
||||||
namespace f1x {
|
|
||||||
namespace openauto {
|
namespace f1x::openauto::autoapp::service::wifiprojection {
|
||||||
namespace autoapp {
|
|
||||||
namespace service {
|
|
||||||
namespace wifiprojection {
|
|
||||||
WifiProjectionService::WifiProjectionService(boost::asio::io_service &ioService,
|
WifiProjectionService::WifiProjectionService(boost::asio::io_service &ioService,
|
||||||
aasdk::messenger::IMessenger::Pointer messenger)
|
aasdk::messenger::IMessenger::Pointer messenger)
|
||||||
: strand_(ioService),
|
: strand_(ioService),
|
||||||
timer_(ioService),
|
timer_(ioService),
|
||||||
channel_(std::make_shared<aasdk::channel::wifiprojection::WifiProjectionService>(strand_, std::move(messenger))) {
|
channel_(
|
||||||
|
std::make_shared<aasdk::channel::wifiprojection::WifiProjectionService>(strand_, std::move(messenger))) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +78,8 @@ namespace f1x {
|
|||||||
response.set_access_point_type(aap_protobuf::service::wifiprojection::message::AccessPointType::STATIC);
|
response.set_access_point_type(aap_protobuf::service::wifiprojection::message::AccessPointType::STATIC);
|
||||||
response.set_car_wifi_ssid("CRANKSHAFT-NG");
|
response.set_car_wifi_ssid("CRANKSHAFT-NG");
|
||||||
response.set_car_wifi_password("1234567890");
|
response.set_car_wifi_password("1234567890");
|
||||||
response.set_car_wifi_security_mode(aap_protobuf::service::wifiprojection::message::WifiSecurityMode::WPA2_PERSONAL);
|
response.set_car_wifi_security_mode(
|
||||||
|
aap_protobuf::service::wifiprojection::message::WifiSecurityMode::WPA2_PERSONAL);
|
||||||
|
|
||||||
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
||||||
promise->then([]() {}, std::bind(&WifiProjectionService::onChannelError, this->shared_from_this(),
|
promise->then([]() {}, std::bind(&WifiProjectionService::onChannelError, this->shared_from_this(),
|
||||||
@ -90,9 +89,11 @@ namespace f1x {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WifiProjectionService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) {
|
void WifiProjectionService::onChannelOpenRequest(
|
||||||
|
const aap_protobuf::service::control::message::ChannelOpenRequest &request) {
|
||||||
OPENAUTO_LOG(info) << "[WifiProjectionService] onChannelOpenRequest()";
|
OPENAUTO_LOG(info) << "[WifiProjectionService] onChannelOpenRequest()";
|
||||||
OPENAUTO_LOG(debug) << "[WifiProjectionService] Channel Id: " << request.service_id() << ", Priority: " << request.priority();
|
OPENAUTO_LOG(debug) << "[WifiProjectionService] Channel Id: " << request.service_id() << ", Priority: "
|
||||||
|
<< request.priority();
|
||||||
|
|
||||||
aap_protobuf::service::control::message::ChannelOpenResponse response;
|
aap_protobuf::service::control::message::ChannelOpenResponse response;
|
||||||
const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS;
|
const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS;
|
||||||
@ -111,8 +112,7 @@ namespace f1x {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,34 +15,39 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with openauto. If not, see <http://www.gnu.org/licenses/>.
|
* along with openauto. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
#include <fstream>
|
||||||
#include <QMessageBox>
|
#include <string>
|
||||||
#include <f1x/openauto/autoapp/UI/SettingsWindow.hpp>
|
#include <f1x/openauto/autoapp/UI/SettingsWindow.hpp>
|
||||||
#include "ui_settingswindow.h" // AutoGenerated at Compile Time
|
#include <QBluetoothLocalDevice>
|
||||||
|
#include <QBluetoothHostInfo>
|
||||||
|
#include <QComboBox>
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QDateTime>
|
||||||
|
#include <QDBusInterface>
|
||||||
|
#include <QDBusReply>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QTextStream>
|
#include <QMessageBox>
|
||||||
#include <string>
|
|
||||||
#include <QTimer>
|
|
||||||
#include <QDateTime>
|
|
||||||
#include <QNetworkInterface>
|
#include <QNetworkInterface>
|
||||||
#include <fstream>
|
|
||||||
#include <QStorageInfo>
|
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
|
#include <QStorageInfo>
|
||||||
|
#include <QTextStream>
|
||||||
|
#include <QTimer>
|
||||||
|
#include "ui_settingswindow.h" // AutoGenerated at Compile Time
|
||||||
|
|
||||||
#ifdef MAC_OS
|
#ifdef MAC_OS
|
||||||
|
|
||||||
#include <mach/mach_host.h>
|
#include <mach/mach_host.h>
|
||||||
#include <mach/mach_init.h>
|
#include <mach/mach_init.h>
|
||||||
#include <mach/mach_port.h>
|
#include <mach/mach_port.h>
|
||||||
#include <mach/vm_map.h>
|
#include <mach/vm_map.h>
|
||||||
#include <mach/vm_statistics.h>
|
#include <mach/vm_statistics.h>
|
||||||
#include <mach/mach_types.h>
|
#include <mach/mach_types.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace f1x {
|
|
||||||
namespace openauto {
|
namespace f1x::openauto::autoapp::ui {
|
||||||
namespace autoapp {
|
|
||||||
namespace ui {
|
|
||||||
|
|
||||||
SettingsWindow::SettingsWindow(configuration::IConfiguration::Pointer configuration, QWidget *parent)
|
SettingsWindow::SettingsWindow(configuration::IConfiguration::Pointer configuration, QWidget *parent)
|
||||||
: QWidget(parent), ui_(new Ui::SettingsWindow), configuration_(std::move(configuration)) {
|
: QWidget(parent), ui_(new Ui::SettingsWindow), configuration_(std::move(configuration)) {
|
||||||
@ -250,23 +255,24 @@ namespace f1x {
|
|||||||
|
|
||||||
configuration_->playerButtonControl(ui_->checkBoxPlayerControl->isChecked());
|
configuration_->playerButtonControl(ui_->checkBoxPlayerControl->isChecked());
|
||||||
|
|
||||||
if (ui_->radioButtonDisableBluetooth->isChecked()) {
|
if (ui_->comboBoxBluetooth->currentText() == "none") {
|
||||||
configuration_->setBluetoothAdapterType(configuration::BluetoothAdapterType::NONE);
|
configuration_->setBluetoothAdapterAddress(""); // or any string that indicates no adapter
|
||||||
} else if (ui_->radioButtonUseLocalBluetoothAdapter->isChecked()) {
|
} else {
|
||||||
configuration_->setBluetoothAdapterType(configuration::BluetoothAdapterType::LOCAL);
|
configuration_->setBluetoothAdapterAddress(
|
||||||
} else if (ui_->radioButtonUseExternalBluetoothAdapter->isChecked()) {
|
ui_->comboBoxBluetooth->currentData().toString().toStdString());
|
||||||
configuration_->setBluetoothAdapterType(configuration::BluetoothAdapterType::REMOTE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
configuration_->setBluetoothRemoteAdapterAddress(
|
|
||||||
ui_->lineEditExternalBluetoothAdapterAddress->text().toStdString());
|
|
||||||
|
|
||||||
configuration_->setMusicAudioChannelEnabled(ui_->checkBoxMusicAudioChannel->isChecked());
|
configuration_->setMusicAudioChannelEnabled(ui_->checkBoxMusicAudioChannel->isChecked());
|
||||||
configuration_->setGuidanceAudioChannelEnabled(ui_->checkBoxSpeechAudioChannel->isChecked());
|
configuration_->setGuidanceAudioChannelEnabled(ui_->checkBoxSpeechAudioChannel->isChecked());
|
||||||
configuration_->setTelephonyAudioChannelEnabled(ui_->checkBoxVoiceAudioChannel->isChecked());
|
configuration_->setTelephonyAudioChannelEnabled(ui_->checkBoxVoiceAudioChannel->isChecked());
|
||||||
configuration_->setAudioOutputBackendType(
|
configuration_->setAudioOutputBackendType(
|
||||||
ui_->radioButtonRtAudio->isChecked() ? configuration::AudioOutputBackendType::RTAUDIO
|
ui_->radioButtonRtAudio->isChecked() ? configuration::AudioOutputBackendType::RTAUDIO
|
||||||
: configuration::AudioOutputBackendType::QT);
|
: configuration::AudioOutputBackendType::QT);
|
||||||
|
configuration_->setMusicAudioChannelEnabled(ui_->checkBoxMusicAudioChannel->isChecked());
|
||||||
|
configuration_->setGuidanceAudioChannelEnabled(ui_->checkBoxSpeechAudioChannel->isChecked());
|
||||||
|
configuration_->setAudioOutputBackendType(
|
||||||
|
ui_->radioButtonRtAudio->isChecked() ? configuration::AudioOutputBackendType::RTAUDIO
|
||||||
|
: configuration::AudioOutputBackendType::QT);
|
||||||
|
|
||||||
configuration_->save();
|
configuration_->save();
|
||||||
|
|
||||||
@ -880,6 +886,8 @@ namespace f1x {
|
|||||||
ui_->radioButtonScreenRotated->setChecked(true);
|
ui_->radioButtonScreenRotated->setChecked(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
populateBluetoothComboBox(ui_->comboBoxBluetooth);
|
||||||
|
|
||||||
if (std::ifstream("/tmp/get_inputs")) {
|
if (std::ifstream("/tmp/get_inputs")) {
|
||||||
QFile inputsFile(QString("/tmp/get_inputs"));
|
QFile inputsFile(QString("/tmp/get_inputs"));
|
||||||
inputsFile.open(QIODevice::ReadOnly);
|
inputsFile.open(QIODevice::ReadOnly);
|
||||||
@ -1117,6 +1125,8 @@ namespace f1x {
|
|||||||
ui_->comboBoxBluetooth->setCurrentText("none");
|
ui_->comboBoxBluetooth->setCurrentText("none");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// set lightsensor
|
// set lightsensor
|
||||||
if (std::ifstream("/etc/cs_lightsensor")) {
|
if (std::ifstream("/etc/cs_lightsensor")) {
|
||||||
ui_->comboBoxLS->setCurrentIndex(1);
|
ui_->comboBoxLS->setCurrentIndex(1);
|
||||||
@ -1187,7 +1197,8 @@ namespace f1x {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MAC_OS
|
#ifdef MAC_OS
|
||||||
void SettingsWindow::getMacMemoryInfo(QString& freeMemory) {
|
|
||||||
|
void SettingsWindow::getMacMemoryInfo(QString &freeMemory) {
|
||||||
mach_port_t host_port;
|
mach_port_t host_port;
|
||||||
vm_size_t page_size;
|
vm_size_t page_size;
|
||||||
vm_statistics64_data_t vm_stats;
|
vm_statistics64_data_t vm_stats;
|
||||||
@ -1195,15 +1206,16 @@ namespace f1x {
|
|||||||
host_port = mach_host_self();
|
host_port = mach_host_self();
|
||||||
mach_msg_type_number_t count = HOST_VM_INFO64_COUNT;
|
mach_msg_type_number_t count = HOST_VM_INFO64_COUNT;
|
||||||
host_page_size(host_port, &page_size);
|
host_page_size(host_port, &page_size);
|
||||||
if (host_statistics64(host_port, HOST_VM_INFO64, (host_info64_t)&vm_stats, &count) != KERN_SUCCESS) {
|
if (host_statistics64(host_port, HOST_VM_INFO64, (host_info64_t) &vm_stats, &count) != KERN_SUCCESS) {
|
||||||
freeMemory = "Error in getting memory info";
|
freeMemory = "Error in getting memory info";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
natural_t free_count = vm_stats.free_count;
|
natural_t free_count = vm_stats.free_count;
|
||||||
uint64_t free_memory = (uint64_t)free_count * (uint64_t)page_size;
|
uint64_t free_memory = (uint64_t) free_count * (uint64_t) page_size;
|
||||||
freeMemory = QString::number(free_memory / (1024 * 1024)) + " MB";
|
freeMemory = QString::number(free_memory / (1024 * 1024)) + " MB";
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void SettingsWindow::updateSystemInfo() {
|
void SettingsWindow::updateSystemInfo() {
|
||||||
@ -1371,11 +1383,9 @@ namespace f1x {
|
|||||||
ui_->tab9->show();
|
ui_->tab9->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void f1x::openauto::autoapp::ui::SettingsWindow::on_pushButtonAudioTest_clicked() {
|
void f1x::openauto::autoapp::ui::SettingsWindow::on_pushButtonAudioTest_clicked() {
|
||||||
ui_->labelTestInProgress->show();
|
ui_->labelTestInProgress->show();
|
||||||
ui_->pushButtonAudioTest->hide();
|
ui_->pushButtonAudioTest->hide();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user