From 173225970facbc1b08baa8c51b44d59f2b5f44fe Mon Sep 17 00:00:00 2001 From: Simon Dean Date: Wed, 13 Nov 2024 15:09:20 +0000 Subject: [PATCH] Remove logging. Bolster WifiProjection --- CMakeLists.txt | 3 ++ src/autoapp/App.cpp | 4 +- src/autoapp/Projection/InputDevice.cpp | 4 +- src/autoapp/Service/AndroidAutoEntity.cpp | 43 +++++++++--------- .../Service/Bluetooth/BluetoothService.cpp | 7 ++- .../GenericNotificationService.cpp | 2 +- .../InputSource/InputSourceService.cpp | 6 +-- .../MediaSink/AudioMediaSinkService.cpp | 11 +++-- .../MediaSink/VideoMediaSinkService.cpp | 20 ++++----- .../MediaSource/MediaSourceService.cpp | 10 ++--- .../PhoneStatus/PhoneStatusService.cpp | 2 +- src/autoapp/Service/Pinger.cpp | 4 +- src/autoapp/Service/Radio/RadioService.cpp | 2 +- src/autoapp/Service/Sensor/SensorService.cpp | 8 ++-- .../WifiProjection/WifiProjectionStatus.cpp | 14 +++--- src/autoapp/autoapp.cpp | 44 +++++++++---------- src/btservice/AndroidBluetoothServer.cpp | 3 +- 17 files changed, 91 insertions(+), 96 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 79cf6c3..a212b6e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,7 +41,10 @@ if (WIN32) set(WINSOCK2_LIBRARIES "ws2_32") endif (WIN32) +add_definitions(-DRPI3_BUILD) + if (RPI3_BUILD) + message(INFO "Compiling for RaspberryPi") add_definitions(-DUSE_OMX -DOMX_SKIP64BIT -DRASPBERRYPI3) set(BCM_HOST_LIBRARIES "/opt/vc/lib/libbcm_host.so") set(BCM_HOST_INCLUDE_DIRS "/opt/vc/include") diff --git a/src/autoapp/App.cpp b/src/autoapp/App.cpp index b016ea2..65d575d 100644 --- a/src/autoapp/App.cpp +++ b/src/autoapp/App.cpp @@ -238,7 +238,7 @@ void App::resume() void App::onAndroidAutoQuit() { strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[App] onAndroidAutoQuit."; + OPENAUTO_LOG(info) << "[App] onAndroidAutoQuit()"; //acceptor_.close(); @@ -268,7 +268,7 @@ void App::onAndroidAutoQuit() void App::onUSBHubError(const aasdk::error::Error& error) { - OPENAUTO_LOG(error) << "[App] usb hub error: " << error.what(); + OPENAUTO_LOG(error) << "[App] onUSBHubError(): " << error.what(); // if(error != aasdk::error::ErrorCode::OPERATION_ABORTED && // error != aasdk::error::ErrorCode::OPERATION_IN_PROGRESS) diff --git a/src/autoapp/Projection/InputDevice.cpp b/src/autoapp/Projection/InputDevice.cpp index 3f7ac95..8cefd9a 100644 --- a/src/autoapp/Projection/InputDevice.cpp +++ b/src/autoapp/Projection/InputDevice.cpp @@ -43,7 +43,7 @@ void InputDevice::start(IInputDeviceEventHandler& eventHandler) { std::lock_guard lock(mutex_); - OPENAUTO_LOG(info) << "[InputDevice] start."; + OPENAUTO_LOG(info) << "[InputDevice] start()"; eventHandler_ = &eventHandler; parent_.installEventFilter(this); } @@ -52,7 +52,7 @@ void InputDevice::stop() { std::lock_guard lock(mutex_); - OPENAUTO_LOG(info) << "[InputDevice] stop."; + OPENAUTO_LOG(info) << "[InputDevice] stop()"; parent_.removeEventFilter(this); eventHandler_ = nullptr; } diff --git a/src/autoapp/Service/AndroidAutoEntity.cpp b/src/autoapp/Service/AndroidAutoEntity.cpp index c69d8ef..0f35cd7 100644 --- a/src/autoapp/Service/AndroidAutoEntity.cpp +++ b/src/autoapp/Service/AndroidAutoEntity.cpp @@ -103,13 +103,12 @@ namespace f1x { eventHandler_ = eventHandler; std::for_each(serviceList_.begin(), serviceList_.end(), std::bind(&IService::start, std::placeholders::_1)); - OPENAUTO_LOG(info) << "[AndroidAutoEntity] Event handlers added."; auto versionRequestPromise = aasdk::channel::SendPromise::defer(strand_); - versionRequestPromise->then([]() { OPENAUTO_LOG(info) << "[AndroidAutoEntity] SUCCESS: Version request sent."; }, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), + versionRequestPromise->then([]() { }, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), std::placeholders::_1)); - OPENAUTO_LOG(info) << "[AndroidAutoEntity] Send Version Request."; + OPENAUTO_LOG(debug) << "[AndroidAutoEntity] Send Version Request."; controlServiceChannel_->sendVersionRequest(std::move(versionRequestPromise)); controlServiceChannel_->receive(this->shared_from_this()); }); @@ -128,7 +127,7 @@ namespace f1x { transport_->stop(); cryptor_->deinit(); } catch (...) { - OPENAUTO_LOG(info) << "[AndroidAutoEntity] stop() - exception when stopping."; + OPENAUTO_LOG(error) << "[AndroidAutoEntity] stop() - exception when stopping."; } }); } @@ -141,7 +140,7 @@ namespace f1x { std::for_each(serviceList_.begin(), serviceList_.end(), std::bind(&IService::pause, std::placeholders::_1)); } catch (...) { - OPENAUTO_LOG(info) << "[AndroidAutoEntity] pause() - exception when pausing."; + OPENAUTO_LOG(error) << "[AndroidAutoEntity] pause() - exception when pausing."; } }); } @@ -154,7 +153,7 @@ namespace f1x { std::for_each(serviceList_.begin(), serviceList_.end(), std::bind(&IService::resume, std::placeholders::_1)); } catch (...) { - OPENAUTO_LOG(info) << "[AndroidAutoEntity] resume() exception when resuming."; + OPENAUTO_LOG(error) << "[AndroidAutoEntity] resume() exception when resuming."; } }); } @@ -169,14 +168,14 @@ namespace f1x { OPENAUTO_LOG(error) << "[AndroidAutoEntity] Version mismatch."; this->triggerQuit(); } else { - OPENAUTO_LOG(info) << "[AndroidAutoEntity] Version matches."; + OPENAUTO_LOG(debug) << "[AndroidAutoEntity] Version matches."; try { OPENAUTO_LOG(info) << "[AndroidAutoEntity] Beginning SSL handshake."; cryptor_->doHandshake(); auto handshakePromise = aasdk::channel::SendPromise::defer(strand_); - handshakePromise->then([]() { OPENAUTO_LOG(info) << "[AndroidAutoEntity] SUCCESS: Sent SSL handshake."; }, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), + handshakePromise->then([]() { }, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), std::placeholders::_1)); controlServiceChannel_->sendHandshake(cryptor_->readHandshakeBuffer(), std::move(handshakePromise)); controlServiceChannel_->receive(this->shared_from_this()); @@ -190,7 +189,7 @@ namespace f1x { void AndroidAutoEntity::onHandshake(const aasdk::common::DataConstBuffer &payload) { OPENAUTO_LOG(info) << "[AndroidAutoEntity] onHandshake()"; - OPENAUTO_LOG(info) << "[AndroidAutoEntity] Payload size: " << payload.size; + OPENAUTO_LOG(debug) << "[AndroidAutoEntity] Payload size: " << payload.size; try { cryptor_->writeHandshakeBuffer(payload); @@ -217,7 +216,7 @@ namespace f1x { controlServiceChannel_->receive(this->shared_from_this()); } catch (const aasdk::error::Error &e) { - OPENAUTO_LOG(info) << "[AndroidAutoEntity] Error during handshake"; + OPENAUTO_LOG(error) << "[AndroidAutoEntity] Error during handshake"; this->onChannelError(e); } } @@ -225,7 +224,7 @@ namespace f1x { void AndroidAutoEntity::onServiceDiscoveryRequest( const aap_protobuf::service::control::message::ServiceDiscoveryRequest &request) { OPENAUTO_LOG(info) << "[AndroidAutoEntity] onServiceDiscoveryRequest()"; - OPENAUTO_LOG(info) << "[AndroidAutoEntity] Type: " << request.label_text() << ", Model: " + OPENAUTO_LOG(debug) << "[AndroidAutoEntity] Type: " << request.label_text() << ", Model: " << request.device_name(); aap_protobuf::service::control::message::ServiceDiscoveryResponse serviceDiscoveryResponse; @@ -260,7 +259,7 @@ namespace f1x { std::bind(&IService::fillFeatures, std::placeholders::_1, std::ref(serviceDiscoveryResponse))); auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() { OPENAUTO_LOG(info) << "[AndroidAutoEntity] SUCCESS: Send ServiceDiscoveryResponse."; }, + promise->then([]() { }, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), std::placeholders::_1)); controlServiceChannel_->sendServiceDiscoveryResponse(serviceDiscoveryResponse, std::move(promise)); controlServiceChannel_->receive(this->shared_from_this()); @@ -269,7 +268,7 @@ namespace f1x { void AndroidAutoEntity::onAudioFocusRequest( const aap_protobuf::service::control::message::AudioFocusRequest &request) { OPENAUTO_LOG(info) << "[AndroidAutoEntity] onAudioFocusRequest()"; - OPENAUTO_LOG(info) << "[AndroidAutoEntity] AudioFocusRequestType received: " + OPENAUTO_LOG(debug) << "[AndroidAutoEntity] AudioFocusRequestType received: " << AudioFocusRequestType_Name(request.audio_focus_type()); /* @@ -292,15 +291,15 @@ namespace f1x { ? aap_protobuf::service::control::message::AudioFocusStateType::AUDIO_FOCUS_STATE_LOSS : aap_protobuf::service::control::message::AudioFocusStateType::AUDIO_FOCUS_STATE_GAIN; - OPENAUTO_LOG(info) << "[AndroidAutoEntity] AudioFocusStateType determined: " + OPENAUTO_LOG(debug) << "[AndroidAutoEntity] AudioFocusStateType determined: " << AudioFocusStateType_Name(audioFocusStateType); aap_protobuf::service::control::message::AudioFocusNotification response; response.set_focus_state(audioFocusStateType); auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() { OPENAUTO_LOG(info) "[AndroidAutoEntity] Resolved Promise"; }, - [capture0 = this->shared_from_this()](auto && PH1) { OPENAUTO_LOG(info) "[AndroidAutoEntity] Failed to Resolve Promise"; capture0->onChannelError(std::forward(PH1)); }); + promise->then([]() { }, + [capture0 = this->shared_from_this()](auto && PH1) { capture0->onChannelError(std::forward(PH1)); }); controlServiceChannel_->sendAudioFocusResponse(response, std::move(promise)); controlServiceChannel_->receive(this->shared_from_this()); } @@ -308,7 +307,7 @@ namespace f1x { void AndroidAutoEntity::onByeByeRequest( const aap_protobuf::service::control::message::ByeByeRequest &request) { OPENAUTO_LOG(info) << "[AndroidAutoEntity] onByeByeRequest()"; - OPENAUTO_LOG(info) << "[AndroidAutoEntity] Reason received: " << request.reason(); + OPENAUTO_LOG(debug) << "[AndroidAutoEntity] Reason received: " << request.reason(); aap_protobuf::service::control::message::ByeByeResponse response; auto promise = aasdk::channel::SendPromise::defer(strand_); @@ -326,8 +325,8 @@ namespace f1x { void AndroidAutoEntity::onNavigationFocusRequest( const aap_protobuf::service::control::message::NavFocusRequestNotification &request) { - OPENAUTO_LOG(info) << "[AndroidAutoEntity] onByeByeResponse()"; - OPENAUTO_LOG(info) << "[AndroidAutoEntity] NavFocusRequestNotification type received: " << NavFocusType_Name(request.focus_type()); + OPENAUTO_LOG(info) << "[AndroidAutoEntity] onNavigationFocusRequest()"; + OPENAUTO_LOG(debug) << "[AndroidAutoEntity] NavFocusRequestNotification type received: " << NavFocusType_Name(request.focus_type()); /* * If the MD sends NAV_FOCUS_PROJECTED in the request, we should stop any local navigation on the HU and grant NAV_FOCUS_NATIVE in the response. @@ -364,7 +363,7 @@ namespace f1x { void AndroidAutoEntity::onPingResponse(const aap_protobuf::service::control::message::PingResponse &response) { OPENAUTO_LOG(info) << "[AndroidAutoEntity] onPingResponse()"; - OPENAUTO_LOG(info) << "[AndroidAutoEntity] Timestamp: " << response.timestamp(); + OPENAUTO_LOG(debug) << "[AndroidAutoEntity] Timestamp: " << response.timestamp(); pinger_->pong(); controlServiceChannel_->receive(this->shared_from_this()); } @@ -382,7 +381,7 @@ namespace f1x { } void AndroidAutoEntity::schedulePing() { - OPENAUTO_LOG(info) << "[AndroidAutoEntity] schedulePing()"; + OPENAUTO_LOG(debug) << "[AndroidAutoEntity] schedulePing()"; auto promise = IPinger::Promise::defer(strand_); promise->then([this, self = this->shared_from_this()]() { this->sendPing(); @@ -400,7 +399,7 @@ namespace f1x { } void AndroidAutoEntity::sendPing() { - OPENAUTO_LOG(info) << "[AndroidAutoEntity] sendPing()"; + OPENAUTO_LOG(debug) << "[AndroidAutoEntity] sendPing()"; auto promise = aasdk::channel::SendPromise::defer(strand_); promise->then([]() {}, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), std::placeholders::_1)); diff --git a/src/autoapp/Service/Bluetooth/BluetoothService.cpp b/src/autoapp/Service/Bluetooth/BluetoothService.cpp index bcb0292..5be2117 100644 --- a/src/autoapp/Service/Bluetooth/BluetoothService.cpp +++ b/src/autoapp/Service/Bluetooth/BluetoothService.cpp @@ -65,7 +65,7 @@ namespace f1x { OPENAUTO_LOG(info) << "[BluetoothService] fillFeatures()"; if (bluetoothDevice_->isAvailable()) { - OPENAUTO_LOG(info) << "[BluetoothService] Local Address: " << bluetoothDevice_->getLocalAddress(); + OPENAUTO_LOG(debug) << "[BluetoothService] Local Address: " << bluetoothDevice_->getLocalAddress(); auto *service = response.add_channels(); service->set_id(static_cast(channel_->getId())); @@ -84,7 +84,7 @@ namespace f1x { void BluetoothService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { OPENAUTO_LOG(info) << "[BluetoothService] onChannelOpenRequest()"; - OPENAUTO_LOG(info) << "[BluetoothService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); + OPENAUTO_LOG(debug) << "[BluetoothService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); aap_protobuf::service::control::message::ChannelOpenResponse response; const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS; @@ -101,7 +101,7 @@ namespace f1x { void BluetoothService::onBluetoothPairingRequest( const aap_protobuf::service::bluetooth::message::BluetoothPairingRequest &request) { OPENAUTO_LOG(info) << "[BluetoothService] onBluetoothPairingRequest()"; - OPENAUTO_LOG(info) << "[BluetoothService] Phone Address: " << request.phone_address(); + OPENAUTO_LOG(debug) << "[BluetoothService] Phone Address: " << request.phone_address(); aap_protobuf::service::bluetooth::message::BluetoothPairingResponse response; @@ -112,7 +112,6 @@ namespace f1x { OPENAUTO_LOG(info) << "[BluetoothService] Phone is Not Paired"; } - // TODO: Response Status /* * The HU must always sent a STATUS_SUCCESS response, * or STATUS_BLUETOOTH_PAIRING_DELAYED if: diff --git a/src/autoapp/Service/GenericNotification/GenericNotificationService.cpp b/src/autoapp/Service/GenericNotification/GenericNotificationService.cpp index 1488d3c..a446e36 100644 --- a/src/autoapp/Service/GenericNotification/GenericNotificationService.cpp +++ b/src/autoapp/Service/GenericNotification/GenericNotificationService.cpp @@ -71,7 +71,7 @@ namespace f1x { void GenericNotificationService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { OPENAUTO_LOG(info) << "[GenericNotificationService] onChannelOpenRequest()"; - OPENAUTO_LOG(info) << "[GenericNotificationService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); + OPENAUTO_LOG(debug) << "[GenericNotificationService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); aap_protobuf::service::control::message::ChannelOpenResponse response; const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS; diff --git a/src/autoapp/Service/InputSource/InputSourceService.cpp b/src/autoapp/Service/InputSource/InputSourceService.cpp index f4ca384..47e7b21 100644 --- a/src/autoapp/Service/InputSource/InputSourceService.cpp +++ b/src/autoapp/Service/InputSource/InputSourceService.cpp @@ -86,7 +86,7 @@ namespace f1x { void InputSourceService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { OPENAUTO_LOG(info) << "[InputSourceService] onChannelOpenRequest()"; - OPENAUTO_LOG(info) << "[InputSourceService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); + OPENAUTO_LOG(debug) << "[InputSourceService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); aap_protobuf::service::control::message::ChannelOpenResponse response; @@ -102,7 +102,7 @@ namespace f1x { void InputSourceService::onKeyBindingRequest(const aap_protobuf::service::media::sink::message::KeyBindingRequest &request) { OPENAUTO_LOG(info) << "[InputSourceService] onKeyBindingRequest()"; - OPENAUTO_LOG(info) << "[InputSourceService] KeyCodes Count: " << request.keycodes_size(); + OPENAUTO_LOG(debug) << "[InputSourceService] KeyCodes Count: " << request.keycodes_size(); aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS; const auto &supportedButtonCodes = inputDevice_->getSupportedButtonCodes(); @@ -123,7 +123,7 @@ namespace f1x { inputDevice_->start(*this); } - OPENAUTO_LOG(info) << "[InputSourceService] Sending KeyBindingResponse with Status: " << status; + OPENAUTO_LOG(debug) << "[InputSourceService] Sending KeyBindingResponse with Status: " << status; auto promise = aasdk::channel::SendPromise::defer(strand_); promise->then([]() {}, diff --git a/src/autoapp/Service/MediaSink/AudioMediaSinkService.cpp b/src/autoapp/Service/MediaSink/AudioMediaSinkService.cpp index 755f7e9..fff4de7 100644 --- a/src/autoapp/Service/MediaSink/AudioMediaSinkService.cpp +++ b/src/autoapp/Service/MediaSink/AudioMediaSinkService.cpp @@ -136,7 +136,7 @@ namespace f1x { ? aap_protobuf::shared::MessageStatus::STATUS_SUCCESS : aap_protobuf::shared::MessageStatus::STATUS_INVALID_CHANNEL; - OPENAUTO_LOG(info) << "[AudioMediaSinkService] Status determined: " << aap_protobuf::shared::MessageStatus_Name(status); + OPENAUTO_LOG(debug) << "[AudioMediaSinkService] Status determined: " << aap_protobuf::shared::MessageStatus_Name(status); aap_protobuf::service::control::message::ChannelOpenResponse response; response.set_status(status); @@ -185,8 +185,8 @@ namespace f1x { } void AudioMediaSinkService::onMediaChannelStopIndication(const aap_protobuf::service::media::shared::message::Stop &indication) { - OPENAUTO_LOG(info) << "[AudioMediaSinkService] onMediaChannelStopIndication()"; - OPENAUTO_LOG(info) << "[AudioMediaSinkService] Channel Id: " << aasdk::messenger::channelIdToString(channel_->getId()) << ", session: " << session_; + OPENAUTO_LOG(debug) << "[AudioMediaSinkService] onMediaChannelStopIndication()"; + OPENAUTO_LOG(debug) << "[AudioMediaSinkService] Channel Id: " << aasdk::messenger::channelIdToString(channel_->getId()) << ", session: " << session_; session_ = -1; audioOutput_->suspend(); @@ -196,12 +196,11 @@ namespace f1x { void AudioMediaSinkService::onMediaWithTimestampIndication(aasdk::messenger::Timestamp::ValueType timestamp, const aasdk::common::DataConstBuffer &buffer) { - OPENAUTO_LOG(info) << "[AudioMediaSinkService] onMediaWithTimestampIndication()"; - OPENAUTO_LOG(info) << "[AudioMediaSinkService] Channel Id: " << aasdk::messenger::channelIdToString(channel_->getId()) << ", session: " << session_; + OPENAUTO_LOG(debug) << "[AudioMediaSinkService] onMediaWithTimestampIndication()"; + OPENAUTO_LOG(debug) << "[AudioMediaSinkService] Channel Id: " << aasdk::messenger::channelIdToString(channel_->getId()) << ", session: " << session_; audioOutput_->write(timestamp, buffer); - // TODO: Move MediaSourceMediaAckIndication to Ack and move to Shared. aap_protobuf::service::media::source::message::Ack indication; indication.set_session_id(session_); indication.set_ack(1); diff --git a/src/autoapp/Service/MediaSink/VideoMediaSinkService.cpp b/src/autoapp/Service/MediaSink/VideoMediaSinkService.cpp index 076f331..b1dc2f8 100644 --- a/src/autoapp/Service/MediaSink/VideoMediaSinkService.cpp +++ b/src/autoapp/Service/MediaSink/VideoMediaSinkService.cpp @@ -91,11 +91,11 @@ namespace f1x { videoConfig1->set_width_margin(videoMargins.width()); videoConfig1->set_density(videoOutput_->getScreenDPI()); - OPENAUTO_LOG(info) << "[VideoMediaSinkService] getVideoResolution " << VideoCodecResolutionType_Name(videoOutput_->getVideoResolution()); - OPENAUTO_LOG(info) << "[VideoMediaSinkService] getVideoFPS " << VideoFrameRateType_Name(videoOutput_->getVideoFPS()); - OPENAUTO_LOG(info) << "[VideoMediaSinkService] width " << videoMargins.width(); - OPENAUTO_LOG(info) << "[VideoMediaSinkService] height " << videoMargins.height(); - OPENAUTO_LOG(info) << "[VideoMediaSinkService] getScreenDPI " << videoOutput_->getScreenDPI(); + OPENAUTO_LOG(debug) << "[VideoMediaSinkService] getVideoResolution " << VideoCodecResolutionType_Name(videoOutput_->getVideoResolution()); + OPENAUTO_LOG(debug) << "[VideoMediaSinkService] getVideoFPS " << VideoFrameRateType_Name(videoOutput_->getVideoFPS()); + OPENAUTO_LOG(debug) << "[VideoMediaSinkService] width " << videoMargins.width(); + OPENAUTO_LOG(debug) << "[VideoMediaSinkService] height " << videoMargins.height(); + OPENAUTO_LOG(debug) << "[VideoMediaSinkService] getScreenDPI " << videoOutput_->getScreenDPI(); } void @@ -170,8 +170,8 @@ namespace f1x { void VideoMediaSinkService::onMediaWithTimestampIndication(aasdk::messenger::Timestamp::ValueType timestamp, const aasdk::common::DataConstBuffer &buffer) { - OPENAUTO_LOG(info) << "[VideoMediaSinkService] onMediaWithTimestampIndication()"; - OPENAUTO_LOG(info) << "[VideoMediaSinkService] Channel Id: " + OPENAUTO_LOG(debug) << "[VideoMediaSinkService] onMediaWithTimestampIndication()"; + OPENAUTO_LOG(debug) << "[VideoMediaSinkService] Channel Id: " << aasdk::messenger::channelIdToString(channel_->getId()) << ", session: " << session_; videoOutput_->write(timestamp, buffer); @@ -188,7 +188,7 @@ namespace f1x { } void VideoMediaSinkService::onMediaIndication(const aasdk::common::DataConstBuffer &buffer) { - OPENAUTO_LOG(info) << "[VideoMediaSinkService] onMediaIndication()"; + OPENAUTO_LOG(debug) << "[VideoMediaSinkService] onMediaIndication()"; this->onMediaWithTimestampIndication(0, buffer); } @@ -199,7 +199,7 @@ namespace f1x { void VideoMediaSinkService::onVideoFocusRequest( const aap_protobuf::service::media::video::message::VideoFocusRequestNotification &request) { - OPENAUTO_LOG(info) << "[VideoMediaSinkService] onMediaIndication()"; + OPENAUTO_LOG(info) << "[VideoMediaSinkService] onVideoFocusRequest()"; OPENAUTO_LOG(info) << "[VideoMediaSinkService] Display index: " << request.disp_channel_id() << ", focus mode: " << VideoFocusMode_Name(request.mode()) << ", focus reason: " << VideoFocusReason_Name(request.reason()); if (request.mode() == @@ -228,7 +228,7 @@ namespace f1x { videoFocusIndication.set_unsolicited(false); auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() {OPENAUTO_LOG(info) << "[VideoMediaSinkService] VideoFocus Request Sent";}, std::bind(&VideoMediaSinkService::onChannelError, this->shared_from_this(), + promise->then([]() { }, std::bind(&VideoMediaSinkService::onChannelError, this->shared_from_this(), std::placeholders::_1)); channel_->sendVideoFocusIndication(videoFocusIndication, std::move(promise)); } diff --git a/src/autoapp/Service/MediaSource/MediaSourceService.cpp b/src/autoapp/Service/MediaSource/MediaSourceService.cpp index 9d73fa7..a2e857b 100644 --- a/src/autoapp/Service/MediaSource/MediaSourceService.cpp +++ b/src/autoapp/Service/MediaSource/MediaSourceService.cpp @@ -100,7 +100,7 @@ namespace f1x { ? aap_protobuf::shared::MessageStatus::STATUS_SUCCESS : aap_protobuf::shared::MessageStatus::STATUS_INTERNAL_ERROR; - OPENAUTO_LOG(info) << "[MediaSourceService] Status determined: " << aap_protobuf::shared::MessageStatus_Name(status); + OPENAUTO_LOG(debug) << "[MediaSourceService] Status determined: " << aap_protobuf::shared::MessageStatus_Name(status); aap_protobuf::service::control::message::ChannelOpenResponse response; response.set_status(status); @@ -155,7 +155,7 @@ namespace f1x { */ void MediaSourceService::onMediaChannelAckIndication( const aap_protobuf::service::media::source::message::Ack &) { - OPENAUTO_LOG(info) << "[MediaSourceService] onMediaChannelAckIndication()"; + OPENAUTO_LOG(debug) << "[MediaSourceService] onMediaChannelAckIndication()"; channel_->receive(this->shared_from_this()); } @@ -163,15 +163,13 @@ namespace f1x { * Source Media Channel Handling */ - // TODO: These are Source Channel Handlers - should be moved to their own handlers in case any more are implemented in the future. - /** * Handle request to Open or Close Microphone Source Channel * @param request */ void MediaSourceService::onMediaSourceOpenRequest( const aap_protobuf::service::media::source::message::MicrophoneRequest &request) { - OPENAUTO_LOG(info) << "[MediaSourceService] onMediaChannelAckIndication()"; + OPENAUTO_LOG(info) << "[MediaSourceService] onMediaSourceOpenRequest()"; OPENAUTO_LOG(info) << "[MediaSourceService] Request to Open?: " << request.open() << ", anc: " << request.anc_enabled() << ", ec: " << request.ec_enabled() << ", max unacked: " << request.max_unacked(); if (request.open()) { @@ -260,7 +258,7 @@ namespace f1x { std::bind(&MediaSourceService::onMediaSourceDataReady, this->shared_from_this(), std::placeholders::_1), [this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[MediaSourceService] audio input read rejected."; + OPENAUTO_LOG(debug) << "[MediaSourceService] audio input read rejected."; }); audioInput_->read(std::move(readPromise)); diff --git a/src/autoapp/Service/PhoneStatus/PhoneStatusService.cpp b/src/autoapp/Service/PhoneStatus/PhoneStatusService.cpp index 99b4786..bb032d1 100644 --- a/src/autoapp/Service/PhoneStatus/PhoneStatusService.cpp +++ b/src/autoapp/Service/PhoneStatus/PhoneStatusService.cpp @@ -71,7 +71,7 @@ namespace f1x { void PhoneStatusService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { OPENAUTO_LOG(info) << "[PhoneStatusService] onChannelOpenRequest()"; - OPENAUTO_LOG(info) << "[PhoneStatusService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); + OPENAUTO_LOG(debug) << "[PhoneStatusService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); aap_protobuf::service::control::message::ChannelOpenResponse response; const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS; diff --git a/src/autoapp/Service/Pinger.cpp b/src/autoapp/Service/Pinger.cpp index 0d7ae56..72aca5a 100644 --- a/src/autoapp/Service/Pinger.cpp +++ b/src/autoapp/Service/Pinger.cpp @@ -51,7 +51,7 @@ void Pinger::ping(Promise::Pointer promise) else { ++pingsCount_; - OPENAUTO_LOG(info) << "[Pinger] Ping counter: " << pingsCount_; + OPENAUTO_LOG(debug) << "[Pinger] Ping counter: " << pingsCount_; promise_ = std::move(promise); timer_.expires_from_now(boost::posix_time::milliseconds(duration_)); @@ -64,7 +64,7 @@ void Pinger::pong() { strand_.dispatch([this, self = this->shared_from_this()]() { ++pongsCount_; - OPENAUTO_LOG(info) << "[Pinger] Pong counter: " << pongsCount_; + OPENAUTO_LOG(debug) << "[Pinger] Pong counter: " << pongsCount_; }); } diff --git a/src/autoapp/Service/Radio/RadioService.cpp b/src/autoapp/Service/Radio/RadioService.cpp index 6c8587f..b4d3c54 100644 --- a/src/autoapp/Service/Radio/RadioService.cpp +++ b/src/autoapp/Service/Radio/RadioService.cpp @@ -71,7 +71,7 @@ namespace f1x { void RadioService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { OPENAUTO_LOG(info) << "[RadioService] onChannelOpenRequest()"; - OPENAUTO_LOG(info) << "[RadioService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); + OPENAUTO_LOG(debug) << "[RadioService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); aap_protobuf::service::control::message::ChannelOpenResponse response; diff --git a/src/autoapp/Service/Sensor/SensorService.cpp b/src/autoapp/Service/Sensor/SensorService.cpp index f75e8aa..819ea31 100644 --- a/src/autoapp/Service/Sensor/SensorService.cpp +++ b/src/autoapp/Service/Sensor/SensorService.cpp @@ -91,7 +91,6 @@ namespace f1x { auto *service = response.add_channels(); service->set_id(static_cast(channel_->getId())); - // TODO: Add and Link other Sensors Here auto *sensorChannel = service->mutable_sensor_source_service(); sensorChannel->add_sensors()->set_sensor_type(aap_protobuf::service::sensorsource::message::SensorType::SENSOR_DRIVING_STATUS_DATA); sensorChannel->add_sensors()->set_sensor_type(aap_protobuf::service::sensorsource::message::SensorType::SENSOR_LOCATION); @@ -100,7 +99,7 @@ namespace f1x { void SensorService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { OPENAUTO_LOG(info) << "[SensorService] onChannelOpenRequest()"; - OPENAUTO_LOG(info) << "[SensorService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); + OPENAUTO_LOG(debug) << "[SensorService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); aap_protobuf::service::control::message::ChannelOpenResponse response; const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS; @@ -117,14 +116,13 @@ namespace f1x { void SensorService::onSensorStartRequest( const aap_protobuf::service::sensorsource::message::SensorRequest &request) { OPENAUTO_LOG(info) << "[SensorService] onSensorStartRequest()"; - OPENAUTO_LOG(info) << "[SensorService] Request Type: "<< request.type(); + OPENAUTO_LOG(debug) << "[SensorService] Request Type: "<< request.type(); aap_protobuf::service::sensorsource::message::SensorStartResponseMessage response; response.set_status(aap_protobuf::shared::MessageStatus::STATUS_SUCCESS); auto promise = aasdk::channel::SendPromise::defer(strand_); - // TODO: Convert to Switch? if (request.type() == aap_protobuf::service::sensorsource::message::SENSOR_DRIVING_STATUS_DATA) { promise->then(std::bind(&SensorService::sendDrivingStatusUnrestricted, this->shared_from_this()), @@ -151,7 +149,7 @@ namespace f1x { indication.add_driving_status_data()->set_status(aap_protobuf::service::sensorsource::message::DrivingStatus::DRIVE_STATUS_UNRESTRICTED); auto promise = aasdk::channel::SendPromise::defer(strand_); - promise->then([]() { OPENAUTO_LOG(info) << "[SensorService] SendPromise resolved successfully()"; }, + promise->then([]() { }, std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1)); channel_->sendSensorEventIndication(indication, std::move(promise)); } diff --git a/src/autoapp/Service/WifiProjection/WifiProjectionStatus.cpp b/src/autoapp/Service/WifiProjection/WifiProjectionStatus.cpp index 7b3f74b..d4956c3 100644 --- a/src/autoapp/Service/WifiProjection/WifiProjectionStatus.cpp +++ b/src/autoapp/Service/WifiProjection/WifiProjectionStatus.cpp @@ -20,6 +20,7 @@ #include #include #include +#include namespace f1x { namespace openauto { @@ -66,21 +67,21 @@ namespace f1x { service->set_id(static_cast(channel_->getId())); auto *wifiChannel = service->mutable_wifi_projection_service(); - wifiChannel->set_car_wifi_bssid(""); // TODO: Temporarily disabled and populating with empty string. + wifiChannel->set_car_wifi_bssid(QNetworkInterface::interfaceFromName("wlan0").hardwareAddress().toStdString()); } void WifiProjectionService::onWifiCredentialsRequest( const aap_protobuf::service::wifiprojection::message::WifiCredentialsRequest &request) { + OPENAUTO_LOG(info) << "[WifiProjectionService] onWifiCredentialsRequest()"; + aap_protobuf::service::wifiprojection::message::WifiCredentialsResponse response; - response.set_access_point_type(aap_protobuf::service::wifiprojection::message::AccessPointType::DYNAMIC); - response.set_car_wifi_password("1234567890"); + response.set_access_point_type(aap_protobuf::service::wifiprojection::message::AccessPointType::STATIC); response.set_car_wifi_ssid("CRANKSHAFT-NG"); + response.set_car_wifi_password("1234567890"); response.set_car_wifi_security_mode(aap_protobuf::service::wifiprojection::message::WifiSecurityMode::WPA2_PERSONAL); - OPENAUTO_LOG(info) << "[WifiProjectionService] onWifiCredentialsRequest()"; - auto promise = aasdk::channel::SendPromise::defer(strand_); promise->then([]() {}, std::bind(&WifiProjectionService::onChannelError, this->shared_from_this(), std::placeholders::_1)); @@ -91,8 +92,7 @@ namespace f1x { void WifiProjectionService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { OPENAUTO_LOG(info) << "[WifiProjectionService] onChannelOpenRequest()"; - OPENAUTO_LOG(info) << "[WifiProjectionService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); - + OPENAUTO_LOG(debug) << "[WifiProjectionService] Channel Id: " << request.service_id() << ", Priority: " << request.priority(); aap_protobuf::service::control::message::ChannelOpenResponse response; const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS; diff --git a/src/autoapp/autoapp.cpp b/src/autoapp/autoapp.cpp index 43095ce..1fb0569 100644 --- a/src/autoapp/autoapp.cpp +++ b/src/autoapp/autoapp.cpp @@ -38,8 +38,6 @@ #include #include -//namespace aap_protobuf = aap_protobuf; -//namespace aasdk = aasdk; namespace autoapp = f1x::openauto::autoapp; using ThreadPool = std::vector; @@ -77,7 +75,7 @@ int main(int argc, char* argv[]) libusb_context* usbContext; if(libusb_init(&usbContext) != 0) { - OPENAUTO_LOG(error) << "[OpenAuto] libusb init failed."; + OPENAUTO_LOG(error) << "[AutoApp] libusb init failed."; return 1; } @@ -90,8 +88,8 @@ int main(int argc, char* argv[]) QApplication qApplication(argc, argv); const int width = QApplication::desktop()->width(); const int height = QApplication::desktop()->height(); - OPENAUTO_LOG(info) << "[OpenAuto] Display width: " << width; - OPENAUTO_LOG(info) << "[OpenAuto] Display height: " << height; + OPENAUTO_LOG(info) << "[AutoApp] Display width: " << width; + OPENAUTO_LOG(info) << "[AutoApp] Display height: " << height; auto configuration = std::make_shared(); @@ -139,57 +137,57 @@ int main(int argc, char* argv[]) QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraHide, [&qApplication]() { system("/opt/crankshaft/cameracontrol.py Background &"); - OPENAUTO_LOG(info) << "[Camera] Background."; + OPENAUTO_LOG(info) << "[AutoApp] Camera Background."; }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraShow, [&qApplication]() { system("/opt/crankshaft/cameracontrol.py Foreground &"); - OPENAUTO_LOG(info) << "[Camera] Foreground."; + OPENAUTO_LOG(info) << "[AutoApp] Camera Foreground."; }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraPosYUp, [&qApplication]() { system("/opt/crankshaft/cameracontrol.py PosYUp &"); - OPENAUTO_LOG(info) << "[Camera] PosY up."; + OPENAUTO_LOG(info) << "[AutoApp] Camera PosY up."; }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraPosYDown, [&qApplication]() { system("/opt/crankshaft/cameracontrol.py PosYDown &"); - OPENAUTO_LOG(info) << "[Camera] PosY down."; + OPENAUTO_LOG(info) << "[AutoApp] Camera PosY down."; }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraZoomPlus, [&qApplication]() { system("/opt/crankshaft/cameracontrol.py ZoomPlus &"); - OPENAUTO_LOG(info) << "[Camera] Zoom plus."; + OPENAUTO_LOG(info) << "[AutoApp] Camera Zoom plus."; }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraZoomMinus, [&qApplication]() { system("/opt/crankshaft/cameracontrol.py ZoomMinus &"); - OPENAUTO_LOG(info) << "[Camera] Zoom minus."; + OPENAUTO_LOG(info) << "[AutoApp] Camera Zoom minus."; }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraRecord, [&qApplication]() { system("/opt/crankshaft/cameracontrol.py Record &"); - OPENAUTO_LOG(info) << "[Camera] Record."; + OPENAUTO_LOG(info) << "[AutoApp] Camera Record."; }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraStop, [&qApplication]() { system("/opt/crankshaft/cameracontrol.py Stop &"); - OPENAUTO_LOG(info) << "[Camera] Stop."; + OPENAUTO_LOG(info) << "[AutoApp] Camera Stop."; }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraSave, [&qApplication]() { system("/opt/crankshaft/cameracontrol.py Save &"); - OPENAUTO_LOG(info) << "[Camera] Save."; + OPENAUTO_LOG(info) << "[AutoApp] Camera Save."; }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::TriggerScriptNight, [&qApplication]() { system("/opt/crankshaft/service_daynight.sh app night"); - OPENAUTO_LOG(info) << "[MainWindow] Night."; + OPENAUTO_LOG(info) << "[AutoApp] MainWindow Night."; }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::TriggerScriptDay, [&qApplication]() { system("/opt/crankshaft/service_daynight.sh app day"); - OPENAUTO_LOG(info) << "[MainWindow] Day."; + OPENAUTO_LOG(info) << "[AutoApp] MainWindow Day."; }); mainWindow.showFullScreen(); @@ -211,20 +209,20 @@ int main(int argc, char* argv[]) }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::TriggerAppStart, [&app]() { - OPENAUTO_LOG(info) << "[Autoapp] TriggerAppStart: Manual start android auto."; + OPENAUTO_LOG(info) << "[AutoApp] TriggerAppStart: Manual start android auto."; try { app->disableAutostartEntity = false; app->resume(); app->waitForUSBDevice(); } catch (...) { - OPENAUTO_LOG(error) << "[Autoapp] TriggerAppStart: app->waitForUSBDevice();"; + OPENAUTO_LOG(error) << "[AutoApp] TriggerAppStart: app->waitForUSBDevice();"; } }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::TriggerAppStop, [&app]() { try { if (std::ifstream("/tmp/android_device")) { - OPENAUTO_LOG(info) << "[Autoapp] TriggerAppStop: Manual stop usb android auto."; + OPENAUTO_LOG(info) << "[AutoApp] TriggerAppStop: Manual stop usb android auto."; app->disableAutostartEntity = true; system("/usr/local/bin/autoapp_helper usbreset"); usleep(500000); @@ -232,11 +230,11 @@ int main(int argc, char* argv[]) app->stop(); //app->pause(); } catch (...) { - OPENAUTO_LOG(error) << "[Autoapp] TriggerAppStop: stop();"; + OPENAUTO_LOG(error) << "[AutoApp] TriggerAppStop: stop();"; } } else { - OPENAUTO_LOG(info) << "[Autoapp] TriggerAppStop: Manual stop wifi android auto."; + OPENAUTO_LOG(info) << "[AutoApp] TriggerAppStop: Manual stop wifi android auto."; try { app->onAndroidAutoQuit(); //app->pause(); @@ -246,7 +244,7 @@ int main(int argc, char* argv[]) } } catch (...) { - OPENAUTO_LOG(info) << "[Autoapp] Exception in manual stop android auto."; + OPENAUTO_LOG(info) << "[AutoApp] Exception in manual stop android auto."; } }); @@ -255,7 +253,7 @@ int main(int argc, char* argv[]) connectdialog.close(); warningdialog.close(); updatedialog.close(); - OPENAUTO_LOG(info) << "[Autoapp] Close all possible open dialogs."; + OPENAUTO_LOG(info) << "[AutoApp] Close all possible open dialogs."; }); if (configuration->hideWarning() == false) { diff --git a/src/btservice/AndroidBluetoothServer.cpp b/src/btservice/AndroidBluetoothServer.cpp index 96921dc..26c45f9 100644 --- a/src/btservice/AndroidBluetoothServer.cpp +++ b/src/btservice/AndroidBluetoothServer.cpp @@ -57,7 +57,8 @@ namespace f1x::openauto::btservice { aap_protobuf::service::wifiprojection::message::WifiCredentialsRequest request; // TODO: How do we ping back the Wireless Port and IP? //aap_protobuf::service::::WifiInfoRequest request; - //request.set_ip_address(getIP4_("wlan0")); + request.set_ip_address(getIP4_("wlan0")); + getIP4_() //request.set_port(5000); sendMessage(request, 1);