Added support for new services provided by AASDK and AAP Protocol version 1.6.

Add extensive logging
Add logo for forked version
Resolve display issue where if Raspberry Pi thinks both HDMI and LCD are enabled, the display width is appearing as two side by side monitors (double width) rather than  just using the physical width of the screen.
This commit is contained in:
Simon Dean 2024-11-21 13:06:19 +00:00
parent e669277eb4
commit b327bd69b2
26 changed files with 187 additions and 162 deletions

View File

@ -2,21 +2,33 @@ cmake_minimum_required(VERSION 3.5.1)
project(openauto CXX)
message(STATUS "OpenAuto")
option(NOPI "Build for Non Raspberry Pi" OFF)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
# Set Compile Versions
set(OPENAUTO_BUILD_DATE 20241028) # Binary Release Build Date
set(OPENAUTO_BUILD_RELEASE 1) # Binary Release Build Number (increment if released on same day)
set(OPENAUTO_BUILD_INCREMENTAL 1) # Binary Build Version - Increment for Each Build
set(OPENAUTO_BUILD_DATE 20241121) # Binary Release Build Date
set(OPENAUTO_BUILD_MAJOR_RELEASE 4) # Binary Release Build Major Number
set(OPENAUTO_BUILD_MINOR_RELEASE 0) # Binary Release Build Minor Number
set(OPENAUTO_BUILD_INCREMENTAL 0) # Binary Build Version - Increment for Each Build
# Configure CMAKE
SET(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_INIT} -Wall -pedantic -fPIC")
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
set(CMAKE_CXX_FLAGS_RELEASE "-g -O3")
set(CMAKE_BUILD_TYPE Debug)
# Default to Release mode unless overridden with -DCMAKE_BUILD_TYPE=Debug on cmake command
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "Forcing Release build type")
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
# Paths
set(resources_directory ${CMAKE_CURRENT_SOURCE_DIR}/assets)
@ -37,23 +49,29 @@ set(Boost_USE_STATIC_RUNTIME OFF)
add_definitions(-DBOOST_ALL_DYN_LINK)
if(CMAKE_BUILD_TYPE STREQUAL "Release")
message(STATUS "Disabling Boost DEBUG logs")
add_definitions(-DNDEBUG)
endif()
if (WIN32)
set(WINSOCK2_LIBRARIES "ws2_32")
endif (WIN32)
add_definitions(-DRPI3_BUILD)
if (RPI3_BUILD)
message(INFO "Compiling for RaspberryPi")
if (DEFINED NOPI)
message(STATUS "Configuring for Non-Raspberry Pi")
else()
message(STATUS "Configuring for RaspberryPi")
add_definitions(-DUSE_OMX -DOMX_SKIP64BIT -DRASPBERRYPI3)
set(BCM_HOST_LIBRARIES "/opt/vc/lib/libbcm_host.so")
set(BCM_HOST_INCLUDE_DIRS "/opt/vc/include")
set(ILCLIENT_INCLUDE_DIRS "/opt/vc/src/hello_pi/libs/ilclient")
set(ILCLIENT_LIBRARIES "/opt/vc/src/hello_pi/libs/ilclient/libilclient.a;/opt/vc/lib/libvcos.so;/opt/vc/lib/libvcilcs.a;/opt/vc/lib/libvchiq_arm.so")
endif (RPI3_BUILD)
endif ()
# Building on a Mac requires Abseil
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") # macOS
message(STATUS "MacOS System Detected")
add_definitions(-DMAC_OS)
find_package(protobuf REQUIRED CONFIG)
find_package(absl REQUIRED)
@ -125,7 +143,12 @@ target_link_libraries(autoapp PUBLIC
${AAP_PROTOBUF_LIB_DIR}
${AASDK_LIB_DIR})
set(PROGRAM_VERSION_STRING "${OPENAUTO_BUILD_MAJOR_RELEASE}.${OPENAUTO_BUILD_MINOR_RELEASE}.${OPENAUTO_BUILD_INCREMENTAL}+${OPENAUTO_BUILD_DATE}")
message(STATUS "Project Version: ${PROGRAM_VERSION_STRING}")
set(btservice_sources_directory ${sources_directory}/btservice)
set(btservice_include_directory ${include_directory}/f1x/openauto/btservice)
file(GLOB_RECURSE btservice_source_files ${btservice_sources_directory}/*.cpp ${btservice_include_directory}/*.hpp ${autoapp_sources_directory}/Configuration/*.cpp ${autoapp_includes_directory}/Configuration/*.hpp ${common_include_directory}/*.hpp)
@ -138,3 +161,12 @@ target_link_libraries(btservice PUBLIC
${Qt5MultimediaWidgets_LIBRARIES}
${PROTOBUF_LIBRARIES}
${AAP_PROTOBUF_LIB_DIR})
set_target_properties(openauto
PROPERTIES VERSION ${LIBRARY_VERSION_STRING} SOVERSION ${LIBRARY_BUILD_INCREMENTAL})
# Install rules
install(TARGETS openauto btservice
EXPORT aasdkTargets
RUNTIME DESTINATION bin
)

7
RELEASE.txt Normal file
View File

@ -0,0 +1,7 @@
Release Notes
20241121 - 4.0.0
Added support for new services provided by AASDK and AAP Protocol version 1.6.
Add extensive logging
Add logo for forked version
Resolve display issue where if Raspberry Pi thinks both HDMI and LCD are enabled, the display width is appearing as two side by side monitors (double width) rather than just using the physical width of the screen.

View File

@ -27,6 +27,9 @@
#include <f1x/openauto/autoapp/Service/IAndroidAutoEntity.hpp>
#include <f1x/openauto/autoapp/Service/IService.hpp>
#include <f1x/openauto/autoapp/Service/IPinger.hpp>
#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>
namespace f1x
{

View File

@ -48,12 +48,16 @@ namespace f1x {
void onBluetoothPairingRequest(
const aap_protobuf::service::bluetooth::message::BluetoothPairingRequest &request) override;
void onBluetoothAuthenticationResult(const aap_protobuf::service::bluetooth::message::BluetoothAuthenticationResult &request) override;
void onChannelError(const aasdk::error::Error &e) override;
private:
using std::enable_shared_from_this<BluetoothService>::shared_from_this;
void sendBluetoothAuthenticationData();
boost::asio::io_service::strand strand_;
aasdk::channel::bluetooth::BluetoothService::Pointer channel_;
projection::IBluetoothDevice::Pointer bluetoothDevice_;

View File

@ -19,6 +19,8 @@
#pragma once
#include <gps.h>
#include <aap_protobuf/service/sensorsource/message/DrivingStatus.pb.h>
#include <aap_protobuf/service/sensorsource/message/SensorType.pb.h>
#include <aasdk/Channel/SensorSource/SensorSourceService.hpp>
#include <f1x/openauto/autoapp/Service/IService.hpp>
#include <boost/asio/io_service.hpp>

View File

@ -24,49 +24,56 @@
#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>
#include <aap_protobuf/aaw/MessageId.pb.h>
#include <aap_protobuf/aaw/Status.pb.h>
#include <aap_protobuf/aaw/WifiConnectionStatus.pb.h>
#include <aap_protobuf/aaw/WifiInfoResponse.pb.h>
#include <aap_protobuf/aaw/WifiVersionRequest.pb.h>
#include <aap_protobuf/aaw/WifiVersionResponse.pb.h>
#include <aap_protobuf/aaw/WifiStartResponse.pb.h>
#include <aap_protobuf/aaw/WifiStartRequest.pb.h>
namespace f1x
{
namespace openauto
{
namespace btservice
{
namespace f1x {
namespace openauto {
namespace btservice {
class AndroidBluetoothServer: public QObject, public IAndroidBluetoothServer
{
Q_OBJECT
class AndroidBluetoothServer : public QObject, public IAndroidBluetoothServer {
Q_OBJECT
public:
AndroidBluetoothServer(autoapp::configuration::IConfiguration::Pointer configuration);
public:
AndroidBluetoothServer(autoapp::configuration::IConfiguration::Pointer configuration);
uint16_t start(const QBluetoothAddress& address) override;
uint16_t start(const QBluetoothAddress &address) override;
private slots:
void onClientConnected();
private slots:
private:
std::unique_ptr<QBluetoothServer> rfcommServer_;
QBluetoothSocket* socket = nullptr;
autoapp::configuration::IConfiguration::Pointer configuration_;
void onClientConnected();
void readSocket();
private:
std::unique_ptr<QBluetoothServer> rfcommServer_;
QBluetoothSocket *socket = nullptr;
autoapp::configuration::IConfiguration::Pointer configuration_;
QByteArray buffer;
void readSocket();
void handleWifiInfoRequest(QByteArray &buffer, uint16_t length);
QByteArray buffer;
void sendMessage(const google::protobuf::Message &message, uint16_t type);
void handleWifiInfoRequest(QByteArray &buffer, uint16_t length);
void handleWifiSecurityRequest(QByteArray &buffer, uint16_t length);
void handleWifiVersionResponse(QByteArray &buffer, uint16_t length);
void handleWifiInfoRequestResponse(QByteArray &buffer, uint16_t length);
void handleWifiConnectionStatus(QByteArray &buffer, uint16_t length);
const ::std::string getIP4_(const QString intf);
};
void handleWifiStartResponse(QByteArray &buffer, uint16_t length);
}
}
void sendMessage(const google::protobuf::Message &message, uint16_t type);
const ::std::string getIP4_(const QString intf);
void DecodeProtoMessage(const std::string &proto_data);
};
}
}
}

View File

@ -198,7 +198,7 @@ void App::waitForDevice()
void App::startServerSocket() {
strand_.dispatch([this, self = this->shared_from_this()]() {
OPENAUTO_LOG(info) << "Listening for WIFI clients on port 5000";
OPENAUTO_LOG(info) << "startServerSocket() - Listening for WIFI Clients on Port 5000";
auto socket = std::make_shared<boost::asio::ip::tcp::socket>(ioService_);
acceptor_.async_accept(
*socket,
@ -208,7 +208,7 @@ void App::startServerSocket() {
}
void App::handleNewClient(std::shared_ptr<boost::asio::ip::tcp::socket> socket, const boost::system::error_code &err) {
OPENAUTO_LOG(info) << "WIFI Client connected";
OPENAUTO_LOG(info) << "handleNewClient() - Handle WIFI Client Connection";
if (!err) {
start(std::move(socket));
}

View File

@ -615,7 +615,7 @@ QString Configuration::getCSValue(QString searchString) const
int equalPosition = line.find("=");
QString value = line.substr(equalPosition + 1).c_str();
value.replace("\"","");
OPENAUTO_LOG(info) << "[Configuration] CS param found: " << searchString.toStdString() << " Value:" << value.toStdString();
OPENAUTO_LOG(debug) << "[Configuration] CS param found: " << searchString.toStdString() << " Value:" << value.toStdString();
return value;
}
}
@ -632,7 +632,7 @@ QString Configuration::getCSValue(QString searchString) const
int equalPosition = line.find("=");
QString value = line.substr(equalPosition + 1).c_str();
value.replace("\"","");
OPENAUTO_LOG(info) << "[Configuration] CS param found: " << searchString.toStdString() << " Value:" << value.toStdString();
OPENAUTO_LOG(debug) << "[Configuration] CS param found: " << searchString.toStdString() << " Value:" << value.toStdString();
return value;
}
}
@ -652,7 +652,7 @@ QString Configuration::getCSValue(QString searchString) const
int equalPosition = line.find("=");
QString value = line.substr(equalPosition + 1).c_str();
value.replace("\"","");
OPENAUTO_LOG(info) << "[Configuration] CS param found: " << searchString.toStdString() << " Value:" << value.toStdString();
OPENAUTO_LOG(debug) << "[Configuration] CS param found: " << searchString.toStdString() << " Value:" << value.toStdString();
return value;
}
}
@ -663,7 +663,7 @@ QString Configuration::getCSValue(QString searchString) const
QString Configuration::getParamFromFile(QString fileName, QString searchString) const
{
OPENAUTO_LOG(info) << "[Configuration] Request param from file: " << fileName.toStdString() << " param: " << searchString.toStdString();
OPENAUTO_LOG(debug) << "[Configuration] Request param from file: " << fileName.toStdString() << " param: " << searchString.toStdString();
using namespace std;
ifstream inFile;
string line;
@ -685,7 +685,7 @@ QString Configuration::getParamFromFile(QString fileName, QString searchString)
int equalPosition = line.find("=");
QString value = line.substr(equalPosition + 1).c_str();
value.replace("\"","");
OPENAUTO_LOG(info) << "[Configuration] Param from file: " << fileName.toStdString() << " found: " << searchString.toStdString() << " Value:" << value.toStdString();
OPENAUTO_LOG(debug) << "[Configuration] Param from file: " << fileName.toStdString() << " found: " << searchString.toStdString() << " Value:" << value.toStdString();
return value;
}
}

View File

@ -42,7 +42,7 @@ LocalBluetoothDevice::LocalBluetoothDevice()
void LocalBluetoothDevice::createBluetoothLocalDevice()
{
OPENAUTO_LOG(debug) << "[LocalBluetoothDevice] create.";
OPENAUTO_LOG(info) << "[LocalBluetoothDevice] create.";
localDevice_ = std::make_unique<QBluetoothLocalDevice>(QBluetoothAddress());
@ -118,7 +118,7 @@ void LocalBluetoothDevice::onStartPairing(const QString& address, PairingPromise
void LocalBluetoothDevice::onPairingDisplayConfirmation(const QBluetoothAddress &address, QString pin)
{
OPENAUTO_LOG(debug) << "[LocalBluetoothDevice] onPairingDisplayConfirmation, address: " << address.toString().toStdString()
OPENAUTO_LOG(info) << "[LocalBluetoothDevice] onPairingDisplayConfirmation, address: " << address.toString().toStdString()
<< ", pin: " << pin.toStdString();
std::lock_guard<decltype(mutex_)> lock(mutex_);
@ -127,7 +127,7 @@ void LocalBluetoothDevice::onPairingDisplayConfirmation(const QBluetoothAddress
void LocalBluetoothDevice::onPairingDisplayPinCode(const QBluetoothAddress &address, QString pin)
{
OPENAUTO_LOG(debug) << "[LocalBluetoothDevice] onPairingDisplayPinCode, address: " << address.toString().toStdString()
OPENAUTO_LOG(info) << "[LocalBluetoothDevice] onPairingDisplayPinCode, address: " << address.toString().toStdString()
<< ", pin: " << pin.toStdString();
std::lock_guard<decltype(mutex_)> lock(mutex_);
@ -136,7 +136,7 @@ void LocalBluetoothDevice::onPairingDisplayPinCode(const QBluetoothAddress &addr
void LocalBluetoothDevice::onPairingFinished(const QBluetoothAddress &address, QBluetoothLocalDevice::Pairing pairing)
{
OPENAUTO_LOG(debug) << "[LocalBluetoothDevice] onPairingDisplayPinCode, address: " << address.toString().toStdString()
OPENAUTO_LOG(info) << "[LocalBluetoothDevice] onPairingDisplayPinCode, address: " << address.toString().toStdString()
<< ", pin: " << pairing;
std::lock_guard<decltype(mutex_)> lock(mutex_);
@ -159,7 +159,7 @@ void LocalBluetoothDevice::onPairingFinished(const QBluetoothAddress &address, Q
void LocalBluetoothDevice::onError(QBluetoothLocalDevice::Error error)
{
OPENAUTO_LOG(debug) << "[LocalBluetoothDevice] onError, error: " << error;
OPENAUTO_LOG(warning) << "[LocalBluetoothDevice] onError, error: " << error;
std::lock_guard<decltype(mutex_)> lock(mutex_);

View File

@ -58,7 +58,7 @@ bool OMXVideoOutput::open()
{
std::lock_guard<decltype(mutex_)> lock(mutex_);
OPENAUTO_LOG(info) << "[OMXVideoOutput] open.";
OPENAUTO_LOG(debug) << "[OMXVideoOutput] open.";
bcm_host_init();
if(OMX_Init() != OMX_ErrorNone)
@ -102,7 +102,7 @@ bool OMXVideoOutput::init()
{
std::lock_guard<decltype(mutex_)> lock(mutex_);
OPENAUTO_LOG(info) << "[OMXVideoOutput] init, state: " << isActive_;
OPENAUTO_LOG(debug) << "[OMXVideoOutput] init, state: " << isActive_;
ilclient_change_component_state(components_[VideoComponent::DECODER], OMX_StateExecuting);
return this->setupDisplayRegion();
@ -179,7 +179,7 @@ void OMXVideoOutput::write(uint64_t timestamp, const aasdk::common::DataConstBuf
void OMXVideoOutput::stop()
{
OPENAUTO_LOG(info) << "[OMXVideoOutput] stop.";
OPENAUTO_LOG(debug) << "[OMXVideoOutput] stop.";
std::lock_guard<decltype(mutex_)> lock(mutex_);

View File

@ -49,7 +49,7 @@ QtAudioInput::QtAudioInput(uint32_t channelCount, uint32_t sampleSize, uint32_t
void QtAudioInput::createAudioInput()
{
OPENAUTO_LOG(debug) << "[AudioInput] create.";
OPENAUTO_LOG(info) << "[AudioInput] createAudioInput()";
audioInput_ = (std::make_unique<QAudioInput>(QAudioDeviceInfo::defaultInputDevice(), audioFormat_));
}

View File

@ -54,7 +54,7 @@ QtAudioOutput::QtAudioOutput(uint32_t channelCount, uint32_t sampleSize, uint32_
void QtAudioOutput::createAudioOutput()
{
OPENAUTO_LOG(debug) << "[QtAudioOutput] create.";
OPENAUTO_LOG(info) << "[QtAudioOutput] createAudioOutput()";
audioOutput_ = std::make_unique<QAudioOutput>(QAudioDeviceInfo::defaultOutputDevice(), audioFormat_);
}

View File

@ -40,7 +40,7 @@ QtVideoOutput::QtVideoOutput(configuration::IConfiguration::Pointer configuratio
void QtVideoOutput::createVideoOutput()
{
OPENAUTO_LOG(debug) << "[QtVideoOutput] create.";
OPENAUTO_LOG(info) << "[QtVideoOutput] createVideoOutput()";
videoWidget_ = std::make_unique<QVideoWidget>();
mediaPlayer_ = std::make_unique<QMediaPlayer>(nullptr, QMediaPlayer::StreamPlayback);
}
@ -79,6 +79,7 @@ void QtVideoOutput::onStartPlayback()
mediaPlayer_->setMedia(QMediaContent(), &videoBuffer_);
mediaPlayer_->play();
// TODO: This only outputs a line if there's an error - FIXME - Output a proper status instead
OPENAUTO_LOG(debug) << "Player error state -> " << mediaPlayer_->errorString().toStdString();
}

View File

@ -60,6 +60,7 @@ bool RtAudioOutput::open()
}
catch(const RtAudioError& e)
{
// TODO: Later version of RtAudio uses a different mechanism - FIXME - support new versions
OPENAUTO_LOG(error) << "[RtAudioOutput] Failed to open audio output, what: " << e.what();
}
}

View File

@ -16,64 +16,10 @@
* along with openauto. If not, see <http://www.gnu.org/licenses/>.
*/
#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>
/*
* HU > MD Version Request
* HU < MD ServiceDiscoveryRequest **
* HU > MD Car MetaData (Make, Model, year etc) **
* HU < MD when Video Projection starts, it MUST be shown without User Ineraction ***********
* HU < MD Prompt Use to Enable and Pair with Car ***********
* HU < MD Request Video Focus for Projection (HU Grant) ***********
*
* AAP needs Bluetooth HFP for Telephone
*
* HU > MD Bluetooth Announcement (HU MAC Address, Supported Pairing Methods) Done as Service Discovery
* HU < MD Bluetooth Pairing Request ***********
* HU > MD Bluetoth Pairing Response***********
*
* AfterPairing, HU can request the Bluetooth PhoneBookAccessProtocol. Sensible UI.
*
* HU < MD connect to Bluetooth HFP***********
* HU Suppress BAP or MAP while AAP connected.***********
* A2DP should be treated by OEM as another such such as a USB stick or radio. If the user plays music via AA, HU should grant request from AA to change focus to AA. HU manages connectivity., ***********
* MD connects to HU and routes call over Bluetooth (non Bluetooth call) ***********
* MD connects Blueooth call and display projection mode ***********
* MD on call to HFP device - MD continues call, disconnects from other HFP and connects to HFP on Vehicle. ***********
* AA only uses HFP, hhowever HU may use MAP, PBAP, PAN and RSAP ***********
* MD will reconnect when required. ***********
*
* Video
* HU < MD - During Service Discovery, MD requests Video Configs supported
* HU > MD sends Config Message with Prioritised indices for Video Conffigurations
* HU < MD MD selects config
* HU < MD sends start message
* HU < MD sends focus request
* HU > MD sends focus granted (unless unsafe - ie reverse camera etc)
* HU < MD Audio Focus Requests when MD wants to play.
* HU > MD Audio Focus Navigations (can be unsolicited or responses to requests)
* HU < MD VoiceSessionRequestNotification with VOICE_SESSION_START, HU should stop all sounds. MD will request GAIN or GAIN_TRANS to play beeps/tones and ASR response.
* Nav Focus for onboard navigation.
* UI System Sounds does not require audio focus as sounds should be played ASAP. System Stream is optionals (not required to support).
* HU should wait to receive two frames of audio before starting playback to minimise buffer underruns.
* AA Latency types supported - Audio Setup - max 500ms, Audio Output max 50ms.
* HU > MD Navigation Focus Notification specified with NF is Phone or Car.
* HU < MD Navigation Focus Request
* "For vehicles that support next turn information in the instrument cluster, the HU can subscribe to next turn updates from the MD navigation engine." (NExt Turn etc)
* same for Media Playback Status
* Radio - Allows Control of Radio from Within AA.
* Vehicle IDs SHOULD have at least 64 bits
*/
namespace f1x {
namespace openauto {
namespace autoapp {
@ -369,7 +315,7 @@ namespace f1x {
}
void AndroidAutoEntity::onChannelError(const aasdk::error::Error &e) {
OPENAUTO_LOG(error) << "[AndroidAutoEntity] onChannelError(): " << e.what();
OPENAUTO_LOG(fatal) << "[AndroidAutoEntity] onChannelError(): " << e.what();
this->triggerQuit();
}
@ -381,7 +327,7 @@ namespace f1x {
}
void AndroidAutoEntity::schedulePing() {
OPENAUTO_LOG(debug) << "[AndroidAutoEntity] schedulePing()";
OPENAUTO_LOG(info) << "[AndroidAutoEntity] schedulePing()";
auto promise = IPinger::Promise::defer(strand_);
promise->then([this, self = this->shared_from_this()]() {
this->sendPing();

View File

@ -65,7 +65,7 @@ namespace f1x {
OPENAUTO_LOG(info) << "[BluetoothService] fillFeatures()";
if (bluetoothDevice_->isAvailable()) {
OPENAUTO_LOG(debug) << "[BluetoothService] Local Address: " << bluetoothDevice_->getLocalAddress();
OPENAUTO_LOG(info) << "[BluetoothService] Local Address: " << bluetoothDevice_->getLocalAddress();
auto *service = response.add_channels();
service->set_id(static_cast<uint32_t>(channel_->getId()));
@ -101,7 +101,7 @@ namespace f1x {
void BluetoothService::onBluetoothPairingRequest(
const aap_protobuf::service::bluetooth::message::BluetoothPairingRequest &request) {
OPENAUTO_LOG(info) << "[BluetoothService] onBluetoothPairingRequest()";
OPENAUTO_LOG(debug) << "[BluetoothService] Phone Address: " << request.phone_address();
OPENAUTO_LOG(info) << "[BluetoothService] Phone Address: " << request.phone_address();
aap_protobuf::service::bluetooth::message::BluetoothPairingResponse response;
@ -122,9 +122,27 @@ namespace f1x {
response.set_already_paired(isPaired);
auto promise = aasdk::channel::SendPromise::defer(strand_);
promise->then([]() {}, std::bind(&BluetoothService::onChannelError, this->shared_from_this(),
promise->then(std::bind(&BluetoothService::sendBluetoothAuthenticationData, this->shared_from_this()), std::bind(&BluetoothService::onChannelError, this->shared_from_this(),
std::placeholders::_1));
channel_->sendBluetoothPairingResponse(response, std::move(promise));
channel_->receive(this->shared_from_this());
}
void BluetoothService::sendBluetoothAuthenticationData() {
aap_protobuf::service::bluetooth::message::BluetoothAuthenticationData data;
data.set_auth_data("123456");
data.set_pairing_method(aap_protobuf::service::bluetooth::message::BluetoothPairingMethod::BLUETOOTH_PAIRING_PIN);
auto promise = aasdk::channel::SendPromise::defer(strand_);
promise->then([]() {}, std::bind(&BluetoothService::onChannelError, this->shared_from_this(),
std::placeholders::_1));
channel_->sendBluetoothAuthenticationData(data, std::move(promise));
channel_->receive(this->shared_from_this());
}
void BluetoothService::onBluetoothAuthenticationResult(const aap_protobuf::service::bluetooth::message::BluetoothAuthenticationResult &request) {
OPENAUTO_LOG(info) << "[BluetoothService] onBluetoothAuthenticationResult()";
OPENAUTO_LOG(info) << "[BluetoothService] AuthData " << request.status();
aap_protobuf::service::bluetooth::message::BluetoothPairingResponse response;
channel_->receive(this->shared_from_this());
}

View File

@ -16,7 +16,6 @@
* along with openauto. If not, see <http://www.gnu.org/licenses/>.
*/
#include <aap_protobuf/service/inputsource/message/InputReport.pb.h>
#include <f1x/openauto/Common/Log.hpp>
#include <f1x/openauto/autoapp/Service/InputSource/InputSourceService.hpp>
@ -101,7 +100,7 @@ namespace f1x {
}
void InputSourceService::onKeyBindingRequest(const aap_protobuf::service::media::sink::message::KeyBindingRequest &request) {
OPENAUTO_LOG(info) << "[InputSourceService] onKeyBindingRequest()";
OPENAUTO_LOG(debug) << "[InputSourceService] onKeyBindingRequest()";
OPENAUTO_LOG(debug) << "[InputSourceService] KeyCodes Count: " << request.keycodes_size();
aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS;

View File

@ -130,7 +130,7 @@ namespace f1x {
OPENAUTO_LOG(info) << "[AudioMediaSinkService] onChannelOpenRequest()";
OPENAUTO_LOG(info) << "[AudioMediaSinkService] Channel Id: " << request.service_id() << ", Priority: " << request.priority();
OPENAUTO_LOG(debug) << "[AudioMediaSinkService] Sample Rate: " << audioOutput_->getSampleRate() << ", Sample Size: " << audioOutput_->getSampleSize() << ", Audio Channels: " << audioOutput_->getChannelCount();
OPENAUTO_LOG(info) << "[AudioMediaSinkService] Sample Rate: " << audioOutput_->getSampleRate() << ", Sample Size: " << audioOutput_->getSampleSize() << ", Audio Channels: " << audioOutput_->getChannelCount();
const aap_protobuf::shared::MessageStatus status = audioOutput_->open()
? aap_protobuf::shared::MessageStatus::STATUS_SUCCESS
@ -185,8 +185,8 @@ namespace f1x {
}
void AudioMediaSinkService::onMediaChannelStopIndication(const aap_protobuf::service::media::shared::message::Stop &indication) {
OPENAUTO_LOG(debug) << "[AudioMediaSinkService] onMediaChannelStopIndication()";
OPENAUTO_LOG(debug) << "[AudioMediaSinkService] Channel Id: " << aasdk::messenger::channelIdToString(channel_->getId()) << ", session: " << session_;
OPENAUTO_LOG(info) << "[AudioMediaSinkService] onMediaChannelStopIndication()";
OPENAUTO_LOG(info) << "[AudioMediaSinkService] Channel Id: " << aasdk::messenger::channelIdToString(channel_->getId()) << ", session: " << session_;
session_ = -1;
audioOutput_->suspend();

View File

@ -91,11 +91,11 @@ namespace f1x {
videoConfig1->set_width_margin(videoMargins.width());
videoConfig1->set_density(videoOutput_->getScreenDPI());
OPENAUTO_LOG(debug) << "[VideoMediaSinkService] getVideoResolution " << VideoCodecResolutionType_Name(videoOutput_->getVideoResolution());
OPENAUTO_LOG(debug) << "[VideoMediaSinkService] getVideoFPS " << VideoFrameRateType_Name(videoOutput_->getVideoFPS());
OPENAUTO_LOG(debug) << "[VideoMediaSinkService] width " << videoMargins.width();
OPENAUTO_LOG(debug) << "[VideoMediaSinkService] height " << videoMargins.height();
OPENAUTO_LOG(debug) << "[VideoMediaSinkService] getScreenDPI " << videoOutput_->getScreenDPI();
OPENAUTO_LOG(info) << "[VideoMediaSinkService] getVideoResolution " << VideoCodecResolutionType_Name(videoOutput_->getVideoResolution());
OPENAUTO_LOG(info) << "[VideoMediaSinkService] getVideoFPS " << VideoFrameRateType_Name(videoOutput_->getVideoFPS());
OPENAUTO_LOG(info) << "[VideoMediaSinkService] width " << videoMargins.width();
OPENAUTO_LOG(info) << "[VideoMediaSinkService] height " << videoMargins.height();
OPENAUTO_LOG(info) << "[VideoMediaSinkService] getScreenDPI " << videoOutput_->getScreenDPI();
}
void
@ -110,7 +110,7 @@ namespace f1x {
? aap_protobuf::service::media::shared::message::Config::STATUS_READY
: aap_protobuf::service::media::shared::message::Config::STATUS_WAIT;
OPENAUTO_LOG(info) << "[VideoMediaSinkService] setup status: " << Config_Status_Name(status);
OPENAUTO_LOG(debug) << "[VideoMediaSinkService] setup status: " << Config_Status_Name(status);
aap_protobuf::service::media::shared::message::Config response;
response.set_status(status);

View File

@ -100,7 +100,7 @@ namespace f1x {
? aap_protobuf::shared::MessageStatus::STATUS_SUCCESS
: aap_protobuf::shared::MessageStatus::STATUS_INTERNAL_ERROR;
OPENAUTO_LOG(debug) << "[MediaSourceService] Status determined: " << aap_protobuf::shared::MessageStatus_Name(status);
OPENAUTO_LOG(info) << "[MediaSourceService] Status determined: " << aap_protobuf::shared::MessageStatus_Name(status);
aap_protobuf::service::control::message::ChannelOpenResponse response;
response.set_status(status);
@ -251,7 +251,7 @@ namespace f1x {
* Reads audio from a MediaSource (eg Microphone). Promise resolves to onMediaSourceDataReady.
*/
void MediaSourceService::readMediaSource() {
OPENAUTO_LOG(error) << "[MediaSourceService] readMediaSource()";
OPENAUTO_LOG(debug) << "[MediaSourceService] readMediaSource()";
if (audioInput_->isActive()) {
auto readPromise = projection::IAudioInput::ReadPromise::defer(strand_);
readPromise->then(

View File

@ -37,25 +37,25 @@ namespace f1x {
void RadioService::start() {
strand_.dispatch([this, self = this->shared_from_this()]() {
OPENAUTO_LOG(info) << "[RadioService] start()";
OPENAUTO_LOG(debug) << "[RadioService] start()";
});
}
void RadioService::stop() {
strand_.dispatch([this, self = this->shared_from_this()]() {
OPENAUTO_LOG(info) << "[RadioService] stop()";
OPENAUTO_LOG(debug) << "[RadioService] stop()";
});
}
void RadioService::pause() {
strand_.dispatch([this, self = this->shared_from_this()]() {
OPENAUTO_LOG(info) << "[RadioService] pause()";
OPENAUTO_LOG(debug) << "[RadioService] pause()";
});
}
void RadioService::resume() {
strand_.dispatch([this, self = this->shared_from_this()]() {
OPENAUTO_LOG(info) << "[RadioService] resume()";
OPENAUTO_LOG(debug) << "[RadioService] resume()";
});
}

View File

@ -16,8 +16,7 @@
* along with openauto. If not, see <http://www.gnu.org/licenses/>.
*/
#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>

View File

@ -69,7 +69,7 @@ namespace f1x {
serviceList.emplace_back(this->createSensorService(messenger));
serviceList.emplace_back(this->createBluetoothService(messenger));
serviceList.emplace_back(this->createInputService(messenger));
serviceList.emplace_back(this->createWifiProjectionService(messenger));
//serviceList.emplace_back(this->createWifiProjectionService(messenger));
return serviceList;
}
@ -79,20 +79,20 @@ namespace f1x {
projection::IBluetoothDevice::Pointer bluetoothDevice;
switch (configuration_->getBluetoothAdapterType()) {
case configuration::BluetoothAdapterType::LOCAL:
OPENAUTO_LOG(info) << "[ServiceFactory] Local Bluetooth";
OPENAUTO_LOG(info) << "[ServiceFactory] Using Local Bluetooth Adapter";
bluetoothDevice = projection::IBluetoothDevice::Pointer(new projection::LocalBluetoothDevice(),
std::bind(&QObject::deleteLater,
std::placeholders::_1));
break;
case configuration::BluetoothAdapterType::REMOTE:
OPENAUTO_LOG(info) << "[ServiceFactory] Remote Bluetooth";
OPENAUTO_LOG(debug) << "[ServiceFactory] Using Remote Bluetooth Adapter";
bluetoothDevice = std::make_shared<projection::RemoteBluetoothDevice>(
configuration_->getBluetoothRemoteAdapterAddress());
break;
default:
OPENAUTO_LOG(info) << "[ServiceFactory] Dummy Bluetooth";
OPENAUTO_LOG(debug) << "[ServiceFactory] Using Dummy Bluetooth";
bluetoothDevice = std::make_shared<projection::DummyBluetoothDevice>();
break;
}
@ -151,7 +151,8 @@ namespace f1x {
std::bind(&QObject::deleteLater, std::placeholders::_1));
serviceList.emplace_back(
std::make_shared<mediasink::GuidanceAudioService>(ioService_, messenger, std::move(guidanceAudioOutput)));
std::make_shared<mediasink::GuidanceAudioService>(ioService_, messenger,
std::move(guidanceAudioOutput)));
}
if (configuration_->telephonyAudioChannelEnabled()) {
@ -162,8 +163,9 @@ namespace f1x {
projection::IAudioOutput::Pointer(new projection::QtAudioOutput(1, 16, 16000),
std::bind(&QObject::deleteLater, std::placeholders::_1));
// serviceList.emplace_back(
// std::make_shared<mediasink::TelephonyAudioService>(ioService_, messenger, std::move(telephonyAudioOutput)));
serviceList.emplace_back(
std::make_shared<mediasink::TelephonyAudioService>(ioService_, messenger,
std::move(telephonyAudioOutput)));
}
/*
@ -197,7 +199,8 @@ namespace f1x {
OPENAUTO_LOG(info) << "[ServiceFactory] createMediaSourceServices()";
projection::IAudioInput::Pointer audioInput(new projection::QtAudioInput(1, 16, 16000),
std::bind(&QObject::deleteLater, std::placeholders::_1));
serviceList.emplace_back(std::make_shared<mediasource::MicrophoneMediaSourceService>(ioService_, messenger, std::move(audioInput)));
serviceList.emplace_back(std::make_shared<mediasource::MicrophoneMediaSourceService>(ioService_, messenger,
std::move(audioInput)));
}
IService::Pointer ServiceFactory::createSensorService(aasdk::messenger::IMessenger::Pointer messenger) {

View File

@ -263,6 +263,7 @@ namespace f1x {
configuration_->setMusicAudioChannelEnabled(ui_->checkBoxMusicAudioChannel->isChecked());
configuration_->setGuidanceAudioChannelEnabled(ui_->checkBoxSpeechAudioChannel->isChecked());
configuration_->setTelephonyAudioChannelEnabled(ui_->checkBoxVoiceAudioChannel->isChecked());
configuration_->setAudioOutputBackendType(
ui_->radioButtonRtAudio->isChecked() ? configuration::AudioOutputBackendType::RTAUDIO
: configuration::AudioOutputBackendType::QT);
@ -547,6 +548,7 @@ namespace f1x {
ui_->checkBoxMusicAudioChannel->setChecked(configuration_->musicAudioChannelEnabled());
ui_->checkBoxSpeechAudioChannel->setChecked(configuration_->guidanceAudioChannelEnabled());
ui_->telephonyAudioChannelEnabled->setChecked(configuration_->guidanceAudioChannelEnabled());
const auto &audioOutputBackendType = configuration_->getAudioOutputBackendType();
ui_->radioButtonRtAudio->setChecked(audioOutputBackendType == configuration::AudioOutputBackendType::RTAUDIO);

View File

@ -18,6 +18,7 @@
#include <thread>
#include <QApplication>
#include <QScreen>
#include <QDesktopWidget>
#include <aasdk/USB/USBHub.hpp>
#include <aasdk/USB/ConnectedAccessoriesEnumerator.hpp>
@ -75,7 +76,7 @@ int main(int argc, char* argv[])
libusb_context* usbContext;
if(libusb_init(&usbContext) != 0)
{
OPENAUTO_LOG(error) << "[AutoApp] libusb init failed.";
OPENAUTO_LOG(error) << "[AutoApp] libusb_init failed.";
return 1;
}
@ -137,57 +138,57 @@ int main(int argc, char* argv[])
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraHide, [&qApplication]() {
system("/opt/crankshaft/cameracontrol.py Background &");
OPENAUTO_LOG(info) << "[AutoApp] Camera Background.";
OPENAUTO_LOG(debug) << "[AutoApp] Camera Background.";
});
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraShow, [&qApplication]() {
system("/opt/crankshaft/cameracontrol.py Foreground &");
OPENAUTO_LOG(info) << "[AutoApp] Camera Foreground.";
OPENAUTO_LOG(debug) << "[AutoApp] Camera Foreground.";
});
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraPosYUp, [&qApplication]() {
system("/opt/crankshaft/cameracontrol.py PosYUp &");
OPENAUTO_LOG(info) << "[AutoApp] Camera PosY up.";
OPENAUTO_LOG(debug) << "[AutoApp] Camera PosY up.";
});
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraPosYDown, [&qApplication]() {
system("/opt/crankshaft/cameracontrol.py PosYDown &");
OPENAUTO_LOG(info) << "[AutoApp] Camera PosY down.";
OPENAUTO_LOG(debug) << "[AutoApp] Camera PosY down.";
});
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraZoomPlus, [&qApplication]() {
system("/opt/crankshaft/cameracontrol.py ZoomPlus &");
OPENAUTO_LOG(info) << "[AutoApp] Camera Zoom plus.";
OPENAUTO_LOG(debug) << "[AutoApp] Camera Zoom plus.";
});
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraZoomMinus, [&qApplication]() {
system("/opt/crankshaft/cameracontrol.py ZoomMinus &");
OPENAUTO_LOG(info) << "[AutoApp] Camera Zoom minus.";
OPENAUTO_LOG(debug) << "[AutoApp] Camera Zoom minus.";
});
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraRecord, [&qApplication]() {
system("/opt/crankshaft/cameracontrol.py Record &");
OPENAUTO_LOG(info) << "[AutoApp] Camera Record.";
OPENAUTO_LOG(debug) << "[AutoApp] Camera Record.";
});
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraStop, [&qApplication]() {
system("/opt/crankshaft/cameracontrol.py Stop &");
OPENAUTO_LOG(info) << "[AutoApp] Camera Stop.";
OPENAUTO_LOG(debug) << "[AutoApp] Camera Stop.";
});
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraSave, [&qApplication]() {
system("/opt/crankshaft/cameracontrol.py Save &");
OPENAUTO_LOG(info) << "[AutoApp] Camera Save.";
OPENAUTO_LOG(debug) << "[AutoApp] Camera Save.";
});
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::TriggerScriptNight, [&qApplication]() {
system("/opt/crankshaft/service_daynight.sh app night");
OPENAUTO_LOG(info) << "[AutoApp] MainWindow Night.";
OPENAUTO_LOG(debug) << "[AutoApp] MainWindow Night.";
});
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::TriggerScriptDay, [&qApplication]() {
system("/opt/crankshaft/service_daynight.sh app day");
OPENAUTO_LOG(info) << "[AutoApp] MainWindow Day.";
OPENAUTO_LOG(debug) << "[AutoApp] MainWindow Day.";
});
mainWindow.showFullScreen();
@ -209,7 +210,7 @@ int main(int argc, char* argv[])
});
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::TriggerAppStart, [&app]() {
OPENAUTO_LOG(info) << "[AutoApp] TriggerAppStart: Manual start android auto.";
OPENAUTO_LOG(debug) << "[AutoApp] TriggerAppStart: Manual start android auto.";
try {
app->disableAutostartEntity = false;
app->resume();
@ -222,7 +223,7 @@ int main(int argc, char* argv[])
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::TriggerAppStop, [&app]() {
try {
if (std::ifstream("/tmp/android_device")) {
OPENAUTO_LOG(info) << "[AutoApp] TriggerAppStop: Manual stop usb android auto.";
OPENAUTO_LOG(debug) << "[AutoApp] TriggerAppStop: Manual stop usb android auto.";
app->disableAutostartEntity = true;
system("/usr/local/bin/autoapp_helper usbreset");
usleep(500000);
@ -234,7 +235,7 @@ int main(int argc, char* argv[])
}
} else {
OPENAUTO_LOG(info) << "[AutoApp] TriggerAppStop: Manual stop wifi android auto.";
OPENAUTO_LOG(debug) << "[AutoApp] TriggerAppStop: Manual stop wifi android auto.";
try {
app->onAndroidAutoQuit();
//app->pause();
@ -244,7 +245,7 @@ int main(int argc, char* argv[])
}
} catch (...) {
OPENAUTO_LOG(info) << "[AutoApp] Exception in manual stop android auto.";
OPENAUTO_LOG(error) << "[AutoApp] Exception in manual stop android auto.";
}
});
@ -253,7 +254,7 @@ int main(int argc, char* argv[])
connectdialog.close();
warningdialog.close();
updatedialog.close();
OPENAUTO_LOG(info) << "[AutoApp] Close all possible open dialogs.";
OPENAUTO_LOG(debug) << "[AutoApp] Close all possible open dialogs.";
});
if (configuration->hideWarning() == false) {