Add extensive logging
This commit is contained in:
parent
5a2a305c04
commit
68759ee2fa
@ -16,6 +16,7 @@ SET(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_INIT} -Wall -pedantic -fPIC")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-g -O3")
|
||||
set(CMAKE_BUILD_TYPE Debug)
|
||||
|
||||
# Paths
|
||||
set(resources_directory ${CMAKE_CURRENT_SOURCE_DIR}/assets)
|
||||
@ -50,10 +51,12 @@ endif (RPI3_BUILD)
|
||||
|
||||
# Building on a Mac requires Abseil
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") # macOS
|
||||
add_definitions(-DMAC_OS)
|
||||
find_package(protobuf REQUIRED CONFIG)
|
||||
find_package(absl REQUIRED)
|
||||
set(CMAKE_PREFIX_PATH "/usr/local/opt/qt@5" ${CMAKE_PREFIX_PATH})
|
||||
list(APPEND CMAKE_PREFIX_PATH /usr/local/opt/util-linux)
|
||||
list(APPEND CMAKE_PREFIX_PATH /usr/local/opt/taglib)
|
||||
include(FindProtobuf)
|
||||
else ()
|
||||
find_package(Protobuf REQUIRED)
|
||||
@ -77,15 +80,16 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}
|
||||
${Qt5Bluetooth_INCLUDE_DIRS}
|
||||
${Qt5Network_INCLUDE_DIRS}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${PROTOBUF_INCLUDE_DIR}
|
||||
${AAP_PROTOBUF_INCLUDE_DIR}
|
||||
${OPENSSL_INCLUDE_DIR}
|
||||
${RTAUDIO_INCLUDE_DIRS}
|
||||
${TAGLIB_INCLUDE_DIRS}
|
||||
${BLKID_INCLUDE_DIRS}
|
||||
${BCM_HOST_INCLUDE_DIRS}
|
||||
${ILCLIENT_INCLUDE_DIRS}
|
||||
${include_directory})
|
||||
${include_directory}
|
||||
${PROTOBUF_INCLUDE_DIR}
|
||||
${AAP_PROTOBUF_INCLUDE_DIR}
|
||||
${AASDK_INCLUDE_DIR})
|
||||
|
||||
link_directories(${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
|
||||
|
||||
@ -98,22 +102,25 @@ file(GLOB_RECURSE autoapp_source_files ${autoapp_sources_directory}/*.ui ${autoa
|
||||
|
||||
add_executable(autoapp ${autoapp_source_files})
|
||||
|
||||
target_link_libraries(autoapp libusb
|
||||
aap_protobuf
|
||||
aasdk
|
||||
target_include_directories(autoapp PUBLIC ${AAP_PROTOBUF_INCLUDE_DIR} ${AASDK_INCLUDE_DIR})
|
||||
|
||||
target_link_libraries(autoapp PUBLIC
|
||||
libusb
|
||||
${Boost_LIBRARIES}
|
||||
${Qt5Multimedia_LIBRARIES}
|
||||
${Qt5MultimediaWidgets_LIBRARIES}
|
||||
${Qt5Bluetooth_LIBRARIES}
|
||||
${Qt5Network_LIBRARIES}
|
||||
${PROTOBUF_LIBRARIES}
|
||||
${BCM_HOST_LIBRARIES}
|
||||
${ILCLIENT_LIBRARIES}
|
||||
${WINSOCK2_LIBRARIES}
|
||||
${RTAUDIO_LIBRARIES}
|
||||
${TAGLIB_LIBRARIES}
|
||||
${BLKID_LIBRARIES}
|
||||
${GPS_LIBRARIES})
|
||||
${GPS_LIBRARIES}
|
||||
${PROTOBUF_LIBRARIES}
|
||||
${AAP_PROTOBUF_LIB_DIR}
|
||||
${AASDK_LIB_DIR})
|
||||
|
||||
set(btservice_sources_directory ${sources_directory}/btservice)
|
||||
set(btservice_include_directory ${include_directory}/f1x/openauto/btservice)
|
||||
@ -121,11 +128,10 @@ file(GLOB_RECURSE btservice_source_files ${btservice_sources_directory}/*.cpp ${
|
||||
|
||||
add_executable(btservice ${btservice_source_files})
|
||||
|
||||
target_link_libraries(
|
||||
btservice
|
||||
aap_protobuf
|
||||
target_link_libraries(btservice PUBLIC
|
||||
${Boost_LIBRARIES}
|
||||
${Qt5Bluetooth_LIBRARIES}
|
||||
${Qt5Network_LIBRARIES}
|
||||
${Qt5MultimediaWidgets_LIBRARIES}
|
||||
${PROTOBUF_LIBRARIES})
|
||||
${PROTOBUF_LIBRARIES}
|
||||
${AAP_PROTOBUF_LIB_DIR})
|
||||
|
55
cmake_modules/Findaap_protobuf.cmake
Normal file
55
cmake_modules/Findaap_protobuf.cmake
Normal file
@ -0,0 +1,55 @@
|
||||
if (AAP_PROTOBUF_LIB_DIRS AND AAP_PROTOBUF_INCLUDE_DIRS)
|
||||
# in cache already
|
||||
message(STATUS "aap_protobuf cached")
|
||||
set(AAP_PROTOBUF_FOUND TRUE)
|
||||
else (AAP_PROTOBUF_LIB_DIRS AND AAP_PROTOBUF_INCLUDE_DIRS)
|
||||
find_path(AAP_PROTOBUF_INCLUDE_DIR
|
||||
NAMES
|
||||
channel/ChannelCloseNotification.pb.h
|
||||
PATHS
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
/opt/local/include
|
||||
/sw/include
|
||||
PATH_SUFFIXES
|
||||
aap_protobuf
|
||||
)
|
||||
|
||||
find_library(AAP_PROTOBUF_LIB_DIR
|
||||
NAMES
|
||||
aap_protobuf libaap_protobuf
|
||||
PATHS
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/opt/local/lib
|
||||
/sw/lib
|
||||
)
|
||||
|
||||
set(AAP_PROTOBUF_INCLUDE_DIRS
|
||||
${AAP_PROTOBUF_INCLUDE_DIR}
|
||||
)
|
||||
set(AAP_PROTOBUF_LIB_DIRS
|
||||
${AAP_PROTOBUF_LIB_DIR}
|
||||
)
|
||||
|
||||
if (AAP_PROTOBUF_INCLUDE_DIRS AND AAP_PROTOBUF_LIB_DIRS)
|
||||
set(AAP_PROTOBUF_FOUND TRUE)
|
||||
endif (AAP_PROTOBUF_INCLUDE_DIRS AND AAP_PROTOBUF_LIB_DIRS)
|
||||
|
||||
if (AAP_PROTOBUF_FOUND)
|
||||
message(STATUS "Found aap_protobuf:")
|
||||
message(STATUS " - Includes: ${AAP_PROTOBUF_INCLUDE_DIRS}")
|
||||
message(STATUS " - Libraries: ${AAP_PROTOBUF_LIB_DIRS}")
|
||||
add_library(aap_protobuf INTERFACE)
|
||||
target_include_directories(aap_protobuf SYSTEM INTERFACE ${AAP_PROTOBUF_INCLUDE_DIR})
|
||||
target_link_libraries(aap_protobuf INTERFACE ${AAP_PROTOBUF_LIB_DIR})
|
||||
else (AAP_PROTOBUF_FOUND)
|
||||
message(STATUS " - Includes: ${AAP_PROTOBUF_INCLUDE_DIRS}")
|
||||
message(STATUS " - Libraries: ${AAP_PROTOBUF_LIB_DIRS}")
|
||||
message(FATAL_ERROR "Could not find aap_protobuf")
|
||||
endif (AAP_PROTOBUF_FOUND)
|
||||
|
||||
# show the AAP_PROTOBUF_INCLUDE_DIRS and AAP_PROTOBUF_LIB_DIRS variables only in the advanced view
|
||||
mark_as_advanced(AAP_PROTOBUF_INCLUDE_DIRS AAP_PROTOBUF_LIB_DIRS)
|
||||
|
||||
endif (AAP_PROTOBUF_LIB_DIRS AND AAP_PROTOBUF_INCLUDE_DIRS)
|
55
cmake_modules/Findaasdk.cmake
Normal file
55
cmake_modules/Findaasdk.cmake
Normal file
@ -0,0 +1,55 @@
|
||||
if (AASDK_LIB_DIRS AND AASDK_INCLUDE_DIRS)
|
||||
# in cache already
|
||||
message(STATUS "aasdk cached")
|
||||
set(AASDK_FOUND TRUE)
|
||||
else (AASDK_LIB_DIRS AND AASDK_INCLUDE_DIRS)
|
||||
find_path(AASDK_INCLUDE_DIR
|
||||
NAMES
|
||||
Version.hpp
|
||||
PATHS
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
/opt/local/include
|
||||
/sw/include
|
||||
PATH_SUFFIXES
|
||||
aasdk
|
||||
)
|
||||
|
||||
find_library(AASDK_LIB_DIR
|
||||
NAMES
|
||||
aasdk libaasdk
|
||||
PATHS
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/opt/local/lib
|
||||
/sw/lib
|
||||
)
|
||||
|
||||
set(AASDK_INCLUDE_DIRS
|
||||
${AASDK_INCLUDE_DIR}
|
||||
)
|
||||
set(AASDK_LIB_DIRS
|
||||
${AASDK_LIB_DIR}
|
||||
)
|
||||
|
||||
if (AASDK_INCLUDE_DIRS AND AASDK_LIB_DIRS)
|
||||
set(AASDK_FOUND TRUE)
|
||||
endif (AASDK_INCLUDE_DIRS AND AASDK_LIB_DIRS)
|
||||
|
||||
if (AASDK_FOUND)
|
||||
message(STATUS "Found aasdk:")
|
||||
message(STATUS " - Includes: ${AASDK_INCLUDE_DIRS}")
|
||||
message(STATUS " - Libraries: ${AASDK_LIB_DIRS}")
|
||||
add_library(aasdk INTERFACE)
|
||||
target_include_directories(aasdk SYSTEM INTERFACE ${AASDK_INCLUDE_DIR})
|
||||
target_link_libraries(aasdk INTERFACE ${AASDK_LIB_DIR})
|
||||
else (AASDK_FOUND)
|
||||
message(STATUS " - Includes: ${AASDK_INCLUDE_DIRS}")
|
||||
message(STATUS " - Libraries: ${AASDK_LIB_DIRS}")
|
||||
message(FATAL_ERROR "Could not find aasdk")
|
||||
endif (AASDK_FOUND)
|
||||
|
||||
# show the AASDK_INCLUDE_DIRS and AASDK_LIB_DIRS variables only in the advanced view
|
||||
mark_as_advanced(AASDK_INCLUDE_DIRS AASDK_LIB_DIRS)
|
||||
|
||||
endif (AASDK_LIB_DIRS AND AASDK_INCLUDE_DIRS)
|
@ -19,7 +19,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <aap_protobuf/service/media/sink/KeyCode.pb.h>
|
||||
#include <aap_protobuf/service/input/message/TouchAction.pb.h>
|
||||
#include <aap_protobuf/service/input/message/PointerAction.pb.h>
|
||||
#include <aasdk/IO/Promise.hpp>
|
||||
|
||||
namespace f1x
|
||||
@ -54,7 +54,7 @@ struct ButtonEvent
|
||||
|
||||
struct TouchEvent
|
||||
{
|
||||
aap_protobuf::service::input::message::TouchAction type;
|
||||
aap_protobuf::service::input::message::PointerAction type;
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
uint32_t pointerId;
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <aasdk/Transport/ITransport.hpp>
|
||||
#include <aasdk/Channel/Control/IControlServiceChannel.hpp>
|
||||
#include <aasdk/Channel/Control/IControlServiceChannelEventHandler.hpp>
|
||||
#include <aasdk/Channel/MediaSink/Video/VideoChannel.hpp>
|
||||
#include <aasdk/Channel/MediaSink/Video/Channel/VideoChannel.hpp>
|
||||
#include <f1x/openauto/autoapp/Configuration/IConfiguration.hpp>
|
||||
#include <f1x/openauto/autoapp/Service/IAndroidAutoEntity.hpp>
|
||||
#include <f1x/openauto/autoapp/Service/IService.hpp>
|
||||
|
@ -48,7 +48,7 @@ namespace f1x {
|
||||
|
||||
void onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) override;
|
||||
|
||||
void onBindingRequest(const aap_protobuf::channel::input::event::BindingRequest &request) override;
|
||||
void onKeyBindingRequest(const aap_protobuf::channel::input::event::KeyBindingRequest &request) override;
|
||||
|
||||
void onChannelError(const aasdk::error::Error &e) override;
|
||||
|
||||
|
@ -44,7 +44,7 @@ namespace service
|
||||
|
||||
// General Constructor
|
||||
MediaSourceService(boost::asio::io_service& ioService,
|
||||
aasdk::channel::mediasource::IMediaSourceService::Pointer channel, projection::IAudioInput::Pointer audioOutput);
|
||||
aasdk::channel::mediasource::IMediaSourceService::Pointer channel, projection::IAudioInput::Pointer audioInput);
|
||||
|
||||
void start() override;
|
||||
|
||||
@ -70,7 +70,7 @@ namespace service
|
||||
|
||||
void onChannelError(const aasdk::error::Error &e) override;
|
||||
|
||||
private:
|
||||
protected:
|
||||
using std::enable_shared_from_this<MediaSourceService>::shared_from_this;
|
||||
|
||||
void onMediaSourceOpenSuccess();
|
||||
|
@ -19,7 +19,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <gps.h>
|
||||
#include <aasdk/Channel/Sensor/SensorService.hpp>
|
||||
#include <aasdk/Channel/SensorSource/SensorSourceService.hpp>
|
||||
#include <f1x/openauto/autoapp/Service/IService.hpp>
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <aasdk/Messenger/IMessenger.hpp>
|
||||
@ -30,7 +30,7 @@ namespace f1x {
|
||||
namespace service {
|
||||
namespace sensor {
|
||||
class SensorService :
|
||||
public aasdk::channel::sensor::ISensorServiceEventHandler,
|
||||
public aasdk::channel::sensorsource::ISensorSourceServiceEventHandler,
|
||||
public IService,
|
||||
public std::enable_shared_from_this<SensorService> {
|
||||
public:
|
||||
@ -71,7 +71,7 @@ namespace f1x {
|
||||
|
||||
boost::asio::deadline_timer timer_;
|
||||
boost::asio::io_service::strand strand_;
|
||||
aasdk::channel::sensor::SensorService::Pointer channel_;
|
||||
aasdk::channel::sensorsource::SensorSourceService::Pointer channel_;
|
||||
struct gps_data_t gpsData_;
|
||||
bool gpsEnabled_ = false;
|
||||
};
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <aasdk/Channel/WifiProjection/WifiProjectionservice.hpp>
|
||||
#include <aasdk/Channel/WifiProjection/WifiProjectionService.hpp>
|
||||
#include <f1x/openauto/autoapp/Service/IService.hpp>
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <aasdk/Messenger/IMessenger.hpp>
|
||||
|
@ -18,11 +18,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <QWidget>
|
||||
#include <f1x/openauto/autoapp/Configuration/IConfiguration.hpp>
|
||||
#include <QFileDialog>
|
||||
#include <QKeyEvent>
|
||||
#ifdef MAC_OS
|
||||
#else
|
||||
#include <sys/sysinfo.h>
|
||||
#endif
|
||||
|
||||
class QCheckBox;
|
||||
class QTimer;
|
||||
@ -50,7 +53,7 @@ public:
|
||||
void loadSystemValues();
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
|
||||
private slots:
|
||||
void unpairAll();
|
||||
@ -95,7 +98,7 @@ public slots:
|
||||
void show_tab9();
|
||||
|
||||
private:
|
||||
void showEvent(QShowEvent* event);
|
||||
void showEvent(QShowEvent* event) override;
|
||||
void load();
|
||||
void loadButtonCheckBoxes();
|
||||
void saveButtonCheckBoxes();
|
||||
@ -104,6 +107,8 @@ private:
|
||||
|
||||
Ui::SettingsWindow* ui_;
|
||||
configuration::IConfiguration::Pointer configuration_;
|
||||
|
||||
void getMacMemoryInfo(QString &freeMemory);
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -193,18 +193,18 @@ bool InputDevice::handleTouchEvent(QEvent* event)
|
||||
return true;
|
||||
}
|
||||
|
||||
aap_protobuf::service::input::message::TouchAction type;
|
||||
aap_protobuf::service::input::message::PointerAction type;
|
||||
|
||||
switch(event->type())
|
||||
{
|
||||
case QEvent::MouseButtonPress:
|
||||
type = aap_protobuf::service::input::message::TouchAction::ACTION_DOWN;
|
||||
type = aap_protobuf::service::input::message::PointerAction::ACTION_DOWN;
|
||||
break;
|
||||
case QEvent::MouseButtonRelease:
|
||||
type = aap_protobuf::service::input::message::TouchAction::ACTION_UP;
|
||||
type = aap_protobuf::service::input::message::PointerAction::ACTION_UP;
|
||||
break;
|
||||
case QEvent::MouseMove:
|
||||
type = aap_protobuf::service::input::message::TouchAction::ACTION_MOVED;
|
||||
type = aap_protobuf::service::input::message::PointerAction::ACTION_MOVED;
|
||||
break;
|
||||
default:
|
||||
return true;
|
||||
|
@ -33,15 +33,9 @@ RtAudioOutput::RtAudioOutput(uint32_t channelCount, uint32_t sampleSize, uint32_
|
||||
, sampleSize_(sampleSize)
|
||||
, sampleRate_(sampleRate)
|
||||
{
|
||||
|
||||
std::vector<RtAudio::Api> apis;
|
||||
RtAudio::getCompiledApi(apis);
|
||||
dac_ = std::find(apis.begin(), apis.end(), RtAudio::LINUX_PULSE) == apis.end() ? std::make_unique<RtAudio>() : std::make_unique<RtAudio>(RtAudio::LINUX_PULSE);
|
||||
|
||||
// Set the error callback
|
||||
dac_->setErrorCallback([](RtAudioErrorType type, const std::string& errorText) {
|
||||
OPENAUTO_LOG(error) << "[RtAudioOutput] " << errorText;
|
||||
});
|
||||
std::vector<RtAudio::Api> apis;
|
||||
RtAudio::getCompiledApi(apis);
|
||||
dac_ = std::find(apis.begin(), apis.end(), RtAudio::LINUX_PULSE) == apis.end() ? std::make_unique<RtAudio>() : std::make_unique<RtAudio>(RtAudio::LINUX_PULSE);
|
||||
}
|
||||
|
||||
bool RtAudioOutput::open()
|
||||
@ -60,19 +54,13 @@ bool RtAudioOutput::open()
|
||||
RtAudio::StreamOptions streamOptions;
|
||||
streamOptions.flags = RTAUDIO_MINIMIZE_LATENCY | RTAUDIO_SCHEDULE_REALTIME;
|
||||
uint32_t bufferFrames = sampleRate_ == 16000 ? 1024 : 2048; //according to the observation of audio packets
|
||||
auto result = dac_->openStream(¶meters, nullptr, RTAUDIO_SINT16, sampleRate_, &bufferFrames, &RtAudioOutput::audioBufferReadHandler, static_cast<void*>(this), &streamOptions);
|
||||
dac_->openStream(¶meters, nullptr, RTAUDIO_SINT16, sampleRate_, &bufferFrames, &RtAudioOutput::audioBufferReadHandler, static_cast<void*>(this), &streamOptions);
|
||||
if (result == RtAudioErrorType::RTAUDIO_NO_ERROR) {
|
||||
OPENAUTO_LOG(info) << "[RtAudioOutput] Sample Rate: " << sampleRate_;
|
||||
return audioBuffer_.open(QIODevice::ReadWrite);
|
||||
} else {
|
||||
// Log the error using the callback or handle it here directly
|
||||
OPENAUTO_LOG(error) << "[RtAudioOutput] Error opening stream: ";
|
||||
}
|
||||
OPENAUTO_LOG(info) << "[RtAudioOutput] Sample Rate: " << sampleRate_;
|
||||
return audioBuffer_.open(QIODevice::ReadWrite);
|
||||
}
|
||||
catch(const std::exception& e)
|
||||
catch(const RtAudioError& e)
|
||||
{
|
||||
OPENAUTO_LOG(error) << "[RtAudioOutput] Exception: " << e.what();
|
||||
OPENAUTO_LOG(error) << "[RtAudioOutput] Failed to open audio output, what: " << e.what();
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -98,10 +86,9 @@ void RtAudioOutput::start()
|
||||
{
|
||||
dac_->startStream();
|
||||
}
|
||||
catch(const RtAudioErrorType& e)
|
||||
catch(const RtAudioError& e)
|
||||
{
|
||||
// TODO: What's the new RtAudio Error?
|
||||
//OPENAUTO_LOG(error) << "[RtAudioOutput] Failed to start audio output, what: " << e.what();
|
||||
OPENAUTO_LOG(error) << "[RtAudioOutput] Failed to start audio output, what: " << e.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -146,10 +133,9 @@ void RtAudioOutput::doSuspend()
|
||||
{
|
||||
dac_->stopStream();
|
||||
}
|
||||
catch(const RtAudioErrorType& e)
|
||||
catch(const RtAudioError& e)
|
||||
{
|
||||
// TODO: What's the new RtAudio Error?
|
||||
//OPENAUTO_LOG(error) << "[RtAudioOutput] Failed to suspend audio output, what: " << e.what();
|
||||
OPENAUTO_LOG(error) << "[RtAudioOutput] Failed to suspend audio output, what: " << e.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -74,329 +74,307 @@
|
||||
*/
|
||||
|
||||
|
||||
namespace f1x
|
||||
{
|
||||
namespace openauto
|
||||
{
|
||||
namespace autoapp
|
||||
{
|
||||
namespace service
|
||||
{
|
||||
namespace f1x {
|
||||
namespace openauto {
|
||||
namespace autoapp {
|
||||
namespace service {
|
||||
|
||||
AndroidAutoEntity::AndroidAutoEntity(boost::asio::io_service& ioService,
|
||||
aasdk::messenger::ICryptor::Pointer cryptor,
|
||||
aasdk::transport::ITransport::Pointer transport,
|
||||
aasdk::messenger::IMessenger::Pointer messenger,
|
||||
configuration::IConfiguration::Pointer configuration,
|
||||
ServiceList serviceList,
|
||||
IPinger::Pointer pinger)
|
||||
: strand_(ioService)
|
||||
, cryptor_(std::move(cryptor))
|
||||
, transport_(std::move(transport))
|
||||
, messenger_(std::move(messenger))
|
||||
, controlServiceChannel_(std::make_shared<aasdk::channel::control::ControlServiceChannel>(strand_, messenger_))
|
||||
, configuration_(std::move(configuration))
|
||||
, serviceList_(std::move(serviceList))
|
||||
, pinger_(std::move(pinger))
|
||||
, eventHandler_(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
AndroidAutoEntity::~AndroidAutoEntity()
|
||||
{
|
||||
OPENAUTO_LOG(debug) << "[AndroidAutoEntity] destroy.";
|
||||
}
|
||||
|
||||
void AndroidAutoEntity::start(IAndroidAutoEntityEventHandler& eventHandler)
|
||||
{
|
||||
strand_.dispatch([this, self = this->shared_from_this(), eventHandler = &eventHandler]() {
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] start.";
|
||||
|
||||
eventHandler_ = eventHandler;
|
||||
std::for_each(serviceList_.begin(), serviceList_.end(), std::bind(&IService::start, std::placeholders::_1));
|
||||
//this->schedulePing();
|
||||
|
||||
auto versionRequestPromise = aasdk::channel::SendPromise::defer(strand_);
|
||||
versionRequestPromise->then([]() {}, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), std::placeholders::_1));
|
||||
controlServiceChannel_->sendVersionRequest(std::move(versionRequestPromise));
|
||||
controlServiceChannel_->receive(this->shared_from_this());
|
||||
});
|
||||
}
|
||||
|
||||
void AndroidAutoEntity::stop()
|
||||
{
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] stop.";
|
||||
|
||||
try {
|
||||
eventHandler_ = nullptr;
|
||||
std::for_each(serviceList_.begin(), serviceList_.end(), std::bind(&IService::stop, std::placeholders::_1));
|
||||
//pinger_->cancel();
|
||||
messenger_->stop();
|
||||
transport_->stop();
|
||||
cryptor_->deinit();
|
||||
} catch (...) {
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] exception in stop.";
|
||||
AndroidAutoEntity::AndroidAutoEntity(boost::asio::io_service &ioService,
|
||||
aasdk::messenger::ICryptor::Pointer cryptor,
|
||||
aasdk::transport::ITransport::Pointer transport,
|
||||
aasdk::messenger::IMessenger::Pointer messenger,
|
||||
configuration::IConfiguration::Pointer configuration,
|
||||
ServiceList serviceList,
|
||||
IPinger::Pointer pinger)
|
||||
: strand_(ioService), cryptor_(std::move(cryptor)), transport_(std::move(transport)),
|
||||
messenger_(std::move(messenger)), controlServiceChannel_(
|
||||
std::make_shared<aasdk::channel::control::ControlServiceChannel>(strand_, messenger_)),
|
||||
configuration_(std::move(configuration)), serviceList_(std::move(serviceList)),
|
||||
pinger_(std::move(pinger)), eventHandler_(nullptr) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void AndroidAutoEntity::pause()
|
||||
{
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] pause.";
|
||||
|
||||
try {
|
||||
std::for_each(serviceList_.begin(), serviceList_.end(), std::bind(&IService::pause, std::placeholders::_1));
|
||||
} catch (...) {
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] exception in pause.";
|
||||
AndroidAutoEntity::~AndroidAutoEntity() {
|
||||
OPENAUTO_LOG(debug) << "[AndroidAutoEntity] destroy.";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void AndroidAutoEntity::resume()
|
||||
{
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] resume.";
|
||||
void AndroidAutoEntity::start(IAndroidAutoEntityEventHandler &eventHandler) {
|
||||
strand_.dispatch([this, self = this->shared_from_this(), eventHandler = &eventHandler]() {
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] start()";
|
||||
|
||||
try {
|
||||
std::for_each(serviceList_.begin(), serviceList_.end(), std::bind(&IService::resume, std::placeholders::_1));
|
||||
} catch (...) {
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] exception in resume.";
|
||||
}
|
||||
});
|
||||
}
|
||||
eventHandler_ = eventHandler;
|
||||
std::for_each(serviceList_.begin(), serviceList_.end(), std::bind(&IService::start, std::placeholders::_1));
|
||||
|
||||
void AndroidAutoEntity::onVersionResponse(uint16_t majorCode, uint16_t minorCode, aap_protobuf::shared::MessageStatus status)
|
||||
{
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] version response, version: " << majorCode
|
||||
<< "." << minorCode
|
||||
<< ", status: " << status;
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] Event handlers added.";
|
||||
auto versionRequestPromise = aasdk::channel::SendPromise::defer(strand_);
|
||||
versionRequestPromise->then([]() {}, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(),
|
||||
std::placeholders::_1));
|
||||
|
||||
if(status == aap_protobuf::shared::MessageStatus::STATUS_NO_COMPATIBLE_VERSION)
|
||||
{
|
||||
OPENAUTO_LOG(error) << "[AndroidAutoEntity] version mismatch.";
|
||||
this->triggerQuit();
|
||||
}
|
||||
else
|
||||
{
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] Begin handshake.";
|
||||
|
||||
try
|
||||
{
|
||||
cryptor_->doHandshake();
|
||||
|
||||
auto handshakePromise = aasdk::channel::SendPromise::defer(strand_);
|
||||
handshakePromise->then([]() {}, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), std::placeholders::_1));
|
||||
controlServiceChannel_->sendHandshake(cryptor_->readHandshakeBuffer(), std::move(handshakePromise));
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] Sending version request.";
|
||||
controlServiceChannel_->sendVersionRequest(std::move(versionRequestPromise));
|
||||
controlServiceChannel_->receive(this->shared_from_this());
|
||||
}
|
||||
catch(const aasdk::error::Error& e)
|
||||
{
|
||||
this->onChannelError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AndroidAutoEntity::onHandshake(const aasdk::common::DataConstBuffer& payload)
|
||||
{
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] Handshake, size: " << payload.size;
|
||||
|
||||
try
|
||||
{
|
||||
cryptor_->writeHandshakeBuffer(payload);
|
||||
|
||||
if(!cryptor_->doHandshake())
|
||||
{
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] continue handshake.";
|
||||
|
||||
auto handshakePromise = aasdk::channel::SendPromise::defer(strand_);
|
||||
handshakePromise->then([]() {}, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), std::placeholders::_1));
|
||||
controlServiceChannel_->sendHandshake(cryptor_->readHandshakeBuffer(), std::move(handshakePromise));
|
||||
}
|
||||
else
|
||||
{
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] Auth completed.";
|
||||
|
||||
aap_protobuf::channel::control::auth::AuthResponse authCompleteIndication;
|
||||
authCompleteIndication.set_status(aap_protobuf::shared::MessageStatus::STATUS_SUCCESS);
|
||||
|
||||
auto authCompletePromise = aasdk::channel::SendPromise::defer(strand_);
|
||||
authCompletePromise->then([]() {}, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), std::placeholders::_1));
|
||||
controlServiceChannel_->sendAuthComplete(authCompleteIndication, std::move(authCompletePromise));
|
||||
});
|
||||
}
|
||||
|
||||
controlServiceChannel_->receive(this->shared_from_this());
|
||||
}
|
||||
catch(const aasdk::error::Error& e)
|
||||
{
|
||||
this->onChannelError(e);
|
||||
}
|
||||
}
|
||||
void AndroidAutoEntity::stop() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] stop()";
|
||||
|
||||
void AndroidAutoEntity::onServiceDiscoveryRequest(const aap_protobuf::channel::control::servicediscovery::event::ServiceDiscoveryRequest& request)
|
||||
{
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] Discovery request, device name: " << request.device_name()
|
||||
<< ", brand: " << request.label_text();
|
||||
try {
|
||||
eventHandler_ = nullptr;
|
||||
std::for_each(serviceList_.begin(), serviceList_.end(),
|
||||
std::bind(&IService::stop, std::placeholders::_1));
|
||||
//pinger_->cancel();
|
||||
messenger_->stop();
|
||||
transport_->stop();
|
||||
cryptor_->deinit();
|
||||
} catch (...) {
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] stop() - exception when stopping.";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
aap_protobuf::connection::PingConfiguration pingConfiguration;
|
||||
pingConfiguration.set_high_latency_threshold_ms();
|
||||
pingConfiguration.set_interval_ms();
|
||||
pingConfiguration.set_timeout_ms();
|
||||
pingConfiguration.set_tracked_ping_count();
|
||||
void AndroidAutoEntity::pause() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] pause()";
|
||||
|
||||
aap_protobuf::connection::WirelessTcpConfiguration wirelessTcpConfiguration;
|
||||
wirelessTcpConfiguration.set_socket_read_timeout_ms();
|
||||
wirelessTcpConfiguration.set_socket_receive_buffer_size_kb();
|
||||
wirelessTcpConfiguration.set_socket_send_buffer_size_kb();
|
||||
try {
|
||||
std::for_each(serviceList_.begin(), serviceList_.end(),
|
||||
std::bind(&IService::pause, std::placeholders::_1));
|
||||
} catch (...) {
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] pause() - exception when pausing.";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
aap_protobuf::connection::ConnectionConfiguration connectionConfiguration;
|
||||
connectionConfiguration.set_allocated_ping_configuration();
|
||||
connectionConfiguration.set_allocated_wireless_tcp_configuration();*/
|
||||
void AndroidAutoEntity::resume() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] resume()";
|
||||
|
||||
aap_protobuf::channel::control::servicediscovery::notification::HeadUnitInfo headUnitInfo;
|
||||
headUnitInfo.set_make("CubeOne");
|
||||
headUnitInfo.set_model("Journey");
|
||||
headUnitInfo.set_year("2024");
|
||||
headUnitInfo.set_vehicle_id("2009");
|
||||
headUnitInfo.set_head_unit_make("CubeOne");
|
||||
headUnitInfo.set_head_unit_model("Journey");
|
||||
headUnitInfo.set_head_unit_software_build("2024.10.15");
|
||||
headUnitInfo.set_head_unit_software_version("1");
|
||||
try {
|
||||
std::for_each(serviceList_.begin(), serviceList_.end(),
|
||||
std::bind(&IService::resume, std::placeholders::_1));
|
||||
} catch (...) {
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] resume() exception when resuming.";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse serviceDiscoveryResponse;
|
||||
serviceDiscoveryResponse.mutable_channels()->Reserve(256);
|
||||
void AndroidAutoEntity::onVersionResponse(uint16_t majorCode, uint16_t minorCode,
|
||||
aap_protobuf::shared::MessageStatus status) {
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] onVersionResponse()";
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] Version Received: " << majorCode << "." << minorCode
|
||||
<< ", with status: " << status;
|
||||
|
||||
//serviceDiscoveryResponse.set_headunit_sw_build("2024.10.15");
|
||||
//serviceDiscoveryResponse.set_headunit_sw_version("1");
|
||||
serviceDiscoveryResponse.set_display_name("JourneyOS");
|
||||
|
||||
serviceDiscoveryResponse.set_allocated_headunit_info(&headUnitInfo);
|
||||
|
||||
//serviceDiscoveryResponse.set_can_play_native_media_during_vr(false);
|
||||
|
||||
std::for_each(serviceList_.begin(), serviceList_.end(), std::bind(&IService::fillFeatures, std::placeholders::_1, std::ref(serviceDiscoveryResponse)));
|
||||
|
||||
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
||||
promise->then([]() {}, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), std::placeholders::_1));
|
||||
controlServiceChannel_->sendServiceDiscoveryResponse(serviceDiscoveryResponse, std::move(promise));
|
||||
controlServiceChannel_->receive(this->shared_from_this());
|
||||
}
|
||||
|
||||
void AndroidAutoEntity::onAudioFocusRequest(const aap_protobuf::channel::control::focus::audio::event::AudioFocusRequest& request)
|
||||
{
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] requested audio focus, type: " << request.audio_focus_type();
|
||||
|
||||
aap_protobuf::channel::control::focus::audio::notification::AudioFocusStateType audioFocusState =
|
||||
request.audio_focus_type() == aap_protobuf::channel::control::focus::audio::event::AudioFocusRequestType::AUDIO_FOCUS_RELEASE
|
||||
? aap_protobuf::channel::control::focus::audio::notification::AudioFocusStateType::AUDIO_FOCUS_STATE_LOSS
|
||||
: aap_protobuf::channel::control::focus::audio::notification::AudioFocusStateType::AUDIO_FOCUS_STATE_GAIN;
|
||||
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] audio focus state: " << audioFocusState;
|
||||
|
||||
aap_protobuf::channel::control::focus::audio::notification::AudioFocusNotification response;
|
||||
response.set_audio_focus_state(audioFocusState);
|
||||
|
||||
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
||||
promise->then([]() {}, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), std::placeholders::_1));
|
||||
controlServiceChannel_->sendAudioFocusResponse(response, std::move(promise));
|
||||
controlServiceChannel_->receive(this->shared_from_this());
|
||||
}
|
||||
|
||||
void AndroidAutoEntity::onByeByeRequest(const aap_protobuf::channel::control::byebye::event::ByeByeRequest& request)
|
||||
{
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] Shutdown request, reason: " << request.reason();
|
||||
|
||||
aap_protobuf::channel::control::byebye::notification::ByeByeResponse response;
|
||||
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
||||
promise->then(std::bind(&AndroidAutoEntity::triggerQuit, this->shared_from_this()),
|
||||
std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), std::placeholders::_1));
|
||||
|
||||
controlServiceChannel_->sendShutdownResponse(response, std::move(promise));
|
||||
}
|
||||
|
||||
void AndroidAutoEntity::onByeByeResponse(const aap_protobuf::channel::control::byebye::notification::ByeByeResponse& response)
|
||||
{
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] Shutdown response ";
|
||||
this->triggerQuit();
|
||||
}
|
||||
|
||||
void AndroidAutoEntity::onNavigationFocusRequest(const aap_protobuf::channel::control::focus::navigation::event::NavFocusRequestNotification& request)
|
||||
{
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] navigation focus request, type: " << request.focus_type();
|
||||
|
||||
aap_protobuf::channel::control::focus::navigation::notification::NavFocusNotification response;
|
||||
response.set_focus_type(aap_protobuf::channel::control::focus::navigation::shared::NavFocusType::NAV_FOCUS_PROJECTED);
|
||||
|
||||
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
||||
promise->then([]() {}, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), std::placeholders::_1));
|
||||
controlServiceChannel_->sendNavigationFocusResponse(response, std::move(promise));
|
||||
controlServiceChannel_->receive(this->shared_from_this());
|
||||
}
|
||||
|
||||
void onVoiceSessionRequest(const aap_protobuf::channel::control::voice::VoiceSessionNotification &request) {
|
||||
// TODO: FIXME
|
||||
}
|
||||
void AndroidAutoEntity::onPingRequest(const aap_protobuf::channel::control::ping::PingRequest& request)
|
||||
{
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] Ping request, timestamp: " << request.timestamp();
|
||||
//pinger_->ping();
|
||||
//controlServiceChannel_->receive(this->shared_from_this());
|
||||
}
|
||||
|
||||
void AndroidAutoEntity::onPingResponse(const aap_protobuf::channel::control::ping::PingResponse& response)
|
||||
{
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] Ping response, timestamp: " << response.timestamp();
|
||||
pinger_->pong();
|
||||
controlServiceChannel_->receive(this->shared_from_this());
|
||||
}
|
||||
|
||||
void AndroidAutoEntity::onChannelError(const aasdk::error::Error& e)
|
||||
{
|
||||
OPENAUTO_LOG(error) << "[AndroidAutoEntity] channel error: " << e.what();
|
||||
this->triggerQuit();
|
||||
}
|
||||
|
||||
void AndroidAutoEntity::triggerQuit()
|
||||
{
|
||||
if(eventHandler_ != nullptr)
|
||||
{
|
||||
eventHandler_->onAndroidAutoQuit();
|
||||
}
|
||||
}
|
||||
|
||||
void AndroidAutoEntity::schedulePing()
|
||||
{
|
||||
auto promise = IPinger::Promise::defer(strand_);
|
||||
promise->then([this, self = this->shared_from_this()]() {
|
||||
this->sendPing();
|
||||
this->schedulePing();
|
||||
},
|
||||
[this, self = this->shared_from_this()](auto error) {
|
||||
if(error != aasdk::error::ErrorCode::OPERATION_ABORTED &&
|
||||
error != aasdk::error::ErrorCode::OPERATION_IN_PROGRESS)
|
||||
{
|
||||
OPENAUTO_LOG(error) << "[AndroidAutoEntity] ping timer exceeded.";
|
||||
if (status == aap_protobuf::shared::MessageStatus::STATUS_NO_COMPATIBLE_VERSION) {
|
||||
OPENAUTO_LOG(error) << "[AndroidAutoEntity] Version mismatch.";
|
||||
this->triggerQuit();
|
||||
} else {
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] Version matches.";
|
||||
|
||||
try {
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] Beginning SSL handshake...";
|
||||
cryptor_->doHandshake();
|
||||
|
||||
auto handshakePromise = aasdk::channel::SendPromise::defer(strand_);
|
||||
handshakePromise->then([]() {}, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(),
|
||||
std::placeholders::_1));
|
||||
controlServiceChannel_->sendHandshake(cryptor_->readHandshakeBuffer(), std::move(handshakePromise));
|
||||
controlServiceChannel_->receive(this->shared_from_this());
|
||||
}
|
||||
catch (const aasdk::error::Error &e) {
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] Handshake Error.";
|
||||
this->onChannelError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
pinger_->ping(std::move(promise));
|
||||
}
|
||||
void AndroidAutoEntity::onHandshake(const aasdk::common::DataConstBuffer &payload) {
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] onHandshake()";
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] Payload size: " << payload.size;
|
||||
|
||||
void AndroidAutoEntity::sendPing()
|
||||
{
|
||||
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
||||
promise->then([]() {}, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), std::placeholders::_1));
|
||||
try {
|
||||
cryptor_->writeHandshakeBuffer(payload);
|
||||
|
||||
aap_protobuf::channel::control::ping::PingRequest request;
|
||||
auto timestamp = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now().time_since_epoch());
|
||||
request.set_timestamp(timestamp.count());
|
||||
controlServiceChannel_->sendPingRequest(request, std::move(promise));
|
||||
}
|
||||
if (!cryptor_->doHandshake()) {
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] Re-attempting handshake.";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
auto handshakePromise = aasdk::channel::SendPromise::defer(strand_);
|
||||
handshakePromise->then([]() {}, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(),
|
||||
std::placeholders::_1));
|
||||
controlServiceChannel_->sendHandshake(cryptor_->readHandshakeBuffer(), std::move(handshakePromise));
|
||||
} else {
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] Handshake completed.";
|
||||
|
||||
aap_protobuf::channel::control::auth::AuthResponse authCompleteIndication;
|
||||
authCompleteIndication.set_status(aap_protobuf::shared::MessageStatus::STATUS_SUCCESS);
|
||||
|
||||
auto authCompletePromise = aasdk::channel::SendPromise::defer(strand_);
|
||||
authCompletePromise->then([]() {}, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(),
|
||||
std::placeholders::_1));
|
||||
controlServiceChannel_->sendAuthComplete(authCompleteIndication, std::move(authCompletePromise));
|
||||
}
|
||||
|
||||
controlServiceChannel_->receive(this->shared_from_this());
|
||||
}
|
||||
catch (const aasdk::error::Error &e) {
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] Error during handshake";
|
||||
this->onChannelError(e);
|
||||
}
|
||||
}
|
||||
|
||||
void AndroidAutoEntity::onServiceDiscoveryRequest(
|
||||
const aap_protobuf::channel::control::servicediscovery::event::ServiceDiscoveryRequest &request) {
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] onServiceDiscoveryRequest()";
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] Type: " << request.label_text() << ", Model: "
|
||||
<< request.device_name();
|
||||
|
||||
aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse serviceDiscoveryResponse;
|
||||
serviceDiscoveryResponse.mutable_channels()->Reserve(256);
|
||||
auto *headUnitInfo = serviceDiscoveryResponse.mutable_headunit_info();
|
||||
|
||||
serviceDiscoveryResponse.set_display_name("JourneyOS");
|
||||
headUnitInfo->set_make("CubeOne");
|
||||
headUnitInfo->set_model("Journey");
|
||||
headUnitInfo->set_year("2024");
|
||||
headUnitInfo->set_vehicle_id("2009");
|
||||
headUnitInfo->set_head_unit_make("CubeOne");
|
||||
headUnitInfo->set_head_unit_model("Journey");
|
||||
headUnitInfo->set_head_unit_software_build("2024.10.15");
|
||||
headUnitInfo->set_head_unit_software_version("1");
|
||||
|
||||
std::for_each(serviceList_.begin(), serviceList_.end(),
|
||||
std::bind(&IService::fillFeatures, std::placeholders::_1, std::ref(serviceDiscoveryResponse)));
|
||||
|
||||
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
||||
promise->then([]() {},
|
||||
std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), std::placeholders::_1));
|
||||
controlServiceChannel_->sendServiceDiscoveryResponse(serviceDiscoveryResponse, std::move(promise));
|
||||
controlServiceChannel_->receive(this->shared_from_this());
|
||||
}
|
||||
|
||||
void AndroidAutoEntity::onAudioFocusRequest(
|
||||
const aap_protobuf::channel::control::focus::audio::event::AudioFocusRequest &request) {
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] onAudioFocusRequest()";
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] AudioFocusRequestType received: "
|
||||
<< AudioFocusRequestType_Name(request.audio_focus_type());
|
||||
|
||||
aap_protobuf::channel::control::focus::audio::notification::AudioFocusStateType audioFocusStateType =
|
||||
request.audio_focus_type() ==
|
||||
aap_protobuf::channel::control::focus::audio::event::AudioFocusRequestType::AUDIO_FOCUS_RELEASE
|
||||
? aap_protobuf::channel::control::focus::audio::notification::AudioFocusStateType::AUDIO_FOCUS_STATE_LOSS
|
||||
: aap_protobuf::channel::control::focus::audio::notification::AudioFocusStateType::AUDIO_FOCUS_STATE_GAIN;
|
||||
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] AudioFocusStateType determined: "
|
||||
<< AudioFocusStateType_Name(audioFocusStateType);
|
||||
|
||||
aap_protobuf::channel::control::focus::audio::notification::AudioFocusNotification response;
|
||||
response.set_audio_focus_state(audioFocusStateType);
|
||||
|
||||
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
||||
promise->then([]() {},
|
||||
std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), std::placeholders::_1));
|
||||
controlServiceChannel_->sendAudioFocusResponse(response, std::move(promise));
|
||||
controlServiceChannel_->receive(this->shared_from_this());
|
||||
}
|
||||
|
||||
void AndroidAutoEntity::onByeByeRequest(
|
||||
const aap_protobuf::channel::control::byebye::event::ByeByeRequest &request) {
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] onByeByeRequest()";
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] Reason received: " << request.reason();
|
||||
|
||||
aap_protobuf::channel::control::byebye::notification::ByeByeResponse response;
|
||||
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
||||
promise->then(std::bind(&AndroidAutoEntity::triggerQuit, this->shared_from_this()),
|
||||
std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), std::placeholders::_1));
|
||||
|
||||
controlServiceChannel_->sendShutdownResponse(response, std::move(promise));
|
||||
}
|
||||
|
||||
void AndroidAutoEntity::onByeByeResponse(
|
||||
const aap_protobuf::channel::control::byebye::notification::ByeByeResponse &response) {
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] onByeByeResponse()";
|
||||
this->triggerQuit();
|
||||
}
|
||||
|
||||
void AndroidAutoEntity::onNavigationFocusRequest(
|
||||
const aap_protobuf::channel::control::focus::navigation::event::NavFocusRequestNotification &request) {
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] onByeByeResponse()";
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] NavFocusRequestNotification type received: " << NavFocusType_Name(request.focus_type());
|
||||
|
||||
aap_protobuf::channel::control::focus::navigation::notification::NavFocusNotification response;
|
||||
response.set_focus_type(
|
||||
aap_protobuf::channel::control::focus::navigation::shared::NavFocusType::NAV_FOCUS_PROJECTED);
|
||||
|
||||
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
||||
promise->then([]() {},
|
||||
std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), std::placeholders::_1));
|
||||
controlServiceChannel_->sendNavigationFocusResponse(response, std::move(promise));
|
||||
controlServiceChannel_->receive(this->shared_from_this());
|
||||
}
|
||||
|
||||
void AndroidAutoEntity::onVoiceSessionRequest(
|
||||
const aap_protobuf::channel::control::voice::VoiceSessionNotification &request) {
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] onVoiceSessionRequest()";
|
||||
}
|
||||
|
||||
void AndroidAutoEntity::onPingRequest(const aap_protobuf::channel::control::ping::PingRequest &request) {
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] onPingRequest()";
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] Timestamp: " << request.timestamp();
|
||||
//pinger_->ping();
|
||||
//controlServiceChannel_->receive(this->shared_from_this());
|
||||
}
|
||||
|
||||
void AndroidAutoEntity::onPingResponse(const aap_protobuf::channel::control::ping::PingResponse &response) {
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] onPingResponse()";
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] Timestamp: " << response.timestamp();
|
||||
pinger_->pong();
|
||||
controlServiceChannel_->receive(this->shared_from_this());
|
||||
}
|
||||
|
||||
void AndroidAutoEntity::onChannelError(const aasdk::error::Error &e) {
|
||||
OPENAUTO_LOG(error) << "[AndroidAutoEntity] onChannelError(): " << e.what();
|
||||
this->triggerQuit();
|
||||
}
|
||||
|
||||
void AndroidAutoEntity::triggerQuit() {
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] triggerQuit()";
|
||||
if (eventHandler_ != nullptr) {
|
||||
eventHandler_->onAndroidAutoQuit();
|
||||
}
|
||||
}
|
||||
|
||||
void AndroidAutoEntity::schedulePing() {
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] schedulePing()";
|
||||
auto promise = IPinger::Promise::defer(strand_);
|
||||
promise->then([this, self = this->shared_from_this()]() {
|
||||
this->sendPing();
|
||||
this->schedulePing();
|
||||
},
|
||||
[this, self = this->shared_from_this()](auto error) {
|
||||
if (error != aasdk::error::ErrorCode::OPERATION_ABORTED &&
|
||||
error != aasdk::error::ErrorCode::OPERATION_IN_PROGRESS) {
|
||||
OPENAUTO_LOG(error) << "[AndroidAutoEntity] Ping timer exceeded.";
|
||||
this->triggerQuit();
|
||||
}
|
||||
});
|
||||
|
||||
pinger_->ping(std::move(promise));
|
||||
}
|
||||
|
||||
void AndroidAutoEntity::sendPing() {
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] sendPing()";
|
||||
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
||||
promise->then([]() {},
|
||||
std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), std::placeholders::_1));
|
||||
|
||||
aap_protobuf::channel::control::ping::PingRequest request;
|
||||
auto timestamp = std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::high_resolution_clock::now().time_since_epoch());
|
||||
request.set_timestamp(timestamp.count());
|
||||
controlServiceChannel_->sendPingRequest(request, std::move(promise));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,53 +36,52 @@ namespace f1x {
|
||||
|
||||
void BluetoothService::start() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[BluetoothService] start.";
|
||||
OPENAUTO_LOG(info) << "[BluetoothService] start()";
|
||||
channel_->receive(this->shared_from_this());
|
||||
});
|
||||
}
|
||||
|
||||
void BluetoothService::stop() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[BluetoothService] stop.";
|
||||
OPENAUTO_LOG(info) << "[BluetoothService] stop()";
|
||||
bluetoothDevice_->stop();
|
||||
});
|
||||
}
|
||||
|
||||
void BluetoothService::pause() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[BluetoothService] pause.";
|
||||
OPENAUTO_LOG(info) << "[BluetoothService] pause()";
|
||||
});
|
||||
}
|
||||
|
||||
void BluetoothService::resume() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[BluetoothService] resume.";
|
||||
OPENAUTO_LOG(info) << "[BluetoothService] resume()";
|
||||
});
|
||||
}
|
||||
|
||||
void BluetoothService::fillFeatures(
|
||||
aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) {
|
||||
OPENAUTO_LOG(info) << "[BluetoothService] fill features";
|
||||
OPENAUTO_LOG(info) << "[BluetoothService] fillFeatures()";
|
||||
|
||||
if (bluetoothDevice_->isAvailable()) {
|
||||
OPENAUTO_LOG(info) << "[BluetoothService] sending local adapter adress: "
|
||||
<< bluetoothDevice_->getLocalAddress();
|
||||
OPENAUTO_LOG(info) << "[BluetoothService] Local Address: " << bluetoothDevice_->getLocalAddress();
|
||||
|
||||
auto *channelDescriptor = response.add_channels();
|
||||
channelDescriptor->set_channel_id(static_cast<uint32_t>(channel_->getId()));
|
||||
auto bluetoothChannel = channelDescriptor->mutable_bluetooth_service();
|
||||
bluetoothChannel->set_adapter_address(bluetoothDevice_->getLocalAddress());
|
||||
bluetoothChannel->add_supported_pairing_methods(aap_protobuf::channel::bluetooth::event::BluetoothPairingMethod::BLUETOOTH_PAIRING_PIN);
|
||||
bluetoothChannel->add_supported_pairing_methods(aap_protobuf::channel::bluetooth::event::BluetoothPairingMethod::BLUETOOTH_PAIRING_NUMERIC_COMPARISON);
|
||||
auto *service = response.add_channels();
|
||||
service->set_id(static_cast<uint32_t>(channel_->getId()));
|
||||
auto bluetooth = service->mutable_bluetooth_service();
|
||||
bluetooth->set_car_address(bluetoothDevice_->getLocalAddress());
|
||||
bluetooth->add_supported_pairing_methods(aap_protobuf::channel::bluetooth::event::BluetoothPairingMethod::BLUETOOTH_PAIRING_PIN);
|
||||
bluetooth->add_supported_pairing_methods(aap_protobuf::channel::bluetooth::event::BluetoothPairingMethod::BLUETOOTH_PAIRING_NUMERIC_COMPARISON);
|
||||
}
|
||||
}
|
||||
|
||||
void BluetoothService::onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) {
|
||||
OPENAUTO_LOG(info) << "[BluetoothService] open request, priority: " << request.priority();
|
||||
const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS;
|
||||
OPENAUTO_LOG(info) << "[BluetoothService] open status: " << status;
|
||||
OPENAUTO_LOG(info) << "[BluetoothService] onChannelOpenRequest()";
|
||||
OPENAUTO_LOG(info) << "[BluetoothService] Channel Id: " << request.service_id() << ", Priority: " << request.priority();
|
||||
|
||||
aap_protobuf::channel::ChannelOpenResponse response;
|
||||
const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS;
|
||||
response.set_status(status);
|
||||
|
||||
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
||||
@ -95,11 +94,18 @@ namespace f1x {
|
||||
|
||||
void BluetoothService::onBluetoothPairingRequest(
|
||||
const aap_protobuf::channel::bluetooth::event::BluetoothPairingRequest &request) {
|
||||
OPENAUTO_LOG(info) << "[BluetoothService] pairing request, address: " << request.phone_address();
|
||||
OPENAUTO_LOG(info) << "[BluetoothService] onBluetoothPairingRequest()";
|
||||
OPENAUTO_LOG(info) << "[BluetoothService] Phone Address: " << request.phone_address();
|
||||
|
||||
aap_protobuf::service::bluetooth::message::BluetoothPairingResponse response;
|
||||
|
||||
const auto isPaired = bluetoothDevice_->isPaired(request.phone_address());
|
||||
if (isPaired) {
|
||||
OPENAUTO_LOG(info) << "[BluetoothService] Phone is Already Paired";
|
||||
} else {
|
||||
OPENAUTO_LOG(info) << "[BluetoothService] Phone is Not Paired";
|
||||
}
|
||||
|
||||
response.set_already_paired(isPaired);
|
||||
response.set_status(aap_protobuf::shared::MessageStatus::STATUS_SUCCESS);
|
||||
|
||||
@ -112,9 +118,8 @@ namespace f1x {
|
||||
}
|
||||
|
||||
void BluetoothService::onChannelError(const aasdk::error::Error &e) {
|
||||
OPENAUTO_LOG(error) << "[BluetoothService] channel error: " << e.what();
|
||||
OPENAUTO_LOG(error) << "[BluetoothService] onChannelError(): " << e.what();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,40 +37,56 @@ namespace f1x {
|
||||
|
||||
void GenericNotificationService::start() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[GenericNotificationService] start.";
|
||||
OPENAUTO_LOG(info) << "[GenericNotificationService] start()";
|
||||
});
|
||||
}
|
||||
|
||||
void GenericNotificationService::stop() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[GenericNotificationService] stop.";
|
||||
OPENAUTO_LOG(info) << "[GenericNotificationService] stop()";
|
||||
});
|
||||
}
|
||||
|
||||
void GenericNotificationService::pause() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[GenericNotificationService] pause.";
|
||||
OPENAUTO_LOG(info) << "[GenericNotificationService] pause()";
|
||||
});
|
||||
}
|
||||
|
||||
void GenericNotificationService::resume() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[GenericNotificationService] resume.";
|
||||
OPENAUTO_LOG(info) << "[GenericNotificationService] resume()";
|
||||
});
|
||||
}
|
||||
|
||||
void GenericNotificationService::fillFeatures(
|
||||
aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) {
|
||||
OPENAUTO_LOG(info) << "[GenericNotificationService] fill features.";
|
||||
OPENAUTO_LOG(info) << "[GenericNotificationService] fillFeatures()";
|
||||
|
||||
auto *channelDescriptor = response.add_channels();
|
||||
channelDescriptor->set_channel_id(static_cast<uint32_t>(channel_->getId()));
|
||||
auto *service = response.add_channels();
|
||||
service->set_id(static_cast<uint32_t>(channel_->getId()));
|
||||
|
||||
auto *vendorExtension = channelDescriptor->mutable_wifi_projection_service();
|
||||
auto *genericNotification = service->mutable_wifi_projection_service();
|
||||
}
|
||||
|
||||
void GenericNotificationService::onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) {
|
||||
OPENAUTO_LOG(info) << "[GenericNotificationService] onChannelOpenRequest()";
|
||||
OPENAUTO_LOG(info) << "[GenericNotificationService] Channel Id: " << request.service_id() << ", Priority: " << request.priority();
|
||||
|
||||
aap_protobuf::channel::ChannelOpenResponse response;
|
||||
const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS;
|
||||
response.set_status(status);
|
||||
|
||||
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
||||
promise->then([]() {}, std::bind(&GenericNotificationService::onChannelError, this->shared_from_this(),
|
||||
std::placeholders::_1));
|
||||
channel_->sendChannelOpenResponse(response, std::move(promise));
|
||||
|
||||
channel_->receive(this->shared_from_this());
|
||||
}
|
||||
|
||||
void GenericNotificationService::onChannelError(const aasdk::error::Error &e) {
|
||||
OPENAUTO_LOG(error) << "[GenericNotificationService] channel error: " << e.what();
|
||||
OPENAUTO_LOG(error) << "[GenericNotificationService] onChannelError(): " << e.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
* along with openauto. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <aap_protobuf/service/input/message/InputEventIndication.pb.h>
|
||||
#include <aap_protobuf/service/input/message/InputReport.pb.h>
|
||||
#include <f1x/openauto/Common/Log.hpp>
|
||||
#include <f1x/openauto/autoapp/Service/InputSource/InputSourceService.hpp>
|
||||
|
||||
@ -36,38 +36,38 @@ namespace f1x {
|
||||
|
||||
void InputSourceService::start() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[InputService] start.";
|
||||
OPENAUTO_LOG(info) << "[InputSourceService] start()";
|
||||
channel_->receive(this->shared_from_this());
|
||||
});
|
||||
}
|
||||
|
||||
void InputSourceService::stop() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[InputService] stop.";
|
||||
OPENAUTO_LOG(info) << "[InputSourceService] stop()";
|
||||
inputDevice_->stop();
|
||||
});
|
||||
}
|
||||
|
||||
void InputSourceService::pause() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[InputService] pause.";
|
||||
OPENAUTO_LOG(info) << "[InputSourceService] pause()";
|
||||
});
|
||||
}
|
||||
|
||||
void InputSourceService::resume() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[InputService] resume.";
|
||||
OPENAUTO_LOG(info) << "[InputSourceService] resume()";
|
||||
});
|
||||
}
|
||||
|
||||
void InputSourceService::fillFeatures(
|
||||
aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) {
|
||||
OPENAUTO_LOG(info) << "[InputService] fill features.";
|
||||
OPENAUTO_LOG(info) << "[InputSourceService] fillFeatures()";
|
||||
|
||||
auto *channelDescriptor = response.add_channels();
|
||||
channelDescriptor->set_channel_id(static_cast<uint32_t>(channel_->getId()));
|
||||
auto *service = response.add_channels();
|
||||
service->set_id(static_cast<uint32_t>(channel_->getId()));
|
||||
|
||||
auto *inputChannel = channelDescriptor->mutable_input_service();
|
||||
auto *inputChannel = service->mutable_input_source_service();
|
||||
|
||||
const auto &supportedButtonCodes = inputDevice_->getSupportedButtonCodes();
|
||||
|
||||
@ -77,7 +77,7 @@ namespace f1x {
|
||||
|
||||
if (inputDevice_->hasTouchscreen()) {
|
||||
const auto &touchscreenSurface = inputDevice_->getTouchscreenGeometry();
|
||||
auto touchscreenConfig = inputChannel->add_touch_screen_config();
|
||||
auto touchscreenConfig = inputChannel->add_touchscreen();
|
||||
|
||||
touchscreenConfig->set_width(touchscreenSurface.width());
|
||||
touchscreenConfig->set_height(touchscreenSurface.height());
|
||||
@ -85,22 +85,24 @@ namespace f1x {
|
||||
}
|
||||
|
||||
void InputSourceService::onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) {
|
||||
OPENAUTO_LOG(info) << "[InputService] open request, priority: " << request.priority();
|
||||
const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS;
|
||||
OPENAUTO_LOG(info) << "[InputService] open status: " << status;
|
||||
OPENAUTO_LOG(info) << "[InputSourceService] onChannelOpenRequest()";
|
||||
OPENAUTO_LOG(info) << "[InputSourceService] Channel Id: " << request.service_id() << ", Priority: " << request.priority();
|
||||
|
||||
|
||||
aap_protobuf::channel::ChannelOpenResponse response;
|
||||
const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS;
|
||||
response.set_status(status);
|
||||
|
||||
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
||||
promise->then([]() {},
|
||||
std::bind(&InputSourceService::onChannelError, this->shared_from_this(), std::placeholders::_1));
|
||||
channel_->sendChannelOpenResponse(response, std::move(promise));
|
||||
|
||||
channel_->receive(this->shared_from_this());
|
||||
}
|
||||
void InputSourceService::onBindingRequest(const aap_protobuf::channel::input::event::BindingRequest &request) {
|
||||
OPENAUTO_LOG(info) << "[InputService] binding request, scan codes count: " << request.keycodes_size();
|
||||
|
||||
void InputSourceService::onKeyBindingRequest(const aap_protobuf::channel::input::event::KeyBindingRequest &request) {
|
||||
OPENAUTO_LOG(info) << "[InputSourceService] onKeyBindingRequest()";
|
||||
OPENAUTO_LOG(info) << "[InputSourceService] KeyCodes Count: " << request.keycodes_size();
|
||||
|
||||
aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS;
|
||||
const auto &supportedButtonCodes = inputDevice_->getSupportedButtonCodes();
|
||||
@ -108,49 +110,48 @@ namespace f1x {
|
||||
for (int i = 0; i < request.keycodes_size(); ++i) {
|
||||
if (std::find(supportedButtonCodes.begin(), supportedButtonCodes.end(), request.keycodes(i)) ==
|
||||
supportedButtonCodes.end()) {
|
||||
OPENAUTO_LOG(error) << "[InputService] binding request, scan code: " << request.keycodes(i)
|
||||
<< " is not supported.";
|
||||
|
||||
status = aap_protobuf::shared::MessageStatus::STATUS_UNSOLICITED_MESSAGE;
|
||||
OPENAUTO_LOG(error) << "[InputSourceService] onKeyBindingRequest is not supported for KeyCode: " << request.keycodes(i);
|
||||
status = aap_protobuf::shared::MessageStatus::STATUS_KEYCODE_NOT_BOUND;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
aap_protobuf::service::media::sink::message::BindingResponse response;
|
||||
aap_protobuf::service::media::sink::message::KeyBindingResponse response;
|
||||
response.set_status(status);
|
||||
|
||||
if (status == aap_protobuf::shared::MessageStatus::STATUS_SUCCESS) {
|
||||
inputDevice_->start(*this);
|
||||
}
|
||||
|
||||
OPENAUTO_LOG(info) << "[InputService] binding request, status: " << status;
|
||||
OPENAUTO_LOG(info) << "[InputSourceService] Sending KeyBindingResponse with Status: " << status;
|
||||
|
||||
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
||||
promise->then([]() {},
|
||||
std::bind(&InputSourceService::onChannelError, this->shared_from_this(), std::placeholders::_1));
|
||||
channel_->sendBindingResponse(response, std::move(promise));
|
||||
channel_->sendKeyBindingResponse(response, std::move(promise));
|
||||
channel_->receive(this->shared_from_this());
|
||||
}
|
||||
|
||||
void InputSourceService::onChannelError(const aasdk::error::Error &e) {
|
||||
OPENAUTO_LOG(error) << "[InputSourceService] channel error: " << e.what();
|
||||
OPENAUTO_LOG(error) << "[InputSourceService] onChannelError(): " << e.what();
|
||||
}
|
||||
|
||||
void InputSourceService::onButtonEvent(const projection::ButtonEvent &event) {
|
||||
OPENAUTO_LOG(error) << "[InputSourceService] onButtonEvent()";
|
||||
auto timestamp = std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::high_resolution_clock::now().time_since_epoch());
|
||||
|
||||
strand_.dispatch(
|
||||
[this, self = this->shared_from_this(), event = std::move(event), timestamp = std::move(timestamp)]() {
|
||||
aap_protobuf::service::input::message::InputEventIndication inputEventIndication;
|
||||
inputEventIndication.set_timestamp(timestamp.count());
|
||||
aap_protobuf::service::input::message::InputReport inputReport;
|
||||
inputReport.set_timestamp(timestamp.count());
|
||||
|
||||
if (event.code == aap_protobuf::service::media::sink::KeyCode::KEYCODE_ROTARY_CONTROLLER) {
|
||||
auto relativeEvent = inputEventIndication.mutable_relative_input_event()->add_relative_input_events();
|
||||
auto relativeEvent = inputReport.mutable_relative_event()->add_data();
|
||||
relativeEvent->set_delta(event.wheelDirection == projection::WheelDirection::LEFT ? -1 : 1);
|
||||
relativeEvent->set_scan_code(event.code);
|
||||
relativeEvent->set_keycode(event.code);
|
||||
} else {
|
||||
auto buttonEvent = inputEventIndication.mutable_button_event()->add_keys();
|
||||
auto buttonEvent = inputReport.mutable_key_event()->add_keys();
|
||||
buttonEvent->set_metastate(0);
|
||||
buttonEvent->set_down(event.type == projection::ButtonEventType::PRESS);
|
||||
buttonEvent->set_longpress(false);
|
||||
@ -160,22 +161,23 @@ namespace f1x {
|
||||
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
||||
promise->then([]() {}, std::bind(&InputSourceService::onChannelError, this->shared_from_this(),
|
||||
std::placeholders::_1));
|
||||
channel_->sendInputEventIndication(inputEventIndication, std::move(promise));
|
||||
channel_->sendInputReport(inputReport, std::move(promise));
|
||||
});
|
||||
}
|
||||
|
||||
void InputSourceService::onTouchEvent(const projection::TouchEvent &event) {
|
||||
OPENAUTO_LOG(error) << "[InputSourceService] onTouchEvent()";
|
||||
auto timestamp = std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::high_resolution_clock::now().time_since_epoch());
|
||||
|
||||
strand_.dispatch(
|
||||
[this, self = this->shared_from_this(), event = std::move(event), timestamp = std::move(timestamp)]() {
|
||||
aap_protobuf::service::input::message::InputEventIndication inputEventIndication;
|
||||
inputEventIndication.set_timestamp(timestamp.count());
|
||||
aap_protobuf::service::input::message::InputReport inputReport;
|
||||
inputReport.set_timestamp(timestamp.count());
|
||||
|
||||
auto touchEvent = inputEventIndication.mutable_touch_event();
|
||||
touchEvent->set_touch_action(event.type);
|
||||
auto touchLocation = touchEvent->add_touch_location();
|
||||
auto touchEvent = inputReport.mutable_touch_event();
|
||||
touchEvent->set_action(event.type);
|
||||
auto touchLocation = touchEvent->add_pointer_data();
|
||||
touchLocation->set_x(event.x);
|
||||
touchLocation->set_y(event.y);
|
||||
touchLocation->set_pointer_id(0);
|
||||
@ -183,12 +185,9 @@ namespace f1x {
|
||||
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
||||
promise->then([]() {}, std::bind(&InputSourceService::onChannelError, this->shared_from_this(),
|
||||
std::placeholders::_1));
|
||||
channel_->sendInputEventIndication(inputEventIndication, std::move(promise));
|
||||
channel_->sendInputReport(inputReport, std::move(promise));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,40 +37,56 @@ namespace f1x {
|
||||
|
||||
void MediaBrowserService::start() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[MediaBrowserService] start.";
|
||||
OPENAUTO_LOG(info) << "[MediaBrowserService] start()";
|
||||
});
|
||||
}
|
||||
|
||||
void MediaBrowserService::stop() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[MediaBrowserService] stop.";
|
||||
OPENAUTO_LOG(info) << "[MediaBrowserService] stop()";
|
||||
});
|
||||
}
|
||||
|
||||
void MediaBrowserService::pause() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[MediaBrowserService] pause.";
|
||||
OPENAUTO_LOG(info) << "[MediaBrowserService] pause()";
|
||||
});
|
||||
}
|
||||
|
||||
void MediaBrowserService::resume() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[MediaBrowserService] resume.";
|
||||
OPENAUTO_LOG(info) << "[MediaBrowserService] resume()";
|
||||
});
|
||||
}
|
||||
|
||||
void MediaBrowserService::fillFeatures(
|
||||
aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) {
|
||||
OPENAUTO_LOG(info) << "[MediaBrowserService] fill features.";
|
||||
OPENAUTO_LOG(info) << "[MediaBrowserService] fillFeatures()";
|
||||
|
||||
auto *channelDescriptor = response.add_channels();
|
||||
channelDescriptor->set_channel_id(static_cast<uint32_t>(channel_->getId()));
|
||||
auto *service = response.add_channels();
|
||||
service->set_id(static_cast<uint32_t>(channel_->getId()));
|
||||
|
||||
auto *vendorExtension = channelDescriptor->mutable_wifi_projection_service();
|
||||
auto *mediaBrowser = service->mutable_media_browser_service();
|
||||
}
|
||||
|
||||
void MediaBrowserService::onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) {
|
||||
OPENAUTO_LOG(info) << "[MediaBrowserService] onChannelOpenRequest()";
|
||||
OPENAUTO_LOG(info) << "[MediaBrowserService] Channel Id: " << request.service_id() << ", Priority: " << request.priority();
|
||||
|
||||
aap_protobuf::channel::ChannelOpenResponse response;
|
||||
const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS;
|
||||
response.set_status(status);
|
||||
|
||||
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
||||
promise->then([]() {}, std::bind(&MediaBrowserService::onChannelError, this->shared_from_this(),
|
||||
std::placeholders::_1));
|
||||
channel_->sendChannelOpenResponse(response, std::move(promise));
|
||||
|
||||
channel_->receive(this->shared_from_this());
|
||||
}
|
||||
|
||||
void MediaBrowserService::onChannelError(const aasdk::error::Error &e) {
|
||||
OPENAUTO_LOG(error) << "[MediaBrowserService] channel error: " << e.what();
|
||||
OPENAUTO_LOG(error) << "[MediaBrowserService] onChannelError(): " << e.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,40 +37,57 @@ namespace f1x {
|
||||
|
||||
void MediaPlaybackStatusService::start() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[MediaPlaybackStatusService] start.";
|
||||
OPENAUTO_LOG(info) << "[MediaPlaybackStatusService] start()";
|
||||
});
|
||||
}
|
||||
|
||||
void MediaPlaybackStatusService::stop() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[MediaPlaybackStatusService] stop.";
|
||||
OPENAUTO_LOG(info) << "[MediaPlaybackStatusService] stop()";
|
||||
});
|
||||
}
|
||||
|
||||
void MediaPlaybackStatusService::pause() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[MediaPlaybackStatusService] pause.";
|
||||
OPENAUTO_LOG(info) << "[MediaPlaybackStatusService] pause()";
|
||||
});
|
||||
}
|
||||
|
||||
void MediaPlaybackStatusService::resume() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[MediaPlaybackStatusService] resume.";
|
||||
OPENAUTO_LOG(info) << "[MediaPlaybackStatusService] resume()";
|
||||
});
|
||||
}
|
||||
|
||||
void MediaPlaybackStatusService::fillFeatures(
|
||||
aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) {
|
||||
OPENAUTO_LOG(info) << "[MediaPlaybackStatusService] fill features.";
|
||||
OPENAUTO_LOG(info) << "[MediaPlaybackStatusService] fillFeatures()";
|
||||
|
||||
auto *channelDescriptor = response.add_channels();
|
||||
channelDescriptor->set_channel_id(static_cast<uint32_t>(channel_->getId()));
|
||||
auto *service = response.add_channels();
|
||||
service->set_id(static_cast<uint32_t>(channel_->getId()));
|
||||
|
||||
auto *vendorExtension = channelDescriptor->mutable_wifi_projection_service();
|
||||
auto *mediaPlaybackStatus = service->mutable_media_playback_service();
|
||||
}
|
||||
|
||||
void MediaPlaybackStatusService::onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) {
|
||||
OPENAUTO_LOG(info) << "[MediaPlaybackStatusService] onChannelOpenRequest()";
|
||||
OPENAUTO_LOG(info) << "[MediaPlaybackStatusService] Channel Id: " << request.service_id() << ", Priority: " << request.priority();
|
||||
|
||||
aap_protobuf::channel::ChannelOpenResponse response;
|
||||
const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS;
|
||||
response.set_status(status);
|
||||
|
||||
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
||||
promise->then([]() {}, std::bind(&MediaPlaybackStatusService::onChannelError, this->shared_from_this(),
|
||||
std::placeholders::_1));
|
||||
channel_->sendChannelOpenResponse(response, std::move(promise));
|
||||
|
||||
channel_->receive(this->shared_from_this());
|
||||
}
|
||||
|
||||
|
||||
void MediaPlaybackStatusService::onChannelError(const aasdk::error::Error &e) {
|
||||
OPENAUTO_LOG(error) << "[MediaPlaybackStatusService] channel error: " << e.what();
|
||||
OPENAUTO_LOG(error) << "[MediaPlaybackStatusService] onChannelError(): " << e.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,29 +34,33 @@ namespace f1x {
|
||||
|
||||
void AudioMediaSinkService::start() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[MediaSinkService] start, channel: "
|
||||
<< aasdk::messenger::channelIdToString(channel_->getId());
|
||||
OPENAUTO_LOG(info) << "[AudioMediaSinkService] start()";
|
||||
OPENAUTO_LOG(info) << "[AudioMediaSinkService] Channel " << aasdk::messenger::channelIdToString(channel_->getId());
|
||||
channel_->receive(this->shared_from_this());
|
||||
});
|
||||
}
|
||||
|
||||
void AudioMediaSinkService::stop() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[MediaSinkService] stop, channel: "
|
||||
<< aasdk::messenger::channelIdToString(channel_->getId());
|
||||
OPENAUTO_LOG(info) << "[AudioMediaSinkService] stop()";
|
||||
OPENAUTO_LOG(info) << "[AudioMediaSinkService] Channel " << aasdk::messenger::channelIdToString(channel_->getId());
|
||||
audioOutput_->stop();
|
||||
});
|
||||
}
|
||||
|
||||
void AudioMediaSinkService::pause() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[MediaSinkService] pause.";
|
||||
OPENAUTO_LOG(info) << "[AudioMediaSinkService] pause()";
|
||||
OPENAUTO_LOG(info) << "[AudioMediaSinkService] Channel " << aasdk::messenger::channelIdToString(channel_->getId());
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
void AudioMediaSinkService::resume() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[MediaSinkService] resume.";
|
||||
OPENAUTO_LOG(info) << "[AudioMediaSinkService] resume()";
|
||||
OPENAUTO_LOG(info) << "[AudioMediaSinkService] Channel " << aasdk::messenger::channelIdToString(channel_->getId());
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@ -66,37 +70,42 @@ namespace f1x {
|
||||
|
||||
void AudioMediaSinkService::fillFeatures(
|
||||
aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) {
|
||||
OPENAUTO_LOG(info) << "[MediaSinkService] fill features, channel: "
|
||||
<< aasdk::messenger::channelIdToString(channel_->getId());
|
||||
OPENAUTO_LOG(info) << "[AudioMediaSinkService] fillFeatures()";
|
||||
OPENAUTO_LOG(info) << "[AudioMediaSinkService] Channel: " << aasdk::messenger::channelIdToString(channel_->getId());
|
||||
|
||||
auto *channelDescriptor = response.add_channels();
|
||||
channelDescriptor->set_channel_id(static_cast<uint32_t>(channel_->getId()));
|
||||
auto *service = response.add_channels();
|
||||
service->set_id(static_cast<uint32_t>(channel_->getId()));
|
||||
|
||||
auto audioChannel = channelDescriptor->mutable_media_sink_service();
|
||||
auto audioChannel = service->mutable_media_sink_service();
|
||||
|
||||
audioChannel->set_stream_type(
|
||||
aap_protobuf::service::media::shared::message::MediaCodecType::MEDIA_CODEC_AUDIO_PCM);
|
||||
|
||||
switch (channel_->getId()) {
|
||||
case aasdk::messenger::ChannelId::MEDIA_SINK_SYSTEM_AUDIO:
|
||||
OPENAUTO_LOG(info) << "[AudioMediaSinkService] System Audio.";
|
||||
audioChannel->set_audio_type(
|
||||
aap_protobuf::service::media::sink::AudioStreamType::AUDIO_STREAM_SYSTEM_AUDIO);
|
||||
break;
|
||||
|
||||
case aasdk::messenger::ChannelId::MEDIA_SINK_MEDIA_AUDIO:
|
||||
OPENAUTO_LOG(info) << "[AudioMediaSinkService] Music Audio.";
|
||||
audioChannel->set_audio_type(aap_protobuf::service::media::sink::AudioStreamType::AUDIO_STREAM_MEDIA);
|
||||
break;
|
||||
|
||||
case aasdk::messenger::ChannelId::MEDIA_SINK_GUIDANCE_AUDIO:
|
||||
OPENAUTO_LOG(info) << "[AudioMediaSinkService] Guidance Audio.";
|
||||
audioChannel->set_audio_type(
|
||||
aap_protobuf::service::media::sink::AudioStreamType::AUDIO_STREAM_GUIDANCE);
|
||||
break;
|
||||
|
||||
case aasdk::messenger::ChannelId::MEDIA_SINK_TELEPHONY_AUDIO:
|
||||
OPENAUTO_LOG(info) << "[AudioMediaSinkService] Telephony Audio.";
|
||||
audioChannel->set_audio_type(
|
||||
aap_protobuf::service::media::sink::AudioStreamType::AUDIO_STREAM_TELEPHONY);
|
||||
break;
|
||||
default:
|
||||
OPENAUTO_LOG(info) << "[AudioMediaSinkService] Unknown Audio.";
|
||||
break;
|
||||
}
|
||||
|
||||
@ -113,18 +122,16 @@ namespace f1x {
|
||||
*/
|
||||
|
||||
void AudioMediaSinkService::onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) {
|
||||
OPENAUTO_LOG(info) << "[MediaSinkService] Channel Open Request with priority " << request.priority()
|
||||
<< " on channel " << aasdk::messenger::channelIdToString(channel_->getId());
|
||||
OPENAUTO_LOG(info) << "[AudioMediaSinkService] onChannelOpenRequest()";
|
||||
OPENAUTO_LOG(info) << "[AudioMediaSinkService] Channel Id: " << request.service_id() << ", Priority: " << request.priority();
|
||||
|
||||
OPENAUTO_LOG(debug) << "[AudioMediaSinkService] Sample Rate: " << audioOutput_->getSampleRate()
|
||||
<< ", Sample Size: " << audioOutput_->getSampleSize()
|
||||
<< ", Channels: " << audioOutput_->getChannelCount();
|
||||
OPENAUTO_LOG(debug) << "[AudioMediaSinkService] Sample Rate: " << audioOutput_->getSampleRate() << ", Sample Size: " << audioOutput_->getSampleSize() << ", Audio Channels: " << audioOutput_->getChannelCount();
|
||||
|
||||
const aap_protobuf::shared::MessageStatus status = audioOutput_->open()
|
||||
? aap_protobuf::shared::MessageStatus::STATUS_SUCCESS
|
||||
: aap_protobuf::shared::MessageStatus::STATUS_INTERNAL_ERROR;
|
||||
|
||||
OPENAUTO_LOG(info) << "[MediaSinkService] open status: " << status;
|
||||
OPENAUTO_LOG(info) << "[AudioMediaSinkService] Status determined: " << aap_protobuf::shared::MessageStatus_Name(status);
|
||||
|
||||
aap_protobuf::channel::ChannelOpenResponse response;
|
||||
response.set_status(status);
|
||||
@ -137,7 +144,7 @@ namespace f1x {
|
||||
}
|
||||
|
||||
void AudioMediaSinkService::onChannelError(const aasdk::error::Error &e) {
|
||||
OPENAUTO_LOG(error) << "[MediaSinkService] channel error: " << e.what()
|
||||
OPENAUTO_LOG(error) << "[AudioMediaSinkService] onChannelError(): " << e.what()
|
||||
<< ", channel: " << aasdk::messenger::channelIdToString(channel_->getId());
|
||||
}
|
||||
|
||||
@ -146,16 +153,11 @@ namespace f1x {
|
||||
*/
|
||||
|
||||
void AudioMediaSinkService::onMediaChannelSetupRequest(const aap_protobuf::channel::media::event::Setup &request) {
|
||||
|
||||
OPENAUTO_LOG(info) << "[MediaSinkService] setup request"
|
||||
<< ", channel: " << aasdk::messenger::channelIdToString(channel_->getId())
|
||||
<< ", codec type: " << MediaCodecType_Name(request.type());
|
||||
|
||||
auto status = aap_protobuf::service::media::sink::MediaSinkChannelSetupStatus::STATUS_READY;
|
||||
|
||||
OPENAUTO_LOG(info) << "[MediaSinkService] setup status: " << status;
|
||||
OPENAUTO_LOG(info) << "[AudioMediaSinkService] onMediaChannelSetupRequest()";
|
||||
OPENAUTO_LOG(info) << "[AudioMediaSinkService] Channel Id: " << aasdk::messenger::channelIdToString(channel_->getId()) << ", Codec: " << MediaCodecType_Name(request.type());
|
||||
|
||||
aap_protobuf::service::media::sink::message::MediaSinkChannelSetupResponse response;
|
||||
auto status = aap_protobuf::service::media::sink::MediaSinkChannelSetupStatus::STATUS_READY;
|
||||
response.set_media_status(status);
|
||||
response.set_max_unacked(1);
|
||||
response.add_configuration_indices(0);
|
||||
@ -170,18 +172,16 @@ namespace f1x {
|
||||
|
||||
|
||||
void AudioMediaSinkService::onMediaChannelStartIndication(const aap_protobuf::channel::media::event::Start &indication) {
|
||||
OPENAUTO_LOG(info) << "[MediaSinkService] start indication"
|
||||
<< ", channel: " << aasdk::messenger::channelIdToString(channel_->getId())
|
||||
<< ", session: " << indication.session_id();
|
||||
OPENAUTO_LOG(info) << "[AudioMediaSinkService] onMediaChannelStartIndication()";
|
||||
OPENAUTO_LOG(info) << "[AudioMediaSinkService] Channel Id: " << aasdk::messenger::channelIdToString(channel_->getId()) << ", session: " << indication.session_id();
|
||||
session_ = indication.session_id();
|
||||
audioOutput_->start();
|
||||
channel_->receive(this->shared_from_this());
|
||||
}
|
||||
|
||||
void AudioMediaSinkService::onMediaChannelStopIndication(const aap_protobuf::channel::media::event::Stop &indication) {
|
||||
OPENAUTO_LOG(info) << "[MediaSinkService] stop indication"
|
||||
<< ", channel: " << aasdk::messenger::channelIdToString(channel_->getId())
|
||||
<< ", session: " << session_;
|
||||
OPENAUTO_LOG(info) << "[AudioMediaSinkService] onMediaChannelStopIndication()";
|
||||
OPENAUTO_LOG(info) << "[AudioMediaSinkService] Channel Id: " << aasdk::messenger::channelIdToString(channel_->getId()) << ", session: " << session_;
|
||||
|
||||
session_ = -1;
|
||||
audioOutput_->suspend();
|
||||
@ -191,6 +191,9 @@ namespace f1x {
|
||||
|
||||
void AudioMediaSinkService::onMediaWithTimestampIndication(aasdk::messenger::Timestamp::ValueType timestamp,
|
||||
const aasdk::common::DataConstBuffer &buffer) {
|
||||
OPENAUTO_LOG(info) << "[AudioMediaSinkService] onMediaWithTimestampIndication()";
|
||||
OPENAUTO_LOG(info) << "[AudioMediaSinkService] Channel Id: " << aasdk::messenger::channelIdToString(channel_->getId()) << ", session: " << session_;
|
||||
|
||||
audioOutput_->write(timestamp, buffer);
|
||||
|
||||
// TODO: Move MediaSourceMediaAckIndication to Ack and move to Shared.
|
||||
@ -206,6 +209,8 @@ namespace f1x {
|
||||
}
|
||||
|
||||
void AudioMediaSinkService::onMediaIndication(const aasdk::common::DataConstBuffer &buffer) {
|
||||
OPENAUTO_LOG(info) << "[AudioMediaSinkService] onMediaIndication()";
|
||||
|
||||
this->onMediaWithTimestampIndication(0, buffer);
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
* along with openauto. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <aasdk/Channel/MediaSink/MediaSinkService.hpp>
|
||||
#include <aasdk/Channel/MediaSink/Audio/Channel/SystemAudioChannel.hpp>
|
||||
#include <f1x/openauto/autoapp/Service/MediaSink/SystemAudioService.hpp>
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
* along with openauto. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <aasdk/Channel/MediaSink/MediaSinkService.hpp>
|
||||
#include <aasdk/Channel/MediaSink/Audio/Channel/TelephonyAudioChannel.hpp>
|
||||
#include <f1x/openauto/autoapp/Service/MediaSink/TelephonyAudioService.hpp>
|
||||
|
||||
|
@ -33,7 +33,8 @@ namespace f1x {
|
||||
|
||||
void VideoMediaSinkService::start() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[MediaSinkService] start, channel: "
|
||||
OPENAUTO_LOG(info) << "[VideoMediaSinkService] start()";
|
||||
OPENAUTO_LOG(info) << "[VideoMediaSinkService] Channel "
|
||||
<< aasdk::messenger::channelIdToString(channel_->getId());
|
||||
channel_->receive(this->shared_from_this());
|
||||
});
|
||||
@ -41,32 +42,39 @@ namespace f1x {
|
||||
|
||||
void VideoMediaSinkService::stop() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[MediaSinkService] stop, channel: "
|
||||
OPENAUTO_LOG(info) << "[VideoMediaSinkService] stop()";
|
||||
OPENAUTO_LOG(info) << "[VideoMediaSinkService] Channel "
|
||||
<< aasdk::messenger::channelIdToString(channel_->getId());
|
||||
});
|
||||
}
|
||||
|
||||
void VideoMediaSinkService::pause() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[MediaSinkService] pause.";
|
||||
OPENAUTO_LOG(info) << "[VideoMediaSinkService] pause()";
|
||||
OPENAUTO_LOG(info) << "[VideoMediaSinkService] Channel "
|
||||
<< aasdk::messenger::channelIdToString(channel_->getId());
|
||||
});
|
||||
}
|
||||
|
||||
void VideoMediaSinkService::resume() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[MediaSinkService] resume.";
|
||||
OPENAUTO_LOG(info) << "[VideoMediaSinkService] resume()";
|
||||
OPENAUTO_LOG(info) << "[VideoMediaSinkService] Channel "
|
||||
<< aasdk::messenger::channelIdToString(channel_->getId());
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
void VideoMediaSinkService::fillFeatures(
|
||||
aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) {
|
||||
OPENAUTO_LOG(info) << "[MediaSinkService] fill features, channel: "
|
||||
OPENAUTO_LOG(info) << "[VideoMediaSinkService] fillFeatures()";
|
||||
OPENAUTO_LOG(info) << "[VideoMediaSinkService] Channel "
|
||||
<< aasdk::messenger::channelIdToString(channel_->getId());
|
||||
|
||||
auto *channelDescriptor = response.add_channels();
|
||||
channelDescriptor->set_channel_id(static_cast<uint32_t>(channel_->getId()));
|
||||
auto *service = response.add_channels();
|
||||
service->set_id(static_cast<uint32_t>(channel_->getId()));
|
||||
|
||||
auto *videoChannel = channelDescriptor->mutable_media_sink_service();
|
||||
auto *videoChannel = service->mutable_media_sink_service();
|
||||
videoChannel->set_stream_type(
|
||||
aap_protobuf::service::media::shared::message::MediaCodecType::MEDIA_CODEC_VIDEO_H264_BP);
|
||||
videoChannel->set_available_while_in_call(true);
|
||||
@ -82,16 +90,19 @@ namespace f1x {
|
||||
|
||||
}
|
||||
|
||||
void VideoMediaSinkService::onMediaChannelSetupRequest(const aap_protobuf::channel::media::event::Setup &request) {
|
||||
void
|
||||
VideoMediaSinkService::onMediaChannelSetupRequest(const aap_protobuf::channel::media::event::Setup &request) {
|
||||
OPENAUTO_LOG(info) << "[VideoMediaSinkService] onMediaChannelSetupRequest()";
|
||||
OPENAUTO_LOG(info) << "[VideoMediaSinkService] Channel Id: "
|
||||
<< aasdk::messenger::channelIdToString(channel_->getId()) << ", Codec: "
|
||||
<< MediaCodecType_Name(request.type());
|
||||
|
||||
OPENAUTO_LOG(info) << "[MediaSinkService] setup request"
|
||||
<< ", channel: " << aasdk::messenger::channelIdToString(channel_->getId())
|
||||
<< ", codec type: " << MediaCodecType_Name(request.type());
|
||||
|
||||
auto status = videoOutput_->init() ? aap_protobuf::service::media::sink::MediaSinkChannelSetupStatus::STATUS_READY
|
||||
: aap_protobuf::service::media::sink::MediaSinkChannelSetupStatus::STATUS_WAIT;
|
||||
auto status = videoOutput_->init()
|
||||
? aap_protobuf::service::media::sink::MediaSinkChannelSetupStatus::STATUS_READY
|
||||
: aap_protobuf::service::media::sink::MediaSinkChannelSetupStatus::STATUS_WAIT;
|
||||
|
||||
OPENAUTO_LOG(info) << "[MediaSinkService] setup status: " << status;
|
||||
OPENAUTO_LOG(info) << "[VideoMediaSinkService] setup status: " << status;
|
||||
|
||||
aap_protobuf::service::media::sink::message::MediaSinkChannelSetupResponse response;
|
||||
response.set_media_status(status);
|
||||
@ -100,21 +111,24 @@ namespace f1x {
|
||||
|
||||
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
||||
promise->then(std::bind(&VideoMediaSinkService::sendVideoFocusIndication, this->shared_from_this()),
|
||||
std::bind(&VideoMediaSinkService::onChannelError, this->shared_from_this(), std::placeholders::_1));
|
||||
std::bind(&VideoMediaSinkService::onChannelError, this->shared_from_this(),
|
||||
std::placeholders::_1));
|
||||
|
||||
channel_->sendChannelSetupResponse(response, std::move(promise));
|
||||
channel_->receive(this->shared_from_this());
|
||||
}
|
||||
|
||||
void VideoMediaSinkService::onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) {
|
||||
OPENAUTO_LOG(info) << "[MediaSinkService] Channel Open Request with priority " << request.priority()
|
||||
<< " on channel " << aasdk::messenger::channelIdToString(channel_->getId());
|
||||
OPENAUTO_LOG(info) << "[VideoMediaSinkService] onChannelOpenRequest()";
|
||||
OPENAUTO_LOG(info) << "[VideoMediaSinkService] Channel Id: " << request.service_id() << ", Priority: "
|
||||
<< request.priority();
|
||||
|
||||
const aap_protobuf::shared::MessageStatus status = videoOutput_->open()
|
||||
? aap_protobuf::shared::MessageStatus::STATUS_SUCCESS
|
||||
: aap_protobuf::shared::MessageStatus::STATUS_INTERNAL_ERROR;
|
||||
|
||||
OPENAUTO_LOG(info) << "[MediaSinkService] open status: " << status;
|
||||
OPENAUTO_LOG(info) << "[VideoMediaSinkService] Status determined: "
|
||||
<< aap_protobuf::shared::MessageStatus_Name(status);
|
||||
|
||||
aap_protobuf::channel::ChannelOpenResponse response;
|
||||
response.set_status(status);
|
||||
@ -126,24 +140,32 @@ namespace f1x {
|
||||
channel_->receive(this->shared_from_this());
|
||||
}
|
||||
|
||||
void VideoMediaSinkService::onMediaChannelStartIndication(const aap_protobuf::channel::media::event::Start &indication) {
|
||||
OPENAUTO_LOG(info) << "[MediaSinkService] start indication"
|
||||
<< ", channel: " << aasdk::messenger::channelIdToString(channel_->getId())
|
||||
<< ", session: " << indication.session_id();
|
||||
void VideoMediaSinkService::onMediaChannelStartIndication(
|
||||
const aap_protobuf::channel::media::event::Start &indication) {
|
||||
OPENAUTO_LOG(info) << "[VideoMediaSinkService] onMediaChannelStartIndication()";
|
||||
OPENAUTO_LOG(info) << "[VideoMediaSinkService] Channel Id: "
|
||||
<< aasdk::messenger::channelIdToString(channel_->getId()) << ", session: "
|
||||
<< indication.session_id();
|
||||
|
||||
session_ = indication.session_id();
|
||||
channel_->receive(this->shared_from_this());
|
||||
}
|
||||
|
||||
void VideoMediaSinkService::onMediaChannelStopIndication(const aap_protobuf::channel::media::event::Stop &indication) {
|
||||
OPENAUTO_LOG(info) << "[MediaSinkService] stop indication"
|
||||
<< ", channel: " << aasdk::messenger::channelIdToString(channel_->getId())
|
||||
<< ", session: " << session_;
|
||||
void VideoMediaSinkService::onMediaChannelStopIndication(
|
||||
const aap_protobuf::channel::media::event::Stop &indication) {
|
||||
OPENAUTO_LOG(info) << "[onMediaChannelStopIndication] onMediaChannelStopIndication()";
|
||||
OPENAUTO_LOG(info) << "[onMediaChannelStopIndication] Channel Id: "
|
||||
<< aasdk::messenger::channelIdToString(channel_->getId()) << ", session: " << session_;
|
||||
|
||||
channel_->receive(this->shared_from_this());
|
||||
}
|
||||
|
||||
void VideoMediaSinkService::onMediaWithTimestampIndication(aasdk::messenger::Timestamp::ValueType timestamp,
|
||||
const aasdk::common::DataConstBuffer &buffer) {
|
||||
const aasdk::common::DataConstBuffer &buffer) {
|
||||
OPENAUTO_LOG(info) << "[VideoMediaSinkService] onMediaWithTimestampIndication()";
|
||||
OPENAUTO_LOG(info) << "[VideoMediaSinkService] Channel Id: "
|
||||
<< aasdk::messenger::channelIdToString(channel_->getId()) << ", session: " << session_;
|
||||
|
||||
videoOutput_->write(timestamp, buffer);
|
||||
|
||||
aap_protobuf::service::media::source::message::MediaSourceMediaAckIndication indication;
|
||||
@ -158,31 +180,30 @@ namespace f1x {
|
||||
}
|
||||
|
||||
void VideoMediaSinkService::onMediaIndication(const aasdk::common::DataConstBuffer &buffer) {
|
||||
OPENAUTO_LOG(info) << "[VideoMediaSinkService] onMediaIndication()";
|
||||
this->onMediaWithTimestampIndication(0, buffer);
|
||||
}
|
||||
|
||||
void VideoMediaSinkService::onChannelError(const aasdk::error::Error &e) {
|
||||
OPENAUTO_LOG(error) << "[MediaSinkService] channel error: " << e.what()
|
||||
OPENAUTO_LOG(error) << "[VideoMediaSinkService] onChannelError(): " << e.what()
|
||||
<< ", channel: " << aasdk::messenger::channelIdToString(channel_->getId());
|
||||
}
|
||||
|
||||
|
||||
|
||||
void VideoMediaSinkService::onVideoFocusRequest(
|
||||
const aap_protobuf::channel::control::focus::video::event::VideoFocusRequestNotification &request) {
|
||||
OPENAUTO_LOG(info) << "[VideoMediaSinkService] video focus request, display index: " << request.disp_channel_id()
|
||||
<< ", focus mode: " << VideoFocusMode_Name(request.mode())
|
||||
<< ", focus reason: " << VideoFocusReason_Name(request.reason());
|
||||
// package aap_protobuf.channel.control.focus.video.shared;
|
||||
// stop video service on go back to openauto
|
||||
if (request.mode() == aap_protobuf::channel::control::focus::video::shared::VideoFocusMode::VIDEO_FOCUS_NATIVE) {
|
||||
OPENAUTO_LOG(info) << "[VideoMediaSinkService] Back to CSNG...";
|
||||
OPENAUTO_LOG(info) << "[VideoMediaSinkService] onMediaIndication()";
|
||||
OPENAUTO_LOG(info) << "[VideoMediaSinkService] Display index: " << request.disp_channel_id() << ", focus mode: " << VideoFocusMode_Name(request.mode()) << ", focus reason: " << VideoFocusReason_Name(request.reason());
|
||||
|
||||
if (request.mode() ==
|
||||
aap_protobuf::channel::control::focus::video::shared::VideoFocusMode::VIDEO_FOCUS_NATIVE) {
|
||||
// Return to OS
|
||||
OPENAUTO_LOG(info) << "[VideoMediaSinkService] Returning to OS.";
|
||||
try {
|
||||
if (!std::ifstream("/tmp/entityexit")) {
|
||||
std::ofstream("/tmp/entityexit");
|
||||
}
|
||||
} catch (...) {
|
||||
OPENAUTO_LOG(error) << "[VideoMediaSinkService] Error in creating entityexit";
|
||||
OPENAUTO_LOG(error) << "[VideoMediaSinkService] Error in creating /tmp/entityexit";
|
||||
}
|
||||
}
|
||||
|
||||
@ -191,14 +212,16 @@ namespace f1x {
|
||||
}
|
||||
|
||||
void VideoMediaSinkService::sendVideoFocusIndication() {
|
||||
OPENAUTO_LOG(info) << "[VideoMediaSinkService] video focus indication.";
|
||||
OPENAUTO_LOG(info) << "[VideoMediaSinkService] sendVideoFocusIndication()";
|
||||
|
||||
aap_protobuf::channel::control::focus::video::notification::VideoFocusNotification videoFocusIndication;
|
||||
videoFocusIndication.set_focus(aap_protobuf::channel::control::focus::video::shared::VideoFocusMode::VIDEO_FOCUS_PROJECTED);
|
||||
videoFocusIndication.set_focus(
|
||||
aap_protobuf::channel::control::focus::video::shared::VideoFocusMode::VIDEO_FOCUS_PROJECTED);
|
||||
videoFocusIndication.set_unsolicited(false);
|
||||
|
||||
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
||||
promise->then([]() {}, std::bind(&VideoMediaSinkService::onChannelError, this->shared_from_this(), std::placeholders::_1));
|
||||
promise->then([]() {}, std::bind(&VideoMediaSinkService::onChannelError, this->shared_from_this(),
|
||||
std::placeholders::_1));
|
||||
channel_->sendVideoFocusIndication(videoFocusIndication, std::move(promise));
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,6 @@
|
||||
* along with openauto. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <aasdk/Channel/MediaSink/MediaSinkService.hpp>
|
||||
#include <aasdk/Channel/MediaSink/Video/Channel/VideoChannel.hpp>
|
||||
#include <f1x/openauto/autoapp/Service/MediaSink/VideoService.hpp>
|
||||
|
||||
|
@ -36,27 +36,27 @@ namespace f1x {
|
||||
|
||||
void MediaSourceService::start() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[AudioInputService] start.";
|
||||
OPENAUTO_LOG(info) << "[MediaSourceService] start()";
|
||||
channel_->receive(this->shared_from_this());
|
||||
});
|
||||
}
|
||||
|
||||
void MediaSourceService::stop() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[AudioInputService] stop.";
|
||||
OPENAUTO_LOG(info) << "[MediaSourceService] stop()";
|
||||
audioInput_->stop();
|
||||
});
|
||||
}
|
||||
|
||||
void MediaSourceService::pause() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[AudioInputService] pause.";
|
||||
OPENAUTO_LOG(info) << "[MediaSourceService] pause()";
|
||||
});
|
||||
}
|
||||
|
||||
void MediaSourceService::resume() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[AudioInputService] resume.";
|
||||
OPENAUTO_LOG(info) << "[MediaSourceService] resume()";
|
||||
});
|
||||
}
|
||||
|
||||
@ -70,12 +70,12 @@ namespace f1x {
|
||||
*/
|
||||
void MediaSourceService::fillFeatures(
|
||||
aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) {
|
||||
OPENAUTO_LOG(info) << "[AudioInputService] fill features.";
|
||||
OPENAUTO_LOG(info) << "[MediaSourceService] fillFeatures()";
|
||||
|
||||
auto *channelDescriptor = response.add_channels();
|
||||
channelDescriptor->set_channel_id(static_cast<uint32_t>(channel_->getId()));
|
||||
auto *service = response.add_channels();
|
||||
service->set_id(static_cast<uint32_t>(channel_->getId()));
|
||||
|
||||
auto *avInputChannel = channelDescriptor->mutable_media_source_service();
|
||||
auto *avInputChannel = service->mutable_media_source_service();
|
||||
avInputChannel->set_stream_type(
|
||||
aap_protobuf::service::media::shared::message::MediaCodecType::MEDIA_CODEC_AUDIO_PCM);
|
||||
|
||||
@ -94,11 +94,14 @@ namespace f1x {
|
||||
* @param request
|
||||
*/
|
||||
void MediaSourceService::onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) {
|
||||
OPENAUTO_LOG(info) << "[AudioInputService] open request, priority: " << request.priority();
|
||||
OPENAUTO_LOG(info) << "[MediaSourceService] onChannelOpenRequest()";
|
||||
OPENAUTO_LOG(info) << "[MediaSourceService] Channel Id: " << request.service_id() << ", Priority: " << request.priority();
|
||||
|
||||
const aap_protobuf::shared::MessageStatus status = audioInput_->open()
|
||||
? aap_protobuf::shared::MessageStatus::STATUS_SUCCESS
|
||||
: aap_protobuf::shared::MessageStatus::STATUS_UNSOLICITED_MESSAGE;
|
||||
OPENAUTO_LOG(info) << "[AudioInputService] open status: " << status;
|
||||
: aap_protobuf::shared::MessageStatus::STATUS_INTERNAL_ERROR;
|
||||
|
||||
OPENAUTO_LOG(info) << "[MediaSourceService] Status determined: " << aap_protobuf::shared::MessageStatus_Name(status);
|
||||
|
||||
aap_protobuf::channel::ChannelOpenResponse response;
|
||||
response.set_status(status);
|
||||
@ -107,8 +110,8 @@ namespace f1x {
|
||||
promise->then([]() {},
|
||||
std::bind(&MediaSourceService::onChannelError, this->shared_from_this(),
|
||||
std::placeholders::_1));
|
||||
channel_->sendChannelOpenResponse(response, std::move(promise));
|
||||
|
||||
channel_->sendChannelOpenResponse(response, std::move(promise));
|
||||
channel_->receive(this->shared_from_this());
|
||||
}
|
||||
|
||||
@ -117,7 +120,7 @@ namespace f1x {
|
||||
* @param e
|
||||
*/
|
||||
void MediaSourceService::onChannelError(const aasdk::error::Error &e) {
|
||||
OPENAUTO_LOG(error) << "[AudioInputService] channel error: " << e.what();
|
||||
OPENAUTO_LOG(error) << "[MediaSourceService] onChannelError(): " << e.what();
|
||||
}
|
||||
|
||||
/*
|
||||
@ -131,15 +134,11 @@ namespace f1x {
|
||||
void
|
||||
MediaSourceService::onMediaChannelSetupRequest(const aap_protobuf::channel::media::event::Setup &request) {
|
||||
|
||||
OPENAUTO_LOG(info) << "[MediaSinkService] setup request"
|
||||
<< ", channel: " << aasdk::messenger::channelIdToString(channel_->getId())
|
||||
<< ", codec type: " << MediaCodecType_Name(request.type());
|
||||
|
||||
auto status = aap_protobuf::service::media::sink::MediaSinkChannelSetupStatus::STATUS_READY;
|
||||
|
||||
OPENAUTO_LOG(info) << "[MediaSinkService] setup status: " << status;
|
||||
OPENAUTO_LOG(info) << "[MediaSourceService] onMediaChannelSetupRequest()";
|
||||
OPENAUTO_LOG(info) << "[MediaSourceService] Channel Id: " << aasdk::messenger::channelIdToString(channel_->getId()) << ", Codec: " << MediaCodecType_Name(request.type());
|
||||
|
||||
aap_protobuf::service::media::sink::message::MediaSinkChannelSetupResponse response;
|
||||
auto status = aap_protobuf::service::media::sink::MediaSinkChannelSetupStatus::STATUS_READY;
|
||||
response.set_media_status(status);
|
||||
response.set_max_unacked(1);
|
||||
response.add_configuration_indices(0);
|
||||
@ -157,6 +156,7 @@ namespace f1x {
|
||||
*/
|
||||
void MediaSourceService::onMediaChannelAckIndication(
|
||||
const aap_protobuf::service::media::source::message::MediaSourceMediaAckIndication &) {
|
||||
OPENAUTO_LOG(info) << "[MediaSourceService] onMediaChannelAckIndication()";
|
||||
channel_->receive(this->shared_from_this());
|
||||
}
|
||||
|
||||
@ -167,25 +167,24 @@ namespace f1x {
|
||||
// TODO: These are Source Channel Handlers - should be moved to their own handlers in case any more are implemented in the future.
|
||||
|
||||
/**
|
||||
* Handle request to open Microphone Channel
|
||||
* Handle request to Open or Close Microphone Source Channel
|
||||
* @param request
|
||||
*/
|
||||
void MediaSourceService::onMediaSourceOpenRequest(
|
||||
const aap_protobuf::service::media::source::message::MicrophoneRequest &request) {
|
||||
OPENAUTO_LOG(info) << "[AudioInputService] input open request, open: " << request.open()
|
||||
<< ", anc: " << request.anc_enabled()
|
||||
<< ", ec: " << request.ec_enabled()
|
||||
<< ", max unacked: " << request.max_unacked();
|
||||
OPENAUTO_LOG(info) << "[MediaSourceService] onMediaChannelAckIndication()";
|
||||
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()) {
|
||||
// Request for Channel Open
|
||||
auto startPromise = projection::IAudioInput::StartPromise::defer(strand_);
|
||||
startPromise->then(std::bind(&MediaSourceService::onMediaSourceOpenSuccess, this->shared_from_this()),
|
||||
[this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(error) << "[AudioInputService] audio input open failed.";
|
||||
OPENAUTO_LOG(error) << "[MediaSourceService] Media Source Open Failed";
|
||||
|
||||
aap_protobuf::service::media::source::message::MicrophoneResponse response;
|
||||
response.set_session_id(session_);
|
||||
// TODO: Matches previous number, but doesn't seem like the right status.
|
||||
|
||||
response.set_status(aap_protobuf::shared::MessageStatus::STATUS_INTERNAL_ERROR);
|
||||
|
||||
auto sendPromise = aasdk::channel::SendPromise::defer(strand_);
|
||||
@ -198,11 +197,12 @@ namespace f1x {
|
||||
|
||||
audioInput_->start(std::move(startPromise));
|
||||
} else {
|
||||
// Request for Channel Close
|
||||
audioInput_->stop();
|
||||
|
||||
aap_protobuf::service::media::source::message::MicrophoneResponse response;
|
||||
response.set_session_id(session_);
|
||||
// TODO: Matches previous number, but doesn't seem like the right status.
|
||||
|
||||
response.set_status(aap_protobuf::shared::MessageStatus::STATUS_SUCCESS);
|
||||
|
||||
auto sendPromise = aasdk::channel::SendPromise::defer(strand_);
|
||||
@ -219,7 +219,7 @@ namespace f1x {
|
||||
* Sends response to advise Microphone is Open
|
||||
*/
|
||||
void MediaSourceService::onMediaSourceOpenSuccess() {
|
||||
OPENAUTO_LOG(info) << "[AudioInputService] audio input open succeed.";
|
||||
OPENAUTO_LOG(error) << "[MediaSourceService] onMediaSourceOpenSuccess()";
|
||||
|
||||
aap_protobuf::service::media::source::message::MicrophoneResponse response;
|
||||
response.set_session_id(session_);
|
||||
@ -239,6 +239,7 @@ namespace f1x {
|
||||
* @param data
|
||||
*/
|
||||
void MediaSourceService::onMediaSourceDataReady(aasdk::common::Data data) {
|
||||
OPENAUTO_LOG(error) << "[MediaSourceService] onMediaSourceDataReady()";
|
||||
auto sendPromise = aasdk::channel::SendPromise::defer(strand_);
|
||||
sendPromise->then(std::bind(&MediaSourceService::readMediaSource, this->shared_from_this()),
|
||||
std::bind(&MediaSourceService::onChannelError, this->shared_from_this(),
|
||||
@ -253,13 +254,14 @@ namespace f1x {
|
||||
* Reads audio from a MediaSource (eg Microphone). Promise resolves to onMediaSourceDataReady.
|
||||
*/
|
||||
void MediaSourceService::readMediaSource() {
|
||||
OPENAUTO_LOG(error) << "[MediaSourceService] readMediaSource()";
|
||||
if (audioInput_->isActive()) {
|
||||
auto readPromise = projection::IAudioInput::ReadPromise::defer(strand_);
|
||||
readPromise->then(
|
||||
std::bind(&MediaSourceService::onMediaSourceDataReady, this->shared_from_this(),
|
||||
std::placeholders::_1),
|
||||
[this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[AudioInputService] audio input read rejected.";
|
||||
OPENAUTO_LOG(info) << "[MediaSourceService] audio input read rejected.";
|
||||
});
|
||||
|
||||
audioInput_->read(std::move(readPromise));
|
||||
|
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* This file is part of openauto project.
|
||||
* Copyright (C) 2018 f1x.studio (Michal Szwaj)
|
||||
*
|
||||
* openauto is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
||||
* openauto is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with openauto. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <aasdk/Channel/MediaSource/Audio/MicrophoneAudioChannel.hpp>
|
||||
#include <f1x/openauto/autoapp/Service/MediaSource/MicrophoneMediaSourceService.hpp>
|
||||
|
||||
namespace f1x {
|
||||
namespace openauto {
|
||||
namespace autoapp {
|
||||
namespace service {
|
||||
namespace mediasource {
|
||||
MicrophoneMediaSourceService::MicrophoneMediaSourceService(boost::asio::io_service &ioService,
|
||||
aasdk::messenger::IMessenger::Pointer messenger,
|
||||
projection::IAudioInput::Pointer audioOutput)
|
||||
: MediaSourceService(ioService, std::make_shared<aasdk::channel::mediasource::audio::MicrophoneAudioChannel>(strand_,
|
||||
std::move(
|
||||
messenger)),
|
||||
std::move(audioOutput)) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -37,40 +37,56 @@ namespace f1x {
|
||||
|
||||
void NavigationStatusService::start() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[NavigationStatusService] start.";
|
||||
OPENAUTO_LOG(info) << "[NavigationStatusService] start()";
|
||||
});
|
||||
}
|
||||
|
||||
void NavigationStatusService::stop() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[NavigationStatusService] stop.";
|
||||
OPENAUTO_LOG(info) << "[NavigationStatusService] stop()";
|
||||
});
|
||||
}
|
||||
|
||||
void NavigationStatusService::pause() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[NavigationStatusService] pause.";
|
||||
OPENAUTO_LOG(info) << "[NavigationStatusService] pause()";
|
||||
});
|
||||
}
|
||||
|
||||
void NavigationStatusService::resume() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[NavigationStatusService] resume.";
|
||||
OPENAUTO_LOG(info) << "[NavigationStatusService] resume()";
|
||||
});
|
||||
}
|
||||
|
||||
void NavigationStatusService::fillFeatures(
|
||||
aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) {
|
||||
OPENAUTO_LOG(info) << "[NavigationStatusService] fill features.";
|
||||
OPENAUTO_LOG(info) << "[NavigationStatusService] fillFeatures()";
|
||||
|
||||
auto *channelDescriptor = response.add_channels();
|
||||
channelDescriptor->set_channel_id(static_cast<uint32_t>(channel_->getId()));
|
||||
auto *service = response.add_channels();
|
||||
service->set_id(static_cast<uint32_t>(channel_->getId()));
|
||||
|
||||
auto *vendorExtension = channelDescriptor->mutable_wifi_projection_service();
|
||||
auto *navigationStatus = service->mutable_navigation_status_service();
|
||||
}
|
||||
|
||||
void NavigationStatusService::onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) {
|
||||
OPENAUTO_LOG(info) << "[NavigationStatusService] onChannelOpenRequest()";
|
||||
OPENAUTO_LOG(info) << "[NavigationStatusService] Channel Id: " << request.service_id() << ", Priority: " << request.priority();
|
||||
|
||||
aap_protobuf::channel::ChannelOpenResponse response;
|
||||
const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS;
|
||||
response.set_status(status);
|
||||
|
||||
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
||||
promise->then([]() {}, std::bind(&NavigationStatusService::onChannelError, this->shared_from_this(),
|
||||
std::placeholders::_1));
|
||||
channel_->sendChannelOpenResponse(response, std::move(promise));
|
||||
|
||||
channel_->receive(this->shared_from_this());
|
||||
}
|
||||
|
||||
void NavigationStatusService::onChannelError(const aasdk::error::Error &e) {
|
||||
OPENAUTO_LOG(error) << "[NavigationStatusService] channel error: " << e.what();
|
||||
OPENAUTO_LOG(error) << "[NavigationStatusService] onChannelError(): " << e.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,43 +37,58 @@ namespace f1x {
|
||||
|
||||
void PhoneStatusService::start() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[PhoneStatusService] start.";
|
||||
OPENAUTO_LOG(info) << "[PhoneStatusService] start()";
|
||||
});
|
||||
}
|
||||
|
||||
void PhoneStatusService::stop() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[PhoneStatusService] stop.";
|
||||
OPENAUTO_LOG(info) << "[PhoneStatusService] stop()";
|
||||
});
|
||||
}
|
||||
|
||||
void PhoneStatusService::pause() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[PhoneStatusService] pause.";
|
||||
OPENAUTO_LOG(info) << "[PhoneStatusService] pause()";
|
||||
});
|
||||
}
|
||||
|
||||
void PhoneStatusService::resume() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[PhoneStatusService] resume.";
|
||||
OPENAUTO_LOG(info) << "[PhoneStatusService] resume()";
|
||||
});
|
||||
}
|
||||
|
||||
void PhoneStatusService::fillFeatures(
|
||||
aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) {
|
||||
OPENAUTO_LOG(info) << "[PhoneStatusService] fill features.";
|
||||
OPENAUTO_LOG(info) << "[PhoneStatusService] fillFeatures()";
|
||||
|
||||
auto *channelDescriptor = response.add_channels();
|
||||
channelDescriptor->set_channel_id(static_cast<uint32_t>(channel_->getId()));
|
||||
auto *service = response.add_channels();
|
||||
service->set_id(static_cast<uint32_t>(channel_->getId()));
|
||||
|
||||
auto *vendorExtension = channelDescriptor->mutable_wifi_projection_service();
|
||||
auto *phoneStatus = service->mutable_phone_status_service();
|
||||
}
|
||||
|
||||
void PhoneStatusService::onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) {
|
||||
OPENAUTO_LOG(info) << "[PhoneStatusService] onChannelOpenRequest()";
|
||||
OPENAUTO_LOG(info) << "[PhoneStatusService] Channel Id: " << request.service_id() << ", Priority: " << request.priority();
|
||||
|
||||
aap_protobuf::channel::ChannelOpenResponse response;
|
||||
const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS;
|
||||
response.set_status(status);
|
||||
|
||||
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
||||
promise->then([]() {}, std::bind(&PhoneStatusService::onChannelError, this->shared_from_this(),
|
||||
std::placeholders::_1));
|
||||
channel_->sendChannelOpenResponse(response, std::move(promise));
|
||||
|
||||
channel_->receive(this->shared_from_this());
|
||||
}
|
||||
|
||||
|
||||
void PhoneStatusService::onChannelError(const aasdk::error::Error &e) {
|
||||
OPENAUTO_LOG(error) << "[PhoneStatusService] channel error: " << e.what();
|
||||
OPENAUTO_LOG(error) << "[PhoneStatusService] onChannelError(): " << e.what();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,40 +37,57 @@ namespace f1x {
|
||||
|
||||
void RadioService::start() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[RadioService] start.";
|
||||
OPENAUTO_LOG(info) << "[RadioService] start()";
|
||||
});
|
||||
}
|
||||
|
||||
void RadioService::stop() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[RadioService] stop.";
|
||||
OPENAUTO_LOG(info) << "[RadioService] stop()";
|
||||
});
|
||||
}
|
||||
|
||||
void RadioService::pause() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[RadioService] pause.";
|
||||
OPENAUTO_LOG(info) << "[RadioService] pause()";
|
||||
});
|
||||
}
|
||||
|
||||
void RadioService::resume() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[RadioService] resume.";
|
||||
OPENAUTO_LOG(info) << "[RadioService] resume()";
|
||||
});
|
||||
}
|
||||
|
||||
void RadioService::fillFeatures(
|
||||
aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) {
|
||||
OPENAUTO_LOG(info) << "[RadioService] fill features.";
|
||||
OPENAUTO_LOG(info) << "[RadioService] fillFeatures()";
|
||||
|
||||
auto *channelDescriptor = response.add_channels();
|
||||
channelDescriptor->set_channel_id(static_cast<uint32_t>(channel_->getId()));
|
||||
auto *service = response.add_channels();
|
||||
service->set_id(static_cast<uint32_t>(channel_->getId()));
|
||||
|
||||
auto *vendorExtension = channelDescriptor->mutable_wifi_projection_service();
|
||||
auto *radio = service->mutable_radio_service();
|
||||
}
|
||||
|
||||
void RadioService::onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) {
|
||||
OPENAUTO_LOG(info) << "[RadioService] onChannelOpenRequest()";
|
||||
OPENAUTO_LOG(info) << "[RadioService] Channel Id: " << request.service_id() << ", Priority: " << request.priority();
|
||||
|
||||
|
||||
aap_protobuf::channel::ChannelOpenResponse response;
|
||||
const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS;
|
||||
response.set_status(status);
|
||||
|
||||
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
||||
promise->then([]() {}, std::bind(&RadioService::onChannelError, this->shared_from_this(),
|
||||
std::placeholders::_1));
|
||||
channel_->sendChannelOpenResponse(response, std::move(promise));
|
||||
|
||||
channel_->receive(this->shared_from_this());
|
||||
}
|
||||
|
||||
void RadioService::onChannelError(const aasdk::error::Error &e) {
|
||||
OPENAUTO_LOG(error) << "[RadioService] channel error: " << e.what();
|
||||
OPENAUTO_LOG(error) << "[RadioService] onChannelError(): " << e.what();
|
||||
}
|
||||
|
||||
|
||||
|
@ -33,7 +33,7 @@ namespace f1x {
|
||||
aasdk::messenger::IMessenger::Pointer messenger)
|
||||
: strand_(ioService),
|
||||
timer_(ioService),
|
||||
channel_(std::make_shared<aasdk::channel::sensor::SensorService>(strand_, std::move(messenger))) {
|
||||
channel_(std::make_shared<aasdk::channel::sensorsource::SensorSourceService>(strand_, std::move(messenger))) {
|
||||
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ namespace f1x {
|
||||
}
|
||||
this->sensorPolling();
|
||||
|
||||
OPENAUTO_LOG(info) << "[SensorService] start.";
|
||||
OPENAUTO_LOG(info) << "[SensorService] start()";
|
||||
channel_->receive(this->shared_from_this());
|
||||
});
|
||||
|
||||
@ -68,41 +68,42 @@ namespace f1x {
|
||||
this->gpsEnabled_ = false;
|
||||
}
|
||||
|
||||
OPENAUTO_LOG(info) << "[SensorService] stop.";
|
||||
OPENAUTO_LOG(info) << "[SensorService] stop()";
|
||||
});
|
||||
}
|
||||
|
||||
void SensorService::pause() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[SensorService] pause.";
|
||||
OPENAUTO_LOG(info) << "[SensorService] pause()";
|
||||
});
|
||||
}
|
||||
|
||||
void SensorService::resume() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[SensorService] resume.";
|
||||
OPENAUTO_LOG(info) << "[SensorService] resume()";
|
||||
});
|
||||
}
|
||||
|
||||
void SensorService::fillFeatures(
|
||||
aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) {
|
||||
OPENAUTO_LOG(info) << "[SensorService] fill features.";
|
||||
OPENAUTO_LOG(info) << "[SensorService] fillFeatures()";
|
||||
|
||||
auto *channelDescriptor = response.add_channels();
|
||||
channelDescriptor->set_channel_id(static_cast<uint32_t>(channel_->getId()));
|
||||
auto *service = response.add_channels();
|
||||
service->set_id(static_cast<uint32_t>(channel_->getId()));
|
||||
|
||||
auto *sensorChannel = channelDescriptor->mutable_sensor_service();
|
||||
// TODO: Add and Link other Sensors Here
|
||||
auto *sensorChannel = service->mutable_sensor_source_service();
|
||||
sensorChannel->add_sensors()->set_sensor_type(aap_protobuf::service::sensor::message::SensorType::SENSOR_DRIVING_STATUS_DATA);
|
||||
sensorChannel->add_sensors()->set_sensor_type(aap_protobuf::service::sensor::message::SensorType::SENSOR_LOCATION);
|
||||
sensorChannel->add_sensors()->set_sensor_type(aap_protobuf::service::sensor::message::SensorType::SENSOR_NIGHT_MODE);
|
||||
}
|
||||
|
||||
void SensorService::onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) {
|
||||
OPENAUTO_LOG(info) << "[SensorService] open request, priority: " << request.priority();
|
||||
const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS;
|
||||
OPENAUTO_LOG(info) << "[SensorService] open status: " << status;
|
||||
OPENAUTO_LOG(info) << "[SensorService] onChannelOpenRequest()";
|
||||
OPENAUTO_LOG(info) << "[SensorService] Channel Id: " << request.service_id() << ", Priority: " << request.priority();
|
||||
|
||||
aap_protobuf::channel::ChannelOpenResponse response;
|
||||
const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS;
|
||||
response.set_status(status);
|
||||
|
||||
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
||||
@ -115,19 +116,21 @@ namespace f1x {
|
||||
|
||||
void SensorService::onSensorStartRequest(
|
||||
const aap_protobuf::channel::sensor::event::SensorRequest &request) {
|
||||
OPENAUTO_LOG(info) << "[SensorService] sensor start request, type: " << request.sensor_type();
|
||||
OPENAUTO_LOG(info) << "[SensorService] onSensorStartRequest()";
|
||||
OPENAUTO_LOG(info) << "[SensorService] Request Type: "<< request.type();
|
||||
|
||||
aap_protobuf::service::sensor::message::SensorStartResponseMessage response;
|
||||
response.set_status(aap_protobuf::shared::MessageStatus::STATUS_SUCCESS);
|
||||
|
||||
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
||||
|
||||
if (request.sensor_type() == aap_protobuf::service::sensor::message::SENSOR_DRIVING_STATUS_DATA)
|
||||
// TODO: Convert to Switch?
|
||||
if (request.type() == aap_protobuf::service::sensor::message::SENSOR_DRIVING_STATUS_DATA)
|
||||
{
|
||||
promise->then(std::bind(&SensorService::sendDrivingStatusUnrestricted, this->shared_from_this()),
|
||||
std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1));
|
||||
}
|
||||
else if (request.sensor_type() == aap_protobuf::service::sensor::message::SensorType::SENSOR_NIGHT_MODE)
|
||||
else if (request.type() == aap_protobuf::service::sensor::message::SensorType::SENSOR_NIGHT_MODE)
|
||||
{
|
||||
promise->then(std::bind(&SensorService::sendNightData, this->shared_from_this()),
|
||||
std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1));
|
||||
@ -143,6 +146,7 @@ namespace f1x {
|
||||
}
|
||||
|
||||
void SensorService::sendDrivingStatusUnrestricted() {
|
||||
OPENAUTO_LOG(info) << "[SensorService] sendDrivingStatusUnrestricted()";
|
||||
aap_protobuf::service::sensor::message::SensorBatch indication;
|
||||
indication.add_driving_status_data()->set_status(aap_protobuf::service::sensor::message::DrivingStatus::DRIVE_STATUS_UNRESTRICTED);
|
||||
|
||||
@ -153,13 +157,14 @@ namespace f1x {
|
||||
}
|
||||
|
||||
void SensorService::sendNightData() {
|
||||
OPENAUTO_LOG(info) << "[SensorService] sendNightData()";
|
||||
aap_protobuf::service::sensor::message::SensorBatch indication;
|
||||
|
||||
if (SensorService::isNight) {
|
||||
OPENAUTO_LOG(info) << "[SensorService] Mode night triggered";
|
||||
OPENAUTO_LOG(info) << "[SensorService] Night Mode Triggered";
|
||||
indication.add_night_mode_data()->set_night_mode(true);
|
||||
} else {
|
||||
OPENAUTO_LOG(info) << "[SensorService] Mode day triggered";
|
||||
OPENAUTO_LOG(info) << "[SensorService] Day Mode Triggered";
|
||||
indication.add_night_mode_data()->set_night_mode(false);
|
||||
}
|
||||
|
||||
@ -174,6 +179,7 @@ namespace f1x {
|
||||
}
|
||||
|
||||
void SensorService::sendGPSLocationData() {
|
||||
OPENAUTO_LOG(info) << "[SensorService] sendGPSLocationData()";
|
||||
aap_protobuf::service::sensor::message::SensorBatch indication;
|
||||
auto *locInd = indication.add_location_data();
|
||||
|
||||
@ -206,6 +212,7 @@ namespace f1x {
|
||||
}
|
||||
|
||||
void SensorService::sensorPolling() {
|
||||
OPENAUTO_LOG(info) << "[SensorService] sensorPolling()";
|
||||
if (!this->stopPolling) {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
this->isNight = is_file_exist("/tmp/night_mode_enabled");
|
||||
@ -216,12 +223,12 @@ namespace f1x {
|
||||
|
||||
if ((this->gpsEnabled_) &&
|
||||
(gps_waiting(&this->gpsData_, 0)) &&
|
||||
//extern int gps_read(struct gps_data_t *, char *message, int message_len);
|
||||
//(gps_read(&this->gpsData_) > 0) &&
|
||||
(this->gpsData_.fix.status != MODE_NO_FIX) &&
|
||||
(gps_read(&this->gpsData_) > 0) &&
|
||||
(this->gpsData_.status != STATUS_NO_FIX) &&
|
||||
(this->gpsData_.fix.mode == MODE_2D || this->gpsData_.fix.mode == MODE_3D) &&
|
||||
(this->gpsData_.set & TIME_SET) &&
|
||||
(this->gpsData_.set & LATLON_SET)) {
|
||||
(this->gpsData_.set & LATLON_SET))
|
||||
{
|
||||
this->sendGPSLocationData();
|
||||
}
|
||||
|
||||
@ -232,12 +239,13 @@ namespace f1x {
|
||||
}
|
||||
|
||||
bool SensorService::is_file_exist(const char *fileName) {
|
||||
OPENAUTO_LOG(info) << "[SensorService] is_file_exist()";
|
||||
std::ifstream ifile(fileName, std::ios::in);
|
||||
return ifile.good();
|
||||
}
|
||||
|
||||
void SensorService::onChannelError(const aasdk::error::Error &e) {
|
||||
OPENAUTO_LOG(error) << "[SensorService] channel error: " << e.what();
|
||||
OPENAUTO_LOG(error) << "[SensorService] onChannelError(): " << e.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include <f1x/openauto/autoapp/Service/MediaSink/SystemAudioService.hpp>
|
||||
#include <f1x/openauto/autoapp/Service/MediaSink/TelephonyAudioService.hpp>
|
||||
|
||||
#include <f1x/openauto/autoapp/Service/MediaSource/MediaSourceService.hpp>
|
||||
#include <f1x/openauto/autoapp/Service/MediaSource/MicrophoneMediaSourceService.hpp>
|
||||
|
||||
#include <f1x/openauto/autoapp/Service/Sensor/SensorService.hpp>
|
||||
#include <f1x/openauto/autoapp/Service/Bluetooth/BluetoothService.hpp>
|
||||
@ -49,7 +49,6 @@
|
||||
#include <f1x/openauto/autoapp/Projection/RemoteBluetoothDevice.hpp>
|
||||
#include <f1x/openauto/autoapp/Projection/DummyBluetoothDevice.hpp>
|
||||
|
||||
|
||||
namespace f1x {
|
||||
namespace openauto {
|
||||
namespace autoapp {
|
||||
@ -64,13 +63,8 @@ namespace f1x {
|
||||
// TODO: MEDIA SERVICE
|
||||
|
||||
ServiceList ServiceFactory::create(aasdk::messenger::IMessenger::Pointer messenger) {
|
||||
OPENAUTO_LOG(info) << "[ServiceFactory] create()";
|
||||
ServiceList serviceList;
|
||||
/*
|
||||
projection::IAudioInput::Pointer audioInput(new projection::QtAudioInput(1, 16, 16000),
|
||||
std::bind(&QObject::deleteLater, std::placeholders::_1));
|
||||
serviceList.emplace_back(std::make_shared<MediaSourceService>(ioService_, messenger, std::move(audioInput)));
|
||||
*/
|
||||
|
||||
|
||||
this->createMediaSinkServices(serviceList, messenger);
|
||||
this->createMediaSourceServices(serviceList, messenger);
|
||||
@ -83,20 +77,24 @@ namespace f1x {
|
||||
}
|
||||
|
||||
IService::Pointer ServiceFactory::createBluetoothService(aasdk::messenger::IMessenger::Pointer messenger) {
|
||||
OPENAUTO_LOG(info) << "[ServiceFactory] createBluetoothService()";
|
||||
projection::IBluetoothDevice::Pointer bluetoothDevice;
|
||||
switch (configuration_->getBluetoothAdapterType()) {
|
||||
case configuration::BluetoothAdapterType::LOCAL:
|
||||
OPENAUTO_LOG(info) << "[ServiceFactory] Local Bluetooth";
|
||||
bluetoothDevice = projection::IBluetoothDevice::Pointer(new projection::LocalBluetoothDevice(),
|
||||
std::bind(&QObject::deleteLater,
|
||||
std::placeholders::_1));
|
||||
break;
|
||||
|
||||
case configuration::BluetoothAdapterType::REMOTE:
|
||||
OPENAUTO_LOG(info) << "[ServiceFactory] Remote Bluetooth";
|
||||
bluetoothDevice = std::make_shared<projection::RemoteBluetoothDevice>(
|
||||
configuration_->getBluetoothRemoteAdapterAddress());
|
||||
break;
|
||||
|
||||
default:
|
||||
OPENAUTO_LOG(info) << "[ServiceFactory] Dummy Bluetooth";
|
||||
bluetoothDevice = std::make_shared<projection::DummyBluetoothDevice>();
|
||||
break;
|
||||
}
|
||||
@ -105,17 +103,19 @@ namespace f1x {
|
||||
}
|
||||
|
||||
IService::Pointer ServiceFactory::createInputService(aasdk::messenger::IMessenger::Pointer messenger) {
|
||||
OPENAUTO_LOG(info) << "[ServiceFactory] createInputService()";
|
||||
QRect videoGeometry;
|
||||
switch (configuration_->getVideoResolution()) {
|
||||
case aap_protobuf::service::media::shared::message::VideoCodecResolutionType::VIDEO_1280x720:
|
||||
OPENAUTO_LOG(info) << "[ServiceFactory] Resolution 1280x720";
|
||||
videoGeometry = QRect(0, 0, 1280, 720);
|
||||
break;
|
||||
|
||||
case aap_protobuf::service::media::shared::message::VideoCodecResolutionType::VIDEO_1920x1080:
|
||||
OPENAUTO_LOG(info) << "[ServiceFactory] Resolution 1920x1080";
|
||||
videoGeometry = QRect(0, 0, 1920, 1080);
|
||||
break;
|
||||
|
||||
default:
|
||||
OPENAUTO_LOG(info) << "[ServiceFactory] Resolution 800x480";
|
||||
videoGeometry = QRect(0, 0, 800, 480);
|
||||
break;
|
||||
}
|
||||
@ -131,7 +131,9 @@ namespace f1x {
|
||||
|
||||
void ServiceFactory::createMediaSinkServices(ServiceList &serviceList,
|
||||
aasdk::messenger::IMessenger::Pointer messenger) {
|
||||
OPENAUTO_LOG(info) << "[ServiceFactory] createMediaSinkServices()";
|
||||
if (configuration_->musicAudioChannelEnabled()) {
|
||||
OPENAUTO_LOG(info) << "[ServiceFactory] Media Audio Channel enabled";
|
||||
auto mediaAudioOutput =
|
||||
configuration_->getAudioOutputBackendType() == configuration::AudioOutputBackendType::RTAUDIO ?
|
||||
std::make_shared<projection::RtAudioOutput>(2, 16, 48000) :
|
||||
@ -143,6 +145,7 @@ namespace f1x {
|
||||
}
|
||||
|
||||
if (configuration_->guidanceAudioChannelEnabled()) {
|
||||
OPENAUTO_LOG(info) << "[ServiceFactory] Guidance Audio Channel enabled";
|
||||
auto guidanceAudioOutput =
|
||||
configuration_->getAudioOutputBackendType() == configuration::AudioOutputBackendType::RTAUDIO ?
|
||||
std::make_shared<projection::RtAudioOutput>(1, 16, 16000) :
|
||||
@ -154,6 +157,7 @@ namespace f1x {
|
||||
}
|
||||
|
||||
if (configuration_->telephonyAudioChannelEnabled()) {
|
||||
OPENAUTO_LOG(info) << "[ServiceFactory] Telephony Audio Channel enabled";
|
||||
auto telephonyAudioOutput =
|
||||
configuration_->getAudioOutputBackendType() == configuration::AudioOutputBackendType::RTAUDIO ?
|
||||
std::make_shared<projection::RtAudioOutput>(1, 16, 16000) :
|
||||
@ -167,6 +171,8 @@ namespace f1x {
|
||||
/*
|
||||
* No Need to Check for systemAudioChannelEnabled - MUST be enabled by default.
|
||||
*/
|
||||
|
||||
OPENAUTO_LOG(info) << "[ServiceFactory] System Audio Channel enabled";
|
||||
auto systemAudioOutput =
|
||||
configuration_->getAudioOutputBackendType() == configuration::AudioOutputBackendType::RTAUDIO ?
|
||||
std::make_shared<projection::RtAudioOutput>(1, 16, 16000) :
|
||||
@ -183,20 +189,26 @@ namespace f1x {
|
||||
std::bind(&QObject::deleteLater, std::placeholders::_1));
|
||||
#endif
|
||||
|
||||
OPENAUTO_LOG(info) << "[ServiceFactory] Video Channel enabled";
|
||||
serviceList.emplace_back(
|
||||
std::make_shared<mediasink::VideoService>(ioService_, messenger, std::move(videoOutput)));
|
||||
}
|
||||
|
||||
void ServiceFactory::createMediaSourceServices(f1x::openauto::autoapp::service::ServiceList &serviceList,
|
||||
aasdk::messenger::IMessenger::Pointer messenger) {
|
||||
|
||||
OPENAUTO_LOG(info) << "[ServiceFactory] createMediaSourceServices()";
|
||||
projection::IAudioInput::Pointer audioInput(new projection::QtAudioInput(1, 16, 16000),
|
||||
std::bind(&QObject::deleteLater, std::placeholders::_1));
|
||||
serviceList.emplace_back(std::make_shared<mediasource::MicrophoneMediaSourceService>(ioService_, messenger, std::move(audioInput)));
|
||||
}
|
||||
|
||||
IService::Pointer ServiceFactory::createSensorService(aasdk::messenger::IMessenger::Pointer messenger) {
|
||||
OPENAUTO_LOG(info) << "[ServiceFactory] createSensorService()";
|
||||
return std::make_shared<sensor::SensorService>(ioService_, messenger);
|
||||
}
|
||||
|
||||
IService::Pointer ServiceFactory::createWifiProjectionService(aasdk::messenger::IMessenger::Pointer messenger) {
|
||||
OPENAUTO_LOG(info) << "[ServiceFactory] createWifiProjectionService()";
|
||||
return std::make_shared<wifiprojection::WifiProjectionService>(ioService_, messenger);
|
||||
}
|
||||
|
||||
|
@ -37,43 +37,56 @@ namespace f1x {
|
||||
|
||||
void VendorExtensionService::start() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[VendorExtensionService] start.";
|
||||
OPENAUTO_LOG(info) << "[VendorExtensionService] start()";
|
||||
});
|
||||
}
|
||||
|
||||
void VendorExtensionService::stop() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[VendorExtensionService] stop.";
|
||||
OPENAUTO_LOG(info) << "[VendorExtensionService] stop()";
|
||||
});
|
||||
}
|
||||
|
||||
void VendorExtensionService::pause() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[VendorExtensionService] pause.";
|
||||
OPENAUTO_LOG(info) << "[VendorExtensionService] pause()";
|
||||
});
|
||||
}
|
||||
|
||||
void VendorExtensionService::resume() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[VendorExtensionService] resume.";
|
||||
OPENAUTO_LOG(info) << "[VendorExtensionService] resume()";
|
||||
});
|
||||
}
|
||||
|
||||
void VendorExtensionService::fillFeatures(
|
||||
aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) {
|
||||
OPENAUTO_LOG(info) << "[VendorExtensionService] fill features.";
|
||||
OPENAUTO_LOG(info) << "[VendorExtensionService] fillFeatures()";
|
||||
|
||||
auto *channelDescriptor = response.add_channels();
|
||||
channelDescriptor->set_channel_id(static_cast<uint32_t>(channel_->getId()));
|
||||
auto *service = response.add_channels();
|
||||
service->set_id(static_cast<uint32_t>(channel_->getId()));
|
||||
|
||||
auto *vendorExtension = channelDescriptor->mutable_wifi_projection_service();
|
||||
auto *vendorExtension = service->mutable_vendor_extension_service();
|
||||
}
|
||||
|
||||
void VendorExtensionService::onChannelError(const aasdk::error::Error &e) {
|
||||
OPENAUTO_LOG(error) << "[VendorExtensionService] channel error: " << e.what();
|
||||
OPENAUTO_LOG(error) << "[VendorExtensionService] onChannelError(): " << e.what();
|
||||
}
|
||||
|
||||
void VendorExtensionService::onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) {
|
||||
OPENAUTO_LOG(info) << "[VendorExtensionService] onChannelOpenRequest()";
|
||||
OPENAUTO_LOG(info) << "[VendorExtensionService] Channel Id: " << request.service_id() << ", Priority: " << request.priority();
|
||||
|
||||
aap_protobuf::channel::ChannelOpenResponse response;
|
||||
const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS;
|
||||
response.set_status(status);
|
||||
|
||||
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
||||
promise->then([]() {}, std::bind(&VendorExtensionService::onChannelError, this->shared_from_this(),
|
||||
std::placeholders::_1));
|
||||
channel_->sendChannelOpenResponse(response, std::move(promise));
|
||||
channel_->receive(this->shared_from_this());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,51 +36,53 @@ namespace f1x {
|
||||
|
||||
void WifiProjectionService::start() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[WifiProjectionService] start.";
|
||||
OPENAUTO_LOG(info) << "[WifiProjectionService] start()";
|
||||
});
|
||||
}
|
||||
|
||||
void WifiProjectionService::stop() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[WifiProjectionService] stop.";
|
||||
OPENAUTO_LOG(info) << "[WifiProjectionService] stop()";
|
||||
});
|
||||
}
|
||||
|
||||
void WifiProjectionService::pause() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[WifiProjectionService] pause.";
|
||||
OPENAUTO_LOG(info) << "[WifiProjectionService] pause()";
|
||||
});
|
||||
}
|
||||
|
||||
void WifiProjectionService::resume() {
|
||||
strand_.dispatch([this, self = this->shared_from_this()]() {
|
||||
OPENAUTO_LOG(info) << "[WifiProjectionService] resume.";
|
||||
OPENAUTO_LOG(info) << "[WifiProjectionService] resume()";
|
||||
});
|
||||
}
|
||||
|
||||
void WifiProjectionService::fillFeatures(
|
||||
aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) {
|
||||
OPENAUTO_LOG(info) << "[WifiProjectionService] fill features.";
|
||||
OPENAUTO_LOG(info) << "[WifiProjectionService] fillFeatures()";
|
||||
|
||||
auto *channelDescriptor = response.add_channels();
|
||||
channelDescriptor->set_channel_id(static_cast<uint32_t>(channel_->getId()));
|
||||
auto *service = response.add_channels();
|
||||
service->set_id(static_cast<uint32_t>(channel_->getId()));
|
||||
|
||||
auto *wifiChannel = channelDescriptor->mutable_wifi_projection_service();
|
||||
auto *wifiChannel = service->mutable_wifi_projection_service();
|
||||
wifiChannel->set_car_wifi_bssid(""); // TODO: Temporarily disabled and populating with empty string.
|
||||
}
|
||||
|
||||
void WifiProjectionService::onWifiCredentialsRequest(
|
||||
const aap_protobuf::service::wifiprojection::message::WifiCredentialsRequest &request) {
|
||||
OPENAUTO_LOG(info) << "[WifiProjectionService] onWifiCredentialsRequest()";
|
||||
// channel_->sendWifiCredentialsResponse(response, std::move(promise));
|
||||
|
||||
}
|
||||
|
||||
void WifiProjectionService::onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) {
|
||||
OPENAUTO_LOG(info) << "[WifiProjectionService] open request, priority: " << request.priority();
|
||||
const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS;
|
||||
OPENAUTO_LOG(info) << "[WifiProjectionService] open status: " << status;
|
||||
OPENAUTO_LOG(info) << "[WifiProjectionService] onChannelOpenRequest()";
|
||||
OPENAUTO_LOG(info) << "[WifiProjectionService] Channel Id: " << request.service_id() << ", Priority: " << request.priority();
|
||||
|
||||
|
||||
aap_protobuf::channel::ChannelOpenResponse response;
|
||||
const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS;
|
||||
response.set_status(status);
|
||||
|
||||
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
||||
@ -92,7 +94,7 @@ namespace f1x {
|
||||
}
|
||||
|
||||
void WifiProjectionService::onChannelError(const aasdk::error::Error &e) {
|
||||
OPENAUTO_LOG(error) << "[WifiProjectionService] channel error: " << e.what();
|
||||
OPENAUTO_LOG(error) << "[WifiProjectionService] onChannelError(): " << e.what();
|
||||
}
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
14
src/autoapp/UI/dialog.cpp
Normal file
14
src/autoapp/UI/dialog.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "dialog.h"
|
||||
#include "ui_dialog.h"
|
||||
|
||||
Dialog::Dialog(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
, ui(new Ui::Dialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
Dialog::~Dialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
22
src/autoapp/UI/dialog.h
Normal file
22
src/autoapp/UI/dialog.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef DIALOG_H
|
||||
#define DIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class Dialog;
|
||||
}
|
||||
|
||||
class Dialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Dialog(QWidget *parent = nullptr);
|
||||
~Dialog();
|
||||
|
||||
private:
|
||||
Ui::Dialog *ui;
|
||||
};
|
||||
|
||||
#endif // DIALOG_H
|
68
src/autoapp/UI/dialog.ui
Normal file
68
src/autoapp/UI/dialog.ui
Normal file
@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Dialog</class>
|
||||
<widget class="QDialog" name="Dialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>240</y>
|
||||
<width>341</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>Dialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>Dialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
14
src/autoapp/UI/journey.cpp
Normal file
14
src/autoapp/UI/journey.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "journey.h"
|
||||
#include "ui_journey.h"
|
||||
|
||||
journey::journey(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
, ui(new Ui::journey)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
journey::~journey()
|
||||
{
|
||||
delete ui;
|
||||
}
|
22
src/autoapp/UI/journey.h
Normal file
22
src/autoapp/UI/journey.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef JOURNEY_H
|
||||
#define JOURNEY_H
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
namespace Ui {
|
||||
class journey;
|
||||
}
|
||||
|
||||
class journey : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit journey(QWidget *parent = nullptr);
|
||||
~journey();
|
||||
|
||||
private:
|
||||
Ui::journey *ui;
|
||||
};
|
||||
|
||||
#endif // JOURNEY_H
|
31
src/autoapp/UI/journey.ui
Normal file
31
src/autoapp/UI/journey.ui
Normal file
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>journey</class>
|
||||
<widget class="QMainWindow" name="journey">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>600</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget"/>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -38,7 +38,8 @@
|
||||
#include <f1x/openauto/autoapp/UI/UpdateDialog.hpp>
|
||||
#include <f1x/openauto/Common/Log.hpp>
|
||||
|
||||
namespace aasdk = aasdk;
|
||||
//namespace aap_protobuf = aap_protobuf;
|
||||
//namespace aasdk = aasdk;
|
||||
namespace autoapp = f1x::openauto::autoapp;
|
||||
using ThreadPool = std::vector<std::thread>;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user