Browse Source

Merge "FR58994: Location Client API: SV poly support"

caf-8.1-sodp-port
qctecmdr 2 years ago
committed by Gerrit - the friendly Code Review server
parent
commit
9ff2a3bf80
  1. 308
      client_api/inc/LocationClientApi.h
  2. 3
      client_api/src/LocationClientApi.cpp
  3. 265
      client_api/src/LocationClientApiImpl.cpp
  4. 3
      client_api/src/LocationClientApiImpl.h
  5. 308
      client_api/src/LocationClientApiLog.h
  6. 79
      client_api/src/LocationClientApiUtils.cpp
  7. 26
      location_hal_daemon/LocHalDaemonClientHandler.cpp
  8. 1
      location_hal_daemon/LocHalDaemonClientHandler.h
  9. 19
      location_hal_daemon/LocationApiMsg.h

308
client_api/inc/LocationClientApi.h

@ -1400,6 +1400,301 @@ struct LocationSystemInfo {
LeapSecondSystemInfo leapSecondSysInfo;
};
/** Specify the valid fields in GnssSvPoly. <br/> */
enum GnssSvPolyValidityMask {
/** GnssSvPoly has valid GnssSvPoly::svId. <br/>
* This flag should always be set. <br/> */
GNSS_SV_POLY_HAS_SV_ID = 0x0000000001,
/** GnssSvPoly has valid GnssSvPoly::svConstellation. <br/>
* This flag should always be set. <br/> */
GNSS_SV_POLY_HAS_SV_CONSTELLATION = 0x0000000002,
/** GnssSvPoly has valid GnssSvPoly::gloFrequency. <br/>
* This flag should be set only if this is Glonass SV. <br/> */
GNSS_SV_POLY_HAS_GLO_FREQUENCY = 0x0000000004,
/** GnssSvPoly has valid GnssSvPoly::actionType. <br/>
* This flag should always be set. <br/> */
GNSS_SV_POLY_HAS_ACTION_TYPE = 0x0000000008,
/** GnssSvPoly has valid GnssSvPoly::statusMask. <br/> */
GNSS_SV_POLY_HAS_STATUS_MASK = 0x0000000010,
/** GnssSvPoly has valid GnssSvPoly::T0. <br/> */
GNSS_SV_POLY_HAS_T0 = 0x0000000020,
/** GnssSvPoly has valid GnssSvPoly::polyCofXYZ0. <br/> */
GNSS_SV_POLY_HAS_POLY_COF_XYZ0 = 0x0000000040,
/** GnssSvPoly has valid GnssSvPoly::polyCofXYZN. <br/> */
GNSS_SV_POLY_HAS_POLY_COF_XYZN = 0x0000000080,
/** GnssSvPoly has valid GnssSvPoly::polyCofClockBias. <br/> */
GNSS_SV_POLY_HAS_POLY_COF_CLK_BIAS = 0x0000000100,
/** GnssSvPoly has valid GnssSvPoly::iode. <br/> */
GNSS_SV_POLY_HAS_IODE = 0x0000000200,
/** GnssSvPoly has valid GnssSvPoly::enhancedIOD. <br/> */
GNSS_SV_POLY_HAS_ENHANCED_IOD = 0x0000000400,
/** GnssSvPoly has valid GnssSvPoly::svPosUnc. <br/> */
GNSS_SV_POLY_HAS_SV_POS_UNC = 0x0000000800,
/** GnssSvPoly has valid GnssSvPoly::ionoDelay. <br/> */
GNSS_SV_POLY_HAS_IONO_DELAY = 0x0000001000,
/** GnssSvPoly has valid GnssSvPoly::ionoDot. <br/> */
GNSS_SV_POLY_HAS_IONO_DOT = 0x0000002000,
/** GnssSvPoly has valid GnssSvPoly::sbasIonoDelay. <br/> */
GNSS_SV_POLY_HAS_SBAS_IONO_DELAY = 0x0000004000,
/** GnssSvPoly has valid GnssSvPoly::sbasIonoDot. <br/> */
GNSS_SV_POLY_HAS_SBAS_IONO_DOT = 0x0000008000,
/** GnssSvPoly has valid GnssSvPoly::tropoDelay. <br/> */
GNSS_SV_POLY_HAS_TROPO_DELAY = 0x0000010000,
/** GnssSvPoly has valid GnssSvPoly::elevation. <br/> */
GNSS_SV_POLY_HAS_ELEVATION = 0x0000020000,
/** GnssSvPoly has valid GnssSvPoly::elevationDot. <br/> */
GNSS_SV_POLY_HAS_ELEVATION_DOT = 0x0000040000,
/** GnssSvPoly has valid GnssSvPoly::elevationUnc. <br/> */
GNSS_SV_POLY_HAS_ELEVATION_UNC = 0x0000080000,
/** GnssSvPoly has valid GnssSvPoly::velCof. <br/> */
GNSS_SV_POLY_HAS_VEL_COF = 0x0000100000,
/** GnssSvPoly has valid GnssSvPoly::gpsIscL1ca. <br/> */
GNSS_SV_POLY_HAS_GPS_ISC_L1CA = 0x0000200000,
/** GnssSvPoly has valid GnssSvPoly::gpsIscL2c. <br/> */
GNSS_SV_POLY_HAS_GPS_ISC_L2C = 0x0000400000,
/** GnssSvPoly has valid GnssSvPoly::gpsIscL5I5. <br/> */
GNSS_SV_POLY_HAS_GPS_ISC_L5I5 = 0x0000800000,
/** GnssSvPoly has valid GnssSvPoly::gpsIscL5Q5. <br/> */
GNSS_SV_POLY_HAS_GPS_ISC_L5Q5 = 0x0001000000,
/** GnssSvPoly has valid GnssSvPoly::gpsTgd. <br/> */
GNSS_SV_POLY_HAS_GPS_TGD = 0x0002000000,
/** GnssSvPoly has valid GnssSvPoly::gloTgdG1G2. <br/> */
GNSS_SV_POLY_HAS_GLO_TGD_G1G2 = 0x0004000000,
/** GnssSvPoly has valid GnssSvPoly::bdsTgdB1. <br/> */
GNSS_SV_POLY_HAS_BDS_TGD_B1 = 0x00080000000,
/** GnssSvPoly has valid GnssSvPoly::bdsTgdB2. <br/> */
GNSS_SV_POLY_HAS_BDS_TGD_B2 = 0x00100000000,
/** GnssSvPoly has valid GnssSvPoly::bdsTgdB2a. <br/> */
GNSS_SV_POLY_HAS_BDS_TGD_B2A = 0x00200000000,
/** GnssSvPoly has valid GnssSvPoly::bdsIscB2a. <br/> */
GNSS_SV_POLY_HAS_BDS_ISC_B2A = 0x00400000000,
/** GnssSvPoly has valid GnssSvPoly::galBgdE1E5a. <br/> */
GNSS_SV_POLY_HAS_GAL_BGD_E1E5A = 0x00800000000,
/** GnssSvPoly has valid GnssSvPoly::galBgdE1E5b. <br/> */
GNSS_SV_POLY_HAS_GAL_BGD_E1E5B = 0x01000000000,
/** GnssSvPoly has valid GnssSvPoly::navicTgdL5. <br/> */
GNSS_SV_POLY_HAS_NAVIC_TDG_L5 = 0x02000000000,
};
/** Specify the SV polynomial report status. <br/> */
enum GnssSvPolyStatusMask {
/** Polynomials based on XTRA. <br/> */
GNSS_SV_POLY_STATUS_SRC_ALM_CORR = 0x01,
/** GLONASS string 4 has been received. <br/> */
GNSS_SV_POLY_STATUS_GLO_STR4 = 0x2,
/** GALILEO polynomial computed from I/Nav navigation
* message. <br/> */
GNSS_SV_POLY_STATUS_GAL_FNAV = 0x04,
/** GALILEO polynomial computed from F/Nav navigation message.
* <br/> */
GNSS_SV_POLY_STATUS_GAL_INAV = 0x08,
};
/** Action to be performed for the received polynomial for this
* satellite. <br/> */
enum GnssSvPolyActionType {
/** Update Polynomial for this satellite. <br/> */
GNSS_SV_POLY_ACTION_UPDATE = 1,
/** Invalidate any previously received polynomial. <br/> */
GNSS_SV_POLY_ACTION_INVALIDATE = 2,
};
/** Const define for the array size of
* GnssSvPoly::polyCofXYZ0. <br/> */
#define GNSS_SV_POLY_XYZ_0_TH_ORDER_COF_SIZE 3
/** Const define for the array size of
* GnssSvPoly::polyCofXYZN. <br/> */
#define GNSS_SV_POLY_XYZ_N_TH_ORDER_COF_SIZE 9
/** Const define for the array size of
* GnssSvPoly::polyCofClockBias. <br/> */
#define GNSS_SV_POLY_SV_CLKBIAS_COF_SIZE 4
/** Const define for the array size of GnssSvPoly::velCoef.
* <br/> */
#define GNSS_SV_POLY_VELOCITY_COF_SIZE 12
struct GnssSvPoly {
/** Bitwise OR of GnssSvPolyValidityMask to specify the
* valid fields in GnssSvPoly. <br/> */
GnssSvPolyValidityMask validityMask;
/** Specify satellite vehicle ID number. <br/>
* For SV id range of each supported constellations, refer to
* documentation in GnssSv::svId. <br/>
*/
uint16_t svId;
/** Specify GNSS Constellation Type for the SV. */
Gnss_LocSvSystemEnumType svConstellation;
/** GLONASS frequency number + 8. This field will only be
* marked as valid via validityMask for GLONASS SVs. <br/>
* Range: 1 to 14 <br/> */
uint8_t gloFrequency;
/** SV polynomial action type, update or invalidate. <br/> */
GnssSvPolyActionType actionType;
/** SV polynomial report status. <br/> */
GnssSvPolyStatusMask statusMask;
/** Reference time for polynomial calculations. <br/>
* - GPS, QZSS: Seconds in the week <br/>
* - GLONASS: Full seconds since Jan. 1, 1996 <br/>
* - BDS: Full seconds since Jan. 1, 2006 <br/>
* - Galileo: Calculated from 00:00 UT on Sunday, August 22,
* 1999 (midnight between August 21 and August 22) <br/>
*/
double T0;
/** Polynomial Coefficient's 0th Term for X, Y, and Z
* Coordinates (C0X, C0Y, C0Z). <br/>
* If this field is indicated as valid via validityMask, then
* every element in the array is valid. <br/> */
double polyCofXYZ0[GNSS_SV_POLY_XYZ_0_TH_ORDER_COF_SIZE];
/** Polynomial coefficient's 1st, 2nd, and 3rd terms for X, Y
* and Z coordinates (C1X, C2X,... C2Z, C3Z). <br/>
* If this field is indicated as valid via validityMask, then
* every element in the array is valid. <br/>
* Units are specified as below: <br/>
* - 1st term -- Meters/second <br/>
* - 2nd term -- Meters/second^2 <br/>
* - 3rd term -- Meters/seconds^3 <br/> */
double polyCofXYZN[GNSS_SV_POLY_XYZ_N_TH_ORDER_COF_SIZE];
/** Polynomial coefficients for satellite clock bias
* correction (C0T, C1T, C2T, C3T). <br/>
* If this field is indicated as valid via validityMask, then
* every element in the array is valid. <br/>
* Units are specified below <br/>
* - 0th term -- Milliseconds/second <br/>
* - 1st term -- Milliseconds/second^2 <br/>
* - 2nd term -- Milliseconds/second^3 <br/>
* - 3rd term -- Milliseconds/second^4 <br/> */
float polyCofClockBias[GNSS_SV_POLY_SV_CLKBIAS_COF_SIZE];
/** Ephemeris reference time. <br/>
* - GPS -- Issue of data ephemeris used (unitless) <br/>
* - GLONASS -- Tb 7-bit <br/>
* - Galileo -- 10-bit <br/> */
uint16_t iode;
/** Enhanced Reference Time, for BDS ephemeris, this is TOE.
* <br/> */
uint32_t enhancedIOD;
/** SV Position Uncertainty, in unit of meters. <br/> */
float svPosUnc;
/** Ionospheric delay at T0, in unit of meters. <br/> */
float ionoDelay;
/** Ionospheric delay rate, in unit of Meters/second. <br/>
*/
float ionoDot;
/** SBAS ionospheric delay at T0, in unit of Meters. <br/>
*/
float sbasIonoDelay;
/** SBAS ionospheric delay rate, in unit of Meters/second. <br/>
*/
float sbasIonoDot;
/** Tropospheric delay, in unit of Meters. <br/>
*/
float tropoDelay;
/** Satellite elevation at T0, in unit of Radians. <br/>
*/
float elevation;
/** Satellite elevation rate, in unit of Radians/second. <br/>
*/
float elevationDot;
/** SV elevation uncertainty, in unit of Radians. <br/>
*/
float elevationUnc;
/** Polynomial coefficients for SV velocity (C0X, C1X, C2X,
* C3X,... C2Z, C3Z). <br/>
* If this field is indicated as valid via validityMask, then
* every element in the array is valid. <br/>
* Units: <br/>
* - 0th term -- Meters/second <br/>
* - 1st term -- Meters/second^2 <br/>
* - 2nd term -- Meters/second^3 <br/>
* - 3rd term -- Meters/second^4 <br/> */
double velCof[GNSS_SV_POLY_VELOCITY_COF_SIZE];
/** Inter-signal correction - GPS/QZSS L1C/A, in unit of
* milliseconds. <br/>
*/
float gpsIscL1ca;
/** Inter-signal correction - GPS/QZSS L2C, in unit of
* milliseconds. <br/>
*/
float gpsIscL2c;
/** Inter-signal correction - GPS/QZSS L5I5, in unit of
* milliseconds. <br/>
*/
float gpsIscL5I5;
/** Inter-signal correction - GPS/QZSS L5Q5, in unit of
* milliseconds. <br/>
*/
float gpsIscL5Q5;
/** Time of group delay - GPS/QZSS, 13 bits from CNAV, 8 bits
* from LNAV, in unit of milliseconds. <br/>
*/
float gpsTgd;
/** Time of group delay - GLONASS G1-G2, in unit of
* milliseconds. <br/>
*/
float gloTgdG1G2;
/** Time of group delay - BDS B1, in unit of
* milliseconds. <br/>
*/
float bdsTgdB1;
/** Time of group delay - BDS B2, in unit of
* milliseconds. <br/>
*/
float bdsTgdB2;
/** Time of group delay - BDS B2A, in unit of milliseconds.
* <br/>
*/
float bdsTgdB2a;
/** Inter-signal correction - BDS B2A, in unit of milliseconds.
* <br/>
*/
float bdsIscB2a;
/** Broadcast group delay - Galileo E1-E5a, in unit of
* milliseconds. <br/>
*/
float galBgdE1E5a;
/** Broadcast group delay - Galileo E1-E5b, in unit of
* milliseconds. <br/>
*/
float galBgdE1E5b;
/** Time of group delay - NavIC L5, in unit of
* milliseconds. <br/>
*/
float navicTgdL5;
};
enum BatchingStatus {
BATCHING_STATUS_INACTIVE = 0,
BATCHING_STATUS_ACTIVE = 1,
@ -1528,6 +1823,16 @@ typedef std::function<void(
const GnssMeasurements& gnssMeasurements
)> GnssMeasurementsCb;
/** @brief
GnssSvPolyCb is for receiving SV polynomial information
when LocationClientApi is in a positioning session. <br/>
@param gnssSvPoly: SV polynomial info in a session
*/
typedef std::function<void(
const GnssSvPoly& gnssSvPoly
)> GnssSvPolyCb;
/** @brief
LocationSystemInfoCb is for receiving rare occuring location
system information update as defined in
@ -1627,6 +1932,9 @@ struct EngineReportCbs {
/** Callback to receive GnssMeasurements from modem GNSS engine.
* <br/> */
GnssMeasurementsCb gnssMeasurementsCallback;
/** Callback to receive GnssSvPoly from modem GNSS engine.
* <br/> */
GnssSvPolyCb gnssSvPolyCallback;
};
/**

3
client_api/src/LocationClientApi.cpp

@ -202,6 +202,9 @@ bool LocationClientApi::startPositionSession(
if (engReportCallbacks.gnssMeasurementsCallback) {
callbacksOption.gnssMeasurementsCb = [](::GnssMeasurementsNotification n) {};
}
if (engReportCallbacks.gnssSvPolyCallback) {
callbacksOption.gnssSvPolynomialCb = [](::GnssSvPolynomial n) {};
}
mApiImpl->updateCallbacks(callbacksOption);
// options

265
client_api/src/LocationClientApiImpl.cpp

@ -891,6 +891,224 @@ static LocationSystemInfo parseLocationSystemInfo(
return systemInfo;
}
// Parse SV polynomial info.
static GnssSvPoly parseGnssSvPolynomial(const ::GnssSvPolynomial
&halGnssSvPoly) {
GnssSvPoly gnssSvPoly = {};
uint32_t validFlags = 0;
gnssSvPoly.svId = halGnssSvPoly.gnssSvId;
validFlags |= GNSS_SV_POLY_HAS_SV_ID;
if (gnssSvPoly.svId >= GPS_SV_PRN_MIN && gnssSvPoly.svId <= GPS_SV_PRN_MAX) {
gnssSvPoly.svConstellation = GNSS_LOC_SV_SYSTEM_GPS;
} else if (gnssSvPoly.svId >= GLO_SV_PRN_MIN && gnssSvPoly.svId <= GLO_SV_PRN_MAX) {
gnssSvPoly.svConstellation = GNSS_LOC_SV_SYSTEM_GLONASS;
} else if (gnssSvPoly.svId >= SBAS_SV_PRN_MIN && gnssSvPoly.svId <= SBAS_SV_PRN_MAX) {
gnssSvPoly.svConstellation = GNSS_LOC_SV_SYSTEM_SBAS;
} else if (gnssSvPoly.svId >= QZSS_SV_PRN_MIN && gnssSvPoly.svId <= QZSS_SV_PRN_MAX) {
gnssSvPoly.svConstellation = GNSS_LOC_SV_SYSTEM_QZSS;
} else if (gnssSvPoly.svId >= BDS_SV_PRN_MIN && gnssSvPoly.svId <= BDS_SV_PRN_MAX) {
gnssSvPoly.svConstellation = GNSS_LOC_SV_SYSTEM_BDS;
} else if (gnssSvPoly.svId >= GAL_SV_PRN_MIN && gnssSvPoly.svId <= GAL_SV_PRN_MAX) {
gnssSvPoly.svConstellation = GNSS_LOC_SV_SYSTEM_GALILEO;
}
if (gnssSvPoly.svConstellation != 0) {
validFlags |= GNSS_SV_POLY_HAS_SV_CONSTELLATION;
}
if ((halGnssSvPoly.is_valid & ULP_GNSS_SV_POLY_BIT_GLO_FREQ) &&
(gnssSvPoly.svConstellation == GNSS_LOC_SV_SYSTEM_GLONASS)) {
gnssSvPoly.gloFrequency = halGnssSvPoly.freqNum;
validFlags |= GNSS_SV_POLY_HAS_GLO_FREQUENCY;
}
uint32_t actionType = GNSS_SV_POLY_ACTION_UPDATE;
if (halGnssSvPoly.is_valid & ULP_GNSS_SV_POLY_BIT_FLAG) {
if ((halGnssSvPoly.svPolyStatusMaskValidity & GNSS_SV_POLY_DELETE_VALID_V02) &&
(halGnssSvPoly.svPolyStatusMask & GNSS_SV_POLY_DELETE_V02)) {
actionType = GNSS_SV_POLY_ACTION_INVALIDATE;
}
}
gnssSvPoly.actionType = (GnssSvPolyActionType) actionType;
validFlags |= GNSS_SV_POLY_HAS_ACTION_TYPE;
if (halGnssSvPoly.is_valid & ULP_GNSS_SV_POLY_BIT_FLAG) {
uint32_t statusMask = 0;
if ((halGnssSvPoly.svPolyStatusMaskValidity & GNSS_SV_POLY_SRC_ALM_CORR_VALID_V02) &&
(halGnssSvPoly.svPolyStatusMask & GNSS_SV_POLY_SRC_ALM_CORR_V02)) {
statusMask |= GNSS_SV_POLY_STATUS_SRC_ALM_CORR;
}
if ((halGnssSvPoly.svPolyStatusMaskValidity & GNSS_SV_POLY_GLO_STR4_VALID_V02) &&
(halGnssSvPoly.svPolyStatusMask & GNSS_SV_POLY_GLO_STR4_V02)) {
statusMask |= GNSS_SV_POLY_STATUS_GLO_STR4;
}
if (halGnssSvPoly.svPolyStatusMaskValidity &
GNSS_SV_POLY_SRC_GAL_FNAV_OR_INAV_VALID_V02) {
if (halGnssSvPoly.svPolyStatusMask & GNSS_SV_POLY_SRC_GAL_FNAV_OR_INAV_V02) {
statusMask |= GNSS_SV_POLY_STATUS_GAL_FNAV;
} else {
statusMask |= GNSS_SV_POLY_STATUS_GAL_INAV;
}
}
gnssSvPoly.statusMask = (GnssSvPolyStatusMask) statusMask;
validFlags |= GNSS_SV_POLY_HAS_STATUS_MASK;
}
if (gnssSvPoly.actionType == GNSS_SV_POLY_ACTION_UPDATE) {
gnssSvPoly.T0 = halGnssSvPoly.T0;
validFlags |= GNSS_SV_POLY_HAS_T0;
uint32_t index = 0;
if (halGnssSvPoly.is_valid & ULP_GNSS_SV_POLY_BIT_POLYCOEFF_XYZ0) {
if (GNSS_SV_POLY_XYZ_0_TH_ORDER_COF_SIZE ==
GNSS_SV_POLY_XYZ_0_TH_ORDER_COEFF_MAX_SIZE) {
for (index = 0; index < GNSS_SV_POLY_XYZ_0_TH_ORDER_COF_SIZE; index++) {
gnssSvPoly.polyCofXYZ0[index] = halGnssSvPoly.polyCoeffXYZ0[index];
}
validFlags |= GNSS_SV_POLY_HAS_POLY_COF_XYZ0;
} else {
LOC_LOGe("array size for polyCofXYZ0 not match");
}
}
if (halGnssSvPoly.is_valid & ULP_GNSS_SV_POLY_BIT_POLYCOEFF_XYZN) {
if (GNSS_SV_POLY_XYZ_N_TH_ORDER_COF_SIZE ==
GNSS_SV_POLY_XYZ_N_TH_ORDER_COEFF_MAX_SIZE) {
for (index = 0; index < GNSS_SV_POLY_XYZ_N_TH_ORDER_COF_SIZE; index++) {
gnssSvPoly.polyCofXYZN[index] = halGnssSvPoly.polyCoefXYZN[index];
}
validFlags |= GNSS_SV_POLY_HAS_POLY_COF_XYZN;
} else {
LOC_LOGe("array size for polyCofXYZN not match");
}
}
if (halGnssSvPoly.is_valid & ULP_GNSS_SV_POLY_BIT_POLYCOEFF_OTHER) {
if (GNSS_SV_POLY_SV_CLKBIAS_COF_SIZE ==
GNSS_SV_POLY_SV_CLKBIAS_COEFF_MAX_SIZE) {
for (index = 0; index < GNSS_SV_POLY_SV_CLKBIAS_COF_SIZE; index++) {
gnssSvPoly.polyCofClockBias[index] = halGnssSvPoly.polyCoefOther[index];
}
validFlags |= GNSS_SV_POLY_HAS_POLY_COF_CLK_BIAS;
} else {
LOC_LOGe("array size for polyCofClockBias not match");
}
}
if (halGnssSvPoly.is_valid & ULP_GNSS_SV_POLY_BIT_IODE) {
gnssSvPoly.iode = halGnssSvPoly.iode;
validFlags |= GNSS_SV_POLY_HAS_IODE;
}
if (halGnssSvPoly.is_valid & ULP_GNSS_SV_POLY_BIT_ENHANCED_IOD) {
gnssSvPoly.enhancedIOD = halGnssSvPoly.enhancedIOD;
validFlags |= GNSS_SV_POLY_HAS_ENHANCED_IOD;
}
if (halGnssSvPoly.is_valid & ULP_GNSS_SV_POLY_BIT_SV_POSUNC) {
gnssSvPoly.svPosUnc = halGnssSvPoly.svPosUnc;
validFlags |= GNSS_SV_POLY_HAS_SV_POS_UNC;
}
if (halGnssSvPoly.is_valid & ULP_GNSS_SV_POLY_BIT_IONODELAY) {
gnssSvPoly.ionoDelay = halGnssSvPoly.ionoDelay;
validFlags |= GNSS_SV_POLY_HAS_IONO_DELAY;
}
if (halGnssSvPoly.is_valid & ULP_GNSS_SV_POLY_BIT_IONODOT) {
gnssSvPoly.ionoDot = halGnssSvPoly.ionoDot;
validFlags |= GNSS_SV_POLY_HAS_IONO_DOT;
}
if (halGnssSvPoly.is_valid & ULP_GNSS_SV_POLY_BIT_SBAS_IONODELAY) {
gnssSvPoly.sbasIonoDelay = halGnssSvPoly.sbasIonoDelay;
validFlags |= GNSS_SV_POLY_HAS_SBAS_IONO_DELAY;
}
if (halGnssSvPoly.is_valid & ULP_GNSS_SV_POLY_BIT_SBAS_IONODOT) {
gnssSvPoly.sbasIonoDot = halGnssSvPoly.sbasIonoDot;
validFlags |= GNSS_SV_POLY_HAS_SBAS_IONO_DOT;
}
if (halGnssSvPoly.is_valid & ULP_GNSS_SV_POLY_BIT_TROPODELAY) {
gnssSvPoly.tropoDelay = halGnssSvPoly.tropoDelay;
validFlags |= GNSS_SV_POLY_HAS_TROPO_DELAY;
}
if (halGnssSvPoly.is_valid & ULP_GNSS_SV_POLY_BIT_ELEVATION) {
gnssSvPoly.elevation = halGnssSvPoly.elevation;
validFlags |= GNSS_SV_POLY_HAS_ELEVATION;
}
if (halGnssSvPoly.is_valid & ULP_GNSS_SV_POLY_BIT_ELEVATIONDOT) {
gnssSvPoly.elevationDot = halGnssSvPoly.elevationDot;
validFlags |= GNSS_SV_POLY_HAS_ELEVATION_DOT;
}
if (halGnssSvPoly.is_valid & ULP_GNSS_SV_POLY_BIT_ELEVATIONUNC) {
gnssSvPoly.elevationUnc = halGnssSvPoly.elevationUnc;
validFlags |= GNSS_SV_POLY_HAS_ELEVATION_UNC;
}
if (halGnssSvPoly.is_valid & ULP_GNSS_SV_POLY_BIT_VELO_COEFF) {
if (GNSS_SV_POLY_VELOCITY_COF_SIZE ==
GNSS_SV_POLY_VELOCITY_COEF_MAX_SIZE) {
for (index = 0; index < GNSS_SV_POLY_VELOCITY_COF_SIZE; index++) {
gnssSvPoly.velCof[index] = halGnssSvPoly.velCoef[index];
}
validFlags |= GNSS_SV_POLY_HAS_VEL_COF;
} else {
LOC_LOGe("array size for velCof not match");
}
}
if (halGnssSvPoly.is_valid & ULP_GNSS_SV_POLY_BIT_GPS_ISC_L1CA) {
gnssSvPoly.gpsIscL1ca = halGnssSvPoly.gpsIscL1ca;
validFlags |= GNSS_SV_POLY_HAS_GPS_ISC_L1CA;
}
if (halGnssSvPoly.is_valid & ULP_GNSS_SV_POLY_BIT_GPS_ISC_L2C) {
gnssSvPoly.gpsIscL2c = halGnssSvPoly.gpsIscL2c;
validFlags |= GNSS_SV_POLY_HAS_GPS_ISC_L2C;
}
if (halGnssSvPoly.is_valid & ULP_GNSS_SV_POLY_BIT_GPS_ISC_L5I5) {
gnssSvPoly.gpsIscL5I5 = halGnssSvPoly.gpsIscL5I5;
validFlags |= GNSS_SV_POLY_HAS_GPS_ISC_L5I5;
}
if (halGnssSvPoly.is_valid & ULP_GNSS_SV_POLY_BIT_GPS_ISC_L5Q5) {
gnssSvPoly.gpsIscL5Q5 = halGnssSvPoly.gpsIscL5Q5;
validFlags |= GNSS_SV_POLY_HAS_GPS_ISC_L5Q5;
}
if (halGnssSvPoly.is_valid & ULP_GNSS_SV_POLY_BIT_GPS_TGD) {
gnssSvPoly.gpsTgd = halGnssSvPoly.gpsTgd;
validFlags |= GNSS_SV_POLY_HAS_GPS_TGD;
}
if (halGnssSvPoly.is_valid & ULP_GNSS_SV_POLY_BIT_GLO_TGD_G1G2) {
gnssSvPoly.gloTgdG1G2 = halGnssSvPoly.gloTgdG1G2;
validFlags |= GNSS_SV_POLY_HAS_GLO_TGD_G1G2;
}
if (halGnssSvPoly.is_valid & ULP_GNSS_SV_POLY_BIT_BDS_TGD_B1) {
gnssSvPoly.bdsTgdB1 = halGnssSvPoly.bdsTgdB1;
validFlags |= GNSS_SV_POLY_HAS_BDS_TGD_B1;
}
if (halGnssSvPoly.is_valid & ULP_GNSS_SV_POLY_BIT_BDS_TGD_B2) {
gnssSvPoly.bdsTgdB2= halGnssSvPoly.bdsTgdB2;
validFlags |= GNSS_SV_POLY_HAS_BDS_TGD_B2;
}
if (halGnssSvPoly.is_valid & ULP_GNSS_SV_POLY_BIT_BDS_TGD_B2A) {
gnssSvPoly.bdsTgdB2a = halGnssSvPoly.bdsTgdB2a;
validFlags |= GNSS_SV_POLY_HAS_BDS_TGD_B2A;
}
if (halGnssSvPoly.is_valid & ULP_GNSS_SV_POLY_BIT_BDS_ISC_B2A) {
gnssSvPoly.bdsIscB2a = halGnssSvPoly.bdsIscB2a;
validFlags |= GNSS_SV_POLY_HAS_BDS_ISC_B2A;
}
if (halGnssSvPoly.is_valid & ULP_GNSS_SV_POLY_BIT_GAL_BGD_E1E5A) {
gnssSvPoly.galBgdE1E5a = halGnssSvPoly.galBgdE1E5a;
validFlags |= GNSS_SV_POLY_HAS_GAL_BGD_E1E5A;
}
if (halGnssSvPoly.is_valid & ULP_GNSS_SV_POLY_BIT_GAL_BGD_E1E5B) {
gnssSvPoly.galBgdE1E5b = halGnssSvPoly.galBgdE1E5b;
validFlags |= GNSS_SV_POLY_HAS_GAL_BGD_E1E5B;
}
if (halGnssSvPoly.is_valid & ULP_GNSS_SV_POLY_BIT_NAVIC_TGD_L5) {
gnssSvPoly.navicTgdL5 = halGnssSvPoly.navicTgdL5;
validFlags |= GNSS_SV_POLY_HAS_NAVIC_TDG_L5;
}
}
gnssSvPoly.validityMask = (GnssSvPolyValidityMask)validFlags;
return gnssSvPoly;
}
/******************************************************************************
ILocIpcListener override
******************************************************************************/
@ -932,6 +1150,7 @@ LocationClientApiImpl::LocationClientApiImpl(CapabilitiesCb capabitiescb) :
mGnssNmeaCb(nullptr),
mGnssDataCb(nullptr),
mGnssMeasurementsCb(nullptr),
mGnssSvPolyCb(nullptr),
mGnssEnergyConsumedInfoCb(nullptr),
mGnssEnergyConsumedResponseCb(nullptr),
mLocationSysInfoCb(nullptr),
@ -1082,6 +1301,7 @@ void LocationClientApiImpl::updateCallbackFunctions(const ClientCallbacks& cbs,
mApiImpl->mGnssNmeaCb = mCbs.engreportcbs.gnssNmeaCallback;
mApiImpl->mGnssDataCb = mCbs.engreportcbs.gnssDataCallback;
mApiImpl->mGnssMeasurementsCb = mCbs.engreportcbs.gnssMeasurementsCallback;
mApiImpl->mGnssSvPolyCb = mCbs.engreportcbs.gnssSvPolyCallback;
}
}
LocationClientApiImpl* mApiImpl;
@ -1126,6 +1346,10 @@ void LocationClientApiImpl::updateCallbacks(LocationCallbacks& callbacks) {
if (mCallBacks.gnssMeasurementsCb) {
callBacksMask |= E_LOC_CB_GNSS_MEAS_BIT;
}
if (mCallBacks.gnssSvPolynomialCb) {
callBacksMask |= E_LOC_CB_GNSS_SV_POLY_BIT;
}
// handle callbacks that are not related to a fix session
if (mApiImpl->mLocationSysInfoCb) {
callBacksMask |= E_LOC_CB_SYSTEM_INFO_BIT;
@ -2224,6 +2448,47 @@ void IpcListener::onReceive(const char* data, uint32_t length,
break;
}
case E_LOCAPI_SV_POLY_MSG_ID:
{
LOC_LOGd("<<< message = SV poly");
if (sizeof(LocAPIGnssSvPolyIndMsg) != mMsgData.length()) {
LOC_LOGw("payload size does not match for message with id: %d",
pMsg->msgId);
}
if ((mApiImpl.mSessionId != LOCATION_CLIENT_SESSION_ID_INVALID) &&
(mApiImpl.mCallbacksMask & E_LOC_CB_GNSS_SV_POLY_BIT)) {
const LocAPIGnssSvPolyIndMsg* pSvPolyIndMsg =
(LocAPIGnssSvPolyIndMsg*)(pMsg);
GnssSvPoly gnssSvPoly =
parseGnssSvPolynomial (pSvPolyIndMsg->gnssSvPolynomial);
if (mApiImpl.mGnssSvPolyCb ) {
mApiImpl.mGnssSvPolyCb(gnssSvPoly);
}
#ifndef FEATURE_EXTERNAL_AP
if (!mDiagInterface) {
break;
}
diagBuffSrc bufferSrc = BUFFER_INVALID;
clientDiagGnssSvPoly *diagGnssSvPolyPtr =
(clientDiagGnssSvPoly*)mDiagInterface->logAlloc(
LOG_GNSS_CLIENT_API_SV_POLY_REPORT_C,
sizeof(clientDiagGnssSvPoly), &bufferSrc);
if (NULL == diagGnssSvPolyPtr) {
LOC_LOGv("memory alloc failed");
break;
}
populateClientDiagSvPoly(diagGnssSvPolyPtr, gnssSvPoly);
diagGnssSvPolyPtr->version = LOG_CLIENT_SV_POLY_DIAG_MSG_VERSION ;
mDiagInterface->logCommit(diagGnssSvPolyPtr, bufferSrc,
LOG_GNSS_CLIENT_API_SV_POLY_REPORT_C,
sizeof(clientDiagGnssSvPoly));
#endif // FEATURE_EXTERNAL_AP
}
break;
}
case E_LOCAPI_GET_GNSS_ENGERY_CONSUMED_MSG_ID:
{
LOC_LOGd("<<< message = GNSS power consumption\n");

3
client_api/src/LocationClientApiImpl.h

@ -77,6 +77,8 @@ void populateClientDiagGnssSv(clientDiagGnssSvStructType* diagGnssSvPtr,
std::vector<GnssSv>& gnssSvs);
void populateClientDiagNmea(clientDiagGnssNmeaStructType *diagGnssNmeaPtr,
const LocAPINmeaSerializedPayload &nmeaSerializedPayload);
void populateClientDiagSvPoly(clientDiagGnssSvPoly *diagGnssSvPolyPtr,
const GnssSvPoly &gnssSvPoly);
#endif // FEATURE_EXTERNAL_AP
enum ReportCbEnumType {
@ -240,6 +242,7 @@ private:
GnssNmeaCb mGnssNmeaCb;
GnssDataCb mGnssDataCb;
GnssMeasurementsCb mGnssMeasurementsCb;
GnssSvPolyCb mGnssSvPolyCb;
GnssEnergyConsumedCb mGnssEnergyConsumedInfoCb;
ResponseCb mGnssEnergyConsumedResponseCb;

308
client_api/src/LocationClientApiLog.h

@ -43,7 +43,7 @@
#define LOG_CLIENT_SV_REPORT_DIAG_MSG_VERSION (2)
#define LOG_CLIENT_NMEA_REPORT_DIAG_MSG_VERSION (1)
#define LOG_CLIENT_MEASUREMENTS_DIAG_MSG_VERSION (1)
#define LOG_CLIENT_SV_POLY_DIAG_MSG_VERSION (1)
#ifndef LOG_GNSS_CLIENT_API_NMEA_REPORT_C
#define LOG_GNSS_CLIENT_API_NMEA_REPORT_C (0x1CB2)
@ -53,6 +53,10 @@
#define LOG_GNSS_CLIENT_API_MEASUREMENTS_REPORT_C (0x1CB7)
#endif
#ifndef LOG_GNSS_CLIENT_API_SV_POLY_REPORT_C
#define LOG_GNSS_CLIENT_API_SV_POLY_REPORT_C (0x1CC7)
#endif
namespace location_client
{
@ -772,5 +776,307 @@ typedef PACKED struct PACKED_POST {
uint8_t nmea[1];
} clientDiagGnssNmeaStructType;
/** Specify the valid fields in clientDiagGnssSvPoly. <br/> */
enum clientDiagGnssSvPolyValidityMask {
/** clientDiagGnssSvPoly has valid clientDiagGnssSvPoly::svId. <br/>
* This flag should always be set. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_HAS_SV_ID = 0x0000000001,
/** clientDiagGnssSvPoly has valid clientDiagGnssSvPoly::svConstellation. <br/>
* This flag should always be set. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_HAS_SV_CONSTELLATION = 0x0000000002,
/** clientDiagGnssSvPoly has valid clientDiagGnssSvPoly::gloFrequency. <br/>
* This flag should be set only if this is Glonass SV. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_HAS_GLO_FREQUENCY = 0x0000000004,
/** clientDiagGnssSvPoly has valid clientDiagGnssSvPoly::actionType. <br/>
* This flag should always be set. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_HAS_ACTION_TYPE = 0x0000000008,
/** clientDiagGnssSvPoly has valid clientDiagGnssSvPoly::statusMask. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_HAS_STATUS_MASK = 0x0000000010,
/** clientDiagGnssSvPoly has valid clientDiagGnssSvPoly::T0. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_HAS_T0 = 0x0000000020,
/** clientDiagGnssSvPoly has valid clientDiagGnssSvPoly::polyCofXYZ0. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_HAS_POLY_COF_XYZ0 = 0x0000000040,
/** clientDiagGnssSvPoly has valid clientDiagGnssSvPoly::polyCofXYZN. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_HAS_POLY_COF_XYZN = 0x0000000080,
/** clientDiagGnssSvPoly has valid clientDiagGnssSvPoly::polyCofClockBias. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_HAS_POLY_COF_CLK_BIAS = 0x0000000100,
/** clientDiagGnssSvPoly has valid clientDiagGnssSvPoly::iode. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_HAS_IODE = 0x0000000200,
/** clientDiagGnssSvPoly has valid clientDiagGnssSvPoly::enhancedIOD. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_HAS_ENHANCED_IOD = 0x0000000400,
/** clientDiagGnssSvPoly has valid clientDiagGnssSvPoly::svPosUnc. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_HAS_SV_POS_UNC = 0x0000000800,
/** clientDiagGnssSvPoly has valid clientDiagGnssSvPoly::ionoDelay. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_HAS_IONO_DELAY = 0x0000001000,
/** clientDiagGnssSvPoly has valid clientDiagGnssSvPoly::ionoDot. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_HAS_IONO_DOT = 0x0000002000,
/** clientDiagGnssSvPoly has valid clientDiagGnssSvPoly::sbasIonoDelay. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_HAS_SBAS_IONO_DELAY = 0x0000004000,
/** clientDiagGnssSvPoly has valid clientDiagGnssSvPoly::sbasIonoDot. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_HAS_SBAS_IONO_DOT = 0x0000008000,
/** clientDiagGnssSvPoly has valid clientDiagGnssSvPoly::tropoDelay. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_HAS_TROPO_DELAY = 0x0000010000,
/** clientDiagGnssSvPoly has valid clientDiagGnssSvPoly::elevation. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_HAS_ELEVATION = 0x0000020000,
/** clientDiagGnssSvPoly has valid clientDiagGnssSvPoly::elevationDot. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_HAS_ELEVATION_DOT = 0x0000040000,
/** clientDiagGnssSvPoly has valid clientDiagGnssSvPoly::elevationUnc. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_HAS_ELEVATION_UNC = 0x0000080000,
/** clientDiagGnssSvPoly has valid clientDiagGnssSvPoly::velCof. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_HAS_VEL_COF = 0x0000100000,
/** clientDiagGnssSvPoly has valid clientDiagGnssSvPoly::gpsIscL1ca. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_HAS_GPS_ISC_L1CA = 0x0000200000,
/** clientDiagGnssSvPoly has valid clientDiagGnssSvPoly::gpsIscL2c. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_HAS_GPS_ISC_L2C = 0x0000400000,
/** clientDiagGnssSvPoly has valid clientDiagGnssSvPoly::gpsIscL5I5. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_HAS_GPS_ISC_L5I5 = 0x0000800000,
/** clientDiagGnssSvPoly has valid clientDiagGnssSvPoly::gpsIscL5Q5. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_HAS_GPS_ISC_L5Q5 = 0x0001000000,
/** clientDiagGnssSvPoly has valid clientDiagGnssSvPoly::gpsTgd. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_HAS_GPS_TGD = 0x0002000000,
/** clientDiagGnssSvPoly has valid clientDiagGnssSvPoly::gloTgdG1G2. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_HAS_GLO_TGD_G1G2 = 0x0004000000,
/** clientDiagGnssSvPoly has valid clientDiagGnssSvPoly::bdsTgdB1. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_HAS_BDS_TGD_B1 = 0x00080000000,
/** clientDiagGnssSvPoly has valid clientDiagGnssSvPoly::bdsTgdB2. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_HAS_BDS_TGD_B2 = 0x00100000000,
/** clientDiagGnssSvPoly has valid clientDiagGnssSvPoly::bdsTgdB2a. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_HAS_BDS_TGD_B2A = 0x00200000000,
/** clientDiagGnssSvPoly has valid clientDiagGnssSvPoly::bdsIscB2a. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_HAS_BDS_ISC_B2A = 0x00400000000,
/** clientDiagGnssSvPoly has valid clientDiagGnssSvPoly::galBgdE1E5a. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_HAS_GAL_BGD_E1E5A = 0x00800000000,
/** clientDiagGnssSvPoly has valid clientDiagGnssSvPoly::galBgdE1E5b. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_HAS_GAL_BGD_E1E5B = 0x01000000000,
/** clientDiagGnssSvPoly has valid clientDiagGnssSvPoly::navicTgdL5. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_HAS_NAVIC_TDG_L5 = 0x02000000000,
};
/** SV Polynomial Report Status. <br/> */
enum clientDiagGnssSvPolyStatusMask {
/** Polynomials based on XTRA. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_STATUS_SRC_ALM_CORR = 0x01,
/** GLONASS string 4 has been received. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_STATUS_GLO_STR4 = 0x2,
/** GALILEO polynomial computed from I/Nav navigation
* message. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_STATUS_GAL_FNAV = 0x04,
/** GALILEO polynomial computed from F/Nav navigation message.
* <br/> */
CLIENT_DIAG_GNSS_SV_POLY_STATUS_GAL_INAV = 0x08,
};
/** Action to be performed for the received polynomial for this
* satellite. <br/> */
enum clientDiagGnssSvPolyActionType {
/** Update Polynomial for this satellite. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_ACTION_UPDATE = 1,
/** Invalidate any previously received polynomial. <br/> */
CLIENT_DIAG_GNSS_SV_POLY_ACTION_INVALIDATE = 2,
};
/** Const define for the array size of clientDiagGnssSvPoly::velCoef.
* <br/> */
#define CLIENT_DIAG_GNSS_SV_POLY_VELOCITY_COF_SIZE 12
/** Const define for the array size of
* clientDiagGnssSvPoly::polyCofXYZ0. <br/> */
#define CLIENT_DIAG_GNSS_SV_POLY_XYZ_0_TH_ORDER_COF_SIZE 3
/** Const define for the array size of
* clientDiagGnssSvPoly::polyCofXYZN. <br/> */
#define CLIENT_DIAG_GNSS_SV_POLY_XYZ_N_TH_ORDER_COF_SIZE 9
/** Const define for the array size of
* clientDiagGnssSvPoly::polyCofClockBias. <br/> */
#define CLIENT_DIAG_GNSS_SV_POLY_SV_CLKBIAS_COF_SIZE 4
typedef PACKED struct PACKED_POST {
/** Used by Logging Module
* Mandatory field */
log_hdr_type logHeader;
/** clientDiag Message Version
* Mandatory field */
uint8 version;
/** Bitwise OR of clientDiagGnssSvPolyValidityMask to specify the
* valid fields in clientDiagGnssSvPoly. <br/> */
clientDiagGnssSvPolyValidityMask validityMask;
/** Specify satellite vehicle ID number. <br/> For SV id range
* of each supported constellations, refer to documentation in
* GnssSv::svId. <br/>
*/
uint16_t svId;
/** Specify GNSS Constellation Type for the SV. */
clientDiagGnss_LocSvSystemEnumType svConstellation;
/** GLONASS frequency number + 8. Valid only for GLONASS
* systems and must be ignored for all other systems. <br/>
* Range: 1 to 14 <br/> */
uint8_t gloFrequency;
/** SV polynomial action type, update or invalidate. <br/> */
clientDiagGnssSvPolyActionType actionType;
/** SV Polynomial Report Status. <br/> */
clientDiagGnssSvPolyStatusMask statusMask;
/** Reference time for polynomial calculations. <br/>
* - GPS, QZSS: Seconds in the week <br/>
* - GLONASS: Full seconds since Jan. 1, 1996 <br/>
* - BDS: Full seconds since Jan. 1, 2006 <br/>
* - Galileo: Calculated from 00:00 UT on Sunday, August 22,
* 1999 (midnight between August 21 and August 22) <br/>
*/
double T0;
/** Polynomial Coefficient's 0th Term for X, Y, and Z
* Coordinates (C0X, C0Y, C0Z). <br/>
* If this field is indicated as valid via validityMask, then
* every element is valid. <br/> */
double polyCofXYZ0[CLIENT_DIAG_GNSS_SV_POLY_XYZ_0_TH_ORDER_COF_SIZE];
/** Polynomial coefficient's 1st, 2nd, and 3rd terms for X, Y
* and Z coordinates (C1X, C2X,... C2Z, C3Z). <br/>
* If this field is indicated as valid via validityMask, then
* every element is valid. <br/>
* Units are specified as below: <br/>
* - 1st term -- Meters/second <br/>
* - 2nd term -- Meters/second^2 <br/>
* - 3rd term -- Meters/seconds^3 <br/> */
double polyCofXYZN[CLIENT_DIAG_GNSS_SV_POLY_XYZ_N_TH_ORDER_COF_SIZE];
/** Polynomial coefficients for satellite clock bias
* correction (C0T, C1T, C2T, C3T). <br/> If this field is
* indicated as valid via validityMask, then every element is
* valid. <br/>
* Units are specified below <br/>
* - 0th term -- Milliseconds/second <br/>
* - 1st term -- Milliseconds/second^2 <br/>
* - 2nd term -- Milliseconds/second^3 <br/>
* - 3rd term -- Milliseconds/second^4 <br/> */
float polyCofClockBias[CLIENT_DIAG_GNSS_SV_POLY_SV_CLKBIAS_COF_SIZE];
/** Ephemeris reference time. <br/>
* - GPS -- Issue of data ephemeris used (unitless) <br/>
* - GLONASS -- Tb 7-bit <br/>
* - Galileo -- 10-bit <br/> */
uint16_t iode;
/** Enhanced Reference Time, for BDS ephemeris, this is TOE.
* <br/> */
uint32_t enhancedIOD;
/** SV Position Uncertainty, in unit of meters. <br/> */
float svPosUnc;
/** Ionospheric delay at T0, in unit of meters. <br/> */
float ionoDelay;
/** Ionospheric delay rate, in unit of Meters/second. <br/>
*/
float ionoDot;
/** SBAS ionospheric delay at T0, in unit of Meters. <br/>
*/
float sbasIonoDelay;
/** SBAS ionospheric delay rate, in unit of Meters/second. <br/>
*/
float sbasIonoDot;
/** Tropospheric delay, in unit of Meters. <br/>
*/
float tropoDelay;
/** Satellite elevation at T0, in unit of Radians. <br/>
*/
float elevation;
/** Satellite elevation rate, in unit of Radians/second. <br/>
*/
float elevationDot;
/** SV elevation uncertainty, in unit of Radians. <br/>
*/
float elevationUnc;
/** Polynomial coefficients for SV velocity (C0X, C1X, C2X,
* C3X,... C2Z, C3Z). <br/>
* If this field is indicated as valid via validityMask, then
* every element is valid. <br/>
* Units: <br/>
* - 0th term -- Meters/second <br/>
* - 1st term -- Meters/second^2 <br/>
* - 2nd term -- Meters/second^3 <br/>
* - 3rd term -- Meters/second^4 <br/> */
double velCof[CLIENT_DIAG_GNSS_SV_POLY_VELOCITY_COF_SIZE];
/** Inter-signal correction - GPS/QZSS L1C/A, in unit of
* milliseconds. <br/>
*/
float gpsIscL1ca;
/** Inter-signal correction - GPS/QZSS L2C, in unit of
* milliseconds. <br/>
*/
float gpsIscL2c;
/** Inter-signal correction - GPS/QZSS L5I5, in unit of
* milliseconds. <br/>
*/
float gpsIscL5I5;
/** Inter-signal correction - GPS/QZSS L5Q5, in unit of
* milliseconds. <br/>
*/
float gpsIscL5Q5;
/** Time of group delay - GPS/QZSS, 13 bits from CNAV, 8 bits
* from LNAV, in unit of milliseconds. <br/>
*/
float gpsTgd;
/** Time of group delay - GLONASS G1-G2, in unit of
* milliseconds. <br/>
*/
float gloTgdG1G2;
/** Time of group delay - BDS B1, in unit of
* milliseconds. <br/>
*/
float bdsTgdB1;
/** Time of group delay - BDS B2, in unit of
* milliseconds. <br/>
*/
float bdsTgdB2;
/** Time of group delay - BDS B2A, in unit of milliseconds.
* <br/>
*/
float bdsTgdB2a;
/** Inter-signal correction - BDS B2A, in unit of milliseconds.
* <br/>
*/
float bdsIscB2a;
/** Broadcast group delay - Galileo E1-E5a, in unit of
* milliseconds. <br/>
*/
float galBgdE1E5a;
/** Broadcast group delay - Galileo E1-E5b, in unit of
* milliseconds. <br/>
*/
float galBgdE1E5b;
/** Time of group delay - NavIC L5, in unit of
* milliseconds. <br/>
*/
float navicTgdL5;
} clientDiagGnssSvPoly;
}
#endif /*LOCATION_CLIENT_API_LOG_H */

79
client_api/src/LocationClientApiUtils.cpp

@ -442,4 +442,83 @@ void populateClientDiagNmea(clientDiagGnssNmeaStructType *diagGnssNmeaPtr,
memcpy(&diagGnssNmeaPtr->nmea, nmeaSerializedPayload.nmea, nmeaSerializedPayload.length);
}
void populateClientDiagSvPoly(clientDiagGnssSvPoly *diagGnssSvPolyPtr,
const GnssSvPoly &gnssSvPoly) {
diagGnssSvPolyPtr->validityMask =
(clientDiagGnssSvPolyValidityMask)gnssSvPoly.validityMask;
diagGnssSvPolyPtr->svId = gnssSvPoly.svId;
diagGnssSvPolyPtr->svConstellation =
(clientDiagGnss_LocSvSystemEnumType) gnssSvPoly.svConstellation;
diagGnssSvPolyPtr->gloFrequency = gnssSvPoly.gloFrequency;
diagGnssSvPolyPtr->actionType =
(clientDiagGnssSvPolyActionType) gnssSvPoly.actionType;
diagGnssSvPolyPtr->statusMask =
(clientDiagGnssSvPolyStatusMask) gnssSvPoly.statusMask;
diagGnssSvPolyPtr->T0 = gnssSvPoly.T0;
uint32_t index = 0;
if (GNSS_SV_POLY_XYZ_0_TH_ORDER_COF_SIZE ==
CLIENT_DIAG_GNSS_SV_POLY_XYZ_0_TH_ORDER_COF_SIZE) {
for (index = 0; index < GNSS_SV_POLY_XYZ_0_TH_ORDER_COF_SIZE; index++) {
diagGnssSvPolyPtr->polyCofXYZ0[index] = gnssSvPoly.polyCofXYZ0[index];
}
} else {
LOC_LOGe("array size for polyCofXYZ0 not match");
}
if (GNSS_SV_POLY_XYZ_N_TH_ORDER_COF_SIZE ==
CLIENT_DIAG_GNSS_SV_POLY_XYZ_N_TH_ORDER_COF_SIZE) {
for (index = 0; index < GNSS_SV_POLY_XYZ_N_TH_ORDER_COF_SIZE; index++) {
diagGnssSvPolyPtr->polyCofXYZN[index] = gnssSvPoly.polyCofXYZN[index];
}
} else {
LOC_LOGe("array size for polyCofXYZN not match");
}
if (GNSS_SV_POLY_SV_CLKBIAS_COF_SIZE ==
CLIENT_DIAG_GNSS_SV_POLY_SV_CLKBIAS_COF_SIZE) {
for (index = 0; index < GNSS_SV_POLY_SV_CLKBIAS_COF_SIZE; index++) {
diagGnssSvPolyPtr->polyCofClockBias[index] = gnssSvPoly.polyCofClockBias[index];
}
} else {
LOC_LOGe("array size for polyCofClockBias not match");
}
diagGnssSvPolyPtr->iode = gnssSvPoly.iode;
diagGnssSvPolyPtr->enhancedIOD = gnssSvPoly.enhancedIOD;
diagGnssSvPolyPtr->svPosUnc = gnssSvPoly.svPosUnc;
diagGnssSvPolyPtr->ionoDelay = gnssSvPoly.ionoDelay;
diagGnssSvPolyPtr->ionoDot = gnssSvPoly.ionoDot;
diagGnssSvPolyPtr->sbasIonoDelay = gnssSvPoly.sbasIonoDelay;
diagGnssSvPolyPtr->sbasIonoDot = gnssSvPoly.sbasIonoDot;
diagGnssSvPolyPtr->tropoDelay = gnssSvPoly.tropoDelay;
diagGnssSvPolyPtr->elevation = gnssSvPoly.elevation;
diagGnssSvPolyPtr->elevationDot = gnssSvPoly.elevationDot;
diagGnssSvPolyPtr->elevationUnc = gnssSvPoly.elevationUnc;
if (GNSS_SV_POLY_VELOCITY_COF_SIZE ==
CLIENT_DIAG_GNSS_SV_POLY_VELOCITY_COF_SIZE) {
for (index = 0; index < GNSS_SV_POLY_VELOCITY_COF_SIZE; index++) {
diagGnssSvPolyPtr->velCof[index] = gnssSvPoly.velCof[index];
}
} else {
LOC_LOGe("array size for velCof not match");
}
diagGnssSvPolyPtr->gpsIscL1ca = gnssSvPoly.gpsIscL1ca;
diagGnssSvPolyPtr->gpsIscL2c = gnssSvPoly.gpsIscL2c;
diagGnssSvPolyPtr->gpsIscL5I5 = gnssSvPoly.gpsIscL5I5;
diagGnssSvPolyPtr->gpsIscL5Q5 = gnssSvPoly.gpsIscL5Q5;
diagGnssSvPolyPtr->gpsTgd = gnssSvPoly.gpsTgd;
diagGnssSvPolyPtr->gloTgdG1G2 = gnssSvPoly.gloTgdG1G2;
diagGnssSvPolyPtr->bdsTgdB1 = gnssSvPoly.bdsTgdB1;
diagGnssSvPolyPtr->bdsTgdB2 = gnssSvPoly.bdsTgdB2;
diagGnssSvPolyPtr->bdsTgdB2a = gnssSvPoly.bdsTgdB2a;
diagGnssSvPolyPtr->bdsIscB2a = gnssSvPoly.bdsIscB2a;
diagGnssSvPolyPtr->galBgdE1E5a = gnssSvPoly.galBgdE1E5a;
diagGnssSvPolyPtr->galBgdE1E5b = gnssSvPoly.galBgdE1E5b;
diagGnssSvPolyPtr->navicTgdL5 = gnssSvPoly.navicTgdL5;
}
}

26
location_hal_daemon/LocHalDaemonClientHandler.cpp

@ -148,6 +148,15 @@ void LocHalDaemonClientHandler::updateSubscription(uint32_t mask) {
mCallbacks.gnssMeasurementsCb = nullptr;
}
// SV poly
if (mSubscriptionMask & E_LOC_CB_GNSS_SV_POLY_BIT) {
mCallbacks.gnssSvPolynomialCb = [this](GnssSvPolynomial notification) {
onGnssSvPolynomialCb(notification);
};
} else {
mCallbacks.gnssMeasurementsCb = nullptr;
}
// system info
if (mSubscriptionMask & E_LOC_CB_SYSTEM_INFO_BIT) {
mCallbacks.locationSystemInfoCb = [this](LocationSystemInfo notification) {
@ -890,6 +899,23 @@ void LocHalDaemonClientHandler::onGnssMeasurementsCb(GnssMeasurementsNotificatio
}
}
void LocHalDaemonClientHandler::onGnssSvPolynomialCb(GnssSvPolynomial notification) {
std::lock_guard<std::mutex> lock(LocationApiService::mMutex);
LOC_LOGd("--< onGnssSvPolynomialCb");
if ((nullptr != mIpcSender) && (mSubscriptionMask & E_LOC_CB_GNSS_SV_POLY_BIT)) {
LocAPIGnssSvPolyIndMsg msg(SERVICE_NAME, notification);
LOC_LOGv("Sending sv poly message");
int rc = sendMessage(msg);
// purge this client if failed
if (!rc) {
LOC_LOGe("failed rc=%d purging client=%s", rc, mName.c_str());
mService->deleteClientbyName(mName);
}
}
}
void LocHalDaemonClientHandler::onLocationSystemInfoCb(LocationSystemInfo notification) {
std::lock_guard<std::mutex> lock(LocationApiService::mMutex);

1
location_hal_daemon/LocHalDaemonClientHandler.h

@ -136,6 +136,7 @@ private:
void onGnssNmeaCb(GnssNmeaNotification);
void onGnssDataCb(GnssDataNotification gnssDataNotification);
void onGnssMeasurementsCb(GnssMeasurementsNotification gnssMeasurementsNotification);
void onGnssSvPolynomialCb(GnssSvPolynomial gnssSvPolynomialNotification);
void onLocationSystemInfoCb(LocationSystemInfo);
void onLocationApiDestroyCompleteCb();

19
location_hal_daemon/LocationApiMsg.h

@ -212,6 +212,10 @@ enum ELocMsgID {
// Measurement reports
E_LOCAPI_MEAS_MSG_ID = 30,
// SV poly reports
E_LOCAPI_SV_POLY_MSG_ID = 31,
// ping
E_LOCAPI_PINGTEST_MSG_ID = 99,
@ -237,6 +241,7 @@ enum ELocationCallbacksOption {
E_LOC_CB_ENGINE_LOCATIONS_INFO_BIT = (1<<9), /**< Register for multiple engine reports */
E_LOC_CB_SIMPLE_LOCATION_INFO_BIT = (1<<10), /**< Register for simple location */
E_LOC_CB_GNSS_MEAS_BIT = (1<<11), /**< Register for GNSS Measurements */
E_LOC_CB_GNSS_SV_POLY_BIT = (1<<12), /**< Register for GNSS SV poly reports */
};
// Mask related to all info that are tied with a position session and need to be unsubscribed
@ -246,7 +251,8 @@ enum ELocationCallbacksOption {
E_LOC_CB_GNSS_SV_BIT|E_LOC_CB_GNSS_NMEA_BIT|\
E_LOC_CB_GNSS_DATA_BIT|E_LOC_CB_GNSS_MEAS_BIT|\
E_LOC_CB_ENGINE_LOCATIONS_INFO_BIT|\
E_LOC_CB_SIMPLE_LOCATION_INFO_BIT)
E_LOC_CB_SIMPLE_LOCATION_INFO_BIT|\
E_LOC_CB_GNSS_SV_POLY_BIT)
typedef uint32_t EngineInfoCallbacksMask;
enum EEngineInfoCallbacksMask {
@ -740,6 +746,17 @@ struct LocAPIMeasIndMsg : LocAPIMsgHeader
gnssMeasurementsNotification(measurementsNotification) { }
};
// defintion for message with msg id of E_LOCAPI_SV_POLY_MSG_ID
struct LocAPIGnssSvPolyIndMsg : LocAPIMsgHeader
{
GnssSvPolynomial gnssSvPolynomial;
inline LocAPIGnssSvPolyIndMsg(const char* name,
GnssSvPolynomial& gnssSvPolynomialNotification) :
LocAPIMsgHeader(name, E_LOCAPI_SV_POLY_MSG_ID),
gnssSvPolynomial(gnssSvPolynomialNotification) { }
};
// defintion for message with msg id of E_LOCAPI_GET_TOTAL_ENGERY_CONSUMED_BY_GPS_ENGINE_MSG_ID
struct LocAPIGnssEnergyConsumedIndMsg: LocAPIMsgHeader
{

Loading…
Cancel
Save