Compiles and Builds, but problems with Video, WiFi Projection and Bluetooth.

This commit is contained in:
Simon Dean 2024-11-13 12:25:09 +00:00
parent 4e36ff016f
commit be8c0ab9cd
58 changed files with 649 additions and 724 deletions

View File

@ -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

View File

@ -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,9 +90,9 @@ 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

View File

@ -20,4 +20,5 @@
#include <boost/log/trivial.hpp>
#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

View File

@ -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;

View File

@ -20,9 +20,9 @@
#include <string>
#include <QRect>
#include <aap_protobuf/service/media/shared/message/VideoFrameRateType.pb.h>
#include <aap_protobuf/service/media/shared/message/VideoCodecResolutionType.pb.h>
#include <aap_protobuf/service/media/sink/KeyCode.pb.h>
#include <aap_protobuf/service/media/sink/message/VideoFrameRateType.pb.h>
#include <aap_protobuf/service/media/sink/message/VideoCodecResolutionType.pb.h>
#include <aap_protobuf/service/media/sink/message/KeyCode.pb.h>
#include <f1x/openauto/autoapp/Configuration/BluetootAdapterType.hpp>
#include <f1x/openauto/autoapp/Configuration/HandednessOfTrafficType.hpp>
#include <f1x/openauto/autoapp/Configuration/AudioOutputBackendType.hpp>
@ -40,7 +40,7 @@ class IConfiguration
{
public:
typedef std::shared_ptr<IConfiguration> Pointer;
typedef std::vector<aap_protobuf::service::media::sink::KeyCode> ButtonCodes;
typedef std::vector<aap_protobuf::service::media::sink::message::KeyCode> 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;

View File

@ -37,7 +37,7 @@ class IInputDevice
{
public:
typedef std::shared_ptr<IInputDevice> Pointer;
typedef std::vector<aap_protobuf::service::media::sink::KeyCode> ButtonCodes;
typedef std::vector<aap_protobuf::service::media::sink::message::KeyCode> ButtonCodes;
virtual ~IInputDevice() = default;
virtual void start(IInputDeviceEventHandler& eventHandler) = 0;

View File

@ -22,8 +22,8 @@
#include <QRect>
#include <aasdk/Common/Data.hpp>
#include <aasdk/Messenger/Timestamp.hpp>
#include <aap_protobuf/service/media/shared/message/VideoFrameRateType.pb.h>
#include <aap_protobuf/service/media/shared/message/VideoCodecResolutionType.pb.h>
#include <aap_protobuf/service/media/sink/message/VideoFrameRateType.pb.h>
#include <aap_protobuf/service/media/sink/message/VideoCodecResolutionType.pb.h>
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;

View File

@ -18,8 +18,8 @@
#pragma once
#include <aap_protobuf/service/media/sink/KeyCode.pb.h>
#include <aap_protobuf/service/input/message/PointerAction.pb.h>
#include <aap_protobuf/service/media/sink/message/KeyCode.pb.h>
#include <aap_protobuf/service/inputsource/message/PointerAction.pb.h>
#include <aasdk/IO/Promise.hpp>
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;

View File

@ -65,7 +65,6 @@ private:
QBluetoothServiceInfo serviceInfo_;
std::unique_ptr<QBluetoothServer> rfcommServer_;
void onClientConnected();
};
}

View File

@ -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;

View File

@ -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 &notification) 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:

View File

@ -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;

View File

@ -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;

View File

@ -21,7 +21,7 @@
#include <vector>
#include <memory>
#include <f1x/openauto/Common/Log.hpp>
#include <aap_protobuf/channel/control/servicediscovery/notification//ServiceDiscoveryResponse.pb.h>
#include <aap_protobuf/service/control/message/ServiceDiscoveryResponse.pb.h>
#include <aap_protobuf/shared/MessageStatus.pb.h>
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<IService::Pointer> ServiceList;

View File

@ -18,7 +18,7 @@
#pragma once
#include <aap_protobuf/service/media/sink/KeyCode.pb.h>
#include <aap_protobuf/service/media/sink/message/KeyCode.pb.h>
#include <aasdk/Channel/InputSource/InputSourceService.hpp>
#include <f1x/openauto/autoapp/Service/IService.hpp>
#include <f1x/openauto/autoapp/Projection/IInputDevice.hpp>
@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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<VideoMediaSinkService>::shared_from_this;

View File

@ -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;

View File

@ -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<NavigationStatusService>::shared_from_this;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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:

View File

@ -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;

View File

@ -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;

View File

@ -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_;

View File

