diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..e241b25 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,277 @@ +# sbgECom Library version 3.1.2358-stable + +The sbgECom C library is used to configure and communicate with [SBG Systems](https://www.sbg-systems.com/) IMU, AHRS and INS.\ +This change log lists all modifications for each released sbgECom library version. + +Change log issued on: 2022-01-13 + +Copyright (C) 2022, SBG Systems SAS. All rights reserved. + +## Summary + +The sbgECom 3.2.96-dev release adds support to latest ELLIPSE 2.3 firmware that comes with new configurations and output logs.\ +It also adds two new commands sbgEComCmdApiGet and sbgEComCmdApiPost to support the new [sbgInsRestApi](https://developer.sbg-systems.com/sbgInsRestApi/) over serial interfaces. + +A new extended sbgECom frame format has been introduced to support large payloads.\ +This new format is fully backward compatible and your code, as well as older firmware, should still work with this new sbgECom implementation. + +New tools and examples have been added to ease product evaluation and integration. + +This release also improves the overall code quality, documentation and examples. + +## Import Highlights for this release + +Please find below, the main improvements and modifications: + - Support for latest ELLIPSE firmware + - Support for new sbgInsRestApi GET/POST commands + - New sbgEComBasicLogger tool to convert logs to CSV files + - New sbgEComApi tool to use the sbgInsRestApi from command line + - Improved sbgECom frame for large payloads + - Improved ELLIPSE on-board magnetic calibration example + - Improve code quality + - First version published on github + +## Release - 3.1.2358-stable + +### New Features + - [SBGECOM-225] - Added KMB binary sensor output log for High Performance INS + - [SBGECOM-226] - Add a new log SBG_ECOM_LOG_RTCM_STREAM + - [SBGECOM-228] - Add new commands to implement GET/POST over sbgECom protocol + - [SBGECOM-229] - Now ELLIPSE-N and D can accept RTCM corrections over Port A + - [SBGECOM-231] - Add support for NMEA PPS frames + - [SBGECOM-253] - Add specific NMEA like output log WASSP + - [SBGECOM-279] - Add in SBG_ECOM_CMD_ADVANCED_CONF a GNSS option bitmask + - [SBGECOM-281] - Add a new sbgBasicLogger command line tool + - [SBGECOM-282] - Add a sbgEComApi CLI tool to access sbgInsRestApi over sbgECom + - [SBGECOM-283] - Add a minimal sbgECom example for PULSE IMU + - [SBGECOM-285] - Add in SBG_ECOM_CMD_ADVANCED_CONF an option to always output time in NMEA messages + - [SBGECOM-286] - Add in SBG_ECOM_CMD_ADVANCED_CONF an option select standard or extended NMEA mode + +### Improvements + - [SBGECOM-181] - Reduce stack usage and use new sbgEComReceiveCmd2 + - [SBGECOM-220] - Updated license to MIT + - [SBGECOM-232] - Updated protocol to support large transfer using multiple pages + - [SBGECOM-287] - Updated sbgEComSetReceiveLogCallback to remove the unused SbgErrorCode return + - [SBGECOM-301] - Improved ELLIPSE onboard magnetic calibration code example + - [SBGECOM-302] - Added new sbgEComPurgeIncoming method to discard rx data + - [SBGECOM-303] - Improved examples, they now use simple CLI arguments + +### Bug Fixes + - [SBGECOM-265] - Add missing 25ms period to output log message definitions + - [SBGECOM-267] - Add missing 40ms period to output log message definitions + - [SBGECOM-284] - Receive a command must not be blocking when timeout = 0 + - [SBGECOM-289] - Fix SBG_ECAN_MSG_GPS#_ALT NUM_SV & DIFF_CORR DBC/DBF definitions + +## Release - 2.0.4536-stable + +### New Features + - [SBGECOM-180] - Added NMEA GGK message output + - [SBGECOM-191] - Added in SBG_ECOM_LOG_GPS#_POS status report for all GNSS constellations + - [SBGECOM-194] - Add specific SBG_ECOM_THIRD_PARTY_ADA_01 output log + - [SBGECOM-208] - Added a README.md file with migration guidelines + - [SBGECOM-216] - Add Cobham SBG_ECOM_THIRD_PARTY_AT_ITINS output log support + - [SBGECOM-219] - Added CAN dbc and BusMaster definitions in sbgECom project +### Improvements + - [SBGECOM-188] - Updated SBG_ECAN_MSG_ODO_VELOCITY from float field to integers + - [SBGECOM-196] - Added status field for SBG_ECAN_MSG_AUTO_TRACK_SLIP_CURV (0x220) message + - [SBGECOM-199] - Simplified SbgEComGnssModelsStdIds enum for ELLIPSE-N and ELLIPSE-D + - [SBGECOM-204] - Renamed SBG_ECOM_GNSS_MODEL_UBLOX_GPS_GLONASS to SBG_ECOM_GNSS_MODEL_INTERNAL + - [SBGECOM-207] - Reworked motion profile / aiding equipments errors models set/get API (removed SbgEComModelInfo) + - [SBGECOM-209] - Reworked and simplified GNSS model ids to comply with sbgECom 2.x + - [SBGECOM-212] - Added in SBG_ECOM_CMD_FEATURES gnss firmware version field +### Removed Features + - [SBGECOM-200] - Removed SBG_ECOM_GNSS_MODEL_UBLOX_HIGH_DYNAMICS, use SBG_ECOM_GNSS_MODEL_INTERNAL instead + - [SBGECOM-201] - Removed SBG_ECOM_GNSS_MODEL_ELLIPSE_D_INTERNAL, use SBG_ECOM_GNSS_MODEL_INTERNAL instead + - [SBGECOM-202] - Removed SBG_ECOM_GNSS_MODEL_UBLOX_HIGH_SPEED, use SBG_ECOM_GNSS_MODEL_INTERNAL instead + - [SBGECOM-203] - Removed SBG_ECOM_GNSS_MODEL_UBLOX_LOW_SPEED, use SBG_ECOM_GNSS_MODEL_INTERNAL instead + - [SBGECOM-206] - Removed deprecated methods sbgEComCmdGnss1GetLeverArmAlignment & sbgEComCmdGnss1SetLeverArmAlignment + - [SBGECOM-211] - Removed legacy IG-500 protocol support + +## Release - 1.11.920-stable + +### New Features + - [SBGECOM-123] - Implement DVL aiding configuration SBG_ECOM_CMD_DVL_#### + - [SBGECOM-126] - Implement AirData aiding configuration SBG_ECOM_CMD_AIRDATA_#### + - [SBGECOM-135] - Add configuration commands for CAN odometer support + - [SBGECOM-136] - Add sbgECom Log Event Output useful for virtual odometer + - [SBGECOM-137] - Add SBG_ECOM_LOG_DEPTH / SBG_ECAN_MSG_DEPTH_INFO/ALTITUDE output logs + - [SBGECOM-140] - Updated SBG_ECOM_CMD_AIDING_ASSIGNMENT command for AirData support + - [SBGECOM-141] - Add airDataInput demo project to show external sbgECom AirData aiding + - [SBGECOM-142] - Updated SBG_ECOM_LOG_PRESSURE to SBG_ECOM_LOG_AIR_DATA with airspeed + - [SBGECOM-143] - Updated SBG_ECAN_MSG_PRESSURE to SBG_ECAN_MSG_AIR_DATA with airspeed + - [SBGECOM-156] - Add baseline length field in SBG_ECOM_LOG_GPS#_HDT log + - [SBGECOM-162] - Add SBG_ECOM_LOG_DIAG message to send text + - [SBGECOM-163] - Add CAN output message with vehicle body velocity + - [SBGECOM-164] - Add CAN output message with track, slip and curvature indications + - [SBGECOM-168] - Add INDYN NMEA like message output for marine applications + - [SBGECOM-170] - Add SBG_ECOM_CMD_GNSS_1_INSTALLATION command to set/get GNSS lever arm + - [SBGECOM-173] - Add compatibility support Crossbow AHRS500 series + - [SBGECOM-174] - Basic Logger: Add support for error log messages + - [SBGECOM-175] - Basic Logger: Add support for UDP interfaces + +### Improvements + - [SBGECOM-132] - Updated SBG_ECOM_CMD_AIDING_ASSIGNMENT command for DVL support + - [SBGECOM-133] - Renamed DVL standard deviation as quality indicator in DVL log structure + - [SBGECOM-144] - Converted SBG_ECOM_AIDING_EM_LOG_RECV to SBG_ECOM_AIDING_DEPTH_RECV + - [SBGECOM-145] - Renamed SBG_ECOM_AIDING_PRESSURE_RECV to SBG_ECOM_AIDING_AIR_DATA_RECV + - [SBGECOM-146] - Renamed SBG_ECOM_SOL_PRESSURE_USED to SBG_ECOM_SOL_AIR_DATA_USED + - [SBGECOM-147] - Added SBG_ECOM_SOL_DEPTH_USED in EKF solution status + - [SBGECOM-165] - Updated CAN log default IDs for Ship Motion HP from 0x210 to 0x14A + - [SBGECOM-169] - Updated SBG_ECOM_THIRD_PARTY_IXBLUE_XXX logs to comply with naming conventions + - [SBGECOM-176] - Minor code cleanup and removed useless defines + - [SBGECOM-177] - Updated all C types to use standard ones uint32 -> uint32_t + - [SBGECOM-178] - Updated common lib code with improved organization + +### Removed Features + - [SBGECOM-100] - Removed deprecated sbgEComSetReceiveCallback method + - [SBGECOM-101] - Removed deprecated sbgEComCmdGnss1SetModel method + - [SBGECOM-102] - Removed deprecated sbgEComCmdSensorSetMotionProfile method + - [SBGECOM-103] - Removed deprecated sbgEComCmdMagSetModel method + - [SBGECOM-171] - SBG_ECOM_CMD_GNSS_1_LEVER_ARM_ALIGNMENT deprecated and replaced by SBG_ECOM_CMD_GNSS_1_INSTALLATION + +## Release - 1.10.3692-stable + +### New Features + - [SBGECOM-115] - Add Septentrio Internal GNSS model for new Ellipse D + - [SBGECOM-117] - Added getters for delta a angle / velocity / temperature for IMU Short log + - [SBGECOM-119] - Added new Swell Mode Ship Motion status flags + +### Improvements + - [SBGECOM-118] - Improved sbgEComStartFrameGeneration & sbgEComFinalizeFrameGeneration methods + - [SBGECOM-122] - Increased time out for sbgEComCmdLicenseApply to support new ELLIPSE-D internal GNSS + +## Release - 1.9.706-stable + +### New Features + - [SBGECOM-110] - Added DOLOG HRP proprietary message + - [SBGECOM-111] - Added a new short IMU log message also used for post processing + - [SBGECOM-112] - Add a heavy machinery motion profile definition for Ellipse series + +### Bug Fixes + - [SBGECOM-113] - Fixed invalid SBG_ECOM_CAN_RX/TX_OK comments + +## Release - 1.8.2916-stable + +### New Features + - [SBGECOM-95] - Added GPS number of SV used and diff corrections details in sbgECan protocol + - [SBGECOM-105] - Add compatibility with SBG_ECOM_CMD_VALIDITY_THRESHOLDS command + - [SBGECOM-108] - Added support for aiding assignment on Port E for ELLIPSE-E and N + +### Improvements + - [SBGECOM-91] - Added sbgEComSetCmdTrialsAndTimeOut to setup the number of trials and default time out for commands + +## Release - 1.7.235-stable + +### New Features + - [SBGECOM-89] - Implement Kongsberg Binary 26 message output + - [SBGECOM-87] - Add an uptime indication in SBG_ECOM_LOG_STATUS + - [SBGECOM-86] - Added the command SBG_ECOM_CMD_ETHERNET_INFO to current device IP address + - [SBGECOM-85] - Added command SBG_ECOM_CMD_ETHERNET_CONF to define / retrieve the Ethernet configuration + - [SBGECOM-77] - Add new output log class for NMEA proprietary messages + - [SBGECOM-75] - Added UAV motion profile definition (for low dynamic rotary wing UAV applications) + +### Improvements + - [SBGECOM-83] - Better use of size_t type instead of uint32 to comply with C standard and 64 bit platforms + - [SBGECOM-84] - Updated sbgCommonLib to latest revision + +### Removed Features + - [SBGECOM-79] - Removed deprecated "course" from the GNSS configurable aiding sources + +## Release - 1.5.209-stable + +### New Features + - [SBGECOM-72] - Added proprietary NMEA message PASHR for roll, pitch, heading, heave + - [SBGECOM-70] - Added SBG Proprietary NMEA message with acceleration and angular rate + - [SBGECOM-68] - Added SBG_ECOM_OUTPUT_MODE_DIV_5 flag for 40 Hz output + - [SBGECOM-66] - Added SBG_ECOM_GENERAL_CPU_OK status flag + - [SBGECOM-65] - Added sbgEComHandleOneLog method to return even if more logs are available + - [SBGECOM-64] - Added sbgEComSendAck method + - [SBGECOM-62] - Added sbgEComStartFrameGeneration and sbgEComFinalizeFrameGeneration methods + - [SBGECOM-59] - Added sbgECom log generation code + - [SBGECOM-57] - Added SBG_ECOM_LOG_FAST_IMU_DATA message definition + - [SBGECOM-40] - Added KVH third party output format id (SBG_ECOM_THIRD_PARTY_KVH) + +### Improvements + - [SBGECOM-74] - Switched unix projects to CMake + - [SBGECOM-73] - Added examples into the sbgECom + - [SBGECOM-63] - Updated sbgCommonLib to latest revision + - [SBGECOM-61] - Use stream buffer instead of basic buffer for sbgECom log parsing + - [SBGECOM-51] - Added SBF (Septentrio) protocol support on Ellipse-E + - [SBGECOM-50] - Added direct PPS from internal GNSS Sync Output (SBG_ECOM_CMD_SYNC_OUT_CONF) + - [SBGECOM-47] - Made the sbgECom 64 bit compatible + - [SBGECOM-46] - Switched project files to Visual Studio 2013 + - [SBGECOM-45] - Added a new callback method (sbgEComSetReceiveLogCallback) and deprecated the old one (sbgEComSetReceiveCallback) + - [SBGECOM-42] - Improved handling of MSG and CLASS fields in low level protocol functions + +### Bug Fixes + - [SBGECOM-71] - Fixed sbgEComCmdGetInfo incorrect error code return when an invalid payload is received + - [SBGECOM-44] - Fixed Various incompatibilities in Big Endian platforms + - [SBGECOM-43] - Added output of NACK reasons in sbgECom configuration commands using the return code + +### Removed Features + - [SBGECOM-60] - Removed Ship Motion 1,2,3 and Ship Motion HP 1,2,3 due to new deported heave concepts + +## Release - 1.4.3239-stable + +### New Features + - [SBGECOM-28] - Added differential correction age, diff base id and num sv to the SBG_ECOM_LOG_GPS#_POS + - [SBGECOM-29] - Added GNSS raw data log for the second GNSS receiver + - [SBGECOM-30] - Added official support for Ellipse additional output interfaces PORT C and PORT E + - [SBGECOM-33] - Added big/little endian support for stream buffer + - [SBGECOM-34] - Added sbgPlatform.h file to setup platform specific configuration such as endianness + +### Improvements + - [SBGECOM-7] - Added support for both little and big endian platforms + - [SBGECOM-32] - Improved stream buffer error handling + - [SBGECOM-36] - Improved File naming and overall library organization + - [SBGECOM-37] - Modified firmware and software version numbering scheme + - [SBGECOM-38] - Increased raw GPS data buffer size from 2048 to 4096 bytes + +### Bug Fixes + - [SBGECOM-21] - Fixed SBG_ECOM_ETH#_RX_OK and SBG_ECOM_ETH#_TX_OK status definitions + - [SBGECOM-27] - Changed sbgEComHandle behavior so the error returned by receive call back is taken into account + - [SBGECOM-35] - Fixed improper comments in some configuration structures + +## Release - 1.3 + +### New Features + - [SBGECOM-10] - Added sbgInterfaceChangeBaudrate for both windows and unix platforms + - [SBGECOM-19] - Added SBG_ECOM_LOG_PRESSURE log for depth sensors and altimeters + - [SBGECOM-25] - Added support for Ellipse series + - [SBGECOM-26] - Added SBG_ECOM_LOG_USBL log for USBL aiding equipments (beta) + +### Improvements + - [SBGECOM-18] - Fixed Typos in GPS pos, Vel and Hdt Fix Status + - [SBGECOM-20] - Better error checking for sbgStreamBuffer with new method sbgStreamBufferGetLastError + - [SBGECOM-22] - Added UTC & Clock status to the binary log SbgLogUtcData + - [SBGECOM-23] - Added Solution status to the binary log SbgLogEkfEuler, SbgLogEkfQuat, SbgLogEkfNav + - [SBGECOM-24] - Added time stamp to the log SBG_ECOM_LOG_MAG_CALIB + + +## Release - 1.2 + +### New Features + - [SBGECOM-14] - Added SBG_ECOM_LOG_SHIP_MOTION_HP logs for delayed heave output + - [SBGECOM-15] - Added sbgInterfaceSerialChangeBaudrate method to change the serial interface baud rate + - [SBGECOM-17] - Added SBG_ECOM_POS_FIXED / SBG_ECAN_POS_FIXED position type for GPS + +### Improvements + - [SBGECOM-13] - Updated SBG_ECOM_LOG_SHIP_MOTION_XXX logs to add velocity and status data + - [SBGECOM-16] - Changed GPS OmniStar solution type to PPP ones for better compatibility with third party GPS + +### Removed Features + - [SBGECOM-11] - Removed heave status field from SBG_ECOM_LOG_STATUS log + +## Release - 1.1 + +### New Features + - [SBGECOM-1] - Added output log for DVL support + - [SBGECOM-3] - Added output for GPS 1 raw data in order to support post processing + - [SBGECOM-4] - Added event markers logs support + - [SBGECOM-6] - Added Unix support and build script + - [SBGECOM-8] - Added sbgEComReceiveAnyCmd method that return any received command that is not an output log + - [SBGECOM-9] - Added settings import and export command + +### Improvements + - [SBGECOM-2] - Added pitch information in the SbgLogGpsHdt GPS true heading log + - [SBGECOM-5] - Now sbgEComProtocolReceive method returns the received command even if the CRC is not valid diff --git a/LICENSE b/LICENSE.md similarity index 90% rename from LICENSE rename to LICENSE.md index 4e46acc..d680467 100644 --- a/LICENSE +++ b/LICENSE.md @@ -1,6 +1,7 @@ -MIT License +# sbgECom License +The MIT License (MIT) -Copyright (c) 2022 SBG Systems +Copyright (C) 2022, SBG Systems SAS. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -18,4 +19,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..7b32952 --- /dev/null +++ b/README.md @@ -0,0 +1,153 @@ +# Welcome to the sbgECom C library version 3.1 +sbgECom is a C library provided under the MIT License and used to interface easily [SBG Systems](https://www.sbg-systems.com/) IMU, AHRS and INS to your application. + +This library has been designed to be platform and OS independent and can safely be used on small micro-controller or larger multi-core CPUs.\ +This package contains the following items: + - sbgECom library full C source code + - Doxygen library source code documentation + - Examples C source code and binaries to quickly start using the sbgECom library + - Several useful tools provided as binary package + +The sbgECom library and examples can be compiled on any platform using CMake.\ +The pre-compiled sbgECom examples and tools are 64 bits binaries available on Windows, Linux and Mac OS X platforms. + +The library is written and maintained by SBG Systems SAS. You can contact the support@sbg-systems.com for if you need assistance. + +# Platform support +The library has been designed to be easily ported to any platform by just providing/implementing a few low level methods and some configuration: + - The platform configuration is set in `common/sbgConfig.h` + - In the file `common/platform/sbgPlatform.c` please provide _sbgGetTime_, _sbgSleep_ and _sbgPlatformDebugLogMsg_ + - In the directory `common/interfaces/` you can provide custom open/read/write implementations for serial communications + +# Building sbgECom Library +The sbgECom library and code examples are very easy to compile on any platform using CMake.\ +The library has no third party library dependencies making it very easy to build. + +SBG Systems doesn't provide the sbgECom as a pre-compiled library for obvious and good reasons. + +## Dependencies +SBG Systems has validated the following toolchain: +- \>= CMake 3.0 +- \>= GNU GCC 8 (any platform) +- \>= AppleClang 13 (Mac OS X) +- \>= Visual Studio 2015 or MSBuild equivalent (Windows) + +## Building sbgECom +To build the sbgECom and C examples, go to the sbgECom library folder and type the following commands. + +```sh +mkdir build +cd build +cmake ../cmake +cmake --build . +``` + +You should find the sbgECom static library and examples binaries in the `bin/Debug` folder. + +# Code Examples +SBG Systems provides several and simple C code examples to quickly use the sbgECom library. +You can find both the source code as well as a binary for each example. + +All examples source code are located in the `examples` directory. You can find pre-compiled 64 bits binaries in the `bin/examples` folder. + +## Ellipse Minimal +Simple C example to illustrate how to connect and read data from an ELLIPSE using the sbgECom library. + +You can test this example using the command below: + +```sh +ellipseMinimal COM4 115200 +``` + +## High Performance INS Minimal +Simple C example to illustrate how to read data from an High Performance INS over an UDP connection and using the sbgECom library. + +You can test this example using the command below. The INS ip address is *192.168.1.1* and send logs on the UDP port *1234*: + +```sh +hpInsMinimal COM4 192.168.1.1 5678 1234 +``` + +## Pulse Minimal +Simple C example to illustrate how to connect and read data from a PULSE IMU using the sbgECom library. + +You can test this example using the command below: + +```sh +pulseMinimal COM4 921600 +``` + +## Ellipse On Board Magnetic Calibration +Simple C example to illustrate how to use the ELLIPSE on board magnetic calibration algorithms. + +You can test this example using the command below: + +```sh +ellipseOnBoardMagCalib COM4 115200 +``` + +## Air Date Input +Simple C example to illustrate how to send air date aiding measurements to an ELLIPSE using the sbgECom library. + +You can test this example using the command below: + +```sh +airDataInput COM4 115200 +``` + +# Command Line Tools +SBG Systems offers two very useful tools to ease evaluation and integration. These tools are located in the `bin/tools` directory. + +> Please read the dedicated README.md files provided with each tool. + +## sbgBasicLogger +Simply parse sbgECom logs from a serial or ethernet interface and write log content to CSV like files. +This tool can also read sbgECom logs from a binary file making it very interesting to convert ELLIPSE datalog to easy to use text files. + +## sbgEComApi +Easily access sbgInsRest API configuration over a serial or UDP interface. You can execute GET and POST queries using simple to use command lines arguments. +This tool is perfect if you would like to setup a High Performance INS product over a serial or ethernet interface and using only bash scripts for example. + +# CAN messages +SBG Systems provides a DBC and BusMaster CAN messages database definition to quickly interface your product with a CAN logger and application. +You can find these CAN database in the `can` directory + +# Migrating from sbgECom v1.x to sbgECom v2.x or above +The sbgECom version 2.x change the C API even if the low level sbgECom protocol API remains backward compatible. +In otherwords, a C code written with sbgECom version 1.x will not compile directly with sbgECom versions 2.x and higher. +But your old C code using sbgECom versions 1.x will still be able to correctly setup and configure your ELLIPSE product. + +## GNSS module +The _SbgEComGnssModelsStdIds_ enum has been simplified and now ELLIPSE-N and ELLIPSE-D should only use _SBG_ECOM_GNSS_MODEL_INTERNAL_ to select the internal GNSS receiver. +The only exception is for ELLIPSE-N hardware revision 1 & 2 as the ublox Max M8 has two modes of operations, either GPS+GLONASS or GPS+BeiDou. The default GPS+GLONASS mode is selected with the _SBG_ECOM_GNSS_MODEL_INTERNAL_ model and the GPS+BeiDou one with _SBG_ECOM_GNSS_MODEL_UBLOX_GPS_BEIDOU_. +The _SBG_ECOM_GNSS_MODEL_UBLOX_GPS_BEIDOU_ model couldn't be used with ELLIPSE-N with hardware revision 3.x or ELLIPSE-D as the GNSS receiver is tracking GPS+GLONASS+BeiDou+Galileo concurrently. + +The table below helps you update your enums to sbgECom v2 correctly: +| sbgECom 1.x | sbgECom 2.x | Remarks | +| ------ | ------ | ------ | +| SBG_ECOM_GNSS_MODEL_UBLOX_GPS_GLONASS | SBG_ECOM_GNSS_MODEL_INTERNAL | To use for ELLIPSE-N and ELLIPSE-D | +| SBG_ECOM_GNSS_MODEL_NMEA | SBG_ECOM_GNSS_MODEL_NMEA | ELLIPSE-E, external NMEA receiver (listen only) | +| SBG_ECOM_GNSS_MODEL_UBLOX_GPS_BEIDOU | SBG_ECOM_GNSS_MODEL_UBLOX_GPS_BEIDOU | Can only be selected on ELLIPSE-N revision 1 & 2 | +| SBG_ECOM_GNSS_MODEL_UBLOX_EXTERNAL | SBG_ECOM_GNSS_MODEL_UBLOX_EXTERNAL | ELLIPSE-E, external ublox receiver (listen only) | +| SBG_ECOM_GNSS_MODEL_UBLOX_HIGH_DYNAMICS | SBG_ECOM_GNSS_MODEL_INTERNAL | For high dynamics applications, please selected the appropriate motion profile | +| SBG_ECOM_GNSS_MODEL_NOVATEL_EXTERNAL | SBG_ECOM_GNSS_MODEL_NOVATEL_EXTERNAL | ELLIPSE-E, external Novatel receiver (listen only) | +| SBG_ECOM_GNSS_MODEL_ELLIPSE_D_INTERNAL | SBG_ECOM_GNSS_MODEL_INTERNAL | Legacy ELLIPSE-D hardware 1 & 2, don't use it anymore | +| SBG_ECOM_GNSS_MODEL_UBLOX_HIGH_SPEED | SBG_ECOM_GNSS_MODEL_INTERNAL | For high speed applications, please selected the appropriate motion profile | +| SBG_ECOM_GNSS_MODEL_SEPTENTRIO_EXTERNAL | SBG_ECOM_GNSS_MODEL_SEPTENTRIO_EXTERNAL | ELLIPSE-E, external Septentrio receiver (listen only) | +| SBG_ECOM_GNSS_MODEL_UBLOX_LOW_SPEED | SBG_ECOM_GNSS_MODEL_INTERNAL | For low dynamics applications, please selected the appropriate motion profile | + +Please also update your code according to the following recommendations and modifications: +- `sbgEComCmdGnss1GetModelInfo` method has been replaced by `sbgEComCmdGnss1GetModelId` with a simpler interface as the version field is no more used in ELLIPSE firmware. +- `sbgEComCmdGnss1GetLeverArmAlignment` and `sbgEComCmdGnss1SetLeverArmAlignment` methods have been suppressed by `sbgEComCmdGnss1InstallationGet` and `sbgEComCmdGnss1InstallationSet` methods. + +## Magnetometers module + +The method `sbgEComCmdMagGetModelInfo` has been replaced by `sbgEComCmdMagGetModelId` with a simpler interface as the version field is no more used in ELLIPSE firmware. + +## Sensor module + +The method `sbgEComCmdSensorGetMotionProfileInfo` has been replaced by `sbgEComCmdSensorGetMotionProfileId` with a simpler interface as the version field is no more used in ELLIPSE firmware. + +## Legacy IG-500 sbgCom + +sbgECom version 2.x drop the legacy IG-500 support so the methods `sbgEComCmdOutputGetLegacyConf` and `sbgEComCmdOutputSetLegacyConf` are removed. Please update your code to use sbgECom protocol instead. diff --git a/can/sbgCan.dbc b/can/sbgCan.dbc new file mode 100644 index 0000000..8650f14 --- /dev/null +++ b/can/sbgCan.dbc @@ -0,0 +1,373 @@ +VERSION "" + + +NS_ : + NS_DESC_ + CM_ + BA_DEF_ + BA_ + VAL_ + CAT_DEF_ + CAT_ + FILTER + BA_DEF_DEF_ + EV_DATA_ + ENVVAR_DATA_ + SGTYPE_ + SGTYPE_VAL_ + BA_DEF_SGTYPE_ + BA_SGTYPE_ + SIG_TYPE_REF_ + VAL_TABLE_ + SIG_GROUP_ + SIG_VALTYPE_ + SIGTYPE_VALTYPE_ + BO_TX_BU_ + BA_DEF_REL_ + BA_REL_ + BA_DEF_DEF_REL_ + BU_SG_REL_ + BU_EV_REL_ + BU_BO_REL_ + SG_MUL_VAL_ + +BS_: + +BU_: + + +BO_ 544 SBG_ECAN_MSG_AUTO_SLIP_CURV: 7 Vector__XXX + SG_ AUTO_STATUS : 48|8@1+ (1,0) [0|255] "" Vector__XXX + SG_ CURVATURE_RADIUS : 32|16@1+ (0.01,0) [0|655.35] "m" Vector__XXX + SG_ ANGLE_SLIP : 16|16@1- (0.0001,0) [-3.2768|3.2767] "rad" Vector__XXX + SG_ ANGLE_TRACK : 0|16@1- (0.0001,0) [-3.2768|3.2767] "rad" Vector__XXX + +BO_ 521 SBG_ECAN_MSG_EVENT_TIME_E: 8 Vector__XXX + SG_ TIME_OFFSET_3 : 48|16@1+ (1,0) [0|65535] "µs" Vector__XXX + SG_ TIME_OFFSET_2 : 32|16@1+ (1,0) [0|65535] "µs" Vector__XXX + SG_ TIME_OFFSET_1 : 16|16@1+ (1,0) [0|65535] "µs" Vector__XXX + SG_ TIME_OFFSET_0 : 0|16@1+ (1,0) [0|65535] "µs" Vector__XXX + +BO_ 520 SBG_ECAN_MSG_EVENT_INFO_E: 8 Vector__XXX + SG_ STATUS : 32|16@1+ (1,0) [0|65535] "" Vector__XXX + SG_ TIME_STAMP : 0|32@1+ (1,0) [0|4294970000] "µs" Vector__XXX + +BO_ 519 SBG_ECAN_MSG_EVENT_TIME_D: 8 Vector__XXX + SG_ TIME_OFFSET_3 : 48|16@1+ (1,0) [0|65535] "µs" Vector__XXX + SG_ TIME_OFFSET_2 : 32|16@1+ (1,0) [0|65535] "µs" Vector__XXX + SG_ TIME_OFFSET_1 : 16|16@1+ (1,0) [0|65535] "µs" Vector__XXX + SG_ TIME_OFFSET_0 : 0|16@1+ (1,0) [0|65535] "µs" Vector__XXX + +BO_ 518 SBG_ECAN_MSG_EVENT_INFO_D: 8 Vector__XXX + SG_ STATUS : 32|16@1+ (1,0) [0|65535] "" Vector__XXX + SG_ TIME_STAMP : 0|32@1+ (1,0) [0|4294970000] "µs" Vector__XXX + +BO_ 517 SBG_ECAN_MSG_EVENT_TIME_C: 8 Vector__XXX + SG_ TIME_OFFSET_3 : 48|16@1+ (1,0) [0|65535] "µs" Vector__XXX + SG_ TIME_OFFSET_2 : 32|16@1+ (1,0) [0|65535] "µs" Vector__XXX + SG_ TIME_OFFSET_1 : 16|16@1+ (1,0) [0|65535] "µs" Vector__XXX + SG_ TIME_OFFSET_0 : 0|16@1+ (1,0) [0|65535] "µs" Vector__XXX + +BO_ 516 SBG_ECAN_MSG_EVENT_INFO_C: 8 Vector__XXX + SG_ STATUS : 32|16@1+ (1,0) [0|65535] "" Vector__XXX + SG_ TIME_STAMP : 0|32@1+ (1,0) [0|4294970000] "µs" Vector__XXX + +BO_ 515 SBG_ECAN_MSG_EVENT_TIME_B: 8 Vector__XXX + SG_ TIME_OFFSET_3 : 48|16@1+ (1,0) [0|65535] "µs" Vector__XXX + SG_ TIME_OFFSET_2 : 32|16@1+ (1,0) [0|65535] "µs" Vector__XXX + SG_ TIME_OFFSET_1 : 16|16@1+ (1,0) [0|65535] "µs" Vector__XXX + SG_ TIME_OFFSET_0 : 0|16@1+ (1,0) [0|65535] "µs" Vector__XXX + +BO_ 514 SBG_ECAN_MSG_EVENT_INFO_B: 8 Vector__XXX + SG_ STATUS : 32|16@1+ (1,0) [0|65535] "" Vector__XXX + SG_ TIME_STAMP : 0|32@1+ (1,0) [0|4294970000] "µs" Vector__XXX + +BO_ 513 SBG_ECAN_MSG_EVENT_TIME_A: 8 Vector__XXX + SG_ TIME_OFFSET_3 : 48|16@1+ (1,0) [0|65535] "µs" Vector__XXX + SG_ TIME_OFFSET_2 : 32|16@1+ (1,0) [0|65535] "µs" Vector__XXX + SG_ TIME_OFFSET_1 : 16|16@1+ (1,0) [0|65535] "µs" Vector__XXX + SG_ TIME_OFFSET_0 : 0|16@1+ (1,0) [0|65535] "µs" Vector__XXX + +BO_ 512 SBG_ECAN_MSG_EVENT_INFO_A: 8 Vector__XXX + SG_ STATUS : 32|16@1+ (1,0) [0|65535] "" Vector__XXX + SG_ TIME_STAMP : 0|32@1+ (1,0) [0|4294970000] "µs" Vector__XXX + +BO_ 393 SBG_ECAN_MSG_GPS2_HDT: 8 Vector__XXX + SG_ PITCH_ACC : 48|16@1+ (0.01,0) [0|655.35] "°" Vector__XXX + SG_ PITCH : 32|16@1- (0.01,0) [-327.68|327.67] "°" Vector__XXX + SG_ TRUE_HEADING_ACC : 16|16@1+ (0.01,0) [0|655.35] "°" Vector__XXX + SG_ TRUE_HEADING : 0|16@1+ (0.01,0) [0|655.35] "°" Vector__XXX + +BO_ 392 SBG_ECAN_MSG_GPS2_HDT_INFO: 6 Vector__XXX + SG_ STATUS : 32|16@1+ (1,0) [0|65535] "" Vector__XXX + SG_ TIME_STAMP : 0|32@1+ (1,0) [0|4294970000] "µs" Vector__XXX + +BO_ 391 SBG_ECAN_MSG_GPS2_POS_ACC: 8 Vector__XXX + SG_ BASE_STATION_ID : 48|16@1+ (1,0) [0|65535] "" Vector__XXX + SG_ ALTITUDE_ACC : 32|16@1+ (0.01,0) [0|655.35] "m" Vector__XXX + SG_ LONGITUDE_ACC : 16|16@1+ (0.01,0) [0|655.35] "m" Vector__XXX + SG_ LATITUDE_ACC : 0|16@1+ (0.01,0) [0|655.35] "m" Vector__XXX + +BO_ 390 SBG_ECAN_MSG_GPS2_POS_ALT: 8 Vector__XXX + SG_ DIFF_CORR_AGE : 56|8@1+ (1,0) [0|255] "s" Vector__XXX + SG_ NUM_SV : 48|8@1+ (1,0) [0|255] "" Vector__XXX + SG_ UNDULATION : 32|16@1- (0.005,0) [-163.84|163.835] "m" Vector__XXX + SG_ ALTITUDE : 0|32@1- (0.001,0) [-2147480|2147480] "m" Vector__XXX + +BO_ 389 SBG_ECAN_MSG_GPS2_POS: 8 Vector__XXX + SG_ LONGITUDE : 32|32@1- (1E-007,0) [-214.7483648|214.7483647] "°" Vector__XXX + SG_ LATITUDE : 0|32@1- (1E-007,0) [-214.7483648|214.7483647] "°" Vector__XXX + +BO_ 388 SBG_ECAN_MSG_GPS2_POS_INFO: 8 Vector__XXX + SG_ STATUS : 32|32@1+ (1,0) [0|4294970000] "" Vector__XXX + SG_ TIME_STAMP : 0|32@1+ (1,0) [0|4294970000] "µs" Vector__XXX + +BO_ 387 SBG_ECAN_MSG_GPS2_VEL_COURSE: 4 Vector__XXX + SG_ COURSE_ACC : 16|16@1+ (0.01,0) [0|655.35] "°" Vector__XXX + SG_ COURSE : 0|16@1+ (0.01,0) [0|655.35] "°" Vector__XXX + +BO_ 386 SBG_ECAN_MSG_GPS2_VEL_ACC: 6 Vector__XXX + SG_ VELOCITY_ACC_D : 32|16@1- (0.01,0) [-327.68|327.67] "m.s-1" Vector__XXX + SG_ VELOCITY_ACC_E : 16|16@1- (0.01,0) [-327.68|327.67] "m.s-1" Vector__XXX + SG_ VELOCITY_ACC_N : 0|16@1- (0.01,0) [-327.68|327.67] "m.s-1" Vector__XXX + +BO_ 385 SBG_ECAN_MSG_GPS2_VEL: 6 Vector__XXX + SG_ VELOCITY_D : 32|16@1- (0.01,0) [-327.68|327.67] "m.s-1" Vector__XXX + SG_ VELOCITY_E : 16|16@1- (0.01,0) [-327.68|327.67] "m.s-1" Vector__XXX + SG_ VELOCITY_N : 0|16@1- (0.01,0) [-327.68|327.67] "m.s-1" Vector__XXX + +BO_ 384 SBG_ECAN_MSG_GPS2_VEL_INFO: 8 Vector__XXX + SG_ STATUS : 32|32@1+ (1,0) [0|4294970000] "" Vector__XXX + SG_ TIME_STAMP : 0|32@1+ (1,0) [0|4294970000] "µs" Vector__XXX + +BO_ 377 SBG_ECAN_MSG_GPS1_HDT: 8 Vector__XXX + SG_ PITCH_ACC : 48|16@1+ (0.01,0) [0|655.35] "°" Vector__XXX + SG_ PITCH : 32|16@1- (0.01,0) [-327.68|327.67] "°" Vector__XXX + SG_ TRUE_HEADING_ACC : 16|16@1+ (0.01,0) [0|655.35] "°" Vector__XXX + SG_ TRUE_HEADING : 0|16@1+ (0.01,0) [0|655.35] "°" Vector__XXX + +BO_ 376 SBG_ECAN_MSG_GPS1_HDT_INFO: 6 Vector__XXX + SG_ STATUS : 32|16@1+ (1,0) [0|65535] "" Vector__XXX + SG_ TIME_STAMP : 0|32@1+ (1,0) [0|4294970000] "µs" Vector__XXX + +BO_ 375 SBG_ECAN_MSG_GPS1_POS_ACC: 8 Vector__XXX + SG_ BASE_STATION_ID : 48|16@1+ (1,0) [0|65535] "" Vector__XXX + SG_ ALTITUDE_ACC : 32|16@1+ (0.01,0) [0|655.35] "m" Vector__XXX + SG_ LONGITUDE_ACC : 16|16@1+ (0.01,0) [0|655.35] "m" Vector__XXX + SG_ LATITUDE_ACC : 0|16@1+ (0.01,0) [0|655.35] "m" Vector__XXX + +BO_ 374 SBG_ECAN_MSG_GPS1_POS_ALT: 8 Vector__XXX + SG_ DIFF_CORR_AGE : 56|8@1+ (1,0) [0|255] "s" Vector__XXX + SG_ NUM_SV : 48|8@1+ (1,0) [0|255] "" Vector__XXX + SG_ UNDULATION : 32|16@1- (0.005,0) [-163.84|163.835] "m" Vector__XXX + SG_ ALTITUDE : 0|32@1- (0.001,0) [-2147480|2147480] "m" Vector__XXX + +BO_ 373 SBG_ECAN_MSG_GPS1_POS: 8 Vector__XXX + SG_ LONGITUDE : 32|32@1- (1E-007,0) [-214.7483648|214.7483647] "°" Vector__XXX + SG_ LATITUDE : 0|32@1- (1E-007,0) [-214.7483648|214.7483647] "°" Vector__XXX + +BO_ 372 SBG_ECAN_MSG_GPS1_POS_INFO: 8 Vector__XXX + SG_ STATUS : 32|32@1+ (1,0) [0|4294970000] "" Vector__XXX + SG_ TIME_STAMP : 0|32@1+ (1,0) [0|4294970000] "µs" Vector__XXX + +BO_ 371 SBG_ECAN_MSG_GPS1_VEL_COURSE: 4 Vector__XXX + SG_ COURSE_ACC : 16|16@1+ (0.01,0) [0|655.35] "°" Vector__XXX + SG_ COURSE : 0|16@1+ (0.01,0) [0|655.35] "°" Vector__XXX + +BO_ 370 SBG_ECAN_MSG_GPS1_VEL_ACC: 6 Vector__XXX + SG_ VELOCITY_ACC_D : 32|16@1- (0.01,0) [-327.68|327.67] "m.s-1" Vector__XXX + SG_ VELOCITY_ACC_E : 16|16@1- (0.01,0) [-327.68|327.67] "m.s-1" Vector__XXX + SG_ VELOCITY_ACC_N : 0|16@1- (0.01,0) [-327.68|327.67] "m.s-1" Vector__XXX + +BO_ 369 SBG_ECAN_MSG_GPS1_VEL: 6 Vector__XXX + SG_ VELOCITY_D : 32|16@1- (0.01,0) [-327.68|327.67] "m.s-1" Vector__XXX + SG_ VELOCITY_E : 16|16@1- (0.01,0) [-327.68|327.67] "m.s-1" Vector__XXX + SG_ VELOCITY_N : 0|16@1- (0.01,0) [-327.68|327.67] "m.s-1" Vector__XXX + +BO_ 368 SBG_ECAN_MSG_GPS1_VEL_INFO: 8 Vector__XXX + SG_ STATUS : 32|32@1+ (1,0) [0|4294970000] "" Vector__XXX + SG_ TIME_STAMP : 0|32@1+ (1,0) [0|4294970000] "µs" Vector__XXX + +BO_ 359 SBG_ECAN_MSG_DEPTH_ALTITUDE: 8 Vector__XXX + SG_ DEPTH : 32|32@1- (0.001,0) [-2147480|2147480] "m" Vector__XXX + SG_ PRESSURE_ABS : 0|32@1+ (0.1,0) [0|429497000] "Pa" Vector__XXX + +BO_ 358 SBG_ECAN_MSG_DEPTH_INFO: 5 Vector__XXX + SG_ DEPTH_STATUS : 32|8@1+ (1,0) [0|255] "" Vector__XXX + SG_ TIME_STAMP : 0|32@1+ (1,0) [0|4294970000] "us" Vector__XXX + +BO_ 356 SBG_ECAN_MSG_AIR_DATA_AIRSPEED: 6 Vector__XXX + SG_ AIRSPEED : 32|16@1- (0.01,0) [-327.68|327.67] "m.s-1" Vector__XXX + SG_ PRESSURE_DIFF : 0|32@1- (0.001,0) [-2147483.648|2147483.647] "Pa" Vector__XXX + +BO_ 355 SBG_ECAN_MSG_AIR_DATA_ALTITUDE: 8 Vector__XXX + SG_ ALTITUDE : 32|32@1- (0.001,0) [-2147483.648|2147483.647] "m" Vector__XXX + SG_ PRESSURE_ABS : 0|32@1+ (0.001,0) [0|4294967.295] "Pa" Vector__XXX + +BO_ 354 SBG_ECAN_MSG_AIR_DATA_INFO: 7 Vector__XXX + SG_ AIR_TEMPERATURE : 40|16@1- (0.01,0) [-327.68|327.67] "°C" Vector__XXX + SG_ AIR_DATA_STATUS : 32|8@1+ (1,0) [0|255] "" Vector__XXX + SG_ TIME_STAMP : 0|32@1+ (1,0) [0|4294970000] "us" Vector__XXX + +BO_ 353 SBG_ECAN_MSG_ODO_VEL: 2 Vector__XXX + SG_ VELOCITY : 0|16@1- (0.01,0) [-327.68|327.67] "m.s-1" Vector__XXX + +BO_ 352 SBG_ECAN_MSG_ODO_INFO: 6 Vector__XXX + SG_ ODO_STATUS : 32|16@1+ (1,0) [0|65535] "" Vector__XXX + SG_ TIME_STAMP : 0|32@1+ (1,0) [0|4294970000] "µs" Vector__XXX + +BO_ 338 SBG_ECAN_MSG_MAG_2: 6 Vector__XXX + SG_ ACCEL_Z : 32|16@1- (0.01,0) [-327.68|327.67] "m.s-2" Vector__XXX + SG_ ACCEL_Y : 16|16@1- (0.01,0) [-327.68|327.67] "m.s-2" Vector__XXX + SG_ ACCEL_X : 0|16@1- (0.01,0) [-327.68|327.67] "m.s-2" Vector__XXX + +BO_ 337 SBG_ECAN_MSG_MAG_1: 6 Vector__XXX + SG_ MAG_Z : 32|16@1- (0.001,0) [-32.768|32.767] "a.u." Vector__XXX + SG_ MAG_Y : 16|16@1- (0.001,0) [-32.768|32.767] "a.u." Vector__XXX + SG_ MAG_X : 0|16@1- (0.001,0) [-32.768|32.767] "a.u." Vector__XXX + +BO_ 336 SBG_ECAN_MSG_MAG_0: 6 Vector__XXX + SG_ STATUS : 32|16@1+ (1,0) [0|65535] "" Vector__XXX + SG_ TIME_STAMP : 0|32@1+ (1,0) [0|4294970000] "µs" Vector__XXX + +BO_ 333 SBG_ECAN_MSG_SHIP_MOTION_HP_2: 6 Vector__XXX + SG_ VEL_Z : 32|16@1- (0.01,0) [-327.68|327.67] "m.s-1" Vector__XXX + SG_ VEL_Y : 16|16@1- (0.01,0) [-327.68|327.67] "m.s-1" Vector__XXX + SG_ VEL_X : 0|16@1- (0.01,0) [-327.68|327.67] "m.s-1" Vector__XXX + +BO_ 332 SBG_ECAN_MSG_SHIP_MOTION_HP_1: 6 Vector__XXX + SG_ ACCEL_Z : 32|16@1- (0.01,0) [-327.68|327.67] "m.s-2" Vector__XXX + SG_ ACCEL_Y : 16|16@1- (0.01,0) [-327.68|327.67] "m.s-2" Vector__XXX + SG_ ACCEL_X : 0|16@1- (0.01,0) [-327.68|327.67] "m.s-2" Vector__XXX + +BO_ 331 SBG_ECAN_MSG_SHIP_MOTION_HP_0: 6 Vector__XXX + SG_ HEAVE : 32|16@1- (0.001,0) [-32.768|32.767] "m" Vector__XXX + SG_ SWAY : 16|16@1- (0.001,0) [-32.768|32.767] "m" Vector__XXX + SG_ SURGE : 0|16@1- (0.001,0) [-32.768|32.767] "m" Vector__XXX + +BO_ 330 SBG_ECAN_MSG_SHIP_MOTION_HP_INFO: 8 Vector__XXX + SG_ STATUS : 48|16@1+ (1,0) [0|65535] "" Vector__XXX + SG_ PERIOD : 32|16@1+ (0.01,0) [0|655.35] "s" Vector__XXX + SG_ TIME_STAMP : 0|32@1+ (1,0) [0|4294970000] "µs" Vector__XXX + +BO_ 329 SBG_ECAN_MSG_SHIP_MOTION_2: 6 Vector__XXX + SG_ VEL_Z : 32|16@1- (0.01,0) [-327.68|327.67] "m.s-1" Vector__XXX + SG_ VEL_Y : 16|16@1- (0.01,0) [-327.68|327.67] "m.s-1" Vector__XXX + SG_ VEL_X : 0|16@1- (0.01,0) [-327.68|327.67] "m.s-1" Vector__XXX + +BO_ 325 SBG_ECAN_MSG_SHIP_MOTION_1: 6 Vector__XXX + SG_ ACCEL_Z : 32|16@1- (0.01,0) [-327.68|327.67] "m.s-2" Vector__XXX + SG_ ACCEL_Y : 16|16@1- (0.01,0) [-327.68|327.67] "m.s-2" Vector__XXX + SG_ ACCEL_X : 0|16@1- (0.01,0) [-327.68|327.67] "m.s-2" Vector__XXX + +BO_ 321 SBG_ECAN_MSG_SHIP_MOTION_0: 6 Vector__XXX + SG_ HEAVE : 32|16@1- (0.001,0) [-32.768|32.767] "m" Vector__XXX + SG_ SWAY : 16|16@1- (0.001,0) [-32.768|32.767] "m" Vector__XXX + SG_ SURGE : 0|16@1- (0.001,0) [-32.768|32.767] "m" Vector__XXX + +BO_ 320 SBG_ECAN_MSG_SHIP_MOTION_INFO: 8 Vector__XXX + SG_ STATUS : 48|16@1+ (1,0) [0|65535] "" Vector__XXX + SG_ PERIOD : 32|16@1+ (0.01,0) [0|655.35] "s" Vector__XXX + SG_ TIME_STAMP : 0|32@1+ (1,0) [0|4294970000] "µs" Vector__XXX + +BO_ 313 SBG_ECAN_MSG_EKF_VEL_BODY: 6 Vector__XXX + SG_ VELOCITY_Z : 32|16@1- (0.01,0) [-327.68|327.67] "m.s-1" Vector__XXX + SG_ VELOCITY_Y : 16|16@1- (0.01,0) [-327.68|327.67] "m.s-1" Vector__XXX + SG_ VELOCITY_X : 0|16@1- (0.01,0) [-327.68|327.67] "m.s-1" Vector__XXX + +BO_ 312 SBG_ECAN_MSG_EKF_VEL_NED_ACC: 6 Vector__XXX + SG_ VELOCITY_ACC_D : 32|16@1- (0.01,0) [-327.68|327.67] "m.s-1" Vector__XXX + SG_ VELOCITY_ACC_E : 16|16@1- (0.01,0) [-327.68|327.67] "m.s-1" Vector__XXX + SG_ VELOCITY_ACC_N : 0|16@1- (0.01,0) [-327.68|327.67] "m.s-1" Vector__XXX + +BO_ 311 SBG_ECAN_MSG_EKF_VEL_NED: 6 Vector__XXX + SG_ VELOCITY_D : 32|16@1- (0.01,0) [-327.68|327.67] "m.s-1" Vector__XXX + SG_ VELOCITY_E : 16|16@1- (0.01,0) [-327.68|327.67] "m.s-1" Vector__XXX + SG_ VELOCITY_N : 0|16@1- (0.01,0) [-327.68|327.67] "m.s-1" Vector__XXX + +BO_ 310 SBG_ECAN_MSG_EKF_POS_ACC: 6 Vector__XXX + SG_ ALTITUDE_ACC : 32|16@1+ (0.01,0) [0|655.35] "m" Vector__XXX + SG_ LONGITUDE_ACC : 16|16@1+ (0.01,0) [0|655.35] "m" Vector__XXX + SG_ LATITUDE_ACC : 0|16@1+ (0.01,0) [0|655.35] "m" Vector__XXX + +BO_ 309 SBG_ECAN_MSG_EKF_ALTITUDE: 6 Vector__XXX + SG_ UNDULATION : 32|16@1- (0.005,0) [-163.84|163.835] "m" Vector__XXX + SG_ ALTITUDE : 0|32@1- (0.001,0) [-2147480|2147480] "m" Vector__XXX + +BO_ 308 SBG_ECAN_MSG_EKF_POS: 8 Vector__XXX + SG_ LONGITUDE : 32|32@1- (1E-007,0) [-214.7483648|214.7483647] "°" Vector__XXX + SG_ LATITUDE : 0|32@1- (1E-007,0) [-214.7483648|214.7483647] "°" Vector__XXX + +BO_ 307 SBG_ECAN_MSG_EKF_ORIENTATION_ACC: 6 Vector__XXX + SG_ YAW_ACC : 32|16@1+ (0.0001,0) [0|6.5535] "rad" Vector__XXX + SG_ PITCH_ACC : 16|16@1+ (0.0001,0) [0|6.5535] "rad" Vector__XXX + SG_ ROLL_ACC : 0|16@1+ (0.0001,0) [0|6.5535] "rad" Vector__XXX + +BO_ 306 SBG_ECAN_MSG_EKF_EULER: 6 Vector__XXX + SG_ YAW : 32|16@1- (0.0001,0) [-3.2768|3.2767] "rad" Vector__XXX + SG_ PITCH : 16|16@1- (0.0001,0) [-3.2768|3.2767] "rad" Vector__XXX + SG_ ROLL : 0|16@1- (0.0001,0) [-3.2768|3.2767] "rad" Vector__XXX + +BO_ 305 SBG_ECAN_MSG_EKF_QUAT: 8 Vector__XXX + SG_ Q3 : 48|16@1- (3.05185094759972E-005,0) [-1|1] "" Vector__XXX + SG_ Q2 : 32|16@1- (3.05185094759972E-005,0) [-1|1] "" Vector__XXX + SG_ Q1 : 16|16@1- (3.05185094759972E-005,0) [-1|1] "" Vector__XXX + SG_ Q0 : 0|16@1- (3.05185094759972E-005,0) [-1|1] "" Vector__XXX + +BO_ 304 SBG_ECAN_MSG_EKF_INFO: 4 Vector__XXX + SG_ TIME_STAMP : 0|32@1+ (1,0) [0|4294970000] "µs" Vector__XXX + +BO_ 292 SBG_ECAN_MSG_IMU_DELTA_ANGLE: 6 Vector__XXX + SG_ DELTA_ANGLE_Z : 32|16@1- (0.001,0) [-32.768|32.767] "rad.s-1" Vector__XXX + SG_ DELTA_ANGLE_Y : 16|16@1- (0.001,0) [-32.768|32.767] "rad.s-1" Vector__XXX + SG_ DELTA_ANGLE_X : 0|16@1- (0.001,0) [-32.768|32.767] "rad.s-1" Vector__XXX + +BO_ 291 SBG_ECAN_MSG_IMU_DELTA_VEL: 6 Vector__XXX + SG_ DELTA_VEL_Z : 32|16@1- (0.01,0) [-327.68|327.67] "m.s-2" Vector__XXX + SG_ DELTA_VEL_Y : 16|16@1- (0.01,0) [-327.68|327.67] "m.s-2" Vector__XXX + SG_ DELTA_VEL_X : 0|16@1- (0.01,0) [-327.68|327.67] "m.s-2" Vector__XXX + +BO_ 290 SBG_ECAN_MSG_IMU_GYRO: 6 Vector__XXX + SG_ GYRO_Z : 32|16@1- (0.001,0) [-32.768|32.767] "rad.s-1" Vector__XXX + SG_ GYRO_Y : 16|16@1- (0.001,0) [-32.768|32.767] "rad.s-1" Vector__XXX + SG_ GYRO_X : 0|16@1- (0.001,0) [-32.768|32.767] "rad.s-1" Vector__XXX + +BO_ 289 SBG_ECAN_MSG_IMU_ACCEL: 6 Vector__XXX + SG_ ACCEL_Z : 32|16@1- (0.01,0) [-327.68|327.67] "m.s-2" Vector__XXX + SG_ ACCEL_Y : 16|16@1- (0.01,0) [-327.68|327.67] "m.s-2" Vector__XXX + SG_ ACCEL_X : 0|16@1- (0.01,0) [-327.68|327.67] "m.s-2" Vector__XXX + +BO_ 288 SBG_ECAN_MSG_IMU_INFO: 8 Vector__XXX + SG_ TEMPERATURE : 48|16@1- (0.01,0) [-327.68|327.67] "°C" Vector__XXX + SG_ STATUS : 32|16@1+ (1,0) [0|65535] "" Vector__XXX + SG_ TIME_STAMP : 0|32@1+ (1,0) [0|4294970000] "µs" Vector__XXX + +BO_ 273 SBG_ECAN_MSG_UTC_1: 8 Vector__XXX + SG_ MICRO_SEC : 48|16@1+ (100,0) [0|6553500] "us" Vector__XXX + SG_ SEC : 40|8@1+ (1,0) [0|255] "s" Vector__XXX + SG_ MIN : 32|8@1+ (1,0) [0|255] "min" Vector__XXX + SG_ HOUR : 24|8@1+ (1,0) [0|255] "h" Vector__XXX + SG_ DAY : 16|8@1+ (1,0) [0|255] "d" Vector__XXX + SG_ MONTH : 8|8@1+ (1,0) [0|255] "month" Vector__XXX + SG_ YEAR : 0|8@1+ (1,2000) [2000|2255] "year" Vector__XXX + +BO_ 272 SBG_ECAN_MSG_UTC_0: 8 Vector__XXX + SG_ GPS_TOW : 32|32@1+ (1,0) [0|4294970000] "ms" Vector__XXX + SG_ TIME_STAMP : 0|32@1+ (1,0) [0|4294970000] "µs" Vector__XXX + +BO_ 258 SBG_ECAN_MSG_STATUS_03: 6 Vector__XXX + SG_ HEAVE_STATUS : 32|16@1+ (1,0) [0|65535] "" Vector__XXX + SG_ SOLUTION : 0|32@1+ (1,0) [0|4294970000] "" Vector__XXX + +BO_ 257 SBG_ECAN_MSG_STATUS_02: 8 Vector__XXX + SG_ AIDING : 32|32@1+ (1,0) [0|4294970000] "" Vector__XXX + SG_ COM : 0|32@1+ (1,0) [0|4294970000] "" Vector__XXX + +BO_ 256 SBG_ECAN_MSG_STATUS_01: 8 Vector__XXX + SG_ CLOCK : 48|16@1+ (1,0) [0|65535] "" Vector__XXX + SG_ GENERAL : 32|16@1+ (1,0) [0|65535] "" Vector__XXX + SG_ TIME_STAMP : 0|32@1+ (1,0) [0|4294970000] "µs" Vector__XXX + + + + diff --git a/can/sbgCan.dbf b/can/sbgCan.dbf new file mode 100644 index 0000000..fef1c3b --- /dev/null +++ b/can/sbgCan.dbf @@ -0,0 +1,410 @@ +//******************************BUSMASTER Messages and signals Database ******************************// + +[DATABASE_VERSION] 1.3 + +[PROTOCOL] CAN + +[BUSMASTER_VERSION] [3.2.2] + +[NUMBER_OF_MESSAGES] 69 + +[START_MSG] SBG_ECAN_MSG_TRACK_SLIP_CURVATURE,544,7,4,1,S +[START_SIGNALS] ANGLE_TRACK,16,1,0,I,32767,-32768,1,0.000000,0.000100,rad, +[START_SIGNALS] ANGLE_SLIP,16,3,0,I,32767,-32768,1,0.000000,0.000100,rad, +[START_SIGNALS] CURVATURE_RADIUS,16,5,0,U,65535,0,1,0.000000,0.010000,m, +[START_SIGNALS] AUTO_STATUS,8,7,0,U,255,0,1,0.000000,1.000000,, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_EVENT_TIME_E,521,8,4,1,S +[START_SIGNALS] TIME_OFFSET_0,16,1,0,U,65535,0,1,0.000000,1.000000,µs, +[START_SIGNALS] TIME_OFFSET_1,16,3,0,U,65535,0,1,0.000000,1.000000,µs, +[START_SIGNALS] TIME_OFFSET_2,16,5,0,U,65535,0,1,0.000000,1.000000,µs, +[START_SIGNALS] TIME_OFFSET_3,16,7,0,U,65535,0,1,0.000000,1.000000,µs, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_EVENT_INFO_E,520,8,2,1,S +[START_SIGNALS] TIME_STAMP,32,1,0,U,4294967295,0,1,0.000000,1.000000,µs, +[START_SIGNALS] STATUS,16,5,0,U,65535,0,1,0.000000,1.000000,, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_EVENT_TIME_D,519,8,4,1,S +[START_SIGNALS] TIME_OFFSET_0,16,1,0,U,65535,0,1,0.000000,1.000000,µs, +[START_SIGNALS] TIME_OFFSET_1,16,3,0,U,65535,0,1,0.000000,1.000000,µs, +[START_SIGNALS] TIME_OFFSET_2,16,5,0,U,65535,0,1,0.000000,1.000000,µs, +[START_SIGNALS] TIME_OFFSET_3,16,7,0,U,65535,0,1,0.000000,1.000000,µs, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_EVENT_INFO_D,518,8,2,1,S +[START_SIGNALS] TIME_STAMP,32,1,0,U,4294967295,0,1,0.000000,1.000000,µs, +[START_SIGNALS] STATUS,16,5,0,U,65535,0,1,0.000000,1.000000,, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_EVENT_TIME_C,517,8,4,1,S +[START_SIGNALS] TIME_OFFSET_0,16,1,0,U,65535,0,1,0.000000,1.000000,µs, +[START_SIGNALS] TIME_OFFSET_1,16,3,0,U,65535,0,1,0.000000,1.000000,µs, +[START_SIGNALS] TIME_OFFSET_2,16,5,0,U,65535,0,1,0.000000,1.000000,µs, +[START_SIGNALS] TIME_OFFSET_3,16,7,0,U,65535,0,1,0.000000,1.000000,µs, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_EVENT_INFO_C,516,8,2,1,S +[START_SIGNALS] TIME_STAMP,32,1,0,U,4294967295,0,1,0.000000,1.000000,µs, +[START_SIGNALS] STATUS,16,5,0,U,65535,0,1,0.000000,1.000000,, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_EVENT_TIME_B,515,8,4,1,S +[START_SIGNALS] TIME_OFFSET_0,16,1,0,U,65535,0,1,0.000000,1.000000,µs, +[START_SIGNALS] TIME_OFFSET_1,16,3,0,U,65535,0,1,0.000000,1.000000,µs, +[START_SIGNALS] TIME_OFFSET_2,16,5,0,U,65535,0,1,0.000000,1.000000,µs, +[START_SIGNALS] TIME_OFFSET_3,16,7,0,U,65535,0,1,0.000000,1.000000,µs, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_EVENT_INFO_B,514,8,2,1,S +[START_SIGNALS] TIME_STAMP,32,1,0,U,4294967295,0,1,0.000000,1.000000,µs, +[START_SIGNALS] STATUS,16,5,0,U,65535,0,1,0.000000,1.000000,, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_EVENT_TIME_A,513,8,4,1,S +[START_SIGNALS] TIME_OFFSET_0,16,1,0,U,65535,0,1,0.000000,1.000000,µs, +[START_SIGNALS] TIME_OFFSET_1,16,3,0,U,65535,0,1,0.000000,1.000000,µs, +[START_SIGNALS] TIME_OFFSET_2,16,5,0,U,65535,0,1,0.000000,1.000000,µs, +[START_SIGNALS] TIME_OFFSET_3,16,7,0,U,65535,0,1,0.000000,1.000000,µs, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_EVENT_INFO_A,512,8,2,1,S +[START_SIGNALS] TIME_STAMP,32,1,0,U,4294967295,0,1,0.000000,1.000000,µs, +[START_SIGNALS] STATUS,16,5,0,U,65535,0,1,0.000000,1.000000,, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_GPS2_HDT,393,8,4,1,S +[START_SIGNALS] TRUE_HEADING,16,1,0,U,65535,0,1,0.000000,0.010000,°, +[START_SIGNALS] TRUE_HEADING_ACC,16,3,0,U,65535,0,1,0.000000,0.010000,°, +[START_SIGNALS] PITCH,16,5,0,I,32767,-32768,1,0.000000,0.010000,°, +[START_SIGNALS] PITCH_ACC,16,7,0,U,65535,0,1,0.000000,0.010000,°, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_GPS2_HDT_INFO,392,6,2,1,S +[START_SIGNALS] TIME_STAMP,32,1,0,U,4294967295,0,1,0.000000,1.000000,µs, +[START_SIGNALS] STATUS,16,5,0,U,65535,0,1,0.000000,1.000000,, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_GPS2_POS_ACC,391,8,4,1,S +[START_SIGNALS] LATITUDE_ACC,16,1,0,U,65535,0,1,0.000000,0.010000,m, +[START_SIGNALS] LONGITUDE_ACC,16,3,0,U,65535,0,1,0.000000,0.010000,m, +[START_SIGNALS] ALTITUDE_ACC,16,5,0,U,65535,0,1,0.000000,0.010000,m, +[START_SIGNALS] BASE_STATION_ID,16,7,0,U,65535,0,1,0.000000,1.000000,, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_GPS2_POS_ALT,390,8,4,1,S +[START_SIGNALS] ALTITUDE,32,1,0,I,2147483647,-2147483648,1,0.000000,0.001000,m, +[START_SIGNALS] UNDULATION,16,5,0,I,32767,-32768,1,0.000000,0.005000,m, +[START_SIGNALS] NUM_SV,8,7,0,U,255,0,1,0.000000,1.000000,, +[START_SIGNALS] DIFF_CORR_AGE,8,8,0,U,255,0,1,0.000000,1.000000,s, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_GPS2_POS,389,8,2,1,S +[START_SIGNALS] LATITUDE,32,1,0,I,2147483647,-2147483648,1,0.000000,0.0000001,°, +[START_SIGNALS] LONGITUDE,32,5,0,I,2147483647,-2147483648,1,0.000000,0.0000001,°, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_GPS2_POS_INFO,388,8,2,1,S +[START_SIGNALS] TIME_STAMP,32,1,0,U,4294967295,0,1,0.000000,1.000000,µs, +[START_SIGNALS] STATUS,32,5,0,U,4294967295,0,1,0.000000,1.000000,, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_GPS2_VEL_COURSE,387,4,2,1,S +[START_SIGNALS] COURSE,16,1,0,U,65535,0,1,0.000000,0.010000,°, +[START_SIGNALS] COURSE_ACC,16,3,0,U,65535,0,1,0.000000,0.010000,°, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_GPS2_VEL_ACC,386,6,3,1,S +[START_SIGNALS] VELOCITY_ACC_N,16,1,0,I,32767,-32768,1,0.000000,0.010000,m.s-1, +[START_SIGNALS] VELOCITY_ACC_E,16,3,0,I,32767,-32768,1,0.000000,0.010000,m.s-1, +[START_SIGNALS] VELOCITY_ACC_D,16,5,0,I,32767,-32768,1,0.000000,0.010000,m.s-1, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_GPS2_VEL,385,6,3,1,S +[START_SIGNALS] VELOCITY_N,16,1,0,I,32767,-32768,1,0.000000,0.010000,m.s-1, +[START_SIGNALS] VELOCITY_E,16,3,0,I,32767,-32768,1,0.000000,0.010000,m.s-1, +[START_SIGNALS] VELOCITY_D,16,5,0,I,32767,-32768,1,0.000000,0.010000,m.s-1, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_GPS2_VEL_INFO,384,8,2,1,S +[START_SIGNALS] TIME_STAMP,32,1,0,U,4294967295,0,1,0.000000,1.000000,µs, +[START_SIGNALS] STATUS,32,5,0,U,4294967295,0,1,0.000000,1.000000,, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_GPS1_HDT,377,8,4,1,S +[START_SIGNALS] TRUE_HEADING,16,1,0,U,65535,0,1,0.000000,0.010000,°, +[START_SIGNALS] TRUE_HEADING_ACC,16,3,0,U,65535,0,1,0.000000,0.010000,°, +[START_SIGNALS] PITCH,16,5,0,I,32767,-32768,1,0.000000,0.010000,°, +[START_SIGNALS] PITCH_ACC,16,7,0,U,65535,0,1,0.000000,0.010000,°, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_GPS1_HDT_INFO,376,6,2,1,S +[START_SIGNALS] TIME_STAMP,32,1,0,U,4294967295,0,1,0.000000,1.000000,µs, +[START_SIGNALS] STATUS,16,5,0,U,65535,0,1,0.000000,1.000000,, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_GPS1_POS_ACC,375,8,4,1,S +[START_SIGNALS] LATITUDE_ACC,16,1,0,U,65535,0,1,0.000000,0.010000,m, +[START_SIGNALS] LONGITUDE_ACC,16,3,0,U,65535,0,1,0.000000,0.010000,m, +[START_SIGNALS] ALTITUDE_ACC,16,5,0,U,65535,0,1,0.000000,0.010000,m, +[START_SIGNALS] BASE_STATION_ID,16,7,0,U,65535,0,1,0.000000,1.000000,, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_GPS1_POS_ALT,374,8,4,1,S +[START_SIGNALS] ALTITUDE,32,1,0,I,2147483647,-2147483648,1,0.000000,0.001000,m, +[START_SIGNALS] UNDULATION,16,5,0,I,32767,-32768,1,0.000000,0.005000,m, +[START_SIGNALS] NUM_SV,8,7,0,U,255,0,1,0.000000,1.000000,, +[START_SIGNALS] DIFF_CORR_AGE,8,8,0,U,255,0,1,0.000000,1.000000,s, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_GPS1_POS,373,8,2,1,S +[START_SIGNALS] LATITUDE,32,1,0,I,2147483647,-2147483648,1,0.000000,0.0000001,°, +[START_SIGNALS] LONGITUDE,32,5,0,I,2147483647,-2147483648,1,0.000000,0.0000001,°, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_GPS1_POS_INFO,372,8,2,1,S +[START_SIGNALS] TIME_STAMP,32,1,0,U,4294967295,0,1,0.000000,1.000000,µs, +[START_SIGNALS] STATUS,32,5,0,U,4294967295,0,1,0.000000,1.000000,, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_GPS1_VEL_COURSE,371,4,2,1,S +[START_SIGNALS] COURSE,16,1,0,U,65535,0,1,0.000000,0.010000,°, +[START_SIGNALS] COURSE_ACC,16,3,0,U,65535,0,1,0.000000,0.010000,°, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_GPS1_VEL_ACC,370,6,3,1,S +[START_SIGNALS] VELOCITY_ACC_N,16,1,0,I,32767,-32768,1,0.000000,0.010000,m.s-1, +[START_SIGNALS] VELOCITY_ACC_E,16,3,0,I,32767,-32768,1,0.000000,0.010000,m.s-1, +[START_SIGNALS] VELOCITY_ACC_D,16,5,0,I,32767,-32768,1,0.000000,0.010000,m.s-1, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_GPS1_VEL,369,6,3,1,S +[START_SIGNALS] VELOCITY_N,16,1,0,I,32767,-32768,1,0.000000,0.010000,m.s-1, +[START_SIGNALS] VELOCITY_E,16,3,0,I,32767,-32768,1,0.000000,0.010000,m.s-1, +[START_SIGNALS] VELOCITY_D,16,5,0,I,32767,-32768,1,0.000000,0.010000,m.s-1, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_GPS1_VEL_INFO,368,8,2,1,S +[START_SIGNALS] TIME_STAMP,32,1,0,U,4294967295,0,1,0.000000,1.000000,µs, +[START_SIGNALS] STATUS,32,5,0,U,4294967295,0,1,0.000000,1.000000,, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_DEPTH_ALTITUDE,359,8,2,1,S +[START_SIGNALS] PRESSURE_ABS,32,1,0,U,4294967295,0,1,0.000000,0.100000,Pa, +[START_SIGNALS] DEPTH,32,5,0,I,2147483647,-2147483648,1,0.000000,0.001000,m, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_DEPTH_INFO,358,5,2,1,S +[START_SIGNALS] TIME_STAMP,32,1,0,U,4294967295,0,1,0.000000,1.000000,us, +[START_SIGNALS] DEPTH_STATUS,8,5,0,U,255,0,1,0.000000,1.000000,, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_AIR_DATA_AIRSPEED,356,6,2,1,S +[START_SIGNALS] PRESSURE_DIFF,32,1,0,I,2147483647,-2147483648,1,0.000000,0.001000,Pa, +[START_SIGNALS] AIRSPEED,16,5,0,I,32767,-32768,1,0.000000,0.010000,m.s-1, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_AIR_DATA_ALTITUDE,355,8,2,1,S +[START_SIGNALS] PRESSURE_ABS,32,1,0,U,4294967295,0,1,0.000000,0.001000,Pa, +[START_SIGNALS] ALTITUDE,32,5,0,I,2147483647,-2147483648,1,0.000000,0.001000,m, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_AIR_DATA_INFO,354,7,3,1,S +[START_SIGNALS] TIME_STAMP,32,1,0,U,4294967295,0,1,0.000000,1.000000,us, +[START_SIGNALS] AIR_DATA_STATUS,8,5,0,U,255,0,1,0.000000,1.000000,, +[START_SIGNALS] AIR_TEMPERATURE,16,6,0,I,32767,-32768,1,0.000000,0.010000,°C, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_ODO_VEL,353,2,1,1,S +[START_SIGNALS] VELOCITY,16,1,0,I,32767,-32768,1,0.000000,0.010000,m.s-1, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_ODO_INFO,352,6,2,1,S +[START_SIGNALS] TIME_STAMP,32,1,0,U,4294967295,0,1,0.000000,1.000000,µs, +[START_SIGNALS] ODO_STATUS,16,5,0,U,65535,0,1,0.000000,1.000000,, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_MAG_2,338,6,3,1,S +[START_SIGNALS] ACCEL_X,16,1,0,I,32767,-32768,1,0.000000,0.010000,m.s-2, +[START_SIGNALS] ACCEL_Y,16,3,0,I,32767,-32768,1,0.000000,0.010000,m.s-2, +[START_SIGNALS] ACCEL_Z,16,5,0,I,32767,-32768,1,0.000000,0.010000,m.s-2, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_MAG_1,337,6,3,1,S +[START_SIGNALS] MAG_X,16,1,0,I,32767,-32768,1,0.000000,0.001000,a.u., +[START_SIGNALS] MAG_Y,16,3,0,I,32767,-32768,1,0.000000,0.001000,a.u., +[START_SIGNALS] MAG_Z,16,5,0,I,32767,-32768,1,0.000000,0.001000,a.u., +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_MAG_0,336,6,2,1,S +[START_SIGNALS] TIME_STAMP,32,1,0,U,4294967295,0,1,0.000000,1.000000,µs, +[START_SIGNALS] STATUS,16,5,0,U,65535,0,1,0.000000,1.000000,, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_SHIP_MOTION_HP_2,333,6,3,1,S +[START_SIGNALS] VEL_X,16,1,0,I,32767,-32768,1,0.000000,0.010000,m.s-1, +[START_SIGNALS] VEL_Y,16,3,0,I,32767,-32768,1,0.000000,0.010000,m.s-1, +[START_SIGNALS] VEL_Z,16,5,0,I,32767,-32768,1,0.000000,0.010000,m.s-1, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_SHIP_MOTION_HP_1,332,6,3,1,S +[START_SIGNALS] ACCEL_X,16,1,0,I,32767,-32768,1,0.000000,0.010000,m.s-2, +[START_SIGNALS] ACCEL_Y,16,3,0,I,32767,-32768,1,0.000000,0.010000,m.s-2, +[START_SIGNALS] ACCEL_Z,16,5,0,I,32767,-32768,1,0.000000,0.010000,m.s-2, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_SHIP_MOTION_HP_0,331,6,3,1,S +[START_SIGNALS] SURGE,16,1,0,I,32767,-32768,1,0.000000,0.001000,m, +[START_SIGNALS] SWAY,16,3,0,I,32767,-32768,1,0.000000,0.001000,m, +[START_SIGNALS] HEAVE,16,5,0,I,32767,-32768,1,0.000000,0.001000,m, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_SHIP_MOTION_HP_INFO,330,8,3,1,S +[START_SIGNALS] TIME_STAMP,32,1,0,U,4294967295,0,1,0.000000,1.000000,µs, +[START_SIGNALS] PERIOD,16,5,0,U,65535,0,1,0.000000,0.010000,s, +[START_SIGNALS] STATUS,16,7,0,U,65535,0,1,0.000000,1.000000,, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_SHIP_MOTION_2,329,6,3,1,S +[START_SIGNALS] VEL_X,16,1,0,I,32767,-32768,1,0.000000,0.010000,m.s-1, +[START_SIGNALS] VEL_Y,16,3,0,I,32767,-32768,1,0.000000,0.010000,m.s-1, +[START_SIGNALS] VEL_Z,16,5,0,I,32767,-32768,1,0.000000,0.010000,m.s-1, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_SHIP_MOTION_1,325,6,3,1,S +[START_SIGNALS] ACCEL_X,16,1,0,I,32767,-32768,1,0.000000,0.010000,m.s-2, +[START_SIGNALS] ACCEL_Y,16,3,0,I,32767,-32768,1,0.000000,0.010000,m.s-2, +[START_SIGNALS] ACCEL_Z,16,5,0,I,32767,-32768,1,0.000000,0.010000,m.s-2, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_SHIP_MOTION_0,321,6,3,1,S +[START_SIGNALS] SURGE,16,1,0,I,32767,-32768,1,0.000000,0.001000,m, +[START_SIGNALS] SWAY,16,3,0,I,32767,-32768,1,0.000000,0.001000,m, +[START_SIGNALS] HEAVE,16,5,0,I,32767,-32768,1,0.000000,0.001000,m, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_SHIP_MOTION_INFO,320,8,3,1,S +[START_SIGNALS] TIME_STAMP,32,1,0,U,4294967295,0,1,0.000000,1.000000,µs, +[START_SIGNALS] PERIOD,16,5,0,U,65535,0,1,0.000000,0.010000,s, +[START_SIGNALS] STATUS,16,7,0,U,65535,0,1,0.000000,1.000000,, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_EKF_VEL_BODY,313,6,3,1,S +[START_SIGNALS] VELOCITY_X,16,1,0,I,32767,-32768,1,0.000000,0.010000,m.s-1, +[START_SIGNALS] VELOCITY_Y,16,3,0,I,32767,-32768,1,0.000000,0.010000,m.s-1, +[START_SIGNALS] VELOCITY_Z,16,5,0,I,32767,-32768,1,0.000000,0.010000,m.s-1, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_EKF_VEL_NED_ACC,312,6,3,1,S +[START_SIGNALS] VELOCITY_ACC_N,16,1,0,I,32767,-32768,1,0.000000,0.010000,m.s-1, +[START_SIGNALS] VELOCITY_ACC_E,16,3,0,I,32767,-32768,1,0.000000,0.010000,m.s-1, +[START_SIGNALS] VELOCITY_ACC_D,16,5,0,I,32767,-32768,1,0.000000,0.010000,m.s-1, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_EKF_VEL_NED,311,6,3,1,S +[START_SIGNALS] VELOCITY_N,16,1,0,I,32767,-32768,1,0.000000,0.010000,m.s-1, +[START_SIGNALS] VELOCITY_E,16,3,0,I,32767,-32768,1,0.000000,0.010000,m.s-1, +[START_SIGNALS] VELOCITY_D,16,5,0,I,32767,-32768,1,0.000000,0.010000,m.s-1, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_EKF_POS_ACC,310,6,3,1,S +[START_SIGNALS] LATITUDE_ACC,16,1,0,U,65535,0,1,0.000000,0.010000,m, +[START_SIGNALS] LONGITUDE_ACC,16,3,0,U,65535,0,1,0.000000,0.010000,m, +[START_SIGNALS] ALTITUDE_ACC,16,5,0,U,65535,0,1,0.000000,0.010000,m, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_EKF_ALTITUDE,309,6,2,1,S +[START_SIGNALS] ALTITUDE,32,1,0,I,2147483647,-2147483648,1,0.000000,0.001000,m, +[START_SIGNALS] UNDULATION,16,5,0,I,32767,-32768,1,0.000000,0.005000,m, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_EKF_POS,308,8,2,1,S +[START_SIGNALS] LATITUDE,32,1,0,I,2147483647,-2147483648,1,0.000000,0.0000001,°, +[START_SIGNALS] LONGITUDE,32,5,0,I,2147483647,-2147483648,1,0.000000,0.0000001,°, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_EKF_ORIENTATION_ACC,307,6,3,1,S +[START_SIGNALS] ROLL_ACC,16,1,0,U,65535,0,1,0.000000,0.000100,rad, +[START_SIGNALS] PITCH_ACC,16,3,0,U,65535,0,1,0.000000,0.000100,rad, +[START_SIGNALS] YAW_ACC,16,5,0,U,65535,0,1,0.000000,0.000100,rad, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_EKF_EULER,306,6,3,1,S +[START_SIGNALS] ROLL,16,1,0,I,32767,-32768,1,0.000000,0.000100,rad, +[START_SIGNALS] PITCH,16,3,0,I,32767,-32768,1,0.000000,0.000100,rad, +[START_SIGNALS] YAW,16,5,0,I,32767,-32768,1,0.000000,0.000100,rad, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_EKF_QUAT,305,8,4,1,S +[START_SIGNALS] Q0,16,1,0,I,32767,-32768,1,0.000000,0.0000305185094759972,, +[START_SIGNALS] Q1,16,3,0,I,32767,-32768,1,0.000000,0.0000305185094759972,, +[START_SIGNALS] Q2,16,5,0,I,32767,-32768,1,0.000000,0.0000305185094759972,, +[START_SIGNALS] Q3,16,7,0,I,32767,-32768,1,0.000000,0.0000305185094759972,, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_EKF_INFO,304,4,1,1,S +[START_SIGNALS] TIME_STAMP,32,1,0,U,4294967295,0,1,0.000000,1.000000,µs, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_IMU_DELTA_ANGLE,292,6,3,1,S +[START_SIGNALS] DELTA_ANGLE_X,16,1,0,I,32767,-32768,1,0.000000,0.001000,rad.s-1, +[START_SIGNALS] DELTA_ANGLE_Y,16,3,0,I,32767,-32768,1,0.000000,0.001000,rad.s-1, +[START_SIGNALS] DELTA_ANGLE_Z,16,5,0,I,32767,-32768,1,0.000000,0.001000,rad.s-1, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_IMU_DELTA_VEL,291,6,3,1,S +[START_SIGNALS] DELTA_VEL_X,16,1,0,I,32767,-32768,1,0.000000,0.010000,m.s-2, +[START_SIGNALS] DELTA_VEL_Y,16,3,0,I,32767,-32768,1,0.000000,0.010000,m.s-2, +[START_SIGNALS] DELTA_VEL_Z,16,5,0,I,32767,-32768,1,0.000000,0.010000,m.s-2, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_IMU_GYRO,290,6,3,1,S +[START_SIGNALS] GYRO_X,16,1,0,I,32767,-32768,1,0.000000,0.001000,rad.s-1, +[START_SIGNALS] GYRO_Y,16,3,0,I,32767,-32768,1,0.000000,0.001000,rad.s-1, +[START_SIGNALS] GYRO_Z,16,5,0,I,32767,-32768,1,0.000000,0.001000,rad.s-1, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_IMU_ACCEL,289,6,3,1,S +[START_SIGNALS] ACCEL_X,16,1,0,I,32767,-32768,1,0.000000,0.010000,m.s-2, +[START_SIGNALS] ACCEL_Y,16,3,0,I,32767,-32768,1,0.000000,0.010000,m.s-2, +[START_SIGNALS] ACCEL_Z,16,5,0,I,32767,-32768,1,0.000000,0.010000,m.s-2, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_IMU_INFO,288,8,3,1,S +[START_SIGNALS] TIME_STAMP,32,1,0,U,4294967295,0,1,0.000000,1.000000,µs, +[START_SIGNALS] STATUS,16,5,0,U,65535,0,1,0.000000,1.000000,, +[START_SIGNALS] TEMPERATURE,16,7,0,I,32767,-32768,1,0.000000,0.010000,°C, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_UTC_1,273,8,7,1,S +[START_SIGNALS] YEAR,8,1,0,U,255,0,1,2000.000000,1.000000,year, +[START_SIGNALS] MONTH,8,2,0,U,255,0,1,0.000000,1.000000,month, +[START_SIGNALS] DAY,8,3,0,U,255,0,1,0.000000,1.000000,d, +[START_SIGNALS] HOUR,8,4,0,U,255,0,1,0.000000,1.000000,h, +[START_SIGNALS] MIN,8,5,0,U,255,0,1,0.000000,1.000000,min, +[START_SIGNALS] SEC,8,6,0,U,255,0,1,0.000000,1.000000,s, +[START_SIGNALS] MICRO_SEC,16,7,0,U,65535,0,1,0.000000,100.000000,us, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_UTC_0,272,8,2,1,S +[START_SIGNALS] TIME_STAMP,32,1,0,U,4294967295,0,1,0.000000,1.000000,µs, +[START_SIGNALS] GPS_TOW,32,5,0,U,4294967295,0,1,0.000000,1.000000,ms, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_STATUS_03,258,6,2,1,S +[START_SIGNALS] SOLUTION,32,1,0,U,4294967295,0,1,0.000000,1.000000,, +[START_SIGNALS] HEAVE_STATUS,16,5,0,U,65535,0,1,0.000000,1.000000,, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_STATUS_02,257,8,2,1,S +[START_SIGNALS] COM,32,1,0,U,4294967295,0,1,0.000000,1.000000,, +[START_SIGNALS] AIDING,32,5,0,U,4294967295,0,1,0.000000,1.000000,, +[END_MSG] + +[START_MSG] SBG_ECAN_MSG_STATUS_01,256,8,3,1,S +[START_SIGNALS] TIME_STAMP,32,1,0,U,4294967295,0,1,0.000000,1.000000,µs, +[START_SIGNALS] GENERAL,16,5,0,U,65535,0,1,0.000000,1.000000,, +[START_SIGNALS] CLOCK,16,7,0,U,65535,0,1,0.000000,1.000000,, +[END_MSG] \ No newline at end of file diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt new file mode 100644 index 0000000..1a00941 --- /dev/null +++ b/cmake/CMakeLists.txt @@ -0,0 +1,59 @@ +# CMake rules used to build the public sbgECom library release +cmake_minimum_required(VERSION 3.0 FATAL_ERROR) + +project(sbgECom) + +set(CMAKE_C_STANDARD 99) +set(CMAKE_C_STANDARD_REQUIRED ON) +set(CMAKE_C_EXTENSIONS ON) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + +# Use a sbgCommonLin as a static library +add_definitions(-DSBG_COMMON_STATIC_USE -D_CRT_SECURE_NO_WARNINGS) + +include_directories( + ${PROJECT_SOURCE_DIR}/../src/ + ${PROJECT_SOURCE_DIR}/../common/ +) + +# Define easier to find output paths +set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/../bin/) +set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/../bin/) + +file(GLOB_RECURSE SRC ${PROJECT_SOURCE_DIR}/../src/*.c) +file(GLOB_RECURSE COMMON_SRC ${PROJECT_SOURCE_DIR}/../common/*.c) + +# Exclude platform specific files +if (NOT MSVC) + list(REMOVE_ITEM COMMON_SRC "${PROJECT_SOURCE_DIR}/../common/interfaces/sbgInterfaceSerialWin.c") +else () + list(REMOVE_ITEM COMMON_SRC "${PROJECT_SOURCE_DIR}/../common/interfaces/sbgInterfaceSerialUnix.c") +endif() + +add_library(sbgECom STATIC ${SRC} ${COMMON_SRC}) + +if (MSVC) + target_link_libraries(sbgECom Ws2_32) + #target_compile_definitions(sbgECom PRIVATE _CRT_SECURE_NO_WARNINGS) +endif() + +# Add all examples +add_executable(airDataInput "${PROJECT_SOURCE_DIR}/../examples/airDataInput/src/airDataInput.c") +target_link_libraries(airDataInput sbgECom) +add_dependencies(airDataInput sbgECom) + +add_executable(ellipseMinimal "${PROJECT_SOURCE_DIR}/../examples/ellipseMinimal/src/ellipseMinimal.c") +target_link_libraries(ellipseMinimal sbgECom) +add_dependencies(ellipseMinimal sbgECom) + +add_executable(ellipseOnboardMagCalib "${PROJECT_SOURCE_DIR}/../examples/ellipseOnboardMagCalib/src/ellipseOnboardMagCalib.c") +target_link_libraries(ellipseOnboardMagCalib sbgECom) +add_dependencies(ellipseOnboardMagCalib sbgECom) + +add_executable(hpInsMinimal "${PROJECT_SOURCE_DIR}/../examples/hpInsMinimal/src/hpInsMinimal.c") +target_link_libraries(hpInsMinimal sbgECom) +add_dependencies(hpInsMinimal sbgECom) + +add_executable(pulseMinimal "${PROJECT_SOURCE_DIR}/../examples/pulseMinimal/src/pulseMinimal.c") +target_link_libraries(pulseMinimal sbgECom) +add_dependencies(pulseMinimal sbgECom) diff --git a/common/crc/sbgCrc.c b/common/crc/sbgCrc.c new file mode 100644 index 0000000..3b5c5f6 --- /dev/null +++ b/common/crc/sbgCrc.c @@ -0,0 +1,271 @@ +#include "sbgCrc.h" + +//----------------------------------------------------------------------// +//- Static global CRC tables -// +//----------------------------------------------------------------------// + +/*!< CRC table used to compute a 16 bit CRC with the polynom 0x8408. */ +static const uint16_t crc16LookupTable[256] = { + 0x0000,0x1189,0x2312,0x329B,0x4624,0x57AD,0x6536,0x74BF,0x8C48,0x9DC1,0xAF5A,0xBED3,0xCA6C,0xDBE5,0xE97E,0xF8F7, + 0x1081,0x0108,0x3393,0x221A,0x56A5,0x472C,0x75B7,0x643E,0x9CC9,0x8D40,0xBFDB,0xAE52,0xDAED,0xCB64,0xF9FF,0xE876, + 0x2102,0x308B,0x0210,0x1399,0x6726,0x76AF,0x4434,0x55BD,0xAD4A,0xBCC3,0x8E58,0x9FD1,0xEB6E,0xFAE7,0xC87C,0xD9F5, + 0x3183,0x200A,0x1291,0x0318,0x77A7,0x662E,0x54B5,0x453C,0xBDCB,0xAC42,0x9ED9,0x8F50,0xFBEF,0xEA66,0xD8FD,0xC974, + 0x4204,0x538D,0x6116,0x709F,0x0420,0x15A9,0x2732,0x36BB,0xCE4C,0xDFC5,0xED5E,0xFCD7,0x8868,0x99E1,0xAB7A,0xBAF3, + 0x5285,0x430C,0x7197,0x601E,0x14A1,0x0528,0x37B3,0x263A,0xDECD,0xCF44,0xFDDF,0xEC56,0x98E9,0x8960,0xBBFB,0xAA72, + 0x6306,0x728F,0x4014,0x519D,0x2522,0x34AB,0x0630,0x17B9,0xEF4E,0xFEC7,0xCC5C,0xDDD5,0xA96A,0xB8E3,0x8A78,0x9BF1, + 0x7387,0x620E,0x5095,0x411C,0x35A3,0x242A,0x16B1,0x0738,0xFFCF,0xEE46,0xDCDD,0xCD54,0xB9EB,0xA862,0x9AF9,0x8B70, + 0x8408,0x9581,0xA71A,0xB693,0xC22C,0xD3A5,0xE13E,0xF0B7,0x0840,0x19C9,0x2B52,0x3ADB,0x4E64,0x5FED,0x6D76,0x7CFF, + 0x9489,0x8500,0xB79B,0xA612,0xD2AD,0xC324,0xF1BF,0xE036,0x18C1,0x0948,0x3BD3,0x2A5A,0x5EE5,0x4F6C,0x7DF7,0x6C7E, + 0xA50A,0xB483,0x8618,0x9791,0xE32E,0xF2A7,0xC03C,0xD1B5,0x2942,0x38CB,0x0A50,0x1BD9,0x6F66,0x7EEF,0x4C74,0x5DFD, + 0xB58B,0xA402,0x9699,0x8710,0xF3AF,0xE226,0xD0BD,0xC134,0x39C3,0x284A,0x1AD1,0x0B58,0x7FE7,0x6E6E,0x5CF5,0x4D7C, + 0xC60C,0xD785,0xE51E,0xF497,0x8028,0x91A1,0xA33A,0xB2B3,0x4A44,0x5BCD,0x6956,0x78DF,0x0C60,0x1DE9,0x2F72,0x3EFB, + 0xD68D,0xC704,0xF59F,0xE416,0x90A9,0x8120,0xB3BB,0xA232,0x5AC5,0x4B4C,0x79D7,0x685E,0x1CE1,0x0D68,0x3FF3,0x2E7A, + 0xE70E,0xF687,0xC41C,0xD595,0xA12A,0xB0A3,0x8238,0x93B1,0x6B46,0x7ACF,0x4854,0x59DD,0x2D62,0x3CEB,0x0E70,0x1FF9, + 0xF78F,0xE606,0xD49D,0xC514,0xB1AB,0xA022,0x92B9,0x8330,0x7BC7,0x6A4E,0x58D5,0x495C,0x3DE3,0x2C6A,0x1EF1,0x0F78}; + +/*!< CRC table used to compute an Ethernet 32 bit CRC using the normal polynom 0x04C11DB7. */ +static const uint32_t crc32EthernetTable[256] = +{ + 0x00000000, + 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b, + 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, + 0x2b4bcb61, 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, + 0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9, 0x5f15adac, + 0x5bd4b01b, 0x569796c2, 0x52568b75, 0x6a1936c8, 0x6ed82b7f, + 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3, 0x709f7b7a, + 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039, + 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, + 0xbaea46ef, 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, + 0xa4ad16ea, 0xa06c0b5d, 0xd4326d90, 0xd0f37027, 0xddb056fe, + 0xd9714b49, 0xc7361b4c, 0xc3f706fb, 0xceb42022, 0xca753d95, + 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1, 0xe13ef6f4, + 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0, + 0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5, + 0x2ac12072, 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, + 0x018aeb13, 0x054bf6a4, 0x0808d07d, 0x0cc9cdca, 0x7897ab07, + 0x7c56b6b0, 0x71159069, 0x75d48dde, 0x6b93dddb, 0x6f52c06c, + 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08, 0x571d7dd1, + 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba, + 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b, + 0xbb60adfc, 0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698, + 0x832f1041, 0x87ee0df6, 0x99a95df3, 0x9d684044, 0x902b669d, + 0x94ea7b2a, 0xe0b41de7, 0xe4750050, 0xe9362689, 0xedf73b3e, + 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2, 0xc6bcf05f, + 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34, + 0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80, + 0x644fc637, 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, + 0x4f040d56, 0x4bc510e1, 0x46863638, 0x42472b8f, 0x5c007b8a, + 0x58c1663d, 0x558240e4, 0x51435d53, 0x251d3b9e, 0x21dc2629, + 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5, 0x3f9b762c, + 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff, + 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e, + 0xf5ee4bb9, 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, + 0xeba91bbc, 0xef68060b, 0xd727bbb6, 0xd3e6a601, 0xdea580d8, + 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd, 0xcda1f604, 0xc960ebb3, + 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7, 0xae3afba2, + 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71, + 0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74, + 0x857130c3, 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, + 0x4e8ee645, 0x4a4ffbf2, 0x470cdd2b, 0x43cdc09c, 0x7b827d21, + 0x7f436096, 0x7200464f, 0x76c15bf8, 0x68860bfd, 0x6c47164a, + 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e, 0x18197087, + 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec, + 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d, + 0x2056cd3a, 0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce, + 0xcc2b1d17, 0xc8ea00a0, 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, + 0xdbee767c, 0xe3a1cbc1, 0xe760d676, 0xea23f0af, 0xeee2ed18, + 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4, 0x89b8fd09, + 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662, + 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, + 0xa2f33668, 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4 +}; + +//----------------------------------------------------------------------// +//- 32 bits Ethernet CRC -// +//----------------------------------------------------------------------// + +/*! + * Initialize the 32 bit CRC computation system. + * \param[in] pInstance Pointer on an allocated but non initialized Crc32 object. + */ +SBG_COMMON_LIB_API void sbgCrc32Initialize(SbgCrc32 *pInstance) +{ + // + // Test input argument + // + assert(pInstance); + + *pInstance = 0xFFFFFFFF; +} + +/*! + * Compute a 32 bit CRC using an Ethernet polynome. + * Warning: the buffer size should be at least 4 bytes long. + * \param[in] pInstance Read only pointer on a valid Crc32 object. + * \param[in] pData Read only pointer on the data buffer to compute CRC on. + * \param[in] dataSize Data size in bytes of the buffer, has to be greater or equals to 4. + */ +SBG_COMMON_LIB_API void sbgCrc32Update(SbgCrc32 *pInstance, const void *pData, size_t dataSize) +{ + const uint8_t *pBuffer = (const uint8_t*)pData; + uint32_t byte; + size_t i; + size_t dataSizeCorrected; + size_t numBytesLeft; + size_t index; + + // + // Test input arguments + // + assert(pInstance); + assert(pData); + + // + // Compute the data size that corresponds to complete uinht32 and how many bytes remains + // + dataSizeCorrected = dataSize & (~0x00000003); + numBytesLeft = dataSize & 0x03; + + // For each byte, update the CRC + // + for (i = 0; i < dataSizeCorrected; i++) + { + // + // We have to get index in reversed order per 4 bytes + // + index = i ^ 0x03; + + // + // Get the current byte value + // + byte = pBuffer[index]; + + // + // Update the CRC value + // + *pInstance = (*pInstance << 8) ^ crc32EthernetTable[((*pInstance >> 24) ^ byte) & 0xFF]; + } + + // + // Test how many bytes remains + // + for (i = 0; i < numBytesLeft; i++) + { + // + // We have to get index in reversed order per 4 bytes + // + index = (dataSizeCorrected-1) + (numBytesLeft - i); + + // + // Get the current byte value + // + byte = pBuffer[index]; + + // + // Update the CRC value + // + *pInstance = (*pInstance << 8) ^ crc32EthernetTable[((*pInstance >> 24) ^ byte) & 0xFF]; + } +} + +/*! + * Compute a 32 Bit CRC using an Ethernet polynome. + * Warning: the buffer size should be at least 4 bytes long. + * \param[in] pData Read only pointer on the data buffer to compute CRC on. + * \param[in] dataSize Data size in bytes of the buffer, has to be greater or equals to 4. + * \return The computed CRC. + */ +SBG_COMMON_LIB_API uint32_t sbgCrc32Compute(const void *pData, size_t dataSize) +{ + SbgCrc32 crcInst; + + // + // Initialize the CRC system + // + sbgCrc32Initialize(&crcInst); + + // + // Compute the CRC + // + sbgCrc32Update(&crcInst, pData, dataSize); + + // + // Return it + // + return sbgCrc32Get(&crcInst); +} + +//----------------------------------------------------------------------// +//- CRC-16 operations -// +//----------------------------------------------------------------------// + +/*! + * Initialize the 16 bit CRC computation system. + * \param[in] pInstance Pointer on an allocated but non initialized Crc16 object. + */ +SBG_COMMON_LIB_API void sbgCrc16Initialize(SbgCrc16 *pInstance) +{ + // + // Test input argument + // + assert(pInstance); + + *pInstance = 0; +} + +/*! + * Compute a 16 bit CRC using an the polynome 0x8408. + * \param[in] pInstance Read only pointer on a valid Crc16 object. + * \param[in] pData Read only pointer on the data buffer to compute CRC on. + * \param[in] dataSize Data size in bytes of the buffer. + */ +SBG_COMMON_LIB_API void sbgCrc16Update(SbgCrc16 *pInstance, const void *pData, size_t dataSize) +{ + const uint8_t *pBuffer = (const uint8_t*)pData; + uint8_t index; + size_t i; + + // + // Test input arguments + // + assert(pInstance); + assert(pData); + + // + // For each byte in our buffer + // + for (i = 0; i < dataSize; i++) + { + // + // Update the current CRC + // + index = (pBuffer[i] ^ *pInstance) & 0xFF; + *pInstance = crc16LookupTable[index] ^ (*pInstance >> 8); + } +} + +/*! + * Compute a 32 Bit CRC using an the polynome 0x8408. + * \param[in] pData Read only pointer on the data buffer to compute CRC on. + * \param[in] dataSize Data size in bytes of the buffer. + * \return The computed CRC. + */ +SBG_COMMON_LIB_API uint16_t sbgCrc16Compute(const void *pData, size_t dataSize) +{ + SbgCrc16 crcInst; + + // + // Initialize the CRC system + // + sbgCrc16Initialize(&crcInst); + + // + // Compute the CRC + // + sbgCrc16Update(&crcInst, pData, dataSize); + + // + // Return it + // + return sbgCrc16Get(&crcInst); +} diff --git a/common/crc/sbgCrc.h b/common/crc/sbgCrc.h new file mode 100644 index 0000000..25b4cbe --- /dev/null +++ b/common/crc/sbgCrc.h @@ -0,0 +1,134 @@ +/*! + * \file sbgCrc.h + * \author SBG Systems (Raphael Siryani) + * \date 15 January 2013 + * + * \brief This file provides CRC-32 and CRC-16 methods. + * + * \section CodeCopyright Copyright Notice + * The MIT license + * + * Copyright (C) 2007-2020, SBG Systems SAS. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef SBG_CRC_H +#define SBG_CRC_H + +//----------------------------------------------------------------------// +//- Header (open extern C block) -// +//----------------------------------------------------------------------// +#ifdef __cplusplus +extern "C" { +#endif + +#include + +//----------------------------------------------------------------------// +//- Types definitions -// +//----------------------------------------------------------------------// + +/*!< Type used to compute a 32 bit Ethernet CRC. */ +typedef uint32_t SbgCrc32; + +/*!< Type used to compute a 16 bit CRC. */ +typedef uint16_t SbgCrc16; + +//----------------------------------------------------------------------// +//- 32 bits Ethernet CRC -// +//----------------------------------------------------------------------// + +/*! + * Initialize the 32 bit CRC computation system. + * \param[in] pInstance Pointer on an allocated but non initialized Crc32 object. + */ +SBG_COMMON_LIB_API void sbgCrc32Initialize(SbgCrc32 *pInstance); + +/*! + * Compute a 32 bit CRC using an Ethernet polynome. + * Warning: the buffer size should be at least 4 bytes long. + * \param[in] pInstance Read only pointer on a valid Crc32 object. + * \param[in] pData Read only pointer on the data buffer to compute CRC on. + * \param[in] dataSize Data size in bytes of the buffer, has to be greater or equals to 4. + */ +SBG_COMMON_LIB_API void sbgCrc32Update(SbgCrc32 *pInstance, const void *pData, size_t dataSize); + +/*! + * Returns the computed 32 bit CRC value. + * \param[in] pInstance Read only pointer on a valid Crc32 object. + * \return The computed CRC. + */ +SBG_INLINE uint32_t sbgCrc32Get(const SbgCrc32 *pInstance) +{ + return *pInstance; +} + +/*! + * Compute a 32 Bit CRC using an Ethernet polynome. + * Warning: the buffer size should be at least 4 bytes long. + * \param[in] pData Read only pointer on the data buffer to compute CRC on. + * \param[in] dataSize Data size in bytes of the buffer, has to be greater or equals to 4. + * \return The computed CRC. + */ +SBG_COMMON_LIB_API uint32_t sbgCrc32Compute(const void *pData, size_t dataSize); + +//----------------------------------------------------------------------// +//- CRC-16 operations -// +//----------------------------------------------------------------------// + +/*! + * Initialize the 16 bit CRC computation system. + * \param[in] pInstance Pointer on an allocated but non initialized Crc16 object. + */ +SBG_COMMON_LIB_API void sbgCrc16Initialize(SbgCrc16 *pInstance); + +/*! + * Compute a 16 bit CRC using an the polynome 0x8408. + * \param[in] pInstance Read only pointer on a valid Crc16 object. + * \param[in] pData Read only pointer on the data buffer to compute CRC on. + * \param[in] dataSize Data size in bytes of the buffer. + */ +SBG_COMMON_LIB_API void sbgCrc16Update(SbgCrc16 *pInstance, const void *pData, size_t dataSize); + +/*! + * Returns the computed 32 bit CRC value. + * \param[in] pInstance Read only pointer on a valid Crc16 object. + * \return The computed CRC. + */ +SBG_INLINE uint16_t sbgCrc16Get(const SbgCrc16 *pInstance) +{ + return *pInstance; +} + +/*! + * Compute a 32 Bit CRC using an the polynome 0x8408. + * \param[in] pData Read only pointer on the data buffer to compute CRC on. + * \param[in] dataSize Data size in bytes of the buffer. + * \return The computed CRC. + */ +SBG_COMMON_LIB_API uint16_t sbgCrc16Compute(const void *pData, size_t dataSize); + +//----------------------------------------------------------------------// +//- Footer (close extern C block) -// +//----------------------------------------------------------------------// +#ifdef __cplusplus +} +#endif + +#endif /* SBG_CRC_H */ diff --git a/common/debug/sbgDebug.c b/common/debug/sbgDebug.c new file mode 100644 index 0000000..fdf22cb --- /dev/null +++ b/common/debug/sbgDebug.c @@ -0,0 +1,153 @@ +/*! + * \file sbgDebug.c + * \author SBG Systems + * + * \brief Error logging for the SBG Systems common C library. + * + * \section CodeCopyright Copyright Notice + * Copyright (C) 2019, SBG Systems SAS. All rights reserved. + * + * This source code is intended for use only by SBG Systems SAS and + * those that have explicit written permission to use it from + * SBG Systems SAS. + * + * 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. + */ + +// Standard headers +#include + +// sbgCommonLib headers +#include + +// Local headers +#include "sbgDebug.h" + +//----------------------------------------------------------------------// +//- Constant definitions -// +//----------------------------------------------------------------------// + +/*! + * Number of bytes translated per line. + */ +#define SBG_DEBUG_NR_BYTES_PER_LINE (16) + +/*! + * Size of the buffer used to generate lines, in bytes. + */ +#define SBG_DEBUG_LINE_BUFFER_SIZE (256) + +//----------------------------------------------------------------------// +//- Private functions -// +//----------------------------------------------------------------------// + +/*! + * Dump the given buffer on a single text line. + * + * \param[out] pLine Output line buffer. + * \param[in] lineSize Size of the ouput line buffer. + * \param[in] pBuffer Buffer. + * \param[in] size Buffer size. + */ +static void sbgDebugHexDumpGenerateLine(char *pLine, size_t lineSize, const uint8_t *pBuffer, size_t size) +{ + size_t length; + + assert(pLine); + assert(lineSize != 0); + assert(pBuffer); + assert(size <= SBG_DEBUG_NR_BYTES_PER_LINE); + + for (size_t i = 0; i < size; i++) + { + length = snprintf(pLine, lineSize, "%02x ", pBuffer[i]); + assert(length < lineSize); + + pLine = &pLine[length]; + lineSize -= length; + } + + for (size_t i = size; i < SBG_DEBUG_NR_BYTES_PER_LINE; i++) + { + length = snprintf(pLine, lineSize, " "); + assert(length < lineSize); + + pLine = &pLine[length]; + lineSize -= length; + } + + length = snprintf(pLine, lineSize, " | "); + assert(length < lineSize); + + pLine = &pLine[length]; + lineSize -= length; + + for (size_t i = 0; i < size; i++) + { + char c; + + if (isprint(pBuffer[i])) + { + c = pBuffer[i]; + } + else + { + c = '.'; + } + + length = snprintf(pLine, lineSize, "%c", c); + assert(length < lineSize); + + pLine = &pLine[length]; + lineSize -= length; + } +} + +//----------------------------------------------------------------------// +//- Public functions -// +//----------------------------------------------------------------------// + +void sbgDebugHexDump(const char *pPrefix, const void *pBuffer, size_t size) +{ + char line[SBG_DEBUG_LINE_BUFFER_SIZE]; + size_t index = 0; + bool multiLine = false; + + assert(pPrefix); + assert(pBuffer || (size == 0)); + + if (size > SBG_DEBUG_NR_BYTES_PER_LINE) + { + SBG_LOG_DEBUG("%s: multi-line dump start (%zu bytes)", pPrefix, size); + multiLine = true; + } + + while (size != 0) + { + const uint8_t *pByteBuffer = pBuffer; + size_t rangeSize; + + if (size < SBG_DEBUG_NR_BYTES_PER_LINE) + { + rangeSize = size; + } + else + { + rangeSize = SBG_DEBUG_NR_BYTES_PER_LINE; + } + + sbgDebugHexDumpGenerateLine(line, sizeof(line), &pByteBuffer[index], rangeSize); + SBG_LOG_DEBUG("%s: %s", pPrefix, line); + + size -= rangeSize; + index += rangeSize; + } + + if (multiLine) + { + SBG_LOG_DEBUG("%s: multi-line dump end", pPrefix); + } +} diff --git a/common/debug/sbgDebug.h b/common/debug/sbgDebug.h new file mode 100644 index 0000000..0b1f5ad --- /dev/null +++ b/common/debug/sbgDebug.h @@ -0,0 +1,162 @@ +/*! + * \file sbgDebug.h + * \author SBG Systems (Raphael Siryani) + * \date 17 March 2015 + * + * \brief Define and handle error logging for the SBG Systems common C library. + * + * The methods defined here should be implemented in sbgPlatform.h/sbgPlatform.c + * according to your platform and needs. + * + * \section CodeCopyright Copyright Notice + * The MIT license + * + * Copyright (C) 2007-2020, SBG Systems SAS. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef SBG_DEBUG_H +#define SBG_DEBUG_H + +// sbgCommonLib headers +#include + +#ifndef SBG_DEBUG_LOG_CATEGORY + #define SBG_DEBUG_LOG_CATEGORY ("None") +#endif + +//----------------------------------------------------------------------// +//- Errors and warning definitions -// +//----------------------------------------------------------------------// + +/*! + * Enum that identify the type of error / warning that has been thrown. + */ +typedef enum _SbgDebugLogType +{ + SBG_DEBUG_LOG_TYPE_ERROR, /*!< The message to log is an error. */ + SBG_DEBUG_LOG_TYPE_WARNING, /*!< The message to log is a warning. */ + SBG_DEBUG_LOG_TYPE_INFO, /*!< The message to log is an information. */ + SBG_DEBUG_LOG_TYPE_DEBUG /*!< The message to log is a debug information. */ +} SbgDebugLogType; + +//----------------------------------------------------------------------// +//- Errors and warning macros -// +//----------------------------------------------------------------------// + +/*! + * Log an error with its associated message. + * \param[in] errorCode The error code that has thrown this error. + * \param[in] format String litteral for the associated error message (you can use printf like string formating). + */ +#define SBG_LOG_ERROR_CALL(errorCode, format, ...) sbgPlatformDebugLogMsg((const char*)__BASE_FILE__, (const char*)__FUNCTION__, __LINE__, SBG_DEBUG_LOG_CATEGORY, SBG_DEBUG_LOG_TYPE_ERROR, errorCode, format, ##__VA_ARGS__) + +#if SBG_CONFIG_ENABLE_LOG_ERROR == 1 + #define SBG_LOG_ERROR SBG_LOG_ERROR_CALL +#else + #define SBG_LOG_ERROR(format, ...) ((void)sizeof(SBG_LOG_ERROR_CALL(format, ## __VA_ARGS__), 0)) +#endif + +/*! + * Log a warning with its associated message. + * \param[in] errorCode The error code that has thrown this warning. + * \param[in] format String litteral for the associated warning message (you can use printf like string formating). + */ +#define SBG_LOG_WARNING_CALL(errorCode, format, ...) sbgPlatformDebugLogMsg((const char*)__BASE_FILE__, (const char*)__FUNCTION__, __LINE__, SBG_DEBUG_LOG_CATEGORY, SBG_DEBUG_LOG_TYPE_WARNING, errorCode, format, ##__VA_ARGS__) + +#if SBG_CONFIG_ENABLE_LOG_WARNING == 1 + #define SBG_LOG_WARNING SBG_LOG_WARNING_CALL +#else + #define SBG_LOG_WARNING(format, ...) ((void)sizeof(SBG_LOG_WARNING_CALL(format, ## __VA_ARGS__), 0)) +#endif + +/*! + * Log an information message. + * \param[in] format String litteral for the information message (you can use printf like string formating). + */ +#define SBG_LOG_INFO_CALL(format, ...) sbgPlatformDebugLogMsg((const char*)__BASE_FILE__, (const char*)__FUNCTION__, __LINE__, SBG_DEBUG_LOG_CATEGORY, SBG_DEBUG_LOG_TYPE_INFO, SBG_NO_ERROR, format, ##__VA_ARGS__) + +#if SBG_CONFIG_ENABLE_LOG_INFO == 1 + #define SBG_LOG_INFO SBG_LOG_INFO_CALL +#else + #define SBG_LOG_INFO(format, ...) ((void)sizeof(SBG_LOG_INFO_CALL(format, ## __VA_ARGS__), 0)) +#endif + +/*! + * Log an information message only in debug mode + * \param[in] format String litteral for the information message (you can use printf like string formating). + */ +#define SBG_LOG_DEBUG_CALL(format, ...) sbgPlatformDebugLogMsg((const char*)__BASE_FILE__, (const char*)__FUNCTION__, __LINE__, SBG_DEBUG_LOG_CATEGORY, SBG_DEBUG_LOG_TYPE_DEBUG, SBG_NO_ERROR, format, ##__VA_ARGS__) + +#if SBG_CONFIG_ENABLE_LOG_DEBUG == 1 + #define SBG_LOG_DEBUG SBG_LOG_DEBUG_CALL +#else + #define SBG_LOG_DEBUG(format, ...) ((void)sizeof(SBG_LOG_DEBUG_CALL(format, ## __VA_ARGS__), 0)) +#endif + +//----------------------------------------------------------------------// +//- Inline functions -// +//----------------------------------------------------------------------// + +/*! + * Convert a log type into a string representation. + * + * \param[in] logType Log type. + * \return String representation for the given log type. + */ +SBG_INLINE const char *sbgDebugLogTypeToStr(SbgDebugLogType logType) +{ + const char *pString; + + switch (logType) + { + case SBG_DEBUG_LOG_TYPE_ERROR: + pString = "error"; + break; + case SBG_DEBUG_LOG_TYPE_WARNING: + pString = "warning"; + break; + case SBG_DEBUG_LOG_TYPE_INFO: + pString = "info"; + break; + case SBG_DEBUG_LOG_TYPE_DEBUG: + pString = "debug"; + break; + default: + pString = "unknown"; + break; + } + + return pString; +} + +//----------------------------------------------------------------------// +//- Public functions -// +//----------------------------------------------------------------------// + +/*! + * Produce a text dump of a buffer. + * + * \param[in] pPrefix Prefix string before each line. + * \param[in] pBuffer Data buffer, may be NULL. + * \param[in] size Data size, in bytes. + */ +void sbgDebugHexDump(const char *prefix, const void *pBuffer, size_t size); + +#endif /* SBG_DEBUG_H */ diff --git a/common/interfaces/sbgInterface.c b/common/interfaces/sbgInterface.c new file mode 100644 index 0000000..0b728ff --- /dev/null +++ b/common/interfaces/sbgInterface.c @@ -0,0 +1,83 @@ +/* sbgCommonLib headers */ +#include + +/* Local headers */ +#include "sbgInterface.h" + +//----------------------------------------------------------------------// +//- Private definitions -// +//----------------------------------------------------------------------// + +static const char *gInterfaceType[] = +{ + [SBG_IF_TYPE_UNKNOW] = "unknown", + [SBG_IF_TYPE_SERIAL] = "serial", + [SBG_IF_TYPE_ETH_UDP] = "eth UDP", + [SBG_IF_TYPE_ETH_TCP_IP] = "eth TCP", + [SBG_IF_TYPE_FILE] = "file" +}; + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +void sbgInterfaceZeroInit(SbgInterface *pInterface) +{ + assert(pInterface); + + // + // Make sure the whole struct is zero init + // + memset(pInterface, 0x00, sizeof(*pInterface)); +} + +SBG_COMMON_LIB_API SbgErrorCode sbgInterfaceDestroy(SbgInterface *pInterface) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + + assert(pInterface); + + if (pInterface->pDestroyFunc) + { + errorCode = pInterface->pDestroyFunc(pInterface); + } + + return errorCode; +} + +const char *sbgInterfaceTypeGetAsString(const SbgInterface *pInterface) +{ + assert(pInterface); + + if (pInterface->type < SBG_ARRAY_SIZE(gInterfaceType)) + { + return gInterfaceType[pInterface->type]; + } + else + { + SBG_LOG_ERROR(SBG_INVALID_PARAMETER, "Unknown interface type: %" PRIu32, pInterface->type); + return gInterfaceType[SBG_IF_TYPE_UNKNOW]; + } +} + +void sbgInterfaceNameSet(SbgInterface *pInterface, const char *pName) +{ + size_t nameLen; + + assert(pInterface); + assert(pName); + + // + // Only keep the end of the name that can fit in the interface name buffer + // + nameLen = strlen(pName); + + if (nameLen < SBG_ARRAY_SIZE(pInterface->name)) + { + strcpy(pInterface->name, pName); + } + else + { + strcpy(pInterface->name, pName+(nameLen-(SBG_ARRAY_SIZE(pInterface->name)-1))); + } +} diff --git a/common/interfaces/sbgInterface.h b/common/interfaces/sbgInterface.h new file mode 100644 index 0000000..59fffff --- /dev/null +++ b/common/interfaces/sbgInterface.h @@ -0,0 +1,453 @@ +/*! + * \file sbgInterface.h + * \author SBG Systems + * \date 10 December 2012 + * + * \brief This file implements the base interface for all Serial and Ethernet ports. + * + * An interface is used to provide a common API for both serial and Ethernet ports. + * An interface can be opened/closed and some data can be written or read from it. + * + * \section CodeCopyright Copyright Notice + * The MIT license + * + * Copyright (C) 2007-2020, SBG Systems SAS. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef SBG_INTERFACE_H +#define SBG_INTERFACE_H + +//----------------------------------------------------------------------// +//- Header (open extern C block) -// +//----------------------------------------------------------------------// +#ifdef __cplusplus +extern "C" { +#endif + +/* sbgCommonLib headers */ +#include + +//----------------------------------------------------------------------// +//- Constant definitions -// +//----------------------------------------------------------------------// + +#define SBG_IF_NAME_MAX_SIZE (48) /*!< Maximum size in bytes for the interface name string */ + +/*! + * Type values reserved for standard interface types. + */ +#define SBG_IF_TYPE_UNKNOW (0) /*!< The interface type is not defined. */ +#define SBG_IF_TYPE_SERIAL (1) /*!< The interface is a serial com port. */ +#define SBG_IF_TYPE_ETH_UDP (2) /*!< The interface is an UDP one. */ +#define SBG_IF_TYPE_ETH_TCP_IP (3) /*!< The interface is an TCP/IP one. */ +#define SBG_IF_TYPE_FILE (4) /*!< The interface is a file. */ +#define SBG_IF_TYPE_LAST_RESERVED (999) /*!< Last reserved value for standard types. */ + +// +// Flags for the flush operation. +// +#define SBG_IF_FLUSH_INPUT ((uint32_t)1 << 0) /*!< Flush input data flag. */ +#define SBG_IF_FLUSH_OUTPUT ((uint32_t)1 << 1) /*!< Flush output data flag. */ +#define SBG_IF_FLUSH_ALL (SBG_IF_FLUSH_INPUT | SBG_IF_FLUSH_OUTPUT) /*!< Flag combination to flush both input and output data. */ + +//----------------------------------------------------------------------// +//- Predefinitions -// +//----------------------------------------------------------------------// + +/*! + * Interface structure pre-definition. + */ +typedef struct _SbgInterface SbgInterface; + +/*! + * Handle that stores the internal interface handle (ie Serial or Ethernet) + */ +typedef void* SbgInterfaceHandle; + +//----------------------------------------------------------------------// +//- Callbacks definitions -// +//----------------------------------------------------------------------// + +/*! + * Method to implement that close and destroy an interface. + * + * \param[in] pInterface Interface instance. + * \return SBG_NO_ERROR if the interface has been closed successfully. + */ +typedef SbgErrorCode (*SbgInterfaceDestroyFunc)(SbgInterface *pInterface); + +/*! + * Method to implement to write a buffer to an interface. + * + * This method should return an error only if all bytes were not written successfully. + * If you try to write zero byte, the method shouldn't return any error. + * + * \param[in] pInterface Interface instance. + * \param[in] pBuffer Pointer on an allocated buffer that contains the data to write + * \param[in] bytesToWrite Number of bytes we would like to write (can be zero). + * \return SBG_NO_ERROR if exactly bytesToWrite have been written successfully. + */ +typedef SbgErrorCode (*SbgInterfaceWriteFunc)(SbgInterface *pInterface, const void *pBuffer, size_t bytesToWrite); + +/*! + * Method to implement to read data from an interface. + * + * This method returns an error only if there is a 'low level' error on the interface. + * If no byte is read at all or less bytes than bytesToRead, this method returns SBG_NO_ERROR. + * You have to check pReadBytes field to know the number of bytes actually read. + * + * \param[in] pInterface Interface instance. + * \param[in] pBuffer Pointer on an allocated buffer that can hold at least bytesToRead bytes of data. + * \param[out] pReadBytes Returns the number of bytes actually read (can be zero and up to bytesToRead). + * \param[in] bytesToRead Maximum number of bytes to try to read on the interface. + * \return SBG_NO_ERROR if zero or some bytes have been read successfully. + */ +typedef SbgErrorCode (*SbgInterfaceReadFunc)(SbgInterface *pInterface, void *pBuffer, size_t *pReadBytes, size_t bytesToRead); + +/*! + * Make an interface flush pending input and/or output data. + * + * If flags include SBG_IF_FLUSH_INPUT, all pending input data is discarded. + * If flags include SBG_IF_FLUSH_OUTPUT, the function blocks until all output data has been written out. + * + * WARNING: The method has no action if not applicable for a type of interface + * + * \param[in] pInterface Interface instance. + * \param[in] flags Combination of the SBG_IF_FLUSH_INPUT and SBG_IF_FLUSH_OUTPUT flags. + * \return SBG_NO_ERROR if successful. + */ +typedef SbgErrorCode (*SbgInterfaceFlushFunc)(SbgInterface *pInterface, uint32_t flags); + +/*! + * Change an interface input and output speed in bps (bit per second) + * + * This method will try to change the speed immediately even if there are + * pending bytes in the send buffer. + * + * If you would like to make sure that all bytes in the Tx buffer have been + * sent before changing the speed, please flush the interface before. + * + * WARNING: The method has no action if not applicable for a type of interface + * + * \param[in] pInterface Interface instance. + * \param[in] speed The new interface speed to set in bps. + * \return SBG_NO_ERROR if successful. + */ +typedef SbgErrorCode (*SbgInterfaceSetSpeed)(SbgInterface *pInterface, uint32_t speed); + +/*! + * Returns the current interface baud rate in bps (bit per second) + * + * WARNING: The method will returns zero if not applicable for a type of interface + * + * \param[in] pInterface Interface instance. + * \return The current interface baud rate in bps or zero if not applicable. + */ +typedef uint32_t (*SbgInterfaceGetSpeed)(const SbgInterface *pInterface); + +/*! + * Compute and return the delay needed by the interface to transmit / receive X number of bytes. + * + * WARNING: The method will returns zero if not applicable for a type of interface. + * + * \param[in] pInterface Interface instance. + * \param[in] numBytes The number of bytes to transmit / receive to evaluate the needed delay. + * \return The expected delay in us needed to transmit / receive the specified number of bytes or 0 if not applicable. + */ +typedef uint32_t (*SbgInterfaceGetDelayFunc)(const SbgInterface *pInterface, size_t numBytes); + +//----------------------------------------------------------------------// +//- Structures definitions -// +//----------------------------------------------------------------------// + +/*! + * Interface definition that stores methods used to communicate on the interface. + * + * The interface class is designed to allow custom user implementations. The type member stores + * a type identifier allowing the identification of the underlying type, including custom + * implementations. Standard interfaces provided by this library use types from 1 up to + * and including SBG_IF_TYPE_LAST_RESERVED. Greater values are intended to identify custom + * types that are normally specific to the project using this library. The value 0 identifies + * an unknown interface type, usually indicating that the interface was not correctly initialized. + */ +struct _SbgInterface +{ + SbgInterfaceHandle handle; /*!< Internal interface handle used to access the media. */ + uint32_t type; /*!< Opaque interface type. */ + char name[SBG_IF_NAME_MAX_SIZE]; /*!< The interface name as passed during the creation */ + + SbgInterfaceDestroyFunc pDestroyFunc; /*!< Optional method used to destroy an interface. */ + SbgInterfaceWriteFunc pWriteFunc; /*!< Optional method used to write some data to this interface. */ + SbgInterfaceReadFunc pReadFunc; /*!< Optional method used to read some data to this interface. */ + SbgInterfaceFlushFunc pFlushFunc; /*!< Optional method used to make this interface flush all pending data. */ + SbgInterfaceSetSpeed pSetSpeedFunc; /*!< Optional method used to set the interface speed in bps. */ + SbgInterfaceGetSpeed pGetSpeedFunc; /*!< Optional method used to retrieve the interface speed in bps. */ + SbgInterfaceGetDelayFunc pDelayFunc; /*!< Optional method used to compute an expected delay to transmit/receive X bytes */ +}; + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Initialize an interface instance to zero. + * + * \param[in] pInterface The interface instance. + */ +SBG_COMMON_LIB_API void sbgInterfaceZeroInit(SbgInterface *pInterface); + +/*! + * Close and destroy the interface gracefully. + * + * This method will call the specialized interface destructor if any. + * + * \param[in] pInterface The interface instance. + * \return SBG_NO_ERROR if the interface has been destroyed successfully. + */ +SBG_COMMON_LIB_API SbgErrorCode sbgInterfaceDestroy(SbgInterface *pInterface); + +/*! + * Returns the interface type. + * + * \param[in] pInterface Interface instance + * \return The interface type. + */ +SBG_INLINE uint32_t sbgInterfaceTypeGet(const SbgInterface *pInterface) +{ + assert(pInterface); + + return pInterface->type; +} + +/*! + * Returns the interface as string. + * + * \param[in] pInterface Interface instance + * \return The interface type. + */ +SBG_COMMON_LIB_API const char *sbgInterfaceTypeGetAsString(const SbgInterface *pInterface); + +/*! + * Returns the interface name string. + * + * \param[in] pInterface Interface instance + * \return The interface name as a NULL terminated C string. + */ +SBG_INLINE const char *sbgInterfaceNameGet(const SbgInterface *pInterface) +{ + assert(pInterface); + + return pInterface->name; +} + +/*! + * Define the interface name as a NULL terminated C string. + * + * This method make sure that the provided string will always fit within + * the allocated name buffer. + * + * If the interface name you would like to set is too long, only the end + * of the string will be kept. + * + * \param[in] pInterface Interface instance + * \param[in] pName The interface name to set as a NULL terminated C string + */ +SBG_COMMON_LIB_API void sbgInterfaceNameSet(SbgInterface *pInterface, const char *pName); + +/*! + * Write some data to an interface. + * + * This method should return an error only if all bytes were not written successfully. + * If you try to write zero byte, the method shouldn't return any error. + * + * \param[in] pInterface Interface instance. + * \param[in] pBuffer Pointer on an allocated buffer that contains the data to write + * \param[in] bytesToWrite Number of bytes we would like to write (can be zero). + * \return SBG_NO_ERROR if exactly bytesToWrite have been written successfully. + * SBG_INVALID_PARAMETER if the interface doesn't support write operations. + */ +SBG_INLINE SbgErrorCode sbgInterfaceWrite(SbgInterface *pInterface, const void *pBuffer, size_t bytesToWrite) +{ + SbgErrorCode errorCode; + + assert(pInterface); + assert(pBuffer); + + if (pInterface->pWriteFunc) + { + errorCode = pInterface->pWriteFunc(pInterface, pBuffer, bytesToWrite); + } + else + { + errorCode = SBG_INVALID_PARAMETER; + } + + return errorCode; +} + +/*! + * Try to read some data from an interface. + * + * This method returns an error only if there is a 'low level' error on the interface. + * If no byte is read at all or less bytes than bytesToRead, this method returns SBG_NO_ERROR. + * You have to check pReadBytes field to know the number of bytes actually read. + * + * \param[in] pInterface Interface instance. + * \param[in] pBuffer Pointer on an allocated buffer that can hold at least bytesToRead bytes of data. + * \param[out] pReadBytes Returns the number of bytes actually read (can be zero and up to bytesToRead). + * \param[in] bytesToRead Maximum number of bytes to try to read on the interface. + * \return SBG_NO_ERROR if zero or some bytes have been read successfully. + * SBG_INVALID_PARAMETER if the interface doesn't support read operations. + */ +SBG_INLINE SbgErrorCode sbgInterfaceRead(SbgInterface *pInterface, void *pBuffer, size_t *pReadBytes, size_t bytesToRead) +{ + SbgErrorCode errorCode; + + assert(pInterface); + assert(pBuffer); + assert(pReadBytes); + + if (pInterface->pReadFunc) + { + errorCode = pInterface->pReadFunc(pInterface, pBuffer, pReadBytes, bytesToRead); + } + else + { + *pReadBytes = 0; + errorCode = SBG_INVALID_PARAMETER; + } + + return errorCode; +} + +/*! + * Make an interface flush pending input and/or output data. + * + * If flags include SBG_IF_FLUSH_INPUT, all pending input data is discarded. + * If flags include SBG_IF_FLUSH_OUTPUT, the function blocks until all output data has been written out. + * + * WARNING: The method has no action if not applicable for a type of interface + * + * \param[in] pInterface Interface instance. + * \param[in] flags Combination of the SBG_IF_FLUSH_INPUT and SBG_IF_FLUSH_OUTPUT flags. + * \return SBG_NO_ERROR if successful. + */ +SBG_INLINE SbgErrorCode sbgInterfaceFlush(SbgInterface *pInterface, uint32_t flags) +{ + SbgErrorCode errorCode; + + assert(pInterface); + assert((flags & ~SBG_IF_FLUSH_ALL) == 0); + + if (pInterface->pFlushFunc) + { + errorCode = pInterface->pFlushFunc(pInterface, flags); + } + else + { + errorCode = SBG_NO_ERROR; + } + + return errorCode; +} + +/*! + * Change an interface input and output speed in bps (bit per second) + * + * This method will try to change the speed immediately even if there are + * pending bytes in the send buffer. + * + * If you would like to make sure that all bytes in the Tx buffer have been + * sent before changing the speed, please flush the interface before. + * + * WARNING: The method has no action if not applicable for a type of interface + * + * \param[in] pInterface Interface instance. + * \param[in] speed The new interface speed to set in bps. + * \return SBG_NO_ERROR if successful. + */ +SBG_INLINE SbgErrorCode sbgInterfaceSetSpeed(SbgInterface *pInterface, uint32_t speed) +{ + assert(pInterface); + assert(speed > 0); + + if (pInterface->pSetSpeedFunc) + { + return pInterface->pSetSpeedFunc(pInterface, speed); + } + else + { + return SBG_NO_ERROR; + } +} + +/*! + * Returns the current interface baud rate in bps (bit per second) + * + * WARNING: The method will returns zero if not applicable for a type of interface + * + * \param[in] pInterface Interface instance. + * \return The current interface baud rate in bps or zero if not applicable. + */ +SBG_INLINE uint32_t sbgInterfaceGetSpeed(const SbgInterface *pInterface) +{ + assert(pInterface); + + if (pInterface->pGetSpeedFunc) + { + return pInterface->pGetSpeedFunc(pInterface); + } + else + { + return 0; + } +} + +/*! + * Compute and return the delay needed by the interface to transmit / receive X number of bytes. + * + * WARNING: The method will returns zero if not applicable for a type of interface. + * + * \param[in] pInterface Interface instance. + * \param[in] numBytes The number of bytes to transmit / receive to evaluate the needed delay. + * \return The expected delay in us needed to transmit / receive the specified number of bytes or 0 if not applicable. + */ +SBG_INLINE uint32_t sbgInterfaceGetDelay(const SbgInterface *pInterface, size_t numBytes) +{ + assert(pInterface); + + if (pInterface->pDelayFunc) + { + return pInterface->pDelayFunc(pInterface, numBytes); + } + else + { + return 0; + } +} + +//----------------------------------------------------------------------// +//- Footer (close extern C block) -// +//----------------------------------------------------------------------// +#ifdef __cplusplus +} +#endif + +#endif /* SBG_INTERFACE_H */ diff --git a/common/interfaces/sbgInterfaceFile.c b/common/interfaces/sbgInterfaceFile.c new file mode 100644 index 0000000..b8189dc --- /dev/null +++ b/common/interfaces/sbgInterfaceFile.c @@ -0,0 +1,304 @@ +// sbgCommnonLib headers +#include + +// Local headers +#include "sbgInterface.h" +#include "sbgInterfaceFile.h" + +//----------------------------------------------------------------------// +//- Private methods -// +//----------------------------------------------------------------------// + +/*! + * Returns the interface FILE descriptor. + * + * \param[in] pInterface Interface instance. + * \return The associated FILE descriptor. + */ +static FILE *sbgInterfaceFileGetDesc(SbgInterface *pInterface) +{ + assert(pInterface); + assert(pInterface->type == SBG_IF_TYPE_FILE); + assert(pInterface->handle); + + return (FILE*)pInterface->handle; +} + +/*! + * Destroy the interface by closing the file descriptor. + * + * \param[in] pInterface Interface instance. + * \return SBG_NO_ERROR if the interface has been closed successfully. + */ +static SbgErrorCode sbgInterfaceFileDestroy(SbgInterface *pInterface) +{ + FILE *pInputFile; + + assert(pInterface); + assert(pInterface->type == SBG_IF_TYPE_FILE); + + pInputFile = sbgInterfaceFileGetDesc(pInterface); + + fclose(pInputFile); + sbgInterfaceZeroInit(pInterface); + + return SBG_NO_ERROR; +} + +/*! + * Write some data the the file + * + * \param[in] pInterface Valid handle on an initialized interface. + * \param[in] pBuffer Pointer on an allocated buffer that contains the data to write + * \param[in] bytesToWrite Number of bytes we would like to write. + * \return SBG_NO_ERROR if all bytes have been written successfully. + */ +static SbgErrorCode sbgInterfaceFileWrite(SbgInterface *pInterface, const void *pBuffer, size_t bytesToWrite) +{ + FILE *pOutputFile; + size_t bytesWritten; + + assert(pInterface); + assert(pInterface->type == SBG_IF_TYPE_FILE); + assert(pBuffer); + + pOutputFile = sbgInterfaceFileGetDesc(pInterface); + + // + // Write the data and check if all bytes have been written + // + bytesWritten = fwrite(pBuffer, sizeof(uint8_t), bytesToWrite, pOutputFile); + + if (bytesWritten == bytesToWrite) + { + + return SBG_NO_ERROR; + } + else + { + return SBG_WRITE_ERROR; + } +} + +/*! + * Try to read some data from an interface. + * \param[in] pInterface Valid handle on an initialized interface. + * \param[in] pBuffer Pointer on an allocated buffer that can hold at least bytesToRead bytes of data. + * \param[out] pReadBytes Pointer on an uint32_t used to return the number of read bytes. + * \param[in] bytesToRead Number of bytes we would like to read. + * \return SBG_NO_ERROR if no error occurs, please check the number of received bytes. + */ +static SbgErrorCode sbgInterfaceFileRead(SbgInterface *pInterface, void *pBuffer, size_t *pReadBytes, size_t bytesToRead) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + FILE *pInputFile; + + assert(pInterface); + assert(pInterface->type == SBG_IF_TYPE_FILE); + assert(pBuffer); + assert(pReadBytes); + + pInputFile = sbgInterfaceFileGetDesc(pInterface); + + // + // Read some bytes from the file and check if an error has occurred + // + *pReadBytes = fread(pBuffer, sizeof(uint8_t), bytesToRead, pInputFile); + + if (*pReadBytes < bytesToRead) + { + // + // Don't report an error if we have reached the end of the file to comply with sbgInterface specification + // + if (ferror(pInputFile) != 0) + { + errorCode = SBG_READ_ERROR; + SBG_LOG_ERROR(errorCode, "File read error %u", ferror(pInputFile)); + } + } + + return errorCode; +} + +/*! + * Make an interface flush all pending input or output data. + * + * If flags include SBG_IF_FLUSH_INPUT, all pending input data is discarded. + * If flags include SBG_IF_FLUSH_OUTPUT, the function blocks until all output data has been written out. + * + * \param[in] pInterface Valid handle on an initialized interface. + * \param[in] flags Combination of the SBG_IF_FLUSH_INPUT and SBG_IF_FLUSH_OUTPUT flags. + * \return SBG_NO_ERROR if successful. + */ +static SbgErrorCode sbgInterfaceFileFlush(SbgInterface *pInterface, uint32_t flags) +{ + SbgErrorCode errorCode; + FILE *pInputFile; + + assert(pInterface); + assert(pInterface->type == SBG_IF_TYPE_FILE); + + pInputFile = sbgInterfaceFileGetDesc(pInterface); + + if ((pInterface->pReadFunc && (flags & SBG_IF_FLUSH_INPUT)) || + (pInterface->pWriteFunc && (flags & SBG_IF_FLUSH_OUTPUT))) + { + int ret; + + ret = fflush(pInputFile); + + if (ret == 0) + { + errorCode = SBG_NO_ERROR; + } + else + { + errorCode = SBG_ERROR; + } + } + else + { + errorCode = SBG_NO_ERROR; + } + + return errorCode; +} + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +SBG_COMMON_LIB_API SbgErrorCode sbgInterfaceFileOpen(SbgInterface *pInterface, const char *filePath) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + FILE *pInputFile; + + assert(pInterface); + assert(filePath); + + // + // Always call the underlying zero init method to make sure we can correctly handle SbgInterface evolutions + // + sbgInterfaceZeroInit(pInterface); + + // + // Try to open the file + // + pInputFile = fopen(filePath, "rb"); + + // + // Test if the input file has been opened + // + if (pInputFile) + { + // + // Define base interface members + // + pInterface->handle = pInputFile; + pInterface->type = SBG_IF_TYPE_FILE; + + // + // Define the interface name + // + sbgInterfaceNameSet(pInterface, filePath); + + // + // Define all specialized members + // + pInterface->pDestroyFunc = sbgInterfaceFileDestroy; + pInterface->pReadFunc = sbgInterfaceFileRead; + pInterface->pWriteFunc = NULL; + pInterface->pFlushFunc = sbgInterfaceFileFlush; + } + else + { + // + // Unable to open the input file + // + errorCode = SBG_INVALID_PARAMETER; + } + + return errorCode; +} + +SBG_COMMON_LIB_API SbgErrorCode sbgInterfaceFileWriteOpen(SbgInterface *pInterface, const char *filePath) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + FILE *pInputFile; + + assert(pInterface); + assert(filePath); + + // + // Try to open the file + // + pInputFile = fopen(filePath, "wb"); + + // + // Test if the input file has been opened + // + if (pInputFile) + { + // + // Define base interface members + // + pInterface->handle = pInputFile; + pInterface->type = SBG_IF_TYPE_FILE; + + // + // Define the interface name + // + sbgInterfaceNameSet(pInterface, filePath); + + // + // Define all specialized members + // + pInterface->pDestroyFunc = sbgInterfaceFileDestroy; + pInterface->pReadFunc = NULL; + pInterface->pWriteFunc = sbgInterfaceFileWrite; + pInterface->pFlushFunc = sbgInterfaceFileFlush; + } + else + { + // + // Unable to open the input file + // + errorCode = SBG_INVALID_PARAMETER; + } + + return errorCode; +} + +SBG_COMMON_LIB_API size_t sbgInterfaceFileGetSize(SbgInterface *pInterface) +{ + FILE *pInputFile; + long cursorPos; + long fileSize; + + assert(pInterface); + assert(pInterface->type == SBG_IF_TYPE_FILE); + + pInputFile = sbgInterfaceFileGetDesc(pInterface); + + // + // Compute the file size + // + cursorPos = ftell(pInputFile); + fseek(pInputFile, 0, SEEK_END); + fileSize = ftell(pInputFile); + fseek(pInputFile, cursorPos, SEEK_SET); + + return (size_t)fileSize; +} + +SBG_COMMON_LIB_API size_t sbgInterfaceFileGetCursor(const SbgInterface *pInterface) +{ + FILE *pInputFile; + + assert(pInterface); + assert(pInterface->type == SBG_IF_TYPE_FILE); + + pInputFile = sbgInterfaceFileGetDesc((SbgInterface*)pInterface); + + return (size_t)ftell(pInputFile); +} diff --git a/common/interfaces/sbgInterfaceFile.h b/common/interfaces/sbgInterfaceFile.h new file mode 100644 index 0000000..63e2296 --- /dev/null +++ b/common/interfaces/sbgInterfaceFile.h @@ -0,0 +1,92 @@ +/*! + * \file sbgInterfaceFile.h + * \author SBG Systems (Raphael Siryani) + * \date 01 April 2013 + * + * \brief This file implements a file interface for read only operations. + * + * \section CodeCopyright Copyright Notice + * The MIT license + * + * Copyright (C) 2007-2020, SBG Systems SAS. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef SBG_INTERFACE_FILE_H +#define SBG_INTERFACE_FILE_H + +//----------------------------------------------------------------------// +//- Header (open extern C block) -// +//----------------------------------------------------------------------// +#ifdef __cplusplus +extern "C" { +#endif + +// sbgCommonLib headers +#include + +// Local headers +#include "sbgInterface.h" + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Open a file as an interface for read only operations. + * + * \param[in] pHandle Pointer on an allocated interface instance to initialize. + * \param[in] filePath File path to open. + * \return SBG_NO_ERROR if the interface has been created. + */ +SBG_COMMON_LIB_API SbgErrorCode sbgInterfaceFileOpen(SbgInterface *pHandle, const char *filePath); + +/*! + * Open a file as an interface for write only operations. + * + * \param[in] pHandle Pointer on an allocated interface instance to initialize. + * \param[in] filePath File path to open. + * \return SBG_NO_ERROR if the interface has been created. + */ +SBG_COMMON_LIB_API SbgErrorCode sbgInterfaceFileWriteOpen(SbgInterface *pHandle, const char *filePath); + +/*! + * Returns the file size in bytes. + * + * \param[in] pInterface Valid handle on an initialized interface. + * \return The file size in bytes. + */ +SBG_COMMON_LIB_API size_t sbgInterfaceFileGetSize(SbgInterface *pHandle); + +/*! + * Returns the current cursor position in the file in bytes. + * + * \param[in] pInterface Valid handle on an initialized interface. + * \return The current cursor position in bytes. + */ +SBG_COMMON_LIB_API size_t sbgInterfaceFileGetCursor(const SbgInterface *pHandle); + +//----------------------------------------------------------------------// +//- Footer (close extern C block) -// +//----------------------------------------------------------------------// +#ifdef __cplusplus +} +#endif + +#endif /* SBG_INTERFACE_FILE_H */ diff --git a/common/interfaces/sbgInterfaceSerial.h b/common/interfaces/sbgInterfaceSerial.h new file mode 100644 index 0000000..addde3d --- /dev/null +++ b/common/interfaces/sbgInterfaceSerial.h @@ -0,0 +1,67 @@ +/*! + * \file sbgInterfaceSerial.h + * \author SBG Systems (Raphael Siryani) + * \date 06 February 2013 + * + * \brief This file implements a serial interface. + * + * \section CodeCopyright Copyright Notice + * The MIT license + * + * Copyright (C) 2007-2020, SBG Systems SAS. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef SBG_INTERFACE_SERIAL_H +#define SBG_INTERFACE_SERIAL_H + +//----------------------------------------------------------------------// +//- Header (open extern C block) -// +//----------------------------------------------------------------------// +#ifdef __cplusplus +extern "C" { +#endif + +// sbgCommonLib headers +#include +#include + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Initialize a serial interface for read and write operations. + * + * \param[in] pInterface Pointer on an allocated interface instance to initialize. + * \param[in] deviceName Serial interface location (COM21 , /dev/ttys0, depending on platform). + * \param[in] baudRate Serial interface baud rate in bps. + * \return SBG_NO_ERROR if the interface has been created. + */ +SBG_COMMON_LIB_API SbgErrorCode sbgInterfaceSerialCreate(SbgInterface *pInterface, const char *deviceName, uint32_t baudRate); + +//----------------------------------------------------------------------// +//- Footer (close extern C block) -// +//----------------------------------------------------------------------// +#ifdef __cplusplus +} +#endif + +#endif // SBG_INTERFACE_SERIAL_H diff --git a/common/interfaces/sbgInterfaceSerialUnix.c b/common/interfaces/sbgInterfaceSerialUnix.c new file mode 100644 index 0000000..88871d0 --- /dev/null +++ b/common/interfaces/sbgInterfaceSerialUnix.c @@ -0,0 +1,541 @@ +// Standard headers +#include +#include +#include +#include +#include +#include +#include + +// sbgCommonLib headers +#include +#include + +//----------------------------------------------------------------------// +//- Definitions -// +//----------------------------------------------------------------------// +#define SBG_IF_SERIAL_TX_BUFFER_SIZE (4096u) /*!< Define the transmission buffer size for the serial port. */ +#define SBG_IF_SERIAL_RX_BUFFER_SIZE (4096u) /*!< Define the reception buffer size for the serial port. */ + +//----------------------------------------------------------------------// +//- Private methods declarations -// +//----------------------------------------------------------------------// + + +/*! + * Returns the right unix baud rate const according to a baud rate value. + * + * \param[in] baudRate The baud rate value (ie 115200). + * \return The Unix baud rate constant. + */ +static uint32_t sbgInterfaceSerialGetBaudRateConst(uint32_t baudRate) +{ + uint32_t baudRateConst; + + // + // Create the right baud rate value for unix platforms + // + switch (baudRate) + { + case 9600: + baudRateConst = B9600; + break; + case 19200: + baudRateConst = B19200; + break; +#ifdef B38400 + case 38400: + baudRateConst = B38400; + break; +#endif +#ifdef B57600 + case 57600: + baudRateConst = B57600; + break; +#endif +#ifdef B115200 + case 115200: + baudRateConst = B115200; + break; +#endif +#ifdef B230400 + case 230400: + baudRateConst = B230400; + break; +#endif +#ifdef B460800 + case 460800: + baudRateConst = B460800; + break; +#endif +#ifdef B921600 + case 921600: + baudRateConst = B921600; + break; +#endif +#ifdef B1000000 + case 1000000: + baudRateConst = B1000000; + break; +#endif +#ifdef B1152000 + case 1152000: + baudRateConst = B1152000; + break; +#endif +#ifdef B1500000 + case 1500000: + baudRateConst = B1500000; + break; +#endif +#ifdef B2000000 + case 2000000: + baudRateConst = B2000000; + break; +#endif +#ifdef B2500000 + case 2500000: + baudRateConst = B2500000; + break; +#endif +#ifdef B3000000 + case 3000000: + baudRateConst = B3000000; + break; +#endif +#ifdef B3500000 + case 3500000: + baudRateConst = B3500000; + break; +#endif +#ifdef B4000000 + case 4000000: + baudRateConst = B4000000; + break; +#endif + default: + baudRateConst = baudRate; + } + + return baudRateConst; +} + +/*! + * Destroy an interface initialized using sbgInterfaceSerialCreate. + * + * \param[in] pInterface Valid handle on an initialized interface. + * \return SBG_NO_ERROR if the interface has been closed and released. + */ +static SbgErrorCode sbgInterfaceSerialDestroy(SbgInterface *pInterface) +{ + int *pSerialHandle; + + assert(pInterface); + assert(pInterface->type == SBG_IF_TYPE_SERIAL); + + // + // Test that we have a valid interface + // + if (pInterface) + { + // + // Get the internal serial handle + // + pSerialHandle = (int*)pInterface->handle; + + // + // Close the port com + // + close((*pSerialHandle)); + SBG_FREE(pSerialHandle); + pInterface->handle = NULL; + + return SBG_NO_ERROR; + } + else + { + return SBG_NULL_POINTER; + } +} + +/*! + * Make an interface flush pending input and/or output data. + * + * If flags include SBG_IF_FLUSH_INPUT, all pending input data is discarded. + * If flags include SBG_IF_FLUSH_OUTPUT, the function blocks until all output data has been written out. + * + * \param[in] pInterface Interface instance. + * \param[in] flags Combination of the SBG_IF_FLUSH_INPUT and SBG_IF_FLUSH_OUTPUT flags. + * \return SBG_NO_ERROR if successful. + */ +static SbgErrorCode sbgInterfaceSerialFlush(SbgInterface *pInterface, uint32_t flags) +{ + SbgErrorCode errorCode; + int fd; + int result = 0; + + assert(pInterface); + assert(pInterface->type == SBG_IF_TYPE_SERIAL); + + fd = *((int *)pInterface->handle); + + if ((result == 0) && (flags & SBG_IF_FLUSH_INPUT)) + { + result = tcflush(fd, TCIFLUSH); + + if (result != 0) + { + SBG_LOG_ERROR(SBG_READ_ERROR, "unable to flush input, error:%s", strerror(errno)); + } + } + + if ((result == 0) && (flags & SBG_IF_FLUSH_OUTPUT)) + { + result = tcdrain(fd); + + if (result != 0) + { + SBG_LOG_ERROR(SBG_WRITE_ERROR, "unable to flush output, error:%s", strerror(errno)); + } + } + + if (result == 0) + { + errorCode = SBG_NO_ERROR; + } + else + { + errorCode = SBG_ERROR; + } + + return errorCode; +} + +/*! + * Change the serial interface baud rate immediatly. + * + * \param[in] handle Valid handle on an initialized interface. + * \param[in] baudRate The new baudrate to apply in bps. + * \return SBG_NO_ERROR if everything is OK + */ +static SbgErrorCode sbgInterfaceSerialChangeBaudrate(SbgInterface *pInterface, uint32_t baudRate) +{ + int hSerialHandle; + struct termios options; + uint32_t baudRateConst; + + assert(pInterface); + assert(pInterface->type == SBG_IF_TYPE_SERIAL); + + // + // Get the internal serial handle + // + hSerialHandle = *((int*)pInterface->handle); + + // + // Get the baud rate const for our Unix platform + // + baudRateConst = sbgInterfaceSerialGetBaudRateConst(baudRate); + + // + // Retrieve current options + // + if (tcgetattr(hSerialHandle, &options) != -1) + { + // + // Set both input and output baud + // + if ( (cfsetispeed(&options, baudRateConst) == -1) || (cfsetospeed(&options, baudRateConst) == -1) ) + { + fprintf(stderr, "sbgInterfaceSerialChangeBaudrate: Unable to set speed.\n"); + return SBG_ERROR; + } + + // + // Define options + // + if (tcsetattr(hSerialHandle, TCSADRAIN, &options) != -1) + { + return SBG_NO_ERROR; + } + else + { + fprintf(stderr, "sbgInterfaceSerialChangeBaudrate: tcsetattr fails.\n"); + return SBG_ERROR; + } + } + else + { + fprintf(stderr, "sbgInterfaceSerialChangeBaudrate: tcgetattr fails.\n"); + return SBG_ERROR; + } +} + +//----------------------------------------------------------------------// +//- Internal interfaces write/read implementations -// +//----------------------------------------------------------------------// + +/*! + * Try to write some data to an interface. + * + * \param[in] pInterface Valid handle on an initialized interface. + * \param[in] pBuffer Pointer on an allocated buffer that contains the data to write + * \param[in] bytesToWrite Number of bytes we would like to write. + * \return SBG_NO_ERROR if all bytes have been written successfully. + */ +static SbgErrorCode sbgInterfaceSerialWrite(SbgInterface *pInterface, const void *pBuffer, size_t bytesToWrite) +{ + size_t numBytesLeftToWrite = bytesToWrite; + uint8_t *pCurrentBuffer = (uint8_t*)pBuffer; + ssize_t numBytesWritten; + int hSerialHandle; + + assert(pInterface); + assert(pInterface->type == SBG_IF_TYPE_SERIAL); + assert(pBuffer); + + // + // Get the internal serial handle + // + hSerialHandle = *((int*)pInterface->handle); + + // + // Write the whole buffer + // + while (numBytesLeftToWrite > 0) + { + // + // Write these bytes to the serial interface + // + numBytesWritten = write(hSerialHandle, pCurrentBuffer, numBytesLeftToWrite); + + // + // Test the there is no error + // + if (numBytesWritten == -1) + { + if (errno == EAGAIN) + { + sbgSleep(1); + } + else + { + // + // An error has occured during the write + // + fprintf(stderr, "sbgDeviceWrite: Unable to write to our device: %s\n", strerror(errno)); + return SBG_WRITE_ERROR; + } + } + else + { + // + // Update the buffer pointer and the number of bytes to write + // + numBytesLeftToWrite -= (size_t)numBytesWritten; + pCurrentBuffer += (size_t)numBytesWritten; + } + } + + return SBG_NO_ERROR; +} + +/*! + * Try to read some data from an interface. + * + * \param[in] pInterface Valid handle on an initialized interface. + * \param[in] pBuffer Pointer on an allocated buffer that can hold at least bytesToRead bytes of data. + * \param[out] pReadBytes Pointer on an uint32 used to return the number of read bytes. + * \param[in] bytesToRead Number of bytes we would like to read. + * \return SBG_NO_ERROR if no error occurs, please check the number of received bytes. + */ +static SbgErrorCode sbgInterfaceSerialRead(SbgInterface *pInterface, void *pBuffer, size_t *pReadBytes, size_t bytesToRead) +{ + SbgErrorCode errorCode; + int hSerialHandle; + ssize_t numBytesRead; + + assert(pInterface); + assert(pInterface->type == SBG_IF_TYPE_SERIAL); + assert(pBuffer); + assert(pReadBytes); + + // + // Get the internal serial handle + // + hSerialHandle = *((int*)pInterface->handle); + + // + // Read our buffer + // + numBytesRead = read(hSerialHandle, pBuffer, bytesToRead); + + // + // Check if the read operation was successful + // + if (numBytesRead >= 0) + { + errorCode = SBG_NO_ERROR; + } + else + { + if (errno == EAGAIN) + { + errorCode = SBG_NO_ERROR; + } + else + { + errorCode = SBG_READ_ERROR; + } + + numBytesRead = 0; + } + + // + // If we can, returns the number of read bytes + // + *pReadBytes = (size_t)numBytesRead; + + return errorCode; +} + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgInterfaceSerialCreate(SbgInterface *pInterface, const char *deviceName, uint32_t baudRate) +{ + int *pSerialHandle; + struct termios options; + uint32_t baudRateConst; + + assert(pInterface); + assert(deviceName); + + // + // Always call the underlying zero init method to make sure we can correctly handle SbgInterface evolutions + // + sbgInterfaceZeroInit(pInterface); + + // + // Get our baud rate const for our Unix platform + // + baudRateConst = sbgInterfaceSerialGetBaudRateConst(baudRate); + + // + // Allocate the serial handle + // + pSerialHandle = (int*)malloc(sizeof(int)); + + // + // Init the com port + // + (*pSerialHandle) = open(deviceName, O_RDWR | O_NOCTTY | O_NDELAY); + + // + // Test that the port has been initialized + // + if ((*pSerialHandle) != -1) + { + // + // Don't block on read call if no data are available + // + if (fcntl((*pSerialHandle), F_SETFL, O_NONBLOCK) != -1) + { + // + // Retreive current options + // + if (tcgetattr((*pSerialHandle), &options) != -1) + { + // + // Define com port options + // + options.c_cflag |= (CLOCAL | CREAD); // Enable the receiver and set local mode... + options.c_cflag &= ~(PARENB|CSTOPB|CSIZE); // No parity, 1 stop bit, mask character size bits + options.c_cflag |= CS8; // Select 8 data bits + options.c_cflag &= ~CRTSCTS; // Disable Hardware flow control + + // + // Disable software flow control + // + options.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON); + + // + // We would like raw input + // + options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG /*| IEXTEN | ECHONL*/); + options.c_oflag &= ~OPOST; + + // + // Set our timeout to 0 + // + options.c_cc[VMIN] = 0; + options.c_cc[VTIME] = 1; + + // + // Set both input and output baud + // + if ( (cfsetispeed(&options, baudRateConst) != -1) && (cfsetospeed(&options, baudRateConst) != -1) ) + { + // + // Define options + // + if (tcsetattr((*pSerialHandle), TCSANOW, &options) != -1) + { + // + // The serial port is ready so create a new serial interface + // + pInterface->handle = (void*)pSerialHandle; + pInterface->type = SBG_IF_TYPE_SERIAL; + + // + // Define the interface name + // + sbgInterfaceNameSet(pInterface, deviceName); + + // + // Define all overloaded members + // + pInterface->pDestroyFunc = sbgInterfaceSerialDestroy; + pInterface->pReadFunc = sbgInterfaceSerialRead; + pInterface->pWriteFunc = sbgInterfaceSerialWrite; + pInterface->pFlushFunc = sbgInterfaceSerialFlush; + pInterface->pSetSpeedFunc = sbgInterfaceSerialChangeBaudrate; + + // + // Purge the communication + // + return sbgInterfaceSerialFlush(pInterface, SBG_IF_FLUSH_ALL); + } + else + { + fprintf(stderr, "sbgInterfaceSerialCreate: tcsetattr fails.\n"); + } + } + else + { + fprintf(stderr, "sbgInterfaceSerialCreate: Unable to set speed.\n"); + } + } + else + { + fprintf(stderr, "sbgInterfaceSerialCreate: tcgetattr fails.\n"); + } + } + else + { + fprintf(stderr, "sbgInterfaceSerialCreate: fcntl fails\n"); + } + } + else + { + fprintf(stderr, "sbgInterfaceSerialCreate: Unable to open the com port: %s\n", deviceName); + } + + // + // Release the allocated serial handle + // + SBG_FREE(pSerialHandle); + + return SBG_ERROR; +} diff --git a/common/interfaces/sbgInterfaceSerialWin.c b/common/interfaces/sbgInterfaceSerialWin.c new file mode 100644 index 0000000..de3b652 --- /dev/null +++ b/common/interfaces/sbgInterfaceSerialWin.c @@ -0,0 +1,510 @@ +// Windows headers +#include + +// sbgCommonLib headers +#include +#include + +//----------------------------------------------------------------------// +//- Definitions -// +//----------------------------------------------------------------------// +#define SBG_IF_SERIAL_TX_BUFFER_SIZE (4096u) /*!< Define the transmission buffer size for the serial port. */ +#define SBG_IF_SERIAL_RX_BUFFER_SIZE (4096u) /*!< Define the reception buffer size for the serial port. */ + +//----------------------------------------------------------------------// +//- Internal methods declarations -// +//----------------------------------------------------------------------// + +/*! + * Returns the last error message for windows api calls. + * + * \param[out] pErrorMsg Pointer on an allocated string that can stores the windows error message. + * \param[in] errorMsgSize Error message buffer size in bytes. + * \return The last error number. + */ +static uint32_t sbgGetWindowsErrorMsg(char *pErrorMsg, size_t errorMsgSize) +{ + DWORD dw = GetLastError(); + DWORD numCharWritten; + LPVOID lpMsgBuf = NULL; + + assert(pErrorMsg); + + // + // Get the error message + // + numCharWritten = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, dw, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&lpMsgBuf, 0, NULL); + + // + // Test if a message has been correctly written + // + if (numCharWritten > 0) + { + // + // Copy the error message + // + strcpy_s(pErrorMsg, errorMsgSize, lpMsgBuf); + } + else + { + pErrorMsg[0] = '\0'; + } + + // + // Release the buffer + // + LocalFree(lpMsgBuf); + + return dw; +} + +/*! + * Returns the serial interface descriptor. + * + * \param[in] pInterface Interface instance. + * \return The associated serial descriptor. + */ +static HANDLE *sbgInterfaceFileGetDesc(SbgInterface *pInterface) +{ + assert(pInterface); + assert(pInterface->type == SBG_IF_TYPE_SERIAL); + assert(pInterface->handle); + + return (HANDLE*)pInterface->handle; +} + +/*! + * Destroy and close the serial interface. + * + * \param[in] pInterface Valid handle on an initialized interface. + * \return SBG_NO_ERROR if the interface has been closed and released. + */ +static SbgErrorCode sbgInterfaceSerialDestroy(SbgInterface *pInterface) +{ + HANDLE pSerialDevice; + + assert(pInterface); + assert(pInterface->type == SBG_IF_TYPE_SERIAL); + + pSerialDevice = sbgInterfaceFileGetDesc(pInterface); + + // + // Close the port com and clear the interface + // + CloseHandle(pSerialDevice); + sbgInterfaceZeroInit(pInterface); + + return SBG_NO_ERROR; +} + + +/*! + * Try to write some data to an interface. + * + * \param[in] pInterface Valid handle on an initialized interface. + * \param[in] pBuffer Pointer on an allocated buffer that contains the data to write + * \param[in] bytesToWrite Number of bytes we would like to write. + * \return SBG_NO_ERROR if all bytes have been written successfully. + */ +static SbgErrorCode sbgInterfaceSerialWrite(SbgInterface *pInterface, const void *pBuffer, size_t bytesToWrite) +{ + DWORD numBytesLeftToWrite; + uint8_t *pCurrentBuffer; + DWORD numBytesWritten; + HANDLE pSerialDevice; + char errorMsg[256]; + + assert(pInterface); + assert(pInterface->type == SBG_IF_TYPE_SERIAL); + assert(pBuffer); + + pSerialDevice = sbgInterfaceFileGetDesc(pInterface); + + // + // Write the whole buffer chunk by chunk + // + numBytesLeftToWrite = (DWORD)bytesToWrite; + pCurrentBuffer = (uint8_t*)pBuffer; + + while (numBytesLeftToWrite > 0) + { + // + // Write these bytes to the serial interface + // + if (WriteFile(pSerialDevice, pCurrentBuffer, numBytesLeftToWrite, (LPDWORD)&numBytesWritten, NULL) == false) + { + // + // An error has occured during the write + // + sbgGetWindowsErrorMsg(errorMsg, sizeof(errorMsg)); + SBG_LOG_ERROR(SBG_WRITE_ERROR, "Write failed error: %s", errorMsg); + return SBG_WRITE_ERROR; + } + + // + // Update the buffer pointer and the number of bytes to write + // + numBytesLeftToWrite -= (size_t)numBytesWritten; + pCurrentBuffer += numBytesWritten; + } + + return SBG_NO_ERROR; +} + +/*! + * Try to read some data from an interface. + * + * \param[in] pInterface Valid handle on an initialized interface. + * \param[in] pBuffer Pointer on an allocated buffer that can hold at least bytesToRead bytes of data. + * \param[out] pReadBytes Pointer on an uint32_t used to return the number of read bytes. + * \param[in] bytesToRead Number of bytes we would like to read. + * \return SBG_NO_ERROR if no error occurs, please check the number of received bytes. + */ +static SbgErrorCode sbgInterfaceSerialRead(SbgInterface *pInterface, void *pBuffer, size_t *pReadBytes, size_t bytesToRead) +{ + HANDLE pSerialDevice; + char errorMsg[256]; + DWORD bytesRead; + + assert(pInterface); + assert(pInterface->type == SBG_IF_TYPE_SERIAL); + assert(pBuffer); + assert(pReadBytes); + + pSerialDevice = sbgInterfaceFileGetDesc(pInterface); + + // + // Read some bytes on the serial buffer + // + if (ReadFile(pSerialDevice, pBuffer, (DWORD)bytesToRead, (LPDWORD)&bytesRead, NULL) == true) + { + // + // Update the number of bytes read + // + (*pReadBytes) = (size_t)bytesRead; + + return SBG_NO_ERROR; + } + else + { + *pReadBytes = (size_t)bytesRead; + + // + // Unable to read some bytes + // + sbgGetWindowsErrorMsg(errorMsg, sizeof(errorMsg)); + SBG_LOG_ERROR(SBG_READ_ERROR, "Read failed: %s", errorMsg); + return SBG_READ_ERROR; + } +} + +/*! + * Make an interface flush pending input and/or output data. + * + * If flags include SBG_IF_FLUSH_INPUT, all pending input data is discarded. + * If flags include SBG_IF_FLUSH_OUTPUT, the function blocks until all output data has been written out. + * + * \param[in] pInterface Interface instance. + * \param[in] flags Combination of the SBG_IF_FLUSH_INPUT and SBG_IF_FLUSH_OUTPUT flags. + * \return SBG_NO_ERROR if successful. + */ +static SbgErrorCode sbgInterfaceSerialFlush(SbgInterface *pInterface, uint32_t flags) +{ + SbgErrorCode errorCode; + HANDLE pSerialDevice; + BOOL result = TRUE; + + assert(pInterface); + assert(pInterface->type == SBG_IF_TYPE_SERIAL); + + pSerialDevice = sbgInterfaceFileGetDesc(pInterface); + + if (result && (flags & SBG_IF_FLUSH_INPUT)) + { + uint8_t buffer[256]; + size_t nrBytes; + + // + // XXX The PurgeComm function is too unreliable. Instead, perform the flush by manually + // draining all input data. + // + do + { + errorCode = sbgInterfaceSerialRead(pInterface, buffer, &nrBytes, sizeof(buffer)); + } + while ((errorCode == SBG_NO_ERROR) && (nrBytes != 0)); + + if (errorCode != SBG_NO_ERROR) + { + result = FALSE; + } + } + + if (result && (flags & SBG_IF_FLUSH_OUTPUT)) + { + result = FlushFileBuffers(pSerialDevice); + + if (!result) + { + char errorMsg[256]; + + sbgGetWindowsErrorMsg(errorMsg, sizeof(errorMsg)); + SBG_LOG_ERROR(SBG_WRITE_ERROR, "unable to flush output, error:%s", errorMsg); + } + } + + if (result == TRUE) + { + errorCode = SBG_NO_ERROR; + } + else + { + errorCode = SBG_ERROR; + } + + return errorCode; +} + +/*! + * Change the serial interface baudrate and flush the serial port to avoid having trash. + * + * \param[in] pInterface Valid handle on an initialized interface. + * \param[in] baudRate The new baudrate to apply in bps. + * \return SBG_NO_ERROR if everything is OK + */ +static SbgErrorCode sbgInterfaceSerialSetSpeed(SbgInterface *pInterface, uint32_t baudRate) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + HANDLE pSerialDevice; + DCB comState; + char errorMsg[256]; + + assert(pInterface); + assert(pInterface->type == SBG_IF_TYPE_SERIAL); + + pSerialDevice = sbgInterfaceFileGetDesc(pInterface); + + // + // Try to retreive current com state + // + if (GetCommState(pSerialDevice, &comState)) + { + comState.BaudRate = baudRate; + + // + // Send the new configuration + if (SetCommState(pSerialDevice, &comState)) + { + // + // Flush the serial interface + // + errorCode = sbgInterfaceFlush(pInterface, SBG_IF_FLUSH_ALL); + } + else + { + errorCode = SBG_ERROR; + sbgGetWindowsErrorMsg(errorMsg, sizeof(errorMsg)); + SBG_LOG_ERROR(errorCode, "Unable to set com state: %s", errorMsg); + + } + } + else + { + errorCode = SBG_ERROR; + sbgGetWindowsErrorMsg(errorMsg, sizeof(errorMsg)); + SBG_LOG_ERROR(errorCode, "Unable to retreive com state: %s", errorMsg); + } + + return errorCode; +} + +/*! + * Returns the current interface baud rate in bps (bit per second) + * + * WARNING: The method will returns zero if not applicable for a type of interface + * + * \param[in] pInterface Interface instance. + * \return The current interface baud rate in bps or zero if not applicable. + */ +static uint32_t sbgInterfaceSerialGetSpeed(const SbgInterface *pInterface) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + HANDLE pSerialDevice; + DCB comState; + char errorMsg[256]; + + assert(pInterface); + assert(pInterface->type == SBG_IF_TYPE_SERIAL); + + pSerialDevice = sbgInterfaceFileGetDesc((SbgInterface*)pInterface); + + if (GetCommState(pSerialDevice, &comState)) + { + return comState.BaudRate; + } + else + { + errorCode = SBG_ERROR; + sbgGetWindowsErrorMsg(errorMsg, sizeof(errorMsg)); + SBG_LOG_ERROR(errorCode, "Unable to retreive com state: %s", errorMsg); + } + + return errorCode; +} + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +SBG_COMMON_LIB_API SbgErrorCode sbgInterfaceSerialCreate(SbgInterface *pInterface, const char *deviceName, uint32_t baudRate) +{ + char errorMsg[256]; + char comPortPath[32]; + COMMTIMEOUTS comTimeOut; + DCB comState; + uint32_t deviceNum; + HANDLE hSerialDevice; + + assert(pInterface); + assert(deviceName); + + // + // Always call the underlying zero init method to make sure we can correctly handle SbgInterface evolutions + // + sbgInterfaceZeroInit(pInterface); + + // + // Extract device number + // + if (sscanf_s(deviceName, "COM%i", &deviceNum) == 1) + { + // + // Build the com port path + // + sprintf_s(comPortPath, 32, "\\\\.\\COM%i", deviceNum); + + // + // Init the com port + // + hSerialDevice = CreateFileA(comPortPath, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + + // + // Test that the port has been initialized + // + if (hSerialDevice != INVALID_HANDLE_VALUE) + { + // + // Purge the com port + // + if (PurgeComm(hSerialDevice, PURGE_TXABORT | PURGE_RXABORT | PURGE_TXCLEAR | PURGE_RXCLEAR)) + { + // + // Retreives current com state and com timeout + // + if ( (GetCommState(hSerialDevice, &comState)) && (GetCommTimeouts(hSerialDevice, &comTimeOut)) ) + { + // + // Define common attributes + // + comState.BaudRate= baudRate; + comState.Parity= NOPARITY; + comState.ByteSize= 8; + comState.StopBits= ONESTOPBIT; + + // + // Disable flow control + // + comState.fDsrSensitivity = false; + comState.fOutxCtsFlow = false; + comState.fOutxDsrFlow = false; + comState.fOutX = false; + comState.fInX = false; + + // + // Define timeout attributes (0 ms read timeout) + // + comTimeOut.ReadIntervalTimeout = MAXDWORD; + comTimeOut.ReadTotalTimeoutMultiplier = 0; + comTimeOut.ReadTotalTimeoutConstant = 0; + + comTimeOut.WriteTotalTimeoutConstant = 0; + comTimeOut.WriteTotalTimeoutMultiplier = 0; + + // + // Configure the com port + // + if ( (SetCommState(hSerialDevice, &comState)) && (SetCommTimeouts(hSerialDevice, &comTimeOut)) ) + { + // + // Define the COM port buffer size + // + if (SetupComm(hSerialDevice, SBG_IF_SERIAL_RX_BUFFER_SIZE, SBG_IF_SERIAL_TX_BUFFER_SIZE)) + { + // + // Define base interface members + // + pInterface->handle = hSerialDevice; + pInterface->type = SBG_IF_TYPE_SERIAL; + + // + // Define the interface name + // + sbgInterfaceNameSet(pInterface, deviceName); + + // + // Define all overloaded members + // + pInterface->pDestroyFunc = sbgInterfaceSerialDestroy; + pInterface->pReadFunc = sbgInterfaceSerialRead; + pInterface->pWriteFunc = sbgInterfaceSerialWrite; + pInterface->pFlushFunc = sbgInterfaceSerialFlush; + pInterface->pSetSpeedFunc = sbgInterfaceSerialSetSpeed; + pInterface->pGetSpeedFunc = sbgInterfaceSerialGetSpeed; + + // + // Purge the communication + // + return sbgInterfaceSerialFlush(pInterface, SBG_IF_FLUSH_ALL); + } + else + { + sbgGetWindowsErrorMsg(errorMsg, sizeof(errorMsg)); + SBG_LOG_ERROR(SBG_ERROR, "Unable to define buffer size: %s", errorMsg); + } + } + else + { + sbgGetWindowsErrorMsg(errorMsg, sizeof(errorMsg)); + SBG_LOG_ERROR(SBG_ERROR, "Unable to set com state and/or timeout: %s", errorMsg); + } + } + else + { + sbgGetWindowsErrorMsg(errorMsg, sizeof(errorMsg)); + SBG_LOG_ERROR(SBG_ERROR, "Unable to retreive com state and/or timeout: %s", errorMsg); + } + } + else + { + sbgGetWindowsErrorMsg(errorMsg, sizeof(errorMsg)); + SBG_LOG_ERROR(SBG_ERROR, "Unable to purge com port %i: %s", deviceNum, errorMsg); + } + + // + // Close the port com + // An error occurred while setting up the serial port, close it. + // + CloseHandle(hSerialDevice); + } + + return SBG_ERROR; + } + else + { + // + // Invalid device name + // + return SBG_INVALID_PARAMETER; + } +} diff --git a/common/interfaces/sbgInterfaceUdp.c b/common/interfaces/sbgInterfaceUdp.c new file mode 100644 index 0000000..6f24653 --- /dev/null +++ b/common/interfaces/sbgInterfaceUdp.c @@ -0,0 +1,457 @@ +// sbgCommonLib headers +#include +#include +#include + +// Standard headers +#ifdef WIN32 +#include +#include +#include + +#define SOCKLEN int +#else // WIN32 +#include +#include +#include +#include +#include +#include +#include + +#define SOCKADDR_IN struct sockaddr_in +#define SOCKADDR struct sockaddr +#define SOCKET int +#define SOCKLEN socklen_t +#define INVALID_SOCKET (~((SOCKET)0)) +#define SOCKET_ERROR (-1) +#define NO_ERROR (0) +#define SD_BOTH (2) + +#define closesocket close +#endif // WIN32 + +//----------------------------------------------------------------------// +//- Private definitions -// +//----------------------------------------------------------------------// + +#define SBG_INTERFACE_UDP_PACKET_MAX_SIZE (1400) + +/*! + * Structure that stores all internal data used by the UDP interface. + */ +typedef struct _SbgInterfaceUdp +{ + SOCKET udpSocket; /*!< The socket used to send and / or receive some UDP data. */ + sbgIpAddress remoteAddr; /*!< IP address to send data to. */ + uint32_t remotePort; /*!< Ethernet port to send data to. */ + uint32_t localPort; /*!< Ethernet port on which the interface is listening. */ +} SbgInterfaceUdp; + +//----------------------------------------------------------------------// +//- Private functions -// +//----------------------------------------------------------------------// + +/*! + * Returns the UDP interface instance. + * + * \param[in] pInterface Interface instance. + * \return The UDP interface instance. + */ +static SbgInterfaceUdp *sbgInterfaceUdpGet(SbgInterface *pInterface) +{ + assert(pInterface); + assert(pInterface->type == SBG_IF_TYPE_ETH_UDP); + assert(pInterface->handle); + + return (SbgInterfaceUdp*)pInterface->handle; +} + +/*! + * Initialize the socket API. + * + * \return SBG_NO_ERROR if the socket API has been correctly initialized. + */ +static SbgErrorCode sbgInterfaceUdpInitSockets(void) +{ +#ifdef WIN32 + WSADATA wsaData; + + if (WSAStartup(MAKEWORD(2, 2), &wsaData) == NO_ERROR) + { + return SBG_NO_ERROR; + } + else + { + return SBG_ERROR; + } +#else + return SBG_NO_ERROR; +#endif +} + +/*! + * Uninitialize the socket API. + * + * \return SBG_NO_ERROR if the socket API has been uninitialized. + */ +static SbgErrorCode sbgInterfaceUpdateCloseSockets(void) +{ +#ifdef WIN32 + if (WSACleanup() == NO_ERROR) + { + return SBG_NO_ERROR; + } + else + { + return SBG_ERROR; + } +#else + return SBG_NO_ERROR; +#endif +} + +/*! + * Define if a socket should block or not on receive and send calls. + * + * \param[in] pInterfaceUdp The UDP interface to change socket mode. + * \param[in] blocking Set to true for a blocking socket or false for a non blocking socket. + * \return SBG_NO_ERROR if the blocking status has been changed. + */ +static SbgErrorCode sbgInterfaceUdpSetSocketBlocking(SbgInterfaceUdp *pInterfaceUdp, bool blocking) +{ + assert(pInterfaceUdp); + +#ifdef WIN32 + u_long blockingMode; + + blockingMode = (blocking ? 0 : 1); + + if (ioctlsocket(pInterfaceUdp->udpSocket, FIONBIO, &blockingMode) == NO_ERROR) + { + return SBG_NO_ERROR; + } + else + { + return SBG_ERROR; + } +#else // WIN32 + int32_t flags; + + flags = fcntl(pInterfaceUdp->udpSocket, F_GETFL, 0); + + if (flags >= 0) + { + flags = (blocking ? (flags & ~O_NONBLOCK) : (flags | O_NONBLOCK)); + + if (fcntl(pInterfaceUdp->udpSocket, F_SETFL, flags) == 0) + { + return SBG_NO_ERROR; + } + } + + return SBG_ERROR; +#endif // WIN32 +} + +/*! + * Destroy an interface initialized using sbgInterfaceUdpCreate. + * + * \param[in] pInterface Pointer on a valid UDP interface created using sbgInterfaceUdpCreate. + * \return SBG_NO_ERROR if the interface has been closed and released. + */ +static SbgErrorCode sbgInterfaceUdpDestroy(SbgInterface *pInterface) +{ + SbgInterfaceUdp *pUdpHandle; + + assert(pInterface); + assert(pInterface->type == SBG_IF_TYPE_ETH_UDP); + + pUdpHandle = sbgInterfaceUdpGet(pInterface); + + // + // Close the socket + // + shutdown(pUdpHandle->udpSocket, SD_BOTH); + closesocket(pUdpHandle->udpSocket); + + // + // free the allocated sbgInterfaceUdp instance + // + free(pUdpHandle); + + sbgInterfaceZeroInit(pInterface); + + return sbgInterfaceUpdateCloseSockets(); +} + +/*! + * Try to write some data to an interface. + * + * \param[in] pHandle Valid handle on an initialized interface. + * \param[in] pBuffer Pointer on an allocated buffer that contains the data to write + * \param[in] bytesToWrite Number of bytes we would like to write. + * \return SBG_NO_ERROR if all bytes have been written successfully. + */ +static SbgErrorCode sbgInterfaceUdpWrite(SbgInterface *pInterface, const void *pBuffer, size_t bytesToWrite) +{ + SbgErrorCode errorCode; + SbgInterfaceUdp *pUdpHandle; + SOCKADDR_IN outAddr; + + assert(pInterface); + assert(pInterface->type == SBG_IF_TYPE_ETH_UDP); + assert(pBuffer); + + pUdpHandle = sbgInterfaceUdpGet(pInterface); + + outAddr.sin_family = AF_INET; + outAddr.sin_addr.s_addr = pUdpHandle->remoteAddr; + outAddr.sin_port = htons((uint16_t)pUdpHandle->remotePort); + + while (bytesToWrite != 0) + { + int partialWriteSize; + int nrBytesSent; + + partialWriteSize = (int)bytesToWrite; + + if (partialWriteSize > SBG_INTERFACE_UDP_PACKET_MAX_SIZE) + { + partialWriteSize = SBG_INTERFACE_UDP_PACKET_MAX_SIZE; + } + + nrBytesSent = sendto(pUdpHandle->udpSocket, pBuffer, partialWriteSize, 0, (SOCKADDR *)&outAddr, sizeof(outAddr)); + + if (nrBytesSent != partialWriteSize) + { + break; + } + + bytesToWrite -= (size_t)partialWriteSize; + pBuffer = (const uint8_t *)pBuffer + partialWriteSize; + } + + if (bytesToWrite == 0) + { + errorCode = SBG_NO_ERROR; + } + else + { + errorCode = SBG_WRITE_ERROR; + } + + return errorCode; +} + +/*! + * Try to read some data from an interface. + * + * \param[in] pHandle Valid handle on an initialized interface. + * \param[in] pBuffer Pointer on an allocated buffer that can hold at least bytesToRead bytes of data. + * \param[out] pReadBytes Pointer on an uint32_t used to return the number of read bytes. + * \param[in] bytesToRead Number of bytes we would like to read. + * \return SBG_NO_ERROR if no error occurs, please check the number of received bytes. + */ +static SbgErrorCode sbgInterfaceUdpRead(SbgInterface *pInterface, void *pBuffer, size_t *pReadBytes, size_t bytesToRead) +{ + SbgErrorCode errorCode; + SbgInterfaceUdp *pUdpHandle; + SOCKADDR_IN remoteAddr; + SOCKLEN remoteAddrLen; + int ret; + + assert(pInterface); + assert(pInterface->type == SBG_IF_TYPE_ETH_UDP); + assert(pBuffer); + assert(pReadBytes); + + pUdpHandle = sbgInterfaceUdpGet(pInterface); + + remoteAddrLen = sizeof(remoteAddr); + ret = recvfrom(pUdpHandle->udpSocket, pBuffer, (int)bytesToRead, 0, (SOCKADDR *)&remoteAddr, &remoteAddrLen); + + if (ret != -1) + { + if ((pUdpHandle->remoteAddr == 0) && + (pUdpHandle->remotePort == 0)) + { + pUdpHandle->remoteAddr = remoteAddr.sin_addr.s_addr; + pUdpHandle->remotePort = ntohs(remoteAddr.sin_port); + } + else if ((pUdpHandle->remoteAddr != remoteAddr.sin_addr.s_addr) || + (pUdpHandle->remotePort != ntohs(remoteAddr.sin_port))) + { + char remoteAddrString[16]; + + sbgNetworkIpToString(remoteAddr.sin_addr.s_addr, remoteAddrString, sizeof(remoteAddrString)); + SBG_LOG_WARNING(SBG_READ_ERROR, "received data from invalid remote host (%s:%u)", remoteAddrString, ntohs(remoteAddr.sin_port)); + ret = 0; + } + + errorCode = SBG_NO_ERROR; + } +#ifdef WIN32 + else if (WSAGetLastError() == WSAEWOULDBLOCK) +#else // WIN32 + else if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) +#endif // WIN32 + { + errorCode = SBG_NO_ERROR; + ret = 0; + } + else + { + errorCode = SBG_READ_ERROR; + SBG_LOG_ERROR(errorCode, "unable to receive data"); + } + + if (errorCode == SBG_NO_ERROR) + { + *pReadBytes = (size_t)ret; + } + + return errorCode; +} + + +//----------------------------------------------------------------------// +//- Public functions -// +//----------------------------------------------------------------------// + +SBG_COMMON_LIB_API SbgErrorCode sbgInterfaceUdpCreate(SbgInterface *pInterface, sbgIpAddress remoteAddr, uint32_t remotePort, uint32_t localPort) +{ + SbgErrorCode errorCode; + + assert(pInterface); + + // + // Always call the underlying zero init method to make sure we can correctly handle SbgInterface evolutions + // + sbgInterfaceZeroInit(pInterface); + + errorCode = sbgInterfaceUdpInitSockets(); + + if (errorCode == SBG_NO_ERROR) + { + SbgInterfaceUdp *pNewUdpHandle; + + pNewUdpHandle = malloc(sizeof(*pNewUdpHandle)); + + if (pNewUdpHandle) + { + pNewUdpHandle->remoteAddr = remoteAddr; + pNewUdpHandle->remotePort = remotePort; + pNewUdpHandle->localPort = localPort; + + pNewUdpHandle->udpSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); + + if (pNewUdpHandle->udpSocket != INVALID_SOCKET) + { + errorCode = sbgInterfaceUdpSetSocketBlocking(pNewUdpHandle, false); + + if (errorCode == SBG_NO_ERROR) + { + SOCKADDR_IN bindAddress; + int socketError; + + bindAddress.sin_family = AF_INET; + bindAddress.sin_addr.s_addr = INADDR_ANY; + bindAddress.sin_port = htons((uint16_t)localPort); + + socketError = bind(pNewUdpHandle->udpSocket, (SOCKADDR *)&bindAddress, sizeof(bindAddress)); + + if (socketError != SOCKET_ERROR) + { + char interfaceName[48]; + char ipStr[16]; + + // + // The serial port is ready so create a new serial interface + // + pInterface->handle = pNewUdpHandle; + pInterface->type = SBG_IF_TYPE_ETH_UDP; + + // + // Define the interface name + // + sbgNetworkIpToString(remoteAddr, ipStr, sizeof(ipStr)); + sprintf(interfaceName, "UDP: %s out: %u in: %u", ipStr, remotePort, localPort); + sbgInterfaceNameSet(pInterface, interfaceName); + + // + // Define all overloaded members + // + pInterface->pDestroyFunc = sbgInterfaceUdpDestroy; + pInterface->pReadFunc = sbgInterfaceUdpRead; + pInterface->pWriteFunc = sbgInterfaceUdpWrite; + + return SBG_NO_ERROR; + } + else + { + errorCode = SBG_ERROR; + SBG_LOG_ERROR(errorCode, "unable to bind socket"); + } + } + else + { + errorCode = SBG_ERROR; + SBG_LOG_ERROR(errorCode, "unable to set non-blocking mode"); + } + + shutdown(pNewUdpHandle->udpSocket, SD_BOTH); + closesocket(pNewUdpHandle->udpSocket); + } + else + { + errorCode = SBG_ERROR; + SBG_LOG_ERROR(errorCode, "unable to create socket"); + } + + SBG_FREE(pNewUdpHandle); + } + else + { + errorCode = SBG_MALLOC_FAILED; + SBG_LOG_ERROR(errorCode, "unable to allocate handle"); + } + + sbgInterfaceUpdateCloseSockets(); + } + + return errorCode; +} + + + +SBG_COMMON_LIB_API SbgErrorCode sbgInterfaceUdpAllowBroadcast(SbgInterface *pInterface, bool allowBroadcast) +{ + SbgErrorCode errorCode; + SbgInterfaceUdp *pUdpHandle; + int socketError; + int optValue; + + assert(pInterface); + assert(pInterface->type == SBG_IF_TYPE_ETH_UDP); + + pUdpHandle = sbgInterfaceUdpGet(pInterface); + + // + // Change socket options to allow broadcast + // + optValue = allowBroadcast; + socketError = setsockopt(pUdpHandle->udpSocket, SOL_SOCKET, SO_BROADCAST, (const char *)&optValue, sizeof(optValue)); + + if (socketError == NO_ERROR) + { + errorCode = SBG_NO_ERROR; + } + else + { + errorCode = SBG_ERROR; + SBG_LOG_ERROR(errorCode, "unable to set socket options"); + } + + return errorCode; +} diff --git a/common/interfaces/sbgInterfaceUdp.h b/common/interfaces/sbgInterfaceUdp.h new file mode 100644 index 0000000..3035bf6 --- /dev/null +++ b/common/interfaces/sbgInterfaceUdp.h @@ -0,0 +1,74 @@ +/*! + * \file sbgInterfaceUdp.h + * \author SBG Systems + * \date 05 February 2013 + * + * \brief This file implements an UDP interface. + * + * \section CodeCopyright Copyright Notice + * The MIT license + * + * Copyright (C) 2007-2020, SBG Systems SAS. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef SBG_INTERFACE_UDP_H +#define SBG_INTERFACE_UDP_H + +#ifdef __cplusplus +extern "C" { +#endif + +// sbgCommonLib headers +#include +#include + +//----------------------------------------------------------------------// +//- Public functions -// +//----------------------------------------------------------------------// + +/*! + * Initialize an unconnected UDP interface for read and write operations. + * + * If the remote address and port are zero, the interface waits for the first packet received on the + * local port and uses the source of that packet as its remote host. This provides a convenient way + * to create "server" UDP interfaces. + * + * \param[in] pInterface Pointer on an allocated interface instance to initialize. + * \param[in] remoteAddr IP address to send data to. + * \param[in] remotePort Ethernet port to send data to. + * \param[in] localPort Ehternet port on which the interface is listening. + * \return SBG_NO_ERROR if the interface has been created. + */ +SBG_COMMON_LIB_API SbgErrorCode sbgInterfaceUdpCreate(SbgInterface *pInterface, sbgIpAddress remoteAddr, uint32_t remotePort, uint32_t localPort); + +/*! + * Define if a socket can send broadcasted packets. + * + * \param[in] pInterface Pointer on a valid UDP interface created using sbgInterfaceUdpCreate. + * \param[in] allowBroadcast Set to true to allow this socket to send broadcasted UDP packets. + * \return SBG_NO_ERROR if the allow broadcast status has been changed. + */ +SBG_COMMON_LIB_API SbgErrorCode sbgInterfaceUdpAllowBroadcast(SbgInterface *pInterface, bool allowBroadcast); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_INTERFACE_UDP_H diff --git a/common/network/sbgNetwork.c b/common/network/sbgNetwork.c new file mode 100644 index 0000000..6f2cd59 --- /dev/null +++ b/common/network/sbgNetwork.c @@ -0,0 +1,125 @@ +// sbgCommonLib headers +#include +#include + +// Local headers +#include "sbgNetwork.h" + +//----------------------------------------------------------------------// +//- IP manipulation methods -// +//----------------------------------------------------------------------// + +/*! + * Convert an ip to a string of the form A.B.C.D + * \param[in] ipAddr IP address to convert to a string. + * \param[out] pBuffer Pointer on an allocated buffer than can hold ip address as a string. + * \param[in] maxSize Maximum number of chars that can be stored in pBuffer including the NULL char. + */ +SBG_COMMON_LIB_API void sbgNetworkIpToString(sbgIpAddress ipAddr, char *pBuffer, size_t maxSize) +{ + // + // Check input arguments + // + assert(pBuffer); + assert(maxSize >= 16); + + SBG_UNUSED_PARAMETER(maxSize); + + // + // Write the IP address + // + snprintf(pBuffer, maxSize, "%" PRIu8 ".%" PRIu8 ".%" PRIu8 ".%" PRIu8, sbgIpAddrGetA(ipAddr), sbgIpAddrGetB(ipAddr), sbgIpAddrGetC(ipAddr), sbgIpAddrGetD(ipAddr)); +} + +/*! + * Convert an ip address stored in a string of the form A.B.C.D to an sbgIpAddress object. + * \param[in] pBuffer IP address as a string of the form A.B.C.D + * \return IP address parsed from the string or 0.0.0.0 if the IP is invalid. + */ +SBG_COMMON_LIB_API sbgIpAddress sbgNetworkIpFromString(const char *pBuffer) +{ + int ipAddrA; + int ipAddrB; + int ipAddrC; + int ipAddrD; + int numReadParams; + sbgIpAddress ip; + sbgIpAddress ret; + char checkBuffer[SBG_NETWORK_IPV4_STRING_SIZE]; + + assert(pBuffer); + + ret = SBG_IPV4_UNSPECIFIED_ADDR; + + numReadParams = sscanf(pBuffer, "%d.%d.%d.%d", &ipAddrA, &ipAddrB, &ipAddrC, &ipAddrD); + + if ((numReadParams == 4) && (ipAddrA >= 0) && (ipAddrA <= 255) && (ipAddrB >= 0) && (ipAddrB <= 255) && (ipAddrC >= 0) && (ipAddrC <= 255) && (ipAddrD >= 0) && (ipAddrD <= 255)) + { + ip = sbgIpAddr((uint8_t)ipAddrA, (uint8_t)ipAddrB, (uint8_t)ipAddrC, (uint8_t)ipAddrD); + + sbgNetworkIpToString(ip, checkBuffer, SBG_ARRAY_SIZE(checkBuffer)); + + if (strcmp(pBuffer, checkBuffer) == 0) + { + ret = ip; + } + } + + return ret; +} + +//----------------------------------------------------------------------// +//- IP validation methods -// +//----------------------------------------------------------------------// + +/*! +* Check if an IpV4 netmask is valid, the mask should be contiguous (1111 followed by 0) +* \param[in] netmask The netmask stored in an uint32_t (host endianness). +* \return true if the netmask is valid ie contiguous. +*/ +SBG_COMMON_LIB_API bool sbgIpNetMaskValid(sbgIpAddress netmask) +{ + uint32_t y; + uint32_t z; + + // + // First test that the netmask is not zero, if yes, it's valid + // + if (netmask != 0) + { + // + // We are doing arithmetic so we have to make sure the netmask is using the platform endianness + // The IP address is always stored in big endian so we have to swap it for little endian platforms + // +#if SBG_CONFIG_BIG_ENDIAN == 0 + netmask = sbgSwap32(netmask); +#endif + + // + // Compute the bitwise inverse + // + y = ~netmask; + + // + // Add one to the inverse so if netmask was a proper one, there will be at most 1 bit set in this. + // + z = y + 1; + + // + // Test that, simply and z with z - 1, which happens to be y. The result will be zero if all is OK, non zero otherwise. + // + if ((z&y) == 0) + { + // + // We have a valid netmask + // + return true; + } + else + { + return false; + } + } + + return true; +} diff --git a/common/network/sbgNetwork.h b/common/network/sbgNetwork.h new file mode 100644 index 0000000..aea2264 --- /dev/null +++ b/common/network/sbgNetwork.h @@ -0,0 +1,290 @@ +/*! + * \file sbgNetwork.h + * \author SBG Systems (Raphael Siryani) + * \date 15 September 2015 + * + * \brief Useful methods for Network handling such as ip addresses. + * + * IP v4 address is stored in memory with a uint32_t. + * Each address component A.B.C.D is stored in 8 bits using the network + * endianess ie Big Endian. + * + * We thus have the following memory organisation: + * + * In Little Endian: + * |LSB| | |MSB| + * | A | B | C | D | + * + * In Big Endian: + * |MSB| | |LSB| + * | A | B | C | D | + * + * \section CodeCopyright Copyright Notice + * The MIT license + * + * Copyright (C) 2007-2020, SBG Systems SAS. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef SBG_NETWORK_H +#define SBG_NETWORK_H + +//----------------------------------------------------------------------// +//- Header (open extern C block) -// +//----------------------------------------------------------------------// +#ifdef __cplusplus +extern "C" { +#endif + +// sbgCommonLib headers +#include + +//----------------------------------------------------------------------// +//- Common IPv4 definitions -// +//----------------------------------------------------------------------// +#define SBG_IPV4_UNSPECIFIED_ADDR sbgIpAddr(0, 0, 0, 0) /*!< This represents an undefined IP address. */ +#define SBG_IPV4_BROADCAST_ADDR sbgIpAddr(255, 255, 255, 255) /*!< Broadcast IP address used to address all devices within the same network. */ + +#define SBG_NETWORK_IPV4_STRING_SIZE (16) /*!< String size for representation of an IPV4 */ + +//----------------------------------------------------------------------// +//- IP setters / getters -// +//----------------------------------------------------------------------// + +/*! + * Build an IP V4 address in the form a.b.c.d + * \param[in] a First 8 bits IP address. + * \param[in] b Second 8 bits IP address. + * \param[in] c Third 8 bits IP address. + * \param[in] d Last 8 bits IP address. + * \return An initialized IP address object. + */ +SBG_INLINE sbgIpAddress sbgIpAddr(uint8_t a, uint8_t b, uint8_t c, uint8_t d) +{ +#if SBG_CONFIG_BIG_ENDIAN == 1 + return (a << 24) | (b << 16) | (c << 8) | d; +#else + return a | (b << 8) | (c << 16) | (d << 24); +#endif +} + +/*! + * Return the first A field of of an IP v4 address of the form A.B.C.D + * \param[in] ipAddr An sbgIpAddress to convert. + * \return The A field of the IP address. + */ +SBG_INLINE uint8_t sbgIpAddrGetA(sbgIpAddress ipAddr) +{ +#if SBG_CONFIG_BIG_ENDIAN == 1 + return (uint8_t)((ipAddr & 0xFF000000) >> 24); +#else + return (uint8_t)((ipAddr & 0x000000FF)); +#endif +} + +/*! +* Return the first B field of of an IP v4 address of the form A.B.C.D +* \param[in] ipAddr An sbgIpAddress to convert. +* \return The B field of the IP address. +*/ +SBG_INLINE uint8_t sbgIpAddrGetB(sbgIpAddress ipAddr) +{ +#if SBG_CONFIG_BIG_ENDIAN == 1 + return (uint8_t)((ipAddr & 0x00FF0000) >> 16); +#else + return (uint8_t)((ipAddr & 0x0000FF00) >> 8); +#endif +} + +/*! +* Return the first C field of of an IP v4 address of the form A.B.C.D +* \param[in] ipAddr An sbgIpAddress to convert. +* \return The C field of the IP address. +*/ +SBG_INLINE uint8_t sbgIpAddrGetC(sbgIpAddress ipAddr) +{ +#if SBG_CONFIG_BIG_ENDIAN == 1 + return (uint8_t)((ipAddr & 0x0000FF00) >> 8); +#else + return (uint8_t)((ipAddr & 0x00FF0000) >> 16); +#endif +} + +/*! +* Return the first D field of of an IP v4 address of the form A.B.C.D +* \param[in] ipAddr An sbgIpAddress to convert. +* \return The D field of the IP address. +*/ +SBG_INLINE uint8_t sbgIpAddrGetD(sbgIpAddress ipAddr) +{ +#if SBG_CONFIG_BIG_ENDIAN == 1 + return (uint8_t)((ipAddr & 0x000000FF)); +#else + return (uint8_t)((ipAddr & 0xFF000000) >> 24); +#endif +} + +//----------------------------------------------------------------------// +//- IP manipulation methods -// +//----------------------------------------------------------------------// + +/*! + * Convert an ip to a string of the form A.B.C.D + * \param[in] ipAddr IP address to convert to a string. + * \param[out] pBuffer Pointer on an allocated buffer than can hold ip address as a string. + * \param[in] maxSize Maximum number of chars that can be stored in pBuffer including the NULL char. + */ +SBG_COMMON_LIB_API void sbgNetworkIpToString(sbgIpAddress ipAddr, char *pBuffer, size_t maxSize); + +/*! + * Convert an ip address stored in a string of the form A.B.C.D to an sbgIpAddress object. + * \param[in] pBuffer IP address as a string of the form A.B.C.D + * \return IP address parsed from the string or 0.0.0.0 if the IP is invalid. + */ +SBG_COMMON_LIB_API sbgIpAddress sbgNetworkIpFromString(const char *pBuffer); + +//----------------------------------------------------------------------// +//- IP operations -// +//----------------------------------------------------------------------// + +/*! + * Given an ip address and the netmask, returns the network part (ip & subnetMask) + * \param[in] ipAddress The ip address stored in an uint32_t (host endianness). + * \param[in] netmask The netmask stored in an uint32_t (host endianness). + * \return The network part of the ip address. + */ +SBG_INLINE sbgIpAddress sbgIpGetNetworkAddr(sbgIpAddress ipAddress, sbgIpAddress netmask) +{ + return (ipAddress & netmask); +} + +/*! + * Given an ip address and the netmask, returns the host part (ip & ~subnetMask) + * \param[in] ipAddress The ip address stored in an uint32_t (host endianness). + * \param[in] netmask The netmask stored in an uint32_t (host endianness). + * \return The host part of the ip address. + */ +SBG_INLINE sbgIpAddress sbgIpGetHostAddr(sbgIpAddress ipAddress, sbgIpAddress netmask) +{ + return (ipAddress & ~netmask); +} + +//----------------------------------------------------------------------// +//- IP validation methods -// +//----------------------------------------------------------------------// + +/*! + * Returns true if the provided IP address is unspecified ie (0.0.0.0) + * \param[in] ipAddress The ip address to test + * \return true if the ip address is unspecified or false otherwise. + */ +SBG_INLINE bool sbgIpAddressIsUnspecified(sbgIpAddress ipAddress) +{ + if (ipAddress == 0) + { + return true; + } + else + { + return false; + } +} + +/*! + * Check if an IpV4 address is valid. The ip address format is A.B.C.D and A should respect 0 < A < 224 + * \param[in] ipAddress The ip address stored in an uint32_t (host endianness). + * \return true if the ip address is valid ie contiguous. + */ +SBG_INLINE bool sbgIpAddressValid(sbgIpAddress ipAddress) +{ + // + // Check the if A part of the ip address is within 1 and 223 + // + if ((sbgIpAddrGetA(ipAddress) > 0) && (sbgIpAddrGetA(ipAddress) < 224)) + { + // + // The ip address is valid + // + return true; + } + else + { + // + // The ip address is not valid + // + return false; + } +} + +/*! + * Given an ip address and the netmask, returns true if this ip address is within the subnet. + * \param[in] ipAddress The ip address stored in an uint32_t (host endianness). + * \param[in] netmask The netmask stored in an uint32_t (host endianness). + * \return true if this ip address is within the subnet or false otherwise. + */ +SBG_INLINE sbgIpAddress sbgIpAddrWithinSubnet(sbgIpAddress ipAddress, sbgIpAddress netmask) +{ + // + // Just check if the host part is equals to zero + // + if (sbgIpGetHostAddr(ipAddress, netmask) == 0) + { + return false; + } + else + { + return true; + } +} + +/*! + * Check if two ip addresses are in the same network given the subnet. + * \param[in] firstIpAddr The first IP address to check. + * \param[in] secondIpAddr The second IP address to check. + * \param[in] netmask The netmask of the network. + * \return true if the two ip addresses are in the same network. + */ +SBG_INLINE bool sbgIpAddrIsSameNetwork(sbgIpAddress firstIpAddr, sbgIpAddress secondIpAddr, sbgIpAddress netmask) +{ + if ((firstIpAddr & netmask) == (secondIpAddr & netmask)) + { + return true; + } + else + { + return false; + } +} + +/*! + * Check if an IpV4 netmask is valid, the mask should be contiguous (1111 followed by 0) + * \param[in] netmask The netmask stored in an uint32_t (host endianness). + * \return true if the netmask is valid ie contiguous. + */ +SBG_COMMON_LIB_API bool sbgIpNetMaskValid(sbgIpAddress netmask); + +//----------------------------------------------------------------------// +//- Footer (close extern C block) -// +//----------------------------------------------------------------------// +#ifdef __cplusplus +} +#endif + +#endif /* SBG_NETWORK_H */ diff --git a/common/platform/sbgPlatform.c b/common/platform/sbgPlatform.c new file mode 100644 index 0000000..8ef4876 --- /dev/null +++ b/common/platform/sbgPlatform.c @@ -0,0 +1,146 @@ +// Standard headers +#include +#include + +// sbgCommonLib headers +#include + +//----------------------------------------------------------------------// +//- Include specific header for WIN32 and UNIX platforms -// +//----------------------------------------------------------------------// +#ifdef WIN32 + #include +#elif defined(__APPLE__) + #include +#else + #include +#endif + +//----------------------------------------------------------------------// +//- Specific timing methods to reimplement for your platform -// +//----------------------------------------------------------------------// + +/*! + * Returns the current time in ms. + * \return The current time in ms. + */ +SBG_COMMON_LIB_API uint32_t sbgGetTime(void) +{ +#ifdef WIN32 + // + // Return the current time in ms + // + return clock() / (CLOCKS_PER_SEC / 1000); +#elif defined(__APPLE__) + mach_timebase_info_data_t timeInfo; + mach_timebase_info(&timeInfo); + + // + // Return the current time in ms + // + return (mach_absolute_time() * timeInfo.numer / timeInfo.denom) / 1000000.0; +#else + struct timespec now; + clock_gettime(CLOCK_REALTIME, &now); + + // + // Return the current time in ms + // + return now.tv_sec * 1000 + now.tv_nsec / 1000000; +#endif +} + +/*! + * Sleep for the specified number of ms. + * \param[in] ms Number of millisecondes to wait. + */ +SBG_COMMON_LIB_API void sbgSleep(uint32_t ms) +{ +#ifdef WIN32 + Sleep(ms); +#else + struct timespec req; + struct timespec rem; + int ret; + + req.tv_sec = ms / 1000; + req.tv_nsec = (ms % 1000) * 1000000L; + + for (;;) + { + ret = nanosleep(&req, &rem); + + if ((ret == 0) || (errno != EINTR)) + { + break; + } + else + { + req = rem; + } + } +#endif +} + +//----------------------------------------------------------------------// +//- Specific logging methods to reimplement for your platform -// +//----------------------------------------------------------------------// + +/*! + * The method is called when one of the SBG_LOG_ERROR, SBG_LOG_WARNING, SBG_LOG_INFO or SBG_LOG_VERBOSE is called. + * It logs an error message with debug information and support a variable list of arguments + * \param[in] pFileName File name where the error occurred. + * \param[in] pFunctionName Function name where the error occurred. + * \param[in] line Line number where the error occurred. + * \param[in] logType Define if we have an error, a warning, an info or a verbose log. + * \param[in] errorCode The error code associated with the message. + * \param[in] pFormat The error message that will be used with the variable list of arguments. + */ +SBG_COMMON_LIB_API void sbgPlatformDebugLogMsg(const char *pFileName, const char *pFunctionName, uint32_t line, const char *pCategory, SbgDebugLogType logType, SbgErrorCode errorCode, const char *pFormat, ...) +{ + char errorMsg[SBG_CONFIG_LOG_MAX_SIZE]; + va_list args; + + assert(pFunctionName); + assert(pFormat); + + SBG_UNUSED_PARAMETER(pFileName); + SBG_UNUSED_PARAMETER(pCategory); + + // + // Initialize the list of variable arguments on the latest function argument + // + va_start(args, pFormat); + + // + // Generate the error message string + // + vsprintf(errorMsg, pFormat, args); + + // + // Close the list of variable arguments + // + va_end(args); + + // + // Log the correct message according to the log type + // + switch (logType) + { + case SBG_DEBUG_LOG_TYPE_ERROR: + fprintf(stderr, "*ERR * %s(%"PRIu32"): %s - %s\n\r", pFunctionName, line, sbgErrorCodeToString(errorCode), errorMsg); + break; + case SBG_DEBUG_LOG_TYPE_WARNING: + fprintf(stderr, "*WARN* %s(%"PRIu32"): %s - %s\n\r", pFunctionName, line, sbgErrorCodeToString(errorCode), errorMsg); + break; + case SBG_DEBUG_LOG_TYPE_INFO: + fprintf(stderr, "*INFO* %s(%"PRIu32"): %s\n\r", pFunctionName, line, errorMsg); + break; + case SBG_DEBUG_LOG_TYPE_DEBUG: + fprintf(stderr, "*DBG * %s(%"PRIu32"): %s\n\r", pFunctionName, line, errorMsg); + break; + default: + fprintf(stderr, "*UKNW* %s(%"PRIu32"): %s\n\r", pFunctionName, line, errorMsg); + break; + } +} diff --git a/common/platform/sbgPlatform.h b/common/platform/sbgPlatform.h new file mode 100644 index 0000000..d23f9ed --- /dev/null +++ b/common/platform/sbgPlatform.h @@ -0,0 +1,100 @@ +/*! + * \file sbgPlatform.h + * \author SBG Systems (Raphael Siryani) + * \date 17 March 2015 + * + * \brief Header file that contains all platform specific definitions. + * + * This file should be modified to each targeted platform. + * For example, all common headers should be included from this file. + * + * The platform endianness should be defined here. + * + * \section CodeCopyright Copyright Notice + * The MIT license + * + * Copyright (C) 2007-2020, SBG Systems SAS. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef SBG_PLATFORM_H +#define SBG_PLATFORM_H + +// System headers +#include + +// sbgCommonLib headers +#include +#include +#include + +//----------------------------------------------------------------------// +//- Add here any additional includes you want to share -// +//----------------------------------------------------------------------// + +#ifdef _WIN32 +#include +#elif defined(__unix__) +#include +#endif + +//----------------------------------------------------------------------// +//- Specific timing methods to reimplement for your platform -// +//----------------------------------------------------------------------// + +/*! + * Returns the current time in ms. + * \return The current time in ms. + */ +SBG_COMMON_LIB_API uint32_t sbgGetTime(void); + +/*! + * Sleep for the specified number of ms. + * \param[in] ms Number of millisecondes to wait. + */ +SBG_COMMON_LIB_API void sbgSleep(uint32_t ms); + +//----------------------------------------------------------------------// +//- Specific logging methods to reimplement for your platform -// +//----------------------------------------------------------------------// + +/*! + * The method is called when one of the SBG_LOG_ERROR, SBG_LOG_WARNING, SBG_LOG_INFO or SBG_LOG_VERBOSE is called. + * It logs an error message with debug information and support a variable list of arguments + * \param[in] pFileName File name where the error occurred. + * \param[in] pFunctionName Function name where the error occurred. + * \param[in] line Line number where the error occurred. + * \param[in] pCategory Category for this log or "None" if no category has been specified. + * \param[in] logType Define if we have an error, a warning, an info or a debug log. + * \param[in] errorCode The error code associated with the message. + * \param[in] pFormat The error message that will be used with the variable list of arguments. + */ +SBG_COMMON_LIB_API void sbgPlatformDebugLogMsg(const char *pFileName, const char *pFunctionName, uint32_t line, const char *pCategory, SbgDebugLogType logType, SbgErrorCode errorCode, const char *pFormat, ...) SBG_CHECK_FORMAT(printf, 7, 8); + +//----------------------------------------------------------------------// +//- Errors and warning managment -// +//----------------------------------------------------------------------// + +/*! + * Run time assert that is raised if the expression is false. + * \param[in] expression The boolean expression to test, the execution is interrupted if the expression is evaluated as false. + */ +#define SBG_PLATFORM_ASSERT(expression) assert((expression)) + +#endif /* SBG_PLATFORM_H */ diff --git a/common/sbgCommon.h b/common/sbgCommon.h new file mode 100644 index 0000000..554d55c --- /dev/null +++ b/common/sbgCommon.h @@ -0,0 +1,144 @@ +/*! + * \file sbgCommon.h + * \author SBG Systems (Raphael Siryani) + * \date 17 March 2015 + * + * \brief Main header file for SBG Systems common C library. + * + * All files / projects that would like to use the SBG Systems common C library + * should include this file. + * + * Be aware that this file doesn't include SBG Systems common C library components + * but just defines all types and environments such as error logging. + * + * \section CodeCopyright Copyright Notice + * The MIT license + * + * Copyright (C) 2007-2020, SBG Systems SAS. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef SBG_COMMON_H +#define SBG_COMMON_H + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Include user defined configuration -// +//----------------------------------------------------------------------// +#include "sbgConfig.h" + +//----------------------------------------------------------------------// +//- Platform default configuration -// +//----------------------------------------------------------------------// + +/*! + * If set to 0, the platform support only aligned memory access. + * If set to 1, the platform support unaligned memory access. + * Default: Support only Aligned access - Disabled + */ +#ifndef SBG_CONFIG_UNALIGNED_ACCESS_AUTH + #define SBG_CONFIG_UNALIGNED_ACCESS_AUTH (0) +#endif + +/*! + * If set to 0, the platform is using little endian. + * If set to 1, the platform is using big endian. + * Default: Little Endian - Disabled + */ +#ifndef SBG_CONFIG_BIG_ENDIAN + #define SBG_CONFIG_BIG_ENDIAN (0) +#endif + +//----------------------------------------------------------------------// +//- Logging default configuration -// +//----------------------------------------------------------------------// + +/*! + * If set to 1, error logs level will be thrown. + * Default: Enabled + */ +#ifndef SBG_CONFIG_ENABLE_LOG_ERROR + #define SBG_CONFIG_ENABLE_LOG_ERROR (1) +#endif + +/*! + * If set to 1, warning logs level will be thrown. + * Default: Enabled + */ +#ifndef SBG_CONFIG_ENABLE_LOG_WARNING + #define SBG_CONFIG_ENABLE_LOG_WARNING (1) +#endif + +/*! + * If set to 1, information logs level will be thrown. + * Default: Enabled + */ +#ifndef SBG_CONFIG_ENABLE_LOG_INFO + #define SBG_CONFIG_ENABLE_LOG_INFO (1) +#endif + +/*! + * If set to 1, debug logs level will be thrown. + * Default: Enabled + */ +#ifndef SBG_CONFIG_ENABLE_LOG_DEBUG + #define SBG_CONFIG_ENABLE_LOG_DEBUG (1) +#endif + +/*! + * Maximum error message size in bytes that can be generated including the NULL Char. + * Default: 1024 + */ +#ifndef SBG_CONFIG_LOG_MAX_SIZE + #define SBG_CONFIG_LOG_MAX_SIZE (size_t)(1024) +#endif + +//----------------------------------------------------------------------// +//- File system default configuration -// +//----------------------------------------------------------------------// + +/*! + * Maximum number of chars for a file name including the NULL char. + * Default: 256 + */ +#ifndef SBG_CONFIG_PATH_MAX_SIZE + #define SBG_CONFIG_PATH_MAX_SIZE (size_t)(256) +#endif + +//----------------------------------------------------------------------// +//- Include core headers -// +//----------------------------------------------------------------------// +#include "sbgTypes.h" +#include "sbgErrorCodes.h" +#include "sbgDefines.h" + +#include "debug/sbgDebug.h" +#include "platform/sbgPlatform.h" + +//----------------------------------------------------------------------// +//- Footer (close extern C block) -// +//----------------------------------------------------------------------// +#ifdef __cplusplus +} +#endif + +#endif /* SBG_COMMON_H */ diff --git a/common/sbgCommonLibVersion.h b/common/sbgCommonLibVersion.h new file mode 100644 index 0000000..9616144 --- /dev/null +++ b/common/sbgCommonLibVersion.h @@ -0,0 +1,60 @@ +/*! + * \file sbgCommonLibVersion.h + * \author SBG Systems (Raphael Siryani) + * \date 26/07/2017 + * + * \brief SBG Systems platform support dynamic library. + * + * \section CodeCopyright Copyright Notice + * The MIT license + * + * Copyright (C) 2007-2020, SBG Systems SAS. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef SBG_COMMON_LIB_VERSION_H +#define SBG_COMMON_LIB_VERSION_H + +//----------------------------------------------------------------------// +//- Version definitions -// +//----------------------------------------------------------------------// + +#define SBG_COMMON_LIB_VERSION_MAJOR 1 +#define SBG_COMMON_LIB_VERSION_MINOR 5 +#define SBG_COMMON_LIB_VERSION_BUILD 1238 +#define SBG_COMMON_LIB_VERSION_QUALIFIER SBG_VERSION_QUALIFIER_STABLE + +#define SBG_COMMON_LIB_VERSION SBG_VERSION_SOFTWARE(SBG_COMMON_LIB_VERSION_MAJOR,SBG_COMMON_LIB_VERSION_MINOR,SBG_COMMON_LIB_VERSION_BUILD,SBG_COMMON_LIB_VERSION_QUALIFIER) + +/* + * Specific macros for RC file. + */ +#ifndef SBG_STR +#define SBG_STR(X) #X +#endif + +#ifndef SBG_ASSTR +#define SBG_ASSTR(X) SBG_STR(X) +#endif + +#define SBG_COMMON_LIB_VERSION_W SBG_COMMON_LIB_VERSION_MAJOR,SBG_COMMON_LIB_VERSION_MINOR,SBG_COMMON_LIB_VERSION_BUILD +#define SBG_COMMON_LIB_VERSION_R SBG_ASSTR(SBG_COMMON_LIB_VERSION_MAJOR) "." SBG_ASSTR(SBG_COMMON_LIB_VERSION_MINOR) "." SBG_ASSTR(SBG_COMMON_LIB_VERSION_BUILD) "-stable\0" + +#endif /* SBG_COMMON_LIB_VERSION_H */ diff --git a/common/sbgConfig.h b/common/sbgConfig.h new file mode 100644 index 0000000..433d228 --- /dev/null +++ b/common/sbgConfig.h @@ -0,0 +1,63 @@ +/*! + * \file sbgConfig.h + * \author SBG Systems (Raphael Siryani) + * \date 17 March 2015 + * + * \brief Header file used to configure the framework. + * + * You can configure for example the logging system. + * + * \section CodeCopyright Copyright Notice + * The MIT license + * + * Copyright (C) 2007-2020, SBG Systems SAS. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef __SBG_CONFIG_H__ +#define __SBG_CONFIG_H__ + +//----------------------------------------------------------------------// +//- Platform configuration -// +//----------------------------------------------------------------------// + +/*! + * Windows x86 & x64 support both aligned and unaligned access + */ +#define SBG_CONFIG_UNALIGNED_ACCESS_AUTH (0) + +/*! + * Windows is using little endianess + */ +#define SBG_CONFIG_BIG_ENDIAN (0) + +//----------------------------------------------------------------------// +//- Logging configuration -// +//----------------------------------------------------------------------// + +/*! + * Enable all error logs + * Default: Enabled + */ +#define SBG_CONFIG_ENABLE_LOG_ERROR (1) +#define SBG_CONFIG_ENABLE_LOG_WARNING (1) +#define SBG_CONFIG_ENABLE_LOG_INFO (1) +#define SBG_CONFIG_ENABLE_LOG_DEBUG (1) + +#endif /* __SBG_CONFIG_H__ */ diff --git a/common/sbgDefines.h b/common/sbgDefines.h new file mode 100644 index 0000000..f4b602c --- /dev/null +++ b/common/sbgDefines.h @@ -0,0 +1,518 @@ +/*! + * \file sbgDefines.h + * \author SBG Systems (Raphael Siryani) + * \date 17 March 2015 + * + * \brief Header file that contains all common definitions. + * + * \section CodeCopyright Copyright Notice + * The MIT license + * + * Copyright (C) 2007-2020, SBG Systems SAS. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef SBG_DEFINES_H +#define SBG_DEFINES_H + +// Standard headers +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Local headers +#include "sbgConfig.h" + +// +// XXX If NDEBUG is defined, most libraries define assert() as ((void)0), which may +// cause "defined but not used" warnings. Redefine assert() in a way that safely +// prevents this warning, i.e. without triggering the expression side effects. +// +#ifdef NDEBUG +#undef assert +#define assert(expression) ((void)sizeof(expression)) +#endif // NDEBUG + +/*! + * Macro used to handle export and import methods of the sbgCommon library + */ +#ifdef _MSC_VER + #ifdef SBG_COMMON_STATIC_USE + #define SBG_COMMON_LIB_API + #else + #ifdef SBG_COMMON_LIB_API_EXPORT + #define SBG_COMMON_LIB_API __declspec(dllexport) + #else + #define SBG_COMMON_LIB_API __declspec(dllimport) + #endif + #endif +#else + #define SBG_COMMON_LIB_API +#endif + +//----------------------------------------------------------------------// +//- Global definitions -// +//----------------------------------------------------------------------// +#ifndef SBG_DISABLE + #define SBG_DISABLE (0) +#endif + +#ifndef SBG_ENABLE + #define SBG_ENABLE (1) +#endif + +#ifndef FALSE + #define FALSE (0) +#endif + +#ifndef TRUE + #define TRUE (1) +#endif + +#ifndef NULL + #define NULL (0) +#endif + +#ifndef SBG_INVALID_HANDLE + #define SBG_INVALID_HANDLE (NULL) +#endif + +#ifndef SBG_ARRAY_SIZE + #define SBG_ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) +#endif + +#ifndef SBG_STRLEN + #define SBG_STRLEN(s) (sizeof(s) - 1) +#endif + +#ifndef SBG_QUOTE_NX + #define SBG_QUOTE_NX(x) #x +#endif + +#ifndef SBG_QUOTE + #define SBG_QUOTE(x) SBG_QUOTE_NX(x) +#endif + +#ifndef SBG_CONCAT_NX + #define SBG_CONCAT_NX(a, b) a ## b +#endif + +#ifndef SBG_CONCAT + #define SBG_CONCAT(a, b) SBG_CONCAT_NX(a, b) +#endif + +#ifndef SBG_UNPACK + #define SBG_UNPACK(...) __VA_ARGS__ +#endif + +#ifndef SBG_CONTAINER_OF + #define SBG_CONTAINER_OF(ptr, type, member) ((type *)((char *)(ptr) - offsetof(type, member))) +#endif + +#ifndef SBG_LIKELY + #if defined(__GNUC__) + #define SBG_LIKELY(expr) __builtin_expect((bool)(expr), true) + #else + #define SBG_LIKELY(expr) (expr) + #endif +#endif + +#ifndef SBG_UNLIKELY + #if defined(__GNUC__) + #define SBG_UNLIKELY(expr) __builtin_expect((bool)(expr), false) + #else + #define SBG_UNLIKELY(expr) (expr) + #endif +#endif + +#ifndef SBG_CHECK_FORMAT + #if defined(__GNUC__) + #define SBG_CHECK_FORMAT(style, format_index, va_args) __attribute__((format(style, format_index, va_args))) + #else + #define SBG_CHECK_FORMAT(style, format_index, va_args) + #endif +#endif + +/*! + * XXX Visual C (not C++) doesn't provide anything to implement typeof(). As a result, + * This macro is private and shouldn't be relied on. + */ +#ifndef __SBG_TYPEOF + #ifdef __cplusplus + #define __SBG_TYPEOF(x) decltype(x) + #elif defined(__GNUC__) + #define __SBG_TYPEOF(x) typeof(x) + #elif defined(__TI_COMPILER_VERSION__) + #define __SBG_TYPEOF(x) typeof(x) + #endif +#endif + +#ifndef SBG_CONST_CAST_AA + #ifdef __SBG_TYPEOF + #define SBG_CONST_CAST_AA(x) ((const __SBG_TYPEOF((x)[0][0])(*)[SBG_ARRAY_SIZE((x)[0])])(x)) + #else + #define SBG_CONST_CAST_AA(x) x + #endif +#endif + +#ifndef SBG_CONST_CAST_PP + #ifdef __SBG_TYPEOF + #define SBG_CONST_CAST_PP(x) ((const __SBG_TYPEOF(**(x))**)(x)) + #else + #define SBG_CONST_CAST_PP(x) x + #endif +#endif + +/*! + * __BASE_FILE__ is gcc specific + */ +#ifndef __GNUC__ +#ifndef __BASE_FILE__ + #define __BASE_FILE__ __FILE__ +#endif +#endif + +#ifdef __cplusplus + #define SBG_DELETE(p) if (p){delete (p); (p) = NULL;} + #define SBG_DELETE_ARRAY(p) if (p){delete[] (p); (p) = NULL;} + #define SBG_FREE(p) if (p){free(p); (p) = NULL;} + #define SBG_FREE_ARRAY(p) if (p){free(p); (p) = NULL;} +#else + #define SBG_DELETE if (p){free(p); (p) = NULL;} + #define SBG_DELETE_ARRAY if (p){free(p); (p) = NULL;} + #define SBG_FREE(p) if (p){free(p); (p) = NULL;} + #define SBG_FREE_ARRAY(p) if (p){free(p); (p) = NULL;} +#endif + +//----------------------------------------------------------------------// +//- Compiler definitions -// +//----------------------------------------------------------------------// + +/*! + * Macro used to abstract the compiler specific inline keyword. + */ +#ifndef SBG_INLINE + #if defined(_MSC_VER) + #define SBG_INLINE __inline + #else + #define SBG_INLINE static inline + #endif +#endif + +/*! + * Macro used to avoid compiler warning when a variable is not used. + */ +#ifndef SBG_UNUSED_PARAMETER + #define SBG_UNUSED_PARAMETER(x) (void)(x) +#endif + +/*! + * The fallthrough attribute is used to avoid compiler warning in swith case statements + * when an intentional break is missing + */ +#ifndef SBG_FALLTHROUGH + #if __cplusplus >= 201703L + #define SBG_FALLTHROUGH [[fallthrough]] /* introduced in C++ 17 */ + #elif defined(__GNUC__) + #if __GNUC__ >= 7 + #define SBG_FALLTHROUGH __attribute__ ((fallthrough)) + #else + #define SBG_FALLTHROUGH ((void)0) + #endif + #else + #define SBG_FALLTHROUGH + #endif +#endif + +//----------------------------------------------------------------------// +//- Macro used to defined packed structures -// +//----------------------------------------------------------------------// + +/*! + * This macro is used to define a new section of packed structures. + * All structures defined after this macro will be packed. + */ +#ifdef __GNUC__ + #define SBG_BEGIN_PACKED() +#elif defined(__TI_COMPILER_VERSION__) + #define SBG_BEGIN_PACKED() +#elif defined(_MSC_VER) + #define SBG_BEGIN_PACKED() __pragma(pack(push, 1)) +#else + #error you must byte-align these structures with the appropriate compiler directives +#endif + +/*! + * This macro is used to specify that a structure is packed. + */ +#ifdef __GNUC__ + #define SBG_PACKED __attribute__((packed)) +#elif defined(__TI_COMPILER_VERSION__) + #define SBG_PACKED __attribute__((packed)) +#elif defined(_MSC_VER) + #define SBG_PACKED +#else + #error you must byte-align these structures with the appropriate compiler directives +#endif + +/*! + * This macro is used to close the section of packed structures and return to the default packing. + */ +#ifdef __GNUC__ + #define SBG_END_PACKED() +#elif defined(__TI_COMPILER_VERSION__) + #define SBG_END_PACKED() +#elif defined(_MSC_VER) + #define SBG_END_PACKED() __pragma(pack(pop)) +#else + #error you must byte-align these structures with the appropriate compiler directives +#endif + +//----------------------------------------------------------------------// +//- Deprecation definitions -// +//----------------------------------------------------------------------// + +/*! + * Macro used to indicate that a function is deprecated. + */ +#ifdef __GNUC__ + #define SBG_DEPRECATED(func) __attribute__ ((deprecated)) func +#elif defined(__TI_COMPILER_VERSION__) + #define SBG_DEPRECATED(func) func __attribute__ ((deprecated)) +#elif defined(_MSC_VER) + #define SBG_DEPRECATED(func) __declspec(deprecated) func +#else + //#warning "WARNING: You need to implement SBG_DEPRECATED for this compiler" + #define SBG_DEPRECATED(func) func +#endif + +/*! + * Macro used to indicate that a macro is deprecated. + */ +#ifdef __GNUC__ + #define SBG_DEPRECATED_MACRO(func) __pragma(deprecated(func)) +#elif defined(_MSC_VER) +#define SBG_DEPRECATED_MACRO(func) __pragma(deprecated(func)) +#else + //#warning "WARNING: You need to implement SBG_DEPRECATED_MACRO for this compiler" + #define SBG_DEPRECATED_MACRO(func) func +#endif + +/*! + * Set the default value of SBG_CONFIG_WARN_ABOUT_DEPRECATED_TYPES. + */ +#ifndef SBG_CONFIG_WARN_ABOUT_DEPRECATED_TYPES +#define SBG_CONFIG_WARN_ABOUT_DEPRECATED_TYPES (1) +#endif + +/*! + * Macro used to indicate that a type definition is deprecated. + * + * XXX In order to avoid excessive noise caused by deprecation warnings, the attribute + * may currently be disabled by defining SBG_CONFIG_WARN_ABOUT_DEPRECATED_TYPES to 0. + */ +#if SBG_CONFIG_WARN_ABOUT_DEPRECATED_TYPES != 0 + #ifdef __GNUC__ + #define SBG_DEPRECATED_TYPEDEF(decl) decl __attribute__((deprecated)) + #elif defined(_MSC_VER) + #define SBG_DEPRECATED_TYPEDEF(decl) __declspec(deprecated) decl + #else + #define SBG_DEPRECATED_TYPEDEF(decl) decl + #endif +#else + #define SBG_DEPRECATED_TYPEDEF(decl) decl +#endif + +//----------------------------------------------------------------------// +//- Basic maths definitions -// +//----------------------------------------------------------------------// +#ifndef SBG_PI + #define SBG_PI 3.14159265358979323846 +#endif + +#ifndef SBG_PI_F + #define SBG_PI_F 3.14159265358979323846f +#endif + +/*! + * Returns the absolute value of x. + * + * \param[in] x Signed integer value. + * \return The absolute value of x. + */ +#ifndef sbgAbs + #define sbgAbs(x) (((x) < 0) ? -(x) : (x)) +#endif + +/*! + * Returns the maximum between a and b + * \param[in] a First operand. + * \param[in] b Second operand. + * \return The maximum between a and b. + */ +#ifndef sbgMax + #define sbgMax(a,b) (((a) > (b)) ? (a) : (b)) +#endif + +/*! + * Returns the minimum between a and b + * \param[in] a First operand. + * \param[in] b Second operand. + * \return The minimum between a and b. + */ +#ifndef sbgMin + #define sbgMin(a,b) (((a) < (b)) ? (a) : (b)) +#endif + +/*! + * Clamp a value between minValue and maxValue ie minValue <= value <= maxValue + * \param[in] value First operand. + * \param[in] minValue First operand. + * \param[in] maxValue Second operand. + * \return The clamped value. + */ +#ifndef sbgClamp + #define sbgClamp(value, minValue, maxValue) (((value) < (minValue))?(minValue): ((value) > (maxValue)?maxValue:value)) +#endif + +/*! + * Integer division with a result rounded up. + * \param[in] n Dividend. + * \param[in] d Divisor. + */ +#ifndef sbgDivCeil + #define sbgDivCeil(n, d) (((n) + (d) - 1) / (d)) +#endif + +/*! + * Convert an angle from radians to degrees using double precision. + * + * \param[in] angle The angle to convert in radians. + * \return The converted angle in degrees. + */ +SBG_INLINE double sbgRadToDegd(double angle) +{ + return angle * 180.0 / SBG_PI; +} + +/*! + * Convert an angle from degrees to radians using double precision. + * + * \param[in] angle The angle to convert in degrees. + * \return The converted angle in radians. + */ +SBG_INLINE double sbgDegToRadd(double angle) +{ + return angle * SBG_PI / 180.0; +} + +/*! + * Convert an angle from radians to degrees using single (float) precision. + * + * \param[in] angle The angle to convert in radians. + * \return The converted angle in degrees. + */ +SBG_INLINE float sbgRadToDegf(float angle) +{ + return angle * 180.0f / SBG_PI_F; +} + +/*! + * Convert an angle from degrees to radians using single (float) precision. + * + * \param[in] angle The angle to convert in degrees. + * \return The converted angle in radians. + */ +SBG_INLINE float sbgDegToRadf(float angle) +{ + return angle * SBG_PI_F / 180.0f; +} + +/*! + * Test if two floating single-point numbers are equals or not. + * + * \param[in] leftValue The first operand to test for equality. + * \param[in] rightValue The second operand to test for equality. + * \retrun true if both left and right operands are almost equal. + */ +SBG_INLINE bool sbgAlmostEqualsFloat(float leftValue, float rightValue) +{ + // + // The IEEE standard says that any comparison operation involving a NAN must return false. + // + if (isnan(leftValue) || isnan(rightValue)) + { + return false; + } + + // + // This method is not good enough and should be updated using DistanceBetweenSignAndMagnitudeNumbers methods + // + if (fabsf(leftValue - rightValue) < FLT_EPSILON) + { + return true; + } + else + { + return false; + } +} + +/*! + * Test if two floating double-point numbers are equals or not using the epsilon technique + * + * \param[in] leftValue The first operand to test for equality. + * \param[in] rightValue The second operand to test for equality. + * \retrun true if both left and right operands are almost equal. + */ +SBG_INLINE bool sbgAlmostEqualsDouble(double leftValue, double rightValue) +{ + // + // The IEEE standard says that any comparison operation involving a NAN must return false. + // + if (isnan(leftValue) || isnan(rightValue)) + { + return false; + } + + // + // This method is not good enough and should be updated using DistanceBetweenSignAndMagnitudeNumbers methods + // + if (fabs(leftValue - rightValue) < DBL_EPSILON) + { + return true; + } + else + { + return false; + } +} + +#endif /* __SBG_DEFINES_H__ */ diff --git a/common/sbgErrorCodes.h b/common/sbgErrorCodes.h new file mode 100644 index 0000000..9082a86 --- /dev/null +++ b/common/sbgErrorCodes.h @@ -0,0 +1,117 @@ +/*! + * \file sbgErrorCodes.h + * \author SBG Systems (Raphael Siryani) + * \date 17 March 2015 + * + * \brief Header file that defines all error codes for SBG Systems libraries. + * + * \section CodeCopyright Copyright Notice + * The MIT license + * + * Copyright (C) 2007-2020, SBG Systems SAS. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef SBG_ERROR_CODES_H +#define SBG_ERROR_CODES_H + +// Local headers +#include "sbgDefines.h" + +//----------------------------------------------------------------------// +//- Errors code definitions -// +//----------------------------------------------------------------------// + +/*! + * Generic errors definitions for SBG Systems projects. + */ +typedef enum _SbgErrorCode +{ + SBG_NO_ERROR = 0, /*!< The operation was successfully executed. */ + SBG_ERROR, /*!< We have a generic error. */ + SBG_NULL_POINTER, /*!< A pointer is null. */ + SBG_INVALID_CRC, /*!< The received frame has an invalid CRC. */ + SBG_INVALID_FRAME, /*!< The received frame is invalid
*/ + /*!< We have received an unexpected frame (not the cmd we are waiting for or with an invalid data size.
*/ + /*!< This could be caused by a desync between questions and answers.
*/ + /*!< You should flush the serial port to fix this. */ + SBG_TIME_OUT, /*!< We have started to receive a frame but not the end. */ + SBG_WRITE_ERROR, /*!< All bytes hasn't been written. */ + SBG_READ_ERROR, /*!< All bytes hasn't been read. */ + SBG_BUFFER_OVERFLOW, /*!< A buffer is too small to contain so much data. */ + SBG_INVALID_PARAMETER, /*!< An invalid parameter has been found. */ + SBG_NOT_READY, /*!< A device isn't ready (Rx isn't ready for example). */ + SBG_MALLOC_FAILED, /*!< Failed to allocate a buffer. */ + SGB_CALIB_MAG_NOT_ENOUGH_POINTS, /*!< Not enough points were available to perform magnetometers calibration. */ + SBG_CALIB_MAG_INVALID_TAKE, /*!< The calibration procedure could not be properly executed due to insufficient precision. */ + SBG_CALIB_MAG_SATURATION, /*!< Saturation were detected when attempt to calibrate magnetos. */ + SBG_CALIB_MAG_POINTS_NOT_IN_A_PLANE, /*!< 2D calibration procedure could not be performed. */ + + SBG_DEVICE_NOT_FOUND, /*!< A device couldn't be founded or opened PC only error code */ + SBG_OPERATION_CANCELLED, /*!< An operation was canceled. PC only error code*/ + SBG_NOT_CONTINUOUS_FRAME, /*!< We have received a frame that isn't a continuous one. PC only error code*/ + + SBG_INCOMPATIBLE_HARDWARE, /*!< Hence valid; the command cannot be executed because of hardware incompatibility */ + SBG_INVALID_VERSION /*!< Incompatible version */ +} SbgErrorCode; + +//----------------------------------------------------------------------// +//- Error codes to string litteral conversion -// +//----------------------------------------------------------------------// + +/*! + * According to an error code, returns a human readable string. + * \param[in] errorCode The errorCode to convert to a string. + * \return Read only corresponding string. + */ +static inline const char *sbgErrorCodeToString(SbgErrorCode errorCode) +{ + /*! + * Array of string litterals that should be exactly ordered as the SbgErrorCode enum. + */ + static const char *sbgErrorCodeString[] = + { + "SBG_NO_ERROR", + "SBG_ERROR", + "SBG_NULL_POINTER", + "SBG_INVALID_CRC", + "SBG_INVALID_FRAME", + "SBG_TIME_OUT", + "SBG_WRITE_ERROR", + "SBG_READ_ERROR", + "SBG_BUFFER_OVERFLOW", + "SBG_INVALID_PARAMETER", + "SBG_NOT_READY", + "SBG_MALLOC_FAILED", + "SGB_CALIB_MAG_NOT_ENOUGH_POINTS", + "SBG_CALIB_MAG_INVALID_TAKE", + "SBG_CALIB_MAG_SATURATION", + "SBG_CALIB_MAG_POINTS_NOT_IN_A_PLANE", + "SBG_DEVICE_NOT_FOUND", + "SBG_OPERATION_CANCELLED", + "SBG_NOT_CONTINUOUS_FRAME", + "SBG_INCOMPATIBLE_HARDWARE", + "SBG_INVALID_VERSION" + }; + + assert(errorCode < SBG_ARRAY_SIZE(sbgErrorCodeString)); + return sbgErrorCodeString[errorCode]; +} + +#endif /* SBG_ERROR_CODES_H */ diff --git a/common/sbgTypes.h b/common/sbgTypes.h new file mode 100644 index 0000000..44ab8ad --- /dev/null +++ b/common/sbgTypes.h @@ -0,0 +1,192 @@ +/*! + * \file sbgTypes.h + * \author SBG Systems (Raphael Siryani) + * \date 17 March 2015 + * + * \brief Header file that defines all scalar types. + * + * The platform endianness should be defined here. + * + * \section CodeCopyright Copyright Notice + * The MIT license + * + * Copyright (C) 2007-2020, SBG Systems SAS. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef SBG_TYPES_H +#define SBG_TYPES_H + +// Standard headers +#include + +// Local headers +#include "sbgDefines.h" + +//----------------------------------------------------------------------// +//- Limits definitions -// +//----------------------------------------------------------------------// +#define SBG_MIN_INT_24 (-8388608l) +#define SBG_MAX_INT_24 (8388607l) +#define SBG_MAX_UINT_24 (16777215ul) + +#define SBG_MIN_INT_40 (-549755813887ll - 1) +#define SBG_MAX_INT_40 (549755813887ll) +#define SBG_MAX_UINT_40 (1099511627775ull) + +#define SBG_MIN_INT_48 (-140737488355327ll - 1) +#define SBG_MAX_INT_48 (140737488355327ll) +#define SBG_MAX_UINT_48 (281474976710655ull) + +#define SBG_MIN_INT_56 (-36028797018963967ll - 1) +#define SBG_MAX_INT_56 (36028797018963967ll) +#define SBG_MAX_UINT_56 (72057594037927935ull) + +//----------------------------------------------------------------------// +//- DEPRECATED: Scalar types definitions -// +//----------------------------------------------------------------------// +SBG_DEPRECATED_TYPEDEF(typedef unsigned char uint8); // 8 bits +SBG_DEPRECATED_TYPEDEF(typedef unsigned short uint16); // 16 bits +SBG_DEPRECATED_TYPEDEF(typedef unsigned int uint32); // 32 bits +SBG_DEPRECATED_TYPEDEF(typedef unsigned long long int uint64); // 64 bits + +SBG_DEPRECATED_TYPEDEF(typedef signed char int8); // 8 bits +SBG_DEPRECATED_TYPEDEF(typedef signed short int16); // 16 bits +SBG_DEPRECATED_TYPEDEF(typedef signed int int32); // 32 bits +SBG_DEPRECATED_TYPEDEF(typedef signed long long int int64); // 64 bits + + +//----------------------------------------------------------------------// +//- Misc types definitions -// +//----------------------------------------------------------------------// +typedef uint32_t sbgIpAddress; /*!< Define an IP v4 address stored in 4 bytes. The format is A.B.C.D, each component is 8 bits and stored in Big Endian. */ + +//------------------------------------------------------------------// +//- Type punning safe conversion unions -// +//------------------------------------------------------------------// + +/*! + * Used to get a uint32_t from a uint8_t array. + */ +typedef union _Uint8PtrToUint32Ptr +{ + uint8_t *m_pointerUint8; /*!< Set the address used to access the uint32_t. */ + uint32_t *m_pointerUint32; /*!< Store the unint32 value. */ +} Uint8PtrToUint32Ptr; + +/*! + * Union used to convert a buffer or 2 unit8 two's complement values to a int16_t + */ +typedef union _Uint8ToInt16 +{ + int16_t value; + uint8_t buffer[2]; +} Uint8ToInt16; + +/*! + * Union used to convert a buffer or 2 unit8 values to a uint16_t + */ +typedef union _Uint8ToUint16 +{ + uint16_t value; + uint8_t buffer[2]; +} Uint8ToUint16; + +/*! + * Union used to convert a buffer or 4 unit8 two's complement values to a int32_t + */ +typedef union _Uint8ToInt32 +{ + int32_t value; + uint8_t buffer[4]; +} Uint8ToInt32; + +/*! + * Union used to convert a buffer or 4 unit8 values to a uint32_t + */ +typedef union _Uint8ToUint32 +{ + uint32_t value; + uint8_t buffer[4]; +} Uint8ToUint32; + +/*! + * Union used to convert a buffer or 8 unit8 two's complement values to a int64_t + */ +typedef union _Uint8ToInt64 +{ + int64_t value; + uint8_t buffer[8]; +} Uint8ToInt64; + +/*! + * Union used to convert a buffer or 8 unit8 values to a uint64_t + */ +typedef union _Uint8ToUint64 +{ + uint64_t value; + uint8_t buffer[8]; +} Uint8ToUint64; + +/*! + * Union that allows type punning (access to a floating point number bits) + */ +typedef union _FloatNint +{ + float valF; + int32_t valI; + uint32_t valU; +} FloatNint; + +/*! + * Union that allows type punning (access to a double number bits) + */ +typedef union _DoubleNint +{ + double valF; + uint64_t valU; + int64_t valI; +} DoubleNint; + +/*! + * Structure that splits a 64bits + */ +typedef struct _Split64 +{ + uint32_t high; + uint32_t low; +} Split64; + +/*! + * Set of 3 int32_t + */ + typedef struct _SbgVector3i + { + int32_t v[3]; + } SbgVector3i; + + /*! + * Set of 3 int64_t + */ + typedef struct _SbgVector3ll + { + int64_t v[3]; + } SbgVector3ll; + +#endif /* SBG_TYPES_H */ diff --git a/common/splitBuffer/sbgSplitBuffer.c b/common/splitBuffer/sbgSplitBuffer.c new file mode 100644 index 0000000..e43ad8d --- /dev/null +++ b/common/splitBuffer/sbgSplitBuffer.c @@ -0,0 +1 @@ +#include "sbgSplitBuffer.h" diff --git a/common/splitBuffer/sbgSplitBuffer.h b/common/splitBuffer/sbgSplitBuffer.h new file mode 100644 index 0000000..882eefa --- /dev/null +++ b/common/splitBuffer/sbgSplitBuffer.h @@ -0,0 +1,251 @@ +/*! + * \file sbgSplitBuffer.h + * \author SBG Systems (Maxime Renaudet) + * \date 19 November 2013 + * + * \brief Helper methods used to handle a splittable buffer. + * + * \section CodeCopyright Copyright Notice + * The MIT license + * + * Copyright (C) 2007-2020, SBG Systems SAS. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef SBG_SPLIT_BUFFER_H +#define SBG_SPLIT_BUFFER_H + +#include + +//----------------------------------------------------------------------// +//- Header (open extern C block) -// +//----------------------------------------------------------------------// +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Structs definitions -// +//----------------------------------------------------------------------// + +/*! + * Defines the ECom transfer states + */ +typedef struct _SbgSplitBuffer +{ + uint8_t *pLinkedBuffer; /*!< Pointer on the buffer that needs to be split */ + size_t linkedBufferSize; /*!< Size of the original buffer */ + size_t subBufferSize; /*!< The size of the sub buffers */ + size_t subBufferNbr; /*!< The number of sub buffers in this split buffer */ +} SbgSplitBuffer; + +//----------------------------------------------------------------------// +//- Public methods definitions -// +//----------------------------------------------------------------------// + +/*! + * Initialize a split buffer for read operations. + * \param[in] pSplitBuffer Pointer to an allocated split buffer instance. + * \param[in] pBuffer The buffer that needs to be split (doesn't take the ownership). + * \param[in] bufferSize The total size of the buffer in bytes. + * \param[in] subBufferSize The size of each sub buffer in bytes. + */ +SBG_INLINE void sbgSplitBufferInitForRead(SbgSplitBuffer *pSplitBuffer, const void *pBuffer, size_t bufferSize, size_t subBufferSize) +{ + // + // Test input arguments + // + assert(pSplitBuffer); + + // + // Initialize split buffer parameters + // + pSplitBuffer->pLinkedBuffer = (uint8_t*)pBuffer; + pSplitBuffer->linkedBufferSize = bufferSize; + pSplitBuffer->subBufferSize = subBufferSize; + + // + // Compute sub buffer number + // + pSplitBuffer->subBufferNbr = (bufferSize + (subBufferSize - 1)) / subBufferSize; +} + +/*! + * Initialize a split buffer for write operations. + * \param[in] pSplitBuffer Pointer to an allocated split buffer instance. + * \param[in] pBuffer The buffer that needs to be split (doesn't take the ownership). + * \param[in] bufferSize The total size of the buffer in bytes. + * \param[in] subBufferSize The size of each sub buffer in bytes. + */ +SBG_INLINE void sbgSplitBufferInitForWrite(SbgSplitBuffer *pSplitBuffer, void *pBuffer, size_t bufferSize, size_t subBufferSize) +{ + // + // Test input arguments + // + assert(pSplitBuffer); + + // + // Initialize split buffer parameters + // + pSplitBuffer->pLinkedBuffer = (uint8_t*)pBuffer; + pSplitBuffer->linkedBufferSize = bufferSize; + pSplitBuffer->subBufferSize = subBufferSize; + + // + // Compute sub buffer number + // + pSplitBuffer->subBufferNbr = (bufferSize + (subBufferSize - 1)) / subBufferSize; +} + +/*! + * Returns the number of sub buffers that compose the whole buffer. + * \param[in] pSplitBuffer Valid pointer to a Split Buffer instance. + * \return The number of sub buffer the buffer has or 0 if there is an error. + */ +SBG_INLINE size_t sbgSplitBufferGetSubBufferNbr(const SbgSplitBuffer *pSplitBuffer) +{ + // + // Test input arguments + // + assert(pSplitBuffer); + + // + // Return subBufferNbr parameter + // + return pSplitBuffer->subBufferNbr; +} + +/*! + * Get one sub buffer given its index. + * \param[in] pSplitBuffer Valid pointer to a Split Buffer instance. + * \param[in] subBufferIdx Index of the sub buffer required. + * \return Pointer to the sub buffer or NULL if the subBuffer index is invalid. + */ +SBG_INLINE void *sbgSplitBufferGetSubBuffer(const SbgSplitBuffer *pSplitBuffer, size_t subBufferIdx) +{ + // + // Test input arguments + // + assert(pSplitBuffer); + + // + // Test input parameters + // + if (subBufferIdx < pSplitBuffer->subBufferNbr) + { + // + // Return pointer to buffer + // + return ((uint8_t*)pSplitBuffer->pLinkedBuffer + pSplitBuffer->subBufferSize*subBufferIdx); + } + else + { + // + // Invalid index + // + return NULL; + } +} + +/*! + * Return the offset in bytes of a sub buffer from the start of the buffer. + * \param[in] pSplitBuffer Valid pointer to a Split Buffer instance. + * \param[in] subBufferIdx Index of the sub buffer required. + * \return Offset to the sub buffer or 0 if the subBuffer index is invalid. + */ +SBG_INLINE size_t sbgSplitBufferGetSubBufferOffset(const SbgSplitBuffer *pSplitBuffer, size_t subBufferIdx) +{ + // + // Test input arguments + // + assert(pSplitBuffer); + + // + // Test input parameters + // + if (subBufferIdx < pSplitBuffer->subBufferNbr) + { + // + // Return pointer to buffer + // + return (pSplitBuffer->subBufferSize * subBufferIdx); + } + else + { + // + // Invalid index + // + return 0; + } +} + +/*! + * Get the size of a sub buffer given its index. + * \param[in] pSplitBuffer Valid pointer to a Split Buffer instance. + * \param[in] subBufferIdx Index of the sub buffer required. + * \return The size of the sub buffer of index subBufferIdx, or 0 if the subBuffer index is invalid. + */ +SBG_INLINE size_t sbgSplitBufferGetSubBufferSize(const SbgSplitBuffer *pSplitBuffer, size_t subBufferIdx) +{ + size_t subBufferSize = 0; + + // + // Test input arguments + // + assert(pSplitBuffer); + + // + // Test input parameters + // + if (pSplitBuffer->subBufferNbr > 0) + { + // + // Test that the sub buffer index is not the last one + // + if (subBufferIdx < (pSplitBuffer->subBufferNbr-1)) + { + // + // We can just return the sub buffer size because it's not the last sub buffer + // + subBufferSize = pSplitBuffer->subBufferSize; + } + else if (subBufferIdx == (pSplitBuffer->subBufferNbr-1) ) + { + // + // It's the last sub buffer so return the remaining size + // + subBufferSize = pSplitBuffer->linkedBufferSize - (subBufferIdx * pSplitBuffer->subBufferSize); + } + } + + // + // Return computed size + // + return subBufferSize; +} + +//----------------------------------------------------------------------// +//- Footer (close extern C block) -// +//----------------------------------------------------------------------// +#ifdef __cplusplus +} +#endif + +#endif /* SBG_SPLIT_BUFFER_H */ diff --git a/common/streamBuffer/sbgStreamBuffer.c b/common/streamBuffer/sbgStreamBuffer.c new file mode 100644 index 0000000..9f4955a --- /dev/null +++ b/common/streamBuffer/sbgStreamBuffer.c @@ -0,0 +1 @@ +#include "sbgStreamBuffer.h" diff --git a/common/streamBuffer/sbgStreamBuffer.h b/common/streamBuffer/sbgStreamBuffer.h new file mode 100644 index 0000000..4ff9e44 --- /dev/null +++ b/common/streamBuffer/sbgStreamBuffer.h @@ -0,0 +1,53 @@ +/*! + * \file sbgStreamBuffer.h + * \author SBG Systems (Raphael Siryani) + * \date 02 January 2013 + * + * \brief Used to read/write data from/to a memory buffer stream. + * + * \section CodeCopyright Copyright Notice + * The MIT license + * + * Copyright (C) 2007-2020, SBG Systems SAS. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + + +#ifndef SBG_STREAM_BUFFER_H +#define SBG_STREAM_BUFFER_H + +//----------------------------------------------------------------------// +//- Header (open extern C block) -// +//----------------------------------------------------------------------// +#ifdef __cplusplus +extern "C" { +#endif + +#include "sbgStreamBufferLE.h" +#include "sbgStreamBufferBE.h" + +//----------------------------------------------------------------------// +//- Footer (close extern C block) -// +//----------------------------------------------------------------------// +#ifdef __cplusplus +} +#endif + +#endif /* SBG_STREAM_BUFFER_H */ diff --git a/common/streamBuffer/sbgStreamBufferBE.h b/common/streamBuffer/sbgStreamBufferBE.h new file mode 100644 index 0000000..6a430df --- /dev/null +++ b/common/streamBuffer/sbgStreamBufferBE.h @@ -0,0 +1,1923 @@ +/*! + * \file sbgStreamBufferBE.h + * \author SBG Systems (Maxime Renaudet) + * \date 17 February 2015 + * + * \brief Specific method of stream buffer for little endian readings/writings. + * + * \section CodeCopyright Copyright Notice + * The MIT license + * + * Copyright (C) 2007-2020, SBG Systems SAS. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef SBG_STREAM_BUFFER_BE_H +#define SBG_STREAM_BUFFER_BE_H + +#include "sbgStreamBufferCommon.h" + +//----------------------------------------------------------------------// +//- Read operations methods -// +//----------------------------------------------------------------------// + +/*! + * Read an int16_t from a stream buffer (Big endian version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE int16_t sbgStreamBufferReadInt16BE(SbgStreamBuffer *pHandle) +{ + int16_t bytesValues[2]; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= sizeof(int16_t)) + { + // + // Test if the platform supports un-aligned access and if the endianness is the same + // + #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 1) + // + // Read the current value + // + bytesValues[0] = *((int16_t*)pHandle->pCurrentPtr); + + // + // Increment the current pointer + // + pHandle->pCurrentPtr += sizeof(int16_t); + + return bytesValues[0]; + #else + // + // Read the each bytes + // + bytesValues[1] = *(pHandle->pCurrentPtr++); + bytesValues[0] = *(pHandle->pCurrentPtr++); + + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + return bytesValues[1] | (bytesValues[0] << 8); + #else + return bytesValues[0] | (bytesValues[1] << 8); + #endif + #endif + } + else + { + // + // We have a buffer overflow so return 0 + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // If we are here, it means we have an error so return 0 + // + return 0; +} + +/*! + * Read an uint16_t from a stream buffer (Big endian version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE uint16_t sbgStreamBufferReadUint16BE(SbgStreamBuffer *pHandle) +{ + uint16_t bytesValues[2]; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= sizeof(uint16_t)) + { + // + // Test if the platform supports un-aligned access and if the endianness is the same + // + #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 1) + // + // Read the current value + // + bytesValues[0] = *((uint16_t*)pHandle->pCurrentPtr); + + // + // Increment the current pointer + // + pHandle->pCurrentPtr += sizeof(uint16_t); + + return bytesValues[0]; + #else + // + // Read the each bytes + // + bytesValues[1] = *(pHandle->pCurrentPtr++); + bytesValues[0] = *(pHandle->pCurrentPtr++); + + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + return bytesValues[1] | (bytesValues[0] << 8); + #else + return bytesValues[0] | (bytesValues[1] << 8); + #endif + #endif + } + else + { + // + // We have a buffer overflow so return 0 + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // If we are here, it means we have an error so return 0 + // + return 0; +} + +/*! + * Read an int24 from a stream buffer (Big endian version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE int32_t sbgStreamBufferReadInt24BE(SbgStreamBuffer *pHandle) +{ + Uint8ToInt32 value; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= 3*sizeof(uint8_t)) + { + // + // Make sure the value is zero init + // + value.value = 0; + + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + // + // Read the each bytes + // + value.buffer[0] = *(pHandle->pCurrentPtr++); // MSB + value.buffer[1] = *(pHandle->pCurrentPtr++); + value.buffer[2] = *(pHandle->pCurrentPtr++); // LSB + #else + // + // Read the each bytes + // + value.buffer[3] = *(pHandle->pCurrentPtr++); // MSB + value.buffer[2] = *(pHandle->pCurrentPtr++); + value.buffer[1] = *(pHandle->pCurrentPtr++); // LSB + #endif + + // + // Shift the value to handle the sign correctly for a 24 bits + // + return value.value >> (32-24); + } + else + { + // + // We have a buffer overflow so return 0 + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // If we are here, it means we have an error so return 0 + // + return 0; +} + +/*! + * Read an uint24 from a stream buffer (Big endian version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE uint32_t sbgStreamBufferReadUint24BE(SbgStreamBuffer *pHandle) +{ + Uint8ToUint32 value; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= 3*sizeof(uint8_t)) + { + // + // Make sure the value is zero init + // + value.value = 0; + + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + // + // Read the each bytes + // + value.buffer[0] = *(pHandle->pCurrentPtr++); // MSB + value.buffer[1] = *(pHandle->pCurrentPtr++); + value.buffer[2] = *(pHandle->pCurrentPtr++); // LSB + #else + // + // Read the each bytes + // + value.buffer[3] = *(pHandle->pCurrentPtr++); // MSB + value.buffer[2] = *(pHandle->pCurrentPtr++); + value.buffer[1] = *(pHandle->pCurrentPtr++); // LSB + #endif + + // + // Shift the value to handle the sign correctly for a 24 bits + // + return value.value >> (32-24); + } + else + { + // + // We have a buffer overflow so return 0 + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // If we are here, it means we have an error so return 0 + // + return 0; +} + +/*! + * Read an int32_t from a stream buffer (Big endian version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE int32_t sbgStreamBufferReadInt32BE(SbgStreamBuffer *pHandle) +{ + int32_t bytesValues[4]; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= sizeof(int32_t)) + { + // + // Test if the platform supports un-aligned access and if the endianness is the same + // + #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 1) + // + // Read the current value + // + bytesValues[0] = *((int32_t*)pHandle->pCurrentPtr); + + // + // Increment the current pointer + // + pHandle->pCurrentPtr += sizeof(int32_t); + + return bytesValues[0]; + #else + // + // Read the each bytes + // + bytesValues[3] = *(pHandle->pCurrentPtr++); + bytesValues[2] = *(pHandle->pCurrentPtr++); + bytesValues[1] = *(pHandle->pCurrentPtr++); + bytesValues[0] = *(pHandle->pCurrentPtr++); + + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + return bytesValues[3] | (bytesValues[2] << 8) | (bytesValues[1] << 16) | (bytesValues[0] << 24); + #else + return bytesValues[0] | (bytesValues[1] << 8) | (bytesValues[2] << 16) | (bytesValues[3] << 24); + #endif + #endif + } + else + { + // + // We have a buffer overflow so return 0 + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // If we are here, it means we have an error so return 0 + // + return 0; +} + +/*! + * Read an uint32_t from a stream buffer (Big endian version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE uint32_t sbgStreamBufferReadUint32BE(SbgStreamBuffer *pHandle) +{ + uint32_t bytesValues[4]; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= sizeof(uint32_t)) + { + // + // Test if the platform supports un-aligned access and if the endianness is the same + // + #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 1) + // + // Read the current value + // + bytesValues[0] = *((uint32_t*)pHandle->pCurrentPtr); + + // + // Increment the current pointer + // + pHandle->pCurrentPtr += sizeof(uint32_t); + + return bytesValues[0]; + #else + // + // Read the each bytes + // + bytesValues[3] = *(pHandle->pCurrentPtr++); + bytesValues[2] = *(pHandle->pCurrentPtr++); + bytesValues[1] = *(pHandle->pCurrentPtr++); + bytesValues[0] = *(pHandle->pCurrentPtr++); + + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + return bytesValues[3] | (bytesValues[2] << 8) | (bytesValues[1] << 16) | (bytesValues[0] << 24); + #else + return bytesValues[0] | (bytesValues[1] << 8) | (bytesValues[2] << 16) | (bytesValues[3] << 24); + #endif + #endif + } + else + { + // + // We have a buffer overflow so return 0 + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // If we are here, it means we have an error so return 0 + // + return 0; +} + +/*! + * Read an int40 from a stream buffer (Big endian version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE int64_t sbgStreamBufferReadInt40BE(SbgStreamBuffer *pHandle) +{ + Uint8ToInt64 value; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= 5*sizeof(uint8_t)) + { + // + // Make sure the value is zero init + // + value.value = 0; + + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + // + // Read the each bytes + // + value.buffer[0] = *(pHandle->pCurrentPtr++); // MSB + value.buffer[1] = *(pHandle->pCurrentPtr++); + value.buffer[2] = *(pHandle->pCurrentPtr++); + value.buffer[3] = *(pHandle->pCurrentPtr++); + value.buffer[4] = *(pHandle->pCurrentPtr++); // LSB + #else + // + // Read the each bytes + // + value.buffer[7] = *(pHandle->pCurrentPtr++); // MSB + value.buffer[6] = *(pHandle->pCurrentPtr++); + value.buffer[5] = *(pHandle->pCurrentPtr++); + value.buffer[4] = *(pHandle->pCurrentPtr++); + value.buffer[3] = *(pHandle->pCurrentPtr++); // LSB + #endif + + // + // Shift the value to handle the sign correctly for a 40 bits + // + return value.value >> (64-40); + } + else + { + // + // We have a buffer overflow so return 0 + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // If we are here, it means we have an error so return 0 + // + return 0; +} + +/*! + * Read an uint40 from a stream buffer (Big endian version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE uint64_t sbgStreamBufferReadUint40BE(SbgStreamBuffer *pHandle) +{ + Uint8ToUint64 value; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= 5*sizeof(uint8_t)) + { + // + // Make sure the value is zero init + // + value.value = 0; + + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + // + // Read the each bytes + // + value.buffer[0] = *(pHandle->pCurrentPtr++); // MSB + value.buffer[1] = *(pHandle->pCurrentPtr++); + value.buffer[2] = *(pHandle->pCurrentPtr++); + value.buffer[3] = *(pHandle->pCurrentPtr++); + value.buffer[4] = *(pHandle->pCurrentPtr++); // LSB + #else + // + // Read the each bytes + // + value.buffer[7] = *(pHandle->pCurrentPtr++); // MSB + value.buffer[6] = *(pHandle->pCurrentPtr++); + value.buffer[5] = *(pHandle->pCurrentPtr++); + value.buffer[4] = *(pHandle->pCurrentPtr++); + value.buffer[3] = *(pHandle->pCurrentPtr++); // LSB + #endif + + // + // Shift the value to handle the sign correctly for a 40 bits + // + return value.value >> (64-40); + } + else + { + // + // We have a buffer overflow so return 0 + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // If we are here, it means we have an error so return 0 + // + return 0; +} + +/*! + * Read an int48 from a stream buffer (Big endian version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE int64_t sbgStreamBufferReadInt48BE(SbgStreamBuffer *pHandle) +{ + Uint8ToInt64 value; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= 6*sizeof(uint8_t)) + { + // + // Make sure the value is zero init + // + value.value = 0; + + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + // + // Read the each bytes + // + value.buffer[0] = *(pHandle->pCurrentPtr++); // MSB + value.buffer[1] = *(pHandle->pCurrentPtr++); + value.buffer[2] = *(pHandle->pCurrentPtr++); + value.buffer[3] = *(pHandle->pCurrentPtr++); + value.buffer[4] = *(pHandle->pCurrentPtr++); + value.buffer[5] = *(pHandle->pCurrentPtr++); // LSB + #else + // + // Read the each bytes + // + value.buffer[7] = *(pHandle->pCurrentPtr++); // MSB + value.buffer[6] = *(pHandle->pCurrentPtr++); + value.buffer[5] = *(pHandle->pCurrentPtr++); + value.buffer[4] = *(pHandle->pCurrentPtr++); + value.buffer[3] = *(pHandle->pCurrentPtr++); + value.buffer[2] = *(pHandle->pCurrentPtr++); // LSB + #endif + + // + // Shift the value to handle the sign correctly for a 48 bits + // + return value.value >> (64-48); + } + else + { + // + // We have a buffer overflow so return 0 + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // If we are here, it means we have an error so return 0 + // + return 0; +} + +/*! + * Read an uint48 from a stream buffer (Big endian version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE uint64_t sbgStreamBufferReadUint48BE(SbgStreamBuffer *pHandle) +{ + Uint8ToUint64 value; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= 6*sizeof(uint8_t)) + { + // + // Make sure the value is zero init + // + value.value = 0; + + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + // + // Read the each bytes + // + value.buffer[0] = *(pHandle->pCurrentPtr++); // MSB + value.buffer[1] = *(pHandle->pCurrentPtr++); + value.buffer[2] = *(pHandle->pCurrentPtr++); + value.buffer[3] = *(pHandle->pCurrentPtr++); + value.buffer[4] = *(pHandle->pCurrentPtr++); + value.buffer[5] = *(pHandle->pCurrentPtr++); // LSB + #else + // + // Read the each bytes + // + value.buffer[7] = *(pHandle->pCurrentPtr++); // MSB + value.buffer[6] = *(pHandle->pCurrentPtr++); + value.buffer[5] = *(pHandle->pCurrentPtr++); + value.buffer[4] = *(pHandle->pCurrentPtr++); + value.buffer[3] = *(pHandle->pCurrentPtr++); + value.buffer[2] = *(pHandle->pCurrentPtr++); // LSB + #endif + + // + // Shift the value to handle the sign correctly for a 48 bits + // + return value.value >> (64-48); + } + else + { + // + // We have a buffer overflow so return 0 + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // If we are here, it means we have an error so return 0 + // + return 0; +} + +/*! + * Read an int56 from a stream buffer (Big endian version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE int64_t sbgStreamBufferReadInt56BE(SbgStreamBuffer *pHandle) +{ + Uint8ToInt64 value; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= 7*sizeof(uint8_t)) + { + // + // Make sure the value is zero init + // + value.value = 0; + + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + // + // Read the each bytes + // + value.buffer[0] = *(pHandle->pCurrentPtr++); // MSB + value.buffer[1] = *(pHandle->pCurrentPtr++); + value.buffer[2] = *(pHandle->pCurrentPtr++); + value.buffer[3] = *(pHandle->pCurrentPtr++); + value.buffer[4] = *(pHandle->pCurrentPtr++); + value.buffer[5] = *(pHandle->pCurrentPtr++); + value.buffer[6] = *(pHandle->pCurrentPtr++); // LSB + #else + // + // Read the each bytes + // + value.buffer[7] = *(pHandle->pCurrentPtr++); // MSB + value.buffer[6] = *(pHandle->pCurrentPtr++); + value.buffer[5] = *(pHandle->pCurrentPtr++); + value.buffer[4] = *(pHandle->pCurrentPtr++); + value.buffer[3] = *(pHandle->pCurrentPtr++); + value.buffer[2] = *(pHandle->pCurrentPtr++); + value.buffer[1] = *(pHandle->pCurrentPtr++); // LSB + #endif + + // + // Shift the value to handle the sign correctly for a 56 bits + // + return value.value >> (64-56); + } + else + { + // + // We have a buffer overflow so return 0 + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // If we are here, it means we have an error so return 0 + // + return 0; +} + +/*! + * Read an uint56 from a stream buffer (Big endian version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE int64_t sbgStreamBufferReadUint56BE(SbgStreamBuffer *pHandle) +{ + Uint8ToUint64 value; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= 7*sizeof(uint8_t)) + { + // + // Make sure the value is zero init + // + value.value = 0; + + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + // + // Read the each bytes + // + value.buffer[0] = *(pHandle->pCurrentPtr++); // MSB + value.buffer[1] = *(pHandle->pCurrentPtr++); + value.buffer[2] = *(pHandle->pCurrentPtr++); + value.buffer[3] = *(pHandle->pCurrentPtr++); + value.buffer[4] = *(pHandle->pCurrentPtr++); + value.buffer[5] = *(pHandle->pCurrentPtr++); + value.buffer[6] = *(pHandle->pCurrentPtr++); // LSB + #else + // + // Read the each bytes + // + value.buffer[7] = *(pHandle->pCurrentPtr++); // MSB + value.buffer[6] = *(pHandle->pCurrentPtr++); + value.buffer[5] = *(pHandle->pCurrentPtr++); + value.buffer[4] = *(pHandle->pCurrentPtr++); + value.buffer[3] = *(pHandle->pCurrentPtr++); + value.buffer[2] = *(pHandle->pCurrentPtr++); + value.buffer[1] = *(pHandle->pCurrentPtr++); // LSB + #endif + + // + // Shift the value to handle the sign correctly for a 56 bits + // + return value.value >> (64-56); + } + else + { + // + // We have a buffer overflow so return 0 + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // If we are here, it means we have an error so return 0 + // + return 0; +} + +/*! + * Read an int64_t from a stream buffer (Big endian version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE int64_t sbgStreamBufferReadInt64BE(SbgStreamBuffer *pHandle) +{ + int64_t lowPart; + int64_t highPart; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= sizeof(int64_t)) + { + // + // Test if the platform supports un-aligned access and if the endianness is the same + // + #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 1) + // + // Read the current value + // + lowPart = *((int64_t*)pHandle->pCurrentPtr); + + // + // Increment the current pointer + // + pHandle->pCurrentPtr += sizeof(int64_t); + + return lowPart; + #else + // + // Read 64 bit value using two 32 bits read to avoid too much 64 bits operations + // + highPart = sbgStreamBufferReadUint32BE(pHandle); + lowPart = sbgStreamBufferReadUint32BE(pHandle); + + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + return (lowPart << 32) | highPart; + #else + return lowPart | (highPart << 32); + #endif + #endif + } + else + { + // + // We have a buffer overflow so return 0 + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // If we are here, it means we have an error so return 0 + // + return 0ll; +} + +/*! + * Read an uint64_t from a stream buffer (Big endian version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE uint64_t sbgStreamBufferReadUint64BE(SbgStreamBuffer *pHandle) +{ + uint64_t lowPart; + uint64_t highPart; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= sizeof(uint64_t)) + { + // + // Test if the platform supports un-aligned access and if the endianness is the same + // + #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 1) + // + // Read the current value + // + lowPart = *((uint64_t*)pHandle->pCurrentPtr); + + // + // Increment the current pointer + // + pHandle->pCurrentPtr += sizeof(uint64_t); + + return lowPart; + #else + // + // Read 64 bit value using two 32 bits read to avoid too much 64 bits operations + // + highPart = sbgStreamBufferReadUint32BE(pHandle); + lowPart = sbgStreamBufferReadUint32BE(pHandle); + + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + return (lowPart << 32) | highPart; + #else + return lowPart | (highPart << 32); + #endif + #endif + } + else + { + // + // We have a buffer overflow so return 0 + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // If we are here, it means we have an error so return 0 + // + return 0ll; +} + +/*! + * Read a size_t from a stream buffer that has been stored in a uint32_t (Big endian version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE size_t sbgStreamBufferReadSizeT32BE(SbgStreamBuffer *pHandle) +{ + assert(pHandle); + + // + // Just call the read method for uint32_t + // We assume that a size_t is at least 32 bits on all platforms + // + return (size_t)sbgStreamBufferReadUint32BE(pHandle); +} + +/*! + * Read a size_t from a stream buffer that has been stored in a uint64_t (Big endian version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE size_t sbgStreamBufferReadSizeT64BE(SbgStreamBuffer *pHandle) +{ + uint64_t size; + + assert(pHandle); + + // + // Just call the read method for uint64_t + // + size = sbgStreamBufferReadUint64BE(pHandle); + + // + // Make sure the read size can fit in the size_t in size_t is 32 bits + // + assert((sizeof(size_t) == 8) || ((sizeof(size_t) == 4) && (size <= UINT32_MAX))); + + // + // Return the read value + // + return (size_t)size; +} + +/*! + * Read an float from a stream buffer (Big endian version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE float sbgStreamBufferReadFloatBE(SbgStreamBuffer *pHandle) +{ + FloatNint floatInt; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= sizeof(float)) + { + // + // Read the float as an uint32_t + // + floatInt.valU = sbgStreamBufferReadUint32BE(pHandle); + + // + // Return the float using an union to avoid compiller cast + // + return floatInt.valF; + } + else + { + // + // We have a buffer overflow so return 0 + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // If we are here, it means we have an error so return 0 + // + return 0.0f; +} + +/*! + * Read an double from a stream buffer (Big endian version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE double sbgStreamBufferReadDoubleBE(SbgStreamBuffer *pHandle) +{ + DoubleNint doubleInt; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= sizeof(double)) + { + // + // Read the float as an uint64_t + // + doubleInt.valU = sbgStreamBufferReadUint64BE(pHandle); + + // + // Return the double using an union to avoid compiller cast + // + return doubleInt.valF; + } + else + { + // + // We have a buffer overflow so return 0 + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // If we are here, it means we have an error so return 0 + // + return 0.0; +} + +//----------------------------------------------------------------------// +//- Write operations methods -// +//----------------------------------------------------------------------// + +/*! + * Write an int16_t into a stream buffer (Big Endian Version). + * + * \param[in] pHandle Valid stream buffer handle that supports write operations. + * \param[in] value The value to write. + * \return SBG_NO_ERROR if the value has been successfully written. + */ +SBG_INLINE SbgErrorCode sbgStreamBufferWriteInt16BE(SbgStreamBuffer *pHandle, int16_t value) +{ + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= sizeof(int16_t)) + { + // + // Test if the platform supports un-aligned access and if the endianness is the same + // + #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 1) + // + // Write the value + // + *((int16_t*)(pHandle->pCurrentPtr)) = value; + + // + // Increment the current pointer + // + pHandle->pCurrentPtr += sizeof(int16_t); + #else + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + #else + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + #endif + #endif + } + else + { + // + // We are accessing a data that is outside the stream buffer + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + return pHandle->errorCode; +} + +/*! + * Write an uint16_t into a stream buffer (Big Endian Version). + * + * \param[in] pHandle Valid stream buffer handle that supports write operations. + * \param[in] value The value to write. + * \return SBG_NO_ERROR if the value has been successfully written. + */ +SBG_INLINE SbgErrorCode sbgStreamBufferWriteUint16BE(SbgStreamBuffer *pHandle, uint16_t value) +{ + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= sizeof(uint16_t)) + { + // + // Test if the platform supports un-aligned access and if the endianness is the same + // + #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 1) + // + // Write the value + // + *((uint16_t*)(pHandle->pCurrentPtr)) = value; + + // + // Increment the current pointer + // + pHandle->pCurrentPtr += sizeof(uint16_t); + #else + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + #else + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + #endif + #endif + } + else + { + // + // We are accessing a data that is outside the stream buffer + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + return pHandle->errorCode; +} + +/*! + * Write an int24 into a stream buffer (Big Endian Version). + * + * \param[in] pHandle Valid stream buffer handle that supports write operations. + * \param[in] value The value to write. + * \return SBG_NO_ERROR if the value has been successfully written. + */ +SBG_INLINE SbgErrorCode sbgStreamBufferWriteInt24BE(SbgStreamBuffer *pHandle, int32_t value) +{ + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Make sure that the value is within 24 bit bonds + // + if ( (value >= SBG_MIN_INT_24) && (value <= SBG_MAX_INT_24) ) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= 3*sizeof(int8_t)) + { + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 16); + #else + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 16); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + #endif + } + else + { + // + // We are accessing a data that is outside the stream buffer + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + else + { + // + // The input value is not within a 24 bit integer bounds + // + pHandle->errorCode = SBG_INVALID_PARAMETER; + } + } + + return pHandle->errorCode; +} + +/*! + * Write an uint24 into a stream buffer (Big Endian Version). + * + * \param[in] pHandle Valid stream buffer handle that supports write operations. + * \param[in] value The value to write. + * \return SBG_NO_ERROR if the value has been successfully written. + */ +SBG_INLINE SbgErrorCode sbgStreamBufferWriteUint24BE(SbgStreamBuffer *pHandle, uint32_t value) +{ + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Make sure that the value is within 24 bit bonds + // + if (value <= SBG_MAX_UINT_24) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= 3*sizeof(uint8_t)) + { + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 16); + #else + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 16); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + #endif + } + else + { + // + // We are accessing a data that is outside the stream buffer + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + else + { + // + // The input value is not within a 24 bit integer bounds + // + pHandle->errorCode = SBG_INVALID_PARAMETER; + } + } + + return pHandle->errorCode; +} + +/*! + * Write an int32_t into a stream buffer (Big Endian Version). + * + * \param[in] pHandle Valid stream buffer handle that supports write operations. + * \param[in] value The value to write. + * \return SBG_NO_ERROR if the value has been successfully written. + */ +SBG_INLINE SbgErrorCode sbgStreamBufferWriteInt32BE(SbgStreamBuffer *pHandle, int32_t value) +{ + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= sizeof(int32_t)) + { + // + // Test if the platform supports un-aligned access and if the endianness is the same + // + #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 1) + // + // Write the value + // + *((int32_t*)(pHandle->pCurrentPtr)) = value; + + // + // Increment the current pointer + // + pHandle->pCurrentPtr += sizeof(int32_t); + #else + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 16); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 24); + #else + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 24); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 16); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + #endif + #endif + } + else + { + // + // We are accessing a data that is outside the stream buffer + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + return pHandle->errorCode; +} + +/*! + * Write an uint32_t into a stream buffer (Big Endian Version). + * + * \param[in] pHandle Valid stream buffer handle that supports write operations. + * \param[in] value The value to write. + * \return SBG_NO_ERROR if the value has been successfully written. + */ +SBG_INLINE SbgErrorCode sbgStreamBufferWriteUint32BE(SbgStreamBuffer *pHandle, uint32_t value) +{ + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= sizeof(uint32_t)) + { + // + // Test if the platform supports un-aligned access and if the endianness is the same + // + #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 1) + // + // Write the value + // + *((uint32_t*)(pHandle->pCurrentPtr)) = value; + + // + // Increment the current pointer + // + pHandle->pCurrentPtr += sizeof(uint32_t); + #else + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 16); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 24); + #else + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 24); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 16); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + #endif + #endif + } + else + { + // + // We are accessing a data that is outside the stream buffer + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + return pHandle->errorCode; +} + +/*! + * Write an uint48 into a stream buffer (Big Endian Version). + * + * \param[in] pHandle Valid stream buffer handle that supports write operations. + * \param[in] value The value to write. + * \return SBG_NO_ERROR if the value has been successfully written. + */ +SBG_INLINE SbgErrorCode sbgStreamBufferWriteUint48BE(SbgStreamBuffer *pHandle, uint64_t value) +{ + assert(pHandle); + assert(value < ((uint64_t)1 << 48)); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= 6 * sizeof(uint8_t)) + { + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 16); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 24); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 32); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 40); + #else + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 40); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 32); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 24); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 16); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + #endif + } + else + { + // + // We are accessing a data that is outside the stream buffer + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + return pHandle->errorCode; +} + +/*! + * Write an int64_t into a stream buffer (Big Endian Version). + * + * \param[in] pHandle Valid stream buffer handle that supports write operations. + * \param[in] value The value to write. + * \return SBG_NO_ERROR if the value has been successfully written. + */ +SBG_INLINE SbgErrorCode sbgStreamBufferWriteInt64BE(SbgStreamBuffer *pHandle, int64_t value) +{ + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= sizeof(int64_t)) + { + // + // Test if the platform supports un-aligned access and if the endianness is the same + // + #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 1) + // + // Write the value + // + *((int64_t*)(pHandle->pCurrentPtr)) = value; + + // + // Increment the current pointer + // + pHandle->pCurrentPtr += sizeof(int64_t); + #else + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 16); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 24); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 32); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 40); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 48); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 56); + #else + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 56); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 48); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 40); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 32); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 24); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 16); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + #endif + #endif + } + else + { + // + // We are accessing a data that is outside the stream buffer + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + return pHandle->errorCode; +} + +/*! + * Write an uint64_t into a stream buffer (Big Endian Version). + * + * \param[in] pHandle Valid stream buffer handle that supports write operations. + * \param[in] value The value to write. + * \return SBG_NO_ERROR if the value has been successfully written. + */ +SBG_INLINE SbgErrorCode sbgStreamBufferWriteUint64BE(SbgStreamBuffer *pHandle, uint64_t value) +{ + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= sizeof(uint64_t)) + { + // + // Test if the platform supports un-aligned access and if the endianness is the same + // + #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 1) + // + // Write the value + // + *((uint64_t*)(pHandle->pCurrentPtr)) = value; + + // + // Increment the current pointer + // + pHandle->pCurrentPtr += sizeof(uint64_t); + #else + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 16); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 24); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 32); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 40); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 48); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 56); + #else + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 56); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 48); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 40); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 32); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 24); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 16); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + #endif + #endif + } + else + { + // + // We are accessing a data that is outside the stream buffer + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + return pHandle->errorCode; +} + +/*! + * Write an size_t into a stream buffer as a uint32_t (Big Endian Version). + * + * \param[in] pHandle Valid stream buffer handle that supports write operations. + * \param[in] value The value to write. + * \return SBG_NO_ERROR if the value has been successfully written. + */ +SBG_INLINE SbgErrorCode sbgStreamBufferWriteSizeT32BE(SbgStreamBuffer *pHandle, size_t value) +{ + assert(pHandle); + + // + // Make sure the provided size_t value doesn't exceed a uint32_t storage + // + assert(value <= UINT32_MAX); + + // + // Call the write method to store a uint32_t + // + return sbgStreamBufferWriteUint32BE(pHandle, (uint32_t)value); +} + +/*! + * Write an size_t into a stream buffer as a uint64_t (Big Endian Version). + * + * \param[in] pHandle Valid stream buffer handle that supports write operations. + * \param[in] value The value to write. + * \return SBG_NO_ERROR if the value has been successfully written. + */ +SBG_INLINE SbgErrorCode sbgStreamBufferWriteSizeT64BE(SbgStreamBuffer *pHandle, size_t value) +{ + // + // Check input parameters + // + assert(pHandle); + + // + // Call the write method to store a uint64_t + // + return sbgStreamBufferWriteUint64BE(pHandle, (uint64_t)value); +} + +/*! + * Write an float into a stream buffer (Big Endian Version). + * + * \param[in] pHandle Valid stream buffer handle that supports write operations. + * \param[in] value The value to write. + * \return SBG_NO_ERROR if the value has been successfully written. + */ +SBG_INLINE SbgErrorCode sbgStreamBufferWriteFloatBE(SbgStreamBuffer *pHandle, float value) +{ + FloatNint floatInt; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // We use an union to avoid compiler cast + // + floatInt.valF = value; + + // + // Write this float as an uint32_t + // + return sbgStreamBufferWriteUint32BE(pHandle, floatInt.valU); + } + + return pHandle->errorCode; +} + +/*! + * Write an double into a stream buffer (Big Endian Version). + * + * \param[in] pHandle Valid stream buffer handle that supports write operations. + * \param[in] value The value to write. + * \return SBG_NO_ERROR if the value has been successfully written. + */ +SBG_INLINE SbgErrorCode sbgStreamBufferWriteDoubleBE(SbgStreamBuffer *pHandle, double value) +{ + DoubleNint doubleInt; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // We use an union to avoid compiler cast + // + doubleInt.valF = value; + + // + // Write this float as an uint64_t + // + return sbgStreamBufferWriteUint64BE(pHandle, doubleInt.valU); + } + + return pHandle->errorCode; +} + +/*! + * Read a C String from a stream buffer (Big Endian Version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \param[out] pString Buffer that can hold the read NULL terminated C string. + * \param[in] maxSize Maximum number of bytes that can be stored in pString (including the NULL char). + * \return SBG_NO_ERROR if the string has been read successfully from the stream buffer. + * SBG_BUFFER_OVERFLOW if the provided string isn't big enough to hold the read string + */ +SBG_INLINE SbgErrorCode sbgStreamBufferReadStringBE(SbgStreamBuffer *pHandle, char *pString, size_t maxSize) +{ + size_t stringLength; + + assert(pHandle); + assert(pString); + assert(maxSize > 0); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // The C string are stored in a stream buffer with a 32 bit size length and then the buffer itself + // + stringLength = sbgStreamBufferReadSizeT32BE(pHandle); + + if (stringLength <= maxSize) + { + // + // Read the string buffer itself + // + sbgStreamBufferReadBuffer(pHandle, pString, stringLength); + } + else + { + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + SBG_LOG_ERROR(pHandle->errorCode, "Trying to store a string of %zu bytes into a buffer of %zu bytes.", stringLength, maxSize); + } + } + + return pHandle->errorCode; +} + +/*! + * Write a NULL terminated C String into a stream buffer (Big Endian Version). + * + * \param[in] pHandle Valid stream buffer handle that supports write operations. + * \param[in] pString NULL terminated C String to write to the stream buffer. + * \return SBG_NO_ERROR if the string has been written successfully to the stream buffer. + */ +SBG_INLINE SbgErrorCode sbgStreamBufferWriteStringBE(SbgStreamBuffer *pHandle, const char *pString) +{ + size_t stringLength; + + assert(pHandle); + assert(pString); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // We write C string using a 32 bit size_t as the string length including the NULL char + // We should thus make sure the provided string isn't too big to fit in a 32 bits size_t + // + stringLength = strlen(pString)+1; + + if (stringLength <= UINT32_MAX) + { + // + // Write the string length + // + if (sbgStreamBufferWriteSizeT32BE(pHandle, stringLength) == SBG_NO_ERROR) + { + // + // Write the string buffer itself + // + sbgStreamBufferWriteBuffer(pHandle, pString, stringLength); + } + } + else + { + pHandle->errorCode = SBG_INVALID_PARAMETER; + SBG_LOG_ERROR(pHandle->errorCode, "The provided string is too big to fit in a 32 bit size_t"); + } + } + + return pHandle->errorCode; +} + +#endif /* SBG_STREAM_BUFFER_BE_H */ diff --git a/common/streamBuffer/sbgStreamBufferCommon.h b/common/streamBuffer/sbgStreamBufferCommon.h new file mode 100644 index 0000000..3e4d9cc --- /dev/null +++ b/common/streamBuffer/sbgStreamBufferCommon.h @@ -0,0 +1,830 @@ +/*! + * \file sbgStreamBufferCommon.h + * \author SBG Systems (Raphael Siryani) + * \date 02 January 2013 + * + * \brief Used to read/write data from/to a memory buffer stream. + * + * \section CodeCopyright Copyright Notice + * The MIT license + * + * Copyright (C) 2007-2020, SBG Systems SAS. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef SBG_STREAM_BUFFER_COMMON_H +#define SBG_STREAM_BUFFER_COMMON_H + +#include + +//----------------------------------------------------------------------// +//- General definitions -// +//----------------------------------------------------------------------// + +/*! + * The default method should read and write using the platform endianness + */ +#if SBG_CONFIG_BIG_ENDIAN == 1 + /*! + * The platform is a big endian one so default methods should use big endian byte order. + */ + #define sbgStreamBufferReadUint16 sbgStreamBufferReadUint16BE + #define sbgStreamBufferReadInt16 sbgStreamBufferReadInt16BE + + #define sbgStreamBufferReadUint24 sbgStreamBufferReadUint24BE + #define sbgStreamBufferReadInt24 sbgStreamBufferReadInt24BE + + #define sbgStreamBufferReadUint32 sbgStreamBufferReadUint32BE + #define sbgStreamBufferReadInt32 sbgStreamBufferReadInt32BE + + #define sbgStreamBufferReadUint40 sbgStreamBufferReadUint40BE + #define sbgStreamBufferReadInt40 sbgStreamBufferReadInt40BE + + #define sbgStreamBufferReadUint48 sbgStreamBufferReadUint48BE + #define sbgStreamBufferReadInt48 sbgStreamBufferReadInt48BE + + #define sbgStreamBufferReadUint56 sbgStreamBufferReadUint56BE + #define sbgStreamBufferReadInt56 sbgStreamBufferReadInt56BE + + #define sbgStreamBufferReadUint64 sbgStreamBufferReadUint64BE + #define sbgStreamBufferReadInt64 sbgStreamBufferReadInt64BE + + #define sbgStreamBufferReadSizeT32 sbgStreamBufferReadSizeT32BE + #define sbgStreamBufferReadSizeT64 sbgStreamBufferReadSizeT64BE + + #define sbgStreamBufferReadFloat sbgStreamBufferReadFloatBE + #define sbgStreamBufferReadDouble sbgStreamBufferReadDoubleBE + + #define sbgStreamBufferWriteUint16 sbgStreamBufferWriteUint16BE + #define sbgStreamBufferWriteInt16 sbgStreamBufferWriteInt16BE + + #define sbgStreamBufferWriteUint24 sbgStreamBufferWriteUint24BE + #define sbgStreamBufferWriteInt24 sbgStreamBufferWriteInt24BE + + #define sbgStreamBufferWriteUint32 sbgStreamBufferWriteUint32BE + #define sbgStreamBufferWriteInt32 sbgStreamBufferWriteInt32BE + + #define sbgStreamBufferWriteUint64 sbgStreamBufferWriteUint64BE + #define sbgStreamBufferWriteInt64 sbgStreamBufferWriteInt64BE + + #define sbgStreamBufferWriteSizeT32 sbgStreamBufferWriteSizeT32BE + #define sbgStreamBufferWriteSizeT64 sbgStreamBufferWriteSizeT64BE + + #define sbgStreamBufferWriteFloat sbgStreamBufferWriteFloatBE + #define sbgStreamBufferWriteDouble sbgStreamBufferWriteDoubleBE + + #define sbgStreamBufferReadString sbgStreamBufferReadStringBE + #define sbgStreamBufferWriteString sbgStreamBufferWriteStringBE +#else + /*! + * The platform is a little endian one so default methods should use little endian byte order. + */ + #define sbgStreamBufferReadUint16 sbgStreamBufferReadUint16LE + #define sbgStreamBufferReadInt16 sbgStreamBufferReadInt16LE + + #define sbgStreamBufferReadUint24 sbgStreamBufferReadUint24LE + #define sbgStreamBufferReadInt24 sbgStreamBufferReadInt24LE + + #define sbgStreamBufferReadUint32 sbgStreamBufferReadUint32LE + #define sbgStreamBufferReadInt32 sbgStreamBufferReadInt32LE + + #define sbgStreamBufferReadUint40 sbgStreamBufferReadUint40LE + #define sbgStreamBufferReadInt40 sbgStreamBufferReadInt40LE + + #define sbgStreamBufferReadUint48 sbgStreamBufferReadUint48LE + #define sbgStreamBufferReadInt48 sbgStreamBufferReadInt48LE + + #define sbgStreamBufferReadUint56 sbgStreamBufferReadUint56LE + #define sbgStreamBufferReadInt56 sbgStreamBufferReadInt56LE + + #define sbgStreamBufferReadUint64 sbgStreamBufferReadUint64LE + #define sbgStreamBufferReadInt64 sbgStreamBufferReadInt64LE + + #define sbgStreamBufferReadSizeT32 sbgStreamBufferReadSizeT32LE + #define sbgStreamBufferReadSizeT64 sbgStreamBufferReadSizeT64LE + + #define sbgStreamBufferReadFloat sbgStreamBufferReadFloatLE + #define sbgStreamBufferReadDouble sbgStreamBufferReadDoubleLE + + #define sbgStreamBufferWriteUint16 sbgStreamBufferWriteUint16LE + #define sbgStreamBufferWriteInt16 sbgStreamBufferWriteInt16LE + + #define sbgStreamBufferWriteUint24 sbgStreamBufferWriteUint24LE + #define sbgStreamBufferWriteInt24 sbgStreamBufferWriteInt24LE + + #define sbgStreamBufferWriteUint32 sbgStreamBufferWriteUint32LE + #define sbgStreamBufferWriteInt32 sbgStreamBufferWriteInt32LE + + #define sbgStreamBufferWriteUint64 sbgStreamBufferWriteUint64LE + #define sbgStreamBufferWriteInt64 sbgStreamBufferWriteInt64LE + + #define sbgStreamBufferWriteSizeT32 sbgStreamBufferWriteSizeT32LE + #define sbgStreamBufferWriteSizeT64 sbgStreamBufferWriteSizeT64LE + + #define sbgStreamBufferWriteFloat sbgStreamBufferWriteFloatLE + #define sbgStreamBufferWriteDouble sbgStreamBufferWriteDoubleLE + + #define sbgStreamBufferReadString sbgStreamBufferReadStringLE + #define sbgStreamBufferWriteString sbgStreamBufferWriteStringLE +#endif + +/*! + * Some methods are common between big and little endian. + * This definitions just unify the API. + */ +#define sbgStreamBufferReadUint8LE sbgStreamBufferReadUint8 +#define sbgStreamBufferReadInt8LE sbgStreamBufferReadInt8 +#define sbgStreamBufferReadBooleanLE sbgStreamBufferReadBoolean +#define sbgStreamBufferReadBufferLE sbgStreamBufferReadBuffer + +#define sbgStreamBufferWriteUint8LE sbgStreamBufferWriteUint8 +#define sbgStreamBufferWriteInt8LE sbgStreamBufferWriteInt8 +#define sbgStreamBufferWriteBooleanLE sbgStreamBufferWriteBoolean +#define sbgStreamBufferWriteBufferLE sbgStreamBufferWriteBuffer + +#define sbgStreamBufferReadUint8BE sbgStreamBufferReadUint8 +#define sbgStreamBufferReadInt8BE sbgStreamBufferReadInt8 +#define sbgStreamBufferReadBooleanBE sbgStreamBufferReadBoolean +#define sbgStreamBufferReadBufferBE sbgStreamBufferReadBuffer + +#define sbgStreamBufferWriteUint8BE sbgStreamBufferWriteUint8 +#define sbgStreamBufferWriteInt8BE sbgStreamBufferWriteInt8 +#define sbgStreamBufferWriteBooleanBE sbgStreamBufferWriteBoolean +#define sbgStreamBufferWriteBufferBE sbgStreamBufferWriteBuffer + +//----------------------------------------------------------------------// +//- Structure definitions -// +//----------------------------------------------------------------------// + +/*! + * Stream buffer modes. + */ +typedef enum _SbgSBMode +{ + SB_MODE_READ, /*!< This stream buffer can perform read operations. */ + SB_MODE_WRITE /*!< This stream buffer can perform write operations. */ +} SbgSBMode; + +/*! + * Enum used to define all seek modes + */ +typedef enum _SbgSBSeekOrigin +{ + SB_SEEK_SET, /*!< The offset is referenced to the begining of the stream. */ + SB_SEEK_CUR_INC, /*!< The offset is referenced to the current cursor position and increment the current cursor. */ + SB_SEEK_CUR_DEC, /*!< The offset is referenced to the current cursor position and decrement the current cursor. */ + SB_SEEK_END /*!< The offset is referenced to the end of the stream. */ +} SbgSBSeekOrigin; + +/*! + * Defines a stream buffer. + */ +typedef struct _SbgStreamBuffer +{ + SbgSBMode modes; /*!< Defines the stream buffer modes (read/write). */ + size_t bufferSize; /*!< Size in bytes of the linked buffer. */ + uint8_t *pBufferPtr; /*!< Pointer to the buffer linked with this stream. */ + uint8_t *pCurrentPtr; /*!< Current pointer within the buffer. */ + SbgErrorCode errorCode; /*!< Current error code on stream buffer. */ +} SbgStreamBuffer; + +//----------------------------------------------------------------------// +//- Common operations methods -// +//----------------------------------------------------------------------// + +/*! + * Initialize a stream buffer for both read and write operations and link it to a buffer. + * + * \param[in] pHandle Handle on an allocated stream buffer. + * \param[in] pLinkedBuffer Pointer on an allocated buffer to link with this stream. + * \param[in] bufferSize Size in bytes of the linked buffer. + * \return SBG_NO_ERROR if the stream buffer has been initialized successfully. + */ +SBG_INLINE SbgErrorCode sbgStreamBufferInitForWrite(SbgStreamBuffer *pHandle, void *pLinkedBuffer, size_t bufferSize) +{ + assert(pHandle); + assert(pLinkedBuffer); + + // + // Initialize stream parameters + // + pHandle->modes = SB_MODE_WRITE; + pHandle->bufferSize = bufferSize; + pHandle->errorCode = SBG_NO_ERROR; + + // + // Initialize the buffer + // + pHandle->pBufferPtr = (uint8_t*)pLinkedBuffer; + pHandle->pCurrentPtr = (uint8_t*)pLinkedBuffer; + + // + // For now, we don't handle any error, maybe we could add checks in debug mode only + // + return SBG_NO_ERROR; +} + +/*! + * Initialize a stream buffer for both read and write operations and link it to a buffer. + * + * \param[in] pHandle Handle on an allocated stream buffer. + * \param[in] pLinkedBuffer Pointer on an allocated buffer to link with this stream. + * \param[in] bufferSize Size in bytes of the linked buffer. + * \return SBG_NO_ERROR if the stream buffer has been initialized successfully. + */ +SBG_INLINE SbgErrorCode sbgStreamBufferInitForRead(SbgStreamBuffer *pHandle, const void *pLinkedBuffer, size_t bufferSize) +{ + assert(pHandle); + assert(pLinkedBuffer); + + // + // Initialize stream parameters + // + pHandle->modes = SB_MODE_READ; + pHandle->bufferSize = bufferSize; + pHandle->errorCode = SBG_NO_ERROR; + + // + // Initialize the buffer + // + pHandle->pBufferPtr = (uint8_t*)pLinkedBuffer; + pHandle->pCurrentPtr = (uint8_t*)pLinkedBuffer; + + // + // For now, we don't handle any error, maybe we could add checks in debug mode only + // + return SBG_NO_ERROR; +} + +/*! + * Return the error code that has occurred on the last stream buffer operation. + * + * \param[in] pHandle Pointer to a valid Stream Buffer handle + * \return Last stream buffer error code + */ +SBG_INLINE SbgErrorCode sbgStreamBufferGetLastError(const SbgStreamBuffer *pHandle) +{ + assert(pHandle); + + // + // Return error code + // + return pHandle->errorCode; +} + +/*! + * Clear the last error code that has occurred on the last stream buffer operation. + * + * \param[in] pHandle Pointer to a valid Stream Buffer handle + */ +SBG_INLINE void sbgStreamBufferClearLastError(SbgStreamBuffer *pHandle) +{ + assert(pHandle); + + // + // Return error code + // + pHandle->errorCode = SBG_NO_ERROR; +} + +/*! + * Returns the size in bytes of this stream. + * + * The size is the linked buffer total size in bytes. + * For example, for a SbgStreamBuffer linked with a buffer of 256 bytes, + * this method will always returns 256 even if no data has been written or read. + * + * \param[in] pHandle Valid handle on a stream buffer. + * \return The allocated size of the linked buffer in bytes. + */ +SBG_INLINE size_t sbgStreamBufferGetSize(const SbgStreamBuffer *pHandle) +{ + assert(pHandle); + + // + // Return the linked buffer size + // + return pHandle->bufferSize; +} + +/*! + * Returns the length in bytes of this stream. + * + * The length is computed using the current cursor position. + * If no data has been read or written, this method will return 0. + * If 4 uint32_t has been written, it should return 16. + * + * \param[in] pHandle Valid handle on a stream buffer. + * \return The current cursor position in bytes. + */ +SBG_INLINE size_t sbgStreamBufferGetLength(const SbgStreamBuffer *pHandle) +{ + assert(pHandle); + + // + // Return the number of bytes between the begin of the stream and the current pointer + // + return ((size_t)pHandle->pCurrentPtr - (size_t)pHandle->pBufferPtr); +} + +/*! + * Returns the available space in this stream. + * + * The available space is just the delta between the linked buffer size + * and the current buffer length (cursor position). + * + * \param[in] pHandle Valid handle on a stream buffer. + * \return The space available in this stream buffer in bytes. + */ +SBG_INLINE size_t sbgStreamBufferGetSpace(const SbgStreamBuffer *pHandle) +{ + assert(pHandle); + + // + // Return the space left in bytes + // + return sbgStreamBufferGetSize(pHandle) - sbgStreamBufferGetLength(pHandle); +} + +/*! + * Move the current cursor position. + * + * \param[in] pHandle Valid handle on a stream buffer. + * \param[in] offset Offset in bytes to apply (only positive). + * \param[in] origin Origin reference point to apply the offset from. + * \return SBG_NO_ERROR if the stream current cursor position has been moved. + */ +SBG_INLINE SbgErrorCode sbgStreamBufferSeek(SbgStreamBuffer *pHandle, size_t offset, SbgSBSeekOrigin origin) +{ + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // According to the origin reference point + // + switch (origin) + { + case SB_SEEK_SET: + pHandle->pCurrentPtr = pHandle->pBufferPtr + offset; + break; + case SB_SEEK_CUR_INC: + pHandle->pCurrentPtr += offset; + break; + case SB_SEEK_CUR_DEC: + pHandle->pCurrentPtr -= offset; + break; + case SB_SEEK_END: + pHandle->pCurrentPtr = pHandle->pBufferPtr + (pHandle->bufferSize - offset); + break; + default: + pHandle->errorCode = SBG_INVALID_PARAMETER; + SBG_LOG_ERROR(pHandle->errorCode, "Invalid origin parameter"); + } + + // + // Make sure that no error has occurred + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if the current ptr is still within the buffer bounds + // + if (pHandle->pCurrentPtr < pHandle->pBufferPtr) + { + // + // We are before the buffer so clamp to the begining of the buffer and raise an error + // + pHandle->pCurrentPtr = pHandle->pBufferPtr; + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + + // + // Stream buffer underflow + // + SBG_LOG_ERROR(pHandle->errorCode, "Trying to seek before the buffer"); + } + else if (pHandle->pCurrentPtr > pHandle->pBufferPtr + pHandle->bufferSize) + { + // + // We are after the buffer so clamp to the end of the buffer and raise an error + // + pHandle->pCurrentPtr = pHandle->pBufferPtr + pHandle->bufferSize; + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + + // + // Stream buffer overflow + // + SBG_LOG_ERROR(pHandle->errorCode, "Trying to seek after the buffer"); + } + } + } + + return pHandle->errorCode; +} + +/*! + * Returns the current offset in bytes from the beginning of the stream. + * + * \param[in] pHandle Valid handle on a stream buffer. + * \return Current offset in bytes from the beginning. + */ +SBG_INLINE size_t sbgStreamBufferTell(const SbgStreamBuffer *pHandle) +{ + assert(pHandle); + + return (size_t)pHandle->pCurrentPtr - (size_t)pHandle->pBufferPtr; +} + +/*! + * Returns a pointer on the internal buffer. + * + * \param[in] pHandle Valid handle on a stream buffer. + * \return Pointer on the begining of the internal buffer. + */ +SBG_INLINE void *sbgStreamBufferGetLinkedBuffer(const SbgStreamBuffer *pHandle) +{ + assert(pHandle); + + return pHandle->pBufferPtr; +} + +/*! + * Returns a pointer on the internal buffer at the current cursor. + * + * \param[in] pHandle Valid handle on a stream buffer. + * \return Pointer on the current cursor of the internal buffer. + */ +SBG_INLINE void *sbgStreamBufferGetCursor(const SbgStreamBuffer *pHandle) +{ + assert(pHandle); + + return pHandle->pCurrentPtr; +} + +//----------------------------------------------------------------------// +//- Read operations methods -// +//----------------------------------------------------------------------// + +/*! + * Read an int8_t from a stream buffer. + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE int8_t sbgStreamBufferReadInt8(SbgStreamBuffer *pHandle) +{ + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= sizeof(int8_t)) + { + // + // Read the byte + // + return *((int8_t*)(pHandle->pCurrentPtr++)); + } + else + { + // + // We have a buffer overflow + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // If we are here, it means we have an error so return 0 + // + return 0; +} + +/*! + * Read an uint8_t from a stream buffer. + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE uint8_t sbgStreamBufferReadUint8(SbgStreamBuffer *pHandle) +{ + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= sizeof(uint8_t)) + { + // + // Read the byte + // + return *((uint8_t*)(pHandle->pCurrentPtr++)); + } + else + { + // + // We have a buffer overflow + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // If we are here, it means we have an error so return 0 + // + return 0; +} + +/*! + * Read a boolean from a stream buffer. + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or false if we have an error. + */ +SBG_INLINE bool sbgStreamBufferReadBoolean(SbgStreamBuffer *pHandle) +{ + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= sizeof(uint8_t)) + { + // + // Read the byte and check if the value is different than zero or not + // + if (*((uint8_t*)(pHandle->pCurrentPtr++))) + { + return true; + } + else + { + return false; + } + } + else + { + // + // We have a buffer overflow + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // If we are here, it means we have an error so return false + // + return false; +} + +/*! + * Read a buffer from a stream buffer. + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \param[out] pBuffer Allocated buffer used to hold read data. + * \param[in] numBytesToRead Number of bytes to read from the stream buffer and to store in pBuffer. + * \return SBG_NO_ERROR if the data has been read. + */ +SBG_INLINE SbgErrorCode sbgStreamBufferReadBuffer(SbgStreamBuffer *pHandle, void *pBuffer, size_t numBytesToRead) +{ + assert(pHandle); + assert((pBuffer) || (numBytesToRead == 0)); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if enough bytes in stream + // + if (sbgStreamBufferGetSpace(pHandle) >= numBytesToRead) + { + // + // Copy from the stream buffer to the output buffer + // + memcpy(pBuffer, pHandle->pCurrentPtr, numBytesToRead); + + // + // Update the current pointer + // + pHandle->pCurrentPtr += numBytesToRead; + } + else + { + // + // Not enough data in stream + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + return pHandle->errorCode; +} + +//----------------------------------------------------------------------// +//- Write operations methods -// +//----------------------------------------------------------------------// + +/*! + * Write an int8_t into a stream buffer + * + * \param[in] pHandle Valid stream buffer handle that supports write operations. + * \param[in] value The value to write. + * \return SBG_NO_ERROR if the value has been successfully written. + */ +SBG_INLINE SbgErrorCode sbgStreamBufferWriteInt8(SbgStreamBuffer *pHandle, int8_t value) +{ + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= sizeof(int8_t)) + { + // + // Write each byte + // + *(pHandle->pCurrentPtr++) = (int8_t)(value); + } + else + { + // + // We are accessing a data that is outside the stream buffer + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + return pHandle->errorCode; +} + +/*! + * Write an uint8_t into a stream buffer + * + * \param[in] pHandle Valid stream buffer handle that supports write operations. + * \param[in] value The value to write. + * \return SBG_NO_ERROR if the value has been successfully written. + */ +SBG_INLINE SbgErrorCode sbgStreamBufferWriteUint8(SbgStreamBuffer *pHandle, uint8_t value) +{ + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= sizeof(uint8_t)) + { + // + // Write each byte + // + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + } + else + { + // + // We are accessing a data that is outside the stream buffer + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + return pHandle->errorCode; +} + +/*! + * Write a boolean into a stream buffer + * + * \param[in] pHandle Valid stream buffer handle that supports write operations. + * \param[in] value The value to write. + * \return SBG_NO_ERROR if the value has been successfully written. + */ +SBG_INLINE SbgErrorCode sbgStreamBufferWriteBoolean(SbgStreamBuffer *pHandle, bool value) +{ + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= sizeof(uint8_t)) + { + // + // Write the boolean as an uint8_t value (1 byte) + // + if (value) + { + *(pHandle->pCurrentPtr++) = 1; + } + else + { + *(pHandle->pCurrentPtr++) = 0; + } + } + else + { + // + // We are accessing a data that is outside the stream buffer + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + return pHandle->errorCode; +} + +/*! + * Write a buffer to a stream buffer. + * + * \param[in] pHandle Valid stream buffer handle that supports write operations. + * \param[out] pBuffer Buffer to write into the stream buffer. + * \param[in] numBytesToRead Number of bytes to write to the stream buffer. + * \return SBG_NO_ERROR if the data has been written. + */ +SBG_INLINE SbgErrorCode sbgStreamBufferWriteBuffer(SbgStreamBuffer *pHandle, const void *pBuffer, size_t numBytesToWrite) +{ + assert(pHandle); + assert((pBuffer) || (numBytesToWrite == 0)); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= numBytesToWrite) + { + // + // Copy from the stream buffer to the output buffer + // + memcpy(pHandle->pCurrentPtr, pBuffer, numBytesToWrite); + + // + // Update the current pointer + // + pHandle->pCurrentPtr += numBytesToWrite; + } + else + { + // + // We are accessing a data that is outside the stream buffer + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + return pHandle->errorCode; +} + +#endif /* SBG_STREAM_BUFFER_COMMON_H */ diff --git a/common/streamBuffer/sbgStreamBufferLE.h b/common/streamBuffer/sbgStreamBufferLE.h new file mode 100644 index 0000000..bd6f370 --- /dev/null +++ b/common/streamBuffer/sbgStreamBufferLE.h @@ -0,0 +1,1921 @@ +/*! + * \file sbgStreamBufferLE.h + * \author SBG Systems (Maxime Renaudet) + * \date 17 February 2015 + * + * \brief Specific method of stream buffer for little endian readings/writings. + * + * \section CodeCopyright Copyright Notice + * The MIT license + * + * Copyright (C) 2007-2020, SBG Systems SAS. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef SBG_STREAM_BUFFER_LE_H +#define SBG_STREAM_BUFFER_LE_H + +#include "sbgStreamBufferCommon.h" + +//----------------------------------------------------------------------// +//- Read operations methods -// +//----------------------------------------------------------------------// + +/*! + * Read an int16_t from a stream buffer (Little endian version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE int16_t sbgStreamBufferReadInt16LE(SbgStreamBuffer *pHandle) +{ + int16_t bytesValues[2]; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= sizeof(int16_t)) + { + // + // Test if the platform supports un-aligned access and if the endianness is the same + // + #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 0) + // + // Read the current value + // + bytesValues[0] = *((int16_t*)pHandle->pCurrentPtr); + + // + // Increment the current pointer + // + pHandle->pCurrentPtr += sizeof(int16_t); + + return bytesValues[0]; + #else + // + // Read the each bytes + // + bytesValues[0] = *(pHandle->pCurrentPtr++); + bytesValues[1] = *(pHandle->pCurrentPtr++); + + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + return bytesValues[1] | (bytesValues[0] << 8); + #else + return bytesValues[0] | (bytesValues[1] << 8); + #endif + #endif + } + else + { + // + // We have a buffer overflow so return 0 + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // If we are here, it means we have an error so return 0 + // + return 0; +} + +/*! + * Read an uint16_t from a stream buffer (Little endian version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE uint16_t sbgStreamBufferReadUint16LE(SbgStreamBuffer *pHandle) +{ + uint16_t bytesValues[2]; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= sizeof(uint16_t)) + { + // + // Test if the platform supports un-aligned access and if the endianness is the same + // + #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 0) + // + // Read the current value + // + bytesValues[0] = *((uint16_t*)pHandle->pCurrentPtr); + + // + // Increment the current pointer + // + pHandle->pCurrentPtr += sizeof(uint16_t); + + return bytesValues[0]; + #else + // + // Read the each bytes + // + bytesValues[0] = *(pHandle->pCurrentPtr++); + bytesValues[1] = *(pHandle->pCurrentPtr++); + + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + return bytesValues[1] | (bytesValues[0] << 8); + #else + return bytesValues[0] | (bytesValues[1] << 8); + #endif + #endif + } + else + { + // + // We have a buffer overflow so return 0 + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // If we are here, it means we have an error so return 0 + // + return 0; +} + +/*! + * Read an int24 from a stream buffer (Little endian version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE int32_t sbgStreamBufferReadInt24LE(SbgStreamBuffer *pHandle) +{ + Uint8ToInt32 value; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= 3*sizeof(uint8_t)) + { + // + // Make sure the value is zero init + // + value.value = 0; + + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + // + // Read the each bytes + // + value.buffer[2] = *(pHandle->pCurrentPtr++); // LSB + value.buffer[1] = *(pHandle->pCurrentPtr++); + value.buffer[0] = *(pHandle->pCurrentPtr++); // MSB + #else + // + // Read the each bytes + // + value.buffer[1] = *(pHandle->pCurrentPtr++); // LSB + value.buffer[2] = *(pHandle->pCurrentPtr++); + value.buffer[3] = *(pHandle->pCurrentPtr++); // MSB + #endif + + // + // Shift the value to handle the sign correctly for a 24 bits + // + return value.value >> (32-24); + } + else + { + // + // We have a buffer overflow so return 0 + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // If we are here, it means we have an error so return 0 + // + return 0; +} + +/*! + * Read an uint24 from a stream buffer (Little endian version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE uint32_t sbgStreamBufferReadUint24LE(SbgStreamBuffer *pHandle) +{ + Uint8ToUint32 value; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= 3*sizeof(uint8_t)) + { + // + // Make sure the value is zero init + // + value.value = 0; + + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + // + // Read the each bytes + // + value.buffer[2] = *(pHandle->pCurrentPtr++); // LSB + value.buffer[1] = *(pHandle->pCurrentPtr++); + value.buffer[0] = *(pHandle->pCurrentPtr++); // MSB + #else + // + // Read the each bytes + // + value.buffer[1] = *(pHandle->pCurrentPtr++); // LSB + value.buffer[2] = *(pHandle->pCurrentPtr++); + value.buffer[3] = *(pHandle->pCurrentPtr++); // MSB + #endif + + // + // Shift the value to handle the sign correctly for a 24 bits + // + return value.value >> (32-24); + } + else + { + // + // We have a buffer overflow so return 0 + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // If we are here, it means we have an error so return 0 + // + return 0; +} + +/*! + * Read an int32_t from a stream buffer (Little endian version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE int32_t sbgStreamBufferReadInt32LE(SbgStreamBuffer *pHandle) +{ + int32_t bytesValues[4]; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= sizeof(int32_t)) + { + // + // Test if the platform supports un-aligned access and if the endianness is the same + // + #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 0) + // + // Read the current value + // + bytesValues[0] = *((int32_t*)pHandle->pCurrentPtr); + + // + // Increment the current pointer + // + pHandle->pCurrentPtr += sizeof(int32_t); + + return bytesValues[0]; + #else + // + // Read the each bytes + // + bytesValues[0] = *(pHandle->pCurrentPtr++); + bytesValues[1] = *(pHandle->pCurrentPtr++); + bytesValues[2] = *(pHandle->pCurrentPtr++); + bytesValues[3] = *(pHandle->pCurrentPtr++); + + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + return bytesValues[3] | (bytesValues[2] << 8) | (bytesValues[1] << 16) | (bytesValues[0] << 24); + #else + return bytesValues[0] | (bytesValues[1] << 8) | (bytesValues[2] << 16) | (bytesValues[3] << 24); + #endif + #endif + } + else + { + // + // We have a buffer overflow so return 0 + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // If we are here, it means we have an error so return 0 + // + return 0; +} + +/*! + * Read an uint32_t from a stream buffer (Little endian version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE uint32_t sbgStreamBufferReadUint32LE(SbgStreamBuffer *pHandle) +{ + uint32_t bytesValues[4]; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= sizeof(uint32_t)) + { + // + // Test if the platform supports un-aligned access and if the endianness is the same + // + #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 0) + // + // Read the current value + // + bytesValues[0] = *((uint32_t*)pHandle->pCurrentPtr); + + // + // Increment the current pointer + // + pHandle->pCurrentPtr += sizeof(uint32_t); + + return bytesValues[0]; + #else + // + // Read the each bytes + // + bytesValues[0] = *(pHandle->pCurrentPtr++); + bytesValues[1] = *(pHandle->pCurrentPtr++); + bytesValues[2] = *(pHandle->pCurrentPtr++); + bytesValues[3] = *(pHandle->pCurrentPtr++); + + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + return bytesValues[3] | (bytesValues[2] << 8) | (bytesValues[1] << 16) | (bytesValues[0] << 24); + #else + return bytesValues[0] | (bytesValues[1] << 8) | (bytesValues[2] << 16) | (bytesValues[3] << 24); + #endif + #endif + } + else + { + // + // We have a buffer overflow so return 0 + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // If we are here, it means we have an error so return 0 + // + return 0; +} + +/*! + * Read an int40 from a stream buffer (Little endian version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE int64_t sbgStreamBufferReadInt40LE(SbgStreamBuffer *pHandle) +{ + Uint8ToInt64 value; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= 5*sizeof(uint8_t)) + { + // + // Make sure the value is zero init + // + value.value = 0; + + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + // + // Read the each bytes + // + value.buffer[4] = *(pHandle->pCurrentPtr++); // LSB + value.buffer[3] = *(pHandle->pCurrentPtr++); + value.buffer[2] = *(pHandle->pCurrentPtr++); + value.buffer[1] = *(pHandle->pCurrentPtr++); + value.buffer[0] = *(pHandle->pCurrentPtr++); // MSB + #else + // + // Read the each bytes + // + value.buffer[3] = *(pHandle->pCurrentPtr++); // MSB + value.buffer[4] = *(pHandle->pCurrentPtr++); + value.buffer[5] = *(pHandle->pCurrentPtr++); + value.buffer[6] = *(pHandle->pCurrentPtr++); + value.buffer[7] = *(pHandle->pCurrentPtr++); // MSB + #endif + + // + // Shift the value to handle the sign correctly for a 40 bits + // + return value.value >> (64-40); + } + else + { + // + // We have a buffer overflow so return 0 + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // If we are here, it means we have an error so return 0 + // + return 0; +} + +/*! + * Read an uint40 from a stream buffer (Little endian version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE int64_t sbgStreamBufferReadUint40LE(SbgStreamBuffer *pHandle) +{ + Uint8ToUint64 value; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= 5*sizeof(uint8_t)) + { + // + // Make sure the value is zero init + // + value.value = 0; + + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + // + // Read the each bytes + // + value.buffer[4] = *(pHandle->pCurrentPtr++); // LSB + value.buffer[3] = *(pHandle->pCurrentPtr++); + value.buffer[2] = *(pHandle->pCurrentPtr++); + value.buffer[1] = *(pHandle->pCurrentPtr++); + value.buffer[0] = *(pHandle->pCurrentPtr++); // MSB + #else + // + // Read the each bytes + // + value.buffer[3] = *(pHandle->pCurrentPtr++); // MSB + value.buffer[4] = *(pHandle->pCurrentPtr++); + value.buffer[5] = *(pHandle->pCurrentPtr++); + value.buffer[6] = *(pHandle->pCurrentPtr++); + value.buffer[7] = *(pHandle->pCurrentPtr++); // MSB + #endif + + // + // Shift the value to handle the sign correctly for a 40 bits + // + return value.value >> (64-40); + } + else + { + // + // We have a buffer overflow so return 0 + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // If we are here, it means we have an error so return 0 + // + return 0; +} + +/*! + * Read an int48 from a stream buffer (Little endian version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE int64_t sbgStreamBufferReadInt48LE(SbgStreamBuffer *pHandle) +{ + Uint8ToInt64 value; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= 6*sizeof(uint8_t)) + { + // + // Make sure the value is zero init + // + value.value = 0; + + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + // + // Read the each bytes + // + value.buffer[5] = *(pHandle->pCurrentPtr++); // LSB + value.buffer[4] = *(pHandle->pCurrentPtr++); + value.buffer[3] = *(pHandle->pCurrentPtr++); + value.buffer[2] = *(pHandle->pCurrentPtr++); + value.buffer[1] = *(pHandle->pCurrentPtr++); + value.buffer[0] = *(pHandle->pCurrentPtr++); // MSB + #else + // + // Read the each bytes + // + value.buffer[2] = *(pHandle->pCurrentPtr++); // LSB + value.buffer[3] = *(pHandle->pCurrentPtr++); + value.buffer[4] = *(pHandle->pCurrentPtr++); + value.buffer[5] = *(pHandle->pCurrentPtr++); + value.buffer[6] = *(pHandle->pCurrentPtr++); + value.buffer[7] = *(pHandle->pCurrentPtr++); // MSB + #endif + + // + // Shift the value to handle the sign correctly for a 48 bits + // + return value.value >> (64-48); + } + else + { + // + // We have a buffer overflow so return 0 + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // If we are here, it means we have an error so return 0 + // + return 0; +} + +/*! + * Read an uint48 from a stream buffer (Little endian version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE uint64_t sbgStreamBufferReadUint48LE(SbgStreamBuffer *pHandle) +{ + Uint8ToUint64 value; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= 6*sizeof(uint8_t)) + { + // + // Make sure the value is zero init + // + value.value = 0; + + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + // + // Read the each bytes + // + value.buffer[5] = *(pHandle->pCurrentPtr++); // LSB + value.buffer[4] = *(pHandle->pCurrentPtr++); + value.buffer[3] = *(pHandle->pCurrentPtr++); + value.buffer[2] = *(pHandle->pCurrentPtr++); + value.buffer[1] = *(pHandle->pCurrentPtr++); + value.buffer[0] = *(pHandle->pCurrentPtr++); // MSB + #else + // + // Read the each bytes + // + value.buffer[2] = *(pHandle->pCurrentPtr++); // LSB + value.buffer[3] = *(pHandle->pCurrentPtr++); + value.buffer[4] = *(pHandle->pCurrentPtr++); + value.buffer[5] = *(pHandle->pCurrentPtr++); + value.buffer[6] = *(pHandle->pCurrentPtr++); + value.buffer[7] = *(pHandle->pCurrentPtr++); // MSB + #endif + + // + // Shift the value to handle the sign correctly for a 48 bits + // + return value.value >> (64-48); + } + else + { + // + // We have a buffer overflow so return 0 + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // If we are here, it means we have an error so return 0 + // + return 0; +} + +/*! + * Read an int56 from a stream buffer (Little endian version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE int64_t sbgStreamBufferReadInt56LE(SbgStreamBuffer *pHandle) +{ + Uint8ToInt64 value; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= 7*sizeof(uint8_t)) + { + // + // Make sure the value is zero init + // + value.value = 0; + + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + // + // Read the each bytes + // + value.buffer[6] = *(pHandle->pCurrentPtr++); // LSB + value.buffer[5] = *(pHandle->pCurrentPtr++); + value.buffer[4] = *(pHandle->pCurrentPtr++); + value.buffer[3] = *(pHandle->pCurrentPtr++); + value.buffer[2] = *(pHandle->pCurrentPtr++); + value.buffer[1] = *(pHandle->pCurrentPtr++); + value.buffer[0] = *(pHandle->pCurrentPtr++); // MSB + #else + // + // Read the each bytes + // + value.buffer[1] = *(pHandle->pCurrentPtr++); // LSB + value.buffer[2] = *(pHandle->pCurrentPtr++); + value.buffer[3] = *(pHandle->pCurrentPtr++); + value.buffer[4] = *(pHandle->pCurrentPtr++); + value.buffer[5] = *(pHandle->pCurrentPtr++); + value.buffer[6] = *(pHandle->pCurrentPtr++); + value.buffer[7] = *(pHandle->pCurrentPtr++); // MSB + #endif + + // + // Shift the value to handle the sign correctly for a 56 bits + // + return value.value >> (64-56); + } + else + { + // + // We have a buffer overflow so return 0 + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // If we are here, it means we have an error so return 0 + // + return 0; +} + +/*! + * Read an uint56 from a stream buffer (Little endian version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE uint64_t sbgStreamBufferReadUint56LE(SbgStreamBuffer *pHandle) +{ + Uint8ToUint64 value; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= 7*sizeof(uint8_t)) + { + // + // Make sure the value is zero init + // + value.value = 0; + + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + // + // Read the each bytes + // + value.buffer[6] = *(pHandle->pCurrentPtr++); // LSB + value.buffer[5] = *(pHandle->pCurrentPtr++); + value.buffer[4] = *(pHandle->pCurrentPtr++); + value.buffer[3] = *(pHandle->pCurrentPtr++); + value.buffer[2] = *(pHandle->pCurrentPtr++); + value.buffer[1] = *(pHandle->pCurrentPtr++); + value.buffer[0] = *(pHandle->pCurrentPtr++); // MSB + #else + // + // Read the each bytes + // + value.buffer[1] = *(pHandle->pCurrentPtr++); // LSB + value.buffer[2] = *(pHandle->pCurrentPtr++); + value.buffer[3] = *(pHandle->pCurrentPtr++); + value.buffer[4] = *(pHandle->pCurrentPtr++); + value.buffer[5] = *(pHandle->pCurrentPtr++); + value.buffer[6] = *(pHandle->pCurrentPtr++); + value.buffer[7] = *(pHandle->pCurrentPtr++); // MSB + #endif + + // + // Shift the value to handle the sign correctly for a 56 bits + // + return value.value >> (64-56); + } + else + { + // + // We have a buffer overflow so return 0 + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // If we are here, it means we have an error so return 0 + // + return 0; +} + +/*! + * Read an int64_t from a stream buffer (Little endian version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE int64_t sbgStreamBufferReadInt64LE(SbgStreamBuffer *pHandle) +{ + int64_t lowPart; + int64_t highPart; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= sizeof(int64_t)) + { + // + // Test if the platform supports un-aligned access and if the endianness is the same + // + #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 0) + // + // Read the current value + // + lowPart = *((int64_t*)pHandle->pCurrentPtr); + + // + // Increment the current pointer + // + pHandle->pCurrentPtr += sizeof(int64_t); + + return lowPart; + #else + // + // Read 64 bit value using two 32 bits read to avoid too much 64 bits operations + // + lowPart = sbgStreamBufferReadUint32LE(pHandle); + highPart = sbgStreamBufferReadUint32LE(pHandle); + + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + return (lowPart << 32) | highPart; + #else + return lowPart | (highPart << 32); + #endif + #endif + } + else + { + // + // We have a buffer overflow so return 0 + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // If we are here, it means we have an error so return 0 + // + return 0ll; +} + +/*! + * Read an uint64_t from a stream buffer (Little endian version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE uint64_t sbgStreamBufferReadUint64LE(SbgStreamBuffer *pHandle) +{ + uint64_t lowPart; + uint64_t highPart; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= sizeof(uint64_t)) + { + // + // Test if the platform supports un-aligned access and if the endianness is the same + // + #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 0) + // + // Read the current value + // + lowPart = *((uint64_t*)pHandle->pCurrentPtr); + + // + // Increment the current pointer + // + pHandle->pCurrentPtr += sizeof(uint64_t); + + return lowPart; + #else + // + // Read 64 bit value using two 32 bits read to avoid too much 64 bits operations + // + lowPart = sbgStreamBufferReadUint32LE(pHandle); + highPart = sbgStreamBufferReadUint32LE(pHandle); + + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + return (lowPart << 32) | highPart; + #else + return lowPart | (highPart << 32); + #endif + #endif + } + else + { + // + // We have a buffer overflow so return 0 + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // If we are here, it means we have an error so return 0 + // + return 0ull; +} + +/*! + * Read a size_t from a stream buffer that has been stored in a uint32_t (Little endian version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE size_t sbgStreamBufferReadSizeT32LE(SbgStreamBuffer *pHandle) +{ + assert(pHandle); + + // + // Just call the read method for uint32_t + // We assume that a size_t is at least 32 bits on all platforms + // + return (size_t)sbgStreamBufferReadUint32LE(pHandle); +} + +/*! + * Read a size_t from a stream buffer that has been stored in a uint64_t (Little endian version). + + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE size_t sbgStreamBufferReadSizeT64LE(SbgStreamBuffer *pHandle) +{ + uint64_t size; + + assert(pHandle); + + // + // Just call the read method for uint64_t + // + size = sbgStreamBufferReadUint64LE(pHandle); + + // + // Make sure the read size can fit in the size_t in size_t is 32 bits + // + assert((sizeof(size_t) == 8) || ((sizeof(size_t) == 4) && (size <= UINT32_MAX))); + + // + // Return the read value + // + return (size_t)size; +} + +/*! + * Read an float from a stream buffer (Little endian version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE float sbgStreamBufferReadFloatLE(SbgStreamBuffer *pHandle) +{ + FloatNint floatInt; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= sizeof(float)) + { + // + // Read the float as an uint32_t + // + floatInt.valU = sbgStreamBufferReadUint32LE(pHandle); + + // + // Return the float using an union to avoid compiler cast + // + return floatInt.valF; + } + else + { + // + // We have a buffer overflow so return 0 + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // If we are here, it means we have an error so return 0 + // + return 0.0f; +} + +/*! + * Read an double from a stream buffer (Little endian version). + * + * \param[in] pHandle Valid stream buffer handle that supports read operations. + * \return The read value or 0 if we have an error. + */ +SBG_INLINE double sbgStreamBufferReadDoubleLE(SbgStreamBuffer *pHandle) +{ + DoubleNint doubleInt; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= sizeof(double)) + { + // + // Read the float as an uint64_t + // + doubleInt.valU = sbgStreamBufferReadUint64LE(pHandle); + + // + // Return the double using an union to avoid compiler cast + // + return doubleInt.valF; + } + else + { + // + // We have a buffer overflow so return 0 + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // If we are here, it means we have an error so return 0 + // + return 0.0; +} + +//----------------------------------------------------------------------// +//- Write operations methods -// +//----------------------------------------------------------------------// + +/*! + * Write an int16_t into a stream buffer (Little Endian Version). + * + * \param[in] pHandle Valid stream buffer handle that supports write operations. + * \param[in] value The value to write. + * \return SBG_NO_ERROR if the value has been successfully written. + */ +SBG_INLINE SbgErrorCode sbgStreamBufferWriteInt16LE(SbgStreamBuffer *pHandle, int16_t value) +{ + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= sizeof(int16_t)) + { + // + // Test if the platform supports un-aligned access and if the endianness is the same + // + #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 0) + // + // Write the value + // + *((int16_t*)(pHandle->pCurrentPtr)) = value; + + // + // Increment the current pointer + // + pHandle->pCurrentPtr += sizeof(int16_t); + #else + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + #else + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + #endif + #endif + } + else + { + // + // We are accessing a data that is outside the stream buffer + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + return pHandle->errorCode; +} + +/*! + * Write an uint16_t into a stream buffer (Little Endian Version). + * + * \param[in] pHandle Valid stream buffer handle that supports write operations. + * \param[in] value The value to write. + * \return SBG_NO_ERROR if the value has been successfully written. + */ +SBG_INLINE SbgErrorCode sbgStreamBufferWriteUint16LE(SbgStreamBuffer *pHandle, uint16_t value) +{ + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= sizeof(uint16_t)) + { + // + // Test if the platform supports un-aligned access and if the endianness is the same + // + #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 0) + // + // Write the value + // + *((uint16_t*)(pHandle->pCurrentPtr)) = value; + + // + // Increment the current pointer + // + pHandle->pCurrentPtr += sizeof(uint16_t); + #else + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + #else + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + #endif + #endif + } + else + { + // + // We are accessing a data that is outside the stream buffer + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + return pHandle->errorCode; +} + + +/*! + * Write an int24 into a stream buffer (Little Endian Version). + * + * \param[in] pHandle Valid stream buffer handle that supports write operations. + * \param[in] value The value to write. + * \return SBG_NO_ERROR if the value has been successfully written. + */ +SBG_INLINE SbgErrorCode sbgStreamBufferWriteInt24LE(SbgStreamBuffer *pHandle, int32_t value) +{ + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Make sure that the value is within 24 bit bonds + // + if ( (value >= SBG_MIN_INT_24) && (value <= SBG_MAX_INT_24) ) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= 3*sizeof(int8_t)) + { + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 16); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + #else + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 16); + #endif + } + else + { + // + // We are accessing a data that is outside the stream buffer + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + else + { + // + // The input value is not within a 24 bit integer bounds + // + pHandle->errorCode = SBG_INVALID_PARAMETER; + } + } + + return pHandle->errorCode; +} + +/*! + * Write an uint24 into a stream buffer (Little Endian Version). + * + * \param[in] pHandle Valid stream buffer handle that supports write operations. + * \param[in] value The value to write. + * \return SBG_NO_ERROR if the value has been successfully written. + */ +SBG_INLINE SbgErrorCode sbgStreamBufferWriteUint24LE(SbgStreamBuffer *pHandle, uint32_t value) +{ + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Make sure that the value is within 24 bit bonds + // + if (value <= SBG_MAX_UINT_24) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= 3*sizeof(uint8_t)) + { + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 16); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + #else + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 16); + #endif + } + else + { + // + // We are accessing a data that is outside the stream buffer + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + else + { + // + // The input value is not within a 24 bit integer bounds + // + pHandle->errorCode = SBG_INVALID_PARAMETER; + } + } + + return pHandle->errorCode; +} + +/*! + * Write an int32_t into a stream buffer (Little Endian Version). + * + * \param[in] pHandle Valid stream buffer handle that supports write operations. + * \param[in] value The value to write. + * \return SBG_NO_ERROR if the value has been successfully written. + */ +SBG_INLINE SbgErrorCode sbgStreamBufferWriteInt32LE(SbgStreamBuffer *pHandle, int32_t value) +{ + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= sizeof(int32_t)) + { + // + // Test if the platform supports un-aligned access and if the endianness is the same + // + #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 0) + // + // Write the value + // + *((int32_t*)(pHandle->pCurrentPtr)) = value; + + // + // Increment the current pointer + // + pHandle->pCurrentPtr += sizeof(int32_t); + #else + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 24); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 16); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + #else + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 16); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 24); + #endif + #endif + } + else + { + // + // We are accessing a data that is outside the stream buffer + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + return pHandle->errorCode; +} + +/*! + * Write an uint32_t into a stream buffer (Little Endian Version). + * + * \param[in] pHandle Valid stream buffer handle that supports write operations. + * \param[in] value The value to write. + * \return SBG_NO_ERROR if the value has been successfully written. + */ +SBG_INLINE SbgErrorCode sbgStreamBufferWriteUint32LE(SbgStreamBuffer *pHandle, uint32_t value) +{ + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= sizeof(uint32_t)) + { + // + // Test if the platform supports un-aligned access and if the endianness is the same + // + #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 0) + // + // Write the value + // + *((uint32_t*)(pHandle->pCurrentPtr)) = value; + + // + // Increment the current pointer + // + pHandle->pCurrentPtr += sizeof(uint32_t); + #else + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 24); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 16); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + #else + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 16); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 24); + #endif + #endif + } + else + { + // + // We are accessing a data that is outside the stream buffer + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + return pHandle->errorCode; +} + +/*! + * Write an uint48 into a stream buffer (Little Endian Version). + * + * \param[in] pHandle Valid stream buffer handle that supports write operations. + * \param[in] value The value to write. + * \return SBG_NO_ERROR if the value has been successfully written. + */ +SBG_INLINE SbgErrorCode sbgStreamBufferWriteUint48LE(SbgStreamBuffer *pHandle, uint64_t value) +{ + assert(pHandle); + assert(value < ((uint64_t)1 << 48)); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= 6 * sizeof(uint8_t)) + { + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 40); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 32); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 24); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 16); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + #else + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 16); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 24); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 32); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 40); + #endif + } + else + { + // + // We are accessing a data that is outside the stream buffer + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + return pHandle->errorCode; +} + +/*! + * Write an int64_t into a stream buffer (Little Endian Version). + * + * \param[in] pHandle Valid stream buffer handle that supports write operations. + * \param[in] value The value to write. + * \return SBG_NO_ERROR if the value has been successfully written. + */ +SBG_INLINE SbgErrorCode sbgStreamBufferWriteInt64LE(SbgStreamBuffer *pHandle, int64_t value) +{ + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= sizeof(int64_t)) + { + // + // Test if the platform supports un-aligned access and if the endianness is the same + // + #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 0) + // + // Write the value + // + *((int64_t*)(pHandle->pCurrentPtr)) = value; + + // + // Increment the current pointer + // + pHandle->pCurrentPtr += sizeof(int64_t); + #else + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 56); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 48); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 40); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 32); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 24); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 16); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + #else + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 16); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 24); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 32); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 40); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 48); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 56); + #endif + #endif + } + else + { + // + // We are accessing a data that is outside the stream buffer + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + return pHandle->errorCode; +} + +/*! + * Write an uint64_t into a stream buffer (Little Endian Version). + * + * \param[in] pHandle Valid stream buffer handle that supports write operations. + * \param[in] value The value to write. + * \return SBG_NO_ERROR if the value has been successfully written. + */ +SBG_INLINE SbgErrorCode sbgStreamBufferWriteUint64LE(SbgStreamBuffer *pHandle, uint64_t value) +{ + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // Test if we can access this item + // + if (sbgStreamBufferGetSpace(pHandle) >= sizeof(uint64_t)) + { + // + // Test if the platform supports un-aligned access and if the endianness is the same + // + #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 0) + // + // Write the value + // + *((uint64_t*)(pHandle->pCurrentPtr)) = value; + + // + // Increment the current pointer + // + pHandle->pCurrentPtr += sizeof(uint64_t); + #else + // + // Store data according to platform endianness + // + #if (SBG_CONFIG_BIG_ENDIAN == 1) + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 56); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 48); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 40); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 32); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 24); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 16); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + #else + *(pHandle->pCurrentPtr++) = (uint8_t)(value); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 8); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 16); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 24); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 32); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 40); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 48); + *(pHandle->pCurrentPtr++) = (uint8_t)(value >> 56); + #endif + #endif + } + else + { + // + // We are accessing a data that is outside the stream buffer + // + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + } + } + + return pHandle->errorCode; +} + +/*! + * Write an size_t into a stream buffer as a uint32_t (Little Endian Version). + * + * \param[in] pHandle Valid stream buffer handle that supports write operations. + * \param[in] value The value to write. + * \return SBG_NO_ERROR if the value has been successfully written. + */ +SBG_INLINE SbgErrorCode sbgStreamBufferWriteSizeT32LE(SbgStreamBuffer *pHandle, size_t value) +{ + assert(pHandle); + + // + // Make sure the provided size_t value doesn't exceed a uint32_t storage + // + assert(value <= UINT32_MAX); + + // + // Call the write method to store a uint32_t + // + return sbgStreamBufferWriteUint32LE(pHandle, (uint32_t)value); +} + +/*! + * Write an size_t into a stream buffer as a uint64_t (Little Endian Version). + * + * \param[in] pHandle Valid stream buffer handle that supports write operations. + * \param[in] value The value to write. + * \return SBG_NO_ERROR if the value has been successfully written. + */ +SBG_INLINE SbgErrorCode sbgStreamBufferWriteSizeT64LE(SbgStreamBuffer *pHandle, size_t value) +{ + assert(pHandle); + + // + // Call the write method to store a uint64_t + // + return sbgStreamBufferWriteUint64LE(pHandle, (uint64_t)value); +} + +/*! + * Write an float into a stream buffer (Little Endian Version). + * + * \param[in] pHandle Valid stream buffer handle that supports write operations. + * \param[in] value The value to write. + * \return SBG_NO_ERROR if the value has been successfully written. + */ +SBG_INLINE SbgErrorCode sbgStreamBufferWriteFloatLE(SbgStreamBuffer *pHandle, float value) +{ + FloatNint floatInt; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // We use an union to avoid compiler cast + // + floatInt.valF = value; + + // + // Write this float as an uint32_t + // + return sbgStreamBufferWriteUint32LE(pHandle, floatInt.valU); + } + + return pHandle->errorCode; +} + +/*! + * Write an double into a stream buffer. (Little Endian Version). + * + * \param[in] pHandle Valid stream buffer handle that supports write operations. + * \param[in] value The value to write. + * \return SBG_NO_ERROR if the value has been successfully written. + */ +SBG_INLINE SbgErrorCode sbgStreamBufferWriteDoubleLE(SbgStreamBuffer *pHandle, double value) +{ + DoubleNint doubleInt; + + assert(pHandle); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // We use an union to avoid compiler cast + // + doubleInt.valF = value; + + // + // Write this float as an uint64_t + // + return sbgStreamBufferWriteUint64LE(pHandle, doubleInt.valU); + } + + return pHandle->errorCode; +} + +/*! +* Read a C String from a stream buffer (Little Endian Version). +* +* \param[in] pHandle Valid stream buffer handle that supports read operations. +* \param[out] pString Buffer that can hold the read NULL terminated C string. +* \param[in] maxSize Maximum number of bytes that can be stored in pString (including the NULL char). +* \return SBG_NO_ERROR if the string has been read successfully from the stream buffer. +* SBG_BUFFER_OVERFLOW if the provided string isn't big enough to hold the read string +*/ +SBG_INLINE SbgErrorCode sbgStreamBufferReadStringLE(SbgStreamBuffer *pHandle, char *pString, size_t maxSize) +{ + size_t stringLength; + + assert(pHandle); + assert(pString); + assert(maxSize > 0); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // The C string are stored in a stream buffer with a 32 bit size length and then the buffer itself + // + stringLength = sbgStreamBufferReadSizeT32LE(pHandle); + + if (stringLength <= maxSize) + { + // + // Read the string buffer itself + // + sbgStreamBufferReadBuffer(pHandle, pString, stringLength); + } + else + { + pHandle->errorCode = SBG_BUFFER_OVERFLOW; + SBG_LOG_ERROR(pHandle->errorCode, "Trying to store a string of %zu bytes into a buffer of %zu bytes.", stringLength, maxSize); + } + } + + return pHandle->errorCode; +} + +/*! +* Write a NULL terminated C String into a stream buffer (Little Endian Version). +* +* \param[in] pHandle Valid stream buffer handle that supports write operations. +* \param[in] pString NULL terminated C String to write to the stream buffer. +* \return SBG_NO_ERROR if the string has been written successfully to the stream buffer. +*/ +SBG_INLINE SbgErrorCode sbgStreamBufferWriteStringLE(SbgStreamBuffer *pHandle, const char *pString) +{ + size_t stringLength; + + assert(pHandle); + assert(pString); + + // + // Test if we haven't already an error + // + if (pHandle->errorCode == SBG_NO_ERROR) + { + // + // We write C string using a 32 bit size_t as the string length including the NULL char + // We should thus make sure the provided string isn't too big to fit in a 32 bits size_t + // + stringLength = strlen(pString) + 1; + + if (stringLength <= UINT32_MAX) + { + // + // Write the string length + // + if (sbgStreamBufferWriteSizeT32LE(pHandle, stringLength) == SBG_NO_ERROR) + { + // + // Write the string buffer itself + // + sbgStreamBufferWriteBuffer(pHandle, pString, stringLength); + } + } + else + { + pHandle->errorCode = SBG_INVALID_PARAMETER; + SBG_LOG_ERROR(pHandle->errorCode, "The provided string is too big to fit in a 32 bit size_t"); + } + } + + return pHandle->errorCode; +} + +#endif /* SBG_STREAM_BUFFER_LE_H */ diff --git a/common/swap/sbgSwap.c b/common/swap/sbgSwap.c new file mode 100644 index 0000000..2ebbd5c --- /dev/null +++ b/common/swap/sbgSwap.c @@ -0,0 +1 @@ +#include "sbgSwap.h" diff --git a/common/swap/sbgSwap.h b/common/swap/sbgSwap.h new file mode 100644 index 0000000..1ae3c90 --- /dev/null +++ b/common/swap/sbgSwap.h @@ -0,0 +1,143 @@ +/*! + * \file sbgSwap.h + * \author SBG Systems (Raphael Siryani) + * \date 14 January 2013 + * + * \brief Set of functions used to swap numbers. + * + * \section CodeCopyright Copyright Notice + * The MIT license + * + * Copyright (C) 2007-2020, SBG Systems SAS. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef SBG_SWAP_H +#define SBG_SWAP_H + +//----------------------------------------------------------------------// +//- Header (open extern C block) -// +//----------------------------------------------------------------------// +#ifdef __cplusplus +extern "C" { +#endif + +#include + +//----------------------------------------------------------------------// +//- Internal swap functions -// +//----------------------------------------------------------------------// + +/*! + * Swap a uint16_t number. + * \param[in] x The uint16_t to swap. + * \return The swapped value. + */ +SBG_INLINE uint16_t sbgSwap16(uint16_t x) +{ + return ((x<<8)|(x>>8)); +} + +/*! + * Swap a uint32_t number. + * \param[in] x The uint32_t to swap. + * \return The swapped value. + */ +SBG_INLINE uint32_t sbgSwap32(uint32_t x) +{ + return ((x << 24) | ((x << 8) & (0xFF0000)) | ((x >> 8) & (0xFF00)) | (x >> 24)); +} + +/*! + * Swap a uint64_t number. + * \param[in] x The uint64_t to swap. + * \return The swapped value. + */ +SBG_INLINE uint64_t sbgSwap64(uint64_t x) +{ + uint32_t hi, lo; + + // + // Separate into high and low 32-bit values + // + lo = (uint32_t)(x&0xFFFFFFFF); + x >>= 32; + hi = (uint32_t)(x&0xFFFFFFFF); + + // + // Swap each part and rebuild our 64 bit vale + // + x = sbgSwap32(lo); + x <<= 32; + x |= sbgSwap32(hi); + + return x; +} + +/*! + * Swap a float number. + * \param[in] val The float to swap. + * \return The swapped value. + */ +SBG_INLINE float sbgSwapFloat(float val) +{ + FloatNint tmpFloat; + + // + // We use a union to do the type punning + // + tmpFloat.valF = val; + tmpFloat.valU = sbgSwap32(tmpFloat.valU); + + // + // Return the swapped float + // + return tmpFloat.valF; +} + +/*! + * Swap a double number. + * \param[in] val The double to swap. + * \return The swapped value. + */ +SBG_INLINE double sbgSwapDouble(double val) +{ + DoubleNint tmpDouble; + + // + // We use a union to do the type punning + // + tmpDouble.valF = val; + tmpDouble.valU = sbgSwap64(tmpDouble.valU); + + // + // Return the swapped double + // + return tmpDouble.valF; +} + +//----------------------------------------------------------------------// +//- Footer (close extern C block) -// +//----------------------------------------------------------------------// +#ifdef __cplusplus +} +#endif + +#endif /* SBG_SWAP_H */ diff --git a/common/version/sbgVersion.c b/common/version/sbgVersion.c new file mode 100644 index 0000000..29c2a85 --- /dev/null +++ b/common/version/sbgVersion.c @@ -0,0 +1,559 @@ +// sbgCommonLib headers +#include + +// Local headers +#include "sbgVersion.h" + +//----------------------------------------------------------------------// +//- Constructor -// +//----------------------------------------------------------------------// + +SBG_COMMON_LIB_API void sbgVersionCreateBasic(SbgVersion *pVersion, uint8_t major, uint8_t minor, uint8_t revision, uint8_t build) +{ + assert(pVersion); + assert(major < 128); + + pVersion->softwareScheme = false; + + pVersion->major = major; + pVersion->minor = minor; + pVersion->rev = revision; + pVersion->build = build; + + pVersion->qualifier = SBG_VERSION_QUALIFIER_DEV; +} + +SBG_COMMON_LIB_API void sbgVersionCreateSoftware(SbgVersion *pVersion, uint8_t major, uint8_t minor, uint16_t build, SbgVersionQualifier qualifier) +{ + assert(pVersion); + assert(major < 64); + assert(minor < 64); + + pVersion->softwareScheme = true; + + pVersion->major = major; + pVersion->minor = minor; + pVersion->build = build; + pVersion->qualifier = qualifier; + + pVersion->rev = 0; +} + +SBG_COMMON_LIB_API void sbgVersionConstructCopy(SbgVersion *pVersion, const SbgVersion *pOtherVersion) +{ + assert(pVersion); + assert(pOtherVersion); + + // + // Copy each member individually to avoid warnings about reading uninitialized bytes. + // + pVersion->softwareScheme = pOtherVersion->softwareScheme; + pVersion->qualifier = pOtherVersion->qualifier; + pVersion->major = pOtherVersion->major; + pVersion->minor = pOtherVersion->minor; + pVersion->rev = pOtherVersion->rev; + pVersion->build = pOtherVersion->build; +} + +//----------------------------------------------------------------------// +//- Version encoding / decoding methods -// +//----------------------------------------------------------------------// + +SBG_COMMON_LIB_API void sbgVersionDecode(uint32_t encodedVersion, SbgVersion *pVersionInfo) +{ + assert(pVersionInfo); + + // + // Test if we have a software version scheme + // + if (encodedVersion&SBG_VERSION_SOFT_SCHEME) + { + // + // We have a software scheme, decode it + // + pVersionInfo->softwareScheme = true; + + // + // Decode the software scheme fields + // + pVersionInfo->qualifier = (SbgVersionQualifier)((encodedVersion >> SBG_VERSION_SOFT_SCHEME_QUALIFIER_SHIFT) & SBG_VERSION_SOFT_SCHEME_QUALIFIER_MASK); + pVersionInfo->major = (encodedVersion >> SBG_VERSION_SOFT_SCHEME_MAJOR_SHIFT) & SBG_VERSION_SOFT_SCHEME_MAJOR_MASK; + pVersionInfo->minor = (encodedVersion >> SBG_VERSION_SOFT_SCHEME_MINOR_SHIFT) & SBG_VERSION_SOFT_SCHEME_MINOR_MASK; + pVersionInfo->build = (encodedVersion >> SBG_VERSION_SOFT_SCHEME_BUILD_SHIFT) & SBG_VERSION_SOFT_SCHEME_BUILD_MASK; + + // + // Set the revision to zero as it's not used + // + pVersionInfo->rev = 0; + } + else + { + // + // We have a basic scheme, decode it + // + pVersionInfo->softwareScheme = false; + + // + // Decode the software scheme fields + // + pVersionInfo->major = (encodedVersion >> 24) & 0xFF; + pVersionInfo->minor = (encodedVersion >> 16) & 0xFF; + pVersionInfo->rev = (encodedVersion >> 8) & 0xFF; + pVersionInfo->build = (encodedVersion >> 0) & 0xFF; + + // + // Set the qualifier to zero + // + pVersionInfo->qualifier = SBG_VERSION_QUALIFIER_DEV; + } +} + +SBG_COMMON_LIB_API uint32_t sbgVersionEncode(const SbgVersion *pVersionInfo) +{ + uint32_t encodedVersion = 0; + + assert(pVersionInfo); + + // + // Test if we have a software scheme or a basic one + // + if (pVersionInfo->softwareScheme) + { + // + // We have a software, scheme, so test that the version is valid + // + assert((pVersionInfo->major <= 63) && (pVersionInfo->minor <= 63) && (pVersionInfo->rev == 0)); + + // + // Indicate that we have a software version scheme + // + encodedVersion = SBG_VERSION_SOFTWARE(pVersionInfo->major, pVersionInfo->minor, pVersionInfo->build, pVersionInfo->qualifier); + } + else + { + // + // We have a basic version scheme so check parameter validity + // + assert(pVersionInfo->major <= 127); + + // + // Encode the basic version information + // + encodedVersion = SBG_VERSION_BASIC(pVersionInfo->major, pVersionInfo->minor, pVersionInfo->rev, pVersionInfo->build); + } + + return encodedVersion; +} + +//----------------------------------------------------------------------// +//- Version comparaison methods -// +//----------------------------------------------------------------------// + +SBG_COMMON_LIB_API int32_t sbgVersionCompare(const SbgVersion *pVersionA, const SbgVersion *pVersionB, SbgVersionCmpThreshold threshold) +{ + int32_t result; + + assert(pVersionA); + assert(pVersionB); + + // + // Check that the two versions are using the same scheme + // + assert(pVersionA->softwareScheme == pVersionB->softwareScheme); + + // + // Do the comparaison according to the selected threshold + // Start by compairing the major field + // + result = pVersionA->major - pVersionB->major; + + // + // Test if we have to also compare the minor field + // + if ( (result == 0) && ((threshold == SBG_VERSION_CMP_THRESHOLD_MINOR) || (threshold == SBG_VERSION_CMP_THRESHOLD_REVISION) || (threshold == SBG_VERSION_CMP_THRESHOLD_BUILD) || (threshold == SBG_VERSION_CMP_THRESHOLD_QUALIFIER)) ) + { + // + // Update the result using the minor indication + // + result = pVersionA->minor - pVersionB->minor; + + // + // Test if we have to also compare the revision field (for basic version only) + // + if ( (result == 0) && ((threshold == SBG_VERSION_CMP_THRESHOLD_REVISION) || (threshold == SBG_VERSION_CMP_THRESHOLD_BUILD) || (threshold == SBG_VERSION_CMP_THRESHOLD_QUALIFIER)) ) + { + // + // Test if we have a software scheme or a basic scheme version + // + if (pVersionA->softwareScheme) + { + // + // We have a software scheme so set the result to 0 + // + result = 0; + } + else + { + // + // We have a basic scheme so we can compare the revision field + // + result = pVersionA->rev - pVersionB->rev; + } + + // + // Test if we have to also compare the build field + // + if ( (result == 0) && ((threshold == SBG_VERSION_CMP_THRESHOLD_BUILD) || (threshold == SBG_VERSION_CMP_THRESHOLD_QUALIFIER)) ) + { + // + // Compare the build field + // + result = pVersionA->build - pVersionB->build; + + // + // Test if we have to also compare the qualifier field + // + if ( (result == 0) && (threshold == SBG_VERSION_CMP_THRESHOLD_QUALIFIER) ) + { + // + // Test if we have a software scheme + // + if (pVersionA->softwareScheme) + { + // + // We have a software scheme so set the result to 0 + // + result = pVersionA->qualifier - pVersionB->qualifier; + } + else + { + // + // We have a basic scheme so set the result to 0 + // + result = 0; + } + } + } + } + } + + return result; +} + +SBG_COMMON_LIB_API int32_t sbgVersionCompareEncoded(uint32_t versionA, uint32_t versionB, SbgVersionCmpThreshold threshold) +{ + SbgVersion versionAInfo; + SbgVersion versionBInfo; + + // + // Decode the versions + // + sbgVersionDecode(versionA, &versionAInfo); + sbgVersionDecode(versionB, &versionBInfo); + + // + // Do the comparaison + // + return sbgVersionCompare(&versionAInfo, &versionBInfo, threshold); +} + +SBG_COMMON_LIB_API int32_t sbgVersionIsWithinRange(const SbgVersion *pLowerVersion, const SbgVersion *pHigherVersion, const SbgVersion *pVersion) +{ + assert(pLowerVersion); + assert(pHigherVersion); + assert(pVersion); + + // + // Use the encoded version to speed up the comparaison + // + return sbgVersionIsWithinRangeEncoded(sbgVersionEncode(pLowerVersion), sbgVersionEncode(pHigherVersion), sbgVersionEncode(pVersion)); +} + +SBG_COMMON_LIB_API int32_t sbgVersionIsWithinRangeEncoded(uint32_t lowerVersion, uint32_t higherVersion, uint32_t version) +{ + // + // Make sure that all versions are using the same scheme + // + assert(lowerVersion <= higherVersion); + assert(( (sbgVersionIsUsingSoftwareScheme(lowerVersion) == sbgVersionIsUsingSoftwareScheme(higherVersion)) && + (sbgVersionIsUsingSoftwareScheme(lowerVersion) == sbgVersionIsUsingSoftwareScheme(version))) || + ( (sbgVersionIsUsingSoftwareScheme(lowerVersion) != sbgVersionIsUsingSoftwareScheme(higherVersion)) && + (sbgVersionIsUsingSoftwareScheme(lowerVersion) != sbgVersionIsUsingSoftwareScheme(version)))); + + // + // We can compare safely the encoded version directly + // + if (version < lowerVersion) + { + return -1; + } + else if (version > higherVersion) + { + return 1; + } + else + { + return 0; + } +} + +//----------------------------------------------------------------------// +//- Version to string methods -// +//----------------------------------------------------------------------// + +SBG_COMMON_LIB_API SbgErrorCode sbgVersionToString(const SbgVersion *pVersionInfo, char *pBuffer, size_t sizeOfBuffer) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + + assert(pVersionInfo); + assert(pBuffer); + assert(sizeOfBuffer>0); + + // + // Test if we have a basic or software version scheme + // + if (pVersionInfo->softwareScheme) + { + // + // We have a software version scheme + // Test that the buffer is big enough to store the generated string (31.31.65535-hotfix) + // + if (sizeOfBuffer >= 19) + { + // + // Generate the string version + // + sprintf(pBuffer, "%u.%u.%u-", pVersionInfo->major, pVersionInfo->minor, pVersionInfo->build); + + // + // Append the qualifier + // + switch (pVersionInfo->qualifier) + { + case SBG_VERSION_QUALIFIER_DEV: + strcat(pBuffer, "dev"); + break; + case SBG_VERSION_QUALIFIER_ALPHA: + strcat(pBuffer, "alpha"); + break; + case SBG_VERSION_QUALIFIER_BETA: + strcat(pBuffer, "beta"); + break; + case SBG_VERSION_QUALIFIER_RC: + strcat(pBuffer, "rc"); + break; + case SBG_VERSION_QUALIFIER_STABLE: + strcat(pBuffer, "stable"); + break; + case SBG_VERSION_QUALIFIER_HOT_FIX: + strcat(pBuffer, "hotfix"); + break; + default: + break; + } + } + else + { + // + // Output buffer is to small + // + errorCode = SBG_BUFFER_OVERFLOW; + } + + } + else + { + // + // We have a basic version scheme, generate the string + // Test that the buffer is big enough to store the generated string + // + if (sizeOfBuffer >= 16) + { + // + // Generate the string version + // + sprintf(pBuffer, "%u.%u.%u.%u", pVersionInfo->major, pVersionInfo->minor, pVersionInfo->rev, pVersionInfo->build); + } + else + { + // + // Output buffer is to small + // + errorCode = SBG_BUFFER_OVERFLOW; + } + } + + // + // Return status of operation + // + return errorCode; +} + +SBG_COMMON_LIB_API SbgErrorCode sbgVersionToStringEncoded(uint32_t version, char *pBuffer, size_t sizeOfBuffer) +{ + SbgVersion versionInfo; + + // + // Decode the versions + // + sbgVersionDecode(version, &versionInfo); + + // + // Return the version as a string + // + return sbgVersionToString(&versionInfo, pBuffer, sizeOfBuffer); +} + +//----------------------------------------------------------------------// +//- String to version methods -// +//----------------------------------------------------------------------// + +SBG_COMMON_LIB_API SbgErrorCode sbgVersionFromString(const char *pVersionStr, SbgVersion *pVersionInfo) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + char qualifierStr[32]; + unsigned int major; + unsigned int minor; + unsigned int rev; + unsigned int build; + + assert(pVersionStr); + assert(pVersionInfo); + + // + // Zero init the returned version struct + // + memset(pVersionInfo, 0x00, sizeof(SbgVersion)); + + // + // Try to parse a basic version + // + if (sscanf(pVersionStr, "%u.%u.%u.%u", &major, &minor, &rev, &build) == 4) + { + // + // We have read successfully a basic version + // + pVersionInfo->softwareScheme = false; + + // + // Fill the version numbers + // + pVersionInfo->major = (uint8_t)major; + pVersionInfo->minor = (uint8_t)minor; + pVersionInfo->rev = (uint8_t)rev; + pVersionInfo->build = (uint8_t)build; + } + else if (sscanf(pVersionStr, "%u.%u.%u-%s", &major, &minor, &build, qualifierStr) == 4) + { + // + // We have read successfully a software scheme version + // + pVersionInfo->softwareScheme = true; + + // + // Fill the version numbers + // + pVersionInfo->major = (uint8_t)major; + pVersionInfo->minor = (uint8_t)minor; + pVersionInfo->build = (uint16_t)build; + + // + // Also convert the qualifier + // + if (!strcmp(qualifierStr, "dev")) + { + // + // Dev qualifier + // + pVersionInfo->qualifier = SBG_VERSION_QUALIFIER_DEV; + } + else if (!strcmp(qualifierStr, "alpha")) + { + // + // Alpha qualifier + // + pVersionInfo->qualifier = SBG_VERSION_QUALIFIER_ALPHA; + } + else if (!strcmp(qualifierStr, "beta")) + { + // + // Beta qualifier + // + pVersionInfo->qualifier = SBG_VERSION_QUALIFIER_BETA; + } + else if (!strcmp(qualifierStr, "rc")) + { + // + // Release Candidate qualifier + // + pVersionInfo->qualifier = SBG_VERSION_QUALIFIER_RC; + } + else if (!strcmp(qualifierStr, "stable")) + { + // + // Stable qualifier + // + pVersionInfo->qualifier = SBG_VERSION_QUALIFIER_STABLE; + } + else if (!strcmp(qualifierStr, "hotfix")) + { + // + // Hot Fix qualifier + // + pVersionInfo->qualifier = SBG_VERSION_QUALIFIER_HOT_FIX; + } + else + { + // + // Unknown qualifier + // + errorCode = SBG_INVALID_PARAMETER; + } + } + else + { + // + // Invalid format + // + errorCode = SBG_INVALID_PARAMETER; + } + + return errorCode; +} + +SBG_COMMON_LIB_API SbgErrorCode sbgVersionFromStringEncoded(const char *pVersionStr, uint32_t *pVersion) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgVersion versionInfo; + + assert(pVersionStr); + assert(pVersion); + + // + // Parse the version from a string + // + errorCode = sbgVersionFromString(pVersionStr, &versionInfo); + + // + // Test that no error has occurred + // + if (errorCode == SBG_NO_ERROR) + { + // + // Encode the version and return it + // + *pVersion = sbgVersionEncode(&versionInfo); + } + else + { + // + // An error has occurred so return a zero version + // + *pVersion = 0; + } + + // + // Return error + // + return errorCode; +} diff --git a/common/version/sbgVersion.h b/common/version/sbgVersion.h new file mode 100644 index 0000000..80ededa --- /dev/null +++ b/common/version/sbgVersion.h @@ -0,0 +1,467 @@ +/*! + * \file sbgVersion.h + * \author SBG Systems (Raphael Siryani) + * \date 23 April 2015 + * + * \brief Helper methods and definitions used to handle version. + * + * Version information is stored within a single uint32_t. + * There are two different versions schemes to better handle software revisions and file format / hardware ones. + * + * Software version are only used for firmware and software. + * This versions is defined as a ..- for example: 1.3.1845-RC + * Major and Minor can range from 0 to 63. + * Build is an uint16_t ranging from 0 to 65535. + * Qualifier is an enum encoded on 3 bits. + * + * Basic version is used for hardware or file formats and is the legacy one for software. + * This versions is defined as a ... + * Each element is stored in an uint8_t. + * The Major version should NEVER go above 31 + * + * \section CodeCopyright Copyright Notice + * The MIT license + * + * Copyright (C) 2007-2020, SBG Systems SAS. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef SBG_VERSION_H +#define SBG_VERSION_H + +//----------------------------------------------------------------------// +//- Header (open extern C block) -// +//----------------------------------------------------------------------// +#ifdef __cplusplus +extern "C" { +#endif + +// sbgCommonLib headers +#include + +//----------------------------------------------------------------------// +//- Version related definitions -// +//----------------------------------------------------------------------// +#define SBG_VERSION_SOFT_SCHEME (0x00000001u << 31) /*!< Set to 1 to indicate a version number that uses the software scheme. Set to 0 means a basic version scheme. */ + +#define SBG_VERSION_SOFT_SCHEME_QUALIFIER_MASK (0x07) /*!< Mask used to keep only the version qualifier enum. */ +#define SBG_VERSION_SOFT_SCHEME_QUALIFIER_SHIFT (28) /*!< Bitshift to apply to get the qualifier enum. */ + +#define SBG_VERSION_SOFT_SCHEME_MAJOR_MASK (0x3F) /*!< Mask used to keep only the major version field. */ +#define SBG_VERSION_SOFT_SCHEME_MAJOR_SHIFT (22) /*!< Bitshift used to get the major version field. */ + +#define SBG_VERSION_SOFT_SCHEME_MINOR_MASK (0x3F) /*!< Mask used to keep only the minor version field. */ +#define SBG_VERSION_SOFT_SCHEME_MINOR_SHIFT (16) /*!< Bitshift used to get the minor version field. */ + +#define SBG_VERSION_SOFT_SCHEME_BUILD_MASK (0xFFFF) /*!< Mask used to keep only the build version field. */ +#define SBG_VERSION_SOFT_SCHEME_BUILD_SHIFT (0) /*!< Bitshift used to get the build version field. */ + +/*! + * Version qualifier enum definition. + * This enum is used to identify if we have a basic version scheme or a software one. + * If it's a software one, we can easly know if the software version is a beta, a stable one. + */ +typedef enum _SbgVersionQualifier +{ + SBG_VERSION_QUALIFIER_DEV = 0, /*!< Development only version or pre-alpha. Customer shouldn't get this version qualifier. */ + SBG_VERSION_QUALIFIER_ALPHA = 1, /*!< Alpha version, missing features, can be unstable and could cause crashes or data loss. API can still change. */ + SBG_VERSION_QUALIFIER_BETA = 2, /*!< Beta version, features are freezed, can be unstable and could cause crashes or data loss. API shouldn't change. */ + SBG_VERSION_QUALIFIER_RC = 3, /*!< Release Candidate, features are freezed, with no known bug. API is freezed. */ + SBG_VERSION_QUALIFIER_STABLE = 4, /*!< Stable release, the version is the standard delivered one. */ + SBG_VERSION_QUALIFIER_HOT_FIX = 5 /*!< Hot fixes were applied on a stable release. It should be bug fixes. This qualifier is temporary as the version should return to stable release as soon as the test procedure has been performed. */ +} SbgVersionQualifier; + +/*! + * Version qualifier enum definition. + * This enum is used to identify if we have a basic version scheme or a software one. + * If it's a software one, we can easily know if the software version is a beta, a stable one. + */ +typedef enum _SbgVersionCmpThreshold +{ + SBG_VERSION_CMP_THRESHOLD_MAJOR = 0, /*!< Compare only the major field. */ + SBG_VERSION_CMP_THRESHOLD_MINOR = 1, /*!< Compare the major and minor fields. */ + SBG_VERSION_CMP_THRESHOLD_REVISION = 2, /*!< Compare the major, minor and revision fields (only for basic versions). */ + SBG_VERSION_CMP_THRESHOLD_BUILD = 3, /*!< Compare the major, minor, revision and build fields. */ + SBG_VERSION_CMP_THRESHOLD_QUALIFIER = 4 /*!< Compare the major, minor, revision, build and qualifier fields (only for software scheme). */ +} SbgVersionCmpThreshold; + +/* + * DEPRECATED compatibility definitions + */ +#define SBG_VERSION_CMP_THRESOLD_MAJOR SBG_VERSION_CMP_THRESHOLD_MAJOR +#define SBG_VERSION_CMP_THRESOLD_MINOR SBG_VERSION_CMP_THRESHOLD_MINOR +#define SBG_VERSION_CMP_THRESOLD_REVISION SBG_VERSION_CMP_THRESHOLD_REVISION +#define SBG_VERSION_CMP_THRESOLD_BUILD SBG_VERSION_CMP_THRESHOLD_BUILD +#define SBG_VERSION_CMP_THRESOLD_QUALIFIER SBG_VERSION_CMP_THRESHOLD_QUALIFIER + +/*! + * This structure contains all the fields provided by a version number. + * It handles both basic and software version numbers. + */ +typedef struct _SbgVersion +{ + bool softwareScheme; /*!< Set to true if it's a software scheme or false if it's a basic one. */ + SbgVersionQualifier qualifier; /*!< Qualifier of the current version */ + uint8_t major; /*!< Major version */ + uint8_t minor; /*!< Minor version */ + uint8_t rev; /*!< Revision number - left to 0 in case of software version */ + uint16_t build; /*!< Build number */ +} SbgVersion; + +//----------------------------------------------------------------------// +//- Macro definitions for encode versions -// +//----------------------------------------------------------------------// + +/*! + * Compile a version number using the basic scheme based on major, minor, revision and build information + * \param[in] maj The major version between 0 to 127. + * \param[in] min The minor version between 0 to 255. + * \param[in] rev The revision version between 0 to 255. + * \param[in] build The build number between 0 to 255. + * \return The encoded version number. + */ +#define SBG_VERSION_BASIC(major, minor, rev, build) ( (((uint32_t)(major)) << 24) | \ + (((uint32_t)(minor)) << 16) | \ + (((uint32_t)(rev)) << 8) | \ + (((uint32_t)(build))) ) + +/*! + * Compile a version number using the software scheme based on major, minor, build, qualifier. + * \param[in] major The major version between 0 to 63. + * \param[in] minor The minor version between 0 to 63. + * \param[in] build The build version between 0 to 65535. + * \param[in] qualifier The version qualifier within the SbgVersionQualifier enum. + * \return The encoded version number. + */ +#define SBG_VERSION_SOFTWARE(major, minor, build, qualifier) ( SBG_VERSION_SOFT_SCHEME | \ + ((((uint32_t)(qualifier)) & SBG_VERSION_SOFT_SCHEME_QUALIFIER_MASK) << SBG_VERSION_SOFT_SCHEME_QUALIFIER_SHIFT) | \ + ((((uint32_t)(major)) & SBG_VERSION_SOFT_SCHEME_MAJOR_MASK) << SBG_VERSION_SOFT_SCHEME_MAJOR_SHIFT) | \ + ((((uint32_t)(minor)) & SBG_VERSION_SOFT_SCHEME_MINOR_MASK) << SBG_VERSION_SOFT_SCHEME_MINOR_SHIFT) | \ + ((((uint32_t)(build)) & SBG_VERSION_SOFT_SCHEME_BUILD_MASK) << SBG_VERSION_SOFT_SCHEME_BUILD_SHIFT) ) +//----------------------------------------------------------------------// +//- Constructor -// +//----------------------------------------------------------------------// + +/*! + * Create a basic scheme version given the components major.minor.rev.build + * + * \param[out] pVersion Version instance + * \param[in] major The major component between 0 to 127 + * \param[in] minor The minor component between 0 to 255 + * \param[in] revision The revision component between 0 to 255 + * \param[in] build The build component between 0 to 255 + */ +SBG_COMMON_LIB_API void sbgVersionCreateBasic(SbgVersion *pVersion, uint8_t major, uint8_t minor, uint8_t revision, uint8_t build); + +/*! + * Create a software scheme version given the components major.minor.build.qualifier + * + * \param[out] pVersion Version instance + * \param[in] major The major component between 0 to 63 + * \param[in] minor The minor component between 0 to 63 + * \param[in] build The build component between 0 to 65535 + * \param[in] qualifier The version qualifier enum value. + */ +SBG_COMMON_LIB_API void sbgVersionCreateSoftware(SbgVersion *pVersion, uint8_t major, uint8_t minor, uint16_t build, SbgVersionQualifier qualifier); + +/*! + * Version copy constructor. + * + * \param[in] pVersion Version. + * \param[in] pOtherVersion Version to copy from. + */ +SBG_COMMON_LIB_API void sbgVersionConstructCopy(SbgVersion *pVersion, const SbgVersion *pOtherVersion); + +//----------------------------------------------------------------------// +//- Version encoding / decoding methods -// +//----------------------------------------------------------------------// + +/*! + * Fill a SbgVersion structure based on an uint32_t that stores the 'compiled' version information. + * \param[in] encodedVersion The version information stored within a uint32_t. + * \param[out] pVersionInfo Pointer on an allocated SbgVersion structure to fill. + */ +SBG_COMMON_LIB_API void sbgVersionDecode(uint32_t encodedVersion, SbgVersion *pVersionInfo); + +/*! + * Construct a uint32_t containing a version information based on a SbgVersion structure. + * \param[in] pVersionInfo Pointer on a read only version structure to encode. + * \return The encoded version information on an uint32_t or 0 if an error has occurred. + */ +SBG_COMMON_LIB_API uint32_t sbgVersionEncode(const SbgVersion *pVersionInfo); + +//----------------------------------------------------------------------// +//- Version parameters methods -// +//----------------------------------------------------------------------// + +/*! + * Returns true if this encoded version number is using a software scheme. + * \param[in] encodedVersion The encoded version number to test stored in a uint32_t. + * \return true if the version number is using a software scheme. + */ +SBG_INLINE bool sbgVersionIsUsingSoftwareScheme(uint32_t encodedVersion) +{ + SbgVersion decodedVersion; + + // + // Decode the version first + // + sbgVersionDecode(encodedVersion, &decodedVersion); + + // + // Returns if the version is using a software scheme + // + return decodedVersion.softwareScheme; +} + +//----------------------------------------------------------------------// +//- Version comparaison methods -// +//----------------------------------------------------------------------// + +/*! + * Compare two version information structures and return if the version A is greater, less or equal than the version B. + * + * The computation is roughly result = version A - version B + * We can define how far we will check if the version A is greater than the version B. + * For example, we can only check the major or major and minor fields. + * + * \param[in] pVersionA The first version to compare. + * \param[in] pVersionB The second version to compare. + * \param[in] threshold The comparaison threshold to know if we are checking the major, minor, revision, build, ... + * \return A positive value if the version A is greater than B, a negative one if version A is less than B and 0 if the two versions are the same (according to the threshold). + */ +SBG_COMMON_LIB_API int32_t sbgVersionCompare(const SbgVersion *pVersionA, const SbgVersion *pVersionB, SbgVersionCmpThreshold threshold); + +/*! + * Compare two encoded versions and return if the version A is greater, less or equal than the version B. + * + * The computation is roughly result = version A - version B + * We can define how far we will check if the version A is greater than the version B. + * For example, we can only check the major or major and minor fields. + * + * \param[in] versionA The first compiled version to compare. + * \param[in] versionB The second compiled version to compare. + * \param[in] threshold The comparaison threshold to know if we are checking the major, minor, revision, build, ... + * \return A positive value if the version A is greater than B, a negative one if version A is less than B and 0 if the two versions are the same (according to the threshold). + */ +SBG_COMMON_LIB_API int32_t sbgVersionCompareEncoded(uint32_t versionA, uint32_t versionB, SbgVersionCmpThreshold threshold); + +/*! + * Check if the provided version is between the provided version interval. + * All versions should have the same scheme. + * + * \param[in] pLowerVersion The lower version bound of the interval. + * \param[in] pHigherVersion The hiver version bound of the interval. + * \param[in] pVersion The version to check. + * \return A negative value if the version is stricly below the lower version bound + * Zero if the version if equal or greater than lower version and equal or smaller than higer version + * A positive value if the version is strictly above the higher version bound + */ +SBG_COMMON_LIB_API int32_t sbgVersionIsWithinRange(const SbgVersion *pLowerVersion, const SbgVersion *pHigherVersion, const SbgVersion *pVersion); + +/*! + * Check if the provided encoded version is between the provided version interval. + * All versions should have the same scheme. + * + * \param[in] lowerVersion The lower version bound of the interval. + * \param[in] higherVersion The hiver version bound of the interval. + * \param[in] version The version to check. + * \return A negative value if the version is stricly below the lower version bound + * Zero if the version if equal or greater than lower version and equal or smaller than higer version + * A positive value if the version is strictly above the higher version bound + */ +SBG_COMMON_LIB_API int32_t sbgVersionIsWithinRangeEncoded(uint32_t lowerVersion, uint32_t higherVersion, uint32_t version); + + +//----------------------------------------------------------------------// +//- Version to string methods -// +//----------------------------------------------------------------------// + +/*! + * Convert a version information to a human readable string. + * \param[in] pVersionInfo Pointer on a read only version structure to convert to a human readable string. + * \param[out] pBuffer Buffer to store the version as a human readable null terminated string. + * \param[in] sizeOfBuffer Maximum buffer size including the null terminated char. + * \return SBG_NO_ERROR if the version information has been converted to a string. + * SBG_BUFFER_OVERFLOW is the buffer isn't big enough to store the converted version string. + */ +SBG_COMMON_LIB_API SbgErrorCode sbgVersionToString(const SbgVersion *pVersionInfo, char *pBuffer, size_t sizeOfBuffer); + +/*! + * Convert an encoded version number to a human readable string. + * \param[in] version Encoded version value to to convert to a human readable string. + * \param[out] pBuffer Buffer to store the version as a human readable null terminated string. + * \param[in] sizeOfBuffer Maximum buffer size including the null terminated char. + * \return SBG_NO_ERROR if the version information has been converted to a string. + * SBG_BUFFER_OVERFLOW is the buffer isn't big enough to store the converted version string. + */ +SBG_COMMON_LIB_API SbgErrorCode sbgVersionToStringEncoded(uint32_t version, char *pBuffer, size_t sizeOfBuffer); + +//----------------------------------------------------------------------// +//- String to version methods -// +//----------------------------------------------------------------------// + +/*! + * Convert a human readable string to a version structure. + * \param[in] pVersionStr The string containing the version to convert. + * \param[out] pVersionInfo Pointer to a version structure to store the parsed version info. + * \return SBG_NO_ERROR if the version information has been converted from a string. + */ +SBG_COMMON_LIB_API SbgErrorCode sbgVersionFromString(const char *pVersionStr, SbgVersion *pVersionInfo); + +/*! + * Convert an encoded version number to a human readable string. + * \param[in] pVersionStr The string containing the version to convert. + * \param[out] pVersion Returned encoded version value parsed from the string. + * \return SBG_NO_ERROR if the version information has been converted from a string. + */ +SBG_COMMON_LIB_API SbgErrorCode sbgVersionFromStringEncoded(const char *pVersionStr, uint32_t *pVersion); + +//----------------------------------------------------------------------// +//- Legacy version system methods -// +//----------------------------------------------------------------------// + +/*! + * Define all these methods as deprecated. + */ +SBG_DEPRECATED(SBG_INLINE uint32_t SBG_VERSION(uint8_t major, uint8_t minor, uint8_t rev, uint8_t build)); +SBG_DEPRECATED(SBG_INLINE uint8_t SBG_VERSION_GET_MAJOR(uint32_t encodedVersion)); +SBG_DEPRECATED(SBG_INLINE uint8_t SBG_VERSION_GET_MINOR(uint32_t encodedVersion)); +SBG_DEPRECATED(SBG_INLINE uint8_t SBG_VERSION_GET_REV(uint32_t encodedVersion)); +SBG_DEPRECATED(SBG_INLINE uint8_t SBG_VERSION_GET_BUILD(uint32_t encodedVersion)); + +/*! + * DEPRECATED macro, please update your code + * + * Compile a version number using the basic scheme based on major, minor, revision and build information + * + * \param[in] maj The major version between 0 to 127. + * \param[in] min The minor version between 0 to 255. + * \param[in] rev The revision version between 0 to 255. + * \param[in] build The build number between 0 to 255. + * \return The encoded version number. + */ +SBG_INLINE uint32_t SBG_VERSION(uint8_t major, uint8_t minor, uint8_t rev, uint8_t build) +{ + // + // The SBG_VERSION macro is the basic version scheme. + // + return SBG_VERSION_BASIC(major, minor, rev, build); +} + +/*! + * DEPRECATED method, please update your code. + * + * Extract a basic version scheme using legacy methods. + * + * \param[in] encodedVersion The encoded version to extract the major version. + * \return The major version. + */ +SBG_INLINE uint8_t SBG_VERSION_GET_MAJOR(uint32_t encodedVersion) +{ + SbgVersion versionInfo; + + // + // Decode the version information + // + sbgVersionDecode(encodedVersion, &versionInfo); + + // + // Return the major version + // + return versionInfo.major; +} + +/*! + * DEPRECATED method, please update your code. + * + * Extract a basic version scheme using legacy methods. + * + * \param[in] encodedVersion The encoded version to extract the major version. + * \return The major version. + */ +SBG_INLINE uint8_t SBG_VERSION_GET_MINOR(uint32_t encodedVersion) +{ + SbgVersion versionInfo; + + // + // Decode the version information + // + sbgVersionDecode(encodedVersion, &versionInfo); + + // + // Return the major version + // + return versionInfo.minor; +} + +/*! + * DEPRECATED method, please update your code. + * + * Extract a basic version scheme using legacy methods. + * + * \param[in] encodedVersion The encoded version to extract the major version. + * \return The major version. + */ +SBG_INLINE uint8_t SBG_VERSION_GET_REV(uint32_t encodedVersion) +{ + SbgVersion versionInfo; + + // + // Decode the version information + // + sbgVersionDecode(encodedVersion, &versionInfo); + + // + // Return the major version + // + return versionInfo.rev; +} + +/*! + * DEPRECATED method, please update your code. + * + * Extract a basic version scheme using legacy methods + * + * \param[in] encodedVersion The encoded version to extract the major version. + * \return The major version. + */ +SBG_INLINE uint8_t SBG_VERSION_GET_BUILD(uint32_t encodedVersion) +{ + SbgVersion versionInfo; + + // + // Decode the version information + // + sbgVersionDecode(encodedVersion, &versionInfo); + + // + // Return the major version + // + return (uint8_t)versionInfo.build; +} + +//----------------------------------------------------------------------// +//- Footer (close extern C block) -// +//----------------------------------------------------------------------// +#ifdef __cplusplus +} +#endif + +#endif /* SBG_VERSION_H */ diff --git a/doc/html/annotated.html b/doc/html/annotated.html new file mode 100644 index 0000000..deaa500 --- /dev/null +++ b/doc/html/annotated.html @@ -0,0 +1,104 @@ + + + + + + + +sbgECom: Data Structures + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+
Data Structures
+
+ + + + + diff --git a/doc/html/bc_s.png b/doc/html/bc_s.png new file mode 100644 index 0000000..224b29a Binary files /dev/null and b/doc/html/bc_s.png differ diff --git a/doc/html/bdwn.png b/doc/html/bdwn.png new file mode 100644 index 0000000..940a0b9 Binary files /dev/null and b/doc/html/bdwn.png differ diff --git a/doc/html/classes.html b/doc/html/classes.html new file mode 100644 index 0000000..a124c33 --- /dev/null +++ b/doc/html/classes.html @@ -0,0 +1,57 @@ + + + + + + + +sbgECom: Data Structure Index + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+
Data Structure Index
+
+ + + + + diff --git a/doc/html/closed.png b/doc/html/closed.png new file mode 100644 index 0000000..98cc2c9 Binary files /dev/null and b/doc/html/closed.png differ diff --git a/doc/html/dir_5903c71b979204ea1ce2d27420efeaa9.html b/doc/html/dir_5903c71b979204ea1ce2d27420efeaa9.html new file mode 100644 index 0000000..bfe6249 --- /dev/null +++ b/doc/html/dir_5903c71b979204ea1ce2d27420efeaa9.html @@ -0,0 +1,62 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/protocol Directory Reference + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + + +
+
+
protocol Directory Reference
+
+
+ + + + + +

+Files

file  sbgEComProtocol.h [code]
 Implementation of the sbgECom binary communication protocol.
 
+
+ + + + diff --git a/doc/html/dir_59d128fb766534d0ff9e97832ccaaa5c.html b/doc/html/dir_59d128fb766534d0ff9e97832ccaaa5c.html new file mode 100644 index 0000000..b991819 --- /dev/null +++ b/doc/html/dir_59d128fb766534d0ff9e97832ccaaa5c.html @@ -0,0 +1,62 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/transfer Directory Reference + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + + +
+
+
transfer Directory Reference
+
+
+ + + + + +

+Files

file  sbgEComTransfer.h [code]
 Handle large send/receive transfer for specific ECom Protocol commands.
 
+
+ + + + diff --git a/doc/html/dir_5e80d29b61c444378a543be4dd1414df.html b/doc/html/dir_5e80d29b61c444378a543be4dd1414df.html new file mode 100644 index 0000000..bfac185 --- /dev/null +++ b/doc/html/dir_5e80d29b61c444378a543be4dd1414df.html @@ -0,0 +1,113 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands Directory Reference + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + + +
+
+
commands Directory Reference
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Files

file  sbgEComCmd.h [code]
 Include all available sbgECom commands.
 
file  sbgEComCmdAdvanced.h [code]
 Advanced settings related commands.
 
file  sbgEComCmdAirData.h [code]
 AirData aiding module configuration commands.
 
file  sbgEComCmdApi.h [code]
 REST API related commands.
 
file  sbgEComCmdCommon.h [code]
 Definitions and methods common to all commands.
 
file  sbgEComCmdDvl.h [code]
 DVL (Doppler Velocity Logger) aiding module configuration commands.
 
file  sbgEComCmdEthernet.h [code]
 Ethernet configuration related commands.
 
file  sbgEComCmdEvent.h [code]
 Input/output event markers configuration commands.
 
file  sbgEComCmdFeatures.h [code]
 Commands used to query supported device features.
 
file  sbgEComCmdGnss.h [code]
 GNSS aiding module configuration commands.
 
file  sbgEComCmdInfo.h [code]
 Commands used to query the device information.
 
file  sbgEComCmdInterface.h [code]
 Commands used to configure device serial, CAN and Ethernet interfaces.
 
file  sbgEComCmdLicense.h [code]
 Command used to upload and apply an activation license.
 
file  sbgEComCmdMag.h [code]
 Magnetometer aiding module configuration & onboard magnetic calibration commands.
 
file  sbgEComCmdOdo.h [code]
 Odometer / DMI aiding module configuration commands.
 
file  sbgEComCmdOutput.h [code]
 Commands used to setup logs to output over the device interfaces.
 
file  sbgEComCmdSensor.h [code]
 Motion profile, aiding assignement & sensor installation commands.
 
file  sbgEComCmdSettings.h [code]
 Import/export/save settings commands.
 
+
+ + + + diff --git a/doc/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html b/doc/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html new file mode 100644 index 0000000..43e520f --- /dev/null +++ b/doc/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html @@ -0,0 +1,88 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src Directory Reference + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + + +
+
+
src Directory Reference
+
+
+ + + + + + + + + + +

+Directories

directory  binaryLogs
 
directory  commands
 
directory  protocol
 
directory  transfer
 
+ + + + + + + + + + + + + + + + + + + +

+Files

file  sbgECanId.h [code]
 Defines all sbgECom commands identifiers.
 
file  sbgECom.h [code]
 Contains main sbgECom methods.
 
file  sbgEComGetVersion.h [code]
 Version information.
 
file  sbgEComIds.h [code]
 Defines all sbgECom commands identifiers.
 
file  sbgEComLib.h [code]
 Main header file for the SBG Systems Enhanced Communication Library.
 
file  sbgEComVersion.h [code]
 Header file that contains all versions related information such as change log.
 
+
+ + + + diff --git a/doc/html/dir_ca88af47f35d3caa830e81530084c4b9.html b/doc/html/dir_ca88af47f35d3caa830e81530084c4b9.html new file mode 100644 index 0000000..84989df --- /dev/null +++ b/doc/html/dir_ca88af47f35d3caa830e81530084c4b9.html @@ -0,0 +1,113 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs Directory Reference + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + + +
+
+
binaryLogs Directory Reference
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Files

file  sbgEComBinaryLogAirData.h [code]
 Parse received air data measurement logs such as barometer data.
 
file  sbgEComBinaryLogAutomotiveData.h [code]
 Parse dedicated automotive measurements logs.
 
file  sbgEComBinaryLogDepth.h [code]
 Parse received subsea depth measurement logs.
 
file  sbgEComBinaryLogDiag.h [code]
 Parse diagnostic logs emitted by the device.
 
file  sbgEComBinaryLogDvl.h [code]
 Parse received DVL (Doppler Velocity Logger) measurement logs.
 
file  sbgEComBinaryLogEkf.h [code]
 Parse EKF measurements such as attitude, position and velocity logs.
 
file  sbgEComBinaryLogEvent.h [code]
 Parse event markers logs used to timestamp external signals.
 
file  sbgEComBinaryLogGps.h [code]
 Parse received GNSS logs such as Position, Velocity and True Heading.
 
file  sbgEComBinaryLogImu.h [code]
 Parse IMU (Inertial Measurement Unit) measurement logs.
 
file  sbgEComBinaryLogMag.h [code]
 Parse magnetic field measurements logs.
 
file  sbgEComBinaryLogOdometer.h [code]
 Parse recevied odometer/DMI velocity measurement logs.
 
file  sbgEComBinaryLogRawData.h [code]
 Parse logs used to store a binary stream such as RAW GNSS data.
 
file  sbgEComBinaryLogRtcm.h [code]
 Parse RTCM data stream logs as received by the INS.
 
file  sbgEComBinaryLogs.h [code]
 Parse incoming sbgECom logs and store result in an union.
 
file  sbgEComBinaryLogShipMotion.h [code]
 Parse logs that returns ship motion values such as heave.
 
file  sbgEComBinaryLogStatus.h [code]
 Parse logs used to report device status.
 
file  sbgEComBinaryLogUsbl.h [code]
 Parse received USBL position mesurements logs.
 
file  sbgEComBinaryLogUtc.h [code]
 Parse logs used to report device UTC time.
 
+
+ + + + diff --git a/doc/html/doc.png b/doc/html/doc.png new file mode 100644 index 0000000..17edabf Binary files /dev/null and b/doc/html/doc.png differ diff --git a/doc/html/doxygen.css b/doc/html/doxygen.css new file mode 100644 index 0000000..9036737 --- /dev/null +++ b/doc/html/doxygen.css @@ -0,0 +1,1841 @@ +/* The standard CSS for doxygen 1.9.3 */ + +body, table, div, p, dl { + font: 400 14px/22px Roboto,sans-serif; +} + +p.reference, p.definition { + font: 400 14px/22px Roboto,sans-serif; +} + +/* @group Heading Levels */ + +h1.groupheader { + font-size: 150%; +} + +.title { + font: 400 14px/28px Roboto,sans-serif; + font-size: 150%; + font-weight: bold; + margin: 10px 2px; +} + +h2.groupheader { + border-bottom: 1px solid #879ECB; + color: #354C7B; + font-size: 150%; + font-weight: normal; + margin-top: 1.75em; + padding-top: 8px; + padding-bottom: 4px; + width: 100%; +} + +h3.groupheader { + font-size: 100%; +} + +h1, h2, h3, h4, h5, h6 { + -webkit-transition: text-shadow 0.5s linear; + -moz-transition: text-shadow 0.5s linear; + -ms-transition: text-shadow 0.5s linear; + -o-transition: text-shadow 0.5s linear; + transition: text-shadow 0.5s linear; + margin-right: 15px; +} + +h1.glow, h2.glow, h3.glow, h4.glow, h5.glow, h6.glow { + text-shadow: 0 0 15px cyan; +} + +dt { + font-weight: bold; +} + +ul.multicol { + -moz-column-gap: 1em; + -webkit-column-gap: 1em; + column-gap: 1em; + -moz-column-count: 3; + -webkit-column-count: 3; + column-count: 3; +} + +p.startli, p.startdd { + margin-top: 2px; +} + +th p.starttd, th p.intertd, th p.endtd { + font-size: 100%; + font-weight: 700; +} + +p.starttd { + margin-top: 0px; +} + +p.endli { + margin-bottom: 0px; +} + +p.enddd { + margin-bottom: 4px; +} + +p.endtd { + margin-bottom: 2px; +} + +p.interli { +} + +p.interdd { +} + +p.intertd { +} + +/* @end */ + +caption { + font-weight: bold; +} + +span.legend { + font-size: 70%; + text-align: center; +} + +h3.version { + font-size: 90%; + text-align: center; +} + +div.navtab { + border-right: 1px solid #A3B4D7; + padding-right: 15px; + text-align: right; + line-height: 110%; +} + +div.navtab table { + border-spacing: 0; +} + +td.navtab { + padding-right: 6px; + padding-left: 6px; +} +td.navtabHL { + background-image: url('tab_a.png'); + background-repeat:repeat-x; + padding-right: 6px; + padding-left: 6px; +} + +td.navtabHL a, td.navtabHL a:visited { + color: #fff; + text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); +} + +a.navtab { + font-weight: bold; +} + +div.qindex{ + text-align: center; + width: 100%; + line-height: 140%; + font-size: 130%; + color: #A0A0A0; +} + +dt.alphachar{ + font-size: 180%; + font-weight: bold; +} + +.alphachar a{ + color: black; +} + +.alphachar a:hover, .alphachar a:visited{ + text-decoration: none; +} + +.classindex dl { + padding: 25px; + column-count:1 +} + +.classindex dd { + display:inline-block; + margin-left: 50px; + width: 90%; + line-height: 1.15em; +} + +.classindex dl.odd { + background-color: #F8F9FC; +} + +@media(min-width: 1120px) { + .classindex dl { + column-count:2 + } +} + +@media(min-width: 1320px) { + .classindex dl { + column-count:3 + } +} + + +/* @group Link Styling */ + +a { + color: #3D578C; + font-weight: normal; + text-decoration: none; +} + +.contents a:visited { + color: #4665A2; +} + +a:hover { + text-decoration: underline; +} + +.contents a.qindexHL:visited { + color: #FFFFFF; +} + +a.el { + font-weight: bold; +} + +a.elRef { +} + +a.code, a.code:visited, a.line, a.line:visited { + color: #4665A2; +} + +a.codeRef, a.codeRef:visited, a.lineRef, a.lineRef:visited { + color: #4665A2; +} + +a.code.hl_class { /* style for links to class names in code snippets */ } +a.code.hl_struct { /* style for links to struct names in code snippets */ } +a.code.hl_union { /* style for links to union names in code snippets */ } +a.code.hl_interface { /* style for links to interface names in code snippets */ } +a.code.hl_protocol { /* style for links to protocol names in code snippets */ } +a.code.hl_category { /* style for links to category names in code snippets */ } +a.code.hl_exception { /* style for links to exception names in code snippets */ } +a.code.hl_service { /* style for links to service names in code snippets */ } +a.code.hl_singleton { /* style for links to singleton names in code snippets */ } +a.code.hl_concept { /* style for links to concept names in code snippets */ } +a.code.hl_namespace { /* style for links to namespace names in code snippets */ } +a.code.hl_package { /* style for links to package names in code snippets */ } +a.code.hl_define { /* style for links to macro names in code snippets */ } +a.code.hl_function { /* style for links to function names in code snippets */ } +a.code.hl_variable { /* style for links to variable names in code snippets */ } +a.code.hl_typedef { /* style for links to typedef names in code snippets */ } +a.code.hl_enumvalue { /* style for links to enum value names in code snippets */ } +a.code.hl_enumeration { /* style for links to enumeration names in code snippets */ } +a.code.hl_signal { /* style for links to Qt signal names in code snippets */ } +a.code.hl_slot { /* style for links to Qt slot names in code snippets */ } +a.code.hl_friend { /* style for links to friend names in code snippets */ } +a.code.hl_dcop { /* style for links to KDE3 DCOP names in code snippets */ } +a.code.hl_property { /* style for links to property names in code snippets */ } +a.code.hl_event { /* style for links to event names in code snippets */ } +a.code.hl_sequence { /* style for links to sequence names in code snippets */ } +a.code.hl_dictionary { /* style for links to dictionary names in code snippets */ } + +/* @end */ + +dl.el { + margin-left: -1cm; +} + +ul { + overflow: visible; +} + +#side-nav ul { + overflow: visible; /* reset ul rule for scroll bar in GENERATE_TREEVIEW window */ +} + +#main-nav ul { + overflow: visible; /* reset ul rule for the navigation bar drop down lists */ +} + +.fragment { + text-align: left; + direction: ltr; + overflow-x: auto; /*Fixed: fragment lines overlap floating elements*/ + overflow-y: hidden; +} + +pre.fragment { + border: 1px solid #C4CFE5; + background-color: #FBFCFD; + padding: 4px 6px; + margin: 4px 8px 4px 2px; + overflow: auto; + word-wrap: break-word; + font-size: 9pt; + line-height: 125%; + font-family: monospace, fixed; + font-size: 105%; +} + +div.fragment { + padding: 0 0 1px 0; /*Fixed: last line underline overlap border*/ + margin: 4px 8px 4px 2px; + background-color: #FBFCFD; + border: 1px solid #C4CFE5; +} + +div.line { + font-family: monospace, fixed; + font-size: 13px; + min-height: 13px; + line-height: 1.0; + text-wrap: unrestricted; + white-space: -moz-pre-wrap; /* Moz */ + white-space: -pre-wrap; /* Opera 4-6 */ + white-space: -o-pre-wrap; /* Opera 7 */ + white-space: pre-wrap; /* CSS3 */ + word-wrap: break-word; /* IE 5.5+ */ + text-indent: -53px; + padding-left: 53px; + padding-bottom: 0px; + margin: 0px; + -webkit-transition-property: background-color, box-shadow; + -webkit-transition-duration: 0.5s; + -moz-transition-property: background-color, box-shadow; + -moz-transition-duration: 0.5s; + -ms-transition-property: background-color, box-shadow; + -ms-transition-duration: 0.5s; + -o-transition-property: background-color, box-shadow; + -o-transition-duration: 0.5s; + transition-property: background-color, box-shadow; + transition-duration: 0.5s; +} + +div.line:after { + content:"\000A"; + white-space: pre; +} + +div.line.glow { + background-color: cyan; + box-shadow: 0 0 10px cyan; +} + + +span.lineno { + padding-right: 4px; + margin-right: 9px; + text-align: right; + border-right: 2px solid #0F0; + background-color: #E8E8E8; + white-space: pre; +} +span.lineno a { + background-color: #D8D8D8; +} + +span.lineno a:hover { + background-color: #C8C8C8; +} + +.lineno { + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +div.ah, span.ah { + background-color: black; + font-weight: bold; + color: #FFFFFF; + margin-bottom: 3px; + margin-top: 3px; + padding: 0.2em; + border: solid thin #333; + border-radius: 0.5em; + -webkit-border-radius: .5em; + -moz-border-radius: .5em; + box-shadow: 2px 2px 3px #999; + -webkit-box-shadow: 2px 2px 3px #999; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; + background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444)); + background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000 110%); +} + +div.classindex ul { + list-style: none; + padding-left: 0; +} + +div.classindex span.ai { + display: inline-block; +} + +div.groupHeader { + margin-left: 16px; + margin-top: 12px; + font-weight: bold; +} + +div.groupText { + margin-left: 16px; + font-style: italic; +} + +body { + background-color: white; + color: black; + margin: 0; +} + +div.contents { + margin-top: 10px; + margin-left: 12px; + margin-right: 8px; +} + +td.indexkey { + background-color: #EBEFF6; + font-weight: bold; + border: 1px solid #C4CFE5; + margin: 2px 0px 2px 0; + padding: 2px 10px; + white-space: nowrap; + vertical-align: top; +} + +td.indexvalue { + background-color: #EBEFF6; + border: 1px solid #C4CFE5; + padding: 2px 10px; + margin: 2px 0px; +} + +tr.memlist { + background-color: #EEF1F7; +} + +p.formulaDsp { + text-align: center; +} + +img.formulaDsp { + +} + +img.formulaInl, img.inline { + vertical-align: middle; +} + +div.center { + text-align: center; + margin-top: 0px; + margin-bottom: 0px; + padding: 0px; +} + +div.center img { + border: 0px; +} + +address.footer { + text-align: right; + padding-right: 12px; +} + +img.footer { + border: 0px; + vertical-align: middle; +} + +.compoundTemplParams { + color: #4665A2; + font-size: 80%; + line-height: 120%; +} + +/* @group Code Colorization */ + +span.keyword { + color: #008000 +} + +span.keywordtype { + color: #604020 +} + +span.keywordflow { + color: #e08000 +} + +span.comment { + color: #800000 +} + +span.preprocessor { + color: #806020 +} + +span.stringliteral { + color: #002080 +} + +span.charliteral { + color: #008080 +} + +span.vhdldigit { + color: #ff00ff +} + +span.vhdlchar { + color: #000000 +} + +span.vhdlkeyword { + color: #700070 +} + +span.vhdllogic { + color: #ff0000 +} + +blockquote { + background-color: #F7F8FB; + border-left: 2px solid #9CAFD4; + margin: 0 24px 0 4px; + padding: 0 12px 0 16px; +} + +blockquote.DocNodeRTL { + border-left: 0; + border-right: 2px solid #9CAFD4; + margin: 0 4px 0 24px; + padding: 0 16px 0 12px; +} + +/* @end */ + +/* +.search { + color: #003399; + font-weight: bold; +} + +form.search { + margin-bottom: 0px; + margin-top: 0px; +} + +input.search { + font-size: 75%; + color: #000080; + font-weight: normal; + background-color: #e8eef2; +} +*/ + +td.tiny { + font-size: 75%; +} + +.dirtab { + padding: 4px; + border-collapse: collapse; + border: 1px solid #A3B4D7; +} + +th.dirtab { + background: #EBEFF6; + font-weight: bold; +} + +hr { + height: 0px; + border: none; + border-top: 1px solid #4A6AAA; +} + +hr.footer { + height: 1px; +} + +/* @group Member Descriptions */ + +table.memberdecls { + border-spacing: 0px; + padding: 0px; +} + +.memberdecls td, .fieldtable tr { + -webkit-transition-property: background-color, box-shadow; + -webkit-transition-duration: 0.5s; + -moz-transition-property: background-color, box-shadow; + -moz-transition-duration: 0.5s; + -ms-transition-property: background-color, box-shadow; + -ms-transition-duration: 0.5s; + -o-transition-property: background-color, box-shadow; + -o-transition-duration: 0.5s; + transition-property: background-color, box-shadow; + transition-duration: 0.5s; +} + +.memberdecls td.glow, .fieldtable tr.glow { + background-color: cyan; + box-shadow: 0 0 15px cyan; +} + +.mdescLeft, .mdescRight, +.memItemLeft, .memItemRight, +.memTemplItemLeft, .memTemplItemRight, .memTemplParams { + background-color: #F9FAFC; + border: none; + margin: 4px; + padding: 1px 0 0 8px; +} + +.mdescLeft, .mdescRight { + padding: 0px 8px 4px 8px; + color: #555; +} + +.memSeparator { + border-bottom: 1px solid #DEE4F0; + line-height: 1px; + margin: 0px; + padding: 0px; +} + +.memItemLeft, .memTemplItemLeft { + white-space: nowrap; +} + +.memItemRight, .memTemplItemRight { + width: 100%; +} + +.memTemplParams { + color: #4665A2; + white-space: nowrap; + font-size: 80%; +} + +/* @end */ + +/* @group Member Details */ + +/* Styles for detailed member documentation */ + +.memtitle { + padding: 8px; + border-top: 1px solid #A8B8D9; + border-left: 1px solid #A8B8D9; + border-right: 1px solid #A8B8D9; + border-top-right-radius: 4px; + border-top-left-radius: 4px; + margin-bottom: -1px; + background-image: url('nav_f.png'); + background-repeat: repeat-x; + background-color: #E2E8F2; + line-height: 1.25; + font-weight: 300; + float:left; +} + +.permalink +{ + font-size: 65%; + display: inline-block; + vertical-align: middle; +} + +.memtemplate { + font-size: 80%; + color: #4665A2; + font-weight: normal; + margin-left: 9px; +} + +.memnav { + background-color: #EBEFF6; + border: 1px solid #A3B4D7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} + +.mempage { + width: 100%; +} + +.memitem { + padding: 0; + margin-bottom: 10px; + margin-right: 5px; + -webkit-transition: box-shadow 0.5s linear; + -moz-transition: box-shadow 0.5s linear; + -ms-transition: box-shadow 0.5s linear; + -o-transition: box-shadow 0.5s linear; + transition: box-shadow 0.5s linear; + display: table !important; + width: 100%; +} + +.memitem.glow { + box-shadow: 0 0 15px cyan; +} + +.memname { + font-weight: 400; + margin-left: 6px; +} + +.memname td { + vertical-align: bottom; +} + +.memproto, dl.reflist dt { + border-top: 1px solid #A8B8D9; + border-left: 1px solid #A8B8D9; + border-right: 1px solid #A8B8D9; + padding: 6px 0px 6px 0px; + color: #253555; + font-weight: bold; + text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); + background-color: #DFE5F1; + /* opera specific markup */ + box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + border-top-right-radius: 4px; + /* firefox specific markup */ + -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; + -moz-border-radius-topright: 4px; + /* webkit specific markup */ + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + -webkit-border-top-right-radius: 4px; + +} + +.overload { + font-family: "courier new",courier,monospace; + font-size: 65%; +} + +.memdoc, dl.reflist dd { + border-bottom: 1px solid #A8B8D9; + border-left: 1px solid #A8B8D9; + border-right: 1px solid #A8B8D9; + padding: 6px 10px 2px 10px; + background-color: #FBFCFD; + border-top-width: 0; + background-image:url('nav_g.png'); + background-repeat:repeat-x; + background-color: #FFFFFF; + /* opera specific markup */ + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + /* firefox specific markup */ + -moz-border-radius-bottomleft: 4px; + -moz-border-radius-bottomright: 4px; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; + /* webkit specific markup */ + -webkit-border-bottom-left-radius: 4px; + -webkit-border-bottom-right-radius: 4px; + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); +} + +dl.reflist dt { + padding: 5px; +} + +dl.reflist dd { + margin: 0px 0px 10px 0px; + padding: 5px; +} + +.paramkey { + text-align: right; +} + +.paramtype { + white-space: nowrap; +} + +.paramname { + color: #602020; + white-space: nowrap; +} +.paramname em { + font-style: normal; +} +.paramname code { + line-height: 14px; +} + +.params, .retval, .exception, .tparams { + margin-left: 0px; + padding-left: 0px; +} + +.params .paramname, .retval .paramname, .tparams .paramname, .exception .paramname { + font-weight: bold; + vertical-align: top; +} + +.params .paramtype, .tparams .paramtype { + font-style: italic; + vertical-align: top; +} + +.params .paramdir, .tparams .paramdir { + font-family: "courier new",courier,monospace; + vertical-align: top; +} + +table.mlabels { + border-spacing: 0px; +} + +td.mlabels-left { + width: 100%; + padding: 0px; +} + +td.mlabels-right { + vertical-align: bottom; + padding: 0px; + white-space: nowrap; +} + +span.mlabels { + margin-left: 8px; +} + +span.mlabel { + background-color: #728DC1; + border-top:1px solid #5373B4; + border-left:1px solid #5373B4; + border-right:1px solid #C4CFE5; + border-bottom:1px solid #C4CFE5; + text-shadow: none; + color: white; + margin-right: 4px; + padding: 2px 3px; + border-radius: 3px; + font-size: 7pt; + white-space: nowrap; + vertical-align: middle; +} + + + +/* @end */ + +/* these are for tree view inside a (index) page */ + +div.directory { + margin: 10px 0px; + border-top: 1px solid #9CAFD4; + border-bottom: 1px solid #9CAFD4; + width: 100%; +} + +.directory table { + border-collapse:collapse; +} + +.directory td { + margin: 0px; + padding: 0px; + vertical-align: top; +} + +.directory td.entry { + white-space: nowrap; + padding-right: 6px; + padding-top: 3px; +} + +.directory td.entry a { + outline:none; +} + +.directory td.entry a img { + border: none; +} + +.directory td.desc { + width: 100%; + padding-left: 6px; + padding-right: 6px; + padding-top: 3px; + border-left: 1px solid rgba(0,0,0,0.05); +} + +.directory tr.even { + padding-left: 6px; + background-color: #F7F8FB; +} + +.directory img { + vertical-align: -30%; +} + +.directory .levels { + white-space: nowrap; + width: 100%; + text-align: right; + font-size: 9pt; +} + +.directory .levels span { + cursor: pointer; + padding-left: 2px; + padding-right: 2px; + color: #3D578C; +} + +.arrow { + color: #9CAFD4; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + cursor: pointer; + font-size: 80%; + display: inline-block; + width: 16px; + height: 22px; +} + +.icon { + font-family: Arial, Helvetica; + font-weight: bold; + font-size: 12px; + height: 14px; + width: 16px; + display: inline-block; + background-color: #728DC1; + color: white; + text-align: center; + border-radius: 4px; + margin-left: 2px; + margin-right: 2px; +} + +.icona { + width: 24px; + height: 22px; + display: inline-block; +} + +.iconfopen { + width: 24px; + height: 18px; + margin-bottom: 4px; + background-image:url('folderopen.png'); + background-position: 0px -4px; + background-repeat: repeat-y; + vertical-align:top; + display: inline-block; +} + +.iconfclosed { + width: 24px; + height: 18px; + margin-bottom: 4px; + background-image:url('folderclosed.png'); + background-position: 0px -4px; + background-repeat: repeat-y; + vertical-align:top; + display: inline-block; +} + +.icondoc { + width: 24px; + height: 18px; + margin-bottom: 4px; + background-image:url('doc.png'); + background-position: 0px -4px; + background-repeat: repeat-y; + vertical-align:top; + display: inline-block; +} + +table.directory { + font: 400 14px Roboto,sans-serif; +} + +/* @end */ + +div.dynheader { + margin-top: 8px; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +address { + font-style: normal; + color: #2A3D61; +} + +table.doxtable caption { + caption-side: top; +} + +table.doxtable { + border-collapse:collapse; + margin-top: 4px; + margin-bottom: 4px; +} + +table.doxtable td, table.doxtable th { + border: 1px solid #2D4068; + padding: 3px 7px 2px; +} + +table.doxtable th { + background-color: #374F7F; + color: #FFFFFF; + font-size: 110%; + padding-bottom: 4px; + padding-top: 5px; +} + +table.fieldtable { + /*width: 100%;*/ + margin-bottom: 10px; + border: 1px solid #A8B8D9; + border-spacing: 0px; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + border-radius: 4px; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; + -webkit-box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); + box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); +} + +.fieldtable td, .fieldtable th { + padding: 3px 7px 2px; +} + +.fieldtable td.fieldtype, .fieldtable td.fieldname { + white-space: nowrap; + border-right: 1px solid #A8B8D9; + border-bottom: 1px solid #A8B8D9; + vertical-align: top; +} + +.fieldtable td.fieldname { + padding-top: 3px; +} + +.fieldtable td.fielddoc { + border-bottom: 1px solid #A8B8D9; + /*width: 100%;*/ +} + +.fieldtable td.fielddoc p:first-child { + margin-top: 0px; +} + +.fieldtable td.fielddoc p:last-child { + margin-bottom: 2px; +} + +.fieldtable tr:last-child td { + border-bottom: none; +} + +.fieldtable th { + background-image:url('nav_f.png'); + background-repeat:repeat-x; + background-color: #E2E8F2; + font-size: 90%; + color: #253555; + padding-bottom: 4px; + padding-top: 5px; + text-align:left; + font-weight: 400; + -moz-border-radius-topleft: 4px; + -moz-border-radius-topright: 4px; + -webkit-border-top-left-radius: 4px; + -webkit-border-top-right-radius: 4px; + border-top-left-radius: 4px; + border-top-right-radius: 4px; + border-bottom: 1px solid #A8B8D9; +} + + +.tabsearch { + top: 0px; + left: 10px; + height: 36px; + background-image: url('tab_b.png'); + z-index: 101; + overflow: hidden; + font-size: 13px; +} + +.navpath ul +{ + font-size: 11px; + background-image:url('tab_b.png'); + background-repeat:repeat-x; + background-position: 0 -5px; + height:30px; + line-height:30px; + color:#8AA0CC; + border:solid 1px #C2CDE4; + overflow:hidden; + margin:0px; + padding:0px; +} + +.navpath li +{ + list-style-type:none; + float:left; + padding-left:10px; + padding-right:15px; + background-image:url('bc_s.png'); + background-repeat:no-repeat; + background-position:right; + color:#364D7C; +} + +.navpath li.navelem a +{ + height:32px; + display:block; + text-decoration: none; + outline: none; + color: #283A5D; + font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; + text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); + text-decoration: none; +} + +.navpath li.navelem a:hover +{ + color:#6884BD; +} + +.navpath li.footer +{ + list-style-type:none; + float:right; + padding-left:10px; + padding-right:15px; + background-image:none; + background-repeat:no-repeat; + background-position:right; + color:#364D7C; + font-size: 8pt; +} + + +div.summary +{ + float: right; + font-size: 8pt; + padding-right: 5px; + width: 50%; + text-align: right; +} + +div.summary a +{ + white-space: nowrap; +} + +table.classindex +{ + margin: 10px; + white-space: nowrap; + margin-left: 3%; + margin-right: 3%; + width: 94%; + border: 0; + border-spacing: 0; + padding: 0; +} + +div.ingroups +{ + font-size: 8pt; + width: 50%; + text-align: left; +} + +div.ingroups a +{ + white-space: nowrap; +} + +div.header +{ + background-image:url('nav_h.png'); + background-repeat:repeat-x; + background-color: #F9FAFC; + margin: 0px; + border-bottom: 1px solid #C4CFE5; +} + +div.headertitle +{ + padding: 5px 5px 5px 10px; +} + +.PageDocRTL-title div.headertitle { + text-align: right; + direction: rtl; +} + +dl { + padding: 0 0 0 0; +} + +/* dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug, dl.examples */ +dl.section { + margin-left: 0px; + padding-left: 0px; +} + +dl.section.DocNodeRTL { + margin-right: 0px; + padding-right: 0px; +} + +dl.note { + margin-left: -7px; + padding-left: 3px; + border-left: 4px solid; + border-color: #D0C000; +} + +dl.note.DocNodeRTL { + margin-left: 0; + padding-left: 0; + border-left: 0; + margin-right: -7px; + padding-right: 3px; + border-right: 4px solid; + border-color: #D0C000; +} + +dl.warning, dl.attention { + margin-left: -7px; + padding-left: 3px; + border-left: 4px solid; + border-color: #FF0000; +} + +dl.warning.DocNodeRTL, dl.attention.DocNodeRTL { + margin-left: 0; + padding-left: 0; + border-left: 0; + margin-right: -7px; + padding-right: 3px; + border-right: 4px solid; + border-color: #FF0000; +} + +dl.pre, dl.post, dl.invariant { + margin-left: -7px; + padding-left: 3px; + border-left: 4px solid; + border-color: #00D000; +} + +dl.pre.DocNodeRTL, dl.post.DocNodeRTL, dl.invariant.DocNodeRTL { + margin-left: 0; + padding-left: 0; + border-left: 0; + margin-right: -7px; + padding-right: 3px; + border-right: 4px solid; + border-color: #00D000; +} + +dl.deprecated { + margin-left: -7px; + padding-left: 3px; + border-left: 4px solid; + border-color: #505050; +} + +dl.deprecated.DocNodeRTL { + margin-left: 0; + padding-left: 0; + border-left: 0; + margin-right: -7px; + padding-right: 3px; + border-right: 4px solid; + border-color: #505050; +} + +dl.todo { + margin-left: -7px; + padding-left: 3px; + border-left: 4px solid; + border-color: #00C0E0; +} + +dl.todo.DocNodeRTL { + margin-left: 0; + padding-left: 0; + border-left: 0; + margin-right: -7px; + padding-right: 3px; + border-right: 4px solid; + border-color: #00C0E0; +} + +dl.test { + margin-left: -7px; + padding-left: 3px; + border-left: 4px solid; + border-color: #3030E0; +} + +dl.test.DocNodeRTL { + margin-left: 0; + padding-left: 0; + border-left: 0; + margin-right: -7px; + padding-right: 3px; + border-right: 4px solid; + border-color: #3030E0; +} + +dl.bug { + margin-left: -7px; + padding-left: 3px; + border-left: 4px solid; + border-color: #C08050; +} + +dl.bug.DocNodeRTL { + margin-left: 0; + padding-left: 0; + border-left: 0; + margin-right: -7px; + padding-right: 3px; + border-right: 4px solid; + border-color: #C08050; +} + +dl.section dd { + margin-bottom: 6px; +} + + +#projectrow +{ + height: 56px; +} + +#projectlogo +{ + text-align: center; + vertical-align: bottom; + border-collapse: separate; +} + +#projectlogo img +{ + border: 0px none; +} + +#projectalign +{ + vertical-align: middle; + padding-left: 0.5em; +} + +#projectname +{ + font: 200% Tahoma, Arial,sans-serif; + margin: 0px; + padding: 2px 0px; +} + +#projectbrief +{ + font: 90% Tahoma, Arial,sans-serif; + margin: 0px; + padding: 0px; +} + +#projectnumber +{ + font: 50% Tahoma, Arial,sans-serif; + margin: 0px; + padding: 0px; +} + +#titlearea +{ + padding: 0px; + margin: 0px; + width: 100%; + border-bottom: 1px solid #5373B4; +} + +.image +{ + text-align: center; +} + +.dotgraph +{ + text-align: center; +} + +.mscgraph +{ + text-align: center; +} + +.plantumlgraph +{ + text-align: center; +} + +.diagraph +{ + text-align: center; +} + +.caption +{ + font-weight: bold; +} + +div.zoom +{ + border: 1px solid #90A5CE; +} + +dl.citelist { + margin-bottom:50px; +} + +dl.citelist dt { + color:#334975; + float:left; + font-weight:bold; + margin-right:10px; + padding:5px; + text-align:right; + width:52px; +} + +dl.citelist dd { + margin:2px 0 2px 72px; + padding:5px 0; +} + +div.toc { + padding: 14px 25px; + background-color: #F4F6FA; + border: 1px solid #D8DFEE; + border-radius: 7px 7px 7px 7px; + float: right; + height: auto; + margin: 0 8px 10px 10px; + width: 200px; +} + +.PageDocRTL-title div.toc { + float: left !important; + text-align: right; +} + +div.toc li { + background: url("bdwn.png") no-repeat scroll 0 5px transparent; + font: 10px/1.2 Verdana,DejaVu Sans,Geneva,sans-serif; + margin-top: 5px; + padding-left: 10px; + padding-top: 2px; +} + +.PageDocRTL-title div.toc li { + background-position-x: right !important; + padding-left: 0 !important; + padding-right: 10px; +} + +div.toc h3 { + font: bold 12px/1.2 Arial,FreeSans,sans-serif; + color: #4665A2; + border-bottom: 0 none; + margin: 0; +} + +div.toc ul { + list-style: none outside none; + border: medium none; + padding: 0px; +} + +div.toc li.level1 { + margin-left: 0px; +} + +div.toc li.level2 { + margin-left: 15px; +} + +div.toc li.level3 { + margin-left: 30px; +} + +div.toc li.level4 { + margin-left: 45px; +} + +span.emoji { + /* font family used at the site: https://unicode.org/emoji/charts/full-emoji-list.html + * font-family: "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", Times, Symbola, Aegyptus, Code2000, Code2001, Code2002, Musica, serif, LastResort; + */ +} + +span.obfuscator { + display: none; +} + +.PageDocRTL-title div.toc li.level1 { + margin-left: 0 !important; + margin-right: 0; +} + +.PageDocRTL-title div.toc li.level2 { + margin-left: 0 !important; + margin-right: 15px; +} + +.PageDocRTL-title div.toc li.level3 { + margin-left: 0 !important; + margin-right: 30px; +} + +.PageDocRTL-title div.toc li.level4 { + margin-left: 0 !important; + margin-right: 45px; +} + +.inherit_header { + font-weight: bold; + color: gray; + cursor: pointer; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.inherit_header td { + padding: 6px 0px 2px 5px; +} + +.inherit { + display: none; +} + +tr.heading h2 { + margin-top: 12px; + margin-bottom: 4px; +} + +/* tooltip related style info */ + +.ttc { + position: absolute; + display: none; +} + +#powerTip { + cursor: default; + /*white-space: nowrap;*/ + background-color: white; + border: 1px solid gray; + border-radius: 4px 4px 4px 4px; + box-shadow: 1px 1px 7px gray; + display: none; + font-size: smaller; + max-width: 80%; + opacity: 0.9; + padding: 1ex 1em 1em; + position: absolute; + z-index: 2147483647; +} + +#powerTip div.ttdoc { + color: grey; + font-style: italic; +} + +#powerTip div.ttname a { + font-weight: bold; +} + +#powerTip div.ttname { + font-weight: bold; +} + +#powerTip div.ttdeci { + color: #006318; +} + +#powerTip div { + margin: 0px; + padding: 0px; + font: 12px/16px Roboto,sans-serif; +} + +#powerTip:before, #powerTip:after { + content: ""; + position: absolute; + margin: 0px; +} + +#powerTip.n:after, #powerTip.n:before, +#powerTip.s:after, #powerTip.s:before, +#powerTip.w:after, #powerTip.w:before, +#powerTip.e:after, #powerTip.e:before, +#powerTip.ne:after, #powerTip.ne:before, +#powerTip.se:after, #powerTip.se:before, +#powerTip.nw:after, #powerTip.nw:before, +#powerTip.sw:after, #powerTip.sw:before { + border: solid transparent; + content: " "; + height: 0; + width: 0; + position: absolute; +} + +#powerTip.n:after, #powerTip.s:after, +#powerTip.w:after, #powerTip.e:after, +#powerTip.nw:after, #powerTip.ne:after, +#powerTip.sw:after, #powerTip.se:after { + border-color: rgba(255, 255, 255, 0); +} + +#powerTip.n:before, #powerTip.s:before, +#powerTip.w:before, #powerTip.e:before, +#powerTip.nw:before, #powerTip.ne:before, +#powerTip.sw:before, #powerTip.se:before { + border-color: rgba(128, 128, 128, 0); +} + +#powerTip.n:after, #powerTip.n:before, +#powerTip.ne:after, #powerTip.ne:before, +#powerTip.nw:after, #powerTip.nw:before { + top: 100%; +} + +#powerTip.n:after, #powerTip.ne:after, #powerTip.nw:after { + border-top-color: #FFFFFF; + border-width: 10px; + margin: 0px -10px; +} +#powerTip.n:before { + border-top-color: #808080; + border-width: 11px; + margin: 0px -11px; +} +#powerTip.n:after, #powerTip.n:before { + left: 50%; +} + +#powerTip.nw:after, #powerTip.nw:before { + right: 14px; +} + +#powerTip.ne:after, #powerTip.ne:before { + left: 14px; +} + +#powerTip.s:after, #powerTip.s:before, +#powerTip.se:after, #powerTip.se:before, +#powerTip.sw:after, #powerTip.sw:before { + bottom: 100%; +} + +#powerTip.s:after, #powerTip.se:after, #powerTip.sw:after { + border-bottom-color: #FFFFFF; + border-width: 10px; + margin: 0px -10px; +} + +#powerTip.s:before, #powerTip.se:before, #powerTip.sw:before { + border-bottom-color: #808080; + border-width: 11px; + margin: 0px -11px; +} + +#powerTip.s:after, #powerTip.s:before { + left: 50%; +} + +#powerTip.sw:after, #powerTip.sw:before { + right: 14px; +} + +#powerTip.se:after, #powerTip.se:before { + left: 14px; +} + +#powerTip.e:after, #powerTip.e:before { + left: 100%; +} +#powerTip.e:after { + border-left-color: #FFFFFF; + border-width: 10px; + top: 50%; + margin-top: -10px; +} +#powerTip.e:before { + border-left-color: #808080; + border-width: 11px; + top: 50%; + margin-top: -11px; +} + +#powerTip.w:after, #powerTip.w:before { + right: 100%; +} +#powerTip.w:after { + border-right-color: #FFFFFF; + border-width: 10px; + top: 50%; + margin-top: -10px; +} +#powerTip.w:before { + border-right-color: #808080; + border-width: 11px; + top: 50%; + margin-top: -11px; +} + +@media print +{ + #top { display: none; } + #side-nav { display: none; } + #nav-path { display: none; } + body { overflow:visible; } + h1, h2, h3, h4, h5, h6 { page-break-after: avoid; } + .summary { display: none; } + .memitem { page-break-inside: avoid; } + #doc-content + { + margin-left:0 !important; + height:auto !important; + width:auto !important; + overflow:inherit; + display:inline; + } +} + +/* @group Markdown */ + +table.markdownTable { + border-collapse:collapse; + margin-top: 4px; + margin-bottom: 4px; +} + +table.markdownTable td, table.markdownTable th { + border: 1px solid #2D4068; + padding: 3px 7px 2px; +} + +table.markdownTable tr { +} + +th.markdownTableHeadLeft, th.markdownTableHeadRight, th.markdownTableHeadCenter, th.markdownTableHeadNone { + background-color: #374F7F; + color: #FFFFFF; + font-size: 110%; + padding-bottom: 4px; + padding-top: 5px; +} + +th.markdownTableHeadLeft, td.markdownTableBodyLeft { + text-align: left +} + +th.markdownTableHeadRight, td.markdownTableBodyRight { + text-align: right +} + +th.markdownTableHeadCenter, td.markdownTableBodyCenter { + text-align: center +} + +.DocNodeRTL { + text-align: right; + direction: rtl; +} + +.DocNodeLTR { + text-align: left; + direction: ltr; +} + +table.DocNodeRTL { + width: auto; + margin-right: 0; + margin-left: auto; +} + +table.DocNodeLTR { + width: auto; + margin-right: auto; + margin-left: 0; +} + +code.JavaDocCode + direction:ltr; +} + +tt, code, kbd, samp +{ + display: inline-block; + direction:ltr; +} +/* @end */ + +u { + text-decoration: underline; +} + diff --git a/doc/html/doxygen.svg b/doc/html/doxygen.svg new file mode 100644 index 0000000..d42dad5 --- /dev/null +++ b/doc/html/doxygen.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/html/dynsections.js b/doc/html/dynsections.js new file mode 100644 index 0000000..3174bd7 --- /dev/null +++ b/doc/html/dynsections.js @@ -0,0 +1,121 @@ +/* + @licstart The following is the entire license notice for the JavaScript code in this file. + + The MIT License (MIT) + + Copyright (C) 1997-2020 by Dimitri van Heesch + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software + and associated documentation files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, publish, distribute, + sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or + substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + @licend The above is the entire license notice for the JavaScript code in this file + */ +function toggleVisibility(linkObj) +{ + var base = $(linkObj).attr('id'); + var summary = $('#'+base+'-summary'); + var content = $('#'+base+'-content'); + var trigger = $('#'+base+'-trigger'); + var src=$(trigger).attr('src'); + if (content.is(':visible')===true) { + content.hide(); + summary.show(); + $(linkObj).addClass('closed').removeClass('opened'); + $(trigger).attr('src',src.substring(0,src.length-8)+'closed.png'); + } else { + content.show(); + summary.hide(); + $(linkObj).removeClass('closed').addClass('opened'); + $(trigger).attr('src',src.substring(0,src.length-10)+'open.png'); + } + return false; +} + +function updateStripes() +{ + $('table.directory tr'). + removeClass('even').filter(':visible:even').addClass('even'); +} + +function toggleLevel(level) +{ + $('table.directory tr').each(function() { + var l = this.id.split('_').length-1; + var i = $('#img'+this.id.substring(3)); + var a = $('#arr'+this.id.substring(3)); + if (l + + + + + + +sbgECom: File List + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+
File List
+
+
+
Here is a list of all documented files with brief descriptions:
+
[detail level 123]
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  src
  binaryLogs
 sbgEComBinaryLogAirData.hParse received air data measurement logs such as barometer data
 sbgEComBinaryLogAutomotiveData.hParse dedicated automotive measurements logs
 sbgEComBinaryLogDepth.hParse received subsea depth measurement logs
 sbgEComBinaryLogDiag.hParse diagnostic logs emitted by the device
 sbgEComBinaryLogDvl.hParse received DVL (Doppler Velocity Logger) measurement logs
 sbgEComBinaryLogEkf.hParse EKF measurements such as attitude, position and velocity logs
 sbgEComBinaryLogEvent.hParse event markers logs used to timestamp external signals
 sbgEComBinaryLogGps.hParse received GNSS logs such as Position, Velocity and True Heading
 sbgEComBinaryLogImu.hParse IMU (Inertial Measurement Unit) measurement logs
 sbgEComBinaryLogMag.hParse magnetic field measurements logs
 sbgEComBinaryLogOdometer.hParse recevied odometer/DMI velocity measurement logs
 sbgEComBinaryLogRawData.hParse logs used to store a binary stream such as RAW GNSS data
 sbgEComBinaryLogRtcm.hParse RTCM data stream logs as received by the INS
 sbgEComBinaryLogs.hParse incoming sbgECom logs and store result in an union
 sbgEComBinaryLogShipMotion.hParse logs that returns ship motion values such as heave
 sbgEComBinaryLogStatus.hParse logs used to report device status
 sbgEComBinaryLogUsbl.hParse received USBL position mesurements logs
 sbgEComBinaryLogUtc.hParse logs used to report device UTC time
  commands
 sbgEComCmd.hInclude all available sbgECom commands
 sbgEComCmdAdvanced.hAdvanced settings related commands
 sbgEComCmdAirData.hAirData aiding module configuration commands
 sbgEComCmdApi.hREST API related commands
 sbgEComCmdCommon.hDefinitions and methods common to all commands
 sbgEComCmdDvl.hDVL (Doppler Velocity Logger) aiding module configuration commands
 sbgEComCmdEthernet.hEthernet configuration related commands
 sbgEComCmdEvent.hInput/output event markers configuration commands
 sbgEComCmdFeatures.hCommands used to query supported device features
 sbgEComCmdGnss.hGNSS aiding module configuration commands
 sbgEComCmdInfo.hCommands used to query the device information
 sbgEComCmdInterface.hCommands used to configure device serial, CAN and Ethernet interfaces
 sbgEComCmdLicense.hCommand used to upload and apply an activation license
 sbgEComCmdMag.hMagnetometer aiding module configuration & onboard magnetic calibration commands
 sbgEComCmdOdo.hOdometer / DMI aiding module configuration commands
 sbgEComCmdOutput.hCommands used to setup logs to output over the device interfaces
 sbgEComCmdSensor.hMotion profile, aiding assignement & sensor installation commands
 sbgEComCmdSettings.hImport/export/save settings commands
  protocol
 sbgEComProtocol.hImplementation of the sbgECom binary communication protocol
  transfer
 sbgEComTransfer.hHandle large send/receive transfer for specific ECom Protocol commands
 sbgECanId.hDefines all sbgECom commands identifiers
 sbgECom.hContains main sbgECom methods
 sbgEComGetVersion.hVersion information
 sbgEComIds.hDefines all sbgECom commands identifiers
 sbgEComLib.hMain header file for the SBG Systems Enhanced Communication Library
 sbgEComVersion.hHeader file that contains all versions related information such as change log
+
+
+ + + + diff --git a/doc/html/folderclosed.png b/doc/html/folderclosed.png new file mode 100644 index 0000000..bb8ab35 Binary files /dev/null and b/doc/html/folderclosed.png differ diff --git a/doc/html/folderopen.png b/doc/html/folderopen.png new file mode 100644 index 0000000..d6c7f67 Binary files /dev/null and b/doc/html/folderopen.png differ diff --git a/doc/html/functions.html b/doc/html/functions.html new file mode 100644 index 0000000..80e81cb --- /dev/null +++ b/doc/html/functions.html @@ -0,0 +1,69 @@ + + + + + + + +sbgECom: Data Fields + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- a -

+
+ + + + diff --git a/doc/html/functions_b.html b/doc/html/functions_b.html new file mode 100644 index 0000000..2860b2c --- /dev/null +++ b/doc/html/functions_b.html @@ -0,0 +1,60 @@ + + + + + + + +sbgECom: Data Fields + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- b -

+
+ + + + diff --git a/doc/html/functions_c.html b/doc/html/functions_c.html new file mode 100644 index 0000000..8da24bc --- /dev/null +++ b/doc/html/functions_c.html @@ -0,0 +1,63 @@ + + + + + + + +sbgECom: Data Fields + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- c -

+
+ + + + diff --git a/doc/html/functions_d.html b/doc/html/functions_d.html new file mode 100644 index 0000000..7edca6b --- /dev/null +++ b/doc/html/functions_d.html @@ -0,0 +1,69 @@ + + + + + + + +sbgECom: Data Fields + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- d -

+
+ + + + diff --git a/doc/html/functions_e.html b/doc/html/functions_e.html new file mode 100644 index 0000000..cfde9a8 --- /dev/null +++ b/doc/html/functions_e.html @@ -0,0 +1,59 @@ + + + + + + + +sbgECom: Data Fields + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- e -

+
+ + + + diff --git a/doc/html/functions_f.html b/doc/html/functions_f.html new file mode 100644 index 0000000..5683a9f --- /dev/null +++ b/doc/html/functions_f.html @@ -0,0 +1,54 @@ + + + + + + + +sbgECom: Data Fields + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- f -

+
+ + + + diff --git a/doc/html/functions_g.html b/doc/html/functions_g.html new file mode 100644 index 0000000..4f42b60 --- /dev/null +++ b/doc/html/functions_g.html @@ -0,0 +1,72 @@ + + + + + + + +sbgECom: Data Fields + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- g -

+
+ + + + diff --git a/doc/html/functions_h.html b/doc/html/functions_h.html new file mode 100644 index 0000000..2217bd7 --- /dev/null +++ b/doc/html/functions_h.html @@ -0,0 +1,58 @@ + + + + + + + +sbgECom: Data Fields + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- h -

+
+ + + + diff --git a/doc/html/functions_i.html b/doc/html/functions_i.html new file mode 100644 index 0000000..efdff5e --- /dev/null +++ b/doc/html/functions_i.html @@ -0,0 +1,55 @@ + + + + + + + +sbgECom: Data Fields + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- i -

+
+ + + + diff --git a/doc/html/functions_l.html b/doc/html/functions_l.html new file mode 100644 index 0000000..a28e402 --- /dev/null +++ b/doc/html/functions_l.html @@ -0,0 +1,62 @@ + + + + + + + +sbgECom: Data Fields + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- l -

+
+ + + + diff --git a/doc/html/functions_m.html b/doc/html/functions_m.html new file mode 100644 index 0000000..1d4e2be --- /dev/null +++ b/doc/html/functions_m.html @@ -0,0 +1,71 @@ + + + + + + + +sbgECom: Data Fields + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- m -

+
+ + + + diff --git a/doc/html/functions_n.html b/doc/html/functions_n.html new file mode 100644 index 0000000..76b9f36 --- /dev/null +++ b/doc/html/functions_n.html @@ -0,0 +1,60 @@ + + + + + + + +sbgECom: Data Fields + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- n -

+
+ + + + diff --git a/doc/html/functions_o.html b/doc/html/functions_o.html new file mode 100644 index 0000000..ee9d66e --- /dev/null +++ b/doc/html/functions_o.html @@ -0,0 +1,57 @@ + + + + + + + +sbgECom: Data Fields + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- o -

+
+ + + + diff --git a/doc/html/functions_p.html b/doc/html/functions_p.html new file mode 100644 index 0000000..54ebb9b --- /dev/null +++ b/doc/html/functions_p.html @@ -0,0 +1,71 @@ + + + + + + + +sbgECom: Data Fields + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- p -

+
+ + + + diff --git a/doc/html/functions_q.html b/doc/html/functions_q.html new file mode 100644 index 0000000..880c65a --- /dev/null +++ b/doc/html/functions_q.html @@ -0,0 +1,54 @@ + + + + + + + +sbgECom: Data Fields + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- q -

+
+ + + + diff --git a/doc/html/functions_r.html b/doc/html/functions_r.html new file mode 100644 index 0000000..52ec8c8 --- /dev/null +++ b/doc/html/functions_r.html @@ -0,0 +1,62 @@ + + + + + + + +sbgECom: Data Fields + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- r -

+
+ + + + diff --git a/doc/html/functions_s.html b/doc/html/functions_s.html new file mode 100644 index 0000000..2bffa28 --- /dev/null +++ b/doc/html/functions_s.html @@ -0,0 +1,69 @@ + + + + + + + +sbgECom: Data Fields + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- s -

+
+ + + + diff --git a/doc/html/functions_t.html b/doc/html/functions_t.html new file mode 100644 index 0000000..ddce730 --- /dev/null +++ b/doc/html/functions_t.html @@ -0,0 +1,66 @@ + + + + + + + +sbgECom: Data Fields + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- t -

+
+ + + + diff --git a/doc/html/functions_u.html b/doc/html/functions_u.html new file mode 100644 index 0000000..7561ea0 --- /dev/null +++ b/doc/html/functions_u.html @@ -0,0 +1,56 @@ + + + + + + + +sbgECom: Data Fields + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- u -

+
+ + + + diff --git a/doc/html/functions_v.html b/doc/html/functions_v.html new file mode 100644 index 0000000..5a59f51 --- /dev/null +++ b/doc/html/functions_v.html @@ -0,0 +1,57 @@ + + + + + + + +sbgECom: Data Fields + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- v -

+
+ + + + diff --git a/doc/html/functions_vars.html b/doc/html/functions_vars.html new file mode 100644 index 0000000..4d03d46 --- /dev/null +++ b/doc/html/functions_vars.html @@ -0,0 +1,69 @@ + + + + + + + +sbgECom: Data Fields - Variables + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+  + +

- a -

+
+ + + + diff --git a/doc/html/functions_vars_b.html b/doc/html/functions_vars_b.html new file mode 100644 index 0000000..0dc5db6 --- /dev/null +++ b/doc/html/functions_vars_b.html @@ -0,0 +1,60 @@ + + + + + + + +sbgECom: Data Fields - Variables + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+  + +

- b -

+
+ + + + diff --git a/doc/html/functions_vars_c.html b/doc/html/functions_vars_c.html new file mode 100644 index 0000000..61a47c0 --- /dev/null +++ b/doc/html/functions_vars_c.html @@ -0,0 +1,63 @@ + + + + + + + +sbgECom: Data Fields - Variables + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+  + +

- c -

+
+ + + + diff --git a/doc/html/functions_vars_d.html b/doc/html/functions_vars_d.html new file mode 100644 index 0000000..0986712 --- /dev/null +++ b/doc/html/functions_vars_d.html @@ -0,0 +1,69 @@ + + + + + + + +sbgECom: Data Fields - Variables + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+  + +

- d -

+
+ + + + diff --git a/doc/html/functions_vars_e.html b/doc/html/functions_vars_e.html new file mode 100644 index 0000000..8d2c80a --- /dev/null +++ b/doc/html/functions_vars_e.html @@ -0,0 +1,59 @@ + + + + + + + +sbgECom: Data Fields - Variables + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+  + +

- e -

+
+ + + + diff --git a/doc/html/functions_vars_f.html b/doc/html/functions_vars_f.html new file mode 100644 index 0000000..f7d90bc --- /dev/null +++ b/doc/html/functions_vars_f.html @@ -0,0 +1,54 @@ + + + + + + + +sbgECom: Data Fields - Variables + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+  + +

- f -

+
+ + + + diff --git a/doc/html/functions_vars_g.html b/doc/html/functions_vars_g.html new file mode 100644 index 0000000..d16d544 --- /dev/null +++ b/doc/html/functions_vars_g.html @@ -0,0 +1,72 @@ + + + + + + + +sbgECom: Data Fields - Variables + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+  + +

- g -

+
+ + + + diff --git a/doc/html/functions_vars_h.html b/doc/html/functions_vars_h.html new file mode 100644 index 0000000..fb1bb11 --- /dev/null +++ b/doc/html/functions_vars_h.html @@ -0,0 +1,58 @@ + + + + + + + +sbgECom: Data Fields - Variables + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+  + +

- h -

+
+ + + + diff --git a/doc/html/functions_vars_i.html b/doc/html/functions_vars_i.html new file mode 100644 index 0000000..93e1325 --- /dev/null +++ b/doc/html/functions_vars_i.html @@ -0,0 +1,55 @@ + + + + + + + +sbgECom: Data Fields - Variables + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+  + +

- i -

+
+ + + + diff --git a/doc/html/functions_vars_l.html b/doc/html/functions_vars_l.html new file mode 100644 index 0000000..021b2d5 --- /dev/null +++ b/doc/html/functions_vars_l.html @@ -0,0 +1,62 @@ + + + + + + + +sbgECom: Data Fields - Variables + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+  + +

- l -

+
+ + + + diff --git a/doc/html/functions_vars_m.html b/doc/html/functions_vars_m.html new file mode 100644 index 0000000..6a182c1 --- /dev/null +++ b/doc/html/functions_vars_m.html @@ -0,0 +1,71 @@ + + + + + + + +sbgECom: Data Fields - Variables + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+  + +

- m -

+
+ + + + diff --git a/doc/html/functions_vars_n.html b/doc/html/functions_vars_n.html new file mode 100644 index 0000000..b389ce1 --- /dev/null +++ b/doc/html/functions_vars_n.html @@ -0,0 +1,60 @@ + + + + + + + +sbgECom: Data Fields - Variables + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+  + +

- n -

+
+ + + + diff --git a/doc/html/functions_vars_o.html b/doc/html/functions_vars_o.html new file mode 100644 index 0000000..987bb5c --- /dev/null +++ b/doc/html/functions_vars_o.html @@ -0,0 +1,57 @@ + + + + + + + +sbgECom: Data Fields - Variables + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+  + +

- o -

+
+ + + + diff --git a/doc/html/functions_vars_p.html b/doc/html/functions_vars_p.html new file mode 100644 index 0000000..cb57253 --- /dev/null +++ b/doc/html/functions_vars_p.html @@ -0,0 +1,71 @@ + + + + + + + +sbgECom: Data Fields - Variables + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+  + +

- p -

+
+ + + + diff --git a/doc/html/functions_vars_q.html b/doc/html/functions_vars_q.html new file mode 100644 index 0000000..2a746f2 --- /dev/null +++ b/doc/html/functions_vars_q.html @@ -0,0 +1,54 @@ + + + + + + + +sbgECom: Data Fields - Variables + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+  + +

- q -

+
+ + + + diff --git a/doc/html/functions_vars_r.html b/doc/html/functions_vars_r.html new file mode 100644 index 0000000..14e9a57 --- /dev/null +++ b/doc/html/functions_vars_r.html @@ -0,0 +1,62 @@ + + + + + + + +sbgECom: Data Fields - Variables + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+  + +

- r -

+
+ + + + diff --git a/doc/html/functions_vars_s.html b/doc/html/functions_vars_s.html new file mode 100644 index 0000000..70d5106 --- /dev/null +++ b/doc/html/functions_vars_s.html @@ -0,0 +1,69 @@ + + + + + + + +sbgECom: Data Fields - Variables + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+ + + + + diff --git a/doc/html/functions_vars_t.html b/doc/html/functions_vars_t.html new file mode 100644 index 0000000..66adaa2 --- /dev/null +++ b/doc/html/functions_vars_t.html @@ -0,0 +1,66 @@ + + + + + + + +sbgECom: Data Fields - Variables + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+ + + + + diff --git a/doc/html/functions_vars_u.html b/doc/html/functions_vars_u.html new file mode 100644 index 0000000..a9e152c --- /dev/null +++ b/doc/html/functions_vars_u.html @@ -0,0 +1,56 @@ + + + + + + + +sbgECom: Data Fields - Variables + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+  + +

- u -

+
+ + + + diff --git a/doc/html/functions_vars_v.html b/doc/html/functions_vars_v.html new file mode 100644 index 0000000..5ede6cc --- /dev/null +++ b/doc/html/functions_vars_v.html @@ -0,0 +1,57 @@ + + + + + + + +sbgECom: Data Fields - Variables + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+  + +

- v -

+
+ + + + diff --git a/doc/html/functions_vars_w.html b/doc/html/functions_vars_w.html new file mode 100644 index 0000000..b44e5d2 --- /dev/null +++ b/doc/html/functions_vars_w.html @@ -0,0 +1,53 @@ + + + + + + + +sbgECom: Data Fields - Variables + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+  + +

- w -

+
+ + + + diff --git a/doc/html/functions_vars_y.html b/doc/html/functions_vars_y.html new file mode 100644 index 0000000..98c7fce --- /dev/null +++ b/doc/html/functions_vars_y.html @@ -0,0 +1,53 @@ + + + + + + + +sbgECom: Data Fields - Variables + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+  + +

- y -

+
+ + + + diff --git a/doc/html/functions_w.html b/doc/html/functions_w.html new file mode 100644 index 0000000..b9da026 --- /dev/null +++ b/doc/html/functions_w.html @@ -0,0 +1,53 @@ + + + + + + + +sbgECom: Data Fields + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- w -

+
+ + + + diff --git a/doc/html/functions_y.html b/doc/html/functions_y.html new file mode 100644 index 0000000..c89d663 --- /dev/null +++ b/doc/html/functions_y.html @@ -0,0 +1,53 @@ + + + + + + + +sbgECom: Data Fields + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- y -

+
+ + + + diff --git a/doc/html/globals.html b/doc/html/globals.html new file mode 100644 index 0000000..e0d443d --- /dev/null +++ b/doc/html/globals.html @@ -0,0 +1,102 @@ + + + + + + + +sbgECom: Globals + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+
Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:
+ +

- _ -

+
+ + + + diff --git a/doc/html/globals_defs.html b/doc/html/globals_defs.html new file mode 100644 index 0000000..f9d9b24 --- /dev/null +++ b/doc/html/globals_defs.html @@ -0,0 +1,259 @@ + + + + + + + +sbgECom: Globals + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+  + +

- s -

+
+ + + + diff --git a/doc/html/globals_enum.html b/doc/html/globals_enum.html new file mode 100644 index 0000000..574b891 --- /dev/null +++ b/doc/html/globals_enum.html @@ -0,0 +1,102 @@ + + + + + + + +sbgECom: Globals + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+  + +

- _ -

+
+ + + + diff --git a/doc/html/globals_eval.html b/doc/html/globals_eval.html new file mode 100644 index 0000000..5326e94 --- /dev/null +++ b/doc/html/globals_eval.html @@ -0,0 +1,405 @@ + + + + + + + +sbgECom: Globals + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+  + +

- s -

+
+ + + + diff --git a/doc/html/globals_func.html b/doc/html/globals_func.html new file mode 100644 index 0000000..a47cab1 --- /dev/null +++ b/doc/html/globals_func.html @@ -0,0 +1,230 @@ + + + + + + + +sbgECom: Globals + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+  + +

- s -

+
+ + + + diff --git a/doc/html/globals_s.html b/doc/html/globals_s.html new file mode 100644 index 0000000..35222f2 --- /dev/null +++ b/doc/html/globals_s.html @@ -0,0 +1,891 @@ + + + + + + + +sbgECom: Globals + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+
Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:
+ +

- s -

+
+ + + + diff --git a/doc/html/globals_type.html b/doc/html/globals_type.html new file mode 100644 index 0000000..90dc6cf --- /dev/null +++ b/doc/html/globals_type.html @@ -0,0 +1,153 @@ + + + + + + + +sbgECom: Globals + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+  + +

- s -

+
+ + + + diff --git a/doc/html/index.html b/doc/html/index.html new file mode 100644 index 0000000..2945319 --- /dev/null +++ b/doc/html/index.html @@ -0,0 +1,54 @@ + + + + + + + +sbgECom: SBG Systems Enhanced Communication library documentation + + + + + + +
+
+ + + + + + +
+
sbgECom 3.1.2358-stable +
+
+
+ + + + + + +
+
+
SBG Systems Enhanced Communication library documentation
+
+
+

Welcome to the sbgECom library documentation.
+ This documentation describes all functions implemented in the sbgECom library.

+
+
+ + + + diff --git a/doc/html/jquery.js b/doc/html/jquery.js new file mode 100644 index 0000000..c9ed3d9 --- /dev/null +++ b/doc/html/jquery.js @@ -0,0 +1,35 @@ +/*! jQuery v3.6.0 | (c) OpenJS Foundation and other contributors | jquery.org/license */ +!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},x=function(e){return null!=e&&e===e.window},E=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.6.0",S=function(e,t){return new S.fn.init(e,t)};function p(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ye(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=S)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+xe(l[o]);c=l.join(",")}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){N(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return g(t.replace($,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[S]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.scope=ce(function(e){return a.appendChild(e).appendChild(C.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=S,!C.getElementsByName||!C.getElementsByName(S).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+S+"-]").length||v.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||v.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||v.push(".#.+[+~]"),e.querySelectorAll("\\\f"),v.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},j=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&y(p,e)?-1:t==C||t.ownerDocument==p&&y(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):"string"!=typeof n?S.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||D,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,D=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement("div")),(fe=E.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),y.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="",y.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="",y.option=!!ce.lastChild;var ge={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n",""]);var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function je(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function De(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function qe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Le(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var _t,zt=[],Ut=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=zt.pop()||S.expando+"_"+wt.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Ut.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Ut.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Ut,"$1"+r):!1!==e.jsonp&&(e.url+=(Tt.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,zt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((_t=E.implementation.createHTMLDocument("").body).innerHTML="
",2===_t.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return $(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=Fe(y.pixelPosition,function(e,t){if(t)return t=We(e,n),Pe.test(t)?S(e).position()[n]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return $(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){S.fn[n]=function(e,t){return 0a;a++)for(i in o[a])n=o[a][i],o[a].hasOwnProperty(i)&&void 0!==n&&(e[i]=t.isPlainObject(n)?t.isPlainObject(e[i])?t.widget.extend({},e[i],n):t.widget.extend({},n):n);return e},t.widget.bridge=function(e,i){var n=i.prototype.widgetFullName||e;t.fn[e]=function(o){var a="string"==typeof o,r=s.call(arguments,1),h=this;return a?this.length||"instance"!==o?this.each(function(){var i,s=t.data(this,n);return"instance"===o?(h=s,!1):s?t.isFunction(s[o])&&"_"!==o.charAt(0)?(i=s[o].apply(s,r),i!==s&&void 0!==i?(h=i&&i.jquery?h.pushStack(i.get()):i,!1):void 0):t.error("no such method '"+o+"' for "+e+" widget instance"):t.error("cannot call methods on "+e+" prior to initialization; "+"attempted to call method '"+o+"'")}):h=void 0:(r.length&&(o=t.widget.extend.apply(null,[o].concat(r))),this.each(function(){var e=t.data(this,n);e?(e.option(o||{}),e._init&&e._init()):t.data(this,n,new i(o,this))})),h}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"
",options:{classes:{},disabled:!1,create:null},_createWidget:function(e,s){s=t(s||this.defaultElement||this)[0],this.element=t(s),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),this.classesElementLookup={},s!==this&&(t.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===s&&this.destroy()}}),this.document=t(s.style?s.ownerDocument:s.document||s),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){var e=this;this._destroy(),t.each(this.classesElementLookup,function(t,i){e._removeClass(i,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:t.noop,widget:function(){return this.element},option:function(e,i){var s,n,o,a=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(a={},s=e.split("."),e=s.shift(),s.length){for(n=a[e]=t.widget.extend({},this.options[e]),o=0;s.length-1>o;o++)n[s[o]]=n[s[o]]||{},n=n[s[o]];if(e=s.pop(),1===arguments.length)return void 0===n[e]?null:n[e];n[e]=i}else{if(1===arguments.length)return void 0===this.options[e]?null:this.options[e];a[e]=i}return this._setOptions(a),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(e){var i,s,n;for(i in e)n=this.classesElementLookup[i],e[i]!==this.options.classes[i]&&n&&n.length&&(s=t(n.get()),this._removeClass(n,i),s.addClass(this._classes({element:s,keys:i,classes:e,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(e){function i(i,o){var a,r;for(r=0;i.length>r;r++)a=n.classesElementLookup[i[r]]||t(),a=e.add?t(t.unique(a.get().concat(e.element.get()))):t(a.not(e.element).get()),n.classesElementLookup[i[r]]=a,s.push(i[r]),o&&e.classes[i[r]]&&s.push(e.classes[i[r]])}var s=[],n=this;return e=t.extend({element:this.element,classes:this.options.classes||{}},e),this._on(e.element,{remove:"_untrackClassesElement"}),e.keys&&i(e.keys.match(/\S+/g)||[],!0),e.extra&&i(e.extra.match(/\S+/g)||[]),s.join(" ")},_untrackClassesElement:function(e){var i=this;t.each(i.classesElementLookup,function(s,n){-1!==t.inArray(e.target,n)&&(i.classesElementLookup[s]=t(n.not(e.target).get()))})},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){s="boolean"==typeof s?s:i;var n="string"==typeof t||null===t,o={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s};return o.element.toggleClass(this._classes(o),s),this},_on:function(e,i,s){var n,o=this;"boolean"!=typeof e&&(s=i,i=e,e=!1),s?(i=n=t(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),t.each(s,function(s,a){function r(){return e||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof a&&(r.guid=a.guid=a.guid||r.guid||t.guid++);var h=s.match(/^([\w:-]*)\s*(.*)$/),l=h[1]+o.eventNamespace,c=h[2];c?n.on(l,c,r):i.on(l,r)})},_off:function(e,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.off(i).off(i),this.bindings=t(this.bindings.not(e).get()),this.focusable=t(this.focusable.not(e).get()),this.hoverable=t(this.hoverable.not(e).get())},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){this._addClass(t(e.currentTarget),null,"ui-state-hover")},mouseleave:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){this._addClass(t(e.currentTarget),null,"ui-state-focus")},focusout:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}}),t.widget,function(){function e(t,e,i){return[parseFloat(t[0])*(u.test(t[0])?e/100:1),parseFloat(t[1])*(u.test(t[1])?i/100:1)]}function i(e,i){return parseInt(t.css(e,i),10)||0}function s(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}var n,o=Math.max,a=Math.abs,r=/left|center|right/,h=/top|center|bottom/,l=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,u=/%$/,d=t.fn.position;t.position={scrollbarWidth:function(){if(void 0!==n)return n;var e,i,s=t("
"),o=s.children()[0];return t("body").append(s),e=o.offsetWidth,s.css("overflow","scroll"),i=o.offsetWidth,e===i&&(i=s[0].clientWidth),s.remove(),n=e-i},getScrollInfo:function(e){var i=e.isWindow||e.isDocument?"":e.element.css("overflow-x"),s=e.isWindow||e.isDocument?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.widthi?"left":e>0?"right":"center",vertical:0>r?"top":s>0?"bottom":"middle"};l>p&&p>a(e+i)&&(u.horizontal="center"),c>f&&f>a(s+r)&&(u.vertical="middle"),u.important=o(a(e),a(i))>o(a(s),a(r))?"horizontal":"vertical",n.using.call(this,t,u)}),h.offset(t.extend(D,{using:r}))})},t.ui.position={fit:{left:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=t.left-e.collisionPosition.marginLeft,h=n-r,l=r+e.collisionWidth-a-n;e.collisionWidth>a?h>0&&0>=l?(i=t.left+h+e.collisionWidth-a-n,t.left+=h-i):t.left=l>0&&0>=h?n:h>l?n+a-e.collisionWidth:n:h>0?t.left+=h:l>0?t.left-=l:t.left=o(t.left-r,t.left)},top:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollTop:s.offset.top,a=e.within.height,r=t.top-e.collisionPosition.marginTop,h=n-r,l=r+e.collisionHeight-a-n;e.collisionHeight>a?h>0&&0>=l?(i=t.top+h+e.collisionHeight-a-n,t.top+=h-i):t.top=l>0&&0>=h?n:h>l?n+a-e.collisionHeight:n:h>0?t.top+=h:l>0?t.top-=l:t.top=o(t.top-r,t.top)}},flip:{left:function(t,e){var i,s,n=e.within,o=n.offset.left+n.scrollLeft,r=n.width,h=n.isWindow?n.scrollLeft:n.offset.left,l=t.left-e.collisionPosition.marginLeft,c=l-h,u=l+e.collisionWidth-r-h,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-r-o,(0>i||a(c)>i)&&(t.left+=d+p+f)):u>0&&(s=t.left-e.collisionPosition.marginLeft+d+p+f-h,(s>0||u>a(s))&&(t.left+=d+p+f))},top:function(t,e){var i,s,n=e.within,o=n.offset.top+n.scrollTop,r=n.height,h=n.isWindow?n.scrollTop:n.offset.top,l=t.top-e.collisionPosition.marginTop,c=l-h,u=l+e.collisionHeight-r-h,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,m=-2*e.offset[1];0>c?(s=t.top+p+f+m+e.collisionHeight-r-o,(0>s||a(c)>s)&&(t.top+=p+f+m)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+m-h,(i>0||u>a(i))&&(t.top+=p+f+m))}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}}}(),t.ui.position,t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(i){return!!t.data(i,e)}}):function(e,i,s){return!!t.data(e,s[3])}}),t.fn.extend({disableSelection:function(){var t="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}}(),enableSelection:function(){return this.off(".ui-disableSelection")}}),t.ui.focusable=function(i,s){var n,o,a,r,h,l=i.nodeName.toLowerCase();return"area"===l?(n=i.parentNode,o=n.name,i.href&&o&&"map"===n.nodeName.toLowerCase()?(a=t("img[usemap='#"+o+"']"),a.length>0&&a.is(":visible")):!1):(/^(input|select|textarea|button|object)$/.test(l)?(r=!i.disabled,r&&(h=t(i).closest("fieldset")[0],h&&(r=!h.disabled))):r="a"===l?i.href||s:s,r&&t(i).is(":visible")&&e(t(i)))},t.extend(t.expr[":"],{focusable:function(e){return t.ui.focusable(e,null!=t.attr(e,"tabindex"))}}),t.ui.focusable,t.fn.form=function(){return"string"==typeof this[0].form?this.closest("form"):t(this[0].form)},t.ui.formResetMixin={_formResetHandler:function(){var e=t(this);setTimeout(function(){var i=e.data("ui-form-reset-instances");t.each(i,function(){this.refresh()})})},_bindFormResetHandler:function(){if(this.form=this.element.form(),this.form.length){var t=this.form.data("ui-form-reset-instances")||[];t.length||this.form.on("reset.ui-form-reset",this._formResetHandler),t.push(this),this.form.data("ui-form-reset-instances",t)}},_unbindFormResetHandler:function(){if(this.form.length){var e=this.form.data("ui-form-reset-instances");e.splice(t.inArray(this,e),1),e.length?this.form.data("ui-form-reset-instances",e):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset")}}},"1.7"===t.fn.jquery.substring(0,3)&&(t.each(["Width","Height"],function(e,i){function s(e,i,s,o){return t.each(n,function(){i-=parseFloat(t.css(e,"padding"+this))||0,s&&(i-=parseFloat(t.css(e,"border"+this+"Width"))||0),o&&(i-=parseFloat(t.css(e,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],o=i.toLowerCase(),a={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+i]=function(e){return void 0===e?a["inner"+i].call(this):this.each(function(){t(this).css(o,s(this,e)+"px")})},t.fn["outer"+i]=function(e,n){return"number"!=typeof e?a["outer"+i].call(this,e):this.each(function(){t(this).css(o,s(this,e,!0,n)+"px")})}}),t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},t.ui.escapeSelector=function(){var t=/([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g;return function(e){return e.replace(t,"\\$1")}}(),t.fn.labels=function(){var e,i,s,n,o;return this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(n=this.eq(0).parents("label"),s=this.attr("id"),s&&(e=this.eq(0).parents().last(),o=e.add(e.length?e.siblings():this.siblings()),i="label[for='"+t.ui.escapeSelector(s)+"']",n=n.add(o.find(i).addBack(i))),this.pushStack(n))},t.fn.scrollParent=function(e){var i=this.css("position"),s="absolute"===i,n=e?/(auto|scroll|hidden)/:/(auto|scroll)/,o=this.parents().filter(function(){var e=t(this);return s&&"static"===e.css("position")?!1:n.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==i&&o.length?o:t(this[0].ownerDocument||document)},t.extend(t.expr[":"],{tabbable:function(e){var i=t.attr(e,"tabindex"),s=null!=i;return(!s||i>=0)&&t.ui.focusable(e,s)}}),t.fn.extend({uniqueId:function(){var t=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++t)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&t(this).removeAttr("id")})}}),t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());var n=!1;t(document).on("mouseup",function(){n=!1}),t.widget("ui.mouse",{version:"1.12.1",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.on("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).on("click."+this.widgetName,function(i){return!0===t.data(i.target,e.widgetName+".preventClickEvent")?(t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){if(!n){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),this._mouseDownEvent=e;var i=this,s=1===e.which,o="string"==typeof this.options.cancel&&e.target.nodeName?t(e.target).closest(this.options.cancel).length:!1;return s&&!o&&this._mouseCapture(e)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(e)!==!1,!this._mouseStarted)?(e.preventDefault(),!0):(!0===t.data(e.target,this.widgetName+".preventClickEvent")&&t.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return i._mouseMove(t)},this._mouseUpDelegate=function(t){return i._mouseUp(t)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),n=!0,!0)):!0}},_mouseMove:function(e){if(this._mouseMoved){if(t.ui.ie&&(!document.documentMode||9>document.documentMode)&&!e.button)return this._mouseUp(e);if(!e.which)if(e.originalEvent.altKey||e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(e)}return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,n=!1,e.preventDefault()},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),t.ui.plugin={add:function(e,i,s){var n,o=t.ui[e].prototype;for(n in s)o.plugins[n]=o.plugins[n]||[],o.plugins[n].push([i,s[n]])},call:function(t,e,i,s){var n,o=t.plugins[e];if(o&&(s||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(n=0;o.length>n;n++)t.options[o[n][0]]&&o[n][1].apply(t.element,i)}},t.widget("ui.resizable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,classes:{"ui-resizable-se":"ui-icon ui-icon-gripsmall-diagonal-se"},containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(t){return parseFloat(t)||0},_isNumber:function(t){return!isNaN(parseFloat(t))},_hasScroll:function(e,i){if("hidden"===t(e).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",n=!1;return e[s]>0?!0:(e[s]=1,n=e[s]>0,e[s]=0,n)},_create:function(){var e,i=this.options,s=this;this._addClass("ui-resizable"),t.extend(this,{_aspectRatio:!!i.aspectRatio,aspectRatio:i.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:i.helper||i.ghost||i.animate?i.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(t("
").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,e={marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom"),marginLeft:this.originalElement.css("marginLeft")},this.element.css(e),this.originalElement.css("margin",0),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css(e),this._proportionallyResize()),this._setupHandles(),i.autoHide&&t(this.element).on("mouseenter",function(){i.disabled||(s._removeClass("ui-resizable-autohide"),s._handles.show())}).on("mouseleave",function(){i.disabled||s.resizing||(s._addClass("ui-resizable-autohide"),s._handles.hide())}),this._mouseInit()},_destroy:function(){this._mouseDestroy();var e,i=function(e){t(e).removeData("resizable").removeData("ui-resizable").off(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_setOption:function(t,e){switch(this._super(t,e),t){case"handles":this._removeHandles(),this._setupHandles();break;default:}},_setupHandles:function(){var e,i,s,n,o,a=this.options,r=this;if(this.handles=a.handles||(t(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=t(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),s=this.handles.split(","),this.handles={},i=0;s.length>i;i++)e=t.trim(s[i]),n="ui-resizable-"+e,o=t("
"),this._addClass(o,"ui-resizable-handle "+n),o.css({zIndex:a.zIndex}),this.handles[e]=".ui-resizable-"+e,this.element.append(o);this._renderAxis=function(e){var i,s,n,o;e=e||this.element;for(i in this.handles)this.handles[i].constructor===String?this.handles[i]=this.element.children(this.handles[i]).first().show():(this.handles[i].jquery||this.handles[i].nodeType)&&(this.handles[i]=t(this.handles[i]),this._on(this.handles[i],{mousedown:r._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(s=t(this.handles[i],this.element),o=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),e.css(n,o),this._proportionallyResize()),this._handles=this._handles.add(this.handles[i])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.on("mouseover",function(){r.resizing||(this.className&&(o=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),r.axis=o&&o[1]?o[1]:"se")}),a.autoHide&&(this._handles.hide(),this._addClass("ui-resizable-autohide"))},_removeHandles:function(){this._handles.remove()},_mouseCapture:function(e){var i,s,n=!1;for(i in this.handles)s=t(this.handles[i])[0],(s===e.target||t.contains(s,e.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(e){var i,s,n,o=this.options,a=this.element;return this.resizing=!0,this._renderProxy(),i=this._num(this.helper.css("left")),s=this._num(this.helper.css("top")),o.containment&&(i+=t(o.containment).scrollLeft()||0,s+=t(o.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:s},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:a.width(),height:a.height()},this.originalSize=this._helper?{width:a.outerWidth(),height:a.outerHeight()}:{width:a.width(),height:a.height()},this.sizeDiff={width:a.outerWidth()-a.width(),height:a.outerHeight()-a.height()},this.originalPosition={left:i,top:s},this.originalMousePosition={left:e.pageX,top:e.pageY},this.aspectRatio="number"==typeof o.aspectRatio?o.aspectRatio:this.originalSize.width/this.originalSize.height||1,n=t(".ui-resizable-"+this.axis).css("cursor"),t("body").css("cursor","auto"===n?this.axis+"-resize":n),this._addClass("ui-resizable-resizing"),this._propagate("start",e),!0},_mouseDrag:function(e){var i,s,n=this.originalMousePosition,o=this.axis,a=e.pageX-n.left||0,r=e.pageY-n.top||0,h=this._change[o];return this._updatePrevProperties(),h?(i=h.apply(this,[e,a,r]),this._updateVirtualBoundaries(e.shiftKey),(this._aspectRatio||e.shiftKey)&&(i=this._updateRatio(i,e)),i=this._respectSize(i,e),this._updateCache(i),this._propagate("resize",e),s=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),t.isEmptyObject(s)||(this._updatePrevProperties(),this._trigger("resize",e,this.ui()),this._applyChanges()),!1):!1},_mouseStop:function(e){this.resizing=!1;var i,s,n,o,a,r,h,l=this.options,c=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&this._hasScroll(i[0],"left")?0:c.sizeDiff.height,o=s?0:c.sizeDiff.width,a={width:c.helper.width()-o,height:c.helper.height()-n},r=parseFloat(c.element.css("left"))+(c.position.left-c.originalPosition.left)||null,h=parseFloat(c.element.css("top"))+(c.position.top-c.originalPosition.top)||null,l.animate||this.element.css(t.extend(a,{top:h,left:r})),c.helper.height(c.size.height),c.helper.width(c.size.width),this._helper&&!l.animate&&this._proportionallyResize()),t("body").css("cursor","auto"),this._removeClass("ui-resizable-resizing"),this._propagate("stop",e),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var t={};return this.position.top!==this.prevPosition.top&&(t.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(t.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(t.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(t.height=this.size.height+"px"),this.helper.css(t),t},_updateVirtualBoundaries:function(t){var e,i,s,n,o,a=this.options;o={minWidth:this._isNumber(a.minWidth)?a.minWidth:0,maxWidth:this._isNumber(a.maxWidth)?a.maxWidth:1/0,minHeight:this._isNumber(a.minHeight)?a.minHeight:0,maxHeight:this._isNumber(a.maxHeight)?a.maxHeight:1/0},(this._aspectRatio||t)&&(e=o.minHeight*this.aspectRatio,s=o.minWidth/this.aspectRatio,i=o.maxHeight*this.aspectRatio,n=o.maxWidth/this.aspectRatio,e>o.minWidth&&(o.minWidth=e),s>o.minHeight&&(o.minHeight=s),o.maxWidth>i&&(o.maxWidth=i),o.maxHeight>n&&(o.maxHeight=n)),this._vBoundaries=o},_updateCache:function(t){this.offset=this.helper.offset(),this._isNumber(t.left)&&(this.position.left=t.left),this._isNumber(t.top)&&(this.position.top=t.top),this._isNumber(t.height)&&(this.size.height=t.height),this._isNumber(t.width)&&(this.size.width=t.width)},_updateRatio:function(t){var e=this.position,i=this.size,s=this.axis;return this._isNumber(t.height)?t.width=t.height*this.aspectRatio:this._isNumber(t.width)&&(t.height=t.width/this.aspectRatio),"sw"===s&&(t.left=e.left+(i.width-t.width),t.top=null),"nw"===s&&(t.top=e.top+(i.height-t.height),t.left=e.left+(i.width-t.width)),t},_respectSize:function(t){var e=this._vBoundaries,i=this.axis,s=this._isNumber(t.width)&&e.maxWidth&&e.maxWidtht.width,a=this._isNumber(t.height)&&e.minHeight&&e.minHeight>t.height,r=this.originalPosition.left+this.originalSize.width,h=this.originalPosition.top+this.originalSize.height,l=/sw|nw|w/.test(i),c=/nw|ne|n/.test(i);return o&&(t.width=e.minWidth),a&&(t.height=e.minHeight),s&&(t.width=e.maxWidth),n&&(t.height=e.maxHeight),o&&l&&(t.left=r-e.minWidth),s&&l&&(t.left=r-e.maxWidth),a&&c&&(t.top=h-e.minHeight),n&&c&&(t.top=h-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_getPaddingPlusBorderDimensions:function(t){for(var e=0,i=[],s=[t.css("borderTopWidth"),t.css("borderRightWidth"),t.css("borderBottomWidth"),t.css("borderLeftWidth")],n=[t.css("paddingTop"),t.css("paddingRight"),t.css("paddingBottom"),t.css("paddingLeft")];4>e;e++)i[e]=parseFloat(s[e])||0,i[e]+=parseFloat(n[e])||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var t,e=0,i=this.helper||this.element;this._proportionallyResizeElements.length>e;e++)t=this._proportionallyResizeElements[e],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(t)),t.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var e=this.element,i=this.options;this.elementOffset=e.offset(),this._helper?(this.helper=this.helper||t("
"),this._addClass(this.helper,this._helper),this.helper.css({width:this.element.outerWidth(),height:this.element.outerHeight(),position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element +},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize,s=this.originalPosition;return{left:s.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},sw:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[e,i,s]))},ne:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},nw:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[e,i,s]))}},_propagate:function(e,i){t.ui.plugin.call(this,e,[i,this.ui()]),"resize"!==e&&this._trigger(e,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),t.ui.plugin.add("resizable","animate",{stop:function(e){var i=t(this).resizable("instance"),s=i.options,n=i._proportionallyResizeElements,o=n.length&&/textarea/i.test(n[0].nodeName),a=o&&i._hasScroll(n[0],"left")?0:i.sizeDiff.height,r=o?0:i.sizeDiff.width,h={width:i.size.width-r,height:i.size.height-a},l=parseFloat(i.element.css("left"))+(i.position.left-i.originalPosition.left)||null,c=parseFloat(i.element.css("top"))+(i.position.top-i.originalPosition.top)||null;i.element.animate(t.extend(h,c&&l?{top:c,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseFloat(i.element.css("width")),height:parseFloat(i.element.css("height")),top:parseFloat(i.element.css("top")),left:parseFloat(i.element.css("left"))};n&&n.length&&t(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",e)}})}}),t.ui.plugin.add("resizable","containment",{start:function(){var e,i,s,n,o,a,r,h=t(this).resizable("instance"),l=h.options,c=h.element,u=l.containment,d=u instanceof t?u.get(0):/parent/.test(u)?c.parent().get(0):u;d&&(h.containerElement=t(d),/document/.test(u)||u===document?(h.containerOffset={left:0,top:0},h.containerPosition={left:0,top:0},h.parentData={element:t(document),left:0,top:0,width:t(document).width(),height:t(document).height()||document.body.parentNode.scrollHeight}):(e=t(d),i=[],t(["Top","Right","Left","Bottom"]).each(function(t,s){i[t]=h._num(e.css("padding"+s))}),h.containerOffset=e.offset(),h.containerPosition=e.position(),h.containerSize={height:e.innerHeight()-i[3],width:e.innerWidth()-i[1]},s=h.containerOffset,n=h.containerSize.height,o=h.containerSize.width,a=h._hasScroll(d,"left")?d.scrollWidth:o,r=h._hasScroll(d)?d.scrollHeight:n,h.parentData={element:d,left:s.left,top:s.top,width:a,height:r}))},resize:function(e){var i,s,n,o,a=t(this).resizable("instance"),r=a.options,h=a.containerOffset,l=a.position,c=a._aspectRatio||e.shiftKey,u={top:0,left:0},d=a.containerElement,p=!0;d[0]!==document&&/static/.test(d.css("position"))&&(u=h),l.left<(a._helper?h.left:0)&&(a.size.width=a.size.width+(a._helper?a.position.left-h.left:a.position.left-u.left),c&&(a.size.height=a.size.width/a.aspectRatio,p=!1),a.position.left=r.helper?h.left:0),l.top<(a._helper?h.top:0)&&(a.size.height=a.size.height+(a._helper?a.position.top-h.top:a.position.top),c&&(a.size.width=a.size.height*a.aspectRatio,p=!1),a.position.top=a._helper?h.top:0),n=a.containerElement.get(0)===a.element.parent().get(0),o=/relative|absolute/.test(a.containerElement.css("position")),n&&o?(a.offset.left=a.parentData.left+a.position.left,a.offset.top=a.parentData.top+a.position.top):(a.offset.left=a.element.offset().left,a.offset.top=a.element.offset().top),i=Math.abs(a.sizeDiff.width+(a._helper?a.offset.left-u.left:a.offset.left-h.left)),s=Math.abs(a.sizeDiff.height+(a._helper?a.offset.top-u.top:a.offset.top-h.top)),i+a.size.width>=a.parentData.width&&(a.size.width=a.parentData.width-i,c&&(a.size.height=a.size.width/a.aspectRatio,p=!1)),s+a.size.height>=a.parentData.height&&(a.size.height=a.parentData.height-s,c&&(a.size.width=a.size.height*a.aspectRatio,p=!1)),p||(a.position.left=a.prevPosition.left,a.position.top=a.prevPosition.top,a.size.width=a.prevSize.width,a.size.height=a.prevSize.height)},stop:function(){var e=t(this).resizable("instance"),i=e.options,s=e.containerOffset,n=e.containerPosition,o=e.containerElement,a=t(e.helper),r=a.offset(),h=a.outerWidth()-e.sizeDiff.width,l=a.outerHeight()-e.sizeDiff.height;e._helper&&!i.animate&&/relative/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l}),e._helper&&!i.animate&&/static/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l})}}),t.ui.plugin.add("resizable","alsoResize",{start:function(){var e=t(this).resizable("instance"),i=e.options;t(i.alsoResize).each(function(){var e=t(this);e.data("ui-resizable-alsoresize",{width:parseFloat(e.width()),height:parseFloat(e.height()),left:parseFloat(e.css("left")),top:parseFloat(e.css("top"))})})},resize:function(e,i){var s=t(this).resizable("instance"),n=s.options,o=s.originalSize,a=s.originalPosition,r={height:s.size.height-o.height||0,width:s.size.width-o.width||0,top:s.position.top-a.top||0,left:s.position.left-a.left||0};t(n.alsoResize).each(function(){var e=t(this),s=t(this).data("ui-resizable-alsoresize"),n={},o=e.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];t.each(o,function(t,e){var i=(s[e]||0)+(r[e]||0);i&&i>=0&&(n[e]=i||null)}),e.css(n)})},stop:function(){t(this).removeData("ui-resizable-alsoresize")}}),t.ui.plugin.add("resizable","ghost",{start:function(){var e=t(this).resizable("instance"),i=e.size;e.ghost=e.originalElement.clone(),e.ghost.css({opacity:.25,display:"block",position:"relative",height:i.height,width:i.width,margin:0,left:0,top:0}),e._addClass(e.ghost,"ui-resizable-ghost"),t.uiBackCompat!==!1&&"string"==typeof e.options.ghost&&e.ghost.addClass(this.options.ghost),e.ghost.appendTo(e.helper)},resize:function(){var e=t(this).resizable("instance");e.ghost&&e.ghost.css({position:"relative",height:e.size.height,width:e.size.width})},stop:function(){var e=t(this).resizable("instance");e.ghost&&e.helper&&e.helper.get(0).removeChild(e.ghost.get(0))}}),t.ui.plugin.add("resizable","grid",{resize:function(){var e,i=t(this).resizable("instance"),s=i.options,n=i.size,o=i.originalSize,a=i.originalPosition,r=i.axis,h="number"==typeof s.grid?[s.grid,s.grid]:s.grid,l=h[0]||1,c=h[1]||1,u=Math.round((n.width-o.width)/l)*l,d=Math.round((n.height-o.height)/c)*c,p=o.width+u,f=o.height+d,m=s.maxWidth&&p>s.maxWidth,g=s.maxHeight&&f>s.maxHeight,_=s.minWidth&&s.minWidth>p,v=s.minHeight&&s.minHeight>f;s.grid=h,_&&(p+=l),v&&(f+=c),m&&(p-=l),g&&(f-=c),/^(se|s|e)$/.test(r)?(i.size.width=p,i.size.height=f):/^(ne)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.top=a.top-d):/^(sw)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.left=a.left-u):((0>=f-c||0>=p-l)&&(e=i._getPaddingPlusBorderDimensions(this)),f-c>0?(i.size.height=f,i.position.top=a.top-d):(f=c-e.height,i.size.height=f,i.position.top=a.top+o.height-f),p-l>0?(i.size.width=p,i.position.left=a.left-u):(p=l-e.width,i.size.width=p,i.position.left=a.left+o.width-p))}}),t.ui.resizable});/** + * Copyright (c) 2007 Ariel Flesler - aflesler ○ gmail • com | https://github.com/flesler + * Licensed under MIT + * @author Ariel Flesler + * @version 2.1.2 + */ +;(function(f){"use strict";"function"===typeof define&&define.amd?define(["jquery"],f):"undefined"!==typeof module&&module.exports?module.exports=f(require("jquery")):f(jQuery)})(function($){"use strict";function n(a){return!a.nodeName||-1!==$.inArray(a.nodeName.toLowerCase(),["iframe","#document","html","body"])}function h(a){return $.isFunction(a)||$.isPlainObject(a)?a:{top:a,left:a}}var p=$.scrollTo=function(a,d,b){return $(window).scrollTo(a,d,b)};p.defaults={axis:"xy",duration:0,limit:!0};$.fn.scrollTo=function(a,d,b){"object"=== typeof d&&(b=d,d=0);"function"===typeof b&&(b={onAfter:b});"max"===a&&(a=9E9);b=$.extend({},p.defaults,b);d=d||b.duration;var u=b.queue&&1=f[g]?0:Math.min(f[g],n));!a&&1-1){targetElements.on(evt+EVENT_NAMESPACE,function elementToggle(event){$.powerTip.toggle(this,event)})}else{targetElements.on(evt+EVENT_NAMESPACE,function elementOpen(event){$.powerTip.show(this,event)})}});$.each(options.closeEvents,function(idx,evt){if($.inArray(evt,options.openEvents)<0){targetElements.on(evt+EVENT_NAMESPACE,function elementClose(event){$.powerTip.hide(this,!isMouseEvent(event))})}});targetElements.on("keydown"+EVENT_NAMESPACE,function elementKeyDown(event){if(event.keyCode===27){$.powerTip.hide(this,true)}})}return targetElements};$.fn.powerTip.defaults={fadeInTime:200,fadeOutTime:100,followMouse:false,popupId:"powerTip",popupClass:null,intentSensitivity:7,intentPollInterval:100,closeDelay:100,placement:"n",smartPlacement:false,offset:10,mouseOnToPopup:false,manual:false,openEvents:["mouseenter","focus"],closeEvents:["mouseleave","blur"]};$.fn.powerTip.smartPlacementLists={n:["n","ne","nw","s"],e:["e","ne","se","w","nw","sw","n","s","e"],s:["s","se","sw","n"],w:["w","nw","sw","e","ne","se","n","s","w"],nw:["nw","w","sw","n","s","se","nw"],ne:["ne","e","se","n","s","sw","ne"],sw:["sw","w","nw","s","n","ne","sw"],se:["se","e","ne","s","n","nw","se"],"nw-alt":["nw-alt","n","ne-alt","sw-alt","s","se-alt","w","e"],"ne-alt":["ne-alt","n","nw-alt","se-alt","s","sw-alt","e","w"],"sw-alt":["sw-alt","s","se-alt","nw-alt","n","ne-alt","w","e"],"se-alt":["se-alt","s","sw-alt","ne-alt","n","nw-alt","e","w"]};$.powerTip={show:function apiShowTip(element,event){if(isMouseEvent(event)){trackMouse(event);session.previousX=event.pageX;session.previousY=event.pageY;$(element).data(DATA_DISPLAYCONTROLLER).show()}else{$(element).first().data(DATA_DISPLAYCONTROLLER).show(true,true)}return element},reposition:function apiResetPosition(element){$(element).first().data(DATA_DISPLAYCONTROLLER).resetPosition();return element},hide:function apiCloseTip(element,immediate){var displayController;immediate=element?immediate:true;if(element){displayController=$(element).first().data(DATA_DISPLAYCONTROLLER)}else if(session.activeHover){displayController=session.activeHover.data(DATA_DISPLAYCONTROLLER)}if(displayController){displayController.hide(immediate)}return element},toggle:function apiToggle(element,event){if(session.activeHover&&session.activeHover.is(element)){$.powerTip.hide(element,!isMouseEvent(event))}else{$.powerTip.show(element,event)}return element}};$.powerTip.showTip=$.powerTip.show;$.powerTip.closeTip=$.powerTip.hide;function CSSCoordinates(){var me=this;me.top="auto";me.left="auto";me.right="auto";me.bottom="auto";me.set=function(property,value){if($.isNumeric(value)){me[property]=Math.round(value)}}}function DisplayController(element,options,tipController){var hoverTimer=null,myCloseDelay=null;function openTooltip(immediate,forceOpen){cancelTimer();if(!element.data(DATA_HASACTIVEHOVER)){if(!immediate){session.tipOpenImminent=true;hoverTimer=setTimeout(function intentDelay(){hoverTimer=null;checkForIntent()},options.intentPollInterval)}else{if(forceOpen){element.data(DATA_FORCEDOPEN,true)}closeAnyDelayed();tipController.showTip(element)}}else{cancelClose()}}function closeTooltip(disableDelay){if(myCloseDelay){myCloseDelay=session.closeDelayTimeout=clearTimeout(myCloseDelay);session.delayInProgress=false}cancelTimer();session.tipOpenImminent=false;if(element.data(DATA_HASACTIVEHOVER)){element.data(DATA_FORCEDOPEN,false);if(!disableDelay){session.delayInProgress=true;session.closeDelayTimeout=setTimeout(function closeDelay(){session.closeDelayTimeout=null;tipController.hideTip(element);session.delayInProgress=false;myCloseDelay=null},options.closeDelay);myCloseDelay=session.closeDelayTimeout}else{tipController.hideTip(element)}}}function checkForIntent(){var xDifference=Math.abs(session.previousX-session.currentX),yDifference=Math.abs(session.previousY-session.currentY),totalDifference=xDifference+yDifference;if(totalDifference",{id:options.popupId});if($body.length===0){$body=$("body")}$body.append(tipElement);session.tooltips=session.tooltips?session.tooltips.add(tipElement):tipElement}if(options.followMouse){if(!tipElement.data(DATA_HASMOUSEMOVE)){$document.on("mousemove"+EVENT_NAMESPACE,positionTipOnCursor);$window.on("scroll"+EVENT_NAMESPACE,positionTipOnCursor);tipElement.data(DATA_HASMOUSEMOVE,true)}}function beginShowTip(element){element.data(DATA_HASACTIVEHOVER,true);tipElement.queue(function queueTipInit(next){showTip(element);next()})}function showTip(element){var tipContent;if(!element.data(DATA_HASACTIVEHOVER)){return}if(session.isTipOpen){if(!session.isClosing){hideTip(session.activeHover)}tipElement.delay(100).queue(function queueTipAgain(next){showTip(element);next()});return}element.trigger("powerTipPreRender");tipContent=getTooltipContent(element);if(tipContent){tipElement.empty().append(tipContent)}else{return}element.trigger("powerTipRender");session.activeHover=element;session.isTipOpen=true;tipElement.data(DATA_MOUSEONTOTIP,options.mouseOnToPopup);tipElement.addClass(options.popupClass);if(!options.followMouse||element.data(DATA_FORCEDOPEN)){positionTipOnElement(element);session.isFixedTipOpen=true}else{positionTipOnCursor()}if(!element.data(DATA_FORCEDOPEN)&&!options.followMouse){$document.on("click"+EVENT_NAMESPACE,function documentClick(event){var target=event.target;if(target!==element[0]){if(options.mouseOnToPopup){if(target!==tipElement[0]&&!$.contains(tipElement[0],target)){$.powerTip.hide()}}else{$.powerTip.hide()}}})}if(options.mouseOnToPopup&&!options.manual){tipElement.on("mouseenter"+EVENT_NAMESPACE,function tipMouseEnter(){if(session.activeHover){session.activeHover.data(DATA_DISPLAYCONTROLLER).cancel()}});tipElement.on("mouseleave"+EVENT_NAMESPACE,function tipMouseLeave(){if(session.activeHover){session.activeHover.data(DATA_DISPLAYCONTROLLER).hide()}})}tipElement.fadeIn(options.fadeInTime,function fadeInCallback(){if(!session.desyncTimeout){session.desyncTimeout=setInterval(closeDesyncedTip,500)}element.trigger("powerTipOpen")})}function hideTip(element){session.isClosing=true;session.isTipOpen=false;session.desyncTimeout=clearInterval(session.desyncTimeout);element.data(DATA_HASACTIVEHOVER,false);element.data(DATA_FORCEDOPEN,false);$document.off("click"+EVENT_NAMESPACE);tipElement.off(EVENT_NAMESPACE);tipElement.fadeOut(options.fadeOutTime,function fadeOutCallback(){var coords=new CSSCoordinates;session.activeHover=null;session.isClosing=false;session.isFixedTipOpen=false;tipElement.removeClass();coords.set("top",session.currentY+options.offset);coords.set("left",session.currentX+options.offset);tipElement.css(coords);element.trigger("powerTipClose")})}function positionTipOnCursor(){var tipWidth,tipHeight,coords,collisions,collisionCount;if(!session.isFixedTipOpen&&(session.isTipOpen||session.tipOpenImminent&&tipElement.data(DATA_HASMOUSEMOVE))){tipWidth=tipElement.outerWidth();tipHeight=tipElement.outerHeight();coords=new CSSCoordinates;coords.set("top",session.currentY+options.offset);coords.set("left",session.currentX+options.offset);collisions=getViewportCollisions(coords,tipWidth,tipHeight);if(collisions!==Collision.none){collisionCount=countFlags(collisions);if(collisionCount===1){if(collisions===Collision.right){coords.set("left",session.scrollLeft+session.windowWidth-tipWidth)}else if(collisions===Collision.bottom){coords.set("top",session.scrollTop+session.windowHeight-tipHeight)}}else{coords.set("left",session.currentX-tipWidth-options.offset);coords.set("top",session.currentY-tipHeight-options.offset)}}tipElement.css(coords)}}function positionTipOnElement(element){var priorityList,finalPlacement;if(options.smartPlacement||options.followMouse&&element.data(DATA_FORCEDOPEN)){priorityList=$.fn.powerTip.smartPlacementLists[options.placement];$.each(priorityList,function(idx,pos){var collisions=getViewportCollisions(placeTooltip(element,pos),tipElement.outerWidth(),tipElement.outerHeight());finalPlacement=pos;return collisions!==Collision.none})}else{placeTooltip(element,options.placement);finalPlacement=options.placement}tipElement.removeClass("w nw sw e ne se n s w se-alt sw-alt ne-alt nw-alt");tipElement.addClass(finalPlacement)}function placeTooltip(element,placement){var iterationCount=0,tipWidth,tipHeight,coords=new CSSCoordinates;coords.set("top",0);coords.set("left",0);tipElement.css(coords);do{tipWidth=tipElement.outerWidth();tipHeight=tipElement.outerHeight();coords=placementCalculator.compute(element,placement,tipWidth,tipHeight,options.offset);tipElement.css(coords)}while(++iterationCount<=5&&(tipWidth!==tipElement.outerWidth()||tipHeight!==tipElement.outerHeight()));return coords}function closeDesyncedTip(){var isDesynced=false,hasDesyncableCloseEvent=$.grep(["mouseleave","mouseout","blur","focusout"],function(eventType){return $.inArray(eventType,options.closeEvents)!==-1}).length>0;if(session.isTipOpen&&!session.isClosing&&!session.delayInProgress&&hasDesyncableCloseEvent){if(session.activeHover.data(DATA_HASACTIVEHOVER)===false||session.activeHover.is(":disabled")){isDesynced=true}else if(!isMouseOver(session.activeHover)&&!session.activeHover.is(":focus")&&!session.activeHover.data(DATA_FORCEDOPEN)){if(tipElement.data(DATA_MOUSEONTOTIP)){if(!isMouseOver(tipElement)){isDesynced=true}}else{isDesynced=true}}if(isDesynced){hideTip(session.activeHover)}}}this.showTip=beginShowTip;this.hideTip=hideTip;this.resetPosition=positionTipOnElement}function isSvgElement(element){return Boolean(window.SVGElement&&element[0]instanceof SVGElement)}function isMouseEvent(event){return Boolean(event&&$.inArray(event.type,MOUSE_EVENTS)>-1&&typeof event.pageX==="number")}function initTracking(){if(!session.mouseTrackingActive){session.mouseTrackingActive=true;getViewportDimensions();$(getViewportDimensions);$document.on("mousemove"+EVENT_NAMESPACE,trackMouse);$window.on("resize"+EVENT_NAMESPACE,trackResize);$window.on("scroll"+EVENT_NAMESPACE,trackScroll)}}function getViewportDimensions(){session.scrollLeft=$window.scrollLeft();session.scrollTop=$window.scrollTop();session.windowWidth=$window.width();session.windowHeight=$window.height()}function trackResize(){session.windowWidth=$window.width();session.windowHeight=$window.height()}function trackScroll(){var x=$window.scrollLeft(),y=$window.scrollTop();if(x!==session.scrollLeft){session.currentX+=x-session.scrollLeft;session.scrollLeft=x}if(y!==session.scrollTop){session.currentY+=y-session.scrollTop;session.scrollTop=y}}function trackMouse(event){session.currentX=event.pageX;session.currentY=event.pageY}function isMouseOver(element){var elementPosition=element.offset(),elementBox=element[0].getBoundingClientRect(),elementWidth=elementBox.right-elementBox.left,elementHeight=elementBox.bottom-elementBox.top;return session.currentX>=elementPosition.left&&session.currentX<=elementPosition.left+elementWidth&&session.currentY>=elementPosition.top&&session.currentY<=elementPosition.top+elementHeight}function getTooltipContent(element){var tipText=element.data(DATA_POWERTIP),tipObject=element.data(DATA_POWERTIPJQ),tipTarget=element.data(DATA_POWERTIPTARGET),targetElement,content;if(tipText){if($.isFunction(tipText)){tipText=tipText.call(element[0])}content=tipText}else if(tipObject){if($.isFunction(tipObject)){tipObject=tipObject.call(element[0])}if(tipObject.length>0){content=tipObject.clone(true,true)}}else if(tipTarget){targetElement=$("#"+tipTarget);if(targetElement.length>0){content=targetElement.html()}}return content}function getViewportCollisions(coords,elementWidth,elementHeight){var viewportTop=session.scrollTop,viewportLeft=session.scrollLeft,viewportBottom=viewportTop+session.windowHeight,viewportRight=viewportLeft+session.windowWidth,collisions=Collision.none;if(coords.topviewportBottom||Math.abs(coords.bottom-session.windowHeight)>viewportBottom){collisions|=Collision.bottom}if(coords.leftviewportRight){collisions|=Collision.left}if(coords.left+elementWidth>viewportRight||coords.right1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery);/*! SmartMenus jQuery Plugin - v1.1.0 - September 17, 2017 + * http://www.smartmenus.org/ + * Copyright Vasil Dinkov, Vadikom Web Ltd. http://vadikom.com; Licensed MIT */(function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&"object"==typeof module.exports?module.exports=t(require("jquery")):t(jQuery)})(function($){function initMouseDetection(t){var e=".smartmenus_mouse";if(mouseDetectionEnabled||t)mouseDetectionEnabled&&t&&($(document).off(e),mouseDetectionEnabled=!1);else{var i=!0,s=null,o={mousemove:function(t){var e={x:t.pageX,y:t.pageY,timeStamp:(new Date).getTime()};if(s){var o=Math.abs(s.x-e.x),a=Math.abs(s.y-e.y);if((o>0||a>0)&&2>=o&&2>=a&&300>=e.timeStamp-s.timeStamp&&(mouse=!0,i)){var n=$(t.target).closest("a");n.is("a")&&$.each(menuTrees,function(){return $.contains(this.$root[0],n[0])?(this.itemEnter({currentTarget:n[0]}),!1):void 0}),i=!1}}s=e}};o[touchEvents?"touchstart":"pointerover pointermove pointerout MSPointerOver MSPointerMove MSPointerOut"]=function(t){isTouchEvent(t.originalEvent)&&(mouse=!1)},$(document).on(getEventsNS(o,e)),mouseDetectionEnabled=!0}}function isTouchEvent(t){return!/^(4|mouse)$/.test(t.pointerType)}function getEventsNS(t,e){e||(e="");var i={};for(var s in t)i[s.split(" ").join(e+" ")+e]=t[s];return i}var menuTrees=[],mouse=!1,touchEvents="ontouchstart"in window,mouseDetectionEnabled=!1,requestAnimationFrame=window.requestAnimationFrame||function(t){return setTimeout(t,1e3/60)},cancelAnimationFrame=window.cancelAnimationFrame||function(t){clearTimeout(t)},canAnimate=!!$.fn.animate;return $.SmartMenus=function(t,e){this.$root=$(t),this.opts=e,this.rootId="",this.accessIdPrefix="",this.$subArrow=null,this.activatedItems=[],this.visibleSubMenus=[],this.showTimeout=0,this.hideTimeout=0,this.scrollTimeout=0,this.clickActivated=!1,this.focusActivated=!1,this.zIndexInc=0,this.idInc=0,this.$firstLink=null,this.$firstSub=null,this.disabled=!1,this.$disableOverlay=null,this.$touchScrollingSub=null,this.cssTransforms3d="perspective"in t.style||"webkitPerspective"in t.style,this.wasCollapsible=!1,this.init()},$.extend($.SmartMenus,{hideAll:function(){$.each(menuTrees,function(){this.menuHideAll()})},destroy:function(){for(;menuTrees.length;)menuTrees[0].destroy();initMouseDetection(!0)},prototype:{init:function(t){var e=this;if(!t){menuTrees.push(this),this.rootId=((new Date).getTime()+Math.random()+"").replace(/\D/g,""),this.accessIdPrefix="sm-"+this.rootId+"-",this.$root.hasClass("sm-rtl")&&(this.opts.rightToLeftSubMenus=!0);var i=".smartmenus";this.$root.data("smartmenus",this).attr("data-smartmenus-id",this.rootId).dataSM("level",1).on(getEventsNS({"mouseover focusin":$.proxy(this.rootOver,this),"mouseout focusout":$.proxy(this.rootOut,this),keydown:$.proxy(this.rootKeyDown,this)},i)).on(getEventsNS({mouseenter:$.proxy(this.itemEnter,this),mouseleave:$.proxy(this.itemLeave,this),mousedown:$.proxy(this.itemDown,this),focus:$.proxy(this.itemFocus,this),blur:$.proxy(this.itemBlur,this),click:$.proxy(this.itemClick,this)},i),"a"),i+=this.rootId,this.opts.hideOnClick&&$(document).on(getEventsNS({touchstart:$.proxy(this.docTouchStart,this),touchmove:$.proxy(this.docTouchMove,this),touchend:$.proxy(this.docTouchEnd,this),click:$.proxy(this.docClick,this)},i)),$(window).on(getEventsNS({"resize orientationchange":$.proxy(this.winResize,this)},i)),this.opts.subIndicators&&(this.$subArrow=$("").addClass("sub-arrow"),this.opts.subIndicatorsText&&this.$subArrow.html(this.opts.subIndicatorsText)),initMouseDetection()}if(this.$firstSub=this.$root.find("ul").each(function(){e.menuInit($(this))}).eq(0),this.$firstLink=this.$root.find("a").eq(0),this.opts.markCurrentItem){var s=/(index|default)\.[^#\?\/]*/i,o=/#.*/,a=window.location.href.replace(s,""),n=a.replace(o,"");this.$root.find("a").each(function(){var t=this.href.replace(s,""),i=$(this);(t==a||t==n)&&(i.addClass("current"),e.opts.markCurrentTree&&i.parentsUntil("[data-smartmenus-id]","ul").each(function(){$(this).dataSM("parent-a").addClass("current")}))})}this.wasCollapsible=this.isCollapsible()},destroy:function(t){if(!t){var e=".smartmenus";this.$root.removeData("smartmenus").removeAttr("data-smartmenus-id").removeDataSM("level").off(e),e+=this.rootId,$(document).off(e),$(window).off(e),this.opts.subIndicators&&(this.$subArrow=null)}this.menuHideAll();var i=this;this.$root.find("ul").each(function(){var t=$(this);t.dataSM("scroll-arrows")&&t.dataSM("scroll-arrows").remove(),t.dataSM("shown-before")&&((i.opts.subMenusMinWidth||i.opts.subMenusMaxWidth)&&t.css({width:"",minWidth:"",maxWidth:""}).removeClass("sm-nowrap"),t.dataSM("scroll-arrows")&&t.dataSM("scroll-arrows").remove(),t.css({zIndex:"",top:"",left:"",marginLeft:"",marginTop:"",display:""})),0==(t.attr("id")||"").indexOf(i.accessIdPrefix)&&t.removeAttr("id")}).removeDataSM("in-mega").removeDataSM("shown-before").removeDataSM("scroll-arrows").removeDataSM("parent-a").removeDataSM("level").removeDataSM("beforefirstshowfired").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeAttr("aria-expanded"),this.$root.find("a.has-submenu").each(function(){var t=$(this);0==t.attr("id").indexOf(i.accessIdPrefix)&&t.removeAttr("id")}).removeClass("has-submenu").removeDataSM("sub").removeAttr("aria-haspopup").removeAttr("aria-controls").removeAttr("aria-expanded").closest("li").removeDataSM("sub"),this.opts.subIndicators&&this.$root.find("span.sub-arrow").remove(),this.opts.markCurrentItem&&this.$root.find("a.current").removeClass("current"),t||(this.$root=null,this.$firstLink=null,this.$firstSub=null,this.$disableOverlay&&(this.$disableOverlay.remove(),this.$disableOverlay=null),menuTrees.splice($.inArray(this,menuTrees),1))},disable:function(t){if(!this.disabled){if(this.menuHideAll(),!t&&!this.opts.isPopup&&this.$root.is(":visible")){var e=this.$root.offset();this.$disableOverlay=$('
').css({position:"absolute",top:e.top,left:e.left,width:this.$root.outerWidth(),height:this.$root.outerHeight(),zIndex:this.getStartZIndex(!0),opacity:0}).appendTo(document.body)}this.disabled=!0}},docClick:function(t){return this.$touchScrollingSub?(this.$touchScrollingSub=null,void 0):((this.visibleSubMenus.length&&!$.contains(this.$root[0],t.target)||$(t.target).closest("a").length)&&this.menuHideAll(),void 0)},docTouchEnd:function(){if(this.lastTouch){if(!(!this.visibleSubMenus.length||void 0!==this.lastTouch.x2&&this.lastTouch.x1!=this.lastTouch.x2||void 0!==this.lastTouch.y2&&this.lastTouch.y1!=this.lastTouch.y2||this.lastTouch.target&&$.contains(this.$root[0],this.lastTouch.target))){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0);var t=this;this.hideTimeout=setTimeout(function(){t.menuHideAll()},350)}this.lastTouch=null}},docTouchMove:function(t){if(this.lastTouch){var e=t.originalEvent.touches[0];this.lastTouch.x2=e.pageX,this.lastTouch.y2=e.pageY}},docTouchStart:function(t){var e=t.originalEvent.touches[0];this.lastTouch={x1:e.pageX,y1:e.pageY,target:e.target}},enable:function(){this.disabled&&(this.$disableOverlay&&(this.$disableOverlay.remove(),this.$disableOverlay=null),this.disabled=!1)},getClosestMenu:function(t){for(var e=$(t).closest("ul");e.dataSM("in-mega");)e=e.parent().closest("ul");return e[0]||null},getHeight:function(t){return this.getOffset(t,!0)},getOffset:function(t,e){var i;"none"==t.css("display")&&(i={position:t[0].style.position,visibility:t[0].style.visibility},t.css({position:"absolute",visibility:"hidden"}).show());var s=t[0].getBoundingClientRect&&t[0].getBoundingClientRect(),o=s&&(e?s.height||s.bottom-s.top:s.width||s.right-s.left);return o||0===o||(o=e?t[0].offsetHeight:t[0].offsetWidth),i&&t.hide().css(i),o},getStartZIndex:function(t){var e=parseInt(this[t?"$root":"$firstSub"].css("z-index"));return!t&&isNaN(e)&&(e=parseInt(this.$root.css("z-index"))),isNaN(e)?1:e},getTouchPoint:function(t){return t.touches&&t.touches[0]||t.changedTouches&&t.changedTouches[0]||t},getViewport:function(t){var e=t?"Height":"Width",i=document.documentElement["client"+e],s=window["inner"+e];return s&&(i=Math.min(i,s)),i},getViewportHeight:function(){return this.getViewport(!0)},getViewportWidth:function(){return this.getViewport()},getWidth:function(t){return this.getOffset(t)},handleEvents:function(){return!this.disabled&&this.isCSSOn()},handleItemEvents:function(t){return this.handleEvents()&&!this.isLinkInMegaMenu(t)},isCollapsible:function(){return"static"==this.$firstSub.css("position")},isCSSOn:function(){return"inline"!=this.$firstLink.css("display")},isFixed:function(){var t="fixed"==this.$root.css("position");return t||this.$root.parentsUntil("body").each(function(){return"fixed"==$(this).css("position")?(t=!0,!1):void 0}),t},isLinkInMegaMenu:function(t){return $(this.getClosestMenu(t[0])).hasClass("mega-menu")},isTouchMode:function(){return!mouse||this.opts.noMouseOver||this.isCollapsible()},itemActivate:function(t,e){var i=t.closest("ul"),s=i.dataSM("level");if(s>1&&(!this.activatedItems[s-2]||this.activatedItems[s-2][0]!=i.dataSM("parent-a")[0])){var o=this;$(i.parentsUntil("[data-smartmenus-id]","ul").get().reverse()).add(i).each(function(){o.itemActivate($(this).dataSM("parent-a"))})}if((!this.isCollapsible()||e)&&this.menuHideSubMenus(this.activatedItems[s-1]&&this.activatedItems[s-1][0]==t[0]?s:s-1),this.activatedItems[s-1]=t,this.$root.triggerHandler("activate.smapi",t[0])!==!1){var a=t.dataSM("sub");a&&(this.isTouchMode()||!this.opts.showOnClick||this.clickActivated)&&this.menuShow(a)}},itemBlur:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&this.$root.triggerHandler("blur.smapi",e[0])},itemClick:function(t){var e=$(t.currentTarget);if(this.handleItemEvents(e)){if(this.$touchScrollingSub&&this.$touchScrollingSub[0]==e.closest("ul")[0])return this.$touchScrollingSub=null,t.stopPropagation(),!1;if(this.$root.triggerHandler("click.smapi",e[0])===!1)return!1;var i=$(t.target).is(".sub-arrow"),s=e.dataSM("sub"),o=s?2==s.dataSM("level"):!1,a=this.isCollapsible(),n=/toggle$/.test(this.opts.collapsibleBehavior),r=/link$/.test(this.opts.collapsibleBehavior),h=/^accordion/.test(this.opts.collapsibleBehavior);if(s&&!s.is(":visible")){if((!r||!a||i)&&(this.opts.showOnClick&&o&&(this.clickActivated=!0),this.itemActivate(e,h),s.is(":visible")))return this.focusActivated=!0,!1}else if(a&&(n||i))return this.itemActivate(e,h),this.menuHide(s),n&&(this.focusActivated=!1),!1;return this.opts.showOnClick&&o||e.hasClass("disabled")||this.$root.triggerHandler("select.smapi",e[0])===!1?!1:void 0}},itemDown:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&e.dataSM("mousedown",!0)},itemEnter:function(t){var e=$(t.currentTarget);if(this.handleItemEvents(e)){if(!this.isTouchMode()){this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0);var i=this;this.showTimeout=setTimeout(function(){i.itemActivate(e)},this.opts.showOnClick&&1==e.closest("ul").dataSM("level")?1:this.opts.showTimeout)}this.$root.triggerHandler("mouseenter.smapi",e[0])}},itemFocus:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&(!this.focusActivated||this.isTouchMode()&&e.dataSM("mousedown")||this.activatedItems.length&&this.activatedItems[this.activatedItems.length-1][0]==e[0]||this.itemActivate(e,!0),this.$root.triggerHandler("focus.smapi",e[0]))},itemLeave:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&(this.isTouchMode()||(e[0].blur(),this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0)),e.removeDataSM("mousedown"),this.$root.triggerHandler("mouseleave.smapi",e[0]))},menuHide:function(t){if(this.$root.triggerHandler("beforehide.smapi",t[0])!==!1&&(canAnimate&&t.stop(!0,!0),"none"!=t.css("display"))){var e=function(){t.css("z-index","")};this.isCollapsible()?canAnimate&&this.opts.collapsibleHideFunction?this.opts.collapsibleHideFunction.call(this,t,e):t.hide(this.opts.collapsibleHideDuration,e):canAnimate&&this.opts.hideFunction?this.opts.hideFunction.call(this,t,e):t.hide(this.opts.hideDuration,e),t.dataSM("scroll")&&(this.menuScrollStop(t),t.css({"touch-action":"","-ms-touch-action":"","-webkit-transform":"",transform:""}).off(".smartmenus_scroll").removeDataSM("scroll").dataSM("scroll-arrows").hide()),t.dataSM("parent-a").removeClass("highlighted").attr("aria-expanded","false"),t.attr({"aria-expanded":"false","aria-hidden":"true"});var i=t.dataSM("level");this.activatedItems.splice(i-1,1),this.visibleSubMenus.splice($.inArray(t,this.visibleSubMenus),1),this.$root.triggerHandler("hide.smapi",t[0])}},menuHideAll:function(){this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0);for(var t=this.opts.isPopup?1:0,e=this.visibleSubMenus.length-1;e>=t;e--)this.menuHide(this.visibleSubMenus[e]);this.opts.isPopup&&(canAnimate&&this.$root.stop(!0,!0),this.$root.is(":visible")&&(canAnimate&&this.opts.hideFunction?this.opts.hideFunction.call(this,this.$root):this.$root.hide(this.opts.hideDuration))),this.activatedItems=[],this.visibleSubMenus=[],this.clickActivated=!1,this.focusActivated=!1,this.zIndexInc=0,this.$root.triggerHandler("hideAll.smapi")},menuHideSubMenus:function(t){for(var e=this.activatedItems.length-1;e>=t;e--){var i=this.activatedItems[e].dataSM("sub");i&&this.menuHide(i)}},menuInit:function(t){if(!t.dataSM("in-mega")){t.hasClass("mega-menu")&&t.find("ul").dataSM("in-mega",!0);for(var e=2,i=t[0];(i=i.parentNode.parentNode)!=this.$root[0];)e++;var s=t.prevAll("a").eq(-1);s.length||(s=t.prevAll().find("a").eq(-1)),s.addClass("has-submenu").dataSM("sub",t),t.dataSM("parent-a",s).dataSM("level",e).parent().dataSM("sub",t);var o=s.attr("id")||this.accessIdPrefix+ ++this.idInc,a=t.attr("id")||this.accessIdPrefix+ ++this.idInc;s.attr({id:o,"aria-haspopup":"true","aria-controls":a,"aria-expanded":"false"}),t.attr({id:a,role:"group","aria-hidden":"true","aria-labelledby":o,"aria-expanded":"false"}),this.opts.subIndicators&&s[this.opts.subIndicatorsPos](this.$subArrow.clone())}},menuPosition:function(t){var e,i,s=t.dataSM("parent-a"),o=s.closest("li"),a=o.parent(),n=t.dataSM("level"),r=this.getWidth(t),h=this.getHeight(t),u=s.offset(),l=u.left,c=u.top,d=this.getWidth(s),m=this.getHeight(s),p=$(window),f=p.scrollLeft(),v=p.scrollTop(),b=this.getViewportWidth(),S=this.getViewportHeight(),g=a.parent().is("[data-sm-horizontal-sub]")||2==n&&!a.hasClass("sm-vertical"),M=this.opts.rightToLeftSubMenus&&!o.is("[data-sm-reverse]")||!this.opts.rightToLeftSubMenus&&o.is("[data-sm-reverse]"),w=2==n?this.opts.mainMenuSubOffsetX:this.opts.subMenusSubOffsetX,T=2==n?this.opts.mainMenuSubOffsetY:this.opts.subMenusSubOffsetY;if(g?(e=M?d-r-w:w,i=this.opts.bottomToTopSubMenus?-h-T:m+T):(e=M?w-r:d-w,i=this.opts.bottomToTopSubMenus?m-T-h:T),this.opts.keepInViewport){var y=l+e,I=c+i;if(M&&f>y?e=g?f-y+e:d-w:!M&&y+r>f+b&&(e=g?f+b-r-y+e:w-r),g||(S>h&&I+h>v+S?i+=v+S-h-I:(h>=S||v>I)&&(i+=v-I)),g&&(I+h>v+S+.49||v>I)||!g&&h>S+.49){var x=this;t.dataSM("scroll-arrows")||t.dataSM("scroll-arrows",$([$('')[0],$('')[0]]).on({mouseenter:function(){t.dataSM("scroll").up=$(this).hasClass("scroll-up"),x.menuScroll(t)},mouseleave:function(e){x.menuScrollStop(t),x.menuScrollOut(t,e)},"mousewheel DOMMouseScroll":function(t){t.preventDefault()}}).insertAfter(t));var A=".smartmenus_scroll";if(t.dataSM("scroll",{y:this.cssTransforms3d?0:i-m,step:1,itemH:m,subH:h,arrowDownH:this.getHeight(t.dataSM("scroll-arrows").eq(1))}).on(getEventsNS({mouseover:function(e){x.menuScrollOver(t,e)},mouseout:function(e){x.menuScrollOut(t,e)},"mousewheel DOMMouseScroll":function(e){x.menuScrollMousewheel(t,e)}},A)).dataSM("scroll-arrows").css({top:"auto",left:"0",marginLeft:e+(parseInt(t.css("border-left-width"))||0),width:r-(parseInt(t.css("border-left-width"))||0)-(parseInt(t.css("border-right-width"))||0),zIndex:t.css("z-index")}).eq(g&&this.opts.bottomToTopSubMenus?0:1).show(),this.isFixed()){var C={};C[touchEvents?"touchstart touchmove touchend":"pointerdown pointermove pointerup MSPointerDown MSPointerMove MSPointerUp"]=function(e){x.menuScrollTouch(t,e)},t.css({"touch-action":"none","-ms-touch-action":"none"}).on(getEventsNS(C,A))}}}t.css({top:"auto",left:"0",marginLeft:e,marginTop:i-m})},menuScroll:function(t,e,i){var s,o=t.dataSM("scroll"),a=t.dataSM("scroll-arrows"),n=o.up?o.upEnd:o.downEnd;if(!e&&o.momentum){if(o.momentum*=.92,s=o.momentum,.5>s)return this.menuScrollStop(t),void 0}else s=i||(e||!this.opts.scrollAccelerate?this.opts.scrollStep:Math.floor(o.step));var r=t.dataSM("level");if(this.activatedItems[r-1]&&this.activatedItems[r-1].dataSM("sub")&&this.activatedItems[r-1].dataSM("sub").is(":visible")&&this.menuHideSubMenus(r-1),o.y=o.up&&o.y>=n||!o.up&&n>=o.y?o.y:Math.abs(n-o.y)>s?o.y+(o.up?s:-s):n,t.css(this.cssTransforms3d?{"-webkit-transform":"translate3d(0, "+o.y+"px, 0)",transform:"translate3d(0, "+o.y+"px, 0)"}:{marginTop:o.y}),mouse&&(o.up&&o.y>o.downEnd||!o.up&&o.y0;t.dataSM("scroll-arrows").eq(i?0:1).is(":visible")&&(t.dataSM("scroll").up=i,this.menuScroll(t,!0))}e.preventDefault()},menuScrollOut:function(t,e){mouse&&(/^scroll-(up|down)/.test((e.relatedTarget||"").className)||(t[0]==e.relatedTarget||$.contains(t[0],e.relatedTarget))&&this.getClosestMenu(e.relatedTarget)==t[0]||t.dataSM("scroll-arrows").css("visibility","hidden"))},menuScrollOver:function(t,e){if(mouse&&!/^scroll-(up|down)/.test(e.target.className)&&this.getClosestMenu(e.target)==t[0]){this.menuScrollRefreshData(t);var i=t.dataSM("scroll"),s=$(window).scrollTop()-t.dataSM("parent-a").offset().top-i.itemH;t.dataSM("scroll-arrows").eq(0).css("margin-top",s).end().eq(1).css("margin-top",s+this.getViewportHeight()-i.arrowDownH).end().css("visibility","visible")}},menuScrollRefreshData:function(t){var e=t.dataSM("scroll"),i=$(window).scrollTop()-t.dataSM("parent-a").offset().top-e.itemH;this.cssTransforms3d&&(i=-(parseFloat(t.css("margin-top"))-i)),$.extend(e,{upEnd:i,downEnd:i+this.getViewportHeight()-e.subH})},menuScrollStop:function(t){return this.scrollTimeout?(cancelAnimationFrame(this.scrollTimeout),this.scrollTimeout=0,t.dataSM("scroll").step=1,!0):void 0},menuScrollTouch:function(t,e){if(e=e.originalEvent,isTouchEvent(e)){var i=this.getTouchPoint(e);if(this.getClosestMenu(i.target)==t[0]){var s=t.dataSM("scroll");if(/(start|down)$/i.test(e.type))this.menuScrollStop(t)?(e.preventDefault(),this.$touchScrollingSub=t):this.$touchScrollingSub=null,this.menuScrollRefreshData(t),$.extend(s,{touchStartY:i.pageY,touchStartTime:e.timeStamp});else if(/move$/i.test(e.type)){var o=void 0!==s.touchY?s.touchY:s.touchStartY;if(void 0!==o&&o!=i.pageY){this.$touchScrollingSub=t;var a=i.pageY>o;void 0!==s.up&&s.up!=a&&$.extend(s,{touchStartY:i.pageY,touchStartTime:e.timeStamp}),$.extend(s,{up:a,touchY:i.pageY}),this.menuScroll(t,!0,Math.abs(i.pageY-o))}e.preventDefault()}else void 0!==s.touchY&&((s.momentum=15*Math.pow(Math.abs(i.pageY-s.touchStartY)/(e.timeStamp-s.touchStartTime),2))&&(this.menuScrollStop(t),this.menuScroll(t),e.preventDefault()),delete s.touchY)}}},menuShow:function(t){if((t.dataSM("beforefirstshowfired")||(t.dataSM("beforefirstshowfired",!0),this.$root.triggerHandler("beforefirstshow.smapi",t[0])!==!1))&&this.$root.triggerHandler("beforeshow.smapi",t[0])!==!1&&(t.dataSM("shown-before",!0),canAnimate&&t.stop(!0,!0),!t.is(":visible"))){var e=t.dataSM("parent-a"),i=this.isCollapsible();if((this.opts.keepHighlighted||i)&&e.addClass("highlighted"),i)t.removeClass("sm-nowrap").css({zIndex:"",width:"auto",minWidth:"",maxWidth:"",top:"",left:"",marginLeft:"",marginTop:""});else{if(t.css("z-index",this.zIndexInc=(this.zIndexInc||this.getStartZIndex())+1),(this.opts.subMenusMinWidth||this.opts.subMenusMaxWidth)&&(t.css({width:"auto",minWidth:"",maxWidth:""}).addClass("sm-nowrap"),this.opts.subMenusMinWidth&&t.css("min-width",this.opts.subMenusMinWidth),this.opts.subMenusMaxWidth)){var s=this.getWidth(t);t.css("max-width",this.opts.subMenusMaxWidth),s>this.getWidth(t)&&t.removeClass("sm-nowrap").css("width",this.opts.subMenusMaxWidth)}this.menuPosition(t)}var o=function(){t.css("overflow","")};i?canAnimate&&this.opts.collapsibleShowFunction?this.opts.collapsibleShowFunction.call(this,t,o):t.show(this.opts.collapsibleShowDuration,o):canAnimate&&this.opts.showFunction?this.opts.showFunction.call(this,t,o):t.show(this.opts.showDuration,o),e.attr("aria-expanded","true"),t.attr({"aria-expanded":"true","aria-hidden":"false"}),this.visibleSubMenus.push(t),this.$root.triggerHandler("show.smapi",t[0])}},popupHide:function(t){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0);var e=this;this.hideTimeout=setTimeout(function(){e.menuHideAll()},t?1:this.opts.hideTimeout)},popupShow:function(t,e){if(!this.opts.isPopup)return alert('SmartMenus jQuery Error:\n\nIf you want to show this menu via the "popupShow" method, set the isPopup:true option.'),void 0;if(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0),this.$root.dataSM("shown-before",!0),canAnimate&&this.$root.stop(!0,!0),!this.$root.is(":visible")){this.$root.css({left:t,top:e});var i=this,s=function(){i.$root.css("overflow","")};canAnimate&&this.opts.showFunction?this.opts.showFunction.call(this,this.$root,s):this.$root.show(this.opts.showDuration,s),this.visibleSubMenus[0]=this.$root}},refresh:function(){this.destroy(!0),this.init(!0)},rootKeyDown:function(t){if(this.handleEvents())switch(t.keyCode){case 27:var e=this.activatedItems[0];if(e){this.menuHideAll(),e[0].focus();var i=e.dataSM("sub");i&&this.menuHide(i)}break;case 32:var s=$(t.target);if(s.is("a")&&this.handleItemEvents(s)){var i=s.dataSM("sub");i&&!i.is(":visible")&&(this.itemClick({currentTarget:t.target}),t.preventDefault())}}},rootOut:function(t){if(this.handleEvents()&&!this.isTouchMode()&&t.target!=this.$root[0]&&(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0),!this.opts.showOnClick||!this.opts.hideOnClick)){var e=this;this.hideTimeout=setTimeout(function(){e.menuHideAll()},this.opts.hideTimeout)}},rootOver:function(t){this.handleEvents()&&!this.isTouchMode()&&t.target!=this.$root[0]&&this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0)},winResize:function(t){if(this.handleEvents()){if(!("onorientationchange"in window)||"orientationchange"==t.type){var e=this.isCollapsible();this.wasCollapsible&&e||(this.activatedItems.length&&this.activatedItems[this.activatedItems.length-1][0].blur(),this.menuHideAll()),this.wasCollapsible=e}}else if(this.$disableOverlay){var i=this.$root.offset();this.$disableOverlay.css({top:i.top,left:i.left,width:this.$root.outerWidth(),height:this.$root.outerHeight()})}}}}),$.fn.dataSM=function(t,e){return e?this.data(t+"_smartmenus",e):this.data(t+"_smartmenus")},$.fn.removeDataSM=function(t){return this.removeData(t+"_smartmenus")},$.fn.smartmenus=function(options){if("string"==typeof options){var args=arguments,method=options;return Array.prototype.shift.call(args),this.each(function(){var t=$(this).data("smartmenus");t&&t[method]&&t[method].apply(t,args)})}return this.each(function(){var dataOpts=$(this).data("sm-options")||null;if(dataOpts)try{dataOpts=eval("("+dataOpts+")")}catch(e){dataOpts=null,alert('ERROR\n\nSmartMenus jQuery init:\nInvalid "data-sm-options" attribute value syntax.')}new $.SmartMenus(this,$.extend({},$.fn.smartmenus.defaults,options,dataOpts))})},$.fn.smartmenus.defaults={isPopup:!1,mainMenuSubOffsetX:0,mainMenuSubOffsetY:0,subMenusSubOffsetX:0,subMenusSubOffsetY:0,subMenusMinWidth:"10em",subMenusMaxWidth:"20em",subIndicators:!0,subIndicatorsPos:"append",subIndicatorsText:"",scrollStep:30,scrollAccelerate:!0,showTimeout:250,hideTimeout:500,showDuration:0,showFunction:null,hideDuration:0,hideFunction:function(t,e){t.fadeOut(200,e)},collapsibleShowDuration:0,collapsibleShowFunction:function(t,e){t.slideDown(200,e)},collapsibleHideDuration:0,collapsibleHideFunction:function(t,e){t.slideUp(200,e)},showOnClick:!1,hideOnClick:!0,noMouseOver:!1,keepInViewport:!0,keepHighlighted:!0,markCurrentItem:!1,markCurrentTree:!0,rightToLeftSubMenus:!1,bottomToTopSubMenus:!1,collapsibleBehavior:"default"},$}); \ No newline at end of file diff --git a/doc/html/menu.js b/doc/html/menu.js new file mode 100644 index 0000000..54e81cf --- /dev/null +++ b/doc/html/menu.js @@ -0,0 +1,127 @@ +/* + @licstart The following is the entire license notice for the JavaScript code in this file. + + The MIT License (MIT) + + Copyright (C) 1997-2020 by Dimitri van Heesch + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software + and associated documentation files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, publish, distribute, + sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or + substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + @licend The above is the entire license notice for the JavaScript code in this file + */ +function initMenu(relPath,searchEnabled,serverSide,searchPage,search) { + function makeTree(data,relPath) { + var result=''; + if ('children' in data) { + result+=''; + } + return result; + } + var searchBox; + if (searchEnabled) { + if (serverSide) { + searchBox='
'+ + '
'+ + '
'+ + ''+ + '
'+ + '
'+ + '
'+ + '
'; + } else { + searchBox='
'+ + ''+ + ''+ + ''+ + ''+ + ''+ + '' + '' + '
'; + } + } + + $('#main-nav').before('
'+ + ''+ + ''+ + '
'); + $('#main-nav').append(makeTree(menudata,relPath)); + $('#main-nav').children(':first').addClass('sm sm-dox').attr('id','main-menu'); + if (searchBox) { + $('#main-menu').append('
  • '); + } + var $mainMenuState = $('#main-menu-state'); + var prevWidth = 0; + if ($mainMenuState.length) { + function initResizableIfExists() { + if (typeof initResizable==='function') initResizable(); + } + // animate mobile menu + $mainMenuState.change(function(e) { + var $menu = $('#main-menu'); + var options = { duration: 250, step: initResizableIfExists }; + if (this.checked) { + options['complete'] = function() { $menu.css('display', 'block') }; + $menu.hide().slideDown(options); + } else { + options['complete'] = function() { $menu.css('display', 'none') }; + $menu.show().slideUp(options); + } + }); + // set default menu visibility + function resetState() { + var $menu = $('#main-menu'); + var $mainMenuState = $('#main-menu-state'); + var newWidth = $(window).outerWidth(); + if (newWidth!=prevWidth) { + if ($(window).outerWidth()<768) { + $mainMenuState.prop('checked',false); $menu.hide(); + $('#searchBoxPos1').html(searchBox); + $('#searchBoxPos2').hide(); + } else { + $menu.show(); + $('#searchBoxPos1').empty(); + $('#searchBoxPos2').html(searchBox); + $('#searchBoxPos2').show(); + } + prevWidth = newWidth; + } + } + $(window).ready(function() { resetState(); initResizableIfExists(); }); + $(window).resize(resetState); + } + $('#main-menu').smartmenus(); +} +/* @license-end */ diff --git a/doc/html/menudata.js b/doc/html/menudata.js new file mode 100644 index 0000000..9914976 --- /dev/null +++ b/doc/html/menudata.js @@ -0,0 +1,91 @@ +/* + @licstart The following is the entire license notice for the JavaScript code in this file. + + The MIT License (MIT) + + Copyright (C) 1997-2020 by Dimitri van Heesch + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software + and associated documentation files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, publish, distribute, + sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or + substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + @licend The above is the entire license notice for the JavaScript code in this file +*/ +var menudata={children:[ +{text:"Main Page",url:"index.html"}, +{text:"Data Structures",url:"annotated.html",children:[ +{text:"Data Structures",url:"annotated.html"}, +{text:"Data Fields",url:"functions.html",children:[ +{text:"All",url:"functions.html",children:[ +{text:"a",url:"functions.html#index_a"}, +{text:"b",url:"functions_b.html#index_b"}, +{text:"c",url:"functions_c.html#index_c"}, +{text:"d",url:"functions_d.html#index_d"}, +{text:"e",url:"functions_e.html#index_e"}, +{text:"f",url:"functions_f.html#index_f"}, +{text:"g",url:"functions_g.html#index_g"}, +{text:"h",url:"functions_h.html#index_h"}, +{text:"i",url:"functions_i.html#index_i"}, +{text:"l",url:"functions_l.html#index_l"}, +{text:"m",url:"functions_m.html#index_m"}, +{text:"n",url:"functions_n.html#index_n"}, +{text:"o",url:"functions_o.html#index_o"}, +{text:"p",url:"functions_p.html#index_p"}, +{text:"q",url:"functions_q.html#index_q"}, +{text:"r",url:"functions_r.html#index_r"}, +{text:"s",url:"functions_s.html#index_s"}, +{text:"t",url:"functions_t.html#index_t"}, +{text:"u",url:"functions_u.html#index_u"}, +{text:"v",url:"functions_v.html#index_v"}, +{text:"w",url:"functions_w.html#index_w"}, +{text:"y",url:"functions_y.html#index_y"}]}, +{text:"Variables",url:"functions_vars.html",children:[ +{text:"a",url:"functions_vars.html#index_a"}, +{text:"b",url:"functions_vars_b.html#index_b"}, +{text:"c",url:"functions_vars_c.html#index_c"}, +{text:"d",url:"functions_vars_d.html#index_d"}, +{text:"e",url:"functions_vars_e.html#index_e"}, +{text:"f",url:"functions_vars_f.html#index_f"}, +{text:"g",url:"functions_vars_g.html#index_g"}, +{text:"h",url:"functions_vars_h.html#index_h"}, +{text:"i",url:"functions_vars_i.html#index_i"}, +{text:"l",url:"functions_vars_l.html#index_l"}, +{text:"m",url:"functions_vars_m.html#index_m"}, +{text:"n",url:"functions_vars_n.html#index_n"}, +{text:"o",url:"functions_vars_o.html#index_o"}, +{text:"p",url:"functions_vars_p.html#index_p"}, +{text:"q",url:"functions_vars_q.html#index_q"}, +{text:"r",url:"functions_vars_r.html#index_r"}, +{text:"s",url:"functions_vars_s.html#index_s"}, +{text:"t",url:"functions_vars_t.html#index_t"}, +{text:"u",url:"functions_vars_u.html#index_u"}, +{text:"v",url:"functions_vars_v.html#index_v"}, +{text:"w",url:"functions_vars_w.html#index_w"}, +{text:"y",url:"functions_vars_y.html#index_y"}]}]}]}, +{text:"Files",url:"files.html",children:[ +{text:"File List",url:"files.html"}, +{text:"Globals",url:"globals.html",children:[ +{text:"All",url:"globals.html",children:[ +{text:"_",url:"globals.html#index__5F"}, +{text:"s",url:"globals_s.html#index_s"}]}, +{text:"Functions",url:"globals_func.html",children:[ +{text:"s",url:"globals_func.html#index_s"}]}, +{text:"Typedefs",url:"globals_type.html",children:[ +{text:"s",url:"globals_type.html#index_s"}]}, +{text:"Enumerations",url:"globals_enum.html",children:[ +{text:"_",url:"globals_enum.html#index__5F"}]}, +{text:"Enumerator",url:"globals_eval.html",children:[ +{text:"s",url:"globals_eval.html#index_s"}]}, +{text:"Macros",url:"globals_defs.html",children:[ +{text:"s",url:"globals_defs.html#index_s"}]}]}]}]} diff --git a/doc/html/nav_f.png b/doc/html/nav_f.png new file mode 100644 index 0000000..72a58a5 Binary files /dev/null and b/doc/html/nav_f.png differ diff --git a/doc/html/nav_g.png b/doc/html/nav_g.png new file mode 100644 index 0000000..2093a23 Binary files /dev/null and b/doc/html/nav_g.png differ diff --git a/doc/html/nav_h.png b/doc/html/nav_h.png new file mode 100644 index 0000000..33389b1 Binary files /dev/null and b/doc/html/nav_h.png differ diff --git a/doc/html/open.png b/doc/html/open.png new file mode 100644 index 0000000..30f75c7 Binary files /dev/null and b/doc/html/open.png differ diff --git a/doc/html/sbg_e_can_id_8h.html b/doc/html/sbg_e_can_id_8h.html new file mode 100644 index 0000000..fe26d2f --- /dev/null +++ b/doc/html/sbg_e_can_id_8h.html @@ -0,0 +1,152 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/sbgECanId.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgECanId.h File Reference
    +
    +
    + +

    Defines all sbgECom commands identifiers. +More...

    + +

    Go to the source code of this file.

    + + + + +

    +Typedefs

    typedef enum _SbgECanMessageId SbgECanMessageId
     
    + + + +

    +Enumerations

    enum  _SbgECanMessageId {
    + }
     
    +

    Detailed Description

    +

    Defines all sbgECom commands identifiers.

    +
    Author
    SBG Systems
    +
    Date
    10 October 2014
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Typedef Documentation

    + +

    ◆ SbgECanMessageId

    + +
    +
    + + + + +
    typedef enum _SbgECanMessageId SbgECanMessageId
    +
    +

    Enum containing the list of messages that can be output on the can interface.

    + +
    +
    +

    Enumeration Type Documentation

    + +

    ◆ _SbgECanMessageId

    + +
    +
    + + + + +
    enum _SbgECanMessageId
    +
    +

    Enum containing the list of messages that can be output on the can interface.

    + + + + + + + + + + + + + + + + + +
    Enumerator
    SBG_ECAN_MSG_SHIP_MOTION_HP_INFO 

    Only for Ekinox, Apogee, Navsight & Quanta

    +
    SBG_ECAN_MSG_SHIP_MOTION_HP_0 

    Only for Ekinox, Apogee, Navsight & Quanta

    +
    SBG_ECAN_MSG_SHIP_MOTION_HP_1 

    Only for Ekinox, Apogee, Navsight & Quanta

    +
    SBG_ECAN_MSG_SHIP_MOTION_HP_2 

    Only for Ekinox, Apogee, Navsight & Quanta

    +
    SBG_ECAN_MSG_GPS2_VEL_INFO 

    Only for Ekinox, Apogee, Navsight & Quanta

    +
    SBG_ECAN_MSG_GPS2_VEL 

    Only for Ekinox, Apogee, Navsight & Quanta

    +
    SBG_ECAN_MSG_GPS2_VEL_ACC 

    Only for Ekinox, Apogee, Navsight & Quanta

    +
    SBG_ECAN_MSG_GPS2_VEL_COURSE 

    Only for Ekinox, Apogee, Navsight & Quanta

    +
    SBG_ECAN_MSG_GPS2_POS_INFO 

    Only for Ekinox, Apogee, Navsight & Quanta

    +
    SBG_ECAN_MSG_GPS2_POS 

    Only for Ekinox, Apogee, Navsight & Quanta

    +
    SBG_ECAN_MSG_GPS2_POS_ALT 

    Only for Ekinox, Apogee, Navsight & Quanta

    +
    SBG_ECAN_MSG_GPS2_POS_ACC 

    Only for Ekinox, Apogee, Navsight & Quanta

    +
    SBG_ECAN_MSG_GPS2_HDT_INFO 

    Only for Ekinox, Apogee, Navsight & Quanta

    +
    SBG_ECAN_MSG_GPS2_HDT 

    Only for Ekinox, Apogee, Navsight & Quanta

    +
    SBG_ECAN_MSG_EVENT_INFO_E 

    Only for Ekinox, Apogee, Navsight & Quanta

    +
    SBG_ECAN_MSG_EVENT_TIME_E 

    Only for Ekinox, Apogee, Navsight & Quanta

    +
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_can_id_8h_source.html b/doc/html/sbg_e_can_id_8h_source.html new file mode 100644 index 0000000..4961f15 --- /dev/null +++ b/doc/html/sbg_e_can_id_8h_source.html @@ -0,0 +1,198 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/sbgECanId.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgECanId.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECAN_ID_H
    +
    33#define SBG_ECAN_ID_H
    +
    34
    +
    35#ifdef __cplusplus
    +
    36extern "C" {
    +
    37#endif
    +
    38
    +
    39//----------------------------------------------------------------------//
    +
    40//- Definition of all messages id for sbgECan -//
    +
    41//----------------------------------------------------------------------//
    +
    42
    + +
    47{
    +
    48 //
    +
    49 // Output Messages
    +
    50 //
    +
    51 SBG_ECAN_MSG_STATUS_01 = 0x100,
    +
    52 SBG_ECAN_MSG_STATUS_02 = 0x101,
    +
    53 SBG_ECAN_MSG_STATUS_03 = 0x102,
    +
    54
    +
    55 SBG_ECAN_MSG_UTC_0 = 0x110,
    +
    56 SBG_ECAN_MSG_UTC_1 = 0x111,
    +
    57
    +
    58 SBG_ECAN_MSG_IMU_INFO = 0x120,
    +
    59 SBG_ECAN_MSG_IMU_ACCEL = 0x121,
    +
    60 SBG_ECAN_MSG_IMU_GYRO = 0x122,
    +
    61 SBG_ECAN_MSG_IMU_DELTA_VEL = 0x123,
    +
    62 SBG_ECAN_MSG_IMU_DELTA_ANGLE = 0x124,
    +
    63
    +
    64 SBG_ECAN_MSG_EKF_INFO = 0x130,
    +
    65 SBG_ECAN_MSG_EKF_QUAT = 0x131,
    +
    66 SBG_ECAN_MSG_EKF_EULER = 0x132,
    +
    67 SBG_ECAN_MSG_EKF_ORIENTATION_ACC = 0x133,
    +
    68 SBG_ECAN_MSG_EKF_POS = 0x134,
    +
    69 SBG_ECAN_MSG_EKF_ALTITUDE = 0x135,
    +
    70 SBG_ECAN_MSG_EKF_POS_ACC = 0x136,
    +
    71 SBG_ECAN_MSG_EKF_VEL_NED = 0x137,
    +
    72 SBG_ECAN_MSG_EKF_VEL_NED_ACC = 0x138,
    +
    73 SBG_ECAN_MSG_EKF_VEL_BODY = 0x139,
    +
    74
    +
    75 SBG_ECAN_MSG_SHIP_MOTION_INFO = 0x140,
    +
    76 SBG_ECAN_MSG_SHIP_MOTION_0 = 0x141,
    +
    77 SBG_ECAN_MSG_SHIP_MOTION_1 = 0x145,
    +
    78 SBG_ECAN_MSG_SHIP_MOTION_2 = 0x149,
    +
    79
    + + + + +
    85 SBG_ECAN_MSG_MAG_0 = 0x150,
    +
    86 SBG_ECAN_MSG_MAG_1 = 0x151,
    +
    87 SBG_ECAN_MSG_MAG_2 = 0x152,
    +
    88
    +
    89 SBG_ECAN_MSG_ODO_INFO = 0x160,
    +
    90 SBG_ECAN_MSG_ODO_VEL = 0x161,
    +
    91
    +
    92 SBG_ECAN_MSG_AIR_DATA_INFO = 0x162,
    +
    93 SBG_ECAN_MSG_AIR_DATA_ALTITUDE = 0x163,
    +
    94 SBG_ECAN_MSG_AIR_DATA_AIRSPEED = 0x164,
    +
    95
    +
    96 SBG_ECAN_MSG_DEPTH_INFO = 0x166,
    +
    97 SBG_ECAN_MSG_DEPTH_ALTITUDE = 0x167,
    +
    98
    +
    99 SBG_ECAN_MSG_GPS1_VEL_INFO = 0x170,
    +
    100 SBG_ECAN_MSG_GPS1_VEL = 0x171,
    +
    101 SBG_ECAN_MSG_GPS1_VEL_ACC = 0x172,
    +
    102 SBG_ECAN_MSG_GPS1_VEL_COURSE = 0x173,
    +
    103 SBG_ECAN_MSG_GPS1_POS_INFO = 0x174,
    +
    104 SBG_ECAN_MSG_GPS1_POS = 0x175,
    +
    105 SBG_ECAN_MSG_GPS1_POS_ALT = 0x176,
    +
    106 SBG_ECAN_MSG_GPS1_POS_ACC = 0x177,
    +
    107 SBG_ECAN_MSG_GPS1_HDT_INFO = 0x178,
    +
    108 SBG_ECAN_MSG_GPS1_HDT = 0x179,
    +
    109
    + + + + + + + + + + +
    121 SBG_ECAN_MSG_EVENT_INFO_A = 0x200,
    +
    122 SBG_ECAN_MSG_EVENT_TIME_A = 0x201,
    +
    123 SBG_ECAN_MSG_EVENT_INFO_B = 0x202,
    +
    124 SBG_ECAN_MSG_EVENT_TIME_B = 0x203,
    +
    125 SBG_ECAN_MSG_EVENT_INFO_C = 0x204,
    +
    126 SBG_ECAN_MSG_EVENT_TIME_C = 0x205,
    +
    127 SBG_ECAN_MSG_EVENT_INFO_D = 0x206,
    +
    128 SBG_ECAN_MSG_EVENT_TIME_D = 0x207,
    + + +
    132 //
    +
    133 // Proprietary CASS logs
    +
    134 //
    +
    135 SBG_ECAN_MSG_CASS_DATINF = 0x210,
    +
    136 SBG_ECAN_MSG_CASS_ACCS = 0x211,
    +
    137 SBG_ECAN_MSG_CASS_OMGS = 0x212,
    +
    138 SBG_ECAN_MSG_CASS_NRPY = 0x213,
    +
    139 SBG_ECAN_MSG_CASS_VEL = 0x214,
    +
    140 SBG_ECAN_MSG_CASS_TIME = 0x215,
    +
    141 SBG_ECAN_MSG_CASS_GPS_INF = 0x216,
    +
    142 SBG_ECAN_MSG_CASS_GPS_COG = 0x217,
    +
    143 SBG_ECAN_MSG_CASS_ADDINF = 0x218,
    +
    144 SBG_ECAN_MSG_CASS_POS1 = 0x219,
    +
    145 SBG_ECAN_MSG_CASS_POS2 = 0x21A,
    +
    146 SBG_ECAN_MSG_CASS_SAT_INF = 0x21B,
    +
    147 SBG_ECAN_MSG_CASS_IACCS = 0x21C,
    +
    148 SBG_ECAN_MSG_CASS_IOMG = 0x21D,
    +
    149 SBG_ECAN_MSG_CASS_RR = 0x21E,
    +
    150
    +
    151 //
    +
    152 // Automotive specific CAN output
    +
    153 //
    +
    154 SBG_ECAN_MSG_AUTO_TRACK_SLIP_CURV = 0x220,
    + +
    156
    +
    157#ifdef __cplusplus
    +
    158}
    +
    159#endif
    +
    160
    +
    161#endif // SBG_ECAN_ID_H
    +
    _SbgECanMessageId
    Definition: sbgECanId.h:47
    +
    @ SBG_ECAN_MSG_SHIP_MOTION_HP_0
    Definition: sbgECanId.h:81
    +
    @ SBG_ECAN_MSG_GPS2_HDT_INFO
    Definition: sbgECanId.h:118
    +
    @ SBG_ECAN_MSG_GPS2_POS_INFO
    Definition: sbgECanId.h:114
    +
    @ SBG_ECAN_MSG_GPS2_VEL
    Definition: sbgECanId.h:111
    +
    @ SBG_ECAN_MSG_GPS2_VEL_ACC
    Definition: sbgECanId.h:112
    +
    @ SBG_ECAN_MSG_GPS2_VEL_COURSE
    Definition: sbgECanId.h:113
    +
    @ SBG_ECAN_MSG_EVENT_TIME_E
    Definition: sbgECanId.h:130
    +
    @ SBG_ECAN_MSG_GPS2_POS_ALT
    Definition: sbgECanId.h:116
    +
    @ SBG_ECAN_MSG_GPS2_POS
    Definition: sbgECanId.h:115
    +
    @ SBG_ECAN_MSG_EVENT_INFO_E
    Definition: sbgECanId.h:129
    +
    @ SBG_ECAN_MSG_SHIP_MOTION_HP_1
    Definition: sbgECanId.h:82
    +
    @ SBG_ECAN_MSG_GPS2_HDT
    Definition: sbgECanId.h:119
    +
    @ SBG_ECAN_MSG_SHIP_MOTION_HP_2
    Definition: sbgECanId.h:83
    +
    @ SBG_ECAN_MSG_GPS2_POS_ACC
    Definition: sbgECanId.h:117
    +
    @ SBG_ECAN_MSG_GPS2_VEL_INFO
    Definition: sbgECanId.h:110
    +
    @ SBG_ECAN_MSG_SHIP_MOTION_HP_INFO
    Definition: sbgECanId.h:80
    +
    enum _SbgECanMessageId SbgECanMessageId
    +
    + + + + diff --git a/doc/html/sbg_e_com_8h.html b/doc/html/sbg_e_com_8h.html new file mode 100644 index 0000000..dcc2543 --- /dev/null +++ b/doc/html/sbg_e_com_8h.html @@ -0,0 +1,420 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/sbgECom.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgECom.h File Reference
    +
    +
    + +

    Contains main sbgECom methods. +More...

    +
    #include <sbgCommon.h>
    +#include "sbgECanId.h"
    +#include "sbgEComIds.h"
    +#include "protocol/sbgEComProtocol.h"
    +#include "binaryLogs/sbgEComBinaryLogs.h"
    +
    +

    Go to the source code of this file.

    + + + + +

    +Data Structures

    struct  _SbgEComHandle
     
    + + + + + +

    +Typedefs

    typedef struct _SbgEComHandle SbgEComHandle
     
    typedef SbgErrorCode(* SbgEComReceiveLogFunc) (SbgEComHandle *pHandle, SbgEComClass msgClass, SbgEComMsgId msg, const SbgBinaryLogData *pLogData, void *pUserArg)
     
    + + + + + + + + + + + + + + + + + +

    +Functions

    SbgErrorCode sbgEComInit (SbgEComHandle *pHandle, SbgInterface *pInterface)
     
    SbgErrorCode sbgEComClose (SbgEComHandle *pHandle)
     
    SbgErrorCode sbgEComHandleOneLog (SbgEComHandle *pHandle)
     
    SbgErrorCode sbgEComHandle (SbgEComHandle *pHandle)
     
    SbgErrorCode sbgEComPurgeIncoming (SbgEComHandle *pHandle)
     
    void sbgEComSetReceiveLogCallback (SbgEComHandle *pHandle, SbgEComReceiveLogFunc pReceiveLogCallback, void *pUserArg)
     
    void sbgEComSetCmdTrialsAndTimeOut (SbgEComHandle *pHandle, uint32_t numTrials, uint32_t cmdDefaultTimeOut)
     
    void sbgEComErrorToString (SbgErrorCode errorCode, char errorMsg[256])
     
    +

    Detailed Description

    +

    Contains main sbgECom methods.

    +
    Author
    SBG Systems
    +
    Date
    05 February 2013
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Typedef Documentation

    + +

    ◆ SbgEComHandle

    + +
    +
    + + + + +
    typedef struct _SbgEComHandle SbgEComHandle
    +
    +

    Interface structure pre-definition.

    + +
    +
    + +

    ◆ SbgEComReceiveLogFunc

    + +
    +
    + + + + +
    typedef SbgErrorCode(* SbgEComReceiveLogFunc) (SbgEComHandle *pHandle, SbgEComClass msgClass, SbgEComMsgId msg, const SbgBinaryLogData *pLogData, void *pUserArg)
    +
    +

    Callback definition called each time a new log is received.

    +
    Parameters
    + + + + + + +
    [in]pHandleValid handle on the sbgECom instance that has called this callback.
    [in]msgClassClass of the message we have received
    [in]msgMessage ID of the log received.
    [in]pLogDataContains the received log data as an union.
    [in]pUserArgOptional user supplied argument.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the received log has been used successfully.
    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgEComInit()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComInit (SbgEComHandlepHandle,
    SbgInterface * pInterface 
    )
    +
    +

    Initialize the protocol system used to communicate with the product and return the created handle.

    +
    Parameters
    + + + +
    [out]pHandlePointer used to store the allocated and initialized sbgECom handle.
    [in]pInterfaceInterface to use for read/write operations.
    +
    +
    +
    Returns
    SBG_NO_ERROR if we have initialized the protocol system.
    + +
    +
    + +

    ◆ sbgEComClose()

    + +
    +
    + + + + + + + + +
    SbgErrorCode sbgEComClose (SbgEComHandlepHandle)
    +
    +

    Close the protocol system and release associated memory.

    +
    Parameters
    + + +
    [in]pHandleA valid sbgECom handle to close.
    +
    +
    +
    Returns
    SBG_NO_ERROR if we have closed and released the sbgECom system.
    + +
    +
    + +

    ◆ sbgEComHandleOneLog()

    + +
    +
    + + + + + + + + +
    SbgErrorCode sbgEComHandleOneLog (SbgEComHandlepHandle)
    +
    +

    Try to parse one log from the input interface and then return.

    +
    Parameters
    + + +
    [in]pHandleA valid sbgECom handle.
    +
    +
    +
    Returns
    SBG_NO_ERROR if no error occurs during incoming log parsing.
    + +
    +
    + +

    ◆ sbgEComHandle()

    + +
    +
    + + + + + + + + +
    SbgErrorCode sbgEComHandle (SbgEComHandlepHandle)
    +
    +

    Handle all incoming logs until no more log are available in the input interface.

    +
    Parameters
    + + +
    [in]pHandleA valid sbgECom handle.
    +
    +
    +
    Returns
    SBG_NO_ERROR if no error occurs during incoming logs parsing.
    + +
    +
    + +

    ◆ sbgEComPurgeIncoming()

    + +
    +
    + + + + + + + + +
    SbgErrorCode sbgEComPurgeIncoming (SbgEComHandlepHandle)
    +
    +

    Purge the interface rx buffer as well as the sbgECom rx work buffer.

    +

    For example, if the program flow has been interrupted, this method can be helpful to discard all trash received data.

    +

    WARNING: This method is blocking for 100ms and actively tries to read incoming data.

    +
    Parameters
    + + +
    [in]pHandleA valid sbgECom handle.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the incoming data has been purged successfully.
    + +
    +
    + +

    ◆ sbgEComSetReceiveLogCallback()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    void sbgEComSetReceiveLogCallback (SbgEComHandlepHandle,
    SbgEComReceiveLogFunc pReceiveLogCallback,
    void * pUserArg 
    )
    +
    +

    Define the callback that should be called each time a new binary log is received.

    +
    Parameters
    + + + + +
    [in]pHandleA valid sbgECom handle.
    [in]pReceiveLogCallbackPointer on the callback to call when a new log is received.
    [in]pUserArgOptional user argument that will be passed to the callback method.
    +
    +
    + +
    +
    + +

    ◆ sbgEComSetCmdTrialsAndTimeOut()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    void sbgEComSetCmdTrialsAndTimeOut (SbgEComHandlepHandle,
    uint32_t numTrials,
    uint32_t cmdDefaultTimeOut 
    )
    +
    +

    Define the default number of trials that should be done when a command is send to the device as well as the time out.

    +
    Parameters
    + + + + +
    [in]pHandleA valid sbgECom handle.
    [in]numTrialsNumber of trials when a command is sent (starting at 1).
    [in]cmdDefaultTimeOutDefault time out in milliseconds to wait to receive an answer from the device.
    +
    +
    + +
    +
    + +

    ◆ sbgEComErrorToString()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    void sbgEComErrorToString (SbgErrorCode errorCode,
    char errorMsg[256] 
    )
    +
    +

    Convert an error code into a human readable string.

    +
    Parameters
    + + + +
    [in]errorCodeThe errorCode to convert into a string.
    [out]errorMsgString buffer used to hold the error string.
    +
    +
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_8h_source.html b/doc/html/sbg_e_com_8h_source.html new file mode 100644 index 0000000..3493ed4 --- /dev/null +++ b/doc/html/sbg_e_com_8h_source.html @@ -0,0 +1,146 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/sbgECom.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgECom.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_H
    +
    33#define SBG_ECOM_H
    +
    34
    +
    35#ifdef __cplusplus
    +
    36extern "C" {
    +
    37#endif
    +
    38
    +
    39// sbgCommonLib headers
    +
    40#include <sbgCommon.h>
    +
    41
    +
    42// Local headers
    +
    43#include "sbgECanId.h"
    +
    44#include "sbgEComIds.h"
    + + +
    47
    +
    48//----------------------------------------------------------------------//
    +
    49//- Predefinitions -//
    +
    50//----------------------------------------------------------------------//
    +
    51
    + +
    56
    +
    57//----------------------------------------------------------------------//
    +
    58//- Callbacks definitions -//
    +
    59//----------------------------------------------------------------------//
    +
    60
    +
    71typedef SbgErrorCode (*SbgEComReceiveLogFunc)(SbgEComHandle *pHandle, SbgEComClass msgClass, SbgEComMsgId msg, const SbgBinaryLogData *pLogData, void *pUserArg);
    +
    72
    +
    73//----------------------------------------------------------------------//
    +
    74//- Structures definitions -//
    +
    75//----------------------------------------------------------------------//
    +
    76
    + +
    81{
    + + +
    85 void *pUserArg;
    +
    87 uint32_t numTrials;
    + +
    89};
    +
    90
    +
    91//----------------------------------------------------------------------//
    +
    92//- Public methods -//
    +
    93//----------------------------------------------------------------------//
    +
    94
    +
    102SbgErrorCode sbgEComInit(SbgEComHandle *pHandle, SbgInterface *pInterface);
    +
    103
    +
    110SbgErrorCode sbgEComClose(SbgEComHandle *pHandle);
    +
    111
    +
    118SbgErrorCode sbgEComHandleOneLog(SbgEComHandle *pHandle);
    +
    119
    +
    126SbgErrorCode sbgEComHandle(SbgEComHandle *pHandle);
    +
    127
    +
    138SbgErrorCode sbgEComPurgeIncoming(SbgEComHandle *pHandle);
    +
    139
    +
    147void sbgEComSetReceiveLogCallback(SbgEComHandle *pHandle, SbgEComReceiveLogFunc pReceiveLogCallback, void *pUserArg);
    +
    148
    +
    156void sbgEComSetCmdTrialsAndTimeOut(SbgEComHandle *pHandle, uint32_t numTrials, uint32_t cmdDefaultTimeOut);
    +
    157
    +
    164void sbgEComErrorToString(SbgErrorCode errorCode, char errorMsg[256]);
    +
    165
    +
    166#ifdef __cplusplus
    +
    167}
    +
    168#endif
    +
    169
    +
    170#endif // SBG_ECOM_H
    +
    171
    +
    Defines all sbgECom commands identifiers.
    +
    SbgErrorCode sbgEComHandle(SbgEComHandle *pHandle)
    +
    SbgErrorCode sbgEComInit(SbgEComHandle *pHandle, SbgInterface *pInterface)
    +
    void sbgEComSetReceiveLogCallback(SbgEComHandle *pHandle, SbgEComReceiveLogFunc pReceiveLogCallback, void *pUserArg)
    +
    void sbgEComErrorToString(SbgErrorCode errorCode, char errorMsg[256])
    +
    SbgErrorCode sbgEComHandleOneLog(SbgEComHandle *pHandle)
    +
    SbgErrorCode sbgEComClose(SbgEComHandle *pHandle)
    +
    void sbgEComSetCmdTrialsAndTimeOut(SbgEComHandle *pHandle, uint32_t numTrials, uint32_t cmdDefaultTimeOut)
    +
    SbgErrorCode(* SbgEComReceiveLogFunc)(SbgEComHandle *pHandle, SbgEComClass msgClass, SbgEComMsgId msg, const SbgBinaryLogData *pLogData, void *pUserArg)
    Definition: sbgECom.h:71
    +
    SbgErrorCode sbgEComPurgeIncoming(SbgEComHandle *pHandle)
    +
    Parse incoming sbgECom logs and store result in an union.
    +
    Defines all sbgECom commands identifiers.
    +
    uint8_t SbgEComMsgId
    Definition: sbgEComIds.h:303
    +
    enum _SbgEComClass SbgEComClass
    +
    Implementation of the sbgECom binary communication protocol.
    +
    Definition: sbgECom.h:81
    +
    uint32_t numTrials
    Definition: sbgECom.h:87
    +
    SbgEComProtocol protocolHandle
    Definition: sbgECom.h:82
    +
    SbgEComReceiveLogFunc pReceiveLogCallback
    Definition: sbgECom.h:84
    +
    uint32_t cmdDefaultTimeOut
    Definition: sbgECom.h:88
    +
    void * pUserArg
    Definition: sbgECom.h:85
    +
    Definition: sbgEComProtocol.h:95
    +
    Definition: sbgEComBinaryLogs.h:71
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_log_air_data_8h.html b/doc/html/sbg_e_com_binary_log_air_data_8h.html new file mode 100644 index 0000000..2ccac39 --- /dev/null +++ b/doc/html/sbg_e_com_binary_log_air_data_8h.html @@ -0,0 +1,294 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogAirData.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComBinaryLogAirData.h File Reference
    +
    +
    + +

    Parse received air data measurement logs such as barometer data. +More...

    +
    #include <sbgCommon.h>
    +#include <streamBuffer/sbgStreamBuffer.h>
    +
    +

    Go to the source code of this file.

    + + + + +

    +Data Structures

    struct  _SbgLogAirData
     
    + + + + + + + + + + + + + +

    +Macros

    #define SBG_ECOM_AIR_DATA_TIME_IS_DELAY   (0x0001u << 0)
     
    #define SBG_ECOM_AIR_DATA_PRESSURE_ABS_VALID   (0x0001u << 1)
     
    #define SBG_ECOM_AIR_DATA_ALTITUDE_VALID   (0x0001u << 2)
     
    #define SBG_ECOM_AIR_DATA_PRESSURE_DIFF_VALID   (0x0001u << 3)
     
    #define SBG_ECOM_AIR_DATA_AIRPSEED_VALID   (0x0001u << 4)
     
    #define SBG_ECOM_AIR_DATA_TEMPERATURE_VALID   (0x0001u << 5)
     
    + + + +

    +Typedefs

    typedef struct _SbgLogAirData SbgLogAirData
     
    + + + + + +

    +Functions

    SbgErrorCode sbgEComBinaryLogParseAirData (SbgStreamBuffer *pInputStream, SbgLogAirData *pOutputData)
     
    SbgErrorCode sbgEComBinaryLogWriteAirData (SbgStreamBuffer *pOutputStream, const SbgLogAirData *pInputData)
     
    +

    Detailed Description

    +

    Parse received air data measurement logs such as barometer data.

    +
    Author
    SBG Systems
    +
    Date
    20 February 2019
    +

    Air Data logs are used to inject / return barometric altitude as well as true air speed.

    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Macro Definition Documentation

    + +

    ◆ SBG_ECOM_AIR_DATA_TIME_IS_DELAY

    + +
    +
    + + + + +
    #define SBG_ECOM_AIR_DATA_TIME_IS_DELAY   (0x0001u << 0)
    +
    +

    Air Data sensor status mask definitions Set to 1 if the time stamp field represents a delay instead of an absolute time stamp.

    + +
    +
    + +

    ◆ SBG_ECOM_AIR_DATA_PRESSURE_ABS_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_AIR_DATA_PRESSURE_ABS_VALID   (0x0001u << 1)
    +
    +

    Set to 1 if the pressure field is filled and valid.

    + +
    +
    + +

    ◆ SBG_ECOM_AIR_DATA_ALTITUDE_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_AIR_DATA_ALTITUDE_VALID   (0x0001u << 2)
    +
    +

    Set to 1 if the barometric altitude field is filled and valid.

    + +
    +
    + +

    ◆ SBG_ECOM_AIR_DATA_PRESSURE_DIFF_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_AIR_DATA_PRESSURE_DIFF_VALID   (0x0001u << 3)
    +
    +

    Set to 1 if the differential pressure field is filled and valid.

    + +
    +
    + +

    ◆ SBG_ECOM_AIR_DATA_AIRPSEED_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_AIR_DATA_AIRPSEED_VALID   (0x0001u << 4)
    +
    +

    Set to 1 if the true airspeed field is filled and valid.

    + +
    +
    + +

    ◆ SBG_ECOM_AIR_DATA_TEMPERATURE_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_AIR_DATA_TEMPERATURE_VALID   (0x0001u << 5)
    +
    +

    Set to 1 if the output air temperature field is filled and valid.

    + +
    +
    +

    Typedef Documentation

    + +

    ◆ SbgLogAirData

    + +
    +
    + + + + +
    typedef struct _SbgLogAirData SbgLogAirData
    +
    +

    Log structure for AirData.

    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgEComBinaryLogParseAirData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogParseAirData (SbgStreamBuffer * pInputStream,
    SbgLogAirDatapOutputData 
    )
    +
    +

    Parse data for the SBG_ECOM_LOG_AIR_DATA message and fill the corresponding structure.

    +
    Parameters
    + + + +
    [in]pInputStreamInput stream buffer to read the payload from.
    [out]pOutputDataPointer on the output structure that stores parsed data.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the payload has been parsed.
    + +
    +
    + +

    ◆ sbgEComBinaryLogWriteAirData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogWriteAirData (SbgStreamBuffer * pOutputStream,
    const SbgLogAirDatapInputData 
    )
    +
    +

    Write data for the SBG_ECOM_LOG_AIR_DATA message to the output stream buffer from the provided structure.

    +
    Parameters
    + + + +
    [out]pOutputStreamOutput stream buffer to write the payload to.
    [in]pInputDataPointer on the input structure that stores data to write.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the message has been generated in the provided buffer.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_log_air_data_8h_source.html b/doc/html/sbg_e_com_binary_log_air_data_8h_source.html new file mode 100644 index 0000000..b8bb951 --- /dev/null +++ b/doc/html/sbg_e_com_binary_log_air_data_8h_source.html @@ -0,0 +1,116 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogAirData.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComBinaryLogAirData.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    35#ifndef SBG_ECOM_BINARY_LOG_AIR_DATA_H
    +
    36#define SBG_ECOM_BINARY_LOG_AIR_DATA_H
    +
    37
    +
    38// sbgCommonLib headers
    +
    39#include <sbgCommon.h>
    +
    40#include <streamBuffer/sbgStreamBuffer.h>
    +
    41
    +
    42#ifdef __cplusplus
    +
    43extern "C" {
    +
    44#endif
    +
    45
    +
    46//----------------------------------------------------------------------//
    +
    47//- Log Air Data status definitions -//
    +
    48//----------------------------------------------------------------------//
    +
    49
    +
    53#define SBG_ECOM_AIR_DATA_TIME_IS_DELAY (0x0001u << 0)
    +
    54#define SBG_ECOM_AIR_DATA_PRESSURE_ABS_VALID (0x0001u << 1)
    +
    55#define SBG_ECOM_AIR_DATA_ALTITUDE_VALID (0x0001u << 2)
    +
    56#define SBG_ECOM_AIR_DATA_PRESSURE_DIFF_VALID (0x0001u << 3)
    +
    57#define SBG_ECOM_AIR_DATA_AIRPSEED_VALID (0x0001u << 4)
    +
    58#define SBG_ECOM_AIR_DATA_TEMPERATURE_VALID (0x0001u << 5)
    +
    60//----------------------------------------------------------------------//
    +
    61//- Log structure definitions -//
    +
    62//----------------------------------------------------------------------//
    +
    63
    +
    67typedef struct _SbgLogAirData
    +
    68{
    +
    69 uint32_t timeStamp;
    +
    70 uint16_t status;
    + +
    72 float altitude;
    + + + + +
    77
    +
    78//----------------------------------------------------------------------//
    +
    79//- Public methods -//
    +
    80//----------------------------------------------------------------------//
    +
    81
    +
    89SbgErrorCode sbgEComBinaryLogParseAirData(SbgStreamBuffer *pInputStream, SbgLogAirData *pOutputData);
    +
    90
    +
    98SbgErrorCode sbgEComBinaryLogWriteAirData(SbgStreamBuffer *pOutputStream, const SbgLogAirData *pInputData);
    +
    99
    +
    100#ifdef __cplusplus
    +
    101}
    +
    102#endif
    +
    103
    +
    104#endif // SBG_ECOM_BINARY_LOG_AIR_DATA_H
    +
    SbgErrorCode sbgEComBinaryLogParseAirData(SbgStreamBuffer *pInputStream, SbgLogAirData *pOutputData)
    +
    struct _SbgLogAirData SbgLogAirData
    +
    SbgErrorCode sbgEComBinaryLogWriteAirData(SbgStreamBuffer *pOutputStream, const SbgLogAirData *pInputData)
    +
    Definition: sbgEComBinaryLogAirData.h:68
    +
    uint16_t status
    Definition: sbgEComBinaryLogAirData.h:70
    +
    float pressureDiff
    Definition: sbgEComBinaryLogAirData.h:73
    +
    float pressureAbs
    Definition: sbgEComBinaryLogAirData.h:71
    +
    float trueAirspeed
    Definition: sbgEComBinaryLogAirData.h:74
    +
    float altitude
    Definition: sbgEComBinaryLogAirData.h:72
    +
    uint32_t timeStamp
    Definition: sbgEComBinaryLogAirData.h:69
    +
    float airTemperature
    Definition: sbgEComBinaryLogAirData.h:75
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_log_automotive_data_8h.html b/doc/html/sbg_e_com_binary_log_automotive_data_8h.html new file mode 100644 index 0000000..7a58f2e --- /dev/null +++ b/doc/html/sbg_e_com_binary_log_automotive_data_8h.html @@ -0,0 +1,159 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogAutomotiveData.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComBinaryLogAutomotiveData.h File Reference
    +
    +
    + +

    Parse dedicated automotive measurements logs. +More...

    +
    #include <sbgCommon.h>
    +#include <streamBuffer/sbgStreamBuffer.h>
    +
    +

    Go to the source code of this file.

    + + + + +

    +Data Structures

    struct  _SbgLogAutoData
     
    + + + + + + + +

    +Macros

    #define SBG_ECOM_AUTO_DATA_TRACK_VALID   (0x1u << 0)
     
    #define SBG_ECOM_AUTO_DATA_SLIP_VALID   (0x1u << 1)
     
    #define SBG_ECOM_AUTO_DATA_CURVATURE_VALID   (0x1u << 2)
     
    + + + +

    +Typedefs

    typedef struct _SbgLogAutoData SbgLogAutoData
     
    +

    Detailed Description

    +

    Parse dedicated automotive measurements logs.

    +
    Author
    SBG Systems
    +
    Date
    22 April 2020
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Macro Definition Documentation

    + +

    ◆ SBG_ECOM_AUTO_DATA_TRACK_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_AUTO_DATA_TRACK_VALID   (0x1u << 0)
    +
    +

    Automotive data status mask definitions Set to 1 if the track angle is valid.

    + +
    +
    + +

    ◆ SBG_ECOM_AUTO_DATA_SLIP_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_AUTO_DATA_SLIP_VALID   (0x1u << 1)
    +
    +

    Set to 1 if the slip angle is valid.

    + +
    +
    + +

    ◆ SBG_ECOM_AUTO_DATA_CURVATURE_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_AUTO_DATA_CURVATURE_VALID   (0x1u << 2)
    +
    +

    Set to 1 if the curvature radius is valid.

    + +
    +
    +

    Typedef Documentation

    + +

    ◆ SbgLogAutoData

    + +
    +
    + + + + +
    typedef struct _SbgLogAutoData SbgLogAutoData
    +
    +

    Log structure for automotive data.

    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_log_automotive_data_8h_source.html b/doc/html/sbg_e_com_binary_log_automotive_data_8h_source.html new file mode 100644 index 0000000..55e6baf --- /dev/null +++ b/doc/html/sbg_e_com_binary_log_automotive_data_8h_source.html @@ -0,0 +1,97 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogAutomotiveData.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComBinaryLogAutomotiveData.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_BINARY_LOG_AUTOMOTIVE_H
    +
    33#define SBG_ECOM_BINARY_LOG_AUTOMOTIVE_H
    +
    34
    +
    35// sbgCommonLib headers
    +
    36#include <sbgCommon.h>
    +
    37#include <streamBuffer/sbgStreamBuffer.h>
    +
    38
    +
    39#ifdef __cplusplus
    +
    40extern "C" {
    +
    41#endif
    +
    42
    +
    43//----------------------------------------------------------------------//
    +
    44//- Constant definitions -//
    +
    45//----------------------------------------------------------------------//
    +
    46
    +
    50#define SBG_ECOM_AUTO_DATA_TRACK_VALID (0x1u << 0)
    +
    51#define SBG_ECOM_AUTO_DATA_SLIP_VALID (0x1u << 1)
    +
    52#define SBG_ECOM_AUTO_DATA_CURVATURE_VALID (0x1u << 2)
    +
    54//----------------------------------------------------------------------//
    +
    55//- Log structure definitions -//
    +
    56//----------------------------------------------------------------------//
    +
    57
    +
    61typedef struct _SbgLogAutoData
    +
    62{
    +
    63 uint8_t status;
    +
    64 float trackAngle;
    +
    65 float slipAngle;
    + + +
    68
    +
    69#ifdef __cplusplus
    +
    70}
    +
    71#endif
    +
    72
    +
    73#endif // SBG_ECOM_BINARY_LOG_AUTOMOTIVE_H
    +
    struct _SbgLogAutoData SbgLogAutoData
    +
    Definition: sbgEComBinaryLogAutomotiveData.h:62
    +
    float trackAngle
    Definition: sbgEComBinaryLogAutomotiveData.h:64
    +
    float slipAngle
    Definition: sbgEComBinaryLogAutomotiveData.h:65
    +
    uint8_t status
    Definition: sbgEComBinaryLogAutomotiveData.h:63
    +
    float curvatureRadius
    Definition: sbgEComBinaryLogAutomotiveData.h:66
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_log_depth_8h.html b/doc/html/sbg_e_com_binary_log_depth_8h.html new file mode 100644 index 0000000..735c275 --- /dev/null +++ b/doc/html/sbg_e_com_binary_log_depth_8h.html @@ -0,0 +1,243 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogDepth.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComBinaryLogDepth.h File Reference
    +
    +
    + +

    Parse received subsea depth measurement logs. +More...

    +
    #include <sbgCommon.h>
    +#include <streamBuffer/sbgStreamBuffer.h>
    +
    +

    Go to the source code of this file.

    + + + + +

    +Data Structures

    struct  _SbgLogDepth
     
    + + + + + + + +

    +Macros

    #define SBG_ECOM_DEPTH_TIME_IS_DELAY   (0x0001u << 0)
     
    #define SBG_ECOM_DEPTH_PRESSURE_ABS_VALID   (0x0001u << 1)
     
    #define SBG_ECOM_DEPTH_ALTITUDE_VALID   (0x0001u << 2)
     
    + + + +

    +Typedefs

    typedef struct _SbgLogDepth SbgLogDepth
     
    + + + + + +

    +Functions

    SbgErrorCode sbgEComBinaryLogParseDepth (SbgStreamBuffer *pInputStream, SbgLogDepth *pOutputData)
     
    SbgErrorCode sbgEComBinaryLogWriteDepth (SbgStreamBuffer *pOutputStream, const SbgLogDepth *pInputData)
     
    +

    Detailed Description

    +

    Parse received subsea depth measurement logs.

    +
    Author
    SBG Systems
    +
    Date
    20 February 2019
    +

    Depth sensor are used for subsea navigation to improve height.

    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Macro Definition Documentation

    + +

    ◆ SBG_ECOM_DEPTH_TIME_IS_DELAY

    + +
    +
    + + + + +
    #define SBG_ECOM_DEPTH_TIME_IS_DELAY   (0x0001u << 0)
    +
    +

    Air Data sensor status mask definitions Set to 1 if the time stamp field represents a delay instead of an absolute time stamp.

    + +
    +
    + +

    ◆ SBG_ECOM_DEPTH_PRESSURE_ABS_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_DEPTH_PRESSURE_ABS_VALID   (0x0001u << 1)
    +
    +

    Set to 1 if the pressure field is filled and valid.

    + +
    +
    + +

    ◆ SBG_ECOM_DEPTH_ALTITUDE_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_DEPTH_ALTITUDE_VALID   (0x0001u << 2)
    +
    +

    Set to 1 if the depth altitude field is filled and valid.

    + +
    +
    +

    Typedef Documentation

    + +

    ◆ SbgLogDepth

    + +
    +
    + + + + +
    typedef struct _SbgLogDepth SbgLogDepth
    +
    +

    Log structure for Depth sensor measurement (subsea).

    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgEComBinaryLogParseDepth()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogParseDepth (SbgStreamBuffer * pInputStream,
    SbgLogDepthpOutputData 
    )
    +
    +

    Parse data for the SBG_ECOM_LOG_DEPTH message and fill the corresponding structure.

    +
    Parameters
    + + + +
    [in]pInputStreamInput stream buffer to read the payload from.
    [out]pOutputDataPointer on the output structure that stores parsed data.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the payload has been parsed.
    + +
    +
    + +

    ◆ sbgEComBinaryLogWriteDepth()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogWriteDepth (SbgStreamBuffer * pOutputStream,
    const SbgLogDepthpInputData 
    )
    +
    +

    Write data for the SBG_ECOM_LOG_DEPTH message to the output stream buffer from the provided structure.

    +
    Parameters
    + + + +
    [out]pOutputStreamOutput stream buffer to write the payload to.
    [in]pInputDataPointer on the input structure that stores data to write.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the message has been generated in the provided buffer.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_log_depth_8h_source.html b/doc/html/sbg_e_com_binary_log_depth_8h_source.html new file mode 100644 index 0000000..dcbcbb3 --- /dev/null +++ b/doc/html/sbg_e_com_binary_log_depth_8h_source.html @@ -0,0 +1,107 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogDepth.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComBinaryLogDepth.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    34#ifndef SBG_ECOM_BINARY_LOG_DEPTH_H
    +
    35#define SBG_ECOM_BINARY_LOG_DEPTH_H
    +
    36
    +
    37// sbgCommonLib headers
    +
    38#include <sbgCommon.h>
    +
    39#include <streamBuffer/sbgStreamBuffer.h>
    +
    40
    +
    41#ifdef __cplusplus
    +
    42extern "C" {
    +
    43#endif
    +
    44
    +
    45//----------------------------------------------------------------------//
    +
    46//- Log Air Data status definitions -//
    +
    47//----------------------------------------------------------------------//
    +
    48
    +
    52#define SBG_ECOM_DEPTH_TIME_IS_DELAY (0x0001u << 0)
    +
    53#define SBG_ECOM_DEPTH_PRESSURE_ABS_VALID (0x0001u << 1)
    +
    54#define SBG_ECOM_DEPTH_ALTITUDE_VALID (0x0001u << 2)
    +
    56//----------------------------------------------------------------------//
    +
    57//- Log structure definitions -//
    +
    58//----------------------------------------------------------------------//
    +
    59
    +
    63typedef struct _SbgLogDepth
    +
    64{
    +
    65 uint32_t timeStamp;
    +
    66 uint16_t status;
    + +
    68 float altitude;
    + +
    70
    +
    71//----------------------------------------------------------------------//
    +
    72//- Public methods -//
    +
    73//----------------------------------------------------------------------//
    +
    74
    +
    82SbgErrorCode sbgEComBinaryLogParseDepth(SbgStreamBuffer *pInputStream, SbgLogDepth *pOutputData);
    +
    83
    +
    91SbgErrorCode sbgEComBinaryLogWriteDepth(SbgStreamBuffer *pOutputStream, const SbgLogDepth *pInputData);
    +
    92
    +
    93#ifdef __cplusplus
    +
    94}
    +
    95#endif
    +
    96
    +
    97#endif // SBG_ECOM_BINARY_LOG_DEPTH_H
    +
    struct _SbgLogDepth SbgLogDepth
    +
    SbgErrorCode sbgEComBinaryLogParseDepth(SbgStreamBuffer *pInputStream, SbgLogDepth *pOutputData)
    +
    SbgErrorCode sbgEComBinaryLogWriteDepth(SbgStreamBuffer *pOutputStream, const SbgLogDepth *pInputData)
    +
    Definition: sbgEComBinaryLogDepth.h:64
    +
    uint32_t timeStamp
    Definition: sbgEComBinaryLogDepth.h:65
    +
    uint16_t status
    Definition: sbgEComBinaryLogDepth.h:66
    +
    float pressureAbs
    Definition: sbgEComBinaryLogDepth.h:67
    +
    float altitude
    Definition: sbgEComBinaryLogDepth.h:68
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_log_diag_8h.html b/doc/html/sbg_e_com_binary_log_diag_8h.html new file mode 100644 index 0000000..38ad2bc --- /dev/null +++ b/doc/html/sbg_e_com_binary_log_diag_8h.html @@ -0,0 +1,209 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogDiag.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComBinaryLogDiag.h File Reference
    +
    +
    + +

    Parse diagnostic logs emitted by the device. +More...

    +
    #include <sbgCommon.h>
    +#include <streamBuffer/sbgStreamBuffer.h>
    +#include <protocol/sbgEComProtocol.h>
    +
    +

    Go to the source code of this file.

    + + + + +

    +Data Structures

    struct  _SbgLogDiagData
     
    + + + +

    +Macros

    #define SBG_ECOM_LOG_DIAG_MAX_STRING_SIZE   (SBG_ECOM_MAX_PAYLOAD_SIZE - 6)
     
    + + + +

    +Typedefs

    typedef struct _SbgLogDiagData SbgLogDiagData
     
    + + + + + +

    +Functions

    SbgErrorCode sbgEComBinaryLogParseDiagData (SbgStreamBuffer *pInputStream, SbgLogDiagData *pOutputData)
     
    SbgErrorCode sbgEComBinaryLogWriteDiagData (SbgStreamBuffer *pOutputStream, const SbgLogDiagData *pInputData)
     
    +

    Detailed Description

    +

    Parse diagnostic logs emitted by the device.

    +
    Author
    SBG Systems
    +
    Date
    12 June 2019
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Macro Definition Documentation

    + +

    ◆ SBG_ECOM_LOG_DIAG_MAX_STRING_SIZE

    + +
    +
    + + + + +
    #define SBG_ECOM_LOG_DIAG_MAX_STRING_SIZE   (SBG_ECOM_MAX_PAYLOAD_SIZE - 6)
    +
    +

    Maximum size of the log string, in bytes.

    + +
    +
    +

    Typedef Documentation

    + +

    ◆ SbgLogDiagData

    + +
    +
    + + + + +
    typedef struct _SbgLogDiagData SbgLogDiagData
    +
    +

    Diagnostic log structure.

    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgEComBinaryLogParseDiagData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogParseDiagData (SbgStreamBuffer * pInputStream,
    SbgLogDiagDatapOutputData 
    )
    +
    +

    Parse data for SBG_ECOM_LOG_DIAG messages and fill the corresponding structure.

    +
    Parameters
    + + + +
    [in]pInputStreamInput stream buffer to read the payload from.
    [out]pOutputDataPointer on the output structure that stores parsed data.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the payload has been parsed.
    + +
    +
    + +

    ◆ sbgEComBinaryLogWriteDiagData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogWriteDiagData (SbgStreamBuffer * pOutputStream,
    const SbgLogDiagDatapInputData 
    )
    +
    +

    Write data for SBG_ECOM_LOG_DIAG messages to the output stream buffer from the provided structure.

    +
    Parameters
    + + + +
    [out]pOutputStreamOutput stream buffer to write the payload to.
    [in]pInputDataPointer on the input structure that stores data to write.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the message has been generated in the provided buffer.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_log_diag_8h_source.html b/doc/html/sbg_e_com_binary_log_diag_8h_source.html new file mode 100644 index 0000000..124f25a --- /dev/null +++ b/doc/html/sbg_e_com_binary_log_diag_8h_source.html @@ -0,0 +1,111 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogDiag.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComBinaryLogDiag.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_BINARY_LOG_DIAG_H
    +
    33#define SBG_ECOM_BINARY_LOG_DIAG_H
    +
    34
    +
    35// sbgCommonLib headers
    +
    36#include <sbgCommon.h>
    +
    37#include <streamBuffer/sbgStreamBuffer.h>
    +
    38
    +
    39// Project headers
    + +
    41
    +
    42#ifdef __cplusplus
    +
    43extern "C" {
    +
    44#endif
    +
    45
    +
    46//----------------------------------------------------------------------//
    +
    47//- Constant definitions -//
    +
    48//----------------------------------------------------------------------//
    +
    49
    +
    53#define SBG_ECOM_LOG_DIAG_MAX_STRING_SIZE (SBG_ECOM_MAX_PAYLOAD_SIZE - 6)
    +
    54
    +
    55//----------------------------------------------------------------------//
    +
    56//- Structure definitions -//
    +
    57//----------------------------------------------------------------------//
    +
    58
    +
    62typedef struct _SbgLogDiagData
    +
    63{
    +
    64 uint32_t timestamp;
    +
    65 SbgDebugLogType type;
    +
    66 SbgErrorCode errorCode;
    + + +
    69
    +
    70//----------------------------------------------------------------------//
    +
    71//- Public methods -//
    +
    72//----------------------------------------------------------------------//
    +
    73
    +
    81SbgErrorCode sbgEComBinaryLogParseDiagData(SbgStreamBuffer *pInputStream, SbgLogDiagData *pOutputData);
    +
    82
    +
    83
    +
    91SbgErrorCode sbgEComBinaryLogWriteDiagData(SbgStreamBuffer *pOutputStream, const SbgLogDiagData *pInputData);
    +
    92
    +
    93#ifdef __cplusplus
    +
    94}
    +
    95#endif
    +
    96
    +
    97#endif // SBG_ECOM_BINARY_LOG_DIAG_H
    +
    SbgErrorCode sbgEComBinaryLogParseDiagData(SbgStreamBuffer *pInputStream, SbgLogDiagData *pOutputData)
    +
    #define SBG_ECOM_LOG_DIAG_MAX_STRING_SIZE
    Definition: sbgEComBinaryLogDiag.h:53
    +
    SbgErrorCode sbgEComBinaryLogWriteDiagData(SbgStreamBuffer *pOutputStream, const SbgLogDiagData *pInputData)
    +
    struct _SbgLogDiagData SbgLogDiagData
    +
    Implementation of the sbgECom binary communication protocol.
    +
    Definition: sbgEComBinaryLogDiag.h:63
    +
    SbgDebugLogType type
    Definition: sbgEComBinaryLogDiag.h:65
    +
    uint32_t timestamp
    Definition: sbgEComBinaryLogDiag.h:64
    +
    SbgErrorCode errorCode
    Definition: sbgEComBinaryLogDiag.h:66
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_log_dvl_8h.html b/doc/html/sbg_e_com_binary_log_dvl_8h.html new file mode 100644 index 0000000..8c76ac4 --- /dev/null +++ b/doc/html/sbg_e_com_binary_log_dvl_8h.html @@ -0,0 +1,225 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogDvl.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComBinaryLogDvl.h File Reference
    +
    +
    + +

    Parse received DVL (Doppler Velocity Logger) measurement logs. +More...

    +
    #include <sbgCommon.h>
    +#include <streamBuffer/sbgStreamBuffer.h>
    +
    +

    Go to the source code of this file.

    + + + + +

    +Data Structures

    struct  _SbgLogDvlData
     
    + + + + + +

    +Macros

    #define SBG_ECOM_DVL_VELOCITY_VALID   (0x0001u << 0)
     
    #define SBG_ECOM_DVL_TIME_SYNC   (0x0001u << 1)
     
    + + + +

    +Typedefs

    typedef struct _SbgLogDvlData SbgLogDvlData
     
    + + + + + +

    +Functions

    SbgErrorCode sbgEComBinaryLogParseDvlData (SbgStreamBuffer *pInputStream, SbgLogDvlData *pOutputData)
     
    SbgErrorCode sbgEComBinaryLogWriteDvlData (SbgStreamBuffer *pOutputStream, const SbgLogDvlData *pInputData)
     
    +

    Detailed Description

    +

    Parse received DVL (Doppler Velocity Logger) measurement logs.

    +
    Author
    SBG Systems
    +
    Date
    05 June 2013
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Macro Definition Documentation

    + +

    ◆ SBG_ECOM_DVL_VELOCITY_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_DVL_VELOCITY_VALID   (0x0001u << 0)
    +
    +

    DVL status mask definitions Set to 1 if the DVL equipment was able to measure a valid velocity.

    + +
    +
    + +

    ◆ SBG_ECOM_DVL_TIME_SYNC

    + +
    +
    + + + + +
    #define SBG_ECOM_DVL_TIME_SYNC   (0x0001u << 1)
    +
    +

    Set to 1 if the DVL data is correctly synchronized.

    + +
    +
    +

    Typedef Documentation

    + +

    ◆ SbgLogDvlData

    + +
    +
    + + + + +
    typedef struct _SbgLogDvlData SbgLogDvlData
    +
    +

    Log structure for DVL data.

    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgEComBinaryLogParseDvlData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogParseDvlData (SbgStreamBuffer * pInputStream,
    SbgLogDvlDatapOutputData 
    )
    +
    +

    Parse data for the SBG_ECOM_LOG_DVL_BOTTOM_TRACK / SBG_ECOM_LOG_DVL_WATER_TRACK message and fill the corresponding structure.

    +
    Parameters
    + + + +
    [in]pInputStreamInput stream buffer to read the payload from.
    [out]pOutputDataPointer on the output structure that stores parsed data.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the payload has been parsed.
    + +
    +
    + +

    ◆ sbgEComBinaryLogWriteDvlData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogWriteDvlData (SbgStreamBuffer * pOutputStream,
    const SbgLogDvlDatapInputData 
    )
    +
    +

    Write data for the SBG_ECOM_LOG_DVL_BOTTOM_TRACK / SBG_ECOM_LOG_DVL_WATER_TRACK message to the output stream buffer from the provided structure.

    +
    Parameters
    + + + +
    [out]pOutputStreamOutput stream buffer to write the payload to.
    [in]pInputDataPointer on the input structure that stores data to write.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the message has been generated in the provided buffer.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_log_dvl_8h_source.html b/doc/html/sbg_e_com_binary_log_dvl_8h_source.html new file mode 100644 index 0000000..7dc1d44 --- /dev/null +++ b/doc/html/sbg_e_com_binary_log_dvl_8h_source.html @@ -0,0 +1,106 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogDvl.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComBinaryLogDvl.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_BINARY_LOG_DVL_H
    +
    33#define SBG_ECOM_BINARY_LOG_DVL_H
    +
    34
    +
    35// sbgCommonLib headers
    +
    36#include <sbgCommon.h>
    +
    37#include <streamBuffer/sbgStreamBuffer.h>
    +
    38
    +
    39#ifdef __cplusplus
    +
    40extern "C" {
    +
    41#endif
    +
    42
    +
    43//----------------------------------------------------------------------//
    +
    44//- Log DVL status definitions -//
    +
    45//----------------------------------------------------------------------//
    +
    46
    +
    50#define SBG_ECOM_DVL_VELOCITY_VALID (0x0001u << 0)
    +
    51#define SBG_ECOM_DVL_TIME_SYNC (0x0001u << 1)
    +
    53//----------------------------------------------------------------------//
    +
    54//- Log structure definitions -//
    +
    55//----------------------------------------------------------------------//
    +
    56
    +
    60typedef struct _SbgLogDvlData
    +
    61{
    +
    62 uint32_t timeStamp;
    +
    63 uint16_t status;
    +
    64 float velocity[3];
    +
    65 float velocityQuality[3];
    + +
    68
    +
    69//----------------------------------------------------------------------//
    +
    70//- Public methods -//
    +
    71//----------------------------------------------------------------------//
    +
    72
    +
    80SbgErrorCode sbgEComBinaryLogParseDvlData(SbgStreamBuffer *pInputStream, SbgLogDvlData *pOutputData);
    +
    81
    +
    89SbgErrorCode sbgEComBinaryLogWriteDvlData(SbgStreamBuffer *pOutputStream, const SbgLogDvlData *pInputData);
    +
    90
    +
    91#ifdef __cplusplus
    +
    92}
    +
    93#endif
    +
    94
    +
    95#endif // SBG_ECOM_BINARY_LOG_DVL_H
    +
    struct _SbgLogDvlData SbgLogDvlData
    +
    SbgErrorCode sbgEComBinaryLogParseDvlData(SbgStreamBuffer *pInputStream, SbgLogDvlData *pOutputData)
    +
    SbgErrorCode sbgEComBinaryLogWriteDvlData(SbgStreamBuffer *pOutputStream, const SbgLogDvlData *pInputData)
    +
    Definition: sbgEComBinaryLogDvl.h:61
    +
    uint32_t timeStamp
    Definition: sbgEComBinaryLogDvl.h:62
    +
    float velocityQuality[3]
    Definition: sbgEComBinaryLogDvl.h:65
    +
    uint16_t status
    Definition: sbgEComBinaryLogDvl.h:63
    +
    float velocity[3]
    Definition: sbgEComBinaryLogDvl.h:64
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_log_ekf_8h.html b/doc/html/sbg_e_com_binary_log_ekf_8h.html new file mode 100644 index 0000000..2b737af --- /dev/null +++ b/doc/html/sbg_e_com_binary_log_ekf_8h.html @@ -0,0 +1,943 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogEkf.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComBinaryLogEkf.h File Reference
    +
    +
    + +

    Parse EKF measurements such as attitude, position and velocity logs. +More...

    +
    #include <sbgCommon.h>
    +#include <streamBuffer/sbgStreamBuffer.h>
    +
    +

    Go to the source code of this file.

    + + + + + + + + +

    +Data Structures

    struct  _SbgLogEkfEulerData
     
    struct  _SbgLogEkfQuatData
     
    struct  _SbgLogEkfNavData
     
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    +Macros

    #define SBG_ECOM_SOLUTION_MODE_SHIFT   (0u)
     
    #define SBG_ECOM_SOLUTION_MODE_MASK   (0x0000000Fu)
     
    #define SBG_ECOM_SOL_ATTITUDE_VALID   (0x00000001u << 4)
     
    #define SBG_ECOM_SOL_HEADING_VALID   (0x00000001u << 5)
     
    #define SBG_ECOM_SOL_VELOCITY_VALID   (0x00000001u << 6)
     
    #define SBG_ECOM_SOL_POSITION_VALID   (0x00000001u << 7)
     
    #define SBG_ECOM_SOL_VERT_REF_USED   (0x00000001u << 8)
     
    #define SBG_ECOM_SOL_MAG_REF_USED   (0x00000001u << 9)
     
    #define SBG_ECOM_SOL_GPS1_VEL_USED   (0x00000001u << 10)
     
    #define SBG_ECOM_SOL_GPS1_POS_USED   (0x00000001u << 11)
     
    #define SBG_ECOM_SOL_GPS1_HDT_USED   (0x00000001u << 13)
     
    #define SBG_ECOM_SOL_GPS2_VEL_USED   (0x00000001u << 14)
     
    #define SBG_ECOM_SOL_GPS2_POS_USED   (0x00000001u << 15)
     
    #define SBG_ECOM_SOL_GPS2_HDT_USED   (0x00000001u << 17)
     
    #define SBG_ECOM_SOL_ODO_USED   (0x00000001u << 18)
     
    #define SBG_ECOM_SOL_DVL_BT_USED   (0x00000001u << 19)
     
    #define SBG_ECOM_SOL_DVL_WT_USED   (0x00000001u << 20)
     
    #define SBG_ECOM_SOL_USER_POS_USED   (0x00000001u << 21)
     
    #define SBG_ECOM_SOL_USER_VEL_USED   (0x00000001u << 22)
     
    #define SBG_ECOM_SOL_USER_HEADING_USED   (0x00000001u << 23)
     
    #define SBG_ECOM_SOL_USBL_USED   (0x00000001u << 24)
     
    #define SBG_ECOM_SOL_AIR_DATA_USED   (0x00000001u << 25)
     
    #define SBG_ECOM_SOL_ZUPT_USED   (0x00000001u << 26)
     
    #define SBG_ECOM_SOL_ALIGN_VALID   (0x00000001u << 27)
     
    #define SBG_ECOM_SOL_DEPTH_USED   (0x00000001u << 28)
     
    + + + + + + + + + +

    +Typedefs

    typedef enum _SbgEComSolutionMode SbgEComSolutionMode
     
    typedef struct _SbgLogEkfEulerData SbgLogEkfEulerData
     
    typedef struct _SbgLogEkfQuatData SbgLogEkfQuatData
     
    typedef struct _SbgLogEkfNavData SbgLogEkfNavData
     
    + + + +

    +Enumerations

    enum  _SbgEComSolutionMode {
    +  SBG_ECOM_SOL_MODE_UNINITIALIZED = 0 +,
    +  SBG_ECOM_SOL_MODE_VERTICAL_GYRO = 1 +,
    +  SBG_ECOM_SOL_MODE_AHRS = 2 +,
    +  SBG_ECOM_SOL_MODE_NAV_VELOCITY = 3 +,
    +  SBG_ECOM_SOL_MODE_NAV_POSITION = 4 +
    + }
     
    + + + + + + + + + + + + + + + + + +

    +Functions

    SBG_INLINE SbgEComSolutionMode sbgEComLogEkfGetSolutionMode (uint32_t status)
     
    SBG_INLINE uint32_t sbgEComLogEkfBuildSolutionStatus (SbgEComSolutionMode solutionMode, uint32_t masks)
     
    SbgErrorCode sbgEComBinaryLogParseEkfEulerData (SbgStreamBuffer *pInputStream, SbgLogEkfEulerData *pOutputData)
     
    SbgErrorCode sbgEComBinaryLogWriteEkfEulerData (SbgStreamBuffer *pOutputStream, const SbgLogEkfEulerData *pInputData)
     
    SbgErrorCode sbgEComBinaryLogParseEkfQuatData (SbgStreamBuffer *pInputStream, SbgLogEkfQuatData *pOutputData)
     
    SbgErrorCode sbgEComBinaryLogWriteEkfQuatData (SbgStreamBuffer *pOutputStream, const SbgLogEkfQuatData *pInputData)
     
    SbgErrorCode sbgEComBinaryLogParseEkfNavData (SbgStreamBuffer *pInputStream, SbgLogEkfNavData *pOutputData)
     
    SbgErrorCode sbgEComBinaryLogWriteEkfNavData (SbgStreamBuffer *pOutputStream, const SbgLogEkfNavData *pInputData)
     
    +

    Detailed Description

    +

    Parse EKF measurements such as attitude, position and velocity logs.

    +
    Author
    SBG Systems
    +
    Date
    25 February 2013
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Macro Definition Documentation

    + +

    ◆ SBG_ECOM_SOLUTION_MODE_SHIFT

    + +
    +
    + + + + +
    #define SBG_ECOM_SOLUTION_MODE_SHIFT   (0u)
    +
    +

    Solution status mode definitions. Shift used to extract the clock status part.

    + +
    +
    + +

    ◆ SBG_ECOM_SOLUTION_MODE_MASK

    + +
    +
    + + + + +
    #define SBG_ECOM_SOLUTION_MODE_MASK   (0x0000000Fu)
    +
    +

    Mask used to keep only the clock status part.

    + +
    +
    + +

    ◆ SBG_ECOM_SOL_ATTITUDE_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_SOL_ATTITUDE_VALID   (0x00000001u << 4)
    +
    +

    Solution bit masks definitions. Set to 1 if attitude data is reliable (Roll/Pitch error < 0,5°).

    + +
    +
    + +

    ◆ SBG_ECOM_SOL_HEADING_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_SOL_HEADING_VALID   (0x00000001u << 5)
    +
    +

    Set to 1 if geading data is reliable (Heading error < 1°).

    + +
    +
    + +

    ◆ SBG_ECOM_SOL_VELOCITY_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_SOL_VELOCITY_VALID   (0x00000001u << 6)
    +
    +

    Set to 1 if velocity data is reliable (velocity error < 1.5 m/s).

    + +
    +
    + +

    ◆ SBG_ECOM_SOL_POSITION_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_SOL_POSITION_VALID   (0x00000001u << 7)
    +
    +

    Set to 1 if position data is reliable (Position error < 10m).

    + +
    +
    + +

    ◆ SBG_ECOM_SOL_VERT_REF_USED

    + +
    +
    + + + + +
    #define SBG_ECOM_SOL_VERT_REF_USED   (0x00000001u << 8)
    +
    +

    Set to 1 if vertical reference is used in solution (data used and valid since 3s).

    + +
    +
    + +

    ◆ SBG_ECOM_SOL_MAG_REF_USED

    + +
    +
    + + + + +
    #define SBG_ECOM_SOL_MAG_REF_USED   (0x00000001u << 9)
    +
    +

    Set to 1 if magnetometer is used in solution (data used and valid since 3s).

    + +
    +
    + +

    ◆ SBG_ECOM_SOL_GPS1_VEL_USED

    + +
    +
    + + + + +
    #define SBG_ECOM_SOL_GPS1_VEL_USED   (0x00000001u << 10)
    +
    +

    Set to 1 if GPS1 velocity is used in solution (data used and valid since 3s).

    + +
    +
    + +

    ◆ SBG_ECOM_SOL_GPS1_POS_USED

    + +
    +
    + + + + +
    #define SBG_ECOM_SOL_GPS1_POS_USED   (0x00000001u << 11)
    +
    +

    Set to 1 if GPS1 Position is used in solution (data used and valid since 3s).

    + +
    +
    + +

    ◆ SBG_ECOM_SOL_GPS1_HDT_USED

    + +
    +
    + + + + +
    #define SBG_ECOM_SOL_GPS1_HDT_USED   (0x00000001u << 13)
    +
    +

    Set to 1 if GPS1 True Heading is used in solution (data used and valid since 3s).

    + +
    +
    + +

    ◆ SBG_ECOM_SOL_GPS2_VEL_USED

    + +
    +
    + + + + +
    #define SBG_ECOM_SOL_GPS2_VEL_USED   (0x00000001u << 14)
    +
    +

    Set to 1 if GPS2 velocity is used in solution (data used and valid since 3s).

    + +
    +
    + +

    ◆ SBG_ECOM_SOL_GPS2_POS_USED

    + +
    +
    + + + + +
    #define SBG_ECOM_SOL_GPS2_POS_USED   (0x00000001u << 15)
    +
    +

    Set to 1 if GPS2 Position is used in solution (data used and valid since 3s).

    + +
    +
    + +

    ◆ SBG_ECOM_SOL_GPS2_HDT_USED

    + +
    +
    + + + + +
    #define SBG_ECOM_SOL_GPS2_HDT_USED   (0x00000001u << 17)
    +
    +

    Set to 1 if GPS2 True Heading is used in solution (data used and valid since 3s).

    + +
    +
    + +

    ◆ SBG_ECOM_SOL_ODO_USED

    + +
    +
    + + + + +
    #define SBG_ECOM_SOL_ODO_USED   (0x00000001u << 18)
    +
    +

    Set to 1 if Odometer is used in solution (data used and valid since 3s).

    + +
    +
    + +

    ◆ SBG_ECOM_SOL_DVL_BT_USED

    + +
    +
    + + + + +
    #define SBG_ECOM_SOL_DVL_BT_USED   (0x00000001u << 19)
    +
    +

    Set to 1 if DVL Bottom Tracking is used in solution (data used and valid since 3s).

    + +
    +
    + +

    ◆ SBG_ECOM_SOL_DVL_WT_USED

    + +
    +
    + + + + +
    #define SBG_ECOM_SOL_DVL_WT_USED   (0x00000001u << 20)
    +
    +

    Set to 1 if DVL Water Tracking is used in solution (data used and valid since 3s).

    + +
    +
    + +

    ◆ SBG_ECOM_SOL_USER_POS_USED

    + +
    +
    + + + + +
    #define SBG_ECOM_SOL_USER_POS_USED   (0x00000001u << 21)
    +
    +

    Set to 1 if user velocity is used in solution (data used and valid since 3s).

    + +
    +
    + +

    ◆ SBG_ECOM_SOL_USER_VEL_USED

    + +
    +
    + + + + +
    #define SBG_ECOM_SOL_USER_VEL_USED   (0x00000001u << 22)
    +
    +

    Set to 1 if user Position is used in solution (data used and valid since 3s).

    + +
    +
    + +

    ◆ SBG_ECOM_SOL_USER_HEADING_USED

    + +
    +
    + + + + +
    #define SBG_ECOM_SOL_USER_HEADING_USED   (0x00000001u << 23)
    +
    +

    Set to 1 if user Course is used in solution (data used and valid since 3s).

    + +
    +
    + +

    ◆ SBG_ECOM_SOL_USBL_USED

    + +
    +
    + + + + +
    #define SBG_ECOM_SOL_USBL_USED   (0x00000001u << 24)
    +
    +

    Set to 1 if USBL / LBL is used in solution (data used and valid since 3s).

    + +
    +
    + +

    ◆ SBG_ECOM_SOL_AIR_DATA_USED

    + +
    +
    + + + + +
    #define SBG_ECOM_SOL_AIR_DATA_USED   (0x00000001u << 25)
    +
    +

    Set to 1 if AirData (altimeter and/or true airspeed) is used in solution (data used and valid since 3s).

    + +
    +
    + +

    ◆ SBG_ECOM_SOL_ZUPT_USED

    + +
    +
    + + + + +
    #define SBG_ECOM_SOL_ZUPT_USED   (0x00000001u << 26)
    +
    +

    Set to 1 if a ZUPT is used in solution (data used and valid since 3s).

    + +
    +
    + +

    ◆ SBG_ECOM_SOL_ALIGN_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_SOL_ALIGN_VALID   (0x00000001u << 27)
    +
    +

    Set to 1 if sensor alignment and calibration parameters are valid

    + +
    +
    + +

    ◆ SBG_ECOM_SOL_DEPTH_USED

    + +
    +
    + + + + +
    #define SBG_ECOM_SOL_DEPTH_USED   (0x00000001u << 28)
    +
    +

    Set to 1 if Depth sensor (for subsea navigation) is used in solution (data used and valid since 3s).

    + +
    +
    +

    Typedef Documentation

    + +

    ◆ SbgEComSolutionMode

    + +
    +
    + + + + +
    typedef enum _SbgEComSolutionMode SbgEComSolutionMode
    +
    +

    Solution filter mode enum.

    + +
    +
    + +

    ◆ SbgLogEkfEulerData

    + +
    +
    + + + + +
    typedef struct _SbgLogEkfEulerData SbgLogEkfEulerData
    +
    +

    EKF computed orientation using euler angles.

    + +
    +
    + +

    ◆ SbgLogEkfQuatData

    + +
    +
    + + + + +
    typedef struct _SbgLogEkfQuatData SbgLogEkfQuatData
    +
    +

    EFK computed orientation using quaternion.

    + +
    +
    + +

    ◆ SbgLogEkfNavData

    + +
    +
    + + + + +
    typedef struct _SbgLogEkfNavData SbgLogEkfNavData
    +
    +

    EFK computed navigation data.

    + +
    +
    +

    Enumeration Type Documentation

    + +

    ◆ _SbgEComSolutionMode

    + +
    +
    + + + + +
    enum _SbgEComSolutionMode
    +
    +

    Solution filter mode enum.

    + + + + + + +
    Enumerator
    SBG_ECOM_SOL_MODE_UNINITIALIZED 

    The Kalman filter is not initialized and the returned data are all invalid.

    +
    SBG_ECOM_SOL_MODE_VERTICAL_GYRO 

    The Kalman filter only rely on a vertical reference to compute roll and pitch angles. Heading and navigation data drift freely.

    +
    SBG_ECOM_SOL_MODE_AHRS 

    A heading reference is available, the Kalman filter provides full orientation but navigation data drift freely.

    +
    SBG_ECOM_SOL_MODE_NAV_VELOCITY 

    The Kalman filter computes orientation and velocity. Position is freely integrated from velocity estimation.

    +
    SBG_ECOM_SOL_MODE_NAV_POSITION 

    Nominal mode, the Kalman filter computes all parameters (attitude, velocity, position). Absolute position is provided.

    +
    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgEComLogEkfGetSolutionMode()

    + +
    +
    + + + + + + + + +
    SBG_INLINE SbgEComSolutionMode sbgEComLogEkfGetSolutionMode (uint32_t status)
    +
    +

    Method used to read the solution mode from a solution status field.

    +
    Parameters
    + + +
    [in]statusStatus uint32_t value to extract the solution mode from it.
    +
    +
    +
    Returns
    The extracted solution mode.
    + +

    References SBG_ECOM_SOLUTION_MODE_MASK, and SBG_ECOM_SOLUTION_MODE_SHIFT.

    + +
    +
    + +

    ◆ sbgEComLogEkfBuildSolutionStatus()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SBG_INLINE uint32_t sbgEComLogEkfBuildSolutionStatus (SbgEComSolutionMode solutionMode,
    uint32_t masks 
    )
    +
    +

    Method used to write the solution status field.

    +
    Parameters
    + + + +
    [in]solutionModeThe solution mode to set.
    [in]masksBit mask to set.
    +
    +
    +
    Returns
    The build solution status field.
    + +

    References SBG_ECOM_SOLUTION_MODE_MASK, and SBG_ECOM_SOLUTION_MODE_SHIFT.

    + +
    +
    + +

    ◆ sbgEComBinaryLogParseEkfEulerData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogParseEkfEulerData (SbgStreamBuffer * pInputStream,
    SbgLogEkfEulerDatapOutputData 
    )
    +
    +

    Parse data for the SBG_ECOM_LOG_EKF_EULER message and fill the corresponding structure.

    +
    Parameters
    + + + +
    [in]pInputStreamInput stream buffer to read the payload from.
    [out]pOutputDataPointer on the output structure that stores parsed data.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the payload has been parsed.
    + +
    +
    + +

    ◆ sbgEComBinaryLogWriteEkfEulerData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogWriteEkfEulerData (SbgStreamBuffer * pOutputStream,
    const SbgLogEkfEulerDatapInputData 
    )
    +
    +

    Write data for the SBG_ECOM_LOG_EKF_EULER message to the output stream buffer from the provided structure.

    +
    Parameters
    + + + +
    [out]pOutputStreamOutput stream buffer to write the payload to.
    [in]pInputDataPointer on the input structure that stores data to write.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the message has been generated in the provided buffer.
    + +
    +
    + +

    ◆ sbgEComBinaryLogParseEkfQuatData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogParseEkfQuatData (SbgStreamBuffer * pInputStream,
    SbgLogEkfQuatDatapOutputData 
    )
    +
    +

    Parse data for the SBG_ECOM_LOG_EKF_QUAT message and fill the corresponding structure.

    +
    Parameters
    + + + +
    [in]pInputStreamInput stream buffer to read the payload from.
    [out]pOutputDataPointer on the output structure that stores parsed data.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the payload has been parsed.
    + +
    +
    + +

    ◆ sbgEComBinaryLogWriteEkfQuatData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogWriteEkfQuatData (SbgStreamBuffer * pOutputStream,
    const SbgLogEkfQuatDatapInputData 
    )
    +
    +

    Write data for the SBG_ECOM_LOG_EKF_QUAT message to the output stream buffer from the provided structure.

    +
    Parameters
    + + + +
    [out]pOutputStreamOutput stream buffer to write the payload to.
    [in]pInputDataPointer on the input structure that stores data to write.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the message has been generated in the provided buffer.
    + +
    +
    + +

    ◆ sbgEComBinaryLogParseEkfNavData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogParseEkfNavData (SbgStreamBuffer * pInputStream,
    SbgLogEkfNavDatapOutputData 
    )
    +
    +

    Parse data for the SBG_ECOM_LOG_EKF_NAV message and fill the corresponding structure.

    +
    Parameters
    + + + +
    [in]pInputStreamInput stream buffer to read the payload from.
    [out]pOutputDataPointer on the output structure that stores parsed data.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the payload has been parsed.
    + +
    +
    + +

    ◆ sbgEComBinaryLogWriteEkfNavData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogWriteEkfNavData (SbgStreamBuffer * pOutputStream,
    const SbgLogEkfNavDatapInputData 
    )
    +
    +

    Write data for the SBG_ECOM_LOG_EKF_NAV message to the output stream buffer from the provided structure.

    +
    Parameters
    + + + +
    [out]pOutputStreamOutput stream buffer to write the payload to.
    [in]pInputDataPointer on the input structure that stores data to write.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the message has been generated in the provided buffer.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_log_ekf_8h_source.html b/doc/html/sbg_e_com_binary_log_ekf_8h_source.html new file mode 100644 index 0000000..9fd58a5 --- /dev/null +++ b/doc/html/sbg_e_com_binary_log_ekf_8h_source.html @@ -0,0 +1,213 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogEkf.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComBinaryLogEkf.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_BINARY_LOG_EKF_H
    +
    33#define SBG_ECOM_BINARY_LOG_EKF_H
    +
    34
    +
    35// sbgCommonLib headers
    +
    36#include <sbgCommon.h>
    +
    37#include <streamBuffer/sbgStreamBuffer.h>
    +
    38
    +
    39#ifdef __cplusplus
    +
    40extern "C" {
    +
    41#endif
    +
    42
    +
    43//----------------------------------------------------------------------//
    +
    44//- Solution status definitions -//
    +
    45//----------------------------------------------------------------------//
    +
    46
    +
    50#define SBG_ECOM_SOLUTION_MODE_SHIFT (0u)
    +
    51#define SBG_ECOM_SOLUTION_MODE_MASK (0x0000000Fu)
    +
    56#define SBG_ECOM_SOL_ATTITUDE_VALID (0x00000001u << 4)
    +
    57#define SBG_ECOM_SOL_HEADING_VALID (0x00000001u << 5)
    +
    58#define SBG_ECOM_SOL_VELOCITY_VALID (0x00000001u << 6)
    +
    59#define SBG_ECOM_SOL_POSITION_VALID (0x00000001u << 7)
    +
    60#define SBG_ECOM_SOL_VERT_REF_USED (0x00000001u << 8)
    +
    61#define SBG_ECOM_SOL_MAG_REF_USED (0x00000001u << 9)
    +
    62#define SBG_ECOM_SOL_GPS1_VEL_USED (0x00000001u << 10)
    +
    63#define SBG_ECOM_SOL_GPS1_POS_USED (0x00000001u << 11)
    +
    64#define SBG_ECOM_SOL_GPS1_HDT_USED (0x00000001u << 13)
    +
    65#define SBG_ECOM_SOL_GPS2_VEL_USED (0x00000001u << 14)
    +
    66#define SBG_ECOM_SOL_GPS2_POS_USED (0x00000001u << 15)
    +
    67#define SBG_ECOM_SOL_GPS2_HDT_USED (0x00000001u << 17)
    +
    68#define SBG_ECOM_SOL_ODO_USED (0x00000001u << 18)
    +
    69#define SBG_ECOM_SOL_DVL_BT_USED (0x00000001u << 19)
    +
    70#define SBG_ECOM_SOL_DVL_WT_USED (0x00000001u << 20)
    +
    71#define SBG_ECOM_SOL_USER_POS_USED (0x00000001u << 21)
    +
    72#define SBG_ECOM_SOL_USER_VEL_USED (0x00000001u << 22)
    +
    73#define SBG_ECOM_SOL_USER_HEADING_USED (0x00000001u << 23)
    +
    74#define SBG_ECOM_SOL_USBL_USED (0x00000001u << 24)
    +
    75#define SBG_ECOM_SOL_AIR_DATA_USED (0x00000001u << 25)
    +
    76#define SBG_ECOM_SOL_ZUPT_USED (0x00000001u << 26)
    +
    77#define SBG_ECOM_SOL_ALIGN_VALID (0x00000001u << 27)
    +
    78#define SBG_ECOM_SOL_DEPTH_USED (0x00000001u << 28)
    + +
    84{
    + + + + + + +
    91
    +
    92//----------------------------------------------------------------------//
    +
    93//- Solution status helpers methods -//
    +
    94//----------------------------------------------------------------------//
    +
    95
    + +
    103{
    + +
    105}
    +
    106
    +
    114SBG_INLINE uint32_t sbgEComLogEkfBuildSolutionStatus(SbgEComSolutionMode solutionMode, uint32_t masks)
    +
    115{
    +
    116 //
    +
    117 // Create the combined status field
    +
    118 //
    +
    119 return ((((uint32_t)solutionMode)&SBG_ECOM_SOLUTION_MODE_MASK) << SBG_ECOM_SOLUTION_MODE_SHIFT) | masks;
    +
    120}
    +
    121
    +
    122
    +
    123//----------------------------------------------------------------------//
    +
    124//- Log structure definitions -//
    +
    125//----------------------------------------------------------------------//
    +
    126
    + +
    131{
    +
    132 uint32_t timeStamp;
    +
    133 float euler[3];
    +
    134 float eulerStdDev[3];
    +
    135 uint32_t status;
    + +
    137
    +
    141typedef struct _SbgLogEkfQuatData
    +
    142{
    +
    143 uint32_t timeStamp;
    +
    144 float quaternion[4];
    +
    145 float eulerStdDev[3];
    +
    146 uint32_t status;
    + +
    148
    +
    152typedef struct _SbgLogEkfNavData
    +
    153{
    +
    154 uint32_t timeStamp;
    +
    155 float velocity[3];
    +
    156 float velocityStdDev[3];
    +
    157 double position[3];
    + +
    160 float positionStdDev[3];
    +
    161 uint32_t status;
    + +
    163
    +
    164//----------------------------------------------------------------------//
    +
    165//- Public methods -//
    +
    166//----------------------------------------------------------------------//
    +
    167
    +
    175SbgErrorCode sbgEComBinaryLogParseEkfEulerData(SbgStreamBuffer *pInputStream, SbgLogEkfEulerData *pOutputData);
    +
    176
    +
    184SbgErrorCode sbgEComBinaryLogWriteEkfEulerData(SbgStreamBuffer *pOutputStream, const SbgLogEkfEulerData *pInputData);
    +
    185
    +
    193SbgErrorCode sbgEComBinaryLogParseEkfQuatData(SbgStreamBuffer *pInputStream, SbgLogEkfQuatData *pOutputData);
    +
    194
    +
    202SbgErrorCode sbgEComBinaryLogWriteEkfQuatData(SbgStreamBuffer *pOutputStream, const SbgLogEkfQuatData *pInputData);
    +
    203
    +
    211SbgErrorCode sbgEComBinaryLogParseEkfNavData(SbgStreamBuffer *pInputStream, SbgLogEkfNavData *pOutputData);
    +
    212
    +
    220SbgErrorCode sbgEComBinaryLogWriteEkfNavData(SbgStreamBuffer *pOutputStream, const SbgLogEkfNavData *pInputData);
    +
    221
    +
    222#ifdef __cplusplus
    +
    223}
    +
    224#endif
    +
    225
    +
    226#endif // SBG_ECOM_BINARY_LOG_EKF_H
    +
    struct _SbgLogEkfNavData SbgLogEkfNavData
    +
    _SbgEComSolutionMode
    Definition: sbgEComBinaryLogEkf.h:84
    +
    @ SBG_ECOM_SOL_MODE_VERTICAL_GYRO
    Definition: sbgEComBinaryLogEkf.h:86
    +
    @ SBG_ECOM_SOL_MODE_AHRS
    Definition: sbgEComBinaryLogEkf.h:87
    +
    @ SBG_ECOM_SOL_MODE_UNINITIALIZED
    Definition: sbgEComBinaryLogEkf.h:85
    +
    @ SBG_ECOM_SOL_MODE_NAV_POSITION
    Definition: sbgEComBinaryLogEkf.h:89
    +
    @ SBG_ECOM_SOL_MODE_NAV_VELOCITY
    Definition: sbgEComBinaryLogEkf.h:88
    +
    SbgErrorCode sbgEComBinaryLogWriteEkfNavData(SbgStreamBuffer *pOutputStream, const SbgLogEkfNavData *pInputData)
    +
    SBG_INLINE SbgEComSolutionMode sbgEComLogEkfGetSolutionMode(uint32_t status)
    Definition: sbgEComBinaryLogEkf.h:102
    +
    SBG_INLINE uint32_t sbgEComLogEkfBuildSolutionStatus(SbgEComSolutionMode solutionMode, uint32_t masks)
    Definition: sbgEComBinaryLogEkf.h:114
    +
    SbgErrorCode sbgEComBinaryLogParseEkfQuatData(SbgStreamBuffer *pInputStream, SbgLogEkfQuatData *pOutputData)
    +
    #define SBG_ECOM_SOLUTION_MODE_SHIFT
    Definition: sbgEComBinaryLogEkf.h:50
    +
    SbgErrorCode sbgEComBinaryLogWriteEkfEulerData(SbgStreamBuffer *pOutputStream, const SbgLogEkfEulerData *pInputData)
    +
    struct _SbgLogEkfEulerData SbgLogEkfEulerData
    +
    SbgErrorCode sbgEComBinaryLogParseEkfNavData(SbgStreamBuffer *pInputStream, SbgLogEkfNavData *pOutputData)
    +
    SbgErrorCode sbgEComBinaryLogParseEkfEulerData(SbgStreamBuffer *pInputStream, SbgLogEkfEulerData *pOutputData)
    +
    struct _SbgLogEkfQuatData SbgLogEkfQuatData
    +
    #define SBG_ECOM_SOLUTION_MODE_MASK
    Definition: sbgEComBinaryLogEkf.h:51
    +
    SbgErrorCode sbgEComBinaryLogWriteEkfQuatData(SbgStreamBuffer *pOutputStream, const SbgLogEkfQuatData *pInputData)
    +
    enum _SbgEComSolutionMode SbgEComSolutionMode
    +
    Definition: sbgEComBinaryLogEkf.h:131
    +
    uint32_t status
    Definition: sbgEComBinaryLogEkf.h:135
    +
    uint32_t timeStamp
    Definition: sbgEComBinaryLogEkf.h:132
    +
    float eulerStdDev[3]
    Definition: sbgEComBinaryLogEkf.h:134
    +
    float euler[3]
    Definition: sbgEComBinaryLogEkf.h:133
    +
    Definition: sbgEComBinaryLogEkf.h:153
    +
    double position[3]
    Definition: sbgEComBinaryLogEkf.h:157
    +
    uint32_t timeStamp
    Definition: sbgEComBinaryLogEkf.h:154
    +
    float velocityStdDev[3]
    Definition: sbgEComBinaryLogEkf.h:156
    +
    float positionStdDev[3]
    Definition: sbgEComBinaryLogEkf.h:160
    +
    float undulation
    Definition: sbgEComBinaryLogEkf.h:159
    +
    float velocity[3]
    Definition: sbgEComBinaryLogEkf.h:155
    +
    uint32_t status
    Definition: sbgEComBinaryLogEkf.h:161
    +
    Definition: sbgEComBinaryLogEkf.h:142
    +
    float quaternion[4]
    Definition: sbgEComBinaryLogEkf.h:144
    +
    uint32_t timeStamp
    Definition: sbgEComBinaryLogEkf.h:143
    +
    uint32_t status
    Definition: sbgEComBinaryLogEkf.h:146
    +
    float eulerStdDev[3]
    Definition: sbgEComBinaryLogEkf.h:145
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_log_event_8h.html b/doc/html/sbg_e_com_binary_log_event_8h.html new file mode 100644 index 0000000..b9369c3 --- /dev/null +++ b/doc/html/sbg_e_com_binary_log_event_8h.html @@ -0,0 +1,276 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogEvent.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComBinaryLogEvent.h File Reference
    +
    +
    + +

    Parse event markers logs used to timestamp external signals. +More...

    +
    #include <sbgCommon.h>
    +#include <streamBuffer/sbgStreamBuffer.h>
    +
    +

    Go to the source code of this file.

    + + + + +

    +Data Structures

    struct  _SbgLogEvent
     
    + + + + + + + + + + + +

    +Macros

    #define SBG_ECOM_EVENT_OVERFLOW   (0x00000001u << 0)
     
    #define SBG_ECOM_EVENT_OFFSET_0_VALID   (0x00000001u << 1)
     
    #define SBG_ECOM_EVENT_OFFSET_1_VALID   (0x00000001u << 2)
     
    #define SBG_ECOM_EVENT_OFFSET_2_VALID   (0x00000001u << 3)
     
    #define SBG_ECOM_EVENT_OFFSET_3_VALID   (0x00000001u << 4)
     
    + + + +

    +Typedefs

    typedef struct _SbgLogEvent SbgLogEvent
     
    + + + + + +

    +Functions

    SbgErrorCode sbgEComBinaryLogParseEvent (SbgStreamBuffer *pInputStream, SbgLogEvent *pOutputData)
     
    SbgErrorCode sbgEComBinaryLogWriteEvent (SbgStreamBuffer *pOutputStream, const SbgLogEvent *pInputData)
     
    +

    Detailed Description

    +

    Parse event markers logs used to timestamp external signals.

    +
    Author
    SBG Systems
    +
    Date
    28 October 2013
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Macro Definition Documentation

    + +

    ◆ SBG_ECOM_EVENT_OVERFLOW

    + +
    +
    + + + + +
    #define SBG_ECOM_EVENT_OVERFLOW   (0x00000001u << 0)
    +
    +

    Log market events status mask definitions Set to 1 if we have received events at a higher rate than 1 kHz.

    + +
    +
    + +

    ◆ SBG_ECOM_EVENT_OFFSET_0_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_EVENT_OFFSET_0_VALID   (0x00000001u << 1)
    +
    +

    Set to 1 if at least two events have been received.

    + +
    +
    + +

    ◆ SBG_ECOM_EVENT_OFFSET_1_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_EVENT_OFFSET_1_VALID   (0x00000001u << 2)
    +
    +

    Set to 1 if at least three events have been received.

    + +
    +
    + +

    ◆ SBG_ECOM_EVENT_OFFSET_2_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_EVENT_OFFSET_2_VALID   (0x00000001u << 3)
    +
    +

    Set to 1 if at least four events have been received.

    + +
    +
    + +

    ◆ SBG_ECOM_EVENT_OFFSET_3_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_EVENT_OFFSET_3_VALID   (0x00000001u << 4)
    +
    +

    Set to 1 if at least five events have been received.

    + +
    +
    +

    Typedef Documentation

    + +

    ◆ SbgLogEvent

    + +
    +
    + + + + +
    typedef struct _SbgLogEvent SbgLogEvent
    +
    +

    Structure that stores data for the SBG_ECOM_LOG_EVENT_# message.

    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgEComBinaryLogParseEvent()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogParseEvent (SbgStreamBuffer * pInputStream,
    SbgLogEventpOutputData 
    )
    +
    +

    Parse data for the SBG_ECOM_LOG_EVENT_# message and fill the corresponding structure.

    +
    Parameters
    + + + +
    [in]pInputStreamInput stream buffer to read the payload from.
    [out]pOutputDataPointer on the output structure that stores parsed data.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the payload has been parsed.
    + +
    +
    + +

    ◆ sbgEComBinaryLogWriteEvent()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogWriteEvent (SbgStreamBuffer * pOutputStream,
    const SbgLogEventpInputData 
    )
    +
    +

    Write data for the SBG_ECOM_LOG_EVENT_# message to the output stream buffer from the provided structure.

    +
    Parameters
    + + + +
    [out]pOutputStreamOutput stream buffer to write the payload to.
    [in]pInputDataPointer on the input structure that stores data to write.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the message has been generated in the provided buffer.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_log_event_8h_source.html b/doc/html/sbg_e_com_binary_log_event_8h_source.html new file mode 100644 index 0000000..35926fc --- /dev/null +++ b/doc/html/sbg_e_com_binary_log_event_8h_source.html @@ -0,0 +1,113 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogEvent.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComBinaryLogEvent.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_BINARY_LOG_EVENT_H
    +
    33#define SBG_ECOM_BINARY_LOG_EVENT_H
    +
    34
    +
    35// sbgCommonLib headers
    +
    36#include <sbgCommon.h>
    +
    37#include <streamBuffer/sbgStreamBuffer.h>
    +
    38
    +
    39#ifdef __cplusplus
    +
    40extern "C" {
    +
    41#endif
    +
    42
    +
    43//----------------------------------------------------------------------//
    +
    44//- Log marker events definitions -//
    +
    45//----------------------------------------------------------------------//
    +
    46
    +
    50#define SBG_ECOM_EVENT_OVERFLOW (0x00000001u << 0)
    +
    51#define SBG_ECOM_EVENT_OFFSET_0_VALID (0x00000001u << 1)
    +
    52#define SBG_ECOM_EVENT_OFFSET_1_VALID (0x00000001u << 2)
    +
    53#define SBG_ECOM_EVENT_OFFSET_2_VALID (0x00000001u << 3)
    +
    54#define SBG_ECOM_EVENT_OFFSET_3_VALID (0x00000001u << 4)
    +
    56//----------------------------------------------------------------------//
    +
    57//- Log structure definitions -//
    +
    58//----------------------------------------------------------------------//
    +
    59
    +
    63typedef struct _SbgLogEvent
    +
    64{
    +
    65 uint32_t timeStamp;
    +
    66 uint16_t status;
    +
    67 uint16_t timeOffset0;
    +
    68 uint16_t timeOffset1;
    +
    69 uint16_t timeOffset2;
    +
    70 uint16_t timeOffset3;
    + +
    72
    +
    73//----------------------------------------------------------------------//
    +
    74//- Public methods -//
    +
    75//----------------------------------------------------------------------//
    +
    76
    +
    84SbgErrorCode sbgEComBinaryLogParseEvent(SbgStreamBuffer *pInputStream, SbgLogEvent *pOutputData);
    +
    85
    +
    93SbgErrorCode sbgEComBinaryLogWriteEvent(SbgStreamBuffer *pOutputStream, const SbgLogEvent *pInputData);
    +
    94
    +
    95#ifdef __cplusplus
    +
    96}
    +
    97#endif
    +
    98
    +
    99#endif // SBG_ECOM_BINARY_LOG_EVENT_H
    +
    struct _SbgLogEvent SbgLogEvent
    +
    SbgErrorCode sbgEComBinaryLogParseEvent(SbgStreamBuffer *pInputStream, SbgLogEvent *pOutputData)
    +
    SbgErrorCode sbgEComBinaryLogWriteEvent(SbgStreamBuffer *pOutputStream, const SbgLogEvent *pInputData)
    +
    Definition: sbgEComBinaryLogEvent.h:64
    +
    uint16_t timeOffset2
    Definition: sbgEComBinaryLogEvent.h:69
    +
    uint32_t timeStamp
    Definition: sbgEComBinaryLogEvent.h:65
    +
    uint16_t timeOffset0
    Definition: sbgEComBinaryLogEvent.h:67
    +
    uint16_t timeOffset3
    Definition: sbgEComBinaryLogEvent.h:70
    +
    uint16_t status
    Definition: sbgEComBinaryLogEvent.h:66
    +
    uint16_t timeOffset1
    Definition: sbgEComBinaryLogEvent.h:68
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_log_gps_8h.html b/doc/html/sbg_e_com_binary_log_gps_8h.html new file mode 100644 index 0000000..4b56865 --- /dev/null +++ b/doc/html/sbg_e_com_binary_log_gps_8h.html @@ -0,0 +1,1518 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogGps.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComBinaryLogGps.h File Reference
    +
    +
    + +

    Parse received GNSS logs such as Position, Velocity and True Heading. +More...

    +
    #include <sbgCommon.h>
    +#include <streamBuffer/sbgStreamBuffer.h>
    +#include "sbgEComBinaryLogRawData.h"
    +
    +

    Go to the source code of this file.

    + + + + + + + + +

    +Data Structures

    struct  _SbgLogGpsVel
     
    struct  _SbgLogGpsPos
     
    struct  _SbgLogGpsHdt
     
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    +Macros

    #define SBG_ECOM_GPS_VEL_STATUS_SHIFT   (0u)
     
    #define SBG_ECOM_GPS_VEL_STATUS_MASK   (0x0000003Fu)
     
    #define SBG_ECOM_GPS_VEL_TYPE_SHIFT   (6u)
     
    #define SBG_ECOM_GPS_VEL_TYPE_MASK   (0x0000003Fu)
     
    #define SBG_ECOM_GPS_POS_STATUS_SHIFT   (0u)
     
    #define SBG_ECOM_GPS_POS_STATUS_MASK   (0x0000003Fu)
     
    #define SBG_ECOM_GPS_POS_TYPE_SHIFT   (6u)
     
    #define SBG_ECOM_GPS_POS_TYPE_MASK   (0x0000003Fu)
     
    #define SBG_ECOM_GPS_POS_GPS_L1_USED   (0x00000001u << 12)
     
    #define SBG_ECOM_GPS_POS_GPS_L2_USED   (0x00000001u << 13)
     
    #define SBG_ECOM_GPS_POS_GPS_L5_USED   (0x00000001u << 14)
     
    #define SBG_ECOM_GPS_POS_GLO_L1_USED   (0x00000001u << 15)
     
    #define SBG_ECOM_GPS_POS_GLO_L2_USED   (0x00000001u << 16)
     
    #define SBG_ECOM_GPS_POS_GLO_L3_USED   (0x00000001u << 17)
     
    #define SBG_ECOM_GPS_POS_GAL_E1_USED   (0x00000001u << 18)
     
    #define SBG_ECOM_GPS_POS_GAL_E5A_USED   (0x00000001u << 19)
     
    #define SBG_ECOM_GPS_POS_GAL_E5B_USED   (0x00000001u << 20)
     
    #define SBG_ECOM_GPS_POS_GAL_E5ALT_USED   (0x00000001u << 21)
     
    #define SBG_ECOM_GPS_POS_GAL_E6_USED   (0x00000001u << 22)
     
    #define SBG_ECOM_GPS_POS_BDS_B1_USED   (0x00000001u << 23)
     
    #define SBG_ECOM_GPS_POS_BDS_B2_USED   (0x00000001u << 24)
     
    #define SBG_ECOM_GPS_POS_BDS_B3_USED   (0x00000001u << 25)
     
    #define SBG_ECOM_GPS_POS_QZSS_L1_USED   (0x00000001u << 26)
     
    #define SBG_ECOM_GPS_POS_QZSS_L2_USED   (0x00000001u << 27)
     
    #define SBG_ECOM_GPS_POS_QZSS_L5_USED   (0x00000001u << 28)
     
    #define SBG_ECOM_GPS_HDT_STATUS_SHIFT   (0u)
     
    #define SBG_ECOM_GPS_HDT_STATUS_MASK   (0x0000003Fu)
     
    #define SBG_ECOM_GPS_HDT_BASELINE_VALID   (0x0001 << 6)
     
    + + + + + + + + + + + + + + + + + +

    +Typedefs

    typedef enum _SbgEComGpsVelStatus SbgEComGpsVelStatus
     
    typedef enum _SbgEComGpsVelType SbgEComGpsVelType
     
    typedef enum _SbgEComGpsPosStatus SbgEComGpsPosStatus
     
    typedef enum _SbgEComGpsPosType SbgEComGpsPosType
     
    typedef enum _SbgEComGpsHdtStatus SbgEComGpsHdtStatus
     
    typedef struct _SbgLogGpsVel SbgLogGpsVel
     
    typedef struct _SbgLogGpsPos SbgLogGpsPos
     
    typedef struct _SbgLogGpsHdt SbgLogGpsHdt
     
    + + + + + + + + + + + +

    +Enumerations

    enum  _SbgEComGpsVelStatus {
    +  SBG_ECOM_VEL_SOL_COMPUTED = 0 +,
    +  SBG_ECOM_VEL_INSUFFICIENT_OBS = 1 +,
    +  SBG_ECOM_VEL_INTERNAL_ERROR = 2 +,
    +  SBG_ECOM_VEL_LIMIT = 3 +
    + }
     
    enum  _SbgEComGpsVelType {
    +  SBG_ECOM_VEL_NO_SOLUTION = 0 +,
    +  SBG_ECOM_VEL_UNKNOWN_TYPE = 1 +,
    +  SBG_ECOM_VEL_DOPPLER = 2 +,
    +  SBG_ECOM_VEL_DIFFERENTIAL = 3 +
    + }
     
    enum  _SbgEComGpsPosStatus {
    +  SBG_ECOM_POS_SOL_COMPUTED = 0 +,
    +  SBG_ECOM_POS_INSUFFICIENT_OBS = 1 +,
    +  SBG_ECOM_POS_INTERNAL_ERROR = 2 +,
    +  SBG_ECOM_POS_HEIGHT_LIMIT = 3 +
    + }
     
    enum  _SbgEComGpsPosType {
    +  SBG_ECOM_POS_NO_SOLUTION = 0 +,
    +  SBG_ECOM_POS_UNKNOWN_TYPE = 1 +,
    +  SBG_ECOM_POS_SINGLE = 2 +,
    +  SBG_ECOM_POS_PSRDIFF = 3 +,
    +  SBG_ECOM_POS_SBAS = 4 +,
    +  SBG_ECOM_POS_OMNISTAR = 5 +,
    +  SBG_ECOM_POS_RTK_FLOAT = 6 +,
    +  SBG_ECOM_POS_RTK_INT = 7 +,
    +  SBG_ECOM_POS_PPP_FLOAT = 8 +,
    +  SBG_ECOM_POS_PPP_INT = 9 +,
    +  SBG_ECOM_POS_FIXED = 10 +
    + }
     
    enum  _SbgEComGpsHdtStatus {
    +  SBG_ECOM_HDT_SOL_COMPUTED = 0 +,
    +  SBG_ECOM_HDT_INSUFFICIENT_OBS = 1 +,
    +  SBG_ECOM_HDT_INTERNAL_ERROR = 2 +,
    +  SBG_ECOM_HDT_HEIGHT_LIMIT = 3 +
    + }
     
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    +Functions

    SBG_INLINE SbgEComGpsVelStatus sbgEComLogGpsVelGetStatus (uint32_t status)
     
    SBG_INLINE SbgEComGpsVelType sbgEComLogGpsVelGetType (uint32_t status)
     
    SBG_INLINE uint32_t sbgEComLogGpsVelBuildStatus (SbgEComGpsVelStatus status, SbgEComGpsVelType type)
     
    SBG_INLINE SbgEComGpsPosStatus sbgEComLogGpsPosGetStatus (uint32_t status)
     
    SBG_INLINE SbgEComGpsPosType sbgEComLogGpsPosGetType (uint32_t status)
     
    SBG_INLINE uint32_t sbgEComLogGpsPosBuildStatus (SbgEComGpsPosStatus status, SbgEComGpsPosType type, uint32_t masks)
     
    SBG_INLINE SbgEComGpsHdtStatus sbgEComLogGpsHdtGetStatus (uint32_t status)
     
    SBG_INLINE uint32_t sbgEComLogGpsHdtBuildStatus (SbgEComGpsHdtStatus status, uint32_t masks)
     
    SbgErrorCode sbgEComBinaryLogParseGpsVelData (SbgStreamBuffer *pInputStream, SbgLogGpsVel *pOutputData)
     
    SbgErrorCode sbgEComBinaryLogWriteGpsVelData (SbgStreamBuffer *pOutputStream, const SbgLogGpsVel *pInputData)
     
    SbgErrorCode sbgEComBinaryLogParseGpsPosData (SbgStreamBuffer *pInputStream, SbgLogGpsPos *pOutputData)
     
    SbgErrorCode sbgEComBinaryLogWriteGpsPosData (SbgStreamBuffer *pOutputStream, const SbgLogGpsPos *pInputData)
     
    SbgErrorCode sbgEComBinaryLogParseGpsHdtData (SbgStreamBuffer *pInputStream, SbgLogGpsHdt *pOutputData)
     
    SbgErrorCode sbgEComBinaryLogWriteGpsHdtData (SbgStreamBuffer *pOutputStream, const SbgLogGpsHdt *pInputData)
     
    SbgErrorCode sbgEComBinaryLogParseGpsRawData (SbgStreamBuffer *pInputStream, SbgLogRawData *pOutputData)
     
    SbgErrorCode sbgEComBinaryLogWriteGpsRawData (SbgStreamBuffer *pOutputStream, const SbgLogRawData *pInputData)
     
    +

    Detailed Description

    +

    Parse received GNSS logs such as Position, Velocity and True Heading.

    +
    Author
    SBG Systems
    +
    Date
    20 February 2013
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Macro Definition Documentation

    + +

    ◆ SBG_ECOM_GPS_VEL_STATUS_SHIFT

    + +
    +
    + + + + +
    #define SBG_ECOM_GPS_VEL_STATUS_SHIFT   (0u)
    +
    +

    Log GPS velocity status and type definitions. Shift used to extract the GPS velocity status part.

    + +
    +
    + +

    ◆ SBG_ECOM_GPS_VEL_STATUS_MASK

    + +
    +
    + + + + +
    #define SBG_ECOM_GPS_VEL_STATUS_MASK   (0x0000003Fu)
    +
    +

    Mask used to keep only the GPS velocity status part.

    + +
    +
    + +

    ◆ SBG_ECOM_GPS_VEL_TYPE_SHIFT

    + +
    +
    + + + + +
    #define SBG_ECOM_GPS_VEL_TYPE_SHIFT   (6u)
    +
    +

    Shift used to extract the GPS velocity type part.

    + +
    +
    + +

    ◆ SBG_ECOM_GPS_VEL_TYPE_MASK

    + +
    +
    + + + + +
    #define SBG_ECOM_GPS_VEL_TYPE_MASK   (0x0000003Fu)
    +
    +

    Mask used to keep only the GPS velocity type part.

    + +
    +
    + +

    ◆ SBG_ECOM_GPS_POS_STATUS_SHIFT

    + +
    +
    + + + + +
    #define SBG_ECOM_GPS_POS_STATUS_SHIFT   (0u)
    +
    +

    GPS position status and type definitions. Shift used to extract the GPS position status part.

    + +
    +
    + +

    ◆ SBG_ECOM_GPS_POS_STATUS_MASK

    + +
    +
    + + + + +
    #define SBG_ECOM_GPS_POS_STATUS_MASK   (0x0000003Fu)
    +
    +

    Mask used to keep only the GPS position status part.

    + +
    +
    + +

    ◆ SBG_ECOM_GPS_POS_TYPE_SHIFT

    + +
    +
    + + + + +
    #define SBG_ECOM_GPS_POS_TYPE_SHIFT   (6u)
    +
    +

    Shift used to extract the GPS position type part.

    + +
    +
    + +

    ◆ SBG_ECOM_GPS_POS_TYPE_MASK

    + +
    +
    + + + + +
    #define SBG_ECOM_GPS_POS_TYPE_MASK   (0x0000003Fu)
    +
    +

    Mask used to keep only the GPS position type part.

    + +
    +
    + +

    ◆ SBG_ECOM_GPS_POS_GPS_L1_USED

    + +
    +
    + + + + +
    #define SBG_ECOM_GPS_POS_GPS_L1_USED   (0x00000001u << 12)
    +
    +

    GNSS signals definitions Set to 1 if GPS L1CA/L1P is used in solution.

    + +
    +
    + +

    ◆ SBG_ECOM_GPS_POS_GPS_L2_USED

    + +
    +
    + + + + +
    #define SBG_ECOM_GPS_POS_GPS_L2_USED   (0x00000001u << 13)
    +
    +

    Set to 1 if GPS L2P/L2C is used in solution.

    + +
    +
    + +

    ◆ SBG_ECOM_GPS_POS_GPS_L5_USED

    + +
    +
    + + + + +
    #define SBG_ECOM_GPS_POS_GPS_L5_USED   (0x00000001u << 14)
    +
    +

    Set to 1 if GPS L5 is used in solution.

    + +
    +
    + +

    ◆ SBG_ECOM_GPS_POS_GLO_L1_USED

    + +
    +
    + + + + +
    #define SBG_ECOM_GPS_POS_GLO_L1_USED   (0x00000001u << 15)
    +
    +

    Set to 1 if GLONASS L1CA is used in solution.

    + +
    +
    + +

    ◆ SBG_ECOM_GPS_POS_GLO_L2_USED

    + +
    +
    + + + + +
    #define SBG_ECOM_GPS_POS_GLO_L2_USED   (0x00000001u << 16)
    +
    +

    Set to 1 if GLONASS L2C/L2P is used in solution.

    + +
    +
    + +

    ◆ SBG_ECOM_GPS_POS_GLO_L3_USED

    + +
    +
    + + + + +
    #define SBG_ECOM_GPS_POS_GLO_L3_USED   (0x00000001u << 17)
    +
    +

    Set to 1 if GLONASS L3 is used in solution.

    + +
    +
    + +

    ◆ SBG_ECOM_GPS_POS_GAL_E1_USED

    + +
    +
    + + + + +
    #define SBG_ECOM_GPS_POS_GAL_E1_USED   (0x00000001u << 18)
    +
    +

    Set to 1 if Galileo E1 is used in solution.

    + +
    +
    + +

    ◆ SBG_ECOM_GPS_POS_GAL_E5A_USED

    + +
    +
    + + + + +
    #define SBG_ECOM_GPS_POS_GAL_E5A_USED   (0x00000001u << 19)
    +
    +

    Set to 1 if Galileo E5a is used in solution.

    + +
    +
    + +

    ◆ SBG_ECOM_GPS_POS_GAL_E5B_USED

    + +
    +
    + + + + +
    #define SBG_ECOM_GPS_POS_GAL_E5B_USED   (0x00000001u << 20)
    +
    +

    Set to 1 if Galileo E5b is used in solution.

    + +
    +
    + +

    ◆ SBG_ECOM_GPS_POS_GAL_E5ALT_USED

    + +
    +
    + + + + +
    #define SBG_ECOM_GPS_POS_GAL_E5ALT_USED   (0x00000001u << 21)
    +
    +

    Set to 1 if Galileo E5 AltBoc is used in solution.

    + +
    +
    + +

    ◆ SBG_ECOM_GPS_POS_GAL_E6_USED

    + +
    +
    + + + + +
    #define SBG_ECOM_GPS_POS_GAL_E6_USED   (0x00000001u << 22)
    +
    +

    Set to 1 if Galileo E6 is used in solution.

    + +
    +
    + +

    ◆ SBG_ECOM_GPS_POS_BDS_B1_USED

    + +
    +
    + + + + +
    #define SBG_ECOM_GPS_POS_BDS_B1_USED   (0x00000001u << 23)
    +
    +

    Set to 1 if BeiDou B1 is used in solution.

    + +
    +
    + +

    ◆ SBG_ECOM_GPS_POS_BDS_B2_USED

    + +
    +
    + + + + +
    #define SBG_ECOM_GPS_POS_BDS_B2_USED   (0x00000001u << 24)
    +
    +

    Set to 1 if BeiDou B2 is used in solution.

    + +
    +
    + +

    ◆ SBG_ECOM_GPS_POS_BDS_B3_USED

    + +
    +
    + + + + +
    #define SBG_ECOM_GPS_POS_BDS_B3_USED   (0x00000001u << 25)
    +
    +

    Set to 1 if BeiDou B3 is used in solution.

    + +
    +
    + +

    ◆ SBG_ECOM_GPS_POS_QZSS_L1_USED

    + +
    +
    + + + + +
    #define SBG_ECOM_GPS_POS_QZSS_L1_USED   (0x00000001u << 26)
    +
    +

    Set to 1 if QZSS L1CA is used in solution.

    + +
    +
    + +

    ◆ SBG_ECOM_GPS_POS_QZSS_L2_USED

    + +
    +
    + + + + +
    #define SBG_ECOM_GPS_POS_QZSS_L2_USED   (0x00000001u << 27)
    +
    +

    Set to 1 if QZSS L2C is used in solution.

    + +
    +
    + +

    ◆ SBG_ECOM_GPS_POS_QZSS_L5_USED

    + +
    +
    + + + + +
    #define SBG_ECOM_GPS_POS_QZSS_L5_USED   (0x00000001u << 28)
    +
    +

    Set to 1 if QZSS L5 is used in solution.

    + +
    +
    + +

    ◆ SBG_ECOM_GPS_HDT_STATUS_SHIFT

    + +
    +
    + + + + +
    #define SBG_ECOM_GPS_HDT_STATUS_SHIFT   (0u)
    +
    +

    GPS HDT status definitions. Shift used to extract the GPS HDT status part.

    + +
    +
    + +

    ◆ SBG_ECOM_GPS_HDT_STATUS_MASK

    + +
    +
    + + + + +
    #define SBG_ECOM_GPS_HDT_STATUS_MASK   (0x0000003Fu)
    +
    +

    Mask used to keep only the GPS HDT status part.

    + +
    +
    + +

    ◆ SBG_ECOM_GPS_HDT_BASELINE_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_GPS_HDT_BASELINE_VALID   (0x0001 << 6)
    +
    +

    GPS HDT status bitmasks Set to 1 if the baseline length field is filled and valid.

    + +
    +
    +

    Typedef Documentation

    + +

    ◆ SbgEComGpsVelStatus

    + +
    +
    + + + + +
    typedef enum _SbgEComGpsVelStatus SbgEComGpsVelStatus
    +
    +

    GPS velocity status definitions.

    + +
    +
    + +

    ◆ SbgEComGpsVelType

    + +
    +
    + + + + +
    typedef enum _SbgEComGpsVelType SbgEComGpsVelType
    +
    +

    GPS velocity types definitions.

    + +
    +
    + +

    ◆ SbgEComGpsPosStatus

    + +
    +
    + + + + +
    typedef enum _SbgEComGpsPosStatus SbgEComGpsPosStatus
    +
    +

    GPS position status definitions.

    + +
    +
    + +

    ◆ SbgEComGpsPosType

    + +
    +
    + + + + +
    typedef enum _SbgEComGpsPosType SbgEComGpsPosType
    +
    +

    GPS position types definitions.

    + +
    +
    + +

    ◆ SbgEComGpsHdtStatus

    + +
    +
    + + + + +
    typedef enum _SbgEComGpsHdtStatus SbgEComGpsHdtStatus
    +
    +

    GPS HDT status definitions.

    + +
    +
    + +

    ◆ SbgLogGpsVel

    + +
    +
    + + + + +
    typedef struct _SbgLogGpsVel SbgLogGpsVel
    +
    +

    Structure that stores data for the SBG_ECOM_LOG_GPS::_VEL message.

    + +
    +
    + +

    ◆ SbgLogGpsPos

    + +
    +
    + + + + +
    typedef struct _SbgLogGpsPos SbgLogGpsPos
    +
    +

    Structure that stores data for the SBG_ECOM_LOG_GPS::_POS message.

    + +
    +
    + +

    ◆ SbgLogGpsHdt

    + +
    +
    + + + + +
    typedef struct _SbgLogGpsHdt SbgLogGpsHdt
    +
    +

    Structure that stores data for the SBG_ECOM_LOG_GPS::_HDT message.

    + +
    +
    +

    Enumeration Type Documentation

    + +

    ◆ _SbgEComGpsVelStatus

    + +
    +
    + + + + +
    enum _SbgEComGpsVelStatus
    +
    +

    GPS velocity status definitions.

    + + + + + +
    Enumerator
    SBG_ECOM_VEL_SOL_COMPUTED 

    A valid solution has been computed.

    +
    SBG_ECOM_VEL_INSUFFICIENT_OBS 

    Not enough valid SV to compute a solution.

    +
    SBG_ECOM_VEL_INTERNAL_ERROR 

    An internal error has occurred.

    +
    SBG_ECOM_VEL_LIMIT 

    Velocity limit exceeded.

    +
    + +
    +
    + +

    ◆ _SbgEComGpsVelType

    + +
    +
    + + + + +
    enum _SbgEComGpsVelType
    +
    +

    GPS velocity types definitions.

    + + + + + +
    Enumerator
    SBG_ECOM_VEL_NO_SOLUTION 

    No valid velocity solution available.

    +
    SBG_ECOM_VEL_UNKNOWN_TYPE 

    An unknown solution type has been computed.

    +
    SBG_ECOM_VEL_DOPPLER 

    A Doppler velocity has been computed.

    +
    SBG_ECOM_VEL_DIFFERENTIAL 

    A differential velocity has been computed between two positions.

    +
    + +
    +
    + +

    ◆ _SbgEComGpsPosStatus

    + +
    +
    + + + + +
    enum _SbgEComGpsPosStatus
    +
    +

    GPS position status definitions.

    + + + + + +
    Enumerator
    SBG_ECOM_POS_SOL_COMPUTED 

    A valid solution has been computed.

    +
    SBG_ECOM_POS_INSUFFICIENT_OBS 

    Not enough valid SV to compute a solution.

    +
    SBG_ECOM_POS_INTERNAL_ERROR 

    An internal error has occurred.

    +
    SBG_ECOM_POS_HEIGHT_LIMIT 

    The height limit has been exceeded.

    +
    + +
    +
    + +

    ◆ _SbgEComGpsPosType

    + +
    +
    + + + + +
    enum _SbgEComGpsPosType
    +
    +

    GPS position types definitions.

    + + + + + + + + + + + + +
    Enumerator
    SBG_ECOM_POS_NO_SOLUTION 

    No valid solution available.

    +
    SBG_ECOM_POS_UNKNOWN_TYPE 

    An unknown solution type has been computed.

    +
    SBG_ECOM_POS_SINGLE 

    Single point solution position.

    +
    SBG_ECOM_POS_PSRDIFF 

    Standard Pseudorange Differential Solution (DGPS).

    +
    SBG_ECOM_POS_SBAS 

    SBAS satellite used for differential corrections.

    +
    SBG_ECOM_POS_OMNISTAR 

    Omnistar VBS Position (L1 sub-meter).

    +
    SBG_ECOM_POS_RTK_FLOAT 

    Floating RTK ambiguity solution (20 cms RTK).

    +
    SBG_ECOM_POS_RTK_INT 

    Integer RTK ambiguity solution (2 cms RTK).

    +
    SBG_ECOM_POS_PPP_FLOAT 

    Precise Point Positioning with float ambiguities.

    +
    SBG_ECOM_POS_PPP_INT 

    Precise Point Positioning with fixed ambiguities.

    +
    SBG_ECOM_POS_FIXED 

    Fixed location solution position.

    +
    + +
    +
    + +

    ◆ _SbgEComGpsHdtStatus

    + +
    +
    + + + + +
    enum _SbgEComGpsHdtStatus
    +
    +

    GPS HDT status definitions.

    + + + + + +
    Enumerator
    SBG_ECOM_HDT_SOL_COMPUTED 

    A valid solution has been computed.

    +
    SBG_ECOM_HDT_INSUFFICIENT_OBS 

    Not enough valid SV to compute a solution.

    +
    SBG_ECOM_HDT_INTERNAL_ERROR 

    An internal error has occurred.

    +
    SBG_ECOM_HDT_HEIGHT_LIMIT 

    The height limit has been exceeded.

    +
    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgEComLogGpsVelGetStatus()

    + +
    +
    + + + + + + + + +
    SBG_INLINE SbgEComGpsVelStatus sbgEComLogGpsVelGetStatus (uint32_t status)
    +
    +

    Method used to read GPS velocity status from a status field.

    +
    Parameters
    + + +
    [in]statusStatus uint32_t value to extract the velocity status from it.
    +
    +
    +
    Returns
    The extracted velocity status.
    + +

    References SBG_ECOM_GPS_VEL_STATUS_MASK, and SBG_ECOM_GPS_VEL_STATUS_SHIFT.

    + +
    +
    + +

    ◆ sbgEComLogGpsVelGetType()

    + +
    +
    + + + + + + + + +
    SBG_INLINE SbgEComGpsVelType sbgEComLogGpsVelGetType (uint32_t status)
    +
    +

    Method used to read GPS velocity type from a status field.

    +
    Parameters
    + + +
    [in]statusStatus uint32_t value to extract the velocity type from it.
    +
    +
    +
    Returns
    The extracted velocity type.
    + +

    References SBG_ECOM_GPS_VEL_TYPE_MASK, and SBG_ECOM_GPS_VEL_TYPE_SHIFT.

    + +
    +
    + +

    ◆ sbgEComLogGpsVelBuildStatus()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SBG_INLINE uint32_t sbgEComLogGpsVelBuildStatus (SbgEComGpsVelStatus status,
    SbgEComGpsVelType type 
    )
    +
    +

    Method used to write the GPS velocity status to a status field.

    +
    Parameters
    + + + +
    [in]statusThe velocity status to set.
    [in]typeThe velocity type to set.
    +
    +
    +
    Returns
    The build GpsVelData status field.
    + +

    References SBG_ECOM_GPS_VEL_STATUS_MASK, SBG_ECOM_GPS_VEL_STATUS_SHIFT, SBG_ECOM_GPS_VEL_TYPE_MASK, and SBG_ECOM_GPS_VEL_TYPE_SHIFT.

    + +
    +
    + +

    ◆ sbgEComLogGpsPosGetStatus()

    + +
    +
    + + + + + + + + +
    SBG_INLINE SbgEComGpsPosStatus sbgEComLogGpsPosGetStatus (uint32_t status)
    +
    +

    Method used to read GPS position status from a status field.

    +
    Parameters
    + + +
    [in]statusStatus uint32_t value to extract the position status from it.
    +
    +
    +
    Returns
    The extracted position status.
    + +

    References SBG_ECOM_GPS_POS_STATUS_MASK, and SBG_ECOM_GPS_POS_STATUS_SHIFT.

    + +
    +
    + +

    ◆ sbgEComLogGpsPosGetType()

    + +
    +
    + + + + + + + + +
    SBG_INLINE SbgEComGpsPosType sbgEComLogGpsPosGetType (uint32_t status)
    +
    +

    Method used to read GPS position type from a status field.

    +
    Parameters
    + + +
    [in]statusStatus uint32_t value to extract the position type from it.
    +
    +
    +
    Returns
    The extracted position type.
    + +

    References SBG_ECOM_GPS_POS_TYPE_MASK, and SBG_ECOM_GPS_POS_TYPE_SHIFT.

    + +
    +
    + +

    ◆ sbgEComLogGpsPosBuildStatus()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    SBG_INLINE uint32_t sbgEComLogGpsPosBuildStatus (SbgEComGpsPosStatus status,
    SbgEComGpsPosType type,
    uint32_t masks 
    )
    +
    +

    Method used to write the GPS position status to a status field.

    +
    Parameters
    + + + + +
    [in]statusThe position status to set.
    [in]typeThe position type to set.
    [in]masksBit mask to set.
    +
    +
    +
    Returns
    The build GpsPosData status field.
    + +

    References SBG_ECOM_GPS_POS_STATUS_MASK, SBG_ECOM_GPS_POS_STATUS_SHIFT, SBG_ECOM_GPS_POS_TYPE_MASK, and SBG_ECOM_GPS_POS_TYPE_SHIFT.

    + +
    +
    + +

    ◆ sbgEComLogGpsHdtGetStatus()

    + +
    +
    + + + + + + + + +
    SBG_INLINE SbgEComGpsHdtStatus sbgEComLogGpsHdtGetStatus (uint32_t status)
    +
    +

    Method used to read GPS HDT status from a status field.

    +
    Parameters
    + + +
    [in]statusStatus uint32_t value to extract the HDT status from it.
    +
    +
    +
    Returns
    The extracted position status.
    + +

    References SBG_ECOM_GPS_HDT_STATUS_MASK, and SBG_ECOM_GPS_HDT_STATUS_SHIFT.

    + +
    +
    + +

    ◆ sbgEComLogGpsHdtBuildStatus()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SBG_INLINE uint32_t sbgEComLogGpsHdtBuildStatus (SbgEComGpsHdtStatus status,
    uint32_t masks 
    )
    +
    +

    Method used to write the GPS HDT status to a status field.

    +
    Parameters
    + + + +
    [in]statusThe HDT status to set.
    [in]masksBit mask to set.
    +
    +
    +
    Returns
    The build GpsPosData status field.
    + +

    References SBG_ECOM_GPS_HDT_STATUS_MASK, and SBG_ECOM_GPS_HDT_STATUS_SHIFT.

    + +
    +
    + +

    ◆ sbgEComBinaryLogParseGpsVelData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogParseGpsVelData (SbgStreamBuffer * pInputStream,
    SbgLogGpsVelpOutputData 
    )
    +
    +

    Parse data for the SBG_ECOM_LOG_GPS::_VEL message and fill the corresponding structure.

    +
    Parameters
    + + + +
    [in]pInputStreamInput stream buffer to read the payload from.
    [out]pOutputDataPointer on the output structure that stores parsed data.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the payload has been parsed.
    + +
    +
    + +

    ◆ sbgEComBinaryLogWriteGpsVelData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogWriteGpsVelData (SbgStreamBuffer * pOutputStream,
    const SbgLogGpsVelpInputData 
    )
    +
    +

    Write data for the SBG_ECOM_LOG_GPS::_VEL message to the output stream buffer from the provided structure.

    +
    Parameters
    + + + +
    [out]pOutputStreamOutput stream buffer to write the payload to.
    [in]pInputDataPointer on the input structure that stores data to write.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the message has been generated in the provided buffer.
    + +
    +
    + +

    ◆ sbgEComBinaryLogParseGpsPosData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogParseGpsPosData (SbgStreamBuffer * pInputStream,
    SbgLogGpsPospOutputData 
    )
    +
    +

    Parse data for the SBG_ECOM_LOG_GPS::_POS message and fill the corresponding structure.

    +
    Parameters
    + + + +
    [in]pInputStreamInput stream buffer to read the payload from.
    [out]pOutputDataPointer on the output structure that stores parsed data.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the payload has been parsed.
    + +
    +
    + +

    ◆ sbgEComBinaryLogWriteGpsPosData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogWriteGpsPosData (SbgStreamBuffer * pOutputStream,
    const SbgLogGpsPospInputData 
    )
    +
    +

    Write data for the SBG_ECOM_LOG_GPS::_POS message to the output stream buffer from the provided structure.

    +
    Parameters
    + + + +
    [out]pOutputStreamOutput stream buffer to write the payload to.
    [in]pInputDataPointer on the input structure that stores data to write.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the message has been generated in the provided buffer.
    + +
    +
    + +

    ◆ sbgEComBinaryLogParseGpsHdtData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogParseGpsHdtData (SbgStreamBuffer * pInputStream,
    SbgLogGpsHdtpOutputData 
    )
    +
    +

    Parse data for the SBG_ECOM_LOG_GPS::_HDT message and fill the corresponding structure.

    +
    Parameters
    + + + +
    [in]pInputStreamInput stream buffer to read the payload from.
    [out]pOutputDataPointer on the output structure that stores parsed data.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the payload has been parsed.
    + +
    +
    + +

    ◆ sbgEComBinaryLogWriteGpsHdtData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogWriteGpsHdtData (SbgStreamBuffer * pOutputStream,
    const SbgLogGpsHdtpInputData 
    )
    +
    +

    Write data for the SBG_ECOM_LOG_GPS::_HDT message to the output stream buffer from the provided structure.

    +
    Parameters
    + + + +
    [out]pOutputStreamOutput stream buffer to write the payload to.
    [in]pInputDataPointer on the input structure that stores data to write.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the message has been generated in the provided buffer.
    + +
    +
    + +

    ◆ sbgEComBinaryLogParseGpsRawData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogParseGpsRawData (SbgStreamBuffer * pInputStream,
    SbgLogRawDatapOutputData 
    )
    +
    +

    Parse data for the SBG_ECOM_LOG_GPS::_RAW message and fill the corresponding structure.

    +
    Parameters
    + + + +
    [in]pInputStreamInput stream buffer to read the payload from.
    [out]pOutputDataPointer on the output structure that stores parsed data.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the payload has been parsed.
    + +
    +
    + +

    ◆ sbgEComBinaryLogWriteGpsRawData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogWriteGpsRawData (SbgStreamBuffer * pOutputStream,
    const SbgLogRawDatapInputData 
    )
    +
    +

    Write data for the SBG_ECOM_LOG_GPS::_RAW message to the output stream buffer from the provided structure.

    +
    Parameters
    + + + +
    [out]pOutputStreamOutput stream buffer to write the payload to.
    [in]pInputDataPointer on the input structure that stores data to write.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the message has been generated in the provided buffer.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_log_gps_8h_source.html b/doc/html/sbg_e_com_binary_log_gps_8h_source.html new file mode 100644 index 0000000..3447b28 --- /dev/null +++ b/doc/html/sbg_e_com_binary_log_gps_8h_source.html @@ -0,0 +1,400 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogGps.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComBinaryLogGps.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_BINARY_LOG_GPS_H
    +
    33#define SBG_ECOM_BINARY_LOG_GPS_H
    +
    34
    +
    35// sbgCommonLib headers
    +
    36#include <sbgCommon.h>
    +
    37#include <streamBuffer/sbgStreamBuffer.h>
    +
    38
    +
    39// Local headers
    + +
    41
    +
    42#ifdef __cplusplus
    +
    43extern "C" {
    +
    44#endif
    +
    45
    +
    46//----------------------------------------------------------------------//
    +
    47//- Log GPS velocity const definitions -//
    +
    48//----------------------------------------------------------------------//
    +
    49
    +
    53#define SBG_ECOM_GPS_VEL_STATUS_SHIFT (0u)
    +
    54#define SBG_ECOM_GPS_VEL_STATUS_MASK (0x0000003Fu)
    +
    55#define SBG_ECOM_GPS_VEL_TYPE_SHIFT (6u)
    +
    56#define SBG_ECOM_GPS_VEL_TYPE_MASK (0x0000003Fu)
    +
    58//----------------------------------------------------------------------//
    +
    59//- Log GPS position const definitions -//
    +
    60//----------------------------------------------------------------------//
    +
    61
    +
    65#define SBG_ECOM_GPS_POS_STATUS_SHIFT (0u)
    +
    66#define SBG_ECOM_GPS_POS_STATUS_MASK (0x0000003Fu)
    +
    67#define SBG_ECOM_GPS_POS_TYPE_SHIFT (6u)
    +
    68#define SBG_ECOM_GPS_POS_TYPE_MASK (0x0000003Fu)
    +
    73#define SBG_ECOM_GPS_POS_GPS_L1_USED (0x00000001u << 12)
    +
    74#define SBG_ECOM_GPS_POS_GPS_L2_USED (0x00000001u << 13)
    +
    75#define SBG_ECOM_GPS_POS_GPS_L5_USED (0x00000001u << 14)
    +
    77#define SBG_ECOM_GPS_POS_GLO_L1_USED (0x00000001u << 15)
    +
    78#define SBG_ECOM_GPS_POS_GLO_L2_USED (0x00000001u << 16)
    +
    79#define SBG_ECOM_GPS_POS_GLO_L3_USED (0x00000001u << 17)
    +
    81#define SBG_ECOM_GPS_POS_GAL_E1_USED (0x00000001u << 18)
    +
    82#define SBG_ECOM_GPS_POS_GAL_E5A_USED (0x00000001u << 19)
    +
    83#define SBG_ECOM_GPS_POS_GAL_E5B_USED (0x00000001u << 20)
    +
    84#define SBG_ECOM_GPS_POS_GAL_E5ALT_USED (0x00000001u << 21)
    +
    85#define SBG_ECOM_GPS_POS_GAL_E6_USED (0x00000001u << 22)
    +
    87#define SBG_ECOM_GPS_POS_BDS_B1_USED (0x00000001u << 23)
    +
    88#define SBG_ECOM_GPS_POS_BDS_B2_USED (0x00000001u << 24)
    +
    89#define SBG_ECOM_GPS_POS_BDS_B3_USED (0x00000001u << 25)
    +
    91#define SBG_ECOM_GPS_POS_QZSS_L1_USED (0x00000001u << 26)
    +
    92#define SBG_ECOM_GPS_POS_QZSS_L2_USED (0x00000001u << 27)
    +
    93#define SBG_ECOM_GPS_POS_QZSS_L5_USED (0x00000001u << 28)
    +
    95//----------------------------------------------------------------------//
    +
    96//- Log GPS HDT const definitions -//
    +
    97//----------------------------------------------------------------------//
    +
    98
    +
    102#define SBG_ECOM_GPS_HDT_STATUS_SHIFT (0u)
    +
    103#define SBG_ECOM_GPS_HDT_STATUS_MASK (0x0000003Fu)
    +
    108#define SBG_ECOM_GPS_HDT_BASELINE_VALID (0x0001 << 6)
    +
    110//----------------------------------------------------------------------//
    +
    111//- Log GPS velocity enums definitions -//
    +
    112//----------------------------------------------------------------------//
    +
    113
    + +
    118{
    + + + + + +
    124
    + +
    129{
    + + + + + +
    135
    +
    136//----------------------------------------------------------------------//
    +
    137//- Log GPS position enums definitions -//
    +
    138//----------------------------------------------------------------------//
    +
    139
    + +
    144{
    + + + + + +
    150
    + +
    155{
    + + + + + + + + + + + + +
    168
    +
    169//----------------------------------------------------------------------//
    +
    170//- Log GPS HDT enums definitions -//
    +
    171//----------------------------------------------------------------------//
    +
    172
    + +
    177{
    + + + + + +
    183
    +
    184//----------------------------------------------------------------------//
    +
    185//- Helpers methods for velocity status access -//
    +
    186//----------------------------------------------------------------------//
    +
    187
    + +
    195{
    + +
    197}
    +
    198
    + +
    206{
    + +
    208}
    +
    209
    + +
    218{
    +
    219 //
    +
    220 // Create the combined status field
    +
    221 //
    +
    222 return ((((uint32_t)status)&SBG_ECOM_GPS_VEL_STATUS_MASK) << SBG_ECOM_GPS_VEL_STATUS_SHIFT) |
    + +
    224}
    +
    225
    +
    226//----------------------------------------------------------------------//
    +
    227//- Helpers methods for position status access -//
    +
    228//----------------------------------------------------------------------//
    +
    229
    + +
    237{
    + +
    239}
    +
    240
    + +
    248{
    + +
    250}
    +
    251
    +
    260SBG_INLINE uint32_t sbgEComLogGpsPosBuildStatus(SbgEComGpsPosStatus status, SbgEComGpsPosType type, uint32_t masks)
    +
    261{
    +
    262 //
    +
    263 // Create the combined status field
    +
    264 //
    +
    265 return ((((uint32_t)status)&SBG_ECOM_GPS_POS_STATUS_MASK) << SBG_ECOM_GPS_POS_STATUS_SHIFT) |
    +
    266 ((((uint32_t)type)&SBG_ECOM_GPS_POS_TYPE_MASK) << SBG_ECOM_GPS_POS_TYPE_SHIFT) | masks;
    +
    267}
    +
    268
    +
    269//----------------------------------------------------------------------//
    +
    270//- Helpers methods for HDT status access -//
    +
    271//----------------------------------------------------------------------//
    +
    272
    + +
    280{
    + +
    282}
    +
    283
    +
    291SBG_INLINE uint32_t sbgEComLogGpsHdtBuildStatus(SbgEComGpsHdtStatus status, uint32_t masks)
    +
    292{
    +
    293 //
    +
    294 // Create the combined status field
    +
    295 //
    +
    296 return ((((uint32_t)status)&SBG_ECOM_GPS_HDT_STATUS_MASK) << SBG_ECOM_GPS_HDT_STATUS_SHIFT) | masks;
    +
    297}
    +
    298
    +
    299//----------------------------------------------------------------------//
    +
    300//- Log structure definitions -//
    +
    301//----------------------------------------------------------------------//
    +
    302
    +
    306typedef struct _SbgLogGpsVel
    +
    307{
    +
    308 uint32_t timeStamp;
    +
    309 uint32_t status;
    +
    310 uint32_t timeOfWeek;
    +
    311 float velocity[3];
    +
    312 float velocityAcc[3];
    +
    313 float course;
    +
    314 float courseAcc;
    + +
    316
    +
    320typedef struct _SbgLogGpsPos
    +
    321{
    +
    322 uint32_t timeStamp;
    +
    323 uint32_t status;
    +
    324 uint32_t timeOfWeek;
    +
    325 double latitude;
    +
    326 double longitude;
    +
    327 double altitude;
    + + + + +
    332 uint8_t numSvUsed;
    +
    333 uint16_t baseStationId;
    + + +
    336
    +
    340typedef struct _SbgLogGpsHdt
    +
    341{
    +
    342 uint32_t timeStamp;
    +
    343 uint16_t status;
    +
    344 uint32_t timeOfWeek;
    +
    345 float heading;
    + +
    347 float pitch;
    + +
    349 float baseline;
    + +
    351
    +
    352//----------------------------------------------------------------------//
    +
    353//- Public methods -//
    +
    354//----------------------------------------------------------------------//
    +
    355
    +
    363SbgErrorCode sbgEComBinaryLogParseGpsVelData(SbgStreamBuffer *pInputStream, SbgLogGpsVel *pOutputData);
    +
    364
    +
    372SbgErrorCode sbgEComBinaryLogWriteGpsVelData(SbgStreamBuffer *pOutputStream, const SbgLogGpsVel *pInputData);
    +
    373
    +
    381SbgErrorCode sbgEComBinaryLogParseGpsPosData(SbgStreamBuffer *pInputStream, SbgLogGpsPos *pOutputData);
    +
    382
    +
    390SbgErrorCode sbgEComBinaryLogWriteGpsPosData(SbgStreamBuffer *pOutputStream, const SbgLogGpsPos *pInputData);
    +
    391
    +
    399SbgErrorCode sbgEComBinaryLogParseGpsHdtData(SbgStreamBuffer *pInputStream, SbgLogGpsHdt *pOutputData);
    +
    400
    +
    408SbgErrorCode sbgEComBinaryLogWriteGpsHdtData(SbgStreamBuffer *pOutputStream, const SbgLogGpsHdt *pInputData);
    +
    409
    +
    417SbgErrorCode sbgEComBinaryLogParseGpsRawData(SbgStreamBuffer *pInputStream, SbgLogRawData *pOutputData);
    +
    418
    +
    426SbgErrorCode sbgEComBinaryLogWriteGpsRawData(SbgStreamBuffer *pOutputStream, const SbgLogRawData *pInputData);
    +
    427
    +
    428#ifdef __cplusplus
    +
    429}
    +
    430#endif
    +
    431
    +
    432#endif // SBG_ECOM_BINARY_LOG_GPS_H
    +
    enum _SbgEComGpsVelType SbgEComGpsVelType
    +
    SBG_INLINE SbgEComGpsPosType sbgEComLogGpsPosGetType(uint32_t status)
    Definition: sbgEComBinaryLogGps.h:247
    +
    #define SBG_ECOM_GPS_POS_TYPE_SHIFT
    Definition: sbgEComBinaryLogGps.h:67
    +
    SbgErrorCode sbgEComBinaryLogParseGpsRawData(SbgStreamBuffer *pInputStream, SbgLogRawData *pOutputData)
    +
    #define SBG_ECOM_GPS_POS_STATUS_MASK
    Definition: sbgEComBinaryLogGps.h:66
    +
    enum _SbgEComGpsPosStatus SbgEComGpsPosStatus
    +
    SbgErrorCode sbgEComBinaryLogWriteGpsPosData(SbgStreamBuffer *pOutputStream, const SbgLogGpsPos *pInputData)
    +
    SBG_INLINE SbgEComGpsPosStatus sbgEComLogGpsPosGetStatus(uint32_t status)
    Definition: sbgEComBinaryLogGps.h:236
    +
    struct _SbgLogGpsVel SbgLogGpsVel
    +
    enum _SbgEComGpsVelStatus SbgEComGpsVelStatus
    +
    enum _SbgEComGpsHdtStatus SbgEComGpsHdtStatus
    +
    #define SBG_ECOM_GPS_POS_STATUS_SHIFT
    Definition: sbgEComBinaryLogGps.h:65
    +
    SbgErrorCode sbgEComBinaryLogWriteGpsHdtData(SbgStreamBuffer *pOutputStream, const SbgLogGpsHdt *pInputData)
    +
    #define SBG_ECOM_GPS_POS_TYPE_MASK
    Definition: sbgEComBinaryLogGps.h:68
    +
    SBG_INLINE SbgEComGpsHdtStatus sbgEComLogGpsHdtGetStatus(uint32_t status)
    Definition: sbgEComBinaryLogGps.h:279
    +
    _SbgEComGpsHdtStatus
    Definition: sbgEComBinaryLogGps.h:177
    +
    @ SBG_ECOM_HDT_HEIGHT_LIMIT
    Definition: sbgEComBinaryLogGps.h:181
    +
    @ SBG_ECOM_HDT_INTERNAL_ERROR
    Definition: sbgEComBinaryLogGps.h:180
    +
    @ SBG_ECOM_HDT_INSUFFICIENT_OBS
    Definition: sbgEComBinaryLogGps.h:179
    +
    @ SBG_ECOM_HDT_SOL_COMPUTED
    Definition: sbgEComBinaryLogGps.h:178
    +
    enum _SbgEComGpsPosType SbgEComGpsPosType
    +
    SBG_INLINE SbgEComGpsVelType sbgEComLogGpsVelGetType(uint32_t status)
    Definition: sbgEComBinaryLogGps.h:205
    +
    struct _SbgLogGpsPos SbgLogGpsPos
    +
    SbgErrorCode sbgEComBinaryLogWriteGpsRawData(SbgStreamBuffer *pOutputStream, const SbgLogRawData *pInputData)
    +
    SbgErrorCode sbgEComBinaryLogParseGpsHdtData(SbgStreamBuffer *pInputStream, SbgLogGpsHdt *pOutputData)
    +
    _SbgEComGpsVelType
    Definition: sbgEComBinaryLogGps.h:129
    +
    @ SBG_ECOM_VEL_DOPPLER
    Definition: sbgEComBinaryLogGps.h:132
    +
    @ SBG_ECOM_VEL_NO_SOLUTION
    Definition: sbgEComBinaryLogGps.h:130
    +
    @ SBG_ECOM_VEL_DIFFERENTIAL
    Definition: sbgEComBinaryLogGps.h:133
    +
    @ SBG_ECOM_VEL_UNKNOWN_TYPE
    Definition: sbgEComBinaryLogGps.h:131
    +
    SBG_INLINE uint32_t sbgEComLogGpsPosBuildStatus(SbgEComGpsPosStatus status, SbgEComGpsPosType type, uint32_t masks)
    Definition: sbgEComBinaryLogGps.h:260
    +
    _SbgEComGpsPosType
    Definition: sbgEComBinaryLogGps.h:155
    +
    @ SBG_ECOM_POS_UNKNOWN_TYPE
    Definition: sbgEComBinaryLogGps.h:157
    +
    @ SBG_ECOM_POS_PSRDIFF
    Definition: sbgEComBinaryLogGps.h:159
    +
    @ SBG_ECOM_POS_FIXED
    Definition: sbgEComBinaryLogGps.h:166
    +
    @ SBG_ECOM_POS_NO_SOLUTION
    Definition: sbgEComBinaryLogGps.h:156
    +
    @ SBG_ECOM_POS_SINGLE
    Definition: sbgEComBinaryLogGps.h:158
    +
    @ SBG_ECOM_POS_PPP_FLOAT
    Definition: sbgEComBinaryLogGps.h:164
    +
    @ SBG_ECOM_POS_RTK_FLOAT
    Definition: sbgEComBinaryLogGps.h:162
    +
    @ SBG_ECOM_POS_RTK_INT
    Definition: sbgEComBinaryLogGps.h:163
    +
    @ SBG_ECOM_POS_PPP_INT
    Definition: sbgEComBinaryLogGps.h:165
    +
    @ SBG_ECOM_POS_SBAS
    Definition: sbgEComBinaryLogGps.h:160
    +
    @ SBG_ECOM_POS_OMNISTAR
    Definition: sbgEComBinaryLogGps.h:161
    +
    _SbgEComGpsVelStatus
    Definition: sbgEComBinaryLogGps.h:118
    +
    @ SBG_ECOM_VEL_LIMIT
    Definition: sbgEComBinaryLogGps.h:122
    +
    @ SBG_ECOM_VEL_SOL_COMPUTED
    Definition: sbgEComBinaryLogGps.h:119
    +
    @ SBG_ECOM_VEL_INTERNAL_ERROR
    Definition: sbgEComBinaryLogGps.h:121
    +
    @ SBG_ECOM_VEL_INSUFFICIENT_OBS
    Definition: sbgEComBinaryLogGps.h:120
    +
    #define SBG_ECOM_GPS_HDT_STATUS_MASK
    Definition: sbgEComBinaryLogGps.h:103
    +
    #define SBG_ECOM_GPS_HDT_STATUS_SHIFT
    Definition: sbgEComBinaryLogGps.h:102
    +
    #define SBG_ECOM_GPS_VEL_STATUS_SHIFT
    Definition: sbgEComBinaryLogGps.h:53
    +
    SBG_INLINE uint32_t sbgEComLogGpsVelBuildStatus(SbgEComGpsVelStatus status, SbgEComGpsVelType type)
    Definition: sbgEComBinaryLogGps.h:217
    +
    struct _SbgLogGpsHdt SbgLogGpsHdt
    +
    #define SBG_ECOM_GPS_VEL_TYPE_MASK
    Definition: sbgEComBinaryLogGps.h:56
    +
    _SbgEComGpsPosStatus
    Definition: sbgEComBinaryLogGps.h:144
    +
    @ SBG_ECOM_POS_INTERNAL_ERROR
    Definition: sbgEComBinaryLogGps.h:147
    +
    @ SBG_ECOM_POS_HEIGHT_LIMIT
    Definition: sbgEComBinaryLogGps.h:148
    +
    @ SBG_ECOM_POS_INSUFFICIENT_OBS
    Definition: sbgEComBinaryLogGps.h:146
    +
    @ SBG_ECOM_POS_SOL_COMPUTED
    Definition: sbgEComBinaryLogGps.h:145
    +
    SbgErrorCode sbgEComBinaryLogParseGpsPosData(SbgStreamBuffer *pInputStream, SbgLogGpsPos *pOutputData)
    +
    SBG_INLINE uint32_t sbgEComLogGpsHdtBuildStatus(SbgEComGpsHdtStatus status, uint32_t masks)
    Definition: sbgEComBinaryLogGps.h:291
    +
    SbgErrorCode sbgEComBinaryLogWriteGpsVelData(SbgStreamBuffer *pOutputStream, const SbgLogGpsVel *pInputData)
    +
    #define SBG_ECOM_GPS_VEL_STATUS_MASK
    Definition: sbgEComBinaryLogGps.h:54
    +
    SBG_INLINE SbgEComGpsVelStatus sbgEComLogGpsVelGetStatus(uint32_t status)
    Definition: sbgEComBinaryLogGps.h:194
    +
    #define SBG_ECOM_GPS_VEL_TYPE_SHIFT
    Definition: sbgEComBinaryLogGps.h:55
    +
    SbgErrorCode sbgEComBinaryLogParseGpsVelData(SbgStreamBuffer *pInputStream, SbgLogGpsVel *pOutputData)
    +
    Parse logs used to store a binary stream such as RAW GNSS data.
    +
    Definition: sbgEComBinaryLogGps.h:341
    +
    float pitchAccuracy
    Definition: sbgEComBinaryLogGps.h:348
    +
    float pitch
    Definition: sbgEComBinaryLogGps.h:347
    +
    float headingAccuracy
    Definition: sbgEComBinaryLogGps.h:346
    +
    uint32_t timeOfWeek
    Definition: sbgEComBinaryLogGps.h:344
    +
    uint32_t timeStamp
    Definition: sbgEComBinaryLogGps.h:342
    +
    uint16_t status
    Definition: sbgEComBinaryLogGps.h:343
    +
    float heading
    Definition: sbgEComBinaryLogGps.h:345
    +
    float baseline
    Definition: sbgEComBinaryLogGps.h:349
    +
    Definition: sbgEComBinaryLogGps.h:321
    +
    uint16_t differentialAge
    Definition: sbgEComBinaryLogGps.h:334
    +
    uint32_t status
    Definition: sbgEComBinaryLogGps.h:323
    +
    uint32_t timeOfWeek
    Definition: sbgEComBinaryLogGps.h:324
    +
    uint32_t timeStamp
    Definition: sbgEComBinaryLogGps.h:322
    +
    double latitude
    Definition: sbgEComBinaryLogGps.h:325
    +
    uint8_t numSvUsed
    Definition: sbgEComBinaryLogGps.h:332
    +
    float latitudeAccuracy
    Definition: sbgEComBinaryLogGps.h:329
    +
    uint16_t baseStationId
    Definition: sbgEComBinaryLogGps.h:333
    +
    float altitudeAccuracy
    Definition: sbgEComBinaryLogGps.h:331
    +
    double longitude
    Definition: sbgEComBinaryLogGps.h:326
    +
    float undulation
    Definition: sbgEComBinaryLogGps.h:328
    +
    double altitude
    Definition: sbgEComBinaryLogGps.h:327
    +
    float longitudeAccuracy
    Definition: sbgEComBinaryLogGps.h:330
    +
    Definition: sbgEComBinaryLogGps.h:307
    +
    uint32_t timeStamp
    Definition: sbgEComBinaryLogGps.h:308
    +
    uint32_t status
    Definition: sbgEComBinaryLogGps.h:309
    +
    float velocity[3]
    Definition: sbgEComBinaryLogGps.h:311
    +
    float courseAcc
    Definition: sbgEComBinaryLogGps.h:314
    +
    float velocityAcc[3]
    Definition: sbgEComBinaryLogGps.h:312
    +
    uint32_t timeOfWeek
    Definition: sbgEComBinaryLogGps.h:310
    +
    float course
    Definition: sbgEComBinaryLogGps.h:313
    +
    Definition: sbgEComBinaryLogRawData.h:57
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_log_imu_8h.html b/doc/html/sbg_e_com_binary_log_imu_8h.html new file mode 100644 index 0000000..209745c --- /dev/null +++ b/doc/html/sbg_e_com_binary_log_imu_8h.html @@ -0,0 +1,661 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogImu.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComBinaryLogImu.h File Reference
    +
    +
    + +

    Parse IMU (Inertial Measurement Unit) measurement logs. +More...

    +
    #include <sbgCommon.h>
    +#include <streamBuffer/sbgStreamBuffer.h>
    +
    +

    Go to the source code of this file.

    + + + + + + + + +

    +Data Structures

    struct  _SbgLogImuData
     
    struct  _SbgLogImuShort
     
    struct  _SbgLogFastImuData
     
    + + + + + + + + + + + + + + + + + + + + + +

    +Macros

    #define SBG_ECOM_IMU_COM_OK   (0x00000001u << 0)
     
    #define SBG_ECOM_IMU_STATUS_BIT   (0x00000001u << 1)
     
    #define SBG_ECOM_IMU_ACCEL_X_BIT   (0x00000001u << 2)
     
    #define SBG_ECOM_IMU_ACCEL_Y_BIT   (0x00000001u << 3)
     
    #define SBG_ECOM_IMU_ACCEL_Z_BIT   (0x00000001u << 4)
     
    #define SBG_ECOM_IMU_GYRO_X_BIT   (0x00000001u << 5)
     
    #define SBG_ECOM_IMU_GYRO_Y_BIT   (0x00000001u << 6)
     
    #define SBG_ECOM_IMU_GYRO_Z_BIT   (0x00000001u << 7)
     
    #define SBG_ECOM_IMU_ACCELS_IN_RANGE   (0x00000001u << 8)
     
    #define SBG_ECOM_IMU_GYROS_IN_RANGE   (0x00000001u << 9)
     
    + + + + + + + +

    +Typedefs

    typedef struct _SbgLogImuData SbgLogImuData
     
    typedef struct _SbgLogImuShort SbgLogImuShort
     
    typedef struct _SbgLogFastImuData SbgLogFastImuData
     
    + + + + + + + + + + + + + + + + + + + +

    +Functions

    float sbgLogImuShortGetDeltaAngle (const SbgLogImuShort *pImuShort, size_t idx)
     
    float sbgLogImuShortGetDeltaVelocity (const SbgLogImuShort *pImuShort, size_t idx)
     
    float sbgLogImuShortGetTemperature (const SbgLogImuShort *pImuShort)
     
    SbgErrorCode sbgEComBinaryLogParseImuData (SbgStreamBuffer *pInputStream, SbgLogImuData *pOutputData)
     
    SbgErrorCode sbgEComBinaryLogWriteImuData (SbgStreamBuffer *pOutputStream, const SbgLogImuData *pInputData)
     
    SbgErrorCode sbgEComBinaryLogParseImuShort (SbgStreamBuffer *pInputStream, SbgLogImuShort *pOutputData)
     
    SbgErrorCode sbgEComBinaryLogWriteImuShort (SbgStreamBuffer *pOutputStream, const SbgLogImuShort *pInputData)
     
    SbgErrorCode sbgEComBinaryLogParseFastImuData (SbgStreamBuffer *pInputStream, SbgLogFastImuData *pOutputData)
     
    SbgErrorCode sbgEComBinaryLogWriteFastImuData (SbgStreamBuffer *pOutputStream, const SbgLogFastImuData *pInputData)
     
    +

    Detailed Description

    +

    Parse IMU (Inertial Measurement Unit) measurement logs.

    +
    Author
    SBG Systems
    +
    Date
    25 February 2013
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Macro Definition Documentation

    + +

    ◆ SBG_ECOM_IMU_COM_OK

    + +
    +
    + + + + +
    #define SBG_ECOM_IMU_COM_OK   (0x00000001u << 0)
    +
    +

    Log inertial data status mask definitions Set to 1 if the communication with the IMU is ok.

    + +
    +
    + +

    ◆ SBG_ECOM_IMU_STATUS_BIT

    + +
    +
    + + + + +
    #define SBG_ECOM_IMU_STATUS_BIT   (0x00000001u << 1)
    +
    +

    Set to 1 if the IMU passes general Built in Tests (calibration, CPU, ...).

    + +
    +
    + +

    ◆ SBG_ECOM_IMU_ACCEL_X_BIT

    + +
    +
    + + + + +
    #define SBG_ECOM_IMU_ACCEL_X_BIT   (0x00000001u << 2)
    +
    +

    Set to 1 if the accelerometer X passes Built In Test.

    + +
    +
    + +

    ◆ SBG_ECOM_IMU_ACCEL_Y_BIT

    + +
    +
    + + + + +
    #define SBG_ECOM_IMU_ACCEL_Y_BIT   (0x00000001u << 3)
    +
    +

    Set to 1 if the accelerometer Y passes Built In Test.

    + +
    +
    + +

    ◆ SBG_ECOM_IMU_ACCEL_Z_BIT

    + +
    +
    + + + + +
    #define SBG_ECOM_IMU_ACCEL_Z_BIT   (0x00000001u << 4)
    +
    +

    Set to 1 if the accelerometer Z passes Built In Test.

    + +
    +
    + +

    ◆ SBG_ECOM_IMU_GYRO_X_BIT

    + +
    +
    + + + + +
    #define SBG_ECOM_IMU_GYRO_X_BIT   (0x00000001u << 5)
    +
    +

    Set to 1 if the gyroscope X passes Built In Test.

    + +
    +
    + +

    ◆ SBG_ECOM_IMU_GYRO_Y_BIT

    + +
    +
    + + + + +
    #define SBG_ECOM_IMU_GYRO_Y_BIT   (0x00000001u << 6)
    +
    +

    Set to 1 if the gyroscope Y passes Built In Test.

    + +
    +
    + +

    ◆ SBG_ECOM_IMU_GYRO_Z_BIT

    + +
    +
    + + + + +
    #define SBG_ECOM_IMU_GYRO_Z_BIT   (0x00000001u << 7)
    +
    +

    Set to 1 if the gyroscope Z passes Built In Test.

    + +
    +
    + +

    ◆ SBG_ECOM_IMU_ACCELS_IN_RANGE

    + +
    +
    + + + + +
    #define SBG_ECOM_IMU_ACCELS_IN_RANGE   (0x00000001u << 8)
    +
    +

    Set to 1 if all accelerometers are within operating range.

    + +
    +
    + +

    ◆ SBG_ECOM_IMU_GYROS_IN_RANGE

    + +
    +
    + + + + +
    #define SBG_ECOM_IMU_GYROS_IN_RANGE   (0x00000001u << 9)
    +
    +

    Set to 1 if all gyroscopes are within operating range.

    + +
    +
    +

    Typedef Documentation

    + +

    ◆ SbgLogImuData

    + +
    +
    + + + + +
    typedef struct _SbgLogImuData SbgLogImuData
    +
    +

    Structure that stores data for the SBG_ECOM_LOG_IMU_DATA message.

    + +
    +
    + +

    ◆ SbgLogImuShort

    + +
    +
    + + + + +
    typedef struct _SbgLogImuShort SbgLogImuShort
    +
    +

    Structure that stores data for the SBG_ECOM_LOG_IMU_SHORT message. This message is only sent asynchronously and is the preferred log for post processing.

    + +
    +
    + +

    ◆ SbgLogFastImuData

    + +
    +
    + + + + +
    typedef struct _SbgLogFastImuData SbgLogFastImuData
    +
    +

    Structure that stores the data for SBG_ECOM_LOG_FAST_IMU_DATA message

    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgLogImuShortGetDeltaAngle()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    float sbgLogImuShortGetDeltaAngle (const SbgLogImuShortpImuShort,
    size_t idx 
    )
    +
    +

    Return from an IMU Short log, the X, Y or Z delta angle value in rad.s^-1

    +
    Parameters
    + + + +
    [in]pImuShortInput IMU short message instance.
    [in]idxThe component to return from 0 to 2.
    +
    +
    +
    Returns
    The delta angle value converted in rad.s^-1.
    + +
    +
    + +

    ◆ sbgLogImuShortGetDeltaVelocity()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    float sbgLogImuShortGetDeltaVelocity (const SbgLogImuShortpImuShort,
    size_t idx 
    )
    +
    +

    Return from an IMU Short log, the X, Y or Z delta velocity value in m.s^-2

    +
    Parameters
    + + + +
    [in]pImuShortInput IMU short message instance.
    [in]idxThe component to return from 0 to 2.
    +
    +
    +
    Returns
    The delta velocity value converted in m.s^-2.
    + +
    +
    + +

    ◆ sbgLogImuShortGetTemperature()

    + +
    +
    + + + + + + + + +
    float sbgLogImuShortGetTemperature (const SbgLogImuShortpImuShort)
    +
    +

    Return from an IMU Short log, the temperature in °C

    +
    Parameters
    + + +
    [in]pImuShortInput IMU short message instance.
    +
    +
    +
    Returns
    The converted temperature in °C
    + +
    +
    + +

    ◆ sbgEComBinaryLogParseImuData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogParseImuData (SbgStreamBuffer * pInputStream,
    SbgLogImuDatapOutputData 
    )
    +
    +

    Parse data for the SBG_ECOM_LOG_IMU_DATA message and fill the corresponding structure.

    +
    Parameters
    + + + +
    [in]pInputStreamInput stream buffer to read the payload from.
    [out]pOutputDataPointer on the output structure that stores parsed data.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the payload has been parsed.
    + +
    +
    + +

    ◆ sbgEComBinaryLogWriteImuData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogWriteImuData (SbgStreamBuffer * pOutputStream,
    const SbgLogImuDatapInputData 
    )
    +
    +

    Write data for the SBG_ECOM_LOG_IMU_DATA message to the output stream buffer from the provided structure.

    +
    Parameters
    + + + +
    [out]pOutputStreamOutput stream buffer to write the payload to.
    [in]pInputDataPointer on the input structure that stores data to write.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the message has been generated in the provided buffer.
    + +
    +
    + +

    ◆ sbgEComBinaryLogParseImuShort()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogParseImuShort (SbgStreamBuffer * pInputStream,
    SbgLogImuShortpOutputData 
    )
    +
    +

    Parse data for the SBG_ECOM_LOG_IMU_SHORT message and fill the corresponding structure.

    +
    Parameters
    + + + +
    [in]pInputStreamInput stream buffer to read the payload from.
    [out]pOutputDataPointer on the output structure that stores parsed data.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the payload has been parsed.
    + +
    +
    + +

    ◆ sbgEComBinaryLogWriteImuShort()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogWriteImuShort (SbgStreamBuffer * pOutputStream,
    const SbgLogImuShortpInputData 
    )
    +
    +

    Write data for the SBG_ECOM_LOG_IMU_SHORT message to the output stream buffer from the provided structure.

    +
    Parameters
    + + + +
    [out]pOutputStreamOutput stream buffer to write the payload to.
    [in]pInputDataPointer on the input structure that stores data to write.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the message has been generated in the provided buffer.
    + +
    +
    + +

    ◆ sbgEComBinaryLogParseFastImuData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogParseFastImuData (SbgStreamBuffer * pInputStream,
    SbgLogFastImuDatapOutputData 
    )
    +
    +

    Parse data for the SBG_ECOM_LOG_FAST_IMU_DATA message and fill the corresponding structure.

    +
    Parameters
    + + + +
    [in]pInputStreamInput stream buffer to read the payload from.
    [out]pOutputDataPointer on the output structure that stores parsed data.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the payload has been parsed.
    + +
    +
    + +

    ◆ sbgEComBinaryLogWriteFastImuData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogWriteFastImuData (SbgStreamBuffer * pOutputStream,
    const SbgLogFastImuDatapInputData 
    )
    +
    +

    Write data for the SBG_ECOM_LOG_FAST_IMU_DATA message to the output stream buffer from the provided structure.

    +
    Parameters
    + + + +
    [out]pOutputStreamOutput stream buffer to write the payload to.
    [in]pInputDataPointer on the input structure that stores data to write.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the message has been generated in the provided buffer.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_log_imu_8h_source.html b/doc/html/sbg_e_com_binary_log_imu_8h_source.html new file mode 100644 index 0000000..be05984 --- /dev/null +++ b/doc/html/sbg_e_com_binary_log_imu_8h_source.html @@ -0,0 +1,175 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogImu.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComBinaryLogImu.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_BINARY_LOG_IMU_H
    +
    33#define SBG_ECOM_BINARY_LOG_IMU_H
    +
    34
    +
    35// sbgCommonLib headers
    +
    36#include <sbgCommon.h>
    +
    37#include <streamBuffer/sbgStreamBuffer.h>
    +
    38
    +
    39#ifdef __cplusplus
    +
    40extern "C" {
    +
    41#endif
    +
    42
    +
    43//----------------------------------------------------------------------//
    +
    44//- Log Inertial Data definitions -//
    +
    45//----------------------------------------------------------------------//
    +
    46
    +
    50#define SBG_ECOM_IMU_COM_OK (0x00000001u << 0)
    +
    51#define SBG_ECOM_IMU_STATUS_BIT (0x00000001u << 1)
    +
    53#define SBG_ECOM_IMU_ACCEL_X_BIT (0x00000001u << 2)
    +
    54#define SBG_ECOM_IMU_ACCEL_Y_BIT (0x00000001u << 3)
    +
    55#define SBG_ECOM_IMU_ACCEL_Z_BIT (0x00000001u << 4)
    +
    57#define SBG_ECOM_IMU_GYRO_X_BIT (0x00000001u << 5)
    +
    58#define SBG_ECOM_IMU_GYRO_Y_BIT (0x00000001u << 6)
    +
    59#define SBG_ECOM_IMU_GYRO_Z_BIT (0x00000001u << 7)
    +
    61#define SBG_ECOM_IMU_ACCELS_IN_RANGE (0x00000001u << 8)
    +
    62#define SBG_ECOM_IMU_GYROS_IN_RANGE (0x00000001u << 9)
    +
    64//----------------------------------------------------------------------//
    +
    65//- Log structure definitions -//
    +
    66//----------------------------------------------------------------------//
    +
    67
    +
    71typedef struct _SbgLogImuData
    +
    72{
    +
    73 uint32_t timeStamp;
    +
    74 uint16_t status;
    +
    75 float accelerometers[3];
    +
    76 float gyroscopes[3];
    + +
    78 float deltaVelocity[3];
    +
    79 float deltaAngle[3];
    + +
    81
    +
    86typedef struct _SbgLogImuShort
    +
    87{
    +
    88 uint32_t timeStamp;
    +
    89 uint16_t status;
    +
    90 int32_t deltaVelocity[3];
    +
    91 int32_t deltaAngle[3];
    +
    92 int16_t temperature;
    + +
    94
    +
    98typedef struct _SbgLogFastImuData
    +
    99{
    +
    100 uint32_t timeStamp;
    +
    101 uint16_t status;
    +
    102 float accelerometers[3];
    +
    103 float gyroscopes[3];
    + +
    105
    +
    106//----------------------------------------------------------------------//
    +
    107//- Public getters -//
    +
    108//----------------------------------------------------------------------//
    +
    109
    +
    117float sbgLogImuShortGetDeltaAngle(const SbgLogImuShort *pImuShort, size_t idx);
    +
    118
    +
    126float sbgLogImuShortGetDeltaVelocity(const SbgLogImuShort *pImuShort, size_t idx);
    +
    127
    + +
    135
    +
    136//----------------------------------------------------------------------//
    +
    137//- Public methods -//
    +
    138//----------------------------------------------------------------------//
    +
    139
    +
    147SbgErrorCode sbgEComBinaryLogParseImuData(SbgStreamBuffer *pInputStream, SbgLogImuData *pOutputData);
    +
    148
    +
    156SbgErrorCode sbgEComBinaryLogWriteImuData(SbgStreamBuffer *pOutputStream, const SbgLogImuData *pInputData);
    +
    157
    +
    165SbgErrorCode sbgEComBinaryLogParseImuShort(SbgStreamBuffer *pInputStream, SbgLogImuShort *pOutputData);
    +
    166
    +
    174SbgErrorCode sbgEComBinaryLogWriteImuShort(SbgStreamBuffer *pOutputStream, const SbgLogImuShort *pInputData);
    +
    175
    +
    183SbgErrorCode sbgEComBinaryLogParseFastImuData(SbgStreamBuffer *pInputStream, SbgLogFastImuData *pOutputData);
    +
    184
    +
    192SbgErrorCode sbgEComBinaryLogWriteFastImuData(SbgStreamBuffer *pOutputStream, const SbgLogFastImuData *pInputData);
    +
    193
    +
    194#ifdef __cplusplus
    +
    195}
    +
    196#endif
    +
    197
    +
    198#endif // SBG_ECOM_BINARY_LOG_IMU_H
    +
    struct _SbgLogImuShort SbgLogImuShort
    +
    float sbgLogImuShortGetDeltaAngle(const SbgLogImuShort *pImuShort, size_t idx)
    +
    SbgErrorCode sbgEComBinaryLogParseImuShort(SbgStreamBuffer *pInputStream, SbgLogImuShort *pOutputData)
    +
    SbgErrorCode sbgEComBinaryLogParseImuData(SbgStreamBuffer *pInputStream, SbgLogImuData *pOutputData)
    +
    SbgErrorCode sbgEComBinaryLogParseFastImuData(SbgStreamBuffer *pInputStream, SbgLogFastImuData *pOutputData)
    +
    struct _SbgLogImuData SbgLogImuData
    +
    struct _SbgLogFastImuData SbgLogFastImuData
    +
    SbgErrorCode sbgEComBinaryLogWriteImuShort(SbgStreamBuffer *pOutputStream, const SbgLogImuShort *pInputData)
    +
    SbgErrorCode sbgEComBinaryLogWriteFastImuData(SbgStreamBuffer *pOutputStream, const SbgLogFastImuData *pInputData)
    +
    float sbgLogImuShortGetTemperature(const SbgLogImuShort *pImuShort)
    +
    float sbgLogImuShortGetDeltaVelocity(const SbgLogImuShort *pImuShort, size_t idx)
    +
    SbgErrorCode sbgEComBinaryLogWriteImuData(SbgStreamBuffer *pOutputStream, const SbgLogImuData *pInputData)
    +
    Definition: sbgEComBinaryLogImu.h:99
    +
    uint32_t timeStamp
    Definition: sbgEComBinaryLogImu.h:100
    +
    float gyroscopes[3]
    Definition: sbgEComBinaryLogImu.h:103
    +
    uint16_t status
    Definition: sbgEComBinaryLogImu.h:101
    +
    float accelerometers[3]
    Definition: sbgEComBinaryLogImu.h:102
    +
    Definition: sbgEComBinaryLogImu.h:72
    +
    float gyroscopes[3]
    Definition: sbgEComBinaryLogImu.h:76
    +
    uint32_t timeStamp
    Definition: sbgEComBinaryLogImu.h:73
    +
    float temperature
    Definition: sbgEComBinaryLogImu.h:77
    +
    uint16_t status
    Definition: sbgEComBinaryLogImu.h:74
    +
    float deltaAngle[3]
    Definition: sbgEComBinaryLogImu.h:79
    +
    float accelerometers[3]
    Definition: sbgEComBinaryLogImu.h:75
    +
    float deltaVelocity[3]
    Definition: sbgEComBinaryLogImu.h:78
    +
    Definition: sbgEComBinaryLogImu.h:87
    +
    int32_t deltaAngle[3]
    Definition: sbgEComBinaryLogImu.h:91
    +
    int32_t deltaVelocity[3]
    Definition: sbgEComBinaryLogImu.h:90
    +
    int16_t temperature
    Definition: sbgEComBinaryLogImu.h:92
    +
    uint16_t status
    Definition: sbgEComBinaryLogImu.h:89
    +
    uint32_t timeStamp
    Definition: sbgEComBinaryLogImu.h:88
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_log_mag_8h.html b/doc/html/sbg_e_com_binary_log_mag_8h.html new file mode 100644 index 0000000..f744002 --- /dev/null +++ b/doc/html/sbg_e_com_binary_log_mag_8h.html @@ -0,0 +1,441 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogMag.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComBinaryLogMag.h File Reference
    +
    +
    + +

    Parse magnetic field measurements logs. +More...

    +
    #include <sbgCommon.h>
    +#include <streamBuffer/sbgStreamBuffer.h>
    +
    +

    Go to the source code of this file.

    + + + + + + +

    +Data Structures

    struct  _SbgLogMag
     
    struct  _SbgLogMagCalib
     
    + + + + + + + + + + + + + + + + + + + +

    +Macros

    #define SBG_ECOM_MAG_MAG_X_BIT   (0x00000001u << 0)
     
    #define SBG_ECOM_MAG_MAG_Y_BIT   (0x00000001u << 1)
     
    #define SBG_ECOM_MAG_MAG_Z_BIT   (0x00000001u << 2)
     
    #define SBG_ECOM_MAG_ACCEL_X_BIT   (0x00000001u << 3)
     
    #define SBG_ECOM_MAG_ACCEL_Y_BIT   (0x00000001u << 4)
     
    #define SBG_ECOM_MAG_ACCEL_Z_BIT   (0x00000001u << 5)
     
    #define SBG_ECOM_MAG_MAGS_IN_RANGE   (0x00000001u << 6)
     
    #define SBG_ECOM_MAG_ACCELS_IN_RANGE   (0x00000001u << 7)
     
    #define SBG_ECOM_MAG_CALIBRATION_OK   (0x00000001u << 8)
     
    + + + + + +

    +Typedefs

    typedef struct _SbgLogMag SbgLogMag
     
    typedef struct _SbgLogMagCalib SbgLogMagCalib
     
    + + + + + + + + + +

    +Functions

    SbgErrorCode sbgEComBinaryLogParseMagData (SbgStreamBuffer *pInputStream, SbgLogMag *pOutputData)
     
    SbgErrorCode sbgEComBinaryLogWriteMagData (SbgStreamBuffer *pOutputStream, const SbgLogMag *pInputData)
     
    SbgErrorCode sbgEComBinaryLogParseMagCalibData (SbgStreamBuffer *pInputStream, SbgLogMagCalib *pOutputData)
     
    SbgErrorCode sbgEComBinaryLogWriteMagCalibData (SbgStreamBuffer *pOutputStream, const SbgLogMagCalib *pInputData)
     
    +

    Detailed Description

    +

    Parse magnetic field measurements logs.

    +
    Author
    SBG Systems
    +
    Date
    12 March 2013
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Macro Definition Documentation

    + +

    ◆ SBG_ECOM_MAG_MAG_X_BIT

    + +
    +
    + + + + +
    #define SBG_ECOM_MAG_MAG_X_BIT   (0x00000001u << 0)
    +
    +

    Log magnetometer data status mask definitions Set to 1 if the magnetometer X passes Built In Test.

    + +
    +
    + +

    ◆ SBG_ECOM_MAG_MAG_Y_BIT

    + +
    +
    + + + + +
    #define SBG_ECOM_MAG_MAG_Y_BIT   (0x00000001u << 1)
    +
    +

    Set to 1 if the magnetometer Y passes Built In Test.

    + +
    +
    + +

    ◆ SBG_ECOM_MAG_MAG_Z_BIT

    + +
    +
    + + + + +
    #define SBG_ECOM_MAG_MAG_Z_BIT   (0x00000001u << 2)
    +
    +

    Set to 1 if the magnetometer Z passes Built In Test.

    + +
    +
    + +

    ◆ SBG_ECOM_MAG_ACCEL_X_BIT

    + +
    +
    + + + + +
    #define SBG_ECOM_MAG_ACCEL_X_BIT   (0x00000001u << 3)
    +
    +

    Set to 1 if the accelerometer X passes Built In Test.

    + +
    +
    + +

    ◆ SBG_ECOM_MAG_ACCEL_Y_BIT

    + +
    +
    + + + + +
    #define SBG_ECOM_MAG_ACCEL_Y_BIT   (0x00000001u << 4)
    +
    +

    Set to 1 if the accelerometer Y passes Built In Test.

    + +
    +
    + +

    ◆ SBG_ECOM_MAG_ACCEL_Z_BIT

    + +
    +
    + + + + +
    #define SBG_ECOM_MAG_ACCEL_Z_BIT   (0x00000001u << 5)
    +
    +

    Set to 1 if the accelerometer Z passes Built In Test.

    + +
    +
    + +

    ◆ SBG_ECOM_MAG_MAGS_IN_RANGE

    + +
    +
    + + + + +
    #define SBG_ECOM_MAG_MAGS_IN_RANGE   (0x00000001u << 6)
    +
    +

    Set to 1 if all magnetometers are within operating range.

    + +
    +
    + +

    ◆ SBG_ECOM_MAG_ACCELS_IN_RANGE

    + +
    +
    + + + + +
    #define SBG_ECOM_MAG_ACCELS_IN_RANGE   (0x00000001u << 7)
    +
    +

    Set to 1 if all accelerometers are within operating range.

    + +
    +
    + +

    ◆ SBG_ECOM_MAG_CALIBRATION_OK

    + +
    +
    + + + + +
    #define SBG_ECOM_MAG_CALIBRATION_OK   (0x00000001u << 8)
    +
    +

    Set to 1 if the magnetometers seems to be calibrated.

    + +
    +
    +

    Typedef Documentation

    + +

    ◆ SbgLogMag

    + +
    +
    + + + + +
    typedef struct _SbgLogMag SbgLogMag
    +
    +

    Structure that stores data for the SBG_ECOM_LOG_MAG message.

    + +
    +
    + +

    ◆ SbgLogMagCalib

    + +
    +
    + + + + +
    typedef struct _SbgLogMagCalib SbgLogMagCalib
    +
    +

    Structure that stores data for the SBG_ECOM_LOG_MAG_CALIB message.

    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgEComBinaryLogParseMagData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogParseMagData (SbgStreamBuffer * pInputStream,
    SbgLogMagpOutputData 
    )
    +
    +

    Parse data for the SBG_ECOM_LOG_MAG message and fill the corresponding structure.

    +
    Parameters
    + + + +
    [in]pInputStreamInput stream buffer to read the payload from.
    [out]pOutputDataPointer on the output structure that stores parsed data.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the payload has been parsed.
    + +
    +
    + +

    ◆ sbgEComBinaryLogWriteMagData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogWriteMagData (SbgStreamBuffer * pOutputStream,
    const SbgLogMagpInputData 
    )
    +
    +

    Write data for the SBG_ECOM_LOG_MAG message to the output stream buffer from the provided structure.

    +
    Parameters
    + + + +
    [out]pOutputStreamOutput stream buffer to write the payload to.
    [in]pInputDataPointer on the input structure that stores data to write.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the message has been generated in the provided buffer.
    + +
    +
    + +

    ◆ sbgEComBinaryLogParseMagCalibData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogParseMagCalibData (SbgStreamBuffer * pInputStream,
    SbgLogMagCalibpOutputData 
    )
    +
    +

    Parse data for the SBG_ECOM_LOG_MAG_CALIB message and fill the corresponding structure.

    +
    Parameters
    + + + +
    [in]pInputStreamInput stream buffer to read the payload from.
    [out]pOutputDataPointer on the output structure that stores parsed data.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the payload has been parsed.
    + +
    +
    + +

    ◆ sbgEComBinaryLogWriteMagCalibData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogWriteMagCalibData (SbgStreamBuffer * pOutputStream,
    const SbgLogMagCalibpInputData 
    )
    +
    +

    Write data for the SBG_ECOM_LOG_MAG_CALIB message to the output stream buffer from the provided structure.

    +
    Parameters
    + + + +
    [out]pOutputStreamOutput stream buffer to write the payload to.
    [in]pInputDataPointer on the input structure that stores data to write.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the message has been generated in the provided buffer.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_log_mag_8h_source.html b/doc/html/sbg_e_com_binary_log_mag_8h_source.html new file mode 100644 index 0000000..4b42f7c --- /dev/null +++ b/doc/html/sbg_e_com_binary_log_mag_8h_source.html @@ -0,0 +1,131 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogMag.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComBinaryLogMag.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_BINARY_LOG_MAG_H
    +
    33#define SBG_ECOM_BINARY_LOG_MAG_H
    +
    34
    +
    35// sbgCommonLib headers
    +
    36#include <sbgCommon.h>
    +
    37#include <streamBuffer/sbgStreamBuffer.h>
    +
    38
    +
    39#ifdef __cplusplus
    +
    40extern "C" {
    +
    41#endif
    +
    42
    +
    43//----------------------------------------------------------------------//
    +
    44//- Log magnetometers status definitions -//
    +
    45//----------------------------------------------------------------------//
    +
    46
    +
    50#define SBG_ECOM_MAG_MAG_X_BIT (0x00000001u << 0)
    +
    51#define SBG_ECOM_MAG_MAG_Y_BIT (0x00000001u << 1)
    +
    52#define SBG_ECOM_MAG_MAG_Z_BIT (0x00000001u << 2)
    +
    54#define SBG_ECOM_MAG_ACCEL_X_BIT (0x00000001u << 3)
    +
    55#define SBG_ECOM_MAG_ACCEL_Y_BIT (0x00000001u << 4)
    +
    56#define SBG_ECOM_MAG_ACCEL_Z_BIT (0x00000001u << 5)
    +
    58#define SBG_ECOM_MAG_MAGS_IN_RANGE (0x00000001u << 6)
    +
    59#define SBG_ECOM_MAG_ACCELS_IN_RANGE (0x00000001u << 7)
    +
    61#define SBG_ECOM_MAG_CALIBRATION_OK (0x00000001u << 8)
    +
    63//----------------------------------------------------------------------//
    +
    64//- Log structure definitions -//
    +
    65//----------------------------------------------------------------------//
    +
    66
    +
    70typedef struct _SbgLogMag
    +
    71{
    +
    72 uint32_t timeStamp;
    +
    73 uint16_t status;
    +
    74 float magnetometers[3];
    +
    75 float accelerometers[3];
    + +
    77
    +
    81typedef struct _SbgLogMagCalib
    +
    82{
    +
    83 uint32_t timeStamp;
    +
    84 uint16_t reserved;
    +
    85 uint8_t magData[16];
    + +
    87
    +
    88//----------------------------------------------------------------------//
    +
    89//- Public methods -//
    +
    90//----------------------------------------------------------------------//
    +
    91
    +
    99SbgErrorCode sbgEComBinaryLogParseMagData(SbgStreamBuffer *pInputStream, SbgLogMag *pOutputData);
    +
    100
    +
    108SbgErrorCode sbgEComBinaryLogWriteMagData(SbgStreamBuffer *pOutputStream, const SbgLogMag *pInputData);
    +
    109
    +
    117SbgErrorCode sbgEComBinaryLogParseMagCalibData(SbgStreamBuffer *pInputStream, SbgLogMagCalib *pOutputData);
    +
    118
    +
    126SbgErrorCode sbgEComBinaryLogWriteMagCalibData(SbgStreamBuffer *pOutputStream, const SbgLogMagCalib *pInputData);
    +
    127
    +
    128#ifdef __cplusplus
    +
    129}
    +
    130#endif
    +
    131
    +
    132#endif // SBG_ECOM_BINARY_LOG_MAG_H
    +
    SbgErrorCode sbgEComBinaryLogParseMagCalibData(SbgStreamBuffer *pInputStream, SbgLogMagCalib *pOutputData)
    +
    struct _SbgLogMagCalib SbgLogMagCalib
    +
    SbgErrorCode sbgEComBinaryLogParseMagData(SbgStreamBuffer *pInputStream, SbgLogMag *pOutputData)
    +
    SbgErrorCode sbgEComBinaryLogWriteMagCalibData(SbgStreamBuffer *pOutputStream, const SbgLogMagCalib *pInputData)
    +
    SbgErrorCode sbgEComBinaryLogWriteMagData(SbgStreamBuffer *pOutputStream, const SbgLogMag *pInputData)
    +
    struct _SbgLogMag SbgLogMag
    +
    Definition: sbgEComBinaryLogMag.h:82
    +
    uint32_t timeStamp
    Definition: sbgEComBinaryLogMag.h:83
    +
    uint16_t reserved
    Definition: sbgEComBinaryLogMag.h:84
    +
    uint8_t magData[16]
    Definition: sbgEComBinaryLogMag.h:85
    +
    Definition: sbgEComBinaryLogMag.h:71
    +
    float accelerometers[3]
    Definition: sbgEComBinaryLogMag.h:75
    +
    uint32_t timeStamp
    Definition: sbgEComBinaryLogMag.h:72
    +
    uint16_t status
    Definition: sbgEComBinaryLogMag.h:73
    +
    float magnetometers[3]
    Definition: sbgEComBinaryLogMag.h:74
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_log_odometer_8h.html b/doc/html/sbg_e_com_binary_log_odometer_8h.html new file mode 100644 index 0000000..6056067 --- /dev/null +++ b/doc/html/sbg_e_com_binary_log_odometer_8h.html @@ -0,0 +1,225 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogOdometer.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComBinaryLogOdometer.h File Reference
    +
    +
    + +

    Parse recevied odometer/DMI velocity measurement logs. +More...

    +
    #include <sbgCommon.h>
    +#include <streamBuffer/sbgStreamBuffer.h>
    +
    +

    Go to the source code of this file.

    + + + + +

    +Data Structures

    struct  _SbgLogOdometerData
     
    + + + + + +

    +Macros

    #define SBG_ECOM_ODO_REAL_MEAS   (0x0001 << 0)
     
    #define SBG_ECOM_ODO_TIME_SYNC   (0x0001 << 1)
     
    + + + +

    +Typedefs

    typedef struct _SbgLogOdometerData SbgLogOdometerData
     
    + + + + + +

    +Functions

    SbgErrorCode sbgEComBinaryLogParseOdometerData (SbgStreamBuffer *pInputStream, SbgLogOdometerData *pOutputData)
     
    SbgErrorCode sbgEComBinaryLogWriteOdometerData (SbgStreamBuffer *pOutputStream, const SbgLogOdometerData *pInputData)
     
    +

    Detailed Description

    +

    Parse recevied odometer/DMI velocity measurement logs.

    +
    Author
    SBG Systems
    +
    Date
    25 February 2013
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Macro Definition Documentation

    + +

    ◆ SBG_ECOM_ODO_REAL_MEAS

    + +
    +
    + + + + +
    #define SBG_ECOM_ODO_REAL_MEAS   (0x0001 << 0)
    +
    +

    Odometer / velocity status mask definitions. Set to 1 if this log comes from a real pulse measurement or from a timeout.

    + +
    +
    + +

    ◆ SBG_ECOM_ODO_TIME_SYNC

    + +
    +
    + + + + +
    #define SBG_ECOM_ODO_TIME_SYNC   (0x0001 << 1)
    +
    +

    Set to 1 if the velocity information is correctly time synchronized.

    + +
    +
    +

    Typedef Documentation

    + +

    ◆ SbgLogOdometerData

    + +
    +
    + + + + +
    typedef struct _SbgLogOdometerData SbgLogOdometerData
    +
    +

    Log structure for odometer data.

    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgEComBinaryLogParseOdometerData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogParseOdometerData (SbgStreamBuffer * pInputStream,
    SbgLogOdometerDatapOutputData 
    )
    +
    +

    Parse data for the SBG_ECOM_LOG_ODO_VEL message and fill the corresponding structure.

    +
    Parameters
    + + + +
    [in]pInputStreamInput stream buffer to read the payload from.
    [out]pOutputDataPointer on the output structure that stores parsed data.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the payload has been parsed.
    + +
    +
    + +

    ◆ sbgEComBinaryLogWriteOdometerData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogWriteOdometerData (SbgStreamBuffer * pOutputStream,
    const SbgLogOdometerDatapInputData 
    )
    +
    +

    Write data for the SBG_ECOM_LOG_ODO_VEL message to the output stream buffer from the provided structure.

    +
    Parameters
    + + + +
    [out]pOutputStreamOutput stream buffer to write the payload to.
    [in]pInputDataPointer on the input structure that stores data to write.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the message has been generated in the provided buffer.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_log_odometer_8h_source.html b/doc/html/sbg_e_com_binary_log_odometer_8h_source.html new file mode 100644 index 0000000..9342e32 --- /dev/null +++ b/doc/html/sbg_e_com_binary_log_odometer_8h_source.html @@ -0,0 +1,104 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogOdometer.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComBinaryLogOdometer.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_BINARY_LOG_ODOMETER_H
    +
    33#define SBG_ECOM_BINARY_LOG_ODOMETER_H
    +
    34
    +
    35// sbgCommonLib headers
    +
    36#include <sbgCommon.h>
    +
    37#include <streamBuffer/sbgStreamBuffer.h>
    +
    38
    +
    39#ifdef __cplusplus
    +
    40extern "C" {
    +
    41#endif
    +
    42
    +
    43//----------------------------------------------------------------------//
    +
    44//- Log odometer status definitions -//
    +
    45//----------------------------------------------------------------------//
    +
    46
    +
    50#define SBG_ECOM_ODO_REAL_MEAS (0x0001 << 0)
    +
    51#define SBG_ECOM_ODO_TIME_SYNC (0x0001 << 1)
    +
    53//----------------------------------------------------------------------//
    +
    54//- Log structure definitions -//
    +
    55//----------------------------------------------------------------------//
    +
    56
    +
    60typedef struct _SbgLogOdometerData
    +
    61{
    +
    62 uint32_t timeStamp;
    +
    63 uint16_t status;
    +
    64 float velocity;
    + +
    66
    +
    67//----------------------------------------------------------------------//
    +
    68//- Public methods -//
    +
    69//----------------------------------------------------------------------//
    +
    70
    +
    78SbgErrorCode sbgEComBinaryLogParseOdometerData(SbgStreamBuffer *pInputStream, SbgLogOdometerData *pOutputData);
    +
    79
    +
    87SbgErrorCode sbgEComBinaryLogWriteOdometerData(SbgStreamBuffer *pOutputStream, const SbgLogOdometerData *pInputData);
    +
    88
    +
    89#ifdef __cplusplus
    +
    90}
    +
    91#endif
    +
    92
    +
    93#endif // SBG_ECOM_BINARY_LOG_ODOMETER_H
    +
    SbgErrorCode sbgEComBinaryLogWriteOdometerData(SbgStreamBuffer *pOutputStream, const SbgLogOdometerData *pInputData)
    +
    struct _SbgLogOdometerData SbgLogOdometerData
    +
    SbgErrorCode sbgEComBinaryLogParseOdometerData(SbgStreamBuffer *pInputStream, SbgLogOdometerData *pOutputData)
    +
    Definition: sbgEComBinaryLogOdometer.h:61
    +
    float velocity
    Definition: sbgEComBinaryLogOdometer.h:64
    +
    uint16_t status
    Definition: sbgEComBinaryLogOdometer.h:63
    +
    uint32_t timeStamp
    Definition: sbgEComBinaryLogOdometer.h:62
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_log_raw_data_8h.html b/doc/html/sbg_e_com_binary_log_raw_data_8h.html new file mode 100644 index 0000000..13281a8 --- /dev/null +++ b/doc/html/sbg_e_com_binary_log_raw_data_8h.html @@ -0,0 +1,208 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogRawData.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComBinaryLogRawData.h File Reference
    +
    +
    + +

    Parse logs used to store a binary stream such as RAW GNSS data. +More...

    +
    #include <sbgCommon.h>
    +#include <streamBuffer/sbgStreamBuffer.h>
    +
    +

    Go to the source code of this file.

    + + + + +

    +Data Structures

    struct  _SbgLogRawData
     
    + + + +

    +Macros

    #define SBG_ECOM_RAW_DATA_MAX_BUFFER_SIZE   (4086u)
     
    + + + +

    +Typedefs

    typedef struct _SbgLogRawData SbgLogRawData
     
    + + + + + +

    +Functions

    SbgErrorCode sbgEComBinaryLogParseRawData (SbgStreamBuffer *pInputStream, SbgLogRawData *pOutputData)
     
    SbgErrorCode sbgEComBinaryLogWriteRawData (SbgStreamBuffer *pOutputStream, const SbgLogRawData *pInputData)
     
    +

    Detailed Description

    +

    Parse logs used to store a binary stream such as RAW GNSS data.

    +
    Author
    SBG Systems
    +
    Date
    16 November 2020
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Macro Definition Documentation

    + +

    ◆ SBG_ECOM_RAW_DATA_MAX_BUFFER_SIZE

    + +
    +
    + + + + +
    #define SBG_ECOM_RAW_DATA_MAX_BUFFER_SIZE   (4086u)
    +
    +

    Maximum buffer size in bytes that can be stored in the raw data log.

    + +
    +
    +

    Typedef Documentation

    + +

    ◆ SbgLogRawData

    + +
    +
    + + + + +
    typedef struct _SbgLogRawData SbgLogRawData
    +
    +

    Structure that stores raw data message.

    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgEComBinaryLogParseRawData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogParseRawData (SbgStreamBuffer * pInputStream,
    SbgLogRawDatapOutputData 
    )
    +
    +

    Parse raw data message and fill the corresponding structure.

    +
    Parameters
    + + + +
    [in]pInputStreamInput stream buffer to read the payload from.
    [out]pOutputDataPointer on the output structure that stores parsed data.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the payload has been parsed.
    + +
    +
    + +

    ◆ sbgEComBinaryLogWriteRawData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogWriteRawData (SbgStreamBuffer * pOutputStream,
    const SbgLogRawDatapInputData 
    )
    +
    +

    Write raw data message to the output stream buffer from the provided structure.

    +
    Parameters
    + + + +
    [out]pOutputStreamOutput stream buffer to write the payload to.
    [in]pInputDataPointer on the input structure that stores data to write.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the message has been generated in the provided buffer.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_log_raw_data_8h_source.html b/doc/html/sbg_e_com_binary_log_raw_data_8h_source.html new file mode 100644 index 0000000..6676dda --- /dev/null +++ b/doc/html/sbg_e_com_binary_log_raw_data_8h_source.html @@ -0,0 +1,102 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogRawData.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComBinaryLogRawData.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_BINARY_LOG_RAW_DATA_H
    +
    33#define SBG_ECOM_BINARY_LOG_RAW_DATA_H
    +
    34
    +
    35// sbgCommonLib headers
    +
    36#include <sbgCommon.h>
    +
    37#include <streamBuffer/sbgStreamBuffer.h>
    +
    38
    +
    39#ifdef __cplusplus
    +
    40extern "C" {
    +
    41#endif
    +
    42
    +
    43//----------------------------------------------------------------------//
    +
    44//- Log raw Data const definitions -//
    +
    45//----------------------------------------------------------------------//
    +
    46
    +
    47#define SBG_ECOM_RAW_DATA_MAX_BUFFER_SIZE (4086u)
    +
    49//----------------------------------------------------------------------//
    +
    50//- Log structure definitions -//
    +
    51//----------------------------------------------------------------------//
    +
    52
    +
    56typedef struct _SbgLogRawData
    +
    57{
    + +
    59 size_t bufferSize;
    + +
    61
    +
    62//----------------------------------------------------------------------//
    +
    63//- Public methods -//
    +
    64//----------------------------------------------------------------------//
    +
    65
    +
    73SbgErrorCode sbgEComBinaryLogParseRawData(SbgStreamBuffer *pInputStream, SbgLogRawData *pOutputData);
    +
    74
    +
    82SbgErrorCode sbgEComBinaryLogWriteRawData(SbgStreamBuffer *pOutputStream, const SbgLogRawData *pInputData);
    +
    83
    +
    84#ifdef __cplusplus
    +
    85}
    +
    86#endif
    +
    87
    +
    88#endif // SBG_ECOM_BINARY_LOG_RAW_DATA_H
    +
    SbgErrorCode sbgEComBinaryLogWriteRawData(SbgStreamBuffer *pOutputStream, const SbgLogRawData *pInputData)
    +
    SbgErrorCode sbgEComBinaryLogParseRawData(SbgStreamBuffer *pInputStream, SbgLogRawData *pOutputData)
    +
    #define SBG_ECOM_RAW_DATA_MAX_BUFFER_SIZE
    Definition: sbgEComBinaryLogRawData.h:47
    +
    struct _SbgLogRawData SbgLogRawData
    +
    Definition: sbgEComBinaryLogRawData.h:57
    +
    uint8_t rawBuffer[SBG_ECOM_RAW_DATA_MAX_BUFFER_SIZE]
    Definition: sbgEComBinaryLogRawData.h:58
    +
    size_t bufferSize
    Definition: sbgEComBinaryLogRawData.h:59
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_log_rtcm_8h.html b/doc/html/sbg_e_com_binary_log_rtcm_8h.html new file mode 100644 index 0000000..278c655 --- /dev/null +++ b/doc/html/sbg_e_com_binary_log_rtcm_8h.html @@ -0,0 +1,159 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogRtcm.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComBinaryLogRtcm.h File Reference
    +
    +
    + +

    Parse RTCM data stream logs as received by the INS. +More...

    +
    #include <sbgCommon.h>
    +#include <streamBuffer/sbgStreamBuffer.h>
    +#include "sbgEComBinaryLogRawData.h"
    +
    +

    Go to the source code of this file.

    + + + + + + +

    +Functions

    SbgErrorCode sbgEComBinaryLogParseRtcmRawData (SbgStreamBuffer *pInputStream, SbgLogRawData *pOutputData)
     
    SbgErrorCode sbgEComBinaryLogWriteRtcmRawData (SbgStreamBuffer *pOutputStream, const SbgLogRawData *pInputData)
     
    +

    Detailed Description

    +

    Parse RTCM data stream logs as received by the INS.

    +
    Author
    SBG Systems
    +
    Date
    16 November 2020
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Function Documentation

    + +

    ◆ sbgEComBinaryLogParseRtcmRawData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogParseRtcmRawData (SbgStreamBuffer * pInputStream,
    SbgLogRawDatapOutputData 
    )
    +
    +

    Parse data for the SBG_ECOM_LOG_RTCM_RAW message and fill the corresponding structure.

    +
    Parameters
    + + + +
    [in]pInputStreamInput stream buffer to read the payload from.
    [out]pOutputDataPointer on the output structure that stores parsed data.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the payload has been parsed.
    + +
    +
    + +

    ◆ sbgEComBinaryLogWriteRtcmRawData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogWriteRtcmRawData (SbgStreamBuffer * pOutputStream,
    const SbgLogRawDatapInputData 
    )
    +
    +

    Write data for the SBG_ECOM_LOG_RTCM_RAW message to the output stream buffer from the provided structure.

    +
    Parameters
    + + + +
    [out]pOutputStreamOutput stream buffer to write the payload to.
    [in]pInputDataPointer on the input structure that stores data to write.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the message has been generated in the provided buffer.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_log_rtcm_8h_source.html b/doc/html/sbg_e_com_binary_log_rtcm_8h_source.html new file mode 100644 index 0000000..4f29712 --- /dev/null +++ b/doc/html/sbg_e_com_binary_log_rtcm_8h_source.html @@ -0,0 +1,87 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogRtcm.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComBinaryLogRtcm.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_BINARY_LOG_RTCM_H
    +
    33#define SBG_ECOM_BINARY_LOG_RTCM_H
    +
    34
    +
    35// sbgCommonLib headers
    +
    36#include <sbgCommon.h>
    +
    37#include <streamBuffer/sbgStreamBuffer.h>
    +
    38
    +
    39// Local headers
    + +
    41
    +
    42#ifdef __cplusplus
    +
    43extern "C" {
    +
    44#endif
    +
    45
    +
    46//----------------------------------------------------------------------//
    +
    47//- Public methods -//
    +
    48//----------------------------------------------------------------------//
    +
    49
    +
    57SbgErrorCode sbgEComBinaryLogParseRtcmRawData(SbgStreamBuffer *pInputStream, SbgLogRawData *pOutputData);
    +
    58
    +
    66SbgErrorCode sbgEComBinaryLogWriteRtcmRawData(SbgStreamBuffer *pOutputStream, const SbgLogRawData *pInputData);
    +
    67
    +
    68#ifdef __cplusplus
    +
    69}
    +
    70#endif
    +
    71
    +
    72#endif // SBG_ECOM_BINARY_LOG_RTCM_H
    +
    Parse logs used to store a binary stream such as RAW GNSS data.
    +
    SbgErrorCode sbgEComBinaryLogParseRtcmRawData(SbgStreamBuffer *pInputStream, SbgLogRawData *pOutputData)
    +
    SbgErrorCode sbgEComBinaryLogWriteRtcmRawData(SbgStreamBuffer *pOutputStream, const SbgLogRawData *pInputData)
    +
    Definition: sbgEComBinaryLogRawData.h:57
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_log_ship_motion_8h.html b/doc/html/sbg_e_com_binary_log_ship_motion_8h.html new file mode 100644 index 0000000..f2a07ff --- /dev/null +++ b/doc/html/sbg_e_com_binary_log_ship_motion_8h.html @@ -0,0 +1,295 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogShipMotion.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComBinaryLogShipMotion.h File Reference
    +
    +
    + +

    Parse logs that returns ship motion values such as heave. +More...

    +
    #include <sbgCommon.h>
    +#include <streamBuffer/sbgStreamBuffer.h>
    +
    +

    Go to the source code of this file.

    + + + + +

    +Data Structures

    struct  _SbgLogShipMotionData
     
    + + + + + + + + + + + + + +

    +Macros

    #define SBG_ECOM_HEAVE_VALID   (0x0001u << 0)
     
    #define SBG_ECOM_HEAVE_VEL_AIDED   (0x0001u << 1)
     
    #define SBG_ECOM_HEAVE_SURGE_SWAY_INCLUDED   (0x0001u << 2)
     
    #define SBG_ECOM_HEAVE_PERIOD_INCLUDED   (0x0001u << 3)
     
    #define SBG_ECOM_HEAVE_PERIOD_VALID   (0x0001u << 4)
     
    #define SBG_ECOM_HEAVE_SWELL_MODE   (0x0001u << 5)
     
    + + + +

    +Typedefs

    typedef struct _SbgLogShipMotionData SbgLogShipMotionData
     
    + + + + + +

    +Functions

    SbgErrorCode sbgEComBinaryLogParseShipMotionData (SbgStreamBuffer *pInputStream, SbgLogShipMotionData *pOutputData)
     
    SbgErrorCode sbgEComBinaryLogWriteShipMotionData (SbgStreamBuffer *pOutputStream, const SbgLogShipMotionData *pInputData)
     
    +

    Detailed Description

    +

    Parse logs that returns ship motion values such as heave.

    +
    Author
    SBG Systems
    +
    Date
    30 March 2013
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Macro Definition Documentation

    + +

    ◆ SBG_ECOM_HEAVE_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_HEAVE_VALID   (0x0001u << 0)
    +
    +

    Set to 1 after heave convergence time.

    + +
    +
    + +

    ◆ SBG_ECOM_HEAVE_VEL_AIDED

    + +
    +
    + + + + +
    #define SBG_ECOM_HEAVE_VEL_AIDED   (0x0001u << 1)
    +
    +

    Set to 1 if heave output is compensated for transient accelerations.

    + +
    +
    + +

    ◆ SBG_ECOM_HEAVE_SURGE_SWAY_INCLUDED

    + +
    +
    + + + + +
    #define SBG_ECOM_HEAVE_SURGE_SWAY_INCLUDED   (0x0001u << 2)
    +
    +

    Set to 1 if surge and sway channels are provided in this output.

    + +
    +
    + +

    ◆ SBG_ECOM_HEAVE_PERIOD_INCLUDED

    + +
    +
    + + + + +
    #define SBG_ECOM_HEAVE_PERIOD_INCLUDED   (0x0001u << 3)
    +
    +

    Set to 1 if the heave period is provided in this output.

    + +
    +
    + +

    ◆ SBG_ECOM_HEAVE_PERIOD_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_HEAVE_PERIOD_VALID   (0x0001u << 4)
    +
    +

    Set to 1 if the returned heave period is assumed to be valid.

    + +
    +
    + +

    ◆ SBG_ECOM_HEAVE_SWELL_MODE

    + +
    +
    + + + + +
    #define SBG_ECOM_HEAVE_SWELL_MODE   (0x0001u << 5)
    +
    +

    Set to 1 if the real time heave filter is using the swell mode computations.

    + +
    +
    +

    Typedef Documentation

    + +

    ◆ SbgLogShipMotionData

    + +
    +
    + + + + +
    typedef struct _SbgLogShipMotionData SbgLogShipMotionData
    +
    +

    Structure that stores data for the SBG_ECOM_LOG_SHIP_MOTION or SBG_ECOM_LOG_SHIP_MOTION_HP message.
    + The data are expressed in the standard NED Ekinox coordiante frame. Surge is positive forward, sway is positive right and heave is positive down.
    + Note that status flag should be read before using the different parameters because it will provide validity information about all included outputs. Some frames may not provide the heave period or surge/sway axes for example

    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgEComBinaryLogParseShipMotionData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogParseShipMotionData (SbgStreamBuffer * pInputStream,
    SbgLogShipMotionDatapOutputData 
    )
    +
    +

    Parse data for the SBG_ECOM_LOG_SHIP_MOTION or SBG_ECOM_LOG_SHIP_MOTION_HP message and fill the corresponding structure.

    +
    Parameters
    + + + +
    [in]pInputStreamInput stream buffer to read the payload from.
    [out]pOutputDataPointer on the output structure that stores parsed data.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the payload has been parsed.
    + +
    +
    + +

    ◆ sbgEComBinaryLogWriteShipMotionData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogWriteShipMotionData (SbgStreamBuffer * pOutputStream,
    const SbgLogShipMotionDatapInputData 
    )
    +
    +

    Write data for the SBG_ECOM_LOG_SHIP_MOTION or SBG_ECOM_LOG_SHIP_MOTION_HP message to the output stream buffer from the provided structure.

    +
    Parameters
    + + + +
    [out]pOutputStreamOutput stream buffer to write the payload to.
    [in]pInputDataPointer on the input structure that stores data to write.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the message has been generated in the provided buffer.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_log_ship_motion_8h_source.html b/doc/html/sbg_e_com_binary_log_ship_motion_8h_source.html new file mode 100644 index 0000000..0245998 --- /dev/null +++ b/doc/html/sbg_e_com_binary_log_ship_motion_8h_source.html @@ -0,0 +1,114 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogShipMotion.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComBinaryLogShipMotion.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_BINARY_LOG_SHIP_MOTION_H
    +
    33#define SBG_ECOM_BINARY_LOG_SHIP_MOTION_H
    +
    34
    +
    35// sbgCommonLib headers
    +
    36#include <sbgCommon.h>
    +
    37#include <streamBuffer/sbgStreamBuffer.h>
    +
    38
    +
    39#ifdef __cplusplus
    +
    40extern "C" {
    +
    41#endif
    +
    42
    +
    43//----------------------------------------------------------------------//
    +
    44//- Heave status definitions -//
    +
    45//----------------------------------------------------------------------//
    +
    46
    +
    47#define SBG_ECOM_HEAVE_VALID (0x0001u << 0)
    +
    48#define SBG_ECOM_HEAVE_VEL_AIDED (0x0001u << 1)
    +
    49#define SBG_ECOM_HEAVE_SURGE_SWAY_INCLUDED (0x0001u << 2)
    +
    50#define SBG_ECOM_HEAVE_PERIOD_INCLUDED (0x0001u << 3)
    +
    51#define SBG_ECOM_HEAVE_PERIOD_VALID (0x0001u << 4)
    +
    52#define SBG_ECOM_HEAVE_SWELL_MODE (0x0001u << 5)
    +
    54//----------------------------------------------------------------------//
    +
    55//- Log structure definitions -//
    +
    56//----------------------------------------------------------------------//
    +
    57
    + +
    66{
    +
    67 uint32_t timeStamp;
    +
    68 uint16_t status;
    + +
    70 float shipMotion[3];
    +
    71 float shipAccel[3];
    +
    72 float shipVel[3];
    + +
    74
    +
    75//----------------------------------------------------------------------//
    +
    76//- Public methods -//
    +
    77//----------------------------------------------------------------------//
    +
    78
    +
    86SbgErrorCode sbgEComBinaryLogParseShipMotionData(SbgStreamBuffer *pInputStream, SbgLogShipMotionData *pOutputData);
    +
    87
    +
    95SbgErrorCode sbgEComBinaryLogWriteShipMotionData(SbgStreamBuffer *pOutputStream, const SbgLogShipMotionData *pInputData);
    +
    96
    +
    97#ifdef __cplusplus
    +
    98}
    +
    99#endif
    +
    100
    +
    101#endif // SBG_ECOM_BINARY_LOG_SHIP_MOTION_H
    +
    struct _SbgLogShipMotionData SbgLogShipMotionData
    +
    SbgErrorCode sbgEComBinaryLogWriteShipMotionData(SbgStreamBuffer *pOutputStream, const SbgLogShipMotionData *pInputData)
    +
    SbgErrorCode sbgEComBinaryLogParseShipMotionData(SbgStreamBuffer *pInputStream, SbgLogShipMotionData *pOutputData)
    +
    Definition: sbgEComBinaryLogShipMotion.h:66
    +
    float shipAccel[3]
    Definition: sbgEComBinaryLogShipMotion.h:71
    +
    float mainHeavePeriod
    Definition: sbgEComBinaryLogShipMotion.h:69
    +
    uint16_t status
    Definition: sbgEComBinaryLogShipMotion.h:68
    +
    uint32_t timeStamp
    Definition: sbgEComBinaryLogShipMotion.h:67
    +
    float shipMotion[3]
    Definition: sbgEComBinaryLogShipMotion.h:70
    +
    float shipVel[3]
    Definition: sbgEComBinaryLogShipMotion.h:72
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_log_status_8h.html b/doc/html/sbg_e_com_binary_log_status_8h.html new file mode 100644 index 0000000..a8a84f6 --- /dev/null +++ b/doc/html/sbg_e_com_binary_log_status_8h.html @@ -0,0 +1,1153 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogStatus.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComBinaryLogStatus.h File Reference
    +
    +
    + +

    Parse logs used to report device status. +More...

    +
    #include <sbgCommon.h>
    +#include <streamBuffer/sbgStreamBuffer.h>
    +
    +

    Go to the source code of this file.

    + + + + +

    +Data Structures

    struct  _SbgLogStatusData
     
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    +Macros

    #define SBG_ECOM_GENERAL_MAIN_POWER_OK   (0x0001u << 0)
     
    #define SBG_ECOM_GENERAL_IMU_POWER_OK   (0x0001u << 1)
     
    #define SBG_ECOM_GENERAL_GPS_POWER_OK   (0x0001u << 2)
     
    #define SBG_ECOM_GENERAL_SETTINGS_OK   (0x0001u << 3)
     
    #define SBG_ECOM_GENERAL_TEMPERATURE_OK   (0x0001u << 4)
     
    #define SBG_ECOM_GENERAL_DATALOGGER_OK   (0x0001u << 5)
     
    #define SBG_ECOM_GENERAL_CPU_OK   (0x0001u << 6)
     
    #define SBG_ECOM_CAN_STATUS_SHIFT   (28u)
     
    #define SBG_ECOM_CAN_STATUS_MASK   (0x00000007u)
     
    #define SBG_ECOM_PORTA_VALID   (0x00000001u << 0)
     
    #define SBG_ECOM_PORTB_VALID   (0x00000001u << 1)
     
    #define SBG_ECOM_PORTC_VALID   (0x00000001u << 2)
     
    #define SBG_ECOM_PORTD_VALID   (0x00000001u << 3)
     
    #define SBG_ECOM_PORTE_VALID   (0x00000001u << 4)
     
    #define SBG_ECOM_PORTA_RX_OK   (0x00000001u << 5)
     
    #define SBG_ECOM_PORTA_TX_OK   (0x00000001u << 6)
     
    #define SBG_ECOM_PORTB_RX_OK   (0x00000001u << 7)
     
    #define SBG_ECOM_PORTB_TX_OK   (0x00000001u << 8)
     
    #define SBG_ECOM_PORTC_RX_OK   (0x00000001u << 9)
     
    #define SBG_ECOM_PORTC_TX_OK   (0x00000001u << 10)
     
    #define SBG_ECOM_PORTD_RX_OK   (0x00000001u << 11)
     
    #define SBG_ECOM_PORTD_TX_OK   (0x00000001u << 12)
     
    #define SBG_ECOM_PORTE_RX_OK   (0x00000001u << 13)
     
    #define SBG_ECOM_PORTE_TX_OK   (0x00000001u << 14)
     
    #define SBG_ECOM_ETH0_VALID   (0x00000001u << 15)
     
    #define SBG_ECOM_ETH1_VALID   (0x00000001u << 16)
     
    #define SBG_ECOM_ETH2_VALID   (0x00000001u << 17)
     
    #define SBG_ECOM_ETH3_VALID   (0x00000001u << 18)
     
    #define SBG_ECOM_ETH4_VALID   (0x00000001u << 19)
     
    #define SBG_ECOM_CAN_VALID   (0x00000001u << 25)
     
    #define SBG_ECOM_CAN_RX_OK   (0x00000001u << 26)
     
    #define SBG_ECOM_CAN_TX_OK   (0x00000001u << 27)
     
    #define SBG_ECOM_AIDING_GPS1_POS_RECV   (0x00000001u << 0)
     
    #define SBG_ECOM_AIDING_GPS1_VEL_RECV   (0x00000001u << 1)
     
    #define SBG_ECOM_AIDING_GPS1_HDT_RECV   (0x00000001u << 2)
     
    #define SBG_ECOM_AIDING_GPS1_UTC_RECV   (0x00000001u << 3)
     
    #define SBG_ECOM_AIDING_GPS2_POS_RECV   (0x00000001u << 4)
     
    #define SBG_ECOM_AIDING_GPS2_VEL_RECV   (0x00000001u << 5)
     
    #define SBG_ECOM_AIDING_GPS2_HDT_RECV   (0x00000001u << 6)
     
    #define SBG_ECOM_AIDING_GPS2_UTC_RECV   (0x00000001u << 7)
     
    #define SBG_ECOM_AIDING_MAG_RECV   (0x00000001u << 8)
     
    #define SBG_ECOM_AIDING_ODO_RECV   (0x00000001u << 9)
     
    #define SBG_ECOM_AIDING_DVL_RECV   (0x00000001u << 10)
     
    #define SBG_ECOM_AIDING_USBL_RECV   (0x00000001u << 11)
     
    #define SBG_ECOM_AIDING_DEPTH_RECV   (0x00000001u << 12)
     
    #define SBG_ECOM_AIDING_AIR_DATA_RECV   (0x00000001u << 13)
     
    #define SBG_ECOM_AIDING_USER_POS_RECV   (0x00000001u << 14)
     
    #define SBG_ECOM_AIDING_USER_VEL_RECV   (0x00000001u << 15)
     
    #define SBG_ECOM_AIDING_USER_HEADING_RECV   (0x00000001u << 16)
     
    + + + + + +

    +Typedefs

    typedef enum _SbgEComCanBusStatus SbgEComCanBusStatus
     
    typedef struct _SbgLogStatusData SbgLogStatusData
     
    + + + +

    +Enumerations

    enum  _SbgEComCanBusStatus {
    +  SBG_ECOM_CAN_BUS_OFF = 0 +,
    +  SBG_ECOM_CAN_BUS_TX_RX_ERR = 1 +,
    +  SBG_ECOM_CAN_BUS_OK = 2 +,
    +  SBG_ECOM_CAN_BUS_ERROR = 3 +
    + }
     
    + + + + + + + + + +

    +Functions

    SBG_INLINE SbgEComCanBusStatus sbgEComLogStatusGetCanStatus (uint32_t status)
     
    SBG_INLINE uint32_t sbgEComLogStatusBuildCommunicationStatus (SbgEComCanBusStatus canStatus, uint32_t masks)
     
    SbgErrorCode sbgEComBinaryLogParseStatusData (SbgStreamBuffer *pInputStream, SbgLogStatusData *pOutputData)
     
    SbgErrorCode sbgEComBinaryLogWriteStatusData (SbgStreamBuffer *pOutputStream, const SbgLogStatusData *pInputData)
     
    +

    Detailed Description

    +

    Parse logs used to report device status.

    +
    Author
    SBG Systems
    +
    Date
    03 April 2013
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Macro Definition Documentation

    + +

    ◆ SBG_ECOM_GENERAL_MAIN_POWER_OK

    + +
    +
    + + + + +
    #define SBG_ECOM_GENERAL_MAIN_POWER_OK   (0x0001u << 0)
    +
    +

    Set to 1 when main power supply is OK.

    + +
    +
    + +

    ◆ SBG_ECOM_GENERAL_IMU_POWER_OK

    + +
    +
    + + + + +
    #define SBG_ECOM_GENERAL_IMU_POWER_OK   (0x0001u << 1)
    +
    +

    Set to 1 when IMU power supply is OK.

    + +
    +
    + +

    ◆ SBG_ECOM_GENERAL_GPS_POWER_OK

    + +
    +
    + + + + +
    #define SBG_ECOM_GENERAL_GPS_POWER_OK   (0x0001u << 2)
    +
    +

    Set to 1 when GPS power supply is OK.

    + +
    +
    + +

    ◆ SBG_ECOM_GENERAL_SETTINGS_OK

    + +
    +
    + + + + +
    #define SBG_ECOM_GENERAL_SETTINGS_OK   (0x0001u << 3)
    +
    +

    Set to 1 if settings where correctly loaded.

    + +
    +
    + +

    ◆ SBG_ECOM_GENERAL_TEMPERATURE_OK

    + +
    +
    + + + + +
    #define SBG_ECOM_GENERAL_TEMPERATURE_OK   (0x0001u << 4)
    +
    +

    Set to 1 when temperature is within specified limits.

    + +
    +
    + +

    ◆ SBG_ECOM_GENERAL_DATALOGGER_OK

    + +
    +
    + + + + +
    #define SBG_ECOM_GENERAL_DATALOGGER_OK   (0x0001u << 5)
    +
    +

    Set to 1 when the datalogger is working correctly.

    + +
    +
    + +

    ◆ SBG_ECOM_GENERAL_CPU_OK

    + +
    +
    + + + + +
    #define SBG_ECOM_GENERAL_CPU_OK   (0x0001u << 6)
    +
    +

    Set to 1 if the CPU headroom is correct.

    + +
    +
    + +

    ◆ SBG_ECOM_CAN_STATUS_SHIFT

    + +
    +
    + + + + +
    #define SBG_ECOM_CAN_STATUS_SHIFT   (28u)
    +
    +

    Communication CAN status definitions. Shift used to access the CAN status part.

    + +
    +
    + +

    ◆ SBG_ECOM_CAN_STATUS_MASK

    + +
    +
    + + + + +
    #define SBG_ECOM_CAN_STATUS_MASK   (0x00000007u)
    +
    +

    Mask used to keep only the CAN status part.

    + +
    +
    + +

    ◆ SBG_ECOM_PORTA_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_PORTA_VALID   (0x00000001u << 0)
    +
    +

    Communication status bit mask definitions. Set to 0 in case of low level communication error.

    + +
    +
    + +

    ◆ SBG_ECOM_PORTB_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_PORTB_VALID   (0x00000001u << 1)
    +
    +

    Set to 0 in case of low level communication error.

    + +
    +
    + +

    ◆ SBG_ECOM_PORTC_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_PORTC_VALID   (0x00000001u << 2)
    +
    +

    Set to 0 in case of low level communication error.

    + +
    +
    + +

    ◆ SBG_ECOM_PORTD_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_PORTD_VALID   (0x00000001u << 3)
    +
    +

    Set to 0 in case of low level communication error.

    + +
    +
    + +

    ◆ SBG_ECOM_PORTE_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_PORTE_VALID   (0x00000001u << 4)
    +
    +

    Set to 0 in case of low level communication error.

    + +
    +
    + +

    ◆ SBG_ECOM_PORTA_RX_OK

    + +
    +
    + + + + +
    #define SBG_ECOM_PORTA_RX_OK   (0x00000001u << 5)
    +
    +

    Set to 0 in case of error on PORT A input.

    + +
    +
    + +

    ◆ SBG_ECOM_PORTA_TX_OK

    + +
    +
    + + + + +
    #define SBG_ECOM_PORTA_TX_OK   (0x00000001u << 6)
    +
    +

    Set to 0 in case of error on PORT A output.

    + +
    +
    + +

    ◆ SBG_ECOM_PORTB_RX_OK

    + +
    +
    + + + + +
    #define SBG_ECOM_PORTB_RX_OK   (0x00000001u << 7)
    +
    +

    Set to 0 in case of error on PORT B input.

    + +
    +
    + +

    ◆ SBG_ECOM_PORTB_TX_OK

    + +
    +
    + + + + +
    #define SBG_ECOM_PORTB_TX_OK   (0x00000001u << 8)
    +
    +

    Set to 0 in case of error on PORT B output.

    + +
    +
    + +

    ◆ SBG_ECOM_PORTC_RX_OK

    + +
    +
    + + + + +
    #define SBG_ECOM_PORTC_RX_OK   (0x00000001u << 9)
    +
    +

    Set to 0 in case of error on PORT C input.

    + +
    +
    + +

    ◆ SBG_ECOM_PORTC_TX_OK

    + +
    +
    + + + + +
    #define SBG_ECOM_PORTC_TX_OK   (0x00000001u << 10)
    +
    +

    Set to 0 in case of error on PORT C output.

    + +
    +
    + +

    ◆ SBG_ECOM_PORTD_RX_OK

    + +
    +
    + + + + +
    #define SBG_ECOM_PORTD_RX_OK   (0x00000001u << 11)
    +
    +

    Set to 0 in case of error on PORT D input.

    + +
    +
    + +

    ◆ SBG_ECOM_PORTD_TX_OK

    + +
    +
    + + + + +
    #define SBG_ECOM_PORTD_TX_OK   (0x00000001u << 12)
    +
    +

    Set to 0 in case of error on PORT D input.

    + +
    +
    + +

    ◆ SBG_ECOM_PORTE_RX_OK

    + +
    +
    + + + + +
    #define SBG_ECOM_PORTE_RX_OK   (0x00000001u << 13)
    +
    +

    Set to 0 in case of error on PORT E input.

    + +
    +
    + +

    ◆ SBG_ECOM_PORTE_TX_OK

    + +
    +
    + + + + +
    #define SBG_ECOM_PORTE_TX_OK   (0x00000001u << 14)
    +
    +

    Set to 0 in case of error on PORT D input.

    + +
    +
    + +

    ◆ SBG_ECOM_ETH0_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_ETH0_VALID   (0x00000001u << 15)
    +
    +

    Set to 0 in case of error on ETH0.

    + +
    +
    + +

    ◆ SBG_ECOM_ETH1_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_ETH1_VALID   (0x00000001u << 16)
    +
    +

    Set to 0 in case of error on ETH1.

    + +
    +
    + +

    ◆ SBG_ECOM_ETH2_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_ETH2_VALID   (0x00000001u << 17)
    +
    +

    Set to 0 in case of error on ETH2.

    + +
    +
    + +

    ◆ SBG_ECOM_ETH3_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_ETH3_VALID   (0x00000001u << 18)
    +
    +

    Set to 0 in case of error on ETH3.

    + +
    +
    + +

    ◆ SBG_ECOM_ETH4_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_ETH4_VALID   (0x00000001u << 19)
    +
    +

    Set to 0 in case of error on ETH4.

    + +
    +
    + +

    ◆ SBG_ECOM_CAN_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_CAN_VALID   (0x00000001u << 25)
    +
    +

    Set to 0 in case of low level communication error.

    + +
    +
    + +

    ◆ SBG_ECOM_CAN_RX_OK

    + +
    +
    + + + + +
    #define SBG_ECOM_CAN_RX_OK   (0x00000001u << 26)
    +
    +

    Set to 0 in case of error on CAN Bus input buffer.

    + +
    +
    + +

    ◆ SBG_ECOM_CAN_TX_OK

    + +
    +
    + + + + +
    #define SBG_ECOM_CAN_TX_OK   (0x00000001u << 27)
    +
    +

    Set to 0 in case of error on CAN Bus output buffer.

    + +
    +
    + +

    ◆ SBG_ECOM_AIDING_GPS1_POS_RECV

    + +
    +
    + + + + +
    #define SBG_ECOM_AIDING_GPS1_POS_RECV   (0x00000001u << 0)
    +
    +

    Set to 1 when valid GPS 1 position data is received.

    + +
    +
    + +

    ◆ SBG_ECOM_AIDING_GPS1_VEL_RECV

    + +
    +
    + + + + +
    #define SBG_ECOM_AIDING_GPS1_VEL_RECV   (0x00000001u << 1)
    +
    +

    Set to 1 when valid GPS 1 velocity data is received.

    + +
    +
    + +

    ◆ SBG_ECOM_AIDING_GPS1_HDT_RECV

    + +
    +
    + + + + +
    #define SBG_ECOM_AIDING_GPS1_HDT_RECV   (0x00000001u << 2)
    +
    +

    Set to 1 when valid GPS 1 true heading data is received.

    + +
    +
    + +

    ◆ SBG_ECOM_AIDING_GPS1_UTC_RECV

    + +
    +
    + + + + +
    #define SBG_ECOM_AIDING_GPS1_UTC_RECV   (0x00000001u << 3)
    +
    +

    Set to 1 when valid GPS 1 UTC time data is received.

    + +
    +
    + +

    ◆ SBG_ECOM_AIDING_GPS2_POS_RECV

    + +
    +
    + + + + +
    #define SBG_ECOM_AIDING_GPS2_POS_RECV   (0x00000001u << 4)
    +
    +

    Set to 1 when valid GPS 2 position data is received.

    + +
    +
    + +

    ◆ SBG_ECOM_AIDING_GPS2_VEL_RECV

    + +
    +
    + + + + +
    #define SBG_ECOM_AIDING_GPS2_VEL_RECV   (0x00000001u << 5)
    +
    +

    Set to 1 when valid GPS 2 velocity data is received.

    + +
    +
    + +

    ◆ SBG_ECOM_AIDING_GPS2_HDT_RECV

    + +
    +
    + + + + +
    #define SBG_ECOM_AIDING_GPS2_HDT_RECV   (0x00000001u << 6)
    +
    +

    Set to 1 when valid GPS 2 true heading data is received.

    + +
    +
    + +

    ◆ SBG_ECOM_AIDING_GPS2_UTC_RECV

    + +
    +
    + + + + +
    #define SBG_ECOM_AIDING_GPS2_UTC_RECV   (0x00000001u << 7)
    +
    +

    Set to 1 when valid GPS 2 UTC time data is received.

    + +
    +
    + +

    ◆ SBG_ECOM_AIDING_MAG_RECV

    + +
    +
    + + + + +
    #define SBG_ECOM_AIDING_MAG_RECV   (0x00000001u << 8)
    +
    +

    Set to 1 when valid Magnetometer data is received.

    + +
    +
    + +

    ◆ SBG_ECOM_AIDING_ODO_RECV

    + +
    +
    + + + + +
    #define SBG_ECOM_AIDING_ODO_RECV   (0x00000001u << 9)
    +
    +

    Set to 1 when Odometer pulse is received.

    + +
    +
    + +

    ◆ SBG_ECOM_AIDING_DVL_RECV

    + +
    +
    + + + + +
    #define SBG_ECOM_AIDING_DVL_RECV   (0x00000001u << 10)
    +
    +

    Set to 1 when valid DVL data is received.

    + +
    +
    + +

    ◆ SBG_ECOM_AIDING_USBL_RECV

    + +
    +
    + + + + +
    #define SBG_ECOM_AIDING_USBL_RECV   (0x00000001u << 11)
    +
    +

    Set to 1 when valid USBL data is received.

    + +
    +
    + +

    ◆ SBG_ECOM_AIDING_DEPTH_RECV

    + +
    +
    + + + + +
    #define SBG_ECOM_AIDING_DEPTH_RECV   (0x00000001u << 12)
    +
    +

    Set to 1 when valid Depth Log data is received.

    + +
    +
    + +

    ◆ SBG_ECOM_AIDING_AIR_DATA_RECV

    + +
    +
    + + + + +
    #define SBG_ECOM_AIDING_AIR_DATA_RECV   (0x00000001u << 13)
    +
    +

    Set to 1 when valid Air Data (altitude and/or true airspeed) is received.

    + +
    +
    + +

    ◆ SBG_ECOM_AIDING_USER_POS_RECV

    + +
    +
    + + + + +
    #define SBG_ECOM_AIDING_USER_POS_RECV   (0x00000001u << 14)
    +
    +

    Set to 1 when valid user position data is received.

    + +
    +
    + +

    ◆ SBG_ECOM_AIDING_USER_VEL_RECV

    + +
    +
    + + + + +
    #define SBG_ECOM_AIDING_USER_VEL_RECV   (0x00000001u << 15)
    +
    +

    Set to 1 when valid user velocity data is received.

    + +
    +
    + +

    ◆ SBG_ECOM_AIDING_USER_HEADING_RECV

    + +
    +
    + + + + +
    #define SBG_ECOM_AIDING_USER_HEADING_RECV   (0x00000001u << 16)
    +
    +

    Set to 1 when valid user heading data is received.

    + +
    +
    +

    Typedef Documentation

    + +

    ◆ SbgEComCanBusStatus

    + +
    +
    + + + + +
    typedef enum _SbgEComCanBusStatus SbgEComCanBusStatus
    +
    +

    Communication status for the CAN Bus.

    + +
    +
    + +

    ◆ SbgLogStatusData

    + +
    +
    + + + + +
    typedef struct _SbgLogStatusData SbgLogStatusData
    +
    +

    Stores global status data.

    + +
    +
    +

    Enumeration Type Documentation

    + +

    ◆ _SbgEComCanBusStatus

    + +
    +
    + + + + +
    enum _SbgEComCanBusStatus
    +
    +

    Communication status for the CAN Bus.

    + + + + + +
    Enumerator
    SBG_ECOM_CAN_BUS_OFF 

    Bus OFF operation due to too much errors.

    +
    SBG_ECOM_CAN_BUS_TX_RX_ERR 

    Errors on Tx or Rx.

    +
    SBG_ECOM_CAN_BUS_OK 

    Bus OK.

    +
    SBG_ECOM_CAN_BUS_ERROR 

    Bus error.

    +
    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgEComLogStatusGetCanStatus()

    + +
    +
    + + + + + + + + +
    SBG_INLINE SbgEComCanBusStatus sbgEComLogStatusGetCanStatus (uint32_t status)
    +
    +

    Method used to read the CAN bus status from a communication status field.

    +
    Parameters
    + + +
    [in]statusStatus field to extract the CAN bus status from it.
    +
    +
    +
    Returns
    The extracted CAN bus status.
    + +

    References SBG_ECOM_CAN_STATUS_MASK, and SBG_ECOM_CAN_STATUS_SHIFT.

    + +
    +
    + +

    ◆ sbgEComLogStatusBuildCommunicationStatus()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SBG_INLINE uint32_t sbgEComLogStatusBuildCommunicationStatus (SbgEComCanBusStatus canStatus,
    uint32_t masks 
    )
    +
    +

    Method used to write the CAN bus status field.

    +
    Parameters
    + + + +
    [in]canStatusThe CAN bus status to set.
    [in]masksBit mask to set.
    +
    +
    +
    Returns
    The build communication status field.
    + +

    References SBG_ECOM_CAN_STATUS_MASK, and SBG_ECOM_CAN_STATUS_SHIFT.

    + +
    +
    + +

    ◆ sbgEComBinaryLogParseStatusData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogParseStatusData (SbgStreamBuffer * pInputStream,
    SbgLogStatusDatapOutputData 
    )
    +
    +

    Parse data for the SBG_ECOM_LOG_STATUS message and fill the corresponding structure.

    +
    Parameters
    + + + +
    [in]pInputStreamInput stream buffer to read the payload from.
    [out]pOutputDataPointer on the output structure that stores parsed data.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the payload has been parsed.
    + +
    +
    + +

    ◆ sbgEComBinaryLogWriteStatusData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogWriteStatusData (SbgStreamBuffer * pOutputStream,
    const SbgLogStatusDatapInputData 
    )
    +
    +

    Write data for the SBG_ECOM_LOG_STATUS message to the output stream buffer from the provided structure.

    +
    Parameters
    + + + +
    [out]pOutputStreamOutput stream buffer to write the payload to.
    [in]pInputDataPointer on the input structure that stores data to write.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the message has been generated in the provided buffer.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_log_status_8h_source.html b/doc/html/sbg_e_com_binary_log_status_8h_source.html new file mode 100644 index 0000000..55d40c3 --- /dev/null +++ b/doc/html/sbg_e_com_binary_log_status_8h_source.html @@ -0,0 +1,202 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogStatus.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComBinaryLogStatus.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_BINARY_LOG_STATUS_H
    +
    33#define SBG_ECOM_BINARY_LOG_STATUS_H
    +
    34
    +
    35// sbgCommonLib headers
    +
    36#include <sbgCommon.h>
    +
    37#include <streamBuffer/sbgStreamBuffer.h>
    +
    38
    +
    39#ifdef __cplusplus
    +
    40extern "C" {
    +
    41#endif
    +
    42
    +
    43//----------------------------------------------------------------------//
    +
    44//- General status definitions -//
    +
    45//----------------------------------------------------------------------//
    +
    46#define SBG_ECOM_GENERAL_MAIN_POWER_OK (0x0001u << 0)
    +
    47#define SBG_ECOM_GENERAL_IMU_POWER_OK (0x0001u << 1)
    +
    48#define SBG_ECOM_GENERAL_GPS_POWER_OK (0x0001u << 2)
    +
    49#define SBG_ECOM_GENERAL_SETTINGS_OK (0x0001u << 3)
    +
    50#define SBG_ECOM_GENERAL_TEMPERATURE_OK (0x0001u << 4)
    +
    51#define SBG_ECOM_GENERAL_DATALOGGER_OK (0x0001u << 5)
    +
    52#define SBG_ECOM_GENERAL_CPU_OK (0x0001u << 6)
    +
    54//----------------------------------------------------------------------//
    +
    55//- Communication status definitions -//
    +
    56//----------------------------------------------------------------------//
    +
    57
    +
    61#define SBG_ECOM_CAN_STATUS_SHIFT (28u)
    +
    62#define SBG_ECOM_CAN_STATUS_MASK (0x00000007u)
    +
    67#define SBG_ECOM_PORTA_VALID (0x00000001u << 0)
    +
    68#define SBG_ECOM_PORTB_VALID (0x00000001u << 1)
    +
    69#define SBG_ECOM_PORTC_VALID (0x00000001u << 2)
    +
    70#define SBG_ECOM_PORTD_VALID (0x00000001u << 3)
    +
    71#define SBG_ECOM_PORTE_VALID (0x00000001u << 4)
    +
    73#define SBG_ECOM_PORTA_RX_OK (0x00000001u << 5)
    +
    74#define SBG_ECOM_PORTA_TX_OK (0x00000001u << 6)
    +
    75#define SBG_ECOM_PORTB_RX_OK (0x00000001u << 7)
    +
    76#define SBG_ECOM_PORTB_TX_OK (0x00000001u << 8)
    +
    77#define SBG_ECOM_PORTC_RX_OK (0x00000001u << 9)
    +
    78#define SBG_ECOM_PORTC_TX_OK (0x00000001u << 10)
    +
    79#define SBG_ECOM_PORTD_RX_OK (0x00000001u << 11)
    +
    80#define SBG_ECOM_PORTD_TX_OK (0x00000001u << 12)
    +
    81#define SBG_ECOM_PORTE_RX_OK (0x00000001u << 13)
    +
    82#define SBG_ECOM_PORTE_TX_OK (0x00000001u << 14)
    +
    84#define SBG_ECOM_ETH0_VALID (0x00000001u << 15)
    +
    85#define SBG_ECOM_ETH1_VALID (0x00000001u << 16)
    +
    86#define SBG_ECOM_ETH2_VALID (0x00000001u << 17)
    +
    87#define SBG_ECOM_ETH3_VALID (0x00000001u << 18)
    +
    88#define SBG_ECOM_ETH4_VALID (0x00000001u << 19)
    +
    90#define SBG_ECOM_CAN_VALID (0x00000001u << 25)
    +
    91#define SBG_ECOM_CAN_RX_OK (0x00000001u << 26)
    +
    92#define SBG_ECOM_CAN_TX_OK (0x00000001u << 27)
    + +
    98{
    + + + + + +
    104
    +
    105//----------------------------------------------------------------------//
    +
    106//- Aiding status definitions -//
    +
    107//----------------------------------------------------------------------//
    +
    108#define SBG_ECOM_AIDING_GPS1_POS_RECV (0x00000001u << 0)
    +
    109#define SBG_ECOM_AIDING_GPS1_VEL_RECV (0x00000001u << 1)
    +
    110#define SBG_ECOM_AIDING_GPS1_HDT_RECV (0x00000001u << 2)
    +
    111#define SBG_ECOM_AIDING_GPS1_UTC_RECV (0x00000001u << 3)
    +
    112#define SBG_ECOM_AIDING_GPS2_POS_RECV (0x00000001u << 4)
    +
    113#define SBG_ECOM_AIDING_GPS2_VEL_RECV (0x00000001u << 5)
    +
    114#define SBG_ECOM_AIDING_GPS2_HDT_RECV (0x00000001u << 6)
    +
    115#define SBG_ECOM_AIDING_GPS2_UTC_RECV (0x00000001u << 7)
    +
    116#define SBG_ECOM_AIDING_MAG_RECV (0x00000001u << 8)
    +
    117#define SBG_ECOM_AIDING_ODO_RECV (0x00000001u << 9)
    +
    118#define SBG_ECOM_AIDING_DVL_RECV (0x00000001u << 10)
    +
    119#define SBG_ECOM_AIDING_USBL_RECV (0x00000001u << 11)
    +
    120#define SBG_ECOM_AIDING_DEPTH_RECV (0x00000001u << 12)
    +
    121#define SBG_ECOM_AIDING_AIR_DATA_RECV (0x00000001u << 13)
    +
    122#define SBG_ECOM_AIDING_USER_POS_RECV (0x00000001u << 14)
    +
    123#define SBG_ECOM_AIDING_USER_VEL_RECV (0x00000001u << 15)
    +
    124#define SBG_ECOM_AIDING_USER_HEADING_RECV (0x00000001u << 16)
    +
    126//----------------------------------------------------------------------//
    +
    127//- Status definitions -//
    +
    128//----------------------------------------------------------------------//
    +
    129
    +
    133typedef struct _SbgLogStatusData
    +
    134{
    +
    135 uint32_t timeStamp;
    +
    136 uint16_t generalStatus;
    +
    137 uint16_t reserved1;
    +
    138 uint32_t comStatus;
    +
    139 uint32_t aidingStatus;
    +
    140 uint32_t reserved2;
    +
    141 uint16_t reserved3;
    +
    142 uint32_t uptime;
    + +
    144
    +
    145//----------------------------------------------------------------------//
    +
    146//- Public getters & helpers -//
    +
    147//----------------------------------------------------------------------//
    +
    148
    + +
    156{
    + +
    158}
    +
    159
    +
    167SBG_INLINE uint32_t sbgEComLogStatusBuildCommunicationStatus(SbgEComCanBusStatus canStatus, uint32_t masks)
    +
    168{
    +
    169 //
    +
    170 // Create the combined status field
    +
    171 //
    +
    172 return ((((uint32_t)canStatus)&SBG_ECOM_CAN_STATUS_MASK) << SBG_ECOM_CAN_STATUS_SHIFT) | masks;
    +
    173}
    +
    174
    +
    175//----------------------------------------------------------------------//
    +
    176//- Public methods -//
    +
    177//----------------------------------------------------------------------//
    +
    178
    +
    186SbgErrorCode sbgEComBinaryLogParseStatusData(SbgStreamBuffer *pInputStream, SbgLogStatusData *pOutputData);
    +
    187
    +
    195SbgErrorCode sbgEComBinaryLogWriteStatusData(SbgStreamBuffer *pOutputStream, const SbgLogStatusData *pInputData);
    +
    196
    +
    197#ifdef __cplusplus
    +
    198}
    +
    199#endif
    +
    200
    +
    201#endif // SBG_ECOM_BINARY_LOG_STATUS_H
    +
    SBG_INLINE uint32_t sbgEComLogStatusBuildCommunicationStatus(SbgEComCanBusStatus canStatus, uint32_t masks)
    Definition: sbgEComBinaryLogStatus.h:167
    +
    SBG_INLINE SbgEComCanBusStatus sbgEComLogStatusGetCanStatus(uint32_t status)
    Definition: sbgEComBinaryLogStatus.h:155
    +
    SbgErrorCode sbgEComBinaryLogWriteStatusData(SbgStreamBuffer *pOutputStream, const SbgLogStatusData *pInputData)
    +
    #define SBG_ECOM_CAN_STATUS_MASK
    Definition: sbgEComBinaryLogStatus.h:62
    +
    #define SBG_ECOM_CAN_STATUS_SHIFT
    Definition: sbgEComBinaryLogStatus.h:61
    +
    SbgErrorCode sbgEComBinaryLogParseStatusData(SbgStreamBuffer *pInputStream, SbgLogStatusData *pOutputData)
    +
    enum _SbgEComCanBusStatus SbgEComCanBusStatus
    +
    struct _SbgLogStatusData SbgLogStatusData
    +
    _SbgEComCanBusStatus
    Definition: sbgEComBinaryLogStatus.h:98
    +
    @ SBG_ECOM_CAN_BUS_OK
    Definition: sbgEComBinaryLogStatus.h:101
    +
    @ SBG_ECOM_CAN_BUS_TX_RX_ERR
    Definition: sbgEComBinaryLogStatus.h:100
    +
    @ SBG_ECOM_CAN_BUS_OFF
    Definition: sbgEComBinaryLogStatus.h:99
    +
    @ SBG_ECOM_CAN_BUS_ERROR
    Definition: sbgEComBinaryLogStatus.h:102
    +
    Definition: sbgEComBinaryLogStatus.h:134
    +
    uint32_t timeStamp
    Definition: sbgEComBinaryLogStatus.h:135
    +
    uint32_t reserved2
    Definition: sbgEComBinaryLogStatus.h:140
    +
    uint16_t reserved3
    Definition: sbgEComBinaryLogStatus.h:141
    +
    uint32_t aidingStatus
    Definition: sbgEComBinaryLogStatus.h:139
    +
    uint16_t generalStatus
    Definition: sbgEComBinaryLogStatus.h:136
    +
    uint16_t reserved1
    Definition: sbgEComBinaryLogStatus.h:137
    +
    uint32_t comStatus
    Definition: sbgEComBinaryLogStatus.h:138
    +
    uint32_t uptime
    Definition: sbgEComBinaryLogStatus.h:142
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_log_usbl_8h.html b/doc/html/sbg_e_com_binary_log_usbl_8h.html new file mode 100644 index 0000000..dbe1753 --- /dev/null +++ b/doc/html/sbg_e_com_binary_log_usbl_8h.html @@ -0,0 +1,243 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogUsbl.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComBinaryLogUsbl.h File Reference
    +
    +
    + +

    Parse received USBL position mesurements logs. +More...

    +
    #include <sbgCommon.h>
    +#include <streamBuffer/sbgStreamBuffer.h>
    +
    +

    Go to the source code of this file.

    + + + + +

    +Data Structures

    struct  _SbgLogUsblData
     
    + + + + + + + +

    +Macros

    #define SBG_ECOM_USBL_TIME_SYNC   (0x0001u << 0)
     
    #define SBG_ECOM_USBL_POSITION_VALID   (0x0001u << 1)
     
    #define SBG_ECOM_USBL_DEPTH_VALID   (0x0001u << 2)
     
    + + + +

    +Typedefs

    typedef struct _SbgLogUsblData SbgLogUsblData
     
    + + + + + +

    +Functions

    SbgErrorCode sbgEComBinaryLogParseUsblData (SbgStreamBuffer *pInputStream, SbgLogUsblData *pOutputData)
     
    SbgErrorCode sbgEComBinaryLogWriteUsblData (SbgStreamBuffer *pOutputStream, const SbgLogUsblData *pInputData)
     
    +

    Detailed Description

    +

    Parse received USBL position mesurements logs.

    +
    Author
    SBG Systems
    +
    Date
    02 June 2014
    +

    USBL binary logs contains underwater positioning data of a USBL beacon.

    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Macro Definition Documentation

    + +

    ◆ SBG_ECOM_USBL_TIME_SYNC

    + +
    +
    + + + + +
    #define SBG_ECOM_USBL_TIME_SYNC   (0x0001u << 0)
    +
    +

    USBL sensor status mask definitions Set to 1 if the USBL sensor data is correctly time synchronized.

    + +
    +
    + +

    ◆ SBG_ECOM_USBL_POSITION_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_USBL_POSITION_VALID   (0x0001u << 1)
    +
    +

    Set to 1 if the USBL data represents a valid 2D position.

    + +
    +
    + +

    ◆ SBG_ECOM_USBL_DEPTH_VALID

    + +
    +
    + + + + +
    #define SBG_ECOM_USBL_DEPTH_VALID   (0x0001u << 2)
    +
    +

    Set to 1 if the USBL data has a valid depth information.

    + +
    +
    +

    Typedef Documentation

    + +

    ◆ SbgLogUsblData

    + +
    +
    + + + + +
    typedef struct _SbgLogUsblData SbgLogUsblData
    +
    +

    Log structure for USBL data.

    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgEComBinaryLogParseUsblData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogParseUsblData (SbgStreamBuffer * pInputStream,
    SbgLogUsblDatapOutputData 
    )
    +
    +

    Parse data for the SBG_ECOM_LOG_USBL message and fill the corresponding structure.

    +
    Parameters
    + + + +
    [in]pInputStreamInput stream buffer to read the payload from.
    [out]pOutputDataPointer on the output structure that stores parsed data.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the payload has been parsed.
    + +
    +
    + +

    ◆ sbgEComBinaryLogWriteUsblData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogWriteUsblData (SbgStreamBuffer * pOutputStream,
    const SbgLogUsblDatapInputData 
    )
    +
    +

    Write data for the SBG_ECOM_LOG_USBL message to the output stream buffer from the provided structure.

    +
    Parameters
    + + + +
    [out]pOutputStreamOutput stream buffer to write the payload to.
    [in]pInputDataPointer on the input structure that stores data to write.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the message has been generated in the provided buffer.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_log_usbl_8h_source.html b/doc/html/sbg_e_com_binary_log_usbl_8h_source.html new file mode 100644 index 0000000..2238a7f --- /dev/null +++ b/doc/html/sbg_e_com_binary_log_usbl_8h_source.html @@ -0,0 +1,115 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogUsbl.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComBinaryLogUsbl.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    34#ifndef SBG_ECOM_BINARY_LOG_USBL_H
    +
    35#define SBG_ECOM_BINARY_LOG_USBL_H
    +
    36
    +
    37// sbgCommonLib headers
    +
    38#include <sbgCommon.h>
    +
    39#include <streamBuffer/sbgStreamBuffer.h>
    +
    40
    +
    41#ifdef __cplusplus
    +
    42extern "C" {
    +
    43#endif
    +
    44
    +
    45//----------------------------------------------------------------------//
    +
    46//- Log USBL status definitions -//
    +
    47//----------------------------------------------------------------------//
    +
    48
    +
    52#define SBG_ECOM_USBL_TIME_SYNC (0x0001u << 0)
    +
    53#define SBG_ECOM_USBL_POSITION_VALID (0x0001u << 1)
    +
    54#define SBG_ECOM_USBL_DEPTH_VALID (0x0001u << 2)
    +
    56//----------------------------------------------------------------------//
    +
    57//- Log structure definitions -//
    +
    58//----------------------------------------------------------------------//
    +
    59
    +
    63typedef struct _SbgLogUsblData
    +
    64{
    +
    65 uint32_t timeStamp;
    +
    66 uint16_t status;
    +
    68 double latitude;
    +
    69 double longitude;
    +
    71 float depth;
    + + + + +
    77
    +
    78//----------------------------------------------------------------------//
    +
    79//- Public methods -//
    +
    80//----------------------------------------------------------------------//
    +
    81
    +
    89SbgErrorCode sbgEComBinaryLogParseUsblData(SbgStreamBuffer *pInputStream, SbgLogUsblData *pOutputData);
    +
    90
    +
    98SbgErrorCode sbgEComBinaryLogWriteUsblData(SbgStreamBuffer *pOutputStream, const SbgLogUsblData *pInputData);
    +
    99
    +
    100#ifdef __cplusplus
    +
    101}
    +
    102#endif
    +
    103
    +
    104#endif // SBG_ECOM_BINARY_LOG_USBL_H
    +
    struct _SbgLogUsblData SbgLogUsblData
    +
    SbgErrorCode sbgEComBinaryLogWriteUsblData(SbgStreamBuffer *pOutputStream, const SbgLogUsblData *pInputData)
    +
    SbgErrorCode sbgEComBinaryLogParseUsblData(SbgStreamBuffer *pInputStream, SbgLogUsblData *pOutputData)
    +
    Definition: sbgEComBinaryLogUsbl.h:64
    +
    uint16_t status
    Definition: sbgEComBinaryLogUsbl.h:66
    +
    double longitude
    Definition: sbgEComBinaryLogUsbl.h:69
    +
    double latitude
    Definition: sbgEComBinaryLogUsbl.h:68
    +
    uint32_t timeStamp
    Definition: sbgEComBinaryLogUsbl.h:65
    +
    float longitudeAccuracy
    Definition: sbgEComBinaryLogUsbl.h:74
    +
    float depthAccuracy
    Definition: sbgEComBinaryLogUsbl.h:75
    +
    float latitudeAccuracy
    Definition: sbgEComBinaryLogUsbl.h:73
    +
    float depth
    Definition: sbgEComBinaryLogUsbl.h:71
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_log_utc_8h.html b/doc/html/sbg_e_com_binary_log_utc_8h.html new file mode 100644 index 0000000..8f10980 --- /dev/null +++ b/doc/html/sbg_e_com_binary_log_utc_8h.html @@ -0,0 +1,564 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogUtc.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComBinaryLogUtc.h File Reference
    +
    +
    + +

    Parse logs used to report device UTC time. +More...

    +
    #include <sbgCommon.h>
    +#include <streamBuffer/sbgStreamBuffer.h>
    +
    +

    Go to the source code of this file.

    + + + + +

    +Data Structures

    struct  _SbgLogUtcData
     
    + + + + + + + + + + + + + +

    +Macros

    #define SBG_ECOM_CLOCK_STATUS_SHIFT   (1u)
     
    #define SBG_ECOM_CLOCK_STATUS_MASK   (0x000Fu)
     
    #define SBG_ECOM_CLOCK_UTC_STATUS_SHIFT   (6u)
     
    #define SBG_ECOM_CLOCK_UTC_STATUS_MASK   (0x000Fu)
     
    #define SBG_ECOM_CLOCK_STABLE_INPUT   (0x0001u << 0)
     
    #define SBG_ECOM_CLOCK_UTC_SYNC   (0x0001u << 5)
     
    + + + + + + + +

    +Typedefs

    typedef enum _SbgEComClockStatus SbgEComClockStatus
     
    typedef enum _SbgEComClockUtcStatus SbgEComClockUtcStatus
     
    typedef struct _SbgLogUtcData SbgLogUtcData
     
    + + + + + +

    +Enumerations

    enum  _SbgEComClockStatus {
    +  SBG_ECOM_CLOCK_ERROR = 0 +,
    +  SBG_ECOM_CLOCK_FREE_RUNNING = 1 +,
    +  SBG_ECOM_CLOCK_STEERING = 2 +,
    +  SBG_ECOM_CLOCK_VALID = 3 +
    + }
     
    enum  _SbgEComClockUtcStatus {
    +  SBG_ECOM_UTC_INVALID = 0 +,
    +  SBG_ECOM_UTC_NO_LEAP_SEC = 1 +,
    +  SBG_ECOM_UTC_VALID = 2 +
    + }
     
    + + + + + + + + + + + + + + + +

    +Functions

    SBG_INLINE SbgEComClockStatus sbgEComLogUtcGetClockStatus (uint16_t status)
     
    SBG_INLINE SbgEComClockUtcStatus sbgEComLogUtcGetClockUtcStatus (uint16_t status)
     
    SBG_INLINE uint16_t sbgEComLogUtcBuildClockStatus (SbgEComClockStatus clockStatus, SbgEComClockUtcStatus utcStatus, uint16_t masks)
     
    const char * sbgEcomLogUtcGetClockStatusAsString (const SbgLogUtcData *pLogUtc)
     
    const char * sbgEcomLogUtcGetUtcStatusAsString (const SbgLogUtcData *pLogUtc)
     
    SbgErrorCode sbgEComBinaryLogParseUtcData (SbgStreamBuffer *pInputStream, SbgLogUtcData *pOutputData)
     
    SbgErrorCode sbgEComBinaryLogWriteUtcData (SbgStreamBuffer *pOutputStream, const SbgLogUtcData *pInputData)
     
    +

    Detailed Description

    +

    Parse logs used to report device UTC time.

    +
    Author
    SBG Systems
    +
    Date
    20 February 2013
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Macro Definition Documentation

    + +

    ◆ SBG_ECOM_CLOCK_STATUS_SHIFT

    + +
    +
    + + + + +
    #define SBG_ECOM_CLOCK_STATUS_SHIFT   (1u)
    +
    +

    Clock status and UTC time status definitions. Shift used to extract the clock status part.

    + +
    +
    + +

    ◆ SBG_ECOM_CLOCK_STATUS_MASK

    + +
    +
    + + + + +
    #define SBG_ECOM_CLOCK_STATUS_MASK   (0x000Fu)
    +
    +

    Mask used to keep only the clock status part.

    + +
    +
    + +

    ◆ SBG_ECOM_CLOCK_UTC_STATUS_SHIFT

    + +
    +
    + + + + +
    #define SBG_ECOM_CLOCK_UTC_STATUS_SHIFT   (6u)
    +
    +

    Shift used to extract the clock UTC status part.

    + +
    +
    + +

    ◆ SBG_ECOM_CLOCK_UTC_STATUS_MASK

    + +
    +
    + + + + +
    #define SBG_ECOM_CLOCK_UTC_STATUS_MASK   (0x000Fu)
    +
    +

    Mask used to keep only the clock UTC status part.

    + +
    +
    + +

    ◆ SBG_ECOM_CLOCK_STABLE_INPUT

    + +
    +
    + + + + +
    #define SBG_ECOM_CLOCK_STABLE_INPUT   (0x0001u << 0)
    +
    +

    Clock status mask definitions. Set to 1 if a stable input clock could be used to synchronized the internal clock.

    + +
    +
    + +

    ◆ SBG_ECOM_CLOCK_UTC_SYNC

    + +
    +
    + + + + +
    #define SBG_ECOM_CLOCK_UTC_SYNC   (0x0001u << 5)
    +
    +

    The UTC time is synchronized with a PPS.

    + +
    +
    +

    Typedef Documentation

    + +

    ◆ SbgEComClockStatus

    + +
    +
    + + + + +
    typedef enum _SbgEComClockStatus SbgEComClockStatus
    +
    +

    Clock status enum.

    + +
    +
    + +

    ◆ SbgEComClockUtcStatus

    + +
    +
    +

    Status for the UTC time data.

    + +
    +
    + +

    ◆ SbgLogUtcData

    + +
    +
    + + + + +
    typedef struct _SbgLogUtcData SbgLogUtcData
    +
    +

    Structure that stores data for the SBG_ECOM_LOG_UTC_TIME message.

    + +
    +
    +

    Enumeration Type Documentation

    + +

    ◆ _SbgEComClockStatus

    + +
    +
    + + + + +
    enum _SbgEComClockStatus
    +
    +

    Clock status enum.

    + + + + + +
    Enumerator
    SBG_ECOM_CLOCK_ERROR 

    An error has occurred on the clock estimation.

    +
    SBG_ECOM_CLOCK_FREE_RUNNING 

    The clock is only based on the internal crystal.

    +
    SBG_ECOM_CLOCK_STEERING 

    A PPS has been detected and the clock is converging to it.

    +
    SBG_ECOM_CLOCK_VALID 

    The clock has converged to the PPS and is within 500ns.

    +
    + +
    +
    + +

    ◆ _SbgEComClockUtcStatus

    + +
    +
    + + + + +
    enum _SbgEComClockUtcStatus
    +
    +

    Status for the UTC time data.

    + + + + +
    Enumerator
    SBG_ECOM_UTC_INVALID 

    The UTC time is not known, we are just propagating the UTC time internally.

    +
    SBG_ECOM_UTC_NO_LEAP_SEC 

    We have received valid UTC time information but we don't have the leap seconds information.

    +
    SBG_ECOM_UTC_VALID 

    We have received valid UTC time data with valid leap seconds.

    +
    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgEComLogUtcGetClockStatus()

    + +
    +
    + + + + + + + + +
    SBG_INLINE SbgEComClockStatus sbgEComLogUtcGetClockStatus (uint16_t status)
    +
    +

    Method used to read the clock status from a status field.

    +
    Parameters
    + + +
    [in]statusStatus field to extract the clock status from it.
    +
    +
    +
    Returns
    The extracted clock status.
    + +

    References SBG_ECOM_CLOCK_STATUS_MASK, and SBG_ECOM_CLOCK_STATUS_SHIFT.

    + +
    +
    + +

    ◆ sbgEComLogUtcGetClockUtcStatus()

    + +
    +
    + + + + + + + + +
    SBG_INLINE SbgEComClockUtcStatus sbgEComLogUtcGetClockUtcStatus (uint16_t status)
    +
    +

    Method used to read the UTC time status from a clock status field.

    +
    Parameters
    + + +
    [in]statusStatus field to extract the UTC time status from it.
    +
    +
    +
    Returns
    The extracted UTC time status.
    + +

    References SBG_ECOM_CLOCK_UTC_STATUS_MASK, and SBG_ECOM_CLOCK_UTC_STATUS_SHIFT.

    + +
    +
    + +

    ◆ sbgEComLogUtcBuildClockStatus()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    SBG_INLINE uint16_t sbgEComLogUtcBuildClockStatus (SbgEComClockStatus clockStatus,
    SbgEComClockUtcStatus utcStatus,
    uint16_t masks 
    )
    +
    +

    Method used to write the clock status field.

    +
    Parameters
    + + + + +
    [in]clockStatusThe clock status to set.
    [in]utcStatusThe UTC time status to set.
    [in]masksBit mask to set.
    +
    +
    +
    Returns
    The build clock status field.
    + +

    References SBG_ECOM_CLOCK_STATUS_MASK, SBG_ECOM_CLOCK_STATUS_SHIFT, SBG_ECOM_CLOCK_UTC_STATUS_MASK, and SBG_ECOM_CLOCK_UTC_STATUS_SHIFT.

    + +
    +
    + +

    ◆ sbgEcomLogUtcGetClockStatusAsString()

    + +
    +
    + + + + + + + + +
    const char * sbgEcomLogUtcGetClockStatusAsString (const SbgLogUtcDatapLogUtc)
    +
    +

    Returns the clock status as a NULL terminated C string.

    +
    Parameters
    + + +
    [in]pLogUtcUTC log instance.
    +
    +
    +
    Returns
    The clock status as a C string.
    + +
    +
    + +

    ◆ sbgEcomLogUtcGetUtcStatusAsString()

    + +
    +
    + + + + + + + + +
    const char * sbgEcomLogUtcGetUtcStatusAsString (const SbgLogUtcDatapLogUtc)
    +
    +

    Returns the UTC status as a NULL terminated C string.

    +
    Parameters
    + + +
    [in]pLogUtcUTC log instance.
    +
    +
    +
    Returns
    The UTC status as a C string.
    + +
    +
    + +

    ◆ sbgEComBinaryLogParseUtcData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogParseUtcData (SbgStreamBuffer * pInputStream,
    SbgLogUtcDatapOutputData 
    )
    +
    +

    Parse data for the SBG_ECOM_LOG_UTC_DATA message and fill the corresponding structure.

    +
    Parameters
    + + + +
    [in]pInputStreamInput stream buffer to read the payload from.
    [out]pOutputDataPointer on the output structure that stores parsed data.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the payload has been parsed.
    + +
    +
    + +

    ◆ sbgEComBinaryLogWriteUtcData()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogWriteUtcData (SbgStreamBuffer * pOutputStream,
    const SbgLogUtcDatapInputData 
    )
    +
    +

    Write data for the SBG_ECOM_LOG_UTC_DATA message to the output stream buffer from the provided structure.

    +
    Parameters
    + + + +
    [out]pOutputStreamOutput stream buffer to write the payload to.
    [in]pInputDataPointer on the input structure that stores data to write.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the message has been generated in the provided buffer.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_log_utc_8h_source.html b/doc/html/sbg_e_com_binary_log_utc_8h_source.html new file mode 100644 index 0000000..05b3807 --- /dev/null +++ b/doc/html/sbg_e_com_binary_log_utc_8h_source.html @@ -0,0 +1,185 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogUtc.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComBinaryLogUtc.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_BINARY_LOG_UTC_H
    +
    33#define SBG_ECOM_BINARY_LOG_UTC_H
    +
    34
    +
    35// sbgCommonLib headers
    +
    36#include <sbgCommon.h>
    +
    37#include <streamBuffer/sbgStreamBuffer.h>
    +
    38
    +
    39#ifdef __cplusplus
    +
    40extern "C" {
    +
    41#endif
    +
    42
    +
    43//----------------------------------------------------------------------//
    +
    44//- Clock status definitions -//
    +
    45//----------------------------------------------------------------------//
    +
    46
    +
    50#define SBG_ECOM_CLOCK_STATUS_SHIFT (1u)
    +
    51#define SBG_ECOM_CLOCK_STATUS_MASK (0x000Fu)
    +
    52#define SBG_ECOM_CLOCK_UTC_STATUS_SHIFT (6u)
    +
    53#define SBG_ECOM_CLOCK_UTC_STATUS_MASK (0x000Fu)
    +
    58#define SBG_ECOM_CLOCK_STABLE_INPUT (0x0001u << 0)
    +
    59#define SBG_ECOM_CLOCK_UTC_SYNC (0x0001u << 5)
    + +
    65{
    + + + + + +
    71
    + +
    76{
    + + + + +
    81
    +
    82//----------------------------------------------------------------------//
    +
    83//- Clock status helpers methods -//
    +
    84//----------------------------------------------------------------------//
    +
    85
    + +
    93{
    + +
    95}
    +
    96
    + +
    104{
    + +
    106}
    +
    107
    +
    116SBG_INLINE uint16_t sbgEComLogUtcBuildClockStatus(SbgEComClockStatus clockStatus, SbgEComClockUtcStatus utcStatus, uint16_t masks)
    +
    117{
    +
    118 //
    +
    119 // Create the combined status field
    +
    120 //
    +
    121 return ((((uint16_t)clockStatus)&SBG_ECOM_CLOCK_STATUS_MASK) << SBG_ECOM_CLOCK_STATUS_SHIFT) |
    +
    122 ((((uint16_t)utcStatus)&SBG_ECOM_CLOCK_UTC_STATUS_MASK) << SBG_ECOM_CLOCK_UTC_STATUS_SHIFT) | masks;
    +
    123}
    +
    124
    +
    125//----------------------------------------------------------------------//
    +
    126//- Log structure definitions -//
    +
    127//----------------------------------------------------------------------//
    +
    128
    +
    132typedef struct _SbgLogUtcData
    +
    133{
    +
    134 uint32_t timeStamp;
    +
    135 uint16_t status;
    +
    136 uint16_t year;
    +
    137 int8_t month;
    +
    138 int8_t day;
    +
    139 int8_t hour;
    +
    140 int8_t minute;
    +
    141 int8_t second;
    +
    142 int32_t nanoSecond;
    +
    143 uint32_t gpsTimeOfWeek;
    + +
    145
    +
    146//----------------------------------------------------------------------//
    +
    147//- Public methods -//
    +
    148//----------------------------------------------------------------------//
    +
    149
    + +
    157
    +
    158
    + +
    166
    +
    174SbgErrorCode sbgEComBinaryLogParseUtcData(SbgStreamBuffer *pInputStream, SbgLogUtcData *pOutputData);
    +
    175
    +
    183SbgErrorCode sbgEComBinaryLogWriteUtcData(SbgStreamBuffer *pOutputStream, const SbgLogUtcData *pInputData);
    +
    184
    +
    185#ifdef __cplusplus
    +
    186}
    +
    187#endif
    +
    188
    +
    189#endif // SBG_ECOM_BINARY_LOG_UTC_H
    +
    const char * sbgEcomLogUtcGetClockStatusAsString(const SbgLogUtcData *pLogUtc)
    +
    SbgErrorCode sbgEComBinaryLogParseUtcData(SbgStreamBuffer *pInputStream, SbgLogUtcData *pOutputData)
    +
    #define SBG_ECOM_CLOCK_UTC_STATUS_SHIFT
    Definition: sbgEComBinaryLogUtc.h:52
    +
    const char * sbgEcomLogUtcGetUtcStatusAsString(const SbgLogUtcData *pLogUtc)
    +
    SbgErrorCode sbgEComBinaryLogWriteUtcData(SbgStreamBuffer *pOutputStream, const SbgLogUtcData *pInputData)
    +
    enum _SbgEComClockStatus SbgEComClockStatus
    +
    #define SBG_ECOM_CLOCK_STATUS_SHIFT
    Definition: sbgEComBinaryLogUtc.h:50
    +
    SBG_INLINE SbgEComClockUtcStatus sbgEComLogUtcGetClockUtcStatus(uint16_t status)
    Definition: sbgEComBinaryLogUtc.h:103
    +
    struct _SbgLogUtcData SbgLogUtcData
    +
    #define SBG_ECOM_CLOCK_UTC_STATUS_MASK
    Definition: sbgEComBinaryLogUtc.h:53
    +
    _SbgEComClockStatus
    Definition: sbgEComBinaryLogUtc.h:65
    +
    @ SBG_ECOM_CLOCK_VALID
    Definition: sbgEComBinaryLogUtc.h:69
    +
    @ SBG_ECOM_CLOCK_FREE_RUNNING
    Definition: sbgEComBinaryLogUtc.h:67
    +
    @ SBG_ECOM_CLOCK_ERROR
    Definition: sbgEComBinaryLogUtc.h:66
    +
    @ SBG_ECOM_CLOCK_STEERING
    Definition: sbgEComBinaryLogUtc.h:68
    +
    SBG_INLINE SbgEComClockStatus sbgEComLogUtcGetClockStatus(uint16_t status)
    Definition: sbgEComBinaryLogUtc.h:92
    +
    #define SBG_ECOM_CLOCK_STATUS_MASK
    Definition: sbgEComBinaryLogUtc.h:51
    +
    SBG_INLINE uint16_t sbgEComLogUtcBuildClockStatus(SbgEComClockStatus clockStatus, SbgEComClockUtcStatus utcStatus, uint16_t masks)
    Definition: sbgEComBinaryLogUtc.h:116
    +
    enum _SbgEComClockUtcStatus SbgEComClockUtcStatus
    +
    _SbgEComClockUtcStatus
    Definition: sbgEComBinaryLogUtc.h:76
    +
    @ SBG_ECOM_UTC_VALID
    Definition: sbgEComBinaryLogUtc.h:79
    +
    @ SBG_ECOM_UTC_INVALID
    Definition: sbgEComBinaryLogUtc.h:77
    +
    @ SBG_ECOM_UTC_NO_LEAP_SEC
    Definition: sbgEComBinaryLogUtc.h:78
    +
    Definition: sbgEComBinaryLogUtc.h:133
    +
    uint16_t year
    Definition: sbgEComBinaryLogUtc.h:136
    +
    int8_t hour
    Definition: sbgEComBinaryLogUtc.h:139
    +
    uint16_t status
    Definition: sbgEComBinaryLogUtc.h:135
    +
    uint32_t timeStamp
    Definition: sbgEComBinaryLogUtc.h:134
    +
    uint32_t gpsTimeOfWeek
    Definition: sbgEComBinaryLogUtc.h:143
    +
    int32_t nanoSecond
    Definition: sbgEComBinaryLogUtc.h:142
    +
    int8_t day
    Definition: sbgEComBinaryLogUtc.h:138
    +
    int8_t second
    Definition: sbgEComBinaryLogUtc.h:141
    +
    int8_t month
    Definition: sbgEComBinaryLogUtc.h:137
    +
    int8_t minute
    Definition: sbgEComBinaryLogUtc.h:140
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_logs_8h.html b/doc/html/sbg_e_com_binary_logs_8h.html new file mode 100644 index 0000000..cca5843 --- /dev/null +++ b/doc/html/sbg_e_com_binary_logs_8h.html @@ -0,0 +1,183 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogs.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComBinaryLogs.h File Reference
    +
    +
    + +

    Parse incoming sbgECom logs and store result in an union. +More...

    + +

    Go to the source code of this file.

    + + + + +

    +Data Structures

    union  _SbgBinaryLogData
     
    + + + +

    +Typedefs

    typedef union _SbgBinaryLogData SbgBinaryLogData
     
    + + + +

    +Functions

    SbgErrorCode sbgEComBinaryLogParse (SbgEComClass msgClass, SbgEComMsgId msg, const void *pPayload, size_t payloadSize, SbgBinaryLogData *pOutputData)
     
    +

    Detailed Description

    +

    Parse incoming sbgECom logs and store result in an union.

    +
    Author
    SBG Systems
    +
    Date
    06 February 2013
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Typedef Documentation

    + +

    ◆ SbgBinaryLogData

    + +
    +
    + + + + +
    typedef union _SbgBinaryLogData SbgBinaryLogData
    +
    +

    Union used to store received logs data.

    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgEComBinaryLogParse()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComBinaryLogParse (SbgEComClass msgClass,
    SbgEComMsgId msg,
    const void * pPayload,
    size_t payloadSize,
    SbgBinaryLogDatapOutputData 
    )
    +
    +

    Parse an incoming log and fill the output union.

    +
    Parameters
    + + + + + + +
    [in]msgClassReceived message class
    [in]msgReceived message ID
    [in]pPayloadRead only pointer on the payload buffer.
    [in]payloadSizePayload size in bytes.
    [out]pOutputDataPointer on the output union that stores parsed data.
    +
    +
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_binary_logs_8h_source.html b/doc/html/sbg_e_com_binary_logs_8h_source.html new file mode 100644 index 0000000..956f414 --- /dev/null +++ b/doc/html/sbg_e_com_binary_logs_8h_source.html @@ -0,0 +1,197 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/binaryLogs/sbgEComBinaryLogs.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComBinaryLogs.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_BINARY_LOGS_H
    +
    33#define SBG_ECOM_BINARY_LOGS_H
    +
    34
    +
    35 // sbgCommonLib headers
    +
    36#include <sbgCommon.h>
    +
    37
    +
    38// Project headers
    +
    39#include <sbgEComIds.h>
    +
    40
    +
    41// Local headers
    + + + +
    45#include "sbgEComBinaryLogDvl.h"
    +
    46#include "sbgEComBinaryLogEkf.h"
    + +
    48#include "sbgEComBinaryLogGps.h"
    +
    49#include "sbgEComBinaryLogImu.h"
    +
    50#include "sbgEComBinaryLogMag.h"
    + + + + + + +
    57#include "sbgEComBinaryLogUtc.h"
    +
    58
    +
    59#ifdef __cplusplus
    +
    60extern "C" {
    +
    61#endif
    +
    62
    +
    63//----------------------------------------------------------------------//
    +
    64//- Log structure definitions -//
    +
    65//----------------------------------------------------------------------//
    +
    66
    +
    70typedef union _SbgBinaryLogData
    +
    71{
    + + + + + + + + + + + + + + + + + + + + + + +
    95 /* Fast logs */
    + + +
    99
    +
    100//----------------------------------------------------------------------//
    +
    101//- Public methods -//
    +
    102//----------------------------------------------------------------------//
    +
    103
    +
    113SbgErrorCode sbgEComBinaryLogParse(SbgEComClass msgClass, SbgEComMsgId msg, const void *pPayload, size_t payloadSize, SbgBinaryLogData *pOutputData);
    +
    114
    +
    115#ifdef __cplusplus
    +
    116}
    +
    117#endif
    +
    118
    +
    119#endif // SBG_ECOM_BINARY_LOGS_H
    +
    Parse received air data measurement logs such as barometer data.
    +
    Parse received subsea depth measurement logs.
    +
    Parse diagnostic logs emitted by the device.
    +
    Parse received DVL (Doppler Velocity Logger) measurement logs.
    +
    Parse EKF measurements such as attitude, position and velocity logs.
    +
    Parse event markers logs used to timestamp external signals.
    +
    Parse received GNSS logs such as Position, Velocity and True Heading.
    +
    Parse IMU (Inertial Measurement Unit) measurement logs.
    +
    Parse magnetic field measurements logs.
    +
    Parse recevied odometer/DMI velocity measurement logs.
    +
    Parse logs used to store a binary stream such as RAW GNSS data.
    +
    Parse RTCM data stream logs as received by the INS.
    +
    Parse logs that returns ship motion values such as heave.
    +
    Parse logs used to report device status.
    +
    Parse received USBL position mesurements logs.
    +
    Parse logs used to report device UTC time.
    +
    SbgErrorCode sbgEComBinaryLogParse(SbgEComClass msgClass, SbgEComMsgId msg, const void *pPayload, size_t payloadSize, SbgBinaryLogData *pOutputData)
    +
    union _SbgBinaryLogData SbgBinaryLogData
    +
    Defines all sbgECom commands identifiers.
    +
    uint8_t SbgEComMsgId
    Definition: sbgEComIds.h:303
    +
    enum _SbgEComClass SbgEComClass
    +
    Definition: sbgEComBinaryLogAirData.h:68
    +
    Definition: sbgEComBinaryLogDepth.h:64
    +
    Definition: sbgEComBinaryLogDiag.h:63
    +
    Definition: sbgEComBinaryLogDvl.h:61
    +
    Definition: sbgEComBinaryLogEkf.h:131
    +
    Definition: sbgEComBinaryLogEkf.h:153
    +
    Definition: sbgEComBinaryLogEkf.h:142
    +
    Definition: sbgEComBinaryLogEvent.h:64
    +
    Definition: sbgEComBinaryLogImu.h:99
    +
    Definition: sbgEComBinaryLogGps.h:341
    +
    Definition: sbgEComBinaryLogGps.h:321
    +
    Definition: sbgEComBinaryLogGps.h:307
    +
    Definition: sbgEComBinaryLogImu.h:72
    +
    Definition: sbgEComBinaryLogImu.h:87
    +
    Definition: sbgEComBinaryLogMag.h:82
    +
    Definition: sbgEComBinaryLogMag.h:71
    +
    Definition: sbgEComBinaryLogOdometer.h:61
    +
    Definition: sbgEComBinaryLogRawData.h:57
    +
    Definition: sbgEComBinaryLogShipMotion.h:66
    +
    Definition: sbgEComBinaryLogStatus.h:134
    +
    Definition: sbgEComBinaryLogUsbl.h:64
    +
    Definition: sbgEComBinaryLogUtc.h:133
    +
    Definition: sbgEComBinaryLogs.h:71
    +
    SbgLogAirData airData
    Definition: sbgEComBinaryLogs.h:89
    +
    SbgLogEvent eventMarker
    Definition: sbgEComBinaryLogs.h:92
    +
    SbgLogImuShort imuShort
    Definition: sbgEComBinaryLogs.h:74
    +
    SbgLogImuData imuData
    Definition: sbgEComBinaryLogs.h:73
    +
    SbgLogStatusData statusData
    Definition: sbgEComBinaryLogs.h:72
    +
    SbgLogGpsVel gpsVelData
    Definition: sbgEComBinaryLogs.h:82
    +
    SbgLogGpsPos gpsPosData
    Definition: sbgEComBinaryLogs.h:81
    +
    SbgLogEkfNavData ekfNavData
    Definition: sbgEComBinaryLogs.h:77
    +
    SbgLogDepth depthData
    Definition: sbgEComBinaryLogs.h:91
    +
    SbgLogOdometerData odometerData
    Definition: sbgEComBinaryLogs.h:79
    +
    SbgLogUsblData usblData
    Definition: sbgEComBinaryLogs.h:90
    +
    SbgLogDiagData diagData
    Definition: sbgEComBinaryLogs.h:93
    +
    SbgLogEkfQuatData ekfQuatData
    Definition: sbgEComBinaryLogs.h:76
    +
    SbgLogMag magData
    Definition: sbgEComBinaryLogs.h:86
    +
    SbgLogMagCalib magCalibData
    Definition: sbgEComBinaryLogs.h:87
    +
    SbgLogDvlData dvlData
    Definition: sbgEComBinaryLogs.h:88
    +
    SbgLogGpsHdt gpsHdtData
    Definition: sbgEComBinaryLogs.h:83
    +
    SbgLogShipMotionData shipMotionData
    Definition: sbgEComBinaryLogs.h:78
    +
    SbgLogEkfEulerData ekfEulerData
    Definition: sbgEComBinaryLogs.h:75
    +
    SbgLogFastImuData fastImuData
    Definition: sbgEComBinaryLogs.h:96
    +
    SbgLogRawData rtcmRawData
    Definition: sbgEComBinaryLogs.h:85
    +
    SbgLogRawData gpsRawData
    Definition: sbgEComBinaryLogs.h:84
    +
    SbgLogUtcData utcData
    Definition: sbgEComBinaryLogs.h:80
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_8h.html b/doc/html/sbg_e_com_cmd_8h.html new file mode 100644 index 0000000..a5a22a1 --- /dev/null +++ b/doc/html/sbg_e_com_cmd_8h.html @@ -0,0 +1,88 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmd.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComCmd.h File Reference
    +
    +
    + +

    Include all available sbgECom commands. +More...

    +
    #include <sbgCommon.h>
    +#include "sbgEComCmdAdvanced.h"
    +#include "sbgEComCmdAirData.h"
    +#include "sbgEComCmdApi.h"
    +#include "sbgEComCmdDvl.h"
    +#include "sbgEComCmdEthernet.h"
    +#include "sbgEComCmdEvent.h"
    +#include "sbgEComCmdFeatures.h"
    +#include "sbgEComCmdGnss.h"
    +#include "sbgEComCmdInfo.h"
    +#include "sbgEComCmdInterface.h"
    +#include "sbgEComCmdLicense.h"
    +#include "sbgEComCmdMag.h"
    +#include "sbgEComCmdOdo.h"
    +#include "sbgEComCmdOutput.h"
    +#include "sbgEComCmdSensor.h"
    +#include "sbgEComCmdSettings.h"
    +
    +

    Go to the source code of this file.

    +

    Detailed Description

    +

    Include all available sbgECom commands.

    +
    Author
    SBG Systems
    +
    Date
    16 June 2014
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_8h_source.html b/doc/html/sbg_e_com_cmd_8h_source.html new file mode 100644 index 0000000..3edd652 --- /dev/null +++ b/doc/html/sbg_e_com_cmd_8h_source.html @@ -0,0 +1,97 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmd.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComCmd.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_CMD_H
    +
    33#define SBG_ECOM_CMD_H
    +
    34
    +
    35// sbgCommonLib headers
    +
    36#include <sbgCommon.h>
    +
    37
    +
    38// Local headers
    +
    39#include "sbgEComCmdAdvanced.h"
    +
    40#include "sbgEComCmdAirData.h"
    +
    41#include "sbgEComCmdApi.h"
    +
    42#include "sbgEComCmdDvl.h"
    +
    43#include "sbgEComCmdEthernet.h"
    +
    44#include "sbgEComCmdEvent.h"
    +
    45#include "sbgEComCmdFeatures.h"
    +
    46#include "sbgEComCmdGnss.h"
    +
    47#include "sbgEComCmdInfo.h"
    +
    48#include "sbgEComCmdInterface.h"
    +
    49#include "sbgEComCmdLicense.h"
    +
    50#include "sbgEComCmdMag.h"
    +
    51#include "sbgEComCmdOdo.h"
    +
    52#include "sbgEComCmdOutput.h"
    +
    53#include "sbgEComCmdSensor.h"
    +
    54#include "sbgEComCmdSettings.h"
    +
    55
    +
    56#endif // SBG_ECOM_CMD_H
    +
    Advanced settings related commands.
    +
    AirData aiding module configuration commands.
    +
    REST API related commands.
    +
    DVL (Doppler Velocity Logger) aiding module configuration commands.
    +
    Ethernet configuration related commands.
    +
    Input/output event markers configuration commands.
    +
    Commands used to query supported device features.
    +
    GNSS aiding module configuration commands.
    +
    Commands used to query the device information.
    +
    Commands used to configure device serial, CAN and Ethernet interfaces.
    +
    Command used to upload and apply an activation license.
    +
    Magnetometer aiding module configuration & onboard magnetic calibration commands.
    +
    Odometer / DMI aiding module configuration commands.
    +
    Commands used to setup logs to output over the device interfaces.
    +
    Motion profile, aiding assignement & sensor installation commands.
    +
    Import/export/save settings commands.
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_advanced_8h.html b/doc/html/sbg_e_com_cmd_advanced_8h.html new file mode 100644 index 0000000..de9ca3a --- /dev/null +++ b/doc/html/sbg_e_com_cmd_advanced_8h.html @@ -0,0 +1,393 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdAdvanced.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComCmdAdvanced.h File Reference
    +
    +
    + +

    Advanced settings related commands. +More...

    +
    #include <sbgCommon.h>
    +#include <sbgECom.h>
    +
    +

    Go to the source code of this file.

    + + + + + + +

    +Data Structures

    struct  _SbgEComAdvancedConf
     
    struct  _SbgEComValidityThresholds
     
    + + + + + + + +

    +Macros

    #define SBG_ECOM_GNSS_OPT_01   (uint32_t)(0x00000001 << 0)
     
    #define SBG_ECOM_NMEA_OPT_MODE_STD   (uint32_t)(0x00000001 << 0)
     
    #define SBG_ECOM_NMEA_OPT_FORCE_UTC   (uint32_t)(0x00000001 << 4)
     
    + + + + + + + +

    +Typedefs

    typedef enum _SbgEComTimeReferenceSrc SbgEComTimeReferenceSrc
     
    typedef struct _SbgEComAdvancedConf SbgEComAdvancedConf
     
    typedef struct _SbgEComValidityThresholds SbgEComValidityThresholds
     
    + + + +

    +Enumerations

    enum  _SbgEComTimeReferenceSrc {
    +  SBG_ECOM_TIME_REF_DISABLED = 0 +,
    +  SBG_ECOM_TIME_REF_SYNC_IN_A +,
    +  SBG_ECOM_TIME_REF_UTC_GPS_1 +
    + }
     
    + + + + + + + + + +

    +Functions

    SbgErrorCode sbgEComCmdAdvancedGetConf (SbgEComHandle *pHandle, SbgEComAdvancedConf *pConf)
     
    SbgErrorCode sbgEComCmdAdvancedSetConf (SbgEComHandle *pHandle, const SbgEComAdvancedConf *pConf)
     
    SbgErrorCode sbgEComCmdAdvancedGetThresholds (SbgEComHandle *pHandle, SbgEComValidityThresholds *pConf)
     
    SbgErrorCode sbgEComCmdAdvancedSetThresholds (SbgEComHandle *pHandle, const SbgEComValidityThresholds *pConf)
     
    +

    Detailed Description

    +

    Advanced settings related commands.

    +
    Author
    SBG Systems
    +
    Date
    11 June 2014
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Macro Definition Documentation

    + +

    ◆ SBG_ECOM_GNSS_OPT_01

    + +
    +
    + + + + +
    #define SBG_ECOM_GNSS_OPT_01   (uint32_t)(0x00000001 << 0)
    +
    +

    List all options for the GNSS bitmask options Reserved advanced GNSS option for ELLIPSE-N/D v3

    + +
    +
    + +

    ◆ SBG_ECOM_NMEA_OPT_MODE_STD

    + +
    +
    + + + + +
    #define SBG_ECOM_NMEA_OPT_MODE_STD   (uint32_t)(0x00000001 << 0)
    +
    +

    List all options for the NMEA bitmask options Output NMEA messages that complies with 82 chars limit

    + +
    +
    + +

    ◆ SBG_ECOM_NMEA_OPT_FORCE_UTC

    + +
    +
    + + + + +
    #define SBG_ECOM_NMEA_OPT_FORCE_UTC   (uint32_t)(0x00000001 << 4)
    +
    +

    Always output time in NMEA messages even if invalid

    + +
    +
    +

    Typedef Documentation

    + +

    ◆ SbgEComTimeReferenceSrc

    + +
    +
    +

    List of available time reference source.

    + +
    +
    + +

    ◆ SbgEComAdvancedConf

    + +
    +
    + + + + +
    typedef struct _SbgEComAdvancedConf SbgEComAdvancedConf
    +
    +

    Structure containing all the info for advanced configuration.

    + +
    +
    + +

    ◆ SbgEComValidityThresholds

    + +
    +
    +

    Structure containing all validity thresholds (status outputs) Setting these thresholds to 0.0 will keep default configuration

    + +
    +
    +

    Enumeration Type Documentation

    + +

    ◆ _SbgEComTimeReferenceSrc

    + +
    +
    + + + + +
    enum _SbgEComTimeReferenceSrc
    +
    +

    List of available time reference source.

    + + + + +
    Enumerator
    SBG_ECOM_TIME_REF_DISABLED 

    The device is running it's internal clock without any time reference.

    +
    SBG_ECOM_TIME_REF_SYNC_IN_A 

    The main port sync in A is used as a time reference.

    +
    SBG_ECOM_TIME_REF_UTC_GPS_1 

    The GPS 1 module is used to provide both time reference and UTC data.

    +
    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgEComCmdAdvancedGetConf()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdAdvancedGetConf (SbgEComHandlepHandle,
    SbgEComAdvancedConfpConf 
    )
    +
    +

    Retrieve the advanced configurations.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [out]pConfPointer to a SbgEComAdvancedConf to contain the current configuration.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdAdvancedSetConf()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdAdvancedSetConf (SbgEComHandlepHandle,
    const SbgEComAdvancedConfpConf 
    )
    +
    +

    Set the advanced configurations.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [in]pConfPointer to a SbgEComAdvancedConf that contains the new configuration.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdAdvancedGetThresholds()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdAdvancedGetThresholds (SbgEComHandlepHandle,
    SbgEComValidityThresholdspConf 
    )
    +
    +

    Retrieve the current validity thresholds

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [out]pConfPointer to a SbgEComValidityThresholds to contain the current configuration.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdAdvancedSetThresholds()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdAdvancedSetThresholds (SbgEComHandlepHandle,
    const SbgEComValidityThresholdspConf 
    )
    +
    +

    Set the validity thresholds

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [in]pConfPointer to a SbgEComValidityThresholds that contains the new configuration.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_advanced_8h_source.html b/doc/html/sbg_e_com_cmd_advanced_8h_source.html new file mode 100644 index 0000000..42f94a5 --- /dev/null +++ b/doc/html/sbg_e_com_cmd_advanced_8h_source.html @@ -0,0 +1,141 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdAdvanced.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComCmdAdvanced.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_CMD_ADVANCED_H
    +
    33#define SBG_ECOM_CMD_ADVANCED_H
    +
    34
    +
    35// sbgCommonLib headers
    +
    36#include <sbgCommon.h>
    +
    37
    +
    38// Project headers
    +
    39#include <sbgECom.h>
    +
    40
    +
    41#ifdef __cplusplus
    +
    42extern "C" {
    +
    43#endif
    +
    44
    +
    45//----------------------------------------------------------------------//
    +
    46//- Advanced definitions -//
    +
    47//----------------------------------------------------------------------//
    +
    48
    + +
    53{
    + + + + +
    58
    +
    62#define SBG_ECOM_GNSS_OPT_01 (uint32_t)(0x00000001 << 0)
    +
    67#define SBG_ECOM_NMEA_OPT_MODE_STD (uint32_t)(0x00000001 << 0)
    +
    68#define SBG_ECOM_NMEA_OPT_FORCE_UTC (uint32_t)(0x00000001 << 4)
    +
    70//----------------------------------------------------------------------//
    +
    71//- Advanced configurations -//
    +
    72//----------------------------------------------------------------------//
    +
    73
    + +
    78{
    + +
    80 uint32_t gnssOptions;
    +
    81 uint32_t nmeaOptions;
    + +
    83
    + +
    89{
    + + + + + +
    95
    +
    96//----------------------------------------------------------------------//
    +
    97//- Public methods -//
    +
    98//----------------------------------------------------------------------//
    +
    99
    + +
    108
    + +
    117
    + +
    127
    + +
    136
    +
    137#ifdef __cplusplus
    +
    138}
    +
    139#endif
    +
    140
    +
    141#endif // SBG_ECOM_CMD_ADVANCED_H
    +
    Contains main sbgECom methods.
    +
    enum _SbgEComTimeReferenceSrc SbgEComTimeReferenceSrc
    +
    SbgErrorCode sbgEComCmdAdvancedGetConf(SbgEComHandle *pHandle, SbgEComAdvancedConf *pConf)
    +
    _SbgEComTimeReferenceSrc
    Definition: sbgEComCmdAdvanced.h:53
    +
    @ SBG_ECOM_TIME_REF_UTC_GPS_1
    Definition: sbgEComCmdAdvanced.h:56
    +
    @ SBG_ECOM_TIME_REF_SYNC_IN_A
    Definition: sbgEComCmdAdvanced.h:55
    +
    @ SBG_ECOM_TIME_REF_DISABLED
    Definition: sbgEComCmdAdvanced.h:54
    +
    struct _SbgEComAdvancedConf SbgEComAdvancedConf
    +
    struct _SbgEComValidityThresholds SbgEComValidityThresholds
    +
    SbgErrorCode sbgEComCmdAdvancedGetThresholds(SbgEComHandle *pHandle, SbgEComValidityThresholds *pConf)
    +
    SbgErrorCode sbgEComCmdAdvancedSetThresholds(SbgEComHandle *pHandle, const SbgEComValidityThresholds *pConf)
    +
    SbgErrorCode sbgEComCmdAdvancedSetConf(SbgEComHandle *pHandle, const SbgEComAdvancedConf *pConf)
    +
    Definition: sbgEComCmdAdvanced.h:78
    +
    uint32_t nmeaOptions
    Definition: sbgEComCmdAdvanced.h:81
    +
    uint32_t gnssOptions
    Definition: sbgEComCmdAdvanced.h:80
    +
    SbgEComTimeReferenceSrc timeReference
    Definition: sbgEComCmdAdvanced.h:79
    +
    Definition: sbgECom.h:81
    +
    Definition: sbgEComCmdAdvanced.h:89
    +
    float attitudeThreshold
    Definition: sbgEComCmdAdvanced.h:92
    +
    float positionThreshold
    Definition: sbgEComCmdAdvanced.h:90
    +
    float velocityThreshold
    Definition: sbgEComCmdAdvanced.h:91
    +
    float headingThreshold
    Definition: sbgEComCmdAdvanced.h:93
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_air_data_8h.html b/doc/html/sbg_e_com_cmd_air_data_8h.html new file mode 100644 index 0000000..4567c95 --- /dev/null +++ b/doc/html/sbg_e_com_cmd_air_data_8h.html @@ -0,0 +1,397 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdAirData.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComCmdAirData.h File Reference
    +
    +
    + +

    AirData aiding module configuration commands. +More...

    +
    #include <sbgCommon.h>
    +#include <sbgECom.h>
    +#include "sbgEComCmdCommon.h"
    +
    +

    Go to the source code of this file.

    + + + + +

    +Data Structures

    struct  _SbgEComAirDataRejectionConf
     
    + + + + + +

    +Typedefs

    typedef enum _SbgEComAirDataModelsIds SbgEComAirDataModelsIds
     
    typedef struct _SbgEComAirDataRejectionConf SbgEComAirDataRejectionConf
     
    + + + +

    +Enumerations

    enum  _SbgEComAirDataModelsIds {
    +  SBG_ECOM_AIR_DATA_MODEL_INTERNAL = 1 +,
    +  SBG_ECOM_AIR_DATA_MODEL_GENERIC_ECOM = 2 +,
    +  SBG_ECOM_AIR_DATA_MODEL_AHRS_500 = 3 +
    + }
     
    + + + + + + + + + + + + + +

    +Functions

    SbgErrorCode sbgEComCmdAirDataSetModelId (SbgEComHandle *pHandle, SbgEComAirDataModelsIds modelId)
     
    SbgErrorCode sbgEComCmdAirDataGetModelId (SbgEComHandle *pHandle, SbgEComAirDataModelsIds *pModelId)
     
    SbgErrorCode sbgEComCmdAirDataSetLeverArm (SbgEComHandle *pHandle, const float *pLeverArm)
     
    SbgErrorCode sbgEComCmdAirDataGetLeverArm (SbgEComHandle *pHandle, float *pLeverArm)
     
    SbgErrorCode sbgEComCmdAirDataSetRejection (SbgEComHandle *pHandle, const SbgEComAirDataRejectionConf *pRejectConf)
     
    SbgErrorCode sbgEComCmdAirDataGetRejection (SbgEComHandle *pHandle, SbgEComAirDataRejectionConf *pRejectConf)
     
    +

    Detailed Description

    +

    AirData aiding module configuration commands.

    +
    Author
    SBG Systems
    +
    Date
    18 February 2019
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Typedef Documentation

    + +

    ◆ SbgEComAirDataModelsIds

    + +
    +
    +

    This enum defines the different AirData model IDs available in standard

    + +
    +
    + +

    ◆ SbgEComAirDataRejectionConf

    + +
    +
    +

    Holds all necessary information for AirData module data rejection.

    + +
    +
    +

    Enumeration Type Documentation

    + +

    ◆ _SbgEComAirDataModelsIds

    + +
    +
    + + + + +
    enum _SbgEComAirDataModelsIds
    +
    +

    This enum defines the different AirData model IDs available in standard

    + + + + +
    Enumerator
    SBG_ECOM_AIR_DATA_MODEL_INTERNAL 

    Use the internal barometer sensor if available.

    +
    SBG_ECOM_AIR_DATA_MODEL_GENERIC_ECOM 

    Generic AirData model using sbgECom input protocol format.

    +
    SBG_ECOM_AIR_DATA_MODEL_AHRS_500 

    Crossbow AHRS-500 compatible input for barometric altitude and airspeed.

    +
    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgEComCmdAirDataSetModelId()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdAirDataSetModelId (SbgEComHandlepHandle,
    SbgEComAirDataModelsIds modelId 
    )
    +
    +

    Set the AirData model to use that both defines the protocol as well as the associated error model.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [in]modelIdAirData model ID to set
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdAirDataGetModelId()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdAirDataGetModelId (SbgEComHandlepHandle,
    SbgEComAirDataModelsIdspModelId 
    )
    +
    +

    Retrieve the AirData model id currently in use by the device.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [out]pModelIdReturns the AirData model ID currently in use by the device.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdAirDataSetLeverArm()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdAirDataSetLeverArm (SbgEComHandlepHandle,
    const float * pLeverArm 
    )
    +
    +

    Set the lever arm configuration of the AirData module.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [in]pLeverArmThe X, Y, Z airspeed sensor lever arm in meters from the pitot sensor to the IMU.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdAirDataGetLeverArm()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdAirDataGetLeverArm (SbgEComHandlepHandle,
    float * pLeverArm 
    )
    +
    +

    Retrieve the lever arm configuration of the AirData module.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [out]pLeverArmReturns the airspeed sensor X,Y,Z lever arm in meters from the pitot sensor to the IMU.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdAirDataSetRejection()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdAirDataSetRejection (SbgEComHandlepHandle,
    const SbgEComAirDataRejectionConfpRejectConf 
    )
    +
    +

    Set the rejection configuration of the AirData module (this command doesn't need a reboot to be applied)

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [out]pRejectConfThe new rejection configuration to set.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdAirDataGetRejection()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdAirDataGetRejection (SbgEComHandlepHandle,
    SbgEComAirDataRejectionConfpRejectConf 
    )
    +
    +

    Retrieve the current rejection configuration of the AirData module.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [out]pRejectConfReturn the rejection configuration currently in use.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_air_data_8h_source.html b/doc/html/sbg_e_com_cmd_air_data_8h_source.html new file mode 100644 index 0000000..49259aa --- /dev/null +++ b/doc/html/sbg_e_com_cmd_air_data_8h_source.html @@ -0,0 +1,129 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdAirData.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComCmdAirData.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_CMD_AIR_DATA_H
    +
    33#define SBG_ECOM_CMD_AIR_DATA_H
    +
    34
    +
    35// sbgCommonLib headers
    +
    36#include <sbgCommon.h>
    +
    37
    +
    38// Project headers
    +
    39#include <sbgECom.h>
    +
    40
    +
    41// Local headers
    +
    42#include "sbgEComCmdCommon.h"
    +
    43
    +
    44#ifdef __cplusplus
    +
    45extern "C" {
    +
    46#endif
    +
    47
    +
    48//----------------------------------------------------------------------//
    +
    49//- Public definitions -//
    +
    50//----------------------------------------------------------------------//
    +
    51
    + +
    56{
    + + + + +
    61
    + +
    66{
    + + + +
    70
    +
    71//----------------------------------------------------------------------//
    +
    72//- Public methods -//
    +
    73//----------------------------------------------------------------------//
    +
    74
    + +
    83
    + +
    92
    +
    100SbgErrorCode sbgEComCmdAirDataSetLeverArm(SbgEComHandle *pHandle, const float *pLeverArm);
    +
    101
    +
    109SbgErrorCode sbgEComCmdAirDataGetLeverArm(SbgEComHandle *pHandle, float *pLeverArm);
    +
    110
    + +
    119
    + +
    128
    +
    129#ifdef __cplusplus
    +
    130}
    +
    131#endif
    +
    132
    +
    133#endif // SBG_ECOM_CMD_AIR_DATA_H
    +
    Contains main sbgECom methods.
    +
    SbgErrorCode sbgEComCmdAirDataGetLeverArm(SbgEComHandle *pHandle, float *pLeverArm)
    +
    SbgErrorCode sbgEComCmdAirDataSetModelId(SbgEComHandle *pHandle, SbgEComAirDataModelsIds modelId)
    +
    enum _SbgEComAirDataModelsIds SbgEComAirDataModelsIds
    +
    struct _SbgEComAirDataRejectionConf SbgEComAirDataRejectionConf
    +
    SbgErrorCode sbgEComCmdAirDataGetModelId(SbgEComHandle *pHandle, SbgEComAirDataModelsIds *pModelId)
    +
    SbgErrorCode sbgEComCmdAirDataSetRejection(SbgEComHandle *pHandle, const SbgEComAirDataRejectionConf *pRejectConf)
    +
    SbgErrorCode sbgEComCmdAirDataGetRejection(SbgEComHandle *pHandle, SbgEComAirDataRejectionConf *pRejectConf)
    +
    _SbgEComAirDataModelsIds
    Definition: sbgEComCmdAirData.h:56
    +
    @ SBG_ECOM_AIR_DATA_MODEL_AHRS_500
    Definition: sbgEComCmdAirData.h:59
    +
    @ SBG_ECOM_AIR_DATA_MODEL_INTERNAL
    Definition: sbgEComCmdAirData.h:57
    +
    @ SBG_ECOM_AIR_DATA_MODEL_GENERIC_ECOM
    Definition: sbgEComCmdAirData.h:58
    +
    SbgErrorCode sbgEComCmdAirDataSetLeverArm(SbgEComHandle *pHandle, const float *pLeverArm)
    +
    Definitions and methods common to all commands.
    +
    enum _SbgEComRejectionMode SbgEComRejectionMode
    +
    Definition: sbgEComCmdAirData.h:66
    +
    SbgEComRejectionMode airspeed
    Definition: sbgEComCmdAirData.h:67
    +
    SbgEComRejectionMode altitude
    Definition: sbgEComCmdAirData.h:68
    +
    Definition: sbgECom.h:81
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_api_8h.html b/doc/html/sbg_e_com_cmd_api_8h.html new file mode 100644 index 0000000..334a77f --- /dev/null +++ b/doc/html/sbg_e_com_cmd_api_8h.html @@ -0,0 +1,308 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdApi.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComCmdApi.h File Reference
    +
    +
    + +

    REST API related commands. +More...

    +
    #include <sbgCommon.h>
    +#include <sbgECom.h>
    +#include <protocol/sbgEComProtocol.h>
    +
    +

    Go to the source code of this file.

    + + + + +

    +Data Structures

    struct  _SbgEComCmdApiReply
     
    + + + +

    +Typedefs

    typedef struct _SbgEComCmdApiReply SbgEComCmdApiReply
     
    + + + + + + + + + + + +

    +Functions

    void sbgEComCmdApiReplyConstruct (SbgEComCmdApiReply *pReply)
     
    void sbgEComCmdApiReplyDestroy (SbgEComCmdApiReply *pReply)
     
    bool sbgEComCmdApiReplySuccessful (const SbgEComCmdApiReply *pReply)
     
    SbgErrorCode sbgEComCmdApiGet (SbgEComHandle *pHandle, const char *pPath, const char *pQuery, SbgEComCmdApiReply *pReply)
     
    SbgErrorCode sbgEComCmdApiPost (SbgEComHandle *pHandle, const char *pPath, const char *pQuery, const char *pBody, SbgEComCmdApiReply *pReply)
     
    +

    Detailed Description

    +

    REST API related commands.

    +
    Author
    SBG Systems
    +
    Date
    October 14, 2020
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Typedef Documentation

    + +

    ◆ SbgEComCmdApiReply

    + +
    +
    + + + + +
    typedef struct _SbgEComCmdApiReply SbgEComCmdApiReply
    +
    +

    Reply to REST API commands.

    +

    The reply content is a null-terminated string, normally in JSON format.

    +

    The content directly refers to data inside the payload.

    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgEComCmdApiReplyConstruct()

    + +
    +
    + + + + + + + + +
    void sbgEComCmdApiReplyConstruct (SbgEComCmdApiReplypReply)
    +
    +

    REST API reply constructor.

    +
    Parameters
    + + +
    [in]pReplyREST API reply.
    +
    +
    + +
    +
    + +

    ◆ sbgEComCmdApiReplyDestroy()

    + +
    +
    + + + + + + + + +
    void sbgEComCmdApiReplyDestroy (SbgEComCmdApiReplypReply)
    +
    +

    REST API reply destructor.

    +
    Parameters
    + + +
    [in]pReplyREST API reply.
    +
    +
    + +
    +
    + +

    ◆ sbgEComCmdApiReplySuccessful()

    + +
    +
    + + + + + + + + +
    bool sbgEComCmdApiReplySuccessful (const SbgEComCmdApiReplypReply)
    +
    +

    Check if a reply indicates successful command execution.

    +
    Parameters
    + + +
    [in]pReplyREST API reply.
    +
    +
    +
    Returns
    True if the reply indicates successful command execution.
    + +
    +
    + +

    ◆ sbgEComCmdApiGet()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdApiGet (SbgEComHandlepHandle,
    const char * pPath,
    const char * pQuery,
    SbgEComCmdApiReplypReply 
    )
    +
    +

    Send a GET command.

    +

    The reply must be destroyed before the next attempt to receive data, either logs or command replies.

    +
    Parameters
    + + + + + +
    [in]pHandleECom handle.
    [in]pPathURI path component.
    [in]pQueryQuery string, may be NULL.
    [out]pReplyReply.
    +
    +
    +
    Returns
    SBG_NO_ERROR if successful.
    + +
    +
    + +

    ◆ sbgEComCmdApiPost()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdApiPost (SbgEComHandlepHandle,
    const char * pPath,
    const char * pQuery,
    const char * pBody,
    SbgEComCmdApiReplypReply 
    )
    +
    +

    Send a POST command.

    +

    The reply must be destroyed before the next attempt to receive data, either logs or command replies.

    +
    Parameters
    + + + + + + +
    [in]pHandleECom handle.
    [in]pPathURI path component.
    [in]pQueryQuery string, may be NULL.
    [in]pBodyBody, may be NULL.
    [out]pReplyReply.
    +
    +
    +
    Returns
    SBG_NO_ERROR if successful.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_api_8h_source.html b/doc/html/sbg_e_com_cmd_api_8h_source.html new file mode 100644 index 0000000..bc5fa69 --- /dev/null +++ b/doc/html/sbg_e_com_cmd_api_8h_source.html @@ -0,0 +1,114 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdApi.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComCmdApi.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_CMD_API_H
    +
    33#define SBG_ECOM_CMD_API_H
    +
    34
    +
    35// sbgCommonLib headers
    +
    36#include <sbgCommon.h>
    +
    37
    +
    38// Project headers
    +
    39#include <sbgECom.h>
    + +
    41
    +
    42#ifdef __cplusplus
    +
    43extern "C" {
    +
    44#endif
    +
    45
    +
    46//----------------------------------------------------------------------//
    +
    47//- Structure definitions -//
    +
    48//----------------------------------------------------------------------//
    +
    49
    +
    57typedef struct _SbgEComCmdApiReply
    +
    58{
    + +
    60 uint16_t statusCode;
    +
    61 const char *pContent;
    + +
    63
    +
    64//----------------------------------------------------------------------//
    +
    65//- Public methods -//
    +
    66//----------------------------------------------------------------------//
    +
    67
    + +
    74
    + +
    81
    + +
    89
    +
    101SbgErrorCode sbgEComCmdApiGet(SbgEComHandle *pHandle, const char *pPath, const char *pQuery, SbgEComCmdApiReply *pReply);
    +
    102
    +
    115SbgErrorCode sbgEComCmdApiPost(SbgEComHandle *pHandle, const char *pPath, const char *pQuery, const char *pBody, SbgEComCmdApiReply *pReply);
    +
    116
    +
    117#ifdef __cplusplus
    +
    118}
    +
    119#endif
    +
    120
    +
    121#endif // SBG_ECOM_CMD_API_H
    +
    Contains main sbgECom methods.
    +
    SbgErrorCode sbgEComCmdApiGet(SbgEComHandle *pHandle, const char *pPath, const char *pQuery, SbgEComCmdApiReply *pReply)
    +
    bool sbgEComCmdApiReplySuccessful(const SbgEComCmdApiReply *pReply)
    +
    void sbgEComCmdApiReplyDestroy(SbgEComCmdApiReply *pReply)
    +
    struct _SbgEComCmdApiReply SbgEComCmdApiReply
    +
    SbgErrorCode sbgEComCmdApiPost(SbgEComHandle *pHandle, const char *pPath, const char *pQuery, const char *pBody, SbgEComCmdApiReply *pReply)
    +
    void sbgEComCmdApiReplyConstruct(SbgEComCmdApiReply *pReply)
    +
    Implementation of the sbgECom binary communication protocol.
    +
    Definition: sbgEComCmdApi.h:58
    +
    uint16_t statusCode
    Definition: sbgEComCmdApi.h:60
    +
    SbgEComProtocolPayload payload
    Definition: sbgEComCmdApi.h:59
    +
    const char * pContent
    Definition: sbgEComCmdApi.h:61
    +
    Definition: sbgECom.h:81
    +
    Definition: sbgEComProtocol.h:83
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_common_8h.html b/doc/html/sbg_e_com_cmd_common_8h.html new file mode 100644 index 0000000..1f5d48c --- /dev/null +++ b/doc/html/sbg_e_com_cmd_common_8h.html @@ -0,0 +1,720 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdCommon.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComCmdCommon.h File Reference
    +
    +
    + +

    Definitions and methods common to all commands. +More...

    +
    #include <sbgCommon.h>
    +#include <sbgECom.h>
    +
    +

    Go to the source code of this file.

    + + + + +

    +Macros

    #define SBG_ECOM_DEFAULT_CMD_TIME_OUT   (500)
     
    + + + + + +

    +Typedefs

    typedef enum _SbgEComRejectionMode SbgEComRejectionMode
     
    typedef enum _SbgEComAxisDirection SbgEComAxisDirection
     
    + + + + + +

    +Enumerations

    enum  _SbgEComRejectionMode {
    +  SBG_ECOM_NEVER_ACCEPT_MODE = 0 +,
    +  SBG_ECOM_AUTOMATIC_MODE = 1 +,
    +  SBG_ECOM_ALWAYS_ACCEPT_MODE = 2 +
    + }
     
    enum  _SbgEComAxisDirection {
    +  SBG_ECOM_ALIGNMENT_FORWARD = 0 +,
    +  SBG_ECOM_ALIGNMENT_BACKWARD = 1 +,
    +  SBG_ECOM_ALIGNMENT_LEFT = 2 +,
    +  SBG_ECOM_ALIGNMENT_RIGHT = 3 +,
    +  SBG_ECOM_ALIGNMENT_UP = 4 +,
    +  SBG_ECOM_ALIGNMENT_DOWN = 5 +
    + }
     
    + + + + + + + + + + + + + + + + + +

    +Functions

    SbgErrorCode sbgEComReceiveAnyCmd (SbgEComHandle *pHandle, uint8_t *pMsgClass, uint8_t *pMsgId, void *pData, size_t *pSize, size_t maxSize, uint32_t timeOut)
     
    SbgErrorCode sbgEComReceiveAnyCmd2 (SbgEComHandle *pHandle, uint8_t *pMsgClass, uint8_t *pMsgId, SbgEComProtocolPayload *pPayload, uint32_t timeOut)
     
    SbgErrorCode sbgEComReceiveCmd (SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msgId, void *pData, size_t *pSize, size_t maxSize, uint32_t timeOut)
     
    SbgErrorCode sbgEComReceiveCmd2 (SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msgId, SbgEComProtocolPayload *pPayload, uint32_t timeOut)
     
    SbgErrorCode sbgEComWaitForAck (SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg, uint32_t timeOut)
     
    SbgErrorCode sbgEComSendAck (SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg, SbgErrorCode cmdError)
     
    SbgErrorCode sbgEComCmdGenericSetModelId (SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg, uint32_t modelId)
     
    SbgErrorCode sbgEComCmdGenericGetModelId (SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg, uint32_t *pModelId)
     
    +

    Detailed Description

    +

    Definitions and methods common to all commands.

    +
    Author
    SBG Systems
    +
    Date
    11 June 2014
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Macro Definition Documentation

    + +

    ◆ SBG_ECOM_DEFAULT_CMD_TIME_OUT

    + +
    +
    + + + + +
    #define SBG_ECOM_DEFAULT_CMD_TIME_OUT   (500)
    +
    +

    Default time out in ms for commands reception.

    + +
    +
    +

    Typedef Documentation

    + +

    ◆ SbgEComRejectionMode

    + +
    +
    +

    List of all rejection modes for aiding inputs.

    + +
    +
    + +

    ◆ SbgEComAxisDirection

    + +
    +
    +

    List of all axis directions for modules/sensor alignment.

    + +
    +
    +

    Enumeration Type Documentation

    + +

    ◆ _SbgEComRejectionMode

    + +
    +
    + + + + +
    enum _SbgEComRejectionMode
    +
    +

    List of all rejection modes for aiding inputs.

    + + + + +
    Enumerator
    SBG_ECOM_NEVER_ACCEPT_MODE 

    Measurement is not taken into account.

    +
    SBG_ECOM_AUTOMATIC_MODE 

    Measurement is accepted and rejected automatically depending on consistency checks

    +
    SBG_ECOM_ALWAYS_ACCEPT_MODE 

    Measurement is always accepted. Should be used with caution

    +
    + +
    +
    + +

    ◆ _SbgEComAxisDirection

    + +
    +
    + + + + +
    enum _SbgEComAxisDirection
    +
    +

    List of all axis directions for modules/sensor alignment.

    + + + + + + + +
    Enumerator
    SBG_ECOM_ALIGNMENT_FORWARD 

    IMU/module Axis is turned in vehicle's forward direction.

    +
    SBG_ECOM_ALIGNMENT_BACKWARD 

    IMU/module Axis is turned in vehicle's backward direction.

    +
    SBG_ECOM_ALIGNMENT_LEFT 

    IMU/module Axis is turned in vehicle's left direction.

    +
    SBG_ECOM_ALIGNMENT_RIGHT 

    IMU/module Axis is turned in vehicle's right direction.

    +
    SBG_ECOM_ALIGNMENT_UP 

    IMU/module Axis is turned in vehicle's up direction.

    +
    SBG_ECOM_ALIGNMENT_DOWN 

    IMU/module Axis is turned in vehicle's down direction.

    +
    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgEComReceiveAnyCmd()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComReceiveAnyCmd (SbgEComHandlepHandle,
    uint8_t * pMsgClass,
    uint8_t * pMsgId,
    void * pData,
    size_t * pSize,
    size_t maxSize,
    uint32_t timeOut 
    )
    +
    +

    Receive a command message.

    +

    All binary logs received are handled trough the standard callback system.

    +
    Parameters
    + + + + + + + + +
    [in]pHandleSbgECom handle.
    [out]pMsgClassMessage class.
    [out]pMsgIdMessage ID.
    [out]pDataData buffer, may be NULL.
    [out]pSizeNumber of bytes received, in bytes, may be NULL.
    [in]maxSizeData buffer size, in bytes.
    [in]timeOutTime-out, in ms.
    +
    +
    +
    Returns
    SBG_NO_ERROR if successful, SBG_NOT_READY if no command message has been received, SBG_BUFFER_OVERFLOW if the payload of the received frame couldn't fit into the buffer, SBG_TIME_OUT if no command message was received within the specified time out.
    + +
    +
    + +

    ◆ sbgEComReceiveAnyCmd2()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComReceiveAnyCmd2 (SbgEComHandlepHandle,
    uint8_t * pMsgClass,
    uint8_t * pMsgId,
    SbgEComProtocolPayloadpPayload,
    uint32_t timeOut 
    )
    +
    +

    Receive a command message.

    +

    All binary logs received are handled trough the standard callback system.

    +

    This function is equivalent to sbgEComReceiveAnyCmd() with two exceptions :

      +
    • the use of a payload object allows handling payloads not limited by the size of a user-provided buffer
    • +
    • the payload object allows direct access to the protocol work buffer to avoid an extra copy per call
    • +
    +

    Any allocated resource associated with the given payload is released when calling this function.

    +

    Because the payload buffer may directly refer to the protocol work buffer on return, it is only valid until the next attempt to receive a frame, with any of the receive functions.

    +
    Parameters
    + + + + + + +
    [in]pHandleSbgECom handle.
    [out]pMsgClassMessage class.
    [out]pMsgIdMessage ID.
    [out]pPayloadPayload.
    [in]timeOutTime-out, in ms.
    +
    +
    +
    Returns
    SBG_NO_ERROR if successful, SBG_NOT_READY if no command message has been received, SBG_TIME_OUT if no command message was received within the specified time out.
    + +
    +
    + +

    ◆ sbgEComReceiveCmd()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComReceiveCmd (SbgEComHandlepHandle,
    uint8_t msgClass,
    uint8_t msgId,
    void * pData,
    size_t * pSize,
    size_t maxSize,
    uint32_t timeOut 
    )
    +
    +

    Receive a specific command message.

    +

    This function also processes ACK messages for the given class and ID.

    +

    All binary logs received during this time are handled trough the standard callback system.

    +
    Parameters
    + + + + + + + + +
    [in]pHandleSbgECom handle.
    [in]msgClassMessage class.
    [in]msgIdMessage ID.
    [out]pDataData buffer.
    [out]pSizeNumber of bytes received, in bytes.
    [in]maxSizeData buffer size, in bytes.
    [in]timeOutTime-out, in ms.
    +
    +
    +
    Returns
    SBG_NO_ERROR if successful, SBG_NOT_READY if no command message has been received, SBG_BUFFER_OVERFLOW if the payload of the received frame couldn't fit into the buffer, SBG_TIME_OUT if no command message was received within the specified time out, any error code reported by an ACK message for the given class and ID.
    + +
    +
    + +

    ◆ sbgEComReceiveCmd2()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComReceiveCmd2 (SbgEComHandlepHandle,
    uint8_t msgClass,
    uint8_t msgId,
    SbgEComProtocolPayloadpPayload,
    uint32_t timeOut 
    )
    +
    +

    Receive a specific command message.

    +

    This function also processes ACK messages for the given class and ID.

    +

    All binary logs received during this time are handled trough the standard callback system.

    +

    This function is equivalent to sbgEComReceiveCmd() with two exceptions :

      +
    • the use of a payload object allows handling payloads not limited by the size of a user-provided buffer
    • +
    • the payload object allows direct access to the protocol work buffer to avoid an extra copy per call
    • +
    +

    Any allocated resource associated with the given payload is released when calling this function.

    +

    Because the payload buffer may directly refer to the protocol work buffer on return, it is only valid until the next attempt to receive a frame, with any of the receive functions.

    +
    Parameters
    + + + + + + +
    [in]pHandleSbgECom handle.
    [in]msgClassMessage class.
    [in]msgIdMessage ID.
    [out]pPayloadPayload.
    [in]timeOutTime-out, in ms.
    +
    +
    +
    Returns
    SBG_NO_ERROR if successful, SBG_NOT_READY if no command message has been received, SBG_TIME_OUT if no command message was received within the specified time out, any error code reported by an ACK message for the given class and ID.
    + +
    +
    + +

    ◆ sbgEComWaitForAck()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComWaitForAck (SbgEComHandlepHandle,
    uint8_t msgClass,
    uint8_t msg,
    uint32_t timeOut 
    )
    +
    +

    Wait for an ACK for a specified amount of time.

    +
    Parameters
    + + + + + +
    [in]pHandleA valid sbgECom handle.
    [in]msgClassThe message class that we want to check
    [in]msgThe message ID that we want to check
    [in]timeOutTime out in ms during which we can receive the ACK.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the ACK has been received.
    + +
    +
    + +

    ◆ sbgEComSendAck()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComSendAck (SbgEComHandlepHandle,
    uint8_t msgClass,
    uint8_t msg,
    SbgErrorCode cmdError 
    )
    +
    +

    Send an ACK for a specific command with an associated error code.

    +
    Parameters
    + + + + + +
    [in]pHandleA valid sbgECom handle.
    [in]msgClassThe message class that we want to send
    [in]msgThe message ID that we want to send.
    [in]cmdErrorThe associated error code.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the ACK has been sent.
    + +
    +
    + +

    ◆ sbgEComCmdGenericSetModelId()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdGenericSetModelId (SbgEComHandlepHandle,
    uint8_t msgClass,
    uint8_t msg,
    uint32_t modelId 
    )
    +
    +

    Generic function to set an error model ID

    +
    Parameters
    + + + + + +
    [in]pHandleA valid sbgECom handle.
    [in]msgClassOriginal message class
    [in]msgOriginal message ID
    [in]modelIdModel ID to set
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdGenericGetModelId()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdGenericGetModelId (SbgEComHandlepHandle,
    uint8_t msgClass,
    uint8_t msg,
    uint32_t * pModelId 
    )
    +
    +

    Generic function to get an error model ID

    +
    Parameters
    + + + + + +
    [in]pHandleA valid sbgECom handle.
    [in]msgClassOriginal message class
    [in]msgOriginal message ID
    [out]pModelIdReturns the currently used model ID.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_common_8h_source.html b/doc/html/sbg_e_com_cmd_common_8h_source.html new file mode 100644 index 0000000..63c1b7c --- /dev/null +++ b/doc/html/sbg_e_com_cmd_common_8h_source.html @@ -0,0 +1,148 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdCommon.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComCmdCommon.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_CMD_COMMON_H
    +
    33#define SBG_ECOM_CMD_COMMON_H
    +
    34
    +
    35// sbgCommonLib headers
    +
    36#include <sbgCommon.h>
    +
    37
    +
    38// Project headers
    +
    39#include <sbgECom.h>
    +
    40
    +
    41#ifdef __cplusplus
    +
    42extern "C" {
    +
    43#endif
    +
    44
    +
    45//----------------------------------------------------------------------//
    +
    46//- Defintions -//
    +
    47//----------------------------------------------------------------------//
    +
    48
    +
    49#define SBG_ECOM_DEFAULT_CMD_TIME_OUT (500)
    + +
    55{
    + + + + +
    60
    + +
    65{
    + + + + + + + +
    73
    +
    74//----------------------------------------------------------------------//
    +
    75//- Common command reception operations -//
    +
    76//----------------------------------------------------------------------//
    +
    77
    +
    95SbgErrorCode sbgEComReceiveAnyCmd(SbgEComHandle *pHandle, uint8_t *pMsgClass, uint8_t *pMsgId, void *pData, size_t *pSize, size_t maxSize, uint32_t timeOut);
    +
    96
    +
    120SbgErrorCode sbgEComReceiveAnyCmd2(SbgEComHandle *pHandle, uint8_t *pMsgClass, uint8_t *pMsgId, SbgEComProtocolPayload *pPayload, uint32_t timeOut);
    +
    121
    +
    142SbgErrorCode sbgEComReceiveCmd(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msgId, void *pData, size_t *pSize, size_t maxSize, uint32_t timeOut);
    +
    143
    +
    170SbgErrorCode sbgEComReceiveCmd2(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msgId, SbgEComProtocolPayload *pPayload, uint32_t timeOut);
    +
    171
    +
    172//----------------------------------------------------------------------//
    +
    173//- ACK related commands operations -//
    +
    174//----------------------------------------------------------------------//
    +
    175
    +
    185SbgErrorCode sbgEComWaitForAck(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg, uint32_t timeOut);
    +
    186
    +
    196SbgErrorCode sbgEComSendAck(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg, SbgErrorCode cmdError);
    +
    197
    +
    198//----------------------------------------------------------------------//
    +
    199//- Generic command definitions -//
    +
    200//----------------------------------------------------------------------//
    +
    201
    +
    211SbgErrorCode sbgEComCmdGenericSetModelId(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg, uint32_t modelId);
    +
    212
    +
    222SbgErrorCode sbgEComCmdGenericGetModelId(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg, uint32_t *pModelId);
    +
    223
    +
    224#ifdef __cplusplus
    +
    225}
    +
    226#endif
    +
    227
    +
    228#endif // SBG_ECOM_CMD_COMMON_H
    +
    Contains main sbgECom methods.
    +
    SbgErrorCode sbgEComReceiveCmd(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msgId, void *pData, size_t *pSize, size_t maxSize, uint32_t timeOut)
    +
    SbgErrorCode sbgEComReceiveAnyCmd(SbgEComHandle *pHandle, uint8_t *pMsgClass, uint8_t *pMsgId, void *pData, size_t *pSize, size_t maxSize, uint32_t timeOut)
    +
    enum _SbgEComAxisDirection SbgEComAxisDirection
    +
    SbgErrorCode sbgEComWaitForAck(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg, uint32_t timeOut)
    +
    _SbgEComRejectionMode
    Definition: sbgEComCmdCommon.h:55
    +
    @ SBG_ECOM_AUTOMATIC_MODE
    Definition: sbgEComCmdCommon.h:57
    +
    @ SBG_ECOM_ALWAYS_ACCEPT_MODE
    Definition: sbgEComCmdCommon.h:58
    +
    @ SBG_ECOM_NEVER_ACCEPT_MODE
    Definition: sbgEComCmdCommon.h:56
    +
    enum _SbgEComRejectionMode SbgEComRejectionMode
    +
    SbgErrorCode sbgEComReceiveCmd2(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msgId, SbgEComProtocolPayload *pPayload, uint32_t timeOut)
    +
    SbgErrorCode sbgEComCmdGenericSetModelId(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg, uint32_t modelId)
    +
    SbgErrorCode sbgEComCmdGenericGetModelId(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg, uint32_t *pModelId)
    +
    _SbgEComAxisDirection
    Definition: sbgEComCmdCommon.h:65
    +
    @ SBG_ECOM_ALIGNMENT_DOWN
    Definition: sbgEComCmdCommon.h:71
    +
    @ SBG_ECOM_ALIGNMENT_RIGHT
    Definition: sbgEComCmdCommon.h:69
    +
    @ SBG_ECOM_ALIGNMENT_BACKWARD
    Definition: sbgEComCmdCommon.h:67
    +
    @ SBG_ECOM_ALIGNMENT_FORWARD
    Definition: sbgEComCmdCommon.h:66
    +
    @ SBG_ECOM_ALIGNMENT_UP
    Definition: sbgEComCmdCommon.h:70
    +
    @ SBG_ECOM_ALIGNMENT_LEFT
    Definition: sbgEComCmdCommon.h:68
    +
    SbgErrorCode sbgEComReceiveAnyCmd2(SbgEComHandle *pHandle, uint8_t *pMsgClass, uint8_t *pMsgId, SbgEComProtocolPayload *pPayload, uint32_t timeOut)
    +
    SbgErrorCode sbgEComSendAck(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg, SbgErrorCode cmdError)
    +
    Definition: sbgECom.h:81
    +
    Definition: sbgEComProtocol.h:83
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_dvl_8h.html b/doc/html/sbg_e_com_cmd_dvl_8h.html new file mode 100644 index 0000000..4367d8e --- /dev/null +++ b/doc/html/sbg_e_com_cmd_dvl_8h.html @@ -0,0 +1,406 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdDvl.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComCmdDvl.h File Reference
    +
    +
    + +

    DVL (Doppler Velocity Logger) aiding module configuration commands. +More...

    +
    #include <sbgCommon.h>
    +#include <sbgECom.h>
    +#include "sbgEComCmdCommon.h"
    +
    +

    Go to the source code of this file.

    + + + + + + +

    +Data Structures

    struct  _SbgEComDvlInstallation
     
    struct  _SbgEComDvlRejectionConf
     
    + + + + + + + +

    +Typedefs

    typedef enum _SbgEComDvlModelsIds SbgEComDvlModelsIds
     
    typedef struct _SbgEComDvlInstallation SbgEComDvlInstallation
     
    typedef struct _SbgEComDvlRejectionConf SbgEComDvlRejectionConf
     
    + + + +

    +Enumerations

    enum  _SbgEComDvlModelsIds { SBG_ECOM_DVL_MODEL_GENERIC_PD6 = 202 + }
     
    + + + + + + + + + + + + + +

    +Functions

    SbgErrorCode sbgEComCmdDvlSetModelId (SbgEComHandle *pHandle, SbgEComDvlModelsIds modelId)
     
    SbgErrorCode sbgEComCmdDvlGetModelId (SbgEComHandle *pHandle, SbgEComDvlModelsIds *pModelId)
     
    SbgErrorCode sbgEComCmdDvlInstallationSet (SbgEComHandle *pHandle, const SbgEComDvlInstallation *pDvlInstallation)
     
    SbgErrorCode sbgEComCmdDvlInstallationGet (SbgEComHandle *pHandle, SbgEComDvlInstallation *pDvlInstallation)
     
    SbgErrorCode sbgEComCmdDvlSetRejection (SbgEComHandle *pHandle, const SbgEComDvlRejectionConf *pRejectConf)
     
    SbgErrorCode sbgEComCmdDvlGetRejection (SbgEComHandle *pHandle, SbgEComDvlRejectionConf *pRejectConf)
     
    +

    Detailed Description

    +

    DVL (Doppler Velocity Logger) aiding module configuration commands.

    +
    Author
    SBG Systems
    +
    Date
    13 December 2018
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Typedef Documentation

    + +

    ◆ SbgEComDvlModelsIds

    + +
    +
    + + + + +
    typedef enum _SbgEComDvlModelsIds SbgEComDvlModelsIds
    +
    +

    This enum defines the different DVL model IDs available in standard

    + +
    +
    + +

    ◆ SbgEComDvlInstallation

    + +
    +
    +

    DVL mechanical installation parameters such as lever arm and alignment

    + +
    +
    + +

    ◆ SbgEComDvlRejectionConf

    + +
    +
    +

    Holds all necessary information for DVL module data rejection.

    + +
    +
    +

    Enumeration Type Documentation

    + +

    ◆ _SbgEComDvlModelsIds

    + +
    +
    + + + + +
    enum _SbgEComDvlModelsIds
    +
    +

    This enum defines the different DVL model IDs available in standard

    + + +
    Enumerator
    SBG_ECOM_DVL_MODEL_GENERIC_PD6 

    Generic DVL using PD6 protocol format.

    +
    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgEComCmdDvlSetModelId()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdDvlSetModelId (SbgEComHandlepHandle,
    SbgEComDvlModelsIds modelId 
    )
    +
    +

    Set the DVL model to use that both defines the protocol as well as the associated error model.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [in]modelIdDVL model ID to set
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdDvlGetModelId()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdDvlGetModelId (SbgEComHandlepHandle,
    SbgEComDvlModelsIdspModelId 
    )
    +
    +

    Retrieve the DVL model id currently in use by the device.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [out]pModelIdReturns the DVL model ID currently in use by the device.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdDvlInstallationSet()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdDvlInstallationSet (SbgEComHandlepHandle,
    const SbgEComDvlInstallationpDvlInstallation 
    )
    +
    +

    Set the lever arm and alignment configuration of the DVL module.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [in]pDvlInstallationThe DVL lever arm and alignment configuration to apply.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdDvlInstallationGet()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdDvlInstallationGet (SbgEComHandlepHandle,
    SbgEComDvlInstallationpDvlInstallation 
    )
    +
    +

    Retrieve the lever arm and alignment configuration of the DVL module.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [out]pDvlInstallationReturns the DVL lever arm and alignment configuration currently in use.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdDvlSetRejection()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdDvlSetRejection (SbgEComHandlepHandle,
    const SbgEComDvlRejectionConfpRejectConf 
    )
    +
    +

    Set the rejection configuration of the DVL module (this command doesn't need a reboot to be applied)

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [out]pRejectConfThe new DVL rejection configuration to set.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdDvlGetRejection()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdDvlGetRejection (SbgEComHandlepHandle,
    SbgEComDvlRejectionConfpRejectConf 
    )
    +
    +

    Retrieve the current rejection configuration of the DVL module.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [out]pRejectConfReturn the DVL rejection configuration currently in use.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_dvl_8h_source.html b/doc/html/sbg_e_com_cmd_dvl_8h_source.html new file mode 100644 index 0000000..8ba08e4 --- /dev/null +++ b/doc/html/sbg_e_com_cmd_dvl_8h_source.html @@ -0,0 +1,137 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdDvl.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComCmdDvl.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_CMD_DVL_H
    +
    33#define SBG_ECOM_CMD_DVL_H
    +
    34
    +
    35// sbgCommonLib headers
    +
    36#include <sbgCommon.h>
    +
    37
    +
    38// Project headers
    +
    39#include <sbgECom.h>
    +
    40
    +
    41// Local headers
    +
    42#include "sbgEComCmdCommon.h"
    +
    43
    +
    44#ifdef __cplusplus
    +
    45extern "C" {
    +
    46#endif
    +
    47
    +
    48//----------------------------------------------------------------------//
    +
    49//- Public definitions -//
    +
    50//----------------------------------------------------------------------//
    +
    51
    + +
    56{
    + + +
    59
    + +
    64{
    +
    65 float leverArm[3];
    +
    66 float alignment[3];
    + + +
    69
    + +
    74{
    + + + +
    78
    +
    79//----------------------------------------------------------------------//
    +
    80//- Public methods -//
    +
    81//----------------------------------------------------------------------//
    +
    82
    + +
    91
    + +
    100
    +
    108SbgErrorCode sbgEComCmdDvlInstallationSet(SbgEComHandle *pHandle, const SbgEComDvlInstallation *pDvlInstallation);
    +
    109
    +
    117SbgErrorCode sbgEComCmdDvlInstallationGet(SbgEComHandle *pHandle, SbgEComDvlInstallation *pDvlInstallation);
    +
    118
    +
    126SbgErrorCode sbgEComCmdDvlSetRejection(SbgEComHandle *pHandle, const SbgEComDvlRejectionConf *pRejectConf);
    +
    127
    + +
    136
    +
    137#ifdef __cplusplus
    +
    138}
    +
    139#endif
    +
    140
    +
    141#endif // SBG_ECOM_CMD_DVL_H
    +
    Contains main sbgECom methods.
    +
    Definitions and methods common to all commands.
    +
    enum _SbgEComRejectionMode SbgEComRejectionMode
    +
    enum _SbgEComDvlModelsIds SbgEComDvlModelsIds
    +
    struct _SbgEComDvlInstallation SbgEComDvlInstallation
    +
    SbgErrorCode sbgEComCmdDvlInstallationGet(SbgEComHandle *pHandle, SbgEComDvlInstallation *pDvlInstallation)
    +
    SbgErrorCode sbgEComCmdDvlSetModelId(SbgEComHandle *pHandle, SbgEComDvlModelsIds modelId)
    +
    SbgErrorCode sbgEComCmdDvlInstallationSet(SbgEComHandle *pHandle, const SbgEComDvlInstallation *pDvlInstallation)
    +
    _SbgEComDvlModelsIds
    Definition: sbgEComCmdDvl.h:56
    +
    @ SBG_ECOM_DVL_MODEL_GENERIC_PD6
    Definition: sbgEComCmdDvl.h:57
    +
    struct _SbgEComDvlRejectionConf SbgEComDvlRejectionConf
    +
    SbgErrorCode sbgEComCmdDvlGetModelId(SbgEComHandle *pHandle, SbgEComDvlModelsIds *pModelId)
    +
    SbgErrorCode sbgEComCmdDvlSetRejection(SbgEComHandle *pHandle, const SbgEComDvlRejectionConf *pRejectConf)
    +
    SbgErrorCode sbgEComCmdDvlGetRejection(SbgEComHandle *pHandle, SbgEComDvlRejectionConf *pRejectConf)
    +
    Definition: sbgEComCmdDvl.h:64
    +
    float leverArm[3]
    Definition: sbgEComCmdDvl.h:65
    +
    bool preciseInstallation
    Definition: sbgEComCmdDvl.h:67
    +
    float alignment[3]
    Definition: sbgEComCmdDvl.h:66
    +
    Definition: sbgEComCmdDvl.h:74
    +
    SbgEComRejectionMode bottomLayer
    Definition: sbgEComCmdDvl.h:75
    +
    SbgEComRejectionMode waterLayer
    Definition: sbgEComCmdDvl.h:76
    +
    Definition: sbgECom.h:81
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_ethernet_8h.html b/doc/html/sbg_e_com_cmd_ethernet_8h.html new file mode 100644 index 0000000..9f6d440 --- /dev/null +++ b/doc/html/sbg_e_com_cmd_ethernet_8h.html @@ -0,0 +1,277 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdEthernet.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComCmdEthernet.h File Reference
    +
    +
    + +

    Ethernet configuration related commands. +More...

    +
    #include <sbgCommon.h>
    +#include <sbgECom.h>
    +
    +

    Go to the source code of this file.

    + + + + +

    +Data Structures

    struct  _SbgEComEthernetConf
     
    + + + + + +

    +Typedefs

    typedef enum _SbgEComEthernetMode SbgEComEthernetMode
     
    typedef struct _SbgEComEthernetConf SbgEComEthernetConf
     
    + + + +

    +Enumerations

    enum  _SbgEComEthernetMode {
    +  SBG_ECOM_ETHERNET_DHCP = 0 +,
    +  SBG_ECOM_ETHERNET_STATIC = 1 +
    + }
     
    + + + + + + + +

    +Functions

    SbgErrorCode sbgEComEthernetGetConf (SbgEComHandle *pHandle, SbgEComEthernetConf *pEthernetConf)
     
    SbgErrorCode sbgEComEthernetSetConf (SbgEComHandle *pHandle, const SbgEComEthernetConf *pEthernetConf)
     
    SbgErrorCode sbgEComEthernetInfo (SbgEComHandle *pHandle, SbgEComEthernetConf *pEthernetConf)
     
    +

    Detailed Description

    +

    Ethernet configuration related commands.

    +
    Author
    SBG Systems
    +
    Date
    14 November 2016
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Typedef Documentation

    + +

    ◆ SbgEComEthernetMode

    + +
    +
    + + + + +
    typedef enum _SbgEComEthernetMode SbgEComEthernetMode
    +
    +

    Enum that defines the different type of IP acquisition method.

    + +
    +
    + +

    ◆ SbgEComEthernetConf

    + +
    +
    + + + + +
    typedef struct _SbgEComEthernetConf SbgEComEthernetConf
    +
    +

    Structure that contains all Ethernet configuration or settings.

    + +
    +
    +

    Enumeration Type Documentation

    + +

    ◆ _SbgEComEthernetMode

    + +
    +
    + + + + +
    enum _SbgEComEthernetMode
    +
    +

    Enum that defines the different type of IP acquisition method.

    + + + +
    Enumerator
    SBG_ECOM_ETHERNET_DHCP 

    The TCP/IP configuration should be acquired from a DHCP server.

    +
    SBG_ECOM_ETHERNET_STATIC 

    The TCP/IP configuration is manually defined.

    +
    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgEComEthernetGetConf()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComEthernetGetConf (SbgEComHandlepHandle,
    SbgEComEthernetConfpEthernetConf 
    )
    +
    +

    Get the configuration for the Ethernet interface.

    +

    Warning: this method only returns the Ethernet configuration and NOT the ip address currently used by the device. You should rather use sbgEComEthernetInfo to retreive the current assigned IP.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [out]pEthernetConfPoiner to a SbgEComEthernetConf struct that holds the read configuration from the device.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComEthernetSetConf()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComEthernetSetConf (SbgEComHandlepHandle,
    const SbgEComEthernetConfpEthernetConf 
    )
    +
    +

    Set the configuration for the Ethernet interface.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [in]pEthernetConfPoiner to a SbgEComEthernetConf struct that holds the new configuration to apply.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComEthernetInfo()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComEthernetInfo (SbgEComHandlepHandle,
    SbgEComEthernetConfpEthernetConf 
    )
    +
    +

    Get the current assigned and used IP address as well as network inforamtion.

    +

    In opposition to sbgEComEthernetGetConf, this method will not return the Ethernet configuration. It will rather return the IP address currently used by the device.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [out]pEthernetConfPoiner to a SbgEComEthernetConf struct that holds the read IP settings from the device.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_ethernet_8h_source.html b/doc/html/sbg_e_com_cmd_ethernet_8h_source.html new file mode 100644 index 0000000..b6fbee8 --- /dev/null +++ b/doc/html/sbg_e_com_cmd_ethernet_8h_source.html @@ -0,0 +1,121 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdEthernet.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComCmdEthernet.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_CMD_ETHERNET_H
    +
    33#define SBG_ECOM_CMD_ETHERNET_H
    +
    34
    +
    35// sbgCommonLib headers
    +
    36#include <sbgCommon.h>
    +
    37
    +
    38// Project headers
    +
    39#include <sbgECom.h>
    +
    40
    +
    41#ifdef __cplusplus
    +
    42extern "C" {
    +
    43#endif
    +
    44
    +
    45//----------------------------------------------------------------------//
    +
    46//- Ethernet interface configuration -//
    +
    47//----------------------------------------------------------------------//
    +
    48
    + +
    53{
    + + + +
    57
    + +
    62{
    + +
    64 sbgIpAddress ipAddress;
    +
    65 sbgIpAddress netmask;
    +
    66 sbgIpAddress gateway;
    +
    67 sbgIpAddress dns1;
    +
    68 sbgIpAddress dns2;
    + +
    70
    +
    71//----------------------------------------------------------------------//
    +
    72//- Public methods -//
    +
    73//----------------------------------------------------------------------//
    +
    74
    +
    85SbgErrorCode sbgEComEthernetGetConf(SbgEComHandle *pHandle, SbgEComEthernetConf *pEthernetConf);
    +
    86
    +
    94SbgErrorCode sbgEComEthernetSetConf(SbgEComHandle *pHandle, const SbgEComEthernetConf *pEthernetConf);
    +
    95
    +
    106SbgErrorCode sbgEComEthernetInfo(SbgEComHandle *pHandle, SbgEComEthernetConf *pEthernetConf);
    +
    107
    +
    108#ifdef __cplusplus
    +
    109}
    +
    110#endif
    +
    111
    +
    112#endif // SBG_ECOM_CMD_ETHERNET_H
    +
    Contains main sbgECom methods.
    +
    struct _SbgEComEthernetConf SbgEComEthernetConf
    +
    SbgErrorCode sbgEComEthernetSetConf(SbgEComHandle *pHandle, const SbgEComEthernetConf *pEthernetConf)
    +
    enum _SbgEComEthernetMode SbgEComEthernetMode
    +
    _SbgEComEthernetMode
    Definition: sbgEComCmdEthernet.h:53
    +
    @ SBG_ECOM_ETHERNET_DHCP
    Definition: sbgEComCmdEthernet.h:54
    +
    @ SBG_ECOM_ETHERNET_STATIC
    Definition: sbgEComCmdEthernet.h:55
    +
    SbgErrorCode sbgEComEthernetGetConf(SbgEComHandle *pHandle, SbgEComEthernetConf *pEthernetConf)
    +
    SbgErrorCode sbgEComEthernetInfo(SbgEComHandle *pHandle, SbgEComEthernetConf *pEthernetConf)
    +
    Definition: sbgEComCmdEthernet.h:62
    +
    sbgIpAddress ipAddress
    Definition: sbgEComCmdEthernet.h:64
    +
    sbgIpAddress dns2
    Definition: sbgEComCmdEthernet.h:68
    +
    SbgEComEthernetMode mode
    Definition: sbgEComCmdEthernet.h:63
    +
    sbgIpAddress netmask
    Definition: sbgEComCmdEthernet.h:65
    +
    sbgIpAddress gateway
    Definition: sbgEComCmdEthernet.h:66
    +
    sbgIpAddress dns1
    Definition: sbgEComCmdEthernet.h:67
    +
    Definition: sbgECom.h:81
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_event_8h.html b/doc/html/sbg_e_com_cmd_event_8h.html new file mode 100644 index 0000000..479b5a1 --- /dev/null +++ b/doc/html/sbg_e_com_cmd_event_8h.html @@ -0,0 +1,613 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdEvent.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComCmdEvent.h File Reference
    +
    +
    + +

    Input/output event markers configuration commands. +More...

    +
    #include <sbgCommon.h>
    +#include <sbgECom.h>
    +
    +

    Go to the source code of this file.

    + + + + + + +

    +Data Structures

    struct  _SbgEComSyncInConf
     
    struct  _SbgEComSyncOutConf
     
    + + + + + + + + + + + + + + + +

    +Typedefs

    typedef enum _SbgEComSyncInId SbgEComSyncInId
     
    typedef enum _SbgEComSyncInSensitivity SbgEComSyncInSensitivity
     
    typedef enum _SbgEComSyncOutId SbgEComSyncOutId
     
    typedef enum _SbgEComSyncOutFunction SbgEComSyncOutFunction
     
    typedef enum _SbgEComSyncOutPolarity SbgEComSyncOutPolarity
     
    typedef struct _SbgEComSyncInConf SbgEComSyncInConf
     
    typedef struct _SbgEComSyncOutConf SbgEComSyncOutConf
     
    + + + + + + + + + + + +

    +Enumerations

    enum  _SbgEComSyncInId {
    +  SBG_ECOM_SYNC_IN_A = 0 +,
    +  SBG_ECOM_SYNC_IN_B = 1 +,
    +  SBG_ECOM_SYNC_IN_C = 2 +,
    +  SBG_ECOM_SYNC_IN_D = 3 +
    + }
     
    enum  _SbgEComSyncInSensitivity {
    +  SBG_ECOM_SYNC_IN_DISABLED = 0 +,
    +  SBG_ECOM_SYNC_IN_FALLING_EDGE = 1 +,
    +  SBG_ECOM_SYNC_IN_RISING_EDGE = 2 +,
    +  SBG_ECOM_SYNC_IN_BOTH_EDGES = 3 +
    + }
     
    enum  _SbgEComSyncOutId {
    +  SBG_ECOM_SYNC_OUT_A = 0 +,
    +  SBG_ECOM_SYNC_OUT_B = 1 +
    + }
     
    enum  _SbgEComSyncOutFunction {
    +  SBG_ECOM_SYNC_OUT_MODE_DISABLED = 0 +,
    +  SBG_ECOM_SYNC_OUT_MODE_MAIN_LOOP = 1 +,
    +  SBG_ECOM_SYNC_OUT_MODE_DIV_2 = 2 +,
    +  SBG_ECOM_SYNC_OUT_MODE_DIV_4 = 4 +,
    +  SBG_ECOM_SYNC_OUT_MODE_DIV_8 = 8 +,
    +  SBG_ECOM_SYNC_OUT_MODE_DIV_10 = 10 +,
    +  SBG_ECOM_SYNC_OUT_MODE_DIV_20 = 20 +,
    +  SBG_ECOM_SYNC_OUT_MODE_DIV_40 = 40 +,
    +  SBG_ECOM_SYNC_OUT_MODE_DIV_200 = 200 +,
    +  SBG_ECOM_SYNC_OUT_MODE_PPS = 10000 +,
    +  SBG_ECOM_SYNC_OUT_MODE_EVENT_IN_A = 10003 +,
    +  SBG_ECOM_SYNC_OUT_MODE_EVENT_IN_B = 10004 +,
    +  SBG_ECOM_SYNC_OUT_MODE_EVENT_IN_C = 10005 +,
    +  SBG_ECOM_SYNC_OUT_MODE_EVENT_IN_D = 10006 +,
    +  SBG_ECOM_SYNC_OUT_MODE_DIRECT_PPS = 10100 +
    + }
     
    enum  _SbgEComSyncOutPolarity {
    +  SBG_ECOM_SYNC_OUT_FALLING_EDGE = 0 +,
    +  SBG_ECOM_SYNC_OUT_RISING_EDGE = 1 +,
    +  SBG_ECOM_SYNC_OUT_TOGGLE = 2 +
    + }
     
    + + + + + + + + + +

    +Functions

    SbgErrorCode sbgEComCmdSyncInGetConf (SbgEComHandle *pHandle, SbgEComSyncInId syncInId, SbgEComSyncInConf *pConf)
     
    SbgErrorCode sbgEComCmdSyncInSetConf (SbgEComHandle *pHandle, SbgEComSyncInId syncInId, const SbgEComSyncInConf *pConf)
     
    SbgErrorCode sbgEComCmdSyncOutGetConf (SbgEComHandle *pHandle, SbgEComSyncOutId syncOutId, SbgEComSyncOutConf *pConf)
     
    SbgErrorCode sbgEComCmdSyncOutSetConf (SbgEComHandle *pHandle, SbgEComSyncOutId syncOutId, const SbgEComSyncOutConf *pConf)
     
    +

    Detailed Description

    +

    Input/output event markers configuration commands.

    +
    Author
    SBG Systems
    +
    Date
    11 June 2014
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Typedef Documentation

    + +

    ◆ SbgEComSyncInId

    + +
    +
    + + + + +
    typedef enum _SbgEComSyncInId SbgEComSyncInId
    +
    +

    List of sync in signals available.

    + +
    +
    + +

    ◆ SbgEComSyncInSensitivity

    + +
    +
    +

    List of available sensitivities for sync in signals.

    + +
    +
    + +

    ◆ SbgEComSyncOutId

    + +
    +
    + + + + +
    typedef enum _SbgEComSyncOutId SbgEComSyncOutId
    +
    +

    List of sync out signals available.

    + +
    +
    + +

    ◆ SbgEComSyncOutFunction

    + +
    +
    +

    Logic and synchronization output types

    + +
    +
    + +

    ◆ SbgEComSyncOutPolarity

    + +
    +
    +

    Logic output polarity

    + +
    +
    + +

    ◆ SbgEComSyncInConf

    + +
    +
    + + + + +
    typedef struct _SbgEComSyncInConf SbgEComSyncInConf
    +
    +

    Helper structure for sync in configuration.

    + +
    +
    + +

    ◆ SbgEComSyncOutConf

    + +
    +
    + + + + +
    typedef struct _SbgEComSyncOutConf SbgEComSyncOutConf
    +
    +

    Helper structure for sync out configuration.

    + +
    +
    +

    Enumeration Type Documentation

    + +

    ◆ _SbgEComSyncInId

    + +
    +
    + + + + +
    enum _SbgEComSyncInId
    +
    +

    List of sync in signals available.

    + + + + + +
    Enumerator
    SBG_ECOM_SYNC_IN_A 

    Sync IN A

    +
    SBG_ECOM_SYNC_IN_B 

    Sync IN B

    +
    SBG_ECOM_SYNC_IN_C 

    Sync IN C

    +
    SBG_ECOM_SYNC_IN_D 

    Sync IN D

    +
    + +
    +
    + +

    ◆ _SbgEComSyncInSensitivity

    + +
    +
    + + + + +
    enum _SbgEComSyncInSensitivity
    +
    +

    List of available sensitivities for sync in signals.

    + + + + + +
    Enumerator
    SBG_ECOM_SYNC_IN_DISABLED 

    This trigger is turned OFF.

    +
    SBG_ECOM_SYNC_IN_FALLING_EDGE 

    The trigger will be activated by a falling edge.

    +
    SBG_ECOM_SYNC_IN_RISING_EDGE 

    The trigger will be activated by a rising edge.

    +
    SBG_ECOM_SYNC_IN_BOTH_EDGES 

    The trigger is activated by a level change (rising or falling edge).

    +
    + +
    +
    + +

    ◆ _SbgEComSyncOutId

    + +
    +
    + + + + +
    enum _SbgEComSyncOutId
    +
    +

    List of sync out signals available.

    + + + +
    Enumerator
    SBG_ECOM_SYNC_OUT_A 

    Synchronization output A

    +
    SBG_ECOM_SYNC_OUT_B 

    Synchronization output B

    +
    + +
    +
    + +

    ◆ _SbgEComSyncOutFunction

    + +
    +
    + + + + +
    enum _SbgEComSyncOutFunction
    +
    +

    Logic and synchronization output types

    + + + + + + + + + + + + + + + + +
    Enumerator
    SBG_ECOM_SYNC_OUT_MODE_DISABLED 

    Output is disabled.

    +
    SBG_ECOM_SYNC_OUT_MODE_MAIN_LOOP 

    Output is generated at 200Hz.

    +
    SBG_ECOM_SYNC_OUT_MODE_DIV_2 

    Output is generated at 100Hz.

    +
    SBG_ECOM_SYNC_OUT_MODE_DIV_4 

    Output is generated at 50Hz.

    +
    SBG_ECOM_SYNC_OUT_MODE_DIV_8 

    Output is generated at 25Hz.

    +
    SBG_ECOM_SYNC_OUT_MODE_DIV_10 

    Output is generated at 20Hz.

    +
    SBG_ECOM_SYNC_OUT_MODE_DIV_20 

    Output is generated at 10Hz.

    +
    SBG_ECOM_SYNC_OUT_MODE_DIV_40 

    Output is generated at 5Hz.

    +
    SBG_ECOM_SYNC_OUT_MODE_DIV_200 

    Output is generated at 1Hz.

    +
    SBG_ECOM_SYNC_OUT_MODE_PPS 

    Pulse Per Second. Same mode as above.

    +
    SBG_ECOM_SYNC_OUT_MODE_EVENT_IN_A 

    Output is generated on a Sync In A event.

    +
    SBG_ECOM_SYNC_OUT_MODE_EVENT_IN_B 

    Output is generated on a Sync In B event.

    +
    SBG_ECOM_SYNC_OUT_MODE_EVENT_IN_C 

    Output is generated on a Sync In C event.

    +
    SBG_ECOM_SYNC_OUT_MODE_EVENT_IN_D 

    Output is generated on a Sync In D event.

    +
    SBG_ECOM_SYNC_OUT_MODE_DIRECT_PPS 

    The internal GNSS PPS signal is directly routed to the Sync Out. This mode is only valid for ELLIPSE-N with hardware revisions above 1.2.1.0. Polarity and duration parameters are ignored with this specific mode.

    +
    + +
    +
    + +

    ◆ _SbgEComSyncOutPolarity

    + +
    +
    + + + + +
    enum _SbgEComSyncOutPolarity
    +
    +

    Logic output polarity

    + + + + +
    Enumerator
    SBG_ECOM_SYNC_OUT_FALLING_EDGE 

    The output pin will generate a falling edge

    +
    SBG_ECOM_SYNC_OUT_RISING_EDGE 

    The output pin will generate a rising edge

    +
    SBG_ECOM_SYNC_OUT_TOGGLE 

    The pulse is a level change

    +
    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgEComCmdSyncInGetConf()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdSyncInGetConf (SbgEComHandlepHandle,
    SbgEComSyncInId syncInId,
    SbgEComSyncInConfpConf 
    )
    +
    +

    Retrieve the configuration of a Sync In.

    +
    Parameters
    + + + + +
    [in]pHandleA valid sbgECom handle.
    [in]syncInIdThe id of the sync whose configuration is to be retrieved.
    [out]pConfPointer to a SbgEComSyncInConf to contain the current configuration of the sync in.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdSyncInSetConf()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdSyncInSetConf (SbgEComHandlepHandle,
    SbgEComSyncInId syncInId,
    const SbgEComSyncInConfpConf 
    )
    +
    +

    Set the configuration of a Sync In.

    +
    Parameters
    + + + + +
    [in]pHandleA valid sbgECom handle.
    [in]syncInIdThe id of the sync whose configuration is to be set.
    [in]pConfPointer to a SbgEComSyncInConf that contains the new configuration for the sync in.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdSyncOutGetConf()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdSyncOutGetConf (SbgEComHandlepHandle,
    SbgEComSyncOutId syncOutId,
    SbgEComSyncOutConfpConf 
    )
    +
    +

    Retrieve the configuration of a Sync Out.

    +
    Parameters
    + + + + +
    [in]pHandleA valid sbgECom handle.
    [in]syncOutIdThe id of the sync whose configuration is to be retrieved.
    [out]pConfPointer to a SbgEComSyncOutConf to contain the current configuration of the sync out.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdSyncOutSetConf()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdSyncOutSetConf (SbgEComHandlepHandle,
    SbgEComSyncOutId syncOutId,
    const SbgEComSyncOutConfpConf 
    )
    +
    +

    Set the configuration of a Sync Out.

    +
    Parameters
    + + + + +
    [in]pHandleA valid sbgECom handle.
    [in]syncOutIdThe id of the sync whose configuration is to be set.
    [in]pConfPointer to a SbgEComSyncOutConf that contains the new configuration for the sync Out.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_event_8h_source.html b/doc/html/sbg_e_com_cmd_event_8h_source.html new file mode 100644 index 0000000..13befda --- /dev/null +++ b/doc/html/sbg_e_com_cmd_event_8h_source.html @@ -0,0 +1,208 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdEvent.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComCmdEvent.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_CMD_EVENT_H
    +
    33#define SBG_ECOM_CMD_EVENT_H
    +
    34
    +
    35// sbgCommonLib headers
    +
    36#include <sbgCommon.h>
    +
    37
    +
    38// Project headers
    +
    39#include <sbgECom.h>
    +
    40
    +
    41#ifdef __cplusplus
    +
    42extern "C" {
    +
    43#endif
    +
    44
    +
    45//----------------------------------------------------------------------//
    +
    46//- Event definitions -//
    +
    47//----------------------------------------------------------------------//
    +
    48
    +
    52typedef enum _SbgEComSyncInId
    +
    53{
    + + + + + +
    59
    + +
    64{
    + + + + + +
    70
    + +
    75{
    + + + +
    79
    + +
    84{
    + + + + + + + + + + + + + + + + +
    105
    + +
    110{
    + + + + +
    115
    +
    116//----------------------------------------------------------------------//
    +
    117//- Event configurations -//
    +
    118//----------------------------------------------------------------------//
    +
    119
    +
    123typedef struct _SbgEComSyncInConf
    +
    124{
    + +
    126 int32_t delay;
    + +
    128
    + +
    133{
    + + +
    136 uint32_t duration;
    + +
    138
    +
    139//----------------------------------------------------------------------//
    +
    140//- Public methods -//
    +
    141//----------------------------------------------------------------------//
    +
    142
    + +
    152
    +
    161SbgErrorCode sbgEComCmdSyncInSetConf(SbgEComHandle *pHandle, SbgEComSyncInId syncInId, const SbgEComSyncInConf *pConf);
    +
    162
    + +
    172
    +
    181SbgErrorCode sbgEComCmdSyncOutSetConf(SbgEComHandle *pHandle, SbgEComSyncOutId syncOutId, const SbgEComSyncOutConf *pConf);
    +
    182
    +
    183#ifdef __cplusplus
    +
    184}
    +
    185#endif
    +
    186
    +
    187#endif // SBG_ECOM_CMD_EVENT_H
    +
    Contains main sbgECom methods.
    +
    enum _SbgEComSyncOutPolarity SbgEComSyncOutPolarity
    +
    _SbgEComSyncOutId
    Definition: sbgEComCmdEvent.h:75
    +
    @ SBG_ECOM_SYNC_OUT_A
    Definition: sbgEComCmdEvent.h:76
    +
    @ SBG_ECOM_SYNC_OUT_B
    Definition: sbgEComCmdEvent.h:77
    +
    _SbgEComSyncOutPolarity
    Definition: sbgEComCmdEvent.h:110
    +
    @ SBG_ECOM_SYNC_OUT_RISING_EDGE
    Definition: sbgEComCmdEvent.h:112
    +
    @ SBG_ECOM_SYNC_OUT_FALLING_EDGE
    Definition: sbgEComCmdEvent.h:111
    +
    @ SBG_ECOM_SYNC_OUT_TOGGLE
    Definition: sbgEComCmdEvent.h:113
    +
    SbgErrorCode sbgEComCmdSyncOutGetConf(SbgEComHandle *pHandle, SbgEComSyncOutId syncOutId, SbgEComSyncOutConf *pConf)
    +
    enum _SbgEComSyncInSensitivity SbgEComSyncInSensitivity
    +
    enum _SbgEComSyncOutId SbgEComSyncOutId
    +
    _SbgEComSyncOutFunction
    Definition: sbgEComCmdEvent.h:84
    +
    @ SBG_ECOM_SYNC_OUT_MODE_EVENT_IN_A
    Definition: sbgEComCmdEvent.h:95
    +
    @ SBG_ECOM_SYNC_OUT_MODE_DIRECT_PPS
    Definition: sbgEComCmdEvent.h:100
    +
    @ SBG_ECOM_SYNC_OUT_MODE_DISABLED
    Definition: sbgEComCmdEvent.h:85
    +
    @ SBG_ECOM_SYNC_OUT_MODE_EVENT_IN_B
    Definition: sbgEComCmdEvent.h:96
    +
    @ SBG_ECOM_SYNC_OUT_MODE_PPS
    Definition: sbgEComCmdEvent.h:94
    +
    @ SBG_ECOM_SYNC_OUT_MODE_EVENT_IN_D
    Definition: sbgEComCmdEvent.h:98
    +
    @ SBG_ECOM_SYNC_OUT_MODE_DIV_40
    Definition: sbgEComCmdEvent.h:92
    +
    @ SBG_ECOM_SYNC_OUT_MODE_DIV_10
    Definition: sbgEComCmdEvent.h:90
    +
    @ SBG_ECOM_SYNC_OUT_MODE_MAIN_LOOP
    Definition: sbgEComCmdEvent.h:86
    +
    @ SBG_ECOM_SYNC_OUT_MODE_EVENT_IN_C
    Definition: sbgEComCmdEvent.h:97
    +
    @ SBG_ECOM_SYNC_OUT_MODE_DIV_8
    Definition: sbgEComCmdEvent.h:89
    +
    @ SBG_ECOM_SYNC_OUT_MODE_DIV_200
    Definition: sbgEComCmdEvent.h:93
    +
    @ SBG_ECOM_SYNC_OUT_MODE_DIV_20
    Definition: sbgEComCmdEvent.h:91
    +
    @ SBG_ECOM_SYNC_OUT_MODE_DIV_4
    Definition: sbgEComCmdEvent.h:88
    +
    @ SBG_ECOM_SYNC_OUT_MODE_DIV_2
    Definition: sbgEComCmdEvent.h:87
    +
    SbgErrorCode sbgEComCmdSyncInSetConf(SbgEComHandle *pHandle, SbgEComSyncInId syncInId, const SbgEComSyncInConf *pConf)
    +
    SbgErrorCode sbgEComCmdSyncInGetConf(SbgEComHandle *pHandle, SbgEComSyncInId syncInId, SbgEComSyncInConf *pConf)
    +
    enum _SbgEComSyncInId SbgEComSyncInId
    +
    SbgErrorCode sbgEComCmdSyncOutSetConf(SbgEComHandle *pHandle, SbgEComSyncOutId syncOutId, const SbgEComSyncOutConf *pConf)
    +
    _SbgEComSyncInId
    Definition: sbgEComCmdEvent.h:53
    +
    @ SBG_ECOM_SYNC_IN_C
    Definition: sbgEComCmdEvent.h:56
    +
    @ SBG_ECOM_SYNC_IN_D
    Definition: sbgEComCmdEvent.h:57
    +
    @ SBG_ECOM_SYNC_IN_B
    Definition: sbgEComCmdEvent.h:55
    +
    @ SBG_ECOM_SYNC_IN_A
    Definition: sbgEComCmdEvent.h:54
    +
    enum _SbgEComSyncOutFunction SbgEComSyncOutFunction
    +
    struct _SbgEComSyncOutConf SbgEComSyncOutConf
    +
    struct _SbgEComSyncInConf SbgEComSyncInConf
    +
    _SbgEComSyncInSensitivity
    Definition: sbgEComCmdEvent.h:64
    +
    @ SBG_ECOM_SYNC_IN_RISING_EDGE
    Definition: sbgEComCmdEvent.h:67
    +
    @ SBG_ECOM_SYNC_IN_DISABLED
    Definition: sbgEComCmdEvent.h:65
    +
    @ SBG_ECOM_SYNC_IN_BOTH_EDGES
    Definition: sbgEComCmdEvent.h:68
    +
    @ SBG_ECOM_SYNC_IN_FALLING_EDGE
    Definition: sbgEComCmdEvent.h:66
    +
    Definition: sbgECom.h:81
    +
    Definition: sbgEComCmdEvent.h:124
    +
    int32_t delay
    Definition: sbgEComCmdEvent.h:126
    +
    SbgEComSyncInSensitivity sensitivity
    Definition: sbgEComCmdEvent.h:125
    +
    Definition: sbgEComCmdEvent.h:133
    +
    SbgEComSyncOutPolarity polarity
    Definition: sbgEComCmdEvent.h:135
    +
    uint32_t duration
    Definition: sbgEComCmdEvent.h:136
    +
    SbgEComSyncOutFunction outputFunction
    Definition: sbgEComCmdEvent.h:134
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_features_8h.html b/doc/html/sbg_e_com_cmd_features_8h.html new file mode 100644 index 0000000..88c2133 --- /dev/null +++ b/doc/html/sbg_e_com_cmd_features_8h.html @@ -0,0 +1,657 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdFeatures.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComCmdFeatures.h File Reference
    +
    +
    + +

    Commands used to query supported device features. +More...

    +
    #include <sbgCommon.h>
    +#include <sbgECom.h>
    +
    +

    Go to the source code of this file.

    + + + + +

    +Data Structures

    struct  _SbgEComFeatures
     
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    +Macros

    #define SBG_ECOM_SENSOR_FEATURE_IMU   (0x00000001 << 0)
     
    #define SBG_ECOM_SENSOR_FEATURE_AHRS   (0x00000001 << 1)
     
    #define SBG_ECOM_SENSOR_FEATURE_NAVIGATION   (0x00000001 << 2)
     
    #define SBG_ECOM_SENSOR_FEATURE_SHIP_MOTION   (0x00000001 << 3)
     
    #define SBG_ECOM_GNSS_SIGNAL_GPS_L1   (0x00000001 << 0)
     
    #define SBG_ECOM_GNSS_SIGNAL_GPS_L2   (0x00000001 << 1)
     
    #define SBG_ECOM_GNSS_SIGNAL_GPS_L5   (0x00000001 << 2)
     
    #define SBG_ECOM_GNSS_SIGNAL_GLONASS_L1   (0x00000001 << 3)
     
    #define SBG_ECOM_GNSS_SIGNAL_GLONASS_L2   (0x00000001 << 4)
     
    #define SBG_ECOM_GNSS_SIGNAL_BEIDOU_B1   (0x00000001 << 5)
     
    #define SBG_ECOM_GNSS_SIGNAL_BEIDOU_B2   (0x00000001 << 6)
     
    #define SBG_ECOM_GNSS_SIGNAL_BEIDOU_B3   (0x00000001 << 7)
     
    #define SBG_ECOM_GNSS_SIGNAL_GALILEO_E1   (0x00000001 << 8)
     
    #define SBG_ECOM_GNSS_SIGNAL_GALILEO_E5   (0x00000001 << 9)
     
    #define SBG_ECOM_GNSS_SIGNAL_GALILEO_E6   (0x00000001 << 10)
     
    #define SBG_ECOM_GNSS_SIGNAL_QZSS   (0x00000001 << 11)
     
    #define SBG_ECOM_GNSS_SIGNAL_SBAS   (0x00000001 << 12)
     
    #define SBG_ECOM_GNSS_SIGNAL_L_BAND   (0x00000001 << 13)
     
    #define SBG_ECOM_GNSS_FEATURE_DUAL_ANT   (0x00000001 << 0)
     
    #define SBG_ECOM_GNSS_FEATURE_RTK_LIMITED   (0x00000001 << 1)
     
    #define SBG_ECOM_GNSS_FEATURE_RTK   (0x00000001 << 2)
     
    #define SBG_ECOM_GNSS_FEATURE_PPP   (0x00000001 << 3)
     
    #define SBG_ECOM_GNSS_FEATURE_RAW_DATA   (0x00000001 << 4)
     
    #define SBG_ECOM_GNSS_FEATURE_RAIM   (0x00000001 << 5)
     
    #define SBG_ECOM_GNSS_FEATURE_HIGH_SPEED   (0x00000001 << 6)
     
    + + + + + +

    +Typedefs

    typedef enum _SbgEComGnssType SbgEComGnssType
     
    typedef struct _SbgEComFeatures SbgEComFeatures
     
    + + + +

    +Enumerations

    enum  _SbgEComGnssType {
    +  SBG_ECOM_GNSS_TYPE_DISABLED = 0 +,
    +  SBG_ECOM_GNSS_TYPE_EXTERNAL = 1 +,
    +  SBG_ECOM_GNSS_TYPE_UBX_MAX_M8 = 2 +,
    +  SBG_ECOM_GNSS_TYPE_NOV_OEM615 = 3 +,
    +  SBG_ECOM_GNSS_TYPE_NOV_OEM615_DUAL = 4 +,
    +  SBG_ECOM_GNSS_TYPE_NOV_OEM617D = 5 +,
    +  SBG_ECOM_GNSS_TYPE_SEP_AX4 = 6 +,
    +  SBG_ECOM_GNSS_TYPE_SEP_AXM2A = 7 +,
    +  SBG_ECOM_GNSS_TYPE_UBX_F9P = 8 +
    + }
     
    + + + +

    +Functions

    SbgErrorCode sbgEComCmdGetFeatures (SbgEComHandle *pHandle, SbgEComFeatures *pFeatures)
     
    +

    Detailed Description

    +

    Commands used to query supported device features.

    +
    Author
    SBG Systems
    +
    Date
    19 March 2015
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Macro Definition Documentation

    + +

    ◆ SBG_ECOM_SENSOR_FEATURE_IMU

    + +
    +
    + + + + +
    #define SBG_ECOM_SENSOR_FEATURE_IMU   (0x00000001 << 0)
    +
    +

    This unit can provide IMU data

    + +
    +
    + +

    ◆ SBG_ECOM_SENSOR_FEATURE_AHRS

    + +
    +
    + + + + +
    #define SBG_ECOM_SENSOR_FEATURE_AHRS   (0x00000001 << 1)
    +
    +

    This unit can provide orientation data
    +

    + +
    +
    + +

    ◆ SBG_ECOM_SENSOR_FEATURE_NAVIGATION

    + +
    +
    + + + + +
    #define SBG_ECOM_SENSOR_FEATURE_NAVIGATION   (0x00000001 << 2)
    +
    +

    This unit can provide position and velocity data

    + +
    +
    + +

    ◆ SBG_ECOM_SENSOR_FEATURE_SHIP_MOTION

    + +
    +
    + + + + +
    #define SBG_ECOM_SENSOR_FEATURE_SHIP_MOTION   (0x00000001 << 3)
    +
    +

    This unit can provide ship motion data output (heave)

    + +
    +
    + +

    ◆ SBG_ECOM_GNSS_SIGNAL_GPS_L1

    + +
    +
    + + + + +
    #define SBG_ECOM_GNSS_SIGNAL_GPS_L1   (0x00000001 << 0)
    +
    +

    This GNSS receiver tracks GPS L1 band.

    + +
    +
    + +

    ◆ SBG_ECOM_GNSS_SIGNAL_GPS_L2

    + +
    +
    + + + + +
    #define SBG_ECOM_GNSS_SIGNAL_GPS_L2   (0x00000001 << 1)
    +
    +

    This GNSS receiver tracks GPS L2 band.

    + +
    +
    + +

    ◆ SBG_ECOM_GNSS_SIGNAL_GPS_L5

    + +
    +
    + + + + +
    #define SBG_ECOM_GNSS_SIGNAL_GPS_L5   (0x00000001 << 2)
    +
    +

    This GNSS receiver tracks GPS L5 band.

    + +
    +
    + +

    ◆ SBG_ECOM_GNSS_SIGNAL_GLONASS_L1

    + +
    +
    + + + + +
    #define SBG_ECOM_GNSS_SIGNAL_GLONASS_L1   (0x00000001 << 3)
    +
    +

    This GNSS receiver tracks GLONASS L1 band.

    + +
    +
    + +

    ◆ SBG_ECOM_GNSS_SIGNAL_GLONASS_L2

    + +
    +
    + + + + +
    #define SBG_ECOM_GNSS_SIGNAL_GLONASS_L2   (0x00000001 << 4)
    +
    +

    This GNSS receiver tracks GLONASS L2 band.

    + +
    +
    + +

    ◆ SBG_ECOM_GNSS_SIGNAL_BEIDOU_B1

    + +
    +
    + + + + +
    #define SBG_ECOM_GNSS_SIGNAL_BEIDOU_B1   (0x00000001 << 5)
    +
    +

    This GNSS receiver tracks BEIDOU B1 band.

    + +
    +
    + +

    ◆ SBG_ECOM_GNSS_SIGNAL_BEIDOU_B2

    + +
    +
    + + + + +
    #define SBG_ECOM_GNSS_SIGNAL_BEIDOU_B2   (0x00000001 << 6)
    +
    +

    This GNSS receiver tracks BEIDOU B2 band.

    + +
    +
    + +

    ◆ SBG_ECOM_GNSS_SIGNAL_BEIDOU_B3

    + +
    +
    + + + + +
    #define SBG_ECOM_GNSS_SIGNAL_BEIDOU_B3   (0x00000001 << 7)
    +
    +

    This GNSS receiver tracks BEIDOU B3 band.

    + +
    +
    + +

    ◆ SBG_ECOM_GNSS_SIGNAL_GALILEO_E1

    + +
    +
    + + + + +
    #define SBG_ECOM_GNSS_SIGNAL_GALILEO_E1   (0x00000001 << 8)
    +
    +

    This GNSS receiver tracks GALILEO E1 band.

    + +
    +
    + +

    ◆ SBG_ECOM_GNSS_SIGNAL_GALILEO_E5

    + +
    +
    + + + + +
    #define SBG_ECOM_GNSS_SIGNAL_GALILEO_E5   (0x00000001 << 9)
    +
    +

    This GNSS receiver tracks GALILEO E5 band.

    + +
    +
    + +

    ◆ SBG_ECOM_GNSS_SIGNAL_GALILEO_E6

    + +
    +
    + + + + +
    #define SBG_ECOM_GNSS_SIGNAL_GALILEO_E6   (0x00000001 << 10)
    +
    +

    This GNSS receiver tracks GALILEO E6 band.

    + +
    +
    + +

    ◆ SBG_ECOM_GNSS_SIGNAL_QZSS

    + +
    +
    + + + + +
    #define SBG_ECOM_GNSS_SIGNAL_QZSS   (0x00000001 << 11)
    +
    +

    This GNSS receiver tracks QZSS signals

    + +
    +
    + +

    ◆ SBG_ECOM_GNSS_SIGNAL_SBAS

    + +
    +
    + + + + +
    #define SBG_ECOM_GNSS_SIGNAL_SBAS   (0x00000001 << 12)
    +
    +

    This GNSS receiver tracks SBAS signals

    + +
    +
    + +

    ◆ SBG_ECOM_GNSS_SIGNAL_L_BAND

    + +
    +
    + + + + +
    #define SBG_ECOM_GNSS_SIGNAL_L_BAND   (0x00000001 << 13)
    +
    +

    This GNSS receiver tracks L-Band (for PPP services)

    + +
    +
    + +

    ◆ SBG_ECOM_GNSS_FEATURE_DUAL_ANT

    + +
    +
    + + + + +
    #define SBG_ECOM_GNSS_FEATURE_DUAL_ANT   (0x00000001 << 0)
    +
    +

    This GNSS receiver provides a dual antenna heading

    + +
    +
    + +

    ◆ SBG_ECOM_GNSS_FEATURE_RTK_LIMITED

    + +
    +
    + + + + +
    #define SBG_ECOM_GNSS_FEATURE_RTK_LIMITED   (0x00000001 << 1)
    +
    +

    This GNSS receiver has limited RTK accuracy (eg. Trimble RTK 30/30)
    +

    + +
    +
    + +

    ◆ SBG_ECOM_GNSS_FEATURE_RTK

    + +
    +
    + + + + +
    #define SBG_ECOM_GNSS_FEATURE_RTK   (0x00000001 << 2)
    +
    +

    This GNSS receiver provides full RTK accuracy

    + +
    +
    + +

    ◆ SBG_ECOM_GNSS_FEATURE_PPP

    + +
    +
    + + + + +
    #define SBG_ECOM_GNSS_FEATURE_PPP   (0x00000001 << 3)
    +
    +

    This GNSS receiver provides PPP computations

    + +
    +
    + +

    ◆ SBG_ECOM_GNSS_FEATURE_RAW_DATA

    + +
    +
    + + + + +
    #define SBG_ECOM_GNSS_FEATURE_RAW_DATA   (0x00000001 << 4)
    +
    +

    This GNSS receiver provides RAW data output

    + +
    +
    + +

    ◆ SBG_ECOM_GNSS_FEATURE_RAIM

    + +
    +
    + + + + +
    #define SBG_ECOM_GNSS_FEATURE_RAIM   (0x00000001 << 5)
    +
    +

    This GNSS receiver provides Receiver Autonomous Integrity Monitoring

    + +
    +
    + +

    ◆ SBG_ECOM_GNSS_FEATURE_HIGH_SPEED

    + +
    +
    + + + + +
    #define SBG_ECOM_GNSS_FEATURE_HIGH_SPEED   (0x00000001 << 6)
    +
    +

    This GNSS receiver has no high speed limitation (> 515m/s)

    + +
    +
    +

    Typedef Documentation

    + +

    ◆ SbgEComGnssType

    + +
    +
    + + + + +
    typedef enum _SbgEComGnssType SbgEComGnssType
    +
    +

    This enum defines the different types of internal GNSS receiver that can provide specific features. Note External type is considered as not handled by the feature system

    + +
    +
    + +

    ◆ SbgEComFeatures

    + +
    +
    + + + + +
    typedef struct _SbgEComFeatures SbgEComFeatures
    +
    +

    This structure contains all the information provided by the SBG_ECOM_CMD_GET_FEATURES command

    + +
    +
    +

    Enumeration Type Documentation

    + +

    ◆ _SbgEComGnssType

    + +
    +
    + + + + +
    enum _SbgEComGnssType
    +
    +

    This enum defines the different types of internal GNSS receiver that can provide specific features. Note External type is considered as not handled by the feature system

    + + + + + + + + + + +
    Enumerator
    SBG_ECOM_GNSS_TYPE_DISABLED 

    GNSS module disabled

    +
    SBG_ECOM_GNSS_TYPE_EXTERNAL 

    External GNSS module (all features are unknown)

    +
    SBG_ECOM_GNSS_TYPE_UBX_MAX_M8 

    Ublox MAX-M8 module

    +
    SBG_ECOM_GNSS_TYPE_NOV_OEM615 

    Novatel OEM615 device

    +
    SBG_ECOM_GNSS_TYPE_NOV_OEM615_DUAL 

    Two Novatel OEM615 devices for dual antenna

    +
    SBG_ECOM_GNSS_TYPE_NOV_OEM617D 

    Novatel OEM617D device

    +
    SBG_ECOM_GNSS_TYPE_SEP_AX4 

    Septentrio Asterx m4

    +
    SBG_ECOM_GNSS_TYPE_SEP_AXM2A 

    Septentrio Asterx m2a

    +
    SBG_ECOM_GNSS_TYPE_UBX_F9P 

    Ublox ZED-F9P module

    +
    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgEComCmdGetFeatures()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdGetFeatures (SbgEComHandlepHandle,
    SbgEComFeaturespFeatures 
    )
    +
    +

    Retrieve the device and embedded GPS receiver features.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [in]pFeaturesA pointer to a structure to hold features.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_features_8h_source.html b/doc/html/sbg_e_com_cmd_features_8h_source.html new file mode 100644 index 0000000..78e1288 --- /dev/null +++ b/doc/html/sbg_e_com_cmd_features_8h_source.html @@ -0,0 +1,171 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdFeatures.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComCmdFeatures.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_CMD_FEATURES_H
    +
    33#define SBG_ECOM_CMD_FEATURES_H
    +
    34
    +
    35// sbgCommonLib headers
    +
    36#include <sbgCommon.h>
    +
    37
    +
    38// Project headers
    +
    39#include <sbgECom.h>
    +
    40
    +
    41#ifdef __cplusplus
    +
    42extern "C" {
    +
    43#endif
    +
    44
    +
    45//----------------------------------------------------------------------//
    +
    46//- Feature commands definitions -//
    +
    47//----------------------------------------------------------------------//
    +
    48
    +
    49//
    +
    50// Main sensor features
    +
    51//
    +
    52#define SBG_ECOM_SENSOR_FEATURE_IMU (0x00000001 << 0)
    +
    53#define SBG_ECOM_SENSOR_FEATURE_AHRS (0x00000001 << 1)
    +
    54#define SBG_ECOM_SENSOR_FEATURE_NAVIGATION (0x00000001 << 2)
    +
    55#define SBG_ECOM_SENSOR_FEATURE_SHIP_MOTION (0x00000001 << 3)
    +
    57//
    +
    58// GPS Signals bitmask defining every signal
    +
    59//
    +
    60#define SBG_ECOM_GNSS_SIGNAL_GPS_L1 (0x00000001 << 0)
    +
    61#define SBG_ECOM_GNSS_SIGNAL_GPS_L2 (0x00000001 << 1)
    +
    62#define SBG_ECOM_GNSS_SIGNAL_GPS_L5 (0x00000001 << 2)
    +
    63#define SBG_ECOM_GNSS_SIGNAL_GLONASS_L1 (0x00000001 << 3)
    +
    64#define SBG_ECOM_GNSS_SIGNAL_GLONASS_L2 (0x00000001 << 4)
    +
    65#define SBG_ECOM_GNSS_SIGNAL_BEIDOU_B1 (0x00000001 << 5)
    +
    66#define SBG_ECOM_GNSS_SIGNAL_BEIDOU_B2 (0x00000001 << 6)
    +
    67#define SBG_ECOM_GNSS_SIGNAL_BEIDOU_B3 (0x00000001 << 7)
    +
    68#define SBG_ECOM_GNSS_SIGNAL_GALILEO_E1 (0x00000001 << 8)
    +
    69#define SBG_ECOM_GNSS_SIGNAL_GALILEO_E5 (0x00000001 << 9)
    +
    70#define SBG_ECOM_GNSS_SIGNAL_GALILEO_E6 (0x00000001 << 10)
    +
    71#define SBG_ECOM_GNSS_SIGNAL_QZSS (0x00000001 << 11)
    +
    72#define SBG_ECOM_GNSS_SIGNAL_SBAS (0x00000001 << 12)
    +
    73#define SBG_ECOM_GNSS_SIGNAL_L_BAND (0x00000001 << 13)
    +
    75//
    +
    76// GPS capabilities
    +
    77//
    +
    78#define SBG_ECOM_GNSS_FEATURE_DUAL_ANT (0x00000001 << 0)
    +
    79#define SBG_ECOM_GNSS_FEATURE_RTK_LIMITED (0x00000001 << 1)
    +
    80#define SBG_ECOM_GNSS_FEATURE_RTK (0x00000001 << 2)
    +
    81#define SBG_ECOM_GNSS_FEATURE_PPP (0x00000001 << 3)
    +
    82#define SBG_ECOM_GNSS_FEATURE_RAW_DATA (0x00000001 << 4)
    +
    83#define SBG_ECOM_GNSS_FEATURE_RAIM (0x00000001 << 5)
    +
    84#define SBG_ECOM_GNSS_FEATURE_HIGH_SPEED (0x00000001 << 6)
    +
    86//----------------------------------------------------------------------//
    +
    87//- Feature commands types definition -//
    +
    88//----------------------------------------------------------------------//
    +
    89
    +
    94typedef enum _SbgEComGnssType
    +
    95{
    + + + + + + + + + + +
    106
    +
    110typedef struct _SbgEComFeatures
    +
    111{
    + + + + + + + + + +
    121
    +
    122//----------------------------------------------------------------------//
    +
    123//- Public methods -//
    +
    124//----------------------------------------------------------------------//
    +
    125
    +
    133SbgErrorCode sbgEComCmdGetFeatures(SbgEComHandle *pHandle, SbgEComFeatures *pFeatures);
    +
    134
    +
    135#ifdef __cplusplus
    +
    136}
    +
    137#endif
    +
    138
    +
    139#endif // SBG_ECOM_CMD_FEATURES_H
    +
    Contains main sbgECom methods.
    +
    enum _SbgEComGnssType SbgEComGnssType
    +
    struct _SbgEComFeatures SbgEComFeatures
    +
    SbgErrorCode sbgEComCmdGetFeatures(SbgEComHandle *pHandle, SbgEComFeatures *pFeatures)
    +
    _SbgEComGnssType
    Definition: sbgEComCmdFeatures.h:95
    +
    @ SBG_ECOM_GNSS_TYPE_NOV_OEM615
    Definition: sbgEComCmdFeatures.h:99
    +
    @ SBG_ECOM_GNSS_TYPE_UBX_F9P
    Definition: sbgEComCmdFeatures.h:104
    +
    @ SBG_ECOM_GNSS_TYPE_SEP_AX4
    Definition: sbgEComCmdFeatures.h:102
    +
    @ SBG_ECOM_GNSS_TYPE_DISABLED
    Definition: sbgEComCmdFeatures.h:96
    +
    @ SBG_ECOM_GNSS_TYPE_NOV_OEM615_DUAL
    Definition: sbgEComCmdFeatures.h:100
    +
    @ SBG_ECOM_GNSS_TYPE_UBX_MAX_M8
    Definition: sbgEComCmdFeatures.h:98
    +
    @ SBG_ECOM_GNSS_TYPE_SEP_AXM2A
    Definition: sbgEComCmdFeatures.h:103
    +
    @ SBG_ECOM_GNSS_TYPE_EXTERNAL
    Definition: sbgEComCmdFeatures.h:97
    +
    @ SBG_ECOM_GNSS_TYPE_NOV_OEM617D
    Definition: sbgEComCmdFeatures.h:101
    +
    Definition: sbgEComCmdFeatures.h:111
    +
    SbgEComGnssType gnssType
    Definition: sbgEComCmdFeatures.h:113
    +
    uint32_t gnssFeaturesMask
    Definition: sbgEComCmdFeatures.h:116
    +
    char gnssSerialNumber[32]
    Definition: sbgEComCmdFeatures.h:118
    +
    uint32_t gnssSignalsMask
    Definition: sbgEComCmdFeatures.h:115
    +
    uint32_t sensorFeaturesMask
    Definition: sbgEComCmdFeatures.h:112
    +
    uint8_t gnssUpdateRate
    Definition: sbgEComCmdFeatures.h:114
    +
    char gnssFirmwareVersion[32]
    Definition: sbgEComCmdFeatures.h:119
    +
    char gnssProductCode[32]
    Definition: sbgEComCmdFeatures.h:117
    +
    Definition: sbgECom.h:81
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_gnss_8h.html b/doc/html/sbg_e_com_cmd_gnss_8h.html new file mode 100644 index 0000000..29997f3 --- /dev/null +++ b/doc/html/sbg_e_com_cmd_gnss_8h.html @@ -0,0 +1,497 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdGnss.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComCmdGnss.h File Reference
    +
    +
    + +

    GNSS aiding module configuration commands. +More...

    +
    #include <sbgCommon.h>
    +#include <sbgECom.h>
    +#include "sbgEComCmdCommon.h"
    +
    +

    Go to the source code of this file.

    + + + + + + +

    +Data Structures

    struct  _SbgEComGnssInstallation
     
    struct  _SbgEComGnssRejectionConf
     
    + + + + + + + + + +

    +Typedefs

    typedef enum _SbgEComGnssModelsStdIds SbgEComGnssModelsStdIds
     
    typedef enum _SbgEComGnssInstallationMode SbgEComGnssInstallationMode
     
    typedef struct _SbgEComGnssInstallation SbgEComGnssInstallation
     
    typedef struct _SbgEComGnssRejectionConf SbgEComGnssRejectionConf
     
    + + + + + +

    +Enumerations

    enum  _SbgEComGnssModelsStdIds {
    +  SBG_ECOM_GNSS_MODEL_INTERNAL = 101 +,
    +  SBG_ECOM_GNSS_MODEL_NMEA = 102 +,
    +  SBG_ECOM_GNSS_MODEL_UBLOX_GPS_BEIDOU = 103 +,
    +  SBG_ECOM_GNSS_MODEL_UBLOX_EXTERNAL = 104 +,
    +  SBG_ECOM_GNSS_MODEL_RESERVED_01 = 105 +,
    +  SBG_ECOM_GNSS_MODEL_NOVATEL_EXTERNAL = 106 +,
    +  SBG_ECOM_GNSS_MODEL_RESERVED_02 = 107 +,
    +  SBG_ECOM_GNSS_MODEL_RESERVED_03 = 108 +,
    +  SBG_ECOM_GNSS_MODEL_SEPTENTRIO_EXTERNAL = 109 +,
    +  SBG_ECOM_GNSS_MODEL_RESERVED_04 = 110 +
    + }
     
    enum  _SbgEComGnssInstallationMode {
    +  SBG_ECOM_GNSS_INSTALLATION_MODE_SINGLE = 1 +,
    +  SBG_ECOM_GNSS_INSTALLATION_MODE_DUAL_AUTO = 2 +,
    +  SBG_ECOM_GNSS_INSTALLATION_MODE_DUAL_ROUGH = 3 +,
    +  SBG_ECOM_GNSS_INSTALLATION_MODE_DUAL_PRECISE = 4 +
    + }
     
    + + + + + + + + + + + + + +

    +Functions

    SbgErrorCode sbgEComCmdGnss1SetModelId (SbgEComHandle *pHandle, SbgEComGnssModelsStdIds modelId)
     
    SbgErrorCode sbgEComCmdGnss1GetModelId (SbgEComHandle *pHandle, SbgEComGnssModelsStdIds *pModelId)
     
    SbgErrorCode sbgEComCmdGnss1InstallationGet (SbgEComHandle *pHandle, SbgEComGnssInstallation *pGnssInstallation)
     
    SbgErrorCode sbgEComCmdGnss1InstallationSet (SbgEComHandle *pHandle, const SbgEComGnssInstallation *pGnssInstallation)
     
    SbgErrorCode sbgEComCmdGnss1GetRejection (SbgEComHandle *pHandle, SbgEComGnssRejectionConf *pRejectConf)
     
    SbgErrorCode sbgEComCmdGnss1SetRejection (SbgEComHandle *pHandle, const SbgEComGnssRejectionConf *pRejectConf)
     
    +

    Detailed Description

    +

    GNSS aiding module configuration commands.

    +
    Author
    SBG Systems
    +
    Date
    11 June 2014
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Typedef Documentation

    + +

    ◆ SbgEComGnssModelsStdIds

    + +
    +
    +

    This enum defines the different GNSS model IDs available in standard

    + +
    +
    + +

    ◆ SbgEComGnssInstallationMode

    + +
    +
    +

    GNSS mechanical installation modes for the dual antenna mode.

    + +
    +
    + +

    ◆ SbgEComGnssInstallation

    + +
    +
    +

    GNSS mechanical installation parameters to be used with command SBG_ECOM_CMD_GNSS_::_INSTALLATION

    + +
    +
    + +

    ◆ SbgEComGnssRejectionConf

    + +
    +
    +

    Holds all necessary information for GNSS module data rejection.

    + +
    +
    +

    Enumeration Type Documentation

    + +

    ◆ _SbgEComGnssModelsStdIds

    + +
    +
    + + + + +
    enum _SbgEComGnssModelsStdIds
    +
    +

    This enum defines the different GNSS model IDs available in standard

    + + + + + + + + + + + +
    Enumerator
    SBG_ECOM_GNSS_MODEL_INTERNAL 

    Default internal GNSS for ELLIPSE-N and ELLIPSE-D

    +
    SBG_ECOM_GNSS_MODEL_NMEA 

    ELLIPSE-E to accept an external GNSS using NMEA protocol

    +
    SBG_ECOM_GNSS_MODEL_UBLOX_GPS_BEIDOU 

    Only for ELLIPSE-N hardware 1 & 2 to select GPS+BEIDOU instead of the default GPS+GLONASS

    +
    SBG_ECOM_GNSS_MODEL_UBLOX_EXTERNAL 

    ELLIPSE-E to accept an external Ublox GNSS (receive only - passive)

    +
    SBG_ECOM_GNSS_MODEL_RESERVED_01 

    Reserved, do not use

    +
    SBG_ECOM_GNSS_MODEL_NOVATEL_EXTERNAL 

    ELLIPSE-E to accept an external Novatel GNSS (receive only - passive)

    +
    SBG_ECOM_GNSS_MODEL_RESERVED_02 

    Reserved, do not use

    +
    SBG_ECOM_GNSS_MODEL_RESERVED_03 

    Reserved, do not use

    +
    SBG_ECOM_GNSS_MODEL_SEPTENTRIO_EXTERNAL 

    ELLIPSE-E to accept an external Septentrio GNSS(receive only - passive)

    +
    SBG_ECOM_GNSS_MODEL_RESERVED_04 

    Reserved, do not use

    +
    + +
    +
    + +

    ◆ _SbgEComGnssInstallationMode

    + +
    +
    +

    GNSS mechanical installation modes for the dual antenna mode.

    + + + + + +
    Enumerator
    SBG_ECOM_GNSS_INSTALLATION_MODE_SINGLE 

    The GNSS will be used in single antenna mode only and the secondary lever arm is not used.

    +
    SBG_ECOM_GNSS_INSTALLATION_MODE_DUAL_AUTO 

    [Reserved] The GNSS dual antenna information will be used but the secondary lever arm is not known.

    +
    SBG_ECOM_GNSS_INSTALLATION_MODE_DUAL_ROUGH 

    The GNSS dual antenna information will be used and we have a rough guess for the secondary lever arm.

    +
    SBG_ECOM_GNSS_INSTALLATION_MODE_DUAL_PRECISE 

    The GNSS dual antenna information will be used and the secondary lever arm is accurately entered and doesn't need online re-estimation.

    +
    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgEComCmdGnss1SetModelId()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdGnss1SetModelId (SbgEComHandlepHandle,
    SbgEComGnssModelsStdIds modelId 
    )
    +
    +

    Set GNSS error model id.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [in]modelIdModel ID to set
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdGnss1GetModelId()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdGnss1GetModelId (SbgEComHandlepHandle,
    SbgEComGnssModelsStdIdspModelId 
    )
    +
    +

    Retrieve GNSS error model id.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [out]pModelIdRetrieved model id.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdGnss1InstallationGet()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdGnss1InstallationGet (SbgEComHandlepHandle,
    SbgEComGnssInstallationpGnssInstallation 
    )
    +
    +

    Retrieve the mechanical installation parameters for the GNSS 1 module.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [out]pGnssInstallationUsed to store the retrieved the GNSS installation parameters.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdGnss1InstallationSet()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdGnss1InstallationSet (SbgEComHandlepHandle,
    const SbgEComGnssInstallationpGnssInstallation 
    )
    +
    +

    Set the mechanical installation parameters for the GNSS 1 module.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [in]pGnssInstallationThe GNSS installation parameters to set.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdGnss1GetRejection()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdGnss1GetRejection (SbgEComHandlepHandle,
    SbgEComGnssRejectionConfpRejectConf 
    )
    +
    +

    Retrieve the rejection configuration of the gnss module.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [out]pRejectConfPointer to a SbgEComGnssRejectionConf struct to hold rejection configuration of the gnss module.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdGnss1SetRejection()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdGnss1SetRejection (SbgEComHandlepHandle,
    const SbgEComGnssRejectionConfpRejectConf 
    )
    +
    +

    Set the rejection configuration of the gnss module.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [out]pRejectConfPointer to a SbgEComGnssRejectionConf struct holding rejection configuration for the gnss module.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_gnss_8h_source.html b/doc/html/sbg_e_com_cmd_gnss_8h_source.html new file mode 100644 index 0000000..63ec3e0 --- /dev/null +++ b/doc/html/sbg_e_com_cmd_gnss_8h_source.html @@ -0,0 +1,173 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdGnss.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComCmdGnss.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_CMD_GNSS_H
    +
    33#define SBG_ECOM_CMD_GNSS_H
    +
    34
    +
    35// sbgCommonLib headers
    +
    36#include <sbgCommon.h>
    +
    37
    +
    38// Project headers
    +
    39#include <sbgECom.h>
    +
    40
    +
    41// Local headers
    +
    42#include "sbgEComCmdCommon.h"
    +
    43
    +
    44#ifdef __cplusplus
    +
    45extern "C" {
    +
    46#endif
    +
    47
    +
    48//----------------------------------------------------------------------//
    +
    49//- Public definitions -//
    +
    50//----------------------------------------------------------------------//
    +
    51
    + +
    56{
    + + + + + + + + + + + +
    68
    + +
    73{
    + + + + + +
    79
    + +
    84{
    +
    85 float leverArmPrimary[3];
    + + + + +
    91
    + +
    96{
    + + + + +
    101
    +
    102//----------------------------------------------------------------------//
    +
    103//- Public methods -//
    +
    104//----------------------------------------------------------------------//
    +
    105
    + +
    114
    + +
    123
    + +
    132
    +
    140SbgErrorCode sbgEComCmdGnss1InstallationSet(SbgEComHandle *pHandle, const SbgEComGnssInstallation *pGnssInstallation);
    +
    141
    + +
    150
    +
    158SbgErrorCode sbgEComCmdGnss1SetRejection(SbgEComHandle *pHandle, const SbgEComGnssRejectionConf *pRejectConf);
    +
    159
    +
    160#ifdef __cplusplus
    +
    161}
    +
    162#endif
    +
    163
    +
    164#endif // SBG_ECOM_CMD_GNSS_H
    +
    Contains main sbgECom methods.
    +
    Definitions and methods common to all commands.
    +
    enum _SbgEComRejectionMode SbgEComRejectionMode
    +
    SbgErrorCode sbgEComCmdGnss1InstallationGet(SbgEComHandle *pHandle, SbgEComGnssInstallation *pGnssInstallation)
    +
    SbgErrorCode sbgEComCmdGnss1SetRejection(SbgEComHandle *pHandle, const SbgEComGnssRejectionConf *pRejectConf)
    +
    enum _SbgEComGnssModelsStdIds SbgEComGnssModelsStdIds
    +
    struct _SbgEComGnssInstallation SbgEComGnssInstallation
    +
    SbgErrorCode sbgEComCmdGnss1SetModelId(SbgEComHandle *pHandle, SbgEComGnssModelsStdIds modelId)
    +
    _SbgEComGnssInstallationMode
    Definition: sbgEComCmdGnss.h:73
    +
    @ SBG_ECOM_GNSS_INSTALLATION_MODE_DUAL_ROUGH
    Definition: sbgEComCmdGnss.h:76
    +
    @ SBG_ECOM_GNSS_INSTALLATION_MODE_SINGLE
    Definition: sbgEComCmdGnss.h:74
    +
    @ SBG_ECOM_GNSS_INSTALLATION_MODE_DUAL_PRECISE
    Definition: sbgEComCmdGnss.h:77
    +
    @ SBG_ECOM_GNSS_INSTALLATION_MODE_DUAL_AUTO
    Definition: sbgEComCmdGnss.h:75
    +
    SbgErrorCode sbgEComCmdGnss1GetModelId(SbgEComHandle *pHandle, SbgEComGnssModelsStdIds *pModelId)
    +
    struct _SbgEComGnssRejectionConf SbgEComGnssRejectionConf
    +
    SbgErrorCode sbgEComCmdGnss1InstallationSet(SbgEComHandle *pHandle, const SbgEComGnssInstallation *pGnssInstallation)
    +
    enum _SbgEComGnssInstallationMode SbgEComGnssInstallationMode
    +
    _SbgEComGnssModelsStdIds
    Definition: sbgEComCmdGnss.h:56
    +
    @ SBG_ECOM_GNSS_MODEL_NMEA
    Definition: sbgEComCmdGnss.h:58
    +
    @ SBG_ECOM_GNSS_MODEL_UBLOX_GPS_BEIDOU
    Definition: sbgEComCmdGnss.h:59
    +
    @ SBG_ECOM_GNSS_MODEL_INTERNAL
    Definition: sbgEComCmdGnss.h:57
    +
    @ SBG_ECOM_GNSS_MODEL_RESERVED_02
    Definition: sbgEComCmdGnss.h:63
    +
    @ SBG_ECOM_GNSS_MODEL_RESERVED_04
    Definition: sbgEComCmdGnss.h:66
    +
    @ SBG_ECOM_GNSS_MODEL_UBLOX_EXTERNAL
    Definition: sbgEComCmdGnss.h:60
    +
    @ SBG_ECOM_GNSS_MODEL_RESERVED_03
    Definition: sbgEComCmdGnss.h:64
    +
    @ SBG_ECOM_GNSS_MODEL_SEPTENTRIO_EXTERNAL
    Definition: sbgEComCmdGnss.h:65
    +
    @ SBG_ECOM_GNSS_MODEL_RESERVED_01
    Definition: sbgEComCmdGnss.h:61
    +
    @ SBG_ECOM_GNSS_MODEL_NOVATEL_EXTERNAL
    Definition: sbgEComCmdGnss.h:62
    +
    SbgErrorCode sbgEComCmdGnss1GetRejection(SbgEComHandle *pHandle, SbgEComGnssRejectionConf *pRejectConf)
    +
    Definition: sbgEComCmdGnss.h:84
    +
    float leverArmPrimary[3]
    Definition: sbgEComCmdGnss.h:85
    +
    float leverArmSecondary[3]
    Definition: sbgEComCmdGnss.h:88
    +
    bool leverArmPrimaryPrecise
    Definition: sbgEComCmdGnss.h:86
    +
    SbgEComGnssInstallationMode leverArmSecondaryMode
    Definition: sbgEComCmdGnss.h:89
    +
    Definition: sbgEComCmdGnss.h:96
    +
    SbgEComRejectionMode position
    Definition: sbgEComCmdGnss.h:97
    +
    SbgEComRejectionMode hdt
    Definition: sbgEComCmdGnss.h:99
    +
    SbgEComRejectionMode velocity
    Definition: sbgEComCmdGnss.h:98
    +
    Definition: sbgECom.h:81
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_info_8h.html b/doc/html/sbg_e_com_cmd_info_8h.html new file mode 100644 index 0000000..e48552c --- /dev/null +++ b/doc/html/sbg_e_com_cmd_info_8h.html @@ -0,0 +1,147 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdInfo.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComCmdInfo.h File Reference
    +
    +
    + +

    Commands used to query the device information. +More...

    +
    #include <sbgCommon.h>
    +#include <sbgECom.h>
    +
    +

    Go to the source code of this file.

    + + + + +

    +Data Structures

    struct  _SbgEComDeviceInfo
     
    + + + +

    +Typedefs

    typedef struct _SbgEComDeviceInfo SbgEComDeviceInfo
     
    + + + +

    +Functions

    SbgErrorCode sbgEComCmdGetInfo (SbgEComHandle *pHandle, SbgEComDeviceInfo *pInfo)
     
    +

    Detailed Description

    +

    Commands used to query the device information.

    +
    Author
    SBG Systems
    +
    Date
    11 June 2014
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Typedef Documentation

    + +

    ◆ SbgEComDeviceInfo

    + +
    +
    + + + + +
    typedef struct _SbgEComDeviceInfo SbgEComDeviceInfo
    +
    +

    Helper structure to retrieve device info.

    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgEComCmdGetInfo()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdGetInfo (SbgEComHandlepHandle,
    SbgEComDeviceInfopInfo 
    )
    +
    +

    Retrieve the device information.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [in]pInfoA pointer to a structure to hold device information.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_info_8h_source.html b/doc/html/sbg_e_com_cmd_info_8h_source.html new file mode 100644 index 0000000..bb9d1e0 --- /dev/null +++ b/doc/html/sbg_e_com_cmd_info_8h_source.html @@ -0,0 +1,116 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdInfo.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComCmdInfo.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_CMD_INFO_H
    +
    33#define SBG_ECOM_CMD_INFO_H
    +
    34
    +
    35// sbgCommonLib headers
    +
    36#include <sbgCommon.h>
    +
    37
    +
    38// Project headers
    +
    39#include <sbgECom.h>
    +
    40
    +
    41#ifdef __cplusplus
    +
    42extern "C" {
    +
    43#endif
    +
    44
    +
    45//----------------------------------------------------------------------//
    +
    46//- Device info definitions -//
    +
    47//----------------------------------------------------------------------//
    +
    48
    +
    49/* Misc */
    +
    50#define SBG_ECOM_INFO_PRODUCT_CODE_LENGTH (32)
    +
    51
    +
    52//----------------------------------------------------------------------//
    +
    53//- Device Info structure -//
    +
    54//----------------------------------------------------------------------//
    +
    55
    +
    59typedef struct _SbgEComDeviceInfo
    +
    60{
    +
    61 uint8_t productCode[SBG_ECOM_INFO_PRODUCT_CODE_LENGTH];
    +
    62 uint32_t serialNumber;
    +
    63 uint32_t calibationRev;
    +
    64 uint16_t calibrationYear;
    + + +
    67 uint32_t hardwareRev;
    +
    68 uint32_t firmwareRev;
    + +
    70
    +
    71//----------------------------------------------------------------------//
    +
    72//- Public methods -//
    +
    73//----------------------------------------------------------------------//
    +
    74
    +
    82SbgErrorCode sbgEComCmdGetInfo(SbgEComHandle *pHandle, SbgEComDeviceInfo *pInfo);
    +
    83
    +
    84#ifdef __cplusplus
    +
    85}
    +
    86#endif
    +
    87
    +
    88#endif // SBG_ECOM_CMD_INFO_H
    +
    Contains main sbgECom methods.
    +
    struct _SbgEComDeviceInfo SbgEComDeviceInfo
    +
    SbgErrorCode sbgEComCmdGetInfo(SbgEComHandle *pHandle, SbgEComDeviceInfo *pInfo)
    +
    Definition: sbgEComCmdInfo.h:60
    +
    uint16_t calibrationYear
    Definition: sbgEComCmdInfo.h:64
    +
    uint32_t calibationRev
    Definition: sbgEComCmdInfo.h:63
    +
    uint32_t serialNumber
    Definition: sbgEComCmdInfo.h:62
    +
    uint32_t hardwareRev
    Definition: sbgEComCmdInfo.h:67
    +
    uint8_t calibrationDay
    Definition: sbgEComCmdInfo.h:66
    +
    uint32_t firmwareRev
    Definition: sbgEComCmdInfo.h:68
    +
    uint8_t productCode[SBG_ECOM_INFO_PRODUCT_CODE_LENGTH]
    Definition: sbgEComCmdInfo.h:61
    +
    uint8_t calibrationMonth
    Definition: sbgEComCmdInfo.h:65
    +
    Definition: sbgECom.h:81
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_interface_8h.html b/doc/html/sbg_e_com_cmd_interface_8h.html new file mode 100644 index 0000000..d793d39 --- /dev/null +++ b/doc/html/sbg_e_com_cmd_interface_8h.html @@ -0,0 +1,559 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdInterface.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComCmdInterface.h File Reference
    +
    +
    + +

    Commands used to configure device serial, CAN and Ethernet interfaces. +More...

    +
    #include <sbgCommon.h>
    +#include <sbgECom.h>
    +
    +

    Go to the source code of this file.

    + + + + +

    +Data Structures

    struct  _SbgEComInterfaceConf
     
    + + + + + + + + + + + +

    +Typedefs

    typedef enum _SbgEComPortId SbgEComPortId
     
    typedef enum _SbgEComPortMode SbgEComPortMode
     
    typedef struct _SbgEComInterfaceConf SbgEComInterfaceConf
     
    typedef enum _SbgEComCanBitRate SbgEComCanBitRate
     
    typedef enum _SbgEComCanMode SbgEComCanMode
     
    + + + + + + + + + +

    +Enumerations

    enum  _SbgEComPortId {
    +  SBG_ECOM_IF_COM_A = 0 +,
    +  SBG_ECOM_IF_COM_B = 1 +,
    +  SBG_ECOM_IF_COM_C = 2 +,
    +  SBG_ECOM_IF_COM_D = 3 +,
    +  SBG_ECOM_IF_COM_E = 4 +,
    +  SBG_ECOM_IF_ETH_0 = 10 +,
    +  SBG_ECOM_IF_ETH_1 = 11 +,
    +  SBG_ECOM_IF_ETH_2 = 12 +,
    +  SBG_ECOM_IF_ETH_3 = 13 +,
    +  SBG_ECOM_IF_ETH_4 = 14 +,
    +  SBG_ECOM_IF_DATA_LOGGER = 20 +
    + }
     
    enum  _SbgEComPortMode {
    +  SBG_ECOM_UART_MODE_OFF = 0 +,
    +  SBG_ECOM_UART_MODE_232 = 1 +,
    +  SBG_ECOM_UART_MODE_422 = 2 +
    + }
     
    enum  _SbgEComCanBitRate {
    +  SBG_ECOM_CAN_BITRATE_DISABLED = 0 +,
    +  SBG_ECOM_CAN_BITRATE_10 = 10 +,
    +  SBG_ECOM_CAN_BITRATE_20 = 20 +,
    +  SBG_ECOM_CAN_BITRATE_25 = 25 +,
    +  SBG_ECOM_CAN_BITRATE_50 = 50 +,
    +  SBG_ECOM_CAN_BITRATE_100 = 100 +,
    +  SBG_ECOM_CAN_BITRATE_125 = 125 +,
    +  SBG_ECOM_CAN_BITRATE_250 = 250 +,
    +  SBG_ECOM_CAN_BITRATE_500 = 500 +,
    +  SBG_ECOM_CAN_BITRATE_750 = 750 +,
    +  SBG_ECOM_CAN_BITRATE_1000 = 1000 +
    + }
     
    enum  _SbgEComCanMode {
    +  SBG_ECOM_CAN_MODE_UNDEFINED = 0 +,
    +  SBG_ECOM_CAN_MODE_SPY = 1 +,
    +  SBG_ECOM_CAN_MODE_NORMAL = 2 +,
    +  SBG_ECOM_CAN_NR_MODE +
    + }
     
    + + + + + + + + + +

    +Functions

    SbgErrorCode sbgEComCmdInterfaceGetUartConf (SbgEComHandle *pHandle, SbgEComPortId interfaceId, SbgEComInterfaceConf *pConf)
     
    SbgErrorCode sbgEComCmdInterfaceSetUartConf (SbgEComHandle *pHandle, SbgEComPortId interfaceId, const SbgEComInterfaceConf *pConf)
     
    SbgErrorCode sbgEComCmdInterfaceGetCanConf (SbgEComHandle *pHandle, SbgEComCanBitRate *pBitrate, SbgEComCanMode *pMode)
     
    SbgErrorCode sbgEComCmdInterfaceSetCanConf (SbgEComHandle *pHandle, SbgEComCanBitRate bitRate, SbgEComCanMode mode)
     
    +

    Detailed Description

    +

    Commands used to configure device serial, CAN and Ethernet interfaces.

    +
    Author
    SBG Systems
    +
    Date
    11 June 2014
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Typedef Documentation

    + +

    ◆ SbgEComPortId

    + +
    +
    + + + + +
    typedef enum _SbgEComPortId SbgEComPortId
    +
    +

    List of serial interfaces available.

    + +
    +
    + +

    ◆ SbgEComPortMode

    + +
    +
    + + + + +
    typedef enum _SbgEComPortMode SbgEComPortMode
    +
    +

    List of serial modes available.

    + +
    +
    + +

    ◆ SbgEComInterfaceConf

    + +
    +
    + + + + +
    typedef struct _SbgEComInterfaceConf SbgEComInterfaceConf
    +
    +

    Helper structure to configure a serial interface

    + +
    +
    + +

    ◆ SbgEComCanBitRate

    + +
    +
    + + + + +
    typedef enum _SbgEComCanBitRate SbgEComCanBitRate
    +
    +

    Enum containing the list of all available bit rates (in KB/s).

    + +
    +
    + +

    ◆ SbgEComCanMode

    + +
    +
    + + + + +
    typedef enum _SbgEComCanMode SbgEComCanMode
    +
    +

    Enum containing the list of different CAN modes

    + +
    +
    +

    Enumeration Type Documentation

    + +

    ◆ _SbgEComPortId

    + +
    +
    + + + + +
    enum _SbgEComPortId
    +
    +

    List of serial interfaces available.

    + + + + + + + + + + + + +
    Enumerator
    SBG_ECOM_IF_COM_A 

    Main communication interface. Full duplex.

    +
    SBG_ECOM_IF_COM_B 

    Auxiliary input interface for RTCM.

    +
    SBG_ECOM_IF_COM_C 

    Auxiliary communication interface. Full duplex.

    +
    SBG_ECOM_IF_COM_D 

    Auxiliary input interface.

    +
    SBG_ECOM_IF_COM_E 

    Auxiliary output interface.

    +
    SBG_ECOM_IF_ETH_0 

    Ethernet interface 0.

    +
    SBG_ECOM_IF_ETH_1 

    Ethernet interface 1.

    +
    SBG_ECOM_IF_ETH_2 

    Ethernet interface 2.

    +
    SBG_ECOM_IF_ETH_3 

    Ethernet interface 3.

    +
    SBG_ECOM_IF_ETH_4 

    Ethernet interface 4.

    +
    SBG_ECOM_IF_DATA_LOGGER 

    Data logger interface.

    +
    + +
    +
    + +

    ◆ _SbgEComPortMode

    + +
    +
    + + + + +
    enum _SbgEComPortMode
    +
    +

    List of serial modes available.

    + + + + +
    Enumerator
    SBG_ECOM_UART_MODE_OFF 

    This interface is turned OFF.

    +
    SBG_ECOM_UART_MODE_232 

    This interface is using RS-232 communications.

    +
    SBG_ECOM_UART_MODE_422 

    This interface is using RS-422 communications.

    +
    + +
    +
    + +

    ◆ _SbgEComCanBitRate

    + +
    +
    + + + + +
    enum _SbgEComCanBitRate
    +
    +

    Enum containing the list of all available bit rates (in KB/s).

    + + + + + + + + + + + + +
    Enumerator
    SBG_ECOM_CAN_BITRATE_DISABLED 

    The CAN interface is disabled.

    +
    SBG_ECOM_CAN_BITRATE_10 

    10Kb/s.

    +
    SBG_ECOM_CAN_BITRATE_20 

    20Kb/s.

    +
    SBG_ECOM_CAN_BITRATE_25 

    25Kb/s.

    +
    SBG_ECOM_CAN_BITRATE_50 

    50Kb/s.

    +
    SBG_ECOM_CAN_BITRATE_100 

    100Kb/s.

    +
    SBG_ECOM_CAN_BITRATE_125 

    125Kb/s.

    +
    SBG_ECOM_CAN_BITRATE_250 

    250Kb/s.

    +
    SBG_ECOM_CAN_BITRATE_500 

    500Kb/s.

    +
    SBG_ECOM_CAN_BITRATE_750 

    750Kb/s.

    +
    SBG_ECOM_CAN_BITRATE_1000 

    1Mb/s.

    +
    + +
    +
    + +

    ◆ _SbgEComCanMode

    + +
    +
    + + + + +
    enum _SbgEComCanMode
    +
    +

    Enum containing the list of different CAN modes

    + + + + +
    Enumerator
    SBG_ECOM_CAN_MODE_UNDEFINED 

    CAN Mode undefined.

    +
    SBG_ECOM_CAN_MODE_SPY 

    Only listening on the CAN bus and doesn't sent anything (even RX ACK bit).

    +
    SBG_ECOM_CAN_MODE_NORMAL 

    The device is allowed to both send and receive over the CAN bus.

    +
    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgEComCmdInterfaceGetUartConf()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdInterfaceGetUartConf (SbgEComHandlepHandle,
    SbgEComPortId interfaceId,
    SbgEComInterfaceConfpConf 
    )
    +
    +

    Retrieve the configuration of one of the interfaces.

    +
    Parameters
    + + + + +
    [in]pHandleA valid sbgECom handle.
    [in]interfaceIdThe interface from which the configuration is to be retrieved.
    [out]pConfPointer to a SbgEComInterfaceConf struct to hold configuration of the interface.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdInterfaceSetUartConf()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdInterfaceSetUartConf (SbgEComHandlepHandle,
    SbgEComPortId interfaceId,
    const SbgEComInterfaceConfpConf 
    )
    +
    +

    Set the configuration of one of the interfaces.

    +
    Parameters
    + + + + +
    [in]pHandleA valid sbgECom handle.
    [in]interfaceIdThe interface from which the configuration is to be retrieved.
    [in]pConfPointer to a SbgEComInterfaceConf struct that holds the new configuration for the interface.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdInterfaceGetCanConf()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdInterfaceGetCanConf (SbgEComHandlepHandle,
    SbgEComCanBitRatepBitrate,
    SbgEComCanModepMode 
    )
    +
    +

    Retrieve the configuration of the CAN interface.

    +
    Parameters
    + + + + +
    [in]pHandleA valid sbgECom handle.
    [out]pBitrateThe bitrate of the CAN interface.
    [out]pModeMode of the CAN interface.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdInterfaceSetCanConf()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdInterfaceSetCanConf (SbgEComHandlepHandle,
    SbgEComCanBitRate bitRate,
    SbgEComCanMode mode 
    )
    +
    +

    Set the configuration of the CAN interface.

    +
    Parameters
    + + + + +
    [in]pHandleA valid sbgECom handle.
    [in]bitRateThe bitrate of the CAN interface.
    [in]modeMode of the CAN interface.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_interface_8h_source.html b/doc/html/sbg_e_com_cmd_interface_8h_source.html new file mode 100644 index 0000000..9a24c13 --- /dev/null +++ b/doc/html/sbg_e_com_cmd_interface_8h_source.html @@ -0,0 +1,195 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdInterface.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComCmdInterface.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_CMD_INTERFACE_H
    +
    33#define SBG_ECOM_CMD_INTERFACE_H
    +
    34
    +
    35// sbgCommonLib headers
    +
    36#include <sbgCommon.h>
    +
    37
    +
    38// Project headers
    +
    39#include <sbgECom.h>
    +
    40
    +
    41#ifdef __cplusplus
    +
    42extern "C" {
    +
    43#endif
    +
    44
    +
    45//----------------------------------------------------------------------//
    +
    46//- Serial interface definitions -//
    +
    47//----------------------------------------------------------------------//
    +
    48
    +
    52typedef enum _SbgEComPortId
    +
    53{
    + + + + + + + + + + + + +
    68
    +
    72typedef enum _SbgEComPortMode
    +
    73{
    + + + + +
    78
    +
    79//----------------------------------------------------------------------//
    +
    80//- Serial interface configuration -//
    +
    81//----------------------------------------------------------------------//
    +
    82
    + +
    87{
    +
    88 uint32_t baudRate;
    + + +
    91
    +
    92//----------------------------------------------------------------------//
    +
    93//- CAN interface definitions -//
    +
    94//----------------------------------------------------------------------//
    +
    95
    + +
    100{
    + + + + + + + + + + + + +
    113
    +
    117typedef enum _SbgEComCanMode
    +
    118{
    + + + +
    122 SBG_ECOM_CAN_NR_MODE
    + +
    124
    +
    125//----------------------------------------------------------------------//
    +
    126//- Public methods -//
    +
    127//----------------------------------------------------------------------//
    +
    128
    + +
    138
    +
    147SbgErrorCode sbgEComCmdInterfaceSetUartConf(SbgEComHandle *pHandle, SbgEComPortId interfaceId, const SbgEComInterfaceConf *pConf);
    +
    148
    + +
    158
    + +
    168
    +
    169#ifdef __cplusplus
    +
    170}
    +
    171#endif
    +
    172
    +
    173#endif // SBG_ECOM_CMD_INTERFACE_H
    +
    Contains main sbgECom methods.
    +
    enum _SbgEComPortId SbgEComPortId
    +
    _SbgEComPortId
    Definition: sbgEComCmdInterface.h:53
    +
    @ SBG_ECOM_IF_COM_E
    Definition: sbgEComCmdInterface.h:58
    +
    @ SBG_ECOM_IF_COM_D
    Definition: sbgEComCmdInterface.h:57
    +
    @ SBG_ECOM_IF_ETH_0
    Definition: sbgEComCmdInterface.h:60
    +
    @ SBG_ECOM_IF_COM_A
    Definition: sbgEComCmdInterface.h:54
    +
    @ SBG_ECOM_IF_DATA_LOGGER
    Definition: sbgEComCmdInterface.h:66
    +
    @ SBG_ECOM_IF_ETH_3
    Definition: sbgEComCmdInterface.h:63
    +
    @ SBG_ECOM_IF_ETH_2
    Definition: sbgEComCmdInterface.h:62
    +
    @ SBG_ECOM_IF_COM_B
    Definition: sbgEComCmdInterface.h:55
    +
    @ SBG_ECOM_IF_ETH_4
    Definition: sbgEComCmdInterface.h:64
    +
    @ SBG_ECOM_IF_COM_C
    Definition: sbgEComCmdInterface.h:56
    +
    @ SBG_ECOM_IF_ETH_1
    Definition: sbgEComCmdInterface.h:61
    +
    SbgErrorCode sbgEComCmdInterfaceGetUartConf(SbgEComHandle *pHandle, SbgEComPortId interfaceId, SbgEComInterfaceConf *pConf)
    +
    _SbgEComPortMode
    Definition: sbgEComCmdInterface.h:73
    +
    @ SBG_ECOM_UART_MODE_422
    Definition: sbgEComCmdInterface.h:76
    +
    @ SBG_ECOM_UART_MODE_232
    Definition: sbgEComCmdInterface.h:75
    +
    @ SBG_ECOM_UART_MODE_OFF
    Definition: sbgEComCmdInterface.h:74
    +
    enum _SbgEComPortMode SbgEComPortMode
    +
    enum _SbgEComCanMode SbgEComCanMode
    +
    _SbgEComCanBitRate
    Definition: sbgEComCmdInterface.h:100
    +
    @ SBG_ECOM_CAN_BITRATE_125
    Definition: sbgEComCmdInterface.h:107
    +
    @ SBG_ECOM_CAN_BITRATE_50
    Definition: sbgEComCmdInterface.h:105
    +
    @ SBG_ECOM_CAN_BITRATE_20
    Definition: sbgEComCmdInterface.h:103
    +
    @ SBG_ECOM_CAN_BITRATE_500
    Definition: sbgEComCmdInterface.h:109
    +
    @ SBG_ECOM_CAN_BITRATE_100
    Definition: sbgEComCmdInterface.h:106
    +
    @ SBG_ECOM_CAN_BITRATE_DISABLED
    Definition: sbgEComCmdInterface.h:101
    +
    @ SBG_ECOM_CAN_BITRATE_750
    Definition: sbgEComCmdInterface.h:110
    +
    @ SBG_ECOM_CAN_BITRATE_1000
    Definition: sbgEComCmdInterface.h:111
    +
    @ SBG_ECOM_CAN_BITRATE_10
    Definition: sbgEComCmdInterface.h:102
    +
    @ SBG_ECOM_CAN_BITRATE_25
    Definition: sbgEComCmdInterface.h:104
    +
    @ SBG_ECOM_CAN_BITRATE_250
    Definition: sbgEComCmdInterface.h:108
    +
    enum _SbgEComCanBitRate SbgEComCanBitRate
    +
    SbgErrorCode sbgEComCmdInterfaceGetCanConf(SbgEComHandle *pHandle, SbgEComCanBitRate *pBitrate, SbgEComCanMode *pMode)
    +
    _SbgEComCanMode
    Definition: sbgEComCmdInterface.h:118
    +
    @ SBG_ECOM_CAN_MODE_UNDEFINED
    Definition: sbgEComCmdInterface.h:119
    +
    @ SBG_ECOM_CAN_MODE_SPY
    Definition: sbgEComCmdInterface.h:120
    +
    @ SBG_ECOM_CAN_MODE_NORMAL
    Definition: sbgEComCmdInterface.h:121
    +
    SbgErrorCode sbgEComCmdInterfaceSetCanConf(SbgEComHandle *pHandle, SbgEComCanBitRate bitRate, SbgEComCanMode mode)
    +
    SbgErrorCode sbgEComCmdInterfaceSetUartConf(SbgEComHandle *pHandle, SbgEComPortId interfaceId, const SbgEComInterfaceConf *pConf)
    +
    struct _SbgEComInterfaceConf SbgEComInterfaceConf
    +
    Definition: sbgECom.h:81
    +
    Definition: sbgEComCmdInterface.h:87
    +
    uint32_t baudRate
    Definition: sbgEComCmdInterface.h:88
    +
    SbgEComPortMode mode
    Definition: sbgEComCmdInterface.h:89
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_license_8h.html b/doc/html/sbg_e_com_cmd_license_8h.html new file mode 100644 index 0000000..7224ac7 --- /dev/null +++ b/doc/html/sbg_e_com_cmd_license_8h.html @@ -0,0 +1,127 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdLicense.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComCmdLicense.h File Reference
    +
    +
    + +

    Command used to upload and apply an activation license. +More...

    +
    #include <sbgCommon.h>
    +#include <sbgECom.h>
    +
    +

    Go to the source code of this file.

    + + + + +

    +Functions

    SbgErrorCode sbgEComCmdLicenseApply (SbgEComHandle *pHandle, const void *pBuffer, size_t size)
     
    +

    Detailed Description

    +

    Command used to upload and apply an activation license.

    +
    Author
    SBG Systems
    +
    Date
    25 February 2015
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Function Documentation

    + +

    ◆ sbgEComCmdLicenseApply()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdLicenseApply (SbgEComHandlepHandle,
    const void * pBuffer,
    size_t size 
    )
    +
    +

    Upload and apply a new license to a device.

    +

    The device will reboot automatically to use the new license.

    +
    Parameters
    + + + + +
    [in]pHandleA valid sbgECom handle.
    [in]pBufferRead only buffer containing the license.
    [in]sizeSize of the buffer.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_license_8h_source.html b/doc/html/sbg_e_com_cmd_license_8h_source.html new file mode 100644 index 0000000..677c16c --- /dev/null +++ b/doc/html/sbg_e_com_cmd_license_8h_source.html @@ -0,0 +1,83 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdLicense.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComCmdLicense.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_CMD_LICENSE_H
    +
    33#define SBG_ECOM_CMD_LICENSE_H
    +
    34
    +
    35// sbgCommonLib headers
    +
    36#include <sbgCommon.h>
    +
    37
    +
    38// Project headers
    +
    39#include <sbgECom.h>
    +
    40
    +
    41#ifdef __cplusplus
    +
    42extern "C" {
    +
    43#endif
    +
    44
    +
    45//----------------------------------------------------------------------//
    +
    46//- Public methods -//
    +
    47//----------------------------------------------------------------------//
    +
    48
    +
    59SbgErrorCode sbgEComCmdLicenseApply(SbgEComHandle *pHandle, const void *pBuffer, size_t size);
    +
    60
    +
    61#ifdef __cplusplus
    +
    62}
    +
    63#endif
    +
    64
    +
    65#endif // SBG_ECOM_CMD_LICENSE_H
    +
    Contains main sbgECom methods.
    +
    SbgErrorCode sbgEComCmdLicenseApply(SbgEComHandle *pHandle, const void *pBuffer, size_t size)
    +
    Definition: sbgECom.h:81
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_mag_8h.html b/doc/html/sbg_e_com_cmd_mag_8h.html new file mode 100644 index 0000000..06fcfeb --- /dev/null +++ b/doc/html/sbg_e_com_cmd_mag_8h.html @@ -0,0 +1,770 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdMag.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComCmdMag.h File Reference
    +
    +
    + +

    Magnetometer aiding module configuration & onboard magnetic calibration commands. +More...

    +
    #include <sbgCommon.h>
    +#include <sbgECom.h>
    +#include "sbgEComCmdCommon.h"
    +
    +

    Go to the source code of this file.

    + + + + + + +

    +Data Structures

    struct  _SbgEComMagRejectionConf
     
    struct  _SbgEComMagCalibResults
     
    + + + + + + + + + + + + + +

    +Macros

    #define SBG_ECOM_MAG_CALIB_NOT_ENOUGH_POINTS   (0x0001u)
     
    #define SBG_ECOM_MAG_CALIB_TOO_MUCH_DISTORTIONS   (0x0002u)
     
    #define SBG_ECOM_MAG_CALIB_X_MOTION_ISSUE   (0x0004u)
     
    #define SBG_ECOM_MAG_CALIB_Y_MOTION_ISSUE   (0x0008u)
     
    #define SBG_ECOM_MAG_CALIB_Z_MOTION_ISSUE   (0x0010u)
     
    #define SBG_ECOM_MAG_CALIB_ALIGNMENT_ISSUE   (0x0020u)
     
    + + + + + + + + + + + + + + + +

    +Typedefs

    typedef enum _SbgEComMagCalibMode SbgEComMagCalibMode
     
    typedef enum _SbgEComMagCalibBandwidth SbgEComMagCalibBandwidth
     
    typedef enum _SbgEComMagCalibQuality SbgEComMagCalibQuality
     
    typedef enum _SbgEComMagCalibConfidence SbgEComMagCalibConfidence
     
    typedef enum _SbgEComMagModelsStdIds SbgEComMagModelsStdId
     
    typedef struct _SbgEComMagRejectionConf SbgEComMagRejectionConf
     
    typedef struct _SbgEComMagCalibResults SbgEComMagCalibResults
     
    + + + + + + + + + + + +

    +Enumerations

    enum  _SbgEComMagCalibMode {
    +  SBG_ECOM_MAG_CALIB_MODE_2D = 1 +,
    +  SBG_ECOM_MAG_CALIB_MODE_3D = 2 +
    + }
     
    enum  _SbgEComMagCalibBandwidth {
    +  SBG_ECOM_MAG_CALIB_LOW_BW = 0 +,
    +  SBG_ECOM_MAG_CALIB_MEDIUM_BW = 1 +,
    +  SBG_ECOM_MAG_CALIB_HIGH_BW = 2 +
    + }
     
    enum  _SbgEComMagCalibQuality {
    +  SBG_ECOM_MAG_CALIB_QUAL_OPTIMAL = 0 +,
    +  SBG_ECOM_MAG_CALIB_QUAL_GOOD = 1 +,
    +  SBG_ECOM_MAG_CALIB_QUAL_POOR = 2 +,
    +  SBG_ECOM_MAG_CALIB_QUAL_INVALID = 3 +
    + }
     
    enum  _SbgEComMagCalibConfidence {
    +  SBG_ECOM_MAG_CALIB_TRUST_HIGH = 0 +,
    +  SBG_ECOM_MAG_CALIB_TRUST_MEDIUM = 1 +,
    +  SBG_ECOM_MAG_CALIB_TRUST_LOW = 2 +
    + }
     
    enum  _SbgEComMagModelsStdIds {
    +  SBG_ECOM_MAG_MODEL_NORMAL = 201 +,
    +  SBG_ECOM_MAG_MODEL_NOISY_MAG_TOLERANT = 202 +
    + }
     
    + + + + + + + + + + + + + + + +

    +Functions

    SbgErrorCode sbgEComCmdMagSetModelId (SbgEComHandle *pHandle, SbgEComMagModelsStdId modelId)
     
    SbgErrorCode sbgEComCmdMagGetModelId (SbgEComHandle *pHandle, SbgEComMagModelsStdId *pModelId)
     
    SbgErrorCode sbgEComCmdMagGetRejection (SbgEComHandle *pHandle, SbgEComMagRejectionConf *pRejectConf)
     
    SbgErrorCode sbgEComCmdMagSetRejection (SbgEComHandle *pHandle, const SbgEComMagRejectionConf *pRejectConf)
     
    SbgErrorCode sbgEComCmdMagSetCalibData (SbgEComHandle *pHandle, const float *pOffset, const float *pMatrix)
     
    SbgErrorCode sbgEComCmdMagStartCalib (SbgEComHandle *pHandle, SbgEComMagCalibMode mode, SbgEComMagCalibBandwidth bandwidth)
     
    SbgErrorCode sbgEComCmdMagComputeCalib (SbgEComHandle *pHandle, SbgEComMagCalibResults *pCalibResults)
     
    +

    Detailed Description

    +

    Magnetometer aiding module configuration & onboard magnetic calibration commands.

    +
    Author
    SBG Systems
    +
    Date
    11 June 2014
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Macro Definition Documentation

    + +

    ◆ SBG_ECOM_MAG_CALIB_NOT_ENOUGH_POINTS

    + +
    +
    + + + + +
    #define SBG_ECOM_MAG_CALIB_NOT_ENOUGH_POINTS   (0x0001u)
    +
    +

    Status bit masks used to report advanced inforamtion on the onboard magnetic calibration. Not enough valid magnetic points have been acquired.

    + +
    +
    + +

    ◆ SBG_ECOM_MAG_CALIB_TOO_MUCH_DISTORTIONS

    + +
    +
    + + + + +
    #define SBG_ECOM_MAG_CALIB_TOO_MUCH_DISTORTIONS   (0x0002u)
    +
    +

    Unable to compute a magnetic calibration due to magnetic interferences or incorrect data set distribution.

    + +
    +
    + +

    ◆ SBG_ECOM_MAG_CALIB_X_MOTION_ISSUE

    + +
    +
    + + + + +
    #define SBG_ECOM_MAG_CALIB_X_MOTION_ISSUE   (0x0004u)
    +
    +

    For a 3D calibration: not enough motion on X axis. For a 2D calibration; too much motion on X axis.

    + +
    +
    + +

    ◆ SBG_ECOM_MAG_CALIB_Y_MOTION_ISSUE

    + +
    +
    + + + + +
    #define SBG_ECOM_MAG_CALIB_Y_MOTION_ISSUE   (0x0008u)
    +
    +

    For a 3D calibration: not enough motion on Y axis. For a 2D calibration; too much motion on Y axis.

    + +
    +
    + +

    ◆ SBG_ECOM_MAG_CALIB_Z_MOTION_ISSUE

    + +
    +
    + + + + +
    #define SBG_ECOM_MAG_CALIB_Z_MOTION_ISSUE   (0x0010u)
    +
    +

    For a 3D or 2D calibration: not enough motion on Z axis.

    + +
    +
    + +

    ◆ SBG_ECOM_MAG_CALIB_ALIGNMENT_ISSUE

    + +
    +
    + + + + +
    #define SBG_ECOM_MAG_CALIB_ALIGNMENT_ISSUE   (0x0020u)
    +
    +

    For a 3D calibration: the alignment between the magnetometers and the inertial frame seems to be invalid.

    + +
    +
    +

    Typedef Documentation

    + +

    ◆ SbgEComMagCalibMode

    + +
    +
    + + + + +
    typedef enum _SbgEComMagCalibMode SbgEComMagCalibMode
    +
    +

    Define if the onboard magnetic calibration should acquiere points for a 3D or 2D calibration.

    + +
    +
    + +

    ◆ SbgEComMagCalibBandwidth

    + +
    +
    +

    Used to select the expected dynamics during the magnetic calibration.

    + +
    +
    + +

    ◆ SbgEComMagCalibQuality

    + +
    +
    +

    General quality indicator of an onboard magnetic calibration.

    + +
    +
    + +

    ◆ SbgEComMagCalibConfidence

    + +
    +
    +

    Confidence indicator on results of an onbard magnetic calibration.

    + +
    +
    + +

    ◆ SbgEComMagModelsStdId

    + +
    +
    +

    This enum defines the different magnetometer model IDs available in standard

    + +
    +
    + +

    ◆ SbgEComMagRejectionConf

    + +
    +
    +

    Holds all necessary information for Magnetometer module data rejection.

    + +
    +
    + +

    ◆ SbgEComMagCalibResults

    + +
    +
    +

    Helper structure to retrieve onboard magnetic calibration results.

    + +
    +
    +

    Enumeration Type Documentation

    + +

    ◆ _SbgEComMagCalibMode

    + +
    +
    + + + + +
    enum _SbgEComMagCalibMode
    +
    +

    Define if the onboard magnetic calibration should acquiere points for a 3D or 2D calibration.

    + + + +
    Enumerator
    SBG_ECOM_MAG_CALIB_MODE_2D 

    Tell the device that the magnetic calibration will be performed with limited motions. This calibration mode is only designed to be used when roll and pitch motions are less than ± 5°. To work correctly, the device should be rotated through at least a full circle.

    +
    SBG_ECOM_MAG_CALIB_MODE_3D 

    Tell the device to start a full 3D magnetic calibration procedure. The 3D magnetic calibration offers the best accuracy but needs at least motion of ± 30° on the roll and pitch angles.

    +
    + +
    +
    + +

    ◆ _SbgEComMagCalibBandwidth

    + +
    +
    + + + + +
    enum _SbgEComMagCalibBandwidth
    +
    +

    Used to select the expected dynamics during the magnetic calibration.

    + + + + +
    Enumerator
    SBG_ECOM_MAG_CALIB_LOW_BW 

    Tell the device that low dynamics will be observed during the magnetic calibration process.

    +
    SBG_ECOM_MAG_CALIB_MEDIUM_BW 

    Tell the device that normal dynamics will be observed during the magnetic calibration process.

    +
    SBG_ECOM_MAG_CALIB_HIGH_BW 

    Tell the device that high dynamics will be observed during the magnetic calibration process.

    +
    + +
    +
    + +

    ◆ _SbgEComMagCalibQuality

    + +
    +
    + + + + +
    enum _SbgEComMagCalibQuality
    +
    +

    General quality indicator of an onboard magnetic calibration.

    + + + + + +
    Enumerator
    SBG_ECOM_MAG_CALIB_QUAL_OPTIMAL 

    All acquired points fit very well on a unit sphere after the calibration.

    +
    SBG_ECOM_MAG_CALIB_QUAL_GOOD 

    Small deviations of the magnetic field norm have been detected. The magnetic calibration should although provide accurate heading.

    +
    SBG_ECOM_MAG_CALIB_QUAL_POOR 

    Large deviations of the magnetic field norm have been detected. It may come from external magnetic distortions during the calibration.

    +
    SBG_ECOM_MAG_CALIB_QUAL_INVALID 

    No valid magnetic calibration has been computed. It could comes from too much magnetic disturbances, insufficient or invalid motions.

    +
    + +
    +
    + +

    ◆ _SbgEComMagCalibConfidence

    + +
    +
    + + + + +
    enum _SbgEComMagCalibConfidence
    +
    +

    Confidence indicator on results of an onbard magnetic calibration.

    + + + + +
    Enumerator
    SBG_ECOM_MAG_CALIB_TRUST_HIGH 

    Reported quality indicator can be trusted as enough remarkable magnetic field points have been acquired.

    +
    SBG_ECOM_MAG_CALIB_TRUST_MEDIUM 

    Few remarkable magnetic field points have been used to compute the magnetic calibration leading to a medium confidence in reported quality indicators.

    +
    SBG_ECOM_MAG_CALIB_TRUST_LOW 

    Even if the quality indicator could report an excellent calibration, The data set used to compute the magnetic calibration was not meaningful enough to compute meaningful quality indicators. This calibration should be used carefully.

    +
    + +
    +
    + +

    ◆ _SbgEComMagModelsStdIds

    + +
    +
    + + + + +
    enum _SbgEComMagModelsStdIds
    +
    +

    This enum defines the different magnetometer model IDs available in standard

    + + + +
    Enumerator
    SBG_ECOM_MAG_MODEL_NORMAL 

    Should be used in most applications

    +
    SBG_ECOM_MAG_MODEL_NOISY_MAG_TOLERANT 

    Should be used in disturbed magnetic environment

    +
    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgEComCmdMagSetModelId()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdMagSetModelId (SbgEComHandlepHandle,
    SbgEComMagModelsStdId modelId 
    )
    +
    +

    Set magnetometer error model id.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle
    [in]modelIdMagnetometer model id to set
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully
    + +
    +
    + +

    ◆ sbgEComCmdMagGetModelId()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdMagGetModelId (SbgEComHandlepHandle,
    SbgEComMagModelsStdIdpModelId 
    )
    +
    +

    Retrieve magnetometer error model id

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle
    [out]pModelIdRetrieved magnetometer model id
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully
    + +
    +
    + +

    ◆ sbgEComCmdMagGetRejection()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdMagGetRejection (SbgEComHandlepHandle,
    SbgEComMagRejectionConfpRejectConf 
    )
    +
    +

    Retrieve the rejection configuration of the magnetometer module.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [out]pRejectConfPointer to a SbgEComMagRejectionConf struct to hold rejection configuration of the magnetometer module.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdMagSetRejection()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdMagSetRejection (SbgEComHandlepHandle,
    const SbgEComMagRejectionConfpRejectConf 
    )
    +
    +

    Set the rejection configuration of the magnetometer module.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [in]pRejectConfPointer to a SbgEComMagRejectionConf struct holding rejection configuration for the magnetometer module.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdMagSetCalibData()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdMagSetCalibData (SbgEComHandlepHandle,
    const float * pOffset,
    const float * pMatrix 
    )
    +
    +

    Send a command that set the magnetometers calibration parameters.

    +
    Parameters
    + + + + +
    [in]pHandleA valid sbgECom handle.
    [in]pOffsetMagnetometers calibration offset vector.
    [in]pMatrixMagnetometers calibration 3x3 matrix.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdMagStartCalib()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdMagStartCalib (SbgEComHandlepHandle,
    SbgEComMagCalibMode mode,
    SbgEComMagCalibBandwidth bandwidth 
    )
    +
    +

    Start the magnetic calibration process.

    +

    As soon as this command is sent, the device will start logging magnetic field data internally. This set of data will be used later by the magnetic calibration algorithms to map the surrounding magnetic field.

    +
    Parameters
    + + + + +
    [in]pHandleA valid sbgECom handle.
    [in]modeDefine which magnetic calibration type to perform. It could be 3D or 2D.
    [in]bandwidthTell the device that we should have low, medium or high dynamics during the magnetic calibration process.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdMagComputeCalib()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdMagComputeCalib (SbgEComHandlepHandle,
    SbgEComMagCalibResultspCalibResults 
    )
    +
    +

    This command computes a magnetic calibration solution based on the magnetic field logged since the last call to the command SBG_ECOM_CMD_START_MAG_CALIB (15).

    +

    As soon as the computations are done, the device will answer with quality indicators, status flags and if possible a valid magnetic calibration matrix and offset.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [out]pCalibResultsPointer on a SbgEComMagCalibResults structure that can hold onboard magnetic calibration results and status.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_mag_8h_source.html b/doc/html/sbg_e_com_cmd_mag_8h_source.html new file mode 100644 index 0000000..dee6b88 --- /dev/null +++ b/doc/html/sbg_e_com_cmd_mag_8h_source.html @@ -0,0 +1,229 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdMag.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComCmdMag.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_CMD_MAG_H
    +
    33#define SBG_ECOM_CMD_MAG_H
    +
    34
    +
    35// sbgCommonLib headers
    +
    36#include <sbgCommon.h>
    +
    37
    +
    38// Project headers
    +
    39#include <sbgECom.h>
    +
    40
    +
    41// Local headers
    +
    42#include "sbgEComCmdCommon.h"
    +
    43
    +
    44#ifdef __cplusplus
    +
    45extern "C" {
    +
    46#endif
    +
    47
    +
    48//----------------------------------------------------------------------//
    +
    49//- Magnetometer definitions -//
    +
    50//----------------------------------------------------------------------//
    +
    51
    + +
    56{
    + + + +
    63
    +
    64
    + +
    69{
    + + + + +
    74
    + +
    79{
    + + + + + +
    85
    + +
    90{
    + + + + +
    97
    +
    101#define SBG_ECOM_MAG_CALIB_NOT_ENOUGH_POINTS (0x0001u)
    +
    102#define SBG_ECOM_MAG_CALIB_TOO_MUCH_DISTORTIONS (0x0002u)
    +
    103#define SBG_ECOM_MAG_CALIB_X_MOTION_ISSUE (0x0004u)
    +
    104#define SBG_ECOM_MAG_CALIB_Y_MOTION_ISSUE (0x0008u)
    +
    105#define SBG_ECOM_MAG_CALIB_Z_MOTION_ISSUE (0x0010u)
    +
    106#define SBG_ECOM_MAG_CALIB_ALIGNMENT_ISSUE (0x0020u)
    + +
    112{
    + + + +
    116
    +
    117//----------------------------------------------------------------------//
    +
    118//- Magnetometer configuration -//
    +
    119//----------------------------------------------------------------------//
    +
    120
    + +
    125{
    + + +
    128
    + +
    133{
    + + +
    136 uint16_t advancedStatus;
    + + + + + + + + + +
    150 uint16_t numPoints;
    +
    151 uint16_t maxNumPoints;
    +
    152 float offset[3];
    +
    153 float matrix[9];
    + +
    155
    +
    156//----------------------------------------------------------------------//
    +
    157//- Magnetometer commands -//
    +
    158//----------------------------------------------------------------------//
    +
    159
    + +
    168
    + +
    177
    + +
    186
    +
    194SbgErrorCode sbgEComCmdMagSetRejection(SbgEComHandle *pHandle, const SbgEComMagRejectionConf *pRejectConf);
    +
    195
    +
    204SbgErrorCode sbgEComCmdMagSetCalibData(SbgEComHandle *pHandle, const float *pOffset, const float *pMatrix);
    +
    205
    +
    206//----------------------------------------------------------------------//
    +
    207//- Magnetometer onboard calibration commands -//
    +
    208//----------------------------------------------------------------------//
    +
    209
    + +
    222
    + +
    233
    +
    234#ifdef __cplusplus
    +
    235}
    +
    236#endif
    +
    237
    +
    238#endif // SBG_ECOM_CMD_MAG_H
    +
    Contains main sbgECom methods.
    +
    Definitions and methods common to all commands.
    +
    enum _SbgEComRejectionMode SbgEComRejectionMode
    +
    SbgErrorCode sbgEComCmdMagSetCalibData(SbgEComHandle *pHandle, const float *pOffset, const float *pMatrix)
    +
    SbgErrorCode sbgEComCmdMagSetModelId(SbgEComHandle *pHandle, SbgEComMagModelsStdId modelId)
    +
    SbgErrorCode sbgEComCmdMagComputeCalib(SbgEComHandle *pHandle, SbgEComMagCalibResults *pCalibResults)
    +
    enum _SbgEComMagCalibBandwidth SbgEComMagCalibBandwidth
    +
    enum _SbgEComMagCalibMode SbgEComMagCalibMode
    +
    SbgErrorCode sbgEComCmdMagGetModelId(SbgEComHandle *pHandle, SbgEComMagModelsStdId *pModelId)
    +
    _SbgEComMagCalibConfidence
    Definition: sbgEComCmdMag.h:90
    +
    @ SBG_ECOM_MAG_CALIB_TRUST_MEDIUM
    Definition: sbgEComCmdMag.h:92
    +
    @ SBG_ECOM_MAG_CALIB_TRUST_LOW
    Definition: sbgEComCmdMag.h:93
    +
    @ SBG_ECOM_MAG_CALIB_TRUST_HIGH
    Definition: sbgEComCmdMag.h:91
    +
    struct _SbgEComMagRejectionConf SbgEComMagRejectionConf
    +
    enum _SbgEComMagCalibQuality SbgEComMagCalibQuality
    +
    struct _SbgEComMagCalibResults SbgEComMagCalibResults
    +
    enum _SbgEComMagCalibConfidence SbgEComMagCalibConfidence
    +
    SbgErrorCode sbgEComCmdMagSetRejection(SbgEComHandle *pHandle, const SbgEComMagRejectionConf *pRejectConf)
    +
    _SbgEComMagCalibMode
    Definition: sbgEComCmdMag.h:56
    +
    @ SBG_ECOM_MAG_CALIB_MODE_3D
    Definition: sbgEComCmdMag.h:60
    +
    @ SBG_ECOM_MAG_CALIB_MODE_2D
    Definition: sbgEComCmdMag.h:57
    +
    _SbgEComMagCalibQuality
    Definition: sbgEComCmdMag.h:79
    +
    @ SBG_ECOM_MAG_CALIB_QUAL_OPTIMAL
    Definition: sbgEComCmdMag.h:80
    +
    @ SBG_ECOM_MAG_CALIB_QUAL_INVALID
    Definition: sbgEComCmdMag.h:83
    +
    @ SBG_ECOM_MAG_CALIB_QUAL_GOOD
    Definition: sbgEComCmdMag.h:81
    +
    @ SBG_ECOM_MAG_CALIB_QUAL_POOR
    Definition: sbgEComCmdMag.h:82
    +
    SbgErrorCode sbgEComCmdMagGetRejection(SbgEComHandle *pHandle, SbgEComMagRejectionConf *pRejectConf)
    +
    SbgErrorCode sbgEComCmdMagStartCalib(SbgEComHandle *pHandle, SbgEComMagCalibMode mode, SbgEComMagCalibBandwidth bandwidth)
    +
    _SbgEComMagModelsStdIds
    Definition: sbgEComCmdMag.h:112
    +
    @ SBG_ECOM_MAG_MODEL_NORMAL
    Definition: sbgEComCmdMag.h:113
    +
    @ SBG_ECOM_MAG_MODEL_NOISY_MAG_TOLERANT
    Definition: sbgEComCmdMag.h:114
    +
    enum _SbgEComMagModelsStdIds SbgEComMagModelsStdId
    +
    _SbgEComMagCalibBandwidth
    Definition: sbgEComCmdMag.h:69
    +
    @ SBG_ECOM_MAG_CALIB_LOW_BW
    Definition: sbgEComCmdMag.h:70
    +
    @ SBG_ECOM_MAG_CALIB_MEDIUM_BW
    Definition: sbgEComCmdMag.h:71
    +
    @ SBG_ECOM_MAG_CALIB_HIGH_BW
    Definition: sbgEComCmdMag.h:72
    +
    Definition: sbgECom.h:81
    +
    Definition: sbgEComCmdMag.h:133
    +
    float beforeMeanError
    Definition: sbgEComCmdMag.h:138
    +
    float afterMaxError
    Definition: sbgEComCmdMag.h:144
    +
    uint16_t maxNumPoints
    Definition: sbgEComCmdMag.h:151
    +
    float matrix[9]
    Definition: sbgEComCmdMag.h:153
    +
    float beforeStdError
    Definition: sbgEComCmdMag.h:139
    +
    float beforeMaxError
    Definition: sbgEComCmdMag.h:140
    +
    float afterMeanError
    Definition: sbgEComCmdMag.h:142
    +
    float afterStdError
    Definition: sbgEComCmdMag.h:143
    +
    float maxAccuracy
    Definition: sbgEComCmdMag.h:148
    +
    SbgEComMagCalibConfidence confidence
    Definition: sbgEComCmdMag.h:135
    +
    uint16_t advancedStatus
    Definition: sbgEComCmdMag.h:136
    +
    float meanAccuracy
    Definition: sbgEComCmdMag.h:146
    +
    SbgEComMagCalibQuality quality
    Definition: sbgEComCmdMag.h:134
    +
    uint16_t numPoints
    Definition: sbgEComCmdMag.h:150
    +
    float offset[3]
    Definition: sbgEComCmdMag.h:152
    +
    float stdAccuracy
    Definition: sbgEComCmdMag.h:147
    +
    Definition: sbgEComCmdMag.h:125
    +
    SbgEComRejectionMode magneticField
    Definition: sbgEComCmdMag.h:126
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_odo_8h.html b/doc/html/sbg_e_com_cmd_odo_8h.html new file mode 100644 index 0000000..b4a17de --- /dev/null +++ b/doc/html/sbg_e_com_cmd_odo_8h.html @@ -0,0 +1,596 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdOdo.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComCmdOdo.h File Reference
    +
    +
    + +

    Odometer / DMI aiding module configuration commands. +More...

    +
    #include <sbgCommon.h>
    +#include <sbgECom.h>
    +#include "sbgEComCmdCommon.h"
    +
    +

    Go to the source code of this file.

    + + + + + + + + +

    +Data Structures

    struct  _SbgEComOdoConf
     
    struct  _SbgEComOdoRejectionConf
     
    struct  _SbgEComCmdOdoCanConf
     
    + + + + + + + + + +

    +Macros

    #define SBG_ECOM_CMD_ODO_CAN_ENABLE   (uint16_t)(0x0001 << 0)
     
    #define SBG_ECOM_CMD_ODO_CAN_ID_EXTENDED   (uint16_t)(0x0001 << 1)
     
    #define SBG_ECOM_CMD_ODO_CAN_BIG_ENDIAN   (uint16_t)(0x0001 << 2)
     
    #define SBG_ECOM_CMD_ODO_CAN_SIGNED   (uint16_t)(0x0001 << 3)
     
    + + + + + + + + + +

    +Typedefs

    typedef struct _SbgEComOdoConf SbgEComOdoConf
     
    typedef struct _SbgEComOdoRejectionConf SbgEComOdoRejectionConf
     
    typedef enum _SbgEComCmdOdoCanChannel SbgEComCmdOdoCanChannel
     
    typedef struct _SbgEComCmdOdoCanConf SbgEComCmdOdoCanConf
     
    + + + +

    +Enumerations

    enum  _SbgEComCmdOdoCanChannel {
    +  SBG_ECOM_CMD_ODO_CAN_CH_VELOCITY = 0 +,
    +  SBG_ECOM_CMD_ODO_CAN_CH_REVERSE = 1 +
    + }
     
    + + + + + + + + + + + + + + + + + +

    +Functions

    SbgErrorCode sbgEComCmdOdoGetConf (SbgEComHandle *pHandle, SbgEComOdoConf *pOdometerConf)
     
    SbgErrorCode sbgEComCmdOdoSetConf (SbgEComHandle *pHandle, const SbgEComOdoConf *pOdometerConf)
     
    SbgErrorCode sbgEComCmdOdoGetLeverArm (SbgEComHandle *pHandle, float *pLeverArm)
     
    SbgErrorCode sbgEComCmdOdoSetLeverArm (SbgEComHandle *pHandle, const float *pLeverArm)
     
    SbgErrorCode sbgEComCmdOdoGetRejection (SbgEComHandle *pHandle, SbgEComOdoRejectionConf *pRejectConf)
     
    SbgErrorCode sbgEComCmdOdoSetRejection (SbgEComHandle *pHandle, const SbgEComOdoRejectionConf *pRejectConf)
     
    SbgErrorCode sbgEComCmdOdoCanGetConf (SbgEComHandle *pHandle, SbgEComCmdOdoCanChannel canChannel, SbgEComCmdOdoCanConf *pOdoCanConf)
     
    SbgErrorCode sbgEComCmdOdoCanSetConf (SbgEComHandle *pHandle, SbgEComCmdOdoCanChannel canChannel, const SbgEComCmdOdoCanConf *pOdoCanConf)
     
    +

    Detailed Description

    +

    Odometer / DMI aiding module configuration commands.

    +
    Author
    SBG Systems
    +
    Date
    11 June 2014
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Macro Definition Documentation

    + +

    ◆ SBG_ECOM_CMD_ODO_CAN_ENABLE

    + +
    +
    + + + + +
    #define SBG_ECOM_CMD_ODO_CAN_ENABLE   (uint16_t)(0x0001 << 0)
    +
    +

    Set to enable CAN odometer information decoding.

    + +
    +
    + +

    ◆ SBG_ECOM_CMD_ODO_CAN_ID_EXTENDED

    + +
    +
    + + + + +
    #define SBG_ECOM_CMD_ODO_CAN_ID_EXTENDED   (uint16_t)(0x0001 << 1)
    +
    +

    Set for a 29 bit extended CAN message, otherwise standard 11 bit

    + +
    +
    + +

    ◆ SBG_ECOM_CMD_ODO_CAN_BIG_ENDIAN

    + +
    +
    + + + + +
    #define SBG_ECOM_CMD_ODO_CAN_BIG_ENDIAN   (uint16_t)(0x0001 << 2)
    +
    +

    Set if the velocity is encoded in big endian, otherwise little endian

    + +
    +
    + +

    ◆ SBG_ECOM_CMD_ODO_CAN_SIGNED

    + +
    +
    + + + + +
    #define SBG_ECOM_CMD_ODO_CAN_SIGNED   (uint16_t)(0x0001 << 3)
    +
    +

    Set to interpret the parsed value as signed, otherwise unsigned.

    + +
    +
    +

    Typedef Documentation

    + +

    ◆ SbgEComOdoConf

    + +
    +
    + + + + +
    typedef struct _SbgEComOdoConf SbgEComOdoConf
    +
    +

    Holds all necessary information for Odometer module parameter configuration.

    + +
    +
    + +

    ◆ SbgEComOdoRejectionConf

    + +
    +
    +

    Holds all necessary information for Odometer module data rejection.

    + +
    +
    + +

    ◆ SbgEComCmdOdoCanChannel

    + +
    +
    +

    CAN odometer channels definition A channel is an inforamtion that can be decoded / used by the device.

    + +
    +
    + +

    ◆ SbgEComCmdOdoCanConf

    + +
    +
    + + + + +
    typedef struct _SbgEComCmdOdoCanConf SbgEComCmdOdoCanConf
    +
    +

    Holds all necessary information for CAN Odometer parameter configuration. This format is very similar to info contained in a DBC file.

    + +
    +
    +

    Enumeration Type Documentation

    + +

    ◆ _SbgEComCmdOdoCanChannel

    + +
    +
    + + + + +
    enum _SbgEComCmdOdoCanChannel
    +
    +

    CAN odometer channels definition A channel is an inforamtion that can be decoded / used by the device.

    + + + +
    Enumerator
    SBG_ECOM_CMD_ODO_CAN_CH_VELOCITY 

    Channel used to decode the vehicle velocity information

    +
    SBG_ECOM_CMD_ODO_CAN_CH_REVERSE 

    Channel used to decode the vehicle velocity reverse info (if available).

    +
    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgEComCmdOdoGetConf()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdOdoGetConf (SbgEComHandlepHandle,
    SbgEComOdoConfpOdometerConf 
    )
    +
    +

    For quadrature and/or pulse based odometer, retrieve the configuration.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [out]pOdometerConfPointer to a SbgEComOdoConf struct to hold configuration of the odometer module.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdOdoSetConf()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdOdoSetConf (SbgEComHandlepHandle,
    const SbgEComOdoConfpOdometerConf 
    )
    +
    +

    For quadrature and/or pulse base odometer, define the configuration.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [in]pOdometerConfPointer to a SbgEComOdoConf struct holding configuration for the odometer module.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdOdoGetLeverArm()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdOdoGetLeverArm (SbgEComHandlepHandle,
    float * pLeverArm 
    )
    +
    +

    Retrieve the lever arm applicable for both quadrature or CAN based odometer.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [out]pLeverArmArray of three values, one for each axis.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdOdoSetLeverArm()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdOdoSetLeverArm (SbgEComHandlepHandle,
    const float * pLeverArm 
    )
    +
    +

    Set the lever arm applicable for both quadrature or CAN based odometer.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [in]pLeverArmArray of three values, one for each axis.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdOdoGetRejection()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdOdoGetRejection (SbgEComHandlepHandle,
    SbgEComOdoRejectionConfpRejectConf 
    )
    +
    +

    Retrieve the velocity rejection configuration for both quadrature or CAN based odometer.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [out]pRejectConfPointer to a SbgEComOdoRejectionConf struct to hold rejection configuration of the odometer module.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdOdoSetRejection()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdOdoSetRejection (SbgEComHandlepHandle,
    const SbgEComOdoRejectionConfpRejectConf 
    )
    +
    +

    Set the velocity rejection configuration for both quadrature or CAN based odometer.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [in]pRejectConfPointer to a SbgEComOdoRejectionConf struct holding rejection configuration for the odometer module.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdOdoCanGetConf()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdOdoCanGetConf (SbgEComHandlepHandle,
    SbgEComCmdOdoCanChannel canChannel,
    SbgEComCmdOdoCanConfpOdoCanConf 
    )
    +
    +

    Retrieve the CAN odometer configuration for a specific CAN information channel

    +
    Parameters
    + + + + +
    [in]pHandleA valid sbgECom handle.
    [in]canChannelThe CAN channel to retreive associated DBC configuration.
    [out]pOdoCanConfStruct to hold configuration of the CAN odometer.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdOdoCanSetConf()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdOdoCanSetConf (SbgEComHandlepHandle,
    SbgEComCmdOdoCanChannel canChannel,
    const SbgEComCmdOdoCanConfpOdoCanConf 
    )
    +
    +

    Set the CAN odometer configuration for a specific CAN information channel

    +
    Parameters
    + + + + +
    [in]pHandleA valid sbgECom handle.
    [in]canChannelThe CAN channel to define associated DBC configuration.
    [in]pOdoCanConfStruct holding configuration for the CAN odometer.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_odo_8h_source.html b/doc/html/sbg_e_com_cmd_odo_8h_source.html new file mode 100644 index 0000000..488ea8c --- /dev/null +++ b/doc/html/sbg_e_com_cmd_odo_8h_source.html @@ -0,0 +1,172 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdOdo.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComCmdOdo.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_CMD_ODO_H
    +
    33#define SBG_ECOM_CMD_ODO_H
    +
    34
    +
    35// sbgCommonLib headers
    +
    36#include <sbgCommon.h>
    +
    37
    +
    38// Project headers
    +
    39#include <sbgECom.h>
    +
    40
    +
    41// Local headers
    +
    42#include "sbgEComCmdCommon.h"
    +
    43
    +
    44#ifdef __cplusplus
    +
    45extern "C" {
    +
    46#endif
    +
    47
    +
    48//----------------------------------------------------------------------//
    +
    49//- Public definitions -//
    +
    50//----------------------------------------------------------------------//
    +
    51
    +
    55typedef struct _SbgEComOdoConf
    +
    56{
    +
    57 float gain;
    +
    58 uint8_t gainError;
    + + +
    61
    + +
    66{
    + + +
    69
    + +
    75{
    + + + +
    79
    +
    80/*
    +
    81 * Define CAN odometer options bitmask
    +
    82 */
    +
    83#define SBG_ECOM_CMD_ODO_CAN_ENABLE (uint16_t)(0x0001 << 0)
    +
    84#define SBG_ECOM_CMD_ODO_CAN_ID_EXTENDED (uint16_t)(0x0001 << 1)
    +
    85#define SBG_ECOM_CMD_ODO_CAN_BIG_ENDIAN (uint16_t)(0x0001 << 2)
    +
    86#define SBG_ECOM_CMD_ODO_CAN_SIGNED (uint16_t)(0x0001 << 3)
    + +
    93{
    +
    94 uint16_t options;
    +
    95 uint32_t canId;
    +
    97 size_t startBit;
    +
    98 size_t dataSize;
    +
    100 float scale;
    +
    101 float offset;
    +
    102 float minValue;
    +
    103 float maxValue;
    + +
    105
    +
    106//----------------------------------------------------------------------//
    +
    107//- Public methods -//
    +
    108//----------------------------------------------------------------------//
    +
    109
    +
    117SbgErrorCode sbgEComCmdOdoGetConf(SbgEComHandle *pHandle, SbgEComOdoConf *pOdometerConf);
    +
    118
    +
    126SbgErrorCode sbgEComCmdOdoSetConf(SbgEComHandle *pHandle, const SbgEComOdoConf *pOdometerConf);
    +
    127
    +
    135SbgErrorCode sbgEComCmdOdoGetLeverArm(SbgEComHandle *pHandle, float *pLeverArm);
    +
    136
    +
    144SbgErrorCode sbgEComCmdOdoSetLeverArm(SbgEComHandle *pHandle, const float *pLeverArm);
    +
    145
    + +
    154
    +
    162SbgErrorCode sbgEComCmdOdoSetRejection(SbgEComHandle *pHandle, const SbgEComOdoRejectionConf *pRejectConf);
    +
    163
    + +
    173
    +
    182SbgErrorCode sbgEComCmdOdoCanSetConf(SbgEComHandle *pHandle, SbgEComCmdOdoCanChannel canChannel, const SbgEComCmdOdoCanConf *pOdoCanConf);
    +
    183
    +
    184#ifdef __cplusplus
    +
    185}
    +
    186#endif
    +
    187
    +
    188#endif // SBG_ECOM_CMD_ODO_H
    +
    Contains main sbgECom methods.
    +
    Definitions and methods common to all commands.
    +
    enum _SbgEComRejectionMode SbgEComRejectionMode
    +
    SbgErrorCode sbgEComCmdOdoGetRejection(SbgEComHandle *pHandle, SbgEComOdoRejectionConf *pRejectConf)
    +
    struct _SbgEComOdoConf SbgEComOdoConf
    +
    SbgErrorCode sbgEComCmdOdoGetConf(SbgEComHandle *pHandle, SbgEComOdoConf *pOdometerConf)
    +
    enum _SbgEComCmdOdoCanChannel SbgEComCmdOdoCanChannel
    +
    SbgErrorCode sbgEComCmdOdoGetLeverArm(SbgEComHandle *pHandle, float *pLeverArm)
    +
    SbgErrorCode sbgEComCmdOdoCanSetConf(SbgEComHandle *pHandle, SbgEComCmdOdoCanChannel canChannel, const SbgEComCmdOdoCanConf *pOdoCanConf)
    +
    _SbgEComCmdOdoCanChannel
    Definition: sbgEComCmdOdo.h:75
    +
    @ SBG_ECOM_CMD_ODO_CAN_CH_VELOCITY
    Definition: sbgEComCmdOdo.h:76
    +
    @ SBG_ECOM_CMD_ODO_CAN_CH_REVERSE
    Definition: sbgEComCmdOdo.h:77
    +
    SbgErrorCode sbgEComCmdOdoCanGetConf(SbgEComHandle *pHandle, SbgEComCmdOdoCanChannel canChannel, SbgEComCmdOdoCanConf *pOdoCanConf)
    +
    struct _SbgEComCmdOdoCanConf SbgEComCmdOdoCanConf
    +
    SbgErrorCode sbgEComCmdOdoSetLeverArm(SbgEComHandle *pHandle, const float *pLeverArm)
    +
    SbgErrorCode sbgEComCmdOdoSetConf(SbgEComHandle *pHandle, const SbgEComOdoConf *pOdometerConf)
    +
    SbgErrorCode sbgEComCmdOdoSetRejection(SbgEComHandle *pHandle, const SbgEComOdoRejectionConf *pRejectConf)
    +
    struct _SbgEComOdoRejectionConf SbgEComOdoRejectionConf
    +
    Definition: sbgEComCmdOdo.h:93
    +
    float maxValue
    Definition: sbgEComCmdOdo.h:103
    +
    size_t startBit
    Definition: sbgEComCmdOdo.h:97
    +
    uint32_t canId
    Definition: sbgEComCmdOdo.h:95
    +
    float offset
    Definition: sbgEComCmdOdo.h:101
    +
    size_t dataSize
    Definition: sbgEComCmdOdo.h:98
    +
    float scale
    Definition: sbgEComCmdOdo.h:100
    +
    float minValue
    Definition: sbgEComCmdOdo.h:102
    +
    uint16_t options
    Definition: sbgEComCmdOdo.h:94
    +
    Definition: sbgECom.h:81
    +
    Definition: sbgEComCmdOdo.h:56
    +
    float gain
    Definition: sbgEComCmdOdo.h:57
    +
    bool reverseMode
    Definition: sbgEComCmdOdo.h:59
    +
    uint8_t gainError
    Definition: sbgEComCmdOdo.h:58
    +
    Definition: sbgEComCmdOdo.h:66
    +
    SbgEComRejectionMode velocity
    Definition: sbgEComCmdOdo.h:67
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_output_8h.html b/doc/html/sbg_e_com_cmd_output_8h.html new file mode 100644 index 0000000..40aee4c --- /dev/null +++ b/doc/html/sbg_e_com_cmd_output_8h.html @@ -0,0 +1,747 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdOutput.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComCmdOutput.h File Reference
    +
    +
    + +

    Commands used to setup logs to output over the device interfaces. +More...

    +
    #include <sbgCommon.h>
    +#include <sbgECom.h>
    +
    +

    Go to the source code of this file.

    + + + + + + + + +

    +Typedefs

    typedef enum _SbgEComOutputPort SbgEComOutputPort
     
    typedef enum _SbgEComOutputMode SbgEComOutputMode
     
    typedef enum _SbgEComOutputMonitoringPoint SbgEComOutputMonitoringPoint
     
    + + + + + + + +

    +Enumerations

    enum  _SbgEComOutputPort {
    +  SBG_ECOM_OUTPUT_PORT_A = 0 +,
    +  SBG_ECOM_OUTPUT_PORT_C = 2 +,
    +  SBG_ECOM_OUTPUT_PORT_E = 4 +
    + }
     
    enum  _SbgEComOutputMode {
    +  SBG_ECOM_OUTPUT_MODE_DISABLED = 0 +,
    +  SBG_ECOM_OUTPUT_MODE_MAIN_LOOP = 1 +,
    +  SBG_ECOM_OUTPUT_MODE_DIV_2 = 2 +,
    +  SBG_ECOM_OUTPUT_MODE_DIV_4 = 4 +,
    +  SBG_ECOM_OUTPUT_MODE_DIV_5 = 5 +,
    +  SBG_ECOM_OUTPUT_MODE_DIV_8 = 8 +,
    +  SBG_ECOM_OUTPUT_MODE_DIV_10 = 10 +,
    +  SBG_ECOM_OUTPUT_MODE_DIV_20 = 20 +,
    +  SBG_ECOM_OUTPUT_MODE_DIV_40 = 40 +,
    +  SBG_ECOM_OUTPUT_MODE_DIV_200 = 200 +,
    +  SBG_ECOM_OUTPUT_MODE_PPS = 10000 +,
    +  SBG_ECOM_OUTPUT_MODE_NEW_DATA = 10001 +,
    +  SBG_ECOM_OUTPUT_MODE_EVENT_IN_A = 10003 +,
    +  SBG_ECOM_OUTPUT_MODE_EVENT_IN_B = 10004 +,
    +  SBG_ECOM_OUTPUT_MODE_EVENT_IN_C = 10005 +,
    +  SBG_ECOM_OUTPUT_MODE_EVENT_IN_D = 10006 +,
    +  SBG_ECOM_OUTPUT_MODE_EVENT_IN_E = 10007 +,
    +  SBG_ECOM_OUTPUT_MODE_HIGH_FREQ_LOOP = 20001 +
    + }
     
    enum  _SbgEComOutputMonitoringPoint {
    +  SBG_ECOM_OUTPUT_MONITORING_POINT_IMU = 0 +,
    +  SBG_ECOM_OUTPUT_MONITORING_POINT_COG = 1 +,
    +  SBG_ECOM_OUTPUT_MONITORING_POINT_1 = 2 +,
    +  SBG_ECOM_OUTPUT_MONITORING_POINT_2 = 3 +,
    +  SBG_ECOM_OUTPUT_MONITORING_POINT_3 = 4 +,
    +  SBG_ECOM_OUTPUT_MONITORING_NUM +
    + }
     
    + + + + + + + + + + + + + + + + + +

    +Functions

    SbgErrorCode sbgEComCmdOutputGetConf (SbgEComHandle *pHandle, SbgEComOutputPort outputPort, SbgEComClass classId, SbgEComMsgId msgId, SbgEComOutputMode *pMode)
     
    SbgErrorCode sbgEComCmdOutputSetConf (SbgEComHandle *pHandle, SbgEComOutputPort outputPort, SbgEComClass classId, SbgEComMsgId msgId, SbgEComOutputMode mode)
     
    SbgErrorCode sbgEComCmdOutputClassGetEnable (SbgEComHandle *pHandle, SbgEComOutputPort outputPort, SbgEComClass classId, bool *pEnable)
     
    SbgErrorCode sbgEComCmdOutputClassSetEnable (SbgEComHandle *pHandle, SbgEComOutputPort outputPort, SbgEComClass classId, bool enable)
     
    SbgErrorCode sbgEComCmdCanOutputGetConf (SbgEComHandle *pHandle, SbgECanMessageId internalId, SbgEComOutputMode *pMode, uint32_t *pUserId, bool *pExtended)
     
    SbgErrorCode sbgEComCmdCanOutputSetConf (SbgEComHandle *pHandle, SbgECanMessageId internalId, SbgEComOutputMode mode, uint32_t userId, bool extended)
     
    SbgErrorCode sbgEComCmdOutputGetNmeaTalkerId (SbgEComHandle *pHandle, SbgEComOutputPort outputPort, char *pNmeaTalkerId)
     
    SbgErrorCode sbgEComCmdOutputSetNmeaTalkerId (SbgEComHandle *pHandle, SbgEComOutputPort outputPort, const char *pNmeaTalkerId)
     
    +

    Detailed Description

    +

    Commands used to setup logs to output over the device interfaces.

    +
    Author
    SBG Systems
    +
    Date
    11 June 2014
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Typedef Documentation

    + +

    ◆ SbgEComOutputPort

    + +
    +
    + + + + +
    typedef enum _SbgEComOutputPort SbgEComOutputPort
    +
    +

    List of ouput ports available.

    + +
    +
    + +

    ◆ SbgEComOutputMode

    + +
    +
    + + + + +
    typedef enum _SbgEComOutputMode SbgEComOutputMode
    +
    +

    List of output modes available.

    + +
    +
    + +

    ◆ SbgEComOutputMonitoringPoint

    + +
    +
    +

    Defines which monitoring point to use for an output port. This feature enabled deporting measurements at a specific monitoring point.

    + +
    +
    +

    Enumeration Type Documentation

    + +

    ◆ _SbgEComOutputPort

    + +
    +
    + + + + +
    enum _SbgEComOutputPort
    +
    +

    List of ouput ports available.

    + + + + +
    Enumerator
    SBG_ECOM_OUTPUT_PORT_A 

    Main output port.

    +
    SBG_ECOM_OUTPUT_PORT_C 

    Secondary output port only available on Ellipse-E devices

    +
    SBG_ECOM_OUTPUT_PORT_E 

    Secondary output port only available on B1 devices

    +
    + +
    +
    + +

    ◆ _SbgEComOutputMode

    + +
    +
    + + + + +
    enum _SbgEComOutputMode
    +
    +

    List of output modes available.

    + + + + + + + + + + + + + + + + + + + +
    Enumerator
    SBG_ECOM_OUTPUT_MODE_DISABLED 

    This output is disabled.

    +
    SBG_ECOM_OUTPUT_MODE_MAIN_LOOP 

    Output the message every main loop (ie 200 Hz).

    +
    SBG_ECOM_OUTPUT_MODE_DIV_2 

    Output the message every 2 main loops (ie 100 Hz).

    +
    SBG_ECOM_OUTPUT_MODE_DIV_4 

    Output the message every 4 main loops (ie 50 Hz).

    +
    SBG_ECOM_OUTPUT_MODE_DIV_5 

    Output the message every 4 main loops (ie 40 Hz).

    +
    SBG_ECOM_OUTPUT_MODE_DIV_8 

    Output the message every 8 main loops (ie 25 Hz).

    +
    SBG_ECOM_OUTPUT_MODE_DIV_10 

    Output the message every 10 main loops (ie 20 Hz).

    +
    SBG_ECOM_OUTPUT_MODE_DIV_20 

    Output the message every 20 main loops (ie 10 Hz).

    +
    SBG_ECOM_OUTPUT_MODE_DIV_40 

    Output the message every 40 main loops (ie 5 Hz).

    +
    SBG_ECOM_OUTPUT_MODE_DIV_200 

    Output the message every 200 main loops (ie 1 Hz).

    +
    SBG_ECOM_OUTPUT_MODE_PPS 

    Output the message on a Pulse Per Second event.

    +
    SBG_ECOM_OUTPUT_MODE_NEW_DATA 

    Output sent when a new data is available.

    +
    SBG_ECOM_OUTPUT_MODE_EVENT_IN_A 

    Output the message when a Sync A is received.

    +
    SBG_ECOM_OUTPUT_MODE_EVENT_IN_B 

    Output the message when a Sync B is received.

    +
    SBG_ECOM_OUTPUT_MODE_EVENT_IN_C 

    Output the message when a Sync C is received.

    +
    SBG_ECOM_OUTPUT_MODE_EVENT_IN_D 

    Output the message when a Sync D is received.

    +
    SBG_ECOM_OUTPUT_MODE_EVENT_IN_E 

    Output the message when a Sync E is received.

    +
    SBG_ECOM_OUTPUT_MODE_HIGH_FREQ_LOOP 

    Output the message in the 1KHz IMU loop

    +
    + +
    +
    + +

    ◆ _SbgEComOutputMonitoringPoint

    + +
    +
    +

    Defines which monitoring point to use for an output port. This feature enabled deporting measurements at a specific monitoring point.

    + + + + + + + +
    Enumerator
    SBG_ECOM_OUTPUT_MONITORING_POINT_IMU 

    Output measurements at the IMU location.

    +
    SBG_ECOM_OUTPUT_MONITORING_POINT_COG 

    Output measurements at the center of rotation.

    +
    SBG_ECOM_OUTPUT_MONITORING_POINT_1 

    Output measurements at the user deported location 1 (only for Ekinox and Apogee).

    +
    SBG_ECOM_OUTPUT_MONITORING_POINT_2 

    Output measurements at the user deported location 2 (only for Ekinox and Apogee).

    +
    SBG_ECOM_OUTPUT_MONITORING_POINT_3 

    Output measurements at the user deported location 3 (only for Ekinox and Apogee).

    +
    SBG_ECOM_OUTPUT_MONITORING_NUM 

    Number of output monitoring points.

    +
    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgEComCmdOutputGetConf()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdOutputGetConf (SbgEComHandlepHandle,
    SbgEComOutputPort outputPort,
    SbgEComClass classId,
    SbgEComMsgId msgId,
    SbgEComOutputModepMode 
    )
    +
    +

    Retrieve the configuration of one the message on one of the output interfaces.

    +
    Parameters
    + + + + + + +
    [in]pHandleA valid sbgECom handle.
    [in]outputPortThe output port of the device for the log concerned.
    [in]classIdThe class of the concerned log.
    [in]msgIdThe id of the concerned log.
    [out]pModePointer to a SbgEComOutputMode to contain the current output mode of the message.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdOutputSetConf()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdOutputSetConf (SbgEComHandlepHandle,
    SbgEComOutputPort outputPort,
    SbgEComClass classId,
    SbgEComMsgId msgId,
    SbgEComOutputMode mode 
    )
    +
    +

    Set the configuration of one the message on one of the output interfaces.

    +
    Parameters
    + + + + + + +
    [in]pHandleA valid sbgECom handle.
    [in]outputPortThe output port of the device for the log concerned.
    [in]classIdThe class of the concerned log.
    [in]msgIdThe id of the concerned log.
    [in]modeNew output mode to set.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdOutputClassGetEnable()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdOutputClassGetEnable (SbgEComHandlepHandle,
    SbgEComOutputPort outputPort,
    SbgEComClass classId,
    bool * pEnable 
    )
    +
    +

    Retrieve the enable of one of the output class message on one of the output interfaces.

    +
    Parameters
    + + + + + +
    [in]pHandleA valid sbgECom handle.
    [in]outputPortThe output port.
    [in]classIdThe class to enable or disable.
    [out]pEnableTRUE to enable message output of this class, FALSE to disable it.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdOutputClassSetEnable()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdOutputClassSetEnable (SbgEComHandlepHandle,
    SbgEComOutputPort outputPort,
    SbgEComClass classId,
    bool enable 
    )
    +
    +

    Set the enable of one of the output class message on one of the output interfaces.

    +
    Parameters
    + + + + + +
    [in]pHandleA valid sbgECom handle.
    [in]outputPortThe output port.
    [in]classIdThe class to enable or disable.
    [in]enableTRUE to enable message output of this class, FALSE to disable it.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdCanOutputGetConf()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdCanOutputGetConf (SbgEComHandlepHandle,
    SbgECanMessageId internalId,
    SbgEComOutputModepMode,
    uint32_t * pUserId,
    bool * pExtended 
    )
    +
    +

    Retrieve the configuration of one the message on the CAN interface.

    +
    Parameters
    + + + + + + +
    [in]pHandleA valid sbgECom handle.
    [in]internalIdThe internal message id.
    [out]pModePointer to a SbgEComOutputMode to contain the current output mode of the message.
    [out]pUserIdThe user defined message id.
    [out]pExtendedTRUE if the user id uses the extended format.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdCanOutputSetConf()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdCanOutputSetConf (SbgEComHandlepHandle,
    SbgECanMessageId internalId,
    SbgEComOutputMode mode,
    uint32_t userId,
    bool extended 
    )
    +
    +

    Set the configuration of one the message on the CAN interface

    +
    Parameters
    + + + + + + +
    [in]pHandleA valid sbgECom handle.
    [in]internalIdThe internal message id.
    [in]modePointer to a SbgEComOutputMode containing the new output mode of the message.
    [in]userIdThe user defined message id.
    [in]extendedTRUE if the user id uses the extended format.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdOutputGetNmeaTalkerId()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdOutputGetNmeaTalkerId (SbgEComHandlepHandle,
    SbgEComOutputPort outputPort,
    char * pNmeaTalkerId 
    )
    +
    +

    Retrieve the NMEA talker id of one of the output interfaces.

    +
    Parameters
    + + + + +
    [in]pHandleA valid sbgECom handle.
    [in]outputPortThe output port of the device for the log concerned.
    [out]pNmeaTalkerIdA 2-char array to contain the nmea talker id.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdOutputSetNmeaTalkerId()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdOutputSetNmeaTalkerId (SbgEComHandlepHandle,
    SbgEComOutputPort outputPort,
    const char * pNmeaTalkerId 
    )
    +
    +

    Set the NMEA talker id of one of the output interfaces.

    +
    Parameters
    + + + + +
    [in]pHandleA valid sbgECom handle.
    [in]outputPortThe output port of the device for the log concerned.
    [out]pNmeaTalkerIdA 2-char array containint the new nmea talker id.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_output_8h_source.html b/doc/html/sbg_e_com_cmd_output_8h_source.html new file mode 100644 index 0000000..d0da1a0 --- /dev/null +++ b/doc/html/sbg_e_com_cmd_output_8h_source.html @@ -0,0 +1,183 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdOutput.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComCmdOutput.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_CMD_OUTPUT_H
    +
    33#define SBG_ECOM_CMD_OUTPUT_H
    +
    34
    +
    35// sbgCommonLib headers
    +
    36#include <sbgCommon.h>
    +
    37
    +
    38// Project headers
    +
    39#include <sbgECom.h>
    +
    40
    +
    41#ifdef __cplusplus
    +
    42extern "C" {
    +
    43#endif
    +
    44
    +
    45//----------------------------------------------------------------------//
    +
    46//- Public definitions -//
    +
    47//----------------------------------------------------------------------//
    +
    48
    + +
    53{
    + + + + +
    58
    + +
    63{
    + + + + + + + + + + + + + + + + + + + +
    83
    + +
    89{
    + + + + + + + +
    97
    +
    98//----------------------------------------------------------------------//
    +
    99//- Public methods -//
    +
    100//----------------------------------------------------------------------//
    +
    101
    + +
    113
    + +
    125
    +
    135SbgErrorCode sbgEComCmdOutputClassGetEnable(SbgEComHandle *pHandle, SbgEComOutputPort outputPort, SbgEComClass classId, bool *pEnable);
    +
    136
    +
    146SbgErrorCode sbgEComCmdOutputClassSetEnable(SbgEComHandle *pHandle, SbgEComOutputPort outputPort, SbgEComClass classId, bool enable);
    +
    147
    +
    158SbgErrorCode sbgEComCmdCanOutputGetConf(SbgEComHandle *pHandle, SbgECanMessageId internalId, SbgEComOutputMode *pMode, uint32_t *pUserId, bool *pExtended);
    +
    159
    +
    170SbgErrorCode sbgEComCmdCanOutputSetConf(SbgEComHandle *pHandle, SbgECanMessageId internalId, SbgEComOutputMode mode, uint32_t userId, bool extended);
    +
    171
    +
    180SbgErrorCode sbgEComCmdOutputGetNmeaTalkerId(SbgEComHandle *pHandle, SbgEComOutputPort outputPort, char *pNmeaTalkerId);
    +
    181
    +
    190SbgErrorCode sbgEComCmdOutputSetNmeaTalkerId(SbgEComHandle *pHandle, SbgEComOutputPort outputPort, const char *pNmeaTalkerId);
    +
    191
    +
    192#ifdef __cplusplus
    +
    193}
    +
    194#endif
    +
    195
    +
    196#endif // SBG_ECOM_CMD_OUTPUT_H
    +
    enum _SbgECanMessageId SbgECanMessageId
    +
    Contains main sbgECom methods.
    +
    SbgErrorCode sbgEComCmdOutputGetNmeaTalkerId(SbgEComHandle *pHandle, SbgEComOutputPort outputPort, char *pNmeaTalkerId)
    +
    enum _SbgEComOutputMode SbgEComOutputMode
    +
    _SbgEComOutputMonitoringPoint
    Definition: sbgEComCmdOutput.h:89
    +
    @ SBG_ECOM_OUTPUT_MONITORING_POINT_3
    Definition: sbgEComCmdOutput.h:94
    +
    @ SBG_ECOM_OUTPUT_MONITORING_POINT_COG
    Definition: sbgEComCmdOutput.h:91
    +
    @ SBG_ECOM_OUTPUT_MONITORING_POINT_2
    Definition: sbgEComCmdOutput.h:93
    +
    @ SBG_ECOM_OUTPUT_MONITORING_NUM
    Definition: sbgEComCmdOutput.h:95
    +
    @ SBG_ECOM_OUTPUT_MONITORING_POINT_IMU
    Definition: sbgEComCmdOutput.h:90
    +
    @ SBG_ECOM_OUTPUT_MONITORING_POINT_1
    Definition: sbgEComCmdOutput.h:92
    +
    SbgErrorCode sbgEComCmdCanOutputGetConf(SbgEComHandle *pHandle, SbgECanMessageId internalId, SbgEComOutputMode *pMode, uint32_t *pUserId, bool *pExtended)
    +
    enum _SbgEComOutputMonitoringPoint SbgEComOutputMonitoringPoint
    +
    SbgErrorCode sbgEComCmdCanOutputSetConf(SbgEComHandle *pHandle, SbgECanMessageId internalId, SbgEComOutputMode mode, uint32_t userId, bool extended)
    +
    _SbgEComOutputPort
    Definition: sbgEComCmdOutput.h:53
    +
    @ SBG_ECOM_OUTPUT_PORT_A
    Definition: sbgEComCmdOutput.h:54
    +
    @ SBG_ECOM_OUTPUT_PORT_E
    Definition: sbgEComCmdOutput.h:56
    +
    @ SBG_ECOM_OUTPUT_PORT_C
    Definition: sbgEComCmdOutput.h:55
    +
    SbgErrorCode sbgEComCmdOutputClassSetEnable(SbgEComHandle *pHandle, SbgEComOutputPort outputPort, SbgEComClass classId, bool enable)
    +
    SbgErrorCode sbgEComCmdOutputSetNmeaTalkerId(SbgEComHandle *pHandle, SbgEComOutputPort outputPort, const char *pNmeaTalkerId)
    +
    SbgErrorCode sbgEComCmdOutputSetConf(SbgEComHandle *pHandle, SbgEComOutputPort outputPort, SbgEComClass classId, SbgEComMsgId msgId, SbgEComOutputMode mode)
    +
    SbgErrorCode sbgEComCmdOutputClassGetEnable(SbgEComHandle *pHandle, SbgEComOutputPort outputPort, SbgEComClass classId, bool *pEnable)
    +
    SbgErrorCode sbgEComCmdOutputGetConf(SbgEComHandle *pHandle, SbgEComOutputPort outputPort, SbgEComClass classId, SbgEComMsgId msgId, SbgEComOutputMode *pMode)
    +
    enum _SbgEComOutputPort SbgEComOutputPort
    +
    _SbgEComOutputMode
    Definition: sbgEComCmdOutput.h:63
    +
    @ SBG_ECOM_OUTPUT_MODE_DIV_20
    Definition: sbgEComCmdOutput.h:71
    +
    @ SBG_ECOM_OUTPUT_MODE_HIGH_FREQ_LOOP
    Definition: sbgEComCmdOutput.h:81
    +
    @ SBG_ECOM_OUTPUT_MODE_DIV_8
    Definition: sbgEComCmdOutput.h:69
    +
    @ SBG_ECOM_OUTPUT_MODE_DIV_200
    Definition: sbgEComCmdOutput.h:73
    +
    @ SBG_ECOM_OUTPUT_MODE_EVENT_IN_B
    Definition: sbgEComCmdOutput.h:77
    +
    @ SBG_ECOM_OUTPUT_MODE_DIV_5
    Definition: sbgEComCmdOutput.h:68
    +
    @ SBG_ECOM_OUTPUT_MODE_EVENT_IN_E
    Definition: sbgEComCmdOutput.h:80
    +
    @ SBG_ECOM_OUTPUT_MODE_DIV_10
    Definition: sbgEComCmdOutput.h:70
    +
    @ SBG_ECOM_OUTPUT_MODE_DISABLED
    Definition: sbgEComCmdOutput.h:64
    +
    @ SBG_ECOM_OUTPUT_MODE_DIV_2
    Definition: sbgEComCmdOutput.h:66
    +
    @ SBG_ECOM_OUTPUT_MODE_DIV_4
    Definition: sbgEComCmdOutput.h:67
    +
    @ SBG_ECOM_OUTPUT_MODE_EVENT_IN_D
    Definition: sbgEComCmdOutput.h:79
    +
    @ SBG_ECOM_OUTPUT_MODE_EVENT_IN_A
    Definition: sbgEComCmdOutput.h:76
    +
    @ SBG_ECOM_OUTPUT_MODE_DIV_40
    Definition: sbgEComCmdOutput.h:72
    +
    @ SBG_ECOM_OUTPUT_MODE_PPS
    Definition: sbgEComCmdOutput.h:74
    +
    @ SBG_ECOM_OUTPUT_MODE_EVENT_IN_C
    Definition: sbgEComCmdOutput.h:78
    +
    @ SBG_ECOM_OUTPUT_MODE_MAIN_LOOP
    Definition: sbgEComCmdOutput.h:65
    +
    @ SBG_ECOM_OUTPUT_MODE_NEW_DATA
    Definition: sbgEComCmdOutput.h:75
    +
    uint8_t SbgEComMsgId
    Definition: sbgEComIds.h:303
    +
    enum _SbgEComClass SbgEComClass
    +
    Definition: sbgECom.h:81
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_sensor_8h.html b/doc/html/sbg_e_com_cmd_sensor_8h.html new file mode 100644 index 0000000..508be51 --- /dev/null +++ b/doc/html/sbg_e_com_cmd_sensor_8h.html @@ -0,0 +1,730 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdSensor.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComCmdSensor.h File Reference
    +
    +
    + +

    Motion profile, aiding assignement & sensor installation commands. +More...

    +
    #include <sbgCommon.h>
    +#include <sbgECom.h>
    +#include "sbgEComCmdCommon.h"
    +
    +

    Go to the source code of this file.

    + + + + + + + + +

    +Data Structures

    struct  _SbgEComAidingAssignConf
     
    struct  _SbgEComSensorAlignmentInfo
     
    struct  _SbgEComInitConditionConf
     
    + + + + + + + + + + + + + + + +

    +Typedefs

    typedef enum _SbgEComModulePortAssignment SbgEComModulePortAssignment
     
    typedef enum _SbgEComModuleSyncAssignment SbgEComModuleSyncAssignment
     
    typedef enum _SbgEComOdometerPinAssignment SbgEComOdometerPinAssignment
     
    typedef enum _SbgEComMotionProfileStdIds SbgEComMotionProfileStdIds
     
    typedef struct _SbgEComAidingAssignConf SbgEComAidingAssignConf
     
    typedef struct _SbgEComSensorAlignmentInfo SbgEComSensorAlignmentInfo
     
    typedef struct _SbgEComInitConditionConf SbgEComInitConditionConf
     
    + + + + + + + + + +

    +Enumerations

    enum  _SbgEComModulePortAssignment {
    +  SBG_ECOM_MODULE_PORT_A = 0 +,
    +  SBG_ECOM_MODULE_PORT_B = 1 +,
    +  SBG_ECOM_MODULE_PORT_C = 2 +,
    +  SBG_ECOM_MODULE_PORT_D = 3 +,
    +  SBG_ECOM_MODULE_PORT_E = 4 +,
    +  SBG_ECOM_MODULE_INTERNAL = 5 +,
    +  SBG_ECOM_MODULE_DISABLED = 0xFF +
    + }
     
    enum  _SbgEComModuleSyncAssignment {
    +  SBG_ECOM_MODULE_SYNC_DISABLED = 0 +,
    +  SBG_ECOM_MODULE_SYNC_IN_A = 1 +,
    +  SBG_ECOM_MODULE_SYNC_IN_B = 2 +,
    +  SBG_ECOM_MODULE_SYNC_IN_C = 3 +,
    +  SBG_ECOM_MODULE_SYNC_IN_D = 4 +,
    +  SBG_ECOM_MODULE_SYNC_INTERNAL = 5 +,
    +  SBG_ECOM_MODULE_SYNC_OUT_A = 6 +,
    +  SBG_ECOM_MODULE_SYNC_OUT_B = 7 +
    + }
     
    enum  _SbgEComOdometerPinAssignment {
    +  SBG_ECOM_MODULE_ODO_DISABLED = 0 +,
    +  SBG_ECOM_MODULE_ODO_A = 1 +,
    +  SBG_ECOM_MODULE_ODO_A_B = 2 +,
    +  SBG_ECOM_MODULE_ODO_CAN = 3 +
    + }
     
    enum  _SbgEComMotionProfileStdIds {
    +  SBG_ECOM_MOTION_PROFILE_GENERAL_PURPOSE = 1 +,
    +  SBG_ECOM_MOTION_PROFILE_AUTOMOTIVE = 2 +,
    +  SBG_ECOM_MOTION_PROFILE_MARINE = 3 +,
    +  SBG_ECOM_MOTION_PROFILE_AIRPLANE = 4 +,
    +  SBG_ECOM_MOTION_PROFILE_HELICOPTER = 5 +,
    +  SBG_ECOM_MOTION_PROFILE_UAV_ROTARY_WING = 7 +,
    +  SBG_ECOM_MOTION_PROFILE_HEAVY_MACHINERY = 8 +
    + }
     
    + + + + + + + + + + + + + + + + + +

    +Functions

    SbgErrorCode sbgEComCmdSensorSetMotionProfileId (SbgEComHandle *pHandle, SbgEComMotionProfileStdIds modelId)
     
    SbgErrorCode sbgEComCmdSensorGetMotionProfileId (SbgEComHandle *pHandle, SbgEComMotionProfileStdIds *pModelId)
     
    SbgErrorCode sbgEComCmdSensorGetInitCondition (SbgEComHandle *pHandle, SbgEComInitConditionConf *pConf)
     
    SbgErrorCode sbgEComCmdSensorSetInitCondition (SbgEComHandle *pHandle, const SbgEComInitConditionConf *pConf)
     
    SbgErrorCode sbgEComCmdSensorGetAidingAssignment (SbgEComHandle *pHandle, SbgEComAidingAssignConf *pConf)
     
    SbgErrorCode sbgEComCmdSensorSetAidingAssignment (SbgEComHandle *pHandle, const SbgEComAidingAssignConf *pConf)
     
    SbgErrorCode sbgEComCmdSensorGetAlignmentAndLeverArm (SbgEComHandle *pHandle, SbgEComSensorAlignmentInfo *pAlignConf, float *pLeverArm)
     
    SbgErrorCode sbgEComCmdSensorSetAlignmentAndLeverArm (SbgEComHandle *pHandle, const SbgEComSensorAlignmentInfo *pAlignConf, const float *pLeverArm)
     
    +

    Detailed Description

    +

    Motion profile, aiding assignement & sensor installation commands.

    +
    Author
    SBG Systems
    +
    Date
    11 June 2014
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Typedef Documentation

    + +

    ◆ SbgEComModulePortAssignment

    + +
    +
    +

    Ports available for the modules.

    + +
    +
    + +

    ◆ SbgEComModuleSyncAssignment

    + +
    +
    +

    Synchronization signals available for the modules.

    + +
    +
    + +

    ◆ SbgEComOdometerPinAssignment

    + +
    +
    +

    List of configurations available for the odometer.

    + +
    +
    + +

    ◆ SbgEComMotionProfileStdIds

    + +
    +
    +

    This enum defines the different motion profile IDs available in standard

    + +
    +
    + +

    ◆ SbgEComAidingAssignConf

    + +
    +
    +

    Helper structure for module assignments

    + +
    +
    + +

    ◆ SbgEComSensorAlignmentInfo

    + +
    +
    +

    Helper structure for sensor alignment details

    + +
    +
    + +

    ◆ SbgEComInitConditionConf

    + +
    +
    +

    Helper structure for sensor Initial condition details

    + +
    +
    +

    Enumeration Type Documentation

    + +

    ◆ _SbgEComModulePortAssignment

    + +
    +
    +

    Ports available for the modules.

    + + + + + + + + +
    Enumerator
    SBG_ECOM_MODULE_PORT_A 

    Module connected on PORT_A.

    +
    SBG_ECOM_MODULE_PORT_B 

    Module connected on PORT_B.

    +
    SBG_ECOM_MODULE_PORT_C 

    Module connected on PORT_C.

    +
    SBG_ECOM_MODULE_PORT_D 

    Module connected on PORT_D.

    +
    SBG_ECOM_MODULE_PORT_E 

    Module connected on PORT_E.

    +
    SBG_ECOM_MODULE_INTERNAL 

    Module is connected internally.

    +
    SBG_ECOM_MODULE_DISABLED 

    Module is disabled.

    +
    + +
    +
    + +

    ◆ _SbgEComModuleSyncAssignment

    + +
    +
    +

    Synchronization signals available for the modules.

    + + + + + + + + + +
    Enumerator
    SBG_ECOM_MODULE_SYNC_DISABLED 

    Module is disabled.

    +
    SBG_ECOM_MODULE_SYNC_IN_A 

    Synchronization is done using SYNC_IN_A pin.

    +
    SBG_ECOM_MODULE_SYNC_IN_B 

    Synchronization is done using SYNC_IN_B pin.

    +
    SBG_ECOM_MODULE_SYNC_IN_C 

    Synchronization is done using SYNC_IN_C pin.

    +
    SBG_ECOM_MODULE_SYNC_IN_D 

    Synchronization is done using SYNC_IN_D pin.

    +
    SBG_ECOM_MODULE_SYNC_INTERNAL 

    Synchronization is internal.

    +
    SBG_ECOM_MODULE_SYNC_OUT_A 

    Synchronization signal is output on SYNC_OUT_A.

    +
    SBG_ECOM_MODULE_SYNC_OUT_B 

    Synchronization signal is output on SYNC_OUT_B.

    +
    + +
    +
    + +

    ◆ _SbgEComOdometerPinAssignment

    + +
    +
    +

    List of configurations available for the odometer.

    + + + + + +
    Enumerator
    SBG_ECOM_MODULE_ODO_DISABLED 

    Odometer is disabled.

    +
    SBG_ECOM_MODULE_ODO_A 

    Odometer connected only to ODO_A (unidirectional)..

    +
    SBG_ECOM_MODULE_ODO_A_B 

    Odometer connected to both ODO_A (signal A) and ODO_B (Signal B or direction) for bidirectional odometer..

    +
    SBG_ECOM_MODULE_ODO_CAN 

    Vehicle odometer using CAN (OBD-II).

    +
    + +
    +
    + +

    ◆ _SbgEComMotionProfileStdIds

    + +
    +
    + + + + +
    enum _SbgEComMotionProfileStdIds
    +
    +

    This enum defines the different motion profile IDs available in standard

    + + + + + + + + +
    Enumerator
    SBG_ECOM_MOTION_PROFILE_GENERAL_PURPOSE 

    Should be used as a default when other profiles do not apply

    +
    SBG_ECOM_MOTION_PROFILE_AUTOMOTIVE 

    Dedicated to car applications

    +
    SBG_ECOM_MOTION_PROFILE_MARINE 

    Used in marine and underwater applications

    +
    SBG_ECOM_MOTION_PROFILE_AIRPLANE 

    For fixed wings aircraft

    +
    SBG_ECOM_MOTION_PROFILE_HELICOPTER 

    For rotary wing aircraft

    +
    SBG_ECOM_MOTION_PROFILE_UAV_ROTARY_WING 

    For rotary wing UAVs that have low dynamics

    +
    SBG_ECOM_MOTION_PROFILE_HEAVY_MACHINERY 

    For vibrating applications with low dynamics and no specific travel direction

    +
    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgEComCmdSensorSetMotionProfileId()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdSensorSetMotionProfileId (SbgEComHandlepHandle,
    SbgEComMotionProfileStdIds modelId 
    )
    +
    +

    Set the motion profile id used to tune the Kalman Filter to a specific application

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [in]modelIdMotion profile id to set
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdSensorGetMotionProfileId()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdSensorGetMotionProfileId (SbgEComHandlepHandle,
    SbgEComMotionProfileStdIdspModelId 
    )
    +
    +

    Retrieve the motion profile id.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [out]pModelIdRetrieved motion profile id
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdSensorGetInitCondition()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdSensorGetInitCondition (SbgEComHandlepHandle,
    SbgEComInitConditionConfpConf 
    )
    +
    +

    Retrieve the initial conditions settings.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [out]pConfPointer to a SbgEComInitConditionConf to contain the current initial conditions settings.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdSensorSetInitCondition()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdSensorSetInitCondition (SbgEComHandlepHandle,
    const SbgEComInitConditionConfpConf 
    )
    +
    +

    Set the initial condition configuration.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [in]pConfPointer to a SbgEComInitConditionConf containing the new initial condition configuration.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdSensorGetAidingAssignment()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdSensorGetAidingAssignment (SbgEComHandlepHandle,
    SbgEComAidingAssignConfpConf 
    )
    +
    +

    Retrieve the assignment of the aiding sensors.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [out]pConfPointer to a SbgEComAidingAssignConf to contain the current assignment of the aiding sensors.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdSensorSetAidingAssignment()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdSensorSetAidingAssignment (SbgEComHandlepHandle,
    const SbgEComAidingAssignConfpConf 
    )
    +
    +

    Set the assignment of the aiding sensors.

    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [out]pConfPointer to a SbgEComAidingAssignConf containing the new assignment of the aiding sensors.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdSensorGetAlignmentAndLeverArm()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdSensorGetAlignmentAndLeverArm (SbgEComHandlepHandle,
    SbgEComSensorAlignmentInfopAlignConf,
    float * pLeverArm 
    )
    +
    +

    Retrieve the alignment and lever arm configuration of the sensor.

    +
    Parameters
    + + + + +
    [in]pHandleA valid sbgECom handle.
    [out]pAlignConfPointer to a SbgEComSensorAlignmentInfo struct to hold alignment configuration of the sensor.
    [out]pLeverArmPointer to a table to contain lever arm X, Y, Z components in meters.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdSensorSetAlignmentAndLeverArm()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdSensorSetAlignmentAndLeverArm (SbgEComHandlepHandle,
    const SbgEComSensorAlignmentInfopAlignConf,
    const float * pLeverArm 
    )
    +
    +

    Set the alignment and lever arm configuration of the sensor.

    +
    Parameters
    + + + + +
    [in]pHandleA valid sbgECom handle.
    [in]pAlignConfPointer to a SbgEComSensorAlignmentInfo struct holding alignment configuration for the sensor.
    [in]pLeverArmPointer to a table containing lever arm X, Y, Z components in meters.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_sensor_8h_source.html b/doc/html/sbg_e_com_cmd_sensor_8h_source.html new file mode 100644 index 0000000..0a4e2e8 --- /dev/null +++ b/doc/html/sbg_e_com_cmd_sensor_8h_source.html @@ -0,0 +1,247 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdSensor.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComCmdSensor.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_CMD_SENSOR_H
    +
    33#define SBG_ECOM_CMD_SENSOR_H
    +
    34
    +
    35// sbgCommonLib headers
    +
    36#include <sbgCommon.h>
    +
    37
    +
    38// Project headers
    +
    39#include <sbgECom.h>
    +
    40
    +
    41// Local headers
    +
    42#include "sbgEComCmdCommon.h"
    +
    43
    +
    44#ifdef __cplusplus
    +
    45extern "C" {
    +
    46#endif
    +
    47
    +
    48//----------------------------------------------------------------------//
    +
    49//- Sensor definitions -//
    +
    50//----------------------------------------------------------------------//
    +
    51
    + +
    56{
    + + + + + + + + +
    65
    + +
    70{
    + + + + + + + + + +
    80
    + +
    85{
    + + + + + +
    91
    + +
    96{
    + + + + + + + + +
    105
    +
    106//----------------------------------------------------------------------//
    +
    107//- Event configurations -//
    +
    108//----------------------------------------------------------------------//
    +
    109
    + +
    114{
    + + + + + + + + +
    123
    + +
    128{
    + + +
    131 float misRoll;
    +
    132 float misPitch;
    +
    133 float misYaw;
    + +
    135
    + +
    140{
    +
    141 double latitude;
    +
    142 double longitude;
    +
    143 double altitude;
    +
    144 uint16_t year;
    +
    145 uint8_t month;
    +
    146 uint8_t day;
    + +
    148
    +
    149//----------------------------------------------------------------------//
    +
    150//- Public methods -//
    +
    151//----------------------------------------------------------------------//
    +
    152
    + +
    161
    + +
    170
    + +
    179
    + +
    188
    + +
    197
    + +
    206
    +
    215SbgErrorCode sbgEComCmdSensorGetAlignmentAndLeverArm(SbgEComHandle *pHandle, SbgEComSensorAlignmentInfo *pAlignConf, float *pLeverArm);
    +
    216
    +
    225SbgErrorCode sbgEComCmdSensorSetAlignmentAndLeverArm(SbgEComHandle *pHandle, const SbgEComSensorAlignmentInfo *pAlignConf, const float *pLeverArm);
    +
    226
    +
    227#ifdef __cplusplus
    +
    228}
    +
    229#endif
    +
    230
    +
    231#endif // SBG_ECOM_CMD_SENSOR_H
    +
    Contains main sbgECom methods.
    +
    Definitions and methods common to all commands.
    +
    enum _SbgEComAxisDirection SbgEComAxisDirection
    +
    SbgErrorCode sbgEComCmdSensorSetMotionProfileId(SbgEComHandle *pHandle, SbgEComMotionProfileStdIds modelId)
    +
    SbgErrorCode sbgEComCmdSensorSetAlignmentAndLeverArm(SbgEComHandle *pHandle, const SbgEComSensorAlignmentInfo *pAlignConf, const float *pLeverArm)
    +
    SbgErrorCode sbgEComCmdSensorGetInitCondition(SbgEComHandle *pHandle, SbgEComInitConditionConf *pConf)
    +
    SbgErrorCode sbgEComCmdSensorGetAidingAssignment(SbgEComHandle *pHandle, SbgEComAidingAssignConf *pConf)
    +
    _SbgEComMotionProfileStdIds
    Definition: sbgEComCmdSensor.h:96
    +
    @ SBG_ECOM_MOTION_PROFILE_AUTOMOTIVE
    Definition: sbgEComCmdSensor.h:98
    +
    @ SBG_ECOM_MOTION_PROFILE_AIRPLANE
    Definition: sbgEComCmdSensor.h:100
    +
    @ SBG_ECOM_MOTION_PROFILE_HELICOPTER
    Definition: sbgEComCmdSensor.h:101
    +
    @ SBG_ECOM_MOTION_PROFILE_GENERAL_PURPOSE
    Definition: sbgEComCmdSensor.h:97
    +
    @ SBG_ECOM_MOTION_PROFILE_MARINE
    Definition: sbgEComCmdSensor.h:99
    +
    @ SBG_ECOM_MOTION_PROFILE_HEAVY_MACHINERY
    Definition: sbgEComCmdSensor.h:103
    +
    @ SBG_ECOM_MOTION_PROFILE_UAV_ROTARY_WING
    Definition: sbgEComCmdSensor.h:102
    +
    enum _SbgEComOdometerPinAssignment SbgEComOdometerPinAssignment
    +
    enum _SbgEComMotionProfileStdIds SbgEComMotionProfileStdIds
    +
    struct _SbgEComInitConditionConf SbgEComInitConditionConf
    +
    SbgErrorCode sbgEComCmdSensorSetAidingAssignment(SbgEComHandle *pHandle, const SbgEComAidingAssignConf *pConf)
    +
    SbgErrorCode sbgEComCmdSensorGetAlignmentAndLeverArm(SbgEComHandle *pHandle, SbgEComSensorAlignmentInfo *pAlignConf, float *pLeverArm)
    +
    SbgErrorCode sbgEComCmdSensorGetMotionProfileId(SbgEComHandle *pHandle, SbgEComMotionProfileStdIds *pModelId)
    +
    _SbgEComModuleSyncAssignment
    Definition: sbgEComCmdSensor.h:70
    +
    @ SBG_ECOM_MODULE_SYNC_OUT_A
    Definition: sbgEComCmdSensor.h:77
    +
    @ SBG_ECOM_MODULE_SYNC_IN_D
    Definition: sbgEComCmdSensor.h:75
    +
    @ SBG_ECOM_MODULE_SYNC_DISABLED
    Definition: sbgEComCmdSensor.h:71
    +
    @ SBG_ECOM_MODULE_SYNC_INTERNAL
    Definition: sbgEComCmdSensor.h:76
    +
    @ SBG_ECOM_MODULE_SYNC_IN_C
    Definition: sbgEComCmdSensor.h:74
    +
    @ SBG_ECOM_MODULE_SYNC_OUT_B
    Definition: sbgEComCmdSensor.h:78
    +
    @ SBG_ECOM_MODULE_SYNC_IN_A
    Definition: sbgEComCmdSensor.h:72
    +
    @ SBG_ECOM_MODULE_SYNC_IN_B
    Definition: sbgEComCmdSensor.h:73
    +
    enum _SbgEComModuleSyncAssignment SbgEComModuleSyncAssignment
    +
    struct _SbgEComSensorAlignmentInfo SbgEComSensorAlignmentInfo
    +
    SbgErrorCode sbgEComCmdSensorSetInitCondition(SbgEComHandle *pHandle, const SbgEComInitConditionConf *pConf)
    +
    enum _SbgEComModulePortAssignment SbgEComModulePortAssignment
    +
    _SbgEComModulePortAssignment
    Definition: sbgEComCmdSensor.h:56
    +
    @ SBG_ECOM_MODULE_DISABLED
    Definition: sbgEComCmdSensor.h:63
    +
    @ SBG_ECOM_MODULE_PORT_E
    Definition: sbgEComCmdSensor.h:61
    +
    @ SBG_ECOM_MODULE_PORT_D
    Definition: sbgEComCmdSensor.h:60
    +
    @ SBG_ECOM_MODULE_PORT_A
    Definition: sbgEComCmdSensor.h:57
    +
    @ SBG_ECOM_MODULE_INTERNAL
    Definition: sbgEComCmdSensor.h:62
    +
    @ SBG_ECOM_MODULE_PORT_C
    Definition: sbgEComCmdSensor.h:59
    +
    @ SBG_ECOM_MODULE_PORT_B
    Definition: sbgEComCmdSensor.h:58
    +
    struct _SbgEComAidingAssignConf SbgEComAidingAssignConf
    +
    _SbgEComOdometerPinAssignment
    Definition: sbgEComCmdSensor.h:85
    +
    @ SBG_ECOM_MODULE_ODO_DISABLED
    Definition: sbgEComCmdSensor.h:86
    +
    @ SBG_ECOM_MODULE_ODO_CAN
    Definition: sbgEComCmdSensor.h:89
    +
    @ SBG_ECOM_MODULE_ODO_A
    Definition: sbgEComCmdSensor.h:87
    +
    @ SBG_ECOM_MODULE_ODO_A_B
    Definition: sbgEComCmdSensor.h:88
    +
    Definition: sbgEComCmdSensor.h:114
    +
    SbgEComModulePortAssignment gps1Port
    Definition: sbgEComCmdSensor.h:115
    +
    SbgEComModuleSyncAssignment gps1Sync
    Definition: sbgEComCmdSensor.h:116
    +
    SbgEComModulePortAssignment airDataPort
    Definition: sbgEComCmdSensor.h:120
    +
    SbgEComOdometerPinAssignment odometerPinsConf
    Definition: sbgEComCmdSensor.h:121
    +
    SbgEComModuleSyncAssignment dvlSync
    Definition: sbgEComCmdSensor.h:118
    +
    SbgEComModulePortAssignment rtcmPort
    Definition: sbgEComCmdSensor.h:119
    +
    SbgEComModulePortAssignment dvlPort
    Definition: sbgEComCmdSensor.h:117
    +
    Definition: sbgECom.h:81
    +
    Definition: sbgEComCmdSensor.h:140
    +
    uint16_t year
    Definition: sbgEComCmdSensor.h:144
    +
    uint8_t day
    Definition: sbgEComCmdSensor.h:146
    +
    double latitude
    Definition: sbgEComCmdSensor.h:141
    +
    uint8_t month
    Definition: sbgEComCmdSensor.h:145
    +
    double longitude
    Definition: sbgEComCmdSensor.h:142
    +
    double altitude
    Definition: sbgEComCmdSensor.h:143
    +
    Definition: sbgEComCmdSensor.h:128
    +
    SbgEComAxisDirection axisDirectionX
    Definition: sbgEComCmdSensor.h:129
    +
    float misPitch
    Definition: sbgEComCmdSensor.h:132
    +
    float misRoll
    Definition: sbgEComCmdSensor.h:131
    +
    float misYaw
    Definition: sbgEComCmdSensor.h:133
    +
    SbgEComAxisDirection axisDirectionY
    Definition: sbgEComCmdSensor.h:130
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_settings_8h.html b/doc/html/sbg_e_com_cmd_settings_8h.html new file mode 100644 index 0000000..9c3f97d --- /dev/null +++ b/doc/html/sbg_e_com_cmd_settings_8h.html @@ -0,0 +1,283 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdSettings.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComCmdSettings.h File Reference
    +
    +
    + +

    Import/export/save settings commands. +More...

    +
    #include <sbgCommon.h>
    +#include <sbgECom.h>
    +
    +

    Go to the source code of this file.

    + + + + +

    +Typedefs

    typedef enum _SbgEComSettingsAction SbgEComSettingsAction
     
    + + + +

    +Enumerations

    enum  _SbgEComSettingsAction {
    +  SBG_ECOM_REBOOT_ONLY = 0 +,
    +  SBG_ECOM_SAVE_SETTINGS = 1 +,
    +  SBG_ECOM_RESTORE_DEFAULT_SETTINGS = 2 +
    + }
     
    + + + + + + + +

    +Functions

    SbgErrorCode sbgEComCmdSettingsAction (SbgEComHandle *pHandle, SbgEComSettingsAction action)
     
    SbgErrorCode sbgEComCmdImportSettings (SbgEComHandle *pHandle, const void *pBuffer, size_t size)
     
    SbgErrorCode sbgEComCmdExportSettings (SbgEComHandle *pHandle, void *pBuffer, size_t *pSize, size_t maxSize)
     
    +

    Detailed Description

    +

    Import/export/save settings commands.

    +
    Author
    SBG Systems
    +
    Date
    11 June 2014
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Typedef Documentation

    + +

    ◆ SbgEComSettingsAction

    + +
    +
    +

    Defintion of all the settings actions available.

    + +
    +
    +

    Enumeration Type Documentation

    + +

    ◆ _SbgEComSettingsAction

    + +
    +
    + + + + +
    enum _SbgEComSettingsAction
    +
    +

    Defintion of all the settings actions available.

    + + + + +
    Enumerator
    SBG_ECOM_REBOOT_ONLY 

    Only reboot the device.

    +
    SBG_ECOM_SAVE_SETTINGS 

    Save the settings to non-volatile memory and then reboot the device.

    +
    SBG_ECOM_RESTORE_DEFAULT_SETTINGS 

    Restore default settings, save them to non-volatile memory and reboot the device.

    +
    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgEComCmdSettingsAction()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdSettingsAction (SbgEComHandlepHandle,
    SbgEComSettingsAction action 
    )
    +
    +

    Send a command to execute a specific system action to reboot/save/restore default settings.

    +

    Execute one of the available settings action:

      +
    • SBG_ECOM_REBOOT_ONLY : Only reboot the device.
    • +
    • SBG_ECOM_SAVE_SETTINGS : Save the settings to non-volatile memory and then reboot the device.
    • +
    • SBG_ECOM_RESTORE_DEFAULT_SETTINGS : Restore default settings, save them to non-volatile memory and reboot the device.
    • +
    +
    Parameters
    + + + +
    [in]pHandleA valid sbgECom handle.
    [in]actionOne of the available SbgEComSettingsAction.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdImportSettings()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdImportSettings (SbgEComHandlepHandle,
    const void * pBuffer,
    size_t size 
    )
    +
    +

    Send a complete set of settings to the device and store them into the FLASH memory.

    +

    The device will reboot automatically to use the new settings.

    +
    Parameters
    + + + + +
    [in]pHandleA valid sbgECom handle.
    [in]pBufferRead only buffer containing the settings.
    [in]sizeSize of the buffer.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    + +

    ◆ sbgEComCmdExportSettings()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComCmdExportSettings (SbgEComHandlepHandle,
    void * pBuffer,
    size_t * pSize,
    size_t maxSize 
    )
    +
    +

    Retrieve a complete set of settings from the device as a buffer.

    +
    Parameters
    + + + + + +
    [in]pHandleA valid sbgECom handle.
    [in]pBufferAllocated buffer that can hold the received settings.
    [out]pSizeThe number of bytes that have been stored into pBuffer.
    [in]maxSizeThe maximum buffer size in bytes that can be stored into pBuffer.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the command has been executed successfully.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_cmd_settings_8h_source.html b/doc/html/sbg_e_com_cmd_settings_8h_source.html new file mode 100644 index 0000000..888ba40 --- /dev/null +++ b/doc/html/sbg_e_com_cmd_settings_8h_source.html @@ -0,0 +1,105 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdSettings.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComCmdSettings.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_CMD_SETTINGS_H
    +
    33#define SBG_ECOM_CMD_SETTINGS_H
    +
    34
    +
    35// sbgCommonLib headers
    +
    36#include <sbgCommon.h>
    +
    37
    +
    38// Project headers
    +
    39#include <sbgECom.h>
    +
    40
    +
    41#ifdef __cplusplus
    +
    42extern "C" {
    +
    43#endif
    +
    44
    +
    45//----------------------------------------------------------------------//
    +
    46//- Settings action definition -//
    +
    47//----------------------------------------------------------------------//
    +
    48
    + +
    53{
    + + + + +
    58
    +
    59//----------------------------------------------------------------------//
    +
    60//- Public methods -//
    +
    61//----------------------------------------------------------------------//
    +
    62
    + +
    76
    +
    87SbgErrorCode sbgEComCmdImportSettings(SbgEComHandle *pHandle, const void *pBuffer, size_t size);
    +
    88
    +
    98SbgErrorCode sbgEComCmdExportSettings(SbgEComHandle *pHandle, void *pBuffer, size_t *pSize, size_t maxSize);
    +
    99
    +
    100#ifdef __cplusplus
    +
    101}
    +
    102#endif
    +
    103
    +
    104#endif // SBG_ECOM_CMD_SETTINGS_H
    +
    Contains main sbgECom methods.
    +
    enum _SbgEComSettingsAction SbgEComSettingsAction
    +
    SbgErrorCode sbgEComCmdSettingsAction(SbgEComHandle *pHandle, SbgEComSettingsAction action)
    +
    SbgErrorCode sbgEComCmdImportSettings(SbgEComHandle *pHandle, const void *pBuffer, size_t size)
    +
    _SbgEComSettingsAction
    Definition: sbgEComCmdSettings.h:53
    +
    @ SBG_ECOM_RESTORE_DEFAULT_SETTINGS
    Definition: sbgEComCmdSettings.h:56
    +
    @ SBG_ECOM_REBOOT_ONLY
    Definition: sbgEComCmdSettings.h:54
    +
    @ SBG_ECOM_SAVE_SETTINGS
    Definition: sbgEComCmdSettings.h:55
    +
    SbgErrorCode sbgEComCmdExportSettings(SbgEComHandle *pHandle, void *pBuffer, size_t *pSize, size_t maxSize)
    +
    Definition: sbgECom.h:81
    +
    + + + + diff --git a/doc/html/sbg_e_com_get_version_8h.html b/doc/html/sbg_e_com_get_version_8h.html new file mode 100644 index 0000000..6122e8e --- /dev/null +++ b/doc/html/sbg_e_com_get_version_8h.html @@ -0,0 +1,124 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/sbgEComGetVersion.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComGetVersion.h File Reference
    +
    +
    + +

    Version information. +More...

    +
    #include <sbgCommon.h>
    +
    +

    Go to the source code of this file.

    + + + + + + +

    +Functions

    uint32_t sbgEComGetVersion (void)
     
    const char * sbgEComGetVersionAsString (void)
     
    +

    Detailed Description

    +

    Version information.

    +
    Author
    SBG Systems
    +
    Date
    05 February 2013
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Function Documentation

    + +

    ◆ sbgEComGetVersion()

    + +
    +
    + + + + + + + + +
    uint32_t sbgEComGetVersion (void )
    +
    +

    Returns an integer representing the version of the sbgECom library.

    +
    Returns
    An integer representing the version of the sbgECom library.
    +
    + +
    +
    + +

    ◆ sbgEComGetVersionAsString()

    + +
    +
    + + + + + + + + +
    const char * sbgEComGetVersionAsString (void )
    +
    +

    Retrieve the sbgECom library version as a string (1.0.443-stable).

    +
    Returns
    Null terminated string that contains the sbgECom library version.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_get_version_8h_source.html b/doc/html/sbg_e_com_get_version_8h_source.html new file mode 100644 index 0000000..3e68123 --- /dev/null +++ b/doc/html/sbg_e_com_get_version_8h_source.html @@ -0,0 +1,81 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/sbgEComGetVersion.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComGetVersion.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    31#ifndef SBG_ECOM_GET_VERSION_H
    +
    32#define SBG_ECOM_GET_VERSION_H
    +
    33
    +
    34// sbgCommonLib headers
    +
    35#include <sbgCommon.h>
    +
    36
    +
    37#ifdef __cplusplus
    +
    38extern "C" {
    +
    39#endif
    +
    40
    +
    41//----------------------------------------------------------------------//
    +
    42//- Public methods -//
    +
    43//----------------------------------------------------------------------//
    +
    44
    +
    50uint32_t sbgEComGetVersion(void);
    +
    51
    +
    57const char *sbgEComGetVersionAsString(void);
    +
    58
    +
    59#ifdef __cplusplus
    +
    60}
    +
    61#endif
    +
    62
    +
    63#endif // SBG_ECOM_GET_VERSION_H
    +
    uint32_t sbgEComGetVersion(void)
    +
    const char * sbgEComGetVersionAsString(void)
    +
    + + + + diff --git a/doc/html/sbg_e_com_ids_8h.html b/doc/html/sbg_e_com_ids_8h.html new file mode 100644 index 0000000..4015729 --- /dev/null +++ b/doc/html/sbg_e_com_ids_8h.html @@ -0,0 +1,887 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/sbgEComIds.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComIds.h File Reference
    +
    +
    + +

    Defines all sbgECom commands identifiers. +More...

    + +

    Go to the source code of this file.

    + + + + + + + + + + + + + + + + + + +

    +Typedefs

    typedef enum _SbgEComClass SbgEComClass
     
    typedef enum _SbgEComLog SbgEComLog
     
    typedef enum _SbgEComLog1MsgId SbgEComLog1
     
    typedef enum _SbgEComNmeaLog SbgEComNmeaLog
     
    typedef enum _SbgEComIdNmea1Log SbgEComIdNmea1Log
     
    typedef enum _SbgEComIdThirdParty SbgEComIdThirdParty
     
    typedef enum _SbgEComCmd SbgEComCmd
     
    typedef uint8_t SbgEComMsgId
     
    + + + + + + + + + + + + + + + +

    +Enumerations

    enum  _SbgEComClass {
    +  SBG_ECOM_CLASS_LOG_ECOM_0 = 0x00 +,
    +  SBG_ECOM_CLASS_LOG_ECOM_1 = 0x01 +,
    +  SBG_ECOM_CLASS_LOG_NMEA_0 = 0x02 +,
    +  SBG_ECOM_CLASS_LOG_NMEA_1 = 0x03 +,
    +  SBG_ECOM_CLASS_LOG_THIRD_PARTY_0 = 0x04 +,
    +  SBG_ECOM_CLASS_LOG_CMD_0 = 0x10 +
    + }
     
    enum  _SbgEComLog {
    +  SBG_ECOM_LOG_STATUS = 1 +,
    +  SBG_ECOM_LOG_UTC_TIME = 2 +,
    +  SBG_ECOM_LOG_IMU_DATA = 3 +,
    +  SBG_ECOM_LOG_MAG = 4 +,
    +  SBG_ECOM_LOG_MAG_CALIB = 5 +,
    +  SBG_ECOM_LOG_EKF_EULER = 6 +,
    +  SBG_ECOM_LOG_EKF_QUAT = 7 +,
    +  SBG_ECOM_LOG_EKF_NAV = 8 +,
    +  SBG_ECOM_LOG_SHIP_MOTION = 9 +,
    +  SBG_ECOM_LOG_GPS1_VEL = 13 +,
    +  SBG_ECOM_LOG_GPS1_POS = 14 +,
    +  SBG_ECOM_LOG_GPS1_HDT = 15 +,
    +  SBG_ECOM_LOG_GPS1_RAW = 31 +,
    +  SBG_ECOM_LOG_GPS2_VEL = 16 +,
    +  SBG_ECOM_LOG_GPS2_POS = 17 +,
    +  SBG_ECOM_LOG_GPS2_HDT = 18 +,
    +  SBG_ECOM_LOG_GPS2_RAW = 38 +,
    +  SBG_ECOM_LOG_ODO_VEL = 19 +,
    +  SBG_ECOM_LOG_EVENT_A = 24 +,
    +  SBG_ECOM_LOG_EVENT_B = 25 +,
    +  SBG_ECOM_LOG_EVENT_C = 26 +,
    +  SBG_ECOM_LOG_EVENT_D = 27 +,
    +  SBG_ECOM_LOG_EVENT_E = 28 +,
    +  SBG_ECOM_LOG_DVL_BOTTOM_TRACK = 29 +,
    +  SBG_ECOM_LOG_DVL_WATER_TRACK = 30 +,
    +  SBG_ECOM_LOG_SHIP_MOTION_HP = 32 +,
    +  SBG_ECOM_LOG_AIR_DATA = 36 +,
    +  SBG_ECOM_LOG_USBL = 37 +,
    +  SBG_ECOM_LOG_IMU_SHORT = 44 +,
    +  SBG_ECOM_LOG_EVENT_OUT_A = 45 +,
    +  SBG_ECOM_LOG_EVENT_OUT_B = 46 +,
    +  SBG_ECOM_LOG_DEPTH = 47 +,
    +  SBG_ECOM_LOG_DIAG = 48 +,
    +  SBG_ECOM_LOG_RTCM_RAW = 49 +,
    +  SBG_ECOM_LOG_ECOM_NUM_MESSAGES +
    + }
     
    enum  _SbgEComLog1MsgId {
    +  SBG_ECOM_LOG_FAST_IMU_DATA = 0 +,
    +  SBG_ECOM_LOG_ECOM_1_NUM_MESSAGES +
    + }
     
    enum  _SbgEComNmeaLog {
    +  SBG_ECOM_LOG_NMEA_GGA = 0 +,
    +  SBG_ECOM_LOG_NMEA_RMC = 1 +,
    +  SBG_ECOM_LOG_NMEA_ZDA = 2 +,
    +  SBG_ECOM_LOG_NMEA_HDT = 3 +,
    +  SBG_ECOM_LOG_NMEA_GST = 4 +,
    +  SBG_ECOM_LOG_NMEA_VBW = 5 +,
    +  SBG_ECOM_LOG_NMEA_DPT = 7 +,
    +  SBG_ECOM_LOG_NMEA_VTG = 8 +,
    +  SBG_ECOM_LOG_NMEA_NUM_MESSAGES +
    + }
     
    enum  _SbgEComIdNmea1Log {
    +  SBG_ECOM_LOG_NMEA_1_PRDID = 0 +,
    +  SBG_ECOM_LOG_NMEA_1_PSBGI = 1 +,
    +  SBG_ECOM_LOG_NMEA_1_PASHR = 2 +,
    +  SBG_ECOM_LOG_NMEA_1_PSBGB = 3 +,
    +  SBG_ECOM_LOG_NMEA_1_PHINF = 5 +,
    +  SBG_ECOM_LOG_NMEA_1_PHTRO = 6 +,
    +  SBG_ECOM_LOG_NMEA_1_PHLIN = 7 +,
    +  SBG_ECOM_LOG_NMEA_1_PHOCT = 8 +,
    +  SBG_ECOM_LOG_NMEA_1_INDYN = 9 +,
    +  SBG_ECOM_LOG_NMEA_1_GGK = 10 +,
    +  SBG_ECOM_LOG_NMEA_1_PPS = 11 +,
    +  SBG_ECOM_LOG_NMEA_1_WASSP = 12 +,
    +  SBG_ECOM_LOG_NMEA_1_NUM_MESSAGES +
    + }
     
    enum  _SbgEComIdThirdParty {
    +  SBG_ECOM_THIRD_PARTY_TSS1 = 0 +,
    +  SBG_ECOM_THIRD_PARTY_KVH = 1 +,
    +  SBG_ECOM_THIRD_PARTY_PD0 = 2 +,
    +  SBG_ECOM_THIRD_PARTY_SIMRAD_1000 = 3 +,
    +  SBG_ECOM_THIRD_PARTY_SIMRAD_3000 = 4 +,
    +  SBG_ECOM_THIRD_PARTY_SEAPATH_B26 = 5 +,
    +  SBG_ECOM_THIRD_PARTY_DOLOG_HRP = 6 +,
    +  SBG_ECOM_THIRD_PARTY_AHRS_500 = 7 +,
    +  SBG_ECOM_THIRD_PARTY_ADA_01 = 8 +,
    +  SBG_ECOM_THIRD_PARTY_AT_ITINS = 9 +,
    +  SBG_ECOM_THIRD_PARTY_KONGSBERG_MB = 10 +,
    +  SBG_ECOM_LOG_THIRD_PARTY_NUM_MESSAGES +
    + }
     
    enum  _SbgEComCmd {
    +  SBG_ECOM_CMD_ACK = 0 +,
    +  SBG_ECOM_CMD_SETTINGS_ACTION = 1 +,
    +  SBG_ECOM_CMD_IMPORT_SETTINGS = 2 +,
    +  SBG_ECOM_CMD_EXPORT_SETTINGS = 3 +,
    +  SBG_ECOM_CMD_INFO = 4 +,
    +  SBG_ECOM_CMD_INIT_PARAMETERS = 5 +,
    +  SBG_ECOM_CMD_MOTION_PROFILE_ID = 7 +,
    +  SBG_ECOM_CMD_IMU_ALIGNMENT_LEVER_ARM = 8 +,
    +  SBG_ECOM_CMD_AIDING_ASSIGNMENT = 9 +,
    +  SBG_ECOM_CMD_MAGNETOMETER_MODEL_ID = 11 +,
    +  SBG_ECOM_CMD_MAGNETOMETER_REJECT_MODE = 12 +,
    +  SBG_ECOM_CMD_SET_MAG_CALIB = 13 +,
    +  SBG_ECOM_CMD_START_MAG_CALIB = 14 +,
    +  SBG_ECOM_CMD_COMPUTE_MAG_CALIB = 15 +,
    +  SBG_ECOM_CMD_GNSS_1_MODEL_ID = 17 +,
    +  SBG_ECOM_CMD_GNSS_1_LEVER_ARM_ALIGNMENT = 18 +,
    +  SBG_ECOM_CMD_GNSS_1_INSTALLATION = 46 +,
    +  SBG_ECOM_CMD_GNSS_1_REJECT_MODES = 19 +,
    +  SBG_ECOM_CMD_ODO_CONF = 20 +,
    +  SBG_ECOM_CMD_ODO_LEVER_ARM = 21 +,
    +  SBG_ECOM_CMD_ODO_REJECT_MODE = 22 +,
    +  SBG_ECOM_CMD_UART_CONF = 23 +,
    +  SBG_ECOM_CMD_CAN_BUS_CONF = 24 +,
    +  SBG_ECOM_CMD_CAN_OUTPUT_CONF = 25 +,
    +  SBG_ECOM_CMD_SYNC_IN_CONF = 26 +,
    +  SBG_ECOM_CMD_SYNC_OUT_CONF = 27 +,
    +  SBG_ECOM_CMD_NMEA_TALKER_ID = 29 +,
    +  SBG_ECOM_CMD_OUTPUT_CONF = 30 +,
    +  SBG_ECOM_CMD_ADVANCED_CONF = 32 +,
    +  SBG_ECOM_CMD_FEATURES = 33 +,
    +  SBG_ECOM_CMD_LICENSE_APPLY = 34 +,
    +  SBG_ECOM_CMD_OUTPUT_CLASS_ENABLE = 35 +,
    +  SBG_ECOM_CMD_ETHERNET_CONF = 36 +,
    +  SBG_ECOM_CMD_ETHERNET_INFO = 37 +,
    +  SBG_ECOM_CMD_VALIDITY_THRESHOLDS = 38 +,
    +  SBG_ECOM_CMD_DVL_MODEL_ID = 39 +,
    +  SBG_ECOM_CMD_DVL_INSTALLATION = 40 +,
    +  SBG_ECOM_CMD_DVL_REJECT_MODES = 41 +,
    +  SBG_ECOM_CMD_AIRDATA_MODEL_ID = 42 +,
    +  SBG_ECOM_CMD_AIRDATA_LEVER_ARM = 43 +,
    +  SBG_ECOM_CMD_AIRDATA_REJECT_MODES = 44 +,
    +  SBG_ECOM_CMD_ODO_CAN_CONF = 45 +,
    +  SBG_ECOM_CMD_API_GET = 46 +,
    +  SBG_ECOM_CMD_API_POST = 47 +,
    +  SBG_ECOM_LOG_ECOM_NUM_CMDS +
    + }
     
    + + + +

    +Functions

    SBG_INLINE bool sbgEComMsgClassIsALog (SbgEComClass msgClass)
     
    +

    Detailed Description

    +

    Defines all sbgECom commands identifiers.

    +
    Author
    SBG Systems
    +
    Date
    25 February 2013
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Typedef Documentation

    + +

    ◆ SbgEComClass

    + +
    +
    + + + + +
    typedef enum _SbgEComClass SbgEComClass
    +
    +

    Enum that defines all the message classes available.

    +

    Keep in mind that message classes are encoded on 7 bits.

    + +
    +
    + +

    ◆ SbgEComLog

    + +
    +
    + + + + +
    typedef enum _SbgEComLog SbgEComLog
    +
    +

    Enum that defines all the available ECom output logs from the sbgECom library.

    + +
    +
    + +

    ◆ SbgEComLog1

    + +
    +
    + + + + +
    typedef enum _SbgEComLog1MsgId SbgEComLog1
    +
    +

    Enum that defines all the available ECom output logs in the class SBG_ECOM_CLASS_LOG_ECOM_1

    + +
    +
    + +

    ◆ SbgEComNmeaLog

    + +
    +
    + + + + +
    typedef enum _SbgEComNmeaLog SbgEComNmeaLog
    +
    +

    Enum that defines all the available Nmea output logs from the sbgECom library.

    + +
    +
    + +

    ◆ SbgEComIdNmea1Log

    + +
    +
    + + + + +
    typedef enum _SbgEComIdNmea1Log SbgEComIdNmea1Log
    +
    +

    Enum that defines all the available Proprietary Nmea output logs from the sbgECom library.

    + +
    +
    + +

    ◆ SbgEComIdThirdParty

    + +
    +
    + + + + +
    typedef enum _SbgEComIdThirdParty SbgEComIdThirdParty
    +
    +

    Enum that defines all the available Proprietary output logs from the sbgECom library.

    + +
    +
    + +

    ◆ SbgEComCmd

    + +
    +
    + + + + +
    typedef enum _SbgEComCmd SbgEComCmd
    +
    +

    Enum that defines all the available commands for the sbgECom library.

    + +
    +
    + +

    ◆ SbgEComMsgId

    + +
    +
    + + + + +
    typedef uint8_t SbgEComMsgId
    +
    +

    This type defines any message identifier. Because message identifiers enum will be different with each class id, we use a generic uint8_t rather than an enum.

    + +
    +
    +

    Enumeration Type Documentation

    + +

    ◆ _SbgEComClass

    + +
    +
    + + + + +
    enum _SbgEComClass
    +
    +

    Enum that defines all the message classes available.

    +

    Keep in mind that message classes are encoded on 7 bits.

    + + + + + + + +
    Enumerator
    SBG_ECOM_CLASS_LOG_ECOM_0 

    Class that contains sbgECom protocol input/output log messages.

    +
    SBG_ECOM_CLASS_LOG_ECOM_1 

    Class that contains special sbgECom output messages that handle high frequency output.

    +
    SBG_ECOM_CLASS_LOG_NMEA_0 

    Class that contains NMEA (and NMEA like) output logs.
    + Note: This class is only used for identification purpose and does not contain any sbgECom message.

    +
    SBG_ECOM_CLASS_LOG_NMEA_1 

    Class that contains proprietary NMEA (and NMEA like) output logs.
    + Note: This class is only used for identification purpose and does not contain any sbgECom message.

    +
    SBG_ECOM_CLASS_LOG_THIRD_PARTY_0 

    Class that contains third party output logs. Note: This class is only used for identification purpose and does not contain any sbgECom message.

    +
    SBG_ECOM_CLASS_LOG_CMD_0 

    Class that contains sbgECom protocol commands.

    +
    + +
    +
    + +

    ◆ _SbgEComLog

    + +
    +
    + + + + +
    enum _SbgEComLog
    +
    +

    Enum that defines all the available ECom output logs from the sbgECom library.

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Enumerator
    SBG_ECOM_LOG_STATUS 

    Status general, clock, com aiding, solution, heave

    +
    SBG_ECOM_LOG_UTC_TIME 

    Provides UTC time reference

    +
    SBG_ECOM_LOG_IMU_DATA 

    Includes IMU status, acc., gyro, temp delta speeds and delta angles values

    +
    SBG_ECOM_LOG_MAG 

    Magnetic data with associated accelerometer on each axis

    +
    SBG_ECOM_LOG_MAG_CALIB 

    Magnetometer calibration data (raw buffer)

    +
    SBG_ECOM_LOG_EKF_EULER 

    Includes roll, pitch, yaw and their accuracies on each axis

    +
    SBG_ECOM_LOG_EKF_QUAT 

    Includes the 4 quaternions values

    +
    SBG_ECOM_LOG_EKF_NAV 

    Position and velocities in NED coordinates with the accuracies on each axis

    +
    SBG_ECOM_LOG_SHIP_MOTION 

    Heave, surge and sway and accelerations on each axis.

    +
    SBG_ECOM_LOG_GPS1_VEL 

    GPS velocities from primary or secondary GPS receiver

    +
    SBG_ECOM_LOG_GPS1_POS 

    GPS positions from primary or secondary GPS receiver

    +
    SBG_ECOM_LOG_GPS1_HDT 

    GPS true heading from dual antenna system

    +
    SBG_ECOM_LOG_GPS1_RAW 

    GPS 1 raw data for post processing.

    +
    SBG_ECOM_LOG_GPS2_VEL 

    GPS 2 velocity log data.

    +
    SBG_ECOM_LOG_GPS2_POS 

    GPS 2 position log data.

    +
    SBG_ECOM_LOG_GPS2_HDT 

    GPS 2 true heading log data.

    +
    SBG_ECOM_LOG_GPS2_RAW 

    GPS 2 raw data for post processing.

    +
    SBG_ECOM_LOG_ODO_VEL 

    Provides odometer velocity

    +
    SBG_ECOM_LOG_EVENT_A 

    Event markers sent when events are detected on sync in A pin

    +
    SBG_ECOM_LOG_EVENT_B 

    Event markers sent when events are detected on sync in B pin

    +
    SBG_ECOM_LOG_EVENT_C 

    Event markers sent when events are detected on sync in C pin

    +
    SBG_ECOM_LOG_EVENT_D 

    Event markers sent when events are detected on sync in D pin

    +
    SBG_ECOM_LOG_EVENT_E 

    Event markers sent when events are detected on sync in E pin

    +
    SBG_ECOM_LOG_DVL_BOTTOM_TRACK 

    Doppler Velocity Log for bottom tracking data.

    +
    SBG_ECOM_LOG_DVL_WATER_TRACK 

    Doppler Velocity log for water layer data.

    +
    SBG_ECOM_LOG_SHIP_MOTION_HP 

    Return delayed ship motion such as surge, sway, heave.

    +
    SBG_ECOM_LOG_AIR_DATA 

    Air Data aiding such as barometric altimeter and true air speed.

    +
    SBG_ECOM_LOG_USBL 

    Raw USBL position data for subsea navigation.

    +
    SBG_ECOM_LOG_IMU_SHORT 

    Short IMU message recommended for post processing usages.

    +
    SBG_ECOM_LOG_EVENT_OUT_A 

    Event marker used to time stamp each generated Sync Out A signal.

    +
    SBG_ECOM_LOG_EVENT_OUT_B 

    Event marker used to time stamp each generated Sync Out B signal.

    +
    SBG_ECOM_LOG_DEPTH 

    Depth sensor measurement log used for subsea navigation.

    +
    SBG_ECOM_LOG_DIAG 

    Diagnostic log.

    +
    SBG_ECOM_LOG_RTCM_RAW 

    RTCM raw data.

    +
    SBG_ECOM_LOG_ECOM_NUM_MESSAGES 

    Helper definition to know the number of ECom messages

    +
    + +
    +
    + +

    ◆ _SbgEComLog1MsgId

    + +
    +
    + + + + +
    enum _SbgEComLog1MsgId
    +
    +

    Enum that defines all the available ECom output logs in the class SBG_ECOM_CLASS_LOG_ECOM_1

    + + + +
    Enumerator
    SBG_ECOM_LOG_FAST_IMU_DATA 

    Provides accelerometers, gyroscopes, time and status at 1KHz rate.

    +
    SBG_ECOM_LOG_ECOM_1_NUM_MESSAGES 

    Helper definition to know the number of ECom messages

    +
    + +
    +
    + +

    ◆ _SbgEComNmeaLog

    + +
    +
    + + + + +
    enum _SbgEComNmeaLog
    +
    +

    Enum that defines all the available Nmea output logs from the sbgECom library.

    + + + + + + + + + + +
    Enumerator
    SBG_ECOM_LOG_NMEA_GGA 

    Latitude, Longitude, Altitude, Quality indicator.

    +
    SBG_ECOM_LOG_NMEA_RMC 

    Latitude, Longitude, velocity, course over ground.

    +
    SBG_ECOM_LOG_NMEA_ZDA 

    UTC Time.

    +
    SBG_ECOM_LOG_NMEA_HDT 

    Heading (True).

    +
    SBG_ECOM_LOG_NMEA_GST 

    GPS Pseudorange Noise Statistics.

    +
    SBG_ECOM_LOG_NMEA_VBW 

    Water referenced and ground referenced speed data.

    +
    SBG_ECOM_LOG_NMEA_DPT 

    Depth sensor output.

    +
    SBG_ECOM_LOG_NMEA_VTG 

    Track an Speed over the ground.

    +
    SBG_ECOM_LOG_NMEA_NUM_MESSAGES 

    Helper definition to know the number of NMEA messages

    +
    + +
    +
    + +

    ◆ _SbgEComIdNmea1Log

    + +
    +
    + + + + +
    enum _SbgEComIdNmea1Log
    +
    +

    Enum that defines all the available Proprietary Nmea output logs from the sbgECom library.

    + + + + + + + + + + + + + + +
    Enumerator
    SBG_ECOM_LOG_NMEA_1_PRDID 

    RDI proprietary sentence. Pitch, Roll, Heading

    +
    SBG_ECOM_LOG_NMEA_1_PSBGI 

    SBG Systems proprietary sentence. Rotation rates, accelerations.

    +
    SBG_ECOM_LOG_NMEA_1_PASHR 

    Proprietary sentence. Roll, Pitch, Heading, Heave.

    +
    SBG_ECOM_LOG_NMEA_1_PSBGB 

    SBG Systems proprietary sentence. Attitude, heading, heave, angular rates, velocity.

    +
    SBG_ECOM_LOG_NMEA_1_PHINF 

    Ixblue NMEA like log used to output Status information.

    +
    SBG_ECOM_LOG_NMEA_1_PHTRO 

    Ixblue NMEA like log used to output Roll and Pitch.

    +
    SBG_ECOM_LOG_NMEA_1_PHLIN 

    Ixblue NMEA like log used to output Surge, Sway and Heave.

    +
    SBG_ECOM_LOG_NMEA_1_PHOCT 

    Ixblue NMEA like log used to output attitude and ship motion.

    +
    SBG_ECOM_LOG_NMEA_1_INDYN 

    Ixblue NMEA like log used to output position, heading, attitude, attitude rate and speed.

    +
    SBG_ECOM_LOG_NMEA_1_GGK 

    Trimble NMEA like log with Time, Latitude, Longitude, Ellipsoidal height

    +
    SBG_ECOM_LOG_NMEA_1_PPS 

    Trimble (Applanix) NMEA like log with UTC and PPS information.

    +
    SBG_ECOM_LOG_NMEA_1_WASSP 

    WASSP NMEA like log similar to PASHR one.

    +
    SBG_ECOM_LOG_NMEA_1_NUM_MESSAGES 

    Helper definition to know the number of NMEA messages

    +
    + +
    +
    + +

    ◆ _SbgEComIdThirdParty

    + +
    +
    + + + + +
    enum _SbgEComIdThirdParty
    +
    +

    Enum that defines all the available Proprietary output logs from the sbgECom library.

    + + + + + + + + + + + + + +
    Enumerator
    SBG_ECOM_THIRD_PARTY_TSS1 

    Roll, Pitch, Heave, heave accelerations

    +
    SBG_ECOM_THIRD_PARTY_KVH 

    Roll, Pitch, Yaw

    +
    SBG_ECOM_THIRD_PARTY_PD0 

    Teledyne PD0 DVL proprietary frame.

    +
    SBG_ECOM_THIRD_PARTY_SIMRAD_1000 

    Konsberg SimRad 1000 proprietary frame that outputs Roll, Pitch and Heading.
    +

    +
    SBG_ECOM_THIRD_PARTY_SIMRAD_3000 

    Konsberg SimRad 3000 proprietary frame that outputs Roll, Pitch and Heading.

    +
    SBG_ECOM_THIRD_PARTY_SEAPATH_B26 

    Konsberg Seapth Binary Log 26 used for MBES FM mode.

    +
    SBG_ECOM_THIRD_PARTY_DOLOG_HRP 

    DOLOG Heading, Roll, Pitch proprietary and binary message.

    +
    SBG_ECOM_THIRD_PARTY_AHRS_500 

    Crossbow AHRS-500 Data Packet output with attitude, rate, acceleration and status.

    +
    SBG_ECOM_THIRD_PARTY_ADA_01 

    ADA specific Data Packet with IMU/INS/Status data

    +
    SBG_ECOM_THIRD_PARTY_AT_ITINS 

    Cobham Aviator UAV 200 navigation (orientation & position) data

    +
    SBG_ECOM_THIRD_PARTY_KONGSBERG_MB 

    Kongsberg multibeam binary log.

    +
    SBG_ECOM_LOG_THIRD_PARTY_NUM_MESSAGES 

    Helper definition to know the number of third party messages

    +
    + +
    +
    + +

    ◆ _SbgEComCmd

    + +
    +
    + + + + +
    enum _SbgEComCmd
    +
    +

    Enum that defines all the available commands for the sbgECom library.

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Enumerator
    SBG_ECOM_CMD_ACK 

    Acknowledge

    +
    SBG_ECOM_CMD_SETTINGS_ACTION 

    Performs various settings actions

    +
    SBG_ECOM_CMD_IMPORT_SETTINGS 

    Imports a new settings structure to the sensor

    +
    SBG_ECOM_CMD_EXPORT_SETTINGS 

    Export the whole configuration from the sensor

    +
    SBG_ECOM_CMD_INFO 

    Get basic device information

    +
    SBG_ECOM_CMD_INIT_PARAMETERS 

    Initial configuration

    +
    SBG_ECOM_CMD_MOTION_PROFILE_ID 

    Set/get motion profile information

    +
    SBG_ECOM_CMD_IMU_ALIGNMENT_LEVER_ARM 

    Sensor alignment and lever arm on vehicle configuration

    +
    SBG_ECOM_CMD_AIDING_ASSIGNMENT 

    Aiding assignments such as RTCM / GPS / Odometer configuration

    +
    SBG_ECOM_CMD_MAGNETOMETER_MODEL_ID 

    Set/get magnetometer error model information

    +
    SBG_ECOM_CMD_MAGNETOMETER_REJECT_MODE 

    Magnetometer aiding rejection mode

    +
    SBG_ECOM_CMD_SET_MAG_CALIB 

    Set magnetic soft and hard Iron calibration data

    +
    SBG_ECOM_CMD_START_MAG_CALIB 

    Start / reset internal magnetic field logging for calibration.

    +
    SBG_ECOM_CMD_COMPUTE_MAG_CALIB 

    Compute a magnetic calibration based on previously logged data.

    +
    SBG_ECOM_CMD_GNSS_1_MODEL_ID 

    Set/get GNSS model information

    +
    SBG_ECOM_CMD_GNSS_1_LEVER_ARM_ALIGNMENT 

    DEPRECATED: GNSS installation configuration (lever arm, antenna alignments)

    +
    SBG_ECOM_CMD_GNSS_1_INSTALLATION 

    Define or retrieve the GNSS 1 main and secondary lever arms configuration.

    +
    SBG_ECOM_CMD_GNSS_1_REJECT_MODES 

    GNSS aiding rejection modes configuration.

    +
    SBG_ECOM_CMD_ODO_CONF 

    Odometer gain, direction configuration

    +
    SBG_ECOM_CMD_ODO_LEVER_ARM 

    Odometer installation configuration (lever arm)

    +
    SBG_ECOM_CMD_ODO_REJECT_MODE 

    Odometer aiding rejection mode configuration.

    +
    SBG_ECOM_CMD_UART_CONF 

    UART interfaces configuration

    +
    SBG_ECOM_CMD_CAN_BUS_CONF 

    CAN bus interface configuration

    +
    SBG_ECOM_CMD_CAN_OUTPUT_CONF 

    CAN identifiers configuration

    +
    SBG_ECOM_CMD_SYNC_IN_CONF 

    Synchronization inputs configuration

    +
    SBG_ECOM_CMD_SYNC_OUT_CONF 

    Synchronization outputs configuration

    +
    SBG_ECOM_CMD_NMEA_TALKER_ID 

    NMEA talker ID configuration

    +
    SBG_ECOM_CMD_OUTPUT_CONF 

    Output configuration

    +
    SBG_ECOM_CMD_ADVANCED_CONF 

    Advanced settings configuration

    +
    SBG_ECOM_CMD_FEATURES 

    Retrieve device features

    +
    SBG_ECOM_CMD_LICENSE_APPLY 

    Upload and apply a new license

    +
    SBG_ECOM_CMD_OUTPUT_CLASS_ENABLE 

    Enable/disable the output of an entire class

    +
    SBG_ECOM_CMD_ETHERNET_CONF 

    Set/get Ethernet configuration such as DHCP mode and IP address.

    +
    SBG_ECOM_CMD_ETHERNET_INFO 

    Return the current IP used by the device.

    +
    SBG_ECOM_CMD_VALIDITY_THRESHOLDS 

    Set/get Validity flag thresholds for position, velocity, attitude and heading

    +
    SBG_ECOM_CMD_DVL_MODEL_ID 

    Set/get DVL model id to use

    +
    SBG_ECOM_CMD_DVL_INSTALLATION 

    DVL installation configuration (lever arm, alignments)

    +
    SBG_ECOM_CMD_DVL_REJECT_MODES 

    DVL aiding rejection modes configuration.

    +
    SBG_ECOM_CMD_AIRDATA_MODEL_ID 

    Set/get AirData model id and protocol to use.

    +
    SBG_ECOM_CMD_AIRDATA_LEVER_ARM 

    AirData installation configuration (lever arm, offsets)

    +
    SBG_ECOM_CMD_AIRDATA_REJECT_MODES 

    AirData aiding rejection modes configuration.

    +
    SBG_ECOM_CMD_ODO_CAN_CONF 

    Configuration for CAN based odometer (CAN ID & DBC)

    +
    SBG_ECOM_CMD_API_GET 

    Command equivalent to the HTTP GET method for a REST API.

    +
    SBG_ECOM_CMD_API_POST 

    Command equivalent to the HTTP POST method for a REST API.

    +
    SBG_ECOM_LOG_ECOM_NUM_CMDS 

    Helper definition to know the number of commands

    +
    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgEComMsgClassIsALog()

    + +
    +
    + + + + + + + + +
    SBG_INLINE bool sbgEComMsgClassIsALog (SbgEComClass msgClass)
    +
    +

    Test if the message class is a binary log one.

    +
    Parameters
    + + +
    [in]msgClassMessage class.
    +
    +
    +
    Returns
    TRUE if the message class corresponds to a binary log.
    + +

    References SBG_ECOM_CLASS_LOG_ECOM_0, and SBG_ECOM_CLASS_LOG_ECOM_1.

    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_ids_8h_source.html b/doc/html/sbg_e_com_ids_8h_source.html new file mode 100644 index 0000000..25397f4 --- /dev/null +++ b/doc/html/sbg_e_com_ids_8h_source.html @@ -0,0 +1,408 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/sbgEComIds.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComIds.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_IDS_H
    +
    33#define SBG_ECOM_IDS_H
    +
    34
    +
    35#ifdef __cplusplus
    +
    36extern "C" {
    +
    37#endif
    +
    38
    +
    39//----------------------------------------------------------------------//
    +
    40//- Definition of all class id for sbgECom -//
    +
    41//----------------------------------------------------------------------//
    +
    42
    +
    48typedef enum _SbgEComClass
    +
    49{
    + + + + + + + +
    64
    +
    65//----------------------------------------------------------------------//
    +
    66//- Definition of all messages id for sbgECom -//
    +
    67//----------------------------------------------------------------------//
    +
    68
    +
    72typedef enum _SbgEComLog
    +
    73{
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    129
    + +
    134{
    + + + +
    138
    +
    142typedef enum _SbgEComNmeaLog
    +
    143{
    + + + + + + + + + + +
    154
    + +
    159{
    + + + + + + + + + + + + + + +
    178
    + +
    183{
    + + + + + + + + + + + + + +
    202
    +
    203
    +
    207typedef enum _SbgEComCmd
    +
    208{
    +
    209 /* Acknowledge */
    + +
    212 /* Special settings commands */
    + + + +
    217 /* Device info */
    + +
    220 /* Sensor parameters */
    + + + + +
    226 /* Magnetometer configuration */
    + + + +
    231 /* Magnetometer on-board calibration */
    + + +
    235 /* GNSS configuration */
    + + + + +
    241 /* Odometer configuration */
    + + + +
    246 /* Interfaces configuration */
    + + + +
    251 /* Events configuration */
    + + +
    255 /* Output configuration */
    + + +
    259 /* Advanced configuration */
    + +
    262 /* Features related commands */
    + +
    265 /* Licenses related commands */
    + +
    268 /* Message class output switch */
    + +
    271 /* Ethernet configuration */
    + + +
    275 /* Validity thresholds */
    + +
    278 /* DVL configuration */
    + + + +
    283 /* AirData configuration */
    + + + +
    288 /* Odometer configuration (using CAN) */
    + +
    291 /* REST API related commands */
    + + +
    295 /* Misc. */
    + + +
    298
    +
    303typedef uint8_t SbgEComMsgId;
    +
    304
    +
    305//----------------------------------------------------------------------//
    +
    306//- Inline helpers for log IDs -//
    +
    307//----------------------------------------------------------------------//
    +
    308
    +
    315SBG_INLINE bool sbgEComMsgClassIsALog(SbgEComClass msgClass)
    +
    316{
    +
    317 //
    +
    318 // Test if this class id is part of the enum
    +
    319 //
    +
    320 if ((msgClass == SBG_ECOM_CLASS_LOG_ECOM_0) || (msgClass == SBG_ECOM_CLASS_LOG_ECOM_1) )
    +
    321 {
    +
    322 return true;
    +
    323 }
    +
    324 else
    +
    325 {
    +
    326 return false;
    +
    327 }
    +
    328}
    +
    329
    +
    330#ifdef __cplusplus
    +
    331}
    +
    332#endif
    +
    333
    +
    334#endif // SBG_ECOM_IDS_H
    +
    enum _SbgEComIdNmea1Log SbgEComIdNmea1Log
    +
    SBG_INLINE bool sbgEComMsgClassIsALog(SbgEComClass msgClass)
    Definition: sbgEComIds.h:315
    +
    _SbgEComLog1MsgId
    Definition: sbgEComIds.h:134
    +
    @ SBG_ECOM_LOG_FAST_IMU_DATA
    Definition: sbgEComIds.h:135
    +
    @ SBG_ECOM_LOG_ECOM_1_NUM_MESSAGES
    Definition: sbgEComIds.h:136
    +
    _SbgEComLog
    Definition: sbgEComIds.h:73
    +
    @ SBG_ECOM_LOG_EVENT_B
    Definition: sbgEComIds.h:102
    +
    @ SBG_ECOM_LOG_GPS2_HDT
    Definition: sbgEComIds.h:96
    +
    @ SBG_ECOM_LOG_ECOM_NUM_MESSAGES
    Definition: sbgEComIds.h:127
    +
    @ SBG_ECOM_LOG_AIR_DATA
    Definition: sbgEComIds.h:112
    +
    @ SBG_ECOM_LOG_DEPTH
    Definition: sbgEComIds.h:122
    +
    @ SBG_ECOM_LOG_MAG_CALIB
    Definition: sbgEComIds.h:81
    +
    @ SBG_ECOM_LOG_EVENT_D
    Definition: sbgEComIds.h:104
    +
    @ SBG_ECOM_LOG_EVENT_OUT_A
    Definition: sbgEComIds.h:119
    +
    @ SBG_ECOM_LOG_GPS1_HDT
    Definition: sbgEComIds.h:91
    +
    @ SBG_ECOM_LOG_GPS1_RAW
    Definition: sbgEComIds.h:92
    +
    @ SBG_ECOM_LOG_IMU_SHORT
    Definition: sbgEComIds.h:117
    +
    @ SBG_ECOM_LOG_ODO_VEL
    Definition: sbgEComIds.h:99
    +
    @ SBG_ECOM_LOG_SHIP_MOTION_HP
    Definition: sbgEComIds.h:110
    +
    @ SBG_ECOM_LOG_DVL_WATER_TRACK
    Definition: sbgEComIds.h:108
    +
    @ SBG_ECOM_LOG_SHIP_MOTION
    Definition: sbgEComIds.h:87
    +
    @ SBG_ECOM_LOG_DIAG
    Definition: sbgEComIds.h:123
    +
    @ SBG_ECOM_LOG_GPS2_RAW
    Definition: sbgEComIds.h:97
    +
    @ SBG_ECOM_LOG_EKF_QUAT
    Definition: sbgEComIds.h:84
    +
    @ SBG_ECOM_LOG_RTCM_RAW
    Definition: sbgEComIds.h:125
    +
    @ SBG_ECOM_LOG_EVENT_C
    Definition: sbgEComIds.h:103
    +
    @ SBG_ECOM_LOG_MAG
    Definition: sbgEComIds.h:80
    +
    @ SBG_ECOM_LOG_IMU_DATA
    Definition: sbgEComIds.h:78
    +
    @ SBG_ECOM_LOG_UTC_TIME
    Definition: sbgEComIds.h:76
    +
    @ SBG_ECOM_LOG_DVL_BOTTOM_TRACK
    Definition: sbgEComIds.h:107
    +
    @ SBG_ECOM_LOG_GPS1_POS
    Definition: sbgEComIds.h:90
    +
    @ SBG_ECOM_LOG_GPS2_VEL
    Definition: sbgEComIds.h:94
    +
    @ SBG_ECOM_LOG_GPS2_POS
    Definition: sbgEComIds.h:95
    +
    @ SBG_ECOM_LOG_EVENT_E
    Definition: sbgEComIds.h:105
    +
    @ SBG_ECOM_LOG_USBL
    Definition: sbgEComIds.h:114
    +
    @ SBG_ECOM_LOG_EVENT_A
    Definition: sbgEComIds.h:101
    +
    @ SBG_ECOM_LOG_STATUS
    Definition: sbgEComIds.h:74
    +
    @ SBG_ECOM_LOG_EVENT_OUT_B
    Definition: sbgEComIds.h:120
    +
    @ SBG_ECOM_LOG_EKF_NAV
    Definition: sbgEComIds.h:85
    +
    @ SBG_ECOM_LOG_GPS1_VEL
    Definition: sbgEComIds.h:89
    +
    @ SBG_ECOM_LOG_EKF_EULER
    Definition: sbgEComIds.h:83
    +
    uint8_t SbgEComMsgId
    Definition: sbgEComIds.h:303
    +
    enum _SbgEComLog1MsgId SbgEComLog1
    +
    enum _SbgEComIdThirdParty SbgEComIdThirdParty
    +
    _SbgEComIdThirdParty
    Definition: sbgEComIds.h:183
    +
    @ SBG_ECOM_THIRD_PARTY_SEAPATH_B26
    Definition: sbgEComIds.h:191
    +
    @ SBG_ECOM_THIRD_PARTY_SIMRAD_3000
    Definition: sbgEComIds.h:189
    +
    @ SBG_ECOM_LOG_THIRD_PARTY_NUM_MESSAGES
    Definition: sbgEComIds.h:200
    +
    @ SBG_ECOM_THIRD_PARTY_TSS1
    Definition: sbgEComIds.h:184
    +
    @ SBG_ECOM_THIRD_PARTY_KVH
    Definition: sbgEComIds.h:185
    +
    @ SBG_ECOM_THIRD_PARTY_AHRS_500
    Definition: sbgEComIds.h:193
    +
    @ SBG_ECOM_THIRD_PARTY_SIMRAD_1000
    Definition: sbgEComIds.h:188
    +
    @ SBG_ECOM_THIRD_PARTY_AT_ITINS
    Definition: sbgEComIds.h:196
    +
    @ SBG_ECOM_THIRD_PARTY_ADA_01
    Definition: sbgEComIds.h:194
    +
    @ SBG_ECOM_THIRD_PARTY_PD0
    Definition: sbgEComIds.h:187
    +
    @ SBG_ECOM_THIRD_PARTY_KONGSBERG_MB
    Definition: sbgEComIds.h:198
    +
    @ SBG_ECOM_THIRD_PARTY_DOLOG_HRP
    Definition: sbgEComIds.h:192
    +
    enum _SbgEComCmd SbgEComCmd
    +
    enum _SbgEComNmeaLog SbgEComNmeaLog
    +
    _SbgEComNmeaLog
    Definition: sbgEComIds.h:143
    +
    @ SBG_ECOM_LOG_NMEA_VBW
    Definition: sbgEComIds.h:149
    +
    @ SBG_ECOM_LOG_NMEA_GST
    Definition: sbgEComIds.h:148
    +
    @ SBG_ECOM_LOG_NMEA_GGA
    Definition: sbgEComIds.h:144
    +
    @ SBG_ECOM_LOG_NMEA_ZDA
    Definition: sbgEComIds.h:146
    +
    @ SBG_ECOM_LOG_NMEA_NUM_MESSAGES
    Definition: sbgEComIds.h:152
    +
    @ SBG_ECOM_LOG_NMEA_DPT
    Definition: sbgEComIds.h:150
    +
    @ SBG_ECOM_LOG_NMEA_VTG
    Definition: sbgEComIds.h:151
    +
    @ SBG_ECOM_LOG_NMEA_HDT
    Definition: sbgEComIds.h:147
    +
    @ SBG_ECOM_LOG_NMEA_RMC
    Definition: sbgEComIds.h:145
    +
    _SbgEComClass
    Definition: sbgEComIds.h:49
    +
    @ SBG_ECOM_CLASS_LOG_NMEA_1
    Definition: sbgEComIds.h:56
    +
    @ SBG_ECOM_CLASS_LOG_NMEA_0
    Definition: sbgEComIds.h:54
    +
    @ SBG_ECOM_CLASS_LOG_THIRD_PARTY_0
    Definition: sbgEComIds.h:58
    +
    @ SBG_ECOM_CLASS_LOG_ECOM_1
    Definition: sbgEComIds.h:52
    +
    @ SBG_ECOM_CLASS_LOG_ECOM_0
    Definition: sbgEComIds.h:50
    +
    @ SBG_ECOM_CLASS_LOG_CMD_0
    Definition: sbgEComIds.h:61
    +
    enum _SbgEComLog SbgEComLog
    +
    enum _SbgEComClass SbgEComClass
    +
    _SbgEComCmd
    Definition: sbgEComIds.h:208
    +
    @ SBG_ECOM_CMD_LICENSE_APPLY
    Definition: sbgEComIds.h:266
    +
    @ SBG_ECOM_CMD_GNSS_1_LEVER_ARM_ALIGNMENT
    Definition: sbgEComIds.h:237
    +
    @ SBG_ECOM_CMD_AIDING_ASSIGNMENT
    Definition: sbgEComIds.h:224
    +
    @ SBG_ECOM_CMD_MOTION_PROFILE_ID
    Definition: sbgEComIds.h:222
    +
    @ SBG_ECOM_CMD_CAN_OUTPUT_CONF
    Definition: sbgEComIds.h:249
    +
    @ SBG_ECOM_CMD_IMPORT_SETTINGS
    Definition: sbgEComIds.h:214
    +
    @ SBG_ECOM_CMD_ACK
    Definition: sbgEComIds.h:210
    +
    @ SBG_ECOM_CMD_NMEA_TALKER_ID
    Definition: sbgEComIds.h:256
    +
    @ SBG_ECOM_CMD_INIT_PARAMETERS
    Definition: sbgEComIds.h:221
    +
    @ SBG_ECOM_CMD_GNSS_1_INSTALLATION
    Definition: sbgEComIds.h:238
    +
    @ SBG_ECOM_CMD_OUTPUT_CLASS_ENABLE
    Definition: sbgEComIds.h:269
    +
    @ SBG_ECOM_CMD_ODO_CAN_CONF
    Definition: sbgEComIds.h:289
    +
    @ SBG_ECOM_CMD_API_GET
    Definition: sbgEComIds.h:292
    +
    @ SBG_ECOM_CMD_INFO
    Definition: sbgEComIds.h:218
    +
    @ SBG_ECOM_CMD_AIRDATA_REJECT_MODES
    Definition: sbgEComIds.h:286
    +
    @ SBG_ECOM_CMD_API_POST
    Definition: sbgEComIds.h:293
    +
    @ SBG_ECOM_CMD_SYNC_IN_CONF
    Definition: sbgEComIds.h:252
    +
    @ SBG_ECOM_CMD_DVL_INSTALLATION
    Definition: sbgEComIds.h:280
    +
    @ SBG_ECOM_CMD_IMU_ALIGNMENT_LEVER_ARM
    Definition: sbgEComIds.h:223
    +
    @ SBG_ECOM_CMD_DVL_MODEL_ID
    Definition: sbgEComIds.h:279
    +
    @ SBG_ECOM_CMD_MAGNETOMETER_MODEL_ID
    Definition: sbgEComIds.h:227
    +
    @ SBG_ECOM_CMD_OUTPUT_CONF
    Definition: sbgEComIds.h:257
    +
    @ SBG_ECOM_CMD_SETTINGS_ACTION
    Definition: sbgEComIds.h:213
    +
    @ SBG_ECOM_CMD_AIRDATA_MODEL_ID
    Definition: sbgEComIds.h:284
    +
    @ SBG_ECOM_CMD_UART_CONF
    Definition: sbgEComIds.h:247
    +
    @ SBG_ECOM_CMD_ODO_CONF
    Definition: sbgEComIds.h:242
    +
    @ SBG_ECOM_CMD_SET_MAG_CALIB
    Definition: sbgEComIds.h:229
    +
    @ SBG_ECOM_CMD_MAGNETOMETER_REJECT_MODE
    Definition: sbgEComIds.h:228
    +
    @ SBG_ECOM_CMD_DVL_REJECT_MODES
    Definition: sbgEComIds.h:281
    +
    @ SBG_ECOM_CMD_ETHERNET_INFO
    Definition: sbgEComIds.h:273
    +
    @ SBG_ECOM_CMD_ODO_LEVER_ARM
    Definition: sbgEComIds.h:243
    +
    @ SBG_ECOM_CMD_VALIDITY_THRESHOLDS
    Definition: sbgEComIds.h:276
    +
    @ SBG_ECOM_CMD_GNSS_1_MODEL_ID
    Definition: sbgEComIds.h:236
    +
    @ SBG_ECOM_CMD_START_MAG_CALIB
    Definition: sbgEComIds.h:232
    +
    @ SBG_ECOM_CMD_COMPUTE_MAG_CALIB
    Definition: sbgEComIds.h:233
    +
    @ SBG_ECOM_CMD_FEATURES
    Definition: sbgEComIds.h:263
    +
    @ SBG_ECOM_CMD_AIRDATA_LEVER_ARM
    Definition: sbgEComIds.h:285
    +
    @ SBG_ECOM_CMD_EXPORT_SETTINGS
    Definition: sbgEComIds.h:215
    +
    @ SBG_ECOM_CMD_ODO_REJECT_MODE
    Definition: sbgEComIds.h:244
    +
    @ SBG_ECOM_CMD_ADVANCED_CONF
    Definition: sbgEComIds.h:260
    +
    @ SBG_ECOM_CMD_SYNC_OUT_CONF
    Definition: sbgEComIds.h:253
    +
    @ SBG_ECOM_CMD_ETHERNET_CONF
    Definition: sbgEComIds.h:272
    +
    @ SBG_ECOM_LOG_ECOM_NUM_CMDS
    Definition: sbgEComIds.h:296
    +
    @ SBG_ECOM_CMD_CAN_BUS_CONF
    Definition: sbgEComIds.h:248
    +
    @ SBG_ECOM_CMD_GNSS_1_REJECT_MODES
    Definition: sbgEComIds.h:239
    +
    _SbgEComIdNmea1Log
    Definition: sbgEComIds.h:159
    +
    @ SBG_ECOM_LOG_NMEA_1_GGK
    Definition: sbgEComIds.h:171
    +
    @ SBG_ECOM_LOG_NMEA_1_PHLIN
    Definition: sbgEComIds.h:167
    +
    @ SBG_ECOM_LOG_NMEA_1_PHINF
    Definition: sbgEComIds.h:165
    +
    @ SBG_ECOM_LOG_NMEA_1_PASHR
    Definition: sbgEComIds.h:162
    +
    @ SBG_ECOM_LOG_NMEA_1_PRDID
    Definition: sbgEComIds.h:160
    +
    @ SBG_ECOM_LOG_NMEA_1_PSBGI
    Definition: sbgEComIds.h:161
    +
    @ SBG_ECOM_LOG_NMEA_1_PHOCT
    Definition: sbgEComIds.h:168
    +
    @ SBG_ECOM_LOG_NMEA_1_INDYN
    Definition: sbgEComIds.h:169
    +
    @ SBG_ECOM_LOG_NMEA_1_PHTRO
    Definition: sbgEComIds.h:166
    +
    @ SBG_ECOM_LOG_NMEA_1_NUM_MESSAGES
    Definition: sbgEComIds.h:176
    +
    @ SBG_ECOM_LOG_NMEA_1_PPS
    Definition: sbgEComIds.h:172
    +
    @ SBG_ECOM_LOG_NMEA_1_PSBGB
    Definition: sbgEComIds.h:163
    +
    @ SBG_ECOM_LOG_NMEA_1_WASSP
    Definition: sbgEComIds.h:174
    +
    + + + + diff --git a/doc/html/sbg_e_com_lib_8h.html b/doc/html/sbg_e_com_lib_8h.html new file mode 100644 index 0000000..7eb4163 --- /dev/null +++ b/doc/html/sbg_e_com_lib_8h.html @@ -0,0 +1,89 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/sbgEComLib.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComLib.h File Reference
    +
    +
    + +

    Main header file for the SBG Systems Enhanced Communication Library. +More...

    +
    #include <sbgCommon.h>
    +#include <crc/sbgCrc.h>
    +#include <interfaces/sbgInterface.h>
    +#include <interfaces/sbgInterfaceUdp.h>
    +#include <interfaces/sbgInterfaceSerial.h>
    +#include <interfaces/sbgInterfaceFile.h>
    +#include <splitBuffer/sbgSplitBuffer.h>
    +#include <streamBuffer/sbgStreamBuffer.h>
    +#include <network/sbgNetwork.h>
    +#include <swap/sbgSwap.h>
    +#include "sbgECanId.h"
    +#include "sbgEComIds.h"
    +#include "commands/sbgEComCmd.h"
    +#include "protocol/sbgEComProtocol.h"
    +#include "binaryLogs/sbgEComBinaryLogs.h"
    +#include "sbgEComVersion.h"
    +#include "sbgEComGetVersion.h"
    +
    +

    Go to the source code of this file.

    +

    Detailed Description

    +

    Main header file for the SBG Systems Enhanced Communication Library.

    +
    Author
    SBG Systems
    +
    Date
    05 February 2013
    +

    Only this main header file should be included to use the library.

    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_lib_8h_source.html b/doc/html/sbg_e_com_lib_8h_source.html new file mode 100644 index 0000000..84d7471 --- /dev/null +++ b/doc/html/sbg_e_com_lib_8h_source.html @@ -0,0 +1,99 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/sbgEComLib.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComLib.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    40#ifndef SBG_ECOM_LIB_H
    +
    41#define SBG_ECOM_LIB_H
    +
    42
    +
    43#ifdef __cplusplus
    +
    44extern "C" {
    +
    45#endif
    +
    46
    +
    47// sbgCommonLib headers
    +
    48#include <sbgCommon.h>
    +
    49#include <crc/sbgCrc.h>
    +
    50#include <interfaces/sbgInterface.h>
    +
    51#include <interfaces/sbgInterfaceUdp.h>
    +
    52#include <interfaces/sbgInterfaceSerial.h>
    +
    53#include <interfaces/sbgInterfaceFile.h>
    +
    54#include <splitBuffer/sbgSplitBuffer.h>
    +
    55#include <streamBuffer/sbgStreamBuffer.h>
    +
    56#include <network/sbgNetwork.h>
    +
    57#include <swap/sbgSwap.h>
    +
    58
    +
    59// Local headers
    +
    60#include "sbgECanId.h"
    +
    61#include "sbgEComIds.h"
    +
    62#include "commands/sbgEComCmd.h"
    + + +
    65#include "sbgEComVersion.h"
    +
    66#include "sbgEComGetVersion.h"
    +
    67
    +
    68//----------------------------------------------------------------------//
    +
    69//- Footer (close extern C block) -//
    +
    70//----------------------------------------------------------------------//
    +
    71#ifdef __cplusplus
    +
    72}
    +
    73#endif
    +
    74
    +
    75#endif // SBG_ECOM_LIB_H
    +
    Defines all sbgECom commands identifiers.
    +
    Parse incoming sbgECom logs and store result in an union.
    +
    Include all available sbgECom commands.
    +
    Version information.
    +
    Defines all sbgECom commands identifiers.
    +
    Implementation of the sbgECom binary communication protocol.
    +
    Header file that contains all versions related information such as change log.
    +
    + + + + diff --git a/doc/html/sbg_e_com_protocol_8h.html b/doc/html/sbg_e_com_protocol_8h.html new file mode 100644 index 0000000..06a4de9 --- /dev/null +++ b/doc/html/sbg_e_com_protocol_8h.html @@ -0,0 +1,791 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/protocol/sbgEComProtocol.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComProtocol.h File Reference
    +
    +
    + +

    Implementation of the sbgECom binary communication protocol. +More...

    +
    #include <sbgCommon.h>
    +#include <interfaces/sbgInterface.h>
    +#include <streamBuffer/sbgStreamBuffer.h>
    +
    +

    Go to the source code of this file.

    + + + + + + +

    +Data Structures

    struct  _SbgEComProtocolPayload
     
    struct  _SbgEComProtocol
     
    + + + + + + + + + + + + + + + +

    +Macros

    #define SBG_ECOM_MAX_BUFFER_SIZE   (4096)
     
    #define SBG_ECOM_MAX_PAYLOAD_SIZE   (4086)
     
    #define SBG_ECOM_MAX_EXTENDED_PAYLOAD_SIZE   (4081)
     
    #define SBG_ECOM_SYNC_1   (0xFF)
     
    #define SBG_ECOM_SYNC_2   (0x5A)
     
    #define SBG_ECOM_ETX   (0x33)
     
    #define SBG_ECOM_RX_TIME_OUT   (450)
     
    + + + + + +

    +Typedefs

    typedef struct _SbgEComProtocolPayload SbgEComProtocolPayload
     
    typedef struct _SbgEComProtocol SbgEComProtocol
     
    + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    +Functions

    void sbgEComProtocolPayloadConstruct (SbgEComProtocolPayload *pPayload)
     
    void sbgEComProtocolPayloadDestroy (SbgEComProtocolPayload *pPayload)
     
    const void * sbgEComProtocolPayloadGetBuffer (const SbgEComProtocolPayload *pPayload)
     
    size_t sbgEComProtocolPayloadGetSize (const SbgEComProtocolPayload *pPayload)
     
    void * sbgEComProtocolPayloadMoveBuffer (SbgEComProtocolPayload *pPayload)
     
    SbgErrorCode sbgEComProtocolInit (SbgEComProtocol *pProtocol, SbgInterface *pInterface)
     
    SbgErrorCode sbgEComProtocolClose (SbgEComProtocol *pProtocol)
     
    SbgErrorCode sbgEComProtocolPurgeIncoming (SbgEComProtocol *pProtocol)
     
    SbgErrorCode sbgEComProtocolSend (SbgEComProtocol *pProtocol, uint8_t msgClass, uint8_t msg, const void *pData, size_t size)
     
    SbgErrorCode sbgEComProtocolReceive (SbgEComProtocol *pProtocol, uint8_t *pMsgClass, uint8_t *pMsgId, void *pData, size_t *pSize, size_t maxSize)
     
    SbgErrorCode sbgEComProtocolReceive2 (SbgEComProtocol *pProtocol, uint8_t *pMsgClass, uint8_t *pMsgId, SbgEComProtocolPayload *pPayload)
     
    SbgErrorCode sbgEComStartFrameGeneration (SbgStreamBuffer *pOutputStream, uint8_t msgClass, uint8_t msg, size_t *pStreamCursor)
     
    SbgErrorCode sbgEComFinalizeFrameGeneration (SbgStreamBuffer *pOutputStream, size_t streamCursor)
     
    +

    Detailed Description

    +

    Implementation of the sbgECom binary communication protocol.

    +
    Author
    SBG Systems
    +
    Date
    06 February 2013
    +

    You will find below, the frame definition used by Ekinox devices.
    +
    +

    + + + + + + + +
    Frame structure
    Fields SYNC 1 SYNC 2 CMD LEN DATA CRC ETX
    Size in bytes 1 1 2 2 (0-4086) 2 1
    Value 0xFF 0x5A ? ? ? ? 0x33
    +


    + Size in bytes indicates the size of the data field.
    + The minimum frame size is 9 bytes and the maximum is 512 bytes.
    +
    + The CRC is calculated on the whole frame without:
    + SYNC STX CRC and ETX fields.
    +

    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Macro Definition Documentation

    + +

    ◆ SBG_ECOM_MAX_BUFFER_SIZE

    + +
    +
    + + + + +
    #define SBG_ECOM_MAX_BUFFER_SIZE   (4096)
    +
    +

    Maximum reception buffer size in bytes.

    + +
    +
    + +

    ◆ SBG_ECOM_MAX_PAYLOAD_SIZE

    + +
    +
    + + + + +
    #define SBG_ECOM_MAX_PAYLOAD_SIZE   (4086)
    +
    +

    Maximum payload size in bytes.

    + +
    +
    + +

    ◆ SBG_ECOM_MAX_EXTENDED_PAYLOAD_SIZE

    + +
    +
    + + + + +
    #define SBG_ECOM_MAX_EXTENDED_PAYLOAD_SIZE   (4081)
    +
    +

    Maximum payload size in an extended frame, in bytes.

    + +
    +
    + +

    ◆ SBG_ECOM_SYNC_1

    + +
    +
    + + + + +
    #define SBG_ECOM_SYNC_1   (0xFF)
    +
    +

    First synchronization char of the frame.

    + +
    +
    + +

    ◆ SBG_ECOM_SYNC_2

    + +
    +
    + + + + +
    #define SBG_ECOM_SYNC_2   (0x5A)
    +
    +

    Second synchronization char of the frame.

    + +
    +
    + +

    ◆ SBG_ECOM_ETX

    + +
    +
    + + + + +
    #define SBG_ECOM_ETX   (0x33)
    +
    +

    End of frame byte.

    + +
    +
    + +

    ◆ SBG_ECOM_RX_TIME_OUT

    + +
    +
    + + + + +
    #define SBG_ECOM_RX_TIME_OUT   (450)
    +
    +

    Default time out for new frame reception.

    + +
    +
    +

    Typedef Documentation

    + +

    ◆ SbgEComProtocolPayload

    + +
    +
    +

    Payload.

    +

    This class is used to abstract whether some payload is received from a single or multiple frames.

    + +
    +
    + +

    ◆ SbgEComProtocol

    + +
    +
    + + + + +
    typedef struct _SbgEComProtocol SbgEComProtocol
    +
    +

    Struct containing all protocol related data.

    +

    The member variables related to large transfers are valid if and only if the large buffer is valid.

    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgEComProtocolPayloadConstruct()

    + +
    +
    + + + + + + + + +
    void sbgEComProtocolPayloadConstruct (SbgEComProtocolPayloadpPayload)
    +
    +

    Payload constructor.

    +
    Parameters
    + + +
    [in]pPayloadPayload.
    +
    +
    + +
    +
    + +

    ◆ sbgEComProtocolPayloadDestroy()

    + +
    +
    + + + + + + + + +
    void sbgEComProtocolPayloadDestroy (SbgEComProtocolPayloadpPayload)
    +
    +

    Payload destructor.

    +
    Parameters
    + + +
    [in]pPayloadPayload.
    +
    +
    + +
    +
    + +

    ◆ sbgEComProtocolPayloadGetBuffer()

    + +
    +
    + + + + + + + + +
    const void * sbgEComProtocolPayloadGetBuffer (const SbgEComProtocolPayloadpPayload)
    +
    +

    Get the buffer of a payload.

    +
    Parameters
    + + +
    [in]pPayloadPayload.
    +
    +
    +
    Returns
    Payload buffer.
    + +
    +
    + +

    ◆ sbgEComProtocolPayloadGetSize()

    + +
    +
    + + + + + + + + +
    size_t sbgEComProtocolPayloadGetSize (const SbgEComProtocolPayloadpPayload)
    +
    +

    Get the size of a payload buffer.

    +
    Parameters
    + + +
    [in]pPayloadPayload.
    +
    +
    +
    Returns
    Size of the payload buffer, in bytes.
    + +
    +
    + +

    ◆ sbgEComProtocolPayloadMoveBuffer()

    + +
    +
    + + + + + + + + +
    void * sbgEComProtocolPayloadMoveBuffer (SbgEComProtocolPayloadpPayload)
    +
    +

    Move the buffer of a payload.

    +

    If successful, the ownership of the buffer is passed to the caller. Otherwise, the payload is unchanged.

    +

    The buffer must be released with free() once unused.

    +
    Parameters
    + + +
    [in]pPayloadPayload.
    +
    +
    +
    Returns
    Payload buffer if successful, NULL otherwise.
    + +
    +
    + +

    ◆ sbgEComProtocolInit()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComProtocolInit (SbgEComProtocolpProtocol,
    SbgInterface * pInterface 
    )
    +
    +

    Initialize the protocol system used to communicate with the product and return the created handle.

    +
    Parameters
    + + + +
    [in]pProtocolPointer on an allocated protocol structure to initialize.
    [in]pInterfaceInterface to use for read/write operations.
    +
    +
    +
    Returns
    SBG_NO_ERROR if we have initialised the protocol system.
    + +
    +
    + +

    ◆ sbgEComProtocolClose()

    + +
    +
    + + + + + + + + +
    SbgErrorCode sbgEComProtocolClose (SbgEComProtocolpProtocol)
    +
    +

    Close the protocol system.

    +
    Parameters
    + + +
    [in]pProtocolA valid protocol handle to close.
    +
    +
    +
    Returns
    SBG_NO_ERROR if we have closed and released the protocol system.
    + +
    +
    + +

    ◆ sbgEComProtocolPurgeIncoming()

    + +
    +
    + + + + + + + + +
    SbgErrorCode sbgEComProtocolPurgeIncoming (SbgEComProtocolpProtocol)
    +
    +

    Purge the interface rx buffer as well as the sbgECom rx work buffer.

    +

    For example, if the program flow has been interrupted, this method can be helpful to discard all trash received data.

    +

    WARNING: This method is blocking for 100ms and actively tries to read incoming data.

    +
    Parameters
    + + +
    [in]pProtocolA valid SbgEComProtocol handle.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the incoming data has been purged successfully.
    + +
    +
    + +

    ◆ sbgEComProtocolSend()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComProtocolSend (SbgEComProtocolpProtocol,
    uint8_t msgClass,
    uint8_t msg,
    const void * pData,
    size_t size 
    )
    +
    +

    Send data.

    +

    If the size is SBG_ECOM_MAX_PAYLOAD_SIZE or less, the data is sent in a single frame. Otherwise, is it fragmented into multiple extended frames, each sent in order, which may block.

    +
    Parameters
    + + + + + + +
    [in]pProtocolA valid protocol handle.
    [in]msgClassMessage class.
    [in]msgMessage ID.
    [in]pDataData buffer.
    [in]sizeData buffer size, in bytes.
    +
    +
    +
    Returns
    SBG_NO_ERROR if the frame has been sent.
    + +
    +
    + +

    ◆ sbgEComProtocolReceive()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComProtocolReceive (SbgEComProtocolpProtocol,
    uint8_t * pMsgClass,
    uint8_t * pMsgId,
    void * pData,
    size_t * pSize,
    size_t maxSize 
    )
    +
    +

    Receive a frame.

    +
    Parameters
    + + + + + + + +
    [in]pProtocolA valid protocol handle.
    [out]pMsgClassMessage class, may be NULL.
    [out]pMsgIdMessage ID, may be NULL.
    [out]pDataData buffer.
    [out]pSizeNumber of bytes received.
    [in]maxSizeData buffer size, in bytes.
    +
    +
    +
    Returns
    SBG_NO_ERROR if successful, SBG_NOT_READY if no complete frame has been received, SBG_BUFFER_OVERFLOW if the payload of the received frame couldn't fit into the data buffer.
    + +
    +
    + +

    ◆ sbgEComProtocolReceive2()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComProtocolReceive2 (SbgEComProtocolpProtocol,
    uint8_t * pMsgClass,
    uint8_t * pMsgId,
    SbgEComProtocolPayloadpPayload 
    )
    +
    +

    Receive a frame.

    +

    This function is equivalent to sbgEComProtocolReceive() with two exceptions :

      +
    • the use of a payload object allows handling payloads not limited by the size of a user-provided buffer
    • +
    • the payload object allows direct access to the protocol work buffer to avoid an extra copy per call
    • +
    +

    Any allocated resource associated with the given payload is released when calling this function.

    +

    Because the payload buffer may directly refer to the protocol work buffer on return, it is only valid until the next attempt to receive a frame, with any of the receive functions.

    +
    Parameters
    + + + + + +
    [in]pProtocolA valid protocol handle.
    [out]pMsgClassMessage class, may be NULL.
    [out]pMsgIdMessage ID, may be NULL.
    [out]pPayloadPayload.
    +
    +
    +
    Returns
    SBG_NO_ERROR if successful, SBG_NOT_READY if no complete frame has been received.
    + +
    +
    + +

    ◆ sbgEComStartFrameGeneration()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComStartFrameGeneration (SbgStreamBuffer * pOutputStream,
    uint8_t msgClass,
    uint8_t msg,
    size_t * pStreamCursor 
    )
    +
    +

    Initialize an output stream for an sbgECom frame generation.

    +

    This function is helpful to avoid memory copy compared to sbgEComProtocolSend one.

    +

    Only standard frames may be sent with this function.

    +
    Parameters
    + + + + + +
    [in]pOutputStreamPointer to an allocated and initialized output stream.
    [in]msgClassMessage class.
    [in]msgMessage ID.
    [out]pStreamCursorThe initial output stream cursor that thus points to the begining of the generated message. This value should be passed to sbgEComFinalizeFrameGeneration for correct operations.
    +
    +
    +
    Returns
    SBG_NO_ERROR in case of good operation.
    + +
    +
    + +

    ◆ sbgEComFinalizeFrameGeneration()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComFinalizeFrameGeneration (SbgStreamBuffer * pOutputStream,
    size_t streamCursor 
    )
    +
    +

    Finalize an output stream that has been initialized with sbgEComStartFrameGeneration.

    +

    At return, the output stream buffer should point at the end of the generated message. You can thus easily create consecutive SBG_ECOM_LOGS with these methods.

    +
    Parameters
    + + + +
    [in]pOutputStreamPointer to an allocated and initialized output stream.
    [in]streamCursorPosition in the stream buffer of the generated message first byte. This value is returned by sbgEComStartFrameGeneration and is mandatory for correct operations.
    +
    +
    +
    Returns
    SBG_NO_ERROR in case of good operation.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_protocol_8h_source.html b/doc/html/sbg_e_com_protocol_8h_source.html new file mode 100644 index 0000000..70105d1 --- /dev/null +++ b/doc/html/sbg_e_com_protocol_8h_source.html @@ -0,0 +1,181 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/protocol/sbgEComProtocol.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComProtocol.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    47#ifndef SBG_ECOM_PROTOCOL_H
    +
    48#define SBG_ECOM_PROTOCOL_H
    +
    49
    +
    50// sbgCommonLib headers
    +
    51#include <sbgCommon.h>
    +
    52#include <interfaces/sbgInterface.h>
    +
    53#include <streamBuffer/sbgStreamBuffer.h>
    +
    54
    +
    55#ifdef __cplusplus
    +
    56extern "C" {
    +
    57#endif
    +
    58
    +
    59//----------------------------------------------------------------------//
    +
    60//- Constant definitions -//
    +
    61//----------------------------------------------------------------------//
    +
    62
    +
    63#define SBG_ECOM_MAX_BUFFER_SIZE (4096)
    +
    64#define SBG_ECOM_MAX_PAYLOAD_SIZE (4086)
    +
    65#define SBG_ECOM_MAX_EXTENDED_PAYLOAD_SIZE (4081)
    +
    66#define SBG_ECOM_SYNC_1 (0xFF)
    +
    67#define SBG_ECOM_SYNC_2 (0x5A)
    +
    68#define SBG_ECOM_ETX (0x33)
    +
    70#define SBG_ECOM_RX_TIME_OUT (450)
    +
    72//----------------------------------------------------------------------//
    +
    73//- Structure definitions -//
    +
    74//----------------------------------------------------------------------//
    +
    75
    + +
    83{
    +
    84 bool allocated;
    +
    85 void *pBuffer;
    +
    86 size_t size;
    + +
    88
    +
    94typedef struct _SbgEComProtocol
    +
    95{
    +
    96 SbgInterface *pLinkedInterface;
    + +
    98 size_t rxBufferSize;
    +
    99 size_t discardSize;
    + +
    102 //
    +
    103 // Member variables related to large transfer reception.
    +
    104 //
    +
    105 uint8_t *pLargeBuffer;
    + +
    107 uint8_t msgClass;
    +
    108 uint8_t msgId;
    +
    109 uint8_t transferId;
    +
    110 uint16_t pageIndex;
    +
    111 uint16_t nrPages;
    + +
    113
    +
    114//----------------------------------------------------------------------//
    +
    115//- Public methods (SbgEComProtocolPayload) -//
    +
    116//----------------------------------------------------------------------//
    +
    117
    + +
    124
    + +
    131
    + +
    139
    + +
    147
    + +
    160
    +
    161//----------------------------------------------------------------------//
    +
    162//- Public methods (SbgEComProtocol) -//
    +
    163//----------------------------------------------------------------------//
    +
    164
    +
    172SbgErrorCode sbgEComProtocolInit(SbgEComProtocol *pProtocol, SbgInterface *pInterface);
    +
    173
    +
    180SbgErrorCode sbgEComProtocolClose(SbgEComProtocol *pProtocol);
    +
    181
    + +
    193
    +
    207SbgErrorCode sbgEComProtocolSend(SbgEComProtocol *pProtocol, uint8_t msgClass, uint8_t msg, const void *pData, size_t size);
    +
    208
    +
    222SbgErrorCode sbgEComProtocolReceive(SbgEComProtocol *pProtocol, uint8_t *pMsgClass, uint8_t *pMsgId, void *pData, size_t *pSize, size_t maxSize);
    +
    223
    +
    243SbgErrorCode sbgEComProtocolReceive2(SbgEComProtocol *pProtocol, uint8_t *pMsgClass, uint8_t *pMsgId, SbgEComProtocolPayload *pPayload);
    +
    244
    +
    259SbgErrorCode sbgEComStartFrameGeneration(SbgStreamBuffer *pOutputStream, uint8_t msgClass, uint8_t msg, size_t *pStreamCursor);
    +
    260
    +
    272SbgErrorCode sbgEComFinalizeFrameGeneration(SbgStreamBuffer *pOutputStream, size_t streamCursor);
    +
    273
    +
    274#ifdef __cplusplus
    +
    275}
    +
    276#endif
    +
    277
    +
    278#endif // SBG_ECOM_PROTOCOL_H
    +
    size_t sbgEComProtocolPayloadGetSize(const SbgEComProtocolPayload *pPayload)
    +
    struct _SbgEComProtocol SbgEComProtocol
    +
    struct _SbgEComProtocolPayload SbgEComProtocolPayload
    +
    SbgErrorCode sbgEComProtocolInit(SbgEComProtocol *pProtocol, SbgInterface *pInterface)
    +
    SbgErrorCode sbgEComStartFrameGeneration(SbgStreamBuffer *pOutputStream, uint8_t msgClass, uint8_t msg, size_t *pStreamCursor)
    +
    SbgErrorCode sbgEComProtocolSend(SbgEComProtocol *pProtocol, uint8_t msgClass, uint8_t msg, const void *pData, size_t size)
    +
    void * sbgEComProtocolPayloadMoveBuffer(SbgEComProtocolPayload *pPayload)
    +
    SbgErrorCode sbgEComProtocolReceive2(SbgEComProtocol *pProtocol, uint8_t *pMsgClass, uint8_t *pMsgId, SbgEComProtocolPayload *pPayload)
    +
    SbgErrorCode sbgEComFinalizeFrameGeneration(SbgStreamBuffer *pOutputStream, size_t streamCursor)
    +
    SbgErrorCode sbgEComProtocolReceive(SbgEComProtocol *pProtocol, uint8_t *pMsgClass, uint8_t *pMsgId, void *pData, size_t *pSize, size_t maxSize)
    +
    void sbgEComProtocolPayloadConstruct(SbgEComProtocolPayload *pPayload)
    +
    SbgErrorCode sbgEComProtocolClose(SbgEComProtocol *pProtocol)
    +
    SbgErrorCode sbgEComProtocolPurgeIncoming(SbgEComProtocol *pProtocol)
    +
    #define SBG_ECOM_MAX_BUFFER_SIZE
    Definition: sbgEComProtocol.h:63
    +
    const void * sbgEComProtocolPayloadGetBuffer(const SbgEComProtocolPayload *pPayload)
    +
    void sbgEComProtocolPayloadDestroy(SbgEComProtocolPayload *pPayload)
    +
    Definition: sbgEComProtocol.h:95
    +
    uint16_t pageIndex
    Definition: sbgEComProtocol.h:110
    +
    uint8_t transferId
    Definition: sbgEComProtocol.h:109
    +
    uint8_t * pLargeBuffer
    Definition: sbgEComProtocol.h:105
    +
    size_t discardSize
    Definition: sbgEComProtocol.h:99
    +
    uint16_t nrPages
    Definition: sbgEComProtocol.h:111
    +
    SbgInterface * pLinkedInterface
    Definition: sbgEComProtocol.h:96
    +
    uint8_t msgClass
    Definition: sbgEComProtocol.h:107
    +
    uint8_t msgId
    Definition: sbgEComProtocol.h:108
    +
    uint8_t nextLargeTxId
    Definition: sbgEComProtocol.h:100
    +
    size_t rxBufferSize
    Definition: sbgEComProtocol.h:98
    +
    size_t largeBufferSize
    Definition: sbgEComProtocol.h:106
    +
    uint8_t rxBuffer[SBG_ECOM_MAX_BUFFER_SIZE]
    Definition: sbgEComProtocol.h:97
    +
    Definition: sbgEComProtocol.h:83
    +
    size_t size
    Definition: sbgEComProtocol.h:86
    +
    void * pBuffer
    Definition: sbgEComProtocol.h:85
    +
    bool allocated
    Definition: sbgEComProtocol.h:84
    +
    + + + + diff --git a/doc/html/sbg_e_com_transfer_8h.html b/doc/html/sbg_e_com_transfer_8h.html new file mode 100644 index 0000000..f35fed3 --- /dev/null +++ b/doc/html/sbg_e_com_transfer_8h.html @@ -0,0 +1,305 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/transfer/sbgEComTransfer.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    + +
    sbgEComTransfer.h File Reference
    +
    +
    + +

    Handle large send/receive transfer for specific ECom Protocol commands. +More...

    +
    #include <sbgCommon.h>
    +#include <sbgECom.h>
    +
    +

    Go to the source code of this file.

    + + + + + + +

    +Macros

    #define SBG_ECOM_TRANSFER_MAX_SIZE   (8192u)
     
    #define SBG_ECOM_TRANSFER_PACKET_SIZE   (512u)
     
    + + + +

    +Typedefs

    typedef enum _SbgEComTransferCmd SbgEComTransferCmd
     
    + + + +

    +Enumerations

    enum  _SbgEComTransferCmd {
    +  SBG_ECOM_TRANSFER_START = 0 +,
    +  SBG_ECOM_TRANSFER_DATA = 1 +,
    +  SBG_ECOM_TRANSFER_END = 2 +
    + }
     
    + + + + + +

    +Functions

    SbgErrorCode sbgEComTransferSend (SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg, const void *pBuffer, size_t size)
     
    SbgErrorCode sbgEComTransferReceive (SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg, void *pBuffer, size_t *pActualSize, size_t bufferSize)
     
    +

    Detailed Description

    +

    Handle large send/receive transfer for specific ECom Protocol commands.

    +
    Author
    SBG Systems
    +
    Date
    19 November 2013
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +

    Macro Definition Documentation

    + +

    ◆ SBG_ECOM_TRANSFER_MAX_SIZE

    + +
    +
    + + + + +
    #define SBG_ECOM_TRANSFER_MAX_SIZE   (8192u)
    +
    +

    Maximum buffer that can be transmitted using the sbgECom transfer protocol.

    + +
    +
    + +

    ◆ SBG_ECOM_TRANSFER_PACKET_SIZE

    + +
    +
    + + + + +
    #define SBG_ECOM_TRANSFER_PACKET_SIZE   (512u)
    +
    +

    Max packet size transmitted in a single frame

    + +
    +
    +

    Typedef Documentation

    + +

    ◆ SbgEComTransferCmd

    + +
    +
    + + + + +
    typedef enum _SbgEComTransferCmd SbgEComTransferCmd
    +
    +

    Defines the ECom transfer commands

    + +
    +
    +

    Enumeration Type Documentation

    + +

    ◆ _SbgEComTransferCmd

    + +
    +
    + + + + +
    enum _SbgEComTransferCmd
    +
    +

    Defines the ECom transfer commands

    + + + + +
    Enumerator
    SBG_ECOM_TRANSFER_START 

    Command to initiate a transfer.

    +
    SBG_ECOM_TRANSFER_DATA 

    Command to transmit/receive data.

    +
    SBG_ECOM_TRANSFER_END 

    Command to end a transfer.

    +
    + +
    +
    +

    Function Documentation

    + +

    ◆ sbgEComTransferSend()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComTransferSend (SbgEComHandlepHandle,
    uint8_t msgClass,
    uint8_t msg,
    const void * pBuffer,
    size_t size 
    )
    +
    +

    Specific method to handle a large send into multiple frames.

    +
    Parameters
    + + + + + + +
    [in]pHandlePointer to a valid SbgEComHandle.
    [in]msgClassOriginal protocol class asking for transfer.
    [in]msgOriginal protocol message id asking for transfer.
    [in]pBufferPointer to the buffer containing the data to send.
    [in]sizeThe size of the buffer.
    +
    +
    +
    Returns
    SBG_NO_ERROR in case of a successful upload.
    + +
    +
    + +

    ◆ sbgEComTransferReceive()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    SbgErrorCode sbgEComTransferReceive (SbgEComHandlepHandle,
    uint8_t msgClass,
    uint8_t msg,
    void * pBuffer,
    size_t * pActualSize,
    size_t bufferSize 
    )
    +
    +

    Specific method to handle a large receive from the device.

    +
    Parameters
    + + + + + + + +
    [in]pHandlePointer to a valid SbgEComHandle.
    [in]msgClassOriginal protocol class asking for transfer.
    [in]msgOriginal protocol message id asking for transfer.
    [in]pBufferPointer to the buffer where to write data.
    [out]pActualSizeThe final size written into the buffer.
    [in]bufferSizeThe size of the buffer.
    +
    +
    +
    Returns
    SBG_NO_ERROR in case of a successful download.
    + +
    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_transfer_8h_source.html b/doc/html/sbg_e_com_transfer_8h_source.html new file mode 100644 index 0000000..8e538d2 --- /dev/null +++ b/doc/html/sbg_e_com_transfer_8h_source.html @@ -0,0 +1,108 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/transfer/sbgEComTransfer.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComTransfer.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_ECOM_TRANSFER_H
    +
    33#define SBG_ECOM_TRANSFER_H
    +
    34
    +
    35// sbgCommonLib headers
    +
    36#include <sbgCommon.h>
    +
    37
    +
    38// Project headers
    +
    39#include <sbgECom.h>
    +
    40
    +
    41#ifdef __cplusplus
    +
    42extern "C" {
    +
    43#endif
    +
    44
    +
    45//----------------------------------------------------------------------//
    +
    46//- Global definitions -//
    +
    47//----------------------------------------------------------------------//
    +
    48
    +
    49#define SBG_ECOM_TRANSFER_MAX_SIZE (8192u)
    +
    50#define SBG_ECOM_TRANSFER_PACKET_SIZE (512u)
    +
    52//----------------------------------------------------------------------//
    +
    53//- Communication protocol structs and definitions -//
    +
    54//----------------------------------------------------------------------//
    +
    55
    + +
    60{
    + + + + +
    65
    +
    66//----------------------------------------------------------------------//
    +
    67//- Public methods -//
    +
    68//----------------------------------------------------------------------//
    +
    69
    +
    80SbgErrorCode sbgEComTransferSend(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg, const void *pBuffer, size_t size);
    +
    81
    +
    93SbgErrorCode sbgEComTransferReceive(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg, void *pBuffer, size_t *pActualSize, size_t bufferSize);
    +
    94
    +
    95#ifdef __cplusplus
    +
    96}
    +
    97#endif
    +
    98
    +
    99#endif // SBG_ECOM_TRANSFER_H
    +
    Contains main sbgECom methods.
    +
    enum _SbgEComTransferCmd SbgEComTransferCmd
    +
    SbgErrorCode sbgEComTransferReceive(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg, void *pBuffer, size_t *pActualSize, size_t bufferSize)
    +
    SbgErrorCode sbgEComTransferSend(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg, const void *pBuffer, size_t size)
    +
    _SbgEComTransferCmd
    Definition: sbgEComTransfer.h:60
    +
    @ SBG_ECOM_TRANSFER_START
    Definition: sbgEComTransfer.h:61
    +
    @ SBG_ECOM_TRANSFER_DATA
    Definition: sbgEComTransfer.h:62
    +
    @ SBG_ECOM_TRANSFER_END
    Definition: sbgEComTransfer.h:63
    +
    Definition: sbgECom.h:81
    +
    + + + + diff --git a/doc/html/sbg_e_com_version_8h.html b/doc/html/sbg_e_com_version_8h.html new file mode 100644 index 0000000..1dce658 --- /dev/null +++ b/doc/html/sbg_e_com_version_8h.html @@ -0,0 +1,72 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/sbgEComVersion.h File Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComVersion.h File Reference
    +
    +
    + +

    Header file that contains all versions related information such as change log. +More...

    +
    #include <sbgCommon.h>
    +
    +

    Go to the source code of this file.

    +

    Detailed Description

    +

    Header file that contains all versions related information such as change log.

    +
    Author
    SBG Systems
    +
    Date
    05 February 2013
    + +
    License

    The MIT license

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    +

    +
    +
    + + + + diff --git a/doc/html/sbg_e_com_version_8h_source.html b/doc/html/sbg_e_com_version_8h_source.html new file mode 100644 index 0000000..78088f3 --- /dev/null +++ b/doc/html/sbg_e_com_version_8h_source.html @@ -0,0 +1,94 @@ + + + + + + + +sbgECom: C:/BuildAgent/work/a862d1d45192611d/build_Release/src/sbgEComVersion.h Source File + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + + +
    +
    +
    sbgEComVersion.h
    +
    +
    +Go to the documentation of this file.
    1
    +
    32#ifndef SBG_E_COM_VERSION_H
    +
    33#define SBG_E_COM_VERSION_H
    +
    34
    +
    35// sbgCommonLib headers
    +
    36#include <sbgCommon.h>
    +
    37
    +
    38#ifdef __cplusplus
    +
    39extern "C" {
    +
    40#endif
    +
    41
    +
    42
    +
    43//----------------------------------------------------------------------//
    +
    44//- Version definitions -//
    +
    45//----------------------------------------------------------------------//
    +
    46
    +
    47#define SBG_E_COM_VERSION_MAJOR 3
    +
    48#define SBG_E_COM_VERSION_MINOR 1
    +
    49#define SBG_E_COM_VERSION_REV 2358
    +
    50#define SBG_E_COM_VERSION_BUILD SBG_VERSION_QUALIFIER_STABLE
    +
    51
    +
    52#define SBG_E_COM_VERSION SBG_VERSION_SOFTWARE(SBG_E_COM_VERSION_MAJOR,SBG_E_COM_VERSION_MINOR,SBG_E_COM_VERSION_REV,SBG_E_COM_VERSION_BUILD)
    +
    53
    +
    54/*
    +
    55 * Backward compatibility macro definitions.
    +
    56 */
    +
    57 #ifndef SBG_STR
    +
    58 #define SBG_STR(X) #X
    +
    59#endif
    +
    60#ifndef SBG_ASSTR
    +
    61 #define SBG_ASSTR(X) SBG_STR(X)
    +
    62#endif
    +
    63#define SBG_E_COM_VERSION_STR SBG_ASSTR(SBG_E_COM_VERSION_MAJOR) "." SBG_ASSTR(SBG_E_COM_VERSION_MINOR) "." SBG_ASSTR(SBG_E_COM_VERSION_REV) "-stable\0"
    +
    64
    +
    65#ifdef __cplusplus
    +
    66}
    +
    67#endif
    +
    68
    +
    69#endif // SBG_E_COM_VERSION_H
    +
    + + + + diff --git a/doc/html/splitbar.png b/doc/html/splitbar.png new file mode 100644 index 0000000..fe895f2 Binary files /dev/null and b/doc/html/splitbar.png differ diff --git a/doc/html/struct___sbg_e_com_advanced_conf.html b/doc/html/struct___sbg_e_com_advanced_conf.html new file mode 100644 index 0000000..1fdf84d --- /dev/null +++ b/doc/html/struct___sbg_e_com_advanced_conf.html @@ -0,0 +1,116 @@ + + + + + + + +sbgECom: _SbgEComAdvancedConf Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgEComAdvancedConf Struct Reference
    +
    +
    + +

    #include <sbgEComCmdAdvanced.h>

    + + + + + + + + +

    +Data Fields

    SbgEComTimeReferenceSrc timeReference
     
    uint32_t gnssOptions
     
    uint32_t nmeaOptions
     
    +

    Detailed Description

    +

    Structure containing all the info for advanced configuration.

    +

    Field Documentation

    + +

    ◆ timeReference

    + +
    +
    + + + + +
    SbgEComTimeReferenceSrc _SbgEComAdvancedConf::timeReference
    +
    +

    Time reference source for clock alignment.

    + +
    +
    + +

    ◆ gnssOptions

    + +
    +
    + + + + +
    uint32_t _SbgEComAdvancedConf::gnssOptions
    +
    +

    Advanced GNSS options - contact SBG Systems.

    + +
    +
    + +

    ◆ nmeaOptions

    + +
    +
    + + + + +
    uint32_t _SbgEComAdvancedConf::nmeaOptions
    +
    +

    Advanced NMEA output options.

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/struct___sbg_e_com_aiding_assign_conf.html b/doc/html/struct___sbg_e_com_aiding_assign_conf.html new file mode 100644 index 0000000..c44aa08 --- /dev/null +++ b/doc/html/struct___sbg_e_com_aiding_assign_conf.html @@ -0,0 +1,184 @@ + + + + + + + +sbgECom: _SbgEComAidingAssignConf Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgEComAidingAssignConf Struct Reference
    +
    +
    + +

    #include <sbgEComCmdSensor.h>

    + + + + + + + + + + + + + + + + +

    +Data Fields

    SbgEComModulePortAssignment gps1Port
     
    SbgEComModuleSyncAssignment gps1Sync
     
    SbgEComModulePortAssignment dvlPort
     
    SbgEComModuleSyncAssignment dvlSync
     
    SbgEComModulePortAssignment rtcmPort
     
    SbgEComModulePortAssignment airDataPort
     
    SbgEComOdometerPinAssignment odometerPinsConf
     
    +

    Detailed Description

    +

    Helper structure for module assignments

    +

    Field Documentation

    + +

    ◆ gps1Port

    + +
    +
    + + + + +
    SbgEComModulePortAssignment _SbgEComAidingAssignConf::gps1Port
    +
    +

    GNSS module port assignment.

    + +
    +
    + +

    ◆ gps1Sync

    + +
    +
    + + + + +
    SbgEComModuleSyncAssignment _SbgEComAidingAssignConf::gps1Sync
    +
    +

    GNSS module sync assignment.

    + +
    +
    + +

    ◆ dvlPort

    + +
    +
    + + + + +
    SbgEComModulePortAssignment _SbgEComAidingAssignConf::dvlPort
    +
    +

    Port on which the DVL is connected

    + +
    +
    + +

    ◆ dvlSync

    + +
    +
    + + + + +
    SbgEComModuleSyncAssignment _SbgEComAidingAssignConf::dvlSync
    +
    +

    Optional sync signal that could be used to time stamp the DVL data.

    + +
    +
    + +

    ◆ rtcmPort

    + +
    +
    + + + + +
    SbgEComModulePortAssignment _SbgEComAidingAssignConf::rtcmPort
    +
    +

    RTCM input port assignment for IGNG-N DGPS.

    + +
    +
    + +

    ◆ airDataPort

    + +
    +
    + + + + +
    SbgEComModulePortAssignment _SbgEComAidingAssignConf::airDataPort
    +
    +

    Port on which Air Data aiding is connected.

    + +
    +
    + +

    ◆ odometerPinsConf

    + +
    +
    + + + + +
    SbgEComOdometerPinAssignment _SbgEComAidingAssignConf::odometerPinsConf
    +
    +

    Odometer module pin assignment.

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/struct___sbg_e_com_air_data_rejection_conf.html b/doc/html/struct___sbg_e_com_air_data_rejection_conf.html new file mode 100644 index 0000000..15eb329 --- /dev/null +++ b/doc/html/struct___sbg_e_com_air_data_rejection_conf.html @@ -0,0 +1,99 @@ + + + + + + + +sbgECom: _SbgEComAirDataRejectionConf Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgEComAirDataRejectionConf Struct Reference
    +
    +
    + +

    #include <sbgEComCmdAirData.h>

    + + + + + + +

    +Data Fields

    SbgEComRejectionMode airspeed
     
    SbgEComRejectionMode altitude
     
    +

    Detailed Description

    +

    Holds all necessary information for AirData module data rejection.

    +

    Field Documentation

    + +

    ◆ airspeed

    + +
    +
    + + + + +
    SbgEComRejectionMode _SbgEComAirDataRejectionConf::airspeed
    +
    +

    Rejection mode for the true air speed measurement.

    + +
    +
    + +

    ◆ altitude

    + +
    +
    + + + + +
    SbgEComRejectionMode _SbgEComAirDataRejectionConf::altitude
    +
    +

    Rejection mode for the barometric altitude measurement.

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/struct___sbg_e_com_cmd_api_reply.html b/doc/html/struct___sbg_e_com_cmd_api_reply.html new file mode 100644 index 0000000..94cf9fd --- /dev/null +++ b/doc/html/struct___sbg_e_com_cmd_api_reply.html @@ -0,0 +1,118 @@ + + + + + + + +sbgECom: _SbgEComCmdApiReply Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgEComCmdApiReply Struct Reference
    +
    +
    + +

    #include <sbgEComCmdApi.h>

    + + + + + + + + +

    +Data Fields

    SbgEComProtocolPayload payload
     
    uint16_t statusCode
     
    const char * pContent
     
    +

    Detailed Description

    +

    Reply to REST API commands.

    +

    The reply content is a null-terminated string, normally in JSON format.

    +

    The content directly refers to data inside the payload.

    +

    Field Documentation

    + +

    ◆ payload

    + +
    +
    + + + + +
    SbgEComProtocolPayload _SbgEComCmdApiReply::payload
    +
    +

    Payload.

    + +
    +
    + +

    ◆ statusCode

    + +
    +
    + + + + +
    uint16_t _SbgEComCmdApiReply::statusCode
    +
    +

    Status code.

    + +
    +
    + +

    ◆ pContent

    + +
    +
    + + + + +
    const char* _SbgEComCmdApiReply::pContent
    +
    +

    Content.

    + +
    +
    +
    The documentation for this struct was generated from the following file:
      +
    • C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdApi.h
    • +
    +
    + + + + diff --git a/doc/html/struct___sbg_e_com_cmd_odo_can_conf.html b/doc/html/struct___sbg_e_com_cmd_odo_can_conf.html new file mode 100644 index 0000000..5d537a3 --- /dev/null +++ b/doc/html/struct___sbg_e_com_cmd_odo_can_conf.html @@ -0,0 +1,201 @@ + + + + + + + +sbgECom: _SbgEComCmdOdoCanConf Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgEComCmdOdoCanConf Struct Reference
    +
    +
    + +

    #include <sbgEComCmdOdo.h>

    + + + + + + + + + + + + + + + + + + +

    +Data Fields

    uint16_t options
     
    uint32_t canId
     
    size_t startBit
     
    size_t dataSize
     
    float scale
     
    float offset
     
    float minValue
     
    float maxValue
     
    +

    Detailed Description

    +

    Holds all necessary information for CAN Odometer parameter configuration. This format is very similar to info contained in a DBC file.

    +

    Field Documentation

    + +

    ◆ options

    + +
    +
    + + + + +
    uint16_t _SbgEComCmdOdoCanConf::options
    +
    +

    Set of options bit masks such as CAN extended.

    + +
    +
    + +

    ◆ canId

    + +
    +
    + + + + +
    uint32_t _SbgEComCmdOdoCanConf::canId
    +
    +

    CAN message ID from which the odometer velocity will be parsed.

    + +
    +
    + +

    ◆ startBit

    + +
    +
    + + + + +
    size_t _SbgEComCmdOdoCanConf::startBit
    +
    +

    Index of field MSB in big endian or LSB in little endian within the payload (any value from 0 to 63).

    + +
    +
    + +

    ◆ dataSize

    + +
    +
    + + + + +
    size_t _SbgEComCmdOdoCanConf::dataSize
    +
    +

    Length in bits of the odometer velocity field (any value from 1 to 64 minus dataOffset).

    + +
    +
    + +

    ◆ scale

    + +
    +
    + + + + +
    float _SbgEComCmdOdoCanConf::scale
    +
    +

    Value to multiply the parsed field with to get physical unit^in m.s-1.

    + +
    +
    + +

    ◆ offset

    + +
    +
    + + + + +
    float _SbgEComCmdOdoCanConf::offset
    +
    +

    Offset to add on the scaled velocity information in m.s-1 (after applying scale factor).

    + +
    +
    + +

    ◆ minValue

    + +
    +
    + + + + +
    float _SbgEComCmdOdoCanConf::minValue
    +
    +

    The minimum velocity to consider the message valid in m.s-1

    + +
    +
    + +

    ◆ maxValue

    + +
    +
    + + + + +
    float _SbgEComCmdOdoCanConf::maxValue
    +
    +

    The maximum velocity to consider the message valid in m.s-1

    + +
    +
    +
    The documentation for this struct was generated from the following file:
      +
    • C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdOdo.h
    • +
    +
    + + + + diff --git a/doc/html/struct___sbg_e_com_device_info.html b/doc/html/struct___sbg_e_com_device_info.html new file mode 100644 index 0000000..7db26f4 --- /dev/null +++ b/doc/html/struct___sbg_e_com_device_info.html @@ -0,0 +1,201 @@ + + + + + + + +sbgECom: _SbgEComDeviceInfo Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgEComDeviceInfo Struct Reference
    +
    +
    + +

    #include <sbgEComCmdInfo.h>

    + + + + + + + + + + + + + + + + + + +

    +Data Fields

    uint8_t productCode [SBG_ECOM_INFO_PRODUCT_CODE_LENGTH]
     
    uint32_t serialNumber
     
    uint32_t calibationRev
     
    uint16_t calibrationYear
     
    uint8_t calibrationMonth
     
    uint8_t calibrationDay
     
    uint32_t hardwareRev
     
    uint32_t firmwareRev
     
    +

    Detailed Description

    +

    Helper structure to retrieve device info.

    +

    Field Documentation

    + +

    ◆ productCode

    + +
    +
    + + + + +
    uint8_t _SbgEComDeviceInfo::productCode[SBG_ECOM_INFO_PRODUCT_CODE_LENGTH]
    +
    +

    Human readable Product Code.

    + +
    +
    + +

    ◆ serialNumber

    + +
    +
    + + + + +
    uint32_t _SbgEComDeviceInfo::serialNumber
    +
    +

    Device serial number

    + +
    +
    + +

    ◆ calibationRev

    + +
    +
    + + + + +
    uint32_t _SbgEComDeviceInfo::calibationRev
    +
    +

    Calibration data revision

    + +
    +
    + +

    ◆ calibrationYear

    + +
    +
    + + + + +
    uint16_t _SbgEComDeviceInfo::calibrationYear
    +
    +

    Device Calibration Year

    + +
    +
    + +

    ◆ calibrationMonth

    + +
    +
    + + + + +
    uint8_t _SbgEComDeviceInfo::calibrationMonth
    +
    +

    Device Calibration Month

    + +
    +
    + +

    ◆ calibrationDay

    + +
    +
    + + + + +
    uint8_t _SbgEComDeviceInfo::calibrationDay
    +
    +

    Device Calibration Day

    + +
    +
    + +

    ◆ hardwareRev

    + +
    +
    + + + + +
    uint32_t _SbgEComDeviceInfo::hardwareRev
    +
    +

    Device hardware revision

    + +
    +
    + +

    ◆ firmwareRev

    + +
    +
    + + + + +
    uint32_t _SbgEComDeviceInfo::firmwareRev
    +
    +

    Firmware revision

    + +
    +
    +
    The documentation for this struct was generated from the following file:
      +
    • C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdInfo.h
    • +
    +
    + + + + diff --git a/doc/html/struct___sbg_e_com_dvl_installation.html b/doc/html/struct___sbg_e_com_dvl_installation.html new file mode 100644 index 0000000..7518e0b --- /dev/null +++ b/doc/html/struct___sbg_e_com_dvl_installation.html @@ -0,0 +1,116 @@ + + + + + + + +sbgECom: _SbgEComDvlInstallation Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgEComDvlInstallation Struct Reference
    +
    +
    + +

    #include <sbgEComCmdDvl.h>

    + + + + + + + + +

    +Data Fields

    float leverArm [3]
     
    float alignment [3]
     
    bool preciseInstallation
     
    +

    Detailed Description

    +

    DVL mechanical installation parameters such as lever arm and alignment

    +

    Field Documentation

    + +

    ◆ leverArm

    + +
    +
    + + + + +
    float _SbgEComDvlInstallation::leverArm[3]
    +
    +

    X, Y, Z DVL lever arm in meters expressed from the DVL to the IMU.

    + +
    +
    + +

    ◆ alignment

    + +
    +
    + + + + +
    float _SbgEComDvlInstallation::alignment[3]
    +
    +

    Roll, pitch, yaw DVL alignment expressed in radians.

    + +
    +
    + +

    ◆ preciseInstallation

    + +
    +
    + + + + +
    bool _SbgEComDvlInstallation::preciseInstallation
    +
    +

    Set to true if both the DVL lever arm and DVL alignment are precise and don't require in-run estimation.

    + +
    +
    +
    The documentation for this struct was generated from the following file:
      +
    • C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdDvl.h
    • +
    +
    + + + + diff --git a/doc/html/struct___sbg_e_com_dvl_rejection_conf.html b/doc/html/struct___sbg_e_com_dvl_rejection_conf.html new file mode 100644 index 0000000..5f5e7f4 --- /dev/null +++ b/doc/html/struct___sbg_e_com_dvl_rejection_conf.html @@ -0,0 +1,99 @@ + + + + + + + +sbgECom: _SbgEComDvlRejectionConf Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgEComDvlRejectionConf Struct Reference
    +
    +
    + +

    #include <sbgEComCmdDvl.h>

    + + + + + + +

    +Data Fields

    SbgEComRejectionMode bottomLayer
     
    SbgEComRejectionMode waterLayer
     
    +

    Detailed Description

    +

    Holds all necessary information for DVL module data rejection.

    +

    Field Documentation

    + +

    ◆ bottomLayer

    + +
    +
    + + + + +
    SbgEComRejectionMode _SbgEComDvlRejectionConf::bottomLayer
    +
    +

    Rejection mode for the bottom tracking (ie when the velocity measurement is in respect to the seabed).

    + +
    +
    + +

    ◆ waterLayer

    + +
    +
    + + + + +
    SbgEComRejectionMode _SbgEComDvlRejectionConf::waterLayer
    +
    +

    Rejection mode for the water tracking (ie when the velocity measurement is relative to a water layer).

    + +
    +
    +
    The documentation for this struct was generated from the following file:
      +
    • C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdDvl.h
    • +
    +
    + + + + diff --git a/doc/html/struct___sbg_e_com_ethernet_conf.html b/doc/html/struct___sbg_e_com_ethernet_conf.html new file mode 100644 index 0000000..cf624ab --- /dev/null +++ b/doc/html/struct___sbg_e_com_ethernet_conf.html @@ -0,0 +1,167 @@ + + + + + + + +sbgECom: _SbgEComEthernetConf Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgEComEthernetConf Struct Reference
    +
    +
    + +

    #include <sbgEComCmdEthernet.h>

    + + + + + + + + + + + + + + +

    +Data Fields

    SbgEComEthernetMode mode
     
    sbgIpAddress ipAddress
     
    sbgIpAddress netmask
     
    sbgIpAddress gateway
     
    sbgIpAddress dns1
     
    sbgIpAddress dns2
     
    +

    Detailed Description

    +

    Structure that contains all Ethernet configuration or settings.

    +

    Field Documentation

    + +

    ◆ mode

    + +
    +
    + + + + +
    SbgEComEthernetMode _SbgEComEthernetConf::mode
    +
    +

    Define how the device will acquiere its IP address, either DHCP or Static.

    + +
    +
    + +

    ◆ ipAddress

    + +
    +
    + + + + +
    sbgIpAddress _SbgEComEthernetConf::ipAddress
    +
    +

    For static mode, defines the device IP address.

    + +
    +
    + +

    ◆ netmask

    + +
    +
    + + + + +
    sbgIpAddress _SbgEComEthernetConf::netmask
    +
    +

    For static mode, defines the device net mask.

    + +
    +
    + +

    ◆ gateway

    + +
    +
    + + + + +
    sbgIpAddress _SbgEComEthernetConf::gateway
    +
    +

    For static mode, defines the gateway to use.

    + +
    +
    + +

    ◆ dns1

    + +
    +
    + + + + +
    sbgIpAddress _SbgEComEthernetConf::dns1
    +
    +

    For static mode, defines the primary DNS to use.

    + +
    +
    + +

    ◆ dns2

    + +
    +
    + + + + +
    sbgIpAddress _SbgEComEthernetConf::dns2
    +
    +

    For static mode, defines the secondary DNS to use.

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/struct___sbg_e_com_features.html b/doc/html/struct___sbg_e_com_features.html new file mode 100644 index 0000000..3108a3c --- /dev/null +++ b/doc/html/struct___sbg_e_com_features.html @@ -0,0 +1,201 @@ + + + + + + + +sbgECom: _SbgEComFeatures Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgEComFeatures Struct Reference
    +
    +
    + +

    #include <sbgEComCmdFeatures.h>

    + + + + + + + + + + + + + + + + + + +

    +Data Fields

    uint32_t sensorFeaturesMask
     
    SbgEComGnssType gnssType
     
    uint8_t gnssUpdateRate
     
    uint32_t gnssSignalsMask
     
    uint32_t gnssFeaturesMask
     
    char gnssProductCode [32]
     
    char gnssSerialNumber [32]
     
    char gnssFirmwareVersion [32]
     
    +

    Detailed Description

    +

    This structure contains all the information provided by the SBG_ECOM_CMD_GET_FEATURES command

    +

    Field Documentation

    + +

    ◆ sensorFeaturesMask

    + +
    +
    + + + + +
    uint32_t _SbgEComFeatures::sensorFeaturesMask
    +
    +

    The different measurement capabilities of this unit

    + +
    +
    + +

    ◆ gnssType

    + +
    +
    + + + + +
    SbgEComGnssType _SbgEComFeatures::gnssType
    +
    +

    The type of GNSS receiver used (brand and model)

    + +
    +
    + +

    ◆ gnssUpdateRate

    + +
    +
    + + + + +
    uint8_t _SbgEComFeatures::gnssUpdateRate
    +
    +

    The actual GNSS update rate

    + +
    +
    + +

    ◆ gnssSignalsMask

    + +
    +
    + + + + +
    uint32_t _SbgEComFeatures::gnssSignalsMask
    +
    +

    GNSS receiver signals tracking

    + +
    +
    + +

    ◆ gnssFeaturesMask

    + +
    +
    + + + + +
    uint32_t _SbgEComFeatures::gnssFeaturesMask
    +
    +

    GNSS receiver computation and output features

    + +
    +
    + +

    ◆ gnssProductCode

    + +
    +
    + + + + +
    char _SbgEComFeatures::gnssProductCode[32]
    +
    +

    String containing the GNSS receiver product code ("\0" if unknown)

    + +
    +
    + +

    ◆ gnssSerialNumber

    + +
    +
    + + + + +
    char _SbgEComFeatures::gnssSerialNumber[32]
    +
    +

    String containing the GNSS receiver serial number ("\0" if unknown)

    + +
    +
    + +

    ◆ gnssFirmwareVersion

    + +
    +
    + + + + +
    char _SbgEComFeatures::gnssFirmwareVersion[32]
    +
    +

    String containing the GNSS receiver firmware version ("\0" if unknown)

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/struct___sbg_e_com_gnss_installation.html b/doc/html/struct___sbg_e_com_gnss_installation.html new file mode 100644 index 0000000..9ab3ad0 --- /dev/null +++ b/doc/html/struct___sbg_e_com_gnss_installation.html @@ -0,0 +1,133 @@ + + + + + + + +sbgECom: _SbgEComGnssInstallation Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgEComGnssInstallation Struct Reference
    +
    +
    + +

    #include <sbgEComCmdGnss.h>

    + + + + + + + + + + +

    +Data Fields

    float leverArmPrimary [3]
     
    bool leverArmPrimaryPrecise
     
    float leverArmSecondary [3]
     
    SbgEComGnssInstallationMode leverArmSecondaryMode
     
    +

    Detailed Description

    +

    GNSS mechanical installation parameters to be used with command SBG_ECOM_CMD_GNSS_::_INSTALLATION

    +

    Field Documentation

    + +

    ◆ leverArmPrimary

    + +
    +
    + + + + +
    float _SbgEComGnssInstallation::leverArmPrimary[3]
    +
    +

    GNSS primary antenna lever arm in IMU X, Y, Z axis in meters

    + +
    +
    + +

    ◆ leverArmPrimaryPrecise

    + +
    +
    + + + + +
    bool _SbgEComGnssInstallation::leverArmPrimaryPrecise
    +
    +

    If set to true, the primary lever arm has been accurately entered and doesn't need online re-estimation.

    + +
    +
    + +

    ◆ leverArmSecondary

    + +
    +
    + + + + +
    float _SbgEComGnssInstallation::leverArmSecondary[3]
    +
    +

    GNSS secondary antenna lever arm in IMU X, Y, Z axis in meters

    + +
    +
    + +

    ◆ leverArmSecondaryMode

    + +
    +
    + + + + +
    SbgEComGnssInstallationMode _SbgEComGnssInstallation::leverArmSecondaryMode
    +
    +

    Define the secondary antenna (dual antenna) operating mode.

    + +
    +
    +
    The documentation for this struct was generated from the following file:
      +
    • C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdGnss.h
    • +
    +
    + + + + diff --git a/doc/html/struct___sbg_e_com_gnss_rejection_conf.html b/doc/html/struct___sbg_e_com_gnss_rejection_conf.html new file mode 100644 index 0000000..afd4716 --- /dev/null +++ b/doc/html/struct___sbg_e_com_gnss_rejection_conf.html @@ -0,0 +1,116 @@ + + + + + + + +sbgECom: _SbgEComGnssRejectionConf Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgEComGnssRejectionConf Struct Reference
    +
    +
    + +

    #include <sbgEComCmdGnss.h>

    + + + + + + + + +

    +Data Fields

    SbgEComRejectionMode position
     
    SbgEComRejectionMode velocity
     
    SbgEComRejectionMode hdt
     
    +

    Detailed Description

    +

    Holds all necessary information for GNSS module data rejection.

    +

    Field Documentation

    + +

    ◆ position

    + +
    +
    + + + + +
    SbgEComRejectionMode _SbgEComGnssRejectionConf::position
    +
    +

    Rejection mode for position.

    + +
    +
    + +

    ◆ velocity

    + +
    +
    + + + + +
    SbgEComRejectionMode _SbgEComGnssRejectionConf::velocity
    +
    +

    Rejection mode for velocity.

    + +
    +
    + +

    ◆ hdt

    + +
    +
    + + + + +
    SbgEComRejectionMode _SbgEComGnssRejectionConf::hdt
    +
    +

    Rejection mode for true heading.

    + +
    +
    +
    The documentation for this struct was generated from the following file:
      +
    • C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdGnss.h
    • +
    +
    + + + + diff --git a/doc/html/struct___sbg_e_com_handle.html b/doc/html/struct___sbg_e_com_handle.html new file mode 100644 index 0000000..65ed63b --- /dev/null +++ b/doc/html/struct___sbg_e_com_handle.html @@ -0,0 +1,150 @@ + + + + + + + +sbgECom: _SbgEComHandle Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgEComHandle Struct Reference
    +
    +
    + +

    #include <sbgECom.h>

    + + + + + + + + + + + + +

    +Data Fields

    SbgEComProtocol protocolHandle
     
    SbgEComReceiveLogFunc pReceiveLogCallback
     
    void * pUserArg
     
    uint32_t numTrials
     
    uint32_t cmdDefaultTimeOut
     
    +

    Detailed Description

    +

    Interface definition that stores methods used to communicate on the interface.

    +

    Field Documentation

    + +

    ◆ protocolHandle

    + +
    +
    + + + + +
    SbgEComProtocol _SbgEComHandle::protocolHandle
    +
    +

    Handle on the protocol system.

    + +
    +
    + +

    ◆ pReceiveLogCallback

    + +
    +
    + + + + +
    SbgEComReceiveLogFunc _SbgEComHandle::pReceiveLogCallback
    +
    +

    Pointer on the method called each time a new binary log is received.

    + +
    +
    + +

    ◆ pUserArg

    + +
    +
    + + + + +
    void* _SbgEComHandle::pUserArg
    +
    +

    Optional user supplied argument for callbacks.

    + +
    +
    + +

    ◆ numTrials

    + +
    +
    + + + + +
    uint32_t _SbgEComHandle::numTrials
    +
    +

    Number of trials when a command is sent (default is 3).

    + +
    +
    + +

    ◆ cmdDefaultTimeOut

    + +
    +
    + + + + +
    uint32_t _SbgEComHandle::cmdDefaultTimeOut
    +
    +

    Default time out in ms to get an answer from the device (default 500 ms).

    + +
    +
    +
    The documentation for this struct was generated from the following file:
      +
    • C:/BuildAgent/work/a862d1d45192611d/build_Release/src/sbgECom.h
    • +
    +
    + + + + diff --git a/doc/html/struct___sbg_e_com_init_condition_conf.html b/doc/html/struct___sbg_e_com_init_condition_conf.html new file mode 100644 index 0000000..169a062 --- /dev/null +++ b/doc/html/struct___sbg_e_com_init_condition_conf.html @@ -0,0 +1,167 @@ + + + + + + + +sbgECom: _SbgEComInitConditionConf Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgEComInitConditionConf Struct Reference
    +
    +
    + +

    #include <sbgEComCmdSensor.h>

    + + + + + + + + + + + + + + +

    +Data Fields

    double latitude
     
    double longitude
     
    double altitude
     
    uint16_t year
     
    uint8_t month
     
    uint8_t day
     
    +

    Detailed Description

    +

    Helper structure for sensor Initial condition details

    +

    Field Documentation

    + +

    ◆ latitude

    + +
    +
    + + + + +
    double _SbgEComInitConditionConf::latitude
    +
    +

    Initial latitude in °

    + +
    +
    + +

    ◆ longitude

    + +
    +
    + + + + +
    double _SbgEComInitConditionConf::longitude
    +
    +

    Initial longitude in °

    + +
    +
    + +

    ◆ altitude

    + +
    +
    + + + + +
    double _SbgEComInitConditionConf::altitude
    +
    +

    Initial altitude above MSL in meters

    + +
    +
    + +

    ◆ year

    + +
    +
    + + + + +
    uint16_t _SbgEComInitConditionConf::year
    +
    +

    Initial Year

    + +
    +
    + +

    ◆ month

    + +
    +
    + + + + +
    uint8_t _SbgEComInitConditionConf::month
    +
    +

    Initial month

    + +
    +
    + +

    ◆ day

    + +
    +
    + + + + +
    uint8_t _SbgEComInitConditionConf::day
    +
    +

    Initial day

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/struct___sbg_e_com_interface_conf.html b/doc/html/struct___sbg_e_com_interface_conf.html new file mode 100644 index 0000000..a55ca3d --- /dev/null +++ b/doc/html/struct___sbg_e_com_interface_conf.html @@ -0,0 +1,99 @@ + + + + + + + +sbgECom: _SbgEComInterfaceConf Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgEComInterfaceConf Struct Reference
    +
    +
    + +

    #include <sbgEComCmdInterface.h>

    + + + + + + +

    +Data Fields

    uint32_t baudRate
     
    SbgEComPortMode mode
     
    +

    Detailed Description

    +

    Helper structure to configure a serial interface

    +

    Field Documentation

    + +

    ◆ baudRate

    + +
    +
    + + + + +
    uint32_t _SbgEComInterfaceConf::baudRate
    +
    +

    The baud rate of the interface.

    + +
    +
    + +

    ◆ mode

    + +
    +
    + + + + +
    SbgEComPortMode _SbgEComInterfaceConf::mode
    +
    +

    The mode of the interface.

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/struct___sbg_e_com_mag_calib_results.html b/doc/html/struct___sbg_e_com_mag_calib_results.html new file mode 100644 index 0000000..619c725 --- /dev/null +++ b/doc/html/struct___sbg_e_com_mag_calib_results.html @@ -0,0 +1,337 @@ + + + + + + + +sbgECom: _SbgEComMagCalibResults Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgEComMagCalibResults Struct Reference
    +
    +
    + +

    #include <sbgEComCmdMag.h>

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    +Data Fields

    SbgEComMagCalibQuality quality
     
    SbgEComMagCalibConfidence confidence
     
    uint16_t advancedStatus
     
    float beforeMeanError
     
    float beforeStdError
     
    float beforeMaxError
     
    float afterMeanError
     
    float afterStdError
     
    float afterMaxError
     
    float meanAccuracy
     
    float stdAccuracy
     
    float maxAccuracy
     
    uint16_t numPoints
     
    uint16_t maxNumPoints
     
    float offset [3]
     
    float matrix [9]
     
    +

    Detailed Description

    +

    Helper structure to retrieve onboard magnetic calibration results.

    +

    Field Documentation

    + +

    ◆ quality

    + +
    +
    + + + + +
    SbgEComMagCalibQuality _SbgEComMagCalibResults::quality
    +
    +

    General magnetic calibration quality indicator.

    + +
    +
    + +

    ◆ confidence

    + +
    +
    + + + + +
    SbgEComMagCalibConfidence _SbgEComMagCalibResults::confidence
    +
    +

    Confidence indicator that should be read to interpret the quality indicator.

    + +
    +
    + +

    ◆ advancedStatus

    + +
    +
    + + + + +
    uint16_t _SbgEComMagCalibResults::advancedStatus
    +
    +

    Set of bit masks used to report advanced information on the magnetic calibration status.

    + +
    +
    + +

    ◆ beforeMeanError

    + +
    +
    + + + + +
    float _SbgEComMagCalibResults::beforeMeanError
    +
    +

    Mean magnetic field norm error observed before calibration.

    + +
    +
    + +

    ◆ beforeStdError

    + +
    +
    + + + + +
    float _SbgEComMagCalibResults::beforeStdError
    +
    +

    Standard deviation of the magnetic field norm error observed before calibration.

    + +
    +
    + +

    ◆ beforeMaxError

    + +
    +
    + + + + +
    float _SbgEComMagCalibResults::beforeMaxError
    +
    +

    Maximum magnetic field norm error observed before calibration.

    + +
    +
    + +

    ◆ afterMeanError

    + +
    +
    + + + + +
    float _SbgEComMagCalibResults::afterMeanError
    +
    +

    Mean magnetic field norm error observed after calibration.

    + +
    +
    + +

    ◆ afterStdError

    + +
    +
    + + + + +
    float _SbgEComMagCalibResults::afterStdError
    +
    +

    Standard deviation of the magnetic field norm error observed after calibration.

    + +
    +
    + +

    ◆ afterMaxError

    + +
    +
    + + + + +
    float _SbgEComMagCalibResults::afterMaxError
    +
    +

    Maximum magnetic field norm error observed after calibration.

    + +
    +
    + +

    ◆ meanAccuracy

    + +
    +
    + + + + +
    float _SbgEComMagCalibResults::meanAccuracy
    +
    +

    Mean expected heading accuracy in radians.

    + +
    +
    + +

    ◆ stdAccuracy

    + +
    +
    + + + + +
    float _SbgEComMagCalibResults::stdAccuracy
    +
    +

    Standard deviation of the expected heading accuracy in radians.

    + +
    +
    + +

    ◆ maxAccuracy

    + +
    +
    + + + + +
    float _SbgEComMagCalibResults::maxAccuracy
    +
    +

    Maximum expected heading accuracy in radians.

    + +
    +
    + +

    ◆ numPoints

    + +
    +
    + + + + +
    uint16_t _SbgEComMagCalibResults::numPoints
    +
    +

    Number of magnetic field points stored internally and used to compute the magnetic calibration.

    + +
    +
    + +

    ◆ maxNumPoints

    + +
    +
    + + + + +
    uint16_t _SbgEComMagCalibResults::maxNumPoints
    +
    +

    Maximum number of magnetic field points that can be stored internally.

    + +
    +
    + +

    ◆ offset

    + +
    +
    + + + + +
    float _SbgEComMagCalibResults::offset[3]
    +
    +

    Computed Hard Iron correction vector offset.

    + +
    +
    + +

    ◆ matrix

    + +
    +
    + + + + +
    float _SbgEComMagCalibResults::matrix[9]
    +
    +

    Computed Hard & Soft Iron correction matrix.

    + +
    +
    +
    The documentation for this struct was generated from the following file:
      +
    • C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdMag.h
    • +
    +
    + + + + diff --git a/doc/html/struct___sbg_e_com_mag_rejection_conf.html b/doc/html/struct___sbg_e_com_mag_rejection_conf.html new file mode 100644 index 0000000..8d90b0b --- /dev/null +++ b/doc/html/struct___sbg_e_com_mag_rejection_conf.html @@ -0,0 +1,82 @@ + + + + + + + +sbgECom: _SbgEComMagRejectionConf Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgEComMagRejectionConf Struct Reference
    +
    +
    + +

    #include <sbgEComCmdMag.h>

    + + + + +

    +Data Fields

    SbgEComRejectionMode magneticField
     
    +

    Detailed Description

    +

    Holds all necessary information for Magnetometer module data rejection.

    +

    Field Documentation

    + +

    ◆ magneticField

    + +
    +
    + + + + +
    SbgEComRejectionMode _SbgEComMagRejectionConf::magneticField
    +
    +

    Rejection mode for magnetic field.

    + +
    +
    +
    The documentation for this struct was generated from the following file:
      +
    • C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdMag.h
    • +
    +
    + + + + diff --git a/doc/html/struct___sbg_e_com_odo_conf.html b/doc/html/struct___sbg_e_com_odo_conf.html new file mode 100644 index 0000000..8731dfe --- /dev/null +++ b/doc/html/struct___sbg_e_com_odo_conf.html @@ -0,0 +1,116 @@ + + + + + + + +sbgECom: _SbgEComOdoConf Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgEComOdoConf Struct Reference
    +
    +
    + +

    #include <sbgEComCmdOdo.h>

    + + + + + + + + +

    +Data Fields

    float gain
     
    uint8_t gainError
     
    bool reverseMode
     
    +

    Detailed Description

    +

    Holds all necessary information for Odometer module parameter configuration.

    +

    Field Documentation

    + +

    ◆ gain

    + +
    +
    + + + + +
    float _SbgEComOdoConf::gain
    +
    +

    Odometer's gain in pulses / meter.

    + +
    +
    + +

    ◆ gainError

    + +
    +
    + + + + +
    uint8_t _SbgEComOdoConf::gainError
    +
    +

    User gain average error in %

    + +
    +
    + +

    ◆ reverseMode

    + +
    +
    + + + + +
    bool _SbgEComOdoConf::reverseMode
    +
    +

    Whether the odometer is in reverse mode or not.

    + +
    +
    +
    The documentation for this struct was generated from the following file:
      +
    • C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdOdo.h
    • +
    +
    + + + + diff --git a/doc/html/struct___sbg_e_com_odo_rejection_conf.html b/doc/html/struct___sbg_e_com_odo_rejection_conf.html new file mode 100644 index 0000000..c166155 --- /dev/null +++ b/doc/html/struct___sbg_e_com_odo_rejection_conf.html @@ -0,0 +1,82 @@ + + + + + + + +sbgECom: _SbgEComOdoRejectionConf Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgEComOdoRejectionConf Struct Reference
    +
    +
    + +

    #include <sbgEComCmdOdo.h>

    + + + + +

    +Data Fields

    SbgEComRejectionMode velocity
     
    +

    Detailed Description

    +

    Holds all necessary information for Odometer module data rejection.

    +

    Field Documentation

    + +

    ◆ velocity

    + +
    +
    + + + + +
    SbgEComRejectionMode _SbgEComOdoRejectionConf::velocity
    +
    +

    Rejection mode for velocity.

    + +
    +
    +
    The documentation for this struct was generated from the following file:
      +
    • C:/BuildAgent/work/a862d1d45192611d/build_Release/src/commands/sbgEComCmdOdo.h
    • +
    +
    + + + + diff --git a/doc/html/struct___sbg_e_com_protocol.html b/doc/html/struct___sbg_e_com_protocol.html new file mode 100644 index 0000000..45d5a81 --- /dev/null +++ b/doc/html/struct___sbg_e_com_protocol.html @@ -0,0 +1,270 @@ + + + + + + + +sbgECom: _SbgEComProtocol Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgEComProtocol Struct Reference
    +
    +
    + +

    #include <sbgEComProtocol.h>

    + + + + + + + + + + + + + + + + + + + + + + + + + + +

    +Data Fields

    SbgInterface * pLinkedInterface
     
    uint8_t rxBuffer [SBG_ECOM_MAX_BUFFER_SIZE]
     
    size_t rxBufferSize
     
    size_t discardSize
     
    uint8_t nextLargeTxId
     
    uint8_t * pLargeBuffer
     
    size_t largeBufferSize
     
    uint8_t msgClass
     
    uint8_t msgId
     
    uint8_t transferId
     
    uint16_t pageIndex
     
    uint16_t nrPages
     
    +

    Detailed Description

    +

    Struct containing all protocol related data.

    +

    The member variables related to large transfers are valid if and only if the large buffer is valid.

    +

    Field Documentation

    + +

    ◆ pLinkedInterface

    + +
    +
    + + + + +
    SbgInterface* _SbgEComProtocol::pLinkedInterface
    +
    +

    Associated interface used by the protocol to read/write bytes.

    + +
    +
    + +

    ◆ rxBuffer

    + +
    +
    + + + + +
    uint8_t _SbgEComProtocol::rxBuffer[SBG_ECOM_MAX_BUFFER_SIZE]
    +
    +

    The reception buffer.

    + +
    +
    + +

    ◆ rxBufferSize

    + +
    +
    + + + + +
    size_t _SbgEComProtocol::rxBufferSize
    +
    +

    The current reception buffer size in bytes.

    + +
    +
    + +

    ◆ discardSize

    + +
    +
    + + + + +
    size_t _SbgEComProtocol::discardSize
    +
    +

    Number of bytes to discard on the next receive attempt.

    + +
    +
    + +

    ◆ nextLargeTxId

    + +
    +
    + + + + +
    uint8_t _SbgEComProtocol::nextLargeTxId
    +
    +

    Transfer ID of the next large send.

    + +
    +
    + +

    ◆ pLargeBuffer

    + +
    +
    + + + + +
    uint8_t* _SbgEComProtocol::pLargeBuffer
    +
    +

    Buffer for large transfers, allocated with malloc() if valid.

    + +
    +
    + +

    ◆ largeBufferSize

    + +
    +
    + + + + +
    size_t _SbgEComProtocol::largeBufferSize
    +
    +

    Size of the large transfer buffer, in bytes.

    + +
    +
    + +

    ◆ msgClass

    + +
    +
    + + + + +
    uint8_t _SbgEComProtocol::msgClass
    +
    +

    Message class for the current large transfer.

    + +
    +
    + +

    ◆ msgId

    + +
    +
    + + + + +
    uint8_t _SbgEComProtocol::msgId
    +
    +

    Message ID for the current large transfer.

    + +
    +
    + +

    ◆ transferId

    + +
    +
    + + + + +
    uint8_t _SbgEComProtocol::transferId
    +
    +

    ID of the current large transfer.

    + +
    +
    + +

    ◆ pageIndex

    + +
    +
    + + + + +
    uint16_t _SbgEComProtocol::pageIndex
    +
    +

    Expected page index of the next frame.

    + +
    +
    + +

    ◆ nrPages

    + +
    +
    + + + + +
    uint16_t _SbgEComProtocol::nrPages
    +
    +

    Number of pages in the current transfer.

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/struct___sbg_e_com_protocol_payload.html b/doc/html/struct___sbg_e_com_protocol_payload.html new file mode 100644 index 0000000..fdce8bc --- /dev/null +++ b/doc/html/struct___sbg_e_com_protocol_payload.html @@ -0,0 +1,117 @@ + + + + + + + +sbgECom: _SbgEComProtocolPayload Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgEComProtocolPayload Struct Reference
    +
    +
    + +

    #include <sbgEComProtocol.h>

    + + + + + + + + +

    +Data Fields

    bool allocated
     
    void * pBuffer
     
    size_t size
     
    +

    Detailed Description

    +

    Payload.

    +

    This class is used to abstract whether some payload is received from a single or multiple frames.

    +

    Field Documentation

    + +

    ◆ allocated

    + +
    +
    + + + + +
    bool _SbgEComProtocolPayload::allocated
    +
    +

    True if the buffer is allocated with malloc().

    + +
    +
    + +

    ◆ pBuffer

    + +
    +
    + + + + +
    void* _SbgEComProtocolPayload::pBuffer
    +
    +

    Buffer.

    + +
    +
    + +

    ◆ size

    + +
    +
    + + + + +
    size_t _SbgEComProtocolPayload::size
    +
    +

    Buffer size, in bytes.

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/struct___sbg_e_com_sensor_alignment_info.html b/doc/html/struct___sbg_e_com_sensor_alignment_info.html new file mode 100644 index 0000000..be2fae4 --- /dev/null +++ b/doc/html/struct___sbg_e_com_sensor_alignment_info.html @@ -0,0 +1,150 @@ + + + + + + + +sbgECom: _SbgEComSensorAlignmentInfo Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgEComSensorAlignmentInfo Struct Reference
    +
    +
    + +

    #include <sbgEComCmdSensor.h>

    + + + + + + + + + + + + +

    +Data Fields

    SbgEComAxisDirection axisDirectionX
     
    SbgEComAxisDirection axisDirectionY
     
    float misRoll
     
    float misPitch
     
    float misYaw
     
    +

    Detailed Description

    +

    Helper structure for sensor alignment details

    +

    Field Documentation

    + +

    ◆ axisDirectionX

    + +
    +
    + + + + +
    SbgEComAxisDirection _SbgEComSensorAlignmentInfo::axisDirectionX
    +
    +

    Sensor X axis direction in vehicle

    + +
    +
    + +

    ◆ axisDirectionY

    + +
    +
    + + + + +
    SbgEComAxisDirection _SbgEComSensorAlignmentInfo::axisDirectionY
    +
    +

    Sensor Y axis direction in vehicle

    + +
    +
    + +

    ◆ misRoll

    + +
    +
    + + + + +
    float _SbgEComSensorAlignmentInfo::misRoll
    +
    +

    Roll angle fine misalignment in rad

    + +
    +
    + +

    ◆ misPitch

    + +
    +
    + + + + +
    float _SbgEComSensorAlignmentInfo::misPitch
    +
    +

    Pitch angle fine misalignment in rad

    + +
    +
    + +

    ◆ misYaw

    + +
    +
    + + + + +
    float _SbgEComSensorAlignmentInfo::misYaw
    +
    +

    Yaw angle fine misalignment in rad

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/struct___sbg_e_com_sync_in_conf.html b/doc/html/struct___sbg_e_com_sync_in_conf.html new file mode 100644 index 0000000..d41001d --- /dev/null +++ b/doc/html/struct___sbg_e_com_sync_in_conf.html @@ -0,0 +1,99 @@ + + + + + + + +sbgECom: _SbgEComSyncInConf Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgEComSyncInConf Struct Reference
    +
    +
    + +

    #include <sbgEComCmdEvent.h>

    + + + + + + +

    +Data Fields

    SbgEComSyncInSensitivity sensitivity
     
    int32_t delay
     
    +

    Detailed Description

    +

    Helper structure for sync in configuration.

    +

    Field Documentation

    + +

    ◆ sensitivity

    + +
    +
    + + + + +
    SbgEComSyncInSensitivity _SbgEComSyncInConf::sensitivity
    +
    +

    Sensitivity of the sync in.

    + +
    +
    + +

    ◆ delay

    + +
    +
    + + + + +
    int32_t _SbgEComSyncInConf::delay
    +
    +

    Delay to take into account for the sync in. (in us)

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/struct___sbg_e_com_sync_out_conf.html b/doc/html/struct___sbg_e_com_sync_out_conf.html new file mode 100644 index 0000000..99e1297 --- /dev/null +++ b/doc/html/struct___sbg_e_com_sync_out_conf.html @@ -0,0 +1,116 @@ + + + + + + + +sbgECom: _SbgEComSyncOutConf Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgEComSyncOutConf Struct Reference
    +
    +
    + +

    #include <sbgEComCmdEvent.h>

    + + + + + + + + +

    +Data Fields

    SbgEComSyncOutFunction outputFunction
     
    SbgEComSyncOutPolarity polarity
     
    uint32_t duration
     
    +

    Detailed Description

    +

    Helper structure for sync out configuration.

    +

    Field Documentation

    + +

    ◆ outputFunction

    + +
    +
    + + + + +
    SbgEComSyncOutFunction _SbgEComSyncOutConf::outputFunction
    +
    +

    Output function of the sync out pin

    + +
    +
    + +

    ◆ polarity

    + +
    +
    + + + + +
    SbgEComSyncOutPolarity _SbgEComSyncOutConf::polarity
    +
    +

    Polarity of the sync out.

    + +
    +
    + +

    ◆ duration

    + +
    +
    + + + + +
    uint32_t _SbgEComSyncOutConf::duration
    +
    +

    Pulse width for the sync out (in ns).

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/struct___sbg_e_com_validity_thresholds.html b/doc/html/struct___sbg_e_com_validity_thresholds.html new file mode 100644 index 0000000..c91f391 --- /dev/null +++ b/doc/html/struct___sbg_e_com_validity_thresholds.html @@ -0,0 +1,133 @@ + + + + + + + +sbgECom: _SbgEComValidityThresholds Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgEComValidityThresholds Struct Reference
    +
    +
    + +

    #include <sbgEComCmdAdvanced.h>

    + + + + + + + + + + +

    +Data Fields

    float positionThreshold
     
    float velocityThreshold
     
    float attitudeThreshold
     
    float headingThreshold
     
    +

    Detailed Description

    +

    Structure containing all validity thresholds (status outputs) Setting these thresholds to 0.0 will keep default configuration

    +

    Field Documentation

    + +

    ◆ positionThreshold

    + +
    +
    + + + + +
    float _SbgEComValidityThresholds::positionThreshold
    +
    +

    Norm of the position standard deviation threshold to raise position valid flag (m)

    + +
    +
    + +

    ◆ velocityThreshold

    + +
    +
    + + + + +
    float _SbgEComValidityThresholds::velocityThreshold
    +
    +

    Norm of the velocity standard deviation threshold to raise velocity valid flag (m/s)

    + +
    +
    + +

    ◆ attitudeThreshold

    + +
    +
    + + + + +
    float _SbgEComValidityThresholds::attitudeThreshold
    +
    +

    Max of the roll/pitch standard deviations threshold to raise attitude valid flag (rad)

    + +
    +
    + +

    ◆ headingThreshold

    + +
    +
    + + + + +
    float _SbgEComValidityThresholds::headingThreshold
    +
    +

    Heading standard deviations threshold to raise heading valid flag (rad)

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/struct___sbg_log_air_data.html b/doc/html/struct___sbg_log_air_data.html new file mode 100644 index 0000000..009caec --- /dev/null +++ b/doc/html/struct___sbg_log_air_data.html @@ -0,0 +1,184 @@ + + + + + + + +sbgECom: _SbgLogAirData Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgLogAirData Struct Reference
    +
    +
    + +

    #include <sbgEComBinaryLogAirData.h>

    + + + + + + + + + + + + + + + + +

    +Data Fields

    uint32_t timeStamp
     
    uint16_t status
     
    float pressureAbs
     
    float altitude
     
    float pressureDiff
     
    float trueAirspeed
     
    float airTemperature
     
    +

    Detailed Description

    +

    Log structure for AirData.

    +

    Field Documentation

    + +

    ◆ timeStamp

    + +
    +
    + + + + +
    uint32_t _SbgLogAirData::timeStamp
    +
    +

    Time in us since the sensor power up OR measurement delay in us.

    + +
    +
    + +

    ◆ status

    + +
    +
    + + + + +
    uint16_t _SbgLogAirData::status
    +
    +

    Airdata sensor status bitmask.

    + +
    +
    + +

    ◆ pressureAbs

    + +
    +
    + + + + +
    float _SbgLogAirData::pressureAbs
    +
    +

    Raw absolute pressure measured by the barometer sensor in Pascals.

    + +
    +
    + +

    ◆ altitude

    + +
    +
    + + + + +
    float _SbgLogAirData::altitude
    +
    +

    Altitude computed from barometric altimeter in meters and positive upward.

    + +
    +
    + +

    ◆ pressureDiff

    + +
    +
    + + + + +
    float _SbgLogAirData::pressureDiff
    +
    +

    Raw differential pressure measured by the pitot tube in Pascal.

    + +
    +
    + +

    ◆ trueAirspeed

    + +
    +
    + + + + +
    float _SbgLogAirData::trueAirspeed
    +
    +

    True airspeed measured by a pitot tube in m.s^-1 and positive forward.

    + +
    +
    + +

    ◆ airTemperature

    + +
    +
    + + + + +
    float _SbgLogAirData::airTemperature
    +
    +

    Outside air temperature in °C that could be used to compute true airspeed from differential pressure.

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/struct___sbg_log_auto_data.html b/doc/html/struct___sbg_log_auto_data.html new file mode 100644 index 0000000..d1a2a85 --- /dev/null +++ b/doc/html/struct___sbg_log_auto_data.html @@ -0,0 +1,133 @@ + + + + + + + +sbgECom: _SbgLogAutoData Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgLogAutoData Struct Reference
    +
    +
    + +

    #include <sbgEComBinaryLogAutomotiveData.h>

    + + + + + + + + + + +

    +Data Fields

    uint8_t status
     
    float trackAngle
     
    float slipAngle
     
    float curvatureRadius
     
    +

    Detailed Description

    +

    Log structure for automotive data.

    +

    Field Documentation

    + +

    ◆ status

    + +
    +
    + + + + +
    uint8_t _SbgLogAutoData::status
    +
    +

    Status bit mask.

    + +
    +
    + +

    ◆ trackAngle

    + +
    +
    + + + + +
    float _SbgLogAutoData::trackAngle
    +
    +

    Track angle, in rad.

    + +
    +
    + +

    ◆ slipAngle

    + +
    +
    + + + + +
    float _SbgLogAutoData::slipAngle
    +
    +

    Slip angle, in rad.

    + +
    +
    + +

    ◆ curvatureRadius

    + +
    +
    + + + + +
    float _SbgLogAutoData::curvatureRadius
    +
    +

    Curvature radius, in m, always positive.

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/struct___sbg_log_depth.html b/doc/html/struct___sbg_log_depth.html new file mode 100644 index 0000000..d2413f9 --- /dev/null +++ b/doc/html/struct___sbg_log_depth.html @@ -0,0 +1,133 @@ + + + + + + + +sbgECom: _SbgLogDepth Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgLogDepth Struct Reference
    +
    +
    + +

    #include <sbgEComBinaryLogDepth.h>

    + + + + + + + + + + +

    +Data Fields

    uint32_t timeStamp
     
    uint16_t status
     
    float pressureAbs
     
    float altitude
     
    +

    Detailed Description

    +

    Log structure for Depth sensor measurement (subsea).

    +

    Field Documentation

    + +

    ◆ timeStamp

    + +
    +
    + + + + +
    uint32_t _SbgLogDepth::timeStamp
    +
    +

    Time in us since the sensor power up OR measurement delay in us.

    + +
    +
    + +

    ◆ status

    + +
    +
    + + + + +
    uint16_t _SbgLogDepth::status
    +
    +

    Airdata sensor status bitmask.

    + +
    +
    + +

    ◆ pressureAbs

    + +
    +
    + + + + +
    float _SbgLogDepth::pressureAbs
    +
    +

    Raw absolute pressure measured by the depth sensor in Pascals.

    + +
    +
    + +

    ◆ altitude

    + +
    +
    + + + + +
    float _SbgLogDepth::altitude
    +
    +

    Altitude computed from depth sensor in meters and positive upward.

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/struct___sbg_log_diag_data.html b/doc/html/struct___sbg_log_diag_data.html new file mode 100644 index 0000000..4ff3724 --- /dev/null +++ b/doc/html/struct___sbg_log_diag_data.html @@ -0,0 +1,133 @@ + + + + + + + +sbgECom: _SbgLogDiagData Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgLogDiagData Struct Reference
    +
    +
    + +

    #include <sbgEComBinaryLogDiag.h>

    + + + + + + + + + + +

    +Data Fields

    uint32_t timestamp
     
    SbgDebugLogType type
     
    SbgErrorCode errorCode
     
    char string [SBG_ECOM_LOG_DIAG_MAX_STRING_SIZE]
     
    +

    Detailed Description

    +

    Diagnostic log structure.

    +

    Field Documentation

    + +

    ◆ timestamp

    + +
    +
    + + + + +
    uint32_t _SbgLogDiagData::timestamp
    +
    +

    Timestamp, in microseconds.

    + +
    +
    + +

    ◆ type

    + +
    +
    + + + + +
    SbgDebugLogType _SbgLogDiagData::type
    +
    +

    Log type.

    + +
    +
    + +

    ◆ errorCode

    + +
    +
    + + + + +
    SbgErrorCode _SbgLogDiagData::errorCode
    +
    +

    Error code.

    + +
    +
    + +

    ◆ string

    + +
    +
    + + + + +
    char _SbgLogDiagData::string[SBG_ECOM_LOG_DIAG_MAX_STRING_SIZE]
    +
    +

    Log string, null-terminated.

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/struct___sbg_log_dvl_data.html b/doc/html/struct___sbg_log_dvl_data.html new file mode 100644 index 0000000..69866e8 --- /dev/null +++ b/doc/html/struct___sbg_log_dvl_data.html @@ -0,0 +1,133 @@ + + + + + + + +sbgECom: _SbgLogDvlData Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgLogDvlData Struct Reference
    +
    +
    + +

    #include <sbgEComBinaryLogDvl.h>

    + + + + + + + + + + +

    +Data Fields

    uint32_t timeStamp
     
    uint16_t status
     
    float velocity [3]
     
    float velocityQuality [3]
     
    +

    Detailed Description

    +

    Log structure for DVL data.

    +

    Field Documentation

    + +

    ◆ timeStamp

    + +
    +
    + + + + +
    uint32_t _SbgLogDvlData::timeStamp
    +
    +

    Time in us since the sensor power up.

    + +
    +
    + +

    ◆ status

    + +
    +
    + + + + +
    uint16_t _SbgLogDvlData::status
    +
    +

    DVL status bitmask.

    + +
    +
    + +

    ◆ velocity

    + +
    +
    + + + + +
    float _SbgLogDvlData::velocity[3]
    +
    +

    X, Y, Z velocities in m.s^-1 expressed in the DVL instrument frame.

    + +
    +
    + +

    ◆ velocityQuality

    + +
    +
    + + + + +
    float _SbgLogDvlData::velocityQuality[3]
    +
    +

    X, Y, Z velocities quality indicators as provided by the DVL sensor and expressed in m.s^-1. WARNING: This is typically just a residual information and not a real standard deviation.

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/struct___sbg_log_ekf_euler_data.html b/doc/html/struct___sbg_log_ekf_euler_data.html new file mode 100644 index 0000000..1fb7769 --- /dev/null +++ b/doc/html/struct___sbg_log_ekf_euler_data.html @@ -0,0 +1,133 @@ + + + + + + + +sbgECom: _SbgLogEkfEulerData Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgLogEkfEulerData Struct Reference
    +
    +
    + +

    #include <sbgEComBinaryLogEkf.h>

    + + + + + + + + + + +

    +Data Fields

    uint32_t timeStamp
     
    float euler [3]
     
    float eulerStdDev [3]
     
    uint32_t status
     
    +

    Detailed Description

    +

    EKF computed orientation using euler angles.

    +

    Field Documentation

    + +

    ◆ timeStamp

    + +
    +
    + + + + +
    uint32_t _SbgLogEkfEulerData::timeStamp
    +
    +

    Time in us since the sensor power up.

    + +
    +
    + +

    ◆ euler

    + +
    +
    + + + + +
    float _SbgLogEkfEulerData::euler[3]
    +
    +

    Roll, Pitch and Yaw angles in rad.

    + +
    +
    + +

    ◆ eulerStdDev

    + +
    +
    + + + + +
    float _SbgLogEkfEulerData::eulerStdDev[3]
    +
    +

    Roll, Pitch and Yaw angles 1 sigma standard deviation in rad.

    + +
    +
    + +

    ◆ status

    + +
    +
    + + + + +
    uint32_t _SbgLogEkfEulerData::status
    +
    +

    EKF solution status bitmask and enum.

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/struct___sbg_log_ekf_nav_data.html b/doc/html/struct___sbg_log_ekf_nav_data.html new file mode 100644 index 0000000..2967551 --- /dev/null +++ b/doc/html/struct___sbg_log_ekf_nav_data.html @@ -0,0 +1,184 @@ + + + + + + + +sbgECom: _SbgLogEkfNavData Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgLogEkfNavData Struct Reference
    +
    +
    + +

    #include <sbgEComBinaryLogEkf.h>

    + + + + + + + + + + + + + + + + +

    +Data Fields

    uint32_t timeStamp
     
    float velocity [3]
     
    float velocityStdDev [3]
     
    double position [3]
     
    float undulation
     
    float positionStdDev [3]
     
    uint32_t status
     
    +

    Detailed Description

    +

    EFK computed navigation data.

    +

    Field Documentation

    + +

    ◆ timeStamp

    + +
    +
    + + + + +
    uint32_t _SbgLogEkfNavData::timeStamp
    +
    +

    Time in us since the sensor power up.

    + +
    +
    + +

    ◆ velocity

    + +
    +
    + + + + +
    float _SbgLogEkfNavData::velocity[3]
    +
    +

    North, East, Down velocity in m.s^-1.

    + +
    +
    + +

    ◆ velocityStdDev

    + +
    +
    + + + + +
    float _SbgLogEkfNavData::velocityStdDev[3]
    +
    +

    North, East, Down velocity 1 sigma standard deviation in m.s^-1.

    + +
    +
    + +

    ◆ position

    + +
    +
    + + + + +
    double _SbgLogEkfNavData::position[3]
    +
    +

    Latitude, Longitude in degrees positive North and East. Altitude above Mean Sea Level in meters.

    + +
    +
    + +

    ◆ undulation

    + +
    +
    + + + + +
    float _SbgLogEkfNavData::undulation
    +
    +

    Altitude difference between the geoid and the Ellipsoid in meters (Height above Ellipsoid = altitude + undulation).

    + +
    +
    + +

    ◆ positionStdDev

    + +
    +
    + + + + +
    float _SbgLogEkfNavData::positionStdDev[3]
    +
    +

    Latitude, longitude and altitude 1 sigma standard deviation in meters.

    + +
    +
    + +

    ◆ status

    + +
    +
    + + + + +
    uint32_t _SbgLogEkfNavData::status
    +
    +

    EKF solution status bitmask and enum.

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/struct___sbg_log_ekf_quat_data.html b/doc/html/struct___sbg_log_ekf_quat_data.html new file mode 100644 index 0000000..abfe47a --- /dev/null +++ b/doc/html/struct___sbg_log_ekf_quat_data.html @@ -0,0 +1,133 @@ + + + + + + + +sbgECom: _SbgLogEkfQuatData Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgLogEkfQuatData Struct Reference
    +
    +
    + +

    #include <sbgEComBinaryLogEkf.h>

    + + + + + + + + + + +

    +Data Fields

    uint32_t timeStamp
     
    float quaternion [4]
     
    float eulerStdDev [3]
     
    uint32_t status
     
    +

    Detailed Description

    +

    EFK computed orientation using quaternion.

    +

    Field Documentation

    + +

    ◆ timeStamp

    + +
    +
    + + + + +
    uint32_t _SbgLogEkfQuatData::timeStamp
    +
    +

    Time in us since the sensor power up.

    + +
    +
    + +

    ◆ quaternion

    + +
    +
    + + + + +
    float _SbgLogEkfQuatData::quaternion[4]
    +
    +

    Orientation quaternion stored in W, X, Y, Z form.

    + +
    +
    + +

    ◆ eulerStdDev

    + +
    +
    + + + + +
    float _SbgLogEkfQuatData::eulerStdDev[3]
    +
    +

    Roll, Pitch and Yaw angles 1 sigma standard deviation in rad.

    + +
    +
    + +

    ◆ status

    + +
    +
    + + + + +
    uint32_t _SbgLogEkfQuatData::status
    +
    +

    EKF solution status bitmask and enum.

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/struct___sbg_log_event.html b/doc/html/struct___sbg_log_event.html new file mode 100644 index 0000000..85a104f --- /dev/null +++ b/doc/html/struct___sbg_log_event.html @@ -0,0 +1,167 @@ + + + + + + + +sbgECom: _SbgLogEvent Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgLogEvent Struct Reference
    +
    +
    + +

    #include <sbgEComBinaryLogEvent.h>

    + + + + + + + + + + + + + + +

    +Data Fields

    uint32_t timeStamp
     
    uint16_t status
     
    uint16_t timeOffset0
     
    uint16_t timeOffset1
     
    uint16_t timeOffset2
     
    uint16_t timeOffset3
     
    +

    Detailed Description

    +

    Structure that stores data for the SBG_ECOM_LOG_EVENT_# message.

    +

    Field Documentation

    + +

    ◆ timeStamp

    + +
    +
    + + + + +
    uint32_t _SbgLogEvent::timeStamp
    +
    +

    Measurement time since the sensor power up.

    + +
    +
    + +

    ◆ status

    + +
    +
    + + + + +
    uint16_t _SbgLogEvent::status
    +
    +

    Events status bitmask.

    + +
    +
    + +

    ◆ timeOffset0

    + +
    +
    + + + + +
    uint16_t _SbgLogEvent::timeOffset0
    +
    +

    Time offset for the second received event.

    + +
    +
    + +

    ◆ timeOffset1

    + +
    +
    + + + + +
    uint16_t _SbgLogEvent::timeOffset1
    +
    +

    Time offset for the third received event.

    + +
    +
    + +

    ◆ timeOffset2

    + +
    +
    + + + + +
    uint16_t _SbgLogEvent::timeOffset2
    +
    +

    Time offset for the fourth received event.

    + +
    +
    + +

    ◆ timeOffset3

    + +
    +
    + + + + +
    uint16_t _SbgLogEvent::timeOffset3
    +
    +

    Time offset for the fifth received event.

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/struct___sbg_log_fast_imu_data.html b/doc/html/struct___sbg_log_fast_imu_data.html new file mode 100644 index 0000000..8a5875c --- /dev/null +++ b/doc/html/struct___sbg_log_fast_imu_data.html @@ -0,0 +1,133 @@ + + + + + + + +sbgECom: _SbgLogFastImuData Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgLogFastImuData Struct Reference
    +
    +
    + +

    #include <sbgEComBinaryLogImu.h>

    + + + + + + + + + + +

    +Data Fields

    uint32_t timeStamp
     
    uint16_t status
     
    float accelerometers [3]
     
    float gyroscopes [3]
     
    +

    Detailed Description

    +

    Structure that stores the data for SBG_ECOM_LOG_FAST_IMU_DATA message

    +

    Field Documentation

    + +

    ◆ timeStamp

    + +
    +
    + + + + +
    uint32_t _SbgLogFastImuData::timeStamp
    +
    +

    Time in us since the sensor power up.

    + +
    +
    + +

    ◆ status

    + +
    +
    + + + + +
    uint16_t _SbgLogFastImuData::status
    +
    +

    IMU status bitmask.

    + +
    +
    + +

    ◆ accelerometers

    + +
    +
    + + + + +
    float _SbgLogFastImuData::accelerometers[3]
    +
    +

    X, Y, Z accelerometers in m.s^-2.

    + +
    +
    + +

    ◆ gyroscopes

    + +
    +
    + + + + +
    float _SbgLogFastImuData::gyroscopes[3]
    +
    +

    X, Y, Z gyroscopes in rad.s^-1.

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/struct___sbg_log_gps_hdt.html b/doc/html/struct___sbg_log_gps_hdt.html new file mode 100644 index 0000000..26be748 --- /dev/null +++ b/doc/html/struct___sbg_log_gps_hdt.html @@ -0,0 +1,201 @@ + + + + + + + +sbgECom: _SbgLogGpsHdt Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgLogGpsHdt Struct Reference
    +
    +
    + +

    #include <sbgEComBinaryLogGps.h>

    + + + + + + + + + + + + + + + + + + +

    +Data Fields

    uint32_t timeStamp
     
    uint16_t status
     
    uint32_t timeOfWeek
     
    float heading
     
    float headingAccuracy
     
    float pitch
     
    float pitchAccuracy
     
    float baseline
     
    +

    Detailed Description

    +

    Structure that stores data for the SBG_ECOM_LOG_GPS::_HDT message.

    +

    Field Documentation

    + +

    ◆ timeStamp

    + +
    +
    + + + + +
    uint32_t _SbgLogGpsHdt::timeStamp
    +
    +

    Time in us since the sensor power up.

    + +
    +
    + +

    ◆ status

    + +
    +
    + + + + +
    uint16_t _SbgLogGpsHdt::status
    +
    +

    GPS HDT status, type and bitmask.

    + +
    +
    + +

    ◆ timeOfWeek

    + +
    +
    + + + + +
    uint32_t _SbgLogGpsHdt::timeOfWeek
    +
    +

    GPS time of week in ms.

    + +
    +
    + +

    ◆ heading

    + +
    +
    + + + + +
    float _SbgLogGpsHdt::heading
    +
    +

    GPS true heading in degrees.

    + +
    +
    + +

    ◆ headingAccuracy

    + +
    +
    + + + + +
    float _SbgLogGpsHdt::headingAccuracy
    +
    +

    1 sigma GPS true heading accuracy in degrees.

    + +
    +
    + +

    ◆ pitch

    + +
    +
    + + + + +
    float _SbgLogGpsHdt::pitch
    +
    +

    GPS pitch angle measured from the master to the rover in degrees.

    + +
    +
    + +

    ◆ pitchAccuracy

    + +
    +
    + + + + +
    float _SbgLogGpsHdt::pitchAccuracy
    +
    +

    1 signa GPS pitch angle accuarcy in degrees.

    + +
    +
    + +

    ◆ baseline

    + +
    +
    + + + + +
    float _SbgLogGpsHdt::baseline
    +
    +

    The distance between the main and aux antenna in meters.

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/struct___sbg_log_gps_pos.html b/doc/html/struct___sbg_log_gps_pos.html new file mode 100644 index 0000000..312d902 --- /dev/null +++ b/doc/html/struct___sbg_log_gps_pos.html @@ -0,0 +1,286 @@ + + + + + + + +sbgECom: _SbgLogGpsPos Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgLogGpsPos Struct Reference
    +
    +
    + +

    #include <sbgEComBinaryLogGps.h>

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    +Data Fields

    uint32_t timeStamp
     
    uint32_t status
     
    uint32_t timeOfWeek
     
    double latitude
     
    double longitude
     
    double altitude
     
    float undulation
     
    float latitudeAccuracy
     
    float longitudeAccuracy
     
    float altitudeAccuracy
     
    uint8_t numSvUsed
     
    uint16_t baseStationId
     
    uint16_t differentialAge
     
    +

    Detailed Description

    +

    Structure that stores data for the SBG_ECOM_LOG_GPS::_POS message.

    +

    Field Documentation

    + +

    ◆ timeStamp

    + +
    +
    + + + + +
    uint32_t _SbgLogGpsPos::timeStamp
    +
    +

    Time in us since the sensor power up.

    + +
    +
    + +

    ◆ status

    + +
    +
    + + + + +
    uint32_t _SbgLogGpsPos::status
    +
    +

    GPS position status, type and bitmask.

    + +
    +
    + +

    ◆ timeOfWeek

    + +
    +
    + + + + +
    uint32_t _SbgLogGpsPos::timeOfWeek
    +
    +

    GPS time of week in ms.

    + +
    +
    + +

    ◆ latitude

    + +
    +
    + + + + +
    double _SbgLogGpsPos::latitude
    +
    +

    Latitude in degrees, positive north.

    + +
    +
    + +

    ◆ longitude

    + +
    +
    + + + + +
    double _SbgLogGpsPos::longitude
    +
    +

    Longitude in degrees, positive east.

    + +
    +
    + +

    ◆ altitude

    + +
    +
    + + + + +
    double _SbgLogGpsPos::altitude
    +
    +

    Altitude above Mean Sea Level in meters.

    + +
    +
    + +

    ◆ undulation

    + +
    +
    + + + + +
    float _SbgLogGpsPos::undulation
    +
    +

    Altitude difference between the geoid and the Ellipsoid in meters (Height above Ellipsoid = altitude + undulation).

    + +
    +
    + +

    ◆ latitudeAccuracy

    + +
    +
    + + + + +
    float _SbgLogGpsPos::latitudeAccuracy
    +
    +

    1 sigma latitude accuracy in meters.

    + +
    +
    + +

    ◆ longitudeAccuracy

    + +
    +
    + + + + +
    float _SbgLogGpsPos::longitudeAccuracy
    +
    +

    1 sigma longitude accuracy in meters.

    + +
    +
    + +

    ◆ altitudeAccuracy

    + +
    +
    + + + + +
    float _SbgLogGpsPos::altitudeAccuracy
    +
    +

    1 sigma altitude accuracy in meters.

    + +
    +
    + +

    ◆ numSvUsed

    + +
    +
    + + + + +
    uint8_t _SbgLogGpsPos::numSvUsed
    +
    +

    Number of space vehicles used to compute the solution (since version 1.4).

    + +
    +
    + +

    ◆ baseStationId

    + +
    +
    + + + + +
    uint16_t _SbgLogGpsPos::baseStationId
    +
    +

    Base station id for differential corrections (0-4095). Set to 0xFFFF if differential corrections are not used (since version 1.4).

    + +
    +
    + +

    ◆ differentialAge

    + +
    +
    + + + + +
    uint16_t _SbgLogGpsPos::differentialAge
    +
    +

    Differential correction age in 0.01 seconds. Set to 0XFFFF if differential corrections are not used (since version 1.4).

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/struct___sbg_log_gps_vel.html b/doc/html/struct___sbg_log_gps_vel.html new file mode 100644 index 0000000..0c1ef5a --- /dev/null +++ b/doc/html/struct___sbg_log_gps_vel.html @@ -0,0 +1,184 @@ + + + + + + + +sbgECom: _SbgLogGpsVel Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgLogGpsVel Struct Reference
    +
    +
    + +

    #include <sbgEComBinaryLogGps.h>

    + + + + + + + + + + + + + + + + +

    +Data Fields

    uint32_t timeStamp
     
    uint32_t status
     
    uint32_t timeOfWeek
     
    float velocity [3]
     
    float velocityAcc [3]
     
    float course
     
    float courseAcc
     
    +

    Detailed Description

    +

    Structure that stores data for the SBG_ECOM_LOG_GPS::_VEL message.

    +

    Field Documentation

    + +

    ◆ timeStamp

    + +
    +
    + + + + +
    uint32_t _SbgLogGpsVel::timeStamp
    +
    +

    Time in us since the sensor power up.

    + +
    +
    + +

    ◆ status

    + +
    +
    + + + + +
    uint32_t _SbgLogGpsVel::status
    +
    +

    GPS velocity status, type and bitmask.

    + +
    +
    + +

    ◆ timeOfWeek

    + +
    +
    + + + + +
    uint32_t _SbgLogGpsVel::timeOfWeek
    +
    +

    GPS time of week in ms.

    + +
    +
    + +

    ◆ velocity

    + +
    +
    + + + + +
    float _SbgLogGpsVel::velocity[3]
    +
    +

    GPS North, East, Down velocity in m.s^-1.

    + +
    +
    + +

    ◆ velocityAcc

    + +
    +
    + + + + +
    float _SbgLogGpsVel::velocityAcc[3]
    +
    +

    GPS North, East, Down velocity 1 sigma accuracy in m.s^-1.

    + +
    +
    + +

    ◆ course

    + +
    +
    + + + + +
    float _SbgLogGpsVel::course
    +
    +

    Track ground course in degrees.

    + +
    +
    + +

    ◆ courseAcc

    + +
    +
    + + + + +
    float _SbgLogGpsVel::courseAcc
    +
    +

    Course accuracy in degrees.

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/struct___sbg_log_imu_data.html b/doc/html/struct___sbg_log_imu_data.html new file mode 100644 index 0000000..315e19b --- /dev/null +++ b/doc/html/struct___sbg_log_imu_data.html @@ -0,0 +1,184 @@ + + + + + + + +sbgECom: _SbgLogImuData Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgLogImuData Struct Reference
    +
    +
    + +

    #include <sbgEComBinaryLogImu.h>

    + + + + + + + + + + + + + + + + +

    +Data Fields

    uint32_t timeStamp
     
    uint16_t status
     
    float accelerometers [3]
     
    float gyroscopes [3]
     
    float temperature
     
    float deltaVelocity [3]
     
    float deltaAngle [3]
     
    +

    Detailed Description

    +

    Structure that stores data for the SBG_ECOM_LOG_IMU_DATA message.

    +

    Field Documentation

    + +

    ◆ timeStamp

    + +
    +
    + + + + +
    uint32_t _SbgLogImuData::timeStamp
    +
    +

    Time in us since the sensor power up.

    + +
    +
    + +

    ◆ status

    + +
    +
    + + + + +
    uint16_t _SbgLogImuData::status
    +
    +

    IMU status bitmask.

    + +
    +
    + +

    ◆ accelerometers

    + +
    +
    + + + + +
    float _SbgLogImuData::accelerometers[3]
    +
    +

    X, Y, Z accelerometers in m.s^-2.

    + +
    +
    + +

    ◆ gyroscopes

    + +
    +
    + + + + +
    float _SbgLogImuData::gyroscopes[3]
    +
    +

    X, Y, Z gyroscopes in rad.s^-1.

    + +
    +
    + +

    ◆ temperature

    + +
    +
    + + + + +
    float _SbgLogImuData::temperature
    +
    +

    Internal temperature in °C.

    + +
    +
    + +

    ◆ deltaVelocity

    + +
    +
    + + + + +
    float _SbgLogImuData::deltaVelocity[3]
    +
    +

    X, Y, Z delta velocity in m.s^-2.

    + +
    +
    + +

    ◆ deltaAngle

    + +
    +
    + + + + +
    float _SbgLogImuData::deltaAngle[3]
    +
    +

    X, Y, Z delta angle in rad.s^-1.

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/struct___sbg_log_imu_short.html b/doc/html/struct___sbg_log_imu_short.html new file mode 100644 index 0000000..c0ec11f --- /dev/null +++ b/doc/html/struct___sbg_log_imu_short.html @@ -0,0 +1,150 @@ + + + + + + + +sbgECom: _SbgLogImuShort Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgLogImuShort Struct Reference
    +
    +
    + +

    #include <sbgEComBinaryLogImu.h>

    + + + + + + + + + + + + +

    +Data Fields

    uint32_t timeStamp
     
    uint16_t status
     
    int32_t deltaVelocity [3]
     
    int32_t deltaAngle [3]
     
    int16_t temperature
     
    +

    Detailed Description

    +

    Structure that stores data for the SBG_ECOM_LOG_IMU_SHORT message. This message is only sent asynchronously and is the preferred log for post processing.

    +

    Field Documentation

    + +

    ◆ timeStamp

    + +
    +
    + + + + +
    uint32_t _SbgLogImuShort::timeStamp
    +
    +

    Time in us since the sensor power up.

    + +
    +
    + +

    ◆ status

    + +
    +
    + + + + +
    uint16_t _SbgLogImuShort::status
    +
    +

    IMU status bitmask.

    + +
    +
    + +

    ◆ deltaVelocity

    + +
    +
    + + + + +
    int32_t _SbgLogImuShort::deltaVelocity[3]
    +
    +

    X, Y, Z delta velocity. Unit is 1048576 LSB for 1 m.s^-2.

    + +
    +
    + +

    ◆ deltaAngle

    + +
    +
    + + + + +
    int32_t _SbgLogImuShort::deltaAngle[3]
    +
    +

    X, Y, Z delta angle. Unit is 67108864 LSB for 1 rad.s^-1.

    + +
    +
    + +

    ◆ temperature

    + +
    +
    + + + + +
    int16_t _SbgLogImuShort::temperature
    +
    +

    IMU average temperature. Unit is 256 LSB for 1°C.

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/struct___sbg_log_mag.html b/doc/html/struct___sbg_log_mag.html new file mode 100644 index 0000000..f7b14b2 --- /dev/null +++ b/doc/html/struct___sbg_log_mag.html @@ -0,0 +1,133 @@ + + + + + + + +sbgECom: _SbgLogMag Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgLogMag Struct Reference
    +
    +
    + +

    #include <sbgEComBinaryLogMag.h>

    + + + + + + + + + + +

    +Data Fields

    uint32_t timeStamp
     
    uint16_t status
     
    float magnetometers [3]
     
    float accelerometers [3]
     
    +

    Detailed Description

    +

    Structure that stores data for the SBG_ECOM_LOG_MAG message.

    +

    Field Documentation

    + +

    ◆ timeStamp

    + +
    +
    + + + + +
    uint32_t _SbgLogMag::timeStamp
    +
    +

    Time in us since the sensor power up.

    + +
    +
    + +

    ◆ status

    + +
    +
    + + + + +
    uint16_t _SbgLogMag::status
    +
    +

    Magnetometer status bitmask.

    + +
    +
    + +

    ◆ magnetometers

    + +
    +
    + + + + +
    float _SbgLogMag::magnetometers[3]
    +
    +

    X, Y, Z magnetometer data in A.U.

    + +
    +
    + +

    ◆ accelerometers

    + +
    +
    + + + + +
    float _SbgLogMag::accelerometers[3]
    +
    +

    X, Y, Z accelerometers in m.s^-2.

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/struct___sbg_log_mag_calib.html b/doc/html/struct___sbg_log_mag_calib.html new file mode 100644 index 0000000..993ff44 --- /dev/null +++ b/doc/html/struct___sbg_log_mag_calib.html @@ -0,0 +1,116 @@ + + + + + + + +sbgECom: _SbgLogMagCalib Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgLogMagCalib Struct Reference
    +
    +
    + +

    #include <sbgEComBinaryLogMag.h>

    + + + + + + + + +

    +Data Fields

    uint32_t timeStamp
     
    uint16_t reserved
     
    uint8_t magData [16]
     
    +

    Detailed Description

    +

    Structure that stores data for the SBG_ECOM_LOG_MAG_CALIB message.

    +

    Field Documentation

    + +

    ◆ timeStamp

    + +
    +
    + + + + +
    uint32_t _SbgLogMagCalib::timeStamp
    +
    +

    Time in us since the sensor power up.

    + +
    +
    + +

    ◆ reserved

    + +
    +
    + + + + +
    uint16_t _SbgLogMagCalib::reserved
    +
    +

    Reserved for future use.

    + +
    +
    + +

    ◆ magData

    + +
    +
    + + + + +
    uint8_t _SbgLogMagCalib::magData[16]
    +
    +

    Magnetometers calibration data.

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/struct___sbg_log_odometer_data.html b/doc/html/struct___sbg_log_odometer_data.html new file mode 100644 index 0000000..8c95481 --- /dev/null +++ b/doc/html/struct___sbg_log_odometer_data.html @@ -0,0 +1,116 @@ + + + + + + + +sbgECom: _SbgLogOdometerData Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgLogOdometerData Struct Reference
    +
    +
    + +

    #include <sbgEComBinaryLogOdometer.h>

    + + + + + + + + +

    +Data Fields

    uint32_t timeStamp
     
    uint16_t status
     
    float velocity
     
    +

    Detailed Description

    +

    Log structure for odometer data.

    +

    Field Documentation

    + +

    ◆ timeStamp

    + +
    +
    + + + + +
    uint32_t _SbgLogOdometerData::timeStamp
    +
    +

    Time in us since the sensor power up.

    + +
    +
    + +

    ◆ status

    + +
    +
    + + + + +
    uint16_t _SbgLogOdometerData::status
    +
    +

    Odometer velocity status bitmask.

    + +
    +
    + +

    ◆ velocity

    + +
    +
    + + + + +
    float _SbgLogOdometerData::velocity
    +
    +

    Velocity in m.s^-1 in the odometer direction.

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/struct___sbg_log_raw_data.html b/doc/html/struct___sbg_log_raw_data.html new file mode 100644 index 0000000..327e25b --- /dev/null +++ b/doc/html/struct___sbg_log_raw_data.html @@ -0,0 +1,99 @@ + + + + + + + +sbgECom: _SbgLogRawData Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgLogRawData Struct Reference
    +
    +
    + +

    #include <sbgEComBinaryLogRawData.h>

    + + + + + + +

    +Data Fields

    uint8_t rawBuffer [SBG_ECOM_RAW_DATA_MAX_BUFFER_SIZE]
     
    size_t bufferSize
     
    +

    Detailed Description

    +

    Structure that stores raw data message.

    +

    Field Documentation

    + +

    ◆ rawBuffer

    + +
    +
    + + + + +
    uint8_t _SbgLogRawData::rawBuffer[SBG_ECOM_RAW_DATA_MAX_BUFFER_SIZE]
    +
    +

    Buffer that contains raw data.

    + +
    +
    + +

    ◆ bufferSize

    + +
    +
    + + + + +
    size_t _SbgLogRawData::bufferSize
    +
    +

    Raw buffer size in bytes.

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/struct___sbg_log_ship_motion_data.html b/doc/html/struct___sbg_log_ship_motion_data.html new file mode 100644 index 0000000..49f82a0 --- /dev/null +++ b/doc/html/struct___sbg_log_ship_motion_data.html @@ -0,0 +1,169 @@ + + + + + + + +sbgECom: _SbgLogShipMotionData Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgLogShipMotionData Struct Reference
    +
    +
    + +

    #include <sbgEComBinaryLogShipMotion.h>

    + + + + + + + + + + + + + + +

    +Data Fields

    uint32_t timeStamp
     
    uint16_t status
     
    float mainHeavePeriod
     
    float shipMotion [3]
     
    float shipAccel [3]
     
    float shipVel [3]
     
    +

    Detailed Description

    +

    Structure that stores data for the SBG_ECOM_LOG_SHIP_MOTION or SBG_ECOM_LOG_SHIP_MOTION_HP message.
    + The data are expressed in the standard NED Ekinox coordiante frame. Surge is positive forward, sway is positive right and heave is positive down.
    + Note that status flag should be read before using the different parameters because it will provide validity information about all included outputs. Some frames may not provide the heave period or surge/sway axes for example

    +

    Field Documentation

    + +

    ◆ timeStamp

    + +
    +
    + + + + +
    uint32_t _SbgLogShipMotionData::timeStamp
    +
    +

    Time in us since the sensor power up.

    + +
    +
    + +

    ◆ status

    + +
    +
    + + + + +
    uint16_t _SbgLogShipMotionData::status
    +
    +

    Ship Motion data status bitmask

    + +
    +
    + +

    ◆ mainHeavePeriod

    + +
    +
    + + + + +
    float _SbgLogShipMotionData::mainHeavePeriod
    +
    +

    Main heave period in seconds.

    + +
    +
    + +

    ◆ shipMotion

    + +
    +
    + + + + +
    float _SbgLogShipMotionData::shipMotion[3]
    +
    +

    Surge, sway and heave in meters.

    + +
    +
    + +

    ◆ shipAccel

    + +
    +
    + + + + +
    float _SbgLogShipMotionData::shipAccel[3]
    +
    +

    Surge, sway and heave ship Acceleration in m.s^-2.

    + +
    +
    + +

    ◆ shipVel

    + +
    +
    + + + + +
    float _SbgLogShipMotionData::shipVel[3]
    +
    +

    Surge, sway and heave velocities

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/struct___sbg_log_status_data.html b/doc/html/struct___sbg_log_status_data.html new file mode 100644 index 0000000..762bf7b --- /dev/null +++ b/doc/html/struct___sbg_log_status_data.html @@ -0,0 +1,201 @@ + + + + + + + +sbgECom: _SbgLogStatusData Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgLogStatusData Struct Reference
    +
    +
    + +

    #include <sbgEComBinaryLogStatus.h>

    + + + + + + + + + + + + + + + + + + +

    +Data Fields

    uint32_t timeStamp
     
    uint16_t generalStatus
     
    uint16_t reserved1
     
    uint32_t comStatus
     
    uint32_t aidingStatus
     
    uint32_t reserved2
     
    uint16_t reserved3
     
    uint32_t uptime
     
    +

    Detailed Description

    +

    Stores global status data.

    +

    Field Documentation

    + +

    ◆ timeStamp

    + +
    +
    + + + + +
    uint32_t _SbgLogStatusData::timeStamp
    +
    +

    Time in us since the sensor power up.

    + +
    +
    + +

    ◆ generalStatus

    + +
    +
    + + + + +
    uint16_t _SbgLogStatusData::generalStatus
    +
    +

    General status bitmask and enums.

    + +
    +
    + +

    ◆ reserved1

    + +
    +
    + + + + +
    uint16_t _SbgLogStatusData::reserved1
    +
    +

    Reserved status field for future use

    + +
    +
    + +

    ◆ comStatus

    + +
    +
    + + + + +
    uint32_t _SbgLogStatusData::comStatus
    +
    +

    Communication status bitmask and enums.

    + +
    +
    + +

    ◆ aidingStatus

    + +
    +
    + + + + +
    uint32_t _SbgLogStatusData::aidingStatus
    +
    +

    Aiding equipments status bitmask and enums.

    + +
    +
    + +

    ◆ reserved2

    + +
    +
    + + + + +
    uint32_t _SbgLogStatusData::reserved2
    +
    +

    Reserved status field for future use.

    + +
    +
    + +

    ◆ reserved3

    + +
    +
    + + + + +
    uint16_t _SbgLogStatusData::reserved3
    +
    +

    Reserved status field for future use.

    + +
    +
    + +

    ◆ uptime

    + +
    +
    + + + + +
    uint32_t _SbgLogStatusData::uptime
    +
    +

    System uptime in seconds.

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/struct___sbg_log_usbl_data.html b/doc/html/struct___sbg_log_usbl_data.html new file mode 100644 index 0000000..cec63c1 --- /dev/null +++ b/doc/html/struct___sbg_log_usbl_data.html @@ -0,0 +1,201 @@ + + + + + + + +sbgECom: _SbgLogUsblData Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgLogUsblData Struct Reference
    +
    +
    + +

    #include <sbgEComBinaryLogUsbl.h>

    + + + + + + + + + + + + + + + + + + +

    +Data Fields

    uint32_t timeStamp
     
    uint16_t status
     
    double latitude
     
    double longitude
     
    float depth
     
    float latitudeAccuracy
     
    float longitudeAccuracy
     
    float depthAccuracy
     
    +

    Detailed Description

    +

    Log structure for USBL data.

    +

    Field Documentation

    + +

    ◆ timeStamp

    + +
    +
    + + + + +
    uint32_t _SbgLogUsblData::timeStamp
    +
    +

    Time in us since the sensor power up.

    + +
    +
    + +

    ◆ status

    + +
    +
    + + + + +
    uint16_t _SbgLogUsblData::status
    +
    +

    USBL system status bitmask.

    + +
    +
    + +

    ◆ latitude

    + +
    +
    + + + + +
    double _SbgLogUsblData::latitude
    +
    +

    Latitude in degrees, positive north.

    + +
    +
    + +

    ◆ longitude

    + +
    +
    + + + + +
    double _SbgLogUsblData::longitude
    +
    +

    Longitude in degrees, positive east.

    + +
    +
    + +

    ◆ depth

    + +
    +
    + + + + +
    float _SbgLogUsblData::depth
    +
    +

    Depth in meters below mean sea level (positive down).

    + +
    +
    + +

    ◆ latitudeAccuracy

    + +
    +
    + + + + +
    float _SbgLogUsblData::latitudeAccuracy
    +
    +

    1 sigma latitude accuracy in meters.

    + +
    +
    + +

    ◆ longitudeAccuracy

    + +
    +
    + + + + +
    float _SbgLogUsblData::longitudeAccuracy
    +
    +

    1 sigma longitude accuracy in meters.

    + +
    +
    + +

    ◆ depthAccuracy

    + +
    +
    + + + + +
    float _SbgLogUsblData::depthAccuracy
    +
    +

    1 sigma depth accuracy in meters.

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/struct___sbg_log_utc_data.html b/doc/html/struct___sbg_log_utc_data.html new file mode 100644 index 0000000..1b92b85 --- /dev/null +++ b/doc/html/struct___sbg_log_utc_data.html @@ -0,0 +1,235 @@ + + + + + + + +sbgECom: _SbgLogUtcData Struct Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgLogUtcData Struct Reference
    +
    +
    + +

    #include <sbgEComBinaryLogUtc.h>

    + + + + + + + + + + + + + + + + + + + + + + +

    +Data Fields

    uint32_t timeStamp
     
    uint16_t status
     
    uint16_t year
     
    int8_t month
     
    int8_t day
     
    int8_t hour
     
    int8_t minute
     
    int8_t second
     
    int32_t nanoSecond
     
    uint32_t gpsTimeOfWeek
     
    +

    Detailed Description

    +

    Structure that stores data for the SBG_ECOM_LOG_UTC_TIME message.

    +

    Field Documentation

    + +

    ◆ timeStamp

    + +
    +
    + + + + +
    uint32_t _SbgLogUtcData::timeStamp
    +
    +

    Time in us since the sensor power up.

    + +
    +
    + +

    ◆ status

    + +
    +
    + + + + +
    uint16_t _SbgLogUtcData::status
    +
    +

    UTC time and clock status information

    + +
    +
    + +

    ◆ year

    + +
    +
    + + + + +
    uint16_t _SbgLogUtcData::year
    +
    +

    Year for example: 2013.

    + +
    +
    + +

    ◆ month

    + +
    +
    + + + + +
    int8_t _SbgLogUtcData::month
    +
    +

    Month in year [1 .. 12].

    + +
    +
    + +

    ◆ day

    + +
    +
    + + + + +
    int8_t _SbgLogUtcData::day
    +
    +

    Day in month [1 .. 31].

    + +
    +
    + +

    ◆ hour

    + +
    +
    + + + + +
    int8_t _SbgLogUtcData::hour
    +
    +

    Hour in day [0 .. 23].

    + +
    +
    + +

    ◆ minute

    + +
    +
    + + + + +
    int8_t _SbgLogUtcData::minute
    +
    +

    Minute in hour [0 .. 59].

    + +
    +
    + +

    ◆ second

    + +
    +
    + + + + +
    int8_t _SbgLogUtcData::second
    +
    +

    Second in minute [0 .. 60]. (60 is used only when a leap second is added)

    + +
    +
    + +

    ◆ nanoSecond

    + +
    +
    + + + + +
    int32_t _SbgLogUtcData::nanoSecond
    +
    +

    Nanosecond of current second in ns.

    + +
    +
    + +

    ◆ gpsTimeOfWeek

    + +
    +
    + + + + +
    uint32_t _SbgLogUtcData::gpsTimeOfWeek
    +
    +

    GPS time of week in ms.

    + +
    +
    +
    The documentation for this struct was generated from the following file: +
    + + + + diff --git a/doc/html/sync_off.png b/doc/html/sync_off.png new file mode 100644 index 0000000..3b443fc Binary files /dev/null and b/doc/html/sync_off.png differ diff --git a/doc/html/sync_on.png b/doc/html/sync_on.png new file mode 100644 index 0000000..e08320f Binary files /dev/null and b/doc/html/sync_on.png differ diff --git a/doc/html/tab_a.png b/doc/html/tab_a.png new file mode 100644 index 0000000..3b725c4 Binary files /dev/null and b/doc/html/tab_a.png differ diff --git a/doc/html/tab_b.png b/doc/html/tab_b.png new file mode 100644 index 0000000..e2b4a86 Binary files /dev/null and b/doc/html/tab_b.png differ diff --git a/doc/html/tab_h.png b/doc/html/tab_h.png new file mode 100644 index 0000000..fd5cb70 Binary files /dev/null and b/doc/html/tab_h.png differ diff --git a/doc/html/tab_s.png b/doc/html/tab_s.png new file mode 100644 index 0000000..ab478c9 Binary files /dev/null and b/doc/html/tab_s.png differ diff --git a/doc/html/tabs.css b/doc/html/tabs.css new file mode 100644 index 0000000..00d1c60 --- /dev/null +++ b/doc/html/tabs.css @@ -0,0 +1 @@ +.sm{position:relative;z-index:9999}.sm,.sm ul,.sm li{display:block;list-style:none;margin:0;padding:0;line-height:normal;direction:ltr;text-align:left;-webkit-tap-highlight-color:rgba(0,0,0,0)}.sm-rtl,.sm-rtl ul,.sm-rtl li{direction:rtl;text-align:right}.sm>li>h1,.sm>li>h2,.sm>li>h3,.sm>li>h4,.sm>li>h5,.sm>li>h6{margin:0;padding:0}.sm ul{display:none}.sm li,.sm a{position:relative}.sm a{display:block}.sm a.disabled{cursor:not-allowed}.sm:after{content:"\00a0";display:block;height:0;font:0/0 serif;clear:both;visibility:hidden;overflow:hidden}.sm,.sm *,.sm *:before,.sm *:after{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.main-menu-btn{position:relative;display:inline-block;width:36px;height:36px;text-indent:36px;margin-left:8px;white-space:nowrap;overflow:hidden;cursor:pointer;-webkit-tap-highlight-color:rgba(0,0,0,0)}.main-menu-btn-icon,.main-menu-btn-icon:before,.main-menu-btn-icon:after{position:absolute;top:50%;left:2px;height:2px;width:24px;background:#666;-webkit-transition:all .25s;transition:all .25s}.main-menu-btn-icon:before{content:'';top:-7px;left:0}.main-menu-btn-icon:after{content:'';top:7px;left:0}#main-menu-state:checked ~ .main-menu-btn .main-menu-btn-icon{height:0}#main-menu-state:checked ~ .main-menu-btn .main-menu-btn-icon:before{top:0;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}#main-menu-state:checked ~ .main-menu-btn .main-menu-btn-icon:after{top:0;-webkit-transform:rotate(45deg);transform:rotate(45deg)}#main-menu-state{position:absolute;width:1px;height:1px;margin:-1px;border:0;padding:0;overflow:hidden;clip:rect(1px,1px,1px,1px)}#main-menu-state:not(:checked) ~ #main-menu{display:none}#main-menu-state:checked ~ #main-menu{display:block}@media(min-width:768px){.main-menu-btn{position:absolute;top:-99999px}#main-menu-state:not(:checked) ~ #main-menu{display:block}}.sm-dox{background-image:url("tab_b.png")}.sm-dox a,.sm-dox a:focus,.sm-dox a:hover,.sm-dox a:active{padding:0 12px;padding-right:43px;font-family:"Lucida Grande","Geneva","Helvetica",Arial,sans-serif;font-size:13px;font-weight:bold;line-height:36px;text-decoration:none;text-shadow:0 1px 1px rgba(255,255,255,0.9);color:#283a5d;outline:0}.sm-dox a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox a.current{color:#d23600}.sm-dox a.disabled{color:#bbb}.sm-dox a span.sub-arrow{position:absolute;top:50%;margin-top:-14px;left:auto;right:3px;width:28px;height:28px;overflow:hidden;font:bold 12px/28px monospace !important;text-align:center;text-shadow:none;background:rgba(255,255,255,0.5);-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}.sm-dox a span.sub-arrow:before{display:block;content:'+'}.sm-dox a.highlighted span.sub-arrow:before{display:block;content:'-'}.sm-dox>li:first-child>a,.sm-dox>li:first-child>:not(ul) a{-moz-border-radius:5px 5px 0 0;-webkit-border-radius:5px;border-radius:5px 5px 0 0}.sm-dox>li:last-child>a,.sm-dox>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul{-moz-border-radius:0 0 5px 5px;-webkit-border-radius:0;border-radius:0 0 5px 5px}.sm-dox>li:last-child>a.highlighted,.sm-dox>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0}.sm-dox ul{background:rgba(162,162,162,0.1)}.sm-dox ul a,.sm-dox ul a:focus,.sm-dox ul a:hover,.sm-dox ul a:active{font-size:12px;border-left:8px solid transparent;line-height:36px;text-shadow:none;background-color:white;background-image:none}.sm-dox ul a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox ul ul a,.sm-dox ul ul a:hover,.sm-dox ul ul a:focus,.sm-dox ul ul a:active{border-left:16px solid transparent}.sm-dox ul ul ul a,.sm-dox ul ul ul a:hover,.sm-dox ul ul ul a:focus,.sm-dox ul ul ul a:active{border-left:24px solid transparent}.sm-dox ul ul ul ul a,.sm-dox ul ul ul ul a:hover,.sm-dox ul ul ul ul a:focus,.sm-dox ul ul ul ul a:active{border-left:32px solid transparent}.sm-dox ul ul ul ul ul a,.sm-dox ul ul ul ul ul a:hover,.sm-dox ul ul ul ul ul a:focus,.sm-dox ul ul ul ul ul a:active{border-left:40px solid transparent}@media(min-width:768px){.sm-dox ul{position:absolute;width:12em}.sm-dox li{float:left}.sm-dox.sm-rtl li{float:right}.sm-dox ul li,.sm-dox.sm-rtl ul li,.sm-dox.sm-vertical li{float:none}.sm-dox a{white-space:nowrap}.sm-dox ul a,.sm-dox.sm-vertical a{white-space:normal}.sm-dox .sm-nowrap>li>a,.sm-dox .sm-nowrap>li>:not(ul) a{white-space:nowrap}.sm-dox{padding:0 10px;background-image:url("tab_b.png");line-height:36px}.sm-dox a span.sub-arrow{top:50%;margin-top:-2px;right:12px;width:0;height:0;border-width:4px;border-style:solid dashed dashed dashed;border-color:#283a5d transparent transparent transparent;background:transparent;-moz-border-radius:0;-webkit-border-radius:0;border-radius:0}.sm-dox a,.sm-dox a:focus,.sm-dox a:active,.sm-dox a:hover,.sm-dox a.highlighted{padding:0 12px;background-image:url("tab_s.png");background-repeat:no-repeat;background-position:right;-moz-border-radius:0 !important;-webkit-border-radius:0;border-radius:0 !important}.sm-dox a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox a:hover span.sub-arrow{border-color:white transparent transparent transparent}.sm-dox a.has-submenu{padding-right:24px}.sm-dox li{border-top:0}.sm-dox>li>ul:before,.sm-dox>li>ul:after{content:'';position:absolute;top:-18px;left:30px;width:0;height:0;overflow:hidden;border-width:9px;border-style:dashed dashed solid dashed;border-color:transparent transparent #bbb transparent}.sm-dox>li>ul:after{top:-16px;left:31px;border-width:8px;border-color:transparent transparent #fff transparent}.sm-dox ul{border:1px solid #bbb;padding:5px 0;background:#fff;-moz-border-radius:5px !important;-webkit-border-radius:5px;border-radius:5px !important;-moz-box-shadow:0 5px 9px rgba(0,0,0,0.2);-webkit-box-shadow:0 5px 9px rgba(0,0,0,0.2);box-shadow:0 5px 9px rgba(0,0,0,0.2)}.sm-dox ul a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-color:transparent transparent transparent #555;border-style:dashed dashed dashed solid}.sm-dox ul a,.sm-dox ul a:hover,.sm-dox ul a:focus,.sm-dox ul a:active,.sm-dox ul a.highlighted{color:#555;background-image:none;border:0 !important;color:#555;background-image:none}.sm-dox ul a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox ul a:hover span.sub-arrow{border-color:transparent transparent transparent white}.sm-dox span.scroll-up,.sm-dox span.scroll-down{position:absolute;display:none;visibility:hidden;overflow:hidden;background:#fff;height:36px}.sm-dox span.scroll-up:hover,.sm-dox span.scroll-down:hover{background:#eee}.sm-dox span.scroll-up:hover span.scroll-up-arrow,.sm-dox span.scroll-up:hover span.scroll-down-arrow{border-color:transparent transparent #d23600 transparent}.sm-dox span.scroll-down:hover span.scroll-down-arrow{border-color:#d23600 transparent transparent transparent}.sm-dox span.scroll-up-arrow,.sm-dox span.scroll-down-arrow{position:absolute;top:0;left:50%;margin-left:-6px;width:0;height:0;overflow:hidden;border-width:6px;border-style:dashed dashed solid dashed;border-color:transparent transparent #555 transparent}.sm-dox span.scroll-down-arrow{top:8px;border-style:solid dashed dashed dashed;border-color:#555 transparent transparent transparent}.sm-dox.sm-rtl a.has-submenu{padding-right:12px;padding-left:24px}.sm-dox.sm-rtl a span.sub-arrow{right:auto;left:12px}.sm-dox.sm-rtl.sm-vertical a.has-submenu{padding:10px 20px}.sm-dox.sm-rtl.sm-vertical a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-rtl>li>ul:before{left:auto;right:30px}.sm-dox.sm-rtl>li>ul:after{left:auto;right:31px}.sm-dox.sm-rtl ul a.has-submenu{padding:10px 20px !important}.sm-dox.sm-rtl ul a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-vertical{padding:10px 0;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}.sm-dox.sm-vertical a{padding:10px 20px}.sm-dox.sm-vertical a:hover,.sm-dox.sm-vertical a:focus,.sm-dox.sm-vertical a:active,.sm-dox.sm-vertical a.highlighted{background:#fff}.sm-dox.sm-vertical a.disabled{background-image:url("tab_b.png")}.sm-dox.sm-vertical a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-style:dashed dashed dashed solid;border-color:transparent transparent transparent #555}.sm-dox.sm-vertical>li>ul:before,.sm-dox.sm-vertical>li>ul:after{display:none}.sm-dox.sm-vertical ul a{padding:10px 20px}.sm-dox.sm-vertical ul a:hover,.sm-dox.sm-vertical ul a:focus,.sm-dox.sm-vertical ul a:active,.sm-dox.sm-vertical ul a.highlighted{background:#eee}.sm-dox.sm-vertical ul a.disabled{background:#fff}} \ No newline at end of file diff --git a/doc/html/union___sbg_binary_log_data.html b/doc/html/union___sbg_binary_log_data.html new file mode 100644 index 0000000..edc79cc --- /dev/null +++ b/doc/html/union___sbg_binary_log_data.html @@ -0,0 +1,456 @@ + + + + + + + +sbgECom: _SbgBinaryLogData Union Reference + + + + + + +
    +
    + + + + + + +
    +
    sbgECom 3.1.2358-stable +
    +
    +
    + + + + + + +
    +
    + +
    _SbgBinaryLogData Union Reference
    +
    +
    + +

    #include <sbgEComBinaryLogs.h>

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    +Data Fields

    SbgLogStatusData statusData
     
    SbgLogImuData imuData
     
    SbgLogImuShort imuShort
     
    SbgLogEkfEulerData ekfEulerData
     
    SbgLogEkfQuatData ekfQuatData
     
    SbgLogEkfNavData ekfNavData
     
    SbgLogShipMotionData shipMotionData
     
    SbgLogOdometerData odometerData
     
    SbgLogUtcData utcData
     
    SbgLogGpsPos gpsPosData
     
    SbgLogGpsVel gpsVelData
     
    SbgLogGpsHdt gpsHdtData
     
    SbgLogRawData gpsRawData
     
    SbgLogRawData rtcmRawData
     
    SbgLogMag magData
     
    SbgLogMagCalib magCalibData
     
    SbgLogDvlData dvlData
     
    SbgLogAirData airData
     
    SbgLogUsblData usblData
     
    SbgLogDepth depthData
     
    SbgLogEvent eventMarker
     
    SbgLogDiagData diagData
     
    SbgLogFastImuData fastImuData
     
    +

    Detailed Description

    +

    Union used to store received logs data.

    +

    Field Documentation

    + +

    ◆ statusData

    + +
    +
    + + + + +
    SbgLogStatusData _SbgBinaryLogData::statusData
    +
    +

    Stores data for the SBG_ECOM_LOG_STATUS message.

    + +
    +
    + +

    ◆ imuData

    + +
    +
    + + + + +
    SbgLogImuData _SbgBinaryLogData::imuData
    +
    +

    Stores data for the SBG_ECOM_LOG_IMU_DATA message.

    + +
    +
    + +

    ◆ imuShort

    + +
    +
    + + + + +
    SbgLogImuShort _SbgBinaryLogData::imuShort
    +
    +

    Stores data for the SBG_ECOM_LOG_IMU_SHORT message.

    + +
    +
    + +

    ◆ ekfEulerData

    + +
    +
    + + + + +
    SbgLogEkfEulerData _SbgBinaryLogData::ekfEulerData
    +
    +

    Stores data for the SBG_ECOM_LOG_EKF_EULER message.

    + +
    +
    + +

    ◆ ekfQuatData

    + +
    +
    + + + + +
    SbgLogEkfQuatData _SbgBinaryLogData::ekfQuatData
    +
    +

    Stores data for the SBG_ECOM_LOG_EKF_QUAT message.

    + +
    +
    + +

    ◆ ekfNavData

    + +
    +
    + + + + +
    SbgLogEkfNavData _SbgBinaryLogData::ekfNavData
    +
    +

    Stores data for the SBG_ECOM_LOG_EKF_NAV message.

    + +
    +
    + +

    ◆ shipMotionData

    + +
    +
    + + + + +
    SbgLogShipMotionData _SbgBinaryLogData::shipMotionData
    +
    +

    Stores data for the SBG_ECOM_LOG_SHIP_MOTION or SBG_ECOM_LOG_SHIP_MOTION_HP message.

    + +
    +
    + +

    ◆ odometerData

    + +
    +
    + + + + +
    SbgLogOdometerData _SbgBinaryLogData::odometerData
    +
    +

    Stores data for the SBG_ECOM_LOG_ODO_VEL message.

    + +
    +
    + +

    ◆ utcData

    + +
    +
    + + + + +
    SbgLogUtcData _SbgBinaryLogData::utcData
    +
    +

    Stores data for the SBG_ECOM_LOG_UTC_TIME message.

    + +
    +
    + +

    ◆ gpsPosData

    + +
    +
    + + + + +
    SbgLogGpsPos _SbgBinaryLogData::gpsPosData
    +
    +

    Stores data for the SBG_ECOM_LOG_GPS_POS message.

    + +
    +
    + +

    ◆ gpsVelData

    + +
    +
    + + + + +
    SbgLogGpsVel _SbgBinaryLogData::gpsVelData
    +
    +

    Stores data for the SBG_ECOM_LOG_GPS::_VEL message.

    + +
    +
    + +

    ◆ gpsHdtData

    + +
    +
    + + + + +
    SbgLogGpsHdt _SbgBinaryLogData::gpsHdtData
    +
    +

    Stores data for the SBG_ECOM_LOG_GPS::_HDT message.

    + +
    +
    + +

    ◆ gpsRawData

    + +
    +
    + + + + +
    SbgLogRawData _SbgBinaryLogData::gpsRawData
    +
    +

    Stores data for the SBG_ECOM_LOG_GPS::_RAW message.

    + +
    +
    + +

    ◆ rtcmRawData

    + +
    +
    + + + + +
    SbgLogRawData _SbgBinaryLogData::rtcmRawData
    +
    +

    Stores data for the SBG_ECOM_LOG_RTCM_RAW message.

    + +
    +
    + +

    ◆ magData

    + +
    +
    + + + + +
    SbgLogMag _SbgBinaryLogData::magData
    +
    +

    Stores data for the SBG_ECOM_LOG_MAG message.

    + +
    +
    + +

    ◆ magCalibData

    + +
    +
    + + + + +
    SbgLogMagCalib _SbgBinaryLogData::magCalibData
    +
    +

    Stores data for the SBG_ECOM_LOG_MAG_CALIB message.

    + +
    +
    + +

    ◆ dvlData

    + +
    +
    + + + + +
    SbgLogDvlData _SbgBinaryLogData::dvlData
    +
    +

    Stores data for the SBG_ECOM_LOG_DVL_BOTTOM_TRACK message.

    + +
    +
    + +

    ◆ airData

    + +
    +
    + + + + +
    SbgLogAirData _SbgBinaryLogData::airData
    +
    +

    Stores data for the SBG_ECOM_LOG_AIR_DATA message.

    + +
    +
    + +

    ◆ usblData

    + +
    +
    + + + + +
    SbgLogUsblData _SbgBinaryLogData::usblData
    +
    +

    Stores data for the SBG_ECOM_LOG_USBL message.

    + +
    +
    + +

    ◆ depthData

    + +
    +
    + + + + +
    SbgLogDepth _SbgBinaryLogData::depthData
    +
    +

    Stores data for the SBG_ECOM_LOG_DEPTH message

    + +
    +
    + +

    ◆ eventMarker

    + +
    +
    + + + + +
    SbgLogEvent _SbgBinaryLogData::eventMarker
    +
    +

    Stores data for the SBG_ECOM_LOG_EVENT_# message.

    + +
    +
    + +

    ◆ diagData

    + +
    +
    + + + + +
    SbgLogDiagData _SbgBinaryLogData::diagData
    +
    +

    Stores data for the SBG_ECOM_LOG_DIAG message.

    + +
    +
    + +

    ◆ fastImuData

    + +
    +
    + + + + +
    SbgLogFastImuData _SbgBinaryLogData::fastImuData
    +
    +

    Stores Fast Imu Data for 1KHz output

    + +
    +
    +
    The documentation for this union was generated from the following file: +
    + + + + diff --git a/examples/airDataInput/src/airDataInput.c b/examples/airDataInput/src/airDataInput.c new file mode 100644 index 0000000..9c7fdbd --- /dev/null +++ b/examples/airDataInput/src/airDataInput.c @@ -0,0 +1,263 @@ +/*! + * \file ellipseMinimal.c + * \author SBG Systems + * \date 28/03/2014 + * + * \brief Send AirData aiding mesurements to an ELLIPSE and read back data + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +// sbgCommonLib headers +#include + +// sbgECom headers +#include + +//----------------------------------------------------------------------// +//- Private methids -// +//----------------------------------------------------------------------// + +/*! + * Generate a random float number between min and max. + * + * \param[in] randMin Minimum random value to generate. + * \param[in] randMax Maximum random value to generate. + * \return Float randome value between min and max. + */ +static float airDataInputRandFloat(float randMin, float randMax) +{ + assert(randMin <= randMax); + + if (randMin == randMax) + { + return randMin; + } + else + { + return (randMax - randMin) * ((float)rand() / RAND_MAX) + randMin; + } +} + +/*! + * Send an AirData packet to the device with random values. + * + * \param[in] pHandle SbgECom handle + * \return SBG_NO_ERROR if the packet has been sent successfully. + */ +static SbgErrorCode airDataInputSendOneLog(SbgEComHandle *pHandle) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgLogAirData airDataLog; + uint8_t outputBuffer[64]; + SbgStreamBuffer outputStream; + + assert(pHandle); + + // + // Create a random AirData struct + // + memset(&airDataLog, 0x00, sizeof(airDataLog)); + + // + // We consider a fixed delay of 10 ms + // + airDataLog.timeStamp = 10000; + airDataLog.status |= SBG_ECOM_AIR_DATA_TIME_IS_DELAY; + + // + // We create a random altitude between 0 to 8000 meters + // + airDataLog.altitude = airDataInputRandFloat(0.0f, 8000.0f); + airDataLog.status |= SBG_ECOM_AIR_DATA_ALTITUDE_VALID; + + // + // We create a random airspeed between 0 to 12 m.s^-1 + // + airDataLog.trueAirspeed = airDataInputRandFloat(0.0f, 12.0f); + airDataLog.status |= SBG_ECOM_AIR_DATA_AIRPSEED_VALID; + + // + // Write the payload + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + + errorCode = sbgEComBinaryLogWriteAirData(&outputStream, &airDataLog); + + if (errorCode == SBG_NO_ERROR) + { + // + // Send the sbgECom log to the device + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_AIR_DATA, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + if (errorCode != SBG_NO_ERROR) + { + SBG_LOG_ERROR(errorCode, "Unable to send the AirData log"); + } + } + else + { + SBG_LOG_ERROR(errorCode, "Unable to write the AirData payload."); + } + + return errorCode; +} + +/*! + * Execute the airDataInput example given an opened and valid interface. + * + * \param[in] pInterface Interface used to communicate with the device. + * \return SBG_NO_ERROR if successful. + */ +static SbgErrorCode airDataInputProcess(SbgInterface *pInterface) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComHandle comHandle; + + assert(pInterface); + + // + // Create the sbgECom library and associate it with the created interfaces + // + errorCode = sbgEComInit(&comHandle, pInterface); + + // + // Test that the sbgECom has been initialized + // + if (errorCode == SBG_NO_ERROR) + { + // + // Welcome message + // + printf("Welcome to the AirDataInput example.\n"); + printf("sbgECom version %s\n\n", SBG_E_COM_VERSION_STR); + + // + // Loop until the user kill the process + // + while (1) + { + // + // Try to read a frame + // + errorCode = sbgEComHandle(&comHandle); + + // + // Test if we have to release some CPU (no frame received) + // + if (errorCode == SBG_NOT_READY) + { + // + // Send one AirData log + // + if (airDataInputSendOneLog(&comHandle) == SBG_NO_ERROR) + { + SBG_LOG_DEBUG("Airdata log sent!"); + } + else + { + SBG_LOG_WARNING(errorCode, "Unable to send AirData log"); + } + + // + // Wait for 100 ms to only send AirData at 10 Hz + // + sbgSleep(100); + } + else + { + SBG_LOG_ERROR(errorCode, "Unable to process incoming sbgECom logs"); + } + } + + // + // Close the sbgEcom library + // + sbgEComClose(&comHandle); + } + else + { + SBG_LOG_ERROR(errorCode, "Unable to initialize the sbgECom library"); + } + + return errorCode; +} + +//----------------------------------------------------------------------// +// Main program // +//----------------------------------------------------------------------// + +/*! + * Program entry point usage: airDataInput COM1 921600 + * + * \param[in] argc Number of input arguments. + * \param[in] argv Input arguments as an array of strings. + * \return EXIT_SUCCESS if successful. + */ +int main(int argc, char** argv) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgInterface sbgInterface; + int exitCode; + + SBG_UNUSED_PARAMETER(argc); + SBG_UNUSED_PARAMETER(argv); + + if (argc == 3) + { + // + // Create a serial interface to communicate with the PULSE + // + errorCode = sbgInterfaceSerialCreate(&sbgInterface, argv[1], atoi(argv[2])); + + if (errorCode == SBG_NO_ERROR) + { + errorCode = airDataInputProcess(&sbgInterface); + + if (errorCode == SBG_NO_ERROR) + { + exitCode = EXIT_SUCCESS; + } + else + { + exitCode = EXIT_FAILURE; + } + + sbgInterfaceDestroy(&sbgInterface); + } + else + { + SBG_LOG_ERROR(errorCode, "unable to open serial interface"); + exitCode = EXIT_FAILURE; + } + } + else + { + printf("Invalid input arguments, usage: airDataInput SERIAL_DEVICE SERIAL_BAUDRATE\n"); + exitCode = EXIT_FAILURE; + } + + return exitCode; +} diff --git a/examples/ellipseMinimal/src/ellipseMinimal.c b/examples/ellipseMinimal/src/ellipseMinimal.c new file mode 100644 index 0000000..99b1f07 --- /dev/null +++ b/examples/ellipseMinimal/src/ellipseMinimal.c @@ -0,0 +1,283 @@ +/*! + * \file ellipseMinimal.c + * \author SBG Systems + * \date 28/03/2014 + * + * \brief C example that simply opens an Ellipse interface and reads Euler Angles from it. + * + * This small example demonstrates how to initialize the sbgECom library + * to read data from an Ellipse using callbacks. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +// sbgCommonLib headers +#include +#include + +// sbgECom headers +#include + +//----------------------------------------------------------------------// +//- Private methods -// +//----------------------------------------------------------------------// + +/*! + * Callback definition called each time a new log is received. + * + * \param[in] pHandle Valid handle on the sbgECom instance that has called this callback. + * \param[in] msgClass Class of the message we have received + * \param[in] msg Message ID of the log received. + * \param[in] pLogData Contains the received log data as an union. + * \param[in] pUserArg Optional user supplied argument. + * \return SBG_NO_ERROR if the received log has been used successfully. + */ +SbgErrorCode onLogReceived(SbgEComHandle *pHandle, SbgEComClass msgClass, SbgEComMsgId msg, const SbgBinaryLogData *pLogData, void *pUserArg) +{ + assert(pLogData); + + SBG_UNUSED_PARAMETER(pHandle); + SBG_UNUSED_PARAMETER(pUserArg); + + if (msgClass == SBG_ECOM_CLASS_LOG_ECOM_0) + { + // + // Handle separately each received data according to the log ID + // + switch (msg) + { + case SBG_ECOM_LOG_EKF_EULER: + // + // Simply display euler angles in real time + // + printf("Euler Angles: %3.1f\t%3.1f\t%3.1f\tStd Dev:%3.1f\t%3.1f\t%3.1f \r", + sbgRadToDegf(pLogData->ekfEulerData.euler[0]), sbgRadToDegf(pLogData->ekfEulerData.euler[1]), sbgRadToDegf(pLogData->ekfEulerData.euler[2]), + sbgRadToDegf(pLogData->ekfEulerData.eulerStdDev[0]), sbgRadToDegf(pLogData->ekfEulerData.eulerStdDev[1]), sbgRadToDegf(pLogData->ekfEulerData.eulerStdDev[2])); + break; + default: + break; + } + } + + return SBG_NO_ERROR; +} + +/*! + * Get and print product info. + * + * \param[in] pECom SbgECom instance. + * \return SBG_NO_ERROR if successful. + */ +static SbgErrorCode getAndPrintProductInfo(SbgEComHandle *pECom) +{ + SbgErrorCode errorCode; + SbgEComDeviceInfo deviceInfo; + + assert(pECom); + + // + // Get device inforamtions + // + errorCode = sbgEComCmdGetInfo(pECom, &deviceInfo); + + // + // Display device information if no error + // + if (errorCode == SBG_NO_ERROR) + { + char calibVersionStr[32]; + char hwRevisionStr[32]; + char fmwVersionStr[32]; + + sbgVersionToStringEncoded(deviceInfo.calibationRev, calibVersionStr, sizeof(calibVersionStr)); + sbgVersionToStringEncoded(deviceInfo.hardwareRev, hwRevisionStr, sizeof(hwRevisionStr)); + sbgVersionToStringEncoded(deviceInfo.firmwareRev, fmwVersionStr, sizeof(fmwVersionStr)); + + printf(" Serial Number: %0.9"PRIu32"\n", deviceInfo.serialNumber); + printf(" Product Code: %s\n", deviceInfo.productCode); + printf(" Hardware Revision: %s\n", hwRevisionStr); + printf(" Firmware Version: %s\n", fmwVersionStr); + printf(" Calib. Version: %s\n", calibVersionStr); + printf("\n"); + } + else + { + SBG_LOG_WARNING(errorCode, "Unable to retrieve device information"); + } + + return errorCode; +} + +/*! + * Execute the ellipseMinimal example given an opened and valid interface. + * + * \param[in] pInterface Interface used to communicate with the device. + * \return SBG_NO_ERROR if successful. + */ +static SbgErrorCode ellipseMinimalProcess(SbgInterface *pInterface) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComHandle comHandle; + + assert(pInterface); + + // + // Create the sbgECom library and associate it with the created interfaces + // + errorCode = sbgEComInit(&comHandle, pInterface); + + // + // Test that the sbgECom has been initialized + // + if (errorCode == SBG_NO_ERROR) + { + // + // Welcome message + // + printf("Welcome to the ELLIPSE minimal example.\n"); + printf("sbgECom version %s\n\n", SBG_E_COM_VERSION_STR); + + // + // Query and display produce info, don't stop if there is an error + // + getAndPrintProductInfo(&comHandle); + + // + // Showcase how to configure some output logs to 25 Hz, don't stop if there is an error + // + errorCode = sbgEComCmdOutputSetConf(&comHandle, SBG_ECOM_OUTPUT_PORT_A, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_IMU_DATA, SBG_ECOM_OUTPUT_MODE_DIV_8); + + if (errorCode != SBG_NO_ERROR) + { + SBG_LOG_WARNING(errorCode, "Unable to configure SBG_ECOM_LOG_IMU_DATA log"); + } + + errorCode = sbgEComCmdOutputSetConf(&comHandle, SBG_ECOM_OUTPUT_PORT_A, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_EKF_EULER, SBG_ECOM_OUTPUT_MODE_DIV_8); + + if (errorCode != SBG_NO_ERROR) + { + SBG_LOG_WARNING(errorCode, "Unable to configure SBG_ECOM_LOG_EKF_EULER log"); + } + + // + // Define callbacks for received data and display header + // + sbgEComSetReceiveLogCallback(&comHandle, onLogReceived, NULL); + printf("Euler Angles display with estimated standard deviation - degrees\n"); + + // + // Loop until the user exist + // + while (1) + { + // + // Try to read a frame + // + errorCode = sbgEComHandle(&comHandle); + + // + // Test if we have to release some CPU (no frame received) + // + if (errorCode == SBG_NOT_READY) + { + // + // Release CPU + // + sbgSleep(1); + } + else + { + SBG_LOG_ERROR(errorCode, "Unable to process incoming sbgECom logs"); + } + } + + // + // Close the sbgEcom library + // + sbgEComClose(&comHandle); + } + else + { + SBG_LOG_ERROR(errorCode, "Unable to initialize the sbgECom library"); + } + + return errorCode; +} + +//----------------------------------------------------------------------// +// Main program // +//----------------------------------------------------------------------// + +/*! + * Program entry point usage: ellipseMinimal COM1 921600 + * + * \param[in] argc Number of input arguments. + * \param[in] argv Input arguments as an array of strings. + * \return EXIT_SUCCESS if successful. + */ +int main(int argc, char** argv) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgInterface sbgInterface; + int exitCode; + + SBG_UNUSED_PARAMETER(argc); + SBG_UNUSED_PARAMETER(argv); + + if (argc == 3) + { + // + // Create a serial interface to communicate with the PULSE + // + errorCode = sbgInterfaceSerialCreate(&sbgInterface, argv[1], atoi(argv[2])); + + if (errorCode == SBG_NO_ERROR) + { + errorCode = ellipseMinimalProcess(&sbgInterface); + + if (errorCode == SBG_NO_ERROR) + { + exitCode = EXIT_SUCCESS; + } + else + { + exitCode = EXIT_FAILURE; + } + + sbgInterfaceDestroy(&sbgInterface); + } + else + { + SBG_LOG_ERROR(errorCode, "unable to open serial interface"); + exitCode = EXIT_FAILURE; + } + } + else + { + printf("Invalid input arguments, usage: ellipseMinimal SERIAL_DEVICE SERIAL_BAUDRATE\n"); + exitCode = EXIT_FAILURE; + } + + return exitCode; +} diff --git a/examples/ellipseOnboardMagCalib/src/ellipseOnboardMagCalib.c b/examples/ellipseOnboardMagCalib/src/ellipseOnboardMagCalib.c new file mode 100644 index 0000000..578a2c8 --- /dev/null +++ b/examples/ellipseOnboardMagCalib/src/ellipseOnboardMagCalib.c @@ -0,0 +1,555 @@ +/*! + * \file ellipseOnboardMagCalib.c + * \author SBG Systems + * \date 30/06/2014 + * + * \brief C example that demonstrates the onboard magnetic calibration procedure. + * + * The onboard magnetic calibration is done with the three following steps: + * - Acquire some magnetic field data + * - Compute a magnetic calibration + * - Apply the newly computed magnetic calibration + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +// sbgCommonLib headers +#include +#include + +// sbgECom headers +#include + +//----------------------------------------------------------------------// +//- Private methods -// +//----------------------------------------------------------------------// + +/*! + * Retursn the last char entered by the user just before the user presses the enter key. + * + * \return The key code entered by the user just before he has pressed the 'enter' key + * or -1 if only 'enter' has been pressed. + */ +static int32_t getUserChoice(void) +{ + int userChoice = -1; + + // + // Just drain getc input to only return the latest char just before the enter key is pressed + // + for (;;) + { + int keyPressed; + + keyPressed = getc(stdin); + + if (keyPressed != '\n') + { + userChoice = keyPressed; + } + else if (keyPressed == '\n') + { + break; + } + } + + return userChoice; +} + +/*! + * Ask the user for a 2D or 3D calibration. + * + * \return The calibration mode to use. + */ +static SbgEComMagCalibMode askCalibrationMode(void) +{ + SbgEComMagCalibMode mode; + int32_t keyPressed; + + for (;;) + { + printf("Would you like to perform a 2D or 3D calibration?\n" + " 1) For a 2D calibration\n" + " 2) For a 3D calibration\n" + "Select 1 or 2 and press enter: "); + + keyPressed = getUserChoice(); + + if (keyPressed == '1') + { + mode = SBG_ECOM_MAG_CALIB_MODE_2D; + break; + } + else if (keyPressed == '2') + { + mode = SBG_ECOM_MAG_CALIB_MODE_3D; + break; + } + else + { + printf("Invalid choice, please retry.\n"); + } + } + + return mode; +} + +/*! + * Display magnetic calibration results on the console. + * + * \param[in] mode Define which magnetic calibration type has been performed. It could be 3D or 2D + * \param[in] pMagCalibResults Pointer on a read only magnetic calibration results structure. + */ +static void displayMagCalibResults(SbgEComMagCalibMode mode, const SbgEComMagCalibResults *pMagCalibResults) +{ + // + // Display the magnetic calibration results + // + printf("\n======== Magnetic calibration report ========\n"); + + // + // Convert the quality indicator to human readable output + // + switch (pMagCalibResults->quality) + { + case SBG_ECOM_MAG_CALIB_QUAL_OPTIMAL: + printf("Quality:\t\toptimal\n"); + break; + case SBG_ECOM_MAG_CALIB_QUAL_GOOD: + printf("Quality:\t\tgood\n"); + break; + case SBG_ECOM_MAG_CALIB_QUAL_POOR: + printf("Quality:\t\tpoor\n"); + break; + default: + printf("Quality:\t\tundefined\n"); + } + + // + // Convert the confidence indicator to human readable output + // + switch (pMagCalibResults->confidence) + { + case SBG_ECOM_MAG_CALIB_TRUST_HIGH: + printf("Confidence:\t\thigh\n"); + break; + case SBG_ECOM_MAG_CALIB_TRUST_MEDIUM: + printf("Confidence:\t\tmedium\n"); + break; + case SBG_ECOM_MAG_CALIB_TRUST_LOW: + printf("Confidence:\t\tlow\n"); + break; + default: + printf("Confidence:\t\tundefined\n"); + } + + // + // Print advanced status + // + printf("Advanced Status:\n"); + if (pMagCalibResults->advancedStatus & SBG_ECOM_MAG_CALIB_NOT_ENOUGH_POINTS) + { + printf("\t- Not enough valid points. Maybe you are moving too fast.\n"); + } + if (pMagCalibResults->advancedStatus & SBG_ECOM_MAG_CALIB_TOO_MUCH_DISTORTIONS) + { + printf("\t- Unable to find a calibration solution. Maybe there are too much non static distortions.\n"); + } + if (pMagCalibResults->advancedStatus & SBG_ECOM_MAG_CALIB_ALIGNMENT_ISSUE) + { + printf("\t- The magnetic calibration has troubles to correct the magnetometers and inertial frame alignment.\n"); + } + + // + // Test if we have a 2D or 3D calibration mode + // + if (mode == SBG_ECOM_MAG_CALIB_MODE_2D) + { + // + // In 2D mode, a X or Y motion issue means we have too much motion + // + if (pMagCalibResults->advancedStatus & SBG_ECOM_MAG_CALIB_X_MOTION_ISSUE) + { + printf("\t- Too much roll motion for a 2D magnetic calibration.\n"); + } + if (pMagCalibResults->advancedStatus & SBG_ECOM_MAG_CALIB_Y_MOTION_ISSUE) + { + printf("\t- Too much pitch motion for a 2D magnetic calibration.\n"); + } + } + else + { + // + // In 3D mode, a X or Y motion issue means we have not enough motion + // + if (pMagCalibResults->advancedStatus & SBG_ECOM_MAG_CALIB_X_MOTION_ISSUE) + { + printf("\t- Not enough roll motion for a 3D magnetic calibration.\n"); + } + if (pMagCalibResults->advancedStatus & SBG_ECOM_MAG_CALIB_Y_MOTION_ISSUE) + { + printf("\t- Not enough pitch motion for a 3D magnetic calibration.\n"); + } + } + + // + // Test if we had enough yaw motion to compute a calibration + // + if (pMagCalibResults->advancedStatus & SBG_ECOM_MAG_CALIB_Z_MOTION_ISSUE) + { + // + // Test if we are in + printf("\t- Not enough yaw motion to compute a valid magnetic calibration.\n"); + } + + // + // Display the number of points used to compute the magnetic calibration + // + printf("\n"); + printf("Used Points:\t%"PRIu16"\n", pMagCalibResults->numPoints); + printf("Max Points:\t%"PRIu16"\n", pMagCalibResults->maxNumPoints); + + // + // Display magnetic field deviation errors + // + printf( "\n" + "---------------------------------------------\n" + "- Magnetic field deviation report -\n" + "---------------------------------------------\n"); + + printf("\t\tMean\tStd\tMax\n"); + printf("Before\t\t%0.2f\t%0.2f\t%0.2f\n", pMagCalibResults->beforeMeanError, pMagCalibResults->beforeStdError, pMagCalibResults->beforeMaxError); + printf("After\t\t%0.2f\t%0.2f\t%0.2f\n", pMagCalibResults->afterMeanError, pMagCalibResults->afterStdError, pMagCalibResults->afterMaxError); + printf("Accuracy (deg)\t%0.2f\t%0.2f\t%0.2f\n", sbgRadToDegf(pMagCalibResults->meanAccuracy), sbgRadToDegf(pMagCalibResults->stdAccuracy), sbgRadToDegf(pMagCalibResults->maxAccuracy)); + printf("\n================ END REPORT ================\n"); +} + +/*! + * Get and print product info. + * + * \param[in] pECom SbgECom instance. + * \return SBG_NO_ERROR if successful. + */ +static SbgErrorCode getAndPrintProductInfo(SbgEComHandle *pECom) +{ + SbgErrorCode errorCode; + SbgEComDeviceInfo deviceInfo; + + assert(pECom); + + // + // Get device inforamtions + // + errorCode = sbgEComCmdGetInfo(pECom, &deviceInfo); + + // + // Display device information if no error + // + if (errorCode == SBG_NO_ERROR) + { + char calibVersionStr[32]; + char hwRevisionStr[32]; + char fmwVersionStr[32]; + + sbgVersionToStringEncoded(deviceInfo.calibationRev, calibVersionStr, sizeof(calibVersionStr)); + sbgVersionToStringEncoded(deviceInfo.hardwareRev, hwRevisionStr, sizeof(hwRevisionStr)); + sbgVersionToStringEncoded(deviceInfo.firmwareRev, fmwVersionStr, sizeof(fmwVersionStr)); + + printf(" Serial Number: %0.9"PRIu32"\n", deviceInfo.serialNumber); + printf(" Product Code: %s\n", deviceInfo.productCode); + printf(" Hardware Revision: %s\n", hwRevisionStr); + printf(" Firmware Version: %s\n", fmwVersionStr); + printf(" Calib. Version: %s\n", calibVersionStr); + printf("\n"); + } + else + { + SBG_LOG_WARNING(errorCode, "Unable to retrieve device information"); + } + + return errorCode; +} + +/*! + * Compute the magnetic calibration and display the results to the user. + * + * The new magnetic calibration can be applied on the device if apply is set to true. + * Computing a magnetic calibration don't reset the list of acquired points. + * + * \param[in] pHandle sbgEComHandle instance + * \param[in] mode 2D or 3D magnetic calibration mode. + * \param[in] apply Set to true to compute and then apply the magnetic calibration + * Set to false to just compute and display the magnetic calibration results. + * \return SBG_NO_ERROR if a valid magnetic calibration has been computed (and optionnaly applied). + */ +static SbgErrorCode computeMagneticCalibration(SbgEComHandle *pHandle, SbgEComMagCalibMode mode, bool apply) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComMagCalibResults magCalibResults; + + assert(pHandle); + + // + // Try to compute a magnetic calibration and get the results + // + errorCode = sbgEComCmdMagComputeCalib(pHandle, &magCalibResults); + + // + // Make sure that we were able to get magnetic calibration results + // + if (errorCode == SBG_NO_ERROR) + { + // + // Test if the device has computed a valid magnetic calibration + // + if (magCalibResults.quality != SBG_ECOM_MAG_CALIB_QUAL_INVALID) + { + if (apply) + { + // + // Send the new magnetic calibration data + // + errorCode = sbgEComCmdMagSetCalibData(pHandle, magCalibResults.offset, magCalibResults.matrix); + + // + // Make sure that the new magnetic calibration data has been updated + // + if (errorCode == SBG_NO_ERROR) + { + printf("The new magnetic calibration has been applied.\n"); + + // + // Display the magnetic calibration status + // + displayMagCalibResults(mode, &magCalibResults); + } + else + { + fprintf(stderr, "ellipseOnboardMagCalib: Unable to upload new magnetic calibration data.\n"); + } + } + else + { + printf("A new magnetic calibration solution has been computed.\n"); + + // + // Display the magnetic calibration status + // + displayMagCalibResults(mode, &magCalibResults); + } + } + else + { + // + // Unable to compute a valid magnetic calibration + // + fprintf(stderr, "ellipseOnboardMagCalib: Unable to compute a valid magnetic calibration.\n"); + } + } + else + { + fprintf(stderr, "ellipseOnboardMagCalib: Unable to get onboard magnetic calibration results.\n"); + } + + return errorCode; +} + +/*! + * Process. + * + * \param[in] pInterface Interface. + * \return SBG_NO_ERROR if successful. + */ +static SbgErrorCode ellipseOnBoardMagCalibProcess(SbgInterface *pInterface) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComHandle comHandle; + SbgEComMagCalibMode mode; + int keyPressed; + + assert(pInterface); + + // + // Create the sbgECom library and associate it with the created interfaces + // + errorCode = sbgEComInit(&comHandle, pInterface); + + // + // Test that the sbgECom has been initialized + // + if (errorCode == SBG_NO_ERROR) + { + printf("Welcome to the ELLIPSE onboard magnetic calibration example.\n"); + printf("sbgECom version %s\n\n", SBG_E_COM_VERSION_STR); + + // + // Get device information and print them + // + getAndPrintProductInfo(&comHandle); + + // + // Ask the user if he wants a 2D or 3D calibration + // + mode = askCalibrationMode(); + + // + // Flush the serial interface and sbgECom work buffer as the program flow has been interrupted + // + sbgEComPurgeIncoming(&comHandle); + + // + // Start / reset the acquisition of magnetic field data + // Each time this command is called, the device is prepared to acquire a new set of magnetic field data + // You have to specify here if the magnetic field data acquisition will be used to compute a 2D or 3D calibration + // + errorCode = sbgEComCmdMagStartCalib(&comHandle, mode, SBG_ECOM_MAG_CALIB_HIGH_BW); + + // + // Make sure that the magnetic calibration has started + // + if (errorCode == SBG_NO_ERROR) + { + for (;;) + { + // + // The device is now acquiring some magnetic field data. + // Wait for a user input before computing the magnetic calibration + // + if (mode == SBG_ECOM_MAG_CALIB_MODE_3D) + { + printf("\n\nThe device is acquiring magnetic field data for a 3D calibration........\n"); + } + else + { + printf("\n\nThe device is acquiring magnetic field data for a 2D calibration.........\n"); + } + + printf( "Please rotate the device slowly...\n" + "\n" + "You can compute as many magnetic calibration as you want wihtout loosing already acquiered points:\n" + " 1) Compute a magnetic calibration but don't apply it\n" + " 2) Compute and apply a magnetic calibration then quit\n" + " 3) Stop the current acquisition and quit\n" + "\n" + "Please enter your choice 1, 2 or 3 and press enter : "); + + // + // Wait for user choice + // + keyPressed = getUserChoice(); + + // + // Flush the serial interface and sbgECom work buffer as the program flow has been interrupted + // + sbgEComPurgeIncoming(&comHandle); + + if (keyPressed == '1') + { + computeMagneticCalibration(&comHandle, mode, false); + } + else if (keyPressed == '2') + { + computeMagneticCalibration(&comHandle, mode, true); + break; + } + else if (keyPressed == '3') + { + break; + } + } + } + else + { + SBG_LOG_ERROR(errorCode, "Unable to start the onboard magnetic calibration"); + } + + // + // Close the sbgEcom library + // + sbgEComClose(&comHandle); + } + else + { + SBG_LOG_ERROR(errorCode, "Unable to initialize the sbgECom library."); + } + + return errorCode; +} + +//----------------------------------------------------------------------// +// Main program // +//----------------------------------------------------------------------// + +/*! + * Program entry point usage: ellipseOnboardMagCalib COM1 921600 + * + * \param[in] argc Number of input arguments. + * \param[in] argv Input arguments as an array of strings. + * \return EXIT_SUCCESS if successful. + */ +int main(int argc, char **argv) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgInterface sbgInterface; + int exitCode; + + SBG_UNUSED_PARAMETER(argc); + SBG_UNUSED_PARAMETER(argv); + + if (argc == 3) + { + // + // Create a serial interface to communicate with the PULSE + // + errorCode = sbgInterfaceSerialCreate(&sbgInterface, argv[1], atoi(argv[2])); + + if (errorCode == SBG_NO_ERROR) + { + errorCode = ellipseOnBoardMagCalibProcess(&sbgInterface); + + if (errorCode == SBG_NO_ERROR) + { + exitCode = EXIT_SUCCESS; + } + else + { + exitCode = EXIT_FAILURE; + } + + sbgInterfaceDestroy(&sbgInterface); + } + else + { + SBG_LOG_ERROR(errorCode, "unable to open serial interface"); + exitCode = EXIT_FAILURE; + } + } + else + { + printf("Invalid input arguments, usage: pulseMinimal SERIAL_DEVICE SERIAL_BAUDRATE\n"); + exitCode = EXIT_FAILURE; + } + + return exitCode; +} diff --git a/examples/hpInsMinimal/src/hpInsMinimal.c b/examples/hpInsMinimal/src/hpInsMinimal.c new file mode 100644 index 0000000..3a52b44 --- /dev/null +++ b/examples/hpInsMinimal/src/hpInsMinimal.c @@ -0,0 +1,222 @@ +/*! + * \file hpInsMinimal.c + * \author SBG Systems + * \date 06/05/2015 + * + * \brief C example to read euler angles from a high performance INS over Ethernet + * + * This small C example demonstrates how to initialize the sbgECom library + * with an ethernet UDP interface and parse incoming SBG_ECOM_LOG_EKF_EULER logs. + * + * The INS has to be correctly setup to output the SBG_ECOM_LOG_EKF_EULER log + * on the selected UDP port. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +// sbgCommonLib headers +#include + +// sbgECom headers +#include + +//----------------------------------------------------------------------// +//- Private methods -// +//----------------------------------------------------------------------// + +/*! + * Callback definition called each time a new log is received. + * + * \param[in] pHandle Valid handle on the sbgECom instance that has called this callback. + * \param[in] msgClass Class of the message we have received + * \param[in] msg Message ID of the log received. + * \param[in] pLogData Contains the received log data as an union. + * \param[in] pUserArg Optional user supplied argument. + * \return SBG_NO_ERROR if the received log has been used successfully. + */ +SbgErrorCode onLogReceived(SbgEComHandle *pHandle, SbgEComClass msgClass, SbgEComMsgId msg, const SbgBinaryLogData *pLogData, void *pUserArg) +{ + SBG_UNUSED_PARAMETER(pHandle); + SBG_UNUSED_PARAMETER(pUserArg); + + if (msgClass == SBG_ECOM_CLASS_LOG_ECOM_0) + { + // + // Handle separately each received data according to the log ID + // + switch (msg) + { + case SBG_ECOM_LOG_EKF_EULER: + // + // Simply display euler angles in real time + // + printf("Euler Angles: %3.1f\t%3.1f\t%3.1f\tStd Dev:%3.1f\t%3.1f\t%3.1f \n", + sbgRadToDegf(pLogData->ekfEulerData.euler[0]), sbgRadToDegf(pLogData->ekfEulerData.euler[1]), sbgRadToDegf(pLogData->ekfEulerData.euler[2]), + sbgRadToDegf(pLogData->ekfEulerData.eulerStdDev[0]), sbgRadToDegf(pLogData->ekfEulerData.eulerStdDev[1]), sbgRadToDegf(pLogData->ekfEulerData.eulerStdDev[2])); + break; + + default: + break; + } + } + + return SBG_NO_ERROR; +} + +/*! + * Execute the hpInsMinimal example given an opened and valid interface. + * + * \param[in] pInterface Interface used to communicate with the device. + * \return SBG_NO_ERROR if successful. + */ +static SbgErrorCode hpInsMinimalProcess(SbgInterface *pInterface) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComHandle comHandle; + + assert(pInterface); + + // + // Create the sbgECom library and associate it with the created interfaces + // + errorCode = sbgEComInit(&comHandle, pInterface); + + // + // Test that the sbgECom has been initialized + // + if (errorCode == SBG_NO_ERROR) + { + // + // Welcome message + // + printf("Welcome to the High Performance INS minimal example.\n"); + printf("sbgECom version %s\n\n", SBG_E_COM_VERSION_STR); + + printf("Euler Angles display with estimated standard deviation.\n"); + + // + // Define callbacks for received data + // + sbgEComSetReceiveLogCallback(&comHandle, onLogReceived, NULL); + + // + // Loop until the user exist + // + while (1) + { + // + // Try to read a frame + // + errorCode = sbgEComHandle(&comHandle); + + // + // Test if we have to release some CPU (no frame received) + // + if (errorCode == SBG_NOT_READY) + { + // + // Release CPU + // + sbgSleep(1); + } + else + { + SBG_LOG_ERROR(errorCode, "Unable to process incoming sbgECom logs"); + } + } + + // + // Close the sbgEcom library + // + sbgEComClose(&comHandle); + } + else + { + SBG_LOG_ERROR(errorCode, "Unable to initialize the sbgECom library"); + } + + return errorCode; +} + +//----------------------------------------------------------------------// +// Main program // +//----------------------------------------------------------------------// + +/*! + * Program entry point usage: ekinoxMinimal REMOTE_ID_ADDR REMOTE_UDP_PORT HOST_UDP_PORT + * + * Establish an UDP connection with a High Performance INS product: + * REMOTE_ID_ADDR: is the INS IP address to connect to in the form 192.168.1.1 + * REMOTE_UDP_PORT: is the UDP port on which the INS is listening + * HOST_UDP_PORT: is the UDP port on which the INS is sending data + * + * \param[in] argc Number of input arguments. + * \param[in] argv Input arguments as an array of strings. + * \return EXIT_SUCCESS if successful. + */ +int main(int argc, char **argv) +{ + SbgErrorCode errorCode =SBG_NO_ERROR; + SbgInterface sbgInterface; + int exitCode; + + SBG_UNUSED_PARAMETER(argc); + SBG_UNUSED_PARAMETER(argv); + + if (argc == 4) + { + // + // Create a serial interface to communicate with the PULSE + // + errorCode = sbgInterfaceUdpCreate(&sbgInterface, sbgNetworkIpFromString(argv[1]), atoi(argv[2]), atoi(argv[3])); + + if (errorCode == SBG_NO_ERROR) + { + errorCode = hpInsMinimalProcess(&sbgInterface); + + if (errorCode == SBG_NO_ERROR) + { + exitCode = EXIT_SUCCESS; + } + else + { + exitCode = EXIT_FAILURE; + } + + sbgInterfaceDestroy(&sbgInterface); + } + else + { + SBG_LOG_ERROR(errorCode, "unable to open serial interface"); + exitCode = EXIT_FAILURE; + } + } + else + { + printf("Invalid input arguments, usage: hpInsMinimal REMOTE_ID_ADDR REMOTE_UDP_PORT HOST_UDP_PORT\n"); + exitCode = EXIT_FAILURE; + } + + return exitCode; +} diff --git a/examples/pulseMinimal/src/pulseMinimal.c b/examples/pulseMinimal/src/pulseMinimal.c new file mode 100644 index 0000000..06ca21a --- /dev/null +++ b/examples/pulseMinimal/src/pulseMinimal.c @@ -0,0 +1,410 @@ +/*! + * \file pulseMinimal.c + * \author SBG Systems + * \date July 27, 2021 + * + * \brief C example that simply opens a pulse interface and reads IMU data from it. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +// sbgCommonLib headers +#include + +// sbgECom headers +#include + +//----------------------------------------------------------------------// +//- Constant definitions -// +//----------------------------------------------------------------------// + +/*! + * IMU short period to configure, in ms. + */ +#define PULSE_MINIMAL_IMU_SHORT_PERIOD (100) + +//----------------------------------------------------------------------// +//- Private methods -// +//----------------------------------------------------------------------// + +/*! + * Callback used to handle received logs. + * + * \param[in] pECom SbgECom instance. + * \param[in] msgClass Class of the received message. + * \param[in] msg Received message ID. + * \param[in] pLogData Received data. + * \param[in] pUserArg Optional user argument. + * \return SBG_NO_ERROR if successful. + */ +static SbgErrorCode pulseMinimalOnLogReceived(SbgEComHandle *pECom, SbgEComClass msgClass, SbgEComMsgId msg, const SbgBinaryLogData *pLogData, void *pUserArg) +{ + SBG_UNUSED_PARAMETER(pECom); + SBG_UNUSED_PARAMETER(pUserArg); + + assert(pLogData); + + if (msgClass == SBG_ECOM_CLASS_LOG_ECOM_0) + { + switch (msg) + { + case SBG_ECOM_LOG_IMU_SHORT: + printf("%" PRIu32 "\t%" PRIu16 "\t%0.3lf\t%0.12lf\t%0.12lf\t%0.12lf\t%0.12lf\t%0.12lf\t%0.12lf\n", + pLogData->imuShort.timeStamp, + pLogData->imuShort.status, + ((double)(pLogData->imuShort.temperature) / 256.0), + ((double)pLogData->imuShort.deltaVelocity[0] / 1048576.0), + ((double)pLogData->imuShort.deltaVelocity[1] / 1048576.0 ), + ((double)pLogData->imuShort.deltaVelocity[2] / 1048576.0 ), + sbgRadToDegd(((double)pLogData->imuShort.deltaAngle[0] / 67108864.0)), + sbgRadToDegd(((double)pLogData->imuShort.deltaAngle[1] / 67108864.0 )), + sbgRadToDegd(((double)pLogData->imuShort.deltaAngle[2] / 67108864.0 ))); + break; + + default: + break; + } + } + + return SBG_NO_ERROR; +} + +/*! + * Receive logs. + * + * \param[in] pECom SbgECom instance. + */ +static void pulseMinimalReceive(SbgEComHandle *pECom) +{ + assert(pECom); + + sbgEComSetReceiveLogCallback(pECom, pulseMinimalOnLogReceived, NULL); + + while (1) + { + SbgErrorCode errorCode; + + errorCode = sbgEComHandle(pECom); + + if (errorCode == SBG_NOT_READY) + { + sbgSleep(1); + } + } +} + +/*! + * Get and print product info. + * + * \param[in] pECom SbgECom instance. + * \return SBG_NO_ERROR if successful. + */ +static SbgErrorCode pulseMinimalGetAndPrintProductInfo(SbgEComHandle *pECom) +{ + SbgEComCmdApiReply reply; + SbgErrorCode errorCode; + + assert(pECom); + + sbgEComCmdApiReplyConstruct(&reply); + + errorCode = sbgEComCmdApiGet(pECom, "/api/v1/info", NULL, &reply); + + if (errorCode == SBG_NO_ERROR) + { + char calibVersion[32]; + char productCode[32]; + char serialNumber[32]; + char hwRevision[32]; + char btVersion[32]; + char fmwVersion[32]; + int ret; + + // + // This is a naive and simplistic way to parse a json content. + // It is recommanded to use a true json parser. + // The cJson library can help you with this. + // + ret = sscanf(reply.pContent, "{" \ + "\"productCode\":\"%[^\"]\"," \ + "\"serialNumber\":\"%[^\"]\"," \ + "\"hwRevision\":\"%[^\"]\"," \ + "\"calibVersion\":\"%[^\"]\"," \ + "\"fmwVersion\":\"%[^\"]\"," \ + "\"btVersion\":\"%[^\"]\"," \ + "}", productCode, serialNumber, hwRevision, calibVersion, fmwVersion, btVersion); + + if (ret == 6) + { + printf(" product code: %s\n", productCode); + printf(" serial number: %s\n", serialNumber); + printf(" hardware revision: %s\n", hwRevision); + printf(" firmware version: %s\n", fmwVersion); + printf(" bootLoader version: %s\n", btVersion); + printf("calibration version: %s\n", calibVersion); + printf("\n"); + } + else + { + errorCode = SBG_INVALID_PARAMETER; + SBG_LOG_ERROR(errorCode, "Received JSON is mal formatted"); + } + } + else + { + SBG_LOG_ERROR(errorCode, "unable to retrieve product info"); + } + + sbgEComCmdApiReplyDestroy(&reply); + + return errorCode; +} + +/*! + * Parse an error JSON payload to extract each field. + * + * This is a naive implementation only for demonstration purposes. + * It should NOT be used in production environements. + * + * \param[in] pContent The JSON payload to parse + * \param[out] pStatus Extracted 'status' field from the JSON payload + * \param[out] pTitle Extracted 'title' field from the JSON payload + * \param[out] pDetail Extracted 'detail' field from the JSON payload. + */ +static SbgErrorCode pulseMinimalJsonParseError(const char* pContent, uint32_t *pStatus, char *pTitle, size_t titleMaxSize, char *pDetail, size_t detailMaxSize) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + char formatStr[128]; + int ret; + + assert(pContent); + assert(pStatus); + assert(pTitle); + assert(titleMaxSize > 0); + assert(pDetail); + assert(detailMaxSize > 0); + + // + // Create a sscanf format string with built in width to avoid buffer overflows + // This is a naive implementation and sscanf should not be used to correctly address buffer overflows. + // + ret = sprintf(formatStr, "{" \ + "\"status\": %%"PRIu32"," \ + "\"title\":\"%%%zu[^\"]\"," \ + "\"detail\":\"%%%zu[^\"]\"," \ + "}", titleMaxSize, detailMaxSize); + + if (ret > 0) + { + // + // This is a naive and simplistic way to parse a json content. + // It is recommanded to use a true json parser. + // The cJson library can help you with this. + // + ret = sscanf(pContent, formatStr, pStatus, pTitle, pDetail); + + if (ret != 3) + { + errorCode = SBG_INVALID_PARAMETER; + SBG_LOG_ERROR(errorCode, "JSON payload mal formatted"); + } + } + else + { + errorCode = SBG_ERROR; + SBG_LOG_ERROR(errorCode, "Unable to generate sscanf format string"); + } + + return errorCode; +} + +/*! + * Change IMU short output rate. + * + * \param[in] pECom SbgECom instance. + * \param[in] period IMU short period. + * \return SBG_NO_ERROR if successful. + */ +static SbgErrorCode pulseMinimalChangeImuShortOutputRate(SbgEComHandle *pECom, uint32_t period) +{ + SbgEComCmdApiReply reply; + SbgErrorCode errorCode; + char periodStr[32]; + int ret; + + assert(pECom); + + sbgEComCmdApiReplyConstruct(&reply); + + // + // This is a naive and simplistic way to build a json string. + // It is recommanded to use a true json generator. + // The cJson library can help you with this. + // + ret = snprintf(periodStr, sizeof(periodStr), "\"%"PRIu32"ms\"", period); + + if (ret >= 0) + { + errorCode = sbgEComCmdApiPost(pECom, "/api/v1/settings/output/comA/messages/imuShort", NULL, periodStr, &reply); + + if (errorCode == SBG_NO_ERROR) + { + // + // Check the reply status code that is based on HTTP codes (200 - OK) + // + if (reply.statusCode == 200) + { + SBG_LOG_INFO("IMU Short output periode successfully configured"); + } + else + { + uint32_t status; + char title[64]; + char details[128]; + + // + // Parse an error payload using a naive and simplistic approch + // You should rather use a true json parser such as cJson library + // + errorCode = pulseMinimalJsonParseError(reply.pContent, &status, title, sizeof(title), details, sizeof(details)); + + if (errorCode == SBG_NO_ERROR) + { + errorCode = SBG_INVALID_PARAMETER; + SBG_LOG_ERROR(errorCode, "unable to configure IMU short log each %"PRIu32" ms", period); + + printf(" status: %"PRIu32"\n", status); + printf(" title: %s\n", title); + printf(" details: %s\n", details); + printf("\n"); + } + } + } + else + { + SBG_LOG_ERROR(errorCode, "unable to configure IMU short log at 10 Hz"); + } + + sbgEComCmdApiReplyDestroy(&reply); + } + else + { + errorCode = SBG_INVALID_PARAMETER; + SBG_LOG_ERROR(errorCode, "unable to parse period (%"PRIu32")", period); + } + + return errorCode; +} + +/*! + * Process. + * + * \param[in] pInterface Interface. + * \return SBG_NO_ERROR if successful. + */ +static SbgErrorCode pulseMinimalProcess(SbgInterface *pInterface) +{ + SbgErrorCode errorCode; + SbgEComHandle comHandle; + + assert(pInterface); + + errorCode = sbgEComInit(&comHandle, pInterface); + + if (errorCode == SBG_NO_ERROR) + { + errorCode = pulseMinimalGetAndPrintProductInfo(&comHandle); + + if (errorCode == SBG_NO_ERROR) + { + errorCode = pulseMinimalChangeImuShortOutputRate(&comHandle, PULSE_MINIMAL_IMU_SHORT_PERIOD); + } + + if (errorCode == SBG_NO_ERROR) + { + pulseMinimalReceive(&comHandle); + } + + sbgEComClose(&comHandle); + } + + return errorCode; +} + +//----------------------------------------------------------------------// +// Main program // +//----------------------------------------------------------------------// + +/*! + * Program entry point usage: pulseMinimal COM1 921600 + * + * \param[in] argc Number of input arguments. + * \param[in] argv Input arguments as an array of strings. + * \return EXIT_SUCCESS if successful. + */ +int main(int argc, char **argv) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgInterface sbgInterface; + int exitCode; + + SBG_UNUSED_PARAMETER(argc); + SBG_UNUSED_PARAMETER(argv); + + if (argc == 3) + { + // + // Create a serial interface to communicate with the PULSE + // + errorCode = sbgInterfaceSerialCreate(&sbgInterface, argv[1], atoi(argv[2])); + + if (errorCode == SBG_NO_ERROR) + { + errorCode = pulseMinimalProcess(&sbgInterface); + + if (errorCode == SBG_NO_ERROR) + { + exitCode = EXIT_SUCCESS; + } + else + { + exitCode = EXIT_FAILURE; + } + + sbgInterfaceDestroy(&sbgInterface); + } + else + { + SBG_LOG_ERROR(errorCode, "unable to open serial interface"); + exitCode = EXIT_FAILURE; + } + } + else + { + printf("Invalid input arguments, usage: pulseMinimal SERIAL_DEVICE SERIAL_BAUDRATE\n"); + exitCode = EXIT_FAILURE; + } + + return exitCode; +} diff --git a/src/binaryLogs/sbgEComBinaryLogAirData.c b/src/binaryLogs/sbgEComBinaryLogAirData.c new file mode 100644 index 0000000..25d3543 --- /dev/null +++ b/src/binaryLogs/sbgEComBinaryLogAirData.c @@ -0,0 +1,66 @@ +#include "sbgEComBinaryLogAirData.h" + +//----------------------------------------------------------------------// +//- Operations -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComBinaryLogParseAirData(SbgStreamBuffer *pInputStream, SbgLogAirData *pOutputData) +{ + assert(pInputStream); + assert(pOutputData); + + // + // Read the frame payload + // + pOutputData->timeStamp = sbgStreamBufferReadUint32LE(pInputStream); + pOutputData->status = sbgStreamBufferReadUint16LE(pInputStream); + + pOutputData->pressureAbs = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->altitude = sbgStreamBufferReadFloatLE(pInputStream); + + // + // The true airspeed fields have been added in version 2.0 + // + if (sbgStreamBufferGetSpace(pInputStream) > 0) + { + pOutputData->pressureDiff = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->trueAirspeed = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->airTemperature = sbgStreamBufferReadFloatLE(pInputStream); + } + else + { + pOutputData->pressureDiff = 0.0f; + pOutputData->trueAirspeed = 0.0f; + pOutputData->airTemperature = 0.0f; + } + + // + // Return if any error has occurred while parsing the frame + // + return sbgStreamBufferGetLastError(pInputStream); +} + +SbgErrorCode sbgEComBinaryLogWriteAirData(SbgStreamBuffer *pOutputStream, const SbgLogAirData *pInputData) +{ + assert(pOutputStream); + assert(pInputData); + + // + // Write the frame payload + // + sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->timeStamp); + sbgStreamBufferWriteUint16LE(pOutputStream, pInputData->status); + + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->pressureAbs); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->altitude); + + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->pressureDiff); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->trueAirspeed); + + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->airTemperature); + + // + // Return if any error has occurred while writing the frame + // + return sbgStreamBufferGetLastError(pOutputStream); +} diff --git a/src/binaryLogs/sbgEComBinaryLogAirData.h b/src/binaryLogs/sbgEComBinaryLogAirData.h new file mode 100644 index 0000000..98a496d --- /dev/null +++ b/src/binaryLogs/sbgEComBinaryLogAirData.h @@ -0,0 +1,104 @@ +/*! + * \file sbgEComBinaryLogAirData.h + * \author SBG Systems + * \date 20 February 2019 + * + * \brief Parse received air data measurement logs such as barometer data. + * + * Air Data logs are used to inject / return barometric altitude + * as well as true air speed. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_BINARY_LOG_AIR_DATA_H +#define SBG_ECOM_BINARY_LOG_AIR_DATA_H + +// sbgCommonLib headers +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Log Air Data status definitions -// +//----------------------------------------------------------------------// + +/*! + * Air Data sensor status mask definitions + */ +#define SBG_ECOM_AIR_DATA_TIME_IS_DELAY (0x0001u << 0) /*!< Set to 1 if the time stamp field represents a delay instead of an absolute time stamp. */ +#define SBG_ECOM_AIR_DATA_PRESSURE_ABS_VALID (0x0001u << 1) /*!< Set to 1 if the pressure field is filled and valid. */ +#define SBG_ECOM_AIR_DATA_ALTITUDE_VALID (0x0001u << 2) /*!< Set to 1 if the barometric altitude field is filled and valid. */ +#define SBG_ECOM_AIR_DATA_PRESSURE_DIFF_VALID (0x0001u << 3) /*!< Set to 1 if the differential pressure field is filled and valid. */ +#define SBG_ECOM_AIR_DATA_AIRPSEED_VALID (0x0001u << 4) /*!< Set to 1 if the true airspeed field is filled and valid. */ +#define SBG_ECOM_AIR_DATA_TEMPERATURE_VALID (0x0001u << 5) /*!< Set to 1 if the output air temperature field is filled and valid. */ + +//----------------------------------------------------------------------// +//- Log structure definitions -// +//----------------------------------------------------------------------// + +/*! + * Log structure for AirData. + */ +typedef struct _SbgLogAirData +{ + uint32_t timeStamp; /*!< Time in us since the sensor power up OR measurement delay in us. */ + uint16_t status; /*!< Airdata sensor status bitmask. */ + float pressureAbs; /*!< Raw absolute pressure measured by the barometer sensor in Pascals. */ + float altitude; /*!< Altitude computed from barometric altimeter in meters and positive upward. */ + float pressureDiff; /*!< Raw differential pressure measured by the pitot tube in Pascal. */ + float trueAirspeed; /*!< True airspeed measured by a pitot tube in m.s^-1 and positive forward. */ + float airTemperature; /*!< Outside air temperature in °C that could be used to compute true airspeed from differential pressure. */ +} SbgLogAirData; + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Parse data for the SBG_ECOM_LOG_AIR_DATA message and fill the corresponding structure. + * + * \param[in] pInputStream Input stream buffer to read the payload from. + * \param[out] pOutputData Pointer on the output structure that stores parsed data. + * \return SBG_NO_ERROR if the payload has been parsed. + */ +SbgErrorCode sbgEComBinaryLogParseAirData(SbgStreamBuffer *pInputStream, SbgLogAirData *pOutputData); + +/*! + * Write data for the SBG_ECOM_LOG_AIR_DATA message to the output stream buffer from the provided structure. + * + * \param[out] pOutputStream Output stream buffer to write the payload to. + * \param[in] pInputData Pointer on the input structure that stores data to write. + * \return SBG_NO_ERROR if the message has been generated in the provided buffer. + */ +SbgErrorCode sbgEComBinaryLogWriteAirData(SbgStreamBuffer *pOutputStream, const SbgLogAirData *pInputData); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_BINARY_LOG_AIR_DATA_H diff --git a/src/binaryLogs/sbgEComBinaryLogAutomotiveData.h b/src/binaryLogs/sbgEComBinaryLogAutomotiveData.h new file mode 100644 index 0000000..0560907 --- /dev/null +++ b/src/binaryLogs/sbgEComBinaryLogAutomotiveData.h @@ -0,0 +1,73 @@ +/*! + * \file sbgEComBinaryLogAutomotiveData.h + * \author SBG Systems + * \date 22 April 2020 + * + * \brief Parse dedicated automotive measurements logs. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_BINARY_LOG_AUTOMOTIVE_H +#define SBG_ECOM_BINARY_LOG_AUTOMOTIVE_H + +// sbgCommonLib headers +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Constant definitions -// +//----------------------------------------------------------------------// + +/*! + * Automotive data status mask definitions + */ +#define SBG_ECOM_AUTO_DATA_TRACK_VALID (0x1u << 0) /*!< Set to 1 if the track angle is valid. */ +#define SBG_ECOM_AUTO_DATA_SLIP_VALID (0x1u << 1) /*!< Set to 1 if the slip angle is valid. */ +#define SBG_ECOM_AUTO_DATA_CURVATURE_VALID (0x1u << 2) /*!< Set to 1 if the curvature radius is valid. */ + +//----------------------------------------------------------------------// +//- Log structure definitions -// +//----------------------------------------------------------------------// + +/*! + * Log structure for automotive data. + */ +typedef struct _SbgLogAutoData +{ + uint8_t status; /*!< Status bit mask. */ + float trackAngle; /*!< Track angle, in rad. */ + float slipAngle; /*!< Slip angle, in rad. */ + float curvatureRadius; /*!< Curvature radius, in m, always positive. */ +} SbgLogAutoData; + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_BINARY_LOG_AUTOMOTIVE_H diff --git a/src/binaryLogs/sbgEComBinaryLogDepth.c b/src/binaryLogs/sbgEComBinaryLogDepth.c new file mode 100644 index 0000000..d87d268 --- /dev/null +++ b/src/binaryLogs/sbgEComBinaryLogDepth.c @@ -0,0 +1,45 @@ +#include "sbgEComBinaryLogDepth.h" + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComBinaryLogParseDepth(SbgStreamBuffer *pInputStream, SbgLogDepth *pOutputData) +{ + assert(pInputStream); + assert(pOutputData); + + // + // Read the frame payload + // + pOutputData->timeStamp = sbgStreamBufferReadUint32LE(pInputStream); + pOutputData->status = sbgStreamBufferReadUint16LE(pInputStream); + + pOutputData->pressureAbs = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->altitude = sbgStreamBufferReadFloatLE(pInputStream); + + // + // Return if any error has occurred while parsing the frame + // + return sbgStreamBufferGetLastError(pInputStream); +} + +SbgErrorCode sbgEComBinaryLogWriteDepth(SbgStreamBuffer *pOutputStream, const SbgLogDepth *pInputData) +{ + assert(pOutputStream); + assert(pInputData); + + // + // Write the frame payload + // + sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->timeStamp); + sbgStreamBufferWriteUint16LE(pOutputStream, pInputData->status); + + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->pressureAbs); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->altitude); + + // + // Return if any error has occurred while writing the frame + // + return sbgStreamBufferGetLastError(pOutputStream); +} diff --git a/src/binaryLogs/sbgEComBinaryLogDepth.h b/src/binaryLogs/sbgEComBinaryLogDepth.h new file mode 100644 index 0000000..bb23822 --- /dev/null +++ b/src/binaryLogs/sbgEComBinaryLogDepth.h @@ -0,0 +1,97 @@ +/*! + * \file sbgEComBinaryLogDepth.h + * \author SBG Systems + * \date 20 February 2019 + * + * \brief Parse received subsea depth measurement logs. + * + * Depth sensor are used for subsea navigation to improve height. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_BINARY_LOG_DEPTH_H +#define SBG_ECOM_BINARY_LOG_DEPTH_H + +// sbgCommonLib headers +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Log Air Data status definitions -// +//----------------------------------------------------------------------// + +/*! + * Air Data sensor status mask definitions + */ +#define SBG_ECOM_DEPTH_TIME_IS_DELAY (0x0001u << 0) /*!< Set to 1 if the time stamp field represents a delay instead of an absolute time stamp. */ +#define SBG_ECOM_DEPTH_PRESSURE_ABS_VALID (0x0001u << 1) /*!< Set to 1 if the pressure field is filled and valid. */ +#define SBG_ECOM_DEPTH_ALTITUDE_VALID (0x0001u << 2) /*!< Set to 1 if the depth altitude field is filled and valid. */ + +//----------------------------------------------------------------------// +//- Log structure definitions -// +//----------------------------------------------------------------------// + +/*! + * Log structure for Depth sensor measurement (subsea). + */ +typedef struct _SbgLogDepth +{ + uint32_t timeStamp; /*!< Time in us since the sensor power up OR measurement delay in us. */ + uint16_t status; /*!< Airdata sensor status bitmask. */ + float pressureAbs; /*!< Raw absolute pressure measured by the depth sensor in Pascals. */ + float altitude; /*!< Altitude computed from depth sensor in meters and positive upward. */ +} SbgLogDepth; + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Parse data for the SBG_ECOM_LOG_DEPTH message and fill the corresponding structure. + * + * \param[in] pInputStream Input stream buffer to read the payload from. + * \param[out] pOutputData Pointer on the output structure that stores parsed data. + * \return SBG_NO_ERROR if the payload has been parsed. + */ +SbgErrorCode sbgEComBinaryLogParseDepth(SbgStreamBuffer *pInputStream, SbgLogDepth *pOutputData); + +/*! + * Write data for the SBG_ECOM_LOG_DEPTH message to the output stream buffer from the provided structure. + * + * \param[out] pOutputStream Output stream buffer to write the payload to. + * \param[in] pInputData Pointer on the input structure that stores data to write. + * \return SBG_NO_ERROR if the message has been generated in the provided buffer. + */ +SbgErrorCode sbgEComBinaryLogWriteDepth(SbgStreamBuffer *pOutputStream, const SbgLogDepth *pInputData); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_BINARY_LOG_DEPTH_H diff --git a/src/binaryLogs/sbgEComBinaryLogDiag.c b/src/binaryLogs/sbgEComBinaryLogDiag.c new file mode 100644 index 0000000..dfcf0c3 --- /dev/null +++ b/src/binaryLogs/sbgEComBinaryLogDiag.c @@ -0,0 +1,49 @@ +// sbgCommonLib headers +#include +#include + +// Local headers +#include "sbgEComBinaryLogDiag.h" + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComBinaryLogParseDiagData(SbgStreamBuffer *pInputStream, SbgLogDiagData *pOutputData) +{ + assert(pInputStream); + assert(pOutputData); + + pOutputData->timestamp = sbgStreamBufferReadUint32LE(pInputStream); + pOutputData->type = (SbgDebugLogType)sbgStreamBufferReadUint8(pInputStream); + pOutputData->errorCode = (SbgErrorCode)sbgStreamBufferReadUint8(pInputStream); + + sbgStreamBufferReadBuffer(pInputStream, pOutputData->string, sbgStreamBufferGetSpace(pInputStream)); + pOutputData->string[sizeof(pOutputData->string) - 1] = '\0'; + + return sbgStreamBufferGetLastError(pInputStream); +} + +SbgErrorCode sbgEComBinaryLogWriteDiagData(SbgStreamBuffer *pOutputStream, const SbgLogDiagData *pInputData) +{ + size_t length; + + assert(pOutputStream); + assert(pInputData); + + sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->timestamp); + sbgStreamBufferWriteUint8(pOutputStream, pInputData->type); + sbgStreamBufferWriteUint8(pOutputStream, pInputData->errorCode); + + length = strlen(pInputData->string); + + if (length >= sizeof(pInputData->string)) + { + length = sizeof(pInputData->string) - 1; + } + + sbgStreamBufferWriteBuffer(pOutputStream, pInputData->string, length); + sbgStreamBufferWriteUint8(pOutputStream, 0); + + return sbgStreamBufferGetLastError(pOutputStream); +} diff --git a/src/binaryLogs/sbgEComBinaryLogDiag.h b/src/binaryLogs/sbgEComBinaryLogDiag.h new file mode 100644 index 0000000..2abdb14 --- /dev/null +++ b/src/binaryLogs/sbgEComBinaryLogDiag.h @@ -0,0 +1,97 @@ +/*! + * \file sbgEComBinaryLogDiag.h + * \author SBG Systems + * \date 12 June 2019 + * + * \brief Parse diagnostic logs emitted by the device. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_BINARY_LOG_DIAG_H +#define SBG_ECOM_BINARY_LOG_DIAG_H + +// sbgCommonLib headers +#include +#include + +// Project headers +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Constant definitions -// +//----------------------------------------------------------------------// + +/*! + * Maximum size of the log string, in bytes. + */ +#define SBG_ECOM_LOG_DIAG_MAX_STRING_SIZE (SBG_ECOM_MAX_PAYLOAD_SIZE - 6) + +//----------------------------------------------------------------------// +//- Structure definitions -// +//----------------------------------------------------------------------// + +/*! + * Diagnostic log structure. + */ +typedef struct _SbgLogDiagData +{ + uint32_t timestamp; /*!< Timestamp, in microseconds. */ + SbgDebugLogType type; /*!< Log type. */ + SbgErrorCode errorCode; /*!< Error code. */ + char string[SBG_ECOM_LOG_DIAG_MAX_STRING_SIZE]; /*!< Log string, null-terminated. */ +} SbgLogDiagData; + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Parse data for SBG_ECOM_LOG_DIAG messages and fill the corresponding structure. + * + * \param[in] pInputStream Input stream buffer to read the payload from. + * \param[out] pOutputData Pointer on the output structure that stores parsed data. + * \return SBG_NO_ERROR if the payload has been parsed. + */ +SbgErrorCode sbgEComBinaryLogParseDiagData(SbgStreamBuffer *pInputStream, SbgLogDiagData *pOutputData); + + +/*! + * Write data for SBG_ECOM_LOG_DIAG messages to the output stream buffer from the provided structure. + * + * \param[out] pOutputStream Output stream buffer to write the payload to. + * \param[in] pInputData Pointer on the input structure that stores data to write. + * \return SBG_NO_ERROR if the message has been generated in the provided buffer. + */ +SbgErrorCode sbgEComBinaryLogWriteDiagData(SbgStreamBuffer *pOutputStream, const SbgLogDiagData *pInputData); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_BINARY_LOG_DIAG_H diff --git a/src/binaryLogs/sbgEComBinaryLogDvl.c b/src/binaryLogs/sbgEComBinaryLogDvl.c new file mode 100644 index 0000000..0bdb392 --- /dev/null +++ b/src/binaryLogs/sbgEComBinaryLogDvl.c @@ -0,0 +1,55 @@ +#include "sbgEComBinaryLogDvl.h" + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComBinaryLogParseDvlData(SbgStreamBuffer *pInputStream, SbgLogDvlData *pOutputData) +{ + assert(pInputStream); + assert(pOutputData); + + // + // Read the frame payload + // + pOutputData->timeStamp = sbgStreamBufferReadUint32LE(pInputStream); + pOutputData->status = sbgStreamBufferReadUint16LE(pInputStream); + + pOutputData->velocity[0] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->velocity[1] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->velocity[2] = sbgStreamBufferReadFloatLE(pInputStream); + + pOutputData->velocityQuality[0] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->velocityQuality[1] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->velocityQuality[2] = sbgStreamBufferReadFloatLE(pInputStream); + + // + // Return if any error has occurred while parsing the frame + // + return sbgStreamBufferGetLastError(pInputStream); +} + +SbgErrorCode sbgEComBinaryLogWriteDvlData(SbgStreamBuffer *pOutputStream, const SbgLogDvlData *pInputData) +{ + assert(pOutputStream); + assert(pInputData); + + // + // Write the frame payload + // + sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->timeStamp); + sbgStreamBufferWriteUint16LE(pOutputStream, pInputData->status); + + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->velocity[0]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->velocity[1]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->velocity[2]); + + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->velocityQuality[0]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->velocityQuality[1]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->velocityQuality[2]); + + // + // Return if any error has occurred while writing the frame + // + return sbgStreamBufferGetLastError(pOutputStream); +} diff --git a/src/binaryLogs/sbgEComBinaryLogDvl.h b/src/binaryLogs/sbgEComBinaryLogDvl.h new file mode 100644 index 0000000..6b833b6 --- /dev/null +++ b/src/binaryLogs/sbgEComBinaryLogDvl.h @@ -0,0 +1,95 @@ +/*! + * \file sbgEComBinaryLogDvl.h + * \author SBG Systems + * \date 05 June 2013 + * + * \brief Parse received DVL (Doppler Velocity Logger) measurement logs. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_BINARY_LOG_DVL_H +#define SBG_ECOM_BINARY_LOG_DVL_H + +// sbgCommonLib headers +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Log DVL status definitions -// +//----------------------------------------------------------------------// + +/*! + * DVL status mask definitions + */ +#define SBG_ECOM_DVL_VELOCITY_VALID (0x0001u << 0) /*!< Set to 1 if the DVL equipment was able to measure a valid velocity. */ +#define SBG_ECOM_DVL_TIME_SYNC (0x0001u << 1) /*!< Set to 1 if the DVL data is correctly synchronized. */ + +//----------------------------------------------------------------------// +//- Log structure definitions -// +//----------------------------------------------------------------------// + +/*! + * Log structure for DVL data. + */ +typedef struct _SbgLogDvlData +{ + uint32_t timeStamp; /*!< Time in us since the sensor power up. */ + uint16_t status; /*!< DVL status bitmask. */ + float velocity[3]; /*!< X, Y, Z velocities in m.s^-1 expressed in the DVL instrument frame. */ + float velocityQuality[3]; /*!< X, Y, Z velocities quality indicators as provided by the DVL sensor and expressed in m.s^-1. + WARNING: This is typically just a residual information and not a real standard deviation. */ +} SbgLogDvlData; + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Parse data for the SBG_ECOM_LOG_DVL_BOTTOM_TRACK / SBG_ECOM_LOG_DVL_WATER_TRACK message and fill the corresponding structure. + * + * \param[in] pInputStream Input stream buffer to read the payload from. + * \param[out] pOutputData Pointer on the output structure that stores parsed data. + * \return SBG_NO_ERROR if the payload has been parsed. + */ +SbgErrorCode sbgEComBinaryLogParseDvlData(SbgStreamBuffer *pInputStream, SbgLogDvlData *pOutputData); + +/*! + * Write data for the SBG_ECOM_LOG_DVL_BOTTOM_TRACK / SBG_ECOM_LOG_DVL_WATER_TRACK message to the output stream buffer from the provided structure. + * + * \param[out] pOutputStream Output stream buffer to write the payload to. + * \param[in] pInputData Pointer on the input structure that stores data to write. + * \return SBG_NO_ERROR if the message has been generated in the provided buffer. + */ +SbgErrorCode sbgEComBinaryLogWriteDvlData(SbgStreamBuffer *pOutputStream, const SbgLogDvlData *pInputData); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_BINARY_LOG_DVL_H diff --git a/src/binaryLogs/sbgEComBinaryLogEkf.c b/src/binaryLogs/sbgEComBinaryLogEkf.c new file mode 100644 index 0000000..e95b9dd --- /dev/null +++ b/src/binaryLogs/sbgEComBinaryLogEkf.c @@ -0,0 +1,183 @@ +#include "sbgEComBinaryLogEkf.h" + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComBinaryLogParseEkfEulerData(SbgStreamBuffer *pInputStream, SbgLogEkfEulerData *pOutputData) +{ + assert(pInputStream); + assert(pOutputData); + + // + // Read the frame payload + // + pOutputData->timeStamp = sbgStreamBufferReadUint32LE(pInputStream); + + pOutputData->euler[0] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->euler[1] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->euler[2] = sbgStreamBufferReadFloatLE(pInputStream); + + pOutputData->eulerStdDev[0] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->eulerStdDev[1] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->eulerStdDev[2] = sbgStreamBufferReadFloatLE(pInputStream); + + pOutputData->status = sbgStreamBufferReadUint32LE(pInputStream); + + // + // Return if any error has occurred while parsing the frame + // + return sbgStreamBufferGetLastError(pInputStream); +} + +SbgErrorCode sbgEComBinaryLogWriteEkfEulerData(SbgStreamBuffer *pOutputStream, const SbgLogEkfEulerData *pInputData) +{ + assert(pOutputStream); + assert(pInputData); + + // + // Write the frame payload + // + sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->timeStamp); + + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->euler[0]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->euler[1]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->euler[2]); + + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->eulerStdDev[0]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->eulerStdDev[1]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->eulerStdDev[2]); + + sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->status); + + // + // Return if any error has occurred while writing the frame + // + return sbgStreamBufferGetLastError(pOutputStream); +} + +SbgErrorCode sbgEComBinaryLogParseEkfQuatData(SbgStreamBuffer *pInputStream, SbgLogEkfQuatData *pOutputData) +{ + assert(pInputStream); + assert(pOutputData); + + // + // Read the frame payload + // + pOutputData->timeStamp = sbgStreamBufferReadUint32LE(pInputStream); + + pOutputData->quaternion[0] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->quaternion[1] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->quaternion[2] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->quaternion[3] = sbgStreamBufferReadFloatLE(pInputStream); + + pOutputData->eulerStdDev[0] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->eulerStdDev[1] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->eulerStdDev[2] = sbgStreamBufferReadFloatLE(pInputStream); + + pOutputData->status = sbgStreamBufferReadUint32LE(pInputStream); + + // + // Return if any error has occurred while parsing the frame + // + return sbgStreamBufferGetLastError(pInputStream); +} + +SbgErrorCode sbgEComBinaryLogWriteEkfQuatData(SbgStreamBuffer *pOutputStream, const SbgLogEkfQuatData *pInputData) +{ + assert(pOutputStream); + assert(pInputData); + + // + // Write the frame payload + // + sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->timeStamp); + + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->quaternion[0]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->quaternion[1]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->quaternion[2]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->quaternion[3]); + + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->eulerStdDev[0]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->eulerStdDev[1]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->eulerStdDev[2]); + + sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->status); + + // + // Return if any error has occurred while writing the frame + // + return sbgStreamBufferGetLastError(pOutputStream); +} + +SbgErrorCode sbgEComBinaryLogParseEkfNavData(SbgStreamBuffer *pInputStream, SbgLogEkfNavData *pOutputData) +{ + assert(pInputStream); + assert(pOutputData); + + // + // Read the frame payload + // + pOutputData->timeStamp = sbgStreamBufferReadUint32LE(pInputStream); + + pOutputData->velocity[0] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->velocity[1] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->velocity[2] = sbgStreamBufferReadFloatLE(pInputStream); + + pOutputData->velocityStdDev[0] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->velocityStdDev[1] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->velocityStdDev[2] = sbgStreamBufferReadFloatLE(pInputStream); + + pOutputData->position[0] = sbgStreamBufferReadDoubleLE(pInputStream); + pOutputData->position[1] = sbgStreamBufferReadDoubleLE(pInputStream); + pOutputData->position[2] = sbgStreamBufferReadDoubleLE(pInputStream); + + pOutputData->undulation = sbgStreamBufferReadFloatLE(pInputStream); + + pOutputData->positionStdDev[0] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->positionStdDev[1] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->positionStdDev[2] = sbgStreamBufferReadFloatLE(pInputStream); + + pOutputData->status = sbgStreamBufferReadUint32LE(pInputStream); + + // + // Return if any error has occurred while parsing the frame + // + return sbgStreamBufferGetLastError(pInputStream); +} + +SbgErrorCode sbgEComBinaryLogWriteEkfNavData(SbgStreamBuffer *pOutputStream, const SbgLogEkfNavData *pInputData) +{ + assert(pOutputStream); + assert(pInputData); + + // + // Write the frame payload + // + sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->timeStamp); + + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->velocity[0]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->velocity[1]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->velocity[2]); + + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->velocityStdDev[0]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->velocityStdDev[1]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->velocityStdDev[2]); + + sbgStreamBufferWriteDoubleLE(pOutputStream, pInputData->position[0]); + sbgStreamBufferWriteDoubleLE(pOutputStream, pInputData->position[1]); + sbgStreamBufferWriteDoubleLE(pOutputStream, pInputData->position[2]); + + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->undulation); + + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->positionStdDev[0]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->positionStdDev[1]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->positionStdDev[2]); + + sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->status); + + // + // Return if any error has occurred while writing the frame + // + return sbgStreamBufferGetLastError(pOutputStream); +} diff --git a/src/binaryLogs/sbgEComBinaryLogEkf.h b/src/binaryLogs/sbgEComBinaryLogEkf.h new file mode 100644 index 0000000..cda5632 --- /dev/null +++ b/src/binaryLogs/sbgEComBinaryLogEkf.h @@ -0,0 +1,226 @@ +/*! + * \file sbgEComBinaryLogEkf.h + * \author SBG Systems + * \date 25 February 2013 + * + * \brief Parse EKF measurements such as attitude, position and velocity logs. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_BINARY_LOG_EKF_H +#define SBG_ECOM_BINARY_LOG_EKF_H + +// sbgCommonLib headers +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Solution status definitions -// +//----------------------------------------------------------------------// + +/*! + * Solution status mode definitions. + */ +#define SBG_ECOM_SOLUTION_MODE_SHIFT (0u) /*!< Shift used to extract the clock status part. */ +#define SBG_ECOM_SOLUTION_MODE_MASK (0x0000000Fu) /*!< Mask used to keep only the clock status part. */ + +/*! + * Solution bit masks definitions. + */ +#define SBG_ECOM_SOL_ATTITUDE_VALID (0x00000001u << 4) /*!< Set to 1 if attitude data is reliable (Roll/Pitch error < 0,5°). */ +#define SBG_ECOM_SOL_HEADING_VALID (0x00000001u << 5) /*!< Set to 1 if geading data is reliable (Heading error < 1°). */ +#define SBG_ECOM_SOL_VELOCITY_VALID (0x00000001u << 6) /*!< Set to 1 if velocity data is reliable (velocity error < 1.5 m/s). */ +#define SBG_ECOM_SOL_POSITION_VALID (0x00000001u << 7) /*!< Set to 1 if position data is reliable (Position error < 10m). */ +#define SBG_ECOM_SOL_VERT_REF_USED (0x00000001u << 8) /*!< Set to 1 if vertical reference is used in solution (data used and valid since 3s). */ +#define SBG_ECOM_SOL_MAG_REF_USED (0x00000001u << 9) /*!< Set to 1 if magnetometer is used in solution (data used and valid since 3s). */ +#define SBG_ECOM_SOL_GPS1_VEL_USED (0x00000001u << 10) /*!< Set to 1 if GPS1 velocity is used in solution (data used and valid since 3s). */ +#define SBG_ECOM_SOL_GPS1_POS_USED (0x00000001u << 11) /*!< Set to 1 if GPS1 Position is used in solution (data used and valid since 3s). */ +#define SBG_ECOM_SOL_GPS1_HDT_USED (0x00000001u << 13) /*!< Set to 1 if GPS1 True Heading is used in solution (data used and valid since 3s). */ +#define SBG_ECOM_SOL_GPS2_VEL_USED (0x00000001u << 14) /*!< Set to 1 if GPS2 velocity is used in solution (data used and valid since 3s). */ +#define SBG_ECOM_SOL_GPS2_POS_USED (0x00000001u << 15) /*!< Set to 1 if GPS2 Position is used in solution (data used and valid since 3s). */ +#define SBG_ECOM_SOL_GPS2_HDT_USED (0x00000001u << 17) /*!< Set to 1 if GPS2 True Heading is used in solution (data used and valid since 3s). */ +#define SBG_ECOM_SOL_ODO_USED (0x00000001u << 18) /*!< Set to 1 if Odometer is used in solution (data used and valid since 3s). */ +#define SBG_ECOM_SOL_DVL_BT_USED (0x00000001u << 19) /*!< Set to 1 if DVL Bottom Tracking is used in solution (data used and valid since 3s). */ +#define SBG_ECOM_SOL_DVL_WT_USED (0x00000001u << 20) /*!< Set to 1 if DVL Water Tracking is used in solution (data used and valid since 3s). */ +#define SBG_ECOM_SOL_USER_POS_USED (0x00000001u << 21) /*!< Set to 1 if user velocity is used in solution (data used and valid since 3s). */ +#define SBG_ECOM_SOL_USER_VEL_USED (0x00000001u << 22) /*!< Set to 1 if user Position is used in solution (data used and valid since 3s). */ +#define SBG_ECOM_SOL_USER_HEADING_USED (0x00000001u << 23) /*!< Set to 1 if user Course is used in solution (data used and valid since 3s). */ +#define SBG_ECOM_SOL_USBL_USED (0x00000001u << 24) /*!< Set to 1 if USBL / LBL is used in solution (data used and valid since 3s). */ +#define SBG_ECOM_SOL_AIR_DATA_USED (0x00000001u << 25) /*!< Set to 1 if AirData (altimeter and/or true airspeed) is used in solution (data used and valid since 3s). */ +#define SBG_ECOM_SOL_ZUPT_USED (0x00000001u << 26) /*!< Set to 1 if a ZUPT is used in solution (data used and valid since 3s). */ +#define SBG_ECOM_SOL_ALIGN_VALID (0x00000001u << 27) /*!< Set to 1 if sensor alignment and calibration parameters are valid */ +#define SBG_ECOM_SOL_DEPTH_USED (0x00000001u << 28) /*!< Set to 1 if Depth sensor (for subsea navigation) is used in solution (data used and valid since 3s). */ + +/*! + * Solution filter mode enum. + */ +typedef enum _SbgEComSolutionMode +{ + SBG_ECOM_SOL_MODE_UNINITIALIZED = 0, /*!< The Kalman filter is not initialized and the returned data are all invalid. */ + SBG_ECOM_SOL_MODE_VERTICAL_GYRO = 1, /*!< The Kalman filter only rely on a vertical reference to compute roll and pitch angles. Heading and navigation data drift freely. */ + SBG_ECOM_SOL_MODE_AHRS = 2, /*!< A heading reference is available, the Kalman filter provides full orientation but navigation data drift freely. */ + SBG_ECOM_SOL_MODE_NAV_VELOCITY = 3, /*!< The Kalman filter computes orientation and velocity. Position is freely integrated from velocity estimation. */ + SBG_ECOM_SOL_MODE_NAV_POSITION = 4 /*!< Nominal mode, the Kalman filter computes all parameters (attitude, velocity, position). Absolute position is provided. */ +} SbgEComSolutionMode; + +//----------------------------------------------------------------------// +//- Solution status helpers methods -// +//----------------------------------------------------------------------// + +/*! + * Method used to read the solution mode from a solution status field. + * + * \param[in] status Status uint32_t value to extract the solution mode from it. + * \return The extracted solution mode. + */ +SBG_INLINE SbgEComSolutionMode sbgEComLogEkfGetSolutionMode(uint32_t status) +{ + return (SbgEComSolutionMode)((status >> SBG_ECOM_SOLUTION_MODE_SHIFT) & SBG_ECOM_SOLUTION_MODE_MASK); +} + +/*! + * Method used to write the solution status field. + * + * \param[in] solutionMode The solution mode to set. + * \param[in] masks Bit mask to set. + * \return The build solution status field. + */ +SBG_INLINE uint32_t sbgEComLogEkfBuildSolutionStatus(SbgEComSolutionMode solutionMode, uint32_t masks) +{ + // + // Create the combined status field + // + return ((((uint32_t)solutionMode)&SBG_ECOM_SOLUTION_MODE_MASK) << SBG_ECOM_SOLUTION_MODE_SHIFT) | masks; +} + + +//----------------------------------------------------------------------// +//- Log structure definitions -// +//----------------------------------------------------------------------// + +/*! + * EKF computed orientation using euler angles. + */ +typedef struct _SbgLogEkfEulerData +{ + uint32_t timeStamp; /*!< Time in us since the sensor power up. */ + float euler[3]; /*!< Roll, Pitch and Yaw angles in rad. */ + float eulerStdDev[3]; /*!< Roll, Pitch and Yaw angles 1 sigma standard deviation in rad. */ + uint32_t status; /*!< EKF solution status bitmask and enum. */ +} SbgLogEkfEulerData; + +/*! + * EFK computed orientation using quaternion. + */ +typedef struct _SbgLogEkfQuatData +{ + uint32_t timeStamp; /*!< Time in us since the sensor power up. */ + float quaternion[4]; /*!< Orientation quaternion stored in W, X, Y, Z form. */ + float eulerStdDev[3]; /*!< Roll, Pitch and Yaw angles 1 sigma standard deviation in rad. */ + uint32_t status; /*!< EKF solution status bitmask and enum. */ +} SbgLogEkfQuatData; + +/*! + * EFK computed navigation data. + */ +typedef struct _SbgLogEkfNavData +{ + uint32_t timeStamp; /*!< Time in us since the sensor power up. */ + float velocity[3]; /*!< North, East, Down velocity in m.s^-1. */ + float velocityStdDev[3]; /*!< North, East, Down velocity 1 sigma standard deviation in m.s^-1. */ + double position[3]; /*!< Latitude, Longitude in degrees positive North and East. + Altitude above Mean Sea Level in meters. */ + float undulation; /*!< Altitude difference between the geoid and the Ellipsoid in meters (Height above Ellipsoid = altitude + undulation). */ + float positionStdDev[3]; /*!< Latitude, longitude and altitude 1 sigma standard deviation in meters. */ + uint32_t status; /*!< EKF solution status bitmask and enum. */ +} SbgLogEkfNavData; + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Parse data for the SBG_ECOM_LOG_EKF_EULER message and fill the corresponding structure. + * + * \param[in] pInputStream Input stream buffer to read the payload from. + * \param[out] pOutputData Pointer on the output structure that stores parsed data. + * \return SBG_NO_ERROR if the payload has been parsed. + */ +SbgErrorCode sbgEComBinaryLogParseEkfEulerData(SbgStreamBuffer *pInputStream, SbgLogEkfEulerData *pOutputData); + +/*! + * Write data for the SBG_ECOM_LOG_EKF_EULER message to the output stream buffer from the provided structure. + * + * \param[out] pOutputStream Output stream buffer to write the payload to. + * \param[in] pInputData Pointer on the input structure that stores data to write. + * \return SBG_NO_ERROR if the message has been generated in the provided buffer. + */ +SbgErrorCode sbgEComBinaryLogWriteEkfEulerData(SbgStreamBuffer *pOutputStream, const SbgLogEkfEulerData *pInputData); + +/*! + * Parse data for the SBG_ECOM_LOG_EKF_QUAT message and fill the corresponding structure. + * + * \param[in] pInputStream Input stream buffer to read the payload from. + * \param[out] pOutputData Pointer on the output structure that stores parsed data. + * \return SBG_NO_ERROR if the payload has been parsed. + */ +SbgErrorCode sbgEComBinaryLogParseEkfQuatData(SbgStreamBuffer *pInputStream, SbgLogEkfQuatData *pOutputData); + +/*! + * Write data for the SBG_ECOM_LOG_EKF_QUAT message to the output stream buffer from the provided structure. + * + * \param[out] pOutputStream Output stream buffer to write the payload to. + * \param[in] pInputData Pointer on the input structure that stores data to write. + * \return SBG_NO_ERROR if the message has been generated in the provided buffer. + */ +SbgErrorCode sbgEComBinaryLogWriteEkfQuatData(SbgStreamBuffer *pOutputStream, const SbgLogEkfQuatData *pInputData); + +/*! + * Parse data for the SBG_ECOM_LOG_EKF_NAV message and fill the corresponding structure. + * + * \param[in] pInputStream Input stream buffer to read the payload from. + * \param[out] pOutputData Pointer on the output structure that stores parsed data. + * \return SBG_NO_ERROR if the payload has been parsed. + */ +SbgErrorCode sbgEComBinaryLogParseEkfNavData(SbgStreamBuffer *pInputStream, SbgLogEkfNavData *pOutputData); + +/*! + * Write data for the SBG_ECOM_LOG_EKF_NAV message to the output stream buffer from the provided structure. + * + * \param[out] pOutputStream Output stream buffer to write the payload to. + * \param[in] pInputData Pointer on the input structure that stores data to write. + * \return SBG_NO_ERROR if the message has been generated in the provided buffer. + */ +SbgErrorCode sbgEComBinaryLogWriteEkfNavData(SbgStreamBuffer *pOutputStream, const SbgLogEkfNavData *pInputData); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_BINARY_LOG_EKF_H diff --git a/src/binaryLogs/sbgEComBinaryLogEvent.c b/src/binaryLogs/sbgEComBinaryLogEvent.c new file mode 100644 index 0000000..82ecaff --- /dev/null +++ b/src/binaryLogs/sbgEComBinaryLogEvent.c @@ -0,0 +1,47 @@ +#include "sbgEComBinaryLogEvent.h" + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComBinaryLogParseEvent(SbgStreamBuffer *pInputStream, SbgLogEvent *pOutputData) +{ + assert(pInputStream); + assert(pOutputData); + + // + // Read the frame payload + // + pOutputData->timeStamp = sbgStreamBufferReadUint32LE(pInputStream); + pOutputData->status = sbgStreamBufferReadUint16LE(pInputStream); + pOutputData->timeOffset0 = sbgStreamBufferReadUint16LE(pInputStream); + pOutputData->timeOffset1 = sbgStreamBufferReadUint16LE(pInputStream); + pOutputData->timeOffset2 = sbgStreamBufferReadUint16LE(pInputStream); + pOutputData->timeOffset3 = sbgStreamBufferReadUint16LE(pInputStream); + + // + // Return if any error has occurred while parsing the frame + // + return sbgStreamBufferGetLastError(pInputStream); +} + +SbgErrorCode sbgEComBinaryLogWriteEvent(SbgStreamBuffer *pOutputStream, const SbgLogEvent *pInputData) +{ + assert(pOutputStream); + assert(pInputData); + + // + // Write the frame payload + // + sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->timeStamp); + sbgStreamBufferWriteUint16LE(pOutputStream, pInputData->status); + sbgStreamBufferWriteUint16LE(pOutputStream, pInputData->timeOffset0); + sbgStreamBufferWriteUint16LE(pOutputStream, pInputData->timeOffset1); + sbgStreamBufferWriteUint16LE(pOutputStream, pInputData->timeOffset2); + sbgStreamBufferWriteUint16LE(pOutputStream, pInputData->timeOffset3); + + // + // Return if any error has occurred while writing the frame + // + return sbgStreamBufferGetLastError(pOutputStream); +} diff --git a/src/binaryLogs/sbgEComBinaryLogEvent.h b/src/binaryLogs/sbgEComBinaryLogEvent.h new file mode 100644 index 0000000..8eb2bb4 --- /dev/null +++ b/src/binaryLogs/sbgEComBinaryLogEvent.h @@ -0,0 +1,99 @@ +/*! + * \file sbgEComBinaryLogEvent.h + * \author SBG Systems + * \date 28 October 2013 + * + * \brief Parse event markers logs used to timestamp external signals. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_BINARY_LOG_EVENT_H +#define SBG_ECOM_BINARY_LOG_EVENT_H + +// sbgCommonLib headers +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Log marker events definitions -// +//----------------------------------------------------------------------// + +/*! + * Log market events status mask definitions + */ +#define SBG_ECOM_EVENT_OVERFLOW (0x00000001u << 0) /*!< Set to 1 if we have received events at a higher rate than 1 kHz. */ +#define SBG_ECOM_EVENT_OFFSET_0_VALID (0x00000001u << 1) /*!< Set to 1 if at least two events have been received. */ +#define SBG_ECOM_EVENT_OFFSET_1_VALID (0x00000001u << 2) /*!< Set to 1 if at least three events have been received. */ +#define SBG_ECOM_EVENT_OFFSET_2_VALID (0x00000001u << 3) /*!< Set to 1 if at least four events have been received. */ +#define SBG_ECOM_EVENT_OFFSET_3_VALID (0x00000001u << 4) /*!< Set to 1 if at least five events have been received. */ + +//----------------------------------------------------------------------// +//- Log structure definitions -// +//----------------------------------------------------------------------// + +/*! + * Structure that stores data for the SBG_ECOM_LOG_EVENT_# message. + */ +typedef struct _SbgLogEvent +{ + uint32_t timeStamp; /*!< Measurement time since the sensor power up. */ + uint16_t status; /*!< Events status bitmask. */ + uint16_t timeOffset0; /*!< Time offset for the second received event. */ + uint16_t timeOffset1; /*!< Time offset for the third received event. */ + uint16_t timeOffset2; /*!< Time offset for the fourth received event. */ + uint16_t timeOffset3; /*!< Time offset for the fifth received event. */ +} SbgLogEvent; + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Parse data for the SBG_ECOM_LOG_EVENT_# message and fill the corresponding structure. + * + * \param[in] pInputStream Input stream buffer to read the payload from. + * \param[out] pOutputData Pointer on the output structure that stores parsed data. + * \return SBG_NO_ERROR if the payload has been parsed. + */ +SbgErrorCode sbgEComBinaryLogParseEvent(SbgStreamBuffer *pInputStream, SbgLogEvent *pOutputData); + +/*! + * Write data for the SBG_ECOM_LOG_EVENT_# message to the output stream buffer from the provided structure. + * + * \param[out] pOutputStream Output stream buffer to write the payload to. + * \param[in] pInputData Pointer on the input structure that stores data to write. + * \return SBG_NO_ERROR if the message has been generated in the provided buffer. + */ +SbgErrorCode sbgEComBinaryLogWriteEvent(SbgStreamBuffer *pOutputStream, const SbgLogEvent *pInputData); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_BINARY_LOG_EVENT_H diff --git a/src/binaryLogs/sbgEComBinaryLogGps.c b/src/binaryLogs/sbgEComBinaryLogGps.c new file mode 100644 index 0000000..d58e3a6 --- /dev/null +++ b/src/binaryLogs/sbgEComBinaryLogGps.c @@ -0,0 +1,206 @@ +#include "sbgEComBinaryLogGps.h" + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComBinaryLogParseGpsVelData(SbgStreamBuffer *pInputStream, SbgLogGpsVel *pOutputData) +{ + assert(pInputStream); + assert(pOutputData); + + // + // Read the frame payload + // + pOutputData->timeStamp = sbgStreamBufferReadUint32LE(pInputStream); + pOutputData->status = sbgStreamBufferReadUint32LE(pInputStream); + pOutputData->timeOfWeek = sbgStreamBufferReadUint32LE(pInputStream); + pOutputData->velocity[0] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->velocity[1] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->velocity[2] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->velocityAcc[0] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->velocityAcc[1] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->velocityAcc[2] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->course = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->courseAcc = sbgStreamBufferReadFloatLE(pInputStream); + + // + // Return if any error has occurred while parsing the frame + // + return sbgStreamBufferGetLastError(pInputStream); +} + +SbgErrorCode sbgEComBinaryLogWriteGpsVelData(SbgStreamBuffer *pOutputStream, const SbgLogGpsVel *pInputData) +{ + assert(pOutputStream); + assert(pInputData); + + // + // Write the frame payload + // + sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->timeStamp); + sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->status); + sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->timeOfWeek); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->velocity[0]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->velocity[1]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->velocity[2]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->velocityAcc[0]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->velocityAcc[1]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->velocityAcc[2]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->course); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->courseAcc); + + // + // Return if any error has occurred while writing the frame + // + return sbgStreamBufferGetLastError(pOutputStream); +} + +SbgErrorCode sbgEComBinaryLogParseGpsPosData(SbgStreamBuffer *pInputStream, SbgLogGpsPos *pOutputData) +{ + assert(pInputStream); + assert(pOutputData); + + // + // Read the frame payload + // + pOutputData->timeStamp = sbgStreamBufferReadUint32LE(pInputStream); + pOutputData->status = sbgStreamBufferReadUint32LE(pInputStream); + pOutputData->timeOfWeek = sbgStreamBufferReadUint32LE(pInputStream); + pOutputData->latitude = sbgStreamBufferReadDoubleLE(pInputStream); + pOutputData->longitude = sbgStreamBufferReadDoubleLE(pInputStream); + pOutputData->altitude = sbgStreamBufferReadDoubleLE(pInputStream); + pOutputData->undulation = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->latitudeAccuracy = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->longitudeAccuracy = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->altitudeAccuracy = sbgStreamBufferReadFloatLE(pInputStream); + + // + // Test if we have a additional information such as base station id (since version 1.4) + // + if (sbgStreamBufferGetSpace(pInputStream) >= 5) + { + // + // Read the additional information + // + pOutputData->numSvUsed = sbgStreamBufferReadUint8LE(pInputStream); + pOutputData->baseStationId = sbgStreamBufferReadUint16LE(pInputStream); + pOutputData->differentialAge = sbgStreamBufferReadUint16LE(pInputStream); + } + else + { + // + // Default the additional information + // + pOutputData->numSvUsed = 0; + pOutputData->baseStationId = 0xFFFF; + pOutputData->differentialAge = 0xFFFF; + } + + // + // Return if any error has occurred while parsing the frame + // + return sbgStreamBufferGetLastError(pInputStream); +} + +SbgErrorCode sbgEComBinaryLogWriteGpsPosData(SbgStreamBuffer *pOutputStream, const SbgLogGpsPos *pInputData) +{ + assert(pOutputStream); + assert(pInputData); + + // + // Write the frame payload + // + sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->timeStamp); + sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->status); + sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->timeOfWeek); + + sbgStreamBufferWriteDoubleLE(pOutputStream, pInputData->latitude); + sbgStreamBufferWriteDoubleLE(pOutputStream, pInputData->longitude); + sbgStreamBufferWriteDoubleLE(pOutputStream, pInputData->altitude); + + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->undulation); + + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->latitudeAccuracy); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->longitudeAccuracy); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->altitudeAccuracy); + + // + // Write the additional information added in version 1.4 + // + sbgStreamBufferWriteUint8LE(pOutputStream, pInputData->numSvUsed); + sbgStreamBufferWriteUint16LE(pOutputStream, pInputData->baseStationId); + sbgStreamBufferWriteUint16LE(pOutputStream, pInputData->differentialAge); + + // + // Return if any error has occurred while writing the frame + // + return sbgStreamBufferGetLastError(pOutputStream); +} + +SbgErrorCode sbgEComBinaryLogParseGpsHdtData(SbgStreamBuffer *pInputStream, SbgLogGpsHdt *pOutputData) +{ + assert(pInputStream); + assert(pOutputData); + + // + // Read the frame payload + // + pOutputData->timeStamp = sbgStreamBufferReadUint32LE(pInputStream); + pOutputData->status = sbgStreamBufferReadUint16LE(pInputStream); + pOutputData->timeOfWeek = sbgStreamBufferReadUint32LE(pInputStream); + pOutputData->heading = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->headingAccuracy = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->pitch = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->pitchAccuracy = sbgStreamBufferReadFloatLE(pInputStream); + + // + // The baseline field have been added in version 2.0 + // + if (sbgStreamBufferGetSpace(pInputStream) > 0) + { + pOutputData->baseline = sbgStreamBufferReadFloatLE(pInputStream); + } + else + { + pOutputData->baseline = 0.0f; + } + + // + // Return if any error has occurred while parsing the frame + // + return sbgStreamBufferGetLastError(pInputStream); +} + +SbgErrorCode sbgEComBinaryLogWriteGpsHdtData(SbgStreamBuffer *pOutputStream, const SbgLogGpsHdt *pInputData) +{ + assert(pOutputStream); + assert(pInputData); + + // + // Write the frame payload + // + sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->timeStamp); + sbgStreamBufferWriteUint16LE(pOutputStream, pInputData->status); + sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->timeOfWeek); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->heading); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->headingAccuracy); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->pitch); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->pitchAccuracy); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->baseline); + + // + // Return if any error has occurred while writing the frame + // + return sbgStreamBufferGetLastError(pOutputStream); +} + +SbgErrorCode sbgEComBinaryLogParseGpsRawData(SbgStreamBuffer *pInputStream, SbgLogRawData *pOutputData) +{ + return sbgEComBinaryLogParseRawData(pInputStream, pOutputData); +} + +SbgErrorCode sbgEComBinaryLogWriteGpsRawData(SbgStreamBuffer *pOutputStream, const SbgLogRawData *pInputData) +{ + return sbgEComBinaryLogWriteRawData(pOutputStream, pInputData); +} diff --git a/src/binaryLogs/sbgEComBinaryLogGps.h b/src/binaryLogs/sbgEComBinaryLogGps.h new file mode 100644 index 0000000..ed1c682 --- /dev/null +++ b/src/binaryLogs/sbgEComBinaryLogGps.h @@ -0,0 +1,432 @@ +/*! + * \file sbgEComBinaryLogGps.h + * \author SBG Systems + * \date 20 February 2013 + * + * \brief Parse received GNSS logs such as Position, Velocity and True Heading. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_BINARY_LOG_GPS_H +#define SBG_ECOM_BINARY_LOG_GPS_H + +// sbgCommonLib headers +#include +#include + +// Local headers +#include "sbgEComBinaryLogRawData.h" + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Log GPS velocity const definitions -// +//----------------------------------------------------------------------// + +/*! + * Log GPS velocity status and type definitions. + */ +#define SBG_ECOM_GPS_VEL_STATUS_SHIFT (0u) /*!< Shift used to extract the GPS velocity status part. */ +#define SBG_ECOM_GPS_VEL_STATUS_MASK (0x0000003Fu) /*!< Mask used to keep only the GPS velocity status part. */ +#define SBG_ECOM_GPS_VEL_TYPE_SHIFT (6u) /*!< Shift used to extract the GPS velocity type part. */ +#define SBG_ECOM_GPS_VEL_TYPE_MASK (0x0000003Fu) /*!< Mask used to keep only the GPS velocity type part. */ + +//----------------------------------------------------------------------// +//- Log GPS position const definitions -// +//----------------------------------------------------------------------// + +/*! + * GPS position status and type definitions. + */ +#define SBG_ECOM_GPS_POS_STATUS_SHIFT (0u) /*!< Shift used to extract the GPS position status part. */ +#define SBG_ECOM_GPS_POS_STATUS_MASK (0x0000003Fu) /*!< Mask used to keep only the GPS position status part. */ +#define SBG_ECOM_GPS_POS_TYPE_SHIFT (6u) /*!< Shift used to extract the GPS position type part. */ +#define SBG_ECOM_GPS_POS_TYPE_MASK (0x0000003Fu) /*!< Mask used to keep only the GPS position type part. */ + +/*! + * GNSS signals definitions + */ +#define SBG_ECOM_GPS_POS_GPS_L1_USED (0x00000001u << 12) /*!< Set to 1 if GPS L1CA/L1P is used in solution. */ +#define SBG_ECOM_GPS_POS_GPS_L2_USED (0x00000001u << 13) /*!< Set to 1 if GPS L2P/L2C is used in solution. */ +#define SBG_ECOM_GPS_POS_GPS_L5_USED (0x00000001u << 14) /*!< Set to 1 if GPS L5 is used in solution. */ + +#define SBG_ECOM_GPS_POS_GLO_L1_USED (0x00000001u << 15) /*!< Set to 1 if GLONASS L1CA is used in solution. */ +#define SBG_ECOM_GPS_POS_GLO_L2_USED (0x00000001u << 16) /*!< Set to 1 if GLONASS L2C/L2P is used in solution. */ +#define SBG_ECOM_GPS_POS_GLO_L3_USED (0x00000001u << 17) /*!< Set to 1 if GLONASS L3 is used in solution. */ + +#define SBG_ECOM_GPS_POS_GAL_E1_USED (0x00000001u << 18) /*!< Set to 1 if Galileo E1 is used in solution. */ +#define SBG_ECOM_GPS_POS_GAL_E5A_USED (0x00000001u << 19) /*!< Set to 1 if Galileo E5a is used in solution. */ +#define SBG_ECOM_GPS_POS_GAL_E5B_USED (0x00000001u << 20) /*!< Set to 1 if Galileo E5b is used in solution. */ +#define SBG_ECOM_GPS_POS_GAL_E5ALT_USED (0x00000001u << 21) /*!< Set to 1 if Galileo E5 AltBoc is used in solution. */ +#define SBG_ECOM_GPS_POS_GAL_E6_USED (0x00000001u << 22) /*!< Set to 1 if Galileo E6 is used in solution. */ + +#define SBG_ECOM_GPS_POS_BDS_B1_USED (0x00000001u << 23) /*!< Set to 1 if BeiDou B1 is used in solution. */ +#define SBG_ECOM_GPS_POS_BDS_B2_USED (0x00000001u << 24) /*!< Set to 1 if BeiDou B2 is used in solution. */ +#define SBG_ECOM_GPS_POS_BDS_B3_USED (0x00000001u << 25) /*!< Set to 1 if BeiDou B3 is used in solution. */ + +#define SBG_ECOM_GPS_POS_QZSS_L1_USED (0x00000001u << 26) /*!< Set to 1 if QZSS L1CA is used in solution. */ +#define SBG_ECOM_GPS_POS_QZSS_L2_USED (0x00000001u << 27) /*!< Set to 1 if QZSS L2C is used in solution. */ +#define SBG_ECOM_GPS_POS_QZSS_L5_USED (0x00000001u << 28) /*!< Set to 1 if QZSS L5 is used in solution. */ + +//----------------------------------------------------------------------// +//- Log GPS HDT const definitions -// +//----------------------------------------------------------------------// + +/*! + * GPS HDT status definitions. + */ +#define SBG_ECOM_GPS_HDT_STATUS_SHIFT (0u) /*!< Shift used to extract the GPS HDT status part. */ +#define SBG_ECOM_GPS_HDT_STATUS_MASK (0x0000003Fu) /*!< Mask used to keep only the GPS HDT status part. */ + +/*! + * GPS HDT status bitmasks + */ +#define SBG_ECOM_GPS_HDT_BASELINE_VALID (0x0001 << 6) /*!< Set to 1 if the baseline length field is filled and valid. */ + +//----------------------------------------------------------------------// +//- Log GPS velocity enums definitions -// +//----------------------------------------------------------------------// + +/*! + * GPS velocity status definitions. + */ +typedef enum _SbgEComGpsVelStatus +{ + SBG_ECOM_VEL_SOL_COMPUTED = 0, /*!< A valid solution has been computed. */ + SBG_ECOM_VEL_INSUFFICIENT_OBS = 1, /*!< Not enough valid SV to compute a solution. */ + SBG_ECOM_VEL_INTERNAL_ERROR = 2, /*!< An internal error has occurred. */ + SBG_ECOM_VEL_LIMIT = 3 /*!< Velocity limit exceeded. */ +} SbgEComGpsVelStatus; + +/*! + * GPS velocity types definitions. + */ +typedef enum _SbgEComGpsVelType +{ + SBG_ECOM_VEL_NO_SOLUTION = 0, /*!< No valid velocity solution available. */ + SBG_ECOM_VEL_UNKNOWN_TYPE = 1, /*!< An unknown solution type has been computed. */ + SBG_ECOM_VEL_DOPPLER = 2, /*!< A Doppler velocity has been computed. */ + SBG_ECOM_VEL_DIFFERENTIAL = 3 /*!< A differential velocity has been computed between two positions. */ +} SbgEComGpsVelType; + +//----------------------------------------------------------------------// +//- Log GPS position enums definitions -// +//----------------------------------------------------------------------// + +/*! + * GPS position status definitions. + */ +typedef enum _SbgEComGpsPosStatus +{ + SBG_ECOM_POS_SOL_COMPUTED = 0, /*!< A valid solution has been computed. */ + SBG_ECOM_POS_INSUFFICIENT_OBS = 1, /*!< Not enough valid SV to compute a solution. */ + SBG_ECOM_POS_INTERNAL_ERROR = 2, /*!< An internal error has occurred. */ + SBG_ECOM_POS_HEIGHT_LIMIT = 3 /*!< The height limit has been exceeded. */ +} SbgEComGpsPosStatus; + +/*! + * GPS position types definitions. + */ +typedef enum _SbgEComGpsPosType +{ + SBG_ECOM_POS_NO_SOLUTION = 0, /*!< No valid solution available. */ + SBG_ECOM_POS_UNKNOWN_TYPE = 1, /*!< An unknown solution type has been computed. */ + SBG_ECOM_POS_SINGLE = 2, /*!< Single point solution position. */ + SBG_ECOM_POS_PSRDIFF = 3, /*!< Standard Pseudorange Differential Solution (DGPS). */ + SBG_ECOM_POS_SBAS = 4, /*!< SBAS satellite used for differential corrections. */ + SBG_ECOM_POS_OMNISTAR = 5, /*!< Omnistar VBS Position (L1 sub-meter). */ + SBG_ECOM_POS_RTK_FLOAT = 6, /*!< Floating RTK ambiguity solution (20 cms RTK). */ + SBG_ECOM_POS_RTK_INT = 7, /*!< Integer RTK ambiguity solution (2 cms RTK). */ + SBG_ECOM_POS_PPP_FLOAT = 8, /*!< Precise Point Positioning with float ambiguities. */ + SBG_ECOM_POS_PPP_INT = 9, /*!< Precise Point Positioning with fixed ambiguities. */ + SBG_ECOM_POS_FIXED = 10 /*!< Fixed location solution position. */ +} SbgEComGpsPosType; + +//----------------------------------------------------------------------// +//- Log GPS HDT enums definitions -// +//----------------------------------------------------------------------// + +/*! + * GPS HDT status definitions. + */ +typedef enum _SbgEComGpsHdtStatus +{ + SBG_ECOM_HDT_SOL_COMPUTED = 0, /*!< A valid solution has been computed. */ + SBG_ECOM_HDT_INSUFFICIENT_OBS = 1, /*!< Not enough valid SV to compute a solution. */ + SBG_ECOM_HDT_INTERNAL_ERROR = 2, /*!< An internal error has occurred. */ + SBG_ECOM_HDT_HEIGHT_LIMIT = 3 /*!< The height limit has been exceeded. */ +} SbgEComGpsHdtStatus; + +//----------------------------------------------------------------------// +//- Helpers methods for velocity status access -// +//----------------------------------------------------------------------// + +/*! + * Method used to read GPS velocity status from a status field. + * + * \param[in] status Status uint32_t value to extract the velocity status from it. + * \return The extracted velocity status. + */ +SBG_INLINE SbgEComGpsVelStatus sbgEComLogGpsVelGetStatus(uint32_t status) +{ + return (SbgEComGpsVelStatus)((status >> SBG_ECOM_GPS_VEL_STATUS_SHIFT) & SBG_ECOM_GPS_VEL_STATUS_MASK); +} + +/*! + * Method used to read GPS velocity type from a status field. + * + * \param[in] status Status uint32_t value to extract the velocity type from it. + * \return The extracted velocity type. + */ +SBG_INLINE SbgEComGpsVelType sbgEComLogGpsVelGetType(uint32_t status) +{ + return (SbgEComGpsVelType)((status >> SBG_ECOM_GPS_VEL_TYPE_SHIFT) & SBG_ECOM_GPS_VEL_TYPE_MASK); +} + +/*! + * Method used to write the GPS velocity status to a status field. + * + * \param[in] status The velocity status to set. + * \param[in] type The velocity type to set. + * \return The build GpsVelData status field. + */ +SBG_INLINE uint32_t sbgEComLogGpsVelBuildStatus(SbgEComGpsVelStatus status, SbgEComGpsVelType type) +{ + // + // Create the combined status field + // + return ((((uint32_t)status)&SBG_ECOM_GPS_VEL_STATUS_MASK) << SBG_ECOM_GPS_VEL_STATUS_SHIFT) | + ((((uint32_t)type)&SBG_ECOM_GPS_VEL_TYPE_MASK) << SBG_ECOM_GPS_VEL_TYPE_SHIFT); +} + +//----------------------------------------------------------------------// +//- Helpers methods for position status access -// +//----------------------------------------------------------------------// + +/*! + * Method used to read GPS position status from a status field. + * + * \param[in] status Status uint32_t value to extract the position status from it. + * \return The extracted position status. + */ +SBG_INLINE SbgEComGpsPosStatus sbgEComLogGpsPosGetStatus(uint32_t status) +{ + return (SbgEComGpsPosStatus)((status >> SBG_ECOM_GPS_POS_STATUS_SHIFT) & SBG_ECOM_GPS_POS_STATUS_MASK); +} + +/*! + * Method used to read GPS position type from a status field. + * + * \param[in] status Status uint32_t value to extract the position type from it. + * \return The extracted position type. + */ +SBG_INLINE SbgEComGpsPosType sbgEComLogGpsPosGetType(uint32_t status) +{ + return (SbgEComGpsPosType)((status >> SBG_ECOM_GPS_POS_TYPE_SHIFT) & SBG_ECOM_GPS_POS_TYPE_MASK); +} + +/*! + * Method used to write the GPS position status to a status field. + * + * \param[in] status The position status to set. + * \param[in] type The position type to set. + * \param[in] masks Bit mask to set. + * \return The build GpsPosData status field. + */ +SBG_INLINE uint32_t sbgEComLogGpsPosBuildStatus(SbgEComGpsPosStatus status, SbgEComGpsPosType type, uint32_t masks) +{ + // + // Create the combined status field + // + return ((((uint32_t)status)&SBG_ECOM_GPS_POS_STATUS_MASK) << SBG_ECOM_GPS_POS_STATUS_SHIFT) | + ((((uint32_t)type)&SBG_ECOM_GPS_POS_TYPE_MASK) << SBG_ECOM_GPS_POS_TYPE_SHIFT) | masks; +} + +//----------------------------------------------------------------------// +//- Helpers methods for HDT status access -// +//----------------------------------------------------------------------// + +/*! + * Method used to read GPS HDT status from a status field. + * + * \param[in] status Status uint32_t value to extract the HDT status from it. + * \return The extracted position status. + */ +SBG_INLINE SbgEComGpsHdtStatus sbgEComLogGpsHdtGetStatus(uint32_t status) +{ + return (SbgEComGpsHdtStatus)((status >> SBG_ECOM_GPS_HDT_STATUS_SHIFT) & SBG_ECOM_GPS_HDT_STATUS_MASK); +} + +/*! + * Method used to write the GPS HDT status to a status field. + * + * \param[in] status The HDT status to set. + * \param[in] masks Bit mask to set. + * \return The build GpsPosData status field. + */ +SBG_INLINE uint32_t sbgEComLogGpsHdtBuildStatus(SbgEComGpsHdtStatus status, uint32_t masks) +{ + // + // Create the combined status field + // + return ((((uint32_t)status)&SBG_ECOM_GPS_HDT_STATUS_MASK) << SBG_ECOM_GPS_HDT_STATUS_SHIFT) | masks; +} + +//----------------------------------------------------------------------// +//- Log structure definitions -// +//----------------------------------------------------------------------// + +/*! + * Structure that stores data for the SBG_ECOM_LOG_GPS#_VEL message. + */ +typedef struct _SbgLogGpsVel +{ + uint32_t timeStamp; /*!< Time in us since the sensor power up. */ + uint32_t status; /*!< GPS velocity status, type and bitmask. */ + uint32_t timeOfWeek; /*!< GPS time of week in ms. */ + float velocity[3]; /*!< GPS North, East, Down velocity in m.s^-1. */ + float velocityAcc[3]; /*!< GPS North, East, Down velocity 1 sigma accuracy in m.s^-1. */ + float course; /*!< Track ground course in degrees. */ + float courseAcc; /*!< Course accuracy in degrees. */ +} SbgLogGpsVel; + +/*! + * Structure that stores data for the SBG_ECOM_LOG_GPS#_POS message. + */ +typedef struct _SbgLogGpsPos +{ + uint32_t timeStamp; /*!< Time in us since the sensor power up. */ + uint32_t status; /*!< GPS position status, type and bitmask. */ + uint32_t timeOfWeek; /*!< GPS time of week in ms. */ + double latitude; /*!< Latitude in degrees, positive north. */ + double longitude; /*!< Longitude in degrees, positive east. */ + double altitude; /*!< Altitude above Mean Sea Level in meters. */ + float undulation; /*!< Altitude difference between the geoid and the Ellipsoid in meters (Height above Ellipsoid = altitude + undulation). */ + float latitudeAccuracy; /*!< 1 sigma latitude accuracy in meters. */ + float longitudeAccuracy; /*!< 1 sigma longitude accuracy in meters. */ + float altitudeAccuracy; /*!< 1 sigma altitude accuracy in meters. */ + uint8_t numSvUsed; /*!< Number of space vehicles used to compute the solution (since version 1.4). */ + uint16_t baseStationId; /*!< Base station id for differential corrections (0-4095). Set to 0xFFFF if differential corrections are not used (since version 1.4). */ + uint16_t differentialAge; /*!< Differential correction age in 0.01 seconds. Set to 0XFFFF if differential corrections are not used (since version 1.4). */ +} SbgLogGpsPos; + +/*! + * Structure that stores data for the SBG_ECOM_LOG_GPS#_HDT message. + */ +typedef struct _SbgLogGpsHdt +{ + uint32_t timeStamp; /*!< Time in us since the sensor power up. */ + uint16_t status; /*!< GPS HDT status, type and bitmask. */ + uint32_t timeOfWeek; /*!< GPS time of week in ms. */ + float heading; /*!< GPS true heading in degrees. */ + float headingAccuracy; /*!< 1 sigma GPS true heading accuracy in degrees. */ + float pitch; /*!< GPS pitch angle measured from the master to the rover in degrees. */ + float pitchAccuracy; /*!< 1 signa GPS pitch angle accuarcy in degrees. */ + float baseline; /*!< The distance between the main and aux antenna in meters. */ +} SbgLogGpsHdt; + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Parse data for the SBG_ECOM_LOG_GPS#_VEL message and fill the corresponding structure. + * + * \param[in] pInputStream Input stream buffer to read the payload from. + * \param[out] pOutputData Pointer on the output structure that stores parsed data. + * \return SBG_NO_ERROR if the payload has been parsed. + */ +SbgErrorCode sbgEComBinaryLogParseGpsVelData(SbgStreamBuffer *pInputStream, SbgLogGpsVel *pOutputData); + +/*! + * Write data for the SBG_ECOM_LOG_GPS#_VEL message to the output stream buffer from the provided structure. + * + * \param[out] pOutputStream Output stream buffer to write the payload to. + * \param[in] pInputData Pointer on the input structure that stores data to write. + * \return SBG_NO_ERROR if the message has been generated in the provided buffer. + */ +SbgErrorCode sbgEComBinaryLogWriteGpsVelData(SbgStreamBuffer *pOutputStream, const SbgLogGpsVel *pInputData); + +/*! + * Parse data for the SBG_ECOM_LOG_GPS#_POS message and fill the corresponding structure. + * + * \param[in] pInputStream Input stream buffer to read the payload from. + * \param[out] pOutputData Pointer on the output structure that stores parsed data. + * \return SBG_NO_ERROR if the payload has been parsed. + */ +SbgErrorCode sbgEComBinaryLogParseGpsPosData(SbgStreamBuffer *pInputStream, SbgLogGpsPos *pOutputData); + +/*! + * Write data for the SBG_ECOM_LOG_GPS#_POS message to the output stream buffer from the provided structure. + * + * \param[out] pOutputStream Output stream buffer to write the payload to. + * \param[in] pInputData Pointer on the input structure that stores data to write. + * \return SBG_NO_ERROR if the message has been generated in the provided buffer. + */ +SbgErrorCode sbgEComBinaryLogWriteGpsPosData(SbgStreamBuffer *pOutputStream, const SbgLogGpsPos *pInputData); + +/*! + * Parse data for the SBG_ECOM_LOG_GPS#_HDT message and fill the corresponding structure. + * + * \param[in] pInputStream Input stream buffer to read the payload from. + * \param[out] pOutputData Pointer on the output structure that stores parsed data. + * \return SBG_NO_ERROR if the payload has been parsed. + */ +SbgErrorCode sbgEComBinaryLogParseGpsHdtData(SbgStreamBuffer *pInputStream, SbgLogGpsHdt *pOutputData); + +/*! + * Write data for the SBG_ECOM_LOG_GPS#_HDT message to the output stream buffer from the provided structure. + * + * \param[out] pOutputStream Output stream buffer to write the payload to. + * \param[in] pInputData Pointer on the input structure that stores data to write. + * \return SBG_NO_ERROR if the message has been generated in the provided buffer. + */ +SbgErrorCode sbgEComBinaryLogWriteGpsHdtData(SbgStreamBuffer *pOutputStream, const SbgLogGpsHdt *pInputData); + +/*! + * Parse data for the SBG_ECOM_LOG_GPS#_RAW message and fill the corresponding structure. + * + * \param[in] pInputStream Input stream buffer to read the payload from. + * \param[out] pOutputData Pointer on the output structure that stores parsed data. + * \return SBG_NO_ERROR if the payload has been parsed. + */ +SbgErrorCode sbgEComBinaryLogParseGpsRawData(SbgStreamBuffer *pInputStream, SbgLogRawData *pOutputData); + +/*! + * Write data for the SBG_ECOM_LOG_GPS#_RAW message to the output stream buffer from the provided structure. + * + * \param[out] pOutputStream Output stream buffer to write the payload to. + * \param[in] pInputData Pointer on the input structure that stores data to write. + * \return SBG_NO_ERROR if the message has been generated in the provided buffer. + */ +SbgErrorCode sbgEComBinaryLogWriteGpsRawData(SbgStreamBuffer *pOutputStream, const SbgLogRawData *pInputData); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_BINARY_LOG_GPS_H diff --git a/src/binaryLogs/sbgEComBinaryLogImu.c b/src/binaryLogs/sbgEComBinaryLogImu.c new file mode 100644 index 0000000..279daf6 --- /dev/null +++ b/src/binaryLogs/sbgEComBinaryLogImu.c @@ -0,0 +1,206 @@ +#include "sbgEComBinaryLogImu.h" + +//----------------------------------------------------------------------// +//- Public getters -// +//----------------------------------------------------------------------// + +float sbgLogImuShortGetDeltaAngle(const SbgLogImuShort *pImuShort, size_t idx) +{ + assert(pImuShort); + assert(idx < 3); + + return pImuShort->deltaAngle[idx] / 67108864.0f; +} + +float sbgLogImuShortGetDeltaVelocity(const SbgLogImuShort *pImuShort, size_t idx) +{ + assert(pImuShort); + assert(idx < 3); + + return pImuShort->deltaVelocity[idx] / 1048576.0f; +} + +float sbgLogImuShortGetTemperature(const SbgLogImuShort *pImuShort) +{ + assert(pImuShort); + + return pImuShort->temperature / 256.0f; +} + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComBinaryLogParseImuData(SbgStreamBuffer *pInputStream, SbgLogImuData *pOutputData) +{ + assert(pInputStream); + assert(pOutputData); + + // + // Read the frame payload + // + pOutputData->timeStamp = sbgStreamBufferReadUint32LE(pInputStream); + pOutputData->status = sbgStreamBufferReadUint16LE(pInputStream); + + pOutputData->accelerometers[0] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->accelerometers[1] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->accelerometers[2] = sbgStreamBufferReadFloatLE(pInputStream); + + pOutputData->gyroscopes[0] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->gyroscopes[1] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->gyroscopes[2] = sbgStreamBufferReadFloatLE(pInputStream); + + pOutputData->temperature = sbgStreamBufferReadFloatLE(pInputStream); + + pOutputData->deltaVelocity[0] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->deltaVelocity[1] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->deltaVelocity[2] = sbgStreamBufferReadFloatLE(pInputStream); + + pOutputData->deltaAngle[0] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->deltaAngle[1] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->deltaAngle[2] = sbgStreamBufferReadFloatLE(pInputStream); + + // + // Return if any error has occurred while parsing the frame + // + return sbgStreamBufferGetLastError(pInputStream); +} + +SbgErrorCode sbgEComBinaryLogWriteImuData(SbgStreamBuffer *pOutputStream, const SbgLogImuData *pInputData) +{ + assert(pOutputStream); + assert(pInputData); + + // + // Write the frame payload + // + sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->timeStamp); + sbgStreamBufferWriteUint16LE(pOutputStream, pInputData->status); + + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->accelerometers[0]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->accelerometers[1]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->accelerometers[2]); + + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->gyroscopes[0]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->gyroscopes[1]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->gyroscopes[2]); + + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->temperature); + + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->deltaVelocity[0]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->deltaVelocity[1]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->deltaVelocity[2]); + + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->deltaAngle[0]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->deltaAngle[1]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->deltaAngle[2]); + + // + // Return if any error has occurred while writing the frame + // + return sbgStreamBufferGetLastError(pOutputStream); +} + +SbgErrorCode sbgEComBinaryLogParseImuShort(SbgStreamBuffer *pInputStream, SbgLogImuShort *pOutputData) +{ + assert(pInputStream); + assert(pOutputData); + + // + // Read the frame payload + // + pOutputData->timeStamp = sbgStreamBufferReadUint32LE(pInputStream); + pOutputData->status = sbgStreamBufferReadUint16LE(pInputStream); + + pOutputData->deltaVelocity[0] = sbgStreamBufferReadInt32LE(pInputStream); + pOutputData->deltaVelocity[1] = sbgStreamBufferReadInt32LE(pInputStream); + pOutputData->deltaVelocity[2] = sbgStreamBufferReadInt32LE(pInputStream); + + pOutputData->deltaAngle[0] = sbgStreamBufferReadInt32LE(pInputStream); + pOutputData->deltaAngle[1] = sbgStreamBufferReadInt32LE(pInputStream); + pOutputData->deltaAngle[2] = sbgStreamBufferReadInt32LE(pInputStream); + + pOutputData->temperature = sbgStreamBufferReadInt16LE(pInputStream); + + // + // Return if any error has occurred while parsing the frame + // + return sbgStreamBufferGetLastError(pInputStream); +} + +SbgErrorCode sbgEComBinaryLogWriteImuShort(SbgStreamBuffer *pOutputStream, const SbgLogImuShort *pInputData) +{ + assert(pOutputStream); + assert(pInputData); + + // + // Write the frame payload + // + sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->timeStamp); + sbgStreamBufferWriteUint16LE(pOutputStream, pInputData->status); + + sbgStreamBufferWriteInt32LE(pOutputStream, pInputData->deltaVelocity[0]); + sbgStreamBufferWriteInt32LE(pOutputStream, pInputData->deltaVelocity[1]); + sbgStreamBufferWriteInt32LE(pOutputStream, pInputData->deltaVelocity[2]); + + sbgStreamBufferWriteInt32LE(pOutputStream, pInputData->deltaAngle[0]); + sbgStreamBufferWriteInt32LE(pOutputStream, pInputData->deltaAngle[1]); + sbgStreamBufferWriteInt32LE(pOutputStream, pInputData->deltaAngle[2]); + + sbgStreamBufferWriteInt16LE(pOutputStream, pInputData->temperature); + + // + // Return if any error has occurred while writing the frame + // + return sbgStreamBufferGetLastError(pOutputStream); +} + +SbgErrorCode sbgEComBinaryLogParseFastImuData(SbgStreamBuffer *pInputStream, SbgLogFastImuData *pOutputData) +{ + assert(pInputStream); + assert(pOutputData); + + // + // Read the frame payload + // + pOutputData->timeStamp = sbgStreamBufferReadUint32LE(pInputStream); + pOutputData->status = sbgStreamBufferReadUint16LE(pInputStream); + + pOutputData->accelerometers[0] = (float)sbgStreamBufferReadInt16LE(pInputStream) * 0.01f; + pOutputData->accelerometers[1] = (float)sbgStreamBufferReadInt16LE(pInputStream) * 0.01f; + pOutputData->accelerometers[2] = (float)sbgStreamBufferReadInt16LE(pInputStream) * 0.01f; + + pOutputData->gyroscopes[0] = (float)sbgStreamBufferReadInt16LE(pInputStream) * 0.001f; + pOutputData->gyroscopes[1] = (float)sbgStreamBufferReadInt16LE(pInputStream) * 0.001f; + pOutputData->gyroscopes[2] = (float)sbgStreamBufferReadInt16LE(pInputStream) * 0.001f; + + // + // Return if any error has occurred while parsing the frame + // + return sbgStreamBufferGetLastError(pInputStream); +} + +SbgErrorCode sbgEComBinaryLogWriteFastImuData(SbgStreamBuffer *pOutputStream, const SbgLogFastImuData *pInputData) +{ + assert(pOutputStream); + assert(pInputData); + + // + // Write the frame payload + // + sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->timeStamp); + sbgStreamBufferWriteUint16LE(pOutputStream, pInputData->status); + + sbgStreamBufferWriteInt16LE(pOutputStream, (int16_t)(pInputData->accelerometers[0] * 100.0f)); + sbgStreamBufferWriteInt16LE(pOutputStream, (int16_t)(pInputData->accelerometers[1] * 100.0f)); + sbgStreamBufferWriteInt16LE(pOutputStream, (int16_t)(pInputData->accelerometers[2] * 100.0f)); + + sbgStreamBufferWriteInt16LE(pOutputStream, (int16_t)(pInputData->gyroscopes[0] * 1000.0f)); + sbgStreamBufferWriteInt16LE(pOutputStream, (int16_t)(pInputData->gyroscopes[1] * 1000.0f)); + sbgStreamBufferWriteInt16LE(pOutputStream, (int16_t)(pInputData->gyroscopes[2] * 1000.0f)); + + // + // Return if any error has occurred while writing the frame + // + return sbgStreamBufferGetLastError(pOutputStream); +} diff --git a/src/binaryLogs/sbgEComBinaryLogImu.h b/src/binaryLogs/sbgEComBinaryLogImu.h new file mode 100644 index 0000000..0dc8067 --- /dev/null +++ b/src/binaryLogs/sbgEComBinaryLogImu.h @@ -0,0 +1,198 @@ +/*! + * \file sbgEComBinaryLogImu.h + * \author SBG Systems + * \date 25 February 2013 + * + * \brief Parse IMU (Inertial Measurement Unit) measurement logs. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_BINARY_LOG_IMU_H +#define SBG_ECOM_BINARY_LOG_IMU_H + +// sbgCommonLib headers +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Log Inertial Data definitions -// +//----------------------------------------------------------------------// + +/*! + * Log inertial data status mask definitions + */ +#define SBG_ECOM_IMU_COM_OK (0x00000001u << 0) /*!< Set to 1 if the communication with the IMU is ok. */ +#define SBG_ECOM_IMU_STATUS_BIT (0x00000001u << 1) /*!< Set to 1 if the IMU passes general Built in Tests (calibration, CPU, ...). */ + +#define SBG_ECOM_IMU_ACCEL_X_BIT (0x00000001u << 2) /*!< Set to 1 if the accelerometer X passes Built In Test. */ +#define SBG_ECOM_IMU_ACCEL_Y_BIT (0x00000001u << 3) /*!< Set to 1 if the accelerometer Y passes Built In Test. */ +#define SBG_ECOM_IMU_ACCEL_Z_BIT (0x00000001u << 4) /*!< Set to 1 if the accelerometer Z passes Built In Test. */ + +#define SBG_ECOM_IMU_GYRO_X_BIT (0x00000001u << 5) /*!< Set to 1 if the gyroscope X passes Built In Test. */ +#define SBG_ECOM_IMU_GYRO_Y_BIT (0x00000001u << 6) /*!< Set to 1 if the gyroscope Y passes Built In Test. */ +#define SBG_ECOM_IMU_GYRO_Z_BIT (0x00000001u << 7) /*!< Set to 1 if the gyroscope Z passes Built In Test. */ + +#define SBG_ECOM_IMU_ACCELS_IN_RANGE (0x00000001u << 8) /*!< Set to 1 if all accelerometers are within operating range. */ +#define SBG_ECOM_IMU_GYROS_IN_RANGE (0x00000001u << 9) /*!< Set to 1 if all gyroscopes are within operating range. */ + +//----------------------------------------------------------------------// +//- Log structure definitions -// +//----------------------------------------------------------------------// + +/*! + * Structure that stores data for the SBG_ECOM_LOG_IMU_DATA message. + */ +typedef struct _SbgLogImuData +{ + uint32_t timeStamp; /*!< Time in us since the sensor power up. */ + uint16_t status; /*!< IMU status bitmask. */ + float accelerometers[3]; /*!< X, Y, Z accelerometers in m.s^-2. */ + float gyroscopes[3]; /*!< X, Y, Z gyroscopes in rad.s^-1. */ + float temperature; /*!< Internal temperature in °C. */ + float deltaVelocity[3]; /*!< X, Y, Z delta velocity in m.s^-2. */ + float deltaAngle[3]; /*!< X, Y, Z delta angle in rad.s^-1. */ +} SbgLogImuData; + +/*! + * Structure that stores data for the SBG_ECOM_LOG_IMU_SHORT message. + * This message is only sent asynchronously and is the preferred log for post processing. + */ +typedef struct _SbgLogImuShort +{ + uint32_t timeStamp; /*!< Time in us since the sensor power up. */ + uint16_t status; /*!< IMU status bitmask. */ + int32_t deltaVelocity[3]; /*!< X, Y, Z delta velocity. Unit is 1048576 LSB for 1 m.s^-2. */ + int32_t deltaAngle[3]; /*!< X, Y, Z delta angle. Unit is 67108864 LSB for 1 rad.s^-1. */ + int16_t temperature; /*!< IMU average temperature. Unit is 256 LSB for 1°C. */ +} SbgLogImuShort; + +/*! + * Structure that stores the data for SBG_ECOM_LOG_FAST_IMU_DATA message + */ +typedef struct _SbgLogFastImuData +{ + uint32_t timeStamp; /*!< Time in us since the sensor power up. */ + uint16_t status; /*!< IMU status bitmask. */ + float accelerometers[3]; /*!< X, Y, Z accelerometers in m.s^-2. */ + float gyroscopes[3]; /*!< X, Y, Z gyroscopes in rad.s^-1. */ +} SbgLogFastImuData; + +//----------------------------------------------------------------------// +//- Public getters -// +//----------------------------------------------------------------------// + +/*! + * Return from an IMU Short log, the X, Y or Z delta angle value in rad.s^-1 + * + * \param[in] pImuShort Input IMU short message instance. + * \param[in] idx The component to return from 0 to 2. + * \return The delta angle value converted in rad.s^-1. + */ +float sbgLogImuShortGetDeltaAngle(const SbgLogImuShort *pImuShort, size_t idx); + +/*! + * Return from an IMU Short log, the X, Y or Z delta velocity value in m.s^-2 + * + * \param[in] pImuShort Input IMU short message instance. + * \param[in] idx The component to return from 0 to 2. + * \return The delta velocity value converted in m.s^-2. + */ +float sbgLogImuShortGetDeltaVelocity(const SbgLogImuShort *pImuShort, size_t idx); + +/*! + * Return from an IMU Short log, the temperature in °C + * + * \param[in] pImuShort Input IMU short message instance. + * \return The converted temperature in °C + */ +float sbgLogImuShortGetTemperature(const SbgLogImuShort *pImuShort); + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Parse data for the SBG_ECOM_LOG_IMU_DATA message and fill the corresponding structure. + * + * \param[in] pInputStream Input stream buffer to read the payload from. + * \param[out] pOutputData Pointer on the output structure that stores parsed data. + * \return SBG_NO_ERROR if the payload has been parsed. + */ +SbgErrorCode sbgEComBinaryLogParseImuData(SbgStreamBuffer *pInputStream, SbgLogImuData *pOutputData); + +/*! + * Write data for the SBG_ECOM_LOG_IMU_DATA message to the output stream buffer from the provided structure. + * + * \param[out] pOutputStream Output stream buffer to write the payload to. + * \param[in] pInputData Pointer on the input structure that stores data to write. + * \return SBG_NO_ERROR if the message has been generated in the provided buffer. + */ +SbgErrorCode sbgEComBinaryLogWriteImuData(SbgStreamBuffer *pOutputStream, const SbgLogImuData *pInputData); + +/*! + * Parse data for the SBG_ECOM_LOG_IMU_SHORT message and fill the corresponding structure. + * + * \param[in] pInputStream Input stream buffer to read the payload from. + * \param[out] pOutputData Pointer on the output structure that stores parsed data. + * \return SBG_NO_ERROR if the payload has been parsed. + */ +SbgErrorCode sbgEComBinaryLogParseImuShort(SbgStreamBuffer *pInputStream, SbgLogImuShort *pOutputData); + +/*! + * Write data for the SBG_ECOM_LOG_IMU_SHORT message to the output stream buffer from the provided structure. + * + * \param[out] pOutputStream Output stream buffer to write the payload to. + * \param[in] pInputData Pointer on the input structure that stores data to write. + * \return SBG_NO_ERROR if the message has been generated in the provided buffer. + */ +SbgErrorCode sbgEComBinaryLogWriteImuShort(SbgStreamBuffer *pOutputStream, const SbgLogImuShort *pInputData); + +/*! + * Parse data for the SBG_ECOM_LOG_FAST_IMU_DATA message and fill the corresponding structure. + * + * \param[in] pInputStream Input stream buffer to read the payload from. + * \param[out] pOutputData Pointer on the output structure that stores parsed data. + * \return SBG_NO_ERROR if the payload has been parsed. + */ +SbgErrorCode sbgEComBinaryLogParseFastImuData(SbgStreamBuffer *pInputStream, SbgLogFastImuData *pOutputData); + +/*! + * Write data for the SBG_ECOM_LOG_FAST_IMU_DATA message to the output stream buffer from the provided structure. + * + * \param[out] pOutputStream Output stream buffer to write the payload to. + * \param[in] pInputData Pointer on the input structure that stores data to write. + * \return SBG_NO_ERROR if the message has been generated in the provided buffer. + */ +SbgErrorCode sbgEComBinaryLogWriteFastImuData(SbgStreamBuffer *pOutputStream, const SbgLogFastImuData *pInputData); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_BINARY_LOG_IMU_H diff --git a/src/binaryLogs/sbgEComBinaryLogMag.c b/src/binaryLogs/sbgEComBinaryLogMag.c new file mode 100644 index 0000000..efa30d5 --- /dev/null +++ b/src/binaryLogs/sbgEComBinaryLogMag.c @@ -0,0 +1,89 @@ +#include "sbgEComBinaryLogMag.h" + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComBinaryLogParseMagData(SbgStreamBuffer *pInputStream, SbgLogMag *pOutputData) +{ + assert(pInputStream); + assert(pOutputData); + + // + // Read the frame payload + // + pOutputData->timeStamp = sbgStreamBufferReadUint32LE(pInputStream); + pOutputData->status = sbgStreamBufferReadUint16LE(pInputStream); + + pOutputData->magnetometers[0] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->magnetometers[1] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->magnetometers[2] = sbgStreamBufferReadFloatLE(pInputStream); + + pOutputData->accelerometers[0] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->accelerometers[1] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->accelerometers[2] = sbgStreamBufferReadFloatLE(pInputStream); + + // + // Return if any error has occurred while parsing the frame + // + return sbgStreamBufferGetLastError(pInputStream); +} + +SbgErrorCode sbgEComBinaryLogWriteMagData(SbgStreamBuffer *pOutputStream, const SbgLogMag *pInputData) +{ + assert(pOutputStream); + assert(pInputData); + + // + // Write the frame payload + // + sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->timeStamp); + sbgStreamBufferWriteUint16LE(pOutputStream, pInputData->status); + + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->magnetometers[0]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->magnetometers[1]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->magnetometers[2]); + + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->accelerometers[0]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->accelerometers[1]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->accelerometers[2]); + + // + // Return if any error has occurred while writing the frame + // + return sbgStreamBufferGetLastError(pOutputStream); +} + +SbgErrorCode sbgEComBinaryLogParseMagCalibData(SbgStreamBuffer *pInputStream, SbgLogMagCalib *pOutputData) +{ + assert(pInputStream); + assert(pOutputData); + + // + // Read the frame payload + // + pOutputData->timeStamp = sbgStreamBufferReadUint32LE(pInputStream); + pOutputData->reserved = sbgStreamBufferReadUint16LE(pInputStream); + + // + // Read the raw magnetic calibration data buffer + // + return sbgStreamBufferReadBuffer(pInputStream, pOutputData->magData, sizeof(pOutputData->magData)); +} + +SbgErrorCode sbgEComBinaryLogWriteMagCalibData(SbgStreamBuffer *pOutputStream, const SbgLogMagCalib *pInputData) +{ + assert(pOutputStream); + assert(pInputData); + + // + // Write the frame payload + // + sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->timeStamp); + sbgStreamBufferWriteUint16LE(pOutputStream, pInputData->reserved); + + // + // Write the raw magnetic calibration data buffer + // + return sbgStreamBufferWriteBuffer(pOutputStream, pInputData->magData, sizeof(pInputData->magData)); +} diff --git a/src/binaryLogs/sbgEComBinaryLogMag.h b/src/binaryLogs/sbgEComBinaryLogMag.h new file mode 100644 index 0000000..bf6921a --- /dev/null +++ b/src/binaryLogs/sbgEComBinaryLogMag.h @@ -0,0 +1,132 @@ +/*! + * \file sbgEComBinaryLogMag.h + * \author SBG Systems + * \date 12 March 2013 + * + * \brief Parse magnetic field measurements logs. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_BINARY_LOG_MAG_H +#define SBG_ECOM_BINARY_LOG_MAG_H + +// sbgCommonLib headers +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Log magnetometers status definitions -// +//----------------------------------------------------------------------// + +/*! + * Log magnetometer data status mask definitions + */ +#define SBG_ECOM_MAG_MAG_X_BIT (0x00000001u << 0) /*!< Set to 1 if the magnetometer X passes Built In Test. */ +#define SBG_ECOM_MAG_MAG_Y_BIT (0x00000001u << 1) /*!< Set to 1 if the magnetometer Y passes Built In Test. */ +#define SBG_ECOM_MAG_MAG_Z_BIT (0x00000001u << 2) /*!< Set to 1 if the magnetometer Z passes Built In Test. */ + +#define SBG_ECOM_MAG_ACCEL_X_BIT (0x00000001u << 3) /*!< Set to 1 if the accelerometer X passes Built In Test. */ +#define SBG_ECOM_MAG_ACCEL_Y_BIT (0x00000001u << 4) /*!< Set to 1 if the accelerometer Y passes Built In Test. */ +#define SBG_ECOM_MAG_ACCEL_Z_BIT (0x00000001u << 5) /*!< Set to 1 if the accelerometer Z passes Built In Test. */ + +#define SBG_ECOM_MAG_MAGS_IN_RANGE (0x00000001u << 6) /*!< Set to 1 if all magnetometers are within operating range. */ +#define SBG_ECOM_MAG_ACCELS_IN_RANGE (0x00000001u << 7) /*!< Set to 1 if all accelerometers are within operating range. */ + +#define SBG_ECOM_MAG_CALIBRATION_OK (0x00000001u << 8) /*!< Set to 1 if the magnetometers seems to be calibrated. */ + +//----------------------------------------------------------------------// +//- Log structure definitions -// +//----------------------------------------------------------------------// + +/*! + * Structure that stores data for the SBG_ECOM_LOG_MAG message. + */ +typedef struct _SbgLogMag +{ + uint32_t timeStamp; /*!< Time in us since the sensor power up. */ + uint16_t status; /*!< Magnetometer status bitmask. */ + float magnetometers[3]; /*!< X, Y, Z magnetometer data in A.U. */ + float accelerometers[3]; /*!< X, Y, Z accelerometers in m.s^-2. */ +} SbgLogMag; + +/*! + * Structure that stores data for the SBG_ECOM_LOG_MAG_CALIB message. + */ +typedef struct _SbgLogMagCalib +{ + uint32_t timeStamp; /*!< Time in us since the sensor power up. */ + uint16_t reserved; /*!< Reserved for future use. */ + uint8_t magData[16]; /*!< Magnetometers calibration data. */ +} SbgLogMagCalib; + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Parse data for the SBG_ECOM_LOG_MAG message and fill the corresponding structure. + * + * \param[in] pInputStream Input stream buffer to read the payload from. + * \param[out] pOutputData Pointer on the output structure that stores parsed data. + * \return SBG_NO_ERROR if the payload has been parsed. + */ +SbgErrorCode sbgEComBinaryLogParseMagData(SbgStreamBuffer *pInputStream, SbgLogMag *pOutputData); + +/*! + * Write data for the SBG_ECOM_LOG_MAG message to the output stream buffer from the provided structure. + * + * \param[out] pOutputStream Output stream buffer to write the payload to. + * \param[in] pInputData Pointer on the input structure that stores data to write. + * \return SBG_NO_ERROR if the message has been generated in the provided buffer. + */ +SbgErrorCode sbgEComBinaryLogWriteMagData(SbgStreamBuffer *pOutputStream, const SbgLogMag *pInputData); + +/*! + * Parse data for the SBG_ECOM_LOG_MAG_CALIB message and fill the corresponding structure. + * + * \param[in] pInputStream Input stream buffer to read the payload from. + * \param[out] pOutputData Pointer on the output structure that stores parsed data. + * \return SBG_NO_ERROR if the payload has been parsed. + */ +SbgErrorCode sbgEComBinaryLogParseMagCalibData(SbgStreamBuffer *pInputStream, SbgLogMagCalib *pOutputData); + +/*! + * Write data for the SBG_ECOM_LOG_MAG_CALIB message to the output stream buffer from the provided structure. + * + * \param[out] pOutputStream Output stream buffer to write the payload to. + * \param[in] pInputData Pointer on the input structure that stores data to write. + * \return SBG_NO_ERROR if the message has been generated in the provided buffer. + */ +SbgErrorCode sbgEComBinaryLogWriteMagCalibData(SbgStreamBuffer *pOutputStream, const SbgLogMagCalib *pInputData); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_BINARY_LOG_MAG_H diff --git a/src/binaryLogs/sbgEComBinaryLogOdometer.c b/src/binaryLogs/sbgEComBinaryLogOdometer.c new file mode 100644 index 0000000..075337c --- /dev/null +++ b/src/binaryLogs/sbgEComBinaryLogOdometer.c @@ -0,0 +1,43 @@ +#include "sbgEComBinaryLogOdometer.h" + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComBinaryLogParseOdometerData(SbgStreamBuffer *pInputStream, SbgLogOdometerData *pOutputData) +{ + assert(pInputStream); + assert(pOutputData); + + // + // Read the frame payload + // + pOutputData->timeStamp = sbgStreamBufferReadUint32LE(pInputStream); + pOutputData->status = sbgStreamBufferReadUint16LE(pInputStream); + + pOutputData->velocity = sbgStreamBufferReadFloatLE(pInputStream); + + // + // Return if any error has occurred while parsing the frame + // + return sbgStreamBufferGetLastError(pInputStream); +} + +SbgErrorCode sbgEComBinaryLogWriteOdometerData(SbgStreamBuffer *pOutputStream, const SbgLogOdometerData *pInputData) +{ + assert(pOutputStream); + assert(pInputData); + + // + // Write the frame payload + // + sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->timeStamp); + sbgStreamBufferWriteUint16LE(pOutputStream, pInputData->status); + + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->velocity); + + // + // Return if any error has occurred while writing the frame + // + return sbgStreamBufferGetLastError(pOutputStream); +} diff --git a/src/binaryLogs/sbgEComBinaryLogOdometer.h b/src/binaryLogs/sbgEComBinaryLogOdometer.h new file mode 100644 index 0000000..f8a9ab6 --- /dev/null +++ b/src/binaryLogs/sbgEComBinaryLogOdometer.h @@ -0,0 +1,93 @@ +/*! + * \file sbgEComBinaryLogOdometer.h + * \author SBG Systems + * \date 25 February 2013 + * + * \brief Parse recevied odometer/DMI velocity measurement logs. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_BINARY_LOG_ODOMETER_H +#define SBG_ECOM_BINARY_LOG_ODOMETER_H + +// sbgCommonLib headers +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Log odometer status definitions -// +//----------------------------------------------------------------------// + +/*! + * Odometer / velocity status mask definitions. + */ +#define SBG_ECOM_ODO_REAL_MEAS (0x0001 << 0) /*!< Set to 1 if this log comes from a real pulse measurement or from a timeout. */ +#define SBG_ECOM_ODO_TIME_SYNC (0x0001 << 1) /*!< Set to 1 if the velocity information is correctly time synchronized. */ + +//----------------------------------------------------------------------// +//- Log structure definitions -// +//----------------------------------------------------------------------// + +/*! + * Log structure for odometer data. + */ +typedef struct _SbgLogOdometerData +{ + uint32_t timeStamp; /*!< Time in us since the sensor power up. */ + uint16_t status; /*!< Odometer velocity status bitmask. */ + float velocity; /*!< Velocity in m.s^-1 in the odometer direction. */ +} SbgLogOdometerData; + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Parse data for the SBG_ECOM_LOG_ODO_VEL message and fill the corresponding structure. + * + * \param[in] pInputStream Input stream buffer to read the payload from. + * \param[out] pOutputData Pointer on the output structure that stores parsed data. + * \return SBG_NO_ERROR if the payload has been parsed. + */ +SbgErrorCode sbgEComBinaryLogParseOdometerData(SbgStreamBuffer *pInputStream, SbgLogOdometerData *pOutputData); + +/*! + * Write data for the SBG_ECOM_LOG_ODO_VEL message to the output stream buffer from the provided structure. + * + * \param[out] pOutputStream Output stream buffer to write the payload to. + * \param[in] pInputData Pointer on the input structure that stores data to write. + * \return SBG_NO_ERROR if the message has been generated in the provided buffer. + */ +SbgErrorCode sbgEComBinaryLogWriteOdometerData(SbgStreamBuffer *pOutputStream, const SbgLogOdometerData *pInputData); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_BINARY_LOG_ODOMETER_H diff --git a/src/binaryLogs/sbgEComBinaryLogRawData.c b/src/binaryLogs/sbgEComBinaryLogRawData.c new file mode 100644 index 0000000..71ed37f --- /dev/null +++ b/src/binaryLogs/sbgEComBinaryLogRawData.c @@ -0,0 +1,40 @@ +// sbgCommonLib headers +#include + +// Local headers +#include "sbgEComBinaryLogRawData.h" + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComBinaryLogParseRawData(SbgStreamBuffer *pInputStream, SbgLogRawData *pOutputData) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + size_t payloadSize; + + assert(pInputStream); + assert(pOutputData); + + payloadSize = sbgStreamBufferGetSize(pInputStream); + + if (payloadSize <= SBG_ECOM_RAW_DATA_MAX_BUFFER_SIZE) + { + errorCode = sbgStreamBufferReadBuffer(pInputStream, pOutputData->rawBuffer, payloadSize); + pOutputData->bufferSize = payloadSize; + } + else + { + errorCode = SBG_BUFFER_OVERFLOW; + } + + return errorCode; +} + +SbgErrorCode sbgEComBinaryLogWriteRawData(SbgStreamBuffer *pOutputStream, const SbgLogRawData *pInputData) +{ + assert(pOutputStream); + assert(pInputData); + + return sbgStreamBufferWriteBuffer(pOutputStream, pInputData->rawBuffer, pInputData->bufferSize); +} diff --git a/src/binaryLogs/sbgEComBinaryLogRawData.h b/src/binaryLogs/sbgEComBinaryLogRawData.h new file mode 100644 index 0000000..342b872 --- /dev/null +++ b/src/binaryLogs/sbgEComBinaryLogRawData.h @@ -0,0 +1,88 @@ +/*! + * \file sbgEComBinaryLogRawData.h + * \author SBG Systems + * \date 16 November 2020 + * + * \brief Parse logs used to store a binary stream such as RAW GNSS data. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_BINARY_LOG_RAW_DATA_H +#define SBG_ECOM_BINARY_LOG_RAW_DATA_H + +// sbgCommonLib headers +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Log raw Data const definitions -// +//----------------------------------------------------------------------// + +#define SBG_ECOM_RAW_DATA_MAX_BUFFER_SIZE (4086u) /*!< Maximum buffer size in bytes that can be stored in the raw data log. */ + +//----------------------------------------------------------------------// +//- Log structure definitions -// +//----------------------------------------------------------------------// + +/*! + * Structure that stores raw data message. + */ +typedef struct _SbgLogRawData +{ + uint8_t rawBuffer[SBG_ECOM_RAW_DATA_MAX_BUFFER_SIZE]; /*!< Buffer that contains raw data. */ + size_t bufferSize; /*!< Raw buffer size in bytes. */ +} SbgLogRawData; + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Parse raw data message and fill the corresponding structure. + * + * \param[in] pInputStream Input stream buffer to read the payload from. + * \param[out] pOutputData Pointer on the output structure that stores parsed data. + * \return SBG_NO_ERROR if the payload has been parsed. + */ +SbgErrorCode sbgEComBinaryLogParseRawData(SbgStreamBuffer *pInputStream, SbgLogRawData *pOutputData); + +/*! + * Write raw data message to the output stream buffer from the provided structure. + * + * \param[out] pOutputStream Output stream buffer to write the payload to. + * \param[in] pInputData Pointer on the input structure that stores data to write. + * \return SBG_NO_ERROR if the message has been generated in the provided buffer. + */ +SbgErrorCode sbgEComBinaryLogWriteRawData(SbgStreamBuffer *pOutputStream, const SbgLogRawData *pInputData); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_BINARY_LOG_RAW_DATA_H diff --git a/src/binaryLogs/sbgEComBinaryLogRtcm.c b/src/binaryLogs/sbgEComBinaryLogRtcm.c new file mode 100644 index 0000000..fcfce45 --- /dev/null +++ b/src/binaryLogs/sbgEComBinaryLogRtcm.c @@ -0,0 +1,19 @@ +// sbgCommonLib headers +#include + +// Local headers +#include "sbgEComBinaryLogRtcm.h" + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComBinaryLogParseRtcmRawData(SbgStreamBuffer *pInputStream, SbgLogRawData *pOutputData) +{ + return sbgEComBinaryLogParseRawData(pInputStream, pOutputData); +} + +SbgErrorCode sbgEComBinaryLogWriteRtcmRawData(SbgStreamBuffer *pOutputStream, const SbgLogRawData *pInputData) +{ + return sbgEComBinaryLogWriteRawData(pOutputStream, pInputData); +} diff --git a/src/binaryLogs/sbgEComBinaryLogRtcm.h b/src/binaryLogs/sbgEComBinaryLogRtcm.h new file mode 100644 index 0000000..68e13d6 --- /dev/null +++ b/src/binaryLogs/sbgEComBinaryLogRtcm.h @@ -0,0 +1,72 @@ +/*! + * \file sbgEComBinaryLogRtcm.h + * \author SBG Systems + * \date 16 November 2020 + * + * \brief Parse RTCM data stream logs as received by the INS. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_BINARY_LOG_RTCM_H +#define SBG_ECOM_BINARY_LOG_RTCM_H + +// sbgCommonLib headers +#include +#include + +// Local headers +#include "sbgEComBinaryLogRawData.h" + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Parse data for the SBG_ECOM_LOG_RTCM_RAW message and fill the corresponding structure. + * + * \param[in] pInputStream Input stream buffer to read the payload from. + * \param[out] pOutputData Pointer on the output structure that stores parsed data. + * \return SBG_NO_ERROR if the payload has been parsed. + */ +SbgErrorCode sbgEComBinaryLogParseRtcmRawData(SbgStreamBuffer *pInputStream, SbgLogRawData *pOutputData); + +/*! + * Write data for the SBG_ECOM_LOG_RTCM_RAW message to the output stream buffer from the provided structure. + * + * \param[out] pOutputStream Output stream buffer to write the payload to. + * \param[in] pInputData Pointer on the input structure that stores data to write. + * \return SBG_NO_ERROR if the message has been generated in the provided buffer. + */ +SbgErrorCode sbgEComBinaryLogWriteRtcmRawData(SbgStreamBuffer *pOutputStream, const SbgLogRawData *pInputData); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_BINARY_LOG_RTCM_H diff --git a/src/binaryLogs/sbgEComBinaryLogShipMotion.c b/src/binaryLogs/sbgEComBinaryLogShipMotion.c new file mode 100644 index 0000000..d89f210 --- /dev/null +++ b/src/binaryLogs/sbgEComBinaryLogShipMotion.c @@ -0,0 +1,110 @@ +#include "sbgEComBinaryLogShipMotion.h" + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComBinaryLogParseShipMotionData(SbgStreamBuffer *pInputStream, SbgLogShipMotionData *pOutputData) +{ + assert(pInputStream); + assert(pOutputData); + + // + // Read the frame payload + // + pOutputData->timeStamp = sbgStreamBufferReadUint32LE(pInputStream); + + // + // Read the main heave period in seconds + // + pOutputData->mainHeavePeriod = sbgStreamBufferReadFloatLE(pInputStream); + + // + // Read the surge, sway and heave ship motion + // + pOutputData->shipMotion[0] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->shipMotion[1] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->shipMotion[2] = sbgStreamBufferReadFloatLE(pInputStream); + + // + // Read the ship accelerations + // + pOutputData->shipAccel[0] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->shipAccel[1] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->shipAccel[2] = sbgStreamBufferReadFloatLE(pInputStream); + + // + // Test if we have a additional information such as ship velocity and status (since version 1.4) + // + if (sbgStreamBufferGetSpace(pInputStream) >= 14) + { + // + // Read new outputs + // + pOutputData->shipVel[0] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->shipVel[1] = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->shipVel[2] = sbgStreamBufferReadFloatLE(pInputStream); + + pOutputData->status = sbgStreamBufferReadUint16LE(pInputStream); + } + else + { + // + // Those outputs are not available in previous versions + // + pOutputData->shipVel[0] = 0.0f; + pOutputData->shipVel[1] = 0.0f; + pOutputData->shipVel[2] = 0.0f; + + pOutputData->status = 0; + } + + // + // Return if any error has occurred while parsing the frame + // + return sbgStreamBufferGetLastError(pInputStream); +} + +SbgErrorCode sbgEComBinaryLogWriteShipMotionData(SbgStreamBuffer *pOutputStream, const SbgLogShipMotionData *pInputData) +{ + assert(pOutputStream); + assert(pInputData); + + // + // Write the frame payload + // + sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->timeStamp); + + // + // Write the main heave period in seconds + // + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->mainHeavePeriod); + + // + // Write the surge, sway and heave ship motion + // + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->shipMotion[0]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->shipMotion[1]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->shipMotion[2]); + + // + // Write the ship accelerations + // + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->shipAccel[0]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->shipAccel[1]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->shipAccel[2]); + + // + // Write additional inforamtion added in version 1.4 + // + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->shipVel[0]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->shipVel[1]); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->shipVel[2]); + + sbgStreamBufferWriteUint16LE(pOutputStream, pInputData->status); + + // + // Return if any error has occurred while writing the frame + // + return sbgStreamBufferGetLastError(pOutputStream); +} diff --git a/src/binaryLogs/sbgEComBinaryLogShipMotion.h b/src/binaryLogs/sbgEComBinaryLogShipMotion.h new file mode 100644 index 0000000..6068b69 --- /dev/null +++ b/src/binaryLogs/sbgEComBinaryLogShipMotion.h @@ -0,0 +1,101 @@ +/*! + * \file sbgEComBinaryLogShipMotion.h + * \author SBG Systems + * \date 30 March 2013 + * + * \brief Parse logs that returns ship motion values such as heave. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_BINARY_LOG_SHIP_MOTION_H +#define SBG_ECOM_BINARY_LOG_SHIP_MOTION_H + +// sbgCommonLib headers +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Heave status definitions -// +//----------------------------------------------------------------------// + +#define SBG_ECOM_HEAVE_VALID (0x0001u << 0) /*!< Set to 1 after heave convergence time. */ +#define SBG_ECOM_HEAVE_VEL_AIDED (0x0001u << 1) /*!< Set to 1 if heave output is compensated for transient accelerations. */ +#define SBG_ECOM_HEAVE_SURGE_SWAY_INCLUDED (0x0001u << 2) /*!< Set to 1 if surge and sway channels are provided in this output. */ +#define SBG_ECOM_HEAVE_PERIOD_INCLUDED (0x0001u << 3) /*!< Set to 1 if the heave period is provided in this output. */ +#define SBG_ECOM_HEAVE_PERIOD_VALID (0x0001u << 4) /*!< Set to 1 if the returned heave period is assumed to be valid. */ +#define SBG_ECOM_HEAVE_SWELL_MODE (0x0001u << 5) /*!< Set to 1 if the real time heave filter is using the swell mode computations. */ + +//----------------------------------------------------------------------// +//- Log structure definitions -// +//----------------------------------------------------------------------// + +/*! + * Structure that stores data for the SBG_ECOM_LOG_SHIP_MOTION or SBG_ECOM_LOG_SHIP_MOTION_HP message.
    + * The data are expressed in the standard NED Ekinox coordiante frame. + * Surge is positive forward, sway is positive right and heave is positive down.
    + * Note that status flag should be read before using the different parameters because it will provide validity information + * about all included outputs. Some frames may not provide the heave period or surge/sway axes for example + */ +typedef struct _SbgLogShipMotionData +{ + uint32_t timeStamp; /*!< Time in us since the sensor power up. */ + uint16_t status; /*!< Ship Motion data status bitmask */ + float mainHeavePeriod; /*!< Main heave period in seconds. */ + float shipMotion[3]; /*!< Surge, sway and heave in meters. */ + float shipAccel[3]; /*!< Surge, sway and heave ship Acceleration in m.s^-2. */ + float shipVel[3]; /*!< Surge, sway and heave velocities */ +} SbgLogShipMotionData; + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Parse data for the SBG_ECOM_LOG_SHIP_MOTION or SBG_ECOM_LOG_SHIP_MOTION_HP message and fill the corresponding structure. + * + * \param[in] pInputStream Input stream buffer to read the payload from. + * \param[out] pOutputData Pointer on the output structure that stores parsed data. + * \return SBG_NO_ERROR if the payload has been parsed. + */ +SbgErrorCode sbgEComBinaryLogParseShipMotionData(SbgStreamBuffer *pInputStream, SbgLogShipMotionData *pOutputData); + +/*! + * Write data for the SBG_ECOM_LOG_SHIP_MOTION or SBG_ECOM_LOG_SHIP_MOTION_HP message to the output stream buffer from the provided structure. + * + * \param[out] pOutputStream Output stream buffer to write the payload to. + * \param[in] pInputData Pointer on the input structure that stores data to write. + * \return SBG_NO_ERROR if the message has been generated in the provided buffer. + */ +SbgErrorCode sbgEComBinaryLogWriteShipMotionData(SbgStreamBuffer *pOutputStream, const SbgLogShipMotionData *pInputData); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_BINARY_LOG_SHIP_MOTION_H diff --git a/src/binaryLogs/sbgEComBinaryLogStatus.c b/src/binaryLogs/sbgEComBinaryLogStatus.c new file mode 100644 index 0000000..e0573de --- /dev/null +++ b/src/binaryLogs/sbgEComBinaryLogStatus.c @@ -0,0 +1,72 @@ +#include "sbgEComBinaryLogStatus.h" + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComBinaryLogParseStatusData(SbgStreamBuffer *pInputStream, SbgLogStatusData *pOutputData) +{ + assert(pInputStream); + assert(pOutputData); + + // + // Read the frame payload + // + pOutputData->timeStamp = sbgStreamBufferReadUint32LE(pInputStream); + pOutputData->generalStatus = sbgStreamBufferReadUint16LE(pInputStream); + pOutputData->reserved1 = sbgStreamBufferReadUint16LE(pInputStream); + pOutputData->comStatus = sbgStreamBufferReadUint32LE(pInputStream); + pOutputData->aidingStatus = sbgStreamBufferReadUint32LE(pInputStream); + pOutputData->reserved2 = sbgStreamBufferReadUint32LE(pInputStream); + pOutputData->reserved3 = sbgStreamBufferReadUint16LE(pInputStream); + + // + // Test if we have a additional information such as uptime (since version 1.7) + // + if (sbgStreamBufferGetSpace(pInputStream) >= sizeof(uint32_t)) + { + // + // Read the additional information + // + pOutputData->uptime = sbgStreamBufferReadUint32LE(pInputStream); + } + else + { + // + // Default the additional information + // + pOutputData->uptime = 0; + } + + // + // Return if any error has occurred while parsing the frame + // + return sbgStreamBufferGetLastError(pInputStream); +} + +SbgErrorCode sbgEComBinaryLogWriteStatusData(SbgStreamBuffer *pOutputStream, const SbgLogStatusData *pInputData) +{ + assert(pOutputStream); + assert(pInputData); + + // + // Write the frame payload + // + sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->timeStamp); + sbgStreamBufferWriteUint16LE(pOutputStream, pInputData->generalStatus); + sbgStreamBufferWriteUint16LE(pOutputStream, pInputData->reserved1); + sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->comStatus); + sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->aidingStatus); + sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->reserved2); + sbgStreamBufferWriteUint16LE(pOutputStream, pInputData->reserved3); + + // + // Write the additional information added in version 1.7 + // + sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->uptime); + + // + // Return if any error has occurred while writing the frame + // + return sbgStreamBufferGetLastError(pOutputStream); +} diff --git a/src/binaryLogs/sbgEComBinaryLogStatus.h b/src/binaryLogs/sbgEComBinaryLogStatus.h new file mode 100644 index 0000000..9c47bcf --- /dev/null +++ b/src/binaryLogs/sbgEComBinaryLogStatus.h @@ -0,0 +1,201 @@ +/*! + * \file sbgEComBinaryLogStatus.h + * \author SBG Systems + * \date 03 April 2013 + * + * \brief Parse logs used to report device status. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_BINARY_LOG_STATUS_H +#define SBG_ECOM_BINARY_LOG_STATUS_H + +// sbgCommonLib headers +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- General status definitions -// +//----------------------------------------------------------------------// +#define SBG_ECOM_GENERAL_MAIN_POWER_OK (0x0001u << 0) /*!< Set to 1 when main power supply is OK. */ +#define SBG_ECOM_GENERAL_IMU_POWER_OK (0x0001u << 1) /*!< Set to 1 when IMU power supply is OK. */ +#define SBG_ECOM_GENERAL_GPS_POWER_OK (0x0001u << 2) /*!< Set to 1 when GPS power supply is OK. */ +#define SBG_ECOM_GENERAL_SETTINGS_OK (0x0001u << 3) /*!< Set to 1 if settings where correctly loaded. */ +#define SBG_ECOM_GENERAL_TEMPERATURE_OK (0x0001u << 4) /*!< Set to 1 when temperature is within specified limits. */ +#define SBG_ECOM_GENERAL_DATALOGGER_OK (0x0001u << 5) /*!< Set to 1 when the datalogger is working correctly. */ +#define SBG_ECOM_GENERAL_CPU_OK (0x0001u << 6) /*!< Set to 1 if the CPU headroom is correct.*/ + +//----------------------------------------------------------------------// +//- Communication status definitions -// +//----------------------------------------------------------------------// + +/*! + * Communication CAN status definitions. + */ +#define SBG_ECOM_CAN_STATUS_SHIFT (28u) /*!< Shift used to access the CAN status part. */ +#define SBG_ECOM_CAN_STATUS_MASK (0x00000007u) /*!< Mask used to keep only the CAN status part. */ + +/*! + * Communication status bit mask definitions. + */ +#define SBG_ECOM_PORTA_VALID (0x00000001u << 0) /*!< Set to 0 in case of low level communication error. */ +#define SBG_ECOM_PORTB_VALID (0x00000001u << 1) /*!< Set to 0 in case of low level communication error. */ +#define SBG_ECOM_PORTC_VALID (0x00000001u << 2) /*!< Set to 0 in case of low level communication error. */ +#define SBG_ECOM_PORTD_VALID (0x00000001u << 3) /*!< Set to 0 in case of low level communication error. */ +#define SBG_ECOM_PORTE_VALID (0x00000001u << 4) /*!< Set to 0 in case of low level communication error. */ + +#define SBG_ECOM_PORTA_RX_OK (0x00000001u << 5) /*!< Set to 0 in case of error on PORT A input. */ +#define SBG_ECOM_PORTA_TX_OK (0x00000001u << 6) /*!< Set to 0 in case of error on PORT A output. */ +#define SBG_ECOM_PORTB_RX_OK (0x00000001u << 7) /*!< Set to 0 in case of error on PORT B input. */ +#define SBG_ECOM_PORTB_TX_OK (0x00000001u << 8) /*!< Set to 0 in case of error on PORT B output. */ +#define SBG_ECOM_PORTC_RX_OK (0x00000001u << 9) /*!< Set to 0 in case of error on PORT C input. */ +#define SBG_ECOM_PORTC_TX_OK (0x00000001u << 10) /*!< Set to 0 in case of error on PORT C output. */ +#define SBG_ECOM_PORTD_RX_OK (0x00000001u << 11) /*!< Set to 0 in case of error on PORT D input. */ +#define SBG_ECOM_PORTD_TX_OK (0x00000001u << 12) /*!< Set to 0 in case of error on PORT D input. */ +#define SBG_ECOM_PORTE_RX_OK (0x00000001u << 13) /*!< Set to 0 in case of error on PORT E input. */ +#define SBG_ECOM_PORTE_TX_OK (0x00000001u << 14) /*!< Set to 0 in case of error on PORT D input. */ + +#define SBG_ECOM_ETH0_VALID (0x00000001u << 15) /*!< Set to 0 in case of error on ETH0. */ +#define SBG_ECOM_ETH1_VALID (0x00000001u << 16) /*!< Set to 0 in case of error on ETH1. */ +#define SBG_ECOM_ETH2_VALID (0x00000001u << 17) /*!< Set to 0 in case of error on ETH2. */ +#define SBG_ECOM_ETH3_VALID (0x00000001u << 18) /*!< Set to 0 in case of error on ETH3. */ +#define SBG_ECOM_ETH4_VALID (0x00000001u << 19) /*!< Set to 0 in case of error on ETH4. */ + +#define SBG_ECOM_CAN_VALID (0x00000001u << 25) /*!< Set to 0 in case of low level communication error. */ +#define SBG_ECOM_CAN_RX_OK (0x00000001u << 26) /*!< Set to 0 in case of error on CAN Bus input buffer. */ +#define SBG_ECOM_CAN_TX_OK (0x00000001u << 27) /*!< Set to 0 in case of error on CAN Bus output buffer. */ + +/*! + * Communication status for the CAN Bus. + */ +typedef enum _SbgEComCanBusStatus +{ + SBG_ECOM_CAN_BUS_OFF = 0, /*!< Bus OFF operation due to too much errors. */ + SBG_ECOM_CAN_BUS_TX_RX_ERR = 1, /*!< Errors on Tx or Rx. */ + SBG_ECOM_CAN_BUS_OK = 2, /*!< Bus OK. */ + SBG_ECOM_CAN_BUS_ERROR = 3 /*!< Bus error. */ +} SbgEComCanBusStatus; + +//----------------------------------------------------------------------// +//- Aiding status definitions -// +//----------------------------------------------------------------------// +#define SBG_ECOM_AIDING_GPS1_POS_RECV (0x00000001u << 0) /*!< Set to 1 when valid GPS 1 position data is received. */ +#define SBG_ECOM_AIDING_GPS1_VEL_RECV (0x00000001u << 1) /*!< Set to 1 when valid GPS 1 velocity data is received. */ +#define SBG_ECOM_AIDING_GPS1_HDT_RECV (0x00000001u << 2) /*!< Set to 1 when valid GPS 1 true heading data is received. */ +#define SBG_ECOM_AIDING_GPS1_UTC_RECV (0x00000001u << 3) /*!< Set to 1 when valid GPS 1 UTC time data is received. */ +#define SBG_ECOM_AIDING_GPS2_POS_RECV (0x00000001u << 4) /*!< Set to 1 when valid GPS 2 position data is received. */ +#define SBG_ECOM_AIDING_GPS2_VEL_RECV (0x00000001u << 5) /*!< Set to 1 when valid GPS 2 velocity data is received. */ +#define SBG_ECOM_AIDING_GPS2_HDT_RECV (0x00000001u << 6) /*!< Set to 1 when valid GPS 2 true heading data is received. */ +#define SBG_ECOM_AIDING_GPS2_UTC_RECV (0x00000001u << 7) /*!< Set to 1 when valid GPS 2 UTC time data is received. */ +#define SBG_ECOM_AIDING_MAG_RECV (0x00000001u << 8) /*!< Set to 1 when valid Magnetometer data is received. */ +#define SBG_ECOM_AIDING_ODO_RECV (0x00000001u << 9) /*!< Set to 1 when Odometer pulse is received. */ +#define SBG_ECOM_AIDING_DVL_RECV (0x00000001u << 10) /*!< Set to 1 when valid DVL data is received. */ +#define SBG_ECOM_AIDING_USBL_RECV (0x00000001u << 11) /*!< Set to 1 when valid USBL data is received. */ +#define SBG_ECOM_AIDING_DEPTH_RECV (0x00000001u << 12) /*!< Set to 1 when valid Depth Log data is received. */ +#define SBG_ECOM_AIDING_AIR_DATA_RECV (0x00000001u << 13) /*!< Set to 1 when valid Air Data (altitude and/or true airspeed) is received. */ +#define SBG_ECOM_AIDING_USER_POS_RECV (0x00000001u << 14) /*!< Set to 1 when valid user position data is received. */ +#define SBG_ECOM_AIDING_USER_VEL_RECV (0x00000001u << 15) /*!< Set to 1 when valid user velocity data is received. */ +#define SBG_ECOM_AIDING_USER_HEADING_RECV (0x00000001u << 16) /*!< Set to 1 when valid user heading data is received. */ + +//----------------------------------------------------------------------// +//- Status definitions -// +//----------------------------------------------------------------------// + +/*! + * Stores global status data. + */ +typedef struct _SbgLogStatusData +{ + uint32_t timeStamp; /*!< Time in us since the sensor power up. */ + uint16_t generalStatus; /*!< General status bitmask and enums. */ + uint16_t reserved1; /*!< Reserved status field for future use */ + uint32_t comStatus; /*!< Communication status bitmask and enums. */ + uint32_t aidingStatus; /*!< Aiding equipments status bitmask and enums. */ + uint32_t reserved2; /*!< Reserved status field for future use. */ + uint16_t reserved3; /*!< Reserved status field for future use. */ + uint32_t uptime; /*!< System uptime in seconds. */ +} SbgLogStatusData; + +//----------------------------------------------------------------------// +//- Public getters & helpers -// +//----------------------------------------------------------------------// + +/*! + * Method used to read the CAN bus status from a communication status field. + * + * \param[in] status Status field to extract the CAN bus status from it. + * \return The extracted CAN bus status. + */ +SBG_INLINE SbgEComCanBusStatus sbgEComLogStatusGetCanStatus(uint32_t status) +{ + return (SbgEComCanBusStatus)((status >> SBG_ECOM_CAN_STATUS_SHIFT) & SBG_ECOM_CAN_STATUS_MASK); +} + +/*! + * Method used to write the CAN bus status field. + * + * \param[in] canStatus The CAN bus status to set. + * \param[in] masks Bit mask to set. + * \return The build communication status field. + */ +SBG_INLINE uint32_t sbgEComLogStatusBuildCommunicationStatus(SbgEComCanBusStatus canStatus, uint32_t masks) +{ + // + // Create the combined status field + // + return ((((uint32_t)canStatus)&SBG_ECOM_CAN_STATUS_MASK) << SBG_ECOM_CAN_STATUS_SHIFT) | masks; +} + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Parse data for the SBG_ECOM_LOG_STATUS message and fill the corresponding structure. + * + * \param[in] pInputStream Input stream buffer to read the payload from. + * \param[out] pOutputData Pointer on the output structure that stores parsed data. + * \return SBG_NO_ERROR if the payload has been parsed. + */ +SbgErrorCode sbgEComBinaryLogParseStatusData(SbgStreamBuffer *pInputStream, SbgLogStatusData *pOutputData); + +/*! + * Write data for the SBG_ECOM_LOG_STATUS message to the output stream buffer from the provided structure. + * + * \param[out] pOutputStream Output stream buffer to write the payload to. + * \param[in] pInputData Pointer on the input structure that stores data to write. + * \return SBG_NO_ERROR if the message has been generated in the provided buffer. + */ +SbgErrorCode sbgEComBinaryLogWriteStatusData(SbgStreamBuffer *pOutputStream, const SbgLogStatusData *pInputData); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_BINARY_LOG_STATUS_H diff --git a/src/binaryLogs/sbgEComBinaryLogUsbl.c b/src/binaryLogs/sbgEComBinaryLogUsbl.c new file mode 100644 index 0000000..67491d0 --- /dev/null +++ b/src/binaryLogs/sbgEComBinaryLogUsbl.c @@ -0,0 +1,57 @@ +#include "sbgEComBinaryLogUsbl.h" + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComBinaryLogParseUsblData(SbgStreamBuffer *pInputStream, SbgLogUsblData *pOutputData) +{ + assert(pInputStream); + assert(pOutputData); + + // + // Read the frame payload + // + pOutputData->timeStamp = sbgStreamBufferReadUint32LE(pInputStream); + pOutputData->status = sbgStreamBufferReadUint16LE(pInputStream); + + pOutputData->latitude = sbgStreamBufferReadDoubleLE(pInputStream); + pOutputData->longitude = sbgStreamBufferReadDoubleLE(pInputStream); + + pOutputData->depth = sbgStreamBufferReadFloatLE(pInputStream); + + pOutputData->latitudeAccuracy = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->longitudeAccuracy = sbgStreamBufferReadFloatLE(pInputStream); + pOutputData->depthAccuracy = sbgStreamBufferReadFloatLE(pInputStream); + + // + // Return if any error has occurred while parsing the frame + // + return sbgStreamBufferGetLastError(pInputStream); +} + +SbgErrorCode sbgEComBinaryLogWriteUsblData(SbgStreamBuffer *pOutputStream, const SbgLogUsblData *pInputData) +{ + assert(pOutputStream); + assert(pInputData); + + // + // Write the frame payload + // + sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->timeStamp); + sbgStreamBufferWriteUint16LE(pOutputStream, pInputData->status); + + sbgStreamBufferWriteDoubleLE(pOutputStream, pInputData->latitude); + sbgStreamBufferWriteDoubleLE(pOutputStream, pInputData->longitude); + + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->depth); + + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->latitudeAccuracy); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->longitudeAccuracy); + sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->depthAccuracy); + + // + // Return if any error has occurred while writing the frame + // + return sbgStreamBufferGetLastError(pOutputStream); +} diff --git a/src/binaryLogs/sbgEComBinaryLogUsbl.h b/src/binaryLogs/sbgEComBinaryLogUsbl.h new file mode 100644 index 0000000..b6b3a64 --- /dev/null +++ b/src/binaryLogs/sbgEComBinaryLogUsbl.h @@ -0,0 +1,104 @@ +/*! + * \file sbgEComBinaryLogUsbl.h + * \author SBG Systems + * \date 02 June 2014 + * + * \brief Parse received USBL position mesurements logs. + * + * USBL binary logs contains underwater positioning data of a USBL beacon. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_BINARY_LOG_USBL_H +#define SBG_ECOM_BINARY_LOG_USBL_H + +// sbgCommonLib headers +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Log USBL status definitions -// +//----------------------------------------------------------------------// + +/*! + * USBL sensor status mask definitions + */ +#define SBG_ECOM_USBL_TIME_SYNC (0x0001u << 0) /*!< Set to 1 if the USBL sensor data is correctly time synchronized. */ +#define SBG_ECOM_USBL_POSITION_VALID (0x0001u << 1) /*!< Set to 1 if the USBL data represents a valid 2D position. */ +#define SBG_ECOM_USBL_DEPTH_VALID (0x0001u << 2) /*!< Set to 1 if the USBL data has a valid depth information. */ + +//----------------------------------------------------------------------// +//- Log structure definitions -// +//----------------------------------------------------------------------// + +/*! + * Log structure for USBL data. + */ +typedef struct _SbgLogUsblData +{ + uint32_t timeStamp; /*!< Time in us since the sensor power up. */ + uint16_t status; /*!< USBL system status bitmask. */ + + double latitude; /*!< Latitude in degrees, positive north. */ + double longitude; /*!< Longitude in degrees, positive east. */ + + float depth; /*!< Depth in meters below mean sea level (positive down). */ + + float latitudeAccuracy; /*!< 1 sigma latitude accuracy in meters. */ + float longitudeAccuracy; /*!< 1 sigma longitude accuracy in meters. */ + float depthAccuracy; /*!< 1 sigma depth accuracy in meters. */ +} SbgLogUsblData; + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Parse data for the SBG_ECOM_LOG_USBL message and fill the corresponding structure. + * + * \param[in] pInputStream Input stream buffer to read the payload from. + * \param[out] pOutputData Pointer on the output structure that stores parsed data. + * \return SBG_NO_ERROR if the payload has been parsed. + */ +SbgErrorCode sbgEComBinaryLogParseUsblData(SbgStreamBuffer *pInputStream, SbgLogUsblData *pOutputData); + +/*! + * Write data for the SBG_ECOM_LOG_USBL message to the output stream buffer from the provided structure. + * + * \param[out] pOutputStream Output stream buffer to write the payload to. + * \param[in] pInputData Pointer on the input structure that stores data to write. + * \return SBG_NO_ERROR if the message has been generated in the provided buffer. + */ +SbgErrorCode sbgEComBinaryLogWriteUsblData(SbgStreamBuffer *pOutputStream, const SbgLogUsblData *pInputData); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_BINARY_LOG_USBL_H diff --git a/src/binaryLogs/sbgEComBinaryLogUtc.c b/src/binaryLogs/sbgEComBinaryLogUtc.c new file mode 100644 index 0000000..d803438 --- /dev/null +++ b/src/binaryLogs/sbgEComBinaryLogUtc.c @@ -0,0 +1,100 @@ +#include "sbgEComBinaryLogUtc.h" + +//----------------------------------------------------------------------// +//- Private global definitions -// +//----------------------------------------------------------------------// + +/*!< Lookup table for clock status enum */ +static const char *gClockStatusStr[] = +{ + [SBG_ECOM_CLOCK_ERROR] = "SBG_ECOM_CLOCK_ERROR", + [SBG_ECOM_CLOCK_FREE_RUNNING] = "SBG_ECOM_CLOCK_FREE_RUNNING", + [SBG_ECOM_CLOCK_STEERING] = "SBG_ECOM_CLOCK_STEERING", + [SBG_ECOM_CLOCK_VALID] = "SBG_ECOM_CLOCK_VALID" +}; + +/*!< Lookup table for UTC status enum */ +static const char *gUtcStatusStr[] = +{ + [SBG_ECOM_UTC_INVALID] = "SBG_ECOM_UTC_INVALID", + [SBG_ECOM_UTC_NO_LEAP_SEC] = "SBG_ECOM_UTC_NO_LEAP_SEC", + [SBG_ECOM_UTC_VALID] = "SBG_ECOM_UTC_VALID", +}; + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +const char *sbgEcomLogUtcGetClockStatusAsString(const SbgLogUtcData *pLogUtc) +{ + SbgEComClockStatus clockStatus; + + assert(pLogUtc); + + clockStatus = sbgEComLogUtcGetClockStatus(pLogUtc->status); + assert(clockStatus < SBG_ARRAY_SIZE(gClockStatusStr)); + + return gClockStatusStr[clockStatus]; +} + +const char *sbgEcomLogUtcGetUtcStatusAsString(const SbgLogUtcData *pLogUtc) +{ + SbgEComClockUtcStatus utcStatus; + + assert(pLogUtc); + + utcStatus = sbgEComLogUtcGetClockUtcStatus(pLogUtc->status); + assert(utcStatus < SBG_ARRAY_SIZE(gUtcStatusStr)); + + return gUtcStatusStr[utcStatus]; +} + +SbgErrorCode sbgEComBinaryLogParseUtcData(SbgStreamBuffer *pInputStream, SbgLogUtcData *pOutputData) +{ + assert(pInputStream); + assert(pOutputData); + + // + // Read the frame payload + // + pOutputData->timeStamp = sbgStreamBufferReadUint32LE(pInputStream); + pOutputData->status = sbgStreamBufferReadUint16LE(pInputStream); + pOutputData->year = sbgStreamBufferReadUint16LE(pInputStream); + pOutputData->month = sbgStreamBufferReadInt8LE(pInputStream); + pOutputData->day = sbgStreamBufferReadInt8LE(pInputStream); + pOutputData->hour = sbgStreamBufferReadInt8LE(pInputStream); + pOutputData->minute = sbgStreamBufferReadInt8LE(pInputStream); + pOutputData->second = sbgStreamBufferReadInt8LE(pInputStream); + pOutputData->nanoSecond = sbgStreamBufferReadInt32LE(pInputStream); + pOutputData->gpsTimeOfWeek = sbgStreamBufferReadUint32LE(pInputStream); + + // + // Return if any error has occurred while parsing the frame + // + return sbgStreamBufferGetLastError(pInputStream); +} + +SbgErrorCode sbgEComBinaryLogWriteUtcData(SbgStreamBuffer *pOutputStream, const SbgLogUtcData *pInputData) +{ + assert(pOutputStream); + assert(pInputData); + + // + // Write the frame payload + // + sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->timeStamp); + sbgStreamBufferWriteUint16LE(pOutputStream, pInputData->status); + sbgStreamBufferWriteUint16LE(pOutputStream, pInputData->year); + sbgStreamBufferWriteInt8LE(pOutputStream, pInputData->month); + sbgStreamBufferWriteInt8LE(pOutputStream, pInputData->day); + sbgStreamBufferWriteInt8LE(pOutputStream, pInputData->hour); + sbgStreamBufferWriteInt8LE(pOutputStream, pInputData->minute); + sbgStreamBufferWriteInt8LE(pOutputStream, pInputData->second); + sbgStreamBufferWriteInt32LE(pOutputStream, pInputData->nanoSecond); + sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->gpsTimeOfWeek); + + // + // Return if any error has occurred while writing the frame + // + return sbgStreamBufferGetLastError(pOutputStream); +} diff --git a/src/binaryLogs/sbgEComBinaryLogUtc.h b/src/binaryLogs/sbgEComBinaryLogUtc.h new file mode 100644 index 0000000..44f7c0a --- /dev/null +++ b/src/binaryLogs/sbgEComBinaryLogUtc.h @@ -0,0 +1,189 @@ +/*! + * \file sbgEComBinaryLogUtc.h + * \author SBG Systems + * \date 20 February 2013 + * + * \brief Parse logs used to report device UTC time. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_BINARY_LOG_UTC_H +#define SBG_ECOM_BINARY_LOG_UTC_H + +// sbgCommonLib headers +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Clock status definitions -// +//----------------------------------------------------------------------// + +/*! + * Clock status and UTC time status definitions. + */ +#define SBG_ECOM_CLOCK_STATUS_SHIFT (1u) /*!< Shift used to extract the clock status part. */ +#define SBG_ECOM_CLOCK_STATUS_MASK (0x000Fu) /*!< Mask used to keep only the clock status part. */ +#define SBG_ECOM_CLOCK_UTC_STATUS_SHIFT (6u) /*!< Shift used to extract the clock UTC status part. */ +#define SBG_ECOM_CLOCK_UTC_STATUS_MASK (0x000Fu) /*!< Mask used to keep only the clock UTC status part. */ + +/*! + * Clock status mask definitions. + */ +#define SBG_ECOM_CLOCK_STABLE_INPUT (0x0001u << 0) /*!< Set to 1 if a stable input clock could be used to synchronized the internal clock. */ +#define SBG_ECOM_CLOCK_UTC_SYNC (0x0001u << 5) /*!< The UTC time is synchronized with a PPS. */ + +/*! + * Clock status enum. + */ +typedef enum _SbgEComClockStatus +{ + SBG_ECOM_CLOCK_ERROR = 0, /*!< An error has occurred on the clock estimation. */ + SBG_ECOM_CLOCK_FREE_RUNNING = 1, /*!< The clock is only based on the internal crystal. */ + SBG_ECOM_CLOCK_STEERING = 2, /*!< A PPS has been detected and the clock is converging to it. */ + SBG_ECOM_CLOCK_VALID = 3 /*!< The clock has converged to the PPS and is within 500ns. */ +} SbgEComClockStatus; + +/*! + * Status for the UTC time data. + */ +typedef enum _SbgEComClockUtcStatus +{ + SBG_ECOM_UTC_INVALID = 0, /*!< The UTC time is not known, we are just propagating the UTC time internally. */ + SBG_ECOM_UTC_NO_LEAP_SEC = 1, /*!< We have received valid UTC time information but we don't have the leap seconds information. */ + SBG_ECOM_UTC_VALID = 2 /*!< We have received valid UTC time data with valid leap seconds. */ +} SbgEComClockUtcStatus; + +//----------------------------------------------------------------------// +//- Clock status helpers methods -// +//----------------------------------------------------------------------// + +/*! + * Method used to read the clock status from a status field. + * + * \param[in] status Status field to extract the clock status from it. + * \return The extracted clock status. + */ +SBG_INLINE SbgEComClockStatus sbgEComLogUtcGetClockStatus(uint16_t status) +{ + return (SbgEComClockStatus)((status >> SBG_ECOM_CLOCK_STATUS_SHIFT) & SBG_ECOM_CLOCK_STATUS_MASK); +} + +/*! + * Method used to read the UTC time status from a clock status field. + * + * \param[in] status Status field to extract the UTC time status from it. + * \return The extracted UTC time status. + */ +SBG_INLINE SbgEComClockUtcStatus sbgEComLogUtcGetClockUtcStatus(uint16_t status) +{ + return (SbgEComClockUtcStatus)((status >> SBG_ECOM_CLOCK_UTC_STATUS_SHIFT) & SBG_ECOM_CLOCK_UTC_STATUS_MASK); +} + +/*! + * Method used to write the clock status field. + * + * \param[in] clockStatus The clock status to set. + * \param[in] utcStatus The UTC time status to set. + * \param[in] masks Bit mask to set. + * \return The build clock status field. + */ +SBG_INLINE uint16_t sbgEComLogUtcBuildClockStatus(SbgEComClockStatus clockStatus, SbgEComClockUtcStatus utcStatus, uint16_t masks) +{ + // + // Create the combined status field + // + return ((((uint16_t)clockStatus)&SBG_ECOM_CLOCK_STATUS_MASK) << SBG_ECOM_CLOCK_STATUS_SHIFT) | + ((((uint16_t)utcStatus)&SBG_ECOM_CLOCK_UTC_STATUS_MASK) << SBG_ECOM_CLOCK_UTC_STATUS_SHIFT) | masks; +} + +//----------------------------------------------------------------------// +//- Log structure definitions -// +//----------------------------------------------------------------------// + +/*! + * Structure that stores data for the SBG_ECOM_LOG_UTC_TIME message. + */ +typedef struct _SbgLogUtcData +{ + uint32_t timeStamp; /*!< Time in us since the sensor power up. */ + uint16_t status; /*!< UTC time and clock status information */ + uint16_t year; /*!< Year for example: 2013. */ + int8_t month; /*!< Month in year [1 .. 12]. */ + int8_t day; /*!< Day in month [1 .. 31]. */ + int8_t hour; /*!< Hour in day [0 .. 23]. */ + int8_t minute; /*!< Minute in hour [0 .. 59]. */ + int8_t second; /*!< Second in minute [0 .. 60]. (60 is used only when a leap second is added) */ + int32_t nanoSecond; /*!< Nanosecond of current second in ns. */ + uint32_t gpsTimeOfWeek; /*!< GPS time of week in ms. */ +} SbgLogUtcData; + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Returns the clock status as a NULL terminated C string. + * + * \param[in] pLogUtc UTC log instance. + * \return The clock status as a C string. + */ +const char *sbgEcomLogUtcGetClockStatusAsString(const SbgLogUtcData *pLogUtc); + + +/*! + * Returns the UTC status as a NULL terminated C string. + * + * \param[in] pLogUtc UTC log instance. + * \return The UTC status as a C string. + */ +const char *sbgEcomLogUtcGetUtcStatusAsString(const SbgLogUtcData *pLogUtc); + +/*! + * Parse data for the SBG_ECOM_LOG_UTC_DATA message and fill the corresponding structure. + * + * \param[in] pInputStream Input stream buffer to read the payload from. + * \param[out] pOutputData Pointer on the output structure that stores parsed data. + * \return SBG_NO_ERROR if the payload has been parsed. + */ +SbgErrorCode sbgEComBinaryLogParseUtcData(SbgStreamBuffer *pInputStream, SbgLogUtcData *pOutputData); + +/*! + * Write data for the SBG_ECOM_LOG_UTC_DATA message to the output stream buffer from the provided structure. + * + * \param[out] pOutputStream Output stream buffer to write the payload to. + * \param[in] pInputData Pointer on the input structure that stores data to write. + * \return SBG_NO_ERROR if the message has been generated in the provided buffer. + */ +SbgErrorCode sbgEComBinaryLogWriteUtcData(SbgStreamBuffer *pOutputStream, const SbgLogUtcData *pInputData); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_BINARY_LOG_UTC_H diff --git a/src/binaryLogs/sbgEComBinaryLogs.c b/src/binaryLogs/sbgEComBinaryLogs.c new file mode 100644 index 0000000..a4f2cac --- /dev/null +++ b/src/binaryLogs/sbgEComBinaryLogs.c @@ -0,0 +1,162 @@ +// sbgCommonLib headers +#include +#include + +// Project headers +#include + +// Local headers +#include "sbgEComBinaryLogAirData.h" +#include "sbgEComBinaryLogDepth.h" +#include "sbgEComBinaryLogDiag.h" +#include "sbgEComBinaryLogDvl.h" +#include "sbgEComBinaryLogEkf.h" +#include "sbgEComBinaryLogEvent.h" +#include "sbgEComBinaryLogGps.h" +#include "sbgEComBinaryLogImu.h" +#include "sbgEComBinaryLogMag.h" +#include "sbgEComBinaryLogOdometer.h" +#include "sbgEComBinaryLogRtcm.h" +#include "sbgEComBinaryLogShipMotion.h" +#include "sbgEComBinaryLogStatus.h" +#include "sbgEComBinaryLogUsbl.h" +#include "sbgEComBinaryLogUtc.h" +#include "sbgEComBinaryLogs.h" + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComBinaryLogParse(SbgEComClass msgClass, SbgEComMsgId msg, const void *pPayload, size_t payloadSize, SbgBinaryLogData *pOutputData) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgStreamBuffer inputStream; + + assert(pPayload); + assert(payloadSize > 0); + assert(pOutputData); + + // + // Create an input stream buffer that points to the frame payload so we can easily parse it's content + // + sbgStreamBufferInitForRead(&inputStream, pPayload, payloadSize); + + // + // Handle the different classes of messages differently + // + if (msgClass == SBG_ECOM_CLASS_LOG_ECOM_0) + { + // + // Parse the incoming log according to its type + // + switch (msg) + { + case SBG_ECOM_LOG_STATUS: + errorCode = sbgEComBinaryLogParseStatusData(&inputStream, &pOutputData->statusData); + break; + case SBG_ECOM_LOG_IMU_DATA: + errorCode = sbgEComBinaryLogParseImuData(&inputStream, &pOutputData->imuData); + break; + case SBG_ECOM_LOG_IMU_SHORT: + errorCode = sbgEComBinaryLogParseImuShort(&inputStream, &pOutputData->imuShort); + break; + case SBG_ECOM_LOG_EKF_EULER: + errorCode = sbgEComBinaryLogParseEkfEulerData(&inputStream, &pOutputData->ekfEulerData); + break; + case SBG_ECOM_LOG_EKF_QUAT: + errorCode = sbgEComBinaryLogParseEkfQuatData(&inputStream, &pOutputData->ekfQuatData); + break; + case SBG_ECOM_LOG_EKF_NAV: + errorCode = sbgEComBinaryLogParseEkfNavData(&inputStream, &pOutputData->ekfNavData); + break; + case SBG_ECOM_LOG_SHIP_MOTION: + case SBG_ECOM_LOG_SHIP_MOTION_HP: + errorCode = sbgEComBinaryLogParseShipMotionData(&inputStream, &pOutputData->shipMotionData); + break; + case SBG_ECOM_LOG_ODO_VEL: + errorCode = sbgEComBinaryLogParseOdometerData(&inputStream, &pOutputData->odometerData); + break; + case SBG_ECOM_LOG_UTC_TIME: + errorCode = sbgEComBinaryLogParseUtcData(&inputStream, &pOutputData->utcData); + break; + case SBG_ECOM_LOG_GPS1_VEL: + case SBG_ECOM_LOG_GPS2_VEL: + errorCode = sbgEComBinaryLogParseGpsVelData(&inputStream, &pOutputData->gpsVelData); + break; + case SBG_ECOM_LOG_GPS1_POS: + case SBG_ECOM_LOG_GPS2_POS: + errorCode = sbgEComBinaryLogParseGpsPosData(&inputStream, &pOutputData->gpsPosData); + break; + case SBG_ECOM_LOG_GPS1_HDT: + case SBG_ECOM_LOG_GPS2_HDT: + errorCode = sbgEComBinaryLogParseGpsHdtData(&inputStream, &pOutputData->gpsHdtData); + break; + case SBG_ECOM_LOG_GPS1_RAW: + case SBG_ECOM_LOG_GPS2_RAW: + errorCode = sbgEComBinaryLogParseGpsRawData(&inputStream, &pOutputData->gpsRawData); + break; + case SBG_ECOM_LOG_RTCM_RAW: + errorCode = sbgEComBinaryLogParseRtcmRawData(&inputStream, &pOutputData->rtcmRawData); + break; + case SBG_ECOM_LOG_MAG: + errorCode = sbgEComBinaryLogParseMagData(&inputStream, &pOutputData->magData); + break; + case SBG_ECOM_LOG_MAG_CALIB: + errorCode = sbgEComBinaryLogParseMagCalibData(&inputStream, &pOutputData->magCalibData); + break; + case SBG_ECOM_LOG_DVL_BOTTOM_TRACK: + errorCode = sbgEComBinaryLogParseDvlData(&inputStream, &pOutputData->dvlData); + break; + case SBG_ECOM_LOG_DVL_WATER_TRACK: + errorCode = sbgEComBinaryLogParseDvlData(&inputStream, &pOutputData->dvlData); + break; + case SBG_ECOM_LOG_AIR_DATA: + errorCode = sbgEComBinaryLogParseAirData(&inputStream, &pOutputData->airData); + break; + case SBG_ECOM_LOG_USBL: + errorCode = sbgEComBinaryLogParseUsblData(&inputStream, &pOutputData->usblData); + break; + case SBG_ECOM_LOG_DEPTH: + errorCode = sbgEComBinaryLogParseDepth(&inputStream, &pOutputData->depthData); + break; + case SBG_ECOM_LOG_EVENT_A: + case SBG_ECOM_LOG_EVENT_B: + case SBG_ECOM_LOG_EVENT_C: + case SBG_ECOM_LOG_EVENT_D: + case SBG_ECOM_LOG_EVENT_E: + case SBG_ECOM_LOG_EVENT_OUT_A: + case SBG_ECOM_LOG_EVENT_OUT_B: + errorCode = sbgEComBinaryLogParseEvent(&inputStream, &pOutputData->eventMarker); + break; + case SBG_ECOM_LOG_DIAG: + errorCode = sbgEComBinaryLogParseDiagData(&inputStream, &pOutputData->diagData); + break; + + default: + errorCode = SBG_ERROR; + } + } + else if (msgClass == SBG_ECOM_CLASS_LOG_ECOM_1) + { + // + // Parse the message depending on the message ID + // + switch ((SbgEComLog1)msg) + { + case SBG_ECOM_LOG_FAST_IMU_DATA: + errorCode = sbgEComBinaryLogParseFastImuData(&inputStream, &pOutputData->fastImuData); + break; + default: + errorCode = SBG_ERROR; + } + } + else + { + // + // Un-handled message class + // + errorCode = SBG_ERROR; + } + + return errorCode; +} diff --git a/src/binaryLogs/sbgEComBinaryLogs.h b/src/binaryLogs/sbgEComBinaryLogs.h new file mode 100644 index 0000000..bed4482 --- /dev/null +++ b/src/binaryLogs/sbgEComBinaryLogs.h @@ -0,0 +1,119 @@ +/*! + * \file sbgEComBinaryLogs.h + * \author SBG Systems + * \date 06 February 2013 + * + * \brief Parse incoming sbgECom logs and store result in an union. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_BINARY_LOGS_H +#define SBG_ECOM_BINARY_LOGS_H + + // sbgCommonLib headers +#include + +// Project headers +#include + +// Local headers +#include "sbgEComBinaryLogAirData.h" +#include "sbgEComBinaryLogDepth.h" +#include "sbgEComBinaryLogDiag.h" +#include "sbgEComBinaryLogDvl.h" +#include "sbgEComBinaryLogEkf.h" +#include "sbgEComBinaryLogEvent.h" +#include "sbgEComBinaryLogGps.h" +#include "sbgEComBinaryLogImu.h" +#include "sbgEComBinaryLogMag.h" +#include "sbgEComBinaryLogOdometer.h" +#include "sbgEComBinaryLogRawData.h" +#include "sbgEComBinaryLogRtcm.h" +#include "sbgEComBinaryLogShipMotion.h" +#include "sbgEComBinaryLogStatus.h" +#include "sbgEComBinaryLogUsbl.h" +#include "sbgEComBinaryLogUtc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Log structure definitions -// +//----------------------------------------------------------------------// + +/*! + * Union used to store received logs data. + */ +typedef union _SbgBinaryLogData +{ + SbgLogStatusData statusData; /*!< Stores data for the SBG_ECOM_LOG_STATUS message. */ + SbgLogImuData imuData; /*!< Stores data for the SBG_ECOM_LOG_IMU_DATA message. */ + SbgLogImuShort imuShort; /*!< Stores data for the SBG_ECOM_LOG_IMU_SHORT message. */ + SbgLogEkfEulerData ekfEulerData; /*!< Stores data for the SBG_ECOM_LOG_EKF_EULER message. */ + SbgLogEkfQuatData ekfQuatData; /*!< Stores data for the SBG_ECOM_LOG_EKF_QUAT message. */ + SbgLogEkfNavData ekfNavData; /*!< Stores data for the SBG_ECOM_LOG_EKF_NAV message. */ + SbgLogShipMotionData shipMotionData; /*!< Stores data for the SBG_ECOM_LOG_SHIP_MOTION or SBG_ECOM_LOG_SHIP_MOTION_HP message. */ + SbgLogOdometerData odometerData; /*!< Stores data for the SBG_ECOM_LOG_ODO_VEL message. */ + SbgLogUtcData utcData; /*!< Stores data for the SBG_ECOM_LOG_UTC_TIME message. */ + SbgLogGpsPos gpsPosData; /*!< Stores data for the SBG_ECOM_LOG_GPS_POS message. */ + SbgLogGpsVel gpsVelData; /*!< Stores data for the SBG_ECOM_LOG_GPS#_VEL message. */ + SbgLogGpsHdt gpsHdtData; /*!< Stores data for the SBG_ECOM_LOG_GPS#_HDT message. */ + SbgLogRawData gpsRawData; /*!< Stores data for the SBG_ECOM_LOG_GPS#_RAW message. */ + SbgLogRawData rtcmRawData; /*!< Stores data for the SBG_ECOM_LOG_RTCM_RAW message. */ + SbgLogMag magData; /*!< Stores data for the SBG_ECOM_LOG_MAG message. */ + SbgLogMagCalib magCalibData; /*!< Stores data for the SBG_ECOM_LOG_MAG_CALIB message. */ + SbgLogDvlData dvlData; /*!< Stores data for the SBG_ECOM_LOG_DVL_BOTTOM_TRACK message. */ + SbgLogAirData airData; /*!< Stores data for the SBG_ECOM_LOG_AIR_DATA message. */ + SbgLogUsblData usblData; /*!< Stores data for the SBG_ECOM_LOG_USBL message. */ + SbgLogDepth depthData; /*!< Stores data for the SBG_ECOM_LOG_DEPTH message */ + SbgLogEvent eventMarker; /*!< Stores data for the SBG_ECOM_LOG_EVENT_# message. */ + SbgLogDiagData diagData; /*!< Stores data for the SBG_ECOM_LOG_DIAG message. */ + + /* Fast logs */ + SbgLogFastImuData fastImuData; /*!< Stores Fast Imu Data for 1KHz output */ + +} SbgBinaryLogData; + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Parse an incoming log and fill the output union. + * + * \param[in] msgClass Received message class + * \param[in] msg Received message ID + * \param[in] pPayload Read only pointer on the payload buffer. + * \param[in] payloadSize Payload size in bytes. + * \param[out] pOutputData Pointer on the output union that stores parsed data. + */ +SbgErrorCode sbgEComBinaryLogParse(SbgEComClass msgClass, SbgEComMsgId msg, const void *pPayload, size_t payloadSize, SbgBinaryLogData *pOutputData); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_BINARY_LOGS_H diff --git a/src/commands/sbgEComCmd.h b/src/commands/sbgEComCmd.h new file mode 100644 index 0000000..9d2aaf8 --- /dev/null +++ b/src/commands/sbgEComCmd.h @@ -0,0 +1,56 @@ +/*! + * \file sbgEComCmd.h + * \author SBG Systems + * \date 16 June 2014 + * + * \brief Include all available sbgECom commands. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_CMD_H +#define SBG_ECOM_CMD_H + +// sbgCommonLib headers +#include + +// Local headers +#include "sbgEComCmdAdvanced.h" +#include "sbgEComCmdAirData.h" +#include "sbgEComCmdApi.h" +#include "sbgEComCmdDvl.h" +#include "sbgEComCmdEthernet.h" +#include "sbgEComCmdEvent.h" +#include "sbgEComCmdFeatures.h" +#include "sbgEComCmdGnss.h" +#include "sbgEComCmdInfo.h" +#include "sbgEComCmdInterface.h" +#include "sbgEComCmdLicense.h" +#include "sbgEComCmdMag.h" +#include "sbgEComCmdOdo.h" +#include "sbgEComCmdOutput.h" +#include "sbgEComCmdSensor.h" +#include "sbgEComCmdSettings.h" + +#endif // SBG_ECOM_CMD_H diff --git a/src/commands/sbgEComCmdAdvanced.c b/src/commands/sbgEComCmdAdvanced.c new file mode 100644 index 0000000..d0df61c --- /dev/null +++ b/src/commands/sbgEComCmdAdvanced.c @@ -0,0 +1,318 @@ +// sbgCommonLib headers +#include +#include + +// Project headers +#include + +// Local headers +#include "sbgEComCmdAdvanced.h" +#include "sbgEComCmdCommon.h" + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComCmdAdvancedGetConf(SbgEComHandle *pHandle, SbgEComAdvancedConf *pConf) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComProtocolPayload receivedPayload; + uint32_t trial; + + assert(pHandle); + assert(pConf); + + sbgEComProtocolPayloadConstruct(&receivedPayload); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the command without payload since this is a no-payload command + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_ADVANCED_CONF, NULL, 0); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComReceiveCmd2(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_ADVANCED_CONF, &receivedPayload, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a SBG_ECOM_CMD_ADVANCED_CONF command + // + if (errorCode == SBG_NO_ERROR) + { + SbgStreamBuffer inputStream; + + // + // Initialize stream buffer to read parameters + // + sbgStreamBufferInitForRead(&inputStream, sbgEComProtocolPayloadGetBuffer(&receivedPayload), sbgEComProtocolPayloadGetSize(&receivedPayload)); + + // + // Read the mandatory time reference parameter + // + pConf->timeReference = (SbgEComTimeReferenceSrc)sbgStreamBufferReadUint8LE(&inputStream); + errorCode = sbgStreamBufferGetLastError(&inputStream); + + if (errorCode == SBG_NO_ERROR) + { + // + // The GNSS options parameter has been introduced in ELLIPSE firmware v2.2 + // We shouldn't report it as an error for older firmware + // + pConf->gnssOptions = sbgStreamBufferReadUint32LE(&inputStream); + + if (sbgStreamBufferGetLastError(&inputStream) == SBG_NO_ERROR) + { + // + // The NMEA options parameter has been introduced in ELLIPSE firmware v2.3 + // We shouldn't report it as an error for older firmware + // + pConf->nmeaOptions = sbgStreamBufferReadUint32LE(&inputStream); + + if (sbgStreamBufferGetLastError(&inputStream) == SBG_NO_ERROR) + { + errorCode = SBG_NO_ERROR; + } + else + { + pConf->nmeaOptions = 0; + } + } + else + { + pConf->gnssOptions = 0; + } + } + + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + sbgEComProtocolPayloadDestroy(&receivedPayload); + + return errorCode; +} + +SbgErrorCode sbgEComCmdAdvancedSetConf(SbgEComHandle *pHandle, const SbgEComAdvancedConf *pConf) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + uint32_t trial; + uint8_t outputBuffer[9]; + SbgStreamBuffer outputStream; + + assert(pHandle); + assert(pConf); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Init stream buffer for output + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + + // + // Build payload + // + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)pConf->timeReference); + sbgStreamBufferWriteUint32LE(&outputStream, pConf->gnssOptions); + sbgStreamBufferWriteUint32LE(&outputStream, pConf->nmeaOptions); + + // + // Send the payload over ECom + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_ADVANCED_CONF, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComWaitForAck(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_ADVANCED_CONF, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a valid ACK + // + if (errorCode == SBG_NO_ERROR) + { + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + return errorCode; +} + +SbgErrorCode sbgEComCmdAdvancedGetThresholds(SbgEComHandle *pHandle, SbgEComValidityThresholds *pConf) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComProtocolPayload receivedPayload; + uint32_t trial; + + assert(pHandle); + assert(pConf); + + sbgEComProtocolPayloadConstruct(&receivedPayload); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the command without payload since this is a no-payload command + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_VALIDITY_THRESHOLDS, NULL, 0); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComReceiveCmd2(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_VALIDITY_THRESHOLDS, &receivedPayload, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a SBG_ECOM_CMD_VALIDITY_THRESHOLDS command + // + if (errorCode == SBG_NO_ERROR) + { + SbgStreamBuffer inputStream; + + // + // Initialize stream buffer to read parameters + // + sbgStreamBufferInitForRead(&inputStream, sbgEComProtocolPayloadGetBuffer(&receivedPayload), sbgEComProtocolPayloadGetSize(&receivedPayload)); + + // + // Read parameters and check payload consistency + // + pConf->positionThreshold = sbgStreamBufferReadFloatLE(&inputStream); + pConf->velocityThreshold = sbgStreamBufferReadFloatLE(&inputStream); + pConf->attitudeThreshold = sbgStreamBufferReadFloatLE(&inputStream); + pConf->headingThreshold = sbgStreamBufferReadFloatLE(&inputStream); + + errorCode = sbgStreamBufferGetLastError(&inputStream); + + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + sbgEComProtocolPayloadDestroy(&receivedPayload); + + return errorCode; +} + +SbgErrorCode sbgEComCmdAdvancedSetThresholds(SbgEComHandle *pHandle, const SbgEComValidityThresholds *pConf) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + uint32_t trial; + uint8_t outputBuffer[4*sizeof(float)]; + SbgStreamBuffer outputStream; + + assert(pHandle); + assert(pConf); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Init stream buffer for output + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + + // + // Build payload + // + sbgStreamBufferWriteFloatLE(&outputStream, pConf->positionThreshold); + sbgStreamBufferWriteFloatLE(&outputStream, pConf->velocityThreshold); + sbgStreamBufferWriteFloatLE(&outputStream, pConf->attitudeThreshold); + sbgStreamBufferWriteFloatLE(&outputStream, pConf->headingThreshold); + + // + // Send the payload over ECom + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_VALIDITY_THRESHOLDS, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComWaitForAck(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_VALIDITY_THRESHOLDS, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a valid ACK + // + if (errorCode == SBG_NO_ERROR) + { + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + return errorCode; +} diff --git a/src/commands/sbgEComCmdAdvanced.h b/src/commands/sbgEComCmdAdvanced.h new file mode 100644 index 0000000..ca87851 --- /dev/null +++ b/src/commands/sbgEComCmdAdvanced.h @@ -0,0 +1,141 @@ +/*! + * \file sbgEComCmdAdvanced.h + * \author SBG Systems + * \date 11 June 2014 + * + * \brief Advanced settings related commands. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_CMD_ADVANCED_H +#define SBG_ECOM_CMD_ADVANCED_H + +// sbgCommonLib headers +#include + +// Project headers +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Advanced definitions -// +//----------------------------------------------------------------------// + +/*! + * List of available time reference source. + */ +typedef enum _SbgEComTimeReferenceSrc +{ + SBG_ECOM_TIME_REF_DISABLED = 0, /*!< The device is running it's internal clock without any time reference. */ + SBG_ECOM_TIME_REF_SYNC_IN_A, /*!< The main port sync in A is used as a time reference. */ + SBG_ECOM_TIME_REF_UTC_GPS_1 /*!< The GPS 1 module is used to provide both time reference and UTC data. */ +} SbgEComTimeReferenceSrc; + +/*! + * List all options for the GNSS bitmask options + */ +#define SBG_ECOM_GNSS_OPT_01 (uint32_t)(0x00000001 << 0) /*!< Reserved advanced GNSS option for ELLIPSE-N/D v3 */ + +/*! + * List all options for the NMEA bitmask options + */ +#define SBG_ECOM_NMEA_OPT_MODE_STD (uint32_t)(0x00000001 << 0) /*!< Output NMEA messages that complies with 82 chars limit */ +#define SBG_ECOM_NMEA_OPT_FORCE_UTC (uint32_t)(0x00000001 << 4) /*!< Always output time in NMEA messages even if invalid */ + +//----------------------------------------------------------------------// +//- Advanced configurations -// +//----------------------------------------------------------------------// + +/*! + * Structure containing all the info for advanced configuration. + */ +typedef struct _SbgEComAdvancedConf +{ + SbgEComTimeReferenceSrc timeReference; /*!< Time reference source for clock alignment. */ + uint32_t gnssOptions; /*!< Advanced GNSS options - contact SBG Systems. */ + uint32_t nmeaOptions; /*!< Advanced NMEA output options. */ +} SbgEComAdvancedConf; + +/*! + * Structure containing all validity thresholds (status outputs) + * Setting these thresholds to 0.0 will keep default configuration + */ +typedef struct _SbgEComValidityThresholds +{ + float positionThreshold; /*!< Norm of the position standard deviation threshold to raise position valid flag (m)*/ + float velocityThreshold; /*!< Norm of the velocity standard deviation threshold to raise velocity valid flag (m/s)*/ + float attitudeThreshold; /*!< Max of the roll/pitch standard deviations threshold to raise attitude valid flag (rad) */ + float headingThreshold; /*!< Heading standard deviations threshold to raise heading valid flag (rad) */ +} SbgEComValidityThresholds; + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Retrieve the advanced configurations. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[out] pConf Pointer to a SbgEComAdvancedConf to contain the current configuration. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdAdvancedGetConf(SbgEComHandle *pHandle, SbgEComAdvancedConf *pConf); + +/*! + * Set the advanced configurations. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] pConf Pointer to a SbgEComAdvancedConf that contains the new configuration. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdAdvancedSetConf(SbgEComHandle *pHandle, const SbgEComAdvancedConf *pConf); + +/*! + * Retrieve the current validity thresholds + * + * \param[in] pHandle A valid sbgECom handle. + * \param[out] pConf Pointer to a SbgEComValidityThresholds to contain the current configuration. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ + +SbgErrorCode sbgEComCmdAdvancedGetThresholds(SbgEComHandle *pHandle, SbgEComValidityThresholds *pConf); + +/*! + * Set the validity thresholds + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] pConf Pointer to a SbgEComValidityThresholds that contains the new configuration. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdAdvancedSetThresholds(SbgEComHandle *pHandle, const SbgEComValidityThresholds *pConf); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_CMD_ADVANCED_H diff --git a/src/commands/sbgEComCmdAirData.c b/src/commands/sbgEComCmdAirData.c new file mode 100644 index 0000000..5ae9a6c --- /dev/null +++ b/src/commands/sbgEComCmdAirData.c @@ -0,0 +1,323 @@ +// sbgCommonLib headers +#include +#include + +// Project headers +#include + +// Local headers +#include "sbgEComCmdAirData.h" +#include "sbgEComCmdCommon.h" + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + + +SbgErrorCode sbgEComCmdAirDataSetModelId(SbgEComHandle *pHandle, SbgEComAirDataModelsIds modelId) +{ + assert(pHandle); + + return sbgEComCmdGenericSetModelId(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_AIRDATA_MODEL_ID, modelId); +} + +SbgErrorCode sbgEComCmdAirDataGetModelId(SbgEComHandle *pHandle, SbgEComAirDataModelsIds *pModelId) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + uint32_t modelIdAsUint; + + assert(pHandle); + assert(pModelId); + + errorCode = sbgEComCmdGenericGetModelId(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_AIRDATA_MODEL_ID, &modelIdAsUint); + + if (errorCode == SBG_NO_ERROR) + { + *pModelId = (SbgEComAirDataModelsIds)modelIdAsUint; + } + + return errorCode; +} + +SbgErrorCode sbgEComCmdAirDataSetLeverArm(SbgEComHandle *pHandle, const float *pLeverArm) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + uint32_t trial; + uint8_t outputBuffer[64]; + SbgStreamBuffer outputStream; + + assert(pHandle); + assert(pLeverArm); + + // + // Create the command payload + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + + // + // Build payload + // + sbgStreamBufferWriteFloatLE(&outputStream, pLeverArm[0]); + sbgStreamBufferWriteFloatLE(&outputStream, pLeverArm[1]); + sbgStreamBufferWriteFloatLE(&outputStream, pLeverArm[2]); + + // + // Make sure the payload has been build correctly + // + errorCode = sbgStreamBufferGetLastError(&outputStream); + + if (errorCode == SBG_NO_ERROR) + { + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the payload over ECom + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_AIRDATA_LEVER_ARM, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComWaitForAck(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_AIRDATA_LEVER_ARM, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a valid ACK + // + if (errorCode == SBG_NO_ERROR) + { + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + } + + return errorCode; +} + +SbgErrorCode sbgEComCmdAirDataGetLeverArm(SbgEComHandle *pHandle, float *pLeverArm) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComProtocolPayload receivedPayload; + uint32_t trial; + + assert(pHandle); + assert(pLeverArm); + + sbgEComProtocolPayloadConstruct(&receivedPayload); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the command only since this is a no-payload command + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_AIRDATA_LEVER_ARM, NULL, 0); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComReceiveCmd2(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_AIRDATA_LEVER_ARM, &receivedPayload, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a SBG_ECOM_CMD_GNSS_1_LEVER_ARM_ALIGNMENT command + // + if (errorCode == SBG_NO_ERROR) + { + SbgStreamBuffer inputStream; + + // + // Initialize stream buffer to parse the payload + // + sbgStreamBufferInitForRead(&inputStream, sbgEComProtocolPayloadGetBuffer(&receivedPayload), sbgEComProtocolPayloadGetSize(&receivedPayload)); + + pLeverArm[0] = sbgStreamBufferReadFloatLE(&inputStream); + pLeverArm[1] = sbgStreamBufferReadFloatLE(&inputStream); + pLeverArm[2] = sbgStreamBufferReadFloatLE(&inputStream); + + // + // The command has been executed successfully so return if an error has occurred during payload parsing + // + errorCode = sbgStreamBufferGetLastError(&inputStream); + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + sbgEComProtocolPayloadDestroy(&receivedPayload); + + return errorCode; +} + +SbgErrorCode sbgEComCmdAirDataSetRejection(SbgEComHandle *pHandle, const SbgEComAirDataRejectionConf *pRejectConf) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + uint32_t trial; + uint8_t outputBuffer[2 * sizeof(uint8_t)]; + SbgStreamBuffer outputStream; + + assert(pHandle); + assert(pRejectConf); + + // + // Create the command payload + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + + // + // Build payload + // + sbgStreamBufferWriteUint8LE(&outputStream, pRejectConf->airspeed); + sbgStreamBufferWriteUint8LE(&outputStream, pRejectConf->altitude); + + // + // Make sure the payload has been build correctly + // + errorCode = sbgStreamBufferGetLastError(&outputStream); + + if (errorCode == SBG_NO_ERROR) + { + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the payload over ECom + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_AIRDATA_REJECT_MODES, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComWaitForAck(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_AIRDATA_REJECT_MODES, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a valid ACK + // + if (errorCode == SBG_NO_ERROR) + { + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + } + + return errorCode; +} + +SbgErrorCode sbgEComCmdAirDataGetRejection(SbgEComHandle *pHandle, SbgEComAirDataRejectionConf *pRejectConf) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComProtocolPayload receivedPayload; + uint32_t trial; + + assert(pHandle); + assert(pRejectConf); + + sbgEComProtocolPayloadConstruct(&receivedPayload); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the command only since this is a no-payload command + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_AIRDATA_REJECT_MODES, NULL, 0); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComReceiveCmd2(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_AIRDATA_REJECT_MODES, &receivedPayload, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a SBG_ECOM_CMD_GNSS_1_REJECT_MODES command + // + if (errorCode == SBG_NO_ERROR) + { + SbgStreamBuffer inputStream; + + // + // Initialize stream buffer to parse payload + // + sbgStreamBufferInitForRead(&inputStream, sbgEComProtocolPayloadGetBuffer(&receivedPayload), sbgEComProtocolPayloadGetSize(&receivedPayload)); + + // + // Parse the payload + // + pRejectConf->airspeed = (SbgEComRejectionMode)sbgStreamBufferReadUint8LE(&inputStream); + pRejectConf->altitude = (SbgEComRejectionMode)sbgStreamBufferReadUint8LE(&inputStream); + + // + // The command has been executed successfully so return if an error has occurred during payload parsing + // + errorCode = sbgStreamBufferGetLastError(&inputStream); + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + sbgEComProtocolPayloadDestroy(&receivedPayload); + + return errorCode; +} diff --git a/src/commands/sbgEComCmdAirData.h b/src/commands/sbgEComCmdAirData.h new file mode 100644 index 0000000..97de602 --- /dev/null +++ b/src/commands/sbgEComCmdAirData.h @@ -0,0 +1,133 @@ +/*! + * \file sbgEComCmdAirData.h + * \author SBG Systems + * \date 18 February 2019 + * + * \brief AirData aiding module configuration commands. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_CMD_AIR_DATA_H +#define SBG_ECOM_CMD_AIR_DATA_H + +// sbgCommonLib headers +#include + +// Project headers +#include + +// Local headers +#include "sbgEComCmdCommon.h" + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Public definitions -// +//----------------------------------------------------------------------// + +/*! + * This enum defines the different AirData model IDs available in standard + */ +typedef enum _SbgEComAirDataModelsIds +{ + SBG_ECOM_AIR_DATA_MODEL_INTERNAL = 1, /*!< Use the internal barometer sensor if available. */ + SBG_ECOM_AIR_DATA_MODEL_GENERIC_ECOM = 2, /*!< Generic AirData model using sbgECom input protocol format. */ + SBG_ECOM_AIR_DATA_MODEL_AHRS_500 = 3, /*!< Crossbow AHRS-500 compatible input for barometric altitude and airspeed. */ +} SbgEComAirDataModelsIds; + +/*! + * Holds all necessary information for AirData module data rejection. + */ +typedef struct _SbgEComAirDataRejectionConf +{ + SbgEComRejectionMode airspeed; /*!< Rejection mode for the true air speed measurement. */ + SbgEComRejectionMode altitude; /*!< Rejection mode for the barometric altitude measurement. */ +} SbgEComAirDataRejectionConf; + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Set the AirData model to use that both defines the protocol as well as the associated error model. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] modelId AirData model ID to set + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdAirDataSetModelId(SbgEComHandle *pHandle, SbgEComAirDataModelsIds modelId); + +/*! + * Retrieve the AirData model id currently in use by the device. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[out] pModelId Returns the AirData model ID currently in use by the device. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdAirDataGetModelId(SbgEComHandle *pHandle, SbgEComAirDataModelsIds *pModelId); + +/*! + * Set the lever arm configuration of the AirData module. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] pLeverArm The X, Y, Z airspeed sensor lever arm in meters from the pitot sensor to the IMU. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdAirDataSetLeverArm(SbgEComHandle *pHandle, const float *pLeverArm); + +/*! + * Retrieve the lever arm configuration of the AirData module. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[out] pLeverArm Returns the airspeed sensor X,Y,Z lever arm in meters from the pitot sensor to the IMU. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdAirDataGetLeverArm(SbgEComHandle *pHandle, float *pLeverArm); + +/*! + * Set the rejection configuration of the AirData module (this command doesn't need a reboot to be applied) + * + * \param[in] pHandle A valid sbgECom handle. + * \param[out] pRejectConf The new rejection configuration to set. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdAirDataSetRejection(SbgEComHandle *pHandle, const SbgEComAirDataRejectionConf *pRejectConf); + +/*! + * Retrieve the current rejection configuration of the AirData module. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[out] pRejectConf Return the rejection configuration currently in use. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdAirDataGetRejection(SbgEComHandle *pHandle, SbgEComAirDataRejectionConf *pRejectConf); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_CMD_AIR_DATA_H diff --git a/src/commands/sbgEComCmdApi.c b/src/commands/sbgEComCmdApi.c new file mode 100644 index 0000000..ebb832a --- /dev/null +++ b/src/commands/sbgEComCmdApi.c @@ -0,0 +1,243 @@ +// sbgCommonLib headers +#include +#include + +// Project headers +#include + +// Local headers +#include "sbgEComCmdApi.h" +#include "sbgEComCmdCommon.h" + +//----------------------------------------------------------------------// +//- Constant definitions -// +//----------------------------------------------------------------------// + +/*! + * Status code indicating success. + */ +#define SBG_ECOM_CMD_API_STATUS_CODE_OK (200) + +/*! + * Status code indicating an internal server error. + */ +#define SBG_ECOM_CMD_API_STATUS_CODE_INTERNAL_SERVER_ERROR (500) + +//----------------------------------------------------------------------// +//- Private methods -// +//----------------------------------------------------------------------// + +/*! + * Parse the payload of a REST API reply. + * + * \param[in] pReply REST API reply. + * \return SBG_NO_ERROR if successful. + */ +static SbgErrorCode sbgEComCmdApiReplyParsePayload(SbgEComCmdApiReply *pReply) +{ + SbgErrorCode errorCode; + SbgStreamBuffer streamBuffer; + uint16_t statusCode; + + assert(pReply); + + sbgStreamBufferInitForRead(&streamBuffer, sbgEComProtocolPayloadGetBuffer(&pReply->payload), sbgEComProtocolPayloadGetSize(&pReply->payload)); + + statusCode = sbgStreamBufferReadUint16LE(&streamBuffer); + + errorCode = sbgStreamBufferGetLastError(&streamBuffer); + + if (errorCode == SBG_NO_ERROR) + { + const char *pContent; + size_t size; + + pContent = sbgStreamBufferGetCursor(&streamBuffer); + size = sbgStreamBufferGetSpace(&streamBuffer); + + if (size != 0) + { + if (pContent[size - 1] == '\0') + { + pReply->statusCode = statusCode; + pReply->pContent = pContent; + + errorCode = SBG_NO_ERROR; + } + else + { + errorCode = SBG_INVALID_FRAME; + SBG_LOG_ERROR(errorCode, "invalid content format"); + } + } + else + { + errorCode = SBG_INVALID_FRAME; + SBG_LOG_ERROR(errorCode, "invalid content size"); + } + } + else + { + SBG_LOG_ERROR(errorCode, "unable to read status code"); + } + + return errorCode; +} + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +void sbgEComCmdApiReplyConstruct(SbgEComCmdApiReply *pReply) //TODO: minuscule ds un commit séparé +{ + assert(pReply); + + sbgEComProtocolPayloadConstruct(&pReply->payload); + + pReply->statusCode = SBG_ECOM_CMD_API_STATUS_CODE_INTERNAL_SERVER_ERROR; + pReply->pContent = NULL; +} + +void sbgEComCmdApiReplyDestroy(SbgEComCmdApiReply *pReply) //TODO: minuscule ds un commit séparé +{ + assert(pReply); + + sbgEComProtocolPayloadDestroy(&pReply->payload); +} + +bool sbgEComCmdApiReplySuccessful(const SbgEComCmdApiReply *pReply) +{ + assert(pReply); + + return pReply->statusCode == SBG_ECOM_CMD_API_STATUS_CODE_OK; +} + +SbgErrorCode sbgEComCmdApiGet(SbgEComHandle *pHandle, const char *pPath, const char *pQuery, SbgEComCmdApiReply *pReply) +{ + SbgErrorCode errorCode; + uint8_t *pSendBuffer; + SbgStreamBuffer streamBuffer; + size_t pathSize; + size_t querySize; + size_t size; + + assert(pPath); + + if (!pQuery) + { + pQuery = ""; + } + + pathSize = strlen(pPath) + 1; + querySize = strlen(pQuery) + 1; + size = pathSize + querySize; + + pSendBuffer = malloc(size); + + if (pSendBuffer) + { + sbgStreamBufferInitForWrite(&streamBuffer, pSendBuffer, size); + + sbgStreamBufferWriteBuffer(&streamBuffer, pPath, pathSize); + errorCode = sbgStreamBufferWriteBuffer(&streamBuffer, pQuery, querySize); + assert(errorCode == SBG_NO_ERROR); + + for (uint32_t i = 0; i < pHandle->numTrials; i++) + { + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_API_GET, sbgStreamBufferGetLinkedBuffer(&streamBuffer), sbgStreamBufferGetLength(&streamBuffer)); + + if (errorCode == SBG_NO_ERROR) + { + errorCode = sbgEComReceiveCmd2(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_API_GET, &pReply->payload, pHandle->cmdDefaultTimeOut); + + if (errorCode == SBG_NO_ERROR) + { + errorCode = sbgEComCmdApiReplyParsePayload(pReply); + break; + } + } + else + { + break; + } + } + + free(pSendBuffer); + } + else + { + errorCode = SBG_MALLOC_FAILED; + SBG_LOG_ERROR(errorCode, "unable allocate buffer"); + } + + return errorCode; +} + +SbgErrorCode sbgEComCmdApiPost(SbgEComHandle *pHandle, const char *pPath, const char *pQuery, const char *pBody, SbgEComCmdApiReply *pReply) +{ + SbgErrorCode errorCode; + uint8_t *pSendBuffer; + SbgStreamBuffer streamBuffer; + size_t pathSize; + size_t querySize; + size_t bodySize; + size_t size; + + assert(pPath); + + if (!pQuery) + { + pQuery = ""; + } + + if (!pBody) + { + pBody = ""; + } + + pathSize = strlen(pPath) + 1; + querySize = strlen(pQuery) + 1; + bodySize = strlen(pBody) + 1; + size = pathSize + querySize + bodySize; + + pSendBuffer = malloc(size); + + if (pSendBuffer) + { + sbgStreamBufferInitForWrite(&streamBuffer, pSendBuffer, size); + + sbgStreamBufferWriteBuffer(&streamBuffer, pPath, pathSize); + sbgStreamBufferWriteBuffer(&streamBuffer, pQuery, querySize); + errorCode = sbgStreamBufferWriteBuffer(&streamBuffer, pBody, bodySize); + assert(errorCode == SBG_NO_ERROR); + + for (uint32_t i = 0; i < pHandle->numTrials; i++) + { + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_API_POST, sbgStreamBufferGetLinkedBuffer(&streamBuffer), sbgStreamBufferGetLength(&streamBuffer)); + + if (errorCode == SBG_NO_ERROR) + { + errorCode = sbgEComReceiveCmd2(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_API_POST, &pReply->payload, pHandle->cmdDefaultTimeOut); + + if (errorCode == SBG_NO_ERROR) + { + errorCode = sbgEComCmdApiReplyParsePayload(pReply); + break; + } + } + else + { + break; + } + } + + free(pSendBuffer); + } + else + { + errorCode = SBG_MALLOC_FAILED; + SBG_LOG_ERROR(errorCode, "unable allocate buffer"); + } + + return errorCode; +} diff --git a/src/commands/sbgEComCmdApi.h b/src/commands/sbgEComCmdApi.h new file mode 100644 index 0000000..588dd82 --- /dev/null +++ b/src/commands/sbgEComCmdApi.h @@ -0,0 +1,121 @@ +/*! + * \file sbgEComCmdApi.h + * \author SBG Systems + * \date October 14, 2020 + * + * \brief REST API related commands. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_CMD_API_H +#define SBG_ECOM_CMD_API_H + +// sbgCommonLib headers +#include + +// Project headers +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Structure definitions -// +//----------------------------------------------------------------------// + +/*! + * Reply to REST API commands. + * + * The reply content is a null-terminated string, normally in JSON format. + * + * The content directly refers to data inside the payload. + */ +typedef struct _SbgEComCmdApiReply +{ + SbgEComProtocolPayload payload; /*!< Payload. */ + uint16_t statusCode; /*!< Status code. */ + const char *pContent; /*!< Content. */ +} SbgEComCmdApiReply; + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * REST API reply constructor. + * + * \param[in] pReply REST API reply. + */ +void sbgEComCmdApiReplyConstruct(SbgEComCmdApiReply *pReply); + +/*! + * REST API reply destructor. + * + * \param[in] pReply REST API reply. + */ +void sbgEComCmdApiReplyDestroy(SbgEComCmdApiReply *pReply); + +/*! + * Check if a reply indicates successful command execution. + * + * \param[in] pReply REST API reply. + * \return True if the reply indicates successful command execution. + */ +bool sbgEComCmdApiReplySuccessful(const SbgEComCmdApiReply *pReply); + +/*! + * Send a GET command. + * + * The reply must be destroyed before the next attempt to receive data, either logs or command replies. + * + * \param[in] pHandle ECom handle. + * \param[in] pPath URI path component. + * \param[in] pQuery Query string, may be NULL. + * \param[out] pReply Reply. + * \return SBG_NO_ERROR if successful. + */ +SbgErrorCode sbgEComCmdApiGet(SbgEComHandle *pHandle, const char *pPath, const char *pQuery, SbgEComCmdApiReply *pReply); + +/*! + * Send a POST command. + * + * The reply must be destroyed before the next attempt to receive data, either logs or command replies. + * + * \param[in] pHandle ECom handle. + * \param[in] pPath URI path component. + * \param[in] pQuery Query string, may be NULL. + * \param[in] pBody Body, may be NULL. + * \param[out] pReply Reply. + * \return SBG_NO_ERROR if successful. + */ +SbgErrorCode sbgEComCmdApiPost(SbgEComHandle *pHandle, const char *pPath, const char *pQuery, const char *pBody, SbgEComCmdApiReply *pReply); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_CMD_API_H diff --git a/src/commands/sbgEComCmdCommon.c b/src/commands/sbgEComCmdCommon.c new file mode 100644 index 0000000..6b3a639 --- /dev/null +++ b/src/commands/sbgEComCmdCommon.c @@ -0,0 +1,498 @@ +// sbgCommonLib headers +#include +#include + +// Project headers +#include + +// Local headers +#include "sbgEComCmdCommon.h" + +//----------------------------------------------------------------------// +//- Common command reception operations -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComReceiveAnyCmd(SbgEComHandle *pHandle, uint8_t *pMsgClass, uint8_t *pMsgId, void *pData, size_t *pSize, size_t maxSize, uint32_t timeOut) +{ + SbgErrorCode errorCode; + SbgEComProtocolPayload payload; + + assert(pHandle); + assert(pMsgClass); + assert(pMsgId); + + sbgEComProtocolPayloadConstruct(&payload); + + errorCode = sbgEComReceiveAnyCmd2(pHandle, pMsgClass, pMsgId, &payload, timeOut); + + if (errorCode == SBG_NO_ERROR) + { + size_t size; + + size = sbgEComProtocolPayloadGetSize(&payload); + + if (size <= maxSize) + { + if (pData) + { + const void *pBuffer; + + pBuffer = sbgEComProtocolPayloadGetBuffer(&payload); + + memcpy(pData, pBuffer, size); + } + + if (pSize) + { + *pSize = size; + } + } + else + { + errorCode = SBG_BUFFER_OVERFLOW; + } + } + + sbgEComProtocolPayloadDestroy(&payload); + + return errorCode; +} + +SbgErrorCode sbgEComReceiveAnyCmd2(SbgEComHandle *pHandle, uint8_t *pMsgClass, uint8_t *pMsgId, SbgEComProtocolPayload *pPayload, uint32_t timeOut) +{ + SbgErrorCode errorCode; + uint32_t start; + + assert(pHandle); + + if (timeOut > 0) + { + start = sbgGetTime(); + } + else + { + // + // Avoid compiler warning + // + start = 0; + } + + for (;;) + { + uint8_t receivedMsgClass; + uint8_t receivedMsgId; + uint32_t now; + + errorCode = sbgEComProtocolReceive2(&pHandle->protocolHandle, &receivedMsgClass, &receivedMsgId, pPayload); + + if (errorCode == SBG_NO_ERROR) + { + if (sbgEComMsgClassIsALog((SbgEComClass)receivedMsgClass)) + { + if (pHandle->pReceiveLogCallback) + { + SbgBinaryLogData logData; + + errorCode = sbgEComBinaryLogParse((SbgEComClass)receivedMsgClass, receivedMsgId, sbgEComProtocolPayloadGetBuffer(pPayload), sbgEComProtocolPayloadGetSize(pPayload), &logData); + + if (errorCode == SBG_NO_ERROR) + { + pHandle->pReceiveLogCallback(pHandle, (SbgEComClass)receivedMsgClass, receivedMsgId, &logData, pHandle->pUserArg); + } + } + } + else + { + if (pMsgClass) + { + *pMsgClass = receivedMsgClass; + } + + if (pMsgId) + { + *pMsgId = receivedMsgId; + } + + break; + } + } + + if (timeOut > 0) + { + if (errorCode == SBG_NOT_READY) + { + sbgSleep(1); + } + + now = sbgGetTime(); + + if ((now - start) >= timeOut) + { + errorCode = SBG_TIME_OUT; + break; + } + } + else + { + errorCode = SBG_TIME_OUT; + break; + } + } + + return errorCode; +} + +SbgErrorCode sbgEComReceiveCmd(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msgId, void *pData, size_t *pSize, size_t maxSize, uint32_t timeOut) +{ + SbgErrorCode errorCode; + SbgEComProtocolPayload payload; + + sbgEComProtocolPayloadConstruct(&payload); + + errorCode = sbgEComReceiveCmd2(pHandle, msgClass, msgId, &payload, timeOut); + + if (errorCode == SBG_NO_ERROR) + { + size_t size; + + size = sbgEComProtocolPayloadGetSize(&payload); + + if (size <= maxSize) + { + if (pData) + { + const void *pBuffer; + + pBuffer = sbgEComProtocolPayloadGetBuffer(&payload); + + memcpy(pData, pBuffer, size); + } + + if (pSize) + { + *pSize = size; + } + } + else + { + errorCode = SBG_BUFFER_OVERFLOW; + } + } + + sbgEComProtocolPayloadDestroy(&payload); + + return errorCode; +} + +SbgErrorCode sbgEComReceiveCmd2(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msgId, SbgEComProtocolPayload *pPayload, uint32_t timeOut) +{ + SbgErrorCode errorCode; + uint32_t start; + + assert(pHandle); + + start = sbgGetTime(); + + for (;;) + { + uint8_t receivedMsgClass; + uint8_t receivedMsgId; + uint32_t now; + + errorCode = sbgEComReceiveAnyCmd2(pHandle, &receivedMsgClass, &receivedMsgId, pPayload, 0); + + if (errorCode == SBG_NO_ERROR) + { + if ((receivedMsgClass == msgClass) && (receivedMsgId == msgId)) + { + break; + } + else if ((receivedMsgClass == SBG_ECOM_CLASS_LOG_CMD_0) && (receivedMsgId == SBG_ECOM_CMD_ACK)) + { + SbgStreamBuffer streamBuffer; + uint8_t ackMsgClass; + uint8_t ackMsgId; + SbgErrorCode ackErrorCode; + + sbgStreamBufferInitForRead(&streamBuffer, sbgEComProtocolPayloadGetBuffer(pPayload), sbgEComProtocolPayloadGetSize(pPayload)); + + ackMsgId = sbgStreamBufferReadUint8(&streamBuffer); + ackMsgClass = sbgStreamBufferReadUint8(&streamBuffer); + ackErrorCode = (SbgErrorCode)sbgStreamBufferReadUint16LE(&streamBuffer); + + errorCode = sbgStreamBufferGetLastError(&streamBuffer); + + if ((errorCode == SBG_NO_ERROR) && (ackMsgClass == msgClass) && (ackMsgId == msgId)) + { + // + // If a successful ACK is expected, the caller should instead explicitely wait for + // it. As a result, consider receiving a "successful ACK" instead of an actual message + // with the requested class/ID an error. + // + if (ackErrorCode != SBG_NO_ERROR) + { + errorCode = ackErrorCode; + } + else + { + errorCode = SBG_ERROR; + } + + break; + } + } + } + else if (errorCode == SBG_NOT_READY) + { + sbgSleep(1); + } + + now = sbgGetTime(); + + if ((now - start) >= timeOut) + { + errorCode = SBG_TIME_OUT; + break; + } + } + + return errorCode; +} + +//----------------------------------------------------------------------// +//- ACK related commands operations -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComWaitForAck(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg, uint32_t timeOut) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComProtocolPayload receivedPayload; + uint8_t ackClass; + uint8_t ackMsg; + + assert(pHandle); + + sbgEComProtocolPayloadConstruct(&receivedPayload); + + // + // Try to receive the ACK + // + errorCode = sbgEComReceiveCmd2(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_ACK, &receivedPayload, timeOut); + + // + // Test if an ACK frame has been received + // + if (errorCode == SBG_NO_ERROR) + { + // + // Validate the received ACK frame + // + if (sbgEComProtocolPayloadGetSize(&receivedPayload) == 2*sizeof(uint16_t)) + { + SbgStreamBuffer inputStream; + + // + // Initialize a stream buffer to parse the received payload + // + sbgStreamBufferInitForRead(&inputStream, sbgEComProtocolPayloadGetBuffer(&receivedPayload), sbgEComProtocolPayloadGetSize(&receivedPayload)); + + // + // The ACK frame contains the ack message ID and class, and a uint16_t for the return error code + // We make sure that the ACK is for the correct command + // + ackMsg = sbgStreamBufferReadUint8LE(&inputStream); + ackClass = sbgStreamBufferReadUint8LE(&inputStream); + + if ((ackMsg == msg) && (ackClass == msgClass)) + { + // + // Parse the error code and return it + // + errorCode = (SbgErrorCode)sbgStreamBufferReadUint16LE(&inputStream); + } + else + { + // + // We have received an ACK but not for this frame! + // + errorCode = SBG_INVALID_FRAME; + } + } + else + { + // + // The ACK is invalid + // + errorCode = SBG_INVALID_FRAME; + } + } + + sbgEComProtocolPayloadDestroy(&receivedPayload); + + return errorCode; +} + +SbgErrorCode sbgEComSendAck(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg, SbgErrorCode cmdError) +{ + SbgStreamBuffer outputStream; + uint8_t outputBuffer[2*sizeof(uint8_t)+sizeof(uint16_t)]; + + assert(pHandle); + + // + // Initialize a stream buffer to write the command payload + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + + // + // Write the message ID and class and then the error code + // + sbgStreamBufferWriteUint8LE(&outputStream, msg); + sbgStreamBufferWriteUint8LE(&outputStream, msgClass); + sbgStreamBufferWriteUint16LE(&outputStream, (uint16_t)cmdError); + + // + // Send the ACK command + // + return sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_ACK, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); +} + +//----------------------------------------------------------------------// +//- Generic command definitions -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComCmdGenericSetModelId(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg, uint32_t modelId) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + uint32_t trial; + uint8_t outputBuffer[sizeof(uint32_t)]; + SbgStreamBuffer outputStream; + + assert(pHandle); + + // + // Init stream buffer for output and Build payload + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + sbgStreamBufferWriteUint32LE(&outputStream, modelId); + + // + // Make sure the payload has been build correctly + // + errorCode = sbgStreamBufferGetLastError(&outputStream); + + if (errorCode == SBG_NO_ERROR) + { + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the payload over ECom + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, msgClass, msg, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComWaitForAck(pHandle, msgClass, msg, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a valid ACK + // + if (errorCode == SBG_NO_ERROR) + { + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + } + + return errorCode; +} + +SbgErrorCode sbgEComCmdGenericGetModelId(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg, uint32_t *pModelId) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComProtocolPayload receivedPayload; + uint32_t trial; + + assert(pHandle); + assert(pModelId); + + sbgEComProtocolPayloadConstruct(&receivedPayload); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the command only since this is a no payload command + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, msgClass, msg, NULL, 0); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComReceiveCmd2(pHandle, msgClass, msg, &receivedPayload, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a the specified command + // + if (errorCode == SBG_NO_ERROR) + { + SbgStreamBuffer inputStream; + + // + // Initialize stream buffer to read parameters + // + sbgStreamBufferInitForRead(&inputStream, sbgEComProtocolPayloadGetBuffer(&receivedPayload), sbgEComProtocolPayloadGetSize(&receivedPayload)); + + // + // Read parameters + // + *pModelId = sbgStreamBufferReadUint32LE(&inputStream); + + // + // The command has been executed successfully so return + // We return the stream buffer error code to catch any overflow error on the payload + // + errorCode = sbgStreamBufferGetLastError(&inputStream); + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + sbgEComProtocolPayloadDestroy(&receivedPayload); + + return errorCode; +} diff --git a/src/commands/sbgEComCmdCommon.h b/src/commands/sbgEComCmdCommon.h new file mode 100644 index 0000000..d4a8a19 --- /dev/null +++ b/src/commands/sbgEComCmdCommon.h @@ -0,0 +1,228 @@ +/*! + * \file sbgEComCmdCommon.h + * \author SBG Systems + * \date 11 June 2014 + * + * \brief Definitions and methods common to all commands. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_CMD_COMMON_H +#define SBG_ECOM_CMD_COMMON_H + +// sbgCommonLib headers +#include + +// Project headers +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Defintions -// +//----------------------------------------------------------------------// + +#define SBG_ECOM_DEFAULT_CMD_TIME_OUT (500) /*!< Default time out in ms for commands reception. */ + +/*! + * List of all rejection modes for aiding inputs. + */ +typedef enum _SbgEComRejectionMode +{ + SBG_ECOM_NEVER_ACCEPT_MODE = 0, /*!< Measurement is not taken into account. */ + SBG_ECOM_AUTOMATIC_MODE = 1, /*!< Measurement is accepted and rejected automatically depending on consistency checks */ + SBG_ECOM_ALWAYS_ACCEPT_MODE = 2 /*!< Measurement is always accepted. Should be used with caution */ +} SbgEComRejectionMode; + +/*! + * List of all axis directions for modules/sensor alignment. + */ +typedef enum _SbgEComAxisDirection +{ + SBG_ECOM_ALIGNMENT_FORWARD = 0, /*!< IMU/module Axis is turned in vehicle's forward direction. */ + SBG_ECOM_ALIGNMENT_BACKWARD = 1, /*!< IMU/module Axis is turned in vehicle's backward direction. */ + SBG_ECOM_ALIGNMENT_LEFT = 2, /*!< IMU/module Axis is turned in vehicle's left direction. */ + SBG_ECOM_ALIGNMENT_RIGHT = 3, /*!< IMU/module Axis is turned in vehicle's right direction. */ + SBG_ECOM_ALIGNMENT_UP = 4, /*!< IMU/module Axis is turned in vehicle's up direction. */ + SBG_ECOM_ALIGNMENT_DOWN = 5 /*!< IMU/module Axis is turned in vehicle's down direction. */ +} SbgEComAxisDirection; + +//----------------------------------------------------------------------// +//- Common command reception operations -// +//----------------------------------------------------------------------// + +/*! + * Receive a command message. + * + * All binary logs received are handled trough the standard callback system. + * + * \param[in] pHandle SbgECom handle. + * \param[out] pMsgClass Message class. + * \param[out] pMsgId Message ID. + * \param[out] pData Data buffer, may be NULL. + * \param[out] pSize Number of bytes received, in bytes, may be NULL. + * \param[in] maxSize Data buffer size, in bytes. + * \param[in] timeOut Time-out, in ms. + * \return SBG_NO_ERROR if successful, + * SBG_NOT_READY if no command message has been received, + * SBG_BUFFER_OVERFLOW if the payload of the received frame couldn't fit into the buffer, + * SBG_TIME_OUT if no command message was received within the specified time out. + */ +SbgErrorCode sbgEComReceiveAnyCmd(SbgEComHandle *pHandle, uint8_t *pMsgClass, uint8_t *pMsgId, void *pData, size_t *pSize, size_t maxSize, uint32_t timeOut); + +/*! + * Receive a command message. + * + * All binary logs received are handled trough the standard callback system. + * + * This function is equivalent to sbgEComReceiveAnyCmd() with two exceptions : + * - the use of a payload object allows handling payloads not limited by the size of a user-provided buffer + * - the payload object allows direct access to the protocol work buffer to avoid an extra copy per call + * + * Any allocated resource associated with the given payload is released when calling this function. + * + * Because the payload buffer may directly refer to the protocol work buffer on return, it is only valid until + * the next attempt to receive a frame, with any of the receive functions. + * + * \param[in] pHandle SbgECom handle. + * \param[out] pMsgClass Message class. + * \param[out] pMsgId Message ID. + * \param[out] pPayload Payload. + * \param[in] timeOut Time-out, in ms. + * \return SBG_NO_ERROR if successful, + * SBG_NOT_READY if no command message has been received, + * SBG_TIME_OUT if no command message was received within the specified time out. + */ +SbgErrorCode sbgEComReceiveAnyCmd2(SbgEComHandle *pHandle, uint8_t *pMsgClass, uint8_t *pMsgId, SbgEComProtocolPayload *pPayload, uint32_t timeOut); + +/*! + * Receive a specific command message. + * + * This function also processes ACK messages for the given class and ID. + * + * All binary logs received during this time are handled trough the standard callback system. + * + * \param[in] pHandle SbgECom handle. + * \param[in] msgClass Message class. + * \param[in] msgId Message ID. + * \param[out] pData Data buffer. + * \param[out] pSize Number of bytes received, in bytes. + * \param[in] maxSize Data buffer size, in bytes. + * \param[in] timeOut Time-out, in ms. + * \return SBG_NO_ERROR if successful, + * SBG_NOT_READY if no command message has been received, + * SBG_BUFFER_OVERFLOW if the payload of the received frame couldn't fit into the buffer, + * SBG_TIME_OUT if no command message was received within the specified time out, + * any error code reported by an ACK message for the given class and ID. + */ +SbgErrorCode sbgEComReceiveCmd(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msgId, void *pData, size_t *pSize, size_t maxSize, uint32_t timeOut); + +/*! + * Receive a specific command message. + * + * This function also processes ACK messages for the given class and ID. + * + * All binary logs received during this time are handled trough the standard callback system. + * + * This function is equivalent to sbgEComReceiveCmd() with two exceptions : + * - the use of a payload object allows handling payloads not limited by the size of a user-provided buffer + * - the payload object allows direct access to the protocol work buffer to avoid an extra copy per call + * + * Any allocated resource associated with the given payload is released when calling this function. + * + * Because the payload buffer may directly refer to the protocol work buffer on return, it is only valid until + * the next attempt to receive a frame, with any of the receive functions. + * + * \param[in] pHandle SbgECom handle. + * \param[in] msgClass Message class. + * \param[in] msgId Message ID. + * \param[out] pPayload Payload. + * \param[in] timeOut Time-out, in ms. + * \return SBG_NO_ERROR if successful, + * SBG_NOT_READY if no command message has been received, + * SBG_TIME_OUT if no command message was received within the specified time out, + * any error code reported by an ACK message for the given class and ID. + */ +SbgErrorCode sbgEComReceiveCmd2(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msgId, SbgEComProtocolPayload *pPayload, uint32_t timeOut); + +//----------------------------------------------------------------------// +//- ACK related commands operations -// +//----------------------------------------------------------------------// + +/*! + * Wait for an ACK for a specified amount of time. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] msgClass The message class that we want to check + * \param[in] msg The message ID that we want to check + * \param[in] timeOut Time out in ms during which we can receive the ACK. + * \return SBG_NO_ERROR if the ACK has been received. + */ +SbgErrorCode sbgEComWaitForAck(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg, uint32_t timeOut); + +/*! + * Send an ACK for a specific command with an associated error code. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] msgClass The message class that we want to send + * \param[in] msg The message ID that we want to send. + * \param[in] cmdError The associated error code. + * \return SBG_NO_ERROR if the ACK has been sent. + */ +SbgErrorCode sbgEComSendAck(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg, SbgErrorCode cmdError); + +//----------------------------------------------------------------------// +//- Generic command definitions -// +//----------------------------------------------------------------------// + +/*! + * Generic function to set an error model ID + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] msgClass Original message class + * \param[in] msg Original message ID + * \param[in] modelId Model ID to set + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdGenericSetModelId(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg, uint32_t modelId); + +/*! + * Generic function to get an error model ID + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] msgClass Original message class + * \param[in] msg Original message ID + * \param[out] pModelId Returns the currently used model ID. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdGenericGetModelId(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg, uint32_t *pModelId); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_CMD_COMMON_H diff --git a/src/commands/sbgEComCmdDvl.c b/src/commands/sbgEComCmdDvl.c new file mode 100644 index 0000000..2972dda --- /dev/null +++ b/src/commands/sbgEComCmdDvl.c @@ -0,0 +1,334 @@ +// sbgCommonLib headers +#include +#include + +// Project headers +#include + +// Local headers +#include "sbgEComCmdCommon.h" +#include "sbgEComCmdDvl.h" + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComCmdDvlSetModelId(SbgEComHandle *pHandle, SbgEComDvlModelsIds modelId) +{ + assert(pHandle); + + return sbgEComCmdGenericSetModelId(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_DVL_MODEL_ID, modelId); +} + +SbgErrorCode sbgEComCmdDvlGetModelId(SbgEComHandle *pHandle, SbgEComDvlModelsIds *pModelId) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + uint32_t modelIdAsUint; + + assert(pHandle); + assert(pModelId); + + errorCode = sbgEComCmdGenericGetModelId(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_DVL_MODEL_ID, &modelIdAsUint); + + if (errorCode == SBG_NO_ERROR) + { + *pModelId = (SbgEComDvlModelsIds)modelIdAsUint; + } + + return errorCode; +} + +SbgErrorCode sbgEComCmdDvlInstallationSet(SbgEComHandle *pHandle, const SbgEComDvlInstallation *pDvlInstallation) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + uint32_t trial; + uint8_t outputBuffer[64]; + SbgStreamBuffer outputStream; + + assert(pHandle); + assert(pDvlInstallation); + + // + // Create the command payload + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + + // + // Build payload + // + sbgStreamBufferWriteFloatLE(&outputStream, pDvlInstallation->leverArm[0]); + sbgStreamBufferWriteFloatLE(&outputStream, pDvlInstallation->leverArm[1]); + sbgStreamBufferWriteFloatLE(&outputStream, pDvlInstallation->leverArm[2]); + + sbgStreamBufferWriteFloatLE(&outputStream, pDvlInstallation->alignment[0]); + sbgStreamBufferWriteFloatLE(&outputStream, pDvlInstallation->alignment[1]); + sbgStreamBufferWriteFloatLE(&outputStream, pDvlInstallation->alignment[2]); + + sbgStreamBufferWriteBooleanLE(&outputStream, pDvlInstallation->preciseInstallation); + + // + // Make sure the payload has been build correctly + // + errorCode = sbgStreamBufferGetLastError(&outputStream); + + if (errorCode == SBG_NO_ERROR) + { + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the payload over ECom + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_DVL_INSTALLATION, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComWaitForAck(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_DVL_INSTALLATION, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a valid ACK + // + if (errorCode == SBG_NO_ERROR) + { + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + } + + return errorCode; +} + +SbgErrorCode sbgEComCmdDvlInstallationGet(SbgEComHandle *pHandle, SbgEComDvlInstallation *pDvlInstallation) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComProtocolPayload receivedPayload; + uint32_t trial; + + assert(pHandle); + assert(pDvlInstallation); + + sbgEComProtocolPayloadConstruct(&receivedPayload); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the command only since this is a no-payload command + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_DVL_INSTALLATION, NULL, 0); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComReceiveCmd2(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_DVL_INSTALLATION, &receivedPayload, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a SBG_ECOM_CMD_GNSS_1_LEVER_ARM_ALIGNMENT command + // + if (errorCode == SBG_NO_ERROR) + { + SbgStreamBuffer inputStream; + + // + // Initialize stream buffer to parse the payload + // + sbgStreamBufferInitForRead(&inputStream, sbgEComProtocolPayloadGetBuffer(&receivedPayload), sbgEComProtocolPayloadGetSize(&receivedPayload)); + + pDvlInstallation->leverArm[0] = sbgStreamBufferReadFloatLE(&inputStream); + pDvlInstallation->leverArm[1] = sbgStreamBufferReadFloatLE(&inputStream); + pDvlInstallation->leverArm[2] = sbgStreamBufferReadFloatLE(&inputStream); + + pDvlInstallation->alignment[0] = sbgStreamBufferReadFloatLE(&inputStream); + pDvlInstallation->alignment[1] = sbgStreamBufferReadFloatLE(&inputStream); + pDvlInstallation->alignment[2] = sbgStreamBufferReadFloatLE(&inputStream); + + pDvlInstallation->preciseInstallation = sbgStreamBufferReadBooleanLE(&inputStream); + + // + // The command has been executed successfully so return if an error has occurred during payload parsing + // + errorCode = sbgStreamBufferGetLastError(&inputStream); + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + sbgEComProtocolPayloadDestroy(&receivedPayload); + + return errorCode; +} + +SbgErrorCode sbgEComCmdDvlSetRejection(SbgEComHandle *pHandle, const SbgEComDvlRejectionConf *pRejectConf) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + uint32_t trial; + uint8_t outputBuffer[2*sizeof(uint8_t)]; + SbgStreamBuffer outputStream; + + assert(pHandle); + assert(pRejectConf); + + // + // Create the command payload + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + + // + // Build payload + // + sbgStreamBufferWriteUint8LE(&outputStream, pRejectConf->bottomLayer); + sbgStreamBufferWriteUint8LE(&outputStream, pRejectConf->waterLayer); + + // + // Make sure the payload has been build correctly + // + errorCode = sbgStreamBufferGetLastError(&outputStream); + + if (errorCode == SBG_NO_ERROR) + { + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the payload over ECom + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_DVL_REJECT_MODES, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComWaitForAck(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_DVL_REJECT_MODES, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a valid ACK + // + if (errorCode == SBG_NO_ERROR) + { + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + } + + return errorCode; +} + +SbgErrorCode sbgEComCmdDvlGetRejection(SbgEComHandle *pHandle, SbgEComDvlRejectionConf *pRejectConf) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComProtocolPayload receivedPayload; + uint32_t trial; + + assert(pHandle); + assert(pRejectConf); + + sbgEComProtocolPayloadConstruct(&receivedPayload); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the command only since this is a no-payload command + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_DVL_REJECT_MODES, NULL, 0); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComReceiveCmd2(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_DVL_REJECT_MODES, &receivedPayload, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a SBG_ECOM_CMD_GNSS_1_REJECT_MODES command + // + if (errorCode == SBG_NO_ERROR) + { + SbgStreamBuffer inputStream; + + // + // Initialize stream buffer to parse payload + // + sbgStreamBufferInitForRead(&inputStream, sbgEComProtocolPayloadGetBuffer(&receivedPayload), sbgEComProtocolPayloadGetSize(&receivedPayload)); + + // + // Parse the payload + // + pRejectConf->bottomLayer = (SbgEComRejectionMode)sbgStreamBufferReadUint8LE(&inputStream); + pRejectConf->waterLayer = (SbgEComRejectionMode)sbgStreamBufferReadUint8LE(&inputStream); + + // + // The command has been executed successfully so return if an error has occurred during payload parsing + // + errorCode = sbgStreamBufferGetLastError(&inputStream); + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + sbgEComProtocolPayloadDestroy(&receivedPayload); + + return errorCode; +} diff --git a/src/commands/sbgEComCmdDvl.h b/src/commands/sbgEComCmdDvl.h new file mode 100644 index 0000000..d215ac1 --- /dev/null +++ b/src/commands/sbgEComCmdDvl.h @@ -0,0 +1,141 @@ +/*! + * \file sbgEComCmdDvl.h + * \author SBG Systems + * \date 13 December 2018 + * + * \brief DVL (Doppler Velocity Logger) aiding module configuration commands. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_CMD_DVL_H +#define SBG_ECOM_CMD_DVL_H + +// sbgCommonLib headers +#include + +// Project headers +#include + +// Local headers +#include "sbgEComCmdCommon.h" + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Public definitions -// +//----------------------------------------------------------------------// + +/*! + * This enum defines the different DVL model IDs available in standard + */ +typedef enum _SbgEComDvlModelsIds +{ + SBG_ECOM_DVL_MODEL_GENERIC_PD6 = 202, /*!< Generic DVL using PD6 protocol format. */ +} SbgEComDvlModelsIds; + +/*! + * DVL mechanical installation parameters such as lever arm and alignment + */ +typedef struct _SbgEComDvlInstallation +{ + float leverArm[3]; /*!< X, Y, Z DVL lever arm in meters expressed from the DVL to the IMU. */ + float alignment[3]; /*!< Roll, pitch, yaw DVL alignment expressed in radians. */ + bool preciseInstallation; /*!< Set to true if both the DVL lever arm and DVL alignment are precise and don't require in-run estimation. */ +} SbgEComDvlInstallation; + +/*! + * Holds all necessary information for DVL module data rejection. + */ +typedef struct _SbgEComDvlRejectionConf +{ + SbgEComRejectionMode bottomLayer; /*!< Rejection mode for the bottom tracking (ie when the velocity measurement is in respect to the seabed). */ + SbgEComRejectionMode waterLayer; /*!< Rejection mode for the water tracking (ie when the velocity measurement is relative to a water layer). */ +} SbgEComDvlRejectionConf; + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Set the DVL model to use that both defines the protocol as well as the associated error model. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] modelId DVL model ID to set + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdDvlSetModelId(SbgEComHandle *pHandle, SbgEComDvlModelsIds modelId); + +/*! + * Retrieve the DVL model id currently in use by the device. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[out] pModelId Returns the DVL model ID currently in use by the device. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdDvlGetModelId(SbgEComHandle *pHandle, SbgEComDvlModelsIds *pModelId); + +/*! + * Set the lever arm and alignment configuration of the DVL module. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] pDvlInstallation The DVL lever arm and alignment configuration to apply. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdDvlInstallationSet(SbgEComHandle *pHandle, const SbgEComDvlInstallation *pDvlInstallation); + +/*! + * Retrieve the lever arm and alignment configuration of the DVL module. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[out] pDvlInstallation Returns the DVL lever arm and alignment configuration currently in use. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdDvlInstallationGet(SbgEComHandle *pHandle, SbgEComDvlInstallation *pDvlInstallation); + +/*! + * Set the rejection configuration of the DVL module (this command doesn't need a reboot to be applied) + * + * \param[in] pHandle A valid sbgECom handle. + * \param[out] pRejectConf The new DVL rejection configuration to set. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdDvlSetRejection(SbgEComHandle *pHandle, const SbgEComDvlRejectionConf *pRejectConf); + +/*! + * Retrieve the current rejection configuration of the DVL module. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[out] pRejectConf Return the DVL rejection configuration currently in use. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdDvlGetRejection(SbgEComHandle *pHandle, SbgEComDvlRejectionConf *pRejectConf); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_CMD_DVL_H diff --git a/src/commands/sbgEComCmdEthernet.c b/src/commands/sbgEComCmdEthernet.c new file mode 100644 index 0000000..5fd9f40 --- /dev/null +++ b/src/commands/sbgEComCmdEthernet.c @@ -0,0 +1,276 @@ +// sbgCommonLib headers +#include +#include + +// Project headers +#include + +// Local headers +#include "sbgEComCmdCommon.h" +#include "sbgEComCmdEthernet.h" + +//----------------------------------------------------------------------// +//- Private methods -// +//----------------------------------------------------------------------// + +/*! + * Write in the output stream buffer, the provided Ethernet configuration. + * + * \param[out] pOutputStream Pointer on the output stream buffer to write to. + * \param[in] pEthernetConf Structure used to hold the parameters to write to the payload buffer. + * \return SBG_NO_ERROR if the structure has been written correctly. + */ +static SbgErrorCode sbgEComEthernetConfWrite(SbgStreamBuffer *pOutputStream, const SbgEComEthernetConf *pEthernetConf) +{ + assert(pOutputStream); + assert(pEthernetConf); + + // + // Build payload + // + sbgStreamBufferWriteUint8LE(pOutputStream, (uint8_t)pEthernetConf->mode); + sbgStreamBufferWriteUint32LE(pOutputStream, pEthernetConf->ipAddress); + sbgStreamBufferWriteUint32LE(pOutputStream, pEthernetConf->netmask); + sbgStreamBufferWriteUint32LE(pOutputStream, pEthernetConf->gateway); + sbgStreamBufferWriteUint32LE(pOutputStream, pEthernetConf->dns1); + sbgStreamBufferWriteUint32LE(pOutputStream, pEthernetConf->dns2); + + // + // Return if an error has occurred during the parse + // + return sbgStreamBufferGetLastError(pOutputStream); +} + +/*! + * Parse the input stream buffer to extract all parameters and fill the corresponding structure. + * + * \param[in] pInputStream Pointer on the input stream buffer to read from. + * \param[out] pEthernetConf Structure used to store the parsed parameters. + * \return SBG_NO_ERROR if the structure has been parsed correctly. + */ +static SbgErrorCode sbgEComEthernetConfParse(SbgStreamBuffer *pInputStream, SbgEComEthernetConf *pEthernetConf) +{ + assert(pInputStream); + assert(pEthernetConf); + + // + // Read all parameters from the payload + // + pEthernetConf->mode = (SbgEComEthernetMode)sbgStreamBufferReadUint8LE(pInputStream); + pEthernetConf->ipAddress = (sbgIpAddress)sbgStreamBufferReadUint32LE(pInputStream); + pEthernetConf->netmask = (sbgIpAddress)sbgStreamBufferReadUint32LE(pInputStream); + pEthernetConf->gateway = (sbgIpAddress)sbgStreamBufferReadUint32LE(pInputStream); + pEthernetConf->dns1 = (sbgIpAddress)sbgStreamBufferReadUint32LE(pInputStream); + pEthernetConf->dns2 = (sbgIpAddress)sbgStreamBufferReadUint32LE(pInputStream); + + // + // Return if an error has occurred during the parse + // + return sbgStreamBufferGetLastError(pInputStream); +} + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComEthernetGetConf(SbgEComHandle *pHandle, SbgEComEthernetConf *pEthernetConf) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComProtocolPayload receivedPayload; + uint32_t trial; + + assert(pHandle); + assert(pEthernetConf); + + sbgEComProtocolPayloadConstruct(&receivedPayload); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the command with no payload to retreive the network configuration + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_ETHERNET_CONF, NULL, 0); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComReceiveCmd2(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_ETHERNET_CONF, &receivedPayload, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received correctly the answer + // + if (errorCode == SBG_NO_ERROR) + { + SbgStreamBuffer inputStream; + + // + // Initialize stream buffer to read parameters + // + sbgStreamBufferInitForRead(&inputStream, sbgEComProtocolPayloadGetBuffer(&receivedPayload), sbgEComProtocolPayloadGetSize(&receivedPayload)); + + // + // Read all parameters from the payload and return any error during the parse + // + errorCode = sbgEComEthernetConfParse(&inputStream, pEthernetConf); + + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + sbgEComProtocolPayloadDestroy(&receivedPayload); + + return errorCode; +} + +SbgErrorCode sbgEComEthernetSetConf(SbgEComHandle *pHandle, const SbgEComEthernetConf *pEthernetConf) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + uint32_t trial; + uint8_t outputBuffer[SBG_ECOM_MAX_BUFFER_SIZE]; + SbgStreamBuffer outputStream; + + assert(pHandle); + assert(pEthernetConf); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Init stream buffer for output + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + + // + // Build payload + // + errorCode = sbgEComEthernetConfWrite(&outputStream, pEthernetConf); + + // + // Send the payload if no error has occurred + // + if (errorCode == SBG_NO_ERROR) + { + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_ETHERNET_CONF, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + } + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComWaitForAck(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_ETHERNET_CONF, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a valid ACK + // + if (errorCode == SBG_NO_ERROR) + { + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + return errorCode; +} + +SbgErrorCode sbgEComEthernetInfo(SbgEComHandle *pHandle, SbgEComEthernetConf *pEthernetConf) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComProtocolPayload receivedPayload; + uint32_t trial; + + assert(pHandle); + assert(pEthernetConf); + + sbgEComProtocolPayloadConstruct(&receivedPayload); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the command with no payload to retreive the network configuration + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_ETHERNET_INFO, NULL, 0); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComReceiveCmd2(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_ETHERNET_INFO, &receivedPayload, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received correctly the answer + // + if (errorCode == SBG_NO_ERROR) + { + SbgStreamBuffer inputStream; + + // + // Initialize stream buffer to read parameters + // + sbgStreamBufferInitForRead(&inputStream, sbgEComProtocolPayloadGetBuffer(&receivedPayload), sbgEComProtocolPayloadGetSize(&receivedPayload)); + + // + // Read all parameters from the payload and return any error during the parse + // + errorCode = sbgEComEthernetConfParse(&inputStream, pEthernetConf); + + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + sbgEComProtocolPayloadDestroy(&receivedPayload); + + return errorCode; +} diff --git a/src/commands/sbgEComCmdEthernet.h b/src/commands/sbgEComCmdEthernet.h new file mode 100644 index 0000000..55a07fe --- /dev/null +++ b/src/commands/sbgEComCmdEthernet.h @@ -0,0 +1,112 @@ +/*! + * \file sbgEComCmdEthernet.h + * \author SBG Systems + * \date 14 November 2016 + * + * \brief Ethernet configuration related commands. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_CMD_ETHERNET_H +#define SBG_ECOM_CMD_ETHERNET_H + +// sbgCommonLib headers +#include + +// Project headers +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Ethernet interface configuration -// +//----------------------------------------------------------------------// + +/*! + * Enum that defines the different type of IP acquisition method. + */ +typedef enum _SbgEComEthernetMode +{ + SBG_ECOM_ETHERNET_DHCP = 0, /*!< The TCP/IP configuration should be acquired from a DHCP server. */ + SBG_ECOM_ETHERNET_STATIC = 1 /*!< The TCP/IP configuration is manually defined. */ +} SbgEComEthernetMode; + +/*! + * Structure that contains all Ethernet configuration or settings. + */ +typedef struct _SbgEComEthernetConf +{ + SbgEComEthernetMode mode; /*!< Define how the device will acquiere its IP address, either DHCP or Static. */ + sbgIpAddress ipAddress; /*!< For static mode, defines the device IP address. */ + sbgIpAddress netmask; /*!< For static mode, defines the device net mask. */ + sbgIpAddress gateway; /*!< For static mode, defines the gateway to use. */ + sbgIpAddress dns1; /*!< For static mode, defines the primary DNS to use. */ + sbgIpAddress dns2; /*!< For static mode, defines the secondary DNS to use. */ +} SbgEComEthernetConf; + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Get the configuration for the Ethernet interface. + * + * Warning: this method only returns the Ethernet configuration and NOT the ip address currently used by the device. + * You should rather use sbgEComEthernetInfo to retreive the current assigned IP. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[out] pEthernetConf Poiner to a SbgEComEthernetConf struct that holds the read configuration from the device. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComEthernetGetConf(SbgEComHandle *pHandle, SbgEComEthernetConf *pEthernetConf); + +/*! + * Set the configuration for the Ethernet interface. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] pEthernetConf Poiner to a SbgEComEthernetConf struct that holds the new configuration to apply. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComEthernetSetConf(SbgEComHandle *pHandle, const SbgEComEthernetConf *pEthernetConf); + +/*! + * Get the current assigned and used IP address as well as network inforamtion. + * + * In opposition to sbgEComEthernetGetConf, this method will not return the Ethernet configuration. + * It will rather return the IP address currently used by the device. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[out] pEthernetConf Poiner to a SbgEComEthernetConf struct that holds the read IP settings from the device. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComEthernetInfo(SbgEComHandle *pHandle, SbgEComEthernetConf *pEthernetConf); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_CMD_ETHERNET_H diff --git a/src/commands/sbgEComCmdEvent.c b/src/commands/sbgEComCmdEvent.c new file mode 100644 index 0000000..0766cdb --- /dev/null +++ b/src/commands/sbgEComCmdEvent.c @@ -0,0 +1,294 @@ +// sbgCommonLib headers +#include +#include + +// Project headers +#include + +// Local headers +#include "sbgEComCmdCommon.h" +#include "sbgEComCmdEvent.h" + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComCmdSyncInGetConf(SbgEComHandle *pHandle, SbgEComSyncInId syncInId, SbgEComSyncInConf *pConf) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComProtocolPayload receivedPayload; + uint32_t trial; + + assert(pHandle); + assert(pConf); + + sbgEComProtocolPayloadConstruct(&receivedPayload); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + uint8_t syncInIdParam = syncInId; + + // + // Send the command with syncInId as a 1-byte payload + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_SYNC_IN_CONF, &syncInIdParam, sizeof(syncInIdParam)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComReceiveCmd2(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_SYNC_IN_CONF, &receivedPayload, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a SBG_ECOM_CMD_SYNC_IN_CONF command + // + if (errorCode == SBG_NO_ERROR) + { + SbgStreamBuffer inputStream; + + // + // Initialize stream buffer to read parameters + // + sbgStreamBufferInitForRead(&inputStream, sbgEComProtocolPayloadGetBuffer(&receivedPayload), sbgEComProtocolPayloadGetSize(&receivedPayload)); + + // + // Read parameters + // First is returned the id of the sync, then the sensitivity and the delay at last. + // + syncInId = (SbgEComSyncInId)sbgStreamBufferReadUint8LE(&inputStream); + pConf->sensitivity = (SbgEComSyncInSensitivity)sbgStreamBufferReadUint8LE(&inputStream); + pConf->delay = sbgStreamBufferReadInt32LE(&inputStream); + + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + sbgEComProtocolPayloadDestroy(&receivedPayload); + + return errorCode; +} + +SbgErrorCode sbgEComCmdSyncInSetConf(SbgEComHandle *pHandle, SbgEComSyncInId syncInId, const SbgEComSyncInConf *pConf) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + uint32_t trial; + uint8_t outputBuffer[SBG_ECOM_MAX_BUFFER_SIZE]; + SbgStreamBuffer outputStream; + + assert(pHandle); + assert(pConf); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Init stream buffer for output + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + + // + // Build payload + // + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)syncInId); + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)pConf->sensitivity); + sbgStreamBufferWriteInt32LE(&outputStream, pConf->delay); + + // + // Send the message over ECom + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_SYNC_IN_CONF, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComWaitForAck(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_SYNC_IN_CONF, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a valid ACK + // + if (errorCode == SBG_NO_ERROR) + { + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + return errorCode; +} + +SbgErrorCode sbgEComCmdSyncOutGetConf(SbgEComHandle *pHandle, SbgEComSyncOutId syncOutId, SbgEComSyncOutConf *pConf) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComProtocolPayload receivedPayload; + uint32_t trial; + + assert(pHandle); + assert(pConf); + + sbgEComProtocolPayloadConstruct(&receivedPayload); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + uint8_t syncOutIdParam = syncOutId; + + // + // Send the command with syncOutId as a 1-byte payload + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_SYNC_OUT_CONF, &syncOutIdParam, sizeof(syncOutIdParam)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComReceiveCmd2(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_SYNC_OUT_CONF, &receivedPayload, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a SBG_ECOM_CMD_SYNC_OUT_CONF command + // + if (errorCode == SBG_NO_ERROR) + { + SbgStreamBuffer inputStream; + + // + // Initialize stream buffer to read parameters + // + sbgStreamBufferInitForRead(&inputStream, sbgEComProtocolPayloadGetBuffer(&receivedPayload), sbgEComProtocolPayloadGetSize(&receivedPayload)); + + // + // Read parameters + // First is returned the id of the sync, then a reserved field, the output function, polarity and the duration at last. + // + syncOutId = (SbgEComSyncOutId)sbgStreamBufferReadUint8LE(&inputStream); + sbgStreamBufferReadUint8LE(&inputStream); + pConf->outputFunction = (SbgEComSyncOutFunction)sbgStreamBufferReadUint16LE(&inputStream); + pConf->polarity = (SbgEComSyncOutPolarity)sbgStreamBufferReadUint8LE(&inputStream); + pConf->duration = sbgStreamBufferReadUint32LE(&inputStream); + + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + sbgEComProtocolPayloadDestroy(&receivedPayload); + + return errorCode; +} + +SbgErrorCode sbgEComCmdSyncOutSetConf(SbgEComHandle *pHandle, SbgEComSyncOutId syncOutId, const SbgEComSyncOutConf *pConf) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + uint32_t trial; + uint8_t outputBuffer[SBG_ECOM_MAX_BUFFER_SIZE]; + SbgStreamBuffer outputStream; + + assert(pHandle); + assert(pConf); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Init stream buffer for output + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + + // + // Build payload + // + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)syncOutId); + sbgStreamBufferWriteUint8LE(&outputStream, 0); + sbgStreamBufferWriteUint16LE(&outputStream, (uint16_t)pConf->outputFunction); + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)pConf->polarity); + sbgStreamBufferWriteUint32LE(&outputStream, pConf->duration); + + // + // Send the payload over ECom + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_SYNC_OUT_CONF, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComWaitForAck(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_SYNC_OUT_CONF, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a valid ACK + // + if (errorCode == SBG_NO_ERROR) + { + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + return errorCode; +} diff --git a/src/commands/sbgEComCmdEvent.h b/src/commands/sbgEComCmdEvent.h new file mode 100644 index 0000000..7f46e80 --- /dev/null +++ b/src/commands/sbgEComCmdEvent.h @@ -0,0 +1,187 @@ +/*! + * \file sbgEComCmdEvent.h + * \author SBG Systems + * \date 11 June 2014 + * + * \brief Input/output event markers configuration commands. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_CMD_EVENT_H +#define SBG_ECOM_CMD_EVENT_H + +// sbgCommonLib headers +#include + +// Project headers +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Event definitions -// +//----------------------------------------------------------------------// + +/*! + * List of sync in signals available. + */ +typedef enum _SbgEComSyncInId +{ + SBG_ECOM_SYNC_IN_A = 0, /*!< Sync IN A */ + SBG_ECOM_SYNC_IN_B = 1, /*!< Sync IN B */ + SBG_ECOM_SYNC_IN_C = 2, /*!< Sync IN C */ + SBG_ECOM_SYNC_IN_D = 3 /*!< Sync IN D */ +} SbgEComSyncInId; + +/*! + * List of available sensitivities for sync in signals. + */ +typedef enum _SbgEComSyncInSensitivity +{ + SBG_ECOM_SYNC_IN_DISABLED = 0, /*!< This trigger is turned OFF. */ + SBG_ECOM_SYNC_IN_FALLING_EDGE = 1, /*!< The trigger will be activated by a falling edge. */ + SBG_ECOM_SYNC_IN_RISING_EDGE = 2, /*!< The trigger will be activated by a rising edge. */ + SBG_ECOM_SYNC_IN_BOTH_EDGES = 3 /*!< The trigger is activated by a level change (rising or falling edge). */ +} SbgEComSyncInSensitivity; + +/*! + * List of sync out signals available. + */ +typedef enum _SbgEComSyncOutId +{ + SBG_ECOM_SYNC_OUT_A = 0, /*!< Synchronization output A */ + SBG_ECOM_SYNC_OUT_B = 1 /*!< Synchronization output B */ +} SbgEComSyncOutId; + +/*! + * Logic and synchronization output types + */ +typedef enum _SbgEComSyncOutFunction +{ + SBG_ECOM_SYNC_OUT_MODE_DISABLED = 0, /*!< Output is disabled. */ + SBG_ECOM_SYNC_OUT_MODE_MAIN_LOOP = 1, /*!< Output is generated at 200Hz. */ + SBG_ECOM_SYNC_OUT_MODE_DIV_2 = 2, /*!< Output is generated at 100Hz. */ + SBG_ECOM_SYNC_OUT_MODE_DIV_4 = 4, /*!< Output is generated at 50Hz. */ + SBG_ECOM_SYNC_OUT_MODE_DIV_8 = 8, /*!< Output is generated at 25Hz. */ + SBG_ECOM_SYNC_OUT_MODE_DIV_10 = 10, /*!< Output is generated at 20Hz. */ + SBG_ECOM_SYNC_OUT_MODE_DIV_20 = 20, /*!< Output is generated at 10Hz. */ + SBG_ECOM_SYNC_OUT_MODE_DIV_40 = 40, /*!< Output is generated at 5Hz. */ + SBG_ECOM_SYNC_OUT_MODE_DIV_200 = 200, /*!< Output is generated at 1Hz. */ + SBG_ECOM_SYNC_OUT_MODE_PPS = 10000, /*!< Pulse Per Second. Same mode as above. */ + SBG_ECOM_SYNC_OUT_MODE_EVENT_IN_A = 10003, /*!< Output is generated on a Sync In A event. */ + SBG_ECOM_SYNC_OUT_MODE_EVENT_IN_B = 10004, /*!< Output is generated on a Sync In B event. */ + SBG_ECOM_SYNC_OUT_MODE_EVENT_IN_C = 10005, /*!< Output is generated on a Sync In C event. */ + SBG_ECOM_SYNC_OUT_MODE_EVENT_IN_D = 10006, /*!< Output is generated on a Sync In D event. */ + + SBG_ECOM_SYNC_OUT_MODE_DIRECT_PPS = 10100, /*!< The internal GNSS PPS signal is directly routed to the Sync Out. + This mode is only valid for ELLIPSE-N with hardware revisions above 1.2.1.0. + Polarity and duration parameters are ignored with this specific mode. */ + +} SbgEComSyncOutFunction; + +/*! + * Logic output polarity + */ +typedef enum _SbgEComSyncOutPolarity +{ + SBG_ECOM_SYNC_OUT_FALLING_EDGE = 0, /*!< The output pin will generate a falling edge*/ + SBG_ECOM_SYNC_OUT_RISING_EDGE = 1, /*!< The output pin will generate a rising edge */ + SBG_ECOM_SYNC_OUT_TOGGLE = 2, /*!< The pulse is a level change */ +} SbgEComSyncOutPolarity; + +//----------------------------------------------------------------------// +//- Event configurations -// +//----------------------------------------------------------------------// + +/*! + * Helper structure for sync in configuration. + */ +typedef struct _SbgEComSyncInConf +{ + SbgEComSyncInSensitivity sensitivity; /*!< Sensitivity of the sync in. */ + int32_t delay; /*!< Delay to take into account for the sync in. (in us)*/ +} SbgEComSyncInConf; + +/*! + * Helper structure for sync out configuration. + */ +typedef struct _SbgEComSyncOutConf +{ + SbgEComSyncOutFunction outputFunction; /*!< Output function of the sync out pin */ + SbgEComSyncOutPolarity polarity; /*!< Polarity of the sync out. */ + uint32_t duration; /*!< Pulse width for the sync out (in ns). */ +} SbgEComSyncOutConf; + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Retrieve the configuration of a Sync In. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] syncInId The id of the sync whose configuration is to be retrieved. + * \param[out] pConf Pointer to a SbgEComSyncInConf to contain the current configuration of the sync in. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdSyncInGetConf(SbgEComHandle *pHandle, SbgEComSyncInId syncInId, SbgEComSyncInConf *pConf); + +/*! + * Set the configuration of a Sync In. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] syncInId The id of the sync whose configuration is to be set. + * \param[in] pConf Pointer to a SbgEComSyncInConf that contains the new configuration for the sync in. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdSyncInSetConf(SbgEComHandle *pHandle, SbgEComSyncInId syncInId, const SbgEComSyncInConf *pConf); + +/*! + * Retrieve the configuration of a Sync Out. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] syncOutId The id of the sync whose configuration is to be retrieved. + * \param[out] pConf Pointer to a SbgEComSyncOutConf to contain the current configuration of the sync out. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdSyncOutGetConf(SbgEComHandle *pHandle, SbgEComSyncOutId syncOutId, SbgEComSyncOutConf *pConf); + +/*! + * Set the configuration of a Sync Out. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] syncOutId The id of the sync whose configuration is to be set. + * \param[in] pConf Pointer to a SbgEComSyncOutConf that contains the new configuration for the sync Out. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdSyncOutSetConf(SbgEComHandle *pHandle, SbgEComSyncOutId syncOutId, const SbgEComSyncOutConf *pConf); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_CMD_EVENT_H diff --git a/src/commands/sbgEComCmdFeatures.c b/src/commands/sbgEComCmdFeatures.c new file mode 100644 index 0000000..efec8d3 --- /dev/null +++ b/src/commands/sbgEComCmdFeatures.c @@ -0,0 +1,100 @@ +// sbgCommonLib headers +#include +#include + +// Project headers +#include + +// Local headers +#include "sbgEComCmdCommon.h" +#include "sbgEComCmdFeatures.h" + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComCmdGetFeatures(SbgEComHandle *pHandle, SbgEComFeatures *pFeatures) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComProtocolPayload receivedPayload; + uint32_t trial; + + assert(pHandle); + assert(pFeatures); + + sbgEComProtocolPayloadConstruct(&receivedPayload); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the command only since this is a no-payload command + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_FEATURES, NULL, 0); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComReceiveCmd2(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_FEATURES, &receivedPayload, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a SBG_ECOM_CMD_GPS_FEATURES command + // + if (errorCode == SBG_NO_ERROR) + { + SbgStreamBuffer inputStream; + + // + // Initialize stream buffer to read parameters + // + sbgStreamBufferInitForRead(&inputStream, sbgEComProtocolPayloadGetBuffer(&receivedPayload), sbgEComProtocolPayloadGetSize(&receivedPayload)); + + // + // Read parameters + // + pFeatures->sensorFeaturesMask = sbgStreamBufferReadUint32LE(&inputStream); + pFeatures->gnssType = (SbgEComGnssType)sbgStreamBufferReadUint8LE(&inputStream); + pFeatures->gnssUpdateRate = sbgStreamBufferReadUint8LE(&inputStream); + pFeatures->gnssSignalsMask = sbgStreamBufferReadUint32LE(&inputStream); + pFeatures->gnssFeaturesMask = sbgStreamBufferReadUint32LE(&inputStream); + sbgStreamBufferReadBuffer(&inputStream, pFeatures->gnssProductCode, 32*sizeof(char)); + sbgStreamBufferReadBuffer(&inputStream, pFeatures->gnssSerialNumber, 32*sizeof(char)); + + // + // Only parse the GNSS firmware version if available + // + if (sbgStreamBufferGetSpace(&inputStream) > 0) + { + sbgStreamBufferReadBuffer(&inputStream, pFeatures->gnssFirmwareVersion, 32 * sizeof(char)); + } + else + { + strcpy(pFeatures->gnssFirmwareVersion, ""); + } + + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + sbgEComProtocolPayloadDestroy(&receivedPayload); + + return errorCode; +} diff --git a/src/commands/sbgEComCmdFeatures.h b/src/commands/sbgEComCmdFeatures.h new file mode 100644 index 0000000..0eb4a5f --- /dev/null +++ b/src/commands/sbgEComCmdFeatures.h @@ -0,0 +1,139 @@ +/*! + * \file sbgEComCmdFeatures.h + * \author SBG Systems + * \date 19 March 2015 + * + * \brief Commands used to query supported device features. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_CMD_FEATURES_H +#define SBG_ECOM_CMD_FEATURES_H + +// sbgCommonLib headers +#include + +// Project headers +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Feature commands definitions -// +//----------------------------------------------------------------------// + +// +// Main sensor features +// +#define SBG_ECOM_SENSOR_FEATURE_IMU (0x00000001 << 0) /*!< This unit can provide IMU data */ +#define SBG_ECOM_SENSOR_FEATURE_AHRS (0x00000001 << 1) /*!< This unit can provide orientation data */ +#define SBG_ECOM_SENSOR_FEATURE_NAVIGATION (0x00000001 << 2) /*!< This unit can provide position and velocity data */ +#define SBG_ECOM_SENSOR_FEATURE_SHIP_MOTION (0x00000001 << 3) /*!< This unit can provide ship motion data output (heave) */ + +// +// GPS Signals bitmask defining every signal +// +#define SBG_ECOM_GNSS_SIGNAL_GPS_L1 (0x00000001 << 0) /*!< This GNSS receiver tracks GPS L1 band. */ +#define SBG_ECOM_GNSS_SIGNAL_GPS_L2 (0x00000001 << 1) /*!< This GNSS receiver tracks GPS L2 band. */ +#define SBG_ECOM_GNSS_SIGNAL_GPS_L5 (0x00000001 << 2) /*!< This GNSS receiver tracks GPS L5 band. */ +#define SBG_ECOM_GNSS_SIGNAL_GLONASS_L1 (0x00000001 << 3) /*!< This GNSS receiver tracks GLONASS L1 band. */ +#define SBG_ECOM_GNSS_SIGNAL_GLONASS_L2 (0x00000001 << 4) /*!< This GNSS receiver tracks GLONASS L2 band. */ +#define SBG_ECOM_GNSS_SIGNAL_BEIDOU_B1 (0x00000001 << 5) /*!< This GNSS receiver tracks BEIDOU B1 band. */ +#define SBG_ECOM_GNSS_SIGNAL_BEIDOU_B2 (0x00000001 << 6) /*!< This GNSS receiver tracks BEIDOU B2 band. */ +#define SBG_ECOM_GNSS_SIGNAL_BEIDOU_B3 (0x00000001 << 7) /*!< This GNSS receiver tracks BEIDOU B3 band. */ +#define SBG_ECOM_GNSS_SIGNAL_GALILEO_E1 (0x00000001 << 8) /*!< This GNSS receiver tracks GALILEO E1 band. */ +#define SBG_ECOM_GNSS_SIGNAL_GALILEO_E5 (0x00000001 << 9) /*!< This GNSS receiver tracks GALILEO E5 band. */ +#define SBG_ECOM_GNSS_SIGNAL_GALILEO_E6 (0x00000001 << 10) /*!< This GNSS receiver tracks GALILEO E6 band. */ +#define SBG_ECOM_GNSS_SIGNAL_QZSS (0x00000001 << 11) /*!< This GNSS receiver tracks QZSS signals */ +#define SBG_ECOM_GNSS_SIGNAL_SBAS (0x00000001 << 12) /*!< This GNSS receiver tracks SBAS signals */ +#define SBG_ECOM_GNSS_SIGNAL_L_BAND (0x00000001 << 13) /*!< This GNSS receiver tracks L-Band (for PPP services) */ + +// +// GPS capabilities +// +#define SBG_ECOM_GNSS_FEATURE_DUAL_ANT (0x00000001 << 0) /*!< This GNSS receiver provides a dual antenna heading */ +#define SBG_ECOM_GNSS_FEATURE_RTK_LIMITED (0x00000001 << 1) /*!< This GNSS receiver has limited RTK accuracy (eg. Trimble RTK 30/30) */ +#define SBG_ECOM_GNSS_FEATURE_RTK (0x00000001 << 2) /*!< This GNSS receiver provides full RTK accuracy */ +#define SBG_ECOM_GNSS_FEATURE_PPP (0x00000001 << 3) /*!< This GNSS receiver provides PPP computations */ +#define SBG_ECOM_GNSS_FEATURE_RAW_DATA (0x00000001 << 4) /*!< This GNSS receiver provides RAW data output */ +#define SBG_ECOM_GNSS_FEATURE_RAIM (0x00000001 << 5) /*!< This GNSS receiver provides Receiver Autonomous Integrity Monitoring */ +#define SBG_ECOM_GNSS_FEATURE_HIGH_SPEED (0x00000001 << 6) /*!< This GNSS receiver has no high speed limitation (> 515m/s) */ + +//----------------------------------------------------------------------// +//- Feature commands types definition -// +//----------------------------------------------------------------------// + +/*! + * This enum defines the different types of internal GNSS receiver that can provide specific features. + * Note External type is considered as not handled by the feature system + */ +typedef enum _SbgEComGnssType +{ + SBG_ECOM_GNSS_TYPE_DISABLED = 0, /*!< GNSS module disabled */ + SBG_ECOM_GNSS_TYPE_EXTERNAL = 1, /*!< External GNSS module (all features are unknown) */ + SBG_ECOM_GNSS_TYPE_UBX_MAX_M8 = 2, /*!< Ublox MAX-M8 module */ + SBG_ECOM_GNSS_TYPE_NOV_OEM615 = 3, /*!< Novatel OEM615 device */ + SBG_ECOM_GNSS_TYPE_NOV_OEM615_DUAL = 4, /*!< Two Novatel OEM615 devices for dual antenna */ + SBG_ECOM_GNSS_TYPE_NOV_OEM617D = 5, /*!< Novatel OEM617D device */ + SBG_ECOM_GNSS_TYPE_SEP_AX4 = 6, /*!< Septentrio Asterx m4 */ + SBG_ECOM_GNSS_TYPE_SEP_AXM2A = 7, /*!< Septentrio Asterx m2a */ + SBG_ECOM_GNSS_TYPE_UBX_F9P = 8, /*!< Ublox ZED-F9P module */ +} SbgEComGnssType; + +/*! + * This structure contains all the information provided by the SBG_ECOM_CMD_GET_FEATURES command + */ +typedef struct _SbgEComFeatures +{ + uint32_t sensorFeaturesMask; /*!< The different measurement capabilities of this unit */ + SbgEComGnssType gnssType; /*!< The type of GNSS receiver used (brand and model) */ + uint8_t gnssUpdateRate; /*!< The actual GNSS update rate */ + uint32_t gnssSignalsMask; /*!< GNSS receiver signals tracking */ + uint32_t gnssFeaturesMask; /*!< GNSS receiver computation and output features */ + char gnssProductCode[32]; /*!< String containing the GNSS receiver product code ("\0" if unknown) */ + char gnssSerialNumber[32]; /*!< String containing the GNSS receiver serial number ("\0" if unknown) */ + char gnssFirmwareVersion[32]; /*!< String containing the GNSS receiver firmware version ("\0" if unknown) */ +} SbgEComFeatures; + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Retrieve the device and embedded GPS receiver features. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] pFeatures A pointer to a structure to hold features. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdGetFeatures(SbgEComHandle *pHandle, SbgEComFeatures *pFeatures); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_CMD_FEATURES_H diff --git a/src/commands/sbgEComCmdGnss.c b/src/commands/sbgEComCmdGnss.c new file mode 100644 index 0000000..9dd1c8b --- /dev/null +++ b/src/commands/sbgEComCmdGnss.c @@ -0,0 +1,422 @@ +// sbgCommonLib headers +#include +#include + +// Project headers +#include + +// Local headers +#include "sbgEComCmdCommon.h" +#include "sbgEComCmdGnss.h" + +//----------------------------------------------------------------------// +//- Private methods -// +//----------------------------------------------------------------------// + +/*! + * Set GNSS error model id. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] id Model ID to set + * \param[in] cmdId The command identifier to set parameters for a specific GNSS module. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +static SbgErrorCode sbgEComCmdGnssSetModelId(SbgEComHandle *pHandle, SbgEComGnssModelsStdIds modelId, SbgEComCmd cmdId) +{ + assert(pHandle); + + return sbgEComCmdGenericSetModelId(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, cmdId, modelId); +} + +/*! + * Retrieve GNSS error model id. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[out] pModelId Retreived model id. + * \param[in] cmdId The command identifier to get parameters for a specific GNSS module. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +static SbgErrorCode sbgEComCmdGnssGetModelId(SbgEComHandle *pHandle, SbgEComGnssModelsStdIds *pModelId, SbgEComCmd cmdId) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + uint32_t modelIdAsUint; + + assert(pHandle); + assert(pModelId); + + errorCode = sbgEComCmdGenericGetModelId(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, cmdId, &modelIdAsUint); + + if (errorCode == SBG_NO_ERROR) + { + *pModelId = (SbgEComGnssModelsStdIds)modelIdAsUint; + } + + return errorCode; +} + +/*! + * Retrieve the mechanical installation parameters for the GNSS # module. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[out] pGnssInstallation Used to store the retrieved the GNSS installation parameters. + * \param[in] cmdId The command identifier to get parameters for a specific GNSS module. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +static SbgErrorCode sbgEComCmdGnssInstallationGet(SbgEComHandle *pHandle, SbgEComGnssInstallation *pGnssInstallation, SbgEComCmd cmdId) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComProtocolPayload receivedPayload; + uint32_t trial; + + assert(pHandle); + assert(pGnssInstallation); + + sbgEComProtocolPayloadConstruct(&receivedPayload); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the command only since this is a no-payload command + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, cmdId, NULL, 0); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComReceiveCmd2(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, cmdId, &receivedPayload, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a valid answer + // + if (errorCode == SBG_NO_ERROR) + { + SbgStreamBuffer inputStream; + + // + // Initialize stream buffer to read parameters + // + sbgStreamBufferInitForRead(&inputStream, sbgEComProtocolPayloadGetBuffer(&receivedPayload), sbgEComProtocolPayloadGetSize(&receivedPayload)); + + // + // Read parameters + // + pGnssInstallation->leverArmPrimary[0] = sbgStreamBufferReadFloatLE(&inputStream); + pGnssInstallation->leverArmPrimary[1] = sbgStreamBufferReadFloatLE(&inputStream); + pGnssInstallation->leverArmPrimary[2] = sbgStreamBufferReadFloatLE(&inputStream); + pGnssInstallation->leverArmPrimaryPrecise = sbgStreamBufferReadBooleanLE(&inputStream); + + pGnssInstallation->leverArmSecondary[0] = sbgStreamBufferReadFloatLE(&inputStream); + pGnssInstallation->leverArmSecondary[1] = sbgStreamBufferReadFloatLE(&inputStream); + pGnssInstallation->leverArmSecondary[2] = sbgStreamBufferReadFloatLE(&inputStream); + pGnssInstallation->leverArmSecondaryMode = (SbgEComGnssInstallationMode)sbgStreamBufferReadUint8LE(&inputStream); + + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + sbgEComProtocolPayloadDestroy(&receivedPayload); + + return errorCode; +} + +/*! + * Set the mechanical installation parameters for the GNSS # module. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] pGnssInstallation The GNSS installation parameters to set. + * \param[in] cmdId The command identifier to set parameters for a specific GNSS module. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +static SbgErrorCode sbgEComCmdGnssInstallationSet(SbgEComHandle *pHandle, const SbgEComGnssInstallation *pGnssInstallation, SbgEComCmd cmdId) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + uint32_t trial; + uint8_t outputBuffer[64]; + SbgStreamBuffer outputStream; + + assert(pHandle); + assert(pGnssInstallation); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Initialize stream buffer for output + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + + // + // Build payload + // + sbgStreamBufferWriteFloatLE(&outputStream, pGnssInstallation->leverArmPrimary[0]); + sbgStreamBufferWriteFloatLE(&outputStream, pGnssInstallation->leverArmPrimary[1]); + sbgStreamBufferWriteFloatLE(&outputStream, pGnssInstallation->leverArmPrimary[2]); + sbgStreamBufferWriteBooleanLE(&outputStream, pGnssInstallation->leverArmPrimaryPrecise); + + sbgStreamBufferWriteFloatLE(&outputStream, pGnssInstallation->leverArmSecondary[0]); + sbgStreamBufferWriteFloatLE(&outputStream, pGnssInstallation->leverArmSecondary[1]); + sbgStreamBufferWriteFloatLE(&outputStream, pGnssInstallation->leverArmSecondary[2]); + sbgStreamBufferWriteUint8LE(&outputStream, pGnssInstallation->leverArmSecondaryMode); + + // + // Send the payload over ECom + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, cmdId, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComWaitForAck(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, cmdId, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a valid ACK + // + if (errorCode == SBG_NO_ERROR) + { + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + return errorCode; +} + +/*! + * Retrieve the rejection configuration of the gnss module. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[out] pAlignConf Pointer to a SbgEComGnssRejectionConf struct to hold rejection configuration of the gnss module. + * \param[in] cmdId The command identifier to get parameters for a specific GNSS module. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +static SbgErrorCode sbgEComCmdGnssGetRejection(SbgEComHandle *pHandle, SbgEComGnssRejectionConf *pRejectConf, SbgEComCmd cmdId) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComProtocolPayload receivedPayload; + uint32_t trial; + + assert(pHandle); + assert(pRejectConf); + + sbgEComProtocolPayloadConstruct(&receivedPayload); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the command only since this is a no-payload command + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, cmdId, NULL, 0); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComReceiveCmd2(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, cmdId, &receivedPayload, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a SBG_ECOM_CMD_GNSS_1_REJECT_MODES command + // + if (errorCode == SBG_NO_ERROR) + { + SbgStreamBuffer inputStream; + + // + // Initialize stream buffer to read parameters + // + sbgStreamBufferInitForRead(&inputStream, sbgEComProtocolPayloadGetBuffer(&receivedPayload), sbgEComProtocolPayloadGetSize(&receivedPayload)); + + // + // Read parameters + // + pRejectConf->position = (SbgEComRejectionMode)sbgStreamBufferReadUint8LE(&inputStream); + pRejectConf->velocity = (SbgEComRejectionMode)sbgStreamBufferReadUint8LE(&inputStream); + sbgStreamBufferReadUint8LE(&inputStream); // Skipped for backward compatibility + pRejectConf->hdt = (SbgEComRejectionMode)sbgStreamBufferReadUint8LE(&inputStream); + + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + sbgEComProtocolPayloadDestroy(&receivedPayload); + + return errorCode; +} + +/*! + * Set the rejection configuration of the gnss module. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[out] pAlignConf Pointer to a SbgEComGnssRejectionConf struct holding rejection configuration for the gnss module. + * \param[in] cmdId The command identifier to set parameters for a specific GNSS module. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +static SbgErrorCode sbgEComCmdGnssSetRejection(SbgEComHandle *pHandle, const SbgEComGnssRejectionConf *pRejectConf, SbgEComCmd cmdId) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + uint32_t trial; + uint8_t outputBuffer[64]; + SbgStreamBuffer outputStream; + + assert(pHandle); + assert(pRejectConf); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Init stream buffer for output + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + + // + // Build payload + // + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)pRejectConf->position); + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)pRejectConf->velocity); + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)SBG_ECOM_NEVER_ACCEPT_MODE); // Reserved parameter + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)pRejectConf->hdt); + + // + // Send the payload over ECom + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, cmdId, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComWaitForAck(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, cmdId, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a valid ACK + // + if (errorCode == SBG_NO_ERROR) + { + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + return errorCode; +} + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComCmdGnss1SetModelId(SbgEComHandle *pHandle, SbgEComGnssModelsStdIds modelId) +{ + assert(pHandle); + + return sbgEComCmdGnssSetModelId(pHandle, modelId, SBG_ECOM_CMD_GNSS_1_MODEL_ID); +} + +SbgErrorCode sbgEComCmdGnss1GetModelId(SbgEComHandle *pHandle, SbgEComGnssModelsStdIds *pModelId) +{ + assert(pHandle); + assert(pModelId); + + return sbgEComCmdGnssGetModelId(pHandle, pModelId, SBG_ECOM_CMD_GNSS_1_MODEL_ID); +} + +SbgErrorCode sbgEComCmdGnss1InstallationGet(SbgEComHandle *pHandle, SbgEComGnssInstallation *pGnssInstallation) +{ + assert(pHandle); + assert(pGnssInstallation); + + return sbgEComCmdGnssInstallationGet(pHandle, pGnssInstallation, SBG_ECOM_CMD_GNSS_1_INSTALLATION); +} + +SbgErrorCode sbgEComCmdGnss1InstallationSet(SbgEComHandle *pHandle, const SbgEComGnssInstallation *pGnssInstallation) +{ + assert(pHandle); + assert(pGnssInstallation); + + return sbgEComCmdGnssInstallationSet(pHandle, pGnssInstallation, SBG_ECOM_CMD_GNSS_1_INSTALLATION); +} + +SbgErrorCode sbgEComCmdGnss1GetRejection(SbgEComHandle *pHandle, SbgEComGnssRejectionConf *pRejectConf) +{ + assert(pHandle); + assert(pRejectConf); + + return sbgEComCmdGnssGetRejection(pHandle, pRejectConf, SBG_ECOM_CMD_GNSS_1_REJECT_MODES); +} + +SbgErrorCode sbgEComCmdGnss1SetRejection(SbgEComHandle *pHandle, const SbgEComGnssRejectionConf *pRejectConf) +{ + assert(pHandle); + assert(pRejectConf); + + return sbgEComCmdGnssSetRejection(pHandle, pRejectConf, SBG_ECOM_CMD_GNSS_1_REJECT_MODES); +} diff --git a/src/commands/sbgEComCmdGnss.h b/src/commands/sbgEComCmdGnss.h new file mode 100644 index 0000000..3772024 --- /dev/null +++ b/src/commands/sbgEComCmdGnss.h @@ -0,0 +1,164 @@ +/*! + * \file sbgEComCmdGnss.h + * \author SBG Systems + * \date 11 June 2014 + * + * \brief GNSS aiding module configuration commands. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_CMD_GNSS_H +#define SBG_ECOM_CMD_GNSS_H + +// sbgCommonLib headers +#include + +// Project headers +#include + +// Local headers +#include "sbgEComCmdCommon.h" + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Public definitions -// +//----------------------------------------------------------------------// + +/*! + * This enum defines the different GNSS model IDs available in standard + */ +typedef enum _SbgEComGnssModelsStdIds +{ + SBG_ECOM_GNSS_MODEL_INTERNAL = 101, /*!< Default internal GNSS for ELLIPSE-N and ELLIPSE-D */ + SBG_ECOM_GNSS_MODEL_NMEA = 102, /*!< ELLIPSE-E to accept an external GNSS using NMEA protocol */ + SBG_ECOM_GNSS_MODEL_UBLOX_GPS_BEIDOU = 103, /*!< Only for ELLIPSE-N hardware 1 & 2 to select GPS+BEIDOU instead of the default GPS+GLONASS */ + SBG_ECOM_GNSS_MODEL_UBLOX_EXTERNAL = 104, /*!< ELLIPSE-E to accept an external Ublox GNSS (receive only - passive) */ + SBG_ECOM_GNSS_MODEL_RESERVED_01 = 105, /*!< Reserved, do not use */ + SBG_ECOM_GNSS_MODEL_NOVATEL_EXTERNAL = 106, /*!< ELLIPSE-E to accept an external Novatel GNSS (receive only - passive) */ + SBG_ECOM_GNSS_MODEL_RESERVED_02 = 107, /*!< Reserved, do not use */ + SBG_ECOM_GNSS_MODEL_RESERVED_03 = 108, /*!< Reserved, do not use */ + SBG_ECOM_GNSS_MODEL_SEPTENTRIO_EXTERNAL = 109, /*!< ELLIPSE-E to accept an external Septentrio GNSS(receive only - passive) */ + SBG_ECOM_GNSS_MODEL_RESERVED_04 = 110 /*!< Reserved, do not use */ +} SbgEComGnssModelsStdIds; + +/*! + * GNSS mechanical installation modes for the dual antenna mode. + */ +typedef enum _SbgEComGnssInstallationMode +{ + SBG_ECOM_GNSS_INSTALLATION_MODE_SINGLE = 1, /*!< The GNSS will be used in single antenna mode only and the secondary lever arm is not used. */ + SBG_ECOM_GNSS_INSTALLATION_MODE_DUAL_AUTO = 2, /*!< [Reserved] The GNSS dual antenna information will be used but the secondary lever arm is not known. */ + SBG_ECOM_GNSS_INSTALLATION_MODE_DUAL_ROUGH = 3, /*!< The GNSS dual antenna information will be used and we have a rough guess for the secondary lever arm. */ + SBG_ECOM_GNSS_INSTALLATION_MODE_DUAL_PRECISE = 4 /*!< The GNSS dual antenna information will be used and the secondary lever arm is accurately entered and doesn't need online re-estimation. */ +} SbgEComGnssInstallationMode; + +/*! + * GNSS mechanical installation parameters to be used with command SBG_ECOM_CMD_GNSS_#_INSTALLATION + */ +typedef struct _SbgEComGnssInstallation +{ + float leverArmPrimary[3]; /*!< GNSS primary antenna lever arm in IMU X, Y, Z axis in meters */ + bool leverArmPrimaryPrecise; /*!< If set to true, the primary lever arm has been accurately entered and doesn't need online re-estimation. */ + + float leverArmSecondary[3]; /*!< GNSS secondary antenna lever arm in IMU X, Y, Z axis in meters */ + SbgEComGnssInstallationMode leverArmSecondaryMode; /*!< Define the secondary antenna (dual antenna) operating mode. */ +} SbgEComGnssInstallation; + +/*! + * Holds all necessary information for GNSS module data rejection. + */ +typedef struct _SbgEComGnssRejectionConf +{ + SbgEComRejectionMode position; /*!< Rejection mode for position. */ + SbgEComRejectionMode velocity; /*!< Rejection mode for velocity. */ + SbgEComRejectionMode hdt; /*!< Rejection mode for true heading. */ +} SbgEComGnssRejectionConf; + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Set GNSS error model id. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] modelId Model ID to set + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdGnss1SetModelId(SbgEComHandle *pHandle, SbgEComGnssModelsStdIds modelId); + +/*! + * Retrieve GNSS error model id. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[out] pModelId Retrieved model id. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdGnss1GetModelId(SbgEComHandle *pHandle, SbgEComGnssModelsStdIds *pModelId); + +/*! + * Retrieve the mechanical installation parameters for the GNSS 1 module. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[out] pGnssInstallation Used to store the retrieved the GNSS installation parameters. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdGnss1InstallationGet(SbgEComHandle *pHandle, SbgEComGnssInstallation *pGnssInstallation); + +/*! + * Set the mechanical installation parameters for the GNSS 1 module. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] pGnssInstallation The GNSS installation parameters to set. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdGnss1InstallationSet(SbgEComHandle *pHandle, const SbgEComGnssInstallation *pGnssInstallation); + +/*! + * Retrieve the rejection configuration of the gnss module. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[out] pRejectConf Pointer to a SbgEComGnssRejectionConf struct to hold rejection configuration of the gnss module. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdGnss1GetRejection(SbgEComHandle *pHandle, SbgEComGnssRejectionConf *pRejectConf); + +/*! + * Set the rejection configuration of the gnss module. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[out] pRejectConf Pointer to a SbgEComGnssRejectionConf struct holding rejection configuration for the gnss module. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdGnss1SetRejection(SbgEComHandle *pHandle, const SbgEComGnssRejectionConf *pRejectConf); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_CMD_GNSS_H diff --git a/src/commands/sbgEComCmdInfo.c b/src/commands/sbgEComCmdInfo.c new file mode 100644 index 0000000..fb4598a --- /dev/null +++ b/src/commands/sbgEComCmdInfo.c @@ -0,0 +1,105 @@ +// sbgCommonLib headers +#include +#include + +// Project headers +#include + +// Local headers +#include "sbgEComCmdCommon.h" +#include "sbgEComCmdInfo.h" + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComCmdGetInfo(SbgEComHandle *pHandle, SbgEComDeviceInfo *pInfo) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComProtocolPayload receivedPayload; + uint32_t trial; + + + assert(pHandle); + assert(pInfo); + + sbgEComProtocolPayloadConstruct(&receivedPayload); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the command only since this is a no-payload command + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_INFO, NULL, 0); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComReceiveCmd2(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_INFO, &receivedPayload, pHandle->cmdDefaultTimeOut); + + // + // Test if we have correctly received a message + // + if (errorCode == SBG_NO_ERROR) + { + // + // Make sure we have received a payload + // + if (sbgEComProtocolPayloadGetSize(&receivedPayload) > 0) + { + SbgStreamBuffer inputStream; + + // + // Initialize stream buffer to read parameters + // + sbgStreamBufferInitForRead(&inputStream, sbgEComProtocolPayloadGetBuffer(&receivedPayload), sbgEComProtocolPayloadGetSize(&receivedPayload)); + + // + // Read parameters + // + sbgStreamBufferReadBuffer(&inputStream, pInfo->productCode, SBG_ECOM_INFO_PRODUCT_CODE_LENGTH); + pInfo->serialNumber = sbgStreamBufferReadUint32LE(&inputStream); + pInfo->calibationRev = sbgStreamBufferReadUint32LE(&inputStream); + pInfo->calibrationYear = sbgStreamBufferReadUint16LE(&inputStream); + pInfo->calibrationMonth = sbgStreamBufferReadUint8LE(&inputStream); + pInfo->calibrationDay = sbgStreamBufferReadUint8LE(&inputStream); + pInfo->hardwareRev = sbgStreamBufferReadUint32LE(&inputStream); + pInfo->firmwareRev = sbgStreamBufferReadUint32LE(&inputStream); + + // + // We have parsed a message so return immediately but report any error during payload parsing + // + errorCode = sbgStreamBufferGetLastError(&inputStream); + + break; + } + else + { + // + // We should have received a non empty payload so we have received an invalid frame + // + errorCode = SBG_INVALID_FRAME; + } + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + sbgEComProtocolPayloadDestroy(&receivedPayload); + + return errorCode; +} diff --git a/src/commands/sbgEComCmdInfo.h b/src/commands/sbgEComCmdInfo.h new file mode 100644 index 0000000..11d003d --- /dev/null +++ b/src/commands/sbgEComCmdInfo.h @@ -0,0 +1,88 @@ +/*! + * \file sbgEComCmdInfo.h + * \author SBG Systems + * \date 11 June 2014 + * + * \brief Commands used to query the device information. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_CMD_INFO_H +#define SBG_ECOM_CMD_INFO_H + +// sbgCommonLib headers +#include + +// Project headers +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Device info definitions -// +//----------------------------------------------------------------------// + +/* Misc */ +#define SBG_ECOM_INFO_PRODUCT_CODE_LENGTH (32) + +//----------------------------------------------------------------------// +//- Device Info structure -// +//----------------------------------------------------------------------// + +/*! + * Helper structure to retrieve device info. + */ +typedef struct _SbgEComDeviceInfo +{ + uint8_t productCode[SBG_ECOM_INFO_PRODUCT_CODE_LENGTH]; /*!< Human readable Product Code. */ + uint32_t serialNumber; /*!< Device serial number */ + uint32_t calibationRev; /*!< Calibration data revision */ + uint16_t calibrationYear; /*!< Device Calibration Year */ + uint8_t calibrationMonth; /*!< Device Calibration Month */ + uint8_t calibrationDay; /*!< Device Calibration Day */ + uint32_t hardwareRev; /*!< Device hardware revision */ + uint32_t firmwareRev; /*!< Firmware revision */ +} SbgEComDeviceInfo; + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Retrieve the device information. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] pInfo A pointer to a structure to hold device information. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdGetInfo(SbgEComHandle *pHandle, SbgEComDeviceInfo *pInfo); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_CMD_INFO_H diff --git a/src/commands/sbgEComCmdInterface.c b/src/commands/sbgEComCmdInterface.c new file mode 100644 index 0000000..e0f10b9 --- /dev/null +++ b/src/commands/sbgEComCmdInterface.c @@ -0,0 +1,301 @@ +// sbgCommonLib headers +#include +#include + +// Project headers +#include + +// Local headers +#include "sbgEComCmdCommon.h" +#include "sbgEComCmdInterface.h" + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComCmdInterfaceGetUartConf(SbgEComHandle *pHandle, SbgEComPortId interfaceId, SbgEComInterfaceConf *pConf) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComProtocolPayload receivedPayload; + uint32_t trial; + + assert(pHandle); + assert(pConf); + + sbgEComProtocolPayloadConstruct(&receivedPayload); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + uint8_t interfaceIdParam = interfaceId; + + // + // Send the command and the interfaceId as a 1-byte payload + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_UART_CONF, &interfaceIdParam, sizeof(interfaceIdParam)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComReceiveCmd2(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_UART_CONF, &receivedPayload, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received correctly the answer + // + if (errorCode == SBG_NO_ERROR) + { + SbgStreamBuffer inputStream; + + // + // Initialize stream buffer to read parameters + // + sbgStreamBufferInitForRead(&inputStream, sbgEComProtocolPayloadGetBuffer(&receivedPayload), sbgEComProtocolPayloadGetSize(&receivedPayload)); + + // + // Read parameters + // First is returned interfaceId, then baud rate and the mode at last. + // + interfaceId = (SbgEComPortId)sbgStreamBufferReadUint8LE(&inputStream); + pConf->baudRate = sbgStreamBufferReadUint32LE(&inputStream); + pConf->mode = (SbgEComPortMode)sbgStreamBufferReadUint8LE(&inputStream); + + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + sbgEComProtocolPayloadDestroy(&receivedPayload); + + return errorCode; +} + +SbgErrorCode sbgEComCmdInterfaceSetUartConf(SbgEComHandle *pHandle, SbgEComPortId interfaceId, const SbgEComInterfaceConf *pConf) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + uint32_t trial; + uint8_t outputBuffer[64]; + SbgStreamBuffer outputStream; + + assert(pHandle); + assert(pConf); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Init stream buffer for output + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + + // + // Build payload + // + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)interfaceId); + sbgStreamBufferWriteUint32LE(&outputStream, pConf->baudRate); + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)pConf->mode); + + // + // Send the payload over ECom + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_UART_CONF, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComWaitForAck(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_UART_CONF, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a valid ACK + // + if (errorCode == SBG_NO_ERROR) + { + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + return errorCode; +} + +SbgErrorCode sbgEComCmdInterfaceGetCanConf(SbgEComHandle *pHandle, SbgEComCanBitRate *pBitrate, SbgEComCanMode *pMode) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComProtocolPayload receivedPayload; + uint32_t trial; + + assert(pHandle); + assert(pBitrate); + assert(pMode); + + sbgEComProtocolPayloadConstruct(&receivedPayload); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the command with no payload + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_CAN_BUS_CONF, NULL, 0); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComReceiveCmd2(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_CAN_BUS_CONF, &receivedPayload, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a SBG_ECOM_CMD_CAN_BUS_CONF command + // + if (errorCode == SBG_NO_ERROR) + { + SbgStreamBuffer inputStream; + + // + // Initialize stream buffer to read parameters + // + sbgStreamBufferInitForRead(&inputStream, sbgEComProtocolPayloadGetBuffer(&receivedPayload), sbgEComProtocolPayloadGetSize(&receivedPayload)); + + // + // Read bit rate returned by the device + // + *pBitrate = (SbgEComCanBitRate)sbgStreamBufferReadUint16LE(&inputStream); + + // + // Check if we can parse the CAN mode that has been introduced in sbgECom version 2.0 + // + if (sbgStreamBufferGetSpace(&inputStream) > 0) + { + // + // Read mode returned by the device + // + *pMode = (SbgEComCanMode)sbgStreamBufferReadUint8(&inputStream); + } + else + { + // + // Default the mode to the behavior prior to CAN mode setting introduction + // + *pMode = SBG_ECOM_CAN_MODE_NORMAL; + } + + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + sbgEComProtocolPayloadDestroy(&receivedPayload); + + return errorCode; +} + +SbgErrorCode sbgEComCmdInterfaceSetCanConf(SbgEComHandle *pHandle, SbgEComCanBitRate bitrate, SbgEComCanMode mode) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + uint32_t trial; + uint8_t outputBuffer[3]; + SbgStreamBuffer outputStream; + + assert(pHandle); + assert(bitrate <= UINT16_MAX); + assert(mode <= UINT8_MAX); + + // + // Build the command payload + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + + sbgStreamBufferWriteUint16LE(&outputStream, (uint16_t)bitrate); + sbgStreamBufferWriteUint8(&outputStream, (uint8_t)mode); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the payload over ECom + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_CAN_BUS_CONF, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComWaitForAck(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_CAN_BUS_CONF, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a valid ACK + // + if (errorCode == SBG_NO_ERROR) + { + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + return errorCode; +} diff --git a/src/commands/sbgEComCmdInterface.h b/src/commands/sbgEComCmdInterface.h new file mode 100644 index 0000000..da016d2 --- /dev/null +++ b/src/commands/sbgEComCmdInterface.h @@ -0,0 +1,173 @@ +/*! + * \file sbgEComCmdInterface.h + * \author SBG Systems + * \date 11 June 2014 + * + * \brief Commands used to configure device serial, CAN and Ethernet interfaces. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_CMD_INTERFACE_H +#define SBG_ECOM_CMD_INTERFACE_H + +// sbgCommonLib headers +#include + +// Project headers +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Serial interface definitions -// +//----------------------------------------------------------------------// + +/*! + * List of serial interfaces available. + */ +typedef enum _SbgEComPortId +{ + SBG_ECOM_IF_COM_A = 0, /*!< Main communication interface. Full duplex. */ + SBG_ECOM_IF_COM_B = 1, /*!< Auxiliary input interface for RTCM. */ + SBG_ECOM_IF_COM_C = 2, /*!< Auxiliary communication interface. Full duplex. */ + SBG_ECOM_IF_COM_D = 3, /*!< Auxiliary input interface. */ + SBG_ECOM_IF_COM_E = 4, /*!< Auxiliary output interface. */ + + SBG_ECOM_IF_ETH_0 = 10, /*!< Ethernet interface 0. */ + SBG_ECOM_IF_ETH_1 = 11, /*!< Ethernet interface 1. */ + SBG_ECOM_IF_ETH_2 = 12, /*!< Ethernet interface 2. */ + SBG_ECOM_IF_ETH_3 = 13, /*!< Ethernet interface 3. */ + SBG_ECOM_IF_ETH_4 = 14, /*!< Ethernet interface 4. */ + + SBG_ECOM_IF_DATA_LOGGER = 20, /*!< Data logger interface. */ +} SbgEComPortId; + +/*! + * List of serial modes available. + */ +typedef enum _SbgEComPortMode +{ + SBG_ECOM_UART_MODE_OFF = 0, /*!< This interface is turned OFF. */ + SBG_ECOM_UART_MODE_232 = 1, /*!< This interface is using RS-232 communications. */ + SBG_ECOM_UART_MODE_422 = 2, /*!< This interface is using RS-422 communications. */ +} SbgEComPortMode; + +//----------------------------------------------------------------------// +//- Serial interface configuration -// +//----------------------------------------------------------------------// + +/*! + * Helper structure to configure a serial interface + */ +typedef struct _SbgEComInterfaceConf +{ + uint32_t baudRate; /*!< The baud rate of the interface. */ + SbgEComPortMode mode; /*!< The mode of the interface. */ +} SbgEComInterfaceConf; + +//----------------------------------------------------------------------// +//- CAN interface definitions -// +//----------------------------------------------------------------------// + +/*! + * Enum containing the list of all available bit rates (in KB/s). + */ +typedef enum _SbgEComCanBitRate +{ + SBG_ECOM_CAN_BITRATE_DISABLED = 0, /*!< The CAN interface is disabled. */ + SBG_ECOM_CAN_BITRATE_10 = 10, /*!< 10Kb/s. */ + SBG_ECOM_CAN_BITRATE_20 = 20, /*!< 20Kb/s. */ + SBG_ECOM_CAN_BITRATE_25 = 25, /*!< 25Kb/s. */ + SBG_ECOM_CAN_BITRATE_50 = 50, /*!< 50Kb/s. */ + SBG_ECOM_CAN_BITRATE_100 = 100, /*!< 100Kb/s. */ + SBG_ECOM_CAN_BITRATE_125 = 125, /*!< 125Kb/s. */ + SBG_ECOM_CAN_BITRATE_250 = 250, /*!< 250Kb/s. */ + SBG_ECOM_CAN_BITRATE_500 = 500, /*!< 500Kb/s. */ + SBG_ECOM_CAN_BITRATE_750 = 750, /*!< 750Kb/s. */ + SBG_ECOM_CAN_BITRATE_1000 = 1000, /*!< 1Mb/s. */ +} SbgEComCanBitRate; + +/*! + * Enum containing the list of different CAN modes + */ +typedef enum _SbgEComCanMode +{ + SBG_ECOM_CAN_MODE_UNDEFINED = 0, /*!< CAN Mode undefined. */ + SBG_ECOM_CAN_MODE_SPY = 1, /*!< Only listening on the CAN bus and doesn't sent anything (even RX ACK bit). */ + SBG_ECOM_CAN_MODE_NORMAL = 2, /*!< The device is allowed to both send and receive over the CAN bus. */ + SBG_ECOM_CAN_NR_MODE +} SbgEComCanMode; + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Retrieve the configuration of one of the interfaces. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] interfaceId The interface from which the configuration is to be retrieved. + * \param[out] pConf Pointer to a SbgEComInterfaceConf struct to hold configuration of the interface. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdInterfaceGetUartConf(SbgEComHandle *pHandle, SbgEComPortId interfaceId, SbgEComInterfaceConf *pConf); + +/*! + * Set the configuration of one of the interfaces. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] interfaceId The interface from which the configuration is to be retrieved. + * \param[in] pConf Pointer to a SbgEComInterfaceConf struct that holds the new configuration for the interface. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdInterfaceSetUartConf(SbgEComHandle *pHandle, SbgEComPortId interfaceId, const SbgEComInterfaceConf *pConf); + +/*! + * Retrieve the configuration of the CAN interface. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[out] pBitrate The bitrate of the CAN interface. + * \param[out] pMode Mode of the CAN interface. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdInterfaceGetCanConf(SbgEComHandle *pHandle, SbgEComCanBitRate *pBitrate, SbgEComCanMode *pMode); + +/*! + * Set the configuration of the CAN interface. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] bitRate The bitrate of the CAN interface. + * \param[in] mode Mode of the CAN interface. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdInterfaceSetCanConf(SbgEComHandle *pHandle, SbgEComCanBitRate bitRate, SbgEComCanMode mode); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_CMD_INTERFACE_H diff --git a/src/commands/sbgEComCmdLicense.c b/src/commands/sbgEComCmdLicense.c new file mode 100644 index 0000000..ce5a4e8 --- /dev/null +++ b/src/commands/sbgEComCmdLicense.c @@ -0,0 +1,44 @@ +// sbgCommonLib headers +#include +#include + +// Project headers +#include +#include + +// Local headers +#include "sbgEComCmdCommon.h" +#include "sbgEComCmdLicense.h" + + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComCmdLicenseApply(SbgEComHandle *pHandle, const void *pBuffer, size_t size) +{ + SbgErrorCode errorCode; + uint32_t currentTimeOut; + + assert(pHandle); + assert(pBuffer); + assert(size > 0); + + // + // Define a time out of 10s to let enough time for the GNSS receiver to apply the license + // + currentTimeOut = pHandle->cmdDefaultTimeOut; + pHandle->cmdDefaultTimeOut = 10000; + + // + // Call function that handle data transfer + // + errorCode = sbgEComTransferSend(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_LICENSE_APPLY, pBuffer, size); + + // + // Restore the default time out + // + pHandle->cmdDefaultTimeOut = currentTimeOut; + + return errorCode; +} diff --git a/src/commands/sbgEComCmdLicense.h b/src/commands/sbgEComCmdLicense.h new file mode 100644 index 0000000..51e8a17 --- /dev/null +++ b/src/commands/sbgEComCmdLicense.h @@ -0,0 +1,65 @@ +/*! + * \file sbgEComCmdLicense.h + * \author SBG Systems + * \date 25 February 2015 + * + * \brief Command used to upload and apply an activation license. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_CMD_LICENSE_H +#define SBG_ECOM_CMD_LICENSE_H + +// sbgCommonLib headers +#include + +// Project headers +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Upload and apply a new license to a device. + * + * The device will reboot automatically to use the new license. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] pBuffer Read only buffer containing the license. + * \param[in] size Size of the buffer. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdLicenseApply(SbgEComHandle *pHandle, const void *pBuffer, size_t size); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_CMD_LICENSE_H diff --git a/src/commands/sbgEComCmdMag.c b/src/commands/sbgEComCmdMag.c new file mode 100644 index 0000000..1bf5470 --- /dev/null +++ b/src/commands/sbgEComCmdMag.c @@ -0,0 +1,422 @@ +// sbgCommonLib headers +#include +#include + +// Project headers +#include + +// Local headers +#include "sbgEComCmdCommon.h" +#include "sbgEComCmdMag.h" + +//----------------------------------------------------------------------// +//- Magnetometer commands -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComCmdMagSetModelId(SbgEComHandle *pHandle, SbgEComMagModelsStdId modelId) +{ + assert(pHandle); + + return sbgEComCmdGenericSetModelId(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_MAGNETOMETER_MODEL_ID, modelId); +} + +SbgErrorCode sbgEComCmdMagGetModelId(SbgEComHandle *pHandle, SbgEComMagModelsStdId *pModelId) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + uint32_t modelIdAsUint; + + assert(pHandle); + assert(pModelId); + + errorCode = sbgEComCmdGenericGetModelId(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_MAGNETOMETER_MODEL_ID, &modelIdAsUint); + + if (errorCode == SBG_NO_ERROR) + { + *pModelId = (SbgEComMagModelsStdId)modelIdAsUint; + } + + return errorCode; +} + +SbgErrorCode sbgEComCmdMagSetCalibData(SbgEComHandle *pHandle, const float *pOffset, const float *pMatrix) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgStreamBuffer outputStream; + uint8_t outputBuffer[12 * sizeof(float)]; + uint32_t trial; + uint32_t i; + + assert(pHandle); + assert(pOffset); + assert(pMatrix); + + // + // Initialize a stream buffer to write the command payload + // + errorCode = sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + + // + // Write the offset vector + // + sbgStreamBufferWriteFloatLE(&outputStream, pOffset[0]); + sbgStreamBufferWriteFloatLE(&outputStream, pOffset[1]); + sbgStreamBufferWriteFloatLE(&outputStream, pOffset[2]); + + // + // Write the matrix + // + for (i = 0; i < 9; i++) + { + sbgStreamBufferWriteFloatLE(&outputStream, pMatrix[i]); + } + + // + // Make sure that the stream buffer has been initialized + // + if (errorCode == SBG_NO_ERROR) + { + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the command + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_SET_MAG_CALIB, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComWaitForAck(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_SET_MAG_CALIB, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a valid ACK + // + if (errorCode == SBG_NO_ERROR) + { + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + } + + return errorCode; +} + +SbgErrorCode sbgEComCmdMagGetRejection(SbgEComHandle *pHandle, SbgEComMagRejectionConf *pRejectConf) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComProtocolPayload receivedPayload; + uint32_t trial; + + assert(pHandle); + assert(pRejectConf); + + sbgEComProtocolPayloadConstruct(&receivedPayload); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the command only since this is a no-payload command + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_MAGNETOMETER_REJECT_MODE, NULL, 0); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + SbgStreamBuffer inputStream; + + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComReceiveCmd2(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_MAGNETOMETER_REJECT_MODE, &receivedPayload, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received frame was OK + // + if (errorCode == SBG_NO_ERROR) + { + // + // Initialize stream buffer to read parameters + // + sbgStreamBufferInitForRead(&inputStream, sbgEComProtocolPayloadGetBuffer(&receivedPayload), sbgEComProtocolPayloadGetSize(&receivedPayload)); + + // + // Read parameters + // + pRejectConf->magneticField = (SbgEComRejectionMode)sbgStreamBufferReadUint8LE(&inputStream); + + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + sbgEComProtocolPayloadDestroy(&receivedPayload); + + return errorCode; +} + +SbgErrorCode sbgEComCmdMagSetRejection(SbgEComHandle *pHandle, const SbgEComMagRejectionConf *pRejectConf) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + uint32_t trial; + uint8_t outputBuffer[64]; + SbgStreamBuffer outputStream; + + assert(pHandle); + assert(pRejectConf); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Init stream buffer for output + // Build payload + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)pRejectConf->magneticField); + + // + // Send the payload over ECom + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_MAGNETOMETER_REJECT_MODE, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComWaitForAck(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_MAGNETOMETER_REJECT_MODE, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a valid ACK + // + if (errorCode == SBG_NO_ERROR) + { + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + return errorCode; +} + +//----------------------------------------------------------------------// +//- Magnetometer onboard calibration commands -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComCmdMagStartCalib(SbgEComHandle *pHandle, SbgEComMagCalibMode mode, SbgEComMagCalibBandwidth bandwidth) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgStreamBuffer outputStream; + uint8_t outputBuffer[2]; + uint32_t trial; + + assert(pHandle); + + // + // Initialize a stream buffer to write the command payload + // + errorCode = sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + + // + // Write the calibration mode and bandwith + // + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)mode); + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)bandwidth); + + // + // Make sure that the stream buffer has been initialized + // + if (errorCode == SBG_NO_ERROR) + { + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the command + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_START_MAG_CALIB, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComWaitForAck(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_START_MAG_CALIB, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a valid ACK + // + if (errorCode == SBG_NO_ERROR) + { + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + } + + return errorCode; +} + +SbgErrorCode sbgEComCmdMagComputeCalib(SbgEComHandle *pHandle, SbgEComMagCalibResults *pCalibResults) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComProtocolPayload receivedPayload; + uint32_t trial; + + assert(pHandle); + assert(pCalibResults); + + sbgEComProtocolPayloadConstruct(&receivedPayload); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the command only since this is a no-payload command + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_COMPUTE_MAG_CALIB, NULL, 0); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 5 s because the onboard magnetic computation can take some time + // + errorCode = sbgEComReceiveCmd2(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_COMPUTE_MAG_CALIB, &receivedPayload, 5000); + + // + // Test if we have received the correct command + // + if (errorCode == SBG_NO_ERROR) + { + SbgStreamBuffer inputStream; + size_t i; + + // + // Initialize stream buffer to read parameters + // + sbgStreamBufferInitForRead(&inputStream, sbgEComProtocolPayloadGetBuffer(&receivedPayload), sbgEComProtocolPayloadGetSize(&receivedPayload)); + + // + // Read quality and status parameters + // + pCalibResults->quality = (SbgEComMagCalibQuality)sbgStreamBufferReadUint8LE(&inputStream); + pCalibResults->confidence = (SbgEComMagCalibConfidence)sbgStreamBufferReadUint8LE(&inputStream); + pCalibResults->advancedStatus = sbgStreamBufferReadUint16LE(&inputStream); + + pCalibResults->beforeMeanError = sbgStreamBufferReadFloatLE(&inputStream); + pCalibResults->beforeStdError = sbgStreamBufferReadFloatLE(&inputStream); + pCalibResults->beforeMaxError = sbgStreamBufferReadFloatLE(&inputStream); + + pCalibResults->afterMeanError = sbgStreamBufferReadFloatLE(&inputStream); + pCalibResults->afterStdError = sbgStreamBufferReadFloatLE(&inputStream); + pCalibResults->afterMaxError = sbgStreamBufferReadFloatLE(&inputStream); + + pCalibResults->meanAccuracy = sbgStreamBufferReadFloatLE(&inputStream); + pCalibResults->stdAccuracy = sbgStreamBufferReadFloatLE(&inputStream); + pCalibResults->maxAccuracy = sbgStreamBufferReadFloatLE(&inputStream); + + pCalibResults->numPoints = sbgStreamBufferReadUint16LE(&inputStream); + pCalibResults->maxNumPoints = sbgStreamBufferReadUint16LE(&inputStream); + + // + // Read the computed hard iron offset vector + // + pCalibResults->offset[0] = sbgStreamBufferReadFloatLE(&inputStream); + pCalibResults->offset[1] = sbgStreamBufferReadFloatLE(&inputStream); + pCalibResults->offset[2] = sbgStreamBufferReadFloatLE(&inputStream); + + // + // Read the computed soft iron matrix + // + for (i = 0; i < 9; i++) + { + pCalibResults->matrix[i] = sbgStreamBufferReadFloatLE(&inputStream); + } + + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + sbgEComProtocolPayloadDestroy(&receivedPayload); + + return errorCode; +} diff --git a/src/commands/sbgEComCmdMag.h b/src/commands/sbgEComCmdMag.h new file mode 100644 index 0000000..b8f5b06 --- /dev/null +++ b/src/commands/sbgEComCmdMag.h @@ -0,0 +1,238 @@ +/*! + * \file sbgEComCmdMag.h + * \author SBG Systems + * \date 11 June 2014 + * + * \brief Magnetometer aiding module configuration & onboard magnetic calibration commands. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_CMD_MAG_H +#define SBG_ECOM_CMD_MAG_H + +// sbgCommonLib headers +#include + +// Project headers +#include + +// Local headers +#include "sbgEComCmdCommon.h" + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Magnetometer definitions -// +//----------------------------------------------------------------------// + +/*! + * Define if the onboard magnetic calibration should acquiere points for a 3D or 2D calibration. + */ +typedef enum _SbgEComMagCalibMode +{ + SBG_ECOM_MAG_CALIB_MODE_2D = 1, /*!< Tell the device that the magnetic calibration will be performed with limited motions. + This calibration mode is only designed to be used when roll and pitch motions are less than ± 5°. + To work correctly, the device should be rotated through at least a full circle. */ + SBG_ECOM_MAG_CALIB_MODE_3D = 2 /*!< Tell the device to start a full 3D magnetic calibration procedure. + The 3D magnetic calibration offers the best accuracy but needs at least motion of ± 30° on the roll and pitch angles. */ +} SbgEComMagCalibMode; + + +/*! + * Used to select the expected dynamics during the magnetic calibration. + */ +typedef enum _SbgEComMagCalibBandwidth +{ + SBG_ECOM_MAG_CALIB_LOW_BW = 0, /*!< Tell the device that low dynamics will be observed during the magnetic calibration process. */ + SBG_ECOM_MAG_CALIB_MEDIUM_BW = 1, /*!< Tell the device that normal dynamics will be observed during the magnetic calibration process. */ + SBG_ECOM_MAG_CALIB_HIGH_BW = 2 /*!< Tell the device that high dynamics will be observed during the magnetic calibration process. */ +} SbgEComMagCalibBandwidth; + +/*! + * General quality indicator of an onboard magnetic calibration. + */ +typedef enum _SbgEComMagCalibQuality +{ + SBG_ECOM_MAG_CALIB_QUAL_OPTIMAL = 0, /*!< All acquired points fit very well on a unit sphere after the calibration. */ + SBG_ECOM_MAG_CALIB_QUAL_GOOD = 1, /*!< Small deviations of the magnetic field norm have been detected. The magnetic calibration should although provide accurate heading. */ + SBG_ECOM_MAG_CALIB_QUAL_POOR = 2, /*!< Large deviations of the magnetic field norm have been detected. It may come from external magnetic distortions during the calibration. */ + SBG_ECOM_MAG_CALIB_QUAL_INVALID = 3 /*!< No valid magnetic calibration has been computed. It could comes from too much magnetic disturbances, insufficient or invalid motions. */ +} SbgEComMagCalibQuality; + +/*! + * Confidence indicator on results of an onbard magnetic calibration. + */ +typedef enum _SbgEComMagCalibConfidence +{ + SBG_ECOM_MAG_CALIB_TRUST_HIGH = 0, /*!< Reported quality indicator can be trusted as enough remarkable magnetic field points have been acquired. */ + SBG_ECOM_MAG_CALIB_TRUST_MEDIUM = 1, /*!< Few remarkable magnetic field points have been used to compute the magnetic calibration leading to a medium confidence in reported quality indicators. */ + SBG_ECOM_MAG_CALIB_TRUST_LOW = 2 /*!< Even if the quality indicator could report an excellent calibration, + The data set used to compute the magnetic calibration was not meaningful enough to compute meaningful quality indicators. + This calibration should be used carefully. */ +} SbgEComMagCalibConfidence; + +/*! + * Status bit masks used to report advanced inforamtion on the onboard magnetic calibration. + */ +#define SBG_ECOM_MAG_CALIB_NOT_ENOUGH_POINTS (0x0001u) /*!< Not enough valid magnetic points have been acquired. */ +#define SBG_ECOM_MAG_CALIB_TOO_MUCH_DISTORTIONS (0x0002u) /*!< Unable to compute a magnetic calibration due to magnetic interferences or incorrect data set distribution. */ +#define SBG_ECOM_MAG_CALIB_X_MOTION_ISSUE (0x0004u) /*!< For a 3D calibration: not enough motion on X axis. For a 2D calibration; too much motion on X axis. */ +#define SBG_ECOM_MAG_CALIB_Y_MOTION_ISSUE (0x0008u) /*!< For a 3D calibration: not enough motion on Y axis. For a 2D calibration; too much motion on Y axis. */ +#define SBG_ECOM_MAG_CALIB_Z_MOTION_ISSUE (0x0010u) /*!< For a 3D or 2D calibration: not enough motion on Z axis. */ +#define SBG_ECOM_MAG_CALIB_ALIGNMENT_ISSUE (0x0020u) /*!< For a 3D calibration: the alignment between the magnetometers and the inertial frame seems to be invalid. */ + +/*! + * This enum defines the different magnetometer model IDs available in standard + */ +typedef enum _SbgEComMagModelsStdIds +{ + SBG_ECOM_MAG_MODEL_NORMAL = 201, /*!< Should be used in most applications */ + SBG_ECOM_MAG_MODEL_NOISY_MAG_TOLERANT = 202, /*!< Should be used in disturbed magnetic environment */ +} SbgEComMagModelsStdId; + +//----------------------------------------------------------------------// +//- Magnetometer configuration -// +//----------------------------------------------------------------------// + +/*! + * Holds all necessary information for Magnetometer module data rejection. + */ +typedef struct _SbgEComMagRejectionConf +{ + SbgEComRejectionMode magneticField; /*!< Rejection mode for magnetic field. */ +} SbgEComMagRejectionConf; + +/*! + * Helper structure to retrieve onboard magnetic calibration results. + */ +typedef struct _SbgEComMagCalibResults +{ + SbgEComMagCalibQuality quality; /*!< General magnetic calibration quality indicator. */ + SbgEComMagCalibConfidence confidence; /*!< Confidence indicator that should be read to interpret the quality indicator. */ + uint16_t advancedStatus; /*!< Set of bit masks used to report advanced information on the magnetic calibration status.*/ + + float beforeMeanError; /*!< Mean magnetic field norm error observed before calibration. */ + float beforeStdError; /*!< Standard deviation of the magnetic field norm error observed before calibration. */ + float beforeMaxError; /*!< Maximum magnetic field norm error observed before calibration. */ + + float afterMeanError; /*!< Mean magnetic field norm error observed after calibration. */ + float afterStdError; /*!< Standard deviation of the magnetic field norm error observed after calibration. */ + float afterMaxError; /*!< Maximum magnetic field norm error observed after calibration. */ + + float meanAccuracy; /*!< Mean expected heading accuracy in radians. */ + float stdAccuracy; /*!< Standard deviation of the expected heading accuracy in radians. */ + float maxAccuracy; /*!< Maximum expected heading accuracy in radians. */ + + uint16_t numPoints; /*!< Number of magnetic field points stored internally and used to compute the magnetic calibration. */ + uint16_t maxNumPoints; /*!< Maximum number of magnetic field points that can be stored internally. */ + float offset[3]; /*!< Computed Hard Iron correction vector offset. */ + float matrix[9]; /*!< Computed Hard & Soft Iron correction matrix. */ +} SbgEComMagCalibResults; + +//----------------------------------------------------------------------// +//- Magnetometer commands -// +//----------------------------------------------------------------------// + +/*! + * Set magnetometer error model id. + * + * \param[in] pHandle A valid sbgECom handle + * \param[in] modelId Magnetometer model id to set + * \return SBG_NO_ERROR if the command has been executed successfully + */ +SbgErrorCode sbgEComCmdMagSetModelId(SbgEComHandle *pHandle, SbgEComMagModelsStdId modelId); + +/*! + * Retrieve magnetometer error model id + * + * \param[in] pHandle A valid sbgECom handle + * \param[out] pModelId Retrieved magnetometer model id + * \return SBG_NO_ERROR if the command has been executed successfully + */ +SbgErrorCode sbgEComCmdMagGetModelId(SbgEComHandle *pHandle, SbgEComMagModelsStdId *pModelId); + +/*! + * Retrieve the rejection configuration of the magnetometer module. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[out] pRejectConf Pointer to a SbgEComMagRejectionConf struct to hold rejection configuration of the magnetometer module. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdMagGetRejection(SbgEComHandle *pHandle, SbgEComMagRejectionConf *pRejectConf); + +/*! + * Set the rejection configuration of the magnetometer module. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] pRejectConf Pointer to a SbgEComMagRejectionConf struct holding rejection configuration for the magnetometer module. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdMagSetRejection(SbgEComHandle *pHandle, const SbgEComMagRejectionConf *pRejectConf); + +/*! + * Send a command that set the magnetometers calibration parameters. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] pOffset Magnetometers calibration offset vector. + * \param[in] pMatrix Magnetometers calibration 3x3 matrix. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdMagSetCalibData(SbgEComHandle *pHandle, const float *pOffset, const float *pMatrix); + +//----------------------------------------------------------------------// +//- Magnetometer onboard calibration commands -// +//----------------------------------------------------------------------// + +/*! + * Start the magnetic calibration process. + * + * As soon as this command is sent, the device will start logging magnetic field data internally. + * This set of data will be used later by the magnetic calibration algorithms to map the surrounding magnetic field. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] mode Define which magnetic calibration type to perform. It could be 3D or 2D. + * \param[in] bandwidth Tell the device that we should have low, medium or high dynamics during the magnetic calibration process. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdMagStartCalib(SbgEComHandle *pHandle, SbgEComMagCalibMode mode, SbgEComMagCalibBandwidth bandwidth); + +/*! + * This command computes a magnetic calibration solution based on the magnetic field logged since the last call to the command SBG_ECOM_CMD_START_MAG_CALIB (15). + * + * As soon as the computations are done, the device will answer with quality indicators, status flags and if possible a valid magnetic calibration matrix and offset. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[out] pCalibResults Pointer on a SbgEComMagCalibResults structure that can hold onboard magnetic calibration results and status. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdMagComputeCalib(SbgEComHandle *pHandle, SbgEComMagCalibResults *pCalibResults); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_CMD_MAG_H diff --git a/src/commands/sbgEComCmdOdo.c b/src/commands/sbgEComCmdOdo.c new file mode 100644 index 0000000..5f07558 --- /dev/null +++ b/src/commands/sbgEComCmdOdo.c @@ -0,0 +1,582 @@ +// sbgCommonLib headers +#include +#include + +// Project headers +#include + +// Local headers +#include "sbgEComCmdCommon.h" +#include "sbgEComCmdOdo.h" + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComCmdOdoGetConf(SbgEComHandle *pHandle, SbgEComOdoConf *pOdometerConf) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComProtocolPayload receivedPayload; + uint32_t trial; + + assert(pHandle); + assert(pOdometerConf); + + sbgEComProtocolPayloadConstruct(&receivedPayload); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the command only since this is a no-payload command + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_ODO_CONF, NULL, 0); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComReceiveCmd2(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_ODO_CONF, &receivedPayload, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a SBG_ECOM_CMD_ODO_CONF command + // + if (errorCode == SBG_NO_ERROR) + { + SbgStreamBuffer inputStream; + + // + // Initialize stream buffer to read parameters + // + sbgStreamBufferInitForRead(&inputStream, sbgEComProtocolPayloadGetBuffer(&receivedPayload), sbgEComProtocolPayloadGetSize(&receivedPayload)); + + // + // Read parameters + // + pOdometerConf->gain = sbgStreamBufferReadFloatLE(&inputStream); + pOdometerConf->gainError = sbgStreamBufferReadUint8LE(&inputStream); + pOdometerConf->reverseMode = sbgStreamBufferReadBooleanLE(&inputStream); + + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + sbgEComProtocolPayloadDestroy(&receivedPayload); + + return errorCode; +} + +SbgErrorCode sbgEComCmdOdoSetConf(SbgEComHandle *pHandle, const SbgEComOdoConf *pOdometerConf) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + uint32_t trial; + uint8_t outputBuffer[64]; + SbgStreamBuffer outputStream; + + assert(pHandle); + assert(pOdometerConf); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Init stream buffer for output + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + + // + // Build payload + // + sbgStreamBufferWriteFloatLE(&outputStream, pOdometerConf->gain); + sbgStreamBufferWriteUint8LE(&outputStream, pOdometerConf->gainError); + sbgStreamBufferWriteBooleanLE(&outputStream, pOdometerConf->reverseMode); + + // + // Send the payload over ECom + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_ODO_CONF, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComWaitForAck(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_ODO_CONF, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a valid ACK + // + if (errorCode == SBG_NO_ERROR) + { + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + return errorCode; +} + +SbgErrorCode sbgEComCmdOdoGetLeverArm(SbgEComHandle *pHandle, float *pLeverArm) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComProtocolPayload receivedPayload; + uint32_t trial; + + assert(pHandle); + assert(pLeverArm); + + sbgEComProtocolPayloadConstruct(&receivedPayload); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the command only since this is a no-payload command + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_ODO_LEVER_ARM, NULL, 0); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComReceiveCmd2(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_ODO_LEVER_ARM, &receivedPayload, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a correct answer + // + if (errorCode == SBG_NO_ERROR) + { + SbgStreamBuffer inputStream; + + // + // Initialize stream buffer to read parameters + // + sbgStreamBufferInitForRead(&inputStream, sbgEComProtocolPayloadGetBuffer(&receivedPayload), sbgEComProtocolPayloadGetSize(&receivedPayload)); + + // + // Read parameters + // + pLeverArm[0] = sbgStreamBufferReadFloatLE(&inputStream); + pLeverArm[1] = sbgStreamBufferReadFloatLE(&inputStream); + pLeverArm[2] = sbgStreamBufferReadFloatLE(&inputStream); + + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + sbgEComProtocolPayloadDestroy(&receivedPayload); + + return errorCode; +} + +SbgErrorCode sbgEComCmdOdoSetLeverArm(SbgEComHandle *pHandle, const float *pLeverArm) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + uint32_t trial; + uint8_t outputBuffer[64]; + SbgStreamBuffer outputStream; + + assert(pHandle); + assert(pLeverArm); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Init stream buffer for output + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + + // + // Build payload + // + sbgStreamBufferWriteFloatLE(&outputStream, pLeverArm[0]); + sbgStreamBufferWriteFloatLE(&outputStream, pLeverArm[1]); + sbgStreamBufferWriteFloatLE(&outputStream, pLeverArm[2]); + + // + // Send the payload over ECom + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_ODO_LEVER_ARM, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComWaitForAck(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_ODO_LEVER_ARM, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a valid ACK + // + if (errorCode == SBG_NO_ERROR) + { + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + return errorCode; +} + +SbgErrorCode sbgEComCmdOdoGetRejection(SbgEComHandle *pHandle, SbgEComOdoRejectionConf *pRejectConf) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComProtocolPayload receivedPayload; + uint32_t trial; + + assert(pHandle); + assert(pRejectConf); + + sbgEComProtocolPayloadConstruct(&receivedPayload); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the command only since this is a no-payload command + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_ODO_REJECT_MODE, NULL, 0); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComReceiveCmd2(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_ODO_REJECT_MODE, &receivedPayload, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a correct answer + // + if (errorCode == SBG_NO_ERROR) + { + SbgStreamBuffer inputStream; + + // + // Initialize stream buffer to read parameters + // + sbgStreamBufferInitForRead(&inputStream, sbgEComProtocolPayloadGetBuffer(&receivedPayload), sbgEComProtocolPayloadGetSize(&receivedPayload)); + + // + // Read parameters + // + pRejectConf->velocity = (SbgEComRejectionMode)sbgStreamBufferReadUint8LE(&inputStream); + + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + sbgEComProtocolPayloadDestroy(&receivedPayload); + + return errorCode; +} + +SbgErrorCode sbgEComCmdOdoSetRejection(SbgEComHandle *pHandle, const SbgEComOdoRejectionConf *pRejectConf) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + uint32_t trial; + uint8_t outputBuffer[64]; + SbgStreamBuffer outputStream; + + assert(pHandle); + assert(pRejectConf); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Init stream buffer for output + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + + // + // Build payload + // + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)pRejectConf->velocity); + + // + // Send the payload over ECom + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_ODO_REJECT_MODE, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComWaitForAck(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_ODO_REJECT_MODE, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a valid ACK + // + if (errorCode == SBG_NO_ERROR) + { + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + return errorCode; +} + +SbgErrorCode sbgEComCmdOdoCanGetConf(SbgEComHandle *pHandle, SbgEComCmdOdoCanChannel canChannel, SbgEComCmdOdoCanConf *pOdoCanConf) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComProtocolPayload receivedPayload; + uint32_t trial; + uint8_t outputBuffer[16]; + SbgStreamBuffer outputStream; + + assert(pHandle); + assert(pOdoCanConf); + assert(canChannel <= UCHAR_MAX); + + sbgEComProtocolPayloadConstruct(&receivedPayload); + + // + // Build the command payload used to ask the CAN odometer configuration for a specific channel + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + sbgStreamBufferWriteUint8LE(&outputStream, canChannel); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the command only since this is a no-payload command + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_ODO_CAN_CONF, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComReceiveCmd2(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_ODO_CAN_CONF, &receivedPayload, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a SBG_ECOM_CMD_ODO_CAN_SPEED_CONF command + // + if (errorCode == SBG_NO_ERROR) + { + SbgStreamBuffer inputStream; + + // + // Initialize stream buffer to read parameters + // + sbgStreamBufferInitForRead(&inputStream, sbgEComProtocolPayloadGetBuffer(&receivedPayload), sbgEComProtocolPayloadGetSize(&receivedPayload)); + + // + // Read fields from payload + // + canChannel = sbgStreamBufferReadUint8LE(&inputStream); + + pOdoCanConf->options = sbgStreamBufferReadUint16LE(&inputStream); + pOdoCanConf->canId = sbgStreamBufferReadUint32LE(&inputStream); + + pOdoCanConf->startBit = sbgStreamBufferReadUint8LE(&inputStream); + pOdoCanConf->dataSize = sbgStreamBufferReadUint8LE(&inputStream); + + pOdoCanConf->scale = sbgStreamBufferReadFloatLE(&inputStream); + pOdoCanConf->offset = sbgStreamBufferReadFloatLE(&inputStream); + pOdoCanConf->minValue = sbgStreamBufferReadFloatLE(&inputStream); + pOdoCanConf->maxValue = sbgStreamBufferReadFloatLE(&inputStream); + + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + sbgEComProtocolPayloadDestroy(&receivedPayload); + + return errorCode; +} + +SbgErrorCode sbgEComCmdOdoCanSetConf(SbgEComHandle *pHandle, SbgEComCmdOdoCanChannel canChannel, const SbgEComCmdOdoCanConf *pOdoCanConf) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + uint32_t trial; + uint8_t outputBuffer[64]; + SbgStreamBuffer outputStream; + + assert(pHandle); + assert(pOdoCanConf); + assert(canChannel <= UCHAR_MAX); + + // + // A CAN message has a payload of up to 64 bits so the offset can range from 0 to 63 and size from 1 to 64 + // + assert(pOdoCanConf->startBit < 64); + assert(pOdoCanConf->dataSize > 0); + assert(pOdoCanConf->dataSize <= 64); + + // + // Build the command payload + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)canChannel); + + sbgStreamBufferWriteUint16LE(&outputStream, pOdoCanConf->options); + sbgStreamBufferWriteUint32LE(&outputStream, pOdoCanConf->canId); + + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)pOdoCanConf->startBit); + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)pOdoCanConf->dataSize); + + sbgStreamBufferWriteFloatLE(&outputStream, pOdoCanConf->scale); + sbgStreamBufferWriteFloatLE(&outputStream, pOdoCanConf->offset); + sbgStreamBufferWriteFloatLE(&outputStream, pOdoCanConf->minValue); + sbgStreamBufferWriteFloatLE(&outputStream, pOdoCanConf->maxValue); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the payload over ECom + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_ODO_CAN_CONF, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComWaitForAck(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_ODO_CAN_CONF, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a valid ACK + // + if (errorCode == SBG_NO_ERROR) + { + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + return errorCode; +} diff --git a/src/commands/sbgEComCmdOdo.h b/src/commands/sbgEComCmdOdo.h new file mode 100644 index 0000000..67eb7f8 --- /dev/null +++ b/src/commands/sbgEComCmdOdo.h @@ -0,0 +1,188 @@ +/*! + * \file sbgEComCmdOdo.h + * \author SBG Systems + * \date 11 June 2014 + * + * \brief Odometer / DMI aiding module configuration commands. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_CMD_ODO_H +#define SBG_ECOM_CMD_ODO_H + +// sbgCommonLib headers +#include + +// Project headers +#include + +// Local headers +#include "sbgEComCmdCommon.h" + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Public definitions -// +//----------------------------------------------------------------------// + +/*! + * Holds all necessary information for Odometer module parameter configuration. + */ +typedef struct _SbgEComOdoConf +{ + float gain; /*!< Odometer's gain in pulses / meter. */ + uint8_t gainError; /*!< User gain average error in % */ + bool reverseMode; /*!< Whether the odometer is in reverse mode or not. */ +} SbgEComOdoConf; + +/*! + * Holds all necessary information for Odometer module data rejection. + */ +typedef struct _SbgEComOdoRejectionConf +{ + SbgEComRejectionMode velocity; /*!< Rejection mode for velocity. */ +} SbgEComOdoRejectionConf; + +/*! + * CAN odometer channels definition + * A channel is an inforamtion that can be decoded / used by the device. + */ +typedef enum _SbgEComCmdOdoCanChannel +{ + SBG_ECOM_CMD_ODO_CAN_CH_VELOCITY = 0, /*!< Channel used to decode the vehicle velocity information */ + SBG_ECOM_CMD_ODO_CAN_CH_REVERSE = 1 /*!< Channel used to decode the vehicle velocity reverse info (if available). */ +} SbgEComCmdOdoCanChannel; + +/* + * Define CAN odometer options bitmask + */ +#define SBG_ECOM_CMD_ODO_CAN_ENABLE (uint16_t)(0x0001 << 0) /*!< Set to enable CAN odometer information decoding. */ +#define SBG_ECOM_CMD_ODO_CAN_ID_EXTENDED (uint16_t)(0x0001 << 1) /*!< Set for a 29 bit extended CAN message, otherwise standard 11 bit */ +#define SBG_ECOM_CMD_ODO_CAN_BIG_ENDIAN (uint16_t)(0x0001 << 2) /*!< Set if the velocity is encoded in big endian, otherwise little endian */ +#define SBG_ECOM_CMD_ODO_CAN_SIGNED (uint16_t)(0x0001 << 3) /*!< Set to interpret the parsed value as signed, otherwise unsigned. */ + +/*! + * Holds all necessary information for CAN Odometer parameter configuration. + * This format is very similar to info contained in a DBC file. + */ +typedef struct _SbgEComCmdOdoCanConf +{ + uint16_t options; /*!< Set of options bit masks such as CAN extended. */ + uint32_t canId; /*!< CAN message ID from which the odometer velocity will be parsed. */ + + size_t startBit; /*!< Index of field MSB in big endian or LSB in little endian within the payload (any value from 0 to 63). */ + size_t dataSize; /*!< Length in bits of the odometer velocity field (any value from 1 to 64 minus dataOffset). */ + + float scale; /*!< Value to multiply the parsed field with to get physical unit^in m.s-1. */ + float offset; /*!< Offset to add on the scaled velocity information in m.s-1 (after applying scale factor). */ + float minValue; /*!< The minimum velocity to consider the message valid in m.s-1 */ + float maxValue; /*!< The maximum velocity to consider the message valid in m.s-1 */ +} SbgEComCmdOdoCanConf; + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * For quadrature and/or pulse based odometer, retrieve the configuration. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[out] pOdometerConf Pointer to a SbgEComOdoConf struct to hold configuration of the odometer module. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdOdoGetConf(SbgEComHandle *pHandle, SbgEComOdoConf *pOdometerConf); + +/*! + * For quadrature and/or pulse base odometer, define the configuration. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] pOdometerConf Pointer to a SbgEComOdoConf struct holding configuration for the odometer module. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdOdoSetConf(SbgEComHandle *pHandle, const SbgEComOdoConf *pOdometerConf); + +/*! + * Retrieve the lever arm applicable for both quadrature or CAN based odometer. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[out] pLeverArm Array of three values, one for each axis. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdOdoGetLeverArm(SbgEComHandle *pHandle, float *pLeverArm); + +/*! + * Set the lever arm applicable for both quadrature or CAN based odometer. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] pLeverArm Array of three values, one for each axis. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdOdoSetLeverArm(SbgEComHandle *pHandle, const float *pLeverArm); + +/*! + * Retrieve the velocity rejection configuration for both quadrature or CAN based odometer. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[out] pRejectConf Pointer to a SbgEComOdoRejectionConf struct to hold rejection configuration of the odometer module. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdOdoGetRejection(SbgEComHandle *pHandle, SbgEComOdoRejectionConf *pRejectConf); + +/*! + * Set the velocity rejection configuration for both quadrature or CAN based odometer. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] pRejectConf Pointer to a SbgEComOdoRejectionConf struct holding rejection configuration for the odometer module. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdOdoSetRejection(SbgEComHandle *pHandle, const SbgEComOdoRejectionConf *pRejectConf); + +/*! + * Retrieve the CAN odometer configuration for a specific CAN information channel + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] canChannel The CAN channel to retreive associated DBC configuration. + * \param[out] pOdoCanConf Struct to hold configuration of the CAN odometer. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdOdoCanGetConf(SbgEComHandle *pHandle, SbgEComCmdOdoCanChannel canChannel, SbgEComCmdOdoCanConf *pOdoCanConf); + +/*! + * Set the CAN odometer configuration for a specific CAN information channel + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] canChannel The CAN channel to define associated DBC configuration. + * \param[in] pOdoCanConf Struct holding configuration for the CAN odometer. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdOdoCanSetConf(SbgEComHandle *pHandle, SbgEComCmdOdoCanChannel canChannel, const SbgEComCmdOdoCanConf *pOdoCanConf); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_CMD_ODO_H diff --git a/src/commands/sbgEComCmdOutput.c b/src/commands/sbgEComCmdOutput.c new file mode 100644 index 0000000..ba95b85 --- /dev/null +++ b/src/commands/sbgEComCmdOutput.c @@ -0,0 +1,583 @@ +// sbgCommonLib headers +#include +#include + +// Project headers +#include + +// Local headers +#include "sbgEComCmdCommon.h" +#include "sbgEComCmdOutput.h" + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComCmdOutputGetConf(SbgEComHandle *pHandle, SbgEComOutputPort outputPort, SbgEComClass classId, SbgEComMsgId msgId, SbgEComOutputMode *pConf) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComProtocolPayload receivedPayload; + uint32_t trial; + uint8_t outputBuffer[5]; + SbgStreamBuffer outputStream; + + assert(pHandle); + assert(pConf); + + sbgEComProtocolPayloadConstruct(&receivedPayload); + + // + // Build payload to send + // + sbgStreamBufferInitForWrite(&outputStream, &outputBuffer, sizeof(outputBuffer)); + + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)outputPort); + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)msgId); + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)classId); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the command and the prepared payload + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_OUTPUT_CONF, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComReceiveCmd2(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_OUTPUT_CONF, &receivedPayload, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a SBG_ECOM_CMD_OUTPUT_CONF command + // + if (errorCode == SBG_NO_ERROR) + { + SbgStreamBuffer inputStream; + + // + // Initialize stream buffer to read parameters + // + sbgStreamBufferInitForRead(&inputStream, sbgEComProtocolPayloadGetBuffer(&receivedPayload), sbgEComProtocolPayloadGetSize(&receivedPayload)); + + // + // Parse the received payload + // + outputPort = (SbgEComOutputPort)sbgStreamBufferReadUint8LE(&inputStream); + msgId = sbgStreamBufferReadUint8LE(&inputStream); + classId = (SbgEComClass)sbgStreamBufferReadUint8LE(&inputStream); + *pConf = (SbgEComOutputMode)sbgStreamBufferReadUint16LE(&inputStream); + + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + sbgEComProtocolPayloadDestroy(&receivedPayload); + + return errorCode; +} + +SbgErrorCode sbgEComCmdOutputSetConf(SbgEComHandle *pHandle, SbgEComOutputPort outputPort, SbgEComClass classId, SbgEComMsgId msgId, SbgEComOutputMode conf) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + uint32_t trial; + uint8_t outputBuffer[5]; + SbgStreamBuffer outputStream; + + assert(pHandle); + + // + // Build the payload to send + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)outputPort); + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)msgId); + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)classId); + sbgStreamBufferWriteUint16LE(&outputStream, (uint16_t)conf); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the payload over ECom + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_OUTPUT_CONF, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComWaitForAck(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_OUTPUT_CONF, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a valid ACK + // + if (errorCode == SBG_NO_ERROR) + { + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + return errorCode; +} + +SbgErrorCode sbgEComCmdOutputClassGetEnable(SbgEComHandle *pHandle, SbgEComOutputPort outputPort, SbgEComClass classId, bool *pEnable) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComProtocolPayload receivedPayload; + uint32_t trial; + uint8_t outputBuffer[3]; + SbgStreamBuffer outputStream; + + assert(pHandle); + assert(pEnable); + + sbgEComProtocolPayloadConstruct(&receivedPayload); + + // + // Build payload to send + // + sbgStreamBufferInitForWrite(&outputStream, &outputBuffer, sizeof(outputBuffer)); + + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)outputPort); + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)classId); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the command and the prepared payload + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_OUTPUT_CLASS_ENABLE, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComReceiveCmd2(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_OUTPUT_CLASS_ENABLE, &receivedPayload, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a correct answer + // + if (errorCode == SBG_NO_ERROR) + { + SbgStreamBuffer inputStream; + + // + // Initialize stream buffer to read parameters + // + sbgStreamBufferInitForRead(&inputStream, sbgEComProtocolPayloadGetBuffer(&receivedPayload), sbgEComProtocolPayloadGetSize(&receivedPayload)); + + // + // Parse the received payload + // + outputPort = (SbgEComOutputPort)sbgStreamBufferReadUint8LE(&inputStream); + classId = (SbgEComClass)sbgStreamBufferReadUint8LE(&inputStream); + *pEnable = (bool)sbgStreamBufferReadUint8LE(&inputStream); + + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + sbgEComProtocolPayloadDestroy(&receivedPayload); + + return errorCode; +} + +SbgErrorCode sbgEComCmdOutputClassSetEnable(SbgEComHandle *pHandle, SbgEComOutputPort outputPort, SbgEComClass classId, bool enable) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + uint32_t trial; + uint8_t outputBuffer[3]; + SbgStreamBuffer outputStream; + + assert(pHandle); + + // + // Build payload to send + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)outputPort); + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)classId); + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)enable); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the payload over ECom + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_OUTPUT_CLASS_ENABLE, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComWaitForAck(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_OUTPUT_CLASS_ENABLE, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a valid ACK + // + if (errorCode == SBG_NO_ERROR) + { + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + return errorCode; +} + +SbgErrorCode sbgEComCmdCanOutputGetConf(SbgEComHandle *pHandle, SbgECanMessageId internalId, SbgEComOutputMode *pMode, uint32_t *pUserId, bool *pExtended) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComProtocolPayload receivedPayload; + uint32_t trial; + uint8_t outputBuffer[2]; + SbgStreamBuffer outputStream; + + + assert(pHandle); + assert(pMode); + assert(pUserId); + assert(pExtended); + + sbgEComProtocolPayloadConstruct(&receivedPayload); + + // + // Build the payload to send + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + sbgStreamBufferWriteUint16LE(&outputStream, internalId); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the payload over ECom + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_CAN_OUTPUT_CONF, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComReceiveCmd2(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_CAN_OUTPUT_CONF, &receivedPayload, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a correct answer + // + if (errorCode == SBG_NO_ERROR) + { + SbgStreamBuffer inputStream; + + // + // Initialize stream buffer to read parameters + // + sbgStreamBufferInitForRead(&inputStream, sbgEComProtocolPayloadGetBuffer(&receivedPayload), sbgEComProtocolPayloadGetSize(&receivedPayload)); + + // + // Parse the payload + // + internalId = (SbgECanMessageId)sbgStreamBufferReadUint16LE(&inputStream); + *pMode = (SbgEComOutputMode)sbgStreamBufferReadUint16LE(&inputStream); + *pUserId = sbgStreamBufferReadUint32LE(&inputStream); + *pExtended = (bool)sbgStreamBufferReadUint8LE(&inputStream); + + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + sbgEComProtocolPayloadDestroy(&receivedPayload); + + return errorCode; +} + +SbgErrorCode sbgEComCmdCanOutputSetConf(SbgEComHandle *pHandle, SbgECanMessageId internalId, SbgEComOutputMode mode, uint32_t userId, bool extended) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + uint32_t trial; + uint8_t outputBuffer[9]; + SbgStreamBuffer outputStream; + + assert(pHandle); + + // + // Build the payload to send + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + + sbgStreamBufferWriteUint16LE(&outputStream, (uint16_t)internalId); + sbgStreamBufferWriteUint16LE(&outputStream, (uint16_t)mode); + sbgStreamBufferWriteUint32LE(&outputStream, userId); + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)extended); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the payload over ECom + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_CAN_OUTPUT_CONF, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComWaitForAck(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_CAN_OUTPUT_CONF, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a valid ACK + // + if (errorCode == SBG_NO_ERROR) + { + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + return errorCode; +} + +SbgErrorCode sbgEComCmdOutputGetNmeaTalkerId(SbgEComHandle *pHandle, SbgEComOutputPort outputPort, char *pNmeaTalkerId) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComProtocolPayload receivedPayload; + uint32_t trial; + uint8_t outputBuffer[1]; + SbgStreamBuffer outputStream; + + assert(pHandle); + assert(pNmeaTalkerId); + + sbgEComProtocolPayloadConstruct(&receivedPayload); + + // + // Build the payload to send + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + sbgStreamBufferWriteUint8(&outputStream, outputPort); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the command with the output port as a 1-byte payload + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_NMEA_TALKER_ID, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComReceiveCmd2(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_NMEA_TALKER_ID, &receivedPayload, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a SBG_ECOM_CMD_NMEA_TALKER_ID command + // + if (errorCode == SBG_NO_ERROR) + { + SbgStreamBuffer inputStream; + + // + // Initialize stream buffer to read parameters + // + sbgStreamBufferInitForRead(&inputStream, sbgEComProtocolPayloadGetBuffer(&receivedPayload), sbgEComProtocolPayloadGetSize(&receivedPayload)); + + // + // Read parameters + // + outputPort = (SbgEComOutputPort)sbgStreamBufferReadUint8LE(&inputStream); + pNmeaTalkerId[0] = (char)sbgStreamBufferReadUint8LE(&inputStream); + pNmeaTalkerId[1] = (char)sbgStreamBufferReadUint8LE(&inputStream); + + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + sbgEComProtocolPayloadDestroy(&receivedPayload); + + return errorCode; +} + +SbgErrorCode sbgEComCmdOutputSetNmeaTalkerId(SbgEComHandle *pHandle, SbgEComOutputPort outputPort, const char *pNmeaTalkerId) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + uint32_t trial; + uint8_t outputBuffer[3]; + SbgStreamBuffer outputStream; + + assert(pHandle); + assert(pNmeaTalkerId); + + // + // Build the payload to send + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)outputPort); + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)(pNmeaTalkerId[0])); + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)(pNmeaTalkerId[1])); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the payload over ECom + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_NMEA_TALKER_ID, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComWaitForAck(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_NMEA_TALKER_ID, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a valid ACK + // + if (errorCode == SBG_NO_ERROR) + { + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + return errorCode; +} diff --git a/src/commands/sbgEComCmdOutput.h b/src/commands/sbgEComCmdOutput.h new file mode 100644 index 0000000..66f8e73 --- /dev/null +++ b/src/commands/sbgEComCmdOutput.h @@ -0,0 +1,196 @@ +/*! + * \file sbgEComCmdOutput.h + * \author SBG Systems + * \date 11 June 2014 + * + * \brief Commands used to setup logs to output over the device interfaces. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_CMD_OUTPUT_H +#define SBG_ECOM_CMD_OUTPUT_H + +// sbgCommonLib headers +#include + +// Project headers +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Public definitions -// +//----------------------------------------------------------------------// + +/*! + * List of ouput ports available. + */ +typedef enum _SbgEComOutputPort +{ + SBG_ECOM_OUTPUT_PORT_A = 0, /*!< Main output port. */ + SBG_ECOM_OUTPUT_PORT_C = 2, /*!< Secondary output port only available on Ellipse-E devices */ + SBG_ECOM_OUTPUT_PORT_E = 4 /*!< Secondary output port only available on B1 devices */ +} SbgEComOutputPort; + +/*! + * List of output modes available. + */ +typedef enum _SbgEComOutputMode +{ + SBG_ECOM_OUTPUT_MODE_DISABLED = 0, /*!< This output is disabled. */ + SBG_ECOM_OUTPUT_MODE_MAIN_LOOP = 1, /*!< Output the message every main loop (ie 200 Hz). */ + SBG_ECOM_OUTPUT_MODE_DIV_2 = 2, /*!< Output the message every 2 main loops (ie 100 Hz). */ + SBG_ECOM_OUTPUT_MODE_DIV_4 = 4, /*!< Output the message every 4 main loops (ie 50 Hz). */ + SBG_ECOM_OUTPUT_MODE_DIV_5 = 5, /*!< Output the message every 4 main loops (ie 40 Hz). */ + SBG_ECOM_OUTPUT_MODE_DIV_8 = 8, /*!< Output the message every 8 main loops (ie 25 Hz). */ + SBG_ECOM_OUTPUT_MODE_DIV_10 = 10, /*!< Output the message every 10 main loops (ie 20 Hz). */ + SBG_ECOM_OUTPUT_MODE_DIV_20 = 20, /*!< Output the message every 20 main loops (ie 10 Hz). */ + SBG_ECOM_OUTPUT_MODE_DIV_40 = 40, /*!< Output the message every 40 main loops (ie 5 Hz). */ + SBG_ECOM_OUTPUT_MODE_DIV_200 = 200, /*!< Output the message every 200 main loops (ie 1 Hz). */ + SBG_ECOM_OUTPUT_MODE_PPS = 10000, /*!< Output the message on a Pulse Per Second event. */ + SBG_ECOM_OUTPUT_MODE_NEW_DATA = 10001, /*!< Output sent when a new data is available. */ + SBG_ECOM_OUTPUT_MODE_EVENT_IN_A = 10003, /*!< Output the message when a Sync A is received. */ + SBG_ECOM_OUTPUT_MODE_EVENT_IN_B = 10004, /*!< Output the message when a Sync B is received. */ + SBG_ECOM_OUTPUT_MODE_EVENT_IN_C = 10005, /*!< Output the message when a Sync C is received. */ + SBG_ECOM_OUTPUT_MODE_EVENT_IN_D = 10006, /*!< Output the message when a Sync D is received. */ + SBG_ECOM_OUTPUT_MODE_EVENT_IN_E = 10007, /*!< Output the message when a Sync E is received. */ + SBG_ECOM_OUTPUT_MODE_HIGH_FREQ_LOOP = 20001 /*!< Output the message in the 1KHz IMU loop */ +} SbgEComOutputMode; + +/*! + * Defines which monitoring point to use for an output port. + * This feature enabled deporting measurements at a specific monitoring point. + */ +typedef enum _SbgEComOutputMonitoringPoint +{ + SBG_ECOM_OUTPUT_MONITORING_POINT_IMU = 0, /*!< Output measurements at the IMU location. */ + SBG_ECOM_OUTPUT_MONITORING_POINT_COG = 1, /*!< Output measurements at the center of rotation. */ + SBG_ECOM_OUTPUT_MONITORING_POINT_1 = 2, /*!< Output measurements at the user deported location 1 (only for Ekinox and Apogee). */ + SBG_ECOM_OUTPUT_MONITORING_POINT_2 = 3, /*!< Output measurements at the user deported location 2 (only for Ekinox and Apogee). */ + SBG_ECOM_OUTPUT_MONITORING_POINT_3 = 4, /*!< Output measurements at the user deported location 3 (only for Ekinox and Apogee). */ + SBG_ECOM_OUTPUT_MONITORING_NUM /*!< Number of output monitoring points. */ +} SbgEComOutputMonitoringPoint; + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Retrieve the configuration of one the message on one of the output interfaces. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] outputPort The output port of the device for the log concerned. + * \param[in] classId The class of the concerned log. + * \param[in] msgId The id of the concerned log. + * \param[out] pMode Pointer to a SbgEComOutputMode to contain the current output mode of the message. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdOutputGetConf(SbgEComHandle *pHandle, SbgEComOutputPort outputPort, SbgEComClass classId, SbgEComMsgId msgId, SbgEComOutputMode *pMode); + +/*! + * Set the configuration of one the message on one of the output interfaces. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] outputPort The output port of the device for the log concerned. + * \param[in] classId The class of the concerned log. + * \param[in] msgId The id of the concerned log. + * \param[in] mode New output mode to set. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdOutputSetConf(SbgEComHandle *pHandle, SbgEComOutputPort outputPort, SbgEComClass classId, SbgEComMsgId msgId, SbgEComOutputMode mode); + +/*! + * Retrieve the enable of one of the output class message on one of the output interfaces. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] outputPort The output port. + * \param[in] classId The class to enable or disable. + * \param[out] pEnable TRUE to enable message output of this class, FALSE to disable it. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdOutputClassGetEnable(SbgEComHandle *pHandle, SbgEComOutputPort outputPort, SbgEComClass classId, bool *pEnable); + +/*! + * Set the enable of one of the output class message on one of the output interfaces. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] outputPort The output port. + * \param[in] classId The class to enable or disable. + * \param[in] enable TRUE to enable message output of this class, FALSE to disable it. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdOutputClassSetEnable(SbgEComHandle *pHandle, SbgEComOutputPort outputPort, SbgEComClass classId, bool enable); + +/*! + * Retrieve the configuration of one the message on the CAN interface. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] internalId The internal message id. + * \param[out] pMode Pointer to a SbgEComOutputMode to contain the current output mode of the message. + * \param[out] pUserId The user defined message id. + * \param[out] pExtended TRUE if the user id uses the extended format. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdCanOutputGetConf(SbgEComHandle *pHandle, SbgECanMessageId internalId, SbgEComOutputMode *pMode, uint32_t *pUserId, bool *pExtended); + +/*! + * Set the configuration of one the message on the CAN interface + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] internalId The internal message id. + * \param[in] mode Pointer to a SbgEComOutputMode containing the new output mode of the message. + * \param[in] userId The user defined message id. + * \param[in] extended TRUE if the user id uses the extended format. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdCanOutputSetConf(SbgEComHandle *pHandle, SbgECanMessageId internalId, SbgEComOutputMode mode, uint32_t userId, bool extended); + +/*! + * Retrieve the NMEA talker id of one of the output interfaces. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] outputPort The output port of the device for the log concerned. + * \param[out] pNmeaTalkerId A 2-char array to contain the nmea talker id. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdOutputGetNmeaTalkerId(SbgEComHandle *pHandle, SbgEComOutputPort outputPort, char *pNmeaTalkerId); + +/*! + * Set the NMEA talker id of one of the output interfaces. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] outputPort The output port of the device for the log concerned. + * \param[out] pNmeaTalkerId A 2-char array containint the new nmea talker id. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdOutputSetNmeaTalkerId(SbgEComHandle *pHandle, SbgEComOutputPort outputPort, const char *pNmeaTalkerId); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_CMD_OUTPUT_H diff --git a/src/commands/sbgEComCmdSensor.c b/src/commands/sbgEComCmdSensor.c new file mode 100644 index 0000000..d6fbcf8 --- /dev/null +++ b/src/commands/sbgEComCmdSensor.c @@ -0,0 +1,484 @@ +// sbgCommonLib headers +#include +#include + +// Project headers +#include + +// Local headers +#include "sbgEComCmdCommon.h" +#include "sbgEComCmdSensor.h" + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComCmdSensorSetMotionProfileId(SbgEComHandle *pHandle, SbgEComMotionProfileStdIds modelId) +{ + assert(pHandle); + + return sbgEComCmdGenericSetModelId(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_MOTION_PROFILE_ID, modelId); +} + + +SbgErrorCode sbgEComCmdSensorGetMotionProfileId(SbgEComHandle *pHandle, SbgEComMotionProfileStdIds *pModelId) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + uint32_t modelIdAsUint; + + assert(pHandle); + assert(pModelId); + + errorCode = sbgEComCmdGenericGetModelId(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_MOTION_PROFILE_ID, &modelIdAsUint); + + if (errorCode == SBG_NO_ERROR) + { + *pModelId = (SbgEComMotionProfileStdIds)modelIdAsUint; + } + + return errorCode; +} + +SbgErrorCode sbgEComCmdSensorGetInitCondition(SbgEComHandle *pHandle, SbgEComInitConditionConf *pConf) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComProtocolPayload receivedPayload; + uint32_t trial; + + assert(pHandle); + assert(pConf); + + sbgEComProtocolPayloadConstruct(&receivedPayload); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the command only since this is a no payload command + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_INIT_PARAMETERS, NULL, 0); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComReceiveCmd2(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_INIT_PARAMETERS, &receivedPayload, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a SBG_ECOM_CMD_INIT_PARAMETERS command + // + if (errorCode == SBG_NO_ERROR) + { + SbgStreamBuffer inputStream; + + // + // Initialize stream buffer to read parameters + // + sbgStreamBufferInitForRead(&inputStream, sbgEComProtocolPayloadGetBuffer(&receivedPayload), sbgEComProtocolPayloadGetSize(&receivedPayload)); + + // + // Read parameters + // + pConf->latitude = sbgStreamBufferReadDoubleLE(&inputStream); + pConf->longitude = sbgStreamBufferReadDoubleLE(&inputStream); + pConf->altitude = sbgStreamBufferReadDoubleLE(&inputStream); + pConf->year = sbgStreamBufferReadUint16LE(&inputStream); + pConf->month = sbgStreamBufferReadUint8LE(&inputStream); + pConf->day = sbgStreamBufferReadUint8LE(&inputStream); + + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + sbgEComProtocolPayloadDestroy(&receivedPayload); + + return errorCode; +} + +SbgErrorCode sbgEComCmdSensorSetInitCondition(SbgEComHandle *pHandle, const SbgEComInitConditionConf *pConf) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + uint32_t trial; + uint8_t outputBuffer[64]; + SbgStreamBuffer outputStream; + + assert(pHandle); + assert(pConf); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Init stream buffer for output + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + + // + // Build payload + // + sbgStreamBufferWriteDoubleLE(&outputStream, pConf->latitude); + sbgStreamBufferWriteDoubleLE(&outputStream, pConf->longitude); + sbgStreamBufferWriteDoubleLE(&outputStream, pConf->altitude); + sbgStreamBufferWriteUint16LE(&outputStream, (uint16_t)pConf->year); + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)pConf->month); + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)pConf->day); + + // + // Send the payload over ECom + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_INIT_PARAMETERS, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComWaitForAck(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_INIT_PARAMETERS, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a valid ACK + // + if (errorCode == SBG_NO_ERROR) + { + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + return errorCode; +} + +SbgErrorCode sbgEComCmdSensorGetAidingAssignment(SbgEComHandle *pHandle, SbgEComAidingAssignConf *pConf) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComProtocolPayload receivedPayload; + uint32_t trial; + + assert(pHandle); + assert(pConf); + + sbgEComProtocolPayloadConstruct(&receivedPayload); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the command only since this is a no payload command + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_AIDING_ASSIGNMENT, NULL, 0); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComReceiveCmd2(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_AIDING_ASSIGNMENT, &receivedPayload, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a SBG_ECOM_CMD_AIDING_ASSIGNMENT command + // + if (errorCode == SBG_NO_ERROR) + { + SbgStreamBuffer inputStream; + + // + // Initialize stream buffer to read parameters + // + sbgStreamBufferInitForRead(&inputStream, sbgEComProtocolPayloadGetBuffer(&receivedPayload), sbgEComProtocolPayloadGetSize(&receivedPayload)); + + // + // Read parameters + // + pConf->gps1Port = (SbgEComModulePortAssignment)sbgStreamBufferReadUint8LE(&inputStream); + pConf->gps1Sync = (SbgEComModuleSyncAssignment)sbgStreamBufferReadUint8LE(&inputStream); + + sbgStreamBufferSeek(&inputStream, 4*sizeof(uint8_t), SB_SEEK_CUR_INC); /*!< Reserved fields to ignore */ + + pConf->dvlPort = (SbgEComModulePortAssignment)sbgStreamBufferReadUint8LE(&inputStream); + pConf->dvlSync = (SbgEComModuleSyncAssignment)sbgStreamBufferReadUint8LE(&inputStream); + + pConf->rtcmPort = (SbgEComModulePortAssignment)sbgStreamBufferReadUint8LE(&inputStream); + pConf->airDataPort = (SbgEComModulePortAssignment)sbgStreamBufferReadUint8LE(&inputStream); + pConf->odometerPinsConf = (SbgEComOdometerPinAssignment)sbgStreamBufferReadUint8LE(&inputStream); + + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + sbgEComProtocolPayloadDestroy(&receivedPayload); + + return errorCode; +} + +SbgErrorCode sbgEComCmdSensorSetAidingAssignment(SbgEComHandle *pHandle, const SbgEComAidingAssignConf *pConf) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + uint32_t trial; + uint8_t outputBuffer[16]; + SbgStreamBuffer outputStream; + + assert(pHandle); + assert(pConf); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Init stream buffer for output + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + + // + // Build payload + // + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)pConf->gps1Port); + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)pConf->gps1Sync); + + // + // Skip the 4 reserved bytes + // + sbgStreamBufferWriteUint8LE(&outputStream, 0); + sbgStreamBufferWriteUint8LE(&outputStream, 0); + sbgStreamBufferWriteUint8LE(&outputStream, 0); + sbgStreamBufferWriteUint8LE(&outputStream, 0); + + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)pConf->dvlPort); + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)pConf->dvlSync); + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)pConf->rtcmPort); + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)pConf->airDataPort); + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)pConf->odometerPinsConf); + + // + // Send the payload over ECom + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_AIDING_ASSIGNMENT, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComWaitForAck(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_AIDING_ASSIGNMENT, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a valid ACK + // + if (errorCode == SBG_NO_ERROR) + { + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + return errorCode; +} + +SbgErrorCode sbgEComCmdSensorGetAlignmentAndLeverArm(SbgEComHandle *pHandle, SbgEComSensorAlignmentInfo *pAlignConf, float *pLeverArm) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComProtocolPayload receivedPayload; + uint32_t trial; + + assert(pHandle); + assert(pAlignConf); + assert(pLeverArm); + + sbgEComProtocolPayloadConstruct(&receivedPayload); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the command only since this is a no-payload command + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_IMU_ALIGNMENT_LEVER_ARM, NULL, 0); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComReceiveCmd2(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_IMU_ALIGNMENT_LEVER_ARM, &receivedPayload, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a SBG_ECOM_CMD_IMU_ALIGNMENT command + // + if (errorCode == SBG_NO_ERROR) + { + SbgStreamBuffer inputStream; + + // + // Initialize stream buffer to read parameters + // + sbgStreamBufferInitForRead(&inputStream, sbgEComProtocolPayloadGetBuffer(&receivedPayload), sbgEComProtocolPayloadGetSize(&receivedPayload)); + + // + // Read parameters + // + pAlignConf->axisDirectionX = (SbgEComAxisDirection)sbgStreamBufferReadUint8LE(&inputStream); + pAlignConf->axisDirectionY = (SbgEComAxisDirection)sbgStreamBufferReadUint8LE(&inputStream); + pAlignConf->misRoll = sbgStreamBufferReadFloatLE(&inputStream); + pAlignConf->misPitch = sbgStreamBufferReadFloatLE(&inputStream); + pAlignConf->misYaw = sbgStreamBufferReadFloatLE(&inputStream); + pLeverArm[0] = sbgStreamBufferReadFloatLE(&inputStream); + pLeverArm[1] = sbgStreamBufferReadFloatLE(&inputStream); + pLeverArm[2] = sbgStreamBufferReadFloatLE(&inputStream); + + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + sbgEComProtocolPayloadDestroy(&receivedPayload); + + return errorCode; +} + +SbgErrorCode sbgEComCmdSensorSetAlignmentAndLeverArm(SbgEComHandle *pHandle, const SbgEComSensorAlignmentInfo *pAlignConf, const float *pLeverArm) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + uint32_t trial; + uint8_t outputBuffer[32]; + SbgStreamBuffer outputStream; + + assert(pHandle); + assert(pAlignConf); + assert(pLeverArm); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Init stream buffer for output + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + + // + // Build payload + // + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)pAlignConf->axisDirectionX); + sbgStreamBufferWriteUint8LE(&outputStream, (uint8_t)pAlignConf->axisDirectionY); + sbgStreamBufferWriteFloatLE(&outputStream, pAlignConf->misRoll); + sbgStreamBufferWriteFloatLE(&outputStream, pAlignConf->misPitch); + sbgStreamBufferWriteFloatLE(&outputStream, pAlignConf->misYaw); + sbgStreamBufferWriteFloatLE(&outputStream, pLeverArm[0]); + sbgStreamBufferWriteFloatLE(&outputStream, pLeverArm[1]); + sbgStreamBufferWriteFloatLE(&outputStream, pLeverArm[2]); + + // + // Send the payload over ECom + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_IMU_ALIGNMENT_LEVER_ARM, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComWaitForAck(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_IMU_ALIGNMENT_LEVER_ARM, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a valid ACK + // + if (errorCode == SBG_NO_ERROR) + { + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + return errorCode; +} diff --git a/src/commands/sbgEComCmdSensor.h b/src/commands/sbgEComCmdSensor.h new file mode 100644 index 0000000..893b6ae --- /dev/null +++ b/src/commands/sbgEComCmdSensor.h @@ -0,0 +1,231 @@ +/*! + * \file sbgEComCmdSensor.h + * \author SBG Systems + * \date 11 June 2014 + * + * \brief Motion profile, aiding assignement & sensor installation commands. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_CMD_SENSOR_H +#define SBG_ECOM_CMD_SENSOR_H + +// sbgCommonLib headers +#include + +// Project headers +#include + +// Local headers +#include "sbgEComCmdCommon.h" + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Sensor definitions -// +//----------------------------------------------------------------------// + +/*! + * Ports available for the modules. + */ +typedef enum _SbgEComModulePortAssignment +{ + SBG_ECOM_MODULE_PORT_A = 0, /*!< Module connected on PORT_A. */ + SBG_ECOM_MODULE_PORT_B = 1, /*!< Module connected on PORT_B. */ + SBG_ECOM_MODULE_PORT_C = 2, /*!< Module connected on PORT_C. */ + SBG_ECOM_MODULE_PORT_D = 3, /*!< Module connected on PORT_D. */ + SBG_ECOM_MODULE_PORT_E = 4, /*!< Module connected on PORT_E. */ + SBG_ECOM_MODULE_INTERNAL = 5, /*!< Module is connected internally. */ + SBG_ECOM_MODULE_DISABLED = 0xFF /*!< Module is disabled. */ +} SbgEComModulePortAssignment; + +/*! + * Synchronization signals available for the modules. + */ +typedef enum _SbgEComModuleSyncAssignment +{ + SBG_ECOM_MODULE_SYNC_DISABLED = 0, /*!< Module is disabled. */ + SBG_ECOM_MODULE_SYNC_IN_A = 1, /*!< Synchronization is done using SYNC_IN_A pin. */ + SBG_ECOM_MODULE_SYNC_IN_B = 2, /*!< Synchronization is done using SYNC_IN_B pin. */ + SBG_ECOM_MODULE_SYNC_IN_C = 3, /*!< Synchronization is done using SYNC_IN_C pin. */ + SBG_ECOM_MODULE_SYNC_IN_D = 4, /*!< Synchronization is done using SYNC_IN_D pin. */ + SBG_ECOM_MODULE_SYNC_INTERNAL = 5, /*!< Synchronization is internal. */ + SBG_ECOM_MODULE_SYNC_OUT_A = 6, /*!< Synchronization signal is output on SYNC_OUT_A. */ + SBG_ECOM_MODULE_SYNC_OUT_B = 7, /*!< Synchronization signal is output on SYNC_OUT_B. */ +} SbgEComModuleSyncAssignment; + +/*! + * List of configurations available for the odometer. + */ +typedef enum _SbgEComOdometerPinAssignment +{ + SBG_ECOM_MODULE_ODO_DISABLED = 0, /*!< Odometer is disabled. */ + SBG_ECOM_MODULE_ODO_A = 1, /*!< Odometer connected only to ODO_A (unidirectional).. */ + SBG_ECOM_MODULE_ODO_A_B = 2, /*!< Odometer connected to both ODO_A (signal A) and ODO_B (Signal B or direction) for bidirectional odometer.. */ + SBG_ECOM_MODULE_ODO_CAN = 3, /*!< Vehicle odometer using CAN (OBD-II). */ +} SbgEComOdometerPinAssignment; + +/*! + * This enum defines the different motion profile IDs available in standard + */ +typedef enum _SbgEComMotionProfileStdIds +{ + SBG_ECOM_MOTION_PROFILE_GENERAL_PURPOSE = 1, /*!< Should be used as a default when other profiles do not apply */ + SBG_ECOM_MOTION_PROFILE_AUTOMOTIVE = 2, /*!< Dedicated to car applications */ + SBG_ECOM_MOTION_PROFILE_MARINE = 3, /*!< Used in marine and underwater applications */ + SBG_ECOM_MOTION_PROFILE_AIRPLANE = 4, /*!< For fixed wings aircraft */ + SBG_ECOM_MOTION_PROFILE_HELICOPTER = 5, /*!< For rotary wing aircraft */ + SBG_ECOM_MOTION_PROFILE_UAV_ROTARY_WING = 7, /*!< For rotary wing UAVs that have low dynamics */ + SBG_ECOM_MOTION_PROFILE_HEAVY_MACHINERY = 8, /*!< For vibrating applications with low dynamics and no specific travel direction */ +} SbgEComMotionProfileStdIds; + +//----------------------------------------------------------------------// +//- Event configurations -// +//----------------------------------------------------------------------// + +/*! + * Helper structure for module assignments + */ +typedef struct _SbgEComAidingAssignConf +{ + SbgEComModulePortAssignment gps1Port; /*!< GNSS module port assignment. */ + SbgEComModuleSyncAssignment gps1Sync; /*!< GNSS module sync assignment. */ + SbgEComModulePortAssignment dvlPort; /*!< Port on which the DVL is connected */ + SbgEComModuleSyncAssignment dvlSync; /*!< Optional sync signal that could be used to time stamp the DVL data. */ + SbgEComModulePortAssignment rtcmPort; /*!< RTCM input port assignment for IGNG-N DGPS. */ + SbgEComModulePortAssignment airDataPort; /*!< Port on which Air Data aiding is connected. */ + SbgEComOdometerPinAssignment odometerPinsConf; /*!< Odometer module pin assignment. */ +} SbgEComAidingAssignConf; + +/*! + * Helper structure for sensor alignment details + */ +typedef struct _SbgEComSensorAlignmentInfo +{ + SbgEComAxisDirection axisDirectionX; /*!< Sensor X axis direction in vehicle */ + SbgEComAxisDirection axisDirectionY; /*!< Sensor Y axis direction in vehicle */ + float misRoll; /*!< Roll angle fine misalignment in rad */ + float misPitch; /*!< Pitch angle fine misalignment in rad */ + float misYaw; /*!< Yaw angle fine misalignment in rad */ +} SbgEComSensorAlignmentInfo; + +/*! + * Helper structure for sensor Initial condition details + */ +typedef struct _SbgEComInitConditionConf +{ + double latitude; /*!< Initial latitude in ° */ + double longitude; /*!< Initial longitude in ° */ + double altitude; /*!< Initial altitude above MSL in meters */ + uint16_t year; /*!< Initial Year */ + uint8_t month; /*!< Initial month */ + uint8_t day; /*!< Initial day */ +} SbgEComInitConditionConf; + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Set the motion profile id used to tune the Kalman Filter to a specific application + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] modelId Motion profile id to set + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdSensorSetMotionProfileId(SbgEComHandle *pHandle, SbgEComMotionProfileStdIds modelId); + +/*! + * Retrieve the motion profile id. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[out] pModelId Retrieved motion profile id + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdSensorGetMotionProfileId(SbgEComHandle *pHandle, SbgEComMotionProfileStdIds *pModelId); + +/*! + * Retrieve the initial conditions settings. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[out] pConf Pointer to a SbgEComInitConditionConf to contain the current initial conditions settings. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdSensorGetInitCondition(SbgEComHandle *pHandle, SbgEComInitConditionConf *pConf); + +/*! + * Set the initial condition configuration. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] pConf Pointer to a SbgEComInitConditionConf containing the new initial condition configuration. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdSensorSetInitCondition(SbgEComHandle *pHandle, const SbgEComInitConditionConf *pConf); + +/*! + * Retrieve the assignment of the aiding sensors. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[out] pConf Pointer to a SbgEComAidingAssignConf to contain the current assignment of the aiding sensors. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdSensorGetAidingAssignment(SbgEComHandle *pHandle, SbgEComAidingAssignConf *pConf); + +/*! + * Set the assignment of the aiding sensors. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[out] pConf Pointer to a SbgEComAidingAssignConf containing the new assignment of the aiding sensors. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdSensorSetAidingAssignment(SbgEComHandle *pHandle, const SbgEComAidingAssignConf *pConf); + +/*! + * Retrieve the alignment and lever arm configuration of the sensor. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[out] pAlignConf Pointer to a SbgEComSensorAlignmentInfo struct to hold alignment configuration of the sensor. + * \param[out] pLeverArm Pointer to a table to contain lever arm X, Y, Z components in meters. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdSensorGetAlignmentAndLeverArm(SbgEComHandle *pHandle, SbgEComSensorAlignmentInfo *pAlignConf, float *pLeverArm); + +/*! + * Set the alignment and lever arm configuration of the sensor. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] pAlignConf Pointer to a SbgEComSensorAlignmentInfo struct holding alignment configuration for the sensor. + * \param[in] pLeverArm Pointer to a table containing lever arm X, Y, Z components in meters. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdSensorSetAlignmentAndLeverArm(SbgEComHandle *pHandle, const SbgEComSensorAlignmentInfo *pAlignConf, const float *pLeverArm); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_CMD_SENSOR_H diff --git a/src/commands/sbgEComCmdSettings.c b/src/commands/sbgEComCmdSettings.c new file mode 100644 index 0000000..17c9f3d --- /dev/null +++ b/src/commands/sbgEComCmdSettings.c @@ -0,0 +1,89 @@ +// sbgCommonLib headers +#include +#include + +// Project headers +#include +#include + +// Local headers +#include "sbgEComCmdCommon.h" +#include "sbgEComCmdSettings.h" + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComCmdSettingsAction(SbgEComHandle *pHandle, SbgEComSettingsAction action) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + uint32_t trial; + uint8_t outputBuffer[1]; + SbgStreamBuffer outputStream; + + assert(pHandle); + + // + // Build the payload to send + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + sbgStreamBufferWriteUint8(&outputStream, action); + + // + // Send the command three times + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send the command and the action + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_SETTINGS_ACTION, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + // + // Make sure that the command has been sent + // + if (errorCode == SBG_NO_ERROR) + { + // + // Try to read the device answer for 500 ms + // + errorCode = sbgEComWaitForAck(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_SETTINGS_ACTION, pHandle->cmdDefaultTimeOut); + + // + // Test if we have received a valid ACK + // + if (errorCode == SBG_NO_ERROR) + { + // + // The command has been executed successfully so return + // + break; + } + } + else + { + // + // We have a write error so exit the try loop + // + break; + } + } + + return errorCode; +} + +SbgErrorCode sbgEComCmdImportSettings(SbgEComHandle *pHandle, const void *pBuffer, size_t size) +{ + // + // Call function that handle data transfer + // + return sbgEComTransferSend(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_IMPORT_SETTINGS, pBuffer, size); +} + +SbgErrorCode sbgEComCmdExportSettings(SbgEComHandle *pHandle, void *pBuffer, size_t *pSize, size_t maxSize) +{ + // + // Call function that handle data transfer + // + return sbgEComTransferReceive(pHandle, SBG_ECOM_CLASS_LOG_CMD_0, SBG_ECOM_CMD_EXPORT_SETTINGS, pBuffer, pSize, maxSize); +} diff --git a/src/commands/sbgEComCmdSettings.h b/src/commands/sbgEComCmdSettings.h new file mode 100644 index 0000000..a246b08 --- /dev/null +++ b/src/commands/sbgEComCmdSettings.h @@ -0,0 +1,104 @@ +/*! + * \file sbgEComCmdSettings.h + * \author SBG Systems + * \date 11 June 2014 + * + * \brief Import/export/save settings commands. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_CMD_SETTINGS_H +#define SBG_ECOM_CMD_SETTINGS_H + +// sbgCommonLib headers +#include + +// Project headers +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Settings action definition -// +//----------------------------------------------------------------------// + +/*! + * Defintion of all the settings actions available. + */ +typedef enum _SbgEComSettingsAction +{ + SBG_ECOM_REBOOT_ONLY = 0, /*!< Only reboot the device. */ + SBG_ECOM_SAVE_SETTINGS = 1, /*!< Save the settings to non-volatile memory and then reboot the device. */ + SBG_ECOM_RESTORE_DEFAULT_SETTINGS = 2 /*!< Restore default settings, save them to non-volatile memory and reboot the device. */ +} SbgEComSettingsAction; + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Send a command to execute a specific system action to reboot/save/restore default settings. + * + * Execute one of the available settings action: + * - SBG_ECOM_REBOOT_ONLY : Only reboot the device. + * - SBG_ECOM_SAVE_SETTINGS : Save the settings to non-volatile memory and then reboot the device. + * - SBG_ECOM_RESTORE_DEFAULT_SETTINGS : Restore default settings, save them to non-volatile memory and reboot the device. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] action One of the available SbgEComSettingsAction. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdSettingsAction(SbgEComHandle *pHandle, SbgEComSettingsAction action); + +/*! + * Send a complete set of settings to the device and store them into the FLASH memory. + * + * The device will reboot automatically to use the new settings. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] pBuffer Read only buffer containing the settings. + * \param[in] size Size of the buffer. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdImportSettings(SbgEComHandle *pHandle, const void *pBuffer, size_t size); + +/*! + * Retrieve a complete set of settings from the device as a buffer. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] pBuffer Allocated buffer that can hold the received settings. + * \param[out] pSize The number of bytes that have been stored into pBuffer. + * \param[in] maxSize The maximum buffer size in bytes that can be stored into pBuffer. + * \return SBG_NO_ERROR if the command has been executed successfully. + */ +SbgErrorCode sbgEComCmdExportSettings(SbgEComHandle *pHandle, void *pBuffer, size_t *pSize, size_t maxSize); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_CMD_SETTINGS_H diff --git a/src/protocol/sbgEComProtocol.c b/src/protocol/sbgEComProtocol.c new file mode 100644 index 0000000..6766376 --- /dev/null +++ b/src/protocol/sbgEComProtocol.c @@ -0,0 +1,1201 @@ +// sbgCommonLib headers +#include +#include +#include +#include + +// Local headers +#include "sbgEComProtocol.h" + +//----------------------------------------------------------------------// +//- Constant definitions -// +//----------------------------------------------------------------------// + +/*! + * Delay before another send attempt when sending a large payload, in milliseconds. + */ +#define SBG_ECOM_PROTOCOL_EXT_SEND_DELAY (50) + +//----------------------------------------------------------------------// +//- Private functions -// +//----------------------------------------------------------------------// + +/*! + * Clear the content of a payload. + * + * Any allocated resource is released, and the payload returns to its constructed state. + * + * \param[in] pPayload Payload. + */ +static void sbgEComProtocolPayloadClear(SbgEComProtocolPayload *pPayload) +{ + assert(pPayload); + + if (pPayload->allocated) + { + free(pPayload->pBuffer); + + pPayload->allocated = false; + } + + pPayload->pBuffer = NULL; + pPayload->size = 0; +} + +/*! + * Set the properties of a payload. + * + * \param[in] pPayload Payload. + * \param[in] allocated True if the given buffer is allocated with malloc(). + * \param[in] pBuffer Buffer. + * \param[in] size Buffer size, in bytes. + */ +static void sbgEComProtocolPayloadSet(SbgEComProtocolPayload *pPayload, bool allocated, void *pBuffer, size_t size) +{ + assert(pPayload); + assert(pBuffer); + + pPayload->allocated = allocated; + pPayload->pBuffer = pBuffer; + pPayload->size = size; +} + +/*! + * Discard unused bytes from the work buffer of a protocol. + * + * \param[in] pProtocol Protocol. + */ +static void sbgEComProtocolDiscardUnusedBytes(SbgEComProtocol *pProtocol) +{ + assert(pProtocol); + + if (pProtocol->discardSize != 0) + { + assert(pProtocol->discardSize <= pProtocol->rxBufferSize); + + memmove(pProtocol->rxBuffer, &pProtocol->rxBuffer[pProtocol->discardSize], pProtocol->rxBufferSize - pProtocol->discardSize); + + pProtocol->rxBufferSize -= pProtocol->discardSize; + pProtocol->discardSize = 0; + } +} + +/*! + * Read data from the underlying interface into the work buffer of a protocol. + * + * \param[in] pProtocol Protocol. + */ +static void sbgEComProtocolRead(SbgEComProtocol *pProtocol) +{ + SbgErrorCode errorCode; + + assert(pProtocol); + + if (pProtocol->rxBufferSize < sizeof(pProtocol->rxBuffer)) + { + size_t nrBytesRead; + + errorCode = sbgInterfaceRead(pProtocol->pLinkedInterface, &pProtocol->rxBuffer[pProtocol->rxBufferSize], &nrBytesRead, sizeof(pProtocol->rxBuffer) - pProtocol->rxBufferSize); + + if (errorCode == SBG_NO_ERROR) + { + pProtocol->rxBufferSize += nrBytesRead; + } + } +} + +/*! + * Find SYNC bytes in the work buffer of a protocol. + * + * The output offset is set if either SBG_NO_ERROR or SBG_NOT_CONTINUOUS_FRAME is returned. + * + * \param[in] pProtocol Protocol. + * \param[in] startOffset Start offset, in bytes. + * \param[out] pOffset Offset, in bytes. + * \return SBG_NO_ERROR if successful, + * SBG_NOT_CONTINUOUS_FRAME if only the first SYNC byte was found, + * SBG_NOT_READY otherwise. + */ +static SbgErrorCode sbgEComProtocolFindSyncBytes(SbgEComProtocol *pProtocol, size_t startOffset, size_t *pOffset) +{ + SbgErrorCode errorCode; + + assert(pProtocol); + + errorCode = SBG_NOT_READY; + + for (size_t i = startOffset; i < (pProtocol->rxBufferSize - 1); i++) + { + if ((pProtocol->rxBuffer[i] == SBG_ECOM_SYNC_1) && (pProtocol->rxBuffer[i + 1] == SBG_ECOM_SYNC_2)) + { + *pOffset = i; + errorCode = SBG_NO_ERROR; + break; + } + } + + // + // The SYNC bytes were not found, but check if the last byte in the work buffer is the first SYNC byte, + // as it could result from receiving a partial frame. + // + if ((errorCode != SBG_NO_ERROR) && (pProtocol->rxBuffer[pProtocol->rxBufferSize - 1] == SBG_ECOM_SYNC_1)) + { + *pOffset = pProtocol->rxBufferSize - 1; + errorCode = SBG_NOT_CONTINUOUS_FRAME; + } + + return errorCode; +} + +/*! + * Parse a frame in the work buffer of a protocol. + * + * A non-zero number of pages indicates the reception of an extended frame. + * + * \param[in] pProtocol Protocol. + * \param[in] offset Frame offset in the protocol work buffer. + * \param[out] pEndOffset Frame end offset in the protocol work buffer. + * \param[out] pMsgClass Message class. + * \param[out] pMsgId Message ID. + * \param[out] pTransferId Transfer ID. + * \param[out] pPageIndex Page index. + * \param[out] pNrPages Number of pages. + * \param[out] pBuffer Payload buffer. + * \param[out] pSize Payload buffer size, in bytes. + * \return SBG_NO_ERROR if successful, + * SBG_NOT_READY if the frame is incomplete, + * SBG_INVALID_FRAME if the frame is invalid, + * SBG_INVALID_CRC if the frame CRC is invalid. + */ +static SbgErrorCode sbgEComProtocolParseFrame(SbgEComProtocol *pProtocol, size_t offset, size_t *pEndOffset, uint8_t *pMsgClass, uint8_t *pMsgId, uint8_t *pTransferId, uint16_t *pPageIndex, uint16_t *pNrPages, void **pBuffer, size_t *pSize) +{ + SbgErrorCode errorCode; + SbgStreamBuffer streamBuffer; + uint8_t msgId; + uint8_t msgClass; + size_t standardPayloadSize; + + assert(pProtocol); + assert(offset < pProtocol->rxBufferSize); + assert(pEndOffset); + assert(pMsgClass); + assert(pMsgId); + assert(pTransferId); + assert(pPageIndex); + assert(pNrPages); + assert(pBuffer); + assert(pSize); + + sbgStreamBufferInitForRead(&streamBuffer, &pProtocol->rxBuffer[offset], pProtocol->rxBufferSize - offset); + + // + // Skip SYNC bytes. + // + sbgStreamBufferSeek(&streamBuffer, 2, SB_SEEK_CUR_INC); + + msgId = sbgStreamBufferReadUint8(&streamBuffer); + msgClass = sbgStreamBufferReadUint8(&streamBuffer); + standardPayloadSize = sbgStreamBufferReadUint16LE(&streamBuffer); + + errorCode = sbgStreamBufferGetLastError(&streamBuffer); + + if (errorCode == SBG_NO_ERROR) + { + if (standardPayloadSize <= SBG_ECOM_MAX_PAYLOAD_SIZE) + { + if (sbgStreamBufferGetSize(&streamBuffer) >= (standardPayloadSize + 9)) + { + size_t payloadSize; + uint8_t transferId; + uint16_t pageIndex; + uint16_t nrPages; + + if ((msgClass & 0x80) == 0) + { + payloadSize = standardPayloadSize; + + transferId = 0; + pageIndex = 0; + nrPages = 0; + + errorCode = SBG_NO_ERROR; + } + else + { + msgClass &= 0x7f; + + // + // In extended frames, the payload size includes the extended headers. + // + payloadSize = standardPayloadSize - 5; + + transferId = sbgStreamBufferReadUint8(&streamBuffer); + pageIndex = sbgStreamBufferReadUint16LE(&streamBuffer); + nrPages = sbgStreamBufferReadUint16LE(&streamBuffer); + + if ((transferId & 0xf0) != 0) + { + SBG_LOG_WARNING(SBG_INVALID_FRAME, "reserved bits set in extended headers"); + transferId &= 0xf; + } + + if (pageIndex < nrPages) + { + errorCode = SBG_NO_ERROR; + } + else + { + errorCode = SBG_INVALID_FRAME; + SBG_LOG_ERROR(errorCode, "invalid page information : %" PRIu16 "/%" PRIu16, pageIndex, nrPages); + } + } + + if (errorCode == SBG_NO_ERROR) + { + void *pPayloadAddr; + uint16_t frameCrc; + uint8_t lastByte; + + pPayloadAddr = sbgStreamBufferGetCursor(&streamBuffer); + + sbgStreamBufferSeek(&streamBuffer, payloadSize, SB_SEEK_CUR_INC); + + frameCrc = sbgStreamBufferReadUint16LE(&streamBuffer); + lastByte = sbgStreamBufferReadUint8(&streamBuffer); + + assert(sbgStreamBufferGetLastError(&streamBuffer) == SBG_NO_ERROR); + + if (lastByte == SBG_ECOM_ETX) + { + uint16_t computedCrc; + + // + // The CRC spans from the header (excluding the SYNC bytes) up to the CRC bytes. + // + sbgStreamBufferSeek(&streamBuffer, 2, SB_SEEK_SET); + computedCrc = sbgCrc16Compute(sbgStreamBufferGetCursor(&streamBuffer), standardPayloadSize + 4); + + if (frameCrc == computedCrc) + { + *pEndOffset = offset + standardPayloadSize + 9; + *pMsgClass = msgClass; + *pMsgId = msgId; + *pTransferId = transferId; + *pPageIndex = pageIndex; + *pNrPages = nrPages; + *pBuffer = pPayloadAddr; + *pSize = payloadSize; + + errorCode = SBG_NO_ERROR; + } + else + { + errorCode = SBG_INVALID_CRC; + SBG_LOG_ERROR(errorCode, "invalid CRC, frame:%#" PRIx16 " computed:%#" PRIx16, frameCrc, computedCrc); + } + } + else + { + errorCode = SBG_INVALID_FRAME; + SBG_LOG_ERROR(errorCode, "invalid end-of-frame: byte:%#" PRIx8, lastByte); + } + } + } + else + { + errorCode = SBG_NOT_READY; + } + } + else + { + errorCode = SBG_INVALID_FRAME; + SBG_LOG_ERROR(errorCode, "invalid payload size %zu", standardPayloadSize); + } + } + else + { + errorCode = SBG_NOT_READY; + } + + return errorCode; +} + +/*! + * Find a frame in the work buffer of a protocol. + * + * If an extended frame is received, the number of pages is set to a non-zero value. + * + * \param[in] pProtocol Protocol. + * \param[out] pMsgClass Message class. + * \param[out] pMsgId Message ID. + * \param[out] pTransferId Transfer ID. + * \param[out] pPageIndex Page index. + * \param[out] pNrPages Number of pages. + * \param[out] pBuffer Payload buffer. + * \param[out] pSize Payload buffer size, in bytes. + * \return SBG_NO_ERROR if successful, + * SBG_NOT_READY if no frame was found. + */ +static SbgErrorCode sbgEComProtocolFindFrame(SbgEComProtocol *pProtocol, uint8_t *pMsgClass, uint8_t *pMsgId, uint8_t *pTransferId, uint16_t *pPageIndex, uint16_t *pNrPages, void **pBuffer, size_t *pSize) +{ + SbgErrorCode errorCode; + size_t startOffset; + + assert(pProtocol); + + errorCode = SBG_NOT_READY; + startOffset = 0; + + while (startOffset < pProtocol->rxBufferSize) + { + size_t offset; + + errorCode = sbgEComProtocolFindSyncBytes(pProtocol, startOffset, &offset); + + if (errorCode == SBG_NO_ERROR) + { + size_t endOffset; + + errorCode = sbgEComProtocolParseFrame(pProtocol, offset, &endOffset, pMsgClass, pMsgId, pTransferId, pPageIndex, pNrPages, pBuffer, pSize); + + if (errorCode == SBG_NO_ERROR) + { + // + // Valid frame found, discard all data up to and including that frame + // on the next read. + // + pProtocol->discardSize = endOffset; + break; + } + else if (errorCode == SBG_NOT_READY) + { + // + // There may be a valid frame at the parse offset, but it's not complete. + // Have all preceding bytes discarded on the next read. + // + pProtocol->discardSize = offset; + break; + } + else + { + // + // Not a valid frame, skip SYNC bytes and try again. + // + startOffset = offset + 2; + errorCode = SBG_NOT_READY; + } + } + else if (errorCode == SBG_NOT_CONTINUOUS_FRAME) + { + // + // The first SYNC byte was found, but not the second. It may be a valid + // frame, so keep the SYNC byte but have all preceding bytes discarded + // on the next read. + // + pProtocol->discardSize = offset; + errorCode = SBG_NOT_READY; + break; + } + else + { + // + // No SYNC byte found, discard all data. + // + pProtocol->rxBufferSize = 0; + errorCode = SBG_NOT_READY; + break; + } + } + + assert(pProtocol->discardSize <= pProtocol->rxBufferSize); + + return errorCode; +} + +/*! + * Send a standard frame. + * + * \param[in] pProtocol Protocol. + * \param[in] msgClass Message class. + * \param[in] msgId Message ID. + * \param[in] pData Data buffer. + * \param[in] size Data buffer size, in bytes. + * \return SBG_NO_ERROR if successful. + */ +static SbgErrorCode sbgEComProtocolSendStandardFrame(SbgEComProtocol *pProtocol, uint8_t msgClass, uint8_t msgId, const void *pData, size_t size) +{ + uint8_t buffer[SBG_ECOM_MAX_BUFFER_SIZE]; + SbgStreamBuffer streamBuffer; + const uint8_t *crcDataStart; + const uint8_t *crcDataEnd; + uint16_t crc; + + assert(pProtocol); + assert((msgClass & 0x80) == 0); + assert(size <= SBG_ECOM_MAX_PAYLOAD_SIZE); + assert(pData || (size == 0)); + + sbgStreamBufferInitForWrite(&streamBuffer, buffer, sizeof(buffer)); + + sbgStreamBufferWriteUint8(&streamBuffer, SBG_ECOM_SYNC_1); + sbgStreamBufferWriteUint8(&streamBuffer, SBG_ECOM_SYNC_2); + + crcDataStart = sbgStreamBufferGetCursor(&streamBuffer); + + sbgStreamBufferWriteUint8(&streamBuffer, msgId); + sbgStreamBufferWriteUint8(&streamBuffer, msgClass); + + sbgStreamBufferWriteUint16LE(&streamBuffer, (uint16_t)size); + + sbgStreamBufferWriteBuffer(&streamBuffer, pData, size); + + crcDataEnd = sbgStreamBufferGetCursor(&streamBuffer); + + crc = sbgCrc16Compute(crcDataStart, crcDataEnd - crcDataStart); + + sbgStreamBufferWriteUint16LE(&streamBuffer, crc); + + sbgStreamBufferWriteUint8(&streamBuffer, SBG_ECOM_ETX); + + assert(sbgStreamBufferGetLastError(&streamBuffer) == SBG_NO_ERROR); + + return sbgInterfaceWrite(pProtocol->pLinkedInterface, sbgStreamBufferGetLinkedBuffer(&streamBuffer), sbgStreamBufferGetLength(&streamBuffer)); +} + +/*! + * Send an extended frame. + * + * \param[in] pProtocol Protocol. + * \param[in] msgClass Message class. + * \param[in] msgId Message ID. + * \param[in] transferId Transfer ID. + * \param[in] pageIndex Page index (0 to 65534) + * \param[in] nrPages Total number of pages (1 to 65535) + * \param[in] pData Data buffer. + * \param[in] size Data buffer size, in bytes. + * \return SBG_NO_ERROR if successful. + */ +static SbgErrorCode sbgEComProtocolSendExtendedFrame(SbgEComProtocol *pProtocol, uint8_t msgClass, uint8_t msgId, uint8_t transferId, size_t pageIndex, size_t nrPages, const void *pData, size_t size) +{ + SbgErrorCode errorCode; + uint8_t buffer[SBG_ECOM_MAX_BUFFER_SIZE]; + SbgStreamBuffer streamBuffer; + const uint8_t *crcDataStart; + const uint8_t *crcDataEnd; + uint16_t crc; + + assert(pProtocol); + assert((msgClass & 0x80) == 0); + assert((transferId & 0xf0) == 0); + assert(pageIndex < UINT16_MAX); + assert((nrPages > 0) && (nrPages <= UINT16_MAX)); + assert(pageIndex < nrPages); + assert(size <= SBG_ECOM_MAX_EXTENDED_PAYLOAD_SIZE); + assert(pData || (size == 0)); + + sbgStreamBufferInitForWrite(&streamBuffer, buffer, sizeof(buffer)); + + sbgStreamBufferWriteUint8(&streamBuffer, SBG_ECOM_SYNC_1); + sbgStreamBufferWriteUint8(&streamBuffer, SBG_ECOM_SYNC_2); + + crcDataStart = sbgStreamBufferGetCursor(&streamBuffer); + + sbgStreamBufferWriteUint8(&streamBuffer, msgId); + sbgStreamBufferWriteUint8(&streamBuffer, 0x80 | msgClass); + + // + // For compatibility reasons, the size must span over the extended headers. + // + sbgStreamBufferWriteUint16LE(&streamBuffer, (uint16_t)size + 5); + + sbgStreamBufferWriteUint8(&streamBuffer, transferId); + sbgStreamBufferWriteUint16LE(&streamBuffer, (uint16_t)pageIndex); + sbgStreamBufferWriteUint16LE(&streamBuffer, (uint16_t)nrPages); + + sbgStreamBufferWriteBuffer(&streamBuffer, pData, size); + + crcDataEnd = sbgStreamBufferGetCursor(&streamBuffer); + + crc = sbgCrc16Compute(crcDataStart, crcDataEnd - crcDataStart); + + sbgStreamBufferWriteUint16LE(&streamBuffer, crc); + + sbgStreamBufferWriteUint8(&streamBuffer, SBG_ECOM_ETX); + + assert(sbgStreamBufferGetLastError(&streamBuffer) == SBG_NO_ERROR); + + for (;;) + { + errorCode = sbgInterfaceWrite(pProtocol->pLinkedInterface, sbgStreamBufferGetLinkedBuffer(&streamBuffer), sbgStreamBufferGetLength(&streamBuffer)); + + if (errorCode != SBG_BUFFER_OVERFLOW) + { + break; + } + + sbgSleep(SBG_ECOM_PROTOCOL_EXT_SEND_DELAY); + } + + return errorCode; +} + +/*! + * Get a transfer ID for the next large send. + * + * This function returns a different ID every time it's called. + * + * \param[in] pProtocol Protocol. + * \return Transfer ID of the next large send. + */ +static SbgErrorCode sbgEComProtocolGetTxId(SbgEComProtocol *pProtocol) +{ + uint8_t transferId; + + assert(pProtocol); + assert((pProtocol->nextLargeTxId & 0xf0) == 0); + + transferId = pProtocol->nextLargeTxId; + pProtocol->nextLargeTxId = (pProtocol->nextLargeTxId + 1) & 0xf0; + + return transferId; +} + +/*! + * Check if a large transfer is in progress. + * + * \param[in] pProtocol Protocol. + * \return True if a large transfer is in progress. + */ +static bool sbgEComProtocolLargeTransferInProgress(const SbgEComProtocol *pProtocol) +{ + assert(pProtocol); + + return pProtocol->pLargeBuffer; +} + +/*! + * Reset The large transfer member variables of a protocol. + * + * \param[in] pProtocol Protocol. + */ +static void sbgEComProtocolResetLargeTransfer(SbgEComProtocol *pProtocol) +{ + assert(pProtocol); + + pProtocol->pLargeBuffer = NULL; + pProtocol->largeBufferSize = 0; + pProtocol->transferId = 0; + pProtocol->pageIndex = 0; + pProtocol->nrPages = 0; +} + +/*! + * Clear any large transfer in progress. + * + * \param[in] pProtocol Protocol. + */ +static void sbgEComProtocolClearLargeTransfer(SbgEComProtocol *pProtocol) +{ + assert(pProtocol); + + free(pProtocol->pLargeBuffer); + + sbgEComProtocolResetLargeTransfer(pProtocol); +} + +/*! + * Process an extended frame. + * + * \param[in] pProtocol Protocol. + * \param[in] msgClass Message class. + * \param[in] msgId Message ID. + * \param[in] transferId Transfer ID. + * \param[in] pageIndex Page index. + * \param[in] nrPages Number of pages. + * \param[in] pBuffer Buffer. + * \param[in] size Buffer size, in bytes. + * \return SBG_NO_ERROR if a large transfer is complete, + * SBG_NOT_READY otherwise. + */ +static SbgErrorCode sbgEComProtocolProcessExtendedFrame(SbgEComProtocol *pProtocol, uint8_t msgClass, uint8_t msgId, uint8_t transferId, uint16_t pageIndex, uint16_t nrPages, const void *pBuffer, size_t size) +{ + SbgErrorCode errorCode; + + assert(pProtocol); + assert((transferId & 0xf0) == 0); + assert(pageIndex < nrPages); + assert(pBuffer || (size == 0)); + assert(size <= SBG_ECOM_MAX_EXTENDED_PAYLOAD_SIZE); + + if (pageIndex == 0) + { + size_t capacity; + + if (sbgEComProtocolLargeTransferInProgress(pProtocol)) + { + SBG_LOG_ERROR(SBG_ERROR, "large transfer started while a large transfer is in progress"); + SBG_LOG_ERROR(SBG_ERROR, "terminating large transfer"); + + sbgEComProtocolClearLargeTransfer(pProtocol); + } + + capacity = nrPages * SBG_ECOM_MAX_EXTENDED_PAYLOAD_SIZE; + + pProtocol->pLargeBuffer = malloc(capacity); + + if (pProtocol->pLargeBuffer) + { + pProtocol->largeBufferSize = 0; + pProtocol->msgClass = msgClass; + pProtocol->msgId = msgId; + pProtocol->transferId = transferId; + pProtocol->pageIndex = 0; + pProtocol->nrPages = nrPages; + + errorCode = SBG_NO_ERROR; + } + else + { + SBG_LOG_ERROR(SBG_MALLOC_FAILED, "unable to allocate buffer"); + + sbgEComProtocolResetLargeTransfer(pProtocol); + + errorCode = SBG_NOT_READY; + } + } + else + { + if (sbgEComProtocolLargeTransferInProgress(pProtocol)) + { + errorCode = SBG_NO_ERROR; + } + else + { + SBG_LOG_ERROR(SBG_ERROR, "extended frame received while no large transfer in progress"); + + errorCode = SBG_NOT_READY; + } + } + + if (errorCode == SBG_NO_ERROR) + { + if (msgClass == pProtocol->msgClass) + { + errorCode = SBG_NO_ERROR; + } + else + { + SBG_LOG_ERROR(SBG_ERROR, "message class mismatch in extended frame"); + SBG_LOG_ERROR(SBG_ERROR, "terminating large transfer"); + + sbgEComProtocolClearLargeTransfer(pProtocol); + + errorCode = SBG_NOT_READY; + } + + if (msgId == pProtocol->msgId) + { + errorCode = SBG_NO_ERROR; + } + else + { + SBG_LOG_ERROR(SBG_ERROR, "message ID mismatch in extended frame"); + SBG_LOG_ERROR(SBG_ERROR, "terminating large transfer"); + + sbgEComProtocolClearLargeTransfer(pProtocol); + + errorCode = SBG_NOT_READY; + } + + if (transferId == pProtocol->transferId) + { + errorCode = SBG_NO_ERROR; + } + else + { + SBG_LOG_ERROR(SBG_ERROR, "transfer ID mismatch in extended frame"); + SBG_LOG_ERROR(SBG_ERROR, "terminating large transfer"); + + sbgEComProtocolClearLargeTransfer(pProtocol); + + errorCode = SBG_NOT_READY; + } + + if (errorCode == SBG_NO_ERROR) + { + if (nrPages == pProtocol->nrPages) + { + if (pageIndex == pProtocol->pageIndex) + { + size_t offset; + + offset = pageIndex * SBG_ECOM_MAX_EXTENDED_PAYLOAD_SIZE; + memcpy(&pProtocol->pLargeBuffer[offset], pBuffer, size); + + pProtocol->largeBufferSize += size; + pProtocol->pageIndex++; + + if (pProtocol->pageIndex != pProtocol->nrPages) + { + errorCode = SBG_NOT_READY; + } + } + else + { + SBG_LOG_ERROR(SBG_ERROR, "extended frame received out of sequence"); + SBG_LOG_ERROR(SBG_ERROR, "terminating large transfer"); + + sbgEComProtocolClearLargeTransfer(pProtocol); + + errorCode = SBG_NOT_READY; + } + } + else + { + SBG_LOG_ERROR(SBG_ERROR, "page count mismatch in extended frame"); + SBG_LOG_ERROR(SBG_ERROR, "terminating large transfer"); + + sbgEComProtocolClearLargeTransfer(pProtocol); + + errorCode = SBG_NOT_READY; + } + } + } + + return errorCode; +} + +//----------------------------------------------------------------------// +//- Public methods (SbgEComProtocolPayload) -// +//----------------------------------------------------------------------// + +void sbgEComProtocolPayloadConstruct(SbgEComProtocolPayload *pPayload) +{ + assert(pPayload); + + pPayload->allocated = false; + pPayload->pBuffer = NULL; + pPayload->size = 0; +} + +void sbgEComProtocolPayloadDestroy(SbgEComProtocolPayload *pPayload) +{ + assert(pPayload); + + if (pPayload->allocated) + { + free(pPayload->pBuffer); + } +} + +const void *sbgEComProtocolPayloadGetBuffer(const SbgEComProtocolPayload *pPayload) +{ + assert(pPayload); + + return pPayload->pBuffer; +} + +size_t sbgEComProtocolPayloadGetSize(const SbgEComProtocolPayload *pPayload) +{ + assert(pPayload); + + return pPayload->size; +} + +void *sbgEComProtocolPayloadMoveBuffer(SbgEComProtocolPayload *pPayload) +{ + void *pBuffer; + + assert(pPayload); + + if (pPayload->pBuffer) + { + if (pPayload->allocated) + { + pBuffer = pPayload->pBuffer; + + sbgEComProtocolPayloadConstruct(pPayload); + } + else + { + pBuffer = malloc(pPayload->size); + + if (pBuffer) + { + memcpy(pBuffer, pPayload->pBuffer, pPayload->size); + + sbgEComProtocolPayloadConstruct(pPayload); + } + else + { + SBG_LOG_ERROR(SBG_MALLOC_FAILED, "unable to allocate buffer"); + } + } + } + else + { + pBuffer = NULL; + } + + return pBuffer; +} + +//----------------------------------------------------------------------// +//- Public methods (SbgEComProtocol) -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComProtocolInit(SbgEComProtocol *pProtocol, SbgInterface *pInterface) +{ + assert(pProtocol); + assert(pInterface); + + pProtocol->pLinkedInterface = pInterface; + pProtocol->rxBufferSize = 0; + pProtocol->discardSize = 0; + pProtocol->nextLargeTxId = 0; + + sbgEComProtocolResetLargeTransfer(pProtocol); + + return SBG_NO_ERROR; +} + +SbgErrorCode sbgEComProtocolClose(SbgEComProtocol *pProtocol) +{ + assert(pProtocol); + + pProtocol->pLinkedInterface = NULL; + pProtocol->rxBufferSize = 0; + pProtocol->discardSize = 0; + pProtocol->nextLargeTxId = 0; + + sbgEComProtocolClearLargeTransfer(pProtocol); + + return SBG_NO_ERROR; +} + +SbgErrorCode sbgEComProtocolPurgeIncoming(SbgEComProtocol *pProtocol) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + size_t numBytesRead; + uint32_t timeStamp; + + // + // Reset the work buffer + // + pProtocol->rxBufferSize = 0; + pProtocol->discardSize = 0; + pProtocol->nextLargeTxId = 0; + + sbgEComProtocolClearLargeTransfer(pProtocol); + + // + // Try to read all iconming data for at least 100 ms and trash them + /// + timeStamp = sbgGetTime(); + + do + { + errorCode = sbgInterfaceRead(pProtocol->pLinkedInterface, pProtocol->rxBuffer, &numBytesRead, sizeof(pProtocol->rxBuffer)); + + if (errorCode != SBG_NO_ERROR) + { + SBG_LOG_ERROR(errorCode, "Unable to read data from interface"); + break; + } + } while ((sbgGetTime() - timeStamp) < 100); + + // + // If we still have read some bytes it means we were not able to purge successfully the rx buffer + // + if ( (errorCode == SBG_NO_ERROR) && (numBytesRead > 0) ) + { + errorCode = SBG_ERROR; + SBG_LOG_ERROR(errorCode, "Unable to purge the rx buffer, %zu bytes remaining", numBytesRead); + } + + return errorCode; +} + +SbgErrorCode sbgEComProtocolSend(SbgEComProtocol *pProtocol, uint8_t msgClass, uint8_t msgId, const void *pData, size_t size) +{ + SbgErrorCode errorCode; + + if (size <= SBG_ECOM_MAX_PAYLOAD_SIZE) + { + errorCode = sbgEComProtocolSendStandardFrame(pProtocol, msgClass, msgId, pData, size); + } + else + { + size_t nrPages; + + nrPages = sbgDivCeil(size, SBG_ECOM_MAX_EXTENDED_PAYLOAD_SIZE); + + if (nrPages <= UINT16_MAX) + { + const uint8_t *pBuffer; + size_t offset; + uint8_t transferId; + + pBuffer = pData; + offset = 0; + transferId = sbgEComProtocolGetTxId(pProtocol); + errorCode = SBG_INVALID_PARAMETER; + + for (uint16_t pageIndex = 0; pageIndex < nrPages; pageIndex++) + { + size_t transferSize; + + if ((size - offset) < SBG_ECOM_MAX_EXTENDED_PAYLOAD_SIZE) + { + transferSize = size - offset; + } + else + { + transferSize = SBG_ECOM_MAX_EXTENDED_PAYLOAD_SIZE; + } + + errorCode = sbgEComProtocolSendExtendedFrame(pProtocol, msgClass, msgId, transferId, pageIndex, nrPages, &pBuffer[offset], transferSize); + + if (errorCode != SBG_NO_ERROR) + { + break; + } + + offset += transferSize; + } + } + else + { + errorCode = SBG_INVALID_PARAMETER; + SBG_LOG_ERROR(errorCode, "payload size too large: %zu", size); + } + } + + return errorCode; +} + +SbgErrorCode sbgEComProtocolReceive(SbgEComProtocol *pProtocol, uint8_t *pMsgClass, uint8_t *pMsgId, void *pData, size_t *pSize, size_t maxSize) +{ + SbgErrorCode errorCode; + SbgEComProtocolPayload payload; + + sbgEComProtocolPayloadConstruct(&payload); + + errorCode = sbgEComProtocolReceive2(pProtocol, pMsgClass, pMsgId, &payload); + + if (errorCode == SBG_NO_ERROR) + { + size_t size; + + size = sbgEComProtocolPayloadGetSize(&payload); + + if (size <= maxSize) + { + if (pData) + { + const void *pBuffer; + + pBuffer = sbgEComProtocolPayloadGetBuffer(&payload); + + memcpy(pData, pBuffer, size); + } + + if (pSize) + { + *pSize = size; + } + } + else + { + errorCode = SBG_BUFFER_OVERFLOW; + } + } + + sbgEComProtocolPayloadDestroy(&payload); + + return errorCode; +} + +SbgErrorCode sbgEComProtocolReceive2(SbgEComProtocol *pProtocol, uint8_t *pMsgClass, uint8_t *pMsgId, SbgEComProtocolPayload *pPayload) +{ + SbgErrorCode errorCode; + uint8_t msgClass; + uint8_t msgId; + uint8_t transferId; + uint16_t pageIndex; + uint16_t nrPages; + void *pBuffer; + size_t size; + + assert(pProtocol); + assert(pProtocol->discardSize <= pProtocol->rxBufferSize); + + sbgEComProtocolPayloadClear(pPayload); + + sbgEComProtocolDiscardUnusedBytes(pProtocol); + + sbgEComProtocolRead(pProtocol); + + errorCode = sbgEComProtocolFindFrame(pProtocol, &msgClass, &msgId, &transferId, &pageIndex, &nrPages, &pBuffer, &size); + + if (errorCode == SBG_NO_ERROR) + { + if (nrPages == 0) + { + if (sbgEComProtocolLargeTransferInProgress(pProtocol)) + { + SBG_LOG_ERROR(SBG_ERROR, "standard frame received while a large transfer is in progress"); + SBG_LOG_ERROR(SBG_ERROR, "terminating large transfer"); + + sbgEComProtocolClearLargeTransfer(pProtocol); + } + + if (pMsgClass) + { + *pMsgClass = msgClass; + } + + if (pMsgId) + { + *pMsgId = msgId; + } + + sbgEComProtocolPayloadSet(pPayload, false, pBuffer, size); + } + else + { + errorCode = sbgEComProtocolProcessExtendedFrame(pProtocol, msgClass, msgId, transferId, pageIndex, nrPages, pBuffer, size); + + if (errorCode == SBG_NO_ERROR) + { + if (pMsgClass) + { + *pMsgClass = msgClass; + } + + if (pMsgId) + { + *pMsgId = msgId; + } + + sbgEComProtocolPayloadSet(pPayload, true, pProtocol->pLargeBuffer, pProtocol->largeBufferSize); + sbgEComProtocolResetLargeTransfer(pProtocol); + } + } + } + + return errorCode; +} + +SbgErrorCode sbgEComStartFrameGeneration(SbgStreamBuffer *pOutputStream, uint8_t msgClass, uint8_t msg, size_t *pStreamCursor) +{ + assert(pOutputStream); + assert((msgClass & 0x80) == 0); + assert(pStreamCursor); + + // + // Backup the current position in the stream buffer + // + *pStreamCursor = sbgStreamBufferTell(pOutputStream); + + // + // Write the header + // + sbgStreamBufferWriteUint8LE(pOutputStream, SBG_ECOM_SYNC_1); + sbgStreamBufferWriteUint8LE(pOutputStream, SBG_ECOM_SYNC_2); + + // + // Write the message ID and class + // + sbgStreamBufferWriteUint8LE(pOutputStream, msg); + sbgStreamBufferWriteUint8LE(pOutputStream, msgClass); + + // + // For now, we don't know the payload size so skip it + // + return sbgStreamBufferSeek(pOutputStream, sizeof(uint16_t), SB_SEEK_CUR_INC); +} + +SbgErrorCode sbgEComFinalizeFrameGeneration(SbgStreamBuffer *pOutputStream, size_t streamCursor) +{ + SbgErrorCode errorCode; + size_t payloadSize; + size_t currentPos; + uint16_t frameCrc; + + assert(pOutputStream); + + // + // Test if any error has occurred on the stream first + // + errorCode = sbgStreamBufferGetLastError(pOutputStream); + + // + // Is the stream buffer error free ? + // + if (errorCode == SBG_NO_ERROR) + { + // + // Compute the payload size (written data minus the header) + // + payloadSize = sbgStreamBufferGetLength(pOutputStream) - streamCursor - 6; + + // + // Test that the payload size is valid + // + if (payloadSize <= SBG_ECOM_MAX_PAYLOAD_SIZE) + { + // + // Backup the current cursor position + // + currentPos = sbgStreamBufferTell(pOutputStream); + + // + // Goto the payload size field (4th byte in the frame) + // + sbgStreamBufferSeek(pOutputStream, streamCursor+4, SB_SEEK_SET); + + // + // Write the payload size + // + sbgStreamBufferWriteUint16LE(pOutputStream, (uint16_t)payloadSize); + + // + // Go back to the previous position + // + sbgStreamBufferSeek(pOutputStream, currentPos, SB_SEEK_SET); + + // + // Compute the 16 bits CRC on the whole frame except Sync 1 and Sync 2 + // + frameCrc = sbgCrc16Compute((uint8_t*)sbgStreamBufferGetLinkedBuffer(pOutputStream) + streamCursor + 2, payloadSize + 4); + + // + // Append the CRC + // + sbgStreamBufferWriteUint16LE(pOutputStream, frameCrc); + + // + // Append the ETX + // + errorCode = sbgStreamBufferWriteUint8LE(pOutputStream, SBG_ECOM_ETX); + } + else + { + // + // Invalid payload size + // + errorCode = SBG_BUFFER_OVERFLOW; + SBG_LOG_ERROR(errorCode, "Payload of %zu bytes is too big for a valid sbgECom log", payloadSize); + } + } + else + { + // + // Notify error + // + SBG_LOG_ERROR(errorCode, "Unable to finalize frame because of an error on Stream Buffer"); + } + + return errorCode; +} diff --git a/src/protocol/sbgEComProtocol.h b/src/protocol/sbgEComProtocol.h new file mode 100644 index 0000000..f69fe4a --- /dev/null +++ b/src/protocol/sbgEComProtocol.h @@ -0,0 +1,278 @@ +/*! + * \file sbgEComProtocol.h + * \author SBG Systems + * \date 06 February 2013 + * + * \brief Implementation of the sbgECom binary communication protocol. + * + * You will find below, the frame definition used by Ekinox devices.
    + *
    + * + * + * + * + * + *
    Frame structure
    Fields SYNC 1 SYNC 2 CMD LEN DATA CRC ETX
    Size in bytes 1 1 2 2 (0-4086) 2 1
    Value 0xFF 0x5A ? ? ? ? 0x33
    + *
    + * Size in bytes indicates the size of the data field.
    + * The minimum frame size is 9 bytes and the maximum is 512 bytes.
    + *
    + * The CRC is calculated on the whole frame without:
    + * SYNC STX CRC and ETX fields.
    + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_PROTOCOL_H +#define SBG_ECOM_PROTOCOL_H + +// sbgCommonLib headers +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Constant definitions -// +//----------------------------------------------------------------------// + +#define SBG_ECOM_MAX_BUFFER_SIZE (4096) /*!< Maximum reception buffer size in bytes. */ +#define SBG_ECOM_MAX_PAYLOAD_SIZE (4086) /*!< Maximum payload size in bytes. */ +#define SBG_ECOM_MAX_EXTENDED_PAYLOAD_SIZE (4081) /*!< Maximum payload size in an extended frame, in bytes. */ +#define SBG_ECOM_SYNC_1 (0xFF) /*!< First synchronization char of the frame. */ +#define SBG_ECOM_SYNC_2 (0x5A) /*!< Second synchronization char of the frame. */ +#define SBG_ECOM_ETX (0x33) /*!< End of frame byte. */ + +#define SBG_ECOM_RX_TIME_OUT (450) /*!< Default time out for new frame reception. */ + +//----------------------------------------------------------------------// +//- Structure definitions -// +//----------------------------------------------------------------------// + +/*! + * Payload. + * + * This class is used to abstract whether some payload is received from a single + * or multiple frames. + */ +typedef struct _SbgEComProtocolPayload +{ + bool allocated; /*!< True if the buffer is allocated with malloc(). */ + void *pBuffer; /*!< Buffer. */ + size_t size; /*!< Buffer size, in bytes. */ +} SbgEComProtocolPayload; + +/*! + * Struct containing all protocol related data. + * + * The member variables related to large transfers are valid if and only if the large buffer is valid. + */ +typedef struct _SbgEComProtocol +{ + SbgInterface *pLinkedInterface; /*!< Associated interface used by the protocol to read/write bytes. */ + uint8_t rxBuffer[SBG_ECOM_MAX_BUFFER_SIZE]; /*!< The reception buffer. */ + size_t rxBufferSize; /*!< The current reception buffer size in bytes. */ + size_t discardSize; /*!< Number of bytes to discard on the next receive attempt. */ + uint8_t nextLargeTxId; /*!< Transfer ID of the next large send. */ + + // + // Member variables related to large transfer reception. + // + uint8_t *pLargeBuffer; /*!< Buffer for large transfers, allocated with malloc() if valid. */ + size_t largeBufferSize; /*!< Size of the large transfer buffer, in bytes. */ + uint8_t msgClass; /*!< Message class for the current large transfer. */ + uint8_t msgId; /*!< Message ID for the current large transfer. */ + uint8_t transferId; /*!< ID of the current large transfer. */ + uint16_t pageIndex; /*!< Expected page index of the next frame. */ + uint16_t nrPages; /*!< Number of pages in the current transfer. */ +} SbgEComProtocol; + +//----------------------------------------------------------------------// +//- Public methods (SbgEComProtocolPayload) -// +//----------------------------------------------------------------------// + +/*! + * Payload constructor. + * + * \param[in] pPayload Payload. + */ +void sbgEComProtocolPayloadConstruct(SbgEComProtocolPayload *pPayload); + +/*! + * Payload destructor. + * + * \param[in] pPayload Payload. + */ +void sbgEComProtocolPayloadDestroy(SbgEComProtocolPayload *pPayload); + +/*! + * Get the buffer of a payload. + * + * \param[in] pPayload Payload. + * \return Payload buffer. + */ +const void *sbgEComProtocolPayloadGetBuffer(const SbgEComProtocolPayload *pPayload); + +/*! + * Get the size of a payload buffer. + * + * \param[in] pPayload Payload. + * \return Size of the payload buffer, in bytes. + */ +size_t sbgEComProtocolPayloadGetSize(const SbgEComProtocolPayload *pPayload); + +/*! + * Move the buffer of a payload. + * + * If successful, the ownership of the buffer is passed to the caller. Otherwise, the payload + * is unchanged. + * + * The buffer must be released with free() once unused. + * + * \param[in] pPayload Payload. + * \return Payload buffer if successful, NULL otherwise. + */ +void *sbgEComProtocolPayloadMoveBuffer(SbgEComProtocolPayload *pPayload); + +//----------------------------------------------------------------------// +//- Public methods (SbgEComProtocol) -// +//----------------------------------------------------------------------// + +/*! + * Initialize the protocol system used to communicate with the product and return the created handle. + * + * \param[in] pProtocol Pointer on an allocated protocol structure to initialize. + * \param[in] pInterface Interface to use for read/write operations. + * \return SBG_NO_ERROR if we have initialised the protocol system. + */ +SbgErrorCode sbgEComProtocolInit(SbgEComProtocol *pProtocol, SbgInterface *pInterface); + +/*! + * Close the protocol system. + * + * \param[in] pProtocol A valid protocol handle to close. + * \return SBG_NO_ERROR if we have closed and released the protocol system. + */ +SbgErrorCode sbgEComProtocolClose(SbgEComProtocol *pProtocol); + +/*! + * Purge the interface rx buffer as well as the sbgECom rx work buffer. + * + * For example, if the program flow has been interrupted, this method can be helpful to discard all trash received data. + * + * WARNING: This method is blocking for 100ms and actively tries to read incoming data. + * + * \param[in] pProtocol A valid SbgEComProtocol handle. + * \return SBG_NO_ERROR if the incoming data has been purged successfully. + */ +SbgErrorCode sbgEComProtocolPurgeIncoming(SbgEComProtocol *pProtocol); + +/*! + * Send data. + * + * If the size is SBG_ECOM_MAX_PAYLOAD_SIZE or less, the data is sent in a single frame. Otherwise, + * is it fragmented into multiple extended frames, each sent in order, which may block. + * + * \param[in] pProtocol A valid protocol handle. + * \param[in] msgClass Message class. + * \param[in] msg Message ID. + * \param[in] pData Data buffer. + * \param[in] size Data buffer size, in bytes. + * \return SBG_NO_ERROR if the frame has been sent. + */ +SbgErrorCode sbgEComProtocolSend(SbgEComProtocol *pProtocol, uint8_t msgClass, uint8_t msg, const void *pData, size_t size); + +/*! + * Receive a frame. + * + * \param[in] pProtocol A valid protocol handle. + * \param[out] pMsgClass Message class, may be NULL. + * \param[out] pMsgId Message ID, may be NULL. + * \param[out] pData Data buffer. + * \param[out] pSize Number of bytes received. + * \param[in] maxSize Data buffer size, in bytes. + * \return SBG_NO_ERROR if successful, + * SBG_NOT_READY if no complete frame has been received, + * SBG_BUFFER_OVERFLOW if the payload of the received frame couldn't fit into the data buffer. + */ +SbgErrorCode sbgEComProtocolReceive(SbgEComProtocol *pProtocol, uint8_t *pMsgClass, uint8_t *pMsgId, void *pData, size_t *pSize, size_t maxSize); + +/*! + * Receive a frame. + * + * This function is equivalent to sbgEComProtocolReceive() with two exceptions : + * - the use of a payload object allows handling payloads not limited by the size of a user-provided buffer + * - the payload object allows direct access to the protocol work buffer to avoid an extra copy per call + * + * Any allocated resource associated with the given payload is released when calling this function. + * + * Because the payload buffer may directly refer to the protocol work buffer on return, it is only valid until + * the next attempt to receive a frame, with any of the receive functions. + * + * \param[in] pProtocol A valid protocol handle. + * \param[out] pMsgClass Message class, may be NULL. + * \param[out] pMsgId Message ID, may be NULL. + * \param[out] pPayload Payload. + * \return SBG_NO_ERROR if successful, + * SBG_NOT_READY if no complete frame has been received. + */ +SbgErrorCode sbgEComProtocolReceive2(SbgEComProtocol *pProtocol, uint8_t *pMsgClass, uint8_t *pMsgId, SbgEComProtocolPayload *pPayload); + +/*! + * Initialize an output stream for an sbgECom frame generation. + * + * This function is helpful to avoid memory copy compared to sbgEComProtocolSend one. + * + * Only standard frames may be sent with this function. + * + * \param[in] pOutputStream Pointer to an allocated and initialized output stream. + * \param[in] msgClass Message class. + * \param[in] msg Message ID. + * \param[out] pStreamCursor The initial output stream cursor that thus points to the begining of the generated message. + * This value should be passed to sbgEComFinalizeFrameGeneration for correct operations. + * \return SBG_NO_ERROR in case of good operation. + */ +SbgErrorCode sbgEComStartFrameGeneration(SbgStreamBuffer *pOutputStream, uint8_t msgClass, uint8_t msg, size_t *pStreamCursor); + +/*! + * Finalize an output stream that has been initialized with sbgEComStartFrameGeneration. + * + * At return, the output stream buffer should point at the end of the generated message. + * You can thus easily create consecutive SBG_ECOM_LOGS with these methods. + * + * \param[in] pOutputStream Pointer to an allocated and initialized output stream. + * \param[in] streamCursor Position in the stream buffer of the generated message first byte. + * This value is returned by sbgEComStartFrameGeneration and is mandatory for correct operations. + * \return SBG_NO_ERROR in case of good operation. + */ +SbgErrorCode sbgEComFinalizeFrameGeneration(SbgStreamBuffer *pOutputStream, size_t streamCursor); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_PROTOCOL_H diff --git a/src/sbgECanId.h b/src/sbgECanId.h new file mode 100644 index 0000000..0933702 --- /dev/null +++ b/src/sbgECanId.h @@ -0,0 +1,161 @@ +/*! + * \file sbgECanId.h + * \author SBG Systems + * \date 10 October 2014 + * + * \brief Defines all sbgECom commands identifiers. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECAN_ID_H +#define SBG_ECAN_ID_H + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Definition of all messages id for sbgECan -// +//----------------------------------------------------------------------// + +/*! + * Enum containing the list of messages that can be output on the can interface. + */ +typedef enum _SbgECanMessageId +{ + // + // Output Messages + // + SBG_ECAN_MSG_STATUS_01 = 0x100, + SBG_ECAN_MSG_STATUS_02 = 0x101, + SBG_ECAN_MSG_STATUS_03 = 0x102, + + SBG_ECAN_MSG_UTC_0 = 0x110, + SBG_ECAN_MSG_UTC_1 = 0x111, + + SBG_ECAN_MSG_IMU_INFO = 0x120, + SBG_ECAN_MSG_IMU_ACCEL = 0x121, + SBG_ECAN_MSG_IMU_GYRO = 0x122, + SBG_ECAN_MSG_IMU_DELTA_VEL = 0x123, + SBG_ECAN_MSG_IMU_DELTA_ANGLE = 0x124, + + SBG_ECAN_MSG_EKF_INFO = 0x130, + SBG_ECAN_MSG_EKF_QUAT = 0x131, + SBG_ECAN_MSG_EKF_EULER = 0x132, + SBG_ECAN_MSG_EKF_ORIENTATION_ACC = 0x133, + SBG_ECAN_MSG_EKF_POS = 0x134, + SBG_ECAN_MSG_EKF_ALTITUDE = 0x135, + SBG_ECAN_MSG_EKF_POS_ACC = 0x136, + SBG_ECAN_MSG_EKF_VEL_NED = 0x137, + SBG_ECAN_MSG_EKF_VEL_NED_ACC = 0x138, + SBG_ECAN_MSG_EKF_VEL_BODY = 0x139, + + SBG_ECAN_MSG_SHIP_MOTION_INFO = 0x140, + SBG_ECAN_MSG_SHIP_MOTION_0 = 0x141, + SBG_ECAN_MSG_SHIP_MOTION_1 = 0x145, + SBG_ECAN_MSG_SHIP_MOTION_2 = 0x149, + + SBG_ECAN_MSG_SHIP_MOTION_HP_INFO = 0x14A, /*!< Only for Ekinox, Apogee, Navsight & Quanta */ + SBG_ECAN_MSG_SHIP_MOTION_HP_0 = 0x14B, /*!< Only for Ekinox, Apogee, Navsight & Quanta */ + SBG_ECAN_MSG_SHIP_MOTION_HP_1 = 0x14C, /*!< Only for Ekinox, Apogee, Navsight & Quanta */ + SBG_ECAN_MSG_SHIP_MOTION_HP_2 = 0x14D, /*!< Only for Ekinox, Apogee, Navsight & Quanta */ + + SBG_ECAN_MSG_MAG_0 = 0x150, + SBG_ECAN_MSG_MAG_1 = 0x151, + SBG_ECAN_MSG_MAG_2 = 0x152, + + SBG_ECAN_MSG_ODO_INFO = 0x160, + SBG_ECAN_MSG_ODO_VEL = 0x161, + + SBG_ECAN_MSG_AIR_DATA_INFO = 0x162, + SBG_ECAN_MSG_AIR_DATA_ALTITUDE = 0x163, + SBG_ECAN_MSG_AIR_DATA_AIRSPEED = 0x164, + + SBG_ECAN_MSG_DEPTH_INFO = 0x166, + SBG_ECAN_MSG_DEPTH_ALTITUDE = 0x167, + + SBG_ECAN_MSG_GPS1_VEL_INFO = 0x170, + SBG_ECAN_MSG_GPS1_VEL = 0x171, + SBG_ECAN_MSG_GPS1_VEL_ACC = 0x172, + SBG_ECAN_MSG_GPS1_VEL_COURSE = 0x173, + SBG_ECAN_MSG_GPS1_POS_INFO = 0x174, + SBG_ECAN_MSG_GPS1_POS = 0x175, + SBG_ECAN_MSG_GPS1_POS_ALT = 0x176, + SBG_ECAN_MSG_GPS1_POS_ACC = 0x177, + SBG_ECAN_MSG_GPS1_HDT_INFO = 0x178, + SBG_ECAN_MSG_GPS1_HDT = 0x179, + + SBG_ECAN_MSG_GPS2_VEL_INFO = 0x180, /*!< Only for Ekinox, Apogee, Navsight & Quanta */ + SBG_ECAN_MSG_GPS2_VEL = 0x181, /*!< Only for Ekinox, Apogee, Navsight & Quanta */ + SBG_ECAN_MSG_GPS2_VEL_ACC = 0x182, /*!< Only for Ekinox, Apogee, Navsight & Quanta */ + SBG_ECAN_MSG_GPS2_VEL_COURSE = 0x183, /*!< Only for Ekinox, Apogee, Navsight & Quanta */ + SBG_ECAN_MSG_GPS2_POS_INFO = 0x184, /*!< Only for Ekinox, Apogee, Navsight & Quanta */ + SBG_ECAN_MSG_GPS2_POS = 0x185, /*!< Only for Ekinox, Apogee, Navsight & Quanta */ + SBG_ECAN_MSG_GPS2_POS_ALT = 0x186, /*!< Only for Ekinox, Apogee, Navsight & Quanta */ + SBG_ECAN_MSG_GPS2_POS_ACC = 0x187, /*!< Only for Ekinox, Apogee, Navsight & Quanta */ + SBG_ECAN_MSG_GPS2_HDT_INFO = 0x188, /*!< Only for Ekinox, Apogee, Navsight & Quanta */ + SBG_ECAN_MSG_GPS2_HDT = 0x189, /*!< Only for Ekinox, Apogee, Navsight & Quanta */ + + SBG_ECAN_MSG_EVENT_INFO_A = 0x200, + SBG_ECAN_MSG_EVENT_TIME_A = 0x201, + SBG_ECAN_MSG_EVENT_INFO_B = 0x202, + SBG_ECAN_MSG_EVENT_TIME_B = 0x203, + SBG_ECAN_MSG_EVENT_INFO_C = 0x204, + SBG_ECAN_MSG_EVENT_TIME_C = 0x205, + SBG_ECAN_MSG_EVENT_INFO_D = 0x206, + SBG_ECAN_MSG_EVENT_TIME_D = 0x207, + SBG_ECAN_MSG_EVENT_INFO_E = 0x208, /*!< Only for Ekinox, Apogee, Navsight & Quanta */ + SBG_ECAN_MSG_EVENT_TIME_E = 0x209, /*!< Only for Ekinox, Apogee, Navsight & Quanta */ + + // + // Proprietary CASS logs + // + SBG_ECAN_MSG_CASS_DATINF = 0x210, + SBG_ECAN_MSG_CASS_ACCS = 0x211, + SBG_ECAN_MSG_CASS_OMGS = 0x212, + SBG_ECAN_MSG_CASS_NRPY = 0x213, + SBG_ECAN_MSG_CASS_VEL = 0x214, + SBG_ECAN_MSG_CASS_TIME = 0x215, + SBG_ECAN_MSG_CASS_GPS_INF = 0x216, + SBG_ECAN_MSG_CASS_GPS_COG = 0x217, + SBG_ECAN_MSG_CASS_ADDINF = 0x218, + SBG_ECAN_MSG_CASS_POS1 = 0x219, + SBG_ECAN_MSG_CASS_POS2 = 0x21A, + SBG_ECAN_MSG_CASS_SAT_INF = 0x21B, + SBG_ECAN_MSG_CASS_IACCS = 0x21C, + SBG_ECAN_MSG_CASS_IOMG = 0x21D, + SBG_ECAN_MSG_CASS_RR = 0x21E, + + // + // Automotive specific CAN output + // + SBG_ECAN_MSG_AUTO_TRACK_SLIP_CURV = 0x220, +} SbgECanMessageId; + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECAN_ID_H diff --git a/src/sbgECom.c b/src/sbgECom.c new file mode 100644 index 0000000..85a3b10 --- /dev/null +++ b/src/sbgECom.c @@ -0,0 +1,251 @@ +#include "sbgECom.h" +#include +#include "commands/sbgEComCmdCommon.h" + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComInit(SbgEComHandle *pHandle, SbgInterface *pInterface) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + + assert(pHandle); + assert(pInterface); + + // + // Initialize the sbgECom handle + // + pHandle->pReceiveLogCallback = NULL; + pHandle->pUserArg = NULL; + + // + // Initialize the default number of trials and time out + // + pHandle->numTrials = 3; + pHandle->cmdDefaultTimeOut = SBG_ECOM_DEFAULT_CMD_TIME_OUT; + + // + // Initialize the protocol + // + errorCode = sbgEComProtocolInit(&pHandle->protocolHandle, pInterface); + + return errorCode; +} + +SbgErrorCode sbgEComClose(SbgEComHandle *pHandle) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + + assert(pHandle); + + // + // Close the protocol + // + errorCode = sbgEComProtocolClose(&pHandle->protocolHandle); + + return errorCode; +} + +SbgErrorCode sbgEComHandleOneLog(SbgEComHandle *pHandle) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgBinaryLogData logData; + uint8_t receivedMsg; + uint8_t receivedMsgClass; + size_t payloadSize; + uint8_t payloadData[SBG_ECOM_MAX_PAYLOAD_SIZE]; + + assert(pHandle); + + // + // Try to read a received frame + // + errorCode = sbgEComProtocolReceive(&pHandle->protocolHandle, &receivedMsgClass, &receivedMsg, payloadData, &payloadSize, sizeof(payloadData)); + + // + // Test if we have received a valid frame + // + if (errorCode == SBG_NO_ERROR) + { + // + // Test if the received frame is a binary log + // + if (sbgEComMsgClassIsALog((SbgEComClass)receivedMsgClass)) + { + // + // The received frame is a binary log one + // + errorCode = sbgEComBinaryLogParse((SbgEComClass)receivedMsgClass, (SbgEComMsgId)receivedMsg, payloadData, payloadSize, &logData); + + // + // Test if the incoming log has been parsed successfully + // + if (errorCode == SBG_NO_ERROR) + { + // + // Test if we have a valid callback to handle received logs + // + if (pHandle->pReceiveLogCallback) + { + // + // Call the binary log callback using the new method + // + errorCode = pHandle->pReceiveLogCallback(pHandle, (SbgEComClass)receivedMsgClass, receivedMsg, &logData, pHandle->pUserArg); + } + } + else + { + // + // Call the on error callback + // + } + } + else + { + // + // We have received a command, it shouldn't happen + // + } + } + else if (errorCode != SBG_NOT_READY) + { + // + // We have received an invalid frame + // + SBG_LOG_WARNING(errorCode, "Invalid frame received"); + } + + return errorCode; +} + +SbgErrorCode sbgEComHandle(SbgEComHandle *pHandle) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + + assert(pHandle); + + // + // Try to read all received frames, we thus loop until we get an SBG_NOT_READY error + // + do + { + // + // Try to read and parse one frame + // + errorCode = sbgEComHandleOneLog(pHandle); + } while (errorCode != SBG_NOT_READY); + + return errorCode; +} + +SbgErrorCode sbgEComPurgeIncoming(SbgEComHandle *pHandle) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + + assert(pHandle); + + errorCode = sbgEComProtocolPurgeIncoming(&pHandle->protocolHandle); + + return errorCode; +} + +void sbgEComSetReceiveLogCallback(SbgEComHandle *pHandle, SbgEComReceiveLogFunc pReceiveLogCallback, void *pUserArg) +{ + assert(pHandle); + + // + // Define the callback and the user argument + // + pHandle->pReceiveLogCallback = pReceiveLogCallback; + pHandle->pUserArg = pUserArg; +} + +void sbgEComSetCmdTrialsAndTimeOut(SbgEComHandle *pHandle, uint32_t numTrials, uint32_t cmdDefaultTimeOut) +{ + assert(pHandle); + assert(numTrials > 0); + assert(cmdDefaultTimeOut > 0); + + // + // Define the new settings + // + pHandle->numTrials = numTrials; + pHandle->cmdDefaultTimeOut = cmdDefaultTimeOut; +} + +void sbgEComErrorToString(SbgErrorCode errorCode, char errorMsg[256]) +{ + if (errorMsg) + { + // + // For each error code, copy the error msg + // + switch (errorCode) + { + case SBG_NO_ERROR: + strcpy(errorMsg, "SBG_NO_ERROR: No error."); + break; + case SBG_ERROR: + strcpy(errorMsg, "SBG_ERROR: Generic error."); + break; + case SBG_NULL_POINTER: + strcpy(errorMsg, "SBG_NULL_POINTER: A pointer is null."); + break; + case SBG_INVALID_CRC: + strcpy(errorMsg, "SBG_INVALID_CRC: The received frame has an invalid CRC."); + break; + case SBG_INVALID_FRAME: + strcpy(errorMsg, "SBG_INVALID_FRAME: The received frame is invalid."); + break; + case SBG_TIME_OUT: + strcpy(errorMsg, "SBG_TIME_OUT: We have a time out during frame reception."); + break; + case SBG_WRITE_ERROR: + strcpy(errorMsg, "SBG_WRITE_ERROR: All bytes hasn't been written."); + break; + case SBG_READ_ERROR: + strcpy(errorMsg, "SBG_READ_ERROR: All bytes hasn't been read."); + break; + case SBG_BUFFER_OVERFLOW: + strcpy(errorMsg, "SBG_BUFFER_OVERFLOW: A buffer is too small to contain so much data."); + break; + case SBG_INVALID_PARAMETER: + strcpy(errorMsg, "SBG_INVALID_PARAMETER: An invalid parameter has been founded."); + break; + case SBG_NOT_READY: + strcpy(errorMsg, "SBG_NOT_READY: A device isn't ready (Rx isn't ready for example)."); + break; + case SBG_MALLOC_FAILED: + strcpy(errorMsg, "SBG_MALLOC_FAILED: Failed to allocate a buffer."); + break; + case SGB_CALIB_MAG_NOT_ENOUGH_POINTS: + strcpy(errorMsg, "SGB_CALIB_MAG_NOT_ENOUGH_POINTS: Not enough points were available to perform magnetometers calibration."); + break; + case SBG_CALIB_MAG_INVALID_TAKE: + strcpy(errorMsg, "SBG_CALIB_MAG_INVALID_TAKE: The calibration procedure could not be properly executed due to insufficient precision."); + break; + case SBG_CALIB_MAG_SATURATION: + strcpy(errorMsg, "SBG_CALIB_MAG_SATURATION: Saturation were detected when attempt to calibrate magnetos."); + break; + case SBG_CALIB_MAG_POINTS_NOT_IN_A_PLANE: + strcpy(errorMsg, "SBG_CALIB_MAG_POINTS_NOT_IN_A_PLANE: 2D calibration procedure could not be performed."); + break; + case SBG_DEVICE_NOT_FOUND: + strcpy(errorMsg, "SBG_DEVICE_NOT_FOUND: A device couldn't be founded or opened."); + break; + case SBG_OPERATION_CANCELLED: + strcpy(errorMsg, "SBG_OPERATION_CANCELLED: An operation has been cancelled by a user."); + break; + case SBG_NOT_CONTINUOUS_FRAME: + strcpy(errorMsg, "SBG_NOT_CONTINUOUS_FRAME: We have received a frame that isn't a continuous one."); + break; + case SBG_INCOMPATIBLE_HARDWARE: + strcpy(errorMsg, "SBG_INCOMPATIBLE_HARDWARE: Hence valid, the configuration cannot be executed because of incompatible hardware."); + break; + default: + sprintf(errorMsg, "Undefined error code: %u", errorCode); + break; + } + } +} diff --git a/src/sbgECom.h b/src/sbgECom.h new file mode 100644 index 0000000..a38554d --- /dev/null +++ b/src/sbgECom.h @@ -0,0 +1,171 @@ +/*! + * \file sbgECom.h + * \author SBG Systems + * \date 05 February 2013 + * + * \brief Contains main sbgECom methods. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_H +#define SBG_ECOM_H + +#ifdef __cplusplus +extern "C" { +#endif + +// sbgCommonLib headers +#include + +// Local headers +#include "sbgECanId.h" +#include "sbgEComIds.h" +#include "protocol/sbgEComProtocol.h" +#include "binaryLogs/sbgEComBinaryLogs.h" + +//----------------------------------------------------------------------// +//- Predefinitions -// +//----------------------------------------------------------------------// + +/*! + * Interface structure pre-definition. + */ +typedef struct _SbgEComHandle SbgEComHandle; + +//----------------------------------------------------------------------// +//- Callbacks definitions -// +//----------------------------------------------------------------------// + +/*! + * Callback definition called each time a new log is received. + * + * \param[in] pHandle Valid handle on the sbgECom instance that has called this callback. + * \param[in] msgClass Class of the message we have received + * \param[in] msg Message ID of the log received. + * \param[in] pLogData Contains the received log data as an union. + * \param[in] pUserArg Optional user supplied argument. + * \return SBG_NO_ERROR if the received log has been used successfully. + */ +typedef SbgErrorCode (*SbgEComReceiveLogFunc)(SbgEComHandle *pHandle, SbgEComClass msgClass, SbgEComMsgId msg, const SbgBinaryLogData *pLogData, void *pUserArg); + +//----------------------------------------------------------------------// +//- Structures definitions -// +//----------------------------------------------------------------------// + +/*! + * Interface definition that stores methods used to communicate on the interface. + */ +struct _SbgEComHandle +{ + SbgEComProtocol protocolHandle; /*!< Handle on the protocol system. */ + + SbgEComReceiveLogFunc pReceiveLogCallback; /*!< Pointer on the method called each time a new binary log is received. */ + void *pUserArg; /*!< Optional user supplied argument for callbacks. */ + + uint32_t numTrials; /*!< Number of trials when a command is sent (default is 3). */ + uint32_t cmdDefaultTimeOut; /*!< Default time out in ms to get an answer from the device (default 500 ms). */ +}; + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Initialize the protocol system used to communicate with the product and return the created handle. + * + * \param[out] pHandle Pointer used to store the allocated and initialized sbgECom handle. + * \param[in] pInterface Interface to use for read/write operations. + * \return SBG_NO_ERROR if we have initialized the protocol system. + */ +SbgErrorCode sbgEComInit(SbgEComHandle *pHandle, SbgInterface *pInterface); + +/*! + * Close the protocol system and release associated memory. + * + * \param[in] pHandle A valid sbgECom handle to close. + * \return SBG_NO_ERROR if we have closed and released the sbgECom system. + */ +SbgErrorCode sbgEComClose(SbgEComHandle *pHandle); + +/*! + * Try to parse one log from the input interface and then return. + * + * \param[in] pHandle A valid sbgECom handle. + * \return SBG_NO_ERROR if no error occurs during incoming log parsing. + */ +SbgErrorCode sbgEComHandleOneLog(SbgEComHandle *pHandle); + +/*! + * Handle all incoming logs until no more log are available in the input interface. + * + * \param[in] pHandle A valid sbgECom handle. + * \return SBG_NO_ERROR if no error occurs during incoming logs parsing. + */ +SbgErrorCode sbgEComHandle(SbgEComHandle *pHandle); + +/*! + * Purge the interface rx buffer as well as the sbgECom rx work buffer. + * + * For example, if the program flow has been interrupted, this method can be helpful to discard all trash received data. + * + * WARNING: This method is blocking for 100ms and actively tries to read incoming data. + * + * \param[in] pHandle A valid sbgECom handle. + * \return SBG_NO_ERROR if the incoming data has been purged successfully. + */ +SbgErrorCode sbgEComPurgeIncoming(SbgEComHandle *pHandle); + +/*! + * Define the callback that should be called each time a new binary log is received. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] pReceiveLogCallback Pointer on the callback to call when a new log is received. + * \param[in] pUserArg Optional user argument that will be passed to the callback method. + */ +void sbgEComSetReceiveLogCallback(SbgEComHandle *pHandle, SbgEComReceiveLogFunc pReceiveLogCallback, void *pUserArg); + +/*! + * Define the default number of trials that should be done when a command is send to the device as well as the time out. + * + * \param[in] pHandle A valid sbgECom handle. + * \param[in] numTrials Number of trials when a command is sent (starting at 1). + * \param[in] cmdDefaultTimeOut Default time out in milliseconds to wait to receive an answer from the device. + */ +void sbgEComSetCmdTrialsAndTimeOut(SbgEComHandle *pHandle, uint32_t numTrials, uint32_t cmdDefaultTimeOut); + +/*! + * Convert an error code into a human readable string. + * + * \param[in] errorCode The errorCode to convert into a string. + * \param[out] errorMsg String buffer used to hold the error string. + */ +void sbgEComErrorToString(SbgErrorCode errorCode, char errorMsg[256]); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_H + diff --git a/src/sbgEComGetVersion.c b/src/sbgEComGetVersion.c new file mode 100644 index 0000000..8c2f207 --- /dev/null +++ b/src/sbgEComGetVersion.c @@ -0,0 +1,23 @@ +// sbgCommonLib headers +#include +#include + +// Project headers +#include "sbgEComVersion.h" + +// Local headers +#include "sbgEComGetVersion.h" + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +uint32_t sbgEComGetVersion(void) +{ + return SBG_E_COM_VERSION; +} + +const char *sbgEComGetVersionAsString(void) +{ + return SBG_E_COM_VERSION_STR; +} diff --git a/src/sbgEComGetVersion.h b/src/sbgEComGetVersion.h new file mode 100644 index 0000000..8874502 --- /dev/null +++ b/src/sbgEComGetVersion.h @@ -0,0 +1,63 @@ +/*! + * \file sbgEComGetVersion.h + * \author SBG Systems + * \date 05 February 2013 + * \brief Version information. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_GET_VERSION_H +#define SBG_ECOM_GET_VERSION_H + +// sbgCommonLib headers +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Returns an integer representing the version of the sbgECom library. + * + * \return An integer representing the version of the sbgECom library.
    + */ +uint32_t sbgEComGetVersion(void); + +/*! + * Retrieve the sbgECom library version as a string (1.0.443-stable). + * + * \return Null terminated string that contains the sbgECom library version. + */ +const char *sbgEComGetVersionAsString(void); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_GET_VERSION_H diff --git a/src/sbgEComIds.h b/src/sbgEComIds.h new file mode 100644 index 0000000..526fe28 --- /dev/null +++ b/src/sbgEComIds.h @@ -0,0 +1,334 @@ +/*! + * \file sbgEComIds.h + * \author SBG Systems + * \date 25 February 2013 + * + * \brief Defines all sbgECom commands identifiers. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_IDS_H +#define SBG_ECOM_IDS_H + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Definition of all class id for sbgECom -// +//----------------------------------------------------------------------// + +/*! + * Enum that defines all the message classes available. + * + * Keep in mind that message classes are encoded on 7 bits. + */ +typedef enum _SbgEComClass +{ + SBG_ECOM_CLASS_LOG_ECOM_0 = 0x00, /*!< Class that contains sbgECom protocol input/output log messages. */ + + SBG_ECOM_CLASS_LOG_ECOM_1 = 0x01, /*!< Class that contains special sbgECom output messages that handle high frequency output. */ + + SBG_ECOM_CLASS_LOG_NMEA_0 = 0x02, /*!< Class that contains NMEA (and NMEA like) output logs.
    + Note: This class is only used for identification purpose and does not contain any sbgECom message. */ + SBG_ECOM_CLASS_LOG_NMEA_1 = 0x03, /*!< Class that contains proprietary NMEA (and NMEA like) output logs.
    + Note: This class is only used for identification purpose and does not contain any sbgECom message. */ + SBG_ECOM_CLASS_LOG_THIRD_PARTY_0 = 0x04, /*!< Class that contains third party output logs. + Note: This class is only used for identification purpose and does not contain any sbgECom message. */ + + SBG_ECOM_CLASS_LOG_CMD_0 = 0x10, /*!< Class that contains sbgECom protocol commands. */ + +} SbgEComClass; + +//----------------------------------------------------------------------// +//- Definition of all messages id for sbgECom -// +//----------------------------------------------------------------------// + +/*! + * Enum that defines all the available ECom output logs from the sbgECom library. + */ +typedef enum _SbgEComLog +{ + SBG_ECOM_LOG_STATUS = 1, /*!< Status general, clock, com aiding, solution, heave */ + + SBG_ECOM_LOG_UTC_TIME = 2, /*!< Provides UTC time reference */ + + SBG_ECOM_LOG_IMU_DATA = 3, /*!< Includes IMU status, acc., gyro, temp delta speeds and delta angles values */ + + SBG_ECOM_LOG_MAG = 4, /*!< Magnetic data with associated accelerometer on each axis */ + SBG_ECOM_LOG_MAG_CALIB = 5, /*!< Magnetometer calibration data (raw buffer) */ + + SBG_ECOM_LOG_EKF_EULER = 6, /*!< Includes roll, pitch, yaw and their accuracies on each axis */ + SBG_ECOM_LOG_EKF_QUAT = 7, /*!< Includes the 4 quaternions values */ + SBG_ECOM_LOG_EKF_NAV = 8, /*!< Position and velocities in NED coordinates with the accuracies on each axis */ + + SBG_ECOM_LOG_SHIP_MOTION = 9, /*!< Heave, surge and sway and accelerations on each axis. */ + + SBG_ECOM_LOG_GPS1_VEL = 13, /*!< GPS velocities from primary or secondary GPS receiver */ + SBG_ECOM_LOG_GPS1_POS = 14, /*!< GPS positions from primary or secondary GPS receiver */ + SBG_ECOM_LOG_GPS1_HDT = 15, /*!< GPS true heading from dual antenna system */ + SBG_ECOM_LOG_GPS1_RAW = 31, /*!< GPS 1 raw data for post processing. */ + + SBG_ECOM_LOG_GPS2_VEL = 16, /*!< GPS 2 velocity log data. */ + SBG_ECOM_LOG_GPS2_POS = 17, /*!< GPS 2 position log data. */ + SBG_ECOM_LOG_GPS2_HDT = 18, /*!< GPS 2 true heading log data. */ + SBG_ECOM_LOG_GPS2_RAW = 38, /*!< GPS 2 raw data for post processing. */ + + SBG_ECOM_LOG_ODO_VEL = 19, /*!< Provides odometer velocity */ + + SBG_ECOM_LOG_EVENT_A = 24, /*!< Event markers sent when events are detected on sync in A pin */ + SBG_ECOM_LOG_EVENT_B = 25, /*!< Event markers sent when events are detected on sync in B pin */ + SBG_ECOM_LOG_EVENT_C = 26, /*!< Event markers sent when events are detected on sync in C pin */ + SBG_ECOM_LOG_EVENT_D = 27, /*!< Event markers sent when events are detected on sync in D pin */ + SBG_ECOM_LOG_EVENT_E = 28, /*!< Event markers sent when events are detected on sync in E pin */ + + SBG_ECOM_LOG_DVL_BOTTOM_TRACK = 29, /*!< Doppler Velocity Log for bottom tracking data. */ + SBG_ECOM_LOG_DVL_WATER_TRACK = 30, /*!< Doppler Velocity log for water layer data. */ + + SBG_ECOM_LOG_SHIP_MOTION_HP = 32, /*!< Return delayed ship motion such as surge, sway, heave. */ + + SBG_ECOM_LOG_AIR_DATA = 36, /*!< Air Data aiding such as barometric altimeter and true air speed. */ + + SBG_ECOM_LOG_USBL = 37, /*!< Raw USBL position data for subsea navigation. */ + + + SBG_ECOM_LOG_IMU_SHORT = 44, /*!< Short IMU message recommended for post processing usages. */ + + SBG_ECOM_LOG_EVENT_OUT_A = 45, /*!< Event marker used to time stamp each generated Sync Out A signal. */ + SBG_ECOM_LOG_EVENT_OUT_B = 46, /*!< Event marker used to time stamp each generated Sync Out B signal. */ + + SBG_ECOM_LOG_DEPTH = 47, /*!< Depth sensor measurement log used for subsea navigation. */ + SBG_ECOM_LOG_DIAG = 48, /*!< Diagnostic log. */ + + SBG_ECOM_LOG_RTCM_RAW = 49, /*!< RTCM raw data. */ + + SBG_ECOM_LOG_ECOM_NUM_MESSAGES /*!< Helper definition to know the number of ECom messages */ +} SbgEComLog; + +/*! + * Enum that defines all the available ECom output logs in the class SBG_ECOM_CLASS_LOG_ECOM_1 + */ +typedef enum _SbgEComLog1MsgId +{ + SBG_ECOM_LOG_FAST_IMU_DATA = 0, /*!< Provides accelerometers, gyroscopes, time and status at 1KHz rate. */ + SBG_ECOM_LOG_ECOM_1_NUM_MESSAGES /*!< Helper definition to know the number of ECom messages */ +} SbgEComLog1; + +/*! + * Enum that defines all the available Nmea output logs from the sbgECom library. + */ +typedef enum _SbgEComNmeaLog +{ + SBG_ECOM_LOG_NMEA_GGA = 0, /*!< Latitude, Longitude, Altitude, Quality indicator. */ + SBG_ECOM_LOG_NMEA_RMC = 1, /*!< Latitude, Longitude, velocity, course over ground. */ + SBG_ECOM_LOG_NMEA_ZDA = 2, /*!< UTC Time. */ + SBG_ECOM_LOG_NMEA_HDT = 3, /*!< Heading (True). */ + SBG_ECOM_LOG_NMEA_GST = 4, /*!< GPS Pseudorange Noise Statistics. */ + SBG_ECOM_LOG_NMEA_VBW = 5, /*!< Water referenced and ground referenced speed data. */ + SBG_ECOM_LOG_NMEA_DPT = 7, /*!< Depth sensor output. */ + SBG_ECOM_LOG_NMEA_VTG = 8, /*!< Track an Speed over the ground. */ + SBG_ECOM_LOG_NMEA_NUM_MESSAGES /*!< Helper definition to know the number of NMEA messages */ +} SbgEComNmeaLog; + +/*! + * Enum that defines all the available Proprietary Nmea output logs from the sbgECom library. + */ +typedef enum _SbgEComIdNmea1Log +{ + SBG_ECOM_LOG_NMEA_1_PRDID = 0, /*!< RDI proprietary sentence. Pitch, Roll, Heading */ + SBG_ECOM_LOG_NMEA_1_PSBGI = 1, /*!< SBG Systems proprietary sentence. Rotation rates, accelerations. */ + SBG_ECOM_LOG_NMEA_1_PASHR = 2, /*!< Proprietary sentence. Roll, Pitch, Heading, Heave. */ + SBG_ECOM_LOG_NMEA_1_PSBGB = 3, /*!< SBG Systems proprietary sentence. Attitude, heading, heave, angular rates, velocity. */ + + SBG_ECOM_LOG_NMEA_1_PHINF = 5, /*!< Ixblue NMEA like log used to output Status information. */ + SBG_ECOM_LOG_NMEA_1_PHTRO = 6, /*!< Ixblue NMEA like log used to output Roll and Pitch. */ + SBG_ECOM_LOG_NMEA_1_PHLIN = 7, /*!< Ixblue NMEA like log used to output Surge, Sway and Heave. */ + SBG_ECOM_LOG_NMEA_1_PHOCT = 8, /*!< Ixblue NMEA like log used to output attitude and ship motion. */ + SBG_ECOM_LOG_NMEA_1_INDYN = 9, /*!< Ixblue NMEA like log used to output position, heading, attitude, attitude rate and speed. */ + + SBG_ECOM_LOG_NMEA_1_GGK = 10, /*!< Trimble NMEA like log with Time, Latitude, Longitude, Ellipsoidal height */ + SBG_ECOM_LOG_NMEA_1_PPS = 11, /*!< Trimble (Applanix) NMEA like log with UTC and PPS information. */ + + SBG_ECOM_LOG_NMEA_1_WASSP = 12, /*!< WASSP NMEA like log similar to PASHR one. */ + + SBG_ECOM_LOG_NMEA_1_NUM_MESSAGES /*!< Helper definition to know the number of NMEA messages */ +} SbgEComIdNmea1Log; + +/*! + * Enum that defines all the available Proprietary output logs from the sbgECom library. + */ +typedef enum _SbgEComIdThirdParty +{ + SBG_ECOM_THIRD_PARTY_TSS1 = 0, /*!< Roll, Pitch, Heave, heave accelerations */ + SBG_ECOM_THIRD_PARTY_KVH = 1, /*!< Roll, Pitch, Yaw */ + + SBG_ECOM_THIRD_PARTY_PD0 = 2, /*!< Teledyne PD0 DVL proprietary frame. */ + SBG_ECOM_THIRD_PARTY_SIMRAD_1000 = 3, /*!< Konsberg SimRad 1000 proprietary frame that outputs Roll, Pitch and Heading. */ + SBG_ECOM_THIRD_PARTY_SIMRAD_3000 = 4, /*!< Konsberg SimRad 3000 proprietary frame that outputs Roll, Pitch and Heading. */ + + SBG_ECOM_THIRD_PARTY_SEAPATH_B26 = 5, /*!< Konsberg Seapth Binary Log 26 used for MBES FM mode. */ + SBG_ECOM_THIRD_PARTY_DOLOG_HRP = 6, /*!< DOLOG Heading, Roll, Pitch proprietary and binary message. */ + SBG_ECOM_THIRD_PARTY_AHRS_500 = 7, /*!< Crossbow AHRS-500 Data Packet output with attitude, rate, acceleration and status. */ + SBG_ECOM_THIRD_PARTY_ADA_01 = 8, /*!< ADA specific Data Packet with IMU/INS/Status data */ + + SBG_ECOM_THIRD_PARTY_AT_ITINS = 9, /*!< Cobham Aviator UAV 200 navigation (orientation & position) data */ + + SBG_ECOM_THIRD_PARTY_KONGSBERG_MB = 10, /*!< Kongsberg multibeam binary log. */ + + SBG_ECOM_LOG_THIRD_PARTY_NUM_MESSAGES /*!< Helper definition to know the number of third party messages */ +} SbgEComIdThirdParty; + + +/*! + * Enum that defines all the available commands for the sbgECom library. + */ +typedef enum _SbgEComCmd +{ + /* Acknowledge */ + SBG_ECOM_CMD_ACK = 0, /*!< Acknowledge */ + + /* Special settings commands */ + SBG_ECOM_CMD_SETTINGS_ACTION = 1, /*!< Performs various settings actions */ + SBG_ECOM_CMD_IMPORT_SETTINGS = 2, /*!< Imports a new settings structure to the sensor */ + SBG_ECOM_CMD_EXPORT_SETTINGS = 3, /*!< Export the whole configuration from the sensor */ + + /* Device info */ + SBG_ECOM_CMD_INFO = 4, /*!< Get basic device information */ + + /* Sensor parameters */ + SBG_ECOM_CMD_INIT_PARAMETERS = 5, /*!< Initial configuration */ + SBG_ECOM_CMD_MOTION_PROFILE_ID = 7, /*!< Set/get motion profile information */ + SBG_ECOM_CMD_IMU_ALIGNMENT_LEVER_ARM = 8, /*!< Sensor alignment and lever arm on vehicle configuration */ + SBG_ECOM_CMD_AIDING_ASSIGNMENT = 9, /*!< Aiding assignments such as RTCM / GPS / Odometer configuration */ + + /* Magnetometer configuration */ + SBG_ECOM_CMD_MAGNETOMETER_MODEL_ID = 11, /*!< Set/get magnetometer error model information */ + SBG_ECOM_CMD_MAGNETOMETER_REJECT_MODE = 12, /*!< Magnetometer aiding rejection mode */ + SBG_ECOM_CMD_SET_MAG_CALIB = 13, /*!< Set magnetic soft and hard Iron calibration data */ + + /* Magnetometer on-board calibration */ + SBG_ECOM_CMD_START_MAG_CALIB = 14, /*!< Start / reset internal magnetic field logging for calibration. */ + SBG_ECOM_CMD_COMPUTE_MAG_CALIB = 15, /*!< Compute a magnetic calibration based on previously logged data. */ + + /* GNSS configuration */ + SBG_ECOM_CMD_GNSS_1_MODEL_ID = 17, /*!< Set/get GNSS model information */ + SBG_ECOM_CMD_GNSS_1_LEVER_ARM_ALIGNMENT = 18, /*!< DEPRECATED: GNSS installation configuration (lever arm, antenna alignments) */ + SBG_ECOM_CMD_GNSS_1_INSTALLATION = 46, /*!< Define or retrieve the GNSS 1 main and secondary lever arms configuration. */ + SBG_ECOM_CMD_GNSS_1_REJECT_MODES = 19, /*!< GNSS aiding rejection modes configuration. */ + + /* Odometer configuration */ + SBG_ECOM_CMD_ODO_CONF = 20, /*!< Odometer gain, direction configuration */ + SBG_ECOM_CMD_ODO_LEVER_ARM = 21, /*!< Odometer installation configuration (lever arm) */ + SBG_ECOM_CMD_ODO_REJECT_MODE = 22, /*!< Odometer aiding rejection mode configuration. */ + + /* Interfaces configuration */ + SBG_ECOM_CMD_UART_CONF = 23, /*!< UART interfaces configuration */ + SBG_ECOM_CMD_CAN_BUS_CONF = 24, /*!< CAN bus interface configuration */ + SBG_ECOM_CMD_CAN_OUTPUT_CONF = 25, /*!< CAN identifiers configuration */ + + /* Events configuration */ + SBG_ECOM_CMD_SYNC_IN_CONF = 26, /*!< Synchronization inputs configuration */ + SBG_ECOM_CMD_SYNC_OUT_CONF = 27, /*!< Synchronization outputs configuration */ + + /* Output configuration */ + SBG_ECOM_CMD_NMEA_TALKER_ID = 29, /*!< NMEA talker ID configuration */ + SBG_ECOM_CMD_OUTPUT_CONF = 30, /*!< Output configuration */ + + /* Advanced configuration */ + SBG_ECOM_CMD_ADVANCED_CONF = 32, /*!< Advanced settings configuration */ + + /* Features related commands */ + SBG_ECOM_CMD_FEATURES = 33, /*!< Retrieve device features */ + + /* Licenses related commands */ + SBG_ECOM_CMD_LICENSE_APPLY = 34, /*!< Upload and apply a new license */ + + /* Message class output switch */ + SBG_ECOM_CMD_OUTPUT_CLASS_ENABLE = 35, /*!< Enable/disable the output of an entire class */ + + /* Ethernet configuration */ + SBG_ECOM_CMD_ETHERNET_CONF = 36, /*!< Set/get Ethernet configuration such as DHCP mode and IP address. */ + SBG_ECOM_CMD_ETHERNET_INFO = 37, /*!< Return the current IP used by the device. */ + + /* Validity thresholds */ + SBG_ECOM_CMD_VALIDITY_THRESHOLDS = 38, /*!< Set/get Validity flag thresholds for position, velocity, attitude and heading */ + + /* DVL configuration */ + SBG_ECOM_CMD_DVL_MODEL_ID = 39, /*!< Set/get DVL model id to use */ + SBG_ECOM_CMD_DVL_INSTALLATION = 40, /*!< DVL installation configuration (lever arm, alignments) */ + SBG_ECOM_CMD_DVL_REJECT_MODES = 41, /*!< DVL aiding rejection modes configuration. */ + + /* AirData configuration */ + SBG_ECOM_CMD_AIRDATA_MODEL_ID = 42, /*!< Set/get AirData model id and protocol to use. */ + SBG_ECOM_CMD_AIRDATA_LEVER_ARM = 43, /*!< AirData installation configuration (lever arm, offsets) */ + SBG_ECOM_CMD_AIRDATA_REJECT_MODES = 44, /*!< AirData aiding rejection modes configuration. */ + + /* Odometer configuration (using CAN) */ + SBG_ECOM_CMD_ODO_CAN_CONF = 45, /*!< Configuration for CAN based odometer (CAN ID & DBC) */ + + /* REST API related commands */ + SBG_ECOM_CMD_API_GET = 46, /*!< Command equivalent to the HTTP GET method for a REST API. */ + SBG_ECOM_CMD_API_POST = 47, /*!< Command equivalent to the HTTP POST method for a REST API. */ + + /* Misc. */ + SBG_ECOM_LOG_ECOM_NUM_CMDS /*!< Helper definition to know the number of commands */ +} SbgEComCmd; + +/*! + * This type defines any message identifier. + * Because message identifiers enum will be different with each class id, we use a generic uint8_t rather than an enum. + */ +typedef uint8_t SbgEComMsgId; + +//----------------------------------------------------------------------// +//- Inline helpers for log IDs -// +//----------------------------------------------------------------------// + +/*! + * Test if the message class is a binary log one. + * + * \param[in] msgClass Message class. + * \return TRUE if the message class corresponds to a binary log. + */ +SBG_INLINE bool sbgEComMsgClassIsALog(SbgEComClass msgClass) +{ + // + // Test if this class id is part of the enum + // + if ((msgClass == SBG_ECOM_CLASS_LOG_ECOM_0) || (msgClass == SBG_ECOM_CLASS_LOG_ECOM_1) ) + { + return true; + } + else + { + return false; + } +} + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_IDS_H diff --git a/src/sbgEComLib.h b/src/sbgEComLib.h new file mode 100644 index 0000000..1080ad7 --- /dev/null +++ b/src/sbgEComLib.h @@ -0,0 +1,75 @@ +/*! + * \file sbgEComLib.h + * \author SBG Systems + * \date 05 February 2013 + * + * \brief Main header file for the SBG Systems Enhanced Communication Library. + * + * Only this main header file should be included to use the library. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +/*! + * \mainpage SBG Systems Enhanced Communication library documentation + * Welcome to the sbgECom library documentation.
    + * This documentation describes all functions implemented in the sbgECom library. + */ + +#ifndef SBG_ECOM_LIB_H +#define SBG_ECOM_LIB_H + +#ifdef __cplusplus +extern "C" { +#endif + +// sbgCommonLib headers +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Local headers +#include "sbgECanId.h" +#include "sbgEComIds.h" +#include "commands/sbgEComCmd.h" +#include "protocol/sbgEComProtocol.h" +#include "binaryLogs/sbgEComBinaryLogs.h" +#include "sbgEComVersion.h" +#include "sbgEComGetVersion.h" + +//----------------------------------------------------------------------// +//- Footer (close extern C block) -// +//----------------------------------------------------------------------// +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_LIB_H diff --git a/src/sbgEComVersion.h b/src/sbgEComVersion.h new file mode 100644 index 0000000..c5c4ab3 --- /dev/null +++ b/src/sbgEComVersion.h @@ -0,0 +1,69 @@ +/*! + * \file sbgEComVersion.h + * \author SBG Systems + * \date 05 February 2013 + * + * \brief Header file that contains all versions related information such as change log. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_E_COM_VERSION_H +#define SBG_E_COM_VERSION_H + +// sbgCommonLib headers +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +//----------------------------------------------------------------------// +//- Version definitions -// +//----------------------------------------------------------------------// + +#define SBG_E_COM_VERSION_MAJOR 3 +#define SBG_E_COM_VERSION_MINOR 1 +#define SBG_E_COM_VERSION_REV 2358 +#define SBG_E_COM_VERSION_BUILD SBG_VERSION_QUALIFIER_STABLE + +#define SBG_E_COM_VERSION SBG_VERSION_SOFTWARE(SBG_E_COM_VERSION_MAJOR,SBG_E_COM_VERSION_MINOR,SBG_E_COM_VERSION_REV,SBG_E_COM_VERSION_BUILD) + +/* + * Backward compatibility macro definitions. + */ + #ifndef SBG_STR + #define SBG_STR(X) #X +#endif +#ifndef SBG_ASSTR + #define SBG_ASSTR(X) SBG_STR(X) +#endif +#define SBG_E_COM_VERSION_STR SBG_ASSTR(SBG_E_COM_VERSION_MAJOR) "." SBG_ASSTR(SBG_E_COM_VERSION_MINOR) "." SBG_ASSTR(SBG_E_COM_VERSION_REV) "-stable\0" + +#ifdef __cplusplus +} +#endif + +#endif // SBG_E_COM_VERSION_H diff --git a/src/transfer/sbgEComTransfer.c b/src/transfer/sbgEComTransfer.c new file mode 100644 index 0000000..b6ad417 --- /dev/null +++ b/src/transfer/sbgEComTransfer.c @@ -0,0 +1,620 @@ +// sbgCommonLib headers +#include +#include +#include + +// Project headers +#include + +// Local headers +#include "sbgEComTransfer.h" + +//----------------------------------------------------------------------// +//- Private methods -// +//----------------------------------------------------------------------// +/*! + * Initiates an upload transfer sequence with a device. + * + * \param[in] pHandle Pointer to a valid SbgEComHandle. + * \param[in] msgClass Original protocol class asking for transfer. + * \param[in] msg Original protocol message id asking for transfer. + * \param[in] size Total size of the upload. + * \return SBG_NO_ERROR when the transfer was initiated successfully. + */ +static SbgErrorCode sbgEComTransferSendInit(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg, size_t size) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgStreamBuffer streamBuffer; + uint8_t outputBuffer[16]; + uint32_t trial; + + assert(pHandle); + + // + // Initialize stream buffer that will contain payload + // + sbgStreamBufferInitForWrite(&streamBuffer, outputBuffer, sizeof(outputBuffer)); + + // + // Build transfer payload (a SBG_ECOM_TRANSFER_START command and the total size of the upload) + // + sbgStreamBufferWriteUint16LE(&streamBuffer, SBG_ECOM_TRANSFER_START); + sbgStreamBufferWriteSizeT32LE(&streamBuffer, size); + + // + // Send command (multiple times in case of failures) + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send transfer payload encapsulated in ECom protocol + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, msgClass, msg, sbgStreamBufferGetLinkedBuffer(&streamBuffer), sbgStreamBufferGetLength(&streamBuffer)); + + if (errorCode == SBG_NO_ERROR) + { + // + // If the device accepts the transfer, it returns an ack, wait for the answer. + // + errorCode = sbgEComWaitForAck(pHandle, msgClass, msg, pHandle->cmdDefaultTimeOut); + + // + // Test if the response is positive from device + // + if (errorCode == SBG_NO_ERROR) + { + // + // Ack received, no need for other trial. + // + break; + } + } + } + + return errorCode; +} + +/*! + * Send one packet of data on a initiated upload transfer. + * + * \param[in] pHandle Pointer to a valid SbgEComHandle. + * \param[in] msgClass Original protocol class asking for transfer. + * \param[in] msg Original protocol message id asking for transfer. + * \param[in] pBuffer Pointer to the buffer containing the data to send. + * \param[in] offset The offset from the start of the transfer. + * \param[in] packetSize The size of this packet. + * \return SBG_NO_ERROR if the packet was sent and acknowledged by the device. + */ +static SbgErrorCode sbgEComTransferSendData(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg, const void *pBuffer, size_t offset, size_t packetSize) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgStreamBuffer streamBuffer; + uint8_t outputBuffer[16]; + uint32_t trial; + + assert(pHandle); + assert(pBuffer); + assert(packetSize > 0); + + // + // Initialize stream buffer for output + // + sbgStreamBufferInitForWrite(&streamBuffer, outputBuffer, sizeof(outputBuffer)); + + // + // Build payload: a SBG_ECOM_TRANSFER_DATA command, the offset from the start of the transfer, and the data + // + sbgStreamBufferWriteUint16LE(&streamBuffer, SBG_ECOM_TRANSFER_DATA); + sbgStreamBufferWriteSizeT32LE(&streamBuffer, offset); + sbgStreamBufferWriteBuffer(&streamBuffer, pBuffer, packetSize); + + // + // Send command (multiple times in case of failures) + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send transfer payload encapsulated in a ECom protocol frame + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, msgClass, msg, sbgStreamBufferGetLinkedBuffer(&streamBuffer), sbgStreamBufferGetLength(&streamBuffer)); + + if (errorCode == SBG_NO_ERROR) + { + // + // If the device receives the frame successfully received, it responds with an ACK, wait for the answer + // + errorCode = sbgEComWaitForAck(pHandle, msgClass, msg, pHandle->cmdDefaultTimeOut); + + // + // Test if the response is positive from device + // + if (errorCode == SBG_NO_ERROR) + { + // + // Ack received, no need for other trial + // + break; + } + } + } + + return errorCode; +} + +/*! + * Ends ongoing upload transfer sequence with a device. + * + * \param[in] pHandle Pointer to a valid SbgEComHandle. + * \param[in] msgClass Original protocol class asking for transfer. + * \param[in] msg Original protocol message id asking for transfer. + * \return SBG_NO_ERROR when the transfer ended successfully. + */ +static SbgErrorCode sbgEComTransferSendEnd(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgStreamBuffer outputStream; + uint8_t outputBuffer[sizeof(uint16_t)]; + uint32_t trial; + + assert(pHandle); + + // + // Build payload, only a SBG_ECOM_TRANSFER_END cmd + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + sbgStreamBufferWriteUint16LE(&outputStream, SBG_ECOM_TRANSFER_END); + + // + // Send command (multiple times in case of failures) + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send upload end payload encapsulated in a ECom protocol frame + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, msgClass, msg, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + if (errorCode == SBG_NO_ERROR) + { + // + // If the device finishes the sequence successfully, it responds with an ACK, wait for answer + // + errorCode = sbgEComWaitForAck(pHandle, msgClass, msg, pHandle->cmdDefaultTimeOut); + + // + // Test if the response is positive from device + // + if (errorCode == SBG_NO_ERROR) + { + // + // ACK received, no need for other trial + // + break; + } + } + } + + return errorCode; +} + +/*! + * Initiates a download sequences with a device. + * + * \param[in] pHandle Pointer to a valid SbgEComHandle. + * \param[in] msgClass Original protocol class asking for transfer. + * \param[in] msg Original protocol message id asking for transfer. + * \param[out] pSize Size of the transfer initiated, returned from the device. + * \return SBG_NO_ERROR when the transfer initiated successfully. + */ +static SbgErrorCode sbgEComTransferReceiveInit(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg, size_t *pSize) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComProtocolPayload receivedPayload; + SbgStreamBuffer outputStream; + uint8_t outputBuffer[sizeof(uint16_t)]; + uint16_t transferCmd; + size_t transferSize; + uint32_t trial; + + assert(pHandle); + + sbgEComProtocolPayloadConstruct(&receivedPayload); + + // + // Build payload, only a SBG_ECOM_TRANSFER_START cmd + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + sbgStreamBufferWriteUint16LE(&outputStream, SBG_ECOM_TRANSFER_START); + + // + // Send command (multiple times in case of failures) + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send transfer payload encapsulated in an ECom protocol frame + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, msgClass, msg, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + if (errorCode == SBG_NO_ERROR) + { + // + // Wait for reponse, the device should respond with a ECOM_TRANSFER_START command and the transfer size + // If it can not initiate the transfer, it will respond with a NACK + // + errorCode = sbgEComReceiveCmd2(pHandle, msgClass, msg, &receivedPayload, pHandle->cmdDefaultTimeOut); + + if (errorCode == SBG_NO_ERROR) + { + SbgStreamBuffer inputStream; + + // + // Init stream buffer on received payload to process it + // + sbgStreamBufferInitForRead(&inputStream, sbgEComProtocolPayloadGetBuffer(&receivedPayload), sbgEComProtocolPayloadGetSize(&receivedPayload)); + + // + // Retrieve parameters, the first one is the transfer command + // The second one is the total transfer size + // + transferCmd = sbgStreamBufferReadUint16LE(&inputStream); + transferSize = sbgStreamBufferReadSizeT32LE(&inputStream); + + // + // The device should have answered with SBG_ECOM_TRANSFER_START transfer command + // + if (transferCmd == SBG_ECOM_TRANSFER_START) + { + // + // Update output variable with the transfer size + // + *pSize = transferSize; + + // + // No need for other trials, exit loop/ + // + break; + } + else + { + // + // Invalid transfer command response + // + errorCode = SBG_ERROR; + } + } + else if (errorCode != SBG_TIME_OUT) + { + SBG_LOG_ERROR(errorCode, "Invalid answer received"); + } + else + { + SBG_LOG_ERROR(errorCode, "No response received"); + } + } + else + { + SBG_LOG_ERROR(errorCode, "Unable to send the command"); + } + } + + sbgEComProtocolPayloadDestroy(&receivedPayload); + + return errorCode; +} + +/*! + * Receive one packet of data on a initiated download transfer. + * + * \param[in] pHandle Pointer to a valid SbgEComHandle. + * \param[in] msgClass Original protocol class asking for transfer. + * \param[in] msg Original protocol message id asking for transfer. + * \param[in] pBuffer Pointer to the buffer where to write the packet. + * \param[in] offset The offset from the start of the buffer. + * \param[in] packetSize The size of the data asked to the device. + * \return SBG_NO_ERROR if the packet was successfully received. + */ +static SbgErrorCode sbgEComTransferReceiveData(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg, void *pBuffer, size_t offset, size_t packetSize) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgEComProtocolPayload receivedPayload; + SbgStreamBuffer outputStream; + uint8_t outputBuffer[16]; + uint32_t trial; + + assert(pHandle); + assert(pBuffer); + assert(packetSize > 0); + + sbgEComProtocolPayloadConstruct(&receivedPayload); + + // + // Build payload: an SBG_ECOM_TRANSFER_DATA transfer command, the offset from the start of the transfer, the size of the packet the device must send + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + sbgStreamBufferWriteUint16LE(&outputStream, SBG_ECOM_TRANSFER_DATA); + sbgStreamBufferWriteSizeT32LE(&outputStream, offset); + sbgStreamBufferWriteSizeT32LE(&outputStream, packetSize); + + // + // Send command (multiple times in case of failures) + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send transfer payload encapsulated in an ECom protocol frame + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, msgClass, msg, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + if (errorCode == SBG_NO_ERROR) + { + // + // Wait for reponse, the device should respond with a ECOM_TRANSFER_DATA, the offset from the start of the transfer and the data payload + // If it can not provide the data, it will respond with a NACK + // + errorCode = sbgEComReceiveCmd2(pHandle, msgClass, msg, &receivedPayload, pHandle->cmdDefaultTimeOut); + + if (errorCode == SBG_NO_ERROR) + { + SbgStreamBuffer inputStream; + uint16_t transferCmd; + size_t rcvdOffset; + + // + // Initialize stream buffer for read on input buffer + // + sbgStreamBufferInitForRead(&inputStream, sbgEComProtocolPayloadGetBuffer(&receivedPayload), sbgEComProtocolPayloadGetSize(&receivedPayload)); + + // + // Read response fields, first is the transfer command, second is the offset + // + transferCmd = sbgStreamBufferReadUint16LE(&inputStream); + rcvdOffset = sbgStreamBufferReadSizeT32LE(&inputStream); + + // + // Test that it's a SBG_ECOM_TRANSFER_DATA command + // The data is at the offset asked and the size corresponds + // + if ( (transferCmd == SBG_ECOM_TRANSFER_DATA) && (offset == rcvdOffset) && (packetSize == (sbgEComProtocolPayloadGetSize(&receivedPayload) - (sizeof(uint16_t) + sizeof(uint32_t)))) ) + { + // + // Read all the buffer + // + sbgStreamBufferReadBuffer(&inputStream, pBuffer, sbgEComProtocolPayloadGetSize(&receivedPayload) - (sizeof(uint16_t) + sizeof(uint32_t))); + + // + // No need for other trials, exit loop + // + break; + } + } + } + } + + sbgEComProtocolPayloadDestroy(&receivedPayload); + + return errorCode; +} + +/*! + * Function that ends a download sequence with a device. + * + * \param[in] pHandle Pointer to a valid SbgEComHandle. + * \param[in] msgClass Original protocol class asking for transfer. + * \param[in] msg Original protocol message id asking for transfer. + * \return SBG_NO_ERROR when the transfer ended successfully. + */ +static SbgErrorCode sbgEComTransferReceiveEnd(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgStreamBuffer outputStream; + uint8_t outputBuffer[sizeof(uint16_t)]; + uint32_t trial; + + assert(pHandle); + + // + // Build payload, only a SBG_ECOM_TRANSFER_END cmd + // + sbgStreamBufferInitForWrite(&outputStream, outputBuffer, sizeof(outputBuffer)); + sbgStreamBufferWriteUint16LE(&outputStream, SBG_ECOM_TRANSFER_END); + + // + // Send command (multiple times in case of failures) + // + for (trial = 0; trial < pHandle->numTrials; trial++) + { + // + // Send upload end payload encapsulated in a ECom protocol frame + // + errorCode = sbgEComProtocolSend(&pHandle->protocolHandle, msgClass, msg, sbgStreamBufferGetLinkedBuffer(&outputStream), sbgStreamBufferGetLength(&outputStream)); + + if (errorCode == SBG_NO_ERROR) + { + // + // If the device is able to finish transfer sequence, it responds with an ACK + // + errorCode = sbgEComWaitForAck(pHandle, msgClass, msg, pHandle->cmdDefaultTimeOut); + + // + // Test if the response is positive from device + // + if (errorCode == SBG_NO_ERROR) + { + // + // No need for other trial, exit loop + // + break; + } + } + } + + return errorCode; +} + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +SbgErrorCode sbgEComTransferSend(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg, const void *pBuffer, size_t size) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgSplitBuffer splitBuffer; + size_t i; + + assert(pHandle); + assert(pBuffer); + assert(size > 0); + + // + // Make sure we are not trying to send a buffer that is too large + // + if (size <= SBG_ECOM_TRANSFER_MAX_SIZE) + { + // + // Initiate data transfer + // + errorCode = sbgEComTransferSendInit(pHandle, msgClass, msg, size); + + // + // Check that the transfer was correctly initialized + // + if (errorCode == SBG_NO_ERROR) + { + // + // Initialize split buffer that will help with splitting up provided buffer + // + sbgSplitBufferInitForRead(&splitBuffer, pBuffer, size, SBG_ECOM_TRANSFER_PACKET_SIZE); + + // + // Transfer sub buffer one by one + // + for (i = 0; i < sbgSplitBufferGetSubBufferNbr(&splitBuffer); i++) + { + // + // Send a sub buffer + // + errorCode = sbgEComTransferSendData(pHandle, msgClass, msg, sbgSplitBufferGetSubBuffer(&splitBuffer, i), sbgSplitBufferGetSubBufferOffset(&splitBuffer, i), sbgSplitBufferGetSubBufferSize(&splitBuffer, i)); + + // + // Test if the sub buffer has been sent + // + if (errorCode != SBG_NO_ERROR) + { + // + // Unable to send a sub buffer, abort send operation. + // + break; + } + } + + // + // Test if any error occurred during data transfer + // + if (errorCode == SBG_NO_ERROR) + { + // + // End data transfer + // + errorCode = sbgEComTransferSendEnd(pHandle, msgClass, msg); + } + } + } + else + { + // + // Trying to send a buffer that is too large + // + errorCode = SBG_INVALID_PARAMETER; + } + + return errorCode; +} + +SbgErrorCode sbgEComTransferReceive(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg, void *pBuffer, size_t *pActualSize, size_t bufferSize) +{ + SbgErrorCode errorCode = SBG_NO_ERROR; + SbgSplitBuffer splitBuffer; + size_t transferSize; + size_t i; + + assert(pHandle); + assert(pBuffer); + assert(pActualSize); + assert(bufferSize > 0); + + // + // initiate data transfer + // + errorCode = sbgEComTransferReceiveInit(pHandle, msgClass, msg, &transferSize); + + // + // Make sure the receive transfer has been correctly initialized + // + if (errorCode == SBG_NO_ERROR) + { + // + // Test that the provided buffer is large enough to receive all data + // + if (transferSize <= bufferSize) + { + // + // Initialize Split buffer to help with sub buffer receive + // + sbgSplitBufferInitForWrite(&splitBuffer, pBuffer, transferSize, SBG_ECOM_TRANSFER_PACKET_SIZE); + + // + // Receive buffers one by one + // + for (i = 0; i < sbgSplitBufferGetSubBufferNbr(&splitBuffer); i++) + { + // + // Receive a sub buffer + // + errorCode = sbgEComTransferReceiveData(pHandle, msgClass, msg, sbgSplitBufferGetSubBuffer(&splitBuffer, i), sbgSplitBufferGetSubBufferOffset(&splitBuffer, i), sbgSplitBufferGetSubBufferSize(&splitBuffer, i)); + + // + // Make sure that the sub buffer has been correctly received + // + if (errorCode != SBG_NO_ERROR) + { + // + // An error occurred, abort data transfer + // + break; + } + } + + // + // Test if any error occurred during transfer + // + if (errorCode == SBG_NO_ERROR) + { + // + // End data transfer + // + errorCode = sbgEComTransferReceiveEnd(pHandle, msgClass, msg); + + // + // Make sure that the transfer has been correctly ended + // + if (errorCode == SBG_NO_ERROR) + { + // + // Since the transfer was successful update output variable pActualSize + // + *pActualSize = transferSize; + } + } + } + else + { + // + // Provided buffer is too small + // + errorCode = SBG_INVALID_PARAMETER; + } + } + + return errorCode; +} diff --git a/src/transfer/sbgEComTransfer.h b/src/transfer/sbgEComTransfer.h new file mode 100644 index 0000000..cb6464b --- /dev/null +++ b/src/transfer/sbgEComTransfer.h @@ -0,0 +1,99 @@ +/*! + * \file sbgEComTransfer.h + * \author SBG Systems + * \date 19 November 2013 + * + * \brief Handle large send/receive transfer for specific ECom Protocol commands. + * + * \copyright Copyright (C) 2022, SBG Systems SAS. All rights reserved. + * \beginlicense The MIT license + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * \endlicense + */ + +#ifndef SBG_ECOM_TRANSFER_H +#define SBG_ECOM_TRANSFER_H + +// sbgCommonLib headers +#include + +// Project headers +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------------------------// +//- Global definitions -// +//----------------------------------------------------------------------// + +#define SBG_ECOM_TRANSFER_MAX_SIZE (8192u) /*!< Maximum buffer that can be transmitted using the sbgECom transfer protocol. */ +#define SBG_ECOM_TRANSFER_PACKET_SIZE (512u) /*!< Max packet size transmitted in a single frame */ + +//----------------------------------------------------------------------// +//- Communication protocol structs and definitions -// +//----------------------------------------------------------------------// + +/*! + * Defines the ECom transfer commands + */ +typedef enum _SbgEComTransferCmd +{ + SBG_ECOM_TRANSFER_START = 0, /*!< Command to initiate a transfer. */ + SBG_ECOM_TRANSFER_DATA = 1, /*!< Command to transmit/receive data. */ + SBG_ECOM_TRANSFER_END = 2 /*!< Command to end a transfer. */ +} SbgEComTransferCmd; + +//----------------------------------------------------------------------// +//- Public methods -// +//----------------------------------------------------------------------// + +/*! + * Specific method to handle a large send into multiple frames. + * + * \param[in] pHandle Pointer to a valid SbgEComHandle. + * \param[in] msgClass Original protocol class asking for transfer. + * \param[in] msg Original protocol message id asking for transfer. + * \param[in] pBuffer Pointer to the buffer containing the data to send. + * \param[in] size The size of the buffer. + * \return SBG_NO_ERROR in case of a successful upload. + */ +SbgErrorCode sbgEComTransferSend(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg, const void *pBuffer, size_t size); + +/*! + * Specific method to handle a large receive from the device. + * + * \param[in] pHandle Pointer to a valid SbgEComHandle. + * \param[in] msgClass Original protocol class asking for transfer. + * \param[in] msg Original protocol message id asking for transfer. + * \param[in] pBuffer Pointer to the buffer where to write data. + * \param[out] pActualSize The final size written into the buffer. + * \param[in] bufferSize The size of the buffer. + * \return SBG_NO_ERROR in case of a successful download. + */ +SbgErrorCode sbgEComTransferReceive(SbgEComHandle *pHandle, uint8_t msgClass, uint8_t msg, void *pBuffer, size_t *pActualSize, size_t bufferSize); + +#ifdef __cplusplus +} +#endif + +#endif // SBG_ECOM_TRANSFER_H