Support GnssMeasurement
Support the new GnssMeasurement and GnssClock data structures for the new gps.h Change-Id: I40e00711501432760c82d27fb82702b1bf57ebb6
This commit is contained in:
parent
d30694acf6
commit
c3a4fba9b8
15 changed files with 154 additions and 144 deletions
|
@ -80,7 +80,7 @@ void LocAdapterBase::
|
|||
}
|
||||
|
||||
void LocAdapterBase::
|
||||
reportSv(QtiGnssSvStatus &svStatus,
|
||||
reportSv(GnssSvStatus &svStatus,
|
||||
GpsLocationExtended &locationExtended,
|
||||
void* svExt)
|
||||
DEFAULT_IMPL()
|
||||
|
@ -137,6 +137,6 @@ bool LocAdapterBase::
|
|||
DEFAULT_IMPL(false)
|
||||
|
||||
void LocAdapterBase::
|
||||
reportGpsMeasurementData(GpsData &gpsMeasurementData)
|
||||
reportGnssMeasurementData(GnssData &gnssMeasurementData)
|
||||
DEFAULT_IMPL()
|
||||
} // namespace loc_core
|
||||
|
|
|
@ -98,7 +98,7 @@ public:
|
|||
void* locationExt,
|
||||
enum loc_sess_status status,
|
||||
LocPosTechMask loc_technology_mask);
|
||||
virtual void reportSv(QtiGnssSvStatus &svStatus,
|
||||
virtual void reportSv(GnssSvStatus &svStatus,
|
||||
GpsLocationExtended &locationExtended,
|
||||
void* svExt);
|
||||
virtual void reportStatus(GpsStatusValue status);
|
||||
|
@ -117,7 +117,7 @@ public:
|
|||
const void* data);
|
||||
inline virtual bool isInSession() { return false; }
|
||||
ContextBase* getContext() const { return mContext; }
|
||||
virtual void reportGpsMeasurementData(GpsData &gpsMeasurementData);
|
||||
virtual void reportGnssMeasurementData(GnssData &gnssMeasurementData);
|
||||
};
|
||||
|
||||
} // namespace loc_core
|
||||
|
|
|
@ -253,23 +253,21 @@ void LocApiBase::reportPosition(UlpLocation &location,
|
|||
);
|
||||
}
|
||||
|
||||
void LocApiBase::reportSv(QtiGnssSvStatus &svStatus,
|
||||
void LocApiBase::reportSv(GnssSvStatus &svStatus,
|
||||
GpsLocationExtended &locationExtended,
|
||||
void* svExt)
|
||||
{
|
||||
// print the SV info before delivering
|
||||
LOC_LOGV("num sv: %d\n ephemeris mask: %dxn almanac mask: %x\n gps/glo/bds in use"
|
||||
" mask: %x/%x/%x\n sv: prn snr elevation azimuth",
|
||||
svStatus.num_svs, svStatus.ephemeris_mask,
|
||||
svStatus.almanac_mask, svStatus.gps_used_in_fix_mask,
|
||||
svStatus.glo_used_in_fix_mask, svStatus.bds_used_in_fix_mask);
|
||||
for (int i = 0; i < svStatus.num_svs && i < GPS_MAX_SVS; i++) {
|
||||
LOC_LOGV(" %d: %d %f %f %f",
|
||||
LOC_LOGV("num sv: %d", svStatus.num_svs);
|
||||
for (int i = 0; i < svStatus.num_svs && i < GNSS_MAX_SVS; i++) {
|
||||
LOC_LOGV(" %03d: %02d %d %f %f %f 0x%02X",
|
||||
i,
|
||||
svStatus.sv_list[i].prn,
|
||||
svStatus.sv_list[i].snr,
|
||||
svStatus.sv_list[i].elevation,
|
||||
svStatus.sv_list[i].azimuth);
|
||||
svStatus.gnss_sv_list[i].svid,
|
||||
svStatus.gnss_sv_list[i].constellation,
|
||||
svStatus.gnss_sv_list[i].c_n0_dbhz,
|
||||
svStatus.gnss_sv_list[i].elevation,
|
||||
svStatus.gnss_sv_list[i].azimuth,
|
||||
svStatus.gnss_sv_list[i].flags);
|
||||
}
|
||||
// loop through adapters, and deliver to all adapters.
|
||||
TO_ALL_LOCADAPTERS(
|
||||
|
@ -364,10 +362,10 @@ void* LocApiBase :: getSibling()
|
|||
LocApiProxyBase* LocApiBase :: getLocApiProxy()
|
||||
DEFAULT_IMPL(NULL)
|
||||
|
||||
void LocApiBase::reportGpsMeasurementData(GpsData &gpsMeasurementData)
|
||||
void LocApiBase::reportGnssMeasurementData(GnssData &gnssMeasurementData)
|
||||
{
|
||||
// loop through adapters, and deliver to all adapters.
|
||||
TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportGpsMeasurementData(gpsMeasurementData));
|
||||
TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportGnssMeasurementData(gnssMeasurementData));
|
||||
}
|
||||
|
||||
enum loc_api_adapter_err LocApiBase::
|
||||
|
|
|
@ -113,7 +113,7 @@ public:
|
|||
enum loc_sess_status status,
|
||||
LocPosTechMask loc_technology_mask =
|
||||
LOC_POS_TECH_MASK_DEFAULT);
|
||||
void reportSv(QtiGnssSvStatus &svStatus,
|
||||
void reportSv(GnssSvStatus &svStatus,
|
||||
GpsLocationExtended &locationExtended,
|
||||
void* svExt);
|
||||
void reportStatus(GpsStatusValue status);
|
||||
|
@ -130,7 +130,7 @@ public:
|
|||
void reportDataCallClosed();
|
||||
void requestNiNotify(GpsNiNotification ¬ify, const void* data);
|
||||
void saveSupportedMsgList(uint64_t supportedMsgList);
|
||||
void reportGpsMeasurementData(GpsData &gpsMeasurementData);
|
||||
void reportGnssMeasurementData(GnssData &gnssMeasurementData);
|
||||
|
||||
// downward calls
|
||||
// All below functions are to be defined by adapter specific modules:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -64,7 +64,7 @@ public:
|
|||
(void)loc_technology_mask;
|
||||
return false;
|
||||
}
|
||||
inline virtual bool reportSv(QtiGnssSvStatus &svStatus,
|
||||
inline virtual bool reportSv(GnssSvStatus &svStatus,
|
||||
GpsLocationExtended &locationExtended,
|
||||
void* svExt) {
|
||||
(void)svStatus;
|
||||
|
|
|
@ -266,47 +266,6 @@ typedef struct {
|
|||
float horUncEllipseOrientAzimuth;
|
||||
} GpsLocationExtended;
|
||||
|
||||
/** Represents SV status. */
|
||||
typedef struct {
|
||||
/** set to sizeof(QtiGnssSvStatus) */
|
||||
size_t size;
|
||||
|
||||
/** Number of SVs currently visible. */
|
||||
int num_svs;
|
||||
|
||||
/** Contains an array of SV information. */
|
||||
GpsSvInfo sv_list[GPS_MAX_SVS];
|
||||
|
||||
/** Represents a bit mask indicating which SVs
|
||||
* have ephemeris data.
|
||||
*/
|
||||
uint32_t ephemeris_mask;
|
||||
|
||||
/** Represents a bit mask indicating which SVs
|
||||
* have almanac data.
|
||||
*/
|
||||
uint32_t almanac_mask;
|
||||
|
||||
/**
|
||||
* Represents a bit mask indicating which GPS SVs
|
||||
* were used for computing the most recent position fix.
|
||||
*/
|
||||
uint32_t gps_used_in_fix_mask;
|
||||
|
||||
/**
|
||||
* Represents a bit mask indicating which GLONASS SVs
|
||||
* were used for computing the most recent position fix.
|
||||
*/
|
||||
uint32_t glo_used_in_fix_mask;
|
||||
|
||||
/**
|
||||
* Represents a bit mask indicating which BDS SVs
|
||||
* were used for computing the most recent position fix.
|
||||
*/
|
||||
uint64_t bds_used_in_fix_mask;
|
||||
|
||||
} QtiGnssSvStatus;
|
||||
|
||||
enum loc_sess_status {
|
||||
LOC_SESS_SUCCESS,
|
||||
LOC_SESS_INTERMEDIATE,
|
||||
|
|
|
@ -375,14 +375,14 @@ void LocEngAdapter::reportPosition(UlpLocation &location,
|
|||
}
|
||||
}
|
||||
|
||||
void LocInternalAdapter::reportSv(QtiGnssSvStatus &svStatus,
|
||||
void LocInternalAdapter::reportSv(GnssSvStatus &svStatus,
|
||||
GpsLocationExtended &locationExtended,
|
||||
void* svExt){
|
||||
sendMsg(new LocEngReportSv(mLocEngAdapter, svStatus,
|
||||
locationExtended, svExt));
|
||||
}
|
||||
|
||||
void LocEngAdapter::reportSv(QtiGnssSvStatus &svStatus,
|
||||
void LocEngAdapter::reportSv(GnssSvStatus &svStatus,
|
||||
GpsLocationExtended &locationExtended,
|
||||
void* svExt)
|
||||
{
|
||||
|
@ -564,10 +564,10 @@ enum loc_api_adapter_err LocEngAdapter::setXtraVersionCheck(int check)
|
|||
return ret;
|
||||
}
|
||||
|
||||
void LocEngAdapter::reportGpsMeasurementData(GpsData &gpsMeasurementData)
|
||||
void LocEngAdapter::reportGnssMeasurementData(GnssData &gnssMeasurementData)
|
||||
{
|
||||
sendMsg(new LocEngReportGpsMeasurement(mOwner,
|
||||
gpsMeasurementData));
|
||||
sendMsg(new LocEngReportGnssMeasurement(mOwner,
|
||||
gnssMeasurementData));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2011-2016, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -55,7 +55,7 @@ public:
|
|||
void* locationExt,
|
||||
enum loc_sess_status status,
|
||||
LocPosTechMask loc_technology_mask);
|
||||
virtual void reportSv(QtiGnssSvStatus &svStatus,
|
||||
virtual void reportSv(GnssSvStatus &svStatus,
|
||||
GpsLocationExtended &locationExtended,
|
||||
void* svExt);
|
||||
virtual void reportStatus(GpsStatusValue status);
|
||||
|
@ -85,6 +85,7 @@ public:
|
|||
bool mSupportsAgpsRequests;
|
||||
bool mSupportsPositionInjection;
|
||||
bool mSupportsTimeInjection;
|
||||
GnssSystemInfo mGnssInfo;
|
||||
|
||||
LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask,
|
||||
void* owner, ContextBase* context,
|
||||
|
@ -269,7 +270,7 @@ public:
|
|||
void* locationExt,
|
||||
enum loc_sess_status status,
|
||||
LocPosTechMask loc_technology_mask);
|
||||
virtual void reportSv(QtiGnssSvStatus &svStatus,
|
||||
virtual void reportSv(GnssSvStatus &svStatus,
|
||||
GpsLocationExtended &locationExtended,
|
||||
void* svExt);
|
||||
virtual void reportStatus(GpsStatusValue status);
|
||||
|
@ -284,7 +285,7 @@ public:
|
|||
virtual bool requestSuplES(int connHandle);
|
||||
virtual bool reportDataCallOpened();
|
||||
virtual bool reportDataCallClosed();
|
||||
virtual void reportGpsMeasurementData(GpsData &gpsMeasurementData);
|
||||
virtual void reportGnssMeasurementData(GnssData &gnssMeasurementData);
|
||||
|
||||
inline const LocPosMode& getPositionMode() const
|
||||
{return mFixCriteria;}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2011-2016, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -285,6 +285,7 @@ static int loc_init(GpsCallbacks* callbacks)
|
|||
}
|
||||
|
||||
event = LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT |
|
||||
LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT |
|
||||
LOC_API_ADAPTER_BIT_SATELLITE_REPORT |
|
||||
LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST |
|
||||
LOC_API_ADAPTER_BIT_ASSISTANCE_DATA_REQUEST |
|
||||
|
@ -304,6 +305,8 @@ static int loc_init(GpsCallbacks* callbacks)
|
|||
NULL, /* location_ext_parser */
|
||||
NULL, /* sv_ext_parser */
|
||||
callbacks->request_utc_time_cb, /* request_utc_time_cb */
|
||||
callbacks->set_system_info_cb, /* set_system_info_cb */
|
||||
callbacks->gnss_sv_status_cb, /* gnss_sv_status_cb */
|
||||
};
|
||||
|
||||
gps_loc_cb = callbacks->location_cb;
|
||||
|
|
|
@ -57,6 +57,8 @@ typedef struct {
|
|||
loc_ext_parser location_ext_parser;
|
||||
loc_ext_parser sv_ext_parser;
|
||||
gps_request_utc_time request_utc_time_cb;
|
||||
gnss_set_system_info set_system_info_cb;
|
||||
gnss_sv_status_callback gnss_sv_status_cb;
|
||||
} LocCallbacks;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2009-2015, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2009-2016, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -828,7 +828,7 @@ void LocEngReportPosition::send() const {
|
|||
|
||||
// case LOC_ENG_MSG_REPORT_SV:
|
||||
LocEngReportSv::LocEngReportSv(LocAdapterBase* adapter,
|
||||
QtiGnssSvStatus &sv,
|
||||
GnssSvStatus &sv,
|
||||
GpsLocationExtended &locExtended,
|
||||
void* svExt) :
|
||||
LocMsg(), mAdapter(adapter), mSvStatus(sv),
|
||||
|
@ -845,9 +845,9 @@ void LocEngReportSv::proc() const {
|
|||
|
||||
if (locEng->mute_session_state != LOC_MUTE_SESS_IN_SESSION)
|
||||
{
|
||||
if (locEng->sv_status_cb != NULL) {
|
||||
locEng->sv_status_cb((GpsSvStatus*)&(mSvStatus),
|
||||
(void*)mSvExt);
|
||||
if (locEng->gnss_sv_status_cb != NULL) {
|
||||
LOC_LOGE("Calling gnss_sv_status_cb");
|
||||
locEng->gnss_sv_status_cb((GnssSvStatus*)&(mSvStatus));
|
||||
}
|
||||
|
||||
if (locEng->generateNmea)
|
||||
|
@ -1376,6 +1376,32 @@ struct LocEngSetCapabilities : public LocMsg {
|
|||
}
|
||||
};
|
||||
|
||||
struct LocEngSetSystemInfo : public LocMsg {
|
||||
loc_eng_data_s_type* mLocEng;
|
||||
inline LocEngSetSystemInfo(loc_eng_data_s_type* locEng) :
|
||||
LocMsg(), mLocEng(locEng)
|
||||
{
|
||||
locallog();
|
||||
}
|
||||
inline virtual void proc() const {
|
||||
if (NULL != mLocEng->set_capabilities_cb) {
|
||||
LOC_LOGV("calling set_system_info_cb 0x%x",
|
||||
mLocEng->adapter->mGnssInfo.year_of_hw);
|
||||
mLocEng->set_system_info_cb(&(mLocEng->adapter->mGnssInfo));
|
||||
}
|
||||
else {
|
||||
LOC_LOGV("set_system_info_cb is NULL.\n");
|
||||
}
|
||||
}
|
||||
inline void locallog() const
|
||||
{
|
||||
LOC_LOGV("LocEngSetSystemInfo");
|
||||
}
|
||||
inline virtual void log() const
|
||||
{
|
||||
locallog();
|
||||
}
|
||||
};
|
||||
// case LOC_ENG_MSG_LOC_INIT:
|
||||
struct LocEngInit : public LocMsg {
|
||||
loc_eng_data_s_type* mLocEng;
|
||||
|
@ -1388,6 +1414,7 @@ struct LocEngInit : public LocMsg {
|
|||
loc_eng_reinit(*mLocEng);
|
||||
// set the capabilities
|
||||
mLocEng->adapter->sendMsg(new LocEngSetCapabilities(mLocEng));
|
||||
mLocEng->adapter->sendMsg(new LocEngSetSystemInfo(mLocEng));
|
||||
}
|
||||
inline void locallog() const
|
||||
{
|
||||
|
@ -1607,10 +1634,13 @@ struct LocEngGnssConstellationConfig : public LocMsg {
|
|||
locallog();
|
||||
}
|
||||
inline virtual void proc() const {
|
||||
mAdapter->mGnssInfo.size = sizeof(GnssSystemInfo);
|
||||
if (mAdapter->gnssConstellationConfig()) {
|
||||
LOC_LOGV("Modem supports GNSS measurements\n");
|
||||
gps_conf.CAPABILITIES |= GPS_CAPABILITY_MEASUREMENTS;
|
||||
mAdapter->mGnssInfo.year_of_hw = 2016;
|
||||
} else {
|
||||
mAdapter->mGnssInfo.year_of_hw = 2015;
|
||||
LOC_LOGV("Modem does not support GNSS measurements\n");
|
||||
}
|
||||
}
|
||||
|
@ -1623,50 +1653,59 @@ struct LocEngGnssConstellationConfig : public LocMsg {
|
|||
};
|
||||
|
||||
// case LOC_ENG_MSG_REPORT_GNSS_MEASUREMENT:
|
||||
LocEngReportGpsMeasurement::LocEngReportGpsMeasurement(void* locEng,
|
||||
GpsData &gpsData) :
|
||||
LocMsg(), mLocEng(locEng), mGpsData(gpsData)
|
||||
LocEngReportGnssMeasurement::LocEngReportGnssMeasurement(void* locEng,
|
||||
GnssData &gnssData) :
|
||||
LocMsg(), mLocEng(locEng), mGnssData(gnssData)
|
||||
{
|
||||
locallog();
|
||||
}
|
||||
void LocEngReportGpsMeasurement::proc() const {
|
||||
void LocEngReportGnssMeasurement::proc() const {
|
||||
loc_eng_data_s_type* locEng = (loc_eng_data_s_type*) mLocEng;
|
||||
if (locEng->mute_session_state != LOC_MUTE_SESS_IN_SESSION)
|
||||
{
|
||||
if (locEng->gps_measurement_cb != NULL) {
|
||||
locEng->gps_measurement_cb((GpsData*)&(mGpsData));
|
||||
if (locEng->gnss_measurement_cb != NULL) {
|
||||
LOC_LOGV("Calling gnss_measurement_cb");
|
||||
locEng->gnss_measurement_cb((GnssData*)&(mGnssData));
|
||||
}
|
||||
}
|
||||
}
|
||||
void LocEngReportGpsMeasurement::locallog() const {
|
||||
void LocEngReportGnssMeasurement::locallog() const {
|
||||
IF_LOC_LOGV {
|
||||
LOC_LOGV("%s:%d]: Received in GPS HAL."
|
||||
"GNSS Measurements count: %d \n",
|
||||
__func__, __LINE__, mGpsData.measurement_count);
|
||||
for (int i =0; i< mGpsData.measurement_count && i < GPS_MAX_SVS; i++) {
|
||||
__func__, __LINE__, mGnssData.measurement_count);
|
||||
for (int i =0; i< mGnssData.measurement_count && i < GNSS_MAX_SVS; i++) {
|
||||
LOC_LOGV(" GNSS measurement data in GPS HAL: \n"
|
||||
" GPS_HAL => Measurement ID | prn | time_offset_ns | state |"
|
||||
" received_gps_tow_ns| c_n0_dbhz | pseudorange_rate_mps |"
|
||||
" GPS_HAL => Measurement ID | svid | time_offset_ns | state |"
|
||||
" c_n0_dbhz | pseudorange_rate_mps |"
|
||||
" pseudorange_rate_uncertainty_mps |"
|
||||
" accumulated_delta_range_state | flags \n"
|
||||
" GPS_HAL => %d | %d | %f | %d | %lld | %f | %f | %f | %d | %d \n",
|
||||
" GPS_HAL => %d | %d | %f | %d | %f | %f | %f | %d | %d \n",
|
||||
i,
|
||||
mGpsData.measurements[i].prn,
|
||||
mGpsData.measurements[i].time_offset_ns,
|
||||
mGpsData.measurements[i].state,
|
||||
mGpsData.measurements[i].received_gps_tow_ns,
|
||||
mGpsData.measurements[i].c_n0_dbhz,
|
||||
mGpsData.measurements[i].pseudorange_rate_mps,
|
||||
mGpsData.measurements[i].pseudorange_rate_uncertainty_mps,
|
||||
mGpsData.measurements[i].accumulated_delta_range_state,
|
||||
mGpsData.measurements[i].flags);
|
||||
mGnssData.measurements[i].svid,
|
||||
mGnssData.measurements[i].time_offset_ns,
|
||||
mGnssData.measurements[i].state,
|
||||
mGnssData.measurements[i].c_n0_dbhz,
|
||||
mGnssData.measurements[i].pseudorange_rate_mps,
|
||||
mGnssData.measurements[i].pseudorange_rate_uncertainty_mps,
|
||||
mGnssData.measurements[i].accumulated_delta_range_state,
|
||||
mGnssData.measurements[i].flags);
|
||||
}
|
||||
LOC_LOGV(" GPS_HAL => Clocks Info: type | time_ns \n"
|
||||
" GPS_HAL => Clocks Info: %d | %lld", mGpsData.clock.type,
|
||||
mGpsData.clock.time_ns);
|
||||
LOC_LOGV(" GPS_HAL => Clocks Info: \n"
|
||||
" time_ns | full_bias_ns | bias_ns | bias_uncertainty_ns | "
|
||||
" drift_nsps | drift_uncertainty_nsps | hw_clock_discontinuity_count | flags"
|
||||
" GPS_HAL => Clocks Info: %lld | %lld | %g | %g | %g | %g | %d | 0x%04x\n",
|
||||
mGnssData.clock.time_ns,
|
||||
mGnssData.clock.full_bias_ns,
|
||||
mGnssData.clock.bias_ns,
|
||||
mGnssData.clock.bias_uncertainty_ns,
|
||||
mGnssData.clock.drift_nsps,
|
||||
mGnssData.clock.drift_uncertainty_nsps,
|
||||
mGnssData.clock.hw_clock_discontinuity_count,
|
||||
mGnssData.clock.flags);
|
||||
}
|
||||
}
|
||||
inline void LocEngReportGpsMeasurement::log() const {
|
||||
inline void LocEngReportGnssMeasurement::log() const {
|
||||
locallog();
|
||||
}
|
||||
|
||||
|
@ -1746,6 +1785,8 @@ int loc_eng_init(loc_eng_data_s_type &loc_eng_data, LocCallbacks* callbacks,
|
|||
loc_eng_data.acquire_wakelock_cb = callbacks->acquire_wakelock_cb;
|
||||
loc_eng_data.release_wakelock_cb = callbacks->release_wakelock_cb;
|
||||
loc_eng_data.request_utc_time_cb = callbacks->request_utc_time_cb;
|
||||
loc_eng_data.set_system_info_cb = callbacks->set_system_info_cb;
|
||||
loc_eng_data.gnss_sv_status_cb = callbacks->gnss_sv_status_cb;
|
||||
loc_eng_data.location_ext_parser = callbacks->location_ext_parser ?
|
||||
callbacks->location_ext_parser : noProc;
|
||||
loc_eng_data.sv_ext_parser = callbacks->sv_ext_parser ?
|
||||
|
@ -1770,6 +1811,8 @@ int loc_eng_init(loc_eng_data_s_type &loc_eng_data, LocCallbacks* callbacks,
|
|||
new LocEngAdapter(event, &loc_eng_data, context,
|
||||
(LocThread::tCreate)callbacks->create_thread_cb);
|
||||
|
||||
loc_eng_data.adapter->mGnssInfo.size = sizeof(GnssSystemInfo);
|
||||
loc_eng_data.adapter->mGnssInfo.year_of_hw = 2015;
|
||||
LOC_LOGD("loc_eng_init created client, id = %p\n",
|
||||
loc_eng_data.adapter);
|
||||
loc_eng_data.adapter->sendMsg(new LocEngInit(&loc_eng_data));
|
||||
|
@ -2942,8 +2985,8 @@ int loc_eng_gps_measurement_init(loc_eng_data_s_type &loc_eng_data,
|
|||
{
|
||||
ENTRY_LOG_CALLFLOW();
|
||||
|
||||
STATE_CHECK((NULL == loc_eng_data.gps_measurement_cb),
|
||||
"gps measurement already initialized",
|
||||
STATE_CHECK((NULL == loc_eng_data.gnss_measurement_cb),
|
||||
"gnss measurement already initialized",
|
||||
return GPS_MEASUREMENT_ERROR_ALREADY_INIT);
|
||||
STATE_CHECK((callbacks != NULL),
|
||||
"callbacks can not be NULL",
|
||||
|
@ -2959,7 +3002,7 @@ int loc_eng_gps_measurement_init(loc_eng_data_s_type &loc_eng_data,
|
|||
event,
|
||||
LOC_REGISTRATION_MASK_ENABLED));
|
||||
// set up the callback
|
||||
loc_eng_data.gps_measurement_cb = callbacks->measurement_callback;
|
||||
loc_eng_data.gnss_measurement_cb = callbacks->gnss_measurement_callback;
|
||||
LOC_LOGD ("%s, event masks updated successfully", __func__);
|
||||
|
||||
return GPS_MEASUREMENT_OPERATION_SUCCESS;
|
||||
|
@ -2994,6 +3037,6 @@ void loc_eng_gps_measurement_close(loc_eng_data_s_type &loc_eng_data)
|
|||
event,
|
||||
LOC_REGISTRATION_MASK_DISABLED));
|
||||
// set up the callback
|
||||
loc_eng_data.gps_measurement_cb = NULL;
|
||||
loc_eng_data.gnss_measurement_cb = NULL;
|
||||
EXIT_LOG(%d, 0);
|
||||
}
|
||||
|
|
|
@ -94,7 +94,9 @@ typedef struct loc_eng_data_s
|
|||
gps_acquire_wakelock acquire_wakelock_cb;
|
||||
gps_release_wakelock release_wakelock_cb;
|
||||
gps_request_utc_time request_utc_time_cb;
|
||||
gps_measurement_callback gps_measurement_cb;
|
||||
gnss_set_system_info set_system_info_cb;
|
||||
gnss_sv_status_callback gnss_sv_status_cb;
|
||||
gnss_measurement_callback gnss_measurement_cb;
|
||||
boolean intermediateFix;
|
||||
AGpsStatusValue agps_status;
|
||||
loc_eng_xtra_data_s_type xtra_module_data;
|
||||
|
|
|
@ -105,11 +105,11 @@ struct LocEngReportPosition : public LocMsg {
|
|||
|
||||
struct LocEngReportSv : public LocMsg {
|
||||
LocAdapterBase* mAdapter;
|
||||
const QtiGnssSvStatus mSvStatus;
|
||||
const GnssSvStatus mSvStatus;
|
||||
const GpsLocationExtended mLocationExtended;
|
||||
const void* mSvExt;
|
||||
LocEngReportSv(LocAdapterBase* adapter,
|
||||
QtiGnssSvStatus &sv,
|
||||
GnssSvStatus &sv,
|
||||
GpsLocationExtended &locExtended,
|
||||
void* svExtended);
|
||||
virtual void proc() const;
|
||||
|
@ -289,11 +289,11 @@ struct LocEngGetZpp : public LocMsg {
|
|||
void send() const;
|
||||
};
|
||||
|
||||
struct LocEngReportGpsMeasurement : public LocMsg {
|
||||
struct LocEngReportGnssMeasurement : public LocMsg {
|
||||
void* mLocEng;
|
||||
const GpsData mGpsData;
|
||||
LocEngReportGpsMeasurement(void* locEng,
|
||||
GpsData &gpsData);
|
||||
const GnssData mGnssData;
|
||||
LocEngReportGnssMeasurement(void* locEng,
|
||||
GnssData &gnssData);
|
||||
virtual void proc() const;
|
||||
void locallog() const;
|
||||
virtual void log() const;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2012, 2016, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -29,10 +29,6 @@
|
|||
|
||||
#define LOG_NDDEBUG 0
|
||||
#define LOG_TAG "LocSvc_eng_nmea"
|
||||
#define GPS_PRN_START 1
|
||||
#define GPS_PRN_END 32
|
||||
#define GLONASS_PRN_START 65
|
||||
#define GLONASS_PRN_END 96
|
||||
#include <loc_eng.h>
|
||||
#include <loc_eng_nmea.h>
|
||||
#include <math.h>
|
||||
|
@ -707,7 +703,7 @@ SIDE EFFECTS
|
|||
|
||||
===========================================================================*/
|
||||
void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p,
|
||||
const QtiGnssSvStatus &svStatus, const GpsLocationExtended &locationExtended)
|
||||
const GnssSvStatus &svStatus, const GpsLocationExtended &locationExtended)
|
||||
{
|
||||
ENTRY_LOG();
|
||||
|
||||
|
@ -724,15 +720,27 @@ void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p,
|
|||
|
||||
//Count GPS SVs for saparating GPS from GLONASS and throw others
|
||||
|
||||
loc_eng_data_p->gps_used_mask = 0;
|
||||
loc_eng_data_p->glo_used_mask = 0;
|
||||
for(svNumber=1; svNumber <= svCount; svNumber++) {
|
||||
if( (svStatus.sv_list[svNumber-1].prn >= GPS_PRN_START)&&
|
||||
(svStatus.sv_list[svNumber-1].prn <= GPS_PRN_END) )
|
||||
if (GNSS_CONSTELLATION_GPS == svStatus.gnss_sv_list[svNumber - 1].constellation)
|
||||
{
|
||||
// cache the used in fix mask, as it will be needed to send $GPGSA
|
||||
// during the position report
|
||||
if (GNSS_SV_FLAGS_USED_IN_FIX == (svStatus.gnss_sv_list[svNumber - 1].flags & GNSS_SV_FLAGS_USED_IN_FIX))
|
||||
{
|
||||
loc_eng_data_p->gps_used_mask |= (1 << (svStatus.gnss_sv_list[svNumber - 1].svid - 1));
|
||||
}
|
||||
gpsCount++;
|
||||
}
|
||||
else if( (svStatus.sv_list[svNumber-1].prn >= GLONASS_PRN_START) &&
|
||||
(svStatus.sv_list[svNumber-1].prn <= GLONASS_PRN_END) )
|
||||
else if (GNSS_CONSTELLATION_GLONASS == svStatus.gnss_sv_list[svNumber - 1].constellation)
|
||||
{
|
||||
// cache the used in fix mask, as it will be needed to send $GNGSA
|
||||
// during the position report
|
||||
if (GNSS_SV_FLAGS_USED_IN_FIX == (svStatus.gnss_sv_list[svNumber - 1].flags & GNSS_SV_FLAGS_USED_IN_FIX))
|
||||
{
|
||||
loc_eng_data_p->glo_used_mask |= (1 << (svStatus.gnss_sv_list[svNumber - 1].svid - 1));
|
||||
}
|
||||
glnCount++;
|
||||
}
|
||||
}
|
||||
|
@ -772,13 +780,12 @@ void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p,
|
|||
|
||||
for (int i=0; (svNumber <= svCount) && (i < 4); svNumber++)
|
||||
{
|
||||
if( (svStatus.sv_list[svNumber-1].prn >= GPS_PRN_START) &&
|
||||
(svStatus.sv_list[svNumber-1].prn <= GPS_PRN_END) )
|
||||
if (GNSS_CONSTELLATION_GPS == svStatus.gnss_sv_list[svNumber - 1].constellation)
|
||||
{
|
||||
length = snprintf(pMarker, lengthRemaining,",%02d,%02d,%03d,",
|
||||
svStatus.sv_list[svNumber-1].prn,
|
||||
(int)(0.5 + svStatus.sv_list[svNumber-1].elevation), //float to int
|
||||
(int)(0.5 + svStatus.sv_list[svNumber-1].azimuth)); //float to int
|
||||
svStatus.gnss_sv_list[svNumber-1].svid,
|
||||
(int)(0.5 + svStatus.gnss_sv_list[svNumber-1].elevation), //float to int
|
||||
(int)(0.5 + svStatus.gnss_sv_list[svNumber-1].azimuth)); //float to int
|
||||
|
||||
if (length < 0 || length >= lengthRemaining)
|
||||
{
|
||||
|
@ -788,10 +795,10 @@ void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p,
|
|||
pMarker += length;
|
||||
lengthRemaining -= length;
|
||||
|
||||
if (svStatus.sv_list[svNumber-1].snr > 0)
|
||||
if (svStatus.gnss_sv_list[svNumber-1].c_n0_dbhz > 0)
|
||||
{
|
||||
length = snprintf(pMarker, lengthRemaining,"%02d",
|
||||
(int)(0.5 + svStatus.sv_list[svNumber-1].snr)); //float to int
|
||||
(int)(0.5 + svStatus.gnss_sv_list[svNumber-1].c_n0_dbhz)); //float to int
|
||||
|
||||
if (length < 0 || length >= lengthRemaining)
|
||||
{
|
||||
|
@ -850,13 +857,13 @@ void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p,
|
|||
|
||||
for (int i=0; (svNumber <= svCount) && (i < 4); svNumber++)
|
||||
{
|
||||
if( (svStatus.sv_list[svNumber-1].prn >= GLONASS_PRN_START) &&
|
||||
(svStatus.sv_list[svNumber-1].prn <= GLONASS_PRN_END) ) {
|
||||
if (GNSS_CONSTELLATION_GLONASS == svStatus.gnss_sv_list[svNumber - 1].constellation)
|
||||
{
|
||||
|
||||
length = snprintf(pMarker, lengthRemaining,",%02d,%02d,%03d,",
|
||||
svStatus.sv_list[svNumber-1].prn,
|
||||
(int)(0.5 + svStatus.sv_list[svNumber-1].elevation), //float to int
|
||||
(int)(0.5 + svStatus.sv_list[svNumber-1].azimuth)); //float to int
|
||||
svStatus.gnss_sv_list[svNumber - 1].svid,
|
||||
(int)(0.5 + svStatus.gnss_sv_list[svNumber - 1].elevation), //float to int
|
||||
(int)(0.5 + svStatus.gnss_sv_list[svNumber - 1].azimuth)); //float to int
|
||||
|
||||
if (length < 0 || length >= lengthRemaining)
|
||||
{
|
||||
|
@ -866,10 +873,10 @@ void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p,
|
|||
pMarker += length;
|
||||
lengthRemaining -= length;
|
||||
|
||||
if (svStatus.sv_list[svNumber-1].snr > 0)
|
||||
if (svStatus.gnss_sv_list[svNumber - 1].c_n0_dbhz > 0)
|
||||
{
|
||||
length = snprintf(pMarker, lengthRemaining,"%02d",
|
||||
(int)(0.5 + svStatus.sv_list[svNumber-1].snr)); //float to int
|
||||
(int)(0.5 + svStatus.gnss_sv_list[svNumber - 1].c_n0_dbhz)); //float to int
|
||||
|
||||
if (length < 0 || length >= lengthRemaining)
|
||||
{
|
||||
|
@ -893,11 +900,6 @@ void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p,
|
|||
|
||||
}//if
|
||||
|
||||
// cache the used in fix mask, as it will be needed to send $GPGSA/$GNGSA
|
||||
// during the position report
|
||||
loc_eng_data_p->gps_used_mask = svStatus.gps_used_in_fix_mask;
|
||||
loc_eng_data_p->glo_used_mask = svStatus.glo_used_in_fix_mask;
|
||||
|
||||
// For RPC, the DOP are sent during sv report, so cache them
|
||||
// now to be sent during position report.
|
||||
// For QMI, the DOP will be in position report.
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
void loc_eng_nmea_send(char *pNmea, int length, loc_eng_data_s_type *loc_eng_data_p);
|
||||
int loc_eng_nmea_put_checksum(char *pNmea, int maxSize);
|
||||
void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p, const QtiGnssSvStatus &svStatus, const GpsLocationExtended &locationExtended);
|
||||
void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p, const GnssSvStatus &svStatus, const GpsLocationExtended &locationExtended);
|
||||
void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p, const UlpLocation &location, const GpsLocationExtended &locationExtended, unsigned char generate_nmea);
|
||||
|
||||
#endif // LOC_ENG_NMEA_H
|
||||
|
|
Loading…
Reference in a new issue