@ -24,6 +24,9 @@
#include <f1x/openauto/btservice/IAndroidBluetoothServer.hpp>
#include <f1x/openauto/autoapp/Configuration/IConfiguration.hpp>
#include <aasdk/Messenger/Message.hpp>
#include <aap_protobuf/service/wifiprojection/message//WifiCredentialsRequest.pb.h>
#include <aap_protobuf/service/wifiprojection/message//WifiCredentialsResponse.pb.h>
#include <aap_protobuf/service/wifiprojection/WifiProjectionMessageId.pb.h>
namespace f1x
{

View File

@ -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<bool>(cGeneralShowAutoPlayKey, false);
instantPlay_ = iniConfig.get<bool>(cGeneralInstantPlayKey, false);
videoFPS_ = static_cast<aap_protobuf::service::media::shared::message::VideoFrameRateType>(iniConfig.get<uint32_t>(cVideoFPSKey,
aap_protobuf::service::media::shared::message::VideoFrameRateType::VIDEO_FPS_30));
videoFPS_ = static_cast<aap_protobuf::service::media::sink::message::VideoFrameRateType>(iniConfig.get<uint32_t>(cVideoFPSKey,
aap_protobuf::service::media::sink::message::VideoFrameRateType::VIDEO_FPS_30));
videoResolution_ = static_cast<aap_protobuf::service::media::shared::message::VideoCodecResolutionType>(iniConfig.get<uint32_t>(cVideoResolutionKey,
aap_protobuf::service::media::shared::message::VideoCodecResolutionType::VIDEO_800x480));
videoResolution_ = static_cast<aap_protobuf::service::media::sink::message::VideoCodecResolutionType>(iniConfig.get<uint32_t>(cVideoResolutionKey,
aap_protobuf::service::media::sink::message::VideoCodecResolutionType::VIDEO_800x480));
screenDPI_ = iniConfig.get<size_t>(cVideoScreenDPIKey, 140);
omxLayerIndex_ = iniConfig.get<int32_t>(cVideoOMXLayerIndexKey, 1);
@ -142,10 +142,10 @@ void Configuration::load()
bluetoothRemoteAdapterAddress_ = iniConfig.get<std::string>(cBluetoothRemoteAdapterAddressKey, "");
_audioChannelEnabledMedia = iniConfig.get<bool>(Audio::Channel::cMediaEnabled, true);
_audioChannelEnabledGuidance = iniConfig.get<bool>(Audio::Channel::cGuidanceEnabled, true);
_audioChannelEnabledSystem = iniConfig.get<bool>(Audio::Channel::cSystemEnabled, true);
_audioChannelEnabledTelephony = iniConfig.get<bool>(Audio::Channel::cTelephonyEnabled, true);
_audioChannelEnabledMedia = iniConfig.get<bool>(cAudioChannelMediaEnabled, true);
_audioChannelEnabledGuidance = iniConfig.get<bool>(cAudioChannelGuidanceEnabled, true);
_audioChannelEnabledSystem = iniConfig.get<bool>(cAudioChannelSystemEnabled, true);
_audioChannelEnabledTelephony = iniConfig.get<bool>(cAudioChannelTelephonyEnabled, true);
audioOutputBackendType_ = static_cast<AudioOutputBackendType>(iniConfig.get<uint32_t>(cAudioOutputBackendType, static_cast<uint32_t>(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<uint32_t>(cBluetoothAdapterTypeKey, static_cast<uint32_t>(bluetoothAdapterType_));
iniConfig.put<std::string>(cBluetoothRemoteAdapterAddressKey, bluetoothRemoteAdapterAddress_);
iniConfig.put<bool>(Audio::Channel::cMediaEnabled, _audioChannelEnabledMedia);
iniConfig.put<bool>(Audio::Channel::cGuidanceEnabled, _audioChannelEnabledGuidance);
iniConfig.put<bool>(Audio::Channel::cSystemEnabled, _audioChannelEnabledSystem);
iniConfig.put<bool>(Audio::Channel::cTelephonyEnabled, _audioChannelEnabledTelephony);
iniConfig.put<bool>(cAudioChannelMediaEnabled, _audioChannelEnabledMedia);
iniConfig.put<bool>(cAudioChannelGuidanceEnabled, _audioChannelEnabledGuidance);
iniConfig.put<bool>(cAudioChannelSystemEnabled, _audioChannelEnabledSystem);
iniConfig.put<bool>(cAudioChannelTelephonyEnabled, _audioChannelEnabledTelephony);
iniConfig.put<uint32_t>(cAudioOutputBackendType, static_cast<uint32_t>(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<bool>(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<bool>(cInputPlayButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PLAY) != buttonCodes_.end());
iniConfig.put<bool>(cInputPauseButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PAUSE) != buttonCodes_.end());
iniConfig.put<bool>(cInputTogglePlayButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PLAY_PAUSE) != buttonCodes_.end());
iniConfig.put<bool>(cInputNextTrackButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_NEXT) != buttonCodes_.end());
iniConfig.put<bool>(cInputPreviousTrackButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_MEDIA_PREVIOUS) != buttonCodes_.end());
iniConfig.put<bool>(cInputHomeButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_HOME) != buttonCodes_.end());
iniConfig.put<bool>(cInputPhoneButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_CALL) != buttonCodes_.end());
iniConfig.put<bool>(cInputCallEndButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_ENDCALL) != buttonCodes_.end());
iniConfig.put<bool>(cInputVoiceCommandButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_SEARCH) != buttonCodes_.end());
iniConfig.put<bool>(cInputLeftButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_LEFT) != buttonCodes_.end());
iniConfig.put<bool>(cInputRightButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_RIGHT) != buttonCodes_.end());
iniConfig.put<bool>(cInputUpButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_UP) != buttonCodes_.end());
iniConfig.put<bool>(cInputDownButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_DOWN) != buttonCodes_.end());
iniConfig.put<bool>(cInputScrollWheelButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_ROTARY_CONTROLLER) != buttonCodes_.end());
iniConfig.put<bool>(cInputBackButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_BACK) != buttonCodes_.end());
iniConfig.put<bool>(cInputEnterButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_DPAD_CENTER) != buttonCodes_.end());
iniConfig.put<bool>(cInputNavButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::KeyCode::KEYCODE_NAVIGATION) != buttonCodes_.end());
iniConfig.put<bool>(cInputPlayButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PLAY) != buttonCodes_.end());
iniConfig.put<bool>(cInputPauseButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PAUSE) != buttonCodes_.end());
iniConfig.put<bool>(cInputTogglePlayButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PLAY_PAUSE) != buttonCodes_.end());
iniConfig.put<bool>(cInputNextTrackButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_NEXT) != buttonCodes_.end());
iniConfig.put<bool>(cInputPreviousTrackButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_MEDIA_PREVIOUS) != buttonCodes_.end());
iniConfig.put<bool>(cInputHomeButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_HOME) != buttonCodes_.end());
iniConfig.put<bool>(cInputPhoneButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_CALL) != buttonCodes_.end());
iniConfig.put<bool>(cInputCallEndButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_ENDCALL) != buttonCodes_.end());
iniConfig.put<bool>(cInputVoiceCommandButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_SEARCH) != buttonCodes_.end());
iniConfig.put<bool>(cInputLeftButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_LEFT) != buttonCodes_.end());
iniConfig.put<bool>(cInputRightButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_RIGHT) != buttonCodes_.end());
iniConfig.put<bool>(cInputUpButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_UP) != buttonCodes_.end());
iniConfig.put<bool>(cInputDownButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_DOWN) != buttonCodes_.end());
iniConfig.put<bool>(cInputScrollWheelButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_ROTARY_CONTROLLER) != buttonCodes_.end());
iniConfig.put<bool>(cInputBackButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_BACK) != buttonCodes_.end());
iniConfig.put<bool>(cInputEnterButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_DPAD_CENTER) != buttonCodes_.end());
iniConfig.put<bool>(cInputNavButtonKey, std::find(buttonCodes_.begin(), buttonCodes_.end(), aap_protobuf::service::media::sink::message::KeyCode::KEYCODE_NAVIGATION) != buttonCodes_.end());
}
}

