Skip to content

Commit

Permalink
release: 3.4.8 (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
ewasjon authored Apr 26, 2024
1 parent 0c6dd6b commit d6bda15
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 17 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## [3.4.8] 2024-04-26
- Added support for age of correction when using NMEA.

## [3.4.7] 2024-04-25
- Added support for UBX-RXM-RTCM messages.
- Added support for UBX-RXM-SPARTN messages.
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ find_package(OpenSSL REQUIRED)
endif (USE_OPENSSL)

add_definitions(-D_POSIX_C_SOURCE=200809L)
add_definitions(-DCLIENT_VERSION="3.4.7")
add_definitions(-DCLIENT_VERSION_INT=0x030407)
add_definitions(-DCLIENT_VERSION="3.4.8")
add_definitions(-DCLIENT_VERSION_INT=0x030408)

if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_definitions(-DCOMPILER_CANNOT_DEDUCE_UNREACHABLE=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.7-green)
![version](https://img.shields.io/badge/version-3.4.8-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
7 changes: 4 additions & 3 deletions examples/lpp/location_information.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ PLI_Result provide_location_information_callback_nmea(LocationInformation& locat
metrics.fix_quality = FixQuality::INVALID;
metrics.number_of_satellites = gga->satellites_in_view();
metrics.hdop = gga->h_dop();
metrics.age_of_corrections = gga->age_of_differential_corrections();

switch (gga->fix_quality()) {
case receiver::nmea::GgaFixQuality::Invalid: metrics.fix_quality = FixQuality::INVALID; break;
Expand Down Expand Up @@ -174,10 +175,10 @@ PLI_Result provide_location_information_callback_fake(LocationInformation& loca
location.velocity = VelocityShape::horizontal_vertical_with_uncertainty(10, 0.5, 90, 1, 0.5,
VerticalDirection::Up);

if(rand() % 2 == 0) {
metrics.fix_quality = FixQuality::RTK_FIX;
if (rand() % 2 == 0) {
metrics.fix_quality = FixQuality::RTK_FIX;
} else {
metrics.fix_quality = FixQuality::RTK_FLOAT;
metrics.fix_quality = FixQuality::RTK_FLOAT;
}
metrics.age_of_corrections = 5;
metrics.number_of_satellites = 1;
Expand Down
2 changes: 1 addition & 1 deletion libs/lpplib/include/lpp/location_information.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ struct HaGnssMetrics {
FixQuality fix_quality;
// Number of satellites used in the navigation solution [0, 64].
long number_of_satellites;
// Age of the most recently used assistance data in seconds [0, 99].
// Age of the most recently used assistance data in seconds [0, 9.9].
Optional<double> age_of_corrections;
// Horizontal dilution of precision in range [0.1, 25.6].
Optional<double> hdop;
Expand Down
22 changes: 14 additions & 8 deletions libs/lpplib/src/internal_lpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,20 +449,26 @@ lpp_ha_GNSS_Metrics_r17(location_information::HaGnssMetrics const& metrics) {
default: break;
}

if (metrics.age_of_corrections.has_value() && metrics.age_of_corrections.const_value() >= 0 &&
metrics.age_of_corrections.const_value() < 1000.0) {
if (metrics.age_of_corrections.has_value()) {
auto age = metrics.age_of_corrections.const_value() / 0.1;
if (age < 0) age = 0;
if (age > 99) age = 99;
element->age_r17 = ALLOC_ZERO(long);
*element->age_r17 = static_cast<long>(metrics.age_of_corrections.const_value() / 0.1);
*element->age_r17 = static_cast<long>(age);
}

if (metrics.hdop.has_value() && metrics.hdop.const_value() >= 0.1 &&
metrics.hdop.const_value() < 2560) {
if (metrics.hdop.has_value()) {
auto hdop = metrics.hdop.const_value() / 0.1;
if (hdop < 1) hdop = 1;
if (hdop > 256) hdop = 256;
element->hdopi_r17 = ALLOC_ZERO(long);
*element->hdopi_r17 = static_cast<long>(metrics.hdop.const_value() / 0.1);
*element->hdopi_r17 = static_cast<long>(hdop);
}

if (metrics.pdop.has_value() && metrics.pdop.const_value() >= 0.1 &&
metrics.pdop.const_value() < 2560) {
if (metrics.pdop.has_value()) {
auto pdop = metrics.pdop.const_value() / 0.1;
if (pdop < 1) pdop = 1;
if (pdop > 256) pdop = 256;
element->pdopi_r17 = ALLOC_ZERO(long);
*element->pdopi_r17 = static_cast<long>(metrics.pdop.const_value() / 0.1);
}
Expand Down
4 changes: 4 additions & 0 deletions libs/lpplib/src/supl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,22 +215,26 @@ SUPL_Message SUPL_Client::process() {
uper_decode_complete(0, &asn_DEF_ULP_PDU, (void**)&pdu, mReceiveBuffer, mReceiveLength);
if (result.code == RC_FAIL) {
mReceiveLength = 0;
ASN_STRUCT_FREE(asn_DEF_ULP_PDU, pdu);
return nullptr;
} else if (result.code == RC_WMORE) {
expected_size = static_cast<size_t>(pdu->length);
if (expected_size > SUPL_CLIENT_RECEIVER_BUFFER_SIZE) {
// Unable to handle such big messages
mReceiveLength = 0;
ASN_STRUCT_FREE(asn_DEF_ULP_PDU, pdu);
return nullptr;
} else if (expected_size > mReceiveLength) {
// Not enough data
ASN_STRUCT_FREE(asn_DEF_ULP_PDU, pdu);
return nullptr;
}

result =
uper_decode_complete(0, &asn_DEF_ULP_PDU, (void**)&pdu, mReceiveBuffer, expected_size);
if (result.code != RC_OK) {
mReceiveLength = 0;
ASN_STRUCT_FREE(asn_DEF_ULP_PDU, pdu);
return nullptr;
}
} else {
Expand Down
25 changes: 24 additions & 1 deletion receiver/nmea/gga.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,28 @@ static bool parse_altitude(std::string const& altitude, std::string const& units
}
}

static bool
parse_age_of_differential_corrections(std::string const& age_of_differential_corrections,
double& value) {
try {
value = std::stod(age_of_differential_corrections);
return true;
} catch (...) {
return false;
}
}

GgaMessage::GgaMessage(std::string prefix, std::string payload, std::string checksum) NMEA_NOEXCEPT
: Message{prefix, payload, checksum},
mTimeOfDay{TAI_Time::now()},
mLatitude{0.0},
mLongitude{0.0},
mFixQuality{GgaFixQuality::Invalid},
mSatellitesInView{0} {}
mSatellitesInView{0},
mHdop{0.0},
mMsl{0.0},
mGeoidSeparation{0.0},
mAgeOfDifferentialCorrections{0} {}

void GgaMessage::print() const NMEA_NOEXCEPT {
printf("[%5s]\n", prefix().c_str());
Expand All @@ -150,6 +165,7 @@ void GgaMessage::print() const NMEA_NOEXCEPT {
printf(" satellites: %d\n", satellites_in_view());
printf(" hdop: %.4f\n", h_dop());
printf(" altitude: %.2f\n", altitude());
printf(" age: %.2f\n", age_of_differential_corrections());
}

std::unique_ptr<Message> GgaMessage::parse(std::string prefix, std::string const& payload,
Expand All @@ -174,6 +190,13 @@ std::unique_ptr<Message> GgaMessage::parse(std::string prefix, std::string const
success &= parse_altitude(tokens[8], tokens[9], message->mMsl);
success &= parse_altitude(tokens[10], tokens[11], message->mGeoidSeparation);

if (tokens.size() > 12) {
success &= parse_age_of_differential_corrections(tokens[12],
message->mAgeOfDifferentialCorrections);
} else {
message->mAgeOfDifferentialCorrections = 0;
}

if (success) {
return std::unique_ptr<GgaMessage>(message);
} else {
Expand Down
8 changes: 7 additions & 1 deletion receiver/nmea/include/receiver/nmea/gga.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class GgaMessage final : public Message {
: Message(other), mTimeOfDay(other.mTimeOfDay), mLatitude(other.mLatitude),
mLongitude(other.mLongitude), mFixQuality(other.mFixQuality),
mSatellitesInView(other.mSatellitesInView), mHdop(other.mHdop), mMsl(other.mMsl),
mGeoidSeparation(other.mGeoidSeparation) {}
mGeoidSeparation(other.mGeoidSeparation), mAgeOfDifferentialCorrections(other.mAgeOfDifferentialCorrections) {}
GgaMessage(GgaMessage&&) = delete;
GgaMessage& operator=(GgaMessage const&) = delete;
GgaMessage& operator=(GgaMessage&&) = delete;
Expand Down Expand Up @@ -54,6 +54,11 @@ class GgaMessage final : public Message {
/// Get the altitude in meters.
NMEA_NODISCARD double altitude() const NMEA_NOEXCEPT { return mMsl + mGeoidSeparation; }

/// Get the age of differential corrections.
NMEA_NODISCARD double age_of_differential_corrections() const NMEA_NOEXCEPT {
return mAgeOfDifferentialCorrections;
}

NMEA_NODISCARD static std::unique_ptr<Message>
parse(std::string prefix, std::string const& payload, std::string checksum);

Expand All @@ -69,6 +74,7 @@ class GgaMessage final : public Message {
double mHdop;
double mMsl;
double mGeoidSeparation;
double mAgeOfDifferentialCorrections;
};

} // namespace nmea
Expand Down

0 comments on commit d6bda15

Please sign in to comment.