Populate WifiProjectionStatus.cpp, NavigationStatusService.cpp

This commit is contained in:
Simon Dean 2024-11-08 12:55:54 +00:00
parent 68759ee2fa
commit 406368d8dd
6 changed files with 98 additions and 79 deletions

View File

@ -46,6 +46,9 @@ namespace f1x {
void onChannelError(const aasdk::error::Error &e) 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;
private: private:
using std::enable_shared_from_this<NavigationStatusService>::shared_from_this; using std::enable_shared_from_this<NavigationStatusService>::shared_from_this;
@ -53,7 +56,6 @@ namespace f1x {
boost::asio::io_service::strand strand_; boost::asio::io_service::strand strand_;
aasdk::channel::navigationstatus::NavigationStatusService::Pointer channel_; aasdk::channel::navigationstatus::NavigationStatusService::Pointer channel_;
}; };
} }
} }
} }

View File

@ -28,28 +28,28 @@
/* /*
* HU > MD Version Request * HU > MD Version Request
* HU < MD ServiceDiscoveryRequest * HU < MD ServiceDiscoveryRequest **
* HU > MD Car MetaData (Make, Model, year etc) * HU > MD Car MetaData (Make, Model, year etc) **
* HU < MD when Video Projection starts, it MUST be shown without User Ineraction * 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 Prompt Use to Enable and Pair with Car ***********
* HU < MD Request Video Focus for Projection (HU Grant) * HU < MD Request Video Focus for Projection (HU Grant) ***********
* *
* AAP neds Bluetooth HFP for Telephone * AAP needs Bluetooth HFP for Telephone
* *
* HU > MD Bluetooth Announcement (HU MAC Address, Supported Pairing Methods) * HU > MD Bluetooth Announcement (HU MAC Address, Supported Pairing Methods) ***********
* HU < MD Bluetooth Pairing Request * HU < MD Bluetooth Pairing Request ***********
* HU > MD Bluetoth Pairing Response * HU > MD Bluetoth Pairing Response***********
* *
* AfterPairing, HU can request the Bluetooth PhoneBookAccessProtocol. Sensible UI. * AfterPairing, HU can request the Bluetooth PhoneBookAccessProtocol. Sensible UI.
* *
* HU < MD connect to Bluetooth HFP * HU < MD connect to Bluetooth HFP***********
* HU Suppress BAP or MAP while AAP connected. * 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. * 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 to HU and routes call over Bluetooth (non Bluetooth call) ***********
* MD connects Blueooth call and display projection mode * 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. * 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 * AA only uses HFP, hhowever HU may use MAP, PBAP, PAN and RSAP ***********
* MD will reconnect when required. * MD will reconnect when required. ***********
* *
* Video * Video
* HU < MD - During Service Discovery, MD requests Video Configs supported * HU < MD - During Service Discovery, MD requests Video Configs supported
@ -103,13 +103,13 @@ namespace f1x {
eventHandler_ = eventHandler; eventHandler_ = eventHandler;
std::for_each(serviceList_.begin(), serviceList_.end(), std::bind(&IService::start, std::placeholders::_1)); std::for_each(serviceList_.begin(), serviceList_.end(), std::bind(&IService::start, std::placeholders::_1));
OPENAUTO_LOG(info) << "[AndroidAutoEntity] Event handlers added."; OPENAUTO_LOG(info) << "[AndroidAutoEntity] Event handlers added.";
auto versionRequestPromise = aasdk::channel::SendPromise::defer(strand_); auto versionRequestPromise = aasdk::channel::SendPromise::defer(strand_);
versionRequestPromise->then([]() {}, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), versionRequestPromise->then([]() { OPENAUTO_LOG(info) << "[AndroidAutoEntity] SUCCESS: Version request sent."; }, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(),
std::placeholders::_1)); std::placeholders::_1));
OPENAUTO_LOG(info) << "[AndroidAutoEntity] Sending version request."; OPENAUTO_LOG(info) << "[AndroidAutoEntity] Send Version Request.";
controlServiceChannel_->sendVersionRequest(std::move(versionRequestPromise)); controlServiceChannel_->sendVersionRequest(std::move(versionRequestPromise));
controlServiceChannel_->receive(this->shared_from_this()); controlServiceChannel_->receive(this->shared_from_this());
}); });
@ -123,7 +123,7 @@ namespace f1x {
eventHandler_ = nullptr; eventHandler_ = nullptr;
std::for_each(serviceList_.begin(), serviceList_.end(), std::for_each(serviceList_.begin(), serviceList_.end(),
std::bind(&IService::stop, std::placeholders::_1)); std::bind(&IService::stop, std::placeholders::_1));
//pinger_->cancel();
messenger_->stop(); messenger_->stop();
transport_->stop(); transport_->stop();
cryptor_->deinit(); cryptor_->deinit();
@ -172,11 +172,11 @@ namespace f1x {
OPENAUTO_LOG(info) << "[AndroidAutoEntity] Version matches."; OPENAUTO_LOG(info) << "[AndroidAutoEntity] Version matches.";
try { try {
OPENAUTO_LOG(info) << "[AndroidAutoEntity] Beginning SSL handshake..."; OPENAUTO_LOG(info) << "[AndroidAutoEntity] Beginning SSL handshake.";
cryptor_->doHandshake(); cryptor_->doHandshake();
auto handshakePromise = aasdk::channel::SendPromise::defer(strand_); auto handshakePromise = aasdk::channel::SendPromise::defer(strand_);
handshakePromise->then([]() {}, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), handshakePromise->then([]() { OPENAUTO_LOG(info) << "[AndroidAutoEntity] SUCCESS: Sent SSL handshake."; }, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(),
std::placeholders::_1)); std::placeholders::_1));
controlServiceChannel_->sendHandshake(cryptor_->readHandshakeBuffer(), std::move(handshakePromise)); controlServiceChannel_->sendHandshake(cryptor_->readHandshakeBuffer(), std::move(handshakePromise));
controlServiceChannel_->receive(this->shared_from_this()); controlServiceChannel_->receive(this->shared_from_this());
@ -246,7 +246,7 @@ namespace f1x {
std::bind(&IService::fillFeatures, std::placeholders::_1, std::ref(serviceDiscoveryResponse))); std::bind(&IService::fillFeatures, std::placeholders::_1, std::ref(serviceDiscoveryResponse)));
auto promise = aasdk::channel::SendPromise::defer(strand_); auto promise = aasdk::channel::SendPromise::defer(strand_);
promise->then([]() {}, promise->then([]() { OPENAUTO_LOG(info) << "[AndroidAutoEntity] SUCCESS: Send ServiceDiscoveryResponse."; },
std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), std::placeholders::_1)); std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), std::placeholders::_1));
controlServiceChannel_->sendServiceDiscoveryResponse(serviceDiscoveryResponse, std::move(promise)); controlServiceChannel_->sendServiceDiscoveryResponse(serviceDiscoveryResponse, std::move(promise));
controlServiceChannel_->receive(this->shared_from_this()); controlServiceChannel_->receive(this->shared_from_this());
@ -271,8 +271,8 @@ namespace f1x {
response.set_audio_focus_state(audioFocusStateType); response.set_audio_focus_state(audioFocusStateType);
auto promise = aasdk::channel::SendPromise::defer(strand_); auto promise = aasdk::channel::SendPromise::defer(strand_);
promise->then([]() {}, promise->then([]() { OPENAUTO_LOG(info) "[AndroidAutoEntity] Resolved Promise"; },
std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), std::placeholders::_1)); [capture0 = this->shared_from_this()](auto && PH1) { OPENAUTO_LOG(info) "[AndroidAutoEntity] Failed to Resolve Promise"; capture0->onChannelError(std::forward<decltype(PH1)>(PH1)); });
controlServiceChannel_->sendAudioFocusResponse(response, std::move(promise)); controlServiceChannel_->sendAudioFocusResponse(response, std::move(promise));
controlServiceChannel_->receive(this->shared_from_this()); controlServiceChannel_->receive(this->shared_from_this());
} }
@ -312,16 +312,15 @@ namespace f1x {
controlServiceChannel_->receive(this->shared_from_this()); controlServiceChannel_->receive(this->shared_from_this());
} }
void AndroidAutoEntity::onBatteryStatusNotification(const aap_protobuf::channel::control::BatteryStatusNotification &notification) {
OPENAUTO_LOG(info) << "[AndroidAutoEntity] onBatteryStatusNotification()";
controlServiceChannel_->receive(this->shared_from_this());
}
void AndroidAutoEntity::onVoiceSessionRequest( void AndroidAutoEntity::onVoiceSessionRequest(
const aap_protobuf::channel::control::voice::VoiceSessionNotification &request) { const aap_protobuf::channel::control::voice::VoiceSessionNotification &request) {
OPENAUTO_LOG(info) << "[AndroidAutoEntity] onVoiceSessionRequest()"; OPENAUTO_LOG(info) << "[AndroidAutoEntity] onVoiceSessionRequest()";
} controlServiceChannel_->receive(this->shared_from_this());
void AndroidAutoEntity::onPingRequest(const aap_protobuf::channel::control::ping::PingRequest &request) {
OPENAUTO_LOG(info) << "[AndroidAutoEntity] onPingRequest()";
OPENAUTO_LOG(info) << "[AndroidAutoEntity] Timestamp: " << request.timestamp();
//pinger_->ping();
//controlServiceChannel_->receive(this->shared_from_this());
} }
void AndroidAutoEntity::onPingResponse(const aap_protobuf::channel::control::ping::PingResponse &response) { void AndroidAutoEntity::onPingResponse(const aap_protobuf::channel::control::ping::PingResponse &response) {
@ -373,7 +372,6 @@ namespace f1x {
request.set_timestamp(timestamp.count()); request.set_timestamp(timestamp.count());
controlServiceChannel_->sendPingRequest(request, std::move(promise)); controlServiceChannel_->sendPingRequest(request, std::move(promise));
} }
} }
} }
} }

View File

@ -28,53 +28,47 @@
#include <f1x/openauto/autoapp/Service/AndroidAutoEntity.hpp> #include <f1x/openauto/autoapp/Service/AndroidAutoEntity.hpp>
#include <f1x/openauto/autoapp/Service/Pinger.hpp> #include <f1x/openauto/autoapp/Service/Pinger.hpp>
namespace f1x namespace f1x {
{ namespace openauto {
namespace openauto namespace autoapp {
{ namespace service {
namespace autoapp
{
namespace service
{
AndroidAutoEntityFactory::AndroidAutoEntityFactory(boost::asio::io_service& ioService, AndroidAutoEntityFactory::AndroidAutoEntityFactory(boost::asio::io_service &ioService,
configuration::IConfiguration::Pointer configuration, configuration::IConfiguration::Pointer configuration,
IServiceFactory& serviceFactory) IServiceFactory &serviceFactory)
: ioService_(ioService) : ioService_(ioService), configuration_(std::move(configuration)), serviceFactory_(serviceFactory) {
, configuration_(std::move(configuration))
, serviceFactory_(serviceFactory)
{
} }
IAndroidAutoEntity::Pointer AndroidAutoEntityFactory::create(aasdk::usb::IAOAPDevice::Pointer aoapDevice) IAndroidAutoEntity::Pointer AndroidAutoEntityFactory::create(aasdk::usb::IAOAPDevice::Pointer aoapDevice) {
{ auto transport(std::make_shared<aasdk::transport::USBTransport>(ioService_, std::move(aoapDevice)));
auto transport(std::make_shared<aasdk::transport::USBTransport>(ioService_, std::move(aoapDevice))); return create(std::move(transport));
return create(std::move(transport)); }
}
IAndroidAutoEntity::Pointer AndroidAutoEntityFactory::create(aasdk::tcp::ITCPEndpoint::Pointer tcpEndpoint) IAndroidAutoEntity::Pointer AndroidAutoEntityFactory::create(aasdk::tcp::ITCPEndpoint::Pointer tcpEndpoint) {
{ auto transport(std::make_shared<aasdk::transport::TCPTransport>(ioService_, std::move(tcpEndpoint)));
auto transport(std::make_shared<aasdk::transport::TCPTransport>(ioService_, std::move(tcpEndpoint))); return create(std::move(transport));
return create(std::move(transport)); }
}
IAndroidAutoEntity::Pointer AndroidAutoEntityFactory::create(aasdk::transport::ITransport::Pointer transport) IAndroidAutoEntity::Pointer AndroidAutoEntityFactory::create(aasdk::transport::ITransport::Pointer transport) {
{ auto sslWrapper(std::make_shared<aasdk::transport::SSLWrapper>());
auto sslWrapper(std::make_shared<aasdk::transport::SSLWrapper>()); auto cryptor(std::make_shared<aasdk::messenger::Cryptor>(std::move(sslWrapper)));
auto cryptor(std::make_shared<aasdk::messenger::Cryptor>(std::move(sslWrapper))); cryptor->init();
cryptor->init();
auto messenger(std::make_shared<aasdk::messenger::Messenger>(ioService_, auto messenger(std::make_shared<aasdk::messenger::Messenger>(ioService_,
std::make_shared<aasdk::messenger::MessageInStream>(ioService_, transport, cryptor), std::make_shared<aasdk::messenger::MessageInStream>(
std::make_shared<aasdk::messenger::MessageOutStream>(ioService_, transport, cryptor))); ioService_, transport, cryptor),
std::make_shared<aasdk::messenger::MessageOutStream>(
ioService_, transport, cryptor)));
auto serviceList = serviceFactory_.create(messenger); auto serviceList = serviceFactory_.create(messenger);
auto pinger(std::make_shared<Pinger>(ioService_, 5000)); auto pinger(std::make_shared<Pinger>(ioService_, 5000));
return std::make_shared<AndroidAutoEntity>(ioService_, std::move(cryptor), std::move(transport), std::move(messenger), configuration_, std::move(serviceList), std::move(pinger)); return std::make_shared<AndroidAutoEntity>(ioService_, std::move(cryptor), std::move(transport),
} std::move(messenger), configuration_, std::move(serviceList),
std::move(pinger));
}
} }
} }
} }
} }

View File

@ -85,6 +85,20 @@ namespace f1x {
channel_->receive(this->shared_from_this()); channel_->receive(this->shared_from_this());
} }
void NavigationStatusService::onStatusUpdate(const aap_protobuf::channel::navigation::event::NavigationStatus &navStatus) {
channel_->receive(this->shared_from_this());
}
void NavigationStatusService::onTurnEvent(const aap_protobuf::channel::navigation::event::NavigationNextTurnEvent &turnEvent) {
channel_->receive(this->shared_from_this());
}
void NavigationStatusService::onDistanceEvent(const aap_protobuf::service::navigation::message::NavigationNextTurnDistanceEvent &distanceEvent) {
channel_->receive(this->shared_from_this());
}
void NavigationStatusService::onChannelError(const aasdk::error::Error &e) { void NavigationStatusService::onChannelError(const aasdk::error::Error &e) {
OPENAUTO_LOG(error) << "[NavigationStatusService] onChannelError(): " << e.what(); OPENAUTO_LOG(error) << "[NavigationStatusService] onChannelError(): " << e.what();
} }

View File

@ -60,8 +60,6 @@ namespace f1x {
} }
// TODO: MEDIA SERVICE
ServiceList ServiceFactory::create(aasdk::messenger::IMessenger::Pointer messenger) { ServiceList ServiceFactory::create(aasdk::messenger::IMessenger::Pointer messenger) {
OPENAUTO_LOG(info) << "[ServiceFactory] create()"; OPENAUTO_LOG(info) << "[ServiceFactory] create()";
ServiceList serviceList; ServiceList serviceList;

View File

@ -71,8 +71,21 @@ namespace f1x {
void WifiProjectionService::onWifiCredentialsRequest( void WifiProjectionService::onWifiCredentialsRequest(
const aap_protobuf::service::wifiprojection::message::WifiCredentialsRequest &request) { const aap_protobuf::service::wifiprojection::message::WifiCredentialsRequest &request) {
aap_protobuf::service::wifiprojection::message::WifiCredentialsResponse response;
response.set_access_point_type(aap_protobuf::service::wifiprojection::message::AccessPointType::DYNAMIC);
response.set_car_wifi_password("1234567890");
response.set_car_wifi_ssid("CRANKSHAFT-NG");
response.set_car_wifi_security_mode(aap_protobuf::service::wifiprojection::message::WifiSecurityMode::WPA2_PERSONAL);
OPENAUTO_LOG(info) << "[WifiProjectionService] onWifiCredentialsRequest()"; OPENAUTO_LOG(info) << "[WifiProjectionService] onWifiCredentialsRequest()";
// channel_->sendWifiCredentialsResponse(response, std::move(promise));
auto promise = aasdk::channel::SendPromise::defer(strand_);
promise->then([]() {}, std::bind(&WifiProjectionService::onChannelError, this->shared_from_this(),
std::placeholders::_1));
channel_->sendWifiCredentialsResponse(response, std::move(promise));
channel_->receive(this->shared_from_this());
} }