View File

@ -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;

View File

@ -54,44 +54,7 @@ void LocalBluetoothDevice::createBluetoothLocalDevice()
localDevice_->powerOn();
localDevice_->setHostMode(QBluetoothLocalDevice::HostDiscoverable);
//
// rfcommServer_ = std::make_unique<QBluetoothServer>(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.";
}
}
}
}
}

View File

@ -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();
}

View File

@ -16,44 +16,36 @@
* along with openauto. If not, see <http://www.gnu.org/licenses/>.
*/
#include <f1x/openauto/Common/Log.hpp>
#include <f1x/openauto/autoapp/Projection/VideoOutput.hpp>
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();
}
}
}
}
}
}
}
}

View File

@ -16,12 +16,12 @@
* along with openauto. If not, see <http://www.gnu.org/licenses/>.
*/
#include <aap_protobuf/connection/WirelessTcpConfiguration.pb.h>
#include <aap_protobuf/connection/PingConfiguration.pb.h>
#include <aap_protobuf/connection/ConnectionConfiguration.pb.h>
#include <aap_protobuf/channel/control/focus/audio/event/AudioFocusRequestType.pb.h>
#include <aap_protobuf/channel/control/focus/audio/notification/AudioFocusStateType.pb.h>
#include <aap_protobuf/channel/control/focus/navigation/shared/NavFocusType.pb.h>
#include <aap_protobuf/service/control/message/WirelessTcpConfiguration.pb.h>
#include <aap_protobuf/service/control/message/PingConfiguration.pb.h>
#include <aap_protobuf/service/control/message/ConnectionConfiguration.pb.h>
#include <aap_protobuf/service/control/message/AudioFocusRequestType.pb.h>
#include <aap_protobuf/service/control/message/AudioFocusStateType.pb.h>
#include <aap_protobuf/service/control/message/NavFocusType.pb.h>
#include <aasdk/Channel/Control/ControlServiceChannel.hpp>
#include <f1x/openauto/autoapp/Service/AndroidAutoEntity.hpp>
#include <f1x/openauto/Common/Log.hpp>
@ -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 &notification) {
void AndroidAutoEntity::onBatteryStatusNotification(const aap_protobuf::service::control::message::BatteryStatusNotification &notification) {
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::microseconds>(
std::chrono::high_resolution_clock::now().time_since_epoch());
request.set_timestamp(timestamp.count());

View File

@ -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<uint32_t>(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(),

View File

@ -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);

View File

@ -16,7 +16,7 @@
* along with openauto. If not, see <http://www.gnu.org/licenses/>.
*/
#include <aap_protobuf/service/input/message/InputReport.pb.h>
#include <aap_protobuf/service/inputsource/message/InputReport.pb.h>
#include <f1x/openauto/Common/Log.hpp>
#include <f1x/openauto/autoapp/Service/InputSource/InputSourceService.hpp>
@ -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();

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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<uint32_t>(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));
}

View File

@ -19,7 +19,6 @@
#include <time.h>
#include <f1x/openauto/Common/Log.hpp>
#include <f1x/openauto/autoapp/Service/MediaSource/MediaSourceService.hpp>
#include <aap_protobuf/service/media/sink/message/MediaSinkChannelSetupResponse.pb.h>
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<uint32_t>(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());
}

View File

@ -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());
}

View File

@ -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);

View File

@ -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);

View File

@ -16,8 +16,8 @@
* along with openauto. If not, see <http://www.gnu.org/licenses/>.
*/
#include <aap_protobuf/service/sensor/message/DrivingStatus.pb.h>
#include <aap_protobuf/service/sensor/message/SensorType.pb.h>
#include <aap_protobuf/service/sensorsource/message/DrivingStatus.pb.h>
#include <aap_protobuf/service/sensorsource/message/SensorType.pb.h>
#include <f1x/openauto/Common/Log.hpp>
#include <f1x/openauto/autoapp/Service/Sensor/SensorService.hpp>
#include <fstream>
@ -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_);

View File

@ -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<mediasink::TelephonyAudioService>(ioService_, messenger, std::move(telephonyAudioOutput)));
// serviceList.emplace_back(
// std::make_shared<mediasink::TelephonyAudioService>(ioService_, messenger, std::move(telephonyAudioOutput)));
}
/*

View File

@ -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);

View File

@ -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);

View File

@ -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<size_t>(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<int>(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);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

View File

@ -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;
}

View File

@ -1,22 +0,0 @@
#ifndef JOURNEY_H
#define JOURNEY_H
#include <QMainWindow>
namespace Ui {
class journey;
}
class journey : public QMainWindow
{
Q_OBJECT
public:
explicit journey(QWidget *parent = nullptr);
~journey();
private:
Ui::journey *ui;
};
#endif // JOURNEY_H

View File

@ -1,31 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>journey</class>
<widget class="QMainWindow" name="journey">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget"/>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>24</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -24,164 +24,158 @@
#include <QtCore/QDataStream>
#include <QNetworkInterface>
namespace f1x {
namespace openauto {
namespace btservice {
AndroidBluetoothServer::AndroidBluetoothServer(autoapp::configuration::IConfiguration::Pointer configuration)
: rfcommServer_(std::make_unique<QBluetoothServer>(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<QBluetoothServer>(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<unsigned>(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<unsigned>(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();
}
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<unsigned>(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<unsigned>(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 "";
}
}

View File

@ -18,17 +18,9 @@
#include <f1x/openauto/btservice/AndroidBluetoothService.hpp>
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();
}
}
}
}
}

View File

@ -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<f1x::openauto::autoapp::configuration::Configuration>();
auto configuration = std::make_shared<f1x::openauto::autoapp::configuration::Configuration>();
// 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;
}