FR 48850 - Device based hybrid ODCPI
Adding support for sending ODCPI request to framework via IGnss interface. Change-Id: I97ab4f00505705fedc266998602499fd344baf31 CRs-Fixed: 2217664
This commit is contained in:
parent
66c682f7d9
commit
98edc19bea
13 changed files with 280 additions and 19 deletions
|
@ -25,6 +25,8 @@
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <cutils/properties.h>
|
#include <cutils/properties.h>
|
||||||
#include "Gnss.h"
|
#include "Gnss.h"
|
||||||
|
#include <LocationUtil.h>
|
||||||
|
|
||||||
typedef void* (getLocationInterface)();
|
typedef void* (getLocationInterface)();
|
||||||
|
|
||||||
#define IMAGES_INFO_FILE "/sys/devices/soc0/images"
|
#define IMAGES_INFO_FILE "/sys/devices/soc0/images"
|
||||||
|
@ -372,6 +374,14 @@ Return<sp<V1_0::IAGnssRil>> Gnss::getExtensionAGnssRil() {
|
||||||
Return<bool> Gnss::setCallback_1_1(const sp<V1_1::IGnssCallback>& callback) {
|
Return<bool> Gnss::setCallback_1_1(const sp<V1_1::IGnssCallback>& callback) {
|
||||||
ENTRY_LOG_CALLFLOW();
|
ENTRY_LOG_CALLFLOW();
|
||||||
callback->gnssNameCb(getVersionString());
|
callback->gnssNameCb(getVersionString());
|
||||||
|
mGnssCbIface_1_1 = callback;
|
||||||
|
GnssInterface* gnssInterface = getGnssInterface();
|
||||||
|
if (nullptr != gnssInterface) {
|
||||||
|
OdcpiRequestCallback cb = [this](const OdcpiRequestInfo& odcpiRequest) {
|
||||||
|
odcpiRequestCb(odcpiRequest);
|
||||||
|
};
|
||||||
|
gnssInterface->odcpiInit(cb);
|
||||||
|
}
|
||||||
return setCallback(callback);
|
return setCallback(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -407,11 +417,36 @@ Return<sp<V1_1::IGnssConfiguration>> Gnss::getExtensionGnssConfiguration_1_1() {
|
||||||
return mGnssConfig;
|
return mGnssConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<bool> Gnss::injectBestLocation(const GnssLocation&) {
|
Return<bool> Gnss::injectBestLocation(const GnssLocation& gnssLocation) {
|
||||||
ENTRY_LOG_CALLFLOW();
|
ENTRY_LOG_CALLFLOW();
|
||||||
|
GnssInterface* gnssInterface = getGnssInterface();
|
||||||
|
if (nullptr != gnssInterface) {
|
||||||
|
Location location = {};
|
||||||
|
convertGnssLocation(gnssLocation, location);
|
||||||
|
gnssInterface->odcpiInject(location);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Gnss::odcpiRequestCb(const OdcpiRequestInfo& request) {
|
||||||
|
ENTRY_LOG_CALLFLOW();
|
||||||
|
if (mGnssCbIface_1_1 != nullptr) {
|
||||||
|
// For emergency mode, request DBH (Device based hybrid) location
|
||||||
|
// Mark Independent from GNSS flag to false.
|
||||||
|
if (ODCPI_REQUEST_TYPE_START == request.type) {
|
||||||
|
if (request.isEmergencyMode) {
|
||||||
|
mGnssCbIface_1_1->gnssRequestLocationCb(false);
|
||||||
|
} else {
|
||||||
|
mGnssCbIface_1_1->gnssRequestLocationCb(true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LOC_LOGv("Unsupported ODCPI request type: %d", request.type);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LOC_LOGe("ODCPI request not supported.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
IGnss* HIDL_FETCH_IGnss(const char* hal) {
|
IGnss* HIDL_FETCH_IGnss(const char* hal) {
|
||||||
ENTRY_LOG_CALLFLOW();
|
ENTRY_LOG_CALLFLOW();
|
||||||
IGnss* iface = nullptr;
|
IGnss* iface = nullptr;
|
||||||
|
|
|
@ -111,6 +111,9 @@ struct Gnss : public IGnss {
|
||||||
Return<bool> updateConfiguration(GnssConfig& gnssConfig);
|
Return<bool> updateConfiguration(GnssConfig& gnssConfig);
|
||||||
GnssInterface* getGnssInterface();
|
GnssInterface* getGnssInterface();
|
||||||
|
|
||||||
|
// Callback for ODCPI request
|
||||||
|
void odcpiRequestCb(const OdcpiRequestInfo& request);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct GnssDeathRecipient : hidl_death_recipient {
|
struct GnssDeathRecipient : hidl_death_recipient {
|
||||||
GnssDeathRecipient(sp<Gnss> gnss) : mGnss(gnss) {
|
GnssDeathRecipient(sp<Gnss> gnss) : mGnss(gnss) {
|
||||||
|
@ -134,6 +137,7 @@ struct Gnss : public IGnss {
|
||||||
|
|
||||||
GnssAPIClient* mApi = nullptr;
|
GnssAPIClient* mApi = nullptr;
|
||||||
sp<V1_0::IGnssCallback> mGnssCbIface = nullptr;
|
sp<V1_0::IGnssCallback> mGnssCbIface = nullptr;
|
||||||
|
sp<V1_1::IGnssCallback> mGnssCbIface_1_1 = nullptr;
|
||||||
sp<V1_0::IGnssNiCallback> mGnssNiCbIface = nullptr;
|
sp<V1_0::IGnssNiCallback> mGnssNiCbIface = nullptr;
|
||||||
GnssConfig mPendingConfig;
|
GnssConfig mPendingConfig;
|
||||||
GnssInterface* mGnssInterface = nullptr;
|
GnssInterface* mGnssInterface = nullptr;
|
||||||
|
|
|
@ -42,34 +42,83 @@ using ::android::hardware::gnss::V1_0::GnssLocationFlags;
|
||||||
void convertGnssLocation(Location& in, GnssLocation& out)
|
void convertGnssLocation(Location& in, GnssLocation& out)
|
||||||
{
|
{
|
||||||
memset(&out, 0, sizeof(GnssLocation));
|
memset(&out, 0, sizeof(GnssLocation));
|
||||||
if (in.flags & LOCATION_HAS_LAT_LONG_BIT)
|
if (in.flags & LOCATION_HAS_LAT_LONG_BIT) {
|
||||||
out.gnssLocationFlags |= GnssLocationFlags::HAS_LAT_LONG;
|
out.gnssLocationFlags |= GnssLocationFlags::HAS_LAT_LONG;
|
||||||
if (in.flags & LOCATION_HAS_ALTITUDE_BIT)
|
|
||||||
out.gnssLocationFlags |= GnssLocationFlags::HAS_ALTITUDE;
|
|
||||||
if (in.flags & LOCATION_HAS_SPEED_BIT)
|
|
||||||
out.gnssLocationFlags |= GnssLocationFlags::HAS_SPEED;
|
|
||||||
if (in.flags & LOCATION_HAS_BEARING_BIT)
|
|
||||||
out.gnssLocationFlags |= GnssLocationFlags::HAS_BEARING;
|
|
||||||
if (in.flags & LOCATION_HAS_ACCURACY_BIT)
|
|
||||||
out.gnssLocationFlags |= GnssLocationFlags::HAS_HORIZONTAL_ACCURACY;
|
|
||||||
if (in.flags & LOCATION_HAS_VERTICAL_ACCURACY_BIT)
|
|
||||||
out.gnssLocationFlags |= GnssLocationFlags::HAS_VERTICAL_ACCURACY;
|
|
||||||
if (in.flags & LOCATION_HAS_SPEED_ACCURACY_BIT)
|
|
||||||
out.gnssLocationFlags |= GnssLocationFlags::HAS_SPEED_ACCURACY;
|
|
||||||
if (in.flags & LOCATION_HAS_BEARING_ACCURACY_BIT)
|
|
||||||
out.gnssLocationFlags |= GnssLocationFlags::HAS_BEARING_ACCURACY;
|
|
||||||
out.latitudeDegrees = in.latitude;
|
out.latitudeDegrees = in.latitude;
|
||||||
out.longitudeDegrees = in.longitude;
|
out.longitudeDegrees = in.longitude;
|
||||||
|
}
|
||||||
|
if (in.flags & LOCATION_HAS_ALTITUDE_BIT) {
|
||||||
|
out.gnssLocationFlags |= GnssLocationFlags::HAS_ALTITUDE;
|
||||||
out.altitudeMeters = in.altitude;
|
out.altitudeMeters = in.altitude;
|
||||||
|
}
|
||||||
|
if (in.flags & LOCATION_HAS_SPEED_BIT) {
|
||||||
|
out.gnssLocationFlags |= GnssLocationFlags::HAS_SPEED;
|
||||||
out.speedMetersPerSec = in.speed;
|
out.speedMetersPerSec = in.speed;
|
||||||
|
}
|
||||||
|
if (in.flags & LOCATION_HAS_BEARING_BIT) {
|
||||||
|
out.gnssLocationFlags |= GnssLocationFlags::HAS_BEARING;
|
||||||
out.bearingDegrees = in.bearing;
|
out.bearingDegrees = in.bearing;
|
||||||
|
}
|
||||||
|
if (in.flags & LOCATION_HAS_ACCURACY_BIT) {
|
||||||
|
out.gnssLocationFlags |= GnssLocationFlags::HAS_HORIZONTAL_ACCURACY;
|
||||||
out.horizontalAccuracyMeters = in.accuracy;
|
out.horizontalAccuracyMeters = in.accuracy;
|
||||||
|
}
|
||||||
|
if (in.flags & LOCATION_HAS_VERTICAL_ACCURACY_BIT) {
|
||||||
|
out.gnssLocationFlags |= GnssLocationFlags::HAS_VERTICAL_ACCURACY;
|
||||||
out.verticalAccuracyMeters = in.verticalAccuracy;
|
out.verticalAccuracyMeters = in.verticalAccuracy;
|
||||||
|
}
|
||||||
|
if (in.flags & LOCATION_HAS_SPEED_ACCURACY_BIT) {
|
||||||
|
out.gnssLocationFlags |= GnssLocationFlags::HAS_SPEED_ACCURACY;
|
||||||
out.speedAccuracyMetersPerSecond = in.speedAccuracy;
|
out.speedAccuracyMetersPerSecond = in.speedAccuracy;
|
||||||
|
}
|
||||||
|
if (in.flags & LOCATION_HAS_BEARING_ACCURACY_BIT) {
|
||||||
|
out.gnssLocationFlags |= GnssLocationFlags::HAS_BEARING_ACCURACY;
|
||||||
out.bearingAccuracyDegrees = in.bearingAccuracy;
|
out.bearingAccuracyDegrees = in.bearingAccuracy;
|
||||||
|
}
|
||||||
|
|
||||||
out.timestamp = static_cast<V1_0::GnssUtcTime>(in.timestamp);
|
out.timestamp = static_cast<V1_0::GnssUtcTime>(in.timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void convertGnssLocation(const GnssLocation& in, Location& out)
|
||||||
|
{
|
||||||
|
memset(&out, 0, sizeof(out));
|
||||||
|
if (in.gnssLocationFlags & GnssLocationFlags::HAS_LAT_LONG) {
|
||||||
|
out.flags |= LOCATION_HAS_LAT_LONG_BIT;
|
||||||
|
out.latitude = in.latitudeDegrees;
|
||||||
|
out.longitude = in.longitudeDegrees;
|
||||||
|
}
|
||||||
|
if (in.gnssLocationFlags & GnssLocationFlags::HAS_ALTITUDE) {
|
||||||
|
out.flags |= LOCATION_HAS_ALTITUDE_BIT;
|
||||||
|
out.altitude = in.altitudeMeters;
|
||||||
|
}
|
||||||
|
if (in.gnssLocationFlags & GnssLocationFlags::HAS_SPEED) {
|
||||||
|
out.flags |= LOCATION_HAS_SPEED_BIT;
|
||||||
|
out.speed = in.speedMetersPerSec;
|
||||||
|
}
|
||||||
|
if (in.gnssLocationFlags & GnssLocationFlags::HAS_BEARING) {
|
||||||
|
out.flags |= LOCATION_HAS_BEARING_BIT;
|
||||||
|
out.bearing = in.bearingDegrees;
|
||||||
|
}
|
||||||
|
if (in.gnssLocationFlags & GnssLocationFlags::HAS_HORIZONTAL_ACCURACY) {
|
||||||
|
out.flags |= LOCATION_HAS_ACCURACY_BIT;
|
||||||
|
out.accuracy = in.horizontalAccuracyMeters;
|
||||||
|
}
|
||||||
|
if (in.gnssLocationFlags & GnssLocationFlags::HAS_VERTICAL_ACCURACY) {
|
||||||
|
out.flags |= LOCATION_HAS_VERTICAL_ACCURACY_BIT;
|
||||||
|
out.verticalAccuracy = in.verticalAccuracyMeters;
|
||||||
|
}
|
||||||
|
if (in.gnssLocationFlags & GnssLocationFlags::HAS_SPEED_ACCURACY) {
|
||||||
|
out.flags |= LOCATION_HAS_SPEED_ACCURACY_BIT;
|
||||||
|
out.speedAccuracy = in.speedAccuracyMetersPerSecond;
|
||||||
|
}
|
||||||
|
if (in.gnssLocationFlags & GnssLocationFlags::HAS_BEARING_ACCURACY) {
|
||||||
|
out.flags |= LOCATION_HAS_BEARING_ACCURACY_BIT;
|
||||||
|
out.bearingAccuracy = in.bearingAccuracyDegrees;
|
||||||
|
}
|
||||||
|
|
||||||
|
out.timestamp = static_cast<uint64_t>(in.timestamp);
|
||||||
|
}
|
||||||
|
|
||||||
void convertGnssConstellationType(GnssSvType& in, GnssConstellationType& out)
|
void convertGnssConstellationType(GnssSvType& in, GnssConstellationType& out)
|
||||||
{
|
{
|
||||||
switch(in) {
|
switch(in) {
|
||||||
|
|
|
@ -41,6 +41,7 @@ namespace V1_1 {
|
||||||
namespace implementation {
|
namespace implementation {
|
||||||
|
|
||||||
void convertGnssLocation(Location& in, V1_0::GnssLocation& out);
|
void convertGnssLocation(Location& in, V1_0::GnssLocation& out);
|
||||||
|
void convertGnssLocation(const V1_0::GnssLocation& in, Location& out);
|
||||||
void convertGnssConstellationType(GnssSvType& in, V1_0::GnssConstellationType& out);
|
void convertGnssConstellationType(GnssSvType& in, V1_0::GnssConstellationType& out);
|
||||||
void convertGnssEphemerisType(GnssEphemerisType& in, GnssDebug::SatelliteEphemerisType& out);
|
void convertGnssEphemerisType(GnssEphemerisType& in, GnssDebug::SatelliteEphemerisType& out);
|
||||||
void convertGnssEphemerisSource(GnssEphemerisSource& in, GnssDebug::SatelliteEphemerisSource& out);
|
void convertGnssEphemerisSource(GnssEphemerisSource& in, GnssDebug::SatelliteEphemerisSource& out);
|
||||||
|
|
|
@ -173,4 +173,8 @@ DEFAULT_IMPL()
|
||||||
void LocAdapterBase::reportGnssSvTypeConfigEvent(const GnssSvTypeConfig& /*config*/)
|
void LocAdapterBase::reportGnssSvTypeConfigEvent(const GnssSvTypeConfig& /*config*/)
|
||||||
DEFAULT_IMPL()
|
DEFAULT_IMPL()
|
||||||
|
|
||||||
|
bool LocAdapterBase::
|
||||||
|
requestOdcpiEvent(OdcpiRequestInfo& /*request*/)
|
||||||
|
DEFAULT_IMPL(false)
|
||||||
|
|
||||||
} // namespace loc_core
|
} // namespace loc_core
|
||||||
|
|
|
@ -160,6 +160,7 @@ public:
|
||||||
GpsLocationExtended &location_extended, LocPosTechMask tech_mask);
|
GpsLocationExtended &location_extended, LocPosTechMask tech_mask);
|
||||||
virtual void reportGnssSvIdConfigEvent(const GnssSvIdConfig& config);
|
virtual void reportGnssSvIdConfigEvent(const GnssSvIdConfig& config);
|
||||||
virtual void reportGnssSvTypeConfigEvent(const GnssSvTypeConfig& config);
|
virtual void reportGnssSvTypeConfigEvent(const GnssSvTypeConfig& config);
|
||||||
|
virtual bool requestOdcpiEvent(OdcpiRequestInfo& request);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace loc_core
|
} // namespace loc_core
|
||||||
|
|
|
@ -288,6 +288,11 @@ void LocApiBase::reportZppBestAvailableFix(LocGpsLocation &zppLoc,
|
||||||
location_extended, tech_mask));
|
location_extended, tech_mask));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LocApiBase::requestOdcpi(OdcpiRequestInfo& request)
|
||||||
|
{
|
||||||
|
// loop through adapters, and deliver to the first handling adapter.
|
||||||
|
TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestOdcpiEvent(request));
|
||||||
|
}
|
||||||
|
|
||||||
void LocApiBase::reportSv(GnssSvNotification& svNotify)
|
void LocApiBase::reportSv(GnssSvNotification& svNotify)
|
||||||
{
|
{
|
||||||
|
@ -467,6 +472,10 @@ void LocApiBase::
|
||||||
injectPosition(double /*latitude*/, double /*longitude*/, float /*accuracy*/)
|
injectPosition(double /*latitude*/, double /*longitude*/, float /*accuracy*/)
|
||||||
DEFAULT_IMPL()
|
DEFAULT_IMPL()
|
||||||
|
|
||||||
|
void LocApiBase::
|
||||||
|
injectPosition(const Location& /*location*/, bool /*onDemandCpi*/)
|
||||||
|
DEFAULT_IMPL()
|
||||||
|
|
||||||
void LocApiBase::
|
void LocApiBase::
|
||||||
setTime(LocGpsUtcTime /*time*/, int64_t /*timeReference*/, int /*uncertainty*/)
|
setTime(LocGpsUtcTime /*time*/, int64_t /*timeReference*/, int /*uncertainty*/)
|
||||||
DEFAULT_IMPL()
|
DEFAULT_IMPL()
|
||||||
|
|
|
@ -159,6 +159,7 @@ public:
|
||||||
LocPosTechMask tech_mask);
|
LocPosTechMask tech_mask);
|
||||||
void reportGnssSvIdConfig(const GnssSvIdConfig& config);
|
void reportGnssSvIdConfig(const GnssSvIdConfig& config);
|
||||||
void reportGnssSvTypeConfig(const GnssSvTypeConfig& config);
|
void reportGnssSvTypeConfig(const GnssSvTypeConfig& config);
|
||||||
|
void requestOdcpi(OdcpiRequestInfo& request);
|
||||||
|
|
||||||
// downward calls
|
// downward calls
|
||||||
// All below functions are to be defined by adapter specific modules:
|
// All below functions are to be defined by adapter specific modules:
|
||||||
|
@ -174,6 +175,8 @@ public:
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
injectPosition(double latitude, double longitude, float accuracy);
|
injectPosition(double latitude, double longitude, float accuracy);
|
||||||
|
virtual void
|
||||||
|
injectPosition(const Location& location, bool onDemandCpi);
|
||||||
virtual void
|
virtual void
|
||||||
setTime(LocGpsUtcTime time, int64_t timeReference, int uncertainty);
|
setTime(LocGpsUtcTime time, int64_t timeReference, int uncertainty);
|
||||||
|
|
||||||
|
|
|
@ -80,6 +80,9 @@ GnssAdapter::GnssAdapter() :
|
||||||
mNiData(),
|
mNiData(),
|
||||||
mAgpsManager(),
|
mAgpsManager(),
|
||||||
mAgpsCbInfo(),
|
mAgpsCbInfo(),
|
||||||
|
mOdcpiRequestCb(nullptr),
|
||||||
|
mOdcpiRequestActive(false),
|
||||||
|
mOdcpiInjectedPositionCount(0),
|
||||||
mSystemStatus(SystemStatus::getInstance(mMsgTask)),
|
mSystemStatus(SystemStatus::getInstance(mMsgTask)),
|
||||||
mServerUrl(":"),
|
mServerUrl(":"),
|
||||||
mXtraObserver(mSystemStatus->getOsObserver(), mMsgTask)
|
mXtraObserver(mSystemStatus->getOsObserver(), mMsgTask)
|
||||||
|
@ -1865,6 +1868,11 @@ GnssAdapter::updateClientsEventMask()
|
||||||
mask |= LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST;
|
mask |= LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add ODCPI handling
|
||||||
|
if (nullptr != mOdcpiRequestCb) {
|
||||||
|
mask |= LOC_API_ADAPTER_BIT_REQUEST_WIFI;
|
||||||
|
}
|
||||||
|
|
||||||
updateEvtMask(mask, LOC_REGISTRATION_MASK_SET);
|
updateEvtMask(mask, LOC_REGISTRATION_MASK_SET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3389,6 +3397,100 @@ GnssAdapter::reportSvPolynomialEvent(GnssSvPolynomial &svPolynomial)
|
||||||
mEngHubProxy->gnssReportSvPolynomial(svPolynomial);
|
mEngHubProxy->gnssReportSvPolynomial(svPolynomial);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
GnssAdapter::requestOdcpiEvent(OdcpiRequestInfo& request)
|
||||||
|
{
|
||||||
|
LOC_LOGd("ODCPI request: type %d, tbf %d, isEmergency %d", request.type,
|
||||||
|
request.tbfMillis, request.isEmergencyMode);
|
||||||
|
|
||||||
|
struct MsgRequestOdcpi : public LocMsg {
|
||||||
|
GnssAdapter& mAdapter;
|
||||||
|
OdcpiRequestInfo mOdcpiRequest;
|
||||||
|
inline MsgRequestOdcpi(GnssAdapter& adapter, OdcpiRequestInfo& request) :
|
||||||
|
LocMsg(),
|
||||||
|
mAdapter(adapter),
|
||||||
|
mOdcpiRequest(request) {}
|
||||||
|
inline virtual void proc() const {
|
||||||
|
mAdapter.requestOdcpi(mOdcpiRequest);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
sendMsg(new MsgRequestOdcpi(*this, request));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GnssAdapter::requestOdcpi(const OdcpiRequestInfo& request)
|
||||||
|
{
|
||||||
|
if (nullptr != mOdcpiRequestCb) {
|
||||||
|
mOdcpiInjectedPositionCount = 0;
|
||||||
|
if (ODCPI_REQUEST_TYPE_START == request.type) {
|
||||||
|
mOdcpiRequestCb(request);
|
||||||
|
mOdcpiRequestActive = true;
|
||||||
|
} else {
|
||||||
|
mOdcpiRequestActive = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LOC_LOGe("ODCPI request not supported");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GnssAdapter::initOdcpiCommand(const OdcpiRequestCallback& callback)
|
||||||
|
{
|
||||||
|
struct MsgInitOdcpi : public LocMsg {
|
||||||
|
GnssAdapter& mAdapter;
|
||||||
|
OdcpiRequestCallback mOdcpiCb;
|
||||||
|
inline MsgInitOdcpi(GnssAdapter& adapter,
|
||||||
|
const OdcpiRequestCallback& callback) :
|
||||||
|
LocMsg(),
|
||||||
|
mAdapter(adapter),
|
||||||
|
mOdcpiCb(callback) {}
|
||||||
|
inline virtual void proc() const {
|
||||||
|
mAdapter.initOdcpi(mOdcpiCb);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
sendMsg(new MsgInitOdcpi(*this, callback));
|
||||||
|
}
|
||||||
|
|
||||||
|
void GnssAdapter::initOdcpi(const OdcpiRequestCallback& callback)
|
||||||
|
{
|
||||||
|
mOdcpiRequestCb = callback;
|
||||||
|
|
||||||
|
/* Register for WIFI request */
|
||||||
|
updateEvtMask(LOC_API_ADAPTER_BIT_REQUEST_WIFI,
|
||||||
|
LOC_REGISTRATION_MASK_ENABLED);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GnssAdapter::injectOdcpiCommand(const Location& location)
|
||||||
|
{
|
||||||
|
struct MsgInjectOdcpi : public LocMsg {
|
||||||
|
GnssAdapter& mAdapter;
|
||||||
|
Location mLocation;
|
||||||
|
inline MsgInjectOdcpi(GnssAdapter& adapter, const Location& location) :
|
||||||
|
LocMsg(),
|
||||||
|
mAdapter(adapter),
|
||||||
|
mLocation(location) {}
|
||||||
|
inline virtual void proc() const {
|
||||||
|
mAdapter.injectOdcpi(mLocation);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
sendMsg(new MsgInjectOdcpi(*this, location));
|
||||||
|
}
|
||||||
|
|
||||||
|
void GnssAdapter::injectOdcpi(const Location& location)
|
||||||
|
{
|
||||||
|
mLocApi->injectPosition(location, true);
|
||||||
|
if (mOdcpiRequestActive) {
|
||||||
|
mOdcpiInjectedPositionCount++;
|
||||||
|
if (mOdcpiInjectedPositionCount >=
|
||||||
|
ODCPI_INJECTED_POSITION_COUNT_PER_REQUEST) {
|
||||||
|
mOdcpiRequestActive = false;
|
||||||
|
mOdcpiInjectedPositionCount = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GnssAdapter::initDefaultAgps() {
|
void GnssAdapter::initDefaultAgps() {
|
||||||
LOC_LOGD("%s]: ", __func__);
|
LOC_LOGD("%s]: ", __func__);
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
#define MAX_SATELLITES_IN_USE 12
|
#define MAX_SATELLITES_IN_USE 12
|
||||||
#define LOC_NI_NO_RESPONSE_TIME 20
|
#define LOC_NI_NO_RESPONSE_TIME 20
|
||||||
#define LOC_GPS_NI_RESPONSE_IGNORE 4
|
#define LOC_GPS_NI_RESPONSE_IGNORE 4
|
||||||
|
#define ODCPI_INJECTED_POSITION_COUNT_PER_REQUEST 30
|
||||||
|
|
||||||
class GnssAdapter;
|
class GnssAdapter;
|
||||||
|
|
||||||
|
@ -110,12 +111,17 @@ class GnssAdapter : public LocAdapterBase {
|
||||||
/* ==== NI ============================================================================= */
|
/* ==== NI ============================================================================= */
|
||||||
NiData mNiData;
|
NiData mNiData;
|
||||||
|
|
||||||
/* ==== AGPS ========================================================*/
|
/* ==== AGPS =========================================================================== */
|
||||||
// This must be initialized via initAgps()
|
// This must be initialized via initAgps()
|
||||||
AgpsManager mAgpsManager;
|
AgpsManager mAgpsManager;
|
||||||
AgpsCbInfo mAgpsCbInfo;
|
AgpsCbInfo mAgpsCbInfo;
|
||||||
void initAgps(const AgpsCbInfo& cbInfo);
|
void initAgps(const AgpsCbInfo& cbInfo);
|
||||||
|
|
||||||
|
/* ==== ODCPI ========================================================================== */
|
||||||
|
OdcpiRequestCallback mOdcpiRequestCb;
|
||||||
|
bool mOdcpiRequestActive;
|
||||||
|
uint32_t mOdcpiInjectedPositionCount;
|
||||||
|
|
||||||
/* === SystemStatus ===================================================================== */
|
/* === SystemStatus ===================================================================== */
|
||||||
SystemStatus* mSystemStatus;
|
SystemStatus* mSystemStatus;
|
||||||
std::string mServerUrl;
|
std::string mServerUrl;
|
||||||
|
@ -129,6 +135,10 @@ class GnssAdapter : public LocAdapterBase {
|
||||||
static void convertLocationInfo(GnssLocationInfoNotification& out,
|
static void convertLocationInfo(GnssLocationInfoNotification& out,
|
||||||
const GpsLocationExtended& locationExtended);
|
const GpsLocationExtended& locationExtended);
|
||||||
|
|
||||||
|
/* ======== UTILITIES ================================================================== */
|
||||||
|
inline void initOdcpi(const OdcpiRequestCallback& callback);
|
||||||
|
inline void injectOdcpi(const Location& location);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
GnssAdapter();
|
GnssAdapter();
|
||||||
|
@ -250,6 +260,11 @@ public:
|
||||||
void dataConnClosedCommand(AGpsExtType agpsType);
|
void dataConnClosedCommand(AGpsExtType agpsType);
|
||||||
void dataConnFailedCommand(AGpsExtType agpsType);
|
void dataConnFailedCommand(AGpsExtType agpsType);
|
||||||
|
|
||||||
|
/* ========= ODCPI ===================================================================== */
|
||||||
|
/* ======== COMMANDS ====(Called from Client Thread)==================================== */
|
||||||
|
void initOdcpiCommand(const OdcpiRequestCallback& callback);
|
||||||
|
void injectOdcpiCommand(const Location& location);
|
||||||
|
|
||||||
/* ======== RESPONSES ================================================================== */
|
/* ======== RESPONSES ================================================================== */
|
||||||
void reportResponse(LocationError err, uint32_t sessionId);
|
void reportResponse(LocationError err, uint32_t sessionId);
|
||||||
void reportResponse(size_t count, LocationError* errs, uint32_t* ids);
|
void reportResponse(size_t count, LocationError* errs, uint32_t* ids);
|
||||||
|
@ -290,6 +305,7 @@ public:
|
||||||
virtual bool reportDataCallClosed();
|
virtual bool reportDataCallClosed();
|
||||||
virtual bool reportZppBestAvailableFix(LocGpsLocation &zppLoc,
|
virtual bool reportZppBestAvailableFix(LocGpsLocation &zppLoc,
|
||||||
GpsLocationExtended &location_extended, LocPosTechMask tech_mask);
|
GpsLocationExtended &location_extended, LocPosTechMask tech_mask);
|
||||||
|
virtual bool requestOdcpiEvent(OdcpiRequestInfo& request);
|
||||||
|
|
||||||
/* ======== UTILITIES ================================================================= */
|
/* ======== UTILITIES ================================================================= */
|
||||||
bool needReport(const UlpLocation& ulpLocation,
|
bool needReport(const UlpLocation& ulpLocation,
|
||||||
|
@ -304,6 +320,7 @@ public:
|
||||||
void reportGnssMeasurementData(const GnssMeasurementsNotification& measurements);
|
void reportGnssMeasurementData(const GnssMeasurementsNotification& measurements);
|
||||||
void reportGnssSvIdConfig(const GnssSvIdConfig& config);
|
void reportGnssSvIdConfig(const GnssSvIdConfig& config);
|
||||||
void reportGnssSvTypeConfig(const GnssSvTypeConfig& config);
|
void reportGnssSvTypeConfig(const GnssSvTypeConfig& config);
|
||||||
|
void requestOdcpi(const OdcpiRequestInfo& request);
|
||||||
|
|
||||||
/*======== GNSSDEBUG ================================================================*/
|
/*======== GNSSDEBUG ================================================================*/
|
||||||
bool getDebugReport(GnssDebugReport& report);
|
bool getDebugReport(GnssDebugReport& report);
|
||||||
|
|
|
@ -67,6 +67,9 @@ static void agpsDataConnFailed(AGpsExtType agpsType);
|
||||||
static void getDebugReport(GnssDebugReport& report);
|
static void getDebugReport(GnssDebugReport& report);
|
||||||
static void updateConnectionStatus(bool connected, int8_t type);
|
static void updateConnectionStatus(bool connected, int8_t type);
|
||||||
|
|
||||||
|
static void odcpiInit(const OdcpiRequestCallback& callback);
|
||||||
|
static void odcpiInject(const Location& location);
|
||||||
|
|
||||||
static const GnssInterface gGnssInterface = {
|
static const GnssInterface gGnssInterface = {
|
||||||
sizeof(GnssInterface),
|
sizeof(GnssInterface),
|
||||||
initialize,
|
initialize,
|
||||||
|
@ -96,6 +99,8 @@ static const GnssInterface gGnssInterface = {
|
||||||
agpsDataConnFailed,
|
agpsDataConnFailed,
|
||||||
getDebugReport,
|
getDebugReport,
|
||||||
updateConnectionStatus,
|
updateConnectionStatus,
|
||||||
|
odcpiInit,
|
||||||
|
odcpiInject,
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef DEBUG_X86
|
#ifndef DEBUG_X86
|
||||||
|
@ -307,3 +312,18 @@ static void updateConnectionStatus(bool connected, int8_t type) {
|
||||||
gGnssAdapter->getSystemStatus()->eventConnectionStatus(connected, type);
|
gGnssAdapter->getSystemStatus()->eventConnectionStatus(connected, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void odcpiInit(const OdcpiRequestCallback& callback)
|
||||||
|
{
|
||||||
|
if (NULL != gGnssAdapter) {
|
||||||
|
gGnssAdapter->initOdcpiCommand(callback);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void odcpiInject(const Location& location)
|
||||||
|
{
|
||||||
|
if (NULL != gGnssAdapter) {
|
||||||
|
gGnssAdapter->injectOdcpiCommand(location);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,8 @@ struct GnssInterface {
|
||||||
void (*agpsDataConnFailed)(AGpsExtType agpsType);
|
void (*agpsDataConnFailed)(AGpsExtType agpsType);
|
||||||
void (*getDebugReport)(GnssDebugReport& report);
|
void (*getDebugReport)(GnssDebugReport& report);
|
||||||
void (*updateConnectionStatus)(bool connected, int8_t type);
|
void (*updateConnectionStatus)(bool connected, int8_t type);
|
||||||
|
void (*odcpiInit)(const OdcpiRequestCallback& callback);
|
||||||
|
void (*odcpiInject)(const Location& location);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FlpInterface {
|
struct FlpInterface {
|
||||||
|
|
|
@ -1514,6 +1514,20 @@ struct AGnssExtStatusIpV6 {
|
||||||
uint8_t ipV6Addr[16];
|
uint8_t ipV6Addr[16];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* ODCPI Request Info */
|
||||||
|
enum OdcpiRequestType {
|
||||||
|
ODCPI_REQUEST_TYPE_START,
|
||||||
|
ODCPI_REQUEST_TYPE_STOP
|
||||||
|
};
|
||||||
|
struct OdcpiRequestInfo {
|
||||||
|
size_t size;
|
||||||
|
OdcpiRequestType type;
|
||||||
|
uint32_t tbfMillis;
|
||||||
|
bool isEmergencyMode;
|
||||||
|
};
|
||||||
|
/* Callback to send ODCPI request to framework */
|
||||||
|
typedef std::function<void(const OdcpiRequestInfo& request)> OdcpiRequestCallback;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Callback with AGNSS(IpV4) status information.
|
* Callback with AGNSS(IpV4) status information.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue