diff --git a/include/f1x/aasdk b/include/f1x/aasdk new file mode 120000 index 0000000..b58b0fa --- /dev/null +++ b/include/f1x/aasdk @@ -0,0 +1 @@ +../../../aasdk/include/aasdk/ \ No newline at end of file diff --git a/include/f1x/openauto/autoapp/App.hpp b/include/f1x/openauto/autoapp/App.hpp index 4ecd245..0af1e18 100644 --- a/include/f1x/openauto/autoapp/App.hpp +++ b/include/f1x/openauto/autoapp/App.hpp @@ -18,11 +18,11 @@ #pragma once -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include diff --git a/include/f1x/openauto/autoapp/Service/AndroidAutoEntity.hpp b/include/f1x/openauto/autoapp/Service/AndroidAutoEntity.hpp index 0ae914c..7bfe7a3 100644 --- a/include/f1x/openauto/autoapp/Service/AndroidAutoEntity.hpp +++ b/include/f1x/openauto/autoapp/Service/AndroidAutoEntity.hpp @@ -60,8 +60,10 @@ public: void onShutdownRequest(const aasdk::proto::messages::ShutdownRequest& request) override; void onShutdownResponse(const aasdk::proto::messages::ShutdownResponse& response) override; void onNavigationFocusRequest(const aasdk::proto::messages::NavigationFocusRequest& request) override; - void onPingResponse(const aasdk::proto::messages::PingResponse& response) override; void onChannelError(const aasdk::error::Error& e) override; + void onPingRequest(const aasdk::proto::messages::PingRequest& request) override; + void onPingResponse(const aasdk::proto::messages::PingResponse& response) override; + void onVoiceSessionRequest(const aasdk::proto::messages::VoiceSessionRequest& request) override; private: using std::enable_shared_from_this::shared_from_this; diff --git a/include/f1x/openauto/btservice/AndroidBluetoothServer.hpp b/include/f1x/openauto/btservice/AndroidBluetoothServer.hpp index bfa40d6..4eb540b 100644 --- a/include/f1x/openauto/btservice/AndroidBluetoothServer.hpp +++ b/include/f1x/openauto/btservice/AndroidBluetoothServer.hpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include namespace f1x { diff --git a/src/autoapp/App.cpp b/src/autoapp/App.cpp index 3967385..b016ea2 100644 --- a/src/autoapp/App.cpp +++ b/src/autoapp/App.cpp @@ -17,8 +17,8 @@ */ #include -#include -#include +#include +#include #include #include diff --git a/src/autoapp/Service/AndroidAutoEntity.cpp b/src/autoapp/Service/AndroidAutoEntity.cpp index 02986dd..7a4985e 100644 --- a/src/autoapp/Service/AndroidAutoEntity.cpp +++ b/src/autoapp/Service/AndroidAutoEntity.cpp @@ -238,6 +238,20 @@ void AndroidAutoEntity::onShutdownRequest(const aasdk::proto::messages::Shutdown controlServiceChannel_->sendShutdownResponse(response, std::move(promise)); } +void AndroidAutoEntity::onPingRequest(const aasdk::proto::messages::PingRequest& request) +{ + OPENAUTO_LOG(info) << "[AndroidAutoEntity] ping request "; + + auto promise = aasdk::channel::SendPromise::defer(strand_); + promise->then([]() {}, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), std::placeholders::_1)); + controlServiceChannel_->sendPingRequest(request, std::move(promise)); +} + +void AndroidAutoEntity::onVoiceSessionRequest(const aasdk::proto::messages::VoiceSessionRequest& request) +{ + OPENAUTO_LOG(error) << "[AndroidAutoEntity] voice session request not implemented"; +} + void AndroidAutoEntity::onShutdownResponse(const aasdk::proto::messages::ShutdownResponse&) { OPENAUTO_LOG(info) << "[AndroidAutoEntity] Shutdown response "; diff --git a/src/autoapp/Service/SensorService.cpp b/src/autoapp/Service/SensorService.cpp index 851744e..7a47d6c 100644 --- a/src/autoapp/Service/SensorService.cpp +++ b/src/autoapp/Service/SensorService.cpp @@ -188,7 +188,7 @@ void SensorService::sendGPSLocationData() auto * locInd = indication.add_gps_location(); // epoch seconds - locInd->set_timestamp(this->gpsData_.fix.time * 1e3); + locInd->set_timestamp(this->gpsData_.fix.time.tv_sec); // degrees locInd->set_latitude(this->gpsData_.fix.latitude * 1e7); locInd->set_longitude(this->gpsData_.fix.longitude * 1e7); @@ -229,8 +229,7 @@ void SensorService::sensorPolling() if ((this->gpsEnabled_) && (gps_waiting(&this->gpsData_, 0)) && - (gps_read(&this->gpsData_) > 0) && - (this->gpsData_.status != STATUS_NO_FIX) && + (gps_read(&this->gpsData_, nullptr, 0) > 0) && (this->gpsData_.fix.mode == MODE_2D || this->gpsData_.fix.mode == MODE_3D) && (this->gpsData_.set & TIME_SET) && (this->gpsData_.set & LATLON_SET)) diff --git a/src/autoapp/autoapp.cpp b/src/autoapp/autoapp.cpp index a2f1ea1..82b423b 100644 --- a/src/autoapp/autoapp.cpp +++ b/src/autoapp/autoapp.cpp @@ -19,12 +19,12 @@ #include #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -38,7 +38,6 @@ #include #include -namespace aasdk = f1x::aasdk; namespace autoapp = f1x::openauto::autoapp; using ThreadPool = std::vector; diff --git a/src/btservice/AndroidBluetoothServer.cpp b/src/btservice/AndroidBluetoothServer.cpp index ee3bfd6..7f25707 100644 --- a/src/btservice/AndroidBluetoothServer.cpp +++ b/src/btservice/AndroidBluetoothServer.cpp @@ -23,6 +23,7 @@ #include #include #include + #include #include #include @@ -61,7 +62,7 @@ namespace f1x { // connect(socket, &QBluetoothSocket::disconnected, this, // QOverload<>::of(&ChatServer::clientDisconnected)); - f1x::aasdk::proto::messages::WifiInfoRequest request; + ::aasdk::proto::messages::WifiInfoRequest request; request.set_ip_address(getIP4_("wlan0")); request.set_port(5000); @@ -121,26 +122,26 @@ namespace f1x { } void AndroidBluetoothServer::handleWifiInfoRequest(QByteArray &buffer, uint16_t length) { - f1x::aasdk::proto::messages::WifiInfoRequest msg; + ::aasdk::proto::messages::WifiInfoRequest msg; msg.ParseFromArray(buffer.data() + 4, length); OPENAUTO_LOG(info) << "WifiInfoRequest: " << msg.DebugString(); - f1x::aasdk::proto::messages::WifiInfoResponse response; + ::aasdk::proto::messages::WifiInfoResponse response; response.set_ip_address(getIP4_("wlan0")); response.set_port(5000); - response.set_status(aasdk::proto::messages::WifiInfoResponse_Status_STATUS_SUCCESS); + response.set_status(::aasdk::proto::messages::WifiInfoResponse_Status_STATUS_SUCCESS); sendMessage(response, 7); } void AndroidBluetoothServer::handleWifiSecurityRequest(QByteArray &buffer, uint16_t length) { - f1x::aasdk::proto::messages::WifiSecurityReponse response; + ::aasdk::proto::messages::WifiSecurityReponse response; response.set_ssid(configuration_->getParamFromFile("/etc/hostapd/hostapd.conf","ssid").toStdString()); response.set_bssid(QNetworkInterface::interfaceFromName("wlan0").hardwareAddress().toStdString()); response.set_key(configuration_->getParamFromFile("/etc/hostapd/hostapd.conf","wpa_passphrase").toStdString()); - response.set_security_mode(aasdk::proto::messages::WifiSecurityReponse_SecurityMode_WPA2_PERSONAL); - response.set_access_point_type(aasdk::proto::messages::WifiSecurityReponse_AccessPointType_STATIC); + response.set_security_mode(::aasdk::proto::messages::WifiSecurityReponse_SecurityMode_WPA2_PERSONAL); + response.set_access_point_type(::aasdk::proto::messages::WifiSecurityReponse_AccessPointType_STATIC); sendMessage(response, 3); } @@ -170,7 +171,7 @@ namespace f1x { } void AndroidBluetoothServer::handleWifiInfoRequestResponse(QByteArray &buffer, uint16_t length) { - f1x::aasdk::proto::messages::WifiInfoResponse msg; + ::aasdk::proto::messages::WifiInfoResponse msg; msg.ParseFromArray(buffer.data() + 4, length); OPENAUTO_LOG(info) << "WifiInfoResponse: " << msg.DebugString(); } @@ -184,4 +185,4 @@ namespace f1x { } } } -} \ No newline at end of file +}