diff --git a/core/LocAdapterBase.cpp b/core/LocAdapterBase.cpp index 19fab0e5..8da9ff1d 100644 --- a/core/LocAdapterBase.cpp +++ b/core/LocAdapterBase.cpp @@ -79,7 +79,7 @@ void LocAdapterBase:: } void LocAdapterBase:: - reportSv(GpsSvStatus &svStatus, + reportSv(GnssSvStatus &svStatus, GpsLocationExtended &locationExtended, void* svExt) DEFAULT_IMPL() diff --git a/core/LocAdapterBase.h b/core/LocAdapterBase.h index 7e0b0ebc..197b1c64 100644 --- a/core/LocAdapterBase.h +++ b/core/LocAdapterBase.h @@ -92,7 +92,7 @@ public: void* locationExt, enum loc_sess_status status, LocPosTechMask loc_technology_mask); - virtual void reportSv(GpsSvStatus &svStatus, + virtual void reportSv(GnssSvStatus &svStatus, GpsLocationExtended &locationExtended, void* svExt); virtual void reportSvMeasurement(GnssSvMeasurementSet &svMeasurementSet); diff --git a/core/LocApiBase.cpp b/core/LocApiBase.cpp index 565967ae..23424583 100644 --- a/core/LocApiBase.cpp +++ b/core/LocApiBase.cpp @@ -253,15 +253,16 @@ void LocApiBase::reportPosition(UlpLocation &location, ); } -void LocApiBase::reportSv(GpsSvStatus &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 used" - " in fix mask: %x\n sv: prn snr elevation azimuth", + 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.used_in_fix_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", i, diff --git a/core/LocApiBase.h b/core/LocApiBase.h index c71100f4..59622a6c 100644 --- a/core/LocApiBase.h +++ b/core/LocApiBase.h @@ -113,7 +113,7 @@ public: enum loc_sess_status status, LocPosTechMask loc_technology_mask = LOC_POS_TECH_MASK_DEFAULT); - void reportSv(GpsSvStatus &svStatus, + void reportSv(GnssSvStatus &svStatus, GpsLocationExtended &locationExtended, void* svExt); void reportSvMeasurement(GnssSvMeasurementSet &svMeasurementSet); diff --git a/core/UlpProxyBase.h b/core/UlpProxyBase.h index 5270cfb3..9eb450bd 100644 --- a/core/UlpProxyBase.h +++ b/core/UlpProxyBase.h @@ -58,7 +58,7 @@ public: LocPosTechMask loc_technology_mask) { return false; } - inline virtual bool reportSv(GpsSvStatus &svStatus, + inline virtual bool reportSv(GnssSvStatus &svStatus, GpsLocationExtended &locationExtended, void* svExt) { return false; diff --git a/core/gps_extended_c.h b/core/gps_extended_c.h index 7debee9b..04fab59b 100644 --- a/core/gps_extended_c.h +++ b/core/gps_extended_c.h @@ -306,6 +306,47 @@ typedef struct GpsExtLocation_s { uint32_t sources_used; } GpsExtLocation; +/** Represents SV status. */ +typedef struct { + /** set to sizeof(GnssSvStatus) */ + 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; + +} GnssSvStatus; + enum loc_sess_status { LOC_SESS_SUCCESS, LOC_SESS_INTERMEDIATE, diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp index dbfc2fb7..c7447543 100644 --- a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp +++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp @@ -797,7 +797,7 @@ void LocApiRpc::reportPosition(const rpc_loc_parsed_position_s_type *location_re void LocApiRpc::reportSv(const rpc_loc_gnss_info_s_type *gnss_report_ptr) { - GpsSvStatus SvStatus = {0}; + GnssSvStatus SvStatus = {0}; GpsLocationExtended locationExtended = {0}; locationExtended.size = sizeof(locationExtended); int num_svs_max = 0; @@ -823,7 +823,7 @@ void LocApiRpc::reportSv(const rpc_loc_gnss_info_s_type *gnss_report_ptr) { if (sv_info_ptr->system == RPC_LOC_SV_SYSTEM_GPS) { - SvStatus.sv_list[SvStatus.num_svs].size = sizeof(GpsSvStatus); + SvStatus.sv_list[SvStatus.num_svs].size = sizeof(GpsSvInfo); SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn; // We only have the data field to report gps eph and alm mask @@ -842,7 +842,7 @@ void LocApiRpc::reportSv(const rpc_loc_gnss_info_s_type *gnss_report_ptr) if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_PROCESS_STATUS) && (sv_info_ptr->process_status == RPC_LOC_SV_STATUS_TRACK)) { - SvStatus.used_in_fix_mask |= (1 << (sv_info_ptr->prn-1)); + SvStatus.gps_used_in_fix_mask |= (1 << (sv_info_ptr->prn-1)); } } // SBAS: GPS RPN: 120-151, @@ -855,6 +855,12 @@ void LocApiRpc::reportSv(const rpc_loc_gnss_info_s_type *gnss_report_ptr) // In extended measurement report, we follow nmea standard, which is 65-96 else if (sv_info_ptr->system == RPC_LOC_SV_SYSTEM_GLONASS) { + if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_PROCESS_STATUS) && + (sv_info_ptr->process_status == RPC_LOC_SV_STATUS_TRACK)) + { + SvStatus.glo_used_in_fix_mask |= (1 << (sv_info_ptr->prn-1)); + } + SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn + (65-1); } // Unsupported SV system diff --git a/loc_api/libloc_api_50001/LocEngAdapter.cpp b/loc_api/libloc_api_50001/LocEngAdapter.cpp index 7089741b..d1b8f8fc 100644 --- a/loc_api/libloc_api_50001/LocEngAdapter.cpp +++ b/loc_api/libloc_api_50001/LocEngAdapter.cpp @@ -199,14 +199,14 @@ void LocEngAdapter::reportPosition(UlpLocation &location, } } -void LocInternalAdapter::reportSv(GpsSvStatus &svStatus, +void LocInternalAdapter::reportSv(GnssSvStatus &svStatus, GpsLocationExtended &locationExtended, void* svExt){ sendMsg(new LocEngReportSv(mLocEngAdapter, svStatus, locationExtended, svExt)); } -void LocEngAdapter::reportSv(GpsSvStatus &svStatus, +void LocEngAdapter::reportSv(GnssSvStatus &svStatus, GpsLocationExtended &locationExtended, void* svExt) { diff --git a/loc_api/libloc_api_50001/LocEngAdapter.h b/loc_api/libloc_api_50001/LocEngAdapter.h index bc41ac1d..e1d8f098 100644 --- a/loc_api/libloc_api_50001/LocEngAdapter.h +++ b/loc_api/libloc_api_50001/LocEngAdapter.h @@ -55,7 +55,7 @@ public: void* locationExt, enum loc_sess_status status, LocPosTechMask loc_technology_mask); - virtual void reportSv(GpsSvStatus &svStatus, + virtual void reportSv(GnssSvStatus &svStatus, GpsLocationExtended &locationExtended, void* svExt); virtual void reportStatus(GpsStatusValue status); @@ -268,7 +268,7 @@ public: void* locationExt, enum loc_sess_status status, LocPosTechMask loc_technology_mask); - virtual void reportSv(GpsSvStatus &svStatus, + virtual void reportSv(GnssSvStatus &svStatus, GpsLocationExtended &locationExtended, void* svExt); virtual void reportSvMeasurement(GnssSvMeasurementSet &svMeasurementSet); diff --git a/loc_api/libloc_api_50001/loc_eng.cpp b/loc_api/libloc_api_50001/loc_eng.cpp index a81df97b..917c2ae2 100644 --- a/loc_api/libloc_api_50001/loc_eng.cpp +++ b/loc_api/libloc_api_50001/loc_eng.cpp @@ -827,7 +827,7 @@ void LocEngReportPosition::send() const { // case LOC_ENG_MSG_REPORT_SV: LocEngReportSv::LocEngReportSv(LocAdapterBase* adapter, - GpsSvStatus &sv, + GnssSvStatus &sv, GpsLocationExtended &locExtended, void* svExt) : LocMsg(), mAdapter(adapter), mSvStatus(sv), diff --git a/loc_api/libloc_api_50001/loc_eng_msg.h b/loc_api/libloc_api_50001/loc_eng_msg.h index 5626c346..9c7b9bcd 100644 --- a/loc_api/libloc_api_50001/loc_eng_msg.h +++ b/loc_api/libloc_api_50001/loc_eng_msg.h @@ -105,11 +105,11 @@ struct LocEngReportPosition : public LocMsg { struct LocEngReportSv : public LocMsg { LocAdapterBase* mAdapter; - const GpsSvStatus mSvStatus; + const GnssSvStatus mSvStatus; const GpsLocationExtended mLocationExtended; const void* mSvExt; LocEngReportSv(LocAdapterBase* adapter, - GpsSvStatus &sv, + GnssSvStatus &sv, GpsLocationExtended &locExtended, void* svExtended); virtual void proc() const; diff --git a/loc_api/libloc_api_50001/loc_eng_nmea.cpp b/loc_api/libloc_api_50001/loc_eng_nmea.cpp index 4c6b9a3a..7bc58bd0 100644 --- a/loc_api/libloc_api_50001/loc_eng_nmea.cpp +++ b/loc_api/libloc_api_50001/loc_eng_nmea.cpp @@ -604,7 +604,7 @@ SIDE EFFECTS ===========================================================================*/ void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p, - const GpsSvStatus &svStatus, const GpsLocationExtended &locationExtended) + const GnssSvStatus &svStatus, const GpsLocationExtended &locationExtended) { ENTRY_LOG(); @@ -790,7 +790,9 @@ void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p, }//if - if (svStatus.used_in_fix_mask == 0) + if (svStatus.gps_used_in_fix_mask == 0 && + svStatus.glo_used_in_fix_mask == 0 && + svStatus.bds_used_in_fix_mask == 0) { // No sv used, so there will be no position report, so send // blank NMEA sentences strlcpy(sentence, "$GPGSA,A,1,,,,,,,,,,,,,,,", sizeof(sentence)); @@ -812,7 +814,7 @@ void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p, else { // cache the used in fix mask, as it will be needed to send $GPGSA // during the position report - loc_eng_data_p->sv_used_mask = svStatus.used_in_fix_mask; + loc_eng_data_p->sv_used_mask = svStatus.gps_used_in_fix_mask; // For RPC, the DOP are sent during sv report, so cache them // now to be sent during position report. diff --git a/loc_api/libloc_api_50001/loc_eng_nmea.h b/loc_api/libloc_api_50001/loc_eng_nmea.h index 40c6dbbd..066943aa 100644 --- a/loc_api/libloc_api_50001/loc_eng_nmea.h +++ b/loc_api/libloc_api_50001/loc_eng_nmea.h @@ -31,12 +31,13 @@ #define LOC_ENG_NMEA_H #include +#include #define NMEA_SENTENCE_MAX_LENGTH 200 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 GpsSvStatus &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