Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
192 changes: 105 additions & 87 deletions HOWTO.md

Large diffs are not rendered by default.

139 changes: 81 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
## Specification and Bindings for Swift Binary Protocol
# Specification and Bindings for Swift Binary Protocol

<!-- toc -->

- [Installing sbp2json, json2sbp, json2json and related tools](#installing-sbp2json-json2sbp-json2json-and-related-tools)
- [Building / installing](#building--installing)
* [Using Docker](#using-docker)
+ [Fetching the prebuilt image from DockerHub](#fetching-the-prebuilt-image-from-dockerhub)
+ [Creating your own image](#creating-your-own-image)
+ [Using the docker image](#using-the-docker-image)
* [Installing from package managers](#installing-from-package-managers)
* [Installing development Python versions](#installing-development-python-versions)
* [Adding development version as a pip dependency](#adding-development-version-as-a-pip-dependency)
* [Installing from source](#installing-from-source)
- [SBP Development Procedures](#sbp-development-procedures)
- [SBP Protocol Specification](#sbp-protocol-specification)
- [JSON Schema Definitions](#json-schema-definitions)
- [Kaitai Struct Format Descriptions](#kaitai-struct-format-descriptions)
- [LICENSE](#license)
- [Specification and Bindings for Swift Binary Protocol](#specification-and-bindings-for-swift-binary-protocol)
- [Installing sbp2json, json2sbp, json2json and related tools](#installing-sbp2json-json2sbp-json2json-and-related-tools)
- [Building / installing](#building--installing)
- [Using Docker](#using-docker)
- [Fetching the prebuilt image from DockerHub](#fetching-the-prebuilt-image-from-dockerhub)
- [Creating your own image](#creating-your-own-image)
- [Using the docker image](#using-the-docker-image)
- [Installing from package managers](#installing-from-package-managers)
- [Installing development Python versions](#installing-development-python-versions)
- [Adding development version as a pip dependency](#adding-development-version-as-a-pip-dependency)
- [Installing from source](#installing-from-source)
- [SBP Development Procedures](#sbp-development-procedures)
- [SBP Protocol Specification](#sbp-protocol-specification)
- [JSON Schema Definitions](#json-schema-definitions)
- [Kaitai Struct Format Descriptions](#kaitai-struct-format-descriptions)
- [Notes on python bindings](#notes-on-python-bindings)
- [LICENSE](#license)

<!-- tocstop -->

Expand All @@ -32,19 +34,19 @@ messages used with SBP, a compiler for generating message bindings, and client
libraries in a variety of languages. This repository is organized into the
following directory structure:

* [`docs`](./docs): Protocol documentation and message definitions.
* [`spec`](./spec): Machine readable protocol specification in
- [`docs`](./docs): Protocol documentation and message definitions.
- [`spec`](./spec): Machine readable protocol specification in
[YAML](http://en.wikipedia.org/wiki/YAML).
* [`generator`](./generator): Simple, template-based generator for
- [`generator`](./generator): Simple, template-based generator for
different languages.
* [`python`](./python): Python client and examples.
* [`c`](./c): C client library and examples.
* [`haskell`](./haskell): Haskell client and examples.
* [`java`](./java): Java client library and examples.
* [`javascript`](./javascript): JavaScript client library and examples.
* [`rust`](./rust): Rust client library and examples.
* [`sbpjson`](./sbpjson): Tools for parsing SBP-JSON.
* [`kaitai`](./kaitai): Kaitai Struct Format Description and generated code.
- [`python`](./python): Python client and examples.
- [`c`](./c): C client library and examples.
- [`haskell`](./haskell): Haskell client and examples.
- [`java`](./java): Java client library and examples.
- [`javascript`](./javascript): JavaScript client library and examples.
- [`rust`](./rust): Rust client library and examples.
- [`sbpjson`](./sbpjson): Tools for parsing SBP-JSON.
- [`kaitai`](./kaitai): Kaitai Struct Format Description and generated code.

Except for the `generator`, all of the above are generated and should not be modified directly.

Expand Down Expand Up @@ -72,7 +74,7 @@ your platform.
To install from source, you can use Rust's cargo tool (first [install
Rust](https://www.rust-lang.org/tools/install)), then run:

```
```sh
cargo install --git https://github.com/swift-nav/libsbp.git --bins
```

Expand All @@ -87,13 +89,13 @@ tool as well as a `sbp2prettyjson` tool.
Finally, a Python version of the `sbp2json` tool exists, which is installable
on any platform that supports Python via pip, e.g.:

```
```sh
pip3 install sbp
```

The tool can then be invoked as follows:

```
```sh
python3 -m sbp2json <sbp.bin
```

Expand All @@ -103,9 +105,11 @@ but works on all platforms that Python itself supports.
## Building / installing

Before you start, run
```

```sh
git pull --tags
```

in you local libsbp repository to pull the tags. This will ensure the correct
version number is generated.

Expand All @@ -119,14 +123,18 @@ Start [Docker desktop](https://docs.docker.com/docker-for-mac/).
The quickest method to get going is to just pull a prebuilt copy from DockerHub
(no guarantees on freshness) by running the following on your command line:

docker run --rm -v $PWD:/mnt/workspace -i -t swiftnav/libsbp-build:2025-02-10 /bin/bash
```sh
docker run --rm -v $PWD:/mnt/workspace -i -t swiftnav/libsbp-build:2025-02-10 /bin/bash
```

This will mount your local copy of the libsbp repository onto the image.

Check this [link](https://hub.docker.com/r/swiftnav/libsbp-build/tags) for newer tags.
Check libsbp-build [dockerhub page](https://hub.docker.com/r/swiftnav/libsbp-build/tags) for newer tags.
Alternatively, you could run

docker run --rm -v $PWD:/mnt/workspace -i -t swiftnav/libsbp-build:latest-master /bin/bash
```sh
docker run --rm -v $PWD:/mnt/workspace -i -t swiftnav/libsbp-build:latest-master /bin/bash
```

if you are facing issues with compilation and the tags are out of date as well.

Expand All @@ -136,18 +144,24 @@ Otherwise, the `Dockerfile` will create a docker image that contains all the
necessary dependencies to build libsbp. You can make a local image fresh from
this file by running `docker build` as such:

docker build -t libsbp-build - <Dockerfile
```sh
docker build -t libsbp-build - <Dockerfile
```

Reading the Dockerfile from STDIN prevents docker from pulling in the whole
repostory into the build context (which is then immediately discarded anyway).
You can customize the UID of the user that's created with the docker image
by passing the desired `UID` value to the build:

```sh
docker build -t libsbp-build --build-arg UID=1234 - <Dockerfile
```

You can then make this image operate on your local workspace like this:

docker run --rm -v $PWD:/mnt/workspace -i -t libsbp-build:latest /bin/bash
```sh
docker run --rm -v $PWD:/mnt/workspace -i -t libsbp-build:latest /bin/bash
```

#### Using the docker image

Expand All @@ -158,12 +172,16 @@ This could take several hours to run. Alternately, the docker image will run
the `make all` command by default, so you can kick off the `make all` process
by simply running the following command:

docker run --rm -v $PWD:/mnt/workspace -i -t libsbp-build:2025-02-10
```sh
docker run --rm -v $PWD:/mnt/workspace -i -t libsbp-build:2025-02-10
```

To speed up this process you can attempt to run Python environment tests in
paralell with:

docker run --rm -v $PWD:/mnt/workspace -i -t -e SBP_TOX_PARALLEL=auto libsbp-build:2025-02-10
```sh
docker run --rm -v $PWD:/mnt/workspace -i -t -e SBP_TOX_PARALLEL=auto libsbp-build:2025-02-10
```

When you are finished, quit Docker so that it would not unnecessarily use up
resources on your machine.
Expand All @@ -177,9 +195,9 @@ issues from an old build.

Some bindings are available on package managers:

* [`python`](https://github.com/swift-nav/libsbp/tree/HEAD/python): available on pip
* [`haskell`](https://github.com/swift-nav/libsbp/tree/HEAD/haskell): available on Hackage
* [`javascript`](https://github.com/swift-nav/libsbp/tree/HEAD/javascript): available on NPM
- [`python`](https://github.com/swift-nav/libsbp/tree/HEAD/python): available on pip
- [`haskell`](https://github.com/swift-nav/libsbp/tree/HEAD/haskell): available on Hackage
- [`javascript`](https://github.com/swift-nav/libsbp/tree/HEAD/javascript): available on NPM

### Installing development Python versions

Expand All @@ -190,6 +208,7 @@ pip install 'file:///path/to/libsbp#subdirectory=python'
```

Or via setuptools directly:

```sh
cd /path/to/libsbp
cd python
Expand All @@ -199,31 +218,35 @@ python setup.py
### Adding development version as a pip dependency

Run the following command:

```sh
pip install "git+https://github.com/swift-nav/libsbp@<GIT_REVISION>#egg=sbp&subdirectory=python"
```

Or add this to `requirements.txt`:
```

```sh
git+https://github.com/swift-nav/libsbp@<GIT_REVISION>#egg=sbp&subdirectory=python
```

### Installing from source

You can build one binding at a time or update all at once:

```
```sh
make python
```

or

```
```sh
make all
```

are both valid. To see a list of all valid targets, run `make help`.

**Python version notes:**

1. By default the Python targets `make python` and `make test-python` (as well
as `make all`) run tests on all Python versions officially supported by *the
libsbp Python bindings*, currently **3.6-3.9**, skipping any versions not
Expand Down Expand Up @@ -256,7 +279,7 @@ detection.

Please see [the docs](docs/sbp.pdf) for a full description of the packet
structure and the message types. Developer documentation for the
language-specific sbp libraries is [here](http://swift-nav.github.io/libsbp/).
language-specific sbp libraries is available at [http://swift-nav.github.io/libsbp/](http://swift-nav.github.io/libsbp/).
Please refer to [the changelog](CHANGELOG.md) for more information about the
evolution of the library and its messages.

Expand All @@ -281,19 +304,19 @@ respectively.
The Kaitai Struct format description files can also potentially be used to
generate bindings for the following targets:

* graphviz
* csharp
* rust
* java
* go
* cpp_stl
* php
* lua
* nim
* html
* ruby
* construct
* javascript
- graphviz
- csharp
- rust
- java
- go
- cpp_stl
- php
- lua
- nim
- html
- ruby
- construct
- javascript

### Notes on python bindings

Expand Down
38 changes: 38 additions & 0 deletions c/include/libsbp/cpp/message_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -6438,6 +6438,44 @@ struct MessageTraits<sbp_msg_ssr_code_phase_biases_bounds_t> {
}
};

template <>
struct MessageTraits<sbp_msg_ssr_flag_high_level_dep_a_t> {
static constexpr sbp_msg_type_t id = SbpMsgSsrFlagHighLevelDepA;
static constexpr const char *name = "MSG_SSR_FLAG_HIGH_LEVEL_DEP_A";
static const sbp_msg_ssr_flag_high_level_dep_a_t &get(const sbp_msg_t &msg) {
return msg.ssr_flag_high_level_dep_a;
}
static sbp_msg_ssr_flag_high_level_dep_a_t &get(sbp_msg_t &msg) {
return msg.ssr_flag_high_level_dep_a;
}
static void to_sbp_msg(const sbp_msg_ssr_flag_high_level_dep_a_t &msg,
sbp_msg_t *sbp_msg) {
sbp_msg->ssr_flag_high_level_dep_a = msg;
}
static sbp_msg_t to_sbp_msg(const sbp_msg_ssr_flag_high_level_dep_a_t &msg) {
sbp_msg_t sbp_msg;
sbp_msg.ssr_flag_high_level_dep_a = msg;
return sbp_msg;
}
static s8 send(sbp_state_t *state, u16 sender_id,
const sbp_msg_ssr_flag_high_level_dep_a_t &msg,
sbp_write_fn_t write) {
return sbp_msg_ssr_flag_high_level_dep_a_send(state, sender_id, &msg,
write);
}
static s8 encode(uint8_t *buf, uint8_t len, uint8_t *n_written,
const sbp_msg_ssr_flag_high_level_dep_a_t &msg) {
return sbp_msg_ssr_flag_high_level_dep_a_encode(buf, len, n_written, &msg);
}
static s8 decode(const uint8_t *buf, uint8_t len, uint8_t *n_read,
sbp_msg_ssr_flag_high_level_dep_a_t *msg) {
return sbp_msg_ssr_flag_high_level_dep_a_decode(buf, len, n_read, msg);
}
static size_t encoded_len(const sbp_msg_ssr_flag_high_level_dep_a_t &msg) {
return sbp_msg_ssr_flag_high_level_dep_a_encoded_len(&msg);
}
};

template <>
struct MessageTraits<sbp_msg_ssr_flag_high_level_t> {
static constexpr sbp_msg_type_t id = SbpMsgSsrFlagHighLevel;
Expand Down
1 change: 1 addition & 0 deletions c/include/libsbp/integrity.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <libsbp/integrity/IntegritySSRHeader.h>
#include <libsbp/integrity/MSG_ACKNOWLEDGE.h>
#include <libsbp/integrity/MSG_SSR_FLAG_HIGH_LEVEL.h>
#include <libsbp/integrity/MSG_SSR_FLAG_HIGH_LEVEL_DEP_A.h>
#include <libsbp/integrity/MSG_SSR_FLAG_IONO_GRID_POINTS.h>
#include <libsbp/integrity/MSG_SSR_FLAG_IONO_GRID_POINT_SAT_LOS.h>
#include <libsbp/integrity/MSG_SSR_FLAG_IONO_TILE_SAT_LOS.h>
Expand Down
9 changes: 7 additions & 2 deletions c/include/libsbp/integrity/MSG_SSR_FLAG_HIGH_LEVEL.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,14 @@ typedef struct {
sbp_gps_time_sec_t obs_time;

/**
* GNSS reference time of the correction associated to the flag.
* GNSS reference time of the ionospheric correction associated to the flag.
*/
sbp_gps_time_sec_t corr_time;
sbp_gps_time_sec_t iono_corr_time;

/**
* GNSS reference time of the satellite correction associated to the flag.
*/
sbp_gps_time_sec_t sat_corr_time;

/**
* SSR Solution ID.
Expand Down
Loading
Loading