Backport LibGPS updates a79d155bd658eff85036f0d7d29486faac0bf3cc
Backport and merge artefacts from a5cdf161ad1aefcda5425b5bef56032e1c510219
This commit is contained in:
parent
d19a4438ca
commit
17d4bfbcda
@ -27,6 +27,7 @@
|
||||
#include <f1x/openauto/autoapp/Service/IAndroidAutoEntity.hpp>
|
||||
#include <f1x/openauto/autoapp/Service/IService.hpp>
|
||||
#include <f1x/openauto/autoapp/Service/IPinger.hpp>
|
||||
#include <Transport/ITransport.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>
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <f1x/openauto/autoapp/Service/IService.hpp>
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <aasdk/Messenger/IMessenger.hpp>
|
||||
|
||||
#include <f1x/openauto/autoapp/Configuration/IConfiguration.hpp>
|
||||
|
||||
namespace f1x::openauto::autoapp::service::wifiprojection {
|
||||
|
||||
@ -31,7 +31,7 @@ namespace f1x::openauto::autoapp::service::wifiprojection {
|
||||
public IService,
|
||||
public std::enable_shared_from_this<WifiProjectionService> {
|
||||
public:
|
||||
WifiProjectionService(boost::asio::io_service &ioService, aasdk::messenger::IMessenger::Pointer messenger);
|
||||
WifiProjectionService(boost::asio::io_service &ioService, aasdk::messenger::IMessenger::Pointer messenger, configuration::IConfiguration::Pointer configuration);
|
||||
|
||||
void start() override;
|
||||
|
||||
@ -53,6 +53,7 @@ namespace f1x::openauto::autoapp::service::wifiprojection {
|
||||
|
||||
private:
|
||||
using std::enable_shared_from_this<WifiProjectionService>::shared_from_this;
|
||||
configuration::IConfiguration::Pointer configuration_;
|
||||
boost::asio::deadline_timer timer_;
|
||||
boost::asio::io_service::strand strand_;
|
||||
aasdk::channel::wifiprojection::WifiProjectionService::Pointer channel_;
|
||||
|
@ -263,21 +263,6 @@ namespace f1x {
|
||||
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(info) << "[AndroidAutoEntity] onVoiceSessionRequest()";
|
||||
controlServiceChannel_->receive(this->shared_from_this());
|
||||
}
|
||||
|
||||
void AndroidAutoEntity::onByeByeResponse(
|
||||
const aap_protobuf::service::control::message::ByeByeResponse &response) {
|
||||
OPENAUTO_LOG(info) << "[AndroidAutoEntity] onByeByeResponse()";
|
||||
|
@ -178,7 +178,11 @@ namespace f1x::openauto::autoapp::service::sensor {
|
||||
auto *locInd = indication.add_location_data();
|
||||
|
||||
// epoch seconds
|
||||
// locInd->set_timestamp(this->gpsData_.fix.time * 1e3);
|
||||
#if GPSD_API_MAJOR_VERSION >= 7
|
||||
locInd->set_timestamp(this->gpsData_.fix.time.tv_sec);
|
||||
#else
|
||||
locInd->set_timestamp(this->gpsData_.fix.time);
|
||||
#endif
|
||||
// degrees
|
||||
locInd->set_latitude_e7(this->gpsData_.fix.latitude * 1e7);
|
||||
locInd->set_longitude_e7(this->gpsData_.fix.longitude * 1e7);
|
||||
@ -214,14 +218,23 @@ namespace f1x::openauto::autoapp::service::sensor {
|
||||
this->previous = this->isNight;
|
||||
this->sendNightData();
|
||||
}
|
||||
|
||||
bool gpsDataAvailable = false;
|
||||
#if GPSD_API_MAJOR_VERSION >= 7
|
||||
if (gps_read (&this->gpsData_, NULL, 0) != -1) {
|
||||
gpsDataAvailable = true;
|
||||
}
|
||||
#else
|
||||
if (gps_read (&this->gpsData_) != -1) {
|
||||
gpsDataAvailable = true;
|
||||
}
|
||||
#endif
|
||||
if ((this->gpsEnabled_) &&
|
||||
(gps_waiting(&this->gpsData_, 0)) &&
|
||||
(gps_read(&this->gpsData_) > 0) &&
|
||||
(this->gpsData_.status != STATUS_NO_FIX) &&
|
||||
(gpsDataAvailable == true) &&
|
||||
(this->gpsData_.fix.mode == MODE_2D || this->gpsData_.fix.mode == MODE_3D) &&
|
||||
(this->gpsData_.set & TIME_SET) &&
|
||||
(this->gpsData_.set & LATLON_SET)) {
|
||||
(this->gpsData_.set & LATLON_SET))
|
||||
{
|
||||
this->sendGPSLocationData();
|
||||
}
|
||||
|
||||
|
@ -25,8 +25,10 @@
|
||||
|
||||
namespace f1x::openauto::autoapp::service::wifiprojection {
|
||||
WifiProjectionService::WifiProjectionService(boost::asio::io_service &ioService,
|
||||
aasdk::messenger::IMessenger::Pointer messenger)
|
||||
: strand_(ioService),
|
||||
aasdk::messenger::IMessenger::Pointer messenger,
|
||||
configuration::IConfiguration::Pointer configuration)
|
||||
: configuration_(std::move(configuration)),
|
||||
strand_(ioService),
|
||||
timer_(ioService),
|
||||
channel_(
|
||||
std::make_shared<aasdk::channel::wifiprojection::WifiProjectionService>(strand_, std::move(messenger))) {
|
||||
@ -76,8 +78,10 @@ namespace f1x::openauto::autoapp::service::wifiprojection {
|
||||
aap_protobuf::service::wifiprojection::message::WifiCredentialsResponse response;
|
||||
|
||||
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_ssid(configuration_->getParamFromFile("/etc/hostapd/hostapd.conf","ssid").toStdString());
|
||||
response.set_car_wifi_password(configuration_->getParamFromFile("/etc/hostapd/hostapd.conf","wpa_passphrase").toStdString());
|
||||
|
||||
// Might need to set WPA2_ENTERPRISE
|
||||
response.set_car_wifi_security_mode(
|
||||
aap_protobuf::service::wifiprojection::message::WifiSecurityMode::WPA2_PERSONAL);
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <aasdk/USB/AccessoryModeQueryChainFactory.hpp>
|
||||
#include <aasdk/USB/AccessoryModeQueryFactory.hpp>
|
||||
#include <aasdk/TCP/TCPWrapper.hpp>
|
||||
#include <boost/log/utility/setup.hpp>
|
||||
#include <f1x/openauto/autoapp/App.hpp>
|
||||
#include <f1x/openauto/autoapp/Configuration/IConfiguration.hpp>
|
||||
#include <f1x/openauto/autoapp/Configuration/RecentAddressesList.hpp>
|
||||
@ -71,8 +72,25 @@ void startIOServiceWorkers(boost::asio::io_service& ioService, ThreadPool& threa
|
||||
threadPool.emplace_back(ioServiceWorker);
|
||||
}
|
||||
|
||||
void configureLogging() {
|
||||
const std::string logIni = "openauto-logs.ini";
|
||||
std::ifstream logSettings(logIni);
|
||||
if (logSettings.good()) {
|
||||
try {
|
||||
// For boost < 1.71 the severity types are not automatically parsed so lets register them.
|
||||
boost::log::register_simple_filter_factory<boost::log::trivial::severity_level>("Severity");
|
||||
boost::log::register_simple_formatter_factory<boost::log::trivial::severity_level, char>("Severity");
|
||||
boost::log::init_from_stream(logSettings);
|
||||
} catch (std::exception const & e) {
|
||||
OPENAUTO_LOG(warning) << "[OpenAuto] " << logIni << " was provided but was not valid.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
configureLogging();
|
||||
|
||||
libusb_context* usbContext;
|
||||
if(libusb_init(&usbContext) != 0)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user