# Copyright (C) 2015-2021 Swift Navigation Inc.
# Contact: https://support.swiftnav.com
#
# This source is subject to the license found in the file 'LICENSE' which must
# be distributed together with this source. All other rights reserved.
#
# THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
# EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.

package: swiftnav.sbp.base
description: Base definition of SBP message container.
render_source: False
stable: True
include:
  - types.yaml
definitions:

 - SBP:
    desc: >
      Packet structure for Swift Navigation Binary Protocol (SBP).
      Definition of the over-the-wire message framing format and packet
      structure for Swift Navigation Binary Protocol (SBP), a minimal
      binary protocol for communicating with Swift devices. It is used
      to transmit solutions, observations, status and debugging
      messages, as well as receive messages from the host operating
      system.
    fields:
        - preamble:
            type: u8
            desc: Denotes the start of frame transmission. For v1.0, always 0x55
        - msg_type:
            type: u16
            desc: Uniquely identifies the type of the payload contents
        - sender:
            type: u16
            desc: >
              A unique identifier of the sending hardware. For v1.0,
              set to the 2 least significant bytes of the device serial
              number
        - length:
            type: u8
            units: bytes
            desc: Byte-length of the payload field
        - payload:
            type: bytes
            size_fn: length
            desc: >
              Binary data of the message, as identified by Message Type and
              Length. Usually contains the in-memory binary representation of
              a C struct (see documentation on individual message types)
        - crc:
            type: u16
            desc: >
              Cyclic Redundancy Check (CRC) of the packet's binary data from
              the Message Type up to the end of Payload (does not include the
              Preamble)
