Skip to content

Commit

Permalink
Release: 3.4.5 (#16)
Browse files Browse the repository at this point in the history
release: 3.4.5
  • Loading branch information
ewasjon authored Apr 2, 2024
1 parent 5058cd7 commit 6c64f84
Show file tree
Hide file tree
Showing 106 changed files with 7,269 additions and 156 deletions.
18 changes: 13 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# Changelog

## [3.4.4]
## [3.4.5] 2024-04-02
- SPARTN generator will not use provided URA epoch-time. This caused issues where only the URA timestamp would be used and because it isn't update vary frequently the corrections data would not be used.
- SPARTN is now "officially" supported. It has been tested with multiple data feed providers and is working as expected.
- Added option to override the ionospheric quality indiciator (SF055).
- Added support for external control commands. This allows the client to be controlled by an external application. See `CONTROL.md` for more information.
- Building with OpenSSL support is now off by default. To enable it, use `-DUSE_OPENSSL=ON` when building with CMake.
- Experimental changes can now be toggled with `-DEXPERIMENTAL=ON` when building with CMake.

## [3.4.4] 2024-03-06
- Fixed message nullptr exception.
- IMSI and MSISDN used `unsigned long` which doesn't have enough bits to store all possible values. Changed to `unsigned long long`.
- Added support to use 5G NR cells in addition to LTE cells.
Expand All @@ -13,18 +21,18 @@
- Added support to parse request periodicity from RequestLocationInformation message.
- When using the u-Blox receiver in `example-lpp`, it will not load the receiver configuration. This behavior is unchanged for `example-ublox` but can still be disabled with `--disable-config`.

## [3.4.3]
## [3.4.3] 2024-02-08
- Added option to export NMEA sentences to a unix socket or a TCP connection. See `--nmea-export-*` command-line arguments. This requires the use of the NMEA receiver.
- Fixed a bug where in cases of TCP connection failure, the addrinfo struct was not freed.

## [3.4.2]
## [3.4.2] 2024-02-02
- 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]
## [3.4.1] 2024-01-30
- Fixed a crash due to missing null pointer check in NMEA `ThreadedReceiver`.

## [3.4.0]
## [3.4.0] 2024-01-26
- Support for receivers that communicate using NMEA protocol has been added. The following sentences are now supported:
- GGA
- GST
Expand Down
12 changes: 8 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ set(CMAKE_CXX_EXTENSIONS OFF)

project(example LANGUAGES C CXX)

option(USE_OPENSSL "USE_OPENSSL" ON)
option(USE_OPENSSL "USE_OPENSSL" OFF)
option(USE_ASAN "USE_ASAN" OFF)
option(ASN_DEBUG "ASN_DEBUG" OFF)
option(INTERFACE_FD_DEBUG "Print FD debug information" OFF)
option(RECEIVER_UBLOX_THREADED "Print Receiver u-blox (threaded) debug information" OFF)
option(SPARTN_DEBUG_PRINT "Print SPARTN debug information" OFF)
option(RECEIVER_NMEA_DEBUG "Print Receiver NMEA debug information" OFF)
option(EXPERIMENTAL "EXPERIMENTAL" OFF)

option (FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." TRUE)
if (FORCE_COLORED_OUTPUT)
Expand All @@ -28,8 +29,8 @@ find_package(OpenSSL REQUIRED)
endif (USE_OPENSSL)

add_definitions(-D_POSIX_C_SOURCE=200809L)
add_definitions(-DCLIENT_VERSION="3.4.4")
add_definitions(-DCLIENT_VERSION_INT=0x030404)
add_definitions(-DCLIENT_VERSION="3.4.5")
add_definitions(-DCLIENT_VERSION_INT=0x030405)

if(${ASN_DEBUG})
add_definitions(-DASN_EMIT_DEBUG=1)
Expand All @@ -52,4 +53,7 @@ add_subdirectory("examples/nmea")
add_subdirectory("examples/lpp")
add_subdirectory("examples/lpp2spartn")
add_subdirectory("examples/ntrip")

add_subdirectory("examples/ctrl_switch")
if(${EXPERIMENTAL})
add_subdirectory("examples/client")
endif()
16 changes: 16 additions & 0 deletions CONTROL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Control

Control commands can be used to configure/instruct the client to perform certain actions. The main reason for this system is to simplify the handling of cell IDs. This will allow the client to be more less specific and not require multiple modems. To use with `example-lpp` you need to specify a interface that control commands will be sent over, e.g., `--ctrl-tcp=localhost --ctrl-tcp-port=5432`. All commands are sent as a string with a leading `/` and ending with `\r\n`. See the example `ctrl-switch` which demonstrates how to send control commands to the client in C/C++.

## Commands

Here are the available commands:
* [CID](#cid)

### CID

Notify the client that the cell ID has changed. The client will then request (update) the assistance data for the new cell ID.

Usage: `/CID,L,MNC,MCC,TAC,CID`

Example: `/CID,L,240,01,0,3`
37 changes: 37 additions & 0 deletions asn.1/helper/bit_string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include <sstream>

namespace helper {

#if 1
BitString::BitString(size_t bits) {
buf = nullptr;
size = 0;
Expand Down Expand Up @@ -160,4 +162,39 @@ std::string BitString::as_string() const {
delete[] data;
return stream.str();
}

#endif

static void BIT_STRING_initialize(BIT_STRING_s* bit_string, size_t bits) {
BIT_STRING_free(&asn_DEF_BIT_STRING, bit_string, ASFM_FREE_UNDERLYING_AND_RESET);

auto bytes = (bits + 7) / 8;
bit_string->size = bytes;
bit_string->bits_unused = 0;
bit_string->buf = reinterpret_cast<uint8_t*>(calloc(bit_string->size, sizeof(uint8_t)));
}

BIT_STRING_s* BitStringBuilder::to_bit_string(size_t bits) {
auto bit_string = asn1_allocate<BIT_STRING_s>();
return into_bit_string(bits, bit_string);
}

BIT_STRING_s* BitStringBuilder::into_bit_string(size_t bits, BIT_STRING_s* bit_string) {
BIT_STRING_initialize(bit_string, bits);

assert(bits <= 64);
for (int j = 0; j < 64; j++) {
if (mBits & (1llu << j)) {
auto x = j / 8;
auto y = 7 - (j % 8);
assert(x < bit_string->size);
if (x < bit_string->size) {
bit_string->buf[x] |= 1 << y;
}
}
}

return bit_string;
}

} // namespace helper
47 changes: 47 additions & 0 deletions asn.1/helper/include/asn.1/bit_string.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

namespace helper {

#if 1

class BitString : public BIT_STRING_s {
public:
explicit BitString(size_t bits);
Expand Down Expand Up @@ -53,4 +55,49 @@ class BitString : public BIT_STRING_s {

static_assert(sizeof(BitString) == sizeof(BIT_STRING_s),
"BitString must be the same size as BIT_STRING_s");

#endif

class BitStringBuilder {
public:
explicit BitStringBuilder() { mBits = 0; }

template <typename T>
BitStringBuilder& set(T index) {
assert(index < 64);
mBits |= 1llu << index;
return *this;
}

template <typename T>
BitStringBuilder& clear(T index) {
assert(index < 64);
mBits &= ~(1llu << index);
return *this;
}

template <typename T>
BitStringBuilder& integer(T index, T bits, uint64_t value) {
// NOTE(ewasjon): A bit string is numbered from left to right, so the
// first bit is the most significant bit. This is the opposite of how
// we usually number bits in C, so we need to reverse the order of the
// bits.
for (T i = 0; i < bits; i++) {
auto bit = bits - i - 1;
if (value & (1llu << bit)) {
set(index + i);
} else {
clear(index + i);
}
}
return *this;
}

BIT_STRING_s* to_bit_string(size_t bits);
BIT_STRING_s* into_bit_string(size_t bits, BIT_STRING_s* bit_string);

private:
uint64_t mBits;
};

} // namespace helper
31 changes: 31 additions & 0 deletions examples/client/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

add_executable(example_client
"main.cpp"
"assistance_data.cpp"
)
add_executable(examples::client ALIAS example_client)

target_include_directories(example_client PRIVATE "./")
target_link_libraries(example_client PRIVATE utility modem lpplib Threads::Threads)
target_link_libraries(example_client PRIVATE args)
target_link_libraries(example_client PRIVATE generator::rtcm)
target_link_libraries(example_client PRIVATE generator::spartn)
target_link_libraries(example_client PRIVATE generator::spartn2)
target_link_libraries(example_client PRIVATE dependency::interface)
target_link_libraries(example_client PRIVATE receiver::ublox)
target_link_libraries(example_client PRIVATE receiver::nmea)
target_link_libraries(example_client PRIVATE asn1::generated asn1::helper)
target_link_libraries(example_client PRIVATE scheduler supl lpp loglet)

set_target_properties(example_client PROPERTIES OUTPUT_NAME "example-client")
set_target_properties(example_client PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")

if (USE_OPENSSL)
target_link_libraries(example_client PRIVATE OpenSSL::SSL)
target_compile_definitions(example_client PRIVATE "USE_OPENSSL=1")
endif (USE_OPENSSL)

if (USE_ASAN)
target_compile_options(example_client PRIVATE -fsanitize=address,undefined,leak)
target_link_libraries(example_client PRIVATE -fsanitize=address,undefined,leak)
endif (USE_ASAN)
4 changes: 4 additions & 0 deletions examples/client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Example - Client

WORK IN PROGRESS - This example is not yet complete.

42 changes: 42 additions & 0 deletions examples/client/assistance_data.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#include "client.hpp"

#include <loglet/loglet.hpp>

#define LOGLET_CURRENT_MODULE "client"

static void process_rtcm(const Config& config, lpp::Message message) {
INFOF("processing RTCM message");
}

static void process_spartn_old(const Config& config, lpp::Message message) {
INFOF("processing SPARTN_OLD message");
}

static void process_spartn(const Config& config, lpp::Message message) {
INFOF("processing SPARTN message");
}

static void process_xer(const Config& config, lpp::Message message) {
INFOF("processing XER message");
}

static void process_uper(const Config& config, lpp::Message message) {
INFOF("processing UPER message");
}

static void process_lpp_rtcm(const Config& config, lpp::Message message) {
INFOF("processing LPP_RTCM message");
}

void process_assistance_data(const Config& config, lpp::Message message) {
INFOF("received assistance data");

switch (config.output_format) {
case OutputFormat::RTCM: process_rtcm(config, std::move(message)); break;
case OutputFormat::SPARTN_OLD: process_spartn_old(config, std::move(message)); break;
case OutputFormat::SPARTN: process_spartn(config, std::move(message)); break;
case OutputFormat::XER: process_xer(config, std::move(message)); break;
case OutputFormat::UPER: process_uper(config, std::move(message)); break;
case OutputFormat::LPP_RTCM: process_lpp_rtcm(config, std::move(message)); break;
}
}
6 changes: 6 additions & 0 deletions examples/client/client.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#pragma once
#include "config.hpp"

#include <lpp/message.hpp>

void process_assistance_data(const Config& config, lpp::Message message);
18 changes: 18 additions & 0 deletions examples/client/config.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#pragma once
#include <lpp/assistance_data.hpp>
#include <supl/cell.hpp>

enum class OutputFormat {
RTCM,
SPARTN_OLD,
SPARTN,
XER,
UPER,
LPP_RTCM,
};

struct Config {
lpp::RequestAssistanceData::Type assistance_data_type;
supl::Cell cell;
OutputFormat output_format;
};
Loading

0 comments on commit 6c64f84

Please sign in to comment.