Merge remote-tracking branch 'quic/location.lnx.2.9' into HEAD
Change-Id: I50d6f5ff7c70532f8be522a76be5a6aaf9b03f3d CRs-Fixed: 2112760
This commit is contained in:
commit
153e37d399
10 changed files with 231 additions and 162 deletions
|
@ -23,7 +23,6 @@
|
||||||
#include <log_util.h>
|
#include <log_util.h>
|
||||||
#include "Gnss.h"
|
#include "Gnss.h"
|
||||||
#include "AGnss.h"
|
#include "AGnss.h"
|
||||||
#include <gps_extended_c.h>
|
|
||||||
|
|
||||||
namespace android {
|
namespace android {
|
||||||
namespace hardware {
|
namespace hardware {
|
||||||
|
@ -36,9 +35,44 @@ sp<IAGnssCallback> AGnss::sAGnssCbIface = nullptr;
|
||||||
AGnss::AGnss(Gnss* gnss) : mGnss(gnss) {
|
AGnss::AGnss(Gnss* gnss) : mGnss(gnss) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AGnss::agnssStatusIpV4Cb(IAGnssCallback::AGnssStatusIpV4 status){
|
void AGnss::agnssStatusIpV4Cb(AGnssExtStatusIpV4 status){
|
||||||
|
IAGnssCallback::AGnssStatusIpV4 st = {};
|
||||||
|
|
||||||
sAGnssCbIface->agnssStatusIpV4Cb(status);
|
switch (status.type) {
|
||||||
|
case LOC_AGPS_TYPE_SUPL:
|
||||||
|
st.type = IAGnssCallback::AGnssType::TYPE_SUPL;
|
||||||
|
break;
|
||||||
|
case LOC_AGPS_TYPE_C2K:
|
||||||
|
st.type = IAGnssCallback::AGnssType::TYPE_C2K;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
LOC_LOGE("invalid type: %d", status.type);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (status.status) {
|
||||||
|
case LOC_GPS_REQUEST_AGPS_DATA_CONN:
|
||||||
|
st.status = IAGnssCallback::AGnssStatusValue::REQUEST_AGNSS_DATA_CONN;
|
||||||
|
break;
|
||||||
|
case LOC_GPS_RELEASE_AGPS_DATA_CONN:
|
||||||
|
st.status = IAGnssCallback::AGnssStatusValue::RELEASE_AGNSS_DATA_CONN;
|
||||||
|
break;
|
||||||
|
case LOC_GPS_AGPS_DATA_CONNECTED:
|
||||||
|
st.status = IAGnssCallback::AGnssStatusValue::AGNSS_DATA_CONNECTED;
|
||||||
|
break;
|
||||||
|
case LOC_GPS_AGPS_DATA_CONN_DONE:
|
||||||
|
st.status = IAGnssCallback::AGnssStatusValue::AGNSS_DATA_CONN_DONE;
|
||||||
|
break;
|
||||||
|
case LOC_GPS_AGPS_DATA_CONN_FAILED:
|
||||||
|
st.status = IAGnssCallback::AGnssStatusValue::AGNSS_DATA_CONN_FAILED;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
LOC_LOGE("invalid status: %d", status.status);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
st.ipV4Addr = status.ipV4Addr;
|
||||||
|
|
||||||
|
sAGnssCbIface->agnssStatusIpV4Cb(st);
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<void> AGnss::setCallback(const sp<IAGnssCallback>& callback) {
|
Return<void> AGnss::setCallback(const sp<IAGnssCallback>& callback) {
|
||||||
|
@ -97,8 +131,24 @@ Return<bool> AGnss::dataConnOpen(const hidl_string& apn,
|
||||||
|
|
||||||
LOC_LOGD("dataConnOpen APN name = [%s]", apn.c_str());
|
LOC_LOGD("dataConnOpen APN name = [%s]", apn.c_str());
|
||||||
|
|
||||||
|
AGpsBearerType bearerType;
|
||||||
|
switch (apnIpType) {
|
||||||
|
case IAGnss::ApnIpType::IPV4:
|
||||||
|
bearerType = AGPS_APN_BEARER_IPV4;
|
||||||
|
break;
|
||||||
|
case IAGnss::ApnIpType::IPV6:
|
||||||
|
bearerType = AGPS_APN_BEARER_IPV6;
|
||||||
|
break;
|
||||||
|
case IAGnss::ApnIpType::IPV4V6:
|
||||||
|
bearerType = AGPS_APN_BEARER_IPV4V6;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
bearerType = AGPS_APN_BEARER_IPV4;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
mGnss->getGnssInterface()->agpsDataConnOpen(
|
mGnss->getGnssInterface()->agpsDataConnOpen(
|
||||||
LOC_AGPS_TYPE_SUPL, apn.c_str(), apn.size(), (int)apnIpType);
|
LOC_AGPS_TYPE_SUPL, apn.c_str(), apn.size(), (int)bearerType);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
#include <android/hardware/gnss/1.0/IAGnss.h>
|
#include <android/hardware/gnss/1.0/IAGnss.h>
|
||||||
#include <hidl/Status.h>
|
#include <hidl/Status.h>
|
||||||
|
#include <gps_extended_c.h>
|
||||||
|
|
||||||
namespace android {
|
namespace android {
|
||||||
namespace hardware {
|
namespace hardware {
|
||||||
|
@ -60,7 +61,7 @@ struct AGnss : public IAGnss {
|
||||||
const hidl_string& hostname, int32_t port) override;
|
const hidl_string& hostname, int32_t port) override;
|
||||||
|
|
||||||
/* Data call setup callback passed down to GNSS HAL implementation */
|
/* Data call setup callback passed down to GNSS HAL implementation */
|
||||||
static void agnssStatusIpV4Cb(IAGnssCallback::AGnssStatusIpV4 status);
|
static void agnssStatusIpV4Cb(AGnssExtStatusIpV4 status);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Gnss* mGnss = nullptr;
|
Gnss* mGnss = nullptr;
|
||||||
|
|
|
@ -295,19 +295,18 @@ void AgpsStateMachine::processAgpsEventDenied(){
|
||||||
* false = Release data connection */
|
* false = Release data connection */
|
||||||
int AgpsStateMachine::requestOrReleaseDataConn(bool request){
|
int AgpsStateMachine::requestOrReleaseDataConn(bool request){
|
||||||
|
|
||||||
AgpsFrameworkInterface::AGnssStatusIpV4 nifRequest;
|
AGnssExtStatusIpV4 nifRequest;
|
||||||
memset(&nifRequest, 0, sizeof(nifRequest));
|
memset(&nifRequest, 0, sizeof(nifRequest));
|
||||||
|
|
||||||
nifRequest.type = (AgpsFrameworkInterface::AGnssType)mAgpsType;
|
nifRequest.type = mAgpsType;
|
||||||
|
|
||||||
if (request) {
|
if (request) {
|
||||||
LOC_LOGD("AGPS Data Conn Request");
|
LOC_LOGD("AGPS Data Conn Request");
|
||||||
nifRequest.status = (AgpsFrameworkInterface::AGnssStatusValue)
|
nifRequest.status = LOC_GPS_REQUEST_AGPS_DATA_CONN;
|
||||||
LOC_GPS_REQUEST_AGPS_DATA_CONN;
|
}
|
||||||
} else {
|
else{
|
||||||
LOC_LOGD("AGPS Data Conn Release");
|
LOC_LOGD("AGPS Data Conn Release");
|
||||||
nifRequest.status = (AgpsFrameworkInterface::AGnssStatusValue)
|
nifRequest.status = LOC_GPS_RELEASE_AGPS_DATA_CONN;
|
||||||
LOC_GPS_RELEASE_AGPS_DATA_CONN;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mAgpsManager->mFrameworkStatusV4Cb(nifRequest);
|
mAgpsManager->mFrameworkStatusV4Cb(nifRequest);
|
||||||
|
@ -849,32 +848,15 @@ void AgpsManager::reportDataCallClosed(){
|
||||||
|
|
||||||
void AgpsManager::reportAtlOpenSuccess(
|
void AgpsManager::reportAtlOpenSuccess(
|
||||||
AGpsExtType agpsType, char* apnName, int apnLen,
|
AGpsExtType agpsType, char* apnName, int apnLen,
|
||||||
LocApnIpType ipType){
|
AGpsBearerType bearerType){
|
||||||
|
|
||||||
LOC_LOGD("AgpsManager::reportAtlOpenSuccess(): "
|
LOC_LOGD("AgpsManager::reportAtlOpenSuccess(): "
|
||||||
"AgpsType %d, APN [%s], Len %d, IPType %d",
|
"AgpsType %d, APN [%s], Len %d, BearerType %d",
|
||||||
agpsType, apnName, apnLen, ipType);
|
agpsType, apnName, apnLen, bearerType);
|
||||||
|
|
||||||
/* Find the state machine instance */
|
/* Find the state machine instance */
|
||||||
AgpsStateMachine* sm = getAgpsStateMachine(agpsType);
|
AgpsStateMachine* sm = getAgpsStateMachine(agpsType);
|
||||||
|
|
||||||
/* Convert LocApnIpType sent by framework to AGpsBearerType */
|
|
||||||
AGpsBearerType bearerType;
|
|
||||||
switch (ipType) {
|
|
||||||
case LOC_APN_IP_IPV4:
|
|
||||||
bearerType = AGPS_APN_BEARER_IPV4;
|
|
||||||
break;
|
|
||||||
case LOC_APN_IP_IPV6:
|
|
||||||
bearerType = AGPS_APN_BEARER_IPV6;
|
|
||||||
break;
|
|
||||||
case LOC_APN_IP_IPV4V6:
|
|
||||||
bearerType = AGPS_APN_BEARER_IPV4V6;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
bearerType = AGPS_APN_BEARER_IPV4;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set bearer and apn info in state machine instance */
|
/* Set bearer and apn info in state machine instance */
|
||||||
sm->setBearer(bearerType);
|
sm->setBearer(bearerType);
|
||||||
sm->setAPN(apnName, apnLen);
|
sm->setAPN(apnName, apnLen);
|
||||||
|
@ -927,39 +909,3 @@ void AgpsManager::handleModemSSR(){
|
||||||
mDSClientInitFn(true);
|
mDSClientInitFn(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AGpsBearerType AgpsUtils::ipTypeToBearerType(LocApnIpType ipType) {
|
|
||||||
|
|
||||||
switch (ipType) {
|
|
||||||
|
|
||||||
case LOC_APN_IP_IPV4:
|
|
||||||
return AGPS_APN_BEARER_IPV4;
|
|
||||||
|
|
||||||
case LOC_APN_IP_IPV6:
|
|
||||||
return AGPS_APN_BEARER_IPV6;
|
|
||||||
|
|
||||||
case LOC_APN_IP_IPV4V6:
|
|
||||||
return AGPS_APN_BEARER_IPV4V6;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return AGPS_APN_BEARER_IPV4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LocApnIpType AgpsUtils::bearerTypeToIpType(AGpsBearerType bearerType){
|
|
||||||
|
|
||||||
switch (bearerType) {
|
|
||||||
|
|
||||||
case AGPS_APN_BEARER_IPV4:
|
|
||||||
return LOC_APN_IP_IPV4;
|
|
||||||
|
|
||||||
case AGPS_APN_BEARER_IPV6:
|
|
||||||
return LOC_APN_IP_IPV6;
|
|
||||||
|
|
||||||
case AGPS_APN_BEARER_IPV4V6:
|
|
||||||
return LOC_APN_IP_IPV4V6;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return LOC_APN_IP_IPV4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
74
gnss/Agps.h
74
gnss/Agps.h
|
@ -87,70 +87,6 @@ typedef enum {
|
||||||
AGPS_NOTIFICATION_TYPE_FOR_ACTIVE_SUBSCRIBERS
|
AGPS_NOTIFICATION_TYPE_FOR_ACTIVE_SUBSCRIBERS
|
||||||
} AgpsNotificationType;
|
} AgpsNotificationType;
|
||||||
|
|
||||||
/* Framework AGNSS interface
|
|
||||||
* This interface is defined in IAGnssCallback provided by
|
|
||||||
* Android Framework.
|
|
||||||
* Must be kept in sync with that interface. */
|
|
||||||
namespace AgpsFrameworkInterface {
|
|
||||||
|
|
||||||
/** AGNSS type **/
|
|
||||||
enum AGnssType : uint8_t {
|
|
||||||
TYPE_SUPL = 1,
|
|
||||||
TYPE_C2K = 2
|
|
||||||
};
|
|
||||||
|
|
||||||
enum AGnssStatusValue : uint8_t {
|
|
||||||
/** GNSS requests data connection for AGNSS. */
|
|
||||||
REQUEST_AGNSS_DATA_CONN = 1,
|
|
||||||
/** GNSS releases the AGNSS data connection. */
|
|
||||||
RELEASE_AGNSS_DATA_CONN = 2,
|
|
||||||
/** AGNSS data connection initiated */
|
|
||||||
AGNSS_DATA_CONNECTED = 3,
|
|
||||||
/** AGNSS data connection completed */
|
|
||||||
AGNSS_DATA_CONN_DONE = 4,
|
|
||||||
/** AGNSS data connection failed */
|
|
||||||
AGNSS_DATA_CONN_FAILED = 5
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Represents the status of AGNSS augmented to support IPv4.
|
|
||||||
*/
|
|
||||||
struct AGnssStatusIpV4 {
|
|
||||||
AGnssType type;
|
|
||||||
AGnssStatusValue status;
|
|
||||||
/*
|
|
||||||
* 32-bit IPv4 address.
|
|
||||||
*/
|
|
||||||
unsigned int ipV4Addr;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Represents the status of AGNSS augmented to support IPv6.
|
|
||||||
*/
|
|
||||||
struct AGnssStatusIpV6 {
|
|
||||||
AGnssType type;
|
|
||||||
AGnssStatusValue status;
|
|
||||||
/*
|
|
||||||
* 128-bit IPv6 address.
|
|
||||||
*/
|
|
||||||
unsigned char ipV6Addr[16];
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Callback with AGNSS(IpV4) status information.
|
|
||||||
*
|
|
||||||
* @param status Will be of type AGnssStatusIpV4.
|
|
||||||
*/
|
|
||||||
typedef void (*AgnssStatusIpV4Cb)(AGnssStatusIpV4 status);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Callback with AGNSS(IpV6) status information.
|
|
||||||
*
|
|
||||||
* @param status Will be of type AGnssStatusIpV6.
|
|
||||||
*/
|
|
||||||
typedef void (*AgnssStatusIpV6Cb)(AGnssStatusIpV6 status);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Classes in this header */
|
/* Classes in this header */
|
||||||
class AgpsSubscriber;
|
class AgpsSubscriber;
|
||||||
class AgpsManager;
|
class AgpsManager;
|
||||||
|
@ -342,8 +278,7 @@ public:
|
||||||
|
|
||||||
/* Register callbacks */
|
/* Register callbacks */
|
||||||
void registerCallbacks(
|
void registerCallbacks(
|
||||||
AgpsFrameworkInterface::AgnssStatusIpV4Cb
|
AgnssStatusIpV4Cb frameworkStatusV4Cb,
|
||||||
frameworkStatusV4Cb,
|
|
||||||
|
|
||||||
AgpsAtlOpenStatusCb atlOpenStatusCb,
|
AgpsAtlOpenStatusCb atlOpenStatusCb,
|
||||||
AgpsAtlCloseStatusCb atlCloseStatusCb,
|
AgpsAtlCloseStatusCb atlCloseStatusCb,
|
||||||
|
@ -382,9 +317,8 @@ public:
|
||||||
void reportDataCallClosed();
|
void reportDataCallClosed();
|
||||||
|
|
||||||
/* Process incoming framework data call events */
|
/* Process incoming framework data call events */
|
||||||
void reportAtlOpenSuccess(
|
void reportAtlOpenSuccess(AGpsExtType agpsType, char* apnName, int apnLen,
|
||||||
AGpsExtType agpsType, char* apnName, int apnLen,
|
AGpsBearerType bearerType);
|
||||||
LocApnIpType ipType);
|
|
||||||
void reportAtlOpenFailed(AGpsExtType agpsType);
|
void reportAtlOpenFailed(AGpsExtType agpsType);
|
||||||
void reportAtlClosed(AGpsExtType agpsType);
|
void reportAtlClosed(AGpsExtType agpsType);
|
||||||
|
|
||||||
|
@ -392,7 +326,7 @@ public:
|
||||||
void handleModemSSR();
|
void handleModemSSR();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
AgpsFrameworkInterface::AgnssStatusIpV4Cb mFrameworkStatusV4Cb;
|
AgnssStatusIpV4Cb mFrameworkStatusV4Cb;
|
||||||
|
|
||||||
AgpsAtlOpenStatusCb mAtlOpenStatusCb;
|
AgpsAtlOpenStatusCb mAtlOpenStatusCb;
|
||||||
AgpsAtlCloseStatusCb mAtlCloseStatusCb;
|
AgpsAtlCloseStatusCb mAtlCloseStatusCb;
|
||||||
|
|
|
@ -50,6 +50,14 @@
|
||||||
|
|
||||||
using namespace loc_core;
|
using namespace loc_core;
|
||||||
|
|
||||||
|
/* Method to fetch status cb from loc_net_iface library */
|
||||||
|
typedef AgpsCbInfo& (*LocAgpsGetAgpsCbInfo)(LocAgpsOpenResultCb openResultCb,
|
||||||
|
LocAgpsCloseResultCb closeResultCb, void* userDataPtr);
|
||||||
|
|
||||||
|
static void agpsOpenResultCb (bool isSuccess, AGpsExtType agpsType, const char* apn,
|
||||||
|
AGpsBearerType bearerType, void* userDataPtr);
|
||||||
|
static void agpsCloseResultCb (bool isSuccess, AGpsExtType agpsType, void* userDataPtr);
|
||||||
|
|
||||||
GnssAdapter::GnssAdapter() :
|
GnssAdapter::GnssAdapter() :
|
||||||
LocAdapterBase(0,
|
LocAdapterBase(0,
|
||||||
LocDualContext::getLocFgContext(NULL,
|
LocDualContext::getLocFgContext(NULL,
|
||||||
|
@ -74,6 +82,7 @@ GnssAdapter::GnssAdapter() :
|
||||||
mUlpPositionMode.mode = LOC_POSITION_MODE_INVALID;
|
mUlpPositionMode.mode = LOC_POSITION_MODE_INVALID;
|
||||||
readConfigCommand();
|
readConfigCommand();
|
||||||
setConfigCommand();
|
setConfigCommand();
|
||||||
|
initDefaultAgpsCommand();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -2391,6 +2400,57 @@ GnssAdapter::reportSvPolynomialEvent(GnssSvPolynomial &svPolynomial)
|
||||||
mUlpProxy->reportSvPolynomial(svPolynomial);
|
mUlpProxy->reportSvPolynomial(svPolynomial);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GnssAdapter::initDefaultAgps() {
|
||||||
|
LOC_LOGD("%s]: ", __func__);
|
||||||
|
|
||||||
|
LocationCapabilitiesMask mask = getCapabilities();
|
||||||
|
if (!(mask & LOCATION_CAPABILITIES_GNSS_MSB_BIT) &&
|
||||||
|
!(mask & LOCATION_CAPABILITIES_GNSS_MSA_BIT)) {
|
||||||
|
LOC_LOGI("%s]: Target does not support MSB and MSA.", __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *handle = nullptr;
|
||||||
|
if ((handle = dlopen("libloc_net_iface.so", RTLD_NOW)) == nullptr) {
|
||||||
|
LOC_LOGE("%s]: libloc_net_iface.so not found !", __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
LocAgpsGetAgpsCbInfo getAgpsCbInfo = (LocAgpsGetAgpsCbInfo)
|
||||||
|
dlsym(handle, "LocNetIfaceAgps_getAgpsCbInfo");
|
||||||
|
if (getAgpsCbInfo == nullptr) {
|
||||||
|
LOC_LOGE("%s]: Failed to get method LocNetIfaceAgps_getStatusCb", __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
AgpsCbInfo& cbInfo = getAgpsCbInfo(agpsOpenResultCb, agpsCloseResultCb, this);
|
||||||
|
|
||||||
|
if (cbInfo.statusV4Cb == nullptr) {
|
||||||
|
LOC_LOGE("%s]: statusV4Cb is nullptr!", __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
initAgpsCommand(cbInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GnssAdapter::initDefaultAgpsCommand() {
|
||||||
|
LOC_LOGD("%s]: ", __func__);
|
||||||
|
|
||||||
|
struct MsgInitDefaultAgps : public LocMsg {
|
||||||
|
GnssAdapter& mAdapter;
|
||||||
|
inline MsgInitDefaultAgps(GnssAdapter& adapter) :
|
||||||
|
LocMsg(),
|
||||||
|
mAdapter(adapter) {
|
||||||
|
LOC_LOGV("MsgInitDefaultAgps");
|
||||||
|
}
|
||||||
|
inline virtual void proc() const {
|
||||||
|
mAdapter.initDefaultAgps();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
sendMsg(new MsgInitDefaultAgps(*this));
|
||||||
|
}
|
||||||
|
|
||||||
/* INIT LOC AGPS MANAGER */
|
/* INIT LOC AGPS MANAGER */
|
||||||
void GnssAdapter::initAgpsCommand(const AgpsCbInfo& cbInfo){
|
void GnssAdapter::initAgpsCommand(const AgpsCbInfo& cbInfo){
|
||||||
|
|
||||||
|
@ -2453,7 +2513,7 @@ void GnssAdapter::initAgpsCommand(const AgpsCbInfo& cbInfo){
|
||||||
|
|
||||||
AgpsManager* mAgpsManager;
|
AgpsManager* mAgpsManager;
|
||||||
|
|
||||||
AgpsFrameworkInterface::AgnssStatusIpV4Cb mFrameworkStatusV4Cb;
|
AgnssStatusIpV4Cb mFrameworkStatusV4Cb;
|
||||||
|
|
||||||
AgpsAtlOpenStatusCb mAtlOpenStatusCb;
|
AgpsAtlOpenStatusCb mAtlOpenStatusCb;
|
||||||
AgpsAtlCloseStatusCb mAtlCloseStatusCb;
|
AgpsAtlCloseStatusCb mAtlCloseStatusCb;
|
||||||
|
@ -2468,7 +2528,7 @@ void GnssAdapter::initAgpsCommand(const AgpsCbInfo& cbInfo){
|
||||||
GnssAdapter& mAdapter;
|
GnssAdapter& mAdapter;
|
||||||
|
|
||||||
inline AgpsMsgInit(AgpsManager* agpsManager,
|
inline AgpsMsgInit(AgpsManager* agpsManager,
|
||||||
AgpsFrameworkInterface::AgnssStatusIpV4Cb frameworkStatusV4Cb,
|
AgnssStatusIpV4Cb frameworkStatusV4Cb,
|
||||||
AgpsAtlOpenStatusCb atlOpenStatusCb,
|
AgpsAtlOpenStatusCb atlOpenStatusCb,
|
||||||
AgpsAtlCloseStatusCb atlCloseStatusCb,
|
AgpsAtlCloseStatusCb atlCloseStatusCb,
|
||||||
AgpsDSClientInitFn dsClientInitFn,
|
AgpsDSClientInitFn dsClientInitFn,
|
||||||
|
@ -2520,7 +2580,7 @@ void GnssAdapter::initAgpsCommand(const AgpsCbInfo& cbInfo){
|
||||||
/* Send message to initialize AGPS Manager */
|
/* Send message to initialize AGPS Manager */
|
||||||
sendMsg(new AgpsMsgInit(
|
sendMsg(new AgpsMsgInit(
|
||||||
&mAgpsManager,
|
&mAgpsManager,
|
||||||
(AgpsFrameworkInterface::AgnssStatusIpV4Cb)cbInfo.statusV4Cb,
|
(AgnssStatusIpV4Cb)cbInfo.statusV4Cb,
|
||||||
atlOpenStatusCb, atlCloseStatusCb,
|
atlOpenStatusCb, atlCloseStatusCb,
|
||||||
dsClientInitFn, dsClientOpenAndStartDataCallFn,
|
dsClientInitFn, dsClientOpenAndStartDataCallFn,
|
||||||
dsClientStopDataCallFn, dsClientCloseDataCallFn,
|
dsClientStopDataCallFn, dsClientCloseDataCallFn,
|
||||||
|
@ -2652,7 +2712,7 @@ bool GnssAdapter::reportDataCallClosed(){
|
||||||
|
|
||||||
void GnssAdapter::dataConnOpenCommand(
|
void GnssAdapter::dataConnOpenCommand(
|
||||||
AGpsExtType agpsType,
|
AGpsExtType agpsType,
|
||||||
const char* apnName, int apnLen, LocApnIpType ipType){
|
const char* apnName, int apnLen, AGpsBearerType bearerType){
|
||||||
|
|
||||||
LOC_LOGI("GnssAdapter::frameworkDataConnOpen");
|
LOC_LOGI("GnssAdapter::frameworkDataConnOpen");
|
||||||
|
|
||||||
|
@ -2662,12 +2722,12 @@ void GnssAdapter::dataConnOpenCommand(
|
||||||
AGpsExtType mAgpsType;
|
AGpsExtType mAgpsType;
|
||||||
char* mApnName;
|
char* mApnName;
|
||||||
int mApnLen;
|
int mApnLen;
|
||||||
LocApnIpType mIpType;
|
AGpsBearerType mBearerType;
|
||||||
|
|
||||||
inline AgpsMsgAtlOpenSuccess(AgpsManager* agpsManager, AGpsExtType agpsType,
|
inline AgpsMsgAtlOpenSuccess(AgpsManager* agpsManager, AGpsExtType agpsType,
|
||||||
const char* apnName, int apnLen, LocApnIpType ipType) :
|
const char* apnName, int apnLen, AGpsBearerType bearerType) :
|
||||||
LocMsg(), mAgpsManager(agpsManager), mAgpsType(agpsType), mApnName(
|
LocMsg(), mAgpsManager(agpsManager), mAgpsType(agpsType), mApnName(
|
||||||
new char[apnLen + 1]), mApnLen(apnLen), mIpType(ipType) {
|
new char[apnLen + 1]), mApnLen(apnLen), mBearerType(bearerType) {
|
||||||
|
|
||||||
LOC_LOGV("AgpsMsgAtlOpenSuccess");
|
LOC_LOGV("AgpsMsgAtlOpenSuccess");
|
||||||
memcpy(mApnName, apnName, apnLen);
|
memcpy(mApnName, apnName, apnLen);
|
||||||
|
@ -2681,13 +2741,12 @@ void GnssAdapter::dataConnOpenCommand(
|
||||||
inline virtual void proc() const {
|
inline virtual void proc() const {
|
||||||
|
|
||||||
LOC_LOGV("AgpsMsgAtlOpenSuccess::proc()");
|
LOC_LOGV("AgpsMsgAtlOpenSuccess::proc()");
|
||||||
mAgpsManager->reportAtlOpenSuccess(mAgpsType, mApnName, mApnLen,
|
mAgpsManager->reportAtlOpenSuccess(mAgpsType, mApnName, mApnLen, mBearerType);
|
||||||
mIpType);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
sendMsg( new AgpsMsgAtlOpenSuccess(
|
sendMsg( new AgpsMsgAtlOpenSuccess(
|
||||||
&mAgpsManager, (AGpsExtType)agpsType, apnName, apnLen, ipType));
|
&mAgpsManager, agpsType, apnName, apnLen, bearerType));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GnssAdapter::dataConnClosedCommand(AGpsExtType agpsType){
|
void GnssAdapter::dataConnClosedCommand(AGpsExtType agpsType){
|
||||||
|
@ -3026,3 +3085,36 @@ GnssAdapter::getAgcInformation(GnssMeasurementsNotification& measurements, int m
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Callbacks registered with loc_net_iface library */
|
||||||
|
static void agpsOpenResultCb (bool isSuccess, AGpsExtType agpsType, const char* apn,
|
||||||
|
AGpsBearerType bearerType, void* userDataPtr) {
|
||||||
|
LOC_LOGD("%s]: ", __func__);
|
||||||
|
if (userDataPtr == nullptr) {
|
||||||
|
LOC_LOGE("%s]: userDataPtr is nullptr.", __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (apn == nullptr) {
|
||||||
|
LOC_LOGE("%s]: apn is nullptr.", __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
GnssAdapter* adapter = (GnssAdapter*)userDataPtr;
|
||||||
|
if (isSuccess) {
|
||||||
|
adapter->dataConnOpenCommand(agpsType, apn, strlen(apn), bearerType);
|
||||||
|
} else {
|
||||||
|
adapter->dataConnFailedCommand(agpsType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void agpsCloseResultCb (bool isSuccess, AGpsExtType agpsType, void* userDataPtr) {
|
||||||
|
LOC_LOGD("%s]: ", __func__);
|
||||||
|
if (userDataPtr == nullptr) {
|
||||||
|
LOC_LOGE("%s]: userDataPtr is nullptr.", __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
GnssAdapter* adapter = (GnssAdapter*)userDataPtr;
|
||||||
|
if (isSuccess) {
|
||||||
|
adapter->dataConnClosedCommand(agpsType);
|
||||||
|
} else {
|
||||||
|
adapter->dataConnFailedCommand(agpsType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -199,10 +199,10 @@ public:
|
||||||
uint32_t* gnssUpdateConfigCommand(GnssConfig config);
|
uint32_t* gnssUpdateConfigCommand(GnssConfig config);
|
||||||
uint32_t gnssDeleteAidingDataCommand(GnssAidingData& data);
|
uint32_t gnssDeleteAidingDataCommand(GnssAidingData& data);
|
||||||
|
|
||||||
|
void initDefaultAgpsCommand();
|
||||||
void initAgpsCommand(const AgpsCbInfo& cbInfo);
|
void initAgpsCommand(const AgpsCbInfo& cbInfo);
|
||||||
void dataConnOpenCommand(
|
void dataConnOpenCommand(AGpsExtType agpsType,
|
||||||
AGpsExtType agpsType,
|
const char* apnName, int apnLen, AGpsBearerType bearerType);
|
||||||
const char* apnName, int apnLen, LocApnIpType ipType);
|
|
||||||
void dataConnClosedCommand(AGpsExtType agpsType);
|
void dataConnClosedCommand(AGpsExtType agpsType);
|
||||||
void dataConnFailedCommand(AGpsExtType agpsType);
|
void dataConnFailedCommand(AGpsExtType agpsType);
|
||||||
|
|
||||||
|
@ -217,6 +217,8 @@ public:
|
||||||
uint32_t getPowerVoteId() { return mPowerVoteId; }
|
uint32_t getPowerVoteId() { return mPowerVoteId; }
|
||||||
bool resolveInAddress(const char* hostAddress, struct in_addr* inAddress);
|
bool resolveInAddress(const char* hostAddress, struct in_addr* inAddress);
|
||||||
virtual bool isInSession() { return !mTrackingSessions.empty(); }
|
virtual bool isInSession() { return !mTrackingSessions.empty(); }
|
||||||
|
void initDefaultAgps();
|
||||||
|
|
||||||
/* ==== REPORTS ======================================================================== */
|
/* ==== REPORTS ======================================================================== */
|
||||||
/* ======== EVENTS ====(Called from QMI/ULP Thread)===================================== */
|
/* ======== EVENTS ====(Called from QMI/ULP Thread)===================================== */
|
||||||
virtual void reportPositionEvent(const UlpLocation& ulpLocation,
|
virtual void reportPositionEvent(const UlpLocation& ulpLocation,
|
||||||
|
|
|
@ -228,7 +228,7 @@ static void agpsDataConnOpen(
|
||||||
|
|
||||||
if (NULL != gGnssAdapter) {
|
if (NULL != gGnssAdapter) {
|
||||||
gGnssAdapter->dataConnOpenCommand(
|
gGnssAdapter->dataConnOpenCommand(
|
||||||
agpsType, apnName, apnLen, ipType);
|
agpsType, apnName, apnLen, (AGpsBearerType)ipType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void agpsDataConnClosed(AGpsExtType agpsType) {
|
static void agpsDataConnClosed(AGpsExtType agpsType) {
|
||||||
|
|
|
@ -51,9 +51,9 @@ struct GnssInterface {
|
||||||
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)(const AgpsCbInfo& cbInfo);
|
void (*agpsInit)(const AgpsCbInfo& cbInfo);
|
||||||
void (*agpsDataConnOpen)(short agpsType, const char* apnName, int apnLen, int ipType);
|
void (*agpsDataConnOpen)(AGpsExtType agpsType, const char* apnName, int apnLen, int ipType);
|
||||||
void (*agpsDataConnClosed)(short agpsType);
|
void (*agpsDataConnClosed)(AGpsExtType agpsType);
|
||||||
void (*agpsDataConnFailed)(short agpsType);
|
void (*agpsDataConnFailed)(AGpsExtType agpsType);
|
||||||
void (*getDebugReport)(GnssDebugReport& report);
|
void (*getDebugReport)(GnssDebugReport& report);
|
||||||
void (*updateConnectionStatus)(bool connected, uint8_t type);
|
void (*updateConnectionStatus)(bool connected, uint8_t type);
|
||||||
};
|
};
|
||||||
|
|
|
@ -143,7 +143,7 @@ typedef struct {
|
||||||
|
|
||||||
|
|
||||||
/** AGPS type */
|
/** AGPS type */
|
||||||
typedef int16_t AGpsExtType;
|
typedef int8_t AGpsExtType;
|
||||||
#define LOC_AGPS_TYPE_INVALID -1
|
#define LOC_AGPS_TYPE_INVALID -1
|
||||||
#define LOC_AGPS_TYPE_ANY 0
|
#define LOC_AGPS_TYPE_ANY 0
|
||||||
#define LOC_AGPS_TYPE_SUPL 1
|
#define LOC_AGPS_TYPE_SUPL 1
|
||||||
|
@ -156,10 +156,10 @@ typedef int16_t AGpsExtType;
|
||||||
#define SSID_BUF_SIZE (32+1)
|
#define SSID_BUF_SIZE (32+1)
|
||||||
|
|
||||||
typedef int16_t AGpsBearerType;
|
typedef int16_t AGpsBearerType;
|
||||||
#define AGPS_APN_BEARER_INVALID -1
|
#define AGPS_APN_BEARER_INVALID 0
|
||||||
#define AGPS_APN_BEARER_IPV4 0
|
#define AGPS_APN_BEARER_IPV4 1
|
||||||
#define AGPS_APN_BEARER_IPV6 1
|
#define AGPS_APN_BEARER_IPV6 2
|
||||||
#define AGPS_APN_BEARER_IPV4V6 2
|
#define AGPS_APN_BEARER_IPV4V6 3
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
AGPS_CB_PRIORITY_LOW = 1,
|
AGPS_CB_PRIORITY_LOW = 1,
|
||||||
|
@ -1238,6 +1238,50 @@ typedef struct
|
||||||
Gnss_Srn_MacAddr_Type macAddrType; /* SRN AP MAC Address type */
|
Gnss_Srn_MacAddr_Type macAddrType; /* SRN AP MAC Address type */
|
||||||
} GnssSrnDataReq;
|
} GnssSrnDataReq;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Represents the status of AGNSS augmented to support IPv4.
|
||||||
|
*/
|
||||||
|
struct AGnssExtStatusIpV4 {
|
||||||
|
AGpsExtType type;
|
||||||
|
LocAGpsStatusValue status;
|
||||||
|
/*
|
||||||
|
* 32-bit IPv4 address.
|
||||||
|
*/
|
||||||
|
uint32_t ipV4Addr;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Represents the status of AGNSS augmented to support IPv6.
|
||||||
|
*/
|
||||||
|
struct AGnssExtStatusIpV6 {
|
||||||
|
AGpsExtType type;
|
||||||
|
LocAGpsStatusValue status;
|
||||||
|
/*
|
||||||
|
* 128-bit IPv6 address.
|
||||||
|
*/
|
||||||
|
uint8_t ipV6Addr[16];
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Callback with AGNSS(IpV4) status information.
|
||||||
|
*
|
||||||
|
* @param status Will be of type AGnssExtStatusIpV4.
|
||||||
|
*/
|
||||||
|
typedef void (*AgnssStatusIpV4Cb)(AGnssExtStatusIpV4 status);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Callback with AGNSS(IpV6) status information.
|
||||||
|
*
|
||||||
|
* @param status Will be of type AGnssExtStatusIpV6.
|
||||||
|
*/
|
||||||
|
typedef void (*AgnssStatusIpV6Cb)(AGnssExtStatusIpV6 status);
|
||||||
|
|
||||||
|
/* Constructs for interaction with loc_net_iface library */
|
||||||
|
typedef void (*LocAgpsOpenResultCb)(bool isSuccess, AGpsExtType agpsType, const char* apn,
|
||||||
|
AGpsBearerType bearerType, void* userDataPtr);
|
||||||
|
|
||||||
|
typedef void (*LocAgpsCloseResultCb)(bool isSuccess, AGpsExtType agpsType, void* userDataPtr);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,7 +208,7 @@ typedef int LocGpsNiEncodingType;
|
||||||
#define LOC_GPS_ENC_UNKNOWN -1
|
#define LOC_GPS_ENC_UNKNOWN -1
|
||||||
|
|
||||||
/** AGPS status event values. */
|
/** AGPS status event values. */
|
||||||
typedef uint16_t LocAGpsStatusValue;
|
typedef uint8_t LocAGpsStatusValue;
|
||||||
/** GPS requests data connection for AGPS. */
|
/** GPS requests data connection for AGPS. */
|
||||||
#define LOC_GPS_REQUEST_AGPS_DATA_CONN 1
|
#define LOC_GPS_REQUEST_AGPS_DATA_CONN 1
|
||||||
/** GPS releases the AGPS data connection. */
|
/** GPS releases the AGPS data connection. */
|
||||||
|
|
Loading…
Reference in a new issue