Merge "Adding priority flag for NI and AGPS callbacks"
This commit is contained in:
commit
a3db3b5919
10 changed files with 48 additions and 10 deletions
|
@ -51,7 +51,11 @@ Return<void> AGnss::setCallback(const sp<IAGnssCallback>& callback) {
|
||||||
// Save the interface
|
// Save the interface
|
||||||
sAGnssCbIface = callback;
|
sAGnssCbIface = callback;
|
||||||
|
|
||||||
mGnss->getGnssInterface()->agpsInit((void*)agnssStatusIpV4Cb);
|
AgpsCbInfo cbInfo = {};
|
||||||
|
cbInfo.statusV4Cb = (void*)agnssStatusIpV4Cb;
|
||||||
|
cbInfo.cbPriority = AGPS_CB_PRIORITY_LOW;
|
||||||
|
|
||||||
|
mGnss->getGnssInterface()->agpsInit(cbInfo);
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,7 @@ BatchingAPIClient::BatchingAPIClient(const sp<IGnssBatchingCallback>& callback)
|
||||||
LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
|
LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
|
||||||
|
|
||||||
LocationCallbacks locationCallbacks;
|
LocationCallbacks locationCallbacks;
|
||||||
|
memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
|
||||||
locationCallbacks.size = sizeof(LocationCallbacks);
|
locationCallbacks.size = sizeof(LocationCallbacks);
|
||||||
|
|
||||||
locationCallbacks.trackingCb = nullptr;
|
locationCallbacks.trackingCb = nullptr;
|
||||||
|
|
|
@ -50,6 +50,7 @@ GeofenceAPIClient::GeofenceAPIClient(const sp<IGnssGeofenceCallback>& callback)
|
||||||
LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
|
LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
|
||||||
|
|
||||||
LocationCallbacks locationCallbacks;
|
LocationCallbacks locationCallbacks;
|
||||||
|
memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
|
||||||
locationCallbacks.size = sizeof(LocationCallbacks);
|
locationCallbacks.size = sizeof(LocationCallbacks);
|
||||||
|
|
||||||
locationCallbacks.trackingCb = nullptr;
|
locationCallbacks.trackingCb = nullptr;
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
|
|
||||||
#include "LocationUtil.h"
|
#include "LocationUtil.h"
|
||||||
#include "GnssAPIClient.h"
|
#include "GnssAPIClient.h"
|
||||||
|
#include <LocDualContext.h>
|
||||||
|
|
||||||
namespace android {
|
namespace android {
|
||||||
namespace hardware {
|
namespace hardware {
|
||||||
|
@ -79,6 +80,7 @@ void GnssAPIClient::gnssUpdateCallbacks(const sp<IGnssCallback>& gpsCb,
|
||||||
mGnssNiCbIface = niCb;
|
mGnssNiCbIface = niCb;
|
||||||
|
|
||||||
LocationCallbacks locationCallbacks;
|
LocationCallbacks locationCallbacks;
|
||||||
|
memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
|
||||||
locationCallbacks.size = sizeof(LocationCallbacks);
|
locationCallbacks.size = sizeof(LocationCallbacks);
|
||||||
|
|
||||||
locationCallbacks.trackingCb = nullptr;
|
locationCallbacks.trackingCb = nullptr;
|
||||||
|
@ -94,7 +96,12 @@ void GnssAPIClient::gnssUpdateCallbacks(const sp<IGnssCallback>& gpsCb,
|
||||||
locationCallbacks.gnssLocationInfoCb = nullptr;
|
locationCallbacks.gnssLocationInfoCb = nullptr;
|
||||||
|
|
||||||
locationCallbacks.gnssNiCb = nullptr;
|
locationCallbacks.gnssNiCb = nullptr;
|
||||||
if (mGnssNiCbIface != nullptr) {
|
loc_core::ContextBase* context =
|
||||||
|
loc_core::LocDualContext::getLocFgContext(
|
||||||
|
NULL, NULL,
|
||||||
|
loc_core::LocDualContext::mLocationHalName, false);
|
||||||
|
if (mGnssNiCbIface != nullptr && !context->hasAgpsExtendedCapabilities()) {
|
||||||
|
LOC_LOGD("Registering NI CB");
|
||||||
locationCallbacks.gnssNiCb = [this](uint32_t id, GnssNiNotification gnssNiNotification) {
|
locationCallbacks.gnssNiCb = [this](uint32_t id, GnssNiNotification gnssNiNotification) {
|
||||||
onGnssNiCb(id, gnssNiNotification);
|
onGnssNiCb(id, gnssNiNotification);
|
||||||
};
|
};
|
||||||
|
|
|
@ -80,6 +80,7 @@ MeasurementAPIClient::measurementSetCallback(const sp<IGnssMeasurementCallback>&
|
||||||
mGnssMeasurementCbIface = callback;
|
mGnssMeasurementCbIface = callback;
|
||||||
|
|
||||||
LocationCallbacks locationCallbacks;
|
LocationCallbacks locationCallbacks;
|
||||||
|
memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
|
||||||
locationCallbacks.size = sizeof(LocationCallbacks);
|
locationCallbacks.size = sizeof(LocationCallbacks);
|
||||||
|
|
||||||
locationCallbacks.trackingCb = nullptr;
|
locationCallbacks.trackingCb = nullptr;
|
||||||
|
|
|
@ -62,7 +62,8 @@ GnssAdapter::GnssAdapter() :
|
||||||
mControlCallbacks(),
|
mControlCallbacks(),
|
||||||
mPowerVoteId(0),
|
mPowerVoteId(0),
|
||||||
mNiData(),
|
mNiData(),
|
||||||
mAgpsManager()
|
mAgpsManager(),
|
||||||
|
mAgpsCbInfo()
|
||||||
{
|
{
|
||||||
LOC_LOGD("%s]: Constructor %p", __func__, this);
|
LOC_LOGD("%s]: Constructor %p", __func__, this);
|
||||||
mUlpPositionMode.mode = LOC_POSITION_MODE_INVALID;
|
mUlpPositionMode.mode = LOC_POSITION_MODE_INVALID;
|
||||||
|
@ -2301,7 +2302,7 @@ GnssAdapter::reportSvPolynomialEvent(GnssSvPolynomial &svPolynomial)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* INIT LOC AGPS MANAGER */
|
/* INIT LOC AGPS MANAGER */
|
||||||
void GnssAdapter::initAgpsCommand(void* statusV4Cb){
|
void GnssAdapter::initAgpsCommand(const AgpsCbInfo& cbInfo){
|
||||||
|
|
||||||
LOC_LOGI("GnssAdapter::initAgpsCommand");
|
LOC_LOGI("GnssAdapter::initAgpsCommand");
|
||||||
|
|
||||||
|
@ -2416,10 +2417,20 @@ void GnssAdapter::initAgpsCommand(void* statusV4Cb){
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (mAgpsCbInfo.cbPriority > cbInfo.cbPriority) {
|
||||||
|
LOC_LOGI("Higher priority AGPS CB already registered (%d > %d) !",
|
||||||
|
mAgpsCbInfo.cbPriority, cbInfo.cbPriority);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
mAgpsCbInfo = cbInfo;
|
||||||
|
LOC_LOGI("Registering AGPS CB 0x%x with priority %d",
|
||||||
|
mAgpsCbInfo.statusV4Cb, mAgpsCbInfo.cbPriority);
|
||||||
|
}
|
||||||
|
|
||||||
/* Send message to initialize AGPS Manager */
|
/* Send message to initialize AGPS Manager */
|
||||||
sendMsg(new AgpsMsgInit(
|
sendMsg(new AgpsMsgInit(
|
||||||
&mAgpsManager,
|
&mAgpsManager,
|
||||||
(AgpsFrameworkInterface::AgnssStatusIpV4Cb)statusV4Cb,
|
(AgpsFrameworkInterface::AgnssStatusIpV4Cb)cbInfo.statusV4Cb,
|
||||||
atlOpenStatusCb, atlCloseStatusCb,
|
atlOpenStatusCb, atlCloseStatusCb,
|
||||||
dsClientInitFn, dsClientOpenAndStartDataCallFn,
|
dsClientInitFn, dsClientOpenAndStartDataCallFn,
|
||||||
dsClientStopDataCallFn, dsClientCloseDataCallFn,
|
dsClientStopDataCallFn, dsClientCloseDataCallFn,
|
||||||
|
|
|
@ -99,6 +99,7 @@ class GnssAdapter : public LocAdapterBase {
|
||||||
/* ==== AGPS ========================================================*/
|
/* ==== AGPS ========================================================*/
|
||||||
// This must be initialized via initAgps()
|
// This must be initialized via initAgps()
|
||||||
AgpsManager mAgpsManager;
|
AgpsManager mAgpsManager;
|
||||||
|
AgpsCbInfo mAgpsCbInfo;
|
||||||
|
|
||||||
/*==== CONVERSION ===================================================================*/
|
/*==== CONVERSION ===================================================================*/
|
||||||
static void convertOptions(LocPosMode& out, const LocationOptions& options);
|
static void convertOptions(LocPosMode& out, const LocationOptions& options);
|
||||||
|
@ -185,7 +186,7 @@ public:
|
||||||
uint32_t* gnssUpdateConfigCommand(GnssConfig config);
|
uint32_t* gnssUpdateConfigCommand(GnssConfig config);
|
||||||
uint32_t gnssDeleteAidingDataCommand(GnssAidingData& data);
|
uint32_t gnssDeleteAidingDataCommand(GnssAidingData& data);
|
||||||
|
|
||||||
void initAgpsCommand(void* statusV4Cb);
|
void initAgpsCommand(const AgpsCbInfo& cbInfo);
|
||||||
void dataConnOpenCommand(
|
void dataConnOpenCommand(
|
||||||
AGpsExtType agpsType,
|
AGpsExtType agpsType,
|
||||||
const char* apnName, int apnLen, LocApnIpType ipType);
|
const char* apnName, int apnLen, LocApnIpType ipType);
|
||||||
|
|
|
@ -54,7 +54,7 @@ static uint32_t* gnssUpdateConfig(GnssConfig config);
|
||||||
static void injectLocation(double latitude, double longitude, float accuracy);
|
static void injectLocation(double latitude, double longitude, float accuracy);
|
||||||
static void injectTime(int64_t time, int64_t timeReference, int32_t uncertainty);
|
static void injectTime(int64_t time, int64_t timeReference, int32_t uncertainty);
|
||||||
|
|
||||||
static void agpsInit(void* statusV4Cb);
|
static void agpsInit(const AgpsCbInfo& cbInfo);
|
||||||
static void agpsDataConnOpen(AGpsExtType agpsType, const char* apnName, int apnLen, int ipType);
|
static void agpsDataConnOpen(AGpsExtType agpsType, const char* apnName, int apnLen, int ipType);
|
||||||
static void agpsDataConnClosed(AGpsExtType agpsType);
|
static void agpsDataConnClosed(AGpsExtType agpsType);
|
||||||
static void agpsDataConnFailed(AGpsExtType agpsType);
|
static void agpsDataConnFailed(AGpsExtType agpsType);
|
||||||
|
@ -215,10 +215,10 @@ static void injectTime(int64_t time, int64_t timeReference, int32_t uncertainty)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void agpsInit(void* statusV4Cb) {
|
static void agpsInit(const AgpsCbInfo& cbInfo) {
|
||||||
|
|
||||||
if (NULL != gGnssAdapter) {
|
if (NULL != gGnssAdapter) {
|
||||||
gGnssAdapter->initAgpsCommand(statusV4Cb);
|
gGnssAdapter->initAgpsCommand(cbInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void agpsDataConnOpen(
|
static void agpsDataConnOpen(
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#define LOCATION_INTERFACE_H
|
#define LOCATION_INTERFACE_H
|
||||||
|
|
||||||
#include <LocationAPI.h>
|
#include <LocationAPI.h>
|
||||||
|
#include <gps_extended_c.h>
|
||||||
|
|
||||||
struct GnssInterface {
|
struct GnssInterface {
|
||||||
size_t size;
|
size_t size;
|
||||||
|
@ -49,7 +50,7 @@ struct GnssInterface {
|
||||||
uint32_t (*gnssDeleteAidingData)(GnssAidingData& data);
|
uint32_t (*gnssDeleteAidingData)(GnssAidingData& data);
|
||||||
void (*injectLocation)(double latitude, double longitude, float accuracy);
|
void (*injectLocation)(double latitude, double longitude, float accuracy);
|
||||||
void (*injectTime)(int64_t time, int64_t timeReference, int32_t uncertainty);
|
void (*injectTime)(int64_t time, int64_t timeReference, int32_t uncertainty);
|
||||||
void (*agpsInit)(void* statusV4Cb);
|
void (*agpsInit)(const AgpsCbInfo& cbInfo);
|
||||||
void (*agpsDataConnOpen)(short agpsType, const char* apnName, int apnLen, int ipType);
|
void (*agpsDataConnOpen)(short agpsType, const char* apnName, int apnLen, int ipType);
|
||||||
void (*agpsDataConnClosed)(short agpsType);
|
void (*agpsDataConnClosed)(short agpsType);
|
||||||
void (*agpsDataConnFailed)(short agpsType);
|
void (*agpsDataConnFailed)(short agpsType);
|
||||||
|
|
|
@ -160,6 +160,17 @@ typedef int16_t AGpsBearerType;
|
||||||
#define AGPS_APN_BEARER_IPV6 1
|
#define AGPS_APN_BEARER_IPV6 1
|
||||||
#define AGPS_APN_BEARER_IPV4V6 2
|
#define AGPS_APN_BEARER_IPV4V6 2
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
AGPS_CB_PRIORITY_LOW = 1,
|
||||||
|
AGPS_CB_PRIORITY_MED = 2,
|
||||||
|
AGPS_CB_PRIORITY_HIGH = 3
|
||||||
|
} AgpsCbPriority;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
void* statusV4Cb;
|
||||||
|
AgpsCbPriority cbPriority;
|
||||||
|
} AgpsCbInfo;
|
||||||
|
|
||||||
/** GPS extended callback structure. */
|
/** GPS extended callback structure. */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/** set to sizeof(LocGpsCallbacks) */
|
/** set to sizeof(LocGpsCallbacks) */
|
||||||
|
|
Loading…
Reference in a new issue