From 5a2a305c04fd862b4fa712a9356d15efce576593 Mon Sep 17 00:00:00 2001 From: Simon Dean Date: Mon, 4 Nov 2024 13:51:11 +0000 Subject: [PATCH 01/14] All modifications for AAP 1.6 --- CMakeLists.txt | 156 +++++----- Dockerfile | 3 + include/f1x/openauto/autoapp/App.hpp | 10 +- .../autoapp/Configuration/Configuration.hpp | 43 ++- .../autoapp/Configuration/IConfiguration.hpp | 24 +- .../autoapp/Projection/IAudioInput.hpp | 4 +- .../autoapp/Projection/IAudioOutput.hpp | 4 +- .../autoapp/Projection/IBluetoothDevice.hpp | 2 +- .../autoapp/Projection/IInputDevice.hpp | 4 +- .../autoapp/Projection/IVideoOutput.hpp | 14 +- .../autoapp/Projection/InputEvent.hpp | 10 +- .../autoapp/Projection/SequentialBuffer.hpp | 2 +- .../autoapp/Projection/VideoOutput.hpp | 4 +- .../autoapp/Service/AndroidAutoEntity.hpp | 25 +- .../Service/AndroidAutoEntityFactory.hpp | 2 +- .../autoapp/Service/AudioInputService.hpp | 67 ----- .../openauto/autoapp/Service/AudioService.hpp | 67 ----- .../Service/Bluetooth/BluetoothService.hpp | 66 +++++ .../autoapp/Service/BluetoothService.hpp | 58 ---- .../GenericNotificationService.hpp | 61 ++++ .../IAndroidAutoEntityEventHandler.hpp | 2 +- .../Service/IAndroidAutoEntityFactory.hpp | 4 +- .../f1x/openauto/autoapp/Service/IPinger.hpp | 2 +- .../f1x/openauto/autoapp/Service/IService.hpp | 6 +- .../autoapp/Service/IServiceFactory.hpp | 2 +- .../openauto/autoapp/Service/InputService.hpp | 67 ----- .../InputSource/InputSourceService.hpp | 71 +++++ .../MediaBrowser/MediaBrowserService.hpp | 61 ++++ .../MediaPlaybackStatusService.hpp | 61 ++++ .../MediaSink/AudioMediaSinkService.hpp | 78 +++++ .../GuidanceAudioService.hpp} | 37 ++- .../{ => MediaSink}/MediaAudioService.hpp | 37 ++- .../Service/MediaSink/SystemAudioService.hpp | 39 +-- .../MediaSink/TelephonyAudioService.hpp | 44 +++ .../MediaSink/VideoMediaSinkService.hpp | 82 ++++++ .../VideoService.hpp} | 40 +-- .../MediaSource/MediaSourceService.hpp | 91 ++++++ .../MicrophoneMediaSourceService.hpp | 44 +++ .../NavigationStatusService.hpp | 61 ++++ .../PhoneStatus/PhoneStatusService.hpp | 61 ++++ .../autoapp/Service/Radio/RadioService.hpp | 61 ++++ .../autoapp/Service/Sensor/SensorService.hpp | 83 ++++++ .../autoapp/Service/SensorService.hpp | 70 ----- .../Service/{WifiService.hpp => Service.hpp} | 56 ++-- .../autoapp/Service/ServiceFactory.hpp | 54 ++-- .../VendorExtensionService.hpp | 61 ++++ .../openauto/autoapp/Service/VideoService.hpp | 70 ----- .../WifiProjection/WifiProjectionService.hpp | 63 ++++ .../f1x/openauto/autoapp/UI/ConnectDialog.hpp | 4 +- .../openauto/autoapp/UI/SettingsWindow.hpp | 3 +- .../btservice/AndroidBluetoothServer.hpp | 2 +- src/autoapp/App.cpp | 4 +- src/autoapp/Configuration/Configuration.cpp | 154 ++++++---- src/autoapp/Projection/InputDevice.cpp | 48 ++-- src/autoapp/Projection/OMXVideoOutput.cpp | 2 +- src/autoapp/Projection/RtAudioOutput.cpp | 36 ++- src/autoapp/Projection/VideoOutput.cpp | 4 +- src/autoapp/Service/AndroidAutoEntity.cpp | 154 +++++++--- .../Service/AndroidAutoEntityFactory.cpp | 16 +- src/autoapp/Service/AudioInputService.cpp | 215 -------------- src/autoapp/Service/AudioService.cpp | 196 ------------- .../Service/Bluetooth/BluetoothService.cpp | 122 ++++++++ src/autoapp/Service/BluetoothService.cpp | 127 -------- .../GenericNotificationService.cpp | 79 +++++ src/autoapp/Service/InputService.cpp | 205 ------------- .../InputSource/InputSourceService.cpp | 196 +++++++++++++ .../MediaBrowser/MediaBrowserService.cpp | 79 +++++ .../MediaPlaybackStatusService.cpp | 79 +++++ .../MediaSink/AudioMediaSinkService.cpp | 217 ++++++++++++++ .../MediaSink/GuidanceAudioService.cpp | 43 +++ .../Service/MediaSink/MediaAudioService.cpp | 42 +++ .../Service/MediaSink/SystemAudioService.cpp | 42 +++ .../MediaSink/TelephonyAudioService.cpp | 41 +++ .../MediaSink/VideoMediaSinkService.cpp | 208 ++++++++++++++ .../Service/MediaSink/VideoService.cpp | 41 +++ .../MediaSource/MediaSourceService.cpp | 272 ++++++++++++++++++ .../NavigationStatusService.cpp | 79 +++++ .../PhoneStatus/PhoneStatusService.cpp | 81 ++++++ src/autoapp/Service/Radio/RadioService.cpp | 81 ++++++ src/autoapp/Service/Sensor/SensorService.cpp | 246 ++++++++++++++++ src/autoapp/Service/SensorService.cpp | 261 ----------------- src/autoapp/Service/ServiceFactory.cpp | 258 ++++++++++------- src/autoapp/Service/SpeechAudioService.cpp | 40 --- src/autoapp/Service/SystemAudioService.cpp | 40 --- .../VendorExtensionService.cpp | 81 ++++++ src/autoapp/Service/VideoService.cpp | 214 -------------- .../WifiProjection/WifiProjectionStatus.cpp | 103 +++++++ src/autoapp/Service/WifiService.cpp | 69 ----- src/autoapp/UI/SettingsWindow.cpp | 88 +++--- src/autoapp/autoapp.cpp | 14 +- src/btservice/AndroidBluetoothServer.cpp | 52 ++-- 91 files changed, 4012 insertions(+), 2360 deletions(-) create mode 100644 Dockerfile delete mode 100644 include/f1x/openauto/autoapp/Service/AudioInputService.hpp delete mode 100644 include/f1x/openauto/autoapp/Service/AudioService.hpp create mode 100644 include/f1x/openauto/autoapp/Service/Bluetooth/BluetoothService.hpp delete mode 100644 include/f1x/openauto/autoapp/Service/BluetoothService.hpp create mode 100644 include/f1x/openauto/autoapp/Service/GenericNotification/GenericNotificationService.hpp delete mode 100644 include/f1x/openauto/autoapp/Service/InputService.hpp create mode 100644 include/f1x/openauto/autoapp/Service/InputSource/InputSourceService.hpp create mode 100644 include/f1x/openauto/autoapp/Service/MediaBrowser/MediaBrowserService.hpp create mode 100644 include/f1x/openauto/autoapp/Service/MediaPlaybackStatus/MediaPlaybackStatusService.hpp create mode 100644 include/f1x/openauto/autoapp/Service/MediaSink/AudioMediaSinkService.hpp rename include/f1x/openauto/autoapp/Service/{SystemAudioService.hpp => MediaSink/GuidanceAudioService.hpp} (54%) rename include/f1x/openauto/autoapp/Service/{ => MediaSink}/MediaAudioService.hpp (54%) rename src/autoapp/Service/MediaAudioService.cpp => include/f1x/openauto/autoapp/Service/MediaSink/SystemAudioService.hpp (50%) create mode 100644 include/f1x/openauto/autoapp/Service/MediaSink/TelephonyAudioService.hpp create mode 100644 include/f1x/openauto/autoapp/Service/MediaSink/VideoMediaSinkService.hpp rename include/f1x/openauto/autoapp/Service/{SpeechAudioService.hpp => MediaSink/VideoService.hpp} (52%) create mode 100644 include/f1x/openauto/autoapp/Service/MediaSource/MediaSourceService.hpp create mode 100644 include/f1x/openauto/autoapp/Service/MediaSource/MicrophoneMediaSourceService.hpp create mode 100644 include/f1x/openauto/autoapp/Service/NavigationStatus/NavigationStatusService.hpp create mode 100644 include/f1x/openauto/autoapp/Service/PhoneStatus/PhoneStatusService.hpp create mode 100644 include/f1x/openauto/autoapp/Service/Radio/RadioService.hpp create mode 100644 include/f1x/openauto/autoapp/Service/Sensor/SensorService.hpp delete mode 100644 include/f1x/openauto/autoapp/Service/SensorService.hpp rename include/f1x/openauto/autoapp/Service/{WifiService.hpp => Service.hpp} (50%) create mode 100644 include/f1x/openauto/autoapp/Service/VendorExtension/VendorExtensionService.hpp delete mode 100644 include/f1x/openauto/autoapp/Service/VideoService.hpp create mode 100644 include/f1x/openauto/autoapp/Service/WifiProjection/WifiProjectionService.hpp delete mode 100644 src/autoapp/Service/AudioInputService.cpp delete mode 100644 src/autoapp/Service/AudioService.cpp create mode 100644 src/autoapp/Service/Bluetooth/BluetoothService.cpp delete mode 100644 src/autoapp/Service/BluetoothService.cpp create mode 100644 src/autoapp/Service/GenericNotification/GenericNotificationService.cpp delete mode 100644 src/autoapp/Service/InputService.cpp create mode 100644 src/autoapp/Service/InputSource/InputSourceService.cpp create mode 100644 src/autoapp/Service/MediaBrowser/MediaBrowserService.cpp create mode 100644 src/autoapp/Service/MediaPlaybackStatus/MediaPlaybackStatusService.cpp create mode 100644 src/autoapp/Service/MediaSink/AudioMediaSinkService.cpp create mode 100644 src/autoapp/Service/MediaSink/GuidanceAudioService.cpp create mode 100644 src/autoapp/Service/MediaSink/MediaAudioService.cpp create mode 100644 src/autoapp/Service/MediaSink/SystemAudioService.cpp create mode 100644 src/autoapp/Service/MediaSink/TelephonyAudioService.cpp create mode 100644 src/autoapp/Service/MediaSink/VideoMediaSinkService.cpp create mode 100644 src/autoapp/Service/MediaSink/VideoService.cpp create mode 100644 src/autoapp/Service/MediaSource/MediaSourceService.cpp create mode 100644 src/autoapp/Service/NavigationStatus/NavigationStatusService.cpp create mode 100644 src/autoapp/Service/PhoneStatus/PhoneStatusService.cpp create mode 100644 src/autoapp/Service/Radio/RadioService.cpp create mode 100644 src/autoapp/Service/Sensor/SensorService.cpp delete mode 100644 src/autoapp/Service/SensorService.cpp delete mode 100644 src/autoapp/Service/SpeechAudioService.cpp delete mode 100644 src/autoapp/Service/SystemAudioService.cpp create mode 100644 src/autoapp/Service/VendorExtension/VendorExtensionService.cpp delete mode 100644 src/autoapp/Service/VideoService.cpp create mode 100644 src/autoapp/Service/WifiProjection/WifiProjectionStatus.cpp delete mode 100644 src/autoapp/Service/WifiService.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 85a64be..4499c9a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,98 +1,119 @@ cmake_minimum_required(VERSION 3.5.1) + project(openauto CXX) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTORCC ON) -set(base_directory ${CMAKE_CURRENT_SOURCE_DIR}) -set(resources_directory ${base_directory}/assets) -set(sources_directory ${base_directory}/src) -set(include_directory ${base_directory}/include) -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${base_directory}/lib) -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${base_directory}/lib) +# Set Compile Versions +set(OPENAUTO_BUILD_DATE 20241028) # Binary Release Build Date +set(OPENAUTO_BUILD_RELEASE 1) # Binary Release Build Number (increment if released on same day) +set(OPENAUTO_BUILD_INCREMENTAL 1) # Binary Build Version - Increment for Each Build -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${base_directory}/bin) -set(EXECUTABLE_OUTPUT_PATH ${base_directory}/bin) - -set(Boost_USE_STATIC_LIBS OFF) -set(Boost_USE_MULTITHREADED ON) -set(Boost_USE_STATIC_RUNTIME OFF) - -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake_modules/") -SET(CMAKE_CXX_STANDARD 14) +# Configure CMAKE +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") +# Paths +set(resources_directory ${CMAKE_CURRENT_SOURCE_DIR}/assets) +set(sources_directory ${CMAKE_CURRENT_SOURCE_DIR}/src) +set(include_directory ${CMAKE_CURRENT_SOURCE_DIR}/include) + +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib) + +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin) +set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/bin) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake_modules/") + +# Configure Boost +set(Boost_USE_STATIC_LIBS OFF) +set(Boost_USE_MULTITHREADED ON) +set(Boost_USE_STATIC_RUNTIME OFF) + add_definitions(-DBOOST_ALL_DYN_LINK) +if (WIN32) + set(WINSOCK2_LIBRARIES "ws2_32") +endif (WIN32) + +if (RPI3_BUILD) + add_definitions(-DUSE_OMX -DOMX_SKIP64BIT -DRASPBERRYPI3) + set(BCM_HOST_LIBRARIES "/opt/vc/lib/libbcm_host.so") + set(BCM_HOST_INCLUDE_DIRS "/opt/vc/include") + set(ILCLIENT_INCLUDE_DIRS "/opt/vc/src/hello_pi/libs/ilclient") + set(ILCLIENT_LIBRARIES "/opt/vc/src/hello_pi/libs/ilclient/libilclient.a;/opt/vc/lib/libvcos.so;/opt/vc/lib/libvcilcs.a;/opt/vc/lib/libvchiq_arm.so") +endif (RPI3_BUILD) + +# Building on a Mac requires Abseil +if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") # macOS + 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) + include(FindProtobuf) +else () + find_package(Protobuf REQUIRED) +endif () + +find_package(aap_protobuf REQUIRED) +find_package(aasdk REQUIRED) find_package(Boost REQUIRED COMPONENTS system log OPTIONAL_COMPONENTS unit_test_framework) find_package(libusb-1.0 REQUIRED) find_package(Qt5 COMPONENTS Multimedia MultimediaWidgets Bluetooth Network) -find_package(Protobuf REQUIRED) find_package(OpenSSL REQUIRED) find_package(rtaudio REQUIRED) find_package(taglib REQUIRED) find_package(blkid REQUIRED) find_package(gps REQUIRED) -if(WIN32) - set(WINSOCK2_LIBRARIES "ws2_32") -endif(WIN32) - -if(RPI3_BUILD) - add_definitions(-DUSE_OMX -DOMX_SKIP64BIT -DRASPBERRYPI3) - set(BCM_HOST_LIBRARIES "/opt/vc/lib/libbcm_host.so") - set(BCM_HOST_INCLUDE_DIRS "/opt/vc/include") - set(ILCLIENT_INCLUDE_DIRS "/opt/vc/src/hello_pi/libs/ilclient") - set(ILCLIENT_LIBRARIES "/opt/vc/src/hello_pi/libs/ilclient/libilclient.a;/opt/vc/lib/libvcos.so;/opt/vc/lib/libvcilcs.a;/opt/vc/lib/libvchiq_arm.so") -endif(RPI3_BUILD) - include_directories(${CMAKE_CURRENT_BINARY_DIR} - ${Qt5Multimedia_INCLUDE_DIRS} - ${Qt5MultimediaWidgets_INCLUDE_DIRS} - ${Qt5Widgets_INCLUDE_DIRS} - ${Qt5Bluetooth_INCLUDE_DIRS} - ${Qt5Network_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} - ${PROTOBUF_INCLUDE_DIR} - ${OPENSSL_INCLUDE_DIR} - ${RTAUDIO_INCLUDE_DIRS} - ${TAGLIB_INCLUDE_DIRS} - ${BLKID_INCLUDE_DIRS} - ${AASDK_PROTO_INCLUDE_DIRS} - ${AASDK_INCLUDE_DIRS} - ${BCM_HOST_INCLUDE_DIRS} - ${ILCLIENT_INCLUDE_DIRS} - ${include_directory}) - + ${Qt5Multimedia_INCLUDE_DIRS} + ${Qt5MultimediaWidgets_INCLUDE_DIRS} + ${Qt5Widgets_INCLUDE_DIRS} + ${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}) + link_directories(${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) set(common_include_directory ${include_directory}/f1x/openauto/Common) set(autoapp_sources_directory ${sources_directory}/autoapp) set(autoapp_include_directory ${include_directory}/f1x/openauto/autoapp) + file(GLOB_RECURSE autoapp_source_files ${autoapp_sources_directory}/*.ui ${autoapp_sources_directory}/*.cpp ${autoapp_include_directory}/*.hpp ${common_include_directory}/*.hpp ${resources_directory}/*.qrc) add_executable(autoapp ${autoapp_source_files}) target_link_libraries(autoapp 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} - ${AASDK_PROTO_LIBRARIES} - ${AASDK_LIBRARIES}) + aap_protobuf + aasdk + ${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}) set(btservice_sources_directory ${sources_directory}/btservice) set(btservice_include_directory ${include_directory}/f1x/openauto/btservice) @@ -100,10 +121,11 @@ file(GLOB_RECURSE btservice_source_files ${btservice_sources_directory}/*.cpp ${ add_executable(btservice ${btservice_source_files}) -target_link_libraries(btservice - ${Boost_LIBRARIES} - ${Qt5Bluetooth_LIBRARIES} - ${Qt5Network_LIBRARIES} - ${Qt5MultimediaWidgets_LIBRARIES} - ${PROTOBUF_LIBRARIES} - ${AASDK_PROTO_LIBRARIES}) +target_link_libraries( + btservice + aap_protobuf + ${Boost_LIBRARIES} + ${Qt5Bluetooth_LIBRARIES} + ${Qt5Network_LIBRARIES} + ${Qt5MultimediaWidgets_LIBRARIES} + ${PROTOBUF_LIBRARIES}) diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b17a21c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,3 @@ +FROM scratch +ADD rootfs.tar.xz / +CMD ["bash"] \ No newline at end of file diff --git a/include/f1x/openauto/autoapp/App.hpp b/include/f1x/openauto/autoapp/App.hpp index 4ecd245..0af1e18 100644 --- a/include/f1x/openauto/autoapp/App.hpp +++ b/include/f1x/openauto/autoapp/App.hpp @@ -18,11 +18,11 @@ #pragma once -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include diff --git a/include/f1x/openauto/autoapp/Configuration/Configuration.hpp b/include/f1x/openauto/autoapp/Configuration/Configuration.hpp index c908cc6..e077135 100644 --- a/include/f1x/openauto/autoapp/Configuration/Configuration.hpp +++ b/include/f1x/openauto/autoapp/Configuration/Configuration.hpp @@ -23,6 +23,7 @@ #include #include #include + #include namespace f1x @@ -88,10 +89,10 @@ public: QString readFileContent(QString fileName) const override; QString getParamFromFile(QString fileName, QString searchString) const override; - aasdk::proto::enums::VideoFPS::Enum getVideoFPS() const override; - void setVideoFPS(aasdk::proto::enums::VideoFPS::Enum value) override; - aasdk::proto::enums::VideoResolution::Enum getVideoResolution() const override; - void setVideoResolution(aasdk::proto::enums::VideoResolution::Enum value) override; + aap_protobuf::service::media::shared::message::VideoFrameRateType getVideoFPS() const override; + void setVideoFPS(aap_protobuf::service::media::shared::message::VideoFrameRateType value) override; + aap_protobuf::service::media::shared::message::VideoCodecResolutionType getVideoResolution() const override; + void setVideoResolution(aap_protobuf::service::media::shared::message::VideoCodecResolutionType value) override; size_t getScreenDPI() const override; void setScreenDPI(size_t value) override; void setOMXLayerIndex(int32_t value) override; @@ -113,14 +114,18 @@ public: bool musicAudioChannelEnabled() const override; void setMusicAudioChannelEnabled(bool value) override; - bool speechAudioChannelEnabled() const override; - void setSpeechAudioChannelEnabled(bool value) override; + bool guidanceAudioChannelEnabled() const override; + void setGuidanceAudioChannelEnabled(bool value) override; + bool systemAudioChannelEnabled() const override; + void setSystemAudioChannelEnabled(bool value) override; + bool telephonyAudioChannelEnabled() const override; + void setTelephonyAudioChannelEnabled(bool value) override; + AudioOutputBackendType getAudioOutputBackendType() const override; void setAudioOutputBackendType(AudioOutputBackendType value) override; - private: void readButtonCodes(boost::property_tree::ptree& iniConfig); - void insertButtonCode(boost::property_tree::ptree& iniConfig, const std::string& buttonCodeKey, aasdk::proto::enums::ButtonCode::Enum buttonCode); + void insertButtonCode(boost::property_tree::ptree& iniConfig, const std::string& buttonCodeKey, aap_protobuf::service::media::sink::KeyCode buttonCode); void writeButtonCodes(boost::property_tree::ptree& iniConfig); HandednessOfTrafficType handednessOfTrafficType_; @@ -143,8 +148,8 @@ private: bool showAutoPlay_; bool instantPlay_; - aasdk::proto::enums::VideoFPS::Enum videoFPS_; - aasdk::proto::enums::VideoResolution::Enum videoResolution_; + aap_protobuf::service::media::shared::message::VideoFrameRateType videoFPS_; + aap_protobuf::service::media::shared::message::VideoCodecResolutionType videoResolution_; size_t screenDPI_; int32_t omxLayerIndex_; QRect videoMargins_; @@ -153,8 +158,11 @@ private: ButtonCodes buttonCodes_; BluetoothAdapterType bluetoothAdapterType_; std::string bluetoothRemoteAdapterAddress_; - bool musicAudioChannelEnabled_; - bool speechAudiochannelEnabled_; + bool _audioChannelEnabledMedia; + bool _audioChannelEnabledGuidance; + bool _audioChannelEnabledSystem; + bool _audioChannelEnabledTelephony; + AudioOutputBackendType audioOutputBackendType_; static const std::string cConfigFileName; @@ -188,8 +196,15 @@ private: static const std::string cVideoMarginWidth; static const std::string cVideoMarginHeight; - static const std::string cAudioMusicAudioChannelEnabled; - static const std::string cAudioSpeechAudioChannelEnabled; + struct Audio { + struct Channel { + static const std::string cMediaEnabled; + static const std::string cGuidanceEnabled; + static const std::string cSystemEnabled; + static const std::string cTelephonyEnabled; + }; + }; + static const std::string cAudioOutputBackendType; static const std::string cBluetoothAdapterTypeKey; diff --git a/include/f1x/openauto/autoapp/Configuration/IConfiguration.hpp b/include/f1x/openauto/autoapp/Configuration/IConfiguration.hpp index db22bc8..a34678a 100644 --- a/include/f1x/openauto/autoapp/Configuration/IConfiguration.hpp +++ b/include/f1x/openauto/autoapp/Configuration/IConfiguration.hpp @@ -20,9 +20,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include #include @@ -40,7 +40,7 @@ class IConfiguration { public: typedef std::shared_ptr Pointer; - typedef std::vector ButtonCodes; + typedef std::vector ButtonCodes; virtual ~IConfiguration() = default; @@ -92,10 +92,10 @@ public: virtual QString readFileContent(QString fileName) const = 0; virtual QString getParamFromFile(QString fileName, QString searchString) const = 0; - virtual aasdk::proto::enums::VideoFPS::Enum getVideoFPS() const = 0; - virtual void setVideoFPS(aasdk::proto::enums::VideoFPS::Enum value) = 0; - virtual aasdk::proto::enums::VideoResolution::Enum getVideoResolution() const = 0; - virtual void setVideoResolution(aasdk::proto::enums::VideoResolution::Enum value) = 0; + virtual aap_protobuf::service::media::shared::message::VideoFrameRateType getVideoFPS() const = 0; + virtual void setVideoFPS(aap_protobuf::service::media::shared::message::VideoFrameRateType value) = 0; + virtual aap_protobuf::service::media::shared::message::VideoCodecResolutionType getVideoResolution() const = 0; + virtual void setVideoResolution(aap_protobuf::service::media::shared::message::VideoCodecResolutionType value) = 0; virtual size_t getScreenDPI() const = 0; virtual void setScreenDPI(size_t value) = 0; virtual void setOMXLayerIndex(int32_t value) = 0; @@ -117,8 +117,12 @@ public: virtual bool musicAudioChannelEnabled() const = 0; virtual void setMusicAudioChannelEnabled(bool value) = 0; - virtual bool speechAudioChannelEnabled() const = 0; - virtual void setSpeechAudioChannelEnabled(bool value) = 0; + virtual bool guidanceAudioChannelEnabled() const = 0; + virtual void setGuidanceAudioChannelEnabled(bool value) = 0; + virtual bool systemAudioChannelEnabled() const = 0; + virtual void setSystemAudioChannelEnabled(bool value) = 0; + virtual bool telephonyAudioChannelEnabled() const = 0; + virtual void setTelephonyAudioChannelEnabled(bool value) = 0; virtual AudioOutputBackendType getAudioOutputBackendType() const = 0; virtual void setAudioOutputBackendType(AudioOutputBackendType value) = 0; }; diff --git a/include/f1x/openauto/autoapp/Projection/IAudioInput.hpp b/include/f1x/openauto/autoapp/Projection/IAudioInput.hpp index 67c3373..a85d588 100644 --- a/include/f1x/openauto/autoapp/Projection/IAudioInput.hpp +++ b/include/f1x/openauto/autoapp/Projection/IAudioInput.hpp @@ -19,8 +19,8 @@ #pragma once #include -#include -#include +#include +#include namespace f1x { diff --git a/include/f1x/openauto/autoapp/Projection/IAudioOutput.hpp b/include/f1x/openauto/autoapp/Projection/IAudioOutput.hpp index c41de31..aaec03a 100644 --- a/include/f1x/openauto/autoapp/Projection/IAudioOutput.hpp +++ b/include/f1x/openauto/autoapp/Projection/IAudioOutput.hpp @@ -19,8 +19,8 @@ #pragma once #include -#include -#include +#include +#include namespace f1x { diff --git a/include/f1x/openauto/autoapp/Projection/IBluetoothDevice.hpp b/include/f1x/openauto/autoapp/Projection/IBluetoothDevice.hpp index 2d151fd..e5794cb 100644 --- a/include/f1x/openauto/autoapp/Projection/IBluetoothDevice.hpp +++ b/include/f1x/openauto/autoapp/Projection/IBluetoothDevice.hpp @@ -16,7 +16,7 @@ * along with openauto. If not, see . */ -#include +#include #pragma once diff --git a/include/f1x/openauto/autoapp/Projection/IInputDevice.hpp b/include/f1x/openauto/autoapp/Projection/IInputDevice.hpp index 663fbbd..dc97b2c 100644 --- a/include/f1x/openauto/autoapp/Projection/IInputDevice.hpp +++ b/include/f1x/openauto/autoapp/Projection/IInputDevice.hpp @@ -19,7 +19,7 @@ #pragma once #include -#include +#include #include namespace f1x @@ -37,7 +37,7 @@ class IInputDevice { public: typedef std::shared_ptr Pointer; - typedef std::vector ButtonCodes; + typedef std::vector ButtonCodes; virtual ~IInputDevice() = default; virtual void start(IInputDeviceEventHandler& eventHandler) = 0; diff --git a/include/f1x/openauto/autoapp/Projection/IVideoOutput.hpp b/include/f1x/openauto/autoapp/Projection/IVideoOutput.hpp index ef0f91c..668c329 100644 --- a/include/f1x/openauto/autoapp/Projection/IVideoOutput.hpp +++ b/include/f1x/openauto/autoapp/Projection/IVideoOutput.hpp @@ -20,9 +20,10 @@ #include #include -#include -#include -#include +#include +#include +#include +#include namespace f1x { @@ -43,13 +44,14 @@ public: virtual bool open() = 0; virtual bool init() = 0; - virtual void write(uint64_t timestamp, const aasdk::common::DataConstBuffer& buffer) = 0; + virtual void write(aasdk::messenger::Timestamp::ValueType timestamp, const aasdk::common::DataConstBuffer& buffer) = 0; virtual void stop() = 0; - virtual aasdk::proto::enums::VideoFPS::Enum getVideoFPS() const = 0; - virtual aasdk::proto::enums::VideoResolution::Enum getVideoResolution() const = 0; + virtual aap_protobuf::service::media::shared::message::VideoFrameRateType getVideoFPS() const = 0; + virtual aap_protobuf::service::media::shared::message::VideoCodecResolutionType getVideoResolution() const = 0; virtual size_t getScreenDPI() const = 0; virtual QRect getVideoMargins() const = 0; + }; } diff --git a/include/f1x/openauto/autoapp/Projection/InputEvent.hpp b/include/f1x/openauto/autoapp/Projection/InputEvent.hpp index fe22064..7e4f92a 100644 --- a/include/f1x/openauto/autoapp/Projection/InputEvent.hpp +++ b/include/f1x/openauto/autoapp/Projection/InputEvent.hpp @@ -18,9 +18,9 @@ #pragma once -#include -#include -#include +#include +#include +#include namespace f1x { @@ -49,12 +49,12 @@ struct ButtonEvent { ButtonEventType type; WheelDirection wheelDirection; - aasdk::proto::enums::ButtonCode::Enum code; + aap_protobuf::service::media::sink::KeyCode code; }; struct TouchEvent { - aasdk::proto::enums::TouchAction::Enum type; + aap_protobuf::service::input::message::TouchAction type; uint32_t x; uint32_t y; uint32_t pointerId; diff --git a/include/f1x/openauto/autoapp/Projection/SequentialBuffer.hpp b/include/f1x/openauto/autoapp/Projection/SequentialBuffer.hpp index 153b687..179aabe 100644 --- a/include/f1x/openauto/autoapp/Projection/SequentialBuffer.hpp +++ b/include/f1x/openauto/autoapp/Projection/SequentialBuffer.hpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include namespace f1x { diff --git a/include/f1x/openauto/autoapp/Projection/VideoOutput.hpp b/include/f1x/openauto/autoapp/Projection/VideoOutput.hpp index 3c67cf6..098fae3 100644 --- a/include/f1x/openauto/autoapp/Projection/VideoOutput.hpp +++ b/include/f1x/openauto/autoapp/Projection/VideoOutput.hpp @@ -35,8 +35,8 @@ class VideoOutput: public IVideoOutput public: VideoOutput(configuration::IConfiguration::Pointer configuration); - aasdk::proto::enums::VideoFPS::Enum getVideoFPS() const override; - aasdk::proto::enums::VideoResolution::Enum getVideoResolution() const override; + aap_protobuf::service::media::shared::message::VideoFrameRateType getVideoFPS() const override; + aap_protobuf::service::media::shared::message::VideoCodecResolutionType getVideoResolution() const override; size_t getScreenDPI() const override; QRect getVideoMargins() const override; diff --git a/include/f1x/openauto/autoapp/Service/AndroidAutoEntity.hpp b/include/f1x/openauto/autoapp/Service/AndroidAutoEntity.hpp index 0ae914c..a30381f 100644 --- a/include/f1x/openauto/autoapp/Service/AndroidAutoEntity.hpp +++ b/include/f1x/openauto/autoapp/Service/AndroidAutoEntity.hpp @@ -19,10 +19,10 @@ #pragma once #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include @@ -53,14 +53,17 @@ public: void stop() override; void pause() override; void resume() override; - void onVersionResponse(uint16_t majorCode, uint16_t minorCode, aasdk::proto::enums::VersionResponseStatus::Enum status) override; + // TODO: on channel open request... on channel close... on navigation focus, on voice session notification, on user switch, on call availability, on service disc update, on battery status, on car connected devices + void onVersionResponse(uint16_t majorCode, uint16_t minorCode, aap_protobuf::shared::MessageStatus status) override; void onHandshake(const aasdk::common::DataConstBuffer& payload) override; - void onServiceDiscoveryRequest(const aasdk::proto::messages::ServiceDiscoveryRequest& request) override; - void onAudioFocusRequest(const aasdk::proto::messages::AudioFocusRequest& request) override; - void onShutdownRequest(const aasdk::proto::messages::ShutdownRequest& request) override; - void onShutdownResponse(const aasdk::proto::messages::ShutdownResponse& response) override; - void onNavigationFocusRequest(const aasdk::proto::messages::NavigationFocusRequest& request) override; - void onPingResponse(const aasdk::proto::messages::PingResponse& response) override; + void onServiceDiscoveryRequest(const aap_protobuf::channel::control::servicediscovery::event::ServiceDiscoveryRequest& request) override; + void onAudioFocusRequest(const aap_protobuf::channel::control::focus::audio::event::AudioFocusRequest& request) override; + void onByeByeRequest(const aap_protobuf::channel::control::byebye::event::ByeByeRequest& request) override; + void onByeByeResponse(const aap_protobuf::channel::control::byebye::notification::ByeByeResponse& response) override; + void onNavigationFocusRequest(const aap_protobuf::channel::control::focus::navigation::event::NavFocusRequestNotification& request) override; + void onVoiceSessionRequest(const aap_protobuf::channel::control::voice::VoiceSessionNotification &request) override; + void onPingResponse(const aap_protobuf::channel::control::ping::PingResponse& response) override; + void onPingRequest(const aap_protobuf::channel::control::ping::PingRequest& request) override; void onChannelError(const aasdk::error::Error& e) override; private: diff --git a/include/f1x/openauto/autoapp/Service/AndroidAutoEntityFactory.hpp b/include/f1x/openauto/autoapp/Service/AndroidAutoEntityFactory.hpp index b9fed4f..9c45e27 100644 --- a/include/f1x/openauto/autoapp/Service/AndroidAutoEntityFactory.hpp +++ b/include/f1x/openauto/autoapp/Service/AndroidAutoEntityFactory.hpp @@ -19,7 +19,7 @@ #pragma once #include -#include +#include #include #include #include diff --git a/include/f1x/openauto/autoapp/Service/AudioInputService.hpp b/include/f1x/openauto/autoapp/Service/AudioInputService.hpp deleted file mode 100644 index c8e56c2..0000000 --- a/include/f1x/openauto/autoapp/Service/AudioInputService.hpp +++ /dev/null @@ -1,67 +0,0 @@ -/* -* 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 . -*/ - -#pragma once - -#include -#include -#include - -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace service -{ - -class AudioInputService: public aasdk::channel::av::IAVInputServiceChannelEventHandler, public IService, public std::enable_shared_from_this -{ -public: - typedef std::shared_ptr Pointer; - - AudioInputService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, projection::IAudioInput::Pointer audioInput); - - void start() override; - void stop() override; - void pause() override; - void resume() override; - void fillFeatures(aasdk::proto::messages::ServiceDiscoveryResponse& response) override; - void onChannelOpenRequest(const aasdk::proto::messages::ChannelOpenRequest& request) override; - void onAVChannelSetupRequest(const aasdk::proto::messages::AVChannelSetupRequest& request) override; - void onAVInputOpenRequest(const aasdk::proto::messages::AVInputOpenRequest& request) override; - void onAVMediaAckIndication(const aasdk::proto::messages::AVMediaAckIndication& indication) override; - void onChannelError(const aasdk::error::Error& e) override; - -private: - using std::enable_shared_from_this::shared_from_this; - void onAudioInputOpenSucceed(); - void onAudioInputDataReady(aasdk::common::Data data); - void readAudioInput(); - - boost::asio::io_service::strand strand_; - aasdk::channel::av::AVInputServiceChannel::Pointer channel_; - projection::IAudioInput::Pointer audioInput_; - int32_t session_; -}; - -} -} -} -} diff --git a/include/f1x/openauto/autoapp/Service/AudioService.hpp b/include/f1x/openauto/autoapp/Service/AudioService.hpp deleted file mode 100644 index 034ddec..0000000 --- a/include/f1x/openauto/autoapp/Service/AudioService.hpp +++ /dev/null @@ -1,67 +0,0 @@ -/* -* 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 . -*/ - -#pragma once - -#include -#include -#include -#include - -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace service -{ - -class AudioService: public aasdk::channel::av::IAudioServiceChannelEventHandler, public IService, public std::enable_shared_from_this -{ -public: - typedef std::shared_ptr Pointer; - - AudioService(boost::asio::io_service& ioService, aasdk::channel::av::IAudioServiceChannel::Pointer channel, projection::IAudioOutput::Pointer audioOutput); - - void start() override; - void stop() override; - void pause() override; - void resume() override; - void fillFeatures(aasdk::proto::messages::ServiceDiscoveryResponse& response) override; - void onChannelOpenRequest(const aasdk::proto::messages::ChannelOpenRequest& request) override; - void onAVChannelSetupRequest(const aasdk::proto::messages::AVChannelSetupRequest& request) override; - void onAVChannelStartIndication(const aasdk::proto::messages::AVChannelStartIndication& indication) override; - void onAVChannelStopIndication(const aasdk::proto::messages::AVChannelStopIndication& indication) override; - void onAVMediaWithTimestampIndication(aasdk::messenger::Timestamp::ValueType timestamp, const aasdk::common::DataConstBuffer& buffer) override; - void onAVMediaIndication(const aasdk::common::DataConstBuffer& buffer) override; - void onChannelError(const aasdk::error::Error& e) override; - -protected: - using std::enable_shared_from_this::shared_from_this; - - boost::asio::io_service::strand strand_; - aasdk::channel::av::IAudioServiceChannel::Pointer channel_; - projection::IAudioOutput::Pointer audioOutput_; - int32_t session_; -}; - -} -} -} -} diff --git a/include/f1x/openauto/autoapp/Service/Bluetooth/BluetoothService.hpp b/include/f1x/openauto/autoapp/Service/Bluetooth/BluetoothService.hpp new file mode 100644 index 0000000..b6bd3fa --- /dev/null +++ b/include/f1x/openauto/autoapp/Service/Bluetooth/BluetoothService.hpp @@ -0,0 +1,66 @@ +/* +* 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 . +*/ + +#pragma once + +#include +#include +#include + +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace bluetooth { + + class BluetoothService + : public aasdk::channel::bluetooth::IBluetoothServiceEventHandler, + public IService, + public std::enable_shared_from_this { + public: + BluetoothService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger, + projection::IBluetoothDevice::Pointer bluetoothDevice); + + void start() override; + void stop() override; + void pause() override; + void resume() override; + void fillFeatures(aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) override; + + void onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) override; + + void onBluetoothPairingRequest( + const aap_protobuf::channel::bluetooth::event::BluetoothPairingRequest &request) override; + + void onChannelError(const aasdk::error::Error &e) override; + + + private: + using std::enable_shared_from_this::shared_from_this; + + boost::asio::io_service::strand strand_; + aasdk::channel::bluetooth::BluetoothService::Pointer channel_; + projection::IBluetoothDevice::Pointer bluetoothDevice_; + }; + + } + } + } + } +} \ No newline at end of file diff --git a/include/f1x/openauto/autoapp/Service/BluetoothService.hpp b/include/f1x/openauto/autoapp/Service/BluetoothService.hpp deleted file mode 100644 index 27b46d8..0000000 --- a/include/f1x/openauto/autoapp/Service/BluetoothService.hpp +++ /dev/null @@ -1,58 +0,0 @@ -/* -* 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 . -*/ - -#pragma once - -#include -#include -#include - -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace service -{ - -class BluetoothService: public aasdk::channel::bluetooth::IBluetoothServiceChannelEventHandler, public IService, public std::enable_shared_from_this -{ -public: - BluetoothService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, projection::IBluetoothDevice::Pointer bluetoothDevice); - void start() override; - void stop() override; - void pause() override; - void resume() override; - void fillFeatures(aasdk::proto::messages::ServiceDiscoveryResponse& response) override; - void onChannelOpenRequest(const aasdk::proto::messages::ChannelOpenRequest& request) override; - void onBluetoothPairingRequest(const aasdk::proto::messages::BluetoothPairingRequest& request) override; - void onChannelError(const aasdk::error::Error& e) override; - -private: - using std::enable_shared_from_this::shared_from_this; - - boost::asio::io_service::strand strand_; - aasdk::channel::bluetooth::BluetoothServiceChannel::Pointer channel_; - projection::IBluetoothDevice::Pointer bluetoothDevice_; -}; - -} -} -} -} diff --git a/include/f1x/openauto/autoapp/Service/GenericNotification/GenericNotificationService.hpp b/include/f1x/openauto/autoapp/Service/GenericNotification/GenericNotificationService.hpp new file mode 100644 index 0000000..b4a9da5 --- /dev/null +++ b/include/f1x/openauto/autoapp/Service/GenericNotification/GenericNotificationService.hpp @@ -0,0 +1,61 @@ +/* +* 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 . +*/ + +#pragma once + +#include +#include +#include +#include + +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace genericnotification { + + class GenericNotificationService : + public aasdk::channel::genericnotification::IGenericNotificationServiceEventHandler, + public IService, + public std::enable_shared_from_this { + public: + GenericNotificationService(boost::asio::io_service &ioService, aasdk::messenger::IMessenger::Pointer messenger); + + void start() override; + void stop() override; + void pause() override; + void resume() override; + void fillFeatures(aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) override; + + void onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) override; + + void onChannelError(const aasdk::error::Error &e) override; + + + private: + using std::enable_shared_from_this::shared_from_this; + boost::asio::deadline_timer timer_; + boost::asio::io_service::strand strand_; + aasdk::channel::genericnotification::GenericNotificationService::Pointer channel_; + }; + + } + } + } + } +} \ No newline at end of file diff --git a/include/f1x/openauto/autoapp/Service/IAndroidAutoEntityEventHandler.hpp b/include/f1x/openauto/autoapp/Service/IAndroidAutoEntityEventHandler.hpp index 648d125..2ae816d 100644 --- a/include/f1x/openauto/autoapp/Service/IAndroidAutoEntityEventHandler.hpp +++ b/include/f1x/openauto/autoapp/Service/IAndroidAutoEntityEventHandler.hpp @@ -18,7 +18,7 @@ #pragma once -#include +#include namespace f1x { diff --git a/include/f1x/openauto/autoapp/Service/IAndroidAutoEntityFactory.hpp b/include/f1x/openauto/autoapp/Service/IAndroidAutoEntityFactory.hpp index 97b958b..5a174fd 100644 --- a/include/f1x/openauto/autoapp/Service/IAndroidAutoEntityFactory.hpp +++ b/include/f1x/openauto/autoapp/Service/IAndroidAutoEntityFactory.hpp @@ -18,8 +18,8 @@ #pragma once -#include -#include +#include +#include #include namespace f1x diff --git a/include/f1x/openauto/autoapp/Service/IPinger.hpp b/include/f1x/openauto/autoapp/Service/IPinger.hpp index d345ed3..c283c88 100644 --- a/include/f1x/openauto/autoapp/Service/IPinger.hpp +++ b/include/f1x/openauto/autoapp/Service/IPinger.hpp @@ -18,7 +18,7 @@ #pragma once -#include +#include namespace f1x { diff --git a/include/f1x/openauto/autoapp/Service/IService.hpp b/include/f1x/openauto/autoapp/Service/IService.hpp index 7c66f49..5a8a91a 100644 --- a/include/f1x/openauto/autoapp/Service/IService.hpp +++ b/include/f1x/openauto/autoapp/Service/IService.hpp @@ -20,7 +20,9 @@ #include #include -#include +#include +#include +#include namespace f1x { @@ -42,7 +44,7 @@ public: virtual void stop() = 0; virtual void pause() = 0; virtual void resume() = 0; - virtual void fillFeatures(aasdk::proto::messages::ServiceDiscoveryResponse& response) = 0; + virtual void fillFeatures(aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse& response) = 0; }; typedef std::vector ServiceList; diff --git a/include/f1x/openauto/autoapp/Service/IServiceFactory.hpp b/include/f1x/openauto/autoapp/Service/IServiceFactory.hpp index 6049d9d..e7d724a 100644 --- a/include/f1x/openauto/autoapp/Service/IServiceFactory.hpp +++ b/include/f1x/openauto/autoapp/Service/IServiceFactory.hpp @@ -18,7 +18,7 @@ #pragma once -#include +#include #include namespace f1x diff --git a/include/f1x/openauto/autoapp/Service/InputService.hpp b/include/f1x/openauto/autoapp/Service/InputService.hpp deleted file mode 100644 index 03ed01b..0000000 --- a/include/f1x/openauto/autoapp/Service/InputService.hpp +++ /dev/null @@ -1,67 +0,0 @@ -/* -* 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 . -*/ - -#pragma once - -#include -#include -#include -#include -#include - -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace service -{ - -class InputService: - public aasdk::channel::input::IInputServiceChannelEventHandler, - public IService, - public projection::IInputDeviceEventHandler, - public std::enable_shared_from_this -{ -public: - InputService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, projection::IInputDevice::Pointer inputDevice); - - void start() override; - void stop() override; - void pause() override; - void resume() override; - void fillFeatures(aasdk::proto::messages::ServiceDiscoveryResponse& response) override; - void onChannelOpenRequest(const aasdk::proto::messages::ChannelOpenRequest& request) override; - void onBindingRequest(const aasdk::proto::messages::BindingRequest& request) override; - void onChannelError(const aasdk::error::Error& e) override; - void onButtonEvent(const projection::ButtonEvent& event) override; - void onTouchEvent(const projection::TouchEvent& event) override; - -private: - using std::enable_shared_from_this::shared_from_this; - - boost::asio::io_service::strand strand_; - aasdk::channel::input::InputServiceChannel::Pointer channel_; - projection::IInputDevice::Pointer inputDevice_; -}; - -} -} -} -} diff --git a/include/f1x/openauto/autoapp/Service/InputSource/InputSourceService.hpp b/include/f1x/openauto/autoapp/Service/InputSource/InputSourceService.hpp new file mode 100644 index 0000000..adc5816 --- /dev/null +++ b/include/f1x/openauto/autoapp/Service/InputSource/InputSourceService.hpp @@ -0,0 +1,71 @@ +/* +* 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 . +*/ + +#pragma once + +#include +#include +#include +#include +#include + +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace inputsource { + + class InputSourceService : + public aasdk::channel::inputsource::IInputSourceServiceEventHandler, + public IService, + public projection::IInputDeviceEventHandler, + public std::enable_shared_from_this { + public: + InputSourceService(boost::asio::io_service &ioService, aasdk::messenger::IMessenger::Pointer messenger, + projection::IInputDevice::Pointer inputDevice); + + void start() override; + void stop() override; + void pause() override; + void resume() override; + void fillFeatures(aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) override; + + + void onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) override; + + void onBindingRequest(const aap_protobuf::channel::input::event::BindingRequest &request) override; + + void onChannelError(const aasdk::error::Error &e) override; + + void onButtonEvent(const projection::ButtonEvent &event) override; + + void onTouchEvent(const projection::TouchEvent &event) override; + + private: + using std::enable_shared_from_this::shared_from_this; + + boost::asio::io_service::strand strand_; + aasdk::channel::inputsource::InputSourceService::Pointer channel_; + projection::IInputDevice::Pointer inputDevice_; + }; + + } + } + } + } +} \ No newline at end of file diff --git a/include/f1x/openauto/autoapp/Service/MediaBrowser/MediaBrowserService.hpp b/include/f1x/openauto/autoapp/Service/MediaBrowser/MediaBrowserService.hpp new file mode 100644 index 0000000..e2455b9 --- /dev/null +++ b/include/f1x/openauto/autoapp/Service/MediaBrowser/MediaBrowserService.hpp @@ -0,0 +1,61 @@ +/* +* 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 . +*/ + +#pragma once + +#include +#include +#include +#include + +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace mediabrowser { + + class MediaBrowserService : + public aasdk::channel::mediabrowser::IMediaBrowserServiceEventHandler, + public IService, + public std::enable_shared_from_this { + public: + MediaBrowserService(boost::asio::io_service &ioService, aasdk::messenger::IMessenger::Pointer messenger); + + void start() override; + void stop() override; + void pause() override; + void resume() override; + void fillFeatures(aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) override; + + void onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) override; + + void onChannelError(const aasdk::error::Error &e) override; + + + private: + using std::enable_shared_from_this::shared_from_this; + boost::asio::deadline_timer timer_; + boost::asio::io_service::strand strand_; + aasdk::channel::mediabrowser::MediaBrowserService::Pointer channel_; + }; + + } + } + } + } +} \ No newline at end of file diff --git a/include/f1x/openauto/autoapp/Service/MediaPlaybackStatus/MediaPlaybackStatusService.hpp b/include/f1x/openauto/autoapp/Service/MediaPlaybackStatus/MediaPlaybackStatusService.hpp new file mode 100644 index 0000000..c4d543b --- /dev/null +++ b/include/f1x/openauto/autoapp/Service/MediaPlaybackStatus/MediaPlaybackStatusService.hpp @@ -0,0 +1,61 @@ +/* +* 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 . +*/ + +#pragma once + +#include +#include +#include +#include + +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace mediaplaybackstatus { + + class MediaPlaybackStatusService : + public aasdk::channel::mediaplaybackstatus::IMediaPlaybackStatusServiceEventHandler, + public IService, + public std::enable_shared_from_this { + public: + MediaPlaybackStatusService(boost::asio::io_service &ioService, aasdk::messenger::IMessenger::Pointer messenger); + + void start() override; + void stop() override; + void pause() override; + void resume() override; + void fillFeatures(aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) override; + + void onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) override; + + void onChannelError(const aasdk::error::Error &e) override; + + + private: + using std::enable_shared_from_this::shared_from_this; + boost::asio::deadline_timer timer_; + boost::asio::io_service::strand strand_; + aasdk::channel::mediaplaybackstatus::MediaPlaybackStatusService::Pointer channel_; + }; + + } + } + } + } +} \ No newline at end of file diff --git a/include/f1x/openauto/autoapp/Service/MediaSink/AudioMediaSinkService.hpp b/include/f1x/openauto/autoapp/Service/MediaSink/AudioMediaSinkService.hpp new file mode 100644 index 0000000..b46f1ea --- /dev/null +++ b/include/f1x/openauto/autoapp/Service/MediaSink/AudioMediaSinkService.hpp @@ -0,0 +1,78 @@ +/* +* 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 . +*/ + +#pragma once +#include +#include +#include +#include +#include + +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace mediasink { + class AudioMediaSinkService : + public aasdk::channel::mediasink::audio::IAudioMediaSinkServiceEventHandler, + public IService, + public std::enable_shared_from_this { + public: + typedef std::shared_ptr Pointer; + + // General Constructor + AudioMediaSinkService(boost::asio::io_service& ioService, + aasdk::channel::mediasink::audio::IAudioMediaSinkService::Pointer channel, + projection::IAudioOutput::Pointer audioOutput); + + void start() override; + void stop() override; + void pause() override; + void resume() override; + void fillFeatures(aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) override; + + void onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) override; + + void onMediaChannelSetupRequest( + const aap_protobuf::channel::media::event::Setup &request) override; + + void onMediaChannelStartIndication( + const aap_protobuf::channel::media::event::Start &indication) override; + + void onMediaChannelStopIndication( + const aap_protobuf::channel::media::event::Stop &indication) override; + + void onMediaWithTimestampIndication(aasdk::messenger::Timestamp::ValueType timestamp, + const aasdk::common::DataConstBuffer &buffer) override; + + void onMediaIndication(const aasdk::common::DataConstBuffer &buffer) override; + + void onChannelError(const aasdk::error::Error &e) override; + + protected: + using std::enable_shared_from_this::shared_from_this; + boost::asio::io_service::strand strand_; + aasdk::channel::mediasink::audio::IAudioMediaSinkService::Pointer channel_; + projection::IAudioOutput::Pointer audioOutput_; + int32_t session_; + }; + } + } + } + } +} \ No newline at end of file diff --git a/include/f1x/openauto/autoapp/Service/SystemAudioService.hpp b/include/f1x/openauto/autoapp/Service/MediaSink/GuidanceAudioService.hpp similarity index 54% rename from include/f1x/openauto/autoapp/Service/SystemAudioService.hpp rename to include/f1x/openauto/autoapp/Service/MediaSink/GuidanceAudioService.hpp index af775b2..62d3bcc 100644 --- a/include/f1x/openauto/autoapp/Service/SystemAudioService.hpp +++ b/include/f1x/openauto/autoapp/Service/MediaSink/GuidanceAudioService.hpp @@ -18,25 +18,24 @@ #pragma once -#include -#include +#include +#include -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace service -{ +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace mediasink { + class GuidanceAudioService : public AudioMediaSinkService { + public: + GuidanceAudioService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger, + projection::IAudioOutput::Pointer audioOutput); -class SystemAudioService: public AudioService -{ -public: - SystemAudioService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, projection::IAudioOutput::Pointer audioOutput); -}; + }; -} -} -} -} + } + } + } + } +} \ No newline at end of file diff --git a/include/f1x/openauto/autoapp/Service/MediaAudioService.hpp b/include/f1x/openauto/autoapp/Service/MediaSink/MediaAudioService.hpp similarity index 54% rename from include/f1x/openauto/autoapp/Service/MediaAudioService.hpp rename to include/f1x/openauto/autoapp/Service/MediaSink/MediaAudioService.hpp index bbd1414..d279405 100644 --- a/include/f1x/openauto/autoapp/Service/MediaAudioService.hpp +++ b/include/f1x/openauto/autoapp/Service/MediaSink/MediaAudioService.hpp @@ -18,25 +18,24 @@ #pragma once -#include -#include +#include +#include -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace service -{ -class MediaAudioService: public AudioService -{ -public: - MediaAudioService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, projection::IAudioOutput::Pointer audioOutput); -}; +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace mediasink { + class MediaAudioService : public AudioMediaSinkService { + public: + MediaAudioService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger, + projection::IAudioOutput::Pointer audioOutput); + }; -} -} -} -} + } + } + } + } +} \ No newline at end of file diff --git a/src/autoapp/Service/MediaAudioService.cpp b/include/f1x/openauto/autoapp/Service/MediaSink/SystemAudioService.hpp similarity index 50% rename from src/autoapp/Service/MediaAudioService.cpp rename to include/f1x/openauto/autoapp/Service/MediaSink/SystemAudioService.hpp index b754d21..82ee072 100644 --- a/src/autoapp/Service/MediaAudioService.cpp +++ b/include/f1x/openauto/autoapp/Service/MediaSink/SystemAudioService.hpp @@ -16,25 +16,28 @@ * along with openauto. If not, see . */ -#include -#include +#pragma once -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace service -{ +#include +#include -MediaAudioService::MediaAudioService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, projection::IAudioOutput::Pointer audioOutput) - : AudioService(ioService, std::make_shared(strand_, std::move(messenger)), std::move(audioOutput)) -{ +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace mediasink { + class SystemAudioService : public AudioMediaSinkService { + public: + SystemAudioService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger, + projection::IAudioOutput::Pointer audioOutput); -} + protected: + projection::IAudioOutput::Pointer audioOutput_; + }; -} -} -} -} + } + } + } + } +} \ No newline at end of file diff --git a/include/f1x/openauto/autoapp/Service/MediaSink/TelephonyAudioService.hpp b/include/f1x/openauto/autoapp/Service/MediaSink/TelephonyAudioService.hpp new file mode 100644 index 0000000..d3dcacd --- /dev/null +++ b/include/f1x/openauto/autoapp/Service/MediaSink/TelephonyAudioService.hpp @@ -0,0 +1,44 @@ +/* +* 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 . +*/ + +#pragma once + +#include +#include + + +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace mediasink { + class TelephonyAudioService : public AudioMediaSinkService { + public: + TelephonyAudioService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger, + projection::IAudioOutput::Pointer audioOutput); + + protected: + projection::IAudioOutput::Pointer audioOutput_; + }; + + } + } + } + } +} \ No newline at end of file diff --git a/include/f1x/openauto/autoapp/Service/MediaSink/VideoMediaSinkService.hpp b/include/f1x/openauto/autoapp/Service/MediaSink/VideoMediaSinkService.hpp new file mode 100644 index 0000000..11a05e0 --- /dev/null +++ b/include/f1x/openauto/autoapp/Service/MediaSink/VideoMediaSinkService.hpp @@ -0,0 +1,82 @@ +/* +* 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 . +*/ + +#pragma once + +#include +#include +#include +#include +#include + +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace mediasink { + + class VideoMediaSinkService : + public aasdk::channel::mediasink::video::IVideoMediaSinkServiceEventHandler, + public IService, + public std::enable_shared_from_this { + public: + typedef std::shared_ptr Pointer; + + // General Constructor + VideoMediaSinkService(boost::asio::io_service& ioService, + aasdk::channel::mediasink::video::IVideoMediaSinkService::Pointer channel, + projection::IVideoOutput::Pointer videoOutput); + + void start() override; + void stop() override; + void pause() override; + void resume() override; + void fillFeatures(aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) override; + + void onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) override; + + void onMediaChannelSetupRequest( + const aap_protobuf::channel::media::event::Setup &request) override; + + void onMediaChannelStartIndication( + const aap_protobuf::channel::media::event::Start &indication) override; + + void onMediaChannelStopIndication( + const aap_protobuf::channel::media::event::Stop &indication) override; + + void onMediaWithTimestampIndication(aasdk::messenger::Timestamp::ValueType timestamp, + const aasdk::common::DataConstBuffer &buffer) override; + + void onMediaIndication(const aasdk::common::DataConstBuffer &buffer) override; + + void onChannelError(const aasdk::error::Error &e) override; + + void onVideoFocusRequest(const aap_protobuf::channel::control::focus::video::event::VideoFocusRequestNotification &request) override; + void sendVideoFocusIndication(); + protected: + using std::enable_shared_from_this::shared_from_this; + boost::asio::io_service::strand strand_; + aasdk::channel::mediasink::video::IVideoMediaSinkService::Pointer channel_; + projection::IVideoOutput::Pointer videoOutput_; + int32_t session_; + }; + } + } + } + } +} \ No newline at end of file diff --git a/include/f1x/openauto/autoapp/Service/SpeechAudioService.hpp b/include/f1x/openauto/autoapp/Service/MediaSink/VideoService.hpp similarity index 52% rename from include/f1x/openauto/autoapp/Service/SpeechAudioService.hpp rename to include/f1x/openauto/autoapp/Service/MediaSink/VideoService.hpp index d71f1a9..29a56e3 100644 --- a/include/f1x/openauto/autoapp/Service/SpeechAudioService.hpp +++ b/include/f1x/openauto/autoapp/Service/MediaSink/VideoService.hpp @@ -18,25 +18,27 @@ #pragma once -#include -#include +#include +#include -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace service -{ -class SpeechAudioService: public AudioService -{ -public: - SpeechAudioService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, projection::IAudioOutput::Pointer audioOutput); -}; +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace mediasink { + class VideoService : public VideoMediaSinkService { + public: + VideoService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger, + projection::IVideoOutput::Pointer videoOutput); -} -} -} -} + protected: + projection::IVideoOutput::Pointer videoOutput; + }; + + } + } + } + } +} \ No newline at end of file diff --git a/include/f1x/openauto/autoapp/Service/MediaSource/MediaSourceService.hpp b/include/f1x/openauto/autoapp/Service/MediaSource/MediaSourceService.hpp new file mode 100644 index 0000000..214ecd8 --- /dev/null +++ b/include/f1x/openauto/autoapp/Service/MediaSource/MediaSourceService.hpp @@ -0,0 +1,91 @@ +/* +* 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 . +*/ + +#pragma once + +#include +#include +#include +#include +#include + +namespace f1x +{ +namespace openauto +{ +namespace autoapp +{ +namespace service +{ + namespace mediasource { + + + class MediaSourceService + : public aasdk::channel::mediasource::IMediaSourceServiceEventHandler, + public IService, + public std::enable_shared_from_this { + public: + typedef std::shared_ptr Pointer; + + // General Constructor + MediaSourceService(boost::asio::io_service& ioService, + aasdk::channel::mediasource::IMediaSourceService::Pointer channel, projection::IAudioInput::Pointer audioOutput); + + void start() override; + + void stop() override; + + void pause() override; + + void resume() override; + + void fillFeatures( + aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) override; + + void onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) override; + + void onMediaChannelSetupRequest( + const aap_protobuf::channel::media::event::Setup &request) override; + + void onMediaSourceOpenRequest( + const aap_protobuf::service::media::source::message::MicrophoneRequest &request) override; + + void onMediaChannelAckIndication( + const aap_protobuf::service::media::source::message::MediaSourceMediaAckIndication &indication) override; + + void onChannelError(const aasdk::error::Error &e) override; + + private: + using std::enable_shared_from_this::shared_from_this; + + void onMediaSourceOpenSuccess(); + + void onMediaSourceDataReady(aasdk::common::Data data); + + void readMediaSource(); + + boost::asio::io_service::strand strand_; + aasdk::channel::mediasource::IMediaSourceService::Pointer channel_; + projection::IAudioInput::Pointer audioInput_; + int32_t session_; + }; + } +} +} +} +} diff --git a/include/f1x/openauto/autoapp/Service/MediaSource/MicrophoneMediaSourceService.hpp b/include/f1x/openauto/autoapp/Service/MediaSource/MicrophoneMediaSourceService.hpp new file mode 100644 index 0000000..6e11a46 --- /dev/null +++ b/include/f1x/openauto/autoapp/Service/MediaSource/MicrophoneMediaSourceService.hpp @@ -0,0 +1,44 @@ +/* +* 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 . +*/ + +#pragma once + +#include +#include + + +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace mediasource { + class MicrophoneMediaSourceService : public MediaSourceService { + public: + MicrophoneMediaSourceService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger, + projection::IAudioInput::Pointer audioInput); + + protected: + projection::IAudioInput::Pointer audioInput_; + }; + + } + } + } + } +} \ No newline at end of file diff --git a/include/f1x/openauto/autoapp/Service/NavigationStatus/NavigationStatusService.hpp b/include/f1x/openauto/autoapp/Service/NavigationStatus/NavigationStatusService.hpp new file mode 100644 index 0000000..8c026e5 --- /dev/null +++ b/include/f1x/openauto/autoapp/Service/NavigationStatus/NavigationStatusService.hpp @@ -0,0 +1,61 @@ +/* +* 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 . +*/ + +#pragma once + +#include +#include +#include +#include + +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace navigationstatus { + + class NavigationStatusService : + public aasdk::channel::navigationstatus::INavigationStatusServiceEventHandler, + public IService, + public std::enable_shared_from_this { + public: + NavigationStatusService(boost::asio::io_service &ioService, aasdk::messenger::IMessenger::Pointer messenger); + + void start() override; + void stop() override; + void pause() override; + void resume() override; + void fillFeatures(aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) override; + + void onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) override; + + void onChannelError(const aasdk::error::Error &e) override; + + + private: + using std::enable_shared_from_this::shared_from_this; + boost::asio::deadline_timer timer_; + boost::asio::io_service::strand strand_; + aasdk::channel::navigationstatus::NavigationStatusService::Pointer channel_; + }; + + } + } + } + } +} \ No newline at end of file diff --git a/include/f1x/openauto/autoapp/Service/PhoneStatus/PhoneStatusService.hpp b/include/f1x/openauto/autoapp/Service/PhoneStatus/PhoneStatusService.hpp new file mode 100644 index 0000000..a5b5f2e --- /dev/null +++ b/include/f1x/openauto/autoapp/Service/PhoneStatus/PhoneStatusService.hpp @@ -0,0 +1,61 @@ +/* +* 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 . +*/ + +#pragma once + +#include +#include +#include +#include + +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace phonestatus { + + class PhoneStatusService : + public aasdk::channel::phonestatus::IPhoneStatusServiceEventHandler, + public IService, + public std::enable_shared_from_this { + public: + PhoneStatusService(boost::asio::io_service &ioService, aasdk::messenger::IMessenger::Pointer messenger); + + void start() override; + void stop() override; + void pause() override; + void resume() override; + void fillFeatures(aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) override; + + void onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) override; + + void onChannelError(const aasdk::error::Error &e) override; + + + private: + using std::enable_shared_from_this::shared_from_this; + boost::asio::deadline_timer timer_; + boost::asio::io_service::strand strand_; + aasdk::channel::phonestatus::PhoneStatusService::Pointer channel_; + }; + + } + } + } + } +} \ No newline at end of file diff --git a/include/f1x/openauto/autoapp/Service/Radio/RadioService.hpp b/include/f1x/openauto/autoapp/Service/Radio/RadioService.hpp new file mode 100644 index 0000000..305b591 --- /dev/null +++ b/include/f1x/openauto/autoapp/Service/Radio/RadioService.hpp @@ -0,0 +1,61 @@ +/* +* 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 . +*/ + +#pragma once + +#include +#include +#include +#include + +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace radio { + + class RadioService : + public aasdk::channel::radio::IRadioServiceEventHandler, + public IService, + public std::enable_shared_from_this { + public: + RadioService(boost::asio::io_service &ioService, aasdk::messenger::IMessenger::Pointer messenger); + + void start() override; + void stop() override; + void pause() override; + void resume() override; + void fillFeatures(aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) override; + + void onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) override; + + void onChannelError(const aasdk::error::Error &e) override; + + + private: + using std::enable_shared_from_this::shared_from_this; + boost::asio::deadline_timer timer_; + boost::asio::io_service::strand strand_; + aasdk::channel::radio::RadioService::Pointer channel_; + }; + + } + } + } + } +} \ No newline at end of file diff --git a/include/f1x/openauto/autoapp/Service/Sensor/SensorService.hpp b/include/f1x/openauto/autoapp/Service/Sensor/SensorService.hpp new file mode 100644 index 0000000..c57c557 --- /dev/null +++ b/include/f1x/openauto/autoapp/Service/Sensor/SensorService.hpp @@ -0,0 +1,83 @@ +/* +* 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 . +*/ + +#pragma once + +#include +#include +#include +#include +#include + +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace sensor { + class SensorService : + public aasdk::channel::sensor::ISensorServiceEventHandler, + public IService, + public std::enable_shared_from_this { + public: + SensorService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger); + + bool isNight = false; + bool previous = false; + bool stopPolling = false; + + void start() override; + void stop() override; + void pause() override; + void resume() override; + void fillFeatures(aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) override; + + void onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) override; + + void onSensorStartRequest( + const aap_protobuf::channel::sensor::event::SensorRequest &request) override; + + void onChannelError(const aasdk::error::Error &e) override; + + private: + using std::enable_shared_from_this::shared_from_this; + + void sendDrivingStatusUnrestricted(); + + void sendNightData(); + + void sendGPSLocationData(); + + bool is_file_exist(const char *filename); + + void sensorPolling(); + + bool firstRun = true; + + boost::asio::deadline_timer timer_; + boost::asio::io_service::strand strand_; + aasdk::channel::sensor::SensorService::Pointer channel_; + struct gps_data_t gpsData_; + bool gpsEnabled_ = false; + }; + + } + } + } + } +} \ No newline at end of file diff --git a/include/f1x/openauto/autoapp/Service/SensorService.hpp b/include/f1x/openauto/autoapp/Service/SensorService.hpp deleted file mode 100644 index 93d96d6..0000000 --- a/include/f1x/openauto/autoapp/Service/SensorService.hpp +++ /dev/null @@ -1,70 +0,0 @@ -/* -* 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 . -*/ - -#pragma once - -#include -#include -#include - -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace service -{ - -class SensorService: public aasdk::channel::sensor::ISensorServiceChannelEventHandler, public IService, public std::enable_shared_from_this -{ -public: - SensorService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger); - bool isNight = false; - bool previous = false; - bool stopPolling = false; - - void start() override; - void stop() override; - void pause() override; - void resume() override; - void fillFeatures(aasdk::proto::messages::ServiceDiscoveryResponse& response) override; - void onChannelOpenRequest(const aasdk::proto::messages::ChannelOpenRequest& request) override; - void onSensorStartRequest(const aasdk::proto::messages::SensorStartRequestMessage& request) override; - void onChannelError(const aasdk::error::Error& e) override; - -private: - using std::enable_shared_from_this::shared_from_this; - void sendDrivingStatusUnrestricted(); - void sendNightData(); - void sendGPSLocationData(); - bool is_file_exist(const char *filename); - void sensorPolling(); - bool firstRun = true; - - boost::asio::deadline_timer timer_; - boost::asio::io_service::strand strand_; - aasdk::channel::sensor::SensorServiceChannel::Pointer channel_; - struct gps_data_t gpsData_; - bool gpsEnabled_ = false; -}; - -} -} -} -} diff --git a/include/f1x/openauto/autoapp/Service/WifiService.hpp b/include/f1x/openauto/autoapp/Service/Service.hpp similarity index 50% rename from include/f1x/openauto/autoapp/Service/WifiService.hpp rename to include/f1x/openauto/autoapp/Service/Service.hpp index f9aefcf..e406e48 100644 --- a/include/f1x/openauto/autoapp/Service/WifiService.hpp +++ b/include/f1x/openauto/autoapp/Service/Service.hpp @@ -18,39 +18,37 @@ #pragma once -#include +#include +#include #include -#include -#include -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace service -{ +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { -class WifiService: public IService, public std::enable_shared_from_this -{ -public: - typedef std::shared_ptr Pointer; + class Service + : public IService { + public: + Service(boost::asio::io_service &ioService); - WifiService(configuration::IConfiguration::Pointer configuration); + void start() override; - void start() override; - void stop() override; - void pause() override; - void resume() override; - void fillFeatures(aasdk::proto::messages::ServiceDiscoveryResponse& response) override; + void stop() override; -private: - using std::enable_shared_from_this::shared_from_this; - configuration::IConfiguration::Pointer configuration_; -}; + void pause() override; -} -} -} -} + void resume() override; + + void fillFeatures(aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) override; + + private: + + boost::asio::io_service::strand strand_; + + }; + } + } + } + } +} \ No newline at end of file diff --git a/include/f1x/openauto/autoapp/Service/ServiceFactory.hpp b/include/f1x/openauto/autoapp/Service/ServiceFactory.hpp index 2ee9c6b..7cf8500 100644 --- a/include/f1x/openauto/autoapp/Service/ServiceFactory.hpp +++ b/include/f1x/openauto/autoapp/Service/ServiceFactory.hpp @@ -21,32 +21,38 @@ #include #include -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace service -{ +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { -class ServiceFactory: public IServiceFactory -{ -public: - ServiceFactory(boost::asio::io_service& ioService, configuration::IConfiguration::Pointer configuration); - ServiceList create(aasdk::messenger::IMessenger::Pointer messenger) override; + class ServiceFactory : public IServiceFactory { + public: + ServiceFactory(boost::asio::io_service &ioService, configuration::IConfiguration::Pointer configuration); + ServiceList create(aasdk::messenger::IMessenger::Pointer messenger) override; -private: - IService::Pointer createVideoService(aasdk::messenger::IMessenger::Pointer messenger); - IService::Pointer createBluetoothService(aasdk::messenger::IMessenger::Pointer messenger); - IService::Pointer createInputService(aasdk::messenger::IMessenger::Pointer messenger); - void createAudioServices(ServiceList& serviceList, aasdk::messenger::IMessenger::Pointer messenger); + private: + IService::Pointer createBluetoothService(aasdk::messenger::IMessenger::Pointer messenger); + IService::Pointer createGenericNotificationService(aasdk::messenger::IMessenger::Pointer messenger); + IService::Pointer createInputService(aasdk::messenger::IMessenger::Pointer messenger); + IService::Pointer createMediaBrowserService(aasdk::messenger::IMessenger::Pointer messenger); + IService::Pointer createMediaPlaybackStatusService(aasdk::messenger::IMessenger::Pointer messenger); - boost::asio::io_service& ioService_; - configuration::IConfiguration::Pointer configuration_; -}; + void createMediaSinkServices(ServiceList &serviceList, aasdk::messenger::IMessenger::Pointer messenger); + void createMediaSourceServices(ServiceList &serviceList, aasdk::messenger::IMessenger::Pointer messenger); -} -} -} + IService::Pointer createNavigationStatusService(aasdk::messenger::IMessenger::Pointer messenger); + IService::Pointer createPhoneStatusService(aasdk::messenger::IMessenger::Pointer messenger); + IService::Pointer createRadioService(aasdk::messenger::IMessenger::Pointer messenger); + IService::Pointer createSensorService(aasdk::messenger::IMessenger::Pointer messenger); + IService::Pointer createVendorExtensionService(aasdk::messenger::IMessenger::Pointer messenger); + IService::Pointer createWifiProjectionService(aasdk::messenger::IMessenger::Pointer messenger); + + boost::asio::io_service &ioService_; + configuration::IConfiguration::Pointer configuration_; + }; + + } + } + } } diff --git a/include/f1x/openauto/autoapp/Service/VendorExtension/VendorExtensionService.hpp b/include/f1x/openauto/autoapp/Service/VendorExtension/VendorExtensionService.hpp new file mode 100644 index 0000000..dea205b --- /dev/null +++ b/include/f1x/openauto/autoapp/Service/VendorExtension/VendorExtensionService.hpp @@ -0,0 +1,61 @@ +/* +* 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 . +*/ + +#pragma once + +#include +#include +#include +#include + +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace vendorextension { + + class VendorExtensionService : + public aasdk::channel::vendorextension::IVendorExtensionServiceEventHandler, + public IService, + public std::enable_shared_from_this { + public: + VendorExtensionService(boost::asio::io_service &ioService, aasdk::messenger::IMessenger::Pointer messenger); + + void start() override; + void stop() override; + void pause() override; + void resume() override; + void fillFeatures(aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) override; + + void onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) override; + + void onChannelError(const aasdk::error::Error &e) override; + + + private: + using std::enable_shared_from_this::shared_from_this; + boost::asio::deadline_timer timer_; + boost::asio::io_service::strand strand_; + aasdk::channel::vendorextension::VendorExtensionService::Pointer channel_; + }; + + } + } + } + } +} \ No newline at end of file diff --git a/include/f1x/openauto/autoapp/Service/VideoService.hpp b/include/f1x/openauto/autoapp/Service/VideoService.hpp deleted file mode 100644 index 391e1bc..0000000 --- a/include/f1x/openauto/autoapp/Service/VideoService.hpp +++ /dev/null @@ -1,70 +0,0 @@ -/* -* 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 . -*/ - -#pragma once - -#include -#include -#include -#include -#include - -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace service -{ - -class VideoService: public aasdk::channel::av::IVideoServiceChannelEventHandler, public IService, public std::enable_shared_from_this -{ -public: - typedef std::shared_ptr Pointer; - - VideoService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, projection::IVideoOutput::Pointer videoOutput); - - void start() override; - void stop() override; - void pause() override; - void resume() override; - void fillFeatures(aasdk::proto::messages::ServiceDiscoveryResponse& response) override; - void onChannelOpenRequest(const aasdk::proto::messages::ChannelOpenRequest& request) override; - void onAVChannelSetupRequest(const aasdk::proto::messages::AVChannelSetupRequest& request) override; - void onAVChannelStartIndication(const aasdk::proto::messages::AVChannelStartIndication& indication) override; - void onAVChannelStopIndication(const aasdk::proto::messages::AVChannelStopIndication& indication) override; - void onAVMediaWithTimestampIndication(aasdk::messenger::Timestamp::ValueType timestamp, const aasdk::common::DataConstBuffer& buffer) override; - void onAVMediaIndication(const aasdk::common::DataConstBuffer& buffer) override; - void onVideoFocusRequest(const aasdk::proto::messages::VideoFocusRequest& request) override; - void onChannelError(const aasdk::error::Error& e) override; - -private: - using std::enable_shared_from_this::shared_from_this; - void sendVideoFocusIndication(); - - boost::asio::io_service::strand strand_; - aasdk::channel::av::VideoServiceChannel::Pointer channel_; - projection::IVideoOutput::Pointer videoOutput_; - int32_t session_; -}; - -} -} -} -} diff --git a/include/f1x/openauto/autoapp/Service/WifiProjection/WifiProjectionService.hpp b/include/f1x/openauto/autoapp/Service/WifiProjection/WifiProjectionService.hpp new file mode 100644 index 0000000..f4450ee --- /dev/null +++ b/include/f1x/openauto/autoapp/Service/WifiProjection/WifiProjectionService.hpp @@ -0,0 +1,63 @@ +/* +* 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 . +*/ + +#pragma once + +#include +#include +#include +#include + +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace wifiprojection { + + class WifiProjectionService : + public aasdk::channel::wifiprojection::IWifiProjectionServiceEventHandler, + public IService, + public std::enable_shared_from_this { + public: + WifiProjectionService(boost::asio::io_service &ioService, aasdk::messenger::IMessenger::Pointer messenger); + + void start() override; + void stop() override; + void pause() override; + void resume() override; + void fillFeatures(aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) override; + + void onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) override; + + void onChannelError(const aasdk::error::Error &e) override; + + void + onWifiCredentialsRequest(const aap_protobuf::service::wifiprojection::message::WifiCredentialsRequest &request) override; + + private: + using std::enable_shared_from_this::shared_from_this; + boost::asio::deadline_timer timer_; + boost::asio::io_service::strand strand_; + aasdk::channel::wifiprojection::WifiProjectionService::Pointer channel_; + }; + + } + } + } + } +} \ No newline at end of file diff --git a/include/f1x/openauto/autoapp/UI/ConnectDialog.hpp b/include/f1x/openauto/autoapp/UI/ConnectDialog.hpp index f97d5fa..5d39d7a 100644 --- a/include/f1x/openauto/autoapp/UI/ConnectDialog.hpp +++ b/include/f1x/openauto/autoapp/UI/ConnectDialog.hpp @@ -3,8 +3,8 @@ #include #include #include -#include -#include +#include +#include #include namespace Ui { diff --git a/include/f1x/openauto/autoapp/UI/SettingsWindow.hpp b/include/f1x/openauto/autoapp/UI/SettingsWindow.hpp index e1faab3..367dd32 100644 --- a/include/f1x/openauto/autoapp/UI/SettingsWindow.hpp +++ b/include/f1x/openauto/autoapp/UI/SettingsWindow.hpp @@ -23,7 +23,6 @@ #include #include #include -#include class QCheckBox; class QTimer; @@ -100,7 +99,7 @@ private: void load(); void loadButtonCheckBoxes(); void saveButtonCheckBoxes(); - void saveButtonCheckBox(const QCheckBox* checkBox, configuration::IConfiguration::ButtonCodes& buttonCodes, aasdk::proto::enums::ButtonCode::Enum buttonCode); + void saveButtonCheckBox(const QCheckBox* checkBox, configuration::IConfiguration::ButtonCodes& buttonCodes, aap_protobuf::service::media::sink::KeyCode buttonCode); void setButtonCheckBoxes(bool value); Ui::SettingsWindow* ui_; diff --git a/include/f1x/openauto/btservice/AndroidBluetoothServer.hpp b/include/f1x/openauto/btservice/AndroidBluetoothServer.hpp index bfa40d6..4eb540b 100644 --- a/include/f1x/openauto/btservice/AndroidBluetoothServer.hpp +++ b/include/f1x/openauto/btservice/AndroidBluetoothServer.hpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include namespace f1x { diff --git a/src/autoapp/App.cpp b/src/autoapp/App.cpp index 3967385..b016ea2 100644 --- a/src/autoapp/App.cpp +++ b/src/autoapp/App.cpp @@ -17,8 +17,8 @@ */ #include -#include -#include +#include +#include #include #include diff --git a/src/autoapp/Configuration/Configuration.cpp b/src/autoapp/Configuration/Configuration.cpp index a39bb1f..63e7908 100644 --- a/src/autoapp/Configuration/Configuration.cpp +++ b/src/autoapp/Configuration/Configuration.cpp @@ -60,8 +60,11 @@ const std::string Configuration::cVideoOMXLayerIndexKey = "Video.OMXLayerIndex"; const std::string Configuration::cVideoMarginWidth = "Video.MarginWidth"; const std::string Configuration::cVideoMarginHeight = "Video.MarginHeight"; -const std::string Configuration::cAudioMusicAudioChannelEnabled = "Audio.MusicAudioChannelEnabled"; -const std::string Configuration::cAudioSpeechAudioChannelEnabled = "Audio.SpeechAudioChannelEnabled"; +const std::string Configuration::Audio::Channel::cMediaEnabled = "Audio.Channel.MediaEnabled"; +const std::string Configuration::Audio::Channel::cGuidanceEnabled = "Audio.Channel.GuidanceEnabled"; +const std::string Configuration::Audio::Channel::cSystemEnabled = "Audio.Channel.SystemEnabled"; +const std::string Configuration::Audio::Channel::cTelephonyEnabled = "Audio.Channel.TelephonyEnabled"; + const std::string Configuration::cAudioOutputBackendType = "Audio.OutputBackendType"; const std::string Configuration::cBluetoothAdapterTypeKey = "Bluetooth.AdapterType"; @@ -120,11 +123,11 @@ void Configuration::load() showAutoPlay_ = iniConfig.get(cGeneralShowAutoPlayKey, false); instantPlay_ = iniConfig.get(cGeneralInstantPlayKey, false); - videoFPS_ = static_cast(iniConfig.get(cVideoFPSKey, - aasdk::proto::enums::VideoFPS::_30)); + videoFPS_ = static_cast(iniConfig.get(cVideoFPSKey, + aap_protobuf::service::media::shared::message::VideoFrameRateType::VIDEO_FPS_30)); - videoResolution_ = static_cast(iniConfig.get(cVideoResolutionKey, - aasdk::proto::enums::VideoResolution::_480p)); + videoResolution_ = static_cast(iniConfig.get(cVideoResolutionKey, + aap_protobuf::service::media::shared::message::VideoCodecResolutionType::VIDEO_800x480)); screenDPI_ = iniConfig.get(cVideoScreenDPIKey, 140); omxLayerIndex_ = iniConfig.get(cVideoOMXLayerIndexKey, 1); @@ -138,8 +141,12 @@ void Configuration::load() static_cast(BluetoothAdapterType::NONE))); bluetoothRemoteAdapterAddress_ = iniConfig.get(cBluetoothRemoteAdapterAddressKey, ""); - musicAudioChannelEnabled_ = iniConfig.get(cAudioMusicAudioChannelEnabled, true); - speechAudiochannelEnabled_ = iniConfig.get(cAudioSpeechAudioChannelEnabled, true); + + _audioChannelEnabledMedia = iniConfig.get(Audio::Channel::cMediaEnabled, true); + _audioChannelEnabledGuidance = iniConfig.get(Audio::Channel::cGuidanceEnabled, true); + _audioChannelEnabledSystem = iniConfig.get(Audio::Channel::cSystemEnabled, true); + _audioChannelEnabledTelephony = iniConfig.get(Audio::Channel::cTelephonyEnabled, true); + audioOutputBackendType_ = static_cast(iniConfig.get(cAudioOutputBackendType, static_cast(AudioOutputBackendType::RTAUDIO))); } catch(const boost::property_tree::ini_parser_error& e) @@ -171,8 +178,8 @@ void Configuration::reset() mp3AutoPlay_ = false; showAutoPlay_ = false; instantPlay_ = false; - videoFPS_ = aasdk::proto::enums::VideoFPS::_30; - videoResolution_ = aasdk::proto::enums::VideoResolution::_480p; + videoFPS_ = aap_protobuf::service::media::shared::message::VideoFrameRateType::VIDEO_FPS_30; + videoResolution_ = aap_protobuf::service::media::shared::message::VideoCodecResolutionType::VIDEO_800x480; screenDPI_ = 140; omxLayerIndex_ = 1; videoMargins_ = QRect(0, 0, 0, 0); @@ -181,8 +188,12 @@ void Configuration::reset() buttonCodes_.clear(); bluetoothAdapterType_ = BluetoothAdapterType::NONE; bluetoothRemoteAdapterAddress_ = ""; - musicAudioChannelEnabled_ = true; - speechAudiochannelEnabled_ = true; + + _audioChannelEnabledMedia = true; + _audioChannelEnabledGuidance = true; + _audioChannelEnabledSystem = true; + _audioChannelEnabledTelephony = true; + audioOutputBackendType_ = AudioOutputBackendType::QT; } @@ -223,9 +234,12 @@ void Configuration::save() iniConfig.put(cBluetoothAdapterTypeKey, static_cast(bluetoothAdapterType_)); iniConfig.put(cBluetoothRemoteAdapterAddressKey, bluetoothRemoteAdapterAddress_); - iniConfig.put(cAudioMusicAudioChannelEnabled, musicAudioChannelEnabled_); - iniConfig.put(cAudioSpeechAudioChannelEnabled, speechAudiochannelEnabled_); - iniConfig.put(cAudioOutputBackendType, static_cast(audioOutputBackendType_)); + iniConfig.put(Audio::Channel::cMediaEnabled, _audioChannelEnabledMedia); + iniConfig.put(Audio::Channel::cGuidanceEnabled, _audioChannelEnabledGuidance); + iniConfig.put(Audio::Channel::cSystemEnabled, _audioChannelEnabledSystem); + iniConfig.put(Audio::Channel::cTelephonyEnabled, _audioChannelEnabledTelephony); + + iniConfig.put(cAudioOutputBackendType, static_cast(audioOutputBackendType_)); boost::property_tree::ini_parser::write_ini(cConfigFileName, iniConfig); } @@ -428,22 +442,22 @@ bool Configuration::instantPlay() const return instantPlay_; } -aasdk::proto::enums::VideoFPS::Enum Configuration::getVideoFPS() const +aap_protobuf::service::media::shared::message::VideoFrameRateType Configuration::getVideoFPS() const { return videoFPS_; } -void Configuration::setVideoFPS(aasdk::proto::enums::VideoFPS::Enum value) +void Configuration::setVideoFPS(aap_protobuf::service::media::shared::message::VideoFrameRateType value) { videoFPS_ = value; } -aasdk::proto::enums::VideoResolution::Enum Configuration::getVideoResolution() const +aap_protobuf::service::media::shared::message::VideoCodecResolutionType Configuration::getVideoResolution() const { return videoResolution_; } -void Configuration::setVideoResolution(aasdk::proto::enums::VideoResolution::Enum value) +void Configuration::setVideoResolution(aap_protobuf::service::media::shared::message::VideoCodecResolutionType value) { videoResolution_ = value; } @@ -530,24 +544,44 @@ void Configuration::setBluetoothRemoteAdapterAddress(const std::string& value) bool Configuration::musicAudioChannelEnabled() const { - return musicAudioChannelEnabled_; + return _audioChannelEnabledMedia; } void Configuration::setMusicAudioChannelEnabled(bool value) { - musicAudioChannelEnabled_ = value; + _audioChannelEnabledMedia = value; } -bool Configuration::speechAudioChannelEnabled() const +bool Configuration::guidanceAudioChannelEnabled() const { - return speechAudiochannelEnabled_; + return _audioChannelEnabledGuidance; } -void Configuration::setSpeechAudioChannelEnabled(bool value) +void Configuration::setGuidanceAudioChannelEnabled(bool value) { - speechAudiochannelEnabled_ = value; + _audioChannelEnabledGuidance = value; } + bool Configuration::systemAudioChannelEnabled() const + { + return _audioChannelEnabledSystem; + } + + void Configuration::setSystemAudioChannelEnabled(bool value) + { + _audioChannelEnabledSystem = value; + } + + bool Configuration::telephonyAudioChannelEnabled() const + { + return _audioChannelEnabledTelephony; + } + + void Configuration::setTelephonyAudioChannelEnabled(bool value) + { + _audioChannelEnabledTelephony = value; + } + AudioOutputBackendType Configuration::getAudioOutputBackendType() const { return audioOutputBackendType_; @@ -683,26 +717,26 @@ QString Configuration::readFileContent(QString fileName) const void Configuration::readButtonCodes(boost::property_tree::ptree& iniConfig) { - this->insertButtonCode(iniConfig, cInputPlayButtonKey, aasdk::proto::enums::ButtonCode::PLAY); - this->insertButtonCode(iniConfig, cInputPauseButtonKey, aasdk::proto::enums::ButtonCode::PAUSE); - this->insertButtonCode(iniConfig, cInputTogglePlayButtonKey, aasdk::proto::enums::ButtonCode::TOGGLE_PLAY); - this->insertButtonCode(iniConfig, cInputNextTrackButtonKey, aasdk::proto::enums::ButtonCode::NEXT); - this->insertButtonCode(iniConfig, cInputPreviousTrackButtonKey, aasdk::proto::enums::ButtonCode::PREV); - this->insertButtonCode(iniConfig, cInputHomeButtonKey, aasdk::proto::enums::ButtonCode::HOME); - this->insertButtonCode(iniConfig, cInputPhoneButtonKey, aasdk::proto::enums::ButtonCode::PHONE); - this->insertButtonCode(iniConfig, cInputCallEndButtonKey, aasdk::proto::enums::ButtonCode::CALL_END); - this->insertButtonCode(iniConfig, cInputVoiceCommandButtonKey, aasdk::proto::enums::ButtonCode::MICROPHONE_1); - this->insertButtonCode(iniConfig, cInputLeftButtonKey, aasdk::proto::enums::ButtonCode::LEFT); - this->insertButtonCode(iniConfig, cInputRightButtonKey, aasdk::proto::enums::ButtonCode::RIGHT); - this->insertButtonCode(iniConfig, cInputUpButtonKey, aasdk::proto::enums::ButtonCode::UP); - this->insertButtonCode(iniConfig, cInputDownButtonKey, aasdk::proto::enums::ButtonCode::DOWN); - this->insertButtonCode(iniConfig, cInputScrollWheelButtonKey, aasdk::proto::enums::ButtonCode::SCROLL_WHEEL); - this->insertButtonCode(iniConfig, cInputBackButtonKey, aasdk::proto::enums::ButtonCode::BACK); - this->insertButtonCode(iniConfig, cInputEnterButtonKey, aasdk::proto::enums::ButtonCode::ENTER); - this->insertButtonCode(iniConfig, cInputNavButtonKey, aasdk::proto::enums::ButtonCode::NAVIGATION); + this->insertButtonCode(iniConfig, cInputPlayButtonKey, aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PLAY); + this->insertButtonCode(iniConfig, cInputPauseButtonKey, aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PAUSE); + this->insertButtonCode(iniConfig, cInputTogglePlayButtonKey, aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PLAY_PAUSE); + this->insertButtonCode(iniConfig, cInputNextTrackButtonKey, aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_NEXT); + this->insertButtonCode(iniConfig, cInputPreviousTrackButtonKey, aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PREVIOUS); + this->insertButtonCode(iniConfig, cInputHomeButtonKey, aap_protobuf::service::media::sink::KeyCode::KEYCODE_HOME); + this->insertButtonCode(iniConfig, cInputPhoneButtonKey, aap_protobuf::service::media::sink::KeyCode::KEYCODE_CALL); + this->insertButtonCode(iniConfig, cInputCallEndButtonKey, aap_protobuf::service::media::sink::KeyCode::KEYCODE_ENDCALL); + this->insertButtonCode(iniConfig, cInputVoiceCommandButtonKey, aap_protobuf::service::media::sink::KeyCode::KEYCODE_SEARCH); + this->insertButtonCode(iniConfig, cInputLeftButtonKey, aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_LEFT); + this->insertButtonCode(iniConfig, cInputRightButtonKey, aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_RIGHT); + this->insertButtonCode(iniConfig, cInputUpButtonKey, aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_UP); + this->insertButtonCode(iniConfig, cInputDownButtonKey, aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_DOWN); + this->insertButtonCode(iniConfig, cInputScrollWheelButtonKey, aap_protobuf::service::media::sink::KeyCode::KEYCODE_ROTARY_CONTROLLER); + this->insertButtonCode(iniConfig, cInputBackButtonKey, aap_protobuf::service::media::sink::KeyCode::KEYCODE_BACK); + this->insertButtonCode(iniConfig, cInputEnterButtonKey, aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_CENTER); + this->insertButtonCode(iniConfig, cInputNavButtonKey, aap_protobuf::service::media::sink::KeyCode::KEYCODE_NAVIGATION); } -void Configuration::insertButtonCode(boost::property_tree::ptree& iniConfig, const std::string& buttonCodeKey, aasdk::proto::enums::ButtonCode::Enum buttonCode) +void Configuration::insertButtonCode(boost::property_tree::ptree& iniConfig, const std::string& buttonCodeKey, aap_protobuf::service::media::sink::KeyCode buttonCode) { if(iniConfig.get(buttonCodeKey, false)) { @@ -712,23 +746,23 @@ void Configuration::insertButtonCode(boost::property_tree::ptree& iniConfig, con void Configuration::writeButtonCodes(boost::property_tree::ptree& iniConfig) { - iniConfig.put(cInputPlayButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aasdk::proto::enums::ButtonCode::PLAY) != buttonCodes_.end()); - iniConfig.put(cInputPauseButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aasdk::proto::enums::ButtonCode::PAUSE) != buttonCodes_.end()); - iniConfig.put(cInputTogglePlayButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aasdk::proto::enums::ButtonCode::TOGGLE_PLAY) != buttonCodes_.end()); - iniConfig.put(cInputNextTrackButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aasdk::proto::enums::ButtonCode::NEXT) != buttonCodes_.end()); - iniConfig.put(cInputPreviousTrackButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aasdk::proto::enums::ButtonCode::PREV) != buttonCodes_.end()); - iniConfig.put(cInputHomeButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aasdk::proto::enums::ButtonCode::HOME) != buttonCodes_.end()); - iniConfig.put(cInputPhoneButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aasdk::proto::enums::ButtonCode::PHONE) != buttonCodes_.end()); - iniConfig.put(cInputCallEndButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aasdk::proto::enums::ButtonCode::CALL_END) != buttonCodes_.end()); - iniConfig.put(cInputVoiceCommandButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aasdk::proto::enums::ButtonCode::MICROPHONE_1) != buttonCodes_.end()); - iniConfig.put(cInputLeftButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aasdk::proto::enums::ButtonCode::LEFT) != buttonCodes_.end()); - iniConfig.put(cInputRightButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aasdk::proto::enums::ButtonCode::RIGHT) != buttonCodes_.end()); - iniConfig.put(cInputUpButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aasdk::proto::enums::ButtonCode::UP) != buttonCodes_.end()); - iniConfig.put(cInputDownButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aasdk::proto::enums::ButtonCode::DOWN) != buttonCodes_.end()); - iniConfig.put(cInputScrollWheelButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aasdk::proto::enums::ButtonCode::SCROLL_WHEEL) != buttonCodes_.end()); - iniConfig.put(cInputBackButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aasdk::proto::enums::ButtonCode::BACK) != buttonCodes_.end()); - iniConfig.put(cInputEnterButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aasdk::proto::enums::ButtonCode::ENTER) != buttonCodes_.end()); - iniConfig.put(cInputNavButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aasdk::proto::enums::ButtonCode::NAVIGATION) != buttonCodes_.end()); + iniConfig.put(cInputPlayButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PLAY) != buttonCodes_.end()); + iniConfig.put(cInputPauseButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PAUSE) != buttonCodes_.end()); + iniConfig.put(cInputTogglePlayButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PLAY_PAUSE) != buttonCodes_.end()); + iniConfig.put(cInputNextTrackButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_NEXT) != buttonCodes_.end()); + iniConfig.put(cInputPreviousTrackButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PREVIOUS) != buttonCodes_.end()); + iniConfig.put(cInputHomeButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_HOME) != buttonCodes_.end()); + iniConfig.put(cInputPhoneButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_CALL) != buttonCodes_.end()); + iniConfig.put(cInputCallEndButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_ENDCALL) != buttonCodes_.end()); + iniConfig.put(cInputVoiceCommandButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_SEARCH) != buttonCodes_.end()); + iniConfig.put(cInputLeftButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_LEFT) != buttonCodes_.end()); + iniConfig.put(cInputRightButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_RIGHT) != buttonCodes_.end()); + iniConfig.put(cInputUpButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_UP) != buttonCodes_.end()); + iniConfig.put(cInputDownButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_DOWN) != buttonCodes_.end()); + iniConfig.put(cInputScrollWheelButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_ROTARY_CONTROLLER) != buttonCodes_.end()); + iniConfig.put(cInputBackButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_BACK) != buttonCodes_.end()); + iniConfig.put(cInputEnterButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_CENTER) != buttonCodes_.end()); + iniConfig.put(cInputNavButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_NAVIGATION) != buttonCodes_.end()); } } diff --git a/src/autoapp/Projection/InputDevice.cpp b/src/autoapp/Projection/InputDevice.cpp index 8bf0e5a..808d3c8 100644 --- a/src/autoapp/Projection/InputDevice.cpp +++ b/src/autoapp/Projection/InputDevice.cpp @@ -83,91 +83,91 @@ bool InputDevice::eventFilter(QObject* obj, QEvent* event) bool InputDevice::handleKeyEvent(QEvent* event, QKeyEvent* key) { auto eventType = event->type() == QEvent::KeyPress ? ButtonEventType::PRESS : ButtonEventType::RELEASE; - aasdk::proto::enums::ButtonCode::Enum buttonCode; + aap_protobuf::service::media::sink::KeyCode buttonCode; WheelDirection wheelDirection = WheelDirection::NONE; switch(key->key()) { case Qt::Key_Return: case Qt::Key_Enter: - buttonCode = aasdk::proto::enums::ButtonCode::ENTER; + buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_CENTER; break; case Qt::Key_Left: - buttonCode = aasdk::proto::enums::ButtonCode::LEFT; + buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_LEFT; break; case Qt::Key_Right: - buttonCode = aasdk::proto::enums::ButtonCode::RIGHT; + buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_RIGHT; break; case Qt::Key_Up: - buttonCode = aasdk::proto::enums::ButtonCode::UP; + buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_UP; break; case Qt::Key_Down: - buttonCode = aasdk::proto::enums::ButtonCode::DOWN; + buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_DOWN; break; case Qt::Key_Escape: - buttonCode = aasdk::proto::enums::ButtonCode::BACK; + buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_BACK; break; case Qt::Key_H: - buttonCode = aasdk::proto::enums::ButtonCode::HOME; + buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_HOME; break; case Qt::Key_P: - buttonCode = aasdk::proto::enums::ButtonCode::PHONE; + buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_CALL; break; case Qt::Key_O: - buttonCode = aasdk::proto::enums::ButtonCode::CALL_END; + buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_ENDCALL; break; case Qt::Key_MediaPlay: case Qt::Key_X: - buttonCode = aasdk::proto::enums::ButtonCode::PLAY; + buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PLAY; break; case Qt::Key_MediaPause: case Qt::Key_C: - buttonCode = aasdk::proto::enums::ButtonCode::PAUSE; + buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PAUSE; break; case Qt::Key_MediaPrevious: case Qt::Key_V: - buttonCode = aasdk::proto::enums::ButtonCode::PREV; + buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PREVIOUS; break; case Qt::Key_MediaTogglePlayPause: case Qt::Key_B: - buttonCode = aasdk::proto::enums::ButtonCode::TOGGLE_PLAY; + buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PLAY_PAUSE; break; case Qt::Key_MediaNext: case Qt::Key_N: - buttonCode = aasdk::proto::enums::ButtonCode::NEXT; + buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_NEXT; break; case Qt::Key_M: - buttonCode = aasdk::proto::enums::ButtonCode::MICROPHONE_1; + buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_SEARCH; break; case Qt::Key_1: wheelDirection = WheelDirection::LEFT; eventType = ButtonEventType::NONE; - buttonCode = aasdk::proto::enums::ButtonCode::SCROLL_WHEEL; + buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_ROTARY_CONTROLLER; break; case Qt::Key_2: wheelDirection = WheelDirection::RIGHT; eventType = ButtonEventType::NONE; - buttonCode = aasdk::proto::enums::ButtonCode::SCROLL_WHEEL; + buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_ROTARY_CONTROLLER; break; case Qt::Key_F: - buttonCode = aasdk::proto::enums::ButtonCode::NAVIGATION; + buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_NAVIGATION; break; default: @@ -177,7 +177,7 @@ bool InputDevice::handleKeyEvent(QEvent* event, QKeyEvent* key) const auto& buttonCodes = this->getSupportedButtonCodes(); if(std::find(buttonCodes.begin(), buttonCodes.end(), buttonCode) != buttonCodes.end()) { - if(buttonCode != aasdk::proto::enums::ButtonCode::SCROLL_WHEEL || event->type() == QEvent::KeyRelease) + if(buttonCode != aap_protobuf::service::media::sink::KeyCode::KEYCODE_ROTARY_CONTROLLER || event->type() == QEvent::KeyRelease) { eventHandler_->onButtonEvent({eventType, wheelDirection, buttonCode}); } @@ -193,18 +193,18 @@ bool InputDevice::handleTouchEvent(QEvent* event) return true; } - aasdk::proto::enums::TouchAction::Enum type; + aap_protobuf::service::input::message::TouchAction type; switch(event->type()) { case QEvent::MouseButtonPress: - type = aasdk::proto::enums::TouchAction::PRESS; + type = aap_protobuf::service::input::message::TouchAction::ACTION_DOWN; break; case QEvent::MouseButtonRelease: - type = aasdk::proto::enums::TouchAction::RELEASE; + type = aap_protobuf::service::input::message::TouchAction::ACTION_UP; break; case QEvent::MouseMove: - type = aasdk::proto::enums::TouchAction::DRAG; + type = aap_protobuf::service::input::message::TouchAction::ACTION_MOVED; break; default: return true; diff --git a/src/autoapp/Projection/OMXVideoOutput.cpp b/src/autoapp/Projection/OMXVideoOutput.cpp index f8f3808..6a46380 100644 --- a/src/autoapp/Projection/OMXVideoOutput.cpp +++ b/src/autoapp/Projection/OMXVideoOutput.cpp @@ -23,7 +23,7 @@ extern "C" #include } -#include +#include #include #include diff --git a/src/autoapp/Projection/RtAudioOutput.cpp b/src/autoapp/Projection/RtAudioOutput.cpp index aa12a8a..a59ea4b 100644 --- a/src/autoapp/Projection/RtAudioOutput.cpp +++ b/src/autoapp/Projection/RtAudioOutput.cpp @@ -33,9 +33,15 @@ RtAudioOutput::RtAudioOutput(uint32_t channelCount, uint32_t sampleSize, uint32_ , sampleSize_(sampleSize) , sampleRate_(sampleRate) { - std::vector apis; - RtAudio::getCompiledApi(apis); - dac_ = std::find(apis.begin(), apis.end(), RtAudio::LINUX_PULSE) == apis.end() ? std::make_unique() : std::make_unique(RtAudio::LINUX_PULSE); + + std::vector apis; + RtAudio::getCompiledApi(apis); + dac_ = std::find(apis.begin(), apis.end(), RtAudio::LINUX_PULSE) == apis.end() ? std::make_unique() : std::make_unique(RtAudio::LINUX_PULSE); + + // Set the error callback + dac_->setErrorCallback([](RtAudioErrorType type, const std::string& errorText) { + OPENAUTO_LOG(error) << "[RtAudioOutput] " << errorText; + }); } bool RtAudioOutput::open() @@ -54,13 +60,19 @@ 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(this), &streamOptions); dac_->openStream(¶meters, nullptr, RTAUDIO_SINT16, sampleRate_, &bufferFrames, &RtAudioOutput::audioBufferReadHandler, static_cast(this), &streamOptions); - OPENAUTO_LOG(info) << "[RtAudioOutput] Sample Rate: " << sampleRate_; - return audioBuffer_.open(QIODevice::ReadWrite); + 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: "; + } } - catch(const RtAudioError& e) + catch(const std::exception& e) { - OPENAUTO_LOG(error) << "[RtAudioOutput] Failed to open audio output, what: " << e.what(); + OPENAUTO_LOG(error) << "[RtAudioOutput] Exception: " << e.what(); } } else @@ -86,9 +98,10 @@ void RtAudioOutput::start() { dac_->startStream(); } - catch(const RtAudioError& e) + catch(const RtAudioErrorType& e) { - OPENAUTO_LOG(error) << "[RtAudioOutput] Failed to start audio output, what: " << e.what(); + // TODO: What's the new RtAudio Error? + //OPENAUTO_LOG(error) << "[RtAudioOutput] Failed to start audio output, what: " << e.what(); } } } @@ -133,9 +146,10 @@ void RtAudioOutput::doSuspend() { dac_->stopStream(); } - catch(const RtAudioError& e) + catch(const RtAudioErrorType& e) { - OPENAUTO_LOG(error) << "[RtAudioOutput] Failed to suspend audio output, what: " << e.what(); + // TODO: What's the new RtAudio Error? + //OPENAUTO_LOG(error) << "[RtAudioOutput] Failed to suspend audio output, what: " << e.what(); } } } diff --git a/src/autoapp/Projection/VideoOutput.cpp b/src/autoapp/Projection/VideoOutput.cpp index dca398d..75edbd3 100644 --- a/src/autoapp/Projection/VideoOutput.cpp +++ b/src/autoapp/Projection/VideoOutput.cpp @@ -33,12 +33,12 @@ VideoOutput::VideoOutput(configuration::IConfiguration::Pointer configuration) } -aasdk::proto::enums::VideoFPS::Enum VideoOutput::getVideoFPS() const +aap_protobuf::service::media::shared::message::VideoFrameRateType VideoOutput::getVideoFPS() const { return configuration_->getVideoFPS(); } -aasdk::proto::enums::VideoResolution::Enum VideoOutput::getVideoResolution() const +aap_protobuf::service::media::shared::message::VideoCodecResolutionType VideoOutput::getVideoResolution() const { return configuration_->getVideoResolution(); } diff --git a/src/autoapp/Service/AndroidAutoEntity.cpp b/src/autoapp/Service/AndroidAutoEntity.cpp index 02986dd..3cea7f4 100644 --- a/src/autoapp/Service/AndroidAutoEntity.cpp +++ b/src/autoapp/Service/AndroidAutoEntity.cpp @@ -16,10 +16,64 @@ * along with openauto. If not, see . */ -#include +#include +#include +#include +#include +#include +#include +#include #include #include +/* + * HU > MD Version Request + * HU < MD ServiceDiscoveryRequest + * HU > MD Car MetaData (Make, Model, year etc) + * HU < MD when Video Projection starts, it MUST be shown without User Ineraction + * HU < MD Prompt Use to Enable and Pair with Car + * HU < MD Request Video Focus for Projection (HU Grant) + * + * AAP neds Bluetooth HFP for Telephone + * + * HU > MD Bluetooth Announcement (HU MAC Address, Supported Pairing Methods) + * HU < MD Bluetooth Pairing Request + * HU > MD Bluetoth Pairing Response + * + * AfterPairing, HU can request the Bluetooth PhoneBookAccessProtocol. Sensible UI. + * + * HU < MD connect to Bluetooth HFP + * HU Suppress BAP or MAP while AAP connected. + * A2DP should be treated by OEM as another such such as a USB stick or radio. If the user plays music via AA, HU should grant request from AA to change focus to AA. HU manages connectivity. + * MD connects to HU and routes call over Bluetooth (non Bluetooth call) + * MD connects Blueooth call and display projection mode + * MD on call to HFP device - MD continues call, disconnects from other HFP and connects to HFP on Vehicle. + * AA only uses HFP, hhowever HU may use MAP, PBAP, PAN and RSAP + * MD will reconnect when required. + * + * Video + * HU < MD - During Service Discovery, MD requests Video Configs supported + * HU > MD sends Config Message with Prioritised indices for Video Conffigurations + * HU < MD MD selects config + * HU < MD sends start message + * HU < MD sends focus request + * HU > MD sends focus granted (unless unsafe - ie reverse camera etc) + * HU < MD Audio Focus Requests when MD wants to play. + * HU > MD Audio Focus Navigations (can be unsolicited or responses to requests) + * HU < MD VoiceSessionRequestNotification with VOICE_SESSION_START, HU should stop all sounds. MD will request GAIN or GAIN_TRANS to play beeps/tones and ASR response. + * Nav Focus for onboard navigation. + * UI System Sounds does not require audio focus as sounds should be played ASAP. System Stream is optionals (not required to support). + * HU should wait to receive two frames of audio before starting playback to minimise buffer underruns. + * AA Latency types supported - Audio Setup - max 500ms, Audio Output max 50ms. + * HU > MD Navigation Focus Notification specified with NF is Phone or Car. + * HU < MD Navigation Focus Request + * "For vehicles that support next turn information in the instrument cluster, the HU can subscribe to next turn updates from the MD navigation engine." (NExt Turn etc) + * same for Media Playback Status + * Radio - Allows Control of Radio from Within AA. + * Vehicle IDs SHOULD have at least 64 bits + */ + + namespace f1x { namespace openauto @@ -113,13 +167,13 @@ void AndroidAutoEntity::resume() }); } -void AndroidAutoEntity::onVersionResponse(uint16_t majorCode, uint16_t minorCode, aasdk::proto::enums::VersionResponseStatus::Enum status) +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; - if(status == aasdk::proto::enums::VersionResponseStatus::MISMATCH) + if(status == aap_protobuf::shared::MessageStatus::STATUS_NO_COMPATIBLE_VERSION) { OPENAUTO_LOG(error) << "[AndroidAutoEntity] version mismatch."; this->triggerQuit(); @@ -164,8 +218,8 @@ void AndroidAutoEntity::onHandshake(const aasdk::common::DataConstBuffer& payloa { OPENAUTO_LOG(info) << "[AndroidAutoEntity] Auth completed."; - aasdk::proto::messages::AuthCompleteIndication authCompleteIndication; - authCompleteIndication.set_status(aasdk::proto::enums::Status::OK); + 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)); @@ -180,24 +234,47 @@ void AndroidAutoEntity::onHandshake(const aasdk::common::DataConstBuffer& payloa } } -void AndroidAutoEntity::onServiceDiscoveryRequest(const aasdk::proto::messages::ServiceDiscoveryRequest& request) +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.device_brand(); + << ", brand: " << request.label_text(); - aasdk::proto::messages::ServiceDiscoveryResponse serviceDiscoveryResponse; + /* + aap_protobuf::connection::PingConfiguration pingConfiguration; + pingConfiguration.set_high_latency_threshold_ms(); + pingConfiguration.set_interval_ms(); + pingConfiguration.set_timeout_ms(); + pingConfiguration.set_tracked_ping_count(); + + 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(); + + aap_protobuf::connection::ConnectionConfiguration connectionConfiguration; + connectionConfiguration.set_allocated_ping_configuration(); + connectionConfiguration.set_allocated_wireless_tcp_configuration();*/ + + 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"); + + aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse serviceDiscoveryResponse; serviceDiscoveryResponse.mutable_channels()->Reserve(256); - serviceDiscoveryResponse.set_head_unit_name("Crankshaft-NG"); - serviceDiscoveryResponse.set_car_model("Universal"); - serviceDiscoveryResponse.set_car_year("2018"); - serviceDiscoveryResponse.set_car_serial("20180301"); - serviceDiscoveryResponse.set_left_hand_drive_vehicle(configuration_->getHandednessOfTrafficType() == configuration::HandednessOfTrafficType::LEFT_HAND_DRIVE); - serviceDiscoveryResponse.set_headunit_manufacturer("f1x"); - serviceDiscoveryResponse.set_headunit_model("Crankshaft-NG Autoapp"); - serviceDiscoveryResponse.set_sw_build("1"); - serviceDiscoveryResponse.set_sw_version("1.0"); - serviceDiscoveryResponse.set_can_play_native_media_during_vr(false); - serviceDiscoveryResponse.set_hide_clock(!configuration_->showClock()); + + //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))); @@ -207,17 +284,18 @@ void AndroidAutoEntity::onServiceDiscoveryRequest(const aasdk::proto::messages:: controlServiceChannel_->receive(this->shared_from_this()); } -void AndroidAutoEntity::onAudioFocusRequest(const aasdk::proto::messages::AudioFocusRequest& request) +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(); - aasdk::proto::enums::AudioFocusState::Enum audioFocusState = - request.audio_focus_type() == aasdk::proto::enums::AudioFocusType::RELEASE ? aasdk::proto::enums::AudioFocusState::LOSS - : aasdk::proto::enums::AudioFocusState::GAIN; + 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; - aasdk::proto::messages::AudioFocusResponse response; + aap_protobuf::channel::control::focus::audio::notification::AudioFocusNotification response; response.set_audio_focus_state(audioFocusState); auto promise = aasdk::channel::SendPromise::defer(strand_); @@ -226,11 +304,11 @@ void AndroidAutoEntity::onAudioFocusRequest(const aasdk::proto::messages::AudioF controlServiceChannel_->receive(this->shared_from_this()); } -void AndroidAutoEntity::onShutdownRequest(const aasdk::proto::messages::ShutdownRequest& request) +void AndroidAutoEntity::onByeByeRequest(const aap_protobuf::channel::control::byebye::event::ByeByeRequest& request) { OPENAUTO_LOG(info) << "[AndroidAutoEntity] Shutdown request, reason: " << request.reason(); - aasdk::proto::messages::ShutdownResponse response; + 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)); @@ -238,18 +316,18 @@ void AndroidAutoEntity::onShutdownRequest(const aasdk::proto::messages::Shutdown controlServiceChannel_->sendShutdownResponse(response, std::move(promise)); } -void AndroidAutoEntity::onShutdownResponse(const aasdk::proto::messages::ShutdownResponse&) +void AndroidAutoEntity::onByeByeResponse(const aap_protobuf::channel::control::byebye::notification::ByeByeResponse& response) { OPENAUTO_LOG(info) << "[AndroidAutoEntity] Shutdown response "; this->triggerQuit(); } -void AndroidAutoEntity::onNavigationFocusRequest(const aasdk::proto::messages::NavigationFocusRequest& request) +void AndroidAutoEntity::onNavigationFocusRequest(const aap_protobuf::channel::control::focus::navigation::event::NavFocusRequestNotification& request) { - OPENAUTO_LOG(info) << "[AndroidAutoEntity] navigation focus request, type: " << request.type(); + OPENAUTO_LOG(info) << "[AndroidAutoEntity] navigation focus request, type: " << request.focus_type(); - aasdk::proto::messages::NavigationFocusResponse response; - response.set_type(2); + 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)); @@ -257,7 +335,17 @@ void AndroidAutoEntity::onNavigationFocusRequest(const aasdk::proto::messages::N controlServiceChannel_->receive(this->shared_from_this()); } -void AndroidAutoEntity::onPingResponse(const aasdk::proto::messages::PingResponse& response) + 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(); @@ -302,7 +390,7 @@ void AndroidAutoEntity::sendPing() auto promise = aasdk::channel::SendPromise::defer(strand_); promise->then([]() {}, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), std::placeholders::_1)); - aasdk::proto::messages::PingRequest request; + aap_protobuf::channel::control::ping::PingRequest request; auto timestamp = std::chrono::duration_cast(std::chrono::high_resolution_clock::now().time_since_epoch()); request.set_timestamp(timestamp.count()); controlServiceChannel_->sendPingRequest(request, std::move(promise)); diff --git a/src/autoapp/Service/AndroidAutoEntityFactory.cpp b/src/autoapp/Service/AndroidAutoEntityFactory.cpp index d833250..9f0ace8 100644 --- a/src/autoapp/Service/AndroidAutoEntityFactory.cpp +++ b/src/autoapp/Service/AndroidAutoEntityFactory.cpp @@ -16,14 +16,14 @@ * along with openauto. If not, see . */ -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include diff --git a/src/autoapp/Service/AudioInputService.cpp b/src/autoapp/Service/AudioInputService.cpp deleted file mode 100644 index 47e80da..0000000 --- a/src/autoapp/Service/AudioInputService.cpp +++ /dev/null @@ -1,215 +0,0 @@ -/* -* 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 . -*/ - -#include -#include -#include - -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace service -{ - -AudioInputService::AudioInputService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, projection::IAudioInput::Pointer audioInput) - : strand_(ioService) - , channel_(std::make_shared(strand_, std::move(messenger))) - , audioInput_(std::move(audioInput)) - , session_(0) -{ - -} - -void AudioInputService::start() -{ - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[AudioInputService] start."; - channel_->receive(this->shared_from_this()); - }); -} - -void AudioInputService::stop() -{ - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[AudioInputService] stop."; - audioInput_->stop(); - }); -} - -void AudioInputService::pause() -{ - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[AudioInputService] pause."; - }); -} - -void AudioInputService::resume() -{ - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[AudioInputService] resume."; - }); -} - -void AudioInputService::fillFeatures(aasdk::proto::messages::ServiceDiscoveryResponse& response) -{ - OPENAUTO_LOG(info) << "[AudioInputService] fill features."; - - auto* channelDescriptor = response.add_channels(); - channelDescriptor->set_channel_id(static_cast(channel_->getId())); - - auto* avInputChannel = channelDescriptor->mutable_av_input_channel(); - avInputChannel->set_stream_type(aasdk::proto::enums::AVStreamType::AUDIO); - - auto audioConfig = avInputChannel->mutable_audio_config(); - audioConfig->set_sample_rate(audioInput_->getSampleRate()); - audioConfig->set_bit_depth(audioInput_->getSampleSize()); - audioConfig->set_channel_count(audioInput_->getChannelCount()); -} - -void AudioInputService::onChannelOpenRequest(const aasdk::proto::messages::ChannelOpenRequest& request) -{ - OPENAUTO_LOG(info) << "[AudioInputService] open request, priority: " << request.priority(); - const aasdk::proto::enums::Status::Enum status = audioInput_->open() ? aasdk::proto::enums::Status::OK : aasdk::proto::enums::Status::FAIL; - OPENAUTO_LOG(info) << "[AudioInputService] open status: " << status; - - aasdk::proto::messages::ChannelOpenResponse response; - response.set_status(status); - - auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() {}, std::bind(&AudioInputService::onChannelError, this->shared_from_this(), std::placeholders::_1)); - channel_->sendChannelOpenResponse(response, std::move(promise)); - - channel_->receive(this->shared_from_this()); -} - -void AudioInputService::onAVChannelSetupRequest(const aasdk::proto::messages::AVChannelSetupRequest& request) -{ - OPENAUTO_LOG(info) << "[AudioInputService] setup request, config index: " << request.config_index(); - const aasdk::proto::enums::AVChannelSetupStatus::Enum status = aasdk::proto::enums::AVChannelSetupStatus::OK; - OPENAUTO_LOG(info) << "[AudioInputService] setup status: " << status; - - - aasdk::proto::messages::AVChannelSetupResponse response; - response.set_media_status(status); - response.set_max_unacked(1); - response.add_configs(0); - - auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() {}, std::bind(&AudioInputService::onChannelError, this->shared_from_this(), std::placeholders::_1)); - channel_->sendAVChannelSetupResponse(response, std::move(promise)); - - channel_->receive(this->shared_from_this()); -} - -void AudioInputService::onAVInputOpenRequest(const aasdk::proto::messages::AVInputOpenRequest& request) -{ - OPENAUTO_LOG(info) << "[AudioInputService] input open request, open: " << request.open() - << ", anc: " << request.anc() - << ", ec: " << request.ec() - << ", max unacked: " << request.max_unacked(); - - if(request.open()) - { - auto startPromise = projection::IAudioInput::StartPromise::defer(strand_); - startPromise->then(std::bind(&AudioInputService::onAudioInputOpenSucceed, this->shared_from_this()), - [this, self = this->shared_from_this()]() { - OPENAUTO_LOG(error) << "[AudioInputService] audio input open failed."; - - aasdk::proto::messages::AVInputOpenResponse response; - response.set_session(session_); - response.set_value(1); - - auto sendPromise = aasdk::channel::SendPromise::defer(strand_); - sendPromise->then([]() {}, std::bind(&AudioInputService::onChannelError, this->shared_from_this(), std::placeholders::_1)); - channel_->sendAVInputOpenResponse(response, std::move(sendPromise)); - }); - - audioInput_->start(std::move(startPromise)); - } - else - { - audioInput_->stop(); - - aasdk::proto::messages::AVInputOpenResponse response; - response.set_session(session_); - response.set_value(0); - - auto sendPromise = aasdk::channel::SendPromise::defer(strand_); - sendPromise->then([]() {}, std::bind(&AudioInputService::onChannelError, this->shared_from_this(), std::placeholders::_1)); - channel_->sendAVInputOpenResponse(response, std::move(sendPromise)); - } - - channel_->receive(this->shared_from_this()); -} - -void AudioInputService::onAVMediaAckIndication(const aasdk::proto::messages::AVMediaAckIndication&) -{ - channel_->receive(this->shared_from_this()); -} - -void AudioInputService::onChannelError(const aasdk::error::Error& e) -{ - OPENAUTO_LOG(error) << "[AudioInputService] channel error: " << e.what(); -} - -void AudioInputService::onAudioInputOpenSucceed() -{ - OPENAUTO_LOG(info) << "[AudioInputService] audio input open succeed."; - - aasdk::proto::messages::AVInputOpenResponse response; - response.set_session(session_); - response.set_value(0); - - auto sendPromise = aasdk::channel::SendPromise::defer(strand_); - sendPromise->then([]() {}, std::bind(&AudioInputService::onChannelError, this->shared_from_this(), std::placeholders::_1)); - channel_->sendAVInputOpenResponse(response, std::move(sendPromise)); - - this->readAudioInput(); -} - -void AudioInputService::onAudioInputDataReady(aasdk::common::Data data) -{ - auto sendPromise = aasdk::channel::SendPromise::defer(strand_); - sendPromise->then(std::bind(&AudioInputService::readAudioInput, this->shared_from_this()), - std::bind(&AudioInputService::onChannelError, this->shared_from_this(), std::placeholders::_1)); - - auto timestamp = std::chrono::duration_cast(std::chrono::high_resolution_clock::now().time_since_epoch()); - channel_->sendAVMediaWithTimestampIndication(timestamp.count(), std::move(data), std::move(sendPromise)); -} - -void AudioInputService::readAudioInput() -{ - if(audioInput_->isActive()) - { - auto readPromise = projection::IAudioInput::ReadPromise::defer(strand_); - readPromise->then(std::bind(&AudioInputService::onAudioInputDataReady, this->shared_from_this(), std::placeholders::_1), - [this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[AudioInputService] audio input read rejected."; - }); - - audioInput_->read(std::move(readPromise)); - } -} - -} -} -} -} diff --git a/src/autoapp/Service/AudioService.cpp b/src/autoapp/Service/AudioService.cpp deleted file mode 100644 index 8db28a7..0000000 --- a/src/autoapp/Service/AudioService.cpp +++ /dev/null @@ -1,196 +0,0 @@ -/* -* 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 . -*/ - -#include -#include - -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace service -{ - -AudioService::AudioService(boost::asio::io_service& ioService, aasdk::channel::av::IAudioServiceChannel::Pointer channel, projection::IAudioOutput::Pointer audioOutput) - : strand_(ioService) - , channel_(std::move(channel)) - , audioOutput_(std::move(audioOutput)) - , session_(-1) -{ - -} - -void AudioService::start() -{ - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[AudioService] start, channel: " << aasdk::messenger::channelIdToString(channel_->getId()); - channel_->receive(this->shared_from_this()); - }); -} - -void AudioService::stop() -{ - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[AudioService] stop, channel: " << aasdk::messenger::channelIdToString(channel_->getId()); - audioOutput_->stop(); - }); -} - -void AudioService::pause() -{ - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[AudioService] pause."; - }); -} - -void AudioService::resume() -{ - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[AudioService] resume."; - }); -} - -void AudioService::fillFeatures(aasdk::proto::messages::ServiceDiscoveryResponse& response) -{ - OPENAUTO_LOG(info) << "[AudioService] fill features, channel: " << aasdk::messenger::channelIdToString(channel_->getId()); - - auto* channelDescriptor = response.add_channels(); - channelDescriptor->set_channel_id(static_cast(channel_->getId())); - - auto* audioChannel = channelDescriptor->mutable_av_channel(); - audioChannel->set_stream_type(aasdk::proto::enums::AVStreamType::AUDIO); - - switch(channel_->getId()) - { - case aasdk::messenger::ChannelId::SYSTEM_AUDIO: - audioChannel->set_audio_type(aasdk::proto::enums::AudioType::SYSTEM); - break; - - case aasdk::messenger::ChannelId::MEDIA_AUDIO: - audioChannel->set_audio_type(aasdk::proto::enums::AudioType::MEDIA); - break; - - case aasdk::messenger::ChannelId::SPEECH_AUDIO: - audioChannel->set_audio_type(aasdk::proto::enums::AudioType::SPEECH); - break; - default: - break; - } - - audioChannel->set_available_while_in_call(true); - - auto* audioConfig = audioChannel->add_audio_configs(); - audioConfig->set_sample_rate(audioOutput_->getSampleRate()); - audioConfig->set_bit_depth(audioOutput_->getSampleSize()); - audioConfig->set_channel_count(audioOutput_->getChannelCount()); -} - -void AudioService::onChannelOpenRequest(const aasdk::proto::messages::ChannelOpenRequest& request) -{ - OPENAUTO_LOG(info) << "[AudioService] open request" - << ", channel: " << aasdk::messenger::channelIdToString(channel_->getId()) - << ", priority: " << request.priority(); - - OPENAUTO_LOG(debug) << "[AudioService] channel: " << aasdk::messenger::channelIdToString(channel_->getId()) - << " audio output sample rate: " << audioOutput_->getSampleRate() - << ", sample size: " << audioOutput_->getSampleSize() - << ", channel count: " << audioOutput_->getChannelCount(); - - const aasdk::proto::enums::Status::Enum status = audioOutput_->open() ? aasdk::proto::enums::Status::OK : aasdk::proto::enums::Status::FAIL; - OPENAUTO_LOG(info) << "[AudioService] open status: " << status - << ", channel: " << aasdk::messenger::channelIdToString(channel_->getId()); - - aasdk::proto::messages::ChannelOpenResponse response; - response.set_status(status); - - auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() {}, std::bind(&AudioService::onChannelError, this->shared_from_this(), std::placeholders::_1)); - channel_->sendChannelOpenResponse(response, std::move(promise)); - channel_->receive(this->shared_from_this()); -} - -void AudioService::onAVChannelSetupRequest(const aasdk::proto::messages::AVChannelSetupRequest& request) -{ - OPENAUTO_LOG(info) << "[AudioService] setup request" - << ", channel: " << aasdk::messenger::channelIdToString(channel_->getId()) - << ", config index: " << request.config_index(); - const aasdk::proto::enums::AVChannelSetupStatus::Enum status = aasdk::proto::enums::AVChannelSetupStatus::OK; - OPENAUTO_LOG(info) << "[AudioService] setup status: " << status - << ", channel: " << aasdk::messenger::channelIdToString(channel_->getId()); - - aasdk::proto::messages::AVChannelSetupResponse response; - response.set_media_status(status); - response.set_max_unacked(1); - response.add_configs(0); - - auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() {}, std::bind(&AudioService::onChannelError, this->shared_from_this(), std::placeholders::_1)); - channel_->sendAVChannelSetupResponse(response, std::move(promise)); - channel_->receive(this->shared_from_this()); -} - -void AudioService::onAVChannelStartIndication(const aasdk::proto::messages::AVChannelStartIndication& indication) -{ - OPENAUTO_LOG(info) << "[AudioService] start indication" - << ", channel: " << aasdk::messenger::channelIdToString(channel_->getId()) - << ", session: " << indication.session(); - session_ = indication.session(); - audioOutput_->start(); - channel_->receive(this->shared_from_this()); -} - -void AudioService::onAVChannelStopIndication(const aasdk::proto::messages::AVChannelStopIndication& indication) -{ - OPENAUTO_LOG(info) << "[AudioService] stop indication" - << ", channel: " << aasdk::messenger::channelIdToString(channel_->getId()) - << ", session: " << session_; - session_ = -1; - audioOutput_->suspend(); - channel_->receive(this->shared_from_this()); -} - -void AudioService::onAVMediaWithTimestampIndication(aasdk::messenger::Timestamp::ValueType timestamp, const aasdk::common::DataConstBuffer& buffer) -{ - audioOutput_->write(timestamp, buffer); - aasdk::proto::messages::AVMediaAckIndication indication; - indication.set_session(session_); - indication.set_value(1); - - auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() {}, std::bind(&AudioService::onChannelError, this->shared_from_this(), std::placeholders::_1)); - channel_->sendAVMediaAckIndication(indication, std::move(promise)); - channel_->receive(this->shared_from_this()); -} - -void AudioService::onAVMediaIndication(const aasdk::common::DataConstBuffer& buffer) -{ - this->onAVMediaWithTimestampIndication(0, buffer); -} - -void AudioService::onChannelError(const aasdk::error::Error& e) -{ - OPENAUTO_LOG(error) << "[AudioService] channel error: " << e.what() - << ", channel: " << aasdk::messenger::channelIdToString(channel_->getId()); -} - -} -} -} -} diff --git a/src/autoapp/Service/Bluetooth/BluetoothService.cpp b/src/autoapp/Service/Bluetooth/BluetoothService.cpp new file mode 100644 index 0000000..a9e7704 --- /dev/null +++ b/src/autoapp/Service/Bluetooth/BluetoothService.cpp @@ -0,0 +1,122 @@ +/* +* 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 . +*/ + +#include +#include + +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace bluetooth { + + BluetoothService::BluetoothService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger, + projection::IBluetoothDevice::Pointer bluetoothDevice) + : strand_(ioService), + channel_(std::make_shared(strand_, std::move(messenger))), + bluetoothDevice_(std::move(bluetoothDevice)) { + + } + + void BluetoothService::start() { + strand_.dispatch([this, self = this->shared_from_this()]() { + 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."; + bluetoothDevice_->stop(); + }); + } + + void BluetoothService::pause() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[BluetoothService] pause."; + }); + } + + void BluetoothService::resume() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[BluetoothService] resume."; + }); + } + + void BluetoothService::fillFeatures( + aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) { + OPENAUTO_LOG(info) << "[BluetoothService] fill features"; + + if (bluetoothDevice_->isAvailable()) { + OPENAUTO_LOG(info) << "[BluetoothService] sending local adapter adress: " + << bluetoothDevice_->getLocalAddress(); + + auto *channelDescriptor = response.add_channels(); + channelDescriptor->set_channel_id(static_cast(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); + } + } + + 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; + + aap_protobuf::channel::ChannelOpenResponse response; + response.set_status(status); + + auto promise = aasdk::channel::SendPromise::defer(strand_); + promise->then([]() {}, std::bind(&BluetoothService::onChannelError, this->shared_from_this(), + std::placeholders::_1)); + channel_->sendChannelOpenResponse(response, std::move(promise)); + + channel_->receive(this->shared_from_this()); + } + + void BluetoothService::onBluetoothPairingRequest( + const aap_protobuf::channel::bluetooth::event::BluetoothPairingRequest &request) { + OPENAUTO_LOG(info) << "[BluetoothService] pairing request, address: " << request.phone_address(); + + aap_protobuf::service::bluetooth::message::BluetoothPairingResponse response; + + const auto isPaired = bluetoothDevice_->isPaired(request.phone_address()); + response.set_already_paired(isPaired); + response.set_status(aap_protobuf::shared::MessageStatus::STATUS_SUCCESS); + + auto promise = aasdk::channel::SendPromise::defer(strand_); + promise->then([]() {}, std::bind(&BluetoothService::onChannelError, this->shared_from_this(), + std::placeholders::_1)); + channel_->sendBluetoothPairingResponse(response, std::move(promise)); + + channel_->receive(this->shared_from_this()); + } + + void BluetoothService::onChannelError(const aasdk::error::Error &e) { + OPENAUTO_LOG(error) << "[BluetoothService] channel error: " << e.what(); + } + + } + } + } + } +} \ No newline at end of file diff --git a/src/autoapp/Service/BluetoothService.cpp b/src/autoapp/Service/BluetoothService.cpp deleted file mode 100644 index 707febb..0000000 --- a/src/autoapp/Service/BluetoothService.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/* -* 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 . -*/ - -#include -#include - -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace service -{ - -BluetoothService::BluetoothService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, projection::IBluetoothDevice::Pointer bluetoothDevice) - : strand_(ioService) - , channel_(std::make_shared(strand_, std::move(messenger))) - , bluetoothDevice_(std::move(bluetoothDevice)) -{ - -} - -void BluetoothService::start() -{ - strand_.dispatch([this, self = this->shared_from_this()]() { - 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."; - bluetoothDevice_->stop(); - }); -} - -void BluetoothService::pause() -{ - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[BluetoothService] pause."; - }); -} - -void BluetoothService::resume() -{ - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[BluetoothService] resume."; - }); -} - -void BluetoothService::fillFeatures(aasdk::proto::messages::ServiceDiscoveryResponse& response) -{ - OPENAUTO_LOG(info) << "[BluetoothService] fill features"; - - if(bluetoothDevice_->isAvailable()) - { - OPENAUTO_LOG(info) << "[BluetoothService] sending local adapter adress: " << bluetoothDevice_->getLocalAddress(); - - auto* channelDescriptor = response.add_channels(); - channelDescriptor->set_channel_id(static_cast(channel_->getId())); - auto bluetoothChannel = channelDescriptor->mutable_bluetooth_channel(); - bluetoothChannel->set_adapter_address(bluetoothDevice_->getLocalAddress()); - bluetoothChannel->add_supported_pairing_methods(aasdk::proto::enums::BluetoothPairingMethod_Enum_HFP); - bluetoothChannel->add_supported_pairing_methods(aasdk::proto::enums::BluetoothPairingMethod_Enum_A2DP); - } -} - -void BluetoothService::onChannelOpenRequest(const aasdk::proto::messages::ChannelOpenRequest& request) -{ - OPENAUTO_LOG(info) << "[BluetoothService] open request, priority: " << request.priority(); - const aasdk::proto::enums::Status::Enum status = aasdk::proto::enums::Status::OK; - OPENAUTO_LOG(info) << "[BluetoothService] open status: " << status; - - aasdk::proto::messages::ChannelOpenResponse response; - response.set_status(status); - - auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() {}, std::bind(&BluetoothService::onChannelError, this->shared_from_this(), std::placeholders::_1)); - channel_->sendChannelOpenResponse(response, std::move(promise)); - - channel_->receive(this->shared_from_this()); -} - -void BluetoothService::onBluetoothPairingRequest(const aasdk::proto::messages::BluetoothPairingRequest& request) -{ - OPENAUTO_LOG(info) << "[BluetoothService] pairing request, address: " << request.phone_address(); - - aasdk::proto::messages::BluetoothPairingResponse response; - - const auto isPaired = bluetoothDevice_->isPaired(request.phone_address()); - response.set_already_paired(isPaired); - response.set_status(isPaired ? aasdk::proto::enums::BluetoothPairingStatus::OK : aasdk::proto::enums::BluetoothPairingStatus::FAIL); - - auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() {}, std::bind(&BluetoothService::onChannelError, this->shared_from_this(), std::placeholders::_1)); - channel_->sendBluetoothPairingResponse(response, std::move(promise)); - - channel_->receive(this->shared_from_this()); -} - -void BluetoothService::onChannelError(const aasdk::error::Error& e) -{ - OPENAUTO_LOG(error) << "[BluetoothService] channel error: " << e.what(); -} - -} -} -} -} diff --git a/src/autoapp/Service/GenericNotification/GenericNotificationService.cpp b/src/autoapp/Service/GenericNotification/GenericNotificationService.cpp new file mode 100644 index 0000000..2d3116d --- /dev/null +++ b/src/autoapp/Service/GenericNotification/GenericNotificationService.cpp @@ -0,0 +1,79 @@ +/* +* 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 . +*/ + +#include +#include +#include +#include + +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace genericnotification { + + GenericNotificationService::GenericNotificationService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger) + : strand_(ioService), + timer_(ioService), + channel_(std::make_shared(strand_, std::move(messenger))) { + + } + + void GenericNotificationService::start() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[GenericNotificationService] start."; + }); + } + + void GenericNotificationService::stop() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[GenericNotificationService] stop."; + }); + } + + void GenericNotificationService::pause() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[GenericNotificationService] pause."; + }); + } + + void GenericNotificationService::resume() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[GenericNotificationService] resume."; + }); + } + + void GenericNotificationService::fillFeatures( + aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) { + OPENAUTO_LOG(info) << "[GenericNotificationService] fill features."; + + auto *channelDescriptor = response.add_channels(); + channelDescriptor->set_channel_id(static_cast(channel_->getId())); + + auto *vendorExtension = channelDescriptor->mutable_wifi_projection_service(); + } + + void GenericNotificationService::onChannelError(const aasdk::error::Error &e) { + OPENAUTO_LOG(error) << "[GenericNotificationService] channel error: " << e.what(); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/autoapp/Service/InputService.cpp b/src/autoapp/Service/InputService.cpp deleted file mode 100644 index f038bb6..0000000 --- a/src/autoapp/Service/InputService.cpp +++ /dev/null @@ -1,205 +0,0 @@ -/* -* 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 . -*/ - -#include -#include -#include - -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace service -{ - -InputService::InputService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, projection::IInputDevice::Pointer inputDevice) - : strand_(ioService) - , channel_(std::make_shared(strand_, std::move(messenger))) - , inputDevice_(std::move(inputDevice)) -{ - -} - -void InputService::start() -{ - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[InputService] start."; - channel_->receive(this->shared_from_this()); - }); -} - -void InputService::stop() -{ - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[InputService] stop."; - inputDevice_->stop(); - }); -} - -void InputService::pause() -{ - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[InputService] pause."; - }); -} - -void InputService::resume() -{ - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[InputService] resume."; - }); -} - -void InputService::fillFeatures(aasdk::proto::messages::ServiceDiscoveryResponse& response) -{ - OPENAUTO_LOG(info) << "[InputService] fill features."; - - auto* channelDescriptor = response.add_channels(); - channelDescriptor->set_channel_id(static_cast(channel_->getId())); - - auto* inputChannel = channelDescriptor->mutable_input_channel(); - - const auto& supportedButtonCodes = inputDevice_->getSupportedButtonCodes(); - - for(const auto& buttonCode : supportedButtonCodes) - { - inputChannel->add_supported_keycodes(buttonCode); - } - - if(inputDevice_->hasTouchscreen()) - { - const auto& touchscreenSurface = inputDevice_->getTouchscreenGeometry(); - auto touchscreenConfig = inputChannel->mutable_touch_screen_config(); - - touchscreenConfig->set_width(touchscreenSurface.width()); - touchscreenConfig->set_height(touchscreenSurface.height()); - } -} - -void InputService::onChannelOpenRequest(const aasdk::proto::messages::ChannelOpenRequest& request) -{ - OPENAUTO_LOG(info) << "[InputService] open request, priority: " << request.priority(); - const aasdk::proto::enums::Status::Enum status = aasdk::proto::enums::Status::OK; - OPENAUTO_LOG(info) << "[InputService] open status: " << status; - - aasdk::proto::messages::ChannelOpenResponse response; - response.set_status(status); - - auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() {}, std::bind(&InputService::onChannelError, this->shared_from_this(), std::placeholders::_1)); - channel_->sendChannelOpenResponse(response, std::move(promise)); - - channel_->receive(this->shared_from_this()); -} - -void InputService::onBindingRequest(const aasdk::proto::messages::BindingRequest& request) -{ - OPENAUTO_LOG(info) << "[InputService] binding request, scan codes count: " << request.scan_codes_size(); - - aasdk::proto::enums::Status::Enum status = aasdk::proto::enums::Status::OK; - const auto& supportedButtonCodes = inputDevice_->getSupportedButtonCodes(); - - for(int i = 0; i < request.scan_codes_size(); ++i) - { - if(std::find(supportedButtonCodes.begin(), supportedButtonCodes.end(), request.scan_codes(i)) == supportedButtonCodes.end()) - { - OPENAUTO_LOG(error) << "[InputService] binding request, scan code: " << request.scan_codes(i) - << " is not supported."; - - status = aasdk::proto::enums::Status::FAIL; - break; - } - } - - aasdk::proto::messages::BindingResponse response; - response.set_status(status); - - if(status == aasdk::proto::enums::Status::OK) - { - inputDevice_->start(*this); - } - - OPENAUTO_LOG(info) << "[InputService] binding request, status: " << status; - - auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() {}, std::bind(&InputService::onChannelError, this->shared_from_this(), std::placeholders::_1)); - channel_->sendBindingResponse(response, std::move(promise)); - channel_->receive(this->shared_from_this()); -} - -void InputService::onChannelError(const aasdk::error::Error& e) -{ - OPENAUTO_LOG(error) << "[SensorService] channel error: " << e.what(); -} - -void InputService::onButtonEvent(const projection::ButtonEvent& event) -{ - auto timestamp = std::chrono::duration_cast(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)]() { - aasdk::proto::messages::InputEventIndication inputEventIndication; - inputEventIndication.set_timestamp(timestamp.count()); - - if(event.code == aasdk::proto::enums::ButtonCode::SCROLL_WHEEL) - { - auto relativeEvent = inputEventIndication.mutable_relative_input_event()->add_relative_input_events(); - relativeEvent->set_delta(event.wheelDirection == projection::WheelDirection::LEFT ? -1 : 1); - relativeEvent->set_scan_code(event.code); - } - else - { - auto buttonEvent = inputEventIndication.mutable_button_event()->add_button_events(); - buttonEvent->set_meta(0); - buttonEvent->set_is_pressed(event.type == projection::ButtonEventType::PRESS); - buttonEvent->set_long_press(false); - buttonEvent->set_scan_code(event.code); - } - - auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() {}, std::bind(&InputService::onChannelError, this->shared_from_this(), std::placeholders::_1)); - channel_->sendInputEventIndication(inputEventIndication, std::move(promise)); - }); -} - -void InputService::onTouchEvent(const projection::TouchEvent& event) -{ - auto timestamp = std::chrono::duration_cast(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)]() { - aasdk::proto::messages::InputEventIndication inputEventIndication; - inputEventIndication.set_timestamp(timestamp.count()); - - auto touchEvent = inputEventIndication.mutable_touch_event(); - touchEvent->set_touch_action(event.type); - auto touchLocation = touchEvent->add_touch_location(); - touchLocation->set_x(event.x); - touchLocation->set_y(event.y); - touchLocation->set_pointer_id(0); - - auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() {}, std::bind(&InputService::onChannelError, this->shared_from_this(), std::placeholders::_1)); - channel_->sendInputEventIndication(inputEventIndication, std::move(promise)); - }); -} - -} -} -} -} diff --git a/src/autoapp/Service/InputSource/InputSourceService.cpp b/src/autoapp/Service/InputSource/InputSourceService.cpp new file mode 100644 index 0000000..54aeb5b --- /dev/null +++ b/src/autoapp/Service/InputSource/InputSourceService.cpp @@ -0,0 +1,196 @@ +/* +* 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 . +*/ + +#include +#include +#include + +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace inputsource { + InputSourceService::InputSourceService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger, + projection::IInputDevice::Pointer inputDevice) + : strand_(ioService), + channel_(std::make_shared(strand_, std::move(messenger))), + inputDevice_(std::move(inputDevice)) { + + } + + void InputSourceService::start() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[InputService] start."; + channel_->receive(this->shared_from_this()); + }); + } + + void InputSourceService::stop() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[InputService] stop."; + inputDevice_->stop(); + }); + } + + void InputSourceService::pause() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[InputService] pause."; + }); + } + + void InputSourceService::resume() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[InputService] resume."; + }); + } + + void InputSourceService::fillFeatures( + aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) { + OPENAUTO_LOG(info) << "[InputService] fill features."; + + auto *channelDescriptor = response.add_channels(); + channelDescriptor->set_channel_id(static_cast(channel_->getId())); + + auto *inputChannel = channelDescriptor->mutable_input_service(); + + const auto &supportedButtonCodes = inputDevice_->getSupportedButtonCodes(); + + for (const auto &buttonCode: supportedButtonCodes) { + inputChannel->add_supported_keycodes(buttonCode); + } + + if (inputDevice_->hasTouchscreen()) { + const auto &touchscreenSurface = inputDevice_->getTouchscreenGeometry(); + auto touchscreenConfig = inputChannel->add_touch_screen_config(); + + touchscreenConfig->set_width(touchscreenSurface.width()); + touchscreenConfig->set_height(touchscreenSurface.height()); + } + } + + 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; + + aap_protobuf::channel::ChannelOpenResponse response; + 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(); + + aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS; + const auto &supportedButtonCodes = inputDevice_->getSupportedButtonCodes(); + + 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; + break; + } + } + + aap_protobuf::service::media::sink::message::BindingResponse response; + response.set_status(status); + + if (status == aap_protobuf::shared::MessageStatus::STATUS_SUCCESS) { + inputDevice_->start(*this); + } + + OPENAUTO_LOG(info) << "[InputService] binding request, 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_->receive(this->shared_from_this()); + } + + void InputSourceService::onChannelError(const aasdk::error::Error &e) { + OPENAUTO_LOG(error) << "[InputSourceService] channel error: " << e.what(); + } + + void InputSourceService::onButtonEvent(const projection::ButtonEvent &event) { + auto timestamp = std::chrono::duration_cast( + 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()); + + if (event.code == aap_protobuf::service::media::sink::KeyCode::KEYCODE_ROTARY_CONTROLLER) { + auto relativeEvent = inputEventIndication.mutable_relative_input_event()->add_relative_input_events(); + relativeEvent->set_delta(event.wheelDirection == projection::WheelDirection::LEFT ? -1 : 1); + relativeEvent->set_scan_code(event.code); + } else { + auto buttonEvent = inputEventIndication.mutable_button_event()->add_keys(); + buttonEvent->set_metastate(0); + buttonEvent->set_down(event.type == projection::ButtonEventType::PRESS); + buttonEvent->set_longpress(false); + buttonEvent->set_keycode(event.code); + } + + 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)); + }); + } + + void InputSourceService::onTouchEvent(const projection::TouchEvent &event) { + auto timestamp = std::chrono::duration_cast( + 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()); + + auto touchEvent = inputEventIndication.mutable_touch_event(); + touchEvent->set_touch_action(event.type); + auto touchLocation = touchEvent->add_touch_location(); + touchLocation->set_x(event.x); + touchLocation->set_y(event.y); + touchLocation->set_pointer_id(0); + + 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)); + }); + } + + + + } + } + } + } +} \ No newline at end of file diff --git a/src/autoapp/Service/MediaBrowser/MediaBrowserService.cpp b/src/autoapp/Service/MediaBrowser/MediaBrowserService.cpp new file mode 100644 index 0000000..4d6d9bd --- /dev/null +++ b/src/autoapp/Service/MediaBrowser/MediaBrowserService.cpp @@ -0,0 +1,79 @@ +/* +* 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 . +*/ + +#include +#include +#include +#include + +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace mediabrowser { + + MediaBrowserService::MediaBrowserService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger) + : strand_(ioService), + timer_(ioService), + channel_(std::make_shared(strand_, std::move(messenger))) { + + } + + void MediaBrowserService::start() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[MediaBrowserService] start."; + }); + } + + void MediaBrowserService::stop() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[MediaBrowserService] stop."; + }); + } + + void MediaBrowserService::pause() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[MediaBrowserService] pause."; + }); + } + + void MediaBrowserService::resume() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[MediaBrowserService] resume."; + }); + } + + void MediaBrowserService::fillFeatures( + aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) { + OPENAUTO_LOG(info) << "[MediaBrowserService] fill features."; + + auto *channelDescriptor = response.add_channels(); + channelDescriptor->set_channel_id(static_cast(channel_->getId())); + + auto *vendorExtension = channelDescriptor->mutable_wifi_projection_service(); + } + + void MediaBrowserService::onChannelError(const aasdk::error::Error &e) { + OPENAUTO_LOG(error) << "[MediaBrowserService] channel error: " << e.what(); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/autoapp/Service/MediaPlaybackStatus/MediaPlaybackStatusService.cpp b/src/autoapp/Service/MediaPlaybackStatus/MediaPlaybackStatusService.cpp new file mode 100644 index 0000000..4a2ad10 --- /dev/null +++ b/src/autoapp/Service/MediaPlaybackStatus/MediaPlaybackStatusService.cpp @@ -0,0 +1,79 @@ +/* +* 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 . +*/ + +#include +#include +#include +#include + +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace mediaplaybackstatus { + + MediaPlaybackStatusService::MediaPlaybackStatusService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger) + : strand_(ioService), + timer_(ioService), + channel_(std::make_shared(strand_, std::move(messenger))) { + + } + + void MediaPlaybackStatusService::start() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[MediaPlaybackStatusService] start."; + }); + } + + void MediaPlaybackStatusService::stop() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[MediaPlaybackStatusService] stop."; + }); + } + + void MediaPlaybackStatusService::pause() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[MediaPlaybackStatusService] pause."; + }); + } + + void MediaPlaybackStatusService::resume() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[MediaPlaybackStatusService] resume."; + }); + } + + void MediaPlaybackStatusService::fillFeatures( + aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) { + OPENAUTO_LOG(info) << "[MediaPlaybackStatusService] fill features."; + + auto *channelDescriptor = response.add_channels(); + channelDescriptor->set_channel_id(static_cast(channel_->getId())); + + auto *vendorExtension = channelDescriptor->mutable_wifi_projection_service(); + } + + void MediaPlaybackStatusService::onChannelError(const aasdk::error::Error &e) { + OPENAUTO_LOG(error) << "[MediaPlaybackStatusService] channel error: " << e.what(); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/autoapp/Service/MediaSink/AudioMediaSinkService.cpp b/src/autoapp/Service/MediaSink/AudioMediaSinkService.cpp new file mode 100644 index 0000000..802d765 --- /dev/null +++ b/src/autoapp/Service/MediaSink/AudioMediaSinkService.cpp @@ -0,0 +1,217 @@ +/* +* 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 . +*/ + +#include +#include + +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace mediasink { + + AudioMediaSinkService::AudioMediaSinkService(boost::asio::io_service &ioService, + aasdk::channel::mediasink::audio::IAudioMediaSinkService::Pointer channel, + projection::IAudioOutput::Pointer audioOutput) + : strand_(ioService), channel_(std::move(channel)), audioOutput_(std::move(audioOutput)), session_(-1) { + + } + + void AudioMediaSinkService::start() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[MediaSinkService] start, 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()); + audioOutput_->stop(); + }); + } + + void AudioMediaSinkService::pause() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[MediaSinkService] pause."; + }); + } + + void AudioMediaSinkService::resume() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[MediaSinkService] resume."; + }); + } + + /* + * Service Discovery + */ + + void AudioMediaSinkService::fillFeatures( + aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) { + OPENAUTO_LOG(info) << "[MediaSinkService] fill features, channel: " + << aasdk::messenger::channelIdToString(channel_->getId()); + + auto *channelDescriptor = response.add_channels(); + channelDescriptor->set_channel_id(static_cast(channel_->getId())); + + auto audioChannel = channelDescriptor->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: + audioChannel->set_audio_type( + aap_protobuf::service::media::sink::AudioStreamType::AUDIO_STREAM_SYSTEM_AUDIO); + break; + + case aasdk::messenger::ChannelId::MEDIA_SINK_MEDIA_AUDIO: + audioChannel->set_audio_type(aap_protobuf::service::media::sink::AudioStreamType::AUDIO_STREAM_MEDIA); + break; + + case aasdk::messenger::ChannelId::MEDIA_SINK_GUIDANCE_AUDIO: + audioChannel->set_audio_type( + aap_protobuf::service::media::sink::AudioStreamType::AUDIO_STREAM_GUIDANCE); + break; + + case aasdk::messenger::ChannelId::MEDIA_SINK_TELEPHONY_AUDIO: + audioChannel->set_audio_type( + aap_protobuf::service::media::sink::AudioStreamType::AUDIO_STREAM_TELEPHONY); + break; + default: + break; + } + + audioChannel->set_available_while_in_call(true); + + auto *audioConfig = audioChannel->add_audio_configs(); + audioConfig->set_sampling_rate(audioOutput_->getSampleRate()); + audioConfig->set_number_of_bits(audioOutput_->getSampleSize()); + audioConfig->set_number_of_channels(audioOutput_->getChannelCount()); + } + + /* + * Base Channel Handling + */ + + 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(debug) << "[AudioMediaSinkService] Sample Rate: " << audioOutput_->getSampleRate() + << ", Sample Size: " << audioOutput_->getSampleSize() + << ", 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; + + aap_protobuf::channel::ChannelOpenResponse response; + response.set_status(status); + + auto promise = aasdk::channel::SendPromise::defer(strand_); + promise->then([]() {}, std::bind(&AudioMediaSinkService::onChannelError, this->shared_from_this(), + std::placeholders::_1)); + channel_->sendChannelOpenResponse(response, std::move(promise)); + channel_->receive(this->shared_from_this()); + } + + void AudioMediaSinkService::onChannelError(const aasdk::error::Error &e) { + OPENAUTO_LOG(error) << "[MediaSinkService] channel error: " << e.what() + << ", channel: " << aasdk::messenger::channelIdToString(channel_->getId()); + } + + /* + * Media Channel Handling + */ + + 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; + + aap_protobuf::service::media::sink::message::MediaSinkChannelSetupResponse response; + response.set_media_status(status); + response.set_max_unacked(1); + response.add_configuration_indices(0); + + auto promise = aasdk::channel::SendPromise::defer(strand_); + + promise->then([]() {}, std::bind(&AudioMediaSinkService::onChannelError, this->shared_from_this(), + std::placeholders::_1)); + channel_->sendChannelSetupResponse(response, std::move(promise)); + channel_->receive(this->shared_from_this()); + } + + + 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(); + 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_; + + session_ = -1; + audioOutput_->suspend(); + + channel_->receive(this->shared_from_this()); + } + + void AudioMediaSinkService::onMediaWithTimestampIndication(aasdk::messenger::Timestamp::ValueType timestamp, + const aasdk::common::DataConstBuffer &buffer) { + audioOutput_->write(timestamp, buffer); + + // TODO: Move MediaSourceMediaAckIndication to Ack and move to Shared. + aap_protobuf::service::media::source::message::MediaSourceMediaAckIndication indication; + indication.set_session_id(session_); + indication.set_ack(1); + + auto promise = aasdk::channel::SendPromise::defer(strand_); + promise->then([]() {}, std::bind(&AudioMediaSinkService::onChannelError, this->shared_from_this(), + std::placeholders::_1)); + channel_->sendMediaAckIndication(indication, std::move(promise)); + channel_->receive(this->shared_from_this()); + } + + void AudioMediaSinkService::onMediaIndication(const aasdk::common::DataConstBuffer &buffer) { + this->onMediaWithTimestampIndication(0, buffer); + } + + + } + } + } + } +} \ No newline at end of file diff --git a/src/autoapp/Service/MediaSink/GuidanceAudioService.cpp b/src/autoapp/Service/MediaSink/GuidanceAudioService.cpp new file mode 100644 index 0000000..1acf33a --- /dev/null +++ b/src/autoapp/Service/MediaSink/GuidanceAudioService.cpp @@ -0,0 +1,43 @@ +/* +* 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 . +*/ + +#include + +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace mediasink { + using f1x::openauto::autoapp::service::mediasink::GuidanceAudioService; + using f1x::openauto::autoapp::service::mediasink::AudioMediaSinkService; + using aasdk::channel::mediasink::audio::channel::GuidanceAudioChannel; + + GuidanceAudioService::GuidanceAudioService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger, + projection::IAudioOutput::Pointer audioOutput) + : AudioMediaSinkService( + ioService, + std::make_shared(strand_, std::move(messenger)), + std::move(audioOutput)) { + + } + } + } + } + } +} \ No newline at end of file diff --git a/src/autoapp/Service/MediaSink/MediaAudioService.cpp b/src/autoapp/Service/MediaSink/MediaAudioService.cpp new file mode 100644 index 0000000..73e3901 --- /dev/null +++ b/src/autoapp/Service/MediaSink/MediaAudioService.cpp @@ -0,0 +1,42 @@ +/* +* 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 . +*/ + +#include + + + +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace mediasink { + MediaAudioService::MediaAudioService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger, + projection::IAudioOutput::Pointer audioOutput) + : AudioMediaSinkService(ioService, + std::make_shared(strand_, + std::move( + messenger)), + std::move(audioOutput)) { + + } + } + } + } + } +} \ No newline at end of file diff --git a/src/autoapp/Service/MediaSink/SystemAudioService.cpp b/src/autoapp/Service/MediaSink/SystemAudioService.cpp new file mode 100644 index 0000000..373ae84 --- /dev/null +++ b/src/autoapp/Service/MediaSink/SystemAudioService.cpp @@ -0,0 +1,42 @@ +/* +* 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 . +*/ + +#include +#include +#include + +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace mediasink { + SystemAudioService::SystemAudioService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger, + projection::IAudioOutput::Pointer audioOutput) + : AudioMediaSinkService(ioService, + std::make_shared(strand_, + std::move(messenger)), + std::move(audioOutput)) { + + } + + } + } + } + } +} \ No newline at end of file diff --git a/src/autoapp/Service/MediaSink/TelephonyAudioService.cpp b/src/autoapp/Service/MediaSink/TelephonyAudioService.cpp new file mode 100644 index 0000000..5c7fa2b --- /dev/null +++ b/src/autoapp/Service/MediaSink/TelephonyAudioService.cpp @@ -0,0 +1,41 @@ +/* +* 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 . +*/ + +#include +#include +#include + +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace mediasink { + TelephonyAudioService::TelephonyAudioService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger, + projection::IAudioOutput::Pointer audioOutput) + : AudioMediaSinkService(ioService, std::make_shared(strand_, + std::move( + messenger)), + std::move(audioOutput)) { + + } + } + } + } + } +} \ No newline at end of file diff --git a/src/autoapp/Service/MediaSink/VideoMediaSinkService.cpp b/src/autoapp/Service/MediaSink/VideoMediaSinkService.cpp new file mode 100644 index 0000000..f672281 --- /dev/null +++ b/src/autoapp/Service/MediaSink/VideoMediaSinkService.cpp @@ -0,0 +1,208 @@ +/* +* 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 . +*/ + +#include +#include + +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace mediasink { + VideoMediaSinkService::VideoMediaSinkService(boost::asio::io_service &ioService, + aasdk::channel::mediasink::video::IVideoMediaSinkService::Pointer channel, + projection::IVideoOutput::Pointer videoOutput) + : strand_(ioService), channel_(std::move(channel)), videoOutput_(std::move(videoOutput)), session_(-1) { + + } + + void VideoMediaSinkService::start() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[MediaSinkService] start, channel: " + << aasdk::messenger::channelIdToString(channel_->getId()); + channel_->receive(this->shared_from_this()); + }); + } + + void VideoMediaSinkService::stop() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[MediaSinkService] stop, channel: " + << aasdk::messenger::channelIdToString(channel_->getId()); + }); + } + + void VideoMediaSinkService::pause() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[MediaSinkService] pause."; + }); + } + + void VideoMediaSinkService::resume() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[MediaSinkService] resume."; + }); + } + + void VideoMediaSinkService::fillFeatures( + aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) { + OPENAUTO_LOG(info) << "[MediaSinkService] fill features, channel: " + << aasdk::messenger::channelIdToString(channel_->getId()); + + auto *channelDescriptor = response.add_channels(); + channelDescriptor->set_channel_id(static_cast(channel_->getId())); + + auto *videoChannel = channelDescriptor->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); + + auto *videoConfig1 = videoChannel->add_video_configs(); + videoConfig1->set_codec_resolution(videoOutput_->getVideoResolution()); + videoConfig1->set_frame_rate(videoOutput_->getVideoFPS()); + + const auto &videoMargins = videoOutput_->getVideoMargins(); + videoConfig1->set_height_margin(videoMargins.height()); + videoConfig1->set_width_margin(videoMargins.width()); + videoConfig1->set_density(videoOutput_->getScreenDPI()); + + } + + void VideoMediaSinkService::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 = 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; + + aap_protobuf::service::media::sink::message::MediaSinkChannelSetupResponse response; + response.set_media_status(status); + response.set_max_unacked(1); + response.add_configuration_indices(0); + + 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)); + + 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()); + + 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; + + aap_protobuf::channel::ChannelOpenResponse response; + response.set_status(status); + + auto promise = aasdk::channel::SendPromise::defer(strand_); + promise->then([]() {}, std::bind(&VideoMediaSinkService::onChannelError, this->shared_from_this(), + std::placeholders::_1)); + channel_->sendChannelOpenResponse(response, std::move(promise)); + 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(); + 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_; + + channel_->receive(this->shared_from_this()); + } + + void VideoMediaSinkService::onMediaWithTimestampIndication(aasdk::messenger::Timestamp::ValueType timestamp, + const aasdk::common::DataConstBuffer &buffer) { + videoOutput_->write(timestamp, buffer); + + aap_protobuf::service::media::source::message::MediaSourceMediaAckIndication indication; + indication.set_session_id(session_); + indication.set_ack(1); + + auto promise = aasdk::channel::SendPromise::defer(strand_); + promise->then([]() {}, std::bind(&VideoMediaSinkService::onChannelError, this->shared_from_this(), + std::placeholders::_1)); + channel_->sendMediaAckIndication(indication, std::move(promise)); + channel_->receive(this->shared_from_this()); + } + + void VideoMediaSinkService::onMediaIndication(const aasdk::common::DataConstBuffer &buffer) { + this->onMediaWithTimestampIndication(0, buffer); + } + + void VideoMediaSinkService::onChannelError(const aasdk::error::Error &e) { + OPENAUTO_LOG(error) << "[MediaSinkService] channel error: " << 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..."; + try { + if (!std::ifstream("/tmp/entityexit")) { + std::ofstream("/tmp/entityexit"); + } + } catch (...) { + OPENAUTO_LOG(error) << "[VideoMediaSinkService] Error in creating entityexit"; + } + } + + this->sendVideoFocusIndication(); + channel_->receive(this->shared_from_this()); + } + + void VideoMediaSinkService::sendVideoFocusIndication() { + OPENAUTO_LOG(info) << "[VideoMediaSinkService] video focus indication."; + + 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_unsolicited(false); + + auto promise = aasdk::channel::SendPromise::defer(strand_); + promise->then([]() {}, std::bind(&VideoMediaSinkService::onChannelError, this->shared_from_this(), std::placeholders::_1)); + channel_->sendVideoFocusIndication(videoFocusIndication, std::move(promise)); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/autoapp/Service/MediaSink/VideoService.cpp b/src/autoapp/Service/MediaSink/VideoService.cpp new file mode 100644 index 0000000..57917ff --- /dev/null +++ b/src/autoapp/Service/MediaSink/VideoService.cpp @@ -0,0 +1,41 @@ +/* +* 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 . +*/ + +#include +#include +#include + +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace mediasink { + VideoService::VideoService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger, + projection::IVideoOutput::Pointer videoOutput) + : VideoMediaSinkService(ioService, std::make_shared(strand_, + std::move( + messenger)), + std::move(videoOutput)) { + + } + } + } + } + } +} \ No newline at end of file diff --git a/src/autoapp/Service/MediaSource/MediaSourceService.cpp b/src/autoapp/Service/MediaSource/MediaSourceService.cpp new file mode 100644 index 0000000..dd98385 --- /dev/null +++ b/src/autoapp/Service/MediaSource/MediaSourceService.cpp @@ -0,0 +1,272 @@ +/* +* 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 . +*/ + +#include +#include +#include +#include + +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace mediasource { + + MediaSourceService::MediaSourceService(boost::asio::io_service &ioService, + aasdk::channel::mediasource::IMediaSourceService::Pointer channel, + projection::IAudioInput::Pointer audioInput) + : strand_(ioService), channel_(std::move(channel)), audioInput_(std::move(audioInput)), session_(-1) { + + } + + void MediaSourceService::start() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[AudioInputService] start."; + channel_->receive(this->shared_from_this()); + }); + } + + void MediaSourceService::stop() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[AudioInputService] stop."; + audioInput_->stop(); + }); + } + + void MediaSourceService::pause() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[AudioInputService] pause."; + }); + } + + void MediaSourceService::resume() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[AudioInputService] resume."; + }); + } + + /* + * Service Discovery + */ + + /** + * Fill Features of Service + * @param response + */ + void MediaSourceService::fillFeatures( + aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) { + OPENAUTO_LOG(info) << "[AudioInputService] fill features."; + + auto *channelDescriptor = response.add_channels(); + channelDescriptor->set_channel_id(static_cast(channel_->getId())); + + auto *avInputChannel = channelDescriptor->mutable_media_source_service(); + avInputChannel->set_stream_type( + aap_protobuf::service::media::shared::message::MediaCodecType::MEDIA_CODEC_AUDIO_PCM); + + auto audioConfig = avInputChannel->mutable_audio_config(); + audioConfig->set_sampling_rate(audioInput_->getSampleRate()); + audioConfig->set_number_of_bits(audioInput_->getSampleSize()); + audioConfig->set_number_of_channels(audioInput_->getChannelCount()); + } + + /* + * Base Channel Handling + */ + + /** + * Open Service Channel Request + * @param request + */ + void MediaSourceService::onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) { + OPENAUTO_LOG(info) << "[AudioInputService] open request, 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::channel::ChannelOpenResponse response; + response.set_status(status); + + auto promise = aasdk::channel::SendPromise::defer(strand_); + promise->then([]() {}, + std::bind(&MediaSourceService::onChannelError, this->shared_from_this(), + std::placeholders::_1)); + channel_->sendChannelOpenResponse(response, std::move(promise)); + + channel_->receive(this->shared_from_this()); + } + + /** + * Generic Channel Error + * @param e + */ + void MediaSourceService::onChannelError(const aasdk::error::Error &e) { + OPENAUTO_LOG(error) << "[AudioInputService] channel error: " << e.what(); + } + + /* + * Media Channel Handling + */ + + /** + * Generic Media Channel Setup Request + * @param request + */ + 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; + + aap_protobuf::service::media::sink::message::MediaSinkChannelSetupResponse response; + response.set_media_status(status); + response.set_max_unacked(1); + response.add_configuration_indices(0); + + auto promise = aasdk::channel::SendPromise::defer(strand_); + + promise->then([]() {}, std::bind(&MediaSourceService::onChannelError, this->shared_from_this(), + std::placeholders::_1)); + channel_->sendChannelSetupResponse(response, std::move(promise)); + channel_->receive(this->shared_from_this()); + } + + /** + * Generic Media Ack + */ + void MediaSourceService::onMediaChannelAckIndication( + const aap_protobuf::service::media::source::message::MediaSourceMediaAckIndication &) { + channel_->receive(this->shared_from_this()); + } + + /* + * Source Media Channel Handling + */ + + // 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 + * @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(); + + if (request.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."; + + 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_); + sendPromise->then([]() {}, + std::bind(&MediaSourceService::onChannelError, + this->shared_from_this(), + std::placeholders::_1)); + channel_->sendMicrophoneOpenResponse(response, std::move(sendPromise)); + }); + + audioInput_->start(std::move(startPromise)); + } else { + 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_); + sendPromise->then([]() {}, std::bind(&MediaSourceService::onChannelError, this->shared_from_this(), + std::placeholders::_1)); + channel_->sendMicrophoneOpenResponse(response, std::move(sendPromise)); + } + + channel_->receive(this->shared_from_this()); + } + + + /** + * Sends response to advise Microphone is Open + */ + void MediaSourceService::onMediaSourceOpenSuccess() { + OPENAUTO_LOG(info) << "[AudioInputService] audio input open succeed."; + + aap_protobuf::service::media::source::message::MicrophoneResponse response; + response.set_session_id(session_); + response.set_status(aap_protobuf::shared::MessageStatus::STATUS_SUCCESS); + + auto sendPromise = aasdk::channel::SendPromise::defer(strand_); + sendPromise->then([]() {}, std::bind(&MediaSourceService::onChannelError, this->shared_from_this(), + std::placeholders::_1)); + + channel_->sendMicrophoneOpenResponse(response, std::move(sendPromise)); + + this->readMediaSource(); + } + + /** + * Resolves promise from readMediaSource. Sends Media with Timestamp Indication to channel. + * @param data + */ + void MediaSourceService::onMediaSourceDataReady(aasdk::common::Data data) { + 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(), + std::placeholders::_1)); + + auto timestamp = std::chrono::duration_cast( + std::chrono::high_resolution_clock::now().time_since_epoch()); + channel_->sendMediaSourceWithTimestampIndication(timestamp.count(), std::move(data), std::move(sendPromise)); + } + + /** + * Reads audio from a MediaSource (eg Microphone). Promise resolves to onMediaSourceDataReady. + */ + void 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."; + }); + + audioInput_->read(std::move(readPromise)); + } + } + } + } + } + } +} diff --git a/src/autoapp/Service/NavigationStatus/NavigationStatusService.cpp b/src/autoapp/Service/NavigationStatus/NavigationStatusService.cpp new file mode 100644 index 0000000..26ca1e3 --- /dev/null +++ b/src/autoapp/Service/NavigationStatus/NavigationStatusService.cpp @@ -0,0 +1,79 @@ +/* +* 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 . +*/ + +#include +#include +#include +#include + +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace navigationstatus { + + NavigationStatusService::NavigationStatusService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger) + : strand_(ioService), + timer_(ioService), + channel_(std::make_shared(strand_, std::move(messenger))) { + + } + + void NavigationStatusService::start() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[NavigationStatusService] start."; + }); + } + + void NavigationStatusService::stop() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[NavigationStatusService] stop."; + }); + } + + void NavigationStatusService::pause() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[NavigationStatusService] pause."; + }); + } + + void NavigationStatusService::resume() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[NavigationStatusService] resume."; + }); + } + + void NavigationStatusService::fillFeatures( + aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) { + OPENAUTO_LOG(info) << "[NavigationStatusService] fill features."; + + auto *channelDescriptor = response.add_channels(); + channelDescriptor->set_channel_id(static_cast(channel_->getId())); + + auto *vendorExtension = channelDescriptor->mutable_wifi_projection_service(); + } + + void NavigationStatusService::onChannelError(const aasdk::error::Error &e) { + OPENAUTO_LOG(error) << "[NavigationStatusService] channel error: " << e.what(); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/autoapp/Service/PhoneStatus/PhoneStatusService.cpp b/src/autoapp/Service/PhoneStatus/PhoneStatusService.cpp new file mode 100644 index 0000000..79a78a5 --- /dev/null +++ b/src/autoapp/Service/PhoneStatus/PhoneStatusService.cpp @@ -0,0 +1,81 @@ +/* +* 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 . +*/ + +#include +#include +#include +#include + +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace phonestatus { + + PhoneStatusService::PhoneStatusService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger) + : strand_(ioService), + timer_(ioService), + channel_(std::make_shared(strand_, std::move(messenger))) { + + } + + void PhoneStatusService::start() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[PhoneStatusService] start."; + }); + } + + void PhoneStatusService::stop() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[PhoneStatusService] stop."; + }); + } + + void PhoneStatusService::pause() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[PhoneStatusService] pause."; + }); + } + + void PhoneStatusService::resume() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[PhoneStatusService] resume."; + }); + } + + void PhoneStatusService::fillFeatures( + aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) { + OPENAUTO_LOG(info) << "[PhoneStatusService] fill features."; + + auto *channelDescriptor = response.add_channels(); + channelDescriptor->set_channel_id(static_cast(channel_->getId())); + + auto *vendorExtension = channelDescriptor->mutable_wifi_projection_service(); + } + + void PhoneStatusService::onChannelError(const aasdk::error::Error &e) { + OPENAUTO_LOG(error) << "[PhoneStatusService] channel error: " << e.what(); + } + + + } + } + } + } +} \ No newline at end of file diff --git a/src/autoapp/Service/Radio/RadioService.cpp b/src/autoapp/Service/Radio/RadioService.cpp new file mode 100644 index 0000000..d7d520a --- /dev/null +++ b/src/autoapp/Service/Radio/RadioService.cpp @@ -0,0 +1,81 @@ +/* +* 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 . +*/ + +#include +#include +#include +#include + +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace radio { + + RadioService::RadioService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger) + : strand_(ioService), + timer_(ioService), + channel_(std::make_shared(strand_, std::move(messenger))) { + + } + + void RadioService::start() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[RadioService] start."; + }); + } + + void RadioService::stop() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[RadioService] stop."; + }); + } + + void RadioService::pause() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[RadioService] pause."; + }); + } + + void RadioService::resume() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[RadioService] resume."; + }); + } + + void RadioService::fillFeatures( + aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) { + OPENAUTO_LOG(info) << "[RadioService] fill features."; + + auto *channelDescriptor = response.add_channels(); + channelDescriptor->set_channel_id(static_cast(channel_->getId())); + + auto *vendorExtension = channelDescriptor->mutable_wifi_projection_service(); + } + + void RadioService::onChannelError(const aasdk::error::Error &e) { + OPENAUTO_LOG(error) << "[RadioService] channel error: " << e.what(); + } + + + } + } + } + } +} \ No newline at end of file diff --git a/src/autoapp/Service/Sensor/SensorService.cpp b/src/autoapp/Service/Sensor/SensorService.cpp new file mode 100644 index 0000000..4db4bae --- /dev/null +++ b/src/autoapp/Service/Sensor/SensorService.cpp @@ -0,0 +1,246 @@ +/* +* 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 . +*/ + +#include +#include +#include +#include +#include +#include +#include + +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace sensor { + SensorService::SensorService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger) + : strand_(ioService), + timer_(ioService), + channel_(std::make_shared(strand_, std::move(messenger))) { + + } + + void SensorService::start() { + strand_.dispatch([this, self = this->shared_from_this()]() { + if (gps_open("127.0.0.1", "2947", &this->gpsData_)) { + OPENAUTO_LOG(warning) << "[SensorService] can't connect to GPSD."; + } else { + OPENAUTO_LOG(info) << "[SensorService] Connected to GPSD."; + gps_stream(&this->gpsData_, WATCH_ENABLE | WATCH_JSON, NULL); + this->gpsEnabled_ = true; + } + + if (is_file_exist("/tmp/night_mode_enabled")) { + this->isNight = true; + } + this->sensorPolling(); + + OPENAUTO_LOG(info) << "[SensorService] start."; + channel_->receive(this->shared_from_this()); + }); + + } + + void SensorService::stop() { + this->stopPolling = true; + + strand_.dispatch([this, self = this->shared_from_this()]() { + if (this->gpsEnabled_) { + gps_stream(&this->gpsData_, WATCH_DISABLE, NULL); + gps_close(&this->gpsData_); + this->gpsEnabled_ = false; + } + + OPENAUTO_LOG(info) << "[SensorService] stop."; + }); + } + + void SensorService::pause() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[SensorService] pause."; + }); + } + + void SensorService::resume() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[SensorService] resume."; + }); + } + + void SensorService::fillFeatures( + aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) { + OPENAUTO_LOG(info) << "[SensorService] fill features."; + + auto *channelDescriptor = response.add_channels(); + channelDescriptor->set_channel_id(static_cast(channel_->getId())); + + auto *sensorChannel = channelDescriptor->mutable_sensor_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; + + aap_protobuf::channel::ChannelOpenResponse response; + response.set_status(status); + + auto promise = aasdk::channel::SendPromise::defer(strand_); + promise->then([]() {}, + std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1)); + channel_->sendChannelOpenResponse(response, std::move(promise)); + + channel_->receive(this->shared_from_this()); + } + + void SensorService::onSensorStartRequest( + const aap_protobuf::channel::sensor::event::SensorRequest &request) { + OPENAUTO_LOG(info) << "[SensorService] sensor start request, type: " << request.sensor_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) + { + 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) + { + promise->then(std::bind(&SensorService::sendNightData, this->shared_from_this()), + std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1)); + } + else + { + promise->then([]() {}, + std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1)); + } + + channel_->sendSensorStartResponse(response, std::move(promise)); + channel_->receive(this->shared_from_this()); + } + + void 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); + + auto promise = aasdk::channel::SendPromise::defer(strand_); + promise->then([]() {}, + std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1)); + channel_->sendSensorEventIndication(indication, std::move(promise)); + } + + void SensorService::sendNightData() { + aap_protobuf::service::sensor::message::SensorBatch indication; + + if (SensorService::isNight) { + OPENAUTO_LOG(info) << "[SensorService] Mode night triggered"; + indication.add_night_mode_data()->set_night_mode(true); + } else { + OPENAUTO_LOG(info) << "[SensorService] Mode day triggered"; + indication.add_night_mode_data()->set_night_mode(false); + } + + auto promise = aasdk::channel::SendPromise::defer(strand_); + promise->then([]() {}, + std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1)); + channel_->sendSensorEventIndication(indication, std::move(promise)); + if (this->firstRun) { + this->firstRun = false; + this->previous = this->isNight; + } + } + + void SensorService::sendGPSLocationData() { + aap_protobuf::service::sensor::message::SensorBatch indication; + auto *locInd = indication.add_location_data(); + + // epoch seconds + // locInd->set_timestamp(this->gpsData_.fix.time * 1e3); + // degrees + locInd->set_latitude(this->gpsData_.fix.latitude * 1e7); + locInd->set_longitude(this->gpsData_.fix.longitude * 1e7); + // meters + auto accuracy = sqrt(pow(this->gpsData_.fix.epx, 2) + pow(this->gpsData_.fix.epy, 2)); + locInd->set_accuracy(accuracy * 1e3); + + if (this->gpsData_.set & ALTITUDE_SET) { + // meters above ellipsoid + locInd->set_altitude(this->gpsData_.fix.altitude * 1e2); + } + if (this->gpsData_.set & SPEED_SET) { + // meters per second to knots + locInd->set_speed(this->gpsData_.fix.speed * 1.94384 * 1e3); + } + if (this->gpsData_.set & TRACK_SET) { + // degrees + locInd->set_bearing(this->gpsData_.fix.track * 1e6); + } + + auto promise = aasdk::channel::SendPromise::defer(strand_); + promise->then([]() {}, + std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1)); + channel_->sendSensorEventIndication(indication, std::move(promise)); + } + + void SensorService::sensorPolling() { + if (!this->stopPolling) { + strand_.dispatch([this, self = this->shared_from_this()]() { + this->isNight = is_file_exist("/tmp/night_mode_enabled"); + if (this->previous != this->isNight && !this->firstRun) { + this->previous = this->isNight; + this->sendNightData(); + } + + 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) && + (this->gpsData_.fix.mode == MODE_2D || this->gpsData_.fix.mode == MODE_3D) && + (this->gpsData_.set & TIME_SET) && + (this->gpsData_.set & LATLON_SET)) { + this->sendGPSLocationData(); + } + + timer_.expires_from_now(boost::posix_time::milliseconds(250)); + timer_.async_wait(strand_.wrap(std::bind(&SensorService::sensorPolling, this->shared_from_this()))); + }); + } + } + + bool SensorService::is_file_exist(const char *fileName) { + 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(); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/autoapp/Service/SensorService.cpp b/src/autoapp/Service/SensorService.cpp deleted file mode 100644 index 851744e..0000000 --- a/src/autoapp/Service/SensorService.cpp +++ /dev/null @@ -1,261 +0,0 @@ -/* -* 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 . -*/ - -#include -#include -#include -#include -#include - -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace service -{ - -SensorService::SensorService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger) - : strand_(ioService), - timer_(ioService), - channel_(std::make_shared(strand_, std::move(messenger))) -{ - -} - -void SensorService::start() -{ - strand_.dispatch([this, self = this->shared_from_this()]() { - if (gps_open("127.0.0.1", "2947", &this->gpsData_)) - { - OPENAUTO_LOG(warning) << "[SensorService] can't connect to GPSD."; - } - else - { - OPENAUTO_LOG(info) << "[SensorService] Connected to GPSD."; - gps_stream(&this->gpsData_, WATCH_ENABLE | WATCH_JSON, NULL); - this->gpsEnabled_ = true; - } - - if (is_file_exist("/tmp/night_mode_enabled")) { - this->isNight = true; - } - this->sensorPolling(); - - OPENAUTO_LOG(info) << "[SensorService] start."; - channel_->receive(this->shared_from_this()); - }); - -} - -void SensorService::stop() -{ - this->stopPolling = true; - - strand_.dispatch([this, self = this->shared_from_this()]() { - if (this->gpsEnabled_) - { - gps_stream(&this->gpsData_, WATCH_DISABLE, NULL); - gps_close(&this->gpsData_); - this->gpsEnabled_ = false; - } - - OPENAUTO_LOG(info) << "[SensorService] stop."; - }); -} - -void SensorService::pause() -{ - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[SensorService] pause."; - }); -} - -void SensorService::resume() -{ - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[SensorService] resume."; - }); -} - -void SensorService::fillFeatures(aasdk::proto::messages::ServiceDiscoveryResponse& response) -{ - OPENAUTO_LOG(info) << "[SensorService] fill features."; - - auto* channelDescriptor = response.add_channels(); - channelDescriptor->set_channel_id(static_cast(channel_->getId())); - - auto* sensorChannel = channelDescriptor->mutable_sensor_channel(); - sensorChannel->add_sensors()->set_type(aasdk::proto::enums::SensorType::DRIVING_STATUS); - sensorChannel->add_sensors()->set_type(aasdk::proto::enums::SensorType::LOCATION); - sensorChannel->add_sensors()->set_type(aasdk::proto::enums::SensorType::NIGHT_DATA); -} - -void SensorService::onChannelOpenRequest(const aasdk::proto::messages::ChannelOpenRequest& request) -{ - OPENAUTO_LOG(info) << "[SensorService] open request, priority: " << request.priority(); - const aasdk::proto::enums::Status::Enum status = aasdk::proto::enums::Status::OK; - OPENAUTO_LOG(info) << "[SensorService] open status: " << status; - - aasdk::proto::messages::ChannelOpenResponse response; - response.set_status(status); - - auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() {}, std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1)); - channel_->sendChannelOpenResponse(response, std::move(promise)); - - channel_->receive(this->shared_from_this()); -} - -void SensorService::onSensorStartRequest(const aasdk::proto::messages::SensorStartRequestMessage& request) -{ - OPENAUTO_LOG(info) << "[SensorService] sensor start request, type: " << request.sensor_type(); - - aasdk::proto::messages::SensorStartResponseMessage response; - response.set_status(aasdk::proto::enums::Status::OK); - - auto promise = aasdk::channel::SendPromise::defer(strand_); - - if(request.sensor_type() == aasdk::proto::enums::SensorType::DRIVING_STATUS) - { - 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() == aasdk::proto::enums::SensorType::NIGHT_DATA) - { - promise->then(std::bind(&SensorService::sendNightData, this->shared_from_this()), - std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1)); - } - else - { - promise->then([]() {}, std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1)); - } - - channel_->sendSensorStartResponse(response, std::move(promise)); - channel_->receive(this->shared_from_this()); -} - -void SensorService::sendDrivingStatusUnrestricted() -{ - aasdk::proto::messages::SensorEventIndication indication; - indication.add_driving_status()->set_status(aasdk::proto::enums::DrivingStatus::UNRESTRICTED); - - auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() {}, std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1)); - channel_->sendSensorEventIndication(indication, std::move(promise)); -} - -void SensorService::sendNightData() -{ - aasdk::proto::messages::SensorEventIndication indication; - - if (SensorService::isNight) { - OPENAUTO_LOG(info) << "[SensorService] Mode night triggered"; - indication.add_night_mode()->set_is_night(true); - } else { - OPENAUTO_LOG(info) << "[SensorService] Mode day triggered"; - indication.add_night_mode()->set_is_night(false); - } - - auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() {}, std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1)); - channel_->sendSensorEventIndication(indication, std::move(promise)); - if (this->firstRun) { - this->firstRun = false; - this->previous = this->isNight; - } -} - -void SensorService::sendGPSLocationData() -{ - aasdk::proto::messages::SensorEventIndication indication; - auto * locInd = indication.add_gps_location(); - - // epoch seconds - locInd->set_timestamp(this->gpsData_.fix.time * 1e3); - // degrees - locInd->set_latitude(this->gpsData_.fix.latitude * 1e7); - locInd->set_longitude(this->gpsData_.fix.longitude * 1e7); - // meters - auto accuracy = sqrt(pow(this->gpsData_.fix.epx, 2) + pow(this->gpsData_.fix.epy, 2)); - locInd->set_accuracy(accuracy * 1e3); - - if (this->gpsData_.set & ALTITUDE_SET) - { - // meters above ellipsoid - locInd->set_altitude(this->gpsData_.fix.altitude * 1e2); - } - if (this->gpsData_.set & SPEED_SET) - { - // meters per second to knots - locInd->set_speed(this->gpsData_.fix.speed * 1.94384 * 1e3); - } - if (this->gpsData_.set & TRACK_SET) - { - // degrees - locInd->set_bearing(this->gpsData_.fix.track * 1e6); - } - - auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() {}, std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1)); - channel_->sendSensorEventIndication(indication, std::move(promise)); -} - -void SensorService::sensorPolling() -{ - if (!this->stopPolling) { - strand_.dispatch([this, self = this->shared_from_this()]() { - this->isNight = is_file_exist("/tmp/night_mode_enabled"); - if (this->previous != this->isNight && !this->firstRun) { - this->previous = this->isNight; - this->sendNightData(); - } - - if ((this->gpsEnabled_) && - (gps_waiting(&this->gpsData_, 0)) && - (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->sendGPSLocationData(); - } - - timer_.expires_from_now(boost::posix_time::milliseconds(250)); - timer_.async_wait(strand_.wrap(std::bind(&SensorService::sensorPolling, this->shared_from_this()))); - }); - } -} - -bool SensorService::is_file_exist(const char *fileName) -{ - 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(); -} - -} -} -} -} diff --git a/src/autoapp/Service/ServiceFactory.cpp b/src/autoapp/Service/ServiceFactory.cpp index 9ef2e70..e2ad415 100644 --- a/src/autoapp/Service/ServiceFactory.cpp +++ b/src/autoapp/Service/ServiceFactory.cpp @@ -18,18 +18,27 @@ #include #include -#include -#include -#include + +#include +#include +#include +#include + #include -#include -#include -#include -#include -#include -#include -#include -#include + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + #include #include #include @@ -39,124 +48,159 @@ #include #include #include -#include -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace service -{ -ServiceFactory::ServiceFactory(boost::asio::io_service& ioService, configuration::IConfiguration::Pointer configuration) - : ioService_(ioService) - , configuration_(std::move(configuration)) -{ +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { -} + ServiceFactory::ServiceFactory(boost::asio::io_service &ioService, + configuration::IConfiguration::Pointer configuration) + : ioService_(ioService), configuration_(std::move(configuration)) { -ServiceList ServiceFactory::create(aasdk::messenger::IMessenger::Pointer messenger) -{ - 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(ioService_, messenger, std::move(audioInput))); - this->createAudioServices(serviceList, messenger); - serviceList.emplace_back(std::make_shared(ioService_, messenger)); - serviceList.emplace_back(this->createVideoService(messenger)); - serviceList.emplace_back(this->createBluetoothService(messenger)); - serviceList.emplace_back(this->createInputService(messenger)); - serviceList.emplace_back(std::make_shared(configuration_)); + // TODO: MEDIA SERVICE - return serviceList; -} + ServiceList ServiceFactory::create(aasdk::messenger::IMessenger::Pointer messenger) { + 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(ioService_, messenger, std::move(audioInput))); + */ -IService::Pointer ServiceFactory::createVideoService(aasdk::messenger::IMessenger::Pointer messenger) -{ -#ifdef USE_OMX - auto videoOutput(std::make_shared(configuration_)); -#else - projection::IVideoOutput::Pointer videoOutput(new projection::QtVideoOutput(configuration_), std::bind(&QObject::deleteLater, std::placeholders::_1)); -#endif - return std::make_shared(ioService_, messenger, std::move(videoOutput)); -} -IService::Pointer ServiceFactory::createBluetoothService(aasdk::messenger::IMessenger::Pointer messenger) -{ - projection::IBluetoothDevice::Pointer bluetoothDevice; - switch(configuration_->getBluetoothAdapterType()) - { - case configuration::BluetoothAdapterType::LOCAL: - bluetoothDevice = projection::IBluetoothDevice::Pointer(new projection::LocalBluetoothDevice(), std::bind(&QObject::deleteLater, std::placeholders::_1)); - break; + this->createMediaSinkServices(serviceList, messenger); + this->createMediaSourceServices(serviceList, messenger); + serviceList.emplace_back(this->createSensorService(messenger)); + serviceList.emplace_back(this->createBluetoothService(messenger)); + serviceList.emplace_back(this->createInputService(messenger)); + serviceList.emplace_back(this->createWifiProjectionService(messenger)); - case configuration::BluetoothAdapterType::REMOTE: - bluetoothDevice = std::make_shared(configuration_->getBluetoothRemoteAdapterAddress()); - break; + return serviceList; + } - default: - bluetoothDevice = std::make_shared(); - break; - } + IService::Pointer ServiceFactory::createBluetoothService(aasdk::messenger::IMessenger::Pointer messenger) { + projection::IBluetoothDevice::Pointer bluetoothDevice; + switch (configuration_->getBluetoothAdapterType()) { + case configuration::BluetoothAdapterType::LOCAL: + bluetoothDevice = projection::IBluetoothDevice::Pointer(new projection::LocalBluetoothDevice(), + std::bind(&QObject::deleteLater, + std::placeholders::_1)); + break; - return std::make_shared(ioService_, messenger, std::move(bluetoothDevice)); -} + case configuration::BluetoothAdapterType::REMOTE: + bluetoothDevice = std::make_shared( + configuration_->getBluetoothRemoteAdapterAddress()); + break; -IService::Pointer ServiceFactory::createInputService(aasdk::messenger::IMessenger::Pointer messenger) -{ - QRect videoGeometry; - switch(configuration_->getVideoResolution()) - { - case aasdk::proto::enums::VideoResolution::_720p: - videoGeometry = QRect(0, 0, 1280, 720); - break; + default: + bluetoothDevice = std::make_shared(); + break; + } - case aasdk::proto::enums::VideoResolution::_1080p: - videoGeometry = QRect(0, 0, 1920, 1080); - break; + return std::make_shared(ioService_, messenger, std::move(bluetoothDevice)); + } - default: - videoGeometry = QRect(0, 0, 800, 480); - break; - } + IService::Pointer ServiceFactory::createInputService(aasdk::messenger::IMessenger::Pointer messenger) { + QRect videoGeometry; + switch (configuration_->getVideoResolution()) { + case aap_protobuf::service::media::shared::message::VideoCodecResolutionType::VIDEO_1280x720: + videoGeometry = QRect(0, 0, 1280, 720); + break; - QScreen* screen = QGuiApplication::primaryScreen(); - QRect screenGeometry = screen == nullptr ? QRect(0, 0, 1, 1) : screen->geometry(); - projection::IInputDevice::Pointer inputDevice(std::make_shared(*QApplication::instance(), configuration_, std::move(screenGeometry), std::move(videoGeometry))); + case aap_protobuf::service::media::shared::message::VideoCodecResolutionType::VIDEO_1920x1080: + videoGeometry = QRect(0, 0, 1920, 1080); + break; - return std::make_shared(ioService_, messenger, std::move(inputDevice)); -} + default: + videoGeometry = QRect(0, 0, 800, 480); + break; + } -void ServiceFactory::createAudioServices(ServiceList& serviceList, aasdk::messenger::IMessenger::Pointer messenger) -{ - if(configuration_->musicAudioChannelEnabled()) - { - auto mediaAudioOutput = configuration_->getAudioOutputBackendType() == configuration::AudioOutputBackendType::RTAUDIO ? - std::make_shared(2, 16, 48000) : - projection::IAudioOutput::Pointer(new projection::QtAudioOutput(2, 16, 48000), std::bind(&QObject::deleteLater, std::placeholders::_1)); + QScreen *screen = QGuiApplication::primaryScreen(); + QRect screenGeometry = screen == nullptr ? QRect(0, 0, 1, 1) : screen->geometry(); + projection::IInputDevice::Pointer inputDevice( + std::make_shared(*QApplication::instance(), configuration_, + std::move(screenGeometry), std::move(videoGeometry))); - serviceList.emplace_back(std::make_shared(ioService_, messenger, std::move(mediaAudioOutput))); - } + return std::make_shared(ioService_, messenger, std::move(inputDevice)); + } - if(configuration_->speechAudioChannelEnabled()) - { - auto speechAudioOutput = configuration_->getAudioOutputBackendType() == configuration::AudioOutputBackendType::RTAUDIO ? - std::make_shared(1, 16, 16000) : - projection::IAudioOutput::Pointer(new projection::QtAudioOutput(1, 16, 16000), std::bind(&QObject::deleteLater, std::placeholders::_1)); + void ServiceFactory::createMediaSinkServices(ServiceList &serviceList, + aasdk::messenger::IMessenger::Pointer messenger) { + if (configuration_->musicAudioChannelEnabled()) { + auto mediaAudioOutput = + configuration_->getAudioOutputBackendType() == configuration::AudioOutputBackendType::RTAUDIO ? + std::make_shared(2, 16, 48000) : + projection::IAudioOutput::Pointer(new projection::QtAudioOutput(2, 16, 48000), + std::bind(&QObject::deleteLater, std::placeholders::_1)); - serviceList.emplace_back(std::make_shared(ioService_, messenger, std::move(speechAudioOutput))); - } + serviceList.emplace_back( + std::make_shared(ioService_, messenger, std::move(mediaAudioOutput))); + } - auto systemAudioOutput = configuration_->getAudioOutputBackendType() == configuration::AudioOutputBackendType::RTAUDIO ? + if (configuration_->guidanceAudioChannelEnabled()) { + auto guidanceAudioOutput = + configuration_->getAudioOutputBackendType() == configuration::AudioOutputBackendType::RTAUDIO ? std::make_shared(1, 16, 16000) : - projection::IAudioOutput::Pointer(new projection::QtAudioOutput(1, 16, 16000), std::bind(&QObject::deleteLater, std::placeholders::_1)); + projection::IAudioOutput::Pointer(new projection::QtAudioOutput(1, 16, 16000), + std::bind(&QObject::deleteLater, std::placeholders::_1)); - serviceList.emplace_back(std::make_shared(ioService_, messenger, std::move(systemAudioOutput))); -} + serviceList.emplace_back( + std::make_shared(ioService_, messenger, std::move(guidanceAudioOutput))); + } -} -} -} + if (configuration_->telephonyAudioChannelEnabled()) { + auto telephonyAudioOutput = + configuration_->getAudioOutputBackendType() == configuration::AudioOutputBackendType::RTAUDIO ? + std::make_shared(1, 16, 16000) : + projection::IAudioOutput::Pointer(new projection::QtAudioOutput(1, 16, 16000), + std::bind(&QObject::deleteLater, std::placeholders::_1)); + + serviceList.emplace_back( + std::make_shared(ioService_, messenger, std::move(telephonyAudioOutput))); + } + + /* + * No Need to Check for systemAudioChannelEnabled - MUST be enabled by default. + */ + auto systemAudioOutput = + configuration_->getAudioOutputBackendType() == configuration::AudioOutputBackendType::RTAUDIO ? + std::make_shared(1, 16, 16000) : + projection::IAudioOutput::Pointer(new projection::QtAudioOutput(1, 16, 16000), + std::bind(&QObject::deleteLater, std::placeholders::_1)); + + serviceList.emplace_back( + std::make_shared(ioService_, messenger, std::move(systemAudioOutput))); + +#ifdef USE_OMX + auto videoOutput(std::make_shared(configuration_)); +#else + projection::IVideoOutput::Pointer videoOutput(new projection::QtVideoOutput(configuration_), + std::bind(&QObject::deleteLater, std::placeholders::_1)); +#endif + + serviceList.emplace_back( + std::make_shared(ioService_, messenger, std::move(videoOutput))); + } + + void ServiceFactory::createMediaSourceServices(f1x::openauto::autoapp::service::ServiceList &serviceList, + aasdk::messenger::IMessenger::Pointer messenger) { + + } + + IService::Pointer ServiceFactory::createSensorService(aasdk::messenger::IMessenger::Pointer messenger) { + return std::make_shared(ioService_, messenger); + } + + IService::Pointer ServiceFactory::createWifiProjectionService(aasdk::messenger::IMessenger::Pointer messenger) { + return std::make_shared(ioService_, messenger); + } + + } + } + } } diff --git a/src/autoapp/Service/SpeechAudioService.cpp b/src/autoapp/Service/SpeechAudioService.cpp deleted file mode 100644 index 5930095..0000000 --- a/src/autoapp/Service/SpeechAudioService.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* -* 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 . -*/ - -#include -#include - -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace service -{ - -SpeechAudioService::SpeechAudioService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, projection::IAudioOutput::Pointer audioOutput) - : AudioService(ioService, std::make_shared(strand_, std::move(messenger)), std::move(audioOutput)) -{ - -} - -} -} -} -} diff --git a/src/autoapp/Service/SystemAudioService.cpp b/src/autoapp/Service/SystemAudioService.cpp deleted file mode 100644 index 0998615..0000000 --- a/src/autoapp/Service/SystemAudioService.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* -* 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 . -*/ - -#include -#include - -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace service -{ - -SystemAudioService::SystemAudioService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, projection::IAudioOutput::Pointer audioOutput) - : AudioService(ioService, std::make_shared(strand_, std::move(messenger)), std::move(audioOutput)) -{ - -} - -} -} -} -} diff --git a/src/autoapp/Service/VendorExtension/VendorExtensionService.cpp b/src/autoapp/Service/VendorExtension/VendorExtensionService.cpp new file mode 100644 index 0000000..cbbc9c1 --- /dev/null +++ b/src/autoapp/Service/VendorExtension/VendorExtensionService.cpp @@ -0,0 +1,81 @@ +/* +* 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 . +*/ + +#include +#include +#include +#include + +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace vendorextension { + + VendorExtensionService::VendorExtensionService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger) + : strand_(ioService), + timer_(ioService), + channel_(std::make_shared(strand_, std::move(messenger))) { + + } + + void VendorExtensionService::start() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[VendorExtensionService] start."; + }); + } + + void VendorExtensionService::stop() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[VendorExtensionService] stop."; + }); + } + + void VendorExtensionService::pause() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[VendorExtensionService] pause."; + }); + } + + void VendorExtensionService::resume() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[VendorExtensionService] resume."; + }); + } + + void VendorExtensionService::fillFeatures( + aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) { + OPENAUTO_LOG(info) << "[VendorExtensionService] fill features."; + + auto *channelDescriptor = response.add_channels(); + channelDescriptor->set_channel_id(static_cast(channel_->getId())); + + auto *vendorExtension = channelDescriptor->mutable_wifi_projection_service(); + } + + void VendorExtensionService::onChannelError(const aasdk::error::Error &e) { + OPENAUTO_LOG(error) << "[VendorExtensionService] channel error: " << e.what(); + } + + + } + } + } + } +} \ No newline at end of file diff --git a/src/autoapp/Service/VideoService.cpp b/src/autoapp/Service/VideoService.cpp deleted file mode 100644 index 29a45b3..0000000 --- a/src/autoapp/Service/VideoService.cpp +++ /dev/null @@ -1,214 +0,0 @@ -/* -* 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 . -*/ - -#include -#include -#include - -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace service -{ - -VideoService::VideoService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, projection::IVideoOutput::Pointer videoOutput) - : strand_(ioService) - , channel_(std::make_shared(strand_, std::move(messenger))) - , videoOutput_(std::move(videoOutput)) - , session_(-1) -{ - -} - -void VideoService::start() -{ - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[VideoService] start."; - channel_->receive(this->shared_from_this()); - }); -} - -void VideoService::stop() -{ - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[VideoService] stop."; - videoOutput_->stop(); - }); -} - -void VideoService::pause() -{ - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[VideoService] pause."; - }); -} - -void VideoService::resume() -{ - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[VideoService] resume."; - }); -} - -void VideoService::onChannelOpenRequest(const aasdk::proto::messages::ChannelOpenRequest& request) -{ - OPENAUTO_LOG(info) << "[VideoService] open request, priority: " << request.priority(); - const aasdk::proto::enums::Status::Enum status = videoOutput_->open() ? aasdk::proto::enums::Status::OK : aasdk::proto::enums::Status::FAIL; - OPENAUTO_LOG(info) << "[VideoService] open status: " << status; - - aasdk::proto::messages::ChannelOpenResponse response; - response.set_status(status); - - auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() {}, std::bind(&VideoService::onChannelError, this->shared_from_this(), std::placeholders::_1)); - channel_->sendChannelOpenResponse(response, std::move(promise)); - - channel_->receive(this->shared_from_this()); -} - -void VideoService::onAVChannelSetupRequest(const aasdk::proto::messages::AVChannelSetupRequest& request) -{ - OPENAUTO_LOG(info) << "[VideoService] setup request, config index: " << request.config_index(); - const aasdk::proto::enums::AVChannelSetupStatus::Enum status = videoOutput_->init() ? aasdk::proto::enums::AVChannelSetupStatus::OK : aasdk::proto::enums::AVChannelSetupStatus::FAIL; - OPENAUTO_LOG(info) << "[VideoService] setup status: " << status; - - aasdk::proto::messages::AVChannelSetupResponse response; - response.set_media_status(status); - response.set_max_unacked(1); - response.add_configs(0); - - auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then(std::bind(&VideoService::sendVideoFocusIndication, this->shared_from_this()), - std::bind(&VideoService::onChannelError, this->shared_from_this(), std::placeholders::_1)); - channel_->sendAVChannelSetupResponse(response, std::move(promise)); - channel_->receive(this->shared_from_this()); -} - -void VideoService::onAVChannelStartIndication(const aasdk::proto::messages::AVChannelStartIndication& indication) -{ - OPENAUTO_LOG(info) << "[VideoService] start indication, session: " << indication.session(); - session_ = indication.session(); - - channel_->receive(this->shared_from_this()); -} - -void VideoService::onAVChannelStopIndication(const aasdk::proto::messages::AVChannelStopIndication& indication) -{ - OPENAUTO_LOG(info) << "[VideoService] stop indication, session: " << session_; - - channel_->receive(this->shared_from_this()); -} - -void VideoService::onAVMediaWithTimestampIndication(aasdk::messenger::Timestamp::ValueType timestamp, const aasdk::common::DataConstBuffer& buffer) -{ - videoOutput_->write(timestamp, buffer); - - aasdk::proto::messages::AVMediaAckIndication indication; - indication.set_session(session_); - indication.set_value(1); - - auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() {}, std::bind(&VideoService::onChannelError, this->shared_from_this(), std::placeholders::_1)); - channel_->sendAVMediaAckIndication(indication, std::move(promise)); - - channel_->receive(this->shared_from_this()); -} - -void VideoService::onAVMediaIndication(const aasdk::common::DataConstBuffer& buffer) -{ - videoOutput_->write(0, buffer); - - aasdk::proto::messages::AVMediaAckIndication indication; - indication.set_session(session_); - indication.set_value(1); - - auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() {}, std::bind(&VideoService::onChannelError, this->shared_from_this(), std::placeholders::_1)); - channel_->sendAVMediaAckIndication(indication, std::move(promise)); - - channel_->receive(this->shared_from_this()); -} - -void VideoService::onChannelError(const aasdk::error::Error& e) -{ - OPENAUTO_LOG(error) << "[VideoService] channel error: " << e.what(); -} - -void VideoService::fillFeatures(aasdk::proto::messages::ServiceDiscoveryResponse& response) -{ - OPENAUTO_LOG(info) << "[VideoService] fill features."; - - auto* channelDescriptor = response.add_channels(); - channelDescriptor->set_channel_id(static_cast(channel_->getId())); - - auto* videoChannel = channelDescriptor->mutable_av_channel(); - videoChannel->set_stream_type(aasdk::proto::enums::AVStreamType::VIDEO); - videoChannel->set_available_while_in_call(true); - - auto* videoConfig1 = videoChannel->add_video_configs(); - videoConfig1->set_video_resolution(videoOutput_->getVideoResolution()); - videoConfig1->set_video_fps(videoOutput_->getVideoFPS()); - - const auto& videoMargins = videoOutput_->getVideoMargins(); - videoConfig1->set_margin_height(videoMargins.height()); - videoConfig1->set_margin_width(videoMargins.width()); - videoConfig1->set_dpi(videoOutput_->getScreenDPI()); -} - -void VideoService::onVideoFocusRequest(const aasdk::proto::messages::VideoFocusRequest& request) -{ - OPENAUTO_LOG(info) << "[VideoService] video focus request, display index: " << request.disp_index() - << ", focus mode: " << request.focus_mode() - << ", focus reason: " << request.focus_reason(); - - // stop video service on go back to openauto - if (request.focus_mode() == 2) { - OPENAUTO_LOG(info) << "[VideoService] Back to CSNG..."; - try { - if (!std::ifstream("/tmp/entityexit")) { - std::ofstream("/tmp/entityexit"); - } - } catch (...) { - OPENAUTO_LOG(error) << "[VideoService] Error in creating entityexit"; - } - } - - this->sendVideoFocusIndication(); - channel_->receive(this->shared_from_this()); -} - -void VideoService::sendVideoFocusIndication() -{ - OPENAUTO_LOG(info) << "[VideoService] video focus indication."; - - aasdk::proto::messages::VideoFocusIndication videoFocusIndication; - videoFocusIndication.set_focus_mode(aasdk::proto::enums::VideoFocusMode::FOCUSED); - videoFocusIndication.set_unrequested(false); - - auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() {}, std::bind(&VideoService::onChannelError, this->shared_from_this(), std::placeholders::_1)); - channel_->sendVideoFocusIndication(videoFocusIndication, std::move(promise)); -} - -} -} -} -} diff --git a/src/autoapp/Service/WifiProjection/WifiProjectionStatus.cpp b/src/autoapp/Service/WifiProjection/WifiProjectionStatus.cpp new file mode 100644 index 0000000..58bcfbd --- /dev/null +++ b/src/autoapp/Service/WifiProjection/WifiProjectionStatus.cpp @@ -0,0 +1,103 @@ +/* +* 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 . +*/ + +#include +#include +#include +#include + +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { + namespace wifiprojection { + WifiProjectionService::WifiProjectionService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger) + : strand_(ioService), + timer_(ioService), + channel_(std::make_shared(strand_, std::move(messenger))) { + + } + + void WifiProjectionService::start() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[WifiProjectionService] start."; + }); + } + + void WifiProjectionService::stop() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[WifiProjectionService] stop."; + }); + } + + void WifiProjectionService::pause() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[WifiProjectionService] pause."; + }); + } + + void WifiProjectionService::resume() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[WifiProjectionService] resume."; + }); + } + + void WifiProjectionService::fillFeatures( + aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) { + OPENAUTO_LOG(info) << "[WifiProjectionService] fill features."; + + auto *channelDescriptor = response.add_channels(); + channelDescriptor->set_channel_id(static_cast(channel_->getId())); + + auto *wifiChannel = channelDescriptor->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) { + // 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; + + aap_protobuf::channel::ChannelOpenResponse response; + response.set_status(status); + + auto promise = aasdk::channel::SendPromise::defer(strand_); + promise->then([]() {}, std::bind(&WifiProjectionService::onChannelError, this->shared_from_this(), + std::placeholders::_1)); + channel_->sendChannelOpenResponse(response, std::move(promise)); + + channel_->receive(this->shared_from_this()); + } + + void WifiProjectionService::onChannelError(const aasdk::error::Error &e) { + OPENAUTO_LOG(error) << "[WifiProjectionService] channel error: " << e.what(); + } + + + } + } + } + } +} \ No newline at end of file diff --git a/src/autoapp/Service/WifiService.cpp b/src/autoapp/Service/WifiService.cpp deleted file mode 100644 index f8d0d55..0000000 --- a/src/autoapp/Service/WifiService.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* -* 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 . -*/ - -#include -#include -#include -#include - -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace service -{ - -WifiService::WifiService(configuration::IConfiguration::Pointer configuration) - : configuration_(std::move(configuration)) -{ - -} - -void WifiService::start() -{ -} - -void WifiService::stop() -{ -} - -void WifiService::pause() -{ -} - -void WifiService::resume() -{ -} - -void WifiService::fillFeatures(aasdk::proto::messages::ServiceDiscoveryResponse& response) -{ - OPENAUTO_LOG(info) << "[WifiService] fill features."; - - auto* channelDescriptor = response.add_channels(); - channelDescriptor->set_channel_id(14); - - auto* channel = channelDescriptor->mutable_wifi_channel(); - channel->set_ssid(configuration_->getParamFromFile("/etc/hostapd/hostapd.conf","ssid").toStdString()); -} - -} -} -} -} diff --git a/src/autoapp/UI/SettingsWindow.cpp b/src/autoapp/UI/SettingsWindow.cpp index de22f45..cceeec6 100644 --- a/src/autoapp/UI/SettingsWindow.cpp +++ b/src/autoapp/UI/SettingsWindow.cpp @@ -211,19 +211,19 @@ void SettingsWindow::onSave() configuration_->instantPlay(ui_->checkBoxInstantPlay->isChecked()); configuration_->hideWarning(ui_->checkBoxDontShowAgain->isChecked()); - configuration_->setVideoFPS(ui_->radioButton30FPS->isChecked() ? aasdk::proto::enums::VideoFPS::_30 : aasdk::proto::enums::VideoFPS::_60); + configuration_->setVideoFPS(ui_->radioButton30FPS->isChecked() ? aap_protobuf::service::media::shared::message::VideoFrameRateType::_30 : aap_protobuf::service::media::shared::message::VideoFrameRateType::_60); if(ui_->radioButton480p->isChecked()) { - configuration_->setVideoResolution(aasdk::proto::enums::VideoResolution::_480p); + configuration_->setVideoResolution(aap_protobuf::service::media::shared::message::VideoCodecResolutionType_480p); } else if(ui_->radioButton720p->isChecked()) { - configuration_->setVideoResolution(aasdk::proto::enums::VideoResolution::_720p); + configuration_->setVideoResolution(aap_protobuf::service::media::shared::message::VideoCodecResolutionType_720p); } else if(ui_->radioButton1080p->isChecked()) { - configuration_->setVideoResolution(aasdk::proto::enums::VideoResolution::_1080p); + configuration_->setVideoResolution(aap_protobuf::service::media::shared::message::VideoCodecResolutionType_1080p); } configuration_->setScreenDPI(static_cast(ui_->horizontalSliderScreenDPI->value())); @@ -502,12 +502,12 @@ void SettingsWindow::load() ui_->checkBoxInstantPlay->setChecked(configuration_->instantPlay()); ui_->checkBoxDontShowAgain->setChecked(configuration_->hideWarning()); - ui_->radioButton30FPS->setChecked(configuration_->getVideoFPS() == aasdk::proto::enums::VideoFPS::_30); - ui_->radioButton60FPS->setChecked(configuration_->getVideoFPS() == aasdk::proto::enums::VideoFPS::_60); + ui_->radioButton30FPS->setChecked(configuration_->getVideoFPS() == aap_protobuf::service::media::shared::message::VideoFrameRateType::_30); + ui_->radioButton60FPS->setChecked(configuration_->getVideoFPS() == aap_protobuf::service::media::shared::message::VideoFrameRateType::_60); - ui_->radioButton480p->setChecked(configuration_->getVideoResolution() == aasdk::proto::enums::VideoResolution::_480p); - ui_->radioButton720p->setChecked(configuration_->getVideoResolution() == aasdk::proto::enums::VideoResolution::_720p); - ui_->radioButton1080p->setChecked(configuration_->getVideoResolution() == aasdk::proto::enums::VideoResolution::_1080p); + ui_->radioButton480p->setChecked(configuration_->getVideoResolution() == aap_protobuf::service::media::shared::message::VideoCodecResolutionType_480p); + ui_->radioButton720p->setChecked(configuration_->getVideoResolution() == aap_protobuf::service::media::shared::message::VideoCodecResolutionType_720p); + ui_->radioButton1080p->setChecked(configuration_->getVideoResolution() == aap_protobuf::service::media::shared::message::VideoCodecResolutionType_1080p); ui_->horizontalSliderScreenDPI->setValue(static_cast(configuration_->getScreenDPI())); ui_->spinBoxOmxLayerIndex->setValue(configuration_->getOMXLayerIndex()); @@ -549,23 +549,23 @@ void SettingsWindow::load() void SettingsWindow::loadButtonCheckBoxes() { const auto& buttonCodes = configuration_->getButtonCodes(); - ui_->checkBoxPlayButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aasdk::proto::enums::ButtonCode::PLAY) != buttonCodes.end()); - ui_->checkBoxPauseButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aasdk::proto::enums::ButtonCode::PAUSE) != buttonCodes.end()); - ui_->checkBoxTogglePlayButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aasdk::proto::enums::ButtonCode::TOGGLE_PLAY) != buttonCodes.end()); - ui_->checkBoxNextTrackButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aasdk::proto::enums::ButtonCode::NEXT) != buttonCodes.end()); - ui_->checkBoxPreviousTrackButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aasdk::proto::enums::ButtonCode::PREV) != buttonCodes.end()); - ui_->checkBoxHomeButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aasdk::proto::enums::ButtonCode::HOME) != buttonCodes.end()); - ui_->checkBoxPhoneButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aasdk::proto::enums::ButtonCode::PHONE) != buttonCodes.end()); - ui_->checkBoxCallEndButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aasdk::proto::enums::ButtonCode::CALL_END) != buttonCodes.end()); - ui_->checkBoxVoiceCommandButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aasdk::proto::enums::ButtonCode::MICROPHONE_1) != buttonCodes.end()); - ui_->checkBoxLeftButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aasdk::proto::enums::ButtonCode::LEFT) != buttonCodes.end()); - ui_->checkBoxRightButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aasdk::proto::enums::ButtonCode::RIGHT) != buttonCodes.end()); - ui_->checkBoxUpButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aasdk::proto::enums::ButtonCode::UP) != buttonCodes.end()); - ui_->checkBoxDownButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aasdk::proto::enums::ButtonCode::DOWN) != buttonCodes.end()); - ui_->checkBoxScrollWheelButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aasdk::proto::enums::ButtonCode::SCROLL_WHEEL) != buttonCodes.end()); - ui_->checkBoxBackButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aasdk::proto::enums::ButtonCode::BACK) != buttonCodes.end()); - ui_->checkBoxEnterButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aasdk::proto::enums::ButtonCode::ENTER) != buttonCodes.end()); - ui_->checkBoxNavButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aasdk::proto::enums::ButtonCode::NAVIGATION) != buttonCodes.end()); + ui_->checkBoxPlayButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PLAY) != buttonCodes.end()); + ui_->checkBoxPauseButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PAUSE) != buttonCodes.end()); + ui_->checkBoxTogglePlayButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PLAY_PAUSE) != buttonCodes.end()); + ui_->checkBoxNextTrackButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_NEXT) != buttonCodes.end()); + ui_->checkBoxPreviousTrackButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PREVIOUS) != buttonCodes.end()); + ui_->checkBoxHomeButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_HOME) != buttonCodes.end()); + ui_->checkBoxPhoneButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_CALL) != buttonCodes.end()); + ui_->checkBoxCallEndButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_ENDCALL) != buttonCodes.end()); + ui_->checkBoxVoiceCommandButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_SEARCH) != buttonCodes.end()); + ui_->checkBoxLeftButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_LEFT) != buttonCodes.end()); + ui_->checkBoxRightButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_RIGHT) != buttonCodes.end()); + ui_->checkBoxUpButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_UP) != buttonCodes.end()); + ui_->checkBoxDownButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_DOWN) != buttonCodes.end()); + ui_->checkBoxScrollWheelButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_ROTARY_CONTROLLER) != buttonCodes.end()); + ui_->checkBoxBackButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_BACK) != buttonCodes.end()); + ui_->checkBoxEnterButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_CENTER) != buttonCodes.end()); + ui_->checkBoxNavButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_NAVIGATION) != buttonCodes.end()); } void SettingsWindow::setButtonCheckBoxes(bool value) @@ -592,27 +592,27 @@ void SettingsWindow::setButtonCheckBoxes(bool value) void SettingsWindow::saveButtonCheckBoxes() { configuration::IConfiguration::ButtonCodes buttonCodes; - this->saveButtonCheckBox(ui_->checkBoxPlayButton, buttonCodes, aasdk::proto::enums::ButtonCode::PLAY); - this->saveButtonCheckBox(ui_->checkBoxPauseButton, buttonCodes, aasdk::proto::enums::ButtonCode::PAUSE); - this->saveButtonCheckBox(ui_->checkBoxTogglePlayButton, buttonCodes, aasdk::proto::enums::ButtonCode::TOGGLE_PLAY); - this->saveButtonCheckBox(ui_->checkBoxNextTrackButton, buttonCodes, aasdk::proto::enums::ButtonCode::NEXT); - this->saveButtonCheckBox(ui_->checkBoxPreviousTrackButton, buttonCodes, aasdk::proto::enums::ButtonCode::PREV); - this->saveButtonCheckBox(ui_->checkBoxHomeButton, buttonCodes, aasdk::proto::enums::ButtonCode::HOME); - this->saveButtonCheckBox(ui_->checkBoxPhoneButton, buttonCodes, aasdk::proto::enums::ButtonCode::PHONE); - this->saveButtonCheckBox(ui_->checkBoxCallEndButton, buttonCodes, aasdk::proto::enums::ButtonCode::CALL_END); - this->saveButtonCheckBox(ui_->checkBoxVoiceCommandButton, buttonCodes, aasdk::proto::enums::ButtonCode::MICROPHONE_1); - this->saveButtonCheckBox(ui_->checkBoxLeftButton, buttonCodes, aasdk::proto::enums::ButtonCode::LEFT); - this->saveButtonCheckBox(ui_->checkBoxRightButton, buttonCodes, aasdk::proto::enums::ButtonCode::RIGHT); - this->saveButtonCheckBox(ui_->checkBoxUpButton, buttonCodes, aasdk::proto::enums::ButtonCode::UP); - this->saveButtonCheckBox(ui_->checkBoxDownButton, buttonCodes, aasdk::proto::enums::ButtonCode::DOWN); - this->saveButtonCheckBox(ui_->checkBoxScrollWheelButton, buttonCodes, aasdk::proto::enums::ButtonCode::SCROLL_WHEEL); - this->saveButtonCheckBox(ui_->checkBoxBackButton, buttonCodes, aasdk::proto::enums::ButtonCode::BACK); - this->saveButtonCheckBox(ui_->checkBoxEnterButton, buttonCodes, aasdk::proto::enums::ButtonCode::ENTER); - this->saveButtonCheckBox(ui_->checkBoxNavButton, buttonCodes, aasdk::proto::enums::ButtonCode::NAVIGATION); + this->saveButtonCheckBox(ui_->checkBoxPlayButton, buttonCodes, aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PLAY); + this->saveButtonCheckBox(ui_->checkBoxPauseButton, buttonCodes, aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PAUSE); + this->saveButtonCheckBox(ui_->checkBoxTogglePlayButton, buttonCodes, aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PLAY_PAUSE); + this->saveButtonCheckBox(ui_->checkBoxNextTrackButton, buttonCodes, aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_NEXT); + this->saveButtonCheckBox(ui_->checkBoxPreviousTrackButton, buttonCodes, aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PREVIOUS); + this->saveButtonCheckBox(ui_->checkBoxHomeButton, buttonCodes, aap_protobuf::service::media::sink::KeyCode::KEYCODE_HOME); + this->saveButtonCheckBox(ui_->checkBoxPhoneButton, buttonCodes, aap_protobuf::service::media::sink::KeyCode::KEYCODE_CALL); + this->saveButtonCheckBox(ui_->checkBoxCallEndButton, buttonCodes, aap_protobuf::service::media::sink::KeyCode::KEYCODE_ENDCALL); + this->saveButtonCheckBox(ui_->checkBoxVoiceCommandButton, buttonCodes, aap_protobuf::service::media::sink::KeyCode::KEYCODE_SEARCH); + this->saveButtonCheckBox(ui_->checkBoxLeftButton, buttonCodes, aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_LEFT); + this->saveButtonCheckBox(ui_->checkBoxRightButton, buttonCodes, aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_RIGHT); + this->saveButtonCheckBox(ui_->checkBoxUpButton, buttonCodes, aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_UP); + this->saveButtonCheckBox(ui_->checkBoxDownButton, buttonCodes, aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_DOWN); + this->saveButtonCheckBox(ui_->checkBoxScrollWheelButton, buttonCodes, aap_protobuf::service::media::sink::KeyCode::KEYCODE_ROTARY_CONTROLLER); + this->saveButtonCheckBox(ui_->checkBoxBackButton, buttonCodes, aap_protobuf::service::media::sink::KeyCode::KEYCODE_BACK); + this->saveButtonCheckBox(ui_->checkBoxEnterButton, buttonCodes, aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_CENTER); + this->saveButtonCheckBox(ui_->checkBoxNavButton, buttonCodes, aap_protobuf::service::media::sink::KeyCode::KEYCODE_NAVIGATION); configuration_->setButtonCodes(buttonCodes); } -void SettingsWindow::saveButtonCheckBox(const QCheckBox* checkBox, configuration::IConfiguration::ButtonCodes& buttonCodes, aasdk::proto::enums::ButtonCode::Enum buttonCode) +void SettingsWindow::saveButtonCheckBox(const QCheckBox* checkBox, configuration::IConfiguration::ButtonCodes& buttonCodes, aap_protobuf::service::media::sink::KeyCode buttonCode) { if(checkBox->isChecked()) { diff --git a/src/autoapp/autoapp.cpp b/src/autoapp/autoapp.cpp index a2f1ea1..6493abb 100644 --- a/src/autoapp/autoapp.cpp +++ b/src/autoapp/autoapp.cpp @@ -19,12 +19,12 @@ #include #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -38,7 +38,7 @@ #include #include -namespace aasdk = f1x::aasdk; +namespace aasdk = aasdk; namespace autoapp = f1x::openauto::autoapp; using ThreadPool = std::vector; diff --git a/src/btservice/AndroidBluetoothServer.cpp b/src/btservice/AndroidBluetoothServer.cpp index ee3bfd6..0a8b702 100644 --- a/src/btservice/AndroidBluetoothServer.cpp +++ b/src/btservice/AndroidBluetoothServer.cpp @@ -23,9 +23,6 @@ #include #include #include -#include -#include -#include namespace f1x { namespace openauto { @@ -61,11 +58,11 @@ namespace f1x { // connect(socket, &QBluetoothSocket::disconnected, this, // QOverload<>::of(&ChatServer::clientDisconnected)); - f1x::aasdk::proto::messages::WifiInfoRequest request; - request.set_ip_address(getIP4_("wlan0")); - request.set_port(5000); + //aap_protobuf::messages::WifiInfoRequest request; + //request.set_ip_address(getIP4_("wlan0")); + //request.set_port(5000); - sendMessage(request, 1); + //sendMessage(request, 1); } else { OPENAUTO_LOG(error) << "[AndroidBluetoothServer] received null socket during client connection."; } @@ -93,7 +90,7 @@ namespace f1x { uint16_t messageId; stream >> messageId; - //OPENAUTO_LOG(info) << "[AndroidBluetoothServer] " << length << " " << messageId; + OPENAUTO_LOG(debug) << ""; switch (messageId) { case 1: @@ -121,28 +118,30 @@ namespace f1x { } void AndroidBluetoothServer::handleWifiInfoRequest(QByteArray &buffer, uint16_t length) { - f1x::aasdk::proto::messages::WifiInfoRequest msg; - msg.ParseFromArray(buffer.data() + 4, length); - OPENAUTO_LOG(info) << "WifiInfoRequest: " << msg.DebugString(); + //TODO: Restire + //aap_protobuf::messages::WifiInfoRequest msg; + //msg.ParseFromArray(buffer.data() + 4, length); + OPENAUTO_LOG(info) << "[AndroidBluetoothServer] WifiInfoRequest: "; //<< msg.DebugString(); - f1x::aasdk::proto::messages::WifiInfoResponse response; - response.set_ip_address(getIP4_("wlan0")); - response.set_port(5000); - response.set_status(aasdk::proto::messages::WifiInfoResponse_Status_STATUS_SUCCESS); + //aap_protobuf::messages::WifiInfoResponse response; + //response.set_ip_address(getIP4_("wlan0")); + //response.set_port(5000); + //response.set_status(aap_protobuf::messages::WifiInfoResponse_Status_STATUS_SUCCESS); - sendMessage(response, 7); + //sendMessage(response, 7); } void AndroidBluetoothServer::handleWifiSecurityRequest(QByteArray &buffer, uint16_t length) { - f1x::aasdk::proto::messages::WifiSecurityReponse response; + OPENAUTO_LOG(info) << "[AndroidBluetoothServer] WifiSecurityRequest:"; + //aap_protobuf::messages::WifiSecurityReponse response; - response.set_ssid(configuration_->getParamFromFile("/etc/hostapd/hostapd.conf","ssid").toStdString()); - response.set_bssid(QNetworkInterface::interfaceFromName("wlan0").hardwareAddress().toStdString()); - response.set_key(configuration_->getParamFromFile("/etc/hostapd/hostapd.conf","wpa_passphrase").toStdString()); - response.set_security_mode(aasdk::proto::messages::WifiSecurityReponse_SecurityMode_WPA2_PERSONAL); - response.set_access_point_type(aasdk::proto::messages::WifiSecurityReponse_AccessPointType_STATIC); + //response.set_ssid(configuration_->getParamFromFile("/etc/hostapd/hostapd.conf","ssid").toStdString()); + //response.set_bssid(QNetworkInterface::interfaceFromName("wlan0").hardwareAddress().toStdString()); + //response.set_key(configuration_->getParamFromFile("/etc/hostapd/hostapd.conf","wpa_passphrase").toStdString()); + //response.set_security_mode(aap_protobuf::messages::WifiSecurityReponse_SecurityMode_WPA2_PERSONAL); + //response.set_access_point_type(aap_protobuf::messages::WifiSecurityReponse_AccessPointType_STATIC); - sendMessage(response, 3); + //sendMessage(response, 3); } void AndroidBluetoothServer::sendMessage(const google::protobuf::Message& message, uint16_t type) { @@ -170,9 +169,10 @@ namespace f1x { } void AndroidBluetoothServer::handleWifiInfoRequestResponse(QByteArray &buffer, uint16_t length) { - f1x::aasdk::proto::messages::WifiInfoResponse msg; - msg.ParseFromArray(buffer.data() + 4, length); - OPENAUTO_LOG(info) << "WifiInfoResponse: " << msg.DebugString(); + OPENAUTO_LOG(info) << "[AndroidBluetoothServer] WifiInfoRequestResponse"; + //aap_protobuf::messages::WifiInfoResponse msg; + //msg.ParseFromArray(buffer.data() + 4, length); + //OPENAUTO_LOG(info) << "WifiInfoResponse: " << msg.DebugString(); } const ::std::string AndroidBluetoothServer::getIP4_(const QString intf) { From 68759ee2fa9c817f7e12cf0421fc1ab7c8da398a Mon Sep 17 00:00:00 2001 From: Simon Dean Date: Thu, 7 Nov 2024 17:18:43 +0000 Subject: [PATCH 02/14] Add extensive logging --- CMakeLists.txt | 30 +- cmake_modules/Findaap_protobuf.cmake | 55 + cmake_modules/Findaasdk.cmake | 55 + .../autoapp/Projection/InputEvent.hpp | 4 +- .../autoapp/Service/AndroidAutoEntity.hpp | 2 +- .../InputSource/InputSourceService.hpp | 2 +- .../MediaSource/MediaSourceService.hpp | 4 +- .../autoapp/Service/Sensor/SensorService.hpp | 6 +- .../WifiProjection/WifiProjectionService.hpp | 2 +- .../openauto/autoapp/UI/SettingsWindow.hpp | 11 +- src/autoapp/Projection/InputDevice.cpp | 8 +- src/autoapp/Projection/RtAudioOutput.cpp | 36 +- src/autoapp/Service/AndroidAutoEntity.cpp | 580 ++-- .../Service/Bluetooth/BluetoothService.cpp | 43 +- .../GenericNotificationService.cpp | 34 +- .../InputSource/InputSourceService.cpp | 77 +- .../MediaBrowser/MediaBrowserService.cpp | 34 +- .../MediaPlaybackStatusService.cpp | 35 +- .../MediaSink/AudioMediaSinkService.cpp | 69 +- .../Service/MediaSink/SystemAudioService.cpp | 1 - .../MediaSink/TelephonyAudioService.cpp | 1 - .../MediaSink/VideoMediaSinkService.cpp | 107 +- .../Service/MediaSink/VideoService.cpp | 1 - .../MediaSource/MediaSourceService.cpp | 62 +- .../MicrophoneMediaSourceService.cpp | 40 + .../NavigationStatusService.cpp | 34 +- .../PhoneStatus/PhoneStatusService.cpp | 37 +- src/autoapp/Service/Radio/RadioService.cpp | 35 +- src/autoapp/Service/Sensor/SensorService.cpp | 52 +- src/autoapp/Service/ServiceFactory.cpp | 34 +- .../VendorExtensionService.cpp | 31 +- .../WifiProjection/WifiProjectionStatus.cpp | 26 +- src/autoapp/UI/SettingsWindow.cpp | 2845 +++++++++-------- src/autoapp/UI/dialog.cpp | 14 + src/autoapp/UI/dialog.h | 22 + src/autoapp/UI/dialog.ui | 68 + src/autoapp/UI/journey.cpp | 14 + src/autoapp/UI/journey.h | 22 + src/autoapp/UI/journey.ui | 31 + src/autoapp/autoapp.cpp | 3 +- 40 files changed, 2549 insertions(+), 2018 deletions(-) create mode 100644 cmake_modules/Findaap_protobuf.cmake create mode 100644 cmake_modules/Findaasdk.cmake create mode 100644 src/autoapp/Service/MediaSource/MicrophoneMediaSourceService.cpp create mode 100644 src/autoapp/UI/dialog.cpp create mode 100644 src/autoapp/UI/dialog.h create mode 100644 src/autoapp/UI/dialog.ui create mode 100644 src/autoapp/UI/journey.cpp create mode 100644 src/autoapp/UI/journey.h create mode 100644 src/autoapp/UI/journey.ui diff --git a/CMakeLists.txt b/CMakeLists.txt index 4499c9a..79cf6c3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}) diff --git a/cmake_modules/Findaap_protobuf.cmake b/cmake_modules/Findaap_protobuf.cmake new file mode 100644 index 0000000..56a29b1 --- /dev/null +++ b/cmake_modules/Findaap_protobuf.cmake @@ -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) diff --git a/cmake_modules/Findaasdk.cmake b/cmake_modules/Findaasdk.cmake new file mode 100644 index 0000000..3b56595 --- /dev/null +++ b/cmake_modules/Findaasdk.cmake @@ -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) diff --git a/include/f1x/openauto/autoapp/Projection/InputEvent.hpp b/include/f1x/openauto/autoapp/Projection/InputEvent.hpp index 7e4f92a..a5c39d0 100644 --- a/include/f1x/openauto/autoapp/Projection/InputEvent.hpp +++ b/include/f1x/openauto/autoapp/Projection/InputEvent.hpp @@ -19,7 +19,7 @@ #pragma once #include -#include +#include #include 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; diff --git a/include/f1x/openauto/autoapp/Service/AndroidAutoEntity.hpp b/include/f1x/openauto/autoapp/Service/AndroidAutoEntity.hpp index a30381f..19acce9 100644 --- a/include/f1x/openauto/autoapp/Service/AndroidAutoEntity.hpp +++ b/include/f1x/openauto/autoapp/Service/AndroidAutoEntity.hpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/f1x/openauto/autoapp/Service/InputSource/InputSourceService.hpp b/include/f1x/openauto/autoapp/Service/InputSource/InputSourceService.hpp index adc5816..a612c26 100644 --- a/include/f1x/openauto/autoapp/Service/InputSource/InputSourceService.hpp +++ b/include/f1x/openauto/autoapp/Service/InputSource/InputSourceService.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; diff --git a/include/f1x/openauto/autoapp/Service/MediaSource/MediaSourceService.hpp b/include/f1x/openauto/autoapp/Service/MediaSource/MediaSourceService.hpp index 214ecd8..9f2600f 100644 --- a/include/f1x/openauto/autoapp/Service/MediaSource/MediaSourceService.hpp +++ b/include/f1x/openauto/autoapp/Service/MediaSource/MediaSourceService.hpp @@ -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::shared_from_this; void onMediaSourceOpenSuccess(); diff --git a/include/f1x/openauto/autoapp/Service/Sensor/SensorService.hpp b/include/f1x/openauto/autoapp/Service/Sensor/SensorService.hpp index c57c557..de2b10a 100644 --- a/include/f1x/openauto/autoapp/Service/Sensor/SensorService.hpp +++ b/include/f1x/openauto/autoapp/Service/Sensor/SensorService.hpp @@ -19,7 +19,7 @@ #pragma once #include -#include +#include #include #include #include @@ -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 { 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; }; diff --git a/include/f1x/openauto/autoapp/Service/WifiProjection/WifiProjectionService.hpp b/include/f1x/openauto/autoapp/Service/WifiProjection/WifiProjectionService.hpp index f4450ee..242448a 100644 --- a/include/f1x/openauto/autoapp/Service/WifiProjection/WifiProjectionService.hpp +++ b/include/f1x/openauto/autoapp/Service/WifiProjection/WifiProjectionService.hpp @@ -18,7 +18,7 @@ #pragma once -#include +#include #include #include #include diff --git a/include/f1x/openauto/autoapp/UI/SettingsWindow.hpp b/include/f1x/openauto/autoapp/UI/SettingsWindow.hpp index 367dd32..b91be8f 100644 --- a/include/f1x/openauto/autoapp/UI/SettingsWindow.hpp +++ b/include/f1x/openauto/autoapp/UI/SettingsWindow.hpp @@ -18,11 +18,14 @@ #pragma once -#include #include #include #include #include +#ifdef MAC_OS +#else + #include +#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); }; } diff --git a/src/autoapp/Projection/InputDevice.cpp b/src/autoapp/Projection/InputDevice.cpp index 808d3c8..cb39975 100644 --- a/src/autoapp/Projection/InputDevice.cpp +++ b/src/autoapp/Projection/InputDevice.cpp @@ -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; diff --git a/src/autoapp/Projection/RtAudioOutput.cpp b/src/autoapp/Projection/RtAudioOutput.cpp index a59ea4b..aa12a8a 100644 --- a/src/autoapp/Projection/RtAudioOutput.cpp +++ b/src/autoapp/Projection/RtAudioOutput.cpp @@ -33,15 +33,9 @@ RtAudioOutput::RtAudioOutput(uint32_t channelCount, uint32_t sampleSize, uint32_ , sampleSize_(sampleSize) , sampleRate_(sampleRate) { - - std::vector apis; - RtAudio::getCompiledApi(apis); - dac_ = std::find(apis.begin(), apis.end(), RtAudio::LINUX_PULSE) == apis.end() ? std::make_unique() : std::make_unique(RtAudio::LINUX_PULSE); - - // Set the error callback - dac_->setErrorCallback([](RtAudioErrorType type, const std::string& errorText) { - OPENAUTO_LOG(error) << "[RtAudioOutput] " << errorText; - }); + std::vector apis; + RtAudio::getCompiledApi(apis); + dac_ = std::find(apis.begin(), apis.end(), RtAudio::LINUX_PULSE) == apis.end() ? std::make_unique() : std::make_unique(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(this), &streamOptions); dac_->openStream(¶meters, nullptr, RTAUDIO_SINT16, sampleRate_, &bufferFrames, &RtAudioOutput::audioBufferReadHandler, static_cast(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(); } } } diff --git a/src/autoapp/Service/AndroidAutoEntity.cpp b/src/autoapp/Service/AndroidAutoEntity.cpp index 3cea7f4..700813a 100644 --- a/src/autoapp/Service/AndroidAutoEntity.cpp +++ b/src/autoapp/Service/AndroidAutoEntity.cpp @@ -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(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(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::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::high_resolution_clock::now().time_since_epoch()); + request.set_timestamp(timestamp.count()); + controlServiceChannel_->sendPingRequest(request, std::move(promise)); + } + + } + } + } } diff --git a/src/autoapp/Service/Bluetooth/BluetoothService.cpp b/src/autoapp/Service/Bluetooth/BluetoothService.cpp index a9e7704..c4e07ec 100644 --- a/src/autoapp/Service/Bluetooth/BluetoothService.cpp +++ b/src/autoapp/Service/Bluetooth/BluetoothService.cpp @@ -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(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(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(); } - } } } diff --git a/src/autoapp/Service/GenericNotification/GenericNotificationService.cpp b/src/autoapp/Service/GenericNotification/GenericNotificationService.cpp index 2d3116d..ec17cbd 100644 --- a/src/autoapp/Service/GenericNotification/GenericNotificationService.cpp +++ b/src/autoapp/Service/GenericNotification/GenericNotificationService.cpp @@ -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(channel_->getId())); + auto *service = response.add_channels(); + service->set_id(static_cast(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(); } } } diff --git a/src/autoapp/Service/InputSource/InputSourceService.cpp b/src/autoapp/Service/InputSource/InputSourceService.cpp index 54aeb5b..2ca8f64 100644 --- a/src/autoapp/Service/InputSource/InputSourceService.cpp +++ b/src/autoapp/Service/InputSource/InputSourceService.cpp @@ -16,7 +16,7 @@ * along with openauto. If not, see . */ -#include +#include #include #include @@ -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(channel_->getId())); + auto *service = response.add_channels(); + service->set_id(static_cast(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::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::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)); }); } - - - } } } diff --git a/src/autoapp/Service/MediaBrowser/MediaBrowserService.cpp b/src/autoapp/Service/MediaBrowser/MediaBrowserService.cpp index 4d6d9bd..ff7f362 100644 --- a/src/autoapp/Service/MediaBrowser/MediaBrowserService.cpp +++ b/src/autoapp/Service/MediaBrowser/MediaBrowserService.cpp @@ -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(channel_->getId())); + auto *service = response.add_channels(); + service->set_id(static_cast(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(); } } } diff --git a/src/autoapp/Service/MediaPlaybackStatus/MediaPlaybackStatusService.cpp b/src/autoapp/Service/MediaPlaybackStatus/MediaPlaybackStatusService.cpp index 4a2ad10..c736181 100644 --- a/src/autoapp/Service/MediaPlaybackStatus/MediaPlaybackStatusService.cpp +++ b/src/autoapp/Service/MediaPlaybackStatus/MediaPlaybackStatusService.cpp @@ -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(channel_->getId())); + auto *service = response.add_channels(); + service->set_id(static_cast(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(); } } } diff --git a/src/autoapp/Service/MediaSink/AudioMediaSinkService.cpp b/src/autoapp/Service/MediaSink/AudioMediaSinkService.cpp index 802d765..ccc3d09 100644 --- a/src/autoapp/Service/MediaSink/AudioMediaSinkService.cpp +++ b/src/autoapp/Service/MediaSink/AudioMediaSinkService.cpp @@ -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(channel_->getId())); + auto *service = response.add_channels(); + service->set_id(static_cast(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); } diff --git a/src/autoapp/Service/MediaSink/SystemAudioService.cpp b/src/autoapp/Service/MediaSink/SystemAudioService.cpp index 373ae84..4b92cf9 100644 --- a/src/autoapp/Service/MediaSink/SystemAudioService.cpp +++ b/src/autoapp/Service/MediaSink/SystemAudioService.cpp @@ -16,7 +16,6 @@ * along with openauto. If not, see . */ -#include #include #include diff --git a/src/autoapp/Service/MediaSink/TelephonyAudioService.cpp b/src/autoapp/Service/MediaSink/TelephonyAudioService.cpp index 5c7fa2b..91f8c6b 100644 --- a/src/autoapp/Service/MediaSink/TelephonyAudioService.cpp +++ b/src/autoapp/Service/MediaSink/TelephonyAudioService.cpp @@ -16,7 +16,6 @@ * along with openauto. If not, see . */ -#include #include #include diff --git a/src/autoapp/Service/MediaSink/VideoMediaSinkService.cpp b/src/autoapp/Service/MediaSink/VideoMediaSinkService.cpp index f672281..3c985e1 100644 --- a/src/autoapp/Service/MediaSink/VideoMediaSinkService.cpp +++ b/src/autoapp/Service/MediaSink/VideoMediaSinkService.cpp @@ -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(channel_->getId())); + auto *service = response.add_channels(); + service->set_id(static_cast(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)); } } diff --git a/src/autoapp/Service/MediaSink/VideoService.cpp b/src/autoapp/Service/MediaSink/VideoService.cpp index 57917ff..eb8b421 100644 --- a/src/autoapp/Service/MediaSink/VideoService.cpp +++ b/src/autoapp/Service/MediaSink/VideoService.cpp @@ -16,7 +16,6 @@ * along with openauto. If not, see . */ -#include #include #include diff --git a/src/autoapp/Service/MediaSource/MediaSourceService.cpp b/src/autoapp/Service/MediaSource/MediaSourceService.cpp index dd98385..a4f3eab 100644 --- a/src/autoapp/Service/MediaSource/MediaSourceService.cpp +++ b/src/autoapp/Service/MediaSource/MediaSourceService.cpp @@ -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(channel_->getId())); + auto *service = response.add_channels(); + service->set_id(static_cast(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)); diff --git a/src/autoapp/Service/MediaSource/MicrophoneMediaSourceService.cpp b/src/autoapp/Service/MediaSource/MicrophoneMediaSourceService.cpp new file mode 100644 index 0000000..7d14c4a --- /dev/null +++ b/src/autoapp/Service/MediaSource/MicrophoneMediaSourceService.cpp @@ -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 . +*/ + +#include +#include + +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(strand_, + std::move( + messenger)), + std::move(audioOutput)) { + + } + } + } + } + } +} \ No newline at end of file diff --git a/src/autoapp/Service/NavigationStatus/NavigationStatusService.cpp b/src/autoapp/Service/NavigationStatus/NavigationStatusService.cpp index 26ca1e3..3f5dec8 100644 --- a/src/autoapp/Service/NavigationStatus/NavigationStatusService.cpp +++ b/src/autoapp/Service/NavigationStatus/NavigationStatusService.cpp @@ -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(channel_->getId())); + auto *service = response.add_channels(); + service->set_id(static_cast(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(); } } } diff --git a/src/autoapp/Service/PhoneStatus/PhoneStatusService.cpp b/src/autoapp/Service/PhoneStatus/PhoneStatusService.cpp index 79a78a5..7a5510f 100644 --- a/src/autoapp/Service/PhoneStatus/PhoneStatusService.cpp +++ b/src/autoapp/Service/PhoneStatus/PhoneStatusService.cpp @@ -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(channel_->getId())); + auto *service = response.add_channels(); + service->set_id(static_cast(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(); } - - } } } diff --git a/src/autoapp/Service/Radio/RadioService.cpp b/src/autoapp/Service/Radio/RadioService.cpp index d7d520a..cf6c77a 100644 --- a/src/autoapp/Service/Radio/RadioService.cpp +++ b/src/autoapp/Service/Radio/RadioService.cpp @@ -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(channel_->getId())); + auto *service = response.add_channels(); + service->set_id(static_cast(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(); } diff --git a/src/autoapp/Service/Sensor/SensorService.cpp b/src/autoapp/Service/Sensor/SensorService.cpp index 4db4bae..7335931 100644 --- a/src/autoapp/Service/Sensor/SensorService.cpp +++ b/src/autoapp/Service/Sensor/SensorService.cpp @@ -33,7 +33,7 @@ namespace f1x { aasdk::messenger::IMessenger::Pointer messenger) : strand_(ioService), timer_(ioService), - channel_(std::make_shared(strand_, std::move(messenger))) { + channel_(std::make_shared(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(channel_->getId())); + auto *service = response.add_channels(); + service->set_id(static_cast(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(); } } } diff --git a/src/autoapp/Service/ServiceFactory.cpp b/src/autoapp/Service/ServiceFactory.cpp index e2ad415..b7c2b3c 100644 --- a/src/autoapp/Service/ServiceFactory.cpp +++ b/src/autoapp/Service/ServiceFactory.cpp @@ -32,7 +32,7 @@ #include #include -#include +#include #include #include @@ -49,7 +49,6 @@ #include #include - 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(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( configuration_->getBluetoothRemoteAdapterAddress()); break; default: + OPENAUTO_LOG(info) << "[ServiceFactory] Dummy Bluetooth"; bluetoothDevice = std::make_shared(); 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(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(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(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(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(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(ioService_, messenger, std::move(audioInput))); } IService::Pointer ServiceFactory::createSensorService(aasdk::messenger::IMessenger::Pointer messenger) { + OPENAUTO_LOG(info) << "[ServiceFactory] createSensorService()"; return std::make_shared(ioService_, messenger); } IService::Pointer ServiceFactory::createWifiProjectionService(aasdk::messenger::IMessenger::Pointer messenger) { + OPENAUTO_LOG(info) << "[ServiceFactory] createWifiProjectionService()"; return std::make_shared(ioService_, messenger); } diff --git a/src/autoapp/Service/VendorExtension/VendorExtensionService.cpp b/src/autoapp/Service/VendorExtension/VendorExtensionService.cpp index cbbc9c1..27d748a 100644 --- a/src/autoapp/Service/VendorExtension/VendorExtensionService.cpp +++ b/src/autoapp/Service/VendorExtension/VendorExtensionService.cpp @@ -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(channel_->getId())); + auto *service = response.add_channels(); + service->set_id(static_cast(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()); + } } } } diff --git a/src/autoapp/Service/WifiProjection/WifiProjectionStatus.cpp b/src/autoapp/Service/WifiProjection/WifiProjectionStatus.cpp index 58bcfbd..56b91a9 100644 --- a/src/autoapp/Service/WifiProjection/WifiProjectionStatus.cpp +++ b/src/autoapp/Service/WifiProjection/WifiProjectionStatus.cpp @@ -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(channel_->getId())); + auto *service = response.add_channels(); + service->set_id(static_cast(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(); } diff --git a/src/autoapp/UI/SettingsWindow.cpp b/src/autoapp/UI/SettingsWindow.cpp index cceeec6..b1ca528 100644 --- a/src/autoapp/UI/SettingsWindow.cpp +++ b/src/autoapp/UI/SettingsWindow.cpp @@ -18,7 +18,7 @@ #include #include -#include "ui_settingswindow.h" +#include "ui_settingswindow.h" // AutoGenerated at Compile Time #include #include #include @@ -30,1407 +30,1478 @@ #include #include -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace ui -{ - -SettingsWindow::SettingsWindow(configuration::IConfiguration::Pointer configuration, QWidget *parent) - : QWidget(parent) - , ui_(new Ui::SettingsWindow) - , configuration_(std::move(configuration)) -{ - ui_->setupUi(this); - connect(ui_->pushButtonCancel, &QPushButton::clicked, this, &SettingsWindow::close); - connect(ui_->pushButtonSave, &QPushButton::clicked, this, &SettingsWindow::onSave); - connect(ui_->pushButtonUnpair , &QPushButton::clicked, this, &SettingsWindow::unpairAll); - connect(ui_->pushButtonUnpair , &QPushButton::clicked, this, &SettingsWindow::close); - connect(ui_->horizontalSliderScreenDPI, &QSlider::valueChanged, this, &SettingsWindow::onUpdateScreenDPI); - connect(ui_->horizontalSliderAlphaTrans, &QSlider::valueChanged, this, &SettingsWindow::onUpdateAlphaTrans); - connect(ui_->horizontalSliderDay, &QSlider::valueChanged, this, &SettingsWindow::onUpdateBrightnessDay); - connect(ui_->horizontalSliderNight, &QSlider::valueChanged, this, &SettingsWindow::onUpdateBrightnessNight); - connect(ui_->horizontalSliderBrightness1, &QSlider::valueChanged, this, &SettingsWindow::onUpdateBrightness1); - connect(ui_->horizontalSliderBrightness2, &QSlider::valueChanged, this, &SettingsWindow::onUpdateBrightness2); - connect(ui_->horizontalSliderBrightness3, &QSlider::valueChanged, this, &SettingsWindow::onUpdateBrightness3); - connect(ui_->horizontalSliderBrightness4, &QSlider::valueChanged, this, &SettingsWindow::onUpdateBrightness4); - connect(ui_->horizontalSliderBrightness5, &QSlider::valueChanged, this, &SettingsWindow::onUpdateBrightness5); - connect(ui_->horizontalSliderLux1, &QSlider::valueChanged, this, &SettingsWindow::onUpdateLux1); - connect(ui_->horizontalSliderLux2, &QSlider::valueChanged, this, &SettingsWindow::onUpdateLux2); - connect(ui_->horizontalSliderLux3, &QSlider::valueChanged, this, &SettingsWindow::onUpdateLux3); - connect(ui_->horizontalSliderLux4, &QSlider::valueChanged, this, &SettingsWindow::onUpdateLux4); - connect(ui_->horizontalSliderLux5, &QSlider::valueChanged, this, &SettingsWindow::onUpdateLux5); - connect(ui_->radioButtonUseExternalBluetoothAdapter, &QRadioButton::clicked, [&](bool checked) { ui_->lineEditExternalBluetoothAdapterAddress->setEnabled(checked); }); - connect(ui_->radioButtonDisableBluetooth, &QRadioButton::clicked, [&]() { ui_->lineEditExternalBluetoothAdapterAddress->setEnabled(false); }); - connect(ui_->radioButtonUseLocalBluetoothAdapter, &QRadioButton::clicked, [&]() { ui_->lineEditExternalBluetoothAdapterAddress->setEnabled(false); }); - connect(ui_->pushButtonClearSelection, &QPushButton::clicked, std::bind(&SettingsWindow::setButtonCheckBoxes, this, false)); - connect(ui_->pushButtonSelectAll, &QPushButton::clicked, std::bind(&SettingsWindow::setButtonCheckBoxes, this, true)); - connect(ui_->pushButtonResetToDefaults, &QPushButton::clicked, this, &SettingsWindow::onResetToDefaults); - connect(ui_->horizontalSliderSystemVolume, &QSlider::valueChanged, this, &SettingsWindow::onUpdateSystemVolume); - connect(ui_->horizontalSliderSystemCapture, &QSlider::valueChanged, this, &SettingsWindow::onUpdateSystemCapture); - connect(ui_->radioButtonHotspot, &QPushButton::clicked, this, &SettingsWindow::onStartHotspot); - connect(ui_->radioButtonClient, &QPushButton::clicked, this, &SettingsWindow::onStopHotspot); - connect(ui_->pushButtonSetTime, &QPushButton::clicked, this, &SettingsWindow::setTime); - connect(ui_->pushButtonSetTime, &QPushButton::clicked, this, &SettingsWindow::close); - connect(ui_->pushButtonNTP, &QPushButton::clicked, [&]() { system("/usr/local/bin/crankshaft rtc sync &"); }); - connect(ui_->pushButtonNTP, &QPushButton::clicked, this, &SettingsWindow::close); - connect(ui_->pushButtonCheckNow, &QPushButton::clicked, [&]() { system("/usr/local/bin/crankshaft update check &"); }); - connect(ui_->pushButtonDebuglog, &QPushButton::clicked, this, &SettingsWindow::close); - connect(ui_->pushButtonDebuglog, &QPushButton::clicked, [&]() { system("/usr/local/bin/crankshaft debuglog &");}); - connect(ui_->pushButtonNetworkAuto, &QPushButton::clicked, [&]() { system("/usr/local/bin/crankshaft network auto &");}); - connect(ui_->pushButtonNetwork0, &QPushButton::clicked, this, &SettingsWindow::on_pushButtonNetwork0_clicked); - connect(ui_->pushButtonNetwork1, &QPushButton::clicked, this, &SettingsWindow::on_pushButtonNetwork1_clicked); - connect(ui_->pushButtonSambaStart, &QPushButton::clicked, [&]() { system("/usr/local/bin/crankshaft samba start &");}); - connect(ui_->pushButtonSambaStop, &QPushButton::clicked, [&]() { system("/usr/local/bin/crankshaft samba stop &");}); - - // menu - ui_->tab1->show(); - ui_->tab2->hide(); - ui_->tab3->hide(); - ui_->tab4->hide(); - ui_->tab5->hide(); - ui_->tab6->hide(); - ui_->tab7->hide(); - ui_->tab8->hide(); - ui_->tab9->hide(); - - ui_->horizontalGroupBox->hide(); - ui_->labelBluetoothAdapterAddress->hide(); - ui_->lineEditExternalBluetoothAdapterAddress->hide(); - ui_->labelTestInProgress->hide(); - - connect(ui_->pushButtonTab1, &QPushButton::clicked, this, &SettingsWindow::show_tab1); - connect(ui_->pushButtonTab2, &QPushButton::clicked, this, &SettingsWindow::show_tab2); - connect(ui_->pushButtonTab3, &QPushButton::clicked, this, &SettingsWindow::show_tab3); - connect(ui_->pushButtonTab4, &QPushButton::clicked, this, &SettingsWindow::show_tab4); - connect(ui_->pushButtonTab5, &QPushButton::clicked, this, &SettingsWindow::show_tab5); - connect(ui_->pushButtonTab5, &QPushButton::clicked, this, &SettingsWindow::updateNetworkInfo); - connect(ui_->pushButtonTab6, &QPushButton::clicked, this, &SettingsWindow::show_tab6); - connect(ui_->pushButtonTab6, &QPushButton::clicked, this, &SettingsWindow::updateSystemInfo); - connect(ui_->pushButtonTab7, &QPushButton::clicked, this, &SettingsWindow::show_tab7); - connect(ui_->pushButtonTab8, &QPushButton::clicked, this, &SettingsWindow::show_tab8); - connect(ui_->pushButtonTab9, &QPushButton::clicked, this, &SettingsWindow::show_tab9); - - QTime time=QTime::currentTime(); - QString time_text_hour=time.toString("hh"); - QString time_text_minute=time.toString("mm"); - ui_->spinBoxHour->setValue((time_text_hour).toInt()); - ui_->spinBoxMinute->setValue((time_text_minute).toInt()); - ui_->label_modeswitchprogress->setText("Ok"); - ui_->label_notavailable->hide(); - - QString wifi_ssid = configuration_->getCSValue("WIFI_SSID"); - QString wifi2_ssid = configuration_->getCSValue("WIFI2_SSID"); - - ui_->pushButtonNetwork0->setText(wifi_ssid); - ui_->pushButtonNetwork1->setText(wifi2_ssid); - - if (!std::ifstream("/boot/crankshaft/network1.conf")) { - ui_->pushButtonNetwork1->hide(); - ui_->pushButtonNetwork0->show(); - } - if (!std::ifstream("/boot/crankshaft/network0.conf")) { - ui_->pushButtonNetwork1->hide(); - ui_->pushButtonNetwork0->setText(configuration_->getCSValue("WIFI2_SSID")); - } - if (!std::ifstream("/boot/crankshaft/network0.conf") && !std::ifstream("/boot/crankshaft/network1.conf")) { - ui_->pushButtonNetwork0->hide(); - ui_->pushButtonNetwork1->hide(); - ui_->pushButtonNetworkAuto->hide(); - ui_->label_notavailable->show(); - } - - if (std::ifstream("/tmp/hotspot_active")) { - ui_->radioButtonClient->setChecked(0); - ui_->radioButtonHotspot->setChecked(1); - ui_->lineEditWifiSSID->setText(configuration_->getParamFromFile("/etc/hostapd/hostapd.conf","ssid")); - ui_->lineEditPassword->show(); - ui_->label_password->show(); - ui_->lineEditPassword->setText("1234567890"); - ui_->clientNetworkSelect->hide(); - ui_->label_notavailable->show(); - } else { - ui_->radioButtonClient->setChecked(1); - ui_->radioButtonHotspot->setChecked(0); - ui_->lineEditWifiSSID->setText(configuration_->readFileContent("/tmp/wifi_ssid")); - ui_->lineEditPassword->hide(); - ui_->label_password->hide(); - ui_->lineEditPassword->setText(""); - ui_->clientNetworkSelect->hide(); - ui_->label_notavailable->show(); - } - - if (std::ifstream("/tmp/samba_running")) { - ui_->labelSambaStatus->setText("running"); - ui_->pushButtonSambaStart->hide(); - ui_->pushButtonSambaStop->show(); - } else { - ui_->labelSambaStatus->setText("stopped"); - ui_->pushButtonSambaStop->hide(); - ui_->pushButtonSambaStart->show(); - } - - QTimer *refresh=new QTimer(this); - connect(refresh, SIGNAL(timeout()),this,SLOT(updateInfo())); - refresh->start(5000); -} - -SettingsWindow::~SettingsWindow() -{ - delete ui_; -} - -void SettingsWindow::updateInfo() -{ - if (ui_->tab6->isVisible() == true) { - updateSystemInfo(); - } - if (ui_->tab5->isVisible() == true) { - updateNetworkInfo(); - } -} - -void SettingsWindow::onSave() -{ - configuration_->setHandednessOfTrafficType(ui_->radioButtonLeftHandDrive->isChecked() ? configuration::HandednessOfTrafficType::LEFT_HAND_DRIVE : configuration::HandednessOfTrafficType::RIGHT_HAND_DRIVE); - - configuration_->showClock(ui_->checkBoxShowClock->isChecked()); - configuration_->showBigClock(ui_->checkBoxShowBigClock->isChecked()); - configuration_->oldGUI(ui_->checkBoxOldGUI->isChecked()); - configuration_->setAlphaTrans(static_cast(ui_->horizontalSliderAlphaTrans->value())); - configuration_->hideMenuToggle(ui_->checkBoxHideMenuToggle->isChecked()); - configuration_->showLux(ui_->checkBoxShowLux->isChecked()); - configuration_->showCursor(ui_->checkBoxShowCursor->isChecked()); - configuration_->hideBrightnessControl(ui_->checkBoxHideBrightnessControl->isChecked()); - configuration_->showNetworkinfo(ui_->checkBoxNetworkinfo->isChecked()); - configuration_->mp3AutoPlay(ui_->checkBoxAutoPlay->isChecked()); - configuration_->showAutoPlay(ui_->checkBoxShowPlayer->isChecked()); - configuration_->instantPlay(ui_->checkBoxInstantPlay->isChecked()); - configuration_->hideWarning(ui_->checkBoxDontShowAgain->isChecked()); - - configuration_->setVideoFPS(ui_->radioButton30FPS->isChecked() ? aap_protobuf::service::media::shared::message::VideoFrameRateType::_30 : aap_protobuf::service::media::shared::message::VideoFrameRateType::_60); - - if(ui_->radioButton480p->isChecked()) - { - configuration_->setVideoResolution(aap_protobuf::service::media::shared::message::VideoCodecResolutionType_480p); - } - else if(ui_->radioButton720p->isChecked()) - { - configuration_->setVideoResolution(aap_protobuf::service::media::shared::message::VideoCodecResolutionType_720p); - } - else if(ui_->radioButton1080p->isChecked()) - { - configuration_->setVideoResolution(aap_protobuf::service::media::shared::message::VideoCodecResolutionType_1080p); - } - - configuration_->setScreenDPI(static_cast(ui_->horizontalSliderScreenDPI->value())); - configuration_->setOMXLayerIndex(ui_->spinBoxOmxLayerIndex->value()); - - QRect videoMargins(0, 0, ui_->spinBoxVideoMarginWidth->value(), ui_->spinBoxVideoMarginHeight->value()); - configuration_->setVideoMargins(std::move(videoMargins)); - - configuration_->setTouchscreenEnabled(ui_->checkBoxEnableTouchscreen->isChecked()); - this->saveButtonCheckBoxes(); - - configuration_->playerButtonControl(ui_->checkBoxPlayerControl->isChecked()); - - if(ui_->radioButtonDisableBluetooth->isChecked()) - { - configuration_->setBluetoothAdapterType(configuration::BluetoothAdapterType::NONE); - } - else if(ui_->radioButtonUseLocalBluetoothAdapter->isChecked()) - { - configuration_->setBluetoothAdapterType(configuration::BluetoothAdapterType::LOCAL); - } - else if(ui_->radioButtonUseExternalBluetoothAdapter->isChecked()) - { - configuration_->setBluetoothAdapterType(configuration::BluetoothAdapterType::REMOTE); - } - - configuration_->setBluetoothRemoteAdapterAddress(ui_->lineEditExternalBluetoothAdapterAddress->text().toStdString()); - - configuration_->setMusicAudioChannelEnabled(ui_->checkBoxMusicAudioChannel->isChecked()); - configuration_->setSpeechAudioChannelEnabled(ui_->checkBoxSpeechAudioChannel->isChecked()); - configuration_->setAudioOutputBackendType(ui_->radioButtonRtAudio->isChecked() ? configuration::AudioOutputBackendType::RTAUDIO : configuration::AudioOutputBackendType::QT); - - configuration_->save(); - - // generate param string for autoapp_helper - std::string params; - params.append( std::to_string(ui_->horizontalSliderSystemVolume->value()) ); - params.append("#"); - params.append( std::to_string(ui_->horizontalSliderSystemCapture->value()) ); - params.append("#"); - params.append( std::to_string(ui_->spinBoxDisconnect->value()) ); - params.append("#"); - params.append( std::to_string(ui_->spinBoxShutdown->value()) ); - params.append("#"); - params.append( std::to_string(ui_->spinBoxDay->value()) ); - params.append("#"); - params.append( std::to_string(ui_->spinBoxNight->value()) ); - params.append("#"); - if (ui_->checkBoxGPIO->isChecked()) { - params.append("1"); - } else { - params.append("0"); - } - params.append("#"); - params.append( std::string(ui_->comboBoxDevMode->currentText().toStdString()) ); - params.append("#"); - params.append( std::string(ui_->comboBoxInvert->currentText().toStdString()) ); - params.append("#"); - params.append( std::string(ui_->comboBoxX11->currentText().toStdString()) ); - params.append("#"); - params.append( std::string(ui_->comboBoxRearcam->currentText().toStdString()) ); - params.append("#"); - params.append( std::string(ui_->comboBoxAndroid->currentText().toStdString()) ); - params.append("#"); - if (ui_->radioButtonX11->isChecked()) { - params.append("1"); - } else { - params.append("0"); - } - params.append("#"); - if (ui_->radioButtonScreenRotated->isChecked()) { - params.append("1"); - } else { - params.append("0"); - } - params.append("#"); - params.append( std::string("'") + std::string(ui_->comboBoxPulseOutput->currentText().toStdString()) + std::string("'") ); - params.append("#"); - params.append( std::string("'") + std::string(ui_->comboBoxPulseInput->currentText().toStdString()) + std::string("'") ); - params.append("#"); - params.append( std::string(ui_->comboBoxHardwareRTC->currentText().toStdString()) ); - params.append("#"); - params.append( std::string(ui_->comboBoxTZ->currentText().toStdString()) ); - params.append("#"); - params.append( std::string(ui_->comboBoxHardwareDAC->currentText().toStdString()) ); - params.append("#"); - if (ui_->checkBoxDisableShutdown->isChecked()) { - params.append("1"); - } else { - params.append("0"); - } - params.append("#"); - if (ui_->checkBoxDisableScreenOff->isChecked()) { - params.append("1"); - } else { - params.append("0"); - } - params.append("#"); - if (ui_->radioButtonDebugmodeEnabled->isChecked()) { - params.append("1"); - } else { - params.append("0"); - } - params.append("#"); - params.append( std::string(ui_->comboBoxGPIOShutdown->currentText().toStdString()) ); - params.append("#"); - params.append( std::to_string(ui_->spinBoxGPIOShutdownDelay->value()) ); - params.append("#"); - if (ui_->checkBoxHotspot->isChecked()) { - params.append("1"); - } else { - params.append("0"); - } - params.append("#"); - params.append( std::string(ui_->comboBoxCam->currentText().toStdString()) ); - params.append("#"); - if (ui_->checkBoxBluetoothAutoPair->isChecked()) { - params.append("1"); - } else { - params.append("0"); - } - params.append("#"); - params.append( std::string(ui_->comboBoxBluetooth->currentText().toStdString()) ); - params.append("#"); - if (ui_->checkBoxHardwareSave->isChecked()) { - params.append("1"); - } else { - params.append("0"); - } - params.append("#"); - params.append( std::string(ui_->comboBoxUSBCam->currentText().toStdString()) ); - params.append("#"); - params.append( std::string(ui_->comboBoxLS->currentText().split(" ")[0].toStdString()) ); - params.append("#"); - params.append( std::string(ui_->comboBoxDayNight->currentText().toStdString()) ); - params.append("#"); - params.append( std::to_string(ui_->horizontalSliderDay->value()) ); - params.append("#"); - params.append( std::to_string(ui_->horizontalSliderNight->value()) ); - params.append("#"); - params.append( std::to_string(ui_->horizontalSliderLux1->value()) ); - params.append("#"); - params.append( std::to_string(ui_->horizontalSliderBrightness1->value()) ); - params.append("#"); - params.append( std::to_string(ui_->horizontalSliderLux2->value()) ); - params.append("#"); - params.append( std::to_string(ui_->horizontalSliderBrightness2->value()) ); - params.append("#"); - params.append( std::to_string(ui_->horizontalSliderLux3->value()) ); - params.append("#"); - params.append( std::to_string(ui_->horizontalSliderBrightness3->value()) ); - params.append("#"); - params.append( std::to_string(ui_->horizontalSliderLux4->value()) ); - params.append("#"); - params.append( std::to_string(ui_->horizontalSliderBrightness4->value()) ); - params.append("#"); - params.append( std::to_string(ui_->horizontalSliderLux5->value()) ); - params.append("#"); - params.append( std::to_string(ui_->horizontalSliderBrightness5->value()) ); - params.append("#"); - params.append( std::string(ui_->comboBoxCheckInterval->currentText().toStdString()) ); - params.append("#"); - params.append( std::string(ui_->comboBoxNightmodeStep->currentText().toStdString()) ); - params.append("#"); - if (ui_->checkBoxDisableDayNightRTC->isChecked()) { - params.append("0"); - } else { - params.append("1"); - } - params.append("#"); - if(ui_->radioButtonAnimatedCSNG->isChecked()) - { - params.append("0"); - } - else if(ui_->radioButtonCSNG->isChecked()) - { - params.append("1"); - } - else if(ui_->radioButtonCustom->isChecked()) - { - params.append("2"); - } - params.append("#"); - params.append( std::string(ui_->comboBoxCountryCode->currentText().split("|")[0].replace(" ","").toStdString()) ); - params.append("#"); - if (ui_->checkBoxBlankOnly ->isChecked()) { - params.append("1"); - } else { - params.append("0"); - } - params.append("#"); - if (ui_->checkBoxFlipX ->isChecked()) { - params.append("1"); - } else { - params.append("0"); - } - params.append("#"); - if (ui_->checkBoxFlipY ->isChecked()) { - params.append("1"); - } else { - params.append("0"); - } - params.append("#"); - params.append( std::string(ui_->comboBoxRotation->currentText().toStdString()) ); - params.append("#"); - params.append( std::string(ui_->comboBoxResolution->currentText().toStdString()) ); - params.append("#"); - params.append( std::string((ui_->comboBoxFPS->currentText()).replace(" (not @1080)","").toStdString()) ); - params.append("#"); - params.append( std::string(ui_->comboBoxAWB->currentText().toStdString()) ); - params.append("#"); - params.append( std::string(ui_->comboBoxEXP->currentText().toStdString()) ); - params.append("#"); - params.append( std::string(ui_->comboBoxLoopTime->currentText().toStdString()) ); - params.append("#"); - params.append( std::string(ui_->comboBoxLoopCount->currentText().toStdString()) ); - params.append("#"); - if (ui_->checkBoxAutoRecording ->isChecked()) { - params.append("1"); - } else { - params.append("0"); - } - params.append("#"); - if (ui_->checkBoxFlipXUSB ->isChecked()) { - params.append("1"); - } else { - params.append("0"); - } - params.append("#"); - if (ui_->checkBoxFlipYUSB ->isChecked()) { - params.append("1"); - } else { - params.append("0"); - } - params.append("#"); - params.append( std::string(ui_->comboBoxUSBRotation->currentText().replace("180","1").toStdString()) ); - params.append("#"); - system((std::string("/usr/local/bin/autoapp_helper setparams#") + std::string(params) + std::string(" &") ).c_str()); - - this->close(); -} - -void SettingsWindow::onResetToDefaults() -{ - QMessageBox confirmationMessage(QMessageBox::Question, "Confirmation", "Are you sure you want to reset settings?", QMessageBox::Yes | QMessageBox::Cancel); - //confirmationMessage.setWindowFlags(Qt::WindowStaysOnTopHint); - if(confirmationMessage.exec() == QMessageBox::Yes) - { - configuration_->reset(); - this->load(); - } -} - -void SettingsWindow::showEvent(QShowEvent* event) -{ - QWidget::showEvent(event); - this->load(); -} - -void SettingsWindow::load() -{ - ui_->radioButtonLeftHandDrive->setChecked(configuration_->getHandednessOfTrafficType() == configuration::HandednessOfTrafficType::LEFT_HAND_DRIVE); - ui_->radioButtonRightHandDrive->setChecked(configuration_->getHandednessOfTrafficType() == configuration::HandednessOfTrafficType::RIGHT_HAND_DRIVE); - ui_->checkBoxShowClock->setChecked(configuration_->showClock()); - ui_->horizontalSliderAlphaTrans->setValue(static_cast(configuration_->getAlphaTrans())); - - ui_->checkBoxShowBigClock->setChecked(configuration_->showBigClock()); - ui_->checkBoxOldGUI->setChecked(configuration_->oldGUI()); - ui_->checkBoxHideMenuToggle->setChecked(configuration_->hideMenuToggle()); - ui_->checkBoxShowLux->setChecked(configuration_->showLux()); - ui_->checkBoxShowCursor->setChecked(configuration_->showCursor()); - ui_->checkBoxHideBrightnessControl->setChecked(configuration_->hideBrightnessControl()); - ui_->checkBoxNetworkinfo->setChecked(configuration_->showNetworkinfo()); - ui_->checkBoxAutoPlay->setChecked(configuration_->mp3AutoPlay()); - ui_->checkBoxShowPlayer->setChecked(configuration_->showAutoPlay()); - ui_->checkBoxInstantPlay->setChecked(configuration_->instantPlay()); - ui_->checkBoxDontShowAgain->setChecked(configuration_->hideWarning()); - - ui_->radioButton30FPS->setChecked(configuration_->getVideoFPS() == aap_protobuf::service::media::shared::message::VideoFrameRateType::_30); - ui_->radioButton60FPS->setChecked(configuration_->getVideoFPS() == aap_protobuf::service::media::shared::message::VideoFrameRateType::_60); - - ui_->radioButton480p->setChecked(configuration_->getVideoResolution() == aap_protobuf::service::media::shared::message::VideoCodecResolutionType_480p); - ui_->radioButton720p->setChecked(configuration_->getVideoResolution() == aap_protobuf::service::media::shared::message::VideoCodecResolutionType_720p); - ui_->radioButton1080p->setChecked(configuration_->getVideoResolution() == aap_protobuf::service::media::shared::message::VideoCodecResolutionType_1080p); - ui_->horizontalSliderScreenDPI->setValue(static_cast(configuration_->getScreenDPI())); - ui_->spinBoxOmxLayerIndex->setValue(configuration_->getOMXLayerIndex()); - - const auto& videoMargins = configuration_->getVideoMargins(); - ui_->spinBoxVideoMarginWidth->setValue(videoMargins.width()); - ui_->spinBoxVideoMarginHeight->setValue(videoMargins.height()); - - ui_->checkBoxEnableTouchscreen->setChecked(configuration_->getTouchscreenEnabled()); - this->loadButtonCheckBoxes(); - ui_->checkBoxPlayerControl->setChecked(configuration_->playerButtonControl()); - - ui_->radioButtonDisableBluetooth->setChecked(configuration_->getBluetoothAdapterType() == configuration::BluetoothAdapterType::NONE); - ui_->radioButtonUseLocalBluetoothAdapter->setChecked(configuration_->getBluetoothAdapterType() == configuration::BluetoothAdapterType::LOCAL); - ui_->radioButtonUseExternalBluetoothAdapter->setChecked(configuration_->getBluetoothAdapterType() == configuration::BluetoothAdapterType::REMOTE); - ui_->lineEditExternalBluetoothAdapterAddress->setEnabled(configuration_->getBluetoothAdapterType() == configuration::BluetoothAdapterType::REMOTE); - ui_->lineEditExternalBluetoothAdapterAddress->setText(QString::fromStdString(configuration_->getBluetoothRemoteAdapterAddress())); - - ui_->checkBoxMusicAudioChannel->setChecked(configuration_->musicAudioChannelEnabled()); - ui_->checkBoxSpeechAudioChannel->setChecked(configuration_->speechAudioChannelEnabled()); - - const auto& audioOutputBackendType = configuration_->getAudioOutputBackendType(); - ui_->radioButtonRtAudio->setChecked(audioOutputBackendType == configuration::AudioOutputBackendType::RTAUDIO); - ui_->radioButtonQtAudio->setChecked(audioOutputBackendType == configuration::AudioOutputBackendType::QT); - - ui_->checkBoxHardwareSave->setChecked(false); - QStorageInfo storage("/media/USBDRIVES/CSSTORAGE"); - storage.refresh(); - if (storage.isValid() && storage.isReady()) { - if (storage.isReadOnly()) { - ui_->labelStorage->setText("Storage is read only! (" + storage.device() + ") - This can be caused by demaged filesystem on CSSTORAGE. Try a reboot."); - } else { - ui_->labelStorage->setText("Device: " + storage.device() + " Label: " + storage.displayName() + " Total: " + QString::number(storage.bytesTotal()/1024/1024/1024) + "GB Free: " + QString::number(storage.bytesFree()/1024/1024/1024) + "GB (" + storage.fileSystemType() + ")"); - } - } else { - ui_->labelStorage->setText("Storage is not ready or missing!"); - } -} - -void SettingsWindow::loadButtonCheckBoxes() -{ - const auto& buttonCodes = configuration_->getButtonCodes(); - ui_->checkBoxPlayButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PLAY) != buttonCodes.end()); - ui_->checkBoxPauseButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PAUSE) != buttonCodes.end()); - ui_->checkBoxTogglePlayButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PLAY_PAUSE) != buttonCodes.end()); - ui_->checkBoxNextTrackButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_NEXT) != buttonCodes.end()); - ui_->checkBoxPreviousTrackButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PREVIOUS) != buttonCodes.end()); - ui_->checkBoxHomeButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_HOME) != buttonCodes.end()); - ui_->checkBoxPhoneButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_CALL) != buttonCodes.end()); - ui_->checkBoxCallEndButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_ENDCALL) != buttonCodes.end()); - ui_->checkBoxVoiceCommandButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_SEARCH) != buttonCodes.end()); - ui_->checkBoxLeftButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_LEFT) != buttonCodes.end()); - ui_->checkBoxRightButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_RIGHT) != buttonCodes.end()); - ui_->checkBoxUpButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_UP) != buttonCodes.end()); - ui_->checkBoxDownButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_DOWN) != buttonCodes.end()); - ui_->checkBoxScrollWheelButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_ROTARY_CONTROLLER) != buttonCodes.end()); - ui_->checkBoxBackButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_BACK) != buttonCodes.end()); - ui_->checkBoxEnterButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_CENTER) != buttonCodes.end()); - ui_->checkBoxNavButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_NAVIGATION) != buttonCodes.end()); -} - -void SettingsWindow::setButtonCheckBoxes(bool value) -{ - ui_->checkBoxPlayButton->setChecked(value); - ui_->checkBoxPauseButton->setChecked(value); - ui_->checkBoxTogglePlayButton->setChecked(value); - ui_->checkBoxNextTrackButton->setChecked(value); - ui_->checkBoxPreviousTrackButton->setChecked(value); - ui_->checkBoxHomeButton->setChecked(value); - ui_->checkBoxPhoneButton->setChecked(value); - ui_->checkBoxCallEndButton->setChecked(value); - ui_->checkBoxVoiceCommandButton->setChecked(value); - ui_->checkBoxLeftButton->setChecked(value); - ui_->checkBoxRightButton->setChecked(value); - ui_->checkBoxUpButton->setChecked(value); - ui_->checkBoxDownButton->setChecked(value); - ui_->checkBoxScrollWheelButton->setChecked(value); - ui_->checkBoxBackButton->setChecked(value); - ui_->checkBoxEnterButton->setChecked(value); - ui_->checkBoxNavButton->setChecked(value); -} - -void SettingsWindow::saveButtonCheckBoxes() -{ - configuration::IConfiguration::ButtonCodes buttonCodes; - this->saveButtonCheckBox(ui_->checkBoxPlayButton, buttonCodes, aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PLAY); - this->saveButtonCheckBox(ui_->checkBoxPauseButton, buttonCodes, aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PAUSE); - this->saveButtonCheckBox(ui_->checkBoxTogglePlayButton, buttonCodes, aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PLAY_PAUSE); - this->saveButtonCheckBox(ui_->checkBoxNextTrackButton, buttonCodes, aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_NEXT); - this->saveButtonCheckBox(ui_->checkBoxPreviousTrackButton, buttonCodes, aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PREVIOUS); - this->saveButtonCheckBox(ui_->checkBoxHomeButton, buttonCodes, aap_protobuf::service::media::sink::KeyCode::KEYCODE_HOME); - this->saveButtonCheckBox(ui_->checkBoxPhoneButton, buttonCodes, aap_protobuf::service::media::sink::KeyCode::KEYCODE_CALL); - this->saveButtonCheckBox(ui_->checkBoxCallEndButton, buttonCodes, aap_protobuf::service::media::sink::KeyCode::KEYCODE_ENDCALL); - this->saveButtonCheckBox(ui_->checkBoxVoiceCommandButton, buttonCodes, aap_protobuf::service::media::sink::KeyCode::KEYCODE_SEARCH); - this->saveButtonCheckBox(ui_->checkBoxLeftButton, buttonCodes, aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_LEFT); - this->saveButtonCheckBox(ui_->checkBoxRightButton, buttonCodes, aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_RIGHT); - this->saveButtonCheckBox(ui_->checkBoxUpButton, buttonCodes, aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_UP); - this->saveButtonCheckBox(ui_->checkBoxDownButton, buttonCodes, aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_DOWN); - this->saveButtonCheckBox(ui_->checkBoxScrollWheelButton, buttonCodes, aap_protobuf::service::media::sink::KeyCode::KEYCODE_ROTARY_CONTROLLER); - this->saveButtonCheckBox(ui_->checkBoxBackButton, buttonCodes, aap_protobuf::service::media::sink::KeyCode::KEYCODE_BACK); - this->saveButtonCheckBox(ui_->checkBoxEnterButton, buttonCodes, aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_CENTER); - this->saveButtonCheckBox(ui_->checkBoxNavButton, buttonCodes, aap_protobuf::service::media::sink::KeyCode::KEYCODE_NAVIGATION); - configuration_->setButtonCodes(buttonCodes); -} - -void SettingsWindow::saveButtonCheckBox(const QCheckBox* checkBox, configuration::IConfiguration::ButtonCodes& buttonCodes, aap_protobuf::service::media::sink::KeyCode buttonCode) -{ - if(checkBox->isChecked()) - { - buttonCodes.push_back(buttonCode); - } -} - -void SettingsWindow::onUpdateScreenDPI(int value) -{ - ui_->labelScreenDPIValue->setText(QString::number(value)); -} - -void SettingsWindow::onUpdateAlphaTrans(int value) -{ - double alpha = value/100.0; - ui_->labelAlphaTransValue->setText(QString::number(alpha)); -} - -void SettingsWindow::onUpdateBrightnessDay(int value) -{ - ui_->labelBrightnessDay->setText(QString::number(value)); -} - -void SettingsWindow::onUpdateBrightnessNight(int value) -{ - ui_->labelBrightnessNight->setText(QString::number(value)); -} - -void SettingsWindow::onUpdateSystemVolume(int value) -{ - ui_->labelSystemVolumeValue->setText(QString::number(value)); -} - -void SettingsWindow::onUpdateSystemCapture(int value) -{ - ui_->labelSystemCaptureValue->setText(QString::number(value)); -} - -void SettingsWindow::onUpdateLux1(int value) -{ - ui_->valueLux1->setText(QString::number(value)); -} - -void SettingsWindow::onUpdateLux2(int value) -{ - ui_->valueLux2->setText(QString::number(value)); -} - -void SettingsWindow::onUpdateLux3(int value) -{ - ui_->valueLux3->setText(QString::number(value)); -} - -void SettingsWindow::onUpdateLux4(int value) -{ - ui_->valueLux4->setText(QString::number(value)); -} - -void SettingsWindow::onUpdateLux5(int value) -{ - ui_->valueLux5->setText(QString::number(value)); -} - -void SettingsWindow::onUpdateBrightness1(int value) -{ - ui_->valueBrightness1->setText(QString::number(value)); -} - -void SettingsWindow::onUpdateBrightness2(int value) -{ - ui_->valueBrightness2->setText(QString::number(value)); -} - -void SettingsWindow::onUpdateBrightness3(int value) -{ - ui_->valueBrightness3->setText(QString::number(value)); -} - -void SettingsWindow::onUpdateBrightness4(int value) -{ - ui_->valueBrightness4->setText(QString::number(value)); -} - -void SettingsWindow::onUpdateBrightness5(int value) -{ - ui_->valueBrightness5->setText(QString::number(value)); -} - -void SettingsWindow::unpairAll() -{ - system("/usr/local/bin/crankshaft bluetooth unpair &"); -} - -void SettingsWindow::setTime() -{ - // generate param string for autoapp_helper - std::string params; - params.append( std::to_string(ui_->spinBoxHour->value()) ); - params.append("#"); - params.append( std::to_string(ui_->spinBoxMinute->value()) ); - params.append("#"); - system((std::string("/usr/local/bin/autoapp_helper settime#") + std::string(params) + std::string(" &") ).c_str()); -} - -void SettingsWindow::syncNTPTime() -{ - system("/usr/local/bin/crankshaft rtc sync &"); -} - -void SettingsWindow::loadSystemValues() -{ - // set brightness slider attribs - ui_->horizontalSliderDay->setMinimum(configuration_->getCSValue("BR_MIN").toInt()); - ui_->horizontalSliderDay->setMaximum(configuration_->getCSValue("BR_MAX").toInt()); - ui_->horizontalSliderDay->setSingleStep(configuration_->getCSValue("BR_STEP").toInt()); - ui_->horizontalSliderDay->setTickInterval(configuration_->getCSValue("BR_STEP").toInt()); - ui_->horizontalSliderDay->setValue(configuration_->getCSValue("BR_DAY").toInt()); - - ui_->horizontalSliderNight->setMinimum(configuration_->getCSValue("BR_MIN").toInt()); - ui_->horizontalSliderNight->setMaximum(configuration_->getCSValue("BR_MAX").toInt()); - ui_->horizontalSliderNight->setSingleStep(configuration_->getCSValue("BR_STEP").toInt()); - ui_->horizontalSliderNight->setTickInterval(configuration_->getCSValue("BR_STEP").toInt()); - ui_->horizontalSliderNight->setValue(configuration_->getCSValue("BR_NIGHT").toInt()); - - ui_->horizontalSliderBrightness1->setMinimum(configuration_->getCSValue("BR_MIN").toInt()); - ui_->horizontalSliderBrightness1->setMaximum(configuration_->getCSValue("BR_MAX").toInt()); - ui_->horizontalSliderBrightness1->setSingleStep(configuration_->getCSValue("BR_STEP").toInt()); - ui_->horizontalSliderBrightness1->setTickInterval(configuration_->getCSValue("BR_STEP").toInt()); - - ui_->horizontalSliderBrightness2->setMinimum(configuration_->getCSValue("BR_MIN").toInt()); - ui_->horizontalSliderBrightness2->setMaximum(configuration_->getCSValue("BR_MAX").toInt()); - ui_->horizontalSliderBrightness2->setSingleStep(configuration_->getCSValue("BR_STEP").toInt()); - ui_->horizontalSliderBrightness2->setTickInterval(configuration_->getCSValue("BR_STEP").toInt()); - - ui_->horizontalSliderBrightness3->setMinimum(configuration_->getCSValue("BR_MIN").toInt()); - ui_->horizontalSliderBrightness3->setMaximum(configuration_->getCSValue("BR_MAX").toInt()); - ui_->horizontalSliderBrightness3->setSingleStep(configuration_->getCSValue("BR_STEP").toInt()); - ui_->horizontalSliderBrightness3->setTickInterval(configuration_->getCSValue("BR_STEP").toInt()); - - ui_->horizontalSliderBrightness4->setMinimum(configuration_->getCSValue("BR_MIN").toInt()); - ui_->horizontalSliderBrightness4->setMaximum(configuration_->getCSValue("BR_MAX").toInt()); - ui_->horizontalSliderBrightness4->setSingleStep(configuration_->getCSValue("BR_STEP").toInt()); - ui_->horizontalSliderBrightness4->setTickInterval(configuration_->getCSValue("BR_STEP").toInt()); - - ui_->horizontalSliderBrightness5->setMinimum(configuration_->getCSValue("BR_MIN").toInt()); - ui_->horizontalSliderBrightness5->setMaximum(configuration_->getCSValue("BR_MAX").toInt()); - ui_->horizontalSliderBrightness5->setSingleStep(configuration_->getCSValue("BR_STEP").toInt()); - ui_->horizontalSliderBrightness5->setTickInterval(configuration_->getCSValue("BR_STEP").toInt()); - - // set tsl2561 slider attribs - ui_->horizontalSliderLux1->setValue(configuration_->getCSValue("LUX_LEVEL_1").toInt()); - ui_->horizontalSliderBrightness1->setValue(configuration_->getCSValue("DISP_BRIGHTNESS_1").toInt()); - ui_->horizontalSliderLux2->setValue(configuration_->getCSValue("LUX_LEVEL_2").toInt()); - ui_->horizontalSliderBrightness2->setValue(configuration_->getCSValue("DISP_BRIGHTNESS_2").toInt()); - ui_->horizontalSliderLux3->setValue(configuration_->getCSValue("LUX_LEVEL_3").toInt()); - ui_->horizontalSliderBrightness3->setValue(configuration_->getCSValue("DISP_BRIGHTNESS_3").toInt()); - ui_->horizontalSliderLux4->setValue(configuration_->getCSValue("LUX_LEVEL_4").toInt()); - ui_->horizontalSliderBrightness4->setValue(configuration_->getCSValue("DISP_BRIGHTNESS_4").toInt()); - ui_->horizontalSliderLux5->setValue(configuration_->getCSValue("LUX_LEVEL_5").toInt()); - ui_->horizontalSliderBrightness5->setValue(configuration_->getCSValue("DISP_BRIGHTNESS_5").toInt()); - ui_->comboBoxCheckInterval->setCurrentText(configuration_->getCSValue("TSL2561_CHECK_INTERVAL")); - ui_->comboBoxNightmodeStep->setCurrentText(configuration_->getCSValue("TSL2561_DAYNIGHT_ON_STEP")); - - if (std::ifstream("/tmp/return_value")) { - QString return_values = configuration_->readFileContent("/tmp/return_value"); - QStringList getparams = return_values.split("#"); - - // version string - ui_->valueSystemVersion->setText(configuration_->readFileContent("/etc/crankshaft.build")); - // date string - ui_->valueSystemBuildDate->setText(configuration_->readFileContent("/etc/crankshaft.date")); - // set volume - ui_->labelSystemVolumeValue->setText(configuration_->readFileContent("/boot/crankshaft/volume")); - ui_->horizontalSliderSystemVolume->setValue(configuration_->readFileContent("/boot/crankshaft/volume").toInt()); - // set cap volume - ui_->labelSystemCaptureValue->setText(configuration_->readFileContent("/boot/crankshaft/capvolume")); - ui_->horizontalSliderSystemCapture->setValue(configuration_->readFileContent("/boot/crankshaft/capvolume").toInt()); - // set shutdown - ui_->valueShutdownTimer->setText("- - -"); - ui_->spinBoxShutdown->setValue(configuration_->getCSValue("DISCONNECTION_POWEROFF_MINS").toInt()); - // set disconnect - ui_->valueDisconnectTimer->setText("- - -"); - ui_->spinBoxDisconnect->setValue(configuration_->getCSValue("DISCONNECTION_SCREEN_POWEROFF_SECS").toInt()); - // set day/night - ui_->spinBoxDay->setValue(configuration_->getCSValue("RTC_DAY_START").toInt()); - ui_->spinBoxNight->setValue(configuration_->getCSValue("RTC_NIGHT_START").toInt()); - // set gpios - if (configuration_->getCSValue("ENABLE_GPIO") == "1") { - ui_->checkBoxGPIO->setChecked(true); - } else { - ui_->checkBoxGPIO->setChecked(false); - } - ui_->comboBoxDevMode->setCurrentText(configuration_->getCSValue("DEV_PIN")); - ui_->comboBoxInvert->setCurrentText(configuration_->getCSValue("INVERT_PIN")); - ui_->comboBoxX11->setCurrentText(configuration_->getCSValue("X11_PIN")); - ui_->comboBoxRearcam->setCurrentText(configuration_->getCSValue("REARCAM_PIN")); - ui_->comboBoxAndroid->setCurrentText(configuration_->getCSValue("ANDROID_PIN")); - // set mode - if (configuration_->getCSValue("START_X11") == "0") { - ui_->radioButtonEGL->setChecked(true); - } else { - ui_->radioButtonX11->setChecked(true); - } - // set rotation - if (configuration_->getCSValue("FLIP_SCREEN") == "0") { - ui_->radioButtonScreenNormal->setChecked(true); - } else { - ui_->radioButtonScreenRotated->setChecked(true); - } - - if (std::ifstream("/tmp/get_inputs")) { - QFile inputsFile(QString("/tmp/get_inputs")); - inputsFile.open(QIODevice::ReadOnly); - QTextStream data_return(&inputsFile); - QStringList inputs = data_return.readAll().split("\n"); - inputsFile.close(); - int cleaner = ui_->comboBoxPulseInput->count(); - while (cleaner > -1) { - ui_->comboBoxPulseInput->removeItem(cleaner); - cleaner--; - } - int indexin = inputs.count(); - int countin = 0; - while (countin < indexin-1) { - ui_->comboBoxPulseInput->addItem(inputs[countin]); - countin++; - } - } - - if (std::ifstream("/tmp/get_outputs")) { - QFile outputsFile(QString("/tmp/get_outputs")); - outputsFile.open(QIODevice::ReadOnly); - QTextStream data_return(&outputsFile); - QStringList outputs = data_return.readAll().split("\n"); - outputsFile.close(); - int cleaner = ui_->comboBoxPulseOutput->count(); - while (cleaner > -1) { - ui_->comboBoxPulseOutput->removeItem(cleaner); - cleaner--; - } - int indexout = outputs.count(); - int countout = 0; - while (countout < indexout-1) { - ui_->comboBoxPulseOutput->addItem(outputs[countout]); - countout++; - } - } - - ui_->comboBoxPulseOutput->setCurrentText(configuration_->readFileContent("/tmp/get_default_output")); - ui_->comboBoxPulseInput->setCurrentText(configuration_->readFileContent("/tmp/get_default_input")); - - if (std::ifstream("/tmp/timezone_listing")) { - QFile zoneFile(QString("/tmp/timezone_listing")); - zoneFile.open(QIODevice::ReadOnly); - QTextStream data_return(&zoneFile); - QStringList zones = data_return.readAll().split("\n"); - zoneFile.close(); - int cleaner = ui_->comboBoxTZ->count(); - while (cleaner > 0) { - ui_->comboBoxTZ->removeItem(cleaner); - cleaner--; - } - int indexout = zones.count(); - int countzone = 0; - while (countzone < indexout-1) { - ui_->comboBoxTZ->addItem(zones[countzone]); - countzone++; - } - } - - // set rtc - QString rtcstring = configuration_->getParamFromFile("/boot/config.txt","dtoverlay=i2c-rtc"); - if (rtcstring != "") { - QStringList rtc = rtcstring.split(","); - ui_->comboBoxHardwareRTC->setCurrentText(rtc[1].trimmed()); - // set timezone - ui_->comboBoxTZ->setCurrentText(configuration_->readFileContent("/etc/timezone")); - } else { - ui_->comboBoxHardwareRTC->setCurrentText("none"); - ui_->comboBoxTZ->setCurrentText(configuration_->readFileContent("/etc/timezone")); - } - - // set dac - QString dac = "Custom"; - if (getparams[4] == "allo-boss-dac-pcm512x-audio") { - dac = "Allo - Boss"; - } - if (getparams[4] == "allo-piano-dac-pcm512x-audio") { - dac = "Allo - Piano"; - } - if (getparams[4] == "iqaudio-dacplus") { - dac = "IQaudIO - Pi-DAC Plus/Pro/Zero"; - } - if (getparams[4] == "iqaudio-dacplus,unmute_amp") { - dac = "IQaudIO - Pi-Digi Amp Plus"; - } - if (getparams[4] == "iqaudio-dacplus,auto_mute_amp") { - dac = "IQaudIO - Pi-Digi Amp Plus - Automute"; - } - if (getparams[4] == "iqaudio-digi-wm8804-audio") { - dac = "IQaudIO - Pi-Digi Plus"; - } - if (getparams[4] == "audioinjector-wm8731-audio") { - dac = "Audioinjector - Zero/Stereo"; - } - if (getparams[4] == "hifiberry-dac") { - dac = "Hifiberry - DAC"; - } - if (getparams[4] == "hifiberry-dacplus") { - dac = "Hifiberry - DAC Plus"; - } - if (getparams[4] == "hifiberry-digi") { - dac = "Hifiberry - Digi"; - } - if (getparams[4] == "hifiberry-digi-pro") { - dac = "Hifiberry - Digi Pro"; - } - if (getparams[4] == "hifiberry-amp") { - dac = "Hifiberry - DAC Amp"; - } - if (getparams[4] == "audio") { - dac = "Raspberry Pi - Onboard"; - } - ui_->comboBoxHardwareDAC->setCurrentText(dac); - - // set shutdown disable - if (configuration_->getCSValue("DISCONNECTION_POWEROFF_DISABLE") == "1") { - ui_->checkBoxDisableShutdown->setChecked(true); - } else { - ui_->checkBoxDisableShutdown->setChecked(false); - } - - // set screen off disable - if (configuration_->getCSValue("DISCONNECTION_SCREEN_POWEROFF_DISABLE") == "1") { - ui_->checkBoxDisableScreenOff->setChecked(true); - } else { - ui_->checkBoxDisableScreenOff->setChecked(false); - } - - // set custom brightness command - if (configuration_->getCSValue("CUSTOM_BRIGHTNESS_COMMAND") != "") { - ui_->labelCustomBrightnessCommand->setText(configuration_->getCSValue("CUSTOM_BRIGHTNESS_COMMAND") + " brvalue"); - } else { - ui_->labelCustomBrightnessCommand->setText("Disabled"); - } - - // set debug mode - if (configuration_->getCSValue("DEBUG_MODE") == "1") { - ui_->radioButtonDebugmodeEnabled->setChecked(true); - } else { - ui_->radioButtonDebugmodeDisabled->setChecked(true); - } - - // GPIO based shutdown - ui_->comboBoxGPIOShutdown->setCurrentText(configuration_->getCSValue("IGNITION_PIN")); - ui_->spinBoxGPIOShutdownDelay->setValue(configuration_->getCSValue("IGNITION_DELAY").toInt()); - - // Wifi Hotspot - if (configuration_->getCSValue("ENABLE_HOTSPOT") == "1") { - ui_->checkBoxHotspot->setChecked(true); - } else { - ui_->checkBoxHotspot->setChecked(false); - } - - // set cam - if (configuration_->getParamFromFile("/boot/config.txt","start_x") == "1") { - ui_->comboBoxCam->setCurrentText("enabled"); - } else { - ui_->comboBoxCam->setCurrentText("disabled"); - } - if (configuration_->getCSValue("RPICAM_HFLIP") == "1") { - ui_->checkBoxFlipX->setChecked(true); - } else { - ui_->checkBoxFlipX->setChecked(false); - } - if (configuration_->getCSValue("RPICAM_VFLIP") == "1") { - ui_->checkBoxFlipY->setChecked(true); - } else { - ui_->checkBoxFlipY->setChecked(false); - } - ui_->comboBoxRotation->setCurrentText(configuration_->getCSValue("RPICAM_ROTATION")); - ui_->comboBoxResolution->setCurrentText(configuration_->getCSValue("RPICAM_RESOLUTION")); - ui_->comboBoxFPS->setCurrentText(configuration_->getCSValue("RPICAM_FPS")); - ui_->comboBoxAWB->setCurrentText(configuration_->getCSValue("RPICAM_AWB")); - ui_->comboBoxEXP->setCurrentText(configuration_->getCSValue("RPICAM_EXP")); - ui_->comboBoxLoopTime->setCurrentText(configuration_->getCSValue("RPICAM_LOOPTIME")); - ui_->comboBoxLoopCount->setCurrentText(configuration_->getCSValue("RPICAM_LOOPCOUNT")); - - if (configuration_->getCSValue("RPICAM_AUTORECORDING") == "1") { - ui_->checkBoxAutoRecording->setChecked(true); - } else { - ui_->checkBoxAutoRecording->setChecked(false); - } - - if (configuration_->getCSValue("USBCAM_USE") == "1") { - ui_->comboBoxUSBCam->setCurrentText("enabled"); - } else { - ui_->comboBoxUSBCam->setCurrentText("none"); - } - if (configuration_->getCSValue("USBCAM_ROTATION") == "1") { - ui_->comboBoxUSBRotation->setCurrentText("180"); - } else { - ui_->comboBoxUSBRotation->setCurrentText("0"); - } - if (configuration_->getCSValue("USBCAM_HFLIP") == "1") { - ui_->checkBoxFlipXUSB->setChecked(true); - } else { - ui_->checkBoxFlipXUSB->setChecked(false); - } - if (configuration_->getCSValue("USBCAM_VFLIP") == "1") { - ui_->checkBoxFlipYUSB->setChecked(true); - } else { - ui_->checkBoxFlipYUSB->setChecked(false); - } - - // set bluetooth - if (configuration_->getCSValue("ENABLE_BLUETOOTH") == "1") { - // check external bluetooth enabled - if (configuration_->getCSValue("EXTERNAL_BLUETOOTH") == "1") { - ui_->radioButtonUseExternalBluetoothAdapter->setChecked(true); - } else { - ui_->radioButtonUseLocalBluetoothAdapter->setChecked(true); - } - // mac - //ui_->lineEditExternalBluetoothAdapterAddress->setText(getparams[37]); - } else { - ui_->radioButtonDisableBluetooth->setChecked(true); - ui_->lineEditExternalBluetoothAdapterAddress->setText(""); - } - if (configuration_->getCSValue("ENABLE_PAIRABLE") == "1") { - ui_->checkBoxBluetoothAutoPair->setChecked(true); - } else { - ui_->checkBoxBluetoothAutoPair->setChecked(false); - } - // set bluetooth type - if (configuration_->getCSValue("ENABLE_BLUETOOTH") == "1") { - QString bt = configuration_->getParamFromFile("/boot/config.txt","dtoverlay=pi3-disable-bt"); - if (bt.contains("pi3-disable-bt")) { - ui_->comboBoxBluetooth->setCurrentText("external"); - } else { - ui_->comboBoxBluetooth->setCurrentText("builtin"); - } - } else { - ui_->comboBoxBluetooth->setCurrentText("none"); - } - - // set lightsensor - if (std::ifstream("/etc/cs_lightsensor")) { - ui_->comboBoxLS->setCurrentIndex(1); - ui_->groupBoxSliderDay->hide(); - ui_->groupBoxSliderNight->hide(); - } else { - ui_->comboBoxLS->setCurrentIndex(0); - ui_->pushButtonTab9->hide(); - ui_->groupBoxSliderDay->show(); - ui_->groupBoxSliderNight->show(); - } - ui_->comboBoxDayNight->setCurrentText(configuration_->getCSValue("DAYNIGHT_PIN")); - if (configuration_->getCSValue("RTC_DAYNIGHT") == "1") { - ui_->checkBoxDisableDayNightRTC->setChecked(false); - } else { - ui_->checkBoxDisableDayNightRTC->setChecked(true); - } - QString theme = configuration_->getParamFromFile("/etc/plymouth/plymouthd.conf","Theme"); - if (theme == "csnganimation") { - ui_->radioButtonAnimatedCSNG->setChecked(true); - } - else if (theme == "crankshaft") { - ui_->radioButtonCSNG->setChecked(true); - } - else if (theme == "custom") { - ui_->radioButtonCustom->setChecked(true); - } - // wifi country code - ui_->comboBoxCountryCode->setCurrentIndex(ui_->comboBoxCountryCode->findText(configuration_->getCSValue("WIFI_COUNTRY"), Qt::MatchFlag::MatchStartsWith)); - // set screen blank instead off - if (configuration_->getCSValue("SCREEN_POWEROFF_OVERRIDE") == "1") { - ui_->checkBoxBlankOnly->setChecked(true); - } else { - ui_->checkBoxBlankOnly->setChecked(false); - } - } - // update network info - updateNetworkInfo(); -} - -void SettingsWindow::onStartHotspot() -{ - ui_->label_modeswitchprogress->setText("Wait ..."); - ui_->clientNetworkSelect->hide(); - ui_->label_notavailable->show(); - ui_->radioButtonClient->setEnabled(0); - ui_->radioButtonHotspot->setEnabled(0); - ui_->lineEdit_wlan0->setText(""); - ui_->lineEditWifiSSID->setText(""); - ui_->pushButtonNetworkAuto->hide(); - qApp->processEvents(); - std::remove("/tmp/manual_hotspot_control"); - std::ofstream("/tmp/manual_hotspot_control"); - system("/opt/crankshaft/service_hotspot.sh start &"); -} - -void SettingsWindow::onStopHotspot() -{ - ui_->label_modeswitchprogress->setText("Wait ..."); - ui_->clientNetworkSelect->hide(); - ui_->label_notavailable->show(); - ui_->radioButtonClient->setEnabled(0); - ui_->radioButtonHotspot->setEnabled(0); - ui_->lineEdit_wlan0->setText(""); - ui_->lineEditWifiSSID->setText(""); - ui_->lineEditPassword->setText(""); - ui_->pushButtonNetworkAuto->hide(); - qApp->processEvents(); - system("/opt/crankshaft/service_hotspot.sh stop &"); -} - -void SettingsWindow::updateSystemInfo() -{ - // free ram - struct sysinfo info; - sysinfo(&info); - ui_->valueSystemFreeMem->setText(QString::number(info.freeram/1024/1024) + " MB"); - // current cpu speed - QString freq = configuration_->readFileContent("/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq"); - int currentfreq = freq.toInt()/1000; - ui_->valueSystemCPUFreq->setText(QString::number(currentfreq) + "MHz"); - // current cpu temp - QString temp = configuration_->readFileContent("/sys/class/thermal/thermal_zone0/temp"); - int currenttemp = temp.toInt()/1000; - ui_->valueSystemCPUTemp->setText(QString::number(currenttemp) + "°C"); - // get remaining times - QProcess process; - process.start("/bin/bash", QStringList() << "-c" << "systemctl list-timers -all | grep disconnect | awk {'print $1'}"); - process.waitForFinished(-1); - QString stdout = process.readAllStandardOutput(); - if (stdout.simplified() != "n/a") { - process.start("/bin/bash", QStringList() << "-c" << "systemctl list-timers -all | grep disconnect | awk {'print $5\" \"$6'}"); - process.waitForFinished(-1); - QString stdout = process.readAllStandardOutput(); - if (stdout.simplified() != "") { - ui_->valueDisconnectTimer->setText(stdout.simplified()); - } else { - ui_->valueDisconnectTimer->setText("Stopped"); - } - } else { - ui_->valueDisconnectTimer->setText("Stopped"); - } - process.start("/bin/bash", QStringList() << "-c" << "systemctl list-timers -all | grep shutdown | awk {'print $1'}"); - process.waitForFinished(-1); - stdout = process.readAllStandardOutput(); - if (stdout.simplified() != "n/a") { - process.start("/bin/bash", QStringList() << "-c" << "systemctl list-timers -all | grep shutdown | awk {'print $5\" \"$6'}"); - process.waitForFinished(-1); - QString stdout = process.readAllStandardOutput(); - if (stdout.simplified() != "") { - ui_->valueShutdownTimer->setText(stdout.simplified()); - } else { - ui_->valueShutdownTimer->setText("Stopped"); - } - } else { - ui_->valueShutdownTimer->setText("Stopped"); - } -} - -void SettingsWindow::show_tab1() -{ - ui_->tab2->hide(); - ui_->tab3->hide(); - ui_->tab4->hide(); - ui_->tab5->hide(); - ui_->tab6->hide(); - ui_->tab7->hide(); - ui_->tab8->hide(); - ui_->tab9->hide(); - ui_->tab1->show(); -} - -void SettingsWindow::show_tab2() -{ - ui_->tab1->hide(); - ui_->tab3->hide(); - ui_->tab4->hide(); - ui_->tab5->hide(); - ui_->tab6->hide(); - ui_->tab7->hide(); - ui_->tab8->hide(); - ui_->tab9->hide(); - ui_->tab2->show(); -} - -void SettingsWindow::show_tab3() -{ - ui_->tab1->hide(); - ui_->tab2->hide(); - ui_->tab4->hide(); - ui_->tab5->hide(); - ui_->tab6->hide(); - ui_->tab7->hide(); - ui_->tab8->hide(); - ui_->tab9->hide(); - ui_->tab3->show(); -} - -void SettingsWindow::show_tab4() -{ - ui_->tab1->hide(); - ui_->tab2->hide(); - ui_->tab3->hide(); - ui_->tab5->hide(); - ui_->tab6->hide(); - ui_->tab7->hide(); - ui_->tab8->hide(); - ui_->tab9->hide(); - ui_->tab4->show(); -} - -void SettingsWindow::show_tab5() -{ - ui_->tab1->hide(); - ui_->tab2->hide(); - ui_->tab3->hide(); - ui_->tab4->hide(); - ui_->tab6->hide(); - ui_->tab7->hide(); - ui_->tab8->hide(); - ui_->tab9->hide(); - ui_->tab5->show(); -} - -void SettingsWindow::show_tab6() -{ - ui_->tab1->hide(); - ui_->tab2->hide(); - ui_->tab3->hide(); - ui_->tab4->hide(); - ui_->tab5->hide(); - ui_->tab7->hide(); - ui_->tab8->hide(); - ui_->tab9->hide(); - ui_->tab6->show(); -} - -void SettingsWindow::show_tab7() -{ - ui_->tab1->hide(); - ui_->tab2->hide(); - ui_->tab3->hide(); - ui_->tab4->hide(); - ui_->tab5->hide(); - ui_->tab6->hide(); - ui_->tab8->hide(); - ui_->tab9->hide(); - ui_->tab7->show(); -} - -void SettingsWindow::show_tab8() -{ - ui_->tab1->hide(); - ui_->tab2->hide(); - ui_->tab3->hide(); - ui_->tab4->hide(); - ui_->tab5->hide(); - ui_->tab6->hide(); - ui_->tab7->hide(); - ui_->tab9->hide(); - ui_->tab8->show(); -} - -void SettingsWindow::show_tab9() -{ - ui_->tab1->hide(); - ui_->tab2->hide(); - ui_->tab3->hide(); - ui_->tab4->hide(); - ui_->tab5->hide(); - ui_->tab6->hide(); - ui_->tab7->hide(); - ui_->tab8->hide(); - ui_->tab9->show(); -} - -} -} -} -} - -void f1x::openauto::autoapp::ui::SettingsWindow::on_pushButtonAudioTest_clicked() -{ - ui_->labelTestInProgress->show(); - ui_->pushButtonAudioTest->hide(); - qApp->processEvents(); - system("/usr/local/bin/crankshaft audio test"); - ui_->pushButtonAudioTest->show(); - ui_->labelTestInProgress->hide(); -} - -void f1x::openauto::autoapp::ui::SettingsWindow::updateNetworkInfo() -{ - if (std::ifstream("/tmp/samba_running")) { - ui_->labelSambaStatus->setText("running"); - if (ui_->pushButtonSambaStart->isVisible() == true) { - ui_->pushButtonSambaStart->hide(); - ui_->pushButtonSambaStop->show(); - } - } else { - ui_->labelSambaStatus->setText("stopped"); - if (ui_->pushButtonSambaStop->isVisible() == true) { - ui_->pushButtonSambaStop->hide(); - ui_->pushButtonSambaStart->show(); - } - } - - if (!std::ifstream("/tmp/mode_change_progress")) { - QNetworkInterface eth0if = QNetworkInterface::interfaceFromName("eth0"); - if (eth0if.flags().testFlag(QNetworkInterface::IsUp)) { - QList entrieseth0 = eth0if.addressEntries(); - if (!entrieseth0.isEmpty()) { - QNetworkAddressEntry eth0 = entrieseth0.first(); - //qDebug() << "eth0: " << eth0.ip(); - ui_->lineEdit_eth0->setText(eth0.ip().toString()); - } - } else { - //qDebug() << "eth0: down"; - ui_->lineEdit_eth0->setText("interface down"); - } - - QNetworkInterface wlan0if = QNetworkInterface::interfaceFromName("wlan0"); - if (wlan0if.flags().testFlag(QNetworkInterface::IsUp)) { - QList entrieswlan0 = wlan0if.addressEntries(); - if (!entrieswlan0.isEmpty()) { - QNetworkAddressEntry wlan0 = entrieswlan0.first(); - //qDebug() << "wlan0: " << wlan0.ip(); - ui_->lineEdit_wlan0->setText(wlan0.ip().toString()); - } - } else { - //qDebug() << "wlan0: down"; - ui_->lineEdit_wlan0->setText("interface down"); - } - - if (std::ifstream("/tmp/hotspot_active")) { - ui_->radioButtonClient->setEnabled(1); - ui_->radioButtonHotspot->setEnabled(1); - ui_->radioButtonHotspot->setChecked(1); - ui_->radioButtonClient->setChecked(0); - ui_->label_modeswitchprogress->setText("Ok"); - ui_->lineEditWifiSSID->setText(configuration_->getParamFromFile("/etc/hostapd/hostapd.conf","ssid")); - ui_->lineEditPassword->show(); - ui_->label_password->show(); - ui_->lineEditPassword->setText(configuration_->getParamFromFile("/etc/hostapd/hostapd.conf","wpa_passphrase")); - ui_->clientNetworkSelect->hide(); +#ifdef MAC_OS +#include +#include +#include +#include +#include +#include +#endif + +namespace f1x { + namespace openauto { + namespace autoapp { + namespace ui { + + SettingsWindow::SettingsWindow(configuration::IConfiguration::Pointer configuration, QWidget *parent) + : QWidget(parent), ui_(new Ui::SettingsWindow), configuration_(std::move(configuration)) { + ui_->setupUi(this); + connect(ui_->pushButtonCancel, &QPushButton::clicked, this, &SettingsWindow::close); + connect(ui_->pushButtonSave, &QPushButton::clicked, this, &SettingsWindow::onSave); + connect(ui_->pushButtonUnpair, &QPushButton::clicked, this, &SettingsWindow::unpairAll); + connect(ui_->pushButtonUnpair, &QPushButton::clicked, this, &SettingsWindow::close); + connect(ui_->horizontalSliderScreenDPI, &QSlider::valueChanged, this, &SettingsWindow::onUpdateScreenDPI); + connect(ui_->horizontalSliderAlphaTrans, &QSlider::valueChanged, this, &SettingsWindow::onUpdateAlphaTrans); + connect(ui_->horizontalSliderDay, &QSlider::valueChanged, this, &SettingsWindow::onUpdateBrightnessDay); + connect(ui_->horizontalSliderNight, &QSlider::valueChanged, this, &SettingsWindow::onUpdateBrightnessNight); + connect(ui_->horizontalSliderBrightness1, &QSlider::valueChanged, this, &SettingsWindow::onUpdateBrightness1); + connect(ui_->horizontalSliderBrightness2, &QSlider::valueChanged, this, &SettingsWindow::onUpdateBrightness2); + connect(ui_->horizontalSliderBrightness3, &QSlider::valueChanged, this, &SettingsWindow::onUpdateBrightness3); + connect(ui_->horizontalSliderBrightness4, &QSlider::valueChanged, this, &SettingsWindow::onUpdateBrightness4); + connect(ui_->horizontalSliderBrightness5, &QSlider::valueChanged, this, &SettingsWindow::onUpdateBrightness5); + connect(ui_->horizontalSliderLux1, &QSlider::valueChanged, this, &SettingsWindow::onUpdateLux1); + connect(ui_->horizontalSliderLux2, &QSlider::valueChanged, this, &SettingsWindow::onUpdateLux2); + connect(ui_->horizontalSliderLux3, &QSlider::valueChanged, this, &SettingsWindow::onUpdateLux3); + connect(ui_->horizontalSliderLux4, &QSlider::valueChanged, this, &SettingsWindow::onUpdateLux4); + connect(ui_->horizontalSliderLux5, &QSlider::valueChanged, this, &SettingsWindow::onUpdateLux5); + connect(ui_->radioButtonUseExternalBluetoothAdapter, &QRadioButton::clicked, + [&](bool checked) { ui_->lineEditExternalBluetoothAdapterAddress->setEnabled(checked); }); + connect(ui_->radioButtonDisableBluetooth, &QRadioButton::clicked, + [&]() { ui_->lineEditExternalBluetoothAdapterAddress->setEnabled(false); }); + connect(ui_->radioButtonUseLocalBluetoothAdapter, &QRadioButton::clicked, + [&]() { ui_->lineEditExternalBluetoothAdapterAddress->setEnabled(false); }); + connect(ui_->pushButtonClearSelection, &QPushButton::clicked, + std::bind(&SettingsWindow::setButtonCheckBoxes, this, false)); + connect(ui_->pushButtonSelectAll, &QPushButton::clicked, + std::bind(&SettingsWindow::setButtonCheckBoxes, this, true)); + connect(ui_->pushButtonResetToDefaults, &QPushButton::clicked, this, &SettingsWindow::onResetToDefaults); + connect(ui_->horizontalSliderSystemVolume, &QSlider::valueChanged, this, + &SettingsWindow::onUpdateSystemVolume); + connect(ui_->horizontalSliderSystemCapture, &QSlider::valueChanged, this, + &SettingsWindow::onUpdateSystemCapture); + connect(ui_->radioButtonHotspot, &QPushButton::clicked, this, &SettingsWindow::onStartHotspot); + connect(ui_->radioButtonClient, &QPushButton::clicked, this, &SettingsWindow::onStopHotspot); + connect(ui_->pushButtonSetTime, &QPushButton::clicked, this, &SettingsWindow::setTime); + connect(ui_->pushButtonSetTime, &QPushButton::clicked, this, &SettingsWindow::close); + connect(ui_->pushButtonNTP, &QPushButton::clicked, [&]() { system("/usr/local/bin/crankshaft rtc sync &"); }); + connect(ui_->pushButtonNTP, &QPushButton::clicked, this, &SettingsWindow::close); + connect(ui_->pushButtonCheckNow, &QPushButton::clicked, + [&]() { system("/usr/local/bin/crankshaft update check &"); }); + connect(ui_->pushButtonDebuglog, &QPushButton::clicked, this, &SettingsWindow::close); + connect(ui_->pushButtonDebuglog, &QPushButton::clicked, + [&]() { system("/usr/local/bin/crankshaft debuglog &"); }); + connect(ui_->pushButtonNetworkAuto, &QPushButton::clicked, + [&]() { system("/usr/local/bin/crankshaft network auto &"); }); + connect(ui_->pushButtonNetwork0, &QPushButton::clicked, this, &SettingsWindow::on_pushButtonNetwork0_clicked); + connect(ui_->pushButtonNetwork1, &QPushButton::clicked, this, &SettingsWindow::on_pushButtonNetwork1_clicked); + connect(ui_->pushButtonSambaStart, &QPushButton::clicked, + [&]() { system("/usr/local/bin/crankshaft samba start &"); }); + connect(ui_->pushButtonSambaStop, &QPushButton::clicked, + [&]() { system("/usr/local/bin/crankshaft samba stop &"); }); + + // menu + ui_->tab1->show(); + ui_->tab2->hide(); + ui_->tab3->hide(); + ui_->tab4->hide(); + ui_->tab5->hide(); + ui_->tab6->hide(); + ui_->tab7->hide(); + ui_->tab8->hide(); + ui_->tab9->hide(); + + ui_->horizontalGroupBox->hide(); + ui_->labelBluetoothAdapterAddress->hide(); + ui_->lineEditExternalBluetoothAdapterAddress->hide(); + ui_->labelTestInProgress->hide(); + + connect(ui_->pushButtonTab1, &QPushButton::clicked, this, &SettingsWindow::show_tab1); + connect(ui_->pushButtonTab2, &QPushButton::clicked, this, &SettingsWindow::show_tab2); + connect(ui_->pushButtonTab3, &QPushButton::clicked, this, &SettingsWindow::show_tab3); + connect(ui_->pushButtonTab4, &QPushButton::clicked, this, &SettingsWindow::show_tab4); + connect(ui_->pushButtonTab5, &QPushButton::clicked, this, &SettingsWindow::show_tab5); + connect(ui_->pushButtonTab5, &QPushButton::clicked, this, &SettingsWindow::updateNetworkInfo); + connect(ui_->pushButtonTab6, &QPushButton::clicked, this, &SettingsWindow::show_tab6); + connect(ui_->pushButtonTab6, &QPushButton::clicked, this, &SettingsWindow::updateSystemInfo); + connect(ui_->pushButtonTab7, &QPushButton::clicked, this, &SettingsWindow::show_tab7); + connect(ui_->pushButtonTab8, &QPushButton::clicked, this, &SettingsWindow::show_tab8); + connect(ui_->pushButtonTab9, &QPushButton::clicked, this, &SettingsWindow::show_tab9); + + QTime time = QTime::currentTime(); + QString time_text_hour = time.toString("hh"); + QString time_text_minute = time.toString("mm"); + ui_->spinBoxHour->setValue((time_text_hour).toInt()); + ui_->spinBoxMinute->setValue((time_text_minute).toInt()); + ui_->label_modeswitchprogress->setText("Ok"); + ui_->label_notavailable->hide(); + + QString wifi_ssid = configuration_->getCSValue("WIFI_SSID"); + QString wifi2_ssid = configuration_->getCSValue("WIFI2_SSID"); + + ui_->pushButtonNetwork0->setText(wifi_ssid); + ui_->pushButtonNetwork1->setText(wifi2_ssid); + + if (!std::ifstream("/boot/crankshaft/network1.conf")) { + ui_->pushButtonNetwork1->hide(); + ui_->pushButtonNetwork0->show(); + } + if (!std::ifstream("/boot/crankshaft/network0.conf")) { + ui_->pushButtonNetwork1->hide(); + ui_->pushButtonNetwork0->setText(configuration_->getCSValue("WIFI2_SSID")); + } + if (!std::ifstream("/boot/crankshaft/network0.conf") && !std::ifstream("/boot/crankshaft/network1.conf")) { + ui_->pushButtonNetwork0->hide(); + ui_->pushButtonNetwork1->hide(); ui_->pushButtonNetworkAuto->hide(); ui_->label_notavailable->show(); - } else { - ui_->radioButtonClient->setEnabled(1); - ui_->radioButtonHotspot->setEnabled(1); - ui_->radioButtonHotspot->setChecked(0); + } + + if (std::ifstream("/tmp/hotspot_active")) { + ui_->radioButtonClient->setChecked(0); + ui_->radioButtonHotspot->setChecked(1); + ui_->lineEditWifiSSID->setText(configuration_->getParamFromFile("/etc/hostapd/hostapd.conf", "ssid")); + ui_->lineEditPassword->show(); + ui_->label_password->show(); + ui_->lineEditPassword->setText("1234567890"); + ui_->clientNetworkSelect->hide(); + ui_->label_notavailable->show(); + } else { ui_->radioButtonClient->setChecked(1); - ui_->label_modeswitchprogress->setText("Ok"); + ui_->radioButtonHotspot->setChecked(0); ui_->lineEditWifiSSID->setText(configuration_->readFileContent("/tmp/wifi_ssid")); ui_->lineEditPassword->hide(); ui_->label_password->hide(); ui_->lineEditPassword->setText(""); - ui_->clientNetworkSelect->show(); - ui_->label_notavailable->hide(); - ui_->pushButtonNetworkAuto->show(); + ui_->clientNetworkSelect->hide(); + ui_->label_notavailable->show(); + } - if (!std::ifstream("/boot/crankshaft/network1.conf")) { - ui_->pushButtonNetwork1->hide(); - ui_->pushButtonNetwork0->show(); - } - if (!std::ifstream("/boot/crankshaft/network0.conf")) { - ui_->pushButtonNetwork1->hide(); - ui_->pushButtonNetwork0->setText(configuration_->getCSValue("WIFI2_SSID")); - } - if (!std::ifstream("/boot/crankshaft/network0.conf") && !std::ifstream("/boot/crankshaft/network1.conf")) { - ui_->pushButtonNetwork0->hide(); - ui_->pushButtonNetwork1->hide(); - ui_->pushButtonNetworkAuto->hide(); - ui_->label_notavailable->show(); - } + if (std::ifstream("/tmp/samba_running")) { + ui_->labelSambaStatus->setText("running"); + ui_->pushButtonSambaStart->hide(); + ui_->pushButtonSambaStop->show(); + } else { + ui_->labelSambaStatus->setText("stopped"); + ui_->pushButtonSambaStop->hide(); + ui_->pushButtonSambaStart->show(); + } + + QTimer *refresh = new QTimer(this); + connect(refresh, SIGNAL(timeout()), this, SLOT(updateInfo())); + refresh->start(5000); } + + SettingsWindow::~SettingsWindow() { + delete ui_; + } + + void SettingsWindow::updateInfo() { + if (ui_->tab6->isVisible() == true) { + updateSystemInfo(); + } + if (ui_->tab5->isVisible() == true) { + updateNetworkInfo(); + } + } + + void SettingsWindow::onSave() { + configuration_->setHandednessOfTrafficType( + ui_->radioButtonLeftHandDrive->isChecked() ? configuration::HandednessOfTrafficType::LEFT_HAND_DRIVE + : configuration::HandednessOfTrafficType::RIGHT_HAND_DRIVE); + + configuration_->showClock(ui_->checkBoxShowClock->isChecked()); + configuration_->showBigClock(ui_->checkBoxShowBigClock->isChecked()); + configuration_->oldGUI(ui_->checkBoxOldGUI->isChecked()); + configuration_->setAlphaTrans(static_cast(ui_->horizontalSliderAlphaTrans->value())); + configuration_->hideMenuToggle(ui_->checkBoxHideMenuToggle->isChecked()); + configuration_->showLux(ui_->checkBoxShowLux->isChecked()); + configuration_->showCursor(ui_->checkBoxShowCursor->isChecked()); + configuration_->hideBrightnessControl(ui_->checkBoxHideBrightnessControl->isChecked()); + configuration_->showNetworkinfo(ui_->checkBoxNetworkinfo->isChecked()); + configuration_->mp3AutoPlay(ui_->checkBoxAutoPlay->isChecked()); + configuration_->showAutoPlay(ui_->checkBoxShowPlayer->isChecked()); + configuration_->instantPlay(ui_->checkBoxInstantPlay->isChecked()); + configuration_->hideWarning(ui_->checkBoxDontShowAgain->isChecked()); + + configuration_->setVideoFPS(ui_->radioButton30FPS->isChecked() + ? aap_protobuf::service::media::shared::message::VideoFrameRateType::VIDEO_FPS_30 + : aap_protobuf::service::media::shared::message::VideoFrameRateType::VIDEO_FPS_60); + + if (ui_->radioButton480p->isChecked()) { + configuration_->setVideoResolution( + aap_protobuf::service::media::shared::message::VideoCodecResolutionType::VIDEO_800x480); + } else if (ui_->radioButton720p->isChecked()) { + configuration_->setVideoResolution( + aap_protobuf::service::media::shared::message::VideoCodecResolutionType::VIDEO_1280x720); + } else if (ui_->radioButton1080p->isChecked()) { + configuration_->setVideoResolution( + aap_protobuf::service::media::shared::message::VideoCodecResolutionType::VIDEO_1920x1080); + } + + configuration_->setScreenDPI(static_cast(ui_->horizontalSliderScreenDPI->value())); + configuration_->setOMXLayerIndex(ui_->spinBoxOmxLayerIndex->value()); + + QRect videoMargins(0, 0, ui_->spinBoxVideoMarginWidth->value(), ui_->spinBoxVideoMarginHeight->value()); + configuration_->setVideoMargins(std::move(videoMargins)); + + configuration_->setTouchscreenEnabled(ui_->checkBoxEnableTouchscreen->isChecked()); + this->saveButtonCheckBoxes(); + + configuration_->playerButtonControl(ui_->checkBoxPlayerControl->isChecked()); + + if (ui_->radioButtonDisableBluetooth->isChecked()) { + configuration_->setBluetoothAdapterType(configuration::BluetoothAdapterType::NONE); + } else if (ui_->radioButtonUseLocalBluetoothAdapter->isChecked()) { + configuration_->setBluetoothAdapterType(configuration::BluetoothAdapterType::LOCAL); + } else if (ui_->radioButtonUseExternalBluetoothAdapter->isChecked()) { + configuration_->setBluetoothAdapterType(configuration::BluetoothAdapterType::REMOTE); + } + + configuration_->setBluetoothRemoteAdapterAddress( + ui_->lineEditExternalBluetoothAdapterAddress->text().toStdString()); + + configuration_->setMusicAudioChannelEnabled(ui_->checkBoxMusicAudioChannel->isChecked()); + configuration_->setGuidanceAudioChannelEnabled(ui_->checkBoxSpeechAudioChannel->isChecked()); + configuration_->setAudioOutputBackendType( + ui_->radioButtonRtAudio->isChecked() ? configuration::AudioOutputBackendType::RTAUDIO + : configuration::AudioOutputBackendType::QT); + + configuration_->save(); + + // generate param string for autoapp_helper + std::string params; + params.append(std::to_string(ui_->horizontalSliderSystemVolume->value())); + params.append("#"); + params.append(std::to_string(ui_->horizontalSliderSystemCapture->value())); + params.append("#"); + params.append(std::to_string(ui_->spinBoxDisconnect->value())); + params.append("#"); + params.append(std::to_string(ui_->spinBoxShutdown->value())); + params.append("#"); + params.append(std::to_string(ui_->spinBoxDay->value())); + params.append("#"); + params.append(std::to_string(ui_->spinBoxNight->value())); + params.append("#"); + if (ui_->checkBoxGPIO->isChecked()) { + params.append("1"); + } else { + params.append("0"); + } + params.append("#"); + params.append(std::string(ui_->comboBoxDevMode->currentText().toStdString())); + params.append("#"); + params.append(std::string(ui_->comboBoxInvert->currentText().toStdString())); + params.append("#"); + params.append(std::string(ui_->comboBoxX11->currentText().toStdString())); + params.append("#"); + params.append(std::string(ui_->comboBoxRearcam->currentText().toStdString())); + params.append("#"); + params.append(std::string(ui_->comboBoxAndroid->currentText().toStdString())); + params.append("#"); + if (ui_->radioButtonX11->isChecked()) { + params.append("1"); + } else { + params.append("0"); + } + params.append("#"); + if (ui_->radioButtonScreenRotated->isChecked()) { + params.append("1"); + } else { + params.append("0"); + } + params.append("#"); + params.append( + std::string("'") + std::string(ui_->comboBoxPulseOutput->currentText().toStdString()) + std::string("'")); + params.append("#"); + params.append( + std::string("'") + std::string(ui_->comboBoxPulseInput->currentText().toStdString()) + std::string("'")); + params.append("#"); + params.append(std::string(ui_->comboBoxHardwareRTC->currentText().toStdString())); + params.append("#"); + params.append(std::string(ui_->comboBoxTZ->currentText().toStdString())); + params.append("#"); + params.append(std::string(ui_->comboBoxHardwareDAC->currentText().toStdString())); + params.append("#"); + if (ui_->checkBoxDisableShutdown->isChecked()) { + params.append("1"); + } else { + params.append("0"); + } + params.append("#"); + if (ui_->checkBoxDisableScreenOff->isChecked()) { + params.append("1"); + } else { + params.append("0"); + } + params.append("#"); + if (ui_->radioButtonDebugmodeEnabled->isChecked()) { + params.append("1"); + } else { + params.append("0"); + } + params.append("#"); + params.append(std::string(ui_->comboBoxGPIOShutdown->currentText().toStdString())); + params.append("#"); + params.append(std::to_string(ui_->spinBoxGPIOShutdownDelay->value())); + params.append("#"); + if (ui_->checkBoxHotspot->isChecked()) { + params.append("1"); + } else { + params.append("0"); + } + params.append("#"); + params.append(std::string(ui_->comboBoxCam->currentText().toStdString())); + params.append("#"); + if (ui_->checkBoxBluetoothAutoPair->isChecked()) { + params.append("1"); + } else { + params.append("0"); + } + params.append("#"); + params.append(std::string(ui_->comboBoxBluetooth->currentText().toStdString())); + params.append("#"); + if (ui_->checkBoxHardwareSave->isChecked()) { + params.append("1"); + } else { + params.append("0"); + } + params.append("#"); + params.append(std::string(ui_->comboBoxUSBCam->currentText().toStdString())); + params.append("#"); + params.append(std::string(ui_->comboBoxLS->currentText().split(" ")[0].toStdString())); + params.append("#"); + params.append(std::string(ui_->comboBoxDayNight->currentText().toStdString())); + params.append("#"); + params.append(std::to_string(ui_->horizontalSliderDay->value())); + params.append("#"); + params.append(std::to_string(ui_->horizontalSliderNight->value())); + params.append("#"); + params.append(std::to_string(ui_->horizontalSliderLux1->value())); + params.append("#"); + params.append(std::to_string(ui_->horizontalSliderBrightness1->value())); + params.append("#"); + params.append(std::to_string(ui_->horizontalSliderLux2->value())); + params.append("#"); + params.append(std::to_string(ui_->horizontalSliderBrightness2->value())); + params.append("#"); + params.append(std::to_string(ui_->horizontalSliderLux3->value())); + params.append("#"); + params.append(std::to_string(ui_->horizontalSliderBrightness3->value())); + params.append("#"); + params.append(std::to_string(ui_->horizontalSliderLux4->value())); + params.append("#"); + params.append(std::to_string(ui_->horizontalSliderBrightness4->value())); + params.append("#"); + params.append(std::to_string(ui_->horizontalSliderLux5->value())); + params.append("#"); + params.append(std::to_string(ui_->horizontalSliderBrightness5->value())); + params.append("#"); + params.append(std::string(ui_->comboBoxCheckInterval->currentText().toStdString())); + params.append("#"); + params.append(std::string(ui_->comboBoxNightmodeStep->currentText().toStdString())); + params.append("#"); + if (ui_->checkBoxDisableDayNightRTC->isChecked()) { + params.append("0"); + } else { + params.append("1"); + } + params.append("#"); + if (ui_->radioButtonAnimatedCSNG->isChecked()) { + params.append("0"); + } else if (ui_->radioButtonCSNG->isChecked()) { + params.append("1"); + } else if (ui_->radioButtonCustom->isChecked()) { + params.append("2"); + } + params.append("#"); + params.append( + std::string(ui_->comboBoxCountryCode->currentText().split("|")[0].replace(" ", "").toStdString())); + params.append("#"); + if (ui_->checkBoxBlankOnly->isChecked()) { + params.append("1"); + } else { + params.append("0"); + } + params.append("#"); + if (ui_->checkBoxFlipX->isChecked()) { + params.append("1"); + } else { + params.append("0"); + } + params.append("#"); + if (ui_->checkBoxFlipY->isChecked()) { + params.append("1"); + } else { + params.append("0"); + } + params.append("#"); + params.append(std::string(ui_->comboBoxRotation->currentText().toStdString())); + params.append("#"); + params.append(std::string(ui_->comboBoxResolution->currentText().toStdString())); + params.append("#"); + params.append(std::string((ui_->comboBoxFPS->currentText()).replace(" (not @1080)", "").toStdString())); + params.append("#"); + params.append(std::string(ui_->comboBoxAWB->currentText().toStdString())); + params.append("#"); + params.append(std::string(ui_->comboBoxEXP->currentText().toStdString())); + params.append("#"); + params.append(std::string(ui_->comboBoxLoopTime->currentText().toStdString())); + params.append("#"); + params.append(std::string(ui_->comboBoxLoopCount->currentText().toStdString())); + params.append("#"); + if (ui_->checkBoxAutoRecording->isChecked()) { + params.append("1"); + } else { + params.append("0"); + } + params.append("#"); + if (ui_->checkBoxFlipXUSB->isChecked()) { + params.append("1"); + } else { + params.append("0"); + } + params.append("#"); + if (ui_->checkBoxFlipYUSB->isChecked()) { + params.append("1"); + } else { + params.append("0"); + } + params.append("#"); + params.append(std::string(ui_->comboBoxUSBRotation->currentText().replace("180", "1").toStdString())); + params.append("#"); + system((std::string("/usr/local/bin/autoapp_helper setparams#") + std::string(params) + + std::string(" &")).c_str()); + + this->close(); + } + + void SettingsWindow::onResetToDefaults() { + QMessageBox confirmationMessage(QMessageBox::Question, "Confirmation", + "Are you sure you want to reset settings?", + QMessageBox::Yes | QMessageBox::Cancel); + //confirmationMessage.setWindowFlags(Qt::WindowStaysOnTopHint); + if (confirmationMessage.exec() == QMessageBox::Yes) { + configuration_->reset(); + this->load(); + } + } + + void SettingsWindow::showEvent(QShowEvent *event) { + QWidget::showEvent(event); + this->load(); + } + + void SettingsWindow::load() { + ui_->radioButtonLeftHandDrive->setChecked( + configuration_->getHandednessOfTrafficType() == configuration::HandednessOfTrafficType::LEFT_HAND_DRIVE); + ui_->radioButtonRightHandDrive->setChecked( + configuration_->getHandednessOfTrafficType() == configuration::HandednessOfTrafficType::RIGHT_HAND_DRIVE); + ui_->checkBoxShowClock->setChecked(configuration_->showClock()); + ui_->horizontalSliderAlphaTrans->setValue(static_cast(configuration_->getAlphaTrans())); + + ui_->checkBoxShowBigClock->setChecked(configuration_->showBigClock()); + ui_->checkBoxOldGUI->setChecked(configuration_->oldGUI()); + ui_->checkBoxHideMenuToggle->setChecked(configuration_->hideMenuToggle()); + ui_->checkBoxShowLux->setChecked(configuration_->showLux()); + ui_->checkBoxShowCursor->setChecked(configuration_->showCursor()); + ui_->checkBoxHideBrightnessControl->setChecked(configuration_->hideBrightnessControl()); + ui_->checkBoxNetworkinfo->setChecked(configuration_->showNetworkinfo()); + ui_->checkBoxAutoPlay->setChecked(configuration_->mp3AutoPlay()); + ui_->checkBoxShowPlayer->setChecked(configuration_->showAutoPlay()); + ui_->checkBoxInstantPlay->setChecked(configuration_->instantPlay()); + ui_->checkBoxDontShowAgain->setChecked(configuration_->hideWarning()); + + ui_->radioButton30FPS->setChecked(configuration_->getVideoFPS() == + aap_protobuf::service::media::shared::message::VideoFrameRateType::VIDEO_FPS_30); + ui_->radioButton60FPS->setChecked(configuration_->getVideoFPS() == + aap_protobuf::service::media::shared::message::VideoFrameRateType::VIDEO_FPS_60); + + ui_->radioButton480p->setChecked(configuration_->getVideoResolution() == + aap_protobuf::service::media::shared::message::VideoCodecResolutionType::VIDEO_800x480); + ui_->radioButton720p->setChecked(configuration_->getVideoResolution() == + aap_protobuf::service::media::shared::message::VideoCodecResolutionType::VIDEO_1280x720); + ui_->radioButton1080p->setChecked(configuration_->getVideoResolution() == + aap_protobuf::service::media::shared::message::VideoCodecResolutionType::VIDEO_1920x1080); + ui_->horizontalSliderScreenDPI->setValue(static_cast(configuration_->getScreenDPI())); + ui_->spinBoxOmxLayerIndex->setValue(configuration_->getOMXLayerIndex()); + + const auto &videoMargins = configuration_->getVideoMargins(); + ui_->spinBoxVideoMarginWidth->setValue(videoMargins.width()); + ui_->spinBoxVideoMarginHeight->setValue(videoMargins.height()); + + ui_->checkBoxEnableTouchscreen->setChecked(configuration_->getTouchscreenEnabled()); + this->loadButtonCheckBoxes(); + ui_->checkBoxPlayerControl->setChecked(configuration_->playerButtonControl()); + + ui_->radioButtonDisableBluetooth->setChecked( + configuration_->getBluetoothAdapterType() == configuration::BluetoothAdapterType::NONE); + ui_->radioButtonUseLocalBluetoothAdapter->setChecked( + configuration_->getBluetoothAdapterType() == configuration::BluetoothAdapterType::LOCAL); + ui_->radioButtonUseExternalBluetoothAdapter->setChecked( + configuration_->getBluetoothAdapterType() == configuration::BluetoothAdapterType::REMOTE); + ui_->lineEditExternalBluetoothAdapterAddress->setEnabled( + configuration_->getBluetoothAdapterType() == configuration::BluetoothAdapterType::REMOTE); + ui_->lineEditExternalBluetoothAdapterAddress->setText( + QString::fromStdString(configuration_->getBluetoothRemoteAdapterAddress())); + + ui_->checkBoxMusicAudioChannel->setChecked(configuration_->musicAudioChannelEnabled()); + ui_->checkBoxSpeechAudioChannel->setChecked(configuration_->guidanceAudioChannelEnabled()); + + const auto &audioOutputBackendType = configuration_->getAudioOutputBackendType(); + ui_->radioButtonRtAudio->setChecked(audioOutputBackendType == configuration::AudioOutputBackendType::RTAUDIO); + ui_->radioButtonQtAudio->setChecked(audioOutputBackendType == configuration::AudioOutputBackendType::QT); + + ui_->checkBoxHardwareSave->setChecked(false); + QStorageInfo storage("/media/USBDRIVES/CSSTORAGE"); + storage.refresh(); + if (storage.isValid() && storage.isReady()) { + if (storage.isReadOnly()) { + ui_->labelStorage->setText("Storage is read only! (" + storage.device() + + ") - This can be caused by demaged filesystem on CSSTORAGE. Try a reboot."); + } else { + ui_->labelStorage->setText( + "Device: " + storage.device() + " Label: " + storage.displayName() + " Total: " + + QString::number(storage.bytesTotal() / 1024 / 1024 / 1024) + "GB Free: " + + QString::number(storage.bytesFree() / 1024 / 1024 / 1024) + "GB (" + storage.fileSystemType() + ")"); + } + } else { + ui_->labelStorage->setText("Storage is not ready or missing!"); + } + } + + void SettingsWindow::loadButtonCheckBoxes() { + const auto &buttonCodes = configuration_->getButtonCodes(); + ui_->checkBoxPlayButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), + aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PLAY) != + buttonCodes.end()); + ui_->checkBoxPauseButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), + aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PAUSE) != + buttonCodes.end()); + ui_->checkBoxTogglePlayButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), + aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PLAY_PAUSE) != + buttonCodes.end()); + ui_->checkBoxNextTrackButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), + aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_NEXT) != + buttonCodes.end()); + ui_->checkBoxPreviousTrackButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), + aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PREVIOUS) != + buttonCodes.end()); + ui_->checkBoxHomeButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), + aap_protobuf::service::media::sink::KeyCode::KEYCODE_HOME) != + buttonCodes.end()); + ui_->checkBoxPhoneButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), + aap_protobuf::service::media::sink::KeyCode::KEYCODE_CALL) != + buttonCodes.end()); + ui_->checkBoxCallEndButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), + aap_protobuf::service::media::sink::KeyCode::KEYCODE_ENDCALL) != + buttonCodes.end()); + ui_->checkBoxVoiceCommandButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), + aap_protobuf::service::media::sink::KeyCode::KEYCODE_SEARCH) != + buttonCodes.end()); + ui_->checkBoxLeftButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), + aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_LEFT) != + buttonCodes.end()); + ui_->checkBoxRightButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), + aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_RIGHT) != + buttonCodes.end()); + ui_->checkBoxUpButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), + aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_UP) != + buttonCodes.end()); + ui_->checkBoxDownButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), + aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_DOWN) != + buttonCodes.end()); + ui_->checkBoxScrollWheelButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), + aap_protobuf::service::media::sink::KeyCode::KEYCODE_ROTARY_CONTROLLER) != + buttonCodes.end()); + ui_->checkBoxBackButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), + aap_protobuf::service::media::sink::KeyCode::KEYCODE_BACK) != + buttonCodes.end()); + ui_->checkBoxEnterButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), + aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_CENTER) != + buttonCodes.end()); + ui_->checkBoxNavButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), + aap_protobuf::service::media::sink::KeyCode::KEYCODE_NAVIGATION) != + buttonCodes.end()); + } + + void SettingsWindow::setButtonCheckBoxes(bool value) { + ui_->checkBoxPlayButton->setChecked(value); + ui_->checkBoxPauseButton->setChecked(value); + ui_->checkBoxTogglePlayButton->setChecked(value); + ui_->checkBoxNextTrackButton->setChecked(value); + ui_->checkBoxPreviousTrackButton->setChecked(value); + ui_->checkBoxHomeButton->setChecked(value); + ui_->checkBoxPhoneButton->setChecked(value); + ui_->checkBoxCallEndButton->setChecked(value); + ui_->checkBoxVoiceCommandButton->setChecked(value); + ui_->checkBoxLeftButton->setChecked(value); + ui_->checkBoxRightButton->setChecked(value); + ui_->checkBoxUpButton->setChecked(value); + ui_->checkBoxDownButton->setChecked(value); + ui_->checkBoxScrollWheelButton->setChecked(value); + ui_->checkBoxBackButton->setChecked(value); + ui_->checkBoxEnterButton->setChecked(value); + ui_->checkBoxNavButton->setChecked(value); + } + + void SettingsWindow::saveButtonCheckBoxes() { + configuration::IConfiguration::ButtonCodes buttonCodes; + this->saveButtonCheckBox(ui_->checkBoxPlayButton, buttonCodes, + aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PLAY); + this->saveButtonCheckBox(ui_->checkBoxPauseButton, buttonCodes, + aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PAUSE); + this->saveButtonCheckBox(ui_->checkBoxTogglePlayButton, buttonCodes, + aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PLAY_PAUSE); + this->saveButtonCheckBox(ui_->checkBoxNextTrackButton, buttonCodes, + aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_NEXT); + this->saveButtonCheckBox(ui_->checkBoxPreviousTrackButton, buttonCodes, + aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PREVIOUS); + this->saveButtonCheckBox(ui_->checkBoxHomeButton, buttonCodes, + aap_protobuf::service::media::sink::KeyCode::KEYCODE_HOME); + this->saveButtonCheckBox(ui_->checkBoxPhoneButton, buttonCodes, + aap_protobuf::service::media::sink::KeyCode::KEYCODE_CALL); + this->saveButtonCheckBox(ui_->checkBoxCallEndButton, buttonCodes, + aap_protobuf::service::media::sink::KeyCode::KEYCODE_ENDCALL); + this->saveButtonCheckBox(ui_->checkBoxVoiceCommandButton, buttonCodes, + aap_protobuf::service::media::sink::KeyCode::KEYCODE_SEARCH); + this->saveButtonCheckBox(ui_->checkBoxLeftButton, buttonCodes, + aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_LEFT); + this->saveButtonCheckBox(ui_->checkBoxRightButton, buttonCodes, + aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_RIGHT); + this->saveButtonCheckBox(ui_->checkBoxUpButton, buttonCodes, + aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_UP); + this->saveButtonCheckBox(ui_->checkBoxDownButton, buttonCodes, + aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_DOWN); + this->saveButtonCheckBox(ui_->checkBoxScrollWheelButton, buttonCodes, + aap_protobuf::service::media::sink::KeyCode::KEYCODE_ROTARY_CONTROLLER); + this->saveButtonCheckBox(ui_->checkBoxBackButton, buttonCodes, + aap_protobuf::service::media::sink::KeyCode::KEYCODE_BACK); + this->saveButtonCheckBox(ui_->checkBoxEnterButton, buttonCodes, + aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_CENTER); + this->saveButtonCheckBox(ui_->checkBoxNavButton, buttonCodes, + aap_protobuf::service::media::sink::KeyCode::KEYCODE_NAVIGATION); + configuration_->setButtonCodes(buttonCodes); + } + + void SettingsWindow::saveButtonCheckBox(const QCheckBox *checkBox, + configuration::IConfiguration::ButtonCodes &buttonCodes, + aap_protobuf::service::media::sink::KeyCode buttonCode) { + if (checkBox->isChecked()) { + buttonCodes.push_back(buttonCode); + } + } + + void SettingsWindow::onUpdateScreenDPI(int value) { + ui_->labelScreenDPIValue->setText(QString::number(value)); + } + + void SettingsWindow::onUpdateAlphaTrans(int value) { + double alpha = value / 100.0; + ui_->labelAlphaTransValue->setText(QString::number(alpha)); + } + + void SettingsWindow::onUpdateBrightnessDay(int value) { + ui_->labelBrightnessDay->setText(QString::number(value)); + } + + void SettingsWindow::onUpdateBrightnessNight(int value) { + ui_->labelBrightnessNight->setText(QString::number(value)); + } + + void SettingsWindow::onUpdateSystemVolume(int value) { + ui_->labelSystemVolumeValue->setText(QString::number(value)); + } + + void SettingsWindow::onUpdateSystemCapture(int value) { + ui_->labelSystemCaptureValue->setText(QString::number(value)); + } + + void SettingsWindow::onUpdateLux1(int value) { + ui_->valueLux1->setText(QString::number(value)); + } + + void SettingsWindow::onUpdateLux2(int value) { + ui_->valueLux2->setText(QString::number(value)); + } + + void SettingsWindow::onUpdateLux3(int value) { + ui_->valueLux3->setText(QString::number(value)); + } + + void SettingsWindow::onUpdateLux4(int value) { + ui_->valueLux4->setText(QString::number(value)); + } + + void SettingsWindow::onUpdateLux5(int value) { + ui_->valueLux5->setText(QString::number(value)); + } + + void SettingsWindow::onUpdateBrightness1(int value) { + ui_->valueBrightness1->setText(QString::number(value)); + } + + void SettingsWindow::onUpdateBrightness2(int value) { + ui_->valueBrightness2->setText(QString::number(value)); + } + + void SettingsWindow::onUpdateBrightness3(int value) { + ui_->valueBrightness3->setText(QString::number(value)); + } + + void SettingsWindow::onUpdateBrightness4(int value) { + ui_->valueBrightness4->setText(QString::number(value)); + } + + void SettingsWindow::onUpdateBrightness5(int value) { + ui_->valueBrightness5->setText(QString::number(value)); + } + + void SettingsWindow::unpairAll() { + system("/usr/local/bin/crankshaft bluetooth unpair &"); + } + + void SettingsWindow::setTime() { + // generate param string for autoapp_helper + std::string params; + params.append(std::to_string(ui_->spinBoxHour->value())); + params.append("#"); + params.append(std::to_string(ui_->spinBoxMinute->value())); + params.append("#"); + system((std::string("/usr/local/bin/autoapp_helper settime#") + std::string(params) + + std::string(" &")).c_str()); + } + + void SettingsWindow::syncNTPTime() { + system("/usr/local/bin/crankshaft rtc sync &"); + } + + void SettingsWindow::loadSystemValues() { + // set brightness slider attribs + ui_->horizontalSliderDay->setMinimum(configuration_->getCSValue("BR_MIN").toInt()); + ui_->horizontalSliderDay->setMaximum(configuration_->getCSValue("BR_MAX").toInt()); + ui_->horizontalSliderDay->setSingleStep(configuration_->getCSValue("BR_STEP").toInt()); + ui_->horizontalSliderDay->setTickInterval(configuration_->getCSValue("BR_STEP").toInt()); + ui_->horizontalSliderDay->setValue(configuration_->getCSValue("BR_DAY").toInt()); + + ui_->horizontalSliderNight->setMinimum(configuration_->getCSValue("BR_MIN").toInt()); + ui_->horizontalSliderNight->setMaximum(configuration_->getCSValue("BR_MAX").toInt()); + ui_->horizontalSliderNight->setSingleStep(configuration_->getCSValue("BR_STEP").toInt()); + ui_->horizontalSliderNight->setTickInterval(configuration_->getCSValue("BR_STEP").toInt()); + ui_->horizontalSliderNight->setValue(configuration_->getCSValue("BR_NIGHT").toInt()); + + ui_->horizontalSliderBrightness1->setMinimum(configuration_->getCSValue("BR_MIN").toInt()); + ui_->horizontalSliderBrightness1->setMaximum(configuration_->getCSValue("BR_MAX").toInt()); + ui_->horizontalSliderBrightness1->setSingleStep(configuration_->getCSValue("BR_STEP").toInt()); + ui_->horizontalSliderBrightness1->setTickInterval(configuration_->getCSValue("BR_STEP").toInt()); + + ui_->horizontalSliderBrightness2->setMinimum(configuration_->getCSValue("BR_MIN").toInt()); + ui_->horizontalSliderBrightness2->setMaximum(configuration_->getCSValue("BR_MAX").toInt()); + ui_->horizontalSliderBrightness2->setSingleStep(configuration_->getCSValue("BR_STEP").toInt()); + ui_->horizontalSliderBrightness2->setTickInterval(configuration_->getCSValue("BR_STEP").toInt()); + + ui_->horizontalSliderBrightness3->setMinimum(configuration_->getCSValue("BR_MIN").toInt()); + ui_->horizontalSliderBrightness3->setMaximum(configuration_->getCSValue("BR_MAX").toInt()); + ui_->horizontalSliderBrightness3->setSingleStep(configuration_->getCSValue("BR_STEP").toInt()); + ui_->horizontalSliderBrightness3->setTickInterval(configuration_->getCSValue("BR_STEP").toInt()); + + ui_->horizontalSliderBrightness4->setMinimum(configuration_->getCSValue("BR_MIN").toInt()); + ui_->horizontalSliderBrightness4->setMaximum(configuration_->getCSValue("BR_MAX").toInt()); + ui_->horizontalSliderBrightness4->setSingleStep(configuration_->getCSValue("BR_STEP").toInt()); + ui_->horizontalSliderBrightness4->setTickInterval(configuration_->getCSValue("BR_STEP").toInt()); + + ui_->horizontalSliderBrightness5->setMinimum(configuration_->getCSValue("BR_MIN").toInt()); + ui_->horizontalSliderBrightness5->setMaximum(configuration_->getCSValue("BR_MAX").toInt()); + ui_->horizontalSliderBrightness5->setSingleStep(configuration_->getCSValue("BR_STEP").toInt()); + ui_->horizontalSliderBrightness5->setTickInterval(configuration_->getCSValue("BR_STEP").toInt()); + + // set tsl2561 slider attribs + ui_->horizontalSliderLux1->setValue(configuration_->getCSValue("LUX_LEVEL_1").toInt()); + ui_->horizontalSliderBrightness1->setValue(configuration_->getCSValue("DISP_BRIGHTNESS_1").toInt()); + ui_->horizontalSliderLux2->setValue(configuration_->getCSValue("LUX_LEVEL_2").toInt()); + ui_->horizontalSliderBrightness2->setValue(configuration_->getCSValue("DISP_BRIGHTNESS_2").toInt()); + ui_->horizontalSliderLux3->setValue(configuration_->getCSValue("LUX_LEVEL_3").toInt()); + ui_->horizontalSliderBrightness3->setValue(configuration_->getCSValue("DISP_BRIGHTNESS_3").toInt()); + ui_->horizontalSliderLux4->setValue(configuration_->getCSValue("LUX_LEVEL_4").toInt()); + ui_->horizontalSliderBrightness4->setValue(configuration_->getCSValue("DISP_BRIGHTNESS_4").toInt()); + ui_->horizontalSliderLux5->setValue(configuration_->getCSValue("LUX_LEVEL_5").toInt()); + ui_->horizontalSliderBrightness5->setValue(configuration_->getCSValue("DISP_BRIGHTNESS_5").toInt()); + ui_->comboBoxCheckInterval->setCurrentText(configuration_->getCSValue("TSL2561_CHECK_INTERVAL")); + ui_->comboBoxNightmodeStep->setCurrentText(configuration_->getCSValue("TSL2561_DAYNIGHT_ON_STEP")); + + if (std::ifstream("/tmp/return_value")) { + QString return_values = configuration_->readFileContent("/tmp/return_value"); + QStringList getparams = return_values.split("#"); + + // version string + ui_->valueSystemVersion->setText(configuration_->readFileContent("/etc/crankshaft.build")); + // date string + ui_->valueSystemBuildDate->setText(configuration_->readFileContent("/etc/crankshaft.date")); + // set volume + ui_->labelSystemVolumeValue->setText(configuration_->readFileContent("/boot/crankshaft/volume")); + ui_->horizontalSliderSystemVolume->setValue( + configuration_->readFileContent("/boot/crankshaft/volume").toInt()); + // set cap volume + ui_->labelSystemCaptureValue->setText(configuration_->readFileContent("/boot/crankshaft/capvolume")); + ui_->horizontalSliderSystemCapture->setValue( + configuration_->readFileContent("/boot/crankshaft/capvolume").toInt()); + // set shutdown + ui_->valueShutdownTimer->setText("- - -"); + ui_->spinBoxShutdown->setValue(configuration_->getCSValue("DISCONNECTION_POWEROFF_MINS").toInt()); + // set disconnect + ui_->valueDisconnectTimer->setText("- - -"); + ui_->spinBoxDisconnect->setValue(configuration_->getCSValue("DISCONNECTION_SCREEN_POWEROFF_SECS").toInt()); + // set day/night + ui_->spinBoxDay->setValue(configuration_->getCSValue("RTC_DAY_START").toInt()); + ui_->spinBoxNight->setValue(configuration_->getCSValue("RTC_NIGHT_START").toInt()); + // set gpios + if (configuration_->getCSValue("ENABLE_GPIO") == "1") { + ui_->checkBoxGPIO->setChecked(true); + } else { + ui_->checkBoxGPIO->setChecked(false); + } + ui_->comboBoxDevMode->setCurrentText(configuration_->getCSValue("DEV_PIN")); + ui_->comboBoxInvert->setCurrentText(configuration_->getCSValue("INVERT_PIN")); + ui_->comboBoxX11->setCurrentText(configuration_->getCSValue("X11_PIN")); + ui_->comboBoxRearcam->setCurrentText(configuration_->getCSValue("REARCAM_PIN")); + ui_->comboBoxAndroid->setCurrentText(configuration_->getCSValue("ANDROID_PIN")); + // set mode + if (configuration_->getCSValue("START_X11") == "0") { + ui_->radioButtonEGL->setChecked(true); + } else { + ui_->radioButtonX11->setChecked(true); + } + // set rotation + if (configuration_->getCSValue("FLIP_SCREEN") == "0") { + ui_->radioButtonScreenNormal->setChecked(true); + } else { + ui_->radioButtonScreenRotated->setChecked(true); + } + + if (std::ifstream("/tmp/get_inputs")) { + QFile inputsFile(QString("/tmp/get_inputs")); + inputsFile.open(QIODevice::ReadOnly); + QTextStream data_return(&inputsFile); + QStringList inputs = data_return.readAll().split("\n"); + inputsFile.close(); + int cleaner = ui_->comboBoxPulseInput->count(); + while (cleaner > -1) { + ui_->comboBoxPulseInput->removeItem(cleaner); + cleaner--; + } + int indexin = inputs.count(); + int countin = 0; + while (countin < indexin - 1) { + ui_->comboBoxPulseInput->addItem(inputs[countin]); + countin++; + } + } + + if (std::ifstream("/tmp/get_outputs")) { + QFile outputsFile(QString("/tmp/get_outputs")); + outputsFile.open(QIODevice::ReadOnly); + QTextStream data_return(&outputsFile); + QStringList outputs = data_return.readAll().split("\n"); + outputsFile.close(); + int cleaner = ui_->comboBoxPulseOutput->count(); + while (cleaner > -1) { + ui_->comboBoxPulseOutput->removeItem(cleaner); + cleaner--; + } + int indexout = outputs.count(); + int countout = 0; + while (countout < indexout - 1) { + ui_->comboBoxPulseOutput->addItem(outputs[countout]); + countout++; + } + } + + ui_->comboBoxPulseOutput->setCurrentText(configuration_->readFileContent("/tmp/get_default_output")); + ui_->comboBoxPulseInput->setCurrentText(configuration_->readFileContent("/tmp/get_default_input")); + + if (std::ifstream("/tmp/timezone_listing")) { + QFile zoneFile(QString("/tmp/timezone_listing")); + zoneFile.open(QIODevice::ReadOnly); + QTextStream data_return(&zoneFile); + QStringList zones = data_return.readAll().split("\n"); + zoneFile.close(); + int cleaner = ui_->comboBoxTZ->count(); + while (cleaner > 0) { + ui_->comboBoxTZ->removeItem(cleaner); + cleaner--; + } + int indexout = zones.count(); + int countzone = 0; + while (countzone < indexout - 1) { + ui_->comboBoxTZ->addItem(zones[countzone]); + countzone++; + } + } + + // set rtc + QString rtcstring = configuration_->getParamFromFile("/boot/config.txt", "dtoverlay=i2c-rtc"); + if (rtcstring != "") { + QStringList rtc = rtcstring.split(","); + ui_->comboBoxHardwareRTC->setCurrentText(rtc[1].trimmed()); + // set timezone + ui_->comboBoxTZ->setCurrentText(configuration_->readFileContent("/etc/timezone")); + } else { + ui_->comboBoxHardwareRTC->setCurrentText("none"); + ui_->comboBoxTZ->setCurrentText(configuration_->readFileContent("/etc/timezone")); + } + + // set dac + QString dac = "Custom"; + if (getparams[4] == "allo-boss-dac-pcm512x-audio") { + dac = "Allo - Boss"; + } + if (getparams[4] == "allo-piano-dac-pcm512x-audio") { + dac = "Allo - Piano"; + } + if (getparams[4] == "iqaudio-dacplus") { + dac = "IQaudIO - Pi-DAC Plus/Pro/Zero"; + } + if (getparams[4] == "iqaudio-dacplus,unmute_amp") { + dac = "IQaudIO - Pi-Digi Amp Plus"; + } + if (getparams[4] == "iqaudio-dacplus,auto_mute_amp") { + dac = "IQaudIO - Pi-Digi Amp Plus - Automute"; + } + if (getparams[4] == "iqaudio-digi-wm8804-audio") { + dac = "IQaudIO - Pi-Digi Plus"; + } + if (getparams[4] == "audioinjector-wm8731-audio") { + dac = "Audioinjector - Zero/Stereo"; + } + if (getparams[4] == "hifiberry-dac") { + dac = "Hifiberry - DAC"; + } + if (getparams[4] == "hifiberry-dacplus") { + dac = "Hifiberry - DAC Plus"; + } + if (getparams[4] == "hifiberry-digi") { + dac = "Hifiberry - Digi"; + } + if (getparams[4] == "hifiberry-digi-pro") { + dac = "Hifiberry - Digi Pro"; + } + if (getparams[4] == "hifiberry-amp") { + dac = "Hifiberry - DAC Amp"; + } + if (getparams[4] == "audio") { + dac = "Raspberry Pi - Onboard"; + } + ui_->comboBoxHardwareDAC->setCurrentText(dac); + + // set shutdown disable + if (configuration_->getCSValue("DISCONNECTION_POWEROFF_DISABLE") == "1") { + ui_->checkBoxDisableShutdown->setChecked(true); + } else { + ui_->checkBoxDisableShutdown->setChecked(false); + } + + // set screen off disable + if (configuration_->getCSValue("DISCONNECTION_SCREEN_POWEROFF_DISABLE") == "1") { + ui_->checkBoxDisableScreenOff->setChecked(true); + } else { + ui_->checkBoxDisableScreenOff->setChecked(false); + } + + // set custom brightness command + if (configuration_->getCSValue("CUSTOM_BRIGHTNESS_COMMAND") != "") { + ui_->labelCustomBrightnessCommand->setText( + configuration_->getCSValue("CUSTOM_BRIGHTNESS_COMMAND") + " brvalue"); + } else { + ui_->labelCustomBrightnessCommand->setText("Disabled"); + } + + // set debug mode + if (configuration_->getCSValue("DEBUG_MODE") == "1") { + ui_->radioButtonDebugmodeEnabled->setChecked(true); + } else { + ui_->radioButtonDebugmodeDisabled->setChecked(true); + } + + // GPIO based shutdown + ui_->comboBoxGPIOShutdown->setCurrentText(configuration_->getCSValue("IGNITION_PIN")); + ui_->spinBoxGPIOShutdownDelay->setValue(configuration_->getCSValue("IGNITION_DELAY").toInt()); + + // Wifi Hotspot + if (configuration_->getCSValue("ENABLE_HOTSPOT") == "1") { + ui_->checkBoxHotspot->setChecked(true); + } else { + ui_->checkBoxHotspot->setChecked(false); + } + + // set cam + if (configuration_->getParamFromFile("/boot/config.txt", "start_x") == "1") { + ui_->comboBoxCam->setCurrentText("enabled"); + } else { + ui_->comboBoxCam->setCurrentText("disabled"); + } + if (configuration_->getCSValue("RPICAM_HFLIP") == "1") { + ui_->checkBoxFlipX->setChecked(true); + } else { + ui_->checkBoxFlipX->setChecked(false); + } + if (configuration_->getCSValue("RPICAM_VFLIP") == "1") { + ui_->checkBoxFlipY->setChecked(true); + } else { + ui_->checkBoxFlipY->setChecked(false); + } + ui_->comboBoxRotation->setCurrentText(configuration_->getCSValue("RPICAM_ROTATION")); + ui_->comboBoxResolution->setCurrentText(configuration_->getCSValue("RPICAM_RESOLUTION")); + ui_->comboBoxFPS->setCurrentText(configuration_->getCSValue("RPICAM_FPS")); + ui_->comboBoxAWB->setCurrentText(configuration_->getCSValue("RPICAM_AWB")); + ui_->comboBoxEXP->setCurrentText(configuration_->getCSValue("RPICAM_EXP")); + ui_->comboBoxLoopTime->setCurrentText(configuration_->getCSValue("RPICAM_LOOPTIME")); + ui_->comboBoxLoopCount->setCurrentText(configuration_->getCSValue("RPICAM_LOOPCOUNT")); + + if (configuration_->getCSValue("RPICAM_AUTORECORDING") == "1") { + ui_->checkBoxAutoRecording->setChecked(true); + } else { + ui_->checkBoxAutoRecording->setChecked(false); + } + + if (configuration_->getCSValue("USBCAM_USE") == "1") { + ui_->comboBoxUSBCam->setCurrentText("enabled"); + } else { + ui_->comboBoxUSBCam->setCurrentText("none"); + } + if (configuration_->getCSValue("USBCAM_ROTATION") == "1") { + ui_->comboBoxUSBRotation->setCurrentText("180"); + } else { + ui_->comboBoxUSBRotation->setCurrentText("0"); + } + if (configuration_->getCSValue("USBCAM_HFLIP") == "1") { + ui_->checkBoxFlipXUSB->setChecked(true); + } else { + ui_->checkBoxFlipXUSB->setChecked(false); + } + if (configuration_->getCSValue("USBCAM_VFLIP") == "1") { + ui_->checkBoxFlipYUSB->setChecked(true); + } else { + ui_->checkBoxFlipYUSB->setChecked(false); + } + + // set bluetooth + if (configuration_->getCSValue("ENABLE_BLUETOOTH") == "1") { + // check external bluetooth enabled + if (configuration_->getCSValue("EXTERNAL_BLUETOOTH") == "1") { + ui_->radioButtonUseExternalBluetoothAdapter->setChecked(true); + } else { + ui_->radioButtonUseLocalBluetoothAdapter->setChecked(true); + } + // mac + //ui_->lineEditExternalBluetoothAdapterAddress->setText(getparams[37]); + } else { + ui_->radioButtonDisableBluetooth->setChecked(true); + ui_->lineEditExternalBluetoothAdapterAddress->setText(""); + } + if (configuration_->getCSValue("ENABLE_PAIRABLE") == "1") { + ui_->checkBoxBluetoothAutoPair->setChecked(true); + } else { + ui_->checkBoxBluetoothAutoPair->setChecked(false); + } + // set bluetooth type + if (configuration_->getCSValue("ENABLE_BLUETOOTH") == "1") { + QString bt = configuration_->getParamFromFile("/boot/config.txt", "dtoverlay=pi3-disable-bt"); + if (bt.contains("pi3-disable-bt")) { + ui_->comboBoxBluetooth->setCurrentText("external"); + } else { + ui_->comboBoxBluetooth->setCurrentText("builtin"); + } + } else { + ui_->comboBoxBluetooth->setCurrentText("none"); + } + + // set lightsensor + if (std::ifstream("/etc/cs_lightsensor")) { + ui_->comboBoxLS->setCurrentIndex(1); + ui_->groupBoxSliderDay->hide(); + ui_->groupBoxSliderNight->hide(); + } else { + ui_->comboBoxLS->setCurrentIndex(0); + ui_->pushButtonTab9->hide(); + ui_->groupBoxSliderDay->show(); + ui_->groupBoxSliderNight->show(); + } + ui_->comboBoxDayNight->setCurrentText(configuration_->getCSValue("DAYNIGHT_PIN")); + if (configuration_->getCSValue("RTC_DAYNIGHT") == "1") { + ui_->checkBoxDisableDayNightRTC->setChecked(false); + } else { + ui_->checkBoxDisableDayNightRTC->setChecked(true); + } + QString theme = configuration_->getParamFromFile("/etc/plymouth/plymouthd.conf", "Theme"); + if (theme == "csnganimation") { + ui_->radioButtonAnimatedCSNG->setChecked(true); + } else if (theme == "crankshaft") { + ui_->radioButtonCSNG->setChecked(true); + } else if (theme == "custom") { + ui_->radioButtonCustom->setChecked(true); + } + // wifi country code + ui_->comboBoxCountryCode->setCurrentIndex( + ui_->comboBoxCountryCode->findText(configuration_->getCSValue("WIFI_COUNTRY"), + Qt::MatchFlag::MatchStartsWith)); + // set screen blank instead off + if (configuration_->getCSValue("SCREEN_POWEROFF_OVERRIDE") == "1") { + ui_->checkBoxBlankOnly->setChecked(true); + } else { + ui_->checkBoxBlankOnly->setChecked(false); + } + } + // update network info + updateNetworkInfo(); + } + + void SettingsWindow::onStartHotspot() { + ui_->label_modeswitchprogress->setText("Wait ..."); + ui_->clientNetworkSelect->hide(); + ui_->label_notavailable->show(); + ui_->radioButtonClient->setEnabled(0); + ui_->radioButtonHotspot->setEnabled(0); + ui_->lineEdit_wlan0->setText(""); + ui_->lineEditWifiSSID->setText(""); + ui_->pushButtonNetworkAuto->hide(); + qApp->processEvents(); + std::remove("/tmp/manual_hotspot_control"); + std::ofstream("/tmp/manual_hotspot_control"); + system("/opt/crankshaft/service_hotspot.sh start &"); + } + + void SettingsWindow::onStopHotspot() { + ui_->label_modeswitchprogress->setText("Wait ..."); + ui_->clientNetworkSelect->hide(); + ui_->label_notavailable->show(); + ui_->radioButtonClient->setEnabled(0); + ui_->radioButtonHotspot->setEnabled(0); + ui_->lineEdit_wlan0->setText(""); + ui_->lineEditWifiSSID->setText(""); + ui_->lineEditPassword->setText(""); + ui_->pushButtonNetworkAuto->hide(); + qApp->processEvents(); + system("/opt/crankshaft/service_hotspot.sh stop &"); + } + +#ifdef MAC_OS + void SettingsWindow::getMacMemoryInfo(QString& freeMemory) { + mach_port_t host_port; + vm_size_t page_size; + vm_statistics64_data_t vm_stats; + + host_port = mach_host_self(); + mach_msg_type_number_t count = HOST_VM_INFO64_COUNT; + host_page_size(host_port, &page_size); + if (host_statistics64(host_port, HOST_VM_INFO64, (host_info64_t)&vm_stats, &count) != KERN_SUCCESS) { + freeMemory = "Error in getting memory info"; + return; + } + + natural_t free_count = vm_stats.free_count; + uint64_t free_memory = (uint64_t)free_count * (uint64_t)page_size; + freeMemory = QString::number(free_memory / (1024 * 1024)) + " MB"; + } +#endif + + void SettingsWindow::updateSystemInfo() { +#ifdef MAC_OS + QString freeMem; + getMacMemoryInfo(freeMem); + ui_->valueSystemFreeMem->setText(freeMem); +#else + struct sysinfo info; + sysinfo(&info); + ui_->valueSystemFreeMem->setText(QString::number(info.freeram / 1024 / 1024) + " MB"); +#endif + + // current cpu speed + QString freq = configuration_->readFileContent("/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq"); + int currentfreq = freq.toInt() / 1000; + ui_->valueSystemCPUFreq->setText(QString::number(currentfreq) + "MHz"); + // current cpu temp + QString temp = configuration_->readFileContent("/sys/class/thermal/thermal_zone0/temp"); + int currenttemp = temp.toInt() / 1000; + ui_->valueSystemCPUTemp->setText(QString::number(currenttemp) + "°C"); + // get remaining times + QProcess process; + process.start("/bin/bash", + QStringList() << "-c" << "systemctl list-timers -all | grep disconnect | awk {'print $1'}"); + process.waitForFinished(-1); + QString stdout = process.readAllStandardOutput(); + if (stdout.simplified() != "n/a") { + process.start("/bin/bash", QStringList() << "-c" + << "systemctl list-timers -all | grep disconnect | awk {'print $5\" \"$6'}"); + process.waitForFinished(-1); + QString stdout = process.readAllStandardOutput(); + if (stdout.simplified() != "") { + ui_->valueDisconnectTimer->setText(stdout.simplified()); + } else { + ui_->valueDisconnectTimer->setText("Stopped"); + } + } else { + ui_->valueDisconnectTimer->setText("Stopped"); + } + process.start("/bin/bash", + QStringList() << "-c" << "systemctl list-timers -all | grep shutdown | awk {'print $1'}"); + process.waitForFinished(-1); + stdout = process.readAllStandardOutput(); + if (stdout.simplified() != "n/a") { + process.start("/bin/bash", QStringList() << "-c" + << "systemctl list-timers -all | grep shutdown | awk {'print $5\" \"$6'}"); + process.waitForFinished(-1); + QString stdout = process.readAllStandardOutput(); + if (stdout.simplified() != "") { + ui_->valueShutdownTimer->setText(stdout.simplified()); + } else { + ui_->valueShutdownTimer->setText("Stopped"); + } + } else { + ui_->valueShutdownTimer->setText("Stopped"); + } + } + + void SettingsWindow::show_tab1() { + ui_->tab2->hide(); + ui_->tab3->hide(); + ui_->tab4->hide(); + ui_->tab5->hide(); + ui_->tab6->hide(); + ui_->tab7->hide(); + ui_->tab8->hide(); + ui_->tab9->hide(); + ui_->tab1->show(); + } + + void SettingsWindow::show_tab2() { + ui_->tab1->hide(); + ui_->tab3->hide(); + ui_->tab4->hide(); + ui_->tab5->hide(); + ui_->tab6->hide(); + ui_->tab7->hide(); + ui_->tab8->hide(); + ui_->tab9->hide(); + ui_->tab2->show(); + } + + void SettingsWindow::show_tab3() { + ui_->tab1->hide(); + ui_->tab2->hide(); + ui_->tab4->hide(); + ui_->tab5->hide(); + ui_->tab6->hide(); + ui_->tab7->hide(); + ui_->tab8->hide(); + ui_->tab9->hide(); + ui_->tab3->show(); + } + + void SettingsWindow::show_tab4() { + ui_->tab1->hide(); + ui_->tab2->hide(); + ui_->tab3->hide(); + ui_->tab5->hide(); + ui_->tab6->hide(); + ui_->tab7->hide(); + ui_->tab8->hide(); + ui_->tab9->hide(); + ui_->tab4->show(); + } + + void SettingsWindow::show_tab5() { + ui_->tab1->hide(); + ui_->tab2->hide(); + ui_->tab3->hide(); + ui_->tab4->hide(); + ui_->tab6->hide(); + ui_->tab7->hide(); + ui_->tab8->hide(); + ui_->tab9->hide(); + ui_->tab5->show(); + } + + void SettingsWindow::show_tab6() { + ui_->tab1->hide(); + ui_->tab2->hide(); + ui_->tab3->hide(); + ui_->tab4->hide(); + ui_->tab5->hide(); + ui_->tab7->hide(); + ui_->tab8->hide(); + ui_->tab9->hide(); + ui_->tab6->show(); + } + + void SettingsWindow::show_tab7() { + ui_->tab1->hide(); + ui_->tab2->hide(); + ui_->tab3->hide(); + ui_->tab4->hide(); + ui_->tab5->hide(); + ui_->tab6->hide(); + ui_->tab8->hide(); + ui_->tab9->hide(); + ui_->tab7->show(); + } + + void SettingsWindow::show_tab8() { + ui_->tab1->hide(); + ui_->tab2->hide(); + ui_->tab3->hide(); + ui_->tab4->hide(); + ui_->tab5->hide(); + ui_->tab6->hide(); + ui_->tab7->hide(); + ui_->tab9->hide(); + ui_->tab8->show(); + } + + void SettingsWindow::show_tab9() { + ui_->tab1->hide(); + ui_->tab2->hide(); + ui_->tab3->hide(); + ui_->tab4->hide(); + ui_->tab5->hide(); + ui_->tab6->hide(); + ui_->tab7->hide(); + ui_->tab8->hide(); + ui_->tab9->show(); + } + + } } + } } -void f1x::openauto::autoapp::ui::SettingsWindow::on_pushButtonNetwork0_clicked() -{ - ui_->lineEdit_wlan0->setText(""); - ui_->lineEditWifiSSID->setText(""); - ui_->lineEditPassword->setText(""); - qApp->processEvents(); - system("/usr/local/bin/crankshaft network 0 >/dev/null 2>&1 &"); +void f1x::openauto::autoapp::ui::SettingsWindow::on_pushButtonAudioTest_clicked() { + ui_->labelTestInProgress->show(); + ui_->pushButtonAudioTest->hide(); + qApp->processEvents(); + system("/usr/local/bin/crankshaft audio test"); + ui_->pushButtonAudioTest->show(); + ui_->labelTestInProgress->hide(); +} + +void f1x::openauto::autoapp::ui::SettingsWindow::updateNetworkInfo() { + if (std::ifstream("/tmp/samba_running")) { + ui_->labelSambaStatus->setText("running"); + if (ui_->pushButtonSambaStart->isVisible() == true) { + ui_->pushButtonSambaStart->hide(); + ui_->pushButtonSambaStop->show(); + } + } else { + ui_->labelSambaStatus->setText("stopped"); + if (ui_->pushButtonSambaStop->isVisible() == true) { + ui_->pushButtonSambaStop->hide(); + ui_->pushButtonSambaStart->show(); + } + } + + if (!std::ifstream("/tmp/mode_change_progress")) { + QNetworkInterface eth0if = QNetworkInterface::interfaceFromName("eth0"); + if (eth0if.flags().testFlag(QNetworkInterface::IsUp)) { + QList entrieseth0 = eth0if.addressEntries(); + if (!entrieseth0.isEmpty()) { + QNetworkAddressEntry eth0 = entrieseth0.first(); + //qDebug() << "eth0: " << eth0.ip(); + ui_->lineEdit_eth0->setText(eth0.ip().toString()); + } + } else { + //qDebug() << "eth0: down"; + ui_->lineEdit_eth0->setText("interface down"); + } + + QNetworkInterface wlan0if = QNetworkInterface::interfaceFromName("wlan0"); + if (wlan0if.flags().testFlag(QNetworkInterface::IsUp)) { + QList entrieswlan0 = wlan0if.addressEntries(); + if (!entrieswlan0.isEmpty()) { + QNetworkAddressEntry wlan0 = entrieswlan0.first(); + //qDebug() << "wlan0: " << wlan0.ip(); + ui_->lineEdit_wlan0->setText(wlan0.ip().toString()); + } + } else { + //qDebug() << "wlan0: down"; + ui_->lineEdit_wlan0->setText("interface down"); + } + + if (std::ifstream("/tmp/hotspot_active")) { + ui_->radioButtonClient->setEnabled(1); + ui_->radioButtonHotspot->setEnabled(1); + ui_->radioButtonHotspot->setChecked(1); + ui_->radioButtonClient->setChecked(0); + ui_->label_modeswitchprogress->setText("Ok"); + ui_->lineEditWifiSSID->setText(configuration_->getParamFromFile("/etc/hostapd/hostapd.conf", "ssid")); + ui_->lineEditPassword->show(); + ui_->label_password->show(); + ui_->lineEditPassword->setText(configuration_->getParamFromFile("/etc/hostapd/hostapd.conf", "wpa_passphrase")); + ui_->clientNetworkSelect->hide(); + ui_->pushButtonNetworkAuto->hide(); + ui_->label_notavailable->show(); + } else { + ui_->radioButtonClient->setEnabled(1); + ui_->radioButtonHotspot->setEnabled(1); + ui_->radioButtonHotspot->setChecked(0); + ui_->radioButtonClient->setChecked(1); + ui_->label_modeswitchprogress->setText("Ok"); + ui_->lineEditWifiSSID->setText(configuration_->readFileContent("/tmp/wifi_ssid")); + ui_->lineEditPassword->hide(); + ui_->label_password->hide(); + ui_->lineEditPassword->setText(""); + ui_->clientNetworkSelect->show(); + ui_->label_notavailable->hide(); + ui_->pushButtonNetworkAuto->show(); + + if (!std::ifstream("/boot/crankshaft/network1.conf")) { + ui_->pushButtonNetwork1->hide(); + ui_->pushButtonNetwork0->show(); + } + if (!std::ifstream("/boot/crankshaft/network0.conf")) { + ui_->pushButtonNetwork1->hide(); + ui_->pushButtonNetwork0->setText(configuration_->getCSValue("WIFI2_SSID")); + } + if (!std::ifstream("/boot/crankshaft/network0.conf") && !std::ifstream("/boot/crankshaft/network1.conf")) { + ui_->pushButtonNetwork0->hide(); + ui_->pushButtonNetwork1->hide(); + ui_->pushButtonNetworkAuto->hide(); + ui_->label_notavailable->show(); + } + } + } +} + +void f1x::openauto::autoapp::ui::SettingsWindow::on_pushButtonNetwork0_clicked() { + ui_->lineEdit_wlan0->setText(""); + ui_->lineEditWifiSSID->setText(""); + ui_->lineEditPassword->setText(""); + qApp->processEvents(); + system("/usr/local/bin/crankshaft network 0 >/dev/null 2>&1 &"); } -void f1x::openauto::autoapp::ui::SettingsWindow::on_pushButtonNetwork1_clicked() -{ - ui_->lineEdit_wlan0->setText(""); - ui_->lineEditWifiSSID->setText(""); - ui_->lineEditPassword->setText(""); - qApp->processEvents(); - system("/usr/local/bin/crankshaft network 1 >/dev/null 2>&1 &"); +void f1x::openauto::autoapp::ui::SettingsWindow::on_pushButtonNetwork1_clicked() { + ui_->lineEdit_wlan0->setText(""); + ui_->lineEditWifiSSID->setText(""); + ui_->lineEditPassword->setText(""); + qApp->processEvents(); + system("/usr/local/bin/crankshaft network 1 >/dev/null 2>&1 &"); } -void f1x::openauto::autoapp::ui::SettingsWindow::keyPressEvent(QKeyEvent *event) -{ - if(event->key() == Qt::Key_Escape) - { - f1x::openauto::autoapp::ui::SettingsWindow::close(); - } - if (event->key() == Qt::Key_Return) { - QApplication::postEvent (QApplication::focusWidget(), new QKeyEvent ( QEvent::KeyPress, Qt::Key_Space, Qt::NoModifier)); - QApplication::postEvent (QApplication::focusWidget(), new QKeyEvent ( QEvent::KeyRelease, Qt::Key_Space, Qt::NoModifier)); - } - if (event->key() == Qt::Key_1) { - QApplication::postEvent (QApplication::focusWidget(), new QKeyEvent ( QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier)); - } - if (event->key() == Qt::Key_2) { - QApplication::postEvent (QApplication::focusWidget(), new QKeyEvent ( QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier)); - } +void f1x::openauto::autoapp::ui::SettingsWindow::keyPressEvent(QKeyEvent *event) { + if (event->key() == Qt::Key_Escape) { + f1x::openauto::autoapp::ui::SettingsWindow::close(); + } + if (event->key() == Qt::Key_Return) { + QApplication::postEvent(QApplication::focusWidget(), + new QKeyEvent(QEvent::KeyPress, Qt::Key_Space, Qt::NoModifier)); + QApplication::postEvent(QApplication::focusWidget(), + new QKeyEvent(QEvent::KeyRelease, Qt::Key_Space, Qt::NoModifier)); + } + if (event->key() == Qt::Key_1) { + QApplication::postEvent(QApplication::focusWidget(), + new QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier)); + } + if (event->key() == Qt::Key_2) { + QApplication::postEvent(QApplication::focusWidget(), new QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier)); + } } diff --git a/src/autoapp/UI/dialog.cpp b/src/autoapp/UI/dialog.cpp new file mode 100644 index 0000000..3510a1d --- /dev/null +++ b/src/autoapp/UI/dialog.cpp @@ -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; +} diff --git a/src/autoapp/UI/dialog.h b/src/autoapp/UI/dialog.h new file mode 100644 index 0000000..17537d1 --- /dev/null +++ b/src/autoapp/UI/dialog.h @@ -0,0 +1,22 @@ +#ifndef DIALOG_H +#define DIALOG_H + +#include + +namespace Ui { +class Dialog; +} + +class Dialog : public QDialog +{ + Q_OBJECT + +public: + explicit Dialog(QWidget *parent = nullptr); + ~Dialog(); + +private: + Ui::Dialog *ui; +}; + +#endif // DIALOG_H diff --git a/src/autoapp/UI/dialog.ui b/src/autoapp/UI/dialog.ui new file mode 100644 index 0000000..6444956 --- /dev/null +++ b/src/autoapp/UI/dialog.ui @@ -0,0 +1,68 @@ + + + Dialog + + + + 0 + 0 + 400 + 300 + + + + Dialog + + + + + 30 + 240 + 341 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + buttonBox + accepted() + Dialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + Dialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/autoapp/UI/journey.cpp b/src/autoapp/UI/journey.cpp new file mode 100644 index 0000000..9f52ef5 --- /dev/null +++ b/src/autoapp/UI/journey.cpp @@ -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; +} diff --git a/src/autoapp/UI/journey.h b/src/autoapp/UI/journey.h new file mode 100644 index 0000000..d63b684 --- /dev/null +++ b/src/autoapp/UI/journey.h @@ -0,0 +1,22 @@ +#ifndef JOURNEY_H +#define JOURNEY_H + +#include + +namespace Ui { +class journey; +} + +class journey : public QMainWindow +{ + Q_OBJECT + +public: + explicit journey(QWidget *parent = nullptr); + ~journey(); + +private: + Ui::journey *ui; +}; + +#endif // JOURNEY_H diff --git a/src/autoapp/UI/journey.ui b/src/autoapp/UI/journey.ui new file mode 100644 index 0000000..052073d --- /dev/null +++ b/src/autoapp/UI/journey.ui @@ -0,0 +1,31 @@ + + + journey + + + + 0 + 0 + 800 + 600 + + + + MainWindow + + + + + + 0 + 0 + 800 + 24 + + + + + + + + diff --git a/src/autoapp/autoapp.cpp b/src/autoapp/autoapp.cpp index 6493abb..43095ce 100644 --- a/src/autoapp/autoapp.cpp +++ b/src/autoapp/autoapp.cpp @@ -38,7 +38,8 @@ #include #include -namespace aasdk = aasdk; +//namespace aap_protobuf = aap_protobuf; +//namespace aasdk = aasdk; namespace autoapp = f1x::openauto::autoapp; using ThreadPool = std::vector; From 406368d8dd06d073244a02f33a313b3cc86448ce Mon Sep 17 00:00:00 2001 From: Simon Dean Date: Fri, 8 Nov 2024 12:55:54 +0000 Subject: [PATCH 03/14] Populate WifiProjectionStatus.cpp, NavigationStatusService.cpp --- .../NavigationStatusService.hpp | 4 +- src/autoapp/Service/AndroidAutoEntity.cpp | 66 ++++++++-------- .../Service/AndroidAutoEntityFactory.cpp | 76 +++++++++---------- .../NavigationStatusService.cpp | 14 ++++ src/autoapp/Service/ServiceFactory.cpp | 2 - .../WifiProjection/WifiProjectionStatus.cpp | 15 +++- 6 files changed, 98 insertions(+), 79 deletions(-) diff --git a/include/f1x/openauto/autoapp/Service/NavigationStatus/NavigationStatusService.hpp b/include/f1x/openauto/autoapp/Service/NavigationStatus/NavigationStatusService.hpp index 8c026e5..2019675 100644 --- a/include/f1x/openauto/autoapp/Service/NavigationStatus/NavigationStatusService.hpp +++ b/include/f1x/openauto/autoapp/Service/NavigationStatus/NavigationStatusService.hpp @@ -46,6 +46,9 @@ namespace f1x { void onChannelError(const aasdk::error::Error &e) override; + void NavigationStatusService::onStatusUpdate(const aap_protobuf::channel::navigation::event::NavigationStatus &navStatus) override; + void NavigationStatusService::onTurnEvent(const aap_protobuf::channel::navigation::event::NavigationNextTurnEvent &turnEvent) override; + void NavigationStatusService::onDistanceEvent(const aap_protobuf::service::navigation::message::NavigationNextTurnDistanceEvent &distanceEvent) override; private: using std::enable_shared_from_this::shared_from_this; @@ -53,7 +56,6 @@ namespace f1x { boost::asio::io_service::strand strand_; aasdk::channel::navigationstatus::NavigationStatusService::Pointer channel_; }; - } } } diff --git a/src/autoapp/Service/AndroidAutoEntity.cpp b/src/autoapp/Service/AndroidAutoEntity.cpp index 700813a..ee486f3 100644 --- a/src/autoapp/Service/AndroidAutoEntity.cpp +++ b/src/autoapp/Service/AndroidAutoEntity.cpp @@ -28,28 +28,28 @@ /* * HU > MD Version Request - * HU < MD ServiceDiscoveryRequest - * HU > MD Car MetaData (Make, Model, year etc) - * HU < MD when Video Projection starts, it MUST be shown without User Ineraction - * HU < MD Prompt Use to Enable and Pair with Car - * HU < MD Request Video Focus for Projection (HU Grant) + * HU < MD ServiceDiscoveryRequest ** + * HU > MD Car MetaData (Make, Model, year etc) ** + * HU < MD when Video Projection starts, it MUST be shown without User Ineraction *********** + * HU < MD Prompt Use to Enable and Pair with Car *********** + * HU < MD Request Video Focus for Projection (HU Grant) *********** * - * AAP neds Bluetooth HFP for Telephone + * AAP needs Bluetooth HFP for Telephone * - * HU > MD Bluetooth Announcement (HU MAC Address, Supported Pairing Methods) - * HU < MD Bluetooth Pairing Request - * HU > MD Bluetoth Pairing Response + * HU > MD Bluetooth Announcement (HU MAC Address, Supported Pairing Methods) *********** + * HU < MD Bluetooth Pairing Request *********** + * HU > MD Bluetoth Pairing Response*********** * * AfterPairing, HU can request the Bluetooth PhoneBookAccessProtocol. Sensible UI. * - * HU < MD connect to Bluetooth HFP - * HU Suppress BAP or MAP while AAP connected. - * A2DP should be treated by OEM as another such such as a USB stick or radio. If the user plays music via AA, HU should grant request from AA to change focus to AA. HU manages connectivity. - * MD connects to HU and routes call over Bluetooth (non Bluetooth call) - * MD connects Blueooth call and display projection mode - * MD on call to HFP device - MD continues call, disconnects from other HFP and connects to HFP on Vehicle. - * AA only uses HFP, hhowever HU may use MAP, PBAP, PAN and RSAP - * MD will reconnect when required. + * HU < MD connect to Bluetooth HFP*********** + * HU Suppress BAP or MAP while AAP connected.*********** + * A2DP should be treated by OEM as another such such as a USB stick or radio. If the user plays music via AA, HU should grant request from AA to change focus to AA. HU manages connectivity., *********** + * MD connects to HU and routes call over Bluetooth (non Bluetooth call) *********** + * MD connects Blueooth call and display projection mode *********** + * MD on call to HFP device - MD continues call, disconnects from other HFP and connects to HFP on Vehicle. *********** + * AA only uses HFP, hhowever HU may use MAP, PBAP, PAN and RSAP *********** + * MD will reconnect when required. *********** * * Video * HU < MD - During Service Discovery, MD requests Video Configs supported @@ -103,13 +103,13 @@ namespace f1x { eventHandler_ = eventHandler; std::for_each(serviceList_.begin(), serviceList_.end(), std::bind(&IService::start, std::placeholders::_1)); - OPENAUTO_LOG(info) << "[AndroidAutoEntity] Event handlers added."; + auto versionRequestPromise = aasdk::channel::SendPromise::defer(strand_); - versionRequestPromise->then([]() {}, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), + versionRequestPromise->then([]() { OPENAUTO_LOG(info) << "[AndroidAutoEntity] SUCCESS: Version request sent."; }, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), std::placeholders::_1)); - OPENAUTO_LOG(info) << "[AndroidAutoEntity] Sending version request."; + OPENAUTO_LOG(info) << "[AndroidAutoEntity] Send Version Request."; controlServiceChannel_->sendVersionRequest(std::move(versionRequestPromise)); controlServiceChannel_->receive(this->shared_from_this()); }); @@ -123,7 +123,7 @@ namespace f1x { eventHandler_ = nullptr; std::for_each(serviceList_.begin(), serviceList_.end(), std::bind(&IService::stop, std::placeholders::_1)); - //pinger_->cancel(); + messenger_->stop(); transport_->stop(); cryptor_->deinit(); @@ -172,11 +172,11 @@ namespace f1x { OPENAUTO_LOG(info) << "[AndroidAutoEntity] Version matches."; try { - OPENAUTO_LOG(info) << "[AndroidAutoEntity] Beginning SSL handshake..."; + 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(), + handshakePromise->then([]() { OPENAUTO_LOG(info) << "[AndroidAutoEntity] SUCCESS: Sent SSL handshake."; }, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), std::placeholders::_1)); controlServiceChannel_->sendHandshake(cryptor_->readHandshakeBuffer(), std::move(handshakePromise)); controlServiceChannel_->receive(this->shared_from_this()); @@ -246,7 +246,7 @@ namespace f1x { std::bind(&IService::fillFeatures, std::placeholders::_1, std::ref(serviceDiscoveryResponse))); auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() {}, + promise->then([]() { OPENAUTO_LOG(info) << "[AndroidAutoEntity] SUCCESS: Send ServiceDiscoveryResponse."; }, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), std::placeholders::_1)); controlServiceChannel_->sendServiceDiscoveryResponse(serviceDiscoveryResponse, std::move(promise)); controlServiceChannel_->receive(this->shared_from_this()); @@ -271,8 +271,8 @@ namespace f1x { 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)); + promise->then([]() { OPENAUTO_LOG(info) "[AndroidAutoEntity] Resolved Promise"; }, + [capture0 = this->shared_from_this()](auto && PH1) { OPENAUTO_LOG(info) "[AndroidAutoEntity] Failed to Resolve Promise"; capture0->onChannelError(std::forward(PH1)); }); controlServiceChannel_->sendAudioFocusResponse(response, std::move(promise)); controlServiceChannel_->receive(this->shared_from_this()); } @@ -312,16 +312,15 @@ namespace f1x { controlServiceChannel_->receive(this->shared_from_this()); } + void AndroidAutoEntity::onBatteryStatusNotification(const aap_protobuf::channel::control::BatteryStatusNotification ¬ification) { + OPENAUTO_LOG(info) << "[AndroidAutoEntity] onBatteryStatusNotification()"; + 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()); + controlServiceChannel_->receive(this->shared_from_this()); } void AndroidAutoEntity::onPingResponse(const aap_protobuf::channel::control::ping::PingResponse &response) { @@ -373,7 +372,6 @@ namespace f1x { request.set_timestamp(timestamp.count()); controlServiceChannel_->sendPingRequest(request, std::move(promise)); } - } } } diff --git a/src/autoapp/Service/AndroidAutoEntityFactory.cpp b/src/autoapp/Service/AndroidAutoEntityFactory.cpp index 9f0ace8..fd7391b 100644 --- a/src/autoapp/Service/AndroidAutoEntityFactory.cpp +++ b/src/autoapp/Service/AndroidAutoEntityFactory.cpp @@ -28,53 +28,47 @@ #include #include -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace service -{ +namespace f1x { + namespace openauto { + namespace autoapp { + namespace service { -AndroidAutoEntityFactory::AndroidAutoEntityFactory(boost::asio::io_service& ioService, - configuration::IConfiguration::Pointer configuration, - IServiceFactory& serviceFactory) - : ioService_(ioService) - , configuration_(std::move(configuration)) - , serviceFactory_(serviceFactory) -{ + AndroidAutoEntityFactory::AndroidAutoEntityFactory(boost::asio::io_service &ioService, + configuration::IConfiguration::Pointer configuration, + IServiceFactory &serviceFactory) + : ioService_(ioService), configuration_(std::move(configuration)), serviceFactory_(serviceFactory) { -} + } -IAndroidAutoEntity::Pointer AndroidAutoEntityFactory::create(aasdk::usb::IAOAPDevice::Pointer aoapDevice) -{ - auto transport(std::make_shared(ioService_, std::move(aoapDevice))); - return create(std::move(transport)); -} + IAndroidAutoEntity::Pointer AndroidAutoEntityFactory::create(aasdk::usb::IAOAPDevice::Pointer aoapDevice) { + auto transport(std::make_shared(ioService_, std::move(aoapDevice))); + return create(std::move(transport)); + } -IAndroidAutoEntity::Pointer AndroidAutoEntityFactory::create(aasdk::tcp::ITCPEndpoint::Pointer tcpEndpoint) -{ - auto transport(std::make_shared(ioService_, std::move(tcpEndpoint))); - return create(std::move(transport)); -} + IAndroidAutoEntity::Pointer AndroidAutoEntityFactory::create(aasdk::tcp::ITCPEndpoint::Pointer tcpEndpoint) { + auto transport(std::make_shared(ioService_, std::move(tcpEndpoint))); + return create(std::move(transport)); + } -IAndroidAutoEntity::Pointer AndroidAutoEntityFactory::create(aasdk::transport::ITransport::Pointer transport) -{ - auto sslWrapper(std::make_shared()); - auto cryptor(std::make_shared(std::move(sslWrapper))); - cryptor->init(); + IAndroidAutoEntity::Pointer AndroidAutoEntityFactory::create(aasdk::transport::ITransport::Pointer transport) { + auto sslWrapper(std::make_shared()); + auto cryptor(std::make_shared(std::move(sslWrapper))); + cryptor->init(); - auto messenger(std::make_shared(ioService_, - std::make_shared(ioService_, transport, cryptor), - std::make_shared(ioService_, transport, cryptor))); + auto messenger(std::make_shared(ioService_, + std::make_shared( + ioService_, transport, cryptor), + std::make_shared( + ioService_, transport, cryptor))); - auto serviceList = serviceFactory_.create(messenger); - auto pinger(std::make_shared(ioService_, 5000)); - return std::make_shared(ioService_, std::move(cryptor), std::move(transport), std::move(messenger), configuration_, std::move(serviceList), std::move(pinger)); -} + auto serviceList = serviceFactory_.create(messenger); + auto pinger(std::make_shared(ioService_, 5000)); + return std::make_shared(ioService_, std::move(cryptor), std::move(transport), + std::move(messenger), configuration_, std::move(serviceList), + std::move(pinger)); + } -} -} -} + } + } + } } diff --git a/src/autoapp/Service/NavigationStatus/NavigationStatusService.cpp b/src/autoapp/Service/NavigationStatus/NavigationStatusService.cpp index 3f5dec8..44f2dc6 100644 --- a/src/autoapp/Service/NavigationStatus/NavigationStatusService.cpp +++ b/src/autoapp/Service/NavigationStatus/NavigationStatusService.cpp @@ -85,6 +85,20 @@ namespace f1x { channel_->receive(this->shared_from_this()); } + void NavigationStatusService::onStatusUpdate(const aap_protobuf::channel::navigation::event::NavigationStatus &navStatus) { + channel_->receive(this->shared_from_this()); + } + + + void NavigationStatusService::onTurnEvent(const aap_protobuf::channel::navigation::event::NavigationNextTurnEvent &turnEvent) { + channel_->receive(this->shared_from_this()); + } + + void NavigationStatusService::onDistanceEvent(const aap_protobuf::service::navigation::message::NavigationNextTurnDistanceEvent &distanceEvent) { + channel_->receive(this->shared_from_this()); + } + + void NavigationStatusService::onChannelError(const aasdk::error::Error &e) { OPENAUTO_LOG(error) << "[NavigationStatusService] onChannelError(): " << e.what(); } diff --git a/src/autoapp/Service/ServiceFactory.cpp b/src/autoapp/Service/ServiceFactory.cpp index b7c2b3c..87c96e0 100644 --- a/src/autoapp/Service/ServiceFactory.cpp +++ b/src/autoapp/Service/ServiceFactory.cpp @@ -60,8 +60,6 @@ namespace f1x { } - // TODO: MEDIA SERVICE - ServiceList ServiceFactory::create(aasdk::messenger::IMessenger::Pointer messenger) { OPENAUTO_LOG(info) << "[ServiceFactory] create()"; ServiceList serviceList; diff --git a/src/autoapp/Service/WifiProjection/WifiProjectionStatus.cpp b/src/autoapp/Service/WifiProjection/WifiProjectionStatus.cpp index 56b91a9..4cca3f9 100644 --- a/src/autoapp/Service/WifiProjection/WifiProjectionStatus.cpp +++ b/src/autoapp/Service/WifiProjection/WifiProjectionStatus.cpp @@ -71,8 +71,21 @@ namespace f1x { void WifiProjectionService::onWifiCredentialsRequest( const aap_protobuf::service::wifiprojection::message::WifiCredentialsRequest &request) { + + aap_protobuf::service::wifiprojection::message::WifiCredentialsResponse response; + + response.set_access_point_type(aap_protobuf::service::wifiprojection::message::AccessPointType::DYNAMIC); + response.set_car_wifi_password("1234567890"); + response.set_car_wifi_ssid("CRANKSHAFT-NG"); + response.set_car_wifi_security_mode(aap_protobuf::service::wifiprojection::message::WifiSecurityMode::WPA2_PERSONAL); + OPENAUTO_LOG(info) << "[WifiProjectionService] onWifiCredentialsRequest()"; - // channel_->sendWifiCredentialsResponse(response, std::move(promise)); + + auto promise = aasdk::channel::SendPromise::defer(strand_); + promise->then([]() {}, std::bind(&WifiProjectionService::onChannelError, this->shared_from_this(), + std::placeholders::_1)); + channel_->sendWifiCredentialsResponse(response, std::move(promise)); + channel_->receive(this->shared_from_this()); } From 4e36ff016fb5718221b7f9984dc13f38e555b435 Mon Sep 17 00:00:00 2001 From: Simon Dean Date: Fri, 8 Nov 2024 12:56:38 +0000 Subject: [PATCH 04/14] Add logo for forked version --- assets/journey.jpg | Bin 0 -> 95089 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 assets/journey.jpg diff --git a/assets/journey.jpg b/assets/journey.jpg new file mode 100644 index 0000000000000000000000000000000000000000..8051d95474684c3df7b71b8d62bacfa0311a1ae0 GIT binary patch literal 95089 zcmeFa2Ut`~lRrFU36itqoS7kKB!db_k|Yv_G~^s42}lMJkRTvYGKeB55=D}Lh~yjx zBuEs2A%AC3@AbX!-F1Y9*(*fU>PyrWn5D|#*9tczl63cK!yQlzKHU4O& z^1YSgKeqC8bCU4%gjq_MLj|A^QE?GoA#sQpuaJe6IIp>gxd^X?mAQ~0Sin+H6e<9W zMd0*<9Orj(=I;MAD4)5zyOo;<%-P8u=zyp5qk|x_!_^)98S zdDsFIaWaQF@If8SVUB!uE><=`R}iU%wWS3J=4ftX#s8xY58VQ0X>tB{!kGjqfJpHP zhzTx}5)%?rkdac-2{6*p(9lWq@UaM}UA=K#<*KsMO(S=Un|hA7l$0$atsK4mfSX5k6 zTJ^HJ=GE)kH+An?+uA!i-*@%rC$fmp(7Atgh{R-Tk(=e}FhVLe2|0 z&!5NN&Wi|`7b-eB8aftoUMQ&E$cYo7V=zK6iRHAg%w0*C1cEP-$|vN$Xu)O{)ZQku zaO=k*XAzob-9b+6VrKubiG}>Xn%N%{`*U6sAUre_VDZq1K(Zh>M_x4O|DW%B0xle& zylUQR~dxv^q=Fztt#!*7i8s?VXN;WHyL$yAlCOj$S-`|peR9<~@LY2zvenSjylt^?jB z=R6V}zNBK=>uNz{ox4TWk|H{JH9B&&T6LSM6-jTrs7glQ*9LuqFHgY{lR2d~13b7B z_C8fW^KP4{`*d7a^vlSjo}#Is^6=~WXW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nov 2024 12:25:09 +0000 Subject: [PATCH 05/14] Compiles and Builds, but problems with Video, WiFi Projection and Bluetooth. --- cmake_modules/Findaap_protobuf.cmake | 8 +- cmake_modules/Findlibusb-1.0.cmake | 8 +- include/f1x/openauto/Common/Log.hpp | 3 +- .../autoapp/Configuration/Configuration.hpp | 26 +- .../autoapp/Configuration/IConfiguration.hpp | 16 +- .../autoapp/Projection/IInputDevice.hpp | 2 +- .../autoapp/Projection/IVideoOutput.hpp | 8 +- .../autoapp/Projection/InputEvent.hpp | 8 +- .../Projection/LocalBluetoothDevice.hpp | 1 - .../autoapp/Projection/VideoOutput.hpp | 4 +- .../autoapp/Service/AndroidAutoEntity.hpp | 17 +- .../Service/Bluetooth/BluetoothService.hpp | 6 +- .../GenericNotificationService.hpp | 4 +- .../f1x/openauto/autoapp/Service/IService.hpp | 4 +- .../InputSource/InputSourceService.hpp | 8 +- .../MediaBrowser/MediaBrowserService.hpp | 4 +- .../MediaPlaybackStatusService.hpp | 4 +- .../MediaSink/AudioMediaSinkService.hpp | 10 +- .../MediaSink/VideoMediaSinkService.hpp | 12 +- .../MediaSource/MediaSourceService.hpp | 8 +- .../NavigationStatusService.hpp | 10 +- .../PhoneStatus/PhoneStatusService.hpp | 4 +- .../autoapp/Service/Radio/RadioService.hpp | 4 +- .../autoapp/Service/Sensor/SensorService.hpp | 6 +- .../f1x/openauto/autoapp/Service/Service.hpp | 2 +- .../VendorExtensionService.hpp | 4 +- .../WifiProjection/WifiProjectionService.hpp | 4 +- .../openauto/autoapp/UI/SettingsWindow.hpp | 2 +- .../btservice/AndroidBluetoothServer.hpp | 3 + src/autoapp/Configuration/Configuration.cpp | 114 +++---- src/autoapp/Projection/InputDevice.cpp | 48 +-- .../Projection/LocalBluetoothDevice.cpp | 52 +-- src/autoapp/Projection/QtVideoOutput.cpp | 1 + src/autoapp/Projection/VideoOutput.cpp | 54 ++- src/autoapp/Service/AndroidAutoEntity.cpp | 99 ++++-- .../Service/Bluetooth/BluetoothService.cpp | 27 +- .../GenericNotificationService.cpp | 6 +- .../InputSource/InputSourceService.cpp | 18 +- .../MediaBrowser/MediaBrowserService.cpp | 6 +- .../MediaPlaybackStatusService.cpp | 6 +- .../MediaSink/AudioMediaSinkService.cpp | 37 ++- .../MediaSink/VideoMediaSinkService.cpp | 44 ++- .../MediaSource/MediaSourceService.cpp | 19 +- .../NavigationStatusService.cpp | 12 +- .../PhoneStatus/PhoneStatusService.cpp | 6 +- src/autoapp/Service/Radio/RadioService.cpp | 6 +- src/autoapp/Service/Sensor/SensorService.cpp | 47 +-- src/autoapp/Service/ServiceFactory.cpp | 8 +- .../VendorExtensionService.cpp | 6 +- .../WifiProjection/WifiProjectionStatus.cpp | 6 +- src/autoapp/UI/SettingsWindow.cpp | 90 ++--- src/autoapp/UI/assets/journey.jpg | Bin 0 -> 95089 bytes src/autoapp/UI/journey.cpp | 14 - src/autoapp/UI/journey.h | 22 -- src/autoapp/UI/journey.ui | 31 -- src/btservice/AndroidBluetoothServer.cpp | 308 +++++++++--------- src/btservice/AndroidBluetoothService.cpp | 30 +- src/btservice/btservice.cpp | 56 ++-- 58 files changed, 649 insertions(+), 724 deletions(-) create mode 100644 src/autoapp/UI/assets/journey.jpg delete mode 100644 src/autoapp/UI/journey.cpp delete mode 100644 src/autoapp/UI/journey.h delete mode 100644 src/autoapp/UI/journey.ui diff --git a/cmake_modules/Findaap_protobuf.cmake b/cmake_modules/Findaap_protobuf.cmake index 56a29b1..7e2eda8 100644 --- a/cmake_modules/Findaap_protobuf.cmake +++ b/cmake_modules/Findaap_protobuf.cmake @@ -1,11 +1,11 @@ if (AAP_PROTOBUF_LIB_DIRS AND AAP_PROTOBUF_INCLUDE_DIRS) # in cache already - message(STATUS "aap_protobuf cached") + message(STATUS "aap_protobuf is 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 + channel/control/GalConstants.pb.h PATHS /usr/include /usr/local/include @@ -37,7 +37,7 @@ else (AAP_PROTOBUF_LIB_DIRS AND AAP_PROTOBUF_INCLUDE_DIRS) endif (AAP_PROTOBUF_INCLUDE_DIRS AND AAP_PROTOBUF_LIB_DIRS) if (AAP_PROTOBUF_FOUND) - message(STATUS "Found aap_protobuf:") + message(STATUS "SUCCESS. Found: aap_protobuf:") message(STATUS " - Includes: ${AAP_PROTOBUF_INCLUDE_DIRS}") message(STATUS " - Libraries: ${AAP_PROTOBUF_LIB_DIRS}") add_library(aap_protobuf INTERFACE) @@ -46,7 +46,7 @@ else (AAP_PROTOBUF_LIB_DIRS AND AAP_PROTOBUF_INCLUDE_DIRS) 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") + message(FATAL_ERROR "Could not locate aap_protobuf") endif (AAP_PROTOBUF_FOUND) # show the AAP_PROTOBUF_INCLUDE_DIRS and AAP_PROTOBUF_LIB_DIRS variables only in the advanced view diff --git a/cmake_modules/Findlibusb-1.0.cmake b/cmake_modules/Findlibusb-1.0.cmake index 80f52dc..311cbc1 100644 --- a/cmake_modules/Findlibusb-1.0.cmake +++ b/cmake_modules/Findlibusb-1.0.cmake @@ -49,7 +49,7 @@ if (LIBUSB_1_LIBRARIES AND LIBUSB_1_INCLUDE_DIRS) else (LIBUSB_1_LIBRARIES AND LIBUSB_1_INCLUDE_DIRS) find_path(LIBUSB_1_INCLUDE_DIR NAMES - libusb.h + libusb.h PATHS /usr/include /usr/local/include @@ -90,12 +90,12 @@ else (LIBUSB_1_LIBRARIES AND LIBUSB_1_INCLUDE_DIRS) target_link_libraries(libusb INTERFACE ${LIBUSB_1_LIBRARY}) endif (NOT libusb_1_FIND_QUIETLY) else (LIBUSB_1_FOUND) - if (libusb_1_FIND_REQUIRED) + if (libusb-1.0_FIND_REQUIRED) message(FATAL_ERROR "Could not find libusb") - endif (libusb_1_FIND_REQUIRED) + endif (libusb-1.0_FIND_REQUIRED) endif (LIBUSB_1_FOUND) # show the LIBUSB_1_INCLUDE_DIRS and LIBUSB_1_LIBRARIES variables only in the advanced view mark_as_advanced(LIBUSB_1_INCLUDE_DIRS LIBUSB_1_LIBRARIES) -endif (LIBUSB_1_LIBRARIES AND LIBUSB_1_INCLUDE_DIRS) \ No newline at end of file +endif (LIBUSB_1_LIBRARIES AND LIBUSB_1_INCLUDE_DIRS) diff --git a/include/f1x/openauto/Common/Log.hpp b/include/f1x/openauto/Common/Log.hpp index 4215961..91fd0df 100644 --- a/include/f1x/openauto/Common/Log.hpp +++ b/include/f1x/openauto/Common/Log.hpp @@ -20,4 +20,5 @@ #include -#define OPENAUTO_LOG(severity) BOOST_LOG_TRIVIAL(severity) << "[OpenAuto] " +#define OPENAUTO_LOG_CONTEXT "" //"(" << typeid(*this).name() << "::" << __func__ << ")" +#define OPENAUTO_LOG(severity) BOOST_LOG_TRIVIAL(severity) << "[OpenAuto] " << OPENAUTO_LOG_CONTEXT diff --git a/include/f1x/openauto/autoapp/Configuration/Configuration.hpp b/include/f1x/openauto/autoapp/Configuration/Configuration.hpp index e077135..e7d760f 100644 --- a/include/f1x/openauto/autoapp/Configuration/Configuration.hpp +++ b/include/f1x/openauto/autoapp/Configuration/Configuration.hpp @@ -89,10 +89,10 @@ public: QString readFileContent(QString fileName) const override; QString getParamFromFile(QString fileName, QString searchString) const override; - aap_protobuf::service::media::shared::message::VideoFrameRateType getVideoFPS() const override; - void setVideoFPS(aap_protobuf::service::media::shared::message::VideoFrameRateType value) override; - aap_protobuf::service::media::shared::message::VideoCodecResolutionType getVideoResolution() const override; - void setVideoResolution(aap_protobuf::service::media::shared::message::VideoCodecResolutionType value) override; + aap_protobuf::service::media::sink::message::VideoFrameRateType getVideoFPS() const override; + void setVideoFPS(aap_protobuf::service::media::sink::message::VideoFrameRateType value) override; + aap_protobuf::service::media::sink::message::VideoCodecResolutionType getVideoResolution() const override; + void setVideoResolution(aap_protobuf::service::media::sink::message::VideoCodecResolutionType value) override; size_t getScreenDPI() const override; void setScreenDPI(size_t value) override; void setOMXLayerIndex(int32_t value) override; @@ -125,7 +125,7 @@ public: void setAudioOutputBackendType(AudioOutputBackendType value) override; private: void readButtonCodes(boost::property_tree::ptree& iniConfig); - void insertButtonCode(boost::property_tree::ptree& iniConfig, const std::string& buttonCodeKey, aap_protobuf::service::media::sink::KeyCode buttonCode); + void insertButtonCode(boost::property_tree::ptree& iniConfig, const std::string& buttonCodeKey, aap_protobuf::service::media::sink::message::KeyCode buttonCode); void writeButtonCodes(boost::property_tree::ptree& iniConfig); HandednessOfTrafficType handednessOfTrafficType_; @@ -148,8 +148,8 @@ private: bool showAutoPlay_; bool instantPlay_; - aap_protobuf::service::media::shared::message::VideoFrameRateType videoFPS_; - aap_protobuf::service::media::shared::message::VideoCodecResolutionType videoResolution_; + aap_protobuf::service::media::sink::message::VideoFrameRateType videoFPS_; + aap_protobuf::service::media::sink::message::VideoCodecResolutionType videoResolution_; size_t screenDPI_; int32_t omxLayerIndex_; QRect videoMargins_; @@ -196,14 +196,10 @@ private: static const std::string cVideoMarginWidth; static const std::string cVideoMarginHeight; - struct Audio { - struct Channel { - static const std::string cMediaEnabled; - static const std::string cGuidanceEnabled; - static const std::string cSystemEnabled; - static const std::string cTelephonyEnabled; - }; - }; + static const std::string cAudioChannelMediaEnabled; + static const std::string cAudioChannelGuidanceEnabled; + static const std::string cAudioChannelSystemEnabled; + static const std::string cAudioChannelTelephonyEnabled; static const std::string cAudioOutputBackendType; diff --git a/include/f1x/openauto/autoapp/Configuration/IConfiguration.hpp b/include/f1x/openauto/autoapp/Configuration/IConfiguration.hpp index a34678a..091eecb 100644 --- a/include/f1x/openauto/autoapp/Configuration/IConfiguration.hpp +++ b/include/f1x/openauto/autoapp/Configuration/IConfiguration.hpp @@ -20,9 +20,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include #include @@ -40,7 +40,7 @@ class IConfiguration { public: typedef std::shared_ptr Pointer; - typedef std::vector ButtonCodes; + typedef std::vector ButtonCodes; virtual ~IConfiguration() = default; @@ -92,10 +92,10 @@ public: virtual QString readFileContent(QString fileName) const = 0; virtual QString getParamFromFile(QString fileName, QString searchString) const = 0; - virtual aap_protobuf::service::media::shared::message::VideoFrameRateType getVideoFPS() const = 0; - virtual void setVideoFPS(aap_protobuf::service::media::shared::message::VideoFrameRateType value) = 0; - virtual aap_protobuf::service::media::shared::message::VideoCodecResolutionType getVideoResolution() const = 0; - virtual void setVideoResolution(aap_protobuf::service::media::shared::message::VideoCodecResolutionType value) = 0; + virtual aap_protobuf::service::media::sink::message::VideoFrameRateType getVideoFPS() const = 0; + virtual void setVideoFPS(aap_protobuf::service::media::sink::message::VideoFrameRateType value) = 0; + virtual aap_protobuf::service::media::sink::message::VideoCodecResolutionType getVideoResolution() const = 0; + virtual void setVideoResolution(aap_protobuf::service::media::sink::message::VideoCodecResolutionType value) = 0; virtual size_t getScreenDPI() const = 0; virtual void setScreenDPI(size_t value) = 0; virtual void setOMXLayerIndex(int32_t value) = 0; diff --git a/include/f1x/openauto/autoapp/Projection/IInputDevice.hpp b/include/f1x/openauto/autoapp/Projection/IInputDevice.hpp index dc97b2c..2e6aee3 100644 --- a/include/f1x/openauto/autoapp/Projection/IInputDevice.hpp +++ b/include/f1x/openauto/autoapp/Projection/IInputDevice.hpp @@ -37,7 +37,7 @@ class IInputDevice { public: typedef std::shared_ptr Pointer; - typedef std::vector ButtonCodes; + typedef std::vector ButtonCodes; virtual ~IInputDevice() = default; virtual void start(IInputDeviceEventHandler& eventHandler) = 0; diff --git a/include/f1x/openauto/autoapp/Projection/IVideoOutput.hpp b/include/f1x/openauto/autoapp/Projection/IVideoOutput.hpp index 668c329..ab93288 100644 --- a/include/f1x/openauto/autoapp/Projection/IVideoOutput.hpp +++ b/include/f1x/openauto/autoapp/Projection/IVideoOutput.hpp @@ -22,8 +22,8 @@ #include #include #include -#include -#include +#include +#include namespace f1x { @@ -47,8 +47,8 @@ public: virtual void write(aasdk::messenger::Timestamp::ValueType timestamp, const aasdk::common::DataConstBuffer& buffer) = 0; virtual void stop() = 0; - virtual aap_protobuf::service::media::shared::message::VideoFrameRateType getVideoFPS() const = 0; - virtual aap_protobuf::service::media::shared::message::VideoCodecResolutionType getVideoResolution() const = 0; + virtual aap_protobuf::service::media::sink::message::VideoFrameRateType getVideoFPS() const = 0; + virtual aap_protobuf::service::media::sink::message::VideoCodecResolutionType getVideoResolution() const = 0; virtual size_t getScreenDPI() const = 0; virtual QRect getVideoMargins() const = 0; diff --git a/include/f1x/openauto/autoapp/Projection/InputEvent.hpp b/include/f1x/openauto/autoapp/Projection/InputEvent.hpp index a5c39d0..c0cda35 100644 --- a/include/f1x/openauto/autoapp/Projection/InputEvent.hpp +++ b/include/f1x/openauto/autoapp/Projection/InputEvent.hpp @@ -18,8 +18,8 @@ #pragma once -#include -#include +#include +#include #include namespace f1x @@ -49,12 +49,12 @@ struct ButtonEvent { ButtonEventType type; WheelDirection wheelDirection; - aap_protobuf::service::media::sink::KeyCode code; + aap_protobuf::service::media::sink::message::KeyCode code; }; struct TouchEvent { - aap_protobuf::service::input::message::PointerAction type; + aap_protobuf::service::inputsource::message::PointerAction type; uint32_t x; uint32_t y; uint32_t pointerId; diff --git a/include/f1x/openauto/autoapp/Projection/LocalBluetoothDevice.hpp b/include/f1x/openauto/autoapp/Projection/LocalBluetoothDevice.hpp index c8677cb..68bc416 100644 --- a/include/f1x/openauto/autoapp/Projection/LocalBluetoothDevice.hpp +++ b/include/f1x/openauto/autoapp/Projection/LocalBluetoothDevice.hpp @@ -65,7 +65,6 @@ private: QBluetoothServiceInfo serviceInfo_; std::unique_ptr rfcommServer_; - void onClientConnected(); }; } diff --git a/include/f1x/openauto/autoapp/Projection/VideoOutput.hpp b/include/f1x/openauto/autoapp/Projection/VideoOutput.hpp index 098fae3..3b6965c 100644 --- a/include/f1x/openauto/autoapp/Projection/VideoOutput.hpp +++ b/include/f1x/openauto/autoapp/Projection/VideoOutput.hpp @@ -35,8 +35,8 @@ class VideoOutput: public IVideoOutput public: VideoOutput(configuration::IConfiguration::Pointer configuration); - aap_protobuf::service::media::shared::message::VideoFrameRateType getVideoFPS() const override; - aap_protobuf::service::media::shared::message::VideoCodecResolutionType getVideoResolution() const override; + aap_protobuf::service::media::sink::message::VideoFrameRateType getVideoFPS() const override; + aap_protobuf::service::media::sink::message::VideoCodecResolutionType getVideoResolution() const override; size_t getScreenDPI() const override; QRect getVideoMargins() const override; diff --git a/include/f1x/openauto/autoapp/Service/AndroidAutoEntity.hpp b/include/f1x/openauto/autoapp/Service/AndroidAutoEntity.hpp index 19acce9..b44d839 100644 --- a/include/f1x/openauto/autoapp/Service/AndroidAutoEntity.hpp +++ b/include/f1x/openauto/autoapp/Service/AndroidAutoEntity.hpp @@ -56,14 +56,15 @@ public: // TODO: on channel open request... on channel close... on navigation focus, on voice session notification, on user switch, on call availability, on service disc update, on battery status, on car connected devices void onVersionResponse(uint16_t majorCode, uint16_t minorCode, aap_protobuf::shared::MessageStatus status) override; void onHandshake(const aasdk::common::DataConstBuffer& payload) override; - void onServiceDiscoveryRequest(const aap_protobuf::channel::control::servicediscovery::event::ServiceDiscoveryRequest& request) override; - void onAudioFocusRequest(const aap_protobuf::channel::control::focus::audio::event::AudioFocusRequest& request) override; - void onByeByeRequest(const aap_protobuf::channel::control::byebye::event::ByeByeRequest& request) override; - void onByeByeResponse(const aap_protobuf::channel::control::byebye::notification::ByeByeResponse& response) override; - void onNavigationFocusRequest(const aap_protobuf::channel::control::focus::navigation::event::NavFocusRequestNotification& request) override; - void onVoiceSessionRequest(const aap_protobuf::channel::control::voice::VoiceSessionNotification &request) override; - void onPingResponse(const aap_protobuf::channel::control::ping::PingResponse& response) override; - void onPingRequest(const aap_protobuf::channel::control::ping::PingRequest& request) override; + void onServiceDiscoveryRequest(const aap_protobuf::service::control::message::ServiceDiscoveryRequest& request) override; + void onAudioFocusRequest(const aap_protobuf::service::control::message::AudioFocusRequest& request) override; + void onByeByeRequest(const aap_protobuf::service::control::message::ByeByeRequest& request) override; + void onByeByeResponse(const aap_protobuf::service::control::message::ByeByeResponse& response) override; + void onNavigationFocusRequest(const aap_protobuf::service::control::message::NavFocusRequestNotification& request) override; + void onVoiceSessionRequest(const aap_protobuf::service::control::message::VoiceSessionNotification &request) override; + void onBatteryStatusNotification(const aap_protobuf::service::control::message::BatteryStatusNotification ¬ification) override; + void onPingResponse(const aap_protobuf::service::control::message::PingResponse& response) override; + void onPingRequest(const aap_protobuf::service::control::message::PingRequest& request) override; void onChannelError(const aasdk::error::Error& e) override; private: diff --git a/include/f1x/openauto/autoapp/Service/Bluetooth/BluetoothService.hpp b/include/f1x/openauto/autoapp/Service/Bluetooth/BluetoothService.hpp index b6bd3fa..cda49bb 100644 --- a/include/f1x/openauto/autoapp/Service/Bluetooth/BluetoothService.hpp +++ b/include/f1x/openauto/autoapp/Service/Bluetooth/BluetoothService.hpp @@ -41,12 +41,12 @@ namespace f1x { void stop() override; void pause() override; void resume() override; - void fillFeatures(aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) override; + void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; - void onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) override; + void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override; void onBluetoothPairingRequest( - const aap_protobuf::channel::bluetooth::event::BluetoothPairingRequest &request) override; + const aap_protobuf::service::bluetooth::message::BluetoothPairingRequest &request) override; void onChannelError(const aasdk::error::Error &e) override; diff --git a/include/f1x/openauto/autoapp/Service/GenericNotification/GenericNotificationService.hpp b/include/f1x/openauto/autoapp/Service/GenericNotification/GenericNotificationService.hpp index b4a9da5..1162e23 100644 --- a/include/f1x/openauto/autoapp/Service/GenericNotification/GenericNotificationService.hpp +++ b/include/f1x/openauto/autoapp/Service/GenericNotification/GenericNotificationService.hpp @@ -40,9 +40,9 @@ namespace f1x { void stop() override; void pause() override; void resume() override; - void fillFeatures(aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) override; + void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; - void onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) override; + void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override; void onChannelError(const aasdk::error::Error &e) override; diff --git a/include/f1x/openauto/autoapp/Service/IService.hpp b/include/f1x/openauto/autoapp/Service/IService.hpp index 5a8a91a..9731894 100644 --- a/include/f1x/openauto/autoapp/Service/IService.hpp +++ b/include/f1x/openauto/autoapp/Service/IService.hpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include namespace f1x @@ -44,7 +44,7 @@ public: virtual void stop() = 0; virtual void pause() = 0; virtual void resume() = 0; - virtual void fillFeatures(aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse& response) = 0; + virtual void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse& response) = 0; }; typedef std::vector ServiceList; diff --git a/include/f1x/openauto/autoapp/Service/InputSource/InputSourceService.hpp b/include/f1x/openauto/autoapp/Service/InputSource/InputSourceService.hpp index a612c26..4309ce1 100644 --- a/include/f1x/openauto/autoapp/Service/InputSource/InputSourceService.hpp +++ b/include/f1x/openauto/autoapp/Service/InputSource/InputSourceService.hpp @@ -18,7 +18,7 @@ #pragma once -#include +#include #include #include #include @@ -43,12 +43,12 @@ namespace f1x { void stop() override; void pause() override; void resume() override; - void fillFeatures(aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) override; + void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; - void onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) override; + void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override; - void onKeyBindingRequest(const aap_protobuf::channel::input::event::KeyBindingRequest &request) override; + void onKeyBindingRequest(const aap_protobuf::service::media::sink::message::KeyBindingRequest &request) override; void onChannelError(const aasdk::error::Error &e) override; diff --git a/include/f1x/openauto/autoapp/Service/MediaBrowser/MediaBrowserService.hpp b/include/f1x/openauto/autoapp/Service/MediaBrowser/MediaBrowserService.hpp index e2455b9..b013a97 100644 --- a/include/f1x/openauto/autoapp/Service/MediaBrowser/MediaBrowserService.hpp +++ b/include/f1x/openauto/autoapp/Service/MediaBrowser/MediaBrowserService.hpp @@ -40,9 +40,9 @@ namespace f1x { void stop() override; void pause() override; void resume() override; - void fillFeatures(aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) override; + void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; - void onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) override; + void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override; void onChannelError(const aasdk::error::Error &e) override; diff --git a/include/f1x/openauto/autoapp/Service/MediaPlaybackStatus/MediaPlaybackStatusService.hpp b/include/f1x/openauto/autoapp/Service/MediaPlaybackStatus/MediaPlaybackStatusService.hpp index c4d543b..923a9fb 100644 --- a/include/f1x/openauto/autoapp/Service/MediaPlaybackStatus/MediaPlaybackStatusService.hpp +++ b/include/f1x/openauto/autoapp/Service/MediaPlaybackStatus/MediaPlaybackStatusService.hpp @@ -40,9 +40,9 @@ namespace f1x { void stop() override; void pause() override; void resume() override; - void fillFeatures(aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) override; + void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; - void onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) override; + void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override; void onChannelError(const aasdk::error::Error &e) override; diff --git a/include/f1x/openauto/autoapp/Service/MediaSink/AudioMediaSinkService.hpp b/include/f1x/openauto/autoapp/Service/MediaSink/AudioMediaSinkService.hpp index b46f1ea..aa8ae9c 100644 --- a/include/f1x/openauto/autoapp/Service/MediaSink/AudioMediaSinkService.hpp +++ b/include/f1x/openauto/autoapp/Service/MediaSink/AudioMediaSinkService.hpp @@ -44,18 +44,18 @@ namespace f1x { void stop() override; void pause() override; void resume() override; - void fillFeatures(aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) override; + void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; - void onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) override; + void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override; void onMediaChannelSetupRequest( - const aap_protobuf::channel::media::event::Setup &request) override; + const aap_protobuf::service::media::shared::message::Setup &request) override; void onMediaChannelStartIndication( - const aap_protobuf::channel::media::event::Start &indication) override; + const aap_protobuf::service::media::shared::message::Start &indication) override; void onMediaChannelStopIndication( - const aap_protobuf::channel::media::event::Stop &indication) override; + const aap_protobuf::service::media::shared::message::Stop &indication) override; void onMediaWithTimestampIndication(aasdk::messenger::Timestamp::ValueType timestamp, const aasdk::common::DataConstBuffer &buffer) override; diff --git a/include/f1x/openauto/autoapp/Service/MediaSink/VideoMediaSinkService.hpp b/include/f1x/openauto/autoapp/Service/MediaSink/VideoMediaSinkService.hpp index 11a05e0..13ebb34 100644 --- a/include/f1x/openauto/autoapp/Service/MediaSink/VideoMediaSinkService.hpp +++ b/include/f1x/openauto/autoapp/Service/MediaSink/VideoMediaSinkService.hpp @@ -46,18 +46,18 @@ namespace f1x { void stop() override; void pause() override; void resume() override; - void fillFeatures(aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) override; + void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; - void onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) override; + void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override; void onMediaChannelSetupRequest( - const aap_protobuf::channel::media::event::Setup &request) override; + const aap_protobuf::service::media::shared::message::Setup &request) override; void onMediaChannelStartIndication( - const aap_protobuf::channel::media::event::Start &indication) override; + const aap_protobuf::service::media::shared::message::Start &indication) override; void onMediaChannelStopIndication( - const aap_protobuf::channel::media::event::Stop &indication) override; + const aap_protobuf::service::media::shared::message::Stop &indication) override; void onMediaWithTimestampIndication(aasdk::messenger::Timestamp::ValueType timestamp, const aasdk::common::DataConstBuffer &buffer) override; @@ -66,7 +66,7 @@ namespace f1x { void onChannelError(const aasdk::error::Error &e) override; - void onVideoFocusRequest(const aap_protobuf::channel::control::focus::video::event::VideoFocusRequestNotification &request) override; + void onVideoFocusRequest(const aap_protobuf::service::media::video::message::VideoFocusRequestNotification &request) override; void sendVideoFocusIndication(); protected: using std::enable_shared_from_this::shared_from_this; diff --git a/include/f1x/openauto/autoapp/Service/MediaSource/MediaSourceService.hpp b/include/f1x/openauto/autoapp/Service/MediaSource/MediaSourceService.hpp index 9f2600f..917c068 100644 --- a/include/f1x/openauto/autoapp/Service/MediaSource/MediaSourceService.hpp +++ b/include/f1x/openauto/autoapp/Service/MediaSource/MediaSourceService.hpp @@ -55,18 +55,18 @@ namespace service void resume() override; void fillFeatures( - aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) override; + aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; - void onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) override; + void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override; void onMediaChannelSetupRequest( - const aap_protobuf::channel::media::event::Setup &request) override; + const aap_protobuf::service::media::shared::message::Setup &request) override; void onMediaSourceOpenRequest( const aap_protobuf::service::media::source::message::MicrophoneRequest &request) override; void onMediaChannelAckIndication( - const aap_protobuf::service::media::source::message::MediaSourceMediaAckIndication &indication) override; + const aap_protobuf::service::media::source::message::Ack &indication) override; void onChannelError(const aasdk::error::Error &e) override; diff --git a/include/f1x/openauto/autoapp/Service/NavigationStatus/NavigationStatusService.hpp b/include/f1x/openauto/autoapp/Service/NavigationStatus/NavigationStatusService.hpp index 2019675..8f37b5a 100644 --- a/include/f1x/openauto/autoapp/Service/NavigationStatus/NavigationStatusService.hpp +++ b/include/f1x/openauto/autoapp/Service/NavigationStatus/NavigationStatusService.hpp @@ -40,15 +40,15 @@ namespace f1x { void stop() override; void pause() override; void resume() override; - void fillFeatures(aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) override; + void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; - void onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) override; + void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override; void onChannelError(const aasdk::error::Error &e) override; - void NavigationStatusService::onStatusUpdate(const aap_protobuf::channel::navigation::event::NavigationStatus &navStatus) override; - void NavigationStatusService::onTurnEvent(const aap_protobuf::channel::navigation::event::NavigationNextTurnEvent &turnEvent) override; - void NavigationStatusService::onDistanceEvent(const aap_protobuf::service::navigation::message::NavigationNextTurnDistanceEvent &distanceEvent) override; + void onStatusUpdate(const aap_protobuf::service::navigationstatus::message::NavigationStatus &navStatus) override; + void onTurnEvent(const aap_protobuf::service::navigationstatus::message::NavigationNextTurnEvent &turnEvent) override; + void onDistanceEvent(const aap_protobuf::service::navigationstatus::message::NavigationNextTurnDistanceEvent &distanceEvent) override; private: using std::enable_shared_from_this::shared_from_this; diff --git a/include/f1x/openauto/autoapp/Service/PhoneStatus/PhoneStatusService.hpp b/include/f1x/openauto/autoapp/Service/PhoneStatus/PhoneStatusService.hpp index a5b5f2e..289b4ee 100644 --- a/include/f1x/openauto/autoapp/Service/PhoneStatus/PhoneStatusService.hpp +++ b/include/f1x/openauto/autoapp/Service/PhoneStatus/PhoneStatusService.hpp @@ -40,9 +40,9 @@ namespace f1x { void stop() override; void pause() override; void resume() override; - void fillFeatures(aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) override; + void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; - void onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) override; + void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override; void onChannelError(const aasdk::error::Error &e) override; diff --git a/include/f1x/openauto/autoapp/Service/Radio/RadioService.hpp b/include/f1x/openauto/autoapp/Service/Radio/RadioService.hpp index 305b591..ba698d9 100644 --- a/include/f1x/openauto/autoapp/Service/Radio/RadioService.hpp +++ b/include/f1x/openauto/autoapp/Service/Radio/RadioService.hpp @@ -40,9 +40,9 @@ namespace f1x { void stop() override; void pause() override; void resume() override; - void fillFeatures(aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) override; + void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; - void onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) override; + void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override; void onChannelError(const aasdk::error::Error &e) override; diff --git a/include/f1x/openauto/autoapp/Service/Sensor/SensorService.hpp b/include/f1x/openauto/autoapp/Service/Sensor/SensorService.hpp index de2b10a..3e2f855 100644 --- a/include/f1x/openauto/autoapp/Service/Sensor/SensorService.hpp +++ b/include/f1x/openauto/autoapp/Service/Sensor/SensorService.hpp @@ -45,12 +45,12 @@ namespace f1x { void stop() override; void pause() override; void resume() override; - void fillFeatures(aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) override; + void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; - void onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) override; + void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override; void onSensorStartRequest( - const aap_protobuf::channel::sensor::event::SensorRequest &request) override; + const aap_protobuf::service::sensorsource::message::SensorRequest &request) override; void onChannelError(const aasdk::error::Error &e) override; diff --git a/include/f1x/openauto/autoapp/Service/Service.hpp b/include/f1x/openauto/autoapp/Service/Service.hpp index e406e48..7157f2b 100644 --- a/include/f1x/openauto/autoapp/Service/Service.hpp +++ b/include/f1x/openauto/autoapp/Service/Service.hpp @@ -40,7 +40,7 @@ namespace f1x { void resume() override; - void fillFeatures(aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) override; + void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; private: diff --git a/include/f1x/openauto/autoapp/Service/VendorExtension/VendorExtensionService.hpp b/include/f1x/openauto/autoapp/Service/VendorExtension/VendorExtensionService.hpp index dea205b..88db0eb 100644 --- a/include/f1x/openauto/autoapp/Service/VendorExtension/VendorExtensionService.hpp +++ b/include/f1x/openauto/autoapp/Service/VendorExtension/VendorExtensionService.hpp @@ -40,9 +40,9 @@ namespace f1x { void stop() override; void pause() override; void resume() override; - void fillFeatures(aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) override; + void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; - void onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) override; + void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override; void onChannelError(const aasdk::error::Error &e) override; diff --git a/include/f1x/openauto/autoapp/Service/WifiProjection/WifiProjectionService.hpp b/include/f1x/openauto/autoapp/Service/WifiProjection/WifiProjectionService.hpp index 242448a..322732e 100644 --- a/include/f1x/openauto/autoapp/Service/WifiProjection/WifiProjectionService.hpp +++ b/include/f1x/openauto/autoapp/Service/WifiProjection/WifiProjectionService.hpp @@ -40,9 +40,9 @@ namespace f1x { void stop() override; void pause() override; void resume() override; - void fillFeatures(aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) override; + void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; - void onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) override; + void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override; void onChannelError(const aasdk::error::Error &e) override; diff --git a/include/f1x/openauto/autoapp/UI/SettingsWindow.hpp b/include/f1x/openauto/autoapp/UI/SettingsWindow.hpp index b91be8f..03d7dbc 100644 --- a/include/f1x/openauto/autoapp/UI/SettingsWindow.hpp +++ b/include/f1x/openauto/autoapp/UI/SettingsWindow.hpp @@ -102,7 +102,7 @@ private: void load(); void loadButtonCheckBoxes(); void saveButtonCheckBoxes(); - void saveButtonCheckBox(const QCheckBox* checkBox, configuration::IConfiguration::ButtonCodes& buttonCodes, aap_protobuf::service::media::sink::KeyCode buttonCode); + void saveButtonCheckBox(const QCheckBox* checkBox, configuration::IConfiguration::ButtonCodes& buttonCodes, aap_protobuf::service::media::sink::message::KeyCode buttonCode); void setButtonCheckBoxes(bool value); Ui::SettingsWindow* ui_; diff --git a/include/f1x/openauto/btservice/AndroidBluetoothServer.hpp b/include/f1x/openauto/btservice/AndroidBluetoothServer.hpp index 4eb540b..2ecfd5b 100644 --- a/include/f1x/openauto/btservice/AndroidBluetoothServer.hpp +++ b/include/f1x/openauto/btservice/AndroidBluetoothServer.hpp @@ -24,6 +24,9 @@ #include #include #include +#include +#include +#include namespace f1x { diff --git a/src/autoapp/Configuration/Configuration.cpp b/src/autoapp/Configuration/Configuration.cpp index 63e7908..a62a845 100644 --- a/src/autoapp/Configuration/Configuration.cpp +++ b/src/autoapp/Configuration/Configuration.cpp @@ -60,10 +60,10 @@ const std::string Configuration::cVideoOMXLayerIndexKey = "Video.OMXLayerIndex"; const std::string Configuration::cVideoMarginWidth = "Video.MarginWidth"; const std::string Configuration::cVideoMarginHeight = "Video.MarginHeight"; -const std::string Configuration::Audio::Channel::cMediaEnabled = "Audio.Channel.MediaEnabled"; -const std::string Configuration::Audio::Channel::cGuidanceEnabled = "Audio.Channel.GuidanceEnabled"; -const std::string Configuration::Audio::Channel::cSystemEnabled = "Audio.Channel.SystemEnabled"; -const std::string Configuration::Audio::Channel::cTelephonyEnabled = "Audio.Channel.TelephonyEnabled"; +const std::string Configuration::cAudioChannelMediaEnabled = "AudioChannel.MediaEnabled"; +const std::string Configuration::cAudioChannelGuidanceEnabled = "AudioChannel.GuidanceEnabled"; +const std::string Configuration::cAudioChannelSystemEnabled = "AudioChannel.SystemEnabled"; +const std::string Configuration::cAudioChannelTelephonyEnabled = "AudioChannel.TelephonyEnabled"; const std::string Configuration::cAudioOutputBackendType = "Audio.OutputBackendType"; @@ -123,11 +123,11 @@ void Configuration::load() showAutoPlay_ = iniConfig.get(cGeneralShowAutoPlayKey, false); instantPlay_ = iniConfig.get(cGeneralInstantPlayKey, false); - videoFPS_ = static_cast(iniConfig.get(cVideoFPSKey, - aap_protobuf::service::media::shared::message::VideoFrameRateType::VIDEO_FPS_30)); + videoFPS_ = static_cast(iniConfig.get(cVideoFPSKey, + aap_protobuf::service::media::sink::message::VideoFrameRateType::VIDEO_FPS_30)); - videoResolution_ = static_cast(iniConfig.get(cVideoResolutionKey, - aap_protobuf::service::media::shared::message::VideoCodecResolutionType::VIDEO_800x480)); + videoResolution_ = static_cast(iniConfig.get(cVideoResolutionKey, + aap_protobuf::service::media::sink::message::VideoCodecResolutionType::VIDEO_800x480)); screenDPI_ = iniConfig.get(cVideoScreenDPIKey, 140); omxLayerIndex_ = iniConfig.get(cVideoOMXLayerIndexKey, 1); @@ -142,10 +142,10 @@ void Configuration::load() bluetoothRemoteAdapterAddress_ = iniConfig.get(cBluetoothRemoteAdapterAddressKey, ""); - _audioChannelEnabledMedia = iniConfig.get(Audio::Channel::cMediaEnabled, true); - _audioChannelEnabledGuidance = iniConfig.get(Audio::Channel::cGuidanceEnabled, true); - _audioChannelEnabledSystem = iniConfig.get(Audio::Channel::cSystemEnabled, true); - _audioChannelEnabledTelephony = iniConfig.get(Audio::Channel::cTelephonyEnabled, true); + _audioChannelEnabledMedia = iniConfig.get(cAudioChannelMediaEnabled, true); + _audioChannelEnabledGuidance = iniConfig.get(cAudioChannelGuidanceEnabled, true); + _audioChannelEnabledSystem = iniConfig.get(cAudioChannelSystemEnabled, true); + _audioChannelEnabledTelephony = iniConfig.get(cAudioChannelTelephonyEnabled, true); audioOutputBackendType_ = static_cast(iniConfig.get(cAudioOutputBackendType, static_cast(AudioOutputBackendType::RTAUDIO))); } @@ -178,8 +178,8 @@ void Configuration::reset() mp3AutoPlay_ = false; showAutoPlay_ = false; instantPlay_ = false; - videoFPS_ = aap_protobuf::service::media::shared::message::VideoFrameRateType::VIDEO_FPS_30; - videoResolution_ = aap_protobuf::service::media::shared::message::VideoCodecResolutionType::VIDEO_800x480; + videoFPS_ = aap_protobuf::service::media::sink::message::VideoFrameRateType::VIDEO_FPS_30; + videoResolution_ = aap_protobuf::service::media::sink::message::VideoCodecResolutionType::VIDEO_800x480; screenDPI_ = 140; omxLayerIndex_ = 1; videoMargins_ = QRect(0, 0, 0, 0); @@ -234,10 +234,10 @@ void Configuration::save() iniConfig.put(cBluetoothAdapterTypeKey, static_cast(bluetoothAdapterType_)); iniConfig.put(cBluetoothRemoteAdapterAddressKey, bluetoothRemoteAdapterAddress_); - iniConfig.put(Audio::Channel::cMediaEnabled, _audioChannelEnabledMedia); - iniConfig.put(Audio::Channel::cGuidanceEnabled, _audioChannelEnabledGuidance); - iniConfig.put(Audio::Channel::cSystemEnabled, _audioChannelEnabledSystem); - iniConfig.put(Audio::Channel::cTelephonyEnabled, _audioChannelEnabledTelephony); + iniConfig.put(cAudioChannelMediaEnabled, _audioChannelEnabledMedia); + iniConfig.put(cAudioChannelGuidanceEnabled, _audioChannelEnabledGuidance); + iniConfig.put(cAudioChannelSystemEnabled, _audioChannelEnabledSystem); + iniConfig.put(cAudioChannelTelephonyEnabled, _audioChannelEnabledTelephony); iniConfig.put(cAudioOutputBackendType, static_cast(audioOutputBackendType_)); boost::property_tree::ini_parser::write_ini(cConfigFileName, iniConfig); @@ -442,22 +442,22 @@ bool Configuration::instantPlay() const return instantPlay_; } -aap_protobuf::service::media::shared::message::VideoFrameRateType Configuration::getVideoFPS() const +aap_protobuf::service::media::sink::message::VideoFrameRateType Configuration::getVideoFPS() const { return videoFPS_; } -void Configuration::setVideoFPS(aap_protobuf::service::media::shared::message::VideoFrameRateType value) +void Configuration::setVideoFPS(aap_protobuf::service::media::sink::message::VideoFrameRateType value) { videoFPS_ = value; } -aap_protobuf::service::media::shared::message::VideoCodecResolutionType Configuration::getVideoResolution() const +aap_protobuf::service::media::sink::message::VideoCodecResolutionType Configuration::getVideoResolution() const { return videoResolution_; } -void Configuration::setVideoResolution(aap_protobuf::service::media::shared::message::VideoCodecResolutionType value) +void Configuration::setVideoResolution(aap_protobuf::service::media::sink::message::VideoCodecResolutionType value) { videoResolution_ = value; } @@ -717,26 +717,26 @@ QString Configuration::readFileContent(QString fileName) const void Configuration::readButtonCodes(boost::property_tree::ptree& iniConfig) { - this->insertButtonCode(iniConfig, cInputPlayButtonKey, aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PLAY); - this->insertButtonCode(iniConfig, cInputPauseButtonKey, aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PAUSE); - this->insertButtonCode(iniConfig, cInputTogglePlayButtonKey, aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PLAY_PAUSE); - this->insertButtonCode(iniConfig, cInputNextTrackButtonKey, aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_NEXT); - this->insertButtonCode(iniConfig, cInputPreviousTrackButtonKey, aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PREVIOUS); - this->insertButtonCode(iniConfig, cInputHomeButtonKey, aap_protobuf::service::media::sink::KeyCode::KEYCODE_HOME); - this->insertButtonCode(iniConfig, cInputPhoneButtonKey, aap_protobuf::service::media::sink::KeyCode::KEYCODE_CALL); - this->insertButtonCode(iniConfig, cInputCallEndButtonKey, aap_protobuf::service::media::sink::KeyCode::KEYCODE_ENDCALL); - this->insertButtonCode(iniConfig, cInputVoiceCommandButtonKey, aap_protobuf::service::media::sink::KeyCode::KEYCODE_SEARCH); - this->insertButtonCode(iniConfig, cInputLeftButtonKey, aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_LEFT); - this->insertButtonCode(iniConfig, cInputRightButtonKey, aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_RIGHT); - this->insertButtonCode(iniConfig, cInputUpButtonKey, aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_UP); - this->insertButtonCode(iniConfig, cInputDownButtonKey, aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_DOWN); - this->insertButtonCode(iniConfig, cInputScrollWheelButtonKey, aap_protobuf::service::media::sink::KeyCode::KEYCODE_ROTARY_CONTROLLER); - this->insertButtonCode(iniConfig, cInputBackButtonKey, aap_protobuf::service::media::sink::KeyCode::KEYCODE_BACK); - this->insertButtonCode(iniConfig, cInputEnterButtonKey, aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_CENTER); - this->insertButtonCode(iniConfig, cInputNavButtonKey, aap_protobuf::service::media::sink::KeyCode::KEYCODE_NAVIGATION); + this->insertButtonCode(iniConfig, cInputPlayButtonKey, aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PLAY); + this->insertButtonCode(iniConfig, cInputPauseButtonKey, aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PAUSE); + this->insertButtonCode(iniConfig, cInputTogglePlayButtonKey, aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PLAY_PAUSE); + this->insertButtonCode(iniConfig, cInputNextTrackButtonKey, aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_NEXT); + this->insertButtonCode(iniConfig, cInputPreviousTrackButtonKey, aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PREVIOUS); + this->insertButtonCode(iniConfig, cInputHomeButtonKey, aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_HOME); + this->insertButtonCode(iniConfig, cInputPhoneButtonKey, aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_CALL); + this->insertButtonCode(iniConfig, cInputCallEndButtonKey, aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_ENDCALL); + this->insertButtonCode(iniConfig, cInputVoiceCommandButtonKey, aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_SEARCH); + this->insertButtonCode(iniConfig, cInputLeftButtonKey, aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_LEFT); + this->insertButtonCode(iniConfig, cInputRightButtonKey, aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_RIGHT); + this->insertButtonCode(iniConfig, cInputUpButtonKey, aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_UP); + this->insertButtonCode(iniConfig, cInputDownButtonKey, aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_DOWN); + this->insertButtonCode(iniConfig, cInputScrollWheelButtonKey, aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_ROTARY_CONTROLLER); + this->insertButtonCode(iniConfig, cInputBackButtonKey, aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_BACK); + this->insertButtonCode(iniConfig, cInputEnterButtonKey, aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_CENTER); + this->insertButtonCode(iniConfig, cInputNavButtonKey, aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_NAVIGATION); } -void Configuration::insertButtonCode(boost::property_tree::ptree& iniConfig, const std::string& buttonCodeKey, aap_protobuf::service::media::sink::KeyCode buttonCode) +void Configuration::insertButtonCode(boost::property_tree::ptree& iniConfig, const std::string& buttonCodeKey, aap_protobuf::service::media::sink::message::KeyCode buttonCode) { if(iniConfig.get(buttonCodeKey, false)) { @@ -746,23 +746,23 @@ void Configuration::insertButtonCode(boost::property_tree::ptree& iniConfig, con void Configuration::writeButtonCodes(boost::property_tree::ptree& iniConfig) { - iniConfig.put(cInputPlayButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PLAY) != buttonCodes_.end()); - iniConfig.put(cInputPauseButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PAUSE) != buttonCodes_.end()); - iniConfig.put(cInputTogglePlayButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PLAY_PAUSE) != buttonCodes_.end()); - iniConfig.put(cInputNextTrackButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_NEXT) != buttonCodes_.end()); - iniConfig.put(cInputPreviousTrackButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PREVIOUS) != buttonCodes_.end()); - iniConfig.put(cInputHomeButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_HOME) != buttonCodes_.end()); - iniConfig.put(cInputPhoneButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_CALL) != buttonCodes_.end()); - iniConfig.put(cInputCallEndButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_ENDCALL) != buttonCodes_.end()); - iniConfig.put(cInputVoiceCommandButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_SEARCH) != buttonCodes_.end()); - iniConfig.put(cInputLeftButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_LEFT) != buttonCodes_.end()); - iniConfig.put(cInputRightButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_RIGHT) != buttonCodes_.end()); - iniConfig.put(cInputUpButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_UP) != buttonCodes_.end()); - iniConfig.put(cInputDownButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_DOWN) != buttonCodes_.end()); - iniConfig.put(cInputScrollWheelButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_ROTARY_CONTROLLER) != buttonCodes_.end()); - iniConfig.put(cInputBackButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_BACK) != buttonCodes_.end()); - iniConfig.put(cInputEnterButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_CENTER) != buttonCodes_.end()); - iniConfig.put(cInputNavButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_NAVIGATION) != buttonCodes_.end()); + iniConfig.put(cInputPlayButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PLAY) != buttonCodes_.end()); + iniConfig.put(cInputPauseButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PAUSE) != buttonCodes_.end()); + iniConfig.put(cInputTogglePlayButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PLAY_PAUSE) != buttonCodes_.end()); + iniConfig.put(cInputNextTrackButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_NEXT) != buttonCodes_.end()); + iniConfig.put(cInputPreviousTrackButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PREVIOUS) != buttonCodes_.end()); + iniConfig.put(cInputHomeButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_HOME) != buttonCodes_.end()); + iniConfig.put(cInputPhoneButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_CALL) != buttonCodes_.end()); + iniConfig.put(cInputCallEndButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_ENDCALL) != buttonCodes_.end()); + iniConfig.put(cInputVoiceCommandButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_SEARCH) != buttonCodes_.end()); + iniConfig.put(cInputLeftButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_LEFT) != buttonCodes_.end()); + iniConfig.put(cInputRightButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_RIGHT) != buttonCodes_.end()); + iniConfig.put(cInputUpButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_UP) != buttonCodes_.end()); + iniConfig.put(cInputDownButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_DOWN) != buttonCodes_.end()); + iniConfig.put(cInputScrollWheelButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_ROTARY_CONTROLLER) != buttonCodes_.end()); + iniConfig.put(cInputBackButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_BACK) != buttonCodes_.end()); + iniConfig.put(cInputEnterButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_CENTER) != buttonCodes_.end()); + iniConfig.put(cInputNavButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_NAVIGATION) != buttonCodes_.end()); } } diff --git a/src/autoapp/Projection/InputDevice.cpp b/src/autoapp/Projection/InputDevice.cpp index cb39975..3f7ac95 100644 --- a/src/autoapp/Projection/InputDevice.cpp +++ b/src/autoapp/Projection/InputDevice.cpp @@ -83,91 +83,91 @@ bool InputDevice::eventFilter(QObject* obj, QEvent* event) bool InputDevice::handleKeyEvent(QEvent* event, QKeyEvent* key) { auto eventType = event->type() == QEvent::KeyPress ? ButtonEventType::PRESS : ButtonEventType::RELEASE; - aap_protobuf::service::media::sink::KeyCode buttonCode; + aap_protobuf::service::media::sink::message::KeyCode buttonCode; WheelDirection wheelDirection = WheelDirection::NONE; switch(key->key()) { case Qt::Key_Return: case Qt::Key_Enter: - buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_CENTER; + buttonCode = aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_CENTER; break; case Qt::Key_Left: - buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_LEFT; + buttonCode = aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_LEFT; break; case Qt::Key_Right: - buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_RIGHT; + buttonCode = aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_RIGHT; break; case Qt::Key_Up: - buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_UP; + buttonCode = aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_UP; break; case Qt::Key_Down: - buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_DOWN; + buttonCode = aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_DOWN; break; case Qt::Key_Escape: - buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_BACK; + buttonCode = aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_BACK; break; case Qt::Key_H: - buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_HOME; + buttonCode = aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_HOME; break; case Qt::Key_P: - buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_CALL; + buttonCode = aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_CALL; break; case Qt::Key_O: - buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_ENDCALL; + buttonCode = aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_ENDCALL; break; case Qt::Key_MediaPlay: case Qt::Key_X: - buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PLAY; + buttonCode = aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PLAY; break; case Qt::Key_MediaPause: case Qt::Key_C: - buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PAUSE; + buttonCode = aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PAUSE; break; case Qt::Key_MediaPrevious: case Qt::Key_V: - buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PREVIOUS; + buttonCode = aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PREVIOUS; break; case Qt::Key_MediaTogglePlayPause: case Qt::Key_B: - buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PLAY_PAUSE; + buttonCode = aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PLAY_PAUSE; break; case Qt::Key_MediaNext: case Qt::Key_N: - buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_NEXT; + buttonCode = aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_NEXT; break; case Qt::Key_M: - buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_SEARCH; + buttonCode = aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_SEARCH; break; case Qt::Key_1: wheelDirection = WheelDirection::LEFT; eventType = ButtonEventType::NONE; - buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_ROTARY_CONTROLLER; + buttonCode = aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_ROTARY_CONTROLLER; break; case Qt::Key_2: wheelDirection = WheelDirection::RIGHT; eventType = ButtonEventType::NONE; - buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_ROTARY_CONTROLLER; + buttonCode = aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_ROTARY_CONTROLLER; break; case Qt::Key_F: - buttonCode = aap_protobuf::service::media::sink::KeyCode::KEYCODE_NAVIGATION; + buttonCode = aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_NAVIGATION; break; default: @@ -177,7 +177,7 @@ bool InputDevice::handleKeyEvent(QEvent* event, QKeyEvent* key) const auto& buttonCodes = this->getSupportedButtonCodes(); if(std::find(buttonCodes.begin(), buttonCodes.end(), buttonCode) != buttonCodes.end()) { - if(buttonCode != aap_protobuf::service::media::sink::KeyCode::KEYCODE_ROTARY_CONTROLLER || event->type() == QEvent::KeyRelease) + if(buttonCode != aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_ROTARY_CONTROLLER || event->type() == QEvent::KeyRelease) { eventHandler_->onButtonEvent({eventType, wheelDirection, buttonCode}); } @@ -193,18 +193,18 @@ bool InputDevice::handleTouchEvent(QEvent* event) return true; } - aap_protobuf::service::input::message::PointerAction type; + aap_protobuf::service::inputsource::message::PointerAction type; switch(event->type()) { case QEvent::MouseButtonPress: - type = aap_protobuf::service::input::message::PointerAction::ACTION_DOWN; + type = aap_protobuf::service::inputsource::message::PointerAction::ACTION_DOWN; break; case QEvent::MouseButtonRelease: - type = aap_protobuf::service::input::message::PointerAction::ACTION_UP; + type = aap_protobuf::service::inputsource::message::PointerAction::ACTION_UP; break; case QEvent::MouseMove: - type = aap_protobuf::service::input::message::PointerAction::ACTION_MOVED; + type = aap_protobuf::service::inputsource::message::PointerAction::ACTION_MOVED; break; default: return true; diff --git a/src/autoapp/Projection/LocalBluetoothDevice.cpp b/src/autoapp/Projection/LocalBluetoothDevice.cpp index 4086eff..58eb52d 100644 --- a/src/autoapp/Projection/LocalBluetoothDevice.cpp +++ b/src/autoapp/Projection/LocalBluetoothDevice.cpp @@ -54,44 +54,7 @@ void LocalBluetoothDevice::createBluetoothLocalDevice() localDevice_->powerOn(); localDevice_->setHostMode(QBluetoothLocalDevice::HostDiscoverable); -// -// rfcommServer_ = std::make_unique(QBluetoothServiceInfo::RfcommProtocol, this); -// connect(rfcommServer_.get(), &QBluetoothServer::newConnection, this, &LocalBluetoothDevice::onClientConnected, Qt::QueuedConnection); -// if (rfcommServer_->listen(localDevice_->address())) { -// OPENAUTO_LOG(debug) << "Listening for rfcomm connections on port " << rfcommServer_->serverPort(); -// } -// else { -// OPENAUTO_LOG(debug) << "Could not start rfcomm"; -// } -// -// //"4de17a00-52cb-11e6-bdf4-0800200c9a66"; -// //"669a0c20-0008-f4bd-e611-cb52007ae14d"; -// const QBluetoothUuid serviceUuid(QLatin1String("4de17a00-52cb-11e6-bdf4-0800200c9a66")); -// -// QBluetoothServiceInfo::Sequence classId; -// classId << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::SerialPort)); -// serviceInfo_.setAttribute(QBluetoothServiceInfo::BluetoothProfileDescriptorList, classId); -// classId.prepend(QVariant::fromValue(serviceUuid)); -// serviceInfo_.setAttribute(QBluetoothServiceInfo::ServiceClassIds, classId); -// serviceInfo_.setAttribute(QBluetoothServiceInfo::ServiceName, "OpenAuto Bluetooth Service"); -// serviceInfo_.setAttribute(QBluetoothServiceInfo::ServiceDescription, "AndroidAuto WiFi projection automatic setup"); -// serviceInfo_.setAttribute(QBluetoothServiceInfo::ServiceProvider, "f1xstudio.com"); -// serviceInfo_.setServiceUuid(serviceUuid); -// -// QBluetoothServiceInfo::Sequence publicBrowse; -// publicBrowse << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::PublicBrowseGroup)); -// serviceInfo_.setAttribute(QBluetoothServiceInfo::BrowseGroupList, publicBrowse); -// -// QBluetoothServiceInfo::Sequence protocolDescriptorList; -// QBluetoothServiceInfo::Sequence protocol; -// protocol << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::L2cap)); -// protocolDescriptorList.append(QVariant::fromValue(protocol)); -// protocol.clear(); -// protocol << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::Rfcomm)) -// << QVariant::fromValue(quint8(rfcommServer_->serverPort())); -// protocolDescriptorList.append(QVariant::fromValue(protocol)); -// serviceInfo_.setAttribute(QBluetoothServiceInfo::ProtocolDescriptorList, protocolDescriptorList); -// serviceInfo_.registerService(localDevice_->address()); + } void LocalBluetoothDevice::stop() @@ -220,19 +183,6 @@ void LocalBluetoothDevice::onHostModeStateChanged(QBluetoothLocalDevice::HostMod } } -void LocalBluetoothDevice::onClientConnected() { - auto socket = rfcommServer_->nextPendingConnection(); - - if(socket != nullptr) - { - OPENAUTO_LOG(info) << "[BluetoothServer] rfcomm client connected, peer name: " << socket->peerName().toStdString(); - } - else - { - OPENAUTO_LOG(error) << "[BluetoothServer] received null socket during client connection."; - } -} - } } } diff --git a/src/autoapp/Projection/QtVideoOutput.cpp b/src/autoapp/Projection/QtVideoOutput.cpp index e1b15fd..42da94a 100644 --- a/src/autoapp/Projection/QtVideoOutput.cpp +++ b/src/autoapp/Projection/QtVideoOutput.cpp @@ -78,6 +78,7 @@ void QtVideoOutput::onStartPlayback() mediaPlayer_->setVideoOutput(videoWidget_.get()); mediaPlayer_->setMedia(QMediaContent(), &videoBuffer_); mediaPlayer_->play(); + OPENAUTO_LOG(debug) << "Player error state -> " << mediaPlayer_->errorString().toStdString(); } diff --git a/src/autoapp/Projection/VideoOutput.cpp b/src/autoapp/Projection/VideoOutput.cpp index 75edbd3..26d7beb 100644 --- a/src/autoapp/Projection/VideoOutput.cpp +++ b/src/autoapp/Projection/VideoOutput.cpp @@ -16,44 +16,36 @@ * along with openauto. If not, see . */ +#include #include -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace projection -{ +namespace f1x { + namespace openauto { + namespace autoapp { + namespace projection { -VideoOutput::VideoOutput(configuration::IConfiguration::Pointer configuration) - : configuration_(std::move(configuration)) -{ + VideoOutput::VideoOutput(configuration::IConfiguration::Pointer configuration) + : configuration_(std::move(configuration)) { -} + } -aap_protobuf::service::media::shared::message::VideoFrameRateType VideoOutput::getVideoFPS() const -{ - return configuration_->getVideoFPS(); -} + aap_protobuf::service::media::sink::message::VideoFrameRateType VideoOutput::getVideoFPS() const { + return configuration_->getVideoFPS(); + } -aap_protobuf::service::media::shared::message::VideoCodecResolutionType VideoOutput::getVideoResolution() const -{ - return configuration_->getVideoResolution(); -} + aap_protobuf::service::media::sink::message::VideoCodecResolutionType VideoOutput::getVideoResolution() const { + return configuration_->getVideoResolution(); + } -size_t VideoOutput::getScreenDPI() const -{ - return configuration_->getScreenDPI(); -} + size_t VideoOutput::getScreenDPI() const { + return configuration_->getScreenDPI(); + } -QRect VideoOutput::getVideoMargins() const -{ - return configuration_->getVideoMargins(); -} + QRect VideoOutput::getVideoMargins() const { + return configuration_->getVideoMargins(); + } -} -} -} + } + } + } } diff --git a/src/autoapp/Service/AndroidAutoEntity.cpp b/src/autoapp/Service/AndroidAutoEntity.cpp index ee486f3..c69d8ef 100644 --- a/src/autoapp/Service/AndroidAutoEntity.cpp +++ b/src/autoapp/Service/AndroidAutoEntity.cpp @@ -16,12 +16,12 @@ * along with openauto. If not, see . */ -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -36,7 +36,7 @@ * * AAP needs Bluetooth HFP for Telephone * - * HU > MD Bluetooth Announcement (HU MAC Address, Supported Pairing Methods) *********** + * HU > MD Bluetooth Announcement (HU MAC Address, Supported Pairing Methods) Done as Service Discovery * HU < MD Bluetooth Pairing Request *********** * HU > MD Bluetoth Pairing Response*********** * @@ -205,7 +205,7 @@ namespace f1x { } else { OPENAUTO_LOG(info) << "[AndroidAutoEntity] Handshake completed."; - aap_protobuf::channel::control::auth::AuthResponse authCompleteIndication; + aap_protobuf::service::control::message::AuthResponse authCompleteIndication; authCompleteIndication.set_status(aap_protobuf::shared::MessageStatus::STATUS_SUCCESS); auto authCompletePromise = aasdk::channel::SendPromise::defer(strand_); @@ -223,24 +223,38 @@ namespace f1x { } void AndroidAutoEntity::onServiceDiscoveryRequest( - const aap_protobuf::channel::control::servicediscovery::event::ServiceDiscoveryRequest &request) { + const aap_protobuf::service::control::message::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; + aap_protobuf::service::control::message::ServiceDiscoveryResponse serviceDiscoveryResponse; serviceDiscoveryResponse.mutable_channels()->Reserve(256); + serviceDiscoveryResponse.set_driver_position(aap_protobuf::service::control::message::DriverPosition::DRIVER_POSITION_RIGHT); + serviceDiscoveryResponse.set_can_play_native_media_during_vr(false); + serviceDiscoveryResponse.set_display_name("CubeOne Journey"); + serviceDiscoveryResponse.set_probe_for_support(false); + + auto *connectionConfiguration = serviceDiscoveryResponse.mutable_connection_configuration(); + + auto *pingConfiguration = connectionConfiguration->mutable_ping_configuration(); + pingConfiguration->set_tracked_ping_count(5); + pingConfiguration->set_timeout_ms(3000); + pingConfiguration->set_interval_ms(1000); + pingConfiguration->set_high_latency_threshold_ms(200); + + 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_vehicle_id("2024110822150988"); 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"); + headUnitInfo->set_head_unit_software_build("1"); + headUnitInfo->set_head_unit_software_version("1.0"); std::for_each(serviceList_.begin(), serviceList_.end(), std::bind(&IService::fillFeatures, std::placeholders::_1, std::ref(serviceDiscoveryResponse))); @@ -253,22 +267,36 @@ namespace f1x { } void AndroidAutoEntity::onAudioFocusRequest( - const aap_protobuf::channel::control::focus::audio::event::AudioFocusRequest &request) { + const aap_protobuf::service::control::message::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 = + /* + * When the MD starts playing music for example, it sends a gain request. The HU replies: + * STATE_GAIN - no restrictions + * STATE_GAIN_MEDIA_ONLY when using a guidance channel + * STATE_LOSS when vehicle is playing high priority sound after stopping native media (ie USB, RADIO) + * + * When HU starts playing music, we should send a STATE LOSS to stop MD music and guidance. + */ + + // If release, we should stop all playback + // MD wants to play a sound, get a notifiation regarding GAIN + // HU grants focus - to enable MD to send audio over both MEDIA and GUIDANCE channels. + // MD can then play guidance over the MEDIA or GUIDANCE streams + // HU should send STATE_LOSS to stop MD playing (ie if user starts radio player) + aap_protobuf::service::control::message::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; + aap_protobuf::service::control::message::AudioFocusRequestType::AUDIO_FOCUS_RELEASE + ? aap_protobuf::service::control::message::AudioFocusStateType::AUDIO_FOCUS_STATE_LOSS + : aap_protobuf::service::control::message::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); + aap_protobuf::service::control::message::AudioFocusNotification response; + response.set_focus_state(audioFocusStateType); auto promise = aasdk::channel::SendPromise::defer(strand_); promise->then([]() { OPENAUTO_LOG(info) "[AndroidAutoEntity] Resolved Promise"; }, @@ -278,11 +306,11 @@ namespace f1x { } void AndroidAutoEntity::onByeByeRequest( - const aap_protobuf::channel::control::byebye::event::ByeByeRequest &request) { + const aap_protobuf::service::control::message::ByeByeRequest &request) { OPENAUTO_LOG(info) << "[AndroidAutoEntity] onByeByeRequest()"; OPENAUTO_LOG(info) << "[AndroidAutoEntity] Reason received: " << request.reason(); - aap_protobuf::channel::control::byebye::notification::ByeByeResponse response; + aap_protobuf::service::control::message::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)); @@ -291,19 +319,25 @@ namespace f1x { } void AndroidAutoEntity::onByeByeResponse( - const aap_protobuf::channel::control::byebye::notification::ByeByeResponse &response) { + const aap_protobuf::service::control::message::ByeByeResponse &response) { OPENAUTO_LOG(info) << "[AndroidAutoEntity] onByeByeResponse()"; this->triggerQuit(); } void AndroidAutoEntity::onNavigationFocusRequest( - const aap_protobuf::channel::control::focus::navigation::event::NavFocusRequestNotification &request) { + const aap_protobuf::service::control::message::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; + /* + * If the MD sends NAV_FOCUS_PROJECTED in the request, we should stop any local navigation on the HU and grant NAV_FOCUS_NATIVE in the response. + * If the HU starts its own Nav, we should send NAV_FOCUS_NATIVE. + * + * For now, this is fine to be hardcoded as OpenAuto does not provide any local navigation, only that provided through Android Auto. + */ + aap_protobuf::service::control::message::NavFocusNotification response; response.set_focus_type( - aap_protobuf::channel::control::focus::navigation::shared::NavFocusType::NAV_FOCUS_PROJECTED); + aap_protobuf::service::control::message::NavFocusType::NAV_FOCUS_PROJECTED); auto promise = aasdk::channel::SendPromise::defer(strand_); promise->then([]() {}, @@ -312,18 +346,23 @@ namespace f1x { controlServiceChannel_->receive(this->shared_from_this()); } - void AndroidAutoEntity::onBatteryStatusNotification(const aap_protobuf::channel::control::BatteryStatusNotification ¬ification) { + void AndroidAutoEntity::onBatteryStatusNotification(const aap_protobuf::service::control::message::BatteryStatusNotification ¬ification) { OPENAUTO_LOG(info) << "[AndroidAutoEntity] onBatteryStatusNotification()"; controlServiceChannel_->receive(this->shared_from_this()); } + void AndroidAutoEntity::onPingRequest(const aap_protobuf::service::control::message::PingRequest& request) { + OPENAUTO_LOG(info) << "[AndroidAutoEntity] onPingRequest()"; + controlServiceChannel_->receive(this->shared_from_this()); + } + void AndroidAutoEntity::onVoiceSessionRequest( - const aap_protobuf::channel::control::voice::VoiceSessionNotification &request) { + const aap_protobuf::service::control::message::VoiceSessionNotification &request) { OPENAUTO_LOG(info) << "[AndroidAutoEntity] onVoiceSessionRequest()"; controlServiceChannel_->receive(this->shared_from_this()); } - void AndroidAutoEntity::onPingResponse(const aap_protobuf::channel::control::ping::PingResponse &response) { + void AndroidAutoEntity::onPingResponse(const aap_protobuf::service::control::message::PingResponse &response) { OPENAUTO_LOG(info) << "[AndroidAutoEntity] onPingResponse()"; OPENAUTO_LOG(info) << "[AndroidAutoEntity] Timestamp: " << response.timestamp(); pinger_->pong(); @@ -366,7 +405,7 @@ namespace f1x { promise->then([]() {}, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), std::placeholders::_1)); - aap_protobuf::channel::control::ping::PingRequest request; + aap_protobuf::service::control::message::PingRequest request; auto timestamp = std::chrono::duration_cast( std::chrono::high_resolution_clock::now().time_since_epoch()); request.set_timestamp(timestamp.count()); diff --git a/src/autoapp/Service/Bluetooth/BluetoothService.cpp b/src/autoapp/Service/Bluetooth/BluetoothService.cpp index c4e07ec..bcb0292 100644 --- a/src/autoapp/Service/Bluetooth/BluetoothService.cpp +++ b/src/autoapp/Service/Bluetooth/BluetoothService.cpp @@ -61,7 +61,7 @@ namespace f1x { } void BluetoothService::fillFeatures( - aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) { + aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) { OPENAUTO_LOG(info) << "[BluetoothService] fillFeatures()"; if (bluetoothDevice_->isAvailable()) { @@ -69,18 +69,24 @@ namespace f1x { auto *service = response.add_channels(); service->set_id(static_cast(channel_->getId())); + auto bluetooth = service->mutable_bluetooth_service(); + // If the HU wants the MD to skip the Bluetooth Pairing and Connection process, the HU can declaire it's address as SKIP_THIS_BLUETOOTH 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); + + // AAP supports bth PIN and Numeric Comparison as pairing methods. + bluetooth->add_supported_pairing_methods(aap_protobuf::service::bluetooth::message::BluetoothPairingMethod::BLUETOOTH_PAIRING_PIN); + bluetooth->add_supported_pairing_methods(aap_protobuf::service::bluetooth::message::BluetoothPairingMethod::BLUETOOTH_PAIRING_NUMERIC_COMPARISON); + } else { + OPENAUTO_LOG(info) << "[BluetoothService] Bluetooth Not Available "; } } - void BluetoothService::onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) { + void BluetoothService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { OPENAUTO_LOG(info) << "[BluetoothService] onChannelOpenRequest()"; OPENAUTO_LOG(info) << "[BluetoothService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); - aap_protobuf::channel::ChannelOpenResponse response; + aap_protobuf::service::control::message::ChannelOpenResponse response; const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS; response.set_status(status); @@ -93,7 +99,7 @@ namespace f1x { } void BluetoothService::onBluetoothPairingRequest( - const aap_protobuf::channel::bluetooth::event::BluetoothPairingRequest &request) { + const aap_protobuf::service::bluetooth::message::BluetoothPairingRequest &request) { OPENAUTO_LOG(info) << "[BluetoothService] onBluetoothPairingRequest()"; OPENAUTO_LOG(info) << "[BluetoothService] Phone Address: " << request.phone_address(); @@ -106,8 +112,15 @@ namespace f1x { OPENAUTO_LOG(info) << "[BluetoothService] Phone is Not Paired"; } - response.set_already_paired(isPaired); + // TODO: Response Status + /* + * The HU must always sent a STATUS_SUCCESS response, + * or STATUS_BLUETOOTH_PAIRING_DELAYED if: + * there's a delay in allowing bluetooth + * the HU is already engaged in a bluetooth call + */ response.set_status(aap_protobuf::shared::MessageStatus::STATUS_SUCCESS); + response.set_already_paired(isPaired); auto promise = aasdk::channel::SendPromise::defer(strand_); promise->then([]() {}, std::bind(&BluetoothService::onChannelError, this->shared_from_this(), diff --git a/src/autoapp/Service/GenericNotification/GenericNotificationService.cpp b/src/autoapp/Service/GenericNotification/GenericNotificationService.cpp index ec17cbd..1488d3c 100644 --- a/src/autoapp/Service/GenericNotification/GenericNotificationService.cpp +++ b/src/autoapp/Service/GenericNotification/GenericNotificationService.cpp @@ -60,7 +60,7 @@ namespace f1x { } void GenericNotificationService::fillFeatures( - aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) { + aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) { OPENAUTO_LOG(info) << "[GenericNotificationService] fillFeatures()"; auto *service = response.add_channels(); @@ -69,11 +69,11 @@ namespace f1x { auto *genericNotification = service->mutable_wifi_projection_service(); } - void GenericNotificationService::onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) { + void GenericNotificationService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { OPENAUTO_LOG(info) << "[GenericNotificationService] onChannelOpenRequest()"; OPENAUTO_LOG(info) << "[GenericNotificationService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); - aap_protobuf::channel::ChannelOpenResponse response; + aap_protobuf::service::control::message::ChannelOpenResponse response; const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS; response.set_status(status); diff --git a/src/autoapp/Service/InputSource/InputSourceService.cpp b/src/autoapp/Service/InputSource/InputSourceService.cpp index 2ca8f64..f4ca384 100644 --- a/src/autoapp/Service/InputSource/InputSourceService.cpp +++ b/src/autoapp/Service/InputSource/InputSourceService.cpp @@ -16,7 +16,7 @@ * along with openauto. If not, see . */ -#include +#include #include #include @@ -61,7 +61,7 @@ namespace f1x { } void InputSourceService::fillFeatures( - aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) { + aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) { OPENAUTO_LOG(info) << "[InputSourceService] fillFeatures()"; auto *service = response.add_channels(); @@ -72,7 +72,7 @@ namespace f1x { const auto &supportedButtonCodes = inputDevice_->getSupportedButtonCodes(); for (const auto &buttonCode: supportedButtonCodes) { - inputChannel->add_supported_keycodes(buttonCode); + inputChannel->add_keycodes_supported(buttonCode); } if (inputDevice_->hasTouchscreen()) { @@ -84,12 +84,12 @@ namespace f1x { } } - void InputSourceService::onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) { + void InputSourceService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { OPENAUTO_LOG(info) << "[InputSourceService] onChannelOpenRequest()"; OPENAUTO_LOG(info) << "[InputSourceService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); - aap_protobuf::channel::ChannelOpenResponse response; + aap_protobuf::service::control::message::ChannelOpenResponse response; const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS; response.set_status(status); @@ -100,7 +100,7 @@ namespace f1x { channel_->receive(this->shared_from_this()); } - void InputSourceService::onKeyBindingRequest(const aap_protobuf::channel::input::event::KeyBindingRequest &request) { + void InputSourceService::onKeyBindingRequest(const aap_protobuf::service::media::sink::message::KeyBindingRequest &request) { OPENAUTO_LOG(info) << "[InputSourceService] onKeyBindingRequest()"; OPENAUTO_LOG(info) << "[InputSourceService] KeyCodes Count: " << request.keycodes_size(); @@ -143,10 +143,10 @@ namespace f1x { strand_.dispatch( [this, self = this->shared_from_this(), event = std::move(event), timestamp = std::move(timestamp)]() { - aap_protobuf::service::input::message::InputReport inputReport; + aap_protobuf::service::inputsource::message::InputReport inputReport; inputReport.set_timestamp(timestamp.count()); - if (event.code == aap_protobuf::service::media::sink::KeyCode::KEYCODE_ROTARY_CONTROLLER) { + if (event.code == aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_ROTARY_CONTROLLER) { auto relativeEvent = inputReport.mutable_relative_event()->add_data(); relativeEvent->set_delta(event.wheelDirection == projection::WheelDirection::LEFT ? -1 : 1); relativeEvent->set_keycode(event.code); @@ -172,7 +172,7 @@ namespace f1x { strand_.dispatch( [this, self = this->shared_from_this(), event = std::move(event), timestamp = std::move(timestamp)]() { - aap_protobuf::service::input::message::InputReport inputReport; + aap_protobuf::service::inputsource::message::InputReport inputReport; inputReport.set_timestamp(timestamp.count()); auto touchEvent = inputReport.mutable_touch_event(); diff --git a/src/autoapp/Service/MediaBrowser/MediaBrowserService.cpp b/src/autoapp/Service/MediaBrowser/MediaBrowserService.cpp index ff7f362..ecf04c8 100644 --- a/src/autoapp/Service/MediaBrowser/MediaBrowserService.cpp +++ b/src/autoapp/Service/MediaBrowser/MediaBrowserService.cpp @@ -60,7 +60,7 @@ namespace f1x { } void MediaBrowserService::fillFeatures( - aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) { + aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) { OPENAUTO_LOG(info) << "[MediaBrowserService] fillFeatures()"; auto *service = response.add_channels(); @@ -69,11 +69,11 @@ namespace f1x { auto *mediaBrowser = service->mutable_media_browser_service(); } - void MediaBrowserService::onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) { + void MediaBrowserService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { OPENAUTO_LOG(info) << "[MediaBrowserService] onChannelOpenRequest()"; OPENAUTO_LOG(info) << "[MediaBrowserService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); - aap_protobuf::channel::ChannelOpenResponse response; + aap_protobuf::service::control::message::ChannelOpenResponse response; const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS; response.set_status(status); diff --git a/src/autoapp/Service/MediaPlaybackStatus/MediaPlaybackStatusService.cpp b/src/autoapp/Service/MediaPlaybackStatus/MediaPlaybackStatusService.cpp index c736181..4262a89 100644 --- a/src/autoapp/Service/MediaPlaybackStatus/MediaPlaybackStatusService.cpp +++ b/src/autoapp/Service/MediaPlaybackStatus/MediaPlaybackStatusService.cpp @@ -60,7 +60,7 @@ namespace f1x { } void MediaPlaybackStatusService::fillFeatures( - aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) { + aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) { OPENAUTO_LOG(info) << "[MediaPlaybackStatusService] fillFeatures()"; auto *service = response.add_channels(); @@ -69,11 +69,11 @@ namespace f1x { auto *mediaPlaybackStatus = service->mutable_media_playback_service(); } - void MediaPlaybackStatusService::onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) { + void MediaPlaybackStatusService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { OPENAUTO_LOG(info) << "[MediaPlaybackStatusService] onChannelOpenRequest()"; OPENAUTO_LOG(info) << "[MediaPlaybackStatusService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); - aap_protobuf::channel::ChannelOpenResponse response; + aap_protobuf::service::control::message::ChannelOpenResponse response; const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS; response.set_status(status); diff --git a/src/autoapp/Service/MediaSink/AudioMediaSinkService.cpp b/src/autoapp/Service/MediaSink/AudioMediaSinkService.cpp index ccc3d09..755f7e9 100644 --- a/src/autoapp/Service/MediaSink/AudioMediaSinkService.cpp +++ b/src/autoapp/Service/MediaSink/AudioMediaSinkService.cpp @@ -69,7 +69,7 @@ namespace f1x { */ void AudioMediaSinkService::fillFeatures( - aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) { + aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) { OPENAUTO_LOG(info) << "[AudioMediaSinkService] fillFeatures()"; OPENAUTO_LOG(info) << "[AudioMediaSinkService] Channel: " << aasdk::messenger::channelIdToString(channel_->getId()); @@ -78,31 +78,31 @@ namespace f1x { auto audioChannel = service->mutable_media_sink_service(); - audioChannel->set_stream_type( + audioChannel->set_available_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); + aap_protobuf::service::media::sink::message::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); + audioChannel->set_audio_type(aap_protobuf::service::media::sink::message::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); + aap_protobuf::service::media::sink::message::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); + aap_protobuf::service::media::sink::message::AudioStreamType::AUDIO_STREAM_TELEPHONY); break; default: OPENAUTO_LOG(info) << "[AudioMediaSinkService] Unknown Audio."; @@ -115,13 +115,18 @@ namespace f1x { audioConfig->set_sampling_rate(audioOutput_->getSampleRate()); audioConfig->set_number_of_bits(audioOutput_->getSampleSize()); audioConfig->set_number_of_channels(audioOutput_->getChannelCount()); + + OPENAUTO_LOG(info) << "[AudioMediaSinkService] getSampleRate " << audioOutput_->getSampleRate(); + OPENAUTO_LOG(info) << "[AudioMediaSinkService] getSampleSize " << audioOutput_->getSampleSize(); + OPENAUTO_LOG(info) << "[AudioMediaSinkService] getChannelCount " << audioOutput_->getChannelCount(); + //OPENAUTO_LOG(info) << "[AudioMediaSinkService] SampleRate " << audioConfig->sampling_rate() << " / " << audioConfig->number_of_bits() << " / " << audioConfig->number_of_channels(); } /* * Base Channel Handling */ - void AudioMediaSinkService::onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) { + void AudioMediaSinkService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { OPENAUTO_LOG(info) << "[AudioMediaSinkService] onChannelOpenRequest()"; OPENAUTO_LOG(info) << "[AudioMediaSinkService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); @@ -129,11 +134,11 @@ namespace f1x { const aap_protobuf::shared::MessageStatus status = audioOutput_->open() ? aap_protobuf::shared::MessageStatus::STATUS_SUCCESS - : aap_protobuf::shared::MessageStatus::STATUS_INTERNAL_ERROR; + : aap_protobuf::shared::MessageStatus::STATUS_INVALID_CHANNEL; OPENAUTO_LOG(info) << "[AudioMediaSinkService] Status determined: " << aap_protobuf::shared::MessageStatus_Name(status); - aap_protobuf::channel::ChannelOpenResponse response; + aap_protobuf::service::control::message::ChannelOpenResponse response; response.set_status(status); auto promise = aasdk::channel::SendPromise::defer(strand_); @@ -152,13 +157,13 @@ namespace f1x { * Media Channel Handling */ - void AudioMediaSinkService::onMediaChannelSetupRequest(const aap_protobuf::channel::media::event::Setup &request) { + void AudioMediaSinkService::onMediaChannelSetupRequest(const aap_protobuf::service::media::shared::message::Setup &request) { 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); + aap_protobuf::service::media::shared::message::Config response; + auto status = aap_protobuf::service::media::shared::message::Config::STATUS_READY; + response.set_status(status); response.set_max_unacked(1); response.add_configuration_indices(0); @@ -171,7 +176,7 @@ namespace f1x { } - void AudioMediaSinkService::onMediaChannelStartIndication(const aap_protobuf::channel::media::event::Start &indication) { + void AudioMediaSinkService::onMediaChannelStartIndication(const aap_protobuf::service::media::shared::message::Start &indication) { OPENAUTO_LOG(info) << "[AudioMediaSinkService] onMediaChannelStartIndication()"; OPENAUTO_LOG(info) << "[AudioMediaSinkService] Channel Id: " << aasdk::messenger::channelIdToString(channel_->getId()) << ", session: " << indication.session_id(); session_ = indication.session_id(); @@ -179,7 +184,7 @@ namespace f1x { channel_->receive(this->shared_from_this()); } - void AudioMediaSinkService::onMediaChannelStopIndication(const aap_protobuf::channel::media::event::Stop &indication) { + void AudioMediaSinkService::onMediaChannelStopIndication(const aap_protobuf::service::media::shared::message::Stop &indication) { OPENAUTO_LOG(info) << "[AudioMediaSinkService] onMediaChannelStopIndication()"; OPENAUTO_LOG(info) << "[AudioMediaSinkService] Channel Id: " << aasdk::messenger::channelIdToString(channel_->getId()) << ", session: " << session_; @@ -197,7 +202,7 @@ namespace f1x { audioOutput_->write(timestamp, buffer); // TODO: Move MediaSourceMediaAckIndication to Ack and move to Shared. - aap_protobuf::service::media::source::message::MediaSourceMediaAckIndication indication; + aap_protobuf::service::media::source::message::Ack indication; indication.set_session_id(session_); indication.set_ack(1); diff --git a/src/autoapp/Service/MediaSink/VideoMediaSinkService.cpp b/src/autoapp/Service/MediaSink/VideoMediaSinkService.cpp index 3c985e1..076f331 100644 --- a/src/autoapp/Service/MediaSink/VideoMediaSinkService.cpp +++ b/src/autoapp/Service/MediaSink/VideoMediaSinkService.cpp @@ -45,6 +45,7 @@ namespace f1x { OPENAUTO_LOG(info) << "[VideoMediaSinkService] stop()"; OPENAUTO_LOG(info) << "[VideoMediaSinkService] Channel " << aasdk::messenger::channelIdToString(channel_->getId()); + videoOutput_->stop(); }); } @@ -66,7 +67,7 @@ namespace f1x { } void VideoMediaSinkService::fillFeatures( - aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) { + aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) { OPENAUTO_LOG(info) << "[VideoMediaSinkService] fillFeatures()"; OPENAUTO_LOG(info) << "[VideoMediaSinkService] Channel " << aasdk::messenger::channelIdToString(channel_->getId()); @@ -75,10 +76,12 @@ namespace f1x { service->set_id(static_cast(channel_->getId())); auto *videoChannel = service->mutable_media_sink_service(); - videoChannel->set_stream_type( + + videoChannel->set_available_type( aap_protobuf::service::media::shared::message::MediaCodecType::MEDIA_CODEC_VIDEO_H264_BP); videoChannel->set_available_while_in_call(true); + auto *videoConfig1 = videoChannel->add_video_configs(); videoConfig1->set_codec_resolution(videoOutput_->getVideoResolution()); videoConfig1->set_frame_rate(videoOutput_->getVideoFPS()); @@ -88,10 +91,15 @@ namespace f1x { videoConfig1->set_width_margin(videoMargins.width()); videoConfig1->set_density(videoOutput_->getScreenDPI()); + OPENAUTO_LOG(info) << "[VideoMediaSinkService] getVideoResolution " << VideoCodecResolutionType_Name(videoOutput_->getVideoResolution()); + OPENAUTO_LOG(info) << "[VideoMediaSinkService] getVideoFPS " << VideoFrameRateType_Name(videoOutput_->getVideoFPS()); + OPENAUTO_LOG(info) << "[VideoMediaSinkService] width " << videoMargins.width(); + OPENAUTO_LOG(info) << "[VideoMediaSinkService] height " << videoMargins.height(); + OPENAUTO_LOG(info) << "[VideoMediaSinkService] getScreenDPI " << videoOutput_->getScreenDPI(); } void - VideoMediaSinkService::onMediaChannelSetupRequest(const aap_protobuf::channel::media::event::Setup &request) { + VideoMediaSinkService::onMediaChannelSetupRequest(const aap_protobuf::service::media::shared::message::Setup &request) { OPENAUTO_LOG(info) << "[VideoMediaSinkService] onMediaChannelSetupRequest()"; OPENAUTO_LOG(info) << "[VideoMediaSinkService] Channel Id: " << aasdk::messenger::channelIdToString(channel_->getId()) << ", Codec: " @@ -99,13 +107,13 @@ namespace f1x { auto status = videoOutput_->init() - ? aap_protobuf::service::media::sink::MediaSinkChannelSetupStatus::STATUS_READY - : aap_protobuf::service::media::sink::MediaSinkChannelSetupStatus::STATUS_WAIT; + ? aap_protobuf::service::media::shared::message::Config::STATUS_READY + : aap_protobuf::service::media::shared::message::Config::STATUS_WAIT; - OPENAUTO_LOG(info) << "[VideoMediaSinkService] setup status: " << status; + OPENAUTO_LOG(info) << "[VideoMediaSinkService] setup status: " << Config_Status_Name(status); - aap_protobuf::service::media::sink::message::MediaSinkChannelSetupResponse response; - response.set_media_status(status); + aap_protobuf::service::media::shared::message::Config response; + response.set_status(status); response.set_max_unacked(1); response.add_configuration_indices(0); @@ -118,7 +126,7 @@ namespace f1x { channel_->receive(this->shared_from_this()); } - void VideoMediaSinkService::onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) { + void VideoMediaSinkService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { OPENAUTO_LOG(info) << "[VideoMediaSinkService] onChannelOpenRequest()"; OPENAUTO_LOG(info) << "[VideoMediaSinkService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); @@ -130,7 +138,7 @@ namespace f1x { OPENAUTO_LOG(info) << "[VideoMediaSinkService] Status determined: " << aap_protobuf::shared::MessageStatus_Name(status); - aap_protobuf::channel::ChannelOpenResponse response; + aap_protobuf::service::control::message::ChannelOpenResponse response; response.set_status(status); auto promise = aasdk::channel::SendPromise::defer(strand_); @@ -141,7 +149,7 @@ namespace f1x { } void VideoMediaSinkService::onMediaChannelStartIndication( - const aap_protobuf::channel::media::event::Start &indication) { + const aap_protobuf::service::media::shared::message::Start &indication) { OPENAUTO_LOG(info) << "[VideoMediaSinkService] onMediaChannelStartIndication()"; OPENAUTO_LOG(info) << "[VideoMediaSinkService] Channel Id: " << aasdk::messenger::channelIdToString(channel_->getId()) << ", session: " @@ -152,7 +160,7 @@ namespace f1x { } void VideoMediaSinkService::onMediaChannelStopIndication( - const aap_protobuf::channel::media::event::Stop &indication) { + const aap_protobuf::service::media::shared::message::Stop &indication) { OPENAUTO_LOG(info) << "[onMediaChannelStopIndication] onMediaChannelStopIndication()"; OPENAUTO_LOG(info) << "[onMediaChannelStopIndication] Channel Id: " << aasdk::messenger::channelIdToString(channel_->getId()) << ", session: " << session_; @@ -168,7 +176,7 @@ namespace f1x { videoOutput_->write(timestamp, buffer); - aap_protobuf::service::media::source::message::MediaSourceMediaAckIndication indication; + aap_protobuf::service::media::source::message::Ack indication; indication.set_session_id(session_); indication.set_ack(1); @@ -190,12 +198,12 @@ namespace f1x { } void VideoMediaSinkService::onVideoFocusRequest( - const aap_protobuf::channel::control::focus::video::event::VideoFocusRequestNotification &request) { + const aap_protobuf::service::media::video::message::VideoFocusRequestNotification &request) { 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) { + aap_protobuf::service::media::video::message::VideoFocusMode::VIDEO_FOCUS_NATIVE) { // Return to OS OPENAUTO_LOG(info) << "[VideoMediaSinkService] Returning to OS."; try { @@ -214,13 +222,13 @@ namespace f1x { void VideoMediaSinkService::sendVideoFocusIndication() { OPENAUTO_LOG(info) << "[VideoMediaSinkService] sendVideoFocusIndication()"; - aap_protobuf::channel::control::focus::video::notification::VideoFocusNotification videoFocusIndication; + aap_protobuf::service::media::video::message::VideoFocusNotification videoFocusIndication; videoFocusIndication.set_focus( - aap_protobuf::channel::control::focus::video::shared::VideoFocusMode::VIDEO_FOCUS_PROJECTED); + aap_protobuf::service::media::video::message::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(), + promise->then([]() {OPENAUTO_LOG(info) << "[VideoMediaSinkService] VideoFocus Request Sent";}, std::bind(&VideoMediaSinkService::onChannelError, this->shared_from_this(), std::placeholders::_1)); channel_->sendVideoFocusIndication(videoFocusIndication, std::move(promise)); } diff --git a/src/autoapp/Service/MediaSource/MediaSourceService.cpp b/src/autoapp/Service/MediaSource/MediaSourceService.cpp index a4f3eab..9d73fa7 100644 --- a/src/autoapp/Service/MediaSource/MediaSourceService.cpp +++ b/src/autoapp/Service/MediaSource/MediaSourceService.cpp @@ -19,7 +19,6 @@ #include #include #include -#include namespace f1x { namespace openauto { @@ -69,14 +68,14 @@ namespace f1x { * @param response */ void MediaSourceService::fillFeatures( - aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) { + aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) { OPENAUTO_LOG(info) << "[MediaSourceService] fillFeatures()"; auto *service = response.add_channels(); service->set_id(static_cast(channel_->getId())); auto *avInputChannel = service->mutable_media_source_service(); - avInputChannel->set_stream_type( + avInputChannel->set_available_type( aap_protobuf::service::media::shared::message::MediaCodecType::MEDIA_CODEC_AUDIO_PCM); auto audioConfig = avInputChannel->mutable_audio_config(); @@ -93,7 +92,7 @@ namespace f1x { * Open Service Channel Request * @param request */ - void MediaSourceService::onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) { + void MediaSourceService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { OPENAUTO_LOG(info) << "[MediaSourceService] onChannelOpenRequest()"; OPENAUTO_LOG(info) << "[MediaSourceService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); @@ -103,7 +102,7 @@ namespace f1x { OPENAUTO_LOG(info) << "[MediaSourceService] Status determined: " << aap_protobuf::shared::MessageStatus_Name(status); - aap_protobuf::channel::ChannelOpenResponse response; + aap_protobuf::service::control::message::ChannelOpenResponse response; response.set_status(status); auto promise = aasdk::channel::SendPromise::defer(strand_); @@ -132,14 +131,14 @@ namespace f1x { * @param request */ void - MediaSourceService::onMediaChannelSetupRequest(const aap_protobuf::channel::media::event::Setup &request) { + MediaSourceService::onMediaChannelSetupRequest(const aap_protobuf::service::media::shared::message::Setup &request) { 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); + aap_protobuf::service::media::shared::message::Config response; + auto status = aap_protobuf::service::media::shared::message::Config::STATUS_READY; + response.set_status(status); response.set_max_unacked(1); response.add_configuration_indices(0); @@ -155,7 +154,7 @@ namespace f1x { * Generic Media Ack */ void MediaSourceService::onMediaChannelAckIndication( - const aap_protobuf::service::media::source::message::MediaSourceMediaAckIndication &) { + const aap_protobuf::service::media::source::message::Ack &) { OPENAUTO_LOG(info) << "[MediaSourceService] onMediaChannelAckIndication()"; channel_->receive(this->shared_from_this()); } diff --git a/src/autoapp/Service/NavigationStatus/NavigationStatusService.cpp b/src/autoapp/Service/NavigationStatus/NavigationStatusService.cpp index 44f2dc6..0e03ee4 100644 --- a/src/autoapp/Service/NavigationStatus/NavigationStatusService.cpp +++ b/src/autoapp/Service/NavigationStatus/NavigationStatusService.cpp @@ -60,7 +60,7 @@ namespace f1x { } void NavigationStatusService::fillFeatures( - aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) { + aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) { OPENAUTO_LOG(info) << "[NavigationStatusService] fillFeatures()"; auto *service = response.add_channels(); @@ -69,11 +69,11 @@ namespace f1x { auto *navigationStatus = service->mutable_navigation_status_service(); } - void NavigationStatusService::onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) { + void NavigationStatusService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { OPENAUTO_LOG(info) << "[NavigationStatusService] onChannelOpenRequest()"; OPENAUTO_LOG(info) << "[NavigationStatusService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); - aap_protobuf::channel::ChannelOpenResponse response; + aap_protobuf::service::control::message::ChannelOpenResponse response; const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS; response.set_status(status); @@ -85,16 +85,16 @@ namespace f1x { channel_->receive(this->shared_from_this()); } - void NavigationStatusService::onStatusUpdate(const aap_protobuf::channel::navigation::event::NavigationStatus &navStatus) { + void NavigationStatusService::onStatusUpdate(const aap_protobuf::service::navigationstatus::message::NavigationStatus &navStatus) { channel_->receive(this->shared_from_this()); } - void NavigationStatusService::onTurnEvent(const aap_protobuf::channel::navigation::event::NavigationNextTurnEvent &turnEvent) { + void NavigationStatusService::onTurnEvent(const aap_protobuf::service::navigationstatus::message::NavigationNextTurnEvent &turnEvent) { channel_->receive(this->shared_from_this()); } - void NavigationStatusService::onDistanceEvent(const aap_protobuf::service::navigation::message::NavigationNextTurnDistanceEvent &distanceEvent) { + void NavigationStatusService::onDistanceEvent(const aap_protobuf::service::navigationstatus::message::NavigationNextTurnDistanceEvent &distanceEvent) { channel_->receive(this->shared_from_this()); } diff --git a/src/autoapp/Service/PhoneStatus/PhoneStatusService.cpp b/src/autoapp/Service/PhoneStatus/PhoneStatusService.cpp index 7a5510f..99b4786 100644 --- a/src/autoapp/Service/PhoneStatus/PhoneStatusService.cpp +++ b/src/autoapp/Service/PhoneStatus/PhoneStatusService.cpp @@ -60,7 +60,7 @@ namespace f1x { } void PhoneStatusService::fillFeatures( - aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) { + aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) { OPENAUTO_LOG(info) << "[PhoneStatusService] fillFeatures()"; auto *service = response.add_channels(); @@ -69,11 +69,11 @@ namespace f1x { auto *phoneStatus = service->mutable_phone_status_service(); } - void PhoneStatusService::onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) { + void PhoneStatusService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { OPENAUTO_LOG(info) << "[PhoneStatusService] onChannelOpenRequest()"; OPENAUTO_LOG(info) << "[PhoneStatusService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); - aap_protobuf::channel::ChannelOpenResponse response; + aap_protobuf::service::control::message::ChannelOpenResponse response; const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS; response.set_status(status); diff --git a/src/autoapp/Service/Radio/RadioService.cpp b/src/autoapp/Service/Radio/RadioService.cpp index cf6c77a..6c8587f 100644 --- a/src/autoapp/Service/Radio/RadioService.cpp +++ b/src/autoapp/Service/Radio/RadioService.cpp @@ -60,7 +60,7 @@ namespace f1x { } void RadioService::fillFeatures( - aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) { + aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) { OPENAUTO_LOG(info) << "[RadioService] fillFeatures()"; auto *service = response.add_channels(); @@ -69,12 +69,12 @@ namespace f1x { auto *radio = service->mutable_radio_service(); } - void RadioService::onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) { + void RadioService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { OPENAUTO_LOG(info) << "[RadioService] onChannelOpenRequest()"; OPENAUTO_LOG(info) << "[RadioService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); - aap_protobuf::channel::ChannelOpenResponse response; + aap_protobuf::service::control::message::ChannelOpenResponse response; const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS; response.set_status(status); diff --git a/src/autoapp/Service/Sensor/SensorService.cpp b/src/autoapp/Service/Sensor/SensorService.cpp index 7335931..f75e8aa 100644 --- a/src/autoapp/Service/Sensor/SensorService.cpp +++ b/src/autoapp/Service/Sensor/SensorService.cpp @@ -16,8 +16,8 @@ * along with openauto. If not, see . */ -#include -#include +#include +#include #include #include #include @@ -85,7 +85,7 @@ namespace f1x { } void SensorService::fillFeatures( - aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) { + aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) { OPENAUTO_LOG(info) << "[SensorService] fillFeatures()"; auto *service = response.add_channels(); @@ -93,16 +93,16 @@ namespace f1x { // 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); + sensorChannel->add_sensors()->set_sensor_type(aap_protobuf::service::sensorsource::message::SensorType::SENSOR_DRIVING_STATUS_DATA); + sensorChannel->add_sensors()->set_sensor_type(aap_protobuf::service::sensorsource::message::SensorType::SENSOR_LOCATION); + sensorChannel->add_sensors()->set_sensor_type(aap_protobuf::service::sensorsource::message::SensorType::SENSOR_NIGHT_MODE); } - void SensorService::onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) { + void SensorService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { OPENAUTO_LOG(info) << "[SensorService] onChannelOpenRequest()"; OPENAUTO_LOG(info) << "[SensorService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); - aap_protobuf::channel::ChannelOpenResponse response; + aap_protobuf::service::control::message::ChannelOpenResponse response; const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS; response.set_status(status); @@ -115,22 +115,22 @@ namespace f1x { } void SensorService::onSensorStartRequest( - const aap_protobuf::channel::sensor::event::SensorRequest &request) { + const aap_protobuf::service::sensorsource::message::SensorRequest &request) { OPENAUTO_LOG(info) << "[SensorService] onSensorStartRequest()"; OPENAUTO_LOG(info) << "[SensorService] Request Type: "<< request.type(); - aap_protobuf::service::sensor::message::SensorStartResponseMessage response; + aap_protobuf::service::sensorsource::message::SensorStartResponseMessage response; response.set_status(aap_protobuf::shared::MessageStatus::STATUS_SUCCESS); auto promise = aasdk::channel::SendPromise::defer(strand_); // TODO: Convert to Switch? - if (request.type() == aap_protobuf::service::sensor::message::SENSOR_DRIVING_STATUS_DATA) + if (request.type() == aap_protobuf::service::sensorsource::message::SENSOR_DRIVING_STATUS_DATA) { promise->then(std::bind(&SensorService::sendDrivingStatusUnrestricted, this->shared_from_this()), std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1)); } - else if (request.type() == aap_protobuf::service::sensor::message::SensorType::SENSOR_NIGHT_MODE) + else if (request.type() == aap_protobuf::service::sensorsource::message::SensorType::SENSOR_NIGHT_MODE) { promise->then(std::bind(&SensorService::sendNightData, this->shared_from_this()), std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1)); @@ -147,18 +147,18 @@ 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); + aap_protobuf::service::sensorsource::message::SensorBatch indication; + indication.add_driving_status_data()->set_status(aap_protobuf::service::sensorsource::message::DrivingStatus::DRIVE_STATUS_UNRESTRICTED); auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() {}, + promise->then([]() { OPENAUTO_LOG(info) << "[SensorService] SendPromise resolved successfully()"; }, std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1)); channel_->sendSensorEventIndication(indication, std::move(promise)); } void SensorService::sendNightData() { OPENAUTO_LOG(info) << "[SensorService] sendNightData()"; - aap_protobuf::service::sensor::message::SensorBatch indication; + aap_protobuf::service::sensorsource::message::SensorBatch indication; if (SensorService::isNight) { OPENAUTO_LOG(info) << "[SensorService] Night Mode Triggered"; @@ -180,29 +180,30 @@ namespace f1x { void SensorService::sendGPSLocationData() { OPENAUTO_LOG(info) << "[SensorService] sendGPSLocationData()"; - aap_protobuf::service::sensor::message::SensorBatch indication; + aap_protobuf::service::sensorsource::message::SensorBatch indication; + auto *locInd = indication.add_location_data(); // epoch seconds // locInd->set_timestamp(this->gpsData_.fix.time * 1e3); // degrees - locInd->set_latitude(this->gpsData_.fix.latitude * 1e7); - locInd->set_longitude(this->gpsData_.fix.longitude * 1e7); + locInd->set_latitude_e7(this->gpsData_.fix.latitude * 1e7); + locInd->set_longitude_e7(this->gpsData_.fix.longitude * 1e7); // meters auto accuracy = sqrt(pow(this->gpsData_.fix.epx, 2) + pow(this->gpsData_.fix.epy, 2)); - locInd->set_accuracy(accuracy * 1e3); + locInd->set_accuracy_e3(accuracy * 1e3); if (this->gpsData_.set & ALTITUDE_SET) { // meters above ellipsoid - locInd->set_altitude(this->gpsData_.fix.altitude * 1e2); + locInd->set_altitude_e2(this->gpsData_.fix.altitude * 1e2); } if (this->gpsData_.set & SPEED_SET) { // meters per second to knots - locInd->set_speed(this->gpsData_.fix.speed * 1.94384 * 1e3); + locInd->set_speed_e3(this->gpsData_.fix.speed * 1.94384 * 1e3); } if (this->gpsData_.set & TRACK_SET) { // degrees - locInd->set_bearing(this->gpsData_.fix.track * 1e6); + locInd->set_bearing_e6(this->gpsData_.fix.track * 1e6); } auto promise = aasdk::channel::SendPromise::defer(strand_); diff --git a/src/autoapp/Service/ServiceFactory.cpp b/src/autoapp/Service/ServiceFactory.cpp index 87c96e0..b397466 100644 --- a/src/autoapp/Service/ServiceFactory.cpp +++ b/src/autoapp/Service/ServiceFactory.cpp @@ -104,11 +104,11 @@ namespace f1x { OPENAUTO_LOG(info) << "[ServiceFactory] createInputService()"; QRect videoGeometry; switch (configuration_->getVideoResolution()) { - case aap_protobuf::service::media::shared::message::VideoCodecResolutionType::VIDEO_1280x720: + case aap_protobuf::service::media::sink::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: + case aap_protobuf::service::media::sink::message::VideoCodecResolutionType::VIDEO_1920x1080: OPENAUTO_LOG(info) << "[ServiceFactory] Resolution 1920x1080"; videoGeometry = QRect(0, 0, 1920, 1080); break; @@ -162,8 +162,8 @@ namespace f1x { projection::IAudioOutput::Pointer(new projection::QtAudioOutput(1, 16, 16000), std::bind(&QObject::deleteLater, std::placeholders::_1)); - serviceList.emplace_back( - std::make_shared(ioService_, messenger, std::move(telephonyAudioOutput))); + // serviceList.emplace_back( + // std::make_shared(ioService_, messenger, std::move(telephonyAudioOutput))); } /* diff --git a/src/autoapp/Service/VendorExtension/VendorExtensionService.cpp b/src/autoapp/Service/VendorExtension/VendorExtensionService.cpp index 27d748a..a6b8ca9 100644 --- a/src/autoapp/Service/VendorExtension/VendorExtensionService.cpp +++ b/src/autoapp/Service/VendorExtension/VendorExtensionService.cpp @@ -60,7 +60,7 @@ namespace f1x { } void VendorExtensionService::fillFeatures( - aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) { + aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) { OPENAUTO_LOG(info) << "[VendorExtensionService] fillFeatures()"; auto *service = response.add_channels(); @@ -73,11 +73,11 @@ namespace f1x { OPENAUTO_LOG(error) << "[VendorExtensionService] onChannelError(): " << e.what(); } - void VendorExtensionService::onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) { + void VendorExtensionService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { OPENAUTO_LOG(info) << "[VendorExtensionService] onChannelOpenRequest()"; OPENAUTO_LOG(info) << "[VendorExtensionService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); - aap_protobuf::channel::ChannelOpenResponse response; + aap_protobuf::service::control::message::ChannelOpenResponse response; const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS; response.set_status(status); diff --git a/src/autoapp/Service/WifiProjection/WifiProjectionStatus.cpp b/src/autoapp/Service/WifiProjection/WifiProjectionStatus.cpp index 4cca3f9..7b3f74b 100644 --- a/src/autoapp/Service/WifiProjection/WifiProjectionStatus.cpp +++ b/src/autoapp/Service/WifiProjection/WifiProjectionStatus.cpp @@ -59,7 +59,7 @@ namespace f1x { } void WifiProjectionService::fillFeatures( - aap_protobuf::channel::control::servicediscovery::notification::ServiceDiscoveryResponse &response) { + aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) { OPENAUTO_LOG(info) << "[WifiProjectionService] fillFeatures()"; auto *service = response.add_channels(); @@ -89,12 +89,12 @@ namespace f1x { } - void WifiProjectionService::onChannelOpenRequest(const aap_protobuf::channel::ChannelOpenRequest &request) { + void WifiProjectionService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { OPENAUTO_LOG(info) << "[WifiProjectionService] onChannelOpenRequest()"; OPENAUTO_LOG(info) << "[WifiProjectionService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); - aap_protobuf::channel::ChannelOpenResponse response; + aap_protobuf::service::control::message::ChannelOpenResponse response; const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS; response.set_status(status); diff --git a/src/autoapp/UI/SettingsWindow.cpp b/src/autoapp/UI/SettingsWindow.cpp index b1ca528..80f4e64 100644 --- a/src/autoapp/UI/SettingsWindow.cpp +++ b/src/autoapp/UI/SettingsWindow.cpp @@ -225,18 +225,18 @@ namespace f1x { configuration_->hideWarning(ui_->checkBoxDontShowAgain->isChecked()); configuration_->setVideoFPS(ui_->radioButton30FPS->isChecked() - ? aap_protobuf::service::media::shared::message::VideoFrameRateType::VIDEO_FPS_30 - : aap_protobuf::service::media::shared::message::VideoFrameRateType::VIDEO_FPS_60); + ? aap_protobuf::service::media::sink::message::VideoFrameRateType::VIDEO_FPS_30 + : aap_protobuf::service::media::sink::message::VideoFrameRateType::VIDEO_FPS_60); if (ui_->radioButton480p->isChecked()) { configuration_->setVideoResolution( - aap_protobuf::service::media::shared::message::VideoCodecResolutionType::VIDEO_800x480); + aap_protobuf::service::media::sink::message::VideoCodecResolutionType::VIDEO_800x480); } else if (ui_->radioButton720p->isChecked()) { configuration_->setVideoResolution( - aap_protobuf::service::media::shared::message::VideoCodecResolutionType::VIDEO_1280x720); + aap_protobuf::service::media::sink::message::VideoCodecResolutionType::VIDEO_1280x720); } else if (ui_->radioButton1080p->isChecked()) { configuration_->setVideoResolution( - aap_protobuf::service::media::shared::message::VideoCodecResolutionType::VIDEO_1920x1080); + aap_protobuf::service::media::sink::message::VideoCodecResolutionType::VIDEO_1920x1080); } configuration_->setScreenDPI(static_cast(ui_->horizontalSliderScreenDPI->value())); @@ -513,16 +513,16 @@ namespace f1x { ui_->checkBoxDontShowAgain->setChecked(configuration_->hideWarning()); ui_->radioButton30FPS->setChecked(configuration_->getVideoFPS() == - aap_protobuf::service::media::shared::message::VideoFrameRateType::VIDEO_FPS_30); + aap_protobuf::service::media::sink::message::VideoFrameRateType::VIDEO_FPS_30); ui_->radioButton60FPS->setChecked(configuration_->getVideoFPS() == - aap_protobuf::service::media::shared::message::VideoFrameRateType::VIDEO_FPS_60); + aap_protobuf::service::media::sink::message::VideoFrameRateType::VIDEO_FPS_60); ui_->radioButton480p->setChecked(configuration_->getVideoResolution() == - aap_protobuf::service::media::shared::message::VideoCodecResolutionType::VIDEO_800x480); + aap_protobuf::service::media::sink::message::VideoCodecResolutionType::VIDEO_800x480); ui_->radioButton720p->setChecked(configuration_->getVideoResolution() == - aap_protobuf::service::media::shared::message::VideoCodecResolutionType::VIDEO_1280x720); + aap_protobuf::service::media::sink::message::VideoCodecResolutionType::VIDEO_1280x720); ui_->radioButton1080p->setChecked(configuration_->getVideoResolution() == - aap_protobuf::service::media::shared::message::VideoCodecResolutionType::VIDEO_1920x1080); + aap_protobuf::service::media::sink::message::VideoCodecResolutionType::VIDEO_1920x1080); ui_->horizontalSliderScreenDPI->setValue(static_cast(configuration_->getScreenDPI())); ui_->spinBoxOmxLayerIndex->setValue(configuration_->getOMXLayerIndex()); @@ -573,55 +573,55 @@ namespace f1x { void SettingsWindow::loadButtonCheckBoxes() { const auto &buttonCodes = configuration_->getButtonCodes(); ui_->checkBoxPlayButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), - aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PLAY) != + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PLAY) != buttonCodes.end()); ui_->checkBoxPauseButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), - aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PAUSE) != + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PAUSE) != buttonCodes.end()); ui_->checkBoxTogglePlayButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), - aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PLAY_PAUSE) != + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PLAY_PAUSE) != buttonCodes.end()); ui_->checkBoxNextTrackButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), - aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_NEXT) != + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_NEXT) != buttonCodes.end()); ui_->checkBoxPreviousTrackButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), - aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PREVIOUS) != + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PREVIOUS) != buttonCodes.end()); ui_->checkBoxHomeButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), - aap_protobuf::service::media::sink::KeyCode::KEYCODE_HOME) != + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_HOME) != buttonCodes.end()); ui_->checkBoxPhoneButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), - aap_protobuf::service::media::sink::KeyCode::KEYCODE_CALL) != + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_CALL) != buttonCodes.end()); ui_->checkBoxCallEndButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), - aap_protobuf::service::media::sink::KeyCode::KEYCODE_ENDCALL) != + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_ENDCALL) != buttonCodes.end()); ui_->checkBoxVoiceCommandButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), - aap_protobuf::service::media::sink::KeyCode::KEYCODE_SEARCH) != + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_SEARCH) != buttonCodes.end()); ui_->checkBoxLeftButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), - aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_LEFT) != + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_LEFT) != buttonCodes.end()); ui_->checkBoxRightButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), - aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_RIGHT) != + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_RIGHT) != buttonCodes.end()); ui_->checkBoxUpButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), - aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_UP) != + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_UP) != buttonCodes.end()); ui_->checkBoxDownButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), - aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_DOWN) != + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_DOWN) != buttonCodes.end()); ui_->checkBoxScrollWheelButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), - aap_protobuf::service::media::sink::KeyCode::KEYCODE_ROTARY_CONTROLLER) != + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_ROTARY_CONTROLLER) != buttonCodes.end()); ui_->checkBoxBackButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), - aap_protobuf::service::media::sink::KeyCode::KEYCODE_BACK) != + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_BACK) != buttonCodes.end()); ui_->checkBoxEnterButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), - aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_CENTER) != + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_CENTER) != buttonCodes.end()); ui_->checkBoxNavButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), - aap_protobuf::service::media::sink::KeyCode::KEYCODE_NAVIGATION) != + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_NAVIGATION) != buttonCodes.end()); } @@ -648,45 +648,45 @@ namespace f1x { void SettingsWindow::saveButtonCheckBoxes() { configuration::IConfiguration::ButtonCodes buttonCodes; this->saveButtonCheckBox(ui_->checkBoxPlayButton, buttonCodes, - aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PLAY); + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PLAY); this->saveButtonCheckBox(ui_->checkBoxPauseButton, buttonCodes, - aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PAUSE); + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PAUSE); this->saveButtonCheckBox(ui_->checkBoxTogglePlayButton, buttonCodes, - aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PLAY_PAUSE); + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PLAY_PAUSE); this->saveButtonCheckBox(ui_->checkBoxNextTrackButton, buttonCodes, - aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_NEXT); + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_NEXT); this->saveButtonCheckBox(ui_->checkBoxPreviousTrackButton, buttonCodes, - aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PREVIOUS); + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PREVIOUS); this->saveButtonCheckBox(ui_->checkBoxHomeButton, buttonCodes, - aap_protobuf::service::media::sink::KeyCode::KEYCODE_HOME); + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_HOME); this->saveButtonCheckBox(ui_->checkBoxPhoneButton, buttonCodes, - aap_protobuf::service::media::sink::KeyCode::KEYCODE_CALL); + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_CALL); this->saveButtonCheckBox(ui_->checkBoxCallEndButton, buttonCodes, - aap_protobuf::service::media::sink::KeyCode::KEYCODE_ENDCALL); + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_ENDCALL); this->saveButtonCheckBox(ui_->checkBoxVoiceCommandButton, buttonCodes, - aap_protobuf::service::media::sink::KeyCode::KEYCODE_SEARCH); + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_SEARCH); this->saveButtonCheckBox(ui_->checkBoxLeftButton, buttonCodes, - aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_LEFT); + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_LEFT); this->saveButtonCheckBox(ui_->checkBoxRightButton, buttonCodes, - aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_RIGHT); + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_RIGHT); this->saveButtonCheckBox(ui_->checkBoxUpButton, buttonCodes, - aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_UP); + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_UP); this->saveButtonCheckBox(ui_->checkBoxDownButton, buttonCodes, - aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_DOWN); + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_DOWN); this->saveButtonCheckBox(ui_->checkBoxScrollWheelButton, buttonCodes, - aap_protobuf::service::media::sink::KeyCode::KEYCODE_ROTARY_CONTROLLER); + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_ROTARY_CONTROLLER); this->saveButtonCheckBox(ui_->checkBoxBackButton, buttonCodes, - aap_protobuf::service::media::sink::KeyCode::KEYCODE_BACK); + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_BACK); this->saveButtonCheckBox(ui_->checkBoxEnterButton, buttonCodes, - aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_CENTER); + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_CENTER); this->saveButtonCheckBox(ui_->checkBoxNavButton, buttonCodes, - aap_protobuf::service::media::sink::KeyCode::KEYCODE_NAVIGATION); + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_NAVIGATION); configuration_->setButtonCodes(buttonCodes); } void SettingsWindow::saveButtonCheckBox(const QCheckBox *checkBox, configuration::IConfiguration::ButtonCodes &buttonCodes, - aap_protobuf::service::media::sink::KeyCode buttonCode) { + aap_protobuf::service::media::sink::message::KeyCode buttonCode) { if (checkBox->isChecked()) { buttonCodes.push_back(buttonCode); } diff --git a/src/autoapp/UI/assets/journey.jpg b/src/autoapp/UI/assets/journey.jpg new file mode 100644 index 0000000000000000000000000000000000000000..8051d95474684c3df7b71b8d62bacfa0311a1ae0 GIT binary patch literal 95089 zcmeFa2Ut`~lRrFU36itqoS7kKB!db_k|Yv_G~^s42}lMJkRTvYGKeB55=D}Lh~yjx zBuEs2A%AC3@AbX!-F1Y9*(*fU>PyrWn5D|#*9tczl63cK!yQlzKHU4O& z^1YSgKeqC8bCU4%gjq_MLj|A^QE?GoA#sQpuaJe6IIp>gxd^X?mAQ~0Sin+H6e<9W zMd0*<9Orj(=I;MAD4)5zyOo;<%-P8u=zyp5qk|x_!_^)98S zdDsFIaWaQF@If8SVUB!uE><=`R}iU%wWS3J=4ftX#s8xY58VQ0X>tB{!kGjqfJpHP zhzTx}5)%?rkdac-2{6*p(9lWq@UaM}UA=K#<*KsMO(S=Un|hA7l$0$atsK4mfSX5k6 zTJ^HJ=GE)kH+An?+uA!i-*@%rC$fmp(7Atgh{R-Tk(=e}FhVLe2|0 z&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`G3S1NT=3KyD+@gCGtN#bJV5kdI1G6VE zHJTuWIXQugnm-2X#u6;m2cw zCh)$0^$qd`sBsKx4uX9I?3RJYtQbUKa|giG51VBMGC_Uwzy*j*2uu*m zQMn-f@RqH60I+xmcFGe#Wf92i24KN=0IWxfA+Q8mR61Z5sKC}aLKIYCIk4I?fUS>U zHUUn>TmU+^LE{3@E{ICtT|C<20 CIj}zf literal 0 HcmV?d00001 diff --git a/src/autoapp/UI/journey.cpp b/src/autoapp/UI/journey.cpp deleted file mode 100644 index 9f52ef5..0000000 --- a/src/autoapp/UI/journey.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "journey.h" -#include "ui_journey.h" - -journey::journey(QWidget *parent) - : QMainWindow(parent) - , ui(new Ui::journey) -{ - ui->setupUi(this); -} - -journey::~journey() -{ - delete ui; -} diff --git a/src/autoapp/UI/journey.h b/src/autoapp/UI/journey.h deleted file mode 100644 index d63b684..0000000 --- a/src/autoapp/UI/journey.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef JOURNEY_H -#define JOURNEY_H - -#include - -namespace Ui { -class journey; -} - -class journey : public QMainWindow -{ - Q_OBJECT - -public: - explicit journey(QWidget *parent = nullptr); - ~journey(); - -private: - Ui::journey *ui; -}; - -#endif // JOURNEY_H diff --git a/src/autoapp/UI/journey.ui b/src/autoapp/UI/journey.ui deleted file mode 100644 index 052073d..0000000 --- a/src/autoapp/UI/journey.ui +++ /dev/null @@ -1,31 +0,0 @@ - - - journey - - - - 0 - 0 - 800 - 600 - - - - MainWindow - - - - - - 0 - 0 - 800 - 24 - - - - - - - - diff --git a/src/btservice/AndroidBluetoothServer.cpp b/src/btservice/AndroidBluetoothServer.cpp index 0a8b702..96921dc 100644 --- a/src/btservice/AndroidBluetoothServer.cpp +++ b/src/btservice/AndroidBluetoothServer.cpp @@ -24,164 +24,158 @@ #include #include -namespace f1x { - namespace openauto { - namespace btservice { - AndroidBluetoothServer::AndroidBluetoothServer(autoapp::configuration::IConfiguration::Pointer configuration) - : rfcommServer_(std::make_unique(QBluetoothServiceInfo::RfcommProtocol, this)) - , configuration_(std::move(configuration)) - { - connect(rfcommServer_.get(), &QBluetoothServer::newConnection, this, - &AndroidBluetoothServer::onClientConnected); - } +namespace f1x::openauto::btservice { - uint16_t AndroidBluetoothServer::start(const QBluetoothAddress &address) { - if (rfcommServer_->listen(address)) { - return rfcommServer_->serverPort(); - } - return 0; - } + AndroidBluetoothServer::AndroidBluetoothServer(autoapp::configuration::IConfiguration::Pointer configuration) + : rfcommServer_(std::make_unique(QBluetoothServiceInfo::RfcommProtocol, this)), + configuration_(std::move(configuration)) { + connect(rfcommServer_.get(), &QBluetoothServer::newConnection, this, + &AndroidBluetoothServer::onClientConnected); + } - void AndroidBluetoothServer::onClientConnected() { - if (socket != nullptr) { - socket->deleteLater(); - } - - socket = rfcommServer_->nextPendingConnection(); - - if (socket != nullptr) { - OPENAUTO_LOG(info) << "[AndroidBluetoothServer] rfcomm client connected, peer name: " - << socket->peerName().toStdString(); - - connect(socket, &QBluetoothSocket::readyRead, this, &AndroidBluetoothServer::readSocket); -// connect(socket, &QBluetoothSocket::disconnected, this, -// QOverload<>::of(&ChatServer::clientDisconnected)); - - //aap_protobuf::messages::WifiInfoRequest request; - //request.set_ip_address(getIP4_("wlan0")); - //request.set_port(5000); - - //sendMessage(request, 1); - } else { - OPENAUTO_LOG(error) << "[AndroidBluetoothServer] received null socket during client connection."; - } - } - - void AndroidBluetoothServer::readSocket() { - buffer += socket->readAll(); - - OPENAUTO_LOG(info) << "Received message"; - - if (buffer.length() < 4) { - OPENAUTO_LOG(debug) << "Not enough data, waiting for more"; - return; - } - - QDataStream stream(buffer); - uint16_t length; - stream >> length; - - if (buffer.length() < length + 4) { - OPENAUTO_LOG(info) << "Not enough data, waiting for more: " << buffer.length(); - return; - } - - uint16_t messageId; - stream >> messageId; - - OPENAUTO_LOG(debug) << ""; - - switch (messageId) { - case 1: - handleWifiInfoRequest(buffer, length); - break; - case 2: - handleWifiSecurityRequest(buffer, length); - break; - case 7: - handleWifiInfoRequestResponse(buffer, length); - break; - default: { - std::stringstream ss; - ss << std::hex << std::setfill('0'); - for (auto &&val : buffer) { - ss << std::setw(2) << static_cast(val); - } - OPENAUTO_LOG(info) << "Unknown message: " << messageId; - OPENAUTO_LOG(info) << ss.str(); - break; - } - } - - buffer = buffer.mid(length + 4); - } - - void AndroidBluetoothServer::handleWifiInfoRequest(QByteArray &buffer, uint16_t length) { - //TODO: Restire - //aap_protobuf::messages::WifiInfoRequest msg; - //msg.ParseFromArray(buffer.data() + 4, length); - OPENAUTO_LOG(info) << "[AndroidBluetoothServer] WifiInfoRequest: "; //<< msg.DebugString(); - - //aap_protobuf::messages::WifiInfoResponse response; - //response.set_ip_address(getIP4_("wlan0")); - //response.set_port(5000); - //response.set_status(aap_protobuf::messages::WifiInfoResponse_Status_STATUS_SUCCESS); - - //sendMessage(response, 7); - } - - void AndroidBluetoothServer::handleWifiSecurityRequest(QByteArray &buffer, uint16_t length) { - OPENAUTO_LOG(info) << "[AndroidBluetoothServer] WifiSecurityRequest:"; - //aap_protobuf::messages::WifiSecurityReponse response; - - //response.set_ssid(configuration_->getParamFromFile("/etc/hostapd/hostapd.conf","ssid").toStdString()); - //response.set_bssid(QNetworkInterface::interfaceFromName("wlan0").hardwareAddress().toStdString()); - //response.set_key(configuration_->getParamFromFile("/etc/hostapd/hostapd.conf","wpa_passphrase").toStdString()); - //response.set_security_mode(aap_protobuf::messages::WifiSecurityReponse_SecurityMode_WPA2_PERSONAL); - //response.set_access_point_type(aap_protobuf::messages::WifiSecurityReponse_AccessPointType_STATIC); - - //sendMessage(response, 3); - } - - void AndroidBluetoothServer::sendMessage(const google::protobuf::Message& message, uint16_t type) { - int byteSize = message.ByteSize(); - QByteArray out(byteSize + 4, 0); - QDataStream ds(&out, QIODevice::ReadWrite); - ds << (uint16_t) byteSize; - ds << type; - message.SerializeToArray(out.data() + 4, byteSize); - - std::stringstream ss; - ss << std::hex << std::setfill('0'); - for (auto &&val : out) { - ss << std::setw(2) << static_cast(val); - } - //OPENAUTO_LOG(info) << "Writing message: " << ss.str(); - OPENAUTO_LOG(debug) << message.GetTypeName() << " - " + message.DebugString(); - - auto written = socket->write(out); - if (written > -1) { - OPENAUTO_LOG(info) << "Bytes written: " << written; - } else { - OPENAUTO_LOG(info) << "Could not write data"; - } - } - - void AndroidBluetoothServer::handleWifiInfoRequestResponse(QByteArray &buffer, uint16_t length) { - OPENAUTO_LOG(info) << "[AndroidBluetoothServer] WifiInfoRequestResponse"; - //aap_protobuf::messages::WifiInfoResponse msg; - //msg.ParseFromArray(buffer.data() + 4, length); - //OPENAUTO_LOG(info) << "WifiInfoResponse: " << msg.DebugString(); - } - - const ::std::string AndroidBluetoothServer::getIP4_(const QString intf) { - for (const QNetworkAddressEntry &address: QNetworkInterface::interfaceFromName(intf).addressEntries()) { - if (address.ip().protocol() == QAbstractSocket::IPv4Protocol) - return address.ip().toString().toStdString(); - } - return ""; - } - } + uint16_t AndroidBluetoothServer::start(const QBluetoothAddress &address) { + if (rfcommServer_->listen(address)) { + return rfcommServer_->serverPort(); } -} \ No newline at end of file + return 0; + } + + void AndroidBluetoothServer::onClientConnected() { + if (socket != nullptr) { + socket->deleteLater(); + } + + socket = rfcommServer_->nextPendingConnection(); + + if (socket != nullptr) { + OPENAUTO_LOG(info) << "[AndroidBluetoothServer] rfcomm client connected, peer name: " + << socket->peerName().toStdString(); + + connect(socket, &QBluetoothSocket::readyRead, this, &AndroidBluetoothServer::readSocket); + + aap_protobuf::service::wifiprojection::message::WifiCredentialsRequest request; + // TODO: How do we ping back the Wireless Port and IP? + //aap_protobuf::service::::WifiInfoRequest request; + //request.set_ip_address(getIP4_("wlan0")); + //request.set_port(5000); + + sendMessage(request, 1); + } else { + OPENAUTO_LOG(error) << "[AndroidBluetoothServer] received null socket during client connection."; + } + } + + void AndroidBluetoothServer::readSocket() { + buffer += socket->readAll(); + + OPENAUTO_LOG(info) << "Received message"; + + if (buffer.length() < 4) { + OPENAUTO_LOG(debug) << "Not enough data, waiting for more"; + return; + } + + QDataStream stream(buffer); + uint16_t length; + stream >> length; + + if (buffer.length() < length + 4) { + OPENAUTO_LOG(info) << "Not enough data, waiting for more: " << buffer.length(); + return; + } + + aap_protobuf::service::wifiprojection::WifiProjectionMessageId messageId; + //uint16_t messageId; + stream >> messageId; + + //OPENAUTO_LOG(info) << "[AndroidBluetoothServer] " << length << " " << messageId; + OPENAUTO_LOG(debug) << messageId; + + std::stringstream ss; + ss << std::hex << std::setfill('0'); + for (auto &&val: buffer) { + ss << std::setw(2) << static_cast(val); + } + OPENAUTO_LOG(info) << "Unknown message: " << messageId; + OPENAUTO_LOG(info) << ss.str(); + + buffer = buffer.mid(length + 4); + } + + void AndroidBluetoothServer::handleWifiInfoRequest(QByteArray &buffer, uint16_t length) { + aap_protobuf::service::wifiprojection::message::WifiCredentialsRequest msg; + msg.ParseFromArray(buffer.data() + 4, length); + OPENAUTO_LOG(info) << "WifiInfoRequest: " << msg.DebugString(); + + aap_protobuf::service::wifiprojection::message::WifiCredentialsResponse response; + + //response.set_ip_address(getIP4_("wlan0")); + //response.set_port(5000); + //response.set_status(aap_protobuf::service::control::WifiInfoResponse_Status_STATUS_SUCCESS); + + sendMessage(response, 7); + } + + void AndroidBluetoothServer::handleWifiSecurityRequest(QByteArray &buffer, uint16_t length) { + OPENAUTO_LOG(info) << "[AndroidBluetoothServer] WifiSecurityRequest:"; + aap_protobuf::service::wifiprojection::message::WifiCredentialsResponse response; + + response.set_car_wifi_security_mode( + aap_protobuf::service::wifiprojection::message::WifiSecurityMode::WPA2_PERSONAL); + response.set_car_wifi_ssid(configuration_->getParamFromFile("/etc/hostapd/hostapd.conf", "ssid").toStdString()); + response.set_car_wifi_password( + configuration_->getParamFromFile("/etc/hostapd/hostapd.conf", "wpa_passphrase").toStdString()); + response.set_access_point_type(aap_protobuf::service::wifiprojection::message::AccessPointType::STATIC); + response.add_supported_wifi_channels(1); + + + //response.set_ssid(configuration_->getParamFromFile("/etc/hostapd/hostapd.conf","ssid").toStdString()); + //response.set_bssid(QNetworkInterface::interfaceFromName("wlan0").hardwareAddress().toStdString()); + //response.set_key(configuration_->getParamFromFile("/etc/hostapd/hostapd.conf","wpa_passphrase").toStdString()); + //response.set_security_mode(aap_protobuf::messages::WifiSecurityReponse_SecurityMode_WPA2_PERSONAL); + //response.set_access_point_type(aap_protobuf::messages::WifiSecurityReponse_AccessPointType_STATIC); + + sendMessage(response, 3); + } + + void AndroidBluetoothServer::sendMessage(const google::protobuf::Message &message, uint16_t type) { + int byteSize = message.ByteSize(); + QByteArray out(byteSize + 4, 0); + QDataStream ds(&out, QIODevice::ReadWrite); + ds << (uint16_t) byteSize; + ds << type; + message.SerializeToArray(out.data() + 4, byteSize); + + std::stringstream ss; + ss << std::hex << std::setfill('0'); + for (auto &&val: out) { + ss << std::setw(2) << static_cast(val); + } + //OPENAUTO_LOG(info) << "Writing message: " << ss.str(); + OPENAUTO_LOG(debug) << message.GetTypeName() << " - " + message.DebugString(); + + auto written = socket->write(out); + if (written > -1) { + OPENAUTO_LOG(info) << "Bytes written: " << written; + } else { + OPENAUTO_LOG(info) << "Could not write data"; + } + } + + void AndroidBluetoothServer::handleWifiInfoRequestResponse(QByteArray &buffer, uint16_t length) { + OPENAUTO_LOG(info) << "[AndroidBluetoothServer] WifiInfoRequestResponse"; + aap_protobuf::service::wifiprojection::message::WifiCredentialsResponse msg; + msg.ParseFromArray(buffer.data() + 4, length); + OPENAUTO_LOG(info) << "WifiInfoResponse: " << msg.DebugString(); + } + + const ::std::string AndroidBluetoothServer::getIP4_(const QString intf) { + for (const QNetworkAddressEntry &address: QNetworkInterface::interfaceFromName(intf).addressEntries()) { + if (address.ip().protocol() == QAbstractSocket::IPv4Protocol) + return address.ip().toString().toStdString(); + } + return ""; + } +} + diff --git a/src/btservice/AndroidBluetoothService.cpp b/src/btservice/AndroidBluetoothService.cpp index f178662..01cc042 100644 --- a/src/btservice/AndroidBluetoothService.cpp +++ b/src/btservice/AndroidBluetoothService.cpp @@ -18,17 +18,9 @@ #include -namespace f1x -{ -namespace openauto -{ -namespace btservice -{ +namespace f1x::openauto::btservice { -AndroidBluetoothService::AndroidBluetoothService(uint16_t portNumber) -{ - //"4de17a00-52cb-11e6-bdf4-0800200c9a66"; - //"669a0c20-0008-f4bd-e611-cb52007ae14d"; + AndroidBluetoothService::AndroidBluetoothService(uint16_t portNumber) { const QBluetoothUuid serviceUuid(QLatin1String("4de17a00-52cb-11e6-bdf4-0800200c9a66")); QBluetoothServiceInfo::Sequence classId; @@ -38,7 +30,7 @@ AndroidBluetoothService::AndroidBluetoothService(uint16_t portNumber) serviceInfo_.setAttribute(QBluetoothServiceInfo::ServiceClassIds, classId); serviceInfo_.setAttribute(QBluetoothServiceInfo::ServiceName, "OpenAuto Bluetooth Service"); serviceInfo_.setAttribute(QBluetoothServiceInfo::ServiceDescription, "AndroidAuto WiFi projection automatic setup"); - serviceInfo_.setAttribute(QBluetoothServiceInfo::ServiceProvider, "f1xstudio.com"); + serviceInfo_.setAttribute(QBluetoothServiceInfo::ServiceProvider, "cubeone.co.uk"); serviceInfo_.setServiceUuid(serviceUuid); QBluetoothServiceInfo::Sequence publicBrowse; @@ -54,18 +46,16 @@ AndroidBluetoothService::AndroidBluetoothService(uint16_t portNumber) << QVariant::fromValue(quint16(portNumber)); protocolDescriptorList.append(QVariant::fromValue(protocol)); serviceInfo_.setAttribute(QBluetoothServiceInfo::ProtocolDescriptorList, protocolDescriptorList); -} + } -bool AndroidBluetoothService::registerService(const QBluetoothAddress& bluetoothAddress) -{ + bool AndroidBluetoothService::registerService(const QBluetoothAddress &bluetoothAddress) { return serviceInfo_.registerService(bluetoothAddress); -} + } -bool AndroidBluetoothService::unregisterService() -{ + bool AndroidBluetoothService::unregisterService() { return serviceInfo_.unregisterService(); -} + } } -} -} + + diff --git a/src/btservice/btservice.cpp b/src/btservice/btservice.cpp index 6fb042f..3b8b8ee 100644 --- a/src/btservice/btservice.cpp +++ b/src/btservice/btservice.cpp @@ -26,42 +26,42 @@ namespace btservice = f1x::openauto::btservice; int main(int argc, char *argv[]) { - QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth*=true")); - QCoreApplication qApplication(argc, argv); + QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth*=true")); + QCoreApplication qApplication(argc, argv); - QBluetoothLocalDevice localDevice; - const QBluetoothAddress address = localDevice.address(); + QBluetoothLocalDevice localDevice; + const QBluetoothAddress address = localDevice.address(); - auto configuration = std::make_shared(); + auto configuration = std::make_shared(); - // Turn Bluetooth on - localDevice.powerOn(); - // Make it visible to others - localDevice.setHostMode(QBluetoothLocalDevice::HostDiscoverable); + // Turn Bluetooth on + localDevice.powerOn(); + // Make it visible to others + localDevice.setHostMode(QBluetoothLocalDevice::HostDiscoverable); - btservice::AndroidBluetoothServer androidBluetoothServer(configuration); - uint16_t portNumber = androidBluetoothServer.start(address); + btservice::AndroidBluetoothServer androidBluetoothServer(configuration); + uint16_t portNumber = androidBluetoothServer.start(address); - if (portNumber == 0) { - OPENAUTO_LOG(error) << "[btservice] Server start failed."; - return 2; - } + if (portNumber == 0) { + OPENAUTO_LOG(error) << "[btservice] Server start failed."; + return 2; + } - OPENAUTO_LOG(info) << "[btservice] Listening for connections, address: " << address.toString().toStdString() - << ", port: " << portNumber; + OPENAUTO_LOG(info) << "[btservice] Listening for connections, address: " << address.toString().toStdString() + << ", port: " << portNumber; - btservice::AndroidBluetoothService androidBluetoothService(portNumber); - if (!androidBluetoothService.registerService(address)) { - OPENAUTO_LOG(error) << "[btservice] Service registration failed."; - return 1; - } else { - OPENAUTO_LOG(info) << "[btservice] Service registered, port: " << portNumber; - } + btservice::AndroidBluetoothService androidBluetoothService(portNumber); + if (!androidBluetoothService.registerService(address)) { + OPENAUTO_LOG(error) << "[btservice] Service registration failed."; + return 1; + } else { + OPENAUTO_LOG(info) << "[btservice] Service registered, port: " << portNumber; + } - QCoreApplication::exec(); + QCoreApplication::exec(); - OPENAUTO_LOG(info) << "stop"; - androidBluetoothService.unregisterService(); + OPENAUTO_LOG(info) << "stop"; + androidBluetoothService.unregisterService(); - return 0; + return 0; } From 173225970facbc1b08baa8c51b44d59f2b5f44fe Mon Sep 17 00:00:00 2001 From: Simon Dean Date: Wed, 13 Nov 2024 15:09:20 +0000 Subject: [PATCH 06/14] Remove logging. Bolster WifiProjection --- CMakeLists.txt | 3 ++ src/autoapp/App.cpp | 4 +- src/autoapp/Projection/InputDevice.cpp | 4 +- src/autoapp/Service/AndroidAutoEntity.cpp | 43 +++++++++--------- .../Service/Bluetooth/BluetoothService.cpp | 7 ++- .../GenericNotificationService.cpp | 2 +- .../InputSource/InputSourceService.cpp | 6 +-- .../MediaSink/AudioMediaSinkService.cpp | 11 +++-- .../MediaSink/VideoMediaSinkService.cpp | 20 ++++----- .../MediaSource/MediaSourceService.cpp | 10 ++--- .../PhoneStatus/PhoneStatusService.cpp | 2 +- src/autoapp/Service/Pinger.cpp | 4 +- src/autoapp/Service/Radio/RadioService.cpp | 2 +- src/autoapp/Service/Sensor/SensorService.cpp | 8 ++-- .../WifiProjection/WifiProjectionStatus.cpp | 14 +++--- src/autoapp/autoapp.cpp | 44 +++++++++---------- src/btservice/AndroidBluetoothServer.cpp | 3 +- 17 files changed, 91 insertions(+), 96 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 79cf6c3..a212b6e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,7 +41,10 @@ if (WIN32) set(WINSOCK2_LIBRARIES "ws2_32") endif (WIN32) +add_definitions(-DRPI3_BUILD) + if (RPI3_BUILD) + message(INFO "Compiling for RaspberryPi") add_definitions(-DUSE_OMX -DOMX_SKIP64BIT -DRASPBERRYPI3) set(BCM_HOST_LIBRARIES "/opt/vc/lib/libbcm_host.so") set(BCM_HOST_INCLUDE_DIRS "/opt/vc/include") diff --git a/src/autoapp/App.cpp b/src/autoapp/App.cpp index b016ea2..65d575d 100644 --- a/src/autoapp/App.cpp +++ b/src/autoapp/App.cpp @@ -238,7 +238,7 @@ void App::resume() void App::onAndroidAutoQuit() { strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[App] onAndroidAutoQuit."; + OPENAUTO_LOG(info) << "[App] onAndroidAutoQuit()"; //acceptor_.close(); @@ -268,7 +268,7 @@ void App::onAndroidAutoQuit() void App::onUSBHubError(const aasdk::error::Error& error) { - OPENAUTO_LOG(error) << "[App] usb hub error: " << error.what(); + OPENAUTO_LOG(error) << "[App] onUSBHubError(): " << error.what(); // if(error != aasdk::error::ErrorCode::OPERATION_ABORTED && // error != aasdk::error::ErrorCode::OPERATION_IN_PROGRESS) diff --git a/src/autoapp/Projection/InputDevice.cpp b/src/autoapp/Projection/InputDevice.cpp index 3f7ac95..8cefd9a 100644 --- a/src/autoapp/Projection/InputDevice.cpp +++ b/src/autoapp/Projection/InputDevice.cpp @@ -43,7 +43,7 @@ void InputDevice::start(IInputDeviceEventHandler& eventHandler) { std::lock_guard lock(mutex_); - OPENAUTO_LOG(info) << "[InputDevice] start."; + OPENAUTO_LOG(info) << "[InputDevice] start()"; eventHandler_ = &eventHandler; parent_.installEventFilter(this); } @@ -52,7 +52,7 @@ void InputDevice::stop() { std::lock_guard lock(mutex_); - OPENAUTO_LOG(info) << "[InputDevice] stop."; + OPENAUTO_LOG(info) << "[InputDevice] stop()"; parent_.removeEventFilter(this); eventHandler_ = nullptr; } diff --git a/src/autoapp/Service/AndroidAutoEntity.cpp b/src/autoapp/Service/AndroidAutoEntity.cpp index c69d8ef..0f35cd7 100644 --- a/src/autoapp/Service/AndroidAutoEntity.cpp +++ b/src/autoapp/Service/AndroidAutoEntity.cpp @@ -103,13 +103,12 @@ namespace f1x { eventHandler_ = eventHandler; std::for_each(serviceList_.begin(), serviceList_.end(), std::bind(&IService::start, std::placeholders::_1)); - OPENAUTO_LOG(info) << "[AndroidAutoEntity] Event handlers added."; auto versionRequestPromise = aasdk::channel::SendPromise::defer(strand_); - versionRequestPromise->then([]() { OPENAUTO_LOG(info) << "[AndroidAutoEntity] SUCCESS: Version request sent."; }, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), + versionRequestPromise->then([]() { }, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), std::placeholders::_1)); - OPENAUTO_LOG(info) << "[AndroidAutoEntity] Send Version Request."; + OPENAUTO_LOG(debug) << "[AndroidAutoEntity] Send Version Request."; controlServiceChannel_->sendVersionRequest(std::move(versionRequestPromise)); controlServiceChannel_->receive(this->shared_from_this()); }); @@ -128,7 +127,7 @@ namespace f1x { transport_->stop(); cryptor_->deinit(); } catch (...) { - OPENAUTO_LOG(info) << "[AndroidAutoEntity] stop() - exception when stopping."; + OPENAUTO_LOG(error) << "[AndroidAutoEntity] stop() - exception when stopping."; } }); } @@ -141,7 +140,7 @@ namespace f1x { std::for_each(serviceList_.begin(), serviceList_.end(), std::bind(&IService::pause, std::placeholders::_1)); } catch (...) { - OPENAUTO_LOG(info) << "[AndroidAutoEntity] pause() - exception when pausing."; + OPENAUTO_LOG(error) << "[AndroidAutoEntity] pause() - exception when pausing."; } }); } @@ -154,7 +153,7 @@ namespace f1x { std::for_each(serviceList_.begin(), serviceList_.end(), std::bind(&IService::resume, std::placeholders::_1)); } catch (...) { - OPENAUTO_LOG(info) << "[AndroidAutoEntity] resume() exception when resuming."; + OPENAUTO_LOG(error) << "[AndroidAutoEntity] resume() exception when resuming."; } }); } @@ -169,14 +168,14 @@ namespace f1x { OPENAUTO_LOG(error) << "[AndroidAutoEntity] Version mismatch."; this->triggerQuit(); } else { - OPENAUTO_LOG(info) << "[AndroidAutoEntity] Version matches."; + OPENAUTO_LOG(debug) << "[AndroidAutoEntity] Version matches."; try { OPENAUTO_LOG(info) << "[AndroidAutoEntity] Beginning SSL handshake."; cryptor_->doHandshake(); auto handshakePromise = aasdk::channel::SendPromise::defer(strand_); - handshakePromise->then([]() { OPENAUTO_LOG(info) << "[AndroidAutoEntity] SUCCESS: Sent SSL handshake."; }, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), + 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()); @@ -190,7 +189,7 @@ namespace f1x { void AndroidAutoEntity::onHandshake(const aasdk::common::DataConstBuffer &payload) { OPENAUTO_LOG(info) << "[AndroidAutoEntity] onHandshake()"; - OPENAUTO_LOG(info) << "[AndroidAutoEntity] Payload size: " << payload.size; + OPENAUTO_LOG(debug) << "[AndroidAutoEntity] Payload size: " << payload.size; try { cryptor_->writeHandshakeBuffer(payload); @@ -217,7 +216,7 @@ namespace f1x { controlServiceChannel_->receive(this->shared_from_this()); } catch (const aasdk::error::Error &e) { - OPENAUTO_LOG(info) << "[AndroidAutoEntity] Error during handshake"; + OPENAUTO_LOG(error) << "[AndroidAutoEntity] Error during handshake"; this->onChannelError(e); } } @@ -225,7 +224,7 @@ namespace f1x { void AndroidAutoEntity::onServiceDiscoveryRequest( const aap_protobuf::service::control::message::ServiceDiscoveryRequest &request) { OPENAUTO_LOG(info) << "[AndroidAutoEntity] onServiceDiscoveryRequest()"; - OPENAUTO_LOG(info) << "[AndroidAutoEntity] Type: " << request.label_text() << ", Model: " + OPENAUTO_LOG(debug) << "[AndroidAutoEntity] Type: " << request.label_text() << ", Model: " << request.device_name(); aap_protobuf::service::control::message::ServiceDiscoveryResponse serviceDiscoveryResponse; @@ -260,7 +259,7 @@ namespace f1x { std::bind(&IService::fillFeatures, std::placeholders::_1, std::ref(serviceDiscoveryResponse))); auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() { OPENAUTO_LOG(info) << "[AndroidAutoEntity] SUCCESS: Send ServiceDiscoveryResponse."; }, + 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()); @@ -269,7 +268,7 @@ namespace f1x { void AndroidAutoEntity::onAudioFocusRequest( const aap_protobuf::service::control::message::AudioFocusRequest &request) { OPENAUTO_LOG(info) << "[AndroidAutoEntity] onAudioFocusRequest()"; - OPENAUTO_LOG(info) << "[AndroidAutoEntity] AudioFocusRequestType received: " + OPENAUTO_LOG(debug) << "[AndroidAutoEntity] AudioFocusRequestType received: " << AudioFocusRequestType_Name(request.audio_focus_type()); /* @@ -292,15 +291,15 @@ namespace f1x { ? aap_protobuf::service::control::message::AudioFocusStateType::AUDIO_FOCUS_STATE_LOSS : aap_protobuf::service::control::message::AudioFocusStateType::AUDIO_FOCUS_STATE_GAIN; - OPENAUTO_LOG(info) << "[AndroidAutoEntity] AudioFocusStateType determined: " + OPENAUTO_LOG(debug) << "[AndroidAutoEntity] AudioFocusStateType determined: " << AudioFocusStateType_Name(audioFocusStateType); aap_protobuf::service::control::message::AudioFocusNotification response; response.set_focus_state(audioFocusStateType); auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() { OPENAUTO_LOG(info) "[AndroidAutoEntity] Resolved Promise"; }, - [capture0 = this->shared_from_this()](auto && PH1) { OPENAUTO_LOG(info) "[AndroidAutoEntity] Failed to Resolve Promise"; capture0->onChannelError(std::forward(PH1)); }); + promise->then([]() { }, + [capture0 = this->shared_from_this()](auto && PH1) { capture0->onChannelError(std::forward(PH1)); }); controlServiceChannel_->sendAudioFocusResponse(response, std::move(promise)); controlServiceChannel_->receive(this->shared_from_this()); } @@ -308,7 +307,7 @@ namespace f1x { void AndroidAutoEntity::onByeByeRequest( const aap_protobuf::service::control::message::ByeByeRequest &request) { OPENAUTO_LOG(info) << "[AndroidAutoEntity] onByeByeRequest()"; - OPENAUTO_LOG(info) << "[AndroidAutoEntity] Reason received: " << request.reason(); + OPENAUTO_LOG(debug) << "[AndroidAutoEntity] Reason received: " << request.reason(); aap_protobuf::service::control::message::ByeByeResponse response; auto promise = aasdk::channel::SendPromise::defer(strand_); @@ -326,8 +325,8 @@ namespace f1x { void AndroidAutoEntity::onNavigationFocusRequest( const aap_protobuf::service::control::message::NavFocusRequestNotification &request) { - OPENAUTO_LOG(info) << "[AndroidAutoEntity] onByeByeResponse()"; - OPENAUTO_LOG(info) << "[AndroidAutoEntity] NavFocusRequestNotification type received: " << NavFocusType_Name(request.focus_type()); + OPENAUTO_LOG(info) << "[AndroidAutoEntity] onNavigationFocusRequest()"; + OPENAUTO_LOG(debug) << "[AndroidAutoEntity] NavFocusRequestNotification type received: " << NavFocusType_Name(request.focus_type()); /* * If the MD sends NAV_FOCUS_PROJECTED in the request, we should stop any local navigation on the HU and grant NAV_FOCUS_NATIVE in the response. @@ -364,7 +363,7 @@ namespace f1x { void AndroidAutoEntity::onPingResponse(const aap_protobuf::service::control::message::PingResponse &response) { OPENAUTO_LOG(info) << "[AndroidAutoEntity] onPingResponse()"; - OPENAUTO_LOG(info) << "[AndroidAutoEntity] Timestamp: " << response.timestamp(); + OPENAUTO_LOG(debug) << "[AndroidAutoEntity] Timestamp: " << response.timestamp(); pinger_->pong(); controlServiceChannel_->receive(this->shared_from_this()); } @@ -382,7 +381,7 @@ namespace f1x { } void AndroidAutoEntity::schedulePing() { - OPENAUTO_LOG(info) << "[AndroidAutoEntity] schedulePing()"; + OPENAUTO_LOG(debug) << "[AndroidAutoEntity] schedulePing()"; auto promise = IPinger::Promise::defer(strand_); promise->then([this, self = this->shared_from_this()]() { this->sendPing(); @@ -400,7 +399,7 @@ namespace f1x { } void AndroidAutoEntity::sendPing() { - OPENAUTO_LOG(info) << "[AndroidAutoEntity] sendPing()"; + OPENAUTO_LOG(debug) << "[AndroidAutoEntity] sendPing()"; auto promise = aasdk::channel::SendPromise::defer(strand_); promise->then([]() {}, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), std::placeholders::_1)); diff --git a/src/autoapp/Service/Bluetooth/BluetoothService.cpp b/src/autoapp/Service/Bluetooth/BluetoothService.cpp index bcb0292..5be2117 100644 --- a/src/autoapp/Service/Bluetooth/BluetoothService.cpp +++ b/src/autoapp/Service/Bluetooth/BluetoothService.cpp @@ -65,7 +65,7 @@ namespace f1x { OPENAUTO_LOG(info) << "[BluetoothService] fillFeatures()"; if (bluetoothDevice_->isAvailable()) { - OPENAUTO_LOG(info) << "[BluetoothService] Local Address: " << bluetoothDevice_->getLocalAddress(); + OPENAUTO_LOG(debug) << "[BluetoothService] Local Address: " << bluetoothDevice_->getLocalAddress(); auto *service = response.add_channels(); service->set_id(static_cast(channel_->getId())); @@ -84,7 +84,7 @@ namespace f1x { void BluetoothService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { OPENAUTO_LOG(info) << "[BluetoothService] onChannelOpenRequest()"; - OPENAUTO_LOG(info) << "[BluetoothService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); + OPENAUTO_LOG(debug) << "[BluetoothService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); aap_protobuf::service::control::message::ChannelOpenResponse response; const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS; @@ -101,7 +101,7 @@ namespace f1x { void BluetoothService::onBluetoothPairingRequest( const aap_protobuf::service::bluetooth::message::BluetoothPairingRequest &request) { OPENAUTO_LOG(info) << "[BluetoothService] onBluetoothPairingRequest()"; - OPENAUTO_LOG(info) << "[BluetoothService] Phone Address: " << request.phone_address(); + OPENAUTO_LOG(debug) << "[BluetoothService] Phone Address: " << request.phone_address(); aap_protobuf::service::bluetooth::message::BluetoothPairingResponse response; @@ -112,7 +112,6 @@ namespace f1x { OPENAUTO_LOG(info) << "[BluetoothService] Phone is Not Paired"; } - // TODO: Response Status /* * The HU must always sent a STATUS_SUCCESS response, * or STATUS_BLUETOOTH_PAIRING_DELAYED if: diff --git a/src/autoapp/Service/GenericNotification/GenericNotificationService.cpp b/src/autoapp/Service/GenericNotification/GenericNotificationService.cpp index 1488d3c..a446e36 100644 --- a/src/autoapp/Service/GenericNotification/GenericNotificationService.cpp +++ b/src/autoapp/Service/GenericNotification/GenericNotificationService.cpp @@ -71,7 +71,7 @@ namespace f1x { void GenericNotificationService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { OPENAUTO_LOG(info) << "[GenericNotificationService] onChannelOpenRequest()"; - OPENAUTO_LOG(info) << "[GenericNotificationService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); + OPENAUTO_LOG(debug) << "[GenericNotificationService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); aap_protobuf::service::control::message::ChannelOpenResponse response; const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS; diff --git a/src/autoapp/Service/InputSource/InputSourceService.cpp b/src/autoapp/Service/InputSource/InputSourceService.cpp index f4ca384..47e7b21 100644 --- a/src/autoapp/Service/InputSource/InputSourceService.cpp +++ b/src/autoapp/Service/InputSource/InputSourceService.cpp @@ -86,7 +86,7 @@ namespace f1x { void InputSourceService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { OPENAUTO_LOG(info) << "[InputSourceService] onChannelOpenRequest()"; - OPENAUTO_LOG(info) << "[InputSourceService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); + OPENAUTO_LOG(debug) << "[InputSourceService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); aap_protobuf::service::control::message::ChannelOpenResponse response; @@ -102,7 +102,7 @@ namespace f1x { void InputSourceService::onKeyBindingRequest(const aap_protobuf::service::media::sink::message::KeyBindingRequest &request) { OPENAUTO_LOG(info) << "[InputSourceService] onKeyBindingRequest()"; - OPENAUTO_LOG(info) << "[InputSourceService] KeyCodes Count: " << request.keycodes_size(); + OPENAUTO_LOG(debug) << "[InputSourceService] KeyCodes Count: " << request.keycodes_size(); aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS; const auto &supportedButtonCodes = inputDevice_->getSupportedButtonCodes(); @@ -123,7 +123,7 @@ namespace f1x { inputDevice_->start(*this); } - OPENAUTO_LOG(info) << "[InputSourceService] Sending KeyBindingResponse with Status: " << status; + OPENAUTO_LOG(debug) << "[InputSourceService] Sending KeyBindingResponse with Status: " << status; auto promise = aasdk::channel::SendPromise::defer(strand_); promise->then([]() {}, diff --git a/src/autoapp/Service/MediaSink/AudioMediaSinkService.cpp b/src/autoapp/Service/MediaSink/AudioMediaSinkService.cpp index 755f7e9..fff4de7 100644 --- a/src/autoapp/Service/MediaSink/AudioMediaSinkService.cpp +++ b/src/autoapp/Service/MediaSink/AudioMediaSinkService.cpp @@ -136,7 +136,7 @@ namespace f1x { ? aap_protobuf::shared::MessageStatus::STATUS_SUCCESS : aap_protobuf::shared::MessageStatus::STATUS_INVALID_CHANNEL; - OPENAUTO_LOG(info) << "[AudioMediaSinkService] Status determined: " << aap_protobuf::shared::MessageStatus_Name(status); + OPENAUTO_LOG(debug) << "[AudioMediaSinkService] Status determined: " << aap_protobuf::shared::MessageStatus_Name(status); aap_protobuf::service::control::message::ChannelOpenResponse response; response.set_status(status); @@ -185,8 +185,8 @@ namespace f1x { } void AudioMediaSinkService::onMediaChannelStopIndication(const aap_protobuf::service::media::shared::message::Stop &indication) { - OPENAUTO_LOG(info) << "[AudioMediaSinkService] onMediaChannelStopIndication()"; - OPENAUTO_LOG(info) << "[AudioMediaSinkService] Channel Id: " << aasdk::messenger::channelIdToString(channel_->getId()) << ", session: " << session_; + OPENAUTO_LOG(debug) << "[AudioMediaSinkService] onMediaChannelStopIndication()"; + OPENAUTO_LOG(debug) << "[AudioMediaSinkService] Channel Id: " << aasdk::messenger::channelIdToString(channel_->getId()) << ", session: " << session_; session_ = -1; audioOutput_->suspend(); @@ -196,12 +196,11 @@ 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_; + OPENAUTO_LOG(debug) << "[AudioMediaSinkService] onMediaWithTimestampIndication()"; + OPENAUTO_LOG(debug) << "[AudioMediaSinkService] Channel Id: " << aasdk::messenger::channelIdToString(channel_->getId()) << ", session: " << session_; audioOutput_->write(timestamp, buffer); - // TODO: Move MediaSourceMediaAckIndication to Ack and move to Shared. aap_protobuf::service::media::source::message::Ack indication; indication.set_session_id(session_); indication.set_ack(1); diff --git a/src/autoapp/Service/MediaSink/VideoMediaSinkService.cpp b/src/autoapp/Service/MediaSink/VideoMediaSinkService.cpp index 076f331..b1dc2f8 100644 --- a/src/autoapp/Service/MediaSink/VideoMediaSinkService.cpp +++ b/src/autoapp/Service/MediaSink/VideoMediaSinkService.cpp @@ -91,11 +91,11 @@ namespace f1x { videoConfig1->set_width_margin(videoMargins.width()); videoConfig1->set_density(videoOutput_->getScreenDPI()); - OPENAUTO_LOG(info) << "[VideoMediaSinkService] getVideoResolution " << VideoCodecResolutionType_Name(videoOutput_->getVideoResolution()); - OPENAUTO_LOG(info) << "[VideoMediaSinkService] getVideoFPS " << VideoFrameRateType_Name(videoOutput_->getVideoFPS()); - OPENAUTO_LOG(info) << "[VideoMediaSinkService] width " << videoMargins.width(); - OPENAUTO_LOG(info) << "[VideoMediaSinkService] height " << videoMargins.height(); - OPENAUTO_LOG(info) << "[VideoMediaSinkService] getScreenDPI " << videoOutput_->getScreenDPI(); + OPENAUTO_LOG(debug) << "[VideoMediaSinkService] getVideoResolution " << VideoCodecResolutionType_Name(videoOutput_->getVideoResolution()); + OPENAUTO_LOG(debug) << "[VideoMediaSinkService] getVideoFPS " << VideoFrameRateType_Name(videoOutput_->getVideoFPS()); + OPENAUTO_LOG(debug) << "[VideoMediaSinkService] width " << videoMargins.width(); + OPENAUTO_LOG(debug) << "[VideoMediaSinkService] height " << videoMargins.height(); + OPENAUTO_LOG(debug) << "[VideoMediaSinkService] getScreenDPI " << videoOutput_->getScreenDPI(); } void @@ -170,8 +170,8 @@ namespace f1x { void VideoMediaSinkService::onMediaWithTimestampIndication(aasdk::messenger::Timestamp::ValueType timestamp, const aasdk::common::DataConstBuffer &buffer) { - OPENAUTO_LOG(info) << "[VideoMediaSinkService] onMediaWithTimestampIndication()"; - OPENAUTO_LOG(info) << "[VideoMediaSinkService] Channel Id: " + OPENAUTO_LOG(debug) << "[VideoMediaSinkService] onMediaWithTimestampIndication()"; + OPENAUTO_LOG(debug) << "[VideoMediaSinkService] Channel Id: " << aasdk::messenger::channelIdToString(channel_->getId()) << ", session: " << session_; videoOutput_->write(timestamp, buffer); @@ -188,7 +188,7 @@ namespace f1x { } void VideoMediaSinkService::onMediaIndication(const aasdk::common::DataConstBuffer &buffer) { - OPENAUTO_LOG(info) << "[VideoMediaSinkService] onMediaIndication()"; + OPENAUTO_LOG(debug) << "[VideoMediaSinkService] onMediaIndication()"; this->onMediaWithTimestampIndication(0, buffer); } @@ -199,7 +199,7 @@ namespace f1x { void VideoMediaSinkService::onVideoFocusRequest( const aap_protobuf::service::media::video::message::VideoFocusRequestNotification &request) { - OPENAUTO_LOG(info) << "[VideoMediaSinkService] onMediaIndication()"; + OPENAUTO_LOG(info) << "[VideoMediaSinkService] onVideoFocusRequest()"; 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() == @@ -228,7 +228,7 @@ namespace f1x { videoFocusIndication.set_unsolicited(false); auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() {OPENAUTO_LOG(info) << "[VideoMediaSinkService] VideoFocus Request Sent";}, std::bind(&VideoMediaSinkService::onChannelError, this->shared_from_this(), + promise->then([]() { }, std::bind(&VideoMediaSinkService::onChannelError, this->shared_from_this(), std::placeholders::_1)); channel_->sendVideoFocusIndication(videoFocusIndication, std::move(promise)); } diff --git a/src/autoapp/Service/MediaSource/MediaSourceService.cpp b/src/autoapp/Service/MediaSource/MediaSourceService.cpp index 9d73fa7..a2e857b 100644 --- a/src/autoapp/Service/MediaSource/MediaSourceService.cpp +++ b/src/autoapp/Service/MediaSource/MediaSourceService.cpp @@ -100,7 +100,7 @@ namespace f1x { ? aap_protobuf::shared::MessageStatus::STATUS_SUCCESS : aap_protobuf::shared::MessageStatus::STATUS_INTERNAL_ERROR; - OPENAUTO_LOG(info) << "[MediaSourceService] Status determined: " << aap_protobuf::shared::MessageStatus_Name(status); + OPENAUTO_LOG(debug) << "[MediaSourceService] Status determined: " << aap_protobuf::shared::MessageStatus_Name(status); aap_protobuf::service::control::message::ChannelOpenResponse response; response.set_status(status); @@ -155,7 +155,7 @@ namespace f1x { */ void MediaSourceService::onMediaChannelAckIndication( const aap_protobuf::service::media::source::message::Ack &) { - OPENAUTO_LOG(info) << "[MediaSourceService] onMediaChannelAckIndication()"; + OPENAUTO_LOG(debug) << "[MediaSourceService] onMediaChannelAckIndication()"; channel_->receive(this->shared_from_this()); } @@ -163,15 +163,13 @@ namespace f1x { * Source Media Channel Handling */ - // 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 or Close Microphone Source Channel * @param request */ void MediaSourceService::onMediaSourceOpenRequest( const aap_protobuf::service::media::source::message::MicrophoneRequest &request) { - OPENAUTO_LOG(info) << "[MediaSourceService] onMediaChannelAckIndication()"; + OPENAUTO_LOG(info) << "[MediaSourceService] onMediaSourceOpenRequest()"; OPENAUTO_LOG(info) << "[MediaSourceService] Request to Open?: " << request.open() << ", anc: " << request.anc_enabled() << ", ec: " << request.ec_enabled() << ", max unacked: " << request.max_unacked(); if (request.open()) { @@ -260,7 +258,7 @@ namespace f1x { std::bind(&MediaSourceService::onMediaSourceDataReady, this->shared_from_this(), std::placeholders::_1), [this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[MediaSourceService] audio input read rejected."; + OPENAUTO_LOG(debug) << "[MediaSourceService] audio input read rejected."; }); audioInput_->read(std::move(readPromise)); diff --git a/src/autoapp/Service/PhoneStatus/PhoneStatusService.cpp b/src/autoapp/Service/PhoneStatus/PhoneStatusService.cpp index 99b4786..bb032d1 100644 --- a/src/autoapp/Service/PhoneStatus/PhoneStatusService.cpp +++ b/src/autoapp/Service/PhoneStatus/PhoneStatusService.cpp @@ -71,7 +71,7 @@ namespace f1x { void PhoneStatusService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { OPENAUTO_LOG(info) << "[PhoneStatusService] onChannelOpenRequest()"; - OPENAUTO_LOG(info) << "[PhoneStatusService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); + OPENAUTO_LOG(debug) << "[PhoneStatusService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); aap_protobuf::service::control::message::ChannelOpenResponse response; const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS; diff --git a/src/autoapp/Service/Pinger.cpp b/src/autoapp/Service/Pinger.cpp index 0d7ae56..72aca5a 100644 --- a/src/autoapp/Service/Pinger.cpp +++ b/src/autoapp/Service/Pinger.cpp @@ -51,7 +51,7 @@ void Pinger::ping(Promise::Pointer promise) else { ++pingsCount_; - OPENAUTO_LOG(info) << "[Pinger] Ping counter: " << pingsCount_; + OPENAUTO_LOG(debug) << "[Pinger] Ping counter: " << pingsCount_; promise_ = std::move(promise); timer_.expires_from_now(boost::posix_time::milliseconds(duration_)); @@ -64,7 +64,7 @@ void Pinger::pong() { strand_.dispatch([this, self = this->shared_from_this()]() { ++pongsCount_; - OPENAUTO_LOG(info) << "[Pinger] Pong counter: " << pongsCount_; + OPENAUTO_LOG(debug) << "[Pinger] Pong counter: " << pongsCount_; }); } diff --git a/src/autoapp/Service/Radio/RadioService.cpp b/src/autoapp/Service/Radio/RadioService.cpp index 6c8587f..b4d3c54 100644 --- a/src/autoapp/Service/Radio/RadioService.cpp +++ b/src/autoapp/Service/Radio/RadioService.cpp @@ -71,7 +71,7 @@ namespace f1x { void RadioService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { OPENAUTO_LOG(info) << "[RadioService] onChannelOpenRequest()"; - OPENAUTO_LOG(info) << "[RadioService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); + OPENAUTO_LOG(debug) << "[RadioService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); aap_protobuf::service::control::message::ChannelOpenResponse response; diff --git a/src/autoapp/Service/Sensor/SensorService.cpp b/src/autoapp/Service/Sensor/SensorService.cpp index f75e8aa..819ea31 100644 --- a/src/autoapp/Service/Sensor/SensorService.cpp +++ b/src/autoapp/Service/Sensor/SensorService.cpp @@ -91,7 +91,6 @@ namespace f1x { auto *service = response.add_channels(); service->set_id(static_cast(channel_->getId())); - // TODO: Add and Link other Sensors Here auto *sensorChannel = service->mutable_sensor_source_service(); sensorChannel->add_sensors()->set_sensor_type(aap_protobuf::service::sensorsource::message::SensorType::SENSOR_DRIVING_STATUS_DATA); sensorChannel->add_sensors()->set_sensor_type(aap_protobuf::service::sensorsource::message::SensorType::SENSOR_LOCATION); @@ -100,7 +99,7 @@ namespace f1x { void SensorService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { OPENAUTO_LOG(info) << "[SensorService] onChannelOpenRequest()"; - OPENAUTO_LOG(info) << "[SensorService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); + OPENAUTO_LOG(debug) << "[SensorService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); aap_protobuf::service::control::message::ChannelOpenResponse response; const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS; @@ -117,14 +116,13 @@ namespace f1x { void SensorService::onSensorStartRequest( const aap_protobuf::service::sensorsource::message::SensorRequest &request) { OPENAUTO_LOG(info) << "[SensorService] onSensorStartRequest()"; - OPENAUTO_LOG(info) << "[SensorService] Request Type: "<< request.type(); + OPENAUTO_LOG(debug) << "[SensorService] Request Type: "<< request.type(); aap_protobuf::service::sensorsource::message::SensorStartResponseMessage response; response.set_status(aap_protobuf::shared::MessageStatus::STATUS_SUCCESS); auto promise = aasdk::channel::SendPromise::defer(strand_); - // TODO: Convert to Switch? if (request.type() == aap_protobuf::service::sensorsource::message::SENSOR_DRIVING_STATUS_DATA) { promise->then(std::bind(&SensorService::sendDrivingStatusUnrestricted, this->shared_from_this()), @@ -151,7 +149,7 @@ namespace f1x { indication.add_driving_status_data()->set_status(aap_protobuf::service::sensorsource::message::DrivingStatus::DRIVE_STATUS_UNRESTRICTED); auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() { OPENAUTO_LOG(info) << "[SensorService] SendPromise resolved successfully()"; }, + promise->then([]() { }, std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1)); channel_->sendSensorEventIndication(indication, std::move(promise)); } diff --git a/src/autoapp/Service/WifiProjection/WifiProjectionStatus.cpp b/src/autoapp/Service/WifiProjection/WifiProjectionStatus.cpp index 7b3f74b..d4956c3 100644 --- a/src/autoapp/Service/WifiProjection/WifiProjectionStatus.cpp +++ b/src/autoapp/Service/WifiProjection/WifiProjectionStatus.cpp @@ -20,6 +20,7 @@ #include #include #include +#include namespace f1x { namespace openauto { @@ -66,21 +67,21 @@ namespace f1x { service->set_id(static_cast(channel_->getId())); auto *wifiChannel = service->mutable_wifi_projection_service(); - wifiChannel->set_car_wifi_bssid(""); // TODO: Temporarily disabled and populating with empty string. + wifiChannel->set_car_wifi_bssid(QNetworkInterface::interfaceFromName("wlan0").hardwareAddress().toStdString()); } void WifiProjectionService::onWifiCredentialsRequest( const aap_protobuf::service::wifiprojection::message::WifiCredentialsRequest &request) { + OPENAUTO_LOG(info) << "[WifiProjectionService] onWifiCredentialsRequest()"; + aap_protobuf::service::wifiprojection::message::WifiCredentialsResponse response; - response.set_access_point_type(aap_protobuf::service::wifiprojection::message::AccessPointType::DYNAMIC); - response.set_car_wifi_password("1234567890"); + response.set_access_point_type(aap_protobuf::service::wifiprojection::message::AccessPointType::STATIC); response.set_car_wifi_ssid("CRANKSHAFT-NG"); + response.set_car_wifi_password("1234567890"); response.set_car_wifi_security_mode(aap_protobuf::service::wifiprojection::message::WifiSecurityMode::WPA2_PERSONAL); - OPENAUTO_LOG(info) << "[WifiProjectionService] onWifiCredentialsRequest()"; - auto promise = aasdk::channel::SendPromise::defer(strand_); promise->then([]() {}, std::bind(&WifiProjectionService::onChannelError, this->shared_from_this(), std::placeholders::_1)); @@ -91,8 +92,7 @@ namespace f1x { void WifiProjectionService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { OPENAUTO_LOG(info) << "[WifiProjectionService] onChannelOpenRequest()"; - OPENAUTO_LOG(info) << "[WifiProjectionService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); - + OPENAUTO_LOG(debug) << "[WifiProjectionService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); aap_protobuf::service::control::message::ChannelOpenResponse response; const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS; diff --git a/src/autoapp/autoapp.cpp b/src/autoapp/autoapp.cpp index 43095ce..1fb0569 100644 --- a/src/autoapp/autoapp.cpp +++ b/src/autoapp/autoapp.cpp @@ -38,8 +38,6 @@ #include #include -//namespace aap_protobuf = aap_protobuf; -//namespace aasdk = aasdk; namespace autoapp = f1x::openauto::autoapp; using ThreadPool = std::vector; @@ -77,7 +75,7 @@ int main(int argc, char* argv[]) libusb_context* usbContext; if(libusb_init(&usbContext) != 0) { - OPENAUTO_LOG(error) << "[OpenAuto] libusb init failed."; + OPENAUTO_LOG(error) << "[AutoApp] libusb init failed."; return 1; } @@ -90,8 +88,8 @@ int main(int argc, char* argv[]) QApplication qApplication(argc, argv); const int width = QApplication::desktop()->width(); const int height = QApplication::desktop()->height(); - OPENAUTO_LOG(info) << "[OpenAuto] Display width: " << width; - OPENAUTO_LOG(info) << "[OpenAuto] Display height: " << height; + OPENAUTO_LOG(info) << "[AutoApp] Display width: " << width; + OPENAUTO_LOG(info) << "[AutoApp] Display height: " << height; auto configuration = std::make_shared(); @@ -139,57 +137,57 @@ int main(int argc, char* argv[]) QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraHide, [&qApplication]() { system("/opt/crankshaft/cameracontrol.py Background &"); - OPENAUTO_LOG(info) << "[Camera] Background."; + OPENAUTO_LOG(info) << "[AutoApp] Camera Background."; }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraShow, [&qApplication]() { system("/opt/crankshaft/cameracontrol.py Foreground &"); - OPENAUTO_LOG(info) << "[Camera] Foreground."; + OPENAUTO_LOG(info) << "[AutoApp] Camera Foreground."; }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraPosYUp, [&qApplication]() { system("/opt/crankshaft/cameracontrol.py PosYUp &"); - OPENAUTO_LOG(info) << "[Camera] PosY up."; + OPENAUTO_LOG(info) << "[AutoApp] Camera PosY up."; }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraPosYDown, [&qApplication]() { system("/opt/crankshaft/cameracontrol.py PosYDown &"); - OPENAUTO_LOG(info) << "[Camera] PosY down."; + OPENAUTO_LOG(info) << "[AutoApp] Camera PosY down."; }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraZoomPlus, [&qApplication]() { system("/opt/crankshaft/cameracontrol.py ZoomPlus &"); - OPENAUTO_LOG(info) << "[Camera] Zoom plus."; + OPENAUTO_LOG(info) << "[AutoApp] Camera Zoom plus."; }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraZoomMinus, [&qApplication]() { system("/opt/crankshaft/cameracontrol.py ZoomMinus &"); - OPENAUTO_LOG(info) << "[Camera] Zoom minus."; + OPENAUTO_LOG(info) << "[AutoApp] Camera Zoom minus."; }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraRecord, [&qApplication]() { system("/opt/crankshaft/cameracontrol.py Record &"); - OPENAUTO_LOG(info) << "[Camera] Record."; + OPENAUTO_LOG(info) << "[AutoApp] Camera Record."; }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraStop, [&qApplication]() { system("/opt/crankshaft/cameracontrol.py Stop &"); - OPENAUTO_LOG(info) << "[Camera] Stop."; + OPENAUTO_LOG(info) << "[AutoApp] Camera Stop."; }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraSave, [&qApplication]() { system("/opt/crankshaft/cameracontrol.py Save &"); - OPENAUTO_LOG(info) << "[Camera] Save."; + OPENAUTO_LOG(info) << "[AutoApp] Camera Save."; }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::TriggerScriptNight, [&qApplication]() { system("/opt/crankshaft/service_daynight.sh app night"); - OPENAUTO_LOG(info) << "[MainWindow] Night."; + OPENAUTO_LOG(info) << "[AutoApp] MainWindow Night."; }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::TriggerScriptDay, [&qApplication]() { system("/opt/crankshaft/service_daynight.sh app day"); - OPENAUTO_LOG(info) << "[MainWindow] Day."; + OPENAUTO_LOG(info) << "[AutoApp] MainWindow Day."; }); mainWindow.showFullScreen(); @@ -211,20 +209,20 @@ int main(int argc, char* argv[]) }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::TriggerAppStart, [&app]() { - OPENAUTO_LOG(info) << "[Autoapp] TriggerAppStart: Manual start android auto."; + OPENAUTO_LOG(info) << "[AutoApp] TriggerAppStart: Manual start android auto."; try { app->disableAutostartEntity = false; app->resume(); app->waitForUSBDevice(); } catch (...) { - OPENAUTO_LOG(error) << "[Autoapp] TriggerAppStart: app->waitForUSBDevice();"; + OPENAUTO_LOG(error) << "[AutoApp] TriggerAppStart: app->waitForUSBDevice();"; } }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::TriggerAppStop, [&app]() { try { if (std::ifstream("/tmp/android_device")) { - OPENAUTO_LOG(info) << "[Autoapp] TriggerAppStop: Manual stop usb android auto."; + OPENAUTO_LOG(info) << "[AutoApp] TriggerAppStop: Manual stop usb android auto."; app->disableAutostartEntity = true; system("/usr/local/bin/autoapp_helper usbreset"); usleep(500000); @@ -232,11 +230,11 @@ int main(int argc, char* argv[]) app->stop(); //app->pause(); } catch (...) { - OPENAUTO_LOG(error) << "[Autoapp] TriggerAppStop: stop();"; + OPENAUTO_LOG(error) << "[AutoApp] TriggerAppStop: stop();"; } } else { - OPENAUTO_LOG(info) << "[Autoapp] TriggerAppStop: Manual stop wifi android auto."; + OPENAUTO_LOG(info) << "[AutoApp] TriggerAppStop: Manual stop wifi android auto."; try { app->onAndroidAutoQuit(); //app->pause(); @@ -246,7 +244,7 @@ int main(int argc, char* argv[]) } } catch (...) { - OPENAUTO_LOG(info) << "[Autoapp] Exception in manual stop android auto."; + OPENAUTO_LOG(info) << "[AutoApp] Exception in manual stop android auto."; } }); @@ -255,7 +253,7 @@ int main(int argc, char* argv[]) connectdialog.close(); warningdialog.close(); updatedialog.close(); - OPENAUTO_LOG(info) << "[Autoapp] Close all possible open dialogs."; + OPENAUTO_LOG(info) << "[AutoApp] Close all possible open dialogs."; }); if (configuration->hideWarning() == false) { diff --git a/src/btservice/AndroidBluetoothServer.cpp b/src/btservice/AndroidBluetoothServer.cpp index 96921dc..26c45f9 100644 --- a/src/btservice/AndroidBluetoothServer.cpp +++ b/src/btservice/AndroidBluetoothServer.cpp @@ -57,7 +57,8 @@ namespace f1x::openauto::btservice { aap_protobuf::service::wifiprojection::message::WifiCredentialsRequest request; // TODO: How do we ping back the Wireless Port and IP? //aap_protobuf::service::::WifiInfoRequest request; - //request.set_ip_address(getIP4_("wlan0")); + request.set_ip_address(getIP4_("wlan0")); + getIP4_() //request.set_port(5000); sendMessage(request, 1); From e669277eb4fed5088e43fd28aa9a137d81779d20 Mon Sep 17 00:00:00 2001 From: Simon Dean Date: Wed, 13 Nov 2024 15:10:14 +0000 Subject: [PATCH 07/14] Rename WifiProjectionStatus.cpp to WifiProjectionService.cpp --- .../{WifiProjectionStatus.cpp => WifiProjectionService.cpp} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/autoapp/Service/WifiProjection/{WifiProjectionStatus.cpp => WifiProjectionService.cpp} (100%) diff --git a/src/autoapp/Service/WifiProjection/WifiProjectionStatus.cpp b/src/autoapp/Service/WifiProjection/WifiProjectionService.cpp similarity index 100% rename from src/autoapp/Service/WifiProjection/WifiProjectionStatus.cpp rename to src/autoapp/Service/WifiProjection/WifiProjectionService.cpp From b327bd69b253542198d171c3b8727db73c32c823 Mon Sep 17 00:00:00 2001 From: Simon Dean Date: Thu, 21 Nov 2024 13:06:19 +0000 Subject: [PATCH 08/14] Added support for new services provided by AASDK and AAP Protocol version 1.6. Add extensive logging Add logo for forked version Resolve display issue where if Raspberry Pi thinks both HDMI and LCD are enabled, the display width is appearing as two side by side monitors (double width) rather than just using the physical width of the screen. --- CMakeLists.txt | 52 +++++++++++--- Readme.md => README.md | 0 RELEASE.txt | 7 ++ .../autoapp/Service/AndroidAutoEntity.hpp | 3 + .../Service/Bluetooth/BluetoothService.hpp | 4 ++ .../autoapp/Service/Sensor/SensorService.hpp | 2 + .../btservice/AndroidBluetoothServer.hpp | 69 ++++++++++--------- src/autoapp/App.cpp | 4 +- src/autoapp/Configuration/Configuration.cpp | 10 +-- .../Projection/LocalBluetoothDevice.cpp | 10 +-- src/autoapp/Projection/OMXVideoOutput.cpp | 6 +- src/autoapp/Projection/QtAudioInput.cpp | 2 +- src/autoapp/Projection/QtAudioOutput.cpp | 2 +- src/autoapp/Projection/QtVideoOutput.cpp | 3 +- src/autoapp/Projection/RtAudioOutput.cpp | 1 + src/autoapp/Service/AndroidAutoEntity.cpp | 58 +--------------- .../Service/Bluetooth/BluetoothService.cpp | 24 ++++++- .../InputSource/InputSourceService.cpp | 3 +- .../MediaSink/AudioMediaSinkService.cpp | 6 +- .../MediaSink/VideoMediaSinkService.cpp | 12 ++-- .../MediaSource/MediaSourceService.cpp | 4 +- src/autoapp/Service/Radio/RadioService.cpp | 8 +-- src/autoapp/Service/Sensor/SensorService.cpp | 3 +- src/autoapp/Service/ServiceFactory.cpp | 19 ++--- src/autoapp/UI/SettingsWindow.cpp | 2 + src/autoapp/autoapp.cpp | 35 +++++----- 26 files changed, 187 insertions(+), 162 deletions(-) rename Readme.md => README.md (100%) create mode 100644 RELEASE.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index a212b6e..f3618dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,21 +2,33 @@ cmake_minimum_required(VERSION 3.5.1) project(openauto CXX) +message(STATUS "OpenAuto") + +option(NOPI "Build for Non Raspberry Pi" OFF) + set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTORCC ON) # Set Compile Versions -set(OPENAUTO_BUILD_DATE 20241028) # Binary Release Build Date -set(OPENAUTO_BUILD_RELEASE 1) # Binary Release Build Number (increment if released on same day) -set(OPENAUTO_BUILD_INCREMENTAL 1) # Binary Build Version - Increment for Each Build +set(OPENAUTO_BUILD_DATE 20241121) # Binary Release Build Date +set(OPENAUTO_BUILD_MAJOR_RELEASE 4) # Binary Release Build Major Number +set(OPENAUTO_BUILD_MINOR_RELEASE 0) # Binary Release Build Minor Number +set(OPENAUTO_BUILD_INCREMENTAL 0) # Binary Build Version - Increment for Each Build # Configure CMAKE -SET(CMAKE_CXX_STANDARD 17) +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) + +# Default to Release mode unless overridden with -DCMAKE_BUILD_TYPE=Debug on cmake command +if(NOT CMAKE_BUILD_TYPE) + message(STATUS "Forcing Release build type") + set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) + # Set the possible values of build type for cmake-gui + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") +endif() # Paths set(resources_directory ${CMAKE_CURRENT_SOURCE_DIR}/assets) @@ -37,23 +49,29 @@ set(Boost_USE_STATIC_RUNTIME OFF) add_definitions(-DBOOST_ALL_DYN_LINK) +if(CMAKE_BUILD_TYPE STREQUAL "Release") + message(STATUS "Disabling Boost DEBUG logs") + add_definitions(-DNDEBUG) +endif() + if (WIN32) set(WINSOCK2_LIBRARIES "ws2_32") endif (WIN32) -add_definitions(-DRPI3_BUILD) - -if (RPI3_BUILD) - message(INFO "Compiling for RaspberryPi") +if (DEFINED NOPI) + message(STATUS "Configuring for Non-Raspberry Pi") +else() + message(STATUS "Configuring for RaspberryPi") add_definitions(-DUSE_OMX -DOMX_SKIP64BIT -DRASPBERRYPI3) set(BCM_HOST_LIBRARIES "/opt/vc/lib/libbcm_host.so") set(BCM_HOST_INCLUDE_DIRS "/opt/vc/include") set(ILCLIENT_INCLUDE_DIRS "/opt/vc/src/hello_pi/libs/ilclient") set(ILCLIENT_LIBRARIES "/opt/vc/src/hello_pi/libs/ilclient/libilclient.a;/opt/vc/lib/libvcos.so;/opt/vc/lib/libvcilcs.a;/opt/vc/lib/libvchiq_arm.so") -endif (RPI3_BUILD) +endif () # Building on a Mac requires Abseil if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") # macOS + message(STATUS "MacOS System Detected") add_definitions(-DMAC_OS) find_package(protobuf REQUIRED CONFIG) find_package(absl REQUIRED) @@ -125,7 +143,12 @@ target_link_libraries(autoapp PUBLIC ${AAP_PROTOBUF_LIB_DIR} ${AASDK_LIB_DIR}) +set(PROGRAM_VERSION_STRING "${OPENAUTO_BUILD_MAJOR_RELEASE}.${OPENAUTO_BUILD_MINOR_RELEASE}.${OPENAUTO_BUILD_INCREMENTAL}+${OPENAUTO_BUILD_DATE}") + +message(STATUS "Project Version: ${PROGRAM_VERSION_STRING}") + set(btservice_sources_directory ${sources_directory}/btservice) + set(btservice_include_directory ${include_directory}/f1x/openauto/btservice) file(GLOB_RECURSE btservice_source_files ${btservice_sources_directory}/*.cpp ${btservice_include_directory}/*.hpp ${autoapp_sources_directory}/Configuration/*.cpp ${autoapp_includes_directory}/Configuration/*.hpp ${common_include_directory}/*.hpp) @@ -138,3 +161,12 @@ target_link_libraries(btservice PUBLIC ${Qt5MultimediaWidgets_LIBRARIES} ${PROTOBUF_LIBRARIES} ${AAP_PROTOBUF_LIB_DIR}) + +set_target_properties(openauto + PROPERTIES VERSION ${LIBRARY_VERSION_STRING} SOVERSION ${LIBRARY_BUILD_INCREMENTAL}) + +# Install rules +install(TARGETS openauto btservice + EXPORT aasdkTargets + RUNTIME DESTINATION bin +) \ No newline at end of file diff --git a/Readme.md b/README.md similarity index 100% rename from Readme.md rename to README.md diff --git a/RELEASE.txt b/RELEASE.txt new file mode 100644 index 0000000..d82e1e3 --- /dev/null +++ b/RELEASE.txt @@ -0,0 +1,7 @@ +Release Notes + +20241121 - 4.0.0 +Added support for new services provided by AASDK and AAP Protocol version 1.6. +Add extensive logging +Add logo for forked version +Resolve display issue where if Raspberry Pi thinks both HDMI and LCD are enabled, the display width is appearing as two side by side monitors (double width) rather than just using the physical width of the screen. diff --git a/include/f1x/openauto/autoapp/Service/AndroidAutoEntity.hpp b/include/f1x/openauto/autoapp/Service/AndroidAutoEntity.hpp index b44d839..e8a8f8b 100644 --- a/include/f1x/openauto/autoapp/Service/AndroidAutoEntity.hpp +++ b/include/f1x/openauto/autoapp/Service/AndroidAutoEntity.hpp @@ -27,6 +27,9 @@ #include #include #include +#include +#include +#include namespace f1x { diff --git a/include/f1x/openauto/autoapp/Service/Bluetooth/BluetoothService.hpp b/include/f1x/openauto/autoapp/Service/Bluetooth/BluetoothService.hpp index cda49bb..84ce401 100644 --- a/include/f1x/openauto/autoapp/Service/Bluetooth/BluetoothService.hpp +++ b/include/f1x/openauto/autoapp/Service/Bluetooth/BluetoothService.hpp @@ -48,12 +48,16 @@ namespace f1x { void onBluetoothPairingRequest( const aap_protobuf::service::bluetooth::message::BluetoothPairingRequest &request) override; + void onBluetoothAuthenticationResult(const aap_protobuf::service::bluetooth::message::BluetoothAuthenticationResult &request) override; + void onChannelError(const aasdk::error::Error &e) override; private: using std::enable_shared_from_this::shared_from_this; + void sendBluetoothAuthenticationData(); + boost::asio::io_service::strand strand_; aasdk::channel::bluetooth::BluetoothService::Pointer channel_; projection::IBluetoothDevice::Pointer bluetoothDevice_; diff --git a/include/f1x/openauto/autoapp/Service/Sensor/SensorService.hpp b/include/f1x/openauto/autoapp/Service/Sensor/SensorService.hpp index 3e2f855..4f72cca 100644 --- a/include/f1x/openauto/autoapp/Service/Sensor/SensorService.hpp +++ b/include/f1x/openauto/autoapp/Service/Sensor/SensorService.hpp @@ -19,6 +19,8 @@ #pragma once #include +#include +#include #include #include #include diff --git a/include/f1x/openauto/btservice/AndroidBluetoothServer.hpp b/include/f1x/openauto/btservice/AndroidBluetoothServer.hpp index 2ecfd5b..24b4f7f 100644 --- a/include/f1x/openauto/btservice/AndroidBluetoothServer.hpp +++ b/include/f1x/openauto/btservice/AndroidBluetoothServer.hpp @@ -24,49 +24,56 @@ #include #include #include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include -namespace f1x -{ -namespace openauto -{ -namespace btservice -{ +namespace f1x { + namespace openauto { + namespace btservice { -class AndroidBluetoothServer: public QObject, public IAndroidBluetoothServer -{ - Q_OBJECT + class AndroidBluetoothServer : public QObject, public IAndroidBluetoothServer { + Q_OBJECT -public: - AndroidBluetoothServer(autoapp::configuration::IConfiguration::Pointer configuration); + public: + AndroidBluetoothServer(autoapp::configuration::IConfiguration::Pointer configuration); - uint16_t start(const QBluetoothAddress& address) override; + uint16_t start(const QBluetoothAddress &address) override; -private slots: - void onClientConnected(); + private slots: -private: - std::unique_ptr rfcommServer_; - QBluetoothSocket* socket = nullptr; - autoapp::configuration::IConfiguration::Pointer configuration_; + void onClientConnected(); - void readSocket(); + private: + std::unique_ptr rfcommServer_; + QBluetoothSocket *socket = nullptr; + autoapp::configuration::IConfiguration::Pointer configuration_; - QByteArray buffer; + void readSocket(); - void handleWifiInfoRequest(QByteArray &buffer, uint16_t length); + QByteArray buffer; - void sendMessage(const google::protobuf::Message &message, uint16_t type); + void handleWifiInfoRequest(QByteArray &buffer, uint16_t length); - void handleWifiSecurityRequest(QByteArray &buffer, uint16_t length); + void handleWifiVersionResponse(QByteArray &buffer, uint16_t length); - void handleWifiInfoRequestResponse(QByteArray &buffer, uint16_t length); + void handleWifiConnectionStatus(QByteArray &buffer, uint16_t length); - const ::std::string getIP4_(const QString intf); -}; + void handleWifiStartResponse(QByteArray &buffer, uint16_t length); -} -} + void sendMessage(const google::protobuf::Message &message, uint16_t type); + + + const ::std::string getIP4_(const QString intf); + + void DecodeProtoMessage(const std::string &proto_data); + }; + + } + } } diff --git a/src/autoapp/App.cpp b/src/autoapp/App.cpp index 65d575d..dc77ae3 100644 --- a/src/autoapp/App.cpp +++ b/src/autoapp/App.cpp @@ -198,7 +198,7 @@ void App::waitForDevice() void App::startServerSocket() { strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "Listening for WIFI clients on port 5000"; + OPENAUTO_LOG(info) << "startServerSocket() - Listening for WIFI Clients on Port 5000"; auto socket = std::make_shared(ioService_); acceptor_.async_accept( *socket, @@ -208,7 +208,7 @@ void App::startServerSocket() { } void App::handleNewClient(std::shared_ptr socket, const boost::system::error_code &err) { - OPENAUTO_LOG(info) << "WIFI Client connected"; + OPENAUTO_LOG(info) << "handleNewClient() - Handle WIFI Client Connection"; if (!err) { start(std::move(socket)); } diff --git a/src/autoapp/Configuration/Configuration.cpp b/src/autoapp/Configuration/Configuration.cpp index a62a845..2c99c1f 100644 --- a/src/autoapp/Configuration/Configuration.cpp +++ b/src/autoapp/Configuration/Configuration.cpp @@ -615,7 +615,7 @@ QString Configuration::getCSValue(QString searchString) const int equalPosition = line.find("="); QString value = line.substr(equalPosition + 1).c_str(); value.replace("\"",""); - OPENAUTO_LOG(info) << "[Configuration] CS param found: " << searchString.toStdString() << " Value:" << value.toStdString(); + OPENAUTO_LOG(debug) << "[Configuration] CS param found: " << searchString.toStdString() << " Value:" << value.toStdString(); return value; } } @@ -632,7 +632,7 @@ QString Configuration::getCSValue(QString searchString) const int equalPosition = line.find("="); QString value = line.substr(equalPosition + 1).c_str(); value.replace("\"",""); - OPENAUTO_LOG(info) << "[Configuration] CS param found: " << searchString.toStdString() << " Value:" << value.toStdString(); + OPENAUTO_LOG(debug) << "[Configuration] CS param found: " << searchString.toStdString() << " Value:" << value.toStdString(); return value; } } @@ -652,7 +652,7 @@ QString Configuration::getCSValue(QString searchString) const int equalPosition = line.find("="); QString value = line.substr(equalPosition + 1).c_str(); value.replace("\"",""); - OPENAUTO_LOG(info) << "[Configuration] CS param found: " << searchString.toStdString() << " Value:" << value.toStdString(); + OPENAUTO_LOG(debug) << "[Configuration] CS param found: " << searchString.toStdString() << " Value:" << value.toStdString(); return value; } } @@ -663,7 +663,7 @@ QString Configuration::getCSValue(QString searchString) const QString Configuration::getParamFromFile(QString fileName, QString searchString) const { - OPENAUTO_LOG(info) << "[Configuration] Request param from file: " << fileName.toStdString() << " param: " << searchString.toStdString(); + OPENAUTO_LOG(debug) << "[Configuration] Request param from file: " << fileName.toStdString() << " param: " << searchString.toStdString(); using namespace std; ifstream inFile; string line; @@ -685,7 +685,7 @@ QString Configuration::getParamFromFile(QString fileName, QString searchString) int equalPosition = line.find("="); QString value = line.substr(equalPosition + 1).c_str(); value.replace("\"",""); - OPENAUTO_LOG(info) << "[Configuration] Param from file: " << fileName.toStdString() << " found: " << searchString.toStdString() << " Value:" << value.toStdString(); + OPENAUTO_LOG(debug) << "[Configuration] Param from file: " << fileName.toStdString() << " found: " << searchString.toStdString() << " Value:" << value.toStdString(); return value; } } diff --git a/src/autoapp/Projection/LocalBluetoothDevice.cpp b/src/autoapp/Projection/LocalBluetoothDevice.cpp index 58eb52d..6c24d71 100644 --- a/src/autoapp/Projection/LocalBluetoothDevice.cpp +++ b/src/autoapp/Projection/LocalBluetoothDevice.cpp @@ -42,7 +42,7 @@ LocalBluetoothDevice::LocalBluetoothDevice() void LocalBluetoothDevice::createBluetoothLocalDevice() { - OPENAUTO_LOG(debug) << "[LocalBluetoothDevice] create."; + OPENAUTO_LOG(info) << "[LocalBluetoothDevice] create."; localDevice_ = std::make_unique(QBluetoothAddress()); @@ -118,7 +118,7 @@ void LocalBluetoothDevice::onStartPairing(const QString& address, PairingPromise void LocalBluetoothDevice::onPairingDisplayConfirmation(const QBluetoothAddress &address, QString pin) { - OPENAUTO_LOG(debug) << "[LocalBluetoothDevice] onPairingDisplayConfirmation, address: " << address.toString().toStdString() + OPENAUTO_LOG(info) << "[LocalBluetoothDevice] onPairingDisplayConfirmation, address: " << address.toString().toStdString() << ", pin: " << pin.toStdString(); std::lock_guard lock(mutex_); @@ -127,7 +127,7 @@ void LocalBluetoothDevice::onPairingDisplayConfirmation(const QBluetoothAddress void LocalBluetoothDevice::onPairingDisplayPinCode(const QBluetoothAddress &address, QString pin) { - OPENAUTO_LOG(debug) << "[LocalBluetoothDevice] onPairingDisplayPinCode, address: " << address.toString().toStdString() + OPENAUTO_LOG(info) << "[LocalBluetoothDevice] onPairingDisplayPinCode, address: " << address.toString().toStdString() << ", pin: " << pin.toStdString(); std::lock_guard lock(mutex_); @@ -136,7 +136,7 @@ void LocalBluetoothDevice::onPairingDisplayPinCode(const QBluetoothAddress &addr void LocalBluetoothDevice::onPairingFinished(const QBluetoothAddress &address, QBluetoothLocalDevice::Pairing pairing) { - OPENAUTO_LOG(debug) << "[LocalBluetoothDevice] onPairingDisplayPinCode, address: " << address.toString().toStdString() + OPENAUTO_LOG(info) << "[LocalBluetoothDevice] onPairingDisplayPinCode, address: " << address.toString().toStdString() << ", pin: " << pairing; std::lock_guard lock(mutex_); @@ -159,7 +159,7 @@ void LocalBluetoothDevice::onPairingFinished(const QBluetoothAddress &address, Q void LocalBluetoothDevice::onError(QBluetoothLocalDevice::Error error) { - OPENAUTO_LOG(debug) << "[LocalBluetoothDevice] onError, error: " << error; + OPENAUTO_LOG(warning) << "[LocalBluetoothDevice] onError, error: " << error; std::lock_guard lock(mutex_); diff --git a/src/autoapp/Projection/OMXVideoOutput.cpp b/src/autoapp/Projection/OMXVideoOutput.cpp index 6a46380..bfdd9d3 100644 --- a/src/autoapp/Projection/OMXVideoOutput.cpp +++ b/src/autoapp/Projection/OMXVideoOutput.cpp @@ -58,7 +58,7 @@ bool OMXVideoOutput::open() { std::lock_guard lock(mutex_); - OPENAUTO_LOG(info) << "[OMXVideoOutput] open."; + OPENAUTO_LOG(debug) << "[OMXVideoOutput] open."; bcm_host_init(); if(OMX_Init() != OMX_ErrorNone) @@ -102,7 +102,7 @@ bool OMXVideoOutput::init() { std::lock_guard lock(mutex_); - OPENAUTO_LOG(info) << "[OMXVideoOutput] init, state: " << isActive_; + OPENAUTO_LOG(debug) << "[OMXVideoOutput] init, state: " << isActive_; ilclient_change_component_state(components_[VideoComponent::DECODER], OMX_StateExecuting); return this->setupDisplayRegion(); @@ -179,7 +179,7 @@ void OMXVideoOutput::write(uint64_t timestamp, const aasdk::common::DataConstBuf void OMXVideoOutput::stop() { - OPENAUTO_LOG(info) << "[OMXVideoOutput] stop."; + OPENAUTO_LOG(debug) << "[OMXVideoOutput] stop."; std::lock_guard lock(mutex_); diff --git a/src/autoapp/Projection/QtAudioInput.cpp b/src/autoapp/Projection/QtAudioInput.cpp index 1558430..0bb2680 100644 --- a/src/autoapp/Projection/QtAudioInput.cpp +++ b/src/autoapp/Projection/QtAudioInput.cpp @@ -49,7 +49,7 @@ QtAudioInput::QtAudioInput(uint32_t channelCount, uint32_t sampleSize, uint32_t void QtAudioInput::createAudioInput() { - OPENAUTO_LOG(debug) << "[AudioInput] create."; + OPENAUTO_LOG(info) << "[AudioInput] createAudioInput()"; audioInput_ = (std::make_unique(QAudioDeviceInfo::defaultInputDevice(), audioFormat_)); } diff --git a/src/autoapp/Projection/QtAudioOutput.cpp b/src/autoapp/Projection/QtAudioOutput.cpp index d6d1401..3b541c7 100644 --- a/src/autoapp/Projection/QtAudioOutput.cpp +++ b/src/autoapp/Projection/QtAudioOutput.cpp @@ -54,7 +54,7 @@ QtAudioOutput::QtAudioOutput(uint32_t channelCount, uint32_t sampleSize, uint32_ void QtAudioOutput::createAudioOutput() { - OPENAUTO_LOG(debug) << "[QtAudioOutput] create."; + OPENAUTO_LOG(info) << "[QtAudioOutput] createAudioOutput()"; audioOutput_ = std::make_unique(QAudioDeviceInfo::defaultOutputDevice(), audioFormat_); } diff --git a/src/autoapp/Projection/QtVideoOutput.cpp b/src/autoapp/Projection/QtVideoOutput.cpp index 42da94a..9a6dbde 100644 --- a/src/autoapp/Projection/QtVideoOutput.cpp +++ b/src/autoapp/Projection/QtVideoOutput.cpp @@ -40,7 +40,7 @@ QtVideoOutput::QtVideoOutput(configuration::IConfiguration::Pointer configuratio void QtVideoOutput::createVideoOutput() { - OPENAUTO_LOG(debug) << "[QtVideoOutput] create."; + OPENAUTO_LOG(info) << "[QtVideoOutput] createVideoOutput()"; videoWidget_ = std::make_unique(); mediaPlayer_ = std::make_unique(nullptr, QMediaPlayer::StreamPlayback); } @@ -79,6 +79,7 @@ void QtVideoOutput::onStartPlayback() mediaPlayer_->setMedia(QMediaContent(), &videoBuffer_); mediaPlayer_->play(); + // TODO: This only outputs a line if there's an error - FIXME - Output a proper status instead OPENAUTO_LOG(debug) << "Player error state -> " << mediaPlayer_->errorString().toStdString(); } diff --git a/src/autoapp/Projection/RtAudioOutput.cpp b/src/autoapp/Projection/RtAudioOutput.cpp index aa12a8a..f97b204 100644 --- a/src/autoapp/Projection/RtAudioOutput.cpp +++ b/src/autoapp/Projection/RtAudioOutput.cpp @@ -60,6 +60,7 @@ bool RtAudioOutput::open() } catch(const RtAudioError& e) { + // TODO: Later version of RtAudio uses a different mechanism - FIXME - support new versions OPENAUTO_LOG(error) << "[RtAudioOutput] Failed to open audio output, what: " << e.what(); } } diff --git a/src/autoapp/Service/AndroidAutoEntity.cpp b/src/autoapp/Service/AndroidAutoEntity.cpp index 0f35cd7..74d968d 100644 --- a/src/autoapp/Service/AndroidAutoEntity.cpp +++ b/src/autoapp/Service/AndroidAutoEntity.cpp @@ -16,64 +16,10 @@ * along with openauto. If not, see . */ -#include -#include -#include -#include -#include -#include #include #include #include -/* - * HU > MD Version Request - * HU < MD ServiceDiscoveryRequest ** - * HU > MD Car MetaData (Make, Model, year etc) ** - * HU < MD when Video Projection starts, it MUST be shown without User Ineraction *********** - * HU < MD Prompt Use to Enable and Pair with Car *********** - * HU < MD Request Video Focus for Projection (HU Grant) *********** - * - * AAP needs Bluetooth HFP for Telephone - * - * HU > MD Bluetooth Announcement (HU MAC Address, Supported Pairing Methods) Done as Service Discovery - * HU < MD Bluetooth Pairing Request *********** - * HU > MD Bluetoth Pairing Response*********** - * - * AfterPairing, HU can request the Bluetooth PhoneBookAccessProtocol. Sensible UI. - * - * HU < MD connect to Bluetooth HFP*********** - * HU Suppress BAP or MAP while AAP connected.*********** - * A2DP should be treated by OEM as another such such as a USB stick or radio. If the user plays music via AA, HU should grant request from AA to change focus to AA. HU manages connectivity., *********** - * MD connects to HU and routes call over Bluetooth (non Bluetooth call) *********** - * MD connects Blueooth call and display projection mode *********** - * MD on call to HFP device - MD continues call, disconnects from other HFP and connects to HFP on Vehicle. *********** - * AA only uses HFP, hhowever HU may use MAP, PBAP, PAN and RSAP *********** - * MD will reconnect when required. *********** - * - * Video - * HU < MD - During Service Discovery, MD requests Video Configs supported - * HU > MD sends Config Message with Prioritised indices for Video Conffigurations - * HU < MD MD selects config - * HU < MD sends start message - * HU < MD sends focus request - * HU > MD sends focus granted (unless unsafe - ie reverse camera etc) - * HU < MD Audio Focus Requests when MD wants to play. - * HU > MD Audio Focus Navigations (can be unsolicited or responses to requests) - * HU < MD VoiceSessionRequestNotification with VOICE_SESSION_START, HU should stop all sounds. MD will request GAIN or GAIN_TRANS to play beeps/tones and ASR response. - * Nav Focus for onboard navigation. - * UI System Sounds does not require audio focus as sounds should be played ASAP. System Stream is optionals (not required to support). - * HU should wait to receive two frames of audio before starting playback to minimise buffer underruns. - * AA Latency types supported - Audio Setup - max 500ms, Audio Output max 50ms. - * HU > MD Navigation Focus Notification specified with NF is Phone or Car. - * HU < MD Navigation Focus Request - * "For vehicles that support next turn information in the instrument cluster, the HU can subscribe to next turn updates from the MD navigation engine." (NExt Turn etc) - * same for Media Playback Status - * Radio - Allows Control of Radio from Within AA. - * Vehicle IDs SHOULD have at least 64 bits - */ - - namespace f1x { namespace openauto { namespace autoapp { @@ -369,7 +315,7 @@ namespace f1x { } void AndroidAutoEntity::onChannelError(const aasdk::error::Error &e) { - OPENAUTO_LOG(error) << "[AndroidAutoEntity] onChannelError(): " << e.what(); + OPENAUTO_LOG(fatal) << "[AndroidAutoEntity] onChannelError(): " << e.what(); this->triggerQuit(); } @@ -381,7 +327,7 @@ namespace f1x { } void AndroidAutoEntity::schedulePing() { - OPENAUTO_LOG(debug) << "[AndroidAutoEntity] schedulePing()"; + OPENAUTO_LOG(info) << "[AndroidAutoEntity] schedulePing()"; auto promise = IPinger::Promise::defer(strand_); promise->then([this, self = this->shared_from_this()]() { this->sendPing(); diff --git a/src/autoapp/Service/Bluetooth/BluetoothService.cpp b/src/autoapp/Service/Bluetooth/BluetoothService.cpp index 5be2117..4e6dbc4 100644 --- a/src/autoapp/Service/Bluetooth/BluetoothService.cpp +++ b/src/autoapp/Service/Bluetooth/BluetoothService.cpp @@ -65,7 +65,7 @@ namespace f1x { OPENAUTO_LOG(info) << "[BluetoothService] fillFeatures()"; if (bluetoothDevice_->isAvailable()) { - OPENAUTO_LOG(debug) << "[BluetoothService] Local Address: " << bluetoothDevice_->getLocalAddress(); + OPENAUTO_LOG(info) << "[BluetoothService] Local Address: " << bluetoothDevice_->getLocalAddress(); auto *service = response.add_channels(); service->set_id(static_cast(channel_->getId())); @@ -101,7 +101,7 @@ namespace f1x { void BluetoothService::onBluetoothPairingRequest( const aap_protobuf::service::bluetooth::message::BluetoothPairingRequest &request) { OPENAUTO_LOG(info) << "[BluetoothService] onBluetoothPairingRequest()"; - OPENAUTO_LOG(debug) << "[BluetoothService] Phone Address: " << request.phone_address(); + OPENAUTO_LOG(info) << "[BluetoothService] Phone Address: " << request.phone_address(); aap_protobuf::service::bluetooth::message::BluetoothPairingResponse response; @@ -122,9 +122,27 @@ namespace f1x { response.set_already_paired(isPaired); auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() {}, std::bind(&BluetoothService::onChannelError, this->shared_from_this(), + promise->then(std::bind(&BluetoothService::sendBluetoothAuthenticationData, this->shared_from_this()), std::bind(&BluetoothService::onChannelError, this->shared_from_this(), std::placeholders::_1)); channel_->sendBluetoothPairingResponse(response, std::move(promise)); + channel_->receive(this->shared_from_this()); + } + + void BluetoothService::sendBluetoothAuthenticationData() { + aap_protobuf::service::bluetooth::message::BluetoothAuthenticationData data; + data.set_auth_data("123456"); + data.set_pairing_method(aap_protobuf::service::bluetooth::message::BluetoothPairingMethod::BLUETOOTH_PAIRING_PIN); + auto promise = aasdk::channel::SendPromise::defer(strand_); + promise->then([]() {}, std::bind(&BluetoothService::onChannelError, this->shared_from_this(), + std::placeholders::_1)); + channel_->sendBluetoothAuthenticationData(data, std::move(promise)); + channel_->receive(this->shared_from_this()); + } + + void BluetoothService::onBluetoothAuthenticationResult(const aap_protobuf::service::bluetooth::message::BluetoothAuthenticationResult &request) { + OPENAUTO_LOG(info) << "[BluetoothService] onBluetoothAuthenticationResult()"; + OPENAUTO_LOG(info) << "[BluetoothService] AuthData " << request.status(); + aap_protobuf::service::bluetooth::message::BluetoothPairingResponse response; channel_->receive(this->shared_from_this()); } diff --git a/src/autoapp/Service/InputSource/InputSourceService.cpp b/src/autoapp/Service/InputSource/InputSourceService.cpp index 47e7b21..49325b6 100644 --- a/src/autoapp/Service/InputSource/InputSourceService.cpp +++ b/src/autoapp/Service/InputSource/InputSourceService.cpp @@ -16,7 +16,6 @@ * along with openauto. If not, see . */ -#include #include #include @@ -101,7 +100,7 @@ namespace f1x { } void InputSourceService::onKeyBindingRequest(const aap_protobuf::service::media::sink::message::KeyBindingRequest &request) { - OPENAUTO_LOG(info) << "[InputSourceService] onKeyBindingRequest()"; + OPENAUTO_LOG(debug) << "[InputSourceService] onKeyBindingRequest()"; OPENAUTO_LOG(debug) << "[InputSourceService] KeyCodes Count: " << request.keycodes_size(); aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS; diff --git a/src/autoapp/Service/MediaSink/AudioMediaSinkService.cpp b/src/autoapp/Service/MediaSink/AudioMediaSinkService.cpp index fff4de7..d3467cd 100644 --- a/src/autoapp/Service/MediaSink/AudioMediaSinkService.cpp +++ b/src/autoapp/Service/MediaSink/AudioMediaSinkService.cpp @@ -130,7 +130,7 @@ namespace f1x { 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() << ", Audio Channels: " << audioOutput_->getChannelCount(); + OPENAUTO_LOG(info) << "[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 @@ -185,8 +185,8 @@ namespace f1x { } void AudioMediaSinkService::onMediaChannelStopIndication(const aap_protobuf::service::media::shared::message::Stop &indication) { - OPENAUTO_LOG(debug) << "[AudioMediaSinkService] onMediaChannelStopIndication()"; - OPENAUTO_LOG(debug) << "[AudioMediaSinkService] Channel Id: " << 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(); diff --git a/src/autoapp/Service/MediaSink/VideoMediaSinkService.cpp b/src/autoapp/Service/MediaSink/VideoMediaSinkService.cpp index b1dc2f8..6ca6f20 100644 --- a/src/autoapp/Service/MediaSink/VideoMediaSinkService.cpp +++ b/src/autoapp/Service/MediaSink/VideoMediaSinkService.cpp @@ -91,11 +91,11 @@ namespace f1x { videoConfig1->set_width_margin(videoMargins.width()); videoConfig1->set_density(videoOutput_->getScreenDPI()); - OPENAUTO_LOG(debug) << "[VideoMediaSinkService] getVideoResolution " << VideoCodecResolutionType_Name(videoOutput_->getVideoResolution()); - OPENAUTO_LOG(debug) << "[VideoMediaSinkService] getVideoFPS " << VideoFrameRateType_Name(videoOutput_->getVideoFPS()); - OPENAUTO_LOG(debug) << "[VideoMediaSinkService] width " << videoMargins.width(); - OPENAUTO_LOG(debug) << "[VideoMediaSinkService] height " << videoMargins.height(); - OPENAUTO_LOG(debug) << "[VideoMediaSinkService] getScreenDPI " << videoOutput_->getScreenDPI(); + OPENAUTO_LOG(info) << "[VideoMediaSinkService] getVideoResolution " << VideoCodecResolutionType_Name(videoOutput_->getVideoResolution()); + OPENAUTO_LOG(info) << "[VideoMediaSinkService] getVideoFPS " << VideoFrameRateType_Name(videoOutput_->getVideoFPS()); + OPENAUTO_LOG(info) << "[VideoMediaSinkService] width " << videoMargins.width(); + OPENAUTO_LOG(info) << "[VideoMediaSinkService] height " << videoMargins.height(); + OPENAUTO_LOG(info) << "[VideoMediaSinkService] getScreenDPI " << videoOutput_->getScreenDPI(); } void @@ -110,7 +110,7 @@ namespace f1x { ? aap_protobuf::service::media::shared::message::Config::STATUS_READY : aap_protobuf::service::media::shared::message::Config::STATUS_WAIT; - OPENAUTO_LOG(info) << "[VideoMediaSinkService] setup status: " << Config_Status_Name(status); + OPENAUTO_LOG(debug) << "[VideoMediaSinkService] setup status: " << Config_Status_Name(status); aap_protobuf::service::media::shared::message::Config response; response.set_status(status); diff --git a/src/autoapp/Service/MediaSource/MediaSourceService.cpp b/src/autoapp/Service/MediaSource/MediaSourceService.cpp index a2e857b..3481f69 100644 --- a/src/autoapp/Service/MediaSource/MediaSourceService.cpp +++ b/src/autoapp/Service/MediaSource/MediaSourceService.cpp @@ -100,7 +100,7 @@ namespace f1x { ? aap_protobuf::shared::MessageStatus::STATUS_SUCCESS : aap_protobuf::shared::MessageStatus::STATUS_INTERNAL_ERROR; - OPENAUTO_LOG(debug) << "[MediaSourceService] Status determined: " << aap_protobuf::shared::MessageStatus_Name(status); + OPENAUTO_LOG(info) << "[MediaSourceService] Status determined: " << aap_protobuf::shared::MessageStatus_Name(status); aap_protobuf::service::control::message::ChannelOpenResponse response; response.set_status(status); @@ -251,7 +251,7 @@ namespace f1x { * Reads audio from a MediaSource (eg Microphone). Promise resolves to onMediaSourceDataReady. */ void MediaSourceService::readMediaSource() { - OPENAUTO_LOG(error) << "[MediaSourceService] readMediaSource()"; + OPENAUTO_LOG(debug) << "[MediaSourceService] readMediaSource()"; if (audioInput_->isActive()) { auto readPromise = projection::IAudioInput::ReadPromise::defer(strand_); readPromise->then( diff --git a/src/autoapp/Service/Radio/RadioService.cpp b/src/autoapp/Service/Radio/RadioService.cpp index b4d3c54..e4b2372 100644 --- a/src/autoapp/Service/Radio/RadioService.cpp +++ b/src/autoapp/Service/Radio/RadioService.cpp @@ -37,25 +37,25 @@ namespace f1x { void RadioService::start() { strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[RadioService] start()"; + OPENAUTO_LOG(debug) << "[RadioService] start()"; }); } void RadioService::stop() { strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[RadioService] stop()"; + OPENAUTO_LOG(debug) << "[RadioService] stop()"; }); } void RadioService::pause() { strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[RadioService] pause()"; + OPENAUTO_LOG(debug) << "[RadioService] pause()"; }); } void RadioService::resume() { strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[RadioService] resume()"; + OPENAUTO_LOG(debug) << "[RadioService] resume()"; }); } diff --git a/src/autoapp/Service/Sensor/SensorService.cpp b/src/autoapp/Service/Sensor/SensorService.cpp index 819ea31..493f4c2 100644 --- a/src/autoapp/Service/Sensor/SensorService.cpp +++ b/src/autoapp/Service/Sensor/SensorService.cpp @@ -16,8 +16,7 @@ * along with openauto. If not, see . */ -#include -#include + #include #include #include diff --git a/src/autoapp/Service/ServiceFactory.cpp b/src/autoapp/Service/ServiceFactory.cpp index b397466..4a51dc8 100644 --- a/src/autoapp/Service/ServiceFactory.cpp +++ b/src/autoapp/Service/ServiceFactory.cpp @@ -69,7 +69,7 @@ namespace f1x { serviceList.emplace_back(this->createSensorService(messenger)); serviceList.emplace_back(this->createBluetoothService(messenger)); serviceList.emplace_back(this->createInputService(messenger)); - serviceList.emplace_back(this->createWifiProjectionService(messenger)); + //serviceList.emplace_back(this->createWifiProjectionService(messenger)); return serviceList; } @@ -79,20 +79,20 @@ namespace f1x { projection::IBluetoothDevice::Pointer bluetoothDevice; switch (configuration_->getBluetoothAdapterType()) { case configuration::BluetoothAdapterType::LOCAL: - OPENAUTO_LOG(info) << "[ServiceFactory] Local Bluetooth"; + OPENAUTO_LOG(info) << "[ServiceFactory] Using Local Bluetooth Adapter"; 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"; + OPENAUTO_LOG(debug) << "[ServiceFactory] Using Remote Bluetooth Adapter"; bluetoothDevice = std::make_shared( configuration_->getBluetoothRemoteAdapterAddress()); break; default: - OPENAUTO_LOG(info) << "[ServiceFactory] Dummy Bluetooth"; + OPENAUTO_LOG(debug) << "[ServiceFactory] Using Dummy Bluetooth"; bluetoothDevice = std::make_shared(); break; } @@ -151,7 +151,8 @@ namespace f1x { std::bind(&QObject::deleteLater, std::placeholders::_1)); serviceList.emplace_back( - std::make_shared(ioService_, messenger, std::move(guidanceAudioOutput))); + std::make_shared(ioService_, messenger, + std::move(guidanceAudioOutput))); } if (configuration_->telephonyAudioChannelEnabled()) { @@ -162,8 +163,9 @@ namespace f1x { projection::IAudioOutput::Pointer(new projection::QtAudioOutput(1, 16, 16000), std::bind(&QObject::deleteLater, std::placeholders::_1)); - // serviceList.emplace_back( - // std::make_shared(ioService_, messenger, std::move(telephonyAudioOutput))); + serviceList.emplace_back( + std::make_shared(ioService_, messenger, + std::move(telephonyAudioOutput))); } /* @@ -197,7 +199,8 @@ namespace f1x { 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(ioService_, messenger, std::move(audioInput))); + serviceList.emplace_back(std::make_shared(ioService_, messenger, + std::move(audioInput))); } IService::Pointer ServiceFactory::createSensorService(aasdk::messenger::IMessenger::Pointer messenger) { diff --git a/src/autoapp/UI/SettingsWindow.cpp b/src/autoapp/UI/SettingsWindow.cpp index 80f4e64..f07a0b3 100644 --- a/src/autoapp/UI/SettingsWindow.cpp +++ b/src/autoapp/UI/SettingsWindow.cpp @@ -263,6 +263,7 @@ namespace f1x { configuration_->setMusicAudioChannelEnabled(ui_->checkBoxMusicAudioChannel->isChecked()); configuration_->setGuidanceAudioChannelEnabled(ui_->checkBoxSpeechAudioChannel->isChecked()); + configuration_->setTelephonyAudioChannelEnabled(ui_->checkBoxVoiceAudioChannel->isChecked()); configuration_->setAudioOutputBackendType( ui_->radioButtonRtAudio->isChecked() ? configuration::AudioOutputBackendType::RTAUDIO : configuration::AudioOutputBackendType::QT); @@ -547,6 +548,7 @@ namespace f1x { ui_->checkBoxMusicAudioChannel->setChecked(configuration_->musicAudioChannelEnabled()); ui_->checkBoxSpeechAudioChannel->setChecked(configuration_->guidanceAudioChannelEnabled()); + ui_->telephonyAudioChannelEnabled->setChecked(configuration_->guidanceAudioChannelEnabled()); const auto &audioOutputBackendType = configuration_->getAudioOutputBackendType(); ui_->radioButtonRtAudio->setChecked(audioOutputBackendType == configuration::AudioOutputBackendType::RTAUDIO); diff --git a/src/autoapp/autoapp.cpp b/src/autoapp/autoapp.cpp index 1fb0569..154f10b 100644 --- a/src/autoapp/autoapp.cpp +++ b/src/autoapp/autoapp.cpp @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -75,7 +76,7 @@ int main(int argc, char* argv[]) libusb_context* usbContext; if(libusb_init(&usbContext) != 0) { - OPENAUTO_LOG(error) << "[AutoApp] libusb init failed."; + OPENAUTO_LOG(error) << "[AutoApp] libusb_init failed."; return 1; } @@ -137,57 +138,57 @@ int main(int argc, char* argv[]) QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraHide, [&qApplication]() { system("/opt/crankshaft/cameracontrol.py Background &"); - OPENAUTO_LOG(info) << "[AutoApp] Camera Background."; + OPENAUTO_LOG(debug) << "[AutoApp] Camera Background."; }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraShow, [&qApplication]() { system("/opt/crankshaft/cameracontrol.py Foreground &"); - OPENAUTO_LOG(info) << "[AutoApp] Camera Foreground."; + OPENAUTO_LOG(debug) << "[AutoApp] Camera Foreground."; }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraPosYUp, [&qApplication]() { system("/opt/crankshaft/cameracontrol.py PosYUp &"); - OPENAUTO_LOG(info) << "[AutoApp] Camera PosY up."; + OPENAUTO_LOG(debug) << "[AutoApp] Camera PosY up."; }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraPosYDown, [&qApplication]() { system("/opt/crankshaft/cameracontrol.py PosYDown &"); - OPENAUTO_LOG(info) << "[AutoApp] Camera PosY down."; + OPENAUTO_LOG(debug) << "[AutoApp] Camera PosY down."; }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraZoomPlus, [&qApplication]() { system("/opt/crankshaft/cameracontrol.py ZoomPlus &"); - OPENAUTO_LOG(info) << "[AutoApp] Camera Zoom plus."; + OPENAUTO_LOG(debug) << "[AutoApp] Camera Zoom plus."; }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraZoomMinus, [&qApplication]() { system("/opt/crankshaft/cameracontrol.py ZoomMinus &"); - OPENAUTO_LOG(info) << "[AutoApp] Camera Zoom minus."; + OPENAUTO_LOG(debug) << "[AutoApp] Camera Zoom minus."; }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraRecord, [&qApplication]() { system("/opt/crankshaft/cameracontrol.py Record &"); - OPENAUTO_LOG(info) << "[AutoApp] Camera Record."; + OPENAUTO_LOG(debug) << "[AutoApp] Camera Record."; }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraStop, [&qApplication]() { system("/opt/crankshaft/cameracontrol.py Stop &"); - OPENAUTO_LOG(info) << "[AutoApp] Camera Stop."; + OPENAUTO_LOG(debug) << "[AutoApp] Camera Stop."; }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraSave, [&qApplication]() { system("/opt/crankshaft/cameracontrol.py Save &"); - OPENAUTO_LOG(info) << "[AutoApp] Camera Save."; + OPENAUTO_LOG(debug) << "[AutoApp] Camera Save."; }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::TriggerScriptNight, [&qApplication]() { system("/opt/crankshaft/service_daynight.sh app night"); - OPENAUTO_LOG(info) << "[AutoApp] MainWindow Night."; + OPENAUTO_LOG(debug) << "[AutoApp] MainWindow Night."; }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::TriggerScriptDay, [&qApplication]() { system("/opt/crankshaft/service_daynight.sh app day"); - OPENAUTO_LOG(info) << "[AutoApp] MainWindow Day."; + OPENAUTO_LOG(debug) << "[AutoApp] MainWindow Day."; }); mainWindow.showFullScreen(); @@ -209,7 +210,7 @@ int main(int argc, char* argv[]) }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::TriggerAppStart, [&app]() { - OPENAUTO_LOG(info) << "[AutoApp] TriggerAppStart: Manual start android auto."; + OPENAUTO_LOG(debug) << "[AutoApp] TriggerAppStart: Manual start android auto."; try { app->disableAutostartEntity = false; app->resume(); @@ -222,7 +223,7 @@ int main(int argc, char* argv[]) QObject::connect(&mainWindow, &autoapp::ui::MainWindow::TriggerAppStop, [&app]() { try { if (std::ifstream("/tmp/android_device")) { - OPENAUTO_LOG(info) << "[AutoApp] TriggerAppStop: Manual stop usb android auto."; + OPENAUTO_LOG(debug) << "[AutoApp] TriggerAppStop: Manual stop usb android auto."; app->disableAutostartEntity = true; system("/usr/local/bin/autoapp_helper usbreset"); usleep(500000); @@ -234,7 +235,7 @@ int main(int argc, char* argv[]) } } else { - OPENAUTO_LOG(info) << "[AutoApp] TriggerAppStop: Manual stop wifi android auto."; + OPENAUTO_LOG(debug) << "[AutoApp] TriggerAppStop: Manual stop wifi android auto."; try { app->onAndroidAutoQuit(); //app->pause(); @@ -244,7 +245,7 @@ int main(int argc, char* argv[]) } } catch (...) { - OPENAUTO_LOG(info) << "[AutoApp] Exception in manual stop android auto."; + OPENAUTO_LOG(error) << "[AutoApp] Exception in manual stop android auto."; } }); @@ -253,7 +254,7 @@ int main(int argc, char* argv[]) connectdialog.close(); warningdialog.close(); updatedialog.close(); - OPENAUTO_LOG(info) << "[AutoApp] Close all possible open dialogs."; + OPENAUTO_LOG(debug) << "[AutoApp] Close all possible open dialogs."; }); if (configuration->hideWarning() == false) { From 7f38e16983e3468cad8f53c23bb4f3209fe457f7 Mon Sep 17 00:00:00 2001 From: Simon Dean Date: Thu, 21 Nov 2024 13:06:48 +0000 Subject: [PATCH 09/14] Resolve display issue where if Raspberry Pi thinks both HDMI and LCD are enabled, the display width is appearing as two side by side monitors (double width) rather than just using the physical width of the screen. --- src/autoapp/autoapp.cpp | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/autoapp/autoapp.cpp b/src/autoapp/autoapp.cpp index 154f10b..8678ced 100644 --- a/src/autoapp/autoapp.cpp +++ b/src/autoapp/autoapp.cpp @@ -87,11 +87,31 @@ int main(int argc, char* argv[]) startIOServiceWorkers(ioService, threadPool); QApplication qApplication(argc, argv); - const int width = QApplication::desktop()->width(); - const int height = QApplication::desktop()->height(); + int width = QApplication::desktop()->width(); + int height = QApplication::desktop()->height(); + + for (QScreen *screen : qApplication.screens()) { + OPENAUTO_LOG(info) << "[AutoApp] Screen name: " << screen->name().toStdString(); + OPENAUTO_LOG(info) << "[AutoApp] Screen geometry: " << screen->geometry().width(); // This includes position and size + OPENAUTO_LOG(info) << "[AutoApp] Screen physical size: " << screen->physicalSize().width(); // Size in millimeters + } + + QScreen *primaryScreen = QGuiApplication::primaryScreen(); + + // Check if a primary screen was found + if (primaryScreen) { + // Get the geometry of the primary screen + QRect screenGeometry = primaryScreen->geometry(); + width = screenGeometry.width(); + height = screenGeometry.height(); + OPENAUTO_LOG(info) << "[AutoApp] Using gemoetry from primary screen."; + } else { + OPENAUTO_LOG(info) << "[AutoApp] Unable to find primary screen, using default values."; + } + OPENAUTO_LOG(info) << "[AutoApp] Display width: " << width; OPENAUTO_LOG(info) << "[AutoApp] Display height: " << height; - + auto configuration = std::make_shared(); autoapp::ui::MainWindow mainWindow(configuration); From 478526b9539f03328b48c1621ec3cf8e4c78e790 Mon Sep 17 00:00:00 2001 From: Simon Dean Date: Wed, 27 Nov 2024 09:53:07 +0000 Subject: [PATCH 10/14] Reformat Code --- ...apterType.hpp => BluetoothAdapterType.hpp} | 17 +- .../Projection/LocalBluetoothDevice.hpp | 16 +- .../f1x/openauto/autoapp/Service/IService.hpp | 31 +- .../autoapp/Service/Sensor/SensorService.hpp | 86 +- .../f1x/openauto/autoapp/Service/Service.hpp | 35 +- .../VendorExtensionService.hpp | 58 +- .../WifiProjection/WifiProjectionService.hpp | 63 +- .../openauto/autoapp/UI/SettingsWindow.hpp | 14 +- src/autoapp/App.cpp | 333 ++- src/autoapp/Configuration/Configuration.cpp | 17 +- .../Projection/DummyBluetoothDevice.cpp | 17 +- .../Projection/LocalBluetoothDevice.cpp | 13 +- .../Service/Bluetooth/BluetoothService.cpp | 215 +- .../GenericNotificationService.cpp | 136 +- .../MediaSink/GuidanceAudioService.cpp | 36 +- .../Service/MediaSink/MediaAudioService.cpp | 32 +- .../Service/MediaSink/SystemAudioService.cpp | 31 +- .../MediaSource/MediaSourceService.cpp | 402 +-- .../MicrophoneMediaSourceService.cpp | 30 +- .../NavigationStatusService.cpp | 167 +- src/autoapp/Service/Pinger.cpp | 102 +- src/autoapp/Service/Radio/RadioService.cpp | 140 +- src/autoapp/Service/Sensor/SensorService.cpp | 438 ++-- src/autoapp/Service/ServiceFactory.cpp | 238 +- .../VendorExtensionService.cpp | 134 +- .../WifiProjection/WifiProjectionService.cpp | 182 +- src/autoapp/UI/SettingsWindow.cpp | 2332 +++++++++-------- 27 files changed, 2598 insertions(+), 2717 deletions(-) rename include/f1x/openauto/autoapp/Configuration/{BluetootAdapterType.hpp => BluetoothAdapterType.hpp} (86%) diff --git a/include/f1x/openauto/autoapp/Configuration/BluetootAdapterType.hpp b/include/f1x/openauto/autoapp/Configuration/BluetoothAdapterType.hpp similarity index 86% rename from include/f1x/openauto/autoapp/Configuration/BluetootAdapterType.hpp rename to include/f1x/openauto/autoapp/Configuration/BluetoothAdapterType.hpp index 8185411..9e9bab1 100644 --- a/include/f1x/openauto/autoapp/Configuration/BluetootAdapterType.hpp +++ b/include/f1x/openauto/autoapp/Configuration/BluetoothAdapterType.hpp @@ -18,17 +18,10 @@ #pragma once -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace configuration -{ -enum class BluetoothAdapterType -{ +namespace f1x::openauto::autoapp::configuration { + + enum class BluetoothAdapterType { NONE, LOCAL, REMOTE @@ -37,4 +30,6 @@ enum class BluetoothAdapterType } } } -} + + + diff --git a/include/f1x/openauto/autoapp/Projection/LocalBluetoothDevice.hpp b/include/f1x/openauto/autoapp/Projection/LocalBluetoothDevice.hpp index 68bc416..cc6fe5b 100644 --- a/include/f1x/openauto/autoapp/Projection/LocalBluetoothDevice.hpp +++ b/include/f1x/openauto/autoapp/Projection/LocalBluetoothDevice.hpp @@ -23,13 +23,7 @@ #pragma once -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace projection +namespace f1x::openauto::autoapp::projection { class LocalBluetoothDevice: public QObject, public IBluetoothDevice @@ -37,7 +31,7 @@ class LocalBluetoothDevice: public QObject, public IBluetoothDevice Q_OBJECT public: - LocalBluetoothDevice(); + LocalBluetoothDevice(const QString &adapterAddress = QString(), QObject *parent = nullptr); void stop() override; bool isPaired(const std::string& address) const override; @@ -68,6 +62,6 @@ private: }; } -} -} -} + + + diff --git a/include/f1x/openauto/autoapp/Service/IService.hpp b/include/f1x/openauto/autoapp/Service/IService.hpp index 9731894..e798ae1 100644 --- a/include/f1x/openauto/autoapp/Service/IService.hpp +++ b/include/f1x/openauto/autoapp/Service/IService.hpp @@ -24,32 +24,29 @@ #include #include -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace service -{ -class IService -{ -public: +namespace f1x::openauto::autoapp::service { + + class IService { + public: typedef std::shared_ptr Pointer; virtual ~IService() = default; virtual void start() = 0; + virtual void stop() = 0; + virtual void pause() = 0; + virtual void resume() = 0; - virtual void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse& response) = 0; -}; -typedef std::vector ServiceList; + virtual void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) = 0; + }; + + typedef std::vector ServiceList; } -} -} -} + + + diff --git a/include/f1x/openauto/autoapp/Service/Sensor/SensorService.hpp b/include/f1x/openauto/autoapp/Service/Sensor/SensorService.hpp index 4f72cca..b872c71 100644 --- a/include/f1x/openauto/autoapp/Service/Sensor/SensorService.hpp +++ b/include/f1x/openauto/autoapp/Service/Sensor/SensorService.hpp @@ -26,60 +26,60 @@ #include #include -namespace f1x { - namespace openauto { - namespace autoapp { - namespace service { - namespace sensor { - class SensorService : - public aasdk::channel::sensorsource::ISensorSourceServiceEventHandler, - public IService, - public std::enable_shared_from_this { - public: - SensorService(boost::asio::io_service &ioService, - aasdk::messenger::IMessenger::Pointer messenger); - bool isNight = false; - bool previous = false; - bool stopPolling = false; +namespace f1x::openauto::autoapp::service::sensor { + class SensorService : + public aasdk::channel::sensorsource::ISensorSourceServiceEventHandler, + public IService, + public std::enable_shared_from_this { + public: + SensorService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger); - void start() override; - void stop() override; - void pause() override; - void resume() override; - void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; + bool isNight = false; + bool previous = false; + bool stopPolling = false; - void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override; + void start() override; - void onSensorStartRequest( - const aap_protobuf::service::sensorsource::message::SensorRequest &request) override; + void stop() override; - void onChannelError(const aasdk::error::Error &e) override; + void pause() override; - private: - using std::enable_shared_from_this::shared_from_this; + void resume() override; - void sendDrivingStatusUnrestricted(); + void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; - void sendNightData(); + void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override; - void sendGPSLocationData(); + void onSensorStartRequest( + const aap_protobuf::service::sensorsource::message::SensorRequest &request) override; - bool is_file_exist(const char *filename); + void onChannelError(const aasdk::error::Error &e) override; - void sensorPolling(); + private: + using std::enable_shared_from_this::shared_from_this; + + void sendDrivingStatusUnrestricted(); + + void sendNightData(); + + void sendGPSLocationData(); + + bool is_file_exist(const char *filename); + + void sensorPolling(); + + bool firstRun = true; + + boost::asio::deadline_timer timer_; + boost::asio::io_service::strand strand_; + aasdk::channel::sensorsource::SensorSourceService::Pointer channel_; + struct gps_data_t gpsData_; + bool gpsEnabled_ = false; + }; + +} - bool firstRun = true; - boost::asio::deadline_timer timer_; - boost::asio::io_service::strand strand_; - aasdk::channel::sensorsource::SensorSourceService::Pointer channel_; - struct gps_data_t gpsData_; - bool gpsEnabled_ = false; - }; - } - } - } - } -} \ No newline at end of file diff --git a/include/f1x/openauto/autoapp/Service/Service.hpp b/include/f1x/openauto/autoapp/Service/Service.hpp index 7157f2b..7cd3d22 100644 --- a/include/f1x/openauto/autoapp/Service/Service.hpp +++ b/include/f1x/openauto/autoapp/Service/Service.hpp @@ -22,33 +22,26 @@ #include #include -namespace f1x { - namespace openauto { - namespace autoapp { - namespace service { +namespace f1x::openauto::autoapp::service { - class Service - : public IService { - public: - Service(boost::asio::io_service &ioService); + class Service + : public IService { + public: + Service(boost::asio::io_service &ioService); - void start() override; + void start() override; - void stop() override; + void stop() override; - void pause() override; + void pause() override; - void resume() override; + void resume() override; - void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; + void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; - private: + private: - boost::asio::io_service::strand strand_; + boost::asio::io_service::strand strand_; - }; - } - } - } - } -} \ No newline at end of file + }; +} diff --git a/include/f1x/openauto/autoapp/Service/VendorExtension/VendorExtensionService.hpp b/include/f1x/openauto/autoapp/Service/VendorExtension/VendorExtensionService.hpp index 88db0eb..df90afe 100644 --- a/include/f1x/openauto/autoapp/Service/VendorExtension/VendorExtensionService.hpp +++ b/include/f1x/openauto/autoapp/Service/VendorExtension/VendorExtensionService.hpp @@ -23,39 +23,39 @@ #include #include -namespace f1x { - namespace openauto { - namespace autoapp { - namespace service { - namespace vendorextension { - class VendorExtensionService : - public aasdk::channel::vendorextension::IVendorExtensionServiceEventHandler, - public IService, - public std::enable_shared_from_this { - public: - VendorExtensionService(boost::asio::io_service &ioService, aasdk::messenger::IMessenger::Pointer messenger); +namespace f1x::openauto::autoapp::service::vendorextension { - void start() override; - void stop() override; - void pause() override; - void resume() override; - void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; + class VendorExtensionService : + public aasdk::channel::vendorextension::IVendorExtensionServiceEventHandler, + public IService, + public std::enable_shared_from_this { + public: + VendorExtensionService(boost::asio::io_service &ioService, aasdk::messenger::IMessenger::Pointer messenger); - void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override; + void start() override; - void onChannelError(const aasdk::error::Error &e) override; + void stop() override; + + void pause() override; + + void resume() override; + + void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; + + void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override; + + void onChannelError(const aasdk::error::Error &e) override; + + + private: + using std::enable_shared_from_this::shared_from_this; + boost::asio::deadline_timer timer_; + boost::asio::io_service::strand strand_; + aasdk::channel::vendorextension::VendorExtensionService::Pointer channel_; + }; + +} - private: - using std::enable_shared_from_this::shared_from_this; - boost::asio::deadline_timer timer_; - boost::asio::io_service::strand strand_; - aasdk::channel::vendorextension::VendorExtensionService::Pointer channel_; - }; - } - } - } - } -} \ No newline at end of file diff --git a/include/f1x/openauto/autoapp/Service/WifiProjection/WifiProjectionService.hpp b/include/f1x/openauto/autoapp/Service/WifiProjection/WifiProjectionService.hpp index 322732e..3b0bd5f 100644 --- a/include/f1x/openauto/autoapp/Service/WifiProjection/WifiProjectionService.hpp +++ b/include/f1x/openauto/autoapp/Service/WifiProjection/WifiProjectionService.hpp @@ -23,41 +23,42 @@ #include #include -namespace f1x { - namespace openauto { - namespace autoapp { - namespace service { - namespace wifiprojection { - class WifiProjectionService : - public aasdk::channel::wifiprojection::IWifiProjectionServiceEventHandler, - public IService, - public std::enable_shared_from_this { - public: - WifiProjectionService(boost::asio::io_service &ioService, aasdk::messenger::IMessenger::Pointer messenger); +namespace f1x::openauto::autoapp::service::wifiprojection { - void start() override; - void stop() override; - void pause() override; - void resume() override; - void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; + class WifiProjectionService : + public aasdk::channel::wifiprojection::IWifiProjectionServiceEventHandler, + public IService, + public std::enable_shared_from_this { + public: + WifiProjectionService(boost::asio::io_service &ioService, aasdk::messenger::IMessenger::Pointer messenger); - void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override; + void start() override; - void onChannelError(const aasdk::error::Error &e) override; + void stop() override; + + void pause() override; + + void resume() override; + + void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; + + void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override; + + void onChannelError(const aasdk::error::Error &e) override; + + void + onWifiCredentialsRequest( + const aap_protobuf::service::wifiprojection::message::WifiCredentialsRequest &request) override; + + private: + using std::enable_shared_from_this::shared_from_this; + boost::asio::deadline_timer timer_; + boost::asio::io_service::strand strand_; + aasdk::channel::wifiprojection::WifiProjectionService::Pointer channel_; + }; + +} - void - onWifiCredentialsRequest(const aap_protobuf::service::wifiprojection::message::WifiCredentialsRequest &request) override; - private: - using std::enable_shared_from_this::shared_from_this; - boost::asio::deadline_timer timer_; - boost::asio::io_service::strand strand_; - aasdk::channel::wifiprojection::WifiProjectionService::Pointer channel_; - }; - } - } - } - } -} \ No newline at end of file diff --git a/include/f1x/openauto/autoapp/UI/SettingsWindow.hpp b/include/f1x/openauto/autoapp/UI/SettingsWindow.hpp index 03d7dbc..bedaad4 100644 --- a/include/f1x/openauto/autoapp/UI/SettingsWindow.hpp +++ b/include/f1x/openauto/autoapp/UI/SettingsWindow.hpp @@ -35,13 +35,7 @@ namespace Ui class SettingsWindow; } -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace ui +namespace f1x::openauto::autoapp::ui { class SettingsWindow : public QWidget @@ -112,6 +106,6 @@ private: }; } -} -} -} + + + diff --git a/src/autoapp/App.cpp b/src/autoapp/App.cpp index dc77ae3..751c7cd 100644 --- a/src/autoapp/App.cpp +++ b/src/autoapp/App.cpp @@ -22,171 +22,145 @@ #include #include -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ +namespace f1x::openauto::autoapp { -App::App(boost::asio::io_service& ioService, aasdk::usb::USBWrapper& usbWrapper, aasdk::tcp::ITCPWrapper& tcpWrapper, service::IAndroidAutoEntityFactory& androidAutoEntityFactory, - aasdk::usb::IUSBHub::Pointer usbHub, aasdk::usb::IConnectedAccessoriesEnumerator::Pointer connectedAccessoriesEnumerator) - : ioService_(ioService) - , usbWrapper_(usbWrapper) - , tcpWrapper_(tcpWrapper) - , strand_(ioService_) - , androidAutoEntityFactory_(androidAutoEntityFactory) - , usbHub_(std::move(usbHub)) - , connectedAccessoriesEnumerator_(std::move(connectedAccessoriesEnumerator)) - , acceptor_(ioService, boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), 5000 )) - , isStopped_(false) -{ + App::App(boost::asio::io_service &ioService, aasdk::usb::USBWrapper &usbWrapper, aasdk::tcp::ITCPWrapper &tcpWrapper, + service::IAndroidAutoEntityFactory &androidAutoEntityFactory, + aasdk::usb::IUSBHub::Pointer usbHub, + aasdk::usb::IConnectedAccessoriesEnumerator::Pointer connectedAccessoriesEnumerator) + : ioService_(ioService), usbWrapper_(usbWrapper), tcpWrapper_(tcpWrapper), strand_(ioService_), + androidAutoEntityFactory_(androidAutoEntityFactory), usbHub_(std::move(usbHub)), + connectedAccessoriesEnumerator_(std::move(connectedAccessoriesEnumerator)), + acceptor_(ioService, boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), 5000)), isStopped_(false) { -} + } -void App::waitForUSBDevice() -{ + void App::waitForUSBDevice() { strand_.dispatch([this, self = this->shared_from_this()]() { - try - { - this->waitForDevice(); - } - catch(...) - { - OPENAUTO_LOG(error) << "[App] waitForUSBDevice() -exception caused by this->waitForDevice();"; - } - try - { - this->enumerateDevices(); - } - catch(...) - { - OPENAUTO_LOG(error) << "[App] waitForUSBDevice() exception caused by this->enumerateDevices()"; - } + try { + this->waitForDevice(); + } + catch (...) { + OPENAUTO_LOG(error) << "[App] waitForUSBDevice() -exception caused by this->waitForDevice();"; + } + try { + this->enumerateDevices(); + } + catch (...) { + OPENAUTO_LOG(error) << "[App] waitForUSBDevice() exception caused by this->enumerateDevices()"; + } }); -} + } -void App::start(aasdk::tcp::ITCPEndpoint::SocketPointer socket) -{ + void App::start(aasdk::tcp::ITCPEndpoint::SocketPointer socket) { strand_.dispatch([this, self = this->shared_from_this(), socket = std::move(socket)]() mutable { - OPENAUTO_LOG(info) << "Start from socket"; - if(androidAutoEntity_ != nullptr) - { + OPENAUTO_LOG(info) << "Start from socket"; + if (androidAutoEntity_ != nullptr) { // tcpWrapper_.close(*socket); // OPENAUTO_LOG(warning) << "[App] android auto entity is still running."; // return; - try { - androidAutoEntity_->stop(); - } catch (...) { - OPENAUTO_LOG(error) << "[App] onAndroidAutoQuit: exception caused by androidAutoEntity_->stop();"; - } - try { - androidAutoEntity_.reset(); - } catch (...) { - OPENAUTO_LOG(error) << "[App] onAndroidAutoQuit: exception caused by androidAutoEntity_.reset();"; - } + try { + androidAutoEntity_->stop(); + } catch (...) { + OPENAUTO_LOG(error) << "[App] onAndroidAutoQuit: exception caused by androidAutoEntity_->stop();"; } + try { + androidAutoEntity_.reset(); + } catch (...) { + OPENAUTO_LOG(error) << "[App] onAndroidAutoQuit: exception caused by androidAutoEntity_.reset();"; + } + } - try - { + try { // usbHub_->cancel(); // connectedAccessoriesEnumerator_->cancel(); - auto tcpEndpoint(std::make_shared(tcpWrapper_, std::move(socket))); - androidAutoEntity_ = androidAutoEntityFactory_.create(std::move(tcpEndpoint)); - androidAutoEntity_->start(*this); - } - catch(const aasdk::error::Error& error) - { - OPENAUTO_LOG(error) << "[App] TCP AndroidAutoEntity create error: " << error.what(); + auto tcpEndpoint(std::make_shared(tcpWrapper_, std::move(socket))); + androidAutoEntity_ = androidAutoEntityFactory_.create(std::move(tcpEndpoint)); + androidAutoEntity_->start(*this); + } + catch (const aasdk::error::Error &error) { + OPENAUTO_LOG(error) << "[App] TCP AndroidAutoEntity create error: " << error.what(); - //androidAutoEntity_.reset(); - this->waitForDevice(); - } + //androidAutoEntity_.reset(); + this->waitForDevice(); + } }); -} + } -void App::stop() -{ + void App::stop() { strand_.dispatch([this, self = this->shared_from_this()]() { - isStopped_ = true; - try { - connectedAccessoriesEnumerator_->cancel(); - } catch (...) { - OPENAUTO_LOG(error) << "[App] stop: exception caused by connectedAccessoriesEnumerator_->cancel()"; - } - try { - usbHub_->cancel(); - } catch (...) { - OPENAUTO_LOG(error) << "[App] stop: exception caused by usbHub_->cancel();"; - } + isStopped_ = true; + try { + connectedAccessoriesEnumerator_->cancel(); + } catch (...) { + OPENAUTO_LOG(error) << "[App] stop: exception caused by connectedAccessoriesEnumerator_->cancel()"; + } + try { + usbHub_->cancel(); + } catch (...) { + OPENAUTO_LOG(error) << "[App] stop: exception caused by usbHub_->cancel();"; + } - if(androidAutoEntity_ != nullptr) - { - try { - androidAutoEntity_->stop(); - } catch (...) { - OPENAUTO_LOG(error) << "[App] stop: exception caused by androidAutoEntity_->stop();"; - } - try { - androidAutoEntity_.reset(); - } catch (...) { - OPENAUTO_LOG(error) << "[App] stop: exception caused by androidAutoEntity_.reset();"; - } + if (androidAutoEntity_ != nullptr) { + try { + androidAutoEntity_->stop(); + } catch (...) { + OPENAUTO_LOG(error) << "[App] stop: exception caused by androidAutoEntity_->stop();"; } + try { + androidAutoEntity_.reset(); + } catch (...) { + OPENAUTO_LOG(error) << "[App] stop: exception caused by androidAutoEntity_.reset();"; + } + } }); -} + } -void App::aoapDeviceHandler(aasdk::usb::DeviceHandle deviceHandle) -{ + void App::aoapDeviceHandler(aasdk::usb::DeviceHandle deviceHandle) { OPENAUTO_LOG(info) << "[App] Device connected."; - if(androidAutoEntity_ != nullptr) - { - OPENAUTO_LOG(warning) << "[App] android auto entity is still running."; - return; + if (androidAutoEntity_ != nullptr) { + OPENAUTO_LOG(warning) << "[App] android auto entity is still running."; + return; } - try - { - // ignore autostart if exit to csng was used - if (!disableAutostartEntity) { - OPENAUTO_LOG(info) << "[App] Start Android Auto allowed - let's go."; - connectedAccessoriesEnumerator_->cancel(); + try { + // ignore autostart if exit to csng was used + if (!disableAutostartEntity) { + OPENAUTO_LOG(info) << "[App] Start Android Auto allowed - let's go."; + connectedAccessoriesEnumerator_->cancel(); - auto aoapDevice(aasdk::usb::AOAPDevice::create(usbWrapper_, ioService_, deviceHandle)); - androidAutoEntity_ = androidAutoEntityFactory_.create(std::move(aoapDevice)); - androidAutoEntity_->start(*this); - } else { - OPENAUTO_LOG(info) << "[App] Start Android Auto not allowed - skip."; - } + auto aoapDevice(aasdk::usb::AOAPDevice::create(usbWrapper_, ioService_, deviceHandle)); + androidAutoEntity_ = androidAutoEntityFactory_.create(std::move(aoapDevice)); + androidAutoEntity_->start(*this); + } else { + OPENAUTO_LOG(info) << "[App] Start Android Auto not allowed - skip."; + } } - catch(const aasdk::error::Error& error) - { - OPENAUTO_LOG(error) << "[App] USB AndroidAutoEntity create error: " << error.what(); + catch (const aasdk::error::Error &error) { + OPENAUTO_LOG(error) << "[App] USB AndroidAutoEntity create error: " << error.what(); - androidAutoEntity_.reset(); - this->waitForDevice(); + androidAutoEntity_.reset(); + this->waitForDevice(); } -} + } -void App::enumerateDevices() -{ + void App::enumerateDevices() { auto promise = aasdk::usb::IConnectedAccessoriesEnumerator::Promise::defer(strand_); promise->then([this, self = this->shared_from_this()](auto result) { - OPENAUTO_LOG(info) << "[App] Devices enumeration result: " << result; - }, - [this, self = this->shared_from_this()](auto e) { - OPENAUTO_LOG(error) << "[App] Devices enumeration failed: " << e.what(); - }); + OPENAUTO_LOG(info) << "[App] Devices enumeration result: " << result; + }, + [this, self = this->shared_from_this()](auto e) { + OPENAUTO_LOG(error) << "[App] Devices enumeration failed: " << e.what(); + }); connectedAccessoriesEnumerator_->enumerate(std::move(promise)); -} + } -void App::waitForDevice() -{ + void App::waitForDevice() { OPENAUTO_LOG(info) << "[App] Waiting for device..."; auto promise = aasdk::usb::IUSBHub::Promise::defer(strand_); @@ -194,80 +168,75 @@ void App::waitForDevice() std::bind(&App::onUSBHubError, this->shared_from_this(), std::placeholders::_1)); usbHub_->start(std::move(promise)); startServerSocket(); -} + } -void App::startServerSocket() { + void App::startServerSocket() { strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "startServerSocket() - Listening for WIFI Clients on Port 5000"; - auto socket = std::make_shared(ioService_); - acceptor_.async_accept( - *socket, - std::bind(&App::handleNewClient, this, socket, std::placeholders::_1) - ); + OPENAUTO_LOG(info) << "startServerSocket() - Listening for WIFI Clients on Port 5000"; + auto socket = std::make_shared(ioService_); + acceptor_.async_accept( + *socket, + std::bind(&App::handleNewClient, this, socket, std::placeholders::_1) + ); }); -} + } -void App::handleNewClient(std::shared_ptr socket, const boost::system::error_code &err) { + void + App::handleNewClient(std::shared_ptr socket, const boost::system::error_code &err) { OPENAUTO_LOG(info) << "handleNewClient() - Handle WIFI Client Connection"; if (!err) { - start(std::move(socket)); + start(std::move(socket)); } -} + } -void App::pause() -{ + void App::pause() { strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[App] pause..."; - androidAutoEntity_->pause(); + OPENAUTO_LOG(info) << "[App] pause..."; + androidAutoEntity_->pause(); }); -} + } -void App::resume() -{ + void App::resume() { strand_.dispatch([this, self = this->shared_from_this()]() { - if(androidAutoEntity_ != nullptr) - { - OPENAUTO_LOG(info) << "[App] resume..."; - androidAutoEntity_->resume(); - } else { - OPENAUTO_LOG(info) << "[App] Ignore resume -> no androidAutoEntity_ ..."; - } + if (androidAutoEntity_ != nullptr) { + OPENAUTO_LOG(info) << "[App] resume..."; + androidAutoEntity_->resume(); + } else { + OPENAUTO_LOG(info) << "[App] Ignore resume -> no androidAutoEntity_ ..."; + } }); -} + } -void App::onAndroidAutoQuit() -{ + void App::onAndroidAutoQuit() { strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[App] onAndroidAutoQuit()"; + OPENAUTO_LOG(info) << "[App] onAndroidAutoQuit()"; - //acceptor_.close(); + //acceptor_.close(); - if (androidAutoEntity_ != nullptr) { - try { - androidAutoEntity_->stop(); - } catch (...) { - OPENAUTO_LOG(error) << "[App] onAndroidAutoQuit: exception caused by androidAutoEntity_->stop();"; - } - try { - androidAutoEntity_.reset(); - } catch (...) { - OPENAUTO_LOG(error) << "[App] onAndroidAutoQuit: exception caused by androidAutoEntity_.reset();"; - } + if (androidAutoEntity_ != nullptr) { + try { + androidAutoEntity_->stop(); + } catch (...) { + OPENAUTO_LOG(error) << "[App] onAndroidAutoQuit: exception caused by androidAutoEntity_->stop();"; } - - if(!isStopped_) - { - try { - this->waitForDevice(); - } catch (...) { - OPENAUTO_LOG(error) << "[App] onAndroidAutoQuit: exception caused by this->waitForDevice();"; - } + try { + androidAutoEntity_.reset(); + } catch (...) { + OPENAUTO_LOG(error) << "[App] onAndroidAutoQuit: exception caused by androidAutoEntity_.reset();"; } + } + + if (!isStopped_) { + try { + this->waitForDevice(); + } catch (...) { + OPENAUTO_LOG(error) << "[App] onAndroidAutoQuit: exception caused by this->waitForDevice();"; + } + } }); -} + } -void App::onUSBHubError(const aasdk::error::Error& error) -{ + void App::onUSBHubError(const aasdk::error::Error &error) { OPENAUTO_LOG(error) << "[App] onUSBHubError(): " << error.what(); // if(error != aasdk::error::ErrorCode::OPERATION_ABORTED && @@ -279,8 +248,8 @@ void App::onUSBHubError(const aasdk::error::Error& error) // OPENAUTO_LOG(error) << "[App] onUSBHubError: exception caused by this->waitForDevice();"; // } // } -} + } } -} -} + + diff --git a/src/autoapp/Configuration/Configuration.cpp b/src/autoapp/Configuration/Configuration.cpp index 2c99c1f..9069544 100644 --- a/src/autoapp/Configuration/Configuration.cpp +++ b/src/autoapp/Configuration/Configuration.cpp @@ -20,13 +20,10 @@ #include #include -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace configuration + + + +namespace f1x::openauto::autoapp::configuration { const std::string Configuration::cConfigFileName = "openauto.ini"; @@ -766,6 +763,6 @@ void Configuration::writeButtonCodes(boost::property_tree::ptree& iniConfig) } } -} -} -} + + + diff --git a/src/autoapp/Projection/DummyBluetoothDevice.cpp b/src/autoapp/Projection/DummyBluetoothDevice.cpp index cf45ac4..4147683 100644 --- a/src/autoapp/Projection/DummyBluetoothDevice.cpp +++ b/src/autoapp/Projection/DummyBluetoothDevice.cpp @@ -18,13 +18,10 @@ #include -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace projection + + + +namespace f1x::openauto::autoapp::projection { void DummyBluetoothDevice::stop() @@ -53,6 +50,6 @@ bool DummyBluetoothDevice::isAvailable() const } } -} -} -} + + + diff --git a/src/autoapp/Projection/LocalBluetoothDevice.cpp b/src/autoapp/Projection/LocalBluetoothDevice.cpp index 6c24d71..ccd987b 100644 --- a/src/autoapp/Projection/LocalBluetoothDevice.cpp +++ b/src/autoapp/Projection/LocalBluetoothDevice.cpp @@ -22,14 +22,7 @@ #include #include -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace projection -{ +namespace f1x::openauto::autoapp::projection { LocalBluetoothDevice::LocalBluetoothDevice() { @@ -183,7 +176,3 @@ void LocalBluetoothDevice::onHostModeStateChanged(QBluetoothLocalDevice::HostMod } } -} -} -} -} diff --git a/src/autoapp/Service/Bluetooth/BluetoothService.cpp b/src/autoapp/Service/Bluetooth/BluetoothService.cpp index 4e6dbc4..14f4c05 100644 --- a/src/autoapp/Service/Bluetooth/BluetoothService.cpp +++ b/src/autoapp/Service/Bluetooth/BluetoothService.cpp @@ -19,50 +19,46 @@ #include #include -namespace f1x { - namespace openauto { - namespace autoapp { - namespace service { - namespace bluetooth { +namespace f1x::openauto::autoapp::service::bluetooth { - BluetoothService::BluetoothService(boost::asio::io_service &ioService, - aasdk::messenger::IMessenger::Pointer messenger, - projection::IBluetoothDevice::Pointer bluetoothDevice) - : strand_(ioService), - channel_(std::make_shared(strand_, std::move(messenger))), - bluetoothDevice_(std::move(bluetoothDevice)) { + BluetoothService::BluetoothService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger, + projection::IBluetoothDevice::Pointer bluetoothDevice) + : strand_(ioService), + channel_(std::make_shared(strand_, std::move(messenger))), + bluetoothDevice_(std::move(bluetoothDevice)) { - } + } - void BluetoothService::start() { - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[BluetoothService] start()"; - channel_->receive(this->shared_from_this()); - }); - } + void BluetoothService::start() { + strand_.dispatch([this, self = this->shared_from_this()]() { + 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()"; - bluetoothDevice_->stop(); - }); - } + void BluetoothService::stop() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[BluetoothService] stop()"; + bluetoothDevice_->stop(); + }); + } - void BluetoothService::pause() { - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[BluetoothService] pause()"; - }); - } + void BluetoothService::pause() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[BluetoothService] pause()"; + }); + } - void BluetoothService::resume() { - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[BluetoothService] resume()"; - }); - } + void BluetoothService::resume() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[BluetoothService] resume()"; + }); + } - void BluetoothService::fillFeatures( - aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) { - OPENAUTO_LOG(info) << "[BluetoothService] fillFeatures()"; + void BluetoothService::fillFeatures( + aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) { + OPENAUTO_LOG(info) << "[BluetoothService] fillFeatures()"; if (bluetoothDevice_->isAvailable()) { OPENAUTO_LOG(info) << "[BluetoothService] Local Address: " << bluetoothDevice_->getLocalAddress(); @@ -82,76 +78,81 @@ namespace f1x { } } - void BluetoothService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { - OPENAUTO_LOG(info) << "[BluetoothService] onChannelOpenRequest()"; - OPENAUTO_LOG(debug) << "[BluetoothService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); + void + BluetoothService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { + OPENAUTO_LOG(info) << "[BluetoothService] onChannelOpenRequest()"; + OPENAUTO_LOG(debug) << "[BluetoothService] Channel Id: " << request.service_id() << ", Priority: " + << request.priority(); - aap_protobuf::service::control::message::ChannelOpenResponse response; - const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS; - response.set_status(status); + aap_protobuf::service::control::message::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(&BluetoothService::onChannelError, this->shared_from_this(), - std::placeholders::_1)); - channel_->sendChannelOpenResponse(response, std::move(promise)); - - channel_->receive(this->shared_from_this()); - } - - void BluetoothService::onBluetoothPairingRequest( - const aap_protobuf::service::bluetooth::message::BluetoothPairingRequest &request) { - 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"; - } - - /* - * The HU must always sent a STATUS_SUCCESS response, - * or STATUS_BLUETOOTH_PAIRING_DELAYED if: - * there's a delay in allowing bluetooth - * the HU is already engaged in a bluetooth call - */ - response.set_status(aap_protobuf::shared::MessageStatus::STATUS_SUCCESS); - response.set_already_paired(isPaired); - - auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then(std::bind(&BluetoothService::sendBluetoothAuthenticationData, this->shared_from_this()), std::bind(&BluetoothService::onChannelError, this->shared_from_this(), - std::placeholders::_1)); - channel_->sendBluetoothPairingResponse(response, std::move(promise)); - channel_->receive(this->shared_from_this()); - } - - void BluetoothService::sendBluetoothAuthenticationData() { - aap_protobuf::service::bluetooth::message::BluetoothAuthenticationData data; - data.set_auth_data("123456"); - data.set_pairing_method(aap_protobuf::service::bluetooth::message::BluetoothPairingMethod::BLUETOOTH_PAIRING_PIN); - auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() {}, std::bind(&BluetoothService::onChannelError, this->shared_from_this(), - std::placeholders::_1)); - channel_->sendBluetoothAuthenticationData(data, std::move(promise)); - channel_->receive(this->shared_from_this()); - } - - void BluetoothService::onBluetoothAuthenticationResult(const aap_protobuf::service::bluetooth::message::BluetoothAuthenticationResult &request) { - OPENAUTO_LOG(info) << "[BluetoothService] onBluetoothAuthenticationResult()"; - OPENAUTO_LOG(info) << "[BluetoothService] AuthData " << request.status(); - aap_protobuf::service::bluetooth::message::BluetoothPairingResponse response; - - channel_->receive(this->shared_from_this()); - } - - void BluetoothService::onChannelError(const aasdk::error::Error &e) { - OPENAUTO_LOG(error) << "[BluetoothService] onChannelError(): " << e.what(); - } - } - } - } + auto promise = aasdk::channel::SendPromise::defer(strand_); + promise->then([]() {}, std::bind(&BluetoothService::onChannelError, this->shared_from_this(), + std::placeholders::_1)); + channel_->sendChannelOpenResponse(response, std::move(promise)); + channel_->receive(this->shared_from_this()); } -} \ No newline at end of file + + void BluetoothService::onBluetoothPairingRequest( + const aap_protobuf::service::bluetooth::message::BluetoothPairingRequest &request) { + 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"; + } + + /* + * The HU must always sent a STATUS_SUCCESS response, + * or STATUS_BLUETOOTH_PAIRING_DELAYED if: + * there's a delay in allowing bluetooth + * the HU is already engaged in a bluetooth call + */ + response.set_status(aap_protobuf::shared::MessageStatus::STATUS_SUCCESS); + response.set_already_paired(isPaired); + + auto promise = aasdk::channel::SendPromise::defer(strand_); + promise->then(std::bind(&BluetoothService::sendBluetoothAuthenticationData, this->shared_from_this()), + std::bind(&BluetoothService::onChannelError, this->shared_from_this(), + std::placeholders::_1)); + channel_->sendBluetoothPairingResponse(response, std::move(promise)); + channel_->receive(this->shared_from_this()); + } + + void BluetoothService::sendBluetoothAuthenticationData() { + OPENAUTO_LOG(info) << "[BluetoothService] sendBluetoothAuthenticationData()"; + + aap_protobuf::service::bluetooth::message::BluetoothAuthenticationData data; + // TODO: Bluetooth Authentication Data + data.set_auth_data("123456"); + data.set_pairing_method(aap_protobuf::service::bluetooth::message::BluetoothPairingMethod::BLUETOOTH_PAIRING_PIN); + auto promise = aasdk::channel::SendPromise::defer(strand_); + promise->then([]() {}, std::bind(&BluetoothService::onChannelError, this->shared_from_this(), + std::placeholders::_1)); + channel_->sendBluetoothAuthenticationData(data, std::move(promise)); + channel_->receive(this->shared_from_this()); + } + + void BluetoothService::onBluetoothAuthenticationResult( + const aap_protobuf::service::bluetooth::message::BluetoothAuthenticationResult &request) { + OPENAUTO_LOG(info) << "[BluetoothService] onBluetoothAuthenticationResult()"; + OPENAUTO_LOG(info) << "[BluetoothService] AuthData " << request.status(); + aap_protobuf::service::bluetooth::message::BluetoothPairingResponse response; + + channel_->receive(this->shared_from_this()); + } + + void BluetoothService::onChannelError(const aasdk::error::Error &e) { + OPENAUTO_LOG(error) << "[BluetoothService] onChannelError(): " << e.what(); + } +} + + + diff --git a/src/autoapp/Service/GenericNotification/GenericNotificationService.cpp b/src/autoapp/Service/GenericNotification/GenericNotificationService.cpp index a446e36..1b29e49 100644 --- a/src/autoapp/Service/GenericNotification/GenericNotificationService.cpp +++ b/src/autoapp/Service/GenericNotification/GenericNotificationService.cpp @@ -21,75 +21,73 @@ #include #include -namespace f1x { - namespace openauto { - namespace autoapp { - namespace service { - namespace genericnotification { +namespace f1x::openauto::autoapp::service::genericnotification { - GenericNotificationService::GenericNotificationService(boost::asio::io_service &ioService, - aasdk::messenger::IMessenger::Pointer messenger) - : strand_(ioService), - timer_(ioService), - channel_(std::make_shared(strand_, std::move(messenger))) { + GenericNotificationService::GenericNotificationService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger) + : strand_(ioService), + timer_(ioService), + channel_(std::make_shared(strand_, std::move( + messenger))) { - } - - void GenericNotificationService::start() { - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[GenericNotificationService] start()"; - }); - } - - void GenericNotificationService::stop() { - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[GenericNotificationService] stop()"; - }); - } - - void GenericNotificationService::pause() { - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[GenericNotificationService] pause()"; - }); - } - - void GenericNotificationService::resume() { - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[GenericNotificationService] resume()"; - }); - } - - void GenericNotificationService::fillFeatures( - aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) { - OPENAUTO_LOG(info) << "[GenericNotificationService] fillFeatures()"; - - auto *service = response.add_channels(); - service->set_id(static_cast(channel_->getId())); - - auto *genericNotification = service->mutable_wifi_projection_service(); - } - - void GenericNotificationService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { - OPENAUTO_LOG(info) << "[GenericNotificationService] onChannelOpenRequest()"; - OPENAUTO_LOG(debug) << "[GenericNotificationService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); - - aap_protobuf::service::control::message::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] onChannelError(): " << e.what(); - } - } - } - } } -} \ No newline at end of file + + void GenericNotificationService::start() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[GenericNotificationService] start()"; + }); + } + + void GenericNotificationService::stop() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[GenericNotificationService] stop()"; + }); + } + + void GenericNotificationService::pause() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[GenericNotificationService] pause()"; + }); + } + + void GenericNotificationService::resume() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[GenericNotificationService] resume()"; + }); + } + + void GenericNotificationService::fillFeatures( + aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) { + OPENAUTO_LOG(info) << "[GenericNotificationService] fillFeatures()"; + + auto *service = response.add_channels(); + service->set_id(static_cast(channel_->getId())); + + auto *genericNotification = service->mutable_wifi_projection_service(); + } + + void GenericNotificationService::onChannelOpenRequest( + const aap_protobuf::service::control::message::ChannelOpenRequest &request) { + OPENAUTO_LOG(info) << "[GenericNotificationService] onChannelOpenRequest()"; + OPENAUTO_LOG(debug) << "[GenericNotificationService] Channel Id: " << request.service_id() << ", Priority: " + << request.priority(); + + aap_protobuf::service::control::message::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] onChannelError(): " << e.what(); + } +} + + + diff --git a/src/autoapp/Service/MediaSink/GuidanceAudioService.cpp b/src/autoapp/Service/MediaSink/GuidanceAudioService.cpp index 1acf33a..6597e30 100644 --- a/src/autoapp/Service/MediaSink/GuidanceAudioService.cpp +++ b/src/autoapp/Service/MediaSink/GuidanceAudioService.cpp @@ -18,26 +18,22 @@ #include -namespace f1x { - namespace openauto { - namespace autoapp { - namespace service { - namespace mediasink { - using f1x::openauto::autoapp::service::mediasink::GuidanceAudioService; - using f1x::openauto::autoapp::service::mediasink::AudioMediaSinkService; - using aasdk::channel::mediasink::audio::channel::GuidanceAudioChannel; - GuidanceAudioService::GuidanceAudioService(boost::asio::io_service &ioService, - aasdk::messenger::IMessenger::Pointer messenger, - projection::IAudioOutput::Pointer audioOutput) - : AudioMediaSinkService( - ioService, - std::make_shared(strand_, std::move(messenger)), - std::move(audioOutput)) { +namespace f1x::openauto::autoapp::service::mediasink { + using f1x::openauto::autoapp::service::mediasink::GuidanceAudioService; + using f1x::openauto::autoapp::service::mediasink::AudioMediaSinkService; + using aasdk::channel::mediasink::audio::channel::GuidanceAudioChannel; + + GuidanceAudioService::GuidanceAudioService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger, + projection::IAudioOutput::Pointer audioOutput) + : AudioMediaSinkService( + ioService, + std::make_shared(strand_, std::move(messenger)), + std::move(audioOutput)) { - } - } - } - } } -} \ No newline at end of file +} + + + diff --git a/src/autoapp/Service/MediaSink/MediaAudioService.cpp b/src/autoapp/Service/MediaSink/MediaAudioService.cpp index 73e3901..a392966 100644 --- a/src/autoapp/Service/MediaSink/MediaAudioService.cpp +++ b/src/autoapp/Service/MediaSink/MediaAudioService.cpp @@ -19,24 +19,18 @@ #include +namespace f1x::openauto::autoapp::service::mediasink { + MediaAudioService::MediaAudioService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger, + projection::IAudioOutput::Pointer audioOutput) + : AudioMediaSinkService(ioService, + std::make_shared(strand_, + std::move( + messenger)), + std::move(audioOutput)) { -namespace f1x { - namespace openauto { - namespace autoapp { - namespace service { - namespace mediasink { - MediaAudioService::MediaAudioService(boost::asio::io_service &ioService, - aasdk::messenger::IMessenger::Pointer messenger, - projection::IAudioOutput::Pointer audioOutput) - : AudioMediaSinkService(ioService, - std::make_shared(strand_, - std::move( - messenger)), - std::move(audioOutput)) { - - } - } - } - } } -} \ No newline at end of file +} + + + diff --git a/src/autoapp/Service/MediaSink/SystemAudioService.cpp b/src/autoapp/Service/MediaSink/SystemAudioService.cpp index 4b92cf9..e44bb3f 100644 --- a/src/autoapp/Service/MediaSink/SystemAudioService.cpp +++ b/src/autoapp/Service/MediaSink/SystemAudioService.cpp @@ -19,23 +19,20 @@ #include #include -namespace f1x { - namespace openauto { - namespace autoapp { - namespace service { - namespace mediasink { - SystemAudioService::SystemAudioService(boost::asio::io_service &ioService, - aasdk::messenger::IMessenger::Pointer messenger, - projection::IAudioOutput::Pointer audioOutput) - : AudioMediaSinkService(ioService, - std::make_shared(strand_, - std::move(messenger)), - std::move(audioOutput)) { - } +namespace f1x::openauto::autoapp::service::mediasink { + SystemAudioService::SystemAudioService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger, + projection::IAudioOutput::Pointer audioOutput) + : AudioMediaSinkService(ioService, + std::make_shared(strand_, + std::move( + messenger)), + std::move(audioOutput)) { - } - } - } } -} \ No newline at end of file + +} + + + diff --git a/src/autoapp/Service/MediaSource/MediaSourceService.cpp b/src/autoapp/Service/MediaSource/MediaSourceService.cpp index 3481f69..86a96d0 100644 --- a/src/autoapp/Service/MediaSource/MediaSourceService.cpp +++ b/src/autoapp/Service/MediaSource/MediaSourceService.cpp @@ -16,256 +16,258 @@ * along with openauto. If not, see . */ -#include #include #include -namespace f1x { - namespace openauto { - namespace autoapp { - namespace service { - namespace mediasource { - MediaSourceService::MediaSourceService(boost::asio::io_service &ioService, - aasdk::channel::mediasource::IMediaSourceService::Pointer channel, - projection::IAudioInput::Pointer audioInput) - : strand_(ioService), channel_(std::move(channel)), audioInput_(std::move(audioInput)), session_(-1) { +namespace f1x::openauto::autoapp::service::mediasource { - } + MediaSourceService::MediaSourceService(boost::asio::io_service &ioService, + aasdk::channel::mediasource::IMediaSourceService::Pointer channel, + projection::IAudioInput::Pointer audioInput) + : strand_(ioService), channel_(std::move(channel)), audioInput_(std::move(audioInput)), session_(-1) { - void MediaSourceService::start() { - strand_.dispatch([this, self = this->shared_from_this()]() { - 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) << "[MediaSourceService] stop()"; - audioInput_->stop(); - }); - } + void MediaSourceService::start() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[MediaSourceService] start()"; + channel_->receive(this->shared_from_this()); + }); + } - void MediaSourceService::pause() { - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[MediaSourceService] pause()"; - }); - } + void MediaSourceService::stop() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[MediaSourceService] stop()"; + audioInput_->stop(); + }); + } - void MediaSourceService::resume() { - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[MediaSourceService] resume()"; - }); - } + void MediaSourceService::pause() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[MediaSourceService] pause()"; + }); + } - /* - * Service Discovery - */ + void MediaSourceService::resume() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[MediaSourceService] resume()"; + }); + } - /** - * Fill Features of Service - * @param response - */ - void MediaSourceService::fillFeatures( - aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) { - OPENAUTO_LOG(info) << "[MediaSourceService] fillFeatures()"; + /* + * Service Discovery + */ - auto *service = response.add_channels(); - service->set_id(static_cast(channel_->getId())); + /** + * Fill Features of Service + * @param response + */ + void MediaSourceService::fillFeatures( + aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) { + OPENAUTO_LOG(info) << "[MediaSourceService] fillFeatures()"; - auto *avInputChannel = service->mutable_media_source_service(); - avInputChannel->set_available_type( - aap_protobuf::service::media::shared::message::MediaCodecType::MEDIA_CODEC_AUDIO_PCM); + auto *service = response.add_channels(); + service->set_id(static_cast(channel_->getId())); - auto audioConfig = avInputChannel->mutable_audio_config(); - audioConfig->set_sampling_rate(audioInput_->getSampleRate()); - audioConfig->set_number_of_bits(audioInput_->getSampleSize()); - audioConfig->set_number_of_channels(audioInput_->getChannelCount()); - } + auto *avInputChannel = service->mutable_media_source_service(); + avInputChannel->set_available_type( + aap_protobuf::service::media::shared::message::MediaCodecType::MEDIA_CODEC_AUDIO_PCM); - /* - * Base Channel Handling - */ + auto audioConfig = avInputChannel->mutable_audio_config(); + audioConfig->set_sampling_rate(audioInput_->getSampleRate()); + audioConfig->set_number_of_bits(audioInput_->getSampleSize()); + audioConfig->set_number_of_channels(audioInput_->getChannelCount()); + } - /** - * Open Service Channel Request - * @param request - */ - void MediaSourceService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { - OPENAUTO_LOG(info) << "[MediaSourceService] onChannelOpenRequest()"; - OPENAUTO_LOG(info) << "[MediaSourceService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); + /* + * Base Channel Handling + */ - const aap_protobuf::shared::MessageStatus status = audioInput_->open() - ? aap_protobuf::shared::MessageStatus::STATUS_SUCCESS - : aap_protobuf::shared::MessageStatus::STATUS_INTERNAL_ERROR; + /** + * Open Service Channel Request + * @param request + */ + void + MediaSourceService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { + OPENAUTO_LOG(info) << "[MediaSourceService] onChannelOpenRequest()"; + OPENAUTO_LOG(info) << "[MediaSourceService] Channel Id: " << request.service_id() << ", Priority: " + << request.priority(); - OPENAUTO_LOG(info) << "[MediaSourceService] Status determined: " << aap_protobuf::shared::MessageStatus_Name(status); + const aap_protobuf::shared::MessageStatus status = audioInput_->open() + ? aap_protobuf::shared::MessageStatus::STATUS_SUCCESS + : aap_protobuf::shared::MessageStatus::STATUS_INTERNAL_ERROR; - aap_protobuf::service::control::message::ChannelOpenResponse response; - response.set_status(status); + OPENAUTO_LOG(info) << "[MediaSourceService] Status determined: " + << aap_protobuf::shared::MessageStatus_Name(status); - auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() {}, - std::bind(&MediaSourceService::onChannelError, this->shared_from_this(), - std::placeholders::_1)); + aap_protobuf::service::control::message::ChannelOpenResponse response; + response.set_status(status); - channel_->sendChannelOpenResponse(response, std::move(promise)); - channel_->receive(this->shared_from_this()); - } + auto promise = aasdk::channel::SendPromise::defer(strand_); + promise->then([]() {}, + std::bind(&MediaSourceService::onChannelError, this->shared_from_this(), + std::placeholders::_1)); - /** - * Generic Channel Error - * @param e - */ - void MediaSourceService::onChannelError(const aasdk::error::Error &e) { - OPENAUTO_LOG(error) << "[MediaSourceService] onChannelError(): " << e.what(); - } + channel_->sendChannelOpenResponse(response, std::move(promise)); + channel_->receive(this->shared_from_this()); + } - /* - * Media Channel Handling - */ + /** + * Generic Channel Error + * @param e + */ + void MediaSourceService::onChannelError(const aasdk::error::Error &e) { + OPENAUTO_LOG(error) << "[MediaSourceService] onChannelError(): " << e.what(); + } - /** - * Generic Media Channel Setup Request - * @param request - */ - void - MediaSourceService::onMediaChannelSetupRequest(const aap_protobuf::service::media::shared::message::Setup &request) { + /* + * Media Channel Handling + */ - OPENAUTO_LOG(info) << "[MediaSourceService] onMediaChannelSetupRequest()"; - OPENAUTO_LOG(info) << "[MediaSourceService] Channel Id: " << aasdk::messenger::channelIdToString(channel_->getId()) << ", Codec: " << MediaCodecType_Name(request.type()); + /** + * Generic Media Channel Setup Request + * @param request + */ + void + MediaSourceService::onMediaChannelSetupRequest(const aap_protobuf::service::media::shared::message::Setup &request) { - aap_protobuf::service::media::shared::message::Config response; - auto status = aap_protobuf::service::media::shared::message::Config::STATUS_READY; - response.set_status(status); - response.set_max_unacked(1); - response.add_configuration_indices(0); + OPENAUTO_LOG(info) << "[MediaSourceService] onMediaChannelSetupRequest()"; + OPENAUTO_LOG(info) << "[MediaSourceService] Channel Id: " << aasdk::messenger::channelIdToString(channel_->getId()) + << ", Codec: " << MediaCodecType_Name(request.type()); - auto promise = aasdk::channel::SendPromise::defer(strand_); + aap_protobuf::service::media::shared::message::Config response; + auto status = aap_protobuf::service::media::shared::message::Config::STATUS_READY; + response.set_status(status); + response.set_max_unacked(1); + response.add_configuration_indices(0); - promise->then([]() {}, std::bind(&MediaSourceService::onChannelError, this->shared_from_this(), - std::placeholders::_1)); - channel_->sendChannelSetupResponse(response, std::move(promise)); - channel_->receive(this->shared_from_this()); - } + auto promise = aasdk::channel::SendPromise::defer(strand_); - /** - * Generic Media Ack - */ - void MediaSourceService::onMediaChannelAckIndication( - const aap_protobuf::service::media::source::message::Ack &) { - OPENAUTO_LOG(debug) << "[MediaSourceService] onMediaChannelAckIndication()"; - channel_->receive(this->shared_from_this()); - } + promise->then([]() {}, std::bind(&MediaSourceService::onChannelError, this->shared_from_this(), + std::placeholders::_1)); + channel_->sendChannelSetupResponse(response, std::move(promise)); + channel_->receive(this->shared_from_this()); + } - /* - * Source Media Channel Handling - */ + /** + * Generic Media Ack + */ + void MediaSourceService::onMediaChannelAckIndication( + const aap_protobuf::service::media::source::message::Ack &) { + OPENAUTO_LOG(debug) << "[MediaSourceService] onMediaChannelAckIndication()"; + channel_->receive(this->shared_from_this()); + } - /** - * 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) << "[MediaSourceService] onMediaSourceOpenRequest()"; - OPENAUTO_LOG(info) << "[MediaSourceService] Request to Open?: " << request.open() << ", anc: " << request.anc_enabled() << ", ec: " << request.ec_enabled() << ", max unacked: " << request.max_unacked(); + /* + * Source Media Channel Handling + */ - 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) << "[MediaSourceService] Media Source Open Failed"; + /** + * 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) << "[MediaSourceService] onMediaSourceOpenRequest()"; + OPENAUTO_LOG(info) << "[MediaSourceService] Request to Open?: " << request.open() << ", anc: " + << request.anc_enabled() << ", ec: " << request.ec_enabled() << ", max unacked: " + << request.max_unacked(); - aap_protobuf::service::media::source::message::MicrophoneResponse response; - response.set_session_id(session_); + 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) << "[MediaSourceService] Media Source Open Failed"; - response.set_status(aap_protobuf::shared::MessageStatus::STATUS_INTERNAL_ERROR); + aap_protobuf::service::media::source::message::MicrophoneResponse response; + response.set_session_id(session_); - auto sendPromise = aasdk::channel::SendPromise::defer(strand_); - sendPromise->then([]() {}, - std::bind(&MediaSourceService::onChannelError, - this->shared_from_this(), - std::placeholders::_1)); - channel_->sendMicrophoneOpenResponse(response, std::move(sendPromise)); - }); + response.set_status(aap_protobuf::shared::MessageStatus::STATUS_INTERNAL_ERROR); - audioInput_->start(std::move(startPromise)); - } else { - // Request for Channel Close - audioInput_->stop(); + auto sendPromise = aasdk::channel::SendPromise::defer(strand_); + sendPromise->then([]() {}, + std::bind(&MediaSourceService::onChannelError, + this->shared_from_this(), + std::placeholders::_1)); + channel_->sendMicrophoneOpenResponse(response, std::move(sendPromise)); + }); - aap_protobuf::service::media::source::message::MicrophoneResponse response; - response.set_session_id(session_); + audioInput_->start(std::move(startPromise)); + } else { + // Request for Channel Close + audioInput_->stop(); - response.set_status(aap_protobuf::shared::MessageStatus::STATUS_SUCCESS); + aap_protobuf::service::media::source::message::MicrophoneResponse response; + response.set_session_id(session_); - auto sendPromise = aasdk::channel::SendPromise::defer(strand_); - sendPromise->then([]() {}, std::bind(&MediaSourceService::onChannelError, this->shared_from_this(), - std::placeholders::_1)); - channel_->sendMicrophoneOpenResponse(response, std::move(sendPromise)); - } + response.set_status(aap_protobuf::shared::MessageStatus::STATUS_SUCCESS); - channel_->receive(this->shared_from_this()); - } + auto sendPromise = aasdk::channel::SendPromise::defer(strand_); + sendPromise->then([]() {}, std::bind(&MediaSourceService::onChannelError, this->shared_from_this(), + std::placeholders::_1)); + channel_->sendMicrophoneOpenResponse(response, std::move(sendPromise)); + } + + channel_->receive(this->shared_from_this()); + } - /** - * Sends response to advise Microphone is Open - */ - void MediaSourceService::onMediaSourceOpenSuccess() { - OPENAUTO_LOG(error) << "[MediaSourceService] onMediaSourceOpenSuccess()"; + /** + * Sends response to advise Microphone is Open + */ + void MediaSourceService::onMediaSourceOpenSuccess() { + OPENAUTO_LOG(error) << "[MediaSourceService] onMediaSourceOpenSuccess()"; - aap_protobuf::service::media::source::message::MicrophoneResponse response; - response.set_session_id(session_); - response.set_status(aap_protobuf::shared::MessageStatus::STATUS_SUCCESS); + aap_protobuf::service::media::source::message::MicrophoneResponse response; + response.set_session_id(session_); + response.set_status(aap_protobuf::shared::MessageStatus::STATUS_SUCCESS); - auto sendPromise = aasdk::channel::SendPromise::defer(strand_); - sendPromise->then([]() {}, std::bind(&MediaSourceService::onChannelError, this->shared_from_this(), - std::placeholders::_1)); + auto sendPromise = aasdk::channel::SendPromise::defer(strand_); + sendPromise->then([]() {}, std::bind(&MediaSourceService::onChannelError, this->shared_from_this(), + std::placeholders::_1)); - channel_->sendMicrophoneOpenResponse(response, std::move(sendPromise)); + channel_->sendMicrophoneOpenResponse(response, std::move(sendPromise)); - this->readMediaSource(); - } + this->readMediaSource(); + } - /** - * Resolves promise from readMediaSource. Sends Media with Timestamp Indication to channel. - * @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(), - std::placeholders::_1)); + /** + * Resolves promise from readMediaSource. Sends Media with Timestamp Indication to channel. + * @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(), + std::placeholders::_1)); - auto timestamp = std::chrono::duration_cast( - std::chrono::high_resolution_clock::now().time_since_epoch()); - channel_->sendMediaSourceWithTimestampIndication(timestamp.count(), std::move(data), std::move(sendPromise)); - } + auto timestamp = std::chrono::duration_cast( + std::chrono::high_resolution_clock::now().time_since_epoch()); + channel_->sendMediaSourceWithTimestampIndication(timestamp.count(), std::move(data), std::move(sendPromise)); + } - /** - * Reads audio from a MediaSource (eg Microphone). Promise resolves to onMediaSourceDataReady. - */ - void MediaSourceService::readMediaSource() { - OPENAUTO_LOG(debug) << "[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(debug) << "[MediaSourceService] audio input read rejected."; - }); + /** + * Reads audio from a MediaSource (eg Microphone). Promise resolves to onMediaSourceDataReady. + */ + void MediaSourceService::readMediaSource() { + OPENAUTO_LOG(debug) << "[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(debug) << "[MediaSourceService] audio input read rejected."; + }); - audioInput_->read(std::move(readPromise)); - } - } - } - } + audioInput_->read(std::move(readPromise)); } } } + + + + diff --git a/src/autoapp/Service/MediaSource/MicrophoneMediaSourceService.cpp b/src/autoapp/Service/MediaSource/MicrophoneMediaSourceService.cpp index 7d14c4a..23f407f 100644 --- a/src/autoapp/Service/MediaSource/MicrophoneMediaSourceService.cpp +++ b/src/autoapp/Service/MediaSource/MicrophoneMediaSourceService.cpp @@ -19,22 +19,18 @@ #include #include -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(strand_, - std::move( - messenger)), - std::move(audioOutput)) { +namespace f1x::openauto::autoapp::service::mediasource { + MicrophoneMediaSourceService::MicrophoneMediaSourceService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger, + projection::IAudioInput::Pointer audioOutput) + : MediaSourceService(ioService, + std::make_shared(strand_, + std::move( + messenger)), + std::move(audioOutput)) { - } - } - } - } } -} \ No newline at end of file +} + + + diff --git a/src/autoapp/Service/NavigationStatus/NavigationStatusService.cpp b/src/autoapp/Service/NavigationStatus/NavigationStatusService.cpp index 0e03ee4..76a8648 100644 --- a/src/autoapp/Service/NavigationStatus/NavigationStatusService.cpp +++ b/src/autoapp/Service/NavigationStatus/NavigationStatusService.cpp @@ -21,89 +21,90 @@ #include #include -namespace f1x { - namespace openauto { - namespace autoapp { - namespace service { - namespace navigationstatus { +namespace f1x::openauto::autoapp::service::navigationstatus { - NavigationStatusService::NavigationStatusService(boost::asio::io_service &ioService, - aasdk::messenger::IMessenger::Pointer messenger) - : strand_(ioService), - timer_(ioService), - channel_(std::make_shared(strand_, std::move(messenger))) { + NavigationStatusService::NavigationStatusService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger) + : strand_(ioService), + timer_(ioService), + channel_(std::make_shared(strand_, + std::move(messenger))) { - } - - void NavigationStatusService::start() { - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[NavigationStatusService] start()"; - }); - } - - void NavigationStatusService::stop() { - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[NavigationStatusService] stop()"; - }); - } - - void NavigationStatusService::pause() { - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[NavigationStatusService] pause()"; - }); - } - - void NavigationStatusService::resume() { - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[NavigationStatusService] resume()"; - }); - } - - void NavigationStatusService::fillFeatures( - aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) { - OPENAUTO_LOG(info) << "[NavigationStatusService] fillFeatures()"; - - auto *service = response.add_channels(); - service->set_id(static_cast(channel_->getId())); - - auto *navigationStatus = service->mutable_navigation_status_service(); - } - - void NavigationStatusService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { - OPENAUTO_LOG(info) << "[NavigationStatusService] onChannelOpenRequest()"; - OPENAUTO_LOG(info) << "[NavigationStatusService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); - - aap_protobuf::service::control::message::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::onStatusUpdate(const aap_protobuf::service::navigationstatus::message::NavigationStatus &navStatus) { - channel_->receive(this->shared_from_this()); - } - - - void NavigationStatusService::onTurnEvent(const aap_protobuf::service::navigationstatus::message::NavigationNextTurnEvent &turnEvent) { - channel_->receive(this->shared_from_this()); - } - - void NavigationStatusService::onDistanceEvent(const aap_protobuf::service::navigationstatus::message::NavigationNextTurnDistanceEvent &distanceEvent) { - channel_->receive(this->shared_from_this()); - } - - - void NavigationStatusService::onChannelError(const aasdk::error::Error &e) { - OPENAUTO_LOG(error) << "[NavigationStatusService] onChannelError(): " << e.what(); - } - } - } - } } -} \ No newline at end of file + + void NavigationStatusService::start() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[NavigationStatusService] start()"; + }); + } + + void NavigationStatusService::stop() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[NavigationStatusService] stop()"; + }); + } + + void NavigationStatusService::pause() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[NavigationStatusService] pause()"; + }); + } + + void NavigationStatusService::resume() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[NavigationStatusService] resume()"; + }); + } + + void NavigationStatusService::fillFeatures( + aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) { + OPENAUTO_LOG(info) << "[NavigationStatusService] fillFeatures()"; + + auto *service = response.add_channels(); + service->set_id(static_cast(channel_->getId())); + + auto *navigationStatus = service->mutable_navigation_status_service(); + } + + void NavigationStatusService::onChannelOpenRequest( + const aap_protobuf::service::control::message::ChannelOpenRequest &request) { + OPENAUTO_LOG(info) << "[NavigationStatusService] onChannelOpenRequest()"; + OPENAUTO_LOG(info) << "[NavigationStatusService] Channel Id: " << request.service_id() << ", Priority: " + << request.priority(); + + aap_protobuf::service::control::message::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::onStatusUpdate( + const aap_protobuf::service::navigationstatus::message::NavigationStatus &navStatus) { + channel_->receive(this->shared_from_this()); + } + + + void NavigationStatusService::onTurnEvent( + const aap_protobuf::service::navigationstatus::message::NavigationNextTurnEvent &turnEvent) { + channel_->receive(this->shared_from_this()); + } + + void NavigationStatusService::onDistanceEvent( + const aap_protobuf::service::navigationstatus::message::NavigationNextTurnDistanceEvent &distanceEvent) { + channel_->receive(this->shared_from_this()); + } + + + void NavigationStatusService::onChannelError(const aasdk::error::Error &e) { + OPENAUTO_LOG(error) << "[NavigationStatusService] onChannelError(): " << e.what(); + } +} + + + diff --git a/src/autoapp/Service/Pinger.cpp b/src/autoapp/Service/Pinger.cpp index 72aca5a..75778cf 100644 --- a/src/autoapp/Service/Pinger.cpp +++ b/src/autoapp/Service/Pinger.cpp @@ -19,86 +19,60 @@ #include #include -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace service -{ +namespace f1x::openauto::autoapp::service { -Pinger::Pinger(boost::asio::io_service& ioService, time_t duration) - : strand_(ioService) - , timer_(ioService) - , duration_(duration) - , cancelled_(false) - , pingsCount_(0) - , pongsCount_(0) -{ + Pinger::Pinger(boost::asio::io_service &ioService, time_t duration) + : strand_(ioService), timer_(ioService), duration_(duration), cancelled_(false), pingsCount_(0), pongsCount_(0) { -} + } -void Pinger::ping(Promise::Pointer promise) -{ + void Pinger::ping(Promise::Pointer promise) { strand_.dispatch([this, self = this->shared_from_this(), promise = std::move(promise)]() mutable { - cancelled_ = false; + cancelled_ = false; - if(promise_ != nullptr) - { - promise_->reject(aasdk::error::Error(aasdk::error::ErrorCode::OPERATION_IN_PROGRESS)); - } - else - { - ++pingsCount_; - OPENAUTO_LOG(debug) << "[Pinger] Ping counter: " << pingsCount_; + if (promise_ != nullptr) { + promise_->reject(aasdk::error::Error(aasdk::error::ErrorCode::OPERATION_IN_PROGRESS)); + } else { + ++pingsCount_; + OPENAUTO_LOG(debug) << "[Pinger] Ping counter: " << pingsCount_; - promise_ = std::move(promise); - timer_.expires_from_now(boost::posix_time::milliseconds(duration_)); - timer_.async_wait(strand_.wrap(std::bind(&Pinger::onTimerExceeded, this->shared_from_this(), std::placeholders::_1))); - } + promise_ = std::move(promise); + timer_.expires_from_now(boost::posix_time::milliseconds(duration_)); + timer_.async_wait( + strand_.wrap(std::bind(&Pinger::onTimerExceeded, this->shared_from_this(), std::placeholders::_1))); + } }); -} + } -void Pinger::pong() -{ + void Pinger::pong() { strand_.dispatch([this, self = this->shared_from_this()]() { - ++pongsCount_; - OPENAUTO_LOG(debug) << "[Pinger] Pong counter: " << pongsCount_; + ++pongsCount_; + OPENAUTO_LOG(debug) << "[Pinger] Pong counter: " << pongsCount_; }); -} + } -void Pinger::onTimerExceeded(const boost::system::error_code& error) -{ - if(promise_ == nullptr) - { - return; - } - else if(error == boost::asio::error::operation_aborted || cancelled_) - { - promise_->reject(aasdk::error::Error(aasdk::error::ErrorCode::OPERATION_ABORTED)); - } - else if(pingsCount_ - pongsCount_ > 4) - { - promise_->reject(aasdk::error::Error()); - } - else - { - promise_->resolve(); + void Pinger::onTimerExceeded(const boost::system::error_code &error) { + if (promise_ == nullptr) { + return; + } else if (error == boost::asio::error::operation_aborted || cancelled_) { + promise_->reject(aasdk::error::Error(aasdk::error::ErrorCode::OPERATION_ABORTED)); + } else if (pingsCount_ - pongsCount_ > 4) { + promise_->reject(aasdk::error::Error()); + } else { + promise_->resolve(); } promise_.reset(); -} + } -void Pinger::cancel() -{ + void Pinger::cancel() { strand_.dispatch([this, self = this->shared_from_this()]() { - cancelled_ = true; - timer_.cancel(); + cancelled_ = true; + timer_.cancel(); }); -} + } } -} -} -} + + + diff --git a/src/autoapp/Service/Radio/RadioService.cpp b/src/autoapp/Service/Radio/RadioService.cpp index e4b2372..eb8363e 100644 --- a/src/autoapp/Service/Radio/RadioService.cpp +++ b/src/autoapp/Service/Radio/RadioService.cpp @@ -21,78 +21,74 @@ #include #include -namespace f1x { - namespace openauto { - namespace autoapp { - namespace service { - namespace radio { +namespace f1x::openauto::autoapp::service::radio { - RadioService::RadioService(boost::asio::io_service &ioService, - aasdk::messenger::IMessenger::Pointer messenger) - : strand_(ioService), - timer_(ioService), - channel_(std::make_shared(strand_, std::move(messenger))) { + RadioService::RadioService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger) + : strand_(ioService), + timer_(ioService), + channel_(std::make_shared(strand_, std::move(messenger))) { - } - - void RadioService::start() { - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(debug) << "[RadioService] start()"; - }); - } - - void RadioService::stop() { - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(debug) << "[RadioService] stop()"; - }); - } - - void RadioService::pause() { - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(debug) << "[RadioService] pause()"; - }); - } - - void RadioService::resume() { - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(debug) << "[RadioService] resume()"; - }); - } - - void RadioService::fillFeatures( - aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) { - OPENAUTO_LOG(info) << "[RadioService] fillFeatures()"; - - auto *service = response.add_channels(); - service->set_id(static_cast(channel_->getId())); - - auto *radio = service->mutable_radio_service(); - } - - void RadioService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { - OPENAUTO_LOG(info) << "[RadioService] onChannelOpenRequest()"; - OPENAUTO_LOG(debug) << "[RadioService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); - - - aap_protobuf::service::control::message::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] onChannelError(): " << e.what(); - } - - - } - } - } } -} \ No newline at end of file + + void RadioService::start() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(debug) << "[RadioService] start()"; + }); + } + + void RadioService::stop() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(debug) << "[RadioService] stop()"; + }); + } + + void RadioService::pause() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(debug) << "[RadioService] pause()"; + }); + } + + void RadioService::resume() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(debug) << "[RadioService] resume()"; + }); + } + + void RadioService::fillFeatures( + aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) { + OPENAUTO_LOG(info) << "[RadioService] fillFeatures()"; + + auto *service = response.add_channels(); + service->set_id(static_cast(channel_->getId())); + + auto *radio = service->mutable_radio_service(); + } + + void RadioService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { + OPENAUTO_LOG(info) << "[RadioService] onChannelOpenRequest()"; + OPENAUTO_LOG(debug) << "[RadioService] Channel Id: " << request.service_id() << ", Priority: " + << request.priority(); + + + aap_protobuf::service::control::message::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] onChannelError(): " << e.what(); + } + + +} + + + diff --git a/src/autoapp/Service/Sensor/SensorService.cpp b/src/autoapp/Service/Sensor/SensorService.cpp index 493f4c2..b66c23a 100644 --- a/src/autoapp/Service/Sensor/SensorService.cpp +++ b/src/autoapp/Service/Sensor/SensorService.cpp @@ -23,230 +23,224 @@ #include #include -namespace f1x { - namespace openauto { - namespace autoapp { - namespace service { - namespace sensor { - SensorService::SensorService(boost::asio::io_service &ioService, - aasdk::messenger::IMessenger::Pointer messenger) - : strand_(ioService), - timer_(ioService), - channel_(std::make_shared(strand_, std::move(messenger))) { +namespace f1x::openauto::autoapp::service::sensor { + SensorService::SensorService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger) + : strand_(ioService), + timer_(ioService), + channel_(std::make_shared(strand_, std::move(messenger))) { - } + } - void SensorService::start() { - strand_.dispatch([this, self = this->shared_from_this()]() { - if (gps_open("127.0.0.1", "2947", &this->gpsData_)) { - OPENAUTO_LOG(warning) << "[SensorService] can't connect to GPSD."; - } else { - OPENAUTO_LOG(info) << "[SensorService] Connected to GPSD."; - gps_stream(&this->gpsData_, WATCH_ENABLE | WATCH_JSON, NULL); - this->gpsEnabled_ = true; - } - - if (is_file_exist("/tmp/night_mode_enabled")) { - this->isNight = true; - } - this->sensorPolling(); - - OPENAUTO_LOG(info) << "[SensorService] start()"; - channel_->receive(this->shared_from_this()); - }); - - } - - void SensorService::stop() { - this->stopPolling = true; - - strand_.dispatch([this, self = this->shared_from_this()]() { - if (this->gpsEnabled_) { - gps_stream(&this->gpsData_, WATCH_DISABLE, NULL); - gps_close(&this->gpsData_); - this->gpsEnabled_ = false; - } - - OPENAUTO_LOG(info) << "[SensorService] stop()"; - }); - } - - void SensorService::pause() { - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[SensorService] pause()"; - }); - } - - void SensorService::resume() { - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[SensorService] resume()"; - }); - } - - void SensorService::fillFeatures( - aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) { - OPENAUTO_LOG(info) << "[SensorService] fillFeatures()"; - - auto *service = response.add_channels(); - service->set_id(static_cast(channel_->getId())); - - auto *sensorChannel = service->mutable_sensor_source_service(); - sensorChannel->add_sensors()->set_sensor_type(aap_protobuf::service::sensorsource::message::SensorType::SENSOR_DRIVING_STATUS_DATA); - sensorChannel->add_sensors()->set_sensor_type(aap_protobuf::service::sensorsource::message::SensorType::SENSOR_LOCATION); - sensorChannel->add_sensors()->set_sensor_type(aap_protobuf::service::sensorsource::message::SensorType::SENSOR_NIGHT_MODE); - } - - void SensorService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { - OPENAUTO_LOG(info) << "[SensorService] onChannelOpenRequest()"; - OPENAUTO_LOG(debug) << "[SensorService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); - - aap_protobuf::service::control::message::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(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1)); - channel_->sendChannelOpenResponse(response, std::move(promise)); - - channel_->receive(this->shared_from_this()); - } - - void SensorService::onSensorStartRequest( - const aap_protobuf::service::sensorsource::message::SensorRequest &request) { - OPENAUTO_LOG(info) << "[SensorService] onSensorStartRequest()"; - OPENAUTO_LOG(debug) << "[SensorService] Request Type: "<< request.type(); - - aap_protobuf::service::sensorsource::message::SensorStartResponseMessage response; - response.set_status(aap_protobuf::shared::MessageStatus::STATUS_SUCCESS); - - auto promise = aasdk::channel::SendPromise::defer(strand_); - - if (request.type() == aap_protobuf::service::sensorsource::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.type() == aap_protobuf::service::sensorsource::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)); - } - else - { - promise->then([]() {}, - std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1)); - } - - channel_->sendSensorStartResponse(response, std::move(promise)); - channel_->receive(this->shared_from_this()); - } - - void SensorService::sendDrivingStatusUnrestricted() { - OPENAUTO_LOG(info) << "[SensorService] sendDrivingStatusUnrestricted()"; - aap_protobuf::service::sensorsource::message::SensorBatch indication; - indication.add_driving_status_data()->set_status(aap_protobuf::service::sensorsource::message::DrivingStatus::DRIVE_STATUS_UNRESTRICTED); - - auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() { }, - std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1)); - channel_->sendSensorEventIndication(indication, std::move(promise)); - } - - void SensorService::sendNightData() { - OPENAUTO_LOG(info) << "[SensorService] sendNightData()"; - aap_protobuf::service::sensorsource::message::SensorBatch indication; - - if (SensorService::isNight) { - OPENAUTO_LOG(info) << "[SensorService] Night Mode Triggered"; - indication.add_night_mode_data()->set_night_mode(true); - } else { - OPENAUTO_LOG(info) << "[SensorService] Day Mode Triggered"; - indication.add_night_mode_data()->set_night_mode(false); - } - - auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() {}, - std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1)); - channel_->sendSensorEventIndication(indication, std::move(promise)); - if (this->firstRun) { - this->firstRun = false; - this->previous = this->isNight; - } - } - - void SensorService::sendGPSLocationData() { - OPENAUTO_LOG(info) << "[SensorService] sendGPSLocationData()"; - aap_protobuf::service::sensorsource::message::SensorBatch indication; - - auto *locInd = indication.add_location_data(); - - // epoch seconds - // locInd->set_timestamp(this->gpsData_.fix.time * 1e3); - // degrees - locInd->set_latitude_e7(this->gpsData_.fix.latitude * 1e7); - locInd->set_longitude_e7(this->gpsData_.fix.longitude * 1e7); - // meters - auto accuracy = sqrt(pow(this->gpsData_.fix.epx, 2) + pow(this->gpsData_.fix.epy, 2)); - locInd->set_accuracy_e3(accuracy * 1e3); - - if (this->gpsData_.set & ALTITUDE_SET) { - // meters above ellipsoid - locInd->set_altitude_e2(this->gpsData_.fix.altitude * 1e2); - } - if (this->gpsData_.set & SPEED_SET) { - // meters per second to knots - locInd->set_speed_e3(this->gpsData_.fix.speed * 1.94384 * 1e3); - } - if (this->gpsData_.set & TRACK_SET) { - // degrees - locInd->set_bearing_e6(this->gpsData_.fix.track * 1e6); - } - - auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() {}, - std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1)); - channel_->sendSensorEventIndication(indication, std::move(promise)); - } - - 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"); - if (this->previous != this->isNight && !this->firstRun) { - this->previous = this->isNight; - this->sendNightData(); - } - - if ((this->gpsEnabled_) && - (gps_waiting(&this->gpsData_, 0)) && - (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->sendGPSLocationData(); - } - - timer_.expires_from_now(boost::posix_time::milliseconds(250)); - timer_.async_wait(strand_.wrap(std::bind(&SensorService::sensorPolling, this->shared_from_this()))); - }); - } - } - - 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] onChannelError(): " << e.what(); - } - } + void SensorService::start() { + strand_.dispatch([this, self = this->shared_from_this()]() { + if (gps_open("127.0.0.1", "2947", &this->gpsData_)) { + OPENAUTO_LOG(warning) << "[SensorService] can't connect to GPSD."; + } else { + OPENAUTO_LOG(info) << "[SensorService] Connected to GPSD."; + gps_stream(&this->gpsData_, WATCH_ENABLE | WATCH_JSON, NULL); + this->gpsEnabled_ = true; } + + if (is_file_exist("/tmp/night_mode_enabled")) { + this->isNight = true; + } + this->sensorPolling(); + + OPENAUTO_LOG(info) << "[SensorService] start()"; + channel_->receive(this->shared_from_this()); + }); + + } + + void SensorService::stop() { + this->stopPolling = true; + + strand_.dispatch([this, self = this->shared_from_this()]() { + if (this->gpsEnabled_) { + gps_stream(&this->gpsData_, WATCH_DISABLE, NULL); + gps_close(&this->gpsData_); + this->gpsEnabled_ = false; + } + + OPENAUTO_LOG(info) << "[SensorService] stop()"; + }); + } + + void SensorService::pause() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[SensorService] pause()"; + }); + } + + void SensorService::resume() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[SensorService] resume()"; + }); + } + + void SensorService::fillFeatures( + aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) { + OPENAUTO_LOG(info) << "[SensorService] fillFeatures()"; + + auto *service = response.add_channels(); + service->set_id(static_cast(channel_->getId())); + + auto *sensorChannel = service->mutable_sensor_source_service(); + sensorChannel->add_sensors()->set_sensor_type( + aap_protobuf::service::sensorsource::message::SensorType::SENSOR_DRIVING_STATUS_DATA); + sensorChannel->add_sensors()->set_sensor_type( + aap_protobuf::service::sensorsource::message::SensorType::SENSOR_LOCATION); + sensorChannel->add_sensors()->set_sensor_type( + aap_protobuf::service::sensorsource::message::SensorType::SENSOR_NIGHT_MODE); + } + + void SensorService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { + OPENAUTO_LOG(info) << "[SensorService] onChannelOpenRequest()"; + OPENAUTO_LOG(debug) << "[SensorService] Channel Id: " << request.service_id() << ", Priority: " + << request.priority(); + + aap_protobuf::service::control::message::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(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1)); + channel_->sendChannelOpenResponse(response, std::move(promise)); + + channel_->receive(this->shared_from_this()); + } + + void SensorService::onSensorStartRequest( + const aap_protobuf::service::sensorsource::message::SensorRequest &request) { + OPENAUTO_LOG(info) << "[SensorService] onSensorStartRequest()"; + OPENAUTO_LOG(debug) << "[SensorService] Request Type: " << request.type(); + + aap_protobuf::service::sensorsource::message::SensorStartResponseMessage response; + response.set_status(aap_protobuf::shared::MessageStatus::STATUS_SUCCESS); + + auto promise = aasdk::channel::SendPromise::defer(strand_); + + if (request.type() == aap_protobuf::service::sensorsource::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.type() == aap_protobuf::service::sensorsource::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)); + } else { + promise->then([]() {}, + std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1)); + } + + channel_->sendSensorStartResponse(response, std::move(promise)); + channel_->receive(this->shared_from_this()); + } + + void SensorService::sendDrivingStatusUnrestricted() { + OPENAUTO_LOG(info) << "[SensorService] sendDrivingStatusUnrestricted()"; + aap_protobuf::service::sensorsource::message::SensorBatch indication; + indication.add_driving_status_data()->set_status( + aap_protobuf::service::sensorsource::message::DrivingStatus::DRIVE_STATUS_UNRESTRICTED); + + auto promise = aasdk::channel::SendPromise::defer(strand_); + promise->then([]() {}, + std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1)); + channel_->sendSensorEventIndication(indication, std::move(promise)); + } + + void SensorService::sendNightData() { + OPENAUTO_LOG(info) << "[SensorService] sendNightData()"; + aap_protobuf::service::sensorsource::message::SensorBatch indication; + + if (SensorService::isNight) { + OPENAUTO_LOG(info) << "[SensorService] Night Mode Triggered"; + indication.add_night_mode_data()->set_night_mode(true); + } else { + OPENAUTO_LOG(info) << "[SensorService] Day Mode Triggered"; + indication.add_night_mode_data()->set_night_mode(false); + } + + auto promise = aasdk::channel::SendPromise::defer(strand_); + promise->then([]() {}, + std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1)); + channel_->sendSensorEventIndication(indication, std::move(promise)); + if (this->firstRun) { + this->firstRun = false; + this->previous = this->isNight; } } -} \ No newline at end of file + + void SensorService::sendGPSLocationData() { + OPENAUTO_LOG(info) << "[SensorService] sendGPSLocationData()"; + aap_protobuf::service::sensorsource::message::SensorBatch indication; + + auto *locInd = indication.add_location_data(); + + // epoch seconds + // locInd->set_timestamp(this->gpsData_.fix.time * 1e3); + // degrees + locInd->set_latitude_e7(this->gpsData_.fix.latitude * 1e7); + locInd->set_longitude_e7(this->gpsData_.fix.longitude * 1e7); + // meters + auto accuracy = sqrt(pow(this->gpsData_.fix.epx, 2) + pow(this->gpsData_.fix.epy, 2)); + locInd->set_accuracy_e3(accuracy * 1e3); + + if (this->gpsData_.set & ALTITUDE_SET) { + // meters above ellipsoid + locInd->set_altitude_e2(this->gpsData_.fix.altitude * 1e2); + } + if (this->gpsData_.set & SPEED_SET) { + // meters per second to knots + locInd->set_speed_e3(this->gpsData_.fix.speed * 1.94384 * 1e3); + } + if (this->gpsData_.set & TRACK_SET) { + // degrees + locInd->set_bearing_e6(this->gpsData_.fix.track * 1e6); + } + + auto promise = aasdk::channel::SendPromise::defer(strand_); + promise->then([]() {}, + std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1)); + channel_->sendSensorEventIndication(indication, std::move(promise)); + } + + 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"); + if (this->previous != this->isNight && !this->firstRun) { + this->previous = this->isNight; + this->sendNightData(); + } + + if ((this->gpsEnabled_) && + (gps_waiting(&this->gpsData_, 0)) && + (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->sendGPSLocationData(); + } + + timer_.expires_from_now(boost::posix_time::milliseconds(250)); + timer_.async_wait(strand_.wrap(std::bind(&SensorService::sensorPolling, this->shared_from_this()))); + }); + } + } + + 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] onChannelError(): " << e.what(); + } +} + + + diff --git a/src/autoapp/Service/ServiceFactory.cpp b/src/autoapp/Service/ServiceFactory.cpp index 4a51dc8..aa0fac8 100644 --- a/src/autoapp/Service/ServiceFactory.cpp +++ b/src/autoapp/Service/ServiceFactory.cpp @@ -49,30 +49,28 @@ #include #include -namespace f1x { - namespace openauto { - namespace autoapp { - namespace service { +namespace f1x::openauto::autoapp::service { - ServiceFactory::ServiceFactory(boost::asio::io_service &ioService, - configuration::IConfiguration::Pointer configuration) - : ioService_(ioService), configuration_(std::move(configuration)) { + ServiceFactory::ServiceFactory(boost::asio::io_service &ioService, + configuration::IConfiguration::Pointer configuration) + : ioService_(ioService), configuration_(std::move(configuration)) { - } + } - ServiceList ServiceFactory::create(aasdk::messenger::IMessenger::Pointer messenger) { - OPENAUTO_LOG(info) << "[ServiceFactory] create()"; - ServiceList serviceList; + ServiceList ServiceFactory::create(aasdk::messenger::IMessenger::Pointer messenger) { + OPENAUTO_LOG(info) << "[ServiceFactory] create()"; + ServiceList serviceList; - this->createMediaSinkServices(serviceList, messenger); - this->createMediaSourceServices(serviceList, messenger); - serviceList.emplace_back(this->createSensorService(messenger)); - serviceList.emplace_back(this->createBluetoothService(messenger)); - serviceList.emplace_back(this->createInputService(messenger)); - //serviceList.emplace_back(this->createWifiProjectionService(messenger)); + this->createMediaSinkServices(serviceList, messenger); + this->createMediaSourceServices(serviceList, messenger); + serviceList.emplace_back(this->createSensorService(messenger)); + serviceList.emplace_back(this->createBluetoothService(messenger)); + serviceList.emplace_back(this->createInputService(messenger)); + // TODO: What is WiFi Projection Service? + //serviceList.emplace_back(this->createWifiProjectionService(messenger)); - return serviceList; - } + return serviceList; + } IService::Pointer ServiceFactory::createBluetoothService(aasdk::messenger::IMessenger::Pointer messenger) { OPENAUTO_LOG(info) << "[ServiceFactory] createBluetoothService()"; @@ -97,123 +95,123 @@ namespace f1x { break; } - return std::make_shared(ioService_, messenger, std::move(bluetoothDevice)); - } + return std::make_shared(ioService_, messenger, std::move(bluetoothDevice)); + } - IService::Pointer ServiceFactory::createInputService(aasdk::messenger::IMessenger::Pointer messenger) { - OPENAUTO_LOG(info) << "[ServiceFactory] createInputService()"; - QRect videoGeometry; - switch (configuration_->getVideoResolution()) { - case aap_protobuf::service::media::sink::message::VideoCodecResolutionType::VIDEO_1280x720: - OPENAUTO_LOG(info) << "[ServiceFactory] Resolution 1280x720"; - videoGeometry = QRect(0, 0, 1280, 720); - break; - case aap_protobuf::service::media::sink::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; - } + IService::Pointer ServiceFactory::createInputService(aasdk::messenger::IMessenger::Pointer messenger) { + OPENAUTO_LOG(info) << "[ServiceFactory] createInputService()"; + QRect videoGeometry; + switch (configuration_->getVideoResolution()) { + case aap_protobuf::service::media::sink::message::VideoCodecResolutionType::VIDEO_1280x720: + OPENAUTO_LOG(info) << "[ServiceFactory] Resolution 1280x720"; + videoGeometry = QRect(0, 0, 1280, 720); + break; + case aap_protobuf::service::media::sink::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; + } - QScreen *screen = QGuiApplication::primaryScreen(); - QRect screenGeometry = screen == nullptr ? QRect(0, 0, 1, 1) : screen->geometry(); - projection::IInputDevice::Pointer inputDevice( - std::make_shared(*QApplication::instance(), configuration_, - std::move(screenGeometry), std::move(videoGeometry))); + QScreen *screen = QGuiApplication::primaryScreen(); + QRect screenGeometry = screen == nullptr ? QRect(0, 0, 1, 1) : screen->geometry(); + projection::IInputDevice::Pointer inputDevice( + std::make_shared(*QApplication::instance(), configuration_, + std::move(screenGeometry), std::move(videoGeometry))); - return std::make_shared(ioService_, messenger, std::move(inputDevice)); - } + return std::make_shared(ioService_, messenger, std::move(inputDevice)); + } - 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(2, 16, 48000) : - projection::IAudioOutput::Pointer(new projection::QtAudioOutput(2, 16, 48000), - std::bind(&QObject::deleteLater, std::placeholders::_1)); + 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(2, 16, 48000) : + projection::IAudioOutput::Pointer(new projection::QtAudioOutput(2, 16, 48000), + std::bind(&QObject::deleteLater, std::placeholders::_1)); - serviceList.emplace_back( - std::make_shared(ioService_, messenger, std::move(mediaAudioOutput))); - } + serviceList.emplace_back( + std::make_shared(ioService_, messenger, std::move(mediaAudioOutput))); + } - if (configuration_->guidanceAudioChannelEnabled()) { - OPENAUTO_LOG(info) << "[ServiceFactory] Guidance Audio Channel enabled"; - auto guidanceAudioOutput = - configuration_->getAudioOutputBackendType() == configuration::AudioOutputBackendType::RTAUDIO ? - std::make_shared(1, 16, 16000) : - projection::IAudioOutput::Pointer(new projection::QtAudioOutput(1, 16, 16000), - std::bind(&QObject::deleteLater, std::placeholders::_1)); + if (configuration_->guidanceAudioChannelEnabled()) { + OPENAUTO_LOG(info) << "[ServiceFactory] Guidance Audio Channel enabled"; + auto guidanceAudioOutput = + configuration_->getAudioOutputBackendType() == configuration::AudioOutputBackendType::RTAUDIO ? + std::make_shared(1, 16, 16000) : + projection::IAudioOutput::Pointer(new projection::QtAudioOutput(1, 16, 16000), + std::bind(&QObject::deleteLater, std::placeholders::_1)); - serviceList.emplace_back( - std::make_shared(ioService_, messenger, - std::move(guidanceAudioOutput))); - } + serviceList.emplace_back( + std::make_shared(ioService_, messenger, + std::move(guidanceAudioOutput))); + } - if (configuration_->telephonyAudioChannelEnabled()) { - OPENAUTO_LOG(info) << "[ServiceFactory] Telephony Audio Channel enabled"; - auto telephonyAudioOutput = - configuration_->getAudioOutputBackendType() == configuration::AudioOutputBackendType::RTAUDIO ? - std::make_shared(1, 16, 16000) : - projection::IAudioOutput::Pointer(new projection::QtAudioOutput(1, 16, 16000), - std::bind(&QObject::deleteLater, std::placeholders::_1)); + if (configuration_->telephonyAudioChannelEnabled()) { + OPENAUTO_LOG(info) << "[ServiceFactory] Telephony Audio Channel enabled"; + auto telephonyAudioOutput = + configuration_->getAudioOutputBackendType() == configuration::AudioOutputBackendType::RTAUDIO ? + std::make_shared(1, 16, 16000) : + projection::IAudioOutput::Pointer(new projection::QtAudioOutput(1, 16, 16000), + std::bind(&QObject::deleteLater, std::placeholders::_1)); - serviceList.emplace_back( - std::make_shared(ioService_, messenger, - std::move(telephonyAudioOutput))); - } + serviceList.emplace_back( + std::make_shared(ioService_, messenger, + std::move(telephonyAudioOutput))); + } - /* - * No Need to Check for systemAudioChannelEnabled - MUST be enabled by default. - */ + /* + * 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(1, 16, 16000) : - projection::IAudioOutput::Pointer(new projection::QtAudioOutput(1, 16, 16000), - std::bind(&QObject::deleteLater, std::placeholders::_1)); + OPENAUTO_LOG(info) << "[ServiceFactory] System Audio Channel enabled"; + auto systemAudioOutput = + configuration_->getAudioOutputBackendType() == configuration::AudioOutputBackendType::RTAUDIO ? + std::make_shared(1, 16, 16000) : + projection::IAudioOutput::Pointer(new projection::QtAudioOutput(1, 16, 16000), + std::bind(&QObject::deleteLater, std::placeholders::_1)); - serviceList.emplace_back( - std::make_shared(ioService_, messenger, std::move(systemAudioOutput))); + serviceList.emplace_back( + std::make_shared(ioService_, messenger, std::move(systemAudioOutput))); #ifdef USE_OMX - auto videoOutput(std::make_shared(configuration_)); + auto videoOutput(std::make_shared(configuration_)); #else - projection::IVideoOutput::Pointer videoOutput(new projection::QtVideoOutput(configuration_), - std::bind(&QObject::deleteLater, std::placeholders::_1)); + projection::IVideoOutput::Pointer videoOutput(new projection::QtVideoOutput(configuration_), + std::bind(&QObject::deleteLater, std::placeholders::_1)); #endif - OPENAUTO_LOG(info) << "[ServiceFactory] Video Channel enabled"; - serviceList.emplace_back( - std::make_shared(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(ioService_, messenger, - std::move(audioInput))); - } - - IService::Pointer ServiceFactory::createSensorService(aasdk::messenger::IMessenger::Pointer messenger) { - OPENAUTO_LOG(info) << "[ServiceFactory] createSensorService()"; - return std::make_shared(ioService_, messenger); - } - - IService::Pointer ServiceFactory::createWifiProjectionService(aasdk::messenger::IMessenger::Pointer messenger) { - OPENAUTO_LOG(info) << "[ServiceFactory] createWifiProjectionService()"; - return std::make_shared(ioService_, messenger); - } - - } - } + OPENAUTO_LOG(info) << "[ServiceFactory] Video Channel enabled"; + serviceList.emplace_back( + std::make_shared(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(ioService_, messenger, + std::move(audioInput))); + } + + IService::Pointer ServiceFactory::createSensorService(aasdk::messenger::IMessenger::Pointer messenger) { + OPENAUTO_LOG(info) << "[ServiceFactory] createSensorService()"; + return std::make_shared(ioService_, messenger); + } + + IService::Pointer ServiceFactory::createWifiProjectionService(aasdk::messenger::IMessenger::Pointer messenger) { + OPENAUTO_LOG(info) << "[ServiceFactory] createWifiProjectionService()"; + return std::make_shared(ioService_, messenger); + } + } + + + diff --git a/src/autoapp/Service/VendorExtension/VendorExtensionService.cpp b/src/autoapp/Service/VendorExtension/VendorExtensionService.cpp index a6b8ca9..333eb13 100644 --- a/src/autoapp/Service/VendorExtension/VendorExtensionService.cpp +++ b/src/autoapp/Service/VendorExtension/VendorExtensionService.cpp @@ -21,74 +21,72 @@ #include #include -namespace f1x { - namespace openauto { - namespace autoapp { - namespace service { - namespace vendorextension { +namespace f1x::openauto::autoapp::service::vendorextension { - VendorExtensionService::VendorExtensionService(boost::asio::io_service &ioService, - aasdk::messenger::IMessenger::Pointer messenger) - : strand_(ioService), - timer_(ioService), - channel_(std::make_shared(strand_, std::move(messenger))) { + VendorExtensionService::VendorExtensionService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger) + : strand_(ioService), + timer_(ioService), + channel_( + std::make_shared(strand_, std::move(messenger))) { - } - - void VendorExtensionService::start() { - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[VendorExtensionService] start()"; - }); - } - - void VendorExtensionService::stop() { - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[VendorExtensionService] stop()"; - }); - } - - void VendorExtensionService::pause() { - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[VendorExtensionService] pause()"; - }); - } - - void VendorExtensionService::resume() { - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[VendorExtensionService] resume()"; - }); - } - - void VendorExtensionService::fillFeatures( - aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) { - OPENAUTO_LOG(info) << "[VendorExtensionService] fillFeatures()"; - - auto *service = response.add_channels(); - service->set_id(static_cast(channel_->getId())); - - auto *vendorExtension = service->mutable_vendor_extension_service(); - } - - void VendorExtensionService::onChannelError(const aasdk::error::Error &e) { - OPENAUTO_LOG(error) << "[VendorExtensionService] onChannelError(): " << e.what(); - } - - void VendorExtensionService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { - OPENAUTO_LOG(info) << "[VendorExtensionService] onChannelOpenRequest()"; - OPENAUTO_LOG(info) << "[VendorExtensionService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); - - aap_protobuf::service::control::message::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()); - } - } - } - } } -} \ No newline at end of file + + void VendorExtensionService::start() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[VendorExtensionService] start()"; + }); + } + + void VendorExtensionService::stop() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[VendorExtensionService] stop()"; + }); + } + + void VendorExtensionService::pause() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[VendorExtensionService] pause()"; + }); + } + + void VendorExtensionService::resume() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[VendorExtensionService] resume()"; + }); + } + + void VendorExtensionService::fillFeatures( + aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) { + OPENAUTO_LOG(info) << "[VendorExtensionService] fillFeatures()"; + + auto *service = response.add_channels(); + service->set_id(static_cast(channel_->getId())); + + auto *vendorExtension = service->mutable_vendor_extension_service(); + } + + void VendorExtensionService::onChannelError(const aasdk::error::Error &e) { + OPENAUTO_LOG(error) << "[VendorExtensionService] onChannelError(): " << e.what(); + } + + void VendorExtensionService::onChannelOpenRequest( + const aap_protobuf::service::control::message::ChannelOpenRequest &request) { + OPENAUTO_LOG(info) << "[VendorExtensionService] onChannelOpenRequest()"; + OPENAUTO_LOG(info) << "[VendorExtensionService] Channel Id: " << request.service_id() << ", Priority: " + << request.priority(); + + aap_protobuf::service::control::message::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()); + } +} + + + diff --git a/src/autoapp/Service/WifiProjection/WifiProjectionService.cpp b/src/autoapp/Service/WifiProjection/WifiProjectionService.cpp index d4956c3..080a898 100644 --- a/src/autoapp/Service/WifiProjection/WifiProjectionService.cpp +++ b/src/autoapp/Service/WifiProjection/WifiProjectionService.cpp @@ -22,97 +22,97 @@ #include #include -namespace f1x { - namespace openauto { - namespace autoapp { - namespace service { - namespace wifiprojection { - WifiProjectionService::WifiProjectionService(boost::asio::io_service &ioService, - aasdk::messenger::IMessenger::Pointer messenger) - : strand_(ioService), - timer_(ioService), - channel_(std::make_shared(strand_, std::move(messenger))) { - } +namespace f1x::openauto::autoapp::service::wifiprojection { + WifiProjectionService::WifiProjectionService(boost::asio::io_service &ioService, + aasdk::messenger::IMessenger::Pointer messenger) + : strand_(ioService), + timer_(ioService), + channel_( + std::make_shared(strand_, std::move(messenger))) { - void WifiProjectionService::start() { - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[WifiProjectionService] start()"; - }); - } - - void WifiProjectionService::stop() { - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[WifiProjectionService] stop()"; - }); - } - - void WifiProjectionService::pause() { - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[WifiProjectionService] pause()"; - }); - } - - void WifiProjectionService::resume() { - strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[WifiProjectionService] resume()"; - }); - } - - void WifiProjectionService::fillFeatures( - aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) { - OPENAUTO_LOG(info) << "[WifiProjectionService] fillFeatures()"; - - auto *service = response.add_channels(); - service->set_id(static_cast(channel_->getId())); - - auto *wifiChannel = service->mutable_wifi_projection_service(); - wifiChannel->set_car_wifi_bssid(QNetworkInterface::interfaceFromName("wlan0").hardwareAddress().toStdString()); - } - - void WifiProjectionService::onWifiCredentialsRequest( - const aap_protobuf::service::wifiprojection::message::WifiCredentialsRequest &request) { - - OPENAUTO_LOG(info) << "[WifiProjectionService] onWifiCredentialsRequest()"; - - aap_protobuf::service::wifiprojection::message::WifiCredentialsResponse response; - - response.set_access_point_type(aap_protobuf::service::wifiprojection::message::AccessPointType::STATIC); - response.set_car_wifi_ssid("CRANKSHAFT-NG"); - response.set_car_wifi_password("1234567890"); - response.set_car_wifi_security_mode(aap_protobuf::service::wifiprojection::message::WifiSecurityMode::WPA2_PERSONAL); - - auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() {}, std::bind(&WifiProjectionService::onChannelError, this->shared_from_this(), - std::placeholders::_1)); - channel_->sendWifiCredentialsResponse(response, std::move(promise)); - channel_->receive(this->shared_from_this()); - - } - - void WifiProjectionService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { - OPENAUTO_LOG(info) << "[WifiProjectionService] onChannelOpenRequest()"; - OPENAUTO_LOG(debug) << "[WifiProjectionService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); - - aap_protobuf::service::control::message::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(&WifiProjectionService::onChannelError, this->shared_from_this(), - std::placeholders::_1)); - channel_->sendChannelOpenResponse(response, std::move(promise)); - - channel_->receive(this->shared_from_this()); - } - - void WifiProjectionService::onChannelError(const aasdk::error::Error &e) { - OPENAUTO_LOG(error) << "[WifiProjectionService] onChannelError(): " << e.what(); - } - - - } - } - } } -} \ No newline at end of file + + void WifiProjectionService::start() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[WifiProjectionService] start()"; + }); + } + + void WifiProjectionService::stop() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[WifiProjectionService] stop()"; + }); + } + + void WifiProjectionService::pause() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[WifiProjectionService] pause()"; + }); + } + + void WifiProjectionService::resume() { + strand_.dispatch([this, self = this->shared_from_this()]() { + OPENAUTO_LOG(info) << "[WifiProjectionService] resume()"; + }); + } + + void WifiProjectionService::fillFeatures( + aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) { + OPENAUTO_LOG(info) << "[WifiProjectionService] fillFeatures()"; + + auto *service = response.add_channels(); + service->set_id(static_cast(channel_->getId())); + + auto *wifiChannel = service->mutable_wifi_projection_service(); + wifiChannel->set_car_wifi_bssid(QNetworkInterface::interfaceFromName("wlan0").hardwareAddress().toStdString()); + } + + void WifiProjectionService::onWifiCredentialsRequest( + const aap_protobuf::service::wifiprojection::message::WifiCredentialsRequest &request) { + + OPENAUTO_LOG(info) << "[WifiProjectionService] onWifiCredentialsRequest()"; + + aap_protobuf::service::wifiprojection::message::WifiCredentialsResponse response; + + response.set_access_point_type(aap_protobuf::service::wifiprojection::message::AccessPointType::STATIC); + response.set_car_wifi_ssid("CRANKSHAFT-NG"); + response.set_car_wifi_password("1234567890"); + response.set_car_wifi_security_mode( + aap_protobuf::service::wifiprojection::message::WifiSecurityMode::WPA2_PERSONAL); + + auto promise = aasdk::channel::SendPromise::defer(strand_); + promise->then([]() {}, std::bind(&WifiProjectionService::onChannelError, this->shared_from_this(), + std::placeholders::_1)); + channel_->sendWifiCredentialsResponse(response, std::move(promise)); + channel_->receive(this->shared_from_this()); + + } + + void WifiProjectionService::onChannelOpenRequest( + const aap_protobuf::service::control::message::ChannelOpenRequest &request) { + OPENAUTO_LOG(info) << "[WifiProjectionService] onChannelOpenRequest()"; + OPENAUTO_LOG(debug) << "[WifiProjectionService] Channel Id: " << request.service_id() << ", Priority: " + << request.priority(); + + aap_protobuf::service::control::message::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(&WifiProjectionService::onChannelError, this->shared_from_this(), + std::placeholders::_1)); + channel_->sendChannelOpenResponse(response, std::move(promise)); + + channel_->receive(this->shared_from_this()); + } + + void WifiProjectionService::onChannelError(const aasdk::error::Error &e) { + OPENAUTO_LOG(error) << "[WifiProjectionService] onChannelError(): " << e.what(); + } + + +} + + + diff --git a/src/autoapp/UI/SettingsWindow.cpp b/src/autoapp/UI/SettingsWindow.cpp index f07a0b3..d7840a6 100644 --- a/src/autoapp/UI/SettingsWindow.cpp +++ b/src/autoapp/UI/SettingsWindow.cpp @@ -15,34 +15,39 @@ * You should have received a copy of the GNU General Public License * along with openauto. If not, see . */ - -#include +#include +#include #include -#include "ui_settingswindow.h" // AutoGenerated at Compile Time +#include +#include +#include +#include +#include +#include +#include #include #include -#include -#include -#include -#include +#include #include -#include -#include #include +#include +#include +#include +#include "ui_settingswindow.h" // AutoGenerated at Compile Time #ifdef MAC_OS + #include #include #include #include #include #include + #endif -namespace f1x { - namespace openauto { - namespace autoapp { - namespace ui { + +namespace f1x::openauto::autoapp::ui { SettingsWindow::SettingsWindow(configuration::IConfiguration::Pointer configuration, QWidget *parent) : QWidget(parent), ui_(new Ui::SettingsWindow), configuration_(std::move(configuration)) { @@ -100,101 +105,101 @@ namespace f1x { connect(ui_->pushButtonSambaStop, &QPushButton::clicked, [&]() { system("/usr/local/bin/crankshaft samba stop &"); }); - // menu - ui_->tab1->show(); - ui_->tab2->hide(); - ui_->tab3->hide(); - ui_->tab4->hide(); - ui_->tab5->hide(); - ui_->tab6->hide(); - ui_->tab7->hide(); - ui_->tab8->hide(); - ui_->tab9->hide(); + // menu + ui_->tab1->show(); + ui_->tab2->hide(); + ui_->tab3->hide(); + ui_->tab4->hide(); + ui_->tab5->hide(); + ui_->tab6->hide(); + ui_->tab7->hide(); + ui_->tab8->hide(); + ui_->tab9->hide(); ui_->horizontalGroupBox->hide(); ui_->labelBluetoothAdapterAddress->hide(); ui_->lineEditExternalBluetoothAdapterAddress->hide(); ui_->labelTestInProgress->hide(); - connect(ui_->pushButtonTab1, &QPushButton::clicked, this, &SettingsWindow::show_tab1); - connect(ui_->pushButtonTab2, &QPushButton::clicked, this, &SettingsWindow::show_tab2); - connect(ui_->pushButtonTab3, &QPushButton::clicked, this, &SettingsWindow::show_tab3); - connect(ui_->pushButtonTab4, &QPushButton::clicked, this, &SettingsWindow::show_tab4); - connect(ui_->pushButtonTab5, &QPushButton::clicked, this, &SettingsWindow::show_tab5); - connect(ui_->pushButtonTab5, &QPushButton::clicked, this, &SettingsWindow::updateNetworkInfo); - connect(ui_->pushButtonTab6, &QPushButton::clicked, this, &SettingsWindow::show_tab6); - connect(ui_->pushButtonTab6, &QPushButton::clicked, this, &SettingsWindow::updateSystemInfo); - connect(ui_->pushButtonTab7, &QPushButton::clicked, this, &SettingsWindow::show_tab7); - connect(ui_->pushButtonTab8, &QPushButton::clicked, this, &SettingsWindow::show_tab8); - connect(ui_->pushButtonTab9, &QPushButton::clicked, this, &SettingsWindow::show_tab9); + connect(ui_->pushButtonTab1, &QPushButton::clicked, this, &SettingsWindow::show_tab1); + connect(ui_->pushButtonTab2, &QPushButton::clicked, this, &SettingsWindow::show_tab2); + connect(ui_->pushButtonTab3, &QPushButton::clicked, this, &SettingsWindow::show_tab3); + connect(ui_->pushButtonTab4, &QPushButton::clicked, this, &SettingsWindow::show_tab4); + connect(ui_->pushButtonTab5, &QPushButton::clicked, this, &SettingsWindow::show_tab5); + connect(ui_->pushButtonTab5, &QPushButton::clicked, this, &SettingsWindow::updateNetworkInfo); + connect(ui_->pushButtonTab6, &QPushButton::clicked, this, &SettingsWindow::show_tab6); + connect(ui_->pushButtonTab6, &QPushButton::clicked, this, &SettingsWindow::updateSystemInfo); + connect(ui_->pushButtonTab7, &QPushButton::clicked, this, &SettingsWindow::show_tab7); + connect(ui_->pushButtonTab8, &QPushButton::clicked, this, &SettingsWindow::show_tab8); + connect(ui_->pushButtonTab9, &QPushButton::clicked, this, &SettingsWindow::show_tab9); - QTime time = QTime::currentTime(); - QString time_text_hour = time.toString("hh"); - QString time_text_minute = time.toString("mm"); - ui_->spinBoxHour->setValue((time_text_hour).toInt()); - ui_->spinBoxMinute->setValue((time_text_minute).toInt()); - ui_->label_modeswitchprogress->setText("Ok"); - ui_->label_notavailable->hide(); + QTime time = QTime::currentTime(); + QString time_text_hour = time.toString("hh"); + QString time_text_minute = time.toString("mm"); + ui_->spinBoxHour->setValue((time_text_hour).toInt()); + ui_->spinBoxMinute->setValue((time_text_minute).toInt()); + ui_->label_modeswitchprogress->setText("Ok"); + ui_->label_notavailable->hide(); - QString wifi_ssid = configuration_->getCSValue("WIFI_SSID"); - QString wifi2_ssid = configuration_->getCSValue("WIFI2_SSID"); + QString wifi_ssid = configuration_->getCSValue("WIFI_SSID"); + QString wifi2_ssid = configuration_->getCSValue("WIFI2_SSID"); - ui_->pushButtonNetwork0->setText(wifi_ssid); - ui_->pushButtonNetwork1->setText(wifi2_ssid); + ui_->pushButtonNetwork0->setText(wifi_ssid); + ui_->pushButtonNetwork1->setText(wifi2_ssid); - if (!std::ifstream("/boot/crankshaft/network1.conf")) { - ui_->pushButtonNetwork1->hide(); - ui_->pushButtonNetwork0->show(); - } - if (!std::ifstream("/boot/crankshaft/network0.conf")) { - ui_->pushButtonNetwork1->hide(); - ui_->pushButtonNetwork0->setText(configuration_->getCSValue("WIFI2_SSID")); - } - if (!std::ifstream("/boot/crankshaft/network0.conf") && !std::ifstream("/boot/crankshaft/network1.conf")) { - ui_->pushButtonNetwork0->hide(); - ui_->pushButtonNetwork1->hide(); - ui_->pushButtonNetworkAuto->hide(); - ui_->label_notavailable->show(); - } + if (!std::ifstream("/boot/crankshaft/network1.conf")) { + ui_->pushButtonNetwork1->hide(); + ui_->pushButtonNetwork0->show(); + } + if (!std::ifstream("/boot/crankshaft/network0.conf")) { + ui_->pushButtonNetwork1->hide(); + ui_->pushButtonNetwork0->setText(configuration_->getCSValue("WIFI2_SSID")); + } + if (!std::ifstream("/boot/crankshaft/network0.conf") && !std::ifstream("/boot/crankshaft/network1.conf")) { + ui_->pushButtonNetwork0->hide(); + ui_->pushButtonNetwork1->hide(); + ui_->pushButtonNetworkAuto->hide(); + ui_->label_notavailable->show(); + } - if (std::ifstream("/tmp/hotspot_active")) { - ui_->radioButtonClient->setChecked(0); - ui_->radioButtonHotspot->setChecked(1); - ui_->lineEditWifiSSID->setText(configuration_->getParamFromFile("/etc/hostapd/hostapd.conf", "ssid")); - ui_->lineEditPassword->show(); - ui_->label_password->show(); - ui_->lineEditPassword->setText("1234567890"); - ui_->clientNetworkSelect->hide(); - ui_->label_notavailable->show(); - } else { - ui_->radioButtonClient->setChecked(1); - ui_->radioButtonHotspot->setChecked(0); - ui_->lineEditWifiSSID->setText(configuration_->readFileContent("/tmp/wifi_ssid")); - ui_->lineEditPassword->hide(); - ui_->label_password->hide(); - ui_->lineEditPassword->setText(""); - ui_->clientNetworkSelect->hide(); - ui_->label_notavailable->show(); - } + if (std::ifstream("/tmp/hotspot_active")) { + ui_->radioButtonClient->setChecked(0); + ui_->radioButtonHotspot->setChecked(1); + ui_->lineEditWifiSSID->setText(configuration_->getParamFromFile("/etc/hostapd/hostapd.conf", "ssid")); + ui_->lineEditPassword->show(); + ui_->label_password->show(); + ui_->lineEditPassword->setText("1234567890"); + ui_->clientNetworkSelect->hide(); + ui_->label_notavailable->show(); + } else { + ui_->radioButtonClient->setChecked(1); + ui_->radioButtonHotspot->setChecked(0); + ui_->lineEditWifiSSID->setText(configuration_->readFileContent("/tmp/wifi_ssid")); + ui_->lineEditPassword->hide(); + ui_->label_password->hide(); + ui_->lineEditPassword->setText(""); + ui_->clientNetworkSelect->hide(); + ui_->label_notavailable->show(); + } - if (std::ifstream("/tmp/samba_running")) { - ui_->labelSambaStatus->setText("running"); - ui_->pushButtonSambaStart->hide(); - ui_->pushButtonSambaStop->show(); - } else { - ui_->labelSambaStatus->setText("stopped"); - ui_->pushButtonSambaStop->hide(); - ui_->pushButtonSambaStart->show(); - } + if (std::ifstream("/tmp/samba_running")) { + ui_->labelSambaStatus->setText("running"); + ui_->pushButtonSambaStart->hide(); + ui_->pushButtonSambaStop->show(); + } else { + ui_->labelSambaStatus->setText("stopped"); + ui_->pushButtonSambaStop->hide(); + ui_->pushButtonSambaStart->show(); + } - QTimer *refresh = new QTimer(this); - connect(refresh, SIGNAL(timeout()), this, SLOT(updateInfo())); - refresh->start(5000); - } + QTimer *refresh = new QTimer(this); + connect(refresh, SIGNAL(timeout()), this, SLOT(updateInfo())); + refresh->start(5000); + } - SettingsWindow::~SettingsWindow() { - delete ui_; - } + SettingsWindow::~SettingsWindow() { + delete ui_; + } void SettingsWindow::updateInfo() { if (ui_->tab6->isVisible() == true) { @@ -205,61 +210,57 @@ namespace f1x { } } - void SettingsWindow::onSave() { - configuration_->setHandednessOfTrafficType( - ui_->radioButtonLeftHandDrive->isChecked() ? configuration::HandednessOfTrafficType::LEFT_HAND_DRIVE - : configuration::HandednessOfTrafficType::RIGHT_HAND_DRIVE); + void SettingsWindow::onSave() { + configuration_->setHandednessOfTrafficType( + ui_->radioButtonLeftHandDrive->isChecked() ? configuration::HandednessOfTrafficType::LEFT_HAND_DRIVE + : configuration::HandednessOfTrafficType::RIGHT_HAND_DRIVE); - configuration_->showClock(ui_->checkBoxShowClock->isChecked()); - configuration_->showBigClock(ui_->checkBoxShowBigClock->isChecked()); - configuration_->oldGUI(ui_->checkBoxOldGUI->isChecked()); - configuration_->setAlphaTrans(static_cast(ui_->horizontalSliderAlphaTrans->value())); - configuration_->hideMenuToggle(ui_->checkBoxHideMenuToggle->isChecked()); - configuration_->showLux(ui_->checkBoxShowLux->isChecked()); - configuration_->showCursor(ui_->checkBoxShowCursor->isChecked()); - configuration_->hideBrightnessControl(ui_->checkBoxHideBrightnessControl->isChecked()); - configuration_->showNetworkinfo(ui_->checkBoxNetworkinfo->isChecked()); - configuration_->mp3AutoPlay(ui_->checkBoxAutoPlay->isChecked()); - configuration_->showAutoPlay(ui_->checkBoxShowPlayer->isChecked()); - configuration_->instantPlay(ui_->checkBoxInstantPlay->isChecked()); - configuration_->hideWarning(ui_->checkBoxDontShowAgain->isChecked()); + configuration_->showClock(ui_->checkBoxShowClock->isChecked()); + configuration_->showBigClock(ui_->checkBoxShowBigClock->isChecked()); + configuration_->oldGUI(ui_->checkBoxOldGUI->isChecked()); + configuration_->setAlphaTrans(static_cast(ui_->horizontalSliderAlphaTrans->value())); + configuration_->hideMenuToggle(ui_->checkBoxHideMenuToggle->isChecked()); + configuration_->showLux(ui_->checkBoxShowLux->isChecked()); + configuration_->showCursor(ui_->checkBoxShowCursor->isChecked()); + configuration_->hideBrightnessControl(ui_->checkBoxHideBrightnessControl->isChecked()); + configuration_->showNetworkinfo(ui_->checkBoxNetworkinfo->isChecked()); + configuration_->mp3AutoPlay(ui_->checkBoxAutoPlay->isChecked()); + configuration_->showAutoPlay(ui_->checkBoxShowPlayer->isChecked()); + configuration_->instantPlay(ui_->checkBoxInstantPlay->isChecked()); + configuration_->hideWarning(ui_->checkBoxDontShowAgain->isChecked()); - configuration_->setVideoFPS(ui_->radioButton30FPS->isChecked() - ? aap_protobuf::service::media::sink::message::VideoFrameRateType::VIDEO_FPS_30 - : aap_protobuf::service::media::sink::message::VideoFrameRateType::VIDEO_FPS_60); + configuration_->setVideoFPS(ui_->radioButton30FPS->isChecked() + ? aap_protobuf::service::media::sink::message::VideoFrameRateType::VIDEO_FPS_30 + : aap_protobuf::service::media::sink::message::VideoFrameRateType::VIDEO_FPS_60); - if (ui_->radioButton480p->isChecked()) { - configuration_->setVideoResolution( - aap_protobuf::service::media::sink::message::VideoCodecResolutionType::VIDEO_800x480); - } else if (ui_->radioButton720p->isChecked()) { - configuration_->setVideoResolution( - aap_protobuf::service::media::sink::message::VideoCodecResolutionType::VIDEO_1280x720); - } else if (ui_->radioButton1080p->isChecked()) { - configuration_->setVideoResolution( - aap_protobuf::service::media::sink::message::VideoCodecResolutionType::VIDEO_1920x1080); - } + if (ui_->radioButton480p->isChecked()) { + configuration_->setVideoResolution( + aap_protobuf::service::media::sink::message::VideoCodecResolutionType::VIDEO_800x480); + } else if (ui_->radioButton720p->isChecked()) { + configuration_->setVideoResolution( + aap_protobuf::service::media::sink::message::VideoCodecResolutionType::VIDEO_1280x720); + } else if (ui_->radioButton1080p->isChecked()) { + configuration_->setVideoResolution( + aap_protobuf::service::media::sink::message::VideoCodecResolutionType::VIDEO_1920x1080); + } - configuration_->setScreenDPI(static_cast(ui_->horizontalSliderScreenDPI->value())); - configuration_->setOMXLayerIndex(ui_->spinBoxOmxLayerIndex->value()); + configuration_->setScreenDPI(static_cast(ui_->horizontalSliderScreenDPI->value())); + configuration_->setOMXLayerIndex(ui_->spinBoxOmxLayerIndex->value()); - QRect videoMargins(0, 0, ui_->spinBoxVideoMarginWidth->value(), ui_->spinBoxVideoMarginHeight->value()); - configuration_->setVideoMargins(std::move(videoMargins)); + QRect videoMargins(0, 0, ui_->spinBoxVideoMarginWidth->value(), ui_->spinBoxVideoMarginHeight->value()); + configuration_->setVideoMargins(std::move(videoMargins)); - configuration_->setTouchscreenEnabled(ui_->checkBoxEnableTouchscreen->isChecked()); - this->saveButtonCheckBoxes(); + configuration_->setTouchscreenEnabled(ui_->checkBoxEnableTouchscreen->isChecked()); + this->saveButtonCheckBoxes(); - configuration_->playerButtonControl(ui_->checkBoxPlayerControl->isChecked()); + configuration_->playerButtonControl(ui_->checkBoxPlayerControl->isChecked()); - if (ui_->radioButtonDisableBluetooth->isChecked()) { - configuration_->setBluetoothAdapterType(configuration::BluetoothAdapterType::NONE); - } else if (ui_->radioButtonUseLocalBluetoothAdapter->isChecked()) { - configuration_->setBluetoothAdapterType(configuration::BluetoothAdapterType::LOCAL); - } else if (ui_->radioButtonUseExternalBluetoothAdapter->isChecked()) { - configuration_->setBluetoothAdapterType(configuration::BluetoothAdapterType::REMOTE); - } - - configuration_->setBluetoothRemoteAdapterAddress( - ui_->lineEditExternalBluetoothAdapterAddress->text().toStdString()); + if (ui_->comboBoxBluetooth->currentText() == "none") { + configuration_->setBluetoothAdapterAddress(""); // or any string that indicates no adapter + } else { + configuration_->setBluetoothAdapterAddress( + ui_->comboBoxBluetooth->currentData().toString().toStdString()); + } configuration_->setMusicAudioChannelEnabled(ui_->checkBoxMusicAudioChannel->isChecked()); configuration_->setGuidanceAudioChannelEnabled(ui_->checkBoxSpeechAudioChannel->isChecked()); @@ -267,273 +268,278 @@ namespace f1x { configuration_->setAudioOutputBackendType( ui_->radioButtonRtAudio->isChecked() ? configuration::AudioOutputBackendType::RTAUDIO : configuration::AudioOutputBackendType::QT); + configuration_->setMusicAudioChannelEnabled(ui_->checkBoxMusicAudioChannel->isChecked()); + configuration_->setGuidanceAudioChannelEnabled(ui_->checkBoxSpeechAudioChannel->isChecked()); + configuration_->setAudioOutputBackendType( + ui_->radioButtonRtAudio->isChecked() ? configuration::AudioOutputBackendType::RTAUDIO + : configuration::AudioOutputBackendType::QT); - configuration_->save(); + configuration_->save(); - // generate param string for autoapp_helper - std::string params; - params.append(std::to_string(ui_->horizontalSliderSystemVolume->value())); - params.append("#"); - params.append(std::to_string(ui_->horizontalSliderSystemCapture->value())); - params.append("#"); - params.append(std::to_string(ui_->spinBoxDisconnect->value())); - params.append("#"); - params.append(std::to_string(ui_->spinBoxShutdown->value())); - params.append("#"); - params.append(std::to_string(ui_->spinBoxDay->value())); - params.append("#"); - params.append(std::to_string(ui_->spinBoxNight->value())); - params.append("#"); - if (ui_->checkBoxGPIO->isChecked()) { - params.append("1"); - } else { - params.append("0"); - } - params.append("#"); - params.append(std::string(ui_->comboBoxDevMode->currentText().toStdString())); - params.append("#"); - params.append(std::string(ui_->comboBoxInvert->currentText().toStdString())); - params.append("#"); - params.append(std::string(ui_->comboBoxX11->currentText().toStdString())); - params.append("#"); - params.append(std::string(ui_->comboBoxRearcam->currentText().toStdString())); - params.append("#"); - params.append(std::string(ui_->comboBoxAndroid->currentText().toStdString())); - params.append("#"); - if (ui_->radioButtonX11->isChecked()) { - params.append("1"); - } else { - params.append("0"); - } - params.append("#"); - if (ui_->radioButtonScreenRotated->isChecked()) { - params.append("1"); - } else { - params.append("0"); - } - params.append("#"); - params.append( - std::string("'") + std::string(ui_->comboBoxPulseOutput->currentText().toStdString()) + std::string("'")); - params.append("#"); - params.append( - std::string("'") + std::string(ui_->comboBoxPulseInput->currentText().toStdString()) + std::string("'")); - params.append("#"); - params.append(std::string(ui_->comboBoxHardwareRTC->currentText().toStdString())); - params.append("#"); - params.append(std::string(ui_->comboBoxTZ->currentText().toStdString())); - params.append("#"); - params.append(std::string(ui_->comboBoxHardwareDAC->currentText().toStdString())); - params.append("#"); - if (ui_->checkBoxDisableShutdown->isChecked()) { - params.append("1"); - } else { - params.append("0"); - } - params.append("#"); - if (ui_->checkBoxDisableScreenOff->isChecked()) { - params.append("1"); - } else { - params.append("0"); - } - params.append("#"); - if (ui_->radioButtonDebugmodeEnabled->isChecked()) { - params.append("1"); - } else { - params.append("0"); - } - params.append("#"); - params.append(std::string(ui_->comboBoxGPIOShutdown->currentText().toStdString())); - params.append("#"); - params.append(std::to_string(ui_->spinBoxGPIOShutdownDelay->value())); - params.append("#"); - if (ui_->checkBoxHotspot->isChecked()) { - params.append("1"); - } else { - params.append("0"); - } - params.append("#"); - params.append(std::string(ui_->comboBoxCam->currentText().toStdString())); - params.append("#"); - if (ui_->checkBoxBluetoothAutoPair->isChecked()) { - params.append("1"); - } else { - params.append("0"); - } - params.append("#"); - params.append(std::string(ui_->comboBoxBluetooth->currentText().toStdString())); - params.append("#"); - if (ui_->checkBoxHardwareSave->isChecked()) { - params.append("1"); - } else { - params.append("0"); - } - params.append("#"); - params.append(std::string(ui_->comboBoxUSBCam->currentText().toStdString())); - params.append("#"); - params.append(std::string(ui_->comboBoxLS->currentText().split(" ")[0].toStdString())); - params.append("#"); - params.append(std::string(ui_->comboBoxDayNight->currentText().toStdString())); - params.append("#"); - params.append(std::to_string(ui_->horizontalSliderDay->value())); - params.append("#"); - params.append(std::to_string(ui_->horizontalSliderNight->value())); - params.append("#"); - params.append(std::to_string(ui_->horizontalSliderLux1->value())); - params.append("#"); - params.append(std::to_string(ui_->horizontalSliderBrightness1->value())); - params.append("#"); - params.append(std::to_string(ui_->horizontalSliderLux2->value())); - params.append("#"); - params.append(std::to_string(ui_->horizontalSliderBrightness2->value())); - params.append("#"); - params.append(std::to_string(ui_->horizontalSliderLux3->value())); - params.append("#"); - params.append(std::to_string(ui_->horizontalSliderBrightness3->value())); - params.append("#"); - params.append(std::to_string(ui_->horizontalSliderLux4->value())); - params.append("#"); - params.append(std::to_string(ui_->horizontalSliderBrightness4->value())); - params.append("#"); - params.append(std::to_string(ui_->horizontalSliderLux5->value())); - params.append("#"); - params.append(std::to_string(ui_->horizontalSliderBrightness5->value())); - params.append("#"); - params.append(std::string(ui_->comboBoxCheckInterval->currentText().toStdString())); - params.append("#"); - params.append(std::string(ui_->comboBoxNightmodeStep->currentText().toStdString())); - params.append("#"); - if (ui_->checkBoxDisableDayNightRTC->isChecked()) { - params.append("0"); - } else { - params.append("1"); - } - params.append("#"); - if (ui_->radioButtonAnimatedCSNG->isChecked()) { - params.append("0"); - } else if (ui_->radioButtonCSNG->isChecked()) { - params.append("1"); - } else if (ui_->radioButtonCustom->isChecked()) { - params.append("2"); - } - params.append("#"); - params.append( - std::string(ui_->comboBoxCountryCode->currentText().split("|")[0].replace(" ", "").toStdString())); - params.append("#"); - if (ui_->checkBoxBlankOnly->isChecked()) { - params.append("1"); - } else { - params.append("0"); - } - params.append("#"); - if (ui_->checkBoxFlipX->isChecked()) { - params.append("1"); - } else { - params.append("0"); - } - params.append("#"); - if (ui_->checkBoxFlipY->isChecked()) { - params.append("1"); - } else { - params.append("0"); - } - params.append("#"); - params.append(std::string(ui_->comboBoxRotation->currentText().toStdString())); - params.append("#"); - params.append(std::string(ui_->comboBoxResolution->currentText().toStdString())); - params.append("#"); - params.append(std::string((ui_->comboBoxFPS->currentText()).replace(" (not @1080)", "").toStdString())); - params.append("#"); - params.append(std::string(ui_->comboBoxAWB->currentText().toStdString())); - params.append("#"); - params.append(std::string(ui_->comboBoxEXP->currentText().toStdString())); - params.append("#"); - params.append(std::string(ui_->comboBoxLoopTime->currentText().toStdString())); - params.append("#"); - params.append(std::string(ui_->comboBoxLoopCount->currentText().toStdString())); - params.append("#"); - if (ui_->checkBoxAutoRecording->isChecked()) { - params.append("1"); - } else { - params.append("0"); - } - params.append("#"); - if (ui_->checkBoxFlipXUSB->isChecked()) { - params.append("1"); - } else { - params.append("0"); - } - params.append("#"); - if (ui_->checkBoxFlipYUSB->isChecked()) { - params.append("1"); - } else { - params.append("0"); - } - params.append("#"); - params.append(std::string(ui_->comboBoxUSBRotation->currentText().replace("180", "1").toStdString())); - params.append("#"); - system((std::string("/usr/local/bin/autoapp_helper setparams#") + std::string(params) + - std::string(" &")).c_str()); + // generate param string for autoapp_helper + std::string params; + params.append(std::to_string(ui_->horizontalSliderSystemVolume->value())); + params.append("#"); + params.append(std::to_string(ui_->horizontalSliderSystemCapture->value())); + params.append("#"); + params.append(std::to_string(ui_->spinBoxDisconnect->value())); + params.append("#"); + params.append(std::to_string(ui_->spinBoxShutdown->value())); + params.append("#"); + params.append(std::to_string(ui_->spinBoxDay->value())); + params.append("#"); + params.append(std::to_string(ui_->spinBoxNight->value())); + params.append("#"); + if (ui_->checkBoxGPIO->isChecked()) { + params.append("1"); + } else { + params.append("0"); + } + params.append("#"); + params.append(std::string(ui_->comboBoxDevMode->currentText().toStdString())); + params.append("#"); + params.append(std::string(ui_->comboBoxInvert->currentText().toStdString())); + params.append("#"); + params.append(std::string(ui_->comboBoxX11->currentText().toStdString())); + params.append("#"); + params.append(std::string(ui_->comboBoxRearcam->currentText().toStdString())); + params.append("#"); + params.append(std::string(ui_->comboBoxAndroid->currentText().toStdString())); + params.append("#"); + if (ui_->radioButtonX11->isChecked()) { + params.append("1"); + } else { + params.append("0"); + } + params.append("#"); + if (ui_->radioButtonScreenRotated->isChecked()) { + params.append("1"); + } else { + params.append("0"); + } + params.append("#"); + params.append( + std::string("'") + std::string(ui_->comboBoxPulseOutput->currentText().toStdString()) + std::string("'")); + params.append("#"); + params.append( + std::string("'") + std::string(ui_->comboBoxPulseInput->currentText().toStdString()) + std::string("'")); + params.append("#"); + params.append(std::string(ui_->comboBoxHardwareRTC->currentText().toStdString())); + params.append("#"); + params.append(std::string(ui_->comboBoxTZ->currentText().toStdString())); + params.append("#"); + params.append(std::string(ui_->comboBoxHardwareDAC->currentText().toStdString())); + params.append("#"); + if (ui_->checkBoxDisableShutdown->isChecked()) { + params.append("1"); + } else { + params.append("0"); + } + params.append("#"); + if (ui_->checkBoxDisableScreenOff->isChecked()) { + params.append("1"); + } else { + params.append("0"); + } + params.append("#"); + if (ui_->radioButtonDebugmodeEnabled->isChecked()) { + params.append("1"); + } else { + params.append("0"); + } + params.append("#"); + params.append(std::string(ui_->comboBoxGPIOShutdown->currentText().toStdString())); + params.append("#"); + params.append(std::to_string(ui_->spinBoxGPIOShutdownDelay->value())); + params.append("#"); + if (ui_->checkBoxHotspot->isChecked()) { + params.append("1"); + } else { + params.append("0"); + } + params.append("#"); + params.append(std::string(ui_->comboBoxCam->currentText().toStdString())); + params.append("#"); + if (ui_->checkBoxBluetoothAutoPair->isChecked()) { + params.append("1"); + } else { + params.append("0"); + } + params.append("#"); + params.append(std::string(ui_->comboBoxBluetooth->currentText().toStdString())); + params.append("#"); + if (ui_->checkBoxHardwareSave->isChecked()) { + params.append("1"); + } else { + params.append("0"); + } + params.append("#"); + params.append(std::string(ui_->comboBoxUSBCam->currentText().toStdString())); + params.append("#"); + params.append(std::string(ui_->comboBoxLS->currentText().split(" ")[0].toStdString())); + params.append("#"); + params.append(std::string(ui_->comboBoxDayNight->currentText().toStdString())); + params.append("#"); + params.append(std::to_string(ui_->horizontalSliderDay->value())); + params.append("#"); + params.append(std::to_string(ui_->horizontalSliderNight->value())); + params.append("#"); + params.append(std::to_string(ui_->horizontalSliderLux1->value())); + params.append("#"); + params.append(std::to_string(ui_->horizontalSliderBrightness1->value())); + params.append("#"); + params.append(std::to_string(ui_->horizontalSliderLux2->value())); + params.append("#"); + params.append(std::to_string(ui_->horizontalSliderBrightness2->value())); + params.append("#"); + params.append(std::to_string(ui_->horizontalSliderLux3->value())); + params.append("#"); + params.append(std::to_string(ui_->horizontalSliderBrightness3->value())); + params.append("#"); + params.append(std::to_string(ui_->horizontalSliderLux4->value())); + params.append("#"); + params.append(std::to_string(ui_->horizontalSliderBrightness4->value())); + params.append("#"); + params.append(std::to_string(ui_->horizontalSliderLux5->value())); + params.append("#"); + params.append(std::to_string(ui_->horizontalSliderBrightness5->value())); + params.append("#"); + params.append(std::string(ui_->comboBoxCheckInterval->currentText().toStdString())); + params.append("#"); + params.append(std::string(ui_->comboBoxNightmodeStep->currentText().toStdString())); + params.append("#"); + if (ui_->checkBoxDisableDayNightRTC->isChecked()) { + params.append("0"); + } else { + params.append("1"); + } + params.append("#"); + if (ui_->radioButtonAnimatedCSNG->isChecked()) { + params.append("0"); + } else if (ui_->radioButtonCSNG->isChecked()) { + params.append("1"); + } else if (ui_->radioButtonCustom->isChecked()) { + params.append("2"); + } + params.append("#"); + params.append( + std::string(ui_->comboBoxCountryCode->currentText().split("|")[0].replace(" ", "").toStdString())); + params.append("#"); + if (ui_->checkBoxBlankOnly->isChecked()) { + params.append("1"); + } else { + params.append("0"); + } + params.append("#"); + if (ui_->checkBoxFlipX->isChecked()) { + params.append("1"); + } else { + params.append("0"); + } + params.append("#"); + if (ui_->checkBoxFlipY->isChecked()) { + params.append("1"); + } else { + params.append("0"); + } + params.append("#"); + params.append(std::string(ui_->comboBoxRotation->currentText().toStdString())); + params.append("#"); + params.append(std::string(ui_->comboBoxResolution->currentText().toStdString())); + params.append("#"); + params.append(std::string((ui_->comboBoxFPS->currentText()).replace(" (not @1080)", "").toStdString())); + params.append("#"); + params.append(std::string(ui_->comboBoxAWB->currentText().toStdString())); + params.append("#"); + params.append(std::string(ui_->comboBoxEXP->currentText().toStdString())); + params.append("#"); + params.append(std::string(ui_->comboBoxLoopTime->currentText().toStdString())); + params.append("#"); + params.append(std::string(ui_->comboBoxLoopCount->currentText().toStdString())); + params.append("#"); + if (ui_->checkBoxAutoRecording->isChecked()) { + params.append("1"); + } else { + params.append("0"); + } + params.append("#"); + if (ui_->checkBoxFlipXUSB->isChecked()) { + params.append("1"); + } else { + params.append("0"); + } + params.append("#"); + if (ui_->checkBoxFlipYUSB->isChecked()) { + params.append("1"); + } else { + params.append("0"); + } + params.append("#"); + params.append(std::string(ui_->comboBoxUSBRotation->currentText().replace("180", "1").toStdString())); + params.append("#"); + system((std::string("/usr/local/bin/autoapp_helper setparams#") + std::string(params) + + std::string(" &")).c_str()); - this->close(); - } + this->close(); + } - void SettingsWindow::onResetToDefaults() { - QMessageBox confirmationMessage(QMessageBox::Question, "Confirmation", - "Are you sure you want to reset settings?", - QMessageBox::Yes | QMessageBox::Cancel); - //confirmationMessage.setWindowFlags(Qt::WindowStaysOnTopHint); - if (confirmationMessage.exec() == QMessageBox::Yes) { - configuration_->reset(); - this->load(); - } - } + void SettingsWindow::onResetToDefaults() { + QMessageBox confirmationMessage(QMessageBox::Question, "Confirmation", + "Are you sure you want to reset settings?", + QMessageBox::Yes | QMessageBox::Cancel); + //confirmationMessage.setWindowFlags(Qt::WindowStaysOnTopHint); + if (confirmationMessage.exec() == QMessageBox::Yes) { + configuration_->reset(); + this->load(); + } + } - void SettingsWindow::showEvent(QShowEvent *event) { - QWidget::showEvent(event); - this->load(); - } + void SettingsWindow::showEvent(QShowEvent *event) { + QWidget::showEvent(event); + this->load(); + } - void SettingsWindow::load() { - ui_->radioButtonLeftHandDrive->setChecked( - configuration_->getHandednessOfTrafficType() == configuration::HandednessOfTrafficType::LEFT_HAND_DRIVE); - ui_->radioButtonRightHandDrive->setChecked( - configuration_->getHandednessOfTrafficType() == configuration::HandednessOfTrafficType::RIGHT_HAND_DRIVE); - ui_->checkBoxShowClock->setChecked(configuration_->showClock()); - ui_->horizontalSliderAlphaTrans->setValue(static_cast(configuration_->getAlphaTrans())); + void SettingsWindow::load() { + ui_->radioButtonLeftHandDrive->setChecked( + configuration_->getHandednessOfTrafficType() == configuration::HandednessOfTrafficType::LEFT_HAND_DRIVE); + ui_->radioButtonRightHandDrive->setChecked( + configuration_->getHandednessOfTrafficType() == configuration::HandednessOfTrafficType::RIGHT_HAND_DRIVE); + ui_->checkBoxShowClock->setChecked(configuration_->showClock()); + ui_->horizontalSliderAlphaTrans->setValue(static_cast(configuration_->getAlphaTrans())); - ui_->checkBoxShowBigClock->setChecked(configuration_->showBigClock()); - ui_->checkBoxOldGUI->setChecked(configuration_->oldGUI()); - ui_->checkBoxHideMenuToggle->setChecked(configuration_->hideMenuToggle()); - ui_->checkBoxShowLux->setChecked(configuration_->showLux()); - ui_->checkBoxShowCursor->setChecked(configuration_->showCursor()); - ui_->checkBoxHideBrightnessControl->setChecked(configuration_->hideBrightnessControl()); - ui_->checkBoxNetworkinfo->setChecked(configuration_->showNetworkinfo()); - ui_->checkBoxAutoPlay->setChecked(configuration_->mp3AutoPlay()); - ui_->checkBoxShowPlayer->setChecked(configuration_->showAutoPlay()); - ui_->checkBoxInstantPlay->setChecked(configuration_->instantPlay()); - ui_->checkBoxDontShowAgain->setChecked(configuration_->hideWarning()); + ui_->checkBoxShowBigClock->setChecked(configuration_->showBigClock()); + ui_->checkBoxOldGUI->setChecked(configuration_->oldGUI()); + ui_->checkBoxHideMenuToggle->setChecked(configuration_->hideMenuToggle()); + ui_->checkBoxShowLux->setChecked(configuration_->showLux()); + ui_->checkBoxShowCursor->setChecked(configuration_->showCursor()); + ui_->checkBoxHideBrightnessControl->setChecked(configuration_->hideBrightnessControl()); + ui_->checkBoxNetworkinfo->setChecked(configuration_->showNetworkinfo()); + ui_->checkBoxAutoPlay->setChecked(configuration_->mp3AutoPlay()); + ui_->checkBoxShowPlayer->setChecked(configuration_->showAutoPlay()); + ui_->checkBoxInstantPlay->setChecked(configuration_->instantPlay()); + ui_->checkBoxDontShowAgain->setChecked(configuration_->hideWarning()); - ui_->radioButton30FPS->setChecked(configuration_->getVideoFPS() == - aap_protobuf::service::media::sink::message::VideoFrameRateType::VIDEO_FPS_30); - ui_->radioButton60FPS->setChecked(configuration_->getVideoFPS() == - aap_protobuf::service::media::sink::message::VideoFrameRateType::VIDEO_FPS_60); + ui_->radioButton30FPS->setChecked(configuration_->getVideoFPS() == + aap_protobuf::service::media::sink::message::VideoFrameRateType::VIDEO_FPS_30); + ui_->radioButton60FPS->setChecked(configuration_->getVideoFPS() == + aap_protobuf::service::media::sink::message::VideoFrameRateType::VIDEO_FPS_60); - ui_->radioButton480p->setChecked(configuration_->getVideoResolution() == - aap_protobuf::service::media::sink::message::VideoCodecResolutionType::VIDEO_800x480); - ui_->radioButton720p->setChecked(configuration_->getVideoResolution() == - aap_protobuf::service::media::sink::message::VideoCodecResolutionType::VIDEO_1280x720); - ui_->radioButton1080p->setChecked(configuration_->getVideoResolution() == - aap_protobuf::service::media::sink::message::VideoCodecResolutionType::VIDEO_1920x1080); - ui_->horizontalSliderScreenDPI->setValue(static_cast(configuration_->getScreenDPI())); - ui_->spinBoxOmxLayerIndex->setValue(configuration_->getOMXLayerIndex()); + ui_->radioButton480p->setChecked(configuration_->getVideoResolution() == + aap_protobuf::service::media::sink::message::VideoCodecResolutionType::VIDEO_800x480); + ui_->radioButton720p->setChecked(configuration_->getVideoResolution() == + aap_protobuf::service::media::sink::message::VideoCodecResolutionType::VIDEO_1280x720); + ui_->radioButton1080p->setChecked(configuration_->getVideoResolution() == + aap_protobuf::service::media::sink::message::VideoCodecResolutionType::VIDEO_1920x1080); + ui_->horizontalSliderScreenDPI->setValue(static_cast(configuration_->getScreenDPI())); + ui_->spinBoxOmxLayerIndex->setValue(configuration_->getOMXLayerIndex()); - const auto &videoMargins = configuration_->getVideoMargins(); - ui_->spinBoxVideoMarginWidth->setValue(videoMargins.width()); - ui_->spinBoxVideoMarginHeight->setValue(videoMargins.height()); + const auto &videoMargins = configuration_->getVideoMargins(); + ui_->spinBoxVideoMarginWidth->setValue(videoMargins.width()); + ui_->spinBoxVideoMarginHeight->setValue(videoMargins.height()); - ui_->checkBoxEnableTouchscreen->setChecked(configuration_->getTouchscreenEnabled()); - this->loadButtonCheckBoxes(); - ui_->checkBoxPlayerControl->setChecked(configuration_->playerButtonControl()); + ui_->checkBoxEnableTouchscreen->setChecked(configuration_->getTouchscreenEnabled()); + this->loadButtonCheckBoxes(); + ui_->checkBoxPlayerControl->setChecked(configuration_->playerButtonControl()); ui_->radioButtonDisableBluetooth->setChecked( configuration_->getBluetoothAdapterType() == configuration::BluetoothAdapterType::NONE); @@ -550,541 +556,543 @@ namespace f1x { ui_->checkBoxSpeechAudioChannel->setChecked(configuration_->guidanceAudioChannelEnabled()); ui_->telephonyAudioChannelEnabled->setChecked(configuration_->guidanceAudioChannelEnabled()); - const auto &audioOutputBackendType = configuration_->getAudioOutputBackendType(); - ui_->radioButtonRtAudio->setChecked(audioOutputBackendType == configuration::AudioOutputBackendType::RTAUDIO); - ui_->radioButtonQtAudio->setChecked(audioOutputBackendType == configuration::AudioOutputBackendType::QT); + const auto &audioOutputBackendType = configuration_->getAudioOutputBackendType(); + ui_->radioButtonRtAudio->setChecked(audioOutputBackendType == configuration::AudioOutputBackendType::RTAUDIO); + ui_->radioButtonQtAudio->setChecked(audioOutputBackendType == configuration::AudioOutputBackendType::QT); - ui_->checkBoxHardwareSave->setChecked(false); - QStorageInfo storage("/media/USBDRIVES/CSSTORAGE"); - storage.refresh(); - if (storage.isValid() && storage.isReady()) { - if (storage.isReadOnly()) { - ui_->labelStorage->setText("Storage is read only! (" + storage.device() + - ") - This can be caused by demaged filesystem on CSSTORAGE. Try a reboot."); - } else { - ui_->labelStorage->setText( - "Device: " + storage.device() + " Label: " + storage.displayName() + " Total: " + - QString::number(storage.bytesTotal() / 1024 / 1024 / 1024) + "GB Free: " + - QString::number(storage.bytesFree() / 1024 / 1024 / 1024) + "GB (" + storage.fileSystemType() + ")"); - } - } else { - ui_->labelStorage->setText("Storage is not ready or missing!"); - } - } + ui_->checkBoxHardwareSave->setChecked(false); + QStorageInfo storage("/media/USBDRIVES/CSSTORAGE"); + storage.refresh(); + if (storage.isValid() && storage.isReady()) { + if (storage.isReadOnly()) { + ui_->labelStorage->setText("Storage is read only! (" + storage.device() + + ") - This can be caused by demaged filesystem on CSSTORAGE. Try a reboot."); + } else { + ui_->labelStorage->setText( + "Device: " + storage.device() + " Label: " + storage.displayName() + " Total: " + + QString::number(storage.bytesTotal() / 1024 / 1024 / 1024) + "GB Free: " + + QString::number(storage.bytesFree() / 1024 / 1024 / 1024) + "GB (" + storage.fileSystemType() + ")"); + } + } else { + ui_->labelStorage->setText("Storage is not ready or missing!"); + } + } - void SettingsWindow::loadButtonCheckBoxes() { - const auto &buttonCodes = configuration_->getButtonCodes(); - ui_->checkBoxPlayButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), - aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PLAY) != + void SettingsWindow::loadButtonCheckBoxes() { + const auto &buttonCodes = configuration_->getButtonCodes(); + ui_->checkBoxPlayButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PLAY) != + buttonCodes.end()); + ui_->checkBoxPauseButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PAUSE) != + buttonCodes.end()); + ui_->checkBoxTogglePlayButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PLAY_PAUSE) != buttonCodes.end()); - ui_->checkBoxPauseButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), - aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PAUSE) != - buttonCodes.end()); - ui_->checkBoxTogglePlayButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), - aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PLAY_PAUSE) != - buttonCodes.end()); - ui_->checkBoxNextTrackButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), - aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_NEXT) != - buttonCodes.end()); - ui_->checkBoxPreviousTrackButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), - aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PREVIOUS) != - buttonCodes.end()); - ui_->checkBoxHomeButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), - aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_HOME) != - buttonCodes.end()); - ui_->checkBoxPhoneButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), - aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_CALL) != - buttonCodes.end()); - ui_->checkBoxCallEndButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), - aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_ENDCALL) != - buttonCodes.end()); - ui_->checkBoxVoiceCommandButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), - aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_SEARCH) != - buttonCodes.end()); - ui_->checkBoxLeftButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), - aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_LEFT) != - buttonCodes.end()); - ui_->checkBoxRightButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), - aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_RIGHT) != - buttonCodes.end()); - ui_->checkBoxUpButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), - aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_UP) != - buttonCodes.end()); - ui_->checkBoxDownButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), - aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_DOWN) != - buttonCodes.end()); - ui_->checkBoxScrollWheelButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), - aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_ROTARY_CONTROLLER) != - buttonCodes.end()); - ui_->checkBoxBackButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), - aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_BACK) != - buttonCodes.end()); - ui_->checkBoxEnterButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), - aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_CENTER) != - buttonCodes.end()); - ui_->checkBoxNavButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), - aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_NAVIGATION) != + ui_->checkBoxNextTrackButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_NEXT) != buttonCodes.end()); + ui_->checkBoxPreviousTrackButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PREVIOUS) != + buttonCodes.end()); + ui_->checkBoxHomeButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_HOME) != + buttonCodes.end()); + ui_->checkBoxPhoneButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_CALL) != + buttonCodes.end()); + ui_->checkBoxCallEndButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_ENDCALL) != + buttonCodes.end()); + ui_->checkBoxVoiceCommandButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_SEARCH) != + buttonCodes.end()); + ui_->checkBoxLeftButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_LEFT) != + buttonCodes.end()); + ui_->checkBoxRightButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_RIGHT) != + buttonCodes.end()); + ui_->checkBoxUpButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_UP) != + buttonCodes.end()); + ui_->checkBoxDownButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_DOWN) != + buttonCodes.end()); + ui_->checkBoxScrollWheelButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_ROTARY_CONTROLLER) != + buttonCodes.end()); + ui_->checkBoxBackButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_BACK) != + buttonCodes.end()); + ui_->checkBoxEnterButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_CENTER) != + buttonCodes.end()); + ui_->checkBoxNavButton->setChecked(std::find(buttonCodes.begin(), buttonCodes.end(), + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_NAVIGATION) != + buttonCodes.end()); + } + + void SettingsWindow::setButtonCheckBoxes(bool value) { + ui_->checkBoxPlayButton->setChecked(value); + ui_->checkBoxPauseButton->setChecked(value); + ui_->checkBoxTogglePlayButton->setChecked(value); + ui_->checkBoxNextTrackButton->setChecked(value); + ui_->checkBoxPreviousTrackButton->setChecked(value); + ui_->checkBoxHomeButton->setChecked(value); + ui_->checkBoxPhoneButton->setChecked(value); + ui_->checkBoxCallEndButton->setChecked(value); + ui_->checkBoxVoiceCommandButton->setChecked(value); + ui_->checkBoxLeftButton->setChecked(value); + ui_->checkBoxRightButton->setChecked(value); + ui_->checkBoxUpButton->setChecked(value); + ui_->checkBoxDownButton->setChecked(value); + ui_->checkBoxScrollWheelButton->setChecked(value); + ui_->checkBoxBackButton->setChecked(value); + ui_->checkBoxEnterButton->setChecked(value); + ui_->checkBoxNavButton->setChecked(value); + } + + void SettingsWindow::saveButtonCheckBoxes() { + configuration::IConfiguration::ButtonCodes buttonCodes; + this->saveButtonCheckBox(ui_->checkBoxPlayButton, buttonCodes, + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PLAY); + this->saveButtonCheckBox(ui_->checkBoxPauseButton, buttonCodes, + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PAUSE); + this->saveButtonCheckBox(ui_->checkBoxTogglePlayButton, buttonCodes, + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PLAY_PAUSE); + this->saveButtonCheckBox(ui_->checkBoxNextTrackButton, buttonCodes, + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_NEXT); + this->saveButtonCheckBox(ui_->checkBoxPreviousTrackButton, buttonCodes, + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PREVIOUS); + this->saveButtonCheckBox(ui_->checkBoxHomeButton, buttonCodes, + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_HOME); + this->saveButtonCheckBox(ui_->checkBoxPhoneButton, buttonCodes, + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_CALL); + this->saveButtonCheckBox(ui_->checkBoxCallEndButton, buttonCodes, + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_ENDCALL); + this->saveButtonCheckBox(ui_->checkBoxVoiceCommandButton, buttonCodes, + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_SEARCH); + this->saveButtonCheckBox(ui_->checkBoxLeftButton, buttonCodes, + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_LEFT); + this->saveButtonCheckBox(ui_->checkBoxRightButton, buttonCodes, + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_RIGHT); + this->saveButtonCheckBox(ui_->checkBoxUpButton, buttonCodes, + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_UP); + this->saveButtonCheckBox(ui_->checkBoxDownButton, buttonCodes, + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_DOWN); + this->saveButtonCheckBox(ui_->checkBoxScrollWheelButton, buttonCodes, + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_ROTARY_CONTROLLER); + this->saveButtonCheckBox(ui_->checkBoxBackButton, buttonCodes, + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_BACK); + this->saveButtonCheckBox(ui_->checkBoxEnterButton, buttonCodes, + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_CENTER); + this->saveButtonCheckBox(ui_->checkBoxNavButton, buttonCodes, + aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_NAVIGATION); + configuration_->setButtonCodes(buttonCodes); + } + + void SettingsWindow::saveButtonCheckBox(const QCheckBox *checkBox, + configuration::IConfiguration::ButtonCodes &buttonCodes, + aap_protobuf::service::media::sink::message::KeyCode buttonCode) { + if (checkBox->isChecked()) { + buttonCodes.push_back(buttonCode); + } + } + + void SettingsWindow::onUpdateScreenDPI(int value) { + ui_->labelScreenDPIValue->setText(QString::number(value)); + } + + void SettingsWindow::onUpdateAlphaTrans(int value) { + double alpha = value / 100.0; + ui_->labelAlphaTransValue->setText(QString::number(alpha)); + } + + void SettingsWindow::onUpdateBrightnessDay(int value) { + ui_->labelBrightnessDay->setText(QString::number(value)); + } + + void SettingsWindow::onUpdateBrightnessNight(int value) { + ui_->labelBrightnessNight->setText(QString::number(value)); + } + + void SettingsWindow::onUpdateSystemVolume(int value) { + ui_->labelSystemVolumeValue->setText(QString::number(value)); + } + + void SettingsWindow::onUpdateSystemCapture(int value) { + ui_->labelSystemCaptureValue->setText(QString::number(value)); + } + + void SettingsWindow::onUpdateLux1(int value) { + ui_->valueLux1->setText(QString::number(value)); + } + + void SettingsWindow::onUpdateLux2(int value) { + ui_->valueLux2->setText(QString::number(value)); + } + + void SettingsWindow::onUpdateLux3(int value) { + ui_->valueLux3->setText(QString::number(value)); + } + + void SettingsWindow::onUpdateLux4(int value) { + ui_->valueLux4->setText(QString::number(value)); + } + + void SettingsWindow::onUpdateLux5(int value) { + ui_->valueLux5->setText(QString::number(value)); + } + + void SettingsWindow::onUpdateBrightness1(int value) { + ui_->valueBrightness1->setText(QString::number(value)); + } + + void SettingsWindow::onUpdateBrightness2(int value) { + ui_->valueBrightness2->setText(QString::number(value)); + } + + void SettingsWindow::onUpdateBrightness3(int value) { + ui_->valueBrightness3->setText(QString::number(value)); + } + + void SettingsWindow::onUpdateBrightness4(int value) { + ui_->valueBrightness4->setText(QString::number(value)); + } + + void SettingsWindow::onUpdateBrightness5(int value) { + ui_->valueBrightness5->setText(QString::number(value)); + } + + void SettingsWindow::unpairAll() { + system("/usr/local/bin/crankshaft bluetooth unpair &"); + } + + void SettingsWindow::setTime() { + // generate param string for autoapp_helper + std::string params; + params.append(std::to_string(ui_->spinBoxHour->value())); + params.append("#"); + params.append(std::to_string(ui_->spinBoxMinute->value())); + params.append("#"); + system((std::string("/usr/local/bin/autoapp_helper settime#") + std::string(params) + + std::string(" &")).c_str()); + } + + void SettingsWindow::syncNTPTime() { + system("/usr/local/bin/crankshaft rtc sync &"); + } + + void SettingsWindow::loadSystemValues() { + // set brightness slider attribs + ui_->horizontalSliderDay->setMinimum(configuration_->getCSValue("BR_MIN").toInt()); + ui_->horizontalSliderDay->setMaximum(configuration_->getCSValue("BR_MAX").toInt()); + ui_->horizontalSliderDay->setSingleStep(configuration_->getCSValue("BR_STEP").toInt()); + ui_->horizontalSliderDay->setTickInterval(configuration_->getCSValue("BR_STEP").toInt()); + ui_->horizontalSliderDay->setValue(configuration_->getCSValue("BR_DAY").toInt()); + + ui_->horizontalSliderNight->setMinimum(configuration_->getCSValue("BR_MIN").toInt()); + ui_->horizontalSliderNight->setMaximum(configuration_->getCSValue("BR_MAX").toInt()); + ui_->horizontalSliderNight->setSingleStep(configuration_->getCSValue("BR_STEP").toInt()); + ui_->horizontalSliderNight->setTickInterval(configuration_->getCSValue("BR_STEP").toInt()); + ui_->horizontalSliderNight->setValue(configuration_->getCSValue("BR_NIGHT").toInt()); + + ui_->horizontalSliderBrightness1->setMinimum(configuration_->getCSValue("BR_MIN").toInt()); + ui_->horizontalSliderBrightness1->setMaximum(configuration_->getCSValue("BR_MAX").toInt()); + ui_->horizontalSliderBrightness1->setSingleStep(configuration_->getCSValue("BR_STEP").toInt()); + ui_->horizontalSliderBrightness1->setTickInterval(configuration_->getCSValue("BR_STEP").toInt()); + + ui_->horizontalSliderBrightness2->setMinimum(configuration_->getCSValue("BR_MIN").toInt()); + ui_->horizontalSliderBrightness2->setMaximum(configuration_->getCSValue("BR_MAX").toInt()); + ui_->horizontalSliderBrightness2->setSingleStep(configuration_->getCSValue("BR_STEP").toInt()); + ui_->horizontalSliderBrightness2->setTickInterval(configuration_->getCSValue("BR_STEP").toInt()); + + ui_->horizontalSliderBrightness3->setMinimum(configuration_->getCSValue("BR_MIN").toInt()); + ui_->horizontalSliderBrightness3->setMaximum(configuration_->getCSValue("BR_MAX").toInt()); + ui_->horizontalSliderBrightness3->setSingleStep(configuration_->getCSValue("BR_STEP").toInt()); + ui_->horizontalSliderBrightness3->setTickInterval(configuration_->getCSValue("BR_STEP").toInt()); + + ui_->horizontalSliderBrightness4->setMinimum(configuration_->getCSValue("BR_MIN").toInt()); + ui_->horizontalSliderBrightness4->setMaximum(configuration_->getCSValue("BR_MAX").toInt()); + ui_->horizontalSliderBrightness4->setSingleStep(configuration_->getCSValue("BR_STEP").toInt()); + ui_->horizontalSliderBrightness4->setTickInterval(configuration_->getCSValue("BR_STEP").toInt()); + + ui_->horizontalSliderBrightness5->setMinimum(configuration_->getCSValue("BR_MIN").toInt()); + ui_->horizontalSliderBrightness5->setMaximum(configuration_->getCSValue("BR_MAX").toInt()); + ui_->horizontalSliderBrightness5->setSingleStep(configuration_->getCSValue("BR_STEP").toInt()); + ui_->horizontalSliderBrightness5->setTickInterval(configuration_->getCSValue("BR_STEP").toInt()); + + // set tsl2561 slider attribs + ui_->horizontalSliderLux1->setValue(configuration_->getCSValue("LUX_LEVEL_1").toInt()); + ui_->horizontalSliderBrightness1->setValue(configuration_->getCSValue("DISP_BRIGHTNESS_1").toInt()); + ui_->horizontalSliderLux2->setValue(configuration_->getCSValue("LUX_LEVEL_2").toInt()); + ui_->horizontalSliderBrightness2->setValue(configuration_->getCSValue("DISP_BRIGHTNESS_2").toInt()); + ui_->horizontalSliderLux3->setValue(configuration_->getCSValue("LUX_LEVEL_3").toInt()); + ui_->horizontalSliderBrightness3->setValue(configuration_->getCSValue("DISP_BRIGHTNESS_3").toInt()); + ui_->horizontalSliderLux4->setValue(configuration_->getCSValue("LUX_LEVEL_4").toInt()); + ui_->horizontalSliderBrightness4->setValue(configuration_->getCSValue("DISP_BRIGHTNESS_4").toInt()); + ui_->horizontalSliderLux5->setValue(configuration_->getCSValue("LUX_LEVEL_5").toInt()); + ui_->horizontalSliderBrightness5->setValue(configuration_->getCSValue("DISP_BRIGHTNESS_5").toInt()); + ui_->comboBoxCheckInterval->setCurrentText(configuration_->getCSValue("TSL2561_CHECK_INTERVAL")); + ui_->comboBoxNightmodeStep->setCurrentText(configuration_->getCSValue("TSL2561_DAYNIGHT_ON_STEP")); + + if (std::ifstream("/tmp/return_value")) { + QString return_values = configuration_->readFileContent("/tmp/return_value"); + QStringList getparams = return_values.split("#"); + + // version string + ui_->valueSystemVersion->setText(configuration_->readFileContent("/etc/crankshaft.build")); + // date string + ui_->valueSystemBuildDate->setText(configuration_->readFileContent("/etc/crankshaft.date")); + // set volume + ui_->labelSystemVolumeValue->setText(configuration_->readFileContent("/boot/crankshaft/volume")); + ui_->horizontalSliderSystemVolume->setValue( + configuration_->readFileContent("/boot/crankshaft/volume").toInt()); + // set cap volume + ui_->labelSystemCaptureValue->setText(configuration_->readFileContent("/boot/crankshaft/capvolume")); + ui_->horizontalSliderSystemCapture->setValue( + configuration_->readFileContent("/boot/crankshaft/capvolume").toInt()); + // set shutdown + ui_->valueShutdownTimer->setText("- - -"); + ui_->spinBoxShutdown->setValue(configuration_->getCSValue("DISCONNECTION_POWEROFF_MINS").toInt()); + // set disconnect + ui_->valueDisconnectTimer->setText("- - -"); + ui_->spinBoxDisconnect->setValue(configuration_->getCSValue("DISCONNECTION_SCREEN_POWEROFF_SECS").toInt()); + // set day/night + ui_->spinBoxDay->setValue(configuration_->getCSValue("RTC_DAY_START").toInt()); + ui_->spinBoxNight->setValue(configuration_->getCSValue("RTC_NIGHT_START").toInt()); + // set gpios + if (configuration_->getCSValue("ENABLE_GPIO") == "1") { + ui_->checkBoxGPIO->setChecked(true); + } else { + ui_->checkBoxGPIO->setChecked(false); + } + ui_->comboBoxDevMode->setCurrentText(configuration_->getCSValue("DEV_PIN")); + ui_->comboBoxInvert->setCurrentText(configuration_->getCSValue("INVERT_PIN")); + ui_->comboBoxX11->setCurrentText(configuration_->getCSValue("X11_PIN")); + ui_->comboBoxRearcam->setCurrentText(configuration_->getCSValue("REARCAM_PIN")); + ui_->comboBoxAndroid->setCurrentText(configuration_->getCSValue("ANDROID_PIN")); + // set mode + if (configuration_->getCSValue("START_X11") == "0") { + ui_->radioButtonEGL->setChecked(true); + } else { + ui_->radioButtonX11->setChecked(true); + } + // set rotation + if (configuration_->getCSValue("FLIP_SCREEN") == "0") { + ui_->radioButtonScreenNormal->setChecked(true); + } else { + ui_->radioButtonScreenRotated->setChecked(true); + } + + populateBluetoothComboBox(ui_->comboBoxBluetooth); + + if (std::ifstream("/tmp/get_inputs")) { + QFile inputsFile(QString("/tmp/get_inputs")); + inputsFile.open(QIODevice::ReadOnly); + QTextStream data_return(&inputsFile); + QStringList inputs = data_return.readAll().split("\n"); + inputsFile.close(); + int cleaner = ui_->comboBoxPulseInput->count(); + while (cleaner > -1) { + ui_->comboBoxPulseInput->removeItem(cleaner); + cleaner--; } - - void SettingsWindow::setButtonCheckBoxes(bool value) { - ui_->checkBoxPlayButton->setChecked(value); - ui_->checkBoxPauseButton->setChecked(value); - ui_->checkBoxTogglePlayButton->setChecked(value); - ui_->checkBoxNextTrackButton->setChecked(value); - ui_->checkBoxPreviousTrackButton->setChecked(value); - ui_->checkBoxHomeButton->setChecked(value); - ui_->checkBoxPhoneButton->setChecked(value); - ui_->checkBoxCallEndButton->setChecked(value); - ui_->checkBoxVoiceCommandButton->setChecked(value); - ui_->checkBoxLeftButton->setChecked(value); - ui_->checkBoxRightButton->setChecked(value); - ui_->checkBoxUpButton->setChecked(value); - ui_->checkBoxDownButton->setChecked(value); - ui_->checkBoxScrollWheelButton->setChecked(value); - ui_->checkBoxBackButton->setChecked(value); - ui_->checkBoxEnterButton->setChecked(value); - ui_->checkBoxNavButton->setChecked(value); + int indexin = inputs.count(); + int countin = 0; + while (countin < indexin - 1) { + ui_->comboBoxPulseInput->addItem(inputs[countin]); + countin++; } + } - void SettingsWindow::saveButtonCheckBoxes() { - configuration::IConfiguration::ButtonCodes buttonCodes; - this->saveButtonCheckBox(ui_->checkBoxPlayButton, buttonCodes, - aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PLAY); - this->saveButtonCheckBox(ui_->checkBoxPauseButton, buttonCodes, - aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PAUSE); - this->saveButtonCheckBox(ui_->checkBoxTogglePlayButton, buttonCodes, - aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PLAY_PAUSE); - this->saveButtonCheckBox(ui_->checkBoxNextTrackButton, buttonCodes, - aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_NEXT); - this->saveButtonCheckBox(ui_->checkBoxPreviousTrackButton, buttonCodes, - aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PREVIOUS); - this->saveButtonCheckBox(ui_->checkBoxHomeButton, buttonCodes, - aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_HOME); - this->saveButtonCheckBox(ui_->checkBoxPhoneButton, buttonCodes, - aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_CALL); - this->saveButtonCheckBox(ui_->checkBoxCallEndButton, buttonCodes, - aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_ENDCALL); - this->saveButtonCheckBox(ui_->checkBoxVoiceCommandButton, buttonCodes, - aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_SEARCH); - this->saveButtonCheckBox(ui_->checkBoxLeftButton, buttonCodes, - aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_LEFT); - this->saveButtonCheckBox(ui_->checkBoxRightButton, buttonCodes, - aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_RIGHT); - this->saveButtonCheckBox(ui_->checkBoxUpButton, buttonCodes, - aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_UP); - this->saveButtonCheckBox(ui_->checkBoxDownButton, buttonCodes, - aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_DOWN); - this->saveButtonCheckBox(ui_->checkBoxScrollWheelButton, buttonCodes, - aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_ROTARY_CONTROLLER); - this->saveButtonCheckBox(ui_->checkBoxBackButton, buttonCodes, - aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_BACK); - this->saveButtonCheckBox(ui_->checkBoxEnterButton, buttonCodes, - aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_CENTER); - this->saveButtonCheckBox(ui_->checkBoxNavButton, buttonCodes, - aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_NAVIGATION); - configuration_->setButtonCodes(buttonCodes); + if (std::ifstream("/tmp/get_outputs")) { + QFile outputsFile(QString("/tmp/get_outputs")); + outputsFile.open(QIODevice::ReadOnly); + QTextStream data_return(&outputsFile); + QStringList outputs = data_return.readAll().split("\n"); + outputsFile.close(); + int cleaner = ui_->comboBoxPulseOutput->count(); + while (cleaner > -1) { + ui_->comboBoxPulseOutput->removeItem(cleaner); + cleaner--; } - - void SettingsWindow::saveButtonCheckBox(const QCheckBox *checkBox, - configuration::IConfiguration::ButtonCodes &buttonCodes, - aap_protobuf::service::media::sink::message::KeyCode buttonCode) { - if (checkBox->isChecked()) { - buttonCodes.push_back(buttonCode); - } + int indexout = outputs.count(); + int countout = 0; + while (countout < indexout - 1) { + ui_->comboBoxPulseOutput->addItem(outputs[countout]); + countout++; } + } - void SettingsWindow::onUpdateScreenDPI(int value) { - ui_->labelScreenDPIValue->setText(QString::number(value)); + ui_->comboBoxPulseOutput->setCurrentText(configuration_->readFileContent("/tmp/get_default_output")); + ui_->comboBoxPulseInput->setCurrentText(configuration_->readFileContent("/tmp/get_default_input")); + + if (std::ifstream("/tmp/timezone_listing")) { + QFile zoneFile(QString("/tmp/timezone_listing")); + zoneFile.open(QIODevice::ReadOnly); + QTextStream data_return(&zoneFile); + QStringList zones = data_return.readAll().split("\n"); + zoneFile.close(); + int cleaner = ui_->comboBoxTZ->count(); + while (cleaner > 0) { + ui_->comboBoxTZ->removeItem(cleaner); + cleaner--; } - - void SettingsWindow::onUpdateAlphaTrans(int value) { - double alpha = value / 100.0; - ui_->labelAlphaTransValue->setText(QString::number(alpha)); + int indexout = zones.count(); + int countzone = 0; + while (countzone < indexout - 1) { + ui_->comboBoxTZ->addItem(zones[countzone]); + countzone++; } + } - void SettingsWindow::onUpdateBrightnessDay(int value) { - ui_->labelBrightnessDay->setText(QString::number(value)); - } + // set rtc + QString rtcstring = configuration_->getParamFromFile("/boot/config.txt", "dtoverlay=i2c-rtc"); + if (rtcstring != "") { + QStringList rtc = rtcstring.split(","); + ui_->comboBoxHardwareRTC->setCurrentText(rtc[1].trimmed()); + // set timezone + ui_->comboBoxTZ->setCurrentText(configuration_->readFileContent("/etc/timezone")); + } else { + ui_->comboBoxHardwareRTC->setCurrentText("none"); + ui_->comboBoxTZ->setCurrentText(configuration_->readFileContent("/etc/timezone")); + } - void SettingsWindow::onUpdateBrightnessNight(int value) { - ui_->labelBrightnessNight->setText(QString::number(value)); - } + // set dac + QString dac = "Custom"; + if (getparams[4] == "allo-boss-dac-pcm512x-audio") { + dac = "Allo - Boss"; + } + if (getparams[4] == "allo-piano-dac-pcm512x-audio") { + dac = "Allo - Piano"; + } + if (getparams[4] == "iqaudio-dacplus") { + dac = "IQaudIO - Pi-DAC Plus/Pro/Zero"; + } + if (getparams[4] == "iqaudio-dacplus,unmute_amp") { + dac = "IQaudIO - Pi-Digi Amp Plus"; + } + if (getparams[4] == "iqaudio-dacplus,auto_mute_amp") { + dac = "IQaudIO - Pi-Digi Amp Plus - Automute"; + } + if (getparams[4] == "iqaudio-digi-wm8804-audio") { + dac = "IQaudIO - Pi-Digi Plus"; + } + if (getparams[4] == "audioinjector-wm8731-audio") { + dac = "Audioinjector - Zero/Stereo"; + } + if (getparams[4] == "hifiberry-dac") { + dac = "Hifiberry - DAC"; + } + if (getparams[4] == "hifiberry-dacplus") { + dac = "Hifiberry - DAC Plus"; + } + if (getparams[4] == "hifiberry-digi") { + dac = "Hifiberry - Digi"; + } + if (getparams[4] == "hifiberry-digi-pro") { + dac = "Hifiberry - Digi Pro"; + } + if (getparams[4] == "hifiberry-amp") { + dac = "Hifiberry - DAC Amp"; + } + if (getparams[4] == "audio") { + dac = "Raspberry Pi - Onboard"; + } + ui_->comboBoxHardwareDAC->setCurrentText(dac); - void SettingsWindow::onUpdateSystemVolume(int value) { - ui_->labelSystemVolumeValue->setText(QString::number(value)); - } + // set shutdown disable + if (configuration_->getCSValue("DISCONNECTION_POWEROFF_DISABLE") == "1") { + ui_->checkBoxDisableShutdown->setChecked(true); + } else { + ui_->checkBoxDisableShutdown->setChecked(false); + } - void SettingsWindow::onUpdateSystemCapture(int value) { - ui_->labelSystemCaptureValue->setText(QString::number(value)); - } + // set screen off disable + if (configuration_->getCSValue("DISCONNECTION_SCREEN_POWEROFF_DISABLE") == "1") { + ui_->checkBoxDisableScreenOff->setChecked(true); + } else { + ui_->checkBoxDisableScreenOff->setChecked(false); + } - void SettingsWindow::onUpdateLux1(int value) { - ui_->valueLux1->setText(QString::number(value)); - } + // set custom brightness command + if (configuration_->getCSValue("CUSTOM_BRIGHTNESS_COMMAND") != "") { + ui_->labelCustomBrightnessCommand->setText( + configuration_->getCSValue("CUSTOM_BRIGHTNESS_COMMAND") + " brvalue"); + } else { + ui_->labelCustomBrightnessCommand->setText("Disabled"); + } - void SettingsWindow::onUpdateLux2(int value) { - ui_->valueLux2->setText(QString::number(value)); - } + // set debug mode + if (configuration_->getCSValue("DEBUG_MODE") == "1") { + ui_->radioButtonDebugmodeEnabled->setChecked(true); + } else { + ui_->radioButtonDebugmodeDisabled->setChecked(true); + } - void SettingsWindow::onUpdateLux3(int value) { - ui_->valueLux3->setText(QString::number(value)); - } + // GPIO based shutdown + ui_->comboBoxGPIOShutdown->setCurrentText(configuration_->getCSValue("IGNITION_PIN")); + ui_->spinBoxGPIOShutdownDelay->setValue(configuration_->getCSValue("IGNITION_DELAY").toInt()); - void SettingsWindow::onUpdateLux4(int value) { - ui_->valueLux4->setText(QString::number(value)); - } + // Wifi Hotspot + if (configuration_->getCSValue("ENABLE_HOTSPOT") == "1") { + ui_->checkBoxHotspot->setChecked(true); + } else { + ui_->checkBoxHotspot->setChecked(false); + } - void SettingsWindow::onUpdateLux5(int value) { - ui_->valueLux5->setText(QString::number(value)); - } + // set cam + if (configuration_->getParamFromFile("/boot/config.txt", "start_x") == "1") { + ui_->comboBoxCam->setCurrentText("enabled"); + } else { + ui_->comboBoxCam->setCurrentText("disabled"); + } + if (configuration_->getCSValue("RPICAM_HFLIP") == "1") { + ui_->checkBoxFlipX->setChecked(true); + } else { + ui_->checkBoxFlipX->setChecked(false); + } + if (configuration_->getCSValue("RPICAM_VFLIP") == "1") { + ui_->checkBoxFlipY->setChecked(true); + } else { + ui_->checkBoxFlipY->setChecked(false); + } + ui_->comboBoxRotation->setCurrentText(configuration_->getCSValue("RPICAM_ROTATION")); + ui_->comboBoxResolution->setCurrentText(configuration_->getCSValue("RPICAM_RESOLUTION")); + ui_->comboBoxFPS->setCurrentText(configuration_->getCSValue("RPICAM_FPS")); + ui_->comboBoxAWB->setCurrentText(configuration_->getCSValue("RPICAM_AWB")); + ui_->comboBoxEXP->setCurrentText(configuration_->getCSValue("RPICAM_EXP")); + ui_->comboBoxLoopTime->setCurrentText(configuration_->getCSValue("RPICAM_LOOPTIME")); + ui_->comboBoxLoopCount->setCurrentText(configuration_->getCSValue("RPICAM_LOOPCOUNT")); - void SettingsWindow::onUpdateBrightness1(int value) { - ui_->valueBrightness1->setText(QString::number(value)); - } + if (configuration_->getCSValue("RPICAM_AUTORECORDING") == "1") { + ui_->checkBoxAutoRecording->setChecked(true); + } else { + ui_->checkBoxAutoRecording->setChecked(false); + } - void SettingsWindow::onUpdateBrightness2(int value) { - ui_->valueBrightness2->setText(QString::number(value)); - } - - void SettingsWindow::onUpdateBrightness3(int value) { - ui_->valueBrightness3->setText(QString::number(value)); - } - - void SettingsWindow::onUpdateBrightness4(int value) { - ui_->valueBrightness4->setText(QString::number(value)); - } - - void SettingsWindow::onUpdateBrightness5(int value) { - ui_->valueBrightness5->setText(QString::number(value)); - } - - void SettingsWindow::unpairAll() { - system("/usr/local/bin/crankshaft bluetooth unpair &"); - } - - void SettingsWindow::setTime() { - // generate param string for autoapp_helper - std::string params; - params.append(std::to_string(ui_->spinBoxHour->value())); - params.append("#"); - params.append(std::to_string(ui_->spinBoxMinute->value())); - params.append("#"); - system((std::string("/usr/local/bin/autoapp_helper settime#") + std::string(params) + - std::string(" &")).c_str()); - } - - void SettingsWindow::syncNTPTime() { - system("/usr/local/bin/crankshaft rtc sync &"); - } - - void SettingsWindow::loadSystemValues() { - // set brightness slider attribs - ui_->horizontalSliderDay->setMinimum(configuration_->getCSValue("BR_MIN").toInt()); - ui_->horizontalSliderDay->setMaximum(configuration_->getCSValue("BR_MAX").toInt()); - ui_->horizontalSliderDay->setSingleStep(configuration_->getCSValue("BR_STEP").toInt()); - ui_->horizontalSliderDay->setTickInterval(configuration_->getCSValue("BR_STEP").toInt()); - ui_->horizontalSliderDay->setValue(configuration_->getCSValue("BR_DAY").toInt()); - - ui_->horizontalSliderNight->setMinimum(configuration_->getCSValue("BR_MIN").toInt()); - ui_->horizontalSliderNight->setMaximum(configuration_->getCSValue("BR_MAX").toInt()); - ui_->horizontalSliderNight->setSingleStep(configuration_->getCSValue("BR_STEP").toInt()); - ui_->horizontalSliderNight->setTickInterval(configuration_->getCSValue("BR_STEP").toInt()); - ui_->horizontalSliderNight->setValue(configuration_->getCSValue("BR_NIGHT").toInt()); - - ui_->horizontalSliderBrightness1->setMinimum(configuration_->getCSValue("BR_MIN").toInt()); - ui_->horizontalSliderBrightness1->setMaximum(configuration_->getCSValue("BR_MAX").toInt()); - ui_->horizontalSliderBrightness1->setSingleStep(configuration_->getCSValue("BR_STEP").toInt()); - ui_->horizontalSliderBrightness1->setTickInterval(configuration_->getCSValue("BR_STEP").toInt()); - - ui_->horizontalSliderBrightness2->setMinimum(configuration_->getCSValue("BR_MIN").toInt()); - ui_->horizontalSliderBrightness2->setMaximum(configuration_->getCSValue("BR_MAX").toInt()); - ui_->horizontalSliderBrightness2->setSingleStep(configuration_->getCSValue("BR_STEP").toInt()); - ui_->horizontalSliderBrightness2->setTickInterval(configuration_->getCSValue("BR_STEP").toInt()); - - ui_->horizontalSliderBrightness3->setMinimum(configuration_->getCSValue("BR_MIN").toInt()); - ui_->horizontalSliderBrightness3->setMaximum(configuration_->getCSValue("BR_MAX").toInt()); - ui_->horizontalSliderBrightness3->setSingleStep(configuration_->getCSValue("BR_STEP").toInt()); - ui_->horizontalSliderBrightness3->setTickInterval(configuration_->getCSValue("BR_STEP").toInt()); - - ui_->horizontalSliderBrightness4->setMinimum(configuration_->getCSValue("BR_MIN").toInt()); - ui_->horizontalSliderBrightness4->setMaximum(configuration_->getCSValue("BR_MAX").toInt()); - ui_->horizontalSliderBrightness4->setSingleStep(configuration_->getCSValue("BR_STEP").toInt()); - ui_->horizontalSliderBrightness4->setTickInterval(configuration_->getCSValue("BR_STEP").toInt()); - - ui_->horizontalSliderBrightness5->setMinimum(configuration_->getCSValue("BR_MIN").toInt()); - ui_->horizontalSliderBrightness5->setMaximum(configuration_->getCSValue("BR_MAX").toInt()); - ui_->horizontalSliderBrightness5->setSingleStep(configuration_->getCSValue("BR_STEP").toInt()); - ui_->horizontalSliderBrightness5->setTickInterval(configuration_->getCSValue("BR_STEP").toInt()); - - // set tsl2561 slider attribs - ui_->horizontalSliderLux1->setValue(configuration_->getCSValue("LUX_LEVEL_1").toInt()); - ui_->horizontalSliderBrightness1->setValue(configuration_->getCSValue("DISP_BRIGHTNESS_1").toInt()); - ui_->horizontalSliderLux2->setValue(configuration_->getCSValue("LUX_LEVEL_2").toInt()); - ui_->horizontalSliderBrightness2->setValue(configuration_->getCSValue("DISP_BRIGHTNESS_2").toInt()); - ui_->horizontalSliderLux3->setValue(configuration_->getCSValue("LUX_LEVEL_3").toInt()); - ui_->horizontalSliderBrightness3->setValue(configuration_->getCSValue("DISP_BRIGHTNESS_3").toInt()); - ui_->horizontalSliderLux4->setValue(configuration_->getCSValue("LUX_LEVEL_4").toInt()); - ui_->horizontalSliderBrightness4->setValue(configuration_->getCSValue("DISP_BRIGHTNESS_4").toInt()); - ui_->horizontalSliderLux5->setValue(configuration_->getCSValue("LUX_LEVEL_5").toInt()); - ui_->horizontalSliderBrightness5->setValue(configuration_->getCSValue("DISP_BRIGHTNESS_5").toInt()); - ui_->comboBoxCheckInterval->setCurrentText(configuration_->getCSValue("TSL2561_CHECK_INTERVAL")); - ui_->comboBoxNightmodeStep->setCurrentText(configuration_->getCSValue("TSL2561_DAYNIGHT_ON_STEP")); - - if (std::ifstream("/tmp/return_value")) { - QString return_values = configuration_->readFileContent("/tmp/return_value"); - QStringList getparams = return_values.split("#"); - - // version string - ui_->valueSystemVersion->setText(configuration_->readFileContent("/etc/crankshaft.build")); - // date string - ui_->valueSystemBuildDate->setText(configuration_->readFileContent("/etc/crankshaft.date")); - // set volume - ui_->labelSystemVolumeValue->setText(configuration_->readFileContent("/boot/crankshaft/volume")); - ui_->horizontalSliderSystemVolume->setValue( - configuration_->readFileContent("/boot/crankshaft/volume").toInt()); - // set cap volume - ui_->labelSystemCaptureValue->setText(configuration_->readFileContent("/boot/crankshaft/capvolume")); - ui_->horizontalSliderSystemCapture->setValue( - configuration_->readFileContent("/boot/crankshaft/capvolume").toInt()); - // set shutdown - ui_->valueShutdownTimer->setText("- - -"); - ui_->spinBoxShutdown->setValue(configuration_->getCSValue("DISCONNECTION_POWEROFF_MINS").toInt()); - // set disconnect - ui_->valueDisconnectTimer->setText("- - -"); - ui_->spinBoxDisconnect->setValue(configuration_->getCSValue("DISCONNECTION_SCREEN_POWEROFF_SECS").toInt()); - // set day/night - ui_->spinBoxDay->setValue(configuration_->getCSValue("RTC_DAY_START").toInt()); - ui_->spinBoxNight->setValue(configuration_->getCSValue("RTC_NIGHT_START").toInt()); - // set gpios - if (configuration_->getCSValue("ENABLE_GPIO") == "1") { - ui_->checkBoxGPIO->setChecked(true); - } else { - ui_->checkBoxGPIO->setChecked(false); - } - ui_->comboBoxDevMode->setCurrentText(configuration_->getCSValue("DEV_PIN")); - ui_->comboBoxInvert->setCurrentText(configuration_->getCSValue("INVERT_PIN")); - ui_->comboBoxX11->setCurrentText(configuration_->getCSValue("X11_PIN")); - ui_->comboBoxRearcam->setCurrentText(configuration_->getCSValue("REARCAM_PIN")); - ui_->comboBoxAndroid->setCurrentText(configuration_->getCSValue("ANDROID_PIN")); - // set mode - if (configuration_->getCSValue("START_X11") == "0") { - ui_->radioButtonEGL->setChecked(true); - } else { - ui_->radioButtonX11->setChecked(true); - } - // set rotation - if (configuration_->getCSValue("FLIP_SCREEN") == "0") { - ui_->radioButtonScreenNormal->setChecked(true); - } else { - ui_->radioButtonScreenRotated->setChecked(true); - } - - if (std::ifstream("/tmp/get_inputs")) { - QFile inputsFile(QString("/tmp/get_inputs")); - inputsFile.open(QIODevice::ReadOnly); - QTextStream data_return(&inputsFile); - QStringList inputs = data_return.readAll().split("\n"); - inputsFile.close(); - int cleaner = ui_->comboBoxPulseInput->count(); - while (cleaner > -1) { - ui_->comboBoxPulseInput->removeItem(cleaner); - cleaner--; - } - int indexin = inputs.count(); - int countin = 0; - while (countin < indexin - 1) { - ui_->comboBoxPulseInput->addItem(inputs[countin]); - countin++; - } - } - - if (std::ifstream("/tmp/get_outputs")) { - QFile outputsFile(QString("/tmp/get_outputs")); - outputsFile.open(QIODevice::ReadOnly); - QTextStream data_return(&outputsFile); - QStringList outputs = data_return.readAll().split("\n"); - outputsFile.close(); - int cleaner = ui_->comboBoxPulseOutput->count(); - while (cleaner > -1) { - ui_->comboBoxPulseOutput->removeItem(cleaner); - cleaner--; - } - int indexout = outputs.count(); - int countout = 0; - while (countout < indexout - 1) { - ui_->comboBoxPulseOutput->addItem(outputs[countout]); - countout++; - } - } - - ui_->comboBoxPulseOutput->setCurrentText(configuration_->readFileContent("/tmp/get_default_output")); - ui_->comboBoxPulseInput->setCurrentText(configuration_->readFileContent("/tmp/get_default_input")); - - if (std::ifstream("/tmp/timezone_listing")) { - QFile zoneFile(QString("/tmp/timezone_listing")); - zoneFile.open(QIODevice::ReadOnly); - QTextStream data_return(&zoneFile); - QStringList zones = data_return.readAll().split("\n"); - zoneFile.close(); - int cleaner = ui_->comboBoxTZ->count(); - while (cleaner > 0) { - ui_->comboBoxTZ->removeItem(cleaner); - cleaner--; - } - int indexout = zones.count(); - int countzone = 0; - while (countzone < indexout - 1) { - ui_->comboBoxTZ->addItem(zones[countzone]); - countzone++; - } - } - - // set rtc - QString rtcstring = configuration_->getParamFromFile("/boot/config.txt", "dtoverlay=i2c-rtc"); - if (rtcstring != "") { - QStringList rtc = rtcstring.split(","); - ui_->comboBoxHardwareRTC->setCurrentText(rtc[1].trimmed()); - // set timezone - ui_->comboBoxTZ->setCurrentText(configuration_->readFileContent("/etc/timezone")); - } else { - ui_->comboBoxHardwareRTC->setCurrentText("none"); - ui_->comboBoxTZ->setCurrentText(configuration_->readFileContent("/etc/timezone")); - } - - // set dac - QString dac = "Custom"; - if (getparams[4] == "allo-boss-dac-pcm512x-audio") { - dac = "Allo - Boss"; - } - if (getparams[4] == "allo-piano-dac-pcm512x-audio") { - dac = "Allo - Piano"; - } - if (getparams[4] == "iqaudio-dacplus") { - dac = "IQaudIO - Pi-DAC Plus/Pro/Zero"; - } - if (getparams[4] == "iqaudio-dacplus,unmute_amp") { - dac = "IQaudIO - Pi-Digi Amp Plus"; - } - if (getparams[4] == "iqaudio-dacplus,auto_mute_amp") { - dac = "IQaudIO - Pi-Digi Amp Plus - Automute"; - } - if (getparams[4] == "iqaudio-digi-wm8804-audio") { - dac = "IQaudIO - Pi-Digi Plus"; - } - if (getparams[4] == "audioinjector-wm8731-audio") { - dac = "Audioinjector - Zero/Stereo"; - } - if (getparams[4] == "hifiberry-dac") { - dac = "Hifiberry - DAC"; - } - if (getparams[4] == "hifiberry-dacplus") { - dac = "Hifiberry - DAC Plus"; - } - if (getparams[4] == "hifiberry-digi") { - dac = "Hifiberry - Digi"; - } - if (getparams[4] == "hifiberry-digi-pro") { - dac = "Hifiberry - Digi Pro"; - } - if (getparams[4] == "hifiberry-amp") { - dac = "Hifiberry - DAC Amp"; - } - if (getparams[4] == "audio") { - dac = "Raspberry Pi - Onboard"; - } - ui_->comboBoxHardwareDAC->setCurrentText(dac); - - // set shutdown disable - if (configuration_->getCSValue("DISCONNECTION_POWEROFF_DISABLE") == "1") { - ui_->checkBoxDisableShutdown->setChecked(true); - } else { - ui_->checkBoxDisableShutdown->setChecked(false); - } - - // set screen off disable - if (configuration_->getCSValue("DISCONNECTION_SCREEN_POWEROFF_DISABLE") == "1") { - ui_->checkBoxDisableScreenOff->setChecked(true); - } else { - ui_->checkBoxDisableScreenOff->setChecked(false); - } - - // set custom brightness command - if (configuration_->getCSValue("CUSTOM_BRIGHTNESS_COMMAND") != "") { - ui_->labelCustomBrightnessCommand->setText( - configuration_->getCSValue("CUSTOM_BRIGHTNESS_COMMAND") + " brvalue"); - } else { - ui_->labelCustomBrightnessCommand->setText("Disabled"); - } - - // set debug mode - if (configuration_->getCSValue("DEBUG_MODE") == "1") { - ui_->radioButtonDebugmodeEnabled->setChecked(true); - } else { - ui_->radioButtonDebugmodeDisabled->setChecked(true); - } - - // GPIO based shutdown - ui_->comboBoxGPIOShutdown->setCurrentText(configuration_->getCSValue("IGNITION_PIN")); - ui_->spinBoxGPIOShutdownDelay->setValue(configuration_->getCSValue("IGNITION_DELAY").toInt()); - - // Wifi Hotspot - if (configuration_->getCSValue("ENABLE_HOTSPOT") == "1") { - ui_->checkBoxHotspot->setChecked(true); - } else { - ui_->checkBoxHotspot->setChecked(false); - } - - // set cam - if (configuration_->getParamFromFile("/boot/config.txt", "start_x") == "1") { - ui_->comboBoxCam->setCurrentText("enabled"); - } else { - ui_->comboBoxCam->setCurrentText("disabled"); - } - if (configuration_->getCSValue("RPICAM_HFLIP") == "1") { - ui_->checkBoxFlipX->setChecked(true); - } else { - ui_->checkBoxFlipX->setChecked(false); - } - if (configuration_->getCSValue("RPICAM_VFLIP") == "1") { - ui_->checkBoxFlipY->setChecked(true); - } else { - ui_->checkBoxFlipY->setChecked(false); - } - ui_->comboBoxRotation->setCurrentText(configuration_->getCSValue("RPICAM_ROTATION")); - ui_->comboBoxResolution->setCurrentText(configuration_->getCSValue("RPICAM_RESOLUTION")); - ui_->comboBoxFPS->setCurrentText(configuration_->getCSValue("RPICAM_FPS")); - ui_->comboBoxAWB->setCurrentText(configuration_->getCSValue("RPICAM_AWB")); - ui_->comboBoxEXP->setCurrentText(configuration_->getCSValue("RPICAM_EXP")); - ui_->comboBoxLoopTime->setCurrentText(configuration_->getCSValue("RPICAM_LOOPTIME")); - ui_->comboBoxLoopCount->setCurrentText(configuration_->getCSValue("RPICAM_LOOPCOUNT")); - - if (configuration_->getCSValue("RPICAM_AUTORECORDING") == "1") { - ui_->checkBoxAutoRecording->setChecked(true); - } else { - ui_->checkBoxAutoRecording->setChecked(false); - } - - if (configuration_->getCSValue("USBCAM_USE") == "1") { - ui_->comboBoxUSBCam->setCurrentText("enabled"); - } else { - ui_->comboBoxUSBCam->setCurrentText("none"); - } - if (configuration_->getCSValue("USBCAM_ROTATION") == "1") { - ui_->comboBoxUSBRotation->setCurrentText("180"); - } else { - ui_->comboBoxUSBRotation->setCurrentText("0"); - } - if (configuration_->getCSValue("USBCAM_HFLIP") == "1") { - ui_->checkBoxFlipXUSB->setChecked(true); - } else { - ui_->checkBoxFlipXUSB->setChecked(false); - } - if (configuration_->getCSValue("USBCAM_VFLIP") == "1") { - ui_->checkBoxFlipYUSB->setChecked(true); - } else { - ui_->checkBoxFlipYUSB->setChecked(false); - } + if (configuration_->getCSValue("USBCAM_USE") == "1") { + ui_->comboBoxUSBCam->setCurrentText("enabled"); + } else { + ui_->comboBoxUSBCam->setCurrentText("none"); + } + if (configuration_->getCSValue("USBCAM_ROTATION") == "1") { + ui_->comboBoxUSBRotation->setCurrentText("180"); + } else { + ui_->comboBoxUSBRotation->setCurrentText("0"); + } + if (configuration_->getCSValue("USBCAM_HFLIP") == "1") { + ui_->checkBoxFlipXUSB->setChecked(true); + } else { + ui_->checkBoxFlipXUSB->setChecked(false); + } + if (configuration_->getCSValue("USBCAM_VFLIP") == "1") { + ui_->checkBoxFlipYUSB->setChecked(true); + } else { + ui_->checkBoxFlipYUSB->setChecked(false); + } // set bluetooth if (configuration_->getCSValue("ENABLE_BLUETOOTH") == "1") { @@ -1117,265 +1125,267 @@ namespace f1x { ui_->comboBoxBluetooth->setCurrentText("none"); } - // set lightsensor - if (std::ifstream("/etc/cs_lightsensor")) { - ui_->comboBoxLS->setCurrentIndex(1); - ui_->groupBoxSliderDay->hide(); - ui_->groupBoxSliderNight->hide(); - } else { - ui_->comboBoxLS->setCurrentIndex(0); - ui_->pushButtonTab9->hide(); - ui_->groupBoxSliderDay->show(); - ui_->groupBoxSliderNight->show(); - } - ui_->comboBoxDayNight->setCurrentText(configuration_->getCSValue("DAYNIGHT_PIN")); - if (configuration_->getCSValue("RTC_DAYNIGHT") == "1") { - ui_->checkBoxDisableDayNightRTC->setChecked(false); - } else { - ui_->checkBoxDisableDayNightRTC->setChecked(true); - } - QString theme = configuration_->getParamFromFile("/etc/plymouth/plymouthd.conf", "Theme"); - if (theme == "csnganimation") { - ui_->radioButtonAnimatedCSNG->setChecked(true); - } else if (theme == "crankshaft") { - ui_->radioButtonCSNG->setChecked(true); - } else if (theme == "custom") { - ui_->radioButtonCustom->setChecked(true); - } - // wifi country code - ui_->comboBoxCountryCode->setCurrentIndex( - ui_->comboBoxCountryCode->findText(configuration_->getCSValue("WIFI_COUNTRY"), - Qt::MatchFlag::MatchStartsWith)); - // set screen blank instead off - if (configuration_->getCSValue("SCREEN_POWEROFF_OVERRIDE") == "1") { - ui_->checkBoxBlankOnly->setChecked(true); - } else { - ui_->checkBoxBlankOnly->setChecked(false); - } - } - // update network info - updateNetworkInfo(); - } - void SettingsWindow::onStartHotspot() { - ui_->label_modeswitchprogress->setText("Wait ..."); - ui_->clientNetworkSelect->hide(); - ui_->label_notavailable->show(); - ui_->radioButtonClient->setEnabled(0); - ui_->radioButtonHotspot->setEnabled(0); - ui_->lineEdit_wlan0->setText(""); - ui_->lineEditWifiSSID->setText(""); - ui_->pushButtonNetworkAuto->hide(); - qApp->processEvents(); - std::remove("/tmp/manual_hotspot_control"); - std::ofstream("/tmp/manual_hotspot_control"); - system("/opt/crankshaft/service_hotspot.sh start &"); - } - - void SettingsWindow::onStopHotspot() { - ui_->label_modeswitchprogress->setText("Wait ..."); - ui_->clientNetworkSelect->hide(); - ui_->label_notavailable->show(); - ui_->radioButtonClient->setEnabled(0); - ui_->radioButtonHotspot->setEnabled(0); - ui_->lineEdit_wlan0->setText(""); - ui_->lineEditWifiSSID->setText(""); - ui_->lineEditPassword->setText(""); - ui_->pushButtonNetworkAuto->hide(); - qApp->processEvents(); - system("/opt/crankshaft/service_hotspot.sh stop &"); - } - -#ifdef MAC_OS - void SettingsWindow::getMacMemoryInfo(QString& freeMemory) { - mach_port_t host_port; - vm_size_t page_size; - vm_statistics64_data_t vm_stats; - - host_port = mach_host_self(); - mach_msg_type_number_t count = HOST_VM_INFO64_COUNT; - host_page_size(host_port, &page_size); - if (host_statistics64(host_port, HOST_VM_INFO64, (host_info64_t)&vm_stats, &count) != KERN_SUCCESS) { - freeMemory = "Error in getting memory info"; - return; - } - - natural_t free_count = vm_stats.free_count; - uint64_t free_memory = (uint64_t)free_count * (uint64_t)page_size; - freeMemory = QString::number(free_memory / (1024 * 1024)) + " MB"; - } -#endif - - void SettingsWindow::updateSystemInfo() { -#ifdef MAC_OS - QString freeMem; - getMacMemoryInfo(freeMem); - ui_->valueSystemFreeMem->setText(freeMem); -#else - struct sysinfo info; - sysinfo(&info); - ui_->valueSystemFreeMem->setText(QString::number(info.freeram / 1024 / 1024) + " MB"); -#endif - - // current cpu speed - QString freq = configuration_->readFileContent("/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq"); - int currentfreq = freq.toInt() / 1000; - ui_->valueSystemCPUFreq->setText(QString::number(currentfreq) + "MHz"); - // current cpu temp - QString temp = configuration_->readFileContent("/sys/class/thermal/thermal_zone0/temp"); - int currenttemp = temp.toInt() / 1000; - ui_->valueSystemCPUTemp->setText(QString::number(currenttemp) + "°C"); - // get remaining times - QProcess process; - process.start("/bin/bash", - QStringList() << "-c" << "systemctl list-timers -all | grep disconnect | awk {'print $1'}"); - process.waitForFinished(-1); - QString stdout = process.readAllStandardOutput(); - if (stdout.simplified() != "n/a") { - process.start("/bin/bash", QStringList() << "-c" - << "systemctl list-timers -all | grep disconnect | awk {'print $5\" \"$6'}"); - process.waitForFinished(-1); - QString stdout = process.readAllStandardOutput(); - if (stdout.simplified() != "") { - ui_->valueDisconnectTimer->setText(stdout.simplified()); - } else { - ui_->valueDisconnectTimer->setText("Stopped"); - } - } else { - ui_->valueDisconnectTimer->setText("Stopped"); - } - process.start("/bin/bash", - QStringList() << "-c" << "systemctl list-timers -all | grep shutdown | awk {'print $1'}"); - process.waitForFinished(-1); - stdout = process.readAllStandardOutput(); - if (stdout.simplified() != "n/a") { - process.start("/bin/bash", QStringList() << "-c" - << "systemctl list-timers -all | grep shutdown | awk {'print $5\" \"$6'}"); - process.waitForFinished(-1); - QString stdout = process.readAllStandardOutput(); - if (stdout.simplified() != "") { - ui_->valueShutdownTimer->setText(stdout.simplified()); - } else { - ui_->valueShutdownTimer->setText("Stopped"); - } - } else { - ui_->valueShutdownTimer->setText("Stopped"); - } - } - - void SettingsWindow::show_tab1() { - ui_->tab2->hide(); - ui_->tab3->hide(); - ui_->tab4->hide(); - ui_->tab5->hide(); - ui_->tab6->hide(); - ui_->tab7->hide(); - ui_->tab8->hide(); - ui_->tab9->hide(); - ui_->tab1->show(); - } - - void SettingsWindow::show_tab2() { - ui_->tab1->hide(); - ui_->tab3->hide(); - ui_->tab4->hide(); - ui_->tab5->hide(); - ui_->tab6->hide(); - ui_->tab7->hide(); - ui_->tab8->hide(); - ui_->tab9->hide(); - ui_->tab2->show(); - } - - void SettingsWindow::show_tab3() { - ui_->tab1->hide(); - ui_->tab2->hide(); - ui_->tab4->hide(); - ui_->tab5->hide(); - ui_->tab6->hide(); - ui_->tab7->hide(); - ui_->tab8->hide(); - ui_->tab9->hide(); - ui_->tab3->show(); - } - - void SettingsWindow::show_tab4() { - ui_->tab1->hide(); - ui_->tab2->hide(); - ui_->tab3->hide(); - ui_->tab5->hide(); - ui_->tab6->hide(); - ui_->tab7->hide(); - ui_->tab8->hide(); - ui_->tab9->hide(); - ui_->tab4->show(); - } - - void SettingsWindow::show_tab5() { - ui_->tab1->hide(); - ui_->tab2->hide(); - ui_->tab3->hide(); - ui_->tab4->hide(); - ui_->tab6->hide(); - ui_->tab7->hide(); - ui_->tab8->hide(); - ui_->tab9->hide(); - ui_->tab5->show(); - } - - void SettingsWindow::show_tab6() { - ui_->tab1->hide(); - ui_->tab2->hide(); - ui_->tab3->hide(); - ui_->tab4->hide(); - ui_->tab5->hide(); - ui_->tab7->hide(); - ui_->tab8->hide(); - ui_->tab9->hide(); - ui_->tab6->show(); - } - - void SettingsWindow::show_tab7() { - ui_->tab1->hide(); - ui_->tab2->hide(); - ui_->tab3->hide(); - ui_->tab4->hide(); - ui_->tab5->hide(); - ui_->tab6->hide(); - ui_->tab8->hide(); - ui_->tab9->hide(); - ui_->tab7->show(); - } - - void SettingsWindow::show_tab8() { - ui_->tab1->hide(); - ui_->tab2->hide(); - ui_->tab3->hide(); - ui_->tab4->hide(); - ui_->tab5->hide(); - ui_->tab6->hide(); - ui_->tab7->hide(); - ui_->tab9->hide(); - ui_->tab8->show(); - } - - void SettingsWindow::show_tab9() { - ui_->tab1->hide(); - ui_->tab2->hide(); - ui_->tab3->hide(); - ui_->tab4->hide(); - ui_->tab5->hide(); - ui_->tab6->hide(); - ui_->tab7->hide(); - ui_->tab8->hide(); - ui_->tab9->show(); - } + // set lightsensor + if (std::ifstream("/etc/cs_lightsensor")) { + ui_->comboBoxLS->setCurrentIndex(1); + ui_->groupBoxSliderDay->hide(); + ui_->groupBoxSliderNight->hide(); + } else { + ui_->comboBoxLS->setCurrentIndex(0); + ui_->pushButtonTab9->hide(); + ui_->groupBoxSliderDay->show(); + ui_->groupBoxSliderNight->show(); + } + ui_->comboBoxDayNight->setCurrentText(configuration_->getCSValue("DAYNIGHT_PIN")); + if (configuration_->getCSValue("RTC_DAYNIGHT") == "1") { + ui_->checkBoxDisableDayNightRTC->setChecked(false); + } else { + ui_->checkBoxDisableDayNightRTC->setChecked(true); + } + QString theme = configuration_->getParamFromFile("/etc/plymouth/plymouthd.conf", "Theme"); + if (theme == "csnganimation") { + ui_->radioButtonAnimatedCSNG->setChecked(true); + } else if (theme == "crankshaft") { + ui_->radioButtonCSNG->setChecked(true); + } else if (theme == "custom") { + ui_->radioButtonCustom->setChecked(true); + } + // wifi country code + ui_->comboBoxCountryCode->setCurrentIndex( + ui_->comboBoxCountryCode->findText(configuration_->getCSValue("WIFI_COUNTRY"), + Qt::MatchFlag::MatchStartsWith)); + // set screen blank instead off + if (configuration_->getCSValue("SCREEN_POWEROFF_OVERRIDE") == "1") { + ui_->checkBoxBlankOnly->setChecked(true); + } else { + ui_->checkBoxBlankOnly->setChecked(false); } } + // update network info + updateNetworkInfo(); } + + void SettingsWindow::onStartHotspot() { + ui_->label_modeswitchprogress->setText("Wait ..."); + ui_->clientNetworkSelect->hide(); + ui_->label_notavailable->show(); + ui_->radioButtonClient->setEnabled(0); + ui_->radioButtonHotspot->setEnabled(0); + ui_->lineEdit_wlan0->setText(""); + ui_->lineEditWifiSSID->setText(""); + ui_->pushButtonNetworkAuto->hide(); + qApp->processEvents(); + std::remove("/tmp/manual_hotspot_control"); + std::ofstream("/tmp/manual_hotspot_control"); + system("/opt/crankshaft/service_hotspot.sh start &"); + } + + void SettingsWindow::onStopHotspot() { + ui_->label_modeswitchprogress->setText("Wait ..."); + ui_->clientNetworkSelect->hide(); + ui_->label_notavailable->show(); + ui_->radioButtonClient->setEnabled(0); + ui_->radioButtonHotspot->setEnabled(0); + ui_->lineEdit_wlan0->setText(""); + ui_->lineEditWifiSSID->setText(""); + ui_->lineEditPassword->setText(""); + ui_->pushButtonNetworkAuto->hide(); + qApp->processEvents(); + system("/opt/crankshaft/service_hotspot.sh stop &"); + } + +#ifdef MAC_OS + + void SettingsWindow::getMacMemoryInfo(QString &freeMemory) { + mach_port_t host_port; + vm_size_t page_size; + vm_statistics64_data_t vm_stats; + + host_port = mach_host_self(); + mach_msg_type_number_t count = HOST_VM_INFO64_COUNT; + host_page_size(host_port, &page_size); + if (host_statistics64(host_port, HOST_VM_INFO64, (host_info64_t) &vm_stats, &count) != KERN_SUCCESS) { + freeMemory = "Error in getting memory info"; + return; + } + + natural_t free_count = vm_stats.free_count; + uint64_t free_memory = (uint64_t) free_count * (uint64_t) page_size; + freeMemory = QString::number(free_memory / (1024 * 1024)) + " MB"; + } + +#endif + + void SettingsWindow::updateSystemInfo() { +#ifdef MAC_OS + QString freeMem; + getMacMemoryInfo(freeMem); + ui_->valueSystemFreeMem->setText(freeMem); +#else + struct sysinfo info; + sysinfo(&info); + ui_->valueSystemFreeMem->setText(QString::number(info.freeram / 1024 / 1024) + " MB"); +#endif + + // current cpu speed + QString freq = configuration_->readFileContent("/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq"); + int currentfreq = freq.toInt() / 1000; + ui_->valueSystemCPUFreq->setText(QString::number(currentfreq) + "MHz"); + // current cpu temp + QString temp = configuration_->readFileContent("/sys/class/thermal/thermal_zone0/temp"); + int currenttemp = temp.toInt() / 1000; + ui_->valueSystemCPUTemp->setText(QString::number(currenttemp) + "°C"); + // get remaining times + QProcess process; + process.start("/bin/bash", + QStringList() << "-c" << "systemctl list-timers -all | grep disconnect | awk {'print $1'}"); + process.waitForFinished(-1); + QString stdout = process.readAllStandardOutput(); + if (stdout.simplified() != "n/a") { + process.start("/bin/bash", QStringList() << "-c" + << "systemctl list-timers -all | grep disconnect | awk {'print $5\" \"$6'}"); + process.waitForFinished(-1); + QString stdout = process.readAllStandardOutput(); + if (stdout.simplified() != "") { + ui_->valueDisconnectTimer->setText(stdout.simplified()); + } else { + ui_->valueDisconnectTimer->setText("Stopped"); + } + } else { + ui_->valueDisconnectTimer->setText("Stopped"); + } + process.start("/bin/bash", + QStringList() << "-c" << "systemctl list-timers -all | grep shutdown | awk {'print $1'}"); + process.waitForFinished(-1); + stdout = process.readAllStandardOutput(); + if (stdout.simplified() != "n/a") { + process.start("/bin/bash", QStringList() << "-c" + << "systemctl list-timers -all | grep shutdown | awk {'print $5\" \"$6'}"); + process.waitForFinished(-1); + QString stdout = process.readAllStandardOutput(); + if (stdout.simplified() != "") { + ui_->valueShutdownTimer->setText(stdout.simplified()); + } else { + ui_->valueShutdownTimer->setText("Stopped"); + } + } else { + ui_->valueShutdownTimer->setText("Stopped"); + } + } + + void SettingsWindow::show_tab1() { + ui_->tab2->hide(); + ui_->tab3->hide(); + ui_->tab4->hide(); + ui_->tab5->hide(); + ui_->tab6->hide(); + ui_->tab7->hide(); + ui_->tab8->hide(); + ui_->tab9->hide(); + ui_->tab1->show(); + } + + void SettingsWindow::show_tab2() { + ui_->tab1->hide(); + ui_->tab3->hide(); + ui_->tab4->hide(); + ui_->tab5->hide(); + ui_->tab6->hide(); + ui_->tab7->hide(); + ui_->tab8->hide(); + ui_->tab9->hide(); + ui_->tab2->show(); + } + + void SettingsWindow::show_tab3() { + ui_->tab1->hide(); + ui_->tab2->hide(); + ui_->tab4->hide(); + ui_->tab5->hide(); + ui_->tab6->hide(); + ui_->tab7->hide(); + ui_->tab8->hide(); + ui_->tab9->hide(); + ui_->tab3->show(); + } + + void SettingsWindow::show_tab4() { + ui_->tab1->hide(); + ui_->tab2->hide(); + ui_->tab3->hide(); + ui_->tab5->hide(); + ui_->tab6->hide(); + ui_->tab7->hide(); + ui_->tab8->hide(); + ui_->tab9->hide(); + ui_->tab4->show(); + } + + void SettingsWindow::show_tab5() { + ui_->tab1->hide(); + ui_->tab2->hide(); + ui_->tab3->hide(); + ui_->tab4->hide(); + ui_->tab6->hide(); + ui_->tab7->hide(); + ui_->tab8->hide(); + ui_->tab9->hide(); + ui_->tab5->show(); + } + + void SettingsWindow::show_tab6() { + ui_->tab1->hide(); + ui_->tab2->hide(); + ui_->tab3->hide(); + ui_->tab4->hide(); + ui_->tab5->hide(); + ui_->tab7->hide(); + ui_->tab8->hide(); + ui_->tab9->hide(); + ui_->tab6->show(); + } + + void SettingsWindow::show_tab7() { + ui_->tab1->hide(); + ui_->tab2->hide(); + ui_->tab3->hide(); + ui_->tab4->hide(); + ui_->tab5->hide(); + ui_->tab6->hide(); + ui_->tab8->hide(); + ui_->tab9->hide(); + ui_->tab7->show(); + } + + void SettingsWindow::show_tab8() { + ui_->tab1->hide(); + ui_->tab2->hide(); + ui_->tab3->hide(); + ui_->tab4->hide(); + ui_->tab5->hide(); + ui_->tab6->hide(); + ui_->tab7->hide(); + ui_->tab9->hide(); + ui_->tab8->show(); + } + + void SettingsWindow::show_tab9() { + ui_->tab1->hide(); + ui_->tab2->hide(); + ui_->tab3->hide(); + ui_->tab4->hide(); + ui_->tab5->hide(); + ui_->tab6->hide(); + ui_->tab7->hide(); + ui_->tab8->hide(); + ui_->tab9->show(); + } + } + void f1x::openauto::autoapp::ui::SettingsWindow::on_pushButtonAudioTest_clicked() { ui_->labelTestInProgress->show(); ui_->pushButtonAudioTest->hide(); From 28caa06b09a7c921bd9551c416a195209b84ed28 Mon Sep 17 00:00:00 2001 From: Simon Dean Date: Wed, 27 Nov 2024 10:02:01 +0000 Subject: [PATCH 11/14] Remove concept of Local and Remote Bluetooth Devices. They both essentially do the same thing - to return the hardware address, and show whether the adapter is available. Remove RemoteBluetoothDevice, merge into LocalBluetoothDevice Introduce routine to SettingsWindow to bring in list of adapters. --- .../Configuration/BluetoothAdapterType.hpp | 7 +- .../autoapp/Configuration/Configuration.hpp | 9 +- .../autoapp/Configuration/IConfiguration.hpp | 6 +- .../Projection/DummyBluetoothDevice.hpp | 3 +- .../autoapp/Projection/IBluetoothDevice.hpp | 3 +- .../Projection/LocalBluetoothDevice.hpp | 3 +- .../Projection/RemoteBluetoothDevice.hpp | 50 --- src/autoapp/Configuration/Configuration.cpp | 16 +- .../Projection/LocalBluetoothDevice.cpp | 3 +- .../Projection/RemoteBluetoothDevice.cpp | 64 ---- .../Service/Bluetooth/BluetoothService.cpp | 34 +- src/autoapp/Service/ServiceFactory.cpp | 34 +- src/autoapp/UI/SettingsWindow.cpp | 300 +++++++++++------- src/autoapp/UI/settingswindow.ui | 101 ------ 14 files changed, 238 insertions(+), 395 deletions(-) delete mode 100644 include/f1x/openauto/autoapp/Projection/RemoteBluetoothDevice.hpp delete mode 100644 src/autoapp/Projection/RemoteBluetoothDevice.cpp diff --git a/include/f1x/openauto/autoapp/Configuration/BluetoothAdapterType.hpp b/include/f1x/openauto/autoapp/Configuration/BluetoothAdapterType.hpp index 9e9bab1..43868a4 100644 --- a/include/f1x/openauto/autoapp/Configuration/BluetoothAdapterType.hpp +++ b/include/f1x/openauto/autoapp/Configuration/BluetoothAdapterType.hpp @@ -24,11 +24,8 @@ namespace f1x::openauto::autoapp::configuration { enum class BluetoothAdapterType { NONE, LOCAL, - REMOTE -}; - -} -} + EXTERNAL + }; } diff --git a/include/f1x/openauto/autoapp/Configuration/Configuration.hpp b/include/f1x/openauto/autoapp/Configuration/Configuration.hpp index e7d760f..dc7aee6 100644 --- a/include/f1x/openauto/autoapp/Configuration/Configuration.hpp +++ b/include/f1x/openauto/autoapp/Configuration/Configuration.hpp @@ -109,8 +109,9 @@ public: BluetoothAdapterType getBluetoothAdapterType() const override; void setBluetoothAdapterType(BluetoothAdapterType value) override; - std::string getBluetoothRemoteAdapterAddress() const override; - void setBluetoothRemoteAdapterAddress(const std::string& value) override; + std::string getBluetoothAdapterAddress() const override; + + void setBluetoothAdapterAddress(const std::string& value) override; bool musicAudioChannelEnabled() const override; void setMusicAudioChannelEnabled(bool value) override; @@ -157,7 +158,7 @@ private: bool enablePlayerControl_; ButtonCodes buttonCodes_; BluetoothAdapterType bluetoothAdapterType_; - std::string bluetoothRemoteAdapterAddress_; + std::string bluetoothAdapterAddress_; bool _audioChannelEnabledMedia; bool _audioChannelEnabledGuidance; bool _audioChannelEnabledSystem; @@ -204,7 +205,7 @@ private: static const std::string cAudioOutputBackendType; static const std::string cBluetoothAdapterTypeKey; - static const std::string cBluetoothRemoteAdapterAddressKey; + static const std::string cBluetoothAdapterAddressKey; static const std::string cInputEnableTouchscreenKey; static const std::string cInputEnablePlayerControlKey; diff --git a/include/f1x/openauto/autoapp/Configuration/IConfiguration.hpp b/include/f1x/openauto/autoapp/Configuration/IConfiguration.hpp index 091eecb..2606c41 100644 --- a/include/f1x/openauto/autoapp/Configuration/IConfiguration.hpp +++ b/include/f1x/openauto/autoapp/Configuration/IConfiguration.hpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include @@ -112,8 +112,8 @@ public: virtual BluetoothAdapterType getBluetoothAdapterType() const = 0; virtual void setBluetoothAdapterType(BluetoothAdapterType value) = 0; - virtual std::string getBluetoothRemoteAdapterAddress() const = 0; - virtual void setBluetoothRemoteAdapterAddress(const std::string& value) = 0; + virtual std::string getBluetoothAdapterAddress() const = 0; + virtual void setBluetoothAdapterAddress(const std::string& value) = 0; virtual bool musicAudioChannelEnabled() const = 0; virtual void setMusicAudioChannelEnabled(bool value) = 0; diff --git a/include/f1x/openauto/autoapp/Projection/DummyBluetoothDevice.hpp b/include/f1x/openauto/autoapp/Projection/DummyBluetoothDevice.hpp index 7dd8717..9086b24 100644 --- a/include/f1x/openauto/autoapp/Projection/DummyBluetoothDevice.hpp +++ b/include/f1x/openauto/autoapp/Projection/DummyBluetoothDevice.hpp @@ -34,8 +34,7 @@ class DummyBluetoothDevice: public IBluetoothDevice public: void stop() override; bool isPaired(const std::string& address) const override; - void pair(const std::string& address, PairingPromise::Pointer promise) override; - std::string getLocalAddress() const override; + std::string getAdapterAddress() const override; bool isAvailable() const override; }; diff --git a/include/f1x/openauto/autoapp/Projection/IBluetoothDevice.hpp b/include/f1x/openauto/autoapp/Projection/IBluetoothDevice.hpp index e5794cb..2599362 100644 --- a/include/f1x/openauto/autoapp/Projection/IBluetoothDevice.hpp +++ b/include/f1x/openauto/autoapp/Projection/IBluetoothDevice.hpp @@ -37,8 +37,7 @@ public: virtual void stop() = 0; virtual bool isPaired(const std::string& address) const = 0; - virtual void pair(const std::string& address, PairingPromise::Pointer promise) = 0; - virtual std::string getLocalAddress() const = 0; + virtual std::string getAdapterAddress() const = 0; virtual bool isAvailable() const = 0; }; diff --git a/include/f1x/openauto/autoapp/Projection/LocalBluetoothDevice.hpp b/include/f1x/openauto/autoapp/Projection/LocalBluetoothDevice.hpp index cc6fe5b..73ec688 100644 --- a/include/f1x/openauto/autoapp/Projection/LocalBluetoothDevice.hpp +++ b/include/f1x/openauto/autoapp/Projection/LocalBluetoothDevice.hpp @@ -35,8 +35,7 @@ public: void stop() override; bool isPaired(const std::string& address) const override; - void pair(const std::string& address, PairingPromise::Pointer promise) override; - std::string getLocalAddress() const override; + std::string getAdapterAddress() const override; bool isAvailable() const override; signals: diff --git a/include/f1x/openauto/autoapp/Projection/RemoteBluetoothDevice.hpp b/include/f1x/openauto/autoapp/Projection/RemoteBluetoothDevice.hpp deleted file mode 100644 index 692241c..0000000 --- a/include/f1x/openauto/autoapp/Projection/RemoteBluetoothDevice.hpp +++ /dev/null @@ -1,50 +0,0 @@ -/* -* 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 . -*/ - -#pragma once - -#include - -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace projection -{ - -class RemoteBluetoothDevice: public IBluetoothDevice -{ -public: - RemoteBluetoothDevice(const std::string& address); - - void stop() override; - bool isPaired(const std::string& address) const override; - void pair(const std::string& address, PairingPromise::Pointer promise) override; - std::string getLocalAddress() const override; - bool isAvailable() const override; - -private: - std::string address_; -}; - -} -} -} -} diff --git a/src/autoapp/Configuration/Configuration.cpp b/src/autoapp/Configuration/Configuration.cpp index 9069544..ba1f789 100644 --- a/src/autoapp/Configuration/Configuration.cpp +++ b/src/autoapp/Configuration/Configuration.cpp @@ -65,7 +65,7 @@ const std::string Configuration::cAudioChannelTelephonyEnabled = "AudioChannel.T const std::string Configuration::cAudioOutputBackendType = "Audio.OutputBackendType"; const std::string Configuration::cBluetoothAdapterTypeKey = "Bluetooth.AdapterType"; -const std::string Configuration::cBluetoothRemoteAdapterAddressKey = "Bluetooth.RemoteAdapterAddress"; +const std::string Configuration::cBluetoothAdapterAddressKey = "Bluetooth.AdapterAddress"; const std::string Configuration::cInputEnableTouchscreenKey = "Input.EnableTouchscreen"; const std::string Configuration::cInputEnablePlayerControlKey = "Input.EnablePlayerControl"; @@ -137,7 +137,7 @@ void Configuration::load() bluetoothAdapterType_ = static_cast(iniConfig.get(cBluetoothAdapterTypeKey, static_cast(BluetoothAdapterType::NONE))); - bluetoothRemoteAdapterAddress_ = iniConfig.get(cBluetoothRemoteAdapterAddressKey, ""); + bluetoothAdapterAddress_ = iniConfig.get(cBluetoothAdapterAddressKey, ""); _audioChannelEnabledMedia = iniConfig.get(cAudioChannelMediaEnabled, true); _audioChannelEnabledGuidance = iniConfig.get(cAudioChannelGuidanceEnabled, true); @@ -184,7 +184,7 @@ void Configuration::reset() enablePlayerControl_ = false; buttonCodes_.clear(); bluetoothAdapterType_ = BluetoothAdapterType::NONE; - bluetoothRemoteAdapterAddress_ = ""; + bluetoothAdapterAddress_ = ""; _audioChannelEnabledMedia = true; _audioChannelEnabledGuidance = true; @@ -229,7 +229,7 @@ void Configuration::save() this->writeButtonCodes(iniConfig); iniConfig.put(cBluetoothAdapterTypeKey, static_cast(bluetoothAdapterType_)); - iniConfig.put(cBluetoothRemoteAdapterAddressKey, bluetoothRemoteAdapterAddress_); + iniConfig.put(cBluetoothAdapterAddressKey, bluetoothAdapterAddress_); iniConfig.put(cAudioChannelMediaEnabled, _audioChannelEnabledMedia); iniConfig.put(cAudioChannelGuidanceEnabled, _audioChannelEnabledGuidance); @@ -529,14 +529,14 @@ void Configuration::setBluetoothAdapterType(BluetoothAdapterType value) bluetoothAdapterType_ = value; } -std::string Configuration::getBluetoothRemoteAdapterAddress() const +std::string Configuration::getBluetoothAdapterAddress() const { - return bluetoothRemoteAdapterAddress_; + return bluetoothAdapterAddress_; } -void Configuration::setBluetoothRemoteAdapterAddress(const std::string& value) +void Configuration::setBluetoothAdapterAddress(const std::string& value) { - bluetoothRemoteAdapterAddress_ = value; + bluetoothAdapterAddress_ = value; } bool Configuration::musicAudioChannelEnabled() const diff --git a/src/autoapp/Projection/LocalBluetoothDevice.cpp b/src/autoapp/Projection/LocalBluetoothDevice.cpp index ccd987b..5d3be0b 100644 --- a/src/autoapp/Projection/LocalBluetoothDevice.cpp +++ b/src/autoapp/Projection/LocalBluetoothDevice.cpp @@ -74,8 +74,7 @@ void LocalBluetoothDevice::pair(const std::string& address, PairingPromise::Poin emit startPairing(QString::fromStdString(address), std::move(promise)); } -std::string LocalBluetoothDevice::getLocalAddress() const -{ + std::string LocalBluetoothDevice::getAdapterAddress() const { std::lock_guard lock(mutex_); return localDevice_->isValid() ? localDevice_->address().toString().toStdString() : ""; } diff --git a/src/autoapp/Projection/RemoteBluetoothDevice.cpp b/src/autoapp/Projection/RemoteBluetoothDevice.cpp deleted file mode 100644 index b86c96f..0000000 --- a/src/autoapp/Projection/RemoteBluetoothDevice.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* -* 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 . -*/ - -#include - -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace projection -{ - -RemoteBluetoothDevice::RemoteBluetoothDevice(const std::string& address) - : address_(address) -{ - -} - -void RemoteBluetoothDevice::stop() -{ - -} - -bool RemoteBluetoothDevice::isPaired(const std::string&) const -{ - return true; -} - -void RemoteBluetoothDevice::pair(const std::string&, PairingPromise::Pointer promise) -{ - promise->resolve(); -} - -std::string RemoteBluetoothDevice::getLocalAddress() const -{ - return address_; -} - -bool RemoteBluetoothDevice::isAvailable() const -{ - return true; -} - -} -} -} -} diff --git a/src/autoapp/Service/Bluetooth/BluetoothService.cpp b/src/autoapp/Service/Bluetooth/BluetoothService.cpp index 14f4c05..d14dabf 100644 --- a/src/autoapp/Service/Bluetooth/BluetoothService.cpp +++ b/src/autoapp/Service/Bluetooth/BluetoothService.cpp @@ -60,23 +60,29 @@ namespace f1x::openauto::autoapp::service::bluetooth { aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) { OPENAUTO_LOG(info) << "[BluetoothService] fillFeatures()"; - if (bluetoothDevice_->isAvailable()) { - OPENAUTO_LOG(info) << "[BluetoothService] Local Address: " << bluetoothDevice_->getLocalAddress(); + auto *service = response.add_channels(); + service->set_id(static_cast(channel_->getId())); - auto *service = response.add_channels(); - service->set_id(static_cast(channel_->getId())); + auto bluetooth = service->mutable_bluetooth_service(); - auto bluetooth = service->mutable_bluetooth_service(); - // If the HU wants the MD to skip the Bluetooth Pairing and Connection process, the HU can declaire it's address as SKIP_THIS_BLUETOOTH - bluetooth->set_car_address(bluetoothDevice_->getLocalAddress()); + if (bluetoothDevice_->isAvailable()) { + OPENAUTO_LOG(info) << "[BluetoothService] Local Address: " << bluetoothDevice_->getAdapterAddress(); - // AAP supports bth PIN and Numeric Comparison as pairing methods. - bluetooth->add_supported_pairing_methods(aap_protobuf::service::bluetooth::message::BluetoothPairingMethod::BLUETOOTH_PAIRING_PIN); - bluetooth->add_supported_pairing_methods(aap_protobuf::service::bluetooth::message::BluetoothPairingMethod::BLUETOOTH_PAIRING_NUMERIC_COMPARISON); - } else { - OPENAUTO_LOG(info) << "[BluetoothService] Bluetooth Not Available "; - } - } + // TODO: Also need to re-establish Bluetooth + // If the HU wants the MD to skip the Bluetooth Pairing and Connection process, the HU can declare its address as SKIP_THIS_BLUETOOTH + bluetooth->set_car_address(bluetoothDevice_->getAdapterAddress()); + + // AAP supports bth PIN and Numeric Comparison as pairing methods. + bluetooth->add_supported_pairing_methods( + aap_protobuf::service::bluetooth::message::BluetoothPairingMethod::BLUETOOTH_PAIRING_PIN); + bluetooth->add_supported_pairing_methods( + aap_protobuf::service::bluetooth::message::BluetoothPairingMethod::BLUETOOTH_PAIRING_NUMERIC_COMPARISON); + } else { + OPENAUTO_LOG(info) << "[BluetoothService] Bluetooth Not Available "; + bluetooth->set_car_address(""); + bluetooth->add_supported_pairing_methods(aap_protobuf::service::bluetooth::message::BluetoothPairingMethod::BLUETOOTH_PAIRING_UNAVAILABLE); + } + } void BluetoothService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { diff --git a/src/autoapp/Service/ServiceFactory.cpp b/src/autoapp/Service/ServiceFactory.cpp index aa0fac8..693be0d 100644 --- a/src/autoapp/Service/ServiceFactory.cpp +++ b/src/autoapp/Service/ServiceFactory.cpp @@ -72,28 +72,18 @@ namespace f1x::openauto::autoapp::service { return serviceList; } - 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] Using Local Bluetooth Adapter"; - bluetoothDevice = projection::IBluetoothDevice::Pointer(new projection::LocalBluetoothDevice(), - std::bind(&QObject::deleteLater, - std::placeholders::_1)); - break; - - case configuration::BluetoothAdapterType::REMOTE: - OPENAUTO_LOG(debug) << "[ServiceFactory] Using Remote Bluetooth Adapter"; - bluetoothDevice = std::make_shared( - configuration_->getBluetoothRemoteAdapterAddress()); - break; - - default: - OPENAUTO_LOG(debug) << "[ServiceFactory] Using Dummy Bluetooth"; - bluetoothDevice = std::make_shared(); - break; - } + IService::Pointer ServiceFactory::createBluetoothService(aasdk::messenger::IMessenger::Pointer messenger) { + OPENAUTO_LOG(info) << "[ServiceFactory] createBluetoothService()"; + projection::IBluetoothDevice::Pointer bluetoothDevice; + if (configuration_->getBluetoothAdapterAddress() == "") { + OPENAUTO_LOG(debug) << "[ServiceFactory] Using Dummy Bluetooth"; + bluetoothDevice = std::make_shared(); + } else { + OPENAUTO_LOG(info) << "[ServiceFactory] Using Local Bluetooth Adapter"; + bluetoothDevice = projection::IBluetoothDevice::Pointer(new projection::LocalBluetoothDevice(), + std::bind(&QObject::deleteLater, + std::placeholders::_1)); + } return std::make_shared(ioService_, messenger, std::move(bluetoothDevice)); } diff --git a/src/autoapp/UI/SettingsWindow.cpp b/src/autoapp/UI/SettingsWindow.cpp index d7840a6..4d39d6e 100644 --- a/src/autoapp/UI/SettingsWindow.cpp +++ b/src/autoapp/UI/SettingsWindow.cpp @@ -49,61 +49,56 @@ namespace f1x::openauto::autoapp::ui { - SettingsWindow::SettingsWindow(configuration::IConfiguration::Pointer configuration, QWidget *parent) - : QWidget(parent), ui_(new Ui::SettingsWindow), configuration_(std::move(configuration)) { - ui_->setupUi(this); - connect(ui_->pushButtonCancel, &QPushButton::clicked, this, &SettingsWindow::close); - connect(ui_->pushButtonSave, &QPushButton::clicked, this, &SettingsWindow::onSave); - connect(ui_->pushButtonUnpair, &QPushButton::clicked, this, &SettingsWindow::unpairAll); - connect(ui_->pushButtonUnpair, &QPushButton::clicked, this, &SettingsWindow::close); - connect(ui_->horizontalSliderScreenDPI, &QSlider::valueChanged, this, &SettingsWindow::onUpdateScreenDPI); - connect(ui_->horizontalSliderAlphaTrans, &QSlider::valueChanged, this, &SettingsWindow::onUpdateAlphaTrans); - connect(ui_->horizontalSliderDay, &QSlider::valueChanged, this, &SettingsWindow::onUpdateBrightnessDay); - connect(ui_->horizontalSliderNight, &QSlider::valueChanged, this, &SettingsWindow::onUpdateBrightnessNight); - connect(ui_->horizontalSliderBrightness1, &QSlider::valueChanged, this, &SettingsWindow::onUpdateBrightness1); - connect(ui_->horizontalSliderBrightness2, &QSlider::valueChanged, this, &SettingsWindow::onUpdateBrightness2); - connect(ui_->horizontalSliderBrightness3, &QSlider::valueChanged, this, &SettingsWindow::onUpdateBrightness3); - connect(ui_->horizontalSliderBrightness4, &QSlider::valueChanged, this, &SettingsWindow::onUpdateBrightness4); - connect(ui_->horizontalSliderBrightness5, &QSlider::valueChanged, this, &SettingsWindow::onUpdateBrightness5); - connect(ui_->horizontalSliderLux1, &QSlider::valueChanged, this, &SettingsWindow::onUpdateLux1); - connect(ui_->horizontalSliderLux2, &QSlider::valueChanged, this, &SettingsWindow::onUpdateLux2); - connect(ui_->horizontalSliderLux3, &QSlider::valueChanged, this, &SettingsWindow::onUpdateLux3); - connect(ui_->horizontalSliderLux4, &QSlider::valueChanged, this, &SettingsWindow::onUpdateLux4); - connect(ui_->horizontalSliderLux5, &QSlider::valueChanged, this, &SettingsWindow::onUpdateLux5); - connect(ui_->radioButtonUseExternalBluetoothAdapter, &QRadioButton::clicked, - [&](bool checked) { ui_->lineEditExternalBluetoothAdapterAddress->setEnabled(checked); }); - connect(ui_->radioButtonDisableBluetooth, &QRadioButton::clicked, - [&]() { ui_->lineEditExternalBluetoothAdapterAddress->setEnabled(false); }); - connect(ui_->radioButtonUseLocalBluetoothAdapter, &QRadioButton::clicked, - [&]() { ui_->lineEditExternalBluetoothAdapterAddress->setEnabled(false); }); - connect(ui_->pushButtonClearSelection, &QPushButton::clicked, - std::bind(&SettingsWindow::setButtonCheckBoxes, this, false)); - connect(ui_->pushButtonSelectAll, &QPushButton::clicked, - std::bind(&SettingsWindow::setButtonCheckBoxes, this, true)); - connect(ui_->pushButtonResetToDefaults, &QPushButton::clicked, this, &SettingsWindow::onResetToDefaults); - connect(ui_->horizontalSliderSystemVolume, &QSlider::valueChanged, this, - &SettingsWindow::onUpdateSystemVolume); - connect(ui_->horizontalSliderSystemCapture, &QSlider::valueChanged, this, - &SettingsWindow::onUpdateSystemCapture); - connect(ui_->radioButtonHotspot, &QPushButton::clicked, this, &SettingsWindow::onStartHotspot); - connect(ui_->radioButtonClient, &QPushButton::clicked, this, &SettingsWindow::onStopHotspot); - connect(ui_->pushButtonSetTime, &QPushButton::clicked, this, &SettingsWindow::setTime); - connect(ui_->pushButtonSetTime, &QPushButton::clicked, this, &SettingsWindow::close); - connect(ui_->pushButtonNTP, &QPushButton::clicked, [&]() { system("/usr/local/bin/crankshaft rtc sync &"); }); - connect(ui_->pushButtonNTP, &QPushButton::clicked, this, &SettingsWindow::close); - connect(ui_->pushButtonCheckNow, &QPushButton::clicked, - [&]() { system("/usr/local/bin/crankshaft update check &"); }); - connect(ui_->pushButtonDebuglog, &QPushButton::clicked, this, &SettingsWindow::close); - connect(ui_->pushButtonDebuglog, &QPushButton::clicked, - [&]() { system("/usr/local/bin/crankshaft debuglog &"); }); - connect(ui_->pushButtonNetworkAuto, &QPushButton::clicked, - [&]() { system("/usr/local/bin/crankshaft network auto &"); }); - connect(ui_->pushButtonNetwork0, &QPushButton::clicked, this, &SettingsWindow::on_pushButtonNetwork0_clicked); - connect(ui_->pushButtonNetwork1, &QPushButton::clicked, this, &SettingsWindow::on_pushButtonNetwork1_clicked); - connect(ui_->pushButtonSambaStart, &QPushButton::clicked, - [&]() { system("/usr/local/bin/crankshaft samba start &"); }); - connect(ui_->pushButtonSambaStop, &QPushButton::clicked, - [&]() { system("/usr/local/bin/crankshaft samba stop &"); }); + SettingsWindow::SettingsWindow(configuration::IConfiguration::Pointer configuration, QWidget *parent) + : QWidget(parent), ui_(new Ui::SettingsWindow), configuration_(std::move(configuration)) { + ui_->setupUi(this); + connect(ui_->pushButtonCancel, &QPushButton::clicked, this, &SettingsWindow::close); + connect(ui_->pushButtonSave, &QPushButton::clicked, this, &SettingsWindow::onSave); + connect(ui_->pushButtonUnpair, &QPushButton::clicked, this, &SettingsWindow::unpairAll); + connect(ui_->pushButtonUnpair, &QPushButton::clicked, this, &SettingsWindow::close); + connect(ui_->horizontalSliderScreenDPI, &QSlider::valueChanged, this, &SettingsWindow::onUpdateScreenDPI); + connect(ui_->horizontalSliderAlphaTrans, &QSlider::valueChanged, this, &SettingsWindow::onUpdateAlphaTrans); + connect(ui_->horizontalSliderDay, &QSlider::valueChanged, this, &SettingsWindow::onUpdateBrightnessDay); + connect(ui_->horizontalSliderNight, &QSlider::valueChanged, this, &SettingsWindow::onUpdateBrightnessNight); + connect(ui_->horizontalSliderBrightness1, &QSlider::valueChanged, this, &SettingsWindow::onUpdateBrightness1); + connect(ui_->horizontalSliderBrightness2, &QSlider::valueChanged, this, &SettingsWindow::onUpdateBrightness2); + connect(ui_->horizontalSliderBrightness3, &QSlider::valueChanged, this, &SettingsWindow::onUpdateBrightness3); + connect(ui_->horizontalSliderBrightness4, &QSlider::valueChanged, this, &SettingsWindow::onUpdateBrightness4); + connect(ui_->horizontalSliderBrightness5, &QSlider::valueChanged, this, &SettingsWindow::onUpdateBrightness5); + connect(ui_->horizontalSliderLux1, &QSlider::valueChanged, this, &SettingsWindow::onUpdateLux1); + connect(ui_->horizontalSliderLux2, &QSlider::valueChanged, this, &SettingsWindow::onUpdateLux2); + connect(ui_->horizontalSliderLux3, &QSlider::valueChanged, this, &SettingsWindow::onUpdateLux3); + connect(ui_->horizontalSliderLux4, &QSlider::valueChanged, this, &SettingsWindow::onUpdateLux4); + connect(ui_->horizontalSliderLux5, &QSlider::valueChanged, this, &SettingsWindow::onUpdateLux5); + + connect(ui_->pushButtonClearSelection, &QPushButton::clicked, + std::bind(&SettingsWindow::setButtonCheckBoxes, this, false)); + connect(ui_->pushButtonSelectAll, &QPushButton::clicked, + std::bind(&SettingsWindow::setButtonCheckBoxes, this, true)); + connect(ui_->pushButtonResetToDefaults, &QPushButton::clicked, this, &SettingsWindow::onResetToDefaults); + connect(ui_->horizontalSliderSystemVolume, &QSlider::valueChanged, this, + &SettingsWindow::onUpdateSystemVolume); + connect(ui_->horizontalSliderSystemCapture, &QSlider::valueChanged, this, + &SettingsWindow::onUpdateSystemCapture); + connect(ui_->radioButtonHotspot, &QPushButton::clicked, this, &SettingsWindow::onStartHotspot); + connect(ui_->radioButtonClient, &QPushButton::clicked, this, &SettingsWindow::onStopHotspot); + connect(ui_->pushButtonSetTime, &QPushButton::clicked, this, &SettingsWindow::setTime); + connect(ui_->pushButtonSetTime, &QPushButton::clicked, this, &SettingsWindow::close); + connect(ui_->pushButtonNTP, &QPushButton::clicked, [&]() { system("/usr/local/bin/crankshaft rtc sync &"); }); + connect(ui_->pushButtonNTP, &QPushButton::clicked, this, &SettingsWindow::close); + connect(ui_->pushButtonCheckNow, &QPushButton::clicked, + [&]() { system("/usr/local/bin/crankshaft update check &"); }); + connect(ui_->pushButtonDebuglog, &QPushButton::clicked, this, &SettingsWindow::close); + connect(ui_->pushButtonDebuglog, &QPushButton::clicked, + [&]() { system("/usr/local/bin/crankshaft debuglog &"); }); + connect(ui_->pushButtonNetworkAuto, &QPushButton::clicked, + [&]() { system("/usr/local/bin/crankshaft network auto &"); }); + connect(ui_->pushButtonNetwork0, &QPushButton::clicked, this, &SettingsWindow::on_pushButtonNetwork0_clicked); + connect(ui_->pushButtonNetwork1, &QPushButton::clicked, this, &SettingsWindow::on_pushButtonNetwork1_clicked); + connect(ui_->pushButtonSambaStart, &QPushButton::clicked, + [&]() { system("/usr/local/bin/crankshaft samba start &"); }); + connect(ui_->pushButtonSambaStop, &QPushButton::clicked, + [&]() { system("/usr/local/bin/crankshaft samba stop &"); }); // menu ui_->tab1->show(); @@ -116,10 +111,8 @@ namespace f1x::openauto::autoapp::ui { ui_->tab8->hide(); ui_->tab9->hide(); - ui_->horizontalGroupBox->hide(); - ui_->labelBluetoothAdapterAddress->hide(); - ui_->lineEditExternalBluetoothAdapterAddress->hide(); - ui_->labelTestInProgress->hide(); + + ui_->labelTestInProgress->hide(); connect(ui_->pushButtonTab1, &QPushButton::clicked, this, &SettingsWindow::show_tab1); connect(ui_->pushButtonTab2, &QPushButton::clicked, this, &SettingsWindow::show_tab2); @@ -201,14 +194,105 @@ namespace f1x::openauto::autoapp::ui { delete ui_; } - void SettingsWindow::updateInfo() { - if (ui_->tab6->isVisible() == true) { - updateSystemInfo(); - } - if (ui_->tab5->isVisible() == true) { - updateNetworkInfo(); - } +#ifdef Q_OS_LINUX + void SettingsWindow::populateBluetoothComboBoxLinux(QComboBox *comboBoxBluetooth) { + QList adapters = QBluetoothLocalDevice::allDevices(); + + qDebug() << "Found" << adapters.count() << "Bluetooth adapters:"; + // Iterate over the adapters and print their information. + comboBoxBluetooth->clear(); // Clear existing items + + if (!adapters.isEmpty()) { + for (const QBluetoothHostInfo &adapter: adapters) { + QString adapterAddress = adapter.address().toString(); + comboBoxBluetooth->addItem(QCoreApplication::translate("SettingsWindow", + QString("%1 (%2)").arg(adapter.name()).arg( + adapterAddress).toUtf8().constData()), + QVariant(adapterAddress)); + } + } else { + comboBoxBluetooth->addItem(QCoreApplication::translate("SettingsWindow", "none", nullptr)); + } + } +#endif +#ifdef Q_OS_WIN + void SettingsWindow::populateBluetoothComboBoxWindows(QComboBox *comboBoxBluetooth) { + QProcess process; + process.start("wmic", + QStringList() << "path" << "Win32_PnPEntity" << "where" << "\"PNPDeviceID like '%BTHENUM%'\"" << "get" + << "Name,PNPDeviceID"); + process.waitForFinished(-1); + + QString output = process.readAllStandardOutput(); + QStringList lines = output.split("\n", QString::SkipEmptyParts); + + comboBoxBluetooth->clear(); // Clear existing items + + int index = 0; + for (auto line: lines) { + if (line.contains("BTH", Qt::CaseInsensitive)) { + QStringList parts = line.split(" ", QString::SkipEmptyParts); + if (parts.count() >= 2) { + QString name = parts[0].trimmed(); + QString address = parts[1].trimmed(); // This might not be an address in all cases + comboBoxBluetooth->addItem(QCoreApplication::translate("SettingsWindow", QString("%1 (%2)").arg(name).arg( + address).toUtf8().constData()), QVariant(address)); + index++; } + } + } + + // Optionally, add "none" if no adapters were found + if (index == 0) { + comboBoxBluetooth->addItem(QCoreApplication::translate("SettingsWindow", "none", nullptr)); + } + } +#endif +#ifdef Q_OS_MAC + void SettingsWindow::populateBluetoothComboBoxMac(QComboBox *comboBoxBluetooth) { + BluetoothAdapterLister lister; + QStringList adapters = lister.listAdapters(); + + comboBoxBluetooth->clear(); // Clear existing items + + if (adapters.isEmpty()) { + comboBoxBluetooth->addItem(QCoreApplication::translate("SettingsWindow", "none", nullptr)); + } else { + for (const QString &adapter: adapters) { + QStringList parts = adapter.split(" ("); + if (parts.count() == 2) { + QString name = parts[0]; + QString address = parts[1].left(parts[1].length() - 1); // Remove trailing ')' + comboBoxBluetooth->addItem(QCoreApplication::translate("SettingsWindow", adapter.toUtf8().constData()), + QVariant(address)); + } + } + } + } +#endif + void SettingsWindow::populateBluetoothComboBox(QComboBox *comboBoxBluetooth) { +#ifdef Q_OS_LINUX + populateBluetoothComboBoxLinux(comboBoxBluetooth); +#elif defined Q_OS_WIN + populateBluetoothComboBoxWindows(comboBoxBluetooth); +#elif defined Q_OS_MAC + populateBluetoothComboBoxMac(comboBoxBluetooth); +#else + // Fallback for other platforms +comboBoxBluetooth->clear(); +comboBoxBluetooth->addItem("Test"); +comboBoxBluetooth->addItem(QCoreApplication::translate("SettingsWindow", "none", nullptr)); +#endif + } + + void SettingsWindow::updateInfo() { + if (ui_->tab6->isVisible() == true) { + updateSystemInfo(); + } + if (ui_->tab5->isVisible() == true) { + updateNetworkInfo(); + } + } void SettingsWindow::onSave() { configuration_->setHandednessOfTrafficType( @@ -262,14 +346,11 @@ namespace f1x::openauto::autoapp::ui { ui_->comboBoxBluetooth->currentData().toString().toStdString()); } - configuration_->setMusicAudioChannelEnabled(ui_->checkBoxMusicAudioChannel->isChecked()); - configuration_->setGuidanceAudioChannelEnabled(ui_->checkBoxSpeechAudioChannel->isChecked()); - configuration_->setTelephonyAudioChannelEnabled(ui_->checkBoxVoiceAudioChannel->isChecked()); - configuration_->setAudioOutputBackendType( - ui_->radioButtonRtAudio->isChecked() ? configuration::AudioOutputBackendType::RTAUDIO - : configuration::AudioOutputBackendType::QT); configuration_->setMusicAudioChannelEnabled(ui_->checkBoxMusicAudioChannel->isChecked()); configuration_->setGuidanceAudioChannelEnabled(ui_->checkBoxSpeechAudioChannel->isChecked()); + //configuration_->setTelephonyAudioChannelEnabled(ui_->checkBoxVoiceAudioChannel->isChecked()); + // TODO: Add CheckBox In + configuration_->setTelephonyAudioChannelEnabled(true); configuration_->setAudioOutputBackendType( ui_->radioButtonRtAudio->isChecked() ? configuration::AudioOutputBackendType::RTAUDIO : configuration::AudioOutputBackendType::QT); @@ -541,20 +622,9 @@ namespace f1x::openauto::autoapp::ui { this->loadButtonCheckBoxes(); ui_->checkBoxPlayerControl->setChecked(configuration_->playerButtonControl()); - ui_->radioButtonDisableBluetooth->setChecked( - configuration_->getBluetoothAdapterType() == configuration::BluetoothAdapterType::NONE); - ui_->radioButtonUseLocalBluetoothAdapter->setChecked( - configuration_->getBluetoothAdapterType() == configuration::BluetoothAdapterType::LOCAL); - ui_->radioButtonUseExternalBluetoothAdapter->setChecked( - configuration_->getBluetoothAdapterType() == configuration::BluetoothAdapterType::REMOTE); - ui_->lineEditExternalBluetoothAdapterAddress->setEnabled( - configuration_->getBluetoothAdapterType() == configuration::BluetoothAdapterType::REMOTE); - ui_->lineEditExternalBluetoothAdapterAddress->setText( - QString::fromStdString(configuration_->getBluetoothRemoteAdapterAddress())); - - ui_->checkBoxMusicAudioChannel->setChecked(configuration_->musicAudioChannelEnabled()); - ui_->checkBoxSpeechAudioChannel->setChecked(configuration_->guidanceAudioChannelEnabled()); - ui_->telephonyAudioChannelEnabled->setChecked(configuration_->guidanceAudioChannelEnabled()); + ui_->checkBoxMusicAudioChannel->setChecked(configuration_->musicAudioChannelEnabled()); + ui_->checkBoxSpeechAudioChannel->setChecked(configuration_->guidanceAudioChannelEnabled()); + //ui_->telephonyAudioChannelEnabled->setChecked(configuration_->telephonyAudioChannelEnabled()); const auto &audioOutputBackendType = configuration_->getAudioOutputBackendType(); ui_->radioButtonRtAudio->setChecked(audioOutputBackendType == configuration::AudioOutputBackendType::RTAUDIO); @@ -1094,36 +1164,34 @@ namespace f1x::openauto::autoapp::ui { ui_->checkBoxFlipYUSB->setChecked(false); } - // set bluetooth - if (configuration_->getCSValue("ENABLE_BLUETOOTH") == "1") { - // check external bluetooth enabled - if (configuration_->getCSValue("EXTERNAL_BLUETOOTH") == "1") { - ui_->radioButtonUseExternalBluetoothAdapter->setChecked(true); - } else { - ui_->radioButtonUseLocalBluetoothAdapter->setChecked(true); - } - // mac - //ui_->lineEditExternalBluetoothAdapterAddress->setText(getparams[37]); - } else { - ui_->radioButtonDisableBluetooth->setChecked(true); - ui_->lineEditExternalBluetoothAdapterAddress->setText(""); - } - if (configuration_->getCSValue("ENABLE_PAIRABLE") == "1") { - ui_->checkBoxBluetoothAutoPair->setChecked(true); - } else { - ui_->checkBoxBluetoothAutoPair->setChecked(false); - } - // set bluetooth type - if (configuration_->getCSValue("ENABLE_BLUETOOTH") == "1") { - QString bt = configuration_->getParamFromFile("/boot/config.txt", "dtoverlay=pi3-disable-bt"); - if (bt.contains("pi3-disable-bt")) { - ui_->comboBoxBluetooth->setCurrentText("external"); - } else { - ui_->comboBoxBluetooth->setCurrentText("builtin"); - } - } else { - ui_->comboBoxBluetooth->setCurrentText("none"); - } + if (configuration_->getCSValue("ENABLE_PAIRABLE") == "1") { + ui_->checkBoxBluetoothAutoPair->setChecked(true); + } else { + ui_->checkBoxBluetoothAutoPair->setChecked(false); + } + // set bluetooth type + if (configuration_->getCSValue("ENABLE_BLUETOOTH") == "1") { + QString bt = configuration_->getParamFromFile("/boot/config.txt", "dtoverlay=pi3-disable-bt"); + + QString selectedAddress = QString::fromStdString( + configuration_->getBluetoothAdapterAddress()); //.value("BluetoothAdapterAddress", "none").toString(); + + // Iterate through the items to find the one with the matching data + bool found = false; + for (int i = 0; i < ui_->comboBoxBluetooth->count(); ++i) { + if (ui_->comboBoxBluetooth->itemData(i).toString() == selectedAddress) { + ui_->comboBoxBluetooth->setCurrentIndex(i); + found = true; + break; + } + } + + if (!found) { + ui_->comboBoxBluetooth->setCurrentIndex(ui_->comboBoxBluetooth->findText("none")); + } + } else { + ui_->comboBoxBluetooth->setCurrentText("none"); + } diff --git a/src/autoapp/UI/settingswindow.ui b/src/autoapp/UI/settingswindow.ui index 191f7a9..717018a 100644 --- a/src/autoapp/UI/settingswindow.ui +++ b/src/autoapp/UI/settingswindow.ui @@ -2754,51 +2754,6 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} 2 - - - - true - - - - 0 - 0 - - - - Bluetooth Adapter - - - - 0 - - - 0 - - - - - Disable bluetooth - - - - - - - Use local adapter - - - - - - - Use external adapter - - - - - - @@ -2932,47 +2887,6 @@ outline: none; 0 - - - - - 0 - 0 - - - - - 100 - 0 - - - - Used Address: - - - - - - - - 0 - 0 - - - - - 200 - 0 - - - - - 200 - 16777215 - - - - @@ -8897,21 +8811,6 @@ QComboBox::item:selected { min-height: 32px; } - - - none - - - - - builtin - - - - - external - - From 361e1467b77a7c0291a450f44e3ea6c2185bd1fa Mon Sep 17 00:00:00 2001 From: Simon Dean Date: Wed, 27 Nov 2024 11:27:12 +0000 Subject: [PATCH 12/14] Move remaining Bluetooth Signals to BtService to prevent overlaps. --- .../Projection/LocalBluetoothDevice.hpp | 11 +- .../openauto/autoapp/UI/SettingsWindow.hpp | 12 +- .../btservice/AndroidBluetoothServer.hpp | 51 +++-- .../btservice/AndroidBluetoothService.hpp | 10 +- .../openauto/btservice/BluetoothHandler.hpp | 38 ++++ .../btservice/IAndroidBluetoothServer.hpp | 12 +- .../btservice/IAndroidBluetoothService.hpp | 10 +- .../openauto/btservice/IBluetoothHandler.hpp | 24 ++ .../Projection/DummyBluetoothDevice.cpp | 7 +- .../Projection/LocalBluetoothDevice.cpp | 146 ++----------- src/autoapp/Service/ServiceFactory.cpp | 2 - src/autoapp/UI/MainWindow.cpp | 2 +- src/btservice/AndroidBluetoothServer.cpp | 206 +++++++++++++----- src/btservice/BluetoothHandler.cpp | 85 ++++++++ src/btservice/btservice.cpp | 36 +-- 15 files changed, 373 insertions(+), 279 deletions(-) create mode 100644 include/f1x/openauto/btservice/BluetoothHandler.hpp create mode 100644 include/f1x/openauto/btservice/IBluetoothHandler.hpp create mode 100644 src/btservice/BluetoothHandler.cpp diff --git a/include/f1x/openauto/autoapp/Projection/LocalBluetoothDevice.hpp b/include/f1x/openauto/autoapp/Projection/LocalBluetoothDevice.hpp index 73ec688..f261228 100644 --- a/include/f1x/openauto/autoapp/Projection/LocalBluetoothDevice.hpp +++ b/include/f1x/openauto/autoapp/Projection/LocalBluetoothDevice.hpp @@ -38,17 +38,8 @@ public: std::string getAdapterAddress() const override; bool isAvailable() const override; -signals: - void startPairing(const QString& address, PairingPromise::Pointer promise); - private slots: - void createBluetoothLocalDevice(); - void onStartPairing(const QString& address, PairingPromise::Pointer promise); - void onPairingDisplayConfirmation(const QBluetoothAddress &address, QString pin); - void onPairingDisplayPinCode(const QBluetoothAddress &address, QString pin); - void onPairingFinished(const QBluetoothAddress &address, QBluetoothLocalDevice::Pairing pairing); - void onError(QBluetoothLocalDevice::Error error); - void onHostModeStateChanged(QBluetoothLocalDevice::HostMode state); + void createBluetoothLocalDevice(const QString &adapterAddress); private: mutable std::mutex mutex_; diff --git a/include/f1x/openauto/autoapp/UI/SettingsWindow.hpp b/include/f1x/openauto/autoapp/UI/SettingsWindow.hpp index bedaad4..6aa3d20 100644 --- a/include/f1x/openauto/autoapp/UI/SettingsWindow.hpp +++ b/include/f1x/openauto/autoapp/UI/SettingsWindow.hpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #ifdef MAC_OS #else @@ -98,7 +99,16 @@ private: void saveButtonCheckBoxes(); void saveButtonCheckBox(const QCheckBox* checkBox, configuration::IConfiguration::ButtonCodes& buttonCodes, aap_protobuf::service::media::sink::message::KeyCode buttonCode); void setButtonCheckBoxes(bool value); - +#ifdef Q_OS_LINUX + void populateBluetoothComboBoxLinux(QComboBox *comboBoxBluetooth); +#endif +#ifdef Q_OS_WIN + void populateBluetoothComboBoxWindows(QComboBox *comboBoxBluetooth); +#endif +#ifdef Q_OS_MAC + void populateBluetoothComboBoxMac(QComboBox *comboBoxBluetooth); +#endif + void populateBluetoothComboBox(QComboBox *comboBoxBluetooth); Ui::SettingsWindow* ui_; configuration::IConfiguration::Pointer configuration_; diff --git a/include/f1x/openauto/btservice/AndroidBluetoothServer.hpp b/include/f1x/openauto/btservice/AndroidBluetoothServer.hpp index 24b4f7f..72c9815 100644 --- a/include/f1x/openauto/btservice/AndroidBluetoothServer.hpp +++ b/include/f1x/openauto/btservice/AndroidBluetoothServer.hpp @@ -33,47 +33,46 @@ #include #include -namespace f1x { - namespace openauto { - namespace btservice { - class AndroidBluetoothServer : public QObject, public IAndroidBluetoothServer { - Q_OBJECT +namespace f1x::openauto::btservice { - public: - AndroidBluetoothServer(autoapp::configuration::IConfiguration::Pointer configuration); + class AndroidBluetoothServer : public QObject, public IAndroidBluetoothServer { + Q_OBJECT - uint16_t start(const QBluetoothAddress &address) override; + public: + AndroidBluetoothServer(autoapp::configuration::IConfiguration::Pointer configuration); - private slots: + uint16_t start(const QBluetoothAddress &address) override; - void onClientConnected(); + private slots: - private: - std::unique_ptr rfcommServer_; - QBluetoothSocket *socket = nullptr; - autoapp::configuration::IConfiguration::Pointer configuration_; + void onClientConnected(); - void readSocket(); + private: + std::unique_ptr rfcommServer_; + QBluetoothSocket *socket = nullptr; + autoapp::configuration::IConfiguration::Pointer configuration_; - QByteArray buffer; + void readSocket(); - void handleWifiInfoRequest(QByteArray &buffer, uint16_t length); + QByteArray buffer; - void handleWifiVersionResponse(QByteArray &buffer, uint16_t length); + void handleWifiInfoRequest(QByteArray &buffer, uint16_t length); - void handleWifiConnectionStatus(QByteArray &buffer, uint16_t length); + void handleWifiVersionResponse(QByteArray &buffer, uint16_t length); - void handleWifiStartResponse(QByteArray &buffer, uint16_t length); + void handleWifiConnectionStatus(QByteArray &buffer, uint16_t length); - void sendMessage(const google::protobuf::Message &message, uint16_t type); + void handleWifiStartResponse(QByteArray &buffer, uint16_t length); + + void sendMessage(const google::protobuf::Message &message, uint16_t type); - const ::std::string getIP4_(const QString intf); + const ::std::string getIP4_(const QString intf); - void DecodeProtoMessage(const std::string &proto_data); - }; + void DecodeProtoMessage(const std::string &proto_data); + }; - } - } } + + diff --git a/include/f1x/openauto/btservice/AndroidBluetoothService.hpp b/include/f1x/openauto/btservice/AndroidBluetoothService.hpp index ebbb860..64e0abb 100644 --- a/include/f1x/openauto/btservice/AndroidBluetoothService.hpp +++ b/include/f1x/openauto/btservice/AndroidBluetoothService.hpp @@ -21,11 +21,7 @@ #include #include -namespace f1x -{ -namespace openauto -{ -namespace btservice +namespace f1x::openauto::btservice { class AndroidBluetoothService: public IAndroidBluetoothService @@ -41,5 +37,5 @@ private: }; } -} -} + + diff --git a/include/f1x/openauto/btservice/BluetoothHandler.hpp b/include/f1x/openauto/btservice/BluetoothHandler.hpp new file mode 100644 index 0000000..236b461 --- /dev/null +++ b/include/f1x/openauto/btservice/BluetoothHandler.hpp @@ -0,0 +1,38 @@ +// +// Created by Simon Dean on 26/11/2024. +// + +#ifndef OPENAUTO_BLUETOOTHHANDLER_HPP +#define OPENAUTO_BLUETOOTHHANDLER_HPP + +#include +#include +#include + + +namespace f1x::openauto::btservice { + + class BluetoothHandler : public QObject, public IBluetoothHandler { + Q_OBJECT + public: + BluetoothHandler(autoapp::configuration::IConfiguration::Pointer configuration); + + private slots: + void onPairingDisplayPinCode(const QBluetoothAddress &address, QString pin); + + void onPairingDisplayConfirmation(const QBluetoothAddress &address, QString pin); + + void onPairingFinished(const QBluetoothAddress &address, QBluetoothLocalDevice::Pairing pairing); + + void onError(QBluetoothLocalDevice::Error error); + + void onHostModeStateChanged(QBluetoothLocalDevice::HostMode state); + + private: + std::unique_ptr localDevice_; + autoapp::configuration::IConfiguration::Pointer configuration_; + }; +} + + +#endif //OPENAUTO_BLUETOOTHHANDLER_HPP diff --git a/include/f1x/openauto/btservice/IAndroidBluetoothServer.hpp b/include/f1x/openauto/btservice/IAndroidBluetoothServer.hpp index c798567..d626bea 100644 --- a/include/f1x/openauto/btservice/IAndroidBluetoothServer.hpp +++ b/include/f1x/openauto/btservice/IAndroidBluetoothServer.hpp @@ -20,11 +20,9 @@ #include -namespace f1x -{ -namespace openauto -{ -namespace btservice + + +namespace f1x::openauto::btservice { class IAndroidBluetoothServer @@ -36,5 +34,5 @@ public: }; } -} -} + + diff --git a/include/f1x/openauto/btservice/IAndroidBluetoothService.hpp b/include/f1x/openauto/btservice/IAndroidBluetoothService.hpp index 71352c9..0868d83 100644 --- a/include/f1x/openauto/btservice/IAndroidBluetoothService.hpp +++ b/include/f1x/openauto/btservice/IAndroidBluetoothService.hpp @@ -20,11 +20,7 @@ #include -namespace f1x -{ -namespace openauto -{ -namespace btservice +namespace f1x::openauto::btservice { class IAndroidBluetoothService @@ -37,5 +33,5 @@ public: }; } -} -} + + diff --git a/include/f1x/openauto/btservice/IBluetoothHandler.hpp b/include/f1x/openauto/btservice/IBluetoothHandler.hpp new file mode 100644 index 0000000..d3430c7 --- /dev/null +++ b/include/f1x/openauto/btservice/IBluetoothHandler.hpp @@ -0,0 +1,24 @@ +// +// Created by Simon Dean on 26/11/2024. +// + +#ifndef OPENAUTO_IBLUETOOTHHANDLER_HPP +#define OPENAUTO_IBLUETOOTHHANDLER_HPP + +#include +#include + +namespace f1x::openauto::btservice { + + class IBluetoothHandler + { + public: + virtual ~IBluetoothHandler() = default; + + }; + +} + + + +#endif //OPENAUTO_IBLUETOOTHHANDLER_HPP diff --git a/src/autoapp/Projection/DummyBluetoothDevice.cpp b/src/autoapp/Projection/DummyBluetoothDevice.cpp index 4147683..10a54c3 100644 --- a/src/autoapp/Projection/DummyBluetoothDevice.cpp +++ b/src/autoapp/Projection/DummyBluetoothDevice.cpp @@ -34,12 +34,7 @@ bool DummyBluetoothDevice::isPaired(const std::string&) const return false; } -void DummyBluetoothDevice::pair(const std::string&, PairingPromise::Pointer promise) -{ - promise->reject(); -} - -std::string DummyBluetoothDevice::getLocalAddress() const +std::string DummyBluetoothDevice::getAdapterAddress() const { return ""; } diff --git a/src/autoapp/Projection/LocalBluetoothDevice.cpp b/src/autoapp/Projection/LocalBluetoothDevice.cpp index 5d3be0b..aebc8bd 100644 --- a/src/autoapp/Projection/LocalBluetoothDevice.cpp +++ b/src/autoapp/Projection/LocalBluetoothDevice.cpp @@ -19,159 +19,53 @@ #include #include #include -#include #include namespace f1x::openauto::autoapp::projection { -LocalBluetoothDevice::LocalBluetoothDevice() -{ + LocalBluetoothDevice::LocalBluetoothDevice(const QString &adapterAddress, QObject *parent) : QObject(parent) { qRegisterMetaType("PairingPromise::Pointer"); this->moveToThread(QApplication::instance()->thread()); - connect(this, &LocalBluetoothDevice::startPairing, this, &LocalBluetoothDevice::onStartPairing, Qt::QueuedConnection); - QMetaObject::invokeMethod(this, "createBluetoothLocalDevice", Qt::BlockingQueuedConnection); -} -void LocalBluetoothDevice::createBluetoothLocalDevice() -{ + QMetaObject::invokeMethod(this, "createBluetoothLocalDevice", Qt::BlockingQueuedConnection, + Q_ARG(QString, adapterAddress)); + + } + + void LocalBluetoothDevice::createBluetoothLocalDevice(const QString &adapterAddress) { OPENAUTO_LOG(info) << "[LocalBluetoothDevice] create."; - localDevice_ = std::make_unique(QBluetoothAddress()); - connect(localDevice_.get(), &QBluetoothLocalDevice::pairingDisplayConfirmation, this, &LocalBluetoothDevice::onPairingDisplayConfirmation); - connect(localDevice_.get(), &QBluetoothLocalDevice::pairingDisplayPinCode, this, &LocalBluetoothDevice::onPairingDisplayPinCode); - connect(localDevice_.get(), &QBluetoothLocalDevice::pairingFinished, this, &LocalBluetoothDevice::onPairingFinished); - connect(localDevice_.get(), &QBluetoothLocalDevice::error, this, &LocalBluetoothDevice::onError); - connect(localDevice_.get(), &QBluetoothLocalDevice::hostModeStateChanged, this, &LocalBluetoothDevice::onHostModeStateChanged); + QBluetoothAddress address(adapterAddress); + localDevice_ = std::make_unique(address); - localDevice_->powerOn(); - localDevice_->setHostMode(QBluetoothLocalDevice::HostDiscoverable); + // Pairing signals are being handled by btservice -} + } -void LocalBluetoothDevice::stop() -{ + void LocalBluetoothDevice::stop() { std::lock_guard lock(mutex_); - if(pairingPromise_ != nullptr) - { - pairingPromise_->reject(); - pairingPromise_.reset(); - pairingAddress_ = QBluetoothAddress(); - } -} + } -bool LocalBluetoothDevice::isPaired(const std::string& address) const -{ + bool LocalBluetoothDevice::isPaired(const std::string &address) const { std::lock_guard lock(mutex_); - return localDevice_->pairingStatus(QBluetoothAddress(QString::fromStdString(address))) != QBluetoothLocalDevice::Unpaired; -} - -void LocalBluetoothDevice::pair(const std::string& address, PairingPromise::Pointer promise) -{ - emit startPairing(QString::fromStdString(address), std::move(promise)); -} + return localDevice_->pairingStatus(QBluetoothAddress(QString::fromStdString(address))) != + QBluetoothLocalDevice::Unpaired; + } std::string LocalBluetoothDevice::getAdapterAddress() const { std::lock_guard lock(mutex_); return localDevice_->isValid() ? localDevice_->address().toString().toStdString() : ""; -} + } -bool LocalBluetoothDevice::isAvailable() const -{ + bool LocalBluetoothDevice::isAvailable() const { std::lock_guard lock(mutex_); return localDevice_->isValid(); + } } -void LocalBluetoothDevice::onStartPairing(const QString& address, PairingPromise::Pointer promise) -{ - OPENAUTO_LOG(debug) << "[LocalBluetoothDevice] onStartPairing, address: " << address.toStdString(); - std::lock_guard lock(mutex_); - - if(!localDevice_->isValid()) - { - promise->reject(); - } - else - { - if(pairingPromise_ != nullptr) - { - pairingPromise_->reject(); - } - - pairingAddress_ = QBluetoothAddress(address); - pairingPromise_ = std::move(promise); - localDevice_->requestPairing(pairingAddress_, QBluetoothLocalDevice::AuthorizedPaired); - } -} - -void LocalBluetoothDevice::onPairingDisplayConfirmation(const QBluetoothAddress &address, QString pin) -{ - OPENAUTO_LOG(info) << "[LocalBluetoothDevice] onPairingDisplayConfirmation, address: " << address.toString().toStdString() - << ", pin: " << pin.toStdString(); - - std::lock_guard lock(mutex_); - localDevice_->pairingConfirmation(address == pairingAddress_); -} - -void LocalBluetoothDevice::onPairingDisplayPinCode(const QBluetoothAddress &address, QString pin) -{ - OPENAUTO_LOG(info) << "[LocalBluetoothDevice] onPairingDisplayPinCode, address: " << address.toString().toStdString() - << ", pin: " << pin.toStdString(); - - std::lock_guard lock(mutex_); - localDevice_->pairingConfirmation(address == pairingAddress_); -} - -void LocalBluetoothDevice::onPairingFinished(const QBluetoothAddress &address, QBluetoothLocalDevice::Pairing pairing) -{ - OPENAUTO_LOG(info) << "[LocalBluetoothDevice] onPairingDisplayPinCode, address: " << address.toString().toStdString() - << ", pin: " << pairing; - - std::lock_guard lock(mutex_); - - if(address == pairingAddress_) - { - if(pairing != QBluetoothLocalDevice::Unpaired) - { - pairingPromise_->resolve(); - } - else - { - pairingPromise_->reject(); - } - - pairingPromise_.reset(); - pairingAddress_ = QBluetoothAddress(); - } -} - -void LocalBluetoothDevice::onError(QBluetoothLocalDevice::Error error) -{ - OPENAUTO_LOG(warning) << "[LocalBluetoothDevice] onError, error: " << error; - - std::lock_guard lock(mutex_); - - if(pairingPromise_ != nullptr) - { - pairingPromise_->reject(); - pairingPromise_.reset(); - pairingAddress_ = QBluetoothAddress(); - } -} - -void LocalBluetoothDevice::onHostModeStateChanged(QBluetoothLocalDevice::HostMode state) -{ - std::lock_guard lock(mutex_); - - if(state == QBluetoothLocalDevice::HostPoweredOff && pairingPromise_ != nullptr) - { - pairingPromise_->reject(); - pairingPromise_.reset(); - pairingAddress_ = QBluetoothAddress(); - } -} diff --git a/src/autoapp/Service/ServiceFactory.cpp b/src/autoapp/Service/ServiceFactory.cpp index 693be0d..f4638e8 100644 --- a/src/autoapp/Service/ServiceFactory.cpp +++ b/src/autoapp/Service/ServiceFactory.cpp @@ -38,7 +38,6 @@ #include #include #include - #include #include #include @@ -46,7 +45,6 @@ #include #include #include -#include #include namespace f1x::openauto::autoapp::service { diff --git a/src/autoapp/UI/MainWindow.cpp b/src/autoapp/UI/MainWindow.cpp index 7a3166c..f9ab78d 100644 --- a/src/autoapp/UI/MainWindow.cpp +++ b/src/autoapp/UI/MainWindow.cpp @@ -2163,7 +2163,7 @@ void f1x::openauto::autoapp::ui::MainWindow::tmpChanged() ui_->devlabel_right->show(); } } - } + // } if (std::ifstream("/tmp/btdevice") || std::ifstream("/tmp/media_playing") || std::ifstream("/tmp/dev_mode_enabled") || std::ifstream("/tmp/android_device")) { if (ui_->labelLock->isVisible() == false) { diff --git a/src/btservice/AndroidBluetoothServer.cpp b/src/btservice/AndroidBluetoothServer.cpp index 26c45f9..8a66cb6 100644 --- a/src/btservice/AndroidBluetoothServer.cpp +++ b/src/btservice/AndroidBluetoothServer.cpp @@ -16,6 +16,7 @@ * along with openauto. If not, see . */ + #include #include #include @@ -23,7 +24,15 @@ #include #include #include +#include +#include +#include +#include +using namespace google::protobuf; +using namespace google::protobuf::io; + +// 39171FDJG002WHhandleWifiVersionRequest namespace f1x::openauto::btservice { @@ -34,14 +43,18 @@ namespace f1x::openauto::btservice { &AndroidBluetoothServer::onClientConnected); } + /// Start Server listening on Address uint16_t AndroidBluetoothServer::start(const QBluetoothAddress &address) { + OPENAUTO_LOG(debug) << "[AndroidBluetoothServer] start()"; if (rfcommServer_->listen(address)) { return rfcommServer_->serverPort(); } return 0; } + /// Call-Back for when Client Connected void AndroidBluetoothServer::onClientConnected() { + OPENAUTO_LOG(debug) << "[AndroidBluetoothServer] onClientConnected()"; if (socket != nullptr) { socket->deleteLater(); } @@ -49,31 +62,31 @@ namespace f1x::openauto::btservice { socket = rfcommServer_->nextPendingConnection(); if (socket != nullptr) { - OPENAUTO_LOG(info) << "[AndroidBluetoothServer] rfcomm client connected, peer name: " + OPENAUTO_LOG(debug) << "[AndroidBluetoothServer] rfcomm client connected, peer name: " << socket->peerName().toStdString(); connect(socket, &QBluetoothSocket::readyRead, this, &AndroidBluetoothServer::readSocket); - aap_protobuf::service::wifiprojection::message::WifiCredentialsRequest request; - // TODO: How do we ping back the Wireless Port and IP? - //aap_protobuf::service::::WifiInfoRequest request; - request.set_ip_address(getIP4_("wlan0")); - getIP4_() - //request.set_port(5000); + aap_protobuf::aaw::WifiVersionRequest versionRequest; + aap_protobuf::aaw::WifiStartRequest startRequest; + startRequest.set_ip_address(getIP4_("wlan0")); + startRequest.set_port(5000); - sendMessage(request, 1); + sendMessage(versionRequest, aap_protobuf::aaw::MessageId::WIFI_VERSION_REQUEST); + sendMessage(startRequest, aap_protobuf::aaw::MessageId::WIFI_START_REQUEST); } else { OPENAUTO_LOG(error) << "[AndroidBluetoothServer] received null socket during client connection."; } } + /// Read data from Bluetooth Socket void AndroidBluetoothServer::readSocket() { buffer += socket->readAll(); - OPENAUTO_LOG(info) << "Received message"; + OPENAUTO_LOG(debug) << "[AndroidBluetoothServer::readSocket] Reading from socket."; if (buffer.length() < 4) { - OPENAUTO_LOG(debug) << "Not enough data, waiting for more"; + OPENAUTO_LOG(debug) << "[AndroidBluetoothServer::readSocket] Not enough data, waiting for more."; return; } @@ -82,66 +95,112 @@ namespace f1x::openauto::btservice { stream >> length; if (buffer.length() < length + 4) { - OPENAUTO_LOG(info) << "Not enough data, waiting for more: " << buffer.length(); + OPENAUTO_LOG(debug) << "[AndroidBluetoothServer::readSocket] Not enough data, waiting for more: " << buffer.length(); return; } - aap_protobuf::service::wifiprojection::WifiProjectionMessageId messageId; - //uint16_t messageId; - stream >> messageId; + quint16 rawMessageId; + stream >> rawMessageId; - //OPENAUTO_LOG(info) << "[AndroidBluetoothServer] " << length << " " << messageId; - OPENAUTO_LOG(debug) << messageId; + aap_protobuf::aaw::MessageId messageId; + messageId = static_cast(rawMessageId); + + OPENAUTO_LOG(debug) << "[AndroidBluetoothServer::readSocket] Message length: " << length << " MessageId: " << messageId; + + switch (messageId) { + + case aap_protobuf::aaw::MessageId::WIFI_INFO_REQUEST: // WifiInfoRequest - Respond with a WifiInfoResponse + handleWifiInfoRequest(buffer, length); + break; + case aap_protobuf::aaw::MessageId::WIFI_VERSION_RESPONSE: // WifiVersionRequest - Send a Version Request + handleWifiVersionResponse(buffer, length);// do something + break; + case aap_protobuf::aaw::MessageId::WIFI_CONNECTION_STATUS: // WifiStartResponse - Receive a confirmation + handleWifiConnectionStatus(buffer, length); + break; + case aap_protobuf::aaw::MessageId::WIFI_START_RESPONSE: // WifiStartResponse - Receive a confirmation + handleWifiStartResponse(buffer, length); + break; + case aap_protobuf::aaw::MessageId::WIFI_START_REQUEST: // These are not received from the MD. + case aap_protobuf::aaw::MessageId::WIFI_INFO_RESPONSE: // These are not received from the MD. + case aap_protobuf::aaw::MessageId::WIFI_VERSION_REQUEST: // These are not received from the MD. + default: + QByteArray messageData = buffer.mid(stream.device()->pos(), length - 2); + + // Convert QByteArray to std::string + std::string protoData = messageData.toStdString(); + + // Pass it to your function + this->DecodeProtoMessage(protoData); std::stringstream ss; ss << std::hex << std::setfill('0'); for (auto &&val: buffer) { ss << std::setw(2) << static_cast(val); } - OPENAUTO_LOG(info) << "Unknown message: " << messageId; - OPENAUTO_LOG(info) << ss.str(); + OPENAUTO_LOG(debug) << "[AndroidBluetoothServer::readSocket] Unknown message: " << messageId; + OPENAUTO_LOG(debug) << "[AndroidBluetoothServer::readSocket] Data " << ss.str(); + + break; + } buffer = buffer.mid(length + 4); } + /// Handles request for WifiInfoRequest by sending a WifiInfoResponse + /// \param buffer + /// \param length void AndroidBluetoothServer::handleWifiInfoRequest(QByteArray &buffer, uint16_t length) { - aap_protobuf::service::wifiprojection::message::WifiCredentialsRequest msg; - msg.ParseFromArray(buffer.data() + 4, length); - OPENAUTO_LOG(info) << "WifiInfoRequest: " << msg.DebugString(); + OPENAUTO_LOG(info) << "[AndroidBluetoothServer::handleWifiInfoRequest] Handling wifi info request"; - aap_protobuf::service::wifiprojection::message::WifiCredentialsResponse response; + aap_protobuf::aaw::WifiInfoResponse response; - //response.set_ip_address(getIP4_("wlan0")); - //response.set_port(5000); - //response.set_status(aap_protobuf::service::control::WifiInfoResponse_Status_STATUS_SUCCESS); - - sendMessage(response, 7); - } - - void AndroidBluetoothServer::handleWifiSecurityRequest(QByteArray &buffer, uint16_t length) { - OPENAUTO_LOG(info) << "[AndroidBluetoothServer] WifiSecurityRequest:"; - aap_protobuf::service::wifiprojection::message::WifiCredentialsResponse response; - - response.set_car_wifi_security_mode( - aap_protobuf::service::wifiprojection::message::WifiSecurityMode::WPA2_PERSONAL); - response.set_car_wifi_ssid(configuration_->getParamFromFile("/etc/hostapd/hostapd.conf", "ssid").toStdString()); - response.set_car_wifi_password( + response.set_ssid(configuration_->getParamFromFile("/etc/hostapd/hostapd.conf", "ssid").toStdString()); + response.set_password( configuration_->getParamFromFile("/etc/hostapd/hostapd.conf", "wpa_passphrase").toStdString()); + response.set_bssid(QNetworkInterface::interfaceFromName("wlan0").hardwareAddress().toStdString()); + response.set_security_mode( + aap_protobuf::service::wifiprojection::message::WifiSecurityMode::WPA2_PERSONAL); response.set_access_point_type(aap_protobuf::service::wifiprojection::message::AccessPointType::STATIC); - response.add_supported_wifi_channels(1); - - - //response.set_ssid(configuration_->getParamFromFile("/etc/hostapd/hostapd.conf","ssid").toStdString()); - //response.set_bssid(QNetworkInterface::interfaceFromName("wlan0").hardwareAddress().toStdString()); - //response.set_key(configuration_->getParamFromFile("/etc/hostapd/hostapd.conf","wpa_passphrase").toStdString()); - //response.set_security_mode(aap_protobuf::messages::WifiSecurityReponse_SecurityMode_WPA2_PERSONAL); - //response.set_access_point_type(aap_protobuf::messages::WifiSecurityReponse_AccessPointType_STATIC); sendMessage(response, 3); } + /// Listens for a WifiVersionResponse from the MD - usually just a notification + /// \param buffer + /// \param length + void AndroidBluetoothServer::handleWifiVersionResponse(QByteArray &buffer, uint16_t length) { + OPENAUTO_LOG(info) << "[AndroidBluetoothServer::handleWifiVersionResponse] Handling wifi version response"; + + aap_protobuf::aaw::WifiVersionResponse response; + response.ParseFromArray(buffer.data() + 4, length); + OPENAUTO_LOG(debug) << "[AndroidBluetoothServer::handleWifiVersionResponse] Unknown Param 1: " << response.unknown_value_a() << " Unknown Param 2: " << response.unknown_value_b(); + } + + /// Listens for WifiStartResponse from MD - usually just a notification with a status + /// \param buffer + /// \param length + void AndroidBluetoothServer::handleWifiStartResponse(QByteArray &buffer, uint16_t length) { + OPENAUTO_LOG(info) << "[AndroidBluetoothServer::handleWifiStartResponse] Handling wifi start response"; + + aap_protobuf::aaw::WifiStartResponse response; + response.ParseFromArray(buffer.data() + 4, length); + OPENAUTO_LOG(debug) << "[AndroidBluetoothServer::handleWifiStartResponse] " << response.ip_address() << " port " << response.port() << " status " << Status_Name(response.status()); + } + + /// Handles request for WifiStartRequest by sending a WifiStartResponse + /// \param buffer + /// \param length + void AndroidBluetoothServer::handleWifiConnectionStatus(QByteArray &buffer, uint16_t length) { + aap_protobuf::aaw::WifiConnectionStatus status; + status.ParseFromArray(buffer.data() + 4, length); + OPENAUTO_LOG(info) << "[AndroidBluetoothServer::handleWifiConnectionStatus] Handle wifi connection status, received: " << Status_Name(status.status()); + } + void AndroidBluetoothServer::sendMessage(const google::protobuf::Message &message, uint16_t type) { - int byteSize = message.ByteSize(); + OPENAUTO_LOG(info) << "[AndroidBluetoothServer::sendMessage] Sending message to connected device"; + + int byteSize = message.ByteSizeLong(); QByteArray out(byteSize + 4, 0); QDataStream ds(&out, QIODevice::ReadWrite); ds << (uint16_t) byteSize; @@ -153,24 +212,17 @@ namespace f1x::openauto::btservice { for (auto &&val: out) { ss << std::setw(2) << static_cast(val); } - //OPENAUTO_LOG(info) << "Writing message: " << ss.str(); + OPENAUTO_LOG(debug) << message.GetTypeName() << " - " + message.DebugString(); auto written = socket->write(out); if (written > -1) { - OPENAUTO_LOG(info) << "Bytes written: " << written; + OPENAUTO_LOG(debug) << "[AndroidBluetoothServer::sendMessage] Bytes written: " << written; } else { - OPENAUTO_LOG(info) << "Could not write data"; + OPENAUTO_LOG(debug) << "[AndroidBluetoothServer::sendMessage] Could not write data"; } } - void AndroidBluetoothServer::handleWifiInfoRequestResponse(QByteArray &buffer, uint16_t length) { - OPENAUTO_LOG(info) << "[AndroidBluetoothServer] WifiInfoRequestResponse"; - aap_protobuf::service::wifiprojection::message::WifiCredentialsResponse msg; - msg.ParseFromArray(buffer.data() + 4, length); - OPENAUTO_LOG(info) << "WifiInfoResponse: " << msg.DebugString(); - } - const ::std::string AndroidBluetoothServer::getIP4_(const QString intf) { for (const QNetworkAddressEntry &address: QNetworkInterface::interfaceFromName(intf).addressEntries()) { if (address.ip().protocol() == QAbstractSocket::IPv4Protocol) @@ -178,5 +230,47 @@ namespace f1x::openauto::btservice { } return ""; } + + /// Decode Proto Messages to their constituent components + /// \param proto_data + void AndroidBluetoothServer::DecodeProtoMessage(const std::string& proto_data) { + UnknownFieldSet set; + + // Create streams + ArrayInputStream raw_input(proto_data.data(), proto_data.size()); + CodedInputStream input(&raw_input); + + // Decode the message + if (!set.MergeFromCodedStream(&input)) { + std::cerr << "Failed to decode the message." << std::endl; + return; + } + + // Iterate over the fields + for (int i = 0; i < set.field_count(); ++i) { + const UnknownField& field = set.field(i); + switch (field.type()) { + case UnknownField::TYPE_VARINT: + std::cout << "Field number " << field.number() << " is a varint: " << field.varint() << std::endl; + break; + case UnknownField::TYPE_FIXED32: + std::cout << "Field number " << field.number() << " is a fixed32: " << field.fixed32() << std::endl; + break; + case UnknownField::TYPE_FIXED64: + std::cout << "Field number " << field.number() << " is a fixed64: " << field.fixed64() << std::endl; + break; + case UnknownField::TYPE_LENGTH_DELIMITED: + std::cout << "Field number " << field.number() << " is length-delimited: "; + for (char ch : field.length_delimited()) { + std::cout << std::hex << (int)(unsigned char)ch; + } + std::cout << std::dec << std::endl; + break; + case UnknownField::TYPE_GROUP: // Deprecated in modern Protobuf + std::cout << "Field number " << field.number() << " is a group." << std::endl; + break; + } + } + } } diff --git a/src/btservice/BluetoothHandler.cpp b/src/btservice/BluetoothHandler.cpp new file mode 100644 index 0000000..40daafa --- /dev/null +++ b/src/btservice/BluetoothHandler.cpp @@ -0,0 +1,85 @@ +// +// Created by Simon Dean on 26/11/2024. +// + +#include +#include +#include +#include + +namespace f1x::openauto::btservice { + BluetoothHandler::BluetoothHandler(autoapp::configuration::IConfiguration::Pointer configuration) + : configuration_(std::move(configuration)) { + + OPENAUTO_LOG(info) << "[BluetoothHandler::BluetoothHandler] Starting Up..."; + + QString adapterAddress = QString::fromStdString(configuration_->getBluetoothAdapterAddress()); + QBluetoothAddress address(adapterAddress); + localDevice_ = std::make_unique(QBluetoothAddress()); + + if (!localDevice_->isValid()) { + OPENAUTO_LOG(error) << "[BluetoothHandler] Bluetooth adapter is not valid."; + } else { + OPENAUTO_LOG(info) << "[BluetoothHandler] Bluetooth adapter is valid."; + } + + QObject::connect(localDevice_.get(), &QBluetoothLocalDevice::pairingDisplayPinCode, this, &BluetoothHandler::onPairingDisplayPinCode); + QObject::connect(localDevice_.get(), &QBluetoothLocalDevice::pairingDisplayConfirmation, this, &BluetoothHandler::onPairingDisplayConfirmation); + QObject::connect(localDevice_.get(), &QBluetoothLocalDevice::pairingFinished, this, &BluetoothHandler::onPairingFinished); + QObject::connect(localDevice_.get(), &QBluetoothLocalDevice::hostModeStateChanged, this, &BluetoothHandler::onHostModeStateChanged); + QObject::connect(localDevice_.get(), &QBluetoothLocalDevice::error, this, &BluetoothHandler::onError); + + // Turn Bluetooth on + localDevice_->powerOn(); + + // Make it visible to others + localDevice_->setHostMode(QBluetoothLocalDevice::HostDiscoverable); + + btservice::AndroidBluetoothServer androidBluetoothServer(configuration_); + uint16_t portNumber = androidBluetoothServer.start(address); + + if (portNumber == 0) { + OPENAUTO_LOG(error) << "[BluetoothHandler::BluetoothHandler] Server start failed."; + throw std::runtime_error("Unable to start bluetooth server"); + } + + OPENAUTO_LOG(info) << "[BluetoothHandler::BluetoothHandler] Listening for connections, address: " << address.toString().toStdString() + << ", port: " << portNumber; + + btservice::AndroidBluetoothService androidBluetoothService(portNumber); + if (!androidBluetoothService.registerService(address)) { + OPENAUTO_LOG(error) << "[BluetoothHandler::BluetoothHandler] Service registration failed."; + throw std::runtime_error("Unable to register btservice"); + } else { + OPENAUTO_LOG(info) << "[BluetoothHandler::BluetoothHandler] Service registered, port: " << portNumber; + } + + androidBluetoothService.unregisterService(); + } + + void BluetoothHandler::onPairingDisplayPinCode(const QBluetoothAddress &address, QString pin) { + OPENAUTO_LOG(debug) << "[BluetoothHandler::onPairingDisplayPinCode] Pairing display PIN code: " << pin.toStdString(); + } + + void BluetoothHandler::onPairingDisplayConfirmation(const QBluetoothAddress &address, QString pin) { + OPENAUTO_LOG(debug) << "[BluetoothHandler::onPairingDisplayConfirmation] Pairing display confirmation: " << pin.toStdString(); + + // Here you can implement logic to show this PIN to the user or automatically accept if you trust all devices + localDevice_->pairingConfirmation(true); // Confirm pairing (for security, you might want to verify the PIN) + } + + void BluetoothHandler::onPairingFinished(const QBluetoothAddress &address, QBluetoothLocalDevice::Pairing pairing) { + OPENAUTO_LOG(info) << "[BluetoothHandler::onPairingFinished] pairingFinished, address: " << address.toString().toStdString() + << ", pairing: " << pairing; + } + + void BluetoothHandler::onError(QBluetoothLocalDevice::Error error) { + OPENAUTO_LOG(warning) << "[BluetoothHandler::onError] Bluetooth error: " << error; + // ... your logic to handle the error ... + } + + void BluetoothHandler::onHostModeStateChanged(QBluetoothLocalDevice::HostMode state) { + OPENAUTO_LOG(info) << "[BluetoothHandler::onHostModeStateChanged] Host mode state changed: " << state; + // ... your logic to handle the state change ... + } +} \ No newline at end of file diff --git a/src/btservice/btservice.cpp b/src/btservice/btservice.cpp index 3b8b8ee..287eede 100644 --- a/src/btservice/btservice.cpp +++ b/src/btservice/btservice.cpp @@ -20,8 +20,7 @@ #include #include #include -#include -#include +#include namespace btservice = f1x::openauto::btservice; @@ -29,39 +28,16 @@ int main(int argc, char *argv[]) { QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth*=true")); QCoreApplication qApplication(argc, argv); - QBluetoothLocalDevice localDevice; - const QBluetoothAddress address = localDevice.address(); - auto configuration = std::make_shared(); - // Turn Bluetooth on - localDevice.powerOn(); - // Make it visible to others - localDevice.setHostMode(QBluetoothLocalDevice::HostDiscoverable); - - btservice::AndroidBluetoothServer androidBluetoothServer(configuration); - uint16_t portNumber = androidBluetoothServer.start(address); - - if (portNumber == 0) { - OPENAUTO_LOG(error) << "[btservice] Server start failed."; - return 2; + try { + btservice::BluetoothHandler bluetoothHandler(configuration); + QCoreApplication::exec(); + } catch (std::runtime_error& e) { + std::cerr << "Exception caught: " << e.what() << std::endl; } - OPENAUTO_LOG(info) << "[btservice] Listening for connections, address: " << address.toString().toStdString() - << ", port: " << portNumber; - - btservice::AndroidBluetoothService androidBluetoothService(portNumber); - if (!androidBluetoothService.registerService(address)) { - OPENAUTO_LOG(error) << "[btservice] Service registration failed."; - return 1; - } else { - OPENAUTO_LOG(info) << "[btservice] Service registered, port: " << portNumber; - } - - QCoreApplication::exec(); - OPENAUTO_LOG(info) << "stop"; - androidBluetoothService.unregisterService(); return 0; } From c5ac7113c8aae31b4f87731fd39d3ffea54aa76b Mon Sep 17 00:00:00 2001 From: Simon Dean Date: Wed, 27 Nov 2024 11:29:35 +0000 Subject: [PATCH 13/14] Remove System Updates during transition and swap name from CrankShaft to Journey: Temporary --- src/autoapp/UI/ConnectDialog.cpp | 2 +- src/autoapp/UI/MainWindow.cpp | 4 +- src/autoapp/UI/UpdateDialog.cpp | 3 +- src/autoapp/UI/mainwindow.ui | 2 +- src/autoapp/UI/settingswindow.ui | 151 +++++++++++++------------------ 5 files changed, 71 insertions(+), 91 deletions(-) diff --git a/src/autoapp/UI/ConnectDialog.cpp b/src/autoapp/UI/ConnectDialog.cpp index bb503d7..88587cc 100644 --- a/src/autoapp/UI/ConnectDialog.cpp +++ b/src/autoapp/UI/ConnectDialog.cpp @@ -131,7 +131,7 @@ void ConnectDialog::loadClientList() if (std::ifstream("/tmp/hotspot_active")) { ui_->listWidgetClients->show(); - ui_->pushButtonUpdate->show(); + //ui_->pushButtonUpdate->show(); if (std::ifstream("/tmp/temp_recent_list")) { QFile versionFile(QString("/tmp/temp_recent_list")); versionFile.open(QIODevice::ReadOnly); diff --git a/src/autoapp/UI/MainWindow.cpp b/src/autoapp/UI/MainWindow.cpp index f9ab78d..a28dec7 100644 --- a/src/autoapp/UI/MainWindow.cpp +++ b/src/autoapp/UI/MainWindow.cpp @@ -2142,7 +2142,7 @@ void f1x::openauto::autoapp::ui::MainWindow::tmpChanged() this->openautoupdate = check_file_exist("/tmp/openauto_update_available"); this->systemupdate = check_file_exist("/tmp/system_update_available"); - if (this->csmtupdate || this->udevupdate || this->openautoupdate || this->systemupdate) { + /*if (this->csmtupdate || this->udevupdate || this->openautoupdate || this->systemupdate) { if (ui_->pushButtonUpdate->isVisible() == false) { ui_->pushButtonUpdate->show(); ui_->label_left->show(); @@ -2153,7 +2153,7 @@ void f1x::openauto::autoapp::ui::MainWindow::tmpChanged() ui_->label_dummy_right->show(); } } - } else { + } else {*/ if (ui_->pushButtonUpdate->isVisible() == true) { ui_->pushButtonUpdate->hide(); ui_->label_left->hide(); diff --git a/src/autoapp/UI/UpdateDialog.cpp b/src/autoapp/UI/UpdateDialog.cpp index 635ea13..4a311ef 100644 --- a/src/autoapp/UI/UpdateDialog.cpp +++ b/src/autoapp/UI/UpdateDialog.cpp @@ -36,7 +36,8 @@ UpdateDialog::UpdateDialog(QWidget *parent) ui_->labelSystemReadyInstall->hide(); ui_->labelUpdateChecking->hide(); ui_->pushButtonUpdateCancel->hide(); - updateCheck(); + // TODO: Restore once switched + //updateCheck(); watcher_tmp = new QFileSystemWatcher(this); watcher_tmp->addPath("/tmp"); diff --git a/src/autoapp/UI/mainwindow.ui b/src/autoapp/UI/mainwindow.ui index 503c8e0..dd911e5 100644 --- a/src/autoapp/UI/mainwindow.ui +++ b/src/autoapp/UI/mainwindow.ui @@ -305,7 +305,7 @@ color: rgb(211, 215, 207); background-color: rgba(255, 255, 255, 0); - <html><head/><body><p><span style=" font-style:normal; color:#ffffff;">crank</span><span style=" font-style:normal; color:#5ce739;">shaft </span><span style=" font-style:normal; color:#40bfbf;">NG </span><span style=" font-style:normal; color:#888a85;">- OpenCarOS</span></p></body></html> + <html><head/><body><p><span style=" font-style:normal; color:#7700C8;">Journey</span><span style=" font-style:normal; color:#ffffff;">OS </span></p></body></html> Qt::AlignCenter diff --git a/src/autoapp/UI/settingswindow.ui b/src/autoapp/UI/settingswindow.ui index 717018a..f0cbcd8 100644 --- a/src/autoapp/UI/settingswindow.ui +++ b/src/autoapp/UI/settingswindow.ui @@ -331,7 +331,7 @@ outline: none; Handedness of traffic - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop @@ -540,7 +540,7 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} 50 - Qt::Horizontal + Qt::Orientation::Horizontal @@ -673,7 +673,7 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} 50 - Qt::Horizontal + Qt::Orientation::Horizontal @@ -757,7 +757,7 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} 50 - Qt::Horizontal + Qt::Orientation::Horizontal @@ -908,7 +908,7 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} - Qt::Vertical + Qt::Orientation::Vertical @@ -1094,7 +1094,7 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} <html><head/><body><p><img src=":/ico_warning.png"/></p></body></html> - Qt::AlignCenter + Qt::AlignmentFlag::AlignCenter @@ -1188,16 +1188,16 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} - QFrame::NoFrame + QFrame::Shape::NoFrame - QFrame::Plain + QFrame::Shadow::Plain Layer index - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter @@ -1275,7 +1275,7 @@ subcontrol-position: center left; Margin height - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter @@ -1327,7 +1327,7 @@ subcontrol-position: center left; - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop 0 @@ -1359,7 +1359,7 @@ subcontrol-position: center left; Margin width - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter @@ -1439,7 +1439,7 @@ subcontrol-position: center left; false - Qt::AlignCenter + Qt::AlignmentFlag::AlignCenter @@ -1536,7 +1536,7 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} 100 - Qt::Horizontal + Qt::Orientation::Horizontal @@ -1702,7 +1702,7 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} <html><head/><body><p><img src=":/ico_info.png"/></p></body></html> - Qt::AlignCenter + Qt::AlignmentFlag::AlignCenter @@ -2010,7 +2010,6 @@ QComboBox::item:selected { - 75 true @@ -2045,7 +2044,6 @@ color: rgb(255, 255, 255); - 75 true @@ -2057,7 +2055,7 @@ color: rgb(255, 255, 255); Test in progress ... - Qt::AlignCenter + Qt::AlignmentFlag::AlignCenter @@ -2132,7 +2130,7 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} 100 - Qt::Horizontal + Qt::Orientation::Horizontal @@ -2198,7 +2196,7 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} 100 - Qt::Horizontal + Qt::Orientation::Horizontal @@ -2208,7 +2206,7 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} - Qt::Vertical + Qt::Orientation::Vertical @@ -2228,10 +2226,10 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop 1 @@ -2720,7 +2718,7 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} - Qt::Vertical + Qt::Orientation::Vertical @@ -2821,7 +2819,7 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} - Qt::Horizontal + Qt::Orientation::Horizontal @@ -2853,7 +2851,6 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} - 75 true @@ -2926,7 +2923,7 @@ outline: none; Wifi Setup - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter @@ -3523,7 +3520,7 @@ outline: none; Wifi Mode - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop false @@ -3612,7 +3609,6 @@ outline: none; - 75 true @@ -3623,7 +3619,7 @@ outline: none; Wait... - Qt::AlignCenter + Qt::AlignmentFlag::AlignCenter @@ -3746,7 +3742,6 @@ outline: none; - 75 true @@ -3781,7 +3776,6 @@ outline: none; - 75 true @@ -3821,7 +3815,7 @@ outline: none; not available - Qt::AlignCenter + Qt::AlignmentFlag::AlignCenter @@ -4145,7 +4139,6 @@ outline: none; - 75 true @@ -4162,7 +4155,7 @@ outline: none; - Qt::Vertical + Qt::Orientation::Vertical @@ -4667,7 +4660,7 @@ outline: none; Boot Screen - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter @@ -4888,7 +4881,7 @@ outline: none; Screen Off Timeout: - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter @@ -4916,7 +4909,7 @@ outline: none; - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter @@ -4979,7 +4972,7 @@ subcontrol-position: center left; Seconds - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter @@ -5070,7 +5063,7 @@ subcontrol-position: center left; Shutdown Timeout: - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter @@ -5098,7 +5091,7 @@ subcontrol-position: center left; - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter @@ -5158,7 +5151,7 @@ subcontrol-position: center left; Minutes - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter @@ -5208,7 +5201,7 @@ subcontrol-position: center left; - Qt::Vertical + Qt::Orientation::Vertical @@ -5421,7 +5414,7 @@ subcontrol-position: center left; - - - - QComboBox::AdjustToContentsOnFirstShow + QComboBox::SizeAdjustPolicy::AdjustToContentsOnFirstShow 0 @@ -7117,7 +7110,7 @@ outline: none; Start Day - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter @@ -7172,7 +7165,7 @@ subcontrol-position: center left; - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter 0 @@ -7210,7 +7203,7 @@ subcontrol-position: center left; Start Night - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter @@ -7333,7 +7326,7 @@ subcontrol-position: center left; - Qt::Vertical + Qt::Orientation::Vertical @@ -7550,7 +7543,7 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} 5 - Qt::Horizontal + Qt::Orientation::Horizontal @@ -7625,7 +7618,7 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} 20 - Qt::Horizontal + Qt::Orientation::Horizontal @@ -7648,7 +7641,7 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} 100 - Qt::Horizontal + Qt::Orientation::Horizontal @@ -7671,7 +7664,7 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} 200 - Qt::Horizontal + Qt::Orientation::Horizontal @@ -7694,7 +7687,7 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} 500 - Qt::Horizontal + Qt::Orientation::Horizontal @@ -7781,7 +7774,7 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} 30 - Qt::Horizontal + Qt::Orientation::Horizontal @@ -7817,7 +7810,7 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} 90 - Qt::Horizontal + Qt::Orientation::Horizontal @@ -7853,7 +7846,7 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} 150 - Qt::Horizontal + Qt::Orientation::Horizontal @@ -7889,7 +7882,7 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} 210 - Qt::Horizontal + Qt::Orientation::Horizontal @@ -7925,7 +7918,7 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} 255 - Qt::Horizontal + Qt::Orientation::Horizontal @@ -7950,7 +7943,7 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} Options - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop @@ -7993,7 +7986,7 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop 0 @@ -8194,7 +8187,7 @@ or lower - Qt::Vertical + Qt::Orientation::Vertical @@ -8464,7 +8457,6 @@ subcontrol-position: center left; - 75 true @@ -8480,7 +8472,7 @@ outline: none; - Qt::Horizontal + Qt::Orientation::Horizontal @@ -8512,7 +8504,6 @@ outline: none; - 75 true @@ -8600,7 +8591,6 @@ outline: none; 12 - 75 true @@ -8624,7 +8614,7 @@ QComboBox::item:selected { } - QComboBox::AdjustToContents + QComboBox::SizeAdjustPolicy::AdjustToContents @@ -8788,7 +8778,6 @@ QComboBox::item:selected { 12 - 75 true @@ -8860,7 +8849,6 @@ QComboBox::item:selected { 12 - 75 true @@ -8995,7 +8983,6 @@ QComboBox::item:selected { 12 - 75 true @@ -9121,7 +9108,7 @@ QComboBox::item:selected { Timezone - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter @@ -9148,7 +9135,6 @@ QComboBox::item:selected { 12 - 75 true @@ -9251,7 +9237,6 @@ QComboBox::item:selected { 12 - 75 true @@ -9310,7 +9295,7 @@ QComboBox::item:selected { FPS - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter @@ -9619,10 +9604,10 @@ border-color: rgb(85, 87, 83); - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Fixed + QSizePolicy::Policy::Fixed @@ -9685,7 +9670,7 @@ border-color: rgb(85, 87, 83); AWB - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter @@ -9711,7 +9696,6 @@ border-color: rgb(85, 87, 83); - 50 false @@ -9987,7 +9971,6 @@ QComboBox::item:selected { - 75 true @@ -10191,7 +10174,7 @@ QComboBox::item:selected { - Qt::Horizontal + Qt::Orientation::Horizontal @@ -10339,10 +10322,10 @@ border-color: rgb(85, 87, 83); - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Fixed + QSizePolicy::Policy::Fixed @@ -10494,7 +10477,6 @@ QComboBox::item:selected { 12 - 75 true @@ -10575,7 +10557,7 @@ QComboBox::item:selected { - Qt::Vertical + Qt::Orientation::Vertical @@ -10612,7 +10594,6 @@ QComboBox::item:selected { - 75 true @@ -10646,7 +10627,6 @@ QComboBox::item:selected { - 75 true @@ -10680,7 +10660,6 @@ QComboBox::item:selected { - 75 true From d97edf539bbeae45d7377e13ca79fde759047f02 Mon Sep 17 00:00:00 2001 From: Simon Dean Date: Fri, 29 Nov 2024 22:13:44 +0000 Subject: [PATCH 14/14] BugFix finalisation of re-worked btservice for Bluetooth Handling. Redeclare function scoped variables to be on on class object for persistent handling in memory. --- CMakeLists.txt | 27 +++++++++++-------- RELEASE.txt | 18 +++++++++---- .../btservice/AndroidBluetoothServer.hpp | 1 + .../btservice/AndroidBluetoothService.hpp | 4 +-- .../openauto/btservice/BluetoothHandler.hpp | 11 ++++++-- .../btservice/IAndroidBluetoothServer.hpp | 15 +++++------ .../btservice/IAndroidBluetoothService.hpp | 10 ++++--- .../openauto/btservice/IBluetoothHandler.hpp | 2 ++ src/autoapp/Service/ServiceFactory.cpp | 3 ++- src/btservice/AndroidBluetoothServer.cpp | 15 ++++++++--- src/btservice/AndroidBluetoothService.cpp | 11 +++++--- src/btservice/BluetoothHandler.cpp | 20 +++++++++----- src/btservice/btservice.cpp | 4 ++- 13 files changed, 94 insertions(+), 47 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f3618dc..c50f447 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,9 +11,9 @@ set(CMAKE_AUTOUIC ON) set(CMAKE_AUTORCC ON) # Set Compile Versions -set(OPENAUTO_BUILD_DATE 20241121) # Binary Release Build Date +set(OPENAUTO_BUILD_DATE 20241124) # Binary Release Build Date set(OPENAUTO_BUILD_MAJOR_RELEASE 4) # Binary Release Build Major Number -set(OPENAUTO_BUILD_MINOR_RELEASE 0) # Binary Release Build Minor Number +set(OPENAUTO_BUILD_MINOR_RELEASE 1) # Binary Release Build Minor Number set(OPENAUTO_BUILD_INCREMENTAL 0) # Binary Build Version - Increment for Each Build # Configure CMAKE @@ -26,6 +26,9 @@ set(CMAKE_CXX_FLAGS_RELEASE "-g -O3") if(NOT CMAKE_BUILD_TYPE) message(STATUS "Forcing Release build type") set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,/usr/local/qt5/lib") + # Set the possible values of build type for cmake-gui set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") endif() @@ -87,7 +90,7 @@ find_package(aap_protobuf REQUIRED) find_package(aasdk REQUIRED) find_package(Boost REQUIRED COMPONENTS system log OPTIONAL_COMPONENTS unit_test_framework) find_package(libusb-1.0 REQUIRED) -find_package(Qt5 COMPONENTS Multimedia MultimediaWidgets Bluetooth Network) +find_package(Qt5 COMPONENTS DBus Multimedia MultimediaWidgets Bluetooth Network) find_package(OpenSSL REQUIRED) find_package(rtaudio REQUIRED) find_package(taglib REQUIRED) @@ -119,7 +122,7 @@ set(common_include_directory ${include_directory}/f1x/openauto/Common) set(autoapp_sources_directory ${sources_directory}/autoapp) set(autoapp_include_directory ${include_directory}/f1x/openauto/autoapp) -file(GLOB_RECURSE autoapp_source_files ${autoapp_sources_directory}/*.ui ${autoapp_sources_directory}/*.cpp ${autoapp_include_directory}/*.hpp ${common_include_directory}/*.hpp ${resources_directory}/*.qrc) +file(GLOB_RECURSE autoapp_source_files ${autoapp_sources_directory}/*.ui ${autoapp_sources_directory}/*.cpp ${autoapp_include_directory}/*.hpp ${autoapp_include_directory}/*.h ${common_include_directory}/*.hpp ${resources_directory}/*.qrc) add_executable(autoapp ${autoapp_source_files}) @@ -128,6 +131,7 @@ target_include_directories(autoapp PUBLIC ${AAP_PROTOBUF_INCLUDE_DIR} ${AASDK_IN target_link_libraries(autoapp PUBLIC libusb ${Boost_LIBRARIES} + ${Qt5DBus_LIBRARIES} ${Qt5Multimedia_LIBRARIES} ${Qt5MultimediaWidgets_LIBRARIES} ${Qt5Bluetooth_LIBRARIES} @@ -152,7 +156,8 @@ set(btservice_sources_directory ${sources_directory}/btservice) set(btservice_include_directory ${include_directory}/f1x/openauto/btservice) file(GLOB_RECURSE btservice_source_files ${btservice_sources_directory}/*.cpp ${btservice_include_directory}/*.hpp ${autoapp_sources_directory}/Configuration/*.cpp ${autoapp_includes_directory}/Configuration/*.hpp ${common_include_directory}/*.hpp) -add_executable(btservice ${btservice_source_files}) +add_executable(btservice ${btservice_source_files} + src/btservice/BluetoothHandler.cpp) target_link_libraries(btservice PUBLIC ${Boost_LIBRARIES} @@ -162,11 +167,11 @@ target_link_libraries(btservice PUBLIC ${PROTOBUF_LIBRARIES} ${AAP_PROTOBUF_LIB_DIR}) -set_target_properties(openauto - PROPERTIES VERSION ${LIBRARY_VERSION_STRING} SOVERSION ${LIBRARY_BUILD_INCREMENTAL}) +set_target_properties(autoapp + PROPERTIES VERSION ${PROGRAM_VERSION_STRING} SOVERSION ${OPENAUTO_BUILD_INCREMENTAL}) # Install rules -install(TARGETS openauto btservice - EXPORT aasdkTargets - RUNTIME DESTINATION bin -) \ No newline at end of file +#install(TARGETS autoapp btservice +# EXPORT aasdkTargets +# RUNTIME DESTINATION bin +#) \ No newline at end of file diff --git a/RELEASE.txt b/RELEASE.txt index d82e1e3..b47a1a3 100644 --- a/RELEASE.txt +++ b/RELEASE.txt @@ -1,7 +1,15 @@ Release Notes -20241121 - 4.0.0 -Added support for new services provided by AASDK and AAP Protocol version 1.6. -Add extensive logging -Add logo for forked version -Resolve display issue where if Raspberry Pi thinks both HDMI and LCD are enabled, the display width is appearing as two side by side monitors (double width) rather than just using the physical width of the screen. +20241124 - 4.1.0 - Bluetooth Updates +* Rename BluetootAdapterType to BluetoothAdapterType, and change from NONE, LOCAL, REMOTE to NONE, LOCAL, EXTERNAL to better match available settings +* getLocalAddress() on Dummy, Local and Remote bluetooth changed to getAdapterAddress() +* Removed RemoteBluetoothDevice replacing all references with LocalBluetoothDevice. RemoteBluetoothDevice is a wrapper essentially with all pairing work handled by btservice. +* Pairing overlaps between btservice and LocalBluetoothDevice - removed duplicated elements from LocalBluetoothDevice to rely on btservice. +* Swap Bluetooth dropdown in Settings from none, builtin or external, to showing a list of detected Bluetooth Adapters. Write hardware address to config file. + +20241121 - 4.0.0 - AAP 1.6 Support +* Added support for new services provided by AASDK and AAP Protocol version 1.6. +* Add extensive logging +* Add logo for forked version +* Resolve display issue where if Raspberry Pi thinks both HDMI and LCD are enabled, the display width is appearing as two side by side monitors (double width) rather than just using the physical width of the screen. + diff --git a/include/f1x/openauto/btservice/AndroidBluetoothServer.hpp b/include/f1x/openauto/btservice/AndroidBluetoothServer.hpp index 72c9815..478129b 100644 --- a/include/f1x/openauto/btservice/AndroidBluetoothServer.hpp +++ b/include/f1x/openauto/btservice/AndroidBluetoothServer.hpp @@ -47,6 +47,7 @@ namespace f1x::openauto::btservice { private slots: void onClientConnected(); + void onError(QBluetoothServer::Error error); private: std::unique_ptr rfcommServer_; diff --git a/include/f1x/openauto/btservice/AndroidBluetoothService.hpp b/include/f1x/openauto/btservice/AndroidBluetoothService.hpp index 64e0abb..551918d 100644 --- a/include/f1x/openauto/btservice/AndroidBluetoothService.hpp +++ b/include/f1x/openauto/btservice/AndroidBluetoothService.hpp @@ -27,9 +27,9 @@ namespace f1x::openauto::btservice class AndroidBluetoothService: public IAndroidBluetoothService { public: - AndroidBluetoothService(uint16_t portNumber); + AndroidBluetoothService(); - bool registerService(const QBluetoothAddress& bluetoothAddress) override; + bool registerService(int16_t portNumber, const QBluetoothAddress& bluetoothAddress) override; bool unregisterService() override; private: diff --git a/include/f1x/openauto/btservice/BluetoothHandler.hpp b/include/f1x/openauto/btservice/BluetoothHandler.hpp index 236b461..911ad0b 100644 --- a/include/f1x/openauto/btservice/BluetoothHandler.hpp +++ b/include/f1x/openauto/btservice/BluetoothHandler.hpp @@ -6,16 +6,20 @@ #define OPENAUTO_BLUETOOTHHANDLER_HPP #include +#include +#include #include #include - namespace f1x::openauto::btservice { class BluetoothHandler : public QObject, public IBluetoothHandler { Q_OBJECT public: - BluetoothHandler(autoapp::configuration::IConfiguration::Pointer configuration); + BluetoothHandler(btservice::IAndroidBluetoothService::Pointer androidBluetoothService, + autoapp::configuration::IConfiguration::Pointer configuration); + + void shutdownService() override; private slots: void onPairingDisplayPinCode(const QBluetoothAddress &address, QString pin); @@ -28,9 +32,12 @@ namespace f1x::openauto::btservice { void onHostModeStateChanged(QBluetoothLocalDevice::HostMode state); + private: std::unique_ptr localDevice_; autoapp::configuration::IConfiguration::Pointer configuration_; + btservice::IAndroidBluetoothService::Pointer androidBluetoothService_; + btservice::IAndroidBluetoothServer::Pointer androidBluetoothServer_; }; } diff --git a/include/f1x/openauto/btservice/IAndroidBluetoothServer.hpp b/include/f1x/openauto/btservice/IAndroidBluetoothServer.hpp index d626bea..8622209 100644 --- a/include/f1x/openauto/btservice/IAndroidBluetoothServer.hpp +++ b/include/f1x/openauto/btservice/IAndroidBluetoothServer.hpp @@ -18,20 +18,19 @@ #pragma once +#include #include +namespace f1x::openauto::btservice { + class IAndroidBluetoothServer { + public: + typedef std::shared_ptr Pointer; -namespace f1x::openauto::btservice -{ - -class IAndroidBluetoothServer -{ -public: virtual ~IAndroidBluetoothServer() = default; - virtual uint16_t start(const QBluetoothAddress& address) = 0; -}; + virtual uint16_t start(const QBluetoothAddress &address) = 0; + }; } diff --git a/include/f1x/openauto/btservice/IAndroidBluetoothService.hpp b/include/f1x/openauto/btservice/IAndroidBluetoothService.hpp index 0868d83..2dd1c21 100644 --- a/include/f1x/openauto/btservice/IAndroidBluetoothService.hpp +++ b/include/f1x/openauto/btservice/IAndroidBluetoothService.hpp @@ -17,7 +17,7 @@ */ #pragma once - +#include #include namespace f1x::openauto::btservice @@ -26,10 +26,12 @@ namespace f1x::openauto::btservice class IAndroidBluetoothService { public: - virtual ~IAndroidBluetoothService() = default; + typedef std::shared_ptr Pointer; - virtual bool registerService(const QBluetoothAddress& bluetoothAddress) = 0; - virtual bool unregisterService() = 0; + virtual ~IAndroidBluetoothService() = default; + + virtual bool registerService(int16_t portNumber, const QBluetoothAddress& bluetoothAddress) = 0; + virtual bool unregisterService() = 0; }; } diff --git a/include/f1x/openauto/btservice/IBluetoothHandler.hpp b/include/f1x/openauto/btservice/IBluetoothHandler.hpp index d3430c7..94f1fdf 100644 --- a/include/f1x/openauto/btservice/IBluetoothHandler.hpp +++ b/include/f1x/openauto/btservice/IBluetoothHandler.hpp @@ -5,6 +5,7 @@ #ifndef OPENAUTO_IBLUETOOTHHANDLER_HPP #define OPENAUTO_IBLUETOOTHHANDLER_HPP +#include #include #include @@ -15,6 +16,7 @@ namespace f1x::openauto::btservice { public: virtual ~IBluetoothHandler() = default; + virtual void shutdownService() = 0; }; } diff --git a/src/autoapp/Service/ServiceFactory.cpp b/src/autoapp/Service/ServiceFactory.cpp index f4638e8..b7440e5 100644 --- a/src/autoapp/Service/ServiceFactory.cpp +++ b/src/autoapp/Service/ServiceFactory.cpp @@ -141,6 +141,7 @@ namespace f1x::openauto::autoapp::service { std::move(guidanceAudioOutput))); } + /* if (configuration_->telephonyAudioChannelEnabled()) { OPENAUTO_LOG(info) << "[ServiceFactory] Telephony Audio Channel enabled"; auto telephonyAudioOutput = @@ -153,7 +154,7 @@ namespace f1x::openauto::autoapp::service { std::make_shared(ioService_, messenger, std::move(telephonyAudioOutput))); } - +*/ /* * No Need to Check for systemAudioChannelEnabled - MUST be enabled by default. */ diff --git a/src/btservice/AndroidBluetoothServer.cpp b/src/btservice/AndroidBluetoothServer.cpp index 8a66cb6..a9d8af6 100644 --- a/src/btservice/AndroidBluetoothServer.cpp +++ b/src/btservice/AndroidBluetoothServer.cpp @@ -39,22 +39,30 @@ namespace f1x::openauto::btservice { AndroidBluetoothServer::AndroidBluetoothServer(autoapp::configuration::IConfiguration::Pointer configuration) : rfcommServer_(std::make_unique(QBluetoothServiceInfo::RfcommProtocol, this)), configuration_(std::move(configuration)) { + OPENAUTO_LOG(info) << "[AndroidBluetoothServer::AndroidBluetoothServer] Initialising"; + connect(rfcommServer_.get(), &QBluetoothServer::newConnection, this, &AndroidBluetoothServer::onClientConnected); + } /// Start Server listening on Address uint16_t AndroidBluetoothServer::start(const QBluetoothAddress &address) { - OPENAUTO_LOG(debug) << "[AndroidBluetoothServer] start()"; + OPENAUTO_LOG(debug) << "[AndroidBluetoothServer::start]"; if (rfcommServer_->listen(address)) { + return rfcommServer_->serverPort(); } return 0; } + void AndroidBluetoothServer::onError(QBluetoothServer::Error error) { + OPENAUTO_LOG(debug) << "[AndroidBluetoothServer::onError]"; + } + /// Call-Back for when Client Connected void AndroidBluetoothServer::onClientConnected() { - OPENAUTO_LOG(debug) << "[AndroidBluetoothServer] onClientConnected()"; + OPENAUTO_LOG(debug) << "[AndroidBluetoothServer::onClientConnected]"; if (socket != nullptr) { socket->deleteLater(); } @@ -159,8 +167,9 @@ namespace f1x::openauto::btservice { response.set_password( configuration_->getParamFromFile("/etc/hostapd/hostapd.conf", "wpa_passphrase").toStdString()); response.set_bssid(QNetworkInterface::interfaceFromName("wlan0").hardwareAddress().toStdString()); + // TODO: AAP uses different values than WiFiProjection.... response.set_security_mode( - aap_protobuf::service::wifiprojection::message::WifiSecurityMode::WPA2_PERSONAL); + aap_protobuf::service::wifiprojection::message::WifiSecurityMode::WPA2_ENTERPRISE); response.set_access_point_type(aap_protobuf::service::wifiprojection::message::AccessPointType::STATIC); sendMessage(response, 3); diff --git a/src/btservice/AndroidBluetoothService.cpp b/src/btservice/AndroidBluetoothService.cpp index 01cc042..f979848 100644 --- a/src/btservice/AndroidBluetoothService.cpp +++ b/src/btservice/AndroidBluetoothService.cpp @@ -17,10 +17,12 @@ */ #include +#include namespace f1x::openauto::btservice { - AndroidBluetoothService::AndroidBluetoothService(uint16_t portNumber) { + AndroidBluetoothService::AndroidBluetoothService() { + OPENAUTO_LOG(info) << "[AndroidBluetoothService::AndroidBluetoothService] Initialising"; const QBluetoothUuid serviceUuid(QLatin1String("4de17a00-52cb-11e6-bdf4-0800200c9a66")); QBluetoothServiceInfo::Sequence classId; @@ -36,6 +38,10 @@ namespace f1x::openauto::btservice { QBluetoothServiceInfo::Sequence publicBrowse; publicBrowse << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::PublicBrowseGroup)); serviceInfo_.setAttribute(QBluetoothServiceInfo::BrowseGroupList, publicBrowse); + } + + bool AndroidBluetoothService::registerService(int16_t portNumber, const QBluetoothAddress &bluetoothAddress) { + OPENAUTO_LOG(info) << "[AndroidBluetoothService::registerService] Registering Service"; QBluetoothServiceInfo::Sequence protocolDescriptorList; QBluetoothServiceInfo::Sequence protocol; @@ -46,13 +52,12 @@ namespace f1x::openauto::btservice { << QVariant::fromValue(quint16(portNumber)); protocolDescriptorList.append(QVariant::fromValue(protocol)); serviceInfo_.setAttribute(QBluetoothServiceInfo::ProtocolDescriptorList, protocolDescriptorList); - } - bool AndroidBluetoothService::registerService(const QBluetoothAddress &bluetoothAddress) { return serviceInfo_.registerService(bluetoothAddress); } bool AndroidBluetoothService::unregisterService() { + OPENAUTO_LOG(info) << "[AndroidBluetoothService::unregisterService] Unregistering"; return serviceInfo_.unregisterService(); } diff --git a/src/btservice/BluetoothHandler.cpp b/src/btservice/BluetoothHandler.cpp index 40daafa..149d719 100644 --- a/src/btservice/BluetoothHandler.cpp +++ b/src/btservice/BluetoothHandler.cpp @@ -8,8 +8,11 @@ #include namespace f1x::openauto::btservice { - BluetoothHandler::BluetoothHandler(autoapp::configuration::IConfiguration::Pointer configuration) - : configuration_(std::move(configuration)) { + BluetoothHandler::BluetoothHandler(btservice::IAndroidBluetoothService::Pointer androidBluetoothService, + autoapp::configuration::IConfiguration::Pointer configuration) + : configuration_(std::move(configuration)), + androidBluetoothService_(std::move(androidBluetoothService)), + androidBluetoothServer_(std::make_unique(configuration_)) { OPENAUTO_LOG(info) << "[BluetoothHandler::BluetoothHandler] Starting Up..."; @@ -35,8 +38,7 @@ namespace f1x::openauto::btservice { // Make it visible to others localDevice_->setHostMode(QBluetoothLocalDevice::HostDiscoverable); - btservice::AndroidBluetoothServer androidBluetoothServer(configuration_); - uint16_t portNumber = androidBluetoothServer.start(address); + uint16_t portNumber = androidBluetoothServer_->start(address); if (portNumber == 0) { OPENAUTO_LOG(error) << "[BluetoothHandler::BluetoothHandler] Server start failed."; @@ -46,15 +48,19 @@ namespace f1x::openauto::btservice { OPENAUTO_LOG(info) << "[BluetoothHandler::BluetoothHandler] Listening for connections, address: " << address.toString().toStdString() << ", port: " << portNumber; - btservice::AndroidBluetoothService androidBluetoothService(portNumber); - if (!androidBluetoothService.registerService(address)) { + if (!androidBluetoothService_->registerService(portNumber, address)) { OPENAUTO_LOG(error) << "[BluetoothHandler::BluetoothHandler] Service registration failed."; throw std::runtime_error("Unable to register btservice"); } else { OPENAUTO_LOG(info) << "[BluetoothHandler::BluetoothHandler] Service registered, port: " << portNumber; } - androidBluetoothService.unregisterService(); + // TODO: Connect to any previously paired devices + } + + void BluetoothHandler::shutdownService() { + OPENAUTO_LOG(info) << "[BluetoothHandler::shutdownService] Shutdown initiated"; + androidBluetoothService_->unregisterService(); } void BluetoothHandler::onPairingDisplayPinCode(const QBluetoothAddress &address, QString pin) { diff --git a/src/btservice/btservice.cpp b/src/btservice/btservice.cpp index 287eede..d7074ed 100644 --- a/src/btservice/btservice.cpp +++ b/src/btservice/btservice.cpp @@ -21,6 +21,7 @@ #include #include #include +#include namespace btservice = f1x::openauto::btservice; @@ -31,7 +32,8 @@ int main(int argc, char *argv[]) { auto configuration = std::make_shared(); try { - btservice::BluetoothHandler bluetoothHandler(configuration); + auto androidBluetoothService = std::make_shared(); + btservice::BluetoothHandler bluetoothHandler(androidBluetoothService, configuration); QCoreApplication::exec(); } catch (std::runtime_error& e) { std::cerr << "Exception caught: " << e.what() << std::endl;