Skip to content

Commit

Permalink
release: v3.4.2 (#13)
Browse files Browse the repository at this point in the history
See CHANGELOG.md for changes
  • Loading branch information
ewasjon authored Feb 2, 2024
1 parent 3c7a485 commit fa8d2ec
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 22 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [3.4.2]
- Fixed a bug where GAD messages had TF009 set to 0. It will now be set to time specified in the STEC/Gridded IE.
- Fixed a bug where parsing bitfields in UBX-NAV-PVT would not be incorrect.

## [3.4.1]
- Fixed a crash due to missing null pointer check in NMEA `ThreadedReceiver`.

Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ find_package(OpenSSL REQUIRED)
endif (USE_OPENSSL)

add_definitions(-D_POSIX_C_SOURCE=200809L)
add_definitions(-DCLIENT_VERSION="3.4.1")
add_definitions(-DCLIENT_VERSION="3.4.2")

if(${ASN_DEBUG})
add_definitions(-DASN_EMIT_DEBUG=1)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SUPL 3GPP LPP client

![version](https://img.shields.io/badge/version-3.4.1-green)
![version](https://img.shields.io/badge/version-3.4.2-green)
![license](https://img.shields.io/badge/license-MXM-blue)

This project is a set of libraries, examples and tools to facilitate the development of 3GPP LPP clients.
Expand Down
2 changes: 2 additions & 0 deletions generator/spartn2/data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ struct CorrectionData {
return &it->second;
}

bool find_gad_epoch_time(long iod, SpartnTime* epoch_time) const;

void add_correction(long gnss_id, GNSS_SSR_OrbitCorrections_r15* orbit);
void add_correction(long gnss_id, GNSS_SSR_ClockCorrections_r15* clock);
void add_correction(long gnss_id, GNSS_SSR_CodeBias_r15* code_bias);
Expand Down
4 changes: 2 additions & 2 deletions generator/spartn2/gad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace generator {
namespace spartn {

void Generator::generate_gad(long iod, long set_id) {
void Generator::generate_gad(long iod, uint32_t epoch_time, long set_id) {
auto cps_it = mCorrectionPointSets.find(set_id);
if (cps_it == mCorrectionPointSets.end()) return;
auto& correction_point_set = *(cps_it->second.get());
Expand Down Expand Up @@ -47,7 +47,7 @@ void Generator::generate_gad(long iod, long set_id) {
}
#endif

MessageBuilder builder{2 /* GAD */, 0, 0};
MessageBuilder builder{2 /* GAD */, 0, epoch_time};
builder.sf005(iod); // TODO(ewasjon): We could include AIOU in the correction point set, to
// handle overflow
builder.sf068(0);
Expand Down
24 changes: 17 additions & 7 deletions generator/spartn2/generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,22 +67,30 @@ std::vector<Message> Generator::generate(const LPP_Message* lpp_message) {
std::vector<long> set_ids;
hpac->set_ids(set_ids);

for (auto set_id : set_ids) {
SpartnTime gad_epoch_time{};
if (mCorrectionData->find_gad_epoch_time(iod, &gad_epoch_time)) {
for (auto set_id : set_ids) {
#ifdef SPARTN_DEBUG_PRINT
printf("GAD: set=%ld, iod=%ld\n", set_id, iod);
printf("GAD: set=%ld, iod=%ld, time=%u\n", set_id, iod,
gad_epoch_time.rounded_seconds);
#endif

generate_gad(iod, set_id);
generate_gad(iod, gad_epoch_time.rounded_seconds, set_id);
}
} else {
#ifdef SPARTN_DEBUG_PRINT
printf("GAD: no epoch time for iod=%ld\n", iod);
#endif
}
}

if (ocb && mGenerateOcb) {
generate_ocb(iod);
}

if (hpac && mGenerateHpac) {
generate_hpac(iod);
}

if (ocb && mGenerateOcb) {
generate_ocb(iod);
}
}

// Increment generation index
Expand Down Expand Up @@ -128,8 +136,10 @@ void Generator::find_correction_point_set(const ProvideAssistanceData_r9_IEs* me
bitmask |= static_cast<uint64_t>(array.bitmaskOfGrids_r16->buf[i]);
}
bitmask >>= array.bitmaskOfGrids_r16->bits_unused;
#ifdef SPARTN_DEBUG_PRINT
printf(" bitmask: %ld bytes, %d bits, 0x%016lX\n", array.bitmaskOfGrids_r16->size,
array.bitmaskOfGrids_r16->bits_unused, bitmask);
#endif
} else {
bitmask = 0xFFFFFFFFFFFFFFFF;
}
Expand Down
30 changes: 28 additions & 2 deletions generator/spartn2/hpac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,32 @@ std::vector<long> CorrectionData::iods() const {
return iods;
}

bool CorrectionData::find_gad_epoch_time(long iod, SpartnTime* epoch_time) const {
SpartnTime time{};
bool found = false;

auto hpac = mHpacData.find(iod);
if (hpac != mHpacData.end()) {
auto& hpac_data = hpac->second;
for (auto& kvp : hpac_data.mKeyedCorrections) {
auto& corrections = kvp.second;
// NOTE(ewasjon): The GAD message is constellation-less, thus the epoch time that will
// be used should be GPS time.
if (corrections.gnss_id != 0) continue;
if (!found || corrections.epoch_time > time) {
time = corrections.epoch_time;
found = true;
}
}
}

if (found && epoch_time) {
*epoch_time = time;
}

return found;
}

void CorrectionData::add_correction(long gnss_id, GNSS_SSR_GriddedCorrection_r16* gridded) {
if (!gridded) return;
auto iod = gridded->iod_ssr_r16;
Expand Down Expand Up @@ -533,8 +559,8 @@ void Generator::generate_hpac(long iod) {

MessageBuilder builder{1 /* HPAC */, subtype, epoch_time};
builder.sf005(iod);
builder.sf068(0); // TODO(ewasjon): [low-priority] We could include AIOU in the correction point set, to
// handle overflow
builder.sf068(0); // TODO(ewasjon): [low-priority] We could include AIOU in the correction
// point set, to handle overflow
builder.sf069();
builder.sf030(1);

Expand Down
2 changes: 1 addition & 1 deletion generator/spartn2/include/generator/spartn2/generator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class Generator {
void find_ocb_corrections(const ProvideAssistanceData_r9_IEs* message);
void find_hpac_corrections(const ProvideAssistanceData_r9_IEs* message);

void generate_gad(long iod, long set_id);
void generate_gad(long iod, uint32_t epoch_time, long set_id);
void generate_ocb(long iod);
void generate_hpac(long iod);

Expand Down
1 change: 1 addition & 0 deletions generator/spartn2/time.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "time.hpp"

#include <utility/time.h>
#include "GNSS-SystemTime.h"

static SPARTN_CONSTEXPR uint32_t SECONDS_IN_DAY = 86400;
Expand Down
8 changes: 8 additions & 0 deletions generator/spartn2/time.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,13 @@ struct SpartnTime {
uint32_t rounded_seconds;
};

inline bool operator==(const SpartnTime& lhs, const SpartnTime& rhs) {
return lhs.seconds == rhs.seconds && lhs.rounded_seconds == rhs.rounded_seconds;
}

inline bool operator>(const SpartnTime& lhs, const SpartnTime& rhs) {
return lhs.seconds > rhs.seconds;
}

struct GNSS_SystemTime;
SpartnTime spartn_time_from(const GNSS_SystemTime& epoch_time);
16 changes: 8 additions & 8 deletions receiver/ublox/ubx_nav_pvt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,25 +166,25 @@ std::unique_ptr<Message> UbxNavPvt::parse(Decoder& decoder) UBLOX_NOEXCEPT {

auto valid = decoder.X1();
payload.valid.valid_date = (valid >> 0) & 0x01;
payload.valid.valid_time = (valid >> 1) & 0x02;
payload.valid.fully_resolved = (valid >> 2) & 0x04;
payload.valid.valid_mag = (valid >> 3) & 0x08;
payload.valid.valid_time = (valid >> 1) & 0x01;
payload.valid.fully_resolved = (valid >> 2) & 0x01;
payload.valid.valid_mag = (valid >> 3) & 0x01;

payload.t_acc = decoder.U4();
payload.nano = decoder.I4();
payload.fix_type = decoder.U1();

auto flags = decoder.X1();
payload.flags.gnss_fix_ok = (flags >> 0) & 0x01;
payload.flags.diff_soln = (flags >> 1) & 0x02;
payload.flags.diff_soln = (flags >> 1) & 0x01;
payload.flags.psm_state = (flags >> 2) & 0x07;
payload.flags.head_veh_valid = (flags >> 5) & 0x20;
payload.flags.head_veh_valid = (flags >> 5) & 0x01;
payload.flags.carr_soln = (flags >> 6) & 0x03;

auto flags2 = decoder.X1();
payload.flags2.confirmed_avai = (flags2 >> 5) & 0x20;
payload.flags2.confirmed_date = (flags2 >> 6) & 0x40;
payload.flags2.confirmed_time = (flags2 >> 7) & 0x80;
payload.flags2.confirmed_avai = (flags2 >> 5) & 0x01;
payload.flags2.confirmed_date = (flags2 >> 6) & 0x01;
payload.flags2.confirmed_time = (flags2 >> 7) & 0x01;

payload.num_sv = decoder.U1();
payload.lon = decoder.I4();
Expand Down

0 comments on commit fa8d2ec

Please sign in to comment.