diff --git a/.devcontainer/Dockerfile.centos b/.devcontainer/Dockerfile.centos deleted file mode 100644 index 3e6d87d4e..000000000 --- a/.devcontainer/Dockerfile.centos +++ /dev/null @@ -1,61 +0,0 @@ -ARG ARCH="amd64" -ARG CENTOS_VERSION="7" -FROM ${ARCH}/centos:${CENTOS_VERSION} - -# Add some CA certificates -COPY .devcontainer/extra_cas /etc/pki/ca-trust/source/anchors -RUN set -ex && update-ca-trust - -# Install some build tools -RUN set -ex \ - && yum -y groupinstall "Development Tools" \ - && yum -y install \ - git \ - gdb \ - vim \ - curl \ - make \ - subversion \ - bash-completion - -# Add some python dependencies -RUN set -ex && yum -y install python2-devel || yum -y install python-devel - -# We need CMake 3 for MIP, so install that here -ARG CMAKE_VERSION="3.23.0" -RUN set -ex \ - && yum -y install epel-release \ - && export CMAKE_MAJOR_VERSION=$(echo ${CMAKE_VERSION} | cut -d"." -f-2) \ - && curl -fsSLo /tmp/cmake-${CMAKE_VERSION}.tar.gz https://cmake.org/files/v${CMAKE_MAJOR_VERSION}/cmake-${CMAKE_VERSION}.tar.gz \ - && tar -C /tmp/ -xzf /tmp/cmake-${CMAKE_VERSION}.tar.gz \ - && cd /tmp/cmake-${CMAKE_VERSION} \ - && ./bootstrap \ - --prefix="/usr" \ - --parallel=$(nproc) \ - -- \ - -DCMAKE_INSTALL_PREFIX="/usr" \ - -DCMAKE_BUILD_TYPE="RELEASE" \ - -DCMAKE_USE_OPENSSL=OFF \ - && make -j$(nproc) \ - && make install \ - && rm -rf /tmp/cmake-* - -# Add a user that will be used when shelling into this container and allow them to use devices -ARG USER_ID=1000 -ARG GROUP_ID=1000 -RUN set -ex \ - && yum install -y \ - sudo \ - && groupadd -g ${USER_ID} microstrain \ - && useradd \ - -N \ - -m \ - -u ${USER_ID} \ - -g ${GROUP_ID} \ - -G "dialout" \ - -s "/bin/bash" \ - microstrain \ - && echo 'microstrain ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers - -# Append /usr/lib to LD_LIBRARY_PATH? Feels like we shouldn't need to do this -ENV LD_LIBRARY_PATH "${LD_LIBRARY_PATH}:/usr/lib" \ No newline at end of file diff --git a/.devcontainer/Dockerfile.ubuntu b/.devcontainer/Dockerfile.ubuntu index f783f26e0..5b060aba9 100644 --- a/.devcontainer/Dockerfile.ubuntu +++ b/.devcontainer/Dockerfile.ubuntu @@ -22,7 +22,8 @@ RUN set -ex \ zlib1g-dev \ subversion \ build-essential \ - bash-completion + bash-completion \ + doxygen # Add a user that will be used when shelling into this container and allow them to use devices ARG USER_ID=1000 diff --git a/.devcontainer/docker_build.sh b/.devcontainer/docker_build.sh index 2ffb17adf..00dd2b18c 100755 --- a/.devcontainer/docker_build.sh +++ b/.devcontainer/docker_build.sh @@ -8,6 +8,7 @@ set -e # Get some arguments from the user os="ubuntu" arch="amd64" +build_docs=false while [[ $# -gt 0 ]]; do case $1 in --os) @@ -20,6 +21,10 @@ while [[ $# -gt 0 ]]; do shift # past argument shift # past value ;; + --docs) + build_docs=true + shift # past argument + ;; *) shift # past argument ;; @@ -31,10 +36,9 @@ script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" project_dir="${script_dir}/.." docker_project_dir="/home/microstrain/mipsdk" dockerfile="${script_dir}/Dockerfile.${os}" -build_dir_name="build_${os}_${arch}" - image_name="microstrain/mipsdk_${os}_builder:${arch}" + # Build the docker image docker build \ -t "${image_name}" \ @@ -49,6 +53,22 @@ if [ "${ISHUDSONBUILD}" != "True" ]; then docker_it_flags="-it" fi +if [ ${build_docs} = true ]; then + build_dir_name="build_docs" + configure_flags="\ + -DMICROSTRAIN_BUILD_DOCUMENTATION=ON \ + -DMICROSTRAIN_BUILD_DOCUMENTATION_QUIET=OFF \ + -DCMAKE_BUILD_TYPE=RELEASE" + build_target="package_docs" +else + build_dir_name="build_${os}_${arch}" + configure_flags="\ + -DMICROSTRAIN_BUILD_EXAMPLES=ON \ + -DMICROSTRAIN_BUILD_PACKAGE=ON \ + -DCMAKE_BUILD_TYPE=RELEASE" + build_target="package" +fi + # Run the build in the docker image docker run \ --rm \ @@ -61,8 +81,7 @@ docker run \ rm -rf ${docker_project_dir}/${build_dir_name}; \ mkdir ${docker_project_dir}/${build_dir_name}; \ cd ${docker_project_dir}/${build_dir_name}; \ - cmake ${docker_project_dir} \ - -DBUILD_PACKAGE=ON; \ - cmake --build . -j; \ - cmake --build . --target package; \ - " \ No newline at end of file + cmake ${docker_project_dir} ${configure_flags}; \ + cmake --build . -j$(nproc); \ + cmake --build . --target ${build_target}; \ + " diff --git a/.gitignore b/.gitignore index 79868ed81..8dadf5d41 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,4 @@ int/ .idea/ .vs/ -src/mip/mip_version.h +src/c/mip/mip_version.h diff --git a/CHANGELOG.md b/CHANGELOG.md index 836aaa4e8..bcba0cdeb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,36 @@ Forthcoming ### Interface Changes ### Bug Fixes +v3.0.0 +------ + +### New Features +* Metadata for C++ template programming (beta) +* Pretty-printing example (beta) +* Packet processing examples +* `microstrain::Span` implementation of `std::span` (interchangeable, see readme/documentation) +* Improved serialization system in c++ + +### Interface Changes +* Reorganized directory structure and libraries + * Separated base ‘microstrain’ library from ‘mip’ library + * Separated C and C++ code + * Migration: + * #include .h files for C and .hpp files for C++. + * Add these include paths to your project: + * `src/c` + * `src/cpp` + * Include files as `#include ` or `#include `, or .hpp for c++. + * Most files have just been moved, but a few things have been broken out into new files +* Introduced microstrain namespace + * Used for common code that’s not mip-specific + * Which namespace to use depends on the location of the corresponding #include file +* Renamed some CMake variables (see readme) + +### Bug Fixes +* Revamped C++ serialization system to avoid huge error messages due to large number of insert/extract overloads. +* Improved CMake scripts +* Cleaned up warnings v2.0.0 ------ diff --git a/CMakeLists.txt b/CMakeLists.txt index c0d38f499..bf1648517 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,296 +1,141 @@ +cmake_minimum_required(VERSION 3.12) -cmake_minimum_required(VERSION 3.10) - -set(CMAKE_CXX_STANDARD 14) -set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_STANDARD 20) # CMake decays this to the highest supported by the compiler set(CMAKE_C_STANDARD 11) -set(CMAKE_C_STANDARD_REQUIRED ON) project( - "MIP SDK" - VERSION "0.0.01" + "MIP_SDK" + VERSION "3.0.00" DESCRIPTION "MicroStrain Communications Library for embedded systems" LANGUAGES C CXX ) +set(MICROSTRAIN_SRC_DIR "${CMAKE_CURRENT_LIST_DIR}/src") + +# Add our cmake directory to the available cmake modules path +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") + # # Build options # -option(MIP_USE_SERIAL "Build serial connection support into the library and examples" ON) -option(MIP_USE_TCP "Build TCP connection support into the library and exampels" ON) -option(MIP_USE_EXTRAS "Build extra support into the library including some things that might work at a higher level and use dynamically allocated memory" ON) -option(MIP_ENABLE_DIAGNOSTICS "Enable various diagnostic counters in the mip library for debugging." OFF) -option(MIP_ENABLE_LOGGING "Build with logging functions enabled" ON) -option(BUILD_PACKAGE "Whether to build a package from the resulting binaries" OFF) -option(BUILD_EXAMPLES "Builds the example programs." ON) -# CTest defines this option to ON by default, so override it to OFF here. -option(BUILD_TESTING "Build the testing tree." OFF) -option(MIP_DISABLE_CPP "Excludes all C++ files from the project." OFF) -option(BUILD_DOCUMENTATION "Build the documentation." OFF) -option(BUILD_DOCUMENTATION_FULL "Build the full (internal) documentation." OFF) -option(BUILD_DOCUMENTATION_QUIET "Suppress doxygen standard output." ON) - -set(MIP_LOGGING_MAX_LEVEL "" CACHE STRING "Max log level the SDK is allowed to log. If this is defined, any log level logged at a higher level than this will result in a noop regardless of runtime configuration.") -set(MIP_TIMESTAMP_TYPE "uint64_t" CACHE STRING "Override the type used for received data timestamps and timeouts (must be unsigned or at least 64 bits).") - -set(SRC_DIR "${CMAKE_CURRENT_LIST_DIR}/src") -set(EXT_DIR "${CMAKE_CURRENT_LIST_DIR}/ext") -set(MIP_CMAKE_DIR "${CMAKE_CURRENT_LIST_DIR}/cmake") - -if(WITH_INTERNAL) - if(NOT DEFINED MIP_INTERNAL_DIR) - set(MIP_INTERNAL_DIR "int" CACHE PATH "") - endif() - file(REAL_PATH "${MIP_INTERNAL_DIR}" MIP_INTERNAL_DIR) +# MicroStrain options +option(MICROSTRAIN_ENABLE_LOGGING "Build with logging functions enabled" ON) - add_subdirectory("${MIP_INTERNAL_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/mip-internal") -endif() +set(MICROSTRAIN_LOGGING_MAX_LEVEL "MICROSTRAIN_LOG_LEVEL_INFO" CACHE STRING "Max log level the SDK is allowed to log. If this is defined, any log level logged at a higher level than this will result in a noop regardless of runtime configuration.") +set(MICROSTRAIN_TIMESTAMP_TYPE "uint64_t" CACHE STRING "Override the type used for received data timestamps and timeouts (must be unsigned or at least 64 bits).") -set(MIP_DIR "${SRC_DIR}/mip") +include(check_cxx_support) -# Use Git to find the version -find_package(Git) -set(DEFAULT_MIP_GIT_VERSION "v0.0.0") -if(NOT GIT_FOUND) - message(STATUS "Unable to find git, will build with unknown version") - set(MIP_GIT_VERSION ${DEFAULT_MSCL_GIT_VERSION}) -else() - execute_process( - COMMAND ${CMAKE_COMMAND} -E env ${GIT_EXECUTABLE} describe --tags - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - OUTPUT_VARIABLE MIP_GIT_VERSION_OUT - ERROR_VARIABLE MIP_GIT_VERSION_ERR - RESULT_VARIABLE MIP_GIT_VERSION_RET - ) - if(NOT ${MIP_GIT_VERSION_RET} EQUAL 0) - message(STATUS "Unable to determine version from Git, defaulting to version ${DEFAULT_MIP_GIT_VERSION}") - set(MIP_GIT_VERSION ${DEFAULT_MIP_GIT_VERSION}) - else() - set(MIP_GIT_VERSION ${MIP_GIT_VERSION_OUT}) - string(REGEX REPLACE "\n" "" MIP_GIT_VERSION "${MIP_GIT_VERSION}") - message(STATUS "MIP SDK Version: ${MIP_GIT_VERSION}") - endif() +option(MICROSTRAIN_ENABLE_CPP "Enables the C++ API. Turn off to avoid compiling the C++ API." ON) +#option(MICROSTRAIN_ENABLE_CPP_C_NAMESPACE "Wraps the C api in a C++ namespace to avoid global namespace pollution (e.g. microstrain::C::microstrain_serial_port)" ${MICROSTRAIN_ENABLE_CPP}) +message(DEBUG "MICROSTRAIN_ENABLE_CPP=${MICROSTRAIN_ENABLE_CPP}") +if(MICROSTRAIN_ENABLE_CPP) + option(MICROSTRAIN_USE_STD_SPAN "Use std::span from C++20 for microstrain::Span." ${MICROSTRAIN_COMPILER_SUPPORTS_SPAN}) + option(MICROSTRAIN_USE_STD_ENDIAN "Use std::endian from C++20 for microstrain::Endian." ${MICROSTRAIN_COMPILER_SUPPORTS_BIT}) + message(DEBUG "MICROSTRAIN_USE_STD_SPAN=${MICROSTRAIN_USE_STD_SPAN}") + message(DEBUG "MICROSTRAIN_USE_STD_ENDIAN=${MICROSTRAIN_USE_STD_ENDIAN}") endif() -# Massage the version number a little so we can use it in a couple places -string(REGEX REPLACE "^v?([0-9]+)\\.([0-9]+)\\.([0-9]+).*" "\\1.\\2.\\3" MIP_GIT_VERSION_CLEAN ${MIP_GIT_VERSION}) -string(REPLACE "." ";" MIP_GIT_VERSION_LIST ${MIP_GIT_VERSION_CLEAN}) -list(LENGTH MIP_GIT_VERSION_LIST MIP_GIT_VERSION_LIST_LENGTH) -if (MIP_GIT_VERSION_LIST_LENGTH GREATER_EQUAL 3) - list(GET MIP_GIT_VERSION_LIST 0 MIP_GIT_VERSION_MAJOR) - list(GET MIP_GIT_VERSION_LIST 1 MIP_GIT_VERSION_MINOR) - list(GET MIP_GIT_VERSION_LIST 2 MIP_GIT_VERSION_PATCH) -else() - message(WARNING "MIP version cannot be parsed into a semantic version string.\nPlease run 'git fetch --tags' to get a properly tagged build") - set(MIP_GIT_VERSION_CLEAN "0.0.0") - set(MIP_GIT_VERSION_MAJOR 0) - set(MIP_GIT_VERSION_MINOR 0) - set(MIP_GIT_VERSION_PATCH 0) -endif() +option(MICROSTRAIN_ENABLE_EXTRAS "Build extra support into the library including some things that might work at a higher level and use dynamically allocated memory" ON) +option(MICROSTRAIN_ENABLE_SERIAL "Build serial connection support into the library and examples" ON) +option(MICROSTRAIN_ENABLE_TCP "Build TCP connection support into the library and examples" ON) -# Generate the version header file -set(VERSION_IN_FILE "${MIP_CMAKE_DIR}/mip_version.h.in") -set(VERSION_OUT_FILE "${MIP_DIR}/mip_version.h") -configure_file(${VERSION_IN_FILE} ${VERSION_OUT_FILE}) +option(MICROSTRAIN_BUILD_PACKAGE "Whether to build a package from the resulting binaries" OFF) +option(MICROSTRAIN_BUILD_EXAMPLES "Builds the example programs." OFF) -# -# Utils -# +# CTest defines this option to ON by default, so override it to OFF here. +option(MICROSTRAIN_BUILD_TESTS "Build the testing tree." OFF) -set(UTILS_DIR "${MIP_DIR}/utils") +option(MICROSTRAIN_BUILD_DOCUMENTATION "Build the documentation." OFF) +option(MICROSTRAIN_BUILD_DOCUMENTATION_FULL "Build the full (internal) documentation." OFF) +option(MICROSTRAIN_BUILD_DOCUMENTATION_QUIET "Suppress doxygen standard output." ON) -set(UTILS_SOURCES - "${UTILS_DIR}/byte_ring.c" - "${UTILS_DIR}/byte_ring.h" - "${UTILS_DIR}/serialization.c" - "${UTILS_DIR}/serialization.h" -) +option(MICROSTRAIN_CMAKE_DEBUG "If set, prints build system debug info such as source files and preprocessor definitions." ON) # TODO: off by default +mark_as_advanced(MICROSTRAIN_CMAKE_DEBUG) -# -# MIP Control -# +# MIP options +option(MIP_ENABLE_DIAGNOSTICS "Enable various diagnostic counters in the mip library for debugging." OFF) -set(MIP_SOURCES - "${VERSION_OUT_FILE}" - "${MIP_DIR}/mip_cmdqueue.c" - "${MIP_DIR}/mip_cmdqueue.h" - "${MIP_DIR}/mip_dispatch.c" - "${MIP_DIR}/mip_dispatch.h" - "${MIP_DIR}/mip_field.c" - "${MIP_DIR}/mip_field.h" - "${MIP_DIR}/mip_offsets.h" - "${MIP_DIR}/mip_packet.c" - "${MIP_DIR}/mip_packet.h" - "${MIP_DIR}/mip_parser.c" - "${MIP_DIR}/mip_parser.h" - "${MIP_DIR}/mip_result.c" - "${MIP_DIR}/mip_result.h" - "${MIP_DIR}/mip_types.h" - "${MIP_DIR}/definitions/common.c" - "${MIP_DIR}/definitions/common.h" - "${MIP_DIR}/definitions/descriptors.c" - "${MIP_DIR}/definitions/descriptors.h" - "${MIP_DIR}/mip.hpp" - "${MIP_DIR}/mip_all.h" - "${MIP_DIR}/mip_all.hpp" -) +if(NOT DEFINED MIP_ENABLE_METADATA) + message(STATUS "MIP_ENABLE_METADATA not set - compiler support: ${MIP_COMPILER_SUPPORTS_METADATA}") +endif() +option(MIP_ENABLE_METADATA "Build support for MIP protocol metadata in C++ (requires c++20)" ${MIP_COMPILER_SUPPORTS_METADATA}) +option(MIP_ENABLE_EXTRAS "Build extra support into the library including some things that might work at a higher level and use dynamically allocated memory" ${MICROSTRAIN_ENABLE_EXTRAS}) -set(MIPDEV_SOURCES - "${MIP_DIR}/mip_interface.c" - "${MIP_DIR}/mip_interface.h" - "${MIP_DIR}/mip_device.cpp" - "${MIP_DIR}/mip_device.hpp" -) +# Include some utilities used for MicroStrain projects +include(microstrain_utilities) -set(MIPDEF_SOURCES - "${MIP_DIR}/definitions/commands_3dm.c" - "${MIP_DIR}/definitions/commands_3dm.h" - "${MIP_DIR}/definitions/commands_base.c" - "${MIP_DIR}/definitions/commands_base.h" - "${MIP_DIR}/definitions/commands_filter.c" - "${MIP_DIR}/definitions/commands_filter.h" - "${MIP_DIR}/definitions/commands_gnss.c" - "${MIP_DIR}/definitions/commands_gnss.h" - "${MIP_DIR}/definitions/commands_rtk.c" - "${MIP_DIR}/definitions/commands_rtk.h" - "${MIP_DIR}/definitions/commands_aiding.c" - "${MIP_DIR}/definitions/commands_aiding.h" - "${MIP_DIR}/definitions/commands_system.c" - "${MIP_DIR}/definitions/commands_system.h" - "${MIP_DIR}/definitions/data_filter.c" - "${MIP_DIR}/definitions/data_filter.h" - "${MIP_DIR}/definitions/data_gnss.c" - "${MIP_DIR}/definitions/data_gnss.h" - "${MIP_DIR}/definitions/data_sensor.c" - "${MIP_DIR}/definitions/data_sensor.h" - "${MIP_DIR}/definitions/data_shared.c" - "${MIP_DIR}/definitions/data_shared.h" - "${MIP_DIR}/definitions/data_system.c" - "${MIP_DIR}/definitions/data_system.h" - ${INTDEF_SOURCES} -) +# +# Common preprocessor definitions +# -string(REGEX REPLACE "\.h(;|$)" ".hpp\\1" MIPDEF_HPP_SOURCES "${MIPDEF_SOURCES}") -string(REGEX REPLACE "\.c(;|$)" ".cpp\\1" MIPDEF_CPP_SOURCES "${MIPDEF_HPP_SOURCES}") +if(WIN32) + if(MSVC) + set(MICROSTRAIN_PRIVATE_COMPILE_OPTIONS + "/external:anglebrackets" # Treat angle brackets as system includes + "/external:W0" # No warnings from system includes + "/W4" # Enable warnings + "/Zc:__cplusplus" # Enable updated __cplusplus value + "/MP" # Multi-process compilation + ) + endif() -if(MIP_USE_SERIAL) - list(APPEND UTILS_SOURCES - "${UTILS_DIR}/serial_port.c" - "${UTILS_DIR}/serial_port.h" - ) - list(APPEND MIP_INTERFACE_SOURCES - "${MIP_DIR}/platform/serial_connection.hpp" - "${MIP_DIR}/platform/serial_connection.cpp" - ) -endif() -if(MIP_USE_TCP) - list(APPEND UTILS_SOURCES - "${UTILS_DIR}/tcp_socket.c" - "${UTILS_DIR}/tcp_socket.h" + # Disable windows defined min/max + # Set Windows header version (0x0501 is _WIN32_WINNT_WINXP, required for TCP) + set(MICROSTRAIN_PRIVATE_COMPILE_DEFINITIONS + "NOMINMAX=1" + "_WIN32_WINNT=_WIN32_WINNT_WINXP" ) - list(APPEND MIP_INTERFACE_SOURCES - "${MIP_DIR}/platform/tcp_connection.hpp" - "${MIP_DIR}/platform/tcp_connection.cpp" - ) -endif() -if(MIP_USE_EXTRAS) - list(APPEND MIP_DEFINES "MIP_USE_EXTRAS") - set(MIP_EXTRAS_DIR "${MIP_DIR}/extras") - set(MIP_EXTRA_SOURCES - "${MIP_EXTRAS_DIR}/composite_result.hpp" - "${MIP_EXTRAS_DIR}/descriptor_id.hpp" - "${MIP_EXTRAS_DIR}/device_models.h" - "${MIP_EXTRAS_DIR}/device_models.c" - "${MIP_EXTRAS_DIR}/index.hpp" - "${MIP_EXTRAS_DIR}/recording_connection.hpp" - "${MIP_EXTRAS_DIR}/recording_connection.cpp" - "${MIP_EXTRAS_DIR}/scope_helper.hpp" - "${MIP_EXTRAS_DIR}/scope_helper.cpp" - "${MIP_EXTRAS_DIR}/version.hpp" - "${MIP_EXTRAS_DIR}/version.cpp" +else() + set(MICROSTRAIN_PRIVATE_COMPILE_OPTIONS + "-Wall" # Enable warnings + "-Wextra" # Enable extra warnings ) -endif() - -# Logging is a little weird since we need to install the header no matter what -list(APPEND MIP_SOURCES "${MIP_DIR}/mip_logging.h") -if(MIP_ENABLE_LOGGING) - list(APPEND MIP_SOURCES "${MIP_DIR}/mip_logging.c") - list(APPEND MIP_DEFINES "MIP_ENABLE_LOGGING") -endif() -set(ALL_MIP_SOURCES - ${MIPDEF_SOURCES} - ${MIPDEF_CPP_SOURCES} - ${MIPDEV_SOURCES} - ${MIP_SOURCES} - ${UTILS_SOURCES} - ${MIP_CPP_HEADERS} - ${MIP_INTERFACE_SOURCES} - ${MIP_EXTRA_SOURCES} -) - -if(MIP_DISABLE_CPP) - list(FILTER ALL_MIP_SOURCES EXCLUDE REGEX "[c|h]pp$") + set(MICROSTRAIN_PRIVATE_COMPILE_DEFINITIONS "") endif() -add_library(mip ${ALL_MIP_SOURCES}) - -target_include_directories(mip PUBLIC - "$" # Include directory for build only - "$" # Include directory for installation -) +# Suppress warnings due to adding files with target_sources. +cmake_policy(SET CMP0076 NEW) -if(WITH_INTERNAL) - target_include_directories(mip PUBLIC - "$" - ) -endif() +# Suppress warnings due to linking libraries across directories +cmake_policy(SET CMP0079 NEW) -# -# Preprocessor definitions -# -if(${MIP_LOGGING_MAX_LEVEL}) - list(APPEND MIP_DEFINES "MIP_LOGGING_MAX_LEVEL=${MIP_LOGGING_MAX_LEVEL}") -endif() +# Add all the C files (required even for C++ API) +set(MICROSTRAIN_SRC_C_DIR "${MICROSTRAIN_SRC_DIR}/c") -if(${MIP_TIMESTAMP_TYPE}) - list(APPEND MIP_DEFINES "MIP_TIMESTAMP_TYPE=${MIP_TIMESTAMP_TYPE}") -endif() +add_subdirectory(${MICROSTRAIN_SRC_C_DIR}/microstrain) +add_subdirectory(${MICROSTRAIN_SRC_C_DIR}/mip) -if(${MIP_ENABLE_DIAGNOSTICS}) - list(APPEND MIP_DEFINES "MIP_ENABLE_DIAGNOSTICS") -endif() +# Add all the C++ files (if C++ enabled) +if(MICROSTRAIN_ENABLE_CPP) + set(MICROSTRAIN_SRC_CPP_DIR "${MICROSTRAIN_SRC_DIR}/cpp") -# Disable windows defined min/max -# Set Windows header version (0x0501 is _WIN32_WINNT_WINXP, required for TCP) -if(WIN32) - list(APPEND MIP_DEFINES "NOMINMAX=1" "_WIN32_WINNT=0x0501") -endif() + add_subdirectory(${MICROSTRAIN_SRC_CPP_DIR}/microstrain) + add_subdirectory(${MICROSTRAIN_SRC_CPP_DIR}/mip) -if(MSVC) - target_compile_options(mip PRIVATE /W4) -else() - target_compile_options(mip PRIVATE -Wall -Wextra) + #target_compile_definitions(${MICROSTRAIN_COMMON_LIBRARY} PUBLIC "MICROSTRAIN_ENABLE_CPP_C_NAMESPACE=${MICROSTRAIN_ENABLE_CPP_C_NAMESPACE}") endif() -target_compile_definitions(mip PUBLIC "${MIP_DEFINES}") +# Create list of requested libraries for easier linking +# Use the PARENT_SCOPE option when adding new modules and make sure it propagates up all levels +set(MICROSTRAIN_LIBRARIES ${MICROSTRAIN_LIBRARIES_TMP} CACHE STRING "List of all requested MicroStrain libraries to make linking easier" FORCE) +set(MIP_LIBRARIES ${MIP_LIBRARIES_TMP} CACHE STRING "List of all requested MIP libraries to make linking easier" FORCE) # # Libraries # -if(WIN32 AND MIP_USE_TCP) - target_link_libraries(mip PUBLIC "ws2_32") -endif() # # TESTING # -include(CTest) -if(BUILD_TESTING) +if(MICROSTRAIN_BUILD_TESTS) + include(CTest) + enable_testing() add_subdirectory("test") endif() @@ -298,35 +143,41 @@ endif() # EXAMPLES # -if(BUILD_EXAMPLES) +if(MICROSTRAIN_BUILD_EXAMPLES) add_subdirectory("examples") endif() +# +# Version numbering +# + +microstrain_get_git_version(MICROSTRAIN_GIT_VERSION MICROSTRAIN_GIT_VERSION_CLEAN) + # # DOCUMENTATION # -find_package(Doxygen) +if(MICROSTRAIN_BUILD_DOCUMENTATION) + find_package(Doxygen) -if(BUILD_DOCUMENTATION) if(NOT DOXYGEN_FOUND) message(FATAL_ERROR "Doxygen is required to build documentation.") endif() - set(DOXYGEN_PROJECT_NUMBER "${MIP_GIT_VERSION}") + set(DOXYGEN_PROJECT_NUMBER "${MICROSTRAIN_GIT_VERSION}") set(DOXYGEN_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/documentation") set(DOXYGEN_IMAGE_PATH "${CMAKE_CURRENT_LIST_DIR}/docs") set(DOXYGEN_WARN_IF_UNDOCUMENTED NO) - if(NOT MIP_DISABLE_CPP) + if(MICROSTRAIN_ENABLE_CPP) set(DOXYGEN_PREDEFINED "__cplusplus") endif() set(DOXYGEN_EXTRACT_ALL YES) - if(BUILD_DOCUMENTATION_FULL) + if(MICROSTRAIN_BUILD_DOCUMENTATION_FULL) set(DOXYGEN_INTERNAL_DOCS YES) # set(DOXYGEN_WARN_AS_ERROR YES) else() @@ -334,12 +185,14 @@ if(BUILD_DOCUMENTATION) set(DOXYGEN_HIDE_UNDOC_CLASSES YES) endif() - if(BUILD_DOCUMENTATION_QUIET) + if(MICROSTRAIN_BUILD_DOCUMENTATION_QUIET) set(DOXYGEN_QUIET YES) endif() + set(DOXYGEN_HTML_EXTRA_STYLESHEET "${CMAKE_CURRENT_LIST_DIR}/docs/style.css") + doxygen_add_docs(docs - "${SRC_DIR}" "${CMAKE_CURRENT_LIST_DIR}/docs" + "${MICROSTRAIN_SRC_DIR}" "${CMAKE_CURRENT_LIST_DIR}/docs" COMMENT "Generating documentation." ) @@ -347,9 +200,9 @@ if(BUILD_DOCUMENTATION) add_custom_target(package_docs WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/documentation/html DEPENDS docs - COMMAND ${CMAKE_COMMAND} -E tar "cf" "${CMAKE_CURRENT_BINARY_DIR}/mipsdk_${MIP_GIT_VERSION}_Documentation.zip" --format=zip "." + COMMAND ${CMAKE_COMMAND} -E tar "cf" "${CMAKE_CURRENT_BINARY_DIR}/mipsdk_${MICROSTRAIN_GIT_VERSION}_Documentation.zip" --format=zip "." ) -endif(BUILD_DOCUMENTATION) +endif() # # Packaging @@ -360,7 +213,7 @@ include(CMakePackageConfigHelpers) set(CONFIG_EXPORT_DIR "${CMAKE_INSTALL_DATADIR}/cmake/mip") -set(EXPORT_TARGETS mip) +set(EXPORT_TARGETS ${MIP_LIBRARY}) configure_package_config_file( "${CMAKE_CURRENT_LIST_DIR}/cmake/mip-config.cmake.in" "${CMAKE_BINARY_DIR}/mip-config.cmake" @@ -374,162 +227,94 @@ write_basic_package_version_file( COMPATIBILITY AnyNewerVersion ) -# -# Installation -# - -# Only install headers that we build the source files for -set(ALL_MIP_HEADERS "${ALL_MIP_SOURCES}") -list(FILTER ALL_MIP_HEADERS INCLUDE REGEX "^.*\.(h|hpp)$") -foreach(MIP_HEADER ${ALL_MIP_HEADERS}) - string(REPLACE "${SRC_DIR}/" "" MIP_HEADER_RELATIVE "${MIP_HEADER}") - if(INT_DIR) - string(REPLACE "${INT_DIR}/" "" MIP_HEADER_RELATIVE "${MIP_HEADER_RELATIVE}") - endif() - set(MIP_HEADER_DESTINATION_FULL "${CMAKE_INSTALL_INCLUDEDIR}/${MIP_HEADER_RELATIVE}") - get_filename_component(MIP_HEADER_DESTINATION "${MIP_HEADER_DESTINATION_FULL}" DIRECTORY) - install( - FILES "${MIP_HEADER}" - DESTINATION "${MIP_HEADER_DESTINATION}" - COMPONENT mip - ) -endforeach() - -install(TARGETS - mip - EXPORT mip-targets - ARCHIVE - COMPONENT mip - DESTINATION "${CMAKE_INSTALL_LIBDIR}/" -) - -install(EXPORT - mip-targets - COMPONENT mip - DESTINATION "${CONFIG_EXPORT_DIR}" -) - -install(FILES - "${CMAKE_BINARY_DIR}/mip-config.cmake" - "${CMAKE_BINARY_DIR}/mip-config-version.cmake" - COMPONENT mip - DESTINATION "${CONFIG_EXPORT_DIR}" -) - -# Try to determine what architecture we are building for based on the compiler output -if(MSVC) - # Detect if this is a x64 or x86 build - if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(MIP_ARCH "x64") - elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) - set(MIP_ARCH "x86") - endif() -elseif(UNIX) - if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - # The dumpmachine command from gcc should contain information on the architecture - execute_process( - COMMAND ${CMAKE_COMMAND} -E env /bin/bash -c "${CMAKE_CXX_COMPILER} -dumpmachine" - OUTPUT_VARIABLE GCC_ARCHITECTURE_OUT - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - ERROR_VARIABLE GCC_ARCHITECTURE_ERR - RESULT_VARIABLE GCC_ARCHITECTURE_RET - ) +# If we were asked to package, find the generators we can use +if(MICROSTRAIN_BUILD_PACKAGE) + microstrain_get_architecture(MICROSTRAIN_ARCH) - # Convert the GCC architecture to the format that we use - if("${GCC_ARCHITECTURE_OUT}" MATCHES ".*x86_64.*") - set(MIP_ARCH "amd64") - elseif("${GCC_ARCHITECTURE_OUT}" MATCHES ".*aarch64.*") - set(MIP_ARCH "arm64") - elseif("${GCC_ARCHITECTURE_OUT}" MATCHES ".*arm.*") - set(MIP_ARCH "armhf") - else() - message(STATUS "Unrecognized GCC architecture ${GCC_ARCHITECTURE_OUT}. Using CMAKE_SYSTEM_PROCESSOR for architecture") - endif() - endif() -endif() -if(NOT DEFINED MIP_ARCH) - message(STATUS "Defaulting MIP_ARCH to ${CMAKE_SYSTEM_PROCESSOR}") - set(MIP_ARCH ${CMAKE_SYSTEM_PROCESSOR}) -endif() + set(MIP_FILE_NAME_PREFIX "mipsdk_${MICROSTRAIN_GIT_VERSION}_${MICROSTRAIN_ARCH}") -# If we were asked to package, find the generators we can use -if(BUILD_PACKAGE) set(FOUND_CPACK_GENERATORS "") - set(7Z_ROOT "" CACHE STRING "Location of the 7zip executable") + set(DPKG_ROOT "" CACHE STRING "Location of the dpkg executable") - set(RPMBUILD_ROOT "" CACHE STRING "Location of the rpmbuild executable") - find_program(7Z_EXECUTABLE - NAMES 7z - PATHS ${7Z_ROOT} - DOC "7zip command line client" - ) - if(NOT ${7Z_EXECUTABLE} STREQUAL "7Z_EXECUTABLE-NOTFOUND") - list(APPEND FOUND_CPACK_GENERATORS "7Z") - endif() find_program(DPKG_EXECUTABLE NAMES dpkg PATHS ${DPKG_ROOT} DOC "dpkg command line client" ) + if(NOT ${DPKG_EXECUTABLE} STREQUAL "DPKG_EXECUTABLE-NOTFOUND") list(APPEND FOUND_CPACK_GENERATORS "DEB") + + # DEB specific configuration + # Build different deb packages for each target + set(CPACK_DEBIAN_MIP_FILE_NAME "${MIP_FILE_NAME_PREFIX}.deb") + set(CPACK_DEB_COMPONENT_INSTALL ON) + set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) endif() + + set(RPMBUILD_ROOT "" CACHE STRING "Location of the rpmbuild executable") find_program(RPMBUILD_EXECUTABLE NAMES rpmbuild PATHS ${RPMBUILD_ROOT} DOC "rpmbuild command line client" ) + if(NOT ${RPMBUILD_EXECUTABLE} STREQUAL "RPMBUILD_EXECUTABLE-NOTFOUND") list(APPEND FOUND_CPACK_GENERATORS "RPM") + + # RPM specific configuration + # Build different RPM packages for each target + set(CPACK_RPM_MIP_FILE_NAME "${MIP_FILE_NAME_PREFIX}.rpm") + set(CPACK_RPM_COMPONENT_INSTALL ON) + set(CPACK_RPM_PACKAGE_AUTOREQ ON) endif() + + # Windows always has zip installed, so only look for it on linux and mac + if(WIN32) + list(APPEND FOUND_CPACK_GENERATORS "ZIP") + else() + set(ZIP_ROOT "" CACHE STRING "Location of the zip executable") + find_program(ZIP_EXECUTABLE + NAMES zip + PATHS ${ZIP_ROOT} + DOC "zip command line client" + ) + if(NOT ${ZIP_EXECUTABLE} STREQUAL "ZIP_EXECUTABLE-NOTFOUND") + list(APPEND FOUND_CPACK_GENERATORS "ZIP") + endif() + endif() + if(NOT FOUND_CPACK_GENERATORS) message(FATAL_ERROR "Unable to find a suitable package generator, but we were requested to build a package.") + else() + message(STATUS "Packaging using the following generators: ${FOUND_CPACK_GENERATORS}") endif() -endif() -# If we were asked to build packages, include CPack and set up packaging -if(BUILD_PACKAGE) + # Packaging # NOTE: CPack requires all these variables to be set before importing the module. Do not move them after the include(CPack) line set(CPACK_GENERATOR "${FOUND_CPACK_GENERATORS}") - set(CPACK_PACKAGE_VENDOR "Parker Hanifin") - set(CPACK_PACKAGE_CONTACT "Rob Fisher ") - set(CPACK_COMPONENTS_ALL "mip") - - set(CPACK_PACKAGE_VERSION ${MIP_GIT_VERSION_CLEAN}) + set(CPACK_PACKAGE_VENDOR "MicroStrain by HBK") + set(CPACK_PACKAGE_CONTACT "MicroStrain Support ") - # Shared configuration - set(MIP_FILE_NAME_PREFIX "mipsdk_${MIP_GIT_VERSION}_${MIP_ARCH}") - - # DEB specific configuration - # Build different deb packages for each target - set(CPACK_DEBIAN_MIP_FILE_NAME "${MIP_FILE_NAME_PREFIX}.deb") - set(CPACK_DEB_COMPONENT_INSTALL ON) - set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) - - # RPM specific configuration - # Build different RPM packages for each target - set(CPACK_RPM_MIP_FILE_NAME "${MIP_FILE_NAME_PREFIX}.rpm") - set(CPACK_RPM_COMPONENT_INSTALL ON) - set(CPACK_RPM_PACKAGE_AUTOREQ ON) + set(CPACK_PACKAGE_VERSION ${MICROSTRAIN_GIT_VERSION_CLEAN}) # Zip specific configuration # Build different zip packages for each target if(MSVC) - set(CPACK_ARCHIVE_MIP_FILE_NAME "${MIP_FILE_NAME_PREFIX}_MSVC_v${MSVC_TOOLSET_VERSION}") + set(CPACK_PACKAGE_FILE_NAME "${MIP_FILE_NAME_PREFIX}_MSVC_v${MSVC_TOOLSET_VERSION}") elseif(APPLE) - set(CPACK_ARCHIVE_MIP_FILE_NAME "${MIP_FILE_NAME_PREFIX}_OSX") + set(CPACK_PACKAGE_FILE_NAME "${MIP_FILE_NAME_PREFIX}_OSX") elseif(UNIX) - set(CPACK_ARCHIVE_MIP_FILE_NAME "${MIP_FILE_NAME_PREFIX}_Linux") + set(CPACK_PACKAGE_FILE_NAME "${MIP_FILE_NAME_PREFIX}_Linux") else() - set(CPACK_ARCHIVE_MIP_FILE_NAME "${MIP_FILE_NAME_PREFIX}") + set(CPACK_PACKAGE_FILE_NAME "${MIP_FILE_NAME_PREFIX}") endif() + set(CPACK_ARCHIVE_COMPONENT_INSTALL ON) + # Package everything into a single group (includes all MIP and MicroStrain SDK files/libs in one package) + set(CPACK_COMPONENTS_GROUPING ALL_COMPONENTS_IN_ONE) + # Finally include cpack which should have taken all of the previous variables into consideration include(CPack) - - cpack_add_component(mip - DESCRIPTION "MIP SDK static library and header files" - GROUP mip - ) endif() diff --git a/Jenkinsfile b/Jenkinsfile index 269e5f624..1ecf17605 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,3 +1,12 @@ +// Utility function for getting the real branch name even in a pull request +def branchName() { + if (env.CHANGE_BRANCH) { + return env.CHANGE_BRANCH + } else { + return env.BRANCH_NAME + } +} + // Utility function for checking out the repo since we want all the branches and tags def checkoutRepo() { // Clean the workspace @@ -5,11 +14,7 @@ def checkoutRepo() { // Handles both PRs and branches script { - if (env.CHANGE_BRANCH) { - BRANCH_NAME_REAL = env.CHANGE_BRANCH - } else { - BRANCH_NAME_REAL = env.BRANCH_NAME - } + BRANCH_NAME_REAL = branchName(); } // Checkout the code from github @@ -17,7 +22,7 @@ def checkoutRepo() { branches: [ [name: 'refs/heads/' + BRANCH_NAME_REAL] ], - userRemoteConfigs: [[credentialsId: 'Github_User_And_Token', url: 'https://github.com/LORD-MicroStrain/libmip.git']], + userRemoteConfigs: [[credentialsId: 'Github_User_And_Token', url: 'https://github.com/LORD-MicroStrain/mip_sdk.git']], extensions: [ ] ]) @@ -25,84 +30,158 @@ def checkoutRepo() { pipeline { agent none + options { + // Set a timeout for the whole pipeline. The timer starts when the project is queued + timeout(time: 1, unit: 'HOURS') + } stages { stage('Build') { - // Run the windows and linux builds in parallel + // Run all the builds in parallel parallel { + stage('Documentation') { + agent { label 'linux-amd64' } + options { + skipDefaultCheckout() + timeout(time: 5, activity: true, unit: 'MINUTES') + } + steps { + script { + checkoutRepo() + env.setProperty('BRANCH_NAME', branchName()) + sh "./.devcontainer/docker_build.sh --os ubuntu --arch amd64 --docs" + archiveArtifacts artifacts: 'build_docs/mipsdk_*' + } + } + } stage('Windows x86') { agent { label 'windows10' } - options { skipDefaultCheckout() } + options { + skipDefaultCheckout() + timeout(time: 5, activity: true, unit: 'MINUTES') + } steps { - checkoutRepo() - powershell """ - mkdir build_Win32 - cd build_Win32 - cmake .. ` - -A "Win32" ` - -T "v142" ` - -DBUILD_DOCUMENTATION=ON ` - -DBUILD_PACKAGE=ON - cmake --build . -j - cmake --build . --target package - cmake --build . --target package_docs - """ - archiveArtifacts artifacts: 'build_Win32/mipsdk_*' + script { + checkoutRepo() + env.setProperty('BRANCH_NAME', branchName()) + powershell """ + mkdir build_Win32 + cd build_Win32 + cmake .. -A "Win32" -DMICROSTRAIN_BUILD_EXAMPLES=ON -DMICROSTRAIN_BUILD_PACKAGE=ON + cmake --build . --config Release + cmake --build . --config Release --target package + """ + archiveArtifacts artifacts: 'build_Win32/mipsdk_*' + } } } stage('Windows x64') { agent { label 'windows10' } - options { skipDefaultCheckout() } + options { + skipDefaultCheckout() + timeout(time: 5, activity: true, unit: 'MINUTES') + } steps { - checkoutRepo() - powershell """ - mkdir build_x64 - cd build_x64 - cmake .. ` - -A "x64" ` - -T "v142" ` - -DBUILD_PACKAGE=ON - cmake --build . -j - cmake --build . --target package - """ - archiveArtifacts artifacts: 'build_x64/mipsdk_*' + script { + checkoutRepo() + env.setProperty('BRANCH_NAME', branchName()) + powershell """ + mkdir build_x64 + cd build_x64 + cmake .. -DMICROSTRAIN_BUILD_EXAMPLES=ON -DMICROSTRAIN_BUILD_PACKAGE=ON + cmake --build . --config Release + cmake --build . --config Release --target package + """ + archiveArtifacts artifacts: 'build_x64/mipsdk_*' + } } } stage('Ubuntu amd64') { agent { label 'linux-amd64' } - options { skipDefaultCheckout() } + options { + skipDefaultCheckout() + timeout(time: 5, activity: true, unit: 'MINUTES') + } steps { - checkoutRepo() - sh "./.devcontainer/docker_build.sh --os ubuntu --arch amd64" - archiveArtifacts artifacts: 'build_ubuntu_amd64/mipsdk_*' + script { + checkoutRepo() + env.setProperty('BRANCH_NAME', branchName()) + sh "./.devcontainer/docker_build.sh --os ubuntu --arch amd64" + archiveArtifacts artifacts: 'build_ubuntu_amd64/mipsdk_*' + } } } - stage('Centos amd64') { - agent { label 'linux-amd64' } - options { skipDefaultCheckout() } + stage('Ubuntu arm64') { + agent { label 'linux-arm64' } + options { + skipDefaultCheckout() + timeout(time: 5, activity: true, unit: 'MINUTES') + } steps { - checkoutRepo() - sh "./.devcontainer/docker_build.sh --os centos --arch amd64" - archiveArtifacts artifacts: 'build_centos_amd64/mipsdk_*' + script { + checkoutRepo() + env.setProperty('BRANCH_NAME', branchName()) + sh "./.devcontainer/docker_build.sh --os ubuntu --arch arm64v8" + archiveArtifacts artifacts: 'build_ubuntu_arm64v8/mipsdk_*' + } + } + } + stage('Ubuntu arm32') { + agent { label 'linux-arm64' } + options { + skipDefaultCheckout() + timeout(time: 5, activity: true, unit: 'MINUTES') + } + steps { + script { + checkoutRepo() + env.setProperty('BRANCH_NAME', branchName()) + sh "./.devcontainer/docker_build.sh --os ubuntu --arch arm32v7" + archiveArtifacts artifacts: 'build_ubuntu_arm32v7/mipsdk_*' + } + } + } + stage("Mac M2") { + agent { label 'mac-m2' } + options { + skipDefaultCheckout() + timeout(time: 5, activity: true, unit: 'MINUTES') + } + steps { + script { + checkoutRepo() + env.setProperty('BRANCH_NAME', branchName()) + sh ''' + mkdir build_mac_arm64 + cd build_mac_arm64 + cmake .. -DMICROSTRAIN_BUILD_EXAMPLES=ON -DMICROSTRAIN_BUILD_PACKAGE=ON -DCMAKE_BUILD_TYPE=RELEASE + cmake --build . -j $(sysctl -n hw.ncpu) + cmake --build . --target package + ''' + archiveArtifacts artifacts: 'build_mac_arm64/mipsdk_*' + } + } + } + stage("Mac Intel") { + agent { label 'mac-intel' } + options { + skipDefaultCheckout() + timeout(time: 5, activity: true, unit: 'MINUTES') + } + steps { + script { + checkoutRepo() + env.setProperty('BRANCH_NAME', branchName()) + sh ''' + mkdir build_mac_intel + cd build_mac_intel + cmake .. -DMICROSTRAIN_BUILD_EXAMPLES=ON -DMICROSTRAIN_BUILD_PACKAGE=ON -DCMAKE_BUILD_TYPE=RELEASE + cmake --build . -j $(sysctl -n hw.ncpu) + cmake --build . --target package + ''' + archiveArtifacts artifacts: 'build_mac_intel/mipsdk_*' + } } } - // stage('Ubuntu arm64') { - // agent { label 'linux-arm64' } - // options { skipDefaultCheckout() } - // steps { - // checkoutRepo() - // sh "./.devcontainer/docker_build.sh --os ubuntu --arch arm64v8" - // archiveArtifacts artifacts: 'build_ubuntu_arm64v8/mipsdk_*' - // } - // } - // stage('Ubuntu arm32') { - // agent { label 'linux-arm64' } - // options { skipDefaultCheckout() } - // steps { - // checkoutRepo() - // sh "./.devcontainer/docker_build.sh --os ubuntu --arch arm32v7" - // archiveArtifacts artifacts: 'build_ubuntu_arm32v7/mipsdk_*' - // } - // } } } } @@ -135,7 +214,7 @@ pipeline { # Release to the latest version if the master commit matches up with the commit of that version if (cd "${WORKSPACE}" && git describe --exact-match --tags HEAD &> /dev/null); then # Publish a release - ./scripts/release.sh \ + ${WORKSPACE}/scripts/release.sh" \ --artifacts "$(find "$(pwd)" -type f)" \ --target "${BRANCH_NAME}" \ --release "$(cd ${WORKSPACE} && git describe --exact-match --tags HEAD)" \ diff --git a/README.md b/README.md index 3ce1688f9..498fc1ad9 100644 --- a/README.md +++ b/README.md @@ -28,20 +28,20 @@ Features Examples -------- - -* Get device information [[C++](./examples/device_info.cpp)] -* Watch IMU [[C](./examples/watch_imu.c) | [C++](./examples/watch_imu.cpp)] -* Threading [[C++](./examples/threading.cpp)] -* Ping [[C++](./examples/ping.cpp)] -* Product-specific examples: - * GQ7 setup [[C](./examples/GQ7/GQ7_example.c) | [C++](./examples/GQ7/GQ7_example.cpp)] - * CV7 setup [[C](./examples/CV7/CV7_example.c) | [C++](./examples/CV7/CV7_example.cpp)] - * GX5-45 setup [[C](./examples/GX5_45/GX5_45_example.c) | [C++](./examples/GX5_45/GX5_45_example.cpp)] - * CV7_INS setup [[C++](./examples/CV7_INS/CV7_INS_simple_example.cpp)] - * CV7_INS with UBlox setup [[C++](./examples/CV7_INS/CV7_INS_simple_ublox_example.cpp)] +| Example | | | Description | +|----------------------------------|-------------------------------------------------------------------|--------------------------------------------------------------|----------------------------------------------------------------------------------------------| +| Generic Examples | | | | +| Get device information | [C++](./examples/device_info.cpp) | | Queries the device strings and prints them to stdout. | +| Watch IMU | [C++](./examples/watch_imu.cpp) | [C](./examples/watch_imu.c) | Configures the IMU for streaming and prints the data to stdout. | +| Threading | [C++](./examples/threading.cpp) | | | +| Ping | [C++](./examples/ping.cpp) | | | +| Product-specific examples | | | | +| CV7 setup | [C++](./examples/CV7/CV7_example.cpp) | [C](./examples/CV7/CV7_example.c) | Configures a CV7 device for typical usage and includes an example of using the event system. | +| CV7_INS setup | [C++](./examples/CV7_INS/CV7_INS_simple_example.cpp) | | Configures a CV7_INS device for typical usage. | +| CV7_INS with UBlox setup | [C++](./examples/CV7_INS/CV7_INS_simple_ublox_example.cpp) | | Configures a CV7_INS device for typical usage with aiding data from a UBlox GNSS receiver. | +| GQ7 setup | [C++](./examples/GQ7/GQ7_example.cpp) | [C](./examples/GQ7/GQ7_example.c) | Configures a GQ7 device for typical usage in a wheeled-vehicle application. | +| GX5-45 setup | [C++](./examples/GX5_45/GX5_45_example.cpp) | [C](./examples/GX5_45/GX5_45_example.c) | Configures a GX5-45 device for typical usage in a wheeled-vehicle application. | +| GX5/CX5/CV5 -15 or -25 setup | [C++](./examples/CX5_GX5_CV5_15_25/CX5_GX5_CV5_15_25_example.cpp) | [C](./examples/CX5_GX5_CV5_15_25/CX5_GX5_CV5_15_25_example.c) | Configures a GX5-45 device for typical usage in a wheeled-vehicle application. | You'll need to enable at least one of the [communications interfaces](#communications-interfaces) in the CMake configuration to use the examples. @@ -81,7 +81,7 @@ See the documentation page for [Command Results](https://lord-microstrain.github In order to implement command timeouts and provide time of arrival information, this library requires applications to provide the time of received data. The time must be provided as an unsigned integral value with a reasonable precision, typically milliseconds since program startup. By default the timestamp type is set to `uint64_t`, but some embedded -applications may which to change this to `uint32_t` via the `MIP_TIMESTAMP_TYPE` define. Note that wraparound is +applications may wish to change this to `uint32_t` via the `MICROSTRAIN_TIMESTAMP_TYPE` define. Note that wraparound is permissible if the wraparound period is longer than twice the longest timeout used by the application. See the documentation page for [Timestamps](https://lord-microstrain.github.io/mip_sdk_documentation/latest/timestamps.html). @@ -98,7 +98,7 @@ A basic serial port interface is provided in C and C++ for Linux, Mac, and Windo The serial port connection will be used in most cases, when the MIP device is connected via a serial or USB cable (the USB connection acts like a virtual serial port). -[Enable it](#build-configuration) in the CMake configuration with `-DMIP_USE_SERIAL=1`. +[Enable it](#build-configuration) in the CMake configuration with `-DMICROSTRAIN_ENABLE_SERIAL=1`. ### TCP Client @@ -106,7 +106,7 @@ The TCP client connection allows you to connect to a MIP device remotely. The MI via the normal serial or USB cable to a computer system running a TCP server which forwards data between the serial port and TCP clients. -[Enable it](#build-configuration) in the CMake configuration with `-DMIP_USE_TCP=1`. +[Enable it](#build-configuration) in the CMake configuration with `-DMICROSTRAIN_ENABLE_TCP=1`. How to Build @@ -116,40 +116,45 @@ How to Build * A working C compiler * C11 or later required -* A working C++ compiler - * For C++ API only. Define `MIP_DISABLE_CPP=ON` if you don't want to use any C++. - * C++11 or later required for the mip library - * C++14 or later for the examples (currently CMakeLists.txt assumes C++14 is required regardless) + * Define `MICROSTRAIN_ENABLE_CPP=OFF` if you don't want to use any C++. Note that some features are only available in C++. +* A working C++ compiler, if using any C++ features + * C++14 or later is required. + * C++20 or later for metadata and associated examples * CMake version 3.10 or later (technically this is optional, see below) * Doxygen, if building documentation ### CMake Build Configuration The following options may be specified when configuring the build with CMake (e.g. `cmake .. -DOPTION=VALUE`): -* MIP_USE_SERIAL - Builds the included serial port library (default enabled). -* MIP_USE_TCP - Builds the included socket library (default enabled). -* MIP_USE_EXTRAS - Builds some higher level utility classes and functions that may use dynamic memory. -* MIP_ENABLE_LOGGING - Builds logging functionality into the library. The user is responsible for configuring a logging callback (default enabled) -* MIP_LOGGING_MAX_LEVEL - Max log level the SDK is allowed to log. If this is defined, any log level logged at a higher level than this will result in a noop regardless of runtime configuration. Useful if you want some logs, but do not want the overhead compiled into the code. -* MIP_ENABLE_DIAGNOSTICS - Adds some counters to various entities which can serve as a debugging aid. -* BUILD_EXAMPLES - If enabled (`-DBUILD_EXAMPLES=ON`), the example projects will be built (default disabled). -* BUILD_TESTING - If enabled (`-DBUILD_TESTING=ON`), the test programs in the /test directory will be compiled and linked. Run the tests with `ctest`. -* BUILD_DOCUMENTATION - If enabled, the documentation will be built with doxygen. You must have doxygen installed. -* BUILD_DOCUMENTATION_FULL - Builds internal documentation (default disabled). -* BUILD_DOCUMENTATION_QUIET - Suppress standard doxygen output (default enabled). -* MIP_DISABLE_CPP - Ignores .hpp/.cpp files during the build and does not add them to the project. -* BUILD_PACKAGE - Adds a `package` target to the project that will build a `.deb`, `.rpm`, or `.7z` file containing the library -* MIP_TIMESTAMP_TYPE - Overrides the default timestamp type. See the timestamps section in the documentation. + +| CMake Option | Default | Description | +|---------------------------------------|----------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| MICROSTRAIN_ENABLE_LOGGING | ON | Builds logging functionality into the library. The user is responsible for configuring a logging callback. | +| MICROSTRAIN_LOGGING_MAX_LEVEL | MICROSTRAIN_LOG_LEVEL_WARN | Max log level the SDK is allowed to log. If this is defined, any log level logged at a higher level than this will result in a noop regardless of runtime configuration. Useful if you want some logs, but do not want the overhead compiled into the code. | +| MICROSTRAIN_TIMESTAMP_TYPE | uint64_t | Overrides the default timestamp type. See [Timestamps](https://lord-microstrain.github.io/mip_sdk_documentation/latest/timestamps.html) in the documentation. | +| MICROSTRAIN_ENABLE_CPP | ON | Causes the src/cpp directory to be included in the build. Disable to turn off the C++ api. | +| MICROSTRAIN_ENABLE_EXTRAS | ON | Builds some higher level utility classes and functions that may use dynamic memory. | +| MICROSTRAIN_ENABLE_SERIAL | ON | Builds the included serial port library. | +| MICROSTRAIN_ENABLE_TCP | ON | Builds the included socket library (default enabled). | +| MICROSTRAIN_BUILD_PACKAGE | OFF | Adds a `package` target to the project that will build a `.deb`, `.rpm`, or `.zip` file containing the library | +| MICROSTRAIN_BUILD_EXAMPLES | OFF | If enabled, the example projects will be built. | +| MICROSTRAIN_BUILD_TESTS | OFF | If enabled, the test programs in the /test directory will be compiled and linked. Run the tests with `ctest`. | +| MICROSTRAIN_BUILD_DOCUMENTATION | OFF | If enabled, the documentation will be built with doxygen. You must have doxygen installed. | +| MICROSTRAIN_BUILD_DOCUMENTATION_FULL | OFF | Builds internal documentation. | +| MICROSTRAIN_BUILD_DOCUMENTATION_QUIET | ON | Suppress standard doxygen output. | +| MIP_ENABLE_DIAGNOSTICS | ON | Adds some counters to various entities which can serve as a debugging aid. | +| MIP_ENABLE_METADATA | ON if supported | Builds metadata for MIP commands. If not set, the system will try to determine if C++20 is available to enable it. C++20 is required for the metadata module. | +| MIP_ENABLE_EXTRAS | MICROSTRAIN_ENABLE_EXTRAS | Builds some higher level utility classes and functions that may use dynamic memory. (default MICROSTRAIN_ENABLE_EXTRAS) | ### Compilation 1. Create the build directory (e.g. `mkdir build`). 2. In the build directory, run `cmake .. ` - * Replace `` with your configuration options, such as `-DMIP_USE_SERIAL=1`. + * Replace `` with your configuration options, such as `-DMICROSTRAIN_ENABLE_SERIAL=1`. * You can use `cmake-gui ..` instead if you'd prefer to use the GUI tool (and have it installed). * An alternative generator may be used, such as ninja, code blocks, etc. by specifying `-G ` 3. Invoke `cmake --build .` in the build directory -4. (Optional, if BUILD_PACKAGE was enabled) Run `cmake --build . --target package` to build the packages. +4. (Optional, if MICROSTRAIN_BUILD_PACKAGE was enabled) Run `cmake --build . --target package` to build the packages. ### Building without CMake @@ -157,18 +162,34 @@ If your target platform doesn't support CMake, you can build the project without include all the necessary files and define a few options. #### Minimum Required Files for building without CMake -* Everything in `src/mip/definitions` (or at least all the descriptor sets you require) -* All the .c, .h, .cpp, and .hpp files in `src/mip` (exclude the c++ files if you're using plain C) -* The `byte_ring` and `serialization` .c/.h files in `src/mip/utils` -* You may optionally include the platform-related connection files (`serial_port.h/.c`) as desired. +##### C only +* All source files in `src/c/microstrain/common`, except logging.c if logging is disabled +* Source files in `src/c/microstrain/connections` for your required connection types +* All source files in `src/c/mip` and `src/c/mip/utils` +* All source files in `src/c/mip/definitions` (or at least all the required descriptor sets) +##### C++ +* The C files indicated above, except those in `definitions` (they can be added too but aren't required) +* Source files in `src/cpp/microstrain/connections` for your required connection types +* All source files in `src/cpp/microstrain` +* All source files in `src/cpp/mip/definitions` (or at least the required descriptor sets) +* Source files in `src/cpp/mip/extras` as needed for your project +* Source files in `src/cpp/mip/metadata` if using metadata #### Required #defines for building without CMake -Pass these to your compiler as appropriate, e.g. `arm-none-eabi-gcc -DMIP_TIMESTAMP_TYPE=uint32_t -DMIP_ENABLE_LOGGING=0` +Pass these to your compiler as appropriate, e.g. `arm-none-eabi-gcc -DMICROSTRAIN_TIMESTAMP_TYPE=uint32_t -DMICROSTRAIN_ENABLE_LOGGING=0` + +These defines must be set when building the MIP SDK sources and for any code that includes +MIP SDK headers. -* MIP_ENABLE_LOGGING (and MIP_LOGGING_MAX_LEVEL) - default is enabled -* MIP_TIMESTAMP_TYPE - defaults to uint64_t if not specified -* MIP_ENABLE_DIAGNOSTICS - Supported on embedded platforms to aid debugging +| Name | Description | +|-------------------------------|--------------------------------------------------------------------------------------| +| MICROSTRAIN_ENABLE_LOGGING | Enables logging facilities (e.g. via printf). | +| MICROSTRAIN_LOGGING_MAX_LEVEL | Disables logging more detailed messages (e.g. debug tracing) to improve performance. | +| MICROSTRAIN_TIMESTAMP_TYPE | Type to use for mip::Timestamp / mip::Timeout. Defaults to uint64_t if not defined. | +| MICROSTRAIN_USE_STD_ENDIAN | Define to 1 to enable the use of std::span from C++20. | +| MICROSTRAIN_USE_STD_SPAN | Define to 1 to enable the use of std::endian from C++20. | +| MIP_ENABLE_DIAGNOSTICS | Enables diagnostic counters. | These options affect the compiled code interface and sizes of various structs. They MUST be consistent between compiling the MIP SDK and any other code which includes @@ -178,7 +199,7 @@ rebuilt properly. Normally CMake takes care of this for you). Known Issues ------------ -* `suppress_ack=true` is not supported -* The commanded BIT, device settings, and capture gyro bias commands can time out unless the timeout is increased +* `suppress_ack=true` is not supported. +* The commanded BIT, device settings, and capture gyro bias commands can time out unless the timeout is increased. See the documentation page for [Known Issues](https://lord-microstrain.github.io/mip_sdk_documentation/latest/other.html#known_issues). diff --git a/cmake/check_cxx_support.cmake b/cmake/check_cxx_support.cmake new file mode 100644 index 000000000..c148cc507 --- /dev/null +++ b/cmake/check_cxx_support.cmake @@ -0,0 +1,30 @@ + +include(CheckIncludeFileCXX) + +CHECK_INCLUDE_FILE_CXX("span" MICROSTRAIN_COMPILER_SUPPORTS_SPAN) +CHECK_INCLUDE_FILE_CXX("bit" MICROSTRAIN_COMPILER_SUPPORTS_BIT) + + +include(CheckCXXSourceCompiles) + +check_cxx_source_compiles(" + +#if __cpp_constexpr < 201603L +#error \"Metadata not supported\" +#endif + +struct Foo +{ + int i = 0; + const char* s = nullptr; +}; + +static inline constexpr Foo foo = {5, \"12345\"}; + +int main() +{ + static_assert(foo.i == 5 && foo.s != nullptr, \"foo has wrong value\"); + return 0; +} + +" MIP_COMPILER_SUPPORTS_METADATA) diff --git a/cmake/microstrain_utilities.cmake b/cmake/microstrain_utilities.cmake new file mode 100644 index 000000000..9ceb10885 --- /dev/null +++ b/cmake/microstrain_utilities.cmake @@ -0,0 +1,153 @@ +# Install the headers in their +macro(microstrain_setup_install_headers LIBRARY ROOT_DIR) + include(GNUInstallDirs) + + # Only install headers that we build the source files for + get_target_property(ALL_HEADERS ${LIBRARY} SOURCES) + list(FILTER ALL_HEADERS INCLUDE REGEX "^.*\.(h|hpp)$") + + # Setup the include directory for each header within a MicroStrain subdirectory + foreach(HEADER ${ALL_HEADERS}) + # Replace the source directory with the installer include directory (within a MicroStrain subdirectory) + string(REPLACE + "${ROOT_DIR}" + "${CMAKE_INSTALL_INCLUDEDIR}/microstrain" + HEADER_DESTINATION_FULL + "${HEADER}" + ) + + # Get the install directory without the file + get_filename_component(HEADER_DESTINATION "${HEADER_DESTINATION_FULL}" DIRECTORY) + + install( + FILES "${HEADER}" + DESTINATION "${HEADER_DESTINATION}" + ) + endforeach() +endmacro() + +macro(microstrain_setup_library_install LIBRARY ROOT_DIR) + install( + TARGETS ${LIBRARY} + EXPORT ${LIBRARY}-targets + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) + + microstrain_setup_install_headers(${LIBRARY} ${ROOT_DIR}) + +# include(CMakePackageConfigHelpers) + +# set(CONFIG_EXPORT_DIR "${CMAKE_INSTALL_DATADIR}/cmake/${LIBRARY}") + + # TODO: Do we want this configure step? What is it used for? +# install( +# FILES "${CMAKE_BINARY_DIR}/${LIBRARY}-config.cmake" "${CMAKE_BINARY_DIR}/${LIBRARY}-config-version.cmake" +# DESTINATION ${CONFIG_EXPORT_DIR} +# COMPONENT ${LIBRARY} +# ) +endmacro() + +# +# Utility macros to write to output variables +# Do not call these in the conventional way I.E. macro_name(${VARIABLE_NAME}) +# Instead, do macro_name(VARIABLE_NAME) which will do `set(${PARAM_OUT} value)` and is equivalent to set(VARIABLE_NAME value) +# + +macro(microstrain_get_git_version GIT_VERSION_OUT GIT_VERSION_CLEAN_OUT) + # Use Git to find the version + find_package(Git) + + set(MICROSTRAIN_DEFAULT_GIT_VERSION "v0.0.0") + + if(NOT GIT_FOUND) + message(WARNING "Unable to find Git, will build with unknown version") + set(${GIT_VERSION_OUT} ${MICROSTRAIN_DEFAULT_GIT_VERSION}) + else() + execute_process( + COMMAND ${CMAKE_COMMAND} -E env ${GIT_EXECUTABLE} describe --tags + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + OUTPUT_VARIABLE MICROSTRAIN_GIT_VERSION_OUT + ERROR_VARIABLE MICROSTRAIN_GIT_VERSION_ERR + RESULT_VARIABLE MICROSTRAIN_GIT_VERSION_RET + ) + if(NOT ${MICROSTRAIN_GIT_VERSION_RET} EQUAL 0) + message(STATUS "Unable to determine version from Git, defaulting to version ${MICROSTRAIN_DEFAULT_GIT_VERSION}") + set(${GIT_VERSION_OUT} ${MICROSTRAIN_DEFAULT_GIT_VERSION}) + else() + set(${GIT_VERSION_OUT} ${MICROSTRAIN_GIT_VERSION_OUT}) + string(REGEX REPLACE "\n" "" ${GIT_VERSION_OUT} "${${GIT_VERSION_OUT}}") + message(STATUS "Determined version from Git: ${${GIT_VERSION_OUT}}") + endif() + endif() + + # Massage the version number a little so we can use it in a couple places + string(REGEX REPLACE "^v?([0-9]+)\\.([0-9]+)\\.([0-9]+).*" "\\1.\\2.\\3" ${GIT_VERSION_CLEAN_OUT} ${${GIT_VERSION_OUT}}) +endmacro() + +# Use the variable name not value for GIT_VERSION_CLEAN to lookup the version and also set it +# This is a followup macro for microstrain_get_git_version +# I.E. microstrain_extract_git_version(MICROSTRAIN_GIT_VERSION_CLEAN MICROSTRAIN_GIT_VERSION_MAJOR ...) +macro(microstrain_extract_git_version GIT_VERSION_CLEAN GIT_VERSION_MAJOR_OUT GIT_VERSION_MINOR_OUT GIT_VERSION_PATCH_OUT) + if(NOT DEFINED ${GIT_VERSION_CLEAN}) + message(WARNING "Use the name to use for the variable GIT_VERSION_CLEAN instead of passing the value") + endif() + + string(REPLACE "." ";" MICROSTRAIN_GIT_VERSION_LIST ${${GIT_VERSION_CLEAN}}) + list(LENGTH MICROSTRAIN_GIT_VERSION_LIST MICROSTRAIN_GIT_VERSION_LIST_LENGTH) + + if(MICROSTRAIN_GIT_VERSION_LIST_LENGTH GREATER_EQUAL 3) + list(GET MICROSTRAIN_GIT_VERSION_LIST 0 ${GIT_VERSION_MAJOR_OUT}) + list(GET MICROSTRAIN_GIT_VERSION_LIST 1 ${GIT_VERSION_MINOR_OUT}) + list(GET MICROSTRAIN_GIT_VERSION_LIST 2 ${GIT_VERSION_PATCH_OUT}) + else() + message(WARNING "Version cannot be parsed into a semantic version string.\nPlease run 'git fetch --tags' to get a properly tagged build") + set(${GIT_VERSION_CLEAN} "0.0.0") + set(${GIT_VERSION_MAJOR_OUT} 0) + set(${GIT_VERSION_MINOR_OUT} 0) + set(${GIT_VERSION_PATCH_OUT} 0) + endif() +endmacro() + +# Try to determine what architecture we are building for based on the compiler output +# Specify the variable to set as the parameter +macro(microstrain_get_architecture SYS_ARCH_OUT) + if(MSVC) + # Detect if this is a x64 or x86 build + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(${SYS_ARCH_OUT} "x64") + elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(${SYS_ARCH_OUT} "x86") + endif() + elseif(UNIX) + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + # The dumpmachine command from gcc should contain information on the architecture + execute_process( + COMMAND ${CMAKE_COMMAND} -E env /bin/bash -c "${CMAKE_CXX_COMPILER} -dumpmachine" + OUTPUT_VARIABLE MICROSTRAIN_GCC_ARCHITECTURE_OUT + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + ERROR_VARIABLE MICROSTRAIN_GCC_ARCHITECTURE_ERR + RESULT_VARIABLE MICROSTRAIN_GCC_ARCHITECTURE_RET + ) + + # Convert the GCC architecture to the format that we use + if("${MICROSTRAIN_GCC_ARCHITECTURE_OUT}" MATCHES ".*x86_64.*") + set(${SYS_ARCH_OUT} "amd64") + elseif("${MICROSTRAIN_GCC_ARCHITECTURE_OUT}" MATCHES ".*aarch64.*") + set(${SYS_ARCH_OUT} "arm64") + elseif("${MICROSTRAIN_GCC_ARCHITECTURE_OUT}" MATCHES ".*arm.*") + set(${SYS_ARCH_OUT} "armhf") + else() + message(STATUS "Unrecognized GCC architecture ${MICROSTRAIN_GCC_ARCHITECTURE_OUT}. Using CMAKE_SYSTEM_PROCESSOR for architecture") + endif() + endif() + endif() + + if(NOT DEFINED ${SYS_ARCH_OUT}) + message(STATUS "Defaulting ${SYS_ARCH_OUT} to ${CMAKE_SYSTEM_PROCESSOR}") + set(${SYS_ARCH_OUT} ${CMAKE_SYSTEM_PROCESSOR}) + else() + message(STATUS "Detected system architecture ${${SYS_ARCH_OUT}}") + endif() +endmacro() diff --git a/cmake/mip_version.h.in b/cmake/mip_version.h.in index 95cdf4df6..18ed3a5ea 100644 --- a/cmake/mip_version.h.in +++ b/cmake/mip_version.h.in @@ -7,4 +7,4 @@ #define MIP_SDK_VERSION "${MIP_GIT_VERSION_CLEAN}" #define MIP_SDK_VERSION_MAJOR ${MIP_GIT_VERSION_MAJOR} #define MIP_SDK_VERSION_MINOR ${MIP_GIT_VERSION_MINOR} -#define MIP_SDK_VERSION_PATCH ${MIP_GIT_VERSION_PATCH} \ No newline at end of file +#define MIP_SDK_VERSION_PATCH ${MIP_GIT_VERSION_PATCH} diff --git a/docs/cpp.md b/docs/cpp.md new file mode 100644 index 000000000..9bb123c0f --- /dev/null +++ b/docs/cpp.md @@ -0,0 +1,46 @@ +C++ Standard Support {#cpp_standards} +==================== + +The MIP SDK requires at least C++14 support, but some parts of the MIP SDK can make use of newer C++ features. +These parts are guarded by `#ifdefs` for the `__cplusplus` version or [feature test macros](https://en.cppreference.com/w/cpp/feature_test) +and they will be safely ignored if your compiler lacks support. + +In a few cases however, this can be dangerous when the MIP SDK is built as a library (e.g., MicroStrain +pre-built versions from github) and then gets used in a project with a different C++ standard version. If the `#ifdef` +guards cause a different implementation to be selected, then there is a mismatch and a violation of the one-definition +rule. This can cause linker errors or mysterious crashes and odd behavior. To avoid this, the MIP SDK requires that the +user explicitly opt-in to certain C++ features. This "opt-in" choice must be made identically when the library is +compiled and then in the project where it is used (this includes anywhere the MIP SDK headers are included). + +std::span +--------- + +A "span" in C++ parlance is the combination of a pointer and length, typically representing a view of an array. The +MIP SDK provides an implementation called `microstrain::Span`, which tries to be compatible with `std::span` from C++20. +It includes most, but not all, features from the standard version. If your compiler supports it, you may use `std::span` +instead by defining `MICROSTRAIN_USE_STD_SPAN`. This will replace the microstrain span implementation with a +typedef to `std::span`. + +https://en.cppreference.com/w/cpp/container/span + +std::endian +----------- + +The serialization system requires a notion of endianness. By default, an enum called `microstrain::Endian` is defined +which provides integer constants representing big and little endianness. If your compiler supports `std::endian` from +C++20, you may define `MICROSTRAIN_USE_STD_ENDIAN` in your project. This will replace the microstrain enum with a +typedef to `std::endian`. + +https://en.cppreference.com/w/cpp/types/endian + +Other Optional C++ Features +--------------------------- + +These features can be used with the MIP SDK if your compiler supports them. No special `#defines` are necessary as +compiled library code is not affected by the choice. They are used by header-only features and no alternative +implementations are supplied with which they could conflict. + +* [std::apply](https://en.cppreference.com/w/cpp/utility/apply) +* [fold expressions](https://en.cppreference.com/w/cpp/language/fold) +* [constexpr if](https://en.cppreference.com/w/cpp/language/if) +* [std::optional](https://en.cppreference.com/w/cpp/utility/optional) diff --git a/docs/docs.c b/docs/docs.c deleted file mode 100644 index 82cba0c54..000000000 --- a/docs/docs.c +++ /dev/null @@ -1,543 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -///@mainpage MIP SDK -/// -/// Welcome to the official MIP Software Development Kit. This software package -/// provides everything you need to communicate with any MIP-compatible -/// MicroStrain inertial sensor. -/// See @ref mip_interface for details on how to get started. -/// -///@par Main Features -/// -///@li MIP packet creation -///@li Send commands using a single function -///@li Packet parsing and field iteration -///@li Data field deserialization -///@li Simple interface requires only two functions to be defined -///@li Can be used to parse offline binary files -///@li Dual C and C++ API for maximum usability, safety, flexibility, and convenience. -///@li Suitable for bare-metal microcontrollers (Minimal code size and memory footprint, No dynamic memory allocation, No dependence on any RTOS or threading) -/// -///@section quickref_cpp Quick Reference [C++] -/// -/// All C++ functions and classes reside within the mip namespace. -/// The C functions can be accessed via the mip::C namespace. -/// -///@li @ref mip::DeviceInterface Top-level MIP interface class. -///@li @ref mip::PacketRef An interface to a MIP packet for either transmission or reception. -///@li @ref mip::PacketBuf Similar to PacketRef but includes the data buffer. -///@li @ref mip::Field An interface to a MIP field within a packet. -///@li @ref mip::Parser MIP parser class for converting received bytes into packets. -///@li @ref mip::CmdResult Stores the status or result of a MIP command. -/// -///@section quickref_c Quick Reference [C] -/// -/// C does not support the equivalent of C++ namespaces, so all definitions are -/// global. Most names start with `mip_` to avoid conflicts. -/// In these documentation pages, objects are referred to by their fully- -/// qualified C++ names for clarity. -/// -///@li @ref mip_interface_c -///@li @ref mip_packet_c -///@li @ref mip_field_c -///@li @ref mip_parser_c -///@li @ref mip::C::mip_cmd_result "mip_cmd_result [C]" -/// -/// -//////////////////////////////////////////////////////////////////////////////// -///@page mip_interface Mip Interface -//////////////////////////////////////////////////////////////////////////////// -/// -//////////////////////////////////////////////////////////////////////////////// -///@section mip_interface_interface Application Interface -/// -/// The MIP interface is a high-level abstraction of a physical device which -/// communicates using the MIP protocol. It provides both data callbacks and -/// command functions for controlling and configuring the device: -/// -///@image html mip_interface.svg -/// -/// When an application calls one of the command functions, the MIP interface -/// creates a packet, sends it to the device, and waits for a reply. When the -/// reply is received, the command function returns the reply code to the -/// application. If no reply is received, or if an error occurs, the function -/// will return a status code. -/// -/// Sending and receiving to or from the device occurs via two functions: -///@li mip::DeviceInterface::sendToDevice() or -/// mip_interface_send_to_device() for transmission and -///@li mip::DeviceInterface::recvFromDevice() or -/// mip_interface_recv_from_device() for reception. -/// -/// Each of these has a corresponding callback to the application. The -/// application is expected to implement the required behavior for each as -/// described below. Additionally, there is an @ref update "update function", -/// which handles periodic tasks such as command timeouts and streaming data -/// collection. An application may optionally override the update callback. -/// -///@li @ref mip::C::mip_send_callback "mip_send_callback" -///@li @ref mip::C::mip_recv_callback "mip_recv_callback" -///@li @ref mip::C::mip_update_callback "mip_update_callback" -/// -/// An application obtains sensor data via the -/// @ref mip_dispatch "dispatch subsystem". There are 3 ways to do so: -///@li Packet callbacks, which call a function when a packet matching the -/// MIP descriptor set is received, -///@li Field callbacks, which call a function when a MIP field matching the -/// descriptor set and field descriptor is called, and -///@li Data pointers, which point to a data structure in memory and update it -/// when the associated data is received. -/// -/// -//////////////////////////////////////////////////////////////////////////////// -///@section mip_commands Sending Commands -/// -/// Typically an application will configure the device, initialize some -/// settings, and start streaming. To do so, it must send commands. In many -/// cases, applications will call a single function for each needed command -/// (e.g. @ref MipCommands_c / @ref MipCommands_cpp). -/// These functions take the command parameters as arguments, send the packet, -/// wait for the reply, and return a result code. Additionally some commands can -/// report back responses from the device. -/// -/// The command functions are blocking, that is, they halt execution until the -/// device responds or the command times out. -/// -/// Note that since MIP data is received serially and is not buffered, data may -/// be received and processed while waiting for command responses. It is -/// recommended (but not required) to set the device to idle during configuration. -/// -//////////////////////////////////////////////////////////////////////////////// -///@section mip_dispatch The Dispatch System -/// -/// Because of the limited resources on embedded platforms, the MIP SDK will not -/// buffer received data, and instead requires the application to process data -/// as it arrives. The MIP interface will dispatch callbacks to the application -/// when the requested data is received. -/// -/// The MIP interface can dispatch data in 3 ways: -///@li Packet callbacks, which call a function with a mip packet, -///@li Field callbacks, which call a function with a single mip field, and -///@li Data pointers, which are updated with data from a single mip field. -/// -/// With the first two options, the callback function will receive a handle to -/// the MIP interface, the associated MIP packet or field, and the reception -/// timestamp. -/// -/// An application must register callbacks with the system during -/// initialization. Each method requires a pointer and the MIP descriptor -/// associated with the data of interest. There is no limit on the number -/// of registered dispatchers, though performance may be affected by using -/// too many. Multiple dispatchers may be registered to the same data. -/// -///@par Packet callbacks -/// -///@code{.cpp} -/// void packet_callback(void* userdata, const mip::PacketRef& packet, Timestamp parseTime) -///@endcode -/// -/// Packet callbacks are invoked when a packet is received which matches the -/// registered descriptor set. The descriptor set may also be a wildcard, -/// allowing the application to process any type of packet. -/// -/// An application can register a packet callback to occur either before or -/// after the field callbacks for the data in the same packet. For example, -/// to print a summary of the packet before displaying information about each -/// field, an application would set the callback to occur first. Usually -/// applications will set a packet callback to occur last, so that they can -/// determine if all of the fields have been processed. -/// -///@par Field callbacks -/// -///@code{.cpp} -/// void field_callback(void* userdata, const mip::Field& field, Timestamp parseTime) -///@endcode -/// -/// Similar to packet callbacks, field callbacks are invoked when a MIP -/// field is received which matches the specified descriptor set and -/// field descriptor. Either descriptor may be a wildcard. -/// -///@par Data pointers -/// -/// Data pointer dispatchers can alleviate a lot of boilerplate code having to -/// do with deserializing a MIP field and storing it somewhere. An application -/// can register a pointer one of the MIP data structures, along with the -/// associated descriptors, and have it automatically updated. The descriptors -/// cannot be wildcards because the type of the data structure is fixed. -/// -///@par Data callbacks -/// -///@code{.cpp} -/// void data_callback(void* userdata, const mip::data_sensor::ScaledAccel& packet, Timestamp parseTime) -///@endcode -/// -/// Thanks to the power of templates, one additional dispatch mechanism is -/// available for C++ applications. A data callback is similar to a field -/// callback except that instead of getting the raw MIP field data, the function -/// is passed the fully-deserialized data structure. -/// -/// -/// Typically an application will register a series of data or field callbacks -/// and write the data to some kind of data structure. Because the order of -/// these callbacks depends on the device configuration, it can be difficult -/// to know which fields belong together in one sample. The solution is to use -/// a packet callback after all of the fields are received. In the case of -/// wraparound "overflow" MIP packets (see the MIP documentation), packets -/// containing a shared timestamp or event source field at the beginning can -/// be used to group data together. -/// -/// -//////////////////////////////////////////////////////////////////////////////// -///@section update The Update Function -/// -/// The application should call mip_interface_update() periodically to process -/// data sent by the device. This update function will call -/// mip_interface_recv_from_device() to parse packets. When a data packet is -/// received, the list of packet and data callbacks is checked, and any -/// matching callbacks are invoked. The update function should be called at -/// a high enough rate to avoid overflowing the connection buffers. The -/// precision of the reception timestamp is dependent on the update rate. -/// -/// The command functions in @ref MipCommands_c / @ref MipCommands_cpp (e.g. mip::C::mip_write_message_format() / mip::writeMessageFormat()) -/// will block execution until the command completes. Either the device will -/// respond with an ack/nack code, or the command will time out. During this -/// time, the system must be able to receive data from the device in order for -/// command replies to be detected. This occurs via the mip_interface_update() -/// function as well. -/// -///@par Single-threaded applications -/// -/// For single-threaded applications, data can be read from the port directly -/// from within the command function. While the command is waiting (status code -/// MIP_STATUS_WAITING / CmdResult::STATUS_WAITING), repeated calls to the -/// update function will be made. By default, the update function calls -/// mip_interface_recv_from_device(). Because the function is called from -/// within a loop, it should sleep for a short time to wait for data if none -/// has been received yet. Doing so prevents excessive CPU usage and lowers -/// power consumption. -/// -/// The following diagram shows the typical control flow for a single-threaded -/// application. First, the device is configured by setting the message format. -/// Execution flows down into the command processing functions until -/// mip_interface_wait_for_reply() is called. This will repeatedly call -/// mip_interface_update() to pump packets from the device through the system, -/// until either an ack/nack is received or the command times out. -/// Once the device acknowledges the command, control is returned to the -/// application which then registers some data or packet callbacks. It finally -/// goes into a loop in collect_data(). Inside this loop, the update function -/// is called to process data packets. -/// -/// Notice that the same update function is called from both the command -/// function and the data collection loop. If any data packets are received -/// while waiting for a command reply, associated callbacks may be executed. -/// This is why this example application registers its callbacks after the -/// format is configured properly. -/// -///@image html device_update.svg -/// -///@par Multi-threaded applications -/// -/// For some applications, it may be desirable to run all of the data collection -/// from a separate thread. In this case, the command functions must not -/// call the update function as that would cause a race condition between the -/// command thread and the data thread. Instead, the command thread should -/// simply sleep or yield and let the data thread process the ack/nack packet. -/// -/// To allow this behavior, the update function takes a boolean parameter which -/// is true when waiting on a command and false when processing data. The -/// default update function, mip_interface_default_update(), ignores this flag, -/// but applications may override it via mip_interface_set_update_function(). In -/// this case, a wrapper function can be created which implements the above -/// behavior: -///@code{.c} -/// bool user_update_function(struct mip_device* device, bool blocking) -/// { -/// // If called from the data thread, do the normal processing. -/// if( !blocking ) -/// return mip_interface_default_update(device, blocking); -/// -/// // Otherwise, sleep and let the data thread process the reply. -/// std::this_thread::sleep_for(std::chrono::milliseconds(10)); -/// return true; -/// } -/// -/// mip_interface_set_update_function(device, &user_update_function); -///@endcode -/// -///@image html device_update_threaded.svg -/// -/// See the threading demo for an example application. -/// -///@par Other thread-safety concerns -/// -///@li Data transmission to the device (but not sending commands) is thread-safe -/// within the MIP SDK. If multiple threads will send to the device, the -/// application should ensure that the device interface is properly protected. -/// -///@li It is up to the application to ensure that sending and receiving from -/// separate threads is safe. This is true for the built-in serial and TCP -/// connections on most operating systems. -/// -///@par Using a custom update function for other purposes -/// -/// An alternate update function may be used for single-threaded -/// applications, too: -///@li To update a progress bar while waiting for commands to complete -///@li To process data from other devices -///@li To avoid blocking inside mip_interface_recv_from_device() when -/// called from a data processing loop. -///@li To push data through the system in a different way (e.g. without using -/// mip_interface_recv_from_device()) -/// -/// Data may be pushed into the system by calling any of these functions: -///@li mip_interface_default_update() - this is the default behavior. -///@li mip_interface_receive_bytes() - process bytes, given a buffer. -///@li mip_interface_receive_packet() - process pre-parsed packets. -///@li mip_interface_process_unparsed_packets() - continue parsing buffered data. -/// -/// -//////////////////////////////////////////////////////////////////////////////// -///@page parsing_packets Mip Parser -//////////////////////////////////////////////////////////////////////////////// -/// -/// The MIP Parser takes in bytes from the device connection or recorded binary -/// file and extracts the packet data. Data is input to the ring buffer and -/// packets are parsed out one at a time and sent to a callback function. -/// -/// The parser uses a ring buffer to store data temporarily between reception -/// and parsing. This helps even out processor workload on embedded systems -/// when data arrives in large bursts. -/// -///@image html mip_parser.svg -/// -//////////////////////////////////////////////////////////////////////////////// -///@section parsing_data Parsing Data -/// -/// Data is supplied by calling mip_parser_parse() / mip::Parser::parse() with -/// a buffer and length. Along with the data, the user must provide a timestamp. -/// The timestamp serves two purposes: to provide a time of reception indicator -/// and to allow the parser to time out waiting for more data. -/// -/// The parse function takes an additional parameter, `max_packets`, which -/// limits the number of packets parsed. This can be used to prevent a large -/// quantity of packets from consuming too much CPU time and denying service -/// to other subsystems. If the limit is reached, parsing stops and the -/// unparsed portion of the data remains in the ring buffer. The constant value -///@ref MIPPARSER_UNLIMITED_PACKETS disables this limit. -/// -/// To continue parsing, call the parse function again. You may choose to -/// not supply any new data by passing NULL and a length of 0. The timestamp -/// should be unchanged from the previous call for highest accuracy, but it's -/// permissible to use the current time as well. If new data is supplied, the -/// new data is appended to the ring buffer and parsing resumes. The timestamp -/// should be the time of the new data. Previously received but unparsed packets -/// will be assigned the new timestamp. -/// -/// The application must parse enough packets to keep up with the incoming -/// data stream. Failure to do so will result in the ring buffer becoming -/// full. If this happens, the parse function will return a negative number, -/// indicating the number of bytes that couldn't be copied. This will never -/// happen if max_packets is `MIPPARSER_UNLIMITED_PACKETS` because all -/// of the data will be processed as soon as it is received. -/// -//////////////////////////////////////////////////////////////////////////////// -///@section ring_buffer The Ring Buffer -/// -/// The ring buffer's backing buffer is a byte array that is allocated by -/// the application during initialization. It must be large enough to store -/// the biggest burst of data seen at any one time. For example, applications -/// expecting to deal with lots of GNSS-related data will need a bigger buffer -/// because there may be a large number of satellite messages. These messages -/// are sent relatively infrequently but contain a lot of data. If max_packets -/// is `MIPPARSER_UNLIMITED_PACKETS`, then it needs only 512 bytes (enough for -/// one packet, rounded up to a power of 2). -/// -/// In addition to passing data to the parse function, data can be written -/// directly to the ring buffer by obtaining a writable pointer and length -/// from mip_parser_get_write_ptr(). This may be more efficient by skipping a -/// copy operation. Call mip_parser_process_written() to tell the parser how -/// many bytes were written to the pointer. Note that the length returned by -/// `mip_parser_get_write_ptr` can frequently be less than the total -/// available space. An application should call it in a loop as long as there -/// is more data to process and the returned size is greater than 0. -/// -//////////////////////////////////////////////////////////////////////////////// -///@section packet_timeouts Packet Timeouts -/// -/// In some cases it's possible for a packet to be corrupted during -/// transmission or reception (e.g. EMI while in transit on the wire, serial -/// baud rate too low, etc). If the payload length byte is corrupted, it may -/// falsely indicate that the packet is longer than what was sent. Without a -/// timeout, the parser would wait until this extra data (potentially up to 255 -/// bytes) was received before checking and realizing that the checksum failed. -/// Any following packets would be delayed, possibly causing additional commands -/// to time out and make the device appear temporarily unresponsive. Setting a -/// reasonable timeout ensures that the bad packet is rejected more quickly. -/// The timeout should be set so that a MIP packet of the largest possible -/// size (261 bytes) can be transferred well within the transmission time plus -/// any additional processing delays in the application or operating system. -/// As an example, for a 115200 baud serial link a timeout of 30 ms would be -/// about right. You can use the mip_timeout_from_baudrate() function to -/// compute an appropriate timeout. -/// -///@see mip_timestamp -///@see mip::Timestamp -/// -//////////////////////////////////////////////////////////////////////////////// -///@section parsing_process The Packet Parsing Process -/// -/// Packets are parsed from the internal ring buffer one at a time in the parse -/// function. -/// -/// If a packet was previously started but not completed previously (due to -/// requiring more data) then the timeout is checked. If too much time has -/// passed, the packet is discarded and the parsing state reset. This check is -/// only performed once per parse call because that is the only point where the -/// timestamp changes. -/// -///@image html parse_function.svg -/// -/// The current status is held by the `expected_length` variable, which tracks -/// how many bytes are expected to be in the current packet. The parse function -/// enters a loop, checking if there is enough data to complete the next parsing -/// step. -/// -///@image html parse_one_packet.svg -/// -/// `expected_length` starts out as 1 when the parser is searching for the start -/// of a packet. Once a potential start byte (`SYNC1`) is found, the packet's -/// start time is initialized to the current timestamp and `expected_length` is -/// bumped up to the size of a mip packet header (4 bytes). -/// -/// When the expected length is 4 bytes, the header's SYNC2 byte is checked for -/// validity and the payload length field is read. `expected_length` is set to -/// the full packet size (computed as the packet header and checksum size plus -/// the payload size). -/// -/// Finally, when `expected_length` is neither of the above two conditions, it -/// means that the entire packet has been received. Note that other values less -/// than 6 (the size of an empty packet) are not possible. At this point, the -/// data is copied out from the ring buffer to a linear buffer for processing. -/// The checksum is verified, and if it passes, the entire packet is dropped -/// from the ring buffer and the callback function is invoked. -/// -/// If any of the checks in the above steps fails, such as a wrong SYNC2 byte, -/// a single byte is dropped from the ring buffer and the loop is continued. -/// Only a single byte can be dropped, because rogue SYNC1 bytes or truncated -/// packets may hide real mip packets in what would have been their payload. -/// -//////////////////////////////////////////////////////////////////////////////// -///@page command_results Command Result -//////////////////////////////////////////////////////////////////////////////// -/// -///@li @ref mip::C::mip_cmd_result "mip_command_result [C]" -///@li @ref mip::CmdResult "CmdResult [C++]" -/// -/// Command results are divided into two categories, reply codes and status -/// codes. Reply codes are returned by the device, e.g.: -///@li ACK_OK -///@li Unknown command (NACK_COMMAND_UNKNOWN) -///@li Invalid parameter (NACK_INVALID_PARAM) -///@li Command failed (NACK_COMMAND_FAILED) -/// The values of these enums match the corresponding values returned by the -/// device. They are non-negative integers. -/// -/// Status codes are set by this library, e.g.: -///@li General error (STATUS_ERROR) -///@li Timeout (STATUS_TIMEDOUT) -///@li Other statuses are used to track commands in progress -///@li User status codes can also be set (STATUS_USER). -/// -/// All of these are negative integers. -/// -/// You can use `mip_cmd_result_is_reply_code()` / `CmdResult::isReplyCode()` and -/// `mip_cmd_result_is_status_code()` / `CmdResult::isStatusCode()` to distinguish -/// between them. -/// -/// In C++, CmdResult is implicitly convertible to bool. ACK_OK converts to true -/// while everything else converts to false. This allows compact code like -///@code{.cpp} -/// if( !resume(device) ) // resume returns a CmdResult -/// fprintf(stderr, "Failed to resume the sensor\n"); -///@endcode -/// -/// For debugging, the name of command results is available via -/// mip_cmd_result_to_string() / CmdResult::name() -/// -/// In C++, CmdResult defaults to the initial state CmdResult::STATUS_NONE. -/// -//////////////////////////////////////////////////////////////////////////////// -///@page timestamps Timestamps and Timeouts -//////////////////////////////////////////////////////////////////////////////// -/// -///@section timestamp_type Timestamp Type -/// Timestamps (`mip_timestamp` / `Timestamp`) represent the local time when data was received or a packet was parsed. These timestamps -/// are used to implement command timeouts and provide the user with an approximate timestamp of received data. It is not intended to be -/// a precise timestamp or used for synchronization, and it generally cannot be used instead of the timestamps from the connected MIP device. -/// In particular, if you limit the maximum number of packets processed per `update` call, the timestamp of some packets may be delayed. -/// -/// Because different applications may keep track of time differently (especially on embedded platforms), it is up to the user to provide -/// the current time whenever data is received from the device. On a PC, this might come from the posix `clock()` function or from the -/// `std::chrono` library. On ARM systems, it is often derived from the Systick timer. It should be a monotonically increasing value; -/// jumps backwards in time (other than due to wraparound) will cause problems. -/// -/// By default, timestamps are `typedef`'d to `uint64_t`. Typically timestamps are in milliseconds. Embedded systems may wish to use -/// `uint32_t` or even `uint16_t` instead. The value is allowed to wrap around as long as the time between wraparounds is longer than -/// twice the longest timeout needed. If higher precision is needed or wraparound can't be tolerated by your application, define it to -/// `uint64_t`. It must be a standard unsigned integer type. -/// -///@section Command Timeouts -/// -/// Timeouts for commands are broken down into two parts. -/// * A "base reply timeout" applies to all commands. This is useful to compensate for communication latency, such as over a TCP socket. -/// * "Additional time" which applies per command, because some commands may take longer to complete. -/// -/// Currently, only the C++ api offers a way to set the additional time parameter, and only when using the `runCommand` function taking -/// the command structure and the `additionalTime` parameter. -/// -/// The `mip_timeout` / `mip::Timeout` typedef is an alias to the timestamp type. -/// -//////////////////////////////////////////////////////////////////////////////// -///@page other Other Considerations -//////////////////////////////////////////////////////////////////////////////// -/// -///@section known_issues Known Issues and Workarounds -/// -///@par suppress_ack parameters are not supported -/// -/// Some commands accept a parameter named `suppress_ack` which acts to prevent -/// the standard ack/nack reply from being returned by the device, e.g. the -/// 3DM Poll Data command. Use of this parameter is not supported in the MIP SDK -/// and will cause the command to appear to time out after a short delay. -/// -/// If you do not wish to wait for a reply (i.e. just send the command and continue) -/// you can build and send the command yourself: -///@code{.cpp} -/// // Create the command with required parameters. -/// mip::commands_3dm::PollData cmd; -/// cmd.desc_set = mip::data_sensor::DESCRIPTOR_SET; -/// cmd.suppress_ack = true; -/// cmd.num_descriptors = 2; -/// cmd.descriptors[0] = mip::data_sensor::ScaledAccel::FIELD_DESCRIPTOR; -/// cmd.descriptors[1] = mip::data_sensor::ScaledGyro::FIELD_DESCRIPTOR; -/// // Build a packet. -/// mip::PacketBuf packet(cmd); -/// // Send it to the device. -/// device.sendCommand(packet); -///@endcode -/// -///@par Some commands take longer and may time out -/// -/// This applies to the following commands: -///@li Save All Settings (`mip::commands_3dm::DeviceSettings` with `mip::FunctionSelector::SAVE`) -///@li Commanded Built-In Test (`mip::commands_base::BuiltInTest`) -///@li Capture Gyro Bias (`mip::commands_3dm::CaptureGyroBias`) -/// -/// The device timeout must be sufficiently long when sending these commands. -/// There are 3 potential ways to avoid erroneous timeouts: -///@li Set a high overall device timeout. This is the easiest solution but may cause excess -/// delays in your application if the device is unplugged, not powered, etc. -///@li Temporarily set the timeout higher, and restore it after running the long command. -///@li If using C++, use the `mip::DeviceInterface::runCommand` function and pass a large enough -/// value for the `additionalTime` parameter. This raises the timeout specifically for that -/// one command instance and is the recommended option. -/// \ No newline at end of file diff --git a/docs/main.md b/docs/main.md new file mode 100644 index 000000000..e94ace5d8 --- /dev/null +++ b/docs/main.md @@ -0,0 +1,49 @@ +MIP SDK {#mainpage} +================= + +Welcome to the official MIP Software Development Kit. This software package +provides everything you need to communicate with any MIP-compatible +MicroStrain inertial sensor. + +### Main Features + +* MIP packet creation +* Send commands using a single function +* Packet parsing and field iteration +* Data field deserialization +* Can be used to parse offline binary files +* Dual C and C++ API for maximum usability, safety, flexibility, and convenience. +* Suitable for bare-metal microcontrollers: + * Minimal code size and memory footprint + * No dynamic memory allocation + * No dependence on any RTOS or threads + +Quick Reference [C++] {#quickref_cpp} +--------------------- + +All C++ functions and classes reside within the mip namespace. +The C functions can be accessed via the mip::C namespace. +Within this documentation, links to C++ entities are shown in green. + +* [C++ API Overview](@ref mip_cpp) +* mip::Interface Top-level MIP interface class. +* mip::PacketView An interface to a MIP packet for either transmission or reception. +* mip::PacketBuf Similar to PacketRef but includes the data buffer. +* mip::FieldView An interface to a MIP field within a packet. +* mip::Parser MIP parser class for converting received bytes into packets. +* mip::CmdResult Stores the status or result of a MIP command. + +Quick Reference [C] {#quickref_c} +------------------- + +C does not support the equivalent of C++ namespaces, so all definitions are +global. Most names start with `mip_` to avoid conflicts. +In these documentation pages, objects are referred to by their fully- +qualified C++ names for clarity. Within this documentation, links to C entities are shown in red. + +* [C API Overview](@ref mip_c) +* [mip_interface ](@ref mip_interface_c) +* [mip_packet ](@ref mip::C::mip_packet_view) +* [mip_field ](@ref mip::C::mip_field_view) +* [mip_parser ](@ref mip::C::mip_parser) +* [mip_cmd_result](@ref mip::C::mip_cmd_result) diff --git a/docs/metadata.md b/docs/metadata.md new file mode 100644 index 000000000..713228b8b --- /dev/null +++ b/docs/metadata.md @@ -0,0 +1,66 @@ +Metadata {#metadata} +======== + +The MIP SDK includes an additional set of definitions for each MIP field which contain additional information beyond +that needed for the core functionality of sending commands and receiving data. It includes human-readable field names +and information on each parameter, such as name, type, size, etc. This information is accessible at compile time and +can be used for things like pretty-printing, CSV generation, and more. + +Metadata is currently an experimental feature and is subject to changes. It requires C++17 or later. + +Usage: +1. Include the metadata definition header for the corresponding descriptor set. +2. Get a reference or pointer to the metadata for your field. +3. Access members of the reference. + +~~~~~~~~{.cpp} +#include + +template +void print_parameters() +{ + // Obtain a reference for easier access. + constexpr const mip::metadata::FieldInfo& field = mip::metadata::MetadataFor::value; + + // Print field name and descriptor. + std::printf("Field (0x%02X,%02X) %s:\n", field.descriptor.descriptorSet, field.descriptor.fieldDescriptor, field.title); + + // Iterate each parameter. + unsigned int p=0; + for(const mip::metadata::ParameterInfo& param : field.parameters) + { + // Single element (most parameters)? + if(param.count.count == 1) + std::printf(" Parameter %u: %s\n", p, param.name); + + // Fixed-size array? + else if(param.count.isFixed()) + std::printf(" Parameter %u: %s[%u]\n", p, param.name, param.count.count); + + // Variable-sized array with another parameter holding the count? + else if(param.count.hasCounter()) + std::printf(" Parameter %u: %s[%s]\n", p, param.name, field.parameters[param.count.counter.index()].name); + + // Variable-length array which is determined by the payload length. + else + std::printf(" Parameter %u: %s[]\n", p, param.name); + + p++; + } + + std::printf("\n"); +} + +#include +#include + +int main() +{ + print_parameters(); + print_parameters(); + print_parameters(); + + return 0; +} + +~~~~~~~~ diff --git a/docs/mip_cmd_result.md b/docs/mip_cmd_result.md new file mode 100644 index 000000000..2fdc46077 --- /dev/null +++ b/docs/mip_cmd_result.md @@ -0,0 +1,40 @@ +Mip Command Results {#command_results} +=================== + +All of the command functions in the MIP SDK return a Command Result. Command results are represented by an 8-bit enum +type in both C and C++: + +* [mip_command_result (C)](@ref mip::C::mip_cmd_result) +* [mip::CmdResult (C++)](@ref mip::CmdResult) + +Command results are divided into two categories, reply codes and status +codes. Reply codes are returned by the device directly: +* `ACK_OK` - Ok; The command was successful. +* `NACK_COMMAND_UNKNOWN` - Unknown command; the descriptor was not recognized or isn't supported. +* `NACK_INVALID_PARAM` - Invalid parameter; One or more parameters are missing, invalid, or not supported. +* `NACK_COMMAND_FAILED` - Command failed; The device was unable to perform the requested function. + +The values of these enums match the corresponding values returned by the device in the MIP protocol. They are +non-negative 8-bit integers. Please see the documentation for your device for more details. + +Status codes are set by this library and are _negative_ 8-bit integers: +* `STATUS_ERROR` - General error, such as failure to send/receive on the connection. +* `STATUS_TIMEDOUT` - Timeout; No response was heard from the device within the specified time period. +* Other statuses are used to track commands in progress +* `STATUS_USER` - Application-specific codes can also be set. They must be this value or lower (more negative). + +You can use [mip_cmd_result_is_reply()](@ref mip::C::mip_cmd_result_is_reply) / mip::CmdResult::isReplyCode() and +[mip_cmd_result_is_status()](@ref mip::C::mip_cmd_result_is_status) / mip::CmdResult::isStatusCode() to distinguish +between the two categories. + +In C++, CmdResult is implicitly convertible to bool. `ACK_OK` converts to true while everything else converts to false. +This allows compact code like +~~~~~~~~{.cpp} +if( !mip::commands_base::resume(device) ) // resume returns a CmdResult + std::fprintf(stderr, "Failed to resume the sensor\n"); +~~~~~~~~ + +For debugging, the name of command results is available via +[mip_cmd_result_to_string()](@ref mip::C::mip_cmd_result_to_string) / mip::CmdResult::name + +In C++, CmdResult defaults to the initial state `CmdResult::STATUS_NONE`. diff --git a/docs/mip_interface.md b/docs/mip_interface.md new file mode 100644 index 000000000..d4ef8cb1f --- /dev/null +++ b/docs/mip_interface.md @@ -0,0 +1,242 @@ + +Mip Interface {#mip_interface_interface} +============= + +Application Interface +--------------------- + +The MIP interface is a high-level abstraction of a physical device which +communicates using the MIP protocol. It provides both data callbacks and +command functions for controlling and configuring the device: + +![](mip_interface.svg) + +When an application calls one of the command functions, the MIP interface +creates a packet, sends it to the device, and waits for a reply. When the +reply is received, the command function returns the reply code to the +application. If no reply is received, or if an error occurs, the function +will return a status code. + +Sending and receiving to or from the device occurs via two functions: +* mip::Interface::sendToDevice() or mip_interface_send_to_device() for transmission and +* mip::Interface::recvFromDevice() or mip_interface_recv_from_device() for reception. + +Each of these has a corresponding callback to the application. The +application is expected to implement the required behavior for each as +described below. Additionally, there is an @ref update "update function", +which handles periodic tasks such as command timeouts and streaming data +collection. An application may optionally override the update callback. + +* [mip_send_callback](@ref mip::C::mip_send_callback) +* [mip_recv_callback](@ref mip::C::mip_recv_callback) +* [mip_update_callback](@ref mip::C::mip_update_callback) + +An application obtains sensor data via the [dispatch subsystem](@ref mip_dispatch). There are 3 ways to do so: +* Packet callbacks, which call a function when a packet matching the MIP descriptor set is received, +* Field callbacks, which call a function when a MIP field matching the descriptor set and field descriptor is called, + and +* Data pointers, which point to a data structure in memory and update it when the associated data is received. + + +Sending Commands {#mip_commands} +---------------- + +Typically an application will configure the device, initialize some +settings, and start streaming. To do so, it must send commands. In many +cases, applications will call a single function for each needed command +(e.g. @ref MipCommands_c / @ref MipCommands_cpp). +These functions take the command parameters as arguments, send the packet, +wait for the reply, and return a result code. Additionally some commands can +report back responses from the device. + +The command functions are blocking, that is, they halt execution until the +device responds or the command times out. + +Note that since MIP data is received serially and is not buffered, data may +be received and processed while waiting for command responses. It is +recommended (but not required) to set the device to idle during configuration. + +The Dispatch System {#mip_dispatch} +------------------- + +Because of the limited resources on embedded platforms, the MIP SDK will not +buffer received data, and instead requires the application to process data +as it arrives. The MIP interface will dispatch callbacks to the application +when the requested data is received. + +The MIP interface can dispatch data in 3 ways: +* Packet callbacks, which call a function with a mip packet, +* Field callbacks, which call a function with a single mip field, and +* Data pointers, which are updated with data from a single mip field. + +With the first two options, the callback function will receive a handle to +the MIP interface, the associated MIP packet or field, and the reception +timestamp. + +An application must register callbacks with the system during +initialization. Each method requires a pointer and the MIP descriptor +associated with the data of interest. There is no limit on the number +of registered dispatchers, though performance may be affected by using +too many. Multiple dispatchers may be registered to the same data. + +### Packet callbacks + +~~~~~~~~{.cpp} + void packet_callback(void* userdata, const mip::PacketView& packet, Timestamp parseTime) +~~~~~~~~ + +Packet callbacks are invoked when a packet is received which matches the +registered descriptor set. The descriptor set may also be a wildcard, +allowing the application to process any type of packet. + +An application can register a packet callback to occur either before or +after the field callbacks for the data in the same packet. For example, +to print a summary of the packet before displaying information about each +field, an application would set the callback to occur first. Usually +applications will set a packet callback to occur last, so that they can +determine if all of the fields have been processed. + +### Field callbacks + +~~~~~~~~{.cpp} + void field_callback(void* userdata, const mip::FieldView& field, Timestamp parseTime) +~~~~~~~~ + +Similar to packet callbacks, field callbacks are invoked when a MIP +field is received which matches the specified descriptor set and +field descriptor. Either descriptor may be a wildcard. + +### Data pointers + +Data pointer dispatchers can alleviate a lot of boilerplate code having to +do with deserializing a MIP field and storing it somewhere. An application +can register a pointer one of the MIP data structures, along with the +associated descriptors, and have it automatically updated. The descriptors +cannot be wildcards because the type of the data structure is fixed. + +### Data callbacks + +~~~~~~~~{.cpp} + void data_callback(void* userdata, const mip::data_sensor::ScaledAccel& packet, Timestamp parseTime) +~~~~~~~~ + +Thanks to the power of templates, one additional dispatch mechanism is +available for C++ applications. A data callback is similar to a field +callback except that instead of getting the raw MIP field data, the function +is passed the fully-deserialized data structure. + + +Typically an application will register a series of data or field callbacks +and write the data to some kind of data structure. Because the order of +these callbacks depends on the device configuration, it can be difficult +to know which fields belong together in one sample. The solution is to use +a packet callback after all of the fields are received. In the case of +wraparound "overflow" MIP packets (see the MIP documentation), packets +containing a shared timestamp or event source field at the beginning can +be used to group data together. + + +The Update Function {#update} +------------------- + +The application should call mip_interface_update() periodically to process +data sent by the device. This update function will call +mip_interface_recv_from_device() to parse packets. When a data packet is +received, the list of packet and data callbacks is checked, and any +matching callbacks are invoked. The update function should be called at +a high enough rate to avoid overflowing the connection buffers. The +precision of the reception timestamp is dependent on the update rate. + +The command functions in @ref MipCommands_c / @ref MipCommands_cpp (e.g. mip::C::mip_write_message_format() / mip::writeMessageFormat()) +will block execution until the command completes. Either the device will +respond with an ack/nack code, or the command will time out. During this +time, the system must be able to receive data from the device in order for +command replies to be detected. This occurs via the mip_interface_update() +function as well. + +### Single-threaded applications + +For single-threaded applications, data can be read from the port directly +from within the command function. While the command is waiting (status code +MIP_STATUS_WAITING / CmdResult::STATUS_WAITING), repeated calls to the +update function will be made. By default, the update function calls +mip_interface_recv_from_device(). Because the function is called from +within a loop, it should sleep for a short time to wait for data if none +has been received yet. Doing so prevents excessive CPU usage and lowers +power consumption. + +The following diagram shows the typical control flow for a single-threaded +application. First, the device is configured by setting the message format. +Execution flows down into the command processing functions until +mip_interface_wait_for_reply() is called. This will repeatedly call +mip_interface_update() to pump packets from the device through the system, +until either an ack/nack is received or the command times out. +Once the device acknowledges the command, control is returned to the +application which then registers some data or packet callbacks. It finally +goes into a loop in collect_data(). Inside this loop, the update function +is called to process data packets. + +Notice that the same update function is called from both the command +function and the data collection loop. If any data packets are received +while waiting for a command reply, associated callbacks may be executed. +This is why this example application registers its callbacks after the +format is configured properly. + +![](device_update.svg) + +### Multi-threaded applications + +For some applications, it may be desirable to run all of the data collection +from a separate thread. In this case, the command functions must not +call the update function as that would cause a race condition between the +command thread and the data thread. Instead, the command thread should +simply sleep or yield and let the data thread process the ack/nack packet. + +To allow this behavior, the update function takes a boolean parameter which +is true when waiting on a command and false when processing data. The +default update function, mip_interface_default_update(), ignores this flag, +but applications may override it via mip_interface_set_update_function(). In +this case, a wrapper function can be created which implements the above +behavior: +~~~~~~~~{.c} + bool user_update_function(struct mip_device* device, bool blocking) + { + // If called from the data thread, do the normal processing. + if( !blocking ) + return mip_interface_default_update(device, blocking); + + // Otherwise, sleep and let the data thread process the reply. + std::this_thread::sleep_for(std::chrono::milliseconds(10)); + return true; + } + + mip_interface_set_update_function(device, &user_update_function); +~~~~~~~~ + +![](device_update_threaded.svg) + +See the threading demo for an example application. + +### Other thread-safety concerns + +* Data transmission to the device (but not sending commands) is thread-safe + within the MIP SDK. If multiple threads will send to the device, the + application should ensure that the device interface is properly protected. + +* It is up to the application to ensure that sending and receiving from + separate threads is safe. This is true for the built-in serial and TCP + connections on most operating systems. + +### Using a custom update function for other purposes + +An alternate update function may be used for single-threaded applications, too: +* To update a progress bar while waiting for commands to complete +* To process data from other devices +* To avoid blocking inside mip_interface_recv_from_device() when called from a data processing loop. +* To push data through the system in a different way (e.g. without using mip_interface_recv_from_device()) + +Data may be pushed into the system by calling any of these functions: +* mip_interface_default_update() - this is the default behavior. +* mip_interface_receive_bytes() - process bytes, given a buffer. +* mip_interface_receive_packet() - process pre-parsed packets. +* mip_interface_process_unparsed_packets() - continue parsing buffered data. diff --git a/docs/mip_packets.md b/docs/mip_packets.md new file mode 100644 index 000000000..deee83d2c --- /dev/null +++ b/docs/mip_packets.md @@ -0,0 +1,224 @@ +MIP Packet Cheatsheet {#mip_packet_processing_cpp} +===================== + +New Packet Creation +------------------- + +mip::PacketView can construct a new MIP packet using any of the +constructor overloads taking a descriptor set parameter. + +### Create a new packet using an existing buffer for storage + + uint8_t buffer[mip::PACKET_LENGTH_MAX]; + + mip::PacketView packet(buffer, sizeof(buffer), descriptor_set); + +Using a Span: + + microstrain::Span buffer_span(buffer, sizeof(buffer)); + mip::PacketView packet(buffer_span, descriptor_set); + +### Create a new packet with a built-in buffer + + mip::PacketBuf packet( descriptor_set ); + +If you know the max size of the packet is less than PACKET_LENGTH_MAX, +you may use `SizedPacketBuf` instead: + + mip::SizedPacketBuf packet(descriptor_set); + +A PacketBuf inherits all of the methods from PacketRef and may be used +interchangeably. + +### Clear/restart a packet + +This effectively resets the packet as if the constructor was called again with +the same parameters (buffer, size, and descriptor set). + + packet.reset(); + +The descriptor set may be changed if desired: + + packet.reset( descriptor_set ); + +### Create a packet from a field using a C++ struct + + void send_command(mip::commands_base::CommSpeed& cmd) + { + mip::PacketBuf packet( cmd ); + + // send packet + } + +The packet is complete and ready to go after construction; the checksum has been computed in this case. + +Similar to the above example, multiple fields may be appended. +In this case, two message format commands are added to one packet. + + mip::PacketBuf packet(mip::commands_3dm::DESCRIPTOR_SET); + + mip::commands_3dm::MessageFormat sensor_format; + mip::commands_3dm::MessageFormat filter_format; + // initialize the commands here + + packet.addField(sensor_format); + packet.addField(filter_format); + + packet.finalize(); + + +Existing Packet Processing +-------------------------- + +### Create a PacketView over an existing packet buffer + + void handle_packet(const uint8_t* buffer, size_t length) + { + mip::PacketView packet(existing_buffer, sizeof(existing_buffer)); + } + +Using a span + + void handle_packet(microstrain::Span buffer) + { + mip::PacketView packet(buffer); + } + +### Validation + +A PacketView can only be used if the packet structure makes sense, i.e. if +PacketView::isSane() returns true. This checks the following: +1. The buffer is not NULL. +2. The size of the buffer is at least PACKET_LENGTH_MIN. +3. The payload length does not exceed the size of the buffer. + +Additional checks are performed by PacketView::isValid(): +1. The packet is sane, i.e. isSane() returns true. +2. The descriptor set is not invalid (0x00). +3. Computing the checksum matches the value in the buffer. + +You may compute the checksum manually as well: + + bool chk_valid = packet.checksumValue() == packet.computeChecksum(); + + +### PacketView properties + +Once a PacketView is created, it may be used to inspect the packet. + + uint8_t desc_set = packet.descriptorSet(); + size_t total_length = packet.totalLength(); + uint8_t payload_length = packet.payloadLength(); + + // Pointer to raw bytes (e.g. to send to the device) + // Do not modify data unless you can be sure the buffer passed + // to the constructor was not const! I.e. only if using PacketBuf + // or the descriptor_set version of PacketView's ctor. + uint8_t* data = packet.pointer(); + + // Pointer to the start of the paylaod. + // The caution about constness above applies here as well. + uint8_t* payload = packet.payload(); + + // This is the value that was passed to the constructor. + size_t buffer_size = packet.bufferSize(); + + // How much of the buffer's capacity has been used. + // Note that the max size is also limited by PACKET_SIZE_MAX. + // If this is negative, the packet is not "sane", i.e. + // PacketView::isSane() is false and you cannot safely iterate fields + // without risking reading past the end of the buffer. + // See "validation" above. + int remaining_space = packet.remainingSpace(); + +### Reading fields in a packet + +Generally, field offsets aren't known ahead of time so they must be iterated. + +The easiest way to do this is with a range-based for loop: + + void iter_fields(const mip::PacketView& packet) + { + for(mip::FieldView field : packet) + { + process_field(field); + } + } + +This is effectively the same as + + void iter_fields(const mip::PacketView& packet) + { + for(mip::FieldIterator fi = packet.begin(); fi != packet.end(); ++fi) + { + process_field(*field); + } + } + + +#### Manually searching for a field without FieldIterator + +The next field in a packet can be obtained directly with FieldView::next or FieldView::nextAfter. +Note that the validity needs to be checked in case there is no next field. +Here is an example code which checks if response data follows an ack/nack reply: + + FieldView first = packet.firstField(); + if(first.isValid()) + { + if( first.is_reply() ) + { + FieldView response = first.nextAfter(); + + if(response.isValid()) + printf("Got response field: 0x%02X\n", response.fieldDescriptor()); + } + } + +### Field properties + +FieldViews have properties similar to PacketViews: + + // Unsafe to access payload data or descriptor info unless valid. + // Generally this is already checked during field iteration. + bool valid = isValid(); + + uint8_t descriptor_set = field.descriptorSet(); // Same as the packet + uint8_t field_desc = field.fieldDescriptor(); + + // Combination of descriptor set and field descriptor. + CompositeDescriptor desc = field.descriptor(); + + uint8_t payload_length = field.payloadLength(); + const uint8_t* payload = field.payload(); + + // Span version of payload + microstrain::Span payload = field.payloadSpan(); + + // Determining the type of field, e.g. for routing it to the right function in your app. + bool is_data_field = field.isData(); // Data field, e.g. accel data + bool is_command = field.isCommand(); // Command to device + bool is_reply = field.isReply(); // Ack/nack field from device + bool is_response_data = field.isResponse(); // Reply from device containing data + +### Decoding field data + +After checking the descriptor, field data can be deserialized. + + if(field.descriptor() == mip::data_sensor::ScaledAccel::DESCRIPTOR) + { + mip::data_sensor::ScaledAccel data; + + if(field.extract(data)) + printf("Accel data = %f %f %f\n", data.scaled_accel[0], data.scaled_accel[1], data.scaled_accel[2]); + } + +You may also deserialize it manually. + + mip::Serializer serializer(field.payloadSpan()); + + // Same as prior example + //serializer.extract(data); + + // Separate parameters for scaled accel + float x,y,z; + serializer.extract(x,y,z); diff --git a/docs/mip_parser.md b/docs/mip_parser.md new file mode 100644 index 000000000..523968cdf --- /dev/null +++ b/docs/mip_parser.md @@ -0,0 +1,127 @@ +Mip Parser {#parsing_packets} +========== + +The MIP Parser takes in bytes from the device connection or recorded binary +file and extracts the packet data. Data is input to the ring buffer and +packets are parsed out one at a time and sent to a callback function. + +The parser uses a ring buffer to store data temporarily between reception +and parsing. This helps even out processor workload on embedded systems +when data arrives in large bursts. + +![](mip_parser.svg) + +Parsing Data {#parsing_data} +------------ + +Data is supplied by calling mip_parser_parse() / mip::Parser::parse() with +a buffer and length. Along with the data, the user must provide a timestamp. +The timestamp serves two purposes: to provide a time of reception indicator +and to allow the parser to time out waiting for more data. + +The parse function takes an additional parameter, `max_packets`, which +limits the number of packets parsed. This can be used to prevent a large +quantity of packets from consuming too much CPU time and denying service +to other subsystems. If the limit is reached, parsing stops and the +unparsed portion of the data remains in the ring buffer. The constant value +MIPPARSER_UNLIMITED_PACKETS disables this limit. + +To continue parsing, call the parse function again. You may choose to +not supply any new data by passing NULL and a length of 0. The timestamp +should be unchanged from the previous call for highest accuracy, but it's +permissible to use the current time as well. If new data is supplied, the +new data is appended to the ring buffer and parsing resumes. The timestamp +should be the time of the new data. Previously received but unparsed packets +will be assigned the new timestamp. + +The application must parse enough packets to keep up with the incoming +data stream. Failure to do so will result in the ring buffer becoming +full. If this happens, the parse function will return a negative number, +indicating the number of bytes that couldn't be copied. This will never +happen if max_packets is `MIPPARSER_UNLIMITED_PACKETS` because all +of the data will be processed as soon as it is received. + +The Ring Buffer {#ring_buffer} +--------------- + +The ring buffer's backing buffer is a byte array that is allocated by +the application during initialization. It must be large enough to store +the biggest burst of data seen at any one time. For example, applications +expecting to deal with lots of GNSS-related data will need a bigger buffer +because there may be a large number of satellite messages. These messages +are sent relatively infrequently but contain a lot of data. If max_packets +is `MIPPARSER_UNLIMITED_PACKETS`, then it needs only 512 bytes (enough for +one packet, rounded up to a power of 2). + +In addition to passing data to the parse function, data can be written +directly to the ring buffer by obtaining a writable pointer and length +from mip_parser_get_write_ptr(). This may be more efficient by skipping a +copy operation. Call mip_parser_process_written() to tell the parser how +many bytes were written to the pointer. Note that the length returned by +`mip_parser_get_write_ptr` can frequently be less than the total +available space. An application should call it in a loop as long as there +is more data to process and the returned size is greater than 0. + +Packet Timeouts {#packet_timeouts} +--------------- + +In some cases it's possible for a packet to be corrupted during +transmission or reception (e.g. EMI while in transit on the wire, serial +baud rate too low, etc). If the payload length byte is corrupted, it may +falsely indicate that the packet is longer than what was sent. Without a +timeout, the parser would wait until this extra data (potentially up to 255 +bytes) was received before checking and realizing that the checksum failed. +Any following packets would be delayed, possibly causing additional commands +to time out and make the device appear temporarily unresponsive. Setting a +reasonable timeout ensures that the bad packet is rejected more quickly. +The timeout should be set so that a MIP packet of the largest possible +size (261 bytes) can be transferred well within the transmission time plus +any additional processing delays in the application or operating system. +As an example, for a 115200 baud serial link a timeout of 30 ms would be +about right. You can use the mip_timeout_from_baudrate() function to +compute an appropriate timeout. + +See ["microstrain_embedded_timestamp (C)"](@ref microstrain::C::microstrain_embedded_timestamp) or microstrain::EmbeddedTimestamp (C++) + +The Packet Parsing Process {#parsing_process} +-------------------------- + +Packets are parsed from the internal ring buffer one at a time in the parse +function. + +If a packet was previously started but not completed previously (due to +requiring more data) then the timeout is checked. If too much time has +passed, the packet is discarded and the parsing state reset. This check is +only performed once per parse call because that is the only point where the +timestamp changes. + +![](parse_function.svg) + +The current status is held by the `expected_length` variable, which tracks +how many bytes are expected to be in the current packet. The parse function +enters a loop, checking if there is enough data to complete the next parsing +step. + +![](parse_one_packet.svg) + +`expected_length` starts out as 1 when the parser is searching for the start +of a packet. Once a potential start byte (`SYNC1`) is found, the packet's +start time is initialized to the current timestamp and `expected_length` is +bumped up to the size of a mip packet header (4 bytes). + +When the expected length is 4 bytes, the header's SYNC2 byte is checked for +validity and the payload length field is read. `expected_length` is set to +the full packet size (computed as the packet header and checksum size plus +the payload size). + +Finally, when `expected_length` is neither of the above two conditions, it +means that the entire packet has been received. Note that other values less +than 6 (the size of an empty packet) are not possible. At this point, the +data is copied out from the ring buffer to a linear buffer for processing. +The checksum is verified, and if it passes, the entire packet is dropped +from the ring buffer and the callback function is invoked. + +If any of the checks in the above steps fails, such as a wrong SYNC2 byte, +a single byte is dropped from the ring buffer and the loop is continued. +Only a single byte can be dropped, because rogue SYNC1 bytes or truncated +packets may hide real mip packets in what would have been their payload. diff --git a/docs/miscellaneous.md b/docs/miscellaneous.md new file mode 100644 index 000000000..5c90128b5 --- /dev/null +++ b/docs/miscellaneous.md @@ -0,0 +1,47 @@ +Other Considerations {#other} +==================== + +Known Issues and Workarounds {#known_issues} +---------------------------- + +### suppress_ack parameters are not supported + +Some commands accept a parameter named `suppress_ack` which prevents +the standard ack/nack reply from being returned by the device, e.g. the +3DM Poll Data command. Use of this parameter is not fully supported by the MIP SDK +and will cause the command to appear to time out after a short delay. + +If you wish to use this feature, (i.e. just send the command without waiting for an ACK/NACK), +you can build and send the command manually: +~~~~~~~~{.cpp} +// Create the command with required parameters. +mip::commands_3dm::PollData cmd; + +cmd.desc_set = mip::data_sensor::DESCRIPTOR_SET; +cmd.suppress_ack = true; // We can set this since we're not calling the standard cmd handling functions. +cmd.num_descriptors = 2; +cmd.descriptors[0] = mip::data_sensor::ScaledAccel::FIELD_DESCRIPTOR; +cmd.descriptors[1] = mip::data_sensor::ScaledGyro::FIELD_DESCRIPTOR; + +// Build a packet. +mip::PacketBuf packet(cmd); + +// Send it to the device. +device.sendCommand(packet); +~~~~~~~~ + +### Some commands take longer and may time out + +This applies to the following commands: +* Device Settings (mip::commands_3dm::DeviceSettings), in particular saving settings. +* Commanded Built-In Test (mip::commands_base::BuiltInTest) +* Capture Gyro Bias (mip::commands_3dm::CaptureGyroBias) + +The device timeout must be sufficiently long when sending these commands. +There are 3 potential ways to avoid erroneous timeouts: +* Set a high overall device timeout. This is the easiest solution but may cause excess + delays in your application if the device is unplugged, not powered, etc. +* Temporarily set the timeout higher, and restore it after running the long command. +* If using C++, use the mip::Interface::runCommand function and pass a large enough + value for the `additionalTime` parameter. This raises the timeout specifically for that + one command instance and is the recommended option. diff --git a/docs/serialization.md b/docs/serialization.md new file mode 100644 index 000000000..5eb37e7db --- /dev/null +++ b/docs/serialization.md @@ -0,0 +1,280 @@ +Serialization {#serialization} +============= + +Serialization in C {#serialization_c} +------------------ + +Serialization infrastructure in C is very basic and is currently limited to built-in types and big-endian protocols. + +To (de)serialize a buffer, follow these steps: +1. Create a serializer and initialize it via @ref microstrain_serializer_init_insertion + or @ref microstrain_serializer_init_extraction, depending on whether you're + writing or reading data. +2. Call `microstrain_insert_*` or `microstrain_extract_*` for each parameter. E.g. [microstrain_extract_u32](@ref microstrain::C::microstrain_extract_u32). +3. Call @ref microstrain_serializer_is_ok to check if all the data was written/read successfully (i.e. fit in the buffer). + Alternatively, to verify if exactly buffer_size bytes were read/written, use @ref microstrain_serializer_is_complete. +4. Transmit the written buffer or use the deserialized parameters. + +When reading an array length from a buffer, it is recommended to use @ref microstrain_extract_count to specify a maximum +length. This helps avoid buffer overrun bugs and associated security vulnerabilities. + +Serialization in C++ {#serialization_cpp} +-------------------- + +The MIP SDK includes a complete serialization system in C++. It supports both big- and little-endian buffers and user- +defined types. + +### Basic usage + +To (de)serialize a buffer, follow these steps: +1. Create a microstrain::Serializer, passing in a pointer to your buffer and the size. A starting offset may also be + specified for convenience. +2. Call microstrain::Serializer::insert or microstrain::Serializer.extract with the values to be (de)serialized. Multiple calls may be made to + these functions if needed. When reading an array length from a buffer, it is recommended to use + microstrain::Serializer::extract_count to specify a maximum count. This helps avoid buffer overrun bugs and associated security + vulnerabilities. +3. Check if the data was written/read successfully (i.e. fit in the buffer) by calling microstrain::Serializer::isOk or + microstrain::Serializer::isFinished (use the latter if the entire buffer should have been used). +4. Transmit the written buffer or use the deserialized parameters. + +Example: + +~~~~~~~~{.cpp} +int main() +{ + // Byte buffers + uint8_t buffer_le[128]; + uint8_t buffer_be[128]; + + // Create serializers + microstrain::BigEndianSerializer bes(buffer_be, sizeof(buffer_be)); + microstrain::LittleEndianSerializer les(buffer_le, sizeof(buffer_le)); + + // Alternatively, specify the endianness via template argument. + //microstrain::Serializer bes2(buffer_be, sizeof(buffer_be)); + //microstrain::Serializer les2(buffer_le, sizeof(buffer_le)); + + // Some variables to serialize + uint8_t a = 22; + int8_t b = -33; + uint16_t c = 1024; + int32_t d = -1000000; + uint64_t e = 0x81726354AABBCCDD; + float f = 1.25f; + double g = -1.1; + + // Serialize all the basic variables. + bes.insert(a,b,c,d,e,f,g); + les.insert(a,b,c,d,e,f,g); + + // buffer_be = [0x16, 0xDF, 0x04,0x00, 0xFF,0xF0,0xBD,0xC0, 0x81,0x72,0x63,0x54,0xAA,0xBB,0xCC,0xDD, 0x3F,0xA0,0x00,0x00, 0xBF,0xF1,0x99,0x99,0x99,0x99,0x99,0x9a] + // buffer_le = [0x16, 0xDF, 0x00,0x04, 0xC0,0xBD,0xF0,0xFF, 0xDD,0xCC,0xBB,0xAA,0x54,0x63,0x72,0x81, 0x00,0x00,0xA0,0x3F, 0x9a,0x99,0x99,0x99,0x99,0x99,0xF1,0xBF] + + // Serialize 20 u64s using C-style array or pointer and size. + uint64_t too_much[20] = {0}; + bes.insert(too_much); // Size is deduced from C-style array. + les.insert(&too_much[0], 20); // 20 items, not 20 bytes. + + // Too much data! Note: no actual overrun / invalid access of the buffer has occurred. + // (20*sizeof(uint64_t) = 160) > (sizeof(buffer) = 128) + assert(!bes.isOk() && !les.isOk()); + + // Jump back to the start of the buffer for deserialization. + // Note: this clears the overrun condition. + bes.setOffset(0); + les.setOffset(0); + assert(bes.isOk() && les.isOk()); + + // Deserialize the values. + bes.extract(a,b,c,d,e,f,g); + les.extract(a,b,c,d,e,f,g); + + // Check if everything was deserialized successfully. + if(!bes.isOk() || !les.isOk()) + return 1; + + // Jump to specific offset. + bes.setOffset(4); + les.setOffset(4); + + // Try to read a value using std::optional (subject to compiler support for C++17). + std::optional vg = microstrain::extract(bes); + assert( vg.has_value() && *vg == d ); + + // Reset again + bes.setOffset(0); + les.setOffset(0); + + // See following examples + + return 0; +} +~~~~~~~~ + +### Supported Types + +The serialization library has support for the following basic types: +* Booleans (as a u8; false->[0x00], true->[0x01]; 0x00 reads as false, anything else as true) +* Signed and unsigned integers of various sizes (u8, s8, u16, ..., u64, s64) +* Floating point values (float and double) +* Enums, provided they have an underlying type specified + +Additionally, the following compound types are supported: +* Arrays, both fixed-size and runtime size + * `std::array` + * `microstrain::Span` / `std::span` + * C-style arrays of fixed, known size + * Pointer and size +* std::tuple (with c++17 support) +* User-defined types (see below) + + Adding to the example above, we have: +~~~~~~~~{.cpp} + // A strongly-typed enum + enum class MyEnum : uint8_t { ZERO=0, ONE=1, TWO=2, THREE, FOUR }; + MyEnum me = MyEnum::TWO; + + auto basics = std::make_tuple(a,b,c,d,e,f,g); + std::array vector4 = {1.0f, 2.0f, 3.0f, 4.0f}; + microstrain::Span vector3(vector4[0], 3); + + /// Serialize a custom enum and the contents of a std::tuple. + bes.insert(me, basics); + les.insert(me, basics); + + /// Serialize an array and Span using the non-member functions. + /// This is equivalent to `s.insert(vector4, vector3)`. + microstrain::insert(bes, vector4, vector3); + microstrain::insert(les, vector4, vector3); +~~~~~~~~ + +### Serialization "One-liners" + +For convenience, a few additional methods are provided for serialization in a single line. +* insert to raw buffer +* extract from raw buffer +* extract to std::optional + +~~~~~~~~{.cpp} +void one_liners() +{ + uint8_t buffer[4]; + microstrain::Span span(buffer, sizeof(buffer)); + + int32_t x = -501; + + // Write a single value to a buffer. + bool ok1 = microstrain::insert(x, span); + bool ok2 = microstrain::insert(x, buffer, sizeof(buffer)); + bool ok3 = microstrain::insert(x, buffer, sizeof(buffer), 0, true); // Enforces all bytes used + + assert(ok1 && ok2 && ok3); + + // Read a single value from the buffer + int32_t y1,y2,y3; + ok1 = microstrain::extract(y1, span); + ok2 = microstrain::extract(y2, span, 0, true); // Enforces all bytes read + ok3 = microstrain::extract(y3, buffer, sizeof(buffer)); + + assert(ok1 && ok2 && ok3 && y1 == x && y2 == x && y3 == x); + + // Read a value of the specified type from the buffer. + // Note: only available with std::optional support from C++17. + std::optional value1 = microstrain::extract(span); + std::optional value2 = microstrain::extract(buffer, sizeof(buffer)); + + assert(value1.has_value() && value2.has_value()); + assert(*value1 == x && *value2 == x); +} +~~~~~~~~ + +### User-defined types + +#### Classes and structs + +Classes and structs may include one or more of the following member functions to enable serialization support: +* `void insert(microstrain::BigEndianSerializer& serializer) const` +* `void insert(microstrain::LittleEndianSerializer& serializer) const` +* `template void insert(microstrain::Serializer& serializer) const` +* `void extract(microstrain::BigEndianSerializer& serializer)` +* `void extract(microstrain::LittleEndianSerializer& serializer)` +* `template void extract(microstrain::Serializer& serializer)` + +In addition, the serialization non-member functions may be overloaded as described next. + +#### Other user-defined types + +All serialization goes through `microstrain::insert` / `microstrain::extract`. These are non-member functions and are +overloaded for various data types. This makes it possible to extend serialization to new types. +Serialization for any custom type may be implemented by overloading the `insert` or `extract` +functions. For example: + +~~~~~~~~{.cpp} +namespace custom +{ + // An enum which is not typed and thus cannot use the regular enum methods. + enum Foo { A=0, B, C, MAX_FOO }; + + // Insert Foo function which just converts to u8. + template + size_t insert(microstrain::Serializer& serializer, Foo foo) + { + return microstrain::insert(serializer, uint8_t(foo)); + } + + // Extract Foo function which range-checks and converts a u8. + template + size_t extract(microstrain::Serializer& serializer, Foo& foo) + { + uint8_t value; + size_t size = microstrain::extract(serializer, value); + if(serializer.isOk()) // Optional check + { + if(value < MAX_FOO) // Another optional check + foo = value; + else + serializer.invalidate(); + } + return size; + } + +} // end namespace custom + +// Test function +void write_read_foo(custom::Foo foo) +{ + // A byte buffer of 8 bytes. + uint8_t buffer[8]; + + // Create the serializer, passing in the buffer. + microstrain::BigEndianSerializer serializer(buffer, sizeof(buffer)); + + // Write foo to the buffer. + // This calls Serializer::insert, which calls the non-member function 'insert'. + // Despite being in the 'custom' namespace, the 'insert(Serializer&, Foo)' + // function will be found via argument-dependent lookup because + // 'Foo' is also in that namespace. + serializer.insert(foo); + + // Jump back to start of buffer for reading. + serializer.setOffset(0); + + // Read foo back out and compare to original. + custom::Foo foo2; + serializer.extract(foo2); + + assert(foo2 == foo); +} +~~~~~~~~ + +### Serialization System Architecture + +The MIP library implements many custom types and heavily leverages the serialization system. It uses `insert`/`extract` +overloads, class methods, strongly-typed enums, and arrays. + +The Serializer uses read/write functions from the microstrain::serialization namespace to handle endianness / +byteswapping and packing at the lowest level. + +This diagram describes the architecture of the serialization system: + +![Serialization Diagram](serialization.svg) diff --git a/docs/serialization.svg b/docs/serialization.svg new file mode 100644 index 000000000..638d406d6 --- /dev/null +++ b/docs/serialization.svg @@ -0,0 +1,4 @@ + + + +
template<Endian> class Serializer
template<Endian> class Serializer
level 3
level 3
level 1
level 1
level 2
level 2
SerializerBase
SerializerBase
arithmetic / builtin types
(u)int8/16/32/64, float, bool, char
arithmetic / builtin types...
Enum types
using std::underlying_type
Enum types...
Fixed-size arrays
std::array, T array[N]
Fixed-size arrays...
Runtime-size arrays
std::vector, std::span, ptr+size
Runtime-size arrays...
std::tuple, multiple parameters
std::tuple, multiple parameters
Class types
if class has insert,extract members
Class types...
raw buffer helpers
insert(T, buffer, size)
extract(T, buffer, size)
raw buffer helpers...
extract and return value
optional<T> extract(serializer)
extract and return value...
serializer insert/extract member fns
Redirects to non-member functions
serializer insert/extract member...
serializer extract_count member fn
Gets an integer with maximum limit
serializer extract_count member f...
namespace microstrain
namespace microstrain
namespace serialization
namespace serialization
namespace little_endian
namespace little_endian
namespace big_endian
namespace big_endian
write<Endian>(buffer, T)
read<Endian>(buffer, T)
write<Endian>(buffer, T)...
write(uint8_t* buffer, T value)
read(const uint8_t* buffer, T& value)
write(uint8_t* buffer, T value)...
write(uint8_t* buffer, T value)
read(const uint8_t* buffer, T& value)
write(uint8_t* buffer, T value)...
microstrain:: insert/extract non-member functions
microstrain:: insert/extract non-member functio...
mip namespace
mip namespace
template<class T>
insert(Serializer, Bitfield<T>)
extract(Serializer, Bitfield<T>)
template<class T>...
DescriptorRate::
insert, extract
Called from ms::insert(class)
DescriptorRate::...
insert(Serializer, Vector<T,N>)
extract(Serializer, vector<T,N>)
insert(Serializer, Vector<T,N>)...
mip field classes & structs
insert, extract member functions
mip field classes & structs...
Non-member functions in the mip namespace are found via argument-dependent lookup (ADL)
See https://en.cppreference.com/w/cpp/language/adl
(use "using microstrain::insert" and then call just "insert"
 to include mip::insert when the type is in the mip namespace)
Non-member functions in the mip namespace are found via argument-dependent lookup (AD...
\ No newline at end of file diff --git a/docs/style.css b/docs/style.css new file mode 100644 index 000000000..1baf53fe7 --- /dev/null +++ b/docs/style.css @@ -0,0 +1,29 @@ +a[href*="cpp.html"], a[href^="class"], a[href*="mip_1_1"], a[href*="microstrain_1_1"] { + filter: hue-rotate(-90deg) saturate(50%); +} +a[href^="group__c"], a[href*="_c.html"], a[href*="_1_1C_"] { + /*filter: brightness(120%);*/ + filter: hue-rotate(90deg) saturate(50%); +} + +/*.directory td.entry:has(> a) {*/ +/* background-color: aquamarine;*/ +/*}*/ + +/*td.entry:has(a.el[href="group__MipCommandQueue__c.html"]) {*/ +/* background-color: green;*/ +/*}*/ + + +/*td.entry:has(a.el[href$="__c.html"]) {*/ +/* !*background-color: #ebecf0;*!*/ +/* filter: brightness(90%);*/ +/*}*/ +/*td.entry:has(a.el[href$="__cpp.html"]) {*/ +/* !*background-color: #ebecf0;*!*/ +/* filter: brightness(90%);*/ +/*}*/ +/*td.entry.even:has(a.el[href$="__c.html"]) {*/ +/* !*background-color: #F7F8FB;*!*/ +/* background-color: #ebecf0;*/ +/*}*/ diff --git a/docs/time.md b/docs/time.md new file mode 100644 index 000000000..658523b4d --- /dev/null +++ b/docs/time.md @@ -0,0 +1,32 @@ +Timestamps and Timeouts {#timestamps} +======================= + +Timestamp Type {#timestamp_type} +-------------- + +Timestamps ([mip_timestamp](@ref mip::C::mip_timestamp) / mip::Timestamp) represent the local time when data was received or a packet was parsed. These timestamps +are used to implement command timeouts and provide the user with an approximate timestamp of received data. It is not intended to be +a precise timestamp or used for synchronization, and it generally cannot be used instead of the timestamps from the connected MIP device. +In particular, if you limit the maximum number of packets processed per `update` call, the timestamp of some packets may be delayed. + +Because different applications may keep track of time differently (especially on embedded platforms), it is up to the user to provide +the current time whenever data is received from the device. On a PC, this might come from the posix `clock()` function or from the +`std::chrono` library. On ARM Cortex-M systems, it is often derived from the Systick timer. It should be a monotonically increasing value; +jumps backwards in time (other than due to wraparound) will cause problems. + +By default, timestamps are `typedef`'d to `uint64_t`. Typically timestamps are in milliseconds. Embedded systems may wish to use +`uint32_t` or even `uint16_t` instead. The value is allowed to wrap around as long as the time between wraparounds is longer than +twice the longest timeout needed. If higher precision is needed or wraparound can't be tolerated by your application, define it to +`uint64_t`. It must be a standard unsigned integer type. + +Command Timeouts +---------------- + +Timeouts for commands are broken down into two parts. +* A "base reply timeout" applies to all commands. This is useful to compensate for communication latency, such as over a TCP socket. +* "Additional time" which applies per command, because some commands may take longer to complete. + +Currently, only the C++ api offers a way to set the additional time parameter, and only when using the `runCommand` function taking +the command structure and the `additionalTime` parameter. + +The `mip_timeout` / `mip::Timeout` typedef is an alias to the timestamp type. diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index b641684d5..f7ac3878c 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,103 +1,102 @@ - set(EXAMPLE_DIR "${CMAKE_CURRENT_LIST_DIR}") +set(MIP_EXAMPLE_UTILS_LIBRARY "example_utils") - -set(DEVICE_SOURCES +add_library(${MIP_EXAMPLE_UTILS_LIBRARY} "${EXAMPLE_DIR}/example_utils.c" "${EXAMPLE_DIR}/example_utils.h" "${EXAMPLE_DIR}/example_utils.cpp" "${EXAMPLE_DIR}/example_utils.hpp" ) -if(MIP_USE_SERIAL) - set(SERIAL_DEFS "MIP_USE_SERIAL") +set(EXAMPLE_LIBS) + +if(MICROSTRAIN_ENABLE_SERIAL) + set(SERIAL_DEFS "MICROSTRAIN_ENABLE_SERIAL") + list(APPEND EXAMPLE_LIBS microstrain_serial) +endif() + +if(MICROSTRAIN_ENABLE_TCP) + set(TCP_DEFS "MICROSTRAIN_ENABLE_TCP") + list(APPEND EXAMPLE_LIBS microstrain_socket) endif() -if(MIP_USE_TCP) - set(TCP_DEFS "MIP_USE_TCP") +if(MICROSTRAIN_ENABLE_SERIAL OR MICROSTRAIN_ENABLE_TCP) + list(APPEND EXAMPLE_LIBS ${MICROSTRAIN_RECORDING_CONNECTION_LIBRARY}) endif() -if(MIP_USE_EXTRAS) - set(EXTRAS_DEFS "MIP_USE_EXTRAS") +if(MIP_ENABLE_EXTRAS) + set(EXTRAS_DEFS "MIP_ENABLE_EXTRAS") endif() set(MIP_EXAMPLE_DEFS ${MIP_DEFINES} ${SERIAL_DEFS} ${TCP_DEFS} ${EXTRAS_DEFS}) -# C++ examples need either serial or TCP support -if(MIP_USE_SERIAL OR MIP_USE_TCP) - - if(NOT MIP_DISABLE_CPP) - - add_executable(DeviceInfo "${EXAMPLE_SOURCES}" "${EXAMPLE_DIR}/device_info.cpp" ${DEVICE_SOURCES}) - target_link_libraries(DeviceInfo mip "${SERIAL_LIB}" "${SOCKET_LIB}") - target_compile_definitions(DeviceInfo PUBLIC "${MIP_EXAMPLE_DEFS}") - target_include_directories(DeviceInfo PUBLIC "${EXAMPLE_DIR}") - - add_executable(WatchImu "${EXAMPLE_SOURCES}" "${EXAMPLE_DIR}/watch_imu.cpp" ${DEVICE_SOURCES}) - target_link_libraries(WatchImu mip "${SERIAL_LIB}" "${SOCKET_LIB}") - target_compile_definitions(WatchImu PUBLIC "${MIP_EXAMPLE_DEFS}") - target_include_directories(WatchImu PUBLIC "${EXAMPLE_DIR}") - - find_package(Threads REQUIRED) - add_executable(ThreadingDemo "${EXAMPLE_SOURCES}" "${EXAMPLE_DIR}/threading.cpp" ${DEVICE_SOURCES}) - target_link_libraries(ThreadingDemo mip "${SERIAL_LIB}" "${SOCKET_LIB}" "${CMAKE_THREAD_LIBS_INIT}") - target_compile_definitions(ThreadingDemo PUBLIC "${MIP_EXAMPLE_DEFS}") - target_include_directories(ThreadingDemo PUBLIC "${EXAMPLE_DIR}") - - add_executable(GQ7_Example "${EXAMPLE_SOURCES}" "${EXAMPLE_DIR}/GQ7/GQ7_example.cpp" ${DEVICE_SOURCES}) - target_link_libraries(GQ7_Example mip "${SERIAL_LIB}" "${SOCKET_LIB}") - target_compile_definitions(GQ7_Example PUBLIC "${MIP_EXAMPLE_DEFS}") - target_include_directories(GQ7_Example PUBLIC "${EXAMPLE_DIR}") - - add_executable(CV7_Example "${EXAMPLE_SOURCES}" "${EXAMPLE_DIR}/CV7/CV7_example.cpp" ${DEVICE_SOURCES}) - target_link_libraries(CV7_Example mip "${SERIAL_LIB}" "${SOCKET_LIB}") - target_compile_definitions(CV7_Example PUBLIC "${MIP_EXAMPLE_DEFS}") - target_include_directories(CV7_Example PUBLIC "${EXAMPLE_DIR}") - - add_executable(CV7_INS_Simple_Example "${EXAMPLE_SOURCES}" "${EXAMPLE_DIR}/CV7_INS/CV7_INS_simple_example.cpp" ${DEVICE_SOURCES}) - target_link_libraries(CV7_INS_Simple_Example mip "${SERIAL_LIB}" "${SOCKET_LIB}") - target_compile_definitions(CV7_INS_Simple_Example PUBLIC "${SERIAL_DEFS}" "${TCP_DEFS}") - target_include_directories(CV7_INS_Simple_Example PUBLIC "${EXAMPLE_DIR}") - - add_executable(CV7_INS_Simple_Ublox_Example "${EXAMPLE_SOURCES}" "${EXAMPLE_DIR}/CV7_INS/CV7_INS_simple_ublox_example.cpp" ${DEVICE_SOURCES} CV7_INS/ublox_device.hpp CV7_INS/simple_ublox_parser.hpp) - target_link_libraries(CV7_INS_Simple_Ublox_Example mip "${SERIAL_LIB}" "${SOCKET_LIB}") - target_compile_definitions(CV7_INS_Simple_Ublox_Example PUBLIC "${SERIAL_DEFS}" "${TCP_DEFS}") - target_include_directories(CV7_INS_Simple_Ublox_Example PUBLIC "${EXAMPLE_DIR}") - - add_executable(CX5_GX5_45_Example "${EXAMPLE_SOURCES}" "${EXAMPLE_DIR}/CX5_GX5_45/CX5_GX5_45_example.cpp" ${DEVICE_SOURCES}) - target_link_libraries(CX5_GX5_45_Example mip "${SERIAL_LIB}" "${SOCKET_LIB}") - target_compile_definitions(CX5_GX5_45_Example PUBLIC "${MIP_EXAMPLE_DEFS}") - target_include_directories(CX5_GX5_45_Example PUBLIC "${EXAMPLE_DIR}") - - add_executable(CX5_GX5_CV5_15_25_Example "${EXAMPLE_SOURCES}" "${EXAMPLE_DIR}/CX5_GX5_CV5_15_25/CX5_GX5_CV5_15_25_example.cpp" ${DEVICE_SOURCES}) - target_link_libraries(CX5_GX5_CV5_15_25_Example mip "${SERIAL_LIB}" "${SOCKET_LIB}") - target_compile_definitions(CX5_GX5_CV5_15_25_Example PUBLIC "${SERIAL_DEFS}" "${TCP_DEFS}") - target_include_directories(CX5_GX5_CV5_15_25_Example PUBLIC "${EXAMPLE_DIR}") +target_compile_definitions(${MIP_EXAMPLE_UTILS_LIBRARY} + PUBLIC + ${MIP_EXAMPLE_DEFS} + ${MICROSTRAIN_PRIVATE_COMPILE_DEFINITIONS} +) + +target_compile_options(${MICROSTRAIN_SERIAL_LIBRARY} PRIVATE ${MICROSTRAIN_PRIVATE_COMPILE_OPTIONS}) + +#target_include_directories(${MIP_EXAMPLE_UTILS_LIBRARY} PRIVATE ${SRC_DIR}) +target_link_libraries(${MIP_EXAMPLE_UTILS_LIBRARY} PUBLIC ${MIP_LIBRARY} ${EXAMPLE_LIBS}) + +list(APPEND EXAMPLE_LIBS ${MIP_EXAMPLE_UTILS_LIBRARY}) + +macro(add_mip_example name sources) + + add_executable(${name} ${sources}) + + target_compile_features(${name} PUBLIC c_std_11) + if(MICROSTRAIN_ENABLE_CPP) # Technically should only do this for C++ examples but this is simpler + target_compile_features(${name} PUBLIC cxx_std_11) endif() + target_link_libraries(${name} PUBLIC ${MIP_LIBRARY} ${EXAMPLE_LIBS}) + target_compile_definitions(${name} PUBLIC ${MIP_EXAMPLE_DEFS}) + target_include_directories(${name} PRIVATE ${EXAMPLE_DIR}) -endif() +endmacro() + +add_mip_example(MipPacketExampleC "${EXAMPLE_DIR}/mip_packet_example.c") + +if(MICROSTRAIN_ENABLE_CPP) -# C examples need serial support -if(MIP_USE_SERIAL) - add_executable(WatchImuC "${EXAMPLE_DIR}/watch_imu.c" ${DEVICE_SOURCES}) - target_link_libraries(WatchImuC mip) - target_include_directories(WatchImuC PUBLIC "${EXAMPLE_DIR}") + add_mip_example(MipPacketExample "${EXAMPLE_DIR}/mip_packet_example.cpp") - add_executable(GQ7_ExampleC "${EXAMPLE_DIR}/GQ7/GQ7_example.c" ${DEVICE_SOURCES}) - target_link_libraries(GQ7_ExampleC mip) - target_include_directories(GQ7_ExampleC PUBLIC "${EXAMPLE_DIR}") + # C++ examples that need either serial or TCP support + if(MICROSTRAIN_ENABLE_SERIAL OR MICROSTRAIN_ENABLE_TCP) - add_executable(CV7_ExampleC "${EXAMPLE_DIR}/CV7/CV7_example.c" ${DEVICE_SOURCES}) - target_link_libraries(CV7_ExampleC mip) - target_include_directories(CV7_ExampleC PUBLIC "${EXAMPLE_DIR}") + # Generic examples + add_mip_example(DeviceInfo "${EXAMPLE_DIR}/device_info.cpp") + add_mip_example(WatchImu "${EXAMPLE_DIR}/watch_imu.cpp") + add_mip_example(Threads "${EXAMPLE_DIR}/threading.cpp") + if(UNIX) + target_link_libraries(Threads PUBLIC pthread) + endif() + if(MIP_ENABLE_METADATA) + add_mip_example(PrettyPrinter "${EXAMPLE_SOURCES};${EXAMPLE_DIR}/PrettyPrinter/pretty_printer.cpp;${EXAMPLE_DIR}/PrettyPrinter/stringify.cpp;${EXAMPLE_DIR}/PrettyPrinter/stringify.hpp") + target_link_libraries(PrettyPrinter PRIVATE ${MIP_METADATA_LIBRARY}) + endif() + + # Product-specific examples + add_mip_example(GQ7_Example "${EXAMPLE_DIR}/GQ7/GQ7_example.cpp") + add_mip_example(CV7_Example "${EXAMPLE_DIR}/CV7/CV7_example.cpp") + add_mip_example(CV7_INS_Simple_Example "${EXAMPLE_DIR}/CV7_INS/CV7_INS_simple_example.cpp") + add_mip_example(CV7_INS_Simple_Ublox_Example "${EXAMPLE_DIR}/CV7_INS/CV7_INS_simple_ublox_example.cpp") + add_mip_example(CX5_GX5_45_Example "${EXAMPLE_DIR}/CX5_GX5_45/CX5_GX5_45_example.cpp") + add_mip_example(CX5_GX5_CV5_15_25_Example "${EXAMPLE_DIR}/CX5_GX5_CV5_15_25/CX5_GX5_CV5_15_25_example.cpp") + + endif() +endif() - add_executable(CX5_GX5_45_ExampleC "${EXAMPLE_DIR}/CX5_GX5_45/CX5_GX5_45_example.c" ${DEVICE_SOURCES}) - target_link_libraries(CX5_GX5_45_ExampleC mip) - target_include_directories(CX5_GX5_45_ExampleC PUBLIC "${EXAMPLE_DIR}") +# C examples that need serial support +if(MICROSTRAIN_ENABLE_SERIAL) - add_executable(CX5_GX5_CV5_15_25_ExampleC "${EXAMPLE_DIR}/CX5_GX5_CV5_15_25/CX5_GX5_CV5_15_25_example.c" ${DEVICE_SOURCES}) - target_link_libraries(CX5_GX5_CV5_15_25_ExampleC mip) - target_include_directories(CX5_GX5_CV5_15_25_ExampleC PUBLIC "${EXAMPLE_DIR}") + add_mip_example(WatchImuC "${EXAMPLE_DIR}/watch_imu.c") + add_mip_example(GQ7_ExampleC "${EXAMPLE_DIR}/GQ7/GQ7_example.c") + add_mip_example(CV7_ExampleC "${EXAMPLE_DIR}/CV7/CV7_example.c") + add_mip_example(CX5_GX5_45_ExampleC "${EXAMPLE_DIR}/CX5_GX5_45/CX5_GX5_45_example.c") + add_mip_example(CX5_GX5_CV5_15_25_ExampleC "${EXAMPLE_DIR}/CX5_GX5_CV5_15_25/CX5_GX5_CV5_15_25_example.c") endif() diff --git a/examples/CV7/CV7_example.c b/examples/CV7/CV7_example.c index b84c7167b..8c402d5c7 100644 --- a/examples/CV7/CV7_example.c +++ b/examples/CV7/CV7_example.c @@ -15,7 +15,7 @@ //! //! THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING //! CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER -//! FOR THEM TO SAVE TIME. AS A RESULT, HBK MICROSTRAIN SHALL NOT BE HELD +//! FOR THEM TO SAVE TIME. AS A RESULT, MICROSTRAIN BY HBK SHALL NOT BE HELD //! LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY //! CLAIMS ARISING FROM THE CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS //! OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. @@ -28,7 +28,7 @@ //////////////////////////////////////////////////////////////////////////////// #include -#include +#include #include #include #include @@ -73,15 +73,15 @@ const uint8_t FILTER_PITCH_EVENT_ACTION_ID = 2; //Required MIP interface user-defined functions mip_timestamp get_current_timestamp(); -bool mip_interface_user_recv_from_device(mip_interface* device, uint8_t* buffer, size_t max_length, mip_timeout wait_time, size_t* out_length, mip_timestamp* timestamp_out); -bool mip_interface_user_send_to_device(mip_interface* device, const uint8_t* data, size_t length); +bool mip_interface_user_recv_from_device(mip_interface* device_, uint8_t* buffer, size_t max_length, mip_timeout wait_time, size_t* out_length, mip_timestamp* timestamp_out); +bool mip_interface_user_send_to_device(mip_interface* device_, const uint8_t* data, size_t length); int usage(const char* argv0); void exit_gracefully(const char *message); bool should_exit(); -void handle_filter_event_source(void* user, const mip_field* field, mip_timestamp timestamp); +void handle_filter_event_source(void* user, const mip_field_view* field, mip_timestamp timestamp); //////////////////////////////////////////////////////////////////////////////// @@ -358,8 +358,11 @@ int main(int argc, const char* argv[]) // Filter Event Source Field Handler //////////////////////////////////////////////////////////////////////////////// -void handle_filter_event_source(void* user, const mip_field* field, mip_timestamp timestamp) +void handle_filter_event_source(void* user, const mip_field_view* field, mip_timestamp timestamp) { + (void)user; + (void)timestamp; + mip_shared_event_source_data data; if(extract_mip_shared_event_source_data_from_field(field, &data)) @@ -389,10 +392,12 @@ mip_timestamp get_current_timestamp() // MIP Interface User Recv Data Function //////////////////////////////////////////////////////////////////////////////// -bool mip_interface_user_recv_from_device(mip_interface* device, uint8_t* buffer, size_t max_length, mip_timeout wait_time, size_t* out_length, mip_timestamp* timestamp_out) +bool mip_interface_user_recv_from_device(mip_interface* device_, uint8_t* buffer, size_t max_length, mip_timeout wait_time, size_t* out_length, mip_timestamp* timestamp_out) { + (void)device_; + *timestamp_out = get_current_timestamp(); - return serial_port_read(&device_port, buffer, max_length, wait_time, out_length); + return serial_port_read(&device_port, buffer, max_length, (int)wait_time, out_length); } @@ -400,8 +405,10 @@ bool mip_interface_user_recv_from_device(mip_interface* device, uint8_t* buffer, // MIP Interface User Send Data Function //////////////////////////////////////////////////////////////////////////////// -bool mip_interface_user_send_to_device(mip_interface* device, const uint8_t* data, size_t length) +bool mip_interface_user_send_to_device(mip_interface* device_, const uint8_t* data, size_t length) { + (void)device_; + size_t bytes_written; return serial_port_write(&device_port, data, length, &bytes_written); @@ -432,8 +439,8 @@ void exit_gracefully(const char *message) if(serial_port_is_open(&device_port)) serial_port_close(&device_port); -#ifdef _WIN32 - int dummy = getchar(); +#ifdef MICROSTRAIN_PLATFORM_WINDOWS + getchar(); #endif exit(0); diff --git a/examples/CV7/CV7_example.cpp b/examples/CV7/CV7_example.cpp index 4dbb7a54c..a414e3174 100644 --- a/examples/CV7/CV7_example.cpp +++ b/examples/CV7/CV7_example.cpp @@ -15,7 +15,7 @@ //! //! THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING //! CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER -//! FOR THEM TO SAVE TIME. AS A RESULT, HBK MICROSTRAIN SHALL NOT BE HELD +//! FOR THEM TO SAVE TIME. AS A RESULT, MICROSTRAIN BY HBK SHALL NOT BE HELD //! LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY //! CLAIMS ARISING FROM THE CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS //! OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. @@ -33,8 +33,6 @@ #include -using namespace mip; - //////////////////////////////////////////////////////////////////////////////// // Global Variables //////////////////////////////////////////////////////////////////////////////// @@ -43,14 +41,14 @@ using namespace mip; float sensor_to_vehicle_transformation_euler[3] = {0.0, 0.0, 0.0}; //Device data stores -data_shared::GpsTimestamp sensor_gps_time; -data_sensor::ScaledAccel sensor_accel; -data_sensor::ScaledGyro sensor_gyro; -data_sensor::ScaledMag sensor_mag; +mip::data_shared::GpsTimestamp sensor_gps_time; +mip::data_sensor::ScaledAccel sensor_accel; +mip::data_sensor::ScaledGyro sensor_gyro; +mip::data_sensor::ScaledMag sensor_mag; -data_shared::GpsTimestamp filter_gps_time; -data_filter::Status filter_status; -data_filter::EulerAngles filter_euler_angles; +mip::data_shared::GpsTimestamp filter_gps_time; +mip::data_filter::Status filter_status; +mip::data_filter::EulerAngles filter_euler_angles; bool filter_state_ahrs = false; @@ -68,7 +66,7 @@ int usage(const char* argv0); void exit_gracefully(const char *message); bool should_exit(); -void handleFilterEventSource(void*, const mip::Field& field, mip::Timestamp timestamp); +void handleFilterEventSource(void*, const mip::FieldView& field, mip::Timestamp timestamp); //////////////////////////////////////////////////////////////////////////////// // Main Function @@ -81,20 +79,20 @@ int main(int argc, const char* argv[]) std::unique_ptr utils; try { utils = handleCommonArgs(argc, argv); - } catch(const std::underflow_error& ex) { + } catch(const std::underflow_error&) { return printCommonUsage(argv); } catch(const std::exception& ex) { fprintf(stderr, "Error: %s\n", ex.what()); return 1; } - std::unique_ptr& device = utils->device; + std::unique_ptr& device = utils->device; // //Ping the device (note: this is good to do to make sure the device is present) // - if(commands_base::ping(*device) != CmdResult::ACK_OK) + if(mip::commands_base::ping(*device) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not ping the device!"); @@ -102,7 +100,7 @@ int main(int argc, const char* argv[]) //Idle the device (note: this is good to do during setup) // - if(commands_base::setIdle(*device) != CmdResult::ACK_OK) + if(mip::commands_base::setIdle(*device) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set the device to idle!"); @@ -110,7 +108,7 @@ int main(int argc, const char* argv[]) //Load the device default settings (so the device is in a known state) // - if(commands_3dm::defaultDeviceSettings(*device) != CmdResult::ACK_OK) + if(mip::commands_3dm::defaultDeviceSettings(*device) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not load default device settings!"); @@ -123,20 +121,20 @@ int main(int argc, const char* argv[]) //Note: Querying the device base rate is only one way to calculate the descriptor decimation. //We could have also set it directly with information from the datasheet (shown in GNSS setup). - if(commands_3dm::getBaseRate(*device, data_sensor::DESCRIPTOR_SET, &sensor_base_rate) != CmdResult::ACK_OK) + if(mip::commands_3dm::getBaseRate(*device, mip::data_sensor::DESCRIPTOR_SET, &sensor_base_rate) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not get sensor base rate format!"); const uint16_t sensor_sample_rate = 100; // Hz const uint16_t sensor_decimation = sensor_base_rate / sensor_sample_rate; - std::array sensor_descriptors = {{ - { data_shared::DATA_GPS_TIME, sensor_decimation }, - { data_sensor::DATA_ACCEL_SCALED, sensor_decimation }, - { data_sensor::DATA_GYRO_SCALED, sensor_decimation }, - { data_sensor::DATA_MAG_SCALED, sensor_decimation }, + std::array sensor_descriptors = {{ + { mip::data_shared::DATA_GPS_TIME, sensor_decimation }, + { mip::data_sensor::DATA_ACCEL_SCALED, sensor_decimation }, + { mip::data_sensor::DATA_GYRO_SCALED, sensor_decimation }, + { mip::data_sensor::DATA_MAG_SCALED, sensor_decimation }, }}; - if(commands_3dm::writeMessageFormat(*device, data_sensor::DESCRIPTOR_SET, sensor_descriptors.size(), sensor_descriptors.data()) != CmdResult::ACK_OK) + if(mip::commands_3dm::writeMessageFormat(*device, mip::data_sensor::DESCRIPTOR_SET, static_cast(sensor_descriptors.size()), sensor_descriptors.data()) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set sensor message format!"); @@ -146,19 +144,19 @@ int main(int argc, const char* argv[]) uint16_t filter_base_rate; - if(commands_3dm::getBaseRate(*device, data_filter::DESCRIPTOR_SET, &filter_base_rate) != CmdResult::ACK_OK) + if(mip::commands_3dm::getBaseRate(*device, mip::data_filter::DESCRIPTOR_SET, &filter_base_rate) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not get filter base rate format!"); const uint16_t filter_sample_rate = 100; // Hz const uint16_t filter_decimation = filter_base_rate / filter_sample_rate; - std::array filter_descriptors = {{ - { data_shared::DATA_GPS_TIME, filter_decimation }, - { data_filter::DATA_FILTER_STATUS, filter_decimation }, - { data_filter::DATA_ATT_EULER_ANGLES, filter_decimation }, + std::array filter_descriptors = {{ + { mip::data_shared::DATA_GPS_TIME, filter_decimation }, + { mip::data_filter::DATA_FILTER_STATUS, filter_decimation }, + { mip::data_filter::DATA_ATT_EULER_ANGLES, filter_decimation }, }}; - if(commands_3dm::writeMessageFormat(*device, data_filter::DESCRIPTOR_SET, filter_descriptors.size(), filter_descriptors.data()) != CmdResult::ACK_OK) + if(mip::commands_3dm::writeMessageFormat(*device, mip::data_filter::DESCRIPTOR_SET, static_cast(filter_descriptors.size()), filter_descriptors.data()) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set filter message format!"); @@ -171,55 +169,55 @@ int main(int argc, const char* argv[]) //EVENTS //Roll - commands_3dm::EventTrigger::Parameters event_params; - event_params.threshold.type = commands_3dm::EventTrigger::ThresholdParams::Type::WINDOW; - event_params.threshold.desc_set = data_filter::DESCRIPTOR_SET; - event_params.threshold.field_desc = data_filter::DATA_ATT_EULER_ANGLES; + mip::commands_3dm::EventTrigger::Parameters event_params; + event_params.threshold.type = mip::commands_3dm::EventTrigger::ThresholdParams::Type::WINDOW; + event_params.threshold.desc_set = mip::data_filter::DESCRIPTOR_SET; + event_params.threshold.field_desc = mip::data_filter::DATA_ATT_EULER_ANGLES; event_params.threshold.param_id = 1; event_params.threshold.high_thres = -0.7853981; event_params.threshold.low_thres = 0.7853981; - if(commands_3dm::writeEventTrigger(*device, FILTER_ROLL_EVENT_ACTION_ID, commands_3dm::EventTrigger::Type::THRESHOLD, event_params) != CmdResult::ACK_OK) + if(mip::commands_3dm::writeEventTrigger(*device, FILTER_ROLL_EVENT_ACTION_ID, mip::commands_3dm::EventTrigger::Type::THRESHOLD, event_params) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set roll event parameters!"); - //Pitch + //Pitch event_params.threshold.param_id = 2; - if(commands_3dm::writeEventTrigger(*device, FILTER_PITCH_EVENT_ACTION_ID, commands_3dm::EventTrigger::Type::THRESHOLD, event_params) != CmdResult::ACK_OK) + if(mip::commands_3dm::writeEventTrigger(*device, FILTER_PITCH_EVENT_ACTION_ID, mip::commands_3dm::EventTrigger::Type::THRESHOLD, event_params) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set pitch event parameters!"); //ACTIONS - //Roll - commands_3dm::EventAction::Parameters event_action; - event_action.message.desc_set = data_filter::DESCRIPTOR_SET; + //Roll + mip::commands_3dm::EventAction::Parameters event_action; + event_action.message.desc_set = mip::data_filter::DESCRIPTOR_SET; event_action.message.num_fields = 1; - event_action.message.descriptors[0] = data_shared::DATA_EVENT_SOURCE; + event_action.message.descriptors[0] = mip::data_shared::DATA_EVENT_SOURCE; event_action.message.decimation = 0; - if(writeEventAction(*device, FILTER_ROLL_EVENT_ACTION_ID, FILTER_ROLL_EVENT_ACTION_ID, commands_3dm::EventAction::Type::MESSAGE, event_action) != CmdResult::ACK_OK) + if(writeEventAction(*device, FILTER_ROLL_EVENT_ACTION_ID, FILTER_ROLL_EVENT_ACTION_ID, mip::commands_3dm::EventAction::Type::MESSAGE, event_action) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set roll action parameters!"); - //Pitch - if(writeEventAction(*device, FILTER_PITCH_EVENT_ACTION_ID, FILTER_PITCH_EVENT_ACTION_ID, commands_3dm::EventAction::Type::MESSAGE, event_action) != CmdResult::ACK_OK) + //Pitch + if(writeEventAction(*device, FILTER_PITCH_EVENT_ACTION_ID, FILTER_PITCH_EVENT_ACTION_ID, mip::commands_3dm::EventAction::Type::MESSAGE, event_action) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set pitch action parameters!"); //ENABLE EVENTS //Roll - if(writeEventControl(*device, FILTER_ROLL_EVENT_ACTION_ID, commands_3dm::EventControl::Mode::ENABLED) != CmdResult::ACK_OK) + if(writeEventControl(*device, FILTER_ROLL_EVENT_ACTION_ID, mip::commands_3dm::EventControl::Mode::ENABLED) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not enable roll event!"); - + //Pitch - if(writeEventControl(*device, FILTER_PITCH_EVENT_ACTION_ID, commands_3dm::EventControl::Mode::ENABLED) != CmdResult::ACK_OK) + if(writeEventControl(*device, FILTER_PITCH_EVENT_ACTION_ID, mip::commands_3dm::EventControl::Mode::ENABLED) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not enable pitch event!"); // //Setup the sensor to vehicle transformation // - if(commands_3dm::writeSensor2VehicleTransformEuler(*device, sensor_to_vehicle_transformation_euler[0], sensor_to_vehicle_transformation_euler[1], sensor_to_vehicle_transformation_euler[2]) != CmdResult::ACK_OK) + if(mip::commands_3dm::writeSensor2VehicleTransformEuler(*device, sensor_to_vehicle_transformation_euler[0], sensor_to_vehicle_transformation_euler[1], sensor_to_vehicle_transformation_euler[2]) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set sensor-to-vehicle transformation!"); @@ -227,7 +225,7 @@ int main(int argc, const char* argv[]) //Setup the filter aiding measurements (GNSS position/velocity and dual antenna [aka gnss heading]) // - if(commands_filter::writeAidingMeasurementEnable(*device, commands_filter::AidingMeasurementEnable::AidingSource::MAGNETOMETER, true) != CmdResult::ACK_OK) + if(mip::commands_filter::writeAidingMeasurementEnable(*device, mip::commands_filter::AidingMeasurementEnable::AidingSource::MAGNETOMETER, true) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set filter aiding measurement enable!"); @@ -235,7 +233,7 @@ int main(int argc, const char* argv[]) //Reset the filter (note: this is good to do after filter setup is complete) // - if(commands_filter::reset(*device) != CmdResult::ACK_OK) + if(mip::commands_filter::reset(*device) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not reset the filter!"); @@ -244,27 +242,27 @@ int main(int argc, const char* argv[]) // //Sensor Data - DispatchHandler sensor_data_handlers[4]; + mip::DispatchHandler sensor_data_handlers[4]; - device->registerExtractor(sensor_data_handlers[0], &sensor_gps_time, data_sensor::DESCRIPTOR_SET); + device->registerExtractor(sensor_data_handlers[0], &sensor_gps_time, mip::data_sensor::DESCRIPTOR_SET); device->registerExtractor(sensor_data_handlers[1], &sensor_accel); device->registerExtractor(sensor_data_handlers[2], &sensor_gyro); device->registerExtractor(sensor_data_handlers[3], &sensor_mag); //Filter Data - DispatchHandler filter_data_handlers[4]; + mip::DispatchHandler filter_data_handlers[4]; - device->registerExtractor(filter_data_handlers[0], &filter_gps_time, data_filter::DESCRIPTOR_SET); + device->registerExtractor(filter_data_handlers[0], &filter_gps_time, mip::data_filter::DESCRIPTOR_SET); device->registerExtractor(filter_data_handlers[1], &filter_status); device->registerExtractor(filter_data_handlers[2], &filter_euler_angles); - device->registerFieldCallback<&handleFilterEventSource>(filter_data_handlers[3], data_filter::DESCRIPTOR_SET, data_shared::DATA_EVENT_SOURCE); + device->registerFieldCallback<&handleFilterEventSource>(filter_data_handlers[3], mip::data_filter::DESCRIPTOR_SET, mip::data_shared::DATA_EVENT_SOURCE); // //Resume the device // - if(commands_base::resume(*device) != CmdResult::ACK_OK) + if(mip::commands_base::resume(*device) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not resume the device!"); @@ -277,14 +275,14 @@ int main(int argc, const char* argv[]) printf("Sensor is configured... waiting for filter to enter AHRS mode (AHRS).\n"); - auto current_state = std::string{""}; + std::string current_state = ""; while(running) { device->update(); displayFilterState(filter_status.filter_state, current_state); //Check Filter State - if((!filter_state_ahrs) && (filter_status.filter_state == data_filter::FilterMode::AHRS)) + if((!filter_state_ahrs) && (filter_status.filter_state == mip::data_filter::FilterMode::AHRS)) { printf("NOTE: Filter has entered AHRS mode.\n"); filter_state_ahrs = true; @@ -316,7 +314,7 @@ int main(int argc, const char* argv[]) // Filter Event Source Field Handler //////////////////////////////////////////////////////////////////////////////// -void handleFilterEventSource(void*, const mip::Field& field, mip::Timestamp timestamp) +void handleFilterEventSource(void*, const mip::FieldView& field, mip::Timestamp) { mip::data_shared::EventSource data; @@ -350,9 +348,9 @@ void exit_gracefully(const char *message) if(message) printf("%s\n", message); -#ifdef _WIN32 +#ifdef MICROSTRAIN_PLATFORM_WINDOWS printf("Press ENTER to exit...\n"); - int dummy = getchar(); + getchar(); #endif exit(0); @@ -368,4 +366,3 @@ bool should_exit() return false; } - diff --git a/examples/CV7_INS/CV7_INS_simple_example.cpp b/examples/CV7_INS/CV7_INS_simple_example.cpp index 5a9177557..905bb5056 100644 --- a/examples/CV7_INS/CV7_INS_simple_example.cpp +++ b/examples/CV7_INS/CV7_INS_simple_example.cpp @@ -14,7 +14,7 @@ //! //! THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING //! CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER -//! FOR THEM TO SAVE TIME. AS A RESULT, HBK MICROSTRAIN SHALL NOT BE HELD +//! FOR THEM TO SAVE TIME. AS A RESULT, MICROSTRAIN BY HBK SHALL NOT BE HELD //! LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY //! CLAIMS ARISING FROM THE CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS //! OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. @@ -30,17 +30,15 @@ #include "example_utils.hpp" #include -using namespace mip; - //////////////////////////////////////////////////////////////////////////////// // Global Variables //////////////////////////////////////////////////////////////////////////////// -data_shared::GpsTimestamp filter_gps_time; -data_filter::Status filter_status; -data_filter::EulerAngles filter_euler_angles; -data_filter::PositionLlh filter_llh_position; -data_filter::VelocityNed filter_ned_velocity; +mip::data_shared::GpsTimestamp filter_gps_time; +mip::data_filter::Status filter_status; +mip::data_filter::EulerAngles filter_euler_angles; +mip::data_filter::PositionLlh filter_llh_position; +mip::data_filter::VelocityNed filter_ned_velocity; uint8_t external_heading_sensor_id = 1; uint8_t gnss_antenna_sensor_id = 2; @@ -54,7 +52,7 @@ bool filter_state_full_nav = false; int usage(const char* argv0); -void print_device_information(const commands_base::BaseDeviceInfo& device_info); +void print_device_information(const mip::commands_base::BaseDeviceInfo& device_info); void exit_gracefully(const char *message); bool should_exit(); @@ -70,28 +68,28 @@ int main(int argc, const char* argv[]) std::unique_ptr utils; try { utils = handleCommonArgs(argc, argv); - } catch(const std::underflow_error& ex) { + } catch(const std::underflow_error&) { return printCommonUsage(argv); } catch(const std::exception& ex) { fprintf(stderr, "Error: %s\n", ex.what()); return 1; } - std::unique_ptr& device = utils->device; + std::unique_ptr& device = utils->device; // //Ping the device (note: this is good to do to make sure the device is present) // - if(commands_base::ping(*device) != CmdResult::ACK_OK) + if(mip::commands_base::ping(*device) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not ping the device!"); // //Read device information // - commands_base::BaseDeviceInfo device_info; - if(commands_base::getDeviceInfo(*device, &device_info) != CmdResult::ACK_OK) + mip::commands_base::BaseDeviceInfo device_info; + if(mip::commands_base::getDeviceInfo(*device, &device_info) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Failed to get device info"); print_device_information(device_info); @@ -100,7 +98,7 @@ int main(int argc, const char* argv[]) //Idle the device (note: this is good to do during setup) // - if(commands_base::setIdle(*device) != CmdResult::ACK_OK) + if(mip::commands_base::setIdle(*device) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set the device to idle!"); @@ -108,7 +106,7 @@ int main(int argc, const char* argv[]) //Load the device default settings (so the device is in a known state) // - if(commands_3dm::defaultDeviceSettings(*device) != CmdResult::ACK_OK) + if(mip::commands_3dm::defaultDeviceSettings(*device) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not load default device settings!"); @@ -120,33 +118,33 @@ int main(int argc, const char* argv[]) // //External heading sensor reference frame. // - commands_aiding::FrameConfig::Rotation external_heading_sensor_to_vehicle_frame_rotation; + mip::commands_aiding::FrameConfig::Rotation external_heading_sensor_to_vehicle_frame_rotation; external_heading_sensor_to_vehicle_frame_rotation.euler = mip::Vector3f(0.0f, 0.0f, 0.0f); // External heading sensor is aligned with vehicle frame float external_heading_sensor_to_vehicle_frame_translation[3] = {0.0, 0.0, 0.0}; // Heading measurements are agnostic to translation, translation set to zero - if(commands_aiding::writeFrameConfig(*device, external_heading_sensor_id, mip::commands_aiding::FrameConfig::Format::EULER, true, - external_heading_sensor_to_vehicle_frame_translation, external_heading_sensor_to_vehicle_frame_rotation) != CmdResult::ACK_OK) + if(mip::commands_aiding::writeFrameConfig(*device, external_heading_sensor_id, mip::commands_aiding::FrameConfig::Format::EULER, true, + external_heading_sensor_to_vehicle_frame_translation, external_heading_sensor_to_vehicle_frame_rotation) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Unable to configure external heading sensor frame ID"); // //External GNSS antenna reference frame // - commands_aiding::FrameConfig::Rotation external_gnss_antenna_to_vehicle_frame_rotation; + mip::commands_aiding::FrameConfig::Rotation external_gnss_antenna_to_vehicle_frame_rotation; external_gnss_antenna_to_vehicle_frame_rotation.euler = mip::Vector3f(0.0f, 0.0f, 0.0f); // GNSS position/velocity measurements are agnostic to rotation, rotation set to zero float external_gnss_antenna_to_vehicle_frame_translation[3] = {0.0, 1.0, 0.0}; // Antenna is translated 1 meter in vehicle frame Y direction - if(commands_aiding::writeFrameConfig(*device, gnss_antenna_sensor_id, mip::commands_aiding::FrameConfig::Format::EULER, true, - external_gnss_antenna_to_vehicle_frame_translation, external_gnss_antenna_to_vehicle_frame_rotation) != CmdResult::ACK_OK) + if(mip::commands_aiding::writeFrameConfig(*device, gnss_antenna_sensor_id, mip::commands_aiding::FrameConfig::Format::EULER, true, + external_gnss_antenna_to_vehicle_frame_translation, external_gnss_antenna_to_vehicle_frame_rotation) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Unable to configure external GNSS antenna frame ID"); // //External bodyframe velocity reference frame // - commands_aiding::FrameConfig::Rotation external_velocity_sensor_to_vehicle_frame_rotation; + mip::commands_aiding::FrameConfig::Rotation external_velocity_sensor_to_vehicle_frame_rotation; external_velocity_sensor_to_vehicle_frame_rotation.euler= mip::Vector3f(0.0f, 0.0f, 1.57f); // Rotated 90 deg around yaw axis float external_velocity_sensor_to_vehicle_frame_translation[3] = {1.0, 0.0, 0.0}; // Sensor is translated 1 meter in X direction - if(commands_aiding::writeFrameConfig(*device, vehicle_frame_velocity_sensor_id, mip::commands_aiding::FrameConfig::Format::EULER, true, - external_velocity_sensor_to_vehicle_frame_translation, external_velocity_sensor_to_vehicle_frame_rotation) != CmdResult::ACK_OK) + if(mip::commands_aiding::writeFrameConfig(*device, vehicle_frame_velocity_sensor_id, mip::commands_aiding::FrameConfig::Format::EULER, true, + external_velocity_sensor_to_vehicle_frame_translation, external_velocity_sensor_to_vehicle_frame_rotation) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Unable to configure external vehicle frame velocity sensor ID"); @@ -156,39 +154,40 @@ int main(int argc, const char* argv[]) uint16_t filter_base_rate; - if(commands_3dm::getBaseRate(*device, data_filter::DESCRIPTOR_SET, &filter_base_rate) != CmdResult::ACK_OK) + if(mip::commands_3dm::getBaseRate(*device, mip::data_filter::DESCRIPTOR_SET, &filter_base_rate) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not get filter base rate format!"); const uint16_t filter_sample_rate = 100; // Hz const uint16_t filter_decimation = filter_base_rate / filter_sample_rate; - std::array filter_descriptors = {{ - { data_shared::DATA_GPS_TIME, filter_decimation }, - { data_filter::DATA_FILTER_STATUS, filter_decimation }, - { data_filter::DATA_ATT_EULER_ANGLES, filter_decimation }, - { data_filter::DATA_POS_LLH, filter_decimation }, - { data_filter::DATA_VEL_NED, filter_decimation }, + std::array filter_descriptors = {{ + { mip::data_shared::DATA_GPS_TIME, filter_decimation }, + { mip::data_filter::DATA_FILTER_STATUS, filter_decimation }, + { mip::data_filter::DATA_ATT_EULER_ANGLES, filter_decimation }, + { mip::data_filter::DATA_POS_LLH, filter_decimation }, + { mip::data_filter::DATA_VEL_NED, filter_decimation }, }}; - if(commands_3dm::writeMessageFormat(*device, data_filter::DESCRIPTOR_SET, filter_descriptors.size(), filter_descriptors.data()) != CmdResult::ACK_OK) + if(mip::commands_3dm::writeMessageFormat(*device, mip::data_filter::DESCRIPTOR_SET, static_cast(filter_descriptors.size()), filter_descriptors.data()) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set filter message format!"); // //Configure the filter to accept external heading // - const auto initConfig = commands_filter::InitializationConfiguration::InitialConditionSource::AUTO_POS_VEL_PITCH_ROLL; - commands_filter::InitializationConfiguration::AlignmentSelector alignment; + const mip::commands_filter::InitializationConfiguration::InitialConditionSource initConfig = + mip::commands_filter::InitializationConfiguration::InitialConditionSource::AUTO_POS_VEL_PITCH_ROLL; + mip::commands_filter::InitializationConfiguration::AlignmentSelector alignment; alignment.external(true); - const Vector3f zero3({0, 0, 0}); - if(commands_filter::writeInitializationConfiguration(*device, 0, initConfig, alignment, 0, 0, 0, zero3, zero3, commands_filter::FilterReferenceFrame::LLH) != CmdResult::ACK_OK) + const mip::Vector3f zero3({0, 0, 0}); + if(mip::commands_filter::writeInitializationConfiguration(*device, 0, initConfig, alignment, 0, 0, 0, zero3, zero3, mip::commands_filter::FilterReferenceFrame::LLH) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set heading source!"); // //Reset the filter (note: this is good to do after filter setup is complete) // - if(commands_filter::reset(*device) != CmdResult::ACK_OK) + if(mip::commands_filter::reset(*device) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not reset the filter!"); @@ -197,9 +196,9 @@ int main(int argc, const char* argv[]) // //Filter Data - DispatchHandler filter_data_handlers[5]; + mip::DispatchHandler filter_data_handlers[5]; - device->registerExtractor(filter_data_handlers[0], &filter_gps_time, data_filter::DESCRIPTOR_SET); + device->registerExtractor(filter_data_handlers[0], &filter_gps_time, mip::data_filter::DESCRIPTOR_SET); device->registerExtractor(filter_data_handlers[1], &filter_status); device->registerExtractor(filter_data_handlers[2], &filter_euler_angles); device->registerExtractor(filter_data_handlers[3], &filter_llh_position); @@ -209,7 +208,7 @@ int main(int argc, const char* argv[]) //Resume the device // - if(commands_base::resume(*device) != CmdResult::ACK_OK) + if(mip::commands_base::resume(*device) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not resume the device!"); @@ -230,7 +229,7 @@ int main(int argc, const char* argv[]) displayFilterState(filter_status.filter_state, current_state); //Check for full nav filter state transition - if((!filter_state_full_nav) && (filter_status.filter_state == data_filter::FilterMode::FULL_NAV)) + if((!filter_state_full_nav) && (filter_status.filter_state == mip::data_filter::FilterMode::FULL_NAV)) { printf("NOTE: Filter has entered full navigation mode.\n"); filter_state_full_nav = true; @@ -244,15 +243,15 @@ int main(int argc, const char* argv[]) if (elapsed_time_from_last_measurement_update > 500) { // Use measurement time of arrival for timestamping method - commands_aiding::Time external_measurement_time; - external_measurement_time.timebase = commands_aiding::Time::Timebase::TIME_OF_ARRIVAL; + mip::commands_aiding::Time external_measurement_time; + external_measurement_time.timebase = mip::commands_aiding::Time::Timebase::TIME_OF_ARRIVAL; external_measurement_time.reserved = 1; external_measurement_time.nanoseconds = current_timestamp * uint64_t(1000000); // External heading command - float external_heading = 0.0; - float external_heading_uncertainty = 0.001; - if(commands_aiding::headingTrue(*device, external_measurement_time, external_heading_sensor_id, external_heading, external_heading_uncertainty, 0x0001) != CmdResult::ACK_OK) + float external_heading = 0.0f; + float external_heading_uncertainty = 0.001f; + if(mip::commands_aiding::headingTrue(*device, external_measurement_time, external_heading_sensor_id, external_heading, external_heading_uncertainty, 0x0001) != mip::CmdResult::ACK_OK) printf("WARNING: Failed to send external heading to CV7-INS\n"); // External position command @@ -260,26 +259,26 @@ int main(int argc, const char* argv[]) double longitude = -73.10628129871753; double height = 122.0; float llh_uncertainty[3] = {1.0, 1.0, 1.0}; - if(commands_aiding::posLlh(*device, external_measurement_time, gnss_antenna_sensor_id, latitude, longitude, height, llh_uncertainty, 0x0007) != CmdResult::ACK_OK) + if(mip::commands_aiding::posLlh(*device, external_measurement_time, gnss_antenna_sensor_id, latitude, longitude, height, llh_uncertainty, 0x0007) != mip::CmdResult::ACK_OK) printf("WARNING: Failed to send external position to CV7-INS\n"); // External global velocity command - float ned_velocity[3] = {0.0, 0.0, 0.0}; - float ned_velocity_uncertainty[3] = {0.1, 0.1, 0.1}; - if(commands_aiding::velNed(*device, external_measurement_time, gnss_antenna_sensor_id, ned_velocity, ned_velocity_uncertainty, 0x0007) != CmdResult::ACK_OK) + float ned_velocity[3] = {0.0f, 0.0f, 0.0f}; + float ned_velocity_uncertainty[3] = {0.1f, 0.1f, 0.1f}; + if(mip::commands_aiding::velNed(*device, external_measurement_time, gnss_antenna_sensor_id, ned_velocity, ned_velocity_uncertainty, 0x0007) != mip::CmdResult::ACK_OK) printf("WARNING: Failed to send external NED velocity to CV7-INS\n"); // External vehicle frame velocity command - float vehicle_frame_velocity[3] = {0.0, 0.0, 0.0}; - float vehicle_frame_velocity_uncertainty[3] = {0.1, 0.1, 0.1}; - if(commands_aiding::velBodyFrame(*device, external_measurement_time, vehicle_frame_velocity_sensor_id, vehicle_frame_velocity, vehicle_frame_velocity_uncertainty, 0x0007) != CmdResult::ACK_OK) + float vehicle_frame_velocity[3] = {0.0f, 0.0f, 0.0f}; + float vehicle_frame_velocity_uncertainty[3] = {0.1f, 0.1f, 0.1f}; + if(mip::commands_aiding::velBodyFrame(*device, external_measurement_time, vehicle_frame_velocity_sensor_id, vehicle_frame_velocity, vehicle_frame_velocity_uncertainty, 0x0007) != mip::CmdResult::ACK_OK) printf("WARNING: Failed to send external vehicle frame velocity to CV7-INS\n"); prev_measurement_update_timestamp = current_timestamp; } //Once in full nav, print out data at 1 Hz - if((filter_status.filter_state == data_filter::FilterMode::FULL_NAV) && (elapsed_time_from_last_message_print >= 1000)) + if((filter_status.filter_state == mip::data_filter::FilterMode::FULL_NAV) && (elapsed_time_from_last_message_print >= 1000)) { printf("\n\n****Filter navigation state****\n"); printf("TIMESTAMP: %f\n", filter_gps_time.tow); @@ -301,14 +300,18 @@ int main(int argc, const char* argv[]) // Print device information //////////////////////////////////////////////////////////////////////////////// -void print_device_information(const commands_base::BaseDeviceInfo& device_info) +void print_device_information(const mip::commands_base::BaseDeviceInfo& device_info) { printf("Connected to:\n"); auto print_info = [](const char* name, const char info[16]) { char msg[17] = {0}; +#ifdef _WIN32 + strncpy_s(msg, info, 16); +#else std::strncpy(msg, info, 16); +#endif printf(" %s%s\n", name, msg); }; @@ -346,9 +349,9 @@ void exit_gracefully(const char *message) if(message) printf("%s\n", message); -#ifdef _WIN32 +#ifdef MICROSTRAIN_PLATFORM_WINDOWS printf("Press ENTER to exit...\n"); - int dummy = getchar(); + getchar(); #endif exit(0); @@ -363,4 +366,3 @@ bool should_exit() { return false; } - diff --git a/examples/CV7_INS/CV7_INS_simple_ublox_example.cpp b/examples/CV7_INS/CV7_INS_simple_ublox_example.cpp index 470eaa627..531a283b5 100644 --- a/examples/CV7_INS/CV7_INS_simple_ublox_example.cpp +++ b/examples/CV7_INS/CV7_INS_simple_ublox_example.cpp @@ -11,7 +11,7 @@ //! //! THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING //! CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER -//! FOR THEM TO SAVE TIME. AS A RESULT, HBK MICROSTRAIN SHALL NOT BE HELD +//! FOR THEM TO SAVE TIME. AS A RESULT, MICROSTRAIN BY HBK SHALL NOT BE HELD //! LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY //! CLAIMS ARISING FROM THE CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS //! OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. @@ -33,18 +33,16 @@ #include #include -using namespace mip; - //////////////////////////////////////////////////////////////////////////////// // Global Variables //////////////////////////////////////////////////////////////////////////////// -data_shared::GpsTimestamp filter_gps_time; -data_filter::Status filter_status; -data_filter::EulerAngles filter_euler_angles; -data_filter::PositionLlh filter_llh_position; -data_filter::VelocityNed filter_ned_velocity; -data_system::TimeSyncStatus system_time_sync_status; +mip::data_shared::GpsTimestamp filter_gps_time; +mip::data_filter::Status filter_status; +mip::data_filter::EulerAngles filter_euler_angles; +mip::data_filter::PositionLlh filter_llh_position; +mip::data_filter::VelocityNed filter_ned_velocity; +mip::data_system::TimeSyncStatus system_time_sync_status; uint8_t gnss_antenna_sensor_id = 1; @@ -61,9 +59,9 @@ struct InputArguments bool enable_pps_sync = false; - int pps_input_pin_id = 1; + uint8_t pps_input_pin_id = 1; - commands_filter::InitializationConfiguration::AlignmentSelector filter_heading_alignment_method = commands_filter::InitializationConfiguration::AlignmentSelector::KINEMATIC; + mip::commands_filter::InitializationConfiguration::AlignmentSelector filter_heading_alignment_method = mip::commands_filter::InitializationConfiguration::AlignmentSelector::KINEMATIC; float gnss_antenna_lever_arm[3] = {0,0,0}; }; @@ -74,7 +72,7 @@ struct InputArguments int usage(const char* argv0); -void print_device_information(const commands_base::BaseDeviceInfo& device_info); +void print_device_information(const mip::commands_base::BaseDeviceInfo& device_info); void exit_gracefully(const char *message); bool should_exit(); @@ -90,34 +88,34 @@ int main(int argc, const char* argv[]) InputArguments input_arguments = parse_input_arguments(argc, argv); std::unique_ptr utils = openFromArgs(input_arguments.mip_device_port_name, input_arguments.mip_device_baudrate, input_arguments.mip_binary_filepath); - std::unique_ptr& device = utils->device; - + std::unique_ptr& device = utils->device; + // // Open uBlox serial port // printf("Connecting to UBlox F9P on %s at %s...\n", input_arguments.ublox_device_port_name.c_str(), input_arguments.ublox_device_baudrate.c_str()); std::unique_ptr utils_ublox = openFromArgs(input_arguments.ublox_device_port_name, input_arguments.ublox_device_baudrate, {}); - ublox::UbloxDevice ublox_device(std::move(utils_ublox->connection)); + mip::ublox::UbloxDevice ublox_device(std::move(utils_ublox->connection)); // //Attempt to idle the device before pinging // - commands_base::setIdle(*device); + mip::commands_base::setIdle(*device); // //Ping the device (note: this is good to do to make sure the device is present) // - if(commands_base::ping(*device) != CmdResult::ACK_OK) + if(mip::commands_base::ping(*device) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not ping the device!"); // //Read device information // - commands_base::BaseDeviceInfo device_info; - if(commands_base::getDeviceInfo(*device, &device_info) != CmdResult::ACK_OK) + mip::commands_base::BaseDeviceInfo device_info; + if(mip::commands_base::getDeviceInfo(*device, &device_info) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Failed to get device info"); print_device_information(device_info); @@ -125,7 +123,7 @@ int main(int argc, const char* argv[]) //Idle the device (note: this is good to do during setup) // - if(commands_base::setIdle(*device) != CmdResult::ACK_OK) + if(mip::commands_base::setIdle(*device) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set the device to idle!"); @@ -133,17 +131,17 @@ int main(int argc, const char* argv[]) //Load the device default settings (so the device is in a known state) // - if(commands_3dm::defaultDeviceSettings(*device) != CmdResult::ACK_OK) + if(mip::commands_3dm::defaultDeviceSettings(*device) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not load default device settings!"); // //External GNSS antenna reference frame // - commands_aiding::FrameConfig::Rotation external_gnss_antenna_to_vehicle_frame_rotation; + mip::commands_aiding::FrameConfig::Rotation external_gnss_antenna_to_vehicle_frame_rotation; external_gnss_antenna_to_vehicle_frame_rotation.euler = mip::Vector3f(0.0f, 0.0f, 0.0f); // GNSS position/velocity measurements are agnostic to rotation, rotation set to zero // GNSS position/velocity measurements are agnostic to rotation, rotation set to zero - if(commands_aiding::writeFrameConfig(*device, gnss_antenna_sensor_id, mip::commands_aiding::FrameConfig::Format::EULER, true, - input_arguments.gnss_antenna_lever_arm, external_gnss_antenna_to_vehicle_frame_rotation) != CmdResult::ACK_OK) + if(mip::commands_aiding::writeFrameConfig(*device, gnss_antenna_sensor_id, mip::commands_aiding::FrameConfig::Format::EULER, true, + input_arguments.gnss_antenna_lever_arm, external_gnss_antenna_to_vehicle_frame_rotation) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Unable to configure external GNSS antenna frame ID"); @@ -152,8 +150,8 @@ int main(int argc, const char* argv[]) // float default_init[3] = {0,0,0}; - if(commands_filter::writeInitializationConfiguration(*device, false, commands_filter::InitializationConfiguration::InitialConditionSource::AUTO_POS_VEL_ATT, input_arguments.filter_heading_alignment_method, - 0, 0, 0, default_init, default_init, commands_filter::FilterReferenceFrame::ECEF) != CmdResult::ACK_OK) + if(mip::commands_filter::writeInitializationConfiguration(*device, false, mip::commands_filter::InitializationConfiguration::InitialConditionSource::AUTO_POS_VEL_ATT, input_arguments.filter_heading_alignment_method, + 0, 0, 0, default_init, default_init, mip::commands_filter::FilterReferenceFrame::ECEF) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not load default device settings!"); @@ -165,18 +163,18 @@ int main(int argc, const char* argv[]) // uint16_t system_data_base_rate; - if(commands_3dm::getBaseRate(*device, data_system::DESCRIPTOR_SET, &system_data_base_rate) != CmdResult::ACK_OK) + if(mip::commands_3dm::getBaseRate(*device, mip::data_system::DESCRIPTOR_SET, &system_data_base_rate) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not get system data base rate format!"); const uint16_t system_data_sample_rate = 10; // Hz const uint16_t system_data_decimation = system_data_base_rate / system_data_sample_rate; - std::array system_data_descriptors = {{ - { data_shared::DATA_GPS_TIME, system_data_decimation }, - { data_system::DATA_TIME_SYNC_STATUS, system_data_decimation }, + std::array system_data_descriptors = {{ + { mip::data_shared::DATA_GPS_TIME, system_data_decimation }, + { mip::data_system::DATA_TIME_SYNC_STATUS, system_data_decimation }, }}; - if(commands_3dm::writeMessageFormat(*device, data_system::DESCRIPTOR_SET, system_data_descriptors.size(), system_data_descriptors.data()) != CmdResult::ACK_OK) + if(mip::commands_3dm::writeMessageFormat(*device, mip::data_system::DESCRIPTOR_SET, static_cast(system_data_descriptors.size()), system_data_descriptors.data()) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set system data message format!"); @@ -184,7 +182,7 @@ int main(int argc, const char* argv[]) // Setup GPIO for PPS input functionality // - if (commands_3dm::writeGpioConfig(*device, input_arguments.pps_input_pin_id, mip::commands_3dm::GpioConfig::Feature::PPS, mip::commands_3dm::GpioConfig::Behavior::PPS_INPUT, mip::commands_3dm::GpioConfig::PinMode::NONE) != CmdResult::ACK_OK) + if (mip::commands_3dm::writeGpioConfig(*device, input_arguments.pps_input_pin_id, mip::commands_3dm::GpioConfig::Feature::PPS, mip::commands_3dm::GpioConfig::Behavior::PPS_INPUT, mip::commands_3dm::GpioConfig::PinMode::NONE) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set GPIO to PPS input!"); @@ -192,7 +190,7 @@ int main(int argc, const char* argv[]) // Setup PPS source as GPIO // - if (mip::commands_3dm::writePpsSource(*device, mip::commands_3dm::PpsSource::Source::GPIO) != CmdResult::ACK_OK) + if (mip::commands_3dm::writePpsSource(*device, mip::commands_3dm::PpsSource::Source::GPIO) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Failed to set PPS source to GPIO!"); } @@ -201,26 +199,27 @@ int main(int argc, const char* argv[]) //Configure factory streaming data. This enables all critical data channels required for post-processing analysis // - if(commands_3dm::factoryStreaming(*device, commands_3dm::FactoryStreaming::Action::MERGE, 0) != CmdResult::ACK_OK) + if(mip::commands_3dm::factoryStreaming(*device, mip::commands_3dm::FactoryStreaming::Action::MERGE, 0) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not enable factory streaming support!"); // //Configure the filter to use magnetometer or GNSS kinematic heading // - const auto initConfig = commands_filter::InitializationConfiguration::InitialConditionSource::AUTO_POS_VEL_PITCH_ROLL; - commands_filter::InitializationConfiguration::AlignmentSelector alignment; + const mip::commands_filter::InitializationConfiguration::InitialConditionSource initConfig = + mip::commands_filter::InitializationConfiguration::InitialConditionSource::AUTO_POS_VEL_PITCH_ROLL; + mip::commands_filter::InitializationConfiguration::AlignmentSelector alignment; alignment.magnetometer(true); alignment.kinematic(true); - const Vector3f zero3({0, 0, 0}); - if(commands_filter::writeInitializationConfiguration(*device, 0, initConfig, alignment, 0, 0, 0, zero3, zero3, commands_filter::FilterReferenceFrame::LLH) != CmdResult::ACK_OK) + const mip::Vector3f zero3({0, 0, 0}); + if(mip::commands_filter::writeInitializationConfiguration(*device, 0, initConfig, alignment, 0, 0, 0, zero3, zero3, mip::commands_filter::FilterReferenceFrame::LLH) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set heading source!"); // //Reset the filter (note: this is good to do after filter setup is complete) // - if(commands_filter::reset(*device) != CmdResult::ACK_OK) + if(mip::commands_filter::reset(*device) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not reset the filter!"); @@ -229,26 +228,26 @@ int main(int argc, const char* argv[]) // //Filter Data - DispatchHandler filter_data_handlers[5]; + mip::DispatchHandler filter_data_handlers[5]; - device->registerExtractor(filter_data_handlers[0], &filter_gps_time, data_filter::DESCRIPTOR_SET); + device->registerExtractor(filter_data_handlers[0], &filter_gps_time, mip::data_filter::DESCRIPTOR_SET); device->registerExtractor(filter_data_handlers[1], &filter_status); device->registerExtractor(filter_data_handlers[2], &filter_euler_angles); device->registerExtractor(filter_data_handlers[3], &filter_llh_position); device->registerExtractor(filter_data_handlers[4], &filter_ned_velocity); //System Data - DispatchHandler system_data_handlers[1]; + mip::DispatchHandler system_data_handlers[1]; - device->registerExtractor(system_data_handlers[0], &system_time_sync_status, data_system::DESCRIPTOR_SET); + device->registerExtractor(system_data_handlers[0], &system_time_sync_status, mip::data_system::DESCRIPTOR_SET); // //Resume the device // - if(commands_base::resume(*device) != CmdResult::ACK_OK) + if(mip::commands_base::resume(*device) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not resume the device!"); - + //Main Loop: Update the interface and process data // @@ -266,10 +265,10 @@ int main(int argc, const char* argv[]) device->update(); // Get ublox data - std::pair ubox_parser_result = ublox_device.update(); + std::pair ubox_parser_result = ublox_device.update(); bool pvt_message_valid = ubox_parser_result.first; - ublox::UbloxPVTMessage pvt_message = ubox_parser_result.second; - + mip::ublox::UbloxPVTMessage pvt_message = ubox_parser_result.second; + // Wait for valid PPS lock if (input_arguments.enable_pps_sync && !pps_sync_valid) { @@ -283,9 +282,9 @@ int main(int argc, const char* argv[]) } continue; } - + //Check for full nav filter state transition - if((!filter_state_full_nav) && (filter_status.filter_state == data_filter::FilterMode::FULL_NAV)) + if((!filter_state_full_nav) && (filter_status.filter_state == mip::data_filter::FilterMode::FULL_NAV)) { printf("NOTE: Filter has entered full navigation mode.\n"); filter_state_full_nav = true; @@ -296,7 +295,7 @@ int main(int argc, const char* argv[]) bool print_new_update_message = elapsed_time_from_last_message_print >= 1000; if (print_new_update_message) { - if(filter_status.filter_state == data_filter::FilterMode::FULL_NAV) + if(filter_status.filter_state == mip::data_filter::FilterMode::FULL_NAV) { printf("\n\n****Filter navigation state****\n"); printf("TIMESTAMP: %f\n", filter_gps_time.tow); @@ -321,38 +320,38 @@ int main(int argc, const char* argv[]) printf("LLH_POSITION_GNSS_MEAS = [%f %f %f]\n", pvt_message.latitude, pvt_message.longitude, pvt_message.height_above_ellipsoid); printf("NED_VELOCITY_GNSS_MEAS = [%f %f %f]\n", pvt_message.ned_velocity[0], pvt_message.ned_velocity[1], pvt_message.ned_velocity[2]); - commands_aiding::Time external_measurement_time; + mip::commands_aiding::Time external_measurement_time; external_measurement_time.reserved = 1; if (input_arguments.enable_pps_sync) { // Send week number update to device uint32_t week_number = get_gps_week(pvt_message.utc_year, pvt_message.utc_month, pvt_message.utc_day); - if (!commands_base::writeGpsTimeUpdate(*device, commands_base::GpsTimeUpdate::FieldId::WEEK_NUMBER, week_number)) + if (!mip::commands_base::writeGpsTimeUpdate(*device, mip::commands_base::GpsTimeUpdate::FieldId::WEEK_NUMBER, week_number)) printf("WARNING: Failed to send week number time update to CV7-INS\n"); // Send time of week update to device - uint32_t time_of_week_int = floor(pvt_message.time_of_week); - if (!commands_base::writeGpsTimeUpdate(*device, commands_base::GpsTimeUpdate::FieldId::TIME_OF_WEEK, time_of_week_int)) + uint32_t time_of_week_int = static_cast(floor(pvt_message.time_of_week)); + if (!mip::commands_base::writeGpsTimeUpdate(*device, mip::commands_base::GpsTimeUpdate::FieldId::TIME_OF_WEEK, time_of_week_int)) printf("WARNING: Failed to send time of week update to CV7-INS\n"); // Mark timestamp for aiding message input - external_measurement_time.timebase = commands_aiding::Time::Timebase::EXTERNAL_TIME; + external_measurement_time.timebase = mip::commands_aiding::Time::Timebase::EXTERNAL_TIME; external_measurement_time.nanoseconds = convert_gps_tow_to_nanoseconds(week_number, pvt_message.time_of_week); } else { // If no PPS sync is supplied, use device time of arrival for data timestamping method - external_measurement_time.timebase = commands_aiding::Time::Timebase::TIME_OF_ARRIVAL; + external_measurement_time.timebase = mip::commands_aiding::Time::Timebase::TIME_OF_ARRIVAL; external_measurement_time.nanoseconds = 0; // Not used, but should be set to 0 } // External position command - if (commands_aiding::posLlh(*device, external_measurement_time, gnss_antenna_sensor_id, pvt_message.latitude, pvt_message.longitude, pvt_message.height_above_ellipsoid, pvt_message.llh_position_uncertainty, 0x0007) != CmdResult::ACK_OK) + if (mip::commands_aiding::posLlh(*device, external_measurement_time, gnss_antenna_sensor_id, pvt_message.latitude, pvt_message.longitude, pvt_message.height_above_ellipsoid, pvt_message.llh_position_uncertainty, 0x0007) != mip::CmdResult::ACK_OK) printf("WARNING: Failed to send external position to CV7-INS\n"); // External global velocity command - if (commands_aiding::velNed(*device, external_measurement_time, gnss_antenna_sensor_id,pvt_message.ned_velocity, pvt_message.ned_velocity_uncertainty, 0x0007) != CmdResult::ACK_OK) + if (mip::commands_aiding::velNed(*device, external_measurement_time, gnss_antenna_sensor_id,pvt_message.ned_velocity, pvt_message.ned_velocity_uncertainty, 0x0007) != mip::CmdResult::ACK_OK) printf("WARNING: Failed to send external NED velocity to CV7-INS\n"); prev_measurement_update_timestamp = current_timestamp; @@ -371,7 +370,7 @@ int main(int argc, const char* argv[]) uint64_t convert_gps_tow_to_nanoseconds(int week_number, float time_of_week) { - return floor(float(week_number) * 604800 * 1e9 + time_of_week * 1e9); + return static_cast(floor(float(week_number) * 604800 * 1e9 + time_of_week * 1e9)); } time_t time_from_ymd(int year, int month, int day) @@ -396,14 +395,19 @@ int get_gps_week(int year, int month, int day) // Print device information //////////////////////////////////////////////////////////////////////////////// -void print_device_information(const commands_base::BaseDeviceInfo& device_info) +void print_device_information(const mip::commands_base::BaseDeviceInfo& device_info) { printf("Connected to:\n"); auto print_info = [](const char* name, const char info[16]) { char msg[17] = {0}; +#ifdef _WIN32 + strncpy_s(msg, info, 16); +#else std::strncpy(msg, info, 16); +#endif + printf(" %s%s\n", name, msg); }; @@ -454,9 +458,9 @@ InputArguments parse_input_arguments(int argc, const char* argv[]) int heading_alignment_int = std::stoi(argv[8]); if (heading_alignment_int == 0) - input_arguments.filter_heading_alignment_method = commands_filter::InitializationConfiguration::AlignmentSelector::KINEMATIC; + input_arguments.filter_heading_alignment_method = mip::commands_filter::InitializationConfiguration::AlignmentSelector::KINEMATIC; else if (heading_alignment_int == 1) - input_arguments.filter_heading_alignment_method = commands_filter::InitializationConfiguration::AlignmentSelector::MAGNETOMETER; + input_arguments.filter_heading_alignment_method = mip::commands_filter::InitializationConfiguration::AlignmentSelector::MAGNETOMETER; else exit_gracefully("Heading alignment selector out of range"); } @@ -467,11 +471,11 @@ InputArguments parse_input_arguments(int argc, const char* argv[]) // PPS sync enable if (argc >= 11) - input_arguments.enable_pps_sync = std::stoi(argv[10]); + input_arguments.enable_pps_sync = (uint8_t)std::strtoul(argv[10], nullptr, 10); // PPS input pin ID if (argc >= 12) - input_arguments.pps_input_pin_id = std::stoi(argv[11]); + input_arguments.pps_input_pin_id = (uint8_t)std::strtoul(argv[11], nullptr, 10); return input_arguments; } @@ -497,9 +501,9 @@ void exit_gracefully(const char *message) if(message) printf("%s\n", message); -#ifdef _WIN32 +#ifdef MICROSTRAIN_PLATFORM_WINDOWS std::cout << "Press ENTER to exit..." << std::endl; - int dummy = getchar(); + getchar(); #endif exit(0); @@ -514,4 +518,3 @@ bool should_exit() { return false; } - diff --git a/examples/CV7_INS/simple_ublox_parser.hpp b/examples/CV7_INS/simple_ublox_parser.hpp index 5c54b9b85..459889b46 100644 --- a/examples/CV7_INS/simple_ublox_parser.hpp +++ b/examples/CV7_INS/simple_ublox_parser.hpp @@ -11,7 +11,7 @@ //! //! THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING //! CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER -//! FOR THEM TO SAVE TIME. AS A RESULT, HBK MICROSTRAIN SHALL NOT BE HELD +//! FOR THEM TO SAVE TIME. AS A RESULT, MICROSTRAIN BY HBK SHALL NOT BE HELD //! LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY //! CLAIMS ARISING FROM THE CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS //! OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. @@ -41,10 +41,10 @@ namespace mip ck_a = 0; ck_b = 0; - int num_bytes = packet.size(); - int num_bytes_without_checksum = num_bytes - 2; + size_t num_bytes = packet.size(); + size_t num_bytes_without_checksum = num_bytes - 2; - for (int i = 2; i < num_bytes_without_checksum; i++) { + for (size_t i = 2; i < num_bytes_without_checksum; i++) { ck_a += packet[i]; ck_b += ck_a; } diff --git a/examples/CV7_INS/ublox_device.hpp b/examples/CV7_INS/ublox_device.hpp index 6ba8f5d6c..93035e709 100644 --- a/examples/CV7_INS/ublox_device.hpp +++ b/examples/CV7_INS/ublox_device.hpp @@ -11,7 +11,7 @@ //! //! THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING //! CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER -//! FOR THEM TO SAVE TIME. AS A RESULT, HBK MICROSTRAIN SHALL NOT BE HELD +//! FOR THEM TO SAVE TIME. AS A RESULT, MICROSTRAIN BY HBK SHALL NOT BE HELD //! LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY //! CLAIMS ARISING FROM THE CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS //! OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. @@ -24,7 +24,7 @@ #include "simple_ublox_parser.hpp" -#include "mip/platform/serial_connection.hpp" +#include "microstrain/connections/serial/serial_connection.hpp" #define PVT_PAYLOAD_SIZE 92 @@ -108,24 +108,24 @@ namespace mip ublox_message.utc_year = ublox_message_raw.utc_year; ublox_message.utc_month = ublox_message_raw.utc_month; ublox_message.utc_day = ublox_message_raw.utc_day; - ublox_message.time_of_week = ublox_message_raw.iTOW * 1e-3; + ublox_message.time_of_week = ublox_message_raw.iTOW * 1e-3f; ublox_message.time_valid = ublox_message_raw.time_valid_flag; // LLH position ublox_message.latitude = ublox_message_raw.latitude * 1e-7; ublox_message.longitude = ublox_message_raw.longitude * 1e-7;; ublox_message.height_above_ellipsoid = ublox_message_raw.height_above_ellipsoid * 1e-3; - ublox_message.llh_position_uncertainty[0] = ublox_message_raw.horizontal_accuracy * 1e-3; - ublox_message.llh_position_uncertainty[1] = ublox_message_raw.horizontal_accuracy * 1e-3; - ublox_message.llh_position_uncertainty[2] = ublox_message_raw.vertical_accuracy * 1e-3; + ublox_message.llh_position_uncertainty[0] = float(ublox_message_raw.horizontal_accuracy) * 1e-3f; + ublox_message.llh_position_uncertainty[1] = float(ublox_message_raw.horizontal_accuracy) * 1e-3f; + ublox_message.llh_position_uncertainty[2] = float(ublox_message_raw.vertical_accuracy) * 1e-3f; ublox_message.llh_position_valid = !ublox_message_raw.llh_invalid_flag; // NED velocity - ublox_message.ned_velocity[0] = ublox_message_raw.north_velocity * 1e-3; - ublox_message.ned_velocity[1] = ublox_message_raw.east_velocity * 1e-3; - ublox_message.ned_velocity[2] = ublox_message_raw.down_velocity * 1e-3; + ublox_message.ned_velocity[0] = float(ublox_message_raw.north_velocity) * 1e-3f; + ublox_message.ned_velocity[1] = float(ublox_message_raw.east_velocity) * 1e-3f; + ublox_message.ned_velocity[2] = float(ublox_message_raw.down_velocity) * 1e-3f; for (int i = 0; i < 3; i++) - ublox_message.ned_velocity_uncertainty[i] = ublox_message_raw.speed_accuracy * 1e-3; + ublox_message.ned_velocity_uncertainty[i] = float(ublox_message_raw.speed_accuracy) * 1e-3f; return ublox_message; } @@ -135,12 +135,16 @@ namespace mip { public: - UbloxDevice(std::unique_ptr connection) : _connection(std::move(connection)), - _message_parser( - [this](const std::vector& packet) { - handle_packet(packet); - }) - {} + UbloxDevice(std::unique_ptr connection) : + _connection(std::move(connection)), + _message_parser( + [this](const std::vector &packet) + { + handle_packet(packet); + } + ) + { + } void handle_packet(const std::vector& packet) { @@ -184,7 +188,7 @@ namespace mip protected: - std::unique_ptr _connection; + std::unique_ptr _connection; UbloxMessageParser _message_parser; bool _new_pvt_message_received = false; diff --git a/examples/CX5_GX5_45/CX5_GX5_45_example.c b/examples/CX5_GX5_45/CX5_GX5_45_example.c index f1c8af86d..a3aa4094d 100644 --- a/examples/CX5_GX5_45/CX5_GX5_45_example.c +++ b/examples/CX5_GX5_45/CX5_GX5_45_example.c @@ -15,7 +15,7 @@ //! //! THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING //! CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER -//! FOR THEM TO SAVE TIME. AS A RESULT, HBK MICROSTRAIN SHALL NOT BE HELD +//! FOR THEM TO SAVE TIME. AS A RESULT, MICROSTRAIN BY HBK SHALL NOT BE HELD //! LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY //! CLAIMS ARISING FROM THE CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS //! OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. @@ -28,8 +28,7 @@ //////////////////////////////////////////////////////////////////////////////// #include -#include - +#include #include #include #include @@ -49,10 +48,10 @@ uint8_t parse_buffer[1024]; mip_interface device; //Sensor-to-vehicle frame rotation (Euler Angles) -float sensor_to_vehicle_rotation_euler[3] = {0.0, 0.0, 0.0}; +float sensor_to_vehicle_rotation_euler[3] = {0.0f, 0.0f, 0.0f}; //GNSS antenna offset -float gnss_antenna_offset_meters[3] = {-0.25, 0.0, 0.0}; +float gnss_antenna_offset_meters[3] = {-0.25f, 0.0f, 0.0f}; //Device data stores mip_sensor_gps_timestamp_data sensor_gps_time; @@ -368,10 +367,12 @@ mip_timestamp get_current_timestamp() // MIP Interface User Recv Data Function //////////////////////////////////////////////////////////////////////////////// -bool mip_interface_user_recv_from_device(mip_interface* device, uint8_t* buffer, size_t max_length, mip_timeout wait_time, size_t* out_length, mip_timestamp* timestamp_out) +bool mip_interface_user_recv_from_device(mip_interface* device_, uint8_t* buffer, size_t max_length, mip_timeout wait_time, size_t* out_length, mip_timestamp* timestamp_out) { + (void)device_; + *timestamp_out = get_current_timestamp(); - return serial_port_read(&device_port, buffer, max_length, wait_time, out_length); + return serial_port_read(&device_port, buffer, max_length, (int)wait_time, out_length); } @@ -379,8 +380,10 @@ bool mip_interface_user_recv_from_device(mip_interface* device, uint8_t* buffer, // MIP Interface User Send Data Function //////////////////////////////////////////////////////////////////////////////// -bool mip_interface_user_send_to_device(mip_interface* device, const uint8_t* data, size_t length) +bool mip_interface_user_send_to_device(mip_interface* device_, const uint8_t* data, size_t length) { + (void)device_; + size_t bytes_written; return serial_port_write(&device_port, data, length, &bytes_written); @@ -411,8 +414,8 @@ void exit_gracefully(const char *message) if(serial_port_is_open(&device_port)) serial_port_close(&device_port); -#ifdef _WIN32 - int dummy = getchar(); +#ifdef MICROSTRAIN_PLATFORM_WINDOWS + getchar(); #endif exit(0); diff --git a/examples/CX5_GX5_45/CX5_GX5_45_example.cpp b/examples/CX5_GX5_45/CX5_GX5_45_example.cpp index 484444522..f2060c84d 100644 --- a/examples/CX5_GX5_45/CX5_GX5_45_example.cpp +++ b/examples/CX5_GX5_45/CX5_GX5_45_example.cpp @@ -15,7 +15,7 @@ //! //! THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING //! CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER -//! FOR THEM TO SAVE TIME. AS A RESULT, HBK MICROSTRAIN SHALL NOT BE HELD +//! FOR THEM TO SAVE TIME. AS A RESULT, MICROSTRAIN BY HBK SHALL NOT BE HELD //! LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY //! CLAIMS ARISING FROM THE CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS //! OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. @@ -33,8 +33,6 @@ #include "example_utils.hpp" -using namespace mip; - //////////////////////////////////////////////////////////////////////////////// // Global Variables @@ -48,20 +46,20 @@ float sensor_to_vehicle_rotation_euler[3] = {0.0, 0.0, 0.0}; float gnss_antenna_offset_meters[3] = {-0.25, 0.0, 0.0}; //Device data stores -data_sensor::GpsTimestamp sensor_gps_time; -data_sensor::ScaledAccel sensor_accel; -data_sensor::ScaledGyro sensor_gyro; -data_sensor::ScaledMag sensor_mag; +mip::data_sensor::GpsTimestamp sensor_gps_time; +mip::data_sensor::ScaledAccel sensor_accel; +mip::data_sensor::ScaledGyro sensor_gyro; +mip::data_sensor::ScaledMag sensor_mag; -data_gnss::FixInfo gnss_fix_info; +mip::data_gnss::FixInfo gnss_fix_info; bool gnss_fix_info_valid = false; -data_filter::Timestamp filter_gps_time; -data_filter::Status filter_status; -data_filter::PositionLlh filter_position_llh; -data_filter::VelocityNed filter_velocity_ned; -data_filter::EulerAngles filter_euler_angles; +mip::data_filter::Timestamp filter_gps_time; +mip::data_filter::Status filter_status; +mip::data_filter::PositionLlh filter_position_llh; +mip::data_filter::VelocityNed filter_velocity_ned; +mip::data_filter::EulerAngles filter_euler_angles; bool filter_state_running = false; @@ -87,21 +85,21 @@ int main(int argc, const char* argv[]) std::unique_ptr utils; try { utils = handleCommonArgs(argc, argv); - } catch(const std::underflow_error& ex) { + } catch(const std::underflow_error&) { return printCommonUsage(argv); } catch(const std::exception& ex) { fprintf(stderr, "Error: %s\n", ex.what()); return 1; } - std::unique_ptr& device = utils->device; + std::unique_ptr& device = utils->device; printf("Connecting to and configuring sensor.\n"); // //Ping the device (note: this is good to do to make sure the device is present) // - if(commands_base::ping(*device) != CmdResult::ACK_OK) + if(mip::commands_base::ping(*device) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not ping the device!"); @@ -109,7 +107,7 @@ int main(int argc, const char* argv[]) //Idle the device (note: this is good to do during setup) // - if(commands_base::setIdle(*device) != CmdResult::ACK_OK) + if(mip::commands_base::setIdle(*device) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set the device to idle!"); @@ -117,7 +115,7 @@ int main(int argc, const char* argv[]) //Load the device default settings (so the device is in a known state) // - if(commands_3dm::defaultDeviceSettings(*device) != CmdResult::ACK_OK) + if(mip::commands_3dm::defaultDeviceSettings(*device) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not load default device settings!"); @@ -130,20 +128,20 @@ int main(int argc, const char* argv[]) //Note: Querying the device base rate is only one way to calculate the descriptor decimation. //We could have also set it directly with information from the datasheet (shown in GNSS setup). - if(commands_3dm::imuGetBaseRate(*device, &sensor_base_rate) != CmdResult::ACK_OK) + if(mip::commands_3dm::imuGetBaseRate(*device, &sensor_base_rate) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not get sensor base rate format!"); const uint16_t sensor_sample_rate = 100; // Hz const uint16_t sensor_decimation = sensor_base_rate / sensor_sample_rate; - std::array sensor_descriptors = {{ - { data_sensor::DATA_TIME_STAMP_GPS, sensor_decimation }, - { data_sensor::DATA_ACCEL_SCALED, sensor_decimation }, - { data_sensor::DATA_GYRO_SCALED, sensor_decimation }, - { data_sensor::DATA_MAG_SCALED, sensor_decimation }, + std::array sensor_descriptors = {{ + { mip::data_sensor::DATA_TIME_STAMP_GPS, sensor_decimation }, + { mip::data_sensor::DATA_ACCEL_SCALED, sensor_decimation }, + { mip::data_sensor::DATA_GYRO_SCALED, sensor_decimation }, + { mip::data_sensor::DATA_MAG_SCALED, sensor_decimation }, }}; - if(commands_3dm::writeImuMessageFormat(*device, sensor_descriptors.size(), sensor_descriptors.data()) != CmdResult::ACK_OK) + if(mip::commands_3dm::writeImuMessageFormat(*device, static_cast(sensor_descriptors.size()), sensor_descriptors.data()) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set sensor message format!"); @@ -151,12 +149,12 @@ int main(int argc, const char* argv[]) //Setup GNSS data format to 4 Hz (decimation of 1) // - std::array gnss_descriptors = {{ - { data_gnss::DATA_FIX_INFO, 1 } + std::array gnss_descriptors = {{ + { mip::data_gnss::DATA_FIX_INFO, 1 } }}; //GNSS - if(commands_3dm::writeGpsMessageFormat(*device, gnss_descriptors.size(), gnss_descriptors.data()) != CmdResult::ACK_OK) + if(mip::commands_3dm::writeGpsMessageFormat(*device, static_cast(gnss_descriptors.size()), gnss_descriptors.data()) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set GNSS1 message format!"); @@ -166,21 +164,21 @@ int main(int argc, const char* argv[]) uint16_t filter_base_rate; - if(commands_3dm::filterGetBaseRate(*device, &filter_base_rate) != CmdResult::ACK_OK) + if(mip::commands_3dm::filterGetBaseRate(*device, &filter_base_rate) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not get filter base rate format!"); const uint16_t filter_sample_rate = 100; // Hz const uint16_t filter_decimation = filter_base_rate / filter_sample_rate; - std::array filter_descriptors = {{ - { data_filter::DATA_FILTER_TIMESTAMP, filter_decimation }, - { data_filter::DATA_FILTER_STATUS, filter_decimation }, - { data_filter::DATA_POS_LLH, filter_decimation }, - { data_filter::DATA_VEL_NED, filter_decimation }, - { data_filter::DATA_ATT_EULER_ANGLES, filter_decimation }, + std::array filter_descriptors = {{ + { mip::data_filter::DATA_FILTER_TIMESTAMP, filter_decimation }, + { mip::data_filter::DATA_FILTER_STATUS, filter_decimation }, + { mip::data_filter::DATA_POS_LLH, filter_decimation }, + { mip::data_filter::DATA_VEL_NED, filter_decimation }, + { mip::data_filter::DATA_ATT_EULER_ANGLES, filter_decimation }, }}; - if(commands_3dm::writeFilterMessageFormat(*device, filter_descriptors.size(), filter_descriptors.data()) != CmdResult::ACK_OK) + if(mip::commands_3dm::writeFilterMessageFormat(*device, static_cast(filter_descriptors.size()), filter_descriptors.data()) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set filter message format!"); @@ -188,7 +186,7 @@ int main(int argc, const char* argv[]) //Setup the sensor to vehicle rotation // - if(commands_filter::writeSensorToVehicleRotationEuler(*device, sensor_to_vehicle_rotation_euler[0], sensor_to_vehicle_rotation_euler[1], sensor_to_vehicle_rotation_euler[2]) != CmdResult::ACK_OK) + if(mip::commands_filter::writeSensorToVehicleRotationEuler(*device, sensor_to_vehicle_rotation_euler[0], sensor_to_vehicle_rotation_euler[1], sensor_to_vehicle_rotation_euler[2]) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set sensor-2-vehicle rotation!"); @@ -196,15 +194,15 @@ int main(int argc, const char* argv[]) //Setup the GNSS antenna offset // - if(commands_filter::writeAntennaOffset(*device, gnss_antenna_offset_meters) != CmdResult::ACK_OK) + if(mip::commands_filter::writeAntennaOffset(*device, gnss_antenna_offset_meters) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set GNSS1 antenna offset!"); - + // //Setup heading update control // - if(commands_filter::writeHeadingSource(*device, commands_filter::HeadingSource::Source::GNSS_VEL_AND_MAG) != CmdResult::ACK_OK) + if(mip::commands_filter::writeHeadingSource(*device, mip::commands_filter::HeadingSource::Source::GNSS_VEL_AND_MAG) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set filter heading update control!"); @@ -212,7 +210,7 @@ int main(int argc, const char* argv[]) //Enable filter auto-initialization // - if(commands_filter::writeAutoInitControl(*device, 1) != CmdResult::ACK_OK) + if(mip::commands_filter::writeAutoInitControl(*device, 1) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set filter autoinit control!"); @@ -221,7 +219,7 @@ int main(int argc, const char* argv[]) //Reset the filter (note: this is good to do after filter setup is complete) // - if(commands_filter::reset(*device) != CmdResult::ACK_OK) + if(mip::commands_filter::reset(*device) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not reset the filter!"); @@ -230,7 +228,7 @@ int main(int argc, const char* argv[]) // //Sensor Data - DispatchHandler sensor_data_handlers[4]; + mip::DispatchHandler sensor_data_handlers[4]; device->registerExtractor(sensor_data_handlers[0], &sensor_gps_time); device->registerExtractor(sensor_data_handlers[1], &sensor_accel); @@ -238,12 +236,12 @@ int main(int argc, const char* argv[]) device->registerExtractor(sensor_data_handlers[3], &sensor_mag); //GNSS Data - DispatchHandler gnss_data_handlers[1]; + mip::DispatchHandler gnss_data_handlers[1]; device->registerExtractor(gnss_data_handlers[0], &gnss_fix_info); - + //Filter Data - DispatchHandler filter_data_handlers[5]; + mip::DispatchHandler filter_data_handlers[5]; device->registerExtractor(filter_data_handlers[0], &filter_gps_time); device->registerExtractor(filter_data_handlers[1], &filter_status); @@ -255,7 +253,7 @@ int main(int argc, const char* argv[]) //Resume the device // - if(commands_base::resume(*device) != CmdResult::ACK_OK) + if(mip::commands_base::resume(*device) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not resume the device!"); @@ -275,15 +273,15 @@ int main(int argc, const char* argv[]) displayFilterState(filter_status.filter_state, current_state, true); //Check GNSS fixes and alert the user when they become valid - if((gnss_fix_info_valid == false) && (gnss_fix_info.fix_type == data_gnss::FixInfo::FixType::FIX_3D) && - (gnss_fix_info.valid_flags & data_gnss::FixInfo::ValidFlags::FIX_TYPE)) + if((gnss_fix_info_valid == false) && (gnss_fix_info.fix_type == mip::data_gnss::FixInfo::FixType::FIX_3D) && + (gnss_fix_info.valid_flags & mip::data_gnss::FixInfo::ValidFlags::FIX_TYPE)) { printf("NOTE: GNSS fix info valid.\n"); gnss_fix_info_valid = true; } - + //Check Filter State - if((!filter_state_running) && ((filter_status.filter_state == data_filter::FilterMode::GX5_RUN_SOLUTION_ERROR) || (filter_status.filter_state == data_filter::FilterMode::GX5_RUN_SOLUTION_VALID))) + if((!filter_state_running) && ((filter_status.filter_state == mip::data_filter::FilterMode::GX5_RUN_SOLUTION_ERROR) || (filter_status.filter_state == mip::data_filter::FilterMode::GX5_RUN_SOLUTION_VALID))) { printf("NOTE: Filter has entered running mode.\n"); filter_state_running = true; @@ -332,9 +330,9 @@ void exit_gracefully(const char *message) if(message) printf("%s\n", message); -#ifdef _WIN32 +#ifdef MICROSTRAIN_PLATFORM_WINDOWS printf("Press ENTER to exit...\n"); - int dummy = getchar(); + getchar(); #endif exit(0); @@ -350,4 +348,3 @@ bool should_exit() return false; } - diff --git a/examples/CX5_GX5_CV5_15_25/CX5_GX5_CV5_15_25_example.c b/examples/CX5_GX5_CV5_15_25/CX5_GX5_CV5_15_25_example.c index 4721360cc..6b6c14b3c 100644 --- a/examples/CX5_GX5_CV5_15_25/CX5_GX5_CV5_15_25_example.c +++ b/examples/CX5_GX5_CV5_15_25/CX5_GX5_CV5_15_25_example.c @@ -15,7 +15,7 @@ //! //! THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING //! CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER -//! FOR THEM TO SAVE TIME. AS A RESULT, HBK MICROSTRAIN SHALL NOT BE HELD +//! FOR THEM TO SAVE TIME. AS A RESULT, MICROSTRAIN BY HBK SHALL NOT BE HELD //! LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY //! CLAIMS ARISING FROM THE CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS //! OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. @@ -28,7 +28,7 @@ //////////////////////////////////////////////////////////////////////////////// #include -#include +#include #include #include @@ -155,7 +155,7 @@ int main(int argc, const char* argv[]) const uint16_t sampling_time = 2000; // The default is 15000 ms and longer sample times are recommended but shortened for convenience mip_cmd_queue* queue = mip_interface_cmd_queue(&device); - const int16_t old_mip_sdk_timeout = mip_cmd_queue_base_reply_timeout(queue); + const mip_timeout old_mip_sdk_timeout = mip_cmd_queue_base_reply_timeout(queue); printf("Capturing gyro bias. This will take %d seconds. \n", sampling_time/1000); mip_cmd_queue_set_base_reply_timeout(queue, sampling_time * 2); float gyro_bias[3] = {0, 0, 0}; @@ -317,10 +317,12 @@ mip_timestamp get_current_timestamp() // MIP Interface User Recv Data Function //////////////////////////////////////////////////////////////////////////////// -bool mip_interface_user_recv_from_device(mip_interface* device, uint8_t* buffer, size_t max_length, mip_timeout wait_time, size_t* out_length, mip_timestamp* timestamp_out) +bool mip_interface_user_recv_from_device(mip_interface* device_, uint8_t* buffer, size_t max_length, mip_timeout wait_time, size_t* out_length, mip_timestamp* timestamp_out) { + (void)device_; + *timestamp_out = get_current_timestamp(); - return serial_port_read(&device_port, buffer, max_length, wait_time, out_length); + return serial_port_read(&device_port, buffer, max_length, (int)wait_time, out_length); } @@ -328,8 +330,10 @@ bool mip_interface_user_recv_from_device(mip_interface* device, uint8_t* buffer, // MIP Interface User Send Data Function //////////////////////////////////////////////////////////////////////////////// -bool mip_interface_user_send_to_device(mip_interface* device, const uint8_t* data, size_t length) +bool mip_interface_user_send_to_device(mip_interface* device_, const uint8_t* data, size_t length) { + (void)device_; + size_t bytes_written; return serial_port_write(&device_port, data, length, &bytes_written); @@ -360,8 +364,8 @@ void exit_gracefully(const char *message) if(serial_port_is_open(&device_port)) serial_port_close(&device_port); -#ifdef _WIN32 - int dummy = getchar(); +#ifdef MICROSTRAIN_PLATFORM_WINDOWS + getchar(); #endif exit(0); diff --git a/examples/CX5_GX5_CV5_15_25/CX5_GX5_CV5_15_25_example.cpp b/examples/CX5_GX5_CV5_15_25/CX5_GX5_CV5_15_25_example.cpp index 74bd0b228..ba3f59c4a 100644 --- a/examples/CX5_GX5_CV5_15_25/CX5_GX5_CV5_15_25_example.cpp +++ b/examples/CX5_GX5_CV5_15_25/CX5_GX5_CV5_15_25_example.cpp @@ -15,7 +15,7 @@ //! //! THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING //! CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER -//! FOR THEM TO SAVE TIME. AS A RESULT, HBK MICROSTRAIN SHALL NOT BE HELD +//! FOR THEM TO SAVE TIME. AS A RESULT, MICROSTRAIN BY HBK SHALL NOT BE HELD //! LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY //! CLAIMS ARISING FROM THE CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS //! OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. @@ -31,8 +31,6 @@ #include #include "../example_utils.hpp" -using namespace mip; - //////////////////////////////////////////////////////////////////////////////// // Global Variables @@ -43,15 +41,15 @@ using namespace mip; float sensor_to_vehicle_rotation_euler[3] = {0.0, 0.0, 0.0}; //Device data stores -data_sensor::GpsTimestamp sensor_gps_time; -data_sensor::ScaledAccel sensor_accel; -data_sensor::ScaledGyro sensor_gyro; +mip::data_sensor::GpsTimestamp sensor_gps_time; +mip::data_sensor::ScaledAccel sensor_accel; +mip::data_sensor::ScaledGyro sensor_gyro; -data_filter::Timestamp filter_gps_time; -data_filter::Status filter_status; -data_filter::EulerAngles filter_euler_angles; -data_filter::CompAngularRate filter_comp_angular_rate; -data_filter::CompAccel filter_comp_accel; +mip::data_filter::Timestamp filter_gps_time; +mip::data_filter::Status filter_status; +mip::data_filter::EulerAngles filter_euler_angles; +mip::data_filter::CompAngularRate filter_comp_angular_rate; +mip::data_filter::CompAccel filter_comp_accel; bool filter_state_running = false; @@ -75,7 +73,7 @@ int main(int argc, const char* argv[]) { std::unique_ptr utils = handleCommonArgs(argc, argv); - std::unique_ptr& device = utils->device; + std::unique_ptr& device = utils->device; printf("Connecting to and configuring sensor.\n"); @@ -83,7 +81,7 @@ int main(int argc, const char* argv[]) //Ping the device (note: this is good to do to make sure the device is present) // - if(commands_base::ping(*device) != CmdResult::ACK_OK) + if(mip::commands_base::ping(*device) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not ping the device!"); @@ -91,7 +89,7 @@ int main(int argc, const char* argv[]) //Idle the device (note: this is good to do during setup) // - if(commands_base::setIdle(*device) != CmdResult::ACK_OK) + if(mip::commands_base::setIdle(*device) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set the device to idle!"); @@ -99,27 +97,26 @@ int main(int argc, const char* argv[]) //Load the device default settings (so the device is in a known state) // - if(commands_3dm::defaultDeviceSettings(*device) != CmdResult::ACK_OK) + if(mip::commands_3dm::defaultDeviceSettings(*device) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not load default device settings!"); float gyro_bias[3] = {0, 0, 0}; const uint32_t sampling_time = 2000; // The default is 15000 ms and longer sample times are recommended but shortened for convenience - const int32_t old_mip_sdk_timeout = device->baseReplyTimeout(); + const mip::Timeout old_mip_sdk_timeout = device->baseReplyTimeout(); printf("Capturing gyro bias. This will take %d seconds \n", sampling_time/1000); device->setBaseReplyTimeout(sampling_time * 2); - if(commands_3dm::captureGyroBias(*device, sampling_time, gyro_bias) != CmdResult::ACK_OK) + if(mip::commands_3dm::captureGyroBias(*device, sampling_time, gyro_bias) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not capture gyro bias!"); - if(commands_3dm::saveGyroBias(*device) != CmdResult::ACK_OK) + if(mip::commands_3dm::saveGyroBias(*device) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not save gyro bias!"); - const uint8_t fn_selector = 1; const uint8_t device_selector = 3; const uint8_t enable_flag = 1; - if(commands_3dm::writeDatastreamControl(*device, device_selector, enable_flag) != CmdResult::ACK_OK) + if(mip::commands_3dm::writeDatastreamControl(*device, device_selector, enable_flag) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not enable device data stream!"); // Reset the timeout @@ -137,19 +134,19 @@ int main(int argc, const char* argv[]) //Note: Querying the device base rate is only one way to calculate the descriptor decimation. //We could have also set it directly with information from the datasheet. - if(commands_3dm::imuGetBaseRate(*device, &sensor_base_rate) != CmdResult::ACK_OK) + if(mip::commands_3dm::imuGetBaseRate(*device, &sensor_base_rate) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not get sensor base rate format!"); const uint16_t sensor_sample_rate = 100; // Hz const uint16_t sensor_decimation = sensor_base_rate / sensor_sample_rate; - std::array sensor_descriptors = {{ - { data_sensor::DATA_TIME_STAMP_GPS, sensor_decimation }, - { data_sensor::DATA_ACCEL_SCALED, sensor_decimation }, - { data_sensor::DATA_GYRO_SCALED, sensor_decimation }, + std::array sensor_descriptors = {{ + { mip::data_sensor::DATA_TIME_STAMP_GPS, sensor_decimation }, + { mip::data_sensor::DATA_ACCEL_SCALED, sensor_decimation }, + { mip::data_sensor::DATA_GYRO_SCALED, sensor_decimation }, }}; - if(commands_3dm::writeImuMessageFormat(*device, sensor_descriptors.size(), sensor_descriptors.data()) != CmdResult::ACK_OK) + if(mip::commands_3dm::writeImuMessageFormat(*device, static_cast(sensor_descriptors.size()), sensor_descriptors.data()) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set sensor message format!"); @@ -159,21 +156,21 @@ int main(int argc, const char* argv[]) uint16_t filter_base_rate; - if(commands_3dm::filterGetBaseRate(*device, &filter_base_rate) != CmdResult::ACK_OK) + if(mip::commands_3dm::filterGetBaseRate(*device, &filter_base_rate) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not get filter base rate format!"); const uint16_t filter_sample_rate = 100; // Hz const uint16_t filter_decimation = filter_base_rate / filter_sample_rate; - std::array filter_descriptors = {{ - { data_filter::DATA_FILTER_TIMESTAMP, filter_decimation }, - { data_filter::DATA_FILTER_STATUS, filter_decimation }, - { data_filter::DATA_ATT_EULER_ANGLES, filter_decimation }, - { data_filter::DATA_COMPENSATED_ANGULAR_RATE, filter_decimation }, - { data_filter::DATA_COMPENSATED_ACCELERATION, filter_decimation }, + std::array filter_descriptors = {{ + { mip::data_filter::DATA_FILTER_TIMESTAMP, filter_decimation }, + { mip::data_filter::DATA_FILTER_STATUS, filter_decimation }, + { mip::data_filter::DATA_ATT_EULER_ANGLES, filter_decimation }, + { mip::data_filter::DATA_COMPENSATED_ANGULAR_RATE, filter_decimation }, + { mip::data_filter::DATA_COMPENSATED_ACCELERATION, filter_decimation }, }}; - if(commands_3dm::writeFilterMessageFormat(*device, filter_descriptors.size(), filter_descriptors.data()) != CmdResult::ACK_OK) + if(mip::commands_3dm::writeFilterMessageFormat(*device, static_cast(filter_descriptors.size()), filter_descriptors.data()) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set filter message format!"); @@ -181,14 +178,14 @@ int main(int argc, const char* argv[]) //Setup the sensor to vehicle rotation // - if(commands_filter::writeSensorToVehicleRotationEuler(*device, sensor_to_vehicle_rotation_euler[0], sensor_to_vehicle_rotation_euler[1], sensor_to_vehicle_rotation_euler[2]) != CmdResult::ACK_OK) + if(mip::commands_filter::writeSensorToVehicleRotationEuler(*device, sensor_to_vehicle_rotation_euler[0], sensor_to_vehicle_rotation_euler[1], sensor_to_vehicle_rotation_euler[2]) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set sensor-2-vehicle rotation!"); // //Enable filter auto-initialization // - if(commands_filter::writeAutoInitControl(*device, 1) != CmdResult::ACK_OK) + if(mip::commands_filter::writeAutoInitControl(*device, 1) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set filter autoinit control!"); @@ -197,7 +194,7 @@ int main(int argc, const char* argv[]) //Reset the filter (note: this is good to do after filter setup is complete) // - if(commands_filter::reset(*device) != CmdResult::ACK_OK) + if(mip::commands_filter::reset(*device) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not reset the filter!"); @@ -206,27 +203,27 @@ int main(int argc, const char* argv[]) // //Sensor Data - DispatchHandler sensor_data_handlers[3]; + mip::DispatchHandler sensor_data_handlers[3]; device->registerExtractor(sensor_data_handlers[0], &sensor_gps_time); device->registerExtractor(sensor_data_handlers[1], &sensor_accel); device->registerExtractor(sensor_data_handlers[2], &sensor_gyro); - + //Filter Data - DispatchHandler filter_data_handlers[5]; + mip::DispatchHandler filter_data_handlers[5]; device->registerExtractor(filter_data_handlers[0], &filter_gps_time); device->registerExtractor(filter_data_handlers[1], &filter_status); device->registerExtractor(filter_data_handlers[2], &filter_euler_angles); device->registerExtractor(filter_data_handlers[3], &filter_comp_angular_rate); device->registerExtractor(filter_data_handlers[4], &filter_comp_accel); - + // //Resume the device // - if(commands_base::resume(*device) != CmdResult::ACK_OK) + if(mip::commands_base::resume(*device) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not resume the device!"); @@ -242,9 +239,9 @@ int main(int argc, const char* argv[]) while(running) { device->update(); - + //Check Filter State - if((!filter_state_running) && ((filter_status.filter_state == data_filter::FilterMode::GX5_RUN_SOLUTION_ERROR) || (filter_status.filter_state == data_filter::FilterMode::GX5_RUN_SOLUTION_VALID))) + if((!filter_state_running) && ((filter_status.filter_state == mip::data_filter::FilterMode::GX5_RUN_SOLUTION_ERROR) || (filter_status.filter_state == mip::data_filter::FilterMode::GX5_RUN_SOLUTION_VALID))) { printf("NOTE: Filter has entered running mode.\n"); filter_state_running = true; @@ -258,7 +255,7 @@ int main(int argc, const char* argv[]) if(curr_timestamp - prev_print_timestamp >= 1000) { printf("TOW = %f: ATT_EULER = [%f %f %f]: COMP_ANG_RATE = [%f %f %f]: COMP_ACCEL = [%f %f %f]\n", - filter_gps_time.tow, filter_euler_angles.roll, filter_euler_angles.pitch, filter_euler_angles.yaw, + filter_gps_time.tow, filter_euler_angles.roll, filter_euler_angles.pitch, filter_euler_angles.yaw, filter_comp_angular_rate.gyro[0], filter_comp_angular_rate.gyro[1], filter_comp_angular_rate.gyro[2], filter_comp_accel.accel[0], filter_comp_accel.accel[1], filter_comp_accel.accel[2]); @@ -293,8 +290,8 @@ void exit_gracefully(const char *message) if(message) printf("%s\n", message); -#ifdef _WIN32 - int dummy = getchar(); +#ifdef MICROSTRAIN_PLATFORM_WINDOWS + getchar(); #endif exit(0); @@ -310,4 +307,3 @@ bool should_exit() return false; } - diff --git a/examples/GQ7/GQ7_example.c b/examples/GQ7/GQ7_example.c index 4e575d702..6c540a51a 100644 --- a/examples/GQ7/GQ7_example.c +++ b/examples/GQ7/GQ7_example.c @@ -15,7 +15,7 @@ //! //! THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING //! CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER -//! FOR THEM TO SAVE TIME. AS A RESULT, HBK MICROSTRAIN SHALL NOT BE HELD +//! FOR THEM TO SAVE TIME. AS A RESULT, MICROSTRAIN BY HBK SHALL NOT BE HELD //! LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY //! CLAIMS ARISING FROM THE CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS //! OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. @@ -28,7 +28,7 @@ //////////////////////////////////////////////////////////////////////////////// #include -#include +#include #include #include #include @@ -401,10 +401,12 @@ mip_timestamp get_current_timestamp() // MIP Interface User Recv Data Function //////////////////////////////////////////////////////////////////////////////// -bool mip_interface_user_recv_from_device(mip_interface* device, uint8_t* buffer, size_t max_length, mip_timeout wait_time, size_t* out_length, mip_timestamp* timestamp_out) +bool mip_interface_user_recv_from_device(mip_interface* device_, uint8_t* buffer, size_t max_length, mip_timeout wait_time, size_t* out_length, mip_timestamp* timestamp_out) { + (void)device_; + *timestamp_out = get_current_timestamp(); - return serial_port_read(&device_port, buffer, max_length, wait_time, out_length); + return serial_port_read(&device_port, buffer, max_length, (int)wait_time, out_length); } @@ -412,8 +414,10 @@ bool mip_interface_user_recv_from_device(mip_interface* device, uint8_t* buffer, // MIP Interface User Send Data Function //////////////////////////////////////////////////////////////////////////////// -bool mip_interface_user_send_to_device(mip_interface* device, const uint8_t* data, size_t length) +bool mip_interface_user_send_to_device(mip_interface* device_, const uint8_t* data, size_t length) { + (void)device_; + size_t bytes_written; return serial_port_write(&device_port, data, length, &bytes_written); @@ -444,8 +448,8 @@ void exit_gracefully(const char *message) if(serial_port_is_open(&device_port)) serial_port_close(&device_port); -#ifdef _WIN32 - int dummy = getchar(); +#ifdef MICROSTRAIN_PLATFORM_WINDOWS + getchar(); #endif exit(0); diff --git a/examples/GQ7/GQ7_example.cpp b/examples/GQ7/GQ7_example.cpp index 0b2f1ba8b..77c645e39 100644 --- a/examples/GQ7/GQ7_example.cpp +++ b/examples/GQ7/GQ7_example.cpp @@ -15,7 +15,7 @@ //! //! THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING //! CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER -//! FOR THEM TO SAVE TIME. AS A RESULT, HBK MICROSTRAIN SHALL NOT BE HELD +//! FOR THEM TO SAVE TIME. AS A RESULT, MICROSTRAIN BY HBK SHALL NOT BE HELD //! LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY //! CLAIMS ARISING FROM THE CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS //! OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. @@ -33,8 +33,6 @@ #include "example_utils.hpp" -using namespace mip; - //////////////////////////////////////////////////////////////////////////////// // Global Variables @@ -48,20 +46,20 @@ float gnss1_antenna_offset_meters[3] = {-0.25, 0.0, 0.0}; float gnss2_antenna_offset_meters[3] = {0.25, 0.0, 0.0}; //Device data stores -data_shared::GpsTimestamp sensor_gps_time; -data_sensor::ScaledAccel sensor_accel; -data_sensor::ScaledGyro sensor_gyro; -data_sensor::ScaledMag sensor_mag; +mip::data_shared::GpsTimestamp sensor_gps_time; +mip::data_sensor::ScaledAccel sensor_accel; +mip::data_sensor::ScaledGyro sensor_gyro; +mip::data_sensor::ScaledMag sensor_mag; -data_gnss::FixInfo gnss_fix_info[2]; +mip::data_gnss::FixInfo gnss_fix_info[2]; bool gnss_fix_info_valid[2] = {false}; -data_shared::GpsTimestamp filter_gps_time; -data_filter::Status filter_status; -data_filter::PositionLlh filter_position_llh; -data_filter::VelocityNed filter_velocity_ned; -data_filter::EulerAngles filter_euler_angles; +mip::data_shared::GpsTimestamp filter_gps_time; +mip::data_filter::Status filter_status; +mip::data_filter::PositionLlh filter_position_llh; +mip::data_filter::VelocityNed filter_velocity_ned; +mip::data_filter::EulerAngles filter_euler_angles; bool filter_state_full_nav = false; @@ -87,21 +85,21 @@ int main(int argc, const char* argv[]) std::unique_ptr utils; try { utils = handleCommonArgs(argc, argv); - } catch(const std::underflow_error& ex) { + } catch(const std::underflow_error&) { return printCommonUsage(argv); } catch(const std::exception& ex) { fprintf(stderr, "Error: %s\n", ex.what()); return 1; } - std::unique_ptr& device = utils->device; + std::unique_ptr& device = utils->device; printf("Connecting to and configuring sensor.\n"); // //Ping the device (note: this is good to do to make sure the device is present) // - if(commands_base::ping(*device) != CmdResult::ACK_OK) + if(mip::commands_base::ping(*device) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not ping the device!"); @@ -109,7 +107,7 @@ int main(int argc, const char* argv[]) //Idle the device (note: this is good to do during setup) // - if(commands_base::setIdle(*device) != CmdResult::ACK_OK) + if(mip::commands_base::setIdle(*device) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set the device to idle!"); @@ -117,7 +115,7 @@ int main(int argc, const char* argv[]) //Load the device default settings (so the device is in a known state) // - if(commands_3dm::defaultDeviceSettings(*device) != CmdResult::ACK_OK) + if(mip::commands_3dm::defaultDeviceSettings(*device) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not load default device settings!"); @@ -130,20 +128,20 @@ int main(int argc, const char* argv[]) //Note: Querying the device base rate is only one way to calculate the descriptor decimation. //We could have also set it directly with information from the datasheet (shown in GNSS setup). - if(commands_3dm::getBaseRate(*device, data_sensor::DESCRIPTOR_SET, &sensor_base_rate) != CmdResult::ACK_OK) + if(mip::commands_3dm::getBaseRate(*device, mip::data_sensor::DESCRIPTOR_SET, &sensor_base_rate) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not get sensor base rate format!"); const uint16_t sensor_sample_rate = 100; // Hz const uint16_t sensor_decimation = sensor_base_rate / sensor_sample_rate; - std::array sensor_descriptors = {{ - { data_shared::DATA_GPS_TIME, sensor_decimation }, - { data_sensor::DATA_ACCEL_SCALED, sensor_decimation }, - { data_sensor::DATA_GYRO_SCALED, sensor_decimation }, - { data_sensor::DATA_MAG_SCALED, sensor_decimation }, + std::array sensor_descriptors = {{ + { mip::data_shared::DATA_GPS_TIME, sensor_decimation }, + { mip::data_sensor::DATA_ACCEL_SCALED, sensor_decimation }, + { mip::data_sensor::DATA_GYRO_SCALED, sensor_decimation }, + { mip::data_sensor::DATA_MAG_SCALED, sensor_decimation }, }}; - if(commands_3dm::writeMessageFormat(*device, data_sensor::DESCRIPTOR_SET, sensor_descriptors.size(), sensor_descriptors.data()) != CmdResult::ACK_OK) + if(mip::commands_3dm::writeMessageFormat(*device, mip::data_sensor::DESCRIPTOR_SET, static_cast(sensor_descriptors.size()), sensor_descriptors.data()) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set sensor message format!"); @@ -151,16 +149,16 @@ int main(int argc, const char* argv[]) //Setup GNSS 1 and 2 data format to 2 Hz (decimation of 1) // - std::array gnss_descriptors = {{ - { data_gnss::DATA_FIX_INFO, 1 } + std::array gnss_descriptors = {{ + { mip::data_gnss::DATA_FIX_INFO, 1 } }}; //GNSS1 - if(commands_3dm::writeMessageFormat(*device, data_gnss::MIP_GNSS1_DATA_DESC_SET, gnss_descriptors.size(), gnss_descriptors.data()) != CmdResult::ACK_OK) + if(mip::commands_3dm::writeMessageFormat(*device, mip::data_gnss::MIP_GNSS1_DATA_DESC_SET, static_cast(gnss_descriptors.size()), gnss_descriptors.data()) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set GNSS1 message format!"); //GNSS2 - if(commands_3dm::writeMessageFormat(*device, data_gnss::MIP_GNSS2_DATA_DESC_SET, gnss_descriptors.size(), gnss_descriptors.data()) != CmdResult::ACK_OK) + if(mip::commands_3dm::writeMessageFormat(*device, mip::data_gnss::MIP_GNSS2_DATA_DESC_SET, static_cast(gnss_descriptors.size()), gnss_descriptors.data()) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set GNSS2 message format!"); @@ -170,21 +168,21 @@ int main(int argc, const char* argv[]) uint16_t filter_base_rate; - if(commands_3dm::getBaseRate(*device, data_filter::DESCRIPTOR_SET, &filter_base_rate) != CmdResult::ACK_OK) + if(mip::commands_3dm::getBaseRate(*device, mip::data_filter::DESCRIPTOR_SET, &filter_base_rate) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not get filter base rate format!"); const uint16_t filter_sample_rate = 100; // Hz const uint16_t filter_decimation = filter_base_rate / filter_sample_rate; - std::array filter_descriptors = {{ - { data_shared::DATA_GPS_TIME, filter_decimation }, - { data_filter::DATA_FILTER_STATUS, filter_decimation }, - { data_filter::DATA_POS_LLH, filter_decimation }, - { data_filter::DATA_VEL_NED, filter_decimation }, - { data_filter::DATA_ATT_EULER_ANGLES, filter_decimation }, + std::array filter_descriptors = {{ + { mip::data_shared::DATA_GPS_TIME, filter_decimation }, + { mip::data_filter::DATA_FILTER_STATUS, filter_decimation }, + { mip::data_filter::DATA_POS_LLH, filter_decimation }, + { mip::data_filter::DATA_VEL_NED, filter_decimation }, + { mip::data_filter::DATA_ATT_EULER_ANGLES, filter_decimation }, }}; - if(commands_3dm::writeMessageFormat(*device, data_filter::DESCRIPTOR_SET, filter_descriptors.size(), filter_descriptors.data()) != CmdResult::ACK_OK) + if(mip::commands_3dm::writeMessageFormat(*device, mip::data_filter::DESCRIPTOR_SET, static_cast(filter_descriptors.size()), filter_descriptors.data()) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set filter message format!"); @@ -192,7 +190,7 @@ int main(int argc, const char* argv[]) //Setup the sensor to vehicle transformation // - if(commands_3dm::writeSensor2VehicleTransformEuler(*device, sensor_to_vehicle_transformation_euler[0], sensor_to_vehicle_transformation_euler[1], sensor_to_vehicle_transformation_euler[2]) != CmdResult::ACK_OK) + if(mip::commands_3dm::writeSensor2VehicleTransformEuler(*device, sensor_to_vehicle_transformation_euler[0], sensor_to_vehicle_transformation_euler[1], sensor_to_vehicle_transformation_euler[2]) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set sensor-to-vehicle transformation!"); @@ -201,11 +199,11 @@ int main(int argc, const char* argv[]) // //GNSS1 - if(commands_filter::writeMultiAntennaOffset(*device, 1, gnss1_antenna_offset_meters) != CmdResult::ACK_OK) + if(mip::commands_filter::writeMultiAntennaOffset(*device, 1, gnss1_antenna_offset_meters) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set GNSS1 antenna offset!"); //GNSS2 - if(commands_filter::writeMultiAntennaOffset(*device, 2, gnss2_antenna_offset_meters) != CmdResult::ACK_OK) + if(mip::commands_filter::writeMultiAntennaOffset(*device, 2, gnss2_antenna_offset_meters) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set GNSS2 antenna offset!"); @@ -213,10 +211,10 @@ int main(int argc, const char* argv[]) //Setup the filter aiding measurements (GNSS position/velocity and dual antenna [aka gnss heading]) // - if(commands_filter::writeAidingMeasurementEnable(*device, commands_filter::AidingMeasurementEnable::AidingSource::GNSS_POS_VEL, true) != CmdResult::ACK_OK) + if(mip::commands_filter::writeAidingMeasurementEnable(*device, mip::commands_filter::AidingMeasurementEnable::AidingSource::GNSS_POS_VEL, true) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set filter aiding measurement enable!"); - if(commands_filter::writeAidingMeasurementEnable(*device, commands_filter::AidingMeasurementEnable::AidingSource::GNSS_HEADING, true) != CmdResult::ACK_OK) + if(mip::commands_filter::writeAidingMeasurementEnable(*device, mip::commands_filter::AidingMeasurementEnable::AidingSource::GNSS_HEADING, true) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set filter aiding measurement enable!"); @@ -224,7 +222,7 @@ int main(int argc, const char* argv[]) //Enable the wheeled-vehicle constraint // - if(commands_filter::writeWheeledVehicleConstraintControl(*device, 1) != CmdResult::ACK_OK) + if(mip::commands_filter::writeWheeledVehicleConstraintControl(*device, 1) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set filter wheeled-vehicle constraint enable!"); @@ -235,11 +233,11 @@ int main(int argc, const char* argv[]) float filter_init_pos[3] = {0}; float filter_init_vel[3] = {0}; - commands_filter::InitializationConfiguration::AlignmentSelector alignment; + mip::commands_filter::InitializationConfiguration::AlignmentSelector alignment; alignment = alignment.DUAL_ANTENNA | alignment.KINEMATIC; - if(commands_filter::writeInitializationConfiguration(*device, 0, commands_filter::InitializationConfiguration::InitialConditionSource::AUTO_POS_VEL_ATT, - alignment, 0.0, 0.0, 0.0, filter_init_pos, filter_init_vel, commands_filter::FilterReferenceFrame::LLH) != CmdResult::ACK_OK) + if(mip::commands_filter::writeInitializationConfiguration(*device, 0, mip::commands_filter::InitializationConfiguration::InitialConditionSource::AUTO_POS_VEL_ATT, + alignment, 0.0, 0.0, 0.0, filter_init_pos, filter_init_vel, mip::commands_filter::FilterReferenceFrame::LLH) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not set filter initialization configuration!"); @@ -247,7 +245,7 @@ int main(int argc, const char* argv[]) //Reset the filter (note: this is good to do after filter setup is complete) // - if(commands_filter::reset(*device) != CmdResult::ACK_OK) + if(mip::commands_filter::reset(*device) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not reset the filter!"); @@ -256,25 +254,25 @@ int main(int argc, const char* argv[]) // //Sensor Data - DispatchHandler sensor_data_handlers[4]; + mip::DispatchHandler sensor_data_handlers[4]; - device->registerExtractor(sensor_data_handlers[0], &sensor_gps_time, data_sensor::DESCRIPTOR_SET); + device->registerExtractor(sensor_data_handlers[0], &sensor_gps_time, mip::data_sensor::DESCRIPTOR_SET); device->registerExtractor(sensor_data_handlers[1], &sensor_accel); device->registerExtractor(sensor_data_handlers[2], &sensor_gyro); device->registerExtractor(sensor_data_handlers[3], &sensor_mag); //GNSS Data - DispatchHandler gnss_data_handlers[2]; + mip::DispatchHandler gnss_data_handlers[2]; - device->registerExtractor(gnss_data_handlers[0], &gnss_fix_info[0], data_gnss::MIP_GNSS1_DATA_DESC_SET); - device->registerExtractor(gnss_data_handlers[1], &gnss_fix_info[1], data_gnss::MIP_GNSS2_DATA_DESC_SET); + device->registerExtractor(gnss_data_handlers[0], &gnss_fix_info[0], mip::data_gnss::MIP_GNSS1_DATA_DESC_SET); + device->registerExtractor(gnss_data_handlers[1], &gnss_fix_info[1], mip::data_gnss::MIP_GNSS2_DATA_DESC_SET); //Filter Data - DispatchHandler filter_data_handlers[5]; + mip::DispatchHandler filter_data_handlers[5]; - device->registerExtractor(filter_data_handlers[0], &filter_gps_time, data_filter::DESCRIPTOR_SET); + device->registerExtractor(filter_data_handlers[0], &filter_gps_time, mip::data_filter::DESCRIPTOR_SET); device->registerExtractor(filter_data_handlers[1], &filter_status); device->registerExtractor(filter_data_handlers[2], &filter_position_llh); device->registerExtractor(filter_data_handlers[3], &filter_velocity_ned); @@ -285,7 +283,7 @@ int main(int argc, const char* argv[]) //Resume the device // - if(commands_base::resume(*device) != CmdResult::ACK_OK) + if(mip::commands_base::resume(*device) != mip::CmdResult::ACK_OK) exit_gracefully("ERROR: Could not resume the device!"); @@ -306,10 +304,10 @@ int main(int argc, const char* argv[]) //Check GNSS fixes and alert the user when they become valid for(int i=0; i<2; i++) { - if((gnss_fix_info_valid[i] == false) && ((gnss_fix_info[i].fix_type == data_gnss::FixInfo::FixType::FIX_3D) || - (gnss_fix_info[i].fix_type == data_gnss::FixInfo::FixType::FIX_RTK_FLOAT) || - (gnss_fix_info[i].fix_type == data_gnss::FixInfo::FixType::FIX_RTK_FIXED)) && - (gnss_fix_info[i].valid_flags & data_gnss::FixInfo::ValidFlags::FIX_TYPE)) + if((gnss_fix_info_valid[i] == false) && ((gnss_fix_info[i].fix_type == mip::data_gnss::FixInfo::FixType::FIX_3D) || + (gnss_fix_info[i].fix_type == mip::data_gnss::FixInfo::FixType::FIX_RTK_FLOAT) || + (gnss_fix_info[i].fix_type == mip::data_gnss::FixInfo::FixType::FIX_RTK_FIXED)) && + (gnss_fix_info[i].valid_flags & mip::data_gnss::FixInfo::ValidFlags::FIX_TYPE)) { printf("NOTE: GNSS%i fix info valid.\n", i+1); gnss_fix_info_valid[i] = true; @@ -317,7 +315,7 @@ int main(int argc, const char* argv[]) } //Check Filter State - if((!filter_state_full_nav) && (filter_status.filter_state == data_filter::FilterMode::FULL_NAV)) + if((!filter_state_full_nav) && (filter_status.filter_state == mip::data_filter::FilterMode::FULL_NAV)) { printf("NOTE: Filter has entered full navigation mode.\n"); filter_state_full_nav = true; @@ -366,9 +364,9 @@ void exit_gracefully(const char *message) if(message) printf("%s\n", message); -#ifdef _WIN32 +#ifdef MICROSTRAIN_PLATFORM_WINDOWS printf("Press ENTER to exit...\n"); - int dummy = getchar(); + getchar(); #endif exit(0); @@ -384,4 +382,3 @@ bool should_exit() return false; } - diff --git a/examples/PrettyPrinter/pretty_printer.cpp b/examples/PrettyPrinter/pretty_printer.cpp new file mode 100644 index 000000000..d2a7758df --- /dev/null +++ b/examples/PrettyPrinter/pretty_printer.cpp @@ -0,0 +1,77 @@ + +#include "../example_utils.hpp" + +#include "stringify.hpp" + +#include + +#include +#include +#include + +#include +#include +#include + + +volatile sig_atomic_t stop_flag = false; +mip::Timestamp last_receive_time = 0; + +mip::metadata::Definitions mipdefs{mip::metadata::ALL_FIELDS}; + +void signal_handler(int signum) +{ + (void)signum; + + stop_flag = true; +} + + +void handleField(void*, const mip::FieldView& field, mip::Timestamp timestamp) +{ + std::printf("%zu: %s\n", timestamp, formatField(field).c_str()); + + last_receive_time = timestamp; +} + + +int main(int argc, const char* argv[]) +{ + mipdefs.registerDefinitions(mip::metadata::ALL_FIELDS); + + std::unique_ptr utils; + try { + utils = handleCommonArgs(argc, argv); + } catch(const std::underflow_error&) { + return printCommonUsage(argv); + } catch(const std::exception& ex) { + fprintf(stderr, "Error: %s\n", ex.what()); + return 1; + } + + std::unique_ptr& device = utils->device; + + if(mip::CmdResult result = mip::commands_base::resume(*device); !result) + { + fprintf(stderr, "Error: Resume command failed: %d %s\n", result.value, result.name()); + return 1; + } + + mip::DispatchHandler handler; + device->registerFieldCallback<&handleField>(handler, 0x00, mip::INVALID_FIELD_DESCRIPTOR); + + mip::commands_base::BaseDeviceInfo info; + mip::commands_base::getDeviceInfo(*device, &info); + + std::signal(SIGTERM, &signal_handler); + + while(!stop_flag) + { + device->update(100); + } + + printf("Stopped.\n"); + + return 0; +} + diff --git a/examples/PrettyPrinter/stringify.cpp b/examples/PrettyPrinter/stringify.cpp new file mode 100644 index 000000000..ad519a207 --- /dev/null +++ b/examples/PrettyPrinter/stringify.cpp @@ -0,0 +1,400 @@ + + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#if __cpp_lib_optional < 201606L +#error "Needs optional support" +#endif + +extern mip::metadata::Definitions mipdefs; + + +struct Formatter +{ + static constexpr size_t MAX_PARAMETERS = 20; + + mip::Serializer serializer; + std::ostream& ss; + std::array offsets; + + std::ostream& formatEnum(const mip::metadata::EnumInfo* info); + std::ostream& formatBitfield(const mip::metadata::BitfieldInfo* info); + std::ostream& formatUnion(const mip::metadata::UnionInfo* info, const mip::metadata::StructInfo& parent, size_t offset_index); + std::ostream& formatStruct(const mip::metadata::StructInfo* info, size_t offset_index=0); + + void formatParameter(const mip::metadata::ParameterInfo& param, const mip::metadata::StructInfo& parent, size_t offset_index=0); + + template + std::ostream& formatBasicType(); +}; + + +//////////////////////////////////////////////////////////////////////////////// +///@brief Format an arithmetic type (including bool) from buffer to a string. +/// +///@param ss Output stream +///@param buffer Data buffer +///@param length Length of data buffer +///@param offset Offset into data buffer where value is stored (may be out of range) +/// +///@returns ss +/// +template +std::ostream& Formatter::formatBasicType() +{ + T value; + if(!serializer.extract(value)) + return ss << "?"; + if constexpr(std::is_same_v) + return ss << value; + else if constexpr(std::is_same_v) + return ss << std::boolalpha << value; + else + return ss << (int)value; +} + +//////////////////////////////////////////////////////////////////////////////// +///@brief Read an integral value from the raw buffer. +/// +///@param type Real type of the data in the buffer. Used for size. +///@param buffer Data buffer +///@param length Length of data buffer +///@param offset Offset into data buffer where value is stored (may be out of range) +/// +///@returns A uint64_t containing the value. All smaller integers are converted to this type. +///@returns std::nullopt (no value) if the offset/size is beyond the end of the buffer. +/// +static std::optional readIntegralValue(mip::metadata::Type type, mip::Serializer& serializer) +{ + switch(type) + { + case mip::metadata::Type::U8: return microstrain::extract< uint8_t>(serializer); + case mip::metadata::Type::S8: return microstrain::extract< int8_t>(serializer); + case mip::metadata::Type::U16: return microstrain::extract(serializer); + case mip::metadata::Type::S16: return microstrain::extract< int32_t>(serializer); + case mip::metadata::Type::U32: return microstrain::extract(serializer); + case mip::metadata::Type::S32: return microstrain::extract< int64_t>(serializer); + case mip::metadata::Type::U64: return microstrain::extract(serializer); + case mip::metadata::Type::S64: return microstrain::extract< int64_t>(serializer); + default: return std::nullopt; + } +} + +//////////////////////////////////////////////////////////////////////////////// +///@brief Format enum from buffer to a string. +/// +///@param ss Output stream +///@param info Enum metadata (may be NULL) +///@param buffer Data buffer +///@param length Length of data buffer +///@param offset Offset into data buffer where value is stored +/// +///@returns ss +/// +std::ostream& Formatter::formatEnum(const mip::metadata::EnumInfo* info) +{ + if(!info) + return ss << ""; + + std::optional value = readIntegralValue(info->type, serializer); + + if(!value) + return ss << "?"; + + auto it = std::find_if( + info->entries.begin(), info->entries.end(), + [value](const mip::metadata::EnumInfo::Entry& entry){ return entry.value == value; } + ); + const char* name = (it != info->entries.end()) ? it->name : "?"; + + return ss << *value << '(' << name << ')'; +} + +//////////////////////////////////////////////////////////////////////////////// +///@brief Format bitfield from buffer to a string. +/// +///@param ss Output stream +///@param info Bitfield metadata (may be NULL) +///@param buffer Data buffer +///@param length Length of data buffer +///@param offset Offset into data buffer where value is stored (may be out of range) +/// +///@returns ss +/// +std::ostream& Formatter::formatBitfield(const mip::metadata::BitfieldInfo* info) +{ + if(!info) + return ss << ""; + + std::optional value = readIntegralValue(info->type, serializer); + + if(!value) + return ss << "?"; + + ss << '{'; + size_t i=0; + for(const mip::metadata::EnumInfo::Entry& entry : info->entries) + { + if(i > 0) + ss << ", "; + + ss << entry.name << '='; + + const size_t firstBit = std::countl_zero(entry.value); + ss << ((*value & entry.value) >> firstBit); + + i++; + } + ss << '}'; + return ss; +} + +void Formatter::formatParameter(const mip::metadata::ParameterInfo ¶m, const mip::metadata::StructInfo& parent, size_t offset_index) +{ + switch(param.type.type) + { + case mip::metadata::Type::NONE: + ss << "-"; + break; + + case mip::metadata::Type::CHAR: formatBasicType(); break; + case mip::metadata::Type::BOOL: formatBasicType(); break; + case mip::metadata::Type::U8: formatBasicType(); break; + case mip::metadata::Type::S8: formatBasicType< int8_t >(); break; + case mip::metadata::Type::U16: formatBasicType(); break; + case mip::metadata::Type::S16: formatBasicType< int16_t>(); break; + case mip::metadata::Type::U32: formatBasicType(); break; + case mip::metadata::Type::S32: formatBasicType< int32_t>(); break; + case mip::metadata::Type::U64: formatBasicType(); break; + case mip::metadata::Type::S64: formatBasicType< int64_t>(); break; + case mip::metadata::Type::FLOAT: formatBasicType(); break; + case mip::metadata::Type::DOUBLE: formatBasicType(); break; + + case mip::metadata::Type::ENUM: + formatEnum(static_cast(param.type.infoPtr)); + break; + + case mip::metadata::Type::BITS: + formatBitfield(static_cast(param.type.infoPtr)); + break; + + case mip::metadata::Type::STRUCT: + formatStruct(static_cast(param.type.infoPtr), offset_index); + break; + + case mip::metadata::Type::UNION: + formatUnion(static_cast(param.type.infoPtr), parent, offset_index); + break; + } +} + +//////////////////////////////////////////////////////////////////////////////// +///@brief Format union from buffer to a string. +/// +///@param ss Output stream +///@param info Union metadata (may be NULL) +///@param parent Struct metadata of the parent object (for parameter access). +///@param buffer Data buffer +///@param length Length of data buffer +///@param offset Offset into data buffer where value is stored (may be out of range) +/// +///@returns ss +/// +std::ostream& Formatter::formatUnion(const mip::metadata::UnionInfo* info, const mip::metadata::StructInfo& parent, size_t offset_index) +{ + if(!info) + return ss << ""; + if(serializer.isOverrun()) + return ss << "?"; + + ss << info->name << '{'; + + for(const mip::metadata::ParameterInfo& param : info->parameters) + { + // Enum condition, where the active union member depends on a previous parameter's value. + if(param.condition.type == mip::metadata::ParameterInfo::Condition::Type::ENUM) + { + // Parameter index is within the parent's parameter array. + assert(param.condition.paramIdx.isValid(parent.parameters.size())); + const mip::metadata::ParameterInfo &discriminant = parent.parameters[param.condition.paramIdx.index()]; + + // Index is within the offset array relative to the parent. + assert(offset_index+param.condition.paramIdx.index() < MAX_PARAMETERS); + const uint8_t offset = offsets[offset_index+param.condition.paramIdx.index()]; + + // Read value from serializer (jump back to the correct parameter offset, then back). + const size_t oldOffset = serializer.setOffset(offset); + std::optional value = readIntegralValue(discriminant.type.type, serializer); + serializer.setOffset(oldOffset); + + // If value was read successfully and it matches the condition value then display it. + if(value.has_value() && *value == param.condition.value) + { + formatParameter(param, parent, offset_index); + } + } + } + + ss << '}'; + return ss; +} + +//static constexpr inline size_t MAX_PARAM_REFS = 5; +//struct Offset +//{ +// microstrain::Index paramId = {}; +// size_t offset = 0; +//}; + +//////////////////////////////////////////////////////////////////////////////// +///@brief Format struct from buffer to a string. +/// +///@param ss Output stream +///@param info Struct metadata (may be NULL) +///@param buffer Data buffer +///@param length Length of data buffer +///@param offset Offset into data buffer where value is stored (may be out of range) +/// +///@returns ss +/// +std::ostream& Formatter::formatStruct(const mip::metadata::StructInfo* info, size_t offset_index) +{ + if(!info) + return ss << ""; + if(serializer.isOverrun()) + return ss << "?"; + + // Keep track of the offset of each parameter so we can go back and look up array sizes, etc. + assert(info->parameters.size() <= MAX_PARAMETERS); // Increase MAX_PARAMETERS if this trips. + + //std::array offsets; + //size_t nextOffsetIndex = 0; + //microstrain::Index firstVariadicParam; + + //const size_t baseOffset = serializer.offset(); + + // Entry in 'offsets' representing the first parameter of this struct. + assert(offset_index + info->parameters.size() <= MAX_PARAMETERS); + // size_t base_index = offset_index; + // num_offsets += info->parameters.size(); + // Ensure there are enough entries in the offsets array. + + ss << '{'; + + for(size_t i=0; iparameters.size(); i++) + { + const mip::metadata::ParameterInfo& param = info->parameters[i]; + if(i > 0) + ss << ", "; + + ss << param.name << '='; + + // Save offset of each parameter in case it's an array count or union discriminator. + // This will clobber the offsets of nested structs (within this one), but those + // offsets won't be needed again. Only basic types can be counters or discriminators + // so only those parameters might need to be read later on. + offsets[offset_index+i] = (uint8_t)serializer.offset(); + + uint8_t count = param.count.count; + if(param.count.hasCounter()) + { + assert(param.count.paramIdx.isValid(i)); // Array size can't come after the array + + const mip::metadata::ParameterInfo& counter = info->parameters[param.count.paramIdx.index()]; + const size_t counterOffset = offsets[offset_index+param.count.paramIdx.index()]; + + // Counters must be arithmetic types and can't be arrays. + assert(counter.type.isBasicType()); + assert(counter.count.count == 1 && !counter.count.hasCounter()); + + const size_t oldOffset = serializer.setOffset(counterOffset); + std::optional counterValue = readIntegralValue(counter.type.type, serializer); + serializer.setOffset(oldOffset); + + if(!counterValue) + { + serializer.invalidate(); + ss << "[?]"; + continue; + } + + count = (uint8_t)*counterValue; + } + if(param.count.count != 1) + ss << (param.type.type == mip::metadata::Type::CHAR ? '"' : '['); + + for(uint8_t j=0; j 0 && param.type.type != mip::metadata::Type::CHAR) + ss << ", "; + + formatParameter(param, *info, offset_index+i); + } + if(param.count.count != 1) + ss << (param.type.type == mip::metadata::Type::CHAR ? '"' : ']'); + } + ss << '}'; + + return ss; +} + +//////////////////////////////////////////////////////////////////////////////// +///@brief Format mip field from buffer to a string. +/// +///@param ss Output stream +///@param field FieldView containing data to print +/// +///@returns ss +/// +std::ostream& formatField(std::ostream& ss, const mip::FieldView& field) +{ + const mip::metadata::FieldInfo* info = mipdefs.findField(field.descriptor()); + + if(!info) + { + ss << std::showbase << std::hex << std::setfill('0'); + ss << "Unknown(" << std::setw(2) << (int)field.descriptorSet() << "," << std::setw(2) << (int)field.fieldDescriptor() << ")[" << std::noshowbase; + for(uint8_t i=0; iname; + + Formatter formatter = { + mip::Serializer(field.payload(), field.payloadLength()), + ss, + }; + + formatter.formatStruct(static_cast(info)); + } + return ss; +} + +//////////////////////////////////////////////////////////////////////////////// +///@brief Format bitfield to a string. +/// +///@param field FieldView holding the buffer containing the field data. +/// +///@returns A human and machine-readable string. +/// +std::string formatField(const mip::FieldView& field) +{ + std::stringstream ss; + + formatField(ss, field); + + return ss.str(); +} diff --git a/examples/PrettyPrinter/stringify.hpp b/examples/PrettyPrinter/stringify.hpp new file mode 100644 index 000000000..04823c02e --- /dev/null +++ b/examples/PrettyPrinter/stringify.hpp @@ -0,0 +1,18 @@ +#pragma once + +#include + +namespace mip +{ + class FieldView; + + namespace metadata + { + class Definitions; + } +} + + +extern mip::metadata::Definitions mipdefs; + +std::string formatField(const mip::FieldView& field); diff --git a/examples/device_info.cpp b/examples/device_info.cpp index 7c9c454a7..ec0bb623c 100644 --- a/examples/device_info.cpp +++ b/examples/device_info.cpp @@ -9,7 +9,7 @@ //! //! THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING //! CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER -//! FOR THEM TO SAVE TIME. AS A RESULT, HBK MICROSTRAIN SHALL NOT BE HELD +//! FOR THEM TO SAVE TIME. AS A RESULT, MICROSTRAIN BY HBK SHALL NOT BE HELD //! LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY //! CLAIMS ARISING FROM THE CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS //! OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. @@ -31,7 +31,7 @@ int main(int argc, const char* argv[]) try { std::unique_ptr utils = handleCommonArgs(argc, argv); - std::unique_ptr& device = utils->device; + std::unique_ptr& device = utils->device; mip::commands_base::BaseDeviceInfo device_info; @@ -44,7 +44,11 @@ int main(int argc, const char* argv[]) auto print_info = [](const char* name, const char info[16]) { char msg[17] = {0}; +#ifdef _WIN32 + strncpy_s(msg, info, 16); +#else std::strncpy(msg, info, 16); +#endif printf(" %s%s\n", name, msg); }; @@ -65,7 +69,7 @@ int main(int argc, const char* argv[]) printf("Error: command completed with NACK: %s (%d)\n", result.name(), result.value); } } - catch(const std::underflow_error& ex) + catch(const std::underflow_error&) { return printCommonUsage(argv); } diff --git a/examples/example_utils.cpp b/examples/example_utils.cpp index 0e47a84fe..b051022e5 100644 --- a/examples/example_utils.cpp +++ b/examples/example_utils.cpp @@ -3,12 +3,12 @@ #include -#include +#include #include "example_utils.hpp" -#ifdef WIN32 +#ifdef MICROSTRAIN_PLATFORM_WINDOWS #define PORT_KEY "COM" #else #define PORT_KEY "/dev/" @@ -20,7 +20,7 @@ mip::Timestamp getCurrentTimestamp() return duration_cast( steady_clock::now().time_since_epoch() ).count(); } -void customLog(void* user, mip_log_level level, const char* fmt, va_list args) +void customLog(void* /*user*/, microstrain_log_level level, const char* fmt, va_list args) { // Convert the varargs into a string std::string log; @@ -37,8 +37,8 @@ void customLog(void* user, mip_log_level level, const char* fmt, va_list args) // Print to the proper stream switch (level) { - case MIP_LOG_LEVEL_FATAL: - case MIP_LOG_LEVEL_ERROR: + case MICROSTRAIN_LOG_LEVEL_FATAL: + case MICROSTRAIN_LOG_LEVEL_ERROR: std::cerr << log; break; default: @@ -49,61 +49,61 @@ void customLog(void* user, mip_log_level level, const char* fmt, va_list args) std::unique_ptr openFromArgs(const std::string& port_or_hostname, const std::string& baud_or_port, const std::string& binary_file_path) { - auto example_utils = std::unique_ptr(new ExampleUtils()); + std::unique_ptr example_utils(new ExampleUtils()); if( !binary_file_path.empty() ) { -#ifdef MIP_USE_EXTRAS - example_utils->recordedFile = std::unique_ptr(new std::ofstream(binary_file_path)); +#if defined MICROSTRAIN_ENABLE_SERIAL || defined MICROSTRAIN_ENABLE_TCP + example_utils->recordedFile.reset(new std::ofstream(binary_file_path)); if( !example_utils->recordedFile->is_open() ) throw std::runtime_error("Unable to open binary file"); -#else // MIP_USE_EXTRAS - throw std::runtime_error("The program was compiled without binary file recording support. Recompile with -DMIP_USE_EXTRAS=ON"); -#endif // MIP_USE_EXTRAS +#else // MIP_ENABLE_EXTRAS + throw std::runtime_error("The program was compiled without binary file recording support. Recompile with -DMIP_ENABLE_EXTRAS=ON"); +#endif // MIP_ENABLE_EXTRAS } if(port_or_hostname.find(PORT_KEY) == std::string::npos) // Not a serial port { -#ifdef MIP_USE_TCP +#ifdef MICROSTRAIN_ENABLE_TCP uint32_t port = std::strtoul(baud_or_port.c_str(), nullptr, 10); if( port < 1024 || port > 65535 ) throw std::runtime_error("Invalid TCP port (must be between 1024 and 65535."); -#ifdef MIP_USE_EXTRAS - using RecordingTcpConnection = mip::extras::RecordingConnectionWrapper; - example_utils->connection = std::unique_ptr(new RecordingTcpConnection(example_utils->recordedFile.get(), example_utils->recordedFile.get(), port_or_hostname, port)); -#else // MIP_USE_EXTRAS - using TcpConnection = mip::platform::TcpConnection; - example_utils->connection = std::unique_ptr(new TcpConnection(port_or_hostname, port)); -#endif // MIP_USE_EXTRAS +#if defined MICROSTRAIN_ENABLE_SERIAL || defined MICROSTRAIN_ENABLE_TCP + using RecordingTcpConnection = microstrain::connections::RecordingConnectionWrapper; + example_utils->connection.reset(new RecordingTcpConnection(example_utils->recordedFile.get(), example_utils->recordedFile.get(), port_or_hostname, uint16_t(port))); +#else // MIP_ENABLE_EXTRAS + using TcpConnection = microstrain::connections::TcpConnection; + example_utils->connection.reset(new TcpConnection(port_or_hostname, port)); +#endif // MIP_ENABLE_EXTRAS - example_utils->device = std::unique_ptr(new mip::DeviceInterface(example_utils->connection.get(), example_utils->buffer, sizeof(example_utils->buffer), 1000, 2000)); -#else // MIP_USE_TCP - throw std::runtime_error("This program was compiled without socket support. Recompile with -DMIP_USE_TCP=1"); -#endif // MIP_USE_TCP + example_utils->device.reset(new mip::Interface(example_utils->connection.get(), example_utils->buffer, sizeof(example_utils->buffer), 1000, 2000)); +#else // MICROSTRAIN_ENABLE_TCP + throw std::runtime_error("This program was compiled without socket support. Recompile with -DMICROSTRAIN_ENABLE_TCP=1"); +#endif // MICROSTRAIN_ENABLE_TCP } else // Serial port { -#ifdef MIP_USE_SERIAL +#ifdef MICROSTRAIN_ENABLE_SERIAL uint32_t baud = std::strtoul(baud_or_port.c_str(), nullptr, 10); if( baud == 0 ) throw std::runtime_error("Serial baud rate must be a decimal integer greater than 0."); -#ifdef MIP_USE_EXTRAS - using RecordingSerialConnection = mip::extras::RecordingConnectionWrapper; - example_utils->connection = std::unique_ptr(new RecordingSerialConnection(example_utils->recordedFile.get(), example_utils->recordedFile.get(), port_or_hostname, baud)); -#else // MIP_USE_EXTRAS - using SerialConnection = mip::platform::SerialConnection; - example_utils->connection = std::unique_ptr(new SerialConnection(port_or_hostname, baud)); -#endif // MIP_USE_EXTRAS - - example_utils->device = std::unique_ptr(new mip::DeviceInterface(example_utils->connection.get(), example_utils->buffer, sizeof(example_utils->buffer), mip::C::mip_timeout_from_baudrate(baud), 500)); -#else // MIP_USE_SERIAL - throw std::runtime_error("This program was compiled without serial support. Recompile with -DMIP_USE_SERIAL=1.\n"); -#endif //MIP_USE_SERIAL +#if defined MICROSTRAIN_ENABLE_SERIAL || defined MICROSTRAIN_ENABLE_TCP + using RecordingSerialConnection = microstrain::connections::RecordingConnectionWrapper; + example_utils->connection.reset(new RecordingSerialConnection(example_utils->recordedFile.get(), example_utils->recordedFile.get(), port_or_hostname, baud)); +#else // MIP_ENABLE_EXTRAS + using SerialConnection = microstrain::connections::SerialConnection; + example_utils->connection.reset(new SerialConnection(port_or_hostname, baud)); +#endif // MIP_ENABLE_EXTRAS + + example_utils->device.reset(new mip::Interface(example_utils->connection.get(), example_utils->buffer, sizeof(example_utils->buffer), mip::C::mip_timeout_from_baudrate(baud), 500)); +#else // MICROSTRAIN_ENABLE_SERIAL + throw std::runtime_error("This program was compiled without serial support. Recompile with -DMICROSTRAIN_ENABLE_SERIAL=1.\n"); +#endif //MICROSTRAIN_ENABLE_SERIAL } if( !example_utils->connection->connect() ) @@ -115,7 +115,7 @@ std::unique_ptr openFromArgs(const std::string& port_or_hostname, std::unique_ptr handleCommonArgs(int argc, const char* argv[], int maxArgs) { // Setup the logger for the MIP SDK - MIP_LOG_INIT(&customLog, MIP_LOG_LEVEL_DEBUG, nullptr); + MICROSTRAIN_LOG_INIT(&customLog, MICROSTRAIN_LOG_LEVEL_DEBUG, nullptr); if( argc < 3 || argc > maxArgs ) { diff --git a/examples/example_utils.hpp b/examples/example_utils.hpp index 7ede3b40c..0b8bb5c09 100644 --- a/examples/example_utils.hpp +++ b/examples/example_utils.hpp @@ -1,18 +1,18 @@ #pragma once -#ifdef MIP_USE_SERIAL - #include "mip/platform/serial_connection.hpp" +#ifdef MICROSTRAIN_ENABLE_SERIAL + #include "microstrain/connections/serial/serial_connection.hpp" #endif -#ifdef MIP_USE_TCP - #include "mip/platform/tcp_connection.hpp" +#ifdef MICROSTRAIN_ENABLE_TCP + #include "microstrain/connections/tcp/tcp_connection.hpp" #endif -#ifdef MIP_USE_EXTRAS - #include "mip/extras/recording_connection.hpp" +#if defined MICROSTRAIN_ENABLE_SERIAL || defined MICROSTRAIN_ENABLE_TCP + #include "microstrain/connections/recording/recording_connection.hpp" #endif -#include +#include #include #include @@ -23,8 +23,8 @@ struct ExampleUtils { - std::unique_ptr connection; - std::unique_ptr device; + std::unique_ptr connection; + std::unique_ptr device; std::unique_ptr recordedFile; uint8_t buffer[1024]; }; @@ -36,5 +36,5 @@ std::unique_ptr openFromArgs(const std::string& port_or_hostname, std::unique_ptr handleCommonArgs(int argc, const char* argv[], int maxArgs=4); int printCommonUsage(const char* argv[]); -/// Displays current filter state for the connected device if it has changed. +/// Displays current filter state for the connected device if it has changed. void displayFilterState(const mip::data_filter::FilterMode &filterState, std::string ¤tState, bool isFiveSeries = false); diff --git a/examples/mip_packet_example.c b/examples/mip_packet_example.c new file mode 100644 index 000000000..416db23fd --- /dev/null +++ b/examples/mip_packet_example.c @@ -0,0 +1,405 @@ + +#include "mip/mip_packet.h" +#include "mip/mip_serialization.h" + +#include "mip/definitions/commands_base.h" +#include "mip/definitions/commands_3dm.h" +#include "mip/definitions/data_sensor.h" +#include "mip/definitions/data_shared.h" + +#include +#include + + +// This function demonstrates how to inspect and iterate fields in +// a MIP packet. These functions do not modify the packet and can +// be used on any packet as long as it has valid structure. +void print_packet(const mip_packet_view* packet, const char* name) +{ + // Ensure the packet structure is correct, otherwise a crash may result. + // This checks the following: + // 1. The packet buffer is not NULL. + // 2. The buffer size is at least MIP_PACKET_LENGTH_MIN. + // 3. The payload length does not exceed the buffer size. + // There's generally no need to check this if you're getting packets + // directly from mip_packet_create (with sufficient buffer space) or + // from the mip parser. If you're reading packets from a file, etc., + // without parsing, use this as a cheap validation step. + // In this example, it should always pass. + assert(mip_packet_is_sane(packet)); + + // Roughly equivalent to mip_packet_checksum_value(packet) == mip_packet_compute_checksum(packet). + const char* checksum_str = mip_packet_is_valid(packet) ? "valid" : "invalid"; + + // Print descriptor set, total length, and payload length. + printf( + "%s: desc_set=0x%02X tot_len=%u pay_len=%u chk=%s [", + name, mip_packet_descriptor_set(packet), mip_packet_total_length(packet), mip_packet_payload_length(packet), checksum_str + ); + + // Print each byte in the packet, including header and checksum. + for(size_t i = 0; i < mip_packet_total_length(packet); i++) + { + printf("%02X", mip_packet_pointer(packet)[i]); + } + + puts("]"); + + // Iterate each field in the packet and print it. + mip_field_view field; + mip_field_init_empty(&field); + while(mip_field_next_in_packet(&field, packet)) + { + // Print descriptors (descriptor set always matches the packet). + printf(" (%02X,%02X): payload=[", mip_field_descriptor_set(&field), mip_field_field_descriptor(&field)); + + // Print field payload bytes. + for(size_t i = 0; i < mip_field_payload_length(&field); i++) + { + printf("%02X", mip_field_payload(&field)[i]); + } + + puts("]"); + } +} + +// This function demonstrates how to build mip packets from scratch. +// It starts with simple cases and moves to more complex ones. It +// also shows some of the low-level details to help you understand +// what's happening "under the hood". +void create_packet_from_scratch() +{ + puts("\nCreate packet from scratch"); + + // Create a mip packet and storage buffer. + mip_packet_view packet; + uint8_t buffer[MIP_PACKET_LENGTH_MAX]; + mip_serializer serializer; + + // If the descriptor set is specified (even if it's invalid, i.e. 0x00) + // the constructor initializes a new MIP packet in the buffer. + // Otherwise, it assumes the buffer already contains a valid MIP packet. + mip_packet_create(&packet, buffer, sizeof(buffer), MIP_BASE_CMD_DESC_SET); + + // The packet isn't ready yet, but print it to demonstrate what the raw bytes look like after each step. + print_packet(&packet, "Empty, un-finalized packet"); + + // Write the checksum. + mip_packet_finalize(&packet); + print_packet(&packet, "Empty packet with checksum"); + + // + // FIELD #1 + // + // A Ping command, with no payload data. + // + + mip_packet_add_field(&packet, MIP_CMD_DESC_BASE_PING, NULL, 0); + + // + // FIELD #2 + // + // A Base Comm Speed command using a fixed/pre-serialized payload. + // + // If you already have the payload data in a buffer, this is the + // most efficient way to add a field. + // + + const uint8_t payload2[] = { 0x01, 0x01, 0x00, 0x01, 0xC2, 0x00 }; + mip_packet_add_field(&packet, MIP_CMD_DESC_BASE_COMM_SPEED, payload2, sizeof(payload2)); + + print_packet(&packet, "Unfinished packet with 2 fields"); + + // + // FIELD #3 + // + // A Base Comm Speed command, using the C struct definition. + // + // Generally, the C struct definitions are the easiest and most readable way to + // create a field in a packet from its parameter values. It's also the most efficient + // method offered by the MIP SDK because the data is not copied through any intermediate + // buffers; it's serialized directly from the command struct to the packet. + // + + mip_base_comm_speed_command cmd3; + cmd3.function = MIP_FUNCTION_WRITE; + cmd3.port = 0x01; + cmd3.baud = 115200; + + // Create a new field with a serializer. + mip_serializer_init_new_field(&serializer, &packet, MIP_CMD_DESC_BASE_COMM_SPEED); + // Serialize the command directly into the field's payload. + insert_mip_base_comm_speed_command(&serializer, &cmd3); + // Update the field length byte. + mip_serializer_finish_new_field(&serializer, &packet); + + print_packet(&packet, "Unfinished packet with 3 fields"); + + // + // FIELD #4 + // + // A Base Comm Speed command, by manually serializing the parameters. + // + // This is exactly the same as field #3, but without the mip_serializer_*_field helper + // functions. This is intended to show what happens "behind the scenes". + // + + // This part is analogous to mip_serializer_init_new_field from field #3. + // -------- + uint8_t* payload4 = NULL; + // Create a field and obtain the payload pointer. + // The return value is the number of bytes remaining after allocating this field. + // Note that in this particular case, we know the field length will be 6 bytes. + // This allows us to save going back and updating the field length after serialization (see field #6). + int leftover3 = mip_packet_create_field(&packet, MIP_CMD_DESC_BASE_COMM_SPEED, 6, &payload4); + + // If less than 0 bytes are left over, then allocation failed by this many bytes. + assert(leftover3 >= 0 && payload4 != NULL); + + // Show what the packet looks like after allocating a field. + // The header will exist but the payload will not be valid yet. + print_packet(&packet, "Field #4 allocated, not written"); + + // Initialize the serializer for the payload. + microstrain_serializer_init_insertion(&serializer, payload4, 6); + // -------- + + // This part is analogous to insert_mip_base_comm_speed_command + // -------- + // Write parameters to the payload. + microstrain_insert_u8(&serializer, 0x01); + microstrain_insert_u8(&serializer, 0x01); + microstrain_insert_u32(&serializer, 115200); + // Make sure serialization was successful (not out of space). + assert(microstrain_serializer_is_ok(&serializer)); + // -------- + + // The equivalent to mip_serializer_finish_new_field isn't required in this case + // because we specified an exact payload length to mip_packet_create_field. + + + // + // Complete packet #1 + // + + // Update the checksum. + mip_packet_finalize(&packet); + + // "Send" the packet + print_packet(&packet, "Finished packet with 4 fields"); + + // + // Packet #2 + // + + // Start over with a new descriptor set. + mip_packet_reset(&packet, MIP_3DM_CMD_DESC_SET); + + // Payload length has been zeroed out. Checksum is garbage. + print_packet(&packet, "Empty packet after reset"); + + // + // FIELD #5 (second packet) + // + // A 3DM Message Format command field using the C struct definition. + // + // Similar to #3 except that we have a variable-length payload. + // Again, this is the recommended method for field creation. + // + + mip_3dm_message_format_command cmd5; + cmd5.function = MIP_FUNCTION_WRITE; + cmd5.desc_set = MIP_SENSOR_DATA_DESC_SET; + cmd5.num_descriptors = 3; // This determines how many descriptors follow. + cmd5.descriptors[0].descriptor = MIP_DATA_DESC_SHARED_REFERENCE_TIME; + cmd5.descriptors[1].descriptor = MIP_DATA_DESC_SENSOR_ACCEL_SCALED; + cmd5.descriptors[2].descriptor = MIP_DATA_DESC_SENSOR_GYRO_SCALED; + cmd5.descriptors[0].decimation = 10; + cmd5.descriptors[1].decimation = 10; + cmd5.descriptors[2].decimation = 10; + + // Create the field and init the serializer in one step. + mip_serializer_init_new_field(&serializer, &packet, MIP_CMD_DESC_3DM_MESSAGE_FORMAT); + // Serialize the command. + insert_mip_3dm_message_format_command(&serializer, &cmd5); + // Update the field length. + mip_serializer_finish_new_field(&serializer, &packet); + + mip_packet_finalize(&packet); + print_packet(&packet, "3DM Message Format command"); + mip_packet_reset(&packet, MIP_3DM_CMD_DESC_SET); + + // + // Packet #3 + // + // FIELD #6 (third packet) + // + + // A 3DM Message Format command field, by manually serializing parameters + // + // Similar to #4 except that with a variable-length payload. + // Similar to #5, but with lower level function calls and slightly different command. + // + + // This part is analogous to mip_serializer_init_new_field from field #3. + // It's almost the same as in field #4, except we use a zero-length field. + // -------- + // Get a pointer to the payload buffer and the maximum number of bytes that can fit. + // + // Start by creating a zero-payload-length field and determining the remaining space. + uint8_t* payload5 = NULL; + int available5 = mip_packet_create_field(&packet, MIP_CMD_DESC_3DM_POLL_DATA, 0, &payload5); + // If less than 0 bytes are available, then there wasn't even space for the field header. + assert(available5 > 0 && payload5 != NULL); + // Initialize the serializer, giving it all available space. + microstrain_serializer_init_insertion(&serializer, payload5, available5); + // -------- + + // This part is analogous to insert_mip_3dm_poll_command + // -------- + // Build a 3DM Poll Data command: + // 1. Suppress_ack + microstrain_insert_bool(&serializer, false); + // 2. Descriptor set + microstrain_insert_u8(&serializer, MIP_SENSOR_DATA_DESC_SET); + // 3. Number of data quantities. + unsigned int num_data = 3; // Configure two descriptors + microstrain_insert_u8(&serializer, num_data); + // 4. Array of uint8_t descriptors. + // Descriptor 1 - Reference timestamp + microstrain_insert_u8(&serializer, MIP_DATA_DESC_SHARED_REFERENCE_TIME); + // Descriptor 2 - Scaled Accel + microstrain_insert_u8(&serializer, MIP_DATA_DESC_SENSOR_ACCEL_SCALED); + // Descriptor 3 - Scaled Gyro + microstrain_insert_u8(&serializer, MIP_DATA_DESC_SENSOR_GYRO_SCALED); + // -------- + + // This part is analogous to mip_serializer_finish_new_field + // -------- + // Check that everything fit in the field payload. + if(microstrain_serializer_is_ok(&serializer)) + { + // Now we know how many bytes were written, so update the field length in the packet. + mip_packet_update_last_field_length(&packet, payload5, microstrain_serializer_length(&serializer)); + } + else // Not enough space + { + assert(false); // This shouldn't happen in this example (note, there's no assertion in mip_serializer_finish_new_field). + // Cancel the field to ensure the packet is still valid. + mip_packet_cancel_last_field(&packet, payload5); + } + // -------- + + // + // Complete packet #3 + // + + mip_packet_finalize(&packet); + print_packet(&packet, "3DM Poll Data command"); +} + +// This function demonstrates how to construct a packet view from a buffer with existing data. +// For simplicity, the packet is hardcoded. +void create_packet_from_buffer() +{ + puts("\nCreate packet from buffer"); + + const uint8_t buffer[] = { + 0x75, 0x65, 0x80, 0x4c, 0x0a, 0xd5, 0x00, 0x00, 0x00, 0x05, 0x5e, 0xe6, 0x7c, 0xc0, 0x0a, 0xd6, + 0x00, 0x00, 0x00, 0x01, 0x4e, 0x43, 0x4a, 0x00, 0x0e, 0x04, 0x3d, 0x9e, 0xe8, 0x8d, 0x38, 0x7f, + 0xdb, 0x00, 0xbf, 0x7a, 0xaf, 0x03, 0x0e, 0x05, 0xbb, 0x0c, 0x1e, 0x30, 0xbb, 0x57, 0x2e, 0x68, + 0xbb, 0xaa, 0x24, 0xae, 0x0e, 0x07, 0xbc, 0x8a, 0xac, 0x80, 0xbc, 0x72, 0xc5, 0x0e, 0xbc, 0xc4, + 0xe2, 0xc1, 0x0e, 0x08, 0x3e, 0xee, 0x3d, 0x9f, 0xbd, 0x66, 0xda, 0xdd, 0xc0, 0xaf, 0xde, 0xf5, + 0x91, 0x96 + }; + + // Create a view of the packet in the buffer. + // Note: The buffer must not be modified, so do not call functions that manipulate the packet. + // E.g. finalize(), addField, createField, reset, etc. + mip_packet_view packet1; + mip_packet_from_buffer(&packet1, buffer, sizeof(buffer)); + + // Ensure the packet is valid before inspecting it. + // This is the combination of checking: + // 1. mip_packet_is_sane (buffer size and payload length checks) + // 2. The packet has a non-zero descriptor set. + // 3. The checksum is valid. + if(!mip_packet_is_valid(&packet1)) + { + assert(false); // The packet should be valid in this example. + return; + } + + // Print the packet. + print_packet(&packet1, "Packet from buffer"); + + // Example of what an application might do to parse specific data. + // This example is for demonstration of the techniques used with the MIP SDK; + // consider using the "dispatch" system (see the documentation) instead. + + // Is this a sensor data packet? + if(mip_packet_descriptor_set(&packet1) == MIP_SENSOR_DATA_DESC_SET) + { + puts("Sensor Data packet:"); + + // Iterate all fields in the packet. + mip_field_view field; + mip_field_init_empty(&field); + while(mip_field_next_in_packet(&field, &packet1)) + { + // Create a deserializer for the field. + mip_serializer serializer; + microstrain_serializer_init_extraction(&serializer, mip_field_payload(&field), mip_field_payload_length(&field)); + + // Check what data the field contains. + switch(mip_field_field_descriptor(&field)) + { + case MIP_DATA_DESC_SHARED_REFERENCE_TIME: + { + uint64_t nanoseconds; + microstrain_extract_u64(&serializer, &nanoseconds); + + if(microstrain_serializer_is_complete(&serializer)) + printf(" Ref Time = %lu\n", nanoseconds); + + break; + } + case MIP_DATA_DESC_SENSOR_ACCEL_SCALED: + { + // Extract the 3-vector. + float x,y,z; + microstrain_extract_float(&serializer, &x); + microstrain_extract_float(&serializer, &y); + microstrain_extract_float(&serializer, &z); + + // Check if the entire field was deserialized (validity check). + if(microstrain_serializer_is_complete(&serializer)) + printf(" Scaled Accel = (%f, %f, %f)\n", x, y, z); + + break; + } + case MIP_DATA_DESC_SENSOR_GYRO_SCALED: + { + // Same as scaled accel except using the C data structure. + // This is the recommended method. + mip_sensor_scaled_gyro_data data; + extract_mip_sensor_scaled_gyro_data(&serializer, &data); + + if(microstrain_serializer_is_complete(&serializer)) + printf(" Scaled Gyro = (%f, %f, %f)\n", data.scaled_gyro[0], data.scaled_gyro[1], data.scaled_gyro[2]); + + break; + } + } + } + puts(""); + } +} + +int main() +{ + create_packet_from_scratch(); + create_packet_from_buffer(); + + return 0; +} diff --git a/examples/mip_packet_example.cpp b/examples/mip_packet_example.cpp new file mode 100644 index 000000000..e0f740eb6 --- /dev/null +++ b/examples/mip_packet_example.cpp @@ -0,0 +1,360 @@ + +#include + +#include +#include +#include +#include + +#include + +// This function demonstrates how to inspect and iterate fields in +// a MIP packet. These functions do not modify the packet and can +// be used on any packet as long as it has valid structure. +void print_packet(const mip::PacketView& packet, const char* name) +{ + // Ensure the packet structure is correct, otherwise a crash may result. + // This checks the following: + // 1. The packet buffer is not NULL. + // 2. The buffer size is at least MIP_PACKET_LENGTH_MIN. + // 3. The payload length does not exceed the buffer size. + // There's generally no need to check this if you're getting packets + // directly from mip_packet_create (with sufficient buffer space) or + // from the mip parser. If you're reading packets from a file, etc., + // without parsing, use this as a cheap validation step. + // In this example, it should always pass. + assert(packet.isSane()); + + // Roughly equivalent to packet.checksumValue() == packet.computeChecksum() + const char* checksum_str = packet.isValid() ? "valid" : "invalid"; + + // Print descriptor set, total length, and payload length. + std::printf( + "%s: desc_set=0x%02X tot_len=%u pay_len=%u chk=%s [", + name, packet.descriptorSet(), packet.totalLength(), packet.payloadLength(), checksum_str + ); + + // Print each byte in the packet, including header and checksum. + for(size_t i=0; i < packet.totalLength(); i++) + { + std::printf("%02X", packet[i]); + } + + std::puts("]"); + + // Iterate each field in the packet and print it. + for(mip::FieldView field : packet) + { + // Print descriptors (descriptor set always matches the packet). + std::printf(" (%02X,%02X): payload=[", field.descriptorSet(), field.fieldDescriptor()); + + // Print field payload bytes. + for(size_t i=0; i < field.payloadLength(); i++) + { + // Note: this indexes the payload, excluding the header, whereas packet[i] indexes the whole packet. + std::printf("%02X", field[i]); + } + + std::puts("]"); + } +} + +// This function demonstrates how to build mip packets from scratch. +// It starts with simple cases and moves to more complex ones. It +// also shows some of the low-level details to help you understand +// what's happening "under the hood". +void create_packet_from_scratch() +{ + std::puts("\nCreate packet from scratch"); + + // Create a mip packet with a built-in buffer. + // A PacketBuf is the combination of a PacketView and a buffer. + // + // If the descriptor set is specified (even if it's invalid, i.e. 0x00) + // the constructor initializes a new MIP packet in the buffer. + // Otherwise, it assumes the buffer already contains a valid MIP packet. + +#if 1 // These sections are identical + mip::PacketBuf packet(mip::commands_base::DESCRIPTOR_SET); +#else + uint8_t buffer[mip::PACKET_LENGTH_MAX]; + mip::PacketView packet(buffer, sizeof(buffer), mip::commands_base::DESCRIPTOR_SET); +#endif + + // The packet isn't ready yet, but print it to demonstrate what the raw bytes look like after each step. + print_packet(packet, "Empty, un-finalized packet"); + + // Write the checksum. + packet.finalize(); + print_packet(packet, "Empty packet with checksum"); + + // + // FIELD #1 + // + // A Ping command, with no payload data. + // + + packet.addField(mip::commands_base::CMD_PING, nullptr, 0); + + // + // FIELD #2 + // + // A Base Comm Speed command using a fixed/pre-serialized payload. + // + // If you already have the payload data in a buffer, this is the + // most efficient way to add a field. + // + + const uint8_t payload2[] = { 0x01, 0x01, 0x00, 0x01, 0xC2, 0x00 }; + packet.addField(mip::commands_base::CMD_COMM_SPEED, payload2, sizeof(payload2)); + + print_packet(packet, "Unfinished packet with 2 fields"); + + // + // FIELD #3 + // + // A Base Comm Speed command, using the C++ struct definition. + // + // Generally, the C++ struct definitions are the easiest and most readable way to + // create a field in a packet from its parameter values. It's also the most efficient + // method offered by the MIP SDK because the data is not copied through any intermediate + // buffers; it's serialized directly from the command struct to the packet. + // + + mip::commands_base::CommSpeed cmd3; + cmd3.function = mip::FunctionSelector::WRITE; + cmd3.port = 0x01; + cmd3.baud = 115200; + + // In C++, the command can be directly added via a template function which takes + // care of the boilerplate of allocating and serializing a field. Compare to the + // C version of field #3 in mip_packet_example.c. + packet.addField(cmd3); + + print_packet(packet, "Unfinished packet with 3 fields"); + + // + // FIELD #4 + // + // A Base Comm Speed command, by manually serializing the parameters. + // + // This is exactly the same as field #3, but without the helper + // functions. This is intended to show what happens "behind the scenes". + // + + mip::Serializer serializer4 = packet.createField(mip::commands_base::CommSpeed::FIELD_DESCRIPTOR, 6); + +#if 1 + // insert is a variadic template allowing serialization of multiple values at once. + // This can offer efficiency improvements over the C version in some cases by bypassing some overhead. + serializer4.insert( + uint8_t(0x01), + uint8_t(0x01), + uint32_t(115200) + ); +#else // Effectively the same, but possibly less efficient. + serialize4.insert(0x01); + serialize4.insert(0x01); + serialize4.insert(115200); +#endif + + // + // Complete packet #1 + // + + // Update the checksum. + packet.finalize(); + + // "Send" the packet + print_packet(packet, "Finished packet with 4 fields"); + + // + // Packet #2 + // + + // Start over with a new descriptor set. + packet.reset(mip::commands_3dm::DESCRIPTOR_SET); + + // Payload length has been zeroed out. Checksum is garbage. + print_packet(packet, "Empty packet after reset"); + + // + // FIELD #5 (second packet) + // + // A 3DM Message Format command field using the C struct definition. + // + // Similar to #3 except that we have a variable-length payload. + // Again, this is the recommended method for field creation. + // + + mip::commands_3dm::MessageFormat cmd5; + cmd5.function = mip::FunctionSelector::WRITE; + cmd5.desc_set = mip::data_sensor::DESCRIPTOR_SET; + cmd5.num_descriptors = 3; // This determines how many descriptors follow. + cmd5.descriptors[0].descriptor = mip::data_shared::ReferenceTimestamp::FIELD_DESCRIPTOR; + cmd5.descriptors[1].descriptor = mip::data_sensor::ScaledAccel::FIELD_DESCRIPTOR; + cmd5.descriptors[2].descriptor = mip::data_sensor::DATA_GYRO_SCALED; + cmd5.descriptors[0].decimation = 10; + cmd5.descriptors[1].decimation = 10; + cmd5.descriptors[2].decimation = 10; + + packet.addField(cmd5); + + packet.finalize(); + print_packet(packet, "3DM Message Format command"); + mip_packet_reset(&packet, mip::commands_3dm::DESCRIPTOR_SET); + + // + // Packet #3 + // + + // FIELD #6 (third packet) + // + // A 3DM Message Format command field, by manually serializing parameters + // + // Similar to #4 except that with a variable-length payload. + // Similar to #5, but with lower level function calls and slightly different command. + // + + // Create a field of unknown length. + // This is equivalent to creating a field with length 0 and a serializer covering + // all of the remaining space. After the field is serialized, the field length is + // updated based on how many bytes were used. + mip::PacketView::AllocatedField field6 = packet.createField(mip::commands_3dm::PollData::FIELD_DESCRIPTOR); + + field6.insert( + false, // suppress_ack + uint8_t(mip::data_sensor::DESCRIPTOR_SET), + uint8_t(3) + ); + + // Arrays can also be directly serialized if their size is known. +#if 1 + std::array descriptors6 = {{ + mip::data_shared::ReferenceTimestamp::FIELD_DESCRIPTOR, + mip::data_sensor::ScaledAccel::FIELD_DESCRIPTOR, + mip::data_sensor::DATA_GYRO_SCALED, + }}; + field6.insert(descriptors6); +#else + uint8_t descriptors6[] = { + mip::data_shared::ReferenceTimestamp::FIELD_DESCRIPTOR, + mip::data_sensor::ScaledAccel::FIELD_DESCRIPTOR, + mip::data_sensor::DATA_GYRO_SCALED, + }; + field6.insert(descriptors6); + // Equivalent to + //field6.insert(descriptors6, 3); +#endif + + // Update the field length. + // Note that if the field would exceed the remaining space in the packet, this will + // instead remove the field entirely and return false. + bool ok6 = field6.commit(); + assert(ok6); // Shouldn't happen in this example. + + // + // Complete packet #3 + // + + mip_packet_finalize(&packet); + print_packet(&packet, "3DM Poll Data command"); +} + +void create_packet_from_buffer() +{ + std::puts("\nCreate packet from buffer"); + + const uint8_t buffer[] = { + 0x75, 0x65, 0x80, 0x4c, 0x0a, 0xd5, 0x00, 0x00, 0x00, 0x05, 0x5e, 0xe6, 0x7c, 0xc0, 0x0a, 0xd6, + 0x00, 0x00, 0x00, 0x01, 0x4e, 0x43, 0x4a, 0x00, 0x0e, 0x04, 0x3d, 0x9e, 0xe8, 0x8d, 0x38, 0x7f, + 0xdb, 0x00, 0xbf, 0x7a, 0xaf, 0x03, 0x0e, 0x05, 0xbb, 0x0c, 0x1e, 0x30, 0xbb, 0x57, 0x2e, 0x68, + 0xbb, 0xaa, 0x24, 0xae, 0x0e, 0x07, 0xbc, 0x8a, 0xac, 0x80, 0xbc, 0x72, 0xc5, 0x0e, 0xbc, 0xc4, + 0xe2, 0xc1, 0x0e, 0x08, 0x3e, 0xee, 0x3d, 0x9f, 0xbd, 0x66, 0xda, 0xdd, 0xc0, 0xaf, 0xde, 0xf5, + 0x91, 0x96 + }; + + // Create a view of the packet in the buffer. + // Note: The buffer must not be modified, so do not call functions that manipulate the packet. + // E.g. finalize(), addField, createField, reset, etc. + mip::PacketView packet1(buffer, sizeof(buffer)); + + // Ensure the packet is valid before inspecting it. + // This is the combination of checking: + // 1. mip_packet_is_sane (buffer size and payload length checks) + // 2. The packet has a non-zero descriptor set. + // 3. The checksum is valid. + if(!packet1.isValid()) + { + assert(false); // The packet should be valid in this example. + return; + } + + // Print the packet. + print_packet(packet1, "Packet from buffer"); + + // Create a view from a span. + microstrain::Span span(buffer, sizeof(buffer)); + mip::PacketView packet2(span); + print_packet(packet2, "Packet from span"); + + // Create a C++ PacketView from the C equivalent. + mip::C::mip_packet_view packet3c; + mip::C::mip_packet_from_buffer(&packet3c, buffer, sizeof(buffer)); + mip::PacketView packet3(packet3c); + print_packet(packet3, "Packet from C packet"); + + // Example of what an application might do to parse specific data. + // This example is for demonstration of the techniques used with the MIP SDK; + // consider using the "dispatch" system (see the documentation) instead. + + // Is this a sensor data packet? + if(packet1.descriptorSet() == mip::data_sensor::DESCRIPTOR_SET) + { + std::puts("Sensor Data packet:"); + + for(mip::FieldView field : packet1) + { + mip::Serializer serializer(field.payloadSpan()); + + switch(field.fieldDescriptor()) + { + case mip::data_shared::ReferenceTimestamp::FIELD_DESCRIPTOR: + { + uint64_t nanoseconds; + + if(serializer.extract(nanoseconds)) + std::printf(" Ref Time = %lu\n", nanoseconds); + + break; + } + case mip::data_sensor::ScaledAccel::FIELD_DESCRIPTOR: + { + mip::data_sensor::ScaledAccel data; + + if(serializer.extract(data)) + std::printf(" Scaled Accel = (%f, %f, %f)\n", data.scaled_accel[0], data.scaled_accel[1], data.scaled_accel[2]); + + break; + } + case mip::data_sensor::ScaledGyro::FIELD_DESCRIPTOR: + { + mip::data_sensor::ScaledGyro data; + + // This calls the FieldView::extract helper function which handles deserialization directly. + // This is the simplest and preferred method. + if(field.extract(data)) + std::printf(" Scaled Gyro = (%f, %f, %f)\n", data.scaled_gyro[0], data.scaled_gyro[1], data.scaled_gyro[2]); + + break; + } + } + } + } +} + +int main() +{ + create_packet_from_scratch(); + create_packet_from_buffer(); +} diff --git a/examples/threading.cpp b/examples/threading.cpp index c12cdf5c4..e143bcd7c 100644 --- a/examples/threading.cpp +++ b/examples/threading.cpp @@ -9,7 +9,7 @@ //! //! THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING //! CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER -//! FOR THEM TO SAVE TIME. AS A RESULT, HBK MICROSTRAIN SHALL NOT BE HELD +//! FOR THEM TO SAVE TIME. AS A RESULT, MICROSTRAIN BY HBK SHALL NOT BE HELD //! LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY //! CLAIMS ARISING FROM THE CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS //! OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. @@ -58,12 +58,12 @@ unsigned int display_progress() return count; } -void packet_callback(void*, const mip::PacketRef& packet, mip::Timestamp timestamp) +void packet_callback(void*, const mip::PacketView&, mip::Timestamp) { - numSamples++; + numSamples = numSamples + 1; } -void device_thread_loop(mip::DeviceInterface* device) +void device_thread_loop(mip::Interface* device) { while(!stop) { @@ -77,7 +77,7 @@ void device_thread_loop(mip::DeviceInterface* device) } } -bool update_device(mip::DeviceInterface& device, mip::Timeout wait_time) +bool update_device(mip::Interface& device, mip::Timeout wait_time) { // Thread calls this with wait_time 0, commands have wait_time > 0. if( wait_time == 0 ) @@ -100,7 +100,7 @@ int main(int argc, const char* argv[]) try { std::unique_ptr utils = handleCommonArgs(argc, argv); - std::unique_ptr& device = utils->device; + std::unique_ptr& device = utils->device; // Disable all streaming channels. mip::commands_base::setIdle(*device); @@ -149,7 +149,7 @@ int main(int argc, const char* argv[]) deviceThread.join(); #endif } - catch(const std::underflow_error& ex) + catch(const std::underflow_error&) { return printCommonUsage(argv); } diff --git a/examples/watch_imu.c b/examples/watch_imu.c index 7fd76467d..64443ee3e 100644 --- a/examples/watch_imu.c +++ b/examples/watch_imu.c @@ -1,34 +1,22 @@ #include -#include #include -#include -#include -#include -#include +#include +#include +#include -#include #include #include #include -#include - -#include - #include #include -#include #include -#include #include -#ifdef WIN32 +#ifdef MICROSTRAIN_PLATFORM_WINDOWS #else #include -#include -#include -#include #endif serial_port port; @@ -36,12 +24,14 @@ uint8_t parse_buffer[1024]; mip_interface device; mip_sensor_scaled_accel_data scaled_accel; -void customLog(void* user, mip_log_level level, const char* fmt, va_list args) +void customLog(void* user, microstrain_log_level level, const char* fmt, va_list args) { + (void)user; + switch (level) { - case MIP_LOG_LEVEL_FATAL: - case MIP_LOG_LEVEL_ERROR: + case MICROSTRAIN_LOG_LEVEL_FATAL: + case MICROSTRAIN_LOG_LEVEL_ERROR: vfprintf(stderr, fmt, args); break; default: @@ -50,13 +40,14 @@ void customLog(void* user, mip_log_level level, const char* fmt, va_list args) } } -void handlePacket(void* unused, const mip_packet* packet, mip_timestamp timestamp) +void handlePacket(void* unused, const mip_packet_view* packet, mip_timestamp timestamp) { (void)unused; + (void)timestamp; printf("\nGot packet with descriptor set 0x%02X:", mip_packet_descriptor_set(packet)); - mip_field field; + mip_field_view field; mip_field_init_empty(&field); while( mip_field_next_in_packet(&field, packet) ) { @@ -65,9 +56,11 @@ void handlePacket(void* unused, const mip_packet* packet, mip_timestamp timestam printf("\n"); } -void handleAccel(void* user, const mip_field* field, mip_timestamp timestamp) +void handleAccel(void* user, const mip_field_view* field, mip_timestamp timestamp) { (void)user; + (void)timestamp; + mip_sensor_scaled_accel_data data; if(extract_mip_sensor_scaled_accel_data_from_field(field, &data)) @@ -82,18 +75,22 @@ void handleAccel(void* user, const mip_field* field, mip_timestamp timestamp) } } -void handleGyro(void* user, const mip_field* field, mip_timestamp timestamp) +void handleGyro(void* user, const mip_field_view* field, mip_timestamp timestamp) { (void)user; + (void)timestamp; + mip_sensor_scaled_gyro_data data; if(extract_mip_sensor_scaled_gyro_data_from_field(field, &data)) printf("Gyro Data: %f, %f, %f\n", data.scaled_gyro[0], data.scaled_gyro[1], data.scaled_gyro[2]); } -void handleMag(void* user, const mip_field* field, mip_timestamp timestamp) +void handleMag(void* user, const mip_field_view* field, mip_timestamp timestamp) { (void)user; + (void)timestamp; + mip_sensor_scaled_mag_data data; if(extract_mip_sensor_scaled_mag_data_from_field(field, &data)) @@ -114,21 +111,21 @@ mip_timestamp get_current_timestamp() } -bool mip_interface_user_recv_from_device(mip_interface* device, uint8_t* buffer, size_t max_length, mip_timeout wait_time, size_t* out_length, mip_timestamp* timestamp_out) +bool mip_interface_user_recv_from_device(mip_interface* device_, uint8_t* buffer, size_t max_length, mip_timeout wait_time, size_t* out_length, mip_timestamp* timestamp_out) { - (void)device; + (void)device_; *timestamp_out = get_current_timestamp(); - if( !serial_port_read(&port, buffer, max_length, wait_time, out_length) ) + if( !serial_port_read(&port, buffer, max_length, (int)wait_time, out_length) ) return false; return true; } -bool mip_interface_user_send_to_device(mip_interface* device, const uint8_t* data, size_t length) +bool mip_interface_user_send_to_device(mip_interface* device_, const uint8_t* data, size_t length) { - (void)device; + (void)device_; size_t bytes_written; if (!serial_port_write(&port, data, length, &bytes_written)) @@ -140,7 +137,7 @@ bool mip_interface_user_send_to_device(mip_interface* device, const uint8_t* dat bool open_port(const char* name, uint32_t baudrate) { - return serial_port_open(&port, name, baudrate); + return serial_port_open(&port, name, (int)baudrate); } int usage(const char* argv0) @@ -154,12 +151,12 @@ int main(int argc, const char* argv[]) if(argc != 3) return usage(argv[0]); - uint32_t baudrate = atoi(argv[2]); + uint32_t baudrate = strtoul(argv[2], NULL, 10); if( baudrate == 0 ) return usage(argv[0]); // Initialize the MIP logger before opening the port so we can print errors if they occur - MIP_LOG_INIT(&customLog, MIP_LOG_LEVEL_INFO, NULL); + MICROSTRAIN_LOG_INIT(&customLog, MICROSTRAIN_LOG_LEVEL_INFO, NULL); if( !open_port(argv[1], baudrate) ) return 1; @@ -228,7 +225,7 @@ int main(int argc, const char* argv[]) // Process data for 3 seconds. for(unsigned int i=0; i<30; i++) { -#ifdef WIN32 +#ifdef MICROSTRAIN_PLATFORM_WINDOWS #else usleep(100000); #endif diff --git a/examples/watch_imu.cpp b/examples/watch_imu.cpp index c071d73f4..3e958cdd4 100644 --- a/examples/watch_imu.cpp +++ b/examples/watch_imu.cpp @@ -1,14 +1,9 @@ #include "example_utils.hpp" -#include -#include -#include - #include #include #include -#include #include #include @@ -19,20 +14,20 @@ mip::data_sensor::ScaledAccel scaled_accel; -void handlePacket(void*, const mip::PacketRef& packet, mip::Timestamp timestamp) +void handlePacket(void*, const mip::PacketView& packet, mip::Timestamp) { // if(packet.descriptorSet() != mip::MIP_SENSOR_DATA_DESC_SET) // return; printf("\nGot packet with descriptor set 0x%02X:", packet.descriptorSet()); - for(mip::Field field : packet) + for(mip::FieldView field : packet) printf(" %02X", field.fieldDescriptor()); printf("\n"); } -void handleAccel(void*, const mip::Field& field, mip::Timestamp timestamp) +void handleAccel(void*, const mip::FieldView& field, mip::Timestamp) { mip::data_sensor::ScaledAccel data; @@ -48,18 +43,18 @@ void handleAccel(void*, const mip::Field& field, mip::Timestamp timestamp) } } -void handleGyro(void*, const mip::data_sensor::ScaledGyro& data, mip::Timestamp timestamp) +void handleGyro(void*, const mip::data_sensor::ScaledGyro& data, mip::Timestamp) { printf("Gyro Data: %f, %f, %f\n", data.scaled_gyro[0], data.scaled_gyro[1], data.scaled_gyro[2]); } -void handleMag(void*, const mip::data_sensor::ScaledMag& data, mip::Timestamp timestamp) +void handleMag(void*, const mip::data_sensor::ScaledMag& data, mip::Timestamp) { printf("Mag Data: %f, %f, %f\n", data.scaled_mag[0], data.scaled_mag[1], data.scaled_mag[2]); } -int run(mip::DeviceInterface& device) +int run(mip::Interface& device) { mip::CmdResult result; @@ -82,13 +77,13 @@ int run(mip::DeviceInterface& device) { mip::data_sensor::DATA_MAG_SCALED, decimation }, }}; - result = mip::commands_3dm::writeMessageFormat(device, mip::data_sensor::DESCRIPTOR_SET, descriptors.size(), descriptors.data()); + result = mip::commands_3dm::writeMessageFormat(device, mip::data_sensor::DESCRIPTOR_SET, static_cast(descriptors.size()), descriptors.data()); if( result == mip::CmdResult::NACK_COMMAND_FAILED ) { // Failed to set message format - maybe this device doesn't have a magnetometer. // Try again without the last descriptor (scaled mag). - result = mip::commands_3dm::writeMessageFormat(device, mip::data_sensor::DESCRIPTOR_SET, descriptors.size()-1, descriptors.data()); + result = mip::commands_3dm::writeMessageFormat(device, mip::data_sensor::DESCRIPTOR_SET, static_cast(descriptors.size()-1), descriptors.data()); } if( result != mip::CmdResult::ACK_OK ) return fprintf(stderr, "Failed to set message format: %s (%d)\n", result.name(), result.value), 1; @@ -139,7 +134,7 @@ int main(int argc, const char* argv[]) { utils = handleCommonArgs(argc, argv); } - catch(const std::underflow_error& ex) + catch(const std::underflow_error&) { return printCommonUsage(argv); } diff --git a/src/c/microstrain/CMakeLists.txt b/src/c/microstrain/CMakeLists.txt new file mode 100644 index 000000000..f4f9df9ca --- /dev/null +++ b/src/c/microstrain/CMakeLists.txt @@ -0,0 +1,4 @@ +add_subdirectory(common) +add_subdirectory(connections) + +set(MICROSTRAIN_LIBRARIES_TMP ${MICROSTRAIN_LIBRARIES_TMP} PARENT_SCOPE) diff --git a/src/c/microstrain/common/CMakeLists.txt b/src/c/microstrain/common/CMakeLists.txt new file mode 100644 index 000000000..636332629 --- /dev/null +++ b/src/c/microstrain/common/CMakeLists.txt @@ -0,0 +1,43 @@ +set(MICROSTRAIN_COMMON_LIBRARY "microstrain_common" CACHE INTERNAL "Name of the common MicroStrain library") +mark_as_advanced(MICROSTRAIN_COMMON_LIBRARY) + +#option(MICROSTRAIN_ENABLE_LOGGING "Build with logging functions enabled" ON) +set(MICROSTRAIN_LOGGING_MAX_LEVEL "MICROSTRAIN_LOG_LEVEL_WARN" CACHE STRING "Max log level the SDK is allowed to log. If this is defined, any call to logging functions with a higher level than this will be compiled out.") +set(MICROSTRAIN_TIMESTAMP_TYPE "uint64_t" CACHE STRING "Override the type used for received data timestamps and timeouts (must be unsigned or at least 64 bits).") + +add_library(${MICROSTRAIN_COMMON_LIBRARY} + "${CMAKE_CURRENT_LIST_DIR}/logging.h" + "${CMAKE_CURRENT_LIST_DIR}/platform.h" + "${CMAKE_CURRENT_LIST_DIR}/serialization.c" + "${CMAKE_CURRENT_LIST_DIR}/serialization.h" +) + +target_compile_features(${MICROSTRAIN_COMMON_LIBRARY} PUBLIC c_std_11) + +target_compile_definitions(${MICROSTRAIN_COMMON_LIBRARY} + PUBLIC "MICROSTRAIN_TIMESTAMP_TYPE=${MICROSTRAIN_TIMESTAMP_TYPE}" + PRIVATE ${MICROSTRAIN_PRIVATE_COMPILE_DEFINITIONS} +) + +target_compile_options(${MICROSTRAIN_COMMON_LIBRARY} PRIVATE ${MICROSTRAIN_PRIVATE_COMPILE_OPTIONS}) + +# Logging is a little weird since we need to install the header no matter what +if(MICROSTRAIN_ENABLE_LOGGING) + if(MICROSTRAIN_LOGGING_MAX_LEVEL STREQUAL "") + message(FATAL_ERROR "MICROSTRAIN_LOGGING_MAX_LEVEL must be MICROSTRAIN_LOG_LEVEL_* or a number") + endif() + target_sources(${MICROSTRAIN_COMMON_LIBRARY} PRIVATE "${CMAKE_CURRENT_LIST_DIR}/logging.c") + message("MicroStrain logging is enabled. Max level = '${MICROSTRAIN_LOGGING_MAX_LEVEL}'") + target_compile_definitions(${MICROSTRAIN_COMMON_LIBRARY} PUBLIC "MICROSTRAIN_ENABLE_LOGGING" "MICROSTRAIN_LOGGING_MAX_LEVEL=${MICROSTRAIN_LOGGING_MAX_LEVEL}") +endif() + +target_include_directories(${MICROSTRAIN_COMMON_LIBRARY} INTERFACE ${MICROSTRAIN_SRC_C_DIR}) + +set(MICROSTRAIN_LIBRARIES_TMP ${MICROSTRAIN_LIBRARIES_TMP} ${MICROSTRAIN_COMMON_LIBRARY} PARENT_SCOPE) + +# +# Installation +# + +include(microstrain_utilities) +microstrain_setup_library_install(${MICROSTRAIN_COMMON_LIBRARY} ${MICROSTRAIN_SRC_DIR}) diff --git a/src/c/microstrain/common/embedded_time.h b/src/c/microstrain/common/embedded_time.h new file mode 100644 index 000000000..06ae4b3dd --- /dev/null +++ b/src/c/microstrain/common/embedded_time.h @@ -0,0 +1,41 @@ + +#include "platform.h" + +#include + + +#ifdef __cplusplus +namespace microstrain { +namespace C { +#else +#include +#endif + +///@brief Type used for packet timestamps and timeouts. +/// +/// Timestamps must be monotonic except for overflow at the maximum value back to 0. +/// The units can be anything, but typically are milliseconds. Choose a long enough +/// unit so that consecutive calls to the parser will not exceed half of the maximum +/// value for this type. For milliseconds, the time to overflow is approximately 50 +/// days, so the parser should be invoked at least every 25 days. Failure to observe +/// this requirement may result in false timeouts or delays in getting parsed packets. +/// +#ifdef MICROSTRAIN_TIMESTAMP_TYPE +typedef MICROSTRAIN_TIMESTAMP_TYPE microstrain_embedded_timestamp; +static_assert( sizeof(microstrain_embedded_timestamp) >= 8 || (microstrain_embedded_timestamp)(-1) > 0, "MICROSTRAIN_TIMESTAMP_TYPE must be unsigned unless 64 bits."); + +#elif defined(MICROSTRAIN_PLATFORM_DESKTOP) +// By default, on desktop we use 64-bit timestamps. +typedef uint64_t microstrain_embedded_timestamp; +#else +// If the platform isn't known, assume u32 timestamps. +typedef uint32_t microstrain_embedded_timestamp; +#endif + +// Timeouts are just an alias for timestamps +typedef microstrain_embedded_timestamp microstrain_embedded_timeout; + +#ifdef __cplusplus +} // namespace C +} // namespace microstrain +#endif // __cplusplus diff --git a/src/mip/mip_logging.c b/src/c/microstrain/common/logging.c similarity index 53% rename from src/mip/mip_logging.c rename to src/c/microstrain/common/logging.c index 23592293a..4f4f4c20c 100644 --- a/src/mip/mip_logging.c +++ b/src/c/microstrain/common/logging.c @@ -1,34 +1,34 @@ -#include "mip_logging.h" +#include "logging.h" #include //////////////////////////////////////////////////////////////////////////////// ///@brief Global logging callback. Do not access directly -mip_log_callback mip_log_callback_ = NULL; +microstrain_log_callback microstrain_log_callback_ = NULL; //////////////////////////////////////////////////////////////////////////////// ///@brief Global logging level. Do not access directly -mip_log_level mip_log_level_ = MIP_LOG_LEVEL_OFF; +microstrain_log_level microstrain_log_level_ = MICROSTRAIN_LOG_LEVEL_OFF; //////////////////////////////////////////////////////////////////////////////// ///@brief Global logging user data. Do not access directly -void* mip_log_user_data_ = NULL; +void* microstrain_log_user_data_ = NULL; //////////////////////////////////////////////////////////////////////////////// ///@brief Initializes the logger with a callback and user data. -/// Call MIP_LOG_INIT instead of using this function directly. +/// Call MICROSTRAIN_LOG_INIT instead of using this function directly. /// This function does not have to be called unless the user wants logging /// ///@param callback The callback to execute when there is data to log -///@param level The level that the MIP SDK should log at +///@param level The level that the MicroStrain SDK should log at ///@param user User data that will be passed to the callback every time it is excuted /// -void mip_logging_init(mip_log_callback callback, mip_log_level level, void* user) +void microstrain_logging_init(microstrain_log_callback callback, microstrain_log_level level, void* user) { - mip_log_callback_ = callback; - mip_log_level_ = level; - mip_log_user_data_ = user; + microstrain_log_callback_ = callback; + microstrain_log_level_ = level; + microstrain_log_user_data_ = user; } //////////////////////////////////////////////////////////////////////////////// @@ -36,9 +36,9 @@ void mip_logging_init(mip_log_callback callback, mip_log_level level, void* user /// ///@return The currently active logging callback /// -mip_log_callback mip_logging_callback() +microstrain_log_callback microstrain_logging_callback(void) { - return mip_log_callback_; + return microstrain_log_callback_; } //////////////////////////////////////////////////////////////////////////////// @@ -46,9 +46,9 @@ mip_log_callback mip_logging_callback() /// ///@return The currently active logging level /// -mip_log_level mip_logging_level() +microstrain_log_level microstrain_logging_level(void) { - return mip_log_level_; + return microstrain_log_level_; } //////////////////////////////////////////////////////////////////////////////// @@ -56,25 +56,24 @@ mip_log_level mip_logging_level() /// ///@return The currently active logging user data /// -void* mip_logging_user_data() +void* microstrain_logging_user_data(void) { - return mip_log_user_data_; + return microstrain_log_user_data_; } //////////////////////////////////////////////////////////////////////////////// ///@brief Internal log function called by logging macros. -/// Call MIP_LOG_* macros instead of using this function directly -///@copydetails mip::C::mip_log_callback +/// Call MICROSTRAIN_LOG_* macros instead of using this function directly +///@copydetails microstrain::C::microstrain_log_callback /// -void mip_logging_log(mip_log_level level, const char* fmt, ...) +void microstrain_logging_log(microstrain_log_level level, const char* fmt, ...) { - const mip_log_callback logging_callback = mip_logging_callback(); - const mip_log_level logging_level = mip_logging_level(); - if (logging_callback != NULL && logging_level >= level) - { - va_list args; - va_start(args, fmt); - logging_callback(mip_logging_user_data(), level, fmt, args); - va_end(args); - } + const microstrain_log_callback callback = microstrain_logging_callback(); + if(callback != NULL && microstrain_logging_level() >= level) + { + va_list args; + va_start(args, fmt); + callback(microstrain_logging_user_data(), level, fmt, args); + va_end(args); + } } \ No newline at end of file diff --git a/src/c/microstrain/common/logging.h b/src/c/microstrain/common/logging.h new file mode 100644 index 000000000..986be635a --- /dev/null +++ b/src/c/microstrain/common/logging.h @@ -0,0 +1,145 @@ +#pragma once + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//////////////////////////////////////////////////////////////////////////////// +///@addtogroup microstrain_c +///@{ +//////////////////////////////////////////////////////////////////////////////// +///@defgroup microstrain_logging MicroStrain Logging [C] +/// +///@brief High-level C functions for logging information from within the MicroStrain SDK +/// +/// This module contains functions that allow the MicroStrain SDK to log information +/// and allows users to override the logging functions +/// +///@{ + +//////////////////////////////////////////////////////////////////////////////// +///@brief Logging level enum +/// +typedef uint8_t microstrain_log_level; +#define MICROSTRAIN_LOG_LEVEL_OFF 0 ///< Signifies that the log is turned off +#define MICROSTRAIN_LOG_LEVEL_FATAL 1 ///< Fatal logs are logged when an unrecoverable error occurs +#define MICROSTRAIN_LOG_LEVEL_ERROR 2 ///< Error logs are logged when an error occurs +#define MICROSTRAIN_LOG_LEVEL_WARN 3 ///< Warning logs are logged when something concerning happens that may or not be a mistake +#define MICROSTRAIN_LOG_LEVEL_INFO 4 ///< Info logs are logged when some general info needs to be conveyed to the user +#define MICROSTRAIN_LOG_LEVEL_DEBUG 5 ///< Debug logs are logged for debug purposes. +#define MICROSTRAIN_LOG_LEVEL_TRACE 6 ///< Trace logs are logged in similar cases to debug logs but can be logged in tight loops + +//////////////////////////////////////////////////////////////////////////////// +///@brief Callback function typedef for custom logging behavior. +/// +///@param level The log level that this log should be logged at +///@param fmt printf style format string +///@param ... Variadic args used to populate the fmt string +/// +typedef void (*microstrain_log_callback)(void* user, microstrain_log_level level, const char* fmt, va_list args); + +void microstrain_logging_init(microstrain_log_callback callback, microstrain_log_level level, void* user); + +microstrain_log_callback microstrain_logging_callback(void); +microstrain_log_level microstrain_logging_level(void); +void* microstrain_logging_user_data(void); + +void microstrain_logging_log(microstrain_log_level level, const char* fmt, ...); + +//////////////////////////////////////////////////////////////////////////////// +///@brief Helper macro used to initialize the MicroStrain logger. +/// This function does not need to be called unless the user wants logging +/// +///@param callback The callback to execute when there is data to log +///@param level The level that the MicroStrain SDK should log at +///@param user User data that will be passed to the callback every time it is excuted +/// +#ifdef MICROSTRAIN_ENABLE_LOGGING +#define MICROSTRAIN_LOG_INIT(callback, level, user) microstrain_logging_init(callback, level, user) +#else +#define MICROSTRAIN_LOG_INIT(callback, level, user) (void)0 +#endif + +//////////////////////////////////////////////////////////////////////////////// +///@brief Helper macro used to log data inside the MicroStrain SDK. Prefer specific +/// log level functions like MICROSTRAIN_LOG_INFO, etc. when possible. +///@copydetails microstrain_log_callback +/// +#ifdef MICROSTRAIN_ENABLE_LOGGING +#define MICROSTRAIN_LOG_LOG(level, ...) microstrain_logging_log(level, __VA_ARGS__) +#else +#define MICROSTRAIN_LOG_LOG(level, ...) (void)0 +#endif + +#ifndef MICROSTRAIN_LOGGING_MAX_LEVEL +#define MICROSTRAIN_LOGGING_MAX_LEVEL MICROSTRAIN_LOG_LEVEL_WARN +#endif + +//////////////////////////////////////////////////////////////////////////////// +///@brief Helper macro used to log data inside the MicroStrain SDK at fatal level +/// +///@param context Context of what called this function. Could be a mip device, serial connection, etc. +///@param fmt printf style format string +///@param ... Variadic args used to populate the fmt string +/// +#if MICROSTRAIN_LOGGING_MAX_LEVEL >= MICROSTRAIN_LOG_LEVEL_FATAL +#define MICROSTRAIN_LOG_FATAL(...) MICROSTRAIN_LOG_LOG(MICROSTRAIN_LOG_LEVEL_FATAL, __VA_ARGS__) +#else +#define MICROSTRAIN_LOG_FATAL(...) (void)0 +#endif + +//////////////////////////////////////////////////////////////////////////////// +///@brief Helper macro used to log data inside the MicroStrain SDK at error level +///@copydetails MICROSTRAIN_LOG_FATAL +#if MICROSTRAIN_LOGGING_MAX_LEVEL >= MICROSTRAIN_LOG_LEVEL_ERROR +#define MICROSTRAIN_LOG_ERROR(...) MICROSTRAIN_LOG_LOG(MICROSTRAIN_LOG_LEVEL_ERROR, __VA_ARGS__) +#else +#define MICROSTRAIN_LOG_ERROR(...) (void)0 +#endif + +//////////////////////////////////////////////////////////////////////////////// +///@brief Helper macro used to log data inside the MicroStrain SDK at warn level +///@copydetails MICROSTRAIN_LOG_FATAL +#if MICROSTRAIN_LOGGING_MAX_LEVEL >= MICROSTRAIN_LOG_LEVEL_WARN +#define MICROSTRAIN_LOG_WARN(...) MICROSTRAIN_LOG_LOG(MICROSTRAIN_LOG_LEVEL_WARN, __VA_ARGS__) +#else +#define MICROSTRAIN_LOG_WARN(...) (void)0 +#endif + +//////////////////////////////////////////////////////////////////////////////// +///@brief Helper macro used to log data inside the MicroStrain SDK at info level +///@copydetails MICROSTRAIN_LOG_FATAL +#if MICROSTRAIN_LOGGING_MAX_LEVEL >= MICROSTRAIN_LOG_LEVEL_INFO +#define MICROSTRAIN_LOG_INFO(...) MICROSTRAIN_LOG_LOG(MICROSTRAIN_LOG_LEVEL_INFO, __VA_ARGS__) +#else +#define MICROSTRAIN_LOG_INFO(...) (void)0 +#endif + +//////////////////////////////////////////////////////////////////////////////// +///@brief Helper macro used to log data inside the MicroStrain SDK at debug level +///@copydetails MICROSTRAIN_LOG_FATAL +#if MICROSTRAIN_LOGGING_MAX_LEVEL >= MICROSTRAIN_LOG_LEVEL_DEBUG +#define MICROSTRAIN_LOG_DEBUG(...) MICROSTRAIN_LOG_LOG(MICROSTRAIN_LOG_LEVEL_DEBUG, __VA_ARGS__) +#else +#define MICROSTRAIN_LOG_DEBUG(...) (void)0 +#endif + +//////////////////////////////////////////////////////////////////////////////// +///@brief Helper macro used to log data inside the MicroStrain SDK at trace level +///@copydetails MICROSTRAIN_LOG_FATAL +#if MICROSTRAIN_LOGGING_MAX_LEVEL >= MICROSTRAIN_LOG_LEVEL_TRACE +#define MICROSTRAIN_LOG_TRACE(...) MICROSTRAIN_LOG_LOG(MICROSTRAIN_LOG_LEVEL_TRACE, __VA_ARGS__) +#else +#define MICROSTRAIN_LOG_TRACE(...) (void)0 +#endif + +///@} +///@} +//////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/src/c/microstrain/common/platform.h b/src/c/microstrain/common/platform.h new file mode 100644 index 000000000..e63f60c58 --- /dev/null +++ b/src/c/microstrain/common/platform.h @@ -0,0 +1,14 @@ +#pragma once + +#if defined _WIN32 +#define MICROSTRAIN_PLATFORM_WINDOWS +#define MICROSTRAIN_PLATFORM_DESKTOP +#elif defined __APPLE__ +#define MICROSTRAIN_PLATFORM_APPLE +#define MICROSTRAIN_PLATFORM_DESKTOP +#elif defined __linux__ +#define MICROSTRAIN_PLATFORM_LINUX +#define MICROSTRAIN_PLATFORM_DESKTOP +#else +#define MICROSTRAIN_PLATFORM_OTHER +#endif diff --git a/src/mip/utils/serialization.c b/src/c/microstrain/common/serialization.c similarity index 57% rename from src/mip/utils/serialization.c rename to src/c/microstrain/common/serialization.c index 96cef9bce..d55a5b3e7 100644 --- a/src/mip/utils/serialization.c +++ b/src/c/microstrain/common/serialization.c @@ -1,15 +1,5 @@ #include "serialization.h" -#include "../mip_field.h" -#include "../mip_packet.h" -#include "../mip_offsets.h" - -#include -#include - -#ifdef __cplusplus -namespace mip { -#endif //////////////////////////////////////////////////////////////////////////////// @@ -21,7 +11,7 @@ namespace mip { ///@param buffer_size /// Size of the buffer. Data will not be written beyond this size. /// -void mip_serializer_init_insertion(mip_serializer* serializer, uint8_t* buffer, size_t buffer_size) +void microstrain_serializer_init_insertion(microstrain_serializer* serializer, uint8_t* buffer, size_t buffer_size) { serializer->_buffer = buffer; serializer->_buffer_size = buffer_size; @@ -37,74 +27,13 @@ void mip_serializer_init_insertion(mip_serializer* serializer, uint8_t* buffer, ///@param buffer_size /// Maximum number of bytes to be read from the buffer. /// -void mip_serializer_init_extraction(mip_serializer* serializer, const uint8_t* buffer, size_t buffer_size) +void microstrain_serializer_init_extraction(microstrain_serializer* serializer, const uint8_t* buffer, size_t buffer_size) { serializer->_buffer = (uint8_t*)buffer; serializer->_buffer_size = buffer_size; serializer->_offset = 0; } -//////////////////////////////////////////////////////////////////////////////// -///@brief Initializer a serialization struct for creation of a new field at the -/// end of the packet. -/// -///@note Call mip_serializer_finiish_new_field after the data has been serialized. -/// -///@note Only one new field per packet can be in progress at a time. -/// -///@param serializer -///@param packet -/// Allocate the new field on the end of this packet. -///@param field_descriptor -/// Field descriptor of the new field. -/// -void mip_serializer_init_new_field(mip_serializer* serializer, mip_packet* packet, uint8_t field_descriptor) -{ - assert(packet); - - serializer->_buffer = NULL; - serializer->_buffer_size = 0; - serializer->_offset = 0; - - const int length = mip_packet_alloc_field(packet, field_descriptor, 0, &serializer->_buffer); - - if( length >= 0 ) - serializer->_buffer_size = length; -} - -//////////////////////////////////////////////////////////////////////////////// -///@brief Call this after a new field allocated by mip_serializer_init_new_field -/// has been written. -/// -/// This will either finish the field, or abort it if the serializer failed. -/// -///@param serializer Must be created from mip_serializer_init_new_field. -///@param packet Must be the original packet. -/// -void mip_serializer_finish_new_field(const mip_serializer* serializer, mip_packet* packet) -{ - assert(packet); - - if( mip_serializer_is_ok(serializer) ) - { - assert(serializer->_offset <= MIP_FIELD_LENGTH_MAX); // Payload too long! - mip_packet_realloc_last_field(packet, serializer->_buffer, (uint8_t) serializer->_offset); - } - else if( serializer->_buffer ) - mip_packet_cancel_last_field(packet, serializer->_buffer); -} - -//////////////////////////////////////////////////////////////////////////////// -///@brief Initialize a serialization struct from a MIP field payload. -/// -///@param serializer -///@param field -/// -void mip_serializer_init_from_field(mip_serializer* serializer, const mip_field* field) -{ - mip_serializer_init_extraction(serializer, mip_field_payload(field), mip_field_payload_length(field)); -} - //////////////////////////////////////////////////////////////////////////////// ///@brief Determines the total length the buffer. /// @@ -112,7 +41,7 @@ void mip_serializer_init_from_field(mip_serializer* serializer, const mip_field* /// ///@returns The buffer size. /// -size_t mip_serializer_capacity(const mip_serializer* serializer) +size_t microstrain_serializer_capacity(const microstrain_serializer* serializer) { return serializer->_buffer_size; } @@ -125,10 +54,10 @@ size_t mip_serializer_capacity(const mip_serializer* serializer) /// For insertion, returns how many bytes have been written. /// For extraction, returns how many bytes have been read. /// -///@note This may exceed the buffer size. Check mip_serializer_is_ok() before using +///@note This may exceed the buffer size. Check microstrain_serializer_is_ok() before using /// the data. /// -size_t mip_serializer_length(const mip_serializer* serializer) +size_t microstrain_serializer_length(const microstrain_serializer* serializer) { return serializer->_offset; } @@ -143,11 +72,11 @@ size_t mip_serializer_length(const mip_serializer* serializer) /// ///@note This can be a negative number if the application attempted to write /// or read more data than contained in the buffer. This is not a bug and -/// it can be detected with the mip_serializer_is_ok() function. +/// it can be detected with the microstrain_serializer_is_ok() function. /// -int mip_serializer_remaining(const mip_serializer* serializer) +int microstrain_serializer_remaining(const microstrain_serializer* serializer) { - return (int)(mip_serializer_capacity(serializer) - mip_serializer_length(serializer)); + return (int)(microstrain_serializer_capacity(serializer) - microstrain_serializer_length(serializer)); } //////////////////////////////////////////////////////////////////////////////// @@ -160,11 +89,11 @@ int mip_serializer_remaining(const mip_serializer* serializer) /// ///@param serializer /// -///@returns true if mip_serializer_remaining() >= 0. +///@returns true if microstrain_serializer_remaining() >= 0. /// -bool mip_serializer_is_ok(const mip_serializer* serializer) +bool microstrain_serializer_is_ok(const microstrain_serializer* serializer) { - return mip_serializer_length(serializer) <= mip_serializer_capacity(serializer); + return microstrain_serializer_length(serializer) <= microstrain_serializer_capacity(serializer); } //////////////////////////////////////////////////////////////////////////////// @@ -175,9 +104,9 @@ bool mip_serializer_is_ok(const mip_serializer* serializer) /// ///@param serializer /// -///@returns true if mip_serializer_remaining() == 0. +///@returns true if microstrain_serializer_remaining() == 0. /// -bool mip_serializer_is_complete(const mip_serializer* serializer) +bool microstrain_serializer_is_complete(const microstrain_serializer* serializer) { return serializer->_offset == serializer->_buffer_size; } @@ -190,7 +119,7 @@ static void pack(uint8_t* buffer, const void* value, size_t size) } #define INSERT_MACRO(name, type) \ -void insert_##name(mip_serializer* serializer, type value) \ +void microstrain_insert_##name(microstrain_serializer* serializer, type value) \ { \ const size_t offset = serializer->_offset + sizeof(type); \ if( offset <= serializer->_buffer_size ) \ @@ -221,7 +150,7 @@ static void unpack(const uint8_t* buffer, void* value, size_t size) #define EXTRACT_MACRO(name, type) \ -void extract_##name(mip_serializer* serializer, type* value) \ +void microstrain_extract_##name(microstrain_serializer* serializer, type* value) \ { \ const size_t offset = serializer->_offset + sizeof(type); \ if( offset <= serializer->_buffer_size ) \ @@ -244,7 +173,7 @@ EXTRACT_MACRO(double, double ) //////////////////////////////////////////////////////////////////////////////// -///@brief Similar to extract_u8 but allows a maximum value to be specified. +///@brief Similar to microstrain_extract_u8 but allows a maximum value to be specified. /// /// If the maximum count would be exceeded, an error is generated which causes /// further extraction to fail. @@ -254,12 +183,12 @@ EXTRACT_MACRO(double, double ) /// The counter value read from the buffer. ///@param max_count /// The maximum value of the counter. If the count exceeds this, it is -/// set to 0 and the serializer is put into an error state. +/// set to 0 and the serializer is insert into an error state. /// -void extract_count(mip_serializer* serializer, uint8_t* count_out, uint8_t max_count) +void microstrain_extract_count(microstrain_serializer* serializer, uint8_t* count_out, uint8_t max_count) { *count_out = 0; // Default to zero if extraction fails. - extract_u8(serializer, count_out); + microstrain_extract_u8(serializer, count_out); if( *count_out > max_count ) { // This is an error condition which can occur if the device sends @@ -272,7 +201,3 @@ void extract_count(mip_serializer* serializer, uint8_t* count_out, uint8_t max_c serializer->_offset = SIZE_MAX; } } - -#ifdef __cplusplus -} // namespace mip -#endif diff --git a/src/c/microstrain/common/serialization.h b/src/c/microstrain/common/serialization.h new file mode 100644 index 000000000..01fc1f36f --- /dev/null +++ b/src/c/microstrain/common/serialization.h @@ -0,0 +1,104 @@ +#pragma once + +#include +#include +#include + +//////////////////////////////////////////////////////////////////////////////// +///@defgroup microstrain_serialization MicroStrain Serialization +/// +///@brief Serialization functions for reading and writing to byte buffers. +///@{ +///@defgroup microstrain_serialization_c MicroStrain Serialization [C] +///@defgroup microstrain_serialization_cpp MicroStrain Serialization [CPP] +///@} + +#ifdef __cplusplus +#include + +namespace microstrain { +namespace C { +extern "C" { +#endif // __cplusplus + + + +//////////////////////////////////////////////////////////////////////////////// +///@addtogroup microstrain_serialization_c +/// +///@brief (De)serialization in C. +/// +///@{ + + +//////////////////////////////////////////////////////////////////////////////// +///@brief Structure used for serialization. +/// +///@note This should be considered an "opaque" structure; its members should be +/// considered an internal implementation detail. Avoid accessing them directly +/// as they are subject to change in future versions of this software. +/// +/// +typedef struct microstrain_serializer +{ + uint8_t* _buffer; ///<@private Pointer to data for serialization. + size_t _buffer_size; ///<@private Size of the buffer. + size_t _offset; ///<@private Current offset into the buffer (can exceed buffer_size!). +} microstrain_serializer; + +void microstrain_serializer_init_insertion(microstrain_serializer* serializer, uint8_t* buffer, size_t buffer_size); +void microstrain_serializer_init_extraction(microstrain_serializer* serializer, const uint8_t* buffer, size_t buffer_size); + +size_t microstrain_serializer_capacity(const microstrain_serializer* serializer); +size_t microstrain_serializer_length(const microstrain_serializer* serializer); +int microstrain_serializer_remaining(const microstrain_serializer* serializer); + +bool microstrain_serializer_is_ok(const microstrain_serializer* serializer); +bool microstrain_serializer_is_complete(const microstrain_serializer* serializer); + + +void microstrain_insert_bool(microstrain_serializer* serializer, bool value); +void microstrain_insert_char(microstrain_serializer* serializer, char value); + +void microstrain_insert_u8 (microstrain_serializer* serializer, uint8_t value); +void microstrain_insert_u16(microstrain_serializer* serializer, uint16_t value); +void microstrain_insert_u32(microstrain_serializer* serializer, uint32_t value); +void microstrain_insert_u64(microstrain_serializer* serializer, uint64_t value); + +void microstrain_insert_s8 (microstrain_serializer* serializer, int8_t value); +void microstrain_insert_s16(microstrain_serializer* serializer, int16_t value); +void microstrain_insert_s32(microstrain_serializer* serializer, int32_t value); +void microstrain_insert_s64(microstrain_serializer* serializer, int64_t value); + +void microstrain_insert_float(microstrain_serializer* serializer, float value); +void microstrain_insert_double(microstrain_serializer* serializer, double value); + + +void microstrain_extract_bool(microstrain_serializer* serializer, bool* value); +void microstrain_extract_char(microstrain_serializer* serializer, char* value); + +void microstrain_extract_u8 (microstrain_serializer* serializer, uint8_t* value); +void microstrain_extract_u16(microstrain_serializer* serializer, uint16_t* value); +void microstrain_extract_u32(microstrain_serializer* serializer, uint32_t* value); +void microstrain_extract_u64(microstrain_serializer* serializer, uint64_t* value); + +void microstrain_extract_s8 (microstrain_serializer* serializer, int8_t* value); +void microstrain_extract_s16(microstrain_serializer* serializer, int16_t* value); +void microstrain_extract_s32(microstrain_serializer* serializer, int32_t* value); +void microstrain_extract_s64(microstrain_serializer* serializer, int64_t* value); + +void microstrain_extract_float (microstrain_serializer* serializer, float* value); +void microstrain_extract_double(microstrain_serializer* serializer, double* value); + +void microstrain_extract_count(microstrain_serializer* serializer, uint8_t* count_out, uint8_t max_count); + +///@} +//////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} // extern "C" +} // namespace C +} // namespace microstrain +#endif // __cplusplus + +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/c/microstrain/connections/CMakeLists.txt b/src/c/microstrain/connections/CMakeLists.txt new file mode 100644 index 000000000..6809db709 --- /dev/null +++ b/src/c/microstrain/connections/CMakeLists.txt @@ -0,0 +1,9 @@ +if(MICROSTRAIN_ENABLE_SERIAL) + add_subdirectory(serial) +endif() + +if(MICROSTRAIN_ENABLE_TCP) + add_subdirectory(tcp) +endif() + +set(MICROSTRAIN_LIBRARIES_TMP ${MICROSTRAIN_LIBRARIES_TMP} PARENT_SCOPE) diff --git a/src/c/microstrain/connections/microstrain_connections_all.h b/src/c/microstrain/connections/microstrain_connections_all.h new file mode 100644 index 000000000..72c3046b8 --- /dev/null +++ b/src/c/microstrain/connections/microstrain_connections_all.h @@ -0,0 +1,5 @@ +#pragma once + +// MicroStrain Connections +#include "serial/serial_port.h" +#include "tcp/tcp_socket.h" diff --git a/src/c/microstrain/connections/serial/CMakeLists.txt b/src/c/microstrain/connections/serial/CMakeLists.txt new file mode 100644 index 000000000..40293fe01 --- /dev/null +++ b/src/c/microstrain/connections/serial/CMakeLists.txt @@ -0,0 +1,27 @@ +set(MICROSTRAIN_SERIAL_LIBRARY "microstrain_serial" CACHE INTERNAL "Name of the MicroStrain serial connections library") +mark_as_advanced(MICROSTRAIN_SERIAL_LIBRARY) + +add_library(${MICROSTRAIN_SERIAL_LIBRARY} + "${CMAKE_CURRENT_LIST_DIR}/serial_port.h" + "${CMAKE_CURRENT_LIST_DIR}/serial_port.c" +) + +target_compile_features(${MICROSTRAIN_SERIAL_LIBRARY} PUBLIC c_std_11) + +target_link_libraries(${MICROSTRAIN_SERIAL_LIBRARY} PUBLIC ${MICROSTRAIN_COMMON_LIBRARY}) + +target_compile_definitions(${MICROSTRAIN_SERIAL_LIBRARY} + PUBLIC "MICROSTRAIN_ENABLE_SERIAL=1" + PRIVATE ${MICROSTRAIN_PRIVATE_COMPILE_DEFINITIONS} +) + +target_compile_options(${MICROSTRAIN_SERIAL_LIBRARY} PRIVATE ${MICROSTRAIN_PRIVATE_COMPILE_OPTIONS}) + +set(MICROSTRAIN_LIBRARIES_TMP ${MICROSTRAIN_LIBRARIES_TMP} ${MICROSTRAIN_SERIAL_LIBRARY} PARENT_SCOPE) + +# +# Installation +# + +include(microstrain_utilities) +microstrain_setup_library_install(${MICROSTRAIN_SERIAL_LIBRARY} ${MICROSTRAIN_SRC_DIR}) diff --git a/src/mip/utils/serial_port.c b/src/c/microstrain/connections/serial/serial_port.c similarity index 80% rename from src/mip/utils/serial_port.c rename to src/c/microstrain/connections/serial/serial_port.c index bffa9a829..534d0ac91 100644 --- a/src/mip/utils/serial_port.c +++ b/src/c/microstrain/connections/serial/serial_port.c @@ -1,19 +1,19 @@ -#include "mip/mip_logging.h" +#include "microstrain/common/logging.h" #include "serial_port.h" -#if defined WIN32 +#if defined MICROSTRAIN_PLATFORM_WINDOWS #include #include -#elif defined __APPLE__ +#elif defined MICROSTRAIN_PLATFORM_APPLE #include #endif #define COM_PORT_BUFFER_SIZE 0x200 -#ifndef WIN32 //Unix only +#if defined MICROSTRAIN_PLATFORM_APPLE || defined MICROSTRAIN_PLATFORM_LINUX #define INVALID_HANDLE_VALUE -1 @@ -33,7 +33,7 @@ speed_t baud_rate_to_speed(int baud_rate) return B115200; case 230400: return B230400; -#ifdef __linux__ //Linux onnly baudrates +#ifdef MICROSTRAIN_PLATFORM_LINUX //Linux onnly baudrates case 460800: return B460800; case 500000: @@ -75,8 +75,8 @@ bool serial_port_open(serial_port *port, const char *port_str, int baudrate) if(port_str == NULL) return false; - MIP_LOG_DEBUG("Opening serial port %s at %d\n", port_str, baudrate); -#ifdef WIN32 + MICROSTRAIN_LOG_DEBUG("Opening serial port %s at %d\n", port_str, baudrate); +#ifdef MICROSTRAIN_PLATFORM_WINDOWS BOOL ready; DCB dcb; @@ -111,21 +111,21 @@ bool serial_port_open(serial_port *port, const char *port_str, int baudrate) // If the port string was modified if (added_prefix) { - free(tmp_port_str); + free((char*)tmp_port_str); tmp_port_str = NULL; } //Check for an invalid handle if(port->handle == INVALID_HANDLE_VALUE) { - MIP_LOG_ERROR("Unable to open com port (%d)\n", last_error); + MICROSTRAIN_LOG_ERROR("Unable to open com port (%d)\n", last_error); return false; } - //Setup the com port buffer sizes + // Set up the com port buffer sizes if(SetupComm(port->handle, COM_PORT_BUFFER_SIZE, COM_PORT_BUFFER_SIZE) == 0) { - MIP_LOG_ERROR("Unable to setup com port buffer size (%d)\n", last_error); + MICROSTRAIN_LOG_ERROR("Unable to setup com port buffer size (%d)\n", last_error); CloseHandle(port->handle); port->handle = INVALID_HANDLE_VALUE; return false; @@ -151,7 +151,7 @@ bool serial_port_open(serial_port *port, const char *port_str, int baudrate) //Close the serial port, mutex, and exit if(!ready) { - MIP_LOG_ERROR("Unable to get com state\n"); + MICROSTRAIN_LOG_ERROR("Unable to get com state\n"); CloseHandle(port->handle); port->handle = INVALID_HANDLE_VALUE; return false; @@ -169,7 +169,7 @@ bool serial_port_open(serial_port *port, const char *port_str, int baudrate) //Close the serial port and exit if(!ready) { - MIP_LOG_ERROR("Unable to set com state\n"); + MICROSTRAIN_LOG_ERROR("Unable to set com state\n"); CloseHandle(port->handle); port->handle = INVALID_HANDLE_VALUE; return false; @@ -186,20 +186,20 @@ bool serial_port_open(serial_port *port, const char *port_str, int baudrate) if (port->handle < 0) { - MIP_LOG_ERROR("Unable to open port (%d): %s\n", errno, strerror(errno)); + MICROSTRAIN_LOG_ERROR("Unable to open port (%d): %s\n", errno, strerror(errno)); return false; } if( ioctl(port->handle, TIOCEXCL) < 0 ) { - MIP_LOG_WARN("Unable to set exclusive mode on serial port (%d): %s\n", errno, strerror(errno)); + MICROSTRAIN_LOG_WARN("Unable to set exclusive mode on serial port (%d): %s\n", errno, strerror(errno)); } // Set up baud rate and other serial device options struct termios serial_port_settings; if (tcgetattr(port->handle, &serial_port_settings) < 0) { - MIP_LOG_ERROR("Unable to get serial port settings (%d): %s\n", errno, strerror(errno)); + MICROSTRAIN_LOG_ERROR("Unable to get serial port settings (%d): %s\n", errno, strerror(errno)); close(port->handle); port->handle = -1; return false; @@ -208,7 +208,7 @@ bool serial_port_open(serial_port *port, const char *port_str, int baudrate) #ifndef __APPLE__ if (cfsetispeed(&serial_port_settings, baud_rate_to_speed(baudrate)) < 0 || cfsetospeed(&serial_port_settings, baud_rate_to_speed(baudrate)) < 0) { - MIP_LOG_ERROR("Unable to set baud rate (%d): %s\n", errno, strerror(errno)); + MICROSTRAIN_LOG_ERROR("Unable to set baud rate (%d): %s\n", errno, strerror(errno)); close(port->handle); port->handle = -1; return false; @@ -228,7 +228,7 @@ bool serial_port_open(serial_port *port, const char *port_str, int baudrate) // Persist the settings if(tcsetattr(port->handle, TCSANOW, &serial_port_settings) < 0) { - MIP_LOG_ERROR("Unable to save serial port settings (%d): %s\n", errno, strerror(errno)); + MICROSTRAIN_LOG_ERROR("Unable to save serial port settings (%d): %s\n", errno, strerror(errno)); close(port->handle); port->handle = -1; return false; @@ -239,7 +239,7 @@ bool serial_port_open(serial_port *port, const char *port_str, int baudrate) speed_t speed = baudrate; if (ioctl(port->handle, IOSSIOSPEED, &speed) < 0) { - MIP_LOG_ERROR("Unable to set baud rate (%d): %s\n", errno, strerror(errno)); + MICROSTRAIN_LOG_ERROR("Unable to set baud rate (%d): %s\n", errno, strerror(errno)); close(port->handle); port->handle = -1; return false; @@ -260,7 +260,7 @@ bool serial_port_close(serial_port *port) if(!serial_port_is_open(port)) return false; -#ifdef WIN32 //Windows +#ifdef MICROSTRAIN_PLATFORM_WINDOWS //Close the serial port CloseHandle(port->handle); #else //Linux & Mac @@ -273,18 +273,17 @@ bool serial_port_close(serial_port *port) bool serial_port_write(serial_port *port, const void *buffer, size_t num_bytes, size_t *bytes_written) { - *bytes_written = 0; //Check for a valid port handle if(!serial_port_is_open(port)) return false; -#ifdef WIN32 //Windows +#ifdef MICROSTRAIN_PLATFORM_WINDOWS DWORD local_bytes_written; //Call the windows write function - if(WriteFile(port->handle, buffer, num_bytes, &local_bytes_written, NULL)) + if(WriteFile(port->handle, buffer, (DWORD)num_bytes, &local_bytes_written, NULL)) { *bytes_written = local_bytes_written; @@ -298,7 +297,7 @@ bool serial_port_write(serial_port *port, const void *buffer, size_t num_bytes, if(*bytes_written == num_bytes) return true; else if(*bytes_written == (size_t)-1) - MIP_LOG_ERROR("Failed to write serial data (%d): %s\n", errno, strerror(errno)); + MICROSTRAIN_LOG_ERROR("Failed to write serial data (%d): %s\n", errno, strerror(errno)); #endif @@ -314,14 +313,14 @@ bool serial_port_read(serial_port *port, void *buffer, size_t num_bytes, int wai if(!serial_port_is_open(port)) return false; -#ifdef WIN32 //Windows +#ifdef MICROSTRAIN_PLATFORM_WINDOWS uint32_t bytes_available = serial_port_read_count(port); DWORD last_error = GetLastError(); if (last_error != 0) { - MIP_LOG_ERROR("Failed to read serial port. Error: %lx\n", last_error); + MICROSTRAIN_LOG_ERROR("Failed to read serial port. Error: %lx\n", last_error); serial_port_close(port); return false; } @@ -339,9 +338,9 @@ bool serial_port_read(serial_port *port, void *buffer, size_t num_bytes, int wai DWORD local_bytes_read; //Call the windows read function - if(!ReadFile(port->handle, buffer, num_bytes, &local_bytes_read, NULL)) + if(!ReadFile(port->handle, buffer, (DWORD)num_bytes, &local_bytes_read, NULL)) return false; - *bytes_read = local_bytes_read; + *bytes_read = (size_t)local_bytes_read; #else //Linux // Poll the device before attempting to read any data, so we will only block for 10ms if there is no data available @@ -351,18 +350,18 @@ bool serial_port_read(serial_port *port, void *buffer, size_t num_bytes, int wai // Keep reading and polling while there is still data available if (poll_status == -1) { - MIP_LOG_ERROR("Failed to poll serial port (%d): %s\n", errno, strerror(errno)); + MICROSTRAIN_LOG_ERROR("Failed to poll serial port (%d): %s\n", errno, strerror(errno)); return false; } else if (poll_fd.revents & POLLHUP) { - MIP_LOG_ERROR("Poll encountered HUP, closing device"); + MICROSTRAIN_LOG_ERROR("Poll encountered HUP, closing device"); serial_port_close(port); return false; } else if (poll_fd.revents & POLLERR || poll_fd.revents & POLLNVAL) { - MIP_LOG_ERROR("Poll encountered error\n"); + MICROSTRAIN_LOG_ERROR("Poll encountered error\n"); return false; } else if (poll_status > 0 && poll_fd.revents & POLLIN) @@ -371,7 +370,7 @@ bool serial_port_read(serial_port *port, void *buffer, size_t num_bytes, int wai if(local_bytes_read == (ssize_t)-1 && errno != EAGAIN) { - MIP_LOG_ERROR("Failed to read serial data (%d): %s\n", errno, strerror(errno)); + MICROSTRAIN_LOG_ERROR("Failed to read serial data (%d): %s\n", errno, strerror(errno)); return false; } if(local_bytes_read >= 0) @@ -387,7 +386,7 @@ bool serial_port_read(serial_port *port, void *buffer, size_t num_bytes, int wai uint32_t serial_port_read_count(serial_port *port) { -#ifdef WIN32 //Windows +#ifdef MICROSTRAIN_PLATFORM_WINDOWS // Clear the last error, if any SetLastError(0); #endif @@ -396,7 +395,7 @@ uint32_t serial_port_read_count(serial_port *port) if(!serial_port_is_open(port)) return 0; -#ifdef WIN32 //Windows +#ifdef MICROSTRAIN_PLATFORM_WINDOWS //Windows COMSTAT com_status; DWORD errors; @@ -418,7 +417,7 @@ uint32_t serial_port_read_count(serial_port *port) bool serial_port_is_open(const serial_port *port) { -#ifdef WIN32 +#ifdef MICROSTRAIN_PLATFORM_WINDOWS return port->handle != INVALID_HANDLE_VALUE; #else return port->handle >= 0; diff --git a/src/mip/utils/serial_port.h b/src/c/microstrain/connections/serial/serial_port.h similarity index 85% rename from src/mip/utils/serial_port.h rename to src/c/microstrain/connections/serial/serial_port.h index a56b0c259..4c5a810f2 100644 --- a/src/mip/utils/serial_port.h +++ b/src/c/microstrain/connections/serial/serial_port.h @@ -1,6 +1,8 @@ #pragma once -#ifdef WIN32 +#include + +#ifdef MICROSTRAIN_PLATFORM_WINDOWS #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif @@ -26,12 +28,12 @@ extern "C" { #endif //////////////////////////////////////////////////////////////////////////////// -///@addtogroup mip_platform Platform specific utilities +///@addtogroup microstrain_platform Platform specific utilities /// ///@{ //////////////////////////////////////////////////////////////////////////////// -///@defgroup mip_serial Serial Port +///@defgroup microstrain_serial Serial Port /// ///@brief A simple implementation for reading and writing to/from a serial port. /// @@ -39,7 +41,7 @@ extern "C" { typedef struct serial_port { -#ifdef WIN32 //Windows +#ifdef MICROSTRAIN_PLATFORM_WINDOWS HANDLE handle; #else //Linux int handle; diff --git a/src/c/microstrain/connections/tcp/CMakeLists.txt b/src/c/microstrain/connections/tcp/CMakeLists.txt new file mode 100644 index 000000000..b0993c131 --- /dev/null +++ b/src/c/microstrain/connections/tcp/CMakeLists.txt @@ -0,0 +1,31 @@ +set(MICROSTRAIN_SOCKET_LIBRARY "microstrain_socket" CACHE INTERNAL "Name of the MicroStrain TCP socket connections library") +mark_as_advanced(MICROSTRAIN_SOCKET_LIBRARY) + +add_library(${MICROSTRAIN_SOCKET_LIBRARY} + "${CMAKE_CURRENT_LIST_DIR}/tcp_socket.h" + "${CMAKE_CURRENT_LIST_DIR}/tcp_socket.c" +) + +target_compile_features(${MICROSTRAIN_SOCKET_LIBRARY} PUBLIC c_std_11) + +target_link_libraries(${MICROSTRAIN_SOCKET_LIBRARY} PUBLIC ${MICROSTRAIN_COMMON_LIBRARY}) + +target_compile_definitions(${MICROSTRAIN_SOCKET_LIBRARY} + PUBLIC "MICROSTRAIN_ENABLE_TCP=1" + PRIVATE ${MICROSTRAIN_PRIVATE_COMPILE_DEFINITIONS} +) + +target_compile_options(${MICROSTRAIN_SOCKET_LIBRARY} PRIVATE ${MICROSTRAIN_PRIVATE_COMPILE_OPTIONS}) + +if(WIN32) + target_link_libraries(${MICROSTRAIN_SOCKET_LIBRARY} PUBLIC "ws2_32") +endif() + +set(MICROSTRAIN_LIBRARIES_TMP ${MICROSTRAIN_LIBRARIES_TMP} ${MICROSTRAIN_SOCKET_LIBRARY} PARENT_SCOPE) + +# +# Installation +# + +include(microstrain_utilities) +microstrain_setup_library_install(${MICROSTRAIN_SOCKET_LIBRARY} ${MICROSTRAIN_SRC_DIR}) diff --git a/src/mip/utils/tcp_socket.c b/src/c/microstrain/connections/tcp/tcp_socket.c similarity index 87% rename from src/mip/utils/tcp_socket.c rename to src/c/microstrain/connections/tcp/tcp_socket.c index 1e4d05734..dc6094d5f 100644 --- a/src/mip/utils/tcp_socket.c +++ b/src/c/microstrain/connections/tcp/tcp_socket.c @@ -1,9 +1,9 @@ #include "tcp_socket.h" -#include "mip/mip_logging.h" +#include "microstrain/common/logging.h" -#ifdef _WIN32 +#ifdef MICROSTRAIN_PLATFORM_WINDOWS #include #include @@ -53,7 +53,7 @@ static bool tcp_socket_open_common(tcp_socket* socket_ptr, const char* hostname, hints.ai_flags = 0; char port_str[6]; // Maximum 5 digits - sprintf(port_str, "%d", port); + snprintf(port_str, sizeof(port_str), "%d", port); int result = getaddrinfo(hostname, port_str, &hints, &info); if( result != 0 ) @@ -65,10 +65,10 @@ static bool tcp_socket_open_common(tcp_socket* socket_ptr, const char* hostname, if( socket_ptr->handle == INVALID_SOCKET ) continue; - if( connect(socket_ptr->handle, addr->ai_addr, addr->ai_addrlen) == 0 ) + if( connect(socket_ptr->handle, addr->ai_addr, (int)addr->ai_addrlen) == 0 ) break; -#ifdef WIN32 +#ifdef MICROSTRAIN_PLATFORM_WINDOWS closesocket(socket_ptr->handle); #else close(socket_ptr->handle); @@ -81,7 +81,7 @@ static bool tcp_socket_open_common(tcp_socket* socket_ptr, const char* hostname, if( socket_ptr->handle == INVALID_SOCKET ) return false; -#ifdef WIN32 +#ifdef MICROSTRAIN_PLATFORM_WINDOWS if( setsockopt(socket_ptr->handle, SOL_SOCKET, SO_RCVTIMEO, (char*)&timeout_ms, sizeof(timeout_ms)) != 0 ) return false; @@ -104,7 +104,7 @@ static bool tcp_socket_open_common(tcp_socket* socket_ptr, const char* hostname, bool tcp_socket_open(tcp_socket* socket_ptr, const char* hostname, uint16_t port, unsigned int timeout_ms) { -#ifdef WIN32 +#ifdef MICROSTRAIN_PLATFORM_WINDOWS // Initialize winsock for each connection since there's no global init function. // This is safe to do multiple times, as long as it's shutdown the same number of times. @@ -112,7 +112,7 @@ bool tcp_socket_open(tcp_socket* socket_ptr, const char* hostname, uint16_t port int result = WSAStartup(MAKEWORD(2,2), &wsaData); if(result != 0) { - MIP_LOG_ERROR("WSAStartup() failed: %d\n", result); + MICROSTRAIN_LOG_ERROR("WSAStartup() failed: %d\n", result); return false; } @@ -126,7 +126,7 @@ bool tcp_socket_close(tcp_socket* socket_ptr) if( socket_ptr->handle == INVALID_SOCKET ) return false; -#ifdef WIN32 +#ifdef MICROSTRAIN_PLATFORM_WINDOWS closesocket(socket_ptr->handle); WSACleanup(); // See tcp_socket_open #else @@ -141,7 +141,7 @@ bool tcp_socket_send(tcp_socket* socket_ptr, const void* buffer, size_t num_byte { for(*bytes_written = 0; *bytes_written < num_bytes; ) { - ssize_t sent = send(socket_ptr->handle, buffer, num_bytes, SEND_FLAGS); + ssize_t sent = send(socket_ptr->handle, buffer, (int)num_bytes, SEND_FLAGS); if(sent < 0) return false; @@ -152,11 +152,11 @@ bool tcp_socket_send(tcp_socket* socket_ptr, const void* buffer, size_t num_byte bool tcp_socket_recv(tcp_socket* socket_ptr, void* buffer, size_t num_bytes, size_t* bytes_read) { - ssize_t local_bytes_read = recv(socket_ptr->handle, buffer, num_bytes, SEND_FLAGS); + ssize_t local_bytes_read = recv(socket_ptr->handle, buffer, (int)num_bytes, SEND_FLAGS); if( local_bytes_read < 0 ) { -#ifdef WIN32 +#ifdef MICROSTRAIN_PLATFORM_WINDOWS return false; #else if(errno != EAGAIN && errno != EWOULDBLOCK) diff --git a/src/mip/utils/tcp_socket.h b/src/c/microstrain/connections/tcp/tcp_socket.h similarity index 85% rename from src/mip/utils/tcp_socket.h rename to src/c/microstrain/connections/tcp/tcp_socket.h index 62827286c..c604271e3 100644 --- a/src/mip/utils/tcp_socket.h +++ b/src/c/microstrain/connections/tcp/tcp_socket.h @@ -1,6 +1,8 @@ #pragma once -#ifdef WIN32 +#include + +#ifdef MICROSTRAIN_PLATFORM_WINDOWS #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN @@ -19,12 +21,12 @@ extern "C" { #endif //////////////////////////////////////////////////////////////////////////////// -///@addtogroup mip_platform +///@addtogroup microstrain_platform /// ///@{ //////////////////////////////////////////////////////////////////////////////// -///@defgroup mip_tcp TCP Client +///@defgroup microstrain_tcp TCP Client /// ///@brief Simple implementation for reading and writing to a tcp client socket /// @@ -32,7 +34,7 @@ extern "C" { typedef struct tcp_socket { -#ifdef WIN32 +#ifdef MICROSTRAIN_PLATFORM_WINDOWS SOCKET handle; #else int handle; diff --git a/src/c/microstrain/microstrain_all.h b/src/c/microstrain/microstrain_all.h new file mode 100644 index 000000000..0afb5561e --- /dev/null +++ b/src/c/microstrain/microstrain_all.h @@ -0,0 +1,8 @@ +#pragma once + +// MicroStrain Common +#include "common/device_models.h" +#include "common/embedded_time.h" +#include "common/logging.h" +#include "common/platform.h" +#include "common/serialization.h" diff --git a/src/c/mip/CMakeLists.txt b/src/c/mip/CMakeLists.txt new file mode 100644 index 000000000..8ebf6c710 --- /dev/null +++ b/src/c/mip/CMakeLists.txt @@ -0,0 +1,106 @@ +set(MIP_LIBRARY "mip" CACHE INTERNAL "Name of the MIP library") +mark_as_advanced(MIP_LIBRARY) + +include(microstrain_utilities) +microstrain_get_git_version(MIP_GIT_VERSION MIP_GIT_VERSION_CLEAN) +microstrain_extract_git_version(MIP_GIT_VERSION_CLEAN MIP_GIT_VERSION_MAJOR MIP_GIT_VERSION_MINOR MIP_GIT_VERSION_PATCH) + +# Generate the version header file +set(MIP_VERSION_IN_FILE "${CMAKE_CURRENT_LIST_DIR}/../../../cmake/mip_version.h.in") +set(MIP_VERSION_OUT_FILE "${CMAKE_CURRENT_LIST_DIR}/mip_version.h") +configure_file(${MIP_VERSION_IN_FILE} ${MIP_VERSION_OUT_FILE}) + +# +# Core MIP C library +# + +add_library(${MIP_LIBRARY} + "${MIP_VERSION_OUT_FILE}" + + "${CMAKE_CURRENT_LIST_DIR}/mip_cmdqueue.c" + "${CMAKE_CURRENT_LIST_DIR}/mip_cmdqueue.h" + "${CMAKE_CURRENT_LIST_DIR}/mip_descriptors.c" + "${CMAKE_CURRENT_LIST_DIR}/mip_descriptors.h" + "${CMAKE_CURRENT_LIST_DIR}/mip_device_models.c" + "${CMAKE_CURRENT_LIST_DIR}/mip_device_models.h" + "${CMAKE_CURRENT_LIST_DIR}/mip_dispatch.c" + "${CMAKE_CURRENT_LIST_DIR}/mip_dispatch.h" + "${CMAKE_CURRENT_LIST_DIR}/mip_field.c" + "${CMAKE_CURRENT_LIST_DIR}/mip_field.h" + "${CMAKE_CURRENT_LIST_DIR}/mip_interface.c" + "${CMAKE_CURRENT_LIST_DIR}/mip_interface.h" + "${CMAKE_CURRENT_LIST_DIR}/mip_offsets.h" + "${CMAKE_CURRENT_LIST_DIR}/mip_packet.c" + "${CMAKE_CURRENT_LIST_DIR}/mip_packet.h" + "${CMAKE_CURRENT_LIST_DIR}/mip_parser.c" + "${CMAKE_CURRENT_LIST_DIR}/mip_parser.h" + "${CMAKE_CURRENT_LIST_DIR}/mip_result.c" + "${CMAKE_CURRENT_LIST_DIR}/mip_result.h" + "${CMAKE_CURRENT_LIST_DIR}/mip_types.h" + "${CMAKE_CURRENT_LIST_DIR}/mip_serialization.c" + "${CMAKE_CURRENT_LIST_DIR}/mip_serialization.h" + "${CMAKE_CURRENT_LIST_DIR}/definitions/common.c" + "${CMAKE_CURRENT_LIST_DIR}/definitions/common.h" + "${CMAKE_CURRENT_LIST_DIR}/mip_all.h" + + "${CMAKE_CURRENT_LIST_DIR}/utils/byte_ring.c" + "${CMAKE_CURRENT_LIST_DIR}/utils/byte_ring.h" +) + +target_compile_features(${MIP_LIBRARY} PUBLIC c_std_11) +target_link_libraries(${MIP_LIBRARY} PUBLIC ${MICROSTRAIN_COMMON_LIBRARY}) + +if(${MIP_ENABLE_DIAGNOSTICS}) + target_compile_definitions(${MIP_LIBRARY} PUBLIC "MIP_ENABLE_DIAGNOSTICS=1") +endif() + +target_compile_definitions(${MIP_LIBRARY} PRIVATE ${MICROSTRAIN_PRIVATE_COMPILE_DEFINITIONS}) + +target_compile_options(${MIP_LIBRARY} PRIVATE ${MICROSTRAIN_PRIVATE_COMPILE_OPTIONS}) + + +# +# Mip definition files +# + +set(MIP_DEFS + commands_3dm + commands_aiding + commands_base + commands_filter + commands_gnss + commands_rtk + commands_system + data_filter + data_gnss + data_sensor + data_shared + data_system +) + +# Set this list as a target property so the C++ version can access it. +set_target_properties(${MIP_LIBRARY} PROPERTIES definitions "${MIP_DEFS}") + +set(MIP_DEF_HEADERS ${MIP_DEFS}) +set(MIP_DEF_SOURCES ${MIP_DEFS}) +list(TRANSFORM MIP_DEF_HEADERS APPEND ".h") +list(TRANSFORM MIP_DEF_SOURCES APPEND ".c") +list(APPEND MIP_DEF_SOURCES ${MIP_DEF_HEADERS}) +list(TRANSFORM MIP_DEF_SOURCES PREPEND "${CMAKE_CURRENT_LIST_DIR}/definitions/") + +if(MICROSTRAIN_CMAKE_DEBUG) + set(INCLUDED_DEF_SOURCES ${MIP_DEF_SOURCES}) + list(TRANSFORM INCLUDED_DEF_SOURCES REPLACE "${CMAKE_CURRENT_LIST_DIR}/" "") + message("C definitions = ${INCLUDED_DEF_SOURCES}") +endif() + +target_sources(${MIP_LIBRARY} PRIVATE ${MIP_DEF_SOURCES}) + +set(MIP_LIBRARIES_TMP ${MIP_LIBRARIES_TMP} ${MIP_LIBRARY} PARENT_SCOPE) + +# +# Installation +# + +include(microstrain_utilities) +microstrain_setup_library_install(${MIP_LIBRARY} ${MICROSTRAIN_SRC_DIR}) diff --git a/src/c/mip/definitions/commands_3dm.c b/src/c/mip/definitions/commands_3dm.c new file mode 100644 index 000000000..d98a9437e --- /dev/null +++ b/src/c/mip/definitions/commands_3dm.c @@ -0,0 +1,5012 @@ + +#include "commands_3dm.h" + +#include +#include + +#include + + +#ifdef __cplusplus +namespace mip { +namespace C { +extern "C" { + +#endif // __cplusplus + + +//////////////////////////////////////////////////////////////////////////////// +// Mip Fields +//////////////////////////////////////////////////////////////////////////////// + +void insert_mip_nmea_message(microstrain_serializer* serializer, const mip_nmea_message* self) +{ + insert_mip_nmea_message_message_id(serializer, self->message_id); + + insert_mip_nmea_message_talker_id(serializer, self->talker_id); + + microstrain_insert_u8(serializer, self->source_desc_set); + + microstrain_insert_u16(serializer, self->decimation); + +} +void extract_mip_nmea_message(microstrain_serializer* serializer, mip_nmea_message* self) +{ + extract_mip_nmea_message_message_id(serializer, &self->message_id); + + extract_mip_nmea_message_talker_id(serializer, &self->talker_id); + + microstrain_extract_u8(serializer, &self->source_desc_set); + + microstrain_extract_u16(serializer, &self->decimation); + +} + +void insert_mip_3dm_poll_imu_message_command(microstrain_serializer* serializer, const mip_3dm_poll_imu_message_command* self) +{ + microstrain_insert_bool(serializer, self->suppress_ack); + + microstrain_insert_u8(serializer, self->num_descriptors); + + + for(unsigned int i=0; i < self->num_descriptors; i++) + insert_mip_descriptor_rate(serializer, &self->descriptors[i]); + +} +void extract_mip_3dm_poll_imu_message_command(microstrain_serializer* serializer, mip_3dm_poll_imu_message_command* self) +{ + microstrain_extract_bool(serializer, &self->suppress_ack); + + assert(self->num_descriptors); + microstrain_extract_count(serializer, &self->num_descriptors, sizeof(self->descriptors)/sizeof(self->descriptors[0])); + + for(unsigned int i=0; i < self->num_descriptors; i++) + extract_mip_descriptor_rate(serializer, &self->descriptors[i]); + +} + +mip_cmd_result mip_3dm_poll_imu_message(mip_interface* device, bool suppress_ack, uint8_t num_descriptors, const mip_descriptor_rate* descriptors) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + microstrain_insert_bool(&serializer, suppress_ack); + + microstrain_insert_u8(&serializer, num_descriptors); + + assert(descriptors || (num_descriptors == 0)); + for(unsigned int i=0; i < num_descriptors; i++) + insert_mip_descriptor_rate(&serializer, &descriptors[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_POLL_IMU_MESSAGE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_3dm_poll_gnss_message_command(microstrain_serializer* serializer, const mip_3dm_poll_gnss_message_command* self) +{ + microstrain_insert_bool(serializer, self->suppress_ack); + + microstrain_insert_u8(serializer, self->num_descriptors); + + + for(unsigned int i=0; i < self->num_descriptors; i++) + insert_mip_descriptor_rate(serializer, &self->descriptors[i]); + +} +void extract_mip_3dm_poll_gnss_message_command(microstrain_serializer* serializer, mip_3dm_poll_gnss_message_command* self) +{ + microstrain_extract_bool(serializer, &self->suppress_ack); + + assert(self->num_descriptors); + microstrain_extract_count(serializer, &self->num_descriptors, sizeof(self->descriptors)/sizeof(self->descriptors[0])); + + for(unsigned int i=0; i < self->num_descriptors; i++) + extract_mip_descriptor_rate(serializer, &self->descriptors[i]); + +} + +mip_cmd_result mip_3dm_poll_gnss_message(mip_interface* device, bool suppress_ack, uint8_t num_descriptors, const mip_descriptor_rate* descriptors) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + microstrain_insert_bool(&serializer, suppress_ack); + + microstrain_insert_u8(&serializer, num_descriptors); + + assert(descriptors || (num_descriptors == 0)); + for(unsigned int i=0; i < num_descriptors; i++) + insert_mip_descriptor_rate(&serializer, &descriptors[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_POLL_GNSS_MESSAGE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_3dm_poll_filter_message_command(microstrain_serializer* serializer, const mip_3dm_poll_filter_message_command* self) +{ + microstrain_insert_bool(serializer, self->suppress_ack); + + microstrain_insert_u8(serializer, self->num_descriptors); + + + for(unsigned int i=0; i < self->num_descriptors; i++) + insert_mip_descriptor_rate(serializer, &self->descriptors[i]); + +} +void extract_mip_3dm_poll_filter_message_command(microstrain_serializer* serializer, mip_3dm_poll_filter_message_command* self) +{ + microstrain_extract_bool(serializer, &self->suppress_ack); + + assert(self->num_descriptors); + microstrain_extract_count(serializer, &self->num_descriptors, sizeof(self->descriptors)/sizeof(self->descriptors[0])); + + for(unsigned int i=0; i < self->num_descriptors; i++) + extract_mip_descriptor_rate(serializer, &self->descriptors[i]); + +} + +mip_cmd_result mip_3dm_poll_filter_message(mip_interface* device, bool suppress_ack, uint8_t num_descriptors, const mip_descriptor_rate* descriptors) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + microstrain_insert_bool(&serializer, suppress_ack); + + microstrain_insert_u8(&serializer, num_descriptors); + + assert(descriptors || (num_descriptors == 0)); + for(unsigned int i=0; i < num_descriptors; i++) + insert_mip_descriptor_rate(&serializer, &descriptors[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_POLL_FILTER_MESSAGE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_3dm_imu_message_format_command(microstrain_serializer* serializer, const mip_3dm_imu_message_format_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_u8(serializer, self->num_descriptors); + + + for(unsigned int i=0; i < self->num_descriptors; i++) + insert_mip_descriptor_rate(serializer, &self->descriptors[i]); + + } +} +void extract_mip_3dm_imu_message_format_command(microstrain_serializer* serializer, mip_3dm_imu_message_format_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + assert(self->num_descriptors); + microstrain_extract_count(serializer, &self->num_descriptors, sizeof(self->descriptors)/sizeof(self->descriptors[0])); + + for(unsigned int i=0; i < self->num_descriptors; i++) + extract_mip_descriptor_rate(serializer, &self->descriptors[i]); + + } +} + +void insert_mip_3dm_imu_message_format_response(microstrain_serializer* serializer, const mip_3dm_imu_message_format_response* self) +{ + microstrain_insert_u8(serializer, self->num_descriptors); + + + for(unsigned int i=0; i < self->num_descriptors; i++) + insert_mip_descriptor_rate(serializer, &self->descriptors[i]); + +} +void extract_mip_3dm_imu_message_format_response(microstrain_serializer* serializer, mip_3dm_imu_message_format_response* self) +{ + assert(self->num_descriptors); + microstrain_extract_count(serializer, &self->num_descriptors, sizeof(self->descriptors)/sizeof(self->descriptors[0])); + + for(unsigned int i=0; i < self->num_descriptors; i++) + extract_mip_descriptor_rate(serializer, &self->descriptors[i]); + +} + +mip_cmd_result mip_3dm_write_imu_message_format(mip_interface* device, uint8_t num_descriptors, const mip_descriptor_rate* descriptors) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_u8(&serializer, num_descriptors); + + assert(descriptors || (num_descriptors == 0)); + for(unsigned int i=0; i < num_descriptors; i++) + insert_mip_descriptor_rate(&serializer, &descriptors[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_IMU_MESSAGE_FORMAT, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_read_imu_message_format(mip_interface* device, uint8_t* num_descriptors_out, uint8_t num_descriptors_out_max, mip_descriptor_rate* descriptors_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_IMU_MESSAGE_FORMAT, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_IMU_MESSAGE_FORMAT, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(num_descriptors_out); + microstrain_extract_count(&deserializer, num_descriptors_out, num_descriptors_out_max); + + assert(descriptors_out || (num_descriptors_out == 0)); + for(unsigned int i=0; i < *num_descriptors_out; i++) + extract_mip_descriptor_rate(&deserializer, &descriptors_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_3dm_save_imu_message_format(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_IMU_MESSAGE_FORMAT, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_load_imu_message_format(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_IMU_MESSAGE_FORMAT, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_default_imu_message_format(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_IMU_MESSAGE_FORMAT, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_3dm_gps_message_format_command(microstrain_serializer* serializer, const mip_3dm_gps_message_format_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_u8(serializer, self->num_descriptors); + + + for(unsigned int i=0; i < self->num_descriptors; i++) + insert_mip_descriptor_rate(serializer, &self->descriptors[i]); + + } +} +void extract_mip_3dm_gps_message_format_command(microstrain_serializer* serializer, mip_3dm_gps_message_format_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + assert(self->num_descriptors); + microstrain_extract_count(serializer, &self->num_descriptors, sizeof(self->descriptors)/sizeof(self->descriptors[0])); + + for(unsigned int i=0; i < self->num_descriptors; i++) + extract_mip_descriptor_rate(serializer, &self->descriptors[i]); + + } +} + +void insert_mip_3dm_gps_message_format_response(microstrain_serializer* serializer, const mip_3dm_gps_message_format_response* self) +{ + microstrain_insert_u8(serializer, self->num_descriptors); + + + for(unsigned int i=0; i < self->num_descriptors; i++) + insert_mip_descriptor_rate(serializer, &self->descriptors[i]); + +} +void extract_mip_3dm_gps_message_format_response(microstrain_serializer* serializer, mip_3dm_gps_message_format_response* self) +{ + assert(self->num_descriptors); + microstrain_extract_count(serializer, &self->num_descriptors, sizeof(self->descriptors)/sizeof(self->descriptors[0])); + + for(unsigned int i=0; i < self->num_descriptors; i++) + extract_mip_descriptor_rate(serializer, &self->descriptors[i]); + +} + +mip_cmd_result mip_3dm_write_gps_message_format(mip_interface* device, uint8_t num_descriptors, const mip_descriptor_rate* descriptors) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_u8(&serializer, num_descriptors); + + assert(descriptors || (num_descriptors == 0)); + for(unsigned int i=0; i < num_descriptors; i++) + insert_mip_descriptor_rate(&serializer, &descriptors[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_MESSAGE_FORMAT, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_read_gps_message_format(mip_interface* device, uint8_t* num_descriptors_out, uint8_t num_descriptors_out_max, mip_descriptor_rate* descriptors_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_MESSAGE_FORMAT, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_GNSS_MESSAGE_FORMAT, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(num_descriptors_out); + microstrain_extract_count(&deserializer, num_descriptors_out, num_descriptors_out_max); + + assert(descriptors_out || (num_descriptors_out == 0)); + for(unsigned int i=0; i < *num_descriptors_out; i++) + extract_mip_descriptor_rate(&deserializer, &descriptors_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_3dm_save_gps_message_format(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_MESSAGE_FORMAT, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_load_gps_message_format(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_MESSAGE_FORMAT, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_default_gps_message_format(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_MESSAGE_FORMAT, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_3dm_filter_message_format_command(microstrain_serializer* serializer, const mip_3dm_filter_message_format_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_u8(serializer, self->num_descriptors); + + + for(unsigned int i=0; i < self->num_descriptors; i++) + insert_mip_descriptor_rate(serializer, &self->descriptors[i]); + + } +} +void extract_mip_3dm_filter_message_format_command(microstrain_serializer* serializer, mip_3dm_filter_message_format_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + assert(self->num_descriptors); + microstrain_extract_count(serializer, &self->num_descriptors, sizeof(self->descriptors)/sizeof(self->descriptors[0])); + + for(unsigned int i=0; i < self->num_descriptors; i++) + extract_mip_descriptor_rate(serializer, &self->descriptors[i]); + + } +} + +void insert_mip_3dm_filter_message_format_response(microstrain_serializer* serializer, const mip_3dm_filter_message_format_response* self) +{ + microstrain_insert_u8(serializer, self->num_descriptors); + + + for(unsigned int i=0; i < self->num_descriptors; i++) + insert_mip_descriptor_rate(serializer, &self->descriptors[i]); + +} +void extract_mip_3dm_filter_message_format_response(microstrain_serializer* serializer, mip_3dm_filter_message_format_response* self) +{ + assert(self->num_descriptors); + microstrain_extract_count(serializer, &self->num_descriptors, sizeof(self->descriptors)/sizeof(self->descriptors[0])); + + for(unsigned int i=0; i < self->num_descriptors; i++) + extract_mip_descriptor_rate(serializer, &self->descriptors[i]); + +} + +mip_cmd_result mip_3dm_write_filter_message_format(mip_interface* device, uint8_t num_descriptors, const mip_descriptor_rate* descriptors) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_u8(&serializer, num_descriptors); + + assert(descriptors || (num_descriptors == 0)); + for(unsigned int i=0; i < num_descriptors; i++) + insert_mip_descriptor_rate(&serializer, &descriptors[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_FILTER_MESSAGE_FORMAT, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_read_filter_message_format(mip_interface* device, uint8_t* num_descriptors_out, uint8_t num_descriptors_out_max, mip_descriptor_rate* descriptors_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_FILTER_MESSAGE_FORMAT, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_FILTER_MESSAGE_FORMAT, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(num_descriptors_out); + microstrain_extract_count(&deserializer, num_descriptors_out, num_descriptors_out_max); + + assert(descriptors_out || (num_descriptors_out == 0)); + for(unsigned int i=0; i < *num_descriptors_out; i++) + extract_mip_descriptor_rate(&deserializer, &descriptors_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_3dm_save_filter_message_format(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_FILTER_MESSAGE_FORMAT, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_load_filter_message_format(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_FILTER_MESSAGE_FORMAT, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_default_filter_message_format(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_FILTER_MESSAGE_FORMAT, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_imu_get_base_rate(mip_interface* device, uint16_t* rate_out) +{ + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + uint8_t responseLength = sizeof(buffer); + + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GET_IMU_BASE_RATE, NULL, 0, MIP_REPLY_DESC_3DM_IMU_BASE_RATE, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(rate_out); + microstrain_extract_u16(&deserializer, rate_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_3dm_gps_get_base_rate(mip_interface* device, uint16_t* rate_out) +{ + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + uint8_t responseLength = sizeof(buffer); + + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GET_GNSS_BASE_RATE, NULL, 0, MIP_REPLY_DESC_3DM_GNSS_BASE_RATE, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(rate_out); + microstrain_extract_u16(&deserializer, rate_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_3dm_filter_get_base_rate(mip_interface* device, uint16_t* rate_out) +{ + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + uint8_t responseLength = sizeof(buffer); + + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GET_FILTER_BASE_RATE, NULL, 0, MIP_REPLY_DESC_3DM_FILTER_BASE_RATE, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(rate_out); + microstrain_extract_u16(&deserializer, rate_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +void insert_mip_3dm_poll_data_command(microstrain_serializer* serializer, const mip_3dm_poll_data_command* self) +{ + microstrain_insert_u8(serializer, self->desc_set); + + microstrain_insert_bool(serializer, self->suppress_ack); + + microstrain_insert_u8(serializer, self->num_descriptors); + + + for(unsigned int i=0; i < self->num_descriptors; i++) + microstrain_insert_u8(serializer, self->descriptors[i]); + +} +void extract_mip_3dm_poll_data_command(microstrain_serializer* serializer, mip_3dm_poll_data_command* self) +{ + microstrain_extract_u8(serializer, &self->desc_set); + + microstrain_extract_bool(serializer, &self->suppress_ack); + + assert(self->num_descriptors); + microstrain_extract_count(serializer, &self->num_descriptors, sizeof(self->descriptors)/sizeof(self->descriptors[0])); + + for(unsigned int i=0; i < self->num_descriptors; i++) + microstrain_extract_u8(serializer, &self->descriptors[i]); + +} + +mip_cmd_result mip_3dm_poll_data(mip_interface* device, uint8_t desc_set, bool suppress_ack, uint8_t num_descriptors, const uint8_t* descriptors) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + microstrain_insert_u8(&serializer, desc_set); + + microstrain_insert_bool(&serializer, suppress_ack); + + microstrain_insert_u8(&serializer, num_descriptors); + + assert(descriptors || (num_descriptors == 0)); + for(unsigned int i=0; i < num_descriptors; i++) + microstrain_insert_u8(&serializer, descriptors[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_POLL_DATA, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_3dm_get_base_rate_command(microstrain_serializer* serializer, const mip_3dm_get_base_rate_command* self) +{ + microstrain_insert_u8(serializer, self->desc_set); + +} +void extract_mip_3dm_get_base_rate_command(microstrain_serializer* serializer, mip_3dm_get_base_rate_command* self) +{ + microstrain_extract_u8(serializer, &self->desc_set); + +} + +void insert_mip_3dm_get_base_rate_response(microstrain_serializer* serializer, const mip_3dm_get_base_rate_response* self) +{ + microstrain_insert_u8(serializer, self->desc_set); + + microstrain_insert_u16(serializer, self->rate); + +} +void extract_mip_3dm_get_base_rate_response(microstrain_serializer* serializer, mip_3dm_get_base_rate_response* self) +{ + microstrain_extract_u8(serializer, &self->desc_set); + + microstrain_extract_u16(serializer, &self->rate); + +} + +mip_cmd_result mip_3dm_get_base_rate(mip_interface* device, uint8_t desc_set, uint16_t* rate_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + microstrain_insert_u8(&serializer, desc_set); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GET_BASE_RATE, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_BASE_RATE, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + microstrain_extract_u8(&deserializer, &desc_set); + + assert(rate_out); + microstrain_extract_u16(&deserializer, rate_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +void insert_mip_3dm_message_format_command(microstrain_serializer* serializer, const mip_3dm_message_format_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + microstrain_insert_u8(serializer, self->desc_set); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_u8(serializer, self->num_descriptors); + + + for(unsigned int i=0; i < self->num_descriptors; i++) + insert_mip_descriptor_rate(serializer, &self->descriptors[i]); + + } +} +void extract_mip_3dm_message_format_command(microstrain_serializer* serializer, mip_3dm_message_format_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + microstrain_extract_u8(serializer, &self->desc_set); + + if( self->function == MIP_FUNCTION_WRITE ) + { + assert(self->num_descriptors); + microstrain_extract_count(serializer, &self->num_descriptors, sizeof(self->descriptors)/sizeof(self->descriptors[0])); + + for(unsigned int i=0; i < self->num_descriptors; i++) + extract_mip_descriptor_rate(serializer, &self->descriptors[i]); + + } +} + +void insert_mip_3dm_message_format_response(microstrain_serializer* serializer, const mip_3dm_message_format_response* self) +{ + microstrain_insert_u8(serializer, self->desc_set); + + microstrain_insert_u8(serializer, self->num_descriptors); + + + for(unsigned int i=0; i < self->num_descriptors; i++) + insert_mip_descriptor_rate(serializer, &self->descriptors[i]); + +} +void extract_mip_3dm_message_format_response(microstrain_serializer* serializer, mip_3dm_message_format_response* self) +{ + microstrain_extract_u8(serializer, &self->desc_set); + + assert(self->num_descriptors); + microstrain_extract_count(serializer, &self->num_descriptors, sizeof(self->descriptors)/sizeof(self->descriptors[0])); + + for(unsigned int i=0; i < self->num_descriptors; i++) + extract_mip_descriptor_rate(serializer, &self->descriptors[i]); + +} + +mip_cmd_result mip_3dm_write_message_format(mip_interface* device, uint8_t desc_set, uint8_t num_descriptors, const mip_descriptor_rate* descriptors) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_u8(&serializer, desc_set); + + microstrain_insert_u8(&serializer, num_descriptors); + + assert(descriptors || (num_descriptors == 0)); + for(unsigned int i=0; i < num_descriptors; i++) + insert_mip_descriptor_rate(&serializer, &descriptors[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_MESSAGE_FORMAT, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_read_message_format(mip_interface* device, uint8_t desc_set, uint8_t* num_descriptors_out, uint8_t num_descriptors_out_max, mip_descriptor_rate* descriptors_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + microstrain_insert_u8(&serializer, desc_set); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_MESSAGE_FORMAT, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_MESSAGE_FORMAT, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + microstrain_extract_u8(&deserializer, &desc_set); + + assert(num_descriptors_out); + microstrain_extract_count(&deserializer, num_descriptors_out, num_descriptors_out_max); + + assert(descriptors_out || (num_descriptors_out == 0)); + for(unsigned int i=0; i < *num_descriptors_out; i++) + extract_mip_descriptor_rate(&deserializer, &descriptors_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_3dm_save_message_format(mip_interface* device, uint8_t desc_set) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + microstrain_insert_u8(&serializer, desc_set); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_MESSAGE_FORMAT, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_load_message_format(mip_interface* device, uint8_t desc_set) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + microstrain_insert_u8(&serializer, desc_set); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_MESSAGE_FORMAT, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_default_message_format(mip_interface* device, uint8_t desc_set) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + microstrain_insert_u8(&serializer, desc_set); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_MESSAGE_FORMAT, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_3dm_nmea_poll_data_command(microstrain_serializer* serializer, const mip_3dm_nmea_poll_data_command* self) +{ + microstrain_insert_bool(serializer, self->suppress_ack); + + microstrain_insert_u8(serializer, self->count); + + + for(unsigned int i=0; i < self->count; i++) + insert_mip_nmea_message(serializer, &self->format_entries[i]); + +} +void extract_mip_3dm_nmea_poll_data_command(microstrain_serializer* serializer, mip_3dm_nmea_poll_data_command* self) +{ + microstrain_extract_bool(serializer, &self->suppress_ack); + + assert(self->count); + microstrain_extract_count(serializer, &self->count, sizeof(self->format_entries)/sizeof(self->format_entries[0])); + + for(unsigned int i=0; i < self->count; i++) + extract_mip_nmea_message(serializer, &self->format_entries[i]); + +} + +mip_cmd_result mip_3dm_nmea_poll_data(mip_interface* device, bool suppress_ack, uint8_t count, const mip_nmea_message* format_entries) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + microstrain_insert_bool(&serializer, suppress_ack); + + microstrain_insert_u8(&serializer, count); + + assert(format_entries || (count == 0)); + for(unsigned int i=0; i < count; i++) + insert_mip_nmea_message(&serializer, &format_entries[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_POLL_NMEA_MESSAGE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_3dm_nmea_message_format_command(microstrain_serializer* serializer, const mip_3dm_nmea_message_format_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_u8(serializer, self->count); + + + for(unsigned int i=0; i < self->count; i++) + insert_mip_nmea_message(serializer, &self->format_entries[i]); + + } +} +void extract_mip_3dm_nmea_message_format_command(microstrain_serializer* serializer, mip_3dm_nmea_message_format_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + assert(self->count); + microstrain_extract_count(serializer, &self->count, sizeof(self->format_entries)/sizeof(self->format_entries[0])); + + for(unsigned int i=0; i < self->count; i++) + extract_mip_nmea_message(serializer, &self->format_entries[i]); + + } +} + +void insert_mip_3dm_nmea_message_format_response(microstrain_serializer* serializer, const mip_3dm_nmea_message_format_response* self) +{ + microstrain_insert_u8(serializer, self->count); + + + for(unsigned int i=0; i < self->count; i++) + insert_mip_nmea_message(serializer, &self->format_entries[i]); + +} +void extract_mip_3dm_nmea_message_format_response(microstrain_serializer* serializer, mip_3dm_nmea_message_format_response* self) +{ + assert(self->count); + microstrain_extract_count(serializer, &self->count, sizeof(self->format_entries)/sizeof(self->format_entries[0])); + + for(unsigned int i=0; i < self->count; i++) + extract_mip_nmea_message(serializer, &self->format_entries[i]); + +} + +mip_cmd_result mip_3dm_write_nmea_message_format(mip_interface* device, uint8_t count, const mip_nmea_message* format_entries) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_u8(&serializer, count); + + assert(format_entries || (count == 0)); + for(unsigned int i=0; i < count; i++) + insert_mip_nmea_message(&serializer, &format_entries[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_NMEA_MESSAGE_FORMAT, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_read_nmea_message_format(mip_interface* device, uint8_t* count_out, uint8_t count_out_max, mip_nmea_message* format_entries_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_NMEA_MESSAGE_FORMAT, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_NMEA_MESSAGE_FORMAT, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(count_out); + microstrain_extract_count(&deserializer, count_out, count_out_max); + + assert(format_entries_out || (count_out == 0)); + for(unsigned int i=0; i < *count_out; i++) + extract_mip_nmea_message(&deserializer, &format_entries_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_3dm_save_nmea_message_format(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_NMEA_MESSAGE_FORMAT, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_load_nmea_message_format(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_NMEA_MESSAGE_FORMAT, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_default_nmea_message_format(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_NMEA_MESSAGE_FORMAT, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_3dm_device_settings_command(microstrain_serializer* serializer, const mip_3dm_device_settings_command* self) +{ + insert_mip_function_selector(serializer, self->function); + +} +void extract_mip_3dm_device_settings_command(microstrain_serializer* serializer, mip_3dm_device_settings_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + +} + +mip_cmd_result mip_3dm_save_device_settings(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_DEVICE_STARTUP_SETTINGS, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_load_device_settings(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_DEVICE_STARTUP_SETTINGS, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_default_device_settings(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_DEVICE_STARTUP_SETTINGS, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_3dm_uart_baudrate_command(microstrain_serializer* serializer, const mip_3dm_uart_baudrate_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_u32(serializer, self->baud); + + } +} +void extract_mip_3dm_uart_baudrate_command(microstrain_serializer* serializer, mip_3dm_uart_baudrate_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_extract_u32(serializer, &self->baud); + + } +} + +void insert_mip_3dm_uart_baudrate_response(microstrain_serializer* serializer, const mip_3dm_uart_baudrate_response* self) +{ + microstrain_insert_u32(serializer, self->baud); + +} +void extract_mip_3dm_uart_baudrate_response(microstrain_serializer* serializer, mip_3dm_uart_baudrate_response* self) +{ + microstrain_extract_u32(serializer, &self->baud); + +} + +mip_cmd_result mip_3dm_write_uart_baudrate(mip_interface* device, uint32_t baud) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_u32(&serializer, baud); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_UART_BAUDRATE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_read_uart_baudrate(mip_interface* device, uint32_t* baud_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_UART_BAUDRATE, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_UART_BAUDRATE, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(baud_out); + microstrain_extract_u32(&deserializer, baud_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_3dm_save_uart_baudrate(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_UART_BAUDRATE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_load_uart_baudrate(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_UART_BAUDRATE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_default_uart_baudrate(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_UART_BAUDRATE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_3dm_factory_streaming_command(microstrain_serializer* serializer, const mip_3dm_factory_streaming_command* self) +{ + insert_mip_3dm_factory_streaming_command_action(serializer, self->action); + + microstrain_insert_u8(serializer, self->reserved); + +} +void extract_mip_3dm_factory_streaming_command(microstrain_serializer* serializer, mip_3dm_factory_streaming_command* self) +{ + extract_mip_3dm_factory_streaming_command_action(serializer, &self->action); + + microstrain_extract_u8(serializer, &self->reserved); + +} + +mip_cmd_result mip_3dm_factory_streaming(mip_interface* device, mip_3dm_factory_streaming_command_action action, uint8_t reserved) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_3dm_factory_streaming_command_action(&serializer, action); + + microstrain_insert_u8(&serializer, reserved); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_CONFIGURE_FACTORY_STREAMING, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_3dm_datastream_control_command(microstrain_serializer* serializer, const mip_3dm_datastream_control_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + microstrain_insert_u8(serializer, self->desc_set); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_bool(serializer, self->enable); + + } +} +void extract_mip_3dm_datastream_control_command(microstrain_serializer* serializer, mip_3dm_datastream_control_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + microstrain_extract_u8(serializer, &self->desc_set); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_extract_bool(serializer, &self->enable); + + } +} + +void insert_mip_3dm_datastream_control_response(microstrain_serializer* serializer, const mip_3dm_datastream_control_response* self) +{ + microstrain_insert_u8(serializer, self->desc_set); + + microstrain_insert_bool(serializer, self->enabled); + +} +void extract_mip_3dm_datastream_control_response(microstrain_serializer* serializer, mip_3dm_datastream_control_response* self) +{ + microstrain_extract_u8(serializer, &self->desc_set); + + microstrain_extract_bool(serializer, &self->enabled); + +} + +mip_cmd_result mip_3dm_write_datastream_control(mip_interface* device, uint8_t desc_set, bool enable) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_u8(&serializer, desc_set); + + microstrain_insert_bool(&serializer, enable); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_CONTROL_DATA_STREAM, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_read_datastream_control(mip_interface* device, uint8_t desc_set, bool* enabled_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + microstrain_insert_u8(&serializer, desc_set); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_CONTROL_DATA_STREAM, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_DATASTREAM_ENABLE, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + microstrain_extract_u8(&deserializer, &desc_set); + + assert(enabled_out); + microstrain_extract_bool(&deserializer, enabled_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_3dm_save_datastream_control(mip_interface* device, uint8_t desc_set) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + microstrain_insert_u8(&serializer, desc_set); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_CONTROL_DATA_STREAM, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_load_datastream_control(mip_interface* device, uint8_t desc_set) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + microstrain_insert_u8(&serializer, desc_set); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_CONTROL_DATA_STREAM, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_default_datastream_control(mip_interface* device, uint8_t desc_set) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + microstrain_insert_u8(&serializer, desc_set); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_CONTROL_DATA_STREAM, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_3dm_constellation_settings_command_settings(microstrain_serializer* serializer, const mip_3dm_constellation_settings_command_settings* self) +{ + insert_mip_3dm_constellation_settings_command_constellation_id(serializer, self->constellation_id); + + microstrain_insert_u8(serializer, self->enable); + + microstrain_insert_u8(serializer, self->reserved_channels); + + microstrain_insert_u8(serializer, self->max_channels); + + insert_mip_3dm_constellation_settings_command_option_flags(serializer, self->option_flags); + +} +void extract_mip_3dm_constellation_settings_command_settings(microstrain_serializer* serializer, mip_3dm_constellation_settings_command_settings* self) +{ + extract_mip_3dm_constellation_settings_command_constellation_id(serializer, &self->constellation_id); + + microstrain_extract_u8(serializer, &self->enable); + + microstrain_extract_u8(serializer, &self->reserved_channels); + + microstrain_extract_u8(serializer, &self->max_channels); + + extract_mip_3dm_constellation_settings_command_option_flags(serializer, &self->option_flags); + +} + +void insert_mip_3dm_constellation_settings_command(microstrain_serializer* serializer, const mip_3dm_constellation_settings_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_u16(serializer, self->max_channels); + + microstrain_insert_u8(serializer, self->config_count); + + + for(unsigned int i=0; i < self->config_count; i++) + insert_mip_3dm_constellation_settings_command_settings(serializer, &self->settings[i]); + + } +} +void extract_mip_3dm_constellation_settings_command(microstrain_serializer* serializer, mip_3dm_constellation_settings_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_extract_u16(serializer, &self->max_channels); + + assert(self->config_count); + microstrain_extract_count(serializer, &self->config_count, sizeof(self->settings)/sizeof(self->settings[0])); + + for(unsigned int i=0; i < self->config_count; i++) + extract_mip_3dm_constellation_settings_command_settings(serializer, &self->settings[i]); + + } +} + +void insert_mip_3dm_constellation_settings_response(microstrain_serializer* serializer, const mip_3dm_constellation_settings_response* self) +{ + microstrain_insert_u16(serializer, self->max_channels_available); + + microstrain_insert_u16(serializer, self->max_channels_use); + + microstrain_insert_u8(serializer, self->config_count); + + + for(unsigned int i=0; i < self->config_count; i++) + insert_mip_3dm_constellation_settings_command_settings(serializer, &self->settings[i]); + +} +void extract_mip_3dm_constellation_settings_response(microstrain_serializer* serializer, mip_3dm_constellation_settings_response* self) +{ + microstrain_extract_u16(serializer, &self->max_channels_available); + + microstrain_extract_u16(serializer, &self->max_channels_use); + + assert(self->config_count); + microstrain_extract_count(serializer, &self->config_count, sizeof(self->settings)/sizeof(self->settings[0])); + + for(unsigned int i=0; i < self->config_count; i++) + extract_mip_3dm_constellation_settings_command_settings(serializer, &self->settings[i]); + +} + +mip_cmd_result mip_3dm_write_constellation_settings(mip_interface* device, uint16_t max_channels, uint8_t config_count, const mip_3dm_constellation_settings_command_settings* settings) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_u16(&serializer, max_channels); + + microstrain_insert_u8(&serializer, config_count); + + assert(settings || (config_count == 0)); + for(unsigned int i=0; i < config_count; i++) + insert_mip_3dm_constellation_settings_command_settings(&serializer, &settings[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_CONSTELLATION_SETTINGS, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_read_constellation_settings(mip_interface* device, uint16_t* max_channels_available_out, uint16_t* max_channels_use_out, uint8_t* config_count_out, uint8_t config_count_out_max, mip_3dm_constellation_settings_command_settings* settings_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_CONSTELLATION_SETTINGS, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_GNSS_CONSTELLATION_SETTINGS, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(max_channels_available_out); + microstrain_extract_u16(&deserializer, max_channels_available_out); + + assert(max_channels_use_out); + microstrain_extract_u16(&deserializer, max_channels_use_out); + + assert(config_count_out); + microstrain_extract_count(&deserializer, config_count_out, config_count_out_max); + + assert(settings_out || (config_count_out == 0)); + for(unsigned int i=0; i < *config_count_out; i++) + extract_mip_3dm_constellation_settings_command_settings(&deserializer, &settings_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_3dm_save_constellation_settings(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_CONSTELLATION_SETTINGS, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_load_constellation_settings(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_CONSTELLATION_SETTINGS, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_default_constellation_settings(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_CONSTELLATION_SETTINGS, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_3dm_gnss_sbas_settings_command(microstrain_serializer* serializer, const mip_3dm_gnss_sbas_settings_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_u8(serializer, self->enable_sbas); + + insert_mip_3dm_gnss_sbas_settings_command_sbasoptions(serializer, self->sbas_options); + + microstrain_insert_u8(serializer, self->num_included_prns); + + + for(unsigned int i=0; i < self->num_included_prns; i++) + microstrain_insert_u16(serializer, self->included_prns[i]); + + } +} +void extract_mip_3dm_gnss_sbas_settings_command(microstrain_serializer* serializer, mip_3dm_gnss_sbas_settings_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_extract_u8(serializer, &self->enable_sbas); + + extract_mip_3dm_gnss_sbas_settings_command_sbasoptions(serializer, &self->sbas_options); + + assert(self->num_included_prns); + microstrain_extract_count(serializer, &self->num_included_prns, sizeof(self->included_prns)/sizeof(self->included_prns[0])); + + for(unsigned int i=0; i < self->num_included_prns; i++) + microstrain_extract_u16(serializer, &self->included_prns[i]); + + } +} + +void insert_mip_3dm_gnss_sbas_settings_response(microstrain_serializer* serializer, const mip_3dm_gnss_sbas_settings_response* self) +{ + microstrain_insert_u8(serializer, self->enable_sbas); + + insert_mip_3dm_gnss_sbas_settings_command_sbasoptions(serializer, self->sbas_options); + + microstrain_insert_u8(serializer, self->num_included_prns); + + + for(unsigned int i=0; i < self->num_included_prns; i++) + microstrain_insert_u16(serializer, self->included_prns[i]); + +} +void extract_mip_3dm_gnss_sbas_settings_response(microstrain_serializer* serializer, mip_3dm_gnss_sbas_settings_response* self) +{ + microstrain_extract_u8(serializer, &self->enable_sbas); + + extract_mip_3dm_gnss_sbas_settings_command_sbasoptions(serializer, &self->sbas_options); + + assert(self->num_included_prns); + microstrain_extract_count(serializer, &self->num_included_prns, sizeof(self->included_prns)/sizeof(self->included_prns[0])); + + for(unsigned int i=0; i < self->num_included_prns; i++) + microstrain_extract_u16(serializer, &self->included_prns[i]); + +} + +mip_cmd_result mip_3dm_write_gnss_sbas_settings(mip_interface* device, uint8_t enable_sbas, mip_3dm_gnss_sbas_settings_command_sbasoptions sbas_options, uint8_t num_included_prns, const uint16_t* included_prns) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_u8(&serializer, enable_sbas); + + insert_mip_3dm_gnss_sbas_settings_command_sbasoptions(&serializer, sbas_options); + + microstrain_insert_u8(&serializer, num_included_prns); + + assert(included_prns || (num_included_prns == 0)); + for(unsigned int i=0; i < num_included_prns; i++) + microstrain_insert_u16(&serializer, included_prns[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_SBAS_SETTINGS, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_read_gnss_sbas_settings(mip_interface* device, uint8_t* enable_sbas_out, mip_3dm_gnss_sbas_settings_command_sbasoptions* sbas_options_out, uint8_t* num_included_prns_out, uint8_t num_included_prns_out_max, uint16_t* included_prns_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_SBAS_SETTINGS, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_GNSS_SBAS_SETTINGS, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(enable_sbas_out); + microstrain_extract_u8(&deserializer, enable_sbas_out); + + assert(sbas_options_out); + extract_mip_3dm_gnss_sbas_settings_command_sbasoptions(&deserializer, sbas_options_out); + + assert(num_included_prns_out); + microstrain_extract_count(&deserializer, num_included_prns_out, num_included_prns_out_max); + + assert(included_prns_out || (num_included_prns_out == 0)); + for(unsigned int i=0; i < *num_included_prns_out; i++) + microstrain_extract_u16(&deserializer, &included_prns_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_3dm_save_gnss_sbas_settings(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_SBAS_SETTINGS, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_load_gnss_sbas_settings(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_SBAS_SETTINGS, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_default_gnss_sbas_settings(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_SBAS_SETTINGS, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_3dm_gnss_assisted_fix_command(microstrain_serializer* serializer, const mip_3dm_gnss_assisted_fix_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_3dm_gnss_assisted_fix_command_assisted_fix_option(serializer, self->option); + + microstrain_insert_u8(serializer, self->flags); + + } +} +void extract_mip_3dm_gnss_assisted_fix_command(microstrain_serializer* serializer, mip_3dm_gnss_assisted_fix_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_3dm_gnss_assisted_fix_command_assisted_fix_option(serializer, &self->option); + + microstrain_extract_u8(serializer, &self->flags); + + } +} + +void insert_mip_3dm_gnss_assisted_fix_response(microstrain_serializer* serializer, const mip_3dm_gnss_assisted_fix_response* self) +{ + insert_mip_3dm_gnss_assisted_fix_command_assisted_fix_option(serializer, self->option); + + microstrain_insert_u8(serializer, self->flags); + +} +void extract_mip_3dm_gnss_assisted_fix_response(microstrain_serializer* serializer, mip_3dm_gnss_assisted_fix_response* self) +{ + extract_mip_3dm_gnss_assisted_fix_command_assisted_fix_option(serializer, &self->option); + + microstrain_extract_u8(serializer, &self->flags); + +} + +mip_cmd_result mip_3dm_write_gnss_assisted_fix(mip_interface* device, mip_3dm_gnss_assisted_fix_command_assisted_fix_option option, uint8_t flags) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + insert_mip_3dm_gnss_assisted_fix_command_assisted_fix_option(&serializer, option); + + microstrain_insert_u8(&serializer, flags); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_ASSISTED_FIX_SETTINGS, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_read_gnss_assisted_fix(mip_interface* device, mip_3dm_gnss_assisted_fix_command_assisted_fix_option* option_out, uint8_t* flags_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_ASSISTED_FIX_SETTINGS, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_GNSS_ASSISTED_FIX_SETTINGS, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(option_out); + extract_mip_3dm_gnss_assisted_fix_command_assisted_fix_option(&deserializer, option_out); + + assert(flags_out); + microstrain_extract_u8(&deserializer, flags_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_3dm_save_gnss_assisted_fix(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_ASSISTED_FIX_SETTINGS, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_load_gnss_assisted_fix(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_ASSISTED_FIX_SETTINGS, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_default_gnss_assisted_fix(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_ASSISTED_FIX_SETTINGS, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_3dm_gnss_time_assistance_command(microstrain_serializer* serializer, const mip_3dm_gnss_time_assistance_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_double(serializer, self->tow); + + microstrain_insert_u16(serializer, self->week_number); + + microstrain_insert_float(serializer, self->accuracy); + + } +} +void extract_mip_3dm_gnss_time_assistance_command(microstrain_serializer* serializer, mip_3dm_gnss_time_assistance_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_extract_double(serializer, &self->tow); + + microstrain_extract_u16(serializer, &self->week_number); + + microstrain_extract_float(serializer, &self->accuracy); + + } +} + +void insert_mip_3dm_gnss_time_assistance_response(microstrain_serializer* serializer, const mip_3dm_gnss_time_assistance_response* self) +{ + microstrain_insert_double(serializer, self->tow); + + microstrain_insert_u16(serializer, self->week_number); + + microstrain_insert_float(serializer, self->accuracy); + +} +void extract_mip_3dm_gnss_time_assistance_response(microstrain_serializer* serializer, mip_3dm_gnss_time_assistance_response* self) +{ + microstrain_extract_double(serializer, &self->tow); + + microstrain_extract_u16(serializer, &self->week_number); + + microstrain_extract_float(serializer, &self->accuracy); + +} + +mip_cmd_result mip_3dm_write_gnss_time_assistance(mip_interface* device, double tow, uint16_t week_number, float accuracy) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_double(&serializer, tow); + + microstrain_insert_u16(&serializer, week_number); + + microstrain_insert_float(&serializer, accuracy); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_TIME_ASSISTANCE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_read_gnss_time_assistance(mip_interface* device, double* tow_out, uint16_t* week_number_out, float* accuracy_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_TIME_ASSISTANCE, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_GNSS_TIME_ASSISTANCE, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(tow_out); + microstrain_extract_double(&deserializer, tow_out); + + assert(week_number_out); + microstrain_extract_u16(&deserializer, week_number_out); + + assert(accuracy_out); + microstrain_extract_float(&deserializer, accuracy_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +void insert_mip_3dm_imu_lowpass_filter_command(microstrain_serializer* serializer, const mip_3dm_imu_lowpass_filter_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + microstrain_insert_u8(serializer, self->target_descriptor); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_bool(serializer, self->enable); + + microstrain_insert_bool(serializer, self->manual); + + microstrain_insert_u16(serializer, self->frequency); + + microstrain_insert_u8(serializer, self->reserved); + + } +} +void extract_mip_3dm_imu_lowpass_filter_command(microstrain_serializer* serializer, mip_3dm_imu_lowpass_filter_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + microstrain_extract_u8(serializer, &self->target_descriptor); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_extract_bool(serializer, &self->enable); + + microstrain_extract_bool(serializer, &self->manual); + + microstrain_extract_u16(serializer, &self->frequency); + + microstrain_extract_u8(serializer, &self->reserved); + + } +} + +void insert_mip_3dm_imu_lowpass_filter_response(microstrain_serializer* serializer, const mip_3dm_imu_lowpass_filter_response* self) +{ + microstrain_insert_u8(serializer, self->target_descriptor); + + microstrain_insert_bool(serializer, self->enable); + + microstrain_insert_bool(serializer, self->manual); + + microstrain_insert_u16(serializer, self->frequency); + + microstrain_insert_u8(serializer, self->reserved); + +} +void extract_mip_3dm_imu_lowpass_filter_response(microstrain_serializer* serializer, mip_3dm_imu_lowpass_filter_response* self) +{ + microstrain_extract_u8(serializer, &self->target_descriptor); + + microstrain_extract_bool(serializer, &self->enable); + + microstrain_extract_bool(serializer, &self->manual); + + microstrain_extract_u16(serializer, &self->frequency); + + microstrain_extract_u8(serializer, &self->reserved); + +} + +mip_cmd_result mip_3dm_write_imu_lowpass_filter(mip_interface* device, uint8_t target_descriptor, bool enable, bool manual, uint16_t frequency, uint8_t reserved) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_u8(&serializer, target_descriptor); + + microstrain_insert_bool(&serializer, enable); + + microstrain_insert_bool(&serializer, manual); + + microstrain_insert_u16(&serializer, frequency); + + microstrain_insert_u8(&serializer, reserved); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_IMU_LOWPASS_FILTER, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_read_imu_lowpass_filter(mip_interface* device, uint8_t target_descriptor, bool* enable_out, bool* manual_out, uint16_t* frequency_out, uint8_t* reserved_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + microstrain_insert_u8(&serializer, target_descriptor); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_IMU_LOWPASS_FILTER, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_ADVANCED_DATA_FILTER, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + microstrain_extract_u8(&deserializer, &target_descriptor); + + assert(enable_out); + microstrain_extract_bool(&deserializer, enable_out); + + assert(manual_out); + microstrain_extract_bool(&deserializer, manual_out); + + assert(frequency_out); + microstrain_extract_u16(&deserializer, frequency_out); + + assert(reserved_out); + microstrain_extract_u8(&deserializer, reserved_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_3dm_save_imu_lowpass_filter(mip_interface* device, uint8_t target_descriptor) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + microstrain_insert_u8(&serializer, target_descriptor); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_IMU_LOWPASS_FILTER, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_load_imu_lowpass_filter(mip_interface* device, uint8_t target_descriptor) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + microstrain_insert_u8(&serializer, target_descriptor); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_IMU_LOWPASS_FILTER, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_default_imu_lowpass_filter(mip_interface* device, uint8_t target_descriptor) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + microstrain_insert_u8(&serializer, target_descriptor); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_IMU_LOWPASS_FILTER, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_3dm_pps_source_command(microstrain_serializer* serializer, const mip_3dm_pps_source_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_3dm_pps_source_command_source(serializer, self->source); + + } +} +void extract_mip_3dm_pps_source_command(microstrain_serializer* serializer, mip_3dm_pps_source_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_3dm_pps_source_command_source(serializer, &self->source); + + } +} + +void insert_mip_3dm_pps_source_response(microstrain_serializer* serializer, const mip_3dm_pps_source_response* self) +{ + insert_mip_3dm_pps_source_command_source(serializer, self->source); + +} +void extract_mip_3dm_pps_source_response(microstrain_serializer* serializer, mip_3dm_pps_source_response* self) +{ + extract_mip_3dm_pps_source_command_source(serializer, &self->source); + +} + +mip_cmd_result mip_3dm_write_pps_source(mip_interface* device, mip_3dm_pps_source_command_source source) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + insert_mip_3dm_pps_source_command_source(&serializer, source); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_PPS_SOURCE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_read_pps_source(mip_interface* device, mip_3dm_pps_source_command_source* source_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_PPS_SOURCE, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_PPS_SOURCE, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(source_out); + extract_mip_3dm_pps_source_command_source(&deserializer, source_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_3dm_save_pps_source(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_PPS_SOURCE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_load_pps_source(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_PPS_SOURCE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_default_pps_source(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_PPS_SOURCE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_3dm_gpio_config_command(microstrain_serializer* serializer, const mip_3dm_gpio_config_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + microstrain_insert_u8(serializer, self->pin); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_3dm_gpio_config_command_feature(serializer, self->feature); + + insert_mip_3dm_gpio_config_command_behavior(serializer, self->behavior); + + insert_mip_3dm_gpio_config_command_pin_mode(serializer, self->pin_mode); + + } +} +void extract_mip_3dm_gpio_config_command(microstrain_serializer* serializer, mip_3dm_gpio_config_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + microstrain_extract_u8(serializer, &self->pin); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_3dm_gpio_config_command_feature(serializer, &self->feature); + + extract_mip_3dm_gpio_config_command_behavior(serializer, &self->behavior); + + extract_mip_3dm_gpio_config_command_pin_mode(serializer, &self->pin_mode); + + } +} + +void insert_mip_3dm_gpio_config_response(microstrain_serializer* serializer, const mip_3dm_gpio_config_response* self) +{ + microstrain_insert_u8(serializer, self->pin); + + insert_mip_3dm_gpio_config_command_feature(serializer, self->feature); + + insert_mip_3dm_gpio_config_command_behavior(serializer, self->behavior); + + insert_mip_3dm_gpio_config_command_pin_mode(serializer, self->pin_mode); + +} +void extract_mip_3dm_gpio_config_response(microstrain_serializer* serializer, mip_3dm_gpio_config_response* self) +{ + microstrain_extract_u8(serializer, &self->pin); + + extract_mip_3dm_gpio_config_command_feature(serializer, &self->feature); + + extract_mip_3dm_gpio_config_command_behavior(serializer, &self->behavior); + + extract_mip_3dm_gpio_config_command_pin_mode(serializer, &self->pin_mode); + +} + +mip_cmd_result mip_3dm_write_gpio_config(mip_interface* device, uint8_t pin, mip_3dm_gpio_config_command_feature feature, mip_3dm_gpio_config_command_behavior behavior, mip_3dm_gpio_config_command_pin_mode pin_mode) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_u8(&serializer, pin); + + insert_mip_3dm_gpio_config_command_feature(&serializer, feature); + + insert_mip_3dm_gpio_config_command_behavior(&serializer, behavior); + + insert_mip_3dm_gpio_config_command_pin_mode(&serializer, pin_mode); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GPIO_CONFIG, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_read_gpio_config(mip_interface* device, uint8_t pin, mip_3dm_gpio_config_command_feature* feature_out, mip_3dm_gpio_config_command_behavior* behavior_out, mip_3dm_gpio_config_command_pin_mode* pin_mode_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + microstrain_insert_u8(&serializer, pin); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GPIO_CONFIG, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_GPIO_CONFIG, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + microstrain_extract_u8(&deserializer, &pin); + + assert(feature_out); + extract_mip_3dm_gpio_config_command_feature(&deserializer, feature_out); + + assert(behavior_out); + extract_mip_3dm_gpio_config_command_behavior(&deserializer, behavior_out); + + assert(pin_mode_out); + extract_mip_3dm_gpio_config_command_pin_mode(&deserializer, pin_mode_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_3dm_save_gpio_config(mip_interface* device, uint8_t pin) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + microstrain_insert_u8(&serializer, pin); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GPIO_CONFIG, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_load_gpio_config(mip_interface* device, uint8_t pin) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + microstrain_insert_u8(&serializer, pin); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GPIO_CONFIG, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_default_gpio_config(mip_interface* device, uint8_t pin) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + microstrain_insert_u8(&serializer, pin); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GPIO_CONFIG, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_3dm_gpio_state_command(microstrain_serializer* serializer, const mip_3dm_gpio_state_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE || self->function == MIP_FUNCTION_READ ) + { + microstrain_insert_u8(serializer, self->pin); + + } + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_bool(serializer, self->state); + + } +} +void extract_mip_3dm_gpio_state_command(microstrain_serializer* serializer, mip_3dm_gpio_state_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE || self->function == MIP_FUNCTION_READ ) + { + microstrain_extract_u8(serializer, &self->pin); + + } + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_extract_bool(serializer, &self->state); + + } +} + +void insert_mip_3dm_gpio_state_response(microstrain_serializer* serializer, const mip_3dm_gpio_state_response* self) +{ + microstrain_insert_u8(serializer, self->pin); + + microstrain_insert_bool(serializer, self->state); + +} +void extract_mip_3dm_gpio_state_response(microstrain_serializer* serializer, mip_3dm_gpio_state_response* self) +{ + microstrain_extract_u8(serializer, &self->pin); + + microstrain_extract_bool(serializer, &self->state); + +} + +mip_cmd_result mip_3dm_write_gpio_state(mip_interface* device, uint8_t pin, bool state) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_u8(&serializer, pin); + + microstrain_insert_bool(&serializer, state); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GPIO_STATE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_read_gpio_state(mip_interface* device, uint8_t pin, bool* state_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + microstrain_insert_u8(&serializer, pin); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GPIO_STATE, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_GPIO_STATE, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + microstrain_extract_u8(&deserializer, &pin); + + assert(state_out); + microstrain_extract_bool(&deserializer, state_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +void insert_mip_3dm_odometer_command(microstrain_serializer* serializer, const mip_3dm_odometer_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_3dm_odometer_command_mode(serializer, self->mode); + + microstrain_insert_float(serializer, self->scaling); + + microstrain_insert_float(serializer, self->uncertainty); + + } +} +void extract_mip_3dm_odometer_command(microstrain_serializer* serializer, mip_3dm_odometer_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_3dm_odometer_command_mode(serializer, &self->mode); + + microstrain_extract_float(serializer, &self->scaling); + + microstrain_extract_float(serializer, &self->uncertainty); + + } +} + +void insert_mip_3dm_odometer_response(microstrain_serializer* serializer, const mip_3dm_odometer_response* self) +{ + insert_mip_3dm_odometer_command_mode(serializer, self->mode); + + microstrain_insert_float(serializer, self->scaling); + + microstrain_insert_float(serializer, self->uncertainty); + +} +void extract_mip_3dm_odometer_response(microstrain_serializer* serializer, mip_3dm_odometer_response* self) +{ + extract_mip_3dm_odometer_command_mode(serializer, &self->mode); + + microstrain_extract_float(serializer, &self->scaling); + + microstrain_extract_float(serializer, &self->uncertainty); + +} + +mip_cmd_result mip_3dm_write_odometer(mip_interface* device, mip_3dm_odometer_command_mode mode, float scaling, float uncertainty) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + insert_mip_3dm_odometer_command_mode(&serializer, mode); + + microstrain_insert_float(&serializer, scaling); + + microstrain_insert_float(&serializer, uncertainty); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_ODOMETER_CONFIG, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_read_odometer(mip_interface* device, mip_3dm_odometer_command_mode* mode_out, float* scaling_out, float* uncertainty_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_ODOMETER_CONFIG, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_ODOMETER_CONFIG, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(mode_out); + extract_mip_3dm_odometer_command_mode(&deserializer, mode_out); + + assert(scaling_out); + microstrain_extract_float(&deserializer, scaling_out); + + assert(uncertainty_out); + microstrain_extract_float(&deserializer, uncertainty_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_3dm_save_odometer(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_ODOMETER_CONFIG, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_load_odometer(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_ODOMETER_CONFIG, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_default_odometer(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_ODOMETER_CONFIG, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_3dm_get_event_support_command_info(microstrain_serializer* serializer, const mip_3dm_get_event_support_command_info* self) +{ + microstrain_insert_u8(serializer, self->type); + + microstrain_insert_u8(serializer, self->count); + +} +void extract_mip_3dm_get_event_support_command_info(microstrain_serializer* serializer, mip_3dm_get_event_support_command_info* self) +{ + microstrain_extract_u8(serializer, &self->type); + + microstrain_extract_u8(serializer, &self->count); + +} + +void insert_mip_3dm_get_event_support_command(microstrain_serializer* serializer, const mip_3dm_get_event_support_command* self) +{ + insert_mip_3dm_get_event_support_command_query(serializer, self->query); + +} +void extract_mip_3dm_get_event_support_command(microstrain_serializer* serializer, mip_3dm_get_event_support_command* self) +{ + extract_mip_3dm_get_event_support_command_query(serializer, &self->query); + +} + +void insert_mip_3dm_get_event_support_response(microstrain_serializer* serializer, const mip_3dm_get_event_support_response* self) +{ + insert_mip_3dm_get_event_support_command_query(serializer, self->query); + + microstrain_insert_u8(serializer, self->max_instances); + + microstrain_insert_u8(serializer, self->num_entries); + + + for(unsigned int i=0; i < self->num_entries; i++) + insert_mip_3dm_get_event_support_command_info(serializer, &self->entries[i]); + +} +void extract_mip_3dm_get_event_support_response(microstrain_serializer* serializer, mip_3dm_get_event_support_response* self) +{ + extract_mip_3dm_get_event_support_command_query(serializer, &self->query); + + microstrain_extract_u8(serializer, &self->max_instances); + + assert(self->num_entries); + microstrain_extract_count(serializer, &self->num_entries, sizeof(self->entries)/sizeof(self->entries[0])); + + for(unsigned int i=0; i < self->num_entries; i++) + extract_mip_3dm_get_event_support_command_info(serializer, &self->entries[i]); + +} + +mip_cmd_result mip_3dm_get_event_support(mip_interface* device, mip_3dm_get_event_support_command_query query, uint8_t* max_instances_out, uint8_t* num_entries_out, uint8_t num_entries_out_max, mip_3dm_get_event_support_command_info* entries_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_3dm_get_event_support_command_query(&serializer, query); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_SUPPORT, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_EVENT_SUPPORT, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + extract_mip_3dm_get_event_support_command_query(&deserializer, &query); + + assert(max_instances_out); + microstrain_extract_u8(&deserializer, max_instances_out); + + assert(num_entries_out); + microstrain_extract_count(&deserializer, num_entries_out, num_entries_out_max); + + assert(entries_out || (num_entries_out == 0)); + for(unsigned int i=0; i < *num_entries_out; i++) + extract_mip_3dm_get_event_support_command_info(&deserializer, &entries_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +void insert_mip_3dm_event_control_command(microstrain_serializer* serializer, const mip_3dm_event_control_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + microstrain_insert_u8(serializer, self->instance); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_3dm_event_control_command_mode(serializer, self->mode); + + } +} +void extract_mip_3dm_event_control_command(microstrain_serializer* serializer, mip_3dm_event_control_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + microstrain_extract_u8(serializer, &self->instance); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_3dm_event_control_command_mode(serializer, &self->mode); + + } +} + +void insert_mip_3dm_event_control_response(microstrain_serializer* serializer, const mip_3dm_event_control_response* self) +{ + microstrain_insert_u8(serializer, self->instance); + + insert_mip_3dm_event_control_command_mode(serializer, self->mode); + +} +void extract_mip_3dm_event_control_response(microstrain_serializer* serializer, mip_3dm_event_control_response* self) +{ + microstrain_extract_u8(serializer, &self->instance); + + extract_mip_3dm_event_control_command_mode(serializer, &self->mode); + +} + +mip_cmd_result mip_3dm_write_event_control(mip_interface* device, uint8_t instance, mip_3dm_event_control_command_mode mode) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_u8(&serializer, instance); + + insert_mip_3dm_event_control_command_mode(&serializer, mode); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_read_event_control(mip_interface* device, uint8_t instance, mip_3dm_event_control_command_mode* mode_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + microstrain_insert_u8(&serializer, instance); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_EVENT_CONTROL, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + microstrain_extract_u8(&deserializer, &instance); + + assert(mode_out); + extract_mip_3dm_event_control_command_mode(&deserializer, mode_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_3dm_save_event_control(mip_interface* device, uint8_t instance) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + microstrain_insert_u8(&serializer, instance); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_load_event_control(mip_interface* device, uint8_t instance) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + microstrain_insert_u8(&serializer, instance); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_default_event_control(mip_interface* device, uint8_t instance) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + microstrain_insert_u8(&serializer, instance); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_3dm_get_event_trigger_status_command_entry(microstrain_serializer* serializer, const mip_3dm_get_event_trigger_status_command_entry* self) +{ + microstrain_insert_u8(serializer, self->type); + + insert_mip_3dm_get_event_trigger_status_command_status(serializer, self->status); + +} +void extract_mip_3dm_get_event_trigger_status_command_entry(microstrain_serializer* serializer, mip_3dm_get_event_trigger_status_command_entry* self) +{ + microstrain_extract_u8(serializer, &self->type); + + extract_mip_3dm_get_event_trigger_status_command_status(serializer, &self->status); + +} + +void insert_mip_3dm_get_event_trigger_status_command(microstrain_serializer* serializer, const mip_3dm_get_event_trigger_status_command* self) +{ + microstrain_insert_u8(serializer, self->requested_count); + + + for(unsigned int i=0; i < self->requested_count; i++) + microstrain_insert_u8(serializer, self->requested_instances[i]); + +} +void extract_mip_3dm_get_event_trigger_status_command(microstrain_serializer* serializer, mip_3dm_get_event_trigger_status_command* self) +{ + assert(self->requested_count); + microstrain_extract_count(serializer, &self->requested_count, sizeof(self->requested_instances)/sizeof(self->requested_instances[0])); + + for(unsigned int i=0; i < self->requested_count; i++) + microstrain_extract_u8(serializer, &self->requested_instances[i]); + +} + +void insert_mip_3dm_get_event_trigger_status_response(microstrain_serializer* serializer, const mip_3dm_get_event_trigger_status_response* self) +{ + microstrain_insert_u8(serializer, self->count); + + + for(unsigned int i=0; i < self->count; i++) + insert_mip_3dm_get_event_trigger_status_command_entry(serializer, &self->triggers[i]); + +} +void extract_mip_3dm_get_event_trigger_status_response(microstrain_serializer* serializer, mip_3dm_get_event_trigger_status_response* self) +{ + assert(self->count); + microstrain_extract_count(serializer, &self->count, sizeof(self->triggers)/sizeof(self->triggers[0])); + + for(unsigned int i=0; i < self->count; i++) + extract_mip_3dm_get_event_trigger_status_command_entry(serializer, &self->triggers[i]); + +} + +mip_cmd_result mip_3dm_get_event_trigger_status(mip_interface* device, uint8_t requested_count, const uint8_t* requested_instances, uint8_t* count_out, uint8_t count_out_max, mip_3dm_get_event_trigger_status_command_entry* triggers_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + microstrain_insert_u8(&serializer, requested_count); + + assert(requested_instances || (requested_count == 0)); + for(unsigned int i=0; i < requested_count; i++) + microstrain_insert_u8(&serializer, requested_instances[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_TRIGGER_STATUS, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_EVENT_TRIGGER_STATUS, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(count_out); + microstrain_extract_count(&deserializer, count_out, count_out_max); + + assert(triggers_out || (count_out == 0)); + for(unsigned int i=0; i < *count_out; i++) + extract_mip_3dm_get_event_trigger_status_command_entry(&deserializer, &triggers_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +void insert_mip_3dm_get_event_action_status_command_entry(microstrain_serializer* serializer, const mip_3dm_get_event_action_status_command_entry* self) +{ + microstrain_insert_u8(serializer, self->action_type); + + microstrain_insert_u8(serializer, self->trigger_id); + +} +void extract_mip_3dm_get_event_action_status_command_entry(microstrain_serializer* serializer, mip_3dm_get_event_action_status_command_entry* self) +{ + microstrain_extract_u8(serializer, &self->action_type); + + microstrain_extract_u8(serializer, &self->trigger_id); + +} + +void insert_mip_3dm_get_event_action_status_command(microstrain_serializer* serializer, const mip_3dm_get_event_action_status_command* self) +{ + microstrain_insert_u8(serializer, self->requested_count); + + + for(unsigned int i=0; i < self->requested_count; i++) + microstrain_insert_u8(serializer, self->requested_instances[i]); + +} +void extract_mip_3dm_get_event_action_status_command(microstrain_serializer* serializer, mip_3dm_get_event_action_status_command* self) +{ + assert(self->requested_count); + microstrain_extract_count(serializer, &self->requested_count, sizeof(self->requested_instances)/sizeof(self->requested_instances[0])); + + for(unsigned int i=0; i < self->requested_count; i++) + microstrain_extract_u8(serializer, &self->requested_instances[i]); + +} + +void insert_mip_3dm_get_event_action_status_response(microstrain_serializer* serializer, const mip_3dm_get_event_action_status_response* self) +{ + microstrain_insert_u8(serializer, self->count); + + + for(unsigned int i=0; i < self->count; i++) + insert_mip_3dm_get_event_action_status_command_entry(serializer, &self->actions[i]); + +} +void extract_mip_3dm_get_event_action_status_response(microstrain_serializer* serializer, mip_3dm_get_event_action_status_response* self) +{ + assert(self->count); + microstrain_extract_count(serializer, &self->count, sizeof(self->actions)/sizeof(self->actions[0])); + + for(unsigned int i=0; i < self->count; i++) + extract_mip_3dm_get_event_action_status_command_entry(serializer, &self->actions[i]); + +} + +mip_cmd_result mip_3dm_get_event_action_status(mip_interface* device, uint8_t requested_count, const uint8_t* requested_instances, uint8_t* count_out, uint8_t count_out_max, mip_3dm_get_event_action_status_command_entry* actions_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + microstrain_insert_u8(&serializer, requested_count); + + assert(requested_instances || (requested_count == 0)); + for(unsigned int i=0; i < requested_count; i++) + microstrain_insert_u8(&serializer, requested_instances[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_ACTION_STATUS, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_EVENT_ACTION_STATUS, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(count_out); + microstrain_extract_count(&deserializer, count_out, count_out_max); + + assert(actions_out || (count_out == 0)); + for(unsigned int i=0; i < *count_out; i++) + extract_mip_3dm_get_event_action_status_command_entry(&deserializer, &actions_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +void insert_mip_3dm_event_trigger_command_gpio_params(microstrain_serializer* serializer, const mip_3dm_event_trigger_command_gpio_params* self) +{ + microstrain_insert_u8(serializer, self->pin); + + insert_mip_3dm_event_trigger_command_gpio_params_mode(serializer, self->mode); + +} +void extract_mip_3dm_event_trigger_command_gpio_params(microstrain_serializer* serializer, mip_3dm_event_trigger_command_gpio_params* self) +{ + microstrain_extract_u8(serializer, &self->pin); + + extract_mip_3dm_event_trigger_command_gpio_params_mode(serializer, &self->mode); + +} + +void insert_mip_3dm_event_trigger_command_threshold_params(microstrain_serializer* serializer, const mip_3dm_event_trigger_command_threshold_params* self) +{ + microstrain_insert_u8(serializer, self->desc_set); + + microstrain_insert_u8(serializer, self->field_desc); + + microstrain_insert_u8(serializer, self->param_id); + + insert_mip_3dm_event_trigger_command_threshold_params_type(serializer, self->type); + + if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_THRESHOLD_PARAMS_TYPE_WINDOW ) + { + microstrain_insert_double(serializer, self->low_thres); + + } + if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_THRESHOLD_PARAMS_TYPE_INTERVAL ) + { + microstrain_insert_double(serializer, self->int_thres); + + } + if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_THRESHOLD_PARAMS_TYPE_WINDOW ) + { + microstrain_insert_double(serializer, self->high_thres); + + } + if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_THRESHOLD_PARAMS_TYPE_INTERVAL ) + { + microstrain_insert_double(serializer, self->interval); + + } +} +void extract_mip_3dm_event_trigger_command_threshold_params(microstrain_serializer* serializer, mip_3dm_event_trigger_command_threshold_params* self) +{ + microstrain_extract_u8(serializer, &self->desc_set); + + microstrain_extract_u8(serializer, &self->field_desc); + + microstrain_extract_u8(serializer, &self->param_id); + + extract_mip_3dm_event_trigger_command_threshold_params_type(serializer, &self->type); + + if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_THRESHOLD_PARAMS_TYPE_WINDOW ) + { + microstrain_extract_double(serializer, &self->low_thres); + + } + if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_THRESHOLD_PARAMS_TYPE_INTERVAL ) + { + microstrain_extract_double(serializer, &self->int_thres); + + } + if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_THRESHOLD_PARAMS_TYPE_WINDOW ) + { + microstrain_extract_double(serializer, &self->high_thres); + + } + if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_THRESHOLD_PARAMS_TYPE_INTERVAL ) + { + microstrain_extract_double(serializer, &self->interval); + + } +} + +void insert_mip_3dm_event_trigger_command_combination_params(microstrain_serializer* serializer, const mip_3dm_event_trigger_command_combination_params* self) +{ + microstrain_insert_u16(serializer, self->logic_table); + + for(unsigned int i=0; i < 4; i++) + microstrain_insert_u8(serializer, self->input_triggers[i]); + +} +void extract_mip_3dm_event_trigger_command_combination_params(microstrain_serializer* serializer, mip_3dm_event_trigger_command_combination_params* self) +{ + microstrain_extract_u16(serializer, &self->logic_table); + + for(unsigned int i=0; i < 4; i++) + microstrain_extract_u8(serializer, &self->input_triggers[i]); + +} + +void insert_mip_3dm_event_trigger_command(microstrain_serializer* serializer, const mip_3dm_event_trigger_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + microstrain_insert_u8(serializer, self->instance); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_3dm_event_trigger_command_type(serializer, self->type); + + if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_GPIO ) + { + insert_mip_3dm_event_trigger_command_gpio_params(serializer, &self->parameters.gpio); + + } + if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_THRESHOLD ) + { + insert_mip_3dm_event_trigger_command_threshold_params(serializer, &self->parameters.threshold); + + } + if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_COMBINATION ) + { + insert_mip_3dm_event_trigger_command_combination_params(serializer, &self->parameters.combination); + + } + } +} +void extract_mip_3dm_event_trigger_command(microstrain_serializer* serializer, mip_3dm_event_trigger_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + microstrain_extract_u8(serializer, &self->instance); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_3dm_event_trigger_command_type(serializer, &self->type); + + if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_GPIO ) + { + extract_mip_3dm_event_trigger_command_gpio_params(serializer, &self->parameters.gpio); + + } + if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_THRESHOLD ) + { + extract_mip_3dm_event_trigger_command_threshold_params(serializer, &self->parameters.threshold); + + } + if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_COMBINATION ) + { + extract_mip_3dm_event_trigger_command_combination_params(serializer, &self->parameters.combination); + + } + } +} + +void insert_mip_3dm_event_trigger_response(microstrain_serializer* serializer, const mip_3dm_event_trigger_response* self) +{ + microstrain_insert_u8(serializer, self->instance); + + insert_mip_3dm_event_trigger_command_type(serializer, self->type); + + if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_GPIO ) + { + insert_mip_3dm_event_trigger_command_gpio_params(serializer, &self->parameters.gpio); + + } + if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_THRESHOLD ) + { + insert_mip_3dm_event_trigger_command_threshold_params(serializer, &self->parameters.threshold); + + } + if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_COMBINATION ) + { + insert_mip_3dm_event_trigger_command_combination_params(serializer, &self->parameters.combination); + + } +} +void extract_mip_3dm_event_trigger_response(microstrain_serializer* serializer, mip_3dm_event_trigger_response* self) +{ + microstrain_extract_u8(serializer, &self->instance); + + extract_mip_3dm_event_trigger_command_type(serializer, &self->type); + + if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_GPIO ) + { + extract_mip_3dm_event_trigger_command_gpio_params(serializer, &self->parameters.gpio); + + } + if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_THRESHOLD ) + { + extract_mip_3dm_event_trigger_command_threshold_params(serializer, &self->parameters.threshold); + + } + if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_COMBINATION ) + { + extract_mip_3dm_event_trigger_command_combination_params(serializer, &self->parameters.combination); + + } +} + +mip_cmd_result mip_3dm_write_event_trigger(mip_interface* device, uint8_t instance, mip_3dm_event_trigger_command_type type, const mip_3dm_event_trigger_command_parameters* parameters) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_u8(&serializer, instance); + + insert_mip_3dm_event_trigger_command_type(&serializer, type); + + if( type == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_GPIO ) + { + insert_mip_3dm_event_trigger_command_gpio_params(&serializer, ¶meters->gpio); + + } + if( type == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_THRESHOLD ) + { + insert_mip_3dm_event_trigger_command_threshold_params(&serializer, ¶meters->threshold); + + } + if( type == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_COMBINATION ) + { + insert_mip_3dm_event_trigger_command_combination_params(&serializer, ¶meters->combination); + + } + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_TRIGGER_CONFIG, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_read_event_trigger(mip_interface* device, uint8_t instance, mip_3dm_event_trigger_command_type* type_out, mip_3dm_event_trigger_command_parameters* parameters_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + microstrain_insert_u8(&serializer, instance); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_TRIGGER_CONFIG, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_EVENT_TRIGGER_CONFIG, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + microstrain_extract_u8(&deserializer, &instance); + + assert(type_out); + extract_mip_3dm_event_trigger_command_type(&deserializer, type_out); + + if( *type_out == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_GPIO ) + { + extract_mip_3dm_event_trigger_command_gpio_params(&deserializer, ¶meters_out->gpio); + + } + if( *type_out == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_THRESHOLD ) + { + extract_mip_3dm_event_trigger_command_threshold_params(&deserializer, ¶meters_out->threshold); + + } + if( *type_out == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_COMBINATION ) + { + extract_mip_3dm_event_trigger_command_combination_params(&deserializer, ¶meters_out->combination); + + } + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_3dm_save_event_trigger(mip_interface* device, uint8_t instance) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + microstrain_insert_u8(&serializer, instance); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_TRIGGER_CONFIG, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_load_event_trigger(mip_interface* device, uint8_t instance) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + microstrain_insert_u8(&serializer, instance); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_TRIGGER_CONFIG, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_default_event_trigger(mip_interface* device, uint8_t instance) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + microstrain_insert_u8(&serializer, instance); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_TRIGGER_CONFIG, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_3dm_event_action_command_gpio_params(microstrain_serializer* serializer, const mip_3dm_event_action_command_gpio_params* self) +{ + microstrain_insert_u8(serializer, self->pin); + + insert_mip_3dm_event_action_command_gpio_params_mode(serializer, self->mode); + +} +void extract_mip_3dm_event_action_command_gpio_params(microstrain_serializer* serializer, mip_3dm_event_action_command_gpio_params* self) +{ + microstrain_extract_u8(serializer, &self->pin); + + extract_mip_3dm_event_action_command_gpio_params_mode(serializer, &self->mode); + +} + +void insert_mip_3dm_event_action_command_message_params(microstrain_serializer* serializer, const mip_3dm_event_action_command_message_params* self) +{ + microstrain_insert_u8(serializer, self->desc_set); + + microstrain_insert_u16(serializer, self->decimation); + + microstrain_insert_u8(serializer, self->num_fields); + + + for(unsigned int i=0; i < self->num_fields; i++) + microstrain_insert_u8(serializer, self->descriptors[i]); + +} +void extract_mip_3dm_event_action_command_message_params(microstrain_serializer* serializer, mip_3dm_event_action_command_message_params* self) +{ + microstrain_extract_u8(serializer, &self->desc_set); + + microstrain_extract_u16(serializer, &self->decimation); + + assert(self->num_fields); + microstrain_extract_count(serializer, &self->num_fields, sizeof(self->descriptors)/sizeof(self->descriptors[0])); + + for(unsigned int i=0; i < self->num_fields; i++) + microstrain_extract_u8(serializer, &self->descriptors[i]); + +} + +void insert_mip_3dm_event_action_command(microstrain_serializer* serializer, const mip_3dm_event_action_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + microstrain_insert_u8(serializer, self->instance); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_u8(serializer, self->trigger); + + insert_mip_3dm_event_action_command_type(serializer, self->type); + + if( self->type == MIP_3DM_EVENT_ACTION_COMMAND_TYPE_GPIO ) + { + insert_mip_3dm_event_action_command_gpio_params(serializer, &self->parameters.gpio); + + } + if( self->type == MIP_3DM_EVENT_ACTION_COMMAND_TYPE_MESSAGE ) + { + insert_mip_3dm_event_action_command_message_params(serializer, &self->parameters.message); + + } + } +} +void extract_mip_3dm_event_action_command(microstrain_serializer* serializer, mip_3dm_event_action_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + microstrain_extract_u8(serializer, &self->instance); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_extract_u8(serializer, &self->trigger); + + extract_mip_3dm_event_action_command_type(serializer, &self->type); + + if( self->type == MIP_3DM_EVENT_ACTION_COMMAND_TYPE_GPIO ) + { + extract_mip_3dm_event_action_command_gpio_params(serializer, &self->parameters.gpio); + + } + if( self->type == MIP_3DM_EVENT_ACTION_COMMAND_TYPE_MESSAGE ) + { + extract_mip_3dm_event_action_command_message_params(serializer, &self->parameters.message); + + } + } +} + +void insert_mip_3dm_event_action_response(microstrain_serializer* serializer, const mip_3dm_event_action_response* self) +{ + microstrain_insert_u8(serializer, self->instance); + + microstrain_insert_u8(serializer, self->trigger); + + insert_mip_3dm_event_action_command_type(serializer, self->type); + + if( self->type == MIP_3DM_EVENT_ACTION_COMMAND_TYPE_GPIO ) + { + insert_mip_3dm_event_action_command_gpio_params(serializer, &self->parameters.gpio); + + } + if( self->type == MIP_3DM_EVENT_ACTION_COMMAND_TYPE_MESSAGE ) + { + insert_mip_3dm_event_action_command_message_params(serializer, &self->parameters.message); + + } +} +void extract_mip_3dm_event_action_response(microstrain_serializer* serializer, mip_3dm_event_action_response* self) +{ + microstrain_extract_u8(serializer, &self->instance); + + microstrain_extract_u8(serializer, &self->trigger); + + extract_mip_3dm_event_action_command_type(serializer, &self->type); + + if( self->type == MIP_3DM_EVENT_ACTION_COMMAND_TYPE_GPIO ) + { + extract_mip_3dm_event_action_command_gpio_params(serializer, &self->parameters.gpio); + + } + if( self->type == MIP_3DM_EVENT_ACTION_COMMAND_TYPE_MESSAGE ) + { + extract_mip_3dm_event_action_command_message_params(serializer, &self->parameters.message); + + } +} + +mip_cmd_result mip_3dm_write_event_action(mip_interface* device, uint8_t instance, uint8_t trigger, mip_3dm_event_action_command_type type, const mip_3dm_event_action_command_parameters* parameters) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_u8(&serializer, instance); + + microstrain_insert_u8(&serializer, trigger); + + insert_mip_3dm_event_action_command_type(&serializer, type); + + if( type == MIP_3DM_EVENT_ACTION_COMMAND_TYPE_GPIO ) + { + insert_mip_3dm_event_action_command_gpio_params(&serializer, ¶meters->gpio); + + } + if( type == MIP_3DM_EVENT_ACTION_COMMAND_TYPE_MESSAGE ) + { + insert_mip_3dm_event_action_command_message_params(&serializer, ¶meters->message); + + } + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_ACTION_CONFIG, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_read_event_action(mip_interface* device, uint8_t instance, uint8_t* trigger_out, mip_3dm_event_action_command_type* type_out, mip_3dm_event_action_command_parameters* parameters_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + microstrain_insert_u8(&serializer, instance); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_ACTION_CONFIG, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_EVENT_ACTION_CONFIG, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + microstrain_extract_u8(&deserializer, &instance); + + assert(trigger_out); + microstrain_extract_u8(&deserializer, trigger_out); + + assert(type_out); + extract_mip_3dm_event_action_command_type(&deserializer, type_out); + + if( *type_out == MIP_3DM_EVENT_ACTION_COMMAND_TYPE_GPIO ) + { + extract_mip_3dm_event_action_command_gpio_params(&deserializer, ¶meters_out->gpio); + + } + if( *type_out == MIP_3DM_EVENT_ACTION_COMMAND_TYPE_MESSAGE ) + { + extract_mip_3dm_event_action_command_message_params(&deserializer, ¶meters_out->message); + + } + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_3dm_save_event_action(mip_interface* device, uint8_t instance) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + microstrain_insert_u8(&serializer, instance); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_ACTION_CONFIG, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_load_event_action(mip_interface* device, uint8_t instance) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + microstrain_insert_u8(&serializer, instance); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_ACTION_CONFIG, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_default_event_action(mip_interface* device, uint8_t instance) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + microstrain_insert_u8(&serializer, instance); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_ACTION_CONFIG, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_3dm_accel_bias_command(microstrain_serializer* serializer, const mip_3dm_accel_bias_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_vector3f(serializer, self->bias); + + } +} +void extract_mip_3dm_accel_bias_command(microstrain_serializer* serializer, mip_3dm_accel_bias_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_vector3f(serializer, self->bias); + + } +} + +void insert_mip_3dm_accel_bias_response(microstrain_serializer* serializer, const mip_3dm_accel_bias_response* self) +{ + insert_mip_vector3f(serializer, self->bias); + +} +void extract_mip_3dm_accel_bias_response(microstrain_serializer* serializer, mip_3dm_accel_bias_response* self) +{ + extract_mip_vector3f(serializer, self->bias); + +} + +mip_cmd_result mip_3dm_write_accel_bias(mip_interface* device, const float* bias) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + assert(bias); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_float(&serializer, bias[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_ACCEL_BIAS, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_read_accel_bias(mip_interface* device, float* bias_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_ACCEL_BIAS, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_ACCEL_BIAS_VECTOR, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(bias_out); + for(unsigned int i=0; i < 3; i++) + microstrain_extract_float(&deserializer, &bias_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_3dm_save_accel_bias(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_ACCEL_BIAS, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_load_accel_bias(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_ACCEL_BIAS, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_default_accel_bias(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_ACCEL_BIAS, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_3dm_gyro_bias_command(microstrain_serializer* serializer, const mip_3dm_gyro_bias_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_vector3f(serializer, self->bias); + + } +} +void extract_mip_3dm_gyro_bias_command(microstrain_serializer* serializer, mip_3dm_gyro_bias_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_vector3f(serializer, self->bias); + + } +} + +void insert_mip_3dm_gyro_bias_response(microstrain_serializer* serializer, const mip_3dm_gyro_bias_response* self) +{ + insert_mip_vector3f(serializer, self->bias); + +} +void extract_mip_3dm_gyro_bias_response(microstrain_serializer* serializer, mip_3dm_gyro_bias_response* self) +{ + extract_mip_vector3f(serializer, self->bias); + +} + +mip_cmd_result mip_3dm_write_gyro_bias(mip_interface* device, const float* bias) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + assert(bias); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_float(&serializer, bias[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GYRO_BIAS, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_read_gyro_bias(mip_interface* device, float* bias_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GYRO_BIAS, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_GYRO_BIAS_VECTOR, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(bias_out); + for(unsigned int i=0; i < 3; i++) + microstrain_extract_float(&deserializer, &bias_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_3dm_save_gyro_bias(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GYRO_BIAS, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_load_gyro_bias(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GYRO_BIAS, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_default_gyro_bias(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GYRO_BIAS, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_3dm_capture_gyro_bias_command(microstrain_serializer* serializer, const mip_3dm_capture_gyro_bias_command* self) +{ + microstrain_insert_u16(serializer, self->averaging_time_ms); + +} +void extract_mip_3dm_capture_gyro_bias_command(microstrain_serializer* serializer, mip_3dm_capture_gyro_bias_command* self) +{ + microstrain_extract_u16(serializer, &self->averaging_time_ms); + +} + +void insert_mip_3dm_capture_gyro_bias_response(microstrain_serializer* serializer, const mip_3dm_capture_gyro_bias_response* self) +{ + insert_mip_vector3f(serializer, self->bias); + +} +void extract_mip_3dm_capture_gyro_bias_response(microstrain_serializer* serializer, mip_3dm_capture_gyro_bias_response* self) +{ + extract_mip_vector3f(serializer, self->bias); + +} + +mip_cmd_result mip_3dm_capture_gyro_bias(mip_interface* device, uint16_t averaging_time_ms, float* bias_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + microstrain_insert_u16(&serializer, averaging_time_ms); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_CAPTURE_GYRO_BIAS, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_GYRO_BIAS_VECTOR, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(bias_out); + for(unsigned int i=0; i < 3; i++) + microstrain_extract_float(&deserializer, &bias_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +void insert_mip_3dm_mag_hard_iron_offset_command(microstrain_serializer* serializer, const mip_3dm_mag_hard_iron_offset_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_vector3f(serializer, self->offset); + + } +} +void extract_mip_3dm_mag_hard_iron_offset_command(microstrain_serializer* serializer, mip_3dm_mag_hard_iron_offset_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_vector3f(serializer, self->offset); + + } +} + +void insert_mip_3dm_mag_hard_iron_offset_response(microstrain_serializer* serializer, const mip_3dm_mag_hard_iron_offset_response* self) +{ + insert_mip_vector3f(serializer, self->offset); + +} +void extract_mip_3dm_mag_hard_iron_offset_response(microstrain_serializer* serializer, mip_3dm_mag_hard_iron_offset_response* self) +{ + extract_mip_vector3f(serializer, self->offset); + +} + +mip_cmd_result mip_3dm_write_mag_hard_iron_offset(mip_interface* device, const float* offset) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + assert(offset); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_float(&serializer, offset[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_HARD_IRON_OFFSET, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_read_mag_hard_iron_offset(mip_interface* device, float* offset_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_HARD_IRON_OFFSET, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_HARD_IRON_OFFSET_VECTOR, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(offset_out); + for(unsigned int i=0; i < 3; i++) + microstrain_extract_float(&deserializer, &offset_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_3dm_save_mag_hard_iron_offset(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_HARD_IRON_OFFSET, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_load_mag_hard_iron_offset(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_HARD_IRON_OFFSET, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_default_mag_hard_iron_offset(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_HARD_IRON_OFFSET, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_3dm_mag_soft_iron_matrix_command(microstrain_serializer* serializer, const mip_3dm_mag_soft_iron_matrix_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_matrix3f(serializer, self->offset); + + } +} +void extract_mip_3dm_mag_soft_iron_matrix_command(microstrain_serializer* serializer, mip_3dm_mag_soft_iron_matrix_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_matrix3f(serializer, self->offset); + + } +} + +void insert_mip_3dm_mag_soft_iron_matrix_response(microstrain_serializer* serializer, const mip_3dm_mag_soft_iron_matrix_response* self) +{ + insert_mip_matrix3f(serializer, self->offset); + +} +void extract_mip_3dm_mag_soft_iron_matrix_response(microstrain_serializer* serializer, mip_3dm_mag_soft_iron_matrix_response* self) +{ + extract_mip_matrix3f(serializer, self->offset); + +} + +mip_cmd_result mip_3dm_write_mag_soft_iron_matrix(mip_interface* device, const float* offset) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + assert(offset); + for(unsigned int i=0; i < 9; i++) + microstrain_insert_float(&serializer, offset[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SOFT_IRON_MATRIX, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_read_mag_soft_iron_matrix(mip_interface* device, float* offset_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SOFT_IRON_MATRIX, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_SOFT_IRON_COMP_MATRIX, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(offset_out); + for(unsigned int i=0; i < 9; i++) + microstrain_extract_float(&deserializer, &offset_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_3dm_save_mag_soft_iron_matrix(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SOFT_IRON_MATRIX, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_load_mag_soft_iron_matrix(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SOFT_IRON_MATRIX, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_default_mag_soft_iron_matrix(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SOFT_IRON_MATRIX, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_3dm_coning_sculling_enable_command(microstrain_serializer* serializer, const mip_3dm_coning_sculling_enable_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_bool(serializer, self->enable); + + } +} +void extract_mip_3dm_coning_sculling_enable_command(microstrain_serializer* serializer, mip_3dm_coning_sculling_enable_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_extract_bool(serializer, &self->enable); + + } +} + +void insert_mip_3dm_coning_sculling_enable_response(microstrain_serializer* serializer, const mip_3dm_coning_sculling_enable_response* self) +{ + microstrain_insert_bool(serializer, self->enable); + +} +void extract_mip_3dm_coning_sculling_enable_response(microstrain_serializer* serializer, mip_3dm_coning_sculling_enable_response* self) +{ + microstrain_extract_bool(serializer, &self->enable); + +} + +mip_cmd_result mip_3dm_write_coning_sculling_enable(mip_interface* device, bool enable) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_bool(&serializer, enable); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_CONING_AND_SCULLING_ENABLE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_read_coning_sculling_enable(mip_interface* device, bool* enable_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_CONING_AND_SCULLING_ENABLE, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_CONING_AND_SCULLING_ENABLE, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(enable_out); + microstrain_extract_bool(&deserializer, enable_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_3dm_save_coning_sculling_enable(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_CONING_AND_SCULLING_ENABLE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_load_coning_sculling_enable(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_CONING_AND_SCULLING_ENABLE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_default_coning_sculling_enable(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_CONING_AND_SCULLING_ENABLE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_3dm_sensor_2_vehicle_transform_euler_command(microstrain_serializer* serializer, const mip_3dm_sensor_2_vehicle_transform_euler_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_float(serializer, self->roll); + + microstrain_insert_float(serializer, self->pitch); + + microstrain_insert_float(serializer, self->yaw); + + } +} +void extract_mip_3dm_sensor_2_vehicle_transform_euler_command(microstrain_serializer* serializer, mip_3dm_sensor_2_vehicle_transform_euler_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_extract_float(serializer, &self->roll); + + microstrain_extract_float(serializer, &self->pitch); + + microstrain_extract_float(serializer, &self->yaw); + + } +} + +void insert_mip_3dm_sensor_2_vehicle_transform_euler_response(microstrain_serializer* serializer, const mip_3dm_sensor_2_vehicle_transform_euler_response* self) +{ + microstrain_insert_float(serializer, self->roll); + + microstrain_insert_float(serializer, self->pitch); + + microstrain_insert_float(serializer, self->yaw); + +} +void extract_mip_3dm_sensor_2_vehicle_transform_euler_response(microstrain_serializer* serializer, mip_3dm_sensor_2_vehicle_transform_euler_response* self) +{ + microstrain_extract_float(serializer, &self->roll); + + microstrain_extract_float(serializer, &self->pitch); + + microstrain_extract_float(serializer, &self->yaw); + +} + +mip_cmd_result mip_3dm_write_sensor_2_vehicle_transform_euler(mip_interface* device, float roll, float pitch, float yaw) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_float(&serializer, roll); + + microstrain_insert_float(&serializer, pitch); + + microstrain_insert_float(&serializer, yaw); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_EUL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_read_sensor_2_vehicle_transform_euler(mip_interface* device, float* roll_out, float* pitch_out, float* yaw_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_EUL, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_EUL, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(roll_out); + microstrain_extract_float(&deserializer, roll_out); + + assert(pitch_out); + microstrain_extract_float(&deserializer, pitch_out); + + assert(yaw_out); + microstrain_extract_float(&deserializer, yaw_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_3dm_save_sensor_2_vehicle_transform_euler(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_EUL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_load_sensor_2_vehicle_transform_euler(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_EUL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_default_sensor_2_vehicle_transform_euler(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_EUL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_3dm_sensor_2_vehicle_transform_quaternion_command(microstrain_serializer* serializer, const mip_3dm_sensor_2_vehicle_transform_quaternion_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_quatf(serializer, self->q); + + } +} +void extract_mip_3dm_sensor_2_vehicle_transform_quaternion_command(microstrain_serializer* serializer, mip_3dm_sensor_2_vehicle_transform_quaternion_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_quatf(serializer, self->q); + + } +} + +void insert_mip_3dm_sensor_2_vehicle_transform_quaternion_response(microstrain_serializer* serializer, const mip_3dm_sensor_2_vehicle_transform_quaternion_response* self) +{ + insert_mip_quatf(serializer, self->q); + +} +void extract_mip_3dm_sensor_2_vehicle_transform_quaternion_response(microstrain_serializer* serializer, mip_3dm_sensor_2_vehicle_transform_quaternion_response* self) +{ + extract_mip_quatf(serializer, self->q); + +} + +mip_cmd_result mip_3dm_write_sensor_2_vehicle_transform_quaternion(mip_interface* device, const float* q) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + assert(q); + for(unsigned int i=0; i < 4; i++) + microstrain_insert_float(&serializer, q[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_QUAT, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_read_sensor_2_vehicle_transform_quaternion(mip_interface* device, float* q_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_QUAT, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_QUAT, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(q_out); + for(unsigned int i=0; i < 4; i++) + microstrain_extract_float(&deserializer, &q_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_3dm_save_sensor_2_vehicle_transform_quaternion(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_QUAT, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_load_sensor_2_vehicle_transform_quaternion(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_QUAT, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_default_sensor_2_vehicle_transform_quaternion(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_QUAT, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_3dm_sensor_2_vehicle_transform_dcm_command(microstrain_serializer* serializer, const mip_3dm_sensor_2_vehicle_transform_dcm_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_matrix3f(serializer, self->dcm); + + } +} +void extract_mip_3dm_sensor_2_vehicle_transform_dcm_command(microstrain_serializer* serializer, mip_3dm_sensor_2_vehicle_transform_dcm_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_matrix3f(serializer, self->dcm); + + } +} + +void insert_mip_3dm_sensor_2_vehicle_transform_dcm_response(microstrain_serializer* serializer, const mip_3dm_sensor_2_vehicle_transform_dcm_response* self) +{ + insert_mip_matrix3f(serializer, self->dcm); + +} +void extract_mip_3dm_sensor_2_vehicle_transform_dcm_response(microstrain_serializer* serializer, mip_3dm_sensor_2_vehicle_transform_dcm_response* self) +{ + extract_mip_matrix3f(serializer, self->dcm); + +} + +mip_cmd_result mip_3dm_write_sensor_2_vehicle_transform_dcm(mip_interface* device, const float* dcm) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + assert(dcm); + for(unsigned int i=0; i < 9; i++) + microstrain_insert_float(&serializer, dcm[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_DCM, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_read_sensor_2_vehicle_transform_dcm(mip_interface* device, float* dcm_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_DCM, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_DCM, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(dcm_out); + for(unsigned int i=0; i < 9; i++) + microstrain_extract_float(&deserializer, &dcm_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_3dm_save_sensor_2_vehicle_transform_dcm(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_DCM, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_load_sensor_2_vehicle_transform_dcm(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_DCM, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_default_sensor_2_vehicle_transform_dcm(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_DCM, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_3dm_complementary_filter_command(microstrain_serializer* serializer, const mip_3dm_complementary_filter_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_bool(serializer, self->pitch_roll_enable); + + microstrain_insert_bool(serializer, self->heading_enable); + + microstrain_insert_float(serializer, self->pitch_roll_time_constant); + + microstrain_insert_float(serializer, self->heading_time_constant); + + } +} +void extract_mip_3dm_complementary_filter_command(microstrain_serializer* serializer, mip_3dm_complementary_filter_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_extract_bool(serializer, &self->pitch_roll_enable); + + microstrain_extract_bool(serializer, &self->heading_enable); + + microstrain_extract_float(serializer, &self->pitch_roll_time_constant); + + microstrain_extract_float(serializer, &self->heading_time_constant); + + } +} + +void insert_mip_3dm_complementary_filter_response(microstrain_serializer* serializer, const mip_3dm_complementary_filter_response* self) +{ + microstrain_insert_bool(serializer, self->pitch_roll_enable); + + microstrain_insert_bool(serializer, self->heading_enable); + + microstrain_insert_float(serializer, self->pitch_roll_time_constant); + + microstrain_insert_float(serializer, self->heading_time_constant); + +} +void extract_mip_3dm_complementary_filter_response(microstrain_serializer* serializer, mip_3dm_complementary_filter_response* self) +{ + microstrain_extract_bool(serializer, &self->pitch_roll_enable); + + microstrain_extract_bool(serializer, &self->heading_enable); + + microstrain_extract_float(serializer, &self->pitch_roll_time_constant); + + microstrain_extract_float(serializer, &self->heading_time_constant); + +} + +mip_cmd_result mip_3dm_write_complementary_filter(mip_interface* device, bool pitch_roll_enable, bool heading_enable, float pitch_roll_time_constant, float heading_time_constant) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_bool(&serializer, pitch_roll_enable); + + microstrain_insert_bool(&serializer, heading_enable); + + microstrain_insert_float(&serializer, pitch_roll_time_constant); + + microstrain_insert_float(&serializer, heading_time_constant); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_LEGACY_COMP_FILTER, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_read_complementary_filter(mip_interface* device, bool* pitch_roll_enable_out, bool* heading_enable_out, float* pitch_roll_time_constant_out, float* heading_time_constant_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_LEGACY_COMP_FILTER, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_LEGACY_COMP_FILTER, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(pitch_roll_enable_out); + microstrain_extract_bool(&deserializer, pitch_roll_enable_out); + + assert(heading_enable_out); + microstrain_extract_bool(&deserializer, heading_enable_out); + + assert(pitch_roll_time_constant_out); + microstrain_extract_float(&deserializer, pitch_roll_time_constant_out); + + assert(heading_time_constant_out); + microstrain_extract_float(&deserializer, heading_time_constant_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_3dm_save_complementary_filter(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_LEGACY_COMP_FILTER, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_load_complementary_filter(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_LEGACY_COMP_FILTER, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_default_complementary_filter(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_LEGACY_COMP_FILTER, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_3dm_sensor_range_command(microstrain_serializer* serializer, const mip_3dm_sensor_range_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + insert_mip_sensor_range_type(serializer, self->sensor); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_u8(serializer, self->setting); + + } +} +void extract_mip_3dm_sensor_range_command(microstrain_serializer* serializer, mip_3dm_sensor_range_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + extract_mip_sensor_range_type(serializer, &self->sensor); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_extract_u8(serializer, &self->setting); + + } +} + +void insert_mip_3dm_sensor_range_response(microstrain_serializer* serializer, const mip_3dm_sensor_range_response* self) +{ + insert_mip_sensor_range_type(serializer, self->sensor); + + microstrain_insert_u8(serializer, self->setting); + +} +void extract_mip_3dm_sensor_range_response(microstrain_serializer* serializer, mip_3dm_sensor_range_response* self) +{ + extract_mip_sensor_range_type(serializer, &self->sensor); + + microstrain_extract_u8(serializer, &self->setting); + +} + +mip_cmd_result mip_3dm_write_sensor_range(mip_interface* device, mip_sensor_range_type sensor, uint8_t setting) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + insert_mip_sensor_range_type(&serializer, sensor); + + microstrain_insert_u8(&serializer, setting); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR_RANGE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_read_sensor_range(mip_interface* device, mip_sensor_range_type sensor, uint8_t* setting_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + insert_mip_sensor_range_type(&serializer, sensor); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR_RANGE, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_SENSOR_RANGE, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + extract_mip_sensor_range_type(&deserializer, &sensor); + + assert(setting_out); + microstrain_extract_u8(&deserializer, setting_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_3dm_save_sensor_range(mip_interface* device, mip_sensor_range_type sensor) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + insert_mip_sensor_range_type(&serializer, sensor); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR_RANGE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_load_sensor_range(mip_interface* device, mip_sensor_range_type sensor) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + insert_mip_sensor_range_type(&serializer, sensor); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR_RANGE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_default_sensor_range(mip_interface* device, mip_sensor_range_type sensor) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + insert_mip_sensor_range_type(&serializer, sensor); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR_RANGE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_3dm_calibrated_sensor_ranges_command_entry(microstrain_serializer* serializer, const mip_3dm_calibrated_sensor_ranges_command_entry* self) +{ + microstrain_insert_u8(serializer, self->setting); + + microstrain_insert_float(serializer, self->range); + +} +void extract_mip_3dm_calibrated_sensor_ranges_command_entry(microstrain_serializer* serializer, mip_3dm_calibrated_sensor_ranges_command_entry* self) +{ + microstrain_extract_u8(serializer, &self->setting); + + microstrain_extract_float(serializer, &self->range); + +} + +void insert_mip_3dm_calibrated_sensor_ranges_command(microstrain_serializer* serializer, const mip_3dm_calibrated_sensor_ranges_command* self) +{ + insert_mip_sensor_range_type(serializer, self->sensor); + +} +void extract_mip_3dm_calibrated_sensor_ranges_command(microstrain_serializer* serializer, mip_3dm_calibrated_sensor_ranges_command* self) +{ + extract_mip_sensor_range_type(serializer, &self->sensor); + +} + +void insert_mip_3dm_calibrated_sensor_ranges_response(microstrain_serializer* serializer, const mip_3dm_calibrated_sensor_ranges_response* self) +{ + insert_mip_sensor_range_type(serializer, self->sensor); + + microstrain_insert_u8(serializer, self->num_ranges); + + + for(unsigned int i=0; i < self->num_ranges; i++) + insert_mip_3dm_calibrated_sensor_ranges_command_entry(serializer, &self->ranges[i]); + +} +void extract_mip_3dm_calibrated_sensor_ranges_response(microstrain_serializer* serializer, mip_3dm_calibrated_sensor_ranges_response* self) +{ + extract_mip_sensor_range_type(serializer, &self->sensor); + + assert(self->num_ranges); + microstrain_extract_count(serializer, &self->num_ranges, sizeof(self->ranges)/sizeof(self->ranges[0])); + + for(unsigned int i=0; i < self->num_ranges; i++) + extract_mip_3dm_calibrated_sensor_ranges_command_entry(serializer, &self->ranges[i]); + +} + +mip_cmd_result mip_3dm_calibrated_sensor_ranges(mip_interface* device, mip_sensor_range_type sensor, uint8_t* num_ranges_out, uint8_t num_ranges_out_max, mip_3dm_calibrated_sensor_ranges_command_entry* ranges_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_sensor_range_type(&serializer, sensor); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_CALIBRATED_RANGES, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_CALIBRATED_RANGES, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + extract_mip_sensor_range_type(&deserializer, &sensor); + + assert(num_ranges_out); + microstrain_extract_count(&deserializer, num_ranges_out, num_ranges_out_max); + + assert(ranges_out || (num_ranges_out == 0)); + for(unsigned int i=0; i < *num_ranges_out; i++) + extract_mip_3dm_calibrated_sensor_ranges_command_entry(&deserializer, &ranges_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +void insert_mip_3dm_lowpass_filter_command(microstrain_serializer* serializer, const mip_3dm_lowpass_filter_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + microstrain_insert_u8(serializer, self->desc_set); + + microstrain_insert_u8(serializer, self->field_desc); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_bool(serializer, self->enable); + + microstrain_insert_bool(serializer, self->manual); + + microstrain_insert_float(serializer, self->frequency); + + } +} +void extract_mip_3dm_lowpass_filter_command(microstrain_serializer* serializer, mip_3dm_lowpass_filter_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + microstrain_extract_u8(serializer, &self->desc_set); + + microstrain_extract_u8(serializer, &self->field_desc); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_extract_bool(serializer, &self->enable); + + microstrain_extract_bool(serializer, &self->manual); + + microstrain_extract_float(serializer, &self->frequency); + + } +} + +void insert_mip_3dm_lowpass_filter_response(microstrain_serializer* serializer, const mip_3dm_lowpass_filter_response* self) +{ + microstrain_insert_u8(serializer, self->desc_set); + + microstrain_insert_u8(serializer, self->field_desc); + + microstrain_insert_bool(serializer, self->enable); + + microstrain_insert_bool(serializer, self->manual); + + microstrain_insert_float(serializer, self->frequency); + +} +void extract_mip_3dm_lowpass_filter_response(microstrain_serializer* serializer, mip_3dm_lowpass_filter_response* self) +{ + microstrain_extract_u8(serializer, &self->desc_set); + + microstrain_extract_u8(serializer, &self->field_desc); + + microstrain_extract_bool(serializer, &self->enable); + + microstrain_extract_bool(serializer, &self->manual); + + microstrain_extract_float(serializer, &self->frequency); + +} + +mip_cmd_result mip_3dm_write_lowpass_filter(mip_interface* device, uint8_t desc_set, uint8_t field_desc, bool enable, bool manual, float frequency) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_u8(&serializer, desc_set); + + microstrain_insert_u8(&serializer, field_desc); + + microstrain_insert_bool(&serializer, enable); + + microstrain_insert_bool(&serializer, manual); + + microstrain_insert_float(&serializer, frequency); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_LOWPASS_FILTER, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_read_lowpass_filter(mip_interface* device, uint8_t desc_set, uint8_t field_desc, bool* enable_out, bool* manual_out, float* frequency_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + microstrain_insert_u8(&serializer, desc_set); + + microstrain_insert_u8(&serializer, field_desc); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_LOWPASS_FILTER, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_3DM_LOWPASS_FILTER, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + microstrain_extract_u8(&deserializer, &desc_set); + + microstrain_extract_u8(&deserializer, &field_desc); + + assert(enable_out); + microstrain_extract_bool(&deserializer, enable_out); + + assert(manual_out); + microstrain_extract_bool(&deserializer, manual_out); + + assert(frequency_out); + microstrain_extract_float(&deserializer, frequency_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_3dm_save_lowpass_filter(mip_interface* device, uint8_t desc_set, uint8_t field_desc) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + microstrain_insert_u8(&serializer, desc_set); + + microstrain_insert_u8(&serializer, field_desc); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_LOWPASS_FILTER, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_load_lowpass_filter(mip_interface* device, uint8_t desc_set, uint8_t field_desc) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + microstrain_insert_u8(&serializer, desc_set); + + microstrain_insert_u8(&serializer, field_desc); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_LOWPASS_FILTER, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_3dm_default_lowpass_filter(mip_interface* device, uint8_t desc_set, uint8_t field_desc) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + microstrain_insert_u8(&serializer, desc_set); + + microstrain_insert_u8(&serializer, field_desc); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_LOWPASS_FILTER, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} + +#ifdef __cplusplus +} // extern "C" +} // namespace C +} // namespace mip +#endif // __cplusplus + diff --git a/src/mip/definitions/commands_3dm.h b/src/c/mip/definitions/commands_3dm.h similarity index 52% rename from src/mip/definitions/commands_3dm.h rename to src/c/mip/definitions/commands_3dm.h index c2e3b7925..af660aa2f 100644 --- a/src/mip/definitions/commands_3dm.h +++ b/src/c/mip/definitions/commands_3dm.h @@ -1,8 +1,9 @@ #pragma once -#include "common.h" -#include "descriptors.h" -#include "../mip_result.h" +#include +#include +#include +#include #include #include @@ -14,14 +15,11 @@ namespace C { extern "C" { #endif // __cplusplus -struct mip_interface; -struct mip_serializer; -struct mip_field; //////////////////////////////////////////////////////////////////////////////// -///@addtogroup MipCommands_c MIP Commands [C] +///@addtogroup MipCommands_c ///@{ -///@defgroup 3dm_commands_c 3dm Commands [C] +///@defgroup 3dm_commands_c 3dm Commands /// ///@{ @@ -145,23 +143,52 @@ enum // Shared Type Definitions //////////////////////////////////////////////////////////////////////////////// -typedef uint8_t mip_nmea_message_message_id; -static const mip_nmea_message_message_id MIP_NMEA_MESSAGE_MESSAGE_ID_GGA = 1; ///< GPS System Fix Data. Source can be the Filter or GNSS1/2 datasets. -static const mip_nmea_message_message_id MIP_NMEA_MESSAGE_MESSAGE_ID_GLL = 2; ///< Geographic Position Lat/Lon. Source can be the Filter or GNSS1/2 datasets. -static const mip_nmea_message_message_id MIP_NMEA_MESSAGE_MESSAGE_ID_GSV = 3; ///< GNSS Satellites in View. Source must be either GNSS1 or GNSS2 datasets. The talker ID must be set to IGNORED. -static const mip_nmea_message_message_id MIP_NMEA_MESSAGE_MESSAGE_ID_RMC = 4; ///< Recommended Minimum Specific GNSS Data. Source can be the Filter or GNSS1/2 datasets. -static const mip_nmea_message_message_id MIP_NMEA_MESSAGE_MESSAGE_ID_VTG = 5; ///< Course over Ground. Source can be the Filter or GNSS1/2 datasets. -static const mip_nmea_message_message_id MIP_NMEA_MESSAGE_MESSAGE_ID_HDT = 6; ///< Heading, True. Source can be the Filter or GNSS1/2 datasets. -static const mip_nmea_message_message_id MIP_NMEA_MESSAGE_MESSAGE_ID_ZDA = 7; ///< Time & Date. Source must be the GNSS1 or GNSS2 datasets. -static const mip_nmea_message_message_id MIP_NMEA_MESSAGE_MESSAGE_ID_MSRA = 129; ///< MicroStrain proprietary Euler angles. Source must be the Filter dataset. The talker ID must be set to IGNORED. -static const mip_nmea_message_message_id MIP_NMEA_MESSAGE_MESSAGE_ID_MSRR = 130; ///< MicroStrain proprietary Angular Rate/Acceleration. Source must be the Sensor dataset. The talker ID must be set to IGNORED. - -typedef uint8_t mip_nmea_message_talker_id; -static const mip_nmea_message_talker_id MIP_NMEA_MESSAGE_TALKER_ID_IGNORED = 0; ///< Talker ID cannot be changed. -static const mip_nmea_message_talker_id MIP_NMEA_MESSAGE_TALKER_ID_GNSS = 1; ///< NMEA message will be produced with talker id "GN". -static const mip_nmea_message_talker_id MIP_NMEA_MESSAGE_TALKER_ID_GPS = 2; ///< NMEA message will be produced with talker id "GP". -static const mip_nmea_message_talker_id MIP_NMEA_MESSAGE_TALKER_ID_GALILEO = 3; ///< NMEA message will be produced with talker id "GA". -static const mip_nmea_message_talker_id MIP_NMEA_MESSAGE_TALKER_ID_GLONASS = 4; ///< NMEA message will be produced with talker id "GL". +enum mip_nmea_message_message_id +{ + MIP_NMEA_MESSAGE_MESSAGE_ID_GGA = 1, ///< GPS System Fix Data. Source can be the Filter or GNSS1/2 datasets. + MIP_NMEA_MESSAGE_MESSAGE_ID_GLL = 2, ///< Geographic Position Lat/Lon. Source can be the Filter or GNSS1/2 datasets. + MIP_NMEA_MESSAGE_MESSAGE_ID_GSV = 3, ///< GNSS Satellites in View. Source must be either GNSS1 or GNSS2 datasets. The talker ID must be set to IGNORED. + MIP_NMEA_MESSAGE_MESSAGE_ID_RMC = 4, ///< Recommended Minimum Specific GNSS Data. Source can be the Filter or GNSS1/2 datasets. + MIP_NMEA_MESSAGE_MESSAGE_ID_VTG = 5, ///< Course over Ground. Source can be the Filter or GNSS1/2 datasets. + MIP_NMEA_MESSAGE_MESSAGE_ID_HDT = 6, ///< Heading, True. Source can be the Filter or GNSS1/2 datasets. + MIP_NMEA_MESSAGE_MESSAGE_ID_ZDA = 7, ///< Time & Date. Source must be the GNSS1 or GNSS2 datasets. + MIP_NMEA_MESSAGE_MESSAGE_ID_MSRA = 129, ///< MicroStrain proprietary Euler angles. Source must be the Filter dataset. The talker ID must be set to IGNORED. + MIP_NMEA_MESSAGE_MESSAGE_ID_MSRR = 130, ///< MicroStrain proprietary Angular Rate/Acceleration. Source must be the Sensor dataset. The talker ID must be set to IGNORED. +}; +typedef enum mip_nmea_message_message_id mip_nmea_message_message_id; + +static inline void insert_mip_nmea_message_message_id(microstrain_serializer* serializer, const mip_nmea_message_message_id self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_nmea_message_message_id(microstrain_serializer* serializer, mip_nmea_message_message_id* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} + +enum mip_nmea_message_talker_id +{ + MIP_NMEA_MESSAGE_TALKER_ID_IGNORED = 0, ///< Talker ID cannot be changed. + MIP_NMEA_MESSAGE_TALKER_ID_GNSS = 1, ///< NMEA message will be produced with talker id "GN". + MIP_NMEA_MESSAGE_TALKER_ID_GPS = 2, ///< NMEA message will be produced with talker id "GP". + MIP_NMEA_MESSAGE_TALKER_ID_GALILEO = 3, ///< NMEA message will be produced with talker id "GA". + MIP_NMEA_MESSAGE_TALKER_ID_GLONASS = 4, ///< NMEA message will be produced with talker id "GL". +}; +typedef enum mip_nmea_message_talker_id mip_nmea_message_talker_id; + +static inline void insert_mip_nmea_message_talker_id(microstrain_serializer* serializer, const mip_nmea_message_talker_id self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_nmea_message_talker_id(microstrain_serializer* serializer, mip_nmea_message_talker_id* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} + struct mip_nmea_message { @@ -169,27 +196,32 @@ struct mip_nmea_message mip_nmea_message_talker_id talker_id; ///< NMEA talker ID. Ignored for proprietary sentences. uint8_t source_desc_set; ///< Data descriptor set where the data will be sourced. Available options depend on the sentence. uint16_t decimation; ///< Decimation from the base rate for source_desc_set. Frequency is limited to 10 Hz or the base rate, whichever is lower. Must be 0 when polling. - }; typedef struct mip_nmea_message mip_nmea_message; -void insert_mip_nmea_message(struct mip_serializer* serializer, const mip_nmea_message* self); -void extract_mip_nmea_message(struct mip_serializer* serializer, mip_nmea_message* self); -void insert_mip_nmea_message_message_id(struct mip_serializer* serializer, const mip_nmea_message_message_id self); -void extract_mip_nmea_message_message_id(struct mip_serializer* serializer, mip_nmea_message_message_id* self); +void insert_mip_nmea_message(microstrain_serializer* serializer, const mip_nmea_message* self); +void extract_mip_nmea_message(microstrain_serializer* serializer, mip_nmea_message* self); -void insert_mip_nmea_message_talker_id(struct mip_serializer* serializer, const mip_nmea_message_talker_id self); -void extract_mip_nmea_message_talker_id(struct mip_serializer* serializer, mip_nmea_message_talker_id* self); - -typedef uint8_t mip_sensor_range_type; -static const mip_sensor_range_type MIP_SENSOR_RANGE_TYPE_ALL = 0; ///< Only allowed for SAVE, LOAD, and DEFAULT function selectors. -static const mip_sensor_range_type MIP_SENSOR_RANGE_TYPE_ACCEL = 1; ///< Accelerometer. Range is specified in g. -static const mip_sensor_range_type MIP_SENSOR_RANGE_TYPE_GYRO = 2; ///< Gyroscope. Range is specified in degrees/s. -static const mip_sensor_range_type MIP_SENSOR_RANGE_TYPE_MAG = 3; ///< Magnetometer. Range is specified in Gauss. -static const mip_sensor_range_type MIP_SENSOR_RANGE_TYPE_PRESS = 4; ///< Pressure sensor. Range is specified in hPa. +enum mip_sensor_range_type +{ + MIP_SENSOR_RANGE_TYPE_ALL = 0, ///< Only allowed for SAVE, LOAD, and DEFAULT function selectors. + MIP_SENSOR_RANGE_TYPE_ACCEL = 1, ///< Accelerometer. Range is specified in g. + MIP_SENSOR_RANGE_TYPE_GYRO = 2, ///< Gyroscope. Range is specified in degrees/s. + MIP_SENSOR_RANGE_TYPE_MAG = 3, ///< Magnetometer. Range is specified in Gauss. + MIP_SENSOR_RANGE_TYPE_PRESS = 4, ///< Pressure sensor. Range is specified in hPa. +}; +typedef enum mip_sensor_range_type mip_sensor_range_type; -void insert_mip_sensor_range_type(struct mip_serializer* serializer, const mip_sensor_range_type self); -void extract_mip_sensor_range_type(struct mip_serializer* serializer, mip_sensor_range_type* self); +static inline void insert_mip_sensor_range_type(microstrain_serializer* serializer, const mip_sensor_range_type self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_sensor_range_type(microstrain_serializer* serializer, mip_sensor_range_type* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} //////////////////////////////////////////////////////////////////////////////// @@ -197,7 +229,7 @@ void extract_mip_sensor_range_type(struct mip_serializer* serializer, mip_sensor //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_poll_imu_message (0x0C,0x01) Poll Imu Message [C] +///@defgroup 3dm_poll_imu_message_c (0x0C,0x01) Poll Imu Message /// Poll the device for an IMU message with the specified format /// /// This function polls for an IMU message using the provided format. The resulting message @@ -214,18 +246,18 @@ struct mip_3dm_poll_imu_message_command bool suppress_ack; ///< Suppress the usual ACK/NACK reply. uint8_t num_descriptors; ///< Number of descriptors in the descriptor list. mip_descriptor_rate descriptors[83]; ///< Descriptor list. - }; typedef struct mip_3dm_poll_imu_message_command mip_3dm_poll_imu_message_command; -void insert_mip_3dm_poll_imu_message_command(struct mip_serializer* serializer, const mip_3dm_poll_imu_message_command* self); -void extract_mip_3dm_poll_imu_message_command(struct mip_serializer* serializer, mip_3dm_poll_imu_message_command* self); -mip_cmd_result mip_3dm_poll_imu_message(struct mip_interface* device, bool suppress_ack, uint8_t num_descriptors, const mip_descriptor_rate* descriptors); +void insert_mip_3dm_poll_imu_message_command(microstrain_serializer* serializer, const mip_3dm_poll_imu_message_command* self); +void extract_mip_3dm_poll_imu_message_command(microstrain_serializer* serializer, mip_3dm_poll_imu_message_command* self); + +mip_cmd_result mip_3dm_poll_imu_message(mip_interface* device, bool suppress_ack, uint8_t num_descriptors, const mip_descriptor_rate* descriptors); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_poll_gnss_message (0x0C,0x02) Poll Gnss Message [C] +///@defgroup 3dm_poll_gnss_message_c (0x0C,0x02) Poll Gnss Message /// Poll the device for an GNSS message with the specified format /// /// This function polls for a GNSS message using the provided format. The resulting message @@ -242,18 +274,18 @@ struct mip_3dm_poll_gnss_message_command bool suppress_ack; ///< Suppress the usual ACK/NACK reply. uint8_t num_descriptors; ///< Number of descriptors in the descriptor list. mip_descriptor_rate descriptors[83]; ///< Descriptor list. - }; typedef struct mip_3dm_poll_gnss_message_command mip_3dm_poll_gnss_message_command; -void insert_mip_3dm_poll_gnss_message_command(struct mip_serializer* serializer, const mip_3dm_poll_gnss_message_command* self); -void extract_mip_3dm_poll_gnss_message_command(struct mip_serializer* serializer, mip_3dm_poll_gnss_message_command* self); -mip_cmd_result mip_3dm_poll_gnss_message(struct mip_interface* device, bool suppress_ack, uint8_t num_descriptors, const mip_descriptor_rate* descriptors); +void insert_mip_3dm_poll_gnss_message_command(microstrain_serializer* serializer, const mip_3dm_poll_gnss_message_command* self); +void extract_mip_3dm_poll_gnss_message_command(microstrain_serializer* serializer, mip_3dm_poll_gnss_message_command* self); + +mip_cmd_result mip_3dm_poll_gnss_message(mip_interface* device, bool suppress_ack, uint8_t num_descriptors, const mip_descriptor_rate* descriptors); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_poll_filter_message (0x0C,0x03) Poll Filter Message [C] +///@defgroup 3dm_poll_filter_message_c (0x0C,0x03) Poll Filter Message /// Poll the device for an Estimation Filter message with the specified format /// /// This function polls for an Estimation Filter message using the provided format. The resulting message @@ -270,18 +302,18 @@ struct mip_3dm_poll_filter_message_command bool suppress_ack; ///< Suppress the usual ACK/NACK reply. uint8_t num_descriptors; ///< Number of descriptors in the format list. mip_descriptor_rate descriptors[83]; ///< Descriptor format list. - }; typedef struct mip_3dm_poll_filter_message_command mip_3dm_poll_filter_message_command; -void insert_mip_3dm_poll_filter_message_command(struct mip_serializer* serializer, const mip_3dm_poll_filter_message_command* self); -void extract_mip_3dm_poll_filter_message_command(struct mip_serializer* serializer, mip_3dm_poll_filter_message_command* self); -mip_cmd_result mip_3dm_poll_filter_message(struct mip_interface* device, bool suppress_ack, uint8_t num_descriptors, const mip_descriptor_rate* descriptors); +void insert_mip_3dm_poll_filter_message_command(microstrain_serializer* serializer, const mip_3dm_poll_filter_message_command* self); +void extract_mip_3dm_poll_filter_message_command(microstrain_serializer* serializer, mip_3dm_poll_filter_message_command* self); + +mip_cmd_result mip_3dm_poll_filter_message(mip_interface* device, bool suppress_ack, uint8_t num_descriptors, const mip_descriptor_rate* descriptors); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_imu_message_format (0x0C,0x08) Imu Message Format [C] +///@defgroup 3dm_imu_message_format_c (0x0C,0x08) Imu Message Format /// Set, read, or save the format of the IMU data packet. /// /// The resulting data messages will maintain the order of descriptors sent in the command. @@ -293,32 +325,32 @@ struct mip_3dm_imu_message_format_command mip_function_selector function; uint8_t num_descriptors; ///< Number of descriptors mip_descriptor_rate descriptors[82]; ///< Descriptor format list. - }; typedef struct mip_3dm_imu_message_format_command mip_3dm_imu_message_format_command; -void insert_mip_3dm_imu_message_format_command(struct mip_serializer* serializer, const mip_3dm_imu_message_format_command* self); -void extract_mip_3dm_imu_message_format_command(struct mip_serializer* serializer, mip_3dm_imu_message_format_command* self); + +void insert_mip_3dm_imu_message_format_command(microstrain_serializer* serializer, const mip_3dm_imu_message_format_command* self); +void extract_mip_3dm_imu_message_format_command(microstrain_serializer* serializer, mip_3dm_imu_message_format_command* self); struct mip_3dm_imu_message_format_response { uint8_t num_descriptors; ///< Number of descriptors mip_descriptor_rate descriptors[82]; ///< Descriptor format list. - }; typedef struct mip_3dm_imu_message_format_response mip_3dm_imu_message_format_response; -void insert_mip_3dm_imu_message_format_response(struct mip_serializer* serializer, const mip_3dm_imu_message_format_response* self); -void extract_mip_3dm_imu_message_format_response(struct mip_serializer* serializer, mip_3dm_imu_message_format_response* self); -mip_cmd_result mip_3dm_write_imu_message_format(struct mip_interface* device, uint8_t num_descriptors, const mip_descriptor_rate* descriptors); -mip_cmd_result mip_3dm_read_imu_message_format(struct mip_interface* device, uint8_t* num_descriptors_out, uint8_t num_descriptors_out_max, mip_descriptor_rate* descriptors_out); -mip_cmd_result mip_3dm_save_imu_message_format(struct mip_interface* device); -mip_cmd_result mip_3dm_load_imu_message_format(struct mip_interface* device); -mip_cmd_result mip_3dm_default_imu_message_format(struct mip_interface* device); +void insert_mip_3dm_imu_message_format_response(microstrain_serializer* serializer, const mip_3dm_imu_message_format_response* self); +void extract_mip_3dm_imu_message_format_response(microstrain_serializer* serializer, mip_3dm_imu_message_format_response* self); + +mip_cmd_result mip_3dm_write_imu_message_format(mip_interface* device, uint8_t num_descriptors, const mip_descriptor_rate* descriptors); +mip_cmd_result mip_3dm_read_imu_message_format(mip_interface* device, uint8_t* num_descriptors_out, uint8_t num_descriptors_out_max, mip_descriptor_rate* descriptors_out); +mip_cmd_result mip_3dm_save_imu_message_format(mip_interface* device); +mip_cmd_result mip_3dm_load_imu_message_format(mip_interface* device); +mip_cmd_result mip_3dm_default_imu_message_format(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_gps_message_format (0x0C,0x09) Gps Message Format [C] +///@defgroup 3dm_gps_message_format_c (0x0C,0x09) Gps Message Format /// Set, read, or save the format of the GNSS data packet. /// /// The resulting data messages will maintain the order of descriptors sent in the command. @@ -330,32 +362,32 @@ struct mip_3dm_gps_message_format_command mip_function_selector function; uint8_t num_descriptors; ///< Number of descriptors mip_descriptor_rate descriptors[82]; ///< Descriptor format list. - }; typedef struct mip_3dm_gps_message_format_command mip_3dm_gps_message_format_command; -void insert_mip_3dm_gps_message_format_command(struct mip_serializer* serializer, const mip_3dm_gps_message_format_command* self); -void extract_mip_3dm_gps_message_format_command(struct mip_serializer* serializer, mip_3dm_gps_message_format_command* self); + +void insert_mip_3dm_gps_message_format_command(microstrain_serializer* serializer, const mip_3dm_gps_message_format_command* self); +void extract_mip_3dm_gps_message_format_command(microstrain_serializer* serializer, mip_3dm_gps_message_format_command* self); struct mip_3dm_gps_message_format_response { uint8_t num_descriptors; ///< Number of descriptors mip_descriptor_rate descriptors[82]; ///< Descriptor format list. - }; typedef struct mip_3dm_gps_message_format_response mip_3dm_gps_message_format_response; -void insert_mip_3dm_gps_message_format_response(struct mip_serializer* serializer, const mip_3dm_gps_message_format_response* self); -void extract_mip_3dm_gps_message_format_response(struct mip_serializer* serializer, mip_3dm_gps_message_format_response* self); -mip_cmd_result mip_3dm_write_gps_message_format(struct mip_interface* device, uint8_t num_descriptors, const mip_descriptor_rate* descriptors); -mip_cmd_result mip_3dm_read_gps_message_format(struct mip_interface* device, uint8_t* num_descriptors_out, uint8_t num_descriptors_out_max, mip_descriptor_rate* descriptors_out); -mip_cmd_result mip_3dm_save_gps_message_format(struct mip_interface* device); -mip_cmd_result mip_3dm_load_gps_message_format(struct mip_interface* device); -mip_cmd_result mip_3dm_default_gps_message_format(struct mip_interface* device); +void insert_mip_3dm_gps_message_format_response(microstrain_serializer* serializer, const mip_3dm_gps_message_format_response* self); +void extract_mip_3dm_gps_message_format_response(microstrain_serializer* serializer, mip_3dm_gps_message_format_response* self); + +mip_cmd_result mip_3dm_write_gps_message_format(mip_interface* device, uint8_t num_descriptors, const mip_descriptor_rate* descriptors); +mip_cmd_result mip_3dm_read_gps_message_format(mip_interface* device, uint8_t* num_descriptors_out, uint8_t num_descriptors_out_max, mip_descriptor_rate* descriptors_out); +mip_cmd_result mip_3dm_save_gps_message_format(mip_interface* device); +mip_cmd_result mip_3dm_load_gps_message_format(mip_interface* device); +mip_cmd_result mip_3dm_default_gps_message_format(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_filter_message_format (0x0C,0x0A) Filter Message Format [C] +///@defgroup 3dm_filter_message_format_c (0x0C,0x0A) Filter Message Format /// Set, read, or save the format of the Estimation Filter data packet. /// /// The resulting data messages will maintain the order of descriptors sent in the command. @@ -367,32 +399,32 @@ struct mip_3dm_filter_message_format_command mip_function_selector function; uint8_t num_descriptors; ///< Number of descriptors (limited by payload size) mip_descriptor_rate descriptors[82]; - }; typedef struct mip_3dm_filter_message_format_command mip_3dm_filter_message_format_command; -void insert_mip_3dm_filter_message_format_command(struct mip_serializer* serializer, const mip_3dm_filter_message_format_command* self); -void extract_mip_3dm_filter_message_format_command(struct mip_serializer* serializer, mip_3dm_filter_message_format_command* self); + +void insert_mip_3dm_filter_message_format_command(microstrain_serializer* serializer, const mip_3dm_filter_message_format_command* self); +void extract_mip_3dm_filter_message_format_command(microstrain_serializer* serializer, mip_3dm_filter_message_format_command* self); struct mip_3dm_filter_message_format_response { uint8_t num_descriptors; ///< Number of descriptors (limited by payload size) mip_descriptor_rate descriptors[82]; - }; typedef struct mip_3dm_filter_message_format_response mip_3dm_filter_message_format_response; -void insert_mip_3dm_filter_message_format_response(struct mip_serializer* serializer, const mip_3dm_filter_message_format_response* self); -void extract_mip_3dm_filter_message_format_response(struct mip_serializer* serializer, mip_3dm_filter_message_format_response* self); -mip_cmd_result mip_3dm_write_filter_message_format(struct mip_interface* device, uint8_t num_descriptors, const mip_descriptor_rate* descriptors); -mip_cmd_result mip_3dm_read_filter_message_format(struct mip_interface* device, uint8_t* num_descriptors_out, uint8_t num_descriptors_out_max, mip_descriptor_rate* descriptors_out); -mip_cmd_result mip_3dm_save_filter_message_format(struct mip_interface* device); -mip_cmd_result mip_3dm_load_filter_message_format(struct mip_interface* device); -mip_cmd_result mip_3dm_default_filter_message_format(struct mip_interface* device); +void insert_mip_3dm_filter_message_format_response(microstrain_serializer* serializer, const mip_3dm_filter_message_format_response* self); +void extract_mip_3dm_filter_message_format_response(microstrain_serializer* serializer, mip_3dm_filter_message_format_response* self); + +mip_cmd_result mip_3dm_write_filter_message_format(mip_interface* device, uint8_t num_descriptors, const mip_descriptor_rate* descriptors); +mip_cmd_result mip_3dm_read_filter_message_format(mip_interface* device, uint8_t* num_descriptors_out, uint8_t num_descriptors_out_max, mip_descriptor_rate* descriptors_out); +mip_cmd_result mip_3dm_save_filter_message_format(mip_interface* device); +mip_cmd_result mip_3dm_load_filter_message_format(mip_interface* device); +mip_cmd_result mip_3dm_default_filter_message_format(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_imu_get_base_rate (0x0C,0x06) Imu Get Base Rate [C] +///@defgroup 3dm_imu_get_base_rate_c (0x0C,0x06) Imu Get Base Rate /// Get the base rate for the IMU data in Hz /// /// This is the fastest rate for this type of data available on the device. @@ -400,21 +432,23 @@ mip_cmd_result mip_3dm_default_filter_message_format(struct mip_interface* devic /// ///@{ +typedef struct mip_3dm_imu_get_base_rate_command mip_3dm_imu_get_base_rate_command; ///< No parameters (empty struct not allowed in C) + struct mip_3dm_imu_get_base_rate_response { uint16_t rate; ///< [hz] - }; typedef struct mip_3dm_imu_get_base_rate_response mip_3dm_imu_get_base_rate_response; -void insert_mip_3dm_imu_get_base_rate_response(struct mip_serializer* serializer, const mip_3dm_imu_get_base_rate_response* self); -void extract_mip_3dm_imu_get_base_rate_response(struct mip_serializer* serializer, mip_3dm_imu_get_base_rate_response* self); -mip_cmd_result mip_3dm_imu_get_base_rate(struct mip_interface* device, uint16_t* rate_out); +void insert_mip_3dm_imu_get_base_rate_response(microstrain_serializer* serializer, const mip_3dm_imu_get_base_rate_response* self); +void extract_mip_3dm_imu_get_base_rate_response(microstrain_serializer* serializer, mip_3dm_imu_get_base_rate_response* self); + +mip_cmd_result mip_3dm_imu_get_base_rate(mip_interface* device, uint16_t* rate_out); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_gps_get_base_rate (0x0C,0x07) Gps Get Base Rate [C] +///@defgroup 3dm_gps_get_base_rate_c (0x0C,0x07) Gps Get Base Rate /// Get the base rate for the GNSS data in Hz /// /// This is the fastest rate for this type of data available on the device. @@ -422,21 +456,23 @@ mip_cmd_result mip_3dm_imu_get_base_rate(struct mip_interface* device, uint16_t* /// ///@{ +typedef struct mip_3dm_gps_get_base_rate_command mip_3dm_gps_get_base_rate_command; ///< No parameters (empty struct not allowed in C) + struct mip_3dm_gps_get_base_rate_response { uint16_t rate; ///< [hz] - }; typedef struct mip_3dm_gps_get_base_rate_response mip_3dm_gps_get_base_rate_response; -void insert_mip_3dm_gps_get_base_rate_response(struct mip_serializer* serializer, const mip_3dm_gps_get_base_rate_response* self); -void extract_mip_3dm_gps_get_base_rate_response(struct mip_serializer* serializer, mip_3dm_gps_get_base_rate_response* self); -mip_cmd_result mip_3dm_gps_get_base_rate(struct mip_interface* device, uint16_t* rate_out); +void insert_mip_3dm_gps_get_base_rate_response(microstrain_serializer* serializer, const mip_3dm_gps_get_base_rate_response* self); +void extract_mip_3dm_gps_get_base_rate_response(microstrain_serializer* serializer, mip_3dm_gps_get_base_rate_response* self); + +mip_cmd_result mip_3dm_gps_get_base_rate(mip_interface* device, uint16_t* rate_out); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_filter_get_base_rate (0x0C,0x0B) Filter Get Base Rate [C] +///@defgroup 3dm_filter_get_base_rate_c (0x0C,0x0B) Filter Get Base Rate /// Get the base rate for the Estimation Filter data in Hz /// /// This is the fastest rate for this type of data available on the device. @@ -444,21 +480,23 @@ mip_cmd_result mip_3dm_gps_get_base_rate(struct mip_interface* device, uint16_t* /// ///@{ +typedef struct mip_3dm_filter_get_base_rate_command mip_3dm_filter_get_base_rate_command; ///< No parameters (empty struct not allowed in C) + struct mip_3dm_filter_get_base_rate_response { uint16_t rate; ///< [hz] - }; typedef struct mip_3dm_filter_get_base_rate_response mip_3dm_filter_get_base_rate_response; -void insert_mip_3dm_filter_get_base_rate_response(struct mip_serializer* serializer, const mip_3dm_filter_get_base_rate_response* self); -void extract_mip_3dm_filter_get_base_rate_response(struct mip_serializer* serializer, mip_3dm_filter_get_base_rate_response* self); -mip_cmd_result mip_3dm_filter_get_base_rate(struct mip_interface* device, uint16_t* rate_out); +void insert_mip_3dm_filter_get_base_rate_response(microstrain_serializer* serializer, const mip_3dm_filter_get_base_rate_response* self); +void extract_mip_3dm_filter_get_base_rate_response(microstrain_serializer* serializer, mip_3dm_filter_get_base_rate_response* self); + +mip_cmd_result mip_3dm_filter_get_base_rate(mip_interface* device, uint16_t* rate_out); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_poll_data (0x0C,0x0D) Poll Data [C] +///@defgroup 3dm_poll_data_c (0x0C,0x0D) Poll Data /// Poll the device for a message with the specified descriptor set and format. /// /// This function polls for a message using the provided format. The resulting message @@ -476,18 +514,18 @@ struct mip_3dm_poll_data_command bool suppress_ack; ///< Suppress the usual ACK/NACK reply. uint8_t num_descriptors; ///< Number of descriptors in the format list. uint8_t descriptors[82]; ///< Descriptor format list. - }; typedef struct mip_3dm_poll_data_command mip_3dm_poll_data_command; -void insert_mip_3dm_poll_data_command(struct mip_serializer* serializer, const mip_3dm_poll_data_command* self); -void extract_mip_3dm_poll_data_command(struct mip_serializer* serializer, mip_3dm_poll_data_command* self); -mip_cmd_result mip_3dm_poll_data(struct mip_interface* device, uint8_t desc_set, bool suppress_ack, uint8_t num_descriptors, const uint8_t* descriptors); +void insert_mip_3dm_poll_data_command(microstrain_serializer* serializer, const mip_3dm_poll_data_command* self); +void extract_mip_3dm_poll_data_command(microstrain_serializer* serializer, mip_3dm_poll_data_command* self); + +mip_cmd_result mip_3dm_poll_data(mip_interface* device, uint8_t desc_set, bool suppress_ack, uint8_t num_descriptors, const uint8_t* descriptors); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_get_base_rate (0x0C,0x0E) Get Base Rate [C] +///@defgroup 3dm_get_base_rate_c (0x0C,0x0E) Get Base Rate /// Get the base rate for the specified descriptor set in Hz. /// ///@{ @@ -495,28 +533,28 @@ mip_cmd_result mip_3dm_poll_data(struct mip_interface* device, uint8_t desc_set, struct mip_3dm_get_base_rate_command { uint8_t desc_set; ///< This is the data descriptor set. It must be a supported descriptor. - }; typedef struct mip_3dm_get_base_rate_command mip_3dm_get_base_rate_command; -void insert_mip_3dm_get_base_rate_command(struct mip_serializer* serializer, const mip_3dm_get_base_rate_command* self); -void extract_mip_3dm_get_base_rate_command(struct mip_serializer* serializer, mip_3dm_get_base_rate_command* self); + +void insert_mip_3dm_get_base_rate_command(microstrain_serializer* serializer, const mip_3dm_get_base_rate_command* self); +void extract_mip_3dm_get_base_rate_command(microstrain_serializer* serializer, mip_3dm_get_base_rate_command* self); struct mip_3dm_get_base_rate_response { uint8_t desc_set; ///< Echoes the parameter in the command. uint16_t rate; ///< Base rate in Hz (0 = variable, unknown, or user-defined rate. Data will be sent when received). - }; typedef struct mip_3dm_get_base_rate_response mip_3dm_get_base_rate_response; -void insert_mip_3dm_get_base_rate_response(struct mip_serializer* serializer, const mip_3dm_get_base_rate_response* self); -void extract_mip_3dm_get_base_rate_response(struct mip_serializer* serializer, mip_3dm_get_base_rate_response* self); -mip_cmd_result mip_3dm_get_base_rate(struct mip_interface* device, uint8_t desc_set, uint16_t* rate_out); +void insert_mip_3dm_get_base_rate_response(microstrain_serializer* serializer, const mip_3dm_get_base_rate_response* self); +void extract_mip_3dm_get_base_rate_response(microstrain_serializer* serializer, mip_3dm_get_base_rate_response* self); + +mip_cmd_result mip_3dm_get_base_rate(mip_interface* device, uint8_t desc_set, uint16_t* rate_out); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_message_format (0x0C,0x0F) Message Format [C] +///@defgroup 3dm_message_format_c (0x0C,0x0F) Message Format /// Set, read, or save the format for a given data packet. /// /// The resulting data messages will maintain the order of descriptors sent in the command. @@ -529,33 +567,33 @@ struct mip_3dm_message_format_command uint8_t desc_set; ///< Data descriptor set. Must be supported. When function is SAVE, LOAD, or DEFAULT, can be 0 to apply to all descriptor sets. uint8_t num_descriptors; ///< Number of descriptors (limited by payload size) mip_descriptor_rate descriptors[82]; ///< List of descriptors and decimations. - }; typedef struct mip_3dm_message_format_command mip_3dm_message_format_command; -void insert_mip_3dm_message_format_command(struct mip_serializer* serializer, const mip_3dm_message_format_command* self); -void extract_mip_3dm_message_format_command(struct mip_serializer* serializer, mip_3dm_message_format_command* self); + +void insert_mip_3dm_message_format_command(microstrain_serializer* serializer, const mip_3dm_message_format_command* self); +void extract_mip_3dm_message_format_command(microstrain_serializer* serializer, mip_3dm_message_format_command* self); struct mip_3dm_message_format_response { uint8_t desc_set; ///< Echoes the descriptor set from the command. uint8_t num_descriptors; ///< Number of descriptors in the list. mip_descriptor_rate descriptors[82]; ///< List of descriptors and decimations. - }; typedef struct mip_3dm_message_format_response mip_3dm_message_format_response; -void insert_mip_3dm_message_format_response(struct mip_serializer* serializer, const mip_3dm_message_format_response* self); -void extract_mip_3dm_message_format_response(struct mip_serializer* serializer, mip_3dm_message_format_response* self); -mip_cmd_result mip_3dm_write_message_format(struct mip_interface* device, uint8_t desc_set, uint8_t num_descriptors, const mip_descriptor_rate* descriptors); -mip_cmd_result mip_3dm_read_message_format(struct mip_interface* device, uint8_t desc_set, uint8_t* num_descriptors_out, uint8_t num_descriptors_out_max, mip_descriptor_rate* descriptors_out); -mip_cmd_result mip_3dm_save_message_format(struct mip_interface* device, uint8_t desc_set); -mip_cmd_result mip_3dm_load_message_format(struct mip_interface* device, uint8_t desc_set); -mip_cmd_result mip_3dm_default_message_format(struct mip_interface* device, uint8_t desc_set); +void insert_mip_3dm_message_format_response(microstrain_serializer* serializer, const mip_3dm_message_format_response* self); +void extract_mip_3dm_message_format_response(microstrain_serializer* serializer, mip_3dm_message_format_response* self); + +mip_cmd_result mip_3dm_write_message_format(mip_interface* device, uint8_t desc_set, uint8_t num_descriptors, const mip_descriptor_rate* descriptors); +mip_cmd_result mip_3dm_read_message_format(mip_interface* device, uint8_t desc_set, uint8_t* num_descriptors_out, uint8_t num_descriptors_out_max, mip_descriptor_rate* descriptors_out); +mip_cmd_result mip_3dm_save_message_format(mip_interface* device, uint8_t desc_set); +mip_cmd_result mip_3dm_load_message_format(mip_interface* device, uint8_t desc_set); +mip_cmd_result mip_3dm_default_message_format(mip_interface* device, uint8_t desc_set); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_nmea_poll_data (0x0C,0x04) Nmea Poll Data [C] +///@defgroup 3dm_nmea_poll_data_c (0x0C,0x04) Nmea Poll Data /// Poll the device for a NMEA message with the specified format. /// /// This function polls for a NMEA message using the provided format. @@ -571,18 +609,18 @@ struct mip_3dm_nmea_poll_data_command bool suppress_ack; ///< Suppress the usual ACK/NACK reply. uint8_t count; ///< Number of format entries (limited by payload size) mip_nmea_message format_entries[40]; ///< List of format entries. - }; typedef struct mip_3dm_nmea_poll_data_command mip_3dm_nmea_poll_data_command; -void insert_mip_3dm_nmea_poll_data_command(struct mip_serializer* serializer, const mip_3dm_nmea_poll_data_command* self); -void extract_mip_3dm_nmea_poll_data_command(struct mip_serializer* serializer, mip_3dm_nmea_poll_data_command* self); -mip_cmd_result mip_3dm_nmea_poll_data(struct mip_interface* device, bool suppress_ack, uint8_t count, const mip_nmea_message* format_entries); +void insert_mip_3dm_nmea_poll_data_command(microstrain_serializer* serializer, const mip_3dm_nmea_poll_data_command* self); +void extract_mip_3dm_nmea_poll_data_command(microstrain_serializer* serializer, mip_3dm_nmea_poll_data_command* self); + +mip_cmd_result mip_3dm_nmea_poll_data(mip_interface* device, bool suppress_ack, uint8_t count, const mip_nmea_message* format_entries); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_nmea_message_format (0x0C,0x0C) Nmea Message Format [C] +///@defgroup 3dm_nmea_message_format_c (0x0C,0x0C) Nmea Message Format /// Set, read, or save the NMEA message format. /// ///@{ @@ -592,32 +630,32 @@ struct mip_3dm_nmea_message_format_command mip_function_selector function; uint8_t count; ///< Number of format entries (limited by payload size) mip_nmea_message format_entries[40]; ///< List of format entries. - }; typedef struct mip_3dm_nmea_message_format_command mip_3dm_nmea_message_format_command; -void insert_mip_3dm_nmea_message_format_command(struct mip_serializer* serializer, const mip_3dm_nmea_message_format_command* self); -void extract_mip_3dm_nmea_message_format_command(struct mip_serializer* serializer, mip_3dm_nmea_message_format_command* self); + +void insert_mip_3dm_nmea_message_format_command(microstrain_serializer* serializer, const mip_3dm_nmea_message_format_command* self); +void extract_mip_3dm_nmea_message_format_command(microstrain_serializer* serializer, mip_3dm_nmea_message_format_command* self); struct mip_3dm_nmea_message_format_response { uint8_t count; ///< Number of format entries (limited by payload size) mip_nmea_message format_entries[40]; ///< List of format entries. - }; typedef struct mip_3dm_nmea_message_format_response mip_3dm_nmea_message_format_response; -void insert_mip_3dm_nmea_message_format_response(struct mip_serializer* serializer, const mip_3dm_nmea_message_format_response* self); -void extract_mip_3dm_nmea_message_format_response(struct mip_serializer* serializer, mip_3dm_nmea_message_format_response* self); -mip_cmd_result mip_3dm_write_nmea_message_format(struct mip_interface* device, uint8_t count, const mip_nmea_message* format_entries); -mip_cmd_result mip_3dm_read_nmea_message_format(struct mip_interface* device, uint8_t* count_out, uint8_t count_out_max, mip_nmea_message* format_entries_out); -mip_cmd_result mip_3dm_save_nmea_message_format(struct mip_interface* device); -mip_cmd_result mip_3dm_load_nmea_message_format(struct mip_interface* device); -mip_cmd_result mip_3dm_default_nmea_message_format(struct mip_interface* device); +void insert_mip_3dm_nmea_message_format_response(microstrain_serializer* serializer, const mip_3dm_nmea_message_format_response* self); +void extract_mip_3dm_nmea_message_format_response(microstrain_serializer* serializer, mip_3dm_nmea_message_format_response* self); + +mip_cmd_result mip_3dm_write_nmea_message_format(mip_interface* device, uint8_t count, const mip_nmea_message* format_entries); +mip_cmd_result mip_3dm_read_nmea_message_format(mip_interface* device, uint8_t* count_out, uint8_t count_out_max, mip_nmea_message* format_entries_out); +mip_cmd_result mip_3dm_save_nmea_message_format(mip_interface* device); +mip_cmd_result mip_3dm_load_nmea_message_format(mip_interface* device); +mip_cmd_result mip_3dm_default_nmea_message_format(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_device_settings (0x0C,0x30) Device Settings [C] +///@defgroup 3dm_device_settings_c (0x0C,0x30) Device Settings /// Save, Load, or Reset to Default the values for all device settings. /// /// When a save current settings command is issued, a brief data disturbance may occur while all settings are written to non-volatile memory. @@ -629,20 +667,20 @@ mip_cmd_result mip_3dm_default_nmea_message_format(struct mip_interface* device) struct mip_3dm_device_settings_command { mip_function_selector function; - }; typedef struct mip_3dm_device_settings_command mip_3dm_device_settings_command; -void insert_mip_3dm_device_settings_command(struct mip_serializer* serializer, const mip_3dm_device_settings_command* self); -void extract_mip_3dm_device_settings_command(struct mip_serializer* serializer, mip_3dm_device_settings_command* self); -mip_cmd_result mip_3dm_save_device_settings(struct mip_interface* device); -mip_cmd_result mip_3dm_load_device_settings(struct mip_interface* device); -mip_cmd_result mip_3dm_default_device_settings(struct mip_interface* device); +void insert_mip_3dm_device_settings_command(microstrain_serializer* serializer, const mip_3dm_device_settings_command* self); +void extract_mip_3dm_device_settings_command(microstrain_serializer* serializer, mip_3dm_device_settings_command* self); + +mip_cmd_result mip_3dm_save_device_settings(mip_interface* device); +mip_cmd_result mip_3dm_load_device_settings(mip_interface* device); +mip_cmd_result mip_3dm_default_device_settings(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_uart_baudrate (0x0C,0x40) Uart Baudrate [C] +///@defgroup 3dm_uart_baudrate_c (0x0C,0x40) Uart Baudrate /// Read, Save, Load, or Reset to Default the baud rate of the main communication channel. /// /// For all functions except 0x01 (use new settings), the new baud rate value is ignored. @@ -665,31 +703,31 @@ struct mip_3dm_uart_baudrate_command { mip_function_selector function; uint32_t baud; - }; typedef struct mip_3dm_uart_baudrate_command mip_3dm_uart_baudrate_command; -void insert_mip_3dm_uart_baudrate_command(struct mip_serializer* serializer, const mip_3dm_uart_baudrate_command* self); -void extract_mip_3dm_uart_baudrate_command(struct mip_serializer* serializer, mip_3dm_uart_baudrate_command* self); + +void insert_mip_3dm_uart_baudrate_command(microstrain_serializer* serializer, const mip_3dm_uart_baudrate_command* self); +void extract_mip_3dm_uart_baudrate_command(microstrain_serializer* serializer, mip_3dm_uart_baudrate_command* self); struct mip_3dm_uart_baudrate_response { uint32_t baud; - }; typedef struct mip_3dm_uart_baudrate_response mip_3dm_uart_baudrate_response; -void insert_mip_3dm_uart_baudrate_response(struct mip_serializer* serializer, const mip_3dm_uart_baudrate_response* self); -void extract_mip_3dm_uart_baudrate_response(struct mip_serializer* serializer, mip_3dm_uart_baudrate_response* self); -mip_cmd_result mip_3dm_write_uart_baudrate(struct mip_interface* device, uint32_t baud); -mip_cmd_result mip_3dm_read_uart_baudrate(struct mip_interface* device, uint32_t* baud_out); -mip_cmd_result mip_3dm_save_uart_baudrate(struct mip_interface* device); -mip_cmd_result mip_3dm_load_uart_baudrate(struct mip_interface* device); -mip_cmd_result mip_3dm_default_uart_baudrate(struct mip_interface* device); +void insert_mip_3dm_uart_baudrate_response(microstrain_serializer* serializer, const mip_3dm_uart_baudrate_response* self); +void extract_mip_3dm_uart_baudrate_response(microstrain_serializer* serializer, mip_3dm_uart_baudrate_response* self); + +mip_cmd_result mip_3dm_write_uart_baudrate(mip_interface* device, uint32_t baud); +mip_cmd_result mip_3dm_read_uart_baudrate(mip_interface* device, uint32_t* baud_out); +mip_cmd_result mip_3dm_save_uart_baudrate(mip_interface* device); +mip_cmd_result mip_3dm_load_uart_baudrate(mip_interface* device); +mip_cmd_result mip_3dm_default_uart_baudrate(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_factory_streaming (0x0C,0x10) Factory Streaming [C] +///@defgroup 3dm_factory_streaming_c (0x0C,0x10) Factory Streaming /// Configures the device for recording data for technical support. /// /// This command will configure all available data streams to predefined @@ -697,30 +735,42 @@ mip_cmd_result mip_3dm_default_uart_baudrate(struct mip_interface* device); /// ///@{ -typedef uint8_t mip_3dm_factory_streaming_command_action; -static const mip_3dm_factory_streaming_command_action MIP_3DM_FACTORY_STREAMING_COMMAND_ACTION_OVERWRITE = 0; ///< Replaces the message format(s), removing any existing descriptors. -static const mip_3dm_factory_streaming_command_action MIP_3DM_FACTORY_STREAMING_COMMAND_ACTION_MERGE = 1; ///< Merges support descriptors into existing format(s). May reorder descriptors. -static const mip_3dm_factory_streaming_command_action MIP_3DM_FACTORY_STREAMING_COMMAND_ACTION_ADD = 2; ///< Adds descriptors to the current message format(s) without changing existing descriptors. May result in duplicates. +enum mip_3dm_factory_streaming_command_action +{ + MIP_3DM_FACTORY_STREAMING_COMMAND_ACTION_OVERWRITE = 0, ///< Replaces the message format(s), removing any existing descriptors. + MIP_3DM_FACTORY_STREAMING_COMMAND_ACTION_MERGE = 1, ///< Merges support descriptors into existing format(s). May reorder descriptors. + MIP_3DM_FACTORY_STREAMING_COMMAND_ACTION_ADD = 2, ///< Adds descriptors to the current message format(s) without changing existing descriptors. May result in duplicates. +}; +typedef enum mip_3dm_factory_streaming_command_action mip_3dm_factory_streaming_command_action; + +static inline void insert_mip_3dm_factory_streaming_command_action(microstrain_serializer* serializer, const mip_3dm_factory_streaming_command_action self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_3dm_factory_streaming_command_action(microstrain_serializer* serializer, mip_3dm_factory_streaming_command_action* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} + struct mip_3dm_factory_streaming_command { mip_3dm_factory_streaming_command_action action; uint8_t reserved; ///< Reserved. Set to 0x00. - }; typedef struct mip_3dm_factory_streaming_command mip_3dm_factory_streaming_command; -void insert_mip_3dm_factory_streaming_command(struct mip_serializer* serializer, const mip_3dm_factory_streaming_command* self); -void extract_mip_3dm_factory_streaming_command(struct mip_serializer* serializer, mip_3dm_factory_streaming_command* self); -void insert_mip_3dm_factory_streaming_command_action(struct mip_serializer* serializer, const mip_3dm_factory_streaming_command_action self); -void extract_mip_3dm_factory_streaming_command_action(struct mip_serializer* serializer, mip_3dm_factory_streaming_command_action* self); +void insert_mip_3dm_factory_streaming_command(microstrain_serializer* serializer, const mip_3dm_factory_streaming_command* self); +void extract_mip_3dm_factory_streaming_command(microstrain_serializer* serializer, mip_3dm_factory_streaming_command* self); -mip_cmd_result mip_3dm_factory_streaming(struct mip_interface* device, mip_3dm_factory_streaming_command_action action, uint8_t reserved); +mip_cmd_result mip_3dm_factory_streaming(mip_interface* device, mip_3dm_factory_streaming_command_action action, uint8_t reserved); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_datastream_control (0x0C,0x11) Datastream Control [C] +///@defgroup 3dm_datastream_control_c (0x0C,0x11) Datastream Control /// Enable/disable the selected data stream. /// /// Each data stream (descriptor set) can be enabled or disabled. @@ -734,37 +784,38 @@ enum { MIP_3DM_DATASTREAM_CONTROL_COMMAND_LEGACY_IMU_STREAM = 0x01 }; enum { MIP_3DM_DATASTREAM_CONTROL_COMMAND_LEGACY_GNSS_STREAM = 0x02 }; enum { MIP_3DM_DATASTREAM_CONTROL_COMMAND_LEGACY_FILTER_STREAM = 0x03 }; enum { MIP_3DM_DATASTREAM_CONTROL_COMMAND_ALL_STREAMS = 0x00 }; + struct mip_3dm_datastream_control_command { mip_function_selector function; uint8_t desc_set; ///< The descriptor set of the stream to control. When function is SAVE, LOAD, or DEFAULT, can be ALL_STREAMS(0) to apply to all descriptor sets. On Generation 5 products, this must be one of the above legacy constants. bool enable; ///< True or false to enable or disable the stream. - }; typedef struct mip_3dm_datastream_control_command mip_3dm_datastream_control_command; -void insert_mip_3dm_datastream_control_command(struct mip_serializer* serializer, const mip_3dm_datastream_control_command* self); -void extract_mip_3dm_datastream_control_command(struct mip_serializer* serializer, mip_3dm_datastream_control_command* self); + +void insert_mip_3dm_datastream_control_command(microstrain_serializer* serializer, const mip_3dm_datastream_control_command* self); +void extract_mip_3dm_datastream_control_command(microstrain_serializer* serializer, mip_3dm_datastream_control_command* self); struct mip_3dm_datastream_control_response { uint8_t desc_set; bool enabled; - }; typedef struct mip_3dm_datastream_control_response mip_3dm_datastream_control_response; -void insert_mip_3dm_datastream_control_response(struct mip_serializer* serializer, const mip_3dm_datastream_control_response* self); -void extract_mip_3dm_datastream_control_response(struct mip_serializer* serializer, mip_3dm_datastream_control_response* self); -mip_cmd_result mip_3dm_write_datastream_control(struct mip_interface* device, uint8_t desc_set, bool enable); -mip_cmd_result mip_3dm_read_datastream_control(struct mip_interface* device, uint8_t desc_set, bool* enabled_out); -mip_cmd_result mip_3dm_save_datastream_control(struct mip_interface* device, uint8_t desc_set); -mip_cmd_result mip_3dm_load_datastream_control(struct mip_interface* device, uint8_t desc_set); -mip_cmd_result mip_3dm_default_datastream_control(struct mip_interface* device, uint8_t desc_set); +void insert_mip_3dm_datastream_control_response(microstrain_serializer* serializer, const mip_3dm_datastream_control_response* self); +void extract_mip_3dm_datastream_control_response(microstrain_serializer* serializer, mip_3dm_datastream_control_response* self); + +mip_cmd_result mip_3dm_write_datastream_control(mip_interface* device, uint8_t desc_set, bool enable); +mip_cmd_result mip_3dm_read_datastream_control(mip_interface* device, uint8_t desc_set, bool* enabled_out); +mip_cmd_result mip_3dm_save_datastream_control(mip_interface* device, uint8_t desc_set); +mip_cmd_result mip_3dm_load_datastream_control(mip_interface* device, uint8_t desc_set); +mip_cmd_result mip_3dm_default_datastream_control(mip_interface* device, uint8_t desc_set); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_constellation_settings (0x0C,0x21) Constellation Settings [C] +///@defgroup 3dm_constellation_settings_c (0x0C,0x21) Constellation Settings /// This command configures which satellite constellations are enabled and how many channels are dedicated to tracking each constellation. /// /// Maximum number of tracking channels to use (total for all constellations): @@ -786,18 +837,42 @@ mip_cmd_result mip_3dm_default_datastream_control(struct mip_interface* device, /// ///@{ -typedef uint8_t mip_3dm_constellation_settings_command_constellation_id; -static const mip_3dm_constellation_settings_command_constellation_id MIP_3DM_CONSTELLATION_SETTINGS_COMMAND_CONSTELLATION_ID_GPS = 0; ///< GPS (G1-G32) -static const mip_3dm_constellation_settings_command_constellation_id MIP_3DM_CONSTELLATION_SETTINGS_COMMAND_CONSTELLATION_ID_SBAS = 1; ///< SBAS (S120-S158) -static const mip_3dm_constellation_settings_command_constellation_id MIP_3DM_CONSTELLATION_SETTINGS_COMMAND_CONSTELLATION_ID_GALILEO = 2; ///< GALILEO (E1-E36) -static const mip_3dm_constellation_settings_command_constellation_id MIP_3DM_CONSTELLATION_SETTINGS_COMMAND_CONSTELLATION_ID_BEIDOU = 3; ///< BeiDou (B1-B37) -static const mip_3dm_constellation_settings_command_constellation_id MIP_3DM_CONSTELLATION_SETTINGS_COMMAND_CONSTELLATION_ID_QZSS = 5; ///< QZSS (Q1-Q5) -static const mip_3dm_constellation_settings_command_constellation_id MIP_3DM_CONSTELLATION_SETTINGS_COMMAND_CONSTELLATION_ID_GLONASS = 6; ///< GLONASS (R1-R32) +enum mip_3dm_constellation_settings_command_constellation_id +{ + MIP_3DM_CONSTELLATION_SETTINGS_COMMAND_CONSTELLATION_ID_GPS = 0, ///< GPS (G1-G32) + MIP_3DM_CONSTELLATION_SETTINGS_COMMAND_CONSTELLATION_ID_SBAS = 1, ///< SBAS (S120-S158) + MIP_3DM_CONSTELLATION_SETTINGS_COMMAND_CONSTELLATION_ID_GALILEO = 2, ///< GALILEO (E1-E36) + MIP_3DM_CONSTELLATION_SETTINGS_COMMAND_CONSTELLATION_ID_BEIDOU = 3, ///< BeiDou (B1-B37) + MIP_3DM_CONSTELLATION_SETTINGS_COMMAND_CONSTELLATION_ID_QZSS = 5, ///< QZSS (Q1-Q5) + MIP_3DM_CONSTELLATION_SETTINGS_COMMAND_CONSTELLATION_ID_GLONASS = 6, ///< GLONASS (R1-R32) +}; +typedef enum mip_3dm_constellation_settings_command_constellation_id mip_3dm_constellation_settings_command_constellation_id; + +static inline void insert_mip_3dm_constellation_settings_command_constellation_id(microstrain_serializer* serializer, const mip_3dm_constellation_settings_command_constellation_id self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_3dm_constellation_settings_command_constellation_id(microstrain_serializer* serializer, mip_3dm_constellation_settings_command_constellation_id* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} typedef uint16_t mip_3dm_constellation_settings_command_option_flags; static const mip_3dm_constellation_settings_command_option_flags MIP_3DM_CONSTELLATION_SETTINGS_COMMAND_OPTION_FLAGS_NONE = 0x0000; static const mip_3dm_constellation_settings_command_option_flags MIP_3DM_CONSTELLATION_SETTINGS_COMMAND_OPTION_FLAGS_L1SAIF = 0x0001; ///< Available only for QZSS static const mip_3dm_constellation_settings_command_option_flags MIP_3DM_CONSTELLATION_SETTINGS_COMMAND_OPTION_FLAGS_ALL = 0x0001; +static inline void insert_mip_3dm_constellation_settings_command_option_flags(microstrain_serializer* serializer, const mip_3dm_constellation_settings_command_option_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_3dm_constellation_settings_command_option_flags(microstrain_serializer* serializer, mip_3dm_constellation_settings_command_option_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} struct mip_3dm_constellation_settings_command_settings { @@ -806,29 +881,24 @@ struct mip_3dm_constellation_settings_command_settings uint8_t reserved_channels; ///< Minimum number of channels reserved for this constellation uint8_t max_channels; ///< Maximum number of channels to use for this constallation mip_3dm_constellation_settings_command_option_flags option_flags; ///< Constellation option Flags - }; typedef struct mip_3dm_constellation_settings_command_settings mip_3dm_constellation_settings_command_settings; + +void insert_mip_3dm_constellation_settings_command_settings(microstrain_serializer* serializer, const mip_3dm_constellation_settings_command_settings* self); +void extract_mip_3dm_constellation_settings_command_settings(microstrain_serializer* serializer, mip_3dm_constellation_settings_command_settings* self); + + struct mip_3dm_constellation_settings_command { mip_function_selector function; uint16_t max_channels; uint8_t config_count; mip_3dm_constellation_settings_command_settings settings[42]; - }; typedef struct mip_3dm_constellation_settings_command mip_3dm_constellation_settings_command; -void insert_mip_3dm_constellation_settings_command(struct mip_serializer* serializer, const mip_3dm_constellation_settings_command* self); -void extract_mip_3dm_constellation_settings_command(struct mip_serializer* serializer, mip_3dm_constellation_settings_command* self); - -void insert_mip_3dm_constellation_settings_command_constellation_id(struct mip_serializer* serializer, const mip_3dm_constellation_settings_command_constellation_id self); -void extract_mip_3dm_constellation_settings_command_constellation_id(struct mip_serializer* serializer, mip_3dm_constellation_settings_command_constellation_id* self); -void insert_mip_3dm_constellation_settings_command_option_flags(struct mip_serializer* serializer, const mip_3dm_constellation_settings_command_option_flags self); -void extract_mip_3dm_constellation_settings_command_option_flags(struct mip_serializer* serializer, mip_3dm_constellation_settings_command_option_flags* self); - -void insert_mip_3dm_constellation_settings_command_settings(struct mip_serializer* serializer, const mip_3dm_constellation_settings_command_settings* self); -void extract_mip_3dm_constellation_settings_command_settings(struct mip_serializer* serializer, mip_3dm_constellation_settings_command_settings* self); +void insert_mip_3dm_constellation_settings_command(microstrain_serializer* serializer, const mip_3dm_constellation_settings_command* self); +void extract_mip_3dm_constellation_settings_command(microstrain_serializer* serializer, mip_3dm_constellation_settings_command* self); struct mip_3dm_constellation_settings_response { @@ -836,22 +906,22 @@ struct mip_3dm_constellation_settings_response uint16_t max_channels_use; ///< Maximum channels to use uint8_t config_count; ///< Number of constellation configurations mip_3dm_constellation_settings_command_settings settings[42]; ///< Constellation Settings - }; typedef struct mip_3dm_constellation_settings_response mip_3dm_constellation_settings_response; -void insert_mip_3dm_constellation_settings_response(struct mip_serializer* serializer, const mip_3dm_constellation_settings_response* self); -void extract_mip_3dm_constellation_settings_response(struct mip_serializer* serializer, mip_3dm_constellation_settings_response* self); -mip_cmd_result mip_3dm_write_constellation_settings(struct mip_interface* device, uint16_t max_channels, uint8_t config_count, const mip_3dm_constellation_settings_command_settings* settings); -mip_cmd_result mip_3dm_read_constellation_settings(struct mip_interface* device, uint16_t* max_channels_available_out, uint16_t* max_channels_use_out, uint8_t* config_count_out, uint8_t config_count_out_max, mip_3dm_constellation_settings_command_settings* settings_out); -mip_cmd_result mip_3dm_save_constellation_settings(struct mip_interface* device); -mip_cmd_result mip_3dm_load_constellation_settings(struct mip_interface* device); -mip_cmd_result mip_3dm_default_constellation_settings(struct mip_interface* device); +void insert_mip_3dm_constellation_settings_response(microstrain_serializer* serializer, const mip_3dm_constellation_settings_response* self); +void extract_mip_3dm_constellation_settings_response(microstrain_serializer* serializer, mip_3dm_constellation_settings_response* self); + +mip_cmd_result mip_3dm_write_constellation_settings(mip_interface* device, uint16_t max_channels, uint8_t config_count, const mip_3dm_constellation_settings_command_settings* settings); +mip_cmd_result mip_3dm_read_constellation_settings(mip_interface* device, uint16_t* max_channels_available_out, uint16_t* max_channels_use_out, uint8_t* config_count_out, uint8_t config_count_out_max, mip_3dm_constellation_settings_command_settings* settings_out); +mip_cmd_result mip_3dm_save_constellation_settings(mip_interface* device); +mip_cmd_result mip_3dm_load_constellation_settings(mip_interface* device); +mip_cmd_result mip_3dm_default_constellation_settings(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_gnss_sbas_settings (0x0C,0x22) Gnss Sbas Settings [C] +///@defgroup 3dm_gnss_sbas_settings_c (0x0C,0x22) Gnss Sbas Settings /// Configure the SBAS subsystem /// /// @@ -865,6 +935,17 @@ static const mip_3dm_gnss_sbas_settings_command_sbasoptions MIP_3DM_GNSS_SBAS_SE static const mip_3dm_gnss_sbas_settings_command_sbasoptions MIP_3DM_GNSS_SBAS_SETTINGS_COMMAND_SBASOPTIONS_ENABLE_CORRECTIONS = 0x0002; ///< Use SBAS differential corrections static const mip_3dm_gnss_sbas_settings_command_sbasoptions MIP_3DM_GNSS_SBAS_SETTINGS_COMMAND_SBASOPTIONS_APPLY_INTEGRITY = 0x0004; ///< Use SBAS integrity information. If enabled, only GPS satellites for which integrity information is available will be used. static const mip_3dm_gnss_sbas_settings_command_sbasoptions MIP_3DM_GNSS_SBAS_SETTINGS_COMMAND_SBASOPTIONS_ALL = 0x0007; +static inline void insert_mip_3dm_gnss_sbas_settings_command_sbasoptions(microstrain_serializer* serializer, const mip_3dm_gnss_sbas_settings_command_sbasoptions self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_3dm_gnss_sbas_settings_command_sbasoptions(microstrain_serializer* serializer, mip_3dm_gnss_sbas_settings_command_sbasoptions* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_3dm_gnss_sbas_settings_command { @@ -873,14 +954,11 @@ struct mip_3dm_gnss_sbas_settings_command mip_3dm_gnss_sbas_settings_command_sbasoptions sbas_options; ///< SBAS options, see definition uint8_t num_included_prns; ///< Number of SBAS PRNs to include in search (0 = include all) uint16_t included_prns[39]; ///< List of specific SBAS PRNs to search for - }; typedef struct mip_3dm_gnss_sbas_settings_command mip_3dm_gnss_sbas_settings_command; -void insert_mip_3dm_gnss_sbas_settings_command(struct mip_serializer* serializer, const mip_3dm_gnss_sbas_settings_command* self); -void extract_mip_3dm_gnss_sbas_settings_command(struct mip_serializer* serializer, mip_3dm_gnss_sbas_settings_command* self); -void insert_mip_3dm_gnss_sbas_settings_command_sbasoptions(struct mip_serializer* serializer, const mip_3dm_gnss_sbas_settings_command_sbasoptions self); -void extract_mip_3dm_gnss_sbas_settings_command_sbasoptions(struct mip_serializer* serializer, mip_3dm_gnss_sbas_settings_command_sbasoptions* self); +void insert_mip_3dm_gnss_sbas_settings_command(microstrain_serializer* serializer, const mip_3dm_gnss_sbas_settings_command* self); +void extract_mip_3dm_gnss_sbas_settings_command(microstrain_serializer* serializer, mip_3dm_gnss_sbas_settings_command* self); struct mip_3dm_gnss_sbas_settings_response { @@ -888,22 +966,22 @@ struct mip_3dm_gnss_sbas_settings_response mip_3dm_gnss_sbas_settings_command_sbasoptions sbas_options; ///< SBAS options, see definition uint8_t num_included_prns; ///< Number of SBAS PRNs to include in search (0 = include all) uint16_t included_prns[39]; ///< List of specific SBAS PRNs to search for - }; typedef struct mip_3dm_gnss_sbas_settings_response mip_3dm_gnss_sbas_settings_response; -void insert_mip_3dm_gnss_sbas_settings_response(struct mip_serializer* serializer, const mip_3dm_gnss_sbas_settings_response* self); -void extract_mip_3dm_gnss_sbas_settings_response(struct mip_serializer* serializer, mip_3dm_gnss_sbas_settings_response* self); -mip_cmd_result mip_3dm_write_gnss_sbas_settings(struct mip_interface* device, uint8_t enable_sbas, mip_3dm_gnss_sbas_settings_command_sbasoptions sbas_options, uint8_t num_included_prns, const uint16_t* included_prns); -mip_cmd_result mip_3dm_read_gnss_sbas_settings(struct mip_interface* device, uint8_t* enable_sbas_out, mip_3dm_gnss_sbas_settings_command_sbasoptions* sbas_options_out, uint8_t* num_included_prns_out, uint8_t num_included_prns_out_max, uint16_t* included_prns_out); -mip_cmd_result mip_3dm_save_gnss_sbas_settings(struct mip_interface* device); -mip_cmd_result mip_3dm_load_gnss_sbas_settings(struct mip_interface* device); -mip_cmd_result mip_3dm_default_gnss_sbas_settings(struct mip_interface* device); +void insert_mip_3dm_gnss_sbas_settings_response(microstrain_serializer* serializer, const mip_3dm_gnss_sbas_settings_response* self); +void extract_mip_3dm_gnss_sbas_settings_response(microstrain_serializer* serializer, mip_3dm_gnss_sbas_settings_response* self); + +mip_cmd_result mip_3dm_write_gnss_sbas_settings(mip_interface* device, uint8_t enable_sbas, mip_3dm_gnss_sbas_settings_command_sbasoptions sbas_options, uint8_t num_included_prns, const uint16_t* included_prns); +mip_cmd_result mip_3dm_read_gnss_sbas_settings(mip_interface* device, uint8_t* enable_sbas_out, mip_3dm_gnss_sbas_settings_command_sbasoptions* sbas_options_out, uint8_t* num_included_prns_out, uint8_t num_included_prns_out_max, uint16_t* included_prns_out); +mip_cmd_result mip_3dm_save_gnss_sbas_settings(mip_interface* device); +mip_cmd_result mip_3dm_load_gnss_sbas_settings(mip_interface* device); +mip_cmd_result mip_3dm_default_gnss_sbas_settings(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_gnss_assisted_fix (0x0C,0x23) Gnss Assisted Fix [C] +///@defgroup 3dm_gnss_assisted_fix_c (0x0C,0x23) Gnss Assisted Fix /// Set the options for assisted GNSS fix. /// /// Devices that implement this command have a dedicated GNSS flash memory and a non-volatile FRAM. @@ -918,44 +996,56 @@ mip_cmd_result mip_3dm_default_gnss_sbas_settings(struct mip_interface* device); /// ///@{ -typedef uint8_t mip_3dm_gnss_assisted_fix_command_assisted_fix_option; -static const mip_3dm_gnss_assisted_fix_command_assisted_fix_option MIP_3DM_GNSS_ASSISTED_FIX_COMMAND_ASSISTED_FIX_OPTION_NONE = 0; ///< No assisted fix (default) -static const mip_3dm_gnss_assisted_fix_command_assisted_fix_option MIP_3DM_GNSS_ASSISTED_FIX_COMMAND_ASSISTED_FIX_OPTION_ENABLED = 1; ///< Enable assisted fix +enum mip_3dm_gnss_assisted_fix_command_assisted_fix_option +{ + MIP_3DM_GNSS_ASSISTED_FIX_COMMAND_ASSISTED_FIX_OPTION_NONE = 0, ///< No assisted fix (default) + MIP_3DM_GNSS_ASSISTED_FIX_COMMAND_ASSISTED_FIX_OPTION_ENABLED = 1, ///< Enable assisted fix +}; +typedef enum mip_3dm_gnss_assisted_fix_command_assisted_fix_option mip_3dm_gnss_assisted_fix_command_assisted_fix_option; + +static inline void insert_mip_3dm_gnss_assisted_fix_command_assisted_fix_option(microstrain_serializer* serializer, const mip_3dm_gnss_assisted_fix_command_assisted_fix_option self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_3dm_gnss_assisted_fix_command_assisted_fix_option(microstrain_serializer* serializer, mip_3dm_gnss_assisted_fix_command_assisted_fix_option* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} + struct mip_3dm_gnss_assisted_fix_command { mip_function_selector function; mip_3dm_gnss_assisted_fix_command_assisted_fix_option option; ///< Assisted fix options uint8_t flags; ///< Assisted fix flags (set to 0xFF) - }; typedef struct mip_3dm_gnss_assisted_fix_command mip_3dm_gnss_assisted_fix_command; -void insert_mip_3dm_gnss_assisted_fix_command(struct mip_serializer* serializer, const mip_3dm_gnss_assisted_fix_command* self); -void extract_mip_3dm_gnss_assisted_fix_command(struct mip_serializer* serializer, mip_3dm_gnss_assisted_fix_command* self); -void insert_mip_3dm_gnss_assisted_fix_command_assisted_fix_option(struct mip_serializer* serializer, const mip_3dm_gnss_assisted_fix_command_assisted_fix_option self); -void extract_mip_3dm_gnss_assisted_fix_command_assisted_fix_option(struct mip_serializer* serializer, mip_3dm_gnss_assisted_fix_command_assisted_fix_option* self); +void insert_mip_3dm_gnss_assisted_fix_command(microstrain_serializer* serializer, const mip_3dm_gnss_assisted_fix_command* self); +void extract_mip_3dm_gnss_assisted_fix_command(microstrain_serializer* serializer, mip_3dm_gnss_assisted_fix_command* self); struct mip_3dm_gnss_assisted_fix_response { mip_3dm_gnss_assisted_fix_command_assisted_fix_option option; ///< Assisted fix options uint8_t flags; ///< Assisted fix flags (set to 0xFF) - }; typedef struct mip_3dm_gnss_assisted_fix_response mip_3dm_gnss_assisted_fix_response; -void insert_mip_3dm_gnss_assisted_fix_response(struct mip_serializer* serializer, const mip_3dm_gnss_assisted_fix_response* self); -void extract_mip_3dm_gnss_assisted_fix_response(struct mip_serializer* serializer, mip_3dm_gnss_assisted_fix_response* self); -mip_cmd_result mip_3dm_write_gnss_assisted_fix(struct mip_interface* device, mip_3dm_gnss_assisted_fix_command_assisted_fix_option option, uint8_t flags); -mip_cmd_result mip_3dm_read_gnss_assisted_fix(struct mip_interface* device, mip_3dm_gnss_assisted_fix_command_assisted_fix_option* option_out, uint8_t* flags_out); -mip_cmd_result mip_3dm_save_gnss_assisted_fix(struct mip_interface* device); -mip_cmd_result mip_3dm_load_gnss_assisted_fix(struct mip_interface* device); -mip_cmd_result mip_3dm_default_gnss_assisted_fix(struct mip_interface* device); +void insert_mip_3dm_gnss_assisted_fix_response(microstrain_serializer* serializer, const mip_3dm_gnss_assisted_fix_response* self); +void extract_mip_3dm_gnss_assisted_fix_response(microstrain_serializer* serializer, mip_3dm_gnss_assisted_fix_response* self); + +mip_cmd_result mip_3dm_write_gnss_assisted_fix(mip_interface* device, mip_3dm_gnss_assisted_fix_command_assisted_fix_option option, uint8_t flags); +mip_cmd_result mip_3dm_read_gnss_assisted_fix(mip_interface* device, mip_3dm_gnss_assisted_fix_command_assisted_fix_option* option_out, uint8_t* flags_out); +mip_cmd_result mip_3dm_save_gnss_assisted_fix(mip_interface* device); +mip_cmd_result mip_3dm_load_gnss_assisted_fix(mip_interface* device); +mip_cmd_result mip_3dm_default_gnss_assisted_fix(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_gnss_time_assistance (0x0C,0x24) Gnss Time Assistance [C] +///@defgroup 3dm_gnss_time_assistance_c (0x0C,0x24) Gnss Time Assistance /// Provide the GNSS subsystem with initial time information. /// /// This message is required immediately after power up if GNSS Assist was enabled when the device was powered off. @@ -969,30 +1059,30 @@ struct mip_3dm_gnss_time_assistance_command double tow; ///< GPS Time of week [seconds] uint16_t week_number; ///< GPS Weeks since 1980 [weeks] float accuracy; ///< Accuracy of time information [seconds] - }; typedef struct mip_3dm_gnss_time_assistance_command mip_3dm_gnss_time_assistance_command; -void insert_mip_3dm_gnss_time_assistance_command(struct mip_serializer* serializer, const mip_3dm_gnss_time_assistance_command* self); -void extract_mip_3dm_gnss_time_assistance_command(struct mip_serializer* serializer, mip_3dm_gnss_time_assistance_command* self); + +void insert_mip_3dm_gnss_time_assistance_command(microstrain_serializer* serializer, const mip_3dm_gnss_time_assistance_command* self); +void extract_mip_3dm_gnss_time_assistance_command(microstrain_serializer* serializer, mip_3dm_gnss_time_assistance_command* self); struct mip_3dm_gnss_time_assistance_response { double tow; ///< GPS Time of week [seconds] uint16_t week_number; ///< GPS Weeks since 1980 [weeks] float accuracy; ///< Accuracy of time information [seconds] - }; typedef struct mip_3dm_gnss_time_assistance_response mip_3dm_gnss_time_assistance_response; -void insert_mip_3dm_gnss_time_assistance_response(struct mip_serializer* serializer, const mip_3dm_gnss_time_assistance_response* self); -void extract_mip_3dm_gnss_time_assistance_response(struct mip_serializer* serializer, mip_3dm_gnss_time_assistance_response* self); -mip_cmd_result mip_3dm_write_gnss_time_assistance(struct mip_interface* device, double tow, uint16_t week_number, float accuracy); -mip_cmd_result mip_3dm_read_gnss_time_assistance(struct mip_interface* device, double* tow_out, uint16_t* week_number_out, float* accuracy_out); +void insert_mip_3dm_gnss_time_assistance_response(microstrain_serializer* serializer, const mip_3dm_gnss_time_assistance_response* self); +void extract_mip_3dm_gnss_time_assistance_response(microstrain_serializer* serializer, mip_3dm_gnss_time_assistance_response* self); + +mip_cmd_result mip_3dm_write_gnss_time_assistance(mip_interface* device, double tow, uint16_t week_number, float accuracy); +mip_cmd_result mip_3dm_read_gnss_time_assistance(mip_interface* device, double* tow_out, uint16_t* week_number_out, float* accuracy_out); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_imu_lowpass_filter (0x0C,0x50) Imu Lowpass Filter [C] +///@defgroup 3dm_imu_lowpass_filter_c (0x0C,0x50) Imu Lowpass Filter /// Advanced configuration for the IMU data quantity low-pass filters. /// /// Deprecated, use the lowpass filter (0x0C,0x54) command instead. @@ -1020,11 +1110,11 @@ struct mip_3dm_imu_lowpass_filter_command bool manual; ///< If false, the cutoff frequency is set to half of the streaming rate as configured by the message format command. Otherwise, the cutoff frequency is set according to the following 'frequency' parameter. uint16_t frequency; ///< -3dB cutoff frequency in Hz. Will not affect filtering if 'manual' is false. uint8_t reserved; ///< Reserved, set to 0x00. - }; typedef struct mip_3dm_imu_lowpass_filter_command mip_3dm_imu_lowpass_filter_command; -void insert_mip_3dm_imu_lowpass_filter_command(struct mip_serializer* serializer, const mip_3dm_imu_lowpass_filter_command* self); -void extract_mip_3dm_imu_lowpass_filter_command(struct mip_serializer* serializer, mip_3dm_imu_lowpass_filter_command* self); + +void insert_mip_3dm_imu_lowpass_filter_command(microstrain_serializer* serializer, const mip_3dm_imu_lowpass_filter_command* self); +void extract_mip_3dm_imu_lowpass_filter_command(microstrain_serializer* serializer, mip_3dm_imu_lowpass_filter_command* self); struct mip_3dm_imu_lowpass_filter_response { @@ -1033,65 +1123,77 @@ struct mip_3dm_imu_lowpass_filter_response bool manual; ///< True if the filter cutoff was manually configured. uint16_t frequency; ///< The cutoff frequency of the filter. If the filter is in auto mode, this value is unspecified. uint8_t reserved; ///< Reserved and must be ignored. - }; typedef struct mip_3dm_imu_lowpass_filter_response mip_3dm_imu_lowpass_filter_response; -void insert_mip_3dm_imu_lowpass_filter_response(struct mip_serializer* serializer, const mip_3dm_imu_lowpass_filter_response* self); -void extract_mip_3dm_imu_lowpass_filter_response(struct mip_serializer* serializer, mip_3dm_imu_lowpass_filter_response* self); -mip_cmd_result mip_3dm_write_imu_lowpass_filter(struct mip_interface* device, uint8_t target_descriptor, bool enable, bool manual, uint16_t frequency, uint8_t reserved); -mip_cmd_result mip_3dm_read_imu_lowpass_filter(struct mip_interface* device, uint8_t target_descriptor, bool* enable_out, bool* manual_out, uint16_t* frequency_out, uint8_t* reserved_out); -mip_cmd_result mip_3dm_save_imu_lowpass_filter(struct mip_interface* device, uint8_t target_descriptor); -mip_cmd_result mip_3dm_load_imu_lowpass_filter(struct mip_interface* device, uint8_t target_descriptor); -mip_cmd_result mip_3dm_default_imu_lowpass_filter(struct mip_interface* device, uint8_t target_descriptor); +void insert_mip_3dm_imu_lowpass_filter_response(microstrain_serializer* serializer, const mip_3dm_imu_lowpass_filter_response* self); +void extract_mip_3dm_imu_lowpass_filter_response(microstrain_serializer* serializer, mip_3dm_imu_lowpass_filter_response* self); + +mip_cmd_result mip_3dm_write_imu_lowpass_filter(mip_interface* device, uint8_t target_descriptor, bool enable, bool manual, uint16_t frequency, uint8_t reserved); +mip_cmd_result mip_3dm_read_imu_lowpass_filter(mip_interface* device, uint8_t target_descriptor, bool* enable_out, bool* manual_out, uint16_t* frequency_out, uint8_t* reserved_out); +mip_cmd_result mip_3dm_save_imu_lowpass_filter(mip_interface* device, uint8_t target_descriptor); +mip_cmd_result mip_3dm_load_imu_lowpass_filter(mip_interface* device, uint8_t target_descriptor); +mip_cmd_result mip_3dm_default_imu_lowpass_filter(mip_interface* device, uint8_t target_descriptor); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_pps_source (0x0C,0x28) Pps Source [C] +///@defgroup 3dm_pps_source_c (0x0C,0x28) Pps Source /// Controls the Pulse Per Second (PPS) source. /// ///@{ -typedef uint8_t mip_3dm_pps_source_command_source; -static const mip_3dm_pps_source_command_source MIP_3DM_PPS_SOURCE_COMMAND_SOURCE_DISABLED = 0; ///< PPS output is disabled. Not valid for PPS source command. -static const mip_3dm_pps_source_command_source MIP_3DM_PPS_SOURCE_COMMAND_SOURCE_RECEIVER_1 = 1; ///< PPS is provided by GNSS receiver 1. -static const mip_3dm_pps_source_command_source MIP_3DM_PPS_SOURCE_COMMAND_SOURCE_RECEIVER_2 = 2; ///< PPS is provided by GNSS receiver 2. -static const mip_3dm_pps_source_command_source MIP_3DM_PPS_SOURCE_COMMAND_SOURCE_GPIO = 3; ///< PPS is provided to an external GPIO pin. Use the GPIO Setup command to choose and configure the pin. -static const mip_3dm_pps_source_command_source MIP_3DM_PPS_SOURCE_COMMAND_SOURCE_GENERATED = 4; ///< PPS is generated from the system oscillator. +enum mip_3dm_pps_source_command_source +{ + MIP_3DM_PPS_SOURCE_COMMAND_SOURCE_DISABLED = 0, ///< PPS output is disabled. Not valid for PPS source command. + MIP_3DM_PPS_SOURCE_COMMAND_SOURCE_RECEIVER_1 = 1, ///< PPS is provided by GNSS receiver 1. + MIP_3DM_PPS_SOURCE_COMMAND_SOURCE_RECEIVER_2 = 2, ///< PPS is provided by GNSS receiver 2. + MIP_3DM_PPS_SOURCE_COMMAND_SOURCE_GPIO = 3, ///< PPS is provided to an external GPIO pin. Use the GPIO Setup command to choose and configure the pin. + MIP_3DM_PPS_SOURCE_COMMAND_SOURCE_GENERATED = 4, ///< PPS is generated from the system oscillator. +}; +typedef enum mip_3dm_pps_source_command_source mip_3dm_pps_source_command_source; + +static inline void insert_mip_3dm_pps_source_command_source(microstrain_serializer* serializer, const mip_3dm_pps_source_command_source self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_3dm_pps_source_command_source(microstrain_serializer* serializer, mip_3dm_pps_source_command_source* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} + struct mip_3dm_pps_source_command { mip_function_selector function; mip_3dm_pps_source_command_source source; - }; typedef struct mip_3dm_pps_source_command mip_3dm_pps_source_command; -void insert_mip_3dm_pps_source_command(struct mip_serializer* serializer, const mip_3dm_pps_source_command* self); -void extract_mip_3dm_pps_source_command(struct mip_serializer* serializer, mip_3dm_pps_source_command* self); -void insert_mip_3dm_pps_source_command_source(struct mip_serializer* serializer, const mip_3dm_pps_source_command_source self); -void extract_mip_3dm_pps_source_command_source(struct mip_serializer* serializer, mip_3dm_pps_source_command_source* self); +void insert_mip_3dm_pps_source_command(microstrain_serializer* serializer, const mip_3dm_pps_source_command* self); +void extract_mip_3dm_pps_source_command(microstrain_serializer* serializer, mip_3dm_pps_source_command* self); struct mip_3dm_pps_source_response { mip_3dm_pps_source_command_source source; - }; typedef struct mip_3dm_pps_source_response mip_3dm_pps_source_response; -void insert_mip_3dm_pps_source_response(struct mip_serializer* serializer, const mip_3dm_pps_source_response* self); -void extract_mip_3dm_pps_source_response(struct mip_serializer* serializer, mip_3dm_pps_source_response* self); -mip_cmd_result mip_3dm_write_pps_source(struct mip_interface* device, mip_3dm_pps_source_command_source source); -mip_cmd_result mip_3dm_read_pps_source(struct mip_interface* device, mip_3dm_pps_source_command_source* source_out); -mip_cmd_result mip_3dm_save_pps_source(struct mip_interface* device); -mip_cmd_result mip_3dm_load_pps_source(struct mip_interface* device); -mip_cmd_result mip_3dm_default_pps_source(struct mip_interface* device); +void insert_mip_3dm_pps_source_response(microstrain_serializer* serializer, const mip_3dm_pps_source_response* self); +void extract_mip_3dm_pps_source_response(microstrain_serializer* serializer, mip_3dm_pps_source_response* self); + +mip_cmd_result mip_3dm_write_pps_source(mip_interface* device, mip_3dm_pps_source_command_source source); +mip_cmd_result mip_3dm_read_pps_source(mip_interface* device, mip_3dm_pps_source_command_source* source_out); +mip_cmd_result mip_3dm_save_pps_source(mip_interface* device); +mip_cmd_result mip_3dm_load_pps_source(mip_interface* device); +mip_cmd_result mip_3dm_default_pps_source(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_gpio_config (0x0C,0x41) Gpio Config [C] +///@defgroup 3dm_gpio_config_c (0x0C,0x41) Gpio Config /// Configures the user GPIO pins on the connector for use with several built-in functions or for general input or output. /// /// GPIO pins are device-dependent. Some features are only available on @@ -1112,30 +1214,58 @@ mip_cmd_result mip_3dm_default_pps_source(struct mip_interface* device); /// ///@{ -typedef uint8_t mip_3dm_gpio_config_command_feature; -static const mip_3dm_gpio_config_command_feature MIP_3DM_GPIO_CONFIG_COMMAND_FEATURE_UNUSED = 0; ///< The pin is not used. It may be technically possible to read the pin state in this mode, but this is not guaranteed to be true of all devices or pins. -static const mip_3dm_gpio_config_command_feature MIP_3DM_GPIO_CONFIG_COMMAND_FEATURE_GPIO = 1; ///< General purpose input or output. Use this for direct control of pin output state or to stream the state of the pin. -static const mip_3dm_gpio_config_command_feature MIP_3DM_GPIO_CONFIG_COMMAND_FEATURE_PPS = 2; ///< Pulse per second input or output. -static const mip_3dm_gpio_config_command_feature MIP_3DM_GPIO_CONFIG_COMMAND_FEATURE_ENCODER = 3; ///< Motor encoder/odometer input. -static const mip_3dm_gpio_config_command_feature MIP_3DM_GPIO_CONFIG_COMMAND_FEATURE_TIMESTAMP = 4; ///< Precision Timestamping. Use with Event Trigger Configuration (0x0C,0x2E). -static const mip_3dm_gpio_config_command_feature MIP_3DM_GPIO_CONFIG_COMMAND_FEATURE_UART = 5; ///< UART data or control lines. - -typedef uint8_t mip_3dm_gpio_config_command_behavior; -static const mip_3dm_gpio_config_command_behavior MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_UNUSED = 0; ///< Use 0 unless otherwise specified. -static const mip_3dm_gpio_config_command_behavior MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_GPIO_INPUT = 1; ///< Pin will be an input. This can be used to stream or poll the value and is the default setting. -static const mip_3dm_gpio_config_command_behavior MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_GPIO_OUTPUT_LOW = 2; ///< Pin is an output initially in the LOW state. This state will be restored during system startup if the configuration is saved. -static const mip_3dm_gpio_config_command_behavior MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_GPIO_OUTPUT_HIGH = 3; ///< Pin is an output initially in the HIGH state. This state will be restored during system startup if the configuration is saved. -static const mip_3dm_gpio_config_command_behavior MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_PPS_INPUT = 1; ///< Pin will receive the pulse-per-second signal. Only one pin can have this behavior. This will only work if the PPS Source command is configured to GPIO. -static const mip_3dm_gpio_config_command_behavior MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_PPS_OUTPUT = 2; ///< Pin will transmit the pulse-per-second signal from the device. -static const mip_3dm_gpio_config_command_behavior MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_ENCODER_A = 1; ///< Encoder "A" quadrature input. Only one pin can have this behavior. The last command to set this behavior will take precedence. -static const mip_3dm_gpio_config_command_behavior MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_ENCODER_B = 2; ///< Encoder "B" quadrature input. Only one pin can have this behavior. The last command to set this behavior will take precedence. -static const mip_3dm_gpio_config_command_behavior MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_TIMESTAMP_RISING = 1; ///< Rising edges will be timestamped. -static const mip_3dm_gpio_config_command_behavior MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_TIMESTAMP_FALLING = 2; ///< Falling edges will be timestamped. -static const mip_3dm_gpio_config_command_behavior MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_TIMESTAMP_EITHER = 3; ///< Both rising and falling edges will be timestamped. -static const mip_3dm_gpio_config_command_behavior MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_UART_PORT2_TX = 33; ///< (0x21) UART port 2 transmit. -static const mip_3dm_gpio_config_command_behavior MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_UART_PORT2_RX = 34; ///< (0x22) UART port 2 receive. -static const mip_3dm_gpio_config_command_behavior MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_UART_PORT3_TX = 49; ///< (0x31) UART port 3 transmit. -static const mip_3dm_gpio_config_command_behavior MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_UART_PORT3_RX = 50; ///< (0x32) UART port 3 receive. +enum mip_3dm_gpio_config_command_feature +{ + MIP_3DM_GPIO_CONFIG_COMMAND_FEATURE_UNUSED = 0, ///< The pin is not used. It may be technically possible to read the pin state in this mode, but this is not guaranteed to be true of all devices or pins. + MIP_3DM_GPIO_CONFIG_COMMAND_FEATURE_GPIO = 1, ///< General purpose input or output. Use this for direct control of pin output state or to stream the state of the pin. + MIP_3DM_GPIO_CONFIG_COMMAND_FEATURE_PPS = 2, ///< Pulse per second input or output. + MIP_3DM_GPIO_CONFIG_COMMAND_FEATURE_ENCODER = 3, ///< Motor encoder/odometer input. + MIP_3DM_GPIO_CONFIG_COMMAND_FEATURE_TIMESTAMP = 4, ///< Precision Timestamping. Use with Event Trigger Configuration (0x0C,0x2E). + MIP_3DM_GPIO_CONFIG_COMMAND_FEATURE_UART = 5, ///< UART data or control lines. +}; +typedef enum mip_3dm_gpio_config_command_feature mip_3dm_gpio_config_command_feature; + +static inline void insert_mip_3dm_gpio_config_command_feature(microstrain_serializer* serializer, const mip_3dm_gpio_config_command_feature self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_3dm_gpio_config_command_feature(microstrain_serializer* serializer, mip_3dm_gpio_config_command_feature* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} + +enum mip_3dm_gpio_config_command_behavior +{ + MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_UNUSED = 0, ///< Use 0 unless otherwise specified. + MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_GPIO_INPUT = 1, ///< Pin will be an input. This can be used to stream or poll the value and is the default setting. + MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_GPIO_OUTPUT_LOW = 2, ///< Pin is an output initially in the LOW state. This state will be restored during system startup if the configuration is saved. + MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_GPIO_OUTPUT_HIGH = 3, ///< Pin is an output initially in the HIGH state. This state will be restored during system startup if the configuration is saved. + MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_PPS_INPUT = 1, ///< Pin will receive the pulse-per-second signal. Only one pin can have this behavior. This will only work if the PPS Source command is configured to GPIO. + MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_PPS_OUTPUT = 2, ///< Pin will transmit the pulse-per-second signal from the device. + MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_ENCODER_A = 1, ///< Encoder "A" quadrature input. Only one pin can have this behavior. The last command to set this behavior will take precedence. + MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_ENCODER_B = 2, ///< Encoder "B" quadrature input. Only one pin can have this behavior. The last command to set this behavior will take precedence. + MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_TIMESTAMP_RISING = 1, ///< Rising edges will be timestamped. + MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_TIMESTAMP_FALLING = 2, ///< Falling edges will be timestamped. + MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_TIMESTAMP_EITHER = 3, ///< Both rising and falling edges will be timestamped. + MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_UART_PORT2_TX = 33, ///< (0x21) UART port 2 transmit. + MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_UART_PORT2_RX = 34, ///< (0x22) UART port 2 receive. + MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_UART_PORT3_TX = 49, ///< (0x31) UART port 3 transmit. + MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_UART_PORT3_RX = 50, ///< (0x32) UART port 3 receive. +}; +typedef enum mip_3dm_gpio_config_command_behavior mip_3dm_gpio_config_command_behavior; + +static inline void insert_mip_3dm_gpio_config_command_behavior(microstrain_serializer* serializer, const mip_3dm_gpio_config_command_behavior self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_3dm_gpio_config_command_behavior(microstrain_serializer* serializer, mip_3dm_gpio_config_command_behavior* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} typedef uint8_t mip_3dm_gpio_config_command_pin_mode; static const mip_3dm_gpio_config_command_pin_mode MIP_3DM_GPIO_CONFIG_COMMAND_PIN_MODE_NONE = 0x00; @@ -1143,6 +1273,17 @@ static const mip_3dm_gpio_config_command_pin_mode MIP_3DM_GPIO_CONFIG_COMMAND_PI static const mip_3dm_gpio_config_command_pin_mode MIP_3DM_GPIO_CONFIG_COMMAND_PIN_MODE_PULLDOWN = 0x02; ///< The pin will have an internal pull-down resistor enabled. This is useful for connecting inputs to signals which can only be pulled high such as mechanical switches. Cannot be used in combination with pull-up. See the device specifications for the resistance value. static const mip_3dm_gpio_config_command_pin_mode MIP_3DM_GPIO_CONFIG_COMMAND_PIN_MODE_PULLUP = 0x04; ///< The pin will have an internal pull-up resistor enabled. Useful for connecting inputs to signals which can only be pulled low such as mechanical switches, or in combination with an open drain output. Cannot be used in combination with pull-down. See the device specifications for the resistance value. Use of this mode may restrict the maximum allowed input voltage. See the device datasheet for details. static const mip_3dm_gpio_config_command_pin_mode MIP_3DM_GPIO_CONFIG_COMMAND_PIN_MODE_ALL = 0x07; +static inline void insert_mip_3dm_gpio_config_command_pin_mode(microstrain_serializer* serializer, const mip_3dm_gpio_config_command_pin_mode self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_3dm_gpio_config_command_pin_mode(microstrain_serializer* serializer, mip_3dm_gpio_config_command_pin_mode* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} + struct mip_3dm_gpio_config_command { @@ -1151,20 +1292,11 @@ struct mip_3dm_gpio_config_command mip_3dm_gpio_config_command_feature feature; ///< Determines how the pin will be used. mip_3dm_gpio_config_command_behavior behavior; ///< Select an appropriate value from the enumeration based on the selected feature (e.g. for PPS, select one of the values prefixed with PPS_.) mip_3dm_gpio_config_command_pin_mode pin_mode; ///< GPIO configuration. May be restricted depending on device, pin, feature, and behavior. See device user manual. - }; typedef struct mip_3dm_gpio_config_command mip_3dm_gpio_config_command; -void insert_mip_3dm_gpio_config_command(struct mip_serializer* serializer, const mip_3dm_gpio_config_command* self); -void extract_mip_3dm_gpio_config_command(struct mip_serializer* serializer, mip_3dm_gpio_config_command* self); - -void insert_mip_3dm_gpio_config_command_feature(struct mip_serializer* serializer, const mip_3dm_gpio_config_command_feature self); -void extract_mip_3dm_gpio_config_command_feature(struct mip_serializer* serializer, mip_3dm_gpio_config_command_feature* self); -void insert_mip_3dm_gpio_config_command_behavior(struct mip_serializer* serializer, const mip_3dm_gpio_config_command_behavior self); -void extract_mip_3dm_gpio_config_command_behavior(struct mip_serializer* serializer, mip_3dm_gpio_config_command_behavior* self); - -void insert_mip_3dm_gpio_config_command_pin_mode(struct mip_serializer* serializer, const mip_3dm_gpio_config_command_pin_mode self); -void extract_mip_3dm_gpio_config_command_pin_mode(struct mip_serializer* serializer, mip_3dm_gpio_config_command_pin_mode* self); +void insert_mip_3dm_gpio_config_command(microstrain_serializer* serializer, const mip_3dm_gpio_config_command* self); +void extract_mip_3dm_gpio_config_command(microstrain_serializer* serializer, mip_3dm_gpio_config_command* self); struct mip_3dm_gpio_config_response { @@ -1172,22 +1304,22 @@ struct mip_3dm_gpio_config_response mip_3dm_gpio_config_command_feature feature; ///< Determines how the pin will be used. mip_3dm_gpio_config_command_behavior behavior; ///< Select an appropriate value from the enumeration based on the selected feature (e.g. for PPS, select one of the values prefixed with PPS_.) mip_3dm_gpio_config_command_pin_mode pin_mode; ///< GPIO configuration. May be restricted depending on device, pin, feature, and behavior. See device user manual. - }; typedef struct mip_3dm_gpio_config_response mip_3dm_gpio_config_response; -void insert_mip_3dm_gpio_config_response(struct mip_serializer* serializer, const mip_3dm_gpio_config_response* self); -void extract_mip_3dm_gpio_config_response(struct mip_serializer* serializer, mip_3dm_gpio_config_response* self); -mip_cmd_result mip_3dm_write_gpio_config(struct mip_interface* device, uint8_t pin, mip_3dm_gpio_config_command_feature feature, mip_3dm_gpio_config_command_behavior behavior, mip_3dm_gpio_config_command_pin_mode pin_mode); -mip_cmd_result mip_3dm_read_gpio_config(struct mip_interface* device, uint8_t pin, mip_3dm_gpio_config_command_feature* feature_out, mip_3dm_gpio_config_command_behavior* behavior_out, mip_3dm_gpio_config_command_pin_mode* pin_mode_out); -mip_cmd_result mip_3dm_save_gpio_config(struct mip_interface* device, uint8_t pin); -mip_cmd_result mip_3dm_load_gpio_config(struct mip_interface* device, uint8_t pin); -mip_cmd_result mip_3dm_default_gpio_config(struct mip_interface* device, uint8_t pin); +void insert_mip_3dm_gpio_config_response(microstrain_serializer* serializer, const mip_3dm_gpio_config_response* self); +void extract_mip_3dm_gpio_config_response(microstrain_serializer* serializer, mip_3dm_gpio_config_response* self); + +mip_cmd_result mip_3dm_write_gpio_config(mip_interface* device, uint8_t pin, mip_3dm_gpio_config_command_feature feature, mip_3dm_gpio_config_command_behavior behavior, mip_3dm_gpio_config_command_pin_mode pin_mode); +mip_cmd_result mip_3dm_read_gpio_config(mip_interface* device, uint8_t pin, mip_3dm_gpio_config_command_feature* feature_out, mip_3dm_gpio_config_command_behavior* behavior_out, mip_3dm_gpio_config_command_pin_mode* pin_mode_out); +mip_cmd_result mip_3dm_save_gpio_config(mip_interface* device, uint8_t pin); +mip_cmd_result mip_3dm_load_gpio_config(mip_interface* device, uint8_t pin); +mip_cmd_result mip_3dm_default_gpio_config(mip_interface* device, uint8_t pin); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_gpio_state (0x0C,0x42) Gpio State [C] +///@defgroup 3dm_gpio_state_c (0x0C,0x42) Gpio State /// Allows the state of the pin to be read or controlled. /// /// This command serves two purposes: 1) To allow reading the state of a pin via command, @@ -1212,37 +1344,52 @@ struct mip_3dm_gpio_state_command mip_function_selector function; uint8_t pin; ///< GPIO pin number counting from 1. Cannot be 0. bool state; ///< The pin state. - }; typedef struct mip_3dm_gpio_state_command mip_3dm_gpio_state_command; -void insert_mip_3dm_gpio_state_command(struct mip_serializer* serializer, const mip_3dm_gpio_state_command* self); -void extract_mip_3dm_gpio_state_command(struct mip_serializer* serializer, mip_3dm_gpio_state_command* self); + +void insert_mip_3dm_gpio_state_command(microstrain_serializer* serializer, const mip_3dm_gpio_state_command* self); +void extract_mip_3dm_gpio_state_command(microstrain_serializer* serializer, mip_3dm_gpio_state_command* self); struct mip_3dm_gpio_state_response { uint8_t pin; ///< GPIO pin number counting from 1. Cannot be 0. bool state; ///< The pin state. - }; typedef struct mip_3dm_gpio_state_response mip_3dm_gpio_state_response; -void insert_mip_3dm_gpio_state_response(struct mip_serializer* serializer, const mip_3dm_gpio_state_response* self); -void extract_mip_3dm_gpio_state_response(struct mip_serializer* serializer, mip_3dm_gpio_state_response* self); -mip_cmd_result mip_3dm_write_gpio_state(struct mip_interface* device, uint8_t pin, bool state); -mip_cmd_result mip_3dm_read_gpio_state(struct mip_interface* device, uint8_t pin, bool* state_out); +void insert_mip_3dm_gpio_state_response(microstrain_serializer* serializer, const mip_3dm_gpio_state_response* self); +void extract_mip_3dm_gpio_state_response(microstrain_serializer* serializer, mip_3dm_gpio_state_response* self); + +mip_cmd_result mip_3dm_write_gpio_state(mip_interface* device, uint8_t pin, bool state); +mip_cmd_result mip_3dm_read_gpio_state(mip_interface* device, uint8_t pin, bool* state_out); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_odometer (0x0C,0x43) Odometer [C] +///@defgroup 3dm_odometer_c (0x0C,0x43) Odometer /// Configures the hardware odometer interface. /// /// ///@{ -typedef uint8_t mip_3dm_odometer_command_mode; -static const mip_3dm_odometer_command_mode MIP_3DM_ODOMETER_COMMAND_MODE_DISABLED = 0; ///< Encoder is disabled. -static const mip_3dm_odometer_command_mode MIP_3DM_ODOMETER_COMMAND_MODE_QUADRATURE = 2; ///< Quadrature encoder mode. +enum mip_3dm_odometer_command_mode +{ + MIP_3DM_ODOMETER_COMMAND_MODE_DISABLED = 0, ///< Encoder is disabled. + MIP_3DM_ODOMETER_COMMAND_MODE_QUADRATURE = 2, ///< Quadrature encoder mode. +}; +typedef enum mip_3dm_odometer_command_mode mip_3dm_odometer_command_mode; + +static inline void insert_mip_3dm_odometer_command_mode(microstrain_serializer* serializer, const mip_3dm_odometer_command_mode self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_3dm_odometer_command_mode(microstrain_serializer* serializer, mip_3dm_odometer_command_mode* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} + struct mip_3dm_odometer_command { @@ -1250,36 +1397,33 @@ struct mip_3dm_odometer_command mip_3dm_odometer_command_mode mode; ///< Mode setting. float scaling; ///< Encoder pulses per meter of distance traveled [pulses/m]. Distance traveled is computed using the formula d = p / N * 2R * pi, where d is distance, p is the number of pulses received, N is the encoder resolution, and R is the wheel radius. By simplifying all of the parameters into one, the formula d = p / S is obtained, where s is the odometer scaling factor passed to this command. S is equivalent to N / (2R * pi) and has units of pulses / meter. N is in units of "A" pulses per revolution and R is in meters. Make this value negative if the odometer is mounted so that it rotates backwards. float uncertainty; ///< Uncertainty in encoder counts to distance translation (1-sigma value) [m/m]. - }; typedef struct mip_3dm_odometer_command mip_3dm_odometer_command; -void insert_mip_3dm_odometer_command(struct mip_serializer* serializer, const mip_3dm_odometer_command* self); -void extract_mip_3dm_odometer_command(struct mip_serializer* serializer, mip_3dm_odometer_command* self); -void insert_mip_3dm_odometer_command_mode(struct mip_serializer* serializer, const mip_3dm_odometer_command_mode self); -void extract_mip_3dm_odometer_command_mode(struct mip_serializer* serializer, mip_3dm_odometer_command_mode* self); +void insert_mip_3dm_odometer_command(microstrain_serializer* serializer, const mip_3dm_odometer_command* self); +void extract_mip_3dm_odometer_command(microstrain_serializer* serializer, mip_3dm_odometer_command* self); struct mip_3dm_odometer_response { mip_3dm_odometer_command_mode mode; ///< Mode setting. float scaling; ///< Encoder pulses per meter of distance traveled [pulses/m]. Distance traveled is computed using the formula d = p / N * 2R * pi, where d is distance, p is the number of pulses received, N is the encoder resolution, and R is the wheel radius. By simplifying all of the parameters into one, the formula d = p / S is obtained, where s is the odometer scaling factor passed to this command. S is equivalent to N / (2R * pi) and has units of pulses / meter. N is in units of "A" pulses per revolution and R is in meters. Make this value negative if the odometer is mounted so that it rotates backwards. float uncertainty; ///< Uncertainty in encoder counts to distance translation (1-sigma value) [m/m]. - }; typedef struct mip_3dm_odometer_response mip_3dm_odometer_response; -void insert_mip_3dm_odometer_response(struct mip_serializer* serializer, const mip_3dm_odometer_response* self); -void extract_mip_3dm_odometer_response(struct mip_serializer* serializer, mip_3dm_odometer_response* self); -mip_cmd_result mip_3dm_write_odometer(struct mip_interface* device, mip_3dm_odometer_command_mode mode, float scaling, float uncertainty); -mip_cmd_result mip_3dm_read_odometer(struct mip_interface* device, mip_3dm_odometer_command_mode* mode_out, float* scaling_out, float* uncertainty_out); -mip_cmd_result mip_3dm_save_odometer(struct mip_interface* device); -mip_cmd_result mip_3dm_load_odometer(struct mip_interface* device); -mip_cmd_result mip_3dm_default_odometer(struct mip_interface* device); +void insert_mip_3dm_odometer_response(microstrain_serializer* serializer, const mip_3dm_odometer_response* self); +void extract_mip_3dm_odometer_response(microstrain_serializer* serializer, mip_3dm_odometer_response* self); + +mip_cmd_result mip_3dm_write_odometer(mip_interface* device, mip_3dm_odometer_command_mode mode, float scaling, float uncertainty); +mip_cmd_result mip_3dm_read_odometer(mip_interface* device, mip_3dm_odometer_command_mode* mode_out, float* scaling_out, float* uncertainty_out); +mip_cmd_result mip_3dm_save_odometer(mip_interface* device); +mip_cmd_result mip_3dm_load_odometer(mip_interface* device); +mip_cmd_result mip_3dm_default_odometer(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_get_event_support (0x0C,0x2A) Get Event Support [C] +///@defgroup 3dm_get_event_support_c (0x0C,0x2A) Get Event Support /// Lists the available trigger or action types. /// /// There are a limited number of trigger and action slots available @@ -1300,31 +1444,43 @@ mip_cmd_result mip_3dm_default_odometer(struct mip_interface* device); /// ///@{ -typedef uint8_t mip_3dm_get_event_support_command_query; -static const mip_3dm_get_event_support_command_query MIP_3DM_GET_EVENT_SUPPORT_COMMAND_QUERY_TRIGGER_TYPES = 1; ///< Query the supported trigger types and max count for each. -static const mip_3dm_get_event_support_command_query MIP_3DM_GET_EVENT_SUPPORT_COMMAND_QUERY_ACTION_TYPES = 2; ///< Query the supported action types and max count for each. +enum mip_3dm_get_event_support_command_query +{ + MIP_3DM_GET_EVENT_SUPPORT_COMMAND_QUERY_TRIGGER_TYPES = 1, ///< Query the supported trigger types and max count for each. + MIP_3DM_GET_EVENT_SUPPORT_COMMAND_QUERY_ACTION_TYPES = 2, ///< Query the supported action types and max count for each. +}; +typedef enum mip_3dm_get_event_support_command_query mip_3dm_get_event_support_command_query; + +static inline void insert_mip_3dm_get_event_support_command_query(microstrain_serializer* serializer, const mip_3dm_get_event_support_command_query self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_3dm_get_event_support_command_query(microstrain_serializer* serializer, mip_3dm_get_event_support_command_query* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} struct mip_3dm_get_event_support_command_info { uint8_t type; ///< Trigger or action type, as defined in the respective setup command. uint8_t count; ///< This is the maximum number of instances supported for this type. - }; typedef struct mip_3dm_get_event_support_command_info mip_3dm_get_event_support_command_info; + +void insert_mip_3dm_get_event_support_command_info(microstrain_serializer* serializer, const mip_3dm_get_event_support_command_info* self); +void extract_mip_3dm_get_event_support_command_info(microstrain_serializer* serializer, mip_3dm_get_event_support_command_info* self); + + struct mip_3dm_get_event_support_command { mip_3dm_get_event_support_command_query query; ///< What type of information to retrieve. - }; typedef struct mip_3dm_get_event_support_command mip_3dm_get_event_support_command; -void insert_mip_3dm_get_event_support_command(struct mip_serializer* serializer, const mip_3dm_get_event_support_command* self); -void extract_mip_3dm_get_event_support_command(struct mip_serializer* serializer, mip_3dm_get_event_support_command* self); - -void insert_mip_3dm_get_event_support_command_query(struct mip_serializer* serializer, const mip_3dm_get_event_support_command_query self); -void extract_mip_3dm_get_event_support_command_query(struct mip_serializer* serializer, mip_3dm_get_event_support_command_query* self); -void insert_mip_3dm_get_event_support_command_info(struct mip_serializer* serializer, const mip_3dm_get_event_support_command_info* self); -void extract_mip_3dm_get_event_support_command_info(struct mip_serializer* serializer, mip_3dm_get_event_support_command_info* self); +void insert_mip_3dm_get_event_support_command(microstrain_serializer* serializer, const mip_3dm_get_event_support_command* self); +void extract_mip_3dm_get_event_support_command(microstrain_serializer* serializer, mip_3dm_get_event_support_command* self); struct mip_3dm_get_event_support_response { @@ -1332,18 +1488,18 @@ struct mip_3dm_get_event_support_response uint8_t max_instances; ///< Number of slots available. The 'instance' number for the configuration or control commands must be between 1 and this value. uint8_t num_entries; ///< Number of supported types. mip_3dm_get_event_support_command_info entries[126]; ///< List of supported types. - }; typedef struct mip_3dm_get_event_support_response mip_3dm_get_event_support_response; -void insert_mip_3dm_get_event_support_response(struct mip_serializer* serializer, const mip_3dm_get_event_support_response* self); -void extract_mip_3dm_get_event_support_response(struct mip_serializer* serializer, mip_3dm_get_event_support_response* self); -mip_cmd_result mip_3dm_get_event_support(struct mip_interface* device, mip_3dm_get_event_support_command_query query, uint8_t* max_instances_out, uint8_t* num_entries_out, uint8_t num_entries_out_max, mip_3dm_get_event_support_command_info* entries_out); +void insert_mip_3dm_get_event_support_response(microstrain_serializer* serializer, const mip_3dm_get_event_support_response* self); +void extract_mip_3dm_get_event_support_response(microstrain_serializer* serializer, mip_3dm_get_event_support_response* self); + +mip_cmd_result mip_3dm_get_event_support(mip_interface* device, mip_3dm_get_event_support_command_query query, uint8_t* max_instances_out, uint8_t* num_entries_out, uint8_t num_entries_out_max, mip_3dm_get_event_support_command_info* entries_out); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_event_control (0x0C,0x2B) Event Control [C] +///@defgroup 3dm_event_control_c (0x0C,0x2B) Event Control /// Enables or disables event triggers. /// /// Triggers can be disabled, enabled, and tested. While disabled, a trigger will @@ -1357,46 +1513,58 @@ mip_cmd_result mip_3dm_get_event_support(struct mip_interface* device, mip_3dm_g /// ///@{ -typedef uint8_t mip_3dm_event_control_command_mode; -static const mip_3dm_event_control_command_mode MIP_3DM_EVENT_CONTROL_COMMAND_MODE_DISABLED = 0; ///< Trigger is disabled. -static const mip_3dm_event_control_command_mode MIP_3DM_EVENT_CONTROL_COMMAND_MODE_ENABLED = 1; ///< Trigger is enabled and will work normally. -static const mip_3dm_event_control_command_mode MIP_3DM_EVENT_CONTROL_COMMAND_MODE_TEST = 2; ///< Forces the trigger to the active state for testing purposes. -static const mip_3dm_event_control_command_mode MIP_3DM_EVENT_CONTROL_COMMAND_MODE_TEST_PULSE = 3; ///< Trigger is forced to the active state for one event cycle only. After the test cycle, the mode reverts to the previous state (either enabled or disabled). +enum mip_3dm_event_control_command_mode +{ + MIP_3DM_EVENT_CONTROL_COMMAND_MODE_DISABLED = 0, ///< Trigger is disabled. + MIP_3DM_EVENT_CONTROL_COMMAND_MODE_ENABLED = 1, ///< Trigger is enabled and will work normally. + MIP_3DM_EVENT_CONTROL_COMMAND_MODE_TEST = 2, ///< Forces the trigger to the active state for testing purposes. + MIP_3DM_EVENT_CONTROL_COMMAND_MODE_TEST_PULSE = 3, ///< Trigger is forced to the active state for one event cycle only. After the test cycle, the mode reverts to the previous state (either enabled or disabled). +}; +typedef enum mip_3dm_event_control_command_mode mip_3dm_event_control_command_mode; + +static inline void insert_mip_3dm_event_control_command_mode(microstrain_serializer* serializer, const mip_3dm_event_control_command_mode self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_3dm_event_control_command_mode(microstrain_serializer* serializer, mip_3dm_event_control_command_mode* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} + struct mip_3dm_event_control_command { mip_function_selector function; uint8_t instance; ///< Trigger instance to affect. 0 can be used to apply the mode to all configured triggers, except when the function selector is READ. mip_3dm_event_control_command_mode mode; ///< How to change the trigger state. Except when instance is 0, the corresponding trigger must be configured, i.e. not have type 0. - }; typedef struct mip_3dm_event_control_command mip_3dm_event_control_command; -void insert_mip_3dm_event_control_command(struct mip_serializer* serializer, const mip_3dm_event_control_command* self); -void extract_mip_3dm_event_control_command(struct mip_serializer* serializer, mip_3dm_event_control_command* self); -void insert_mip_3dm_event_control_command_mode(struct mip_serializer* serializer, const mip_3dm_event_control_command_mode self); -void extract_mip_3dm_event_control_command_mode(struct mip_serializer* serializer, mip_3dm_event_control_command_mode* self); +void insert_mip_3dm_event_control_command(microstrain_serializer* serializer, const mip_3dm_event_control_command* self); +void extract_mip_3dm_event_control_command(microstrain_serializer* serializer, mip_3dm_event_control_command* self); struct mip_3dm_event_control_response { uint8_t instance; ///< Trigger instance to affect. 0 can be used to apply the mode to all configured triggers, except when the function selector is READ. mip_3dm_event_control_command_mode mode; ///< How to change the trigger state. Except when instance is 0, the corresponding trigger must be configured, i.e. not have type 0. - }; typedef struct mip_3dm_event_control_response mip_3dm_event_control_response; -void insert_mip_3dm_event_control_response(struct mip_serializer* serializer, const mip_3dm_event_control_response* self); -void extract_mip_3dm_event_control_response(struct mip_serializer* serializer, mip_3dm_event_control_response* self); -mip_cmd_result mip_3dm_write_event_control(struct mip_interface* device, uint8_t instance, mip_3dm_event_control_command_mode mode); -mip_cmd_result mip_3dm_read_event_control(struct mip_interface* device, uint8_t instance, mip_3dm_event_control_command_mode* mode_out); -mip_cmd_result mip_3dm_save_event_control(struct mip_interface* device, uint8_t instance); -mip_cmd_result mip_3dm_load_event_control(struct mip_interface* device, uint8_t instance); -mip_cmd_result mip_3dm_default_event_control(struct mip_interface* device, uint8_t instance); +void insert_mip_3dm_event_control_response(microstrain_serializer* serializer, const mip_3dm_event_control_response* self); +void extract_mip_3dm_event_control_response(microstrain_serializer* serializer, mip_3dm_event_control_response* self); + +mip_cmd_result mip_3dm_write_event_control(mip_interface* device, uint8_t instance, mip_3dm_event_control_command_mode mode); +mip_cmd_result mip_3dm_read_event_control(mip_interface* device, uint8_t instance, mip_3dm_event_control_command_mode* mode_out); +mip_cmd_result mip_3dm_save_event_control(mip_interface* device, uint8_t instance); +mip_cmd_result mip_3dm_load_event_control(mip_interface* device, uint8_t instance); +mip_cmd_result mip_3dm_default_event_control(mip_interface* device, uint8_t instance); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_get_event_trigger_status (0x0C,0x2C) Get Event Trigger Status [C] +///@defgroup 3dm_get_event_trigger_status_c (0x0C,0x2C) Get Event Trigger Status /// ///@{ @@ -1406,46 +1574,54 @@ static const mip_3dm_get_event_trigger_status_command_status MIP_3DM_GET_EVENT_T static const mip_3dm_get_event_trigger_status_command_status MIP_3DM_GET_EVENT_TRIGGER_STATUS_COMMAND_STATUS_ENABLED = 0x02; ///< True if the trigger is enabled. static const mip_3dm_get_event_trigger_status_command_status MIP_3DM_GET_EVENT_TRIGGER_STATUS_COMMAND_STATUS_TEST = 0x04; ///< True if the trigger is in test mode. static const mip_3dm_get_event_trigger_status_command_status MIP_3DM_GET_EVENT_TRIGGER_STATUS_COMMAND_STATUS_ALL = 0x07; +static inline void insert_mip_3dm_get_event_trigger_status_command_status(microstrain_serializer* serializer, const mip_3dm_get_event_trigger_status_command_status self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_3dm_get_event_trigger_status_command_status(microstrain_serializer* serializer, mip_3dm_get_event_trigger_status_command_status* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} struct mip_3dm_get_event_trigger_status_command_entry { uint8_t type; ///< Configured trigger type. mip_3dm_get_event_trigger_status_command_status status; ///< Trigger status. - }; typedef struct mip_3dm_get_event_trigger_status_command_entry mip_3dm_get_event_trigger_status_command_entry; + +void insert_mip_3dm_get_event_trigger_status_command_entry(microstrain_serializer* serializer, const mip_3dm_get_event_trigger_status_command_entry* self); +void extract_mip_3dm_get_event_trigger_status_command_entry(microstrain_serializer* serializer, mip_3dm_get_event_trigger_status_command_entry* self); + + struct mip_3dm_get_event_trigger_status_command { uint8_t requested_count; ///< Number of entries requested. If 0, requests all trigger slots. uint8_t requested_instances[20]; ///< List of trigger instances to query. - }; typedef struct mip_3dm_get_event_trigger_status_command mip_3dm_get_event_trigger_status_command; -void insert_mip_3dm_get_event_trigger_status_command(struct mip_serializer* serializer, const mip_3dm_get_event_trigger_status_command* self); -void extract_mip_3dm_get_event_trigger_status_command(struct mip_serializer* serializer, mip_3dm_get_event_trigger_status_command* self); - -void insert_mip_3dm_get_event_trigger_status_command_status(struct mip_serializer* serializer, const mip_3dm_get_event_trigger_status_command_status self); -void extract_mip_3dm_get_event_trigger_status_command_status(struct mip_serializer* serializer, mip_3dm_get_event_trigger_status_command_status* self); -void insert_mip_3dm_get_event_trigger_status_command_entry(struct mip_serializer* serializer, const mip_3dm_get_event_trigger_status_command_entry* self); -void extract_mip_3dm_get_event_trigger_status_command_entry(struct mip_serializer* serializer, mip_3dm_get_event_trigger_status_command_entry* self); +void insert_mip_3dm_get_event_trigger_status_command(microstrain_serializer* serializer, const mip_3dm_get_event_trigger_status_command* self); +void extract_mip_3dm_get_event_trigger_status_command(microstrain_serializer* serializer, mip_3dm_get_event_trigger_status_command* self); struct mip_3dm_get_event_trigger_status_response { uint8_t count; ///< Number of entries requested. If requested_count was 0, this is the number of supported trigger slots. mip_3dm_get_event_trigger_status_command_entry triggers[20]; ///< A list of the configured triggers. Entries are in the order requested, or in increasing order if count was 0. - }; typedef struct mip_3dm_get_event_trigger_status_response mip_3dm_get_event_trigger_status_response; -void insert_mip_3dm_get_event_trigger_status_response(struct mip_serializer* serializer, const mip_3dm_get_event_trigger_status_response* self); -void extract_mip_3dm_get_event_trigger_status_response(struct mip_serializer* serializer, mip_3dm_get_event_trigger_status_response* self); -mip_cmd_result mip_3dm_get_event_trigger_status(struct mip_interface* device, uint8_t requested_count, const uint8_t* requested_instances, uint8_t* count_out, uint8_t count_out_max, mip_3dm_get_event_trigger_status_command_entry* triggers_out); +void insert_mip_3dm_get_event_trigger_status_response(microstrain_serializer* serializer, const mip_3dm_get_event_trigger_status_response* self); +void extract_mip_3dm_get_event_trigger_status_response(microstrain_serializer* serializer, mip_3dm_get_event_trigger_status_response* self); + +mip_cmd_result mip_3dm_get_event_trigger_status(mip_interface* device, uint8_t requested_count, const uint8_t* requested_instances, uint8_t* count_out, uint8_t count_out_max, mip_3dm_get_event_trigger_status_command_entry* triggers_out); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_get_event_action_status (0x0C,0x2D) Get Event Action Status [C] +///@defgroup 3dm_get_event_action_status_c (0x0C,0x2D) Get Event Action Status /// ///@{ @@ -1453,58 +1629,92 @@ struct mip_3dm_get_event_action_status_command_entry { uint8_t action_type; ///< Configured action type. uint8_t trigger_id; ///< Associated trigger instance. - }; typedef struct mip_3dm_get_event_action_status_command_entry mip_3dm_get_event_action_status_command_entry; + +void insert_mip_3dm_get_event_action_status_command_entry(microstrain_serializer* serializer, const mip_3dm_get_event_action_status_command_entry* self); +void extract_mip_3dm_get_event_action_status_command_entry(microstrain_serializer* serializer, mip_3dm_get_event_action_status_command_entry* self); + + struct mip_3dm_get_event_action_status_command { uint8_t requested_count; ///< Number of entries requested. If 0, requests all action slots. uint8_t requested_instances[20]; ///< List of action instances to query. - }; typedef struct mip_3dm_get_event_action_status_command mip_3dm_get_event_action_status_command; -void insert_mip_3dm_get_event_action_status_command(struct mip_serializer* serializer, const mip_3dm_get_event_action_status_command* self); -void extract_mip_3dm_get_event_action_status_command(struct mip_serializer* serializer, mip_3dm_get_event_action_status_command* self); -void insert_mip_3dm_get_event_action_status_command_entry(struct mip_serializer* serializer, const mip_3dm_get_event_action_status_command_entry* self); -void extract_mip_3dm_get_event_action_status_command_entry(struct mip_serializer* serializer, mip_3dm_get_event_action_status_command_entry* self); +void insert_mip_3dm_get_event_action_status_command(microstrain_serializer* serializer, const mip_3dm_get_event_action_status_command* self); +void extract_mip_3dm_get_event_action_status_command(microstrain_serializer* serializer, mip_3dm_get_event_action_status_command* self); struct mip_3dm_get_event_action_status_response { uint8_t count; ///< Number of entries requested. If requested_count was 0, this is the number of supported action slots. mip_3dm_get_event_action_status_command_entry actions[20]; ///< A list of the configured actions. Entries are in the order requested, or in increasing order if count was 0. - }; typedef struct mip_3dm_get_event_action_status_response mip_3dm_get_event_action_status_response; -void insert_mip_3dm_get_event_action_status_response(struct mip_serializer* serializer, const mip_3dm_get_event_action_status_response* self); -void extract_mip_3dm_get_event_action_status_response(struct mip_serializer* serializer, mip_3dm_get_event_action_status_response* self); -mip_cmd_result mip_3dm_get_event_action_status(struct mip_interface* device, uint8_t requested_count, const uint8_t* requested_instances, uint8_t* count_out, uint8_t count_out_max, mip_3dm_get_event_action_status_command_entry* actions_out); +void insert_mip_3dm_get_event_action_status_response(microstrain_serializer* serializer, const mip_3dm_get_event_action_status_response* self); +void extract_mip_3dm_get_event_action_status_response(microstrain_serializer* serializer, mip_3dm_get_event_action_status_response* self); + +mip_cmd_result mip_3dm_get_event_action_status(mip_interface* device, uint8_t requested_count, const uint8_t* requested_instances, uint8_t* count_out, uint8_t count_out_max, mip_3dm_get_event_action_status_command_entry* actions_out); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_event_trigger (0x0C,0x2E) Event Trigger [C] +///@defgroup 3dm_event_trigger_c (0x0C,0x2E) Event Trigger /// Configures various types of event triggers. /// ///@{ -typedef uint8_t mip_3dm_event_trigger_command_gpio_params_mode; -static const mip_3dm_event_trigger_command_gpio_params_mode MIP_3DM_EVENT_TRIGGER_COMMAND_GPIO_PARAMS_MODE_DISABLED = 0; ///< The pin will have no effect and the trigger will never activate. -static const mip_3dm_event_trigger_command_gpio_params_mode MIP_3DM_EVENT_TRIGGER_COMMAND_GPIO_PARAMS_MODE_WHILE_HIGH = 1; ///< The trigger will be active while the pin is high. -static const mip_3dm_event_trigger_command_gpio_params_mode MIP_3DM_EVENT_TRIGGER_COMMAND_GPIO_PARAMS_MODE_WHILE_LOW = 2; ///< The trigger will be active while the pin is low. -static const mip_3dm_event_trigger_command_gpio_params_mode MIP_3DM_EVENT_TRIGGER_COMMAND_GPIO_PARAMS_MODE_EDGE = 4; ///< Use if the pin is configured for timestamping via the 3DM Gpio Configuration command (0x0C41). +enum mip_3dm_event_trigger_command_gpio_params_mode +{ + MIP_3DM_EVENT_TRIGGER_COMMAND_GPIO_PARAMS_MODE_DISABLED = 0, ///< The pin will have no effect and the trigger will never activate. + MIP_3DM_EVENT_TRIGGER_COMMAND_GPIO_PARAMS_MODE_WHILE_HIGH = 1, ///< The trigger will be active while the pin is high. + MIP_3DM_EVENT_TRIGGER_COMMAND_GPIO_PARAMS_MODE_WHILE_LOW = 2, ///< The trigger will be active while the pin is low. + MIP_3DM_EVENT_TRIGGER_COMMAND_GPIO_PARAMS_MODE_EDGE = 4, ///< Use if the pin is configured for timestamping via the 3DM Gpio Configuration command (0x0C41). +}; +typedef enum mip_3dm_event_trigger_command_gpio_params_mode mip_3dm_event_trigger_command_gpio_params_mode; + +static inline void insert_mip_3dm_event_trigger_command_gpio_params_mode(microstrain_serializer* serializer, const mip_3dm_event_trigger_command_gpio_params_mode self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_3dm_event_trigger_command_gpio_params_mode(microstrain_serializer* serializer, mip_3dm_event_trigger_command_gpio_params_mode* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} + struct mip_3dm_event_trigger_command_gpio_params { uint8_t pin; ///< GPIO pin number. mip_3dm_event_trigger_command_gpio_params_mode mode; ///< How the pin state affects the trigger. - }; typedef struct mip_3dm_event_trigger_command_gpio_params mip_3dm_event_trigger_command_gpio_params; -typedef uint8_t mip_3dm_event_trigger_command_threshold_params_type; -static const mip_3dm_event_trigger_command_threshold_params_type MIP_3DM_EVENT_TRIGGER_COMMAND_THRESHOLD_PARAMS_TYPE_WINDOW = 1; ///< Window comparison. Trigger is active if low_thres <= value <= high_thres. If the thresholds are reversed, the trigger is active when value < high_thres or value > low_thres. -static const mip_3dm_event_trigger_command_threshold_params_type MIP_3DM_EVENT_TRIGGER_COMMAND_THRESHOLD_PARAMS_TYPE_INTERVAL = 2; ///< Trigger at evenly-spaced intervals. Normally used with time fields to trigger periodically. Trigger is active when (value % interval) <= int_thres. If the thresholds are reversed (high_thres < low_thres) then the trigger is active when (value % low_thres) > high_thres. + +void insert_mip_3dm_event_trigger_command_gpio_params(microstrain_serializer* serializer, const mip_3dm_event_trigger_command_gpio_params* self); +void extract_mip_3dm_event_trigger_command_gpio_params(microstrain_serializer* serializer, mip_3dm_event_trigger_command_gpio_params* self); + +enum mip_3dm_event_trigger_command_threshold_params_type +{ + MIP_3DM_EVENT_TRIGGER_COMMAND_THRESHOLD_PARAMS_TYPE_WINDOW = 1, ///< Window comparison. Trigger is active if low_thres <= value <= high_thres. If the thresholds are reversed, the trigger is active when value < high_thres or value > low_thres. + MIP_3DM_EVENT_TRIGGER_COMMAND_THRESHOLD_PARAMS_TYPE_INTERVAL = 2, ///< Trigger at evenly-spaced intervals. Normally used with time fields to trigger periodically. Trigger is active when (value % interval) <= int_thres. If the thresholds are reversed (high_thres < low_thres) then the trigger is active when (value % low_thres) > high_thres. +}; +typedef enum mip_3dm_event_trigger_command_threshold_params_type mip_3dm_event_trigger_command_threshold_params_type; + +static inline void insert_mip_3dm_event_trigger_command_threshold_params_type(microstrain_serializer* serializer, const mip_3dm_event_trigger_command_threshold_params_type self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_3dm_event_trigger_command_threshold_params_type(microstrain_serializer* serializer, mip_3dm_event_trigger_command_threshold_params_type* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} + struct mip_3dm_event_trigger_command_threshold_params { @@ -1522,9 +1732,12 @@ struct mip_3dm_event_trigger_command_threshold_params double high_thres; double interval; }; - }; typedef struct mip_3dm_event_trigger_command_threshold_params mip_3dm_event_trigger_command_threshold_params; + +void insert_mip_3dm_event_trigger_command_threshold_params(microstrain_serializer* serializer, const mip_3dm_event_trigger_command_threshold_params* self); +void extract_mip_3dm_event_trigger_command_threshold_params(microstrain_serializer* serializer, mip_3dm_event_trigger_command_threshold_params* self); + enum { MIP_3DM_EVENT_TRIGGER_COMMAND_COMBINATION_PARAMS_LOGIC_NEVER = 0x0000 }; enum { MIP_3DM_EVENT_TRIGGER_COMMAND_COMBINATION_PARAMS_LOGIC_ALWAYS = 0xFFFF }; enum { MIP_3DM_EVENT_TRIGGER_COMMAND_COMBINATION_PARAMS_LOGIC_NONE = 0x0001 }; @@ -1538,18 +1751,36 @@ enum { MIP_3DM_EVENT_TRIGGER_COMMAND_COMBINATION_PARAMS_LOGIC_ONLY_D = 0x0100 }; enum { MIP_3DM_EVENT_TRIGGER_COMMAND_COMBINATION_PARAMS_LOGIC_AND_AB = 0x8888 }; enum { MIP_3DM_EVENT_TRIGGER_COMMAND_COMBINATION_PARAMS_LOGIC_AB_OR_C = 0xF8F8 }; enum { MIP_3DM_EVENT_TRIGGER_COMMAND_COMBINATION_PARAMS_LOGIC_AND = 0x8000 }; + struct mip_3dm_event_trigger_command_combination_params { uint16_t logic_table; ///< The last column of a truth table describing the output given the state of each input. uint8_t input_triggers[4]; ///< List of trigger IDs for inputs. Use 0 for unused inputs. - }; typedef struct mip_3dm_event_trigger_command_combination_params mip_3dm_event_trigger_command_combination_params; -typedef uint8_t mip_3dm_event_trigger_command_type; -static const mip_3dm_event_trigger_command_type MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_NONE = 0; ///< No trigger selected. The state will always be inactive. -static const mip_3dm_event_trigger_command_type MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_GPIO = 1; ///< Trigger based on the state of a GPIO pin. See GpioParams. -static const mip_3dm_event_trigger_command_type MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_THRESHOLD = 2; ///< Compare a data quantity against a high and low threshold. See ThresholdParams. -static const mip_3dm_event_trigger_command_type MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_COMBINATION = 3; ///< Logical combination of two or more triggers. See CombinationParams. + +void insert_mip_3dm_event_trigger_command_combination_params(microstrain_serializer* serializer, const mip_3dm_event_trigger_command_combination_params* self); +void extract_mip_3dm_event_trigger_command_combination_params(microstrain_serializer* serializer, mip_3dm_event_trigger_command_combination_params* self); + +enum mip_3dm_event_trigger_command_type +{ + MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_NONE = 0, ///< No trigger selected. The state will always be inactive. + MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_GPIO = 1, ///< Trigger based on the state of a GPIO pin. See GpioParams. + MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_THRESHOLD = 2, ///< Compare a data quantity against a high and low threshold. See ThresholdParams. + MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_COMBINATION = 3, ///< Logical combination of two or more triggers. See CombinationParams. +}; +typedef enum mip_3dm_event_trigger_command_type mip_3dm_event_trigger_command_type; + +static inline void insert_mip_3dm_event_trigger_command_type(microstrain_serializer* serializer, const mip_3dm_event_trigger_command_type self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_3dm_event_trigger_command_type(microstrain_serializer* serializer, mip_3dm_event_trigger_command_type* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} union mip_3dm_event_trigger_command_parameters { @@ -1565,83 +1796,100 @@ struct mip_3dm_event_trigger_command uint8_t instance; ///< Trigger number. When function is SAVE, LOAD, or DEFAULT, this can be 0 to apply to all instances. mip_3dm_event_trigger_command_type type; ///< Type of trigger to configure. mip_3dm_event_trigger_command_parameters parameters; - }; typedef struct mip_3dm_event_trigger_command mip_3dm_event_trigger_command; -void insert_mip_3dm_event_trigger_command(struct mip_serializer* serializer, const mip_3dm_event_trigger_command* self); -void extract_mip_3dm_event_trigger_command(struct mip_serializer* serializer, mip_3dm_event_trigger_command* self); -void insert_mip_3dm_event_trigger_command_gpio_params(struct mip_serializer* serializer, const mip_3dm_event_trigger_command_gpio_params* self); -void extract_mip_3dm_event_trigger_command_gpio_params(struct mip_serializer* serializer, mip_3dm_event_trigger_command_gpio_params* self); - -void insert_mip_3dm_event_trigger_command_gpio_params_mode(struct mip_serializer* serializer, const mip_3dm_event_trigger_command_gpio_params_mode self); -void extract_mip_3dm_event_trigger_command_gpio_params_mode(struct mip_serializer* serializer, mip_3dm_event_trigger_command_gpio_params_mode* self); - -void insert_mip_3dm_event_trigger_command_threshold_params(struct mip_serializer* serializer, const mip_3dm_event_trigger_command_threshold_params* self); -void extract_mip_3dm_event_trigger_command_threshold_params(struct mip_serializer* serializer, mip_3dm_event_trigger_command_threshold_params* self); - -void insert_mip_3dm_event_trigger_command_threshold_params_type(struct mip_serializer* serializer, const mip_3dm_event_trigger_command_threshold_params_type self); -void extract_mip_3dm_event_trigger_command_threshold_params_type(struct mip_serializer* serializer, mip_3dm_event_trigger_command_threshold_params_type* self); - -void insert_mip_3dm_event_trigger_command_combination_params(struct mip_serializer* serializer, const mip_3dm_event_trigger_command_combination_params* self); -void extract_mip_3dm_event_trigger_command_combination_params(struct mip_serializer* serializer, mip_3dm_event_trigger_command_combination_params* self); - -void insert_mip_3dm_event_trigger_command_type(struct mip_serializer* serializer, const mip_3dm_event_trigger_command_type self); -void extract_mip_3dm_event_trigger_command_type(struct mip_serializer* serializer, mip_3dm_event_trigger_command_type* self); +void insert_mip_3dm_event_trigger_command(microstrain_serializer* serializer, const mip_3dm_event_trigger_command* self); +void extract_mip_3dm_event_trigger_command(microstrain_serializer* serializer, mip_3dm_event_trigger_command* self); struct mip_3dm_event_trigger_response { uint8_t instance; ///< Trigger number. When function is SAVE, LOAD, or DEFAULT, this can be 0 to apply to all instances. mip_3dm_event_trigger_command_type type; ///< Type of trigger to configure. mip_3dm_event_trigger_command_parameters parameters; - }; typedef struct mip_3dm_event_trigger_response mip_3dm_event_trigger_response; -void insert_mip_3dm_event_trigger_response(struct mip_serializer* serializer, const mip_3dm_event_trigger_response* self); -void extract_mip_3dm_event_trigger_response(struct mip_serializer* serializer, mip_3dm_event_trigger_response* self); -mip_cmd_result mip_3dm_write_event_trigger(struct mip_interface* device, uint8_t instance, mip_3dm_event_trigger_command_type type, const mip_3dm_event_trigger_command_parameters* parameters); -mip_cmd_result mip_3dm_read_event_trigger(struct mip_interface* device, uint8_t instance, mip_3dm_event_trigger_command_type* type_out, mip_3dm_event_trigger_command_parameters* parameters_out); -mip_cmd_result mip_3dm_save_event_trigger(struct mip_interface* device, uint8_t instance); -mip_cmd_result mip_3dm_load_event_trigger(struct mip_interface* device, uint8_t instance); -mip_cmd_result mip_3dm_default_event_trigger(struct mip_interface* device, uint8_t instance); +void insert_mip_3dm_event_trigger_response(microstrain_serializer* serializer, const mip_3dm_event_trigger_response* self); +void extract_mip_3dm_event_trigger_response(microstrain_serializer* serializer, mip_3dm_event_trigger_response* self); + +mip_cmd_result mip_3dm_write_event_trigger(mip_interface* device, uint8_t instance, mip_3dm_event_trigger_command_type type, const mip_3dm_event_trigger_command_parameters* parameters); +mip_cmd_result mip_3dm_read_event_trigger(mip_interface* device, uint8_t instance, mip_3dm_event_trigger_command_type* type_out, mip_3dm_event_trigger_command_parameters* parameters_out); +mip_cmd_result mip_3dm_save_event_trigger(mip_interface* device, uint8_t instance); +mip_cmd_result mip_3dm_load_event_trigger(mip_interface* device, uint8_t instance); +mip_cmd_result mip_3dm_default_event_trigger(mip_interface* device, uint8_t instance); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_event_action (0x0C,0x2F) Event Action [C] +///@defgroup 3dm_event_action_c (0x0C,0x2F) Event Action /// Configures various types of event actions. /// ///@{ -typedef uint8_t mip_3dm_event_action_command_gpio_params_mode; -static const mip_3dm_event_action_command_gpio_params_mode MIP_3DM_EVENT_ACTION_COMMAND_GPIO_PARAMS_MODE_DISABLED = 0; ///< Pin state will not be changed. -static const mip_3dm_event_action_command_gpio_params_mode MIP_3DM_EVENT_ACTION_COMMAND_GPIO_PARAMS_MODE_ACTIVE_HIGH = 1; ///< Pin will be set high when the trigger is active and low otherwise. -static const mip_3dm_event_action_command_gpio_params_mode MIP_3DM_EVENT_ACTION_COMMAND_GPIO_PARAMS_MODE_ACTIVE_LOW = 2; ///< Pin will be set low when the trigger is active and high otherwise. -static const mip_3dm_event_action_command_gpio_params_mode MIP_3DM_EVENT_ACTION_COMMAND_GPIO_PARAMS_MODE_ONESHOT_HIGH = 5; ///< Pin will be set high each time the trigger activates. It will not be set low. -static const mip_3dm_event_action_command_gpio_params_mode MIP_3DM_EVENT_ACTION_COMMAND_GPIO_PARAMS_MODE_ONESHOT_LOW = 6; ///< Pin will be set low each time the trigger activates. It will not be set high. -static const mip_3dm_event_action_command_gpio_params_mode MIP_3DM_EVENT_ACTION_COMMAND_GPIO_PARAMS_MODE_TOGGLE = 7; ///< Pin will change to the opposite state each time the trigger activates. +enum mip_3dm_event_action_command_gpio_params_mode +{ + MIP_3DM_EVENT_ACTION_COMMAND_GPIO_PARAMS_MODE_DISABLED = 0, ///< Pin state will not be changed. + MIP_3DM_EVENT_ACTION_COMMAND_GPIO_PARAMS_MODE_ACTIVE_HIGH = 1, ///< Pin will be set high when the trigger is active and low otherwise. + MIP_3DM_EVENT_ACTION_COMMAND_GPIO_PARAMS_MODE_ACTIVE_LOW = 2, ///< Pin will be set low when the trigger is active and high otherwise. + MIP_3DM_EVENT_ACTION_COMMAND_GPIO_PARAMS_MODE_ONESHOT_HIGH = 5, ///< Pin will be set high each time the trigger activates. It will not be set low. + MIP_3DM_EVENT_ACTION_COMMAND_GPIO_PARAMS_MODE_ONESHOT_LOW = 6, ///< Pin will be set low each time the trigger activates. It will not be set high. + MIP_3DM_EVENT_ACTION_COMMAND_GPIO_PARAMS_MODE_TOGGLE = 7, ///< Pin will change to the opposite state each time the trigger activates. +}; +typedef enum mip_3dm_event_action_command_gpio_params_mode mip_3dm_event_action_command_gpio_params_mode; + +static inline void insert_mip_3dm_event_action_command_gpio_params_mode(microstrain_serializer* serializer, const mip_3dm_event_action_command_gpio_params_mode self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_3dm_event_action_command_gpio_params_mode(microstrain_serializer* serializer, mip_3dm_event_action_command_gpio_params_mode* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} + struct mip_3dm_event_action_command_gpio_params { uint8_t pin; ///< GPIO pin number. mip_3dm_event_action_command_gpio_params_mode mode; ///< Behavior of the pin. - }; typedef struct mip_3dm_event_action_command_gpio_params mip_3dm_event_action_command_gpio_params; + +void insert_mip_3dm_event_action_command_gpio_params(microstrain_serializer* serializer, const mip_3dm_event_action_command_gpio_params* self); +void extract_mip_3dm_event_action_command_gpio_params(microstrain_serializer* serializer, mip_3dm_event_action_command_gpio_params* self); + struct mip_3dm_event_action_command_message_params { uint8_t desc_set; ///< MIP data descriptor set. uint16_t decimation; ///< Decimation from the base rate. If 0, a packet is emitted each time the trigger activates. Otherwise, packets will be streamed while the trigger is active. The internal decimation counter is reset if the trigger deactivates. uint8_t num_fields; ///< Number of mip fields in the packet. Limited to 12. uint8_t descriptors[20]; ///< List of field descriptors. - }; typedef struct mip_3dm_event_action_command_message_params mip_3dm_event_action_command_message_params; -typedef uint8_t mip_3dm_event_action_command_type; -static const mip_3dm_event_action_command_type MIP_3DM_EVENT_ACTION_COMMAND_TYPE_NONE = 0; ///< No action. Parameters should be empty. -static const mip_3dm_event_action_command_type MIP_3DM_EVENT_ACTION_COMMAND_TYPE_GPIO = 1; ///< Control the state of a GPIO pin. See GpioParameters. -static const mip_3dm_event_action_command_type MIP_3DM_EVENT_ACTION_COMMAND_TYPE_MESSAGE = 2; ///< Output a data packet. See MessageParameters. + +void insert_mip_3dm_event_action_command_message_params(microstrain_serializer* serializer, const mip_3dm_event_action_command_message_params* self); +void extract_mip_3dm_event_action_command_message_params(microstrain_serializer* serializer, mip_3dm_event_action_command_message_params* self); + +enum mip_3dm_event_action_command_type +{ + MIP_3DM_EVENT_ACTION_COMMAND_TYPE_NONE = 0, ///< No action. Parameters should be empty. + MIP_3DM_EVENT_ACTION_COMMAND_TYPE_GPIO = 1, ///< Control the state of a GPIO pin. See GpioParameters. + MIP_3DM_EVENT_ACTION_COMMAND_TYPE_MESSAGE = 2, ///< Output a data packet. See MessageParameters. +}; +typedef enum mip_3dm_event_action_command_type mip_3dm_event_action_command_type; + +static inline void insert_mip_3dm_event_action_command_type(microstrain_serializer* serializer, const mip_3dm_event_action_command_type self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_3dm_event_action_command_type(microstrain_serializer* serializer, mip_3dm_event_action_command_type* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} union mip_3dm_event_action_command_parameters { @@ -1657,23 +1905,11 @@ struct mip_3dm_event_action_command uint8_t trigger; ///< Trigger ID number. mip_3dm_event_action_command_type type; ///< Type of action to configure. mip_3dm_event_action_command_parameters parameters; - }; typedef struct mip_3dm_event_action_command mip_3dm_event_action_command; -void insert_mip_3dm_event_action_command(struct mip_serializer* serializer, const mip_3dm_event_action_command* self); -void extract_mip_3dm_event_action_command(struct mip_serializer* serializer, mip_3dm_event_action_command* self); - -void insert_mip_3dm_event_action_command_gpio_params(struct mip_serializer* serializer, const mip_3dm_event_action_command_gpio_params* self); -void extract_mip_3dm_event_action_command_gpio_params(struct mip_serializer* serializer, mip_3dm_event_action_command_gpio_params* self); - -void insert_mip_3dm_event_action_command_gpio_params_mode(struct mip_serializer* serializer, const mip_3dm_event_action_command_gpio_params_mode self); -void extract_mip_3dm_event_action_command_gpio_params_mode(struct mip_serializer* serializer, mip_3dm_event_action_command_gpio_params_mode* self); -void insert_mip_3dm_event_action_command_message_params(struct mip_serializer* serializer, const mip_3dm_event_action_command_message_params* self); -void extract_mip_3dm_event_action_command_message_params(struct mip_serializer* serializer, mip_3dm_event_action_command_message_params* self); - -void insert_mip_3dm_event_action_command_type(struct mip_serializer* serializer, const mip_3dm_event_action_command_type self); -void extract_mip_3dm_event_action_command_type(struct mip_serializer* serializer, mip_3dm_event_action_command_type* self); +void insert_mip_3dm_event_action_command(microstrain_serializer* serializer, const mip_3dm_event_action_command* self); +void extract_mip_3dm_event_action_command(microstrain_serializer* serializer, mip_3dm_event_action_command* self); struct mip_3dm_event_action_response { @@ -1681,22 +1917,22 @@ struct mip_3dm_event_action_response uint8_t trigger; ///< Trigger ID number. mip_3dm_event_action_command_type type; ///< Type of action to configure. mip_3dm_event_action_command_parameters parameters; - }; typedef struct mip_3dm_event_action_response mip_3dm_event_action_response; -void insert_mip_3dm_event_action_response(struct mip_serializer* serializer, const mip_3dm_event_action_response* self); -void extract_mip_3dm_event_action_response(struct mip_serializer* serializer, mip_3dm_event_action_response* self); -mip_cmd_result mip_3dm_write_event_action(struct mip_interface* device, uint8_t instance, uint8_t trigger, mip_3dm_event_action_command_type type, const mip_3dm_event_action_command_parameters* parameters); -mip_cmd_result mip_3dm_read_event_action(struct mip_interface* device, uint8_t instance, uint8_t* trigger_out, mip_3dm_event_action_command_type* type_out, mip_3dm_event_action_command_parameters* parameters_out); -mip_cmd_result mip_3dm_save_event_action(struct mip_interface* device, uint8_t instance); -mip_cmd_result mip_3dm_load_event_action(struct mip_interface* device, uint8_t instance); -mip_cmd_result mip_3dm_default_event_action(struct mip_interface* device, uint8_t instance); +void insert_mip_3dm_event_action_response(microstrain_serializer* serializer, const mip_3dm_event_action_response* self); +void extract_mip_3dm_event_action_response(microstrain_serializer* serializer, mip_3dm_event_action_response* self); + +mip_cmd_result mip_3dm_write_event_action(mip_interface* device, uint8_t instance, uint8_t trigger, mip_3dm_event_action_command_type type, const mip_3dm_event_action_command_parameters* parameters); +mip_cmd_result mip_3dm_read_event_action(mip_interface* device, uint8_t instance, uint8_t* trigger_out, mip_3dm_event_action_command_type* type_out, mip_3dm_event_action_command_parameters* parameters_out); +mip_cmd_result mip_3dm_save_event_action(mip_interface* device, uint8_t instance); +mip_cmd_result mip_3dm_load_event_action(mip_interface* device, uint8_t instance); +mip_cmd_result mip_3dm_default_event_action(mip_interface* device, uint8_t instance); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_accel_bias (0x0C,0x37) Accel Bias [C] +///@defgroup 3dm_accel_bias_c (0x0C,0x37) Accel Bias /// Configures the user specified accelerometer bias /// /// The user specified bias is subtracted from the calibrated accelerometer output. Value is input in the sensor frame. @@ -1707,31 +1943,31 @@ struct mip_3dm_accel_bias_command { mip_function_selector function; mip_vector3f bias; ///< accelerometer bias in the sensor frame (x,y,z) [g] - }; typedef struct mip_3dm_accel_bias_command mip_3dm_accel_bias_command; -void insert_mip_3dm_accel_bias_command(struct mip_serializer* serializer, const mip_3dm_accel_bias_command* self); -void extract_mip_3dm_accel_bias_command(struct mip_serializer* serializer, mip_3dm_accel_bias_command* self); + +void insert_mip_3dm_accel_bias_command(microstrain_serializer* serializer, const mip_3dm_accel_bias_command* self); +void extract_mip_3dm_accel_bias_command(microstrain_serializer* serializer, mip_3dm_accel_bias_command* self); struct mip_3dm_accel_bias_response { mip_vector3f bias; ///< accelerometer bias in the sensor frame (x,y,z) [g] - }; typedef struct mip_3dm_accel_bias_response mip_3dm_accel_bias_response; -void insert_mip_3dm_accel_bias_response(struct mip_serializer* serializer, const mip_3dm_accel_bias_response* self); -void extract_mip_3dm_accel_bias_response(struct mip_serializer* serializer, mip_3dm_accel_bias_response* self); -mip_cmd_result mip_3dm_write_accel_bias(struct mip_interface* device, const float* bias); -mip_cmd_result mip_3dm_read_accel_bias(struct mip_interface* device, float* bias_out); -mip_cmd_result mip_3dm_save_accel_bias(struct mip_interface* device); -mip_cmd_result mip_3dm_load_accel_bias(struct mip_interface* device); -mip_cmd_result mip_3dm_default_accel_bias(struct mip_interface* device); +void insert_mip_3dm_accel_bias_response(microstrain_serializer* serializer, const mip_3dm_accel_bias_response* self); +void extract_mip_3dm_accel_bias_response(microstrain_serializer* serializer, mip_3dm_accel_bias_response* self); + +mip_cmd_result mip_3dm_write_accel_bias(mip_interface* device, const float* bias); +mip_cmd_result mip_3dm_read_accel_bias(mip_interface* device, float* bias_out); +mip_cmd_result mip_3dm_save_accel_bias(mip_interface* device); +mip_cmd_result mip_3dm_load_accel_bias(mip_interface* device); +mip_cmd_result mip_3dm_default_accel_bias(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_gyro_bias (0x0C,0x38) Gyro Bias [C] +///@defgroup 3dm_gyro_bias_c (0x0C,0x38) Gyro Bias /// Configures the user specified gyroscope bias /// /// The user specified bias is subtracted from the calibrated angular rate output. Value is input in the sensor frame. @@ -1742,31 +1978,31 @@ struct mip_3dm_gyro_bias_command { mip_function_selector function; mip_vector3f bias; ///< gyro bias in the sensor frame (x,y,z) [radians/second] - }; typedef struct mip_3dm_gyro_bias_command mip_3dm_gyro_bias_command; -void insert_mip_3dm_gyro_bias_command(struct mip_serializer* serializer, const mip_3dm_gyro_bias_command* self); -void extract_mip_3dm_gyro_bias_command(struct mip_serializer* serializer, mip_3dm_gyro_bias_command* self); + +void insert_mip_3dm_gyro_bias_command(microstrain_serializer* serializer, const mip_3dm_gyro_bias_command* self); +void extract_mip_3dm_gyro_bias_command(microstrain_serializer* serializer, mip_3dm_gyro_bias_command* self); struct mip_3dm_gyro_bias_response { mip_vector3f bias; ///< gyro bias in the sensor frame (x,y,z) [radians/second] - }; typedef struct mip_3dm_gyro_bias_response mip_3dm_gyro_bias_response; -void insert_mip_3dm_gyro_bias_response(struct mip_serializer* serializer, const mip_3dm_gyro_bias_response* self); -void extract_mip_3dm_gyro_bias_response(struct mip_serializer* serializer, mip_3dm_gyro_bias_response* self); -mip_cmd_result mip_3dm_write_gyro_bias(struct mip_interface* device, const float* bias); -mip_cmd_result mip_3dm_read_gyro_bias(struct mip_interface* device, float* bias_out); -mip_cmd_result mip_3dm_save_gyro_bias(struct mip_interface* device); -mip_cmd_result mip_3dm_load_gyro_bias(struct mip_interface* device); -mip_cmd_result mip_3dm_default_gyro_bias(struct mip_interface* device); +void insert_mip_3dm_gyro_bias_response(microstrain_serializer* serializer, const mip_3dm_gyro_bias_response* self); +void extract_mip_3dm_gyro_bias_response(microstrain_serializer* serializer, mip_3dm_gyro_bias_response* self); + +mip_cmd_result mip_3dm_write_gyro_bias(mip_interface* device, const float* bias); +mip_cmd_result mip_3dm_read_gyro_bias(mip_interface* device, float* bias_out); +mip_cmd_result mip_3dm_save_gyro_bias(mip_interface* device); +mip_cmd_result mip_3dm_load_gyro_bias(mip_interface* device); +mip_cmd_result mip_3dm_default_gyro_bias(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_capture_gyro_bias (0x0C,0x39) Capture Gyro Bias [C] +///@defgroup 3dm_capture_gyro_bias_c (0x0C,0x39) Capture Gyro Bias /// Samples gyro for a specified time range and writes the averaged result to the Gyro Bias vector in RAM /// /// The device will average the gyro output for the duration of "averaging_time_ms." To store the resulting vector @@ -1779,32 +2015,32 @@ mip_cmd_result mip_3dm_default_gyro_bias(struct mip_interface* device); struct mip_3dm_capture_gyro_bias_command { uint16_t averaging_time_ms; ///< Averaging time [milliseconds] - }; typedef struct mip_3dm_capture_gyro_bias_command mip_3dm_capture_gyro_bias_command; -void insert_mip_3dm_capture_gyro_bias_command(struct mip_serializer* serializer, const mip_3dm_capture_gyro_bias_command* self); -void extract_mip_3dm_capture_gyro_bias_command(struct mip_serializer* serializer, mip_3dm_capture_gyro_bias_command* self); + +void insert_mip_3dm_capture_gyro_bias_command(microstrain_serializer* serializer, const mip_3dm_capture_gyro_bias_command* self); +void extract_mip_3dm_capture_gyro_bias_command(microstrain_serializer* serializer, mip_3dm_capture_gyro_bias_command* self); struct mip_3dm_capture_gyro_bias_response { mip_vector3f bias; ///< gyro bias in the sensor frame (x,y,z) [radians/second] - }; typedef struct mip_3dm_capture_gyro_bias_response mip_3dm_capture_gyro_bias_response; -void insert_mip_3dm_capture_gyro_bias_response(struct mip_serializer* serializer, const mip_3dm_capture_gyro_bias_response* self); -void extract_mip_3dm_capture_gyro_bias_response(struct mip_serializer* serializer, mip_3dm_capture_gyro_bias_response* self); -mip_cmd_result mip_3dm_capture_gyro_bias(struct mip_interface* device, uint16_t averaging_time_ms, float* bias_out); +void insert_mip_3dm_capture_gyro_bias_response(microstrain_serializer* serializer, const mip_3dm_capture_gyro_bias_response* self); +void extract_mip_3dm_capture_gyro_bias_response(microstrain_serializer* serializer, mip_3dm_capture_gyro_bias_response* self); + +mip_cmd_result mip_3dm_capture_gyro_bias(mip_interface* device, uint16_t averaging_time_ms, float* bias_out); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_mag_hard_iron_offset (0x0C,0x3A) Mag Hard Iron Offset [C] +///@defgroup 3dm_mag_hard_iron_offset_c (0x0C,0x3A) Mag Hard Iron Offset /// Configure the user specified magnetometer hard iron offset vector /// /// The values for this offset are determined empirically by external software algorithms /// based on calibration data taken after the device is installed in its application. These values -/// can be obtained and set by using the LORD "MIP Iron Calibration" application. +/// can be obtained and set by using Microstrain software tools. /// Alternatively, on some systems, the auto-mag calibration feature may be used to capture these values in-run. /// The offset is applied to the scaled magnetometer vector prior to output. /// @@ -1814,41 +2050,41 @@ struct mip_3dm_mag_hard_iron_offset_command { mip_function_selector function; mip_vector3f offset; ///< hard iron offset in the sensor frame (x,y,z) [Gauss] - }; typedef struct mip_3dm_mag_hard_iron_offset_command mip_3dm_mag_hard_iron_offset_command; -void insert_mip_3dm_mag_hard_iron_offset_command(struct mip_serializer* serializer, const mip_3dm_mag_hard_iron_offset_command* self); -void extract_mip_3dm_mag_hard_iron_offset_command(struct mip_serializer* serializer, mip_3dm_mag_hard_iron_offset_command* self); + +void insert_mip_3dm_mag_hard_iron_offset_command(microstrain_serializer* serializer, const mip_3dm_mag_hard_iron_offset_command* self); +void extract_mip_3dm_mag_hard_iron_offset_command(microstrain_serializer* serializer, mip_3dm_mag_hard_iron_offset_command* self); struct mip_3dm_mag_hard_iron_offset_response { mip_vector3f offset; ///< hard iron offset in the sensor frame (x,y,z) [Gauss] - }; typedef struct mip_3dm_mag_hard_iron_offset_response mip_3dm_mag_hard_iron_offset_response; -void insert_mip_3dm_mag_hard_iron_offset_response(struct mip_serializer* serializer, const mip_3dm_mag_hard_iron_offset_response* self); -void extract_mip_3dm_mag_hard_iron_offset_response(struct mip_serializer* serializer, mip_3dm_mag_hard_iron_offset_response* self); -mip_cmd_result mip_3dm_write_mag_hard_iron_offset(struct mip_interface* device, const float* offset); -mip_cmd_result mip_3dm_read_mag_hard_iron_offset(struct mip_interface* device, float* offset_out); -mip_cmd_result mip_3dm_save_mag_hard_iron_offset(struct mip_interface* device); -mip_cmd_result mip_3dm_load_mag_hard_iron_offset(struct mip_interface* device); -mip_cmd_result mip_3dm_default_mag_hard_iron_offset(struct mip_interface* device); +void insert_mip_3dm_mag_hard_iron_offset_response(microstrain_serializer* serializer, const mip_3dm_mag_hard_iron_offset_response* self); +void extract_mip_3dm_mag_hard_iron_offset_response(microstrain_serializer* serializer, mip_3dm_mag_hard_iron_offset_response* self); + +mip_cmd_result mip_3dm_write_mag_hard_iron_offset(mip_interface* device, const float* offset); +mip_cmd_result mip_3dm_read_mag_hard_iron_offset(mip_interface* device, float* offset_out); +mip_cmd_result mip_3dm_save_mag_hard_iron_offset(mip_interface* device); +mip_cmd_result mip_3dm_load_mag_hard_iron_offset(mip_interface* device); +mip_cmd_result mip_3dm_default_mag_hard_iron_offset(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_mag_soft_iron_matrix (0x0C,0x3B) Mag Soft Iron Matrix [C] +///@defgroup 3dm_mag_soft_iron_matrix_c (0x0C,0x3B) Mag Soft Iron Matrix /// Configure the user specified magnetometer soft iron offset matrix /// /// The values for this matrix are determined empirically by external software algorithms /// based on calibration data taken after the device is installed in its application. These values -/// can be obtained and set by using the LORD "MIP Iron Calibration" application. +/// can be obtained and set by using Microstrain software tools. /// Alternatively, on some systems, the auto-mag calibration feature may be used to capture these values in-run. /// The matrix is applied to the scaled magnetometer vector prior to output. /// /// The matrix is in row major order: -/// EQSTART M = \begin{bmatrix} 0 & 1 & 2 \\ 3 & 4 & 5 \\ 6 & 7 & 8 \end{bmatrix} EQEND +/// EQSTART M = \\begin{bmatrix} 0 & 1 & 2 \\\\ 3 & 4 & 5 \\\\ 6 & 7 & 8 \\end{bmatrix} EQEND /// /// ///@{ @@ -1857,31 +2093,31 @@ struct mip_3dm_mag_soft_iron_matrix_command { mip_function_selector function; mip_matrix3f offset; ///< soft iron matrix [dimensionless] - }; typedef struct mip_3dm_mag_soft_iron_matrix_command mip_3dm_mag_soft_iron_matrix_command; -void insert_mip_3dm_mag_soft_iron_matrix_command(struct mip_serializer* serializer, const mip_3dm_mag_soft_iron_matrix_command* self); -void extract_mip_3dm_mag_soft_iron_matrix_command(struct mip_serializer* serializer, mip_3dm_mag_soft_iron_matrix_command* self); + +void insert_mip_3dm_mag_soft_iron_matrix_command(microstrain_serializer* serializer, const mip_3dm_mag_soft_iron_matrix_command* self); +void extract_mip_3dm_mag_soft_iron_matrix_command(microstrain_serializer* serializer, mip_3dm_mag_soft_iron_matrix_command* self); struct mip_3dm_mag_soft_iron_matrix_response { mip_matrix3f offset; ///< soft iron matrix [dimensionless] - }; typedef struct mip_3dm_mag_soft_iron_matrix_response mip_3dm_mag_soft_iron_matrix_response; -void insert_mip_3dm_mag_soft_iron_matrix_response(struct mip_serializer* serializer, const mip_3dm_mag_soft_iron_matrix_response* self); -void extract_mip_3dm_mag_soft_iron_matrix_response(struct mip_serializer* serializer, mip_3dm_mag_soft_iron_matrix_response* self); -mip_cmd_result mip_3dm_write_mag_soft_iron_matrix(struct mip_interface* device, const float* offset); -mip_cmd_result mip_3dm_read_mag_soft_iron_matrix(struct mip_interface* device, float* offset_out); -mip_cmd_result mip_3dm_save_mag_soft_iron_matrix(struct mip_interface* device); -mip_cmd_result mip_3dm_load_mag_soft_iron_matrix(struct mip_interface* device); -mip_cmd_result mip_3dm_default_mag_soft_iron_matrix(struct mip_interface* device); +void insert_mip_3dm_mag_soft_iron_matrix_response(microstrain_serializer* serializer, const mip_3dm_mag_soft_iron_matrix_response* self); +void extract_mip_3dm_mag_soft_iron_matrix_response(microstrain_serializer* serializer, mip_3dm_mag_soft_iron_matrix_response* self); + +mip_cmd_result mip_3dm_write_mag_soft_iron_matrix(mip_interface* device, const float* offset); +mip_cmd_result mip_3dm_read_mag_soft_iron_matrix(mip_interface* device, float* offset_out); +mip_cmd_result mip_3dm_save_mag_soft_iron_matrix(mip_interface* device); +mip_cmd_result mip_3dm_load_mag_soft_iron_matrix(mip_interface* device); +mip_cmd_result mip_3dm_default_mag_soft_iron_matrix(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_coning_sculling_enable (0x0C,0x3E) Coning Sculling Enable [C] +///@defgroup 3dm_coning_sculling_enable_c (0x0C,0x3E) Coning Sculling Enable /// Controls the Coning and Sculling Compenstation setting. /// ///@{ @@ -1890,31 +2126,31 @@ struct mip_3dm_coning_sculling_enable_command { mip_function_selector function; bool enable; ///< If true, coning and sculling compensation is enabled. - }; typedef struct mip_3dm_coning_sculling_enable_command mip_3dm_coning_sculling_enable_command; -void insert_mip_3dm_coning_sculling_enable_command(struct mip_serializer* serializer, const mip_3dm_coning_sculling_enable_command* self); -void extract_mip_3dm_coning_sculling_enable_command(struct mip_serializer* serializer, mip_3dm_coning_sculling_enable_command* self); + +void insert_mip_3dm_coning_sculling_enable_command(microstrain_serializer* serializer, const mip_3dm_coning_sculling_enable_command* self); +void extract_mip_3dm_coning_sculling_enable_command(microstrain_serializer* serializer, mip_3dm_coning_sculling_enable_command* self); struct mip_3dm_coning_sculling_enable_response { bool enable; ///< If true, coning and sculling compensation is enabled. - }; typedef struct mip_3dm_coning_sculling_enable_response mip_3dm_coning_sculling_enable_response; -void insert_mip_3dm_coning_sculling_enable_response(struct mip_serializer* serializer, const mip_3dm_coning_sculling_enable_response* self); -void extract_mip_3dm_coning_sculling_enable_response(struct mip_serializer* serializer, mip_3dm_coning_sculling_enable_response* self); -mip_cmd_result mip_3dm_write_coning_sculling_enable(struct mip_interface* device, bool enable); -mip_cmd_result mip_3dm_read_coning_sculling_enable(struct mip_interface* device, bool* enable_out); -mip_cmd_result mip_3dm_save_coning_sculling_enable(struct mip_interface* device); -mip_cmd_result mip_3dm_load_coning_sculling_enable(struct mip_interface* device); -mip_cmd_result mip_3dm_default_coning_sculling_enable(struct mip_interface* device); +void insert_mip_3dm_coning_sculling_enable_response(microstrain_serializer* serializer, const mip_3dm_coning_sculling_enable_response* self); +void extract_mip_3dm_coning_sculling_enable_response(microstrain_serializer* serializer, mip_3dm_coning_sculling_enable_response* self); + +mip_cmd_result mip_3dm_write_coning_sculling_enable(mip_interface* device, bool enable); +mip_cmd_result mip_3dm_read_coning_sculling_enable(mip_interface* device, bool* enable_out); +mip_cmd_result mip_3dm_save_coning_sculling_enable(mip_interface* device); +mip_cmd_result mip_3dm_load_coning_sculling_enable(mip_interface* device); +mip_cmd_result mip_3dm_default_coning_sculling_enable(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_sensor_2_vehicle_transform_euler (0x0C,0x31) Sensor 2 Vehicle Transform Euler [C] +///@defgroup 3dm_sensor_2_vehicle_transform_euler_c (0x0C,0x31) Sensor 2 Vehicle Transform Euler /// Sets the sensor-to-vehicle frame transformation using Yaw, Pitch, Roll Euler angles. /// These are the Yaw, Pitch, and Roll mounting angles of the sensor with respect to vehicle frame of reference, /// and describe the transformation of vectors from the sensor body frame to the vehicle frame.
@@ -1949,33 +2185,33 @@ struct mip_3dm_sensor_2_vehicle_transform_euler_command float roll; ///< [radians] float pitch; ///< [radians] float yaw; ///< [radians] - }; typedef struct mip_3dm_sensor_2_vehicle_transform_euler_command mip_3dm_sensor_2_vehicle_transform_euler_command; -void insert_mip_3dm_sensor_2_vehicle_transform_euler_command(struct mip_serializer* serializer, const mip_3dm_sensor_2_vehicle_transform_euler_command* self); -void extract_mip_3dm_sensor_2_vehicle_transform_euler_command(struct mip_serializer* serializer, mip_3dm_sensor_2_vehicle_transform_euler_command* self); + +void insert_mip_3dm_sensor_2_vehicle_transform_euler_command(microstrain_serializer* serializer, const mip_3dm_sensor_2_vehicle_transform_euler_command* self); +void extract_mip_3dm_sensor_2_vehicle_transform_euler_command(microstrain_serializer* serializer, mip_3dm_sensor_2_vehicle_transform_euler_command* self); struct mip_3dm_sensor_2_vehicle_transform_euler_response { float roll; ///< [radians] float pitch; ///< [radians] float yaw; ///< [radians] - }; typedef struct mip_3dm_sensor_2_vehicle_transform_euler_response mip_3dm_sensor_2_vehicle_transform_euler_response; -void insert_mip_3dm_sensor_2_vehicle_transform_euler_response(struct mip_serializer* serializer, const mip_3dm_sensor_2_vehicle_transform_euler_response* self); -void extract_mip_3dm_sensor_2_vehicle_transform_euler_response(struct mip_serializer* serializer, mip_3dm_sensor_2_vehicle_transform_euler_response* self); -mip_cmd_result mip_3dm_write_sensor_2_vehicle_transform_euler(struct mip_interface* device, float roll, float pitch, float yaw); -mip_cmd_result mip_3dm_read_sensor_2_vehicle_transform_euler(struct mip_interface* device, float* roll_out, float* pitch_out, float* yaw_out); -mip_cmd_result mip_3dm_save_sensor_2_vehicle_transform_euler(struct mip_interface* device); -mip_cmd_result mip_3dm_load_sensor_2_vehicle_transform_euler(struct mip_interface* device); -mip_cmd_result mip_3dm_default_sensor_2_vehicle_transform_euler(struct mip_interface* device); +void insert_mip_3dm_sensor_2_vehicle_transform_euler_response(microstrain_serializer* serializer, const mip_3dm_sensor_2_vehicle_transform_euler_response* self); +void extract_mip_3dm_sensor_2_vehicle_transform_euler_response(microstrain_serializer* serializer, mip_3dm_sensor_2_vehicle_transform_euler_response* self); + +mip_cmd_result mip_3dm_write_sensor_2_vehicle_transform_euler(mip_interface* device, float roll, float pitch, float yaw); +mip_cmd_result mip_3dm_read_sensor_2_vehicle_transform_euler(mip_interface* device, float* roll_out, float* pitch_out, float* yaw_out); +mip_cmd_result mip_3dm_save_sensor_2_vehicle_transform_euler(mip_interface* device); +mip_cmd_result mip_3dm_load_sensor_2_vehicle_transform_euler(mip_interface* device); +mip_cmd_result mip_3dm_default_sensor_2_vehicle_transform_euler(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_sensor_2_vehicle_transform_quaternion (0x0C,0x32) Sensor 2 Vehicle Transform Quaternion [C] +///@defgroup 3dm_sensor_2_vehicle_transform_quaternion_c (0x0C,0x32) Sensor 2 Vehicle Transform Quaternion /// Set the sensor to vehicle frame transformation using unit length quaternion. /// /// Note: This is the transformation, the inverse of the rotation. @@ -2016,31 +2252,31 @@ struct mip_3dm_sensor_2_vehicle_transform_quaternion_command { mip_function_selector function; mip_quatf q; ///< Unit length quaternion representing transform [w, i, j, k] - }; typedef struct mip_3dm_sensor_2_vehicle_transform_quaternion_command mip_3dm_sensor_2_vehicle_transform_quaternion_command; -void insert_mip_3dm_sensor_2_vehicle_transform_quaternion_command(struct mip_serializer* serializer, const mip_3dm_sensor_2_vehicle_transform_quaternion_command* self); -void extract_mip_3dm_sensor_2_vehicle_transform_quaternion_command(struct mip_serializer* serializer, mip_3dm_sensor_2_vehicle_transform_quaternion_command* self); + +void insert_mip_3dm_sensor_2_vehicle_transform_quaternion_command(microstrain_serializer* serializer, const mip_3dm_sensor_2_vehicle_transform_quaternion_command* self); +void extract_mip_3dm_sensor_2_vehicle_transform_quaternion_command(microstrain_serializer* serializer, mip_3dm_sensor_2_vehicle_transform_quaternion_command* self); struct mip_3dm_sensor_2_vehicle_transform_quaternion_response { mip_quatf q; ///< Unit length quaternion representing transform [w, i, j, k] - }; typedef struct mip_3dm_sensor_2_vehicle_transform_quaternion_response mip_3dm_sensor_2_vehicle_transform_quaternion_response; -void insert_mip_3dm_sensor_2_vehicle_transform_quaternion_response(struct mip_serializer* serializer, const mip_3dm_sensor_2_vehicle_transform_quaternion_response* self); -void extract_mip_3dm_sensor_2_vehicle_transform_quaternion_response(struct mip_serializer* serializer, mip_3dm_sensor_2_vehicle_transform_quaternion_response* self); -mip_cmd_result mip_3dm_write_sensor_2_vehicle_transform_quaternion(struct mip_interface* device, const float* q); -mip_cmd_result mip_3dm_read_sensor_2_vehicle_transform_quaternion(struct mip_interface* device, float* q_out); -mip_cmd_result mip_3dm_save_sensor_2_vehicle_transform_quaternion(struct mip_interface* device); -mip_cmd_result mip_3dm_load_sensor_2_vehicle_transform_quaternion(struct mip_interface* device); -mip_cmd_result mip_3dm_default_sensor_2_vehicle_transform_quaternion(struct mip_interface* device); +void insert_mip_3dm_sensor_2_vehicle_transform_quaternion_response(microstrain_serializer* serializer, const mip_3dm_sensor_2_vehicle_transform_quaternion_response* self); +void extract_mip_3dm_sensor_2_vehicle_transform_quaternion_response(microstrain_serializer* serializer, mip_3dm_sensor_2_vehicle_transform_quaternion_response* self); + +mip_cmd_result mip_3dm_write_sensor_2_vehicle_transform_quaternion(mip_interface* device, const float* q); +mip_cmd_result mip_3dm_read_sensor_2_vehicle_transform_quaternion(mip_interface* device, float* q_out); +mip_cmd_result mip_3dm_save_sensor_2_vehicle_transform_quaternion(mip_interface* device); +mip_cmd_result mip_3dm_load_sensor_2_vehicle_transform_quaternion(mip_interface* device); +mip_cmd_result mip_3dm_default_sensor_2_vehicle_transform_quaternion(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_sensor_2_vehicle_transform_dcm (0x0C,0x33) Sensor 2 Vehicle Transform Dcm [C] +///@defgroup 3dm_sensor_2_vehicle_transform_dcm_c (0x0C,0x33) Sensor 2 Vehicle Transform Dcm /// Set the sensor to vehicle frame transformation using a using a 3 x 3 direction cosine matrix EQSTART M_{ned}^{veh} EQEND, stored in row-major order in a 9-element array. /// /// These angles define the transformation of vectors from the sensor body frame to the fixed vehicle frame, according to:
@@ -2051,7 +2287,7 @@ mip_cmd_result mip_3dm_default_sensor_2_vehicle_transform_quaternion(struct mip_ /// EQSTART v^{sen} EQEND is a 3-element vector expressed in the sensor body frame.
/// EQSTART v^{veh} EQEND is the same 3-element vector expressed in the vehicle frame.
///
-/// The matrix elements are stored is row-major order: EQSTART M_{sen}^{veh} = \begin{bmatrix} M_{11}, M_{12}, M_{13}, M_{21}, M_{22}, M_{23}, M_{31}, M_{32}, M_{33} \end{bmatrix} EQEND +/// The matrix elements are stored is row-major order: EQSTART M_{sen}^{veh} = \\begin{bmatrix} M_{11}, M_{12}, M_{13}, M_{21}, M_{22}, M_{23}, M_{31}, M_{32}, M_{33} \\end{bmatrix} EQEND /// The transformation may be stored in the device as a matrix or a quaternion. When EQSTART M_{sen}^{veh} EQEND is read back from the device, it may not /// be exactly equal to array used to set the transformation, but it is functionally equivalent.
///

@@ -2079,31 +2315,31 @@ struct mip_3dm_sensor_2_vehicle_transform_dcm_command { mip_function_selector function; mip_matrix3f dcm; ///< 3 x 3 direction cosine matrix, stored in row-major order - }; typedef struct mip_3dm_sensor_2_vehicle_transform_dcm_command mip_3dm_sensor_2_vehicle_transform_dcm_command; -void insert_mip_3dm_sensor_2_vehicle_transform_dcm_command(struct mip_serializer* serializer, const mip_3dm_sensor_2_vehicle_transform_dcm_command* self); -void extract_mip_3dm_sensor_2_vehicle_transform_dcm_command(struct mip_serializer* serializer, mip_3dm_sensor_2_vehicle_transform_dcm_command* self); + +void insert_mip_3dm_sensor_2_vehicle_transform_dcm_command(microstrain_serializer* serializer, const mip_3dm_sensor_2_vehicle_transform_dcm_command* self); +void extract_mip_3dm_sensor_2_vehicle_transform_dcm_command(microstrain_serializer* serializer, mip_3dm_sensor_2_vehicle_transform_dcm_command* self); struct mip_3dm_sensor_2_vehicle_transform_dcm_response { mip_matrix3f dcm; ///< 3 x 3 direction cosine matrix, stored in row-major order - }; typedef struct mip_3dm_sensor_2_vehicle_transform_dcm_response mip_3dm_sensor_2_vehicle_transform_dcm_response; -void insert_mip_3dm_sensor_2_vehicle_transform_dcm_response(struct mip_serializer* serializer, const mip_3dm_sensor_2_vehicle_transform_dcm_response* self); -void extract_mip_3dm_sensor_2_vehicle_transform_dcm_response(struct mip_serializer* serializer, mip_3dm_sensor_2_vehicle_transform_dcm_response* self); -mip_cmd_result mip_3dm_write_sensor_2_vehicle_transform_dcm(struct mip_interface* device, const float* dcm); -mip_cmd_result mip_3dm_read_sensor_2_vehicle_transform_dcm(struct mip_interface* device, float* dcm_out); -mip_cmd_result mip_3dm_save_sensor_2_vehicle_transform_dcm(struct mip_interface* device); -mip_cmd_result mip_3dm_load_sensor_2_vehicle_transform_dcm(struct mip_interface* device); -mip_cmd_result mip_3dm_default_sensor_2_vehicle_transform_dcm(struct mip_interface* device); +void insert_mip_3dm_sensor_2_vehicle_transform_dcm_response(microstrain_serializer* serializer, const mip_3dm_sensor_2_vehicle_transform_dcm_response* self); +void extract_mip_3dm_sensor_2_vehicle_transform_dcm_response(microstrain_serializer* serializer, mip_3dm_sensor_2_vehicle_transform_dcm_response* self); + +mip_cmd_result mip_3dm_write_sensor_2_vehicle_transform_dcm(mip_interface* device, const float* dcm); +mip_cmd_result mip_3dm_read_sensor_2_vehicle_transform_dcm(mip_interface* device, float* dcm_out); +mip_cmd_result mip_3dm_save_sensor_2_vehicle_transform_dcm(mip_interface* device); +mip_cmd_result mip_3dm_load_sensor_2_vehicle_transform_dcm(mip_interface* device); +mip_cmd_result mip_3dm_default_sensor_2_vehicle_transform_dcm(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_complementary_filter (0x0C,0x51) Complementary Filter [C] +///@defgroup 3dm_complementary_filter_c (0x0C,0x51) Complementary Filter /// Configure the settings for the complementary filter which produces the following (0x80) descriptor set values: attitude matrix (0x80,09), quaternion (0x80,0A), and Euler angle (0x80,0C) outputs. /// /// The filter can be configured to correct for pitch and roll using the accelerometer (with the assumption that linear acceleration is minimal), @@ -2119,11 +2355,11 @@ struct mip_3dm_complementary_filter_command bool heading_enable; ///< Enable Heading corrections (only available on devices with magnetometer) float pitch_roll_time_constant; ///< Time constant associated with the pitch/roll corrections [s] float heading_time_constant; ///< Time constant associated with the heading corrections [s] - }; typedef struct mip_3dm_complementary_filter_command mip_3dm_complementary_filter_command; -void insert_mip_3dm_complementary_filter_command(struct mip_serializer* serializer, const mip_3dm_complementary_filter_command* self); -void extract_mip_3dm_complementary_filter_command(struct mip_serializer* serializer, mip_3dm_complementary_filter_command* self); + +void insert_mip_3dm_complementary_filter_command(microstrain_serializer* serializer, const mip_3dm_complementary_filter_command* self); +void extract_mip_3dm_complementary_filter_command(microstrain_serializer* serializer, mip_3dm_complementary_filter_command* self); struct mip_3dm_complementary_filter_response { @@ -2131,22 +2367,22 @@ struct mip_3dm_complementary_filter_response bool heading_enable; ///< Enable Heading corrections (only available on devices with magnetometer) float pitch_roll_time_constant; ///< Time constant associated with the pitch/roll corrections [s] float heading_time_constant; ///< Time constant associated with the heading corrections [s] - }; typedef struct mip_3dm_complementary_filter_response mip_3dm_complementary_filter_response; -void insert_mip_3dm_complementary_filter_response(struct mip_serializer* serializer, const mip_3dm_complementary_filter_response* self); -void extract_mip_3dm_complementary_filter_response(struct mip_serializer* serializer, mip_3dm_complementary_filter_response* self); -mip_cmd_result mip_3dm_write_complementary_filter(struct mip_interface* device, bool pitch_roll_enable, bool heading_enable, float pitch_roll_time_constant, float heading_time_constant); -mip_cmd_result mip_3dm_read_complementary_filter(struct mip_interface* device, bool* pitch_roll_enable_out, bool* heading_enable_out, float* pitch_roll_time_constant_out, float* heading_time_constant_out); -mip_cmd_result mip_3dm_save_complementary_filter(struct mip_interface* device); -mip_cmd_result mip_3dm_load_complementary_filter(struct mip_interface* device); -mip_cmd_result mip_3dm_default_complementary_filter(struct mip_interface* device); +void insert_mip_3dm_complementary_filter_response(microstrain_serializer* serializer, const mip_3dm_complementary_filter_response* self); +void extract_mip_3dm_complementary_filter_response(microstrain_serializer* serializer, mip_3dm_complementary_filter_response* self); + +mip_cmd_result mip_3dm_write_complementary_filter(mip_interface* device, bool pitch_roll_enable, bool heading_enable, float pitch_roll_time_constant, float heading_time_constant); +mip_cmd_result mip_3dm_read_complementary_filter(mip_interface* device, bool* pitch_roll_enable_out, bool* heading_enable_out, float* pitch_roll_time_constant_out, float* heading_time_constant_out); +mip_cmd_result mip_3dm_save_complementary_filter(mip_interface* device); +mip_cmd_result mip_3dm_load_complementary_filter(mip_interface* device); +mip_cmd_result mip_3dm_default_complementary_filter(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_sensor_range (0x0C,0x52) Sensor Range [C] +///@defgroup 3dm_sensor_range_c (0x0C,0x52) Sensor Range /// Changes the IMU sensor gain. /// /// This allows you to optimize the range to get the best accuracy and performance @@ -2163,32 +2399,32 @@ struct mip_3dm_sensor_range_command mip_function_selector function; mip_sensor_range_type sensor; ///< Which type of sensor will get the new range value. uint8_t setting; ///< Use the 3DM Get Calibrated Sensor Ranges (0x0C,0x53) command to determine this value. - }; typedef struct mip_3dm_sensor_range_command mip_3dm_sensor_range_command; -void insert_mip_3dm_sensor_range_command(struct mip_serializer* serializer, const mip_3dm_sensor_range_command* self); -void extract_mip_3dm_sensor_range_command(struct mip_serializer* serializer, mip_3dm_sensor_range_command* self); + +void insert_mip_3dm_sensor_range_command(microstrain_serializer* serializer, const mip_3dm_sensor_range_command* self); +void extract_mip_3dm_sensor_range_command(microstrain_serializer* serializer, mip_3dm_sensor_range_command* self); struct mip_3dm_sensor_range_response { mip_sensor_range_type sensor; ///< Which type of sensor will get the new range value. uint8_t setting; ///< Use the 3DM Get Calibrated Sensor Ranges (0x0C,0x53) command to determine this value. - }; typedef struct mip_3dm_sensor_range_response mip_3dm_sensor_range_response; -void insert_mip_3dm_sensor_range_response(struct mip_serializer* serializer, const mip_3dm_sensor_range_response* self); -void extract_mip_3dm_sensor_range_response(struct mip_serializer* serializer, mip_3dm_sensor_range_response* self); -mip_cmd_result mip_3dm_write_sensor_range(struct mip_interface* device, mip_sensor_range_type sensor, uint8_t setting); -mip_cmd_result mip_3dm_read_sensor_range(struct mip_interface* device, mip_sensor_range_type sensor, uint8_t* setting_out); -mip_cmd_result mip_3dm_save_sensor_range(struct mip_interface* device, mip_sensor_range_type sensor); -mip_cmd_result mip_3dm_load_sensor_range(struct mip_interface* device, mip_sensor_range_type sensor); -mip_cmd_result mip_3dm_default_sensor_range(struct mip_interface* device, mip_sensor_range_type sensor); +void insert_mip_3dm_sensor_range_response(microstrain_serializer* serializer, const mip_3dm_sensor_range_response* self); +void extract_mip_3dm_sensor_range_response(microstrain_serializer* serializer, mip_3dm_sensor_range_response* self); + +mip_cmd_result mip_3dm_write_sensor_range(mip_interface* device, mip_sensor_range_type sensor, uint8_t setting); +mip_cmd_result mip_3dm_read_sensor_range(mip_interface* device, mip_sensor_range_type sensor, uint8_t* setting_out); +mip_cmd_result mip_3dm_save_sensor_range(mip_interface* device, mip_sensor_range_type sensor); +mip_cmd_result mip_3dm_load_sensor_range(mip_interface* device, mip_sensor_range_type sensor); +mip_cmd_result mip_3dm_default_sensor_range(mip_interface* device, mip_sensor_range_type sensor); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_calibrated_sensor_ranges (0x0C,0x53) Calibrated Sensor Ranges [C] +///@defgroup 3dm_calibrated_sensor_ranges_c (0x0C,0x53) Calibrated Sensor Ranges /// Returns the supported sensor ranges which may be used with the 3DM Sensor Range (0x0C,0x52) command. /// /// The response includes an array of (u8, float) pairs which map each allowed setting @@ -2200,38 +2436,39 @@ struct mip_3dm_calibrated_sensor_ranges_command_entry { uint8_t setting; ///< The value used in the 3DM Sensor Range command and response. float range; ///< The actual range value. Units depend on the sensor type. - }; typedef struct mip_3dm_calibrated_sensor_ranges_command_entry mip_3dm_calibrated_sensor_ranges_command_entry; + +void insert_mip_3dm_calibrated_sensor_ranges_command_entry(microstrain_serializer* serializer, const mip_3dm_calibrated_sensor_ranges_command_entry* self); +void extract_mip_3dm_calibrated_sensor_ranges_command_entry(microstrain_serializer* serializer, mip_3dm_calibrated_sensor_ranges_command_entry* self); + + struct mip_3dm_calibrated_sensor_ranges_command { mip_sensor_range_type sensor; ///< The sensor to query. Cannot be ALL. - }; typedef struct mip_3dm_calibrated_sensor_ranges_command mip_3dm_calibrated_sensor_ranges_command; -void insert_mip_3dm_calibrated_sensor_ranges_command(struct mip_serializer* serializer, const mip_3dm_calibrated_sensor_ranges_command* self); -void extract_mip_3dm_calibrated_sensor_ranges_command(struct mip_serializer* serializer, mip_3dm_calibrated_sensor_ranges_command* self); -void insert_mip_3dm_calibrated_sensor_ranges_command_entry(struct mip_serializer* serializer, const mip_3dm_calibrated_sensor_ranges_command_entry* self); -void extract_mip_3dm_calibrated_sensor_ranges_command_entry(struct mip_serializer* serializer, mip_3dm_calibrated_sensor_ranges_command_entry* self); +void insert_mip_3dm_calibrated_sensor_ranges_command(microstrain_serializer* serializer, const mip_3dm_calibrated_sensor_ranges_command* self); +void extract_mip_3dm_calibrated_sensor_ranges_command(microstrain_serializer* serializer, mip_3dm_calibrated_sensor_ranges_command* self); struct mip_3dm_calibrated_sensor_ranges_response { mip_sensor_range_type sensor; ///< The sensor type from the command. uint8_t num_ranges; ///< Number of supported ranges. mip_3dm_calibrated_sensor_ranges_command_entry ranges[50]; ///< List of possible range settings. - }; typedef struct mip_3dm_calibrated_sensor_ranges_response mip_3dm_calibrated_sensor_ranges_response; -void insert_mip_3dm_calibrated_sensor_ranges_response(struct mip_serializer* serializer, const mip_3dm_calibrated_sensor_ranges_response* self); -void extract_mip_3dm_calibrated_sensor_ranges_response(struct mip_serializer* serializer, mip_3dm_calibrated_sensor_ranges_response* self); -mip_cmd_result mip_3dm_calibrated_sensor_ranges(struct mip_interface* device, mip_sensor_range_type sensor, uint8_t* num_ranges_out, uint8_t num_ranges_out_max, mip_3dm_calibrated_sensor_ranges_command_entry* ranges_out); +void insert_mip_3dm_calibrated_sensor_ranges_response(microstrain_serializer* serializer, const mip_3dm_calibrated_sensor_ranges_response* self); +void extract_mip_3dm_calibrated_sensor_ranges_response(microstrain_serializer* serializer, mip_3dm_calibrated_sensor_ranges_response* self); + +mip_cmd_result mip_3dm_calibrated_sensor_ranges(mip_interface* device, mip_sensor_range_type sensor, uint8_t* num_ranges_out, uint8_t num_ranges_out_max, mip_3dm_calibrated_sensor_ranges_command_entry* ranges_out); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_3dm_lowpass_filter (0x0C,0x54) Lowpass Filter [C] +///@defgroup 3dm_lowpass_filter_c (0x0C,0x54) Lowpass Filter /// This command controls the low-pass anti-aliasing filter supported data quantities. /// /// See the device user manual for data quantities which support the anti-aliasing filter. @@ -2257,11 +2494,11 @@ struct mip_3dm_lowpass_filter_command bool enable; ///< The filter will be enabled if this is true. bool manual; ///< If false, the frequency parameter is ignored and the filter will track to half of the configured message format frequency. float frequency; ///< Cutoff frequency in Hz. This will return the actual frequency when read out in automatic mode. - }; typedef struct mip_3dm_lowpass_filter_command mip_3dm_lowpass_filter_command; -void insert_mip_3dm_lowpass_filter_command(struct mip_serializer* serializer, const mip_3dm_lowpass_filter_command* self); -void extract_mip_3dm_lowpass_filter_command(struct mip_serializer* serializer, mip_3dm_lowpass_filter_command* self); + +void insert_mip_3dm_lowpass_filter_command(microstrain_serializer* serializer, const mip_3dm_lowpass_filter_command* self); +void extract_mip_3dm_lowpass_filter_command(microstrain_serializer* serializer, mip_3dm_lowpass_filter_command* self); struct mip_3dm_lowpass_filter_response { @@ -2270,17 +2507,17 @@ struct mip_3dm_lowpass_filter_response bool enable; ///< The filter will be enabled if this is true. bool manual; ///< If false, the frequency parameter is ignored and the filter will track to half of the configured message format frequency. float frequency; ///< Cutoff frequency in Hz. This will return the actual frequency when read out in automatic mode. - }; typedef struct mip_3dm_lowpass_filter_response mip_3dm_lowpass_filter_response; -void insert_mip_3dm_lowpass_filter_response(struct mip_serializer* serializer, const mip_3dm_lowpass_filter_response* self); -void extract_mip_3dm_lowpass_filter_response(struct mip_serializer* serializer, mip_3dm_lowpass_filter_response* self); -mip_cmd_result mip_3dm_write_lowpass_filter(struct mip_interface* device, uint8_t desc_set, uint8_t field_desc, bool enable, bool manual, float frequency); -mip_cmd_result mip_3dm_read_lowpass_filter(struct mip_interface* device, uint8_t desc_set, uint8_t field_desc, bool* enable_out, bool* manual_out, float* frequency_out); -mip_cmd_result mip_3dm_save_lowpass_filter(struct mip_interface* device, uint8_t desc_set, uint8_t field_desc); -mip_cmd_result mip_3dm_load_lowpass_filter(struct mip_interface* device, uint8_t desc_set, uint8_t field_desc); -mip_cmd_result mip_3dm_default_lowpass_filter(struct mip_interface* device, uint8_t desc_set, uint8_t field_desc); +void insert_mip_3dm_lowpass_filter_response(microstrain_serializer* serializer, const mip_3dm_lowpass_filter_response* self); +void extract_mip_3dm_lowpass_filter_response(microstrain_serializer* serializer, mip_3dm_lowpass_filter_response* self); + +mip_cmd_result mip_3dm_write_lowpass_filter(mip_interface* device, uint8_t desc_set, uint8_t field_desc, bool enable, bool manual, float frequency); +mip_cmd_result mip_3dm_read_lowpass_filter(mip_interface* device, uint8_t desc_set, uint8_t field_desc, bool* enable_out, bool* manual_out, float* frequency_out); +mip_cmd_result mip_3dm_save_lowpass_filter(mip_interface* device, uint8_t desc_set, uint8_t field_desc); +mip_cmd_result mip_3dm_load_lowpass_filter(mip_interface* device, uint8_t desc_set, uint8_t field_desc); +mip_cmd_result mip_3dm_default_lowpass_filter(mip_interface* device, uint8_t desc_set, uint8_t field_desc); ///@} /// @@ -2290,8 +2527,8 @@ mip_cmd_result mip_3dm_default_lowpass_filter(struct mip_interface* device, uint /// //////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus +} // extern "C" } // namespace C } // namespace mip -} // extern "C" #endif // __cplusplus diff --git a/src/c/mip/definitions/commands_aiding.c b/src/c/mip/definitions/commands_aiding.c new file mode 100644 index 000000000..36a330757 --- /dev/null +++ b/src/c/mip/definitions/commands_aiding.c @@ -0,0 +1,845 @@ + +#include "commands_aiding.h" + +#include +#include + +#include + + +#ifdef __cplusplus +namespace mip { +namespace C { +extern "C" { + +#endif // __cplusplus + + +//////////////////////////////////////////////////////////////////////////////// +// Mip Fields +//////////////////////////////////////////////////////////////////////////////// + +void insert_mip_time(microstrain_serializer* serializer, const mip_time* self) +{ + insert_mip_time_timebase(serializer, self->timebase); + + microstrain_insert_u8(serializer, self->reserved); + + microstrain_insert_u64(serializer, self->nanoseconds); + +} +void extract_mip_time(microstrain_serializer* serializer, mip_time* self) +{ + extract_mip_time_timebase(serializer, &self->timebase); + + microstrain_extract_u8(serializer, &self->reserved); + + microstrain_extract_u64(serializer, &self->nanoseconds); + +} + +void insert_mip_aiding_frame_config_command(microstrain_serializer* serializer, const mip_aiding_frame_config_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + microstrain_insert_u8(serializer, self->frame_id); + + if( self->function == MIP_FUNCTION_WRITE || self->function == MIP_FUNCTION_READ ) + { + insert_mip_aiding_frame_config_command_format(serializer, self->format); + + } + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_bool(serializer, self->tracking_enabled); + + insert_mip_vector3f(serializer, self->translation); + + if( self->format == MIP_AIDING_FRAME_CONFIG_COMMAND_FORMAT_EULER ) + { + insert_mip_vector3f(serializer, self->rotation.euler); + + } + if( self->format == MIP_AIDING_FRAME_CONFIG_COMMAND_FORMAT_QUATERNION ) + { + insert_mip_quatf(serializer, self->rotation.quaternion); + + } + } +} +void extract_mip_aiding_frame_config_command(microstrain_serializer* serializer, mip_aiding_frame_config_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + microstrain_extract_u8(serializer, &self->frame_id); + + if( self->function == MIP_FUNCTION_WRITE || self->function == MIP_FUNCTION_READ ) + { + extract_mip_aiding_frame_config_command_format(serializer, &self->format); + + } + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_extract_bool(serializer, &self->tracking_enabled); + + extract_mip_vector3f(serializer, self->translation); + + if( self->format == MIP_AIDING_FRAME_CONFIG_COMMAND_FORMAT_EULER ) + { + extract_mip_vector3f(serializer, self->rotation.euler); + + } + if( self->format == MIP_AIDING_FRAME_CONFIG_COMMAND_FORMAT_QUATERNION ) + { + extract_mip_quatf(serializer, self->rotation.quaternion); + + } + } +} + +void insert_mip_aiding_frame_config_response(microstrain_serializer* serializer, const mip_aiding_frame_config_response* self) +{ + microstrain_insert_u8(serializer, self->frame_id); + + insert_mip_aiding_frame_config_command_format(serializer, self->format); + + microstrain_insert_bool(serializer, self->tracking_enabled); + + insert_mip_vector3f(serializer, self->translation); + + if( self->format == MIP_AIDING_FRAME_CONFIG_COMMAND_FORMAT_EULER ) + { + insert_mip_vector3f(serializer, self->rotation.euler); + + } + if( self->format == MIP_AIDING_FRAME_CONFIG_COMMAND_FORMAT_QUATERNION ) + { + insert_mip_quatf(serializer, self->rotation.quaternion); + + } +} +void extract_mip_aiding_frame_config_response(microstrain_serializer* serializer, mip_aiding_frame_config_response* self) +{ + microstrain_extract_u8(serializer, &self->frame_id); + + extract_mip_aiding_frame_config_command_format(serializer, &self->format); + + microstrain_extract_bool(serializer, &self->tracking_enabled); + + extract_mip_vector3f(serializer, self->translation); + + if( self->format == MIP_AIDING_FRAME_CONFIG_COMMAND_FORMAT_EULER ) + { + extract_mip_vector3f(serializer, self->rotation.euler); + + } + if( self->format == MIP_AIDING_FRAME_CONFIG_COMMAND_FORMAT_QUATERNION ) + { + extract_mip_quatf(serializer, self->rotation.quaternion); + + } +} + +mip_cmd_result mip_aiding_write_frame_config(mip_interface* device, uint8_t frame_id, mip_aiding_frame_config_command_format format, bool tracking_enabled, const float* translation, const mip_aiding_frame_config_command_rotation* rotation) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_u8(&serializer, frame_id); + + insert_mip_aiding_frame_config_command_format(&serializer, format); + + microstrain_insert_bool(&serializer, tracking_enabled); + + assert(translation); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_float(&serializer, translation[i]); + + if( format == MIP_AIDING_FRAME_CONFIG_COMMAND_FORMAT_EULER ) + { + insert_mip_vector3f(&serializer, rotation->euler); + + } + if( format == MIP_AIDING_FRAME_CONFIG_COMMAND_FORMAT_QUATERNION ) + { + insert_mip_quatf(&serializer, rotation->quaternion); + + } + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_FRAME_CONFIG, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_aiding_read_frame_config(mip_interface* device, uint8_t frame_id, mip_aiding_frame_config_command_format format, bool* tracking_enabled_out, float* translation_out, mip_aiding_frame_config_command_rotation* rotation_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + microstrain_insert_u8(&serializer, frame_id); + + insert_mip_aiding_frame_config_command_format(&serializer, format); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_FRAME_CONFIG, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_AIDING_FRAME_CONFIG, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + microstrain_extract_u8(&deserializer, &frame_id); + + extract_mip_aiding_frame_config_command_format(&deserializer, &format); + + assert(tracking_enabled_out); + microstrain_extract_bool(&deserializer, tracking_enabled_out); + + assert(translation_out); + for(unsigned int i=0; i < 3; i++) + microstrain_extract_float(&deserializer, &translation_out[i]); + + if( format == MIP_AIDING_FRAME_CONFIG_COMMAND_FORMAT_EULER ) + { + extract_mip_vector3f(&deserializer, rotation_out->euler); + + } + if( format == MIP_AIDING_FRAME_CONFIG_COMMAND_FORMAT_QUATERNION ) + { + extract_mip_quatf(&deserializer, rotation_out->quaternion); + + } + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_aiding_save_frame_config(mip_interface* device, uint8_t frame_id) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + microstrain_insert_u8(&serializer, frame_id); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_FRAME_CONFIG, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_aiding_load_frame_config(mip_interface* device, uint8_t frame_id) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + microstrain_insert_u8(&serializer, frame_id); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_FRAME_CONFIG, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_aiding_default_frame_config(mip_interface* device, uint8_t frame_id) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + microstrain_insert_u8(&serializer, frame_id); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_FRAME_CONFIG, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_aiding_echo_control_command(microstrain_serializer* serializer, const mip_aiding_echo_control_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_aiding_echo_control_command_mode(serializer, self->mode); + + } +} +void extract_mip_aiding_echo_control_command(microstrain_serializer* serializer, mip_aiding_echo_control_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_aiding_echo_control_command_mode(serializer, &self->mode); + + } +} + +void insert_mip_aiding_echo_control_response(microstrain_serializer* serializer, const mip_aiding_echo_control_response* self) +{ + insert_mip_aiding_echo_control_command_mode(serializer, self->mode); + +} +void extract_mip_aiding_echo_control_response(microstrain_serializer* serializer, mip_aiding_echo_control_response* self) +{ + extract_mip_aiding_echo_control_command_mode(serializer, &self->mode); + +} + +mip_cmd_result mip_aiding_write_echo_control(mip_interface* device, mip_aiding_echo_control_command_mode mode) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + insert_mip_aiding_echo_control_command_mode(&serializer, mode); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_ECHO_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_aiding_read_echo_control(mip_interface* device, mip_aiding_echo_control_command_mode* mode_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_ECHO_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_AIDING_ECHO_CONTROL, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(mode_out); + extract_mip_aiding_echo_control_command_mode(&deserializer, mode_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_aiding_save_echo_control(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_ECHO_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_aiding_load_echo_control(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_ECHO_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_aiding_default_echo_control(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_ECHO_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_aiding_pos_ecef_command(microstrain_serializer* serializer, const mip_aiding_pos_ecef_command* self) +{ + insert_mip_time(serializer, &self->time); + + microstrain_insert_u8(serializer, self->frame_id); + + insert_mip_vector3d(serializer, self->position); + + insert_mip_vector3f(serializer, self->uncertainty); + + insert_mip_aiding_pos_ecef_command_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_aiding_pos_ecef_command(microstrain_serializer* serializer, mip_aiding_pos_ecef_command* self) +{ + extract_mip_time(serializer, &self->time); + + microstrain_extract_u8(serializer, &self->frame_id); + + extract_mip_vector3d(serializer, self->position); + + extract_mip_vector3f(serializer, self->uncertainty); + + extract_mip_aiding_pos_ecef_command_valid_flags(serializer, &self->valid_flags); + +} + +mip_cmd_result mip_aiding_pos_ecef(mip_interface* device, const mip_time* time, uint8_t frame_id, const double* position, const float* uncertainty, mip_aiding_pos_ecef_command_valid_flags valid_flags) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + assert(time); + insert_mip_time(&serializer, time); + + microstrain_insert_u8(&serializer, frame_id); + + assert(position); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_double(&serializer, position[i]); + + assert(uncertainty); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_float(&serializer, uncertainty[i]); + + insert_mip_aiding_pos_ecef_command_valid_flags(&serializer, valid_flags); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_POS_ECEF, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_aiding_pos_llh_command(microstrain_serializer* serializer, const mip_aiding_pos_llh_command* self) +{ + insert_mip_time(serializer, &self->time); + + microstrain_insert_u8(serializer, self->frame_id); + + microstrain_insert_double(serializer, self->latitude); + + microstrain_insert_double(serializer, self->longitude); + + microstrain_insert_double(serializer, self->height); + + insert_mip_vector3f(serializer, self->uncertainty); + + insert_mip_aiding_pos_llh_command_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_aiding_pos_llh_command(microstrain_serializer* serializer, mip_aiding_pos_llh_command* self) +{ + extract_mip_time(serializer, &self->time); + + microstrain_extract_u8(serializer, &self->frame_id); + + microstrain_extract_double(serializer, &self->latitude); + + microstrain_extract_double(serializer, &self->longitude); + + microstrain_extract_double(serializer, &self->height); + + extract_mip_vector3f(serializer, self->uncertainty); + + extract_mip_aiding_pos_llh_command_valid_flags(serializer, &self->valid_flags); + +} + +mip_cmd_result mip_aiding_pos_llh(mip_interface* device, const mip_time* time, uint8_t frame_id, double latitude, double longitude, double height, const float* uncertainty, mip_aiding_pos_llh_command_valid_flags valid_flags) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + assert(time); + insert_mip_time(&serializer, time); + + microstrain_insert_u8(&serializer, frame_id); + + microstrain_insert_double(&serializer, latitude); + + microstrain_insert_double(&serializer, longitude); + + microstrain_insert_double(&serializer, height); + + assert(uncertainty); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_float(&serializer, uncertainty[i]); + + insert_mip_aiding_pos_llh_command_valid_flags(&serializer, valid_flags); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_POS_LLH, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_aiding_height_above_ellipsoid_command(microstrain_serializer* serializer, const mip_aiding_height_above_ellipsoid_command* self) +{ + insert_mip_time(serializer, &self->time); + + microstrain_insert_u8(serializer, self->frame_id); + + microstrain_insert_float(serializer, self->height); + + microstrain_insert_float(serializer, self->uncertainty); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_aiding_height_above_ellipsoid_command(microstrain_serializer* serializer, mip_aiding_height_above_ellipsoid_command* self) +{ + extract_mip_time(serializer, &self->time); + + microstrain_extract_u8(serializer, &self->frame_id); + + microstrain_extract_float(serializer, &self->height); + + microstrain_extract_float(serializer, &self->uncertainty); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} + +mip_cmd_result mip_aiding_height_above_ellipsoid(mip_interface* device, const mip_time* time, uint8_t frame_id, float height, float uncertainty, uint16_t valid_flags) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + assert(time); + insert_mip_time(&serializer, time); + + microstrain_insert_u8(&serializer, frame_id); + + microstrain_insert_float(&serializer, height); + + microstrain_insert_float(&serializer, uncertainty); + + microstrain_insert_u16(&serializer, valid_flags); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_HEIGHT_ABOVE_ELLIPSOID, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_aiding_vel_ecef_command(microstrain_serializer* serializer, const mip_aiding_vel_ecef_command* self) +{ + insert_mip_time(serializer, &self->time); + + microstrain_insert_u8(serializer, self->frame_id); + + insert_mip_vector3f(serializer, self->velocity); + + insert_mip_vector3f(serializer, self->uncertainty); + + insert_mip_aiding_vel_ecef_command_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_aiding_vel_ecef_command(microstrain_serializer* serializer, mip_aiding_vel_ecef_command* self) +{ + extract_mip_time(serializer, &self->time); + + microstrain_extract_u8(serializer, &self->frame_id); + + extract_mip_vector3f(serializer, self->velocity); + + extract_mip_vector3f(serializer, self->uncertainty); + + extract_mip_aiding_vel_ecef_command_valid_flags(serializer, &self->valid_flags); + +} + +mip_cmd_result mip_aiding_vel_ecef(mip_interface* device, const mip_time* time, uint8_t frame_id, const float* velocity, const float* uncertainty, mip_aiding_vel_ecef_command_valid_flags valid_flags) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + assert(time); + insert_mip_time(&serializer, time); + + microstrain_insert_u8(&serializer, frame_id); + + assert(velocity); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_float(&serializer, velocity[i]); + + assert(uncertainty); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_float(&serializer, uncertainty[i]); + + insert_mip_aiding_vel_ecef_command_valid_flags(&serializer, valid_flags); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_VEL_ECEF, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_aiding_vel_ned_command(microstrain_serializer* serializer, const mip_aiding_vel_ned_command* self) +{ + insert_mip_time(serializer, &self->time); + + microstrain_insert_u8(serializer, self->frame_id); + + insert_mip_vector3f(serializer, self->velocity); + + insert_mip_vector3f(serializer, self->uncertainty); + + insert_mip_aiding_vel_ned_command_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_aiding_vel_ned_command(microstrain_serializer* serializer, mip_aiding_vel_ned_command* self) +{ + extract_mip_time(serializer, &self->time); + + microstrain_extract_u8(serializer, &self->frame_id); + + extract_mip_vector3f(serializer, self->velocity); + + extract_mip_vector3f(serializer, self->uncertainty); + + extract_mip_aiding_vel_ned_command_valid_flags(serializer, &self->valid_flags); + +} + +mip_cmd_result mip_aiding_vel_ned(mip_interface* device, const mip_time* time, uint8_t frame_id, const float* velocity, const float* uncertainty, mip_aiding_vel_ned_command_valid_flags valid_flags) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + assert(time); + insert_mip_time(&serializer, time); + + microstrain_insert_u8(&serializer, frame_id); + + assert(velocity); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_float(&serializer, velocity[i]); + + assert(uncertainty); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_float(&serializer, uncertainty[i]); + + insert_mip_aiding_vel_ned_command_valid_flags(&serializer, valid_flags); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_VEL_NED, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_aiding_vel_body_frame_command(microstrain_serializer* serializer, const mip_aiding_vel_body_frame_command* self) +{ + insert_mip_time(serializer, &self->time); + + microstrain_insert_u8(serializer, self->frame_id); + + insert_mip_vector3f(serializer, self->velocity); + + insert_mip_vector3f(serializer, self->uncertainty); + + insert_mip_aiding_vel_body_frame_command_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_aiding_vel_body_frame_command(microstrain_serializer* serializer, mip_aiding_vel_body_frame_command* self) +{ + extract_mip_time(serializer, &self->time); + + microstrain_extract_u8(serializer, &self->frame_id); + + extract_mip_vector3f(serializer, self->velocity); + + extract_mip_vector3f(serializer, self->uncertainty); + + extract_mip_aiding_vel_body_frame_command_valid_flags(serializer, &self->valid_flags); + +} + +mip_cmd_result mip_aiding_vel_body_frame(mip_interface* device, const mip_time* time, uint8_t frame_id, const float* velocity, const float* uncertainty, mip_aiding_vel_body_frame_command_valid_flags valid_flags) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + assert(time); + insert_mip_time(&serializer, time); + + microstrain_insert_u8(&serializer, frame_id); + + assert(velocity); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_float(&serializer, velocity[i]); + + assert(uncertainty); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_float(&serializer, uncertainty[i]); + + insert_mip_aiding_vel_body_frame_command_valid_flags(&serializer, valid_flags); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_VEL_BODY_FRAME, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_aiding_heading_true_command(microstrain_serializer* serializer, const mip_aiding_heading_true_command* self) +{ + insert_mip_time(serializer, &self->time); + + microstrain_insert_u8(serializer, self->frame_id); + + microstrain_insert_float(serializer, self->heading); + + microstrain_insert_float(serializer, self->uncertainty); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_aiding_heading_true_command(microstrain_serializer* serializer, mip_aiding_heading_true_command* self) +{ + extract_mip_time(serializer, &self->time); + + microstrain_extract_u8(serializer, &self->frame_id); + + microstrain_extract_float(serializer, &self->heading); + + microstrain_extract_float(serializer, &self->uncertainty); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} + +mip_cmd_result mip_aiding_heading_true(mip_interface* device, const mip_time* time, uint8_t frame_id, float heading, float uncertainty, uint16_t valid_flags) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + assert(time); + insert_mip_time(&serializer, time); + + microstrain_insert_u8(&serializer, frame_id); + + microstrain_insert_float(&serializer, heading); + + microstrain_insert_float(&serializer, uncertainty); + + microstrain_insert_u16(&serializer, valid_flags); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_HEADING_TRUE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_aiding_magnetic_field_command(microstrain_serializer* serializer, const mip_aiding_magnetic_field_command* self) +{ + insert_mip_time(serializer, &self->time); + + microstrain_insert_u8(serializer, self->frame_id); + + insert_mip_vector3f(serializer, self->magnetic_field); + + insert_mip_vector3f(serializer, self->uncertainty); + + insert_mip_aiding_magnetic_field_command_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_aiding_magnetic_field_command(microstrain_serializer* serializer, mip_aiding_magnetic_field_command* self) +{ + extract_mip_time(serializer, &self->time); + + microstrain_extract_u8(serializer, &self->frame_id); + + extract_mip_vector3f(serializer, self->magnetic_field); + + extract_mip_vector3f(serializer, self->uncertainty); + + extract_mip_aiding_magnetic_field_command_valid_flags(serializer, &self->valid_flags); + +} + +mip_cmd_result mip_aiding_magnetic_field(mip_interface* device, const mip_time* time, uint8_t frame_id, const float* magnetic_field, const float* uncertainty, mip_aiding_magnetic_field_command_valid_flags valid_flags) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + assert(time); + insert_mip_time(&serializer, time); + + microstrain_insert_u8(&serializer, frame_id); + + assert(magnetic_field); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_float(&serializer, magnetic_field[i]); + + assert(uncertainty); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_float(&serializer, uncertainty[i]); + + insert_mip_aiding_magnetic_field_command_valid_flags(&serializer, valid_flags); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_MAGNETIC_FIELD, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_aiding_pressure_command(microstrain_serializer* serializer, const mip_aiding_pressure_command* self) +{ + insert_mip_time(serializer, &self->time); + + microstrain_insert_u8(serializer, self->frame_id); + + microstrain_insert_float(serializer, self->pressure); + + microstrain_insert_float(serializer, self->uncertainty); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_aiding_pressure_command(microstrain_serializer* serializer, mip_aiding_pressure_command* self) +{ + extract_mip_time(serializer, &self->time); + + microstrain_extract_u8(serializer, &self->frame_id); + + microstrain_extract_float(serializer, &self->pressure); + + microstrain_extract_float(serializer, &self->uncertainty); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} + +mip_cmd_result mip_aiding_pressure(mip_interface* device, const mip_time* time, uint8_t frame_id, float pressure, float uncertainty, uint16_t valid_flags) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + assert(time); + insert_mip_time(&serializer, time); + + microstrain_insert_u8(&serializer, frame_id); + + microstrain_insert_float(&serializer, pressure); + + microstrain_insert_float(&serializer, uncertainty); + + microstrain_insert_u16(&serializer, valid_flags); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_PRESSURE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} + +#ifdef __cplusplus +} // extern "C" +} // namespace C +} // namespace mip +#endif // __cplusplus + diff --git a/src/mip/definitions/commands_aiding.h b/src/c/mip/definitions/commands_aiding.h similarity index 55% rename from src/mip/definitions/commands_aiding.h rename to src/c/mip/definitions/commands_aiding.h index 51d92b67e..e12c67577 100644 --- a/src/mip/definitions/commands_aiding.h +++ b/src/c/mip/definitions/commands_aiding.h @@ -1,8 +1,9 @@ #pragma once -#include "common.h" -#include "descriptors.h" -#include "../mip_result.h" +#include +#include +#include +#include #include #include @@ -14,14 +15,11 @@ namespace C { extern "C" { #endif // __cplusplus -struct mip_interface; -struct mip_serializer; -struct mip_field; //////////////////////////////////////////////////////////////////////////////// -///@addtogroup MipCommands_c MIP Commands [C] +///@addtogroup MipCommands_c ///@{ -///@defgroup aiding_commands_c Aiding Commands [C] +///@defgroup aiding_commands_c Aiding Commands /// ///@{ @@ -60,24 +58,36 @@ enum // Shared Type Definitions //////////////////////////////////////////////////////////////////////////////// -typedef uint8_t mip_time_timebase; -static const mip_time_timebase MIP_TIME_TIMEBASE_INTERNAL_REFERENCE = 1; ///< Timestamp provided is with respect to internal clock. -static const mip_time_timebase MIP_TIME_TIMEBASE_EXTERNAL_TIME = 2; ///< Timestamp provided is with respect to external clock, synced by PPS source. -static const mip_time_timebase MIP_TIME_TIMEBASE_TIME_OF_ARRIVAL = 3; ///< Timestamp provided is a fixed latency relative to time of message arrival. +enum mip_time_timebase +{ + MIP_TIME_TIMEBASE_INTERNAL_REFERENCE = 1, ///< Timestamp provided is with respect to internal clock. + MIP_TIME_TIMEBASE_EXTERNAL_TIME = 2, ///< Timestamp provided is with respect to external clock, synced by PPS source. + MIP_TIME_TIMEBASE_TIME_OF_ARRIVAL = 3, ///< Timestamp provided is a fixed latency relative to time of message arrival. +}; +typedef enum mip_time_timebase mip_time_timebase; + +static inline void insert_mip_time_timebase(microstrain_serializer* serializer, const mip_time_timebase self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_time_timebase(microstrain_serializer* serializer, mip_time_timebase* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} + struct mip_time { mip_time_timebase timebase; ///< Timebase reference, e.g. internal, external, GPS, UTC, etc. uint8_t reserved; ///< Reserved, set to 0x01. uint64_t nanoseconds; ///< Nanoseconds since the timebase epoch. - }; typedef struct mip_time mip_time; -void insert_mip_time(struct mip_serializer* serializer, const mip_time* self); -void extract_mip_time(struct mip_serializer* serializer, mip_time* self); -void insert_mip_time_timebase(struct mip_serializer* serializer, const mip_time_timebase self); -void extract_mip_time_timebase(struct mip_serializer* serializer, mip_time_timebase* self); +void insert_mip_time(microstrain_serializer* serializer, const mip_time* self); +void extract_mip_time(microstrain_serializer* serializer, mip_time* self); //////////////////////////////////////////////////////////////////////////////// @@ -85,9 +95,10 @@ void extract_mip_time_timebase(struct mip_serializer* serializer, mip_time_timeb //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_aiding_frame_config (0x13,0x01) Frame Config [C] -/// Defines an aiding frame associated with a specific sensor frame ID. The frame ID used in this command -/// should mirror the frame ID used in the aiding command (if that aiding measurement is measured in this reference frame) +///@defgroup aiding_frame_config_c (0x13,0x01) Frame Config +/// Defines an aiding frame associated with a specific sensor frame ID. +/// The frame ID used in this command should mirror the frame ID used in the aiding command +/// (if that aiding measurement is measured in this reference frame). /// /// This transform satisfies the following relationship: /// @@ -113,9 +124,23 @@ void extract_mip_time_timebase(struct mip_serializer* serializer, mip_time_timeb /// ///@{ -typedef uint8_t mip_aiding_frame_config_command_format; -static const mip_aiding_frame_config_command_format MIP_AIDING_FRAME_CONFIG_COMMAND_FORMAT_EULER = 1; ///< Translation vector followed by euler angles (roll, pitch, yaw). -static const mip_aiding_frame_config_command_format MIP_AIDING_FRAME_CONFIG_COMMAND_FORMAT_QUATERNION = 2; ///< Translation vector followed by quaternion (w, x, y, z). +enum mip_aiding_frame_config_command_format +{ + MIP_AIDING_FRAME_CONFIG_COMMAND_FORMAT_EULER = 1, ///< Translation vector followed by euler angles (roll, pitch, yaw). + MIP_AIDING_FRAME_CONFIG_COMMAND_FORMAT_QUATERNION = 2, ///< Translation vector followed by quaternion (w, x, y, z). +}; +typedef enum mip_aiding_frame_config_command_format mip_aiding_frame_config_command_format; + +static inline void insert_mip_aiding_frame_config_command_format(microstrain_serializer* serializer, const mip_aiding_frame_config_command_format self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_aiding_frame_config_command_format(microstrain_serializer* serializer, mip_aiding_frame_config_command_format* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} union mip_aiding_frame_config_command_rotation { @@ -132,14 +157,11 @@ struct mip_aiding_frame_config_command bool tracking_enabled; ///< If enabled, the Kalman filter will track errors. mip_vector3f translation; ///< Translation X, Y, and Z. mip_aiding_frame_config_command_rotation rotation; ///< Rotation as specified by format. - }; typedef struct mip_aiding_frame_config_command mip_aiding_frame_config_command; -void insert_mip_aiding_frame_config_command(struct mip_serializer* serializer, const mip_aiding_frame_config_command* self); -void extract_mip_aiding_frame_config_command(struct mip_serializer* serializer, mip_aiding_frame_config_command* self); -void insert_mip_aiding_frame_config_command_format(struct mip_serializer* serializer, const mip_aiding_frame_config_command_format self); -void extract_mip_aiding_frame_config_command_format(struct mip_serializer* serializer, mip_aiding_frame_config_command_format* self); +void insert_mip_aiding_frame_config_command(microstrain_serializer* serializer, const mip_aiding_frame_config_command* self); +void extract_mip_aiding_frame_config_command(microstrain_serializer* serializer, mip_aiding_frame_config_command* self); struct mip_aiding_frame_config_response { @@ -148,63 +170,75 @@ struct mip_aiding_frame_config_response bool tracking_enabled; ///< If enabled, the Kalman filter will track errors. mip_vector3f translation; ///< Translation X, Y, and Z. mip_aiding_frame_config_command_rotation rotation; ///< Rotation as specified by format. - }; typedef struct mip_aiding_frame_config_response mip_aiding_frame_config_response; -void insert_mip_aiding_frame_config_response(struct mip_serializer* serializer, const mip_aiding_frame_config_response* self); -void extract_mip_aiding_frame_config_response(struct mip_serializer* serializer, mip_aiding_frame_config_response* self); -mip_cmd_result mip_aiding_write_frame_config(struct mip_interface* device, uint8_t frame_id, mip_aiding_frame_config_command_format format, bool tracking_enabled, const float* translation, const mip_aiding_frame_config_command_rotation* rotation); -mip_cmd_result mip_aiding_read_frame_config(struct mip_interface* device, uint8_t frame_id, mip_aiding_frame_config_command_format format, bool* tracking_enabled_out, float* translation_out, mip_aiding_frame_config_command_rotation* rotation_out); -mip_cmd_result mip_aiding_save_frame_config(struct mip_interface* device, uint8_t frame_id); -mip_cmd_result mip_aiding_load_frame_config(struct mip_interface* device, uint8_t frame_id); -mip_cmd_result mip_aiding_default_frame_config(struct mip_interface* device, uint8_t frame_id); +void insert_mip_aiding_frame_config_response(microstrain_serializer* serializer, const mip_aiding_frame_config_response* self); +void extract_mip_aiding_frame_config_response(microstrain_serializer* serializer, mip_aiding_frame_config_response* self); + +mip_cmd_result mip_aiding_write_frame_config(mip_interface* device, uint8_t frame_id, mip_aiding_frame_config_command_format format, bool tracking_enabled, const float* translation, const mip_aiding_frame_config_command_rotation* rotation); +mip_cmd_result mip_aiding_read_frame_config(mip_interface* device, uint8_t frame_id, mip_aiding_frame_config_command_format format, bool* tracking_enabled_out, float* translation_out, mip_aiding_frame_config_command_rotation* rotation_out); +mip_cmd_result mip_aiding_save_frame_config(mip_interface* device, uint8_t frame_id); +mip_cmd_result mip_aiding_load_frame_config(mip_interface* device, uint8_t frame_id); +mip_cmd_result mip_aiding_default_frame_config(mip_interface* device, uint8_t frame_id); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_aiding_echo_control (0x13,0x1F) Echo Control [C] +///@defgroup aiding_echo_control_c (0x13,0x1F) Echo Control /// Controls command response behavior to external aiding commands /// ///@{ -typedef uint8_t mip_aiding_echo_control_command_mode; -static const mip_aiding_echo_control_command_mode MIP_AIDING_ECHO_CONTROL_COMMAND_MODE_SUPPRESS_ACK = 0; ///< Suppresses the usual command ack field for aiding messages. -static const mip_aiding_echo_control_command_mode MIP_AIDING_ECHO_CONTROL_COMMAND_MODE_STANDARD = 1; ///< Normal ack/nack behavior. -static const mip_aiding_echo_control_command_mode MIP_AIDING_ECHO_CONTROL_COMMAND_MODE_RESPONSE = 2; ///< Echo the data back as a response. +enum mip_aiding_echo_control_command_mode +{ + MIP_AIDING_ECHO_CONTROL_COMMAND_MODE_SUPPRESS_ACK = 0, ///< Suppresses the usual command ack field for aiding messages. + MIP_AIDING_ECHO_CONTROL_COMMAND_MODE_STANDARD = 1, ///< Normal ack/nack behavior. + MIP_AIDING_ECHO_CONTROL_COMMAND_MODE_RESPONSE = 2, ///< Echo the data back as a response. +}; +typedef enum mip_aiding_echo_control_command_mode mip_aiding_echo_control_command_mode; + +static inline void insert_mip_aiding_echo_control_command_mode(microstrain_serializer* serializer, const mip_aiding_echo_control_command_mode self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_aiding_echo_control_command_mode(microstrain_serializer* serializer, mip_aiding_echo_control_command_mode* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} + struct mip_aiding_echo_control_command { mip_function_selector function; mip_aiding_echo_control_command_mode mode; ///< Controls data echoing. - }; typedef struct mip_aiding_echo_control_command mip_aiding_echo_control_command; -void insert_mip_aiding_echo_control_command(struct mip_serializer* serializer, const mip_aiding_echo_control_command* self); -void extract_mip_aiding_echo_control_command(struct mip_serializer* serializer, mip_aiding_echo_control_command* self); -void insert_mip_aiding_echo_control_command_mode(struct mip_serializer* serializer, const mip_aiding_echo_control_command_mode self); -void extract_mip_aiding_echo_control_command_mode(struct mip_serializer* serializer, mip_aiding_echo_control_command_mode* self); +void insert_mip_aiding_echo_control_command(microstrain_serializer* serializer, const mip_aiding_echo_control_command* self); +void extract_mip_aiding_echo_control_command(microstrain_serializer* serializer, mip_aiding_echo_control_command* self); struct mip_aiding_echo_control_response { mip_aiding_echo_control_command_mode mode; ///< Controls data echoing. - }; typedef struct mip_aiding_echo_control_response mip_aiding_echo_control_response; -void insert_mip_aiding_echo_control_response(struct mip_serializer* serializer, const mip_aiding_echo_control_response* self); -void extract_mip_aiding_echo_control_response(struct mip_serializer* serializer, mip_aiding_echo_control_response* self); -mip_cmd_result mip_aiding_write_echo_control(struct mip_interface* device, mip_aiding_echo_control_command_mode mode); -mip_cmd_result mip_aiding_read_echo_control(struct mip_interface* device, mip_aiding_echo_control_command_mode* mode_out); -mip_cmd_result mip_aiding_save_echo_control(struct mip_interface* device); -mip_cmd_result mip_aiding_load_echo_control(struct mip_interface* device); -mip_cmd_result mip_aiding_default_echo_control(struct mip_interface* device); +void insert_mip_aiding_echo_control_response(microstrain_serializer* serializer, const mip_aiding_echo_control_response* self); +void extract_mip_aiding_echo_control_response(microstrain_serializer* serializer, mip_aiding_echo_control_response* self); + +mip_cmd_result mip_aiding_write_echo_control(mip_interface* device, mip_aiding_echo_control_command_mode mode); +mip_cmd_result mip_aiding_read_echo_control(mip_interface* device, mip_aiding_echo_control_command_mode* mode_out); +mip_cmd_result mip_aiding_save_echo_control(mip_interface* device); +mip_cmd_result mip_aiding_load_echo_control(mip_interface* device); +mip_cmd_result mip_aiding_default_echo_control(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_aiding_pos_ecef (0x13,0x21) Pos Ecef [C] +///@defgroup aiding_pos_ecef_c (0x13,0x21) Pos Ecef /// Cartesian vector position aiding command. Coordinates are given in the WGS84 ECEF system. /// ///@{ @@ -215,6 +249,17 @@ static const mip_aiding_pos_ecef_command_valid_flags MIP_AIDING_POS_ECEF_COMMAND static const mip_aiding_pos_ecef_command_valid_flags MIP_AIDING_POS_ECEF_COMMAND_VALID_FLAGS_Y = 0x0002; ///< static const mip_aiding_pos_ecef_command_valid_flags MIP_AIDING_POS_ECEF_COMMAND_VALID_FLAGS_Z = 0x0004; ///< static const mip_aiding_pos_ecef_command_valid_flags MIP_AIDING_POS_ECEF_COMMAND_VALID_FLAGS_ALL = 0x0007; +static inline void insert_mip_aiding_pos_ecef_command_valid_flags(microstrain_serializer* serializer, const mip_aiding_pos_ecef_command_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_aiding_pos_ecef_command_valid_flags(microstrain_serializer* serializer, mip_aiding_pos_ecef_command_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_aiding_pos_ecef_command { @@ -223,22 +268,20 @@ struct mip_aiding_pos_ecef_command mip_vector3d position; ///< ECEF position [m]. mip_vector3f uncertainty; ///< ECEF position uncertainty [m]. Cannot be 0 unless the corresponding valid flags are 0. mip_aiding_pos_ecef_command_valid_flags valid_flags; ///< Valid flags. Axes with 0 will be completely ignored. - }; typedef struct mip_aiding_pos_ecef_command mip_aiding_pos_ecef_command; -void insert_mip_aiding_pos_ecef_command(struct mip_serializer* serializer, const mip_aiding_pos_ecef_command* self); -void extract_mip_aiding_pos_ecef_command(struct mip_serializer* serializer, mip_aiding_pos_ecef_command* self); -void insert_mip_aiding_pos_ecef_command_valid_flags(struct mip_serializer* serializer, const mip_aiding_pos_ecef_command_valid_flags self); -void extract_mip_aiding_pos_ecef_command_valid_flags(struct mip_serializer* serializer, mip_aiding_pos_ecef_command_valid_flags* self); +void insert_mip_aiding_pos_ecef_command(microstrain_serializer* serializer, const mip_aiding_pos_ecef_command* self); +void extract_mip_aiding_pos_ecef_command(microstrain_serializer* serializer, mip_aiding_pos_ecef_command* self); -mip_cmd_result mip_aiding_pos_ecef(struct mip_interface* device, const mip_time* time, uint8_t frame_id, const double* position, const float* uncertainty, mip_aiding_pos_ecef_command_valid_flags valid_flags); +mip_cmd_result mip_aiding_pos_ecef(mip_interface* device, const mip_time* time, uint8_t frame_id, const double* position, const float* uncertainty, mip_aiding_pos_ecef_command_valid_flags valid_flags); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_aiding_pos_llh (0x13,0x22) Pos Llh [C] -/// Geodetic position aiding command. Coordinates are given in WGS84 geodetic latitude, longitude, and height above the ellipsoid. +///@defgroup aiding_pos_llh_c (0x13,0x22) Pos Llh +/// Geodetic position aiding command. +/// Coordinates are given in WGS84 geodetic latitude, longitude, and height above the ellipsoid. /// Uncertainty is given in NED coordinates, which are parallel to incremental changes in latitude, longitude, and height. /// ///@{ @@ -249,6 +292,17 @@ static const mip_aiding_pos_llh_command_valid_flags MIP_AIDING_POS_LLH_COMMAND_V static const mip_aiding_pos_llh_command_valid_flags MIP_AIDING_POS_LLH_COMMAND_VALID_FLAGS_LONGITUDE = 0x0002; ///< static const mip_aiding_pos_llh_command_valid_flags MIP_AIDING_POS_LLH_COMMAND_VALID_FLAGS_HEIGHT = 0x0004; ///< static const mip_aiding_pos_llh_command_valid_flags MIP_AIDING_POS_LLH_COMMAND_VALID_FLAGS_ALL = 0x0007; +static inline void insert_mip_aiding_pos_llh_command_valid_flags(microstrain_serializer* serializer, const mip_aiding_pos_llh_command_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_aiding_pos_llh_command_valid_flags(microstrain_serializer* serializer, mip_aiding_pos_llh_command_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_aiding_pos_llh_command { @@ -259,21 +313,18 @@ struct mip_aiding_pos_llh_command double height; ///< [m] mip_vector3f uncertainty; ///< NED position uncertainty. Cannot be 0 unless the corresponding valid flags are 0. mip_aiding_pos_llh_command_valid_flags valid_flags; ///< Valid flags. Axes with 0 will be completely ignored. - }; typedef struct mip_aiding_pos_llh_command mip_aiding_pos_llh_command; -void insert_mip_aiding_pos_llh_command(struct mip_serializer* serializer, const mip_aiding_pos_llh_command* self); -void extract_mip_aiding_pos_llh_command(struct mip_serializer* serializer, mip_aiding_pos_llh_command* self); -void insert_mip_aiding_pos_llh_command_valid_flags(struct mip_serializer* serializer, const mip_aiding_pos_llh_command_valid_flags self); -void extract_mip_aiding_pos_llh_command_valid_flags(struct mip_serializer* serializer, mip_aiding_pos_llh_command_valid_flags* self); +void insert_mip_aiding_pos_llh_command(microstrain_serializer* serializer, const mip_aiding_pos_llh_command* self); +void extract_mip_aiding_pos_llh_command(microstrain_serializer* serializer, mip_aiding_pos_llh_command* self); -mip_cmd_result mip_aiding_pos_llh(struct mip_interface* device, const mip_time* time, uint8_t frame_id, double latitude, double longitude, double height, const float* uncertainty, mip_aiding_pos_llh_command_valid_flags valid_flags); +mip_cmd_result mip_aiding_pos_llh(mip_interface* device, const mip_time* time, uint8_t frame_id, double latitude, double longitude, double height, const float* uncertainty, mip_aiding_pos_llh_command_valid_flags valid_flags); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_aiding_height_above_ellipsoid (0x13,0x23) Height Above Ellipsoid [C] +///@defgroup aiding_height_above_ellipsoid_c (0x13,0x23) Height Above Ellipsoid /// Estimated value of the height above ellipsoid. /// ///@{ @@ -285,18 +336,18 @@ struct mip_aiding_height_above_ellipsoid_command float height; ///< [m] float uncertainty; ///< [m] uint16_t valid_flags; - }; typedef struct mip_aiding_height_above_ellipsoid_command mip_aiding_height_above_ellipsoid_command; -void insert_mip_aiding_height_above_ellipsoid_command(struct mip_serializer* serializer, const mip_aiding_height_above_ellipsoid_command* self); -void extract_mip_aiding_height_above_ellipsoid_command(struct mip_serializer* serializer, mip_aiding_height_above_ellipsoid_command* self); -mip_cmd_result mip_aiding_height_above_ellipsoid(struct mip_interface* device, const mip_time* time, uint8_t frame_id, float height, float uncertainty, uint16_t valid_flags); +void insert_mip_aiding_height_above_ellipsoid_command(microstrain_serializer* serializer, const mip_aiding_height_above_ellipsoid_command* self); +void extract_mip_aiding_height_above_ellipsoid_command(microstrain_serializer* serializer, mip_aiding_height_above_ellipsoid_command* self); + +mip_cmd_result mip_aiding_height_above_ellipsoid(mip_interface* device, const mip_time* time, uint8_t frame_id, float height, float uncertainty, uint16_t valid_flags); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_aiding_vel_ecef (0x13,0x28) Vel Ecef [C] +///@defgroup aiding_vel_ecef_c (0x13,0x28) Vel Ecef /// ECEF velocity aiding command. Coordinates are given in the WGS84 ECEF frame. /// ///@{ @@ -307,6 +358,17 @@ static const mip_aiding_vel_ecef_command_valid_flags MIP_AIDING_VEL_ECEF_COMMAND static const mip_aiding_vel_ecef_command_valid_flags MIP_AIDING_VEL_ECEF_COMMAND_VALID_FLAGS_Y = 0x0002; ///< static const mip_aiding_vel_ecef_command_valid_flags MIP_AIDING_VEL_ECEF_COMMAND_VALID_FLAGS_Z = 0x0004; ///< static const mip_aiding_vel_ecef_command_valid_flags MIP_AIDING_VEL_ECEF_COMMAND_VALID_FLAGS_ALL = 0x0007; +static inline void insert_mip_aiding_vel_ecef_command_valid_flags(microstrain_serializer* serializer, const mip_aiding_vel_ecef_command_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_aiding_vel_ecef_command_valid_flags(microstrain_serializer* serializer, mip_aiding_vel_ecef_command_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_aiding_vel_ecef_command { @@ -315,21 +377,18 @@ struct mip_aiding_vel_ecef_command mip_vector3f velocity; ///< ECEF velocity [m/s]. mip_vector3f uncertainty; ///< ECEF velocity uncertainty [m/s]. Cannot be 0 unless the corresponding valid flags are 0. mip_aiding_vel_ecef_command_valid_flags valid_flags; ///< Valid flags. Axes with 0 will be completely ignored. - }; typedef struct mip_aiding_vel_ecef_command mip_aiding_vel_ecef_command; -void insert_mip_aiding_vel_ecef_command(struct mip_serializer* serializer, const mip_aiding_vel_ecef_command* self); -void extract_mip_aiding_vel_ecef_command(struct mip_serializer* serializer, mip_aiding_vel_ecef_command* self); -void insert_mip_aiding_vel_ecef_command_valid_flags(struct mip_serializer* serializer, const mip_aiding_vel_ecef_command_valid_flags self); -void extract_mip_aiding_vel_ecef_command_valid_flags(struct mip_serializer* serializer, mip_aiding_vel_ecef_command_valid_flags* self); +void insert_mip_aiding_vel_ecef_command(microstrain_serializer* serializer, const mip_aiding_vel_ecef_command* self); +void extract_mip_aiding_vel_ecef_command(microstrain_serializer* serializer, mip_aiding_vel_ecef_command* self); -mip_cmd_result mip_aiding_vel_ecef(struct mip_interface* device, const mip_time* time, uint8_t frame_id, const float* velocity, const float* uncertainty, mip_aiding_vel_ecef_command_valid_flags valid_flags); +mip_cmd_result mip_aiding_vel_ecef(mip_interface* device, const mip_time* time, uint8_t frame_id, const float* velocity, const float* uncertainty, mip_aiding_vel_ecef_command_valid_flags valid_flags); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_aiding_vel_ned (0x13,0x29) Vel Ned [C] +///@defgroup aiding_vel_ned_c (0x13,0x29) Vel Ned /// NED velocity aiding command. Coordinates are given in the local North-East-Down frame. /// ///@{ @@ -340,6 +399,17 @@ static const mip_aiding_vel_ned_command_valid_flags MIP_AIDING_VEL_NED_COMMAND_V static const mip_aiding_vel_ned_command_valid_flags MIP_AIDING_VEL_NED_COMMAND_VALID_FLAGS_Y = 0x0002; ///< static const mip_aiding_vel_ned_command_valid_flags MIP_AIDING_VEL_NED_COMMAND_VALID_FLAGS_Z = 0x0004; ///< static const mip_aiding_vel_ned_command_valid_flags MIP_AIDING_VEL_NED_COMMAND_VALID_FLAGS_ALL = 0x0007; +static inline void insert_mip_aiding_vel_ned_command_valid_flags(microstrain_serializer* serializer, const mip_aiding_vel_ned_command_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_aiding_vel_ned_command_valid_flags(microstrain_serializer* serializer, mip_aiding_vel_ned_command_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_aiding_vel_ned_command { @@ -348,23 +418,19 @@ struct mip_aiding_vel_ned_command mip_vector3f velocity; ///< NED velocity [m/s]. mip_vector3f uncertainty; ///< NED velocity uncertainty [m/s]. Cannot be 0 unless the corresponding valid flags are 0. mip_aiding_vel_ned_command_valid_flags valid_flags; ///< Valid flags. Axes with 0 will be completely ignored. - }; typedef struct mip_aiding_vel_ned_command mip_aiding_vel_ned_command; -void insert_mip_aiding_vel_ned_command(struct mip_serializer* serializer, const mip_aiding_vel_ned_command* self); -void extract_mip_aiding_vel_ned_command(struct mip_serializer* serializer, mip_aiding_vel_ned_command* self); -void insert_mip_aiding_vel_ned_command_valid_flags(struct mip_serializer* serializer, const mip_aiding_vel_ned_command_valid_flags self); -void extract_mip_aiding_vel_ned_command_valid_flags(struct mip_serializer* serializer, mip_aiding_vel_ned_command_valid_flags* self); +void insert_mip_aiding_vel_ned_command(microstrain_serializer* serializer, const mip_aiding_vel_ned_command* self); +void extract_mip_aiding_vel_ned_command(microstrain_serializer* serializer, mip_aiding_vel_ned_command* self); -mip_cmd_result mip_aiding_vel_ned(struct mip_interface* device, const mip_time* time, uint8_t frame_id, const float* velocity, const float* uncertainty, mip_aiding_vel_ned_command_valid_flags valid_flags); +mip_cmd_result mip_aiding_vel_ned(mip_interface* device, const mip_time* time, uint8_t frame_id, const float* velocity, const float* uncertainty, mip_aiding_vel_ned_command_valid_flags valid_flags); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_aiding_vel_body_frame (0x13,0x2A) Vel Body Frame [C] -/// Estimate of velocity of the vehicle in the frame associated -/// with the given sensor ID, relative to the vehicle frame. +///@defgroup aiding_vel_body_frame_c (0x13,0x2A) Vel Body Frame +/// Estimated of velocity of the vehicle in the frame associated with the given sensor ID, relative to the vehicle frame. /// ///@{ @@ -374,6 +440,17 @@ static const mip_aiding_vel_body_frame_command_valid_flags MIP_AIDING_VEL_BODY_F static const mip_aiding_vel_body_frame_command_valid_flags MIP_AIDING_VEL_BODY_FRAME_COMMAND_VALID_FLAGS_Y = 0x0002; ///< static const mip_aiding_vel_body_frame_command_valid_flags MIP_AIDING_VEL_BODY_FRAME_COMMAND_VALID_FLAGS_Z = 0x0004; ///< static const mip_aiding_vel_body_frame_command_valid_flags MIP_AIDING_VEL_BODY_FRAME_COMMAND_VALID_FLAGS_ALL = 0x0007; +static inline void insert_mip_aiding_vel_body_frame_command_valid_flags(microstrain_serializer* serializer, const mip_aiding_vel_body_frame_command_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_aiding_vel_body_frame_command_valid_flags(microstrain_serializer* serializer, mip_aiding_vel_body_frame_command_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_aiding_vel_body_frame_command { @@ -382,21 +459,18 @@ struct mip_aiding_vel_body_frame_command mip_vector3f velocity; ///< [m/s] mip_vector3f uncertainty; ///< [m/s] 1-sigma uncertainty. Cannot be 0 unless the corresponding valid flags are 0. mip_aiding_vel_body_frame_command_valid_flags valid_flags; ///< Valid flags. Axes with 0 will be completely ignored. - }; typedef struct mip_aiding_vel_body_frame_command mip_aiding_vel_body_frame_command; -void insert_mip_aiding_vel_body_frame_command(struct mip_serializer* serializer, const mip_aiding_vel_body_frame_command* self); -void extract_mip_aiding_vel_body_frame_command(struct mip_serializer* serializer, mip_aiding_vel_body_frame_command* self); -void insert_mip_aiding_vel_body_frame_command_valid_flags(struct mip_serializer* serializer, const mip_aiding_vel_body_frame_command_valid_flags self); -void extract_mip_aiding_vel_body_frame_command_valid_flags(struct mip_serializer* serializer, mip_aiding_vel_body_frame_command_valid_flags* self); +void insert_mip_aiding_vel_body_frame_command(microstrain_serializer* serializer, const mip_aiding_vel_body_frame_command* self); +void extract_mip_aiding_vel_body_frame_command(microstrain_serializer* serializer, mip_aiding_vel_body_frame_command* self); -mip_cmd_result mip_aiding_vel_body_frame(struct mip_interface* device, const mip_time* time, uint8_t frame_id, const float* velocity, const float* uncertainty, mip_aiding_vel_body_frame_command_valid_flags valid_flags); +mip_cmd_result mip_aiding_vel_body_frame(mip_interface* device, const mip_time* time, uint8_t frame_id, const float* velocity, const float* uncertainty, mip_aiding_vel_body_frame_command_valid_flags valid_flags); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_aiding_heading_true (0x13,0x31) Heading True [C] +///@defgroup aiding_heading_true_c (0x13,0x31) Heading True /// ///@{ @@ -407,18 +481,18 @@ struct mip_aiding_heading_true_command float heading; ///< Heading [radians]. Range +/- Pi. float uncertainty; ///< Cannot be 0 unless the valid flags are 0. uint16_t valid_flags; - }; typedef struct mip_aiding_heading_true_command mip_aiding_heading_true_command; -void insert_mip_aiding_heading_true_command(struct mip_serializer* serializer, const mip_aiding_heading_true_command* self); -void extract_mip_aiding_heading_true_command(struct mip_serializer* serializer, mip_aiding_heading_true_command* self); -mip_cmd_result mip_aiding_heading_true(struct mip_interface* device, const mip_time* time, uint8_t frame_id, float heading, float uncertainty, uint16_t valid_flags); +void insert_mip_aiding_heading_true_command(microstrain_serializer* serializer, const mip_aiding_heading_true_command* self); +void extract_mip_aiding_heading_true_command(microstrain_serializer* serializer, mip_aiding_heading_true_command* self); + +mip_cmd_result mip_aiding_heading_true(mip_interface* device, const mip_time* time, uint8_t frame_id, float heading, float uncertainty, uint16_t valid_flags); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_aiding_magnetic_field (0x13,0x32) Magnetic Field [C] +///@defgroup aiding_magnetic_field_c (0x13,0x32) Magnetic Field /// Estimate of magnetic field in the frame associated with the given sensor ID. /// ///@{ @@ -429,6 +503,17 @@ static const mip_aiding_magnetic_field_command_valid_flags MIP_AIDING_MAGNETIC_F static const mip_aiding_magnetic_field_command_valid_flags MIP_AIDING_MAGNETIC_FIELD_COMMAND_VALID_FLAGS_Y = 0x0002; ///< static const mip_aiding_magnetic_field_command_valid_flags MIP_AIDING_MAGNETIC_FIELD_COMMAND_VALID_FLAGS_Z = 0x0004; ///< static const mip_aiding_magnetic_field_command_valid_flags MIP_AIDING_MAGNETIC_FIELD_COMMAND_VALID_FLAGS_ALL = 0x0007; +static inline void insert_mip_aiding_magnetic_field_command_valid_flags(microstrain_serializer* serializer, const mip_aiding_magnetic_field_command_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_aiding_magnetic_field_command_valid_flags(microstrain_serializer* serializer, mip_aiding_magnetic_field_command_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_aiding_magnetic_field_command { @@ -437,21 +522,18 @@ struct mip_aiding_magnetic_field_command mip_vector3f magnetic_field; ///< [G] mip_vector3f uncertainty; ///< [G] 1-sigma uncertainty. Cannot be 0 unless the corresponding valid flags are 0. mip_aiding_magnetic_field_command_valid_flags valid_flags; ///< Valid flags. Axes with 0 will be completely ignored. - }; typedef struct mip_aiding_magnetic_field_command mip_aiding_magnetic_field_command; -void insert_mip_aiding_magnetic_field_command(struct mip_serializer* serializer, const mip_aiding_magnetic_field_command* self); -void extract_mip_aiding_magnetic_field_command(struct mip_serializer* serializer, mip_aiding_magnetic_field_command* self); -void insert_mip_aiding_magnetic_field_command_valid_flags(struct mip_serializer* serializer, const mip_aiding_magnetic_field_command_valid_flags self); -void extract_mip_aiding_magnetic_field_command_valid_flags(struct mip_serializer* serializer, mip_aiding_magnetic_field_command_valid_flags* self); +void insert_mip_aiding_magnetic_field_command(microstrain_serializer* serializer, const mip_aiding_magnetic_field_command* self); +void extract_mip_aiding_magnetic_field_command(microstrain_serializer* serializer, mip_aiding_magnetic_field_command* self); -mip_cmd_result mip_aiding_magnetic_field(struct mip_interface* device, const mip_time* time, uint8_t frame_id, const float* magnetic_field, const float* uncertainty, mip_aiding_magnetic_field_command_valid_flags valid_flags); +mip_cmd_result mip_aiding_magnetic_field(mip_interface* device, const mip_time* time, uint8_t frame_id, const float* magnetic_field, const float* uncertainty, mip_aiding_magnetic_field_command_valid_flags valid_flags); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_aiding_pressure (0x13,0x33) Pressure [C] +///@defgroup aiding_pressure_c (0x13,0x33) Pressure /// Estimated value of air pressure. /// ///@{ @@ -463,13 +545,13 @@ struct mip_aiding_pressure_command float pressure; ///< [mbar] float uncertainty; ///< [mbar] 1-sigma uncertainty. Cannot be 0 unless the valid flags are 0. uint16_t valid_flags; - }; typedef struct mip_aiding_pressure_command mip_aiding_pressure_command; -void insert_mip_aiding_pressure_command(struct mip_serializer* serializer, const mip_aiding_pressure_command* self); -void extract_mip_aiding_pressure_command(struct mip_serializer* serializer, mip_aiding_pressure_command* self); -mip_cmd_result mip_aiding_pressure(struct mip_interface* device, const mip_time* time, uint8_t frame_id, float pressure, float uncertainty, uint16_t valid_flags); +void insert_mip_aiding_pressure_command(microstrain_serializer* serializer, const mip_aiding_pressure_command* self); +void extract_mip_aiding_pressure_command(microstrain_serializer* serializer, mip_aiding_pressure_command* self); + +mip_cmd_result mip_aiding_pressure(mip_interface* device, const mip_time* time, uint8_t frame_id, float pressure, float uncertainty, uint16_t valid_flags); ///@} /// @@ -479,8 +561,8 @@ mip_cmd_result mip_aiding_pressure(struct mip_interface* device, const mip_time* /// //////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus +} // extern "C" } // namespace C } // namespace mip -} // extern "C" #endif // __cplusplus diff --git a/src/c/mip/definitions/commands_base.c b/src/c/mip/definitions/commands_base.c new file mode 100644 index 000000000..2fdd14628 --- /dev/null +++ b/src/c/mip/definitions/commands_base.c @@ -0,0 +1,355 @@ + +#include "commands_base.h" + +#include +#include + +#include + + +#ifdef __cplusplus +namespace mip { +namespace C { +extern "C" { + +#endif // __cplusplus + + +//////////////////////////////////////////////////////////////////////////////// +// Mip Fields +//////////////////////////////////////////////////////////////////////////////// + +void insert_mip_base_device_info(microstrain_serializer* serializer, const mip_base_device_info* self) +{ + microstrain_insert_u16(serializer, self->firmware_version); + + for(unsigned int i=0; i < 16; i++) + microstrain_insert_char(serializer, self->model_name[i]); + + for(unsigned int i=0; i < 16; i++) + microstrain_insert_char(serializer, self->model_number[i]); + + for(unsigned int i=0; i < 16; i++) + microstrain_insert_char(serializer, self->serial_number[i]); + + for(unsigned int i=0; i < 16; i++) + microstrain_insert_char(serializer, self->lot_number[i]); + + for(unsigned int i=0; i < 16; i++) + microstrain_insert_char(serializer, self->device_options[i]); + +} +void extract_mip_base_device_info(microstrain_serializer* serializer, mip_base_device_info* self) +{ + microstrain_extract_u16(serializer, &self->firmware_version); + + for(unsigned int i=0; i < 16; i++) + microstrain_extract_char(serializer, &self->model_name[i]); + + for(unsigned int i=0; i < 16; i++) + microstrain_extract_char(serializer, &self->model_number[i]); + + for(unsigned int i=0; i < 16; i++) + microstrain_extract_char(serializer, &self->serial_number[i]); + + for(unsigned int i=0; i < 16; i++) + microstrain_extract_char(serializer, &self->lot_number[i]); + + for(unsigned int i=0; i < 16; i++) + microstrain_extract_char(serializer, &self->device_options[i]); + +} + +mip_cmd_result mip_base_ping(mip_interface* device) +{ + return mip_interface_run_command(device, MIP_BASE_CMD_DESC_SET, MIP_CMD_DESC_BASE_PING, NULL, 0); +} +mip_cmd_result mip_base_set_idle(mip_interface* device) +{ + return mip_interface_run_command(device, MIP_BASE_CMD_DESC_SET, MIP_CMD_DESC_BASE_SET_TO_IDLE, NULL, 0); +} +mip_cmd_result mip_base_get_device_info(mip_interface* device, mip_base_device_info* device_info_out) +{ + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + uint8_t responseLength = sizeof(buffer); + + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_BASE_CMD_DESC_SET, MIP_CMD_DESC_BASE_GET_DEVICE_INFO, NULL, 0, MIP_REPLY_DESC_BASE_DEVICE_INFO, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(device_info_out); + extract_mip_base_device_info(&deserializer, device_info_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_base_get_device_descriptors(mip_interface* device, uint16_t* descriptors_out, size_t descriptors_out_max, uint8_t* descriptors_out_count) +{ + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + uint8_t responseLength = sizeof(buffer); + + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_BASE_CMD_DESC_SET, MIP_CMD_DESC_BASE_GET_DEVICE_DESCRIPTORS, NULL, 0, MIP_REPLY_DESC_BASE_DEVICE_DESCRIPTORS, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + for(*descriptors_out_count = 0; (*descriptors_out_count < descriptors_out_max) && (microstrain_serializer_remaining(&deserializer) > 0); (*descriptors_out_count)++) + microstrain_extract_u16(&deserializer, &descriptors_out[*descriptors_out_count]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_base_built_in_test(mip_interface* device, uint32_t* result_out) +{ + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + uint8_t responseLength = sizeof(buffer); + + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_BASE_CMD_DESC_SET, MIP_CMD_DESC_BASE_BUILT_IN_TEST, NULL, 0, MIP_REPLY_DESC_BASE_BUILT_IN_TEST, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(result_out); + microstrain_extract_u32(&deserializer, result_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_base_resume(mip_interface* device) +{ + return mip_interface_run_command(device, MIP_BASE_CMD_DESC_SET, MIP_CMD_DESC_BASE_RESUME, NULL, 0); +} +mip_cmd_result mip_base_get_extended_descriptors(mip_interface* device, uint16_t* descriptors_out, size_t descriptors_out_max, uint8_t* descriptors_out_count) +{ + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + uint8_t responseLength = sizeof(buffer); + + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_BASE_CMD_DESC_SET, MIP_CMD_DESC_BASE_GET_EXTENDED_DESCRIPTORS, NULL, 0, MIP_REPLY_DESC_BASE_GET_EXTENDED_DESCRIPTORS, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + for(*descriptors_out_count = 0; (*descriptors_out_count < descriptors_out_max) && (microstrain_serializer_remaining(&deserializer) > 0); (*descriptors_out_count)++) + microstrain_extract_u16(&deserializer, &descriptors_out[*descriptors_out_count]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_base_continuous_bit(mip_interface* device, uint8_t* result_out) +{ + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + uint8_t responseLength = sizeof(buffer); + + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_BASE_CMD_DESC_SET, MIP_CMD_DESC_BASE_CONTINUOUS_BIT, NULL, 0, MIP_REPLY_DESC_BASE_CONTINUOUS_BIT, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(result_out); + for(unsigned int i=0; i < 16; i++) + microstrain_extract_u8(&deserializer, &result_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +void insert_mip_base_comm_speed_command(microstrain_serializer* serializer, const mip_base_comm_speed_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + microstrain_insert_u8(serializer, self->port); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_u32(serializer, self->baud); + + } +} +void extract_mip_base_comm_speed_command(microstrain_serializer* serializer, mip_base_comm_speed_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + microstrain_extract_u8(serializer, &self->port); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_extract_u32(serializer, &self->baud); + + } +} + +void insert_mip_base_comm_speed_response(microstrain_serializer* serializer, const mip_base_comm_speed_response* self) +{ + microstrain_insert_u8(serializer, self->port); + + microstrain_insert_u32(serializer, self->baud); + +} +void extract_mip_base_comm_speed_response(microstrain_serializer* serializer, mip_base_comm_speed_response* self) +{ + microstrain_extract_u8(serializer, &self->port); + + microstrain_extract_u32(serializer, &self->baud); + +} + +mip_cmd_result mip_base_write_comm_speed(mip_interface* device, uint8_t port, uint32_t baud) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_u8(&serializer, port); + + microstrain_insert_u32(&serializer, baud); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_BASE_CMD_DESC_SET, MIP_CMD_DESC_BASE_COMM_SPEED, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_base_read_comm_speed(mip_interface* device, uint8_t port, uint32_t* baud_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + microstrain_insert_u8(&serializer, port); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_BASE_CMD_DESC_SET, MIP_CMD_DESC_BASE_COMM_SPEED, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_BASE_COMM_SPEED, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + microstrain_extract_u8(&deserializer, &port); + + assert(baud_out); + microstrain_extract_u32(&deserializer, baud_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_base_save_comm_speed(mip_interface* device, uint8_t port) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + microstrain_insert_u8(&serializer, port); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_BASE_CMD_DESC_SET, MIP_CMD_DESC_BASE_COMM_SPEED, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_base_load_comm_speed(mip_interface* device, uint8_t port) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + microstrain_insert_u8(&serializer, port); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_BASE_CMD_DESC_SET, MIP_CMD_DESC_BASE_COMM_SPEED, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_base_default_comm_speed(mip_interface* device, uint8_t port) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + microstrain_insert_u8(&serializer, port); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_BASE_CMD_DESC_SET, MIP_CMD_DESC_BASE_COMM_SPEED, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_base_gps_time_update_command(microstrain_serializer* serializer, const mip_base_gps_time_update_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_base_gps_time_update_command_field_id(serializer, self->field_id); + + microstrain_insert_u32(serializer, self->value); + + } +} +void extract_mip_base_gps_time_update_command(microstrain_serializer* serializer, mip_base_gps_time_update_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_base_gps_time_update_command_field_id(serializer, &self->field_id); + + microstrain_extract_u32(serializer, &self->value); + + } +} + +mip_cmd_result mip_base_write_gps_time_update(mip_interface* device, mip_base_gps_time_update_command_field_id field_id, uint32_t value) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + insert_mip_base_gps_time_update_command_field_id(&serializer, field_id); + + microstrain_insert_u32(&serializer, value); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_BASE_CMD_DESC_SET, MIP_CMD_DESC_BASE_GPS_TIME_UPDATE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_base_soft_reset(mip_interface* device) +{ + return mip_interface_run_command(device, MIP_BASE_CMD_DESC_SET, MIP_CMD_DESC_BASE_SOFT_RESET, NULL, 0); +} + +#ifdef __cplusplus +} // extern "C" +} // namespace C +} // namespace mip +#endif // __cplusplus + diff --git a/src/mip/definitions/commands_base.h b/src/c/mip/definitions/commands_base.h similarity index 62% rename from src/mip/definitions/commands_base.h rename to src/c/mip/definitions/commands_base.h index 6d30392c6..eda89b56a 100644 --- a/src/mip/definitions/commands_base.h +++ b/src/c/mip/definitions/commands_base.h @@ -1,8 +1,9 @@ #pragma once -#include "common.h" -#include "descriptors.h" -#include "../mip_result.h" +#include +#include +#include +#include #include #include @@ -14,14 +15,11 @@ namespace C { extern "C" { #endif // __cplusplus -struct mip_interface; -struct mip_serializer; -struct mip_field; //////////////////////////////////////////////////////////////////////////////// -///@addtogroup MipCommands_c MIP Commands [C] +///@addtogroup MipCommands_c ///@{ -///@defgroup base_commands_c Base Commands [C] +///@defgroup base_commands_c Base Commands /// ///@{ @@ -67,17 +65,28 @@ struct mip_base_device_info char serial_number[16]; char lot_number[16]; char device_options[16]; - }; typedef struct mip_base_device_info mip_base_device_info; -void insert_mip_base_device_info(struct mip_serializer* serializer, const mip_base_device_info* self); -void extract_mip_base_device_info(struct mip_serializer* serializer, mip_base_device_info* self); -typedef uint8_t mip_time_format; -static const mip_time_format MIP_TIME_FORMAT_GPS = 1; ///< GPS time, a = week number since 1980, b = time of week in milliseconds. +void insert_mip_base_device_info(microstrain_serializer* serializer, const mip_base_device_info* self); +void extract_mip_base_device_info(microstrain_serializer* serializer, mip_base_device_info* self); + +enum mip_time_format +{ + MIP_TIME_FORMAT_GPS = 1, ///< GPS time, a = week number since 1980, b = time of week in milliseconds. +}; +typedef enum mip_time_format mip_time_format; -void insert_mip_time_format(struct mip_serializer* serializer, const mip_time_format self); -void extract_mip_time_format(struct mip_serializer* serializer, mip_time_format* self); +static inline void insert_mip_time_format(microstrain_serializer* serializer, const mip_time_format self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_time_format(microstrain_serializer* serializer, mip_time_format* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} typedef uint32_t mip_commanded_test_bits_gq7; static const mip_commanded_test_bits_gq7 MIP_COMMANDED_TEST_BITS_GQ7_NONE = 0x00000000; @@ -109,9 +118,16 @@ static const mip_commanded_test_bits_gq7 MIP_COMMANDED_TEST_BITS_GQ7_GNSS_RTK_FA static const mip_commanded_test_bits_gq7 MIP_COMMANDED_TEST_BITS_GQ7_GNSS_SOLUTION_FAULT = 0x40000000; ///< static const mip_commanded_test_bits_gq7 MIP_COMMANDED_TEST_BITS_GQ7_GNSS_GENERAL_FAULT = 0x80000000; ///< static const mip_commanded_test_bits_gq7 MIP_COMMANDED_TEST_BITS_GQ7_ALL = 0xFFFFFFFF; - -void insert_mip_commanded_test_bits_gq7(struct mip_serializer* serializer, const mip_commanded_test_bits_gq7 self); -void extract_mip_commanded_test_bits_gq7(struct mip_serializer* serializer, mip_commanded_test_bits_gq7* self); +static inline void insert_mip_commanded_test_bits_gq7(microstrain_serializer* serializer, const mip_commanded_test_bits_gq7 self) +{ + microstrain_insert_u32(serializer, (uint32_t)(self)); +} +static inline void extract_mip_commanded_test_bits_gq7(microstrain_serializer* serializer, mip_commanded_test_bits_gq7* self) +{ + uint32_t tmp = 0; + microstrain_extract_u32(serializer, &tmp); + *self = tmp; +} //////////////////////////////////////////////////////////////////////////////// @@ -119,7 +135,7 @@ void extract_mip_commanded_test_bits_gq7(struct mip_serializer* serializer, mip_ //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_base_ping (0x01,0x01) Ping [C] +///@defgroup base_ping_c (0x01,0x01) Ping /// Test Communications with a device. /// /// The Device will respond with an ACK, if present and operating correctly. @@ -128,12 +144,14 @@ void extract_mip_commanded_test_bits_gq7(struct mip_serializer* serializer, mip_ /// ///@{ -mip_cmd_result mip_base_ping(struct mip_interface* device); +typedef struct mip_base_ping_command mip_base_ping_command; ///< No parameters (empty struct not allowed in C) + +mip_cmd_result mip_base_ping(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_base_set_idle (0x01,0x02) Set Idle [C] +///@defgroup base_set_idle_c (0x01,0x02) Set Idle /// Turn off all device data streams. /// /// The Device will respond with an ACK, if present and operating correctly. @@ -142,31 +160,35 @@ mip_cmd_result mip_base_ping(struct mip_interface* device); /// ///@{ -mip_cmd_result mip_base_set_idle(struct mip_interface* device); +typedef struct mip_base_set_idle_command mip_base_set_idle_command; ///< No parameters (empty struct not allowed in C) + +mip_cmd_result mip_base_set_idle(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_base_get_device_info (0x01,0x03) Get Device Info [C] +///@defgroup base_get_device_info_c (0x01,0x03) Get Device Info /// Get the device ID strings and firmware version number. /// ///@{ +typedef struct mip_base_get_device_info_command mip_base_get_device_info_command; ///< No parameters (empty struct not allowed in C) + struct mip_base_get_device_info_response { mip_base_device_info device_info; - }; typedef struct mip_base_get_device_info_response mip_base_get_device_info_response; -void insert_mip_base_get_device_info_response(struct mip_serializer* serializer, const mip_base_get_device_info_response* self); -void extract_mip_base_get_device_info_response(struct mip_serializer* serializer, mip_base_get_device_info_response* self); -mip_cmd_result mip_base_get_device_info(struct mip_interface* device, mip_base_device_info* device_info_out); +void insert_mip_base_get_device_info_response(microstrain_serializer* serializer, const mip_base_get_device_info_response* self); +void extract_mip_base_get_device_info_response(microstrain_serializer* serializer, mip_base_get_device_info_response* self); + +mip_cmd_result mip_base_get_device_info(mip_interface* device, mip_base_device_info* device_info_out); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_base_get_device_descriptors (0x01,0x04) Get Device Descriptors [C] +///@defgroup base_get_device_descriptors_c (0x01,0x04) Get Device Descriptors /// Get the command and data descriptors supported by the device. /// /// Reply has two fields: "ACK/NACK" and "Descriptors". The "Descriptors" field is an array of 16 bit values. @@ -174,22 +196,24 @@ mip_cmd_result mip_base_get_device_info(struct mip_interface* device, mip_base_d /// ///@{ +typedef struct mip_base_get_device_descriptors_command mip_base_get_device_descriptors_command; ///< No parameters (empty struct not allowed in C) + struct mip_base_get_device_descriptors_response { uint16_t descriptors[253]; uint8_t descriptors_count; - }; typedef struct mip_base_get_device_descriptors_response mip_base_get_device_descriptors_response; -void insert_mip_base_get_device_descriptors_response(struct mip_serializer* serializer, const mip_base_get_device_descriptors_response* self); -void extract_mip_base_get_device_descriptors_response(struct mip_serializer* serializer, mip_base_get_device_descriptors_response* self); -mip_cmd_result mip_base_get_device_descriptors(struct mip_interface* device, uint16_t* descriptors_out, size_t descriptors_out_max, uint8_t* descriptors_out_count); +void insert_mip_base_get_device_descriptors_response(microstrain_serializer* serializer, const mip_base_get_device_descriptors_response* self); +void extract_mip_base_get_device_descriptors_response(microstrain_serializer* serializer, mip_base_get_device_descriptors_response* self); + +mip_cmd_result mip_base_get_device_descriptors(mip_interface* device, uint16_t* descriptors_out, size_t descriptors_out_max, uint8_t* descriptors_out_count); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_base_built_in_test (0x01,0x05) Built In Test [C] +///@defgroup base_built_in_test_c (0x01,0x05) Built In Test /// Run the device Built-In Test (BIT). /// /// The Built-In Test command always returns a 32 bit value. @@ -199,33 +223,37 @@ mip_cmd_result mip_base_get_device_descriptors(struct mip_interface* device, uin /// ///@{ +typedef struct mip_base_built_in_test_command mip_base_built_in_test_command; ///< No parameters (empty struct not allowed in C) + struct mip_base_built_in_test_response { uint32_t result; - }; typedef struct mip_base_built_in_test_response mip_base_built_in_test_response; -void insert_mip_base_built_in_test_response(struct mip_serializer* serializer, const mip_base_built_in_test_response* self); -void extract_mip_base_built_in_test_response(struct mip_serializer* serializer, mip_base_built_in_test_response* self); -mip_cmd_result mip_base_built_in_test(struct mip_interface* device, uint32_t* result_out); +void insert_mip_base_built_in_test_response(microstrain_serializer* serializer, const mip_base_built_in_test_response* self); +void extract_mip_base_built_in_test_response(microstrain_serializer* serializer, mip_base_built_in_test_response* self); + +mip_cmd_result mip_base_built_in_test(mip_interface* device, uint32_t* result_out); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_base_resume (0x01,0x06) Resume [C] +///@defgroup base_resume_c (0x01,0x06) Resume /// Take the device out of idle mode. /// /// The device responds with ACK upon success. /// ///@{ -mip_cmd_result mip_base_resume(struct mip_interface* device); +typedef struct mip_base_resume_command mip_base_resume_command; ///< No parameters (empty struct not allowed in C) + +mip_cmd_result mip_base_resume(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_base_get_extended_descriptors (0x01,0x07) Get Extended Descriptors [C] +///@defgroup base_get_extended_descriptors_c (0x01,0x07) Get Extended Descriptors /// Get the command and data descriptors supported by the device. /// /// Reply has two fields: "ACK/NACK" and "Descriptors". The "Descriptors" field is an array of 16 bit values. @@ -233,43 +261,47 @@ mip_cmd_result mip_base_resume(struct mip_interface* device); /// ///@{ +typedef struct mip_base_get_extended_descriptors_command mip_base_get_extended_descriptors_command; ///< No parameters (empty struct not allowed in C) + struct mip_base_get_extended_descriptors_response { uint16_t descriptors[253]; uint8_t descriptors_count; - }; typedef struct mip_base_get_extended_descriptors_response mip_base_get_extended_descriptors_response; -void insert_mip_base_get_extended_descriptors_response(struct mip_serializer* serializer, const mip_base_get_extended_descriptors_response* self); -void extract_mip_base_get_extended_descriptors_response(struct mip_serializer* serializer, mip_base_get_extended_descriptors_response* self); -mip_cmd_result mip_base_get_extended_descriptors(struct mip_interface* device, uint16_t* descriptors_out, size_t descriptors_out_max, uint8_t* descriptors_out_count); +void insert_mip_base_get_extended_descriptors_response(microstrain_serializer* serializer, const mip_base_get_extended_descriptors_response* self); +void extract_mip_base_get_extended_descriptors_response(microstrain_serializer* serializer, mip_base_get_extended_descriptors_response* self); + +mip_cmd_result mip_base_get_extended_descriptors(mip_interface* device, uint16_t* descriptors_out, size_t descriptors_out_max, uint8_t* descriptors_out_count); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_base_continuous_bit (0x01,0x08) Continuous Bit [C] +///@defgroup base_continuous_bit_c (0x01,0x08) Continuous Bit /// Report result of continuous built-in test. /// /// This test is non-disruptive but is not as thorough as the commanded BIT. /// ///@{ +typedef struct mip_base_continuous_bit_command mip_base_continuous_bit_command; ///< No parameters (empty struct not allowed in C) + struct mip_base_continuous_bit_response { uint8_t result[16]; ///< Device-specific bitfield (128 bits). See device user manual. Bits are least-significant-byte first. For example, bit 0 is located at bit 0 of result[0], bit 1 is located at bit 1 of result[0], bit 8 is located at bit 0 of result[1], and bit 127 is located at bit 7 of result[15]. - }; typedef struct mip_base_continuous_bit_response mip_base_continuous_bit_response; -void insert_mip_base_continuous_bit_response(struct mip_serializer* serializer, const mip_base_continuous_bit_response* self); -void extract_mip_base_continuous_bit_response(struct mip_serializer* serializer, mip_base_continuous_bit_response* self); -mip_cmd_result mip_base_continuous_bit(struct mip_interface* device, uint8_t* result_out); +void insert_mip_base_continuous_bit_response(microstrain_serializer* serializer, const mip_base_continuous_bit_response* self); +void extract_mip_base_continuous_bit_response(microstrain_serializer* serializer, mip_base_continuous_bit_response* self); + +mip_cmd_result mip_base_continuous_bit(mip_interface* device, uint8_t* result_out); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_base_comm_speed (0x01,0x09) Comm Speed [C] +///@defgroup base_comm_speed_c (0x01,0x09) Comm Speed /// Controls the baud rate of a specific port on the device. /// /// Please see the device user manual for supported baud rates on each port. @@ -288,37 +320,38 @@ mip_cmd_result mip_base_continuous_bit(struct mip_interface* device, uint8_t* re ///@{ enum { MIP_BASE_COMM_SPEED_COMMAND_ALL_PORTS = 0 }; + struct mip_base_comm_speed_command { mip_function_selector function; uint8_t port; ///< Port ID number, starting with 1. When function is SAVE, LOAD, or DEFAULT, this can be 0 to apply to all ports. See the device user manual for details. uint32_t baud; ///< Port baud rate. Must be a supported rate. - }; typedef struct mip_base_comm_speed_command mip_base_comm_speed_command; -void insert_mip_base_comm_speed_command(struct mip_serializer* serializer, const mip_base_comm_speed_command* self); -void extract_mip_base_comm_speed_command(struct mip_serializer* serializer, mip_base_comm_speed_command* self); + +void insert_mip_base_comm_speed_command(microstrain_serializer* serializer, const mip_base_comm_speed_command* self); +void extract_mip_base_comm_speed_command(microstrain_serializer* serializer, mip_base_comm_speed_command* self); struct mip_base_comm_speed_response { uint8_t port; ///< Port ID number, starting with 1. When function is SAVE, LOAD, or DEFAULT, this can be 0 to apply to all ports. See the device user manual for details. uint32_t baud; ///< Port baud rate. Must be a supported rate. - }; typedef struct mip_base_comm_speed_response mip_base_comm_speed_response; -void insert_mip_base_comm_speed_response(struct mip_serializer* serializer, const mip_base_comm_speed_response* self); -void extract_mip_base_comm_speed_response(struct mip_serializer* serializer, mip_base_comm_speed_response* self); -mip_cmd_result mip_base_write_comm_speed(struct mip_interface* device, uint8_t port, uint32_t baud); -mip_cmd_result mip_base_read_comm_speed(struct mip_interface* device, uint8_t port, uint32_t* baud_out); -mip_cmd_result mip_base_save_comm_speed(struct mip_interface* device, uint8_t port); -mip_cmd_result mip_base_load_comm_speed(struct mip_interface* device, uint8_t port); -mip_cmd_result mip_base_default_comm_speed(struct mip_interface* device, uint8_t port); +void insert_mip_base_comm_speed_response(microstrain_serializer* serializer, const mip_base_comm_speed_response* self); +void extract_mip_base_comm_speed_response(microstrain_serializer* serializer, mip_base_comm_speed_response* self); + +mip_cmd_result mip_base_write_comm_speed(mip_interface* device, uint8_t port, uint32_t baud); +mip_cmd_result mip_base_read_comm_speed(mip_interface* device, uint8_t port, uint32_t* baud_out); +mip_cmd_result mip_base_save_comm_speed(mip_interface* device, uint8_t port); +mip_cmd_result mip_base_load_comm_speed(mip_interface* device, uint8_t port); +mip_cmd_result mip_base_default_comm_speed(mip_interface* device, uint8_t port); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_base_gps_time_update (0x01,0x72) Gps Time Update [C] +///@defgroup base_gps_time_update_c (0x01,0x72) Gps Time Update /// Set device internal GPS time /// When combined with a PPS input signal applied to the I/O connector, this command enables complete synchronization of data outputs /// with an external time base, such as GPS system time. Since the hardware PPS synchronization can only detect the fractional number of seconds when pulses arrive, @@ -326,37 +359,51 @@ mip_cmd_result mip_base_default_comm_speed(struct mip_interface* device, uint8_t /// ///@{ -typedef uint8_t mip_base_gps_time_update_command_field_id; -static const mip_base_gps_time_update_command_field_id MIP_BASE_GPS_TIME_UPDATE_COMMAND_FIELD_ID_WEEK_NUMBER = 1; ///< Week number. -static const mip_base_gps_time_update_command_field_id MIP_BASE_GPS_TIME_UPDATE_COMMAND_FIELD_ID_TIME_OF_WEEK = 2; ///< Time of week in seconds. +enum mip_base_gps_time_update_command_field_id +{ + MIP_BASE_GPS_TIME_UPDATE_COMMAND_FIELD_ID_WEEK_NUMBER = 1, ///< Week number. + MIP_BASE_GPS_TIME_UPDATE_COMMAND_FIELD_ID_TIME_OF_WEEK = 2, ///< Time of week in seconds. +}; +typedef enum mip_base_gps_time_update_command_field_id mip_base_gps_time_update_command_field_id; + +static inline void insert_mip_base_gps_time_update_command_field_id(microstrain_serializer* serializer, const mip_base_gps_time_update_command_field_id self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_base_gps_time_update_command_field_id(microstrain_serializer* serializer, mip_base_gps_time_update_command_field_id* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} + struct mip_base_gps_time_update_command { mip_function_selector function; mip_base_gps_time_update_command_field_id field_id; ///< Determines how to interpret value. uint32_t value; ///< Week number or time of week, depending on the field_id. - }; typedef struct mip_base_gps_time_update_command mip_base_gps_time_update_command; -void insert_mip_base_gps_time_update_command(struct mip_serializer* serializer, const mip_base_gps_time_update_command* self); -void extract_mip_base_gps_time_update_command(struct mip_serializer* serializer, mip_base_gps_time_update_command* self); -void insert_mip_base_gps_time_update_command_field_id(struct mip_serializer* serializer, const mip_base_gps_time_update_command_field_id self); -void extract_mip_base_gps_time_update_command_field_id(struct mip_serializer* serializer, mip_base_gps_time_update_command_field_id* self); +void insert_mip_base_gps_time_update_command(microstrain_serializer* serializer, const mip_base_gps_time_update_command* self); +void extract_mip_base_gps_time_update_command(microstrain_serializer* serializer, mip_base_gps_time_update_command* self); -mip_cmd_result mip_base_write_gps_time_update(struct mip_interface* device, mip_base_gps_time_update_command_field_id field_id, uint32_t value); +mip_cmd_result mip_base_write_gps_time_update(mip_interface* device, mip_base_gps_time_update_command_field_id field_id, uint32_t value); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_base_soft_reset (0x01,0x7E) Soft Reset [C] +///@defgroup base_soft_reset_c (0x01,0x7E) Soft Reset /// Resets the device. /// /// Device responds with ACK and immediately resets. /// ///@{ -mip_cmd_result mip_base_soft_reset(struct mip_interface* device); +typedef struct mip_base_soft_reset_command mip_base_soft_reset_command; ///< No parameters (empty struct not allowed in C) + +mip_cmd_result mip_base_soft_reset(mip_interface* device); ///@} /// @@ -366,8 +413,8 @@ mip_cmd_result mip_base_soft_reset(struct mip_interface* device); /// //////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus +} // extern "C" } // namespace C } // namespace mip -} // extern "C" #endif // __cplusplus diff --git a/src/c/mip/definitions/commands_filter.c b/src/c/mip/definitions/commands_filter.c new file mode 100644 index 000000000..92440e4d1 --- /dev/null +++ b/src/c/mip/definitions/commands_filter.c @@ -0,0 +1,5546 @@ + +#include "commands_filter.h" + +#include +#include + +#include + + +#ifdef __cplusplus +namespace mip { +namespace C { +extern "C" { + +#endif // __cplusplus + + +//////////////////////////////////////////////////////////////////////////////// +// Mip Fields +//////////////////////////////////////////////////////////////////////////////// + +mip_cmd_result mip_filter_reset(mip_interface* device) +{ + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_RESET_FILTER, NULL, 0); +} +void insert_mip_filter_set_initial_attitude_command(microstrain_serializer* serializer, const mip_filter_set_initial_attitude_command* self) +{ + microstrain_insert_float(serializer, self->roll); + + microstrain_insert_float(serializer, self->pitch); + + microstrain_insert_float(serializer, self->heading); + +} +void extract_mip_filter_set_initial_attitude_command(microstrain_serializer* serializer, mip_filter_set_initial_attitude_command* self) +{ + microstrain_extract_float(serializer, &self->roll); + + microstrain_extract_float(serializer, &self->pitch); + + microstrain_extract_float(serializer, &self->heading); + +} + +mip_cmd_result mip_filter_set_initial_attitude(mip_interface* device, float roll, float pitch, float heading) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + microstrain_insert_float(&serializer, roll); + + microstrain_insert_float(&serializer, pitch); + + microstrain_insert_float(&serializer, heading); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SET_INITIAL_ATTITUDE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_estimation_control_command(microstrain_serializer* serializer, const mip_filter_estimation_control_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_filter_estimation_control_command_enable_flags(serializer, self->enable); + + } +} +void extract_mip_filter_estimation_control_command(microstrain_serializer* serializer, mip_filter_estimation_control_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_filter_estimation_control_command_enable_flags(serializer, &self->enable); + + } +} + +void insert_mip_filter_estimation_control_response(microstrain_serializer* serializer, const mip_filter_estimation_control_response* self) +{ + insert_mip_filter_estimation_control_command_enable_flags(serializer, self->enable); + +} +void extract_mip_filter_estimation_control_response(microstrain_serializer* serializer, mip_filter_estimation_control_response* self) +{ + extract_mip_filter_estimation_control_command_enable_flags(serializer, &self->enable); + +} + +mip_cmd_result mip_filter_write_estimation_control(mip_interface* device, mip_filter_estimation_control_command_enable_flags enable) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + insert_mip_filter_estimation_control_command_enable_flags(&serializer, enable); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ESTIMATION_CONTROL_FLAGS, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_estimation_control(mip_interface* device, mip_filter_estimation_control_command_enable_flags* enable_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ESTIMATION_CONTROL_FLAGS, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_ESTIMATION_CONTROL_FLAGS, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(enable_out); + extract_mip_filter_estimation_control_command_enable_flags(&deserializer, enable_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_estimation_control(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ESTIMATION_CONTROL_FLAGS, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_estimation_control(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ESTIMATION_CONTROL_FLAGS, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_estimation_control(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ESTIMATION_CONTROL_FLAGS, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_external_gnss_update_command(microstrain_serializer* serializer, const mip_filter_external_gnss_update_command* self) +{ + microstrain_insert_double(serializer, self->gps_time); + + microstrain_insert_u16(serializer, self->gps_week); + + microstrain_insert_double(serializer, self->latitude); + + microstrain_insert_double(serializer, self->longitude); + + microstrain_insert_double(serializer, self->height); + + insert_mip_vector3f(serializer, self->velocity); + + insert_mip_vector3f(serializer, self->pos_uncertainty); + + insert_mip_vector3f(serializer, self->vel_uncertainty); + +} +void extract_mip_filter_external_gnss_update_command(microstrain_serializer* serializer, mip_filter_external_gnss_update_command* self) +{ + microstrain_extract_double(serializer, &self->gps_time); + + microstrain_extract_u16(serializer, &self->gps_week); + + microstrain_extract_double(serializer, &self->latitude); + + microstrain_extract_double(serializer, &self->longitude); + + microstrain_extract_double(serializer, &self->height); + + extract_mip_vector3f(serializer, self->velocity); + + extract_mip_vector3f(serializer, self->pos_uncertainty); + + extract_mip_vector3f(serializer, self->vel_uncertainty); + +} + +mip_cmd_result mip_filter_external_gnss_update(mip_interface* device, double gps_time, uint16_t gps_week, double latitude, double longitude, double height, const float* velocity, const float* pos_uncertainty, const float* vel_uncertainty) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + microstrain_insert_double(&serializer, gps_time); + + microstrain_insert_u16(&serializer, gps_week); + + microstrain_insert_double(&serializer, latitude); + + microstrain_insert_double(&serializer, longitude); + + microstrain_insert_double(&serializer, height); + + assert(velocity); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_float(&serializer, velocity[i]); + + assert(pos_uncertainty); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_float(&serializer, pos_uncertainty[i]); + + assert(vel_uncertainty); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_float(&serializer, vel_uncertainty[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_EXTERNAL_GNSS_UPDATE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_external_heading_update_command(microstrain_serializer* serializer, const mip_filter_external_heading_update_command* self) +{ + microstrain_insert_float(serializer, self->heading); + + microstrain_insert_float(serializer, self->heading_uncertainty); + + microstrain_insert_u8(serializer, self->type); + +} +void extract_mip_filter_external_heading_update_command(microstrain_serializer* serializer, mip_filter_external_heading_update_command* self) +{ + microstrain_extract_float(serializer, &self->heading); + + microstrain_extract_float(serializer, &self->heading_uncertainty); + + microstrain_extract_u8(serializer, &self->type); + +} + +mip_cmd_result mip_filter_external_heading_update(mip_interface* device, float heading, float heading_uncertainty, uint8_t type) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + microstrain_insert_float(&serializer, heading); + + microstrain_insert_float(&serializer, heading_uncertainty); + + microstrain_insert_u8(&serializer, type); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_EXTERNAL_HEADING_UPDATE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_external_heading_update_with_time_command(microstrain_serializer* serializer, const mip_filter_external_heading_update_with_time_command* self) +{ + microstrain_insert_double(serializer, self->gps_time); + + microstrain_insert_u16(serializer, self->gps_week); + + microstrain_insert_float(serializer, self->heading); + + microstrain_insert_float(serializer, self->heading_uncertainty); + + microstrain_insert_u8(serializer, self->type); + +} +void extract_mip_filter_external_heading_update_with_time_command(microstrain_serializer* serializer, mip_filter_external_heading_update_with_time_command* self) +{ + microstrain_extract_double(serializer, &self->gps_time); + + microstrain_extract_u16(serializer, &self->gps_week); + + microstrain_extract_float(serializer, &self->heading); + + microstrain_extract_float(serializer, &self->heading_uncertainty); + + microstrain_extract_u8(serializer, &self->type); + +} + +mip_cmd_result mip_filter_external_heading_update_with_time(mip_interface* device, double gps_time, uint16_t gps_week, float heading, float heading_uncertainty, uint8_t type) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + microstrain_insert_double(&serializer, gps_time); + + microstrain_insert_u16(&serializer, gps_week); + + microstrain_insert_float(&serializer, heading); + + microstrain_insert_float(&serializer, heading_uncertainty); + + microstrain_insert_u8(&serializer, type); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_EXTERNAL_HEADING_UPDATE_WITH_TIME, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_tare_orientation_command(microstrain_serializer* serializer, const mip_filter_tare_orientation_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_filter_tare_orientation_command_mip_tare_axes(serializer, self->axes); + + } +} +void extract_mip_filter_tare_orientation_command(microstrain_serializer* serializer, mip_filter_tare_orientation_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_filter_tare_orientation_command_mip_tare_axes(serializer, &self->axes); + + } +} + +void insert_mip_filter_tare_orientation_response(microstrain_serializer* serializer, const mip_filter_tare_orientation_response* self) +{ + insert_mip_filter_tare_orientation_command_mip_tare_axes(serializer, self->axes); + +} +void extract_mip_filter_tare_orientation_response(microstrain_serializer* serializer, mip_filter_tare_orientation_response* self) +{ + extract_mip_filter_tare_orientation_command_mip_tare_axes(serializer, &self->axes); + +} + +mip_cmd_result mip_filter_write_tare_orientation(mip_interface* device, mip_filter_tare_orientation_command_mip_tare_axes axes) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + insert_mip_filter_tare_orientation_command_mip_tare_axes(&serializer, axes); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_TARE_ORIENTATION, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_tare_orientation(mip_interface* device, mip_filter_tare_orientation_command_mip_tare_axes* axes_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_TARE_ORIENTATION, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_TARE_ORIENTATION, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(axes_out); + extract_mip_filter_tare_orientation_command_mip_tare_axes(&deserializer, axes_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_tare_orientation(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_TARE_ORIENTATION, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_tare_orientation(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_TARE_ORIENTATION, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_tare_orientation(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_TARE_ORIENTATION, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_vehicle_dynamics_mode_command(microstrain_serializer* serializer, const mip_filter_vehicle_dynamics_mode_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_filter_vehicle_dynamics_mode_command_dynamics_mode(serializer, self->mode); + + } +} +void extract_mip_filter_vehicle_dynamics_mode_command(microstrain_serializer* serializer, mip_filter_vehicle_dynamics_mode_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_filter_vehicle_dynamics_mode_command_dynamics_mode(serializer, &self->mode); + + } +} + +void insert_mip_filter_vehicle_dynamics_mode_response(microstrain_serializer* serializer, const mip_filter_vehicle_dynamics_mode_response* self) +{ + insert_mip_filter_vehicle_dynamics_mode_command_dynamics_mode(serializer, self->mode); + +} +void extract_mip_filter_vehicle_dynamics_mode_response(microstrain_serializer* serializer, mip_filter_vehicle_dynamics_mode_response* self) +{ + extract_mip_filter_vehicle_dynamics_mode_command_dynamics_mode(serializer, &self->mode); + +} + +mip_cmd_result mip_filter_write_vehicle_dynamics_mode(mip_interface* device, mip_filter_vehicle_dynamics_mode_command_dynamics_mode mode) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + insert_mip_filter_vehicle_dynamics_mode_command_dynamics_mode(&serializer, mode); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_VEHICLE_DYNAMICS_MODE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_vehicle_dynamics_mode(mip_interface* device, mip_filter_vehicle_dynamics_mode_command_dynamics_mode* mode_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_VEHICLE_DYNAMICS_MODE, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_VEHICLE_DYNAMICS_MODE, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(mode_out); + extract_mip_filter_vehicle_dynamics_mode_command_dynamics_mode(&deserializer, mode_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_vehicle_dynamics_mode(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_VEHICLE_DYNAMICS_MODE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_vehicle_dynamics_mode(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_VEHICLE_DYNAMICS_MODE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_vehicle_dynamics_mode(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_VEHICLE_DYNAMICS_MODE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_sensor_to_vehicle_rotation_euler_command(microstrain_serializer* serializer, const mip_filter_sensor_to_vehicle_rotation_euler_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_float(serializer, self->roll); + + microstrain_insert_float(serializer, self->pitch); + + microstrain_insert_float(serializer, self->yaw); + + } +} +void extract_mip_filter_sensor_to_vehicle_rotation_euler_command(microstrain_serializer* serializer, mip_filter_sensor_to_vehicle_rotation_euler_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_extract_float(serializer, &self->roll); + + microstrain_extract_float(serializer, &self->pitch); + + microstrain_extract_float(serializer, &self->yaw); + + } +} + +void insert_mip_filter_sensor_to_vehicle_rotation_euler_response(microstrain_serializer* serializer, const mip_filter_sensor_to_vehicle_rotation_euler_response* self) +{ + microstrain_insert_float(serializer, self->roll); + + microstrain_insert_float(serializer, self->pitch); + + microstrain_insert_float(serializer, self->yaw); + +} +void extract_mip_filter_sensor_to_vehicle_rotation_euler_response(microstrain_serializer* serializer, mip_filter_sensor_to_vehicle_rotation_euler_response* self) +{ + microstrain_extract_float(serializer, &self->roll); + + microstrain_extract_float(serializer, &self->pitch); + + microstrain_extract_float(serializer, &self->yaw); + +} + +mip_cmd_result mip_filter_write_sensor_to_vehicle_rotation_euler(mip_interface* device, float roll, float pitch, float yaw) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_float(&serializer, roll); + + microstrain_insert_float(&serializer, pitch); + + microstrain_insert_float(&serializer, yaw); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_ROTATION_EULER, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_sensor_to_vehicle_rotation_euler(mip_interface* device, float* roll_out, float* pitch_out, float* yaw_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_ROTATION_EULER, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_SENSOR2VEHICLE_ROTATION_EULER, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(roll_out); + microstrain_extract_float(&deserializer, roll_out); + + assert(pitch_out); + microstrain_extract_float(&deserializer, pitch_out); + + assert(yaw_out); + microstrain_extract_float(&deserializer, yaw_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_sensor_to_vehicle_rotation_euler(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_ROTATION_EULER, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_sensor_to_vehicle_rotation_euler(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_ROTATION_EULER, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_sensor_to_vehicle_rotation_euler(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_ROTATION_EULER, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_sensor_to_vehicle_rotation_dcm_command(microstrain_serializer* serializer, const mip_filter_sensor_to_vehicle_rotation_dcm_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_matrix3f(serializer, self->dcm); + + } +} +void extract_mip_filter_sensor_to_vehicle_rotation_dcm_command(microstrain_serializer* serializer, mip_filter_sensor_to_vehicle_rotation_dcm_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_matrix3f(serializer, self->dcm); + + } +} + +void insert_mip_filter_sensor_to_vehicle_rotation_dcm_response(microstrain_serializer* serializer, const mip_filter_sensor_to_vehicle_rotation_dcm_response* self) +{ + insert_mip_matrix3f(serializer, self->dcm); + +} +void extract_mip_filter_sensor_to_vehicle_rotation_dcm_response(microstrain_serializer* serializer, mip_filter_sensor_to_vehicle_rotation_dcm_response* self) +{ + extract_mip_matrix3f(serializer, self->dcm); + +} + +mip_cmd_result mip_filter_write_sensor_to_vehicle_rotation_dcm(mip_interface* device, const float* dcm) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + assert(dcm); + for(unsigned int i=0; i < 9; i++) + microstrain_insert_float(&serializer, dcm[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_ROTATION_DCM, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_sensor_to_vehicle_rotation_dcm(mip_interface* device, float* dcm_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_ROTATION_DCM, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_SENSOR2VEHICLE_ROTATION_DCM, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(dcm_out); + for(unsigned int i=0; i < 9; i++) + microstrain_extract_float(&deserializer, &dcm_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_sensor_to_vehicle_rotation_dcm(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_ROTATION_DCM, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_sensor_to_vehicle_rotation_dcm(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_ROTATION_DCM, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_sensor_to_vehicle_rotation_dcm(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_ROTATION_DCM, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_sensor_to_vehicle_rotation_quaternion_command(microstrain_serializer* serializer, const mip_filter_sensor_to_vehicle_rotation_quaternion_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_quatf(serializer, self->quat); + + } +} +void extract_mip_filter_sensor_to_vehicle_rotation_quaternion_command(microstrain_serializer* serializer, mip_filter_sensor_to_vehicle_rotation_quaternion_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_quatf(serializer, self->quat); + + } +} + +void insert_mip_filter_sensor_to_vehicle_rotation_quaternion_response(microstrain_serializer* serializer, const mip_filter_sensor_to_vehicle_rotation_quaternion_response* self) +{ + insert_mip_quatf(serializer, self->quat); + +} +void extract_mip_filter_sensor_to_vehicle_rotation_quaternion_response(microstrain_serializer* serializer, mip_filter_sensor_to_vehicle_rotation_quaternion_response* self) +{ + extract_mip_quatf(serializer, self->quat); + +} + +mip_cmd_result mip_filter_write_sensor_to_vehicle_rotation_quaternion(mip_interface* device, const float* quat) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + assert(quat); + for(unsigned int i=0; i < 4; i++) + microstrain_insert_float(&serializer, quat[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_ROTATION_QUATERNION, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_sensor_to_vehicle_rotation_quaternion(mip_interface* device, float* quat_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_ROTATION_QUATERNION, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_SENSOR2VEHICLE_ROTATION_QUATERNION, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(quat_out); + for(unsigned int i=0; i < 4; i++) + microstrain_extract_float(&deserializer, &quat_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_sensor_to_vehicle_rotation_quaternion(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_ROTATION_QUATERNION, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_sensor_to_vehicle_rotation_quaternion(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_ROTATION_QUATERNION, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_sensor_to_vehicle_rotation_quaternion(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_ROTATION_QUATERNION, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_sensor_to_vehicle_offset_command(microstrain_serializer* serializer, const mip_filter_sensor_to_vehicle_offset_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_vector3f(serializer, self->offset); + + } +} +void extract_mip_filter_sensor_to_vehicle_offset_command(microstrain_serializer* serializer, mip_filter_sensor_to_vehicle_offset_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_vector3f(serializer, self->offset); + + } +} + +void insert_mip_filter_sensor_to_vehicle_offset_response(microstrain_serializer* serializer, const mip_filter_sensor_to_vehicle_offset_response* self) +{ + insert_mip_vector3f(serializer, self->offset); + +} +void extract_mip_filter_sensor_to_vehicle_offset_response(microstrain_serializer* serializer, mip_filter_sensor_to_vehicle_offset_response* self) +{ + extract_mip_vector3f(serializer, self->offset); + +} + +mip_cmd_result mip_filter_write_sensor_to_vehicle_offset(mip_interface* device, const float* offset) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + assert(offset); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_float(&serializer, offset[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_OFFSET, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_sensor_to_vehicle_offset(mip_interface* device, float* offset_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_OFFSET, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_SENSOR2VEHICLE_OFFSET, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(offset_out); + for(unsigned int i=0; i < 3; i++) + microstrain_extract_float(&deserializer, &offset_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_sensor_to_vehicle_offset(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_OFFSET, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_sensor_to_vehicle_offset(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_OFFSET, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_sensor_to_vehicle_offset(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_OFFSET, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_antenna_offset_command(microstrain_serializer* serializer, const mip_filter_antenna_offset_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_vector3f(serializer, self->offset); + + } +} +void extract_mip_filter_antenna_offset_command(microstrain_serializer* serializer, mip_filter_antenna_offset_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_vector3f(serializer, self->offset); + + } +} + +void insert_mip_filter_antenna_offset_response(microstrain_serializer* serializer, const mip_filter_antenna_offset_response* self) +{ + insert_mip_vector3f(serializer, self->offset); + +} +void extract_mip_filter_antenna_offset_response(microstrain_serializer* serializer, mip_filter_antenna_offset_response* self) +{ + extract_mip_vector3f(serializer, self->offset); + +} + +mip_cmd_result mip_filter_write_antenna_offset(mip_interface* device, const float* offset) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + assert(offset); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_float(&serializer, offset[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ANTENNA_OFFSET, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_antenna_offset(mip_interface* device, float* offset_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ANTENNA_OFFSET, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_ANTENNA_OFFSET, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(offset_out); + for(unsigned int i=0; i < 3; i++) + microstrain_extract_float(&deserializer, &offset_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_antenna_offset(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ANTENNA_OFFSET, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_antenna_offset(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ANTENNA_OFFSET, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_antenna_offset(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ANTENNA_OFFSET, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_gnss_source_command(microstrain_serializer* serializer, const mip_filter_gnss_source_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_filter_gnss_source_command_source(serializer, self->source); + + } +} +void extract_mip_filter_gnss_source_command(microstrain_serializer* serializer, mip_filter_gnss_source_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_filter_gnss_source_command_source(serializer, &self->source); + + } +} + +void insert_mip_filter_gnss_source_response(microstrain_serializer* serializer, const mip_filter_gnss_source_response* self) +{ + insert_mip_filter_gnss_source_command_source(serializer, self->source); + +} +void extract_mip_filter_gnss_source_response(microstrain_serializer* serializer, mip_filter_gnss_source_response* self) +{ + extract_mip_filter_gnss_source_command_source(serializer, &self->source); + +} + +mip_cmd_result mip_filter_write_gnss_source(mip_interface* device, mip_filter_gnss_source_command_source source) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + insert_mip_filter_gnss_source_command_source(&serializer, source); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GNSS_SOURCE_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_gnss_source(mip_interface* device, mip_filter_gnss_source_command_source* source_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GNSS_SOURCE_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_GNSS_SOURCE_CONTROL, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(source_out); + extract_mip_filter_gnss_source_command_source(&deserializer, source_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_gnss_source(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GNSS_SOURCE_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_gnss_source(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GNSS_SOURCE_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_gnss_source(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GNSS_SOURCE_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_heading_source_command(microstrain_serializer* serializer, const mip_filter_heading_source_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_filter_heading_source_command_source(serializer, self->source); + + } +} +void extract_mip_filter_heading_source_command(microstrain_serializer* serializer, mip_filter_heading_source_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_filter_heading_source_command_source(serializer, &self->source); + + } +} + +void insert_mip_filter_heading_source_response(microstrain_serializer* serializer, const mip_filter_heading_source_response* self) +{ + insert_mip_filter_heading_source_command_source(serializer, self->source); + +} +void extract_mip_filter_heading_source_response(microstrain_serializer* serializer, mip_filter_heading_source_response* self) +{ + extract_mip_filter_heading_source_command_source(serializer, &self->source); + +} + +mip_cmd_result mip_filter_write_heading_source(mip_interface* device, mip_filter_heading_source_command_source source) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + insert_mip_filter_heading_source_command_source(&serializer, source); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_HEADING_UPDATE_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_heading_source(mip_interface* device, mip_filter_heading_source_command_source* source_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_HEADING_UPDATE_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_HEADING_UPDATE_CONTROL, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(source_out); + extract_mip_filter_heading_source_command_source(&deserializer, source_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_heading_source(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_HEADING_UPDATE_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_heading_source(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_HEADING_UPDATE_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_heading_source(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_HEADING_UPDATE_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_auto_init_control_command(microstrain_serializer* serializer, const mip_filter_auto_init_control_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_u8(serializer, self->enable); + + } +} +void extract_mip_filter_auto_init_control_command(microstrain_serializer* serializer, mip_filter_auto_init_control_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_extract_u8(serializer, &self->enable); + + } +} + +void insert_mip_filter_auto_init_control_response(microstrain_serializer* serializer, const mip_filter_auto_init_control_response* self) +{ + microstrain_insert_u8(serializer, self->enable); + +} +void extract_mip_filter_auto_init_control_response(microstrain_serializer* serializer, mip_filter_auto_init_control_response* self) +{ + microstrain_extract_u8(serializer, &self->enable); + +} + +mip_cmd_result mip_filter_write_auto_init_control(mip_interface* device, uint8_t enable) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_u8(&serializer, enable); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_AUTOINIT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_auto_init_control(mip_interface* device, uint8_t* enable_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_AUTOINIT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_AUTOINIT_CONTROL, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(enable_out); + microstrain_extract_u8(&deserializer, enable_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_auto_init_control(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_AUTOINIT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_auto_init_control(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_AUTOINIT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_auto_init_control(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_AUTOINIT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_accel_noise_command(microstrain_serializer* serializer, const mip_filter_accel_noise_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_vector3f(serializer, self->noise); + + } +} +void extract_mip_filter_accel_noise_command(microstrain_serializer* serializer, mip_filter_accel_noise_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_vector3f(serializer, self->noise); + + } +} + +void insert_mip_filter_accel_noise_response(microstrain_serializer* serializer, const mip_filter_accel_noise_response* self) +{ + insert_mip_vector3f(serializer, self->noise); + +} +void extract_mip_filter_accel_noise_response(microstrain_serializer* serializer, mip_filter_accel_noise_response* self) +{ + extract_mip_vector3f(serializer, self->noise); + +} + +mip_cmd_result mip_filter_write_accel_noise(mip_interface* device, const float* noise) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + assert(noise); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_float(&serializer, noise[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ACCEL_NOISE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_accel_noise(mip_interface* device, float* noise_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ACCEL_NOISE, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_ACCEL_NOISE, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(noise_out); + for(unsigned int i=0; i < 3; i++) + microstrain_extract_float(&deserializer, &noise_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_accel_noise(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ACCEL_NOISE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_accel_noise(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ACCEL_NOISE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_accel_noise(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ACCEL_NOISE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_gyro_noise_command(microstrain_serializer* serializer, const mip_filter_gyro_noise_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_vector3f(serializer, self->noise); + + } +} +void extract_mip_filter_gyro_noise_command(microstrain_serializer* serializer, mip_filter_gyro_noise_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_vector3f(serializer, self->noise); + + } +} + +void insert_mip_filter_gyro_noise_response(microstrain_serializer* serializer, const mip_filter_gyro_noise_response* self) +{ + insert_mip_vector3f(serializer, self->noise); + +} +void extract_mip_filter_gyro_noise_response(microstrain_serializer* serializer, mip_filter_gyro_noise_response* self) +{ + extract_mip_vector3f(serializer, self->noise); + +} + +mip_cmd_result mip_filter_write_gyro_noise(mip_interface* device, const float* noise) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + assert(noise); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_float(&serializer, noise[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GYRO_NOISE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_gyro_noise(mip_interface* device, float* noise_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GYRO_NOISE, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_GYRO_NOISE, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(noise_out); + for(unsigned int i=0; i < 3; i++) + microstrain_extract_float(&deserializer, &noise_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_gyro_noise(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GYRO_NOISE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_gyro_noise(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GYRO_NOISE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_gyro_noise(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GYRO_NOISE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_accel_bias_model_command(microstrain_serializer* serializer, const mip_filter_accel_bias_model_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_vector3f(serializer, self->beta); + + insert_mip_vector3f(serializer, self->noise); + + } +} +void extract_mip_filter_accel_bias_model_command(microstrain_serializer* serializer, mip_filter_accel_bias_model_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_vector3f(serializer, self->beta); + + extract_mip_vector3f(serializer, self->noise); + + } +} + +void insert_mip_filter_accel_bias_model_response(microstrain_serializer* serializer, const mip_filter_accel_bias_model_response* self) +{ + insert_mip_vector3f(serializer, self->beta); + + insert_mip_vector3f(serializer, self->noise); + +} +void extract_mip_filter_accel_bias_model_response(microstrain_serializer* serializer, mip_filter_accel_bias_model_response* self) +{ + extract_mip_vector3f(serializer, self->beta); + + extract_mip_vector3f(serializer, self->noise); + +} + +mip_cmd_result mip_filter_write_accel_bias_model(mip_interface* device, const float* beta, const float* noise) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + assert(beta); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_float(&serializer, beta[i]); + + assert(noise); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_float(&serializer, noise[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ACCEL_BIAS_MODEL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_accel_bias_model(mip_interface* device, float* beta_out, float* noise_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ACCEL_BIAS_MODEL, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_ACCEL_BIAS_MODEL, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(beta_out); + for(unsigned int i=0; i < 3; i++) + microstrain_extract_float(&deserializer, &beta_out[i]); + + assert(noise_out); + for(unsigned int i=0; i < 3; i++) + microstrain_extract_float(&deserializer, &noise_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_accel_bias_model(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ACCEL_BIAS_MODEL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_accel_bias_model(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ACCEL_BIAS_MODEL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_accel_bias_model(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ACCEL_BIAS_MODEL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_gyro_bias_model_command(microstrain_serializer* serializer, const mip_filter_gyro_bias_model_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_vector3f(serializer, self->beta); + + insert_mip_vector3f(serializer, self->noise); + + } +} +void extract_mip_filter_gyro_bias_model_command(microstrain_serializer* serializer, mip_filter_gyro_bias_model_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_vector3f(serializer, self->beta); + + extract_mip_vector3f(serializer, self->noise); + + } +} + +void insert_mip_filter_gyro_bias_model_response(microstrain_serializer* serializer, const mip_filter_gyro_bias_model_response* self) +{ + insert_mip_vector3f(serializer, self->beta); + + insert_mip_vector3f(serializer, self->noise); + +} +void extract_mip_filter_gyro_bias_model_response(microstrain_serializer* serializer, mip_filter_gyro_bias_model_response* self) +{ + extract_mip_vector3f(serializer, self->beta); + + extract_mip_vector3f(serializer, self->noise); + +} + +mip_cmd_result mip_filter_write_gyro_bias_model(mip_interface* device, const float* beta, const float* noise) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + assert(beta); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_float(&serializer, beta[i]); + + assert(noise); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_float(&serializer, noise[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GYRO_BIAS_MODEL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_gyro_bias_model(mip_interface* device, float* beta_out, float* noise_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GYRO_BIAS_MODEL, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_GYRO_BIAS_MODEL, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(beta_out); + for(unsigned int i=0; i < 3; i++) + microstrain_extract_float(&deserializer, &beta_out[i]); + + assert(noise_out); + for(unsigned int i=0; i < 3; i++) + microstrain_extract_float(&deserializer, &noise_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_gyro_bias_model(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GYRO_BIAS_MODEL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_gyro_bias_model(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GYRO_BIAS_MODEL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_gyro_bias_model(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GYRO_BIAS_MODEL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_altitude_aiding_command(microstrain_serializer* serializer, const mip_filter_altitude_aiding_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_filter_altitude_aiding_command_aiding_selector(serializer, self->selector); + + } +} +void extract_mip_filter_altitude_aiding_command(microstrain_serializer* serializer, mip_filter_altitude_aiding_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_filter_altitude_aiding_command_aiding_selector(serializer, &self->selector); + + } +} + +void insert_mip_filter_altitude_aiding_response(microstrain_serializer* serializer, const mip_filter_altitude_aiding_response* self) +{ + insert_mip_filter_altitude_aiding_command_aiding_selector(serializer, self->selector); + +} +void extract_mip_filter_altitude_aiding_response(microstrain_serializer* serializer, mip_filter_altitude_aiding_response* self) +{ + extract_mip_filter_altitude_aiding_command_aiding_selector(serializer, &self->selector); + +} + +mip_cmd_result mip_filter_write_altitude_aiding(mip_interface* device, mip_filter_altitude_aiding_command_aiding_selector selector) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + insert_mip_filter_altitude_aiding_command_aiding_selector(&serializer, selector); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ALTITUDE_AIDING_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_altitude_aiding(mip_interface* device, mip_filter_altitude_aiding_command_aiding_selector* selector_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ALTITUDE_AIDING_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_ALTITUDE_AIDING_CONTROL, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(selector_out); + extract_mip_filter_altitude_aiding_command_aiding_selector(&deserializer, selector_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_altitude_aiding(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ALTITUDE_AIDING_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_altitude_aiding(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ALTITUDE_AIDING_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_altitude_aiding(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ALTITUDE_AIDING_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_pitch_roll_aiding_command(microstrain_serializer* serializer, const mip_filter_pitch_roll_aiding_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_filter_pitch_roll_aiding_command_aiding_source(serializer, self->source); + + } +} +void extract_mip_filter_pitch_roll_aiding_command(microstrain_serializer* serializer, mip_filter_pitch_roll_aiding_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_filter_pitch_roll_aiding_command_aiding_source(serializer, &self->source); + + } +} + +void insert_mip_filter_pitch_roll_aiding_response(microstrain_serializer* serializer, const mip_filter_pitch_roll_aiding_response* self) +{ + insert_mip_filter_pitch_roll_aiding_command_aiding_source(serializer, self->source); + +} +void extract_mip_filter_pitch_roll_aiding_response(microstrain_serializer* serializer, mip_filter_pitch_roll_aiding_response* self) +{ + extract_mip_filter_pitch_roll_aiding_command_aiding_source(serializer, &self->source); + +} + +mip_cmd_result mip_filter_write_pitch_roll_aiding(mip_interface* device, mip_filter_pitch_roll_aiding_command_aiding_source source) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + insert_mip_filter_pitch_roll_aiding_command_aiding_source(&serializer, source); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SECONDARY_PITCH_ROLL_AIDING_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_pitch_roll_aiding(mip_interface* device, mip_filter_pitch_roll_aiding_command_aiding_source* source_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SECONDARY_PITCH_ROLL_AIDING_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_SECONDARY_PITCH_ROLL_AIDING_CONTROL, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(source_out); + extract_mip_filter_pitch_roll_aiding_command_aiding_source(&deserializer, source_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_pitch_roll_aiding(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SECONDARY_PITCH_ROLL_AIDING_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_pitch_roll_aiding(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SECONDARY_PITCH_ROLL_AIDING_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_pitch_roll_aiding(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SECONDARY_PITCH_ROLL_AIDING_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_auto_zupt_command(microstrain_serializer* serializer, const mip_filter_auto_zupt_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_u8(serializer, self->enable); + + microstrain_insert_float(serializer, self->threshold); + + } +} +void extract_mip_filter_auto_zupt_command(microstrain_serializer* serializer, mip_filter_auto_zupt_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_extract_u8(serializer, &self->enable); + + microstrain_extract_float(serializer, &self->threshold); + + } +} + +void insert_mip_filter_auto_zupt_response(microstrain_serializer* serializer, const mip_filter_auto_zupt_response* self) +{ + microstrain_insert_u8(serializer, self->enable); + + microstrain_insert_float(serializer, self->threshold); + +} +void extract_mip_filter_auto_zupt_response(microstrain_serializer* serializer, mip_filter_auto_zupt_response* self) +{ + microstrain_extract_u8(serializer, &self->enable); + + microstrain_extract_float(serializer, &self->threshold); + +} + +mip_cmd_result mip_filter_write_auto_zupt(mip_interface* device, uint8_t enable, float threshold) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_u8(&serializer, enable); + + microstrain_insert_float(&serializer, threshold); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ZUPT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_auto_zupt(mip_interface* device, uint8_t* enable_out, float* threshold_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ZUPT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_ZUPT_CONTROL, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(enable_out); + microstrain_extract_u8(&deserializer, enable_out); + + assert(threshold_out); + microstrain_extract_float(&deserializer, threshold_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_auto_zupt(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ZUPT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_auto_zupt(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ZUPT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_auto_zupt(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ZUPT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_auto_angular_zupt_command(microstrain_serializer* serializer, const mip_filter_auto_angular_zupt_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_u8(serializer, self->enable); + + microstrain_insert_float(serializer, self->threshold); + + } +} +void extract_mip_filter_auto_angular_zupt_command(microstrain_serializer* serializer, mip_filter_auto_angular_zupt_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_extract_u8(serializer, &self->enable); + + microstrain_extract_float(serializer, &self->threshold); + + } +} + +void insert_mip_filter_auto_angular_zupt_response(microstrain_serializer* serializer, const mip_filter_auto_angular_zupt_response* self) +{ + microstrain_insert_u8(serializer, self->enable); + + microstrain_insert_float(serializer, self->threshold); + +} +void extract_mip_filter_auto_angular_zupt_response(microstrain_serializer* serializer, mip_filter_auto_angular_zupt_response* self) +{ + microstrain_extract_u8(serializer, &self->enable); + + microstrain_extract_float(serializer, &self->threshold); + +} + +mip_cmd_result mip_filter_write_auto_angular_zupt(mip_interface* device, uint8_t enable, float threshold) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_u8(&serializer, enable); + + microstrain_insert_float(&serializer, threshold); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ANGULAR_ZUPT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_auto_angular_zupt(mip_interface* device, uint8_t* enable_out, float* threshold_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ANGULAR_ZUPT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_ANGULAR_ZUPT_CONTROL, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(enable_out); + microstrain_extract_u8(&deserializer, enable_out); + + assert(threshold_out); + microstrain_extract_float(&deserializer, threshold_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_auto_angular_zupt(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ANGULAR_ZUPT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_auto_angular_zupt(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ANGULAR_ZUPT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_auto_angular_zupt(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ANGULAR_ZUPT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_commanded_zupt(mip_interface* device) +{ + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_COMMANDED_ZUPT, NULL, 0); +} +mip_cmd_result mip_filter_commanded_angular_zupt(mip_interface* device) +{ + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_COMMANDED_ANGULAR_ZUPT, NULL, 0); +} +void insert_mip_filter_mag_capture_auto_cal_command(microstrain_serializer* serializer, const mip_filter_mag_capture_auto_cal_command* self) +{ + insert_mip_function_selector(serializer, self->function); + +} +void extract_mip_filter_mag_capture_auto_cal_command(microstrain_serializer* serializer, mip_filter_mag_capture_auto_cal_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + +} + +mip_cmd_result mip_filter_write_mag_capture_auto_cal(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAG_CAPTURE_AUTO_CALIBRATION, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_save_mag_capture_auto_cal(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAG_CAPTURE_AUTO_CALIBRATION, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_gravity_noise_command(microstrain_serializer* serializer, const mip_filter_gravity_noise_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_vector3f(serializer, self->noise); + + } +} +void extract_mip_filter_gravity_noise_command(microstrain_serializer* serializer, mip_filter_gravity_noise_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_vector3f(serializer, self->noise); + + } +} + +void insert_mip_filter_gravity_noise_response(microstrain_serializer* serializer, const mip_filter_gravity_noise_response* self) +{ + insert_mip_vector3f(serializer, self->noise); + +} +void extract_mip_filter_gravity_noise_response(microstrain_serializer* serializer, mip_filter_gravity_noise_response* self) +{ + extract_mip_vector3f(serializer, self->noise); + +} + +mip_cmd_result mip_filter_write_gravity_noise(mip_interface* device, const float* noise) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + assert(noise); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_float(&serializer, noise[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GRAVITY_NOISE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_gravity_noise(mip_interface* device, float* noise_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GRAVITY_NOISE, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_GRAVITY_NOISE, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(noise_out); + for(unsigned int i=0; i < 3; i++) + microstrain_extract_float(&deserializer, &noise_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_gravity_noise(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GRAVITY_NOISE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_gravity_noise(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GRAVITY_NOISE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_gravity_noise(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GRAVITY_NOISE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_pressure_altitude_noise_command(microstrain_serializer* serializer, const mip_filter_pressure_altitude_noise_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_float(serializer, self->noise); + + } +} +void extract_mip_filter_pressure_altitude_noise_command(microstrain_serializer* serializer, mip_filter_pressure_altitude_noise_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_extract_float(serializer, &self->noise); + + } +} + +void insert_mip_filter_pressure_altitude_noise_response(microstrain_serializer* serializer, const mip_filter_pressure_altitude_noise_response* self) +{ + microstrain_insert_float(serializer, self->noise); + +} +void extract_mip_filter_pressure_altitude_noise_response(microstrain_serializer* serializer, mip_filter_pressure_altitude_noise_response* self) +{ + microstrain_extract_float(serializer, &self->noise); + +} + +mip_cmd_result mip_filter_write_pressure_altitude_noise(mip_interface* device, float noise) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_float(&serializer, noise); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_PRESSURE_NOISE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_pressure_altitude_noise(mip_interface* device, float* noise_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_PRESSURE_NOISE, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_PRESSURE_NOISE, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(noise_out); + microstrain_extract_float(&deserializer, noise_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_pressure_altitude_noise(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_PRESSURE_NOISE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_pressure_altitude_noise(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_PRESSURE_NOISE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_pressure_altitude_noise(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_PRESSURE_NOISE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_hard_iron_offset_noise_command(microstrain_serializer* serializer, const mip_filter_hard_iron_offset_noise_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_vector3f(serializer, self->noise); + + } +} +void extract_mip_filter_hard_iron_offset_noise_command(microstrain_serializer* serializer, mip_filter_hard_iron_offset_noise_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_vector3f(serializer, self->noise); + + } +} + +void insert_mip_filter_hard_iron_offset_noise_response(microstrain_serializer* serializer, const mip_filter_hard_iron_offset_noise_response* self) +{ + insert_mip_vector3f(serializer, self->noise); + +} +void extract_mip_filter_hard_iron_offset_noise_response(microstrain_serializer* serializer, mip_filter_hard_iron_offset_noise_response* self) +{ + extract_mip_vector3f(serializer, self->noise); + +} + +mip_cmd_result mip_filter_write_hard_iron_offset_noise(mip_interface* device, const float* noise) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + assert(noise); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_float(&serializer, noise[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_HARD_IRON_OFFSET_NOISE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_hard_iron_offset_noise(mip_interface* device, float* noise_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_HARD_IRON_OFFSET_NOISE, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_HARD_IRON_OFFSET_NOISE, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(noise_out); + for(unsigned int i=0; i < 3; i++) + microstrain_extract_float(&deserializer, &noise_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_hard_iron_offset_noise(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_HARD_IRON_OFFSET_NOISE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_hard_iron_offset_noise(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_HARD_IRON_OFFSET_NOISE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_hard_iron_offset_noise(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_HARD_IRON_OFFSET_NOISE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_soft_iron_matrix_noise_command(microstrain_serializer* serializer, const mip_filter_soft_iron_matrix_noise_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_matrix3f(serializer, self->noise); + + } +} +void extract_mip_filter_soft_iron_matrix_noise_command(microstrain_serializer* serializer, mip_filter_soft_iron_matrix_noise_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_matrix3f(serializer, self->noise); + + } +} + +void insert_mip_filter_soft_iron_matrix_noise_response(microstrain_serializer* serializer, const mip_filter_soft_iron_matrix_noise_response* self) +{ + insert_mip_matrix3f(serializer, self->noise); + +} +void extract_mip_filter_soft_iron_matrix_noise_response(microstrain_serializer* serializer, mip_filter_soft_iron_matrix_noise_response* self) +{ + extract_mip_matrix3f(serializer, self->noise); + +} + +mip_cmd_result mip_filter_write_soft_iron_matrix_noise(mip_interface* device, const float* noise) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + assert(noise); + for(unsigned int i=0; i < 9; i++) + microstrain_insert_float(&serializer, noise[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SOFT_IRON_MATRIX_NOISE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_soft_iron_matrix_noise(mip_interface* device, float* noise_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SOFT_IRON_MATRIX_NOISE, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_SOFT_IRON_MATRIX_NOISE, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(noise_out); + for(unsigned int i=0; i < 9; i++) + microstrain_extract_float(&deserializer, &noise_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_soft_iron_matrix_noise(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SOFT_IRON_MATRIX_NOISE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_soft_iron_matrix_noise(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SOFT_IRON_MATRIX_NOISE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_soft_iron_matrix_noise(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SOFT_IRON_MATRIX_NOISE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_mag_noise_command(microstrain_serializer* serializer, const mip_filter_mag_noise_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_vector3f(serializer, self->noise); + + } +} +void extract_mip_filter_mag_noise_command(microstrain_serializer* serializer, mip_filter_mag_noise_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_vector3f(serializer, self->noise); + + } +} + +void insert_mip_filter_mag_noise_response(microstrain_serializer* serializer, const mip_filter_mag_noise_response* self) +{ + insert_mip_vector3f(serializer, self->noise); + +} +void extract_mip_filter_mag_noise_response(microstrain_serializer* serializer, mip_filter_mag_noise_response* self) +{ + extract_mip_vector3f(serializer, self->noise); + +} + +mip_cmd_result mip_filter_write_mag_noise(mip_interface* device, const float* noise) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + assert(noise); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_float(&serializer, noise[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAG_NOISE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_mag_noise(mip_interface* device, float* noise_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAG_NOISE, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_MAG_NOISE, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(noise_out); + for(unsigned int i=0; i < 3; i++) + microstrain_extract_float(&deserializer, &noise_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_mag_noise(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAG_NOISE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_mag_noise(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAG_NOISE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_mag_noise(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAG_NOISE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_inclination_source_command(microstrain_serializer* serializer, const mip_filter_inclination_source_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_filter_mag_param_source(serializer, self->source); + + microstrain_insert_float(serializer, self->inclination); + + } +} +void extract_mip_filter_inclination_source_command(microstrain_serializer* serializer, mip_filter_inclination_source_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_filter_mag_param_source(serializer, &self->source); + + microstrain_extract_float(serializer, &self->inclination); + + } +} + +void insert_mip_filter_inclination_source_response(microstrain_serializer* serializer, const mip_filter_inclination_source_response* self) +{ + insert_mip_filter_mag_param_source(serializer, self->source); + + microstrain_insert_float(serializer, self->inclination); + +} +void extract_mip_filter_inclination_source_response(microstrain_serializer* serializer, mip_filter_inclination_source_response* self) +{ + extract_mip_filter_mag_param_source(serializer, &self->source); + + microstrain_extract_float(serializer, &self->inclination); + +} + +mip_cmd_result mip_filter_write_inclination_source(mip_interface* device, mip_filter_mag_param_source source, float inclination) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + insert_mip_filter_mag_param_source(&serializer, source); + + microstrain_insert_float(&serializer, inclination); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_INCLINATION_SOURCE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_inclination_source(mip_interface* device, mip_filter_mag_param_source* source_out, float* inclination_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_INCLINATION_SOURCE, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_INCLINATION_SOURCE, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(source_out); + extract_mip_filter_mag_param_source(&deserializer, source_out); + + assert(inclination_out); + microstrain_extract_float(&deserializer, inclination_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_inclination_source(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_INCLINATION_SOURCE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_inclination_source(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_INCLINATION_SOURCE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_inclination_source(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_INCLINATION_SOURCE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_magnetic_declination_source_command(microstrain_serializer* serializer, const mip_filter_magnetic_declination_source_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_filter_mag_param_source(serializer, self->source); + + microstrain_insert_float(serializer, self->declination); + + } +} +void extract_mip_filter_magnetic_declination_source_command(microstrain_serializer* serializer, mip_filter_magnetic_declination_source_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_filter_mag_param_source(serializer, &self->source); + + microstrain_extract_float(serializer, &self->declination); + + } +} + +void insert_mip_filter_magnetic_declination_source_response(microstrain_serializer* serializer, const mip_filter_magnetic_declination_source_response* self) +{ + insert_mip_filter_mag_param_source(serializer, self->source); + + microstrain_insert_float(serializer, self->declination); + +} +void extract_mip_filter_magnetic_declination_source_response(microstrain_serializer* serializer, mip_filter_magnetic_declination_source_response* self) +{ + extract_mip_filter_mag_param_source(serializer, &self->source); + + microstrain_extract_float(serializer, &self->declination); + +} + +mip_cmd_result mip_filter_write_magnetic_declination_source(mip_interface* device, mip_filter_mag_param_source source, float declination) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + insert_mip_filter_mag_param_source(&serializer, source); + + microstrain_insert_float(&serializer, declination); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_DECLINATION_SOURCE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_magnetic_declination_source(mip_interface* device, mip_filter_mag_param_source* source_out, float* declination_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_DECLINATION_SOURCE, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_DECLINATION_SOURCE, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(source_out); + extract_mip_filter_mag_param_source(&deserializer, source_out); + + assert(declination_out); + microstrain_extract_float(&deserializer, declination_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_magnetic_declination_source(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_DECLINATION_SOURCE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_magnetic_declination_source(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_DECLINATION_SOURCE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_magnetic_declination_source(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_DECLINATION_SOURCE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_mag_field_magnitude_source_command(microstrain_serializer* serializer, const mip_filter_mag_field_magnitude_source_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_filter_mag_param_source(serializer, self->source); + + microstrain_insert_float(serializer, self->magnitude); + + } +} +void extract_mip_filter_mag_field_magnitude_source_command(microstrain_serializer* serializer, mip_filter_mag_field_magnitude_source_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_filter_mag_param_source(serializer, &self->source); + + microstrain_extract_float(serializer, &self->magnitude); + + } +} + +void insert_mip_filter_mag_field_magnitude_source_response(microstrain_serializer* serializer, const mip_filter_mag_field_magnitude_source_response* self) +{ + insert_mip_filter_mag_param_source(serializer, self->source); + + microstrain_insert_float(serializer, self->magnitude); + +} +void extract_mip_filter_mag_field_magnitude_source_response(microstrain_serializer* serializer, mip_filter_mag_field_magnitude_source_response* self) +{ + extract_mip_filter_mag_param_source(serializer, &self->source); + + microstrain_extract_float(serializer, &self->magnitude); + +} + +mip_cmd_result mip_filter_write_mag_field_magnitude_source(mip_interface* device, mip_filter_mag_param_source source, float magnitude) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + insert_mip_filter_mag_param_source(&serializer, source); + + microstrain_insert_float(&serializer, magnitude); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAGNETIC_MAGNITUDE_SOURCE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_mag_field_magnitude_source(mip_interface* device, mip_filter_mag_param_source* source_out, float* magnitude_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAGNETIC_MAGNITUDE_SOURCE, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_MAGNETIC_MAGNITUDE_SOURCE, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(source_out); + extract_mip_filter_mag_param_source(&deserializer, source_out); + + assert(magnitude_out); + microstrain_extract_float(&deserializer, magnitude_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_mag_field_magnitude_source(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAGNETIC_MAGNITUDE_SOURCE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_mag_field_magnitude_source(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAGNETIC_MAGNITUDE_SOURCE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_mag_field_magnitude_source(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAGNETIC_MAGNITUDE_SOURCE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_reference_position_command(microstrain_serializer* serializer, const mip_filter_reference_position_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_bool(serializer, self->enable); + + microstrain_insert_double(serializer, self->latitude); + + microstrain_insert_double(serializer, self->longitude); + + microstrain_insert_double(serializer, self->altitude); + + } +} +void extract_mip_filter_reference_position_command(microstrain_serializer* serializer, mip_filter_reference_position_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_extract_bool(serializer, &self->enable); + + microstrain_extract_double(serializer, &self->latitude); + + microstrain_extract_double(serializer, &self->longitude); + + microstrain_extract_double(serializer, &self->altitude); + + } +} + +void insert_mip_filter_reference_position_response(microstrain_serializer* serializer, const mip_filter_reference_position_response* self) +{ + microstrain_insert_bool(serializer, self->enable); + + microstrain_insert_double(serializer, self->latitude); + + microstrain_insert_double(serializer, self->longitude); + + microstrain_insert_double(serializer, self->altitude); + +} +void extract_mip_filter_reference_position_response(microstrain_serializer* serializer, mip_filter_reference_position_response* self) +{ + microstrain_extract_bool(serializer, &self->enable); + + microstrain_extract_double(serializer, &self->latitude); + + microstrain_extract_double(serializer, &self->longitude); + + microstrain_extract_double(serializer, &self->altitude); + +} + +mip_cmd_result mip_filter_write_reference_position(mip_interface* device, bool enable, double latitude, double longitude, double altitude) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_bool(&serializer, enable); + + microstrain_insert_double(&serializer, latitude); + + microstrain_insert_double(&serializer, longitude); + + microstrain_insert_double(&serializer, altitude); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_REFERENCE_POSITION, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_reference_position(mip_interface* device, bool* enable_out, double* latitude_out, double* longitude_out, double* altitude_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_REFERENCE_POSITION, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_REFERENCE_POSITION, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(enable_out); + microstrain_extract_bool(&deserializer, enable_out); + + assert(latitude_out); + microstrain_extract_double(&deserializer, latitude_out); + + assert(longitude_out); + microstrain_extract_double(&deserializer, longitude_out); + + assert(altitude_out); + microstrain_extract_double(&deserializer, altitude_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_reference_position(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_REFERENCE_POSITION, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_reference_position(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_REFERENCE_POSITION, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_reference_position(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_REFERENCE_POSITION, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_accel_magnitude_error_adaptive_measurement_command(microstrain_serializer* serializer, const mip_filter_accel_magnitude_error_adaptive_measurement_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_filter_adaptive_measurement(serializer, self->adaptive_measurement); + + microstrain_insert_float(serializer, self->frequency); + + microstrain_insert_float(serializer, self->low_limit); + + microstrain_insert_float(serializer, self->high_limit); + + microstrain_insert_float(serializer, self->low_limit_uncertainty); + + microstrain_insert_float(serializer, self->high_limit_uncertainty); + + microstrain_insert_float(serializer, self->minimum_uncertainty); + + } +} +void extract_mip_filter_accel_magnitude_error_adaptive_measurement_command(microstrain_serializer* serializer, mip_filter_accel_magnitude_error_adaptive_measurement_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_filter_adaptive_measurement(serializer, &self->adaptive_measurement); + + microstrain_extract_float(serializer, &self->frequency); + + microstrain_extract_float(serializer, &self->low_limit); + + microstrain_extract_float(serializer, &self->high_limit); + + microstrain_extract_float(serializer, &self->low_limit_uncertainty); + + microstrain_extract_float(serializer, &self->high_limit_uncertainty); + + microstrain_extract_float(serializer, &self->minimum_uncertainty); + + } +} + +void insert_mip_filter_accel_magnitude_error_adaptive_measurement_response(microstrain_serializer* serializer, const mip_filter_accel_magnitude_error_adaptive_measurement_response* self) +{ + insert_mip_filter_adaptive_measurement(serializer, self->adaptive_measurement); + + microstrain_insert_float(serializer, self->frequency); + + microstrain_insert_float(serializer, self->low_limit); + + microstrain_insert_float(serializer, self->high_limit); + + microstrain_insert_float(serializer, self->low_limit_uncertainty); + + microstrain_insert_float(serializer, self->high_limit_uncertainty); + + microstrain_insert_float(serializer, self->minimum_uncertainty); + +} +void extract_mip_filter_accel_magnitude_error_adaptive_measurement_response(microstrain_serializer* serializer, mip_filter_accel_magnitude_error_adaptive_measurement_response* self) +{ + extract_mip_filter_adaptive_measurement(serializer, &self->adaptive_measurement); + + microstrain_extract_float(serializer, &self->frequency); + + microstrain_extract_float(serializer, &self->low_limit); + + microstrain_extract_float(serializer, &self->high_limit); + + microstrain_extract_float(serializer, &self->low_limit_uncertainty); + + microstrain_extract_float(serializer, &self->high_limit_uncertainty); + + microstrain_extract_float(serializer, &self->minimum_uncertainty); + +} + +mip_cmd_result mip_filter_write_accel_magnitude_error_adaptive_measurement(mip_interface* device, mip_filter_adaptive_measurement adaptive_measurement, float frequency, float low_limit, float high_limit, float low_limit_uncertainty, float high_limit_uncertainty, float minimum_uncertainty) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + insert_mip_filter_adaptive_measurement(&serializer, adaptive_measurement); + + microstrain_insert_float(&serializer, frequency); + + microstrain_insert_float(&serializer, low_limit); + + microstrain_insert_float(&serializer, high_limit); + + microstrain_insert_float(&serializer, low_limit_uncertainty); + + microstrain_insert_float(&serializer, high_limit_uncertainty); + + microstrain_insert_float(&serializer, minimum_uncertainty); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ACCEL_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_accel_magnitude_error_adaptive_measurement(mip_interface* device, mip_filter_adaptive_measurement* adaptive_measurement_out, float* frequency_out, float* low_limit_out, float* high_limit_out, float* low_limit_uncertainty_out, float* high_limit_uncertainty_out, float* minimum_uncertainty_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ACCEL_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_ACCEL_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(adaptive_measurement_out); + extract_mip_filter_adaptive_measurement(&deserializer, adaptive_measurement_out); + + assert(frequency_out); + microstrain_extract_float(&deserializer, frequency_out); + + assert(low_limit_out); + microstrain_extract_float(&deserializer, low_limit_out); + + assert(high_limit_out); + microstrain_extract_float(&deserializer, high_limit_out); + + assert(low_limit_uncertainty_out); + microstrain_extract_float(&deserializer, low_limit_uncertainty_out); + + assert(high_limit_uncertainty_out); + microstrain_extract_float(&deserializer, high_limit_uncertainty_out); + + assert(minimum_uncertainty_out); + microstrain_extract_float(&deserializer, minimum_uncertainty_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_accel_magnitude_error_adaptive_measurement(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ACCEL_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_accel_magnitude_error_adaptive_measurement(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ACCEL_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_accel_magnitude_error_adaptive_measurement(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ACCEL_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_mag_magnitude_error_adaptive_measurement_command(microstrain_serializer* serializer, const mip_filter_mag_magnitude_error_adaptive_measurement_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_filter_adaptive_measurement(serializer, self->adaptive_measurement); + + microstrain_insert_float(serializer, self->frequency); + + microstrain_insert_float(serializer, self->low_limit); + + microstrain_insert_float(serializer, self->high_limit); + + microstrain_insert_float(serializer, self->low_limit_uncertainty); + + microstrain_insert_float(serializer, self->high_limit_uncertainty); + + microstrain_insert_float(serializer, self->minimum_uncertainty); + + } +} +void extract_mip_filter_mag_magnitude_error_adaptive_measurement_command(microstrain_serializer* serializer, mip_filter_mag_magnitude_error_adaptive_measurement_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_filter_adaptive_measurement(serializer, &self->adaptive_measurement); + + microstrain_extract_float(serializer, &self->frequency); + + microstrain_extract_float(serializer, &self->low_limit); + + microstrain_extract_float(serializer, &self->high_limit); + + microstrain_extract_float(serializer, &self->low_limit_uncertainty); + + microstrain_extract_float(serializer, &self->high_limit_uncertainty); + + microstrain_extract_float(serializer, &self->minimum_uncertainty); + + } +} + +void insert_mip_filter_mag_magnitude_error_adaptive_measurement_response(microstrain_serializer* serializer, const mip_filter_mag_magnitude_error_adaptive_measurement_response* self) +{ + insert_mip_filter_adaptive_measurement(serializer, self->adaptive_measurement); + + microstrain_insert_float(serializer, self->frequency); + + microstrain_insert_float(serializer, self->low_limit); + + microstrain_insert_float(serializer, self->high_limit); + + microstrain_insert_float(serializer, self->low_limit_uncertainty); + + microstrain_insert_float(serializer, self->high_limit_uncertainty); + + microstrain_insert_float(serializer, self->minimum_uncertainty); + +} +void extract_mip_filter_mag_magnitude_error_adaptive_measurement_response(microstrain_serializer* serializer, mip_filter_mag_magnitude_error_adaptive_measurement_response* self) +{ + extract_mip_filter_adaptive_measurement(serializer, &self->adaptive_measurement); + + microstrain_extract_float(serializer, &self->frequency); + + microstrain_extract_float(serializer, &self->low_limit); + + microstrain_extract_float(serializer, &self->high_limit); + + microstrain_extract_float(serializer, &self->low_limit_uncertainty); + + microstrain_extract_float(serializer, &self->high_limit_uncertainty); + + microstrain_extract_float(serializer, &self->minimum_uncertainty); + +} + +mip_cmd_result mip_filter_write_mag_magnitude_error_adaptive_measurement(mip_interface* device, mip_filter_adaptive_measurement adaptive_measurement, float frequency, float low_limit, float high_limit, float low_limit_uncertainty, float high_limit_uncertainty, float minimum_uncertainty) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + insert_mip_filter_adaptive_measurement(&serializer, adaptive_measurement); + + microstrain_insert_float(&serializer, frequency); + + microstrain_insert_float(&serializer, low_limit); + + microstrain_insert_float(&serializer, high_limit); + + microstrain_insert_float(&serializer, low_limit_uncertainty); + + microstrain_insert_float(&serializer, high_limit_uncertainty); + + microstrain_insert_float(&serializer, minimum_uncertainty); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAG_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_mag_magnitude_error_adaptive_measurement(mip_interface* device, mip_filter_adaptive_measurement* adaptive_measurement_out, float* frequency_out, float* low_limit_out, float* high_limit_out, float* low_limit_uncertainty_out, float* high_limit_uncertainty_out, float* minimum_uncertainty_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAG_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_MAG_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(adaptive_measurement_out); + extract_mip_filter_adaptive_measurement(&deserializer, adaptive_measurement_out); + + assert(frequency_out); + microstrain_extract_float(&deserializer, frequency_out); + + assert(low_limit_out); + microstrain_extract_float(&deserializer, low_limit_out); + + assert(high_limit_out); + microstrain_extract_float(&deserializer, high_limit_out); + + assert(low_limit_uncertainty_out); + microstrain_extract_float(&deserializer, low_limit_uncertainty_out); + + assert(high_limit_uncertainty_out); + microstrain_extract_float(&deserializer, high_limit_uncertainty_out); + + assert(minimum_uncertainty_out); + microstrain_extract_float(&deserializer, minimum_uncertainty_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_mag_magnitude_error_adaptive_measurement(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAG_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_mag_magnitude_error_adaptive_measurement(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAG_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_mag_magnitude_error_adaptive_measurement(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAG_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_mag_dip_angle_error_adaptive_measurement_command(microstrain_serializer* serializer, const mip_filter_mag_dip_angle_error_adaptive_measurement_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_bool(serializer, self->enable); + + microstrain_insert_float(serializer, self->frequency); + + microstrain_insert_float(serializer, self->high_limit); + + microstrain_insert_float(serializer, self->high_limit_uncertainty); + + microstrain_insert_float(serializer, self->minimum_uncertainty); + + } +} +void extract_mip_filter_mag_dip_angle_error_adaptive_measurement_command(microstrain_serializer* serializer, mip_filter_mag_dip_angle_error_adaptive_measurement_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_extract_bool(serializer, &self->enable); + + microstrain_extract_float(serializer, &self->frequency); + + microstrain_extract_float(serializer, &self->high_limit); + + microstrain_extract_float(serializer, &self->high_limit_uncertainty); + + microstrain_extract_float(serializer, &self->minimum_uncertainty); + + } +} + +void insert_mip_filter_mag_dip_angle_error_adaptive_measurement_response(microstrain_serializer* serializer, const mip_filter_mag_dip_angle_error_adaptive_measurement_response* self) +{ + microstrain_insert_bool(serializer, self->enable); + + microstrain_insert_float(serializer, self->frequency); + + microstrain_insert_float(serializer, self->high_limit); + + microstrain_insert_float(serializer, self->high_limit_uncertainty); + + microstrain_insert_float(serializer, self->minimum_uncertainty); + +} +void extract_mip_filter_mag_dip_angle_error_adaptive_measurement_response(microstrain_serializer* serializer, mip_filter_mag_dip_angle_error_adaptive_measurement_response* self) +{ + microstrain_extract_bool(serializer, &self->enable); + + microstrain_extract_float(serializer, &self->frequency); + + microstrain_extract_float(serializer, &self->high_limit); + + microstrain_extract_float(serializer, &self->high_limit_uncertainty); + + microstrain_extract_float(serializer, &self->minimum_uncertainty); + +} + +mip_cmd_result mip_filter_write_mag_dip_angle_error_adaptive_measurement(mip_interface* device, bool enable, float frequency, float high_limit, float high_limit_uncertainty, float minimum_uncertainty) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_bool(&serializer, enable); + + microstrain_insert_float(&serializer, frequency); + + microstrain_insert_float(&serializer, high_limit); + + microstrain_insert_float(&serializer, high_limit_uncertainty); + + microstrain_insert_float(&serializer, minimum_uncertainty); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAG_DIP_ANGLE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_mag_dip_angle_error_adaptive_measurement(mip_interface* device, bool* enable_out, float* frequency_out, float* high_limit_out, float* high_limit_uncertainty_out, float* minimum_uncertainty_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAG_DIP_ANGLE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_MAG_DIP_ANGLE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(enable_out); + microstrain_extract_bool(&deserializer, enable_out); + + assert(frequency_out); + microstrain_extract_float(&deserializer, frequency_out); + + assert(high_limit_out); + microstrain_extract_float(&deserializer, high_limit_out); + + assert(high_limit_uncertainty_out); + microstrain_extract_float(&deserializer, high_limit_uncertainty_out); + + assert(minimum_uncertainty_out); + microstrain_extract_float(&deserializer, minimum_uncertainty_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_mag_dip_angle_error_adaptive_measurement(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAG_DIP_ANGLE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_mag_dip_angle_error_adaptive_measurement(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAG_DIP_ANGLE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_mag_dip_angle_error_adaptive_measurement(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAG_DIP_ANGLE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_aiding_measurement_enable_command(microstrain_serializer* serializer, const mip_filter_aiding_measurement_enable_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + insert_mip_filter_aiding_measurement_enable_command_aiding_source(serializer, self->aiding_source); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_bool(serializer, self->enable); + + } +} +void extract_mip_filter_aiding_measurement_enable_command(microstrain_serializer* serializer, mip_filter_aiding_measurement_enable_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + extract_mip_filter_aiding_measurement_enable_command_aiding_source(serializer, &self->aiding_source); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_extract_bool(serializer, &self->enable); + + } +} + +void insert_mip_filter_aiding_measurement_enable_response(microstrain_serializer* serializer, const mip_filter_aiding_measurement_enable_response* self) +{ + insert_mip_filter_aiding_measurement_enable_command_aiding_source(serializer, self->aiding_source); + + microstrain_insert_bool(serializer, self->enable); + +} +void extract_mip_filter_aiding_measurement_enable_response(microstrain_serializer* serializer, mip_filter_aiding_measurement_enable_response* self) +{ + extract_mip_filter_aiding_measurement_enable_command_aiding_source(serializer, &self->aiding_source); + + microstrain_extract_bool(serializer, &self->enable); + +} + +mip_cmd_result mip_filter_write_aiding_measurement_enable(mip_interface* device, mip_filter_aiding_measurement_enable_command_aiding_source aiding_source, bool enable) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + insert_mip_filter_aiding_measurement_enable_command_aiding_source(&serializer, aiding_source); + + microstrain_insert_bool(&serializer, enable); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_AIDING_MEASUREMENT_ENABLE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_aiding_measurement_enable(mip_interface* device, mip_filter_aiding_measurement_enable_command_aiding_source aiding_source, bool* enable_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + insert_mip_filter_aiding_measurement_enable_command_aiding_source(&serializer, aiding_source); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_AIDING_MEASUREMENT_ENABLE, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_AIDING_MEASUREMENT_ENABLE, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + extract_mip_filter_aiding_measurement_enable_command_aiding_source(&deserializer, &aiding_source); + + assert(enable_out); + microstrain_extract_bool(&deserializer, enable_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_aiding_measurement_enable(mip_interface* device, mip_filter_aiding_measurement_enable_command_aiding_source aiding_source) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + insert_mip_filter_aiding_measurement_enable_command_aiding_source(&serializer, aiding_source); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_AIDING_MEASUREMENT_ENABLE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_aiding_measurement_enable(mip_interface* device, mip_filter_aiding_measurement_enable_command_aiding_source aiding_source) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + insert_mip_filter_aiding_measurement_enable_command_aiding_source(&serializer, aiding_source); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_AIDING_MEASUREMENT_ENABLE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_aiding_measurement_enable(mip_interface* device, mip_filter_aiding_measurement_enable_command_aiding_source aiding_source) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + insert_mip_filter_aiding_measurement_enable_command_aiding_source(&serializer, aiding_source); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_AIDING_MEASUREMENT_ENABLE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_run(mip_interface* device) +{ + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_RUN, NULL, 0); +} +void insert_mip_filter_kinematic_constraint_command(microstrain_serializer* serializer, const mip_filter_kinematic_constraint_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_u8(serializer, self->acceleration_constraint_selection); + + microstrain_insert_u8(serializer, self->velocity_constraint_selection); + + microstrain_insert_u8(serializer, self->angular_constraint_selection); + + } +} +void extract_mip_filter_kinematic_constraint_command(microstrain_serializer* serializer, mip_filter_kinematic_constraint_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_extract_u8(serializer, &self->acceleration_constraint_selection); + + microstrain_extract_u8(serializer, &self->velocity_constraint_selection); + + microstrain_extract_u8(serializer, &self->angular_constraint_selection); + + } +} + +void insert_mip_filter_kinematic_constraint_response(microstrain_serializer* serializer, const mip_filter_kinematic_constraint_response* self) +{ + microstrain_insert_u8(serializer, self->acceleration_constraint_selection); + + microstrain_insert_u8(serializer, self->velocity_constraint_selection); + + microstrain_insert_u8(serializer, self->angular_constraint_selection); + +} +void extract_mip_filter_kinematic_constraint_response(microstrain_serializer* serializer, mip_filter_kinematic_constraint_response* self) +{ + microstrain_extract_u8(serializer, &self->acceleration_constraint_selection); + + microstrain_extract_u8(serializer, &self->velocity_constraint_selection); + + microstrain_extract_u8(serializer, &self->angular_constraint_selection); + +} + +mip_cmd_result mip_filter_write_kinematic_constraint(mip_interface* device, uint8_t acceleration_constraint_selection, uint8_t velocity_constraint_selection, uint8_t angular_constraint_selection) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_u8(&serializer, acceleration_constraint_selection); + + microstrain_insert_u8(&serializer, velocity_constraint_selection); + + microstrain_insert_u8(&serializer, angular_constraint_selection); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_KINEMATIC_CONSTRAINT, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_kinematic_constraint(mip_interface* device, uint8_t* acceleration_constraint_selection_out, uint8_t* velocity_constraint_selection_out, uint8_t* angular_constraint_selection_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_KINEMATIC_CONSTRAINT, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_KINEMATIC_CONSTRAINT, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(acceleration_constraint_selection_out); + microstrain_extract_u8(&deserializer, acceleration_constraint_selection_out); + + assert(velocity_constraint_selection_out); + microstrain_extract_u8(&deserializer, velocity_constraint_selection_out); + + assert(angular_constraint_selection_out); + microstrain_extract_u8(&deserializer, angular_constraint_selection_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_kinematic_constraint(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_KINEMATIC_CONSTRAINT, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_kinematic_constraint(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_KINEMATIC_CONSTRAINT, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_kinematic_constraint(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_KINEMATIC_CONSTRAINT, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_initialization_configuration_command(microstrain_serializer* serializer, const mip_filter_initialization_configuration_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_u8(serializer, self->wait_for_run_command); + + insert_mip_filter_initialization_configuration_command_initial_condition_source(serializer, self->initial_cond_src); + + insert_mip_filter_initialization_configuration_command_alignment_selector(serializer, self->auto_heading_alignment_selector); + + microstrain_insert_float(serializer, self->initial_heading); + + microstrain_insert_float(serializer, self->initial_pitch); + + microstrain_insert_float(serializer, self->initial_roll); + + insert_mip_vector3f(serializer, self->initial_position); + + insert_mip_vector3f(serializer, self->initial_velocity); + + insert_mip_filter_reference_frame(serializer, self->reference_frame_selector); + + } +} +void extract_mip_filter_initialization_configuration_command(microstrain_serializer* serializer, mip_filter_initialization_configuration_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_extract_u8(serializer, &self->wait_for_run_command); + + extract_mip_filter_initialization_configuration_command_initial_condition_source(serializer, &self->initial_cond_src); + + extract_mip_filter_initialization_configuration_command_alignment_selector(serializer, &self->auto_heading_alignment_selector); + + microstrain_extract_float(serializer, &self->initial_heading); + + microstrain_extract_float(serializer, &self->initial_pitch); + + microstrain_extract_float(serializer, &self->initial_roll); + + extract_mip_vector3f(serializer, self->initial_position); + + extract_mip_vector3f(serializer, self->initial_velocity); + + extract_mip_filter_reference_frame(serializer, &self->reference_frame_selector); + + } +} + +void insert_mip_filter_initialization_configuration_response(microstrain_serializer* serializer, const mip_filter_initialization_configuration_response* self) +{ + microstrain_insert_u8(serializer, self->wait_for_run_command); + + insert_mip_filter_initialization_configuration_command_initial_condition_source(serializer, self->initial_cond_src); + + insert_mip_filter_initialization_configuration_command_alignment_selector(serializer, self->auto_heading_alignment_selector); + + microstrain_insert_float(serializer, self->initial_heading); + + microstrain_insert_float(serializer, self->initial_pitch); + + microstrain_insert_float(serializer, self->initial_roll); + + insert_mip_vector3f(serializer, self->initial_position); + + insert_mip_vector3f(serializer, self->initial_velocity); + + insert_mip_filter_reference_frame(serializer, self->reference_frame_selector); + +} +void extract_mip_filter_initialization_configuration_response(microstrain_serializer* serializer, mip_filter_initialization_configuration_response* self) +{ + microstrain_extract_u8(serializer, &self->wait_for_run_command); + + extract_mip_filter_initialization_configuration_command_initial_condition_source(serializer, &self->initial_cond_src); + + extract_mip_filter_initialization_configuration_command_alignment_selector(serializer, &self->auto_heading_alignment_selector); + + microstrain_extract_float(serializer, &self->initial_heading); + + microstrain_extract_float(serializer, &self->initial_pitch); + + microstrain_extract_float(serializer, &self->initial_roll); + + extract_mip_vector3f(serializer, self->initial_position); + + extract_mip_vector3f(serializer, self->initial_velocity); + + extract_mip_filter_reference_frame(serializer, &self->reference_frame_selector); + +} + +mip_cmd_result mip_filter_write_initialization_configuration(mip_interface* device, uint8_t wait_for_run_command, mip_filter_initialization_configuration_command_initial_condition_source initial_cond_src, mip_filter_initialization_configuration_command_alignment_selector auto_heading_alignment_selector, float initial_heading, float initial_pitch, float initial_roll, const float* initial_position, const float* initial_velocity, mip_filter_reference_frame reference_frame_selector) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_u8(&serializer, wait_for_run_command); + + insert_mip_filter_initialization_configuration_command_initial_condition_source(&serializer, initial_cond_src); + + insert_mip_filter_initialization_configuration_command_alignment_selector(&serializer, auto_heading_alignment_selector); + + microstrain_insert_float(&serializer, initial_heading); + + microstrain_insert_float(&serializer, initial_pitch); + + microstrain_insert_float(&serializer, initial_roll); + + assert(initial_position); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_float(&serializer, initial_position[i]); + + assert(initial_velocity); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_float(&serializer, initial_velocity[i]); + + insert_mip_filter_reference_frame(&serializer, reference_frame_selector); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_INITIALIZATION_CONFIGURATION, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_initialization_configuration(mip_interface* device, uint8_t* wait_for_run_command_out, mip_filter_initialization_configuration_command_initial_condition_source* initial_cond_src_out, mip_filter_initialization_configuration_command_alignment_selector* auto_heading_alignment_selector_out, float* initial_heading_out, float* initial_pitch_out, float* initial_roll_out, float* initial_position_out, float* initial_velocity_out, mip_filter_reference_frame* reference_frame_selector_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_INITIALIZATION_CONFIGURATION, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_INITIALIZATION_CONFIGURATION, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(wait_for_run_command_out); + microstrain_extract_u8(&deserializer, wait_for_run_command_out); + + assert(initial_cond_src_out); + extract_mip_filter_initialization_configuration_command_initial_condition_source(&deserializer, initial_cond_src_out); + + assert(auto_heading_alignment_selector_out); + extract_mip_filter_initialization_configuration_command_alignment_selector(&deserializer, auto_heading_alignment_selector_out); + + assert(initial_heading_out); + microstrain_extract_float(&deserializer, initial_heading_out); + + assert(initial_pitch_out); + microstrain_extract_float(&deserializer, initial_pitch_out); + + assert(initial_roll_out); + microstrain_extract_float(&deserializer, initial_roll_out); + + assert(initial_position_out); + for(unsigned int i=0; i < 3; i++) + microstrain_extract_float(&deserializer, &initial_position_out[i]); + + assert(initial_velocity_out); + for(unsigned int i=0; i < 3; i++) + microstrain_extract_float(&deserializer, &initial_velocity_out[i]); + + assert(reference_frame_selector_out); + extract_mip_filter_reference_frame(&deserializer, reference_frame_selector_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_initialization_configuration(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_INITIALIZATION_CONFIGURATION, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_initialization_configuration(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_INITIALIZATION_CONFIGURATION, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_initialization_configuration(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_INITIALIZATION_CONFIGURATION, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_adaptive_filter_options_command(microstrain_serializer* serializer, const mip_filter_adaptive_filter_options_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_u8(serializer, self->level); + + microstrain_insert_u16(serializer, self->time_limit); + + } +} +void extract_mip_filter_adaptive_filter_options_command(microstrain_serializer* serializer, mip_filter_adaptive_filter_options_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_extract_u8(serializer, &self->level); + + microstrain_extract_u16(serializer, &self->time_limit); + + } +} + +void insert_mip_filter_adaptive_filter_options_response(microstrain_serializer* serializer, const mip_filter_adaptive_filter_options_response* self) +{ + microstrain_insert_u8(serializer, self->level); + + microstrain_insert_u16(serializer, self->time_limit); + +} +void extract_mip_filter_adaptive_filter_options_response(microstrain_serializer* serializer, mip_filter_adaptive_filter_options_response* self) +{ + microstrain_extract_u8(serializer, &self->level); + + microstrain_extract_u16(serializer, &self->time_limit); + +} + +mip_cmd_result mip_filter_write_adaptive_filter_options(mip_interface* device, uint8_t level, uint16_t time_limit) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_u8(&serializer, level); + + microstrain_insert_u16(&serializer, time_limit); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ADAPTIVE_FILTER_OPTIONS, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_adaptive_filter_options(mip_interface* device, uint8_t* level_out, uint16_t* time_limit_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ADAPTIVE_FILTER_OPTIONS, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_ADAPTIVE_FILTER_OPTIONS, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(level_out); + microstrain_extract_u8(&deserializer, level_out); + + assert(time_limit_out); + microstrain_extract_u16(&deserializer, time_limit_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_adaptive_filter_options(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ADAPTIVE_FILTER_OPTIONS, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_adaptive_filter_options(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ADAPTIVE_FILTER_OPTIONS, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_adaptive_filter_options(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ADAPTIVE_FILTER_OPTIONS, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_multi_antenna_offset_command(microstrain_serializer* serializer, const mip_filter_multi_antenna_offset_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + microstrain_insert_u8(serializer, self->receiver_id); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_vector3f(serializer, self->antenna_offset); + + } +} +void extract_mip_filter_multi_antenna_offset_command(microstrain_serializer* serializer, mip_filter_multi_antenna_offset_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + microstrain_extract_u8(serializer, &self->receiver_id); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_vector3f(serializer, self->antenna_offset); + + } +} + +void insert_mip_filter_multi_antenna_offset_response(microstrain_serializer* serializer, const mip_filter_multi_antenna_offset_response* self) +{ + microstrain_insert_u8(serializer, self->receiver_id); + + insert_mip_vector3f(serializer, self->antenna_offset); + +} +void extract_mip_filter_multi_antenna_offset_response(microstrain_serializer* serializer, mip_filter_multi_antenna_offset_response* self) +{ + microstrain_extract_u8(serializer, &self->receiver_id); + + extract_mip_vector3f(serializer, self->antenna_offset); + +} + +mip_cmd_result mip_filter_write_multi_antenna_offset(mip_interface* device, uint8_t receiver_id, const float* antenna_offset) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_u8(&serializer, receiver_id); + + assert(antenna_offset); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_float(&serializer, antenna_offset[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MULTI_ANTENNA_OFFSET, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_multi_antenna_offset(mip_interface* device, uint8_t receiver_id, float* antenna_offset_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + microstrain_insert_u8(&serializer, receiver_id); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MULTI_ANTENNA_OFFSET, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_MULTI_ANTENNA_OFFSET, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + microstrain_extract_u8(&deserializer, &receiver_id); + + assert(antenna_offset_out); + for(unsigned int i=0; i < 3; i++) + microstrain_extract_float(&deserializer, &antenna_offset_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_multi_antenna_offset(mip_interface* device, uint8_t receiver_id) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + microstrain_insert_u8(&serializer, receiver_id); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MULTI_ANTENNA_OFFSET, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_multi_antenna_offset(mip_interface* device, uint8_t receiver_id) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + microstrain_insert_u8(&serializer, receiver_id); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MULTI_ANTENNA_OFFSET, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_multi_antenna_offset(mip_interface* device, uint8_t receiver_id) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + microstrain_insert_u8(&serializer, receiver_id); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MULTI_ANTENNA_OFFSET, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_rel_pos_configuration_command(microstrain_serializer* serializer, const mip_filter_rel_pos_configuration_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_u8(serializer, self->source); + + insert_mip_filter_reference_frame(serializer, self->reference_frame_selector); + + insert_mip_vector3d(serializer, self->reference_coordinates); + + } +} +void extract_mip_filter_rel_pos_configuration_command(microstrain_serializer* serializer, mip_filter_rel_pos_configuration_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_extract_u8(serializer, &self->source); + + extract_mip_filter_reference_frame(serializer, &self->reference_frame_selector); + + extract_mip_vector3d(serializer, self->reference_coordinates); + + } +} + +void insert_mip_filter_rel_pos_configuration_response(microstrain_serializer* serializer, const mip_filter_rel_pos_configuration_response* self) +{ + microstrain_insert_u8(serializer, self->source); + + insert_mip_filter_reference_frame(serializer, self->reference_frame_selector); + + insert_mip_vector3d(serializer, self->reference_coordinates); + +} +void extract_mip_filter_rel_pos_configuration_response(microstrain_serializer* serializer, mip_filter_rel_pos_configuration_response* self) +{ + microstrain_extract_u8(serializer, &self->source); + + extract_mip_filter_reference_frame(serializer, &self->reference_frame_selector); + + extract_mip_vector3d(serializer, self->reference_coordinates); + +} + +mip_cmd_result mip_filter_write_rel_pos_configuration(mip_interface* device, uint8_t source, mip_filter_reference_frame reference_frame_selector, const double* reference_coordinates) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_u8(&serializer, source); + + insert_mip_filter_reference_frame(&serializer, reference_frame_selector); + + assert(reference_coordinates); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_double(&serializer, reference_coordinates[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_REL_POS_CONFIGURATION, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_rel_pos_configuration(mip_interface* device, uint8_t* source_out, mip_filter_reference_frame* reference_frame_selector_out, double* reference_coordinates_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_REL_POS_CONFIGURATION, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_REL_POS_CONFIGURATION, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(source_out); + microstrain_extract_u8(&deserializer, source_out); + + assert(reference_frame_selector_out); + extract_mip_filter_reference_frame(&deserializer, reference_frame_selector_out); + + assert(reference_coordinates_out); + for(unsigned int i=0; i < 3; i++) + microstrain_extract_double(&deserializer, &reference_coordinates_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_rel_pos_configuration(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_REL_POS_CONFIGURATION, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_rel_pos_configuration(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_REL_POS_CONFIGURATION, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_rel_pos_configuration(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_REL_POS_CONFIGURATION, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_ref_point_lever_arm_command(microstrain_serializer* serializer, const mip_filter_ref_point_lever_arm_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_filter_ref_point_lever_arm_command_reference_point_selector(serializer, self->ref_point_sel); + + insert_mip_vector3f(serializer, self->lever_arm_offset); + + } +} +void extract_mip_filter_ref_point_lever_arm_command(microstrain_serializer* serializer, mip_filter_ref_point_lever_arm_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_filter_ref_point_lever_arm_command_reference_point_selector(serializer, &self->ref_point_sel); + + extract_mip_vector3f(serializer, self->lever_arm_offset); + + } +} + +void insert_mip_filter_ref_point_lever_arm_response(microstrain_serializer* serializer, const mip_filter_ref_point_lever_arm_response* self) +{ + insert_mip_filter_ref_point_lever_arm_command_reference_point_selector(serializer, self->ref_point_sel); + + insert_mip_vector3f(serializer, self->lever_arm_offset); + +} +void extract_mip_filter_ref_point_lever_arm_response(microstrain_serializer* serializer, mip_filter_ref_point_lever_arm_response* self) +{ + extract_mip_filter_ref_point_lever_arm_command_reference_point_selector(serializer, &self->ref_point_sel); + + extract_mip_vector3f(serializer, self->lever_arm_offset); + +} + +mip_cmd_result mip_filter_write_ref_point_lever_arm(mip_interface* device, mip_filter_ref_point_lever_arm_command_reference_point_selector ref_point_sel, const float* lever_arm_offset) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + insert_mip_filter_ref_point_lever_arm_command_reference_point_selector(&serializer, ref_point_sel); + + assert(lever_arm_offset); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_float(&serializer, lever_arm_offset[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_REF_POINT_LEVER_ARM, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_ref_point_lever_arm(mip_interface* device, mip_filter_ref_point_lever_arm_command_reference_point_selector* ref_point_sel_out, float* lever_arm_offset_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_REF_POINT_LEVER_ARM, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_REF_POINT_LEVER_ARM, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(ref_point_sel_out); + extract_mip_filter_ref_point_lever_arm_command_reference_point_selector(&deserializer, ref_point_sel_out); + + assert(lever_arm_offset_out); + for(unsigned int i=0; i < 3; i++) + microstrain_extract_float(&deserializer, &lever_arm_offset_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_ref_point_lever_arm(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_REF_POINT_LEVER_ARM, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_ref_point_lever_arm(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_REF_POINT_LEVER_ARM, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_ref_point_lever_arm(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_REF_POINT_LEVER_ARM, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_speed_measurement_command(microstrain_serializer* serializer, const mip_filter_speed_measurement_command* self) +{ + microstrain_insert_u8(serializer, self->source); + + microstrain_insert_float(serializer, self->time_of_week); + + microstrain_insert_float(serializer, self->speed); + + microstrain_insert_float(serializer, self->speed_uncertainty); + +} +void extract_mip_filter_speed_measurement_command(microstrain_serializer* serializer, mip_filter_speed_measurement_command* self) +{ + microstrain_extract_u8(serializer, &self->source); + + microstrain_extract_float(serializer, &self->time_of_week); + + microstrain_extract_float(serializer, &self->speed); + + microstrain_extract_float(serializer, &self->speed_uncertainty); + +} + +mip_cmd_result mip_filter_speed_measurement(mip_interface* device, uint8_t source, float time_of_week, float speed, float speed_uncertainty) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + microstrain_insert_u8(&serializer, source); + + microstrain_insert_float(&serializer, time_of_week); + + microstrain_insert_float(&serializer, speed); + + microstrain_insert_float(&serializer, speed_uncertainty); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SPEED_MEASUREMENT, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_speed_lever_arm_command(microstrain_serializer* serializer, const mip_filter_speed_lever_arm_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + microstrain_insert_u8(serializer, self->source); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_vector3f(serializer, self->lever_arm_offset); + + } +} +void extract_mip_filter_speed_lever_arm_command(microstrain_serializer* serializer, mip_filter_speed_lever_arm_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + microstrain_extract_u8(serializer, &self->source); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_vector3f(serializer, self->lever_arm_offset); + + } +} + +void insert_mip_filter_speed_lever_arm_response(microstrain_serializer* serializer, const mip_filter_speed_lever_arm_response* self) +{ + microstrain_insert_u8(serializer, self->source); + + insert_mip_vector3f(serializer, self->lever_arm_offset); + +} +void extract_mip_filter_speed_lever_arm_response(microstrain_serializer* serializer, mip_filter_speed_lever_arm_response* self) +{ + microstrain_extract_u8(serializer, &self->source); + + extract_mip_vector3f(serializer, self->lever_arm_offset); + +} + +mip_cmd_result mip_filter_write_speed_lever_arm(mip_interface* device, uint8_t source, const float* lever_arm_offset) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_u8(&serializer, source); + + assert(lever_arm_offset); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_float(&serializer, lever_arm_offset[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SPEED_LEVER_ARM, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_speed_lever_arm(mip_interface* device, uint8_t source, float* lever_arm_offset_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + microstrain_insert_u8(&serializer, source); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SPEED_LEVER_ARM, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_SPEED_LEVER_ARM, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + microstrain_extract_u8(&deserializer, &source); + + assert(lever_arm_offset_out); + for(unsigned int i=0; i < 3; i++) + microstrain_extract_float(&deserializer, &lever_arm_offset_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_speed_lever_arm(mip_interface* device, uint8_t source) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + microstrain_insert_u8(&serializer, source); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SPEED_LEVER_ARM, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_speed_lever_arm(mip_interface* device, uint8_t source) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + microstrain_insert_u8(&serializer, source); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SPEED_LEVER_ARM, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_speed_lever_arm(mip_interface* device, uint8_t source) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + microstrain_insert_u8(&serializer, source); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SPEED_LEVER_ARM, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_wheeled_vehicle_constraint_control_command(microstrain_serializer* serializer, const mip_filter_wheeled_vehicle_constraint_control_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_u8(serializer, self->enable); + + } +} +void extract_mip_filter_wheeled_vehicle_constraint_control_command(microstrain_serializer* serializer, mip_filter_wheeled_vehicle_constraint_control_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_extract_u8(serializer, &self->enable); + + } +} + +void insert_mip_filter_wheeled_vehicle_constraint_control_response(microstrain_serializer* serializer, const mip_filter_wheeled_vehicle_constraint_control_response* self) +{ + microstrain_insert_u8(serializer, self->enable); + +} +void extract_mip_filter_wheeled_vehicle_constraint_control_response(microstrain_serializer* serializer, mip_filter_wheeled_vehicle_constraint_control_response* self) +{ + microstrain_extract_u8(serializer, &self->enable); + +} + +mip_cmd_result mip_filter_write_wheeled_vehicle_constraint_control(mip_interface* device, uint8_t enable) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_u8(&serializer, enable); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_WHEELED_VEHICLE_CONSTRAINT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_wheeled_vehicle_constraint_control(mip_interface* device, uint8_t* enable_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_WHEELED_VEHICLE_CONSTRAINT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_WHEELED_VEHICLE_CONSTRAINT_CONTROL, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(enable_out); + microstrain_extract_u8(&deserializer, enable_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_wheeled_vehicle_constraint_control(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_WHEELED_VEHICLE_CONSTRAINT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_wheeled_vehicle_constraint_control(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_WHEELED_VEHICLE_CONSTRAINT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_wheeled_vehicle_constraint_control(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_WHEELED_VEHICLE_CONSTRAINT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_vertical_gyro_constraint_control_command(microstrain_serializer* serializer, const mip_filter_vertical_gyro_constraint_control_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_u8(serializer, self->enable); + + } +} +void extract_mip_filter_vertical_gyro_constraint_control_command(microstrain_serializer* serializer, mip_filter_vertical_gyro_constraint_control_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_extract_u8(serializer, &self->enable); + + } +} + +void insert_mip_filter_vertical_gyro_constraint_control_response(microstrain_serializer* serializer, const mip_filter_vertical_gyro_constraint_control_response* self) +{ + microstrain_insert_u8(serializer, self->enable); + +} +void extract_mip_filter_vertical_gyro_constraint_control_response(microstrain_serializer* serializer, mip_filter_vertical_gyro_constraint_control_response* self) +{ + microstrain_extract_u8(serializer, &self->enable); + +} + +mip_cmd_result mip_filter_write_vertical_gyro_constraint_control(mip_interface* device, uint8_t enable) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_u8(&serializer, enable); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_VERTICAL_GYRO_CONSTRAINT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_vertical_gyro_constraint_control(mip_interface* device, uint8_t* enable_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_VERTICAL_GYRO_CONSTRAINT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_VERTICAL_GYRO_CONSTRAINT_CONTROL, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(enable_out); + microstrain_extract_u8(&deserializer, enable_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_vertical_gyro_constraint_control(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_VERTICAL_GYRO_CONSTRAINT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_vertical_gyro_constraint_control(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_VERTICAL_GYRO_CONSTRAINT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_vertical_gyro_constraint_control(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_VERTICAL_GYRO_CONSTRAINT_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_gnss_antenna_cal_control_command(microstrain_serializer* serializer, const mip_filter_gnss_antenna_cal_control_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_u8(serializer, self->enable); + + microstrain_insert_float(serializer, self->max_offset); + + } +} +void extract_mip_filter_gnss_antenna_cal_control_command(microstrain_serializer* serializer, mip_filter_gnss_antenna_cal_control_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_extract_u8(serializer, &self->enable); + + microstrain_extract_float(serializer, &self->max_offset); + + } +} + +void insert_mip_filter_gnss_antenna_cal_control_response(microstrain_serializer* serializer, const mip_filter_gnss_antenna_cal_control_response* self) +{ + microstrain_insert_u8(serializer, self->enable); + + microstrain_insert_float(serializer, self->max_offset); + +} +void extract_mip_filter_gnss_antenna_cal_control_response(microstrain_serializer* serializer, mip_filter_gnss_antenna_cal_control_response* self) +{ + microstrain_extract_u8(serializer, &self->enable); + + microstrain_extract_float(serializer, &self->max_offset); + +} + +mip_cmd_result mip_filter_write_gnss_antenna_cal_control(mip_interface* device, uint8_t enable, float max_offset) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_u8(&serializer, enable); + + microstrain_insert_float(&serializer, max_offset); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_GNSS_ANTENNA_CALIBRATION_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_read_gnss_antenna_cal_control(mip_interface* device, uint8_t* enable_out, float* max_offset_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_GNSS_ANTENNA_CALIBRATION_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_GNSS_ANTENNA_CALIBRATION_CONTROL, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(enable_out); + microstrain_extract_u8(&deserializer, enable_out); + + assert(max_offset_out); + microstrain_extract_float(&deserializer, max_offset_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_filter_save_gnss_antenna_cal_control(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_GNSS_ANTENNA_CALIBRATION_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_load_gnss_antenna_cal_control(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_GNSS_ANTENNA_CALIBRATION_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_filter_default_gnss_antenna_cal_control(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_GNSS_ANTENNA_CALIBRATION_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_filter_set_initial_heading_command(microstrain_serializer* serializer, const mip_filter_set_initial_heading_command* self) +{ + microstrain_insert_float(serializer, self->heading); + +} +void extract_mip_filter_set_initial_heading_command(microstrain_serializer* serializer, mip_filter_set_initial_heading_command* self) +{ + microstrain_extract_float(serializer, &self->heading); + +} + +mip_cmd_result mip_filter_set_initial_heading(mip_interface* device, float heading) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + microstrain_insert_float(&serializer, heading); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SET_INITIAL_HEADING, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} + +#ifdef __cplusplus +} // extern "C" +} // namespace C +} // namespace mip +#endif // __cplusplus + diff --git a/src/mip/definitions/commands_filter.h b/src/c/mip/definitions/commands_filter.h similarity index 55% rename from src/mip/definitions/commands_filter.h rename to src/c/mip/definitions/commands_filter.h index 1c48785ec..ebf9b8e5c 100644 --- a/src/mip/definitions/commands_filter.h +++ b/src/c/mip/definitions/commands_filter.h @@ -1,8 +1,9 @@ #pragma once -#include "common.h" -#include "descriptors.h" -#include "../mip_result.h" +#include +#include +#include +#include #include #include @@ -14,14 +15,11 @@ namespace C { extern "C" { #endif // __cplusplus -struct mip_interface; -struct mip_serializer; -struct mip_field; //////////////////////////////////////////////////////////////////////////////// -///@addtogroup MipCommands_c MIP Commands [C] +///@addtogroup MipCommands_c ///@{ -///@defgroup filter_commands_c Filter Commands [C] +///@defgroup filter_commands_c Filter Commands /// ///@{ @@ -156,28 +154,61 @@ enum // Shared Type Definitions //////////////////////////////////////////////////////////////////////////////// -typedef uint8_t mip_filter_reference_frame; -static const mip_filter_reference_frame MIP_FILTER_REFERENCE_FRAME_ECEF = 1; ///< WGS84 Earth-fixed, earth centered coordinates -static const mip_filter_reference_frame MIP_FILTER_REFERENCE_FRAME_LLH = 2; ///< WGS84 Latitude, longitude, and height above ellipsoid +enum mip_filter_reference_frame +{ + MIP_FILTER_REFERENCE_FRAME_ECEF = 1, ///< WGS84 Earth-fixed, earth centered coordinates + MIP_FILTER_REFERENCE_FRAME_LLH = 2, ///< WGS84 Latitude, longitude, and height above ellipsoid +}; +typedef enum mip_filter_reference_frame mip_filter_reference_frame; -void insert_mip_filter_reference_frame(struct mip_serializer* serializer, const mip_filter_reference_frame self); -void extract_mip_filter_reference_frame(struct mip_serializer* serializer, mip_filter_reference_frame* self); +static inline void insert_mip_filter_reference_frame(microstrain_serializer* serializer, const mip_filter_reference_frame self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_filter_reference_frame(microstrain_serializer* serializer, mip_filter_reference_frame* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} -typedef uint8_t mip_filter_mag_param_source; -static const mip_filter_mag_param_source MIP_FILTER_MAG_PARAM_SOURCE_NONE = 1; ///< No source. See command documentation for default behavior -static const mip_filter_mag_param_source MIP_FILTER_MAG_PARAM_SOURCE_WMM = 2; ///< Magnetic field is assumed to conform to the World Magnetic Model, calculated using current location estimate as an input to the model. -static const mip_filter_mag_param_source MIP_FILTER_MAG_PARAM_SOURCE_MANUAL = 3; ///< Magnetic field is assumed to have the parameter specified by the user. +enum mip_filter_mag_param_source +{ + MIP_FILTER_MAG_PARAM_SOURCE_NONE = 1, ///< No source. See command documentation for default behavior + MIP_FILTER_MAG_PARAM_SOURCE_WMM = 2, ///< Magnetic field is assumed to conform to the World Magnetic Model, calculated using current location estimate as an input to the model. + MIP_FILTER_MAG_PARAM_SOURCE_MANUAL = 3, ///< Magnetic field is assumed to have the parameter specified by the user. +}; +typedef enum mip_filter_mag_param_source mip_filter_mag_param_source; -void insert_mip_filter_mag_param_source(struct mip_serializer* serializer, const mip_filter_mag_param_source self); -void extract_mip_filter_mag_param_source(struct mip_serializer* serializer, mip_filter_mag_param_source* self); +static inline void insert_mip_filter_mag_param_source(microstrain_serializer* serializer, const mip_filter_mag_param_source self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_filter_mag_param_source(microstrain_serializer* serializer, mip_filter_mag_param_source* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} -typedef uint8_t mip_filter_adaptive_measurement; -static const mip_filter_adaptive_measurement MIP_FILTER_ADAPTIVE_MEASUREMENT_DISABLED = 0; ///< No adaptive measurement -static const mip_filter_adaptive_measurement MIP_FILTER_ADAPTIVE_MEASUREMENT_FIXED = 1; ///< Enable fixed adaptive measurement (use specified limits) -static const mip_filter_adaptive_measurement MIP_FILTER_ADAPTIVE_MEASUREMENT_AUTO = 2; ///< Enable auto adaptive measurement +enum mip_filter_adaptive_measurement +{ + MIP_FILTER_ADAPTIVE_MEASUREMENT_DISABLED = 0, ///< No adaptive measurement + MIP_FILTER_ADAPTIVE_MEASUREMENT_FIXED = 1, ///< Enable fixed adaptive measurement (use specified limits) + MIP_FILTER_ADAPTIVE_MEASUREMENT_AUTO = 2, ///< Enable auto adaptive measurement +}; +typedef enum mip_filter_adaptive_measurement mip_filter_adaptive_measurement; -void insert_mip_filter_adaptive_measurement(struct mip_serializer* serializer, const mip_filter_adaptive_measurement self); -void extract_mip_filter_adaptive_measurement(struct mip_serializer* serializer, mip_filter_adaptive_measurement* self); +static inline void insert_mip_filter_adaptive_measurement(microstrain_serializer* serializer, const mip_filter_adaptive_measurement self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_filter_adaptive_measurement(microstrain_serializer* serializer, mip_filter_adaptive_measurement* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} //////////////////////////////////////////////////////////////////////////////// @@ -185,7 +216,7 @@ void extract_mip_filter_adaptive_measurement(struct mip_serializer* serializer, //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_reset (0x0D,0x01) Reset [C] +///@defgroup filter_reset_c (0x0D,0x01) Reset /// Resets the filter to the initialization state. /// /// If the auto-initialization feature is disabled, the initial attitude or heading must be set in @@ -193,12 +224,14 @@ void extract_mip_filter_adaptive_measurement(struct mip_serializer* serializer, /// ///@{ -mip_cmd_result mip_filter_reset(struct mip_interface* device); +typedef struct mip_filter_reset_command mip_filter_reset_command; ///< No parameters (empty struct not allowed in C) + +mip_cmd_result mip_filter_reset(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_set_initial_attitude (0x0D,0x02) Set Initial Attitude [C] +///@defgroup filter_set_initial_attitude_c (0x0D,0x02) Set Initial Attitude /// Set the sensor initial attitude. /// /// This command can only be issued in the "Init" state and should be used with a good @@ -219,18 +252,18 @@ struct mip_filter_set_initial_attitude_command float roll; ///< [radians] float pitch; ///< [radians] float heading; ///< [radians] - }; typedef struct mip_filter_set_initial_attitude_command mip_filter_set_initial_attitude_command; -void insert_mip_filter_set_initial_attitude_command(struct mip_serializer* serializer, const mip_filter_set_initial_attitude_command* self); -void extract_mip_filter_set_initial_attitude_command(struct mip_serializer* serializer, mip_filter_set_initial_attitude_command* self); -mip_cmd_result mip_filter_set_initial_attitude(struct mip_interface* device, float roll, float pitch, float heading); +void insert_mip_filter_set_initial_attitude_command(microstrain_serializer* serializer, const mip_filter_set_initial_attitude_command* self); +void extract_mip_filter_set_initial_attitude_command(microstrain_serializer* serializer, mip_filter_set_initial_attitude_command* self); + +mip_cmd_result mip_filter_set_initial_attitude(mip_interface* device, float roll, float pitch, float heading); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_estimation_control (0x0D,0x14) Estimation Control [C] +///@defgroup filter_estimation_control_c (0x0D,0x14) Estimation Control /// Estimation Control Flags /// /// Controls which parameters are estimated by the Kalman Filter. @@ -255,39 +288,47 @@ static const mip_filter_estimation_control_command_enable_flags MIP_FILTER_ESTIM static const mip_filter_estimation_control_command_enable_flags MIP_FILTER_ESTIMATION_CONTROL_COMMAND_ENABLE_FLAGS_AUTO_MAG_HARD_IRON = 0x0020; ///< static const mip_filter_estimation_control_command_enable_flags MIP_FILTER_ESTIMATION_CONTROL_COMMAND_ENABLE_FLAGS_AUTO_MAG_SOFT_IRON = 0x0040; ///< static const mip_filter_estimation_control_command_enable_flags MIP_FILTER_ESTIMATION_CONTROL_COMMAND_ENABLE_FLAGS_ALL = 0x007F; +static inline void insert_mip_filter_estimation_control_command_enable_flags(microstrain_serializer* serializer, const mip_filter_estimation_control_command_enable_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_filter_estimation_control_command_enable_flags(microstrain_serializer* serializer, mip_filter_estimation_control_command_enable_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_filter_estimation_control_command { mip_function_selector function; mip_filter_estimation_control_command_enable_flags enable; ///< See above - }; typedef struct mip_filter_estimation_control_command mip_filter_estimation_control_command; -void insert_mip_filter_estimation_control_command(struct mip_serializer* serializer, const mip_filter_estimation_control_command* self); -void extract_mip_filter_estimation_control_command(struct mip_serializer* serializer, mip_filter_estimation_control_command* self); -void insert_mip_filter_estimation_control_command_enable_flags(struct mip_serializer* serializer, const mip_filter_estimation_control_command_enable_flags self); -void extract_mip_filter_estimation_control_command_enable_flags(struct mip_serializer* serializer, mip_filter_estimation_control_command_enable_flags* self); +void insert_mip_filter_estimation_control_command(microstrain_serializer* serializer, const mip_filter_estimation_control_command* self); +void extract_mip_filter_estimation_control_command(microstrain_serializer* serializer, mip_filter_estimation_control_command* self); struct mip_filter_estimation_control_response { mip_filter_estimation_control_command_enable_flags enable; ///< See above - }; typedef struct mip_filter_estimation_control_response mip_filter_estimation_control_response; -void insert_mip_filter_estimation_control_response(struct mip_serializer* serializer, const mip_filter_estimation_control_response* self); -void extract_mip_filter_estimation_control_response(struct mip_serializer* serializer, mip_filter_estimation_control_response* self); -mip_cmd_result mip_filter_write_estimation_control(struct mip_interface* device, mip_filter_estimation_control_command_enable_flags enable); -mip_cmd_result mip_filter_read_estimation_control(struct mip_interface* device, mip_filter_estimation_control_command_enable_flags* enable_out); -mip_cmd_result mip_filter_save_estimation_control(struct mip_interface* device); -mip_cmd_result mip_filter_load_estimation_control(struct mip_interface* device); -mip_cmd_result mip_filter_default_estimation_control(struct mip_interface* device); +void insert_mip_filter_estimation_control_response(microstrain_serializer* serializer, const mip_filter_estimation_control_response* self); +void extract_mip_filter_estimation_control_response(microstrain_serializer* serializer, mip_filter_estimation_control_response* self); + +mip_cmd_result mip_filter_write_estimation_control(mip_interface* device, mip_filter_estimation_control_command_enable_flags enable); +mip_cmd_result mip_filter_read_estimation_control(mip_interface* device, mip_filter_estimation_control_command_enable_flags* enable_out); +mip_cmd_result mip_filter_save_estimation_control(mip_interface* device); +mip_cmd_result mip_filter_load_estimation_control(mip_interface* device); +mip_cmd_result mip_filter_default_estimation_control(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_external_gnss_update (0x0D,0x16) External Gnss Update [C] +///@defgroup filter_external_gnss_update_c (0x0D,0x16) External Gnss Update /// Provide a filter measurement from an external GNSS /// /// The GNSS source control must be set to "external" for this command to succeed, otherwise it will be NACK'd. @@ -306,18 +347,18 @@ struct mip_filter_external_gnss_update_command mip_vector3f velocity; ///< NED Frame [meters/second] mip_vector3f pos_uncertainty; ///< NED Frame, 1-sigma [meters] mip_vector3f vel_uncertainty; ///< NED Frame, 1-sigma [meters/second] - }; typedef struct mip_filter_external_gnss_update_command mip_filter_external_gnss_update_command; -void insert_mip_filter_external_gnss_update_command(struct mip_serializer* serializer, const mip_filter_external_gnss_update_command* self); -void extract_mip_filter_external_gnss_update_command(struct mip_serializer* serializer, mip_filter_external_gnss_update_command* self); -mip_cmd_result mip_filter_external_gnss_update(struct mip_interface* device, double gps_time, uint16_t gps_week, double latitude, double longitude, double height, const float* velocity, const float* pos_uncertainty, const float* vel_uncertainty); +void insert_mip_filter_external_gnss_update_command(microstrain_serializer* serializer, const mip_filter_external_gnss_update_command* self); +void extract_mip_filter_external_gnss_update_command(microstrain_serializer* serializer, mip_filter_external_gnss_update_command* self); + +mip_cmd_result mip_filter_external_gnss_update(mip_interface* device, double gps_time, uint16_t gps_week, double latitude, double longitude, double height, const float* velocity, const float* pos_uncertainty, const float* vel_uncertainty); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_external_heading_update (0x0D,0x17) External Heading Update [C] +///@defgroup filter_external_heading_update_c (0x0D,0x17) External Heading Update /// Provide a filter measurement from an external heading source /// /// The heading must be the sensor frame with respect to the NED frame. @@ -339,18 +380,18 @@ struct mip_filter_external_heading_update_command float heading; ///< Bounded by +-PI [radians] float heading_uncertainty; ///< 1-sigma [radians] uint8_t type; ///< 1 - True, 2 - Magnetic - }; typedef struct mip_filter_external_heading_update_command mip_filter_external_heading_update_command; -void insert_mip_filter_external_heading_update_command(struct mip_serializer* serializer, const mip_filter_external_heading_update_command* self); -void extract_mip_filter_external_heading_update_command(struct mip_serializer* serializer, mip_filter_external_heading_update_command* self); -mip_cmd_result mip_filter_external_heading_update(struct mip_interface* device, float heading, float heading_uncertainty, uint8_t type); +void insert_mip_filter_external_heading_update_command(microstrain_serializer* serializer, const mip_filter_external_heading_update_command* self); +void extract_mip_filter_external_heading_update_command(microstrain_serializer* serializer, mip_filter_external_heading_update_command* self); + +mip_cmd_result mip_filter_external_heading_update(mip_interface* device, float heading, float heading_uncertainty, uint8_t type); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_external_heading_update_with_time (0x0D,0x1F) External Heading Update With Time [C] +///@defgroup filter_external_heading_update_with_time_c (0x0D,0x1F) External Heading Update With Time /// Provide a filter measurement from an external heading source at a specific GPS time /// /// This is more accurate than the External Heading Update (0x0D, 0x17) and should be used in applications @@ -378,18 +419,18 @@ struct mip_filter_external_heading_update_with_time_command float heading; ///< Relative to true north, bounded by +-PI [radians] float heading_uncertainty; ///< 1-sigma [radians] uint8_t type; ///< 1 - True, 2 - Magnetic - }; typedef struct mip_filter_external_heading_update_with_time_command mip_filter_external_heading_update_with_time_command; -void insert_mip_filter_external_heading_update_with_time_command(struct mip_serializer* serializer, const mip_filter_external_heading_update_with_time_command* self); -void extract_mip_filter_external_heading_update_with_time_command(struct mip_serializer* serializer, mip_filter_external_heading_update_with_time_command* self); -mip_cmd_result mip_filter_external_heading_update_with_time(struct mip_interface* device, double gps_time, uint16_t gps_week, float heading, float heading_uncertainty, uint8_t type); +void insert_mip_filter_external_heading_update_with_time_command(microstrain_serializer* serializer, const mip_filter_external_heading_update_with_time_command* self); +void extract_mip_filter_external_heading_update_with_time_command(microstrain_serializer* serializer, mip_filter_external_heading_update_with_time_command* self); + +mip_cmd_result mip_filter_external_heading_update_with_time(mip_interface* device, double gps_time, uint16_t gps_week, float heading, float heading_uncertainty, uint8_t type); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_tare_orientation (0x0D,0x21) Tare Orientation [C] +///@defgroup filter_tare_orientation_c (0x0D,0x21) Tare Orientation /// Tare the device orientation. /// /// This function uses the current device orientation relative to the NED frame as the current sensor to vehicle transformation. @@ -404,81 +445,101 @@ static const mip_filter_tare_orientation_command_mip_tare_axes MIP_FILTER_TARE_O static const mip_filter_tare_orientation_command_mip_tare_axes MIP_FILTER_TARE_ORIENTATION_COMMAND_MIP_TARE_AXES_PITCH = 0x2; ///< static const mip_filter_tare_orientation_command_mip_tare_axes MIP_FILTER_TARE_ORIENTATION_COMMAND_MIP_TARE_AXES_YAW = 0x4; ///< static const mip_filter_tare_orientation_command_mip_tare_axes MIP_FILTER_TARE_ORIENTATION_COMMAND_MIP_TARE_AXES_ALL = 0x7; +static inline void insert_mip_filter_tare_orientation_command_mip_tare_axes(microstrain_serializer* serializer, const mip_filter_tare_orientation_command_mip_tare_axes self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_filter_tare_orientation_command_mip_tare_axes(microstrain_serializer* serializer, mip_filter_tare_orientation_command_mip_tare_axes* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} + struct mip_filter_tare_orientation_command { mip_function_selector function; mip_filter_tare_orientation_command_mip_tare_axes axes; ///< Axes to tare - }; typedef struct mip_filter_tare_orientation_command mip_filter_tare_orientation_command; -void insert_mip_filter_tare_orientation_command(struct mip_serializer* serializer, const mip_filter_tare_orientation_command* self); -void extract_mip_filter_tare_orientation_command(struct mip_serializer* serializer, mip_filter_tare_orientation_command* self); -void insert_mip_filter_tare_orientation_command_mip_tare_axes(struct mip_serializer* serializer, const mip_filter_tare_orientation_command_mip_tare_axes self); -void extract_mip_filter_tare_orientation_command_mip_tare_axes(struct mip_serializer* serializer, mip_filter_tare_orientation_command_mip_tare_axes* self); +void insert_mip_filter_tare_orientation_command(microstrain_serializer* serializer, const mip_filter_tare_orientation_command* self); +void extract_mip_filter_tare_orientation_command(microstrain_serializer* serializer, mip_filter_tare_orientation_command* self); struct mip_filter_tare_orientation_response { mip_filter_tare_orientation_command_mip_tare_axes axes; ///< Axes to tare - }; typedef struct mip_filter_tare_orientation_response mip_filter_tare_orientation_response; -void insert_mip_filter_tare_orientation_response(struct mip_serializer* serializer, const mip_filter_tare_orientation_response* self); -void extract_mip_filter_tare_orientation_response(struct mip_serializer* serializer, mip_filter_tare_orientation_response* self); -mip_cmd_result mip_filter_write_tare_orientation(struct mip_interface* device, mip_filter_tare_orientation_command_mip_tare_axes axes); -mip_cmd_result mip_filter_read_tare_orientation(struct mip_interface* device, mip_filter_tare_orientation_command_mip_tare_axes* axes_out); -mip_cmd_result mip_filter_save_tare_orientation(struct mip_interface* device); -mip_cmd_result mip_filter_load_tare_orientation(struct mip_interface* device); -mip_cmd_result mip_filter_default_tare_orientation(struct mip_interface* device); +void insert_mip_filter_tare_orientation_response(microstrain_serializer* serializer, const mip_filter_tare_orientation_response* self); +void extract_mip_filter_tare_orientation_response(microstrain_serializer* serializer, mip_filter_tare_orientation_response* self); + +mip_cmd_result mip_filter_write_tare_orientation(mip_interface* device, mip_filter_tare_orientation_command_mip_tare_axes axes); +mip_cmd_result mip_filter_read_tare_orientation(mip_interface* device, mip_filter_tare_orientation_command_mip_tare_axes* axes_out); +mip_cmd_result mip_filter_save_tare_orientation(mip_interface* device); +mip_cmd_result mip_filter_load_tare_orientation(mip_interface* device); +mip_cmd_result mip_filter_default_tare_orientation(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_vehicle_dynamics_mode (0x0D,0x10) Vehicle Dynamics Mode [C] +///@defgroup filter_vehicle_dynamics_mode_c (0x0D,0x10) Vehicle Dynamics Mode /// Controls the vehicle dynamics mode. /// ///@{ -typedef uint8_t mip_filter_vehicle_dynamics_mode_command_dynamics_mode; -static const mip_filter_vehicle_dynamics_mode_command_dynamics_mode MIP_FILTER_VEHICLE_DYNAMICS_MODE_COMMAND_DYNAMICS_MODE_PORTABLE = 1; ///< -static const mip_filter_vehicle_dynamics_mode_command_dynamics_mode MIP_FILTER_VEHICLE_DYNAMICS_MODE_COMMAND_DYNAMICS_MODE_AUTOMOTIVE = 2; ///< -static const mip_filter_vehicle_dynamics_mode_command_dynamics_mode MIP_FILTER_VEHICLE_DYNAMICS_MODE_COMMAND_DYNAMICS_MODE_AIRBORNE = 3; ///< -static const mip_filter_vehicle_dynamics_mode_command_dynamics_mode MIP_FILTER_VEHICLE_DYNAMICS_MODE_COMMAND_DYNAMICS_MODE_AIRBORNE_HIGH_G = 4; ///< +enum mip_filter_vehicle_dynamics_mode_command_dynamics_mode +{ + MIP_FILTER_VEHICLE_DYNAMICS_MODE_COMMAND_DYNAMICS_MODE_PORTABLE = 1, ///< + MIP_FILTER_VEHICLE_DYNAMICS_MODE_COMMAND_DYNAMICS_MODE_AUTOMOTIVE = 2, ///< + MIP_FILTER_VEHICLE_DYNAMICS_MODE_COMMAND_DYNAMICS_MODE_AIRBORNE = 3, ///< + MIP_FILTER_VEHICLE_DYNAMICS_MODE_COMMAND_DYNAMICS_MODE_AIRBORNE_HIGH_G = 4, ///< +}; +typedef enum mip_filter_vehicle_dynamics_mode_command_dynamics_mode mip_filter_vehicle_dynamics_mode_command_dynamics_mode; + +static inline void insert_mip_filter_vehicle_dynamics_mode_command_dynamics_mode(microstrain_serializer* serializer, const mip_filter_vehicle_dynamics_mode_command_dynamics_mode self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_filter_vehicle_dynamics_mode_command_dynamics_mode(microstrain_serializer* serializer, mip_filter_vehicle_dynamics_mode_command_dynamics_mode* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} + struct mip_filter_vehicle_dynamics_mode_command { mip_function_selector function; mip_filter_vehicle_dynamics_mode_command_dynamics_mode mode; - }; typedef struct mip_filter_vehicle_dynamics_mode_command mip_filter_vehicle_dynamics_mode_command; -void insert_mip_filter_vehicle_dynamics_mode_command(struct mip_serializer* serializer, const mip_filter_vehicle_dynamics_mode_command* self); -void extract_mip_filter_vehicle_dynamics_mode_command(struct mip_serializer* serializer, mip_filter_vehicle_dynamics_mode_command* self); -void insert_mip_filter_vehicle_dynamics_mode_command_dynamics_mode(struct mip_serializer* serializer, const mip_filter_vehicle_dynamics_mode_command_dynamics_mode self); -void extract_mip_filter_vehicle_dynamics_mode_command_dynamics_mode(struct mip_serializer* serializer, mip_filter_vehicle_dynamics_mode_command_dynamics_mode* self); +void insert_mip_filter_vehicle_dynamics_mode_command(microstrain_serializer* serializer, const mip_filter_vehicle_dynamics_mode_command* self); +void extract_mip_filter_vehicle_dynamics_mode_command(microstrain_serializer* serializer, mip_filter_vehicle_dynamics_mode_command* self); struct mip_filter_vehicle_dynamics_mode_response { mip_filter_vehicle_dynamics_mode_command_dynamics_mode mode; - }; typedef struct mip_filter_vehicle_dynamics_mode_response mip_filter_vehicle_dynamics_mode_response; -void insert_mip_filter_vehicle_dynamics_mode_response(struct mip_serializer* serializer, const mip_filter_vehicle_dynamics_mode_response* self); -void extract_mip_filter_vehicle_dynamics_mode_response(struct mip_serializer* serializer, mip_filter_vehicle_dynamics_mode_response* self); -mip_cmd_result mip_filter_write_vehicle_dynamics_mode(struct mip_interface* device, mip_filter_vehicle_dynamics_mode_command_dynamics_mode mode); -mip_cmd_result mip_filter_read_vehicle_dynamics_mode(struct mip_interface* device, mip_filter_vehicle_dynamics_mode_command_dynamics_mode* mode_out); -mip_cmd_result mip_filter_save_vehicle_dynamics_mode(struct mip_interface* device); -mip_cmd_result mip_filter_load_vehicle_dynamics_mode(struct mip_interface* device); -mip_cmd_result mip_filter_default_vehicle_dynamics_mode(struct mip_interface* device); +void insert_mip_filter_vehicle_dynamics_mode_response(microstrain_serializer* serializer, const mip_filter_vehicle_dynamics_mode_response* self); +void extract_mip_filter_vehicle_dynamics_mode_response(microstrain_serializer* serializer, mip_filter_vehicle_dynamics_mode_response* self); + +mip_cmd_result mip_filter_write_vehicle_dynamics_mode(mip_interface* device, mip_filter_vehicle_dynamics_mode_command_dynamics_mode mode); +mip_cmd_result mip_filter_read_vehicle_dynamics_mode(mip_interface* device, mip_filter_vehicle_dynamics_mode_command_dynamics_mode* mode_out); +mip_cmd_result mip_filter_save_vehicle_dynamics_mode(mip_interface* device); +mip_cmd_result mip_filter_load_vehicle_dynamics_mode(mip_interface* device); +mip_cmd_result mip_filter_default_vehicle_dynamics_mode(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_sensor_to_vehicle_rotation_euler (0x0D,0x11) Sensor To Vehicle Rotation Euler [C] +///@defgroup filter_sensor_to_vehicle_rotation_euler_c (0x0D,0x11) Sensor To Vehicle Rotation Euler /// Set the sensor to vehicle frame rotation using Yaw, Pitch, Roll Euler angles. /// /// Note: This is the rotation, the inverse of the transformation. @@ -511,33 +572,33 @@ struct mip_filter_sensor_to_vehicle_rotation_euler_command float roll; ///< [radians] float pitch; ///< [radians] float yaw; ///< [radians] - }; typedef struct mip_filter_sensor_to_vehicle_rotation_euler_command mip_filter_sensor_to_vehicle_rotation_euler_command; -void insert_mip_filter_sensor_to_vehicle_rotation_euler_command(struct mip_serializer* serializer, const mip_filter_sensor_to_vehicle_rotation_euler_command* self); -void extract_mip_filter_sensor_to_vehicle_rotation_euler_command(struct mip_serializer* serializer, mip_filter_sensor_to_vehicle_rotation_euler_command* self); + +void insert_mip_filter_sensor_to_vehicle_rotation_euler_command(microstrain_serializer* serializer, const mip_filter_sensor_to_vehicle_rotation_euler_command* self); +void extract_mip_filter_sensor_to_vehicle_rotation_euler_command(microstrain_serializer* serializer, mip_filter_sensor_to_vehicle_rotation_euler_command* self); struct mip_filter_sensor_to_vehicle_rotation_euler_response { float roll; ///< [radians] float pitch; ///< [radians] float yaw; ///< [radians] - }; typedef struct mip_filter_sensor_to_vehicle_rotation_euler_response mip_filter_sensor_to_vehicle_rotation_euler_response; -void insert_mip_filter_sensor_to_vehicle_rotation_euler_response(struct mip_serializer* serializer, const mip_filter_sensor_to_vehicle_rotation_euler_response* self); -void extract_mip_filter_sensor_to_vehicle_rotation_euler_response(struct mip_serializer* serializer, mip_filter_sensor_to_vehicle_rotation_euler_response* self); -mip_cmd_result mip_filter_write_sensor_to_vehicle_rotation_euler(struct mip_interface* device, float roll, float pitch, float yaw); -mip_cmd_result mip_filter_read_sensor_to_vehicle_rotation_euler(struct mip_interface* device, float* roll_out, float* pitch_out, float* yaw_out); -mip_cmd_result mip_filter_save_sensor_to_vehicle_rotation_euler(struct mip_interface* device); -mip_cmd_result mip_filter_load_sensor_to_vehicle_rotation_euler(struct mip_interface* device); -mip_cmd_result mip_filter_default_sensor_to_vehicle_rotation_euler(struct mip_interface* device); +void insert_mip_filter_sensor_to_vehicle_rotation_euler_response(microstrain_serializer* serializer, const mip_filter_sensor_to_vehicle_rotation_euler_response* self); +void extract_mip_filter_sensor_to_vehicle_rotation_euler_response(microstrain_serializer* serializer, mip_filter_sensor_to_vehicle_rotation_euler_response* self); + +mip_cmd_result mip_filter_write_sensor_to_vehicle_rotation_euler(mip_interface* device, float roll, float pitch, float yaw); +mip_cmd_result mip_filter_read_sensor_to_vehicle_rotation_euler(mip_interface* device, float* roll_out, float* pitch_out, float* yaw_out); +mip_cmd_result mip_filter_save_sensor_to_vehicle_rotation_euler(mip_interface* device); +mip_cmd_result mip_filter_load_sensor_to_vehicle_rotation_euler(mip_interface* device); +mip_cmd_result mip_filter_default_sensor_to_vehicle_rotation_euler(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_sensor_to_vehicle_rotation_dcm (0x0D,0x4E) Sensor To Vehicle Rotation Dcm [C] +///@defgroup filter_sensor_to_vehicle_rotation_dcm_c (0x0D,0x4E) Sensor To Vehicle Rotation Dcm /// Set the sensor to vehicle frame rotation using a row-major direction cosine matrix. /// /// Note: This is the rotation, the inverse of the transformation. @@ -549,7 +610,7 @@ mip_cmd_result mip_filter_default_sensor_to_vehicle_rotation_euler(struct mip_in ///
/// Matrix element order:

/// -/// EQSTART T_{SEN}^{VEH} = \begin{bmatrix} 0 & 1 & 2\\ 3 & 4 & 5\\ 6 & 7 & 8 \end{bmatrix} EQEND +/// EQSTART T_{SEN}^{VEH} = \\begin{bmatrix} 0 & 1 & 2\\\\ 3 & 4 & 5\\\\ 6 & 7 & 8 \\end{bmatrix} EQEND /// ///

/// This rotation affects the following output quantities:

@@ -574,31 +635,31 @@ struct mip_filter_sensor_to_vehicle_rotation_dcm_command { mip_function_selector function; mip_matrix3f dcm; - }; typedef struct mip_filter_sensor_to_vehicle_rotation_dcm_command mip_filter_sensor_to_vehicle_rotation_dcm_command; -void insert_mip_filter_sensor_to_vehicle_rotation_dcm_command(struct mip_serializer* serializer, const mip_filter_sensor_to_vehicle_rotation_dcm_command* self); -void extract_mip_filter_sensor_to_vehicle_rotation_dcm_command(struct mip_serializer* serializer, mip_filter_sensor_to_vehicle_rotation_dcm_command* self); + +void insert_mip_filter_sensor_to_vehicle_rotation_dcm_command(microstrain_serializer* serializer, const mip_filter_sensor_to_vehicle_rotation_dcm_command* self); +void extract_mip_filter_sensor_to_vehicle_rotation_dcm_command(microstrain_serializer* serializer, mip_filter_sensor_to_vehicle_rotation_dcm_command* self); struct mip_filter_sensor_to_vehicle_rotation_dcm_response { mip_matrix3f dcm; - }; typedef struct mip_filter_sensor_to_vehicle_rotation_dcm_response mip_filter_sensor_to_vehicle_rotation_dcm_response; -void insert_mip_filter_sensor_to_vehicle_rotation_dcm_response(struct mip_serializer* serializer, const mip_filter_sensor_to_vehicle_rotation_dcm_response* self); -void extract_mip_filter_sensor_to_vehicle_rotation_dcm_response(struct mip_serializer* serializer, mip_filter_sensor_to_vehicle_rotation_dcm_response* self); -mip_cmd_result mip_filter_write_sensor_to_vehicle_rotation_dcm(struct mip_interface* device, const float* dcm); -mip_cmd_result mip_filter_read_sensor_to_vehicle_rotation_dcm(struct mip_interface* device, float* dcm_out); -mip_cmd_result mip_filter_save_sensor_to_vehicle_rotation_dcm(struct mip_interface* device); -mip_cmd_result mip_filter_load_sensor_to_vehicle_rotation_dcm(struct mip_interface* device); -mip_cmd_result mip_filter_default_sensor_to_vehicle_rotation_dcm(struct mip_interface* device); +void insert_mip_filter_sensor_to_vehicle_rotation_dcm_response(microstrain_serializer* serializer, const mip_filter_sensor_to_vehicle_rotation_dcm_response* self); +void extract_mip_filter_sensor_to_vehicle_rotation_dcm_response(microstrain_serializer* serializer, mip_filter_sensor_to_vehicle_rotation_dcm_response* self); + +mip_cmd_result mip_filter_write_sensor_to_vehicle_rotation_dcm(mip_interface* device, const float* dcm); +mip_cmd_result mip_filter_read_sensor_to_vehicle_rotation_dcm(mip_interface* device, float* dcm_out); +mip_cmd_result mip_filter_save_sensor_to_vehicle_rotation_dcm(mip_interface* device); +mip_cmd_result mip_filter_load_sensor_to_vehicle_rotation_dcm(mip_interface* device); +mip_cmd_result mip_filter_default_sensor_to_vehicle_rotation_dcm(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_sensor_to_vehicle_rotation_quaternion (0x0D,0x4F) Sensor To Vehicle Rotation Quaternion [C] +///@defgroup filter_sensor_to_vehicle_rotation_quaternion_c (0x0D,0x4F) Sensor To Vehicle Rotation Quaternion /// Set the sensor to vehicle frame rotation using a quaternion. /// /// Note: This is the rotation, the inverse of the transformation. @@ -610,7 +671,7 @@ mip_cmd_result mip_filter_default_sensor_to_vehicle_rotation_dcm(struct mip_inte ///
/// Quaternion element definition:

///
-/// EQSTART Q_{SEN}^{VEH} = \begin{bmatrix} q_{0} & q_{1}*i & q_{2}*j & q_{3}*k \end{bmatrix} EQEND +/// EQSTART Q_{SEN}^{VEH} = \\begin{bmatrix} q_{0} & q_{1}*i & q_{2}*j & q_{3}*k \\end{bmatrix} EQEND ///

/// This rotation affects the following output quantities:

/// IMU:
@@ -634,31 +695,31 @@ struct mip_filter_sensor_to_vehicle_rotation_quaternion_command { mip_function_selector function; mip_quatf quat; - }; typedef struct mip_filter_sensor_to_vehicle_rotation_quaternion_command mip_filter_sensor_to_vehicle_rotation_quaternion_command; -void insert_mip_filter_sensor_to_vehicle_rotation_quaternion_command(struct mip_serializer* serializer, const mip_filter_sensor_to_vehicle_rotation_quaternion_command* self); -void extract_mip_filter_sensor_to_vehicle_rotation_quaternion_command(struct mip_serializer* serializer, mip_filter_sensor_to_vehicle_rotation_quaternion_command* self); + +void insert_mip_filter_sensor_to_vehicle_rotation_quaternion_command(microstrain_serializer* serializer, const mip_filter_sensor_to_vehicle_rotation_quaternion_command* self); +void extract_mip_filter_sensor_to_vehicle_rotation_quaternion_command(microstrain_serializer* serializer, mip_filter_sensor_to_vehicle_rotation_quaternion_command* self); struct mip_filter_sensor_to_vehicle_rotation_quaternion_response { mip_quatf quat; - }; typedef struct mip_filter_sensor_to_vehicle_rotation_quaternion_response mip_filter_sensor_to_vehicle_rotation_quaternion_response; -void insert_mip_filter_sensor_to_vehicle_rotation_quaternion_response(struct mip_serializer* serializer, const mip_filter_sensor_to_vehicle_rotation_quaternion_response* self); -void extract_mip_filter_sensor_to_vehicle_rotation_quaternion_response(struct mip_serializer* serializer, mip_filter_sensor_to_vehicle_rotation_quaternion_response* self); -mip_cmd_result mip_filter_write_sensor_to_vehicle_rotation_quaternion(struct mip_interface* device, const float* quat); -mip_cmd_result mip_filter_read_sensor_to_vehicle_rotation_quaternion(struct mip_interface* device, float* quat_out); -mip_cmd_result mip_filter_save_sensor_to_vehicle_rotation_quaternion(struct mip_interface* device); -mip_cmd_result mip_filter_load_sensor_to_vehicle_rotation_quaternion(struct mip_interface* device); -mip_cmd_result mip_filter_default_sensor_to_vehicle_rotation_quaternion(struct mip_interface* device); +void insert_mip_filter_sensor_to_vehicle_rotation_quaternion_response(microstrain_serializer* serializer, const mip_filter_sensor_to_vehicle_rotation_quaternion_response* self); +void extract_mip_filter_sensor_to_vehicle_rotation_quaternion_response(microstrain_serializer* serializer, mip_filter_sensor_to_vehicle_rotation_quaternion_response* self); + +mip_cmd_result mip_filter_write_sensor_to_vehicle_rotation_quaternion(mip_interface* device, const float* quat); +mip_cmd_result mip_filter_read_sensor_to_vehicle_rotation_quaternion(mip_interface* device, float* quat_out); +mip_cmd_result mip_filter_save_sensor_to_vehicle_rotation_quaternion(mip_interface* device); +mip_cmd_result mip_filter_load_sensor_to_vehicle_rotation_quaternion(mip_interface* device); +mip_cmd_result mip_filter_default_sensor_to_vehicle_rotation_quaternion(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_sensor_to_vehicle_offset (0x0D,0x12) Sensor To Vehicle Offset [C] +///@defgroup filter_sensor_to_vehicle_offset_c (0x0D,0x12) Sensor To Vehicle Offset /// Set the sensor to vehicle frame offset, expressed in the sensor frame. /// /// This is a simple offset, not a lever arm. It does not compensate for inertial effects experienced from being offset from the center of gravity/rotation of the vehicle. @@ -675,34 +736,38 @@ struct mip_filter_sensor_to_vehicle_offset_command { mip_function_selector function; mip_vector3f offset; ///< [meters] - }; typedef struct mip_filter_sensor_to_vehicle_offset_command mip_filter_sensor_to_vehicle_offset_command; -void insert_mip_filter_sensor_to_vehicle_offset_command(struct mip_serializer* serializer, const mip_filter_sensor_to_vehicle_offset_command* self); -void extract_mip_filter_sensor_to_vehicle_offset_command(struct mip_serializer* serializer, mip_filter_sensor_to_vehicle_offset_command* self); + +void insert_mip_filter_sensor_to_vehicle_offset_command(microstrain_serializer* serializer, const mip_filter_sensor_to_vehicle_offset_command* self); +void extract_mip_filter_sensor_to_vehicle_offset_command(microstrain_serializer* serializer, mip_filter_sensor_to_vehicle_offset_command* self); struct mip_filter_sensor_to_vehicle_offset_response { mip_vector3f offset; ///< [meters] - }; typedef struct mip_filter_sensor_to_vehicle_offset_response mip_filter_sensor_to_vehicle_offset_response; -void insert_mip_filter_sensor_to_vehicle_offset_response(struct mip_serializer* serializer, const mip_filter_sensor_to_vehicle_offset_response* self); -void extract_mip_filter_sensor_to_vehicle_offset_response(struct mip_serializer* serializer, mip_filter_sensor_to_vehicle_offset_response* self); -mip_cmd_result mip_filter_write_sensor_to_vehicle_offset(struct mip_interface* device, const float* offset); -mip_cmd_result mip_filter_read_sensor_to_vehicle_offset(struct mip_interface* device, float* offset_out); -mip_cmd_result mip_filter_save_sensor_to_vehicle_offset(struct mip_interface* device); -mip_cmd_result mip_filter_load_sensor_to_vehicle_offset(struct mip_interface* device); -mip_cmd_result mip_filter_default_sensor_to_vehicle_offset(struct mip_interface* device); +void insert_mip_filter_sensor_to_vehicle_offset_response(microstrain_serializer* serializer, const mip_filter_sensor_to_vehicle_offset_response* self); +void extract_mip_filter_sensor_to_vehicle_offset_response(microstrain_serializer* serializer, mip_filter_sensor_to_vehicle_offset_response* self); + +mip_cmd_result mip_filter_write_sensor_to_vehicle_offset(mip_interface* device, const float* offset); +mip_cmd_result mip_filter_read_sensor_to_vehicle_offset(mip_interface* device, float* offset_out); +mip_cmd_result mip_filter_save_sensor_to_vehicle_offset(mip_interface* device); +mip_cmd_result mip_filter_load_sensor_to_vehicle_offset(mip_interface* device); +mip_cmd_result mip_filter_default_sensor_to_vehicle_offset(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_antenna_offset (0x0D,0x13) Antenna Offset [C] -/// Set the sensor to GNSS antenna offset. +///@defgroup filter_antenna_offset_c (0x0D,0x13) Antenna Offset +/// Configure the GNSS antenna offset. +/// +/// For 5-series products, this is expressed in the sensor frame, from the sensor origin to the GNSS antenna RF center. +/// +/// For 7-series products, this is expressed in the vehicle frame, from the sensor origin to the GNSS antenna RF center. /// -/// This is expressed in the sensor frame, from the sensor origin to the GNSS antenna RF center. +/// This command should also be used for CV7 / GV7-INS NMEA Input over GPIO. /// /// The magnitude of the offset vector is limited to 10 meters /// @@ -713,31 +778,31 @@ struct mip_filter_antenna_offset_command { mip_function_selector function; mip_vector3f offset; ///< [meters] - }; typedef struct mip_filter_antenna_offset_command mip_filter_antenna_offset_command; -void insert_mip_filter_antenna_offset_command(struct mip_serializer* serializer, const mip_filter_antenna_offset_command* self); -void extract_mip_filter_antenna_offset_command(struct mip_serializer* serializer, mip_filter_antenna_offset_command* self); + +void insert_mip_filter_antenna_offset_command(microstrain_serializer* serializer, const mip_filter_antenna_offset_command* self); +void extract_mip_filter_antenna_offset_command(microstrain_serializer* serializer, mip_filter_antenna_offset_command* self); struct mip_filter_antenna_offset_response { mip_vector3f offset; ///< [meters] - }; typedef struct mip_filter_antenna_offset_response mip_filter_antenna_offset_response; -void insert_mip_filter_antenna_offset_response(struct mip_serializer* serializer, const mip_filter_antenna_offset_response* self); -void extract_mip_filter_antenna_offset_response(struct mip_serializer* serializer, mip_filter_antenna_offset_response* self); -mip_cmd_result mip_filter_write_antenna_offset(struct mip_interface* device, const float* offset); -mip_cmd_result mip_filter_read_antenna_offset(struct mip_interface* device, float* offset_out); -mip_cmd_result mip_filter_save_antenna_offset(struct mip_interface* device); -mip_cmd_result mip_filter_load_antenna_offset(struct mip_interface* device); -mip_cmd_result mip_filter_default_antenna_offset(struct mip_interface* device); +void insert_mip_filter_antenna_offset_response(microstrain_serializer* serializer, const mip_filter_antenna_offset_response* self); +void extract_mip_filter_antenna_offset_response(microstrain_serializer* serializer, mip_filter_antenna_offset_response* self); + +mip_cmd_result mip_filter_write_antenna_offset(mip_interface* device, const float* offset); +mip_cmd_result mip_filter_read_antenna_offset(mip_interface* device, float* offset_out); +mip_cmd_result mip_filter_save_antenna_offset(mip_interface* device); +mip_cmd_result mip_filter_load_antenna_offset(mip_interface* device); +mip_cmd_result mip_filter_default_antenna_offset(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_gnss_source (0x0D,0x15) Gnss Source [C] +///@defgroup filter_gnss_source_c (0x0D,0x15) Gnss Source /// Control the source of GNSS information used to update the Kalman Filter. /// /// Changing the GNSS source while the sensor is in the "running" state may temporarily place @@ -746,44 +811,56 @@ mip_cmd_result mip_filter_default_antenna_offset(struct mip_interface* device); /// ///@{ -typedef uint8_t mip_filter_gnss_source_command_source; -static const mip_filter_gnss_source_command_source MIP_FILTER_GNSS_SOURCE_COMMAND_SOURCE_ALL_INT = 1; ///< All internal receivers -static const mip_filter_gnss_source_command_source MIP_FILTER_GNSS_SOURCE_COMMAND_SOURCE_EXT = 2; ///< External GNSS messages provided by user -static const mip_filter_gnss_source_command_source MIP_FILTER_GNSS_SOURCE_COMMAND_SOURCE_INT_1 = 3; ///< Internal GNSS Receiver 1 only -static const mip_filter_gnss_source_command_source MIP_FILTER_GNSS_SOURCE_COMMAND_SOURCE_INT_2 = 4; ///< Internal GNSS Receiver 2 only +enum mip_filter_gnss_source_command_source +{ + MIP_FILTER_GNSS_SOURCE_COMMAND_SOURCE_ALL_INT = 1, ///< All internal receivers + MIP_FILTER_GNSS_SOURCE_COMMAND_SOURCE_EXT = 2, ///< External GNSS messages provided by user + MIP_FILTER_GNSS_SOURCE_COMMAND_SOURCE_INT_1 = 3, ///< Internal GNSS Receiver 1 only + MIP_FILTER_GNSS_SOURCE_COMMAND_SOURCE_INT_2 = 4, ///< Internal GNSS Receiver 2 only +}; +typedef enum mip_filter_gnss_source_command_source mip_filter_gnss_source_command_source; + +static inline void insert_mip_filter_gnss_source_command_source(microstrain_serializer* serializer, const mip_filter_gnss_source_command_source self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_filter_gnss_source_command_source(microstrain_serializer* serializer, mip_filter_gnss_source_command_source* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} + struct mip_filter_gnss_source_command { mip_function_selector function; mip_filter_gnss_source_command_source source; - }; typedef struct mip_filter_gnss_source_command mip_filter_gnss_source_command; -void insert_mip_filter_gnss_source_command(struct mip_serializer* serializer, const mip_filter_gnss_source_command* self); -void extract_mip_filter_gnss_source_command(struct mip_serializer* serializer, mip_filter_gnss_source_command* self); -void insert_mip_filter_gnss_source_command_source(struct mip_serializer* serializer, const mip_filter_gnss_source_command_source self); -void extract_mip_filter_gnss_source_command_source(struct mip_serializer* serializer, mip_filter_gnss_source_command_source* self); +void insert_mip_filter_gnss_source_command(microstrain_serializer* serializer, const mip_filter_gnss_source_command* self); +void extract_mip_filter_gnss_source_command(microstrain_serializer* serializer, mip_filter_gnss_source_command* self); struct mip_filter_gnss_source_response { mip_filter_gnss_source_command_source source; - }; typedef struct mip_filter_gnss_source_response mip_filter_gnss_source_response; -void insert_mip_filter_gnss_source_response(struct mip_serializer* serializer, const mip_filter_gnss_source_response* self); -void extract_mip_filter_gnss_source_response(struct mip_serializer* serializer, mip_filter_gnss_source_response* self); -mip_cmd_result mip_filter_write_gnss_source(struct mip_interface* device, mip_filter_gnss_source_command_source source); -mip_cmd_result mip_filter_read_gnss_source(struct mip_interface* device, mip_filter_gnss_source_command_source* source_out); -mip_cmd_result mip_filter_save_gnss_source(struct mip_interface* device); -mip_cmd_result mip_filter_load_gnss_source(struct mip_interface* device); -mip_cmd_result mip_filter_default_gnss_source(struct mip_interface* device); +void insert_mip_filter_gnss_source_response(microstrain_serializer* serializer, const mip_filter_gnss_source_response* self); +void extract_mip_filter_gnss_source_response(microstrain_serializer* serializer, mip_filter_gnss_source_response* self); + +mip_cmd_result mip_filter_write_gnss_source(mip_interface* device, mip_filter_gnss_source_command_source source); +mip_cmd_result mip_filter_read_gnss_source(mip_interface* device, mip_filter_gnss_source_command_source* source_out); +mip_cmd_result mip_filter_save_gnss_source(mip_interface* device); +mip_cmd_result mip_filter_load_gnss_source(mip_interface* device); +mip_cmd_result mip_filter_default_gnss_source(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_heading_source (0x0D,0x18) Heading Source [C] +///@defgroup filter_heading_source_c (0x0D,0x18) Heading Source /// Control the source of heading information used to update the Kalman Filter. /// /// 1. To use internal GNSS velocity vector for heading updates, the target application @@ -799,48 +876,60 @@ mip_cmd_result mip_filter_default_gnss_source(struct mip_interface* device); /// ///@{ -typedef uint8_t mip_filter_heading_source_command_source; -static const mip_filter_heading_source_command_source MIP_FILTER_HEADING_SOURCE_COMMAND_SOURCE_NONE = 0; ///< See note 3 -static const mip_filter_heading_source_command_source MIP_FILTER_HEADING_SOURCE_COMMAND_SOURCE_MAG = 1; ///< -static const mip_filter_heading_source_command_source MIP_FILTER_HEADING_SOURCE_COMMAND_SOURCE_GNSS_VEL = 2; ///< See notes 1,2 -static const mip_filter_heading_source_command_source MIP_FILTER_HEADING_SOURCE_COMMAND_SOURCE_EXTERNAL = 3; ///< -static const mip_filter_heading_source_command_source MIP_FILTER_HEADING_SOURCE_COMMAND_SOURCE_GNSS_VEL_AND_MAG = 4; ///< -static const mip_filter_heading_source_command_source MIP_FILTER_HEADING_SOURCE_COMMAND_SOURCE_GNSS_VEL_AND_EXTERNAL = 5; ///< -static const mip_filter_heading_source_command_source MIP_FILTER_HEADING_SOURCE_COMMAND_SOURCE_MAG_AND_EXTERNAL = 6; ///< -static const mip_filter_heading_source_command_source MIP_FILTER_HEADING_SOURCE_COMMAND_SOURCE_GNSS_VEL_AND_MAG_AND_EXTERNAL = 7; ///< +enum mip_filter_heading_source_command_source +{ + MIP_FILTER_HEADING_SOURCE_COMMAND_SOURCE_NONE = 0, ///< See note 3 + MIP_FILTER_HEADING_SOURCE_COMMAND_SOURCE_MAG = 1, ///< + MIP_FILTER_HEADING_SOURCE_COMMAND_SOURCE_GNSS_VEL = 2, ///< See notes 1,2 + MIP_FILTER_HEADING_SOURCE_COMMAND_SOURCE_EXTERNAL = 3, ///< + MIP_FILTER_HEADING_SOURCE_COMMAND_SOURCE_GNSS_VEL_AND_MAG = 4, ///< + MIP_FILTER_HEADING_SOURCE_COMMAND_SOURCE_GNSS_VEL_AND_EXTERNAL = 5, ///< + MIP_FILTER_HEADING_SOURCE_COMMAND_SOURCE_MAG_AND_EXTERNAL = 6, ///< + MIP_FILTER_HEADING_SOURCE_COMMAND_SOURCE_GNSS_VEL_AND_MAG_AND_EXTERNAL = 7, ///< +}; +typedef enum mip_filter_heading_source_command_source mip_filter_heading_source_command_source; + +static inline void insert_mip_filter_heading_source_command_source(microstrain_serializer* serializer, const mip_filter_heading_source_command_source self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_filter_heading_source_command_source(microstrain_serializer* serializer, mip_filter_heading_source_command_source* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} + struct mip_filter_heading_source_command { mip_function_selector function; mip_filter_heading_source_command_source source; - }; typedef struct mip_filter_heading_source_command mip_filter_heading_source_command; -void insert_mip_filter_heading_source_command(struct mip_serializer* serializer, const mip_filter_heading_source_command* self); -void extract_mip_filter_heading_source_command(struct mip_serializer* serializer, mip_filter_heading_source_command* self); -void insert_mip_filter_heading_source_command_source(struct mip_serializer* serializer, const mip_filter_heading_source_command_source self); -void extract_mip_filter_heading_source_command_source(struct mip_serializer* serializer, mip_filter_heading_source_command_source* self); +void insert_mip_filter_heading_source_command(microstrain_serializer* serializer, const mip_filter_heading_source_command* self); +void extract_mip_filter_heading_source_command(microstrain_serializer* serializer, mip_filter_heading_source_command* self); struct mip_filter_heading_source_response { mip_filter_heading_source_command_source source; - }; typedef struct mip_filter_heading_source_response mip_filter_heading_source_response; -void insert_mip_filter_heading_source_response(struct mip_serializer* serializer, const mip_filter_heading_source_response* self); -void extract_mip_filter_heading_source_response(struct mip_serializer* serializer, mip_filter_heading_source_response* self); -mip_cmd_result mip_filter_write_heading_source(struct mip_interface* device, mip_filter_heading_source_command_source source); -mip_cmd_result mip_filter_read_heading_source(struct mip_interface* device, mip_filter_heading_source_command_source* source_out); -mip_cmd_result mip_filter_save_heading_source(struct mip_interface* device); -mip_cmd_result mip_filter_load_heading_source(struct mip_interface* device); -mip_cmd_result mip_filter_default_heading_source(struct mip_interface* device); +void insert_mip_filter_heading_source_response(microstrain_serializer* serializer, const mip_filter_heading_source_response* self); +void extract_mip_filter_heading_source_response(microstrain_serializer* serializer, mip_filter_heading_source_response* self); + +mip_cmd_result mip_filter_write_heading_source(mip_interface* device, mip_filter_heading_source_command_source source); +mip_cmd_result mip_filter_read_heading_source(mip_interface* device, mip_filter_heading_source_command_source* source_out); +mip_cmd_result mip_filter_save_heading_source(mip_interface* device); +mip_cmd_result mip_filter_load_heading_source(mip_interface* device); +mip_cmd_result mip_filter_default_heading_source(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_auto_init_control (0x0D,0x19) Auto Init Control [C] +///@defgroup filter_auto_init_control_c (0x0D,0x19) Auto Init Control /// Filter Auto-initialization Control /// /// Enable/Disable automatic initialization upon device startup. @@ -857,31 +946,31 @@ struct mip_filter_auto_init_control_command { mip_function_selector function; uint8_t enable; ///< See above - }; typedef struct mip_filter_auto_init_control_command mip_filter_auto_init_control_command; -void insert_mip_filter_auto_init_control_command(struct mip_serializer* serializer, const mip_filter_auto_init_control_command* self); -void extract_mip_filter_auto_init_control_command(struct mip_serializer* serializer, mip_filter_auto_init_control_command* self); + +void insert_mip_filter_auto_init_control_command(microstrain_serializer* serializer, const mip_filter_auto_init_control_command* self); +void extract_mip_filter_auto_init_control_command(microstrain_serializer* serializer, mip_filter_auto_init_control_command* self); struct mip_filter_auto_init_control_response { uint8_t enable; ///< See above - }; typedef struct mip_filter_auto_init_control_response mip_filter_auto_init_control_response; -void insert_mip_filter_auto_init_control_response(struct mip_serializer* serializer, const mip_filter_auto_init_control_response* self); -void extract_mip_filter_auto_init_control_response(struct mip_serializer* serializer, mip_filter_auto_init_control_response* self); -mip_cmd_result mip_filter_write_auto_init_control(struct mip_interface* device, uint8_t enable); -mip_cmd_result mip_filter_read_auto_init_control(struct mip_interface* device, uint8_t* enable_out); -mip_cmd_result mip_filter_save_auto_init_control(struct mip_interface* device); -mip_cmd_result mip_filter_load_auto_init_control(struct mip_interface* device); -mip_cmd_result mip_filter_default_auto_init_control(struct mip_interface* device); +void insert_mip_filter_auto_init_control_response(microstrain_serializer* serializer, const mip_filter_auto_init_control_response* self); +void extract_mip_filter_auto_init_control_response(microstrain_serializer* serializer, mip_filter_auto_init_control_response* self); + +mip_cmd_result mip_filter_write_auto_init_control(mip_interface* device, uint8_t enable); +mip_cmd_result mip_filter_read_auto_init_control(mip_interface* device, uint8_t* enable_out); +mip_cmd_result mip_filter_save_auto_init_control(mip_interface* device); +mip_cmd_result mip_filter_load_auto_init_control(mip_interface* device); +mip_cmd_result mip_filter_default_auto_init_control(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_accel_noise (0x0D,0x1A) Accel Noise [C] +///@defgroup filter_accel_noise_c (0x0D,0x1A) Accel Noise /// Accelerometer Noise Standard Deviation /// /// Each of the noise values must be greater than 0.0. @@ -896,31 +985,31 @@ struct mip_filter_accel_noise_command { mip_function_selector function; mip_vector3f noise; ///< Accel Noise 1-sigma [meters/second^2] - }; typedef struct mip_filter_accel_noise_command mip_filter_accel_noise_command; -void insert_mip_filter_accel_noise_command(struct mip_serializer* serializer, const mip_filter_accel_noise_command* self); -void extract_mip_filter_accel_noise_command(struct mip_serializer* serializer, mip_filter_accel_noise_command* self); + +void insert_mip_filter_accel_noise_command(microstrain_serializer* serializer, const mip_filter_accel_noise_command* self); +void extract_mip_filter_accel_noise_command(microstrain_serializer* serializer, mip_filter_accel_noise_command* self); struct mip_filter_accel_noise_response { mip_vector3f noise; ///< Accel Noise 1-sigma [meters/second^2] - }; typedef struct mip_filter_accel_noise_response mip_filter_accel_noise_response; -void insert_mip_filter_accel_noise_response(struct mip_serializer* serializer, const mip_filter_accel_noise_response* self); -void extract_mip_filter_accel_noise_response(struct mip_serializer* serializer, mip_filter_accel_noise_response* self); -mip_cmd_result mip_filter_write_accel_noise(struct mip_interface* device, const float* noise); -mip_cmd_result mip_filter_read_accel_noise(struct mip_interface* device, float* noise_out); -mip_cmd_result mip_filter_save_accel_noise(struct mip_interface* device); -mip_cmd_result mip_filter_load_accel_noise(struct mip_interface* device); -mip_cmd_result mip_filter_default_accel_noise(struct mip_interface* device); +void insert_mip_filter_accel_noise_response(microstrain_serializer* serializer, const mip_filter_accel_noise_response* self); +void extract_mip_filter_accel_noise_response(microstrain_serializer* serializer, mip_filter_accel_noise_response* self); + +mip_cmd_result mip_filter_write_accel_noise(mip_interface* device, const float* noise); +mip_cmd_result mip_filter_read_accel_noise(mip_interface* device, float* noise_out); +mip_cmd_result mip_filter_save_accel_noise(mip_interface* device); +mip_cmd_result mip_filter_load_accel_noise(mip_interface* device); +mip_cmd_result mip_filter_default_accel_noise(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_gyro_noise (0x0D,0x1B) Gyro Noise [C] +///@defgroup filter_gyro_noise_c (0x0D,0x1B) Gyro Noise /// Gyroscope Noise Standard Deviation /// /// Each of the noise values must be greater than 0.0 @@ -935,31 +1024,31 @@ struct mip_filter_gyro_noise_command { mip_function_selector function; mip_vector3f noise; ///< Gyro Noise 1-sigma [rad/second] - }; typedef struct mip_filter_gyro_noise_command mip_filter_gyro_noise_command; -void insert_mip_filter_gyro_noise_command(struct mip_serializer* serializer, const mip_filter_gyro_noise_command* self); -void extract_mip_filter_gyro_noise_command(struct mip_serializer* serializer, mip_filter_gyro_noise_command* self); + +void insert_mip_filter_gyro_noise_command(microstrain_serializer* serializer, const mip_filter_gyro_noise_command* self); +void extract_mip_filter_gyro_noise_command(microstrain_serializer* serializer, mip_filter_gyro_noise_command* self); struct mip_filter_gyro_noise_response { mip_vector3f noise; ///< Gyro Noise 1-sigma [rad/second] - }; typedef struct mip_filter_gyro_noise_response mip_filter_gyro_noise_response; -void insert_mip_filter_gyro_noise_response(struct mip_serializer* serializer, const mip_filter_gyro_noise_response* self); -void extract_mip_filter_gyro_noise_response(struct mip_serializer* serializer, mip_filter_gyro_noise_response* self); -mip_cmd_result mip_filter_write_gyro_noise(struct mip_interface* device, const float* noise); -mip_cmd_result mip_filter_read_gyro_noise(struct mip_interface* device, float* noise_out); -mip_cmd_result mip_filter_save_gyro_noise(struct mip_interface* device); -mip_cmd_result mip_filter_load_gyro_noise(struct mip_interface* device); -mip_cmd_result mip_filter_default_gyro_noise(struct mip_interface* device); +void insert_mip_filter_gyro_noise_response(microstrain_serializer* serializer, const mip_filter_gyro_noise_response* self); +void extract_mip_filter_gyro_noise_response(microstrain_serializer* serializer, mip_filter_gyro_noise_response* self); + +mip_cmd_result mip_filter_write_gyro_noise(mip_interface* device, const float* noise); +mip_cmd_result mip_filter_read_gyro_noise(mip_interface* device, float* noise_out); +mip_cmd_result mip_filter_save_gyro_noise(mip_interface* device); +mip_cmd_result mip_filter_load_gyro_noise(mip_interface* device); +mip_cmd_result mip_filter_default_gyro_noise(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_accel_bias_model (0x0D,0x1C) Accel Bias Model [C] +///@defgroup filter_accel_bias_model_c (0x0D,0x1C) Accel Bias Model /// Accelerometer Bias Model Parameters /// /// Noise values must be greater than 0.0 @@ -972,32 +1061,32 @@ struct mip_filter_accel_bias_model_command mip_function_selector function; mip_vector3f beta; ///< Accel Bias Beta [1/second] mip_vector3f noise; ///< Accel Noise 1-sigma [meters/second^2] - }; typedef struct mip_filter_accel_bias_model_command mip_filter_accel_bias_model_command; -void insert_mip_filter_accel_bias_model_command(struct mip_serializer* serializer, const mip_filter_accel_bias_model_command* self); -void extract_mip_filter_accel_bias_model_command(struct mip_serializer* serializer, mip_filter_accel_bias_model_command* self); + +void insert_mip_filter_accel_bias_model_command(microstrain_serializer* serializer, const mip_filter_accel_bias_model_command* self); +void extract_mip_filter_accel_bias_model_command(microstrain_serializer* serializer, mip_filter_accel_bias_model_command* self); struct mip_filter_accel_bias_model_response { mip_vector3f beta; ///< Accel Bias Beta [1/second] mip_vector3f noise; ///< Accel Noise 1-sigma [meters/second^2] - }; typedef struct mip_filter_accel_bias_model_response mip_filter_accel_bias_model_response; -void insert_mip_filter_accel_bias_model_response(struct mip_serializer* serializer, const mip_filter_accel_bias_model_response* self); -void extract_mip_filter_accel_bias_model_response(struct mip_serializer* serializer, mip_filter_accel_bias_model_response* self); -mip_cmd_result mip_filter_write_accel_bias_model(struct mip_interface* device, const float* beta, const float* noise); -mip_cmd_result mip_filter_read_accel_bias_model(struct mip_interface* device, float* beta_out, float* noise_out); -mip_cmd_result mip_filter_save_accel_bias_model(struct mip_interface* device); -mip_cmd_result mip_filter_load_accel_bias_model(struct mip_interface* device); -mip_cmd_result mip_filter_default_accel_bias_model(struct mip_interface* device); +void insert_mip_filter_accel_bias_model_response(microstrain_serializer* serializer, const mip_filter_accel_bias_model_response* self); +void extract_mip_filter_accel_bias_model_response(microstrain_serializer* serializer, mip_filter_accel_bias_model_response* self); + +mip_cmd_result mip_filter_write_accel_bias_model(mip_interface* device, const float* beta, const float* noise); +mip_cmd_result mip_filter_read_accel_bias_model(mip_interface* device, float* beta_out, float* noise_out); +mip_cmd_result mip_filter_save_accel_bias_model(mip_interface* device); +mip_cmd_result mip_filter_load_accel_bias_model(mip_interface* device); +mip_cmd_result mip_filter_default_accel_bias_model(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_gyro_bias_model (0x0D,0x1D) Gyro Bias Model [C] +///@defgroup filter_gyro_bias_model_c (0x0D,0x1D) Gyro Bias Model /// Gyroscope Bias Model Parameters /// /// Noise values must be greater than 0.0 @@ -1010,32 +1099,32 @@ struct mip_filter_gyro_bias_model_command mip_function_selector function; mip_vector3f beta; ///< Gyro Bias Beta [1/second] mip_vector3f noise; ///< Gyro Noise 1-sigma [rad/second] - }; typedef struct mip_filter_gyro_bias_model_command mip_filter_gyro_bias_model_command; -void insert_mip_filter_gyro_bias_model_command(struct mip_serializer* serializer, const mip_filter_gyro_bias_model_command* self); -void extract_mip_filter_gyro_bias_model_command(struct mip_serializer* serializer, mip_filter_gyro_bias_model_command* self); + +void insert_mip_filter_gyro_bias_model_command(microstrain_serializer* serializer, const mip_filter_gyro_bias_model_command* self); +void extract_mip_filter_gyro_bias_model_command(microstrain_serializer* serializer, mip_filter_gyro_bias_model_command* self); struct mip_filter_gyro_bias_model_response { mip_vector3f beta; ///< Gyro Bias Beta [1/second] mip_vector3f noise; ///< Gyro Noise 1-sigma [rad/second] - }; typedef struct mip_filter_gyro_bias_model_response mip_filter_gyro_bias_model_response; -void insert_mip_filter_gyro_bias_model_response(struct mip_serializer* serializer, const mip_filter_gyro_bias_model_response* self); -void extract_mip_filter_gyro_bias_model_response(struct mip_serializer* serializer, mip_filter_gyro_bias_model_response* self); -mip_cmd_result mip_filter_write_gyro_bias_model(struct mip_interface* device, const float* beta, const float* noise); -mip_cmd_result mip_filter_read_gyro_bias_model(struct mip_interface* device, float* beta_out, float* noise_out); -mip_cmd_result mip_filter_save_gyro_bias_model(struct mip_interface* device); -mip_cmd_result mip_filter_load_gyro_bias_model(struct mip_interface* device); -mip_cmd_result mip_filter_default_gyro_bias_model(struct mip_interface* device); +void insert_mip_filter_gyro_bias_model_response(microstrain_serializer* serializer, const mip_filter_gyro_bias_model_response* self); +void extract_mip_filter_gyro_bias_model_response(microstrain_serializer* serializer, mip_filter_gyro_bias_model_response* self); + +mip_cmd_result mip_filter_write_gyro_bias_model(mip_interface* device, const float* beta, const float* noise); +mip_cmd_result mip_filter_read_gyro_bias_model(mip_interface* device, float* beta_out, float* noise_out); +mip_cmd_result mip_filter_save_gyro_bias_model(mip_interface* device); +mip_cmd_result mip_filter_load_gyro_bias_model(mip_interface* device); +mip_cmd_result mip_filter_default_gyro_bias_model(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_altitude_aiding (0x0D,0x47) Altitude Aiding [C] +///@defgroup filter_altitude_aiding_c (0x0D,0x47) Altitude Aiding /// Select altitude input for absolute altitude and/or vertical velocity. The primary altitude reading is always GNSS. /// Aiding inputs are used to improve GNSS altitude readings when GNSS is available and to backup GNSS during outages. /// @@ -1044,83 +1133,107 @@ mip_cmd_result mip_filter_default_gyro_bias_model(struct mip_interface* device); /// ///@{ -typedef uint8_t mip_filter_altitude_aiding_command_aiding_selector; -static const mip_filter_altitude_aiding_command_aiding_selector MIP_FILTER_ALTITUDE_AIDING_COMMAND_AIDING_SELECTOR_NONE = 0; ///< No altitude aiding -static const mip_filter_altitude_aiding_command_aiding_selector MIP_FILTER_ALTITUDE_AIDING_COMMAND_AIDING_SELECTOR_PRESURE = 1; ///< Enable pressure sensor aiding +enum mip_filter_altitude_aiding_command_aiding_selector +{ + MIP_FILTER_ALTITUDE_AIDING_COMMAND_AIDING_SELECTOR_NONE = 0, ///< No altitude aiding + MIP_FILTER_ALTITUDE_AIDING_COMMAND_AIDING_SELECTOR_PRESURE = 1, ///< Enable pressure sensor aiding +}; +typedef enum mip_filter_altitude_aiding_command_aiding_selector mip_filter_altitude_aiding_command_aiding_selector; + +static inline void insert_mip_filter_altitude_aiding_command_aiding_selector(microstrain_serializer* serializer, const mip_filter_altitude_aiding_command_aiding_selector self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_filter_altitude_aiding_command_aiding_selector(microstrain_serializer* serializer, mip_filter_altitude_aiding_command_aiding_selector* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} + struct mip_filter_altitude_aiding_command { mip_function_selector function; mip_filter_altitude_aiding_command_aiding_selector selector; ///< See above - }; typedef struct mip_filter_altitude_aiding_command mip_filter_altitude_aiding_command; -void insert_mip_filter_altitude_aiding_command(struct mip_serializer* serializer, const mip_filter_altitude_aiding_command* self); -void extract_mip_filter_altitude_aiding_command(struct mip_serializer* serializer, mip_filter_altitude_aiding_command* self); -void insert_mip_filter_altitude_aiding_command_aiding_selector(struct mip_serializer* serializer, const mip_filter_altitude_aiding_command_aiding_selector self); -void extract_mip_filter_altitude_aiding_command_aiding_selector(struct mip_serializer* serializer, mip_filter_altitude_aiding_command_aiding_selector* self); +void insert_mip_filter_altitude_aiding_command(microstrain_serializer* serializer, const mip_filter_altitude_aiding_command* self); +void extract_mip_filter_altitude_aiding_command(microstrain_serializer* serializer, mip_filter_altitude_aiding_command* self); struct mip_filter_altitude_aiding_response { mip_filter_altitude_aiding_command_aiding_selector selector; ///< See above - }; typedef struct mip_filter_altitude_aiding_response mip_filter_altitude_aiding_response; -void insert_mip_filter_altitude_aiding_response(struct mip_serializer* serializer, const mip_filter_altitude_aiding_response* self); -void extract_mip_filter_altitude_aiding_response(struct mip_serializer* serializer, mip_filter_altitude_aiding_response* self); -mip_cmd_result mip_filter_write_altitude_aiding(struct mip_interface* device, mip_filter_altitude_aiding_command_aiding_selector selector); -mip_cmd_result mip_filter_read_altitude_aiding(struct mip_interface* device, mip_filter_altitude_aiding_command_aiding_selector* selector_out); -mip_cmd_result mip_filter_save_altitude_aiding(struct mip_interface* device); -mip_cmd_result mip_filter_load_altitude_aiding(struct mip_interface* device); -mip_cmd_result mip_filter_default_altitude_aiding(struct mip_interface* device); +void insert_mip_filter_altitude_aiding_response(microstrain_serializer* serializer, const mip_filter_altitude_aiding_response* self); +void extract_mip_filter_altitude_aiding_response(microstrain_serializer* serializer, mip_filter_altitude_aiding_response* self); + +mip_cmd_result mip_filter_write_altitude_aiding(mip_interface* device, mip_filter_altitude_aiding_command_aiding_selector selector); +mip_cmd_result mip_filter_read_altitude_aiding(mip_interface* device, mip_filter_altitude_aiding_command_aiding_selector* selector_out); +mip_cmd_result mip_filter_save_altitude_aiding(mip_interface* device); +mip_cmd_result mip_filter_load_altitude_aiding(mip_interface* device); +mip_cmd_result mip_filter_default_altitude_aiding(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_pitch_roll_aiding (0x0D,0x4B) Pitch Roll Aiding [C] +///@defgroup filter_pitch_roll_aiding_c (0x0D,0x4B) Pitch Roll Aiding /// Select pitch/roll aiding input. Pitch/roll reading is always derived from GNSS corrected inertial solution. /// Aiding inputs are used to improve that solution during periods of low dynamics and GNSS outages. /// ///@{ -typedef uint8_t mip_filter_pitch_roll_aiding_command_aiding_source; -static const mip_filter_pitch_roll_aiding_command_aiding_source MIP_FILTER_PITCH_ROLL_AIDING_COMMAND_AIDING_SOURCE_NONE = 0; ///< No pitch/roll aiding -static const mip_filter_pitch_roll_aiding_command_aiding_source MIP_FILTER_PITCH_ROLL_AIDING_COMMAND_AIDING_SOURCE_GRAVITY_VEC = 1; ///< Enable gravity vector aiding +enum mip_filter_pitch_roll_aiding_command_aiding_source +{ + MIP_FILTER_PITCH_ROLL_AIDING_COMMAND_AIDING_SOURCE_NONE = 0, ///< No pitch/roll aiding + MIP_FILTER_PITCH_ROLL_AIDING_COMMAND_AIDING_SOURCE_GRAVITY_VEC = 1, ///< Enable gravity vector aiding +}; +typedef enum mip_filter_pitch_roll_aiding_command_aiding_source mip_filter_pitch_roll_aiding_command_aiding_source; + +static inline void insert_mip_filter_pitch_roll_aiding_command_aiding_source(microstrain_serializer* serializer, const mip_filter_pitch_roll_aiding_command_aiding_source self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_filter_pitch_roll_aiding_command_aiding_source(microstrain_serializer* serializer, mip_filter_pitch_roll_aiding_command_aiding_source* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} + struct mip_filter_pitch_roll_aiding_command { mip_function_selector function; mip_filter_pitch_roll_aiding_command_aiding_source source; ///< Controls the aiding source - }; typedef struct mip_filter_pitch_roll_aiding_command mip_filter_pitch_roll_aiding_command; -void insert_mip_filter_pitch_roll_aiding_command(struct mip_serializer* serializer, const mip_filter_pitch_roll_aiding_command* self); -void extract_mip_filter_pitch_roll_aiding_command(struct mip_serializer* serializer, mip_filter_pitch_roll_aiding_command* self); -void insert_mip_filter_pitch_roll_aiding_command_aiding_source(struct mip_serializer* serializer, const mip_filter_pitch_roll_aiding_command_aiding_source self); -void extract_mip_filter_pitch_roll_aiding_command_aiding_source(struct mip_serializer* serializer, mip_filter_pitch_roll_aiding_command_aiding_source* self); +void insert_mip_filter_pitch_roll_aiding_command(microstrain_serializer* serializer, const mip_filter_pitch_roll_aiding_command* self); +void extract_mip_filter_pitch_roll_aiding_command(microstrain_serializer* serializer, mip_filter_pitch_roll_aiding_command* self); struct mip_filter_pitch_roll_aiding_response { mip_filter_pitch_roll_aiding_command_aiding_source source; ///< Controls the aiding source - }; typedef struct mip_filter_pitch_roll_aiding_response mip_filter_pitch_roll_aiding_response; -void insert_mip_filter_pitch_roll_aiding_response(struct mip_serializer* serializer, const mip_filter_pitch_roll_aiding_response* self); -void extract_mip_filter_pitch_roll_aiding_response(struct mip_serializer* serializer, mip_filter_pitch_roll_aiding_response* self); -mip_cmd_result mip_filter_write_pitch_roll_aiding(struct mip_interface* device, mip_filter_pitch_roll_aiding_command_aiding_source source); -mip_cmd_result mip_filter_read_pitch_roll_aiding(struct mip_interface* device, mip_filter_pitch_roll_aiding_command_aiding_source* source_out); -mip_cmd_result mip_filter_save_pitch_roll_aiding(struct mip_interface* device); -mip_cmd_result mip_filter_load_pitch_roll_aiding(struct mip_interface* device); -mip_cmd_result mip_filter_default_pitch_roll_aiding(struct mip_interface* device); +void insert_mip_filter_pitch_roll_aiding_response(microstrain_serializer* serializer, const mip_filter_pitch_roll_aiding_response* self); +void extract_mip_filter_pitch_roll_aiding_response(microstrain_serializer* serializer, mip_filter_pitch_roll_aiding_response* self); + +mip_cmd_result mip_filter_write_pitch_roll_aiding(mip_interface* device, mip_filter_pitch_roll_aiding_command_aiding_source source); +mip_cmd_result mip_filter_read_pitch_roll_aiding(mip_interface* device, mip_filter_pitch_roll_aiding_command_aiding_source* source_out); +mip_cmd_result mip_filter_save_pitch_roll_aiding(mip_interface* device); +mip_cmd_result mip_filter_load_pitch_roll_aiding(mip_interface* device); +mip_cmd_result mip_filter_default_pitch_roll_aiding(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_auto_zupt (0x0D,0x1E) Auto Zupt [C] +///@defgroup filter_auto_zupt_c (0x0D,0x1E) Auto Zupt /// The ZUPT is triggered when the scalar magnitude of the GNSS reported velocity vector is equal-to or less than the threshold value. /// The device will NACK threshold values that are less than zero (i.e.negative.) /// @@ -1131,32 +1244,32 @@ struct mip_filter_auto_zupt_command mip_function_selector function; uint8_t enable; ///< 0 - Disable, 1 - Enable float threshold; ///< [meters/second] - }; typedef struct mip_filter_auto_zupt_command mip_filter_auto_zupt_command; -void insert_mip_filter_auto_zupt_command(struct mip_serializer* serializer, const mip_filter_auto_zupt_command* self); -void extract_mip_filter_auto_zupt_command(struct mip_serializer* serializer, mip_filter_auto_zupt_command* self); + +void insert_mip_filter_auto_zupt_command(microstrain_serializer* serializer, const mip_filter_auto_zupt_command* self); +void extract_mip_filter_auto_zupt_command(microstrain_serializer* serializer, mip_filter_auto_zupt_command* self); struct mip_filter_auto_zupt_response { uint8_t enable; ///< 0 - Disable, 1 - Enable float threshold; ///< [meters/second] - }; typedef struct mip_filter_auto_zupt_response mip_filter_auto_zupt_response; -void insert_mip_filter_auto_zupt_response(struct mip_serializer* serializer, const mip_filter_auto_zupt_response* self); -void extract_mip_filter_auto_zupt_response(struct mip_serializer* serializer, mip_filter_auto_zupt_response* self); -mip_cmd_result mip_filter_write_auto_zupt(struct mip_interface* device, uint8_t enable, float threshold); -mip_cmd_result mip_filter_read_auto_zupt(struct mip_interface* device, uint8_t* enable_out, float* threshold_out); -mip_cmd_result mip_filter_save_auto_zupt(struct mip_interface* device); -mip_cmd_result mip_filter_load_auto_zupt(struct mip_interface* device); -mip_cmd_result mip_filter_default_auto_zupt(struct mip_interface* device); +void insert_mip_filter_auto_zupt_response(microstrain_serializer* serializer, const mip_filter_auto_zupt_response* self); +void extract_mip_filter_auto_zupt_response(microstrain_serializer* serializer, mip_filter_auto_zupt_response* self); + +mip_cmd_result mip_filter_write_auto_zupt(mip_interface* device, uint8_t enable, float threshold); +mip_cmd_result mip_filter_read_auto_zupt(mip_interface* device, uint8_t* enable_out, float* threshold_out); +mip_cmd_result mip_filter_save_auto_zupt(mip_interface* device); +mip_cmd_result mip_filter_load_auto_zupt(mip_interface* device); +mip_cmd_result mip_filter_default_auto_zupt(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_auto_angular_zupt (0x0D,0x20) Auto Angular Zupt [C] +///@defgroup filter_auto_angular_zupt_c (0x0D,0x20) Auto Angular Zupt /// Zero Angular Rate Update /// The ZUPT is triggered when the scalar magnitude of the angular rate vector is equal-to or less than the threshold value. /// The device will NACK threshold values that are less than zero (i.e.negative.) @@ -1168,52 +1281,56 @@ struct mip_filter_auto_angular_zupt_command mip_function_selector function; uint8_t enable; ///< 0 - Disable, 1 - Enable float threshold; ///< [radians/second] - }; typedef struct mip_filter_auto_angular_zupt_command mip_filter_auto_angular_zupt_command; -void insert_mip_filter_auto_angular_zupt_command(struct mip_serializer* serializer, const mip_filter_auto_angular_zupt_command* self); -void extract_mip_filter_auto_angular_zupt_command(struct mip_serializer* serializer, mip_filter_auto_angular_zupt_command* self); + +void insert_mip_filter_auto_angular_zupt_command(microstrain_serializer* serializer, const mip_filter_auto_angular_zupt_command* self); +void extract_mip_filter_auto_angular_zupt_command(microstrain_serializer* serializer, mip_filter_auto_angular_zupt_command* self); struct mip_filter_auto_angular_zupt_response { uint8_t enable; ///< 0 - Disable, 1 - Enable float threshold; ///< [radians/second] - }; typedef struct mip_filter_auto_angular_zupt_response mip_filter_auto_angular_zupt_response; -void insert_mip_filter_auto_angular_zupt_response(struct mip_serializer* serializer, const mip_filter_auto_angular_zupt_response* self); -void extract_mip_filter_auto_angular_zupt_response(struct mip_serializer* serializer, mip_filter_auto_angular_zupt_response* self); -mip_cmd_result mip_filter_write_auto_angular_zupt(struct mip_interface* device, uint8_t enable, float threshold); -mip_cmd_result mip_filter_read_auto_angular_zupt(struct mip_interface* device, uint8_t* enable_out, float* threshold_out); -mip_cmd_result mip_filter_save_auto_angular_zupt(struct mip_interface* device); -mip_cmd_result mip_filter_load_auto_angular_zupt(struct mip_interface* device); -mip_cmd_result mip_filter_default_auto_angular_zupt(struct mip_interface* device); +void insert_mip_filter_auto_angular_zupt_response(microstrain_serializer* serializer, const mip_filter_auto_angular_zupt_response* self); +void extract_mip_filter_auto_angular_zupt_response(microstrain_serializer* serializer, mip_filter_auto_angular_zupt_response* self); + +mip_cmd_result mip_filter_write_auto_angular_zupt(mip_interface* device, uint8_t enable, float threshold); +mip_cmd_result mip_filter_read_auto_angular_zupt(mip_interface* device, uint8_t* enable_out, float* threshold_out); +mip_cmd_result mip_filter_save_auto_angular_zupt(mip_interface* device); +mip_cmd_result mip_filter_load_auto_angular_zupt(mip_interface* device); +mip_cmd_result mip_filter_default_auto_angular_zupt(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_commanded_zupt (0x0D,0x22) Commanded Zupt [C] +///@defgroup filter_commanded_zupt_c (0x0D,0x22) Commanded Zupt /// Please see the device user manual for the maximum rate of this message. /// ///@{ -mip_cmd_result mip_filter_commanded_zupt(struct mip_interface* device); +typedef struct mip_filter_commanded_zupt_command mip_filter_commanded_zupt_command; ///< No parameters (empty struct not allowed in C) + +mip_cmd_result mip_filter_commanded_zupt(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_commanded_angular_zupt (0x0D,0x23) Commanded Angular Zupt [C] +///@defgroup filter_commanded_angular_zupt_c (0x0D,0x23) Commanded Angular Zupt /// Please see the device user manual for the maximum rate of this message. /// ///@{ -mip_cmd_result mip_filter_commanded_angular_zupt(struct mip_interface* device); +typedef struct mip_filter_commanded_angular_zupt_command mip_filter_commanded_angular_zupt_command; ///< No parameters (empty struct not allowed in C) + +mip_cmd_result mip_filter_commanded_angular_zupt(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_mag_capture_auto_cal (0x0D,0x27) Mag Capture Auto Cal [C] +///@defgroup filter_mag_capture_auto_cal_c (0x0D,0x27) Mag Capture Auto Cal /// This command captures the current value of the auto-calibration, applies it to the current fixed hard and soft iron calibration coefficients, and replaces the current fixed hard and soft iron calibration coefficients with the new values. /// This may be used in place of (or in addition to) a manual hard and soft iron calibration utility. This command also resets the auto-calibration coefficients. /// Function selector SAVE is the same as issuing the 0x0C, 0x3A and 0x0C, 0x3B commands with the SAVE function selector. @@ -1223,19 +1340,19 @@ mip_cmd_result mip_filter_commanded_angular_zupt(struct mip_interface* device); struct mip_filter_mag_capture_auto_cal_command { mip_function_selector function; - }; typedef struct mip_filter_mag_capture_auto_cal_command mip_filter_mag_capture_auto_cal_command; -void insert_mip_filter_mag_capture_auto_cal_command(struct mip_serializer* serializer, const mip_filter_mag_capture_auto_cal_command* self); -void extract_mip_filter_mag_capture_auto_cal_command(struct mip_serializer* serializer, mip_filter_mag_capture_auto_cal_command* self); -mip_cmd_result mip_filter_write_mag_capture_auto_cal(struct mip_interface* device); -mip_cmd_result mip_filter_save_mag_capture_auto_cal(struct mip_interface* device); +void insert_mip_filter_mag_capture_auto_cal_command(microstrain_serializer* serializer, const mip_filter_mag_capture_auto_cal_command* self); +void extract_mip_filter_mag_capture_auto_cal_command(microstrain_serializer* serializer, mip_filter_mag_capture_auto_cal_command* self); + +mip_cmd_result mip_filter_write_mag_capture_auto_cal(mip_interface* device); +mip_cmd_result mip_filter_save_mag_capture_auto_cal(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_gravity_noise (0x0D,0x28) Gravity Noise [C] +///@defgroup filter_gravity_noise_c (0x0D,0x28) Gravity Noise /// Set the expected gravity noise 1-sigma values. This function can be used to tune the filter performance in the target application. /// /// Note: Noise values must be greater than 0.0 @@ -1249,31 +1366,31 @@ struct mip_filter_gravity_noise_command { mip_function_selector function; mip_vector3f noise; ///< Gravity Noise 1-sigma [gauss] - }; typedef struct mip_filter_gravity_noise_command mip_filter_gravity_noise_command; -void insert_mip_filter_gravity_noise_command(struct mip_serializer* serializer, const mip_filter_gravity_noise_command* self); -void extract_mip_filter_gravity_noise_command(struct mip_serializer* serializer, mip_filter_gravity_noise_command* self); + +void insert_mip_filter_gravity_noise_command(microstrain_serializer* serializer, const mip_filter_gravity_noise_command* self); +void extract_mip_filter_gravity_noise_command(microstrain_serializer* serializer, mip_filter_gravity_noise_command* self); struct mip_filter_gravity_noise_response { mip_vector3f noise; ///< Gravity Noise 1-sigma [gauss] - }; typedef struct mip_filter_gravity_noise_response mip_filter_gravity_noise_response; -void insert_mip_filter_gravity_noise_response(struct mip_serializer* serializer, const mip_filter_gravity_noise_response* self); -void extract_mip_filter_gravity_noise_response(struct mip_serializer* serializer, mip_filter_gravity_noise_response* self); -mip_cmd_result mip_filter_write_gravity_noise(struct mip_interface* device, const float* noise); -mip_cmd_result mip_filter_read_gravity_noise(struct mip_interface* device, float* noise_out); -mip_cmd_result mip_filter_save_gravity_noise(struct mip_interface* device); -mip_cmd_result mip_filter_load_gravity_noise(struct mip_interface* device); -mip_cmd_result mip_filter_default_gravity_noise(struct mip_interface* device); +void insert_mip_filter_gravity_noise_response(microstrain_serializer* serializer, const mip_filter_gravity_noise_response* self); +void extract_mip_filter_gravity_noise_response(microstrain_serializer* serializer, mip_filter_gravity_noise_response* self); + +mip_cmd_result mip_filter_write_gravity_noise(mip_interface* device, const float* noise); +mip_cmd_result mip_filter_read_gravity_noise(mip_interface* device, float* noise_out); +mip_cmd_result mip_filter_save_gravity_noise(mip_interface* device); +mip_cmd_result mip_filter_load_gravity_noise(mip_interface* device); +mip_cmd_result mip_filter_default_gravity_noise(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_pressure_altitude_noise (0x0D,0x29) Pressure Altitude Noise [C] +///@defgroup filter_pressure_altitude_noise_c (0x0D,0x29) Pressure Altitude Noise /// Set the expected pressure altitude noise 1-sigma values. This function can be used to tune the filter performance in the target application. /// /// The noise value must be greater than 0.0 @@ -1287,31 +1404,31 @@ struct mip_filter_pressure_altitude_noise_command { mip_function_selector function; float noise; ///< Pressure Altitude Noise 1-sigma [m] - }; typedef struct mip_filter_pressure_altitude_noise_command mip_filter_pressure_altitude_noise_command; -void insert_mip_filter_pressure_altitude_noise_command(struct mip_serializer* serializer, const mip_filter_pressure_altitude_noise_command* self); -void extract_mip_filter_pressure_altitude_noise_command(struct mip_serializer* serializer, mip_filter_pressure_altitude_noise_command* self); + +void insert_mip_filter_pressure_altitude_noise_command(microstrain_serializer* serializer, const mip_filter_pressure_altitude_noise_command* self); +void extract_mip_filter_pressure_altitude_noise_command(microstrain_serializer* serializer, mip_filter_pressure_altitude_noise_command* self); struct mip_filter_pressure_altitude_noise_response { float noise; ///< Pressure Altitude Noise 1-sigma [m] - }; typedef struct mip_filter_pressure_altitude_noise_response mip_filter_pressure_altitude_noise_response; -void insert_mip_filter_pressure_altitude_noise_response(struct mip_serializer* serializer, const mip_filter_pressure_altitude_noise_response* self); -void extract_mip_filter_pressure_altitude_noise_response(struct mip_serializer* serializer, mip_filter_pressure_altitude_noise_response* self); -mip_cmd_result mip_filter_write_pressure_altitude_noise(struct mip_interface* device, float noise); -mip_cmd_result mip_filter_read_pressure_altitude_noise(struct mip_interface* device, float* noise_out); -mip_cmd_result mip_filter_save_pressure_altitude_noise(struct mip_interface* device); -mip_cmd_result mip_filter_load_pressure_altitude_noise(struct mip_interface* device); -mip_cmd_result mip_filter_default_pressure_altitude_noise(struct mip_interface* device); +void insert_mip_filter_pressure_altitude_noise_response(microstrain_serializer* serializer, const mip_filter_pressure_altitude_noise_response* self); +void extract_mip_filter_pressure_altitude_noise_response(microstrain_serializer* serializer, mip_filter_pressure_altitude_noise_response* self); + +mip_cmd_result mip_filter_write_pressure_altitude_noise(mip_interface* device, float noise); +mip_cmd_result mip_filter_read_pressure_altitude_noise(mip_interface* device, float* noise_out); +mip_cmd_result mip_filter_save_pressure_altitude_noise(mip_interface* device); +mip_cmd_result mip_filter_load_pressure_altitude_noise(mip_interface* device); +mip_cmd_result mip_filter_default_pressure_altitude_noise(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_hard_iron_offset_noise (0x0D,0x2B) Hard Iron Offset Noise [C] +///@defgroup filter_hard_iron_offset_noise_c (0x0D,0x2B) Hard Iron Offset Noise /// Set the expected hard iron offset noise 1-sigma values. This function can be used to tune the filter performance in the target application. /// /// This function can be used to tune the filter performance in the target application. @@ -1327,31 +1444,31 @@ struct mip_filter_hard_iron_offset_noise_command { mip_function_selector function; mip_vector3f noise; ///< Hard Iron Offset Noise 1-sigma [gauss] - }; typedef struct mip_filter_hard_iron_offset_noise_command mip_filter_hard_iron_offset_noise_command; -void insert_mip_filter_hard_iron_offset_noise_command(struct mip_serializer* serializer, const mip_filter_hard_iron_offset_noise_command* self); -void extract_mip_filter_hard_iron_offset_noise_command(struct mip_serializer* serializer, mip_filter_hard_iron_offset_noise_command* self); + +void insert_mip_filter_hard_iron_offset_noise_command(microstrain_serializer* serializer, const mip_filter_hard_iron_offset_noise_command* self); +void extract_mip_filter_hard_iron_offset_noise_command(microstrain_serializer* serializer, mip_filter_hard_iron_offset_noise_command* self); struct mip_filter_hard_iron_offset_noise_response { mip_vector3f noise; ///< Hard Iron Offset Noise 1-sigma [gauss] - }; typedef struct mip_filter_hard_iron_offset_noise_response mip_filter_hard_iron_offset_noise_response; -void insert_mip_filter_hard_iron_offset_noise_response(struct mip_serializer* serializer, const mip_filter_hard_iron_offset_noise_response* self); -void extract_mip_filter_hard_iron_offset_noise_response(struct mip_serializer* serializer, mip_filter_hard_iron_offset_noise_response* self); -mip_cmd_result mip_filter_write_hard_iron_offset_noise(struct mip_interface* device, const float* noise); -mip_cmd_result mip_filter_read_hard_iron_offset_noise(struct mip_interface* device, float* noise_out); -mip_cmd_result mip_filter_save_hard_iron_offset_noise(struct mip_interface* device); -mip_cmd_result mip_filter_load_hard_iron_offset_noise(struct mip_interface* device); -mip_cmd_result mip_filter_default_hard_iron_offset_noise(struct mip_interface* device); +void insert_mip_filter_hard_iron_offset_noise_response(microstrain_serializer* serializer, const mip_filter_hard_iron_offset_noise_response* self); +void extract_mip_filter_hard_iron_offset_noise_response(microstrain_serializer* serializer, mip_filter_hard_iron_offset_noise_response* self); + +mip_cmd_result mip_filter_write_hard_iron_offset_noise(mip_interface* device, const float* noise); +mip_cmd_result mip_filter_read_hard_iron_offset_noise(mip_interface* device, float* noise_out); +mip_cmd_result mip_filter_save_hard_iron_offset_noise(mip_interface* device); +mip_cmd_result mip_filter_load_hard_iron_offset_noise(mip_interface* device); +mip_cmd_result mip_filter_default_hard_iron_offset_noise(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_soft_iron_matrix_noise (0x0D,0x2C) Soft Iron Matrix Noise [C] +///@defgroup filter_soft_iron_matrix_noise_c (0x0D,0x2C) Soft Iron Matrix Noise /// Set the expected soft iron matrix noise 1-sigma values. /// This function can be used to tune the filter performance in the target application. /// @@ -1366,31 +1483,31 @@ struct mip_filter_soft_iron_matrix_noise_command { mip_function_selector function; mip_matrix3f noise; ///< Soft Iron Matrix Noise 1-sigma [dimensionless] - }; typedef struct mip_filter_soft_iron_matrix_noise_command mip_filter_soft_iron_matrix_noise_command; -void insert_mip_filter_soft_iron_matrix_noise_command(struct mip_serializer* serializer, const mip_filter_soft_iron_matrix_noise_command* self); -void extract_mip_filter_soft_iron_matrix_noise_command(struct mip_serializer* serializer, mip_filter_soft_iron_matrix_noise_command* self); + +void insert_mip_filter_soft_iron_matrix_noise_command(microstrain_serializer* serializer, const mip_filter_soft_iron_matrix_noise_command* self); +void extract_mip_filter_soft_iron_matrix_noise_command(microstrain_serializer* serializer, mip_filter_soft_iron_matrix_noise_command* self); struct mip_filter_soft_iron_matrix_noise_response { mip_matrix3f noise; ///< Soft Iron Matrix Noise 1-sigma [dimensionless] - }; typedef struct mip_filter_soft_iron_matrix_noise_response mip_filter_soft_iron_matrix_noise_response; -void insert_mip_filter_soft_iron_matrix_noise_response(struct mip_serializer* serializer, const mip_filter_soft_iron_matrix_noise_response* self); -void extract_mip_filter_soft_iron_matrix_noise_response(struct mip_serializer* serializer, mip_filter_soft_iron_matrix_noise_response* self); -mip_cmd_result mip_filter_write_soft_iron_matrix_noise(struct mip_interface* device, const float* noise); -mip_cmd_result mip_filter_read_soft_iron_matrix_noise(struct mip_interface* device, float* noise_out); -mip_cmd_result mip_filter_save_soft_iron_matrix_noise(struct mip_interface* device); -mip_cmd_result mip_filter_load_soft_iron_matrix_noise(struct mip_interface* device); -mip_cmd_result mip_filter_default_soft_iron_matrix_noise(struct mip_interface* device); +void insert_mip_filter_soft_iron_matrix_noise_response(microstrain_serializer* serializer, const mip_filter_soft_iron_matrix_noise_response* self); +void extract_mip_filter_soft_iron_matrix_noise_response(microstrain_serializer* serializer, mip_filter_soft_iron_matrix_noise_response* self); + +mip_cmd_result mip_filter_write_soft_iron_matrix_noise(mip_interface* device, const float* noise); +mip_cmd_result mip_filter_read_soft_iron_matrix_noise(mip_interface* device, float* noise_out); +mip_cmd_result mip_filter_save_soft_iron_matrix_noise(mip_interface* device); +mip_cmd_result mip_filter_load_soft_iron_matrix_noise(mip_interface* device); +mip_cmd_result mip_filter_default_soft_iron_matrix_noise(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_mag_noise (0x0D,0x42) Mag Noise [C] +///@defgroup filter_mag_noise_c (0x0D,0x42) Mag Noise /// Set the expected magnetometer noise 1-sigma values. /// This function can be used to tune the filter performance in the target application. /// @@ -1405,31 +1522,31 @@ struct mip_filter_mag_noise_command { mip_function_selector function; mip_vector3f noise; ///< Mag Noise 1-sigma [gauss] - }; typedef struct mip_filter_mag_noise_command mip_filter_mag_noise_command; -void insert_mip_filter_mag_noise_command(struct mip_serializer* serializer, const mip_filter_mag_noise_command* self); -void extract_mip_filter_mag_noise_command(struct mip_serializer* serializer, mip_filter_mag_noise_command* self); + +void insert_mip_filter_mag_noise_command(microstrain_serializer* serializer, const mip_filter_mag_noise_command* self); +void extract_mip_filter_mag_noise_command(microstrain_serializer* serializer, mip_filter_mag_noise_command* self); struct mip_filter_mag_noise_response { mip_vector3f noise; ///< Mag Noise 1-sigma [gauss] - }; typedef struct mip_filter_mag_noise_response mip_filter_mag_noise_response; -void insert_mip_filter_mag_noise_response(struct mip_serializer* serializer, const mip_filter_mag_noise_response* self); -void extract_mip_filter_mag_noise_response(struct mip_serializer* serializer, mip_filter_mag_noise_response* self); -mip_cmd_result mip_filter_write_mag_noise(struct mip_interface* device, const float* noise); -mip_cmd_result mip_filter_read_mag_noise(struct mip_interface* device, float* noise_out); -mip_cmd_result mip_filter_save_mag_noise(struct mip_interface* device); -mip_cmd_result mip_filter_load_mag_noise(struct mip_interface* device); -mip_cmd_result mip_filter_default_mag_noise(struct mip_interface* device); +void insert_mip_filter_mag_noise_response(microstrain_serializer* serializer, const mip_filter_mag_noise_response* self); +void extract_mip_filter_mag_noise_response(microstrain_serializer* serializer, mip_filter_mag_noise_response* self); + +mip_cmd_result mip_filter_write_mag_noise(mip_interface* device, const float* noise); +mip_cmd_result mip_filter_read_mag_noise(mip_interface* device, float* noise_out); +mip_cmd_result mip_filter_save_mag_noise(mip_interface* device); +mip_cmd_result mip_filter_load_mag_noise(mip_interface* device); +mip_cmd_result mip_filter_default_mag_noise(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_inclination_source (0x0D,0x4C) Inclination Source [C] +///@defgroup filter_inclination_source_c (0x0D,0x4C) Inclination Source /// Set/Get the local magnetic field inclination angle source. /// /// This can be used to correct for the local value of inclination (dip angle) of the earthmagnetic field. @@ -1443,32 +1560,32 @@ struct mip_filter_inclination_source_command mip_function_selector function; mip_filter_mag_param_source source; ///< Inclination Source float inclination; ///< Inclination angle [radians] (only required if source = MANUAL) - }; typedef struct mip_filter_inclination_source_command mip_filter_inclination_source_command; -void insert_mip_filter_inclination_source_command(struct mip_serializer* serializer, const mip_filter_inclination_source_command* self); -void extract_mip_filter_inclination_source_command(struct mip_serializer* serializer, mip_filter_inclination_source_command* self); + +void insert_mip_filter_inclination_source_command(microstrain_serializer* serializer, const mip_filter_inclination_source_command* self); +void extract_mip_filter_inclination_source_command(microstrain_serializer* serializer, mip_filter_inclination_source_command* self); struct mip_filter_inclination_source_response { mip_filter_mag_param_source source; ///< Inclination Source float inclination; ///< Inclination angle [radians] (only required if source = MANUAL) - }; typedef struct mip_filter_inclination_source_response mip_filter_inclination_source_response; -void insert_mip_filter_inclination_source_response(struct mip_serializer* serializer, const mip_filter_inclination_source_response* self); -void extract_mip_filter_inclination_source_response(struct mip_serializer* serializer, mip_filter_inclination_source_response* self); -mip_cmd_result mip_filter_write_inclination_source(struct mip_interface* device, mip_filter_mag_param_source source, float inclination); -mip_cmd_result mip_filter_read_inclination_source(struct mip_interface* device, mip_filter_mag_param_source* source_out, float* inclination_out); -mip_cmd_result mip_filter_save_inclination_source(struct mip_interface* device); -mip_cmd_result mip_filter_load_inclination_source(struct mip_interface* device); -mip_cmd_result mip_filter_default_inclination_source(struct mip_interface* device); +void insert_mip_filter_inclination_source_response(microstrain_serializer* serializer, const mip_filter_inclination_source_response* self); +void extract_mip_filter_inclination_source_response(microstrain_serializer* serializer, mip_filter_inclination_source_response* self); + +mip_cmd_result mip_filter_write_inclination_source(mip_interface* device, mip_filter_mag_param_source source, float inclination); +mip_cmd_result mip_filter_read_inclination_source(mip_interface* device, mip_filter_mag_param_source* source_out, float* inclination_out); +mip_cmd_result mip_filter_save_inclination_source(mip_interface* device); +mip_cmd_result mip_filter_load_inclination_source(mip_interface* device); +mip_cmd_result mip_filter_default_inclination_source(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_magnetic_declination_source (0x0D,0x43) Magnetic Declination Source [C] +///@defgroup filter_magnetic_declination_source_c (0x0D,0x43) Magnetic Declination Source /// Set/Get the local magnetic field declination angle source. /// /// This can be used to correct for the local value of declination of the earthmagnetic field. @@ -1482,32 +1599,32 @@ struct mip_filter_magnetic_declination_source_command mip_function_selector function; mip_filter_mag_param_source source; ///< Magnetic field declination angle source float declination; ///< Declination angle [radians] (only required if source = MANUAL) - }; typedef struct mip_filter_magnetic_declination_source_command mip_filter_magnetic_declination_source_command; -void insert_mip_filter_magnetic_declination_source_command(struct mip_serializer* serializer, const mip_filter_magnetic_declination_source_command* self); -void extract_mip_filter_magnetic_declination_source_command(struct mip_serializer* serializer, mip_filter_magnetic_declination_source_command* self); + +void insert_mip_filter_magnetic_declination_source_command(microstrain_serializer* serializer, const mip_filter_magnetic_declination_source_command* self); +void extract_mip_filter_magnetic_declination_source_command(microstrain_serializer* serializer, mip_filter_magnetic_declination_source_command* self); struct mip_filter_magnetic_declination_source_response { mip_filter_mag_param_source source; ///< Magnetic field declination angle source float declination; ///< Declination angle [radians] (only required if source = MANUAL) - }; typedef struct mip_filter_magnetic_declination_source_response mip_filter_magnetic_declination_source_response; -void insert_mip_filter_magnetic_declination_source_response(struct mip_serializer* serializer, const mip_filter_magnetic_declination_source_response* self); -void extract_mip_filter_magnetic_declination_source_response(struct mip_serializer* serializer, mip_filter_magnetic_declination_source_response* self); -mip_cmd_result mip_filter_write_magnetic_declination_source(struct mip_interface* device, mip_filter_mag_param_source source, float declination); -mip_cmd_result mip_filter_read_magnetic_declination_source(struct mip_interface* device, mip_filter_mag_param_source* source_out, float* declination_out); -mip_cmd_result mip_filter_save_magnetic_declination_source(struct mip_interface* device); -mip_cmd_result mip_filter_load_magnetic_declination_source(struct mip_interface* device); -mip_cmd_result mip_filter_default_magnetic_declination_source(struct mip_interface* device); +void insert_mip_filter_magnetic_declination_source_response(microstrain_serializer* serializer, const mip_filter_magnetic_declination_source_response* self); +void extract_mip_filter_magnetic_declination_source_response(microstrain_serializer* serializer, mip_filter_magnetic_declination_source_response* self); + +mip_cmd_result mip_filter_write_magnetic_declination_source(mip_interface* device, mip_filter_mag_param_source source, float declination); +mip_cmd_result mip_filter_read_magnetic_declination_source(mip_interface* device, mip_filter_mag_param_source* source_out, float* declination_out); +mip_cmd_result mip_filter_save_magnetic_declination_source(mip_interface* device); +mip_cmd_result mip_filter_load_magnetic_declination_source(mip_interface* device); +mip_cmd_result mip_filter_default_magnetic_declination_source(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_mag_field_magnitude_source (0x0D,0x4D) Mag Field Magnitude Source [C] +///@defgroup filter_mag_field_magnitude_source_c (0x0D,0x4D) Mag Field Magnitude Source /// Set/Get the local magnetic field magnitude source. /// /// This is used to specify the local magnitude of the earth's magnetic field. @@ -1520,32 +1637,32 @@ struct mip_filter_mag_field_magnitude_source_command mip_function_selector function; mip_filter_mag_param_source source; ///< Magnetic Field Magnitude Source float magnitude; ///< Magnitude [gauss] (only required if source = MANUAL) - }; typedef struct mip_filter_mag_field_magnitude_source_command mip_filter_mag_field_magnitude_source_command; -void insert_mip_filter_mag_field_magnitude_source_command(struct mip_serializer* serializer, const mip_filter_mag_field_magnitude_source_command* self); -void extract_mip_filter_mag_field_magnitude_source_command(struct mip_serializer* serializer, mip_filter_mag_field_magnitude_source_command* self); + +void insert_mip_filter_mag_field_magnitude_source_command(microstrain_serializer* serializer, const mip_filter_mag_field_magnitude_source_command* self); +void extract_mip_filter_mag_field_magnitude_source_command(microstrain_serializer* serializer, mip_filter_mag_field_magnitude_source_command* self); struct mip_filter_mag_field_magnitude_source_response { mip_filter_mag_param_source source; ///< Magnetic Field Magnitude Source float magnitude; ///< Magnitude [gauss] (only required if source = MANUAL) - }; typedef struct mip_filter_mag_field_magnitude_source_response mip_filter_mag_field_magnitude_source_response; -void insert_mip_filter_mag_field_magnitude_source_response(struct mip_serializer* serializer, const mip_filter_mag_field_magnitude_source_response* self); -void extract_mip_filter_mag_field_magnitude_source_response(struct mip_serializer* serializer, mip_filter_mag_field_magnitude_source_response* self); -mip_cmd_result mip_filter_write_mag_field_magnitude_source(struct mip_interface* device, mip_filter_mag_param_source source, float magnitude); -mip_cmd_result mip_filter_read_mag_field_magnitude_source(struct mip_interface* device, mip_filter_mag_param_source* source_out, float* magnitude_out); -mip_cmd_result mip_filter_save_mag_field_magnitude_source(struct mip_interface* device); -mip_cmd_result mip_filter_load_mag_field_magnitude_source(struct mip_interface* device); -mip_cmd_result mip_filter_default_mag_field_magnitude_source(struct mip_interface* device); +void insert_mip_filter_mag_field_magnitude_source_response(microstrain_serializer* serializer, const mip_filter_mag_field_magnitude_source_response* self); +void extract_mip_filter_mag_field_magnitude_source_response(microstrain_serializer* serializer, mip_filter_mag_field_magnitude_source_response* self); + +mip_cmd_result mip_filter_write_mag_field_magnitude_source(mip_interface* device, mip_filter_mag_param_source source, float magnitude); +mip_cmd_result mip_filter_read_mag_field_magnitude_source(mip_interface* device, mip_filter_mag_param_source* source_out, float* magnitude_out); +mip_cmd_result mip_filter_save_mag_field_magnitude_source(mip_interface* device); +mip_cmd_result mip_filter_load_mag_field_magnitude_source(mip_interface* device); +mip_cmd_result mip_filter_default_mag_field_magnitude_source(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_reference_position (0x0D,0x26) Reference Position [C] +///@defgroup filter_reference_position_c (0x0D,0x26) Reference Position /// Set the Lat/Long/Alt reference position for the sensor. /// /// This position is used by the sensor to calculate the WGS84 gravity and WMM2015 magnetic field parameters. @@ -1560,11 +1677,11 @@ struct mip_filter_reference_position_command double latitude; ///< [degrees] double longitude; ///< [degrees] double altitude; ///< [meters] - }; typedef struct mip_filter_reference_position_command mip_filter_reference_position_command; -void insert_mip_filter_reference_position_command(struct mip_serializer* serializer, const mip_filter_reference_position_command* self); -void extract_mip_filter_reference_position_command(struct mip_serializer* serializer, mip_filter_reference_position_command* self); + +void insert_mip_filter_reference_position_command(microstrain_serializer* serializer, const mip_filter_reference_position_command* self); +void extract_mip_filter_reference_position_command(microstrain_serializer* serializer, mip_filter_reference_position_command* self); struct mip_filter_reference_position_response { @@ -1572,22 +1689,22 @@ struct mip_filter_reference_position_response double latitude; ///< [degrees] double longitude; ///< [degrees] double altitude; ///< [meters] - }; typedef struct mip_filter_reference_position_response mip_filter_reference_position_response; -void insert_mip_filter_reference_position_response(struct mip_serializer* serializer, const mip_filter_reference_position_response* self); -void extract_mip_filter_reference_position_response(struct mip_serializer* serializer, mip_filter_reference_position_response* self); -mip_cmd_result mip_filter_write_reference_position(struct mip_interface* device, bool enable, double latitude, double longitude, double altitude); -mip_cmd_result mip_filter_read_reference_position(struct mip_interface* device, bool* enable_out, double* latitude_out, double* longitude_out, double* altitude_out); -mip_cmd_result mip_filter_save_reference_position(struct mip_interface* device); -mip_cmd_result mip_filter_load_reference_position(struct mip_interface* device); -mip_cmd_result mip_filter_default_reference_position(struct mip_interface* device); +void insert_mip_filter_reference_position_response(microstrain_serializer* serializer, const mip_filter_reference_position_response* self); +void extract_mip_filter_reference_position_response(microstrain_serializer* serializer, mip_filter_reference_position_response* self); + +mip_cmd_result mip_filter_write_reference_position(mip_interface* device, bool enable, double latitude, double longitude, double altitude); +mip_cmd_result mip_filter_read_reference_position(mip_interface* device, bool* enable_out, double* latitude_out, double* longitude_out, double* altitude_out); +mip_cmd_result mip_filter_save_reference_position(mip_interface* device); +mip_cmd_result mip_filter_load_reference_position(mip_interface* device); +mip_cmd_result mip_filter_default_reference_position(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_accel_magnitude_error_adaptive_measurement (0x0D,0x44) Accel Magnitude Error Adaptive Measurement [C] +///@defgroup filter_accel_magnitude_error_adaptive_measurement_c (0x0D,0x44) Accel Magnitude Error Adaptive Measurement /// Enable or disable the gravity magnitude error adaptive measurement. /// This function can be used to tune the filter performance in the target application /// @@ -1615,11 +1732,11 @@ struct mip_filter_accel_magnitude_error_adaptive_measurement_command float low_limit_uncertainty; ///< 1-Sigma [meters/second^2] float high_limit_uncertainty; ///< 1-Sigma [meters/second^2] float minimum_uncertainty; ///< 1-Sigma [meters/second^2] - }; typedef struct mip_filter_accel_magnitude_error_adaptive_measurement_command mip_filter_accel_magnitude_error_adaptive_measurement_command; -void insert_mip_filter_accel_magnitude_error_adaptive_measurement_command(struct mip_serializer* serializer, const mip_filter_accel_magnitude_error_adaptive_measurement_command* self); -void extract_mip_filter_accel_magnitude_error_adaptive_measurement_command(struct mip_serializer* serializer, mip_filter_accel_magnitude_error_adaptive_measurement_command* self); + +void insert_mip_filter_accel_magnitude_error_adaptive_measurement_command(microstrain_serializer* serializer, const mip_filter_accel_magnitude_error_adaptive_measurement_command* self); +void extract_mip_filter_accel_magnitude_error_adaptive_measurement_command(microstrain_serializer* serializer, mip_filter_accel_magnitude_error_adaptive_measurement_command* self); struct mip_filter_accel_magnitude_error_adaptive_measurement_response { @@ -1630,22 +1747,22 @@ struct mip_filter_accel_magnitude_error_adaptive_measurement_response float low_limit_uncertainty; ///< 1-Sigma [meters/second^2] float high_limit_uncertainty; ///< 1-Sigma [meters/second^2] float minimum_uncertainty; ///< 1-Sigma [meters/second^2] - }; typedef struct mip_filter_accel_magnitude_error_adaptive_measurement_response mip_filter_accel_magnitude_error_adaptive_measurement_response; -void insert_mip_filter_accel_magnitude_error_adaptive_measurement_response(struct mip_serializer* serializer, const mip_filter_accel_magnitude_error_adaptive_measurement_response* self); -void extract_mip_filter_accel_magnitude_error_adaptive_measurement_response(struct mip_serializer* serializer, mip_filter_accel_magnitude_error_adaptive_measurement_response* self); -mip_cmd_result mip_filter_write_accel_magnitude_error_adaptive_measurement(struct mip_interface* device, mip_filter_adaptive_measurement adaptive_measurement, float frequency, float low_limit, float high_limit, float low_limit_uncertainty, float high_limit_uncertainty, float minimum_uncertainty); -mip_cmd_result mip_filter_read_accel_magnitude_error_adaptive_measurement(struct mip_interface* device, mip_filter_adaptive_measurement* adaptive_measurement_out, float* frequency_out, float* low_limit_out, float* high_limit_out, float* low_limit_uncertainty_out, float* high_limit_uncertainty_out, float* minimum_uncertainty_out); -mip_cmd_result mip_filter_save_accel_magnitude_error_adaptive_measurement(struct mip_interface* device); -mip_cmd_result mip_filter_load_accel_magnitude_error_adaptive_measurement(struct mip_interface* device); -mip_cmd_result mip_filter_default_accel_magnitude_error_adaptive_measurement(struct mip_interface* device); +void insert_mip_filter_accel_magnitude_error_adaptive_measurement_response(microstrain_serializer* serializer, const mip_filter_accel_magnitude_error_adaptive_measurement_response* self); +void extract_mip_filter_accel_magnitude_error_adaptive_measurement_response(microstrain_serializer* serializer, mip_filter_accel_magnitude_error_adaptive_measurement_response* self); + +mip_cmd_result mip_filter_write_accel_magnitude_error_adaptive_measurement(mip_interface* device, mip_filter_adaptive_measurement adaptive_measurement, float frequency, float low_limit, float high_limit, float low_limit_uncertainty, float high_limit_uncertainty, float minimum_uncertainty); +mip_cmd_result mip_filter_read_accel_magnitude_error_adaptive_measurement(mip_interface* device, mip_filter_adaptive_measurement* adaptive_measurement_out, float* frequency_out, float* low_limit_out, float* high_limit_out, float* low_limit_uncertainty_out, float* high_limit_uncertainty_out, float* minimum_uncertainty_out); +mip_cmd_result mip_filter_save_accel_magnitude_error_adaptive_measurement(mip_interface* device); +mip_cmd_result mip_filter_load_accel_magnitude_error_adaptive_measurement(mip_interface* device); +mip_cmd_result mip_filter_default_accel_magnitude_error_adaptive_measurement(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_mag_magnitude_error_adaptive_measurement (0x0D,0x45) Mag Magnitude Error Adaptive Measurement [C] +///@defgroup filter_mag_magnitude_error_adaptive_measurement_c (0x0D,0x45) Mag Magnitude Error Adaptive Measurement /// Enable or disable the magnetometer magnitude error adaptive measurement. /// This feature will reject magnetometer readings that are out of range of the thresholds specified (fixed adaptive) or calculated internally (auto-adaptive). /// @@ -1668,11 +1785,11 @@ struct mip_filter_mag_magnitude_error_adaptive_measurement_command float low_limit_uncertainty; ///< 1-Sigma [meters/second^2] float high_limit_uncertainty; ///< 1-Sigma [meters/second^2] float minimum_uncertainty; ///< 1-Sigma [meters/second^2] - }; typedef struct mip_filter_mag_magnitude_error_adaptive_measurement_command mip_filter_mag_magnitude_error_adaptive_measurement_command; -void insert_mip_filter_mag_magnitude_error_adaptive_measurement_command(struct mip_serializer* serializer, const mip_filter_mag_magnitude_error_adaptive_measurement_command* self); -void extract_mip_filter_mag_magnitude_error_adaptive_measurement_command(struct mip_serializer* serializer, mip_filter_mag_magnitude_error_adaptive_measurement_command* self); + +void insert_mip_filter_mag_magnitude_error_adaptive_measurement_command(microstrain_serializer* serializer, const mip_filter_mag_magnitude_error_adaptive_measurement_command* self); +void extract_mip_filter_mag_magnitude_error_adaptive_measurement_command(microstrain_serializer* serializer, mip_filter_mag_magnitude_error_adaptive_measurement_command* self); struct mip_filter_mag_magnitude_error_adaptive_measurement_response { @@ -1683,22 +1800,22 @@ struct mip_filter_mag_magnitude_error_adaptive_measurement_response float low_limit_uncertainty; ///< 1-Sigma [meters/second^2] float high_limit_uncertainty; ///< 1-Sigma [meters/second^2] float minimum_uncertainty; ///< 1-Sigma [meters/second^2] - }; typedef struct mip_filter_mag_magnitude_error_adaptive_measurement_response mip_filter_mag_magnitude_error_adaptive_measurement_response; -void insert_mip_filter_mag_magnitude_error_adaptive_measurement_response(struct mip_serializer* serializer, const mip_filter_mag_magnitude_error_adaptive_measurement_response* self); -void extract_mip_filter_mag_magnitude_error_adaptive_measurement_response(struct mip_serializer* serializer, mip_filter_mag_magnitude_error_adaptive_measurement_response* self); -mip_cmd_result mip_filter_write_mag_magnitude_error_adaptive_measurement(struct mip_interface* device, mip_filter_adaptive_measurement adaptive_measurement, float frequency, float low_limit, float high_limit, float low_limit_uncertainty, float high_limit_uncertainty, float minimum_uncertainty); -mip_cmd_result mip_filter_read_mag_magnitude_error_adaptive_measurement(struct mip_interface* device, mip_filter_adaptive_measurement* adaptive_measurement_out, float* frequency_out, float* low_limit_out, float* high_limit_out, float* low_limit_uncertainty_out, float* high_limit_uncertainty_out, float* minimum_uncertainty_out); -mip_cmd_result mip_filter_save_mag_magnitude_error_adaptive_measurement(struct mip_interface* device); -mip_cmd_result mip_filter_load_mag_magnitude_error_adaptive_measurement(struct mip_interface* device); -mip_cmd_result mip_filter_default_mag_magnitude_error_adaptive_measurement(struct mip_interface* device); +void insert_mip_filter_mag_magnitude_error_adaptive_measurement_response(microstrain_serializer* serializer, const mip_filter_mag_magnitude_error_adaptive_measurement_response* self); +void extract_mip_filter_mag_magnitude_error_adaptive_measurement_response(microstrain_serializer* serializer, mip_filter_mag_magnitude_error_adaptive_measurement_response* self); + +mip_cmd_result mip_filter_write_mag_magnitude_error_adaptive_measurement(mip_interface* device, mip_filter_adaptive_measurement adaptive_measurement, float frequency, float low_limit, float high_limit, float low_limit_uncertainty, float high_limit_uncertainty, float minimum_uncertainty); +mip_cmd_result mip_filter_read_mag_magnitude_error_adaptive_measurement(mip_interface* device, mip_filter_adaptive_measurement* adaptive_measurement_out, float* frequency_out, float* low_limit_out, float* high_limit_out, float* low_limit_uncertainty_out, float* high_limit_uncertainty_out, float* minimum_uncertainty_out); +mip_cmd_result mip_filter_save_mag_magnitude_error_adaptive_measurement(mip_interface* device); +mip_cmd_result mip_filter_load_mag_magnitude_error_adaptive_measurement(mip_interface* device); +mip_cmd_result mip_filter_default_mag_magnitude_error_adaptive_measurement(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_mag_dip_angle_error_adaptive_measurement (0x0D,0x46) Mag Dip Angle Error Adaptive Measurement [C] +///@defgroup filter_mag_dip_angle_error_adaptive_measurement_c (0x0D,0x46) Mag Dip Angle Error Adaptive Measurement /// Enable or disable the magnetometer dip angle error adaptive measurement. /// This function can be used to tune the filter performance in the target application /// @@ -1721,11 +1838,11 @@ struct mip_filter_mag_dip_angle_error_adaptive_measurement_command float high_limit; ///< [meters/second^2] float high_limit_uncertainty; ///< 1-Sigma [meters/second^2] float minimum_uncertainty; ///< 1-Sigma [meters/second^2] - }; typedef struct mip_filter_mag_dip_angle_error_adaptive_measurement_command mip_filter_mag_dip_angle_error_adaptive_measurement_command; -void insert_mip_filter_mag_dip_angle_error_adaptive_measurement_command(struct mip_serializer* serializer, const mip_filter_mag_dip_angle_error_adaptive_measurement_command* self); -void extract_mip_filter_mag_dip_angle_error_adaptive_measurement_command(struct mip_serializer* serializer, mip_filter_mag_dip_angle_error_adaptive_measurement_command* self); + +void insert_mip_filter_mag_dip_angle_error_adaptive_measurement_command(microstrain_serializer* serializer, const mip_filter_mag_dip_angle_error_adaptive_measurement_command* self); +void extract_mip_filter_mag_dip_angle_error_adaptive_measurement_command(microstrain_serializer* serializer, mip_filter_mag_dip_angle_error_adaptive_measurement_command* self); struct mip_filter_mag_dip_angle_error_adaptive_measurement_response { @@ -1734,86 +1851,100 @@ struct mip_filter_mag_dip_angle_error_adaptive_measurement_response float high_limit; ///< [meters/second^2] float high_limit_uncertainty; ///< 1-Sigma [meters/second^2] float minimum_uncertainty; ///< 1-Sigma [meters/second^2] - }; typedef struct mip_filter_mag_dip_angle_error_adaptive_measurement_response mip_filter_mag_dip_angle_error_adaptive_measurement_response; -void insert_mip_filter_mag_dip_angle_error_adaptive_measurement_response(struct mip_serializer* serializer, const mip_filter_mag_dip_angle_error_adaptive_measurement_response* self); -void extract_mip_filter_mag_dip_angle_error_adaptive_measurement_response(struct mip_serializer* serializer, mip_filter_mag_dip_angle_error_adaptive_measurement_response* self); -mip_cmd_result mip_filter_write_mag_dip_angle_error_adaptive_measurement(struct mip_interface* device, bool enable, float frequency, float high_limit, float high_limit_uncertainty, float minimum_uncertainty); -mip_cmd_result mip_filter_read_mag_dip_angle_error_adaptive_measurement(struct mip_interface* device, bool* enable_out, float* frequency_out, float* high_limit_out, float* high_limit_uncertainty_out, float* minimum_uncertainty_out); -mip_cmd_result mip_filter_save_mag_dip_angle_error_adaptive_measurement(struct mip_interface* device); -mip_cmd_result mip_filter_load_mag_dip_angle_error_adaptive_measurement(struct mip_interface* device); -mip_cmd_result mip_filter_default_mag_dip_angle_error_adaptive_measurement(struct mip_interface* device); +void insert_mip_filter_mag_dip_angle_error_adaptive_measurement_response(microstrain_serializer* serializer, const mip_filter_mag_dip_angle_error_adaptive_measurement_response* self); +void extract_mip_filter_mag_dip_angle_error_adaptive_measurement_response(microstrain_serializer* serializer, mip_filter_mag_dip_angle_error_adaptive_measurement_response* self); + +mip_cmd_result mip_filter_write_mag_dip_angle_error_adaptive_measurement(mip_interface* device, bool enable, float frequency, float high_limit, float high_limit_uncertainty, float minimum_uncertainty); +mip_cmd_result mip_filter_read_mag_dip_angle_error_adaptive_measurement(mip_interface* device, bool* enable_out, float* frequency_out, float* high_limit_out, float* high_limit_uncertainty_out, float* minimum_uncertainty_out); +mip_cmd_result mip_filter_save_mag_dip_angle_error_adaptive_measurement(mip_interface* device); +mip_cmd_result mip_filter_load_mag_dip_angle_error_adaptive_measurement(mip_interface* device); +mip_cmd_result mip_filter_default_mag_dip_angle_error_adaptive_measurement(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_aiding_measurement_enable (0x0D,0x50) Aiding Measurement Enable [C] +///@defgroup filter_aiding_measurement_enable_c (0x0D,0x50) Aiding Measurement Enable /// Enables / disables the specified aiding measurement source. /// /// /// ///@{ -typedef uint16_t mip_filter_aiding_measurement_enable_command_aiding_source; -static const mip_filter_aiding_measurement_enable_command_aiding_source MIP_FILTER_AIDING_MEASUREMENT_ENABLE_COMMAND_AIDING_SOURCE_GNSS_POS_VEL = 0; ///< GNSS Position and Velocity -static const mip_filter_aiding_measurement_enable_command_aiding_source MIP_FILTER_AIDING_MEASUREMENT_ENABLE_COMMAND_AIDING_SOURCE_GNSS_HEADING = 1; ///< GNSS Heading (dual antenna) -static const mip_filter_aiding_measurement_enable_command_aiding_source MIP_FILTER_AIDING_MEASUREMENT_ENABLE_COMMAND_AIDING_SOURCE_ALTIMETER = 2; ///< Pressure altimeter (built-in sensor) -static const mip_filter_aiding_measurement_enable_command_aiding_source MIP_FILTER_AIDING_MEASUREMENT_ENABLE_COMMAND_AIDING_SOURCE_SPEED = 3; ///< Speed sensor / Odometer -static const mip_filter_aiding_measurement_enable_command_aiding_source MIP_FILTER_AIDING_MEASUREMENT_ENABLE_COMMAND_AIDING_SOURCE_MAGNETOMETER = 4; ///< Magnetometer (built-in sensor) -static const mip_filter_aiding_measurement_enable_command_aiding_source MIP_FILTER_AIDING_MEASUREMENT_ENABLE_COMMAND_AIDING_SOURCE_EXTERNAL_HEADING = 5; ///< External heading input -static const mip_filter_aiding_measurement_enable_command_aiding_source MIP_FILTER_AIDING_MEASUREMENT_ENABLE_COMMAND_AIDING_SOURCE_EXTERNAL_ALTIMETER = 6; ///< External pressure altimeter input -static const mip_filter_aiding_measurement_enable_command_aiding_source MIP_FILTER_AIDING_MEASUREMENT_ENABLE_COMMAND_AIDING_SOURCE_EXTERNAL_MAGNETOMETER = 7; ///< External magnetomer input -static const mip_filter_aiding_measurement_enable_command_aiding_source MIP_FILTER_AIDING_MEASUREMENT_ENABLE_COMMAND_AIDING_SOURCE_BODY_FRAME_VEL = 8; ///< External body frame velocity input -static const mip_filter_aiding_measurement_enable_command_aiding_source MIP_FILTER_AIDING_MEASUREMENT_ENABLE_COMMAND_AIDING_SOURCE_ALL = 65535; ///< Save/load/reset all options +enum mip_filter_aiding_measurement_enable_command_aiding_source +{ + MIP_FILTER_AIDING_MEASUREMENT_ENABLE_COMMAND_AIDING_SOURCE_GNSS_POS_VEL = 0, ///< GNSS Position and Velocity + MIP_FILTER_AIDING_MEASUREMENT_ENABLE_COMMAND_AIDING_SOURCE_GNSS_HEADING = 1, ///< GNSS Heading (dual antenna) + MIP_FILTER_AIDING_MEASUREMENT_ENABLE_COMMAND_AIDING_SOURCE_ALTIMETER = 2, ///< Pressure altimeter (built-in sensor) + MIP_FILTER_AIDING_MEASUREMENT_ENABLE_COMMAND_AIDING_SOURCE_SPEED = 3, ///< Speed sensor / Odometer + MIP_FILTER_AIDING_MEASUREMENT_ENABLE_COMMAND_AIDING_SOURCE_MAGNETOMETER = 4, ///< Magnetometer (built-in sensor) + MIP_FILTER_AIDING_MEASUREMENT_ENABLE_COMMAND_AIDING_SOURCE_EXTERNAL_HEADING = 5, ///< External heading input + MIP_FILTER_AIDING_MEASUREMENT_ENABLE_COMMAND_AIDING_SOURCE_EXTERNAL_ALTIMETER = 6, ///< External pressure altimeter input + MIP_FILTER_AIDING_MEASUREMENT_ENABLE_COMMAND_AIDING_SOURCE_EXTERNAL_MAGNETOMETER = 7, ///< External magnetomer input + MIP_FILTER_AIDING_MEASUREMENT_ENABLE_COMMAND_AIDING_SOURCE_BODY_FRAME_VEL = 8, ///< External body frame velocity input + MIP_FILTER_AIDING_MEASUREMENT_ENABLE_COMMAND_AIDING_SOURCE_ALL = 65535, ///< Save/load/reset all options +}; +typedef enum mip_filter_aiding_measurement_enable_command_aiding_source mip_filter_aiding_measurement_enable_command_aiding_source; + +static inline void insert_mip_filter_aiding_measurement_enable_command_aiding_source(microstrain_serializer* serializer, const mip_filter_aiding_measurement_enable_command_aiding_source self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_filter_aiding_measurement_enable_command_aiding_source(microstrain_serializer* serializer, mip_filter_aiding_measurement_enable_command_aiding_source* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_filter_aiding_measurement_enable_command { mip_function_selector function; mip_filter_aiding_measurement_enable_command_aiding_source aiding_source; ///< Aiding measurement source bool enable; ///< Controls the aiding source - }; typedef struct mip_filter_aiding_measurement_enable_command mip_filter_aiding_measurement_enable_command; -void insert_mip_filter_aiding_measurement_enable_command(struct mip_serializer* serializer, const mip_filter_aiding_measurement_enable_command* self); -void extract_mip_filter_aiding_measurement_enable_command(struct mip_serializer* serializer, mip_filter_aiding_measurement_enable_command* self); -void insert_mip_filter_aiding_measurement_enable_command_aiding_source(struct mip_serializer* serializer, const mip_filter_aiding_measurement_enable_command_aiding_source self); -void extract_mip_filter_aiding_measurement_enable_command_aiding_source(struct mip_serializer* serializer, mip_filter_aiding_measurement_enable_command_aiding_source* self); +void insert_mip_filter_aiding_measurement_enable_command(microstrain_serializer* serializer, const mip_filter_aiding_measurement_enable_command* self); +void extract_mip_filter_aiding_measurement_enable_command(microstrain_serializer* serializer, mip_filter_aiding_measurement_enable_command* self); struct mip_filter_aiding_measurement_enable_response { mip_filter_aiding_measurement_enable_command_aiding_source aiding_source; ///< Aiding measurement source bool enable; ///< Controls the aiding source - }; typedef struct mip_filter_aiding_measurement_enable_response mip_filter_aiding_measurement_enable_response; -void insert_mip_filter_aiding_measurement_enable_response(struct mip_serializer* serializer, const mip_filter_aiding_measurement_enable_response* self); -void extract_mip_filter_aiding_measurement_enable_response(struct mip_serializer* serializer, mip_filter_aiding_measurement_enable_response* self); -mip_cmd_result mip_filter_write_aiding_measurement_enable(struct mip_interface* device, mip_filter_aiding_measurement_enable_command_aiding_source aiding_source, bool enable); -mip_cmd_result mip_filter_read_aiding_measurement_enable(struct mip_interface* device, mip_filter_aiding_measurement_enable_command_aiding_source aiding_source, bool* enable_out); -mip_cmd_result mip_filter_save_aiding_measurement_enable(struct mip_interface* device, mip_filter_aiding_measurement_enable_command_aiding_source aiding_source); -mip_cmd_result mip_filter_load_aiding_measurement_enable(struct mip_interface* device, mip_filter_aiding_measurement_enable_command_aiding_source aiding_source); -mip_cmd_result mip_filter_default_aiding_measurement_enable(struct mip_interface* device, mip_filter_aiding_measurement_enable_command_aiding_source aiding_source); +void insert_mip_filter_aiding_measurement_enable_response(microstrain_serializer* serializer, const mip_filter_aiding_measurement_enable_response* self); +void extract_mip_filter_aiding_measurement_enable_response(microstrain_serializer* serializer, mip_filter_aiding_measurement_enable_response* self); + +mip_cmd_result mip_filter_write_aiding_measurement_enable(mip_interface* device, mip_filter_aiding_measurement_enable_command_aiding_source aiding_source, bool enable); +mip_cmd_result mip_filter_read_aiding_measurement_enable(mip_interface* device, mip_filter_aiding_measurement_enable_command_aiding_source aiding_source, bool* enable_out); +mip_cmd_result mip_filter_save_aiding_measurement_enable(mip_interface* device, mip_filter_aiding_measurement_enable_command_aiding_source aiding_source); +mip_cmd_result mip_filter_load_aiding_measurement_enable(mip_interface* device, mip_filter_aiding_measurement_enable_command_aiding_source aiding_source); +mip_cmd_result mip_filter_default_aiding_measurement_enable(mip_interface* device, mip_filter_aiding_measurement_enable_command_aiding_source aiding_source); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_run (0x0D,0x05) Run [C] +///@defgroup filter_run_c (0x0D,0x05) Run /// Manual run command. /// /// If the initialization configuration has the "wait_for_run_command" option enabled, the filter will wait until it receives this command before commencing integration and enabling the Kalman filter. Prior to the receipt of this command, the filter will remain in the filter initialization mode. /// ///@{ -mip_cmd_result mip_filter_run(struct mip_interface* device); +typedef struct mip_filter_run_command mip_filter_run_command; ///< No parameters (empty struct not allowed in C) + +mip_cmd_result mip_filter_run(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_kinematic_constraint (0x0D,0x51) Kinematic Constraint [C] +///@defgroup filter_kinematic_constraint_c (0x0D,0x51) Kinematic Constraint /// Controls kinematic constraint model selection for the navigation filter. /// /// See manual for explanation of how the kinematic constraints are applied. @@ -1826,33 +1957,33 @@ struct mip_filter_kinematic_constraint_command uint8_t acceleration_constraint_selection; ///< Acceleration constraint:
0=None (default),
1=Zero-acceleration. uint8_t velocity_constraint_selection; ///< 0=None (default),
1=Zero-velocity,
2=Wheeled-vehicle.
uint8_t angular_constraint_selection; ///< 0=None (default), 1=Zero-angular rate (ZUPT). - }; typedef struct mip_filter_kinematic_constraint_command mip_filter_kinematic_constraint_command; -void insert_mip_filter_kinematic_constraint_command(struct mip_serializer* serializer, const mip_filter_kinematic_constraint_command* self); -void extract_mip_filter_kinematic_constraint_command(struct mip_serializer* serializer, mip_filter_kinematic_constraint_command* self); + +void insert_mip_filter_kinematic_constraint_command(microstrain_serializer* serializer, const mip_filter_kinematic_constraint_command* self); +void extract_mip_filter_kinematic_constraint_command(microstrain_serializer* serializer, mip_filter_kinematic_constraint_command* self); struct mip_filter_kinematic_constraint_response { uint8_t acceleration_constraint_selection; ///< Acceleration constraint:
0=None (default),
1=Zero-acceleration. uint8_t velocity_constraint_selection; ///< 0=None (default),
1=Zero-velocity,
2=Wheeled-vehicle.
uint8_t angular_constraint_selection; ///< 0=None (default), 1=Zero-angular rate (ZUPT). - }; typedef struct mip_filter_kinematic_constraint_response mip_filter_kinematic_constraint_response; -void insert_mip_filter_kinematic_constraint_response(struct mip_serializer* serializer, const mip_filter_kinematic_constraint_response* self); -void extract_mip_filter_kinematic_constraint_response(struct mip_serializer* serializer, mip_filter_kinematic_constraint_response* self); -mip_cmd_result mip_filter_write_kinematic_constraint(struct mip_interface* device, uint8_t acceleration_constraint_selection, uint8_t velocity_constraint_selection, uint8_t angular_constraint_selection); -mip_cmd_result mip_filter_read_kinematic_constraint(struct mip_interface* device, uint8_t* acceleration_constraint_selection_out, uint8_t* velocity_constraint_selection_out, uint8_t* angular_constraint_selection_out); -mip_cmd_result mip_filter_save_kinematic_constraint(struct mip_interface* device); -mip_cmd_result mip_filter_load_kinematic_constraint(struct mip_interface* device); -mip_cmd_result mip_filter_default_kinematic_constraint(struct mip_interface* device); +void insert_mip_filter_kinematic_constraint_response(microstrain_serializer* serializer, const mip_filter_kinematic_constraint_response* self); +void extract_mip_filter_kinematic_constraint_response(microstrain_serializer* serializer, mip_filter_kinematic_constraint_response* self); + +mip_cmd_result mip_filter_write_kinematic_constraint(mip_interface* device, uint8_t acceleration_constraint_selection, uint8_t velocity_constraint_selection, uint8_t angular_constraint_selection); +mip_cmd_result mip_filter_read_kinematic_constraint(mip_interface* device, uint8_t* acceleration_constraint_selection_out, uint8_t* velocity_constraint_selection_out, uint8_t* angular_constraint_selection_out); +mip_cmd_result mip_filter_save_kinematic_constraint(mip_interface* device); +mip_cmd_result mip_filter_load_kinematic_constraint(mip_interface* device); +mip_cmd_result mip_filter_default_kinematic_constraint(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_initialization_configuration (0x0D,0x52) Initialization Configuration [C] +///@defgroup filter_initialization_configuration_c (0x0D,0x52) Initialization Configuration /// Controls the source and values used for initial conditions of the navigation solution. /// /// Notes: Initial conditions are the position, velocity, and attitude of the platform used when the filter starts running or is reset. @@ -1868,12 +1999,37 @@ static const mip_filter_initialization_configuration_command_alignment_selector static const mip_filter_initialization_configuration_command_alignment_selector MIP_FILTER_INITIALIZATION_CONFIGURATION_COMMAND_ALIGNMENT_SELECTOR_MAGNETOMETER = 0x04; ///< Magnetometer heading alignment (Internal magnetometer determines initial heading) static const mip_filter_initialization_configuration_command_alignment_selector MIP_FILTER_INITIALIZATION_CONFIGURATION_COMMAND_ALIGNMENT_SELECTOR_EXTERNAL = 0x08; ///< External heading alignment (External heading input determines heading) static const mip_filter_initialization_configuration_command_alignment_selector MIP_FILTER_INITIALIZATION_CONFIGURATION_COMMAND_ALIGNMENT_SELECTOR_ALL = 0x0F; +static inline void insert_mip_filter_initialization_configuration_command_alignment_selector(microstrain_serializer* serializer, const mip_filter_initialization_configuration_command_alignment_selector self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_filter_initialization_configuration_command_alignment_selector(microstrain_serializer* serializer, mip_filter_initialization_configuration_command_alignment_selector* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} + +enum mip_filter_initialization_configuration_command_initial_condition_source +{ + MIP_FILTER_INITIALIZATION_CONFIGURATION_COMMAND_INITIAL_CONDITION_SOURCE_AUTO_POS_VEL_ATT = 0, ///< Automatic position, velocity and attitude + MIP_FILTER_INITIALIZATION_CONFIGURATION_COMMAND_INITIAL_CONDITION_SOURCE_AUTO_POS_VEL_PITCH_ROLL = 1, ///< Automatic position and velocity, automatic pitch and roll, and user-specified heading + MIP_FILTER_INITIALIZATION_CONFIGURATION_COMMAND_INITIAL_CONDITION_SOURCE_AUTO_POS_VEL = 2, ///< Automatic position and velocity, with fully user-specified attitude + MIP_FILTER_INITIALIZATION_CONFIGURATION_COMMAND_INITIAL_CONDITION_SOURCE_MANUAL = 3, ///< User-specified position, velocity, and attitude. +}; +typedef enum mip_filter_initialization_configuration_command_initial_condition_source mip_filter_initialization_configuration_command_initial_condition_source; + +static inline void insert_mip_filter_initialization_configuration_command_initial_condition_source(microstrain_serializer* serializer, const mip_filter_initialization_configuration_command_initial_condition_source self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_filter_initialization_configuration_command_initial_condition_source(microstrain_serializer* serializer, mip_filter_initialization_configuration_command_initial_condition_source* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} -typedef uint8_t mip_filter_initialization_configuration_command_initial_condition_source; -static const mip_filter_initialization_configuration_command_initial_condition_source MIP_FILTER_INITIALIZATION_CONFIGURATION_COMMAND_INITIAL_CONDITION_SOURCE_AUTO_POS_VEL_ATT = 0; ///< Automatic position, velocity and attitude -static const mip_filter_initialization_configuration_command_initial_condition_source MIP_FILTER_INITIALIZATION_CONFIGURATION_COMMAND_INITIAL_CONDITION_SOURCE_AUTO_POS_VEL_PITCH_ROLL = 1; ///< Automatic position and velocity, automatic pitch and roll, and user-specified heading -static const mip_filter_initialization_configuration_command_initial_condition_source MIP_FILTER_INITIALIZATION_CONFIGURATION_COMMAND_INITIAL_CONDITION_SOURCE_AUTO_POS_VEL = 2; ///< Automatic position and velocity, with fully user-specified attitude -static const mip_filter_initialization_configuration_command_initial_condition_source MIP_FILTER_INITIALIZATION_CONFIGURATION_COMMAND_INITIAL_CONDITION_SOURCE_MANUAL = 3; ///< User-specified position, velocity, and attitude. struct mip_filter_initialization_configuration_command { @@ -1887,17 +2043,11 @@ struct mip_filter_initialization_configuration_command mip_vector3f initial_position; ///< User-specified initial platform position (units determined by reference frame selector, see note.) mip_vector3f initial_velocity; ///< User-specified initial platform velocity (units determined by reference frame selector, see note.) mip_filter_reference_frame reference_frame_selector; ///< User-specified initial position/velocity reference frames - }; typedef struct mip_filter_initialization_configuration_command mip_filter_initialization_configuration_command; -void insert_mip_filter_initialization_configuration_command(struct mip_serializer* serializer, const mip_filter_initialization_configuration_command* self); -void extract_mip_filter_initialization_configuration_command(struct mip_serializer* serializer, mip_filter_initialization_configuration_command* self); -void insert_mip_filter_initialization_configuration_command_alignment_selector(struct mip_serializer* serializer, const mip_filter_initialization_configuration_command_alignment_selector self); -void extract_mip_filter_initialization_configuration_command_alignment_selector(struct mip_serializer* serializer, mip_filter_initialization_configuration_command_alignment_selector* self); - -void insert_mip_filter_initialization_configuration_command_initial_condition_source(struct mip_serializer* serializer, const mip_filter_initialization_configuration_command_initial_condition_source self); -void extract_mip_filter_initialization_configuration_command_initial_condition_source(struct mip_serializer* serializer, mip_filter_initialization_configuration_command_initial_condition_source* self); +void insert_mip_filter_initialization_configuration_command(microstrain_serializer* serializer, const mip_filter_initialization_configuration_command* self); +void extract_mip_filter_initialization_configuration_command(microstrain_serializer* serializer, mip_filter_initialization_configuration_command* self); struct mip_filter_initialization_configuration_response { @@ -1910,22 +2060,22 @@ struct mip_filter_initialization_configuration_response mip_vector3f initial_position; ///< User-specified initial platform position (units determined by reference frame selector, see note.) mip_vector3f initial_velocity; ///< User-specified initial platform velocity (units determined by reference frame selector, see note.) mip_filter_reference_frame reference_frame_selector; ///< User-specified initial position/velocity reference frames - }; typedef struct mip_filter_initialization_configuration_response mip_filter_initialization_configuration_response; -void insert_mip_filter_initialization_configuration_response(struct mip_serializer* serializer, const mip_filter_initialization_configuration_response* self); -void extract_mip_filter_initialization_configuration_response(struct mip_serializer* serializer, mip_filter_initialization_configuration_response* self); -mip_cmd_result mip_filter_write_initialization_configuration(struct mip_interface* device, uint8_t wait_for_run_command, mip_filter_initialization_configuration_command_initial_condition_source initial_cond_src, mip_filter_initialization_configuration_command_alignment_selector auto_heading_alignment_selector, float initial_heading, float initial_pitch, float initial_roll, const float* initial_position, const float* initial_velocity, mip_filter_reference_frame reference_frame_selector); -mip_cmd_result mip_filter_read_initialization_configuration(struct mip_interface* device, uint8_t* wait_for_run_command_out, mip_filter_initialization_configuration_command_initial_condition_source* initial_cond_src_out, mip_filter_initialization_configuration_command_alignment_selector* auto_heading_alignment_selector_out, float* initial_heading_out, float* initial_pitch_out, float* initial_roll_out, float* initial_position_out, float* initial_velocity_out, mip_filter_reference_frame* reference_frame_selector_out); -mip_cmd_result mip_filter_save_initialization_configuration(struct mip_interface* device); -mip_cmd_result mip_filter_load_initialization_configuration(struct mip_interface* device); -mip_cmd_result mip_filter_default_initialization_configuration(struct mip_interface* device); +void insert_mip_filter_initialization_configuration_response(microstrain_serializer* serializer, const mip_filter_initialization_configuration_response* self); +void extract_mip_filter_initialization_configuration_response(microstrain_serializer* serializer, mip_filter_initialization_configuration_response* self); + +mip_cmd_result mip_filter_write_initialization_configuration(mip_interface* device, uint8_t wait_for_run_command, mip_filter_initialization_configuration_command_initial_condition_source initial_cond_src, mip_filter_initialization_configuration_command_alignment_selector auto_heading_alignment_selector, float initial_heading, float initial_pitch, float initial_roll, const float* initial_position, const float* initial_velocity, mip_filter_reference_frame reference_frame_selector); +mip_cmd_result mip_filter_read_initialization_configuration(mip_interface* device, uint8_t* wait_for_run_command_out, mip_filter_initialization_configuration_command_initial_condition_source* initial_cond_src_out, mip_filter_initialization_configuration_command_alignment_selector* auto_heading_alignment_selector_out, float* initial_heading_out, float* initial_pitch_out, float* initial_roll_out, float* initial_position_out, float* initial_velocity_out, mip_filter_reference_frame* reference_frame_selector_out); +mip_cmd_result mip_filter_save_initialization_configuration(mip_interface* device); +mip_cmd_result mip_filter_load_initialization_configuration(mip_interface* device); +mip_cmd_result mip_filter_default_initialization_configuration(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_adaptive_filter_options (0x0D,0x53) Adaptive Filter Options [C] +///@defgroup filter_adaptive_filter_options_c (0x0D,0x53) Adaptive Filter Options /// Configures the basic setup for auto-adaptive filtering. See product manual for a detailed description of this feature. /// ///@{ @@ -1935,32 +2085,32 @@ struct mip_filter_adaptive_filter_options_command mip_function_selector function; uint8_t level; ///< Auto-adaptive operating level:
0=Off,
1=Conservative,
2=Moderate (default),
3=Aggressive. uint16_t time_limit; ///< Maximum duration of measurement rejection before entering recovery mode (ms) - }; typedef struct mip_filter_adaptive_filter_options_command mip_filter_adaptive_filter_options_command; -void insert_mip_filter_adaptive_filter_options_command(struct mip_serializer* serializer, const mip_filter_adaptive_filter_options_command* self); -void extract_mip_filter_adaptive_filter_options_command(struct mip_serializer* serializer, mip_filter_adaptive_filter_options_command* self); + +void insert_mip_filter_adaptive_filter_options_command(microstrain_serializer* serializer, const mip_filter_adaptive_filter_options_command* self); +void extract_mip_filter_adaptive_filter_options_command(microstrain_serializer* serializer, mip_filter_adaptive_filter_options_command* self); struct mip_filter_adaptive_filter_options_response { uint8_t level; ///< Auto-adaptive operating level:
0=Off,
1=Conservative,
2=Moderate (default),
3=Aggressive. uint16_t time_limit; ///< Maximum duration of measurement rejection before entering recovery mode (ms) - }; typedef struct mip_filter_adaptive_filter_options_response mip_filter_adaptive_filter_options_response; -void insert_mip_filter_adaptive_filter_options_response(struct mip_serializer* serializer, const mip_filter_adaptive_filter_options_response* self); -void extract_mip_filter_adaptive_filter_options_response(struct mip_serializer* serializer, mip_filter_adaptive_filter_options_response* self); -mip_cmd_result mip_filter_write_adaptive_filter_options(struct mip_interface* device, uint8_t level, uint16_t time_limit); -mip_cmd_result mip_filter_read_adaptive_filter_options(struct mip_interface* device, uint8_t* level_out, uint16_t* time_limit_out); -mip_cmd_result mip_filter_save_adaptive_filter_options(struct mip_interface* device); -mip_cmd_result mip_filter_load_adaptive_filter_options(struct mip_interface* device); -mip_cmd_result mip_filter_default_adaptive_filter_options(struct mip_interface* device); +void insert_mip_filter_adaptive_filter_options_response(microstrain_serializer* serializer, const mip_filter_adaptive_filter_options_response* self); +void extract_mip_filter_adaptive_filter_options_response(microstrain_serializer* serializer, mip_filter_adaptive_filter_options_response* self); + +mip_cmd_result mip_filter_write_adaptive_filter_options(mip_interface* device, uint8_t level, uint16_t time_limit); +mip_cmd_result mip_filter_read_adaptive_filter_options(mip_interface* device, uint8_t* level_out, uint16_t* time_limit_out); +mip_cmd_result mip_filter_save_adaptive_filter_options(mip_interface* device); +mip_cmd_result mip_filter_load_adaptive_filter_options(mip_interface* device); +mip_cmd_result mip_filter_default_adaptive_filter_options(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_multi_antenna_offset (0x0D,0x54) Multi Antenna Offset [C] +///@defgroup filter_multi_antenna_offset_c (0x0D,0x54) Multi Antenna Offset /// Set the antenna lever arm. /// /// This command works with devices that utilize multiple antennas. @@ -1973,32 +2123,32 @@ struct mip_filter_multi_antenna_offset_command mip_function_selector function; uint8_t receiver_id; ///< Receiver: 1, 2, etc... mip_vector3f antenna_offset; ///< Antenna lever arm offset vector in the vehicle frame (m) - }; typedef struct mip_filter_multi_antenna_offset_command mip_filter_multi_antenna_offset_command; -void insert_mip_filter_multi_antenna_offset_command(struct mip_serializer* serializer, const mip_filter_multi_antenna_offset_command* self); -void extract_mip_filter_multi_antenna_offset_command(struct mip_serializer* serializer, mip_filter_multi_antenna_offset_command* self); + +void insert_mip_filter_multi_antenna_offset_command(microstrain_serializer* serializer, const mip_filter_multi_antenna_offset_command* self); +void extract_mip_filter_multi_antenna_offset_command(microstrain_serializer* serializer, mip_filter_multi_antenna_offset_command* self); struct mip_filter_multi_antenna_offset_response { uint8_t receiver_id; mip_vector3f antenna_offset; - }; typedef struct mip_filter_multi_antenna_offset_response mip_filter_multi_antenna_offset_response; -void insert_mip_filter_multi_antenna_offset_response(struct mip_serializer* serializer, const mip_filter_multi_antenna_offset_response* self); -void extract_mip_filter_multi_antenna_offset_response(struct mip_serializer* serializer, mip_filter_multi_antenna_offset_response* self); -mip_cmd_result mip_filter_write_multi_antenna_offset(struct mip_interface* device, uint8_t receiver_id, const float* antenna_offset); -mip_cmd_result mip_filter_read_multi_antenna_offset(struct mip_interface* device, uint8_t receiver_id, float* antenna_offset_out); -mip_cmd_result mip_filter_save_multi_antenna_offset(struct mip_interface* device, uint8_t receiver_id); -mip_cmd_result mip_filter_load_multi_antenna_offset(struct mip_interface* device, uint8_t receiver_id); -mip_cmd_result mip_filter_default_multi_antenna_offset(struct mip_interface* device, uint8_t receiver_id); +void insert_mip_filter_multi_antenna_offset_response(microstrain_serializer* serializer, const mip_filter_multi_antenna_offset_response* self); +void extract_mip_filter_multi_antenna_offset_response(microstrain_serializer* serializer, mip_filter_multi_antenna_offset_response* self); + +mip_cmd_result mip_filter_write_multi_antenna_offset(mip_interface* device, uint8_t receiver_id, const float* antenna_offset); +mip_cmd_result mip_filter_read_multi_antenna_offset(mip_interface* device, uint8_t receiver_id, float* antenna_offset_out); +mip_cmd_result mip_filter_save_multi_antenna_offset(mip_interface* device, uint8_t receiver_id); +mip_cmd_result mip_filter_load_multi_antenna_offset(mip_interface* device, uint8_t receiver_id); +mip_cmd_result mip_filter_default_multi_antenna_offset(mip_interface* device, uint8_t receiver_id); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_rel_pos_configuration (0x0D,0x55) Rel Pos Configuration [C] +///@defgroup filter_rel_pos_configuration_c (0x0D,0x55) Rel Pos Configuration /// Configure the reference location for filter relative positioning outputs /// ///@{ @@ -2009,33 +2159,33 @@ struct mip_filter_rel_pos_configuration_command uint8_t source; ///< 0 - auto (RTK base station), 1 - manual mip_filter_reference_frame reference_frame_selector; ///< ECEF or LLH mip_vector3d reference_coordinates; ///< reference coordinates, units determined by source selection - }; typedef struct mip_filter_rel_pos_configuration_command mip_filter_rel_pos_configuration_command; -void insert_mip_filter_rel_pos_configuration_command(struct mip_serializer* serializer, const mip_filter_rel_pos_configuration_command* self); -void extract_mip_filter_rel_pos_configuration_command(struct mip_serializer* serializer, mip_filter_rel_pos_configuration_command* self); + +void insert_mip_filter_rel_pos_configuration_command(microstrain_serializer* serializer, const mip_filter_rel_pos_configuration_command* self); +void extract_mip_filter_rel_pos_configuration_command(microstrain_serializer* serializer, mip_filter_rel_pos_configuration_command* self); struct mip_filter_rel_pos_configuration_response { uint8_t source; ///< 0 - auto (RTK base station), 1 - manual mip_filter_reference_frame reference_frame_selector; ///< ECEF or LLH mip_vector3d reference_coordinates; ///< reference coordinates, units determined by source selection - }; typedef struct mip_filter_rel_pos_configuration_response mip_filter_rel_pos_configuration_response; -void insert_mip_filter_rel_pos_configuration_response(struct mip_serializer* serializer, const mip_filter_rel_pos_configuration_response* self); -void extract_mip_filter_rel_pos_configuration_response(struct mip_serializer* serializer, mip_filter_rel_pos_configuration_response* self); -mip_cmd_result mip_filter_write_rel_pos_configuration(struct mip_interface* device, uint8_t source, mip_filter_reference_frame reference_frame_selector, const double* reference_coordinates); -mip_cmd_result mip_filter_read_rel_pos_configuration(struct mip_interface* device, uint8_t* source_out, mip_filter_reference_frame* reference_frame_selector_out, double* reference_coordinates_out); -mip_cmd_result mip_filter_save_rel_pos_configuration(struct mip_interface* device); -mip_cmd_result mip_filter_load_rel_pos_configuration(struct mip_interface* device); -mip_cmd_result mip_filter_default_rel_pos_configuration(struct mip_interface* device); +void insert_mip_filter_rel_pos_configuration_response(microstrain_serializer* serializer, const mip_filter_rel_pos_configuration_response* self); +void extract_mip_filter_rel_pos_configuration_response(microstrain_serializer* serializer, mip_filter_rel_pos_configuration_response* self); + +mip_cmd_result mip_filter_write_rel_pos_configuration(mip_interface* device, uint8_t source, mip_filter_reference_frame reference_frame_selector, const double* reference_coordinates); +mip_cmd_result mip_filter_read_rel_pos_configuration(mip_interface* device, uint8_t* source_out, mip_filter_reference_frame* reference_frame_selector_out, double* reference_coordinates_out); +mip_cmd_result mip_filter_save_rel_pos_configuration(mip_interface* device); +mip_cmd_result mip_filter_load_rel_pos_configuration(mip_interface* device); +mip_cmd_result mip_filter_default_rel_pos_configuration(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_ref_point_lever_arm (0x0D,0x56) Ref Point Lever Arm [C] +///@defgroup filter_ref_point_lever_arm_c (0x0D,0x56) Ref Point Lever Arm /// Lever arm offset with respect to the sensor for the indicated point of reference. /// This is used to change the location of the indicated point of reference, and will affect filter position and velocity outputs. /// Changing this setting from default will result in a global position offset that depends on vehicle attitude, @@ -2047,43 +2197,55 @@ mip_cmd_result mip_filter_default_rel_pos_configuration(struct mip_interface* de /// ///@{ -typedef uint8_t mip_filter_ref_point_lever_arm_command_reference_point_selector; -static const mip_filter_ref_point_lever_arm_command_reference_point_selector MIP_FILTER_REF_POINT_LEVER_ARM_COMMAND_REFERENCE_POINT_SELECTOR_VEH = 1; ///< Defines the origin of the vehicle +enum mip_filter_ref_point_lever_arm_command_reference_point_selector +{ + MIP_FILTER_REF_POINT_LEVER_ARM_COMMAND_REFERENCE_POINT_SELECTOR_VEH = 1, ///< Defines the origin of the vehicle +}; +typedef enum mip_filter_ref_point_lever_arm_command_reference_point_selector mip_filter_ref_point_lever_arm_command_reference_point_selector; + +static inline void insert_mip_filter_ref_point_lever_arm_command_reference_point_selector(microstrain_serializer* serializer, const mip_filter_ref_point_lever_arm_command_reference_point_selector self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_filter_ref_point_lever_arm_command_reference_point_selector(microstrain_serializer* serializer, mip_filter_ref_point_lever_arm_command_reference_point_selector* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} + struct mip_filter_ref_point_lever_arm_command { mip_function_selector function; mip_filter_ref_point_lever_arm_command_reference_point_selector ref_point_sel; ///< Reserved, must be 1 mip_vector3f lever_arm_offset; ///< [m] Lever arm offset vector in the vehicle's reference frame. - }; typedef struct mip_filter_ref_point_lever_arm_command mip_filter_ref_point_lever_arm_command; -void insert_mip_filter_ref_point_lever_arm_command(struct mip_serializer* serializer, const mip_filter_ref_point_lever_arm_command* self); -void extract_mip_filter_ref_point_lever_arm_command(struct mip_serializer* serializer, mip_filter_ref_point_lever_arm_command* self); -void insert_mip_filter_ref_point_lever_arm_command_reference_point_selector(struct mip_serializer* serializer, const mip_filter_ref_point_lever_arm_command_reference_point_selector self); -void extract_mip_filter_ref_point_lever_arm_command_reference_point_selector(struct mip_serializer* serializer, mip_filter_ref_point_lever_arm_command_reference_point_selector* self); +void insert_mip_filter_ref_point_lever_arm_command(microstrain_serializer* serializer, const mip_filter_ref_point_lever_arm_command* self); +void extract_mip_filter_ref_point_lever_arm_command(microstrain_serializer* serializer, mip_filter_ref_point_lever_arm_command* self); struct mip_filter_ref_point_lever_arm_response { mip_filter_ref_point_lever_arm_command_reference_point_selector ref_point_sel; ///< Reserved, must be 1 mip_vector3f lever_arm_offset; ///< [m] Lever arm offset vector in the vehicle's reference frame. - }; typedef struct mip_filter_ref_point_lever_arm_response mip_filter_ref_point_lever_arm_response; -void insert_mip_filter_ref_point_lever_arm_response(struct mip_serializer* serializer, const mip_filter_ref_point_lever_arm_response* self); -void extract_mip_filter_ref_point_lever_arm_response(struct mip_serializer* serializer, mip_filter_ref_point_lever_arm_response* self); -mip_cmd_result mip_filter_write_ref_point_lever_arm(struct mip_interface* device, mip_filter_ref_point_lever_arm_command_reference_point_selector ref_point_sel, const float* lever_arm_offset); -mip_cmd_result mip_filter_read_ref_point_lever_arm(struct mip_interface* device, mip_filter_ref_point_lever_arm_command_reference_point_selector* ref_point_sel_out, float* lever_arm_offset_out); -mip_cmd_result mip_filter_save_ref_point_lever_arm(struct mip_interface* device); -mip_cmd_result mip_filter_load_ref_point_lever_arm(struct mip_interface* device); -mip_cmd_result mip_filter_default_ref_point_lever_arm(struct mip_interface* device); +void insert_mip_filter_ref_point_lever_arm_response(microstrain_serializer* serializer, const mip_filter_ref_point_lever_arm_response* self); +void extract_mip_filter_ref_point_lever_arm_response(microstrain_serializer* serializer, mip_filter_ref_point_lever_arm_response* self); + +mip_cmd_result mip_filter_write_ref_point_lever_arm(mip_interface* device, mip_filter_ref_point_lever_arm_command_reference_point_selector ref_point_sel, const float* lever_arm_offset); +mip_cmd_result mip_filter_read_ref_point_lever_arm(mip_interface* device, mip_filter_ref_point_lever_arm_command_reference_point_selector* ref_point_sel_out, float* lever_arm_offset_out); +mip_cmd_result mip_filter_save_ref_point_lever_arm(mip_interface* device); +mip_cmd_result mip_filter_load_ref_point_lever_arm(mip_interface* device); +mip_cmd_result mip_filter_default_ref_point_lever_arm(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_speed_measurement (0x0D,0x60) Speed Measurement [C] +///@defgroup filter_speed_measurement_c (0x0D,0x60) Speed Measurement /// Speed aiding measurement, where speed is defined as rate of motion along the vehicle's x-axis direction. /// Can be used by an external odometer/speedometer, for example. /// This command cannot be used if the internal odometer is configured. @@ -2096,18 +2258,18 @@ struct mip_filter_speed_measurement_command float time_of_week; ///< GPS time of week when speed was sampled float speed; ///< Estimated speed along vehicle's x-axis (may be positive or negative) [meters/second] float speed_uncertainty; ///< Estimated uncertainty in the speed measurement (1-sigma value) [meters/second] - }; typedef struct mip_filter_speed_measurement_command mip_filter_speed_measurement_command; -void insert_mip_filter_speed_measurement_command(struct mip_serializer* serializer, const mip_filter_speed_measurement_command* self); -void extract_mip_filter_speed_measurement_command(struct mip_serializer* serializer, mip_filter_speed_measurement_command* self); -mip_cmd_result mip_filter_speed_measurement(struct mip_interface* device, uint8_t source, float time_of_week, float speed, float speed_uncertainty); +void insert_mip_filter_speed_measurement_command(microstrain_serializer* serializer, const mip_filter_speed_measurement_command* self); +void extract_mip_filter_speed_measurement_command(microstrain_serializer* serializer, mip_filter_speed_measurement_command* self); + +mip_cmd_result mip_filter_speed_measurement(mip_interface* device, uint8_t source, float time_of_week, float speed, float speed_uncertainty); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_speed_lever_arm (0x0D,0x61) Speed Lever Arm [C] +///@defgroup filter_speed_lever_arm_c (0x0D,0x61) Speed Lever Arm /// Lever arm offset for speed measurements. /// This is used to compensate for an off-center measurement point /// having a different speed due to rotation of the vehicle. @@ -2123,32 +2285,32 @@ struct mip_filter_speed_lever_arm_command mip_function_selector function; uint8_t source; ///< Reserved, must be 1. mip_vector3f lever_arm_offset; ///< [m] Lever arm offset vector in the vehicle's reference frame. - }; typedef struct mip_filter_speed_lever_arm_command mip_filter_speed_lever_arm_command; -void insert_mip_filter_speed_lever_arm_command(struct mip_serializer* serializer, const mip_filter_speed_lever_arm_command* self); -void extract_mip_filter_speed_lever_arm_command(struct mip_serializer* serializer, mip_filter_speed_lever_arm_command* self); + +void insert_mip_filter_speed_lever_arm_command(microstrain_serializer* serializer, const mip_filter_speed_lever_arm_command* self); +void extract_mip_filter_speed_lever_arm_command(microstrain_serializer* serializer, mip_filter_speed_lever_arm_command* self); struct mip_filter_speed_lever_arm_response { uint8_t source; ///< Reserved, must be 1. mip_vector3f lever_arm_offset; ///< [m] Lever arm offset vector in the vehicle's reference frame. - }; typedef struct mip_filter_speed_lever_arm_response mip_filter_speed_lever_arm_response; -void insert_mip_filter_speed_lever_arm_response(struct mip_serializer* serializer, const mip_filter_speed_lever_arm_response* self); -void extract_mip_filter_speed_lever_arm_response(struct mip_serializer* serializer, mip_filter_speed_lever_arm_response* self); -mip_cmd_result mip_filter_write_speed_lever_arm(struct mip_interface* device, uint8_t source, const float* lever_arm_offset); -mip_cmd_result mip_filter_read_speed_lever_arm(struct mip_interface* device, uint8_t source, float* lever_arm_offset_out); -mip_cmd_result mip_filter_save_speed_lever_arm(struct mip_interface* device, uint8_t source); -mip_cmd_result mip_filter_load_speed_lever_arm(struct mip_interface* device, uint8_t source); -mip_cmd_result mip_filter_default_speed_lever_arm(struct mip_interface* device, uint8_t source); +void insert_mip_filter_speed_lever_arm_response(microstrain_serializer* serializer, const mip_filter_speed_lever_arm_response* self); +void extract_mip_filter_speed_lever_arm_response(microstrain_serializer* serializer, mip_filter_speed_lever_arm_response* self); + +mip_cmd_result mip_filter_write_speed_lever_arm(mip_interface* device, uint8_t source, const float* lever_arm_offset); +mip_cmd_result mip_filter_read_speed_lever_arm(mip_interface* device, uint8_t source, float* lever_arm_offset_out); +mip_cmd_result mip_filter_save_speed_lever_arm(mip_interface* device, uint8_t source); +mip_cmd_result mip_filter_load_speed_lever_arm(mip_interface* device, uint8_t source); +mip_cmd_result mip_filter_default_speed_lever_arm(mip_interface* device, uint8_t source); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_wheeled_vehicle_constraint_control (0x0D,0x63) Wheeled Vehicle Constraint Control [C] +///@defgroup filter_wheeled_vehicle_constraint_control_c (0x0D,0x63) Wheeled Vehicle Constraint Control /// Configure the wheeled vehicle kinematic constraint. /// /// When enabled, the filter uses the assumption that velocity is constrained to the primary vehicle axis. @@ -2163,31 +2325,31 @@ struct mip_filter_wheeled_vehicle_constraint_control_command { mip_function_selector function; uint8_t enable; ///< 0 - Disable, 1 - Enable - }; typedef struct mip_filter_wheeled_vehicle_constraint_control_command mip_filter_wheeled_vehicle_constraint_control_command; -void insert_mip_filter_wheeled_vehicle_constraint_control_command(struct mip_serializer* serializer, const mip_filter_wheeled_vehicle_constraint_control_command* self); -void extract_mip_filter_wheeled_vehicle_constraint_control_command(struct mip_serializer* serializer, mip_filter_wheeled_vehicle_constraint_control_command* self); + +void insert_mip_filter_wheeled_vehicle_constraint_control_command(microstrain_serializer* serializer, const mip_filter_wheeled_vehicle_constraint_control_command* self); +void extract_mip_filter_wheeled_vehicle_constraint_control_command(microstrain_serializer* serializer, mip_filter_wheeled_vehicle_constraint_control_command* self); struct mip_filter_wheeled_vehicle_constraint_control_response { uint8_t enable; ///< 0 - Disable, 1 - Enable - }; typedef struct mip_filter_wheeled_vehicle_constraint_control_response mip_filter_wheeled_vehicle_constraint_control_response; -void insert_mip_filter_wheeled_vehicle_constraint_control_response(struct mip_serializer* serializer, const mip_filter_wheeled_vehicle_constraint_control_response* self); -void extract_mip_filter_wheeled_vehicle_constraint_control_response(struct mip_serializer* serializer, mip_filter_wheeled_vehicle_constraint_control_response* self); -mip_cmd_result mip_filter_write_wheeled_vehicle_constraint_control(struct mip_interface* device, uint8_t enable); -mip_cmd_result mip_filter_read_wheeled_vehicle_constraint_control(struct mip_interface* device, uint8_t* enable_out); -mip_cmd_result mip_filter_save_wheeled_vehicle_constraint_control(struct mip_interface* device); -mip_cmd_result mip_filter_load_wheeled_vehicle_constraint_control(struct mip_interface* device); -mip_cmd_result mip_filter_default_wheeled_vehicle_constraint_control(struct mip_interface* device); +void insert_mip_filter_wheeled_vehicle_constraint_control_response(microstrain_serializer* serializer, const mip_filter_wheeled_vehicle_constraint_control_response* self); +void extract_mip_filter_wheeled_vehicle_constraint_control_response(microstrain_serializer* serializer, mip_filter_wheeled_vehicle_constraint_control_response* self); + +mip_cmd_result mip_filter_write_wheeled_vehicle_constraint_control(mip_interface* device, uint8_t enable); +mip_cmd_result mip_filter_read_wheeled_vehicle_constraint_control(mip_interface* device, uint8_t* enable_out); +mip_cmd_result mip_filter_save_wheeled_vehicle_constraint_control(mip_interface* device); +mip_cmd_result mip_filter_load_wheeled_vehicle_constraint_control(mip_interface* device); +mip_cmd_result mip_filter_default_wheeled_vehicle_constraint_control(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_vertical_gyro_constraint_control (0x0D,0x62) Vertical Gyro Constraint Control [C] +///@defgroup filter_vertical_gyro_constraint_control_c (0x0D,0x62) Vertical Gyro Constraint Control /// Configure the vertical gyro kinematic constraint. /// /// When enabled and no valid GNSS measurements are available, the filter uses the accelerometers to track pitch @@ -2200,31 +2362,31 @@ struct mip_filter_vertical_gyro_constraint_control_command { mip_function_selector function; uint8_t enable; ///< 0 - Disable, 1 - Enable - }; typedef struct mip_filter_vertical_gyro_constraint_control_command mip_filter_vertical_gyro_constraint_control_command; -void insert_mip_filter_vertical_gyro_constraint_control_command(struct mip_serializer* serializer, const mip_filter_vertical_gyro_constraint_control_command* self); -void extract_mip_filter_vertical_gyro_constraint_control_command(struct mip_serializer* serializer, mip_filter_vertical_gyro_constraint_control_command* self); + +void insert_mip_filter_vertical_gyro_constraint_control_command(microstrain_serializer* serializer, const mip_filter_vertical_gyro_constraint_control_command* self); +void extract_mip_filter_vertical_gyro_constraint_control_command(microstrain_serializer* serializer, mip_filter_vertical_gyro_constraint_control_command* self); struct mip_filter_vertical_gyro_constraint_control_response { uint8_t enable; ///< 0 - Disable, 1 - Enable - }; typedef struct mip_filter_vertical_gyro_constraint_control_response mip_filter_vertical_gyro_constraint_control_response; -void insert_mip_filter_vertical_gyro_constraint_control_response(struct mip_serializer* serializer, const mip_filter_vertical_gyro_constraint_control_response* self); -void extract_mip_filter_vertical_gyro_constraint_control_response(struct mip_serializer* serializer, mip_filter_vertical_gyro_constraint_control_response* self); -mip_cmd_result mip_filter_write_vertical_gyro_constraint_control(struct mip_interface* device, uint8_t enable); -mip_cmd_result mip_filter_read_vertical_gyro_constraint_control(struct mip_interface* device, uint8_t* enable_out); -mip_cmd_result mip_filter_save_vertical_gyro_constraint_control(struct mip_interface* device); -mip_cmd_result mip_filter_load_vertical_gyro_constraint_control(struct mip_interface* device); -mip_cmd_result mip_filter_default_vertical_gyro_constraint_control(struct mip_interface* device); +void insert_mip_filter_vertical_gyro_constraint_control_response(microstrain_serializer* serializer, const mip_filter_vertical_gyro_constraint_control_response* self); +void extract_mip_filter_vertical_gyro_constraint_control_response(microstrain_serializer* serializer, mip_filter_vertical_gyro_constraint_control_response* self); + +mip_cmd_result mip_filter_write_vertical_gyro_constraint_control(mip_interface* device, uint8_t enable); +mip_cmd_result mip_filter_read_vertical_gyro_constraint_control(mip_interface* device, uint8_t* enable_out); +mip_cmd_result mip_filter_save_vertical_gyro_constraint_control(mip_interface* device); +mip_cmd_result mip_filter_load_vertical_gyro_constraint_control(mip_interface* device); +mip_cmd_result mip_filter_default_vertical_gyro_constraint_control(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_gnss_antenna_cal_control (0x0D,0x64) Gnss Antenna Cal Control [C] +///@defgroup filter_gnss_antenna_cal_control_c (0x0D,0x64) Gnss Antenna Cal Control /// Configure the GNSS antenna lever arm calibration. /// /// When enabled, the filter will enable lever arm error tracking, up to the maximum offset specified. @@ -2236,32 +2398,32 @@ struct mip_filter_gnss_antenna_cal_control_command mip_function_selector function; uint8_t enable; ///< 0 - Disable, 1 - Enable float max_offset; ///< Maximum absolute value of lever arm offset error in the vehicle frame [meters]. See device user manual for the valid range of this parameter. - }; typedef struct mip_filter_gnss_antenna_cal_control_command mip_filter_gnss_antenna_cal_control_command; -void insert_mip_filter_gnss_antenna_cal_control_command(struct mip_serializer* serializer, const mip_filter_gnss_antenna_cal_control_command* self); -void extract_mip_filter_gnss_antenna_cal_control_command(struct mip_serializer* serializer, mip_filter_gnss_antenna_cal_control_command* self); + +void insert_mip_filter_gnss_antenna_cal_control_command(microstrain_serializer* serializer, const mip_filter_gnss_antenna_cal_control_command* self); +void extract_mip_filter_gnss_antenna_cal_control_command(microstrain_serializer* serializer, mip_filter_gnss_antenna_cal_control_command* self); struct mip_filter_gnss_antenna_cal_control_response { uint8_t enable; ///< 0 - Disable, 1 - Enable float max_offset; ///< Maximum absolute value of lever arm offset error in the vehicle frame [meters]. See device user manual for the valid range of this parameter. - }; typedef struct mip_filter_gnss_antenna_cal_control_response mip_filter_gnss_antenna_cal_control_response; -void insert_mip_filter_gnss_antenna_cal_control_response(struct mip_serializer* serializer, const mip_filter_gnss_antenna_cal_control_response* self); -void extract_mip_filter_gnss_antenna_cal_control_response(struct mip_serializer* serializer, mip_filter_gnss_antenna_cal_control_response* self); -mip_cmd_result mip_filter_write_gnss_antenna_cal_control(struct mip_interface* device, uint8_t enable, float max_offset); -mip_cmd_result mip_filter_read_gnss_antenna_cal_control(struct mip_interface* device, uint8_t* enable_out, float* max_offset_out); -mip_cmd_result mip_filter_save_gnss_antenna_cal_control(struct mip_interface* device); -mip_cmd_result mip_filter_load_gnss_antenna_cal_control(struct mip_interface* device); -mip_cmd_result mip_filter_default_gnss_antenna_cal_control(struct mip_interface* device); +void insert_mip_filter_gnss_antenna_cal_control_response(microstrain_serializer* serializer, const mip_filter_gnss_antenna_cal_control_response* self); +void extract_mip_filter_gnss_antenna_cal_control_response(microstrain_serializer* serializer, mip_filter_gnss_antenna_cal_control_response* self); + +mip_cmd_result mip_filter_write_gnss_antenna_cal_control(mip_interface* device, uint8_t enable, float max_offset); +mip_cmd_result mip_filter_read_gnss_antenna_cal_control(mip_interface* device, uint8_t* enable_out, float* max_offset_out); +mip_cmd_result mip_filter_save_gnss_antenna_cal_control(mip_interface* device); +mip_cmd_result mip_filter_load_gnss_antenna_cal_control(mip_interface* device); +mip_cmd_result mip_filter_default_gnss_antenna_cal_control(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_set_initial_heading (0x0D,0x03) Set Initial Heading [C] +///@defgroup filter_set_initial_heading_c (0x0D,0x03) Set Initial Heading /// Set the initial heading angle. /// /// The estimation filter will reset the heading estimate to provided value. If the product supports magnetometer aiding and this feature has been enabled, the heading @@ -2272,13 +2434,13 @@ mip_cmd_result mip_filter_default_gnss_antenna_cal_control(struct mip_interface* struct mip_filter_set_initial_heading_command { float heading; ///< Initial heading in radians [-pi, pi] - }; typedef struct mip_filter_set_initial_heading_command mip_filter_set_initial_heading_command; -void insert_mip_filter_set_initial_heading_command(struct mip_serializer* serializer, const mip_filter_set_initial_heading_command* self); -void extract_mip_filter_set_initial_heading_command(struct mip_serializer* serializer, mip_filter_set_initial_heading_command* self); -mip_cmd_result mip_filter_set_initial_heading(struct mip_interface* device, float heading); +void insert_mip_filter_set_initial_heading_command(microstrain_serializer* serializer, const mip_filter_set_initial_heading_command* self); +void extract_mip_filter_set_initial_heading_command(microstrain_serializer* serializer, mip_filter_set_initial_heading_command* self); + +mip_cmd_result mip_filter_set_initial_heading(mip_interface* device, float heading); ///@} /// @@ -2288,8 +2450,8 @@ mip_cmd_result mip_filter_set_initial_heading(struct mip_interface* device, floa /// //////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus +} // extern "C" } // namespace C } // namespace mip -} // extern "C" #endif // __cplusplus diff --git a/src/c/mip/definitions/commands_gnss.c b/src/c/mip/definitions/commands_gnss.c new file mode 100644 index 000000000..2d78d89aa --- /dev/null +++ b/src/c/mip/definitions/commands_gnss.c @@ -0,0 +1,368 @@ + +#include "commands_gnss.h" + +#include +#include + +#include + + +#ifdef __cplusplus +namespace mip { +namespace C { +extern "C" { + +#endif // __cplusplus + + +//////////////////////////////////////////////////////////////////////////////// +// Mip Fields +//////////////////////////////////////////////////////////////////////////////// + +void insert_mip_gnss_receiver_info_command_info(microstrain_serializer* serializer, const mip_gnss_receiver_info_command_info* self) +{ + microstrain_insert_u8(serializer, self->receiver_id); + + microstrain_insert_u8(serializer, self->mip_data_descriptor_set); + + for(unsigned int i=0; i < 32; i++) + microstrain_insert_char(serializer, self->description[i]); + +} +void extract_mip_gnss_receiver_info_command_info(microstrain_serializer* serializer, mip_gnss_receiver_info_command_info* self) +{ + microstrain_extract_u8(serializer, &self->receiver_id); + + microstrain_extract_u8(serializer, &self->mip_data_descriptor_set); + + for(unsigned int i=0; i < 32; i++) + microstrain_extract_char(serializer, &self->description[i]); + +} + +mip_cmd_result mip_gnss_receiver_info(mip_interface* device, uint8_t* num_receivers_out, uint8_t num_receivers_out_max, mip_gnss_receiver_info_command_info* receiver_info_out) +{ + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + uint8_t responseLength = sizeof(buffer); + + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_GNSS_CMD_DESC_SET, MIP_CMD_DESC_GNSS_LIST_RECEIVERS, NULL, 0, MIP_REPLY_DESC_GNSS_LIST_RECEIVERS, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(num_receivers_out); + microstrain_extract_count(&deserializer, num_receivers_out, num_receivers_out_max); + + assert(receiver_info_out || (num_receivers_out == 0)); + for(unsigned int i=0; i < *num_receivers_out; i++) + extract_mip_gnss_receiver_info_command_info(&deserializer, &receiver_info_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +void insert_mip_gnss_signal_configuration_command(microstrain_serializer* serializer, const mip_gnss_signal_configuration_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_u8(serializer, self->gps_enable); + + microstrain_insert_u8(serializer, self->glonass_enable); + + microstrain_insert_u8(serializer, self->galileo_enable); + + microstrain_insert_u8(serializer, self->beidou_enable); + + for(unsigned int i=0; i < 4; i++) + microstrain_insert_u8(serializer, self->reserved[i]); + + } +} +void extract_mip_gnss_signal_configuration_command(microstrain_serializer* serializer, mip_gnss_signal_configuration_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_extract_u8(serializer, &self->gps_enable); + + microstrain_extract_u8(serializer, &self->glonass_enable); + + microstrain_extract_u8(serializer, &self->galileo_enable); + + microstrain_extract_u8(serializer, &self->beidou_enable); + + for(unsigned int i=0; i < 4; i++) + microstrain_extract_u8(serializer, &self->reserved[i]); + + } +} + +void insert_mip_gnss_signal_configuration_response(microstrain_serializer* serializer, const mip_gnss_signal_configuration_response* self) +{ + microstrain_insert_u8(serializer, self->gps_enable); + + microstrain_insert_u8(serializer, self->glonass_enable); + + microstrain_insert_u8(serializer, self->galileo_enable); + + microstrain_insert_u8(serializer, self->beidou_enable); + + for(unsigned int i=0; i < 4; i++) + microstrain_insert_u8(serializer, self->reserved[i]); + +} +void extract_mip_gnss_signal_configuration_response(microstrain_serializer* serializer, mip_gnss_signal_configuration_response* self) +{ + microstrain_extract_u8(serializer, &self->gps_enable); + + microstrain_extract_u8(serializer, &self->glonass_enable); + + microstrain_extract_u8(serializer, &self->galileo_enable); + + microstrain_extract_u8(serializer, &self->beidou_enable); + + for(unsigned int i=0; i < 4; i++) + microstrain_extract_u8(serializer, &self->reserved[i]); + +} + +mip_cmd_result mip_gnss_write_signal_configuration(mip_interface* device, uint8_t gps_enable, uint8_t glonass_enable, uint8_t galileo_enable, uint8_t beidou_enable, const uint8_t* reserved) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_u8(&serializer, gps_enable); + + microstrain_insert_u8(&serializer, glonass_enable); + + microstrain_insert_u8(&serializer, galileo_enable); + + microstrain_insert_u8(&serializer, beidou_enable); + + assert(reserved); + for(unsigned int i=0; i < 4; i++) + microstrain_insert_u8(&serializer, reserved[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_GNSS_CMD_DESC_SET, MIP_CMD_DESC_GNSS_SIGNAL_CONFIGURATION, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_gnss_read_signal_configuration(mip_interface* device, uint8_t* gps_enable_out, uint8_t* glonass_enable_out, uint8_t* galileo_enable_out, uint8_t* beidou_enable_out, uint8_t* reserved_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_GNSS_CMD_DESC_SET, MIP_CMD_DESC_GNSS_SIGNAL_CONFIGURATION, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_GNSS_SIGNAL_CONFIGURATION, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(gps_enable_out); + microstrain_extract_u8(&deserializer, gps_enable_out); + + assert(glonass_enable_out); + microstrain_extract_u8(&deserializer, glonass_enable_out); + + assert(galileo_enable_out); + microstrain_extract_u8(&deserializer, galileo_enable_out); + + assert(beidou_enable_out); + microstrain_extract_u8(&deserializer, beidou_enable_out); + + assert(reserved_out); + for(unsigned int i=0; i < 4; i++) + microstrain_extract_u8(&deserializer, &reserved_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_gnss_save_signal_configuration(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_GNSS_CMD_DESC_SET, MIP_CMD_DESC_GNSS_SIGNAL_CONFIGURATION, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_gnss_load_signal_configuration(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_GNSS_CMD_DESC_SET, MIP_CMD_DESC_GNSS_SIGNAL_CONFIGURATION, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_gnss_default_signal_configuration(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_GNSS_CMD_DESC_SET, MIP_CMD_DESC_GNSS_SIGNAL_CONFIGURATION, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_gnss_rtk_dongle_configuration_command(microstrain_serializer* serializer, const mip_gnss_rtk_dongle_configuration_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_u8(serializer, self->enable); + + for(unsigned int i=0; i < 3; i++) + microstrain_insert_u8(serializer, self->reserved[i]); + + } +} +void extract_mip_gnss_rtk_dongle_configuration_command(microstrain_serializer* serializer, mip_gnss_rtk_dongle_configuration_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_extract_u8(serializer, &self->enable); + + for(unsigned int i=0; i < 3; i++) + microstrain_extract_u8(serializer, &self->reserved[i]); + + } +} + +void insert_mip_gnss_rtk_dongle_configuration_response(microstrain_serializer* serializer, const mip_gnss_rtk_dongle_configuration_response* self) +{ + microstrain_insert_u8(serializer, self->enable); + + for(unsigned int i=0; i < 3; i++) + microstrain_insert_u8(serializer, self->reserved[i]); + +} +void extract_mip_gnss_rtk_dongle_configuration_response(microstrain_serializer* serializer, mip_gnss_rtk_dongle_configuration_response* self) +{ + microstrain_extract_u8(serializer, &self->enable); + + for(unsigned int i=0; i < 3; i++) + microstrain_extract_u8(serializer, &self->reserved[i]); + +} + +mip_cmd_result mip_gnss_write_rtk_dongle_configuration(mip_interface* device, uint8_t enable, const uint8_t* reserved) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_u8(&serializer, enable); + + assert(reserved); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_u8(&serializer, reserved[i]); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_GNSS_CMD_DESC_SET, MIP_CMD_DESC_GNSS_RTK_DONGLE_CONFIGURATION, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_gnss_read_rtk_dongle_configuration(mip_interface* device, uint8_t* enable_out, uint8_t* reserved_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_GNSS_CMD_DESC_SET, MIP_CMD_DESC_GNSS_RTK_DONGLE_CONFIGURATION, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_GNSS_RTK_DONGLE_CONFIGURATION, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(enable_out); + microstrain_extract_u8(&deserializer, enable_out); + + assert(reserved_out); + for(unsigned int i=0; i < 3; i++) + microstrain_extract_u8(&deserializer, &reserved_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_gnss_save_rtk_dongle_configuration(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_GNSS_CMD_DESC_SET, MIP_CMD_DESC_GNSS_RTK_DONGLE_CONFIGURATION, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_gnss_load_rtk_dongle_configuration(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_GNSS_CMD_DESC_SET, MIP_CMD_DESC_GNSS_RTK_DONGLE_CONFIGURATION, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_gnss_default_rtk_dongle_configuration(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_GNSS_CMD_DESC_SET, MIP_CMD_DESC_GNSS_RTK_DONGLE_CONFIGURATION, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} + +#ifdef __cplusplus +} // extern "C" +} // namespace C +} // namespace mip +#endif // __cplusplus + diff --git a/src/mip/definitions/commands_gnss.h b/src/c/mip/definitions/commands_gnss.h similarity index 54% rename from src/mip/definitions/commands_gnss.h rename to src/c/mip/definitions/commands_gnss.h index 2f024f2cc..46c37ab66 100644 --- a/src/mip/definitions/commands_gnss.h +++ b/src/c/mip/definitions/commands_gnss.h @@ -1,8 +1,9 @@ #pragma once -#include "common.h" -#include "descriptors.h" -#include "../mip_result.h" +#include +#include +#include +#include #include #include @@ -14,14 +15,11 @@ namespace C { extern "C" { #endif // __cplusplus -struct mip_interface; -struct mip_serializer; -struct mip_field; //////////////////////////////////////////////////////////////////////////////// -///@addtogroup MipCommands_c MIP Commands [C] +///@addtogroup MipCommands_c ///@{ -///@defgroup gnss_commands_c Gnss Commands [C] +///@defgroup gnss_commands_c Gnss Commands /// ///@{ @@ -48,19 +46,22 @@ enum enum { MIP_GNSS_GPS_ENABLE_L1CA = 0x0001 }; enum { MIP_GNSS_GPS_ENABLE_L2C = 0x0002 }; +enum { MIP_GNSS_GPS_ENABLE_L5 = 0x0004 }; enum { MIP_GNSS_GLONASS_ENABLE_L1OF = 0x0001 }; enum { MIP_GNSS_GLONASS_ENABLE_L2OF = 0x0002 }; enum { MIP_GNSS_GALILEO_ENABLE_E1 = 0x0001 }; enum { MIP_GNSS_GALILEO_ENABLE_E5B = 0x0002 }; +enum { MIP_GNSS_GALILEO_ENABLE_E5A = 0x0004 }; enum { MIP_GNSS_BEIDOU_ENABLE_B1 = 0x0001 }; enum { MIP_GNSS_BEIDOU_ENABLE_B2 = 0x0002 }; +enum { MIP_GNSS_BEIDOU_ENABLE_B2A = 0x0004 }; //////////////////////////////////////////////////////////////////////////////// // Mip Fields //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_gnss_receiver_info (0x0E,0x01) Receiver Info [C] +///@defgroup gnss_receiver_info_c (0x0E,0x01) Receiver Info /// Return information about the GNSS receivers in the device. /// /// @@ -71,28 +72,31 @@ struct mip_gnss_receiver_info_command_info uint8_t receiver_id; ///< Receiver id: e.g. 1, 2, etc. uint8_t mip_data_descriptor_set; ///< MIP descriptor set associated with this receiver char description[32]; ///< Ascii description of receiver. Contains the following info (comma-delimited):
Module name/model
Firmware version info - }; typedef struct mip_gnss_receiver_info_command_info mip_gnss_receiver_info_command_info; -void insert_mip_gnss_receiver_info_command_info(struct mip_serializer* serializer, const mip_gnss_receiver_info_command_info* self); -void extract_mip_gnss_receiver_info_command_info(struct mip_serializer* serializer, mip_gnss_receiver_info_command_info* self); + +void insert_mip_gnss_receiver_info_command_info(microstrain_serializer* serializer, const mip_gnss_receiver_info_command_info* self); +void extract_mip_gnss_receiver_info_command_info(microstrain_serializer* serializer, mip_gnss_receiver_info_command_info* self); + + +typedef struct mip_gnss_receiver_info_command mip_gnss_receiver_info_command; ///< No parameters (empty struct not allowed in C) struct mip_gnss_receiver_info_response { uint8_t num_receivers; ///< Number of physical receivers in the device mip_gnss_receiver_info_command_info receiver_info[5]; - }; typedef struct mip_gnss_receiver_info_response mip_gnss_receiver_info_response; -void insert_mip_gnss_receiver_info_response(struct mip_serializer* serializer, const mip_gnss_receiver_info_response* self); -void extract_mip_gnss_receiver_info_response(struct mip_serializer* serializer, mip_gnss_receiver_info_response* self); -mip_cmd_result mip_gnss_receiver_info(struct mip_interface* device, uint8_t* num_receivers_out, uint8_t num_receivers_out_max, mip_gnss_receiver_info_command_info* receiver_info_out); +void insert_mip_gnss_receiver_info_response(microstrain_serializer* serializer, const mip_gnss_receiver_info_response* self); +void extract_mip_gnss_receiver_info_response(microstrain_serializer* serializer, mip_gnss_receiver_info_response* self); + +mip_cmd_result mip_gnss_receiver_info(mip_interface* device, uint8_t* num_receivers_out, uint8_t num_receivers_out_max, mip_gnss_receiver_info_command_info* receiver_info_out); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_gnss_signal_configuration (0x0E,0x02) Signal Configuration [C] +///@defgroup gnss_signal_configuration_c (0x0E,0x02) Signal Configuration /// Configure the GNSS signals used by the device. /// /// @@ -101,40 +105,40 @@ mip_cmd_result mip_gnss_receiver_info(struct mip_interface* device, uint8_t* num struct mip_gnss_signal_configuration_command { mip_function_selector function; - uint8_t gps_enable; ///< Bitfield 0: Enable L1CA, 1: Enable L2C + uint8_t gps_enable; ///< Bitfield 0: Enable L1CA, 1: Enable L2C, 2: Enable L5 uint8_t glonass_enable; ///< Bitfield 0: Enable L1OF, 1: Enable L2OF - uint8_t galileo_enable; ///< Bitfield 0: Enable E1, 1: Enable E5B - uint8_t beidou_enable; ///< Bitfield 0: Enable B1, 1: Enable B2 + uint8_t galileo_enable; ///< Bitfield 0: Enable E1, 1: Enable E5B, 2: Enable E5A + uint8_t beidou_enable; ///< Bitfield 0: Enable B1, 1: Enable B2, 2: Enable B2A uint8_t reserved[4]; - }; typedef struct mip_gnss_signal_configuration_command mip_gnss_signal_configuration_command; -void insert_mip_gnss_signal_configuration_command(struct mip_serializer* serializer, const mip_gnss_signal_configuration_command* self); -void extract_mip_gnss_signal_configuration_command(struct mip_serializer* serializer, mip_gnss_signal_configuration_command* self); + +void insert_mip_gnss_signal_configuration_command(microstrain_serializer* serializer, const mip_gnss_signal_configuration_command* self); +void extract_mip_gnss_signal_configuration_command(microstrain_serializer* serializer, mip_gnss_signal_configuration_command* self); struct mip_gnss_signal_configuration_response { - uint8_t gps_enable; ///< Bitfield 0: Enable L1CA, 1: Enable L2C + uint8_t gps_enable; ///< Bitfield 0: Enable L1CA, 1: Enable L2C, 2: Enable L5 uint8_t glonass_enable; ///< Bitfield 0: Enable L1OF, 1: Enable L2OF - uint8_t galileo_enable; ///< Bitfield 0: Enable E1, 1: Enable E5B - uint8_t beidou_enable; ///< Bitfield 0: Enable B1, 1: Enable B2 + uint8_t galileo_enable; ///< Bitfield 0: Enable E1, 1: Enable E5B, 2: Enable E5A + uint8_t beidou_enable; ///< Bitfield 0: Enable B1, 1: Enable B2, 2: Enable B2A uint8_t reserved[4]; - }; typedef struct mip_gnss_signal_configuration_response mip_gnss_signal_configuration_response; -void insert_mip_gnss_signal_configuration_response(struct mip_serializer* serializer, const mip_gnss_signal_configuration_response* self); -void extract_mip_gnss_signal_configuration_response(struct mip_serializer* serializer, mip_gnss_signal_configuration_response* self); -mip_cmd_result mip_gnss_write_signal_configuration(struct mip_interface* device, uint8_t gps_enable, uint8_t glonass_enable, uint8_t galileo_enable, uint8_t beidou_enable, const uint8_t* reserved); -mip_cmd_result mip_gnss_read_signal_configuration(struct mip_interface* device, uint8_t* gps_enable_out, uint8_t* glonass_enable_out, uint8_t* galileo_enable_out, uint8_t* beidou_enable_out, uint8_t* reserved_out); -mip_cmd_result mip_gnss_save_signal_configuration(struct mip_interface* device); -mip_cmd_result mip_gnss_load_signal_configuration(struct mip_interface* device); -mip_cmd_result mip_gnss_default_signal_configuration(struct mip_interface* device); +void insert_mip_gnss_signal_configuration_response(microstrain_serializer* serializer, const mip_gnss_signal_configuration_response* self); +void extract_mip_gnss_signal_configuration_response(microstrain_serializer* serializer, mip_gnss_signal_configuration_response* self); + +mip_cmd_result mip_gnss_write_signal_configuration(mip_interface* device, uint8_t gps_enable, uint8_t glonass_enable, uint8_t galileo_enable, uint8_t beidou_enable, const uint8_t* reserved); +mip_cmd_result mip_gnss_read_signal_configuration(mip_interface* device, uint8_t* gps_enable_out, uint8_t* glonass_enable_out, uint8_t* galileo_enable_out, uint8_t* beidou_enable_out, uint8_t* reserved_out); +mip_cmd_result mip_gnss_save_signal_configuration(mip_interface* device); +mip_cmd_result mip_gnss_load_signal_configuration(mip_interface* device); +mip_cmd_result mip_gnss_default_signal_configuration(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_gnss_rtk_dongle_configuration (0x0E,0x10) Rtk Dongle Configuration [C] +///@defgroup gnss_rtk_dongle_configuration_c (0x0E,0x10) Rtk Dongle Configuration /// Configure the communications with the RTK Dongle connected to the device. /// /// @@ -145,27 +149,27 @@ struct mip_gnss_rtk_dongle_configuration_command mip_function_selector function; uint8_t enable; ///< 0 - Disabled, 1- Enabled uint8_t reserved[3]; - }; typedef struct mip_gnss_rtk_dongle_configuration_command mip_gnss_rtk_dongle_configuration_command; -void insert_mip_gnss_rtk_dongle_configuration_command(struct mip_serializer* serializer, const mip_gnss_rtk_dongle_configuration_command* self); -void extract_mip_gnss_rtk_dongle_configuration_command(struct mip_serializer* serializer, mip_gnss_rtk_dongle_configuration_command* self); + +void insert_mip_gnss_rtk_dongle_configuration_command(microstrain_serializer* serializer, const mip_gnss_rtk_dongle_configuration_command* self); +void extract_mip_gnss_rtk_dongle_configuration_command(microstrain_serializer* serializer, mip_gnss_rtk_dongle_configuration_command* self); struct mip_gnss_rtk_dongle_configuration_response { uint8_t enable; uint8_t reserved[3]; - }; typedef struct mip_gnss_rtk_dongle_configuration_response mip_gnss_rtk_dongle_configuration_response; -void insert_mip_gnss_rtk_dongle_configuration_response(struct mip_serializer* serializer, const mip_gnss_rtk_dongle_configuration_response* self); -void extract_mip_gnss_rtk_dongle_configuration_response(struct mip_serializer* serializer, mip_gnss_rtk_dongle_configuration_response* self); -mip_cmd_result mip_gnss_write_rtk_dongle_configuration(struct mip_interface* device, uint8_t enable, const uint8_t* reserved); -mip_cmd_result mip_gnss_read_rtk_dongle_configuration(struct mip_interface* device, uint8_t* enable_out, uint8_t* reserved_out); -mip_cmd_result mip_gnss_save_rtk_dongle_configuration(struct mip_interface* device); -mip_cmd_result mip_gnss_load_rtk_dongle_configuration(struct mip_interface* device); -mip_cmd_result mip_gnss_default_rtk_dongle_configuration(struct mip_interface* device); +void insert_mip_gnss_rtk_dongle_configuration_response(microstrain_serializer* serializer, const mip_gnss_rtk_dongle_configuration_response* self); +void extract_mip_gnss_rtk_dongle_configuration_response(microstrain_serializer* serializer, mip_gnss_rtk_dongle_configuration_response* self); + +mip_cmd_result mip_gnss_write_rtk_dongle_configuration(mip_interface* device, uint8_t enable, const uint8_t* reserved); +mip_cmd_result mip_gnss_read_rtk_dongle_configuration(mip_interface* device, uint8_t* enable_out, uint8_t* reserved_out); +mip_cmd_result mip_gnss_save_rtk_dongle_configuration(mip_interface* device); +mip_cmd_result mip_gnss_load_rtk_dongle_configuration(mip_interface* device); +mip_cmd_result mip_gnss_default_rtk_dongle_configuration(mip_interface* device); ///@} /// @@ -175,8 +179,8 @@ mip_cmd_result mip_gnss_default_rtk_dongle_configuration(struct mip_interface* d /// //////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus +} // extern "C" } // namespace C } // namespace mip -} // extern "C" #endif // __cplusplus diff --git a/src/c/mip/definitions/commands_rtk.c b/src/c/mip/definitions/commands_rtk.c new file mode 100644 index 000000000..20d5c29d1 --- /dev/null +++ b/src/c/mip/definitions/commands_rtk.c @@ -0,0 +1,438 @@ + +#include "commands_rtk.h" + +#include +#include + +#include + + +#ifdef __cplusplus +namespace mip { +namespace C { +extern "C" { + +#endif // __cplusplus + + +//////////////////////////////////////////////////////////////////////////////// +// Mip Fields +//////////////////////////////////////////////////////////////////////////////// + +mip_cmd_result mip_rtk_get_status_flags(mip_interface* device, mip_rtk_get_status_flags_command_status_flags* flags_out) +{ + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + uint8_t responseLength = sizeof(buffer); + + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_RTK_CMD_DESC_SET, MIP_CMD_DESC_RTK_GET_STATUS_FLAGS, NULL, 0, MIP_REPLY_DESC_RTK_GET_STATUS_FLAGS, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(flags_out); + extract_mip_rtk_get_status_flags_command_status_flags(&deserializer, flags_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_rtk_get_imei(mip_interface* device, char* imei_out) +{ + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + uint8_t responseLength = sizeof(buffer); + + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_RTK_CMD_DESC_SET, MIP_CMD_DESC_RTK_GET_IMEI, NULL, 0, MIP_REPLY_DESC_RTK_GET_IMEI, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(imei_out); + for(unsigned int i=0; i < 32; i++) + microstrain_extract_char(&deserializer, &imei_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_rtk_get_imsi(mip_interface* device, char* imsi_out) +{ + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + uint8_t responseLength = sizeof(buffer); + + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_RTK_CMD_DESC_SET, MIP_CMD_DESC_RTK_GET_IMSI, NULL, 0, MIP_REPLY_DESC_RTK_GET_IMSI, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(imsi_out); + for(unsigned int i=0; i < 32; i++) + microstrain_extract_char(&deserializer, &imsi_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_rtk_get_iccid(mip_interface* device, char* iccid_out) +{ + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + uint8_t responseLength = sizeof(buffer); + + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_RTK_CMD_DESC_SET, MIP_CMD_DESC_RTK_GET_ICCID, NULL, 0, MIP_REPLY_DESC_RTK_GET_ICCID, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(iccid_out); + for(unsigned int i=0; i < 32; i++) + microstrain_extract_char(&deserializer, &iccid_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +void insert_mip_rtk_connected_device_type_command(microstrain_serializer* serializer, const mip_rtk_connected_device_type_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + insert_mip_rtk_connected_device_type_command_type(serializer, self->devType); + + } +} +void extract_mip_rtk_connected_device_type_command(microstrain_serializer* serializer, mip_rtk_connected_device_type_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + extract_mip_rtk_connected_device_type_command_type(serializer, &self->devType); + + } +} + +void insert_mip_rtk_connected_device_type_response(microstrain_serializer* serializer, const mip_rtk_connected_device_type_response* self) +{ + insert_mip_rtk_connected_device_type_command_type(serializer, self->devType); + +} +void extract_mip_rtk_connected_device_type_response(microstrain_serializer* serializer, mip_rtk_connected_device_type_response* self) +{ + extract_mip_rtk_connected_device_type_command_type(serializer, &self->devType); + +} + +mip_cmd_result mip_rtk_write_connected_device_type(mip_interface* device, mip_rtk_connected_device_type_command_type dev_type) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + insert_mip_rtk_connected_device_type_command_type(&serializer, dev_type); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_RTK_CMD_DESC_SET, MIP_CMD_DESC_RTK_CONNECTED_DEVICE_TYPE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_rtk_read_connected_device_type(mip_interface* device, mip_rtk_connected_device_type_command_type* dev_type_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_RTK_CMD_DESC_SET, MIP_CMD_DESC_RTK_CONNECTED_DEVICE_TYPE, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_RTK_CONNECTED_DEVICE_TYPE, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(dev_type_out); + extract_mip_rtk_connected_device_type_command_type(&deserializer, dev_type_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_rtk_save_connected_device_type(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_RTK_CMD_DESC_SET, MIP_CMD_DESC_RTK_CONNECTED_DEVICE_TYPE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_rtk_load_connected_device_type(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_RTK_CMD_DESC_SET, MIP_CMD_DESC_RTK_CONNECTED_DEVICE_TYPE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_rtk_default_connected_device_type(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_RTK_CMD_DESC_SET, MIP_CMD_DESC_RTK_CONNECTED_DEVICE_TYPE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_rtk_get_act_code(mip_interface* device, char* activation_code_out) +{ + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + uint8_t responseLength = sizeof(buffer); + + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_RTK_CMD_DESC_SET, MIP_CMD_DESC_RTK_GET_ACT_CODE, NULL, 0, MIP_REPLY_DESC_RTK_GET_ACT_CODE, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(activation_code_out); + for(unsigned int i=0; i < 32; i++) + microstrain_extract_char(&deserializer, &activation_code_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_rtk_get_modem_firmware_version(mip_interface* device, char* modem_firmware_version_out) +{ + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + uint8_t responseLength = sizeof(buffer); + + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_RTK_CMD_DESC_SET, MIP_CMD_DESC_RTK_GET_MODEM_FIRMWARE_VERSION, NULL, 0, MIP_REPLY_DESC_RTK_GET_MODEM_FIRMWARE_VERSION, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(modem_firmware_version_out); + for(unsigned int i=0; i < 32; i++) + microstrain_extract_char(&deserializer, &modem_firmware_version_out[i]); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_rtk_get_rssi(mip_interface* device, bool* valid_out, int32_t* rssi_out, int32_t* signal_quality_out) +{ + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + uint8_t responseLength = sizeof(buffer); + + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_RTK_CMD_DESC_SET, MIP_CMD_DESC_RTK_GET_RSSI, NULL, 0, MIP_REPLY_DESC_RTK_GET_RSSI, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(valid_out); + microstrain_extract_bool(&deserializer, valid_out); + + assert(rssi_out); + microstrain_extract_s32(&deserializer, rssi_out); + + assert(signal_quality_out); + microstrain_extract_s32(&deserializer, signal_quality_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +void insert_mip_rtk_service_status_command(microstrain_serializer* serializer, const mip_rtk_service_status_command* self) +{ + microstrain_insert_u32(serializer, self->reserved1); + + microstrain_insert_u32(serializer, self->reserved2); + +} +void extract_mip_rtk_service_status_command(microstrain_serializer* serializer, mip_rtk_service_status_command* self) +{ + microstrain_extract_u32(serializer, &self->reserved1); + + microstrain_extract_u32(serializer, &self->reserved2); + +} + +void insert_mip_rtk_service_status_response(microstrain_serializer* serializer, const mip_rtk_service_status_response* self) +{ + insert_mip_rtk_service_status_command_service_flags(serializer, self->flags); + + microstrain_insert_u32(serializer, self->receivedBytes); + + microstrain_insert_u32(serializer, self->lastBytes); + + microstrain_insert_u64(serializer, self->lastBytesTime); + +} +void extract_mip_rtk_service_status_response(microstrain_serializer* serializer, mip_rtk_service_status_response* self) +{ + extract_mip_rtk_service_status_command_service_flags(serializer, &self->flags); + + microstrain_extract_u32(serializer, &self->receivedBytes); + + microstrain_extract_u32(serializer, &self->lastBytes); + + microstrain_extract_u64(serializer, &self->lastBytesTime); + +} + +mip_cmd_result mip_rtk_service_status(mip_interface* device, uint32_t reserved1, uint32_t reserved2, mip_rtk_service_status_command_service_flags* flags_out, uint32_t* received_bytes_out, uint32_t* last_bytes_out, uint64_t* last_bytes_time_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + microstrain_insert_u32(&serializer, reserved1); + + microstrain_insert_u32(&serializer, reserved2); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_RTK_CMD_DESC_SET, MIP_CMD_DESC_RTK_SERVICE_STATUS, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_RTK_SERVICE_STATUS, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(flags_out); + extract_mip_rtk_service_status_command_service_flags(&deserializer, flags_out); + + assert(received_bytes_out); + microstrain_extract_u32(&deserializer, received_bytes_out); + + assert(last_bytes_out); + microstrain_extract_u32(&deserializer, last_bytes_out); + + assert(last_bytes_time_out); + microstrain_extract_u64(&deserializer, last_bytes_time_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +void insert_mip_rtk_prod_erase_storage_command(microstrain_serializer* serializer, const mip_rtk_prod_erase_storage_command* self) +{ + insert_mip_media_selector(serializer, self->media); + +} +void extract_mip_rtk_prod_erase_storage_command(microstrain_serializer* serializer, mip_rtk_prod_erase_storage_command* self) +{ + extract_mip_media_selector(serializer, &self->media); + +} + +mip_cmd_result mip_rtk_prod_erase_storage(mip_interface* device, mip_media_selector media) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_media_selector(&serializer, media); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_RTK_CMD_DESC_SET, MIP_CMD_DESC_RTK_PROD_ERASE_STORAGE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +void insert_mip_rtk_led_control_command(microstrain_serializer* serializer, const mip_rtk_led_control_command* self) +{ + for(unsigned int i=0; i < 3; i++) + microstrain_insert_u8(serializer, self->primaryColor[i]); + + for(unsigned int i=0; i < 3; i++) + microstrain_insert_u8(serializer, self->altColor[i]); + + insert_mip_led_action(serializer, self->act); + + microstrain_insert_u32(serializer, self->period); + +} +void extract_mip_rtk_led_control_command(microstrain_serializer* serializer, mip_rtk_led_control_command* self) +{ + for(unsigned int i=0; i < 3; i++) + microstrain_extract_u8(serializer, &self->primaryColor[i]); + + for(unsigned int i=0; i < 3; i++) + microstrain_extract_u8(serializer, &self->altColor[i]); + + extract_mip_led_action(serializer, &self->act); + + microstrain_extract_u32(serializer, &self->period); + +} + +mip_cmd_result mip_rtk_led_control(mip_interface* device, const uint8_t* primary_color, const uint8_t* alt_color, mip_led_action act, uint32_t period) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + assert(primary_color); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_u8(&serializer, primary_color[i]); + + assert(alt_color); + for(unsigned int i=0; i < 3; i++) + microstrain_insert_u8(&serializer, alt_color[i]); + + insert_mip_led_action(&serializer, act); + + microstrain_insert_u32(&serializer, period); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_RTK_CMD_DESC_SET, MIP_CMD_DESC_LED_CONTROL, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_rtk_modem_hard_reset(mip_interface* device) +{ + return mip_interface_run_command(device, MIP_RTK_CMD_DESC_SET, MIP_CMD_DESC_RTK_MODEM_HARD_RESET, NULL, 0); +} + +#ifdef __cplusplus +} // extern "C" +} // namespace C +} // namespace mip +#endif // __cplusplus + diff --git a/src/mip/definitions/commands_rtk.h b/src/c/mip/definitions/commands_rtk.h similarity index 53% rename from src/mip/definitions/commands_rtk.h rename to src/c/mip/definitions/commands_rtk.h index 6271716eb..b94731c9f 100644 --- a/src/mip/definitions/commands_rtk.h +++ b/src/c/mip/definitions/commands_rtk.h @@ -1,8 +1,9 @@ #pragma once -#include "common.h" -#include "descriptors.h" -#include "../mip_result.h" +#include +#include +#include +#include #include #include @@ -14,14 +15,11 @@ namespace C { extern "C" { #endif // __cplusplus -struct mip_interface; -struct mip_serializer; -struct mip_field; //////////////////////////////////////////////////////////////////////////////// -///@addtogroup MipCommands_c MIP Commands [C] +///@addtogroup MipCommands_c ///@{ -///@defgroup rtk_commands_c Rtk Commands [C] +///@defgroup rtk_commands_c Rtk Commands /// ///@{ @@ -61,20 +59,42 @@ enum // Shared Type Definitions //////////////////////////////////////////////////////////////////////////////// -typedef uint8_t mip_media_selector; -static const mip_media_selector MIP_MEDIA_SELECTOR_MEDIA_EXTERNALFLASH = 0; ///< -static const mip_media_selector MIP_MEDIA_SELECTOR_MEDIA_SD = 1; ///< +enum mip_media_selector +{ + MIP_MEDIA_SELECTOR_MEDIA_EXTERNALFLASH = 0, ///< + MIP_MEDIA_SELECTOR_MEDIA_SD = 1, ///< +}; +typedef enum mip_media_selector mip_media_selector; -void insert_mip_media_selector(struct mip_serializer* serializer, const mip_media_selector self); -void extract_mip_media_selector(struct mip_serializer* serializer, mip_media_selector* self); +static inline void insert_mip_media_selector(microstrain_serializer* serializer, const mip_media_selector self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_media_selector(microstrain_serializer* serializer, mip_media_selector* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} -typedef uint8_t mip_led_action; -static const mip_led_action MIP_LED_ACTION_LED_NONE = 0; ///< -static const mip_led_action MIP_LED_ACTION_LED_FLASH = 1; ///< -static const mip_led_action MIP_LED_ACTION_LED_PULSATE = 2; ///< +enum mip_led_action +{ + MIP_LED_ACTION_LED_NONE = 0, ///< + MIP_LED_ACTION_LED_FLASH = 1, ///< + MIP_LED_ACTION_LED_PULSATE = 2, ///< +}; +typedef enum mip_led_action mip_led_action; -void insert_mip_led_action(struct mip_serializer* serializer, const mip_led_action self); -void extract_mip_led_action(struct mip_serializer* serializer, mip_led_action* self); +static inline void insert_mip_led_action(microstrain_serializer* serializer, const mip_led_action self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_led_action(microstrain_serializer* serializer, mip_led_action* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} //////////////////////////////////////////////////////////////////////////////// @@ -82,7 +102,7 @@ void extract_mip_led_action(struct mip_serializer* serializer, mip_led_action* s //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_rtk_get_status_flags (0x0F,0x01) Get Status Flags [C] +///@defgroup rtk_get_status_flags_c (0x0F,0x01) Get Status Flags /// ///@{ @@ -100,6 +120,16 @@ static const mip_rtk_get_status_flags_command_status_flags_legacy MIP_RTK_GET_ST static const mip_rtk_get_status_flags_command_status_flags_legacy MIP_RTK_GET_STATUS_FLAGS_COMMAND_STATUS_FLAGS_LEGACY_RSRQ = 0x30000000; ///< static const mip_rtk_get_status_flags_command_status_flags_legacy MIP_RTK_GET_STATUS_FLAGS_COMMAND_STATUS_FLAGS_LEGACY_SINR = 0xC0000000; ///< static const mip_rtk_get_status_flags_command_status_flags_legacy MIP_RTK_GET_STATUS_FLAGS_COMMAND_STATUS_FLAGS_LEGACY_ALL = 0xFFFFFFFF; +static inline void insert_mip_rtk_get_status_flags_command_status_flags_legacy(microstrain_serializer* serializer, const mip_rtk_get_status_flags_command_status_flags_legacy self) +{ + microstrain_insert_u32(serializer, (uint32_t)(self)); +} +static inline void extract_mip_rtk_get_status_flags_command_status_flags_legacy(microstrain_serializer* serializer, mip_rtk_get_status_flags_command_status_flags_legacy* self) +{ + uint32_t tmp = 0; + microstrain_extract_u32(serializer, &tmp); + *self = tmp; +} typedef uint32_t mip_rtk_get_status_flags_command_status_flags; static const mip_rtk_get_status_flags_command_status_flags MIP_RTK_GET_STATUS_FLAGS_COMMAND_STATUS_FLAGS_NONE = 0x00000000; @@ -116,178 +146,209 @@ static const mip_rtk_get_status_flags_command_status_flags MIP_RTK_GET_STATUS_FL static const mip_rtk_get_status_flags_command_status_flags MIP_RTK_GET_STATUS_FLAGS_COMMAND_STATUS_FLAGS_RESERVED = 0x20000000; ///< static const mip_rtk_get_status_flags_command_status_flags MIP_RTK_GET_STATUS_FLAGS_COMMAND_STATUS_FLAGS_VERSION = 0xC0000000; ///< static const mip_rtk_get_status_flags_command_status_flags MIP_RTK_GET_STATUS_FLAGS_COMMAND_STATUS_FLAGS_ALL = 0xFFFFFFFF; +static inline void insert_mip_rtk_get_status_flags_command_status_flags(microstrain_serializer* serializer, const mip_rtk_get_status_flags_command_status_flags self) +{ + microstrain_insert_u32(serializer, (uint32_t)(self)); +} +static inline void extract_mip_rtk_get_status_flags_command_status_flags(microstrain_serializer* serializer, mip_rtk_get_status_flags_command_status_flags* self) +{ + uint32_t tmp = 0; + microstrain_extract_u32(serializer, &tmp); + *self = tmp; +} -void insert_mip_rtk_get_status_flags_command_status_flags_legacy(struct mip_serializer* serializer, const mip_rtk_get_status_flags_command_status_flags_legacy self); -void extract_mip_rtk_get_status_flags_command_status_flags_legacy(struct mip_serializer* serializer, mip_rtk_get_status_flags_command_status_flags_legacy* self); -void insert_mip_rtk_get_status_flags_command_status_flags(struct mip_serializer* serializer, const mip_rtk_get_status_flags_command_status_flags self); -void extract_mip_rtk_get_status_flags_command_status_flags(struct mip_serializer* serializer, mip_rtk_get_status_flags_command_status_flags* self); +typedef struct mip_rtk_get_status_flags_command mip_rtk_get_status_flags_command; ///< No parameters (empty struct not allowed in C) struct mip_rtk_get_status_flags_response { mip_rtk_get_status_flags_command_status_flags flags; ///< Model number dependent. See above structures. - }; typedef struct mip_rtk_get_status_flags_response mip_rtk_get_status_flags_response; -void insert_mip_rtk_get_status_flags_response(struct mip_serializer* serializer, const mip_rtk_get_status_flags_response* self); -void extract_mip_rtk_get_status_flags_response(struct mip_serializer* serializer, mip_rtk_get_status_flags_response* self); -mip_cmd_result mip_rtk_get_status_flags(struct mip_interface* device, mip_rtk_get_status_flags_command_status_flags* flags_out); +void insert_mip_rtk_get_status_flags_response(microstrain_serializer* serializer, const mip_rtk_get_status_flags_response* self); +void extract_mip_rtk_get_status_flags_response(microstrain_serializer* serializer, mip_rtk_get_status_flags_response* self); + +mip_cmd_result mip_rtk_get_status_flags(mip_interface* device, mip_rtk_get_status_flags_command_status_flags* flags_out); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_rtk_get_imei (0x0F,0x02) Get Imei [C] +///@defgroup rtk_get_imei_c (0x0F,0x02) Get Imei /// ///@{ +typedef struct mip_rtk_get_imei_command mip_rtk_get_imei_command; ///< No parameters (empty struct not allowed in C) + struct mip_rtk_get_imei_response { char IMEI[32]; - }; typedef struct mip_rtk_get_imei_response mip_rtk_get_imei_response; -void insert_mip_rtk_get_imei_response(struct mip_serializer* serializer, const mip_rtk_get_imei_response* self); -void extract_mip_rtk_get_imei_response(struct mip_serializer* serializer, mip_rtk_get_imei_response* self); -mip_cmd_result mip_rtk_get_imei(struct mip_interface* device, char* imei_out); +void insert_mip_rtk_get_imei_response(microstrain_serializer* serializer, const mip_rtk_get_imei_response* self); +void extract_mip_rtk_get_imei_response(microstrain_serializer* serializer, mip_rtk_get_imei_response* self); + +mip_cmd_result mip_rtk_get_imei(mip_interface* device, char* imei_out); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_rtk_get_imsi (0x0F,0x03) Get Imsi [C] +///@defgroup rtk_get_imsi_c (0x0F,0x03) Get Imsi /// ///@{ +typedef struct mip_rtk_get_imsi_command mip_rtk_get_imsi_command; ///< No parameters (empty struct not allowed in C) + struct mip_rtk_get_imsi_response { char IMSI[32]; - }; typedef struct mip_rtk_get_imsi_response mip_rtk_get_imsi_response; -void insert_mip_rtk_get_imsi_response(struct mip_serializer* serializer, const mip_rtk_get_imsi_response* self); -void extract_mip_rtk_get_imsi_response(struct mip_serializer* serializer, mip_rtk_get_imsi_response* self); -mip_cmd_result mip_rtk_get_imsi(struct mip_interface* device, char* imsi_out); +void insert_mip_rtk_get_imsi_response(microstrain_serializer* serializer, const mip_rtk_get_imsi_response* self); +void extract_mip_rtk_get_imsi_response(microstrain_serializer* serializer, mip_rtk_get_imsi_response* self); + +mip_cmd_result mip_rtk_get_imsi(mip_interface* device, char* imsi_out); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_rtk_get_iccid (0x0F,0x04) Get Iccid [C] +///@defgroup rtk_get_iccid_c (0x0F,0x04) Get Iccid /// ///@{ +typedef struct mip_rtk_get_iccid_command mip_rtk_get_iccid_command; ///< No parameters (empty struct not allowed in C) + struct mip_rtk_get_iccid_response { char ICCID[32]; - }; typedef struct mip_rtk_get_iccid_response mip_rtk_get_iccid_response; -void insert_mip_rtk_get_iccid_response(struct mip_serializer* serializer, const mip_rtk_get_iccid_response* self); -void extract_mip_rtk_get_iccid_response(struct mip_serializer* serializer, mip_rtk_get_iccid_response* self); -mip_cmd_result mip_rtk_get_iccid(struct mip_interface* device, char* iccid_out); +void insert_mip_rtk_get_iccid_response(microstrain_serializer* serializer, const mip_rtk_get_iccid_response* self); +void extract_mip_rtk_get_iccid_response(microstrain_serializer* serializer, mip_rtk_get_iccid_response* self); + +mip_cmd_result mip_rtk_get_iccid(mip_interface* device, char* iccid_out); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_rtk_connected_device_type (0x0F,0x06) Connected Device Type [C] +///@defgroup rtk_connected_device_type_c (0x0F,0x06) Connected Device Type /// ///@{ -typedef uint8_t mip_rtk_connected_device_type_command_type; -static const mip_rtk_connected_device_type_command_type MIP_RTK_CONNECTED_DEVICE_TYPE_COMMAND_TYPE_GENERIC = 0; ///< -static const mip_rtk_connected_device_type_command_type MIP_RTK_CONNECTED_DEVICE_TYPE_COMMAND_TYPE_GQ7 = 1; ///< +enum mip_rtk_connected_device_type_command_type +{ + MIP_RTK_CONNECTED_DEVICE_TYPE_COMMAND_TYPE_GENERIC = 0, ///< + MIP_RTK_CONNECTED_DEVICE_TYPE_COMMAND_TYPE_GQ7 = 1, ///< +}; +typedef enum mip_rtk_connected_device_type_command_type mip_rtk_connected_device_type_command_type; + +static inline void insert_mip_rtk_connected_device_type_command_type(microstrain_serializer* serializer, const mip_rtk_connected_device_type_command_type self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_rtk_connected_device_type_command_type(microstrain_serializer* serializer, mip_rtk_connected_device_type_command_type* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} + struct mip_rtk_connected_device_type_command { mip_function_selector function; mip_rtk_connected_device_type_command_type devType; - }; typedef struct mip_rtk_connected_device_type_command mip_rtk_connected_device_type_command; -void insert_mip_rtk_connected_device_type_command(struct mip_serializer* serializer, const mip_rtk_connected_device_type_command* self); -void extract_mip_rtk_connected_device_type_command(struct mip_serializer* serializer, mip_rtk_connected_device_type_command* self); -void insert_mip_rtk_connected_device_type_command_type(struct mip_serializer* serializer, const mip_rtk_connected_device_type_command_type self); -void extract_mip_rtk_connected_device_type_command_type(struct mip_serializer* serializer, mip_rtk_connected_device_type_command_type* self); +void insert_mip_rtk_connected_device_type_command(microstrain_serializer* serializer, const mip_rtk_connected_device_type_command* self); +void extract_mip_rtk_connected_device_type_command(microstrain_serializer* serializer, mip_rtk_connected_device_type_command* self); struct mip_rtk_connected_device_type_response { mip_rtk_connected_device_type_command_type devType; - }; typedef struct mip_rtk_connected_device_type_response mip_rtk_connected_device_type_response; -void insert_mip_rtk_connected_device_type_response(struct mip_serializer* serializer, const mip_rtk_connected_device_type_response* self); -void extract_mip_rtk_connected_device_type_response(struct mip_serializer* serializer, mip_rtk_connected_device_type_response* self); -mip_cmd_result mip_rtk_write_connected_device_type(struct mip_interface* device, mip_rtk_connected_device_type_command_type dev_type); -mip_cmd_result mip_rtk_read_connected_device_type(struct mip_interface* device, mip_rtk_connected_device_type_command_type* dev_type_out); -mip_cmd_result mip_rtk_save_connected_device_type(struct mip_interface* device); -mip_cmd_result mip_rtk_load_connected_device_type(struct mip_interface* device); -mip_cmd_result mip_rtk_default_connected_device_type(struct mip_interface* device); +void insert_mip_rtk_connected_device_type_response(microstrain_serializer* serializer, const mip_rtk_connected_device_type_response* self); +void extract_mip_rtk_connected_device_type_response(microstrain_serializer* serializer, mip_rtk_connected_device_type_response* self); + +mip_cmd_result mip_rtk_write_connected_device_type(mip_interface* device, mip_rtk_connected_device_type_command_type dev_type); +mip_cmd_result mip_rtk_read_connected_device_type(mip_interface* device, mip_rtk_connected_device_type_command_type* dev_type_out); +mip_cmd_result mip_rtk_save_connected_device_type(mip_interface* device); +mip_cmd_result mip_rtk_load_connected_device_type(mip_interface* device); +mip_cmd_result mip_rtk_default_connected_device_type(mip_interface* device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_rtk_get_act_code (0x0F,0x07) Get Act Code [C] +///@defgroup rtk_get_act_code_c (0x0F,0x07) Get Act Code /// ///@{ +typedef struct mip_rtk_get_act_code_command mip_rtk_get_act_code_command; ///< No parameters (empty struct not allowed in C) + struct mip_rtk_get_act_code_response { char ActivationCode[32]; - }; typedef struct mip_rtk_get_act_code_response mip_rtk_get_act_code_response; -void insert_mip_rtk_get_act_code_response(struct mip_serializer* serializer, const mip_rtk_get_act_code_response* self); -void extract_mip_rtk_get_act_code_response(struct mip_serializer* serializer, mip_rtk_get_act_code_response* self); -mip_cmd_result mip_rtk_get_act_code(struct mip_interface* device, char* activation_code_out); +void insert_mip_rtk_get_act_code_response(microstrain_serializer* serializer, const mip_rtk_get_act_code_response* self); +void extract_mip_rtk_get_act_code_response(microstrain_serializer* serializer, mip_rtk_get_act_code_response* self); + +mip_cmd_result mip_rtk_get_act_code(mip_interface* device, char* activation_code_out); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_rtk_get_modem_firmware_version (0x0F,0x08) Get Modem Firmware Version [C] +///@defgroup rtk_get_modem_firmware_version_c (0x0F,0x08) Get Modem Firmware Version /// ///@{ +typedef struct mip_rtk_get_modem_firmware_version_command mip_rtk_get_modem_firmware_version_command; ///< No parameters (empty struct not allowed in C) + struct mip_rtk_get_modem_firmware_version_response { char ModemFirmwareVersion[32]; - }; typedef struct mip_rtk_get_modem_firmware_version_response mip_rtk_get_modem_firmware_version_response; -void insert_mip_rtk_get_modem_firmware_version_response(struct mip_serializer* serializer, const mip_rtk_get_modem_firmware_version_response* self); -void extract_mip_rtk_get_modem_firmware_version_response(struct mip_serializer* serializer, mip_rtk_get_modem_firmware_version_response* self); -mip_cmd_result mip_rtk_get_modem_firmware_version(struct mip_interface* device, char* modem_firmware_version_out); +void insert_mip_rtk_get_modem_firmware_version_response(microstrain_serializer* serializer, const mip_rtk_get_modem_firmware_version_response* self); +void extract_mip_rtk_get_modem_firmware_version_response(microstrain_serializer* serializer, mip_rtk_get_modem_firmware_version_response* self); + +mip_cmd_result mip_rtk_get_modem_firmware_version(mip_interface* device, char* modem_firmware_version_out); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_rtk_get_rssi (0x0F,0x05) Get Rssi [C] +///@defgroup rtk_get_rssi_c (0x0F,0x05) Get Rssi /// Get the RSSI and connected/disconnected status of modem /// ///@{ +typedef struct mip_rtk_get_rssi_command mip_rtk_get_rssi_command; ///< No parameters (empty struct not allowed in C) + struct mip_rtk_get_rssi_response { bool valid; int32_t rssi; int32_t signalQuality; - }; typedef struct mip_rtk_get_rssi_response mip_rtk_get_rssi_response; -void insert_mip_rtk_get_rssi_response(struct mip_serializer* serializer, const mip_rtk_get_rssi_response* self); -void extract_mip_rtk_get_rssi_response(struct mip_serializer* serializer, mip_rtk_get_rssi_response* self); -mip_cmd_result mip_rtk_get_rssi(struct mip_interface* device, bool* valid_out, int32_t* rssi_out, int32_t* signal_quality_out); +void insert_mip_rtk_get_rssi_response(microstrain_serializer* serializer, const mip_rtk_get_rssi_response* self); +void extract_mip_rtk_get_rssi_response(microstrain_serializer* serializer, mip_rtk_get_rssi_response* self); + +mip_cmd_result mip_rtk_get_rssi(mip_interface* device, bool* valid_out, int32_t* rssi_out, int32_t* signal_quality_out); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_rtk_service_status (0x0F,0x0A) Service Status [C] +///@defgroup rtk_service_status_c (0x0F,0x0A) Service Status /// The 3DMRTK will send this message to the server to indicate that the connection should remain open. The Server will respond with information and status. /// ///@{ @@ -298,19 +359,27 @@ static const mip_rtk_service_status_command_service_flags MIP_RTK_SERVICE_STATUS static const mip_rtk_service_status_command_service_flags MIP_RTK_SERVICE_STATUS_COMMAND_SERVICE_FLAGS_CORRECTIONS_UNAVAILABLE = 0x02; ///< static const mip_rtk_service_status_command_service_flags MIP_RTK_SERVICE_STATUS_COMMAND_SERVICE_FLAGS_RESERVED = 0xFC; ///< static const mip_rtk_service_status_command_service_flags MIP_RTK_SERVICE_STATUS_COMMAND_SERVICE_FLAGS_ALL = 0xFF; +static inline void insert_mip_rtk_service_status_command_service_flags(microstrain_serializer* serializer, const mip_rtk_service_status_command_service_flags self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_rtk_service_status_command_service_flags(microstrain_serializer* serializer, mip_rtk_service_status_command_service_flags* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} + struct mip_rtk_service_status_command { uint32_t reserved1; uint32_t reserved2; - }; typedef struct mip_rtk_service_status_command mip_rtk_service_status_command; -void insert_mip_rtk_service_status_command(struct mip_serializer* serializer, const mip_rtk_service_status_command* self); -void extract_mip_rtk_service_status_command(struct mip_serializer* serializer, mip_rtk_service_status_command* self); -void insert_mip_rtk_service_status_command_service_flags(struct mip_serializer* serializer, const mip_rtk_service_status_command_service_flags self); -void extract_mip_rtk_service_status_command_service_flags(struct mip_serializer* serializer, mip_rtk_service_status_command_service_flags* self); +void insert_mip_rtk_service_status_command(microstrain_serializer* serializer, const mip_rtk_service_status_command* self); +void extract_mip_rtk_service_status_command(microstrain_serializer* serializer, mip_rtk_service_status_command* self); struct mip_rtk_service_status_response { @@ -318,18 +387,18 @@ struct mip_rtk_service_status_response uint32_t receivedBytes; uint32_t lastBytes; uint64_t lastBytesTime; - }; typedef struct mip_rtk_service_status_response mip_rtk_service_status_response; -void insert_mip_rtk_service_status_response(struct mip_serializer* serializer, const mip_rtk_service_status_response* self); -void extract_mip_rtk_service_status_response(struct mip_serializer* serializer, mip_rtk_service_status_response* self); -mip_cmd_result mip_rtk_service_status(struct mip_interface* device, uint32_t reserved1, uint32_t reserved2, mip_rtk_service_status_command_service_flags* flags_out, uint32_t* received_bytes_out, uint32_t* last_bytes_out, uint64_t* last_bytes_time_out); +void insert_mip_rtk_service_status_response(microstrain_serializer* serializer, const mip_rtk_service_status_response* self); +void extract_mip_rtk_service_status_response(microstrain_serializer* serializer, mip_rtk_service_status_response* self); + +mip_cmd_result mip_rtk_service_status(mip_interface* device, uint32_t reserved1, uint32_t reserved2, mip_rtk_service_status_command_service_flags* flags_out, uint32_t* received_bytes_out, uint32_t* last_bytes_out, uint64_t* last_bytes_time_out); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_rtk_prod_erase_storage (0x0F,0x20) Prod Erase Storage [C] +///@defgroup rtk_prod_erase_storage_c (0x0F,0x20) Prod Erase Storage /// This command will erase the selected media to a raw and uninitialized state. ALL DATA WILL BE LOST. /// This command is only available in calibration mode. /// @@ -338,18 +407,18 @@ mip_cmd_result mip_rtk_service_status(struct mip_interface* device, uint32_t res struct mip_rtk_prod_erase_storage_command { mip_media_selector media; - }; typedef struct mip_rtk_prod_erase_storage_command mip_rtk_prod_erase_storage_command; -void insert_mip_rtk_prod_erase_storage_command(struct mip_serializer* serializer, const mip_rtk_prod_erase_storage_command* self); -void extract_mip_rtk_prod_erase_storage_command(struct mip_serializer* serializer, mip_rtk_prod_erase_storage_command* self); -mip_cmd_result mip_rtk_prod_erase_storage(struct mip_interface* device, mip_media_selector media); +void insert_mip_rtk_prod_erase_storage_command(microstrain_serializer* serializer, const mip_rtk_prod_erase_storage_command* self); +void extract_mip_rtk_prod_erase_storage_command(microstrain_serializer* serializer, mip_rtk_prod_erase_storage_command* self); + +mip_cmd_result mip_rtk_prod_erase_storage(mip_interface* device, mip_media_selector media); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_rtk_led_control (0x0F,0x21) Led Control [C] +///@defgroup rtk_led_control_c (0x0F,0x21) Led Control /// This command allows direct control of the LED on the 3DM RTK. This command is only available in calibration mode or Production Test Mode. /// ///@{ @@ -360,24 +429,26 @@ struct mip_rtk_led_control_command uint8_t altColor[3]; mip_led_action act; uint32_t period; - }; typedef struct mip_rtk_led_control_command mip_rtk_led_control_command; -void insert_mip_rtk_led_control_command(struct mip_serializer* serializer, const mip_rtk_led_control_command* self); -void extract_mip_rtk_led_control_command(struct mip_serializer* serializer, mip_rtk_led_control_command* self); -mip_cmd_result mip_rtk_led_control(struct mip_interface* device, const uint8_t* primary_color, const uint8_t* alt_color, mip_led_action act, uint32_t period); +void insert_mip_rtk_led_control_command(microstrain_serializer* serializer, const mip_rtk_led_control_command* self); +void extract_mip_rtk_led_control_command(microstrain_serializer* serializer, mip_rtk_led_control_command* self); + +mip_cmd_result mip_rtk_led_control(mip_interface* device, const uint8_t* primary_color, const uint8_t* alt_color, mip_led_action act, uint32_t period); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_rtk_modem_hard_reset (0x0F,0x22) Modem Hard Reset [C] +///@defgroup rtk_modem_hard_reset_c (0x0F,0x22) Modem Hard Reset /// This command will clear the modem flash. THIS MUST NOT BE DONE OFTEN AS IT CAN DAMAGE THE FLASH! /// This command is only available in calibration mode. /// ///@{ -mip_cmd_result mip_rtk_modem_hard_reset(struct mip_interface* device); +typedef struct mip_rtk_modem_hard_reset_command mip_rtk_modem_hard_reset_command; ///< No parameters (empty struct not allowed in C) + +mip_cmd_result mip_rtk_modem_hard_reset(mip_interface* device); ///@} /// @@ -387,8 +458,8 @@ mip_cmd_result mip_rtk_modem_hard_reset(struct mip_interface* device); /// //////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus +} // extern "C" } // namespace C } // namespace mip -} // extern "C" #endif // __cplusplus diff --git a/src/c/mip/definitions/commands_system.c b/src/c/mip/definitions/commands_system.c new file mode 100644 index 000000000..731014238 --- /dev/null +++ b/src/c/mip/definitions/commands_system.c @@ -0,0 +1,112 @@ + +#include "commands_system.h" + +#include +#include + +#include + + +#ifdef __cplusplus +namespace mip { +namespace C { +extern "C" { + +#endif // __cplusplus + + +//////////////////////////////////////////////////////////////////////////////// +// Mip Fields +//////////////////////////////////////////////////////////////////////////////// + +void insert_mip_system_comm_mode_command(microstrain_serializer* serializer, const mip_system_comm_mode_command* self) +{ + insert_mip_function_selector(serializer, self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_insert_u8(serializer, self->mode); + + } +} +void extract_mip_system_comm_mode_command(microstrain_serializer* serializer, mip_system_comm_mode_command* self) +{ + extract_mip_function_selector(serializer, &self->function); + + if( self->function == MIP_FUNCTION_WRITE ) + { + microstrain_extract_u8(serializer, &self->mode); + + } +} + +void insert_mip_system_comm_mode_response(microstrain_serializer* serializer, const mip_system_comm_mode_response* self) +{ + microstrain_insert_u8(serializer, self->mode); + +} +void extract_mip_system_comm_mode_response(microstrain_serializer* serializer, mip_system_comm_mode_response* self) +{ + microstrain_extract_u8(serializer, &self->mode); + +} + +mip_cmd_result mip_system_write_comm_mode(mip_interface* device, uint8_t mode) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); + + microstrain_insert_u8(&serializer, mode); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_SYSTEM_CMD_DESC_SET, MIP_CMD_DESC_SYSTEM_COM_MODE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} +mip_cmd_result mip_system_read_comm_mode(mip_interface* device, uint8_t* mode_out) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); + + assert(microstrain_serializer_is_ok(&serializer)); + + uint8_t responseLength = sizeof(buffer); + mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_SYSTEM_CMD_DESC_SET, MIP_CMD_DESC_SYSTEM_COM_MODE, buffer, (uint8_t)microstrain_serializer_length(&serializer), MIP_REPLY_DESC_SYSTEM_COM_MODE, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + microstrain_serializer deserializer; + microstrain_serializer_init_insertion(&deserializer, buffer, responseLength); + + assert(mode_out); + microstrain_extract_u8(&deserializer, mode_out); + + if( microstrain_serializer_remaining(&deserializer) != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +mip_cmd_result mip_system_default_comm_mode(mip_interface* device) +{ + microstrain_serializer serializer; + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + microstrain_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); + + insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); + + assert(microstrain_serializer_is_ok(&serializer)); + + return mip_interface_run_command(device, MIP_SYSTEM_CMD_DESC_SET, MIP_CMD_DESC_SYSTEM_COM_MODE, buffer, (uint8_t)microstrain_serializer_length(&serializer)); +} + +#ifdef __cplusplus +} // extern "C" +} // namespace C +} // namespace mip +#endif // __cplusplus + diff --git a/src/mip/definitions/commands_system.h b/src/c/mip/definitions/commands_system.h similarity index 71% rename from src/mip/definitions/commands_system.h rename to src/c/mip/definitions/commands_system.h index ebdd56585..1a44b7c67 100644 --- a/src/mip/definitions/commands_system.h +++ b/src/c/mip/definitions/commands_system.h @@ -1,8 +1,9 @@ #pragma once -#include "common.h" -#include "descriptors.h" -#include "../mip_result.h" +#include +#include +#include +#include #include #include @@ -14,14 +15,11 @@ namespace C { extern "C" { #endif // __cplusplus -struct mip_interface; -struct mip_serializer; -struct mip_field; //////////////////////////////////////////////////////////////////////////////// -///@addtogroup MipCommands_c MIP Commands [C] +///@addtogroup MipCommands_c ///@{ -///@defgroup system_commands_c System Commands [C] +///@defgroup system_commands_c System Commands /// ///@{ @@ -57,7 +55,7 @@ enum { MIP_SYSTEM_COMMAND_COMM_MODE_GPS = 0x03 }; //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_system_comm_mode (0x7F,0x10) Comm Mode [C] +///@defgroup system_comm_mode_c (0x7F,0x10) Comm Mode /// Advanced specialized communication modes. /// /// This command allows the user to communicate directly with various subsystems which may be present in MIP devices (i.e. IMU, GNSS, etc.) @@ -74,24 +72,24 @@ struct mip_system_comm_mode_command { mip_function_selector function; uint8_t mode; - }; typedef struct mip_system_comm_mode_command mip_system_comm_mode_command; -void insert_mip_system_comm_mode_command(struct mip_serializer* serializer, const mip_system_comm_mode_command* self); -void extract_mip_system_comm_mode_command(struct mip_serializer* serializer, mip_system_comm_mode_command* self); + +void insert_mip_system_comm_mode_command(microstrain_serializer* serializer, const mip_system_comm_mode_command* self); +void extract_mip_system_comm_mode_command(microstrain_serializer* serializer, mip_system_comm_mode_command* self); struct mip_system_comm_mode_response { uint8_t mode; - }; typedef struct mip_system_comm_mode_response mip_system_comm_mode_response; -void insert_mip_system_comm_mode_response(struct mip_serializer* serializer, const mip_system_comm_mode_response* self); -void extract_mip_system_comm_mode_response(struct mip_serializer* serializer, mip_system_comm_mode_response* self); -mip_cmd_result mip_system_write_comm_mode(struct mip_interface* device, uint8_t mode); -mip_cmd_result mip_system_read_comm_mode(struct mip_interface* device, uint8_t* mode_out); -mip_cmd_result mip_system_default_comm_mode(struct mip_interface* device); +void insert_mip_system_comm_mode_response(microstrain_serializer* serializer, const mip_system_comm_mode_response* self); +void extract_mip_system_comm_mode_response(microstrain_serializer* serializer, mip_system_comm_mode_response* self); + +mip_cmd_result mip_system_write_comm_mode(mip_interface* device, uint8_t mode); +mip_cmd_result mip_system_read_comm_mode(mip_interface* device, uint8_t* mode_out); +mip_cmd_result mip_system_default_comm_mode(mip_interface* device); ///@} /// @@ -101,8 +99,8 @@ mip_cmd_result mip_system_default_comm_mode(struct mip_interface* device); /// //////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus +} // extern "C" } // namespace C } // namespace mip -} // extern "C" #endif // __cplusplus diff --git a/src/c/mip/definitions/common.c b/src/c/mip/definitions/common.c new file mode 100644 index 000000000..80c752de2 --- /dev/null +++ b/src/c/mip/definitions/common.c @@ -0,0 +1,39 @@ + +#include "common.h" + +#include "microstrain/common/serialization.h" + + +void insert_mip_descriptor_rate(microstrain_serializer* serializer, const mip_descriptor_rate* self) +{ + microstrain_insert_u8(serializer, self->descriptor); + microstrain_insert_u16(serializer, self->decimation); +} + +void extract_mip_descriptor_rate(microstrain_serializer* serializer, mip_descriptor_rate* self) +{ + microstrain_extract_u8(serializer, &self->descriptor); + microstrain_extract_u16(serializer, &self->decimation); +} + +#define IMPLEMENT_MIP_VECTOR_FUNCTIONS(n,type,name) \ +void insert_##name(microstrain_serializer* serializer, const name self) \ +{ \ + for(unsigned int i=0; i +#include "../mip_field.h" + +#include +#include +#include + +#ifdef __cplusplus +#include +#include +#include + +namespace mip { +namespace C { +extern "C" { +using microstrain::C::microstrain_serializer; +#endif // __cplusplus + +typedef struct mip_descriptor_rate +{ + uint8_t descriptor; + uint16_t decimation; +} mip_descriptor_rate; + +void insert_mip_descriptor_rate(microstrain_serializer *serializer, const mip_descriptor_rate *self); +void extract_mip_descriptor_rate(microstrain_serializer *serializer, mip_descriptor_rate *self); + +#define DECLARE_MIP_VECTOR_TYPE(n, type, name) \ +typedef type name[n]; \ +\ +void insert_##name(microstrain_serializer* serializer, const name self); \ +void extract_##name(microstrain_serializer* serializer, name self); + +DECLARE_MIP_VECTOR_TYPE(3, float, mip_vector3f) +DECLARE_MIP_VECTOR_TYPE(4, float, mip_vector4f) +DECLARE_MIP_VECTOR_TYPE(9, float, mip_matrix3f) +DECLARE_MIP_VECTOR_TYPE(3, double, mip_vector3d) +DECLARE_MIP_VECTOR_TYPE(4, double, mip_vector4d) +DECLARE_MIP_VECTOR_TYPE(9, double, mip_matrix3d) +DECLARE_MIP_VECTOR_TYPE(4, float, mip_quatf) + +#undef DECLARE_MIP_VECTOR_TYPE + +#ifdef __cplusplus +} // extern "C" +} // namespace C +} // namespace mip +#endif // __cplusplus diff --git a/src/c/mip/definitions/data_filter.c b/src/c/mip/definitions/data_filter.c new file mode 100644 index 000000000..cd2d37b8c --- /dev/null +++ b/src/c/mip/definitions/data_filter.c @@ -0,0 +1,1570 @@ + +#include "data_filter.h" + +#include +#include + +#include + + +#ifdef __cplusplus +namespace mip { +namespace C { +extern "C" { + +#endif // __cplusplus + + +//////////////////////////////////////////////////////////////////////////////// +// Mip Fields +//////////////////////////////////////////////////////////////////////////////// + +void insert_mip_filter_position_llh_data(microstrain_serializer* serializer, const mip_filter_position_llh_data* self) +{ + microstrain_insert_double(serializer, self->latitude); + + microstrain_insert_double(serializer, self->longitude); + + microstrain_insert_double(serializer, self->ellipsoid_height); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_position_llh_data(microstrain_serializer* serializer, mip_filter_position_llh_data* self) +{ + microstrain_extract_double(serializer, &self->latitude); + + microstrain_extract_double(serializer, &self->longitude); + + microstrain_extract_double(serializer, &self->ellipsoid_height); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_position_llh_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_position_llh_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_position_llh_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_velocity_ned_data(microstrain_serializer* serializer, const mip_filter_velocity_ned_data* self) +{ + microstrain_insert_float(serializer, self->north); + + microstrain_insert_float(serializer, self->east); + + microstrain_insert_float(serializer, self->down); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_velocity_ned_data(microstrain_serializer* serializer, mip_filter_velocity_ned_data* self) +{ + microstrain_extract_float(serializer, &self->north); + + microstrain_extract_float(serializer, &self->east); + + microstrain_extract_float(serializer, &self->down); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_velocity_ned_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_velocity_ned_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_velocity_ned_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_attitude_quaternion_data(microstrain_serializer* serializer, const mip_filter_attitude_quaternion_data* self) +{ + insert_mip_quatf(serializer, self->q); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_attitude_quaternion_data(microstrain_serializer* serializer, mip_filter_attitude_quaternion_data* self) +{ + extract_mip_quatf(serializer, self->q); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_attitude_quaternion_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_attitude_quaternion_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_attitude_quaternion_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_attitude_dcm_data(microstrain_serializer* serializer, const mip_filter_attitude_dcm_data* self) +{ + insert_mip_matrix3f(serializer, self->dcm); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_attitude_dcm_data(microstrain_serializer* serializer, mip_filter_attitude_dcm_data* self) +{ + extract_mip_matrix3f(serializer, self->dcm); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_attitude_dcm_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_attitude_dcm_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_attitude_dcm_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_euler_angles_data(microstrain_serializer* serializer, const mip_filter_euler_angles_data* self) +{ + microstrain_insert_float(serializer, self->roll); + + microstrain_insert_float(serializer, self->pitch); + + microstrain_insert_float(serializer, self->yaw); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_euler_angles_data(microstrain_serializer* serializer, mip_filter_euler_angles_data* self) +{ + microstrain_extract_float(serializer, &self->roll); + + microstrain_extract_float(serializer, &self->pitch); + + microstrain_extract_float(serializer, &self->yaw); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_euler_angles_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_euler_angles_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_euler_angles_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_gyro_bias_data(microstrain_serializer* serializer, const mip_filter_gyro_bias_data* self) +{ + insert_mip_vector3f(serializer, self->bias); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_gyro_bias_data(microstrain_serializer* serializer, mip_filter_gyro_bias_data* self) +{ + extract_mip_vector3f(serializer, self->bias); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_gyro_bias_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_gyro_bias_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_gyro_bias_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_accel_bias_data(microstrain_serializer* serializer, const mip_filter_accel_bias_data* self) +{ + insert_mip_vector3f(serializer, self->bias); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_accel_bias_data(microstrain_serializer* serializer, mip_filter_accel_bias_data* self) +{ + extract_mip_vector3f(serializer, self->bias); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_accel_bias_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_accel_bias_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_accel_bias_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_position_llh_uncertainty_data(microstrain_serializer* serializer, const mip_filter_position_llh_uncertainty_data* self) +{ + microstrain_insert_float(serializer, self->north); + + microstrain_insert_float(serializer, self->east); + + microstrain_insert_float(serializer, self->down); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_position_llh_uncertainty_data(microstrain_serializer* serializer, mip_filter_position_llh_uncertainty_data* self) +{ + microstrain_extract_float(serializer, &self->north); + + microstrain_extract_float(serializer, &self->east); + + microstrain_extract_float(serializer, &self->down); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_position_llh_uncertainty_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_position_llh_uncertainty_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_position_llh_uncertainty_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_velocity_ned_uncertainty_data(microstrain_serializer* serializer, const mip_filter_velocity_ned_uncertainty_data* self) +{ + microstrain_insert_float(serializer, self->north); + + microstrain_insert_float(serializer, self->east); + + microstrain_insert_float(serializer, self->down); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_velocity_ned_uncertainty_data(microstrain_serializer* serializer, mip_filter_velocity_ned_uncertainty_data* self) +{ + microstrain_extract_float(serializer, &self->north); + + microstrain_extract_float(serializer, &self->east); + + microstrain_extract_float(serializer, &self->down); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_velocity_ned_uncertainty_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_velocity_ned_uncertainty_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_velocity_ned_uncertainty_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_euler_angles_uncertainty_data(microstrain_serializer* serializer, const mip_filter_euler_angles_uncertainty_data* self) +{ + microstrain_insert_float(serializer, self->roll); + + microstrain_insert_float(serializer, self->pitch); + + microstrain_insert_float(serializer, self->yaw); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_euler_angles_uncertainty_data(microstrain_serializer* serializer, mip_filter_euler_angles_uncertainty_data* self) +{ + microstrain_extract_float(serializer, &self->roll); + + microstrain_extract_float(serializer, &self->pitch); + + microstrain_extract_float(serializer, &self->yaw); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_euler_angles_uncertainty_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_euler_angles_uncertainty_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_euler_angles_uncertainty_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_gyro_bias_uncertainty_data(microstrain_serializer* serializer, const mip_filter_gyro_bias_uncertainty_data* self) +{ + insert_mip_vector3f(serializer, self->bias_uncert); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_gyro_bias_uncertainty_data(microstrain_serializer* serializer, mip_filter_gyro_bias_uncertainty_data* self) +{ + extract_mip_vector3f(serializer, self->bias_uncert); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_gyro_bias_uncertainty_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_gyro_bias_uncertainty_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_gyro_bias_uncertainty_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_accel_bias_uncertainty_data(microstrain_serializer* serializer, const mip_filter_accel_bias_uncertainty_data* self) +{ + insert_mip_vector3f(serializer, self->bias_uncert); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_accel_bias_uncertainty_data(microstrain_serializer* serializer, mip_filter_accel_bias_uncertainty_data* self) +{ + extract_mip_vector3f(serializer, self->bias_uncert); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_accel_bias_uncertainty_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_accel_bias_uncertainty_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_accel_bias_uncertainty_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_timestamp_data(microstrain_serializer* serializer, const mip_filter_timestamp_data* self) +{ + microstrain_insert_double(serializer, self->tow); + + microstrain_insert_u16(serializer, self->week_number); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_timestamp_data(microstrain_serializer* serializer, mip_filter_timestamp_data* self) +{ + microstrain_extract_double(serializer, &self->tow); + + microstrain_extract_u16(serializer, &self->week_number); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_timestamp_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_timestamp_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_timestamp_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_status_data(microstrain_serializer* serializer, const mip_filter_status_data* self) +{ + insert_mip_filter_mode(serializer, self->filter_state); + + insert_mip_filter_dynamics_mode(serializer, self->dynamics_mode); + + insert_mip_filter_status_flags(serializer, self->status_flags); + +} +void extract_mip_filter_status_data(microstrain_serializer* serializer, mip_filter_status_data* self) +{ + extract_mip_filter_mode(serializer, &self->filter_state); + + extract_mip_filter_dynamics_mode(serializer, &self->dynamics_mode); + + extract_mip_filter_status_flags(serializer, &self->status_flags); + +} +bool extract_mip_filter_status_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_status_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_status_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_linear_accel_data(microstrain_serializer* serializer, const mip_filter_linear_accel_data* self) +{ + insert_mip_vector3f(serializer, self->accel); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_linear_accel_data(microstrain_serializer* serializer, mip_filter_linear_accel_data* self) +{ + extract_mip_vector3f(serializer, self->accel); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_linear_accel_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_linear_accel_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_linear_accel_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_gravity_vector_data(microstrain_serializer* serializer, const mip_filter_gravity_vector_data* self) +{ + insert_mip_vector3f(serializer, self->gravity); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_gravity_vector_data(microstrain_serializer* serializer, mip_filter_gravity_vector_data* self) +{ + extract_mip_vector3f(serializer, self->gravity); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_gravity_vector_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_gravity_vector_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_gravity_vector_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_comp_accel_data(microstrain_serializer* serializer, const mip_filter_comp_accel_data* self) +{ + insert_mip_vector3f(serializer, self->accel); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_comp_accel_data(microstrain_serializer* serializer, mip_filter_comp_accel_data* self) +{ + extract_mip_vector3f(serializer, self->accel); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_comp_accel_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_comp_accel_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_comp_accel_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_comp_angular_rate_data(microstrain_serializer* serializer, const mip_filter_comp_angular_rate_data* self) +{ + insert_mip_vector3f(serializer, self->gyro); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_comp_angular_rate_data(microstrain_serializer* serializer, mip_filter_comp_angular_rate_data* self) +{ + extract_mip_vector3f(serializer, self->gyro); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_comp_angular_rate_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_comp_angular_rate_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_comp_angular_rate_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_quaternion_attitude_uncertainty_data(microstrain_serializer* serializer, const mip_filter_quaternion_attitude_uncertainty_data* self) +{ + insert_mip_quatf(serializer, self->q); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_quaternion_attitude_uncertainty_data(microstrain_serializer* serializer, mip_filter_quaternion_attitude_uncertainty_data* self) +{ + extract_mip_quatf(serializer, self->q); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_quaternion_attitude_uncertainty_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_quaternion_attitude_uncertainty_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_quaternion_attitude_uncertainty_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_wgs84_gravity_mag_data(microstrain_serializer* serializer, const mip_filter_wgs84_gravity_mag_data* self) +{ + microstrain_insert_float(serializer, self->magnitude); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_wgs84_gravity_mag_data(microstrain_serializer* serializer, mip_filter_wgs84_gravity_mag_data* self) +{ + microstrain_extract_float(serializer, &self->magnitude); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_wgs84_gravity_mag_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_wgs84_gravity_mag_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_wgs84_gravity_mag_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_heading_update_state_data(microstrain_serializer* serializer, const mip_filter_heading_update_state_data* self) +{ + microstrain_insert_float(serializer, self->heading); + + microstrain_insert_float(serializer, self->heading_1sigma); + + insert_mip_filter_heading_update_state_data_heading_source(serializer, self->source); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_heading_update_state_data(microstrain_serializer* serializer, mip_filter_heading_update_state_data* self) +{ + microstrain_extract_float(serializer, &self->heading); + + microstrain_extract_float(serializer, &self->heading_1sigma); + + extract_mip_filter_heading_update_state_data_heading_source(serializer, &self->source); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_heading_update_state_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_heading_update_state_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_heading_update_state_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_magnetic_model_data(microstrain_serializer* serializer, const mip_filter_magnetic_model_data* self) +{ + microstrain_insert_float(serializer, self->intensity_north); + + microstrain_insert_float(serializer, self->intensity_east); + + microstrain_insert_float(serializer, self->intensity_down); + + microstrain_insert_float(serializer, self->inclination); + + microstrain_insert_float(serializer, self->declination); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_magnetic_model_data(microstrain_serializer* serializer, mip_filter_magnetic_model_data* self) +{ + microstrain_extract_float(serializer, &self->intensity_north); + + microstrain_extract_float(serializer, &self->intensity_east); + + microstrain_extract_float(serializer, &self->intensity_down); + + microstrain_extract_float(serializer, &self->inclination); + + microstrain_extract_float(serializer, &self->declination); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_magnetic_model_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_magnetic_model_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_magnetic_model_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_accel_scale_factor_data(microstrain_serializer* serializer, const mip_filter_accel_scale_factor_data* self) +{ + insert_mip_vector3f(serializer, self->scale_factor); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_accel_scale_factor_data(microstrain_serializer* serializer, mip_filter_accel_scale_factor_data* self) +{ + extract_mip_vector3f(serializer, self->scale_factor); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_accel_scale_factor_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_accel_scale_factor_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_accel_scale_factor_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_accel_scale_factor_uncertainty_data(microstrain_serializer* serializer, const mip_filter_accel_scale_factor_uncertainty_data* self) +{ + insert_mip_vector3f(serializer, self->scale_factor_uncert); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_accel_scale_factor_uncertainty_data(microstrain_serializer* serializer, mip_filter_accel_scale_factor_uncertainty_data* self) +{ + extract_mip_vector3f(serializer, self->scale_factor_uncert); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_accel_scale_factor_uncertainty_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_accel_scale_factor_uncertainty_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_accel_scale_factor_uncertainty_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_gyro_scale_factor_data(microstrain_serializer* serializer, const mip_filter_gyro_scale_factor_data* self) +{ + insert_mip_vector3f(serializer, self->scale_factor); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_gyro_scale_factor_data(microstrain_serializer* serializer, mip_filter_gyro_scale_factor_data* self) +{ + extract_mip_vector3f(serializer, self->scale_factor); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_gyro_scale_factor_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_gyro_scale_factor_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_gyro_scale_factor_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_gyro_scale_factor_uncertainty_data(microstrain_serializer* serializer, const mip_filter_gyro_scale_factor_uncertainty_data* self) +{ + insert_mip_vector3f(serializer, self->scale_factor_uncert); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_gyro_scale_factor_uncertainty_data(microstrain_serializer* serializer, mip_filter_gyro_scale_factor_uncertainty_data* self) +{ + extract_mip_vector3f(serializer, self->scale_factor_uncert); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_gyro_scale_factor_uncertainty_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_gyro_scale_factor_uncertainty_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_gyro_scale_factor_uncertainty_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_mag_bias_data(microstrain_serializer* serializer, const mip_filter_mag_bias_data* self) +{ + insert_mip_vector3f(serializer, self->bias); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_mag_bias_data(microstrain_serializer* serializer, mip_filter_mag_bias_data* self) +{ + extract_mip_vector3f(serializer, self->bias); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_mag_bias_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_mag_bias_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_mag_bias_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_mag_bias_uncertainty_data(microstrain_serializer* serializer, const mip_filter_mag_bias_uncertainty_data* self) +{ + insert_mip_vector3f(serializer, self->bias_uncert); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_mag_bias_uncertainty_data(microstrain_serializer* serializer, mip_filter_mag_bias_uncertainty_data* self) +{ + extract_mip_vector3f(serializer, self->bias_uncert); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_mag_bias_uncertainty_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_mag_bias_uncertainty_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_mag_bias_uncertainty_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_standard_atmosphere_data(microstrain_serializer* serializer, const mip_filter_standard_atmosphere_data* self) +{ + microstrain_insert_float(serializer, self->geometric_altitude); + + microstrain_insert_float(serializer, self->geopotential_altitude); + + microstrain_insert_float(serializer, self->standard_temperature); + + microstrain_insert_float(serializer, self->standard_pressure); + + microstrain_insert_float(serializer, self->standard_density); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_standard_atmosphere_data(microstrain_serializer* serializer, mip_filter_standard_atmosphere_data* self) +{ + microstrain_extract_float(serializer, &self->geometric_altitude); + + microstrain_extract_float(serializer, &self->geopotential_altitude); + + microstrain_extract_float(serializer, &self->standard_temperature); + + microstrain_extract_float(serializer, &self->standard_pressure); + + microstrain_extract_float(serializer, &self->standard_density); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_standard_atmosphere_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_standard_atmosphere_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_standard_atmosphere_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_pressure_altitude_data(microstrain_serializer* serializer, const mip_filter_pressure_altitude_data* self) +{ + microstrain_insert_float(serializer, self->pressure_altitude); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_pressure_altitude_data(microstrain_serializer* serializer, mip_filter_pressure_altitude_data* self) +{ + microstrain_extract_float(serializer, &self->pressure_altitude); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_pressure_altitude_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_pressure_altitude_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_pressure_altitude_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_density_altitude_data(microstrain_serializer* serializer, const mip_filter_density_altitude_data* self) +{ + microstrain_insert_float(serializer, self->density_altitude); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_density_altitude_data(microstrain_serializer* serializer, mip_filter_density_altitude_data* self) +{ + microstrain_extract_float(serializer, &self->density_altitude); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_density_altitude_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_density_altitude_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_density_altitude_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_antenna_offset_correction_data(microstrain_serializer* serializer, const mip_filter_antenna_offset_correction_data* self) +{ + insert_mip_vector3f(serializer, self->offset); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_antenna_offset_correction_data(microstrain_serializer* serializer, mip_filter_antenna_offset_correction_data* self) +{ + extract_mip_vector3f(serializer, self->offset); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_antenna_offset_correction_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_antenna_offset_correction_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_antenna_offset_correction_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_antenna_offset_correction_uncertainty_data(microstrain_serializer* serializer, const mip_filter_antenna_offset_correction_uncertainty_data* self) +{ + insert_mip_vector3f(serializer, self->offset_uncert); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_antenna_offset_correction_uncertainty_data(microstrain_serializer* serializer, mip_filter_antenna_offset_correction_uncertainty_data* self) +{ + extract_mip_vector3f(serializer, self->offset_uncert); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_antenna_offset_correction_uncertainty_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_antenna_offset_correction_uncertainty_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_antenna_offset_correction_uncertainty_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_multi_antenna_offset_correction_data(microstrain_serializer* serializer, const mip_filter_multi_antenna_offset_correction_data* self) +{ + microstrain_insert_u8(serializer, self->receiver_id); + + insert_mip_vector3f(serializer, self->offset); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_multi_antenna_offset_correction_data(microstrain_serializer* serializer, mip_filter_multi_antenna_offset_correction_data* self) +{ + microstrain_extract_u8(serializer, &self->receiver_id); + + extract_mip_vector3f(serializer, self->offset); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_multi_antenna_offset_correction_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_multi_antenna_offset_correction_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_multi_antenna_offset_correction_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_multi_antenna_offset_correction_uncertainty_data(microstrain_serializer* serializer, const mip_filter_multi_antenna_offset_correction_uncertainty_data* self) +{ + microstrain_insert_u8(serializer, self->receiver_id); + + insert_mip_vector3f(serializer, self->offset_uncert); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_multi_antenna_offset_correction_uncertainty_data(microstrain_serializer* serializer, mip_filter_multi_antenna_offset_correction_uncertainty_data* self) +{ + microstrain_extract_u8(serializer, &self->receiver_id); + + extract_mip_vector3f(serializer, self->offset_uncert); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_multi_antenna_offset_correction_uncertainty_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_multi_antenna_offset_correction_uncertainty_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_multi_antenna_offset_correction_uncertainty_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_magnetometer_offset_data(microstrain_serializer* serializer, const mip_filter_magnetometer_offset_data* self) +{ + insert_mip_vector3f(serializer, self->hard_iron); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_magnetometer_offset_data(microstrain_serializer* serializer, mip_filter_magnetometer_offset_data* self) +{ + extract_mip_vector3f(serializer, self->hard_iron); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_magnetometer_offset_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_magnetometer_offset_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_magnetometer_offset_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_magnetometer_matrix_data(microstrain_serializer* serializer, const mip_filter_magnetometer_matrix_data* self) +{ + insert_mip_matrix3f(serializer, self->soft_iron); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_magnetometer_matrix_data(microstrain_serializer* serializer, mip_filter_magnetometer_matrix_data* self) +{ + extract_mip_matrix3f(serializer, self->soft_iron); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_magnetometer_matrix_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_magnetometer_matrix_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_magnetometer_matrix_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_magnetometer_offset_uncertainty_data(microstrain_serializer* serializer, const mip_filter_magnetometer_offset_uncertainty_data* self) +{ + insert_mip_vector3f(serializer, self->hard_iron_uncertainty); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_magnetometer_offset_uncertainty_data(microstrain_serializer* serializer, mip_filter_magnetometer_offset_uncertainty_data* self) +{ + extract_mip_vector3f(serializer, self->hard_iron_uncertainty); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_magnetometer_offset_uncertainty_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_magnetometer_offset_uncertainty_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_magnetometer_offset_uncertainty_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_magnetometer_matrix_uncertainty_data(microstrain_serializer* serializer, const mip_filter_magnetometer_matrix_uncertainty_data* self) +{ + insert_mip_matrix3f(serializer, self->soft_iron_uncertainty); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_magnetometer_matrix_uncertainty_data(microstrain_serializer* serializer, mip_filter_magnetometer_matrix_uncertainty_data* self) +{ + extract_mip_matrix3f(serializer, self->soft_iron_uncertainty); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_magnetometer_matrix_uncertainty_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_magnetometer_matrix_uncertainty_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_magnetometer_matrix_uncertainty_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_magnetometer_covariance_matrix_data(microstrain_serializer* serializer, const mip_filter_magnetometer_covariance_matrix_data* self) +{ + insert_mip_matrix3f(serializer, self->covariance); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_magnetometer_covariance_matrix_data(microstrain_serializer* serializer, mip_filter_magnetometer_covariance_matrix_data* self) +{ + extract_mip_matrix3f(serializer, self->covariance); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_magnetometer_covariance_matrix_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_magnetometer_covariance_matrix_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_magnetometer_covariance_matrix_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_magnetometer_residual_vector_data(microstrain_serializer* serializer, const mip_filter_magnetometer_residual_vector_data* self) +{ + insert_mip_vector3f(serializer, self->residual); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_magnetometer_residual_vector_data(microstrain_serializer* serializer, mip_filter_magnetometer_residual_vector_data* self) +{ + extract_mip_vector3f(serializer, self->residual); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_magnetometer_residual_vector_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_magnetometer_residual_vector_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_magnetometer_residual_vector_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_clock_correction_data(microstrain_serializer* serializer, const mip_filter_clock_correction_data* self) +{ + microstrain_insert_u8(serializer, self->receiver_id); + + microstrain_insert_float(serializer, self->bias); + + microstrain_insert_float(serializer, self->bias_drift); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_clock_correction_data(microstrain_serializer* serializer, mip_filter_clock_correction_data* self) +{ + microstrain_extract_u8(serializer, &self->receiver_id); + + microstrain_extract_float(serializer, &self->bias); + + microstrain_extract_float(serializer, &self->bias_drift); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_clock_correction_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_clock_correction_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_clock_correction_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_clock_correction_uncertainty_data(microstrain_serializer* serializer, const mip_filter_clock_correction_uncertainty_data* self) +{ + microstrain_insert_u8(serializer, self->receiver_id); + + microstrain_insert_float(serializer, self->bias_uncertainty); + + microstrain_insert_float(serializer, self->bias_drift_uncertainty); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_clock_correction_uncertainty_data(microstrain_serializer* serializer, mip_filter_clock_correction_uncertainty_data* self) +{ + microstrain_extract_u8(serializer, &self->receiver_id); + + microstrain_extract_float(serializer, &self->bias_uncertainty); + + microstrain_extract_float(serializer, &self->bias_drift_uncertainty); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_clock_correction_uncertainty_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_clock_correction_uncertainty_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_clock_correction_uncertainty_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_gnss_pos_aid_status_data(microstrain_serializer* serializer, const mip_filter_gnss_pos_aid_status_data* self) +{ + microstrain_insert_u8(serializer, self->receiver_id); + + microstrain_insert_float(serializer, self->time_of_week); + + insert_mip_gnss_aid_status_flags(serializer, self->status); + + for(unsigned int i=0; i < 8; i++) + microstrain_insert_u8(serializer, self->reserved[i]); + +} +void extract_mip_filter_gnss_pos_aid_status_data(microstrain_serializer* serializer, mip_filter_gnss_pos_aid_status_data* self) +{ + microstrain_extract_u8(serializer, &self->receiver_id); + + microstrain_extract_float(serializer, &self->time_of_week); + + extract_mip_gnss_aid_status_flags(serializer, &self->status); + + for(unsigned int i=0; i < 8; i++) + microstrain_extract_u8(serializer, &self->reserved[i]); + +} +bool extract_mip_filter_gnss_pos_aid_status_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_gnss_pos_aid_status_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_gnss_pos_aid_status_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_gnss_att_aid_status_data(microstrain_serializer* serializer, const mip_filter_gnss_att_aid_status_data* self) +{ + microstrain_insert_float(serializer, self->time_of_week); + + insert_mip_gnss_aid_status_flags(serializer, self->status); + + for(unsigned int i=0; i < 8; i++) + microstrain_insert_u8(serializer, self->reserved[i]); + +} +void extract_mip_filter_gnss_att_aid_status_data(microstrain_serializer* serializer, mip_filter_gnss_att_aid_status_data* self) +{ + microstrain_extract_float(serializer, &self->time_of_week); + + extract_mip_gnss_aid_status_flags(serializer, &self->status); + + for(unsigned int i=0; i < 8; i++) + microstrain_extract_u8(serializer, &self->reserved[i]); + +} +bool extract_mip_filter_gnss_att_aid_status_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_gnss_att_aid_status_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_gnss_att_aid_status_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_head_aid_status_data(microstrain_serializer* serializer, const mip_filter_head_aid_status_data* self) +{ + microstrain_insert_float(serializer, self->time_of_week); + + insert_mip_filter_head_aid_status_data_heading_aid_type(serializer, self->type); + + for(unsigned int i=0; i < 2; i++) + microstrain_insert_float(serializer, self->reserved[i]); + +} +void extract_mip_filter_head_aid_status_data(microstrain_serializer* serializer, mip_filter_head_aid_status_data* self) +{ + microstrain_extract_float(serializer, &self->time_of_week); + + extract_mip_filter_head_aid_status_data_heading_aid_type(serializer, &self->type); + + for(unsigned int i=0; i < 2; i++) + microstrain_extract_float(serializer, &self->reserved[i]); + +} +bool extract_mip_filter_head_aid_status_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_head_aid_status_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_head_aid_status_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_rel_pos_ned_data(microstrain_serializer* serializer, const mip_filter_rel_pos_ned_data* self) +{ + insert_mip_vector3d(serializer, self->relative_position); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_rel_pos_ned_data(microstrain_serializer* serializer, mip_filter_rel_pos_ned_data* self) +{ + extract_mip_vector3d(serializer, self->relative_position); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_rel_pos_ned_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_rel_pos_ned_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_rel_pos_ned_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_ecef_pos_data(microstrain_serializer* serializer, const mip_filter_ecef_pos_data* self) +{ + insert_mip_vector3d(serializer, self->position_ecef); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_ecef_pos_data(microstrain_serializer* serializer, mip_filter_ecef_pos_data* self) +{ + extract_mip_vector3d(serializer, self->position_ecef); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_ecef_pos_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_ecef_pos_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_ecef_pos_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_ecef_vel_data(microstrain_serializer* serializer, const mip_filter_ecef_vel_data* self) +{ + insert_mip_vector3f(serializer, self->velocity_ecef); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_ecef_vel_data(microstrain_serializer* serializer, mip_filter_ecef_vel_data* self) +{ + extract_mip_vector3f(serializer, self->velocity_ecef); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_ecef_vel_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_ecef_vel_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_ecef_vel_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_ecef_pos_uncertainty_data(microstrain_serializer* serializer, const mip_filter_ecef_pos_uncertainty_data* self) +{ + insert_mip_vector3f(serializer, self->pos_uncertainty); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_ecef_pos_uncertainty_data(microstrain_serializer* serializer, mip_filter_ecef_pos_uncertainty_data* self) +{ + extract_mip_vector3f(serializer, self->pos_uncertainty); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_ecef_pos_uncertainty_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_ecef_pos_uncertainty_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_ecef_pos_uncertainty_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_ecef_vel_uncertainty_data(microstrain_serializer* serializer, const mip_filter_ecef_vel_uncertainty_data* self) +{ + insert_mip_vector3f(serializer, self->vel_uncertainty); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_ecef_vel_uncertainty_data(microstrain_serializer* serializer, mip_filter_ecef_vel_uncertainty_data* self) +{ + extract_mip_vector3f(serializer, self->vel_uncertainty); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_ecef_vel_uncertainty_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_ecef_vel_uncertainty_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_ecef_vel_uncertainty_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_aiding_measurement_summary_data(microstrain_serializer* serializer, const mip_filter_aiding_measurement_summary_data* self) +{ + microstrain_insert_float(serializer, self->time_of_week); + + microstrain_insert_u8(serializer, self->source); + + insert_mip_filter_aiding_measurement_type(serializer, self->type); + + insert_mip_filter_measurement_indicator(serializer, self->indicator); + +} +void extract_mip_filter_aiding_measurement_summary_data(microstrain_serializer* serializer, mip_filter_aiding_measurement_summary_data* self) +{ + microstrain_extract_float(serializer, &self->time_of_week); + + microstrain_extract_u8(serializer, &self->source); + + extract_mip_filter_aiding_measurement_type(serializer, &self->type); + + extract_mip_filter_measurement_indicator(serializer, &self->indicator); + +} +bool extract_mip_filter_aiding_measurement_summary_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_aiding_measurement_summary_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_aiding_measurement_summary_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_odometer_scale_factor_error_data(microstrain_serializer* serializer, const mip_filter_odometer_scale_factor_error_data* self) +{ + microstrain_insert_float(serializer, self->scale_factor_error); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_odometer_scale_factor_error_data(microstrain_serializer* serializer, mip_filter_odometer_scale_factor_error_data* self) +{ + microstrain_extract_float(serializer, &self->scale_factor_error); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_odometer_scale_factor_error_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_odometer_scale_factor_error_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_odometer_scale_factor_error_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_odometer_scale_factor_error_uncertainty_data(microstrain_serializer* serializer, const mip_filter_odometer_scale_factor_error_uncertainty_data* self) +{ + microstrain_insert_float(serializer, self->scale_factor_error_uncertainty); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_odometer_scale_factor_error_uncertainty_data(microstrain_serializer* serializer, mip_filter_odometer_scale_factor_error_uncertainty_data* self) +{ + microstrain_extract_float(serializer, &self->scale_factor_error_uncertainty); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_odometer_scale_factor_error_uncertainty_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_odometer_scale_factor_error_uncertainty_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_odometer_scale_factor_error_uncertainty_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_gnss_dual_antenna_status_data(microstrain_serializer* serializer, const mip_filter_gnss_dual_antenna_status_data* self) +{ + microstrain_insert_float(serializer, self->time_of_week); + + microstrain_insert_float(serializer, self->heading); + + microstrain_insert_float(serializer, self->heading_unc); + + insert_mip_filter_gnss_dual_antenna_status_data_fix_type(serializer, self->fix_type); + + insert_mip_filter_gnss_dual_antenna_status_data_dual_antenna_status_flags(serializer, self->status_flags); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_filter_gnss_dual_antenna_status_data(microstrain_serializer* serializer, mip_filter_gnss_dual_antenna_status_data* self) +{ + microstrain_extract_float(serializer, &self->time_of_week); + + microstrain_extract_float(serializer, &self->heading); + + microstrain_extract_float(serializer, &self->heading_unc); + + extract_mip_filter_gnss_dual_antenna_status_data_fix_type(serializer, &self->fix_type); + + extract_mip_filter_gnss_dual_antenna_status_data_dual_antenna_status_flags(serializer, &self->status_flags); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_filter_gnss_dual_antenna_status_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_gnss_dual_antenna_status_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_gnss_dual_antenna_status_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_aiding_frame_config_error_data(microstrain_serializer* serializer, const mip_filter_aiding_frame_config_error_data* self) +{ + microstrain_insert_u8(serializer, self->frame_id); + + insert_mip_vector3f(serializer, self->translation); + + insert_mip_quatf(serializer, self->attitude); + +} +void extract_mip_filter_aiding_frame_config_error_data(microstrain_serializer* serializer, mip_filter_aiding_frame_config_error_data* self) +{ + microstrain_extract_u8(serializer, &self->frame_id); + + extract_mip_vector3f(serializer, self->translation); + + extract_mip_quatf(serializer, self->attitude); + +} +bool extract_mip_filter_aiding_frame_config_error_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_aiding_frame_config_error_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_aiding_frame_config_error_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_filter_aiding_frame_config_error_uncertainty_data(microstrain_serializer* serializer, const mip_filter_aiding_frame_config_error_uncertainty_data* self) +{ + microstrain_insert_u8(serializer, self->frame_id); + + insert_mip_vector3f(serializer, self->translation_unc); + + insert_mip_vector3f(serializer, self->attitude_unc); + +} +void extract_mip_filter_aiding_frame_config_error_uncertainty_data(microstrain_serializer* serializer, mip_filter_aiding_frame_config_error_uncertainty_data* self) +{ + microstrain_extract_u8(serializer, &self->frame_id); + + extract_mip_vector3f(serializer, self->translation_unc); + + extract_mip_vector3f(serializer, self->attitude_unc); + +} +bool extract_mip_filter_aiding_frame_config_error_uncertainty_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_filter_aiding_frame_config_error_uncertainty_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_filter_aiding_frame_config_error_uncertainty_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + + +#ifdef __cplusplus +} // extern "C" +} // namespace C +} // namespace mip +#endif // __cplusplus + diff --git a/src/mip/definitions/data_filter.h b/src/c/mip/definitions/data_filter.h similarity index 60% rename from src/mip/definitions/data_filter.h rename to src/c/mip/definitions/data_filter.h index 316db62c9..f88b95b96 100644 --- a/src/mip/definitions/data_filter.h +++ b/src/c/mip/definitions/data_filter.h @@ -1,8 +1,9 @@ #pragma once -#include "common.h" -#include "descriptors.h" -#include "../mip_result.h" +#include +#include +#include +#include #include #include @@ -14,14 +15,11 @@ namespace C { extern "C" { #endif // __cplusplus -struct mip_interface; -struct mip_serializer; -struct mip_field; //////////////////////////////////////////////////////////////////////////////// -///@addtogroup MipData_c MIP Data [C] +///@addtogroup MipData_c ///@{ -///@defgroup filter_data_c Filter Data [C] +///@defgroup filter_data_c Filter Data /// ///@{ @@ -102,27 +100,49 @@ enum // Shared Type Definitions //////////////////////////////////////////////////////////////////////////////// -typedef uint16_t mip_filter_mode; -static const mip_filter_mode MIP_FILTER_MODE_GX5_STARTUP = 0; ///< -static const mip_filter_mode MIP_FILTER_MODE_GX5_INIT = 1; ///< -static const mip_filter_mode MIP_FILTER_MODE_GX5_RUN_SOLUTION_VALID = 2; ///< -static const mip_filter_mode MIP_FILTER_MODE_GX5_RUN_SOLUTION_ERROR = 3; ///< -static const mip_filter_mode MIP_FILTER_MODE_INIT = 1; ///< -static const mip_filter_mode MIP_FILTER_MODE_VERT_GYRO = 2; ///< -static const mip_filter_mode MIP_FILTER_MODE_AHRS = 3; ///< -static const mip_filter_mode MIP_FILTER_MODE_FULL_NAV = 4; ///< +enum mip_filter_mode +{ + MIP_FILTER_MODE_GX5_STARTUP = 0, ///< + MIP_FILTER_MODE_GX5_INIT = 1, ///< + MIP_FILTER_MODE_GX5_RUN_SOLUTION_VALID = 2, ///< + MIP_FILTER_MODE_GX5_RUN_SOLUTION_ERROR = 3, ///< + MIP_FILTER_MODE_INIT = 1, ///< + MIP_FILTER_MODE_VERT_GYRO = 2, ///< + MIP_FILTER_MODE_AHRS = 3, ///< + MIP_FILTER_MODE_FULL_NAV = 4, ///< +}; +typedef enum mip_filter_mode mip_filter_mode; -void insert_mip_filter_mode(struct mip_serializer* serializer, const mip_filter_mode self); -void extract_mip_filter_mode(struct mip_serializer* serializer, mip_filter_mode* self); +static inline void insert_mip_filter_mode(microstrain_serializer* serializer, const mip_filter_mode self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_filter_mode(microstrain_serializer* serializer, mip_filter_mode* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} -typedef uint16_t mip_filter_dynamics_mode; -static const mip_filter_dynamics_mode MIP_FILTER_DYNAMICS_MODE_GX5_PORTABLE = 1; ///< -static const mip_filter_dynamics_mode MIP_FILTER_DYNAMICS_MODE_GX5_AUTOMOTIVE = 2; ///< -static const mip_filter_dynamics_mode MIP_FILTER_DYNAMICS_MODE_GX5_AIRBORNE = 3; ///< -static const mip_filter_dynamics_mode MIP_FILTER_DYNAMICS_MODE_GQ7_DEFAULT = 1; ///< +enum mip_filter_dynamics_mode +{ + MIP_FILTER_DYNAMICS_MODE_GX5_PORTABLE = 1, ///< + MIP_FILTER_DYNAMICS_MODE_GX5_AUTOMOTIVE = 2, ///< + MIP_FILTER_DYNAMICS_MODE_GX5_AIRBORNE = 3, ///< + MIP_FILTER_DYNAMICS_MODE_GQ7_DEFAULT = 1, ///< +}; +typedef enum mip_filter_dynamics_mode mip_filter_dynamics_mode; -void insert_mip_filter_dynamics_mode(struct mip_serializer* serializer, const mip_filter_dynamics_mode self); -void extract_mip_filter_dynamics_mode(struct mip_serializer* serializer, mip_filter_dynamics_mode* self); +static inline void insert_mip_filter_dynamics_mode(microstrain_serializer* serializer, const mip_filter_dynamics_mode self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_filter_dynamics_mode(microstrain_serializer* serializer, mip_filter_dynamics_mode* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} typedef uint16_t mip_filter_status_flags; static const mip_filter_status_flags MIP_FILTER_STATUS_FLAGS_NONE = 0x0000; @@ -155,29 +175,47 @@ static const mip_filter_status_flags MIP_FILTER_STATUS_FLAGS_GQ7_MOUNTING_TRANSF static const mip_filter_status_flags MIP_FILTER_STATUS_FLAGS_GQ7_TIME_SYNC_WARNING = 0x0400; ///< No time synchronization pulse detected static const mip_filter_status_flags MIP_FILTER_STATUS_FLAGS_GQ7_SOLUTION_ERROR = 0xF000; ///< Filter computation warning flags. If any bits 12-15 are set, and all filter outputs will be invalid. static const mip_filter_status_flags MIP_FILTER_STATUS_FLAGS_ALL = 0xFFFF; +static inline void insert_mip_filter_status_flags(microstrain_serializer* serializer, const mip_filter_status_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_filter_status_flags(microstrain_serializer* serializer, mip_filter_status_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} -void insert_mip_filter_status_flags(struct mip_serializer* serializer, const mip_filter_status_flags self); -void extract_mip_filter_status_flags(struct mip_serializer* serializer, mip_filter_status_flags* self); - -typedef uint8_t mip_filter_aiding_measurement_type; -static const mip_filter_aiding_measurement_type MIP_FILTER_AIDING_MEASUREMENT_TYPE_GNSS = 1; ///< -static const mip_filter_aiding_measurement_type MIP_FILTER_AIDING_MEASUREMENT_TYPE_DUAL_ANTENNA = 2; ///< -static const mip_filter_aiding_measurement_type MIP_FILTER_AIDING_MEASUREMENT_TYPE_HEADING = 3; ///< -static const mip_filter_aiding_measurement_type MIP_FILTER_AIDING_MEASUREMENT_TYPE_PRESSURE = 4; ///< -static const mip_filter_aiding_measurement_type MIP_FILTER_AIDING_MEASUREMENT_TYPE_MAGNETOMETER = 5; ///< -static const mip_filter_aiding_measurement_type MIP_FILTER_AIDING_MEASUREMENT_TYPE_SPEED = 6; ///< -static const mip_filter_aiding_measurement_type MIP_FILTER_AIDING_MEASUREMENT_TYPE_AIDING_POS_ECEF = 33; ///< -static const mip_filter_aiding_measurement_type MIP_FILTER_AIDING_MEASUREMENT_TYPE_AIDING_POS_LLH = 34; ///< -static const mip_filter_aiding_measurement_type MIP_FILTER_AIDING_MEASUREMENT_TYPE_AIDING_HEIGHT_ABOVE_ELLIPSOID = 35; ///< -static const mip_filter_aiding_measurement_type MIP_FILTER_AIDING_MEASUREMENT_TYPE_AIDING_VEL_ECEF = 40; ///< -static const mip_filter_aiding_measurement_type MIP_FILTER_AIDING_MEASUREMENT_TYPE_AIDING_VEL_NED = 41; ///< -static const mip_filter_aiding_measurement_type MIP_FILTER_AIDING_MEASUREMENT_TYPE_AIDING_VEL_BODY_FRAME = 42; ///< -static const mip_filter_aiding_measurement_type MIP_FILTER_AIDING_MEASUREMENT_TYPE_AIDING_HEADING_TRUE = 49; ///< -static const mip_filter_aiding_measurement_type MIP_FILTER_AIDING_MEASUREMENT_TYPE_AIDING_MAGNETIC_FIELD = 50; ///< -static const mip_filter_aiding_measurement_type MIP_FILTER_AIDING_MEASUREMENT_TYPE_AIDING_PRESSURE = 51; ///< - -void insert_mip_filter_aiding_measurement_type(struct mip_serializer* serializer, const mip_filter_aiding_measurement_type self); -void extract_mip_filter_aiding_measurement_type(struct mip_serializer* serializer, mip_filter_aiding_measurement_type* self); +enum mip_filter_aiding_measurement_type +{ + MIP_FILTER_AIDING_MEASUREMENT_TYPE_GNSS = 1, ///< + MIP_FILTER_AIDING_MEASUREMENT_TYPE_DUAL_ANTENNA = 2, ///< + MIP_FILTER_AIDING_MEASUREMENT_TYPE_HEADING = 3, ///< + MIP_FILTER_AIDING_MEASUREMENT_TYPE_PRESSURE = 4, ///< + MIP_FILTER_AIDING_MEASUREMENT_TYPE_MAGNETOMETER = 5, ///< + MIP_FILTER_AIDING_MEASUREMENT_TYPE_SPEED = 6, ///< + MIP_FILTER_AIDING_MEASUREMENT_TYPE_AIDING_POS_ECEF = 33, ///< + MIP_FILTER_AIDING_MEASUREMENT_TYPE_AIDING_POS_LLH = 34, ///< + MIP_FILTER_AIDING_MEASUREMENT_TYPE_AIDING_HEIGHT_ABOVE_ELLIPSOID = 35, ///< + MIP_FILTER_AIDING_MEASUREMENT_TYPE_AIDING_VEL_ECEF = 40, ///< + MIP_FILTER_AIDING_MEASUREMENT_TYPE_AIDING_VEL_NED = 41, ///< + MIP_FILTER_AIDING_MEASUREMENT_TYPE_AIDING_VEL_BODY_FRAME = 42, ///< + MIP_FILTER_AIDING_MEASUREMENT_TYPE_AIDING_HEADING_TRUE = 49, ///< + MIP_FILTER_AIDING_MEASUREMENT_TYPE_AIDING_MAGNETIC_FIELD = 50, ///< + MIP_FILTER_AIDING_MEASUREMENT_TYPE_AIDING_PRESSURE = 51, ///< +}; +typedef enum mip_filter_aiding_measurement_type mip_filter_aiding_measurement_type; + +static inline void insert_mip_filter_aiding_measurement_type(microstrain_serializer* serializer, const mip_filter_aiding_measurement_type self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_filter_aiding_measurement_type(microstrain_serializer* serializer, mip_filter_aiding_measurement_type* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} typedef uint8_t mip_filter_measurement_indicator; static const mip_filter_measurement_indicator MIP_FILTER_MEASUREMENT_INDICATOR_NONE = 0x00; @@ -188,9 +226,16 @@ static const mip_filter_measurement_indicator MIP_FILTER_MEASUREMENT_INDICATOR_S static const mip_filter_measurement_indicator MIP_FILTER_MEASUREMENT_INDICATOR_CONFIGURATION_ERROR = 0x10; ///< static const mip_filter_measurement_indicator MIP_FILTER_MEASUREMENT_INDICATOR_MAX_NUM_MEAS_EXCEEDED = 0x20; ///< static const mip_filter_measurement_indicator MIP_FILTER_MEASUREMENT_INDICATOR_ALL = 0x3F; - -void insert_mip_filter_measurement_indicator(struct mip_serializer* serializer, const mip_filter_measurement_indicator self); -void extract_mip_filter_measurement_indicator(struct mip_serializer* serializer, mip_filter_measurement_indicator* self); +static inline void insert_mip_filter_measurement_indicator(microstrain_serializer* serializer, const mip_filter_measurement_indicator self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_filter_measurement_indicator(microstrain_serializer* serializer, mip_filter_measurement_indicator* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} typedef uint16_t mip_gnss_aid_status_flags; static const mip_gnss_aid_status_flags MIP_GNSS_AID_STATUS_FLAGS_NONE = 0x0000; @@ -211,9 +256,16 @@ static const mip_gnss_aid_status_flags MIP_GNSS_AID_STATUS_FLAGS_BEI_B3 static const mip_gnss_aid_status_flags MIP_GNSS_AID_STATUS_FLAGS_NO_FIX = 0x4000; ///< If 1, this GNSS module is reporting no position fix static const mip_gnss_aid_status_flags MIP_GNSS_AID_STATUS_FLAGS_CONFIG_ERROR = 0x8000; ///< If 1, there is likely an issue with the antenna offset for this GNSS module static const mip_gnss_aid_status_flags MIP_GNSS_AID_STATUS_FLAGS_ALL = 0xFFFF; - -void insert_mip_gnss_aid_status_flags(struct mip_serializer* serializer, const mip_gnss_aid_status_flags self); -void extract_mip_gnss_aid_status_flags(struct mip_serializer* serializer, mip_gnss_aid_status_flags* self); +static inline void insert_mip_gnss_aid_status_flags(microstrain_serializer* serializer, const mip_gnss_aid_status_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_gnss_aid_status_flags(microstrain_serializer* serializer, mip_gnss_aid_status_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} //////////////////////////////////////////////////////////////////////////////// @@ -221,7 +273,7 @@ void extract_mip_gnss_aid_status_flags(struct mip_serializer* serializer, mip_gn //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_position_llh (0x82,0x01) Position Llh [C] +///@defgroup filter_position_llh_c (0x82,0x01) Position Llh /// Filter reported position in the WGS84 geodetic frame. /// ///@{ @@ -232,18 +284,18 @@ struct mip_filter_position_llh_data double longitude; ///< [degrees] double ellipsoid_height; ///< [meters] uint16_t valid_flags; ///< 0 - Invalid, 1 - valid - }; typedef struct mip_filter_position_llh_data mip_filter_position_llh_data; -void insert_mip_filter_position_llh_data(struct mip_serializer* serializer, const mip_filter_position_llh_data* self); -void extract_mip_filter_position_llh_data(struct mip_serializer* serializer, mip_filter_position_llh_data* self); -bool extract_mip_filter_position_llh_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_position_llh_data(microstrain_serializer* serializer, const mip_filter_position_llh_data* self); +void extract_mip_filter_position_llh_data(microstrain_serializer* serializer, mip_filter_position_llh_data* self); +bool extract_mip_filter_position_llh_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_velocity_ned (0x82,0x02) Velocity Ned [C] +///@defgroup filter_velocity_ned_c (0x82,0x02) Velocity Ned /// Filter reported velocity in the NED local-level frame. /// ///@{ @@ -254,18 +306,18 @@ struct mip_filter_velocity_ned_data float east; ///< [meters/second] float down; ///< [meters/second] uint16_t valid_flags; ///< 0 - Invalid, 1 - valid - }; typedef struct mip_filter_velocity_ned_data mip_filter_velocity_ned_data; -void insert_mip_filter_velocity_ned_data(struct mip_serializer* serializer, const mip_filter_velocity_ned_data* self); -void extract_mip_filter_velocity_ned_data(struct mip_serializer* serializer, mip_filter_velocity_ned_data* self); -bool extract_mip_filter_velocity_ned_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_velocity_ned_data(microstrain_serializer* serializer, const mip_filter_velocity_ned_data* self); +void extract_mip_filter_velocity_ned_data(microstrain_serializer* serializer, mip_filter_velocity_ned_data* self); +bool extract_mip_filter_velocity_ned_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_attitude_quaternion (0x82,0x03) Attitude Quaternion [C] +///@defgroup filter_attitude_quaternion_c (0x82,0x03) Attitude Quaternion /// 4x1 vector representation of the quaternion describing the orientation of the device with respect to the NED local-level frame. /// This quaternion satisfies the following relationship: /// @@ -282,18 +334,18 @@ struct mip_filter_attitude_quaternion_data { mip_quatf q; ///< Quaternion elements EQSTART q = (q_w, q_x, q_y, q_z) EQEND uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_attitude_quaternion_data mip_filter_attitude_quaternion_data; -void insert_mip_filter_attitude_quaternion_data(struct mip_serializer* serializer, const mip_filter_attitude_quaternion_data* self); -void extract_mip_filter_attitude_quaternion_data(struct mip_serializer* serializer, mip_filter_attitude_quaternion_data* self); -bool extract_mip_filter_attitude_quaternion_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_attitude_quaternion_data(microstrain_serializer* serializer, const mip_filter_attitude_quaternion_data* self); +void extract_mip_filter_attitude_quaternion_data(microstrain_serializer* serializer, mip_filter_attitude_quaternion_data* self); +bool extract_mip_filter_attitude_quaternion_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_attitude_dcm (0x82,0x04) Attitude Dcm [C] +///@defgroup filter_attitude_dcm_c (0x82,0x04) Attitude Dcm /// 3x3 Direction Cosine Matrix EQSTART M_{ned}^{veh} EQEND describing the orientation of the device with respect to the NED local-level frame. /// This matrix satisfies the following relationship: /// @@ -304,7 +356,7 @@ bool extract_mip_filter_attitude_quaternion_data_from_field(const struct mip_fie /// EQSTART v^{ned} EQEND is a 3-element vector expressed in the NED frame.
/// EQSTART v^{veh} EQEND is the same 3-element vector expressed in the vehicle frame.
///
-/// The matrix elements are stored is row-major order: EQSTART M_{ned}^{veh} = \begin{bmatrix} M_{11}, M_{12}, M_{13}, M_{21}, M_{22}, M_{23}, M_{31}, M_{32}, M_{33} \end{bmatrix} EQEND +/// The matrix elements are stored is row-major order: EQSTART M_{ned}^{veh} = \\begin{bmatrix} M_{11}, M_{12}, M_{13}, M_{21}, M_{22}, M_{23}, M_{31}, M_{32}, M_{33} \\end{bmatrix} EQEND /// ///@{ @@ -312,18 +364,18 @@ struct mip_filter_attitude_dcm_data { mip_matrix3f dcm; ///< Matrix elements in row-major order. uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_attitude_dcm_data mip_filter_attitude_dcm_data; -void insert_mip_filter_attitude_dcm_data(struct mip_serializer* serializer, const mip_filter_attitude_dcm_data* self); -void extract_mip_filter_attitude_dcm_data(struct mip_serializer* serializer, mip_filter_attitude_dcm_data* self); -bool extract_mip_filter_attitude_dcm_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_attitude_dcm_data(microstrain_serializer* serializer, const mip_filter_attitude_dcm_data* self); +void extract_mip_filter_attitude_dcm_data(microstrain_serializer* serializer, mip_filter_attitude_dcm_data* self); +bool extract_mip_filter_attitude_dcm_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_euler_angles (0x82,0x05) Euler Angles [C] +///@defgroup filter_euler_angles_c (0x82,0x05) Euler Angles /// Filter reported Euler angles describing the orientation of the device with respect to the NED local-level frame. /// The Euler angles are reported in 3-2-1 (Yaw-Pitch-Roll, AKA Aircraft) order. /// @@ -335,18 +387,18 @@ struct mip_filter_euler_angles_data float pitch; ///< [radians] float yaw; ///< [radians] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_euler_angles_data mip_filter_euler_angles_data; -void insert_mip_filter_euler_angles_data(struct mip_serializer* serializer, const mip_filter_euler_angles_data* self); -void extract_mip_filter_euler_angles_data(struct mip_serializer* serializer, mip_filter_euler_angles_data* self); -bool extract_mip_filter_euler_angles_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_euler_angles_data(microstrain_serializer* serializer, const mip_filter_euler_angles_data* self); +void extract_mip_filter_euler_angles_data(microstrain_serializer* serializer, mip_filter_euler_angles_data* self); +bool extract_mip_filter_euler_angles_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_gyro_bias (0x82,0x06) Gyro Bias [C] +///@defgroup filter_gyro_bias_c (0x82,0x06) Gyro Bias /// Filter reported gyro bias expressed in the sensor frame. /// ///@{ @@ -355,18 +407,18 @@ struct mip_filter_gyro_bias_data { mip_vector3f bias; ///< (x, y, z) [radians/second] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_gyro_bias_data mip_filter_gyro_bias_data; -void insert_mip_filter_gyro_bias_data(struct mip_serializer* serializer, const mip_filter_gyro_bias_data* self); -void extract_mip_filter_gyro_bias_data(struct mip_serializer* serializer, mip_filter_gyro_bias_data* self); -bool extract_mip_filter_gyro_bias_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_gyro_bias_data(microstrain_serializer* serializer, const mip_filter_gyro_bias_data* self); +void extract_mip_filter_gyro_bias_data(microstrain_serializer* serializer, mip_filter_gyro_bias_data* self); +bool extract_mip_filter_gyro_bias_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_accel_bias (0x82,0x07) Accel Bias [C] +///@defgroup filter_accel_bias_c (0x82,0x07) Accel Bias /// Filter reported accelerometer bias expressed in the sensor frame. /// ///@{ @@ -375,18 +427,18 @@ struct mip_filter_accel_bias_data { mip_vector3f bias; ///< (x, y, z) [meters/second^2] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_accel_bias_data mip_filter_accel_bias_data; -void insert_mip_filter_accel_bias_data(struct mip_serializer* serializer, const mip_filter_accel_bias_data* self); -void extract_mip_filter_accel_bias_data(struct mip_serializer* serializer, mip_filter_accel_bias_data* self); -bool extract_mip_filter_accel_bias_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_accel_bias_data(microstrain_serializer* serializer, const mip_filter_accel_bias_data* self); +void extract_mip_filter_accel_bias_data(microstrain_serializer* serializer, mip_filter_accel_bias_data* self); +bool extract_mip_filter_accel_bias_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_position_llh_uncertainty (0x82,0x08) Position Llh Uncertainty [C] +///@defgroup filter_position_llh_uncertainty_c (0x82,0x08) Position Llh Uncertainty /// Filter reported 1-sigma position uncertainty in the NED local-level frame. /// ///@{ @@ -397,18 +449,18 @@ struct mip_filter_position_llh_uncertainty_data float east; ///< [meters] float down; ///< [meters] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_position_llh_uncertainty_data mip_filter_position_llh_uncertainty_data; -void insert_mip_filter_position_llh_uncertainty_data(struct mip_serializer* serializer, const mip_filter_position_llh_uncertainty_data* self); -void extract_mip_filter_position_llh_uncertainty_data(struct mip_serializer* serializer, mip_filter_position_llh_uncertainty_data* self); -bool extract_mip_filter_position_llh_uncertainty_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_position_llh_uncertainty_data(microstrain_serializer* serializer, const mip_filter_position_llh_uncertainty_data* self); +void extract_mip_filter_position_llh_uncertainty_data(microstrain_serializer* serializer, mip_filter_position_llh_uncertainty_data* self); +bool extract_mip_filter_position_llh_uncertainty_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_velocity_ned_uncertainty (0x82,0x09) Velocity Ned Uncertainty [C] +///@defgroup filter_velocity_ned_uncertainty_c (0x82,0x09) Velocity Ned Uncertainty /// Filter reported 1-sigma velocity uncertainties in the NED local-level frame. /// ///@{ @@ -419,18 +471,18 @@ struct mip_filter_velocity_ned_uncertainty_data float east; ///< [meters/second] float down; ///< [meters/second] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_velocity_ned_uncertainty_data mip_filter_velocity_ned_uncertainty_data; -void insert_mip_filter_velocity_ned_uncertainty_data(struct mip_serializer* serializer, const mip_filter_velocity_ned_uncertainty_data* self); -void extract_mip_filter_velocity_ned_uncertainty_data(struct mip_serializer* serializer, mip_filter_velocity_ned_uncertainty_data* self); -bool extract_mip_filter_velocity_ned_uncertainty_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_velocity_ned_uncertainty_data(microstrain_serializer* serializer, const mip_filter_velocity_ned_uncertainty_data* self); +void extract_mip_filter_velocity_ned_uncertainty_data(microstrain_serializer* serializer, mip_filter_velocity_ned_uncertainty_data* self); +bool extract_mip_filter_velocity_ned_uncertainty_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_euler_angles_uncertainty (0x82,0x0A) Euler Angles Uncertainty [C] +///@defgroup filter_euler_angles_uncertainty_c (0x82,0x0A) Euler Angles Uncertainty /// Filter reported 1-sigma Euler angle uncertainties. /// The uncertainties are reported in 3-2-1 (Yaw-Pitch-Roll, AKA Aircraft) order. /// @@ -442,18 +494,18 @@ struct mip_filter_euler_angles_uncertainty_data float pitch; ///< [radians] float yaw; ///< [radians] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_euler_angles_uncertainty_data mip_filter_euler_angles_uncertainty_data; -void insert_mip_filter_euler_angles_uncertainty_data(struct mip_serializer* serializer, const mip_filter_euler_angles_uncertainty_data* self); -void extract_mip_filter_euler_angles_uncertainty_data(struct mip_serializer* serializer, mip_filter_euler_angles_uncertainty_data* self); -bool extract_mip_filter_euler_angles_uncertainty_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_euler_angles_uncertainty_data(microstrain_serializer* serializer, const mip_filter_euler_angles_uncertainty_data* self); +void extract_mip_filter_euler_angles_uncertainty_data(microstrain_serializer* serializer, mip_filter_euler_angles_uncertainty_data* self); +bool extract_mip_filter_euler_angles_uncertainty_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_gyro_bias_uncertainty (0x82,0x0B) Gyro Bias Uncertainty [C] +///@defgroup filter_gyro_bias_uncertainty_c (0x82,0x0B) Gyro Bias Uncertainty /// Filter reported 1-sigma gyro bias uncertainties expressed in the sensor frame. /// ///@{ @@ -462,18 +514,18 @@ struct mip_filter_gyro_bias_uncertainty_data { mip_vector3f bias_uncert; ///< (x,y,z) [radians/sec] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_gyro_bias_uncertainty_data mip_filter_gyro_bias_uncertainty_data; -void insert_mip_filter_gyro_bias_uncertainty_data(struct mip_serializer* serializer, const mip_filter_gyro_bias_uncertainty_data* self); -void extract_mip_filter_gyro_bias_uncertainty_data(struct mip_serializer* serializer, mip_filter_gyro_bias_uncertainty_data* self); -bool extract_mip_filter_gyro_bias_uncertainty_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_gyro_bias_uncertainty_data(microstrain_serializer* serializer, const mip_filter_gyro_bias_uncertainty_data* self); +void extract_mip_filter_gyro_bias_uncertainty_data(microstrain_serializer* serializer, mip_filter_gyro_bias_uncertainty_data* self); +bool extract_mip_filter_gyro_bias_uncertainty_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_accel_bias_uncertainty (0x82,0x0C) Accel Bias Uncertainty [C] +///@defgroup filter_accel_bias_uncertainty_c (0x82,0x0C) Accel Bias Uncertainty /// Filter reported 1-sigma accelerometer bias uncertainties expressed in the sensor frame. /// ///@{ @@ -482,18 +534,18 @@ struct mip_filter_accel_bias_uncertainty_data { mip_vector3f bias_uncert; ///< (x,y,z) [meters/second^2] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_accel_bias_uncertainty_data mip_filter_accel_bias_uncertainty_data; -void insert_mip_filter_accel_bias_uncertainty_data(struct mip_serializer* serializer, const mip_filter_accel_bias_uncertainty_data* self); -void extract_mip_filter_accel_bias_uncertainty_data(struct mip_serializer* serializer, mip_filter_accel_bias_uncertainty_data* self); -bool extract_mip_filter_accel_bias_uncertainty_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_accel_bias_uncertainty_data(microstrain_serializer* serializer, const mip_filter_accel_bias_uncertainty_data* self); +void extract_mip_filter_accel_bias_uncertainty_data(microstrain_serializer* serializer, mip_filter_accel_bias_uncertainty_data* self); +bool extract_mip_filter_accel_bias_uncertainty_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_timestamp (0x82,0x11) Timestamp [C] +///@defgroup filter_timestamp_c (0x82,0x11) Timestamp /// GPS timestamp of the Filter data /// /// Should the PPS become unavailable, the device will revert to its internal clock, which will cause the reported time to drift from true GPS time. @@ -509,18 +561,18 @@ struct mip_filter_timestamp_data double tow; ///< GPS Time of Week [seconds] uint16_t week_number; ///< GPS Week Number since 1980 [weeks] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_timestamp_data mip_filter_timestamp_data; -void insert_mip_filter_timestamp_data(struct mip_serializer* serializer, const mip_filter_timestamp_data* self); -void extract_mip_filter_timestamp_data(struct mip_serializer* serializer, mip_filter_timestamp_data* self); -bool extract_mip_filter_timestamp_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_timestamp_data(microstrain_serializer* serializer, const mip_filter_timestamp_data* self); +void extract_mip_filter_timestamp_data(microstrain_serializer* serializer, mip_filter_timestamp_data* self); +bool extract_mip_filter_timestamp_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_status (0x82,0x10) Status [C] +///@defgroup filter_status_c (0x82,0x10) Status /// Device-specific filter status indicators. /// ///@{ @@ -530,18 +582,18 @@ struct mip_filter_status_data mip_filter_mode filter_state; ///< Device-specific filter state. Please consult the user manual for definition. mip_filter_dynamics_mode dynamics_mode; ///< Device-specific dynamics mode. Please consult the user manual for definition. mip_filter_status_flags status_flags; ///< Device-specific status flags. Please consult the user manual for definition. - }; typedef struct mip_filter_status_data mip_filter_status_data; -void insert_mip_filter_status_data(struct mip_serializer* serializer, const mip_filter_status_data* self); -void extract_mip_filter_status_data(struct mip_serializer* serializer, mip_filter_status_data* self); -bool extract_mip_filter_status_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_status_data(microstrain_serializer* serializer, const mip_filter_status_data* self); +void extract_mip_filter_status_data(microstrain_serializer* serializer, mip_filter_status_data* self); +bool extract_mip_filter_status_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_linear_accel (0x82,0x0D) Linear Accel [C] +///@defgroup filter_linear_accel_c (0x82,0x0D) Linear Accel /// Filter-compensated linear acceleration expressed in the vehicle frame. /// Note: The estimated gravity has been removed from this data leaving only linear acceleration. /// @@ -551,18 +603,18 @@ struct mip_filter_linear_accel_data { mip_vector3f accel; ///< (x,y,z) [meters/second^2] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_linear_accel_data mip_filter_linear_accel_data; -void insert_mip_filter_linear_accel_data(struct mip_serializer* serializer, const mip_filter_linear_accel_data* self); -void extract_mip_filter_linear_accel_data(struct mip_serializer* serializer, mip_filter_linear_accel_data* self); -bool extract_mip_filter_linear_accel_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_linear_accel_data(microstrain_serializer* serializer, const mip_filter_linear_accel_data* self); +void extract_mip_filter_linear_accel_data(microstrain_serializer* serializer, mip_filter_linear_accel_data* self); +bool extract_mip_filter_linear_accel_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_gravity_vector (0x82,0x13) Gravity Vector [C] +///@defgroup filter_gravity_vector_c (0x82,0x13) Gravity Vector /// Filter reported gravity vector expressed in the vehicle frame. /// ///@{ @@ -571,18 +623,18 @@ struct mip_filter_gravity_vector_data { mip_vector3f gravity; ///< (x, y, z) [meters/second^2] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_gravity_vector_data mip_filter_gravity_vector_data; -void insert_mip_filter_gravity_vector_data(struct mip_serializer* serializer, const mip_filter_gravity_vector_data* self); -void extract_mip_filter_gravity_vector_data(struct mip_serializer* serializer, mip_filter_gravity_vector_data* self); -bool extract_mip_filter_gravity_vector_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_gravity_vector_data(microstrain_serializer* serializer, const mip_filter_gravity_vector_data* self); +void extract_mip_filter_gravity_vector_data(microstrain_serializer* serializer, mip_filter_gravity_vector_data* self); +bool extract_mip_filter_gravity_vector_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_comp_accel (0x82,0x1C) Comp Accel [C] +///@defgroup filter_comp_accel_c (0x82,0x1C) Comp Accel /// Filter-compensated acceleration expressed in the vehicle frame. /// ///@{ @@ -591,18 +643,18 @@ struct mip_filter_comp_accel_data { mip_vector3f accel; ///< (x,y,z) [meters/second^2] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_comp_accel_data mip_filter_comp_accel_data; -void insert_mip_filter_comp_accel_data(struct mip_serializer* serializer, const mip_filter_comp_accel_data* self); -void extract_mip_filter_comp_accel_data(struct mip_serializer* serializer, mip_filter_comp_accel_data* self); -bool extract_mip_filter_comp_accel_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_comp_accel_data(microstrain_serializer* serializer, const mip_filter_comp_accel_data* self); +void extract_mip_filter_comp_accel_data(microstrain_serializer* serializer, mip_filter_comp_accel_data* self); +bool extract_mip_filter_comp_accel_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_comp_angular_rate (0x82,0x0E) Comp Angular Rate [C] +///@defgroup filter_comp_angular_rate_c (0x82,0x0E) Comp Angular Rate /// Filter-compensated angular rate expressed in the vehicle frame. /// ///@{ @@ -611,18 +663,18 @@ struct mip_filter_comp_angular_rate_data { mip_vector3f gyro; ///< (x, y, z) [radians/second] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_comp_angular_rate_data mip_filter_comp_angular_rate_data; -void insert_mip_filter_comp_angular_rate_data(struct mip_serializer* serializer, const mip_filter_comp_angular_rate_data* self); -void extract_mip_filter_comp_angular_rate_data(struct mip_serializer* serializer, mip_filter_comp_angular_rate_data* self); -bool extract_mip_filter_comp_angular_rate_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_comp_angular_rate_data(microstrain_serializer* serializer, const mip_filter_comp_angular_rate_data* self); +void extract_mip_filter_comp_angular_rate_data(microstrain_serializer* serializer, mip_filter_comp_angular_rate_data* self); +bool extract_mip_filter_comp_angular_rate_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_quaternion_attitude_uncertainty (0x82,0x12) Quaternion Attitude Uncertainty [C] +///@defgroup filter_quaternion_attitude_uncertainty_c (0x82,0x12) Quaternion Attitude Uncertainty /// Filter reported quaternion uncertainties. /// ///@{ @@ -631,18 +683,18 @@ struct mip_filter_quaternion_attitude_uncertainty_data { mip_quatf q; ///< [dimensionless] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_quaternion_attitude_uncertainty_data mip_filter_quaternion_attitude_uncertainty_data; -void insert_mip_filter_quaternion_attitude_uncertainty_data(struct mip_serializer* serializer, const mip_filter_quaternion_attitude_uncertainty_data* self); -void extract_mip_filter_quaternion_attitude_uncertainty_data(struct mip_serializer* serializer, mip_filter_quaternion_attitude_uncertainty_data* self); -bool extract_mip_filter_quaternion_attitude_uncertainty_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_quaternion_attitude_uncertainty_data(microstrain_serializer* serializer, const mip_filter_quaternion_attitude_uncertainty_data* self); +void extract_mip_filter_quaternion_attitude_uncertainty_data(microstrain_serializer* serializer, mip_filter_quaternion_attitude_uncertainty_data* self); +bool extract_mip_filter_quaternion_attitude_uncertainty_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_wgs84_gravity_mag (0x82,0x0F) Wgs84 Gravity Mag [C] +///@defgroup filter_wgs84_gravity_mag_c (0x82,0x0F) Wgs84 Gravity Mag /// Filter reported WGS84 gravity magnitude. /// ///@{ @@ -651,18 +703,18 @@ struct mip_filter_wgs84_gravity_mag_data { float magnitude; ///< [meters/second^2] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_wgs84_gravity_mag_data mip_filter_wgs84_gravity_mag_data; -void insert_mip_filter_wgs84_gravity_mag_data(struct mip_serializer* serializer, const mip_filter_wgs84_gravity_mag_data* self); -void extract_mip_filter_wgs84_gravity_mag_data(struct mip_serializer* serializer, mip_filter_wgs84_gravity_mag_data* self); -bool extract_mip_filter_wgs84_gravity_mag_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_wgs84_gravity_mag_data(microstrain_serializer* serializer, const mip_filter_wgs84_gravity_mag_data* self); +void extract_mip_filter_wgs84_gravity_mag_data(microstrain_serializer* serializer, mip_filter_wgs84_gravity_mag_data* self); +bool extract_mip_filter_wgs84_gravity_mag_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_heading_update_state (0x82,0x14) Heading Update State [C] +///@defgroup filter_heading_update_state_c (0x82,0x14) Heading Update State /// Filter reported heading update state. /// /// Heading updates can be applied from the sources listed below. Note, some of these sources may be combined. @@ -670,12 +722,27 @@ bool extract_mip_filter_wgs84_gravity_mag_data_from_field(const struct mip_field /// ///@{ -typedef uint16_t mip_filter_heading_update_state_data_heading_source; -static const mip_filter_heading_update_state_data_heading_source MIP_FILTER_HEADING_UPDATE_STATE_DATA_HEADING_SOURCE_NONE = 0; ///< -static const mip_filter_heading_update_state_data_heading_source MIP_FILTER_HEADING_UPDATE_STATE_DATA_HEADING_SOURCE_MAGNETOMETER = 1; ///< -static const mip_filter_heading_update_state_data_heading_source MIP_FILTER_HEADING_UPDATE_STATE_DATA_HEADING_SOURCE_GNSS_VELOCITY_VECTOR = 2; ///< -static const mip_filter_heading_update_state_data_heading_source MIP_FILTER_HEADING_UPDATE_STATE_DATA_HEADING_SOURCE_EXTERNAL = 4; ///< -static const mip_filter_heading_update_state_data_heading_source MIP_FILTER_HEADING_UPDATE_STATE_DATA_HEADING_SOURCE_DUAL_ANTENNA = 8; ///< +enum mip_filter_heading_update_state_data_heading_source +{ + MIP_FILTER_HEADING_UPDATE_STATE_DATA_HEADING_SOURCE_NONE = 0, ///< + MIP_FILTER_HEADING_UPDATE_STATE_DATA_HEADING_SOURCE_MAGNETOMETER = 1, ///< + MIP_FILTER_HEADING_UPDATE_STATE_DATA_HEADING_SOURCE_GNSS_VELOCITY_VECTOR = 2, ///< + MIP_FILTER_HEADING_UPDATE_STATE_DATA_HEADING_SOURCE_EXTERNAL = 4, ///< + MIP_FILTER_HEADING_UPDATE_STATE_DATA_HEADING_SOURCE_DUAL_ANTENNA = 8, ///< +}; +typedef enum mip_filter_heading_update_state_data_heading_source mip_filter_heading_update_state_data_heading_source; + +static inline void insert_mip_filter_heading_update_state_data_heading_source(microstrain_serializer* serializer, const mip_filter_heading_update_state_data_heading_source self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_filter_heading_update_state_data_heading_source(microstrain_serializer* serializer, mip_filter_heading_update_state_data_heading_source* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_filter_heading_update_state_data { @@ -683,21 +750,18 @@ struct mip_filter_heading_update_state_data float heading_1sigma; ///< [radians] mip_filter_heading_update_state_data_heading_source source; uint16_t valid_flags; ///< 1 if a valid heading update was received in 2 seconds, 0 otherwise. - }; typedef struct mip_filter_heading_update_state_data mip_filter_heading_update_state_data; -void insert_mip_filter_heading_update_state_data(struct mip_serializer* serializer, const mip_filter_heading_update_state_data* self); -void extract_mip_filter_heading_update_state_data(struct mip_serializer* serializer, mip_filter_heading_update_state_data* self); -bool extract_mip_filter_heading_update_state_data_from_field(const struct mip_field* field, void* ptr); -void insert_mip_filter_heading_update_state_data_heading_source(struct mip_serializer* serializer, const mip_filter_heading_update_state_data_heading_source self); -void extract_mip_filter_heading_update_state_data_heading_source(struct mip_serializer* serializer, mip_filter_heading_update_state_data_heading_source* self); +void insert_mip_filter_heading_update_state_data(microstrain_serializer* serializer, const mip_filter_heading_update_state_data* self); +void extract_mip_filter_heading_update_state_data(microstrain_serializer* serializer, mip_filter_heading_update_state_data* self); +bool extract_mip_filter_heading_update_state_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_magnetic_model (0x82,0x15) Magnetic Model [C] +///@defgroup filter_magnetic_model_c (0x82,0x15) Magnetic Model /// The World Magnetic Model is used for this data. Please refer to the device user manual for the current version of the model. /// A valid GNSS location is required for the model to be valid. /// @@ -711,18 +775,18 @@ struct mip_filter_magnetic_model_data float inclination; ///< [radians] float declination; ///< [radians] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_magnetic_model_data mip_filter_magnetic_model_data; -void insert_mip_filter_magnetic_model_data(struct mip_serializer* serializer, const mip_filter_magnetic_model_data* self); -void extract_mip_filter_magnetic_model_data(struct mip_serializer* serializer, mip_filter_magnetic_model_data* self); -bool extract_mip_filter_magnetic_model_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_magnetic_model_data(microstrain_serializer* serializer, const mip_filter_magnetic_model_data* self); +void extract_mip_filter_magnetic_model_data(microstrain_serializer* serializer, mip_filter_magnetic_model_data* self); +bool extract_mip_filter_magnetic_model_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_accel_scale_factor (0x82,0x17) Accel Scale Factor [C] +///@defgroup filter_accel_scale_factor_c (0x82,0x17) Accel Scale Factor /// Filter reported accelerometer scale factor expressed in the sensor frame. /// ///@{ @@ -731,18 +795,18 @@ struct mip_filter_accel_scale_factor_data { mip_vector3f scale_factor; ///< (x,y,z) [dimensionless] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_accel_scale_factor_data mip_filter_accel_scale_factor_data; -void insert_mip_filter_accel_scale_factor_data(struct mip_serializer* serializer, const mip_filter_accel_scale_factor_data* self); -void extract_mip_filter_accel_scale_factor_data(struct mip_serializer* serializer, mip_filter_accel_scale_factor_data* self); -bool extract_mip_filter_accel_scale_factor_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_accel_scale_factor_data(microstrain_serializer* serializer, const mip_filter_accel_scale_factor_data* self); +void extract_mip_filter_accel_scale_factor_data(microstrain_serializer* serializer, mip_filter_accel_scale_factor_data* self); +bool extract_mip_filter_accel_scale_factor_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_accel_scale_factor_uncertainty (0x82,0x19) Accel Scale Factor Uncertainty [C] +///@defgroup filter_accel_scale_factor_uncertainty_c (0x82,0x19) Accel Scale Factor Uncertainty /// Filter reported 1-sigma accelerometer scale factor uncertainty expressed in the sensor frame. /// ///@{ @@ -751,18 +815,18 @@ struct mip_filter_accel_scale_factor_uncertainty_data { mip_vector3f scale_factor_uncert; ///< (x,y,z) [dimensionless] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_accel_scale_factor_uncertainty_data mip_filter_accel_scale_factor_uncertainty_data; -void insert_mip_filter_accel_scale_factor_uncertainty_data(struct mip_serializer* serializer, const mip_filter_accel_scale_factor_uncertainty_data* self); -void extract_mip_filter_accel_scale_factor_uncertainty_data(struct mip_serializer* serializer, mip_filter_accel_scale_factor_uncertainty_data* self); -bool extract_mip_filter_accel_scale_factor_uncertainty_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_accel_scale_factor_uncertainty_data(microstrain_serializer* serializer, const mip_filter_accel_scale_factor_uncertainty_data* self); +void extract_mip_filter_accel_scale_factor_uncertainty_data(microstrain_serializer* serializer, mip_filter_accel_scale_factor_uncertainty_data* self); +bool extract_mip_filter_accel_scale_factor_uncertainty_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_gyro_scale_factor (0x82,0x16) Gyro Scale Factor [C] +///@defgroup filter_gyro_scale_factor_c (0x82,0x16) Gyro Scale Factor /// Filter reported gyro scale factor expressed in the sensor frame. /// ///@{ @@ -771,18 +835,18 @@ struct mip_filter_gyro_scale_factor_data { mip_vector3f scale_factor; ///< (x,y,z) [dimensionless] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_gyro_scale_factor_data mip_filter_gyro_scale_factor_data; -void insert_mip_filter_gyro_scale_factor_data(struct mip_serializer* serializer, const mip_filter_gyro_scale_factor_data* self); -void extract_mip_filter_gyro_scale_factor_data(struct mip_serializer* serializer, mip_filter_gyro_scale_factor_data* self); -bool extract_mip_filter_gyro_scale_factor_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_gyro_scale_factor_data(microstrain_serializer* serializer, const mip_filter_gyro_scale_factor_data* self); +void extract_mip_filter_gyro_scale_factor_data(microstrain_serializer* serializer, mip_filter_gyro_scale_factor_data* self); +bool extract_mip_filter_gyro_scale_factor_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_gyro_scale_factor_uncertainty (0x82,0x18) Gyro Scale Factor Uncertainty [C] +///@defgroup filter_gyro_scale_factor_uncertainty_c (0x82,0x18) Gyro Scale Factor Uncertainty /// Filter reported 1-sigma gyro scale factor uncertainty expressed in the sensor frame. /// ///@{ @@ -791,18 +855,18 @@ struct mip_filter_gyro_scale_factor_uncertainty_data { mip_vector3f scale_factor_uncert; ///< (x,y,z) [dimensionless] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_gyro_scale_factor_uncertainty_data mip_filter_gyro_scale_factor_uncertainty_data; -void insert_mip_filter_gyro_scale_factor_uncertainty_data(struct mip_serializer* serializer, const mip_filter_gyro_scale_factor_uncertainty_data* self); -void extract_mip_filter_gyro_scale_factor_uncertainty_data(struct mip_serializer* serializer, mip_filter_gyro_scale_factor_uncertainty_data* self); -bool extract_mip_filter_gyro_scale_factor_uncertainty_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_gyro_scale_factor_uncertainty_data(microstrain_serializer* serializer, const mip_filter_gyro_scale_factor_uncertainty_data* self); +void extract_mip_filter_gyro_scale_factor_uncertainty_data(microstrain_serializer* serializer, mip_filter_gyro_scale_factor_uncertainty_data* self); +bool extract_mip_filter_gyro_scale_factor_uncertainty_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_mag_bias (0x82,0x1A) Mag Bias [C] +///@defgroup filter_mag_bias_c (0x82,0x1A) Mag Bias /// Filter reported magnetometer bias expressed in the sensor frame. /// ///@{ @@ -811,18 +875,18 @@ struct mip_filter_mag_bias_data { mip_vector3f bias; ///< (x,y,z) [Gauss] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_mag_bias_data mip_filter_mag_bias_data; -void insert_mip_filter_mag_bias_data(struct mip_serializer* serializer, const mip_filter_mag_bias_data* self); -void extract_mip_filter_mag_bias_data(struct mip_serializer* serializer, mip_filter_mag_bias_data* self); -bool extract_mip_filter_mag_bias_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_mag_bias_data(microstrain_serializer* serializer, const mip_filter_mag_bias_data* self); +void extract_mip_filter_mag_bias_data(microstrain_serializer* serializer, mip_filter_mag_bias_data* self); +bool extract_mip_filter_mag_bias_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_mag_bias_uncertainty (0x82,0x1B) Mag Bias Uncertainty [C] +///@defgroup filter_mag_bias_uncertainty_c (0x82,0x1B) Mag Bias Uncertainty /// Filter reported 1-sigma magnetometer bias uncertainty expressed in the sensor frame. /// ///@{ @@ -831,18 +895,18 @@ struct mip_filter_mag_bias_uncertainty_data { mip_vector3f bias_uncert; ///< (x,y,z) [Gauss] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_mag_bias_uncertainty_data mip_filter_mag_bias_uncertainty_data; -void insert_mip_filter_mag_bias_uncertainty_data(struct mip_serializer* serializer, const mip_filter_mag_bias_uncertainty_data* self); -void extract_mip_filter_mag_bias_uncertainty_data(struct mip_serializer* serializer, mip_filter_mag_bias_uncertainty_data* self); -bool extract_mip_filter_mag_bias_uncertainty_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_mag_bias_uncertainty_data(microstrain_serializer* serializer, const mip_filter_mag_bias_uncertainty_data* self); +void extract_mip_filter_mag_bias_uncertainty_data(microstrain_serializer* serializer, mip_filter_mag_bias_uncertainty_data* self); +bool extract_mip_filter_mag_bias_uncertainty_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_standard_atmosphere (0x82,0x20) Standard Atmosphere [C] +///@defgroup filter_standard_atmosphere_c (0x82,0x20) Standard Atmosphere /// Filter reported standard atmosphere parameters. /// /// The US 1976 Standard Atmosphere Model is used. A valid GNSS location is required for the model to be valid. @@ -857,18 +921,18 @@ struct mip_filter_standard_atmosphere_data float standard_pressure; ///< [milliBar] float standard_density; ///< [kilogram/meter^3] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_standard_atmosphere_data mip_filter_standard_atmosphere_data; -void insert_mip_filter_standard_atmosphere_data(struct mip_serializer* serializer, const mip_filter_standard_atmosphere_data* self); -void extract_mip_filter_standard_atmosphere_data(struct mip_serializer* serializer, mip_filter_standard_atmosphere_data* self); -bool extract_mip_filter_standard_atmosphere_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_standard_atmosphere_data(microstrain_serializer* serializer, const mip_filter_standard_atmosphere_data* self); +void extract_mip_filter_standard_atmosphere_data(microstrain_serializer* serializer, mip_filter_standard_atmosphere_data* self); +bool extract_mip_filter_standard_atmosphere_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_pressure_altitude (0x82,0x21) Pressure Altitude [C] +///@defgroup filter_pressure_altitude_c (0x82,0x21) Pressure Altitude /// Filter reported pressure altitude. /// /// The US 1976 Standard Atmosphere Model is used to calculate the pressure altitude in meters. @@ -881,18 +945,18 @@ struct mip_filter_pressure_altitude_data { float pressure_altitude; ///< [meters] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_pressure_altitude_data mip_filter_pressure_altitude_data; -void insert_mip_filter_pressure_altitude_data(struct mip_serializer* serializer, const mip_filter_pressure_altitude_data* self); -void extract_mip_filter_pressure_altitude_data(struct mip_serializer* serializer, mip_filter_pressure_altitude_data* self); -bool extract_mip_filter_pressure_altitude_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_pressure_altitude_data(microstrain_serializer* serializer, const mip_filter_pressure_altitude_data* self); +void extract_mip_filter_pressure_altitude_data(microstrain_serializer* serializer, mip_filter_pressure_altitude_data* self); +bool extract_mip_filter_pressure_altitude_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_density_altitude (0x82,0x22) Density Altitude [C] +///@defgroup filter_density_altitude_c (0x82,0x22) Density Altitude /// ///@{ @@ -900,18 +964,18 @@ struct mip_filter_density_altitude_data { float density_altitude; ///< m uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_density_altitude_data mip_filter_density_altitude_data; -void insert_mip_filter_density_altitude_data(struct mip_serializer* serializer, const mip_filter_density_altitude_data* self); -void extract_mip_filter_density_altitude_data(struct mip_serializer* serializer, mip_filter_density_altitude_data* self); -bool extract_mip_filter_density_altitude_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_density_altitude_data(microstrain_serializer* serializer, const mip_filter_density_altitude_data* self); +void extract_mip_filter_density_altitude_data(microstrain_serializer* serializer, mip_filter_density_altitude_data* self); +bool extract_mip_filter_density_altitude_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_antenna_offset_correction (0x82,0x30) Antenna Offset Correction [C] +///@defgroup filter_antenna_offset_correction_c (0x82,0x30) Antenna Offset Correction /// Filter reported GNSS antenna offset in vehicle frame. /// /// This offset added to any previously stored offset vector to compensate for errors in definition. @@ -922,18 +986,18 @@ struct mip_filter_antenna_offset_correction_data { mip_vector3f offset; ///< (x,y,z) [meters] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_antenna_offset_correction_data mip_filter_antenna_offset_correction_data; -void insert_mip_filter_antenna_offset_correction_data(struct mip_serializer* serializer, const mip_filter_antenna_offset_correction_data* self); -void extract_mip_filter_antenna_offset_correction_data(struct mip_serializer* serializer, mip_filter_antenna_offset_correction_data* self); -bool extract_mip_filter_antenna_offset_correction_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_antenna_offset_correction_data(microstrain_serializer* serializer, const mip_filter_antenna_offset_correction_data* self); +void extract_mip_filter_antenna_offset_correction_data(microstrain_serializer* serializer, mip_filter_antenna_offset_correction_data* self); +bool extract_mip_filter_antenna_offset_correction_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_antenna_offset_correction_uncertainty (0x82,0x31) Antenna Offset Correction Uncertainty [C] +///@defgroup filter_antenna_offset_correction_uncertainty_c (0x82,0x31) Antenna Offset Correction Uncertainty /// Filter reported 1-sigma GNSS antenna offset uncertainties in vehicle frame. /// ///@{ @@ -942,18 +1006,18 @@ struct mip_filter_antenna_offset_correction_uncertainty_data { mip_vector3f offset_uncert; ///< (x,y,z) [meters] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_antenna_offset_correction_uncertainty_data mip_filter_antenna_offset_correction_uncertainty_data; -void insert_mip_filter_antenna_offset_correction_uncertainty_data(struct mip_serializer* serializer, const mip_filter_antenna_offset_correction_uncertainty_data* self); -void extract_mip_filter_antenna_offset_correction_uncertainty_data(struct mip_serializer* serializer, mip_filter_antenna_offset_correction_uncertainty_data* self); -bool extract_mip_filter_antenna_offset_correction_uncertainty_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_antenna_offset_correction_uncertainty_data(microstrain_serializer* serializer, const mip_filter_antenna_offset_correction_uncertainty_data* self); +void extract_mip_filter_antenna_offset_correction_uncertainty_data(microstrain_serializer* serializer, mip_filter_antenna_offset_correction_uncertainty_data* self); +bool extract_mip_filter_antenna_offset_correction_uncertainty_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_multi_antenna_offset_correction (0x82,0x34) Multi Antenna Offset Correction [C] +///@defgroup filter_multi_antenna_offset_correction_c (0x82,0x34) Multi Antenna Offset Correction /// Filter reported GNSS antenna offset in vehicle frame. /// /// This offset added to any previously stored offset vector to compensate for errors in definition. @@ -965,18 +1029,18 @@ struct mip_filter_multi_antenna_offset_correction_data uint8_t receiver_id; ///< Receiver ID for the receiver to which the antenna is attached mip_vector3f offset; ///< (x,y,z) [meters] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_multi_antenna_offset_correction_data mip_filter_multi_antenna_offset_correction_data; -void insert_mip_filter_multi_antenna_offset_correction_data(struct mip_serializer* serializer, const mip_filter_multi_antenna_offset_correction_data* self); -void extract_mip_filter_multi_antenna_offset_correction_data(struct mip_serializer* serializer, mip_filter_multi_antenna_offset_correction_data* self); -bool extract_mip_filter_multi_antenna_offset_correction_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_multi_antenna_offset_correction_data(microstrain_serializer* serializer, const mip_filter_multi_antenna_offset_correction_data* self); +void extract_mip_filter_multi_antenna_offset_correction_data(microstrain_serializer* serializer, mip_filter_multi_antenna_offset_correction_data* self); +bool extract_mip_filter_multi_antenna_offset_correction_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_multi_antenna_offset_correction_uncertainty (0x82,0x35) Multi Antenna Offset Correction Uncertainty [C] +///@defgroup filter_multi_antenna_offset_correction_uncertainty_c (0x82,0x35) Multi Antenna Offset Correction Uncertainty /// Filter reported 1-sigma GNSS antenna offset uncertainties in vehicle frame. /// ///@{ @@ -986,18 +1050,18 @@ struct mip_filter_multi_antenna_offset_correction_uncertainty_data uint8_t receiver_id; ///< Receiver ID for the receiver to which the antenna is attached mip_vector3f offset_uncert; ///< (x,y,z) [meters] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_multi_antenna_offset_correction_uncertainty_data mip_filter_multi_antenna_offset_correction_uncertainty_data; -void insert_mip_filter_multi_antenna_offset_correction_uncertainty_data(struct mip_serializer* serializer, const mip_filter_multi_antenna_offset_correction_uncertainty_data* self); -void extract_mip_filter_multi_antenna_offset_correction_uncertainty_data(struct mip_serializer* serializer, mip_filter_multi_antenna_offset_correction_uncertainty_data* self); -bool extract_mip_filter_multi_antenna_offset_correction_uncertainty_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_multi_antenna_offset_correction_uncertainty_data(microstrain_serializer* serializer, const mip_filter_multi_antenna_offset_correction_uncertainty_data* self); +void extract_mip_filter_multi_antenna_offset_correction_uncertainty_data(microstrain_serializer* serializer, mip_filter_multi_antenna_offset_correction_uncertainty_data* self); +bool extract_mip_filter_multi_antenna_offset_correction_uncertainty_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_magnetometer_offset (0x82,0x25) Magnetometer Offset [C] +///@defgroup filter_magnetometer_offset_c (0x82,0x25) Magnetometer Offset /// Filter reported magnetometer hard iron offset in sensor frame. /// /// This offset added to any previously stored hard iron offset vector to compensate for magnetometer in-run bias errors. @@ -1008,18 +1072,18 @@ struct mip_filter_magnetometer_offset_data { mip_vector3f hard_iron; ///< (x,y,z) [Gauss] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_magnetometer_offset_data mip_filter_magnetometer_offset_data; -void insert_mip_filter_magnetometer_offset_data(struct mip_serializer* serializer, const mip_filter_magnetometer_offset_data* self); -void extract_mip_filter_magnetometer_offset_data(struct mip_serializer* serializer, mip_filter_magnetometer_offset_data* self); -bool extract_mip_filter_magnetometer_offset_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_magnetometer_offset_data(microstrain_serializer* serializer, const mip_filter_magnetometer_offset_data* self); +void extract_mip_filter_magnetometer_offset_data(microstrain_serializer* serializer, mip_filter_magnetometer_offset_data* self); +bool extract_mip_filter_magnetometer_offset_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_magnetometer_matrix (0x82,0x26) Magnetometer Matrix [C] +///@defgroup filter_magnetometer_matrix_c (0x82,0x26) Magnetometer Matrix /// Filter reported magnetometer soft iron matrix in sensor frame. /// /// This matrix is post multiplied to any previously stored soft iron matrix to compensate for magnetometer in-run errors. @@ -1030,18 +1094,18 @@ struct mip_filter_magnetometer_matrix_data { mip_matrix3f soft_iron; ///< Row-major [dimensionless] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_magnetometer_matrix_data mip_filter_magnetometer_matrix_data; -void insert_mip_filter_magnetometer_matrix_data(struct mip_serializer* serializer, const mip_filter_magnetometer_matrix_data* self); -void extract_mip_filter_magnetometer_matrix_data(struct mip_serializer* serializer, mip_filter_magnetometer_matrix_data* self); -bool extract_mip_filter_magnetometer_matrix_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_magnetometer_matrix_data(microstrain_serializer* serializer, const mip_filter_magnetometer_matrix_data* self); +void extract_mip_filter_magnetometer_matrix_data(microstrain_serializer* serializer, mip_filter_magnetometer_matrix_data* self); +bool extract_mip_filter_magnetometer_matrix_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_magnetometer_offset_uncertainty (0x82,0x28) Magnetometer Offset Uncertainty [C] +///@defgroup filter_magnetometer_offset_uncertainty_c (0x82,0x28) Magnetometer Offset Uncertainty /// Filter reported 1-sigma magnetometer hard iron offset uncertainties in sensor frame. /// ///@{ @@ -1050,18 +1114,18 @@ struct mip_filter_magnetometer_offset_uncertainty_data { mip_vector3f hard_iron_uncertainty; ///< (x,y,z) [Gauss] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_magnetometer_offset_uncertainty_data mip_filter_magnetometer_offset_uncertainty_data; -void insert_mip_filter_magnetometer_offset_uncertainty_data(struct mip_serializer* serializer, const mip_filter_magnetometer_offset_uncertainty_data* self); -void extract_mip_filter_magnetometer_offset_uncertainty_data(struct mip_serializer* serializer, mip_filter_magnetometer_offset_uncertainty_data* self); -bool extract_mip_filter_magnetometer_offset_uncertainty_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_magnetometer_offset_uncertainty_data(microstrain_serializer* serializer, const mip_filter_magnetometer_offset_uncertainty_data* self); +void extract_mip_filter_magnetometer_offset_uncertainty_data(microstrain_serializer* serializer, mip_filter_magnetometer_offset_uncertainty_data* self); +bool extract_mip_filter_magnetometer_offset_uncertainty_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_magnetometer_matrix_uncertainty (0x82,0x29) Magnetometer Matrix Uncertainty [C] +///@defgroup filter_magnetometer_matrix_uncertainty_c (0x82,0x29) Magnetometer Matrix Uncertainty /// Filter reported 1-sigma magnetometer soft iron matrix uncertainties in sensor frame. /// ///@{ @@ -1070,18 +1134,18 @@ struct mip_filter_magnetometer_matrix_uncertainty_data { mip_matrix3f soft_iron_uncertainty; ///< Row-major [dimensionless] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_magnetometer_matrix_uncertainty_data mip_filter_magnetometer_matrix_uncertainty_data; -void insert_mip_filter_magnetometer_matrix_uncertainty_data(struct mip_serializer* serializer, const mip_filter_magnetometer_matrix_uncertainty_data* self); -void extract_mip_filter_magnetometer_matrix_uncertainty_data(struct mip_serializer* serializer, mip_filter_magnetometer_matrix_uncertainty_data* self); -bool extract_mip_filter_magnetometer_matrix_uncertainty_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_magnetometer_matrix_uncertainty_data(microstrain_serializer* serializer, const mip_filter_magnetometer_matrix_uncertainty_data* self); +void extract_mip_filter_magnetometer_matrix_uncertainty_data(microstrain_serializer* serializer, mip_filter_magnetometer_matrix_uncertainty_data* self); +bool extract_mip_filter_magnetometer_matrix_uncertainty_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_magnetometer_covariance_matrix (0x82,0x2A) Magnetometer Covariance Matrix [C] +///@defgroup filter_magnetometer_covariance_matrix_c (0x82,0x2A) Magnetometer Covariance Matrix /// ///@{ @@ -1089,18 +1153,18 @@ struct mip_filter_magnetometer_covariance_matrix_data { mip_matrix3f covariance; uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_magnetometer_covariance_matrix_data mip_filter_magnetometer_covariance_matrix_data; -void insert_mip_filter_magnetometer_covariance_matrix_data(struct mip_serializer* serializer, const mip_filter_magnetometer_covariance_matrix_data* self); -void extract_mip_filter_magnetometer_covariance_matrix_data(struct mip_serializer* serializer, mip_filter_magnetometer_covariance_matrix_data* self); -bool extract_mip_filter_magnetometer_covariance_matrix_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_magnetometer_covariance_matrix_data(microstrain_serializer* serializer, const mip_filter_magnetometer_covariance_matrix_data* self); +void extract_mip_filter_magnetometer_covariance_matrix_data(microstrain_serializer* serializer, mip_filter_magnetometer_covariance_matrix_data* self); +bool extract_mip_filter_magnetometer_covariance_matrix_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_magnetometer_residual_vector (0x82,0x2C) Magnetometer Residual Vector [C] +///@defgroup filter_magnetometer_residual_vector_c (0x82,0x2C) Magnetometer Residual Vector /// Filter reported magnetometer measurement residuals in vehicle frame. /// ///@{ @@ -1109,18 +1173,18 @@ struct mip_filter_magnetometer_residual_vector_data { mip_vector3f residual; ///< (x,y,z) [Gauss] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_magnetometer_residual_vector_data mip_filter_magnetometer_residual_vector_data; -void insert_mip_filter_magnetometer_residual_vector_data(struct mip_serializer* serializer, const mip_filter_magnetometer_residual_vector_data* self); -void extract_mip_filter_magnetometer_residual_vector_data(struct mip_serializer* serializer, mip_filter_magnetometer_residual_vector_data* self); -bool extract_mip_filter_magnetometer_residual_vector_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_magnetometer_residual_vector_data(microstrain_serializer* serializer, const mip_filter_magnetometer_residual_vector_data* self); +void extract_mip_filter_magnetometer_residual_vector_data(microstrain_serializer* serializer, mip_filter_magnetometer_residual_vector_data* self); +bool extract_mip_filter_magnetometer_residual_vector_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_clock_correction (0x82,0x32) Clock Correction [C] +///@defgroup filter_clock_correction_c (0x82,0x32) Clock Correction /// Filter reported GNSS receiver clock error parameters. /// ///@{ @@ -1131,18 +1195,18 @@ struct mip_filter_clock_correction_data float bias; ///< [seconds] float bias_drift; ///< [seconds/second] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_clock_correction_data mip_filter_clock_correction_data; -void insert_mip_filter_clock_correction_data(struct mip_serializer* serializer, const mip_filter_clock_correction_data* self); -void extract_mip_filter_clock_correction_data(struct mip_serializer* serializer, mip_filter_clock_correction_data* self); -bool extract_mip_filter_clock_correction_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_clock_correction_data(microstrain_serializer* serializer, const mip_filter_clock_correction_data* self); +void extract_mip_filter_clock_correction_data(microstrain_serializer* serializer, mip_filter_clock_correction_data* self); +bool extract_mip_filter_clock_correction_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_clock_correction_uncertainty (0x82,0x33) Clock Correction Uncertainty [C] +///@defgroup filter_clock_correction_uncertainty_c (0x82,0x33) Clock Correction Uncertainty /// Filter reported 1-sigma GNSS receiver clock error parameters. /// ///@{ @@ -1153,18 +1217,18 @@ struct mip_filter_clock_correction_uncertainty_data float bias_uncertainty; ///< [seconds] float bias_drift_uncertainty; ///< [seconds/second] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_clock_correction_uncertainty_data mip_filter_clock_correction_uncertainty_data; -void insert_mip_filter_clock_correction_uncertainty_data(struct mip_serializer* serializer, const mip_filter_clock_correction_uncertainty_data* self); -void extract_mip_filter_clock_correction_uncertainty_data(struct mip_serializer* serializer, mip_filter_clock_correction_uncertainty_data* self); -bool extract_mip_filter_clock_correction_uncertainty_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_clock_correction_uncertainty_data(microstrain_serializer* serializer, const mip_filter_clock_correction_uncertainty_data* self); +void extract_mip_filter_clock_correction_uncertainty_data(microstrain_serializer* serializer, mip_filter_clock_correction_uncertainty_data* self); +bool extract_mip_filter_clock_correction_uncertainty_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_gnss_pos_aid_status (0x82,0x43) Gnss Pos Aid Status [C] +///@defgroup filter_gnss_pos_aid_status_c (0x82,0x43) Gnss Pos Aid Status /// Filter reported GNSS position aiding status /// ///@{ @@ -1175,18 +1239,18 @@ struct mip_filter_gnss_pos_aid_status_data float time_of_week; ///< Last GNSS aiding measurement time of week [seconds] mip_gnss_aid_status_flags status; ///< Aiding measurement status bitfield uint8_t reserved[8]; - }; typedef struct mip_filter_gnss_pos_aid_status_data mip_filter_gnss_pos_aid_status_data; -void insert_mip_filter_gnss_pos_aid_status_data(struct mip_serializer* serializer, const mip_filter_gnss_pos_aid_status_data* self); -void extract_mip_filter_gnss_pos_aid_status_data(struct mip_serializer* serializer, mip_filter_gnss_pos_aid_status_data* self); -bool extract_mip_filter_gnss_pos_aid_status_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_gnss_pos_aid_status_data(microstrain_serializer* serializer, const mip_filter_gnss_pos_aid_status_data* self); +void extract_mip_filter_gnss_pos_aid_status_data(microstrain_serializer* serializer, mip_filter_gnss_pos_aid_status_data* self); +bool extract_mip_filter_gnss_pos_aid_status_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_gnss_att_aid_status (0x82,0x44) Gnss Att Aid Status [C] +///@defgroup filter_gnss_att_aid_status_c (0x82,0x44) Gnss Att Aid Status /// Filter reported dual antenna GNSS attitude aiding status /// ///@{ @@ -1196,46 +1260,58 @@ struct mip_filter_gnss_att_aid_status_data float time_of_week; ///< Last valid aiding measurement time of week [seconds] [processed instead of measured?] mip_gnss_aid_status_flags status; ///< Last valid aiding measurement status bitfield uint8_t reserved[8]; - }; typedef struct mip_filter_gnss_att_aid_status_data mip_filter_gnss_att_aid_status_data; -void insert_mip_filter_gnss_att_aid_status_data(struct mip_serializer* serializer, const mip_filter_gnss_att_aid_status_data* self); -void extract_mip_filter_gnss_att_aid_status_data(struct mip_serializer* serializer, mip_filter_gnss_att_aid_status_data* self); -bool extract_mip_filter_gnss_att_aid_status_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_gnss_att_aid_status_data(microstrain_serializer* serializer, const mip_filter_gnss_att_aid_status_data* self); +void extract_mip_filter_gnss_att_aid_status_data(microstrain_serializer* serializer, mip_filter_gnss_att_aid_status_data* self); +bool extract_mip_filter_gnss_att_aid_status_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_head_aid_status (0x82,0x45) Head Aid Status [C] +///@defgroup filter_head_aid_status_c (0x82,0x45) Head Aid Status /// Filter reported GNSS heading aiding status /// ///@{ -typedef uint8_t mip_filter_head_aid_status_data_heading_aid_type; -static const mip_filter_head_aid_status_data_heading_aid_type MIP_FILTER_HEAD_AID_STATUS_DATA_HEADING_AID_TYPE_DUAL_ANTENNA = 1; ///< -static const mip_filter_head_aid_status_data_heading_aid_type MIP_FILTER_HEAD_AID_STATUS_DATA_HEADING_AID_TYPE_EXTERNAL_MESSAGE = 2; ///< +enum mip_filter_head_aid_status_data_heading_aid_type +{ + MIP_FILTER_HEAD_AID_STATUS_DATA_HEADING_AID_TYPE_DUAL_ANTENNA = 1, ///< + MIP_FILTER_HEAD_AID_STATUS_DATA_HEADING_AID_TYPE_EXTERNAL_MESSAGE = 2, ///< +}; +typedef enum mip_filter_head_aid_status_data_heading_aid_type mip_filter_head_aid_status_data_heading_aid_type; + +static inline void insert_mip_filter_head_aid_status_data_heading_aid_type(microstrain_serializer* serializer, const mip_filter_head_aid_status_data_heading_aid_type self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_filter_head_aid_status_data_heading_aid_type(microstrain_serializer* serializer, mip_filter_head_aid_status_data_heading_aid_type* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} + struct mip_filter_head_aid_status_data { float time_of_week; ///< Last valid aiding measurement time of week [seconds] [processed instead of measured?] mip_filter_head_aid_status_data_heading_aid_type type; ///< 1 - Dual antenna, 2 - External heading message (user supplied) float reserved[2]; - }; typedef struct mip_filter_head_aid_status_data mip_filter_head_aid_status_data; -void insert_mip_filter_head_aid_status_data(struct mip_serializer* serializer, const mip_filter_head_aid_status_data* self); -void extract_mip_filter_head_aid_status_data(struct mip_serializer* serializer, mip_filter_head_aid_status_data* self); -bool extract_mip_filter_head_aid_status_data_from_field(const struct mip_field* field, void* ptr); -void insert_mip_filter_head_aid_status_data_heading_aid_type(struct mip_serializer* serializer, const mip_filter_head_aid_status_data_heading_aid_type self); -void extract_mip_filter_head_aid_status_data_heading_aid_type(struct mip_serializer* serializer, mip_filter_head_aid_status_data_heading_aid_type* self); +void insert_mip_filter_head_aid_status_data(microstrain_serializer* serializer, const mip_filter_head_aid_status_data* self); +void extract_mip_filter_head_aid_status_data(microstrain_serializer* serializer, mip_filter_head_aid_status_data* self); +bool extract_mip_filter_head_aid_status_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_rel_pos_ned (0x82,0x42) Rel Pos Ned [C] +///@defgroup filter_rel_pos_ned_c (0x82,0x42) Rel Pos Ned /// Filter reported relative position, with respect to configured reference position /// ///@{ @@ -1244,18 +1320,18 @@ struct mip_filter_rel_pos_ned_data { mip_vector3d relative_position; ///< [meters, NED] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_rel_pos_ned_data mip_filter_rel_pos_ned_data; -void insert_mip_filter_rel_pos_ned_data(struct mip_serializer* serializer, const mip_filter_rel_pos_ned_data* self); -void extract_mip_filter_rel_pos_ned_data(struct mip_serializer* serializer, mip_filter_rel_pos_ned_data* self); -bool extract_mip_filter_rel_pos_ned_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_rel_pos_ned_data(microstrain_serializer* serializer, const mip_filter_rel_pos_ned_data* self); +void extract_mip_filter_rel_pos_ned_data(microstrain_serializer* serializer, mip_filter_rel_pos_ned_data* self); +bool extract_mip_filter_rel_pos_ned_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_ecef_pos (0x82,0x40) Ecef Pos [C] +///@defgroup filter_ecef_pos_c (0x82,0x40) Ecef Pos /// Filter reported ECEF position /// ///@{ @@ -1264,18 +1340,18 @@ struct mip_filter_ecef_pos_data { mip_vector3d position_ecef; ///< [meters, ECEF] uint16_t valid_flags; ///< 0 - invalid, 1 valid - }; typedef struct mip_filter_ecef_pos_data mip_filter_ecef_pos_data; -void insert_mip_filter_ecef_pos_data(struct mip_serializer* serializer, const mip_filter_ecef_pos_data* self); -void extract_mip_filter_ecef_pos_data(struct mip_serializer* serializer, mip_filter_ecef_pos_data* self); -bool extract_mip_filter_ecef_pos_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_ecef_pos_data(microstrain_serializer* serializer, const mip_filter_ecef_pos_data* self); +void extract_mip_filter_ecef_pos_data(microstrain_serializer* serializer, mip_filter_ecef_pos_data* self); +bool extract_mip_filter_ecef_pos_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_ecef_vel (0x82,0x41) Ecef Vel [C] +///@defgroup filter_ecef_vel_c (0x82,0x41) Ecef Vel /// Filter reported ECEF velocity /// ///@{ @@ -1284,18 +1360,18 @@ struct mip_filter_ecef_vel_data { mip_vector3f velocity_ecef; ///< [meters/second, ECEF] uint16_t valid_flags; ///< 0 - invalid, 1 valid - }; typedef struct mip_filter_ecef_vel_data mip_filter_ecef_vel_data; -void insert_mip_filter_ecef_vel_data(struct mip_serializer* serializer, const mip_filter_ecef_vel_data* self); -void extract_mip_filter_ecef_vel_data(struct mip_serializer* serializer, mip_filter_ecef_vel_data* self); -bool extract_mip_filter_ecef_vel_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_ecef_vel_data(microstrain_serializer* serializer, const mip_filter_ecef_vel_data* self); +void extract_mip_filter_ecef_vel_data(microstrain_serializer* serializer, mip_filter_ecef_vel_data* self); +bool extract_mip_filter_ecef_vel_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_ecef_pos_uncertainty (0x82,0x36) Ecef Pos Uncertainty [C] +///@defgroup filter_ecef_pos_uncertainty_c (0x82,0x36) Ecef Pos Uncertainty /// Filter reported 1-sigma position uncertainty in the ECEF frame. /// ///@{ @@ -1304,18 +1380,18 @@ struct mip_filter_ecef_pos_uncertainty_data { mip_vector3f pos_uncertainty; ///< [meters] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_ecef_pos_uncertainty_data mip_filter_ecef_pos_uncertainty_data; -void insert_mip_filter_ecef_pos_uncertainty_data(struct mip_serializer* serializer, const mip_filter_ecef_pos_uncertainty_data* self); -void extract_mip_filter_ecef_pos_uncertainty_data(struct mip_serializer* serializer, mip_filter_ecef_pos_uncertainty_data* self); -bool extract_mip_filter_ecef_pos_uncertainty_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_ecef_pos_uncertainty_data(microstrain_serializer* serializer, const mip_filter_ecef_pos_uncertainty_data* self); +void extract_mip_filter_ecef_pos_uncertainty_data(microstrain_serializer* serializer, mip_filter_ecef_pos_uncertainty_data* self); +bool extract_mip_filter_ecef_pos_uncertainty_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_ecef_vel_uncertainty (0x82,0x37) Ecef Vel Uncertainty [C] +///@defgroup filter_ecef_vel_uncertainty_c (0x82,0x37) Ecef Vel Uncertainty /// Filter reported 1-sigma velocity uncertainties in the ECEF frame. /// ///@{ @@ -1324,18 +1400,18 @@ struct mip_filter_ecef_vel_uncertainty_data { mip_vector3f vel_uncertainty; ///< [meters/second] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_ecef_vel_uncertainty_data mip_filter_ecef_vel_uncertainty_data; -void insert_mip_filter_ecef_vel_uncertainty_data(struct mip_serializer* serializer, const mip_filter_ecef_vel_uncertainty_data* self); -void extract_mip_filter_ecef_vel_uncertainty_data(struct mip_serializer* serializer, mip_filter_ecef_vel_uncertainty_data* self); -bool extract_mip_filter_ecef_vel_uncertainty_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_ecef_vel_uncertainty_data(microstrain_serializer* serializer, const mip_filter_ecef_vel_uncertainty_data* self); +void extract_mip_filter_ecef_vel_uncertainty_data(microstrain_serializer* serializer, mip_filter_ecef_vel_uncertainty_data* self); +bool extract_mip_filter_ecef_vel_uncertainty_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_aiding_measurement_summary (0x82,0x46) Aiding Measurement Summary [C] +///@defgroup filter_aiding_measurement_summary_c (0x82,0x46) Aiding Measurement Summary /// Filter reported aiding measurement summary. This message contains a summary of the specified aiding measurement over the previous measurement interval ending at the specified time. /// ///@{ @@ -1346,18 +1422,18 @@ struct mip_filter_aiding_measurement_summary_data uint8_t source; mip_filter_aiding_measurement_type type; ///< (see product manual for supported types) Note: values 0x20 and above correspond to commanded aiding measurements in the 0x13 Aiding command set. mip_filter_measurement_indicator indicator; - }; typedef struct mip_filter_aiding_measurement_summary_data mip_filter_aiding_measurement_summary_data; -void insert_mip_filter_aiding_measurement_summary_data(struct mip_serializer* serializer, const mip_filter_aiding_measurement_summary_data* self); -void extract_mip_filter_aiding_measurement_summary_data(struct mip_serializer* serializer, mip_filter_aiding_measurement_summary_data* self); -bool extract_mip_filter_aiding_measurement_summary_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_aiding_measurement_summary_data(microstrain_serializer* serializer, const mip_filter_aiding_measurement_summary_data* self); +void extract_mip_filter_aiding_measurement_summary_data(microstrain_serializer* serializer, mip_filter_aiding_measurement_summary_data* self); +bool extract_mip_filter_aiding_measurement_summary_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_odometer_scale_factor_error (0x82,0x47) Odometer Scale Factor Error [C] +///@defgroup filter_odometer_scale_factor_error_c (0x82,0x47) Odometer Scale Factor Error /// Filter reported odometer scale factor error. The total scale factor estimate is the user indicated scale factor, plus the user indicated scale factor times the scale factor error. /// ///@{ @@ -1366,18 +1442,18 @@ struct mip_filter_odometer_scale_factor_error_data { float scale_factor_error; ///< [dimensionless] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_odometer_scale_factor_error_data mip_filter_odometer_scale_factor_error_data; -void insert_mip_filter_odometer_scale_factor_error_data(struct mip_serializer* serializer, const mip_filter_odometer_scale_factor_error_data* self); -void extract_mip_filter_odometer_scale_factor_error_data(struct mip_serializer* serializer, mip_filter_odometer_scale_factor_error_data* self); -bool extract_mip_filter_odometer_scale_factor_error_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_odometer_scale_factor_error_data(microstrain_serializer* serializer, const mip_filter_odometer_scale_factor_error_data* self); +void extract_mip_filter_odometer_scale_factor_error_data(microstrain_serializer* serializer, mip_filter_odometer_scale_factor_error_data* self); +bool extract_mip_filter_odometer_scale_factor_error_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_odometer_scale_factor_error_uncertainty (0x82,0x48) Odometer Scale Factor Error Uncertainty [C] +///@defgroup filter_odometer_scale_factor_error_uncertainty_c (0x82,0x48) Odometer Scale Factor Error Uncertainty /// Filter reported odometer scale factor error uncertainty. /// ///@{ @@ -1386,26 +1462,40 @@ struct mip_filter_odometer_scale_factor_error_uncertainty_data { float scale_factor_error_uncertainty; ///< [dimensionless] uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_odometer_scale_factor_error_uncertainty_data mip_filter_odometer_scale_factor_error_uncertainty_data; -void insert_mip_filter_odometer_scale_factor_error_uncertainty_data(struct mip_serializer* serializer, const mip_filter_odometer_scale_factor_error_uncertainty_data* self); -void extract_mip_filter_odometer_scale_factor_error_uncertainty_data(struct mip_serializer* serializer, mip_filter_odometer_scale_factor_error_uncertainty_data* self); -bool extract_mip_filter_odometer_scale_factor_error_uncertainty_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_odometer_scale_factor_error_uncertainty_data(microstrain_serializer* serializer, const mip_filter_odometer_scale_factor_error_uncertainty_data* self); +void extract_mip_filter_odometer_scale_factor_error_uncertainty_data(microstrain_serializer* serializer, mip_filter_odometer_scale_factor_error_uncertainty_data* self); +bool extract_mip_filter_odometer_scale_factor_error_uncertainty_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_gnss_dual_antenna_status (0x82,0x49) Gnss Dual Antenna Status [C] +///@defgroup filter_gnss_dual_antenna_status_c (0x82,0x49) Gnss Dual Antenna Status /// Summary information for status of GNSS dual antenna heading estimate. /// ///@{ -typedef uint8_t mip_filter_gnss_dual_antenna_status_data_fix_type; -static const mip_filter_gnss_dual_antenna_status_data_fix_type MIP_FILTER_GNSS_DUAL_ANTENNA_STATUS_DATA_FIX_TYPE_FIX_NONE = 0; ///< -static const mip_filter_gnss_dual_antenna_status_data_fix_type MIP_FILTER_GNSS_DUAL_ANTENNA_STATUS_DATA_FIX_TYPE_FIX_DA_FLOAT = 1; ///< -static const mip_filter_gnss_dual_antenna_status_data_fix_type MIP_FILTER_GNSS_DUAL_ANTENNA_STATUS_DATA_FIX_TYPE_FIX_DA_FIXED = 2; ///< +enum mip_filter_gnss_dual_antenna_status_data_fix_type +{ + MIP_FILTER_GNSS_DUAL_ANTENNA_STATUS_DATA_FIX_TYPE_FIX_NONE = 0, ///< + MIP_FILTER_GNSS_DUAL_ANTENNA_STATUS_DATA_FIX_TYPE_FIX_DA_FLOAT = 1, ///< + MIP_FILTER_GNSS_DUAL_ANTENNA_STATUS_DATA_FIX_TYPE_FIX_DA_FIXED = 2, ///< +}; +typedef enum mip_filter_gnss_dual_antenna_status_data_fix_type mip_filter_gnss_dual_antenna_status_data_fix_type; + +static inline void insert_mip_filter_gnss_dual_antenna_status_data_fix_type(microstrain_serializer* serializer, const mip_filter_gnss_dual_antenna_status_data_fix_type self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_filter_gnss_dual_antenna_status_data_fix_type(microstrain_serializer* serializer, mip_filter_gnss_dual_antenna_status_data_fix_type* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} typedef uint16_t mip_filter_gnss_dual_antenna_status_data_dual_antenna_status_flags; static const mip_filter_gnss_dual_antenna_status_data_dual_antenna_status_flags MIP_FILTER_GNSS_DUAL_ANTENNA_STATUS_DATA_DUAL_ANTENNA_STATUS_FLAGS_NONE = 0x0000; @@ -1413,6 +1503,17 @@ static const mip_filter_gnss_dual_antenna_status_data_dual_antenna_status_flags static const mip_filter_gnss_dual_antenna_status_data_dual_antenna_status_flags MIP_FILTER_GNSS_DUAL_ANTENNA_STATUS_DATA_DUAL_ANTENNA_STATUS_FLAGS_RCV_2_DATA_VALID = 0x0002; ///< static const mip_filter_gnss_dual_antenna_status_data_dual_antenna_status_flags MIP_FILTER_GNSS_DUAL_ANTENNA_STATUS_DATA_DUAL_ANTENNA_STATUS_FLAGS_ANTENNA_OFFSETS_VALID = 0x0004; ///< static const mip_filter_gnss_dual_antenna_status_data_dual_antenna_status_flags MIP_FILTER_GNSS_DUAL_ANTENNA_STATUS_DATA_DUAL_ANTENNA_STATUS_FLAGS_ALL = 0x0007; +static inline void insert_mip_filter_gnss_dual_antenna_status_data_dual_antenna_status_flags(microstrain_serializer* serializer, const mip_filter_gnss_dual_antenna_status_data_dual_antenna_status_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_filter_gnss_dual_antenna_status_data_dual_antenna_status_flags(microstrain_serializer* serializer, mip_filter_gnss_dual_antenna_status_data_dual_antenna_status_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_filter_gnss_dual_antenna_status_data { @@ -1422,24 +1523,18 @@ struct mip_filter_gnss_dual_antenna_status_data mip_filter_gnss_dual_antenna_status_data_fix_type fix_type; ///< Fix type indicator mip_filter_gnss_dual_antenna_status_data_dual_antenna_status_flags status_flags; uint16_t valid_flags; ///< 0 - invalid, 1 - valid - }; typedef struct mip_filter_gnss_dual_antenna_status_data mip_filter_gnss_dual_antenna_status_data; -void insert_mip_filter_gnss_dual_antenna_status_data(struct mip_serializer* serializer, const mip_filter_gnss_dual_antenna_status_data* self); -void extract_mip_filter_gnss_dual_antenna_status_data(struct mip_serializer* serializer, mip_filter_gnss_dual_antenna_status_data* self); -bool extract_mip_filter_gnss_dual_antenna_status_data_from_field(const struct mip_field* field, void* ptr); - -void insert_mip_filter_gnss_dual_antenna_status_data_fix_type(struct mip_serializer* serializer, const mip_filter_gnss_dual_antenna_status_data_fix_type self); -void extract_mip_filter_gnss_dual_antenna_status_data_fix_type(struct mip_serializer* serializer, mip_filter_gnss_dual_antenna_status_data_fix_type* self); -void insert_mip_filter_gnss_dual_antenna_status_data_dual_antenna_status_flags(struct mip_serializer* serializer, const mip_filter_gnss_dual_antenna_status_data_dual_antenna_status_flags self); -void extract_mip_filter_gnss_dual_antenna_status_data_dual_antenna_status_flags(struct mip_serializer* serializer, mip_filter_gnss_dual_antenna_status_data_dual_antenna_status_flags* self); +void insert_mip_filter_gnss_dual_antenna_status_data(microstrain_serializer* serializer, const mip_filter_gnss_dual_antenna_status_data* self); +void extract_mip_filter_gnss_dual_antenna_status_data(microstrain_serializer* serializer, mip_filter_gnss_dual_antenna_status_data* self); +bool extract_mip_filter_gnss_dual_antenna_status_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_aiding_frame_config_error (0x82,0x50) Aiding Frame Config Error [C] +///@defgroup filter_aiding_frame_config_error_c (0x82,0x50) Aiding Frame Config Error /// Filter reported aiding source frame configuration error /// /// These estimates are used to compensate for small errors to the user-supplied aiding frame configurations (set with (0x13, 0x01) command ). @@ -1451,18 +1546,18 @@ struct mip_filter_aiding_frame_config_error_data uint8_t frame_id; ///< Frame ID for the receiver to which the antenna is attached mip_vector3f translation; ///< Translation config X, Y, and Z (m). mip_quatf attitude; ///< Attitude quaternion - }; typedef struct mip_filter_aiding_frame_config_error_data mip_filter_aiding_frame_config_error_data; -void insert_mip_filter_aiding_frame_config_error_data(struct mip_serializer* serializer, const mip_filter_aiding_frame_config_error_data* self); -void extract_mip_filter_aiding_frame_config_error_data(struct mip_serializer* serializer, mip_filter_aiding_frame_config_error_data* self); -bool extract_mip_filter_aiding_frame_config_error_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_aiding_frame_config_error_data(microstrain_serializer* serializer, const mip_filter_aiding_frame_config_error_data* self); +void extract_mip_filter_aiding_frame_config_error_data(microstrain_serializer* serializer, mip_filter_aiding_frame_config_error_data* self); +bool extract_mip_filter_aiding_frame_config_error_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_filter_aiding_frame_config_error_uncertainty (0x82,0x51) Aiding Frame Config Error Uncertainty [C] +///@defgroup filter_aiding_frame_config_error_uncertainty_c (0x82,0x51) Aiding Frame Config Error Uncertainty /// Filter reported aiding source frame configuration error uncertainty /// /// These estimates are used to compensate for small errors to the user-supplied aiding frame configurations (set with (0x13, 0x01) command ). @@ -1474,12 +1569,12 @@ struct mip_filter_aiding_frame_config_error_uncertainty_data uint8_t frame_id; ///< Frame ID for the receiver to which the antenna is attached mip_vector3f translation_unc; ///< Translation uncertaint X, Y, and Z (m). mip_vector3f attitude_unc; ///< Attitude uncertainty, X, Y, and Z (radians). - }; typedef struct mip_filter_aiding_frame_config_error_uncertainty_data mip_filter_aiding_frame_config_error_uncertainty_data; -void insert_mip_filter_aiding_frame_config_error_uncertainty_data(struct mip_serializer* serializer, const mip_filter_aiding_frame_config_error_uncertainty_data* self); -void extract_mip_filter_aiding_frame_config_error_uncertainty_data(struct mip_serializer* serializer, mip_filter_aiding_frame_config_error_uncertainty_data* self); -bool extract_mip_filter_aiding_frame_config_error_uncertainty_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_filter_aiding_frame_config_error_uncertainty_data(microstrain_serializer* serializer, const mip_filter_aiding_frame_config_error_uncertainty_data* self); +void extract_mip_filter_aiding_frame_config_error_uncertainty_data(microstrain_serializer* serializer, mip_filter_aiding_frame_config_error_uncertainty_data* self); +bool extract_mip_filter_aiding_frame_config_error_uncertainty_data_from_field(const mip_field_view* field, void* ptr); ///@} @@ -1490,8 +1585,8 @@ bool extract_mip_filter_aiding_frame_config_error_uncertainty_data_from_field(co /// //////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus +} // extern "C" } // namespace C } // namespace mip -} // extern "C" #endif // __cplusplus diff --git a/src/c/mip/definitions/data_gnss.c b/src/c/mip/definitions/data_gnss.c new file mode 100644 index 000000000..34950b55b --- /dev/null +++ b/src/c/mip/definitions/data_gnss.c @@ -0,0 +1,1452 @@ + +#include "data_gnss.h" + +#include +#include + +#include + + +#ifdef __cplusplus +namespace mip { +namespace C { +extern "C" { + +#endif // __cplusplus + + +//////////////////////////////////////////////////////////////////////////////// +// Mip Fields +//////////////////////////////////////////////////////////////////////////////// + +void insert_mip_gnss_pos_llh_data(microstrain_serializer* serializer, const mip_gnss_pos_llh_data* self) +{ + microstrain_insert_double(serializer, self->latitude); + + microstrain_insert_double(serializer, self->longitude); + + microstrain_insert_double(serializer, self->ellipsoid_height); + + microstrain_insert_double(serializer, self->msl_height); + + microstrain_insert_float(serializer, self->horizontal_accuracy); + + microstrain_insert_float(serializer, self->vertical_accuracy); + + insert_mip_gnss_pos_llh_data_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_gnss_pos_llh_data(microstrain_serializer* serializer, mip_gnss_pos_llh_data* self) +{ + microstrain_extract_double(serializer, &self->latitude); + + microstrain_extract_double(serializer, &self->longitude); + + microstrain_extract_double(serializer, &self->ellipsoid_height); + + microstrain_extract_double(serializer, &self->msl_height); + + microstrain_extract_float(serializer, &self->horizontal_accuracy); + + microstrain_extract_float(serializer, &self->vertical_accuracy); + + extract_mip_gnss_pos_llh_data_valid_flags(serializer, &self->valid_flags); + +} +bool extract_mip_gnss_pos_llh_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_gnss_pos_llh_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_gnss_pos_llh_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_gnss_pos_ecef_data(microstrain_serializer* serializer, const mip_gnss_pos_ecef_data* self) +{ + insert_mip_vector3d(serializer, self->x); + + microstrain_insert_float(serializer, self->x_accuracy); + + insert_mip_gnss_pos_ecef_data_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_gnss_pos_ecef_data(microstrain_serializer* serializer, mip_gnss_pos_ecef_data* self) +{ + extract_mip_vector3d(serializer, self->x); + + microstrain_extract_float(serializer, &self->x_accuracy); + + extract_mip_gnss_pos_ecef_data_valid_flags(serializer, &self->valid_flags); + +} +bool extract_mip_gnss_pos_ecef_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_gnss_pos_ecef_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_gnss_pos_ecef_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_gnss_vel_ned_data(microstrain_serializer* serializer, const mip_gnss_vel_ned_data* self) +{ + insert_mip_vector3f(serializer, self->v); + + microstrain_insert_float(serializer, self->speed); + + microstrain_insert_float(serializer, self->ground_speed); + + microstrain_insert_float(serializer, self->heading); + + microstrain_insert_float(serializer, self->speed_accuracy); + + microstrain_insert_float(serializer, self->heading_accuracy); + + insert_mip_gnss_vel_ned_data_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_gnss_vel_ned_data(microstrain_serializer* serializer, mip_gnss_vel_ned_data* self) +{ + extract_mip_vector3f(serializer, self->v); + + microstrain_extract_float(serializer, &self->speed); + + microstrain_extract_float(serializer, &self->ground_speed); + + microstrain_extract_float(serializer, &self->heading); + + microstrain_extract_float(serializer, &self->speed_accuracy); + + microstrain_extract_float(serializer, &self->heading_accuracy); + + extract_mip_gnss_vel_ned_data_valid_flags(serializer, &self->valid_flags); + +} +bool extract_mip_gnss_vel_ned_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_gnss_vel_ned_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_gnss_vel_ned_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_gnss_vel_ecef_data(microstrain_serializer* serializer, const mip_gnss_vel_ecef_data* self) +{ + insert_mip_vector3f(serializer, self->v); + + microstrain_insert_float(serializer, self->v_accuracy); + + insert_mip_gnss_vel_ecef_data_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_gnss_vel_ecef_data(microstrain_serializer* serializer, mip_gnss_vel_ecef_data* self) +{ + extract_mip_vector3f(serializer, self->v); + + microstrain_extract_float(serializer, &self->v_accuracy); + + extract_mip_gnss_vel_ecef_data_valid_flags(serializer, &self->valid_flags); + +} +bool extract_mip_gnss_vel_ecef_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_gnss_vel_ecef_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_gnss_vel_ecef_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_gnss_dop_data(microstrain_serializer* serializer, const mip_gnss_dop_data* self) +{ + microstrain_insert_float(serializer, self->gdop); + + microstrain_insert_float(serializer, self->pdop); + + microstrain_insert_float(serializer, self->hdop); + + microstrain_insert_float(serializer, self->vdop); + + microstrain_insert_float(serializer, self->tdop); + + microstrain_insert_float(serializer, self->ndop); + + microstrain_insert_float(serializer, self->edop); + + insert_mip_gnss_dop_data_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_gnss_dop_data(microstrain_serializer* serializer, mip_gnss_dop_data* self) +{ + microstrain_extract_float(serializer, &self->gdop); + + microstrain_extract_float(serializer, &self->pdop); + + microstrain_extract_float(serializer, &self->hdop); + + microstrain_extract_float(serializer, &self->vdop); + + microstrain_extract_float(serializer, &self->tdop); + + microstrain_extract_float(serializer, &self->ndop); + + microstrain_extract_float(serializer, &self->edop); + + extract_mip_gnss_dop_data_valid_flags(serializer, &self->valid_flags); + +} +bool extract_mip_gnss_dop_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_gnss_dop_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_gnss_dop_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_gnss_utc_time_data(microstrain_serializer* serializer, const mip_gnss_utc_time_data* self) +{ + microstrain_insert_u16(serializer, self->year); + + microstrain_insert_u8(serializer, self->month); + + microstrain_insert_u8(serializer, self->day); + + microstrain_insert_u8(serializer, self->hour); + + microstrain_insert_u8(serializer, self->min); + + microstrain_insert_u8(serializer, self->sec); + + microstrain_insert_u32(serializer, self->msec); + + insert_mip_gnss_utc_time_data_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_gnss_utc_time_data(microstrain_serializer* serializer, mip_gnss_utc_time_data* self) +{ + microstrain_extract_u16(serializer, &self->year); + + microstrain_extract_u8(serializer, &self->month); + + microstrain_extract_u8(serializer, &self->day); + + microstrain_extract_u8(serializer, &self->hour); + + microstrain_extract_u8(serializer, &self->min); + + microstrain_extract_u8(serializer, &self->sec); + + microstrain_extract_u32(serializer, &self->msec); + + extract_mip_gnss_utc_time_data_valid_flags(serializer, &self->valid_flags); + +} +bool extract_mip_gnss_utc_time_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_gnss_utc_time_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_gnss_utc_time_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_gnss_gps_time_data(microstrain_serializer* serializer, const mip_gnss_gps_time_data* self) +{ + microstrain_insert_double(serializer, self->tow); + + microstrain_insert_u16(serializer, self->week_number); + + insert_mip_gnss_gps_time_data_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_gnss_gps_time_data(microstrain_serializer* serializer, mip_gnss_gps_time_data* self) +{ + microstrain_extract_double(serializer, &self->tow); + + microstrain_extract_u16(serializer, &self->week_number); + + extract_mip_gnss_gps_time_data_valid_flags(serializer, &self->valid_flags); + +} +bool extract_mip_gnss_gps_time_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_gnss_gps_time_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_gnss_gps_time_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_gnss_clock_info_data(microstrain_serializer* serializer, const mip_gnss_clock_info_data* self) +{ + microstrain_insert_double(serializer, self->bias); + + microstrain_insert_double(serializer, self->drift); + + microstrain_insert_double(serializer, self->accuracy_estimate); + + insert_mip_gnss_clock_info_data_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_gnss_clock_info_data(microstrain_serializer* serializer, mip_gnss_clock_info_data* self) +{ + microstrain_extract_double(serializer, &self->bias); + + microstrain_extract_double(serializer, &self->drift); + + microstrain_extract_double(serializer, &self->accuracy_estimate); + + extract_mip_gnss_clock_info_data_valid_flags(serializer, &self->valid_flags); + +} +bool extract_mip_gnss_clock_info_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_gnss_clock_info_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_gnss_clock_info_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_gnss_fix_info_data(microstrain_serializer* serializer, const mip_gnss_fix_info_data* self) +{ + insert_mip_gnss_fix_info_data_fix_type(serializer, self->fix_type); + + microstrain_insert_u8(serializer, self->num_sv); + + insert_mip_gnss_fix_info_data_fix_flags(serializer, self->fix_flags); + + insert_mip_gnss_fix_info_data_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_gnss_fix_info_data(microstrain_serializer* serializer, mip_gnss_fix_info_data* self) +{ + extract_mip_gnss_fix_info_data_fix_type(serializer, &self->fix_type); + + microstrain_extract_u8(serializer, &self->num_sv); + + extract_mip_gnss_fix_info_data_fix_flags(serializer, &self->fix_flags); + + extract_mip_gnss_fix_info_data_valid_flags(serializer, &self->valid_flags); + +} +bool extract_mip_gnss_fix_info_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_gnss_fix_info_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_gnss_fix_info_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_gnss_sv_info_data(microstrain_serializer* serializer, const mip_gnss_sv_info_data* self) +{ + microstrain_insert_u8(serializer, self->channel); + + microstrain_insert_u8(serializer, self->sv_id); + + microstrain_insert_u16(serializer, self->carrier_noise_ratio); + + microstrain_insert_s16(serializer, self->azimuth); + + microstrain_insert_s16(serializer, self->elevation); + + insert_mip_gnss_sv_info_data_svflags(serializer, self->sv_flags); + + insert_mip_gnss_sv_info_data_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_gnss_sv_info_data(microstrain_serializer* serializer, mip_gnss_sv_info_data* self) +{ + microstrain_extract_u8(serializer, &self->channel); + + microstrain_extract_u8(serializer, &self->sv_id); + + microstrain_extract_u16(serializer, &self->carrier_noise_ratio); + + microstrain_extract_s16(serializer, &self->azimuth); + + microstrain_extract_s16(serializer, &self->elevation); + + extract_mip_gnss_sv_info_data_svflags(serializer, &self->sv_flags); + + extract_mip_gnss_sv_info_data_valid_flags(serializer, &self->valid_flags); + +} +bool extract_mip_gnss_sv_info_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_gnss_sv_info_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_gnss_sv_info_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_gnss_hw_status_data(microstrain_serializer* serializer, const mip_gnss_hw_status_data* self) +{ + insert_mip_gnss_hw_status_data_receiver_state(serializer, self->receiver_state); + + insert_mip_gnss_hw_status_data_antenna_state(serializer, self->antenna_state); + + insert_mip_gnss_hw_status_data_antenna_power(serializer, self->antenna_power); + + insert_mip_gnss_hw_status_data_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_gnss_hw_status_data(microstrain_serializer* serializer, mip_gnss_hw_status_data* self) +{ + extract_mip_gnss_hw_status_data_receiver_state(serializer, &self->receiver_state); + + extract_mip_gnss_hw_status_data_antenna_state(serializer, &self->antenna_state); + + extract_mip_gnss_hw_status_data_antenna_power(serializer, &self->antenna_power); + + extract_mip_gnss_hw_status_data_valid_flags(serializer, &self->valid_flags); + +} +bool extract_mip_gnss_hw_status_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_gnss_hw_status_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_gnss_hw_status_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_gnss_dgps_info_data(microstrain_serializer* serializer, const mip_gnss_dgps_info_data* self) +{ + microstrain_insert_u8(serializer, self->sv_id); + + microstrain_insert_float(serializer, self->age); + + microstrain_insert_float(serializer, self->range_correction); + + microstrain_insert_float(serializer, self->range_rate_correction); + + insert_mip_gnss_dgps_info_data_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_gnss_dgps_info_data(microstrain_serializer* serializer, mip_gnss_dgps_info_data* self) +{ + microstrain_extract_u8(serializer, &self->sv_id); + + microstrain_extract_float(serializer, &self->age); + + microstrain_extract_float(serializer, &self->range_correction); + + microstrain_extract_float(serializer, &self->range_rate_correction); + + extract_mip_gnss_dgps_info_data_valid_flags(serializer, &self->valid_flags); + +} +bool extract_mip_gnss_dgps_info_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_gnss_dgps_info_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_gnss_dgps_info_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_gnss_dgps_channel_data(microstrain_serializer* serializer, const mip_gnss_dgps_channel_data* self) +{ + microstrain_insert_u8(serializer, self->sv_id); + + microstrain_insert_float(serializer, self->age); + + microstrain_insert_float(serializer, self->range_correction); + + microstrain_insert_float(serializer, self->range_rate_correction); + + insert_mip_gnss_dgps_channel_data_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_gnss_dgps_channel_data(microstrain_serializer* serializer, mip_gnss_dgps_channel_data* self) +{ + microstrain_extract_u8(serializer, &self->sv_id); + + microstrain_extract_float(serializer, &self->age); + + microstrain_extract_float(serializer, &self->range_correction); + + microstrain_extract_float(serializer, &self->range_rate_correction); + + extract_mip_gnss_dgps_channel_data_valid_flags(serializer, &self->valid_flags); + +} +bool extract_mip_gnss_dgps_channel_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_gnss_dgps_channel_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_gnss_dgps_channel_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_gnss_clock_info_2_data(microstrain_serializer* serializer, const mip_gnss_clock_info_2_data* self) +{ + microstrain_insert_double(serializer, self->bias); + + microstrain_insert_double(serializer, self->drift); + + microstrain_insert_double(serializer, self->bias_accuracy_estimate); + + microstrain_insert_double(serializer, self->drift_accuracy_estimate); + + insert_mip_gnss_clock_info_2_data_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_gnss_clock_info_2_data(microstrain_serializer* serializer, mip_gnss_clock_info_2_data* self) +{ + microstrain_extract_double(serializer, &self->bias); + + microstrain_extract_double(serializer, &self->drift); + + microstrain_extract_double(serializer, &self->bias_accuracy_estimate); + + microstrain_extract_double(serializer, &self->drift_accuracy_estimate); + + extract_mip_gnss_clock_info_2_data_valid_flags(serializer, &self->valid_flags); + +} +bool extract_mip_gnss_clock_info_2_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_gnss_clock_info_2_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_gnss_clock_info_2_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_gnss_gps_leap_seconds_data(microstrain_serializer* serializer, const mip_gnss_gps_leap_seconds_data* self) +{ + microstrain_insert_u8(serializer, self->leap_seconds); + + insert_mip_gnss_gps_leap_seconds_data_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_gnss_gps_leap_seconds_data(microstrain_serializer* serializer, mip_gnss_gps_leap_seconds_data* self) +{ + microstrain_extract_u8(serializer, &self->leap_seconds); + + extract_mip_gnss_gps_leap_seconds_data_valid_flags(serializer, &self->valid_flags); + +} +bool extract_mip_gnss_gps_leap_seconds_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_gnss_gps_leap_seconds_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_gnss_gps_leap_seconds_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_gnss_sbas_info_data(microstrain_serializer* serializer, const mip_gnss_sbas_info_data* self) +{ + microstrain_insert_double(serializer, self->time_of_week); + + microstrain_insert_u16(serializer, self->week_number); + + insert_mip_sbas_system(serializer, self->sbas_system); + + microstrain_insert_u8(serializer, self->sbas_id); + + microstrain_insert_u8(serializer, self->count); + + insert_mip_gnss_sbas_info_data_sbas_status(serializer, self->sbas_status); + + insert_mip_gnss_sbas_info_data_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_gnss_sbas_info_data(microstrain_serializer* serializer, mip_gnss_sbas_info_data* self) +{ + microstrain_extract_double(serializer, &self->time_of_week); + + microstrain_extract_u16(serializer, &self->week_number); + + extract_mip_sbas_system(serializer, &self->sbas_system); + + microstrain_extract_u8(serializer, &self->sbas_id); + + microstrain_extract_u8(serializer, &self->count); + + extract_mip_gnss_sbas_info_data_sbas_status(serializer, &self->sbas_status); + + extract_mip_gnss_sbas_info_data_valid_flags(serializer, &self->valid_flags); + +} +bool extract_mip_gnss_sbas_info_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_gnss_sbas_info_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_gnss_sbas_info_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_gnss_sbas_correction_data(microstrain_serializer* serializer, const mip_gnss_sbas_correction_data* self) +{ + microstrain_insert_u8(serializer, self->index); + + microstrain_insert_u8(serializer, self->count); + + microstrain_insert_double(serializer, self->time_of_week); + + microstrain_insert_u16(serializer, self->week_number); + + insert_mip_gnss_constellation_id(serializer, self->gnss_id); + + microstrain_insert_u8(serializer, self->sv_id); + + microstrain_insert_u8(serializer, self->udrei); + + microstrain_insert_float(serializer, self->pseudorange_correction); + + microstrain_insert_float(serializer, self->iono_correction); + + insert_mip_gnss_sbas_correction_data_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_gnss_sbas_correction_data(microstrain_serializer* serializer, mip_gnss_sbas_correction_data* self) +{ + microstrain_extract_u8(serializer, &self->index); + + microstrain_extract_u8(serializer, &self->count); + + microstrain_extract_double(serializer, &self->time_of_week); + + microstrain_extract_u16(serializer, &self->week_number); + + extract_mip_gnss_constellation_id(serializer, &self->gnss_id); + + microstrain_extract_u8(serializer, &self->sv_id); + + microstrain_extract_u8(serializer, &self->udrei); + + microstrain_extract_float(serializer, &self->pseudorange_correction); + + microstrain_extract_float(serializer, &self->iono_correction); + + extract_mip_gnss_sbas_correction_data_valid_flags(serializer, &self->valid_flags); + +} +bool extract_mip_gnss_sbas_correction_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_gnss_sbas_correction_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_gnss_sbas_correction_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_gnss_rf_error_detection_data(microstrain_serializer* serializer, const mip_gnss_rf_error_detection_data* self) +{ + insert_mip_gnss_rf_error_detection_data_rfband(serializer, self->rf_band); + + insert_mip_gnss_rf_error_detection_data_jamming_state(serializer, self->jamming_state); + + insert_mip_gnss_rf_error_detection_data_spoofing_state(serializer, self->spoofing_state); + + for(unsigned int i=0; i < 4; i++) + microstrain_insert_u8(serializer, self->reserved[i]); + + insert_mip_gnss_rf_error_detection_data_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_gnss_rf_error_detection_data(microstrain_serializer* serializer, mip_gnss_rf_error_detection_data* self) +{ + extract_mip_gnss_rf_error_detection_data_rfband(serializer, &self->rf_band); + + extract_mip_gnss_rf_error_detection_data_jamming_state(serializer, &self->jamming_state); + + extract_mip_gnss_rf_error_detection_data_spoofing_state(serializer, &self->spoofing_state); + + for(unsigned int i=0; i < 4; i++) + microstrain_extract_u8(serializer, &self->reserved[i]); + + extract_mip_gnss_rf_error_detection_data_valid_flags(serializer, &self->valid_flags); + +} +bool extract_mip_gnss_rf_error_detection_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_gnss_rf_error_detection_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_gnss_rf_error_detection_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_gnss_base_station_info_data(microstrain_serializer* serializer, const mip_gnss_base_station_info_data* self) +{ + microstrain_insert_double(serializer, self->time_of_week); + + microstrain_insert_u16(serializer, self->week_number); + + insert_mip_vector3d(serializer, self->ecef_pos); + + microstrain_insert_float(serializer, self->height); + + microstrain_insert_u16(serializer, self->station_id); + + insert_mip_gnss_base_station_info_data_indicator_flags(serializer, self->indicators); + + insert_mip_gnss_base_station_info_data_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_gnss_base_station_info_data(microstrain_serializer* serializer, mip_gnss_base_station_info_data* self) +{ + microstrain_extract_double(serializer, &self->time_of_week); + + microstrain_extract_u16(serializer, &self->week_number); + + extract_mip_vector3d(serializer, self->ecef_pos); + + microstrain_extract_float(serializer, &self->height); + + microstrain_extract_u16(serializer, &self->station_id); + + extract_mip_gnss_base_station_info_data_indicator_flags(serializer, &self->indicators); + + extract_mip_gnss_base_station_info_data_valid_flags(serializer, &self->valid_flags); + +} +bool extract_mip_gnss_base_station_info_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_gnss_base_station_info_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_gnss_base_station_info_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_gnss_rtk_corrections_status_data(microstrain_serializer* serializer, const mip_gnss_rtk_corrections_status_data* self) +{ + microstrain_insert_double(serializer, self->time_of_week); + + microstrain_insert_u16(serializer, self->week_number); + + insert_mip_gnss_rtk_corrections_status_data_epoch_status(serializer, self->epoch_status); + + microstrain_insert_u32(serializer, self->dongle_status); + + microstrain_insert_float(serializer, self->gps_correction_latency); + + microstrain_insert_float(serializer, self->glonass_correction_latency); + + microstrain_insert_float(serializer, self->galileo_correction_latency); + + microstrain_insert_float(serializer, self->beidou_correction_latency); + + for(unsigned int i=0; i < 4; i++) + microstrain_insert_u32(serializer, self->reserved[i]); + + insert_mip_gnss_rtk_corrections_status_data_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_gnss_rtk_corrections_status_data(microstrain_serializer* serializer, mip_gnss_rtk_corrections_status_data* self) +{ + microstrain_extract_double(serializer, &self->time_of_week); + + microstrain_extract_u16(serializer, &self->week_number); + + extract_mip_gnss_rtk_corrections_status_data_epoch_status(serializer, &self->epoch_status); + + microstrain_extract_u32(serializer, &self->dongle_status); + + microstrain_extract_float(serializer, &self->gps_correction_latency); + + microstrain_extract_float(serializer, &self->glonass_correction_latency); + + microstrain_extract_float(serializer, &self->galileo_correction_latency); + + microstrain_extract_float(serializer, &self->beidou_correction_latency); + + for(unsigned int i=0; i < 4; i++) + microstrain_extract_u32(serializer, &self->reserved[i]); + + extract_mip_gnss_rtk_corrections_status_data_valid_flags(serializer, &self->valid_flags); + +} +bool extract_mip_gnss_rtk_corrections_status_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_gnss_rtk_corrections_status_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_gnss_rtk_corrections_status_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_gnss_satellite_status_data(microstrain_serializer* serializer, const mip_gnss_satellite_status_data* self) +{ + microstrain_insert_u8(serializer, self->index); + + microstrain_insert_u8(serializer, self->count); + + microstrain_insert_double(serializer, self->time_of_week); + + microstrain_insert_u16(serializer, self->week_number); + + insert_mip_gnss_constellation_id(serializer, self->gnss_id); + + microstrain_insert_u8(serializer, self->satellite_id); + + microstrain_insert_float(serializer, self->elevation); + + microstrain_insert_float(serializer, self->azimuth); + + microstrain_insert_bool(serializer, self->health); + + insert_mip_gnss_satellite_status_data_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_gnss_satellite_status_data(microstrain_serializer* serializer, mip_gnss_satellite_status_data* self) +{ + microstrain_extract_u8(serializer, &self->index); + + microstrain_extract_u8(serializer, &self->count); + + microstrain_extract_double(serializer, &self->time_of_week); + + microstrain_extract_u16(serializer, &self->week_number); + + extract_mip_gnss_constellation_id(serializer, &self->gnss_id); + + microstrain_extract_u8(serializer, &self->satellite_id); + + microstrain_extract_float(serializer, &self->elevation); + + microstrain_extract_float(serializer, &self->azimuth); + + microstrain_extract_bool(serializer, &self->health); + + extract_mip_gnss_satellite_status_data_valid_flags(serializer, &self->valid_flags); + +} +bool extract_mip_gnss_satellite_status_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_gnss_satellite_status_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_gnss_satellite_status_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_gnss_raw_data(microstrain_serializer* serializer, const mip_gnss_raw_data* self) +{ + microstrain_insert_u8(serializer, self->index); + + microstrain_insert_u8(serializer, self->count); + + microstrain_insert_double(serializer, self->time_of_week); + + microstrain_insert_u16(serializer, self->week_number); + + microstrain_insert_u16(serializer, self->receiver_id); + + microstrain_insert_u8(serializer, self->tracking_channel); + + insert_mip_gnss_constellation_id(serializer, self->gnss_id); + + microstrain_insert_u8(serializer, self->satellite_id); + + insert_mip_gnss_signal_id(serializer, self->signal_id); + + microstrain_insert_float(serializer, self->signal_strength); + + insert_mip_gnss_raw_data_gnss_signal_quality(serializer, self->quality); + + microstrain_insert_double(serializer, self->pseudorange); + + microstrain_insert_double(serializer, self->carrier_phase); + + microstrain_insert_float(serializer, self->doppler); + + microstrain_insert_float(serializer, self->range_uncert); + + microstrain_insert_float(serializer, self->phase_uncert); + + microstrain_insert_float(serializer, self->doppler_uncert); + + microstrain_insert_float(serializer, self->lock_time); + + insert_mip_gnss_raw_data_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_gnss_raw_data(microstrain_serializer* serializer, mip_gnss_raw_data* self) +{ + microstrain_extract_u8(serializer, &self->index); + + microstrain_extract_u8(serializer, &self->count); + + microstrain_extract_double(serializer, &self->time_of_week); + + microstrain_extract_u16(serializer, &self->week_number); + + microstrain_extract_u16(serializer, &self->receiver_id); + + microstrain_extract_u8(serializer, &self->tracking_channel); + + extract_mip_gnss_constellation_id(serializer, &self->gnss_id); + + microstrain_extract_u8(serializer, &self->satellite_id); + + extract_mip_gnss_signal_id(serializer, &self->signal_id); + + microstrain_extract_float(serializer, &self->signal_strength); + + extract_mip_gnss_raw_data_gnss_signal_quality(serializer, &self->quality); + + microstrain_extract_double(serializer, &self->pseudorange); + + microstrain_extract_double(serializer, &self->carrier_phase); + + microstrain_extract_float(serializer, &self->doppler); + + microstrain_extract_float(serializer, &self->range_uncert); + + microstrain_extract_float(serializer, &self->phase_uncert); + + microstrain_extract_float(serializer, &self->doppler_uncert); + + microstrain_extract_float(serializer, &self->lock_time); + + extract_mip_gnss_raw_data_valid_flags(serializer, &self->valid_flags); + +} +bool extract_mip_gnss_raw_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_gnss_raw_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_gnss_raw_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_gnss_gps_ephemeris_data(microstrain_serializer* serializer, const mip_gnss_gps_ephemeris_data* self) +{ + microstrain_insert_u8(serializer, self->index); + + microstrain_insert_u8(serializer, self->count); + + microstrain_insert_double(serializer, self->time_of_week); + + microstrain_insert_u16(serializer, self->week_number); + + microstrain_insert_u8(serializer, self->satellite_id); + + microstrain_insert_u8(serializer, self->health); + + microstrain_insert_u8(serializer, self->iodc); + + microstrain_insert_u8(serializer, self->iode); + + microstrain_insert_double(serializer, self->t_oc); + + microstrain_insert_double(serializer, self->af0); + + microstrain_insert_double(serializer, self->af1); + + microstrain_insert_double(serializer, self->af2); + + microstrain_insert_double(serializer, self->t_gd); + + microstrain_insert_double(serializer, self->ISC_L1CA); + + microstrain_insert_double(serializer, self->ISC_L2C); + + microstrain_insert_double(serializer, self->t_oe); + + microstrain_insert_double(serializer, self->a); + + microstrain_insert_double(serializer, self->a_dot); + + microstrain_insert_double(serializer, self->mean_anomaly); + + microstrain_insert_double(serializer, self->delta_mean_motion); + + microstrain_insert_double(serializer, self->delta_mean_motion_dot); + + microstrain_insert_double(serializer, self->eccentricity); + + microstrain_insert_double(serializer, self->argument_of_perigee); + + microstrain_insert_double(serializer, self->omega); + + microstrain_insert_double(serializer, self->omega_dot); + + microstrain_insert_double(serializer, self->inclination); + + microstrain_insert_double(serializer, self->inclination_dot); + + microstrain_insert_double(serializer, self->c_ic); + + microstrain_insert_double(serializer, self->c_is); + + microstrain_insert_double(serializer, self->c_uc); + + microstrain_insert_double(serializer, self->c_us); + + microstrain_insert_double(serializer, self->c_rc); + + microstrain_insert_double(serializer, self->c_rs); + + insert_mip_gnss_gps_ephemeris_data_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_gnss_gps_ephemeris_data(microstrain_serializer* serializer, mip_gnss_gps_ephemeris_data* self) +{ + microstrain_extract_u8(serializer, &self->index); + + microstrain_extract_u8(serializer, &self->count); + + microstrain_extract_double(serializer, &self->time_of_week); + + microstrain_extract_u16(serializer, &self->week_number); + + microstrain_extract_u8(serializer, &self->satellite_id); + + microstrain_extract_u8(serializer, &self->health); + + microstrain_extract_u8(serializer, &self->iodc); + + microstrain_extract_u8(serializer, &self->iode); + + microstrain_extract_double(serializer, &self->t_oc); + + microstrain_extract_double(serializer, &self->af0); + + microstrain_extract_double(serializer, &self->af1); + + microstrain_extract_double(serializer, &self->af2); + + microstrain_extract_double(serializer, &self->t_gd); + + microstrain_extract_double(serializer, &self->ISC_L1CA); + + microstrain_extract_double(serializer, &self->ISC_L2C); + + microstrain_extract_double(serializer, &self->t_oe); + + microstrain_extract_double(serializer, &self->a); + + microstrain_extract_double(serializer, &self->a_dot); + + microstrain_extract_double(serializer, &self->mean_anomaly); + + microstrain_extract_double(serializer, &self->delta_mean_motion); + + microstrain_extract_double(serializer, &self->delta_mean_motion_dot); + + microstrain_extract_double(serializer, &self->eccentricity); + + microstrain_extract_double(serializer, &self->argument_of_perigee); + + microstrain_extract_double(serializer, &self->omega); + + microstrain_extract_double(serializer, &self->omega_dot); + + microstrain_extract_double(serializer, &self->inclination); + + microstrain_extract_double(serializer, &self->inclination_dot); + + microstrain_extract_double(serializer, &self->c_ic); + + microstrain_extract_double(serializer, &self->c_is); + + microstrain_extract_double(serializer, &self->c_uc); + + microstrain_extract_double(serializer, &self->c_us); + + microstrain_extract_double(serializer, &self->c_rc); + + microstrain_extract_double(serializer, &self->c_rs); + + extract_mip_gnss_gps_ephemeris_data_valid_flags(serializer, &self->valid_flags); + +} +bool extract_mip_gnss_gps_ephemeris_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_gnss_gps_ephemeris_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_gnss_gps_ephemeris_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_gnss_galileo_ephemeris_data(microstrain_serializer* serializer, const mip_gnss_galileo_ephemeris_data* self) +{ + microstrain_insert_u8(serializer, self->index); + + microstrain_insert_u8(serializer, self->count); + + microstrain_insert_double(serializer, self->time_of_week); + + microstrain_insert_u16(serializer, self->week_number); + + microstrain_insert_u8(serializer, self->satellite_id); + + microstrain_insert_u8(serializer, self->health); + + microstrain_insert_u8(serializer, self->iodc); + + microstrain_insert_u8(serializer, self->iode); + + microstrain_insert_double(serializer, self->t_oc); + + microstrain_insert_double(serializer, self->af0); + + microstrain_insert_double(serializer, self->af1); + + microstrain_insert_double(serializer, self->af2); + + microstrain_insert_double(serializer, self->t_gd); + + microstrain_insert_double(serializer, self->ISC_L1CA); + + microstrain_insert_double(serializer, self->ISC_L2C); + + microstrain_insert_double(serializer, self->t_oe); + + microstrain_insert_double(serializer, self->a); + + microstrain_insert_double(serializer, self->a_dot); + + microstrain_insert_double(serializer, self->mean_anomaly); + + microstrain_insert_double(serializer, self->delta_mean_motion); + + microstrain_insert_double(serializer, self->delta_mean_motion_dot); + + microstrain_insert_double(serializer, self->eccentricity); + + microstrain_insert_double(serializer, self->argument_of_perigee); + + microstrain_insert_double(serializer, self->omega); + + microstrain_insert_double(serializer, self->omega_dot); + + microstrain_insert_double(serializer, self->inclination); + + microstrain_insert_double(serializer, self->inclination_dot); + + microstrain_insert_double(serializer, self->c_ic); + + microstrain_insert_double(serializer, self->c_is); + + microstrain_insert_double(serializer, self->c_uc); + + microstrain_insert_double(serializer, self->c_us); + + microstrain_insert_double(serializer, self->c_rc); + + microstrain_insert_double(serializer, self->c_rs); + + insert_mip_gnss_galileo_ephemeris_data_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_gnss_galileo_ephemeris_data(microstrain_serializer* serializer, mip_gnss_galileo_ephemeris_data* self) +{ + microstrain_extract_u8(serializer, &self->index); + + microstrain_extract_u8(serializer, &self->count); + + microstrain_extract_double(serializer, &self->time_of_week); + + microstrain_extract_u16(serializer, &self->week_number); + + microstrain_extract_u8(serializer, &self->satellite_id); + + microstrain_extract_u8(serializer, &self->health); + + microstrain_extract_u8(serializer, &self->iodc); + + microstrain_extract_u8(serializer, &self->iode); + + microstrain_extract_double(serializer, &self->t_oc); + + microstrain_extract_double(serializer, &self->af0); + + microstrain_extract_double(serializer, &self->af1); + + microstrain_extract_double(serializer, &self->af2); + + microstrain_extract_double(serializer, &self->t_gd); + + microstrain_extract_double(serializer, &self->ISC_L1CA); + + microstrain_extract_double(serializer, &self->ISC_L2C); + + microstrain_extract_double(serializer, &self->t_oe); + + microstrain_extract_double(serializer, &self->a); + + microstrain_extract_double(serializer, &self->a_dot); + + microstrain_extract_double(serializer, &self->mean_anomaly); + + microstrain_extract_double(serializer, &self->delta_mean_motion); + + microstrain_extract_double(serializer, &self->delta_mean_motion_dot); + + microstrain_extract_double(serializer, &self->eccentricity); + + microstrain_extract_double(serializer, &self->argument_of_perigee); + + microstrain_extract_double(serializer, &self->omega); + + microstrain_extract_double(serializer, &self->omega_dot); + + microstrain_extract_double(serializer, &self->inclination); + + microstrain_extract_double(serializer, &self->inclination_dot); + + microstrain_extract_double(serializer, &self->c_ic); + + microstrain_extract_double(serializer, &self->c_is); + + microstrain_extract_double(serializer, &self->c_uc); + + microstrain_extract_double(serializer, &self->c_us); + + microstrain_extract_double(serializer, &self->c_rc); + + microstrain_extract_double(serializer, &self->c_rs); + + extract_mip_gnss_galileo_ephemeris_data_valid_flags(serializer, &self->valid_flags); + +} +bool extract_mip_gnss_galileo_ephemeris_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_gnss_galileo_ephemeris_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_gnss_galileo_ephemeris_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_gnss_glo_ephemeris_data(microstrain_serializer* serializer, const mip_gnss_glo_ephemeris_data* self) +{ + microstrain_insert_u8(serializer, self->index); + + microstrain_insert_u8(serializer, self->count); + + microstrain_insert_double(serializer, self->time_of_week); + + microstrain_insert_u16(serializer, self->week_number); + + microstrain_insert_u8(serializer, self->satellite_id); + + microstrain_insert_s8(serializer, self->freq_number); + + microstrain_insert_u32(serializer, self->tk); + + microstrain_insert_u32(serializer, self->tb); + + microstrain_insert_u8(serializer, self->sat_type); + + microstrain_insert_double(serializer, self->gamma); + + microstrain_insert_double(serializer, self->tau_n); + + insert_mip_vector3d(serializer, self->x); + + insert_mip_vector3f(serializer, self->v); + + insert_mip_vector3f(serializer, self->a); + + microstrain_insert_u8(serializer, self->health); + + microstrain_insert_u8(serializer, self->P); + + microstrain_insert_u8(serializer, self->NT); + + microstrain_insert_float(serializer, self->delta_tau_n); + + microstrain_insert_u8(serializer, self->Ft); + + microstrain_insert_u8(serializer, self->En); + + microstrain_insert_u8(serializer, self->P1); + + microstrain_insert_u8(serializer, self->P2); + + microstrain_insert_u8(serializer, self->P3); + + microstrain_insert_u8(serializer, self->P4); + + insert_mip_gnss_glo_ephemeris_data_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_gnss_glo_ephemeris_data(microstrain_serializer* serializer, mip_gnss_glo_ephemeris_data* self) +{ + microstrain_extract_u8(serializer, &self->index); + + microstrain_extract_u8(serializer, &self->count); + + microstrain_extract_double(serializer, &self->time_of_week); + + microstrain_extract_u16(serializer, &self->week_number); + + microstrain_extract_u8(serializer, &self->satellite_id); + + microstrain_extract_s8(serializer, &self->freq_number); + + microstrain_extract_u32(serializer, &self->tk); + + microstrain_extract_u32(serializer, &self->tb); + + microstrain_extract_u8(serializer, &self->sat_type); + + microstrain_extract_double(serializer, &self->gamma); + + microstrain_extract_double(serializer, &self->tau_n); + + extract_mip_vector3d(serializer, self->x); + + extract_mip_vector3f(serializer, self->v); + + extract_mip_vector3f(serializer, self->a); + + microstrain_extract_u8(serializer, &self->health); + + microstrain_extract_u8(serializer, &self->P); + + microstrain_extract_u8(serializer, &self->NT); + + microstrain_extract_float(serializer, &self->delta_tau_n); + + microstrain_extract_u8(serializer, &self->Ft); + + microstrain_extract_u8(serializer, &self->En); + + microstrain_extract_u8(serializer, &self->P1); + + microstrain_extract_u8(serializer, &self->P2); + + microstrain_extract_u8(serializer, &self->P3); + + microstrain_extract_u8(serializer, &self->P4); + + extract_mip_gnss_glo_ephemeris_data_valid_flags(serializer, &self->valid_flags); + +} +bool extract_mip_gnss_glo_ephemeris_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_gnss_glo_ephemeris_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_gnss_glo_ephemeris_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_gnss_gps_iono_corr_data(microstrain_serializer* serializer, const mip_gnss_gps_iono_corr_data* self) +{ + microstrain_insert_double(serializer, self->time_of_week); + + microstrain_insert_u16(serializer, self->week_number); + + for(unsigned int i=0; i < 4; i++) + microstrain_insert_double(serializer, self->alpha[i]); + + for(unsigned int i=0; i < 4; i++) + microstrain_insert_double(serializer, self->beta[i]); + + insert_mip_gnss_gps_iono_corr_data_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_gnss_gps_iono_corr_data(microstrain_serializer* serializer, mip_gnss_gps_iono_corr_data* self) +{ + microstrain_extract_double(serializer, &self->time_of_week); + + microstrain_extract_u16(serializer, &self->week_number); + + for(unsigned int i=0; i < 4; i++) + microstrain_extract_double(serializer, &self->alpha[i]); + + for(unsigned int i=0; i < 4; i++) + microstrain_extract_double(serializer, &self->beta[i]); + + extract_mip_gnss_gps_iono_corr_data_valid_flags(serializer, &self->valid_flags); + +} +bool extract_mip_gnss_gps_iono_corr_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_gnss_gps_iono_corr_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_gnss_gps_iono_corr_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_gnss_galileo_iono_corr_data(microstrain_serializer* serializer, const mip_gnss_galileo_iono_corr_data* self) +{ + microstrain_insert_double(serializer, self->time_of_week); + + microstrain_insert_u16(serializer, self->week_number); + + insert_mip_vector3d(serializer, self->alpha); + + microstrain_insert_u8(serializer, self->disturbance_flags); + + insert_mip_gnss_galileo_iono_corr_data_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_gnss_galileo_iono_corr_data(microstrain_serializer* serializer, mip_gnss_galileo_iono_corr_data* self) +{ + microstrain_extract_double(serializer, &self->time_of_week); + + microstrain_extract_u16(serializer, &self->week_number); + + extract_mip_vector3d(serializer, self->alpha); + + microstrain_extract_u8(serializer, &self->disturbance_flags); + + extract_mip_gnss_galileo_iono_corr_data_valid_flags(serializer, &self->valid_flags); + +} +bool extract_mip_gnss_galileo_iono_corr_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_gnss_galileo_iono_corr_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_gnss_galileo_iono_corr_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + + +#ifdef __cplusplus +} // extern "C" +} // namespace C +} // namespace mip +#endif // __cplusplus + diff --git a/src/mip/definitions/data_gnss.h b/src/c/mip/definitions/data_gnss.h similarity index 59% rename from src/mip/definitions/data_gnss.h rename to src/c/mip/definitions/data_gnss.h index c2bb9a258..5dbe74ee6 100644 --- a/src/mip/definitions/data_gnss.h +++ b/src/c/mip/definitions/data_gnss.h @@ -1,8 +1,9 @@ #pragma once -#include "common.h" -#include "descriptors.h" -#include "../mip_result.h" +#include +#include +#include +#include #include #include @@ -14,14 +15,11 @@ namespace C { extern "C" { #endif // __cplusplus -struct mip_interface; -struct mip_serializer; -struct mip_field; //////////////////////////////////////////////////////////////////////////////// -///@addtogroup MipData_c MIP Data [C] +///@addtogroup MipData_c ///@{ -///@defgroup gnss_data_c Gnss Data [C] +///@defgroup gnss_data_c Gnss Data /// ///@{ @@ -60,7 +58,6 @@ enum MIP_DATA_DESC_GNSS_GLONASS_EPHEMERIS = 0x62, MIP_DATA_DESC_GNSS_GALILEO_EPHEMERIS = 0x63, MIP_DATA_DESC_GNSS_GPS_IONO_CORR = 0x71, - MIP_DATA_DESC_GNSS_GLONASS_IONO_CORR = 0x72, MIP_DATA_DESC_GNSS_GALILEO_IONO_CORR = 0x73, }; @@ -74,96 +71,130 @@ enum { MIP_GNSS2_DATA_DESC_SET = 0x92 }; enum { MIP_GNSS3_DATA_DESC_SET = 0x93 }; enum { MIP_GNSS4_DATA_DESC_SET = 0x94 }; enum { MIP_GNSS5_DATA_DESC_SET = 0x95 }; -typedef uint8_t mip_gnss_constellation_id; -static const mip_gnss_constellation_id MIP_GNSS_CONSTELLATION_ID_UNKNOWN = 0; ///< -static const mip_gnss_constellation_id MIP_GNSS_CONSTELLATION_ID_GPS = 1; ///< -static const mip_gnss_constellation_id MIP_GNSS_CONSTELLATION_ID_GLONASS = 2; ///< -static const mip_gnss_constellation_id MIP_GNSS_CONSTELLATION_ID_GALILEO = 3; ///< -static const mip_gnss_constellation_id MIP_GNSS_CONSTELLATION_ID_BEIDOU = 4; ///< -static const mip_gnss_constellation_id MIP_GNSS_CONSTELLATION_ID_SBAS = 5; ///< - -void insert_mip_gnss_constellation_id(struct mip_serializer* serializer, const mip_gnss_constellation_id self); -void extract_mip_gnss_constellation_id(struct mip_serializer* serializer, mip_gnss_constellation_id* self); - -typedef uint8_t mip_gnss_signal_id; -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_UNKNOWN = 0; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GPS_L1CA = 1; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GPS_L1P = 2; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GPS_L1Z = 3; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GPS_L2CA = 4; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GPS_L2P = 5; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GPS_L2Z = 6; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GPS_L2CL = 7; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GPS_L2CM = 8; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GPS_L2CML = 9; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GPS_L5I = 10; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GPS_L5Q = 11; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GPS_L5IQ = 12; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GPS_L1CD = 13; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GPS_L1CP = 14; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GPS_L1CDP = 15; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GLONASS_G1CA = 32; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GLONASS_G1P = 33; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GLONASS_G2C = 34; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GLONASS_G2P = 35; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GALILEO_E1C = 64; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GALILEO_E1A = 65; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GALILEO_E1B = 66; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GALILEO_E1BC = 67; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GALILEO_E1ABC = 68; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GALILEO_E6C = 69; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GALILEO_E6A = 70; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GALILEO_E6B = 71; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GALILEO_E6BC = 72; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GALILEO_E6ABC = 73; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GALILEO_E5BI = 74; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GALILEO_E5BQ = 75; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GALILEO_E5BIQ = 76; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GALILEO_E5ABI = 77; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GALILEO_E5ABQ = 78; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GALILEO_E5ABIQ = 79; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GALILEO_E5AI = 80; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GALILEO_E5AQ = 81; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_GALILEO_E5AIQ = 82; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_SBAS_L1CA = 96; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_SBAS_L5I = 97; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_SBAS_L5Q = 98; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_SBAS_L5IQ = 99; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_QZSS_L1CA = 128; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_QZSS_LEXS = 129; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_QZSS_LEXL = 130; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_QZSS_LEXSL = 131; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_QZSS_L2CM = 132; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_QZSS_L2CL = 133; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_QZSS_L2CML = 134; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_QZSS_L5I = 135; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_QZSS_L5Q = 136; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_QZSS_L5IQ = 137; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_QZSS_L1CD = 138; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_QZSS_L1CP = 139; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_QZSS_L1CDP = 140; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_BEIDOU_B1I = 160; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_BEIDOU_B1Q = 161; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_BEIDOU_B1IQ = 162; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_BEIDOU_B3I = 163; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_BEIDOU_B3Q = 164; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_BEIDOU_B3IQ = 165; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_BEIDOU_B2I = 166; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_BEIDOU_B2Q = 167; ///< -static const mip_gnss_signal_id MIP_GNSS_SIGNAL_ID_BEIDOU_B2IQ = 168; ///< - -void insert_mip_gnss_signal_id(struct mip_serializer* serializer, const mip_gnss_signal_id self); -void extract_mip_gnss_signal_id(struct mip_serializer* serializer, mip_gnss_signal_id* self); - -typedef uint8_t mip_sbas_system; -static const mip_sbas_system MIP_SBAS_SYSTEM_UNKNOWN = 0; ///< -static const mip_sbas_system MIP_SBAS_SYSTEM_WAAS = 1; ///< -static const mip_sbas_system MIP_SBAS_SYSTEM_EGNOS = 2; ///< -static const mip_sbas_system MIP_SBAS_SYSTEM_MSAS = 3; ///< -static const mip_sbas_system MIP_SBAS_SYSTEM_GAGAN = 4; ///< - -void insert_mip_sbas_system(struct mip_serializer* serializer, const mip_sbas_system self); -void extract_mip_sbas_system(struct mip_serializer* serializer, mip_sbas_system* self); +enum mip_gnss_constellation_id +{ + MIP_GNSS_CONSTELLATION_ID_UNKNOWN = 0, ///< + MIP_GNSS_CONSTELLATION_ID_GPS = 1, ///< + MIP_GNSS_CONSTELLATION_ID_GLONASS = 2, ///< + MIP_GNSS_CONSTELLATION_ID_GALILEO = 3, ///< + MIP_GNSS_CONSTELLATION_ID_BEIDOU = 4, ///< + MIP_GNSS_CONSTELLATION_ID_SBAS = 5, ///< +}; +typedef enum mip_gnss_constellation_id mip_gnss_constellation_id; + +static inline void insert_mip_gnss_constellation_id(microstrain_serializer* serializer, const mip_gnss_constellation_id self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_gnss_constellation_id(microstrain_serializer* serializer, mip_gnss_constellation_id* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} + +enum mip_gnss_signal_id +{ + MIP_GNSS_SIGNAL_ID_UNKNOWN = 0, ///< + MIP_GNSS_SIGNAL_ID_GPS_L1CA = 1, ///< + MIP_GNSS_SIGNAL_ID_GPS_L1P = 2, ///< + MIP_GNSS_SIGNAL_ID_GPS_L1Z = 3, ///< + MIP_GNSS_SIGNAL_ID_GPS_L2CA = 4, ///< + MIP_GNSS_SIGNAL_ID_GPS_L2P = 5, ///< + MIP_GNSS_SIGNAL_ID_GPS_L2Z = 6, ///< + MIP_GNSS_SIGNAL_ID_GPS_L2CL = 7, ///< + MIP_GNSS_SIGNAL_ID_GPS_L2CM = 8, ///< + MIP_GNSS_SIGNAL_ID_GPS_L2CML = 9, ///< + MIP_GNSS_SIGNAL_ID_GPS_L5I = 10, ///< + MIP_GNSS_SIGNAL_ID_GPS_L5Q = 11, ///< + MIP_GNSS_SIGNAL_ID_GPS_L5IQ = 12, ///< + MIP_GNSS_SIGNAL_ID_GPS_L1CD = 13, ///< + MIP_GNSS_SIGNAL_ID_GPS_L1CP = 14, ///< + MIP_GNSS_SIGNAL_ID_GPS_L1CDP = 15, ///< + MIP_GNSS_SIGNAL_ID_GLONASS_G1CA = 32, ///< + MIP_GNSS_SIGNAL_ID_GLONASS_G1P = 33, ///< + MIP_GNSS_SIGNAL_ID_GLONASS_G2C = 34, ///< + MIP_GNSS_SIGNAL_ID_GLONASS_G2P = 35, ///< + MIP_GNSS_SIGNAL_ID_GALILEO_E1C = 64, ///< + MIP_GNSS_SIGNAL_ID_GALILEO_E1A = 65, ///< + MIP_GNSS_SIGNAL_ID_GALILEO_E1B = 66, ///< + MIP_GNSS_SIGNAL_ID_GALILEO_E1BC = 67, ///< + MIP_GNSS_SIGNAL_ID_GALILEO_E1ABC = 68, ///< + MIP_GNSS_SIGNAL_ID_GALILEO_E6C = 69, ///< + MIP_GNSS_SIGNAL_ID_GALILEO_E6A = 70, ///< + MIP_GNSS_SIGNAL_ID_GALILEO_E6B = 71, ///< + MIP_GNSS_SIGNAL_ID_GALILEO_E6BC = 72, ///< + MIP_GNSS_SIGNAL_ID_GALILEO_E6ABC = 73, ///< + MIP_GNSS_SIGNAL_ID_GALILEO_E5BI = 74, ///< + MIP_GNSS_SIGNAL_ID_GALILEO_E5BQ = 75, ///< + MIP_GNSS_SIGNAL_ID_GALILEO_E5BIQ = 76, ///< + MIP_GNSS_SIGNAL_ID_GALILEO_E5ABI = 77, ///< + MIP_GNSS_SIGNAL_ID_GALILEO_E5ABQ = 78, ///< + MIP_GNSS_SIGNAL_ID_GALILEO_E5ABIQ = 79, ///< + MIP_GNSS_SIGNAL_ID_GALILEO_E5AI = 80, ///< + MIP_GNSS_SIGNAL_ID_GALILEO_E5AQ = 81, ///< + MIP_GNSS_SIGNAL_ID_GALILEO_E5AIQ = 82, ///< + MIP_GNSS_SIGNAL_ID_SBAS_L1CA = 96, ///< + MIP_GNSS_SIGNAL_ID_SBAS_L5I = 97, ///< + MIP_GNSS_SIGNAL_ID_SBAS_L5Q = 98, ///< + MIP_GNSS_SIGNAL_ID_SBAS_L5IQ = 99, ///< + MIP_GNSS_SIGNAL_ID_QZSS_L1CA = 128, ///< + MIP_GNSS_SIGNAL_ID_QZSS_LEXS = 129, ///< + MIP_GNSS_SIGNAL_ID_QZSS_LEXL = 130, ///< + MIP_GNSS_SIGNAL_ID_QZSS_LEXSL = 131, ///< + MIP_GNSS_SIGNAL_ID_QZSS_L2CM = 132, ///< + MIP_GNSS_SIGNAL_ID_QZSS_L2CL = 133, ///< + MIP_GNSS_SIGNAL_ID_QZSS_L2CML = 134, ///< + MIP_GNSS_SIGNAL_ID_QZSS_L5I = 135, ///< + MIP_GNSS_SIGNAL_ID_QZSS_L5Q = 136, ///< + MIP_GNSS_SIGNAL_ID_QZSS_L5IQ = 137, ///< + MIP_GNSS_SIGNAL_ID_QZSS_L1CD = 138, ///< + MIP_GNSS_SIGNAL_ID_QZSS_L1CP = 139, ///< + MIP_GNSS_SIGNAL_ID_QZSS_L1CDP = 140, ///< + MIP_GNSS_SIGNAL_ID_BEIDOU_B1I = 160, ///< + MIP_GNSS_SIGNAL_ID_BEIDOU_B1Q = 161, ///< + MIP_GNSS_SIGNAL_ID_BEIDOU_B1IQ = 162, ///< + MIP_GNSS_SIGNAL_ID_BEIDOU_B3I = 163, ///< + MIP_GNSS_SIGNAL_ID_BEIDOU_B3Q = 164, ///< + MIP_GNSS_SIGNAL_ID_BEIDOU_B3IQ = 165, ///< + MIP_GNSS_SIGNAL_ID_BEIDOU_B2I = 166, ///< + MIP_GNSS_SIGNAL_ID_BEIDOU_B2Q = 167, ///< + MIP_GNSS_SIGNAL_ID_BEIDOU_B2IQ = 168, ///< + MIP_GNSS_SIGNAL_ID_BEIDOU_B2A = 169, ///< +}; +typedef enum mip_gnss_signal_id mip_gnss_signal_id; + +static inline void insert_mip_gnss_signal_id(microstrain_serializer* serializer, const mip_gnss_signal_id self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_gnss_signal_id(microstrain_serializer* serializer, mip_gnss_signal_id* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} + +enum mip_sbas_system +{ + MIP_SBAS_SYSTEM_UNKNOWN = 0, ///< + MIP_SBAS_SYSTEM_WAAS = 1, ///< + MIP_SBAS_SYSTEM_EGNOS = 2, ///< + MIP_SBAS_SYSTEM_MSAS = 3, ///< + MIP_SBAS_SYSTEM_GAGAN = 4, ///< +}; +typedef enum mip_sbas_system mip_sbas_system; + +static inline void insert_mip_sbas_system(microstrain_serializer* serializer, const mip_sbas_system self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_sbas_system(microstrain_serializer* serializer, mip_sbas_system* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} enum { MIP_GNSS_DGPS_INFO_MAX_CHANNEL_NUMBER = 32 }; enum { MIP_GNSS_SV_INFO_MAX_SV_NUMBER = 32 }; @@ -173,7 +204,7 @@ enum { MIP_GNSS_SV_INFO_MAX_SV_NUMBER = 32 }; //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_gnss_pos_llh (0x81,0x03) Pos Llh [C] +///@defgroup gnss_pos_llh_c (0x81,0x03) Pos Llh /// GNSS reported position in the WGS84 geodetic frame /// ///@{ @@ -187,6 +218,17 @@ static const mip_gnss_pos_llh_data_valid_flags MIP_GNSS_POS_LLH_DATA_VALID_FLAGS static const mip_gnss_pos_llh_data_valid_flags MIP_GNSS_POS_LLH_DATA_VALID_FLAGS_VERTICAL_ACCURACY = 0x0010; ///< static const mip_gnss_pos_llh_data_valid_flags MIP_GNSS_POS_LLH_DATA_VALID_FLAGS_FLAGS = 0x001F; ///< static const mip_gnss_pos_llh_data_valid_flags MIP_GNSS_POS_LLH_DATA_VALID_FLAGS_ALL = 0x001F; +static inline void insert_mip_gnss_pos_llh_data_valid_flags(microstrain_serializer* serializer, const mip_gnss_pos_llh_data_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_gnss_pos_llh_data_valid_flags(microstrain_serializer* serializer, mip_gnss_pos_llh_data_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_gnss_pos_llh_data { @@ -197,21 +239,18 @@ struct mip_gnss_pos_llh_data float horizontal_accuracy; ///< [meters] float vertical_accuracy; ///< [meters] mip_gnss_pos_llh_data_valid_flags valid_flags; - }; typedef struct mip_gnss_pos_llh_data mip_gnss_pos_llh_data; -void insert_mip_gnss_pos_llh_data(struct mip_serializer* serializer, const mip_gnss_pos_llh_data* self); -void extract_mip_gnss_pos_llh_data(struct mip_serializer* serializer, mip_gnss_pos_llh_data* self); -bool extract_mip_gnss_pos_llh_data_from_field(const struct mip_field* field, void* ptr); -void insert_mip_gnss_pos_llh_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_pos_llh_data_valid_flags self); -void extract_mip_gnss_pos_llh_data_valid_flags(struct mip_serializer* serializer, mip_gnss_pos_llh_data_valid_flags* self); +void insert_mip_gnss_pos_llh_data(microstrain_serializer* serializer, const mip_gnss_pos_llh_data* self); +void extract_mip_gnss_pos_llh_data(microstrain_serializer* serializer, mip_gnss_pos_llh_data* self); +bool extract_mip_gnss_pos_llh_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_gnss_pos_ecef (0x81,0x04) Pos Ecef [C] +///@defgroup gnss_pos_ecef_c (0x81,0x04) Pos Ecef /// GNSS reported position in the Earth-centered, Earth-Fixed (ECEF) frame /// ///@{ @@ -222,27 +261,35 @@ static const mip_gnss_pos_ecef_data_valid_flags MIP_GNSS_POS_ECEF_DATA_VALID_FLA static const mip_gnss_pos_ecef_data_valid_flags MIP_GNSS_POS_ECEF_DATA_VALID_FLAGS_POSITION_ACCURACY = 0x0002; ///< static const mip_gnss_pos_ecef_data_valid_flags MIP_GNSS_POS_ECEF_DATA_VALID_FLAGS_FLAGS = 0x0003; ///< static const mip_gnss_pos_ecef_data_valid_flags MIP_GNSS_POS_ECEF_DATA_VALID_FLAGS_ALL = 0x0003; +static inline void insert_mip_gnss_pos_ecef_data_valid_flags(microstrain_serializer* serializer, const mip_gnss_pos_ecef_data_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_gnss_pos_ecef_data_valid_flags(microstrain_serializer* serializer, mip_gnss_pos_ecef_data_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_gnss_pos_ecef_data { mip_vector3d x; ///< [meters] float x_accuracy; ///< [meters] mip_gnss_pos_ecef_data_valid_flags valid_flags; - }; typedef struct mip_gnss_pos_ecef_data mip_gnss_pos_ecef_data; -void insert_mip_gnss_pos_ecef_data(struct mip_serializer* serializer, const mip_gnss_pos_ecef_data* self); -void extract_mip_gnss_pos_ecef_data(struct mip_serializer* serializer, mip_gnss_pos_ecef_data* self); -bool extract_mip_gnss_pos_ecef_data_from_field(const struct mip_field* field, void* ptr); -void insert_mip_gnss_pos_ecef_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_pos_ecef_data_valid_flags self); -void extract_mip_gnss_pos_ecef_data_valid_flags(struct mip_serializer* serializer, mip_gnss_pos_ecef_data_valid_flags* self); +void insert_mip_gnss_pos_ecef_data(microstrain_serializer* serializer, const mip_gnss_pos_ecef_data* self); +void extract_mip_gnss_pos_ecef_data(microstrain_serializer* serializer, mip_gnss_pos_ecef_data* self); +bool extract_mip_gnss_pos_ecef_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_gnss_vel_ned (0x81,0x05) Vel Ned [C] +///@defgroup gnss_vel_ned_c (0x81,0x05) Vel Ned /// GNSS reported velocity in the NED frame /// ///@{ @@ -257,6 +304,17 @@ static const mip_gnss_vel_ned_data_valid_flags MIP_GNSS_VEL_NED_DATA_VALID_FLAGS static const mip_gnss_vel_ned_data_valid_flags MIP_GNSS_VEL_NED_DATA_VALID_FLAGS_HEADING_ACCURACY = 0x0020; ///< static const mip_gnss_vel_ned_data_valid_flags MIP_GNSS_VEL_NED_DATA_VALID_FLAGS_FLAGS = 0x003F; ///< static const mip_gnss_vel_ned_data_valid_flags MIP_GNSS_VEL_NED_DATA_VALID_FLAGS_ALL = 0x003F; +static inline void insert_mip_gnss_vel_ned_data_valid_flags(microstrain_serializer* serializer, const mip_gnss_vel_ned_data_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_gnss_vel_ned_data_valid_flags(microstrain_serializer* serializer, mip_gnss_vel_ned_data_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_gnss_vel_ned_data { @@ -267,21 +325,18 @@ struct mip_gnss_vel_ned_data float speed_accuracy; ///< [meters/second] float heading_accuracy; ///< [degrees] mip_gnss_vel_ned_data_valid_flags valid_flags; - }; typedef struct mip_gnss_vel_ned_data mip_gnss_vel_ned_data; -void insert_mip_gnss_vel_ned_data(struct mip_serializer* serializer, const mip_gnss_vel_ned_data* self); -void extract_mip_gnss_vel_ned_data(struct mip_serializer* serializer, mip_gnss_vel_ned_data* self); -bool extract_mip_gnss_vel_ned_data_from_field(const struct mip_field* field, void* ptr); -void insert_mip_gnss_vel_ned_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_vel_ned_data_valid_flags self); -void extract_mip_gnss_vel_ned_data_valid_flags(struct mip_serializer* serializer, mip_gnss_vel_ned_data_valid_flags* self); +void insert_mip_gnss_vel_ned_data(microstrain_serializer* serializer, const mip_gnss_vel_ned_data* self); +void extract_mip_gnss_vel_ned_data(microstrain_serializer* serializer, mip_gnss_vel_ned_data* self); +bool extract_mip_gnss_vel_ned_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_gnss_vel_ecef (0x81,0x06) Vel Ecef [C] +///@defgroup gnss_vel_ecef_c (0x81,0x06) Vel Ecef /// GNSS reported velocity in the Earth-centered, Earth-Fixed (ECEF) frame /// ///@{ @@ -292,27 +347,35 @@ static const mip_gnss_vel_ecef_data_valid_flags MIP_GNSS_VEL_ECEF_DATA_VALID_FLA static const mip_gnss_vel_ecef_data_valid_flags MIP_GNSS_VEL_ECEF_DATA_VALID_FLAGS_VELOCITY_ACCURACY = 0x0002; ///< static const mip_gnss_vel_ecef_data_valid_flags MIP_GNSS_VEL_ECEF_DATA_VALID_FLAGS_FLAGS = 0x0003; ///< static const mip_gnss_vel_ecef_data_valid_flags MIP_GNSS_VEL_ECEF_DATA_VALID_FLAGS_ALL = 0x0003; +static inline void insert_mip_gnss_vel_ecef_data_valid_flags(microstrain_serializer* serializer, const mip_gnss_vel_ecef_data_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_gnss_vel_ecef_data_valid_flags(microstrain_serializer* serializer, mip_gnss_vel_ecef_data_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_gnss_vel_ecef_data { mip_vector3f v; ///< [meters/second] float v_accuracy; ///< [meters/second] mip_gnss_vel_ecef_data_valid_flags valid_flags; - }; typedef struct mip_gnss_vel_ecef_data mip_gnss_vel_ecef_data; -void insert_mip_gnss_vel_ecef_data(struct mip_serializer* serializer, const mip_gnss_vel_ecef_data* self); -void extract_mip_gnss_vel_ecef_data(struct mip_serializer* serializer, mip_gnss_vel_ecef_data* self); -bool extract_mip_gnss_vel_ecef_data_from_field(const struct mip_field* field, void* ptr); -void insert_mip_gnss_vel_ecef_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_vel_ecef_data_valid_flags self); -void extract_mip_gnss_vel_ecef_data_valid_flags(struct mip_serializer* serializer, mip_gnss_vel_ecef_data_valid_flags* self); +void insert_mip_gnss_vel_ecef_data(microstrain_serializer* serializer, const mip_gnss_vel_ecef_data* self); +void extract_mip_gnss_vel_ecef_data(microstrain_serializer* serializer, mip_gnss_vel_ecef_data* self); +bool extract_mip_gnss_vel_ecef_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_gnss_dop (0x81,0x07) Dop [C] +///@defgroup gnss_dop_c (0x81,0x07) Dop /// GNSS reported dilution of precision information. /// ///@{ @@ -328,6 +391,17 @@ static const mip_gnss_dop_data_valid_flags MIP_GNSS_DOP_DATA_VALID_FLAGS_NDOP = static const mip_gnss_dop_data_valid_flags MIP_GNSS_DOP_DATA_VALID_FLAGS_EDOP = 0x0040; ///< static const mip_gnss_dop_data_valid_flags MIP_GNSS_DOP_DATA_VALID_FLAGS_FLAGS = 0x007F; ///< static const mip_gnss_dop_data_valid_flags MIP_GNSS_DOP_DATA_VALID_FLAGS_ALL = 0x007F; +static inline void insert_mip_gnss_dop_data_valid_flags(microstrain_serializer* serializer, const mip_gnss_dop_data_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_gnss_dop_data_valid_flags(microstrain_serializer* serializer, mip_gnss_dop_data_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_gnss_dop_data { @@ -339,21 +413,18 @@ struct mip_gnss_dop_data float ndop; ///< Northing DOP float edop; ///< Easting DOP mip_gnss_dop_data_valid_flags valid_flags; - }; typedef struct mip_gnss_dop_data mip_gnss_dop_data; -void insert_mip_gnss_dop_data(struct mip_serializer* serializer, const mip_gnss_dop_data* self); -void extract_mip_gnss_dop_data(struct mip_serializer* serializer, mip_gnss_dop_data* self); -bool extract_mip_gnss_dop_data_from_field(const struct mip_field* field, void* ptr); -void insert_mip_gnss_dop_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_dop_data_valid_flags self); -void extract_mip_gnss_dop_data_valid_flags(struct mip_serializer* serializer, mip_gnss_dop_data_valid_flags* self); +void insert_mip_gnss_dop_data(microstrain_serializer* serializer, const mip_gnss_dop_data* self); +void extract_mip_gnss_dop_data(microstrain_serializer* serializer, mip_gnss_dop_data* self); +bool extract_mip_gnss_dop_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_gnss_utc_time (0x81,0x08) Utc Time [C] +///@defgroup gnss_utc_time_c (0x81,0x08) Utc Time /// GNSS reported Coordinated Universal Time /// ///@{ @@ -364,6 +435,17 @@ static const mip_gnss_utc_time_data_valid_flags MIP_GNSS_UTC_TIME_DATA_VALID_FLA static const mip_gnss_utc_time_data_valid_flags MIP_GNSS_UTC_TIME_DATA_VALID_FLAGS_LEAP_SECONDS_KNOWN = 0x0002; ///< static const mip_gnss_utc_time_data_valid_flags MIP_GNSS_UTC_TIME_DATA_VALID_FLAGS_FLAGS = 0x0003; ///< static const mip_gnss_utc_time_data_valid_flags MIP_GNSS_UTC_TIME_DATA_VALID_FLAGS_ALL = 0x0003; +static inline void insert_mip_gnss_utc_time_data_valid_flags(microstrain_serializer* serializer, const mip_gnss_utc_time_data_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_gnss_utc_time_data_valid_flags(microstrain_serializer* serializer, mip_gnss_utc_time_data_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_gnss_utc_time_data { @@ -375,21 +457,18 @@ struct mip_gnss_utc_time_data uint8_t sec; ///< Second (0-59) uint32_t msec; ///< Millisecond(0-999) mip_gnss_utc_time_data_valid_flags valid_flags; - }; typedef struct mip_gnss_utc_time_data mip_gnss_utc_time_data; -void insert_mip_gnss_utc_time_data(struct mip_serializer* serializer, const mip_gnss_utc_time_data* self); -void extract_mip_gnss_utc_time_data(struct mip_serializer* serializer, mip_gnss_utc_time_data* self); -bool extract_mip_gnss_utc_time_data_from_field(const struct mip_field* field, void* ptr); -void insert_mip_gnss_utc_time_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_utc_time_data_valid_flags self); -void extract_mip_gnss_utc_time_data_valid_flags(struct mip_serializer* serializer, mip_gnss_utc_time_data_valid_flags* self); +void insert_mip_gnss_utc_time_data(microstrain_serializer* serializer, const mip_gnss_utc_time_data* self); +void extract_mip_gnss_utc_time_data(microstrain_serializer* serializer, mip_gnss_utc_time_data* self); +bool extract_mip_gnss_utc_time_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_gnss_gps_time (0x81,0x09) Gps Time [C] +///@defgroup gnss_gps_time_c (0x81,0x09) Gps Time /// GNSS reported GPS Time /// ///@{ @@ -400,27 +479,35 @@ static const mip_gnss_gps_time_data_valid_flags MIP_GNSS_GPS_TIME_DATA_VALID_FLA static const mip_gnss_gps_time_data_valid_flags MIP_GNSS_GPS_TIME_DATA_VALID_FLAGS_WEEK_NUMBER = 0x0002; ///< static const mip_gnss_gps_time_data_valid_flags MIP_GNSS_GPS_TIME_DATA_VALID_FLAGS_FLAGS = 0x0003; ///< static const mip_gnss_gps_time_data_valid_flags MIP_GNSS_GPS_TIME_DATA_VALID_FLAGS_ALL = 0x0003; +static inline void insert_mip_gnss_gps_time_data_valid_flags(microstrain_serializer* serializer, const mip_gnss_gps_time_data_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_gnss_gps_time_data_valid_flags(microstrain_serializer* serializer, mip_gnss_gps_time_data_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_gnss_gps_time_data { double tow; ///< GPS Time of week [seconds] uint16_t week_number; ///< GPS Week since 1980 [weeks] mip_gnss_gps_time_data_valid_flags valid_flags; - }; typedef struct mip_gnss_gps_time_data mip_gnss_gps_time_data; -void insert_mip_gnss_gps_time_data(struct mip_serializer* serializer, const mip_gnss_gps_time_data* self); -void extract_mip_gnss_gps_time_data(struct mip_serializer* serializer, mip_gnss_gps_time_data* self); -bool extract_mip_gnss_gps_time_data_from_field(const struct mip_field* field, void* ptr); -void insert_mip_gnss_gps_time_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_gps_time_data_valid_flags self); -void extract_mip_gnss_gps_time_data_valid_flags(struct mip_serializer* serializer, mip_gnss_gps_time_data_valid_flags* self); +void insert_mip_gnss_gps_time_data(microstrain_serializer* serializer, const mip_gnss_gps_time_data* self); +void extract_mip_gnss_gps_time_data(microstrain_serializer* serializer, mip_gnss_gps_time_data* self); +bool extract_mip_gnss_gps_time_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_gnss_clock_info (0x81,0x0A) Clock Info [C] +///@defgroup gnss_clock_info_c (0x81,0x0A) Clock Info /// GNSS reported receiver clock parameters /// ///@{ @@ -432,6 +519,17 @@ static const mip_gnss_clock_info_data_valid_flags MIP_GNSS_CLOCK_INFO_DATA_VALID static const mip_gnss_clock_info_data_valid_flags MIP_GNSS_CLOCK_INFO_DATA_VALID_FLAGS_ACCURACY_ESTIMATE = 0x0004; ///< static const mip_gnss_clock_info_data_valid_flags MIP_GNSS_CLOCK_INFO_DATA_VALID_FLAGS_FLAGS = 0x0007; ///< static const mip_gnss_clock_info_data_valid_flags MIP_GNSS_CLOCK_INFO_DATA_VALID_FLAGS_ALL = 0x0007; +static inline void insert_mip_gnss_clock_info_data_valid_flags(microstrain_serializer* serializer, const mip_gnss_clock_info_data_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_gnss_clock_info_data_valid_flags(microstrain_serializer* serializer, mip_gnss_clock_info_data_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_gnss_clock_info_data { @@ -439,40 +537,61 @@ struct mip_gnss_clock_info_data double drift; ///< [seconds/second] double accuracy_estimate; ///< [seconds] mip_gnss_clock_info_data_valid_flags valid_flags; - }; typedef struct mip_gnss_clock_info_data mip_gnss_clock_info_data; -void insert_mip_gnss_clock_info_data(struct mip_serializer* serializer, const mip_gnss_clock_info_data* self); -void extract_mip_gnss_clock_info_data(struct mip_serializer* serializer, mip_gnss_clock_info_data* self); -bool extract_mip_gnss_clock_info_data_from_field(const struct mip_field* field, void* ptr); -void insert_mip_gnss_clock_info_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_clock_info_data_valid_flags self); -void extract_mip_gnss_clock_info_data_valid_flags(struct mip_serializer* serializer, mip_gnss_clock_info_data_valid_flags* self); +void insert_mip_gnss_clock_info_data(microstrain_serializer* serializer, const mip_gnss_clock_info_data* self); +void extract_mip_gnss_clock_info_data(microstrain_serializer* serializer, mip_gnss_clock_info_data* self); +bool extract_mip_gnss_clock_info_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_gnss_fix_info (0x81,0x0B) Fix Info [C] +///@defgroup gnss_fix_info_c (0x81,0x0B) Fix Info /// GNSS reported position fix type /// ///@{ -typedef uint8_t mip_gnss_fix_info_data_fix_type; -static const mip_gnss_fix_info_data_fix_type MIP_GNSS_FIX_INFO_DATA_FIX_TYPE_FIX_3D = 0; ///< -static const mip_gnss_fix_info_data_fix_type MIP_GNSS_FIX_INFO_DATA_FIX_TYPE_FIX_2D = 1; ///< -static const mip_gnss_fix_info_data_fix_type MIP_GNSS_FIX_INFO_DATA_FIX_TYPE_FIX_TIME_ONLY = 2; ///< -static const mip_gnss_fix_info_data_fix_type MIP_GNSS_FIX_INFO_DATA_FIX_TYPE_FIX_NONE = 3; ///< -static const mip_gnss_fix_info_data_fix_type MIP_GNSS_FIX_INFO_DATA_FIX_TYPE_FIX_INVALID = 4; ///< -static const mip_gnss_fix_info_data_fix_type MIP_GNSS_FIX_INFO_DATA_FIX_TYPE_FIX_RTK_FLOAT = 5; ///< -static const mip_gnss_fix_info_data_fix_type MIP_GNSS_FIX_INFO_DATA_FIX_TYPE_FIX_RTK_FIXED = 6; ///< -static const mip_gnss_fix_info_data_fix_type MIP_GNSS_FIX_INFO_DATA_FIX_TYPE_FIX_DIFFERENTIAL = 7; ///< +enum mip_gnss_fix_info_data_fix_type +{ + MIP_GNSS_FIX_INFO_DATA_FIX_TYPE_FIX_3D = 0, ///< + MIP_GNSS_FIX_INFO_DATA_FIX_TYPE_FIX_2D = 1, ///< + MIP_GNSS_FIX_INFO_DATA_FIX_TYPE_FIX_TIME_ONLY = 2, ///< + MIP_GNSS_FIX_INFO_DATA_FIX_TYPE_FIX_NONE = 3, ///< + MIP_GNSS_FIX_INFO_DATA_FIX_TYPE_FIX_INVALID = 4, ///< + MIP_GNSS_FIX_INFO_DATA_FIX_TYPE_FIX_RTK_FLOAT = 5, ///< + MIP_GNSS_FIX_INFO_DATA_FIX_TYPE_FIX_RTK_FIXED = 6, ///< + MIP_GNSS_FIX_INFO_DATA_FIX_TYPE_FIX_DIFFERENTIAL = 7, ///< +}; +typedef enum mip_gnss_fix_info_data_fix_type mip_gnss_fix_info_data_fix_type; + +static inline void insert_mip_gnss_fix_info_data_fix_type(microstrain_serializer* serializer, const mip_gnss_fix_info_data_fix_type self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_gnss_fix_info_data_fix_type(microstrain_serializer* serializer, mip_gnss_fix_info_data_fix_type* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} typedef uint16_t mip_gnss_fix_info_data_fix_flags; static const mip_gnss_fix_info_data_fix_flags MIP_GNSS_FIX_INFO_DATA_FIX_FLAGS_NONE = 0x0000; static const mip_gnss_fix_info_data_fix_flags MIP_GNSS_FIX_INFO_DATA_FIX_FLAGS_SBAS_USED = 0x0001; ///< static const mip_gnss_fix_info_data_fix_flags MIP_GNSS_FIX_INFO_DATA_FIX_FLAGS_DGNSS_USED = 0x0002; ///< static const mip_gnss_fix_info_data_fix_flags MIP_GNSS_FIX_INFO_DATA_FIX_FLAGS_ALL = 0x0003; +static inline void insert_mip_gnss_fix_info_data_fix_flags(microstrain_serializer* serializer, const mip_gnss_fix_info_data_fix_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_gnss_fix_info_data_fix_flags(microstrain_serializer* serializer, mip_gnss_fix_info_data_fix_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} typedef uint16_t mip_gnss_fix_info_data_valid_flags; static const mip_gnss_fix_info_data_valid_flags MIP_GNSS_FIX_INFO_DATA_VALID_FLAGS_NONE = 0x0000; @@ -481,6 +600,17 @@ static const mip_gnss_fix_info_data_valid_flags MIP_GNSS_FIX_INFO_DATA_VALID_FLA static const mip_gnss_fix_info_data_valid_flags MIP_GNSS_FIX_INFO_DATA_VALID_FLAGS_FIX_FLAGS = 0x0004; ///< static const mip_gnss_fix_info_data_valid_flags MIP_GNSS_FIX_INFO_DATA_VALID_FLAGS_FLAGS = 0x0007; ///< static const mip_gnss_fix_info_data_valid_flags MIP_GNSS_FIX_INFO_DATA_VALID_FLAGS_ALL = 0x0007; +static inline void insert_mip_gnss_fix_info_data_valid_flags(microstrain_serializer* serializer, const mip_gnss_fix_info_data_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_gnss_fix_info_data_valid_flags(microstrain_serializer* serializer, mip_gnss_fix_info_data_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_gnss_fix_info_data { @@ -488,27 +618,18 @@ struct mip_gnss_fix_info_data uint8_t num_sv; mip_gnss_fix_info_data_fix_flags fix_flags; mip_gnss_fix_info_data_valid_flags valid_flags; - }; typedef struct mip_gnss_fix_info_data mip_gnss_fix_info_data; -void insert_mip_gnss_fix_info_data(struct mip_serializer* serializer, const mip_gnss_fix_info_data* self); -void extract_mip_gnss_fix_info_data(struct mip_serializer* serializer, mip_gnss_fix_info_data* self); -bool extract_mip_gnss_fix_info_data_from_field(const struct mip_field* field, void* ptr); -void insert_mip_gnss_fix_info_data_fix_type(struct mip_serializer* serializer, const mip_gnss_fix_info_data_fix_type self); -void extract_mip_gnss_fix_info_data_fix_type(struct mip_serializer* serializer, mip_gnss_fix_info_data_fix_type* self); - -void insert_mip_gnss_fix_info_data_fix_flags(struct mip_serializer* serializer, const mip_gnss_fix_info_data_fix_flags self); -void extract_mip_gnss_fix_info_data_fix_flags(struct mip_serializer* serializer, mip_gnss_fix_info_data_fix_flags* self); - -void insert_mip_gnss_fix_info_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_fix_info_data_valid_flags self); -void extract_mip_gnss_fix_info_data_valid_flags(struct mip_serializer* serializer, mip_gnss_fix_info_data_valid_flags* self); +void insert_mip_gnss_fix_info_data(microstrain_serializer* serializer, const mip_gnss_fix_info_data* self); +void extract_mip_gnss_fix_info_data(microstrain_serializer* serializer, mip_gnss_fix_info_data* self); +bool extract_mip_gnss_fix_info_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_gnss_sv_info (0x81,0x0C) Sv Info [C] +///@defgroup gnss_sv_info_c (0x81,0x0C) Sv Info /// GNSS reported space vehicle information /// /// When enabled, these fields will arrive in separate MIP packets @@ -520,6 +641,16 @@ static const mip_gnss_sv_info_data_svflags MIP_GNSS_SV_INFO_DATA_SVFLAGS_NONE static const mip_gnss_sv_info_data_svflags MIP_GNSS_SV_INFO_DATA_SVFLAGS_USED_FOR_NAVIGATION = 0x0001; ///< static const mip_gnss_sv_info_data_svflags MIP_GNSS_SV_INFO_DATA_SVFLAGS_HEALTHY = 0x0002; ///< static const mip_gnss_sv_info_data_svflags MIP_GNSS_SV_INFO_DATA_SVFLAGS_ALL = 0x0003; +static inline void insert_mip_gnss_sv_info_data_svflags(microstrain_serializer* serializer, const mip_gnss_sv_info_data_svflags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_gnss_sv_info_data_svflags(microstrain_serializer* serializer, mip_gnss_sv_info_data_svflags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} typedef uint16_t mip_gnss_sv_info_data_valid_flags; static const mip_gnss_sv_info_data_valid_flags MIP_GNSS_SV_INFO_DATA_VALID_FLAGS_NONE = 0x0000; @@ -531,6 +662,17 @@ static const mip_gnss_sv_info_data_valid_flags MIP_GNSS_SV_INFO_DATA_VALID_FLAGS static const mip_gnss_sv_info_data_valid_flags MIP_GNSS_SV_INFO_DATA_VALID_FLAGS_SV_FLAGS = 0x0020; ///< static const mip_gnss_sv_info_data_valid_flags MIP_GNSS_SV_INFO_DATA_VALID_FLAGS_FLAGS = 0x003F; ///< static const mip_gnss_sv_info_data_valid_flags MIP_GNSS_SV_INFO_DATA_VALID_FLAGS_ALL = 0x003F; +static inline void insert_mip_gnss_sv_info_data_valid_flags(microstrain_serializer* serializer, const mip_gnss_sv_info_data_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_gnss_sv_info_data_valid_flags(microstrain_serializer* serializer, mip_gnss_sv_info_data_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_gnss_sv_info_data { @@ -541,44 +683,80 @@ struct mip_gnss_sv_info_data int16_t elevation; ///< [deg] mip_gnss_sv_info_data_svflags sv_flags; mip_gnss_sv_info_data_valid_flags valid_flags; - }; typedef struct mip_gnss_sv_info_data mip_gnss_sv_info_data; -void insert_mip_gnss_sv_info_data(struct mip_serializer* serializer, const mip_gnss_sv_info_data* self); -void extract_mip_gnss_sv_info_data(struct mip_serializer* serializer, mip_gnss_sv_info_data* self); -bool extract_mip_gnss_sv_info_data_from_field(const struct mip_field* field, void* ptr); - -void insert_mip_gnss_sv_info_data_svflags(struct mip_serializer* serializer, const mip_gnss_sv_info_data_svflags self); -void extract_mip_gnss_sv_info_data_svflags(struct mip_serializer* serializer, mip_gnss_sv_info_data_svflags* self); -void insert_mip_gnss_sv_info_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_sv_info_data_valid_flags self); -void extract_mip_gnss_sv_info_data_valid_flags(struct mip_serializer* serializer, mip_gnss_sv_info_data_valid_flags* self); +void insert_mip_gnss_sv_info_data(microstrain_serializer* serializer, const mip_gnss_sv_info_data* self); +void extract_mip_gnss_sv_info_data(microstrain_serializer* serializer, mip_gnss_sv_info_data* self); +bool extract_mip_gnss_sv_info_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_gnss_hw_status (0x81,0x0D) Hw Status [C] +///@defgroup gnss_hw_status_c (0x81,0x0D) Hw Status /// GNSS reported hardware status /// ///@{ -typedef uint8_t mip_gnss_hw_status_data_receiver_state; -static const mip_gnss_hw_status_data_receiver_state MIP_GNSS_HW_STATUS_DATA_RECEIVER_STATE_OFF = 0; ///< -static const mip_gnss_hw_status_data_receiver_state MIP_GNSS_HW_STATUS_DATA_RECEIVER_STATE_ON = 1; ///< -static const mip_gnss_hw_status_data_receiver_state MIP_GNSS_HW_STATUS_DATA_RECEIVER_STATE_UNKNOWN = 2; ///< +enum mip_gnss_hw_status_data_receiver_state +{ + MIP_GNSS_HW_STATUS_DATA_RECEIVER_STATE_OFF = 0, ///< + MIP_GNSS_HW_STATUS_DATA_RECEIVER_STATE_ON = 1, ///< + MIP_GNSS_HW_STATUS_DATA_RECEIVER_STATE_UNKNOWN = 2, ///< +}; +typedef enum mip_gnss_hw_status_data_receiver_state mip_gnss_hw_status_data_receiver_state; -typedef uint8_t mip_gnss_hw_status_data_antenna_state; -static const mip_gnss_hw_status_data_antenna_state MIP_GNSS_HW_STATUS_DATA_ANTENNA_STATE_INIT = 1; ///< -static const mip_gnss_hw_status_data_antenna_state MIP_GNSS_HW_STATUS_DATA_ANTENNA_STATE_SHORT = 2; ///< -static const mip_gnss_hw_status_data_antenna_state MIP_GNSS_HW_STATUS_DATA_ANTENNA_STATE_OPEN = 3; ///< -static const mip_gnss_hw_status_data_antenna_state MIP_GNSS_HW_STATUS_DATA_ANTENNA_STATE_GOOD = 4; ///< -static const mip_gnss_hw_status_data_antenna_state MIP_GNSS_HW_STATUS_DATA_ANTENNA_STATE_UNKNOWN = 5; ///< +static inline void insert_mip_gnss_hw_status_data_receiver_state(microstrain_serializer* serializer, const mip_gnss_hw_status_data_receiver_state self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_gnss_hw_status_data_receiver_state(microstrain_serializer* serializer, mip_gnss_hw_status_data_receiver_state* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} + +enum mip_gnss_hw_status_data_antenna_state +{ + MIP_GNSS_HW_STATUS_DATA_ANTENNA_STATE_INIT = 1, ///< + MIP_GNSS_HW_STATUS_DATA_ANTENNA_STATE_SHORT = 2, ///< + MIP_GNSS_HW_STATUS_DATA_ANTENNA_STATE_OPEN = 3, ///< + MIP_GNSS_HW_STATUS_DATA_ANTENNA_STATE_GOOD = 4, ///< + MIP_GNSS_HW_STATUS_DATA_ANTENNA_STATE_UNKNOWN = 5, ///< +}; +typedef enum mip_gnss_hw_status_data_antenna_state mip_gnss_hw_status_data_antenna_state; + +static inline void insert_mip_gnss_hw_status_data_antenna_state(microstrain_serializer* serializer, const mip_gnss_hw_status_data_antenna_state self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_gnss_hw_status_data_antenna_state(microstrain_serializer* serializer, mip_gnss_hw_status_data_antenna_state* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} + +enum mip_gnss_hw_status_data_antenna_power +{ + MIP_GNSS_HW_STATUS_DATA_ANTENNA_POWER_OFF = 0, ///< + MIP_GNSS_HW_STATUS_DATA_ANTENNA_POWER_ON = 1, ///< + MIP_GNSS_HW_STATUS_DATA_ANTENNA_POWER_UNKNOWN = 2, ///< +}; +typedef enum mip_gnss_hw_status_data_antenna_power mip_gnss_hw_status_data_antenna_power; -typedef uint8_t mip_gnss_hw_status_data_antenna_power; -static const mip_gnss_hw_status_data_antenna_power MIP_GNSS_HW_STATUS_DATA_ANTENNA_POWER_OFF = 0; ///< -static const mip_gnss_hw_status_data_antenna_power MIP_GNSS_HW_STATUS_DATA_ANTENNA_POWER_ON = 1; ///< -static const mip_gnss_hw_status_data_antenna_power MIP_GNSS_HW_STATUS_DATA_ANTENNA_POWER_UNKNOWN = 2; ///< +static inline void insert_mip_gnss_hw_status_data_antenna_power(microstrain_serializer* serializer, const mip_gnss_hw_status_data_antenna_power self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_gnss_hw_status_data_antenna_power(microstrain_serializer* serializer, mip_gnss_hw_status_data_antenna_power* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} typedef uint16_t mip_gnss_hw_status_data_valid_flags; static const mip_gnss_hw_status_data_valid_flags MIP_GNSS_HW_STATUS_DATA_VALID_FLAGS_NONE = 0x0000; @@ -587,6 +765,17 @@ static const mip_gnss_hw_status_data_valid_flags MIP_GNSS_HW_STATUS_DATA_VALID_F static const mip_gnss_hw_status_data_valid_flags MIP_GNSS_HW_STATUS_DATA_VALID_FLAGS_ANTENNA_POWER = 0x0004; ///< static const mip_gnss_hw_status_data_valid_flags MIP_GNSS_HW_STATUS_DATA_VALID_FLAGS_FLAGS = 0x0007; ///< static const mip_gnss_hw_status_data_valid_flags MIP_GNSS_HW_STATUS_DATA_VALID_FLAGS_ALL = 0x0007; +static inline void insert_mip_gnss_hw_status_data_valid_flags(microstrain_serializer* serializer, const mip_gnss_hw_status_data_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_gnss_hw_status_data_valid_flags(microstrain_serializer* serializer, mip_gnss_hw_status_data_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_gnss_hw_status_data { @@ -594,30 +783,18 @@ struct mip_gnss_hw_status_data mip_gnss_hw_status_data_antenna_state antenna_state; mip_gnss_hw_status_data_antenna_power antenna_power; mip_gnss_hw_status_data_valid_flags valid_flags; - }; typedef struct mip_gnss_hw_status_data mip_gnss_hw_status_data; -void insert_mip_gnss_hw_status_data(struct mip_serializer* serializer, const mip_gnss_hw_status_data* self); -void extract_mip_gnss_hw_status_data(struct mip_serializer* serializer, mip_gnss_hw_status_data* self); -bool extract_mip_gnss_hw_status_data_from_field(const struct mip_field* field, void* ptr); - -void insert_mip_gnss_hw_status_data_receiver_state(struct mip_serializer* serializer, const mip_gnss_hw_status_data_receiver_state self); -void extract_mip_gnss_hw_status_data_receiver_state(struct mip_serializer* serializer, mip_gnss_hw_status_data_receiver_state* self); - -void insert_mip_gnss_hw_status_data_antenna_state(struct mip_serializer* serializer, const mip_gnss_hw_status_data_antenna_state self); -void extract_mip_gnss_hw_status_data_antenna_state(struct mip_serializer* serializer, mip_gnss_hw_status_data_antenna_state* self); -void insert_mip_gnss_hw_status_data_antenna_power(struct mip_serializer* serializer, const mip_gnss_hw_status_data_antenna_power self); -void extract_mip_gnss_hw_status_data_antenna_power(struct mip_serializer* serializer, mip_gnss_hw_status_data_antenna_power* self); - -void insert_mip_gnss_hw_status_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_hw_status_data_valid_flags self); -void extract_mip_gnss_hw_status_data_valid_flags(struct mip_serializer* serializer, mip_gnss_hw_status_data_valid_flags* self); +void insert_mip_gnss_hw_status_data(microstrain_serializer* serializer, const mip_gnss_hw_status_data* self); +void extract_mip_gnss_hw_status_data(microstrain_serializer* serializer, mip_gnss_hw_status_data* self); +bool extract_mip_gnss_hw_status_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_gnss_dgps_info (0x81,0x0E) Dgps Info [C] +///@defgroup gnss_dgps_info_c (0x81,0x0E) Dgps Info /// GNSS reported DGNSS status /// ///
Possible Base Station Status Values:
@@ -642,6 +819,17 @@ static const mip_gnss_dgps_info_data_valid_flags MIP_GNSS_DGPS_INFO_DATA_VALID_F static const mip_gnss_dgps_info_data_valid_flags MIP_GNSS_DGPS_INFO_DATA_VALID_FLAGS_NUM_CHANNELS = 0x0008; ///< static const mip_gnss_dgps_info_data_valid_flags MIP_GNSS_DGPS_INFO_DATA_VALID_FLAGS_FLAGS = 0x000F; ///< static const mip_gnss_dgps_info_data_valid_flags MIP_GNSS_DGPS_INFO_DATA_VALID_FLAGS_ALL = 0x000F; +static inline void insert_mip_gnss_dgps_info_data_valid_flags(microstrain_serializer* serializer, const mip_gnss_dgps_info_data_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_gnss_dgps_info_data_valid_flags(microstrain_serializer* serializer, mip_gnss_dgps_info_data_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_gnss_dgps_info_data { @@ -650,21 +838,18 @@ struct mip_gnss_dgps_info_data float range_correction; float range_rate_correction; mip_gnss_dgps_info_data_valid_flags valid_flags; - }; typedef struct mip_gnss_dgps_info_data mip_gnss_dgps_info_data; -void insert_mip_gnss_dgps_info_data(struct mip_serializer* serializer, const mip_gnss_dgps_info_data* self); -void extract_mip_gnss_dgps_info_data(struct mip_serializer* serializer, mip_gnss_dgps_info_data* self); -bool extract_mip_gnss_dgps_info_data_from_field(const struct mip_field* field, void* ptr); -void insert_mip_gnss_dgps_info_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_dgps_info_data_valid_flags self); -void extract_mip_gnss_dgps_info_data_valid_flags(struct mip_serializer* serializer, mip_gnss_dgps_info_data_valid_flags* self); +void insert_mip_gnss_dgps_info_data(microstrain_serializer* serializer, const mip_gnss_dgps_info_data* self); +void extract_mip_gnss_dgps_info_data(microstrain_serializer* serializer, mip_gnss_dgps_info_data* self); +bool extract_mip_gnss_dgps_info_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_gnss_dgps_channel (0x81,0x0F) Dgps Channel [C] +///@defgroup gnss_dgps_channel_c (0x81,0x0F) Dgps Channel /// GNSS reported DGPS Channel Status status /// /// When enabled, a separate field for each active space vehicle will be sent in the packet. @@ -679,6 +864,17 @@ static const mip_gnss_dgps_channel_data_valid_flags MIP_GNSS_DGPS_CHANNEL_DATA_V static const mip_gnss_dgps_channel_data_valid_flags MIP_GNSS_DGPS_CHANNEL_DATA_VALID_FLAGS_RANGE_RATE_CORRECTION = 0x0008; ///< static const mip_gnss_dgps_channel_data_valid_flags MIP_GNSS_DGPS_CHANNEL_DATA_VALID_FLAGS_FLAGS = 0x000F; ///< static const mip_gnss_dgps_channel_data_valid_flags MIP_GNSS_DGPS_CHANNEL_DATA_VALID_FLAGS_ALL = 0x000F; +static inline void insert_mip_gnss_dgps_channel_data_valid_flags(microstrain_serializer* serializer, const mip_gnss_dgps_channel_data_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_gnss_dgps_channel_data_valid_flags(microstrain_serializer* serializer, mip_gnss_dgps_channel_data_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_gnss_dgps_channel_data { @@ -687,21 +883,18 @@ struct mip_gnss_dgps_channel_data float range_correction; ///< [m] float range_rate_correction; ///< [m/s] mip_gnss_dgps_channel_data_valid_flags valid_flags; - }; typedef struct mip_gnss_dgps_channel_data mip_gnss_dgps_channel_data; -void insert_mip_gnss_dgps_channel_data(struct mip_serializer* serializer, const mip_gnss_dgps_channel_data* self); -void extract_mip_gnss_dgps_channel_data(struct mip_serializer* serializer, mip_gnss_dgps_channel_data* self); -bool extract_mip_gnss_dgps_channel_data_from_field(const struct mip_field* field, void* ptr); -void insert_mip_gnss_dgps_channel_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_dgps_channel_data_valid_flags self); -void extract_mip_gnss_dgps_channel_data_valid_flags(struct mip_serializer* serializer, mip_gnss_dgps_channel_data_valid_flags* self); +void insert_mip_gnss_dgps_channel_data(microstrain_serializer* serializer, const mip_gnss_dgps_channel_data* self); +void extract_mip_gnss_dgps_channel_data(microstrain_serializer* serializer, mip_gnss_dgps_channel_data* self); +bool extract_mip_gnss_dgps_channel_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_gnss_clock_info_2 (0x81,0x10) Clock Info 2 [C] +///@defgroup gnss_clock_info_2_c (0x81,0x10) Clock Info 2 /// GNSS reported receiver clock parameters /// /// This supersedes MIP_DATA_DESC_GNSS_CLOCK_INFO with additional information. @@ -716,6 +909,17 @@ static const mip_gnss_clock_info_2_data_valid_flags MIP_GNSS_CLOCK_INFO_2_DATA_V static const mip_gnss_clock_info_2_data_valid_flags MIP_GNSS_CLOCK_INFO_2_DATA_VALID_FLAGS_DRIFT_ACCURACY = 0x0008; ///< static const mip_gnss_clock_info_2_data_valid_flags MIP_GNSS_CLOCK_INFO_2_DATA_VALID_FLAGS_FLAGS = 0x000F; ///< static const mip_gnss_clock_info_2_data_valid_flags MIP_GNSS_CLOCK_INFO_2_DATA_VALID_FLAGS_ALL = 0x000F; +static inline void insert_mip_gnss_clock_info_2_data_valid_flags(microstrain_serializer* serializer, const mip_gnss_clock_info_2_data_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_gnss_clock_info_2_data_valid_flags(microstrain_serializer* serializer, mip_gnss_clock_info_2_data_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_gnss_clock_info_2_data { @@ -724,21 +928,18 @@ struct mip_gnss_clock_info_2_data double bias_accuracy_estimate; double drift_accuracy_estimate; mip_gnss_clock_info_2_data_valid_flags valid_flags; - }; typedef struct mip_gnss_clock_info_2_data mip_gnss_clock_info_2_data; -void insert_mip_gnss_clock_info_2_data(struct mip_serializer* serializer, const mip_gnss_clock_info_2_data* self); -void extract_mip_gnss_clock_info_2_data(struct mip_serializer* serializer, mip_gnss_clock_info_2_data* self); -bool extract_mip_gnss_clock_info_2_data_from_field(const struct mip_field* field, void* ptr); -void insert_mip_gnss_clock_info_2_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_clock_info_2_data_valid_flags self); -void extract_mip_gnss_clock_info_2_data_valid_flags(struct mip_serializer* serializer, mip_gnss_clock_info_2_data_valid_flags* self); +void insert_mip_gnss_clock_info_2_data(microstrain_serializer* serializer, const mip_gnss_clock_info_2_data* self); +void extract_mip_gnss_clock_info_2_data(microstrain_serializer* serializer, mip_gnss_clock_info_2_data* self); +bool extract_mip_gnss_clock_info_2_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_gnss_gps_leap_seconds (0x81,0x11) Gps Leap Seconds [C] +///@defgroup gnss_gps_leap_seconds_c (0x81,0x11) Gps Leap Seconds /// GNSS reported leap seconds (difference between GPS and UTC Time) /// ///@{ @@ -747,26 +948,34 @@ typedef uint16_t mip_gnss_gps_leap_seconds_data_valid_flags; static const mip_gnss_gps_leap_seconds_data_valid_flags MIP_GNSS_GPS_LEAP_SECONDS_DATA_VALID_FLAGS_NONE = 0x0000; static const mip_gnss_gps_leap_seconds_data_valid_flags MIP_GNSS_GPS_LEAP_SECONDS_DATA_VALID_FLAGS_LEAP_SECONDS = 0x0002; ///< static const mip_gnss_gps_leap_seconds_data_valid_flags MIP_GNSS_GPS_LEAP_SECONDS_DATA_VALID_FLAGS_ALL = 0x0002; +static inline void insert_mip_gnss_gps_leap_seconds_data_valid_flags(microstrain_serializer* serializer, const mip_gnss_gps_leap_seconds_data_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_gnss_gps_leap_seconds_data_valid_flags(microstrain_serializer* serializer, mip_gnss_gps_leap_seconds_data_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_gnss_gps_leap_seconds_data { uint8_t leap_seconds; ///< [s] mip_gnss_gps_leap_seconds_data_valid_flags valid_flags; - }; typedef struct mip_gnss_gps_leap_seconds_data mip_gnss_gps_leap_seconds_data; -void insert_mip_gnss_gps_leap_seconds_data(struct mip_serializer* serializer, const mip_gnss_gps_leap_seconds_data* self); -void extract_mip_gnss_gps_leap_seconds_data(struct mip_serializer* serializer, mip_gnss_gps_leap_seconds_data* self); -bool extract_mip_gnss_gps_leap_seconds_data_from_field(const struct mip_field* field, void* ptr); -void insert_mip_gnss_gps_leap_seconds_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_gps_leap_seconds_data_valid_flags self); -void extract_mip_gnss_gps_leap_seconds_data_valid_flags(struct mip_serializer* serializer, mip_gnss_gps_leap_seconds_data_valid_flags* self); +void insert_mip_gnss_gps_leap_seconds_data(microstrain_serializer* serializer, const mip_gnss_gps_leap_seconds_data* self); +void extract_mip_gnss_gps_leap_seconds_data(microstrain_serializer* serializer, mip_gnss_gps_leap_seconds_data* self); +bool extract_mip_gnss_gps_leap_seconds_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_gnss_sbas_info (0x81,0x12) Sbas Info [C] +///@defgroup gnss_sbas_info_c (0x81,0x12) Sbas Info /// GNSS SBAS status /// ///@{ @@ -778,6 +987,16 @@ static const mip_gnss_sbas_info_data_sbas_status MIP_GNSS_SBAS_INFO_DATA_SBAS_ST static const mip_gnss_sbas_info_data_sbas_status MIP_GNSS_SBAS_INFO_DATA_SBAS_STATUS_INTEGRITY_AVAILABLE = 0x04; ///< static const mip_gnss_sbas_info_data_sbas_status MIP_GNSS_SBAS_INFO_DATA_SBAS_STATUS_TEST_MODE = 0x08; ///< static const mip_gnss_sbas_info_data_sbas_status MIP_GNSS_SBAS_INFO_DATA_SBAS_STATUS_ALL = 0x0F; +static inline void insert_mip_gnss_sbas_info_data_sbas_status(microstrain_serializer* serializer, const mip_gnss_sbas_info_data_sbas_status self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_gnss_sbas_info_data_sbas_status(microstrain_serializer* serializer, mip_gnss_sbas_info_data_sbas_status* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} typedef uint16_t mip_gnss_sbas_info_data_valid_flags; static const mip_gnss_sbas_info_data_valid_flags MIP_GNSS_SBAS_INFO_DATA_VALID_FLAGS_NONE = 0x0000; @@ -789,6 +1008,17 @@ static const mip_gnss_sbas_info_data_valid_flags MIP_GNSS_SBAS_INFO_DATA_VALID_F static const mip_gnss_sbas_info_data_valid_flags MIP_GNSS_SBAS_INFO_DATA_VALID_FLAGS_SBAS_STATUS = 0x0020; ///< static const mip_gnss_sbas_info_data_valid_flags MIP_GNSS_SBAS_INFO_DATA_VALID_FLAGS_FLAGS = 0x003F; ///< static const mip_gnss_sbas_info_data_valid_flags MIP_GNSS_SBAS_INFO_DATA_VALID_FLAGS_ALL = 0x003F; +static inline void insert_mip_gnss_sbas_info_data_valid_flags(microstrain_serializer* serializer, const mip_gnss_sbas_info_data_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_gnss_sbas_info_data_valid_flags(microstrain_serializer* serializer, mip_gnss_sbas_info_data_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_gnss_sbas_info_data { @@ -799,24 +1029,18 @@ struct mip_gnss_sbas_info_data uint8_t count; ///< Number of SBAS corrections mip_gnss_sbas_info_data_sbas_status sbas_status; ///< Status of the SBAS service mip_gnss_sbas_info_data_valid_flags valid_flags; - }; typedef struct mip_gnss_sbas_info_data mip_gnss_sbas_info_data; -void insert_mip_gnss_sbas_info_data(struct mip_serializer* serializer, const mip_gnss_sbas_info_data* self); -void extract_mip_gnss_sbas_info_data(struct mip_serializer* serializer, mip_gnss_sbas_info_data* self); -bool extract_mip_gnss_sbas_info_data_from_field(const struct mip_field* field, void* ptr); -void insert_mip_gnss_sbas_info_data_sbas_status(struct mip_serializer* serializer, const mip_gnss_sbas_info_data_sbas_status self); -void extract_mip_gnss_sbas_info_data_sbas_status(struct mip_serializer* serializer, mip_gnss_sbas_info_data_sbas_status* self); - -void insert_mip_gnss_sbas_info_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_sbas_info_data_valid_flags self); -void extract_mip_gnss_sbas_info_data_valid_flags(struct mip_serializer* serializer, mip_gnss_sbas_info_data_valid_flags* self); +void insert_mip_gnss_sbas_info_data(microstrain_serializer* serializer, const mip_gnss_sbas_info_data* self); +void extract_mip_gnss_sbas_info_data(microstrain_serializer* serializer, mip_gnss_sbas_info_data* self); +bool extract_mip_gnss_sbas_info_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_gnss_sbas_correction (0x81,0x13) Sbas Correction [C] +///@defgroup gnss_sbas_correction_c (0x81,0x13) Sbas Correction /// GNSS calculated SBAS Correction /// /// UDREI - the variance of a normal distribution associated with the user differential range errors for a @@ -850,6 +1074,17 @@ static const mip_gnss_sbas_correction_data_valid_flags MIP_GNSS_SBAS_CORRECTION_ static const mip_gnss_sbas_correction_data_valid_flags MIP_GNSS_SBAS_CORRECTION_DATA_VALID_FLAGS_IONO_CORRECTION = 0x0004; ///< static const mip_gnss_sbas_correction_data_valid_flags MIP_GNSS_SBAS_CORRECTION_DATA_VALID_FLAGS_FLAGS = 0x0007; ///< static const mip_gnss_sbas_correction_data_valid_flags MIP_GNSS_SBAS_CORRECTION_DATA_VALID_FLAGS_ALL = 0x0007; +static inline void insert_mip_gnss_sbas_correction_data_valid_flags(microstrain_serializer* serializer, const mip_gnss_sbas_correction_data_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_gnss_sbas_correction_data_valid_flags(microstrain_serializer* serializer, mip_gnss_sbas_correction_data_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_gnss_sbas_correction_data { @@ -863,42 +1098,81 @@ struct mip_gnss_sbas_correction_data float pseudorange_correction; ///< Pseudo-range correction [meters]. float iono_correction; ///< Ionospheric correction [meters]. mip_gnss_sbas_correction_data_valid_flags valid_flags; - }; typedef struct mip_gnss_sbas_correction_data mip_gnss_sbas_correction_data; -void insert_mip_gnss_sbas_correction_data(struct mip_serializer* serializer, const mip_gnss_sbas_correction_data* self); -void extract_mip_gnss_sbas_correction_data(struct mip_serializer* serializer, mip_gnss_sbas_correction_data* self); -bool extract_mip_gnss_sbas_correction_data_from_field(const struct mip_field* field, void* ptr); -void insert_mip_gnss_sbas_correction_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_sbas_correction_data_valid_flags self); -void extract_mip_gnss_sbas_correction_data_valid_flags(struct mip_serializer* serializer, mip_gnss_sbas_correction_data_valid_flags* self); +void insert_mip_gnss_sbas_correction_data(microstrain_serializer* serializer, const mip_gnss_sbas_correction_data* self); +void extract_mip_gnss_sbas_correction_data(microstrain_serializer* serializer, mip_gnss_sbas_correction_data* self); +bool extract_mip_gnss_sbas_correction_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_gnss_rf_error_detection (0x81,0x14) Rf Error Detection [C] +///@defgroup gnss_rf_error_detection_c (0x81,0x14) Rf Error Detection /// GNSS Error Detection subsystem status /// ///@{ -typedef uint8_t mip_gnss_rf_error_detection_data_rfband; -static const mip_gnss_rf_error_detection_data_rfband MIP_GNSS_RF_ERROR_DETECTION_DATA_RFBAND_UNKNOWN = 0; ///< -static const mip_gnss_rf_error_detection_data_rfband MIP_GNSS_RF_ERROR_DETECTION_DATA_RFBAND_L1 = 1; ///< -static const mip_gnss_rf_error_detection_data_rfband MIP_GNSS_RF_ERROR_DETECTION_DATA_RFBAND_L2 = 2; ///< -static const mip_gnss_rf_error_detection_data_rfband MIP_GNSS_RF_ERROR_DETECTION_DATA_RFBAND_L5 = 5; ///< +enum mip_gnss_rf_error_detection_data_rfband +{ + MIP_GNSS_RF_ERROR_DETECTION_DATA_RFBAND_UNKNOWN = 0, ///< + MIP_GNSS_RF_ERROR_DETECTION_DATA_RFBAND_L1 = 1, ///< + MIP_GNSS_RF_ERROR_DETECTION_DATA_RFBAND_L2 = 2, ///< + MIP_GNSS_RF_ERROR_DETECTION_DATA_RFBAND_L5 = 5, ///< +}; +typedef enum mip_gnss_rf_error_detection_data_rfband mip_gnss_rf_error_detection_data_rfband; + +static inline void insert_mip_gnss_rf_error_detection_data_rfband(microstrain_serializer* serializer, const mip_gnss_rf_error_detection_data_rfband self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_gnss_rf_error_detection_data_rfband(microstrain_serializer* serializer, mip_gnss_rf_error_detection_data_rfband* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} + +enum mip_gnss_rf_error_detection_data_jamming_state +{ + MIP_GNSS_RF_ERROR_DETECTION_DATA_JAMMING_STATE_UNKNOWN = 0, ///< + MIP_GNSS_RF_ERROR_DETECTION_DATA_JAMMING_STATE_NONE = 1, ///< + MIP_GNSS_RF_ERROR_DETECTION_DATA_JAMMING_STATE_PARTIAL = 2, ///< + MIP_GNSS_RF_ERROR_DETECTION_DATA_JAMMING_STATE_SIGNIFICANT = 3, ///< +}; +typedef enum mip_gnss_rf_error_detection_data_jamming_state mip_gnss_rf_error_detection_data_jamming_state; + +static inline void insert_mip_gnss_rf_error_detection_data_jamming_state(microstrain_serializer* serializer, const mip_gnss_rf_error_detection_data_jamming_state self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_gnss_rf_error_detection_data_jamming_state(microstrain_serializer* serializer, mip_gnss_rf_error_detection_data_jamming_state* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} -typedef uint8_t mip_gnss_rf_error_detection_data_jamming_state; -static const mip_gnss_rf_error_detection_data_jamming_state MIP_GNSS_RF_ERROR_DETECTION_DATA_JAMMING_STATE_UNKNOWN = 0; ///< -static const mip_gnss_rf_error_detection_data_jamming_state MIP_GNSS_RF_ERROR_DETECTION_DATA_JAMMING_STATE_NONE = 1; ///< -static const mip_gnss_rf_error_detection_data_jamming_state MIP_GNSS_RF_ERROR_DETECTION_DATA_JAMMING_STATE_PARTIAL = 2; ///< -static const mip_gnss_rf_error_detection_data_jamming_state MIP_GNSS_RF_ERROR_DETECTION_DATA_JAMMING_STATE_SIGNIFICANT = 3; ///< +enum mip_gnss_rf_error_detection_data_spoofing_state +{ + MIP_GNSS_RF_ERROR_DETECTION_DATA_SPOOFING_STATE_UNKNOWN = 0, ///< + MIP_GNSS_RF_ERROR_DETECTION_DATA_SPOOFING_STATE_NONE = 1, ///< + MIP_GNSS_RF_ERROR_DETECTION_DATA_SPOOFING_STATE_PARTIAL = 2, ///< + MIP_GNSS_RF_ERROR_DETECTION_DATA_SPOOFING_STATE_SIGNIFICANT = 3, ///< +}; +typedef enum mip_gnss_rf_error_detection_data_spoofing_state mip_gnss_rf_error_detection_data_spoofing_state; -typedef uint8_t mip_gnss_rf_error_detection_data_spoofing_state; -static const mip_gnss_rf_error_detection_data_spoofing_state MIP_GNSS_RF_ERROR_DETECTION_DATA_SPOOFING_STATE_UNKNOWN = 0; ///< -static const mip_gnss_rf_error_detection_data_spoofing_state MIP_GNSS_RF_ERROR_DETECTION_DATA_SPOOFING_STATE_NONE = 1; ///< -static const mip_gnss_rf_error_detection_data_spoofing_state MIP_GNSS_RF_ERROR_DETECTION_DATA_SPOOFING_STATE_PARTIAL = 2; ///< -static const mip_gnss_rf_error_detection_data_spoofing_state MIP_GNSS_RF_ERROR_DETECTION_DATA_SPOOFING_STATE_SIGNIFICANT = 3; ///< +static inline void insert_mip_gnss_rf_error_detection_data_spoofing_state(microstrain_serializer* serializer, const mip_gnss_rf_error_detection_data_spoofing_state self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_gnss_rf_error_detection_data_spoofing_state(microstrain_serializer* serializer, mip_gnss_rf_error_detection_data_spoofing_state* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} typedef uint16_t mip_gnss_rf_error_detection_data_valid_flags; static const mip_gnss_rf_error_detection_data_valid_flags MIP_GNSS_RF_ERROR_DETECTION_DATA_VALID_FLAGS_NONE = 0x0000; @@ -907,6 +1181,17 @@ static const mip_gnss_rf_error_detection_data_valid_flags MIP_GNSS_RF_ERROR_DETE static const mip_gnss_rf_error_detection_data_valid_flags MIP_GNSS_RF_ERROR_DETECTION_DATA_VALID_FLAGS_SPOOFING_STATE = 0x0004; ///< static const mip_gnss_rf_error_detection_data_valid_flags MIP_GNSS_RF_ERROR_DETECTION_DATA_VALID_FLAGS_FLAGS = 0x0007; ///< static const mip_gnss_rf_error_detection_data_valid_flags MIP_GNSS_RF_ERROR_DETECTION_DATA_VALID_FLAGS_ALL = 0x0007; +static inline void insert_mip_gnss_rf_error_detection_data_valid_flags(microstrain_serializer* serializer, const mip_gnss_rf_error_detection_data_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_gnss_rf_error_detection_data_valid_flags(microstrain_serializer* serializer, mip_gnss_rf_error_detection_data_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_gnss_rf_error_detection_data { @@ -915,30 +1200,18 @@ struct mip_gnss_rf_error_detection_data mip_gnss_rf_error_detection_data_spoofing_state spoofing_state; ///< GNSS Spoofing State (as reported by the GNSS module) uint8_t reserved[4]; ///< Reserved for future use mip_gnss_rf_error_detection_data_valid_flags valid_flags; - }; typedef struct mip_gnss_rf_error_detection_data mip_gnss_rf_error_detection_data; -void insert_mip_gnss_rf_error_detection_data(struct mip_serializer* serializer, const mip_gnss_rf_error_detection_data* self); -void extract_mip_gnss_rf_error_detection_data(struct mip_serializer* serializer, mip_gnss_rf_error_detection_data* self); -bool extract_mip_gnss_rf_error_detection_data_from_field(const struct mip_field* field, void* ptr); -void insert_mip_gnss_rf_error_detection_data_rfband(struct mip_serializer* serializer, const mip_gnss_rf_error_detection_data_rfband self); -void extract_mip_gnss_rf_error_detection_data_rfband(struct mip_serializer* serializer, mip_gnss_rf_error_detection_data_rfband* self); - -void insert_mip_gnss_rf_error_detection_data_jamming_state(struct mip_serializer* serializer, const mip_gnss_rf_error_detection_data_jamming_state self); -void extract_mip_gnss_rf_error_detection_data_jamming_state(struct mip_serializer* serializer, mip_gnss_rf_error_detection_data_jamming_state* self); - -void insert_mip_gnss_rf_error_detection_data_spoofing_state(struct mip_serializer* serializer, const mip_gnss_rf_error_detection_data_spoofing_state self); -void extract_mip_gnss_rf_error_detection_data_spoofing_state(struct mip_serializer* serializer, mip_gnss_rf_error_detection_data_spoofing_state* self); - -void insert_mip_gnss_rf_error_detection_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_rf_error_detection_data_valid_flags self); -void extract_mip_gnss_rf_error_detection_data_valid_flags(struct mip_serializer* serializer, mip_gnss_rf_error_detection_data_valid_flags* self); +void insert_mip_gnss_rf_error_detection_data(microstrain_serializer* serializer, const mip_gnss_rf_error_detection_data* self); +void extract_mip_gnss_rf_error_detection_data(microstrain_serializer* serializer, mip_gnss_rf_error_detection_data* self); +bool extract_mip_gnss_rf_error_detection_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_gnss_base_station_info (0x81,0x30) Base Station Info [C] +///@defgroup gnss_base_station_info_c (0x81,0x30) Base Station Info /// RTCM reported base station information (sourced from RTCM Message 1005 or 1006) /// /// Valid Flag Mapping: @@ -957,6 +1230,16 @@ static const mip_gnss_base_station_info_data_indicator_flags MIP_GNSS_BASE_STATI static const mip_gnss_base_station_info_data_indicator_flags MIP_GNSS_BASE_STATION_INFO_DATA_INDICATOR_FLAGS_QUARTER_CYCLE_BIT2 = 0x0080; ///< static const mip_gnss_base_station_info_data_indicator_flags MIP_GNSS_BASE_STATION_INFO_DATA_INDICATOR_FLAGS_QUARTER_CYCLE_BITS = 0x00C0; ///< static const mip_gnss_base_station_info_data_indicator_flags MIP_GNSS_BASE_STATION_INFO_DATA_INDICATOR_FLAGS_ALL = 0x00FF; +static inline void insert_mip_gnss_base_station_info_data_indicator_flags(microstrain_serializer* serializer, const mip_gnss_base_station_info_data_indicator_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_gnss_base_station_info_data_indicator_flags(microstrain_serializer* serializer, mip_gnss_base_station_info_data_indicator_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} typedef uint16_t mip_gnss_base_station_info_data_valid_flags; static const mip_gnss_base_station_info_data_valid_flags MIP_GNSS_BASE_STATION_INFO_DATA_VALID_FLAGS_NONE = 0x0000; @@ -968,6 +1251,17 @@ static const mip_gnss_base_station_info_data_valid_flags MIP_GNSS_BASE_STATION_I static const mip_gnss_base_station_info_data_valid_flags MIP_GNSS_BASE_STATION_INFO_DATA_VALID_FLAGS_INDICATORS = 0x0020; ///< static const mip_gnss_base_station_info_data_valid_flags MIP_GNSS_BASE_STATION_INFO_DATA_VALID_FLAGS_FLAGS = 0x003F; ///< static const mip_gnss_base_station_info_data_valid_flags MIP_GNSS_BASE_STATION_INFO_DATA_VALID_FLAGS_ALL = 0x003F; +static inline void insert_mip_gnss_base_station_info_data_valid_flags(microstrain_serializer* serializer, const mip_gnss_base_station_info_data_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_gnss_base_station_info_data_valid_flags(microstrain_serializer* serializer, mip_gnss_base_station_info_data_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_gnss_base_station_info_data { @@ -978,24 +1272,18 @@ struct mip_gnss_base_station_info_data uint16_t station_id; ///< Range: 0-4095 mip_gnss_base_station_info_data_indicator_flags indicators; ///< Bitfield mip_gnss_base_station_info_data_valid_flags valid_flags; - }; typedef struct mip_gnss_base_station_info_data mip_gnss_base_station_info_data; -void insert_mip_gnss_base_station_info_data(struct mip_serializer* serializer, const mip_gnss_base_station_info_data* self); -void extract_mip_gnss_base_station_info_data(struct mip_serializer* serializer, mip_gnss_base_station_info_data* self); -bool extract_mip_gnss_base_station_info_data_from_field(const struct mip_field* field, void* ptr); -void insert_mip_gnss_base_station_info_data_indicator_flags(struct mip_serializer* serializer, const mip_gnss_base_station_info_data_indicator_flags self); -void extract_mip_gnss_base_station_info_data_indicator_flags(struct mip_serializer* serializer, mip_gnss_base_station_info_data_indicator_flags* self); - -void insert_mip_gnss_base_station_info_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_base_station_info_data_valid_flags self); -void extract_mip_gnss_base_station_info_data_valid_flags(struct mip_serializer* serializer, mip_gnss_base_station_info_data_valid_flags* self); +void insert_mip_gnss_base_station_info_data(microstrain_serializer* serializer, const mip_gnss_base_station_info_data* self); +void extract_mip_gnss_base_station_info_data(microstrain_serializer* serializer, mip_gnss_base_station_info_data* self); +bool extract_mip_gnss_base_station_info_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_gnss_rtk_corrections_status (0x81,0x31) Rtk Corrections Status [C] +///@defgroup gnss_rtk_corrections_status_c (0x81,0x31) Rtk Corrections Status /// ///@{ @@ -1011,6 +1299,16 @@ static const mip_gnss_rtk_corrections_status_data_valid_flags MIP_GNSS_RTK_CORRE static const mip_gnss_rtk_corrections_status_data_valid_flags MIP_GNSS_RTK_CORRECTIONS_STATUS_DATA_VALID_FLAGS_BEIDOU_LATENCY = 0x0080; ///< static const mip_gnss_rtk_corrections_status_data_valid_flags MIP_GNSS_RTK_CORRECTIONS_STATUS_DATA_VALID_FLAGS_FLAGS = 0x00FF; ///< static const mip_gnss_rtk_corrections_status_data_valid_flags MIP_GNSS_RTK_CORRECTIONS_STATUS_DATA_VALID_FLAGS_ALL = 0x00FF; +static inline void insert_mip_gnss_rtk_corrections_status_data_valid_flags(microstrain_serializer* serializer, const mip_gnss_rtk_corrections_status_data_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_gnss_rtk_corrections_status_data_valid_flags(microstrain_serializer* serializer, mip_gnss_rtk_corrections_status_data_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} typedef uint16_t mip_gnss_rtk_corrections_status_data_epoch_status; static const mip_gnss_rtk_corrections_status_data_epoch_status MIP_GNSS_RTK_CORRECTIONS_STATUS_DATA_EPOCH_STATUS_NONE = 0x0000; @@ -1024,6 +1322,17 @@ static const mip_gnss_rtk_corrections_status_data_epoch_status MIP_GNSS_RTK_CORR static const mip_gnss_rtk_corrections_status_data_epoch_status MIP_GNSS_RTK_CORRECTIONS_STATUS_DATA_EPOCH_STATUS_USING_GLONASS_MSM_MESSAGES = 0x0080; ///< Using MSM messages for GLONASS corrections instead of RTCM messages 1009-1012 static const mip_gnss_rtk_corrections_status_data_epoch_status MIP_GNSS_RTK_CORRECTIONS_STATUS_DATA_EPOCH_STATUS_DONGLE_STATUS_READ_FAILED = 0x0100; ///< A read of the dongle status was attempted, but failed static const mip_gnss_rtk_corrections_status_data_epoch_status MIP_GNSS_RTK_CORRECTIONS_STATUS_DATA_EPOCH_STATUS_ALL = 0x01FF; +static inline void insert_mip_gnss_rtk_corrections_status_data_epoch_status(microstrain_serializer* serializer, const mip_gnss_rtk_corrections_status_data_epoch_status self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_gnss_rtk_corrections_status_data_epoch_status(microstrain_serializer* serializer, mip_gnss_rtk_corrections_status_data_epoch_status* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_gnss_rtk_corrections_status_data { @@ -1037,24 +1346,18 @@ struct mip_gnss_rtk_corrections_status_data float beidou_correction_latency; ///< Latency of last Beidou correction [seconds] uint32_t reserved[4]; ///< Reserved for future use mip_gnss_rtk_corrections_status_data_valid_flags valid_flags; - }; typedef struct mip_gnss_rtk_corrections_status_data mip_gnss_rtk_corrections_status_data; -void insert_mip_gnss_rtk_corrections_status_data(struct mip_serializer* serializer, const mip_gnss_rtk_corrections_status_data* self); -void extract_mip_gnss_rtk_corrections_status_data(struct mip_serializer* serializer, mip_gnss_rtk_corrections_status_data* self); -bool extract_mip_gnss_rtk_corrections_status_data_from_field(const struct mip_field* field, void* ptr); - -void insert_mip_gnss_rtk_corrections_status_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_rtk_corrections_status_data_valid_flags self); -void extract_mip_gnss_rtk_corrections_status_data_valid_flags(struct mip_serializer* serializer, mip_gnss_rtk_corrections_status_data_valid_flags* self); -void insert_mip_gnss_rtk_corrections_status_data_epoch_status(struct mip_serializer* serializer, const mip_gnss_rtk_corrections_status_data_epoch_status self); -void extract_mip_gnss_rtk_corrections_status_data_epoch_status(struct mip_serializer* serializer, mip_gnss_rtk_corrections_status_data_epoch_status* self); +void insert_mip_gnss_rtk_corrections_status_data(microstrain_serializer* serializer, const mip_gnss_rtk_corrections_status_data* self); +void extract_mip_gnss_rtk_corrections_status_data(microstrain_serializer* serializer, mip_gnss_rtk_corrections_status_data* self); +bool extract_mip_gnss_rtk_corrections_status_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_gnss_satellite_status (0x81,0x20) Satellite Status [C] +///@defgroup gnss_satellite_status_c (0x81,0x20) Satellite Status /// Status information for a GNSS satellite. /// ///@{ @@ -1070,6 +1373,17 @@ static const mip_gnss_satellite_status_data_valid_flags MIP_GNSS_SATELLITE_STATU static const mip_gnss_satellite_status_data_valid_flags MIP_GNSS_SATELLITE_STATUS_DATA_VALID_FLAGS_HEALTH = 0x0040; ///< static const mip_gnss_satellite_status_data_valid_flags MIP_GNSS_SATELLITE_STATUS_DATA_VALID_FLAGS_FLAGS = 0x007F; ///< static const mip_gnss_satellite_status_data_valid_flags MIP_GNSS_SATELLITE_STATUS_DATA_VALID_FLAGS_ALL = 0x007F; +static inline void insert_mip_gnss_satellite_status_data_valid_flags(microstrain_serializer* serializer, const mip_gnss_satellite_status_data_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_gnss_satellite_status_data_valid_flags(microstrain_serializer* serializer, mip_gnss_satellite_status_data_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_gnss_satellite_status_data { @@ -1083,32 +1397,43 @@ struct mip_gnss_satellite_status_data float azimuth; ///< Azimuth of the satellite relative to the rover [degrees] bool health; ///< True if the satellite is healthy. mip_gnss_satellite_status_data_valid_flags valid_flags; - }; typedef struct mip_gnss_satellite_status_data mip_gnss_satellite_status_data; -void insert_mip_gnss_satellite_status_data(struct mip_serializer* serializer, const mip_gnss_satellite_status_data* self); -void extract_mip_gnss_satellite_status_data(struct mip_serializer* serializer, mip_gnss_satellite_status_data* self); -bool extract_mip_gnss_satellite_status_data_from_field(const struct mip_field* field, void* ptr); -void insert_mip_gnss_satellite_status_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_satellite_status_data_valid_flags self); -void extract_mip_gnss_satellite_status_data_valid_flags(struct mip_serializer* serializer, mip_gnss_satellite_status_data_valid_flags* self); +void insert_mip_gnss_satellite_status_data(microstrain_serializer* serializer, const mip_gnss_satellite_status_data* self); +void extract_mip_gnss_satellite_status_data(microstrain_serializer* serializer, mip_gnss_satellite_status_data* self); +bool extract_mip_gnss_satellite_status_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_gnss_raw (0x81,0x22) Raw [C] +///@defgroup gnss_raw_c (0x81,0x22) Raw /// GNSS Raw observation. /// ///@{ -typedef uint8_t mip_gnss_raw_data_gnss_signal_quality; -static const mip_gnss_raw_data_gnss_signal_quality MIP_GNSS_RAW_DATA_GNSS_SIGNAL_QUALITY_NONE = 0; ///< -static const mip_gnss_raw_data_gnss_signal_quality MIP_GNSS_RAW_DATA_GNSS_SIGNAL_QUALITY_SEARCHING = 1; ///< -static const mip_gnss_raw_data_gnss_signal_quality MIP_GNSS_RAW_DATA_GNSS_SIGNAL_QUALITY_ACQUIRED = 2; ///< -static const mip_gnss_raw_data_gnss_signal_quality MIP_GNSS_RAW_DATA_GNSS_SIGNAL_QUALITY_UNUSABLE = 3; ///< -static const mip_gnss_raw_data_gnss_signal_quality MIP_GNSS_RAW_DATA_GNSS_SIGNAL_QUALITY_TIME_LOCKED = 4; ///< -static const mip_gnss_raw_data_gnss_signal_quality MIP_GNSS_RAW_DATA_GNSS_SIGNAL_QUALITY_FULLY_LOCKED = 5; ///< +enum mip_gnss_raw_data_gnss_signal_quality +{ + MIP_GNSS_RAW_DATA_GNSS_SIGNAL_QUALITY_NONE = 0, ///< + MIP_GNSS_RAW_DATA_GNSS_SIGNAL_QUALITY_SEARCHING = 1, ///< + MIP_GNSS_RAW_DATA_GNSS_SIGNAL_QUALITY_ACQUIRED = 2, ///< + MIP_GNSS_RAW_DATA_GNSS_SIGNAL_QUALITY_UNUSABLE = 3, ///< + MIP_GNSS_RAW_DATA_GNSS_SIGNAL_QUALITY_TIME_LOCKED = 4, ///< + MIP_GNSS_RAW_DATA_GNSS_SIGNAL_QUALITY_FULLY_LOCKED = 5, ///< +}; +typedef enum mip_gnss_raw_data_gnss_signal_quality mip_gnss_raw_data_gnss_signal_quality; + +static inline void insert_mip_gnss_raw_data_gnss_signal_quality(microstrain_serializer* serializer, const mip_gnss_raw_data_gnss_signal_quality self) +{ + microstrain_insert_u8(serializer, (uint8_t)(self)); +} +static inline void extract_mip_gnss_raw_data_gnss_signal_quality(microstrain_serializer* serializer, mip_gnss_raw_data_gnss_signal_quality* self) +{ + uint8_t tmp = 0; + microstrain_extract_u8(serializer, &tmp); + *self = tmp; +} typedef uint16_t mip_gnss_raw_data_valid_flags; static const mip_gnss_raw_data_valid_flags MIP_GNSS_RAW_DATA_VALID_FLAGS_NONE = 0x0000; @@ -1130,6 +1455,17 @@ static const mip_gnss_raw_data_valid_flags MIP_GNSS_RAW_DATA_VALID_FLAGS_DOPPLER static const mip_gnss_raw_data_valid_flags MIP_GNSS_RAW_DATA_VALID_FLAGS_LOCK_TIME = 0x8000; ///< static const mip_gnss_raw_data_valid_flags MIP_GNSS_RAW_DATA_VALID_FLAGS_FLAGS = 0xFFFF; ///< static const mip_gnss_raw_data_valid_flags MIP_GNSS_RAW_DATA_VALID_FLAGS_ALL = 0xFFFF; +static inline void insert_mip_gnss_raw_data_valid_flags(microstrain_serializer* serializer, const mip_gnss_raw_data_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_gnss_raw_data_valid_flags(microstrain_serializer* serializer, mip_gnss_raw_data_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_gnss_raw_data { @@ -1152,24 +1488,18 @@ struct mip_gnss_raw_data float doppler_uncert; ///< Uncertainty of the measured doppler shift [Hz]. float lock_time; ///< DOC Minimum carrier phase lock time [s]. Note: the maximum value is dependent on the receiver. mip_gnss_raw_data_valid_flags valid_flags; - }; typedef struct mip_gnss_raw_data mip_gnss_raw_data; -void insert_mip_gnss_raw_data(struct mip_serializer* serializer, const mip_gnss_raw_data* self); -void extract_mip_gnss_raw_data(struct mip_serializer* serializer, mip_gnss_raw_data* self); -bool extract_mip_gnss_raw_data_from_field(const struct mip_field* field, void* ptr); -void insert_mip_gnss_raw_data_gnss_signal_quality(struct mip_serializer* serializer, const mip_gnss_raw_data_gnss_signal_quality self); -void extract_mip_gnss_raw_data_gnss_signal_quality(struct mip_serializer* serializer, mip_gnss_raw_data_gnss_signal_quality* self); - -void insert_mip_gnss_raw_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_raw_data_valid_flags self); -void extract_mip_gnss_raw_data_valid_flags(struct mip_serializer* serializer, mip_gnss_raw_data_valid_flags* self); +void insert_mip_gnss_raw_data(microstrain_serializer* serializer, const mip_gnss_raw_data* self); +void extract_mip_gnss_raw_data(microstrain_serializer* serializer, mip_gnss_raw_data* self); +bool extract_mip_gnss_raw_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_gnss_gps_ephemeris (0x81,0x61) Gps Ephemeris [C] +///@defgroup gnss_gps_ephemeris_c (0x81,0x61) Gps Ephemeris /// GPS Ephemeris Data /// ///@{ @@ -1178,8 +1508,20 @@ typedef uint16_t mip_gnss_gps_ephemeris_data_valid_flags; static const mip_gnss_gps_ephemeris_data_valid_flags MIP_GNSS_GPS_EPHEMERIS_DATA_VALID_FLAGS_NONE = 0x0000; static const mip_gnss_gps_ephemeris_data_valid_flags MIP_GNSS_GPS_EPHEMERIS_DATA_VALID_FLAGS_EPHEMERIS = 0x0001; ///< static const mip_gnss_gps_ephemeris_data_valid_flags MIP_GNSS_GPS_EPHEMERIS_DATA_VALID_FLAGS_MODERN_DATA = 0x0002; ///< -static const mip_gnss_gps_ephemeris_data_valid_flags MIP_GNSS_GPS_EPHEMERIS_DATA_VALID_FLAGS_FLAGS = 0x0003; ///< -static const mip_gnss_gps_ephemeris_data_valid_flags MIP_GNSS_GPS_EPHEMERIS_DATA_VALID_FLAGS_ALL = 0x0003; +static const mip_gnss_gps_ephemeris_data_valid_flags MIP_GNSS_GPS_EPHEMERIS_DATA_VALID_FLAGS_ISC_L5 = 0x0004; ///< +static const mip_gnss_gps_ephemeris_data_valid_flags MIP_GNSS_GPS_EPHEMERIS_DATA_VALID_FLAGS_FLAGS = 0x0007; ///< +static const mip_gnss_gps_ephemeris_data_valid_flags MIP_GNSS_GPS_EPHEMERIS_DATA_VALID_FLAGS_ALL = 0x0007; +static inline void insert_mip_gnss_gps_ephemeris_data_valid_flags(microstrain_serializer* serializer, const mip_gnss_gps_ephemeris_data_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_gnss_gps_ephemeris_data_valid_flags(microstrain_serializer* serializer, mip_gnss_gps_ephemeris_data_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_gnss_gps_ephemeris_data { @@ -1196,8 +1538,8 @@ struct mip_gnss_gps_ephemeris_data double af1; ///< Clock drift in [s/s]. double af2; ///< Clock drift rate in [s/s^2]. double t_gd; ///< T Group Delay [s]. - double ISC_L1CA; - double ISC_L2C; + double ISC_L1CA; ///< Inter-signal correction (L1). + double ISC_L2C; ///< Inter-signal correction (L2, or L5 if isc_l5 flag is set). double t_oe; ///< Reference time for ephemeris in [s]. double a; ///< Semi-major axis [m]. double a_dot; ///< Semi-major axis rate [m/s]. @@ -1217,21 +1559,18 @@ struct mip_gnss_gps_ephemeris_data double c_rc; ///< Harmonic Correction Term. double c_rs; ///< Harmonic Correction Term. mip_gnss_gps_ephemeris_data_valid_flags valid_flags; - }; typedef struct mip_gnss_gps_ephemeris_data mip_gnss_gps_ephemeris_data; -void insert_mip_gnss_gps_ephemeris_data(struct mip_serializer* serializer, const mip_gnss_gps_ephemeris_data* self); -void extract_mip_gnss_gps_ephemeris_data(struct mip_serializer* serializer, mip_gnss_gps_ephemeris_data* self); -bool extract_mip_gnss_gps_ephemeris_data_from_field(const struct mip_field* field, void* ptr); -void insert_mip_gnss_gps_ephemeris_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_gps_ephemeris_data_valid_flags self); -void extract_mip_gnss_gps_ephemeris_data_valid_flags(struct mip_serializer* serializer, mip_gnss_gps_ephemeris_data_valid_flags* self); +void insert_mip_gnss_gps_ephemeris_data(microstrain_serializer* serializer, const mip_gnss_gps_ephemeris_data* self); +void extract_mip_gnss_gps_ephemeris_data(microstrain_serializer* serializer, mip_gnss_gps_ephemeris_data* self); +bool extract_mip_gnss_gps_ephemeris_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_gnss_galileo_ephemeris (0x81,0x63) Galileo Ephemeris [C] +///@defgroup gnss_galileo_ephemeris_c (0x81,0x63) Galileo Ephemeris /// Galileo Ephemeris Data /// ///@{ @@ -1240,8 +1579,20 @@ typedef uint16_t mip_gnss_galileo_ephemeris_data_valid_flags; static const mip_gnss_galileo_ephemeris_data_valid_flags MIP_GNSS_GALILEO_EPHEMERIS_DATA_VALID_FLAGS_NONE = 0x0000; static const mip_gnss_galileo_ephemeris_data_valid_flags MIP_GNSS_GALILEO_EPHEMERIS_DATA_VALID_FLAGS_EPHEMERIS = 0x0001; ///< static const mip_gnss_galileo_ephemeris_data_valid_flags MIP_GNSS_GALILEO_EPHEMERIS_DATA_VALID_FLAGS_MODERN_DATA = 0x0002; ///< -static const mip_gnss_galileo_ephemeris_data_valid_flags MIP_GNSS_GALILEO_EPHEMERIS_DATA_VALID_FLAGS_FLAGS = 0x0003; ///< -static const mip_gnss_galileo_ephemeris_data_valid_flags MIP_GNSS_GALILEO_EPHEMERIS_DATA_VALID_FLAGS_ALL = 0x0003; +static const mip_gnss_galileo_ephemeris_data_valid_flags MIP_GNSS_GALILEO_EPHEMERIS_DATA_VALID_FLAGS_ISC_L5 = 0x0004; ///< +static const mip_gnss_galileo_ephemeris_data_valid_flags MIP_GNSS_GALILEO_EPHEMERIS_DATA_VALID_FLAGS_FLAGS = 0x0007; ///< +static const mip_gnss_galileo_ephemeris_data_valid_flags MIP_GNSS_GALILEO_EPHEMERIS_DATA_VALID_FLAGS_ALL = 0x0007; +static inline void insert_mip_gnss_galileo_ephemeris_data_valid_flags(microstrain_serializer* serializer, const mip_gnss_galileo_ephemeris_data_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_gnss_galileo_ephemeris_data_valid_flags(microstrain_serializer* serializer, mip_gnss_galileo_ephemeris_data_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_gnss_galileo_ephemeris_data { @@ -1258,8 +1609,8 @@ struct mip_gnss_galileo_ephemeris_data double af1; ///< Clock drift in [s/s]. double af2; ///< Clock drift rate in [s/s^2]. double t_gd; ///< T Group Delay [s]. - double ISC_L1CA; - double ISC_L2C; + double ISC_L1CA; ///< Inter-signal correction (L1). + double ISC_L2C; ///< Inter-signal correction (L2, or L5 if isc_l5 flag is set). double t_oe; ///< Reference time for ephemeris in [s]. double a; ///< Semi-major axis [m]. double a_dot; ///< Semi-major axis rate [m/s]. @@ -1279,21 +1630,18 @@ struct mip_gnss_galileo_ephemeris_data double c_rc; ///< Harmonic Correction Term. double c_rs; ///< Harmonic Correction Term. mip_gnss_galileo_ephemeris_data_valid_flags valid_flags; - }; typedef struct mip_gnss_galileo_ephemeris_data mip_gnss_galileo_ephemeris_data; -void insert_mip_gnss_galileo_ephemeris_data(struct mip_serializer* serializer, const mip_gnss_galileo_ephemeris_data* self); -void extract_mip_gnss_galileo_ephemeris_data(struct mip_serializer* serializer, mip_gnss_galileo_ephemeris_data* self); -bool extract_mip_gnss_galileo_ephemeris_data_from_field(const struct mip_field* field, void* ptr); -void insert_mip_gnss_galileo_ephemeris_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_galileo_ephemeris_data_valid_flags self); -void extract_mip_gnss_galileo_ephemeris_data_valid_flags(struct mip_serializer* serializer, mip_gnss_galileo_ephemeris_data_valid_flags* self); +void insert_mip_gnss_galileo_ephemeris_data(microstrain_serializer* serializer, const mip_gnss_galileo_ephemeris_data* self); +void extract_mip_gnss_galileo_ephemeris_data(microstrain_serializer* serializer, mip_gnss_galileo_ephemeris_data* self); +bool extract_mip_gnss_galileo_ephemeris_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_gnss_glo_ephemeris (0x81,0x62) Glo Ephemeris [C] +///@defgroup gnss_glo_ephemeris_c (0x81,0x62) Glo Ephemeris /// Glonass Ephemeris Data /// ///@{ @@ -1303,6 +1651,17 @@ static const mip_gnss_glo_ephemeris_data_valid_flags MIP_GNSS_GLO_EPHEMERIS_DATA static const mip_gnss_glo_ephemeris_data_valid_flags MIP_GNSS_GLO_EPHEMERIS_DATA_VALID_FLAGS_EPHEMERIS = 0x0001; ///< static const mip_gnss_glo_ephemeris_data_valid_flags MIP_GNSS_GLO_EPHEMERIS_DATA_VALID_FLAGS_FLAGS = 0x0001; ///< static const mip_gnss_glo_ephemeris_data_valid_flags MIP_GNSS_GLO_EPHEMERIS_DATA_VALID_FLAGS_ALL = 0x0001; +static inline void insert_mip_gnss_glo_ephemeris_data_valid_flags(microstrain_serializer* serializer, const mip_gnss_glo_ephemeris_data_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_gnss_glo_ephemeris_data_valid_flags(microstrain_serializer* serializer, mip_gnss_glo_ephemeris_data_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_gnss_glo_ephemeris_data { @@ -1331,21 +1690,18 @@ struct mip_gnss_glo_ephemeris_data uint8_t P3; ///< Number of satellites in almanac for this frame uint8_t P4; ///< Flag indicating ephemeris parameters are present mip_gnss_glo_ephemeris_data_valid_flags valid_flags; - }; typedef struct mip_gnss_glo_ephemeris_data mip_gnss_glo_ephemeris_data; -void insert_mip_gnss_glo_ephemeris_data(struct mip_serializer* serializer, const mip_gnss_glo_ephemeris_data* self); -void extract_mip_gnss_glo_ephemeris_data(struct mip_serializer* serializer, mip_gnss_glo_ephemeris_data* self); -bool extract_mip_gnss_glo_ephemeris_data_from_field(const struct mip_field* field, void* ptr); -void insert_mip_gnss_glo_ephemeris_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_glo_ephemeris_data_valid_flags self); -void extract_mip_gnss_glo_ephemeris_data_valid_flags(struct mip_serializer* serializer, mip_gnss_glo_ephemeris_data_valid_flags* self); +void insert_mip_gnss_glo_ephemeris_data(microstrain_serializer* serializer, const mip_gnss_glo_ephemeris_data* self); +void extract_mip_gnss_glo_ephemeris_data(microstrain_serializer* serializer, mip_gnss_glo_ephemeris_data* self); +bool extract_mip_gnss_glo_ephemeris_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_gnss_gps_iono_corr (0x81,0x71) Gps Iono Corr [C] +///@defgroup gnss_gps_iono_corr_c (0x81,0x71) Gps Iono Corr /// Ionospheric Correction Terms for GNSS /// ///@{ @@ -1358,6 +1714,17 @@ static const mip_gnss_gps_iono_corr_data_valid_flags MIP_GNSS_GPS_IONO_CORR_DATA static const mip_gnss_gps_iono_corr_data_valid_flags MIP_GNSS_GPS_IONO_CORR_DATA_VALID_FLAGS_BETA = 0x0008; ///< static const mip_gnss_gps_iono_corr_data_valid_flags MIP_GNSS_GPS_IONO_CORR_DATA_VALID_FLAGS_FLAGS = 0x000F; ///< static const mip_gnss_gps_iono_corr_data_valid_flags MIP_GNSS_GPS_IONO_CORR_DATA_VALID_FLAGS_ALL = 0x000F; +static inline void insert_mip_gnss_gps_iono_corr_data_valid_flags(microstrain_serializer* serializer, const mip_gnss_gps_iono_corr_data_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_gnss_gps_iono_corr_data_valid_flags(microstrain_serializer* serializer, mip_gnss_gps_iono_corr_data_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_gnss_gps_iono_corr_data { @@ -1366,21 +1733,18 @@ struct mip_gnss_gps_iono_corr_data double alpha[4]; ///< Ionospheric Correction Terms. double beta[4]; ///< Ionospheric Correction Terms. mip_gnss_gps_iono_corr_data_valid_flags valid_flags; - }; typedef struct mip_gnss_gps_iono_corr_data mip_gnss_gps_iono_corr_data; -void insert_mip_gnss_gps_iono_corr_data(struct mip_serializer* serializer, const mip_gnss_gps_iono_corr_data* self); -void extract_mip_gnss_gps_iono_corr_data(struct mip_serializer* serializer, mip_gnss_gps_iono_corr_data* self); -bool extract_mip_gnss_gps_iono_corr_data_from_field(const struct mip_field* field, void* ptr); -void insert_mip_gnss_gps_iono_corr_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_gps_iono_corr_data_valid_flags self); -void extract_mip_gnss_gps_iono_corr_data_valid_flags(struct mip_serializer* serializer, mip_gnss_gps_iono_corr_data_valid_flags* self); +void insert_mip_gnss_gps_iono_corr_data(microstrain_serializer* serializer, const mip_gnss_gps_iono_corr_data* self); +void extract_mip_gnss_gps_iono_corr_data(microstrain_serializer* serializer, mip_gnss_gps_iono_corr_data* self); +bool extract_mip_gnss_gps_iono_corr_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_gnss_galileo_iono_corr (0x81,0x73) Galileo Iono Corr [C] +///@defgroup gnss_galileo_iono_corr_c (0x81,0x73) Galileo Iono Corr /// Ionospheric Correction Terms for Galileo /// ///@{ @@ -1393,6 +1757,17 @@ static const mip_gnss_galileo_iono_corr_data_valid_flags MIP_GNSS_GALILEO_IONO_C static const mip_gnss_galileo_iono_corr_data_valid_flags MIP_GNSS_GALILEO_IONO_CORR_DATA_VALID_FLAGS_DISTURBANCE_FLAGS = 0x0008; ///< static const mip_gnss_galileo_iono_corr_data_valid_flags MIP_GNSS_GALILEO_IONO_CORR_DATA_VALID_FLAGS_FLAGS = 0x000F; ///< static const mip_gnss_galileo_iono_corr_data_valid_flags MIP_GNSS_GALILEO_IONO_CORR_DATA_VALID_FLAGS_ALL = 0x000F; +static inline void insert_mip_gnss_galileo_iono_corr_data_valid_flags(microstrain_serializer* serializer, const mip_gnss_galileo_iono_corr_data_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_gnss_galileo_iono_corr_data_valid_flags(microstrain_serializer* serializer, mip_gnss_galileo_iono_corr_data_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_gnss_galileo_iono_corr_data { @@ -1401,15 +1776,12 @@ struct mip_gnss_galileo_iono_corr_data mip_vector3d alpha; ///< Coefficients for the model. uint8_t disturbance_flags; ///< Region disturbance flags (bits 1-5). mip_gnss_galileo_iono_corr_data_valid_flags valid_flags; - }; typedef struct mip_gnss_galileo_iono_corr_data mip_gnss_galileo_iono_corr_data; -void insert_mip_gnss_galileo_iono_corr_data(struct mip_serializer* serializer, const mip_gnss_galileo_iono_corr_data* self); -void extract_mip_gnss_galileo_iono_corr_data(struct mip_serializer* serializer, mip_gnss_galileo_iono_corr_data* self); -bool extract_mip_gnss_galileo_iono_corr_data_from_field(const struct mip_field* field, void* ptr); -void insert_mip_gnss_galileo_iono_corr_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_galileo_iono_corr_data_valid_flags self); -void extract_mip_gnss_galileo_iono_corr_data_valid_flags(struct mip_serializer* serializer, mip_gnss_galileo_iono_corr_data_valid_flags* self); +void insert_mip_gnss_galileo_iono_corr_data(microstrain_serializer* serializer, const mip_gnss_galileo_iono_corr_data* self); +void extract_mip_gnss_galileo_iono_corr_data(microstrain_serializer* serializer, mip_gnss_galileo_iono_corr_data* self); +bool extract_mip_gnss_galileo_iono_corr_data_from_field(const mip_field_view* field, void* ptr); ///@} @@ -1420,8 +1792,8 @@ void extract_mip_gnss_galileo_iono_corr_data_valid_flags(struct mip_serializer* /// //////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus +} // extern "C" } // namespace C } // namespace mip -} // extern "C" #endif // __cplusplus diff --git a/src/c/mip/definitions/data_sensor.c b/src/c/mip/definitions/data_sensor.c new file mode 100644 index 000000000..776ad480b --- /dev/null +++ b/src/c/mip/definitions/data_sensor.c @@ -0,0 +1,526 @@ + +#include "data_sensor.h" + +#include +#include + +#include + + +#ifdef __cplusplus +namespace mip { +namespace C { +extern "C" { + +#endif // __cplusplus + + +//////////////////////////////////////////////////////////////////////////////// +// Mip Fields +//////////////////////////////////////////////////////////////////////////////// + +void insert_mip_sensor_raw_accel_data(microstrain_serializer* serializer, const mip_sensor_raw_accel_data* self) +{ + insert_mip_vector3f(serializer, self->raw_accel); + +} +void extract_mip_sensor_raw_accel_data(microstrain_serializer* serializer, mip_sensor_raw_accel_data* self) +{ + extract_mip_vector3f(serializer, self->raw_accel); + +} +bool extract_mip_sensor_raw_accel_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_sensor_raw_accel_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_sensor_raw_accel_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_sensor_raw_gyro_data(microstrain_serializer* serializer, const mip_sensor_raw_gyro_data* self) +{ + insert_mip_vector3f(serializer, self->raw_gyro); + +} +void extract_mip_sensor_raw_gyro_data(microstrain_serializer* serializer, mip_sensor_raw_gyro_data* self) +{ + extract_mip_vector3f(serializer, self->raw_gyro); + +} +bool extract_mip_sensor_raw_gyro_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_sensor_raw_gyro_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_sensor_raw_gyro_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_sensor_raw_mag_data(microstrain_serializer* serializer, const mip_sensor_raw_mag_data* self) +{ + insert_mip_vector3f(serializer, self->raw_mag); + +} +void extract_mip_sensor_raw_mag_data(microstrain_serializer* serializer, mip_sensor_raw_mag_data* self) +{ + extract_mip_vector3f(serializer, self->raw_mag); + +} +bool extract_mip_sensor_raw_mag_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_sensor_raw_mag_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_sensor_raw_mag_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_sensor_raw_pressure_data(microstrain_serializer* serializer, const mip_sensor_raw_pressure_data* self) +{ + microstrain_insert_float(serializer, self->raw_pressure); + +} +void extract_mip_sensor_raw_pressure_data(microstrain_serializer* serializer, mip_sensor_raw_pressure_data* self) +{ + microstrain_extract_float(serializer, &self->raw_pressure); + +} +bool extract_mip_sensor_raw_pressure_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_sensor_raw_pressure_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_sensor_raw_pressure_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_sensor_scaled_accel_data(microstrain_serializer* serializer, const mip_sensor_scaled_accel_data* self) +{ + insert_mip_vector3f(serializer, self->scaled_accel); + +} +void extract_mip_sensor_scaled_accel_data(microstrain_serializer* serializer, mip_sensor_scaled_accel_data* self) +{ + extract_mip_vector3f(serializer, self->scaled_accel); + +} +bool extract_mip_sensor_scaled_accel_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_sensor_scaled_accel_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_sensor_scaled_accel_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_sensor_scaled_gyro_data(microstrain_serializer* serializer, const mip_sensor_scaled_gyro_data* self) +{ + insert_mip_vector3f(serializer, self->scaled_gyro); + +} +void extract_mip_sensor_scaled_gyro_data(microstrain_serializer* serializer, mip_sensor_scaled_gyro_data* self) +{ + extract_mip_vector3f(serializer, self->scaled_gyro); + +} +bool extract_mip_sensor_scaled_gyro_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_sensor_scaled_gyro_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_sensor_scaled_gyro_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_sensor_scaled_mag_data(microstrain_serializer* serializer, const mip_sensor_scaled_mag_data* self) +{ + insert_mip_vector3f(serializer, self->scaled_mag); + +} +void extract_mip_sensor_scaled_mag_data(microstrain_serializer* serializer, mip_sensor_scaled_mag_data* self) +{ + extract_mip_vector3f(serializer, self->scaled_mag); + +} +bool extract_mip_sensor_scaled_mag_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_sensor_scaled_mag_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_sensor_scaled_mag_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_sensor_scaled_pressure_data(microstrain_serializer* serializer, const mip_sensor_scaled_pressure_data* self) +{ + microstrain_insert_float(serializer, self->scaled_pressure); + +} +void extract_mip_sensor_scaled_pressure_data(microstrain_serializer* serializer, mip_sensor_scaled_pressure_data* self) +{ + microstrain_extract_float(serializer, &self->scaled_pressure); + +} +bool extract_mip_sensor_scaled_pressure_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_sensor_scaled_pressure_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_sensor_scaled_pressure_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_sensor_delta_theta_data(microstrain_serializer* serializer, const mip_sensor_delta_theta_data* self) +{ + insert_mip_vector3f(serializer, self->delta_theta); + +} +void extract_mip_sensor_delta_theta_data(microstrain_serializer* serializer, mip_sensor_delta_theta_data* self) +{ + extract_mip_vector3f(serializer, self->delta_theta); + +} +bool extract_mip_sensor_delta_theta_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_sensor_delta_theta_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_sensor_delta_theta_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_sensor_delta_velocity_data(microstrain_serializer* serializer, const mip_sensor_delta_velocity_data* self) +{ + insert_mip_vector3f(serializer, self->delta_velocity); + +} +void extract_mip_sensor_delta_velocity_data(microstrain_serializer* serializer, mip_sensor_delta_velocity_data* self) +{ + extract_mip_vector3f(serializer, self->delta_velocity); + +} +bool extract_mip_sensor_delta_velocity_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_sensor_delta_velocity_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_sensor_delta_velocity_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_sensor_comp_orientation_matrix_data(microstrain_serializer* serializer, const mip_sensor_comp_orientation_matrix_data* self) +{ + insert_mip_matrix3f(serializer, self->m); + +} +void extract_mip_sensor_comp_orientation_matrix_data(microstrain_serializer* serializer, mip_sensor_comp_orientation_matrix_data* self) +{ + extract_mip_matrix3f(serializer, self->m); + +} +bool extract_mip_sensor_comp_orientation_matrix_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_sensor_comp_orientation_matrix_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_sensor_comp_orientation_matrix_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_sensor_comp_quaternion_data(microstrain_serializer* serializer, const mip_sensor_comp_quaternion_data* self) +{ + insert_mip_quatf(serializer, self->q); + +} +void extract_mip_sensor_comp_quaternion_data(microstrain_serializer* serializer, mip_sensor_comp_quaternion_data* self) +{ + extract_mip_quatf(serializer, self->q); + +} +bool extract_mip_sensor_comp_quaternion_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_sensor_comp_quaternion_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_sensor_comp_quaternion_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_sensor_comp_euler_angles_data(microstrain_serializer* serializer, const mip_sensor_comp_euler_angles_data* self) +{ + microstrain_insert_float(serializer, self->roll); + + microstrain_insert_float(serializer, self->pitch); + + microstrain_insert_float(serializer, self->yaw); + +} +void extract_mip_sensor_comp_euler_angles_data(microstrain_serializer* serializer, mip_sensor_comp_euler_angles_data* self) +{ + microstrain_extract_float(serializer, &self->roll); + + microstrain_extract_float(serializer, &self->pitch); + + microstrain_extract_float(serializer, &self->yaw); + +} +bool extract_mip_sensor_comp_euler_angles_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_sensor_comp_euler_angles_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_sensor_comp_euler_angles_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_sensor_comp_orientation_update_matrix_data(microstrain_serializer* serializer, const mip_sensor_comp_orientation_update_matrix_data* self) +{ + insert_mip_matrix3f(serializer, self->m); + +} +void extract_mip_sensor_comp_orientation_update_matrix_data(microstrain_serializer* serializer, mip_sensor_comp_orientation_update_matrix_data* self) +{ + extract_mip_matrix3f(serializer, self->m); + +} +bool extract_mip_sensor_comp_orientation_update_matrix_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_sensor_comp_orientation_update_matrix_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_sensor_comp_orientation_update_matrix_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_sensor_orientation_raw_temp_data(microstrain_serializer* serializer, const mip_sensor_orientation_raw_temp_data* self) +{ + for(unsigned int i=0; i < 4; i++) + microstrain_insert_u16(serializer, self->raw_temp[i]); + +} +void extract_mip_sensor_orientation_raw_temp_data(microstrain_serializer* serializer, mip_sensor_orientation_raw_temp_data* self) +{ + for(unsigned int i=0; i < 4; i++) + microstrain_extract_u16(serializer, &self->raw_temp[i]); + +} +bool extract_mip_sensor_orientation_raw_temp_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_sensor_orientation_raw_temp_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_sensor_orientation_raw_temp_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_sensor_internal_timestamp_data(microstrain_serializer* serializer, const mip_sensor_internal_timestamp_data* self) +{ + microstrain_insert_u32(serializer, self->counts); + +} +void extract_mip_sensor_internal_timestamp_data(microstrain_serializer* serializer, mip_sensor_internal_timestamp_data* self) +{ + microstrain_extract_u32(serializer, &self->counts); + +} +bool extract_mip_sensor_internal_timestamp_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_sensor_internal_timestamp_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_sensor_internal_timestamp_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_sensor_pps_timestamp_data(microstrain_serializer* serializer, const mip_sensor_pps_timestamp_data* self) +{ + microstrain_insert_u32(serializer, self->seconds); + + microstrain_insert_u32(serializer, self->useconds); + +} +void extract_mip_sensor_pps_timestamp_data(microstrain_serializer* serializer, mip_sensor_pps_timestamp_data* self) +{ + microstrain_extract_u32(serializer, &self->seconds); + + microstrain_extract_u32(serializer, &self->useconds); + +} +bool extract_mip_sensor_pps_timestamp_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_sensor_pps_timestamp_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_sensor_pps_timestamp_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_sensor_gps_timestamp_data(microstrain_serializer* serializer, const mip_sensor_gps_timestamp_data* self) +{ + microstrain_insert_double(serializer, self->tow); + + microstrain_insert_u16(serializer, self->week_number); + + insert_mip_sensor_gps_timestamp_data_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_sensor_gps_timestamp_data(microstrain_serializer* serializer, mip_sensor_gps_timestamp_data* self) +{ + microstrain_extract_double(serializer, &self->tow); + + microstrain_extract_u16(serializer, &self->week_number); + + extract_mip_sensor_gps_timestamp_data_valid_flags(serializer, &self->valid_flags); + +} +bool extract_mip_sensor_gps_timestamp_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_sensor_gps_timestamp_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_sensor_gps_timestamp_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_sensor_temperature_abs_data(microstrain_serializer* serializer, const mip_sensor_temperature_abs_data* self) +{ + microstrain_insert_float(serializer, self->min_temp); + + microstrain_insert_float(serializer, self->max_temp); + + microstrain_insert_float(serializer, self->mean_temp); + +} +void extract_mip_sensor_temperature_abs_data(microstrain_serializer* serializer, mip_sensor_temperature_abs_data* self) +{ + microstrain_extract_float(serializer, &self->min_temp); + + microstrain_extract_float(serializer, &self->max_temp); + + microstrain_extract_float(serializer, &self->mean_temp); + +} +bool extract_mip_sensor_temperature_abs_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_sensor_temperature_abs_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_sensor_temperature_abs_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_sensor_up_vector_data(microstrain_serializer* serializer, const mip_sensor_up_vector_data* self) +{ + insert_mip_vector3f(serializer, self->up); + +} +void extract_mip_sensor_up_vector_data(microstrain_serializer* serializer, mip_sensor_up_vector_data* self) +{ + extract_mip_vector3f(serializer, self->up); + +} +bool extract_mip_sensor_up_vector_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_sensor_up_vector_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_sensor_up_vector_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_sensor_north_vector_data(microstrain_serializer* serializer, const mip_sensor_north_vector_data* self) +{ + insert_mip_vector3f(serializer, self->north); + +} +void extract_mip_sensor_north_vector_data(microstrain_serializer* serializer, mip_sensor_north_vector_data* self) +{ + extract_mip_vector3f(serializer, self->north); + +} +bool extract_mip_sensor_north_vector_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_sensor_north_vector_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_sensor_north_vector_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_sensor_overrange_status_data(microstrain_serializer* serializer, const mip_sensor_overrange_status_data* self) +{ + insert_mip_sensor_overrange_status_data_status(serializer, self->status); + +} +void extract_mip_sensor_overrange_status_data(microstrain_serializer* serializer, mip_sensor_overrange_status_data* self) +{ + extract_mip_sensor_overrange_status_data_status(serializer, &self->status); + +} +bool extract_mip_sensor_overrange_status_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_sensor_overrange_status_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_sensor_overrange_status_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_sensor_odometer_data_data(microstrain_serializer* serializer, const mip_sensor_odometer_data_data* self) +{ + microstrain_insert_float(serializer, self->speed); + + microstrain_insert_float(serializer, self->uncertainty); + + microstrain_insert_u16(serializer, self->valid_flags); + +} +void extract_mip_sensor_odometer_data_data(microstrain_serializer* serializer, mip_sensor_odometer_data_data* self) +{ + microstrain_extract_float(serializer, &self->speed); + + microstrain_extract_float(serializer, &self->uncertainty); + + microstrain_extract_u16(serializer, &self->valid_flags); + +} +bool extract_mip_sensor_odometer_data_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_sensor_odometer_data_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_sensor_odometer_data_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + + +#ifdef __cplusplus +} // extern "C" +} // namespace C +} // namespace mip +#endif // __cplusplus + diff --git a/src/mip/definitions/data_sensor.h b/src/c/mip/definitions/data_sensor.h similarity index 62% rename from src/mip/definitions/data_sensor.h rename to src/c/mip/definitions/data_sensor.h index bae38d0a0..d2d35497d 100644 --- a/src/mip/definitions/data_sensor.h +++ b/src/c/mip/definitions/data_sensor.h @@ -1,8 +1,9 @@ #pragma once -#include "common.h" -#include "descriptors.h" -#include "../mip_result.h" +#include +#include +#include +#include #include #include @@ -14,14 +15,11 @@ namespace C { extern "C" { #endif // __cplusplus -struct mip_interface; -struct mip_serializer; -struct mip_field; //////////////////////////////////////////////////////////////////////////////// -///@addtogroup MipData_c MIP Data [C] +///@addtogroup MipData_c ///@{ -///@defgroup sensor_data_c Sensor Data [C] +///@defgroup sensor_data_c Sensor Data /// ///@{ @@ -72,7 +70,7 @@ enum //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_sensor_raw_accel (0x80,0x01) Raw Accel [C] +///@defgroup sensor_raw_accel_c (0x80,0x01) Raw Accel /// Three element vector representing the sensed acceleration. /// This quantity is temperature compensated and expressed in the sensor body frame. /// @@ -81,18 +79,18 @@ enum struct mip_sensor_raw_accel_data { mip_vector3f raw_accel; ///< Native sensor counts - }; typedef struct mip_sensor_raw_accel_data mip_sensor_raw_accel_data; -void insert_mip_sensor_raw_accel_data(struct mip_serializer* serializer, const mip_sensor_raw_accel_data* self); -void extract_mip_sensor_raw_accel_data(struct mip_serializer* serializer, mip_sensor_raw_accel_data* self); -bool extract_mip_sensor_raw_accel_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_sensor_raw_accel_data(microstrain_serializer* serializer, const mip_sensor_raw_accel_data* self); +void extract_mip_sensor_raw_accel_data(microstrain_serializer* serializer, mip_sensor_raw_accel_data* self); +bool extract_mip_sensor_raw_accel_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_sensor_raw_gyro (0x80,0x02) Raw Gyro [C] +///@defgroup sensor_raw_gyro_c (0x80,0x02) Raw Gyro /// Three element vector representing the sensed angular rate. /// This quantity is temperature compensated and expressed in the sensor body frame. /// @@ -101,18 +99,18 @@ bool extract_mip_sensor_raw_accel_data_from_field(const struct mip_field* field, struct mip_sensor_raw_gyro_data { mip_vector3f raw_gyro; ///< Native sensor counts - }; typedef struct mip_sensor_raw_gyro_data mip_sensor_raw_gyro_data; -void insert_mip_sensor_raw_gyro_data(struct mip_serializer* serializer, const mip_sensor_raw_gyro_data* self); -void extract_mip_sensor_raw_gyro_data(struct mip_serializer* serializer, mip_sensor_raw_gyro_data* self); -bool extract_mip_sensor_raw_gyro_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_sensor_raw_gyro_data(microstrain_serializer* serializer, const mip_sensor_raw_gyro_data* self); +void extract_mip_sensor_raw_gyro_data(microstrain_serializer* serializer, mip_sensor_raw_gyro_data* self); +bool extract_mip_sensor_raw_gyro_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_sensor_raw_mag (0x80,0x03) Raw Mag [C] +///@defgroup sensor_raw_mag_c (0x80,0x03) Raw Mag /// Three element vector representing the sensed magnetic field. /// This quantity is temperature compensated and expressed in the vehicle frame. /// @@ -121,18 +119,18 @@ bool extract_mip_sensor_raw_gyro_data_from_field(const struct mip_field* field, struct mip_sensor_raw_mag_data { mip_vector3f raw_mag; ///< Native sensor counts - }; typedef struct mip_sensor_raw_mag_data mip_sensor_raw_mag_data; -void insert_mip_sensor_raw_mag_data(struct mip_serializer* serializer, const mip_sensor_raw_mag_data* self); -void extract_mip_sensor_raw_mag_data(struct mip_serializer* serializer, mip_sensor_raw_mag_data* self); -bool extract_mip_sensor_raw_mag_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_sensor_raw_mag_data(microstrain_serializer* serializer, const mip_sensor_raw_mag_data* self); +void extract_mip_sensor_raw_mag_data(microstrain_serializer* serializer, mip_sensor_raw_mag_data* self); +bool extract_mip_sensor_raw_mag_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_sensor_raw_pressure (0x80,0x16) Raw Pressure [C] +///@defgroup sensor_raw_pressure_c (0x80,0x16) Raw Pressure /// Scalar value representing the sensed ambient pressure. /// This quantity is temperature compensated. /// @@ -141,18 +139,18 @@ bool extract_mip_sensor_raw_mag_data_from_field(const struct mip_field* field, v struct mip_sensor_raw_pressure_data { float raw_pressure; ///< Native sensor counts - }; typedef struct mip_sensor_raw_pressure_data mip_sensor_raw_pressure_data; -void insert_mip_sensor_raw_pressure_data(struct mip_serializer* serializer, const mip_sensor_raw_pressure_data* self); -void extract_mip_sensor_raw_pressure_data(struct mip_serializer* serializer, mip_sensor_raw_pressure_data* self); -bool extract_mip_sensor_raw_pressure_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_sensor_raw_pressure_data(microstrain_serializer* serializer, const mip_sensor_raw_pressure_data* self); +void extract_mip_sensor_raw_pressure_data(microstrain_serializer* serializer, mip_sensor_raw_pressure_data* self); +bool extract_mip_sensor_raw_pressure_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_sensor_scaled_accel (0x80,0x04) Scaled Accel [C] +///@defgroup sensor_scaled_accel_c (0x80,0x04) Scaled Accel /// 3-element vector representing the sensed acceleration. /// This quantity is temperature compensated and expressed in the vehicle frame. /// @@ -161,18 +159,18 @@ bool extract_mip_sensor_raw_pressure_data_from_field(const struct mip_field* fie struct mip_sensor_scaled_accel_data { mip_vector3f scaled_accel; ///< (x, y, z)[g] - }; typedef struct mip_sensor_scaled_accel_data mip_sensor_scaled_accel_data; -void insert_mip_sensor_scaled_accel_data(struct mip_serializer* serializer, const mip_sensor_scaled_accel_data* self); -void extract_mip_sensor_scaled_accel_data(struct mip_serializer* serializer, mip_sensor_scaled_accel_data* self); -bool extract_mip_sensor_scaled_accel_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_sensor_scaled_accel_data(microstrain_serializer* serializer, const mip_sensor_scaled_accel_data* self); +void extract_mip_sensor_scaled_accel_data(microstrain_serializer* serializer, mip_sensor_scaled_accel_data* self); +bool extract_mip_sensor_scaled_accel_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_sensor_scaled_gyro (0x80,0x05) Scaled Gyro [C] +///@defgroup sensor_scaled_gyro_c (0x80,0x05) Scaled Gyro /// 3-element vector representing the sensed angular rate. /// This quantity is temperature compensated and expressed in the vehicle frame. /// @@ -181,18 +179,18 @@ bool extract_mip_sensor_scaled_accel_data_from_field(const struct mip_field* fie struct mip_sensor_scaled_gyro_data { mip_vector3f scaled_gyro; ///< (x, y, z) [radians/second] - }; typedef struct mip_sensor_scaled_gyro_data mip_sensor_scaled_gyro_data; -void insert_mip_sensor_scaled_gyro_data(struct mip_serializer* serializer, const mip_sensor_scaled_gyro_data* self); -void extract_mip_sensor_scaled_gyro_data(struct mip_serializer* serializer, mip_sensor_scaled_gyro_data* self); -bool extract_mip_sensor_scaled_gyro_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_sensor_scaled_gyro_data(microstrain_serializer* serializer, const mip_sensor_scaled_gyro_data* self); +void extract_mip_sensor_scaled_gyro_data(microstrain_serializer* serializer, mip_sensor_scaled_gyro_data* self); +bool extract_mip_sensor_scaled_gyro_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_sensor_scaled_mag (0x80,0x06) Scaled Mag [C] +///@defgroup sensor_scaled_mag_c (0x80,0x06) Scaled Mag /// 3-element vector representing the sensed magnetic field. /// This quantity is temperature compensated and expressed in the vehicle frame. /// @@ -201,18 +199,18 @@ bool extract_mip_sensor_scaled_gyro_data_from_field(const struct mip_field* fiel struct mip_sensor_scaled_mag_data { mip_vector3f scaled_mag; ///< (x, y, z) [Gauss] - }; typedef struct mip_sensor_scaled_mag_data mip_sensor_scaled_mag_data; -void insert_mip_sensor_scaled_mag_data(struct mip_serializer* serializer, const mip_sensor_scaled_mag_data* self); -void extract_mip_sensor_scaled_mag_data(struct mip_serializer* serializer, mip_sensor_scaled_mag_data* self); -bool extract_mip_sensor_scaled_mag_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_sensor_scaled_mag_data(microstrain_serializer* serializer, const mip_sensor_scaled_mag_data* self); +void extract_mip_sensor_scaled_mag_data(microstrain_serializer* serializer, mip_sensor_scaled_mag_data* self); +bool extract_mip_sensor_scaled_mag_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_sensor_scaled_pressure (0x80,0x17) Scaled Pressure [C] +///@defgroup sensor_scaled_pressure_c (0x80,0x17) Scaled Pressure /// Scalar value representing the sensed ambient pressure. /// ///@{ @@ -220,18 +218,18 @@ bool extract_mip_sensor_scaled_mag_data_from_field(const struct mip_field* field struct mip_sensor_scaled_pressure_data { float scaled_pressure; ///< [mBar] - }; typedef struct mip_sensor_scaled_pressure_data mip_sensor_scaled_pressure_data; -void insert_mip_sensor_scaled_pressure_data(struct mip_serializer* serializer, const mip_sensor_scaled_pressure_data* self); -void extract_mip_sensor_scaled_pressure_data(struct mip_serializer* serializer, mip_sensor_scaled_pressure_data* self); -bool extract_mip_sensor_scaled_pressure_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_sensor_scaled_pressure_data(microstrain_serializer* serializer, const mip_sensor_scaled_pressure_data* self); +void extract_mip_sensor_scaled_pressure_data(microstrain_serializer* serializer, mip_sensor_scaled_pressure_data* self); +bool extract_mip_sensor_scaled_pressure_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_sensor_delta_theta (0x80,0x07) Delta Theta [C] +///@defgroup sensor_delta_theta_c (0x80,0x07) Delta Theta /// 3-element vector representing the time integral of angular rate. /// This quantity is the integral of sensed angular rate over the period set by the IMU message format. It is expressed in the vehicle frame. /// @@ -240,18 +238,18 @@ bool extract_mip_sensor_scaled_pressure_data_from_field(const struct mip_field* struct mip_sensor_delta_theta_data { mip_vector3f delta_theta; ///< (x, y, z) [radians] - }; typedef struct mip_sensor_delta_theta_data mip_sensor_delta_theta_data; -void insert_mip_sensor_delta_theta_data(struct mip_serializer* serializer, const mip_sensor_delta_theta_data* self); -void extract_mip_sensor_delta_theta_data(struct mip_serializer* serializer, mip_sensor_delta_theta_data* self); -bool extract_mip_sensor_delta_theta_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_sensor_delta_theta_data(microstrain_serializer* serializer, const mip_sensor_delta_theta_data* self); +void extract_mip_sensor_delta_theta_data(microstrain_serializer* serializer, mip_sensor_delta_theta_data* self); +bool extract_mip_sensor_delta_theta_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_sensor_delta_velocity (0x80,0x08) Delta Velocity [C] +///@defgroup sensor_delta_velocity_c (0x80,0x08) Delta Velocity /// 3-element vector representing the time integral of acceleration. /// This quantity is the integral of sensed acceleration over the period set by the IMU message format. It is expressed in the vehicle frame. /// @@ -260,18 +258,18 @@ bool extract_mip_sensor_delta_theta_data_from_field(const struct mip_field* fiel struct mip_sensor_delta_velocity_data { mip_vector3f delta_velocity; ///< (x, y, z) [g*sec] - }; typedef struct mip_sensor_delta_velocity_data mip_sensor_delta_velocity_data; -void insert_mip_sensor_delta_velocity_data(struct mip_serializer* serializer, const mip_sensor_delta_velocity_data* self); -void extract_mip_sensor_delta_velocity_data(struct mip_serializer* serializer, mip_sensor_delta_velocity_data* self); -bool extract_mip_sensor_delta_velocity_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_sensor_delta_velocity_data(microstrain_serializer* serializer, const mip_sensor_delta_velocity_data* self); +void extract_mip_sensor_delta_velocity_data(microstrain_serializer* serializer, mip_sensor_delta_velocity_data* self); +bool extract_mip_sensor_delta_velocity_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_sensor_comp_orientation_matrix (0x80,0x09) Comp Orientation Matrix [C] +///@defgroup sensor_comp_orientation_matrix_c (0x80,0x09) Comp Orientation Matrix /// 3x3 Direction Cosine Matrix EQSTART M_{ned}^{veh} EQEND describing the orientation of the device with respect to the NED local-level frame. /// This matrix satisfies the following relationship: /// @@ -282,25 +280,25 @@ bool extract_mip_sensor_delta_velocity_data_from_field(const struct mip_field* f /// EQSTART v^{ned} EQEND is a 3-element vector expressed in the NED frame.
/// EQSTART v^{veh} EQEND is the same 3-element vector expressed in the vehicle frame.
///
-/// The matrix elements are stored is row-major order: EQSTART M = \begin{bmatrix} M_{11}, M_{12}, M_{13}, M_{21}, M_{22}, M_{23}, M_{31}, M_{32}, M_{33} \end{bmatrix} EQEND +/// The matrix elements are stored is row-major order: EQSTART M = \\begin{bmatrix} M_{11}, M_{12}, M_{13}, M_{21}, M_{22}, M_{23}, M_{31}, M_{32}, M_{33} \\end{bmatrix} EQEND /// ///@{ struct mip_sensor_comp_orientation_matrix_data { mip_matrix3f m; ///< Matrix elements in row-major order. - }; typedef struct mip_sensor_comp_orientation_matrix_data mip_sensor_comp_orientation_matrix_data; -void insert_mip_sensor_comp_orientation_matrix_data(struct mip_serializer* serializer, const mip_sensor_comp_orientation_matrix_data* self); -void extract_mip_sensor_comp_orientation_matrix_data(struct mip_serializer* serializer, mip_sensor_comp_orientation_matrix_data* self); -bool extract_mip_sensor_comp_orientation_matrix_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_sensor_comp_orientation_matrix_data(microstrain_serializer* serializer, const mip_sensor_comp_orientation_matrix_data* self); +void extract_mip_sensor_comp_orientation_matrix_data(microstrain_serializer* serializer, mip_sensor_comp_orientation_matrix_data* self); +bool extract_mip_sensor_comp_orientation_matrix_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_sensor_comp_quaternion (0x80,0x0A) Comp Quaternion [C] +///@defgroup sensor_comp_quaternion_c (0x80,0x0A) Comp Quaternion /// 4x1 vector representation of the quaternion describing the orientation of the device with respect to the NED local-level frame. /// This quaternion satisfies the following relationship: /// @@ -316,18 +314,18 @@ bool extract_mip_sensor_comp_orientation_matrix_data_from_field(const struct mip struct mip_sensor_comp_quaternion_data { mip_quatf q; ///< Quaternion elements EQSTART q = (q_w, q_x, q_y, q_z) EQEND - }; typedef struct mip_sensor_comp_quaternion_data mip_sensor_comp_quaternion_data; -void insert_mip_sensor_comp_quaternion_data(struct mip_serializer* serializer, const mip_sensor_comp_quaternion_data* self); -void extract_mip_sensor_comp_quaternion_data(struct mip_serializer* serializer, mip_sensor_comp_quaternion_data* self); -bool extract_mip_sensor_comp_quaternion_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_sensor_comp_quaternion_data(microstrain_serializer* serializer, const mip_sensor_comp_quaternion_data* self); +void extract_mip_sensor_comp_quaternion_data(microstrain_serializer* serializer, mip_sensor_comp_quaternion_data* self); +bool extract_mip_sensor_comp_quaternion_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_sensor_comp_euler_angles (0x80,0x0C) Comp Euler Angles [C] +///@defgroup sensor_comp_euler_angles_c (0x80,0x0C) Comp Euler Angles /// Euler angles describing the orientation of the device with respect to the NED local-level frame. /// The Euler angles are reported in 3-2-1 (Yaw-Pitch-Roll, AKA Aircraft) order. /// @@ -338,18 +336,18 @@ struct mip_sensor_comp_euler_angles_data float roll; ///< [radians] float pitch; ///< [radians] float yaw; ///< [radians] - }; typedef struct mip_sensor_comp_euler_angles_data mip_sensor_comp_euler_angles_data; -void insert_mip_sensor_comp_euler_angles_data(struct mip_serializer* serializer, const mip_sensor_comp_euler_angles_data* self); -void extract_mip_sensor_comp_euler_angles_data(struct mip_serializer* serializer, mip_sensor_comp_euler_angles_data* self); -bool extract_mip_sensor_comp_euler_angles_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_sensor_comp_euler_angles_data(microstrain_serializer* serializer, const mip_sensor_comp_euler_angles_data* self); +void extract_mip_sensor_comp_euler_angles_data(microstrain_serializer* serializer, mip_sensor_comp_euler_angles_data* self); +bool extract_mip_sensor_comp_euler_angles_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_sensor_comp_orientation_update_matrix (0x80,0x0B) Comp Orientation Update Matrix [C] +///@defgroup sensor_comp_orientation_update_matrix_c (0x80,0x0B) Comp Orientation Update Matrix /// DEPRECATED! /// ///@{ @@ -357,18 +355,18 @@ bool extract_mip_sensor_comp_euler_angles_data_from_field(const struct mip_field struct mip_sensor_comp_orientation_update_matrix_data { mip_matrix3f m; - }; typedef struct mip_sensor_comp_orientation_update_matrix_data mip_sensor_comp_orientation_update_matrix_data; -void insert_mip_sensor_comp_orientation_update_matrix_data(struct mip_serializer* serializer, const mip_sensor_comp_orientation_update_matrix_data* self); -void extract_mip_sensor_comp_orientation_update_matrix_data(struct mip_serializer* serializer, mip_sensor_comp_orientation_update_matrix_data* self); -bool extract_mip_sensor_comp_orientation_update_matrix_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_sensor_comp_orientation_update_matrix_data(microstrain_serializer* serializer, const mip_sensor_comp_orientation_update_matrix_data* self); +void extract_mip_sensor_comp_orientation_update_matrix_data(microstrain_serializer* serializer, mip_sensor_comp_orientation_update_matrix_data* self); +bool extract_mip_sensor_comp_orientation_update_matrix_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_sensor_orientation_raw_temp (0x80,0x0D) Orientation Raw Temp [C] +///@defgroup sensor_orientation_raw_temp_c (0x80,0x0D) Orientation Raw Temp /// DEPRECATED! /// ///@{ @@ -376,18 +374,18 @@ bool extract_mip_sensor_comp_orientation_update_matrix_data_from_field(const str struct mip_sensor_orientation_raw_temp_data { uint16_t raw_temp[4]; - }; typedef struct mip_sensor_orientation_raw_temp_data mip_sensor_orientation_raw_temp_data; -void insert_mip_sensor_orientation_raw_temp_data(struct mip_serializer* serializer, const mip_sensor_orientation_raw_temp_data* self); -void extract_mip_sensor_orientation_raw_temp_data(struct mip_serializer* serializer, mip_sensor_orientation_raw_temp_data* self); -bool extract_mip_sensor_orientation_raw_temp_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_sensor_orientation_raw_temp_data(microstrain_serializer* serializer, const mip_sensor_orientation_raw_temp_data* self); +void extract_mip_sensor_orientation_raw_temp_data(microstrain_serializer* serializer, mip_sensor_orientation_raw_temp_data* self); +bool extract_mip_sensor_orientation_raw_temp_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_sensor_internal_timestamp (0x80,0x0E) Internal Timestamp [C] +///@defgroup sensor_internal_timestamp_c (0x80,0x0E) Internal Timestamp /// DEPRECATED! /// ///@{ @@ -395,18 +393,18 @@ bool extract_mip_sensor_orientation_raw_temp_data_from_field(const struct mip_fi struct mip_sensor_internal_timestamp_data { uint32_t counts; - }; typedef struct mip_sensor_internal_timestamp_data mip_sensor_internal_timestamp_data; -void insert_mip_sensor_internal_timestamp_data(struct mip_serializer* serializer, const mip_sensor_internal_timestamp_data* self); -void extract_mip_sensor_internal_timestamp_data(struct mip_serializer* serializer, mip_sensor_internal_timestamp_data* self); -bool extract_mip_sensor_internal_timestamp_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_sensor_internal_timestamp_data(microstrain_serializer* serializer, const mip_sensor_internal_timestamp_data* self); +void extract_mip_sensor_internal_timestamp_data(microstrain_serializer* serializer, mip_sensor_internal_timestamp_data* self); +bool extract_mip_sensor_internal_timestamp_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_sensor_pps_timestamp (0x80,0x0F) Pps Timestamp [C] +///@defgroup sensor_pps_timestamp_c (0x80,0x0F) Pps Timestamp /// DEPRECATED! /// ///@{ @@ -415,18 +413,18 @@ struct mip_sensor_pps_timestamp_data { uint32_t seconds; uint32_t useconds; - }; typedef struct mip_sensor_pps_timestamp_data mip_sensor_pps_timestamp_data; -void insert_mip_sensor_pps_timestamp_data(struct mip_serializer* serializer, const mip_sensor_pps_timestamp_data* self); -void extract_mip_sensor_pps_timestamp_data(struct mip_serializer* serializer, mip_sensor_pps_timestamp_data* self); -bool extract_mip_sensor_pps_timestamp_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_sensor_pps_timestamp_data(microstrain_serializer* serializer, const mip_sensor_pps_timestamp_data* self); +void extract_mip_sensor_pps_timestamp_data(microstrain_serializer* serializer, mip_sensor_pps_timestamp_data* self); +bool extract_mip_sensor_pps_timestamp_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_sensor_gps_timestamp (0x80,0x12) Gps Timestamp [C] +///@defgroup sensor_gps_timestamp_c (0x80,0x12) Gps Timestamp /// GPS timestamp of the SENSOR data /// /// Should the PPS become unavailable, the device will revert to its internal clock, which will cause the reported time to drift from true GPS time. @@ -445,27 +443,35 @@ static const mip_sensor_gps_timestamp_data_valid_flags MIP_SENSOR_GPS_TIMESTAMP_ static const mip_sensor_gps_timestamp_data_valid_flags MIP_SENSOR_GPS_TIMESTAMP_DATA_VALID_FLAGS_TOW_VALID = 0x0008; ///< True if the time of week is valid. static const mip_sensor_gps_timestamp_data_valid_flags MIP_SENSOR_GPS_TIMESTAMP_DATA_VALID_FLAGS_WEEK_NUMBER_VALID = 0x0010; ///< True if the week number is valid. static const mip_sensor_gps_timestamp_data_valid_flags MIP_SENSOR_GPS_TIMESTAMP_DATA_VALID_FLAGS_ALL = 0x001F; +static inline void insert_mip_sensor_gps_timestamp_data_valid_flags(microstrain_serializer* serializer, const mip_sensor_gps_timestamp_data_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_sensor_gps_timestamp_data_valid_flags(microstrain_serializer* serializer, mip_sensor_gps_timestamp_data_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_sensor_gps_timestamp_data { double tow; ///< GPS Time of Week [seconds] uint16_t week_number; ///< GPS Week Number since 1980 [weeks] mip_sensor_gps_timestamp_data_valid_flags valid_flags; - }; typedef struct mip_sensor_gps_timestamp_data mip_sensor_gps_timestamp_data; -void insert_mip_sensor_gps_timestamp_data(struct mip_serializer* serializer, const mip_sensor_gps_timestamp_data* self); -void extract_mip_sensor_gps_timestamp_data(struct mip_serializer* serializer, mip_sensor_gps_timestamp_data* self); -bool extract_mip_sensor_gps_timestamp_data_from_field(const struct mip_field* field, void* ptr); -void insert_mip_sensor_gps_timestamp_data_valid_flags(struct mip_serializer* serializer, const mip_sensor_gps_timestamp_data_valid_flags self); -void extract_mip_sensor_gps_timestamp_data_valid_flags(struct mip_serializer* serializer, mip_sensor_gps_timestamp_data_valid_flags* self); +void insert_mip_sensor_gps_timestamp_data(microstrain_serializer* serializer, const mip_sensor_gps_timestamp_data* self); +void extract_mip_sensor_gps_timestamp_data(microstrain_serializer* serializer, mip_sensor_gps_timestamp_data* self); +bool extract_mip_sensor_gps_timestamp_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_sensor_temperature_abs (0x80,0x14) Temperature Abs [C] +///@defgroup sensor_temperature_abs_c (0x80,0x14) Temperature Abs /// SENSOR reported temperature statistics /// /// Temperature may originate from the MEMS sensors, or be calculated in combination with board temperature sensors. @@ -479,18 +485,18 @@ struct mip_sensor_temperature_abs_data float min_temp; ///< [degC] float max_temp; ///< [degC] float mean_temp; ///< [degC] - }; typedef struct mip_sensor_temperature_abs_data mip_sensor_temperature_abs_data; -void insert_mip_sensor_temperature_abs_data(struct mip_serializer* serializer, const mip_sensor_temperature_abs_data* self); -void extract_mip_sensor_temperature_abs_data(struct mip_serializer* serializer, mip_sensor_temperature_abs_data* self); -bool extract_mip_sensor_temperature_abs_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_sensor_temperature_abs_data(microstrain_serializer* serializer, const mip_sensor_temperature_abs_data* self); +void extract_mip_sensor_temperature_abs_data(microstrain_serializer* serializer, mip_sensor_temperature_abs_data* self); +bool extract_mip_sensor_temperature_abs_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_sensor_up_vector (0x80,0x11) Up Vector [C] +///@defgroup sensor_up_vector_c (0x80,0x11) Up Vector /// Gyro-stabilized 3-element vector representing the complementary filter's estimated vertical direction. /// This quantity is expressed in the vehicle frame. /// @@ -504,18 +510,18 @@ bool extract_mip_sensor_temperature_abs_data_from_field(const struct mip_field* struct mip_sensor_up_vector_data { mip_vector3f up; ///< [Gs] - }; typedef struct mip_sensor_up_vector_data mip_sensor_up_vector_data; -void insert_mip_sensor_up_vector_data(struct mip_serializer* serializer, const mip_sensor_up_vector_data* self); -void extract_mip_sensor_up_vector_data(struct mip_serializer* serializer, mip_sensor_up_vector_data* self); -bool extract_mip_sensor_up_vector_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_sensor_up_vector_data(microstrain_serializer* serializer, const mip_sensor_up_vector_data* self); +void extract_mip_sensor_up_vector_data(microstrain_serializer* serializer, mip_sensor_up_vector_data* self); +bool extract_mip_sensor_up_vector_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_sensor_north_vector (0x80,0x10) North Vector [C] +///@defgroup sensor_north_vector_c (0x80,0x10) North Vector /// Gyro-stabilized 3-element vector representing the complementary filter's estimate of magnetic north. /// This quantity is expressed in the vehicle frame. /// @@ -526,18 +532,18 @@ bool extract_mip_sensor_up_vector_data_from_field(const struct mip_field* field, struct mip_sensor_north_vector_data { mip_vector3f north; ///< [Gauss] - }; typedef struct mip_sensor_north_vector_data mip_sensor_north_vector_data; -void insert_mip_sensor_north_vector_data(struct mip_serializer* serializer, const mip_sensor_north_vector_data* self); -void extract_mip_sensor_north_vector_data(struct mip_serializer* serializer, mip_sensor_north_vector_data* self); -bool extract_mip_sensor_north_vector_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_sensor_north_vector_data(microstrain_serializer* serializer, const mip_sensor_north_vector_data* self); +void extract_mip_sensor_north_vector_data(microstrain_serializer* serializer, mip_sensor_north_vector_data* self); +bool extract_mip_sensor_north_vector_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_sensor_overrange_status (0x80,0x18) Overrange Status [C] +///@defgroup sensor_overrange_status_c (0x80,0x18) Overrange Status /// ///@{ @@ -554,25 +560,33 @@ static const mip_sensor_overrange_status_data_status MIP_SENSOR_OVERRANGE_STATUS static const mip_sensor_overrange_status_data_status MIP_SENSOR_OVERRANGE_STATUS_DATA_STATUS_MAG_Z = 0x0400; ///< static const mip_sensor_overrange_status_data_status MIP_SENSOR_OVERRANGE_STATUS_DATA_STATUS_PRESS = 0x1000; ///< static const mip_sensor_overrange_status_data_status MIP_SENSOR_OVERRANGE_STATUS_DATA_STATUS_ALL = 0x1777; +static inline void insert_mip_sensor_overrange_status_data_status(microstrain_serializer* serializer, const mip_sensor_overrange_status_data_status self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_sensor_overrange_status_data_status(microstrain_serializer* serializer, mip_sensor_overrange_status_data_status* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_sensor_overrange_status_data { mip_sensor_overrange_status_data_status status; - }; typedef struct mip_sensor_overrange_status_data mip_sensor_overrange_status_data; -void insert_mip_sensor_overrange_status_data(struct mip_serializer* serializer, const mip_sensor_overrange_status_data* self); -void extract_mip_sensor_overrange_status_data(struct mip_serializer* serializer, mip_sensor_overrange_status_data* self); -bool extract_mip_sensor_overrange_status_data_from_field(const struct mip_field* field, void* ptr); -void insert_mip_sensor_overrange_status_data_status(struct mip_serializer* serializer, const mip_sensor_overrange_status_data_status self); -void extract_mip_sensor_overrange_status_data_status(struct mip_serializer* serializer, mip_sensor_overrange_status_data_status* self); +void insert_mip_sensor_overrange_status_data(microstrain_serializer* serializer, const mip_sensor_overrange_status_data* self); +void extract_mip_sensor_overrange_status_data(microstrain_serializer* serializer, mip_sensor_overrange_status_data* self); +bool extract_mip_sensor_overrange_status_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_sensor_odometer_data (0x80,0x40) Odometer Data [C] +///@defgroup sensor_odometer_data_c (0x80,0x40) Odometer Data /// ///@{ @@ -581,12 +595,12 @@ struct mip_sensor_odometer_data_data float speed; ///< Average speed over the time interval [m/s]. Can be negative for quadrature encoders. float uncertainty; ///< Uncertainty of velocity [m/s]. uint16_t valid_flags; ///< If odometer is configured, bit 0 will be set to 1. - }; typedef struct mip_sensor_odometer_data_data mip_sensor_odometer_data_data; -void insert_mip_sensor_odometer_data_data(struct mip_serializer* serializer, const mip_sensor_odometer_data_data* self); -void extract_mip_sensor_odometer_data_data(struct mip_serializer* serializer, mip_sensor_odometer_data_data* self); -bool extract_mip_sensor_odometer_data_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_sensor_odometer_data_data(microstrain_serializer* serializer, const mip_sensor_odometer_data_data* self); +void extract_mip_sensor_odometer_data_data(microstrain_serializer* serializer, mip_sensor_odometer_data_data* self); +bool extract_mip_sensor_odometer_data_data_from_field(const mip_field_view* field, void* ptr); ///@} @@ -597,8 +611,8 @@ bool extract_mip_sensor_odometer_data_data_from_field(const struct mip_field* fi /// //////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus +} // extern "C" } // namespace C } // namespace mip -} // extern "C" #endif // __cplusplus diff --git a/src/c/mip/definitions/data_shared.c b/src/c/mip/definitions/data_shared.c new file mode 100644 index 000000000..1d0413326 --- /dev/null +++ b/src/c/mip/definitions/data_shared.c @@ -0,0 +1,224 @@ + +#include "data_shared.h" + +#include +#include + +#include + + +#ifdef __cplusplus +namespace mip { +namespace C { +extern "C" { + +#endif // __cplusplus + + +//////////////////////////////////////////////////////////////////////////////// +// Mip Fields +//////////////////////////////////////////////////////////////////////////////// + +void insert_mip_shared_event_source_data(microstrain_serializer* serializer, const mip_shared_event_source_data* self) +{ + microstrain_insert_u8(serializer, self->trigger_id); + +} +void extract_mip_shared_event_source_data(microstrain_serializer* serializer, mip_shared_event_source_data* self) +{ + microstrain_extract_u8(serializer, &self->trigger_id); + +} +bool extract_mip_shared_event_source_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_shared_event_source_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_shared_event_source_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_shared_ticks_data(microstrain_serializer* serializer, const mip_shared_ticks_data* self) +{ + microstrain_insert_u32(serializer, self->ticks); + +} +void extract_mip_shared_ticks_data(microstrain_serializer* serializer, mip_shared_ticks_data* self) +{ + microstrain_extract_u32(serializer, &self->ticks); + +} +bool extract_mip_shared_ticks_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_shared_ticks_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_shared_ticks_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_shared_delta_ticks_data(microstrain_serializer* serializer, const mip_shared_delta_ticks_data* self) +{ + microstrain_insert_u32(serializer, self->ticks); + +} +void extract_mip_shared_delta_ticks_data(microstrain_serializer* serializer, mip_shared_delta_ticks_data* self) +{ + microstrain_extract_u32(serializer, &self->ticks); + +} +bool extract_mip_shared_delta_ticks_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_shared_delta_ticks_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_shared_delta_ticks_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_shared_gps_timestamp_data(microstrain_serializer* serializer, const mip_shared_gps_timestamp_data* self) +{ + microstrain_insert_double(serializer, self->tow); + + microstrain_insert_u16(serializer, self->week_number); + + insert_mip_shared_gps_timestamp_data_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_shared_gps_timestamp_data(microstrain_serializer* serializer, mip_shared_gps_timestamp_data* self) +{ + microstrain_extract_double(serializer, &self->tow); + + microstrain_extract_u16(serializer, &self->week_number); + + extract_mip_shared_gps_timestamp_data_valid_flags(serializer, &self->valid_flags); + +} +bool extract_mip_shared_gps_timestamp_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_shared_gps_timestamp_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_shared_gps_timestamp_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_shared_delta_time_data(microstrain_serializer* serializer, const mip_shared_delta_time_data* self) +{ + microstrain_insert_double(serializer, self->seconds); + +} +void extract_mip_shared_delta_time_data(microstrain_serializer* serializer, mip_shared_delta_time_data* self) +{ + microstrain_extract_double(serializer, &self->seconds); + +} +bool extract_mip_shared_delta_time_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_shared_delta_time_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_shared_delta_time_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_shared_reference_timestamp_data(microstrain_serializer* serializer, const mip_shared_reference_timestamp_data* self) +{ + microstrain_insert_u64(serializer, self->nanoseconds); + +} +void extract_mip_shared_reference_timestamp_data(microstrain_serializer* serializer, mip_shared_reference_timestamp_data* self) +{ + microstrain_extract_u64(serializer, &self->nanoseconds); + +} +bool extract_mip_shared_reference_timestamp_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_shared_reference_timestamp_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_shared_reference_timestamp_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_shared_reference_time_delta_data(microstrain_serializer* serializer, const mip_shared_reference_time_delta_data* self) +{ + microstrain_insert_u64(serializer, self->dt_nanos); + +} +void extract_mip_shared_reference_time_delta_data(microstrain_serializer* serializer, mip_shared_reference_time_delta_data* self) +{ + microstrain_extract_u64(serializer, &self->dt_nanos); + +} +bool extract_mip_shared_reference_time_delta_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_shared_reference_time_delta_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_shared_reference_time_delta_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_shared_external_timestamp_data(microstrain_serializer* serializer, const mip_shared_external_timestamp_data* self) +{ + microstrain_insert_u64(serializer, self->nanoseconds); + + insert_mip_shared_external_timestamp_data_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_shared_external_timestamp_data(microstrain_serializer* serializer, mip_shared_external_timestamp_data* self) +{ + microstrain_extract_u64(serializer, &self->nanoseconds); + + extract_mip_shared_external_timestamp_data_valid_flags(serializer, &self->valid_flags); + +} +bool extract_mip_shared_external_timestamp_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_shared_external_timestamp_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_shared_external_timestamp_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_shared_external_time_delta_data(microstrain_serializer* serializer, const mip_shared_external_time_delta_data* self) +{ + microstrain_insert_u64(serializer, self->dt_nanos); + + insert_mip_shared_external_time_delta_data_valid_flags(serializer, self->valid_flags); + +} +void extract_mip_shared_external_time_delta_data(microstrain_serializer* serializer, mip_shared_external_time_delta_data* self) +{ + microstrain_extract_u64(serializer, &self->dt_nanos); + + extract_mip_shared_external_time_delta_data_valid_flags(serializer, &self->valid_flags); + +} +bool extract_mip_shared_external_time_delta_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_shared_external_time_delta_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_shared_external_time_delta_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + + +#ifdef __cplusplus +} // extern "C" +} // namespace C +} // namespace mip +#endif // __cplusplus + diff --git a/src/mip/definitions/data_shared.h b/src/c/mip/definitions/data_shared.h similarity index 66% rename from src/mip/definitions/data_shared.h rename to src/c/mip/definitions/data_shared.h index 6c4a0f404..4869bb87f 100644 --- a/src/mip/definitions/data_shared.h +++ b/src/c/mip/definitions/data_shared.h @@ -1,8 +1,9 @@ #pragma once -#include "common.h" -#include "descriptors.h" -#include "../mip_result.h" +#include +#include +#include +#include #include #include @@ -14,14 +15,11 @@ namespace C { extern "C" { #endif // __cplusplus -struct mip_interface; -struct mip_serializer; -struct mip_field; //////////////////////////////////////////////////////////////////////////////// -///@addtogroup MipData_c MIP Data [C] +///@addtogroup MipData_c ///@{ -///@defgroup shared_data_c Shared Data [C] +///@defgroup shared_data_c Shared Data /// ///@{ @@ -57,7 +55,7 @@ enum { MIP_DATA_DESC_SHARED_START = 0xD0 }; //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_shared_event_source (0xFF,0xD0) Event Source [C] +///@defgroup shared_event_source_c (0xFF,0xD0) Event Source /// Identifies which event trigger caused this packet to be emitted. /// /// Generally this is used to determine whether a packet was emitted @@ -68,18 +66,18 @@ enum { MIP_DATA_DESC_SHARED_START = 0xD0 }; struct mip_shared_event_source_data { uint8_t trigger_id; ///< Trigger ID number. If 0, this message was emitted due to being scheduled in the 3DM Message Format Command (0x0C,0x0F). - }; typedef struct mip_shared_event_source_data mip_shared_event_source_data; -void insert_mip_shared_event_source_data(struct mip_serializer* serializer, const mip_shared_event_source_data* self); -void extract_mip_shared_event_source_data(struct mip_serializer* serializer, mip_shared_event_source_data* self); -bool extract_mip_shared_event_source_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_shared_event_source_data(microstrain_serializer* serializer, const mip_shared_event_source_data* self); +void extract_mip_shared_event_source_data(microstrain_serializer* serializer, mip_shared_event_source_data* self); +bool extract_mip_shared_event_source_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_shared_ticks (0xFF,0xD1) Ticks [C] +///@defgroup shared_ticks_c (0xFF,0xD1) Ticks /// Time since powerup in multiples of the base rate. /// /// The counter will wrap around to 0 after approximately 50 days. @@ -90,18 +88,18 @@ bool extract_mip_shared_event_source_data_from_field(const struct mip_field* fie struct mip_shared_ticks_data { uint32_t ticks; ///< Ticks since powerup. - }; typedef struct mip_shared_ticks_data mip_shared_ticks_data; -void insert_mip_shared_ticks_data(struct mip_serializer* serializer, const mip_shared_ticks_data* self); -void extract_mip_shared_ticks_data(struct mip_serializer* serializer, mip_shared_ticks_data* self); -bool extract_mip_shared_ticks_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_shared_ticks_data(microstrain_serializer* serializer, const mip_shared_ticks_data* self); +void extract_mip_shared_ticks_data(microstrain_serializer* serializer, mip_shared_ticks_data* self); +bool extract_mip_shared_ticks_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_shared_delta_ticks (0xFF,0xD2) Delta Ticks [C] +///@defgroup shared_delta_ticks_c (0xFF,0xD2) Delta Ticks /// Ticks since the last output of this field. /// /// This field can be used to track the amount of time passed between @@ -113,18 +111,18 @@ bool extract_mip_shared_ticks_data_from_field(const struct mip_field* field, voi struct mip_shared_delta_ticks_data { uint32_t ticks; ///< Ticks since last output. - }; typedef struct mip_shared_delta_ticks_data mip_shared_delta_ticks_data; -void insert_mip_shared_delta_ticks_data(struct mip_serializer* serializer, const mip_shared_delta_ticks_data* self); -void extract_mip_shared_delta_ticks_data(struct mip_serializer* serializer, mip_shared_delta_ticks_data* self); -bool extract_mip_shared_delta_ticks_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_shared_delta_ticks_data(microstrain_serializer* serializer, const mip_shared_delta_ticks_data* self); +void extract_mip_shared_delta_ticks_data(microstrain_serializer* serializer, mip_shared_delta_ticks_data* self); +bool extract_mip_shared_delta_ticks_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_shared_gps_timestamp (0xFF,0xD3) Gps Timestamp [C] +///@defgroup shared_gps_timestamp_c (0xFF,0xD3) Gps Timestamp /// Outputs the current GPS system time in time-of-week and week number format. /// /// For events, this is the time of the event trigger. @@ -138,27 +136,35 @@ static const mip_shared_gps_timestamp_data_valid_flags MIP_SHARED_GPS_TIMESTAMP_ static const mip_shared_gps_timestamp_data_valid_flags MIP_SHARED_GPS_TIMESTAMP_DATA_VALID_FLAGS_WEEK_NUMBER = 0x0002; ///< Week number has been set static const mip_shared_gps_timestamp_data_valid_flags MIP_SHARED_GPS_TIMESTAMP_DATA_VALID_FLAGS_TIME_VALID = 0x0003; ///< Both TOW and Week Number have been set static const mip_shared_gps_timestamp_data_valid_flags MIP_SHARED_GPS_TIMESTAMP_DATA_VALID_FLAGS_ALL = 0x0003; +static inline void insert_mip_shared_gps_timestamp_data_valid_flags(microstrain_serializer* serializer, const mip_shared_gps_timestamp_data_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_shared_gps_timestamp_data_valid_flags(microstrain_serializer* serializer, mip_shared_gps_timestamp_data_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_shared_gps_timestamp_data { double tow; ///< GPS Time of Week [seconds] uint16_t week_number; ///< GPS Week Number since 1980 [weeks] mip_shared_gps_timestamp_data_valid_flags valid_flags; - }; typedef struct mip_shared_gps_timestamp_data mip_shared_gps_timestamp_data; -void insert_mip_shared_gps_timestamp_data(struct mip_serializer* serializer, const mip_shared_gps_timestamp_data* self); -void extract_mip_shared_gps_timestamp_data(struct mip_serializer* serializer, mip_shared_gps_timestamp_data* self); -bool extract_mip_shared_gps_timestamp_data_from_field(const struct mip_field* field, void* ptr); -void insert_mip_shared_gps_timestamp_data_valid_flags(struct mip_serializer* serializer, const mip_shared_gps_timestamp_data_valid_flags self); -void extract_mip_shared_gps_timestamp_data_valid_flags(struct mip_serializer* serializer, mip_shared_gps_timestamp_data_valid_flags* self); +void insert_mip_shared_gps_timestamp_data(microstrain_serializer* serializer, const mip_shared_gps_timestamp_data* self); +void extract_mip_shared_gps_timestamp_data(microstrain_serializer* serializer, mip_shared_gps_timestamp_data* self); +bool extract_mip_shared_gps_timestamp_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_shared_delta_time (0xFF,0xD4) Delta Time [C] +///@defgroup shared_delta_time_c (0xFF,0xD4) Delta Time /// Time in the synchronized clock domain since the last output of this field within the same descriptor set and event instance. /// /// This can be used to track the amount of time passed between @@ -175,18 +181,18 @@ void extract_mip_shared_gps_timestamp_data_valid_flags(struct mip_serializer* se struct mip_shared_delta_time_data { double seconds; ///< Seconds since last output. - }; typedef struct mip_shared_delta_time_data mip_shared_delta_time_data; -void insert_mip_shared_delta_time_data(struct mip_serializer* serializer, const mip_shared_delta_time_data* self); -void extract_mip_shared_delta_time_data(struct mip_serializer* serializer, mip_shared_delta_time_data* self); -bool extract_mip_shared_delta_time_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_shared_delta_time_data(microstrain_serializer* serializer, const mip_shared_delta_time_data* self); +void extract_mip_shared_delta_time_data(microstrain_serializer* serializer, mip_shared_delta_time_data* self); +bool extract_mip_shared_delta_time_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_shared_reference_timestamp (0xFF,0xD5) Reference Timestamp [C] +///@defgroup shared_reference_timestamp_c (0xFF,0xD5) Reference Timestamp /// Internal reference timestamp. /// /// This timestamp represents the time at which the corresponding @@ -201,18 +207,18 @@ bool extract_mip_shared_delta_time_data_from_field(const struct mip_field* field struct mip_shared_reference_timestamp_data { uint64_t nanoseconds; ///< Nanoseconds since initialization. - }; typedef struct mip_shared_reference_timestamp_data mip_shared_reference_timestamp_data; -void insert_mip_shared_reference_timestamp_data(struct mip_serializer* serializer, const mip_shared_reference_timestamp_data* self); -void extract_mip_shared_reference_timestamp_data(struct mip_serializer* serializer, mip_shared_reference_timestamp_data* self); -bool extract_mip_shared_reference_timestamp_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_shared_reference_timestamp_data(microstrain_serializer* serializer, const mip_shared_reference_timestamp_data* self); +void extract_mip_shared_reference_timestamp_data(microstrain_serializer* serializer, mip_shared_reference_timestamp_data* self); +bool extract_mip_shared_reference_timestamp_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_shared_reference_time_delta (0xFF,0xD6) Reference Time Delta [C] +///@defgroup shared_reference_time_delta_c (0xFF,0xD6) Reference Time Delta /// Delta time since the last packet. /// /// Difference between the time as reported by the shared reference time field, 0xD5, @@ -229,18 +235,18 @@ bool extract_mip_shared_reference_timestamp_data_from_field(const struct mip_fie struct mip_shared_reference_time_delta_data { uint64_t dt_nanos; ///< Nanoseconds since the last occurrence of this field in a packet of the same descriptor set and event source. - }; typedef struct mip_shared_reference_time_delta_data mip_shared_reference_time_delta_data; -void insert_mip_shared_reference_time_delta_data(struct mip_serializer* serializer, const mip_shared_reference_time_delta_data* self); -void extract_mip_shared_reference_time_delta_data(struct mip_serializer* serializer, mip_shared_reference_time_delta_data* self); -bool extract_mip_shared_reference_time_delta_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_shared_reference_time_delta_data(microstrain_serializer* serializer, const mip_shared_reference_time_delta_data* self); +void extract_mip_shared_reference_time_delta_data(microstrain_serializer* serializer, mip_shared_reference_time_delta_data* self); +bool extract_mip_shared_reference_time_delta_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_shared_external_timestamp (0xFF,0xD7) External Timestamp [C] +///@defgroup shared_external_timestamp_c (0xFF,0xD7) External Timestamp /// External timestamp in nanoseconds. /// /// This timestamp represents the time at which the corresponding @@ -257,26 +263,34 @@ typedef uint16_t mip_shared_external_timestamp_data_valid_flags; static const mip_shared_external_timestamp_data_valid_flags MIP_SHARED_EXTERNAL_TIMESTAMP_DATA_VALID_FLAGS_NONE = 0x0000; static const mip_shared_external_timestamp_data_valid_flags MIP_SHARED_EXTERNAL_TIMESTAMP_DATA_VALID_FLAGS_NANOSECONDS = 0x0001; ///< static const mip_shared_external_timestamp_data_valid_flags MIP_SHARED_EXTERNAL_TIMESTAMP_DATA_VALID_FLAGS_ALL = 0x0001; +static inline void insert_mip_shared_external_timestamp_data_valid_flags(microstrain_serializer* serializer, const mip_shared_external_timestamp_data_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_shared_external_timestamp_data_valid_flags(microstrain_serializer* serializer, mip_shared_external_timestamp_data_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_shared_external_timestamp_data { uint64_t nanoseconds; mip_shared_external_timestamp_data_valid_flags valid_flags; - }; typedef struct mip_shared_external_timestamp_data mip_shared_external_timestamp_data; -void insert_mip_shared_external_timestamp_data(struct mip_serializer* serializer, const mip_shared_external_timestamp_data* self); -void extract_mip_shared_external_timestamp_data(struct mip_serializer* serializer, mip_shared_external_timestamp_data* self); -bool extract_mip_shared_external_timestamp_data_from_field(const struct mip_field* field, void* ptr); -void insert_mip_shared_external_timestamp_data_valid_flags(struct mip_serializer* serializer, const mip_shared_external_timestamp_data_valid_flags self); -void extract_mip_shared_external_timestamp_data_valid_flags(struct mip_serializer* serializer, mip_shared_external_timestamp_data_valid_flags* self); +void insert_mip_shared_external_timestamp_data(microstrain_serializer* serializer, const mip_shared_external_timestamp_data* self); +void extract_mip_shared_external_timestamp_data(microstrain_serializer* serializer, mip_shared_external_timestamp_data* self); +bool extract_mip_shared_external_timestamp_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_shared_external_time_delta (0xFF,0xD8) External Time Delta [C] +///@defgroup shared_external_time_delta_c (0xFF,0xD8) External Time Delta /// Delta time since the last packet containing delta external (0xFF,0xD4) or delta gps time (0xFF,0xD8). /// /// Difference between the time as reported by the shared external time field, 0xD7, @@ -297,20 +311,28 @@ typedef uint16_t mip_shared_external_time_delta_data_valid_flags; static const mip_shared_external_time_delta_data_valid_flags MIP_SHARED_EXTERNAL_TIME_DELTA_DATA_VALID_FLAGS_NONE = 0x0000; static const mip_shared_external_time_delta_data_valid_flags MIP_SHARED_EXTERNAL_TIME_DELTA_DATA_VALID_FLAGS_DT_NANOS = 0x0001; ///< static const mip_shared_external_time_delta_data_valid_flags MIP_SHARED_EXTERNAL_TIME_DELTA_DATA_VALID_FLAGS_ALL = 0x0001; +static inline void insert_mip_shared_external_time_delta_data_valid_flags(microstrain_serializer* serializer, const mip_shared_external_time_delta_data_valid_flags self) +{ + microstrain_insert_u16(serializer, (uint16_t)(self)); +} +static inline void extract_mip_shared_external_time_delta_data_valid_flags(microstrain_serializer* serializer, mip_shared_external_time_delta_data_valid_flags* self) +{ + uint16_t tmp = 0; + microstrain_extract_u16(serializer, &tmp); + *self = tmp; +} + struct mip_shared_external_time_delta_data { uint64_t dt_nanos; ///< Nanoseconds since the last occurrence of this field in a packet of the same descriptor set and event source. mip_shared_external_time_delta_data_valid_flags valid_flags; - }; typedef struct mip_shared_external_time_delta_data mip_shared_external_time_delta_data; -void insert_mip_shared_external_time_delta_data(struct mip_serializer* serializer, const mip_shared_external_time_delta_data* self); -void extract_mip_shared_external_time_delta_data(struct mip_serializer* serializer, mip_shared_external_time_delta_data* self); -bool extract_mip_shared_external_time_delta_data_from_field(const struct mip_field* field, void* ptr); -void insert_mip_shared_external_time_delta_data_valid_flags(struct mip_serializer* serializer, const mip_shared_external_time_delta_data_valid_flags self); -void extract_mip_shared_external_time_delta_data_valid_flags(struct mip_serializer* serializer, mip_shared_external_time_delta_data_valid_flags* self); +void insert_mip_shared_external_time_delta_data(microstrain_serializer* serializer, const mip_shared_external_time_delta_data* self); +void extract_mip_shared_external_time_delta_data(microstrain_serializer* serializer, mip_shared_external_time_delta_data* self); +bool extract_mip_shared_external_time_delta_data_from_field(const mip_field_view* field, void* ptr); ///@} @@ -321,8 +343,8 @@ void extract_mip_shared_external_time_delta_data_valid_flags(struct mip_serializ /// //////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus +} // extern "C" } // namespace C } // namespace mip -} // extern "C" #endif // __cplusplus diff --git a/src/c/mip/definitions/data_system.c b/src/c/mip/definitions/data_system.c new file mode 100644 index 000000000..81d644ff0 --- /dev/null +++ b/src/c/mip/definitions/data_system.c @@ -0,0 +1,118 @@ + +#include "data_system.h" + +#include +#include + +#include + + +#ifdef __cplusplus +namespace mip { +namespace C { +extern "C" { + +#endif // __cplusplus + + +//////////////////////////////////////////////////////////////////////////////// +// Mip Fields +//////////////////////////////////////////////////////////////////////////////// + +void insert_mip_system_built_in_test_data(microstrain_serializer* serializer, const mip_system_built_in_test_data* self) +{ + for(unsigned int i=0; i < 16; i++) + microstrain_insert_u8(serializer, self->result[i]); + +} +void extract_mip_system_built_in_test_data(microstrain_serializer* serializer, mip_system_built_in_test_data* self) +{ + for(unsigned int i=0; i < 16; i++) + microstrain_extract_u8(serializer, &self->result[i]); + +} +bool extract_mip_system_built_in_test_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_system_built_in_test_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_system_built_in_test_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_system_time_sync_status_data(microstrain_serializer* serializer, const mip_system_time_sync_status_data* self) +{ + microstrain_insert_bool(serializer, self->time_sync); + + microstrain_insert_u8(serializer, self->last_pps_rcvd); + +} +void extract_mip_system_time_sync_status_data(microstrain_serializer* serializer, mip_system_time_sync_status_data* self) +{ + microstrain_extract_bool(serializer, &self->time_sync); + + microstrain_extract_u8(serializer, &self->last_pps_rcvd); + +} +bool extract_mip_system_time_sync_status_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_system_time_sync_status_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_system_time_sync_status_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_system_gpio_state_data(microstrain_serializer* serializer, const mip_system_gpio_state_data* self) +{ + microstrain_insert_u8(serializer, self->states); + +} +void extract_mip_system_gpio_state_data(microstrain_serializer* serializer, mip_system_gpio_state_data* self) +{ + microstrain_extract_u8(serializer, &self->states); + +} +bool extract_mip_system_gpio_state_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_system_gpio_state_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_system_gpio_state_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + +void insert_mip_system_gpio_analog_value_data(microstrain_serializer* serializer, const mip_system_gpio_analog_value_data* self) +{ + microstrain_insert_u8(serializer, self->gpio_id); + + microstrain_insert_float(serializer, self->value); + +} +void extract_mip_system_gpio_analog_value_data(microstrain_serializer* serializer, mip_system_gpio_analog_value_data* self) +{ + microstrain_extract_u8(serializer, &self->gpio_id); + + microstrain_extract_float(serializer, &self->value); + +} +bool extract_mip_system_gpio_analog_value_data_from_field(const mip_field_view* field, void* ptr) +{ + assert(ptr); + mip_system_gpio_analog_value_data* self = ptr; + microstrain_serializer serializer; + microstrain_serializer_init_from_field(&serializer, field); + extract_mip_system_gpio_analog_value_data(&serializer, self); + return microstrain_serializer_is_complete(&serializer); +} + + +#ifdef __cplusplus +} // extern "C" +} // namespace C +} // namespace mip +#endif // __cplusplus + diff --git a/src/mip/definitions/data_system.h b/src/c/mip/definitions/data_system.h similarity index 74% rename from src/mip/definitions/data_system.h rename to src/c/mip/definitions/data_system.h index e55e0b8bb..ca9e09681 100644 --- a/src/mip/definitions/data_system.h +++ b/src/c/mip/definitions/data_system.h @@ -1,8 +1,9 @@ #pragma once -#include "common.h" -#include "descriptors.h" -#include "../mip_result.h" +#include +#include +#include +#include #include #include @@ -14,14 +15,11 @@ namespace C { extern "C" { #endif // __cplusplus -struct mip_interface; -struct mip_serializer; -struct mip_field; //////////////////////////////////////////////////////////////////////////////// -///@addtogroup MipData_c MIP Data [C] +///@addtogroup MipData_c ///@{ -///@defgroup system_data_c System Data [C] +///@defgroup system_data_c System Data /// ///@{ @@ -50,7 +48,7 @@ enum //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_system_built_in_test (0xA0,0x01) Built In Test [C] +///@defgroup system_built_in_test_c (0xA0,0x01) Built In Test /// Contains the continuous built-in-test (BIT) results. /// /// Due to the large size of this field, it is recommended to stream it at @@ -76,18 +74,18 @@ enum struct mip_system_built_in_test_data { uint8_t result[16]; ///< Device-specific bitfield (128 bits). See device user manual. Bits are least-significant-byte first. For example, bit 0 is located at bit 0 of result[0], bit 1 is located at bit 1 of result[0], bit 8 is located at bit 0 of result[1], and bit 127 is located at bit 7 of result[15]. - }; typedef struct mip_system_built_in_test_data mip_system_built_in_test_data; -void insert_mip_system_built_in_test_data(struct mip_serializer* serializer, const mip_system_built_in_test_data* self); -void extract_mip_system_built_in_test_data(struct mip_serializer* serializer, mip_system_built_in_test_data* self); -bool extract_mip_system_built_in_test_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_system_built_in_test_data(microstrain_serializer* serializer, const mip_system_built_in_test_data* self); +void extract_mip_system_built_in_test_data(microstrain_serializer* serializer, mip_system_built_in_test_data* self); +bool extract_mip_system_built_in_test_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_system_time_sync_status (0xA0,0x02) Time Sync Status [C] +///@defgroup system_time_sync_status_c (0xA0,0x02) Time Sync Status /// Indicates whether a sync has been achieved using the PPS signal. /// ///@{ @@ -96,18 +94,18 @@ struct mip_system_time_sync_status_data { bool time_sync; ///< True if sync with the PPS signal is currently valid. False if PPS feature is disabled or a PPS signal is not detected. uint8_t last_pps_rcvd; ///< Elapsed time in seconds since last PPS was received, with a maximum value of 255. - }; typedef struct mip_system_time_sync_status_data mip_system_time_sync_status_data; -void insert_mip_system_time_sync_status_data(struct mip_serializer* serializer, const mip_system_time_sync_status_data* self); -void extract_mip_system_time_sync_status_data(struct mip_serializer* serializer, mip_system_time_sync_status_data* self); -bool extract_mip_system_time_sync_status_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_system_time_sync_status_data(microstrain_serializer* serializer, const mip_system_time_sync_status_data* self); +void extract_mip_system_time_sync_status_data(microstrain_serializer* serializer, mip_system_time_sync_status_data* self); +bool extract_mip_system_time_sync_status_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_system_gpio_state (0xA0,0x03) Gpio State [C] +///@defgroup system_gpio_state_c (0xA0,0x03) Gpio State /// Indicates the state of all of the user GPIO pins. /// /// This message can be used to correlate external signals @@ -133,18 +131,18 @@ bool extract_mip_system_time_sync_status_data_from_field(const struct mip_field* struct mip_system_gpio_state_data { uint8_t states; ///< Bitfield containing the states for each GPIO pin.
Bit 0 (0x01): pin 1
Bit 1 (0x02): pin 2
Bit 2 (0x04): pin 3
Bit 3 (0x08): pin 4
Bits for pins that don't exist will read as 0. - }; typedef struct mip_system_gpio_state_data mip_system_gpio_state_data; -void insert_mip_system_gpio_state_data(struct mip_serializer* serializer, const mip_system_gpio_state_data* self); -void extract_mip_system_gpio_state_data(struct mip_serializer* serializer, mip_system_gpio_state_data* self); -bool extract_mip_system_gpio_state_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_system_gpio_state_data(microstrain_serializer* serializer, const mip_system_gpio_state_data* self); +void extract_mip_system_gpio_state_data(microstrain_serializer* serializer, mip_system_gpio_state_data* self); +bool extract_mip_system_gpio_state_data_from_field(const mip_field_view* field, void* ptr); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup c_system_gpio_analog_value (0xA0,0x04) Gpio Analog Value [C] +///@defgroup system_gpio_analog_value_c (0xA0,0x04) Gpio Analog Value /// Indicates the analog value of the given user GPIO. /// The pin must be configured for analog input. /// @@ -154,12 +152,12 @@ struct mip_system_gpio_analog_value_data { uint8_t gpio_id; ///< GPIO pin number starting with 1. float value; ///< Value of the GPIO line in scaled volts. - }; typedef struct mip_system_gpio_analog_value_data mip_system_gpio_analog_value_data; -void insert_mip_system_gpio_analog_value_data(struct mip_serializer* serializer, const mip_system_gpio_analog_value_data* self); -void extract_mip_system_gpio_analog_value_data(struct mip_serializer* serializer, mip_system_gpio_analog_value_data* self); -bool extract_mip_system_gpio_analog_value_data_from_field(const struct mip_field* field, void* ptr); + +void insert_mip_system_gpio_analog_value_data(microstrain_serializer* serializer, const mip_system_gpio_analog_value_data* self); +void extract_mip_system_gpio_analog_value_data(microstrain_serializer* serializer, mip_system_gpio_analog_value_data* self); +bool extract_mip_system_gpio_analog_value_data_from_field(const mip_field_view* field, void* ptr); ///@} @@ -170,8 +168,8 @@ bool extract_mip_system_gpio_analog_value_data_from_field(const struct mip_field /// //////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus +} // extern "C" } // namespace C } // namespace mip -} // extern "C" #endif // __cplusplus diff --git a/src/mip/mip_all.h b/src/c/mip/mip_all.h similarity index 50% rename from src/mip/mip_all.h rename to src/c/mip/mip_all.h index f07cf6852..7b535c1eb 100644 --- a/src/mip/mip_all.h +++ b/src/c/mip/mip_all.h @@ -1,29 +1,46 @@ #pragma once -//MIP Core +//////////////////////////////////////////////////////////////////////////////// +///@defgroup mip MIP +///@{ +/// +///@defgroup mip_c MIP C API +///@brief This module contains functions and classes for communicating with a +/// MIP device in %C. +/// +///@} +//////////////////////////////////////////////////////////////////////////////// + + +// MIP Core #include "mip_cmdqueue.h" +#include "mip_descriptors.h" #include "mip_dispatch.h" #include "mip_field.h" #include "mip_interface.h" #include "mip_offsets.h" #include "mip_packet.h" #include "mip_parser.h" -#include "definitions/descriptors.h" +#include "mip_result.h" +#include "mip_serialization.h" +#include "mip_types.h" +#include "mip_version.h" -//MIP Utils -#include "utils/serialization.h" +// MIP Utils +#include "utils/byte_ring.h" -//MIP Commands -#include "definitions/commands_base.h" +// MIP Commands #include "definitions/commands_3dm.h" +#include "definitions/commands_aiding.h" +#include "definitions/commands_base.h" #include "definitions/commands_filter.h" #include "definitions/commands_gnss.h" #include "definitions/commands_rtk.h" #include "definitions/commands_system.h" -//MIP Data +// MIP Data +#include "definitions/data_filter.h" +#include "definitions/data_gnss.h" +#include "definitions/data_sensor.h" #include "definitions/data_shared.h" #include "definitions/data_system.h" -#include "definitions/data_sensor.h" -#include "definitions/data_gnss.h" -#include "definitions/data_filter.h" diff --git a/src/mip/mip_cmdqueue.c b/src/c/mip/mip_cmdqueue.c similarity index 95% rename from src/mip/mip_cmdqueue.c rename to src/c/mip/mip_cmdqueue.c index 24874891d..8b225b355 100644 --- a/src/mip/mip_cmdqueue.c +++ b/src/c/mip/mip_cmdqueue.c @@ -13,6 +13,12 @@ #define MIP_INDEX_REPLY_DESCRIPTOR 0 #define MIP_INDEX_REPLY_ACK_CODE 1 +#ifdef __cplusplus +namespace mip { +namespace C { +extern "C" { +#endif + //////////////////////////////////////////////////////////////////////////////// ///@brief Initialize a pending command with no reponse data or additional time. @@ -265,7 +271,7 @@ void mip_cmd_queue_dequeue(mip_cmd_queue* queue, mip_pending_cmd* cmd) /// not updated). The caller should set pending->_status to this value /// after doing any additional processing requiring the pending struct. /// -static enum mip_cmd_result process_fields_for_pending_cmd(mip_pending_cmd* pending, const mip_packet* packet, mip_timeout base_timeout, mip_timestamp timestamp) +static enum mip_cmd_result process_fields_for_pending_cmd(mip_pending_cmd* pending, const mip_packet_view* packet, mip_timeout base_timeout, mip_timestamp timestamp) { assert( pending->_status != MIP_STATUS_NONE ); // pending->_status must be set to MIP_STATUS_PENDING in mip_cmd_queue_enqueue to get here. assert( !mip_cmd_result_is_finished(pending->_status) ); // Command shouldn't be finished yet - make sure the queue is processed properly. @@ -283,7 +289,7 @@ static enum mip_cmd_result process_fields_for_pending_cmd(mip_pending_cmd* pendi if( mip_packet_descriptor_set(packet) == pending->_descriptor_set ) { - mip_field field = {0}; + mip_field_view field = {0}; while( mip_field_next_in_packet(&field, packet) ) { // Not an ack/nack reply field, skip it. @@ -306,7 +312,7 @@ static enum mip_cmd_result process_fields_for_pending_cmd(mip_pending_cmd* pendi // Descriptor matches! uint8_t response_length = 0; - mip_field response_field; + mip_field_view response_field; // If the command was ACK'd, check if response data is expected. if( pending->_response_descriptor != 0x00 && ack_code == MIP_ACK_OK ) @@ -372,7 +378,7 @@ static enum mip_cmd_result process_fields_for_pending_cmd(mip_pending_cmd* pendi ///@param packet The received MIP packet. Assumed to be valid. ///@param timestamp The time the packet was received /// -void mip_cmd_queue_process_packet(mip_cmd_queue* queue, const mip_packet* packet, mip_timestamp timestamp) +void mip_cmd_queue_process_packet(mip_cmd_queue* queue, const mip_packet_view* packet, mip_timestamp timestamp) { // Check if the packet is a command descriptor set. const uint8_t descriptor_set = mip_packet_descriptor_set(packet); @@ -556,3 +562,9 @@ uint16_t mip_cmd_queue_diagnostic_cmd_errors(const mip_cmd_queue* queue) } #endif // MIP_ENABLE_DIAGNOSTICS + +#ifdef __cplusplus +} // extern "C" +} // namespace C +} // namespace mip +#endif diff --git a/src/mip/mip_cmdqueue.h b/src/c/mip/mip_cmdqueue.h similarity index 93% rename from src/mip/mip_cmdqueue.h rename to src/c/mip/mip_cmdqueue.h index 868e735ec..35b7b6fb7 100644 --- a/src/mip/mip_cmdqueue.h +++ b/src/c/mip/mip_cmdqueue.h @@ -14,19 +14,16 @@ extern "C" { #endif //////////////////////////////////////////////////////////////////////////////// -///@addtogroup mip_c -///@{ - -//////////////////////////////////////////////////////////////////////////////// -///@defgroup MipCommandQueue_c Mip Command Queue [C] +///@defgroup MipCommandHandling_c Mip Command Handling +///@ingroup mip_c /// -///@brief Functions for handling command responses. +///@brief Functions for processing command responses. /// ///@{ //////////////////////////////////////////////////////////////////////////////// -///@defgroup PendingCommand mip_pending_cmd functions [C] +///@defgroup MipPendingCommand_c Pending Mip Commands /// ///@{ @@ -37,7 +34,6 @@ extern "C" { /// considered an internal implementation detail. Avoid accessing them directly /// as they are subject to change in future versions of this software. /// - typedef struct mip_pending_cmd { struct mip_pending_cmd* _next; ///<@private Next command in the queue. @@ -72,7 +68,7 @@ bool mip_pending_cmd_check_timeout(const mip_pending_cmd* cmd, mip_timestamp now ///@} //////////////////////////////////////////////////////////////////////////////// -///@defgroup CommandQueue mip_cmd_queue functions [C] +///@defgroup MipCommandQueue_c Mip Command Queue /// ///@note This should be considered an "opaque" structure; its members should be /// considered an internal implementation detail. Avoid accessing them directly @@ -89,11 +85,10 @@ bool mip_pending_cmd_check_timeout(const mip_pending_cmd* cmd, mip_timestamp now /// considered an internal implementation detail. Avoid accessing them directly /// as they are subject to change in future versions of this software. /// - typedef struct mip_cmd_queue { - mip_pending_cmd* _first_pending_cmd; - mip_timeout _base_timeout; + mip_pending_cmd* _first_pending_cmd; ///<@private Pointer to the first pending command, if any. + mip_timeout _base_timeout; ///<@private Base command timeout. #ifdef MIP_ENABLE_DIAGNOSTICS uint16_t _diag_cmds_queued; ///<@private Number of queued commands. @@ -116,7 +111,7 @@ void mip_cmd_queue_update(mip_cmd_queue* queue, mip_timestamp timestamp); void mip_cmd_queue_set_base_reply_timeout(mip_cmd_queue* queue, mip_timeout timeout); mip_timeout mip_cmd_queue_base_reply_timeout(const mip_cmd_queue* queue); -void mip_cmd_queue_process_packet(mip_cmd_queue* queue, const mip_packet* packet, mip_timestamp timestamp); +void mip_cmd_queue_process_packet(mip_cmd_queue* queue, const mip_packet_view* packet, mip_timestamp timestamp); #ifdef MIP_ENABLE_DIAGNOSTICS @@ -130,13 +125,12 @@ uint16_t mip_cmd_queue_diagnostic_cmd_timeouts(const mip_cmd_queue* queue); uint16_t mip_cmd_queue_diagnostic_cmd_errors(const mip_cmd_queue* queue); #endif // MIP_ENABLE_DIAGNOSTICS -///@} ///@} ///@} //////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus +} // extern "C" } // namespace C } // namespace mip -} // extern "C" #endif diff --git a/src/mip/definitions/descriptors.c b/src/c/mip/mip_descriptors.c similarity index 89% rename from src/mip/definitions/descriptors.c rename to src/c/mip/mip_descriptors.c index 685a3b500..b4a754615 100644 --- a/src/mip/definitions/descriptors.c +++ b/src/c/mip/mip_descriptors.c @@ -1,13 +1,16 @@ -#include "descriptors.h" +#include "mip_descriptors.h" -#include "../utils/serialization.h" +#include "microstrain/common/serialization.h" #ifdef __cplusplus namespace mip { extern "C" { #endif // __cplusplus +//////////////////////////////////////////////////////////////////////////////// +///@addtogroup mip_c +///@{ //////////////////////////////////////////////////////////////////////////////// ///@brief Determines if the descriptor set is valid. @@ -151,20 +154,22 @@ bool mip_is_shared_data_field_descriptor(uint8_t field_descriptor) } -void insert_mip_function_selector(mip_serializer* serializer, enum mip_function_selector self) +void insert_mip_function_selector(microstrain_serializer* serializer, enum mip_function_selector self) { - insert_u8(serializer, self); + microstrain_insert_u8(serializer, self); } -void extract_mip_function_selector(mip_serializer* serializer, enum mip_function_selector* self) +void extract_mip_function_selector(microstrain_serializer* serializer, enum mip_function_selector* self) { uint8_t tmp; - extract_u8(serializer, &tmp); + microstrain_extract_u8(serializer, &tmp); *self = (enum mip_function_selector)tmp; } +///@} +//////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus -} // namespace mip } // extern "C" +} // namespace mip #endif // __cplusplus diff --git a/src/c/mip/mip_descriptors.h b/src/c/mip/mip_descriptors.h new file mode 100644 index 000000000..3373e1e52 --- /dev/null +++ b/src/c/mip/mip_descriptors.h @@ -0,0 +1,59 @@ +#pragma once + +#include +#include +#include +#include "microstrain/common/serialization.h" +#include "mip_result.h" + +#ifdef __cplusplus +namespace mip { +namespace C { +using ::microstrain::C::microstrain_serializer; +extern "C" { +#endif // __cplusplus + +enum { + MIP_INVALID_DESCRIPTOR_SET = 0x00, + MIP_DATA_DESCRIPTOR_SET_START = 0x80, + MIP_RESERVED_DESCRIPTOR_SET_START = 0xF0, + + MIP_INVALID_FIELD_DESCRIPTOR = 0x00, + MIP_REPLY_DESCRIPTOR = 0xF1, + MIP_RESERVED_DESCRIPTOR_START = 0xF0, + MIP_RESPONSE_DESCRIPTOR_START = 0x80, + + MIP_SHARED_DATA_FIELD_DESCRIPTOR_START = 0xD0, +}; + +bool mip_is_valid_descriptor_set(uint8_t descriptor_set); +bool mip_is_data_descriptor_set(uint8_t descriptor_set); +bool mip_is_cmd_descriptor_set(uint8_t descriptor_set); +bool mip_is_reserved_descriptor_set(uint8_t descriptor_set); +bool mip_is_gnss_data_descriptor_set(uint8_t descriptor_set); + +bool mip_is_valid_field_descriptor(uint8_t field_descriptor); +bool mip_is_cmd_field_descriptor(uint8_t field_descriptor); +bool mip_is_reply_field_descriptor(uint8_t field_descriptor); +bool mip_is_response_field_descriptor(uint8_t field_descriptor); +bool mip_is_reserved_cmd_field_descriptor(uint8_t field_descriptor); +bool mip_is_shared_data_field_descriptor(uint8_t field_descriptor); + +enum mip_function_selector +{ + MIP_FUNCTION_WRITE = 0x01, + MIP_FUNCTION_READ = 0x02, + MIP_FUNCTION_SAVE = 0x03, + MIP_FUNCTION_LOAD = 0x04, + MIP_FUNCTION_RESET = 0x05, +}; +typedef enum mip_function_selector mip_function_selector; +void insert_mip_function_selector(microstrain_serializer* serializer, enum mip_function_selector self); +void extract_mip_function_selector(microstrain_serializer* serializer, enum mip_function_selector* self); + + +#ifdef __cplusplus +} // extern "C" +} // namespace C +} // namespace mip +#endif // __cplusplus diff --git a/src/mip/extras/device_models.c b/src/c/mip/mip_device_models.c similarity index 95% rename from src/mip/extras/device_models.c rename to src/c/mip/mip_device_models.c index 8566c0958..5bd4d47bd 100644 --- a/src/mip/extras/device_models.c +++ b/src/c/mip/mip_device_models.c @@ -1,5 +1,5 @@ -#include "device_models.h" +#include "mip_device_models.h" #include #include @@ -41,7 +41,7 @@ mip_model_number get_model_from_string(const char* model_or_serial) if (i < start_index + 4) return MODEL_UNKNOWN; - return atoi(model_or_serial + start_index); + return (mip_model_number)atoi(model_or_serial + start_index); } const char* get_model_name_from_number(mip_model_number model) @@ -73,6 +73,7 @@ const char* get_model_name_from_number(mip_model_number model) case MODEL_3DM_CX5_25: return "3DM-CX5-25"; case MODEL_3DM_CX5_15: return "3DM-CX5-15"; case MODEL_3DM_CX5_10: return "3DM-CX5-10"; + case MODEL_3DM_CL5_10: return "3DM-CL5-10"; case MODEL_3DM_CL5_15: return "3DM-CL5-15"; case MODEL_3DM_CL5_25: return "3DM-CL5-25"; case MODEL_3DM_GQ7: return "3DM-GQ7"; diff --git a/src/mip/extras/device_models.h b/src/c/mip/mip_device_models.h similarity index 97% rename from src/mip/extras/device_models.h rename to src/c/mip/mip_device_models.h index 5b47ce67b..5f9769e24 100644 --- a/src/mip/extras/device_models.h +++ b/src/c/mip/mip_device_models.h @@ -2,8 +2,7 @@ #ifdef __cplusplus namespace mip { -namespace C -{ +namespace C { extern "C" { #endif // __cplusplus @@ -62,7 +61,7 @@ const char* get_model_name_from_number(mip_model_number model); using ModelNumber = C::mip_model_number; inline ModelNumber getModelFromString(const char* model_or_serial) { return C::get_model_from_string(model_or_serial); } -inline const char* getModelNameFromNumber(ModelNumber model) { return get_model_name_from_number(model); } +inline const char* getModelNameFromNumber(ModelNumber model) { return C::get_model_name_from_number(model); } } // namespace mip diff --git a/src/mip/mip_dispatch.c b/src/c/mip/mip_dispatch.c similarity index 98% rename from src/mip/mip_dispatch.c rename to src/c/mip/mip_dispatch.c index 251e1770e..58c551071 100644 --- a/src/mip/mip_dispatch.c +++ b/src/c/mip/mip_dispatch.c @@ -10,8 +10,10 @@ #ifdef __cplusplus namespace mip { namespace C { +extern "C" { #endif + //////////////////////////////////////////////////////////////////////////////// ///@brief Type of dispatch callback. /// @@ -267,7 +269,7 @@ static bool mip_dispatch_is_descriptor_set_match(uint8_t desc_set, uint8_t handl ///@param timestamp Packet parse time. ///@param post If true, this is called after field iteration. Otherwise before. /// -static void mip_dispatcher_call_packet_callbacks(mip_dispatcher* self, const mip_packet* packet, mip_timestamp timestamp, bool post) +static void mip_dispatcher_call_packet_callbacks(mip_dispatcher* self, const mip_packet_view* packet, mip_timestamp timestamp, bool post) { const uint8_t descriptor_set = mip_packet_descriptor_set(packet); @@ -312,7 +314,7 @@ static bool mip_dispatch_is_descriptor_match(uint8_t desc_set, uint8_t field_des ///@param field Valid MIP field. ///@param timestamp Packet parse time. /// -static void mip_dispatcher_call_field_callbacks(mip_dispatcher* self, const mip_field* field, mip_timestamp timestamp) +static void mip_dispatcher_call_field_callbacks(mip_dispatcher* self, const mip_field_view* field, mip_timestamp timestamp) { const uint8_t descriptor_set = mip_field_descriptor_set(field); const uint8_t field_descriptor = mip_field_field_descriptor(field); @@ -348,11 +350,11 @@ static void mip_dispatcher_call_field_callbacks(mip_dispatcher* self, const mip_ ///@param timestamp /// The approximate parse time of the packet. /// -void mip_dispatcher_dispatch_packet(mip_dispatcher* self, const mip_packet* packet, mip_timestamp timestamp) +void mip_dispatcher_dispatch_packet(mip_dispatcher* self, const mip_packet_view* packet, mip_timestamp timestamp) { mip_dispatcher_call_packet_callbacks(self, packet, timestamp, false); - mip_field field; + mip_field_view field; mip_field_init_empty(&field); while( mip_field_next_in_packet(&field, packet) ) { @@ -363,6 +365,7 @@ void mip_dispatcher_dispatch_packet(mip_dispatcher* self, const mip_packet* pack } #ifdef __cplusplus +} // extern "C" } // namespace C } // namespace mip #endif diff --git a/src/mip/mip_dispatch.h b/src/c/mip/mip_dispatch.h similarity index 79% rename from src/mip/mip_dispatch.h rename to src/c/mip/mip_dispatch.h index 59b02dbbf..ed956e629 100644 --- a/src/mip/mip_dispatch.h +++ b/src/c/mip/mip_dispatch.h @@ -3,7 +3,7 @@ #include "mip_types.h" #include "mip_field.h" #include "mip_packet.h" -#include "definitions/descriptors.h" +#include "mip_descriptors.h" #include @@ -11,6 +11,7 @@ #ifdef __cplusplus namespace mip { namespace C { +extern "C" { #endif @@ -20,10 +21,16 @@ namespace C { //////////////////////////////////////////////////////////////////////////////// -///@defgroup MipDispatch_c Mip Dispatch [C] +///@defgroup MipDispatch_c Data Dispatch /// ///@brief System for issuing callbacks from MIP packets or fields. /// +/// The user's application may register handlers in the dispatcher to receive +/// callbacks for reception of various types of data. Packets, fields, and +/// deserialized data callbacks may be registered. +/// +///@see mip_dispatch +/// ///@{ @@ -35,7 +42,7 @@ namespace C { ///@param packet The MIP packet triggering this callback. ///@param timestamp The approximate parse time of the packet. /// -typedef void (*mip_dispatch_packet_callback)(void* context, const mip_packet* packet, mip_timestamp timestamp); +typedef void (*mip_dispatch_packet_callback)(void* context, const mip_packet_view* packet, mip_timestamp timestamp); //////////////////////////////////////////////////////////////////////////////// ///@brief Signature for field-level callbacks. @@ -44,7 +51,7 @@ typedef void (*mip_dispatch_packet_callback)(void* context, const mip_packet* pa ///@param field The MIP field triggering this callback. ///@param timestamp The approximate parse time of the packet. /// -typedef void (*mip_dispatch_field_callback )(void* context, const mip_field* field, mip_timestamp timestamp); +typedef void (*mip_dispatch_field_callback)(void* context, const mip_field_view* field, mip_timestamp timestamp); //////////////////////////////////////////////////////////////////////////////// ///@brief Signature for extraction callbacks. @@ -52,7 +59,7 @@ typedef void (*mip_dispatch_field_callback )(void* context, const mip_field* fie ///@param field A valid mip_field. ///@param ptr A pointer to the destination field structure. /// -typedef bool (*mip_dispatch_extractor)(const mip_field* field, void* ptr); +typedef bool (*mip_dispatch_extractor)(const mip_field_view* field, void *ptr); enum { @@ -68,7 +75,7 @@ enum { }; //////////////////////////////////////////////////////////////////////////////// -///@defgroup mip_dispatch_handler mip_dispatch_handler +///@defgroup MipDispatchHandler_c Dispatch Handler /// /// This represents a binding between a MIP descriptor pair and a callback /// function. @@ -89,9 +96,9 @@ typedef struct mip_dispatch_handler struct mip_dispatch_handler* _next; ///<@private Pointer to the next handler in the list. union { - mip_dispatch_packet_callback _packet_callback; ///<@private User function for packets. Valid if _type is MIP_DISPATCH_TYPE_PACKET_*. - mip_dispatch_field_callback _field_callback; ///<@private User callback for data fields. Valid if _type is MIP_DISPATCH_TYPE_FIELD. - mip_dispatch_extractor _extract_callback; ///<@private User callback for data fields. Valid if _type is MIP_DISPATCH_TYPE_EXTRACT. + mip_dispatch_packet_callback _packet_callback; ///<@private User function for packets. Valid if _type is MIP_DISPATCH_TYPE_PACKET_*. + mip_dispatch_field_callback _field_callback; ///<@private User callback for data fields. Valid if _type is MIP_DISPATCH_TYPE_FIELD. + mip_dispatch_extractor _extract_callback; ///<@private User callback for data fields. Valid if _type is MIP_DISPATCH_TYPE_EXTRACT. }; void* _user_data; ///<@private User-provided pointer which is passed directly to the callback. uint8_t _type; ///<@private Type of the callback. (Using u8 for better struct packing.) @see mip_dispatch_type @@ -111,7 +118,9 @@ bool mip_dispatch_handler_is_enabled(mip_dispatch_handler* handler); ///@} //////////////////////////////////////////////////////////////////////////////// -///@defgroup MipDispatchHandler mip_dispatch_handler - Represents a callback +///@defgroup MipDispatcher_c Mip Dispatcher +/// +/// This is included in the Mip Interface to allow the registration of callbacks. /// ///@{ @@ -129,7 +138,7 @@ void mip_dispatcher_add_handler(mip_dispatcher* self, mip_dispatch_handler* hand void mip_dispatcher_remove_handler(mip_dispatcher* self, mip_dispatch_handler* handler); void mip_dispatcher_remove_all_handlers(mip_dispatcher* self); -void mip_dispatcher_dispatch_packet(mip_dispatcher* self, const mip_packet* packet, mip_timestamp timestamp); +void mip_dispatcher_dispatch_packet(mip_dispatcher* self, const mip_packet_view* packet, mip_timestamp timestamp); ///@} ///@} @@ -138,6 +147,7 @@ void mip_dispatcher_dispatch_packet(mip_dispatcher* self, const mip_packet* pack #ifdef __cplusplus +} // extern "C" } // namespace C } // namespace mip #endif diff --git a/src/mip/mip_field.c b/src/c/mip/mip_field.c similarity index 85% rename from src/mip/mip_field.c rename to src/c/mip/mip_field.c index de7548430..99e39efe8 100644 --- a/src/mip/mip_field.c +++ b/src/c/mip/mip_field.c @@ -3,13 +3,21 @@ #include "mip_packet.h" #include "mip_offsets.h" -#include "definitions/descriptors.h" +#include "mip_descriptors.h" + +#include #include +#ifdef __cplusplus +namespace mip { +namespace C { +extern "C" { +#endif + //////////////////////////////////////////////////////////////////////////////// -///@brief Constructs a %mip_field given the parameters. +///@brief Constructs a field view given the parameters. /// ///@param field ///@param descriptor_set @@ -23,9 +31,7 @@ ///@param payload_length /// The length of the payload. Cannot exceed MIP_FIELD_PAYLOAD_LENGTH_MAX. /// -///@returns A %mip_field initialized with the specified values. -/// -void mip_field_init(mip_field* field, uint8_t descriptor_set, uint8_t field_descriptor, const uint8_t* payload, uint8_t payload_length) +void mip_field_init(mip_field_view* field, uint8_t descriptor_set, uint8_t field_descriptor, const uint8_t* payload, uint8_t payload_length) { assert( payload_length <= MIP_FIELD_PAYLOAD_LENGTH_MAX ); if( payload_length > MIP_FIELD_PAYLOAD_LENGTH_MAX ) @@ -41,7 +47,7 @@ void mip_field_init(mip_field* field, uint8_t descriptor_set, uint8_t field_desc //////////////////////////////////////////////////////////////////////////////// ///@brief Returns the descriptor set of the packet containing this field._ /// -uint8_t mip_field_descriptor_set(const mip_field* field) +uint8_t mip_field_descriptor_set(const mip_field_view* field) { return field->_descriptor_set; } @@ -49,7 +55,7 @@ uint8_t mip_field_descriptor_set(const mip_field* field) //////////////////////////////////////////////////////////////////////////////// ///@brief Returns the field descriptor. /// -uint8_t mip_field_field_descriptor(const mip_field* field) +uint8_t mip_field_field_descriptor(const mip_field_view* field) { return field->_field_descriptor; } @@ -57,7 +63,7 @@ uint8_t mip_field_field_descriptor(const mip_field* field) //////////////////////////////////////////////////////////////////////////////// ///@brief Returns the length of the payload. /// -uint8_t mip_field_payload_length(const mip_field* field) +uint8_t mip_field_payload_length(const mip_field_view* field) { assert(field->_payload_length <= MIP_FIELD_PAYLOAD_LENGTH_MAX); @@ -67,7 +73,7 @@ uint8_t mip_field_payload_length(const mip_field* field) //////////////////////////////////////////////////////////////////////////////// ///@brief Returns the payload pointer for the field data. /// -const uint8_t* mip_field_payload(const mip_field* field) +const uint8_t* mip_field_payload(const mip_field_view* field) { return field->_payload; } @@ -75,7 +81,7 @@ const uint8_t* mip_field_payload(const mip_field* field) //////////////////////////////////////////////////////////////////////////////// ///@brief Returns true if the field has a valid field descriptor. /// -bool mip_field_is_valid(const mip_field* field) +bool mip_field_is_valid(const mip_field_view* field) { return field->_field_descriptor != MIP_INVALID_FIELD_DESCRIPTOR; } @@ -90,7 +96,7 @@ bool mip_field_is_valid(const mip_field* field) /// ///@param field /// -void mip_field_init_empty(mip_field* field) +void mip_field_init_empty(mip_field_view* field) { mip_field_init(field, MIP_INVALID_DESCRIPTOR_SET, MIP_INVALID_FIELD_DESCRIPTOR, NULL, 0); } @@ -113,9 +119,9 @@ void mip_field_init_empty(mip_field* field) /// ///@returns a mip_field struct with the field data. /// -mip_field mip_field_from_header_ptr(const uint8_t* header, uint8_t total_length, uint8_t descriptor_set) +mip_field_view mip_field_from_header_ptr(const uint8_t* header, uint8_t total_length, uint8_t descriptor_set) { - mip_field field; + mip_field_view field; // Default invalid values. field._payload = NULL; @@ -161,13 +167,13 @@ mip_field mip_field_from_header_ptr(const uint8_t* header, uint8_t total_length, /// ///@returns A mip_field struct with the first field from the packet. /// -mip_field mip_field_first_from_packet(const mip_packet* packet) +mip_field_view mip_field_first_from_packet(const mip_packet_view* packet) { return mip_field_from_header_ptr( mip_packet_payload(packet), mip_packet_payload_length(packet), mip_packet_descriptor_set(packet) ); } //////////////////////////////////////////////////////////////////////////////// -///@brief Gets the next field after the specified field._ +///@brief Gets the next field after the specified field. /// ///@param field /// An existing MIP field in a packet. Can be invalid, in which case the @@ -176,7 +182,7 @@ mip_field mip_field_first_from_packet(const mip_packet* packet) ///@returns A mip_field struct referencing the next field after the input /// field._ Check mip_field_is_valid() to see if the field exists. /// -mip_field mip_field_next_after(const mip_field* field) +mip_field_view mip_field_next_after(const mip_field_view* field) { // Payload length must be zero if payload is NULL. assert(!(field->_payload == NULL) || (field->_payload_length == 0)); @@ -195,7 +201,7 @@ mip_field mip_field_next_after(const mip_field* field) /// ///@returns true if the field exists and is valid. /// -bool mip_field_next(mip_field* field) +bool mip_field_next(mip_field_view* field) { *field = mip_field_next_after(field); @@ -224,7 +230,7 @@ bool mip_field_next(mip_field* field) /// } ///@endcode /// -bool mip_field_next_in_packet(mip_field* field, const mip_packet* packet) +bool mip_field_next_in_packet(mip_field_view* field, const mip_packet_view* packet) { if( field->_descriptor_set != MIP_INVALID_DESCRIPTOR_SET ) *field = mip_field_next_after(field); @@ -233,3 +239,9 @@ bool mip_field_next_in_packet(mip_field* field, const mip_packet* packet) return mip_field_is_valid(field); } + +#ifdef __cplusplus +} // extern "C" +} // namespace C +} // namespace mip +#endif diff --git a/src/mip/mip_field.h b/src/c/mip/mip_field.h similarity index 72% rename from src/mip/mip_field.h rename to src/c/mip/mip_field.h index 919d54246..dbc8b4c4a 100644 --- a/src/mip/mip_field.h +++ b/src/c/mip/mip_field.h @@ -5,7 +5,7 @@ #include "mip_packet.h" #ifdef __cplusplus -namespace mip{ +namespace mip { namespace C { extern "C" { #endif @@ -16,7 +16,7 @@ extern "C" { ///@{ //////////////////////////////////////////////////////////////////////////////// -///@defgroup mip_field_c Mip Fields [C] +///@defgroup MipFields_c Mip Fields /// ///@brief Functions for processing received MIP fields. /// @@ -42,42 +42,42 @@ extern "C" { /// /// This structure references the original packet data and does not contain a /// copy of the field payload. Therefore, the data buffer must exist as long as -/// there are %mip_field instances which reference it (even if the field payload +/// there are instances which reference it (even if the field payload /// itself is not used directly). /// ///@note This should be considered an "opaque" structure; its members should be /// considered an internal implementation detail. Avoid accessing them directly /// as they are subject to change in future versions of this software. /// -typedef struct mip_field +typedef struct mip_field_view { const uint8_t* _payload; ///<@private The field payload, excluding the header. uint8_t _payload_length; ///<@private The length of the payload, excluding the header. uint8_t _field_descriptor; ///<@private MIP field descriptor. Field not valid if set to 0x00. uint8_t _descriptor_set; ///<@private MIP descriptor set (from the packet) uint8_t _remaining_length; ///<@private Remaining space after this field. -} mip_field; +} mip_field_view; -void mip_field_init(mip_field* field, uint8_t descriptor_set, uint8_t field_descriptor, const uint8_t* payload, uint8_t payload_length); +void mip_field_init(mip_field_view* field, uint8_t descriptor_set, uint8_t field_descriptor, const uint8_t* payload, uint8_t payload_length); //////////////////////////////////////////////////////////////////////////////// -///@defgroup FieldAccess Field Accessors [C] +///@defgroup MipFieldAccess_c Mip Field Accessors /// ///@brief Functions for inspecting a MIP field. /// ///@{ -uint8_t mip_field_descriptor_set(const mip_field* field); -uint8_t mip_field_field_descriptor(const mip_field* field); -uint8_t mip_field_payload_length(const mip_field* field); -const uint8_t* mip_field_payload(const mip_field* field); +uint8_t mip_field_descriptor_set(const mip_field_view* field); +uint8_t mip_field_field_descriptor(const mip_field_view* field); +uint8_t mip_field_payload_length(const mip_field_view* field); +const uint8_t* mip_field_payload(const mip_field_view* field); -bool mip_field_is_valid(const mip_field* field); +bool mip_field_is_valid(const mip_field_view* field); ///@} //////////////////////////////////////////////////////////////////////////////// -///@defgroup FieldIteration_c Field Iteration [C] +///@defgroup MipFieldIteration_c Mip Field Iteration /// ///@brief Functions for iterating over fields in a MIP packet. /// @@ -100,15 +100,15 @@ bool mip_field_is_valid(const mip_field* field); /// ///@{ -void mip_field_init_empty(mip_field* field); +void mip_field_init_empty(mip_field_view* field); -mip_field mip_field_from_header_ptr(const uint8_t* header, uint8_t total_length, uint8_t descriptor_set); +mip_field_view mip_field_from_header_ptr(const uint8_t* header, uint8_t total_length, uint8_t descriptor_set); -mip_field mip_field_first_from_packet(const mip_packet* packet); -mip_field mip_field_next_after(const mip_field* field); -bool mip_field_next(mip_field* field); +mip_field_view mip_field_first_from_packet(const mip_packet_view* packet); +mip_field_view mip_field_next_after(const mip_field_view* field); +bool mip_field_next(mip_field_view* field); -bool mip_field_next_in_packet(mip_field* field, const mip_packet* packet); +bool mip_field_next_in_packet(mip_field_view* field, const mip_packet_view* packet); // bool mip_field_is_at_end(const struct mip_field* field); @@ -119,7 +119,7 @@ bool mip_field_next_in_packet(mip_field* field, const mip_packet* packet); /// #ifdef __cplusplus -} // namespace mip -} // namespace C } // extern "C" +} // namespace C +} // namespace mip #endif diff --git a/src/mip/mip_interface.c b/src/c/mip/mip_interface.c similarity index 98% rename from src/mip/mip_interface.c rename to src/c/mip/mip_interface.c index 586b7689a..03740d269 100644 --- a/src/mip/mip_interface.c +++ b/src/c/mip/mip_interface.c @@ -3,12 +3,18 @@ #include "mip_field.h" -#include "definitions/descriptors.h" +#include "mip_descriptors.h" #include #include +#ifdef __cplusplus +namespace mip { +namespace C { +extern "C" { +#endif + //////////////////////////////////////////////////////////////////////////////// ///@typedef mip::C::mip_send_callback /// @@ -483,7 +489,7 @@ void mip_interface_process_unparsed_packets(mip_interface* device) ///@param timestamp /// timestamp_type of the received MIP packet. /// -void mip_interface_receive_packet(mip_interface* device, const mip_packet* packet, mip_timestamp timestamp) +void mip_interface_receive_packet(mip_interface* device, const mip_packet_view* packet, mip_timestamp timestamp) { mip_cmd_queue_process_packet(&device->_queue, packet, timestamp); mip_dispatcher_dispatch_packet(&device->_dispatcher, packet, timestamp); @@ -498,7 +504,7 @@ void mip_interface_receive_packet(mip_interface* device, const mip_packet* packe /// ///@returns True /// -bool mip_interface_parse_callback(void* device, const mip_packet* packet, mip_timestamp timestamp) +bool mip_interface_parse_callback(void* device, const mip_packet_view* packet, mip_timestamp timestamp) { mip_interface_receive_packet(device, packet, timestamp); @@ -602,7 +608,7 @@ enum mip_cmd_result mip_interface_run_command_with_response(mip_interface* devic uint8_t buffer[MIP_PACKET_LENGTH_MAX]; - mip_packet packet; + mip_packet_view packet; mip_packet_create(&packet, buffer, sizeof(buffer), descriptor_set); mip_packet_add_field(&packet, cmd_descriptor, cmd_data, cmd_length); mip_packet_finalize(&packet); @@ -629,7 +635,7 @@ enum mip_cmd_result mip_interface_run_command_with_response(mip_interface* devic ///@param cmd /// The command status tracker. No lifetime requirement. /// -enum mip_cmd_result mip_interface_run_command_packet(mip_interface* device, const mip_packet* packet, mip_pending_cmd* cmd) +enum mip_cmd_result mip_interface_run_command_packet(mip_interface* device, const mip_packet_view* packet, mip_pending_cmd* cmd) { if( !mip_interface_start_command_packet(device, packet, cmd) ) return MIP_STATUS_ERROR; @@ -650,7 +656,7 @@ enum mip_cmd_result mip_interface_run_command_packet(mip_interface* device, cons ///@returns False on error sending the packet. No cleanup is necessary and cmd /// can be destroyed immediately afterward in this case. /// -bool mip_interface_start_command_packet(mip_interface* device, const mip_packet* packet, mip_pending_cmd* cmd) +bool mip_interface_start_command_packet(mip_interface* device, const mip_packet_view* packet, mip_pending_cmd* cmd) { mip_cmd_queue_enqueue(mip_interface_cmd_queue(device), cmd); @@ -729,4 +735,11 @@ void mip_interface_register_extractor( { mip_dispatch_handler_init_extractor(handler, descriptor_set, field_descriptor, extractor, field_ptr); mip_dispatcher_add_handler(&device->_dispatcher, handler); -} \ No newline at end of file +} + + +#ifdef __cplusplus +} // extern "C" +} // namespace C +} // namespace mip +#endif diff --git a/src/mip/mip_interface.h b/src/c/mip/mip_interface.h similarity index 94% rename from src/mip/mip_interface.h rename to src/c/mip/mip_interface.h index c3d2868ed..dad828edd 100644 --- a/src/mip/mip_interface.h +++ b/src/c/mip/mip_interface.h @@ -1,14 +1,14 @@ #pragma once -#include -#include - #include "mip_parser.h" #include "mip_cmdqueue.h" #include "mip_dispatch.h" +#include +#include + #ifdef __cplusplus -namespace mip{ +namespace mip { namespace C { extern "C" { #endif @@ -17,9 +17,9 @@ extern "C" { ///@addtogroup mip_c ///@{ //////////////////////////////////////////////////////////////////////////////// -///@defgroup mip_interface_c Mip Interface [C] +///@defgroup mip_interface_c Mip Interface /// -///@brief High-level C functions for controlling a MIP device. +///@brief High-level %C functions for controlling a MIP device. /// /// This module contains functions and classes for communicating with a /// MIP device in C. @@ -72,8 +72,8 @@ bool mip_interface_update(mip_interface* device, mip_timeout wait_time); bool mip_interface_default_update(mip_interface* device, mip_timeout wait_time); size_t mip_interface_receive_bytes(mip_interface* device, const uint8_t* data, size_t length, mip_timestamp timestamp); void mip_interface_process_unparsed_packets(mip_interface* device); -bool mip_interface_parse_callback(void* device, const mip_packet* packet, mip_timestamp timestamp); -void mip_interface_receive_packet(mip_interface* device, const mip_packet* packet, mip_timestamp timestamp); +bool mip_interface_parse_callback(void* device, const mip_packet_view* packet, mip_timestamp timestamp); +void mip_interface_receive_packet(mip_interface* device, const mip_packet_view* packet, mip_timestamp timestamp); // // Commands @@ -82,9 +82,9 @@ void mip_interface_receive_packet(mip_interface* device, const mip_packet* packe enum mip_cmd_result mip_interface_wait_for_reply(mip_interface* device, mip_pending_cmd* cmd); enum mip_cmd_result mip_interface_run_command(mip_interface* device, uint8_t descriptor_set, uint8_t field_descriptor, const uint8_t* payload, uint8_t payload_length); enum mip_cmd_result mip_interface_run_command_with_response(mip_interface* device, uint8_t descriptor_set, uint8_t field_descriptor, const uint8_t* payload, uint8_t payload_length, uint8_t response_descriptor, uint8_t* response_data, uint8_t* response_length_inout); -enum mip_cmd_result mip_interface_run_command_packet(mip_interface* device, const mip_packet* packet, mip_pending_cmd* cmd); +enum mip_cmd_result mip_interface_run_command_packet(mip_interface* device, const mip_packet_view* packet, mip_pending_cmd* cmd); -bool mip_interface_start_command_packet(mip_interface* device, const mip_packet* packet, mip_pending_cmd* cmd); +bool mip_interface_start_command_packet(mip_interface* device, const mip_packet_view* packet, mip_pending_cmd* cmd); // // Data Callbacks @@ -118,7 +118,7 @@ mip_cmd_queue* mip_interface_cmd_queue(mip_interface* device); ///@} #ifdef __cplusplus -} // namespace mip -} // namespace C } // extern "C" +} // namespace C +} // namespace mip #endif diff --git a/src/mip/mip_offsets.h b/src/c/mip/mip_offsets.h similarity index 100% rename from src/mip/mip_offsets.h rename to src/c/mip/mip_offsets.h diff --git a/src/mip/mip_packet.c b/src/c/mip/mip_packet.c similarity index 84% rename from src/mip/mip_packet.c rename to src/c/mip/mip_packet.c index d5f6496af..e387270e0 100644 --- a/src/mip/mip_packet.c +++ b/src/c/mip/mip_packet.c @@ -2,11 +2,19 @@ #include "mip_packet.h" #include "mip_offsets.h" -#include "definitions/descriptors.h" +#include "mip_descriptors.h" + +#include #include #include +#ifdef __cplusplus +namespace mip { +namespace C { +extern "C" { +#endif + // // Initialization @@ -33,7 +41,7 @@ /// MIP_PACKET_LENGTH_MIN bytes, calling the accessor functions is undefined /// behavior. /// -void mip_packet_from_buffer(mip_packet* packet, uint8_t* buffer, size_t length) +void mip_packet_from_buffer(mip_packet_view* packet, const uint8_t* buffer, size_t length) { assert(buffer != NULL); @@ -41,7 +49,7 @@ void mip_packet_from_buffer(mip_packet* packet, uint8_t* buffer, size_t length) if( length > MIP_PACKET_LENGTH_MAX ) length = MIP_PACKET_LENGTH_MAX; - packet->_buffer = buffer; + packet->_buffer = (uint8_t*)buffer; packet->_buffer_length = (uint_least16_t)length; } @@ -59,7 +67,7 @@ void mip_packet_from_buffer(mip_packet* packet, uint8_t* buffer, size_t length) ///@param descriptor_set /// The MIP descriptor set for the packet. /// -void mip_packet_create(mip_packet* packet, uint8_t* buffer, size_t buffer_size, uint8_t descriptor_set) +void mip_packet_create(mip_packet_view* packet, uint8_t* buffer, size_t buffer_size, uint8_t descriptor_set) { mip_packet_from_buffer(packet, buffer, buffer_size); @@ -84,7 +92,7 @@ void mip_packet_create(mip_packet* packet, uint8_t* buffer, size_t buffer_size, //////////////////////////////////////////////////////////////////////////////// ///@brief Returns the MIP descriptor set for this packet. /// -uint8_t mip_packet_descriptor_set(const mip_packet* packet) +uint8_t mip_packet_descriptor_set(const mip_packet_view* packet) { return packet->_buffer[MIP_INDEX_DESCSET]; } @@ -92,7 +100,7 @@ uint8_t mip_packet_descriptor_set(const mip_packet* packet) //////////////////////////////////////////////////////////////////////////////// ///@brief Returns the length of the payload (MIP fields). /// -uint8_t mip_packet_payload_length(const mip_packet* packet) +uint8_t mip_packet_payload_length(const mip_packet_view* packet) { return packet->_buffer[MIP_INDEX_LENGTH]; } @@ -102,7 +110,7 @@ uint8_t mip_packet_payload_length(const mip_packet* packet) /// ///@returns The length of the packet. Always at least MIP_PACKET_LENGTH_MIN. /// -uint_least16_t mip_packet_total_length(const mip_packet* packet) +uint_least16_t mip_packet_total_length(const mip_packet_view* packet) { return mip_packet_payload_length(packet) + MIP_PACKET_LENGTH_MIN; } @@ -110,7 +118,7 @@ uint_least16_t mip_packet_total_length(const mip_packet* packet) //////////////////////////////////////////////////////////////////////////////// ///@brief Returns a writable pointer to the data buffer. /// -uint8_t* mip_packet_buffer(mip_packet* packet) +uint8_t* mip_packet_buffer(mip_packet_view* packet) { return packet->_buffer; } @@ -118,7 +126,7 @@ uint8_t* mip_packet_buffer(mip_packet* packet) //////////////////////////////////////////////////////////////////////////////// ///@brief Returns a pointer to the data buffer containing the packet. /// -const uint8_t* mip_packet_pointer(const mip_packet* packet) +const uint8_t* mip_packet_pointer(const mip_packet_view* packet) { return packet->_buffer; } @@ -126,7 +134,7 @@ const uint8_t* mip_packet_pointer(const mip_packet* packet) //////////////////////////////////////////////////////////////////////////////// ///@brief Returns a pointer to the packet's payload (the first field). /// -const uint8_t* mip_packet_payload(const mip_packet* packet) +const uint8_t* mip_packet_payload(const mip_packet_view* packet) { return packet->_buffer + MIP_INDEX_PAYLOAD; } @@ -137,7 +145,7 @@ const uint8_t* mip_packet_payload(const mip_packet* packet) /// This function does not compute the checksum. To do so, use /// mip_packet_compute_checksum(). /// -uint16_t mip_packet_checksum_value(const mip_packet* packet) +uint16_t mip_packet_checksum_value(const mip_packet_view* packet) { const uint_least16_t index = mip_packet_total_length(packet) - MIP_CHECKSUM_LENGTH; @@ -149,7 +157,7 @@ uint16_t mip_packet_checksum_value(const mip_packet* packet) /// ///@returns The computed checksum value. /// -uint16_t mip_packet_compute_checksum(const mip_packet* packet) +uint16_t mip_packet_compute_checksum(const mip_packet_view* packet) { uint8_t a = 0; uint8_t b = 0; @@ -176,7 +184,7 @@ uint16_t mip_packet_compute_checksum(const mip_packet* packet) /// used to access it (to do so is undefined behavior). This should never occur /// in normal circumstances. /// -bool mip_packet_is_sane(const mip_packet* packet) +bool mip_packet_is_sane(const mip_packet_view* packet) { return packet->_buffer && (packet->_buffer_length >= MIP_PACKET_LENGTH_MIN) && (packet->_buffer_length >= mip_packet_payload_length(packet)+MIP_PACKET_LENGTH_MIN); } @@ -189,7 +197,7 @@ bool mip_packet_is_sane(const mip_packet* packet) /// * The descriptor set is not 0x00, and /// * The checksum is valid. /// -bool mip_packet_is_valid(const mip_packet* packet) +bool mip_packet_is_valid(const mip_packet_view* packet) { if( !mip_packet_is_sane(packet) || (mip_packet_descriptor_set(packet) == 0x00) ) return false; @@ -207,7 +215,7 @@ bool mip_packet_is_valid(const mip_packet* packet) /// ///@returns true if the packet has a payload length of 0. /// -bool mip_packet_is_empty(const mip_packet* packet) +bool mip_packet_is_empty(const mip_packet_view* packet) { if( !mip_packet_is_sane(packet) ) return true; @@ -221,7 +229,7 @@ bool mip_packet_is_empty(const mip_packet* packet) /// ///@note This is the BUFFER SIZE and not the packet length. /// -uint_least16_t mip_packet_buffer_size(const mip_packet* packet) +uint_least16_t mip_packet_buffer_size(const mip_packet_view* packet) { return packet->_buffer_length; } @@ -235,7 +243,7 @@ uint_least16_t mip_packet_buffer_size(const mip_packet* packet) /// buffer capacity. Such packets are not 'sane' (mip_packet_is_sane) /// and can only be produced by manipulating the buffered data directly. /// -int mip_packet_remaining_space(const mip_packet* packet) +int mip_packet_remaining_space(const mip_packet_view* packet) { return mip_packet_buffer_size(packet) - mip_packet_total_length(packet); } @@ -248,7 +256,7 @@ int mip_packet_remaining_space(const mip_packet* packet) ///@returns true if the packet contains data. ///@returns false if it contains commands or replies. /// -bool mip_packet_is_data(const mip_packet* packet) +bool mip_packet_is_data(const mip_packet_view* packet) { return mip_is_data_descriptor_set(mip_packet_descriptor_set(packet)); } @@ -286,10 +294,10 @@ bool mip_packet_is_data(const mip_packet* packet) /// ///@returns true if the field was added, or false if there was not enough space. /// -bool mip_packet_add_field(mip_packet* packet, uint8_t field_descriptor, const uint8_t* payload, uint8_t payload_length) +bool mip_packet_add_field(mip_packet_view* packet, uint8_t field_descriptor, const uint8_t* payload, uint8_t payload_length) { uint8_t* payload_buffer; - int remaining = mip_packet_alloc_field(packet, field_descriptor, payload_length, &payload_buffer); + int remaining = mip_packet_create_field(packet, field_descriptor, payload_length, &payload_buffer); if( remaining < 0 ) return false; @@ -328,7 +336,7 @@ bool mip_packet_add_field(mip_packet* packet, uint8_t field_descriptor, const ui /// is negative, the field could not be allocated and the payload must /// not be written. /// -int mip_packet_alloc_field(mip_packet* packet, uint8_t field_descriptor, uint8_t payload_length, uint8_t** const payload_ptr_out) +int mip_packet_create_field(mip_packet_view* packet, uint8_t field_descriptor, uint8_t payload_length, uint8_t** payload_ptr_out) { assert(payload_ptr_out != NULL); assert( payload_length <= MIP_FIELD_PAYLOAD_LENGTH_MAX ); @@ -357,7 +365,7 @@ int mip_packet_alloc_field(mip_packet* packet, uint8_t field_descriptor, uint8_t //////////////////////////////////////////////////////////////////////////////// ///@brief Changes the size of the last field in the packet. /// -/// Use this in conjunction with mip_packet_alloc_field() when the size of the +/// Use this in conjunction with mip_packet_create_field() when the size of the /// field is not known in advance. Pass a payload size of 0 to alloc_field and /// check that the returned available space is sufficient, then write the /// payload and call this function with the actual space used. @@ -375,7 +383,7 @@ int mip_packet_alloc_field(mip_packet* packet, uint8_t field_descriptor, uint8_t ///@returns The space remaining in the packet after changing the field size. /// This will be negative if the new length did not fit. /// -int mip_packet_realloc_last_field(mip_packet* packet, uint8_t* payload_ptr, uint8_t new_payload_length) +int mip_packet_update_last_field_length(mip_packet_view* packet, uint8_t* payload_ptr, uint8_t new_payload_length) { assert(payload_ptr != NULL); assert( new_payload_length <= MIP_FIELD_PAYLOAD_LENGTH_MAX ); @@ -400,7 +408,7 @@ int mip_packet_realloc_last_field(mip_packet* packet, uint8_t* payload_ptr, uint //////////////////////////////////////////////////////////////////////////////// ///@brief Removes the last field from the packet after having allocated it. /// -/// Use only after allocating a field with mip_packet_alloc_field to cancel it. +/// Use only after allocating a field with mip_packet_create_field to cancel it. /// E.g. if it turns out that there isn't enough buffer space to write the /// payload. /// @@ -411,7 +419,7 @@ int mip_packet_realloc_last_field(mip_packet* packet, uint8_t* payload_ptr, uint /// ///@returns The remaining space in the packet after removing the field. /// -int mip_packet_cancel_last_field(mip_packet* packet, uint8_t* payload_ptr) +int mip_packet_cancel_last_field(mip_packet_view* packet, uint8_t* payload_ptr) { assert(payload_ptr != NULL); @@ -440,7 +448,7 @@ int mip_packet_cancel_last_field(mip_packet* packet, uint8_t* payload_ptr) /// Total Length ///~~~ /// -void mip_packet_finalize(mip_packet* packet) +void mip_packet_finalize(mip_packet_view* packet) { uint16_t checksum = mip_packet_compute_checksum(packet); uint_least16_t length = mip_packet_total_length(packet) - MIP_CHECKSUM_LENGTH; @@ -458,8 +466,14 @@ void mip_packet_finalize(mip_packet* packet) ///@param packet ///@param descriptor_set New descriptor set. /// -void mip_packet_reset(mip_packet* packet, uint8_t descriptor_set) +void mip_packet_reset(mip_packet_view* packet, uint8_t descriptor_set) { mip_packet_create(packet, mip_packet_buffer(packet), mip_packet_buffer_size(packet), descriptor_set); } + +#ifdef __cplusplus +} // extern "C" +} // namespace C +} // namespace mip +#endif diff --git a/src/c/mip/mip_packet.h b/src/c/mip/mip_packet.h new file mode 100644 index 000000000..1c0306c8f --- /dev/null +++ b/src/c/mip/mip_packet.h @@ -0,0 +1,129 @@ +#pragma once + +#include "mip_types.h" + +#ifdef __cplusplus + +namespace microstrain { +namespace C { +struct microstrain_serializer; +} +} + +namespace mip { +namespace C { +extern "C" { +#else +struct microstrain_serializer; +#endif + + +//////////////////////////////////////////////////////////////////////////////// +///@addtogroup mip_c +///@{ + +//////////////////////////////////////////////////////////////////////////////// +///@defgroup mip_packet_c Mip Packet +/// +///@brief Functions for building and processing MIP packets. +/// +/// A MIP Packet is represented by the mip_packet_view struct. +/// +///~~~ +/// +-------+-------+------+------+------------+-----/ /----+------------+---- +/// | SYNC1 | SYNC2 | DESC | PLEN | Field | ... | Checksum | remaining buffer space... +/// +-------+-------+------+------+------------+-----/ /----+------------+---- +///~~~ +/// +///@{ + + +//////////////////////////////////////////////////////////////////////////////// +///@brief Structure representing a MIP Packet. +/// +/// Use to inspect received packets or construct new ones. +/// +///@note This should be considered an "opaque" structure; its members should be +/// considered an internal implementation detail. Avoid accessing them directly +/// as they are subject to change in future versions of this software. +/// +typedef struct mip_packet_view +{ + uint8_t* _buffer; ///<@private Pointer to the packet data. + uint_least16_t _buffer_length; ///<@private Length of the buffer (NOT the packet length!). +} mip_packet_view; + + +//////////////////////////////////////////////////////////////////////////////// +///@defgroup MipPacketBuilding_c Packet Building +/// +///@brief Functions for building new MIP packets. +/// +/// Use these functions to create a new packet, add fields, and write the +/// checksum. +/// +///@ingroup +///@{ + +void mip_packet_create(mip_packet_view* packet, uint8_t* buffer, size_t buffer_size, uint8_t descriptor_set); + +bool mip_packet_add_field(mip_packet_view* packet, uint8_t field_descriptor, const uint8_t* payload, uint8_t payload_length); +int mip_packet_create_field(mip_packet_view* packet, uint8_t field_descriptor, uint8_t payload_length, uint8_t** payload_ptr_out); +int mip_packet_update_last_field_length(mip_packet_view* packet, uint8_t* payload_ptr, uint8_t new_payload_length); +int mip_packet_cancel_last_field(mip_packet_view* packet, uint8_t* payload_ptr); + +void mip_packet_finalize(mip_packet_view* packet); + +void mip_packet_reset(mip_packet_view* packet, uint8_t descriptor_set); + +///@} +//////////////////////////////////////////////////////////////////////////////// +///@defgroup MipPacketAccessors_c Packet Inspection +/// +///@brief Functions for accessing information about an existing MIP packet. +/// +/// Use these functions to get information about a MIP packet after it has been +/// parsed. Generally, first the descriptor set would be inspected followed by +/// iterating the fields using the MipFieldIteration functions. +/// +/// With the exception of mip_packet_checksum_value() (and any function which +/// calls it, e.g. mip_packet_is_valid()), these functions may also be used on +/// packets which are under construction via the PacketBuilding functions. +/// +///@warning Do not call the packet-building functions unless you know the +/// input buffer is not const. +/// +///@{ + +void mip_packet_from_buffer(mip_packet_view* packet, const uint8_t* buffer, size_t length); + +uint8_t mip_packet_descriptor_set(const mip_packet_view* packet); +uint_least16_t mip_packet_total_length(const mip_packet_view* packet); +uint8_t mip_packet_payload_length(const mip_packet_view* packet); +uint8_t* mip_packet_buffer(mip_packet_view* packet); +const uint8_t* mip_packet_pointer(const mip_packet_view* packet); +const uint8_t* mip_packet_payload(const mip_packet_view* packet); +uint16_t mip_packet_checksum_value(const mip_packet_view* packet); +uint16_t mip_packet_compute_checksum(const mip_packet_view* packet); + + +bool mip_packet_is_sane(const mip_packet_view* packet); +bool mip_packet_is_valid(const mip_packet_view* packet); +bool mip_packet_is_empty(const mip_packet_view* packet); + +uint_least16_t mip_packet_buffer_size(const mip_packet_view* packet); +int mip_packet_remaining_space(const mip_packet_view* packet); + +bool mip_packet_is_data(const mip_packet_view* packet); + +///@} + +///@} +///@} +//////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} // extern "C" +} // namespace C +} // namespace mip +#endif diff --git a/src/mip/mip_parser.c b/src/c/mip/mip_parser.c similarity index 97% rename from src/mip/mip_parser.c rename to src/c/mip/mip_parser.c index d6192347e..f1b7f86ae 100644 --- a/src/mip/mip_parser.c +++ b/src/c/mip/mip_parser.c @@ -5,6 +5,12 @@ #include +#ifdef __cplusplus +namespace mip { +namespace C { +extern "C" { +#endif + #define MIPPARSER_RESET_LENGTH 1 @@ -134,9 +140,9 @@ size_t mip_parser_parse(mip_parser* parser, const uint8_t* input_buffer, size_t // Copy as much data as will fit in the ring buffer. size_t count = byte_ring_copy_from_and_update(&parser->_ring, &input_buffer, &input_count); - MIP_DIAG_INC(parser->_diag_bytes_read, count); + MIP_DIAG_INC(parser->_diag_bytes_read, (uint32_t)count); - mip_packet packet; + mip_packet_view packet; while( mip_parser_parse_one_packet_from_ring(parser, &packet, timestamp) ) { num_packets++; @@ -150,7 +156,7 @@ size_t mip_parser_parse(mip_parser* parser, const uint8_t* input_buffer, size_t // Pull more data from the input buffer if possible. count = byte_ring_copy_from_and_update(&parser->_ring, &input_buffer, &input_count); - MIP_DIAG_INC(parser->_diag_bytes_read, count); + MIP_DIAG_INC(parser->_diag_bytes_read, (uint32_t)count); return input_count; } @@ -179,7 +185,7 @@ size_t mip_parser_parse(mip_parser* parser, const uint8_t* input_buffer, size_t ///@returns true if a packet was found, false if more data is required. If false, /// the packet is not initialized. /// -bool mip_parser_parse_one_packet_from_ring(mip_parser* parser, mip_packet* packet_out, mip_timestamp timestamp) +bool mip_parser_parse_one_packet_from_ring(mip_parser* parser, mip_packet_view* packet_out, mip_timestamp timestamp) { // Parse packets while there is sufficient data in the ring buffer. while( byte_ring_count(&parser->_ring) >= parser->_expected_length ) @@ -380,7 +386,7 @@ size_t mip_parser_get_write_ptr(mip_parser* parser, uint8_t** const ptr_out) /// void mip_parser_process_written(mip_parser* parser, size_t count, mip_timestamp timestamp, unsigned int max_packets) { - MIP_DIAG_INC(parser->_diag_bytes_read, count); + MIP_DIAG_INC(parser->_diag_bytes_read, (uint32_t)count); byte_ring_notify_written(&parser->_ring, count); mip_parser_parse(parser, NULL, 0, timestamp, max_packets); @@ -482,3 +488,10 @@ mip_timeout mip_timeout_from_baudrate(uint32_t baudrate) // timeout [ms] = (packet_time [s]) * (1000 [ms/s]) * tolerance return num_symbols * 1500 / baudrate; } + + +#ifdef __cplusplus +} // extern "C" +} // namespace C +} // namespace mip +#endif diff --git a/src/mip/mip_parser.h b/src/c/mip/mip_parser.h similarity index 97% rename from src/mip/mip_parser.h rename to src/c/mip/mip_parser.h index 059b38043..7499528e4 100644 --- a/src/mip/mip_parser.h +++ b/src/c/mip/mip_parser.h @@ -7,13 +7,13 @@ #include "mip_types.h" #ifdef __cplusplus -namespace mip{ +namespace mip { namespace C { extern "C" { #endif //////////////////////////////////////////////////////////////////////////////// -///@addtogroup mip_c MIP C API +///@addtogroup mip_c /// ///@brief This module contains all of the C submodules. /// @@ -21,7 +21,7 @@ extern "C" { //////////////////////////////////////////////////////////////////////////////// -///@defgroup mip_parser_c mip_parser [C] +///@defgroup mip_parser_c Mip Parser /// ///@brief Functions for parsing MIP packets /// @@ -42,7 +42,7 @@ extern "C" { ///@param user A user-specified pointer which will be given the callback_object parameter which was previously passed to mip_parser_init. ///@param packet A pointer to the MIP packet. Do not store this pointer as it will be invalidated after the callback returns. ///@param timestamp The approximate time the packet was parsed. -typedef bool (*mip_packet_callback)(void* user, const mip_packet* packet, mip_timestamp timestamp); +typedef bool (*mip_packet_callback)(void* user, const mip_packet_view* packet, mip_timestamp timestamp); //////////////////////////////////////////////////////////////////////////////// @@ -80,7 +80,7 @@ typedef struct mip_parser void mip_parser_init(mip_parser* parser, uint8_t* buffer, size_t buffer_size, mip_packet_callback callback, void* callback_object, mip_timestamp timeout); -bool mip_parser_parse_one_packet_from_ring(mip_parser* parser, mip_packet* packet_out, mip_timestamp timestamp); +bool mip_parser_parse_one_packet_from_ring(mip_parser* parser, mip_packet_view* packet_out, mip_timestamp timestamp); size_t mip_parser_parse(mip_parser* parser, const uint8_t* input_buffer, size_t input_count, mip_timestamp timestamp, unsigned int max_packets); void mip_parser_reset(mip_parser* parser); @@ -130,7 +130,7 @@ mip_timeout mip_timeout_from_baudrate(uint32_t baudrate); //////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus -} // namespace mip -} // namespace C } // extern "C" +} // namespace C +} // namespace mip #endif diff --git a/src/mip/mip_result.c b/src/c/mip/mip_result.c similarity index 73% rename from src/mip/mip_result.c rename to src/c/mip/mip_result.c index e8c08e438..82e8f75a2 100644 --- a/src/mip/mip_result.c +++ b/src/c/mip/mip_result.c @@ -3,6 +3,7 @@ #ifdef __cplusplus namespace mip { +namespace C { extern "C" { #endif // __cplusplus @@ -17,24 +18,25 @@ const char* mip_cmd_result_to_string(enum mip_cmd_result result) { switch(result) { - // Status codes - case MIP_STATUS_ERROR: return "Error"; - case MIP_STATUS_CANCELLED: return "Canceled"; - case MIP_STATUS_TIMEDOUT: return "Timed out"; - case MIP_STATUS_WAITING: return "Waiting"; - case MIP_STATUS_PENDING: return "Pending"; - case MIP_STATUS_NONE: return "None"; - // Device replies - case MIP_ACK_OK: return "Ok"; - case MIP_NACK_COMMAND_UNKNOWN: return "Unknown Command"; + // Status codes + case MIP_STATUS_ERROR: return "Error"; + case MIP_STATUS_CANCELLED: return "Canceled"; + case MIP_STATUS_TIMEDOUT: return "Timed out"; + case MIP_STATUS_WAITING: return "Waiting"; + case MIP_STATUS_PENDING: return "Pending"; + case MIP_STATUS_NONE: return "None"; + // Device replies + case MIP_ACK_OK: return "Ok"; + case MIP_NACK_COMMAND_UNKNOWN: return "Unknown Command"; case MIP_NACK_INVALID_CHECKSUM: return "Invalid Checksum"; - case MIP_NACK_INVALID_PARAM: return "Invalid Parameter"; - case MIP_NACK_COMMAND_FAILED: return "Command Failed"; - case MIP_NACK_COMMAND_TIMEOUT: return "Device Error"; + case MIP_NACK_INVALID_PARAM: return "Invalid Parameter"; + case MIP_NACK_COMMAND_FAILED: return "Command Failed"; + case MIP_NACK_COMMAND_TIMEOUT: return "Device Error"; + case MIP_STATUS_USER_START: default: if(mip_cmd_result_is_user(result)) return "User Status"; - else return "Unknown"; + else return "Unknown"; } } @@ -81,5 +83,6 @@ bool mip_cmd_result_is_ack(enum mip_cmd_result result) #ifdef __cplusplus } // extern "C" +} // namespace C } // namespace mip #endif // __cplusplus diff --git a/src/c/mip/mip_result.h b/src/c/mip/mip_result.h new file mode 100644 index 000000000..e57676a48 --- /dev/null +++ b/src/c/mip/mip_result.h @@ -0,0 +1,65 @@ +#pragma once + +#include +#include + +#ifdef __cplusplus +namespace mip { +namespace C { +extern "C" { +#endif // __cplusplus + + +//////////////////////////////////////////////////////////////////////////////// +///@addtogroup mip_c +///@{ + +//////////////////////////////////////////////////////////////////////////////// +///@brief Represents the status of a MIP command. +/// +/// Values that start with MIP_STATUS are status codes from this library. +/// Values that start with MIP_(N)ACK represent replies from the device. +/// Values at or below MIP_STATUS_USER_START (negative values) are reserved for +/// status codes from user code. +/// +/// See @ref command_results +/// +typedef enum mip_cmd_result +{ + MIP_STATUS_USER_START = -10, ///< Values defined by user code must be less than or equal to this value. + + // Status codes < 0 + MIP_STATUS_ERROR = -6, ///< Command could not be executed (error sending/receiving) + MIP_STATUS_CANCELLED = -5, ///< Command was canceled in software. + MIP_STATUS_TIMEDOUT = -4, ///< Reply was not received before timeout expired. + MIP_STATUS_WAITING = -3, ///< Waiting for command reply (timeout timer has started). + MIP_STATUS_PENDING = -2, ///< Command has been queued but the I/O update hasn't run yet. + MIP_STATUS_NONE = -1, ///< Command has been initialized but not queued yet. + + // Device replies >= 0 + MIP_ACK_OK = 0x00, ///< Command completed successfully. + MIP_NACK_COMMAND_UNKNOWN = 0x01, ///< Command not supported. + MIP_NACK_INVALID_CHECKSUM = 0x02, ///< Reserved. + MIP_NACK_INVALID_PARAM = 0x03, ///< A parameter was not a supported value. + MIP_NACK_COMMAND_FAILED = 0x04, ///< The device could not complete the command. + MIP_NACK_COMMAND_TIMEOUT = 0x05, ///< Internal device timeout. Use MIP_STATUS_TIMEDOUT for command timeouts. +} mip_cmd_result; + +const char *mip_cmd_result_to_string(enum mip_cmd_result result); + +bool mip_cmd_result_is_finished(enum mip_cmd_result result); + +bool mip_cmd_result_is_reply(enum mip_cmd_result result); +bool mip_cmd_result_is_status(enum mip_cmd_result result); +bool mip_cmd_result_is_user(enum mip_cmd_result result); + +bool mip_cmd_result_is_ack(enum mip_cmd_result result); + +///@} +//////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} // extern "C" +} // namespace C +} // namespace mip +#endif // __cplusplus diff --git a/src/c/mip/mip_serialization.c b/src/c/mip/mip_serialization.c new file mode 100644 index 000000000..83e97964f --- /dev/null +++ b/src/c/mip/mip_serialization.c @@ -0,0 +1,80 @@ + +#include "mip_serialization.h" +#include "mip_offsets.h" + +#include + +#ifdef __cplusplus +namespace mip { +namespace C { +extern "C" { +#endif + + +//////////////////////////////////////////////////////////////////////////////// +///@brief Initialize a serialization struct for creation of a new field at the +/// end of the packet. +/// +///@note Call mip_serializer_finish_new_field after the data has been serialized. +/// +///@note Only one new field per packet can be in progress at a time. +/// +///@param serializer +///@param packet +/// Allocate the new field on the end of this packet. +///@param field_descriptor +/// Field descriptor of the new field. +/// +void mip_serializer_init_new_field(mip_serializer* serializer, mip_packet_view* packet, uint8_t field_descriptor) +{ + assert(packet); + + serializer->_buffer = NULL; + serializer->_buffer_size = 0; + serializer->_offset = 0; + + const int length = mip_packet_create_field(packet, field_descriptor, 0, &serializer->_buffer); + + if( length >= 0 ) + serializer->_buffer_size = length; +} + +//////////////////////////////////////////////////////////////////////////////// +///@brief Call this after a new field allocated by mip_serializer_init_new_field +/// has been written. +/// +/// This will either finish the field, or abort it if the serializer failed. +/// +///@param serializer Must be created from mip_serializer_init_new_field. +///@param packet Must be the original packet. +/// +void mip_serializer_finish_new_field(const mip_serializer* serializer, mip_packet_view* packet) +{ + assert(packet); + + if(microstrain_serializer_is_ok(serializer) ) + { + assert(serializer->_offset <= MIP_FIELD_LENGTH_MAX); // Payload too long! + mip_packet_update_last_field_length(packet, serializer->_buffer, (uint8_t) serializer->_offset); + } + else if( serializer->_buffer ) + mip_packet_cancel_last_field(packet, serializer->_buffer); +} + +//////////////////////////////////////////////////////////////////////////////// +///@brief Initialize a serialization struct from a microstrain field payload. +/// +///@param serializer +///@param field +/// +void microstrain_serializer_init_from_field(mip_serializer* serializer, const mip_field_view* field) +{ + microstrain_serializer_init_extraction(serializer, mip_field_payload(field), mip_field_payload_length(field)); +} + + +#ifdef __cplusplus +} // extern "C" +} // namespace C +} // namespace mip +#endif diff --git a/src/c/mip/mip_serialization.h b/src/c/mip/mip_serialization.h new file mode 100644 index 000000000..a9162a46c --- /dev/null +++ b/src/c/mip/mip_serialization.h @@ -0,0 +1,24 @@ +#pragma once + +#include "mip_field.h" + +#include + + +#ifdef __cplusplus +namespace mip { +namespace C { +extern "C" { +#endif + +typedef microstrain_serializer mip_serializer; + +void mip_serializer_init_new_field(mip_serializer* serializer, mip_packet_view* packet, uint8_t field_descriptor); +void mip_serializer_finish_new_field(const mip_serializer* serializer, mip_packet_view* packet); +void microstrain_serializer_init_from_field(mip_serializer* serializer, const mip_field_view* field); + +#ifdef __cplusplus +} // extern "C" +} // namespace C +} // namespace mip +#endif diff --git a/src/c/mip/mip_types.h b/src/c/mip/mip_types.h new file mode 100644 index 000000000..1bef0948f --- /dev/null +++ b/src/c/mip/mip_types.h @@ -0,0 +1,55 @@ +#pragma once + +#include +#include +#include + +#ifdef __cplusplus + +#include + +namespace mip { +namespace C { +extern "C" { + +typedef microstrain::C::microstrain_embedded_timestamp mip_timestamp; +typedef microstrain::C::microstrain_embedded_timestamp mip_timeout; + +#else + +#include + +typedef microstrain_embedded_timestamp mip_timestamp; +typedef microstrain_embedded_timestamp mip_timeout; + +#endif + + +#ifdef MIP_ENABLE_DIAGNOSTICS + +// Saturating addition +#define MIP_DIAG_INC(counter, amount) do { if (counter + amount < counter) counter = -1; else counter += amount; } while(false) + +#define MIP_DIAG_ZERO(counter) counter = 0 + +#else // MIP_ENABLE_DIAGNOSTICS + +// Do nothing if diagnostic counters diabled. Cast amount to void to avoid "unused local variable" warnings. +#define MIP_DIAG_INC(counter, amount) (void)amount + +#define MIP_DIAG_ZERO(counter) (void)0 + +#endif // MIP_ENABLE_DIAGNOSTICS + + +#ifdef __cplusplus + +} // extern "C" +} // namespace C + +using Timestamp = microstrain::EmbeddedTimestamp; +using Timeout = microstrain::EmbeddedTimeout; + +} // namespace mip + +#endif diff --git a/src/mip/utils/byte_ring.c b/src/c/mip/utils/byte_ring.c similarity index 100% rename from src/mip/utils/byte_ring.c rename to src/c/mip/utils/byte_ring.c diff --git a/src/mip/utils/byte_ring.h b/src/c/mip/utils/byte_ring.h similarity index 100% rename from src/mip/utils/byte_ring.h rename to src/c/mip/utils/byte_ring.h diff --git a/src/cpp/microstrain/CMakeLists.txt b/src/cpp/microstrain/CMakeLists.txt new file mode 100644 index 000000000..74e9b1d60 --- /dev/null +++ b/src/cpp/microstrain/CMakeLists.txt @@ -0,0 +1,8 @@ +add_subdirectory(common) +add_subdirectory(connections) + +if(MICROSTRAIN_ENABLE_EXTRAS) + add_subdirectory(extras) +endif() + +set(MICROSTRAIN_LIBRARIES_TMP ${MICROSTRAIN_LIBRARIES_TMP} PARENT_SCOPE) diff --git a/src/cpp/microstrain/common/CMakeLists.txt b/src/cpp/microstrain/common/CMakeLists.txt new file mode 100644 index 000000000..8ff7dd37f --- /dev/null +++ b/src/cpp/microstrain/common/CMakeLists.txt @@ -0,0 +1,29 @@ +# microstrain_common is defined by the C api. +target_sources(${MICROSTRAIN_COMMON_LIBRARY} PRIVATE + "${CMAKE_CURRENT_LIST_DIR}/embedded_time.hpp" + "${CMAKE_CURRENT_LIST_DIR}/index.hpp" + "${CMAKE_CURRENT_LIST_DIR}/logging.hpp" + "${CMAKE_CURRENT_LIST_DIR}/platform.hpp" + "${CMAKE_CURRENT_LIST_DIR}/serialization.hpp" + "${CMAKE_CURRENT_LIST_DIR}/serialization/readwrite.hpp" + "${CMAKE_CURRENT_LIST_DIR}/serialization/serializer.hpp" +) + +target_compile_features(${MICROSTRAIN_COMMON_LIBRARY} PUBLIC cxx_std_11) +target_include_directories(${MICROSTRAIN_COMMON_LIBRARY} INTERFACE ${MICROSTRAIN_SRC_CPP_DIR}) + + +if(MICROSTRAIN_USE_STD_SPAN) + target_compile_definitions(${MICROSTRAIN_COMMON_LIBRARY} PUBLIC "MICROSTRAIN_USE_STD_SPAN=1") +endif() + +if(MICROSTRAIN_USE_STD_ENDIAN) + target_compile_definitions(${MICROSTRAIN_COMMON_LIBRARY} PUBLIC "MICROSTRAIN_USE_STD_ENDIAN=1") +endif() + +# +# Installation +# + +include(microstrain_utilities) +microstrain_setup_install_headers(${MICROSTRAIN_COMMON_LIBRARY} ${MICROSTRAIN_SRC_DIR}) diff --git a/src/cpp/microstrain/common/embedded_time.hpp b/src/cpp/microstrain/common/embedded_time.hpp new file mode 100644 index 000000000..0a77a599e --- /dev/null +++ b/src/cpp/microstrain/common/embedded_time.hpp @@ -0,0 +1,12 @@ +#pragma once + +#include + + +namespace microstrain +{ + +using EmbeddedTimestamp = C::microstrain_embedded_timestamp; +using EmbeddedTimeout = C::microstrain_embedded_timeout; + +} // namespace microstrain diff --git a/src/mip/extras/index.hpp b/src/cpp/microstrain/common/index.hpp similarity index 84% rename from src/mip/extras/index.hpp rename to src/cpp/microstrain/common/index.hpp index 3f31deb79..629a980af 100644 --- a/src/mip/extras/index.hpp +++ b/src/cpp/microstrain/common/index.hpp @@ -2,8 +2,9 @@ #include #include +#include -namespace mip +namespace microstrain { class Id; @@ -13,12 +14,12 @@ namespace mip /// Use this to help avoid off-by-one errors when using indices into arrays at /// the same time as referring to MIP values which typically start at 1. /// - /// Use the .index() or .id() methods to get the actual value, depending on + /// Use the index() or id() methods to get the actual value, depending on /// what you need. The index() method returns an unsigned int in the range [0,N-1] /// while the id() method returns an unsigned int in the range [1,N] /// /// isAssigned() can be used to see if the value is valid, i.e. initialized. - /// isValid(N) can be used to check if the value is within a maximum count. + /// isValid() can be used to check if the value is within a maximum count. /// /// The default value with no initialization is INVALID. /// @@ -27,7 +28,7 @@ namespace mip class Index { private: - unsigned int INVALID = -1; + unsigned int INVALID = UINT_MAX; public: constexpr explicit Index(unsigned int index) : m_index(index) {} @@ -55,6 +56,13 @@ namespace mip constexpr Index(const Id& other); constexpr Index& operator=(const Id& other); + bool operator<(Index other) const { return m_index < other.m_index; } + bool operator>(Index other) const { return m_index > other.m_index; } + bool operator<=(Index other) const { return m_index <= other.m_index; } + bool operator>=(Index other) const { return m_index >= other.m_index; } + bool operator==(Index other) const { return m_index == other.m_index; } + bool operator!=(Index other) const { return m_index != other.m_index; } + private: unsigned int m_index; }; @@ -62,7 +70,7 @@ namespace mip //////////////////////////////////////////////////////////////////////////////// ///@brief Representes an ID number ranging from 1..N including N. /// - /// This is interchangeable with the Index class above. + /// This is interchangeable with the Index class. /// class Id { @@ -113,4 +121,4 @@ namespace mip template auto indexOrDefault(Container& container, Index index, Value default_) { return index.isValid(container.size()) ? container[index.index()] : default_; } -} // namespace mip +} // namespace microstrain diff --git a/src/cpp/microstrain/common/logging.hpp b/src/cpp/microstrain/common/logging.hpp new file mode 100644 index 000000000..5837f3ab7 --- /dev/null +++ b/src/cpp/microstrain/common/logging.hpp @@ -0,0 +1,33 @@ +#pragma once + +#include + + +namespace microstrain +{ + +enum class LogLevel +{ + OFF = MICROSTRAIN_LOG_LEVEL_OFF, + FATAL = MICROSTRAIN_LOG_LEVEL_FATAL, + ERROR = MICROSTRAIN_LOG_LEVEL_ERROR, + WARN = MICROSTRAIN_LOG_LEVEL_WARN, + INFO = MICROSTRAIN_LOG_LEVEL_INFO, + DEBUG = MICROSTRAIN_LOG_LEVEL_DEBUG, + TRACE = MICROSTRAIN_LOG_LEVEL_TRACE, +}; + +//namespace logging +//{ +// using Callback = ::microstrain_log_callback; +// +// void init(Callback callback, LogLevel max_level, void* user=nullptr); +// +// Callback get_callback() { return ::microstrain_logging_callback(); } +// LogLevel max_level() { return static_cast(::microstrain_logging_level()); } +// void* user_pointer() { return ::microstrain_logging_user_data(); } +// +// //void log(LogLevel level, const char* fmt, ...) { ::microstrain_logging_log(level, fmt, args); } +//} + +} // namespace microstrain diff --git a/src/cpp/microstrain/common/platform.hpp b/src/cpp/microstrain/common/platform.hpp new file mode 100644 index 000000000..52a2a60f6 --- /dev/null +++ b/src/cpp/microstrain/common/platform.hpp @@ -0,0 +1,26 @@ +#pragma once + +#include + +#ifdef __has_include +#if __has_include() +#include +#endif +#endif + +#if __cpp_inline_variables >= 201606L +#define INLINE_VAR inline +#else +#define INLINE_VAR +#endif + + +#if __cpp_if_constexpr >= 201606L + #define IF_CONSTEXPR if constexpr +#else + #define IF_CONSTEXPR if +#endif + +#if __cpp_lib_optional >= 201606L +#define MICROSTRAIN_HAS_OPTIONAL +#endif diff --git a/src/cpp/microstrain/common/serialization.hpp b/src/cpp/microstrain/common/serialization.hpp new file mode 100644 index 000000000..6655334c8 --- /dev/null +++ b/src/cpp/microstrain/common/serialization.hpp @@ -0,0 +1,10 @@ +#pragma once + +#include "serialization/serializer.hpp" + +#include +#include + +#include +#include +#include diff --git a/src/cpp/microstrain/common/serialization/readwrite.hpp b/src/cpp/microstrain/common/serialization/readwrite.hpp new file mode 100644 index 000000000..7fc092b54 --- /dev/null +++ b/src/cpp/microstrain/common/serialization/readwrite.hpp @@ -0,0 +1,206 @@ +#pragma once + +#include "../platform.hpp" + +#include +#include +#include +#include + +// Don't depend on C++ standard since it could be different between +// compiling this lib and the user's project including this file. +// In that case there would be two conflicting definitions of Endian! +// Maybe use a CMake variable in the future. +// +//#if __cpp_lib_endian >= 201907L +//#include +//#endif + +#ifdef MICROSTRAIN_USE_STD_ENDIAN + +#include + +namespace microstrain +{ +namespace serialization +{ + using Endian = std::endian; +} // namespace serialization +} // namespace microstrain + +#else // MICROSTRAIN_USE_STD_ENDIAN + +namespace microstrain +{ +namespace serialization +{ + +enum class Endian +{ + little, + big, + //native = little, +}; + +} // namespace serialization +} // namespace microstrain + +#endif // MICROSTRAIN_USE_STD_ENDIAN + +namespace microstrain +{ +namespace serialization +{ + +// +// Write to buffer +// + +namespace big_endian +{ + +template +typename std::enable_if::value && sizeof(T) == 1, size_t>::type +/*size_t*/ write(uint8_t *buffer, T value) +{ + buffer[0] = reinterpret_cast(&value)[0]; + return sizeof(T); +} + +template +typename std::enable_if::value && sizeof(T) == 2, size_t>::type +/*size_t*/ write(uint8_t *buffer, T value) +{ + buffer[0] = reinterpret_cast(&value)[1]; + buffer[1] = reinterpret_cast(&value)[0]; + return sizeof(T); +} + +template +typename std::enable_if::value && sizeof(T) == 4, size_t>::type +/*size_t*/ write(uint8_t *buffer, T value) +{ + buffer[0] = reinterpret_cast(&value)[3]; + buffer[1] = reinterpret_cast(&value)[2]; + buffer[2] = reinterpret_cast(&value)[1]; + buffer[3] = reinterpret_cast(&value)[0]; + return sizeof(T); +} + +template +typename std::enable_if::value && sizeof(T) == 8, size_t>::type +/*size_t*/ write(uint8_t *buffer, T value) +{ + buffer[0] = reinterpret_cast(&value)[7]; + buffer[1] = reinterpret_cast(&value)[6]; + buffer[2] = reinterpret_cast(&value)[5]; + buffer[3] = reinterpret_cast(&value)[4]; + buffer[4] = reinterpret_cast(&value)[3]; + buffer[5] = reinterpret_cast(&value)[2]; + buffer[6] = reinterpret_cast(&value)[1]; + buffer[7] = reinterpret_cast(&value)[0]; + return sizeof(T); +} + +} // namespace big_endian +namespace little_endian +{ + +template +typename std::enable_if::value, size_t>::type +/*size_t*/ write(uint8_t *buffer, T value) +{ + std::memcpy(buffer, &value, sizeof(value)); + return sizeof(value); +} + +} // namespace little_endian + + +template +typename std::enable_if::value, size_t>::type +/*size_t*/ write(uint8_t* buffer, T value) { return E==Endian::little ? little_endian::write(buffer,value) : big_endian::write(buffer,value); } + + +// +// Read from buffer +// + +namespace big_endian +{ + +template +typename std::enable_if::value && sizeof(T)==1, size_t>::type +/*size_t*/ read(const uint8_t* buffer, T& value) +{ + reinterpret_cast(&value)[0] = buffer[0]; + return sizeof(T); +} + +template +typename std::enable_if::value && sizeof(T)==2, size_t>::type +/*size_t*/ read(const uint8_t* buffer, T& value) +{ + reinterpret_cast(&value)[0] = buffer[1]; + reinterpret_cast(&value)[1] = buffer[0]; + return sizeof(T); +} + +template +typename std::enable_if::value && sizeof(T)==4, size_t>::type +/*size_t*/ read(const uint8_t* buffer, T& value) +{ + reinterpret_cast(&value)[0] = buffer[3]; + reinterpret_cast(&value)[1] = buffer[2]; + reinterpret_cast(&value)[2] = buffer[1]; + reinterpret_cast(&value)[3] = buffer[0]; + return sizeof(T); +} + +template +typename std::enable_if::value && sizeof(T)==8, size_t>::type +/*size_t*/ read(const uint8_t* buffer, T& value) +{ + reinterpret_cast(&value)[0] = buffer[7]; + reinterpret_cast(&value)[1] = buffer[6]; + reinterpret_cast(&value)[2] = buffer[5]; + reinterpret_cast(&value)[3] = buffer[4]; + reinterpret_cast(&value)[4] = buffer[3]; + reinterpret_cast(&value)[5] = buffer[2]; + reinterpret_cast(&value)[6] = buffer[1]; + reinterpret_cast(&value)[7] = buffer[0]; + return sizeof(T); +} + +} // namespace big_endian +namespace little_endian +{ + +template +typename std::enable_if::value, size_t>::type +/*size_t*/ read(const uint8_t* buffer, T& value) +{ + std::memcpy(&value, buffer, sizeof(T)); + return sizeof(T); +} + +} // namespace little_endian + + +template +size_t read(const uint8_t* buffer, T& value) +{ + return (E==Endian::little) ? little_endian::read(buffer, value) : big_endian::read(buffer, value); +} + +// Read T and return by value +template +T read(const uint8_t* buffer) +{ + T value; + read(buffer, value); + return value; +} + +} // namespace serialization +} // namespace microstrain diff --git a/src/cpp/microstrain/common/serialization/serializer.hpp b/src/cpp/microstrain/common/serialization/serializer.hpp new file mode 100644 index 000000000..d9f575bd6 --- /dev/null +++ b/src/cpp/microstrain/common/serialization/serializer.hpp @@ -0,0 +1,996 @@ +#pragma once + +#include "readwrite.hpp" + +#include "../span.hpp" + +#include + +#include +#include + +#ifdef MICROSTRAIN_HAS_OPTIONAL +#include +#endif + +#if __cpp_lib_apply >= 201603L +#include +#endif + +namespace microstrain +{ + +//////////////////////////////////////////////////////////////////////////////// +///@brief Represents a view of a buffer of bytes of known capacity. +/// +/// The class maintains 3 attributes: +///@li A pointer to the first byte of the buffer. +///@li A capacity indicating the total size of the buffer. +///@li An offset, representing the number of bytes read or written. +/// +/// This class works for either reading or writing data. As data is written/ +/// read, the offset is incremented. Through functions such as pointer() and +/// getPtrAndAdvance(), the next readable/writable location can be accessed. +/// Both of these take a 'required_size' parameter indicating the amount of +/// data intending to be read/written. If sufficient data/space remains, +/// a valid pointer is returned. Otherwise, NULL is returned. The offset is +/// incremented in getPtrAndAdvance() regardless. This means the offset can +/// exceed the size/capacity of the buffer. This is an "overrun" condition, +/// and it can be checked with the isOk(), isFinished(), or hasRemaining() +/// functions. This behavior prevents bugs where an object is partially +/// read/written in the case where a larger parameter (say u32) fails but +/// then a smaller one (say u8) succeeds. With this class an overflowing +/// access will cause every following access to fail. Note that "overrun" +/// here does NOT mean that an out-of-bounds access has occurred. +/// +///@note This class can be constructed with a const buffer, however constness +/// is not enforced. It is up to the user to ensure const buffers are +/// not written. +/// +class SerializerBase +{ +public: + SerializerBase() = default; + SerializerBase(uint8_t* ptr, size_t capacity, size_t offset=0) : m_ptr(ptr), m_size(capacity), m_offset(offset) {} + SerializerBase(const uint8_t* ptr, size_t size, size_t offset=0) : m_ptr(const_cast(ptr)), m_size(size), m_offset(offset) {} + SerializerBase(microstrain::Span buffer, size_t offset=0) : m_ptr(const_cast(buffer.data())), m_size(buffer.size()), m_offset(offset) {} + + size_t capacity() const { return m_size; } ///< Returns the total size of the buffer. + size_t offset() const { return m_offset; } ///< Returns the current read or write offset. + size_t usedLength() const { return offset(); } ///< Returns the number of bytes read/written. + int remaining() const { return int(m_size - m_offset); } ///< Returns the number of byte remaining (negative if overflowed). + + bool isOverrun() const { return m_offset > m_size; } ///< Returns true if offset has exceeded the size/capacity. + bool isOk() const { return !isOverrun(); } ///< Returns true if not overrun, i.e. !isOverrun(). + bool isFinished() const { return m_offset == m_size; } ///< Returns true if the entire buffer (and no more) has been read/written. + bool hasRemaining(size_t count=0) const { return m_offset+count <= m_size; } ///< Returns true if at least 'count' bytes remain unread/unwritten. + + uint8_t* basePointer() { return m_ptr; } ///< Returns a pointer to the start of the buffer. + const uint8_t* basePointer() const { return m_ptr; } ///< Returns a pointer to the start of the buffer. + + ///@brief Obtains a pointer to the current offset for reading/writing a value of the specified size. + /// This function does NOT advance the offset value. Generally, you should use getPtrAndAdvance() instead. + ///@param required_size How many bytes will be read/written to the pointer. + ///@returns A valid pointer if required_size bytes are available. NULL otherwise. + uint8_t* pointer(size_t required_size) { return hasRemaining(required_size) ? (m_ptr+m_offset) : nullptr; } + const uint8_t* pointer(size_t required_size) const { return hasRemaining(required_size) ? (m_ptr+m_offset) : nullptr; } ///<@copydoc pointer(size_t required_size) + + ///@brief Obtains a pointer to the current offset for reading/writing a value of specified size, and post-increments the offset by that size. + /// Use this function just like pointer(). + ///@param size How many bytes will be read/written to the pointer. The offset is increased by this amount. + ///@returns A valid pointer if size bytes are available. NULL otherwise. + ///Example usage: + ///@code{.cpp} + /// uint32_t value = 5; + /// if(uint8_t* ptr = serializer.getPointerAndAdvance(sizeof(value))) + /// std::memcpy(ptr, &value, sizeof(value)); + ///@endcode + uint8_t* getPtrAndAdvance(size_t size) { uint8_t* ptr = hasRemaining(size) ? (m_ptr+m_offset) : nullptr; m_offset += size; return ptr; } + + ///@brief Marks the buffer as invalid, i.e. overrun/error state. + /// All further accesses via pointer(), getPtrAndAdvance(), etc. will fail. (basePointer() and capacity() remain valid) + void invalidate() { m_offset = m_size+1; } + + ///@brief Sets a new offset and returns the old value. + /// This can be used to save/restore the current offset. + /// Calling setOffset() after an overrun with an in-range (i.e. non-overrun) value restores the non-overrun status. + ///@param offset New offset. Allowed to exceed the size, i.e. an overrun state. + ///@returns The old offset value. + size_t setOffset(size_t offset) { std::swap(m_offset, offset); return offset; } + +private: + uint8_t* m_ptr = nullptr; + size_t m_size = 0; + size_t m_offset = 0; +}; + + +//////////////////////////////////////////////////////////////////////////////// +///@brief Serializes or deserializes data to/from a byte buffer. +/// +/// Create one of these to handle serialization or deserialization of one or +/// more values to/from a buffer of bytes. +/// +/// You can use `this->insert`/`extract` or directly call the `insert`/`extract` non- +///member functions taking a serializer reference. +/// +/// The endianness is included as part of the %Serializer's type so that it +/// doesn't have to be repeatedly re-specified. It is not included as a +/// runtime parameter for performance reasons (most of the time only a buffer +/// of a known, specific endianness is required). +/// +///@tparam E Endianness of the target buffer. +/// +template +class Serializer : public SerializerBase +{ +public: + using SerializerBase::SerializerBase; + + static const serialization::Endian ENDIAN = E; + + template bool insert (const Ts&... values); + template bool extract(Ts&... values); + + template bool extract_count(T& count, S max_count); + template bool extract_count(T* count, S max_count) { return extract_count(*count, max_count); } +}; + +using BigEndianSerializer = Serializer; +using LittleEndianSerializer = Serializer; + + +// +// +// Non-member functions which the user may overload +// +// + +//////////////////////////////////////////////////////////////////////////////// +// +// LEVEL 1 SERIALIZATION +// +//////////////////////////////////////////////////////////////////////////////// + +// +// Built-in types (bool, int, float, ...) +// + +//////////////////////////////////////////////////////////////////////////////// +///@brief Inserts a numeric value to a Serializer. +/// +///@tparam E Endianness of buffer. Automatically deduced from the serializer parameter. +///@tparam T Type of the value to write. Automatically deduced from the value parameter. +/// +///@param buffer Serializer object pointing to the destination buffer. +///@param value A number to write to the buffer. Can be bool, int, uint32_t, float, etc. +/// +///@returns The size of T, for consistency. +/// +template +typename std::enable_if::value, size_t>::type +/*size_t*/ insert(Serializer& buffer, T value) +{ + if(auto ptr = buffer.getPtrAndAdvance(sizeof(T))) + serialization::write(ptr, value); + + return sizeof(T); +} + +//////////////////////////////////////////////////////////////////////////////// +///@brief Reads a numeric value from a Serializer. +/// +///@tparam E Endianness of buffer. Automatically deduced from the serializer parameter. +///@tparam T Type of the value to read. Automatically deduced from the value parameter. +/// +///@param buffer Serializer object pointing to the source buffer. +///@param[out] value The read value is stored in this variable. Can be a reference to bool, int, uint32_t, float, etc. +/// +///@returns The size of T, for consistency. +/// +template +typename std::enable_if::value, size_t>::type +/*size_t*/ extract(Serializer& buffer, T& value) +{ + if(auto ptr = buffer.getPtrAndAdvance(sizeof(T))) + serialization::read(ptr, value); + + return sizeof(T); +} + + +// +// Enums +// + +//////////////////////////////////////////////////////////////////////////////// +///@brief Writes an enum to a Serializer. +/// For this to work properly, the enum must have its underlying type specified, i.e., +/// like `enum Foo : uint32_t { /*...*/ };` +/// +///@tparam E Endianness of buffer. Automatically deduced from the serializer parameter. +///@tparam T Type of the enum. Automatically deduced from the underlying type of the enum. +/// +///@param buffer Serializer object pointing to the destination buffer. +///@param value The enum value to write to the buffer. +/// +///@returns The size of T, for consistency. +/// +template +typename std::enable_if::value, size_t>::type +/*size_t*/ insert(Serializer& buffer, T value) +{ + using BaseType = typename std::underlying_type::type; + + if(auto ptr = buffer.getPtrAndAdvance(sizeof(BaseType))) + serialization::write(ptr, static_cast(value)); + + return sizeof(BaseType); +} + +//////////////////////////////////////////////////////////////////////////////// +///@brief Reads an enum from a Serializer. +/// For this to work properly, the enum must have its underlying type specified, i.e., +/// like `enum Foo : uint32_t { /*...*/ };` +/// +///@tparam E Endianness of buffer. Automatically deduced from the serializer parameter. +///@tparam T Type of the enum. Automatically deduced from the underlying type of the enum. +/// +///@param buffer Serializer object pointing to the source buffer. +///@param[out] value The value will be stored in this variable. +/// +///@returns The size of T, for consistency. +/// +template +typename std::enable_if::value, size_t>::type +/*size_t*/ extract(Serializer& buffer, T& value) +{ + using BaseType = typename std::underlying_type::type; + + if(auto ptr = buffer.getPtrAndAdvance(sizeof(BaseType))) + { + BaseType base; + serialization::read(ptr, base); + value = static_cast(base); + } + + return sizeof(BaseType); +} + + +// +// Classes - if they have member functions "insert" and "extract" +// + +//////////////////////////////////////////////////////////////////////////////// +///@brief Writes a class object to a Serializer. +/// This overload is available to any class which defines a method +/// `insert`. It shall take a Serializer reference as the sole parameter. +/// +/// Example: +///@code{.cpp} +/// class Foo +/// { +/// int x, y; +/// float z; +/// +/// // E.g. for big endian serialization: +/// void insert(microstrain::BigEndianSerializer& serializer) const { +/// insert(serializer, x, y, z); // Write x, y, and z parameters. +/// } +/// // OR, if both big and little serialization are desired: +/// template +/// void insert(microstrain::Serializer& serializer) const { +/// insert(serializer, x, y, z); // Write x, y, and z parameters. +/// } +/// }; +///@endcode +/// +///@tparam E Endianness of buffer. Automatically deduced from the serializer parameter. +///@tparam T Type of the class. Automatically deduced from the object parameter. +/// +///@param serializer Serializer object pointing to the destination buffer. +///@param object The class to write to the buffer. +/// +///@returns The number of bytes written. +/// +template +typename std::enable_if::value , size_t>::type +/*size_t*/ insert(microstrain::Serializer& serializer, const T& object) +{ + size_t offset = serializer.offset(); + object.insert(serializer); + return serializer.offset() - offset; +} + +//////////////////////////////////////////////////////////////////////////////// +///@brief Reads a class object from a Serializer. +/// This overload is available to any class which defines a method +/// `extract`. It shall take a Serializer reference as the sole parameter. +/// +/// Example: +///@code{.cpp} +/// class Foo +/// { +/// int x, y; +/// float z; +/// +/// // E.g. for big endian serialization: +/// void extract(microstrain::BigEndianSerializer& serializer) { +/// extract(serializer, x, y, z); // Read x, y, and z parameters. +/// } +/// // OR, if both big and little serialization are desired: +/// template +/// void insert(microstrain::Serializer& serializer) { +/// extract(serializer, x, y, z); // Read x, y, and z parameters. +/// } +/// }; +///@endcode +/// +///@tparam E Endianness of buffer. Automatically deduced from the serializer parameter. +///@tparam T Type of the class. Automatically deduced from the object parameter. +/// +///@param serializer Serializer object pointing to the source buffer. +///@param object The class to read from the buffer. +/// +///@returns The number of bytes read. +/// +template +typename std::enable_if::value , size_t>::type +/*size_t*/ extract(microstrain::Serializer& serializer, T& object) +{ + size_t offset = serializer.offset(); + object.extract(serializer); + return serializer.offset() - offset; +} + + +//////////////////////////////////////////////////////////////////////////////// +// +// LEVEL 2 SERIALIZATION +// +//////////////////////////////////////////////////////////////////////////////// + +// +// std::tuple - only supported if std::apply can be used +// +#if __cpp_lib_apply >= 201603L + +//////////////////////////////////////////////////////////////////////////////// +///@brief Writes all values from a std::tuple to a Serializer. +/// +/// This overload is only enabled if std::apply from c++17 is available. +/// +///@tparam E Endianness of buffer. Automatically deduced from the serializer parameter. +///@tparam Ts Types contained in the tuple. Deduced from the values parameter. +/// +///@param serializer Serializer object pointing to the destination buffer. +///@param values Tuple to serialize. +/// +///@returns The total sizes of each type in the enum (i.e. Ts). +/// +template +size_t insert(Serializer& serializer, const std::tuple& values) +{ + auto lambda = [&serializer](const Ts&... args) { + return insert(serializer, args...); + }; + + return std::apply(lambda, values); +} + +//////////////////////////////////////////////////////////////////////////////// +///@brief Reads values from a Serializer to a series of references wrapped in a std::tuple. +/// +/// This overload is only enabled if std::apply from c++17 is available. +/// +///@tparam E Endianness of buffer. Automatically deduced from the serializer parameter. +///@tparam Ts Types contained in the tuple. Deduced from the values parameter. +/// +///@param serializer Serializer object pointing to the source buffer. +///@param values Tuple of references (i.e. via std::ref or std::reference_wrapper) to the destination variables. +/// +///@returns The total sizes of each type in the enum (i.e. Ts). +/// +template +size_t extract(Serializer& serializer, const std::tuple...>& values) +{ + auto lambda = [&serializer](auto&... args) { + return extract(serializer, args...); + }; + + return std::apply(lambda, values); +} + +#endif + + + +// +// Arrays of runtime length +// + +//////////////////////////////////////////////////////////////////////////////// +///@brief Writes an array to a Serializer. +/// +///@tparam E Endianness of buffer. Automatically deduced from the serializer parameter. +///@tparam T Type of array elements. Automatically deduced from the values parameter. +/// +///@param serializer Serializer object pointing to the destination buffer. +///@param values Pointer to the first value in the array. +///@param count Number of elements in the array to write. +/// +///@returns The total number of bytes written. +/// +template +size_t insert(Serializer& serializer, const T* values, size_t count) +{ + // For arithmetic types the size is fixed so it can be optimized. + IF_CONSTEXPR(std::is_arithmetic::value) + { + const size_t size = sizeof(T)*count; + if(auto ptr = serializer.getPtrAndAdvance(size)) + { + for(size_t i=0; i(ptr+i*sizeof(T), values[i]); + } + return size; + } + else // Unknown size, have to check length every time. + { + size_t offset = serializer.offset(); + for(size_t i=0; i +size_t extract(Serializer& serializer, T* values, size_t count) +{ + // For arithmetic types the size is fixed so it can be optimized. + IF_CONSTEXPR(std::is_arithmetic::value) + { + const size_t size = sizeof(T)*count; + if(auto ptr = serializer.getPtrAndAdvance(size)) + { + for(size_t i=0; i(ptr+i*sizeof(T), values[i]); + } + return size; + } + else // Unknown size, have to check length every time. + { + size_t offset = serializer.offset(); + for(size_t i=0; i +size_t insert(Serializer& serializer, microstrain::Span values) +{ + return insert(serializer, values.data(), values.size()); +} + +//////////////////////////////////////////////////////////////////////////////// +///@brief Reads an array from a Serializer via a Span. +/// +///@tparam E Endianness of buffer. Automatically deduced from the serializer parameter. +///@tparam T Type of array elements. Automatically deduced from the values parameter. +/// +///@param serializer Serializer object pointing to the source buffer. +///@param values Span containing pointer and count. +/// +///@returns The total number of bytes read. +/// +template +size_t extract(Serializer& serializer, microstrain::Span values) +{ + return extract(serializer, values.data(), values.size()); +} + + +// +// Arrays of fixed size +// + +//////////////////////////////////////////////////////////////////////////////// +///@brief Writes a fixed-size array to a Serializer. +/// +///@tparam E Endianness of buffer. Automatically deduced from the serializer parameter. +///@tparam T Type of array elements. Automatically deduced from the values parameter. +/// +///@param serializer Serializer object pointing to the destination buffer. +///@param values C-style array of values +/// +///@returns The total number of bytes written. +/// +template +size_t insert(Serializer& serializer, const T(&values)[N]) +{ + return insert(serializer, values, N); +} + +//////////////////////////////////////////////////////////////////////////////// +///@brief Reads a fixed-size array from a Serializer. +/// +///@tparam E Endianness of buffer. Automatically deduced from the serializer parameter. +///@tparam T Type of array elements. Automatically deduced from the values parameter. +/// +///@param serializer Serializer object pointing to the source buffer. +///@param values C-style array of values +/// +///@returns The total number of bytes read. +/// +template +size_t extract(Serializer& serializer, T(&values)[N]) +{ + return extract(serializer, values, N); +} + + + +//////////////////////////////////////////////////////////////////////////////// +///@brief Writes a std::array to a Serializer. +/// +///@tparam E Endianness of buffer. Automatically deduced from the serializer parameter. +///@tparam T Type of array elements. Automatically deduced from the values parameter. +/// +///@param serializer Serializer object pointing to the destination buffer. +///@param values std::array of values +/// +///@returns The total number of bytes written. +/// +template +size_t insert(Serializer& serializer, const std::array& values) +{ + return insert(serializer, values.data(), values.size()); +} + +//////////////////////////////////////////////////////////////////////////////// +///@brief Reads a std::array from a Serializer. +/// +///@tparam E Endianness of buffer. Automatically deduced from the serializer parameter. +///@tparam T Type of array elements. Automatically deduced from the values parameter. +/// +///@param serializer Serializer object pointing to the source buffer. +///@param values std::array of values +/// +///@returns The total number of bytes read. +/// +template +size_t extract(Serializer& serializer, const std::array& values) +{ + return extract(serializer, values.data(), values.size()); +} + +// +// Multiple values at once - more efficient since it avoids multiple size checks +// + +//////////////////////////////////////////////////////////////////////////////// +///@brief Writes multiple values to a Serializer. +/// +/// This function is equivalent to calling insert on each parameter in sequence. +/// +/// This function can make use of C++17 fold expressions to improve performance +/// by combining the buffer bounds checks when all types are of known size (i.e. numeric types). +/// +///@tparam E Endianness of buffer. Automatically deduced from the serializer parameter. +///@tparam Ts Types of values. Automatically deduced from the values parameters. +/// +///@param serializer Serializer object pointing to the destination buffer. +///@param values One or more parameters to be written. +/// +///@returns The total number of bytes written. +/// +#if __cpp_fold_expressions >= 201603L && __cpp_if_constexpr >= 201606L +template +typename std::enable_if<(sizeof...(Ts) > 1), size_t>::type +/*size_t*/ insert(Serializer& serializer, Ts... values) +{ + if constexpr( (std::is_arithmetic::value && ...) ) + { + const size_t size = ( ... + sizeof(Ts) ); + + if(uint8_t* ptr = serializer.getPtrAndAdvance(size)) + { + size_t offset = 0; + ( ..., (offset += serialization::write(ptr+offset, values)) ); + return offset; + } + + return size; + } + else // Class types may not have fixed sizes, can't optimize them + return ( ... + insert(serializer, values) ); +} +#else +template +size_t insert(Serializer& serializer, const T0& value0, const T1& value1, Ts... values) +{ + return insert(serializer, value0) + insert(serializer, value1, values...); +} +#endif + + +//////////////////////////////////////////////////////////////////////////////// +///@brief Reads multiple values from a Serializer. +/// +/// This function is equivalent to calling extract on each parameter in sequence. +/// +/// This function can make use of C++17 fold expressions to improve performance +/// by combining the buffer bounds checks when all types are of known size (i.e. numeric types). +/// +///@tparam E Endianness of buffer. Automatically deduced from the serializer parameter. +///@tparam Ts Types of values. Automatically deduced from the values parameters. +/// +///@param serializer Serializer object pointing to the destination buffer. +///@param values One or more parameters to be read. +/// +///@returns The total number of bytes read. +/// +#if __cpp_fold_expressions >= 201603L && __cpp_if_constexpr >= 201606L +template +typename std::enable_if<(sizeof...(Ts) > 1), size_t>::type +/*size_t*/ extract(Serializer& serializer, Ts&... values) +{ + if constexpr( (std::is_arithmetic::value && ...) ) + { + const size_t size = ( ... + sizeof(Ts) ); + + if(uint8_t* ptr = serializer.getPtrAndAdvance(size)) + { + size_t offset = 0; + ( ..., (offset += serialization::read(ptr+offset, values)) ); + return offset; + } + + return size; + } + else // Class types may not have fixed sizes, can't optimize them + return ( ... + extract(serializer, values) ); +} +#else +template +size_t extract(Serializer& serializer, T0& value0, T1& value1, Ts&... values) +{ + return extract(serializer, value0) + extract(serializer, value1, values...); +} +#endif + + +// +// Raw buffer - avoids the need to create a serializer yourself. +// + +//////////////////////////////////////////////////////////////////////////////// +///@brief Serializes a value to a raw byte buffer. +/// +/// Use this overload to write a single value without needing to +/// manually construct a Serializer object. +/// +/// Example: +///@code{.cpp} +/// uint8_t buffer[256]; +/// uint32_t value = 16909060; // 0x01020304 +/// insert(value, buffer, sizeof(buffer), 0, false); +/// // Buffer = [0x01, 0x02, 0x03, 0x04] +/// insert(value, buffer, sizeof(buffer), 0, false); +/// // Buffer = [0x04, 0x03, 0x02, 0x01] +///@endcode +/// +///@tparam E Endianness of buffer. Must be manually specified. +///@tparam T Type of value. Automatically deduced from the value parameter. +/// +///@param value Parameter to serialize. This can be any serializable type. +///@param buffer Pointer to first element of the byte buffer. +///@param buffer_length Length/size of buffer. +///@param offset Starting offset. Default 0. +///@param exact_size Returns true only if exactly buffer_length plus offset bytes are written. Default false. +/// +///@returns False if the buffer isn't large enough. +///@returns False if exact_size is true and the number of bytes written didn't equal buffer_length. +///@returns True otherwise. +/// +template +bool insert(const T& value, uint8_t* buffer, size_t buffer_length, size_t offset=0, bool exact_size=false) +{ + Serializer serializer(buffer, buffer_length, offset); + serializer.insert(value); + return exact_size ? serializer.isFinished() : serializer.isOk(); +} + +//////////////////////////////////////////////////////////////////////////////// +///@brief Deserializes a value from a raw byte buffer. +/// +/// Use this overload to read a single value without needing to +/// manually construct a Serializer object. +/// +/// Example: +///@code{.cpp} +/// uint8_t buffer[4] = {0x01, 0x02, 0x03, 0x04}; +/// uint32_t value_BE; +/// uint32_t value_LE; +/// extract(value_BE, buffer, sizeof(buffer), 0, true); +/// extract(value_LE, buffer, sizeof(buffer), 0, true); +/// // value_BE == 0x01020304 +/// // value_LE == 0x04030201 +///@endcode +/// +///@tparam E Endianness of buffer. Must be manually specified. +///@tparam T Type of value. Automatically deduced from the value parameter. +/// +///@param value Parameter to deserialize. This can be any serializable type. +///@param buffer Pointer to first element of the byte buffer. +///@param buffer_length Length/size of buffer. +///@param offset Starting offset (default 0). +///@param exact_size Returns true only if exactly buffer_length-offset bytes are read. Default false. +/// +///@returns False if the buffer doesn't have enough data. +///@returns False if exact_size is true and the number of bytes read plus offset didn't equal buffer_length. +///@returns True otherwise. +/// +template +bool extract(T& value, const uint8_t* buffer, size_t buffer_length, size_t offset=0, bool exact_size=false) +{ + Serializer serializer(buffer, buffer_length, offset); + extract(serializer, value); + return exact_size ? serializer.isFinished() : serializer.isOk(); +} + + +// +// Raw buffer - Span version +// + +//////////////////////////////////////////////////////////////////////////////// +///@brief Serializes a value to a raw byte buffer (span version). +/// +/// Use this overload to write a single value without needing to +/// manually construct a Serializer object. +/// +///@tparam E Endianness of buffer. Must be manually specified. +///@tparam T Type of value. Automatically deduced from the value parameter. +/// +///@param value Parameter to serialize. This can be any serializable type. +///@param buffer Source buffer span. +///@param offset Starting offset. Default 0. +///@param exact_size Returns true only if exactly buffer.size()-offset bytes are written. Default false. +/// +///@returns False if the buffer isn't large enough. +///@returns False if exact_size is true and the number of bytes written didn't equal buffer_length. +///@returns True otherwise. +/// +template +bool insert(T value, microstrain::Span buffer, size_t offset=0, bool exact_size=false) +{ + return insert(value, buffer.data(), buffer.size(), offset, exact_size); +} + +//////////////////////////////////////////////////////////////////////////////// +///@brief Deserializes a value from a raw byte buffer (span version). +/// +/// Use this overload to read a single value without needing to +/// manually construct a Serializer object. +/// +///@tparam E Endianness of buffer. Must be manually specified. +///@tparam T Type of value. Automatically deduced from the value parameter. +/// +///@param value Parameter to deserialize. This can be any serializable type. +///@param buffer Source buffer span. +///@param offset Starting offset (default 0). +///@param exact_size Returns true only if exactly buffer.size()-offset bytes are read. Default false. +/// +///@returns False if the buffer doesn't have enough data. +///@returns False if exact_size is true and the number of bytes read plus offset didn't equal buffer_length. +///@returns True otherwise. +/// +template +bool extract(T& value, microstrain::Span buffer, size_t offset=0, bool exact_size=false) +{ + return extract(value, buffer.data(), buffer.size(), offset, exact_size); +} + +// +// Special Deserialization +// + +#ifdef MICROSTRAIN_HAS_OPTIONAL +//////////////////////////////////////////////////////////////////////////////// +///@brief Reads a value from a serializer and returns it via std::optional. +/// +/// This overload is only enabled if std::optional is supported. +/// +///@tparam E Endianness of buffer. Automatically deduced from the serializer parameter. +///@tparam T Type of value. Must be manually specified. +/// +///@param buffer Serializer object pointing to the buffer. +/// +///@returns The value read from the buffer, or std::nullopt if it couldn't be read. +/// +template +std::optional extract(Serializer& serializer) +{ + T value; + if(extract(serializer, value)) + return value; + else + return std::nullopt; +} + +//////////////////////////////////////////////////////////////////////////////// +///@brief Reads a value from a raw byte buffer and returns it via std::optional. +/// +/// This overload is only enabled if std::optional is supported. +/// +///@see bool extract(T& value, const uint8_t* buffer, size_t buffer_length, size_t offset=0, bool exact_size=false) +/// +///@tparam E Endianness of buffer. Must be manually specified. +///@tparam T Type of value. Must be manually specified. +/// +///@param buffer Pointer to first element of the byte buffer. +///@param buffer_length Length/size of buffer. +///@param offset Starting offset (default 0). +///@param exact_size Returns a value only if exactly buffer_length-offset bytes are read. Default false. +/// +///@returns The value read from the buffer, or std::nullopt if it couldn't be read. +/// +template +std::optional extract(const uint8_t* buffer, size_t length, size_t offset, bool exact_size=false) +{ + T value; + if(extract(value, buffer, length, offset, exact_size)) + return value; + else + return std::nullopt; +} + +//////////////////////////////////////////////////////////////////////////////// +///@brief Reads a value from a raw byte span and returns it via std::optional. +/// +/// This overload is only enabled if std::optional is supported. +/// +///@see bool extract(T& value, microstrain::Span buffer, size_t offset=0, bool exact_size=false) +/// +///@tparam E Endianness of buffer. Must be manually specified. +///@tparam T Type of value. Must be manually specified. +/// +///@param buffer Source buffer span. +///@param offset Starting offset (default 0). +///@param exact_size Returns a value only if exactly buffer.size()-offset bytes are read. Default false. +/// +///@returns The value read from the buffer, or std::nullopt if it couldn't be read. +/// +template +std::optional extract(microstrain::Span buffer, size_t offset, bool exact_size=false) +{ + T value; + if(extract(value, buffer.data(), buffer.size(), offset, exact_size)) + return value; + else + return std::nullopt; +} +#endif + + +//////////////////////////////////////////////////////////////////////////////// +// +// Serializer member functions which depend on the above overloads. +// +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +///@brief Serializes one or more values. +/// +/// This function defers to the non-member function microstrain::insert. By +/// doing so, it allows the user to provide custom overloads for their own +/// types. Any type supported by the non-member functions may be used here. +/// +///@tparam Ts Types of values to serialize. +/// +///@param values One or more parameters to serialize. +/// +///@returns True if all values were successfully written. +/// +template +template +bool Serializer::insert(const Ts&... values) +{ + // Prevents infinite recursion but allows ADL + // https://stackoverflow.com/questions/13407205/calling-nonmember-instead-of-member-function + using microstrain::insert; + + insert(*this, values...); + + return isOk(); +} + +//////////////////////////////////////////////////////////////////////////////// +///@brief Deserializes one or more values. +/// +/// This function defers to the non-member function microstrain::extract. By +/// doing so, it allows the user to provide custom overloads for their own +/// types. Any type supported by the non-member functions may be used here. +/// +///@tparam Ts Types of values to deserialize. +/// +///@param[out] values One or more parameters to deserialize. +/// +///@returns True if all values were successfully read. +/// +template +template +bool Serializer::extract(Ts&... values) +{ + // Prevents infinite recursion but allows ADL + // https://stackoverflow.com/questions/13407205/calling-nonmember-instead-of-member-function + using microstrain::extract; + + extract(*this, values...); + + return isOk(); +} + +//////////////////////////////////////////////////////////////////////////////// +///@brief Deserializes an integer with maximum permissible value. +/// +/// This function is intended to be used with protocols which have embedded +/// length fields. This function returns false and invalidates the serializer +/// if the count is too large. +/// +///@tparam T Type of value to read. Expected to be integer-like and must +/// support `bool operator<=(S)`. +///@tparam S Type of the maximum value. Usually the same integral type as T, +/// but the only requirement is that it can be compared with T. +/// +///@param[out] count Value read from the buffer. Set to 0 on failure. +///@param max_count Maximum permissible value for count (inclusive). +/// +///@returns True if the count was successfully read and is less than +/// or equal to max_count. +/// +template +template +bool Serializer::extract_count(T& count, S max_count) +{ + if( this->extract(count) ) + { + if( count <= max_count ) + return true; + + invalidate(); + } + + count = 0; + + return false; +} + + +} // namespace microstrain diff --git a/src/cpp/microstrain/common/span.hpp b/src/cpp/microstrain/common/span.hpp new file mode 100644 index 000000000..6075a88f0 --- /dev/null +++ b/src/cpp/microstrain/common/span.hpp @@ -0,0 +1,121 @@ +#pragma once + +#ifdef MICROSTRAIN_USE_STD_SPAN + +#include + +namespace microstrain +{ + + static inline constexpr size_t DYNAMIC_EXTENT = std::dynamic_extent; + + template + using Span = std::span; + +} // namespace microstrain + +#else // MICROSTRAIN_USE_STD_SPAN + +#include +#include + +namespace microstrain +{ + + +static constexpr size_t DYNAMIC_EXTENT = -1; + +//////////////////////////////////////////////////////////////////////////////// +///@brief Implementation of std::span from C++20. +/// +/// This class represents a pointer and length. It provides the minimum +/// functionality required by this SDK while trying to be interchangeable +/// with std::span. +/// +/// https://en.cppreference.com/w/cpp/container/span +/// +/// See @ref cpp_standards +/// +template +struct Span +{ + static constexpr size_t extent = Extent; + + using element_type = T; + using value_type = typename std::remove_cv::type; + using difference_type = ptrdiff_t; + using pointer = T*; + using reference = T&; + using const_pointer = const T*; + using const_reference = const T&; + + constexpr Span(pointer ptr) : m_ptr(ptr) {} + + constexpr pointer begin() const noexcept { return m_ptr; } + constexpr pointer end() const noexcept { return m_ptr+extent; } + + constexpr element_type front() const noexcept { return *m_ptr; } + constexpr element_type back() const noexcept { return *m_ptr[extent-1]; } + + constexpr reference operator[](size_t idx) noexcept { return m_ptr[idx]; } + constexpr const_reference operator[](size_t idx) const noexcept { return m_ptr[idx]; } + + constexpr pointer data() const noexcept { return m_ptr; } + + [[nodiscard]] constexpr size_t size() const noexcept { return extent; } + [[nodiscard]] constexpr bool empty() const noexcept { return extent == 0; } + + [[nodiscard]] constexpr Span subspan(size_t index, size_t length) const { return {m_ptr+index, length}; } + [[nodiscard]] constexpr Span subspan(size_t index) const { return {m_ptr+index, extent-index}; } + template + [[nodiscard]] constexpr Span subspan() const { return {m_ptr+Offset}; } + +private: + pointer m_ptr = nullptr; +}; + + +template +struct Span +{ + using element_type = T; + using value_type = typename std::remove_cv::type; + using difference_type = ptrdiff_t; + using pointer = T*; + using reference = T&; + using const_pointer = const T*; + using const_reference = const T&; + + constexpr Span() = default; + constexpr Span(pointer ptr, size_t cnt) : m_ptr(ptr), m_cnt(cnt) {} + template + constexpr Span(const T (&arr)[N]) : m_ptr(arr), m_cnt(N) {} + + constexpr pointer begin() const noexcept { return m_ptr; } + constexpr pointer end() const noexcept { return m_ptr+m_cnt; } + + constexpr element_type front() const noexcept { return *m_ptr; } + constexpr element_type back() const noexcept { return *m_ptr[m_cnt-1]; } + + constexpr reference operator[](size_t idx) noexcept { return m_ptr[idx]; } + constexpr const_reference operator[](size_t idx) const noexcept { return m_ptr[idx]; } + + constexpr pointer data() const noexcept { return m_ptr; } + + [[nodiscard]] constexpr size_t size() const noexcept { return m_cnt; } + [[nodiscard]] constexpr bool empty() const noexcept { return m_cnt == 0; } + + [[nodiscard]] constexpr Span subspan(size_t index, size_t length) const { return {m_ptr+index, length}; } + [[nodiscard]] constexpr Span subspan(size_t index) const { return {m_ptr+index, m_cnt-index}; } + template + [[nodiscard]] constexpr Span subspan() const { return {m_ptr+Offset, Count}; } + +private: + pointer m_ptr = nullptr; + size_t m_cnt = 0; +}; + + +} // namespace microstrain + +#endif // MICROSTRAIN_USE_STD_SPAN diff --git a/src/cpp/microstrain/connections/CMakeLists.txt b/src/cpp/microstrain/connections/CMakeLists.txt new file mode 100644 index 000000000..4c46c8b44 --- /dev/null +++ b/src/cpp/microstrain/connections/CMakeLists.txt @@ -0,0 +1,14 @@ +if(MICROSTRAIN_ENABLE_SERIAL) + add_subdirectory(serial) +endif() + +if(MICROSTRAIN_ENABLE_TCP) + add_subdirectory(tcp) +endif() + +# Don't include recording connection if no connections are enabled. +if(MICROSTRAIN_ENABLE_SERIAL OR MICROSTRAIN_ENABLE_TCP) + add_subdirectory(recording) +endif() + +set(MICROSTRAIN_LIBRARIES_TMP ${MICROSTRAIN_LIBRARIES_TMP} PARENT_SCOPE) diff --git a/src/cpp/microstrain/connections/connection.hpp b/src/cpp/microstrain/connections/connection.hpp new file mode 100644 index 000000000..e74fe8a40 --- /dev/null +++ b/src/cpp/microstrain/connections/connection.hpp @@ -0,0 +1,64 @@ +#pragma once + +#include +#include + +#include +#include + +#ifdef MICROSTRAIN_HAS_SPAN +#include +#endif + + +namespace microstrain +{ + +//////////////////////////////////////////////////////////////////////////////// +///@brief Represents a type of connection. +/// +/// The following methods are pure virtual and must be implemented by a derived +/// class: +///@li `bool sendToDevice(const uint8_t* data, size_t length)` +///@li `bool recvFromDevice(uint8_t* buffer, size_t maxLength, unsigned int wait_time_ms, size_t* lengthOut, EmbeddedTimestamp* timestampOut)` +/// +class Connection +{ +public: + + static constexpr auto TYPE = "None"; + + Connection() { mType = TYPE; }; + virtual ~Connection() {} + + virtual bool sendToDevice(const uint8_t* data, size_t length) = 0; + virtual bool recvFromDevice(uint8_t* buffer, size_t max_length, unsigned int wait_time_ms, size_t* length_out, EmbeddedTimestamp* timestamp_out) = 0; + +#ifdef MICROSTRAIN_HAS_SPAN + bool sendToDevice(std::span data) { return sendToDevice(data.data(), data.size()); } + bool recvFromDevice(std::span& buffer, unsigned int wait_time_ms, EmbeddedTimestamp* timestamp_out) { + size_t length = 0; + if(!recvFromDevice(buffer.data(), buffer.size(), wait_time_ms, &length, timestamp_out)) + return false; + buffer = buffer.first(length); + return true; + } +#endif + + virtual bool isConnected() const = 0; + virtual bool connect() = 0; + virtual bool disconnect() = 0; + + const char* type() const { return mType; }; + + virtual const char* interfaceName() const = 0; + virtual uint32_t parameter() const = 0; + +protected: + + const char *mType; + +}; + + +} // namespace microstrain diff --git a/src/cpp/microstrain/connections/microstrain_connections_all.hpp b/src/cpp/microstrain/connections/microstrain_connections_all.hpp new file mode 100644 index 000000000..f20776609 --- /dev/null +++ b/src/cpp/microstrain/connections/microstrain_connections_all.hpp @@ -0,0 +1,7 @@ +#pragma once + +// MicroStrain Connections +#include "connection.hpp" +#include "recording/recording_connection.hpp" +#include "serial/serial_connection.hpp" +#include "tcp/tcp_connection.hpp" diff --git a/src/cpp/microstrain/connections/recording/CMakeLists.txt b/src/cpp/microstrain/connections/recording/CMakeLists.txt new file mode 100644 index 000000000..161d5a603 --- /dev/null +++ b/src/cpp/microstrain/connections/recording/CMakeLists.txt @@ -0,0 +1,23 @@ +set(MICROSTRAIN_RECORDING_CONNECTION_LIBRARY "microstrain_recording_connection" CACHE INTERNAL "Name of the MicroStrain recording connections library") +mark_as_advanced(MICROSTRAIN_RECORDING_CONNECTION_LIBRARY) + +add_library(${MICROSTRAIN_RECORDING_CONNECTION_LIBRARY} + "${CMAKE_CURRENT_LIST_DIR}/recording_connection.cpp" + "${CMAKE_CURRENT_LIST_DIR}/recording_connection.hpp" + "${CMAKE_CURRENT_LIST_DIR}/../connection.hpp" +) + +target_compile_features(${MICROSTRAIN_RECORDING_CONNECTION_LIBRARY} PUBLIC cxx_std_11) + +target_link_libraries(${MICROSTRAIN_RECORDING_CONNECTION_LIBRARY} PUBLIC ${MICROSTRAIN_COMMON_LIBRARY}) + +target_compile_options(${MICROSTRAIN_RECORDING_CONNECTION_LIBRARY} PRIVATE ${MICROSTRAIN_PRIVATE_COMPILE_OPTIONS}) + +set(MICROSTRAIN_LIBRARIES_TMP ${MICROSTRAIN_LIBRARIES_TMP} ${MICROSTRAIN_RECORDING_CONNECTION_LIBRARY} PARENT_SCOPE) + +# +# Installation +# + +include(microstrain_utilities) +microstrain_setup_library_install(${MICROSTRAIN_RECORDING_CONNECTION_LIBRARY} ${MICROSTRAIN_SRC_DIR}) diff --git a/src/mip/extras/recording_connection.cpp b/src/cpp/microstrain/connections/recording/recording_connection.cpp similarity index 61% rename from src/mip/extras/recording_connection.cpp rename to src/cpp/microstrain/connections/recording/recording_connection.cpp index b9a3e7d7a..f3f7fd2a4 100644 --- a/src/mip/extras/recording_connection.cpp +++ b/src/cpp/microstrain/connections/recording/recording_connection.cpp @@ -1,8 +1,10 @@ + #include "recording_connection.hpp" -namespace mip + +namespace microstrain { -namespace extras +namespace connections { ///@brief Creates a RecordingConnection that will write received bytes to recvStream, and sent bytes to sendStream @@ -16,33 +18,33 @@ RecordingConnection::RecordingConnection(Connection* connection, std::ostream* r mType = TYPE; } -///@copydoc mip::Connection::sendToDevice +///@copydoc microstrain::Connection::sendToDevice bool RecordingConnection::sendToDevice(const uint8_t* data, size_t length) { const bool ok = mConnection->sendToDevice(data, length); - if( ok && mSendFile != nullptr && mConnection->isConnected()) - { - mSendFile->write(reinterpret_cast(data), length); + if( ok && mSendFile != nullptr) + { + mSendFile->write(reinterpret_cast(data), static_cast(length)); mSendFileWritten += length; } return ok; } -///@copydoc mip::Connection::recvFromDevice -bool RecordingConnection::recvFromDevice(uint8_t* buffer, size_t max_length, Timeout wait_time, size_t* count_out, Timestamp* timestamp_out) +///@copydoc microstrain::Connection::recvFromDevice +bool RecordingConnection::recvFromDevice(uint8_t* buffer, size_t max_length, unsigned int wait_time_ms, size_t* length_out, EmbeddedTimestamp* timestamp_out) { - const bool ok = mConnection->recvFromDevice(buffer, max_length, wait_time, count_out, timestamp_out); - if (ok && mRecvFile != nullptr && mConnection->isConnected()) - { - mRecvFile->write(reinterpret_cast(buffer), *count_out); + const bool ok = mConnection->recvFromDevice(buffer, max_length, wait_time_ms, length_out, timestamp_out); - mRecvFileWritten += *count_out; + if (ok && mRecvFile != nullptr) + { + mRecvFile->write(reinterpret_cast(buffer), static_cast(*length_out)); + mRecvFileWritten += *length_out; } return ok; } -} // namespace extras -} // namespace mip \ No newline at end of file +} // namespace connections +} // namespace microstrain diff --git a/src/mip/extras/recording_connection.hpp b/src/cpp/microstrain/connections/recording/recording_connection.hpp similarity index 81% rename from src/mip/extras/recording_connection.hpp rename to src/cpp/microstrain/connections/recording/recording_connection.hpp index 4297d7651..68c121a16 100644 --- a/src/mip/extras/recording_connection.hpp +++ b/src/cpp/microstrain/connections/recording/recording_connection.hpp @@ -1,18 +1,18 @@ #pragma once -#include +#include "../connection.hpp" #include #include #include -namespace mip +namespace microstrain { -namespace extras +namespace connections { //////////////////////////////////////////////////////////////////////////////// -///@addtogroup mip_extras Extra utilities +///@addtogroup microstrain_extras Extra utilities ///@{ //////////////////////////////////////////////////////////////////////////////// @@ -24,11 +24,12 @@ class RecordingConnection : public Connection static constexpr auto TYPE = "Recording"; RecordingConnection(Connection *connection, std::ostream *recvStream = nullptr, std::ostream *sendStream = nullptr); + ~RecordingConnection() = default; - bool sendToDevice(const uint8_t* data, size_t length) final; - bool recvFromDevice(uint8_t* buffer, size_t max_length, Timeout wait_time, size_t* length_out, Timestamp* timestamp_out) final; + bool sendToDevice(const uint8_t* data, size_t length) override; + bool recvFromDevice(uint8_t* buffer, size_t max_length, unsigned int wait_time_ms, size_t* length_out, EmbeddedTimestamp* timestamp_out) override; - bool isConnected() const + bool isConnected() const override { if(mConnection) return mConnection->isConnected(); @@ -36,13 +37,13 @@ class RecordingConnection : public Connection return false; }; - bool connect() + bool connect() override { if (mConnection) return mConnection->connect(); return false; }; - bool disconnect() + bool disconnect() override { if (mConnection) return mConnection->disconnect(); @@ -52,12 +53,12 @@ class RecordingConnection : public Connection const char* interfaceName() const override { return mConnection->interfaceName(); } uint32_t parameter() const override { return mConnection->parameter(); } - uint64_t recvFileBytesWritten() + uint64_t recvFileBytesWritten() const { return mRecvFileWritten; } - uint64_t sendFileBytesWritten() + uint64_t sendFileBytesWritten() const { return mSendFileWritten; } @@ -97,5 +98,5 @@ class RecordingConnectionWrapper : public RecordingConnection ///@} //////////////////////////////////////////////////////////////////////////////// -} // namespace extras -} // namespace mip +} // namespace connections +} // namespace microstrain diff --git a/src/cpp/microstrain/connections/serial/CMakeLists.txt b/src/cpp/microstrain/connections/serial/CMakeLists.txt new file mode 100644 index 000000000..0ac119d42 --- /dev/null +++ b/src/cpp/microstrain/connections/serial/CMakeLists.txt @@ -0,0 +1,15 @@ +# Add to existing C library. +target_sources(${MICROSTRAIN_SERIAL_LIBRARY} PRIVATE + "${CMAKE_CURRENT_LIST_DIR}/serial_connection.cpp" + "${CMAKE_CURRENT_LIST_DIR}/serial_connection.hpp" + "${CMAKE_CURRENT_LIST_DIR}/../connection.hpp" +) + +target_compile_features(${MICROSTRAIN_SERIAL_LIBRARY} PUBLIC cxx_std_11) + +# +# Installation +# + +include(microstrain_utilities) +microstrain_setup_install_headers(${MICROSTRAIN_SERIAL_LIBRARY} ${MICROSTRAIN_SRC_DIR}) diff --git a/src/mip/platform/serial_connection.cpp b/src/cpp/microstrain/connections/serial/serial_connection.cpp similarity index 67% rename from src/mip/platform/serial_connection.cpp rename to src/cpp/microstrain/connections/serial/serial_connection.cpp index 22603e7a6..54e7e1edc 100644 --- a/src/mip/platform/serial_connection.cpp +++ b/src/cpp/microstrain/connections/serial/serial_connection.cpp @@ -4,18 +4,18 @@ #include #include -namespace mip +namespace microstrain { -namespace platform +namespace connections { -///@brief Creates a SerialConnection that will communicate with a device over serial +///@brief Creates a Serial Connection that will communicate with a device over serial /// ///@param portName Path to the port to connect to. On Windows, this usually looks like "COM", on linux, "/dev/tty" ///@param baudrate Baud rate to open the device at. Note that the device needs to be configured to -SerialConnection::SerialConnection(const std::string& portName, uint32_t baudrate) +SerialConnection::SerialConnection(std::string portName, uint32_t baudrate) { - mPortName = portName; + mPortName = std::move(portName); mBaudrate = baudrate; mType = TYPE; @@ -54,20 +54,20 @@ bool SerialConnection::disconnect() -///@copydoc mip::Connection::recvFromDevice -bool SerialConnection::recvFromDevice(uint8_t* buffer, size_t max_length, Timeout wait_time, size_t* length_out, mip::Timestamp* timestamp) +///@copydoc microstrain::Connection::recvFromDevice +bool SerialConnection::recvFromDevice(uint8_t* buffer, size_t max_length, unsigned int wait_time_ms, size_t* length_out, EmbeddedTimestamp* timestamp_out) { - *timestamp = std::chrono::duration_cast(std::chrono::steady_clock::now().time_since_epoch()).count(); + *timestamp_out = std::chrono::duration_cast(std::chrono::steady_clock::now().time_since_epoch()).count(); - return serial_port_read(&mPort, buffer, max_length, wait_time, length_out); + return serial_port_read(&mPort, buffer, max_length, wait_time_ms, length_out); } -///@copydoc mip::Connection::sendToDevice +///@copydoc microstrain::Connection::sendToDevice bool SerialConnection::sendToDevice(const uint8_t* data, size_t length) { size_t length_out; return serial_port_write(&mPort, data, length, &length_out); } -} // namespace platform -} // namespace mip +} // namespace connections +} // namespace microstrain diff --git a/src/mip/platform/serial_connection.hpp b/src/cpp/microstrain/connections/serial/serial_connection.hpp similarity index 74% rename from src/mip/platform/serial_connection.hpp rename to src/cpp/microstrain/connections/serial/serial_connection.hpp index 6ecd6d5f1..cc1af1df9 100644 --- a/src/mip/platform/serial_connection.hpp +++ b/src/cpp/microstrain/connections/serial/serial_connection.hpp @@ -1,32 +1,33 @@ #pragma once -#include -#include +#include "../connection.hpp" + +#include #include -namespace mip +namespace microstrain { -namespace platform +namespace connections { //////////////////////////////////////////////////////////////////////////////// -///@addtogroup mip_platform +///@addtogroup microstrain_platform ///@{ //////////////////////////////////////////////////////////////////////////////// ///@brief Can be used on Windows, OSX, or linux to communicate with a MIP device over serial /// -class SerialConnection : public mip::Connection +class SerialConnection : public microstrain::Connection { public: static constexpr auto TYPE = "Serial"; - SerialConnection(const std::string& portName, uint32_t baudrate); + SerialConnection(std::string portName, uint32_t baudrate); ~SerialConnection(); - bool recvFromDevice(uint8_t* buffer, size_t max_length, Timeout wait_time, size_t* length_out, mip::Timestamp* timestamp) final; + bool recvFromDevice(uint8_t* buffer, size_t max_length, unsigned int wait_time_ms, size_t* length_out, EmbeddedTimestamp* timestamp_out) final; bool sendToDevice(const uint8_t* data, size_t length) final; bool isConnected() const override; @@ -63,5 +64,5 @@ class UsbSerialConnection : public SerialConnection ///@} //////////////////////////////////////////////////////////////////////////////// -} // namespace platform -} // namespace mip \ No newline at end of file +} // namespace connections +} // namespace microstrain diff --git a/src/cpp/microstrain/connections/tcp/CMakeLists.txt b/src/cpp/microstrain/connections/tcp/CMakeLists.txt new file mode 100644 index 000000000..1558d4822 --- /dev/null +++ b/src/cpp/microstrain/connections/tcp/CMakeLists.txt @@ -0,0 +1,15 @@ +# Add to existing C library. +target_sources(${MICROSTRAIN_SOCKET_LIBRARY} PRIVATE + "${CMAKE_CURRENT_LIST_DIR}/tcp_connection.cpp" + "${CMAKE_CURRENT_LIST_DIR}/tcp_connection.hpp" + "${CMAKE_CURRENT_LIST_DIR}/../connection.hpp" +) + +target_compile_features(${MICROSTRAIN_SOCKET_LIBRARY} PUBLIC cxx_std_11) + +# +# Installation +# + +include(microstrain_utilities) +microstrain_setup_install_headers(${MICROSTRAIN_SOCKET_LIBRARY} ${MICROSTRAIN_SRC_DIR}) diff --git a/src/mip/platform/tcp_connection.cpp b/src/cpp/microstrain/connections/tcp/tcp_connection.cpp similarity index 70% rename from src/mip/platform/tcp_connection.cpp rename to src/cpp/microstrain/connections/tcp/tcp_connection.cpp index 8131a465c..80a2b78bc 100644 --- a/src/mip/platform/tcp_connection.cpp +++ b/src/cpp/microstrain/connections/tcp/tcp_connection.cpp @@ -5,14 +5,14 @@ #include #include -namespace mip +namespace microstrain { -namespace platform +namespace connections { ///@brief Creates a TcpConnection that will communicate with a device over TCP /// -///@param hostName Host name or IP address to connect to +///@param hostname Host name or IP address to connect to ///@param port Port on hostName to connect to TcpConnection::TcpConnection(const std::string& hostname, uint16_t port) { @@ -55,22 +55,22 @@ bool TcpConnection::disconnect() return tcp_socket_close(&mSocket); } -///@copydoc mip::Connection::sendToDevice -bool TcpConnection::recvFromDevice(uint8_t* buffer, size_t max_length, Timeout wait_time, size_t* length_out, mip::Timestamp* timestamp) +///@copydoc microstrain::Connection::recvFromDevice +bool TcpConnection::recvFromDevice(uint8_t* buffer, size_t max_length, unsigned int wait_time_ms, size_t* length_out, EmbeddedTimestamp* timestamp_out) { - (void)wait_time; // Not used, timeout is always fixed + (void)wait_time_ms; // Not used, timeout is always fixed - *timestamp = std::chrono::duration_cast(std::chrono::steady_clock::now().time_since_epoch()).count(); + *timestamp_out = std::chrono::duration_cast(std::chrono::steady_clock::now().time_since_epoch()).count(); return tcp_socket_recv(&mSocket, buffer, max_length, length_out); } -///@copydoc mip::Connection::recvFromDevice +///@copydoc microstrain::Connection::sendToDevice bool TcpConnection::sendToDevice(const uint8_t* data, size_t length) { size_t length_out; return tcp_socket_send(&mSocket, data, length, &length_out); } -} // namespace platform -} // namespace mip \ No newline at end of file +} // namespace connections +} // namespace microstrain diff --git a/src/mip/platform/tcp_connection.hpp b/src/cpp/microstrain/connections/tcp/tcp_connection.hpp similarity index 56% rename from src/mip/platform/tcp_connection.hpp rename to src/cpp/microstrain/connections/tcp/tcp_connection.hpp index a33bc9558..60efb4000 100644 --- a/src/mip/platform/tcp_connection.hpp +++ b/src/cpp/microstrain/connections/tcp/tcp_connection.hpp @@ -1,38 +1,40 @@ #pragma once -#include +#include "../connection.hpp" -#include +#include #include -namespace mip +namespace microstrain { -namespace platform +namespace connections { //////////////////////////////////////////////////////////////////////////////// -///@addtogroup mip_platform +///@addtogroup microstrain_platform ///@{ //////////////////////////////////////////////////////////////////////////////// ///@brief Can be used on Windows, OSX, or linux to communicate with a MIP device over TCP /// -class TcpConnection : public mip::Connection +class TcpConnection : public microstrain::Connection { public: static constexpr auto TYPE = "TCP"; - TcpConnection() = default; TcpConnection(const std::string& hostname, uint16_t port); ~TcpConnection(); - bool recvFromDevice(uint8_t* buffer, size_t max_length, Timeout wait_time, size_t* length_out, mip::Timestamp* timestamp) final; - bool sendToDevice(const uint8_t* data, size_t length) final; + TcpConnection(const TcpConnection&) = delete; + TcpConnection& operator=(const TcpConnection&) = delete; - bool isConnected() const; - bool connect(); - bool disconnect(); + bool recvFromDevice(uint8_t* buffer, size_t max_length, unsigned int wait_time_ms, size_t* length_out, EmbeddedTimestamp* timestamp_out) override; + bool sendToDevice(const uint8_t* data, size_t length) override; + + bool isConnected() const override; + bool connect() override; + bool disconnect() override; void connectionInfo(std::string &host_name, uint32_t &port) const { @@ -53,5 +55,5 @@ class TcpConnection : public mip::Connection ///@} //////////////////////////////////////////////////////////////////////////////// -}; // namespace platform -}; // namespace mip \ No newline at end of file +}; // namespace microstrain +}; // namespace connections diff --git a/src/cpp/microstrain/extras/CMakeLists.txt b/src/cpp/microstrain/extras/CMakeLists.txt new file mode 100644 index 000000000..f81dddf12 --- /dev/null +++ b/src/cpp/microstrain/extras/CMakeLists.txt @@ -0,0 +1,28 @@ +set(MICROSTRAIN_EXTRAS_LIBRARY "microstrain_extras" CACHE INTERNAL "Name of the MicroStrain extras library") +mark_as_advanced(MICROSTRAIN_EXTRAS_LIBRARY) + +add_library(${MICROSTRAIN_EXTRAS_LIBRARY} + "${CMAKE_CURRENT_LIST_DIR}/scope_helper.cpp" + "${CMAKE_CURRENT_LIST_DIR}/scope_helper.hpp" +) + + +target_compile_features(${MICROSTRAIN_EXTRAS_LIBRARY} PUBLIC cxx_std_11) + +target_link_libraries(${MICROSTRAIN_EXTRAS_LIBRARY} PUBLIC ${MICROSTRAIN_COMMON_LIBRARY}) + +target_compile_definitions(${MICROSTRAIN_EXTRAS_LIBRARY} + PUBLIC "MICROSTRAIN_ENABLE_EXTRAS=1" + PRIVATE ${MICROSTRAIN_PRIVATE_COMPILE_DEFINITIONS} +) + +target_compile_options(${MICROSTRAIN_EXTRAS_LIBRARY} PRIVATE ${MICROSTRAIN_PRIVATE_COMPILE_OPTIONS}) + +set(MICROSTRAIN_LIBRARIES_TMP ${MICROSTRAIN_LIBRARIES_TMP} ${MICROSTRAIN_EXTRAS_LIBRARY} PARENT_SCOPE) + +# +# Installation +# + +include(microstrain_utilities) +microstrain_setup_library_install(${MICROSTRAIN_EXTRAS_LIBRARY} ${MICROSTRAIN_SRC_DIR}) diff --git a/src/cpp/microstrain/extras/scope_helper.cpp b/src/cpp/microstrain/extras/scope_helper.cpp new file mode 100644 index 000000000..ac51f5e82 --- /dev/null +++ b/src/cpp/microstrain/extras/scope_helper.cpp @@ -0,0 +1,28 @@ +#include "scope_helper.hpp" + +namespace microstrain +{ +namespace extras +{ + +ScopeHelper::ScopeHelper(std::function scopeFunction) : + m_outOfScopeFunction(scopeFunction), + m_canceled(false) +{ +} + +ScopeHelper::~ScopeHelper() +{ + if (!m_canceled) + { + m_outOfScopeFunction(); + } +} + +void ScopeHelper::cancel() +{ + m_canceled = true; +} + +} //namespace extras +} //namespace microstrain diff --git a/src/cpp/microstrain/extras/scope_helper.hpp b/src/cpp/microstrain/extras/scope_helper.hpp new file mode 100644 index 000000000..f766f4de1 --- /dev/null +++ b/src/cpp/microstrain/extras/scope_helper.hpp @@ -0,0 +1,47 @@ +#pragma once + +#include +#include + +namespace microstrain +{ +namespace extras +{ + +//Class: ScopeHelper +// Class that allows a function to be run when this object goes out of scope. +class ScopeHelper +{ +private: + //Variable: m_outOfScopeFunction + // The function to run when the ScopeHelper goes out of scope. + std::function m_outOfScopeFunction; + + //Variable: m_canceled + // Whether the scope function has been canceled or not. + bool m_canceled; + + ScopeHelper(); //default constructor disabled + ScopeHelper(const ScopeHelper&); //copy constructor disabled + ScopeHelper& operator=(const ScopeHelper&); //assignment operator disabled + +public: + //Constructor: ScopeHelper + // Creates a ScopeHelper object. + // + //Parameters: + // scopeFunction - The function to run when the ScopeHelper object is destroyed. + ScopeHelper(std::function scopeFunction); + + //Destructor: ScopeHelper + // Runs whatever function was assigned in the creation of the ScopeHelper. + ~ScopeHelper(); + + //Function: cancel + // Sets a flag that indicates the originally set function should NOT be run when + // the ScopeHelper is destroyed. + void cancel(); +}; + +} //namespace extras +} //namespace microstrain diff --git a/src/cpp/microstrain/microstrain_all.hpp b/src/cpp/microstrain/microstrain_all.hpp new file mode 100644 index 000000000..5a0233561 --- /dev/null +++ b/src/cpp/microstrain/microstrain_all.hpp @@ -0,0 +1,24 @@ +#pragma once + +// MicroStrain Common +#include "common/embedded_time.hpp" +#include "common/index.hpp" +#include "common/logging.hpp" +#include "common/platform.hpp" +#include "common/serialization.hpp" +#include "common/serialization/readwrite.hpp" +#include "common/serialization/serializer.hpp" + +//////////////////////////////////////////////////////////////////////////////// +///@defgroup microstrain MicroStrain API +///@{ +/// +///@defgroup microstrain_c MicroStrain C API +///@{ +///@} +/// +///@defgroup microstrain_cpp MicroStrain C++ API +///@{ +///@} +/// +///@} diff --git a/src/cpp/mip/CMakeLists.txt b/src/cpp/mip/CMakeLists.txt new file mode 100644 index 000000000..53c44a3a3 --- /dev/null +++ b/src/cpp/mip/CMakeLists.txt @@ -0,0 +1,53 @@ +set(MIP_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/..") + +target_sources(${MIP_LIBRARY} PRIVATE + "${CMAKE_CURRENT_LIST_DIR}/mip.hpp" + "${CMAKE_CURRENT_LIST_DIR}/mip_all.hpp" + "${CMAKE_CURRENT_LIST_DIR}/mip_cmdqueue.hpp" + "${CMAKE_CURRENT_LIST_DIR}/mip_descriptors.hpp" + "${CMAKE_CURRENT_LIST_DIR}/mip_field.hpp" + "${CMAKE_CURRENT_LIST_DIR}/mip_interface.hpp" + "${CMAKE_CURRENT_LIST_DIR}/mip_interface.cpp" + "${CMAKE_CURRENT_LIST_DIR}/mip_packet.hpp" + "${CMAKE_CURRENT_LIST_DIR}/mip_parser.hpp" + "${CMAKE_CURRENT_LIST_DIR}/mip_result.hpp" + "${CMAKE_CURRENT_LIST_DIR}/mip_serialization.hpp" +) + +target_compile_features(${MIP_LIBRARY} PUBLIC cxx_std_11) +target_include_directories(${MIP_LIBRARY} PRIVATE ${MIP_INCLUDE_DIR}) + +# Get the mipdef list from the C version +get_target_property(MIP_DEFS ${MIP_LIBRARY} definitions) + +set(MIP_DEF_HEADERS ${MIP_DEFS}) +set(MIP_DEF_SOURCES ${MIP_DEFS}) +list(TRANSFORM MIP_DEF_HEADERS APPEND ".hpp") +list(TRANSFORM MIP_DEF_SOURCES APPEND ".cpp") +list(APPEND MIP_DEF_SOURCES ${MIP_DEF_HEADERS}) +list(TRANSFORM MIP_DEF_SOURCES PREPEND "${CMAKE_CURRENT_LIST_DIR}/definitions/") + +if(MICROSTRAIN_CMAKE_DEBUG) + set(INCLUDED_DEF_SOURCES ${MIP_DEF_SOURCES}) + list(TRANSFORM INCLUDED_DEF_SOURCES REPLACE "${CMAKE_CURRENT_LIST_DIR}/" "") + message("C++ definitions = ${INCLUDED_DEF_SOURCES}") +endif() + +target_sources(${MIP_LIBRARY} PRIVATE ${MIP_DEF_SOURCES}) + +if(MIP_ENABLE_METADATA) + add_subdirectory(metadata) +endif() + +if(MIP_ENABLE_EXTRAS) + add_subdirectory(extras) +endif() + +set(MIP_LIBRARIES_TMP ${MIP_LIBRARIES_TMP} PARENT_SCOPE) + +# +# Installation +# + +include(microstrain_utilities) +microstrain_setup_install_headers(${MIP_LIBRARY} ${MICROSTRAIN_SRC_DIR}) diff --git a/src/mip/definitions/commands_3dm.cpp b/src/cpp/mip/definitions/commands_3dm.cpp similarity index 50% rename from src/mip/definitions/commands_3dm.cpp rename to src/cpp/mip/definitions/commands_3dm.cpp index 477119d41..00c114c13 100644 --- a/src/mip/definitions/commands_3dm.cpp +++ b/src/cpp/mip/definitions/commands_3dm.cpp @@ -1,74 +1,65 @@ #include "commands_3dm.hpp" -#include "../utils/serialization.h" -#include "../mip_interface.h" +#include +#include #include namespace mip { -class Serializer; - namespace C { struct mip_interface; } // namespace C namespace commands_3dm { -using ::mip::insert; -using ::mip::extract; using namespace ::mip::C; //////////////////////////////////////////////////////////////////////////////// -// Shared Type Definitions +// Mip Fields //////////////////////////////////////////////////////////////////////////////// -void insert(Serializer& serializer, const NmeaMessage& self) +void NmeaMessage::insert(Serializer& serializer) const { - insert(serializer, self.message_id); + serializer.insert(message_id); - insert(serializer, self.talker_id); + serializer.insert(talker_id); - insert(serializer, self.source_desc_set); + serializer.insert(source_desc_set); - insert(serializer, self.decimation); + serializer.insert(decimation); } -void extract(Serializer& serializer, NmeaMessage& self) +void NmeaMessage::extract(Serializer& serializer) { - extract(serializer, self.message_id); + serializer.extract(message_id); - extract(serializer, self.talker_id); + serializer.extract(talker_id); - extract(serializer, self.source_desc_set); + serializer.extract(source_desc_set); - extract(serializer, self.decimation); + serializer.extract(decimation); } - -//////////////////////////////////////////////////////////////////////////////// -// Mip Fields -//////////////////////////////////////////////////////////////////////////////// - -void insert(Serializer& serializer, const PollImuMessage& self) +void PollImuMessage::insert(Serializer& serializer) const { - insert(serializer, self.suppress_ack); + serializer.insert(suppress_ack); - insert(serializer, self.num_descriptors); + serializer.insert(num_descriptors); - for(unsigned int i=0; i < self.num_descriptors; i++) - insert(serializer, self.descriptors[i]); + for(unsigned int i=0; i < num_descriptors; i++) + serializer.insert(descriptors[i]); } -void extract(Serializer& serializer, PollImuMessage& self) +void PollImuMessage::extract(Serializer& serializer) { - extract(serializer, self.suppress_ack); + serializer.extract(suppress_ack); - C::extract_count(&serializer, &self.num_descriptors, sizeof(self.descriptors)/sizeof(self.descriptors[0])); - for(unsigned int i=0; i < self.num_descriptors; i++) - extract(serializer, self.descriptors[i]); + serializer.extract_count(num_descriptors, sizeof(descriptors)/sizeof(descriptors[0])); + for(unsigned int i=0; i < num_descriptors; i++) + serializer.extract(descriptors[i]); } @@ -77,35 +68,35 @@ TypedResult pollImuMessage(C::mip_interface& device, bool suppre uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, suppressAck); + serializer.insert(suppressAck); - insert(serializer, numDescriptors); + serializer.insert(numDescriptors); assert(descriptors || (numDescriptors == 0)); for(unsigned int i=0; i < numDescriptors; i++) - insert(serializer, descriptors[i]); + serializer.insert(descriptors[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_POLL_IMU_MESSAGE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_POLL_IMU_MESSAGE, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const PollGnssMessage& self) +void PollGnssMessage::insert(Serializer& serializer) const { - insert(serializer, self.suppress_ack); + serializer.insert(suppress_ack); - insert(serializer, self.num_descriptors); + serializer.insert(num_descriptors); - for(unsigned int i=0; i < self.num_descriptors; i++) - insert(serializer, self.descriptors[i]); + for(unsigned int i=0; i < num_descriptors; i++) + serializer.insert(descriptors[i]); } -void extract(Serializer& serializer, PollGnssMessage& self) +void PollGnssMessage::extract(Serializer& serializer) { - extract(serializer, self.suppress_ack); + serializer.extract(suppress_ack); - C::extract_count(&serializer, &self.num_descriptors, sizeof(self.descriptors)/sizeof(self.descriptors[0])); - for(unsigned int i=0; i < self.num_descriptors; i++) - extract(serializer, self.descriptors[i]); + serializer.extract_count(num_descriptors, sizeof(descriptors)/sizeof(descriptors[0])); + for(unsigned int i=0; i < num_descriptors; i++) + serializer.extract(descriptors[i]); } @@ -114,35 +105,35 @@ TypedResult pollGnssMessage(C::mip_interface& device, bool supp uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, suppressAck); + serializer.insert(suppressAck); - insert(serializer, numDescriptors); + serializer.insert(numDescriptors); assert(descriptors || (numDescriptors == 0)); for(unsigned int i=0; i < numDescriptors; i++) - insert(serializer, descriptors[i]); + serializer.insert(descriptors[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_POLL_GNSS_MESSAGE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_POLL_GNSS_MESSAGE, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const PollFilterMessage& self) +void PollFilterMessage::insert(Serializer& serializer) const { - insert(serializer, self.suppress_ack); + serializer.insert(suppress_ack); - insert(serializer, self.num_descriptors); + serializer.insert(num_descriptors); - for(unsigned int i=0; i < self.num_descriptors; i++) - insert(serializer, self.descriptors[i]); + for(unsigned int i=0; i < num_descriptors; i++) + serializer.insert(descriptors[i]); } -void extract(Serializer& serializer, PollFilterMessage& self) +void PollFilterMessage::extract(Serializer& serializer) { - extract(serializer, self.suppress_ack); + serializer.extract(suppress_ack); - C::extract_count(&serializer, &self.num_descriptors, sizeof(self.descriptors)/sizeof(self.descriptors[0])); - for(unsigned int i=0; i < self.num_descriptors; i++) - extract(serializer, self.descriptors[i]); + serializer.extract_count(num_descriptors, sizeof(descriptors)/sizeof(descriptors[0])); + for(unsigned int i=0; i < num_descriptors; i++) + serializer.extract(descriptors[i]); } @@ -151,57 +142,57 @@ TypedResult pollFilterMessage(C::mip_interface& device, bool uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, suppressAck); + serializer.insert(suppressAck); - insert(serializer, numDescriptors); + serializer.insert(numDescriptors); assert(descriptors || (numDescriptors == 0)); for(unsigned int i=0; i < numDescriptors; i++) - insert(serializer, descriptors[i]); + serializer.insert(descriptors[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_POLL_FILTER_MESSAGE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_POLL_FILTER_MESSAGE, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const ImuMessageFormat& self) +void ImuMessageFormat::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.num_descriptors); + serializer.insert(num_descriptors); - for(unsigned int i=0; i < self.num_descriptors; i++) - insert(serializer, self.descriptors[i]); + for(unsigned int i=0; i < num_descriptors; i++) + serializer.insert(descriptors[i]); } } -void extract(Serializer& serializer, ImuMessageFormat& self) +void ImuMessageFormat::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - C::extract_count(&serializer, &self.num_descriptors, sizeof(self.descriptors)/sizeof(self.descriptors[0])); - for(unsigned int i=0; i < self.num_descriptors; i++) - extract(serializer, self.descriptors[i]); + serializer.extract_count(num_descriptors, sizeof(descriptors)/sizeof(descriptors[0])); + for(unsigned int i=0; i < num_descriptors; i++) + serializer.extract(descriptors[i]); } } -void insert(Serializer& serializer, const ImuMessageFormat::Response& self) +void ImuMessageFormat::Response::insert(Serializer& serializer) const { - insert(serializer, self.num_descriptors); + serializer.insert(num_descriptors); - for(unsigned int i=0; i < self.num_descriptors; i++) - insert(serializer, self.descriptors[i]); + for(unsigned int i=0; i < num_descriptors; i++) + serializer.insert(descriptors[i]); } -void extract(Serializer& serializer, ImuMessageFormat::Response& self) +void ImuMessageFormat::Response::extract(Serializer& serializer) { - C::extract_count(&serializer, &self.num_descriptors, sizeof(self.descriptors)/sizeof(self.descriptors[0])); - for(unsigned int i=0; i < self.num_descriptors; i++) - extract(serializer, self.descriptors[i]); + serializer.extract_count(num_descriptors, sizeof(descriptors)/sizeof(descriptors[0])); + for(unsigned int i=0; i < num_descriptors; i++) + serializer.extract(descriptors[i]); } @@ -210,36 +201,36 @@ TypedResult writeImuMessageFormat(C::mip_interface& device, ui uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, numDescriptors); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(numDescriptors); assert(descriptors || (numDescriptors == 0)); for(unsigned int i=0; i < numDescriptors; i++) - insert(serializer, descriptors[i]); + serializer.insert(descriptors[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_IMU_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_IMU_MESSAGE_FORMAT, buffer, (uint8_t)serializer.usedLength()); } TypedResult readImuMessageFormat(C::mip_interface& device, uint8_t* numDescriptorsOut, uint8_t numDescriptorsOutMax, DescriptorRate* descriptorsOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_IMU_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_IMU_MESSAGE_FORMAT, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_IMU_MESSAGE_FORMAT, buffer, (uint8_t)serializer.usedLength(), REPLY_IMU_MESSAGE_FORMAT, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - C::extract_count(&deserializer, numDescriptorsOut, numDescriptorsOutMax); + deserializer.extract_count(*numDescriptorsOut, numDescriptorsOutMax); assert(descriptorsOut || (numDescriptorsOut == 0)); for(unsigned int i=0; i < *numDescriptorsOut; i++) - extract(deserializer, descriptorsOut[i]); + deserializer.extract(descriptorsOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -251,70 +242,70 @@ TypedResult saveImuMessageFormat(C::mip_interface& device) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_IMU_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_IMU_MESSAGE_FORMAT, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadImuMessageFormat(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_IMU_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_IMU_MESSAGE_FORMAT, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultImuMessageFormat(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_IMU_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_IMU_MESSAGE_FORMAT, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const GpsMessageFormat& self) +void GpsMessageFormat::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.num_descriptors); + serializer.insert(num_descriptors); - for(unsigned int i=0; i < self.num_descriptors; i++) - insert(serializer, self.descriptors[i]); + for(unsigned int i=0; i < num_descriptors; i++) + serializer.insert(descriptors[i]); } } -void extract(Serializer& serializer, GpsMessageFormat& self) +void GpsMessageFormat::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - C::extract_count(&serializer, &self.num_descriptors, sizeof(self.descriptors)/sizeof(self.descriptors[0])); - for(unsigned int i=0; i < self.num_descriptors; i++) - extract(serializer, self.descriptors[i]); + serializer.extract_count(num_descriptors, sizeof(descriptors)/sizeof(descriptors[0])); + for(unsigned int i=0; i < num_descriptors; i++) + serializer.extract(descriptors[i]); } } -void insert(Serializer& serializer, const GpsMessageFormat::Response& self) +void GpsMessageFormat::Response::insert(Serializer& serializer) const { - insert(serializer, self.num_descriptors); + serializer.insert(num_descriptors); - for(unsigned int i=0; i < self.num_descriptors; i++) - insert(serializer, self.descriptors[i]); + for(unsigned int i=0; i < num_descriptors; i++) + serializer.insert(descriptors[i]); } -void extract(Serializer& serializer, GpsMessageFormat::Response& self) +void GpsMessageFormat::Response::extract(Serializer& serializer) { - C::extract_count(&serializer, &self.num_descriptors, sizeof(self.descriptors)/sizeof(self.descriptors[0])); - for(unsigned int i=0; i < self.num_descriptors; i++) - extract(serializer, self.descriptors[i]); + serializer.extract_count(num_descriptors, sizeof(descriptors)/sizeof(descriptors[0])); + for(unsigned int i=0; i < num_descriptors; i++) + serializer.extract(descriptors[i]); } @@ -323,36 +314,36 @@ TypedResult writeGpsMessageFormat(C::mip_interface& device, ui uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, numDescriptors); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(numDescriptors); assert(descriptors || (numDescriptors == 0)); for(unsigned int i=0; i < numDescriptors; i++) - insert(serializer, descriptors[i]); + serializer.insert(descriptors[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_MESSAGE_FORMAT, buffer, (uint8_t)serializer.usedLength()); } TypedResult readGpsMessageFormat(C::mip_interface& device, uint8_t* numDescriptorsOut, uint8_t numDescriptorsOutMax, DescriptorRate* descriptorsOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_GNSS_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_GNSS_MESSAGE_FORMAT, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_GNSS_MESSAGE_FORMAT, buffer, (uint8_t)serializer.usedLength(), REPLY_GNSS_MESSAGE_FORMAT, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - C::extract_count(&deserializer, numDescriptorsOut, numDescriptorsOutMax); + deserializer.extract_count(*numDescriptorsOut, numDescriptorsOutMax); assert(descriptorsOut || (numDescriptorsOut == 0)); for(unsigned int i=0; i < *numDescriptorsOut; i++) - extract(deserializer, descriptorsOut[i]); + deserializer.extract(descriptorsOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -364,70 +355,70 @@ TypedResult saveGpsMessageFormat(C::mip_interface& device) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_MESSAGE_FORMAT, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadGpsMessageFormat(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_MESSAGE_FORMAT, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultGpsMessageFormat(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_MESSAGE_FORMAT, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const FilterMessageFormat& self) +void FilterMessageFormat::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.num_descriptors); + serializer.insert(num_descriptors); - for(unsigned int i=0; i < self.num_descriptors; i++) - insert(serializer, self.descriptors[i]); + for(unsigned int i=0; i < num_descriptors; i++) + serializer.insert(descriptors[i]); } } -void extract(Serializer& serializer, FilterMessageFormat& self) +void FilterMessageFormat::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - C::extract_count(&serializer, &self.num_descriptors, sizeof(self.descriptors)/sizeof(self.descriptors[0])); - for(unsigned int i=0; i < self.num_descriptors; i++) - extract(serializer, self.descriptors[i]); + serializer.extract_count(num_descriptors, sizeof(descriptors)/sizeof(descriptors[0])); + for(unsigned int i=0; i < num_descriptors; i++) + serializer.extract(descriptors[i]); } } -void insert(Serializer& serializer, const FilterMessageFormat::Response& self) +void FilterMessageFormat::Response::insert(Serializer& serializer) const { - insert(serializer, self.num_descriptors); + serializer.insert(num_descriptors); - for(unsigned int i=0; i < self.num_descriptors; i++) - insert(serializer, self.descriptors[i]); + for(unsigned int i=0; i < num_descriptors; i++) + serializer.insert(descriptors[i]); } -void extract(Serializer& serializer, FilterMessageFormat::Response& self) +void FilterMessageFormat::Response::extract(Serializer& serializer) { - C::extract_count(&serializer, &self.num_descriptors, sizeof(self.descriptors)/sizeof(self.descriptors[0])); - for(unsigned int i=0; i < self.num_descriptors; i++) - extract(serializer, self.descriptors[i]); + serializer.extract_count(num_descriptors, sizeof(descriptors)/sizeof(descriptors[0])); + for(unsigned int i=0; i < num_descriptors; i++) + serializer.extract(descriptors[i]); } @@ -436,36 +427,36 @@ TypedResult writeFilterMessageFormat(C::mip_interface& devi uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, numDescriptors); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(numDescriptors); assert(descriptors || (numDescriptors == 0)); for(unsigned int i=0; i < numDescriptors; i++) - insert(serializer, descriptors[i]); + serializer.insert(descriptors[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_FILTER_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_FILTER_MESSAGE_FORMAT, buffer, (uint8_t)serializer.usedLength()); } TypedResult readFilterMessageFormat(C::mip_interface& device, uint8_t* numDescriptorsOut, uint8_t numDescriptorsOutMax, DescriptorRate* descriptorsOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_FILTER_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_FILTER_MESSAGE_FORMAT, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_FILTER_MESSAGE_FORMAT, buffer, (uint8_t)serializer.usedLength(), REPLY_FILTER_MESSAGE_FORMAT, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - C::extract_count(&deserializer, numDescriptorsOut, numDescriptorsOutMax); + deserializer.extract_count(*numDescriptorsOut, numDescriptorsOutMax); assert(descriptorsOut || (numDescriptorsOut == 0)); for(unsigned int i=0; i < *numDescriptorsOut; i++) - extract(deserializer, descriptorsOut[i]); + deserializer.extract(descriptorsOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -477,50 +468,48 @@ TypedResult saveFilterMessageFormat(C::mip_interface& devic uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_FILTER_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_FILTER_MESSAGE_FORMAT, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadFilterMessageFormat(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_FILTER_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_FILTER_MESSAGE_FORMAT, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultFilterMessageFormat(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_FILTER_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_FILTER_MESSAGE_FORMAT, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const ImuGetBaseRate& self) +void ImuGetBaseRate::insert(Serializer& serializer) const { (void)serializer; - (void)self; } -void extract(Serializer& serializer, ImuGetBaseRate& self) +void ImuGetBaseRate::extract(Serializer& serializer) { (void)serializer; - (void)self; } -void insert(Serializer& serializer, const ImuGetBaseRate::Response& self) +void ImuGetBaseRate::Response::insert(Serializer& serializer) const { - insert(serializer, self.rate); + serializer.insert(rate); } -void extract(Serializer& serializer, ImuGetBaseRate::Response& self) +void ImuGetBaseRate::Response::extract(Serializer& serializer) { - extract(serializer, self.rate); + serializer.extract(rate); } @@ -536,32 +525,30 @@ TypedResult imuGetBaseRate(C::mip_interface& device, uint16_t* r Serializer deserializer(buffer, responseLength); assert(rateOut); - extract(deserializer, *rateOut); + deserializer.extract(*rateOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; } return result; } -void insert(Serializer& serializer, const GpsGetBaseRate& self) +void GpsGetBaseRate::insert(Serializer& serializer) const { (void)serializer; - (void)self; } -void extract(Serializer& serializer, GpsGetBaseRate& self) +void GpsGetBaseRate::extract(Serializer& serializer) { (void)serializer; - (void)self; } -void insert(Serializer& serializer, const GpsGetBaseRate::Response& self) +void GpsGetBaseRate::Response::insert(Serializer& serializer) const { - insert(serializer, self.rate); + serializer.insert(rate); } -void extract(Serializer& serializer, GpsGetBaseRate::Response& self) +void GpsGetBaseRate::Response::extract(Serializer& serializer) { - extract(serializer, self.rate); + serializer.extract(rate); } @@ -577,32 +564,30 @@ TypedResult gpsGetBaseRate(C::mip_interface& device, uint16_t* r Serializer deserializer(buffer, responseLength); assert(rateOut); - extract(deserializer, *rateOut); + deserializer.extract(*rateOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; } return result; } -void insert(Serializer& serializer, const FilterGetBaseRate& self) +void FilterGetBaseRate::insert(Serializer& serializer) const { (void)serializer; - (void)self; } -void extract(Serializer& serializer, FilterGetBaseRate& self) +void FilterGetBaseRate::extract(Serializer& serializer) { (void)serializer; - (void)self; } -void insert(Serializer& serializer, const FilterGetBaseRate::Response& self) +void FilterGetBaseRate::Response::insert(Serializer& serializer) const { - insert(serializer, self.rate); + serializer.insert(rate); } -void extract(Serializer& serializer, FilterGetBaseRate::Response& self) +void FilterGetBaseRate::Response::extract(Serializer& serializer) { - extract(serializer, self.rate); + serializer.extract(rate); } @@ -618,34 +603,34 @@ TypedResult filterGetBaseRate(C::mip_interface& device, uint1 Serializer deserializer(buffer, responseLength); assert(rateOut); - extract(deserializer, *rateOut); + deserializer.extract(*rateOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; } return result; } -void insert(Serializer& serializer, const PollData& self) +void PollData::insert(Serializer& serializer) const { - insert(serializer, self.desc_set); + serializer.insert(desc_set); - insert(serializer, self.suppress_ack); + serializer.insert(suppress_ack); - insert(serializer, self.num_descriptors); + serializer.insert(num_descriptors); - for(unsigned int i=0; i < self.num_descriptors; i++) - insert(serializer, self.descriptors[i]); + for(unsigned int i=0; i < num_descriptors; i++) + serializer.insert(descriptors[i]); } -void extract(Serializer& serializer, PollData& self) +void PollData::extract(Serializer& serializer) { - extract(serializer, self.desc_set); + serializer.extract(desc_set); - extract(serializer, self.suppress_ack); + serializer.extract(suppress_ack); - C::extract_count(&serializer, &self.num_descriptors, sizeof(self.descriptors)/sizeof(self.descriptors[0])); - for(unsigned int i=0; i < self.num_descriptors; i++) - extract(serializer, self.descriptors[i]); + serializer.extract_count(num_descriptors, sizeof(descriptors)/sizeof(descriptors[0])); + for(unsigned int i=0; i < num_descriptors; i++) + serializer.extract(descriptors[i]); } @@ -654,43 +639,43 @@ TypedResult pollData(C::mip_interface& device, uint8_t descSet, bool s uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, descSet); + serializer.insert(descSet); - insert(serializer, suppressAck); + serializer.insert(suppressAck); - insert(serializer, numDescriptors); + serializer.insert(numDescriptors); assert(descriptors || (numDescriptors == 0)); for(unsigned int i=0; i < numDescriptors; i++) - insert(serializer, descriptors[i]); + serializer.insert(descriptors[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_POLL_DATA, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_POLL_DATA, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const GetBaseRate& self) +void GetBaseRate::insert(Serializer& serializer) const { - insert(serializer, self.desc_set); + serializer.insert(desc_set); } -void extract(Serializer& serializer, GetBaseRate& self) +void GetBaseRate::extract(Serializer& serializer) { - extract(serializer, self.desc_set); + serializer.extract(desc_set); } -void insert(Serializer& serializer, const GetBaseRate::Response& self) +void GetBaseRate::Response::insert(Serializer& serializer) const { - insert(serializer, self.desc_set); + serializer.insert(desc_set); - insert(serializer, self.rate); + serializer.insert(rate); } -void extract(Serializer& serializer, GetBaseRate::Response& self) +void GetBaseRate::Response::extract(Serializer& serializer) { - extract(serializer, self.desc_set); + serializer.extract(desc_set); - extract(serializer, self.rate); + serializer.extract(rate); } @@ -699,74 +684,74 @@ TypedResult getBaseRate(C::mip_interface& device, uint8_t descSet, uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, descSet); + serializer.insert(descSet); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_GET_BASE_RATE, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_BASE_RATE, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_GET_BASE_RATE, buffer, (uint8_t)serializer.usedLength(), REPLY_BASE_RATE, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - extract(deserializer, descSet); + deserializer.extract(descSet); assert(rateOut); - extract(deserializer, *rateOut); + deserializer.extract(*rateOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; } return result; } -void insert(Serializer& serializer, const MessageFormat& self) +void MessageFormat::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - insert(serializer, self.desc_set); + serializer.insert(desc_set); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.num_descriptors); + serializer.insert(num_descriptors); - for(unsigned int i=0; i < self.num_descriptors; i++) - insert(serializer, self.descriptors[i]); + for(unsigned int i=0; i < num_descriptors; i++) + serializer.insert(descriptors[i]); } } -void extract(Serializer& serializer, MessageFormat& self) +void MessageFormat::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - extract(serializer, self.desc_set); + serializer.extract(desc_set); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - C::extract_count(&serializer, &self.num_descriptors, sizeof(self.descriptors)/sizeof(self.descriptors[0])); - for(unsigned int i=0; i < self.num_descriptors; i++) - extract(serializer, self.descriptors[i]); + serializer.extract_count(num_descriptors, sizeof(descriptors)/sizeof(descriptors[0])); + for(unsigned int i=0; i < num_descriptors; i++) + serializer.extract(descriptors[i]); } } -void insert(Serializer& serializer, const MessageFormat::Response& self) +void MessageFormat::Response::insert(Serializer& serializer) const { - insert(serializer, self.desc_set); + serializer.insert(desc_set); - insert(serializer, self.num_descriptors); + serializer.insert(num_descriptors); - for(unsigned int i=0; i < self.num_descriptors; i++) - insert(serializer, self.descriptors[i]); + for(unsigned int i=0; i < num_descriptors; i++) + serializer.insert(descriptors[i]); } -void extract(Serializer& serializer, MessageFormat::Response& self) +void MessageFormat::Response::extract(Serializer& serializer) { - extract(serializer, self.desc_set); + serializer.extract(desc_set); - C::extract_count(&serializer, &self.num_descriptors, sizeof(self.descriptors)/sizeof(self.descriptors[0])); - for(unsigned int i=0; i < self.num_descriptors; i++) - extract(serializer, self.descriptors[i]); + serializer.extract_count(num_descriptors, sizeof(descriptors)/sizeof(descriptors[0])); + for(unsigned int i=0; i < num_descriptors; i++) + serializer.extract(descriptors[i]); } @@ -775,42 +760,42 @@ TypedResult writeMessageFormat(C::mip_interface& device, uint8_t uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, descSet); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(descSet); - insert(serializer, numDescriptors); + serializer.insert(numDescriptors); assert(descriptors || (numDescriptors == 0)); for(unsigned int i=0; i < numDescriptors; i++) - insert(serializer, descriptors[i]); + serializer.insert(descriptors[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MESSAGE_FORMAT, buffer, (uint8_t)serializer.usedLength()); } TypedResult readMessageFormat(C::mip_interface& device, uint8_t descSet, uint8_t* numDescriptorsOut, uint8_t numDescriptorsOutMax, DescriptorRate* descriptorsOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); - insert(serializer, descSet); + serializer.insert(FunctionSelector::READ); + serializer.insert(descSet); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_MESSAGE_FORMAT, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_MESSAGE_FORMAT, buffer, (uint8_t)serializer.usedLength(), REPLY_MESSAGE_FORMAT, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - extract(deserializer, descSet); + deserializer.extract(descSet); - C::extract_count(&deserializer, numDescriptorsOut, numDescriptorsOutMax); + deserializer.extract_count(*numDescriptorsOut, numDescriptorsOutMax); assert(descriptorsOut || (numDescriptorsOut == 0)); for(unsigned int i=0; i < *numDescriptorsOut; i++) - extract(deserializer, descriptorsOut[i]); + deserializer.extract(descriptorsOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -822,54 +807,54 @@ TypedResult saveMessageFormat(C::mip_interface& device, uint8_t d uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); - insert(serializer, descSet); + serializer.insert(FunctionSelector::SAVE); + serializer.insert(descSet); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MESSAGE_FORMAT, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadMessageFormat(C::mip_interface& device, uint8_t descSet) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); - insert(serializer, descSet); + serializer.insert(FunctionSelector::LOAD); + serializer.insert(descSet); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MESSAGE_FORMAT, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultMessageFormat(C::mip_interface& device, uint8_t descSet) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); - insert(serializer, descSet); + serializer.insert(FunctionSelector::RESET); + serializer.insert(descSet); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MESSAGE_FORMAT, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const NmeaPollData& self) +void NmeaPollData::insert(Serializer& serializer) const { - insert(serializer, self.suppress_ack); + serializer.insert(suppress_ack); - insert(serializer, self.count); + serializer.insert(count); - for(unsigned int i=0; i < self.count; i++) - insert(serializer, self.format_entries[i]); + for(unsigned int i=0; i < count; i++) + serializer.insert(format_entries[i]); } -void extract(Serializer& serializer, NmeaPollData& self) +void NmeaPollData::extract(Serializer& serializer) { - extract(serializer, self.suppress_ack); + serializer.extract(suppress_ack); - C::extract_count(&serializer, &self.count, sizeof(self.format_entries)/sizeof(self.format_entries[0])); - for(unsigned int i=0; i < self.count; i++) - extract(serializer, self.format_entries[i]); + serializer.extract_count(count, sizeof(format_entries)/sizeof(format_entries[0])); + for(unsigned int i=0; i < count; i++) + serializer.extract(format_entries[i]); } @@ -878,57 +863,57 @@ TypedResult nmeaPollData(C::mip_interface& device, bool suppressAc uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, suppressAck); + serializer.insert(suppressAck); - insert(serializer, count); + serializer.insert(count); assert(formatEntries || (count == 0)); for(unsigned int i=0; i < count; i++) - insert(serializer, formatEntries[i]); + serializer.insert(formatEntries[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_POLL_NMEA_MESSAGE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_POLL_NMEA_MESSAGE, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const NmeaMessageFormat& self) +void NmeaMessageFormat::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.count); + serializer.insert(count); - for(unsigned int i=0; i < self.count; i++) - insert(serializer, self.format_entries[i]); + for(unsigned int i=0; i < count; i++) + serializer.insert(format_entries[i]); } } -void extract(Serializer& serializer, NmeaMessageFormat& self) +void NmeaMessageFormat::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - C::extract_count(&serializer, &self.count, sizeof(self.format_entries)/sizeof(self.format_entries[0])); - for(unsigned int i=0; i < self.count; i++) - extract(serializer, self.format_entries[i]); + serializer.extract_count(count, sizeof(format_entries)/sizeof(format_entries[0])); + for(unsigned int i=0; i < count; i++) + serializer.extract(format_entries[i]); } } -void insert(Serializer& serializer, const NmeaMessageFormat::Response& self) +void NmeaMessageFormat::Response::insert(Serializer& serializer) const { - insert(serializer, self.count); + serializer.insert(count); - for(unsigned int i=0; i < self.count; i++) - insert(serializer, self.format_entries[i]); + for(unsigned int i=0; i < count; i++) + serializer.insert(format_entries[i]); } -void extract(Serializer& serializer, NmeaMessageFormat::Response& self) +void NmeaMessageFormat::Response::extract(Serializer& serializer) { - C::extract_count(&serializer, &self.count, sizeof(self.format_entries)/sizeof(self.format_entries[0])); - for(unsigned int i=0; i < self.count; i++) - extract(serializer, self.format_entries[i]); + serializer.extract_count(count, sizeof(format_entries)/sizeof(format_entries[0])); + for(unsigned int i=0; i < count; i++) + serializer.extract(format_entries[i]); } @@ -937,36 +922,36 @@ TypedResult writeNmeaMessageFormat(C::mip_interface& device, uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, count); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(count); assert(formatEntries || (count == 0)); for(unsigned int i=0; i < count; i++) - insert(serializer, formatEntries[i]); + serializer.insert(formatEntries[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_NMEA_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_NMEA_MESSAGE_FORMAT, buffer, (uint8_t)serializer.usedLength()); } TypedResult readNmeaMessageFormat(C::mip_interface& device, uint8_t* countOut, uint8_t countOutMax, NmeaMessage* formatEntriesOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_NMEA_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_NMEA_MESSAGE_FORMAT, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_NMEA_MESSAGE_FORMAT, buffer, (uint8_t)serializer.usedLength(), REPLY_NMEA_MESSAGE_FORMAT, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - C::extract_count(&deserializer, countOut, countOutMax); + deserializer.extract_count(*countOut, countOutMax); assert(formatEntriesOut || (countOut == 0)); for(unsigned int i=0; i < *countOut; i++) - extract(deserializer, formatEntriesOut[i]); + deserializer.extract(formatEntriesOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -978,39 +963,39 @@ TypedResult saveNmeaMessageFormat(C::mip_interface& device) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_NMEA_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_NMEA_MESSAGE_FORMAT, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadNmeaMessageFormat(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_NMEA_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_NMEA_MESSAGE_FORMAT, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultNmeaMessageFormat(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_NMEA_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_NMEA_MESSAGE_FORMAT, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const DeviceSettings& self) +void DeviceSettings::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); } -void extract(Serializer& serializer, DeviceSettings& self) +void DeviceSettings::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); } @@ -1019,60 +1004,60 @@ TypedResult saveDeviceSettings(C::mip_interface& device) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_DEVICE_STARTUP_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_DEVICE_STARTUP_SETTINGS, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadDeviceSettings(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_DEVICE_STARTUP_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_DEVICE_STARTUP_SETTINGS, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultDeviceSettings(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_DEVICE_STARTUP_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_DEVICE_STARTUP_SETTINGS, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const UartBaudrate& self) +void UartBaudrate::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.baud); + serializer.insert(baud); } } -void extract(Serializer& serializer, UartBaudrate& self) +void UartBaudrate::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.baud); + serializer.extract(baud); } } -void insert(Serializer& serializer, const UartBaudrate::Response& self) +void UartBaudrate::Response::insert(Serializer& serializer) const { - insert(serializer, self.baud); + serializer.insert(baud); } -void extract(Serializer& serializer, UartBaudrate::Response& self) +void UartBaudrate::Response::extract(Serializer& serializer) { - extract(serializer, self.baud); + serializer.extract(baud); } @@ -1081,30 +1066,30 @@ TypedResult writeUartBaudrate(C::mip_interface& device, uint32_t b uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, baud); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(baud); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_UART_BAUDRATE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_UART_BAUDRATE, buffer, (uint8_t)serializer.usedLength()); } TypedResult readUartBaudrate(C::mip_interface& device, uint32_t* baudOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_UART_BAUDRATE, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_UART_BAUDRATE, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_UART_BAUDRATE, buffer, (uint8_t)serializer.usedLength(), REPLY_UART_BAUDRATE, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(baudOut); - extract(deserializer, *baudOut); + deserializer.extract(*baudOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -1116,43 +1101,43 @@ TypedResult saveUartBaudrate(C::mip_interface& device) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_UART_BAUDRATE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_UART_BAUDRATE, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadUartBaudrate(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_UART_BAUDRATE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_UART_BAUDRATE, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultUartBaudrate(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_UART_BAUDRATE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_UART_BAUDRATE, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const FactoryStreaming& self) +void FactoryStreaming::insert(Serializer& serializer) const { - insert(serializer, self.action); + serializer.insert(action); - insert(serializer, self.reserved); + serializer.insert(reserved); } -void extract(Serializer& serializer, FactoryStreaming& self) +void FactoryStreaming::extract(Serializer& serializer) { - extract(serializer, self.action); + serializer.extract(action); - extract(serializer, self.reserved); + serializer.extract(reserved); } @@ -1161,51 +1146,51 @@ TypedResult factoryStreaming(C::mip_interface& device, Factory uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, action); + serializer.insert(action); - insert(serializer, reserved); + serializer.insert(reserved); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_CONFIGURE_FACTORY_STREAMING, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_CONFIGURE_FACTORY_STREAMING, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const DatastreamControl& self) +void DatastreamControl::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - insert(serializer, self.desc_set); + serializer.insert(desc_set); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.enable); + serializer.insert(enable); } } -void extract(Serializer& serializer, DatastreamControl& self) +void DatastreamControl::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - extract(serializer, self.desc_set); + serializer.extract(desc_set); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.enable); + serializer.extract(enable); } } -void insert(Serializer& serializer, const DatastreamControl::Response& self) +void DatastreamControl::Response::insert(Serializer& serializer) const { - insert(serializer, self.desc_set); + serializer.insert(desc_set); - insert(serializer, self.enabled); + serializer.insert(enabled); } -void extract(Serializer& serializer, DatastreamControl::Response& self) +void DatastreamControl::Response::extract(Serializer& serializer) { - extract(serializer, self.desc_set); + serializer.extract(desc_set); - extract(serializer, self.enabled); + serializer.extract(enabled); } @@ -1214,36 +1199,36 @@ TypedResult writeDatastreamControl(C::mip_interface& device, uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, descSet); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(descSet); - insert(serializer, enable); + serializer.insert(enable); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_CONTROL_DATA_STREAM, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_CONTROL_DATA_STREAM, buffer, (uint8_t)serializer.usedLength()); } TypedResult readDatastreamControl(C::mip_interface& device, uint8_t descSet, bool* enabledOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); - insert(serializer, descSet); + serializer.insert(FunctionSelector::READ); + serializer.insert(descSet); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_CONTROL_DATA_STREAM, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_DATASTREAM_ENABLE, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_CONTROL_DATA_STREAM, buffer, (uint8_t)serializer.usedLength(), REPLY_DATASTREAM_ENABLE, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - extract(deserializer, descSet); + deserializer.extract(descSet); assert(enabledOut); - extract(deserializer, *enabledOut); + deserializer.extract(*enabledOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -1255,115 +1240,115 @@ TypedResult saveDatastreamControl(C::mip_interface& device, u uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); - insert(serializer, descSet); + serializer.insert(FunctionSelector::SAVE); + serializer.insert(descSet); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_CONTROL_DATA_STREAM, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_CONTROL_DATA_STREAM, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadDatastreamControl(C::mip_interface& device, uint8_t descSet) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); - insert(serializer, descSet); + serializer.insert(FunctionSelector::LOAD); + serializer.insert(descSet); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_CONTROL_DATA_STREAM, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_CONTROL_DATA_STREAM, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultDatastreamControl(C::mip_interface& device, uint8_t descSet) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); - insert(serializer, descSet); + serializer.insert(FunctionSelector::RESET); + serializer.insert(descSet); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_CONTROL_DATA_STREAM, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_CONTROL_DATA_STREAM, buffer, (uint8_t)serializer.usedLength()); +} +void ConstellationSettings::Settings::insert(Serializer& serializer) const +{ + serializer.insert(constellation_id); + + serializer.insert(enable); + + serializer.insert(reserved_channels); + + serializer.insert(max_channels); + + serializer.insert(option_flags); + +} +void ConstellationSettings::Settings::extract(Serializer& serializer) +{ + serializer.extract(constellation_id); + + serializer.extract(enable); + + serializer.extract(reserved_channels); + + serializer.extract(max_channels); + + serializer.extract(option_flags); + } -void insert(Serializer& serializer, const ConstellationSettings& self) + +void ConstellationSettings::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.max_channels); + serializer.insert(max_channels); - insert(serializer, self.config_count); + serializer.insert(config_count); - for(unsigned int i=0; i < self.config_count; i++) - insert(serializer, self.settings[i]); + for(unsigned int i=0; i < config_count; i++) + serializer.insert(settings[i]); } } -void extract(Serializer& serializer, ConstellationSettings& self) +void ConstellationSettings::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.max_channels); + serializer.extract(max_channels); - C::extract_count(&serializer, &self.config_count, sizeof(self.settings)/sizeof(self.settings[0])); - for(unsigned int i=0; i < self.config_count; i++) - extract(serializer, self.settings[i]); + serializer.extract_count(config_count, sizeof(settings)/sizeof(settings[0])); + for(unsigned int i=0; i < config_count; i++) + serializer.extract(settings[i]); } } -void insert(Serializer& serializer, const ConstellationSettings::Response& self) -{ - insert(serializer, self.max_channels_available); - - insert(serializer, self.max_channels_use); - - insert(serializer, self.config_count); - - for(unsigned int i=0; i < self.config_count; i++) - insert(serializer, self.settings[i]); - -} -void extract(Serializer& serializer, ConstellationSettings::Response& self) -{ - extract(serializer, self.max_channels_available); - - extract(serializer, self.max_channels_use); - - C::extract_count(&serializer, &self.config_count, sizeof(self.settings)/sizeof(self.settings[0])); - for(unsigned int i=0; i < self.config_count; i++) - extract(serializer, self.settings[i]); - -} - -void insert(Serializer& serializer, const ConstellationSettings::Settings& self) +void ConstellationSettings::Response::insert(Serializer& serializer) const { - insert(serializer, self.constellation_id); - - insert(serializer, self.enable); + serializer.insert(max_channels_available); - insert(serializer, self.reserved_channels); + serializer.insert(max_channels_use); - insert(serializer, self.max_channels); + serializer.insert(config_count); - insert(serializer, self.option_flags); + for(unsigned int i=0; i < config_count; i++) + serializer.insert(settings[i]); } -void extract(Serializer& serializer, ConstellationSettings::Settings& self) +void ConstellationSettings::Response::extract(Serializer& serializer) { - extract(serializer, self.constellation_id); + serializer.extract(max_channels_available); - extract(serializer, self.enable); + serializer.extract(max_channels_use); - extract(serializer, self.reserved_channels); - - extract(serializer, self.max_channels); - - extract(serializer, self.option_flags); + serializer.extract_count(config_count, sizeof(settings)/sizeof(settings[0])); + for(unsigned int i=0; i < config_count; i++) + serializer.extract(settings[i]); } @@ -1372,44 +1357,44 @@ TypedResult writeConstellationSettings(C::mip_interface& uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, maxChannels); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(maxChannels); - insert(serializer, configCount); + serializer.insert(configCount); assert(settings || (configCount == 0)); for(unsigned int i=0; i < configCount; i++) - insert(serializer, settings[i]); + serializer.insert(settings[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_CONSTELLATION_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_CONSTELLATION_SETTINGS, buffer, (uint8_t)serializer.usedLength()); } TypedResult readConstellationSettings(C::mip_interface& device, uint16_t* maxChannelsAvailableOut, uint16_t* maxChannelsUseOut, uint8_t* configCountOut, uint8_t configCountOutMax, ConstellationSettings::Settings* settingsOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_GNSS_CONSTELLATION_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_GNSS_CONSTELLATION_SETTINGS, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_GNSS_CONSTELLATION_SETTINGS, buffer, (uint8_t)serializer.usedLength(), REPLY_GNSS_CONSTELLATION_SETTINGS, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(maxChannelsAvailableOut); - extract(deserializer, *maxChannelsAvailableOut); + deserializer.extract(*maxChannelsAvailableOut); assert(maxChannelsUseOut); - extract(deserializer, *maxChannelsUseOut); + deserializer.extract(*maxChannelsUseOut); - C::extract_count(&deserializer, configCountOut, configCountOutMax); + deserializer.extract_count(*configCountOut, configCountOutMax); assert(settingsOut || (configCountOut == 0)); for(unsigned int i=0; i < *configCountOut; i++) - extract(deserializer, settingsOut[i]); + deserializer.extract(settingsOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -1421,86 +1406,86 @@ TypedResult saveConstellationSettings(C::mip_interface& d uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_CONSTELLATION_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_CONSTELLATION_SETTINGS, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadConstellationSettings(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_CONSTELLATION_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_CONSTELLATION_SETTINGS, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultConstellationSettings(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_CONSTELLATION_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_CONSTELLATION_SETTINGS, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const GnssSbasSettings& self) +void GnssSbasSettings::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.enable_sbas); + serializer.insert(enable_sbas); - insert(serializer, self.sbas_options); + serializer.insert(sbas_options); - insert(serializer, self.num_included_prns); + serializer.insert(num_included_prns); - for(unsigned int i=0; i < self.num_included_prns; i++) - insert(serializer, self.included_prns[i]); + for(unsigned int i=0; i < num_included_prns; i++) + serializer.insert(included_prns[i]); } } -void extract(Serializer& serializer, GnssSbasSettings& self) +void GnssSbasSettings::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.enable_sbas); + serializer.extract(enable_sbas); - extract(serializer, self.sbas_options); + serializer.extract(sbas_options); - C::extract_count(&serializer, &self.num_included_prns, sizeof(self.included_prns)/sizeof(self.included_prns[0])); - for(unsigned int i=0; i < self.num_included_prns; i++) - extract(serializer, self.included_prns[i]); + serializer.extract_count(num_included_prns, sizeof(included_prns)/sizeof(included_prns[0])); + for(unsigned int i=0; i < num_included_prns; i++) + serializer.extract(included_prns[i]); } } -void insert(Serializer& serializer, const GnssSbasSettings::Response& self) +void GnssSbasSettings::Response::insert(Serializer& serializer) const { - insert(serializer, self.enable_sbas); + serializer.insert(enable_sbas); - insert(serializer, self.sbas_options); + serializer.insert(sbas_options); - insert(serializer, self.num_included_prns); + serializer.insert(num_included_prns); - for(unsigned int i=0; i < self.num_included_prns; i++) - insert(serializer, self.included_prns[i]); + for(unsigned int i=0; i < num_included_prns; i++) + serializer.insert(included_prns[i]); } -void extract(Serializer& serializer, GnssSbasSettings::Response& self) +void GnssSbasSettings::Response::extract(Serializer& serializer) { - extract(serializer, self.enable_sbas); + serializer.extract(enable_sbas); - extract(serializer, self.sbas_options); + serializer.extract(sbas_options); - C::extract_count(&serializer, &self.num_included_prns, sizeof(self.included_prns)/sizeof(self.included_prns[0])); - for(unsigned int i=0; i < self.num_included_prns; i++) - extract(serializer, self.included_prns[i]); + serializer.extract_count(num_included_prns, sizeof(included_prns)/sizeof(included_prns[0])); + for(unsigned int i=0; i < num_included_prns; i++) + serializer.extract(included_prns[i]); } @@ -1509,46 +1494,46 @@ TypedResult writeGnssSbasSettings(C::mip_interface& device, ui uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, enableSbas); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(enableSbas); - insert(serializer, sbasOptions); + serializer.insert(sbasOptions); - insert(serializer, numIncludedPrns); + serializer.insert(numIncludedPrns); assert(includedPrns || (numIncludedPrns == 0)); for(unsigned int i=0; i < numIncludedPrns; i++) - insert(serializer, includedPrns[i]); + serializer.insert(includedPrns[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_SBAS_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_SBAS_SETTINGS, buffer, (uint8_t)serializer.usedLength()); } TypedResult readGnssSbasSettings(C::mip_interface& device, uint8_t* enableSbasOut, GnssSbasSettings::SBASOptions* sbasOptionsOut, uint8_t* numIncludedPrnsOut, uint8_t numIncludedPrnsOutMax, uint16_t* includedPrnsOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_GNSS_SBAS_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_GNSS_SBAS_SETTINGS, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_GNSS_SBAS_SETTINGS, buffer, (uint8_t)serializer.usedLength(), REPLY_GNSS_SBAS_SETTINGS, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(enableSbasOut); - extract(deserializer, *enableSbasOut); + deserializer.extract(*enableSbasOut); assert(sbasOptionsOut); - extract(deserializer, *sbasOptionsOut); + deserializer.extract(*sbasOptionsOut); - C::extract_count(&deserializer, numIncludedPrnsOut, numIncludedPrnsOutMax); + deserializer.extract_count(*numIncludedPrnsOut, numIncludedPrnsOutMax); assert(includedPrnsOut || (numIncludedPrnsOut == 0)); for(unsigned int i=0; i < *numIncludedPrnsOut; i++) - extract(deserializer, includedPrnsOut[i]); + deserializer.extract(includedPrnsOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -1560,68 +1545,68 @@ TypedResult saveGnssSbasSettings(C::mip_interface& device) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_SBAS_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_SBAS_SETTINGS, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadGnssSbasSettings(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_SBAS_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_SBAS_SETTINGS, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultGnssSbasSettings(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_SBAS_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_SBAS_SETTINGS, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const GnssAssistedFix& self) +void GnssAssistedFix::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.option); + serializer.insert(option); - insert(serializer, self.flags); + serializer.insert(flags); } } -void extract(Serializer& serializer, GnssAssistedFix& self) +void GnssAssistedFix::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.option); + serializer.extract(option); - extract(serializer, self.flags); + serializer.extract(flags); } } -void insert(Serializer& serializer, const GnssAssistedFix::Response& self) +void GnssAssistedFix::Response::insert(Serializer& serializer) const { - insert(serializer, self.option); + serializer.insert(option); - insert(serializer, self.flags); + serializer.insert(flags); } -void extract(Serializer& serializer, GnssAssistedFix::Response& self) +void GnssAssistedFix::Response::extract(Serializer& serializer) { - extract(serializer, self.option); + serializer.extract(option); - extract(serializer, self.flags); + serializer.extract(flags); } @@ -1630,35 +1615,35 @@ TypedResult writeGnssAssistedFix(C::mip_interface& device, Gnss uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, option); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(option); - insert(serializer, flags); + serializer.insert(flags); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_ASSISTED_FIX_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_ASSISTED_FIX_SETTINGS, buffer, (uint8_t)serializer.usedLength()); } TypedResult readGnssAssistedFix(C::mip_interface& device, GnssAssistedFix::AssistedFixOption* optionOut, uint8_t* flagsOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_GNSS_ASSISTED_FIX_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_GNSS_ASSISTED_FIX_SETTINGS, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_GNSS_ASSISTED_FIX_SETTINGS, buffer, (uint8_t)serializer.usedLength(), REPLY_GNSS_ASSISTED_FIX_SETTINGS, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(optionOut); - extract(deserializer, *optionOut); + deserializer.extract(*optionOut); assert(flagsOut); - extract(deserializer, *flagsOut); + deserializer.extract(*flagsOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -1670,76 +1655,76 @@ TypedResult saveGnssAssistedFix(C::mip_interface& device) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_ASSISTED_FIX_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_ASSISTED_FIX_SETTINGS, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadGnssAssistedFix(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_ASSISTED_FIX_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_ASSISTED_FIX_SETTINGS, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultGnssAssistedFix(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_ASSISTED_FIX_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_ASSISTED_FIX_SETTINGS, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const GnssTimeAssistance& self) +void GnssTimeAssistance::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.tow); + serializer.insert(tow); - insert(serializer, self.week_number); + serializer.insert(week_number); - insert(serializer, self.accuracy); + serializer.insert(accuracy); } } -void extract(Serializer& serializer, GnssTimeAssistance& self) +void GnssTimeAssistance::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.tow); + serializer.extract(tow); - extract(serializer, self.week_number); + serializer.extract(week_number); - extract(serializer, self.accuracy); + serializer.extract(accuracy); } } -void insert(Serializer& serializer, const GnssTimeAssistance::Response& self) +void GnssTimeAssistance::Response::insert(Serializer& serializer) const { - insert(serializer, self.tow); + serializer.insert(tow); - insert(serializer, self.week_number); + serializer.insert(week_number); - insert(serializer, self.accuracy); + serializer.insert(accuracy); } -void extract(Serializer& serializer, GnssTimeAssistance::Response& self) +void GnssTimeAssistance::Response::extract(Serializer& serializer) { - extract(serializer, self.tow); + serializer.extract(tow); - extract(serializer, self.week_number); + serializer.extract(week_number); - extract(serializer, self.accuracy); + serializer.extract(accuracy); } @@ -1748,107 +1733,107 @@ TypedResult writeGnssTimeAssistance(C::mip_interface& device uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, tow); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(tow); - insert(serializer, weekNumber); + serializer.insert(weekNumber); - insert(serializer, accuracy); + serializer.insert(accuracy); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_TIME_ASSISTANCE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_TIME_ASSISTANCE, buffer, (uint8_t)serializer.usedLength()); } TypedResult readGnssTimeAssistance(C::mip_interface& device, double* towOut, uint16_t* weekNumberOut, float* accuracyOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_GNSS_TIME_ASSISTANCE, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_GNSS_TIME_ASSISTANCE, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_GNSS_TIME_ASSISTANCE, buffer, (uint8_t)serializer.usedLength(), REPLY_GNSS_TIME_ASSISTANCE, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(towOut); - extract(deserializer, *towOut); + deserializer.extract(*towOut); assert(weekNumberOut); - extract(deserializer, *weekNumberOut); + deserializer.extract(*weekNumberOut); assert(accuracyOut); - extract(deserializer, *accuracyOut); + deserializer.extract(*accuracyOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; } return result; } -void insert(Serializer& serializer, const ImuLowpassFilter& self) +void ImuLowpassFilter::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - insert(serializer, self.target_descriptor); + serializer.insert(target_descriptor); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.enable); + serializer.insert(enable); - insert(serializer, self.manual); + serializer.insert(manual); - insert(serializer, self.frequency); + serializer.insert(frequency); - insert(serializer, self.reserved); + serializer.insert(reserved); } } -void extract(Serializer& serializer, ImuLowpassFilter& self) +void ImuLowpassFilter::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - extract(serializer, self.target_descriptor); + serializer.extract(target_descriptor); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.enable); + serializer.extract(enable); - extract(serializer, self.manual); + serializer.extract(manual); - extract(serializer, self.frequency); + serializer.extract(frequency); - extract(serializer, self.reserved); + serializer.extract(reserved); } } -void insert(Serializer& serializer, const ImuLowpassFilter::Response& self) +void ImuLowpassFilter::Response::insert(Serializer& serializer) const { - insert(serializer, self.target_descriptor); + serializer.insert(target_descriptor); - insert(serializer, self.enable); + serializer.insert(enable); - insert(serializer, self.manual); + serializer.insert(manual); - insert(serializer, self.frequency); + serializer.insert(frequency); - insert(serializer, self.reserved); + serializer.insert(reserved); } -void extract(Serializer& serializer, ImuLowpassFilter::Response& self) +void ImuLowpassFilter::Response::extract(Serializer& serializer) { - extract(serializer, self.target_descriptor); + serializer.extract(target_descriptor); - extract(serializer, self.enable); + serializer.extract(enable); - extract(serializer, self.manual); + serializer.extract(manual); - extract(serializer, self.frequency); + serializer.extract(frequency); - extract(serializer, self.reserved); + serializer.extract(reserved); } @@ -1857,51 +1842,51 @@ TypedResult writeImuLowpassFilter(C::mip_interface& device, ui uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, targetDescriptor); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(targetDescriptor); - insert(serializer, enable); + serializer.insert(enable); - insert(serializer, manual); + serializer.insert(manual); - insert(serializer, frequency); + serializer.insert(frequency); - insert(serializer, reserved); + serializer.insert(reserved); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_IMU_LOWPASS_FILTER, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_IMU_LOWPASS_FILTER, buffer, (uint8_t)serializer.usedLength()); } TypedResult readImuLowpassFilter(C::mip_interface& device, uint8_t targetDescriptor, bool* enableOut, bool* manualOut, uint16_t* frequencyOut, uint8_t* reservedOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); - insert(serializer, targetDescriptor); + serializer.insert(FunctionSelector::READ); + serializer.insert(targetDescriptor); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_IMU_LOWPASS_FILTER, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_ADVANCED_DATA_FILTER, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_IMU_LOWPASS_FILTER, buffer, (uint8_t)serializer.usedLength(), REPLY_ADVANCED_DATA_FILTER, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - extract(deserializer, targetDescriptor); + deserializer.extract(targetDescriptor); assert(enableOut); - extract(deserializer, *enableOut); + deserializer.extract(*enableOut); assert(manualOut); - extract(deserializer, *manualOut); + deserializer.extract(*manualOut); assert(frequencyOut); - extract(deserializer, *frequencyOut); + deserializer.extract(*frequencyOut); assert(reservedOut); - extract(deserializer, *reservedOut); + deserializer.extract(*reservedOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -1913,66 +1898,66 @@ TypedResult saveImuLowpassFilter(C::mip_interface& device, uin uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); - insert(serializer, targetDescriptor); + serializer.insert(FunctionSelector::SAVE); + serializer.insert(targetDescriptor); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_IMU_LOWPASS_FILTER, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_IMU_LOWPASS_FILTER, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadImuLowpassFilter(C::mip_interface& device, uint8_t targetDescriptor) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); - insert(serializer, targetDescriptor); + serializer.insert(FunctionSelector::LOAD); + serializer.insert(targetDescriptor); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_IMU_LOWPASS_FILTER, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_IMU_LOWPASS_FILTER, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultImuLowpassFilter(C::mip_interface& device, uint8_t targetDescriptor) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); - insert(serializer, targetDescriptor); + serializer.insert(FunctionSelector::RESET); + serializer.insert(targetDescriptor); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_IMU_LOWPASS_FILTER, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_IMU_LOWPASS_FILTER, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const PpsSource& self) +void PpsSource::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.source); + serializer.insert(source); } } -void extract(Serializer& serializer, PpsSource& self) +void PpsSource::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.source); + serializer.extract(source); } } -void insert(Serializer& serializer, const PpsSource::Response& self) +void PpsSource::Response::insert(Serializer& serializer) const { - insert(serializer, self.source); + serializer.insert(source); } -void extract(Serializer& serializer, PpsSource::Response& self) +void PpsSource::Response::extract(Serializer& serializer) { - extract(serializer, self.source); + serializer.extract(source); } @@ -1981,30 +1966,30 @@ TypedResult writePpsSource(C::mip_interface& device, PpsSource::Sourc uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, source); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(source); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_PPS_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_PPS_SOURCE, buffer, (uint8_t)serializer.usedLength()); } TypedResult readPpsSource(C::mip_interface& device, PpsSource::Source* sourceOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_PPS_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_PPS_SOURCE, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_PPS_SOURCE, buffer, (uint8_t)serializer.usedLength(), REPLY_PPS_SOURCE, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(sourceOut); - extract(deserializer, *sourceOut); + deserializer.extract(*sourceOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -2016,84 +2001,84 @@ TypedResult savePpsSource(C::mip_interface& device) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_PPS_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_PPS_SOURCE, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadPpsSource(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_PPS_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_PPS_SOURCE, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultPpsSource(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_PPS_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_PPS_SOURCE, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const GpioConfig& self) +void GpioConfig::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - insert(serializer, self.pin); + serializer.insert(pin); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.feature); + serializer.insert(feature); - insert(serializer, self.behavior); + serializer.insert(behavior); - insert(serializer, self.pin_mode); + serializer.insert(pin_mode); } } -void extract(Serializer& serializer, GpioConfig& self) +void GpioConfig::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - extract(serializer, self.pin); + serializer.extract(pin); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.feature); + serializer.extract(feature); - extract(serializer, self.behavior); + serializer.extract(behavior); - extract(serializer, self.pin_mode); + serializer.extract(pin_mode); } } -void insert(Serializer& serializer, const GpioConfig::Response& self) +void GpioConfig::Response::insert(Serializer& serializer) const { - insert(serializer, self.pin); + serializer.insert(pin); - insert(serializer, self.feature); + serializer.insert(feature); - insert(serializer, self.behavior); + serializer.insert(behavior); - insert(serializer, self.pin_mode); + serializer.insert(pin_mode); } -void extract(Serializer& serializer, GpioConfig::Response& self) +void GpioConfig::Response::extract(Serializer& serializer) { - extract(serializer, self.pin); + serializer.extract(pin); - extract(serializer, self.feature); + serializer.extract(feature); - extract(serializer, self.behavior); + serializer.extract(behavior); - extract(serializer, self.pin_mode); + serializer.extract(pin_mode); } @@ -2102,46 +2087,46 @@ TypedResult writeGpioConfig(C::mip_interface& device, uint8_t pin, G uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, pin); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(pin); - insert(serializer, feature); + serializer.insert(feature); - insert(serializer, behavior); + serializer.insert(behavior); - insert(serializer, pinMode); + serializer.insert(pinMode); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GPIO_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GPIO_CONFIG, buffer, (uint8_t)serializer.usedLength()); } TypedResult readGpioConfig(C::mip_interface& device, uint8_t pin, GpioConfig::Feature* featureOut, GpioConfig::Behavior* behaviorOut, GpioConfig::PinMode* pinModeOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); - insert(serializer, pin); + serializer.insert(FunctionSelector::READ); + serializer.insert(pin); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_GPIO_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_GPIO_CONFIG, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_GPIO_CONFIG, buffer, (uint8_t)serializer.usedLength(), REPLY_GPIO_CONFIG, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - extract(deserializer, pin); + deserializer.extract(pin); assert(featureOut); - extract(deserializer, *featureOut); + deserializer.extract(*featureOut); assert(behaviorOut); - extract(deserializer, *behaviorOut); + deserializer.extract(*behaviorOut); assert(pinModeOut); - extract(deserializer, *pinModeOut); + deserializer.extract(*pinModeOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -2153,80 +2138,80 @@ TypedResult saveGpioConfig(C::mip_interface& device, uint8_t pin) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); - insert(serializer, pin); + serializer.insert(FunctionSelector::SAVE); + serializer.insert(pin); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GPIO_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GPIO_CONFIG, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadGpioConfig(C::mip_interface& device, uint8_t pin) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); - insert(serializer, pin); + serializer.insert(FunctionSelector::LOAD); + serializer.insert(pin); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GPIO_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GPIO_CONFIG, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultGpioConfig(C::mip_interface& device, uint8_t pin) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); - insert(serializer, pin); + serializer.insert(FunctionSelector::RESET); + serializer.insert(pin); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GPIO_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GPIO_CONFIG, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const GpioState& self) +void GpioState::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE || self.function == FunctionSelector::READ ) + if( function == FunctionSelector::WRITE || function == FunctionSelector::READ ) { - insert(serializer, self.pin); + serializer.insert(pin); } - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.state); + serializer.insert(state); } } -void extract(Serializer& serializer, GpioState& self) +void GpioState::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE || self.function == FunctionSelector::READ ) + if( function == FunctionSelector::WRITE || function == FunctionSelector::READ ) { - extract(serializer, self.pin); + serializer.extract(pin); } - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.state); + serializer.extract(state); } } -void insert(Serializer& serializer, const GpioState::Response& self) +void GpioState::Response::insert(Serializer& serializer) const { - insert(serializer, self.pin); + serializer.insert(pin); - insert(serializer, self.state); + serializer.insert(state); } -void extract(Serializer& serializer, GpioState::Response& self) +void GpioState::Response::extract(Serializer& serializer) { - extract(serializer, self.pin); + serializer.extract(pin); - extract(serializer, self.state); + serializer.extract(state); } @@ -2235,87 +2220,87 @@ TypedResult writeGpioState(C::mip_interface& device, uint8_t pin, boo uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, pin); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(pin); - insert(serializer, state); + serializer.insert(state); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GPIO_STATE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GPIO_STATE, buffer, (uint8_t)serializer.usedLength()); } TypedResult readGpioState(C::mip_interface& device, uint8_t pin, bool* stateOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); - insert(serializer, pin); + serializer.insert(FunctionSelector::READ); + serializer.insert(pin); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_GPIO_STATE, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_GPIO_STATE, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_GPIO_STATE, buffer, (uint8_t)serializer.usedLength(), REPLY_GPIO_STATE, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - extract(deserializer, pin); + deserializer.extract(pin); assert(stateOut); - extract(deserializer, *stateOut); + deserializer.extract(*stateOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; } return result; } -void insert(Serializer& serializer, const Odometer& self) +void Odometer::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.mode); + serializer.insert(mode); - insert(serializer, self.scaling); + serializer.insert(scaling); - insert(serializer, self.uncertainty); + serializer.insert(uncertainty); } } -void extract(Serializer& serializer, Odometer& self) +void Odometer::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.mode); + serializer.extract(mode); - extract(serializer, self.scaling); + serializer.extract(scaling); - extract(serializer, self.uncertainty); + serializer.extract(uncertainty); } } -void insert(Serializer& serializer, const Odometer::Response& self) +void Odometer::Response::insert(Serializer& serializer) const { - insert(serializer, self.mode); + serializer.insert(mode); - insert(serializer, self.scaling); + serializer.insert(scaling); - insert(serializer, self.uncertainty); + serializer.insert(uncertainty); } -void extract(Serializer& serializer, Odometer::Response& self) +void Odometer::Response::extract(Serializer& serializer) { - extract(serializer, self.mode); + serializer.extract(mode); - extract(serializer, self.scaling); + serializer.extract(scaling); - extract(serializer, self.uncertainty); + serializer.extract(uncertainty); } @@ -2324,40 +2309,40 @@ TypedResult writeOdometer(C::mip_interface& device, Odometer::Mode mod uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, mode); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(mode); - insert(serializer, scaling); + serializer.insert(scaling); - insert(serializer, uncertainty); + serializer.insert(uncertainty); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ODOMETER_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ODOMETER_CONFIG, buffer, (uint8_t)serializer.usedLength()); } TypedResult readOdometer(C::mip_interface& device, Odometer::Mode* modeOut, float* scalingOut, float* uncertaintyOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_ODOMETER_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_ODOMETER_CONFIG, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_ODOMETER_CONFIG, buffer, (uint8_t)serializer.usedLength(), REPLY_ODOMETER_CONFIG, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(modeOut); - extract(deserializer, *modeOut); + deserializer.extract(*modeOut); assert(scalingOut); - extract(deserializer, *scalingOut); + deserializer.extract(*scalingOut); assert(uncertaintyOut); - extract(deserializer, *uncertaintyOut); + deserializer.extract(*uncertaintyOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -2369,78 +2354,78 @@ TypedResult saveOdometer(C::mip_interface& device) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ODOMETER_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ODOMETER_CONFIG, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadOdometer(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ODOMETER_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ODOMETER_CONFIG, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultOdometer(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ODOMETER_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ODOMETER_CONFIG, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const GetEventSupport& self) +void GetEventSupport::Info::insert(Serializer& serializer) const { - insert(serializer, self.query); + serializer.insert(type); + + serializer.insert(count); } -void extract(Serializer& serializer, GetEventSupport& self) +void GetEventSupport::Info::extract(Serializer& serializer) { - extract(serializer, self.query); + serializer.extract(type); + + serializer.extract(count); } -void insert(Serializer& serializer, const GetEventSupport::Response& self) +void GetEventSupport::insert(Serializer& serializer) const { - insert(serializer, self.query); - - insert(serializer, self.max_instances); - - insert(serializer, self.num_entries); - - for(unsigned int i=0; i < self.num_entries; i++) - insert(serializer, self.entries[i]); + serializer.insert(query); } -void extract(Serializer& serializer, GetEventSupport::Response& self) +void GetEventSupport::extract(Serializer& serializer) { - extract(serializer, self.query); - - extract(serializer, self.max_instances); - - C::extract_count(&serializer, &self.num_entries, sizeof(self.entries)/sizeof(self.entries[0])); - for(unsigned int i=0; i < self.num_entries; i++) - extract(serializer, self.entries[i]); + serializer.extract(query); } -void insert(Serializer& serializer, const GetEventSupport::Info& self) +void GetEventSupport::Response::insert(Serializer& serializer) const { - insert(serializer, self.type); + serializer.insert(query); + + serializer.insert(max_instances); - insert(serializer, self.count); + serializer.insert(num_entries); + + for(unsigned int i=0; i < num_entries; i++) + serializer.insert(entries[i]); } -void extract(Serializer& serializer, GetEventSupport::Info& self) +void GetEventSupport::Response::extract(Serializer& serializer) { - extract(serializer, self.type); + serializer.extract(query); + + serializer.extract(max_instances); - extract(serializer, self.count); + serializer.extract_count(num_entries, sizeof(entries)/sizeof(entries[0])); + for(unsigned int i=0; i < num_entries; i++) + serializer.extract(entries[i]); } @@ -2449,69 +2434,69 @@ TypedResult getEventSupport(C::mip_interface& device, GetEventS uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, query); + serializer.insert(query); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_EVENT_SUPPORT, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_EVENT_SUPPORT, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_EVENT_SUPPORT, buffer, (uint8_t)serializer.usedLength(), REPLY_EVENT_SUPPORT, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - extract(deserializer, query); + deserializer.extract(query); assert(maxInstancesOut); - extract(deserializer, *maxInstancesOut); + deserializer.extract(*maxInstancesOut); - C::extract_count(&deserializer, numEntriesOut, numEntriesOutMax); + deserializer.extract_count(*numEntriesOut, numEntriesOutMax); assert(entriesOut || (numEntriesOut == 0)); for(unsigned int i=0; i < *numEntriesOut; i++) - extract(deserializer, entriesOut[i]); + deserializer.extract(entriesOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; } return result; } -void insert(Serializer& serializer, const EventControl& self) +void EventControl::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - insert(serializer, self.instance); + serializer.insert(instance); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.mode); + serializer.insert(mode); } } -void extract(Serializer& serializer, EventControl& self) +void EventControl::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - extract(serializer, self.instance); + serializer.extract(instance); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.mode); + serializer.extract(mode); } } -void insert(Serializer& serializer, const EventControl::Response& self) +void EventControl::Response::insert(Serializer& serializer) const { - insert(serializer, self.instance); + serializer.insert(instance); - insert(serializer, self.mode); + serializer.insert(mode); } -void extract(Serializer& serializer, EventControl::Response& self) +void EventControl::Response::extract(Serializer& serializer) { - extract(serializer, self.instance); + serializer.extract(instance); - extract(serializer, self.mode); + serializer.extract(mode); } @@ -2520,36 +2505,36 @@ TypedResult writeEventControl(C::mip_interface& device, uint8_t in uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, instance); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(instance); - insert(serializer, mode); + serializer.insert(mode); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_EVENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_EVENT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult readEventControl(C::mip_interface& device, uint8_t instance, EventControl::Mode* modeOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); - insert(serializer, instance); + serializer.insert(FunctionSelector::READ); + serializer.insert(instance); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_EVENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_EVENT_CONTROL, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_EVENT_CONTROL, buffer, (uint8_t)serializer.usedLength(), REPLY_EVENT_CONTROL, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - extract(deserializer, instance); + deserializer.extract(instance); assert(modeOut); - extract(deserializer, *modeOut); + deserializer.extract(*modeOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -2561,81 +2546,81 @@ TypedResult saveEventControl(C::mip_interface& device, uint8_t ins uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); - insert(serializer, instance); + serializer.insert(FunctionSelector::SAVE); + serializer.insert(instance); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_EVENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_EVENT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadEventControl(C::mip_interface& device, uint8_t instance) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); - insert(serializer, instance); + serializer.insert(FunctionSelector::LOAD); + serializer.insert(instance); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_EVENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_EVENT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultEventControl(C::mip_interface& device, uint8_t instance) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); - insert(serializer, instance); + serializer.insert(FunctionSelector::RESET); + serializer.insert(instance); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_EVENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_EVENT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const GetEventTriggerStatus& self) +void GetEventTriggerStatus::Entry::insert(Serializer& serializer) const { - insert(serializer, self.requested_count); + serializer.insert(type); - for(unsigned int i=0; i < self.requested_count; i++) - insert(serializer, self.requested_instances[i]); + serializer.insert(status); } -void extract(Serializer& serializer, GetEventTriggerStatus& self) +void GetEventTriggerStatus::Entry::extract(Serializer& serializer) { - C::extract_count(&serializer, &self.requested_count, sizeof(self.requested_instances)/sizeof(self.requested_instances[0])); - for(unsigned int i=0; i < self.requested_count; i++) - extract(serializer, self.requested_instances[i]); + serializer.extract(type); + + serializer.extract(status); } -void insert(Serializer& serializer, const GetEventTriggerStatus::Response& self) +void GetEventTriggerStatus::insert(Serializer& serializer) const { - insert(serializer, self.count); + serializer.insert(requested_count); - for(unsigned int i=0; i < self.count; i++) - insert(serializer, self.triggers[i]); + for(unsigned int i=0; i < requested_count; i++) + serializer.insert(requested_instances[i]); } -void extract(Serializer& serializer, GetEventTriggerStatus::Response& self) +void GetEventTriggerStatus::extract(Serializer& serializer) { - C::extract_count(&serializer, &self.count, sizeof(self.triggers)/sizeof(self.triggers[0])); - for(unsigned int i=0; i < self.count; i++) - extract(serializer, self.triggers[i]); + serializer.extract_count(requested_count, sizeof(requested_instances)/sizeof(requested_instances[0])); + for(unsigned int i=0; i < requested_count; i++) + serializer.extract(requested_instances[i]); } -void insert(Serializer& serializer, const GetEventTriggerStatus::Entry& self) +void GetEventTriggerStatus::Response::insert(Serializer& serializer) const { - insert(serializer, self.type); + serializer.insert(count); - insert(serializer, self.status); + for(unsigned int i=0; i < count; i++) + serializer.insert(triggers[i]); } -void extract(Serializer& serializer, GetEventTriggerStatus::Entry& self) +void GetEventTriggerStatus::Response::extract(Serializer& serializer) { - extract(serializer, self.type); - - extract(serializer, self.status); + serializer.extract_count(count, sizeof(triggers)/sizeof(triggers[0])); + for(unsigned int i=0; i < count; i++) + serializer.extract(triggers[i]); } @@ -2644,75 +2629,75 @@ TypedResult getEventTriggerStatus(C::mip_interface& devic uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, requestedCount); + serializer.insert(requestedCount); assert(requestedInstances || (requestedCount == 0)); for(unsigned int i=0; i < requestedCount; i++) - insert(serializer, requestedInstances[i]); + serializer.insert(requestedInstances[i]); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_EVENT_TRIGGER_STATUS, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_EVENT_TRIGGER_STATUS, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_EVENT_TRIGGER_STATUS, buffer, (uint8_t)serializer.usedLength(), REPLY_EVENT_TRIGGER_STATUS, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - C::extract_count(&deserializer, countOut, countOutMax); + deserializer.extract_count(*countOut, countOutMax); assert(triggersOut || (countOut == 0)); for(unsigned int i=0; i < *countOut; i++) - extract(deserializer, triggersOut[i]); + deserializer.extract(triggersOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; } return result; } -void insert(Serializer& serializer, const GetEventActionStatus& self) +void GetEventActionStatus::Entry::insert(Serializer& serializer) const { - insert(serializer, self.requested_count); + serializer.insert(action_type); - for(unsigned int i=0; i < self.requested_count; i++) - insert(serializer, self.requested_instances[i]); + serializer.insert(trigger_id); } -void extract(Serializer& serializer, GetEventActionStatus& self) +void GetEventActionStatus::Entry::extract(Serializer& serializer) { - C::extract_count(&serializer, &self.requested_count, sizeof(self.requested_instances)/sizeof(self.requested_instances[0])); - for(unsigned int i=0; i < self.requested_count; i++) - extract(serializer, self.requested_instances[i]); + serializer.extract(action_type); + + serializer.extract(trigger_id); } -void insert(Serializer& serializer, const GetEventActionStatus::Response& self) +void GetEventActionStatus::insert(Serializer& serializer) const { - insert(serializer, self.count); + serializer.insert(requested_count); - for(unsigned int i=0; i < self.count; i++) - insert(serializer, self.actions[i]); + for(unsigned int i=0; i < requested_count; i++) + serializer.insert(requested_instances[i]); } -void extract(Serializer& serializer, GetEventActionStatus::Response& self) +void GetEventActionStatus::extract(Serializer& serializer) { - C::extract_count(&serializer, &self.count, sizeof(self.actions)/sizeof(self.actions[0])); - for(unsigned int i=0; i < self.count; i++) - extract(serializer, self.actions[i]); + serializer.extract_count(requested_count, sizeof(requested_instances)/sizeof(requested_instances[0])); + for(unsigned int i=0; i < requested_count; i++) + serializer.extract(requested_instances[i]); } -void insert(Serializer& serializer, const GetEventActionStatus::Entry& self) +void GetEventActionStatus::Response::insert(Serializer& serializer) const { - insert(serializer, self.action_type); + serializer.insert(count); - insert(serializer, self.trigger_id); + for(unsigned int i=0; i < count; i++) + serializer.insert(actions[i]); } -void extract(Serializer& serializer, GetEventActionStatus::Entry& self) +void GetEventActionStatus::Response::extract(Serializer& serializer) { - extract(serializer, self.action_type); - - extract(serializer, self.trigger_id); + serializer.extract_count(count, sizeof(actions)/sizeof(actions[0])); + for(unsigned int i=0; i < count; i++) + serializer.extract(actions[i]); } @@ -2721,290 +2706,290 @@ TypedResult getEventActionStatus(C::mip_interface& device, uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, requestedCount); + serializer.insert(requestedCount); assert(requestedInstances || (requestedCount == 0)); for(unsigned int i=0; i < requestedCount; i++) - insert(serializer, requestedInstances[i]); + serializer.insert(requestedInstances[i]); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_EVENT_ACTION_STATUS, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_EVENT_ACTION_STATUS, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_EVENT_ACTION_STATUS, buffer, (uint8_t)serializer.usedLength(), REPLY_EVENT_ACTION_STATUS, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - C::extract_count(&deserializer, countOut, countOutMax); + deserializer.extract_count(*countOut, countOutMax); assert(actionsOut || (countOut == 0)); for(unsigned int i=0; i < *countOut; i++) - extract(deserializer, actionsOut[i]); + deserializer.extract(actionsOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; } return result; } -void insert(Serializer& serializer, const EventTrigger& self) +void EventTrigger::GpioParams::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(pin); - insert(serializer, self.instance); + serializer.insert(mode); - if( self.function == FunctionSelector::WRITE ) - { - insert(serializer, self.type); - - if( self.type == EventTrigger::Type::GPIO ) - { - insert(serializer, self.parameters.gpio); - - } - if( self.type == EventTrigger::Type::THRESHOLD ) - { - insert(serializer, self.parameters.threshold); - - } - if( self.type == EventTrigger::Type::COMBINATION ) - { - insert(serializer, self.parameters.combination); - - } - } } -void extract(Serializer& serializer, EventTrigger& self) +void EventTrigger::GpioParams::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(pin); - extract(serializer, self.instance); + serializer.extract(mode); - if( self.function == FunctionSelector::WRITE ) - { - extract(serializer, self.type); - - if( self.type == EventTrigger::Type::GPIO ) - { - extract(serializer, self.parameters.gpio); - - } - if( self.type == EventTrigger::Type::THRESHOLD ) - { - extract(serializer, self.parameters.threshold); - - } - if( self.type == EventTrigger::Type::COMBINATION ) - { - extract(serializer, self.parameters.combination); - - } - } } -void insert(Serializer& serializer, const EventTrigger::Response& self) +void EventTrigger::ThresholdParams::insert(Serializer& serializer) const { - insert(serializer, self.instance); + serializer.insert(desc_set); + + serializer.insert(field_desc); - insert(serializer, self.type); + serializer.insert(param_id); - if( self.type == EventTrigger::Type::GPIO ) + serializer.insert(type); + + if( type == EventTrigger::ThresholdParams::Type::WINDOW ) + { + serializer.insert(low_thres); + + } + if( type == EventTrigger::ThresholdParams::Type::INTERVAL ) { - insert(serializer, self.parameters.gpio); + serializer.insert(int_thres); } - if( self.type == EventTrigger::Type::THRESHOLD ) + if( type == EventTrigger::ThresholdParams::Type::WINDOW ) { - insert(serializer, self.parameters.threshold); + serializer.insert(high_thres); } - if( self.type == EventTrigger::Type::COMBINATION ) + if( type == EventTrigger::ThresholdParams::Type::INTERVAL ) { - insert(serializer, self.parameters.combination); + serializer.insert(interval); } } -void extract(Serializer& serializer, EventTrigger::Response& self) +void EventTrigger::ThresholdParams::extract(Serializer& serializer) { - extract(serializer, self.instance); + serializer.extract(desc_set); - extract(serializer, self.type); + serializer.extract(field_desc); - if( self.type == EventTrigger::Type::GPIO ) + serializer.extract(param_id); + + serializer.extract(type); + + if( type == EventTrigger::ThresholdParams::Type::WINDOW ) + { + serializer.extract(low_thres); + + } + if( type == EventTrigger::ThresholdParams::Type::INTERVAL ) { - extract(serializer, self.parameters.gpio); + serializer.extract(int_thres); } - if( self.type == EventTrigger::Type::THRESHOLD ) + if( type == EventTrigger::ThresholdParams::Type::WINDOW ) { - extract(serializer, self.parameters.threshold); + serializer.extract(high_thres); } - if( self.type == EventTrigger::Type::COMBINATION ) + if( type == EventTrigger::ThresholdParams::Type::INTERVAL ) { - extract(serializer, self.parameters.combination); + serializer.extract(interval); } } -void insert(Serializer& serializer, const EventTrigger::GpioParams& self) +void EventTrigger::CombinationParams::insert(Serializer& serializer) const { - insert(serializer, self.pin); + serializer.insert(logic_table); - insert(serializer, self.mode); + for(unsigned int i=0; i < 4; i++) + serializer.insert(input_triggers[i]); } -void extract(Serializer& serializer, EventTrigger::GpioParams& self) +void EventTrigger::CombinationParams::extract(Serializer& serializer) { - extract(serializer, self.pin); + serializer.extract(logic_table); - extract(serializer, self.mode); + for(unsigned int i=0; i < 4; i++) + serializer.extract(input_triggers[i]); } -void insert(Serializer& serializer, const EventTrigger::ThresholdParams& self) +void EventTrigger::insert(Serializer& serializer) const { - insert(serializer, self.desc_set); + serializer.insert(function); - insert(serializer, self.field_desc); + serializer.insert(instance); - insert(serializer, self.param_id); + if( function == FunctionSelector::WRITE ) + { + serializer.insert(type); + + if( type == EventTrigger::Type::GPIO ) + { + serializer.insert(parameters.gpio); + + } + if( type == EventTrigger::Type::THRESHOLD ) + { + serializer.insert(parameters.threshold); + + } + if( type == EventTrigger::Type::COMBINATION ) + { + serializer.insert(parameters.combination); + + } + } +} +void EventTrigger::extract(Serializer& serializer) +{ + serializer.extract(function); - insert(serializer, self.type); + serializer.extract(instance); - if( self.type == EventTrigger::ThresholdParams::Type::WINDOW ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.low_thres); + serializer.extract(type); + if( type == EventTrigger::Type::GPIO ) + { + serializer.extract(parameters.gpio); + + } + if( type == EventTrigger::Type::THRESHOLD ) + { + serializer.extract(parameters.threshold); + + } + if( type == EventTrigger::Type::COMBINATION ) + { + serializer.extract(parameters.combination); + + } } - if( self.type == EventTrigger::ThresholdParams::Type::INTERVAL ) +} + +void EventTrigger::Response::insert(Serializer& serializer) const +{ + serializer.insert(instance); + + serializer.insert(type); + + if( type == EventTrigger::Type::GPIO ) { - insert(serializer, self.int_thres); + serializer.insert(parameters.gpio); } - if( self.type == EventTrigger::ThresholdParams::Type::WINDOW ) + if( type == EventTrigger::Type::THRESHOLD ) { - insert(serializer, self.high_thres); + serializer.insert(parameters.threshold); } - if( self.type == EventTrigger::ThresholdParams::Type::INTERVAL ) + if( type == EventTrigger::Type::COMBINATION ) { - insert(serializer, self.interval); + serializer.insert(parameters.combination); } } -void extract(Serializer& serializer, EventTrigger::ThresholdParams& self) +void EventTrigger::Response::extract(Serializer& serializer) { - extract(serializer, self.desc_set); + serializer.extract(instance); - extract(serializer, self.field_desc); + serializer.extract(type); - extract(serializer, self.param_id); - - extract(serializer, self.type); - - if( self.type == EventTrigger::ThresholdParams::Type::WINDOW ) - { - extract(serializer, self.low_thres); - - } - if( self.type == EventTrigger::ThresholdParams::Type::INTERVAL ) + if( type == EventTrigger::Type::GPIO ) { - extract(serializer, self.int_thres); + serializer.extract(parameters.gpio); } - if( self.type == EventTrigger::ThresholdParams::Type::WINDOW ) + if( type == EventTrigger::Type::THRESHOLD ) { - extract(serializer, self.high_thres); + serializer.extract(parameters.threshold); } - if( self.type == EventTrigger::ThresholdParams::Type::INTERVAL ) + if( type == EventTrigger::Type::COMBINATION ) { - extract(serializer, self.interval); + serializer.extract(parameters.combination); } } -void insert(Serializer& serializer, const EventTrigger::CombinationParams& self) -{ - insert(serializer, self.logic_table); - - for(unsigned int i=0; i < 4; i++) - insert(serializer, self.input_triggers[i]); - -} -void extract(Serializer& serializer, EventTrigger::CombinationParams& self) -{ - extract(serializer, self.logic_table); - - for(unsigned int i=0; i < 4; i++) - extract(serializer, self.input_triggers[i]); - -} - TypedResult writeEventTrigger(C::mip_interface& device, uint8_t instance, EventTrigger::Type type, const EventTrigger::Parameters& parameters) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, instance); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(instance); - insert(serializer, type); + serializer.insert(type); if( type == EventTrigger::Type::GPIO ) { - insert(serializer, parameters.gpio); + serializer.insert(parameters.gpio); } if( type == EventTrigger::Type::THRESHOLD ) { - insert(serializer, parameters.threshold); + serializer.insert(parameters.threshold); } if( type == EventTrigger::Type::COMBINATION ) { - insert(serializer, parameters.combination); + serializer.insert(parameters.combination); } assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_EVENT_TRIGGER_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_EVENT_TRIGGER_CONFIG, buffer, (uint8_t)serializer.usedLength()); } TypedResult readEventTrigger(C::mip_interface& device, uint8_t instance, EventTrigger::Type* typeOut, EventTrigger::Parameters* parametersOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); - insert(serializer, instance); + serializer.insert(FunctionSelector::READ); + serializer.insert(instance); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_EVENT_TRIGGER_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_EVENT_TRIGGER_CONFIG, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_EVENT_TRIGGER_CONFIG, buffer, (uint8_t)serializer.usedLength(), REPLY_EVENT_TRIGGER_CONFIG, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - extract(deserializer, instance); + deserializer.extract(instance); assert(typeOut); - extract(deserializer, *typeOut); + deserializer.extract(*typeOut); if( *typeOut == EventTrigger::Type::GPIO ) { - extract(deserializer, parametersOut->gpio); + deserializer.extract(parametersOut->gpio); } if( *typeOut == EventTrigger::Type::THRESHOLD ) { - extract(deserializer, parametersOut->threshold); + deserializer.extract(parametersOut->threshold); } if( *typeOut == EventTrigger::Type::COMBINATION ) { - extract(deserializer, parametersOut->combination); + deserializer.extract(parametersOut->combination); } if( deserializer.remaining() != 0 ) @@ -3017,223 +3002,223 @@ TypedResult saveEventTrigger(C::mip_interface& device, uint8_t ins uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); - insert(serializer, instance); + serializer.insert(FunctionSelector::SAVE); + serializer.insert(instance); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_EVENT_TRIGGER_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_EVENT_TRIGGER_CONFIG, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadEventTrigger(C::mip_interface& device, uint8_t instance) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); - insert(serializer, instance); + serializer.insert(FunctionSelector::LOAD); + serializer.insert(instance); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_EVENT_TRIGGER_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_EVENT_TRIGGER_CONFIG, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultEventTrigger(C::mip_interface& device, uint8_t instance) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); - insert(serializer, instance); + serializer.insert(FunctionSelector::RESET); + serializer.insert(instance); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_EVENT_TRIGGER_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_EVENT_TRIGGER_CONFIG, buffer, (uint8_t)serializer.usedLength()); +} +void EventAction::GpioParams::insert(Serializer& serializer) const +{ + serializer.insert(pin); + + serializer.insert(mode); + +} +void EventAction::GpioParams::extract(Serializer& serializer) +{ + serializer.extract(pin); + + serializer.extract(mode); + +} + +void EventAction::MessageParams::insert(Serializer& serializer) const +{ + serializer.insert(desc_set); + + serializer.insert(decimation); + + serializer.insert(num_fields); + + for(unsigned int i=0; i < num_fields; i++) + serializer.insert(descriptors[i]); + +} +void EventAction::MessageParams::extract(Serializer& serializer) +{ + serializer.extract(desc_set); + + serializer.extract(decimation); + + serializer.extract_count(num_fields, sizeof(descriptors)/sizeof(descriptors[0])); + for(unsigned int i=0; i < num_fields; i++) + serializer.extract(descriptors[i]); + } -void insert(Serializer& serializer, const EventAction& self) + +void EventAction::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - insert(serializer, self.instance); + serializer.insert(instance); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.trigger); + serializer.insert(trigger); - insert(serializer, self.type); + serializer.insert(type); - if( self.type == EventAction::Type::GPIO ) + if( type == EventAction::Type::GPIO ) { - insert(serializer, self.parameters.gpio); + serializer.insert(parameters.gpio); } - if( self.type == EventAction::Type::MESSAGE ) + if( type == EventAction::Type::MESSAGE ) { - insert(serializer, self.parameters.message); + serializer.insert(parameters.message); } } } -void extract(Serializer& serializer, EventAction& self) +void EventAction::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - extract(serializer, self.instance); + serializer.extract(instance); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.trigger); + serializer.extract(trigger); - extract(serializer, self.type); + serializer.extract(type); - if( self.type == EventAction::Type::GPIO ) + if( type == EventAction::Type::GPIO ) { - extract(serializer, self.parameters.gpio); + serializer.extract(parameters.gpio); } - if( self.type == EventAction::Type::MESSAGE ) + if( type == EventAction::Type::MESSAGE ) { - extract(serializer, self.parameters.message); + serializer.extract(parameters.message); } } } -void insert(Serializer& serializer, const EventAction::Response& self) +void EventAction::Response::insert(Serializer& serializer) const { - insert(serializer, self.instance); + serializer.insert(instance); - insert(serializer, self.trigger); + serializer.insert(trigger); - insert(serializer, self.type); + serializer.insert(type); - if( self.type == EventAction::Type::GPIO ) + if( type == EventAction::Type::GPIO ) { - insert(serializer, self.parameters.gpio); + serializer.insert(parameters.gpio); } - if( self.type == EventAction::Type::MESSAGE ) + if( type == EventAction::Type::MESSAGE ) { - insert(serializer, self.parameters.message); + serializer.insert(parameters.message); } } -void extract(Serializer& serializer, EventAction::Response& self) +void EventAction::Response::extract(Serializer& serializer) { - extract(serializer, self.instance); + serializer.extract(instance); - extract(serializer, self.trigger); + serializer.extract(trigger); - extract(serializer, self.type); + serializer.extract(type); - if( self.type == EventAction::Type::GPIO ) + if( type == EventAction::Type::GPIO ) { - extract(serializer, self.parameters.gpio); + serializer.extract(parameters.gpio); } - if( self.type == EventAction::Type::MESSAGE ) + if( type == EventAction::Type::MESSAGE ) { - extract(serializer, self.parameters.message); + serializer.extract(parameters.message); } } -void insert(Serializer& serializer, const EventAction::GpioParams& self) -{ - insert(serializer, self.pin); - - insert(serializer, self.mode); - -} -void extract(Serializer& serializer, EventAction::GpioParams& self) -{ - extract(serializer, self.pin); - - extract(serializer, self.mode); - -} - -void insert(Serializer& serializer, const EventAction::MessageParams& self) -{ - insert(serializer, self.desc_set); - - insert(serializer, self.decimation); - - insert(serializer, self.num_fields); - - for(unsigned int i=0; i < self.num_fields; i++) - insert(serializer, self.descriptors[i]); - -} -void extract(Serializer& serializer, EventAction::MessageParams& self) -{ - extract(serializer, self.desc_set); - - extract(serializer, self.decimation); - - C::extract_count(&serializer, &self.num_fields, sizeof(self.descriptors)/sizeof(self.descriptors[0])); - for(unsigned int i=0; i < self.num_fields; i++) - extract(serializer, self.descriptors[i]); - -} - TypedResult writeEventAction(C::mip_interface& device, uint8_t instance, uint8_t trigger, EventAction::Type type, const EventAction::Parameters& parameters) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, instance); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(instance); - insert(serializer, trigger); + serializer.insert(trigger); - insert(serializer, type); + serializer.insert(type); if( type == EventAction::Type::GPIO ) { - insert(serializer, parameters.gpio); + serializer.insert(parameters.gpio); } if( type == EventAction::Type::MESSAGE ) { - insert(serializer, parameters.message); + serializer.insert(parameters.message); } assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_EVENT_ACTION_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_EVENT_ACTION_CONFIG, buffer, (uint8_t)serializer.usedLength()); } TypedResult readEventAction(C::mip_interface& device, uint8_t instance, uint8_t* triggerOut, EventAction::Type* typeOut, EventAction::Parameters* parametersOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); - insert(serializer, instance); + serializer.insert(FunctionSelector::READ); + serializer.insert(instance); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_EVENT_ACTION_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_EVENT_ACTION_CONFIG, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_EVENT_ACTION_CONFIG, buffer, (uint8_t)serializer.usedLength(), REPLY_EVENT_ACTION_CONFIG, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - extract(deserializer, instance); + deserializer.extract(instance); assert(triggerOut); - extract(deserializer, *triggerOut); + deserializer.extract(*triggerOut); assert(typeOut); - extract(deserializer, *typeOut); + deserializer.extract(*typeOut); if( *typeOut == EventAction::Type::GPIO ) { - extract(deserializer, parametersOut->gpio); + deserializer.extract(parametersOut->gpio); } if( *typeOut == EventAction::Type::MESSAGE ) { - extract(deserializer, parametersOut->message); + deserializer.extract(parametersOut->message); } if( deserializer.remaining() != 0 ) @@ -3246,70 +3231,66 @@ TypedResult saveEventAction(C::mip_interface& device, uint8_t insta uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); - insert(serializer, instance); + serializer.insert(FunctionSelector::SAVE); + serializer.insert(instance); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_EVENT_ACTION_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_EVENT_ACTION_CONFIG, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadEventAction(C::mip_interface& device, uint8_t instance) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); - insert(serializer, instance); + serializer.insert(FunctionSelector::LOAD); + serializer.insert(instance); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_EVENT_ACTION_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_EVENT_ACTION_CONFIG, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultEventAction(C::mip_interface& device, uint8_t instance) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); - insert(serializer, instance); + serializer.insert(FunctionSelector::RESET); + serializer.insert(instance); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_EVENT_ACTION_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_EVENT_ACTION_CONFIG, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const AccelBias& self) +void AccelBias::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.bias[i]); + serializer.insert(bias); } } -void extract(Serializer& serializer, AccelBias& self) +void AccelBias::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.bias[i]); + serializer.extract(bias); } } -void insert(Serializer& serializer, const AccelBias::Response& self) +void AccelBias::Response::insert(Serializer& serializer) const { - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.bias[i]); + serializer.insert(bias); } -void extract(Serializer& serializer, AccelBias::Response& self) +void AccelBias::Response::extract(Serializer& serializer) { - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.bias[i]); + serializer.extract(bias); } @@ -3318,33 +3299,33 @@ TypedResult writeAccelBias(C::mip_interface& device, const float* bia uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - assert(bias || (3 == 0)); + serializer.insert(FunctionSelector::WRITE); + assert(bias); for(unsigned int i=0; i < 3; i++) - insert(serializer, bias[i]); + serializer.insert(bias[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ACCEL_BIAS, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ACCEL_BIAS, buffer, (uint8_t)serializer.usedLength()); } TypedResult readAccelBias(C::mip_interface& device, float* biasOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_ACCEL_BIAS, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_ACCEL_BIAS_VECTOR, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_ACCEL_BIAS, buffer, (uint8_t)serializer.usedLength(), REPLY_ACCEL_BIAS_VECTOR, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - assert(biasOut || (3 == 0)); + assert(biasOut); for(unsigned int i=0; i < 3; i++) - extract(deserializer, biasOut[i]); + deserializer.extract(biasOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -3356,64 +3337,60 @@ TypedResult saveAccelBias(C::mip_interface& device) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ACCEL_BIAS, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ACCEL_BIAS, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadAccelBias(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ACCEL_BIAS, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ACCEL_BIAS, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultAccelBias(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ACCEL_BIAS, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ACCEL_BIAS, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const GyroBias& self) +void GyroBias::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.bias[i]); + serializer.insert(bias); } } -void extract(Serializer& serializer, GyroBias& self) +void GyroBias::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.bias[i]); + serializer.extract(bias); } } -void insert(Serializer& serializer, const GyroBias::Response& self) +void GyroBias::Response::insert(Serializer& serializer) const { - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.bias[i]); + serializer.insert(bias); } -void extract(Serializer& serializer, GyroBias::Response& self) +void GyroBias::Response::extract(Serializer& serializer) { - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.bias[i]); + serializer.extract(bias); } @@ -3422,33 +3399,33 @@ TypedResult writeGyroBias(C::mip_interface& device, const float* bias) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - assert(bias || (3 == 0)); + serializer.insert(FunctionSelector::WRITE); + assert(bias); for(unsigned int i=0; i < 3; i++) - insert(serializer, bias[i]); + serializer.insert(bias[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GYRO_BIAS, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GYRO_BIAS, buffer, (uint8_t)serializer.usedLength()); } TypedResult readGyroBias(C::mip_interface& device, float* biasOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_GYRO_BIAS, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_GYRO_BIAS_VECTOR, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_GYRO_BIAS, buffer, (uint8_t)serializer.usedLength(), REPLY_GYRO_BIAS_VECTOR, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - assert(biasOut || (3 == 0)); + assert(biasOut); for(unsigned int i=0; i < 3; i++) - extract(deserializer, biasOut[i]); + deserializer.extract(biasOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -3460,52 +3437,50 @@ TypedResult saveGyroBias(C::mip_interface& device) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GYRO_BIAS, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GYRO_BIAS, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadGyroBias(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GYRO_BIAS, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GYRO_BIAS, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultGyroBias(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GYRO_BIAS, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GYRO_BIAS, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const CaptureGyroBias& self) +void CaptureGyroBias::insert(Serializer& serializer) const { - insert(serializer, self.averaging_time_ms); + serializer.insert(averaging_time_ms); } -void extract(Serializer& serializer, CaptureGyroBias& self) +void CaptureGyroBias::extract(Serializer& serializer) { - extract(serializer, self.averaging_time_ms); + serializer.extract(averaging_time_ms); } -void insert(Serializer& serializer, const CaptureGyroBias::Response& self) +void CaptureGyroBias::Response::insert(Serializer& serializer) const { - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.bias[i]); + serializer.insert(bias); } -void extract(Serializer& serializer, CaptureGyroBias::Response& self) +void CaptureGyroBias::Response::extract(Serializer& serializer) { - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.bias[i]); + serializer.extract(bias); } @@ -3514,59 +3489,55 @@ TypedResult captureGyroBias(C::mip_interface& device, uint16_t uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, averagingTimeMs); + serializer.insert(averagingTimeMs); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_CAPTURE_GYRO_BIAS, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_GYRO_BIAS_VECTOR, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_CAPTURE_GYRO_BIAS, buffer, (uint8_t)serializer.usedLength(), REPLY_GYRO_BIAS_VECTOR, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - assert(biasOut || (3 == 0)); + assert(biasOut); for(unsigned int i=0; i < 3; i++) - extract(deserializer, biasOut[i]); + deserializer.extract(biasOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; } return result; } -void insert(Serializer& serializer, const MagHardIronOffset& self) +void MagHardIronOffset::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.offset[i]); + serializer.insert(offset); } } -void extract(Serializer& serializer, MagHardIronOffset& self) +void MagHardIronOffset::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.offset[i]); + serializer.extract(offset); } } -void insert(Serializer& serializer, const MagHardIronOffset::Response& self) +void MagHardIronOffset::Response::insert(Serializer& serializer) const { - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.offset[i]); + serializer.insert(offset); } -void extract(Serializer& serializer, MagHardIronOffset::Response& self) +void MagHardIronOffset::Response::extract(Serializer& serializer) { - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.offset[i]); + serializer.extract(offset); } @@ -3575,33 +3546,33 @@ TypedResult writeMagHardIronOffset(C::mip_interface& device, uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - assert(offset || (3 == 0)); + serializer.insert(FunctionSelector::WRITE); + assert(offset); for(unsigned int i=0; i < 3; i++) - insert(serializer, offset[i]); + serializer.insert(offset[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_HARD_IRON_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_HARD_IRON_OFFSET, buffer, (uint8_t)serializer.usedLength()); } TypedResult readMagHardIronOffset(C::mip_interface& device, float* offsetOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_HARD_IRON_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_HARD_IRON_OFFSET_VECTOR, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_HARD_IRON_OFFSET, buffer, (uint8_t)serializer.usedLength(), REPLY_HARD_IRON_OFFSET_VECTOR, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - assert(offsetOut || (3 == 0)); + assert(offsetOut); for(unsigned int i=0; i < 3; i++) - extract(deserializer, offsetOut[i]); + deserializer.extract(offsetOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -3613,64 +3584,60 @@ TypedResult saveMagHardIronOffset(C::mip_interface& device) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_HARD_IRON_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_HARD_IRON_OFFSET, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadMagHardIronOffset(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_HARD_IRON_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_HARD_IRON_OFFSET, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultMagHardIronOffset(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_HARD_IRON_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_HARD_IRON_OFFSET, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const MagSoftIronMatrix& self) +void MagSoftIronMatrix::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 9; i++) - insert(serializer, self.offset[i]); + serializer.insert(offset); } } -void extract(Serializer& serializer, MagSoftIronMatrix& self) +void MagSoftIronMatrix::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 9; i++) - extract(serializer, self.offset[i]); + serializer.extract(offset); } } -void insert(Serializer& serializer, const MagSoftIronMatrix::Response& self) +void MagSoftIronMatrix::Response::insert(Serializer& serializer) const { - for(unsigned int i=0; i < 9; i++) - insert(serializer, self.offset[i]); + serializer.insert(offset); } -void extract(Serializer& serializer, MagSoftIronMatrix::Response& self) +void MagSoftIronMatrix::Response::extract(Serializer& serializer) { - for(unsigned int i=0; i < 9; i++) - extract(serializer, self.offset[i]); + serializer.extract(offset); } @@ -3679,33 +3646,33 @@ TypedResult writeMagSoftIronMatrix(C::mip_interface& device, uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - assert(offset || (9 == 0)); + serializer.insert(FunctionSelector::WRITE); + assert(offset); for(unsigned int i=0; i < 9; i++) - insert(serializer, offset[i]); + serializer.insert(offset[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SOFT_IRON_MATRIX, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SOFT_IRON_MATRIX, buffer, (uint8_t)serializer.usedLength()); } TypedResult readMagSoftIronMatrix(C::mip_interface& device, float* offsetOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_SOFT_IRON_MATRIX, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_SOFT_IRON_COMP_MATRIX, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_SOFT_IRON_MATRIX, buffer, (uint8_t)serializer.usedLength(), REPLY_SOFT_IRON_COMP_MATRIX, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - assert(offsetOut || (9 == 0)); + assert(offsetOut); for(unsigned int i=0; i < 9; i++) - extract(deserializer, offsetOut[i]); + deserializer.extract(offsetOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -3717,60 +3684,60 @@ TypedResult saveMagSoftIronMatrix(C::mip_interface& device) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SOFT_IRON_MATRIX, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SOFT_IRON_MATRIX, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadMagSoftIronMatrix(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SOFT_IRON_MATRIX, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SOFT_IRON_MATRIX, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultMagSoftIronMatrix(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SOFT_IRON_MATRIX, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SOFT_IRON_MATRIX, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const ConingScullingEnable& self) +void ConingScullingEnable::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.enable); + serializer.insert(enable); } } -void extract(Serializer& serializer, ConingScullingEnable& self) +void ConingScullingEnable::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.enable); + serializer.extract(enable); } } -void insert(Serializer& serializer, const ConingScullingEnable::Response& self) +void ConingScullingEnable::Response::insert(Serializer& serializer) const { - insert(serializer, self.enable); + serializer.insert(enable); } -void extract(Serializer& serializer, ConingScullingEnable::Response& self) +void ConingScullingEnable::Response::extract(Serializer& serializer) { - extract(serializer, self.enable); + serializer.extract(enable); } @@ -3779,30 +3746,30 @@ TypedResult writeConingScullingEnable(C::mip_interface& de uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, enable); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(enable); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_CONING_AND_SCULLING_ENABLE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_CONING_AND_SCULLING_ENABLE, buffer, (uint8_t)serializer.usedLength()); } TypedResult readConingScullingEnable(C::mip_interface& device, bool* enableOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_CONING_AND_SCULLING_ENABLE, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_CONING_AND_SCULLING_ENABLE, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_CONING_AND_SCULLING_ENABLE, buffer, (uint8_t)serializer.usedLength(), REPLY_CONING_AND_SCULLING_ENABLE, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(enableOut); - extract(deserializer, *enableOut); + deserializer.extract(*enableOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -3814,76 +3781,76 @@ TypedResult saveConingScullingEnable(C::mip_interface& dev uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_CONING_AND_SCULLING_ENABLE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_CONING_AND_SCULLING_ENABLE, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadConingScullingEnable(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_CONING_AND_SCULLING_ENABLE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_CONING_AND_SCULLING_ENABLE, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultConingScullingEnable(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_CONING_AND_SCULLING_ENABLE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_CONING_AND_SCULLING_ENABLE, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const Sensor2VehicleTransformEuler& self) +void Sensor2VehicleTransformEuler::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.roll); + serializer.insert(roll); - insert(serializer, self.pitch); + serializer.insert(pitch); - insert(serializer, self.yaw); + serializer.insert(yaw); } } -void extract(Serializer& serializer, Sensor2VehicleTransformEuler& self) +void Sensor2VehicleTransformEuler::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.roll); + serializer.extract(roll); - extract(serializer, self.pitch); + serializer.extract(pitch); - extract(serializer, self.yaw); + serializer.extract(yaw); } } -void insert(Serializer& serializer, const Sensor2VehicleTransformEuler::Response& self) +void Sensor2VehicleTransformEuler::Response::insert(Serializer& serializer) const { - insert(serializer, self.roll); + serializer.insert(roll); - insert(serializer, self.pitch); + serializer.insert(pitch); - insert(serializer, self.yaw); + serializer.insert(yaw); } -void extract(Serializer& serializer, Sensor2VehicleTransformEuler::Response& self) +void Sensor2VehicleTransformEuler::Response::extract(Serializer& serializer) { - extract(serializer, self.roll); + serializer.extract(roll); - extract(serializer, self.pitch); + serializer.extract(pitch); - extract(serializer, self.yaw); + serializer.extract(yaw); } @@ -3892,40 +3859,40 @@ TypedResult writeSensor2VehicleTransformEuler(C::m uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, roll); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(roll); - insert(serializer, pitch); + serializer.insert(pitch); - insert(serializer, yaw); + serializer.insert(yaw); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_TRANSFORM_EUL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_TRANSFORM_EUL, buffer, (uint8_t)serializer.usedLength()); } TypedResult readSensor2VehicleTransformEuler(C::mip_interface& device, float* rollOut, float* pitchOut, float* yawOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_TRANSFORM_EUL, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_SENSOR2VEHICLE_TRANSFORM_EUL, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_TRANSFORM_EUL, buffer, (uint8_t)serializer.usedLength(), REPLY_SENSOR2VEHICLE_TRANSFORM_EUL, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(rollOut); - extract(deserializer, *rollOut); + deserializer.extract(*rollOut); assert(pitchOut); - extract(deserializer, *pitchOut); + deserializer.extract(*pitchOut); assert(yawOut); - extract(deserializer, *yawOut); + deserializer.extract(*yawOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -3937,64 +3904,60 @@ TypedResult saveSensor2VehicleTransformEuler(C::mi uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_TRANSFORM_EUL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_TRANSFORM_EUL, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadSensor2VehicleTransformEuler(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_TRANSFORM_EUL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_TRANSFORM_EUL, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultSensor2VehicleTransformEuler(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_TRANSFORM_EUL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_TRANSFORM_EUL, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const Sensor2VehicleTransformQuaternion& self) +void Sensor2VehicleTransformQuaternion::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 4; i++) - insert(serializer, self.q[i]); + serializer.insert(q); } } -void extract(Serializer& serializer, Sensor2VehicleTransformQuaternion& self) +void Sensor2VehicleTransformQuaternion::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 4; i++) - extract(serializer, self.q[i]); + serializer.extract(q); } } -void insert(Serializer& serializer, const Sensor2VehicleTransformQuaternion::Response& self) +void Sensor2VehicleTransformQuaternion::Response::insert(Serializer& serializer) const { - for(unsigned int i=0; i < 4; i++) - insert(serializer, self.q[i]); + serializer.insert(q); } -void extract(Serializer& serializer, Sensor2VehicleTransformQuaternion::Response& self) +void Sensor2VehicleTransformQuaternion::Response::extract(Serializer& serializer) { - for(unsigned int i=0; i < 4; i++) - extract(serializer, self.q[i]); + serializer.extract(q); } @@ -4003,33 +3966,33 @@ TypedResult writeSensor2VehicleTransformQuate uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - assert(q || (4 == 0)); + serializer.insert(FunctionSelector::WRITE); + assert(q); for(unsigned int i=0; i < 4; i++) - insert(serializer, q[i]); + serializer.insert(q[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_TRANSFORM_QUAT, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_TRANSFORM_QUAT, buffer, (uint8_t)serializer.usedLength()); } TypedResult readSensor2VehicleTransformQuaternion(C::mip_interface& device, float* qOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_TRANSFORM_QUAT, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_SENSOR2VEHICLE_TRANSFORM_QUAT, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_TRANSFORM_QUAT, buffer, (uint8_t)serializer.usedLength(), REPLY_SENSOR2VEHICLE_TRANSFORM_QUAT, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - assert(qOut || (4 == 0)); + assert(qOut); for(unsigned int i=0; i < 4; i++) - extract(deserializer, qOut[i]); + deserializer.extract(qOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -4041,64 +4004,60 @@ TypedResult saveSensor2VehicleTransformQuater uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_TRANSFORM_QUAT, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_TRANSFORM_QUAT, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadSensor2VehicleTransformQuaternion(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_TRANSFORM_QUAT, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_TRANSFORM_QUAT, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultSensor2VehicleTransformQuaternion(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_TRANSFORM_QUAT, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_TRANSFORM_QUAT, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const Sensor2VehicleTransformDcm& self) +void Sensor2VehicleTransformDcm::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 9; i++) - insert(serializer, self.dcm[i]); + serializer.insert(dcm); } } -void extract(Serializer& serializer, Sensor2VehicleTransformDcm& self) +void Sensor2VehicleTransformDcm::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 9; i++) - extract(serializer, self.dcm[i]); + serializer.extract(dcm); } } -void insert(Serializer& serializer, const Sensor2VehicleTransformDcm::Response& self) +void Sensor2VehicleTransformDcm::Response::insert(Serializer& serializer) const { - for(unsigned int i=0; i < 9; i++) - insert(serializer, self.dcm[i]); + serializer.insert(dcm); } -void extract(Serializer& serializer, Sensor2VehicleTransformDcm::Response& self) +void Sensor2VehicleTransformDcm::Response::extract(Serializer& serializer) { - for(unsigned int i=0; i < 9; i++) - extract(serializer, self.dcm[i]); + serializer.extract(dcm); } @@ -4107,33 +4066,33 @@ TypedResult writeSensor2VehicleTransformDcm(C::mip_i uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - assert(dcm || (9 == 0)); + serializer.insert(FunctionSelector::WRITE); + assert(dcm); for(unsigned int i=0; i < 9; i++) - insert(serializer, dcm[i]); + serializer.insert(dcm[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_TRANSFORM_DCM, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_TRANSFORM_DCM, buffer, (uint8_t)serializer.usedLength()); } TypedResult readSensor2VehicleTransformDcm(C::mip_interface& device, float* dcmOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_TRANSFORM_DCM, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_SENSOR2VEHICLE_TRANSFORM_DCM, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_TRANSFORM_DCM, buffer, (uint8_t)serializer.usedLength(), REPLY_SENSOR2VEHICLE_TRANSFORM_DCM, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - assert(dcmOut || (9 == 0)); + assert(dcmOut); for(unsigned int i=0; i < 9; i++) - extract(deserializer, dcmOut[i]); + deserializer.extract(dcmOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -4145,84 +4104,84 @@ TypedResult saveSensor2VehicleTransformDcm(C::mip_in uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_TRANSFORM_DCM, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_TRANSFORM_DCM, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadSensor2VehicleTransformDcm(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_TRANSFORM_DCM, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_TRANSFORM_DCM, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultSensor2VehicleTransformDcm(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_TRANSFORM_DCM, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_TRANSFORM_DCM, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const ComplementaryFilter& self) +void ComplementaryFilter::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.pitch_roll_enable); + serializer.insert(pitch_roll_enable); - insert(serializer, self.heading_enable); + serializer.insert(heading_enable); - insert(serializer, self.pitch_roll_time_constant); + serializer.insert(pitch_roll_time_constant); - insert(serializer, self.heading_time_constant); + serializer.insert(heading_time_constant); } } -void extract(Serializer& serializer, ComplementaryFilter& self) +void ComplementaryFilter::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.pitch_roll_enable); + serializer.extract(pitch_roll_enable); - extract(serializer, self.heading_enable); + serializer.extract(heading_enable); - extract(serializer, self.pitch_roll_time_constant); + serializer.extract(pitch_roll_time_constant); - extract(serializer, self.heading_time_constant); + serializer.extract(heading_time_constant); } } -void insert(Serializer& serializer, const ComplementaryFilter::Response& self) +void ComplementaryFilter::Response::insert(Serializer& serializer) const { - insert(serializer, self.pitch_roll_enable); + serializer.insert(pitch_roll_enable); - insert(serializer, self.heading_enable); + serializer.insert(heading_enable); - insert(serializer, self.pitch_roll_time_constant); + serializer.insert(pitch_roll_time_constant); - insert(serializer, self.heading_time_constant); + serializer.insert(heading_time_constant); } -void extract(Serializer& serializer, ComplementaryFilter::Response& self) +void ComplementaryFilter::Response::extract(Serializer& serializer) { - extract(serializer, self.pitch_roll_enable); + serializer.extract(pitch_roll_enable); - extract(serializer, self.heading_enable); + serializer.extract(heading_enable); - extract(serializer, self.pitch_roll_time_constant); + serializer.extract(pitch_roll_time_constant); - extract(serializer, self.heading_time_constant); + serializer.extract(heading_time_constant); } @@ -4231,45 +4190,45 @@ TypedResult writeComplementaryFilter(C::mip_interface& devi uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, pitchRollEnable); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(pitchRollEnable); - insert(serializer, headingEnable); + serializer.insert(headingEnable); - insert(serializer, pitchRollTimeConstant); + serializer.insert(pitchRollTimeConstant); - insert(serializer, headingTimeConstant); + serializer.insert(headingTimeConstant); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_LEGACY_COMP_FILTER, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_LEGACY_COMP_FILTER, buffer, (uint8_t)serializer.usedLength()); } TypedResult readComplementaryFilter(C::mip_interface& device, bool* pitchRollEnableOut, bool* headingEnableOut, float* pitchRollTimeConstantOut, float* headingTimeConstantOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_LEGACY_COMP_FILTER, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_LEGACY_COMP_FILTER, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_LEGACY_COMP_FILTER, buffer, (uint8_t)serializer.usedLength(), REPLY_LEGACY_COMP_FILTER, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(pitchRollEnableOut); - extract(deserializer, *pitchRollEnableOut); + deserializer.extract(*pitchRollEnableOut); assert(headingEnableOut); - extract(deserializer, *headingEnableOut); + deserializer.extract(*headingEnableOut); assert(pitchRollTimeConstantOut); - extract(deserializer, *pitchRollTimeConstantOut); + deserializer.extract(*pitchRollTimeConstantOut); assert(headingTimeConstantOut); - extract(deserializer, *headingTimeConstantOut); + deserializer.extract(*headingTimeConstantOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -4281,68 +4240,68 @@ TypedResult saveComplementaryFilter(C::mip_interface& devic uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_LEGACY_COMP_FILTER, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_LEGACY_COMP_FILTER, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadComplementaryFilter(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_LEGACY_COMP_FILTER, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_LEGACY_COMP_FILTER, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultComplementaryFilter(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_LEGACY_COMP_FILTER, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_LEGACY_COMP_FILTER, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const SensorRange& self) +void SensorRange::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - insert(serializer, self.sensor); + serializer.insert(sensor); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.setting); + serializer.insert(setting); } } -void extract(Serializer& serializer, SensorRange& self) +void SensorRange::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - extract(serializer, self.sensor); + serializer.extract(sensor); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.setting); + serializer.extract(setting); } } -void insert(Serializer& serializer, const SensorRange::Response& self) +void SensorRange::Response::insert(Serializer& serializer) const { - insert(serializer, self.sensor); + serializer.insert(sensor); - insert(serializer, self.setting); + serializer.insert(setting); } -void extract(Serializer& serializer, SensorRange::Response& self) +void SensorRange::Response::extract(Serializer& serializer) { - extract(serializer, self.sensor); + serializer.extract(sensor); - extract(serializer, self.setting); + serializer.extract(setting); } @@ -4351,36 +4310,36 @@ TypedResult writeSensorRange(C::mip_interface& device, SensorRangeT uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, sensor); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(sensor); - insert(serializer, setting); + serializer.insert(setting); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR_RANGE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR_RANGE, buffer, (uint8_t)serializer.usedLength()); } TypedResult readSensorRange(C::mip_interface& device, SensorRangeType sensor, uint8_t* settingOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); - insert(serializer, sensor); + serializer.insert(FunctionSelector::READ); + serializer.insert(sensor); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_SENSOR_RANGE, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_SENSOR_RANGE, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_SENSOR_RANGE, buffer, (uint8_t)serializer.usedLength(), REPLY_SENSOR_RANGE, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - extract(deserializer, sensor); + deserializer.extract(sensor); assert(settingOut); - extract(deserializer, *settingOut); + deserializer.extract(*settingOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -4392,80 +4351,80 @@ TypedResult saveSensorRange(C::mip_interface& device, SensorRangeTy uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); - insert(serializer, sensor); + serializer.insert(FunctionSelector::SAVE); + serializer.insert(sensor); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR_RANGE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR_RANGE, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadSensorRange(C::mip_interface& device, SensorRangeType sensor) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); - insert(serializer, sensor); + serializer.insert(FunctionSelector::LOAD); + serializer.insert(sensor); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR_RANGE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR_RANGE, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultSensorRange(C::mip_interface& device, SensorRangeType sensor) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); - insert(serializer, sensor); + serializer.insert(FunctionSelector::RESET); + serializer.insert(sensor); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR_RANGE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR_RANGE, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const CalibratedSensorRanges& self) +void CalibratedSensorRanges::Entry::insert(Serializer& serializer) const { - insert(serializer, self.sensor); + serializer.insert(setting); + + serializer.insert(range); } -void extract(Serializer& serializer, CalibratedSensorRanges& self) +void CalibratedSensorRanges::Entry::extract(Serializer& serializer) { - extract(serializer, self.sensor); + serializer.extract(setting); + + serializer.extract(range); } -void insert(Serializer& serializer, const CalibratedSensorRanges::Response& self) +void CalibratedSensorRanges::insert(Serializer& serializer) const { - insert(serializer, self.sensor); - - insert(serializer, self.num_ranges); - - for(unsigned int i=0; i < self.num_ranges; i++) - insert(serializer, self.ranges[i]); + serializer.insert(sensor); } -void extract(Serializer& serializer, CalibratedSensorRanges::Response& self) +void CalibratedSensorRanges::extract(Serializer& serializer) { - extract(serializer, self.sensor); - - C::extract_count(&serializer, &self.num_ranges, sizeof(self.ranges)/sizeof(self.ranges[0])); - for(unsigned int i=0; i < self.num_ranges; i++) - extract(serializer, self.ranges[i]); + serializer.extract(sensor); } -void insert(Serializer& serializer, const CalibratedSensorRanges::Entry& self) +void CalibratedSensorRanges::Response::insert(Serializer& serializer) const { - insert(serializer, self.setting); + serializer.insert(sensor); + + serializer.insert(num_ranges); - insert(serializer, self.range); + for(unsigned int i=0; i < num_ranges; i++) + serializer.insert(ranges[i]); } -void extract(Serializer& serializer, CalibratedSensorRanges::Entry& self) +void CalibratedSensorRanges::Response::extract(Serializer& serializer) { - extract(serializer, self.setting); + serializer.extract(sensor); - extract(serializer, self.range); + serializer.extract_count(num_ranges, sizeof(ranges)/sizeof(ranges[0])); + for(unsigned int i=0; i < num_ranges; i++) + serializer.extract(ranges[i]); } @@ -4474,90 +4433,90 @@ TypedResult calibratedSensorRanges(C::mip_interface& dev uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, sensor); + serializer.insert(sensor); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_CALIBRATED_RANGES, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_CALIBRATED_RANGES, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_CALIBRATED_RANGES, buffer, (uint8_t)serializer.usedLength(), REPLY_CALIBRATED_RANGES, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - extract(deserializer, sensor); + deserializer.extract(sensor); - C::extract_count(&deserializer, numRangesOut, numRangesOutMax); + deserializer.extract_count(*numRangesOut, numRangesOutMax); assert(rangesOut || (numRangesOut == 0)); for(unsigned int i=0; i < *numRangesOut; i++) - extract(deserializer, rangesOut[i]); + deserializer.extract(rangesOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; } return result; } -void insert(Serializer& serializer, const LowpassFilter& self) +void LowpassFilter::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - insert(serializer, self.desc_set); + serializer.insert(desc_set); - insert(serializer, self.field_desc); + serializer.insert(field_desc); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.enable); + serializer.insert(enable); - insert(serializer, self.manual); + serializer.insert(manual); - insert(serializer, self.frequency); + serializer.insert(frequency); } } -void extract(Serializer& serializer, LowpassFilter& self) +void LowpassFilter::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - extract(serializer, self.desc_set); + serializer.extract(desc_set); - extract(serializer, self.field_desc); + serializer.extract(field_desc); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.enable); + serializer.extract(enable); - extract(serializer, self.manual); + serializer.extract(manual); - extract(serializer, self.frequency); + serializer.extract(frequency); } } -void insert(Serializer& serializer, const LowpassFilter::Response& self) +void LowpassFilter::Response::insert(Serializer& serializer) const { - insert(serializer, self.desc_set); + serializer.insert(desc_set); - insert(serializer, self.field_desc); + serializer.insert(field_desc); - insert(serializer, self.enable); + serializer.insert(enable); - insert(serializer, self.manual); + serializer.insert(manual); - insert(serializer, self.frequency); + serializer.insert(frequency); } -void extract(Serializer& serializer, LowpassFilter::Response& self) +void LowpassFilter::Response::extract(Serializer& serializer) { - extract(serializer, self.desc_set); + serializer.extract(desc_set); - extract(serializer, self.field_desc); + serializer.extract(field_desc); - extract(serializer, self.enable); + serializer.extract(enable); - extract(serializer, self.manual); + serializer.extract(manual); - extract(serializer, self.frequency); + serializer.extract(frequency); } @@ -4566,52 +4525,52 @@ TypedResult writeLowpassFilter(C::mip_interface& device, uint8_t uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, descSet); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(descSet); - insert(serializer, fieldDesc); + serializer.insert(fieldDesc); - insert(serializer, enable); + serializer.insert(enable); - insert(serializer, manual); + serializer.insert(manual); - insert(serializer, frequency); + serializer.insert(frequency); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_LOWPASS_FILTER, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_LOWPASS_FILTER, buffer, (uint8_t)serializer.usedLength()); } TypedResult readLowpassFilter(C::mip_interface& device, uint8_t descSet, uint8_t fieldDesc, bool* enableOut, bool* manualOut, float* frequencyOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); - insert(serializer, descSet); + serializer.insert(FunctionSelector::READ); + serializer.insert(descSet); - insert(serializer, fieldDesc); + serializer.insert(fieldDesc); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_LOWPASS_FILTER, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_LOWPASS_FILTER, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_LOWPASS_FILTER, buffer, (uint8_t)serializer.usedLength(), REPLY_LOWPASS_FILTER, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - extract(deserializer, descSet); + deserializer.extract(descSet); - extract(deserializer, fieldDesc); + deserializer.extract(fieldDesc); assert(enableOut); - extract(deserializer, *enableOut); + deserializer.extract(*enableOut); assert(manualOut); - extract(deserializer, *manualOut); + deserializer.extract(*manualOut); assert(frequencyOut); - extract(deserializer, *frequencyOut); + deserializer.extract(*frequencyOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -4623,42 +4582,42 @@ TypedResult saveLowpassFilter(C::mip_interface& device, uint8_t d uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); - insert(serializer, descSet); + serializer.insert(FunctionSelector::SAVE); + serializer.insert(descSet); - insert(serializer, fieldDesc); + serializer.insert(fieldDesc); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_LOWPASS_FILTER, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_LOWPASS_FILTER, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadLowpassFilter(C::mip_interface& device, uint8_t descSet, uint8_t fieldDesc) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); - insert(serializer, descSet); + serializer.insert(FunctionSelector::LOAD); + serializer.insert(descSet); - insert(serializer, fieldDesc); + serializer.insert(fieldDesc); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_LOWPASS_FILTER, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_LOWPASS_FILTER, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultLowpassFilter(C::mip_interface& device, uint8_t descSet, uint8_t fieldDesc) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); - insert(serializer, descSet); + serializer.insert(FunctionSelector::RESET); + serializer.insert(descSet); - insert(serializer, fieldDesc); + serializer.insert(fieldDesc); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_LOWPASS_FILTER, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_LOWPASS_FILTER, buffer, (uint8_t)serializer.usedLength()); } } // namespace commands_3dm diff --git a/src/mip/definitions/commands_3dm.hpp b/src/cpp/mip/definitions/commands_3dm.hpp similarity index 78% rename from src/mip/definitions/commands_3dm.hpp rename to src/cpp/mip/definitions/commands_3dm.hpp index 5d771bd68..f45238309 100644 --- a/src/mip/definitions/commands_3dm.hpp +++ b/src/cpp/mip/definitions/commands_3dm.hpp @@ -1,16 +1,14 @@ #pragma once -#include "common.h" -#include "descriptors.h" -#include "../mip_result.h" +#include +#include +#include +#include #include #include -#include namespace mip { -class Serializer; - namespace C { struct mip_interface; } // namespace C @@ -18,9 +16,9 @@ struct mip_interface; namespace commands_3dm { //////////////////////////////////////////////////////////////////////////////// -///@addtogroup MipCommands_cpp MIP Commands [CPP] +///@addtogroup MipCommands_cpp ///@{ -///@defgroup 3dm_commands_cpp 3dm Commands [CPP] +///@defgroup 3dm_commands_cpp 3dm Commands /// ///@{ @@ -168,15 +166,17 @@ struct NmeaMessage GLONASS = 4, ///< NMEA message will be produced with talker id "GL". }; + /// Parameters MessageID message_id = static_cast(0); ///< NMEA sentence type. TalkerID talker_id = static_cast(0); ///< NMEA talker ID. Ignored for proprietary sentences. uint8_t source_desc_set = 0; ///< Data descriptor set where the data will be sourced. Available options depend on the sentence. uint16_t decimation = 0; ///< Decimation from the base rate for source_desc_set. Frequency is limited to 10 Hz or the base rate, whichever is lower. Must be 0 when polling. + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const NmeaMessage& self); -void extract(Serializer& serializer, NmeaMessage& self); - enum class SensorRangeType : uint8_t { ALL = 0, ///< Only allowed for SAVE, LOAD, and DEFAULT function selectors. @@ -192,7 +192,7 @@ enum class SensorRangeType : uint8_t //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_poll_imu_message (0x0C,0x01) Poll Imu Message [CPP] +///@defgroup 3dm_poll_imu_message_cpp (0x0C,0x01) Poll Imu Message /// Poll the device for an IMU message with the specified format /// /// This function polls for an IMU message using the provided format. The resulting message @@ -206,39 +206,41 @@ enum class SensorRangeType : uint8_t struct PollImuMessage { + /// Parameters bool suppress_ack = 0; ///< Suppress the usual ACK/NACK reply. uint8_t num_descriptors = 0; ///< Number of descriptors in the descriptor list. DescriptorRate descriptors[83]; ///< Descriptor list. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_POLL_IMU_MESSAGE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "PollImuMessage"; static constexpr const char* DOC_NAME = "PollImuMessage"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000030; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(suppress_ack,num_descriptors,descriptors); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(suppress_ack),std::ref(num_descriptors),std::ref(descriptors)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + typedef void Response; }; -void insert(Serializer& serializer, const PollImuMessage& self); -void extract(Serializer& serializer, PollImuMessage& self); - TypedResult pollImuMessage(C::mip_interface& device, bool suppressAck, uint8_t numDescriptors, const DescriptorRate* descriptors); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_poll_gnss_message (0x0C,0x02) Poll Gnss Message [CPP] +///@defgroup 3dm_poll_gnss_message_cpp (0x0C,0x02) Poll Gnss Message /// Poll the device for an GNSS message with the specified format /// /// This function polls for a GNSS message using the provided format. The resulting message @@ -252,39 +254,41 @@ TypedResult pollImuMessage(C::mip_interface& device, bool suppre struct PollGnssMessage { + /// Parameters bool suppress_ack = 0; ///< Suppress the usual ACK/NACK reply. uint8_t num_descriptors = 0; ///< Number of descriptors in the descriptor list. DescriptorRate descriptors[83]; ///< Descriptor list. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_POLL_GNSS_MESSAGE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "PollGnssMessage"; static constexpr const char* DOC_NAME = "PollGnssMessage"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000030; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(suppress_ack,num_descriptors,descriptors); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(suppress_ack),std::ref(num_descriptors),std::ref(descriptors)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + typedef void Response; }; -void insert(Serializer& serializer, const PollGnssMessage& self); -void extract(Serializer& serializer, PollGnssMessage& self); - TypedResult pollGnssMessage(C::mip_interface& device, bool suppressAck, uint8_t numDescriptors, const DescriptorRate* descriptors); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_poll_filter_message (0x0C,0x03) Poll Filter Message [CPP] +///@defgroup 3dm_poll_filter_message_cpp (0x0C,0x03) Poll Filter Message /// Poll the device for an Estimation Filter message with the specified format /// /// This function polls for an Estimation Filter message using the provided format. The resulting message @@ -298,39 +302,41 @@ TypedResult pollGnssMessage(C::mip_interface& device, bool supp struct PollFilterMessage { + /// Parameters bool suppress_ack = 0; ///< Suppress the usual ACK/NACK reply. uint8_t num_descriptors = 0; ///< Number of descriptors in the format list. DescriptorRate descriptors[83]; ///< Descriptor format list. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_POLL_FILTER_MESSAGE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "PollFilterMessage"; static constexpr const char* DOC_NAME = "PollFilterMessage"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000030; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(suppress_ack,num_descriptors,descriptors); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(suppress_ack),std::ref(num_descriptors),std::ref(descriptors)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + typedef void Response; }; -void insert(Serializer& serializer, const PollFilterMessage& self); -void extract(Serializer& serializer, PollFilterMessage& self); - TypedResult pollFilterMessage(C::mip_interface& device, bool suppressAck, uint8_t numDescriptors, const DescriptorRate* descriptors); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_imu_message_format (0x0C,0x08) Imu Message Format [CPP] +///@defgroup 3dm_imu_message_format_cpp (0x0C,0x08) Imu Message Format /// Set, read, or save the format of the IMU data packet. /// /// The resulting data messages will maintain the order of descriptors sent in the command. @@ -339,31 +345,25 @@ TypedResult pollFilterMessage(C::mip_interface& device, bool struct ImuMessageFormat { + /// Parameters FunctionSelector function = static_cast(0); uint8_t num_descriptors = 0; ///< Number of descriptors DescriptorRate descriptors[82]; ///< Descriptor format list. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_IMU_MESSAGE_FORMAT; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ImuMessageFormat"; static constexpr const char* DOC_NAME = "ImuMessageFormat"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8003; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x0000000C; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(num_descriptors,descriptors); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(num_descriptors),std::ref(descriptors)); } @@ -375,32 +375,40 @@ struct ImuMessageFormat return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint8_t num_descriptors = 0; ///< Number of descriptors + DescriptorRate descriptors[82]; ///< Descriptor format list. + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_IMU_MESSAGE_FORMAT; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ImuMessageFormat::Response"; static constexpr const char* DOC_NAME = "ImuMessageFormat Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x0000000C; - uint8_t num_descriptors = 0; ///< Number of descriptors - DescriptorRate descriptors[82]; ///< Descriptor format list. - + auto asTuple() const + { + return std::make_tuple(num_descriptors,descriptors); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(num_descriptors),std::ref(descriptors)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const ImuMessageFormat& self); -void extract(Serializer& serializer, ImuMessageFormat& self); - -void insert(Serializer& serializer, const ImuMessageFormat::Response& self); -void extract(Serializer& serializer, ImuMessageFormat::Response& self); - TypedResult writeImuMessageFormat(C::mip_interface& device, uint8_t numDescriptors, const DescriptorRate* descriptors); TypedResult readImuMessageFormat(C::mip_interface& device, uint8_t* numDescriptorsOut, uint8_t numDescriptorsOutMax, DescriptorRate* descriptorsOut); TypedResult saveImuMessageFormat(C::mip_interface& device); @@ -410,7 +418,7 @@ TypedResult defaultImuMessageFormat(C::mip_interface& device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_gps_message_format (0x0C,0x09) Gps Message Format [CPP] +///@defgroup 3dm_gps_message_format_cpp (0x0C,0x09) Gps Message Format /// Set, read, or save the format of the GNSS data packet. /// /// The resulting data messages will maintain the order of descriptors sent in the command. @@ -419,31 +427,25 @@ TypedResult defaultImuMessageFormat(C::mip_interface& device); struct GpsMessageFormat { + /// Parameters FunctionSelector function = static_cast(0); uint8_t num_descriptors = 0; ///< Number of descriptors DescriptorRate descriptors[82]; ///< Descriptor format list. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_GNSS_MESSAGE_FORMAT; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GpsMessageFormat"; static constexpr const char* DOC_NAME = "GpsMessageFormat"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8003; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x0000000C; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(num_descriptors,descriptors); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(num_descriptors),std::ref(descriptors)); } @@ -455,32 +457,40 @@ struct GpsMessageFormat return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint8_t num_descriptors = 0; ///< Number of descriptors + DescriptorRate descriptors[82]; ///< Descriptor format list. + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_GNSS_MESSAGE_FORMAT; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GpsMessageFormat::Response"; static constexpr const char* DOC_NAME = "GpsMessageFormat Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x0000000C; - uint8_t num_descriptors = 0; ///< Number of descriptors - DescriptorRate descriptors[82]; ///< Descriptor format list. - + auto asTuple() const + { + return std::make_tuple(num_descriptors,descriptors); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(num_descriptors),std::ref(descriptors)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const GpsMessageFormat& self); -void extract(Serializer& serializer, GpsMessageFormat& self); - -void insert(Serializer& serializer, const GpsMessageFormat::Response& self); -void extract(Serializer& serializer, GpsMessageFormat::Response& self); - TypedResult writeGpsMessageFormat(C::mip_interface& device, uint8_t numDescriptors, const DescriptorRate* descriptors); TypedResult readGpsMessageFormat(C::mip_interface& device, uint8_t* numDescriptorsOut, uint8_t numDescriptorsOutMax, DescriptorRate* descriptorsOut); TypedResult saveGpsMessageFormat(C::mip_interface& device); @@ -490,7 +500,7 @@ TypedResult defaultGpsMessageFormat(C::mip_interface& device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_filter_message_format (0x0C,0x0A) Filter Message Format [CPP] +///@defgroup 3dm_filter_message_format_cpp (0x0C,0x0A) Filter Message Format /// Set, read, or save the format of the Estimation Filter data packet. /// /// The resulting data messages will maintain the order of descriptors sent in the command. @@ -499,31 +509,25 @@ TypedResult defaultGpsMessageFormat(C::mip_interface& device); struct FilterMessageFormat { + /// Parameters FunctionSelector function = static_cast(0); uint8_t num_descriptors = 0; ///< Number of descriptors (limited by payload size) DescriptorRate descriptors[82]; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_FILTER_MESSAGE_FORMAT; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "FilterMessageFormat"; static constexpr const char* DOC_NAME = "FilterMessageFormat"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8003; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x0000000C; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(num_descriptors,descriptors); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(num_descriptors),std::ref(descriptors)); } @@ -535,32 +539,40 @@ struct FilterMessageFormat return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint8_t num_descriptors = 0; ///< Number of descriptors (limited by payload size) + DescriptorRate descriptors[82]; + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_FILTER_MESSAGE_FORMAT; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "FilterMessageFormat::Response"; static constexpr const char* DOC_NAME = "FilterMessageFormat Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x0000000C; - uint8_t num_descriptors = 0; ///< Number of descriptors (limited by payload size) - DescriptorRate descriptors[82]; - + auto asTuple() const + { + return std::make_tuple(num_descriptors,descriptors); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(num_descriptors),std::ref(descriptors)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const FilterMessageFormat& self); -void extract(Serializer& serializer, FilterMessageFormat& self); - -void insert(Serializer& serializer, const FilterMessageFormat::Response& self); -void extract(Serializer& serializer, FilterMessageFormat::Response& self); - TypedResult writeFilterMessageFormat(C::mip_interface& device, uint8_t numDescriptors, const DescriptorRate* descriptors); TypedResult readFilterMessageFormat(C::mip_interface& device, uint8_t* numDescriptorsOut, uint8_t numDescriptorsOutMax, DescriptorRate* descriptorsOut); TypedResult saveFilterMessageFormat(C::mip_interface& device); @@ -570,7 +582,7 @@ TypedResult defaultFilterMessageFormat(C::mip_interface& de ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_imu_get_base_rate (0x0C,0x06) Imu Get Base Rate [CPP] +///@defgroup 3dm_imu_get_base_rate_cpp (0x0C,0x06) Imu Get Base Rate /// Get the base rate for the IMU data in Hz /// /// This is the fastest rate for this type of data available on the device. @@ -580,57 +592,63 @@ TypedResult defaultFilterMessageFormat(C::mip_interface& de struct ImuGetBaseRate { - + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_GET_IMU_BASE_RATE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ImuGetBaseRate"; static constexpr const char* DOC_NAME = "Get IMU Data Base Rate"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(); } - auto as_tuple() + auto asTuple() { return std::make_tuple(); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint16_t rate = 0; ///< [hz] + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_IMU_BASE_RATE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ImuGetBaseRate::Response"; static constexpr const char* DOC_NAME = "Get IMU Data Base Rate Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - uint16_t rate = 0; ///< [hz] - + auto asTuple() const + { + return std::make_tuple(rate); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(rate)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const ImuGetBaseRate& self); -void extract(Serializer& serializer, ImuGetBaseRate& self); - -void insert(Serializer& serializer, const ImuGetBaseRate::Response& self); -void extract(Serializer& serializer, ImuGetBaseRate::Response& self); - TypedResult imuGetBaseRate(C::mip_interface& device, uint16_t* rateOut); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_gps_get_base_rate (0x0C,0x07) Gps Get Base Rate [CPP] +///@defgroup 3dm_gps_get_base_rate_cpp (0x0C,0x07) Gps Get Base Rate /// Get the base rate for the GNSS data in Hz /// /// This is the fastest rate for this type of data available on the device. @@ -640,57 +658,63 @@ TypedResult imuGetBaseRate(C::mip_interface& device, uint16_t* r struct GpsGetBaseRate { - + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_GET_GNSS_BASE_RATE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GpsGetBaseRate"; static constexpr const char* DOC_NAME = "Get GNSS Data Base Rate"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(); } - auto as_tuple() + auto asTuple() { return std::make_tuple(); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint16_t rate = 0; ///< [hz] + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_GNSS_BASE_RATE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GpsGetBaseRate::Response"; static constexpr const char* DOC_NAME = "Get GNSS Data Base Rate Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - uint16_t rate = 0; ///< [hz] - + auto asTuple() const + { + return std::make_tuple(rate); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(rate)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const GpsGetBaseRate& self); -void extract(Serializer& serializer, GpsGetBaseRate& self); - -void insert(Serializer& serializer, const GpsGetBaseRate::Response& self); -void extract(Serializer& serializer, GpsGetBaseRate::Response& self); - TypedResult gpsGetBaseRate(C::mip_interface& device, uint16_t* rateOut); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_filter_get_base_rate (0x0C,0x0B) Filter Get Base Rate [CPP] +///@defgroup 3dm_filter_get_base_rate_cpp (0x0C,0x0B) Filter Get Base Rate /// Get the base rate for the Estimation Filter data in Hz /// /// This is the fastest rate for this type of data available on the device. @@ -700,57 +724,63 @@ TypedResult gpsGetBaseRate(C::mip_interface& device, uint16_t* r struct FilterGetBaseRate { - + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_GET_FILTER_BASE_RATE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "FilterGetBaseRate"; static constexpr const char* DOC_NAME = "Get Estimation Filter Data Base Rate"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(); } - auto as_tuple() + auto asTuple() { return std::make_tuple(); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint16_t rate = 0; ///< [hz] + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_FILTER_BASE_RATE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "FilterGetBaseRate::Response"; static constexpr const char* DOC_NAME = "Get Estimation Filter Data Base Rate Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - uint16_t rate = 0; ///< [hz] - + auto asTuple() const + { + return std::make_tuple(rate); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(rate)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const FilterGetBaseRate& self); -void extract(Serializer& serializer, FilterGetBaseRate& self); - -void insert(Serializer& serializer, const FilterGetBaseRate::Response& self); -void extract(Serializer& serializer, FilterGetBaseRate::Response& self); - TypedResult filterGetBaseRate(C::mip_interface& device, uint16_t* rateOut); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_poll_data (0x0C,0x0D) Poll Data [CPP] +///@defgroup 3dm_poll_data_cpp (0x0C,0x0D) Poll Data /// Poll the device for a message with the specified descriptor set and format. /// /// This function polls for a message using the provided format. The resulting message @@ -764,99 +794,109 @@ TypedResult filterGetBaseRate(C::mip_interface& device, uint1 struct PollData { + /// Parameters uint8_t desc_set = 0; ///< Data descriptor set. Must be supported. bool suppress_ack = 0; ///< Suppress the usual ACK/NACK reply. uint8_t num_descriptors = 0; ///< Number of descriptors in the format list. uint8_t descriptors[82] = {0}; ///< Descriptor format list. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_POLL_DATA; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "PollData"; static constexpr const char* DOC_NAME = "PollData"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t COUNTER_PARAMS = 0x000000C0; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(desc_set,suppress_ack,num_descriptors,descriptors); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(desc_set),std::ref(suppress_ack),std::ref(num_descriptors),std::ref(descriptors)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + typedef void Response; }; -void insert(Serializer& serializer, const PollData& self); -void extract(Serializer& serializer, PollData& self); - TypedResult pollData(C::mip_interface& device, uint8_t descSet, bool suppressAck, uint8_t numDescriptors, const uint8_t* descriptors); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_get_base_rate (0x0C,0x0E) Get Base Rate [CPP] +///@defgroup 3dm_get_base_rate_cpp (0x0C,0x0E) Get Base Rate /// Get the base rate for the specified descriptor set in Hz. /// ///@{ struct GetBaseRate { + /// Parameters uint8_t desc_set = 0; ///< This is the data descriptor set. It must be a supported descriptor. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_GET_BASE_RATE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GetBaseRate"; static constexpr const char* DOC_NAME = "Get Data Base Rate"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0001; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(desc_set); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(desc_set)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint8_t desc_set = 0; ///< Echoes the parameter in the command. + uint16_t rate = 0; ///< Base rate in Hz (0 = variable, unknown, or user-defined rate. Data will be sent when received). + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_BASE_RATE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GetBaseRate::Response"; static constexpr const char* DOC_NAME = "Get Data Base Rate Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0001; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - uint8_t desc_set = 0; ///< Echoes the parameter in the command. - uint16_t rate = 0; ///< Base rate in Hz (0 = variable, unknown, or user-defined rate. Data will be sent when received). - + auto asTuple() const + { + return std::make_tuple(desc_set,rate); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(desc_set),std::ref(rate)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const GetBaseRate& self); -void extract(Serializer& serializer, GetBaseRate& self); - -void insert(Serializer& serializer, const GetBaseRate::Response& self); -void extract(Serializer& serializer, GetBaseRate::Response& self); - TypedResult getBaseRate(C::mip_interface& device, uint8_t descSet, uint16_t* rateOut); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_message_format (0x0C,0x0F) Message Format [CPP] +///@defgroup 3dm_message_format_cpp (0x0C,0x0F) Message Format /// Set, read, or save the format for a given data packet. /// /// The resulting data messages will maintain the order of descriptors sent in the command. @@ -865,32 +905,26 @@ TypedResult getBaseRate(C::mip_interface& device, uint8_t descSet, struct MessageFormat { + /// Parameters FunctionSelector function = static_cast(0); uint8_t desc_set = 0; ///< Data descriptor set. Must be supported. When function is SAVE, LOAD, or DEFAULT, can be 0 to apply to all descriptor sets. uint8_t num_descriptors = 0; ///< Number of descriptors (limited by payload size) DescriptorRate descriptors[82]; ///< List of descriptors and decimations. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_MESSAGE_FORMAT; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "MessageFormat"; static constexpr const char* DOC_NAME = "MessageFormat"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8007; - static constexpr const uint32_t READ_PARAMS = 0x8001; - static constexpr const uint32_t SAVE_PARAMS = 0x8001; - static constexpr const uint32_t LOAD_PARAMS = 0x8001; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8001; - static constexpr const uint32_t ECHOED_PARAMS = 0x0001; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000030; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(desc_set,num_descriptors,descriptors); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(desc_set),std::ref(num_descriptors),std::ref(descriptors)); } @@ -903,33 +937,41 @@ struct MessageFormat return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint8_t desc_set = 0; ///< Echoes the descriptor set from the command. + uint8_t num_descriptors = 0; ///< Number of descriptors in the list. + DescriptorRate descriptors[82]; ///< List of descriptors and decimations. + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_MESSAGE_FORMAT; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "MessageFormat::Response"; static constexpr const char* DOC_NAME = "MessageFormat Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0001; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000030; - uint8_t desc_set = 0; ///< Echoes the descriptor set from the command. - uint8_t num_descriptors = 0; ///< Number of descriptors in the list. - DescriptorRate descriptors[82]; ///< List of descriptors and decimations. - + auto asTuple() const + { + return std::make_tuple(desc_set,num_descriptors,descriptors); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(desc_set),std::ref(num_descriptors),std::ref(descriptors)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const MessageFormat& self); -void extract(Serializer& serializer, MessageFormat& self); - -void insert(Serializer& serializer, const MessageFormat::Response& self); -void extract(Serializer& serializer, MessageFormat::Response& self); - TypedResult writeMessageFormat(C::mip_interface& device, uint8_t descSet, uint8_t numDescriptors, const DescriptorRate* descriptors); TypedResult readMessageFormat(C::mip_interface& device, uint8_t descSet, uint8_t* numDescriptorsOut, uint8_t numDescriptorsOutMax, DescriptorRate* descriptorsOut); TypedResult saveMessageFormat(C::mip_interface& device, uint8_t descSet); @@ -939,7 +981,7 @@ TypedResult defaultMessageFormat(C::mip_interface& device, uint8_ ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_nmea_poll_data (0x0C,0x04) Nmea Poll Data [CPP] +///@defgroup 3dm_nmea_poll_data_cpp (0x0C,0x04) Nmea Poll Data /// Poll the device for a NMEA message with the specified format. /// /// This function polls for a NMEA message using the provided format. @@ -952,70 +994,66 @@ TypedResult defaultMessageFormat(C::mip_interface& device, uint8_ struct NmeaPollData { + /// Parameters bool suppress_ack = 0; ///< Suppress the usual ACK/NACK reply. uint8_t count = 0; ///< Number of format entries (limited by payload size) NmeaMessage format_entries[40]; ///< List of format entries. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_POLL_NMEA_MESSAGE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "NmeaPollData"; static constexpr const char* DOC_NAME = "NmeaPollData"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000030; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(suppress_ack,count,format_entries); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(suppress_ack),std::ref(count),std::ref(format_entries)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + typedef void Response; }; -void insert(Serializer& serializer, const NmeaPollData& self); -void extract(Serializer& serializer, NmeaPollData& self); - TypedResult nmeaPollData(C::mip_interface& device, bool suppressAck, uint8_t count, const NmeaMessage* formatEntries); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_nmea_message_format (0x0C,0x0C) Nmea Message Format [CPP] +///@defgroup 3dm_nmea_message_format_cpp (0x0C,0x0C) Nmea Message Format /// Set, read, or save the NMEA message format. /// ///@{ struct NmeaMessageFormat { + /// Parameters FunctionSelector function = static_cast(0); uint8_t count = 0; ///< Number of format entries (limited by payload size) NmeaMessage format_entries[40]; ///< List of format entries. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_NMEA_MESSAGE_FORMAT; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "NmeaMessageFormat"; static constexpr const char* DOC_NAME = "NmeaMessageFormat"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8003; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x0000000C; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(count,format_entries); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(count),std::ref(format_entries)); } @@ -1027,32 +1065,40 @@ struct NmeaMessageFormat return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint8_t count = 0; ///< Number of format entries (limited by payload size) + NmeaMessage format_entries[40]; ///< List of format entries. + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_NMEA_MESSAGE_FORMAT; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "NmeaMessageFormat::Response"; static constexpr const char* DOC_NAME = "NmeaMessageFormat Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x0000000C; - uint8_t count = 0; ///< Number of format entries (limited by payload size) - NmeaMessage format_entries[40]; ///< List of format entries. - + auto asTuple() const + { + return std::make_tuple(count,format_entries); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(count),std::ref(format_entries)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const NmeaMessageFormat& self); -void extract(Serializer& serializer, NmeaMessageFormat& self); - -void insert(Serializer& serializer, const NmeaMessageFormat::Response& self); -void extract(Serializer& serializer, NmeaMessageFormat::Response& self); - TypedResult writeNmeaMessageFormat(C::mip_interface& device, uint8_t count, const NmeaMessage* formatEntries); TypedResult readNmeaMessageFormat(C::mip_interface& device, uint8_t* countOut, uint8_t countOutMax, NmeaMessage* formatEntriesOut); TypedResult saveNmeaMessageFormat(C::mip_interface& device); @@ -1062,7 +1108,7 @@ TypedResult defaultNmeaMessageFormat(C::mip_interface& device ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_device_settings (0x0C,0x30) Device Settings [CPP] +///@defgroup 3dm_device_settings_cpp (0x0C,0x30) Device Settings /// Save, Load, or Reset to Default the values for all device settings. /// /// When a save current settings command is issued, a brief data disturbance may occur while all settings are written to non-volatile memory. @@ -1073,28 +1119,23 @@ TypedResult defaultNmeaMessageFormat(C::mip_interface& device struct DeviceSettings { + /// Parameters FunctionSelector function = static_cast(0); + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_DEVICE_STARTUP_SETTINGS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "DeviceSettings"; static constexpr const char* DOC_NAME = "DeviceSettings"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x0000; - static constexpr const uint32_t READ_PARAMS = 0x0000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(); } - auto as_tuple() + auto asTuple() { return std::make_tuple(); } @@ -1106,11 +1147,12 @@ struct DeviceSettings return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + typedef void Response; }; -void insert(Serializer& serializer, const DeviceSettings& self); -void extract(Serializer& serializer, DeviceSettings& self); - TypedResult saveDeviceSettings(C::mip_interface& device); TypedResult loadDeviceSettings(C::mip_interface& device); TypedResult defaultDeviceSettings(C::mip_interface& device); @@ -1118,7 +1160,7 @@ TypedResult defaultDeviceSettings(C::mip_interface& device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_uart_baudrate (0x0C,0x40) Uart Baudrate [CPP] +///@defgroup 3dm_uart_baudrate_cpp (0x0C,0x40) Uart Baudrate /// Read, Save, Load, or Reset to Default the baud rate of the main communication channel. /// /// For all functions except 0x01 (use new settings), the new baud rate value is ignored. @@ -1139,30 +1181,24 @@ TypedResult defaultDeviceSettings(C::mip_interface& device); struct UartBaudrate { + /// Parameters FunctionSelector function = static_cast(0); uint32_t baud = 0; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_UART_BAUDRATE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "UartBaudrate"; static constexpr const char* DOC_NAME = "UartBaudrate"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8001; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(baud); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(baud)); } @@ -1174,31 +1210,39 @@ struct UartBaudrate return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint32_t baud = 0; + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_UART_BAUDRATE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "UartBaudrate::Response"; static constexpr const char* DOC_NAME = "UartBaudrate Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - uint32_t baud = 0; - + auto asTuple() const + { + return std::make_tuple(baud); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(baud)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const UartBaudrate& self); -void extract(Serializer& serializer, UartBaudrate& self); - -void insert(Serializer& serializer, const UartBaudrate::Response& self); -void extract(Serializer& serializer, UartBaudrate::Response& self); - TypedResult writeUartBaudrate(C::mip_interface& device, uint32_t baud); TypedResult readUartBaudrate(C::mip_interface& device, uint32_t* baudOut); TypedResult saveUartBaudrate(C::mip_interface& device); @@ -1208,7 +1252,7 @@ TypedResult defaultUartBaudrate(C::mip_interface& device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_factory_streaming (0x0C,0x10) Factory Streaming [CPP] +///@defgroup 3dm_factory_streaming_cpp (0x0C,0x10) Factory Streaming /// Configures the device for recording data for technical support. /// /// This command will configure all available data streams to predefined @@ -1225,38 +1269,40 @@ struct FactoryStreaming ADD = 2, ///< Adds descriptors to the current message format(s) without changing existing descriptors. May result in duplicates. }; + /// Parameters Action action = static_cast(0); uint8_t reserved = 0; ///< Reserved. Set to 0x00. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_CONFIGURE_FACTORY_STREAMING; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "FactoryStreaming"; static constexpr const char* DOC_NAME = "FactoryStreaming"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(action,reserved); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(action),std::ref(reserved)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + typedef void Response; }; -void insert(Serializer& serializer, const FactoryStreaming& self); -void extract(Serializer& serializer, FactoryStreaming& self); - TypedResult factoryStreaming(C::mip_interface& device, FactoryStreaming::Action action, uint8_t reserved); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_datastream_control (0x0C,0x11) Datastream Control [CPP] +///@defgroup 3dm_datastream_control_cpp (0x0C,0x11) Datastream Control /// Enable/disable the selected data stream. /// /// Each data stream (descriptor set) can be enabled or disabled. @@ -1272,31 +1318,25 @@ struct DatastreamControl static constexpr const uint8_t LEGACY_GNSS_STREAM = 0x02; static constexpr const uint8_t LEGACY_FILTER_STREAM = 0x03; static constexpr const uint8_t ALL_STREAMS = 0x00; + /// Parameters FunctionSelector function = static_cast(0); uint8_t desc_set = 0; ///< The descriptor set of the stream to control. When function is SAVE, LOAD, or DEFAULT, can be ALL_STREAMS(0) to apply to all descriptor sets. On Generation 5 products, this must be one of the above legacy constants. bool enable = 0; ///< True or false to enable or disable the stream. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_CONTROL_DATA_STREAM; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "DatastreamControl"; static constexpr const char* DOC_NAME = "DatastreamControl"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8003; - static constexpr const uint32_t READ_PARAMS = 0x8001; - static constexpr const uint32_t SAVE_PARAMS = 0x8001; - static constexpr const uint32_t LOAD_PARAMS = 0x8001; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8001; - static constexpr const uint32_t ECHOED_PARAMS = 0x0001; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(desc_set,enable); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(desc_set),std::ref(enable)); } @@ -1309,32 +1349,40 @@ struct DatastreamControl return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint8_t desc_set = 0; + bool enabled = 0; + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_DATASTREAM_ENABLE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "DatastreamControl::Response"; static constexpr const char* DOC_NAME = "DatastreamControl Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0001; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - uint8_t desc_set = 0; - bool enabled = 0; - + auto asTuple() const + { + return std::make_tuple(desc_set,enabled); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(desc_set),std::ref(enabled)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const DatastreamControl& self); -void extract(Serializer& serializer, DatastreamControl& self); - -void insert(Serializer& serializer, const DatastreamControl::Response& self); -void extract(Serializer& serializer, DatastreamControl::Response& self); - TypedResult writeDatastreamControl(C::mip_interface& device, uint8_t descSet, bool enable); TypedResult readDatastreamControl(C::mip_interface& device, uint8_t descSet, bool* enabledOut); TypedResult saveDatastreamControl(C::mip_interface& device, uint8_t descSet); @@ -1344,7 +1392,7 @@ TypedResult defaultDatastreamControl(C::mip_interface& device ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_constellation_settings (0x0C,0x21) Constellation Settings [CPP] +///@defgroup 3dm_constellation_settings_cpp (0x0C,0x21) Constellation Settings /// This command configures which satellite constellations are enabled and how many channels are dedicated to tracking each constellation. /// /// Maximum number of tracking channels to use (total for all constellations): @@ -1380,6 +1428,7 @@ struct ConstellationSettings struct OptionFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -1397,47 +1446,44 @@ struct ConstellationSettings OptionFlags& operator&=(uint16_t val) { return *this = value & val; } bool l1saif() const { return (value & L1SAIF) > 0; } - void l1saif(bool val) { if(val) value |= L1SAIF; else value &= ~L1SAIF; } - + void l1saif(bool val) { value &= ~L1SAIF; if(val) value |= L1SAIF; } bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - struct Settings { + /// Parameters ConstellationId constellation_id = static_cast(0); ///< Constellation ID uint8_t enable = 0; ///< Enable/Disable constellation uint8_t reserved_channels = 0; ///< Minimum number of channels reserved for this constellation uint8_t max_channels = 0; ///< Maximum number of channels to use for this constallation OptionFlags option_flags; ///< Constellation option Flags + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; + /// Parameters FunctionSelector function = static_cast(0); uint16_t max_channels = 0; uint8_t config_count = 0; Settings settings[42]; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_GNSS_CONSTELLATION_SETTINGS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ConstellationSettings"; static constexpr const char* DOC_NAME = "ConstellationSettings"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8007; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000030; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(max_channels,config_count,settings); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(max_channels),std::ref(config_count),std::ref(settings)); } @@ -1449,37 +1495,42 @@ struct ConstellationSettings return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint16_t max_channels_available = 0; ///< Maximum channels available + uint16_t max_channels_use = 0; ///< Maximum channels to use + uint8_t config_count = 0; ///< Number of constellation configurations + Settings settings[42]; ///< Constellation Settings + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_GNSS_CONSTELLATION_SETTINGS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ConstellationSettings::Response"; static constexpr const char* DOC_NAME = "ConstellationSettings Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x000000C0; - uint16_t max_channels_available = 0; ///< Maximum channels available - uint16_t max_channels_use = 0; ///< Maximum channels to use - uint8_t config_count = 0; ///< Number of constellation configurations - Settings settings[42]; ///< Constellation Settings - + auto asTuple() const + { + return std::make_tuple(max_channels_available,max_channels_use,config_count,settings); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(max_channels_available),std::ref(max_channels_use),std::ref(config_count),std::ref(settings)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const ConstellationSettings& self); -void extract(Serializer& serializer, ConstellationSettings& self); - -void insert(Serializer& serializer, const ConstellationSettings::Settings& self); -void extract(Serializer& serializer, ConstellationSettings::Settings& self); - -void insert(Serializer& serializer, const ConstellationSettings::Response& self); -void extract(Serializer& serializer, ConstellationSettings::Response& self); - TypedResult writeConstellationSettings(C::mip_interface& device, uint16_t maxChannels, uint8_t configCount, const ConstellationSettings::Settings* settings); TypedResult readConstellationSettings(C::mip_interface& device, uint16_t* maxChannelsAvailableOut, uint16_t* maxChannelsUseOut, uint8_t* configCountOut, uint8_t configCountOutMax, ConstellationSettings::Settings* settingsOut); TypedResult saveConstellationSettings(C::mip_interface& device); @@ -1489,7 +1540,7 @@ TypedResult defaultConstellationSettings(C::mip_interface ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_gnss_sbas_settings (0x0C,0x22) Gnss Sbas Settings [CPP] +///@defgroup 3dm_gnss_sbas_settings_cpp (0x0C,0x22) Gnss Sbas Settings /// Configure the SBAS subsystem /// /// @@ -1501,6 +1552,7 @@ struct GnssSbasSettings { struct SBASOptions : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -1520,43 +1572,35 @@ struct GnssSbasSettings SBASOptions& operator&=(uint16_t val) { return *this = value & val; } bool enableRanging() const { return (value & ENABLE_RANGING) > 0; } - void enableRanging(bool val) { if(val) value |= ENABLE_RANGING; else value &= ~ENABLE_RANGING; } + void enableRanging(bool val) { value &= ~ENABLE_RANGING; if(val) value |= ENABLE_RANGING; } bool enableCorrections() const { return (value & ENABLE_CORRECTIONS) > 0; } - void enableCorrections(bool val) { if(val) value |= ENABLE_CORRECTIONS; else value &= ~ENABLE_CORRECTIONS; } + void enableCorrections(bool val) { value &= ~ENABLE_CORRECTIONS; if(val) value |= ENABLE_CORRECTIONS; } bool applyIntegrity() const { return (value & APPLY_INTEGRITY) > 0; } - void applyIntegrity(bool val) { if(val) value |= APPLY_INTEGRITY; else value &= ~APPLY_INTEGRITY; } - + void applyIntegrity(bool val) { value &= ~APPLY_INTEGRITY; if(val) value |= APPLY_INTEGRITY; } bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters FunctionSelector function = static_cast(0); uint8_t enable_sbas = 0; ///< 0 - SBAS Disabled, 1 - SBAS enabled SBASOptions sbas_options; ///< SBAS options, see definition uint8_t num_included_prns = 0; ///< Number of SBAS PRNs to include in search (0 = include all) uint16_t included_prns[39] = {0}; ///< List of specific SBAS PRNs to search for + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_GNSS_SBAS_SETTINGS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GnssSbasSettings"; static constexpr const char* DOC_NAME = "SBAS Settings"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x800F; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x000000C0; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(enable_sbas,sbas_options,num_included_prns,included_prns); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(enable_sbas),std::ref(sbas_options),std::ref(num_included_prns),std::ref(included_prns)); } @@ -1568,34 +1612,42 @@ struct GnssSbasSettings return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint8_t enable_sbas = 0; ///< 0 - SBAS Disabled, 1 - SBAS enabled + SBASOptions sbas_options; ///< SBAS options, see definition + uint8_t num_included_prns = 0; ///< Number of SBAS PRNs to include in search (0 = include all) + uint16_t included_prns[39] = {0}; ///< List of specific SBAS PRNs to search for + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_GNSS_SBAS_SETTINGS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GnssSbasSettings::Response"; static constexpr const char* DOC_NAME = "SBAS Settings Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x000000C0; - uint8_t enable_sbas = 0; ///< 0 - SBAS Disabled, 1 - SBAS enabled - SBASOptions sbas_options; ///< SBAS options, see definition - uint8_t num_included_prns = 0; ///< Number of SBAS PRNs to include in search (0 = include all) - uint16_t included_prns[39] = {0}; ///< List of specific SBAS PRNs to search for - + auto asTuple() const + { + return std::make_tuple(enable_sbas,sbas_options,num_included_prns,included_prns); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(enable_sbas),std::ref(sbas_options),std::ref(num_included_prns),std::ref(included_prns)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const GnssSbasSettings& self); -void extract(Serializer& serializer, GnssSbasSettings& self); - -void insert(Serializer& serializer, const GnssSbasSettings::Response& self); -void extract(Serializer& serializer, GnssSbasSettings::Response& self); - TypedResult writeGnssSbasSettings(C::mip_interface& device, uint8_t enableSbas, GnssSbasSettings::SBASOptions sbasOptions, uint8_t numIncludedPrns, const uint16_t* includedPrns); TypedResult readGnssSbasSettings(C::mip_interface& device, uint8_t* enableSbasOut, GnssSbasSettings::SBASOptions* sbasOptionsOut, uint8_t* numIncludedPrnsOut, uint8_t numIncludedPrnsOutMax, uint16_t* includedPrnsOut); TypedResult saveGnssSbasSettings(C::mip_interface& device); @@ -1605,7 +1657,7 @@ TypedResult defaultGnssSbasSettings(C::mip_interface& device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_gnss_assisted_fix (0x0C,0x23) Gnss Assisted Fix [CPP] +///@defgroup 3dm_gnss_assisted_fix_cpp (0x0C,0x23) Gnss Assisted Fix /// Set the options for assisted GNSS fix. /// /// Devices that implement this command have a dedicated GNSS flash memory and a non-volatile FRAM. @@ -1628,31 +1680,25 @@ struct GnssAssistedFix ENABLED = 1, ///< Enable assisted fix }; + /// Parameters FunctionSelector function = static_cast(0); AssistedFixOption option = static_cast(0); ///< Assisted fix options uint8_t flags = 0; ///< Assisted fix flags (set to 0xFF) + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_GNSS_ASSISTED_FIX_SETTINGS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GnssAssistedFix"; static constexpr const char* DOC_NAME = "GNSS Assisted Fix Settings"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8003; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(option,flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(option),std::ref(flags)); } @@ -1664,32 +1710,40 @@ struct GnssAssistedFix return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + AssistedFixOption option = static_cast(0); ///< Assisted fix options + uint8_t flags = 0; ///< Assisted fix flags (set to 0xFF) + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_GNSS_ASSISTED_FIX_SETTINGS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GnssAssistedFix::Response"; static constexpr const char* DOC_NAME = "GNSS Assisted Fix Settings Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - AssistedFixOption option = static_cast(0); ///< Assisted fix options - uint8_t flags = 0; ///< Assisted fix flags (set to 0xFF) - + auto asTuple() const + { + return std::make_tuple(option,flags); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(option),std::ref(flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const GnssAssistedFix& self); -void extract(Serializer& serializer, GnssAssistedFix& self); - -void insert(Serializer& serializer, const GnssAssistedFix::Response& self); -void extract(Serializer& serializer, GnssAssistedFix::Response& self); - TypedResult writeGnssAssistedFix(C::mip_interface& device, GnssAssistedFix::AssistedFixOption option, uint8_t flags); TypedResult readGnssAssistedFix(C::mip_interface& device, GnssAssistedFix::AssistedFixOption* optionOut, uint8_t* flagsOut); TypedResult saveGnssAssistedFix(C::mip_interface& device); @@ -1699,7 +1753,7 @@ TypedResult defaultGnssAssistedFix(C::mip_interface& device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_gnss_time_assistance (0x0C,0x24) Gnss Time Assistance [CPP] +///@defgroup 3dm_gnss_time_assistance_cpp (0x0C,0x24) Gnss Time Assistance /// Provide the GNSS subsystem with initial time information. /// /// This message is required immediately after power up if GNSS Assist was enabled when the device was powered off. @@ -1709,32 +1763,26 @@ TypedResult defaultGnssAssistedFix(C::mip_interface& device); struct GnssTimeAssistance { + /// Parameters FunctionSelector function = static_cast(0); double tow = 0; ///< GPS Time of week [seconds] uint16_t week_number = 0; ///< GPS Weeks since 1980 [weeks] float accuracy = 0; ///< Accuracy of time information [seconds] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_GNSS_TIME_ASSISTANCE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GnssTimeAssistance"; static constexpr const char* DOC_NAME = "GnssTimeAssistance"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8007; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x0000; - static constexpr const uint32_t LOAD_PARAMS = 0x0000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x0000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(tow,week_number,accuracy); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(tow),std::ref(week_number),std::ref(accuracy)); } @@ -1746,40 +1794,48 @@ struct GnssTimeAssistance return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + double tow = 0; ///< GPS Time of week [seconds] + uint16_t week_number = 0; ///< GPS Weeks since 1980 [weeks] + float accuracy = 0; ///< Accuracy of time information [seconds] + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_GNSS_TIME_ASSISTANCE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GnssTimeAssistance::Response"; static constexpr const char* DOC_NAME = "GnssTimeAssistance Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - double tow = 0; ///< GPS Time of week [seconds] - uint16_t week_number = 0; ///< GPS Weeks since 1980 [weeks] - float accuracy = 0; ///< Accuracy of time information [seconds] - + auto asTuple() const + { + return std::make_tuple(tow,week_number,accuracy); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(tow),std::ref(week_number),std::ref(accuracy)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const GnssTimeAssistance& self); -void extract(Serializer& serializer, GnssTimeAssistance& self); - -void insert(Serializer& serializer, const GnssTimeAssistance::Response& self); -void extract(Serializer& serializer, GnssTimeAssistance::Response& self); - TypedResult writeGnssTimeAssistance(C::mip_interface& device, double tow, uint16_t weekNumber, float accuracy); TypedResult readGnssTimeAssistance(C::mip_interface& device, double* towOut, uint16_t* weekNumberOut, float* accuracyOut); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_imu_lowpass_filter (0x0C,0x50) Imu Lowpass Filter [CPP] +///@defgroup 3dm_imu_lowpass_filter_cpp (0x0C,0x50) Imu Lowpass Filter /// Advanced configuration for the IMU data quantity low-pass filters. /// /// Deprecated, use the lowpass filter (0x0C,0x54) command instead. @@ -1801,6 +1857,7 @@ TypedResult readGnssTimeAssistance(C::mip_interface& device, struct ImuLowpassFilter { + /// Parameters FunctionSelector function = static_cast(0); uint8_t target_descriptor = 0; ///< Field descriptor of filtered quantity within the Sensor data set. Supported values are accel (0x04), gyro (0x05), mag (0x06), and pressure (0x17), provided the data is supported by the device. Except with the READ function selector, this can be 0 to apply to all of the above quantities. bool enable = 0; ///< The target data will be filtered if this is true. @@ -1808,27 +1865,20 @@ struct ImuLowpassFilter uint16_t frequency = 0; ///< -3dB cutoff frequency in Hz. Will not affect filtering if 'manual' is false. uint8_t reserved = 0; ///< Reserved, set to 0x00. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_IMU_LOWPASS_FILTER; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ImuLowpassFilter"; static constexpr const char* DOC_NAME = "Advanced Low-Pass Filter Settings"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x801F; - static constexpr const uint32_t READ_PARAMS = 0x8001; - static constexpr const uint32_t SAVE_PARAMS = 0x8001; - static constexpr const uint32_t LOAD_PARAMS = 0x8001; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8001; - static constexpr const uint32_t ECHOED_PARAMS = 0x0001; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(target_descriptor,enable,manual,frequency,reserved); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(target_descriptor),std::ref(enable),std::ref(manual),std::ref(frequency),std::ref(reserved)); } @@ -1841,35 +1891,43 @@ struct ImuLowpassFilter return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { - static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; - static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_ADVANCED_DATA_FILTER; - static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; - static constexpr const char* NAME = "ImuLowpassFilter::Response"; - static constexpr const char* DOC_NAME = "Advanced Low-Pass Filter Settings Response"; - - static constexpr const uint32_t ECHOED_PARAMS = 0x0001; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; + /// Parameters uint8_t target_descriptor = 0; bool enable = 0; ///< True if the filter is currently enabled. bool manual = 0; ///< True if the filter cutoff was manually configured. uint16_t frequency = 0; ///< The cutoff frequency of the filter. If the filter is in auto mode, this value is unspecified. uint8_t reserved = 0; ///< Reserved and must be ignored. + /// Descriptors + static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; + static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_ADVANCED_DATA_FILTER; + static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; + static constexpr const char* NAME = "ImuLowpassFilter::Response"; + static constexpr const char* DOC_NAME = "Advanced Low-Pass Filter Settings Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; + + auto asTuple() const + { + return std::make_tuple(target_descriptor,enable,manual,frequency,reserved); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(target_descriptor),std::ref(enable),std::ref(manual),std::ref(frequency),std::ref(reserved)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const ImuLowpassFilter& self); -void extract(Serializer& serializer, ImuLowpassFilter& self); - -void insert(Serializer& serializer, const ImuLowpassFilter::Response& self); -void extract(Serializer& serializer, ImuLowpassFilter::Response& self); - TypedResult writeImuLowpassFilter(C::mip_interface& device, uint8_t targetDescriptor, bool enable, bool manual, uint16_t frequency, uint8_t reserved); TypedResult readImuLowpassFilter(C::mip_interface& device, uint8_t targetDescriptor, bool* enableOut, bool* manualOut, uint16_t* frequencyOut, uint8_t* reservedOut); TypedResult saveImuLowpassFilter(C::mip_interface& device, uint8_t targetDescriptor); @@ -1879,7 +1937,7 @@ TypedResult defaultImuLowpassFilter(C::mip_interface& device, ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_pps_source (0x0C,0x28) Pps Source [CPP] +///@defgroup 3dm_pps_source_cpp (0x0C,0x28) Pps Source /// Controls the Pulse Per Second (PPS) source. /// ///@{ @@ -1895,30 +1953,24 @@ struct PpsSource GENERATED = 4, ///< PPS is generated from the system oscillator. }; + /// Parameters FunctionSelector function = static_cast(0); Source source = static_cast(0); + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_PPS_SOURCE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "PpsSource"; static constexpr const char* DOC_NAME = "PpsSource"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8001; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(source); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(source)); } @@ -1930,31 +1982,39 @@ struct PpsSource return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + Source source = static_cast(0); + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_PPS_SOURCE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "PpsSource::Response"; static constexpr const char* DOC_NAME = "PpsSource Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - Source source = static_cast(0); - + auto asTuple() const + { + return std::make_tuple(source); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(source)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const PpsSource& self); -void extract(Serializer& serializer, PpsSource& self); - -void insert(Serializer& serializer, const PpsSource::Response& self); -void extract(Serializer& serializer, PpsSource::Response& self); - TypedResult writePpsSource(C::mip_interface& device, PpsSource::Source source); TypedResult readPpsSource(C::mip_interface& device, PpsSource::Source* sourceOut); TypedResult savePpsSource(C::mip_interface& device); @@ -1964,7 +2024,7 @@ TypedResult defaultPpsSource(C::mip_interface& device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_gpio_config (0x0C,0x41) Gpio Config [CPP] +///@defgroup 3dm_gpio_config_cpp (0x0C,0x41) Gpio Config /// Configures the user GPIO pins on the connector for use with several built-in functions or for general input or output. /// /// GPIO pins are device-dependent. Some features are only available on @@ -2018,6 +2078,7 @@ struct GpioConfig struct PinMode : Bitfield { + typedef uint8_t Type; enum _enumType : uint8_t { NONE = 0x00, @@ -2037,43 +2098,35 @@ struct GpioConfig PinMode& operator&=(uint8_t val) { return *this = value & val; } bool openDrain() const { return (value & OPEN_DRAIN) > 0; } - void openDrain(bool val) { if(val) value |= OPEN_DRAIN; else value &= ~OPEN_DRAIN; } + void openDrain(bool val) { value &= ~OPEN_DRAIN; if(val) value |= OPEN_DRAIN; } bool pulldown() const { return (value & PULLDOWN) > 0; } - void pulldown(bool val) { if(val) value |= PULLDOWN; else value &= ~PULLDOWN; } + void pulldown(bool val) { value &= ~PULLDOWN; if(val) value |= PULLDOWN; } bool pullup() const { return (value & PULLUP) > 0; } - void pullup(bool val) { if(val) value |= PULLUP; else value &= ~PULLUP; } - + void pullup(bool val) { value &= ~PULLUP; if(val) value |= PULLUP; } bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters FunctionSelector function = static_cast(0); uint8_t pin = 0; ///< GPIO pin number counting from 1. For save, load, and default function selectors, this can be 0 to select all pins. Feature feature = static_cast(0); ///< Determines how the pin will be used. Behavior behavior = static_cast(0); ///< Select an appropriate value from the enumeration based on the selected feature (e.g. for PPS, select one of the values prefixed with PPS_.) PinMode pin_mode; ///< GPIO configuration. May be restricted depending on device, pin, feature, and behavior. See device user manual. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_GPIO_CONFIG; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GpioConfig"; static constexpr const char* DOC_NAME = "GPIO Configuration"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x800F; - static constexpr const uint32_t READ_PARAMS = 0x8001; - static constexpr const uint32_t SAVE_PARAMS = 0x8001; - static constexpr const uint32_t LOAD_PARAMS = 0x8001; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8001; - static constexpr const uint32_t ECHOED_PARAMS = 0x0001; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(pin,feature,behavior,pin_mode); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(pin),std::ref(feature),std::ref(behavior),std::ref(pin_mode)); } @@ -2086,34 +2139,42 @@ struct GpioConfig return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint8_t pin = 0; ///< GPIO pin number counting from 1. For save, load, and default function selectors, this can be 0 to select all pins. + Feature feature = static_cast(0); ///< Determines how the pin will be used. + Behavior behavior = static_cast(0); ///< Select an appropriate value from the enumeration based on the selected feature (e.g. for PPS, select one of the values prefixed with PPS_.) + PinMode pin_mode; ///< GPIO configuration. May be restricted depending on device, pin, feature, and behavior. See device user manual. + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_GPIO_CONFIG; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GpioConfig::Response"; static constexpr const char* DOC_NAME = "GPIO Configuration Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0001; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - uint8_t pin = 0; ///< GPIO pin number counting from 1. For save, load, and default function selectors, this can be 0 to select all pins. - Feature feature = static_cast(0); ///< Determines how the pin will be used. - Behavior behavior = static_cast(0); ///< Select an appropriate value from the enumeration based on the selected feature (e.g. for PPS, select one of the values prefixed with PPS_.) - PinMode pin_mode; ///< GPIO configuration. May be restricted depending on device, pin, feature, and behavior. See device user manual. - + auto asTuple() const + { + return std::make_tuple(pin,feature,behavior,pin_mode); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(pin),std::ref(feature),std::ref(behavior),std::ref(pin_mode)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const GpioConfig& self); -void extract(Serializer& serializer, GpioConfig& self); - -void insert(Serializer& serializer, const GpioConfig::Response& self); -void extract(Serializer& serializer, GpioConfig::Response& self); - TypedResult writeGpioConfig(C::mip_interface& device, uint8_t pin, GpioConfig::Feature feature, GpioConfig::Behavior behavior, GpioConfig::PinMode pinMode); TypedResult readGpioConfig(C::mip_interface& device, uint8_t pin, GpioConfig::Feature* featureOut, GpioConfig::Behavior* behaviorOut, GpioConfig::PinMode* pinModeOut); TypedResult saveGpioConfig(C::mip_interface& device, uint8_t pin); @@ -2123,7 +2184,7 @@ TypedResult defaultGpioConfig(C::mip_interface& device, uint8_t pin) ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_gpio_state (0x0C,0x42) Gpio State [CPP] +///@defgroup 3dm_gpio_state_cpp (0x0C,0x42) Gpio State /// Allows the state of the pin to be read or controlled. /// /// This command serves two purposes: 1) To allow reading the state of a pin via command, @@ -2145,31 +2206,25 @@ TypedResult defaultGpioConfig(C::mip_interface& device, uint8_t pin) struct GpioState { + /// Parameters FunctionSelector function = static_cast(0); uint8_t pin = 0; ///< GPIO pin number counting from 1. Cannot be 0. bool state = 0; ///< The pin state. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_GPIO_STATE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GpioState"; static constexpr const char* DOC_NAME = "GPIO State"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8003; - static constexpr const uint32_t READ_PARAMS = 0x8001; - static constexpr const uint32_t SAVE_PARAMS = 0x0000; - static constexpr const uint32_t LOAD_PARAMS = 0x0000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x0000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0001; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(pin,state); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(pin),std::ref(state)); } @@ -2181,39 +2236,47 @@ struct GpioState return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint8_t pin = 0; ///< GPIO pin number counting from 1. Cannot be 0. + bool state = 0; ///< The pin state. + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_GPIO_STATE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GpioState::Response"; static constexpr const char* DOC_NAME = "GPIO State Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0001; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - uint8_t pin = 0; ///< GPIO pin number counting from 1. Cannot be 0. - bool state = 0; ///< The pin state. - + auto asTuple() const + { + return std::make_tuple(pin,state); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(pin),std::ref(state)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const GpioState& self); -void extract(Serializer& serializer, GpioState& self); - -void insert(Serializer& serializer, const GpioState::Response& self); -void extract(Serializer& serializer, GpioState::Response& self); - TypedResult writeGpioState(C::mip_interface& device, uint8_t pin, bool state); TypedResult readGpioState(C::mip_interface& device, uint8_t pin, bool* stateOut); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_odometer (0x0C,0x43) Odometer [CPP] +///@defgroup 3dm_odometer_cpp (0x0C,0x43) Odometer /// Configures the hardware odometer interface. /// /// @@ -2227,32 +2290,26 @@ struct Odometer QUADRATURE = 2, ///< Quadrature encoder mode. }; + /// Parameters FunctionSelector function = static_cast(0); Mode mode = static_cast(0); ///< Mode setting. float scaling = 0; ///< Encoder pulses per meter of distance traveled [pulses/m]. Distance traveled is computed using the formula d = p / N * 2R * pi, where d is distance, p is the number of pulses received, N is the encoder resolution, and R is the wheel radius. By simplifying all of the parameters into one, the formula d = p / S is obtained, where s is the odometer scaling factor passed to this command. S is equivalent to N / (2R * pi) and has units of pulses / meter. N is in units of "A" pulses per revolution and R is in meters. Make this value negative if the odometer is mounted so that it rotates backwards. float uncertainty = 0; ///< Uncertainty in encoder counts to distance translation (1-sigma value) [m/m]. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_ODOMETER_CONFIG; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "Odometer"; static constexpr const char* DOC_NAME = "Odometer Settings"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8007; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(mode,scaling,uncertainty); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(mode),std::ref(scaling),std::ref(uncertainty)); } @@ -2264,33 +2321,41 @@ struct Odometer return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + Mode mode = static_cast(0); ///< Mode setting. + float scaling = 0; ///< Encoder pulses per meter of distance traveled [pulses/m]. Distance traveled is computed using the formula d = p / N * 2R * pi, where d is distance, p is the number of pulses received, N is the encoder resolution, and R is the wheel radius. By simplifying all of the parameters into one, the formula d = p / S is obtained, where s is the odometer scaling factor passed to this command. S is equivalent to N / (2R * pi) and has units of pulses / meter. N is in units of "A" pulses per revolution and R is in meters. Make this value negative if the odometer is mounted so that it rotates backwards. + float uncertainty = 0; ///< Uncertainty in encoder counts to distance translation (1-sigma value) [m/m]. + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_ODOMETER_CONFIG; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "Odometer::Response"; static constexpr const char* DOC_NAME = "Odometer Settings Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - Mode mode = static_cast(0); ///< Mode setting. - float scaling = 0; ///< Encoder pulses per meter of distance traveled [pulses/m]. Distance traveled is computed using the formula d = p / N * 2R * pi, where d is distance, p is the number of pulses received, N is the encoder resolution, and R is the wheel radius. By simplifying all of the parameters into one, the formula d = p / S is obtained, where s is the odometer scaling factor passed to this command. S is equivalent to N / (2R * pi) and has units of pulses / meter. N is in units of "A" pulses per revolution and R is in meters. Make this value negative if the odometer is mounted so that it rotates backwards. - float uncertainty = 0; ///< Uncertainty in encoder counts to distance translation (1-sigma value) [m/m]. - + auto asTuple() const + { + return std::make_tuple(mode,scaling,uncertainty); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(mode),std::ref(scaling),std::ref(uncertainty)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const Odometer& self); -void extract(Serializer& serializer, Odometer& self); - -void insert(Serializer& serializer, const Odometer::Response& self); -void extract(Serializer& serializer, Odometer::Response& self); - TypedResult writeOdometer(C::mip_interface& device, Odometer::Mode mode, float scaling, float uncertainty); TypedResult readOdometer(C::mip_interface& device, Odometer::Mode* modeOut, float* scalingOut, float* uncertaintyOut); TypedResult saveOdometer(C::mip_interface& device); @@ -2300,7 +2365,7 @@ TypedResult defaultOdometer(C::mip_interface& device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_get_event_support (0x0C,0x2A) Get Event Support [CPP] +///@defgroup 3dm_get_event_support_cpp (0x0C,0x2A) Get Event Support /// Lists the available trigger or action types. /// /// There are a limited number of trigger and action slots available @@ -2331,68 +2396,78 @@ struct GetEventSupport struct Info { + /// Parameters uint8_t type = 0; ///< Trigger or action type, as defined in the respective setup command. uint8_t count = 0; ///< This is the maximum number of instances supported for this type. + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; + /// Parameters Query query = static_cast(0); ///< What type of information to retrieve. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_EVENT_SUPPORT; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GetEventSupport"; static constexpr const char* DOC_NAME = "Get Supported Events"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0001; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(query); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(query)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + Query query = static_cast(0); ///< Query type specified in the command. + uint8_t max_instances = 0; ///< Number of slots available. The 'instance' number for the configuration or control commands must be between 1 and this value. + uint8_t num_entries = 0; ///< Number of supported types. + Info entries[126]; ///< List of supported types. + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_EVENT_SUPPORT; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GetEventSupport::Response"; static constexpr const char* DOC_NAME = "Get Supported Events Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0001; - static constexpr const uint32_t COUNTER_PARAMS = 0x000000C0; - Query query = static_cast(0); ///< Query type specified in the command. - uint8_t max_instances = 0; ///< Number of slots available. The 'instance' number for the configuration or control commands must be between 1 and this value. - uint8_t num_entries = 0; ///< Number of supported types. - Info entries[126]; ///< List of supported types. - + auto asTuple() const + { + return std::make_tuple(query,max_instances,num_entries,entries); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(query),std::ref(max_instances),std::ref(num_entries),std::ref(entries)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const GetEventSupport& self); -void extract(Serializer& serializer, GetEventSupport& self); - -void insert(Serializer& serializer, const GetEventSupport::Info& self); -void extract(Serializer& serializer, GetEventSupport::Info& self); - -void insert(Serializer& serializer, const GetEventSupport::Response& self); -void extract(Serializer& serializer, GetEventSupport::Response& self); - TypedResult getEventSupport(C::mip_interface& device, GetEventSupport::Query query, uint8_t* maxInstancesOut, uint8_t* numEntriesOut, uint8_t numEntriesOutMax, GetEventSupport::Info* entriesOut); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_event_control (0x0C,0x2B) Event Control [CPP] +///@defgroup 3dm_event_control_cpp (0x0C,0x2B) Event Control /// Enables or disables event triggers. /// /// Triggers can be disabled, enabled, and tested. While disabled, a trigger will @@ -2416,31 +2491,25 @@ struct EventControl TEST_PULSE = 3, ///< Trigger is forced to the active state for one event cycle only. After the test cycle, the mode reverts to the previous state (either enabled or disabled). }; + /// Parameters FunctionSelector function = static_cast(0); uint8_t instance = 0; ///< Trigger instance to affect. 0 can be used to apply the mode to all configured triggers, except when the function selector is READ. Mode mode = static_cast(0); ///< How to change the trigger state. Except when instance is 0, the corresponding trigger must be configured, i.e. not have type 0. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_EVENT_CONTROL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "EventControl"; static constexpr const char* DOC_NAME = "Event Control"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8003; - static constexpr const uint32_t READ_PARAMS = 0x8001; - static constexpr const uint32_t SAVE_PARAMS = 0x8001; - static constexpr const uint32_t LOAD_PARAMS = 0x8001; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8001; - static constexpr const uint32_t ECHOED_PARAMS = 0x0001; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(instance,mode); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(instance),std::ref(mode)); } @@ -2453,32 +2522,40 @@ struct EventControl return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint8_t instance = 0; ///< Trigger instance to affect. 0 can be used to apply the mode to all configured triggers, except when the function selector is READ. + Mode mode = static_cast(0); ///< How to change the trigger state. Except when instance is 0, the corresponding trigger must be configured, i.e. not have type 0. + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_EVENT_CONTROL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "EventControl::Response"; static constexpr const char* DOC_NAME = "Event Control Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0001; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - uint8_t instance = 0; ///< Trigger instance to affect. 0 can be used to apply the mode to all configured triggers, except when the function selector is READ. - Mode mode = static_cast(0); ///< How to change the trigger state. Except when instance is 0, the corresponding trigger must be configured, i.e. not have type 0. - + auto asTuple() const + { + return std::make_tuple(instance,mode); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(instance),std::ref(mode)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const EventControl& self); -void extract(Serializer& serializer, EventControl& self); - -void insert(Serializer& serializer, const EventControl::Response& self); -void extract(Serializer& serializer, EventControl::Response& self); - TypedResult writeEventControl(C::mip_interface& device, uint8_t instance, EventControl::Mode mode); TypedResult readEventControl(C::mip_interface& device, uint8_t instance, EventControl::Mode* modeOut); TypedResult saveEventControl(C::mip_interface& device, uint8_t instance); @@ -2488,7 +2565,7 @@ TypedResult defaultEventControl(C::mip_interface& device, uint8_t ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_get_event_trigger_status (0x0C,0x2C) Get Event Trigger Status [CPP] +///@defgroup 3dm_get_event_trigger_status_cpp (0x0C,0x2C) Get Event Trigger Status /// ///@{ @@ -2496,6 +2573,7 @@ struct GetEventTriggerStatus { struct Status : Bitfield { + typedef uint8_t Type; enum _enumType : uint8_t { NONE = 0x00, @@ -2515,79 +2593,87 @@ struct GetEventTriggerStatus Status& operator&=(uint8_t val) { return *this = value & val; } bool active() const { return (value & ACTIVE) > 0; } - void active(bool val) { if(val) value |= ACTIVE; else value &= ~ACTIVE; } + void active(bool val) { value &= ~ACTIVE; if(val) value |= ACTIVE; } bool enabled() const { return (value & ENABLED) > 0; } - void enabled(bool val) { if(val) value |= ENABLED; else value &= ~ENABLED; } + void enabled(bool val) { value &= ~ENABLED; if(val) value |= ENABLED; } bool test() const { return (value & TEST) > 0; } - void test(bool val) { if(val) value |= TEST; else value &= ~TEST; } - + void test(bool val) { value &= ~TEST; if(val) value |= TEST; } bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - struct Entry { + /// Parameters uint8_t type = 0; ///< Configured trigger type. Status status; ///< Trigger status. + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; + /// Parameters uint8_t requested_count = 0; ///< Number of entries requested. If 0, requests all trigger slots. uint8_t requested_instances[20] = {0}; ///< List of trigger instances to query. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_EVENT_TRIGGER_STATUS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GetEventTriggerStatus"; static constexpr const char* DOC_NAME = "Get Trigger Status"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x0000000C; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(requested_count,requested_instances); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(requested_count),std::ref(requested_instances)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint8_t count = 0; ///< Number of entries requested. If requested_count was 0, this is the number of supported trigger slots. + Entry triggers[20]; ///< A list of the configured triggers. Entries are in the order requested, or in increasing order if count was 0. + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_EVENT_TRIGGER_STATUS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GetEventTriggerStatus::Response"; static constexpr const char* DOC_NAME = "Get Trigger Status Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x0000000C; - uint8_t count = 0; ///< Number of entries requested. If requested_count was 0, this is the number of supported trigger slots. - Entry triggers[20]; ///< A list of the configured triggers. Entries are in the order requested, or in increasing order if count was 0. - + auto asTuple() const + { + return std::make_tuple(count,triggers); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(count),std::ref(triggers)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const GetEventTriggerStatus& self); -void extract(Serializer& serializer, GetEventTriggerStatus& self); - -void insert(Serializer& serializer, const GetEventTriggerStatus::Entry& self); -void extract(Serializer& serializer, GetEventTriggerStatus::Entry& self); - -void insert(Serializer& serializer, const GetEventTriggerStatus::Response& self); -void extract(Serializer& serializer, GetEventTriggerStatus::Response& self); - TypedResult getEventTriggerStatus(C::mip_interface& device, uint8_t requestedCount, const uint8_t* requestedInstances, uint8_t* countOut, uint8_t countOutMax, GetEventTriggerStatus::Entry* triggersOut); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_get_event_action_status (0x0C,0x2D) Get Event Action Status [CPP] +///@defgroup 3dm_get_event_action_status_cpp (0x0C,0x2D) Get Event Action Status /// ///@{ @@ -2595,67 +2681,77 @@ struct GetEventActionStatus { struct Entry { + /// Parameters uint8_t action_type = 0; ///< Configured action type. uint8_t trigger_id = 0; ///< Associated trigger instance. + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; + /// Parameters uint8_t requested_count = 0; ///< Number of entries requested. If 0, requests all action slots. uint8_t requested_instances[20] = {0}; ///< List of action instances to query. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_EVENT_ACTION_STATUS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GetEventActionStatus"; static constexpr const char* DOC_NAME = "Get Action Status"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x0000000C; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(requested_count,requested_instances); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(requested_count),std::ref(requested_instances)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint8_t count = 0; ///< Number of entries requested. If requested_count was 0, this is the number of supported action slots. + Entry actions[20]; ///< A list of the configured actions. Entries are in the order requested, or in increasing order if count was 0. + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_EVENT_ACTION_STATUS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GetEventActionStatus::Response"; static constexpr const char* DOC_NAME = "Get Action Status Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x0000000C; - uint8_t count = 0; ///< Number of entries requested. If requested_count was 0, this is the number of supported action slots. - Entry actions[20]; ///< A list of the configured actions. Entries are in the order requested, or in increasing order if count was 0. - + auto asTuple() const + { + return std::make_tuple(count,actions); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(count),std::ref(actions)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const GetEventActionStatus& self); -void extract(Serializer& serializer, GetEventActionStatus& self); - -void insert(Serializer& serializer, const GetEventActionStatus::Entry& self); -void extract(Serializer& serializer, GetEventActionStatus::Entry& self); - -void insert(Serializer& serializer, const GetEventActionStatus::Response& self); -void extract(Serializer& serializer, GetEventActionStatus::Response& self); - TypedResult getEventActionStatus(C::mip_interface& device, uint8_t requestedCount, const uint8_t* requestedInstances, uint8_t* countOut, uint8_t countOutMax, GetEventActionStatus::Entry* actionsOut); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_event_trigger (0x0C,0x2E) Event Trigger [CPP] +///@defgroup 3dm_event_trigger_cpp (0x0C,0x2E) Event Trigger /// Configures various types of event triggers. /// ///@{ @@ -2672,9 +2768,14 @@ struct EventTrigger EDGE = 4, ///< Use if the pin is configured for timestamping via the 3DM Gpio Configuration command (0x0C41). }; + /// Parameters uint8_t pin = 0; ///< GPIO pin number. Mode mode = static_cast(0); ///< How the pin state affects the trigger. + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; struct ThresholdParams { @@ -2684,6 +2785,7 @@ struct EventTrigger INTERVAL = 2, ///< Trigger at evenly-spaced intervals. Normally used with time fields to trigger periodically. Trigger is active when (value % interval) <= int_thres. If the thresholds are reversed (high_thres < low_thres) then the trigger is active when (value % low_thres) > high_thres. }; + /// Parameters uint8_t desc_set = 0; ///< Descriptor set of target data quantity. uint8_t field_desc = 0; ///< Field descriptor of target data quantity. uint8_t param_id = 0; ///< 1-based index of the target parameter within the MIP field. E.g. for Scaled Accel (0x80,0x04) a value of 2 would represent the Y axis. @@ -2699,6 +2801,10 @@ struct EventTrigger double interval; }; + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; struct CombinationParams { @@ -2715,9 +2821,14 @@ struct EventTrigger static constexpr const uint16_t LOGIC_AND_AB = 0x8888; static constexpr const uint16_t LOGIC_AB_OR_C = 0xF8F8; static constexpr const uint16_t LOGIC_AND = 0x8000; + /// Parameters uint16_t logic_table = 0; ///< The last column of a truth table describing the output given the state of each input. uint8_t input_triggers[4] = {0}; ///< List of trigger IDs for inputs. Use 0 for unused inputs. + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; enum class Type : uint8_t { @@ -2729,38 +2840,32 @@ struct EventTrigger union Parameters { - Parameters() {} GpioParams gpio; ThresholdParams threshold; CombinationParams combination; + + Parameters() {} }; - + /// Parameters FunctionSelector function = static_cast(0); uint8_t instance = 0; ///< Trigger number. When function is SAVE, LOAD, or DEFAULT, this can be 0 to apply to all instances. Type type = static_cast(0); ///< Type of trigger to configure. Parameters parameters; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_EVENT_TRIGGER_CONFIG; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "EventTrigger"; static constexpr const char* DOC_NAME = "Event Trigger Configuration"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8007; - static constexpr const uint32_t READ_PARAMS = 0x8001; - static constexpr const uint32_t SAVE_PARAMS = 0x8001; - static constexpr const uint32_t LOAD_PARAMS = 0x8001; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8001; - static constexpr const uint32_t ECHOED_PARAMS = 0x0001; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(instance,type,parameters); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(instance),std::ref(type),std::ref(parameters)); } @@ -2773,42 +2878,41 @@ struct EventTrigger return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint8_t instance = 0; ///< Trigger number. When function is SAVE, LOAD, or DEFAULT, this can be 0 to apply to all instances. + Type type = static_cast(0); ///< Type of trigger to configure. + Parameters parameters; + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_EVENT_TRIGGER_CONFIG; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "EventTrigger::Response"; static constexpr const char* DOC_NAME = "Event Trigger Configuration Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0001; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - uint8_t instance = 0; ///< Trigger number. When function is SAVE, LOAD, or DEFAULT, this can be 0 to apply to all instances. - Type type = static_cast(0); ///< Type of trigger to configure. - Parameters parameters; - + auto asTuple() const + { + return std::make_tuple(instance,type,parameters); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(instance),std::ref(type),std::ref(parameters)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const EventTrigger& self); -void extract(Serializer& serializer, EventTrigger& self); - -void insert(Serializer& serializer, const EventTrigger::GpioParams& self); -void extract(Serializer& serializer, EventTrigger::GpioParams& self); - -void insert(Serializer& serializer, const EventTrigger::ThresholdParams& self); -void extract(Serializer& serializer, EventTrigger::ThresholdParams& self); - -void insert(Serializer& serializer, const EventTrigger::CombinationParams& self); -void extract(Serializer& serializer, EventTrigger::CombinationParams& self); - -void insert(Serializer& serializer, const EventTrigger::Response& self); -void extract(Serializer& serializer, EventTrigger::Response& self); - TypedResult writeEventTrigger(C::mip_interface& device, uint8_t instance, EventTrigger::Type type, const EventTrigger::Parameters& parameters); TypedResult readEventTrigger(C::mip_interface& device, uint8_t instance, EventTrigger::Type* typeOut, EventTrigger::Parameters* parametersOut); TypedResult saveEventTrigger(C::mip_interface& device, uint8_t instance); @@ -2818,7 +2922,7 @@ TypedResult defaultEventTrigger(C::mip_interface& device, uint8_t ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_event_action (0x0C,0x2F) Event Action [CPP] +///@defgroup 3dm_event_action_cpp (0x0C,0x2F) Event Action /// Configures various types of event actions. /// ///@{ @@ -2837,17 +2941,27 @@ struct EventAction TOGGLE = 7, ///< Pin will change to the opposite state each time the trigger activates. }; + /// Parameters uint8_t pin = 0; ///< GPIO pin number. Mode mode = static_cast(0); ///< Behavior of the pin. + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; struct MessageParams { + /// Parameters uint8_t desc_set = 0; ///< MIP data descriptor set. uint16_t decimation = 0; ///< Decimation from the base rate. If 0, a packet is emitted each time the trigger activates. Otherwise, packets will be streamed while the trigger is active. The internal decimation counter is reset if the trigger deactivates. uint8_t num_fields = 0; ///< Number of mip fields in the packet. Limited to 12. uint8_t descriptors[20] = {0}; ///< List of field descriptors. + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; enum class Type : uint8_t { @@ -2858,38 +2972,32 @@ struct EventAction union Parameters { - Parameters() {} GpioParams gpio; MessageParams message; + + Parameters() {} }; - + /// Parameters FunctionSelector function = static_cast(0); uint8_t instance = 0; ///< Action number. When function is SAVE, LOAD, or DEFAULT, this can be 0 to apply to all instances. uint8_t trigger = 0; ///< Trigger ID number. Type type = static_cast(0); ///< Type of action to configure. Parameters parameters; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_EVENT_ACTION_CONFIG; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "EventAction"; static constexpr const char* DOC_NAME = "Event Action Configuration"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x800F; - static constexpr const uint32_t READ_PARAMS = 0x8001; - static constexpr const uint32_t SAVE_PARAMS = 0x8001; - static constexpr const uint32_t LOAD_PARAMS = 0x8001; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8001; - static constexpr const uint32_t ECHOED_PARAMS = 0x0001; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(instance,trigger,type,parameters); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(instance),std::ref(trigger),std::ref(type),std::ref(parameters)); } @@ -2902,40 +3010,42 @@ struct EventAction return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint8_t instance = 0; ///< Action number. When function is SAVE, LOAD, or DEFAULT, this can be 0 to apply to all instances. + uint8_t trigger = 0; ///< Trigger ID number. + Type type = static_cast(0); ///< Type of action to configure. + Parameters parameters; + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_EVENT_ACTION_CONFIG; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "EventAction::Response"; static constexpr const char* DOC_NAME = "Event Action Configuration Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0001; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - uint8_t instance = 0; ///< Action number. When function is SAVE, LOAD, or DEFAULT, this can be 0 to apply to all instances. - uint8_t trigger = 0; ///< Trigger ID number. - Type type = static_cast(0); ///< Type of action to configure. - Parameters parameters; - + auto asTuple() const + { + return std::make_tuple(instance,trigger,type,parameters); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(instance),std::ref(trigger),std::ref(type),std::ref(parameters)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const EventAction& self); -void extract(Serializer& serializer, EventAction& self); - -void insert(Serializer& serializer, const EventAction::GpioParams& self); -void extract(Serializer& serializer, EventAction::GpioParams& self); - -void insert(Serializer& serializer, const EventAction::MessageParams& self); -void extract(Serializer& serializer, EventAction::MessageParams& self); - -void insert(Serializer& serializer, const EventAction::Response& self); -void extract(Serializer& serializer, EventAction::Response& self); - TypedResult writeEventAction(C::mip_interface& device, uint8_t instance, uint8_t trigger, EventAction::Type type, const EventAction::Parameters& parameters); TypedResult readEventAction(C::mip_interface& device, uint8_t instance, uint8_t* triggerOut, EventAction::Type* typeOut, EventAction::Parameters* parametersOut); TypedResult saveEventAction(C::mip_interface& device, uint8_t instance); @@ -2945,7 +3055,7 @@ TypedResult defaultEventAction(C::mip_interface& device, uint8_t in ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_accel_bias (0x0C,0x37) Accel Bias [CPP] +///@defgroup 3dm_accel_bias_cpp (0x0C,0x37) Accel Bias /// Configures the user specified accelerometer bias /// /// The user specified bias is subtracted from the calibrated accelerometer output. Value is input in the sensor frame. @@ -2954,30 +3064,24 @@ TypedResult defaultEventAction(C::mip_interface& device, uint8_t in struct AccelBias { + /// Parameters FunctionSelector function = static_cast(0); Vector3f bias; ///< accelerometer bias in the sensor frame (x,y,z) [g] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_ACCEL_BIAS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "AccelBias"; static constexpr const char* DOC_NAME = "Configure Accel Bias"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8001; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(bias); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(bias)); } @@ -2989,31 +3093,39 @@ struct AccelBias return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + Vector3f bias; ///< accelerometer bias in the sensor frame (x,y,z) [g] + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_ACCEL_BIAS_VECTOR; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "AccelBias::Response"; static constexpr const char* DOC_NAME = "Configure Accel Bias Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - Vector3f bias; ///< accelerometer bias in the sensor frame (x,y,z) [g] - + auto asTuple() const + { + return std::make_tuple(bias); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(bias)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const AccelBias& self); -void extract(Serializer& serializer, AccelBias& self); - -void insert(Serializer& serializer, const AccelBias::Response& self); -void extract(Serializer& serializer, AccelBias::Response& self); - TypedResult writeAccelBias(C::mip_interface& device, const float* bias); TypedResult readAccelBias(C::mip_interface& device, float* biasOut); TypedResult saveAccelBias(C::mip_interface& device); @@ -3023,7 +3135,7 @@ TypedResult defaultAccelBias(C::mip_interface& device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_gyro_bias (0x0C,0x38) Gyro Bias [CPP] +///@defgroup 3dm_gyro_bias_cpp (0x0C,0x38) Gyro Bias /// Configures the user specified gyroscope bias /// /// The user specified bias is subtracted from the calibrated angular rate output. Value is input in the sensor frame. @@ -3032,30 +3144,24 @@ TypedResult defaultAccelBias(C::mip_interface& device); struct GyroBias { + /// Parameters FunctionSelector function = static_cast(0); Vector3f bias; ///< gyro bias in the sensor frame (x,y,z) [radians/second] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_GYRO_BIAS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GyroBias"; static constexpr const char* DOC_NAME = "Configure Gyro Bias"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8001; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(bias); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(bias)); } @@ -3067,31 +3173,39 @@ struct GyroBias return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + Vector3f bias; ///< gyro bias in the sensor frame (x,y,z) [radians/second] + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_GYRO_BIAS_VECTOR; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GyroBias::Response"; static constexpr const char* DOC_NAME = "Configure Gyro Bias Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - Vector3f bias; ///< gyro bias in the sensor frame (x,y,z) [radians/second] - + auto asTuple() const + { + return std::make_tuple(bias); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(bias)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const GyroBias& self); -void extract(Serializer& serializer, GyroBias& self); - -void insert(Serializer& serializer, const GyroBias::Response& self); -void extract(Serializer& serializer, GyroBias::Response& self); - TypedResult writeGyroBias(C::mip_interface& device, const float* bias); TypedResult readGyroBias(C::mip_interface& device, float* biasOut); TypedResult saveGyroBias(C::mip_interface& device); @@ -3101,7 +3215,7 @@ TypedResult defaultGyroBias(C::mip_interface& device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_capture_gyro_bias (0x0C,0x39) Capture Gyro Bias [CPP] +///@defgroup 3dm_capture_gyro_bias_cpp (0x0C,0x39) Capture Gyro Bias /// Samples gyro for a specified time range and writes the averaged result to the Gyro Bias vector in RAM /// /// The device will average the gyro output for the duration of "averaging_time_ms." To store the resulting vector @@ -3113,63 +3227,71 @@ TypedResult defaultGyroBias(C::mip_interface& device); struct CaptureGyroBias { + /// Parameters uint16_t averaging_time_ms = 0; ///< Averaging time [milliseconds] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_CAPTURE_GYRO_BIAS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "CaptureGyroBias"; static constexpr const char* DOC_NAME = "Capture Gyro Bias"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(averaging_time_ms); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(averaging_time_ms)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + Vector3f bias; ///< gyro bias in the sensor frame (x,y,z) [radians/second] + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_GYRO_BIAS_VECTOR; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "CaptureGyroBias::Response"; static constexpr const char* DOC_NAME = "Capture Gyro Bias Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - Vector3f bias; ///< gyro bias in the sensor frame (x,y,z) [radians/second] - + auto asTuple() const + { + return std::make_tuple(bias); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(bias)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const CaptureGyroBias& self); -void extract(Serializer& serializer, CaptureGyroBias& self); - -void insert(Serializer& serializer, const CaptureGyroBias::Response& self); -void extract(Serializer& serializer, CaptureGyroBias::Response& self); - TypedResult captureGyroBias(C::mip_interface& device, uint16_t averagingTimeMs, float* biasOut); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_mag_hard_iron_offset (0x0C,0x3A) Mag Hard Iron Offset [CPP] +///@defgroup 3dm_mag_hard_iron_offset_cpp (0x0C,0x3A) Mag Hard Iron Offset /// Configure the user specified magnetometer hard iron offset vector /// /// The values for this offset are determined empirically by external software algorithms /// based on calibration data taken after the device is installed in its application. These values -/// can be obtained and set by using the LORD "MIP Iron Calibration" application. +/// can be obtained and set by using Microstrain software tools. /// Alternatively, on some systems, the auto-mag calibration feature may be used to capture these values in-run. /// The offset is applied to the scaled magnetometer vector prior to output. /// @@ -3177,30 +3299,24 @@ TypedResult captureGyroBias(C::mip_interface& device, uint16_t struct MagHardIronOffset { + /// Parameters FunctionSelector function = static_cast(0); Vector3f offset; ///< hard iron offset in the sensor frame (x,y,z) [Gauss] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_HARD_IRON_OFFSET; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "MagHardIronOffset"; static constexpr const char* DOC_NAME = "Magnetometer Hard Iron Offset"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8001; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(offset); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(offset)); } @@ -3212,31 +3328,39 @@ struct MagHardIronOffset return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + Vector3f offset; ///< hard iron offset in the sensor frame (x,y,z) [Gauss] + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_HARD_IRON_OFFSET_VECTOR; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "MagHardIronOffset::Response"; static constexpr const char* DOC_NAME = "Magnetometer Hard Iron Offset Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - Vector3f offset; ///< hard iron offset in the sensor frame (x,y,z) [Gauss] - + auto asTuple() const + { + return std::make_tuple(offset); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(offset)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const MagHardIronOffset& self); -void extract(Serializer& serializer, MagHardIronOffset& self); - -void insert(Serializer& serializer, const MagHardIronOffset::Response& self); -void extract(Serializer& serializer, MagHardIronOffset::Response& self); - TypedResult writeMagHardIronOffset(C::mip_interface& device, const float* offset); TypedResult readMagHardIronOffset(C::mip_interface& device, float* offsetOut); TypedResult saveMagHardIronOffset(C::mip_interface& device); @@ -3246,47 +3370,41 @@ TypedResult defaultMagHardIronOffset(C::mip_interface& device ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_mag_soft_iron_matrix (0x0C,0x3B) Mag Soft Iron Matrix [CPP] +///@defgroup 3dm_mag_soft_iron_matrix_cpp (0x0C,0x3B) Mag Soft Iron Matrix /// Configure the user specified magnetometer soft iron offset matrix /// /// The values for this matrix are determined empirically by external software algorithms /// based on calibration data taken after the device is installed in its application. These values -/// can be obtained and set by using the LORD "MIP Iron Calibration" application. +/// can be obtained and set by using Microstrain software tools. /// Alternatively, on some systems, the auto-mag calibration feature may be used to capture these values in-run. /// The matrix is applied to the scaled magnetometer vector prior to output. /// /// The matrix is in row major order: -/// EQSTART M = \begin{bmatrix} 0 & 1 & 2 \\ 3 & 4 & 5 \\ 6 & 7 & 8 \end{bmatrix} EQEND +/// EQSTART M = \\begin{bmatrix} 0 & 1 & 2 \\\\ 3 & 4 & 5 \\\\ 6 & 7 & 8 \\end{bmatrix} EQEND /// /// ///@{ struct MagSoftIronMatrix { + /// Parameters FunctionSelector function = static_cast(0); Matrix3f offset; ///< soft iron matrix [dimensionless] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_SOFT_IRON_MATRIX; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "MagSoftIronMatrix"; static constexpr const char* DOC_NAME = "Magnetometer Soft Iron Matrix"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8001; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(offset); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(offset)); } @@ -3298,31 +3416,39 @@ struct MagSoftIronMatrix return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + Matrix3f offset; ///< soft iron matrix [dimensionless] + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_SOFT_IRON_COMP_MATRIX; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "MagSoftIronMatrix::Response"; static constexpr const char* DOC_NAME = "Magnetometer Soft Iron Matrix Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - Matrix3f offset; ///< soft iron matrix [dimensionless] - + auto asTuple() const + { + return std::make_tuple(offset); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(offset)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const MagSoftIronMatrix& self); -void extract(Serializer& serializer, MagSoftIronMatrix& self); - -void insert(Serializer& serializer, const MagSoftIronMatrix::Response& self); -void extract(Serializer& serializer, MagSoftIronMatrix::Response& self); - TypedResult writeMagSoftIronMatrix(C::mip_interface& device, const float* offset); TypedResult readMagSoftIronMatrix(C::mip_interface& device, float* offsetOut); TypedResult saveMagSoftIronMatrix(C::mip_interface& device); @@ -3332,37 +3458,31 @@ TypedResult defaultMagSoftIronMatrix(C::mip_interface& device ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_coning_sculling_enable (0x0C,0x3E) Coning Sculling Enable [CPP] +///@defgroup 3dm_coning_sculling_enable_cpp (0x0C,0x3E) Coning Sculling Enable /// Controls the Coning and Sculling Compenstation setting. /// ///@{ struct ConingScullingEnable { + /// Parameters FunctionSelector function = static_cast(0); bool enable = 0; ///< If true, coning and sculling compensation is enabled. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_CONING_AND_SCULLING_ENABLE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ConingScullingEnable"; static constexpr const char* DOC_NAME = "Coning and Sculling Enable"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8001; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(enable); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(enable)); } @@ -3374,31 +3494,39 @@ struct ConingScullingEnable return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + bool enable = 0; ///< If true, coning and sculling compensation is enabled. + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_CONING_AND_SCULLING_ENABLE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ConingScullingEnable::Response"; static constexpr const char* DOC_NAME = "Coning and Sculling Enable Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - bool enable = 0; ///< If true, coning and sculling compensation is enabled. - + auto asTuple() const + { + return std::make_tuple(enable); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(enable)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const ConingScullingEnable& self); -void extract(Serializer& serializer, ConingScullingEnable& self); - -void insert(Serializer& serializer, const ConingScullingEnable::Response& self); -void extract(Serializer& serializer, ConingScullingEnable::Response& self); - TypedResult writeConingScullingEnable(C::mip_interface& device, bool enable); TypedResult readConingScullingEnable(C::mip_interface& device, bool* enableOut); TypedResult saveConingScullingEnable(C::mip_interface& device); @@ -3408,7 +3536,7 @@ TypedResult defaultConingScullingEnable(C::mip_interface& ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_sensor_2_vehicle_transform_euler (0x0C,0x31) Sensor 2 Vehicle Transform Euler [CPP] +///@defgroup 3dm_sensor_2_vehicle_transform_euler_cpp (0x0C,0x31) Sensor 2 Vehicle Transform Euler /// Sets the sensor-to-vehicle frame transformation using Yaw, Pitch, Roll Euler angles. /// These are the Yaw, Pitch, and Roll mounting angles of the sensor with respect to vehicle frame of reference, /// and describe the transformation of vectors from the sensor body frame to the vehicle frame.
@@ -3439,32 +3567,26 @@ TypedResult defaultConingScullingEnable(C::mip_interface& struct Sensor2VehicleTransformEuler { + /// Parameters FunctionSelector function = static_cast(0); float roll = 0; ///< [radians] float pitch = 0; ///< [radians] float yaw = 0; ///< [radians] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_SENSOR2VEHICLE_TRANSFORM_EUL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "Sensor2VehicleTransformEuler"; static constexpr const char* DOC_NAME = "Sensor to Vehicle Frame Transformation Euler"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8007; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(roll,pitch,yaw); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(roll),std::ref(pitch),std::ref(yaw)); } @@ -3476,33 +3598,41 @@ struct Sensor2VehicleTransformEuler return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + float roll = 0; ///< [radians] + float pitch = 0; ///< [radians] + float yaw = 0; ///< [radians] + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_SENSOR2VEHICLE_TRANSFORM_EUL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "Sensor2VehicleTransformEuler::Response"; static constexpr const char* DOC_NAME = "Sensor to Vehicle Frame Transformation Euler Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - float roll = 0; ///< [radians] - float pitch = 0; ///< [radians] - float yaw = 0; ///< [radians] - + auto asTuple() const + { + return std::make_tuple(roll,pitch,yaw); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(roll),std::ref(pitch),std::ref(yaw)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const Sensor2VehicleTransformEuler& self); -void extract(Serializer& serializer, Sensor2VehicleTransformEuler& self); - -void insert(Serializer& serializer, const Sensor2VehicleTransformEuler::Response& self); -void extract(Serializer& serializer, Sensor2VehicleTransformEuler::Response& self); - TypedResult writeSensor2VehicleTransformEuler(C::mip_interface& device, float roll, float pitch, float yaw); TypedResult readSensor2VehicleTransformEuler(C::mip_interface& device, float* rollOut, float* pitchOut, float* yawOut); TypedResult saveSensor2VehicleTransformEuler(C::mip_interface& device); @@ -3512,7 +3642,7 @@ TypedResult defaultSensor2VehicleTransformEuler(C: ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_sensor_2_vehicle_transform_quaternion (0x0C,0x32) Sensor 2 Vehicle Transform Quaternion [CPP] +///@defgroup 3dm_sensor_2_vehicle_transform_quaternion_cpp (0x0C,0x32) Sensor 2 Vehicle Transform Quaternion /// Set the sensor to vehicle frame transformation using unit length quaternion. /// /// Note: This is the transformation, the inverse of the rotation. @@ -3551,30 +3681,24 @@ TypedResult defaultSensor2VehicleTransformEuler(C: struct Sensor2VehicleTransformQuaternion { + /// Parameters FunctionSelector function = static_cast(0); Quatf q; ///< Unit length quaternion representing transform [w, i, j, k] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_SENSOR2VEHICLE_TRANSFORM_QUAT; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "Sensor2VehicleTransformQuaternion"; static constexpr const char* DOC_NAME = "Sensor to Vehicle Frame Transformation Quaternion"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8001; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(q); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(q)); } @@ -3586,31 +3710,39 @@ struct Sensor2VehicleTransformQuaternion return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + Quatf q; ///< Unit length quaternion representing transform [w, i, j, k] + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_SENSOR2VEHICLE_TRANSFORM_QUAT; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "Sensor2VehicleTransformQuaternion::Response"; static constexpr const char* DOC_NAME = "Sensor to Vehicle Frame Transformation Quaternion Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - Quatf q; ///< Unit length quaternion representing transform [w, i, j, k] - + auto asTuple() const + { + return std::make_tuple(q); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(q)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const Sensor2VehicleTransformQuaternion& self); -void extract(Serializer& serializer, Sensor2VehicleTransformQuaternion& self); - -void insert(Serializer& serializer, const Sensor2VehicleTransformQuaternion::Response& self); -void extract(Serializer& serializer, Sensor2VehicleTransformQuaternion::Response& self); - TypedResult writeSensor2VehicleTransformQuaternion(C::mip_interface& device, const float* q); TypedResult readSensor2VehicleTransformQuaternion(C::mip_interface& device, float* qOut); TypedResult saveSensor2VehicleTransformQuaternion(C::mip_interface& device); @@ -3620,7 +3752,7 @@ TypedResult defaultSensor2VehicleTransformQua ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_sensor_2_vehicle_transform_dcm (0x0C,0x33) Sensor 2 Vehicle Transform Dcm [CPP] +///@defgroup 3dm_sensor_2_vehicle_transform_dcm_cpp (0x0C,0x33) Sensor 2 Vehicle Transform Dcm /// Set the sensor to vehicle frame transformation using a using a 3 x 3 direction cosine matrix EQSTART M_{ned}^{veh} EQEND, stored in row-major order in a 9-element array. /// /// These angles define the transformation of vectors from the sensor body frame to the fixed vehicle frame, according to:
@@ -3631,7 +3763,7 @@ TypedResult defaultSensor2VehicleTransformQua /// EQSTART v^{sen} EQEND is a 3-element vector expressed in the sensor body frame.
/// EQSTART v^{veh} EQEND is the same 3-element vector expressed in the vehicle frame.
///
-/// The matrix elements are stored is row-major order: EQSTART M_{sen}^{veh} = \begin{bmatrix} M_{11}, M_{12}, M_{13}, M_{21}, M_{22}, M_{23}, M_{31}, M_{32}, M_{33} \end{bmatrix} EQEND +/// The matrix elements are stored is row-major order: EQSTART M_{sen}^{veh} = \\begin{bmatrix} M_{11}, M_{12}, M_{13}, M_{21}, M_{22}, M_{23}, M_{31}, M_{32}, M_{33} \\end{bmatrix} EQEND /// The transformation may be stored in the device as a matrix or a quaternion. When EQSTART M_{sen}^{veh} EQEND is read back from the device, it may not /// be exactly equal to array used to set the transformation, but it is functionally equivalent.
///

@@ -3657,30 +3789,24 @@ TypedResult defaultSensor2VehicleTransformQua struct Sensor2VehicleTransformDcm { + /// Parameters FunctionSelector function = static_cast(0); Matrix3f dcm; ///< 3 x 3 direction cosine matrix, stored in row-major order + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_SENSOR2VEHICLE_TRANSFORM_DCM; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "Sensor2VehicleTransformDcm"; static constexpr const char* DOC_NAME = "Sensor to Vehicle Frame Transformation Direction Cosine Matrix"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8001; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(dcm); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(dcm)); } @@ -3692,31 +3818,39 @@ struct Sensor2VehicleTransformDcm return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + Matrix3f dcm; ///< 3 x 3 direction cosine matrix, stored in row-major order + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_SENSOR2VEHICLE_TRANSFORM_DCM; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "Sensor2VehicleTransformDcm::Response"; static constexpr const char* DOC_NAME = "Sensor to Vehicle Frame Transformation Direction Cosine Matrix Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - Matrix3f dcm; ///< 3 x 3 direction cosine matrix, stored in row-major order - + auto asTuple() const + { + return std::make_tuple(dcm); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(dcm)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const Sensor2VehicleTransformDcm& self); -void extract(Serializer& serializer, Sensor2VehicleTransformDcm& self); - -void insert(Serializer& serializer, const Sensor2VehicleTransformDcm::Response& self); -void extract(Serializer& serializer, Sensor2VehicleTransformDcm::Response& self); - TypedResult writeSensor2VehicleTransformDcm(C::mip_interface& device, const float* dcm); TypedResult readSensor2VehicleTransformDcm(C::mip_interface& device, float* dcmOut); TypedResult saveSensor2VehicleTransformDcm(C::mip_interface& device); @@ -3726,7 +3860,7 @@ TypedResult defaultSensor2VehicleTransformDcm(C::mip ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_complementary_filter (0x0C,0x51) Complementary Filter [CPP] +///@defgroup 3dm_complementary_filter_cpp (0x0C,0x51) Complementary Filter /// Configure the settings for the complementary filter which produces the following (0x80) descriptor set values: attitude matrix (0x80,09), quaternion (0x80,0A), and Euler angle (0x80,0C) outputs. /// /// The filter can be configured to correct for pitch and roll using the accelerometer (with the assumption that linear acceleration is minimal), @@ -3737,33 +3871,27 @@ TypedResult defaultSensor2VehicleTransformDcm(C::mip struct ComplementaryFilter { + /// Parameters FunctionSelector function = static_cast(0); bool pitch_roll_enable = 0; ///< Enable Pitch/Roll corrections bool heading_enable = 0; ///< Enable Heading corrections (only available on devices with magnetometer) float pitch_roll_time_constant = 0; ///< Time constant associated with the pitch/roll corrections [s] float heading_time_constant = 0; ///< Time constant associated with the heading corrections [s] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_LEGACY_COMP_FILTER; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ComplementaryFilter"; static constexpr const char* DOC_NAME = "Complementary filter settings"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x800F; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(pitch_roll_enable,heading_enable,pitch_roll_time_constant,heading_time_constant); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(pitch_roll_enable),std::ref(heading_enable),std::ref(pitch_roll_time_constant),std::ref(heading_time_constant)); } @@ -3775,34 +3903,42 @@ struct ComplementaryFilter return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + bool pitch_roll_enable = 0; ///< Enable Pitch/Roll corrections + bool heading_enable = 0; ///< Enable Heading corrections (only available on devices with magnetometer) + float pitch_roll_time_constant = 0; ///< Time constant associated with the pitch/roll corrections [s] + float heading_time_constant = 0; ///< Time constant associated with the heading corrections [s] + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_LEGACY_COMP_FILTER; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ComplementaryFilter::Response"; static constexpr const char* DOC_NAME = "Complementary filter settings Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - bool pitch_roll_enable = 0; ///< Enable Pitch/Roll corrections - bool heading_enable = 0; ///< Enable Heading corrections (only available on devices with magnetometer) - float pitch_roll_time_constant = 0; ///< Time constant associated with the pitch/roll corrections [s] - float heading_time_constant = 0; ///< Time constant associated with the heading corrections [s] - + auto asTuple() const + { + return std::make_tuple(pitch_roll_enable,heading_enable,pitch_roll_time_constant,heading_time_constant); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(pitch_roll_enable),std::ref(heading_enable),std::ref(pitch_roll_time_constant),std::ref(heading_time_constant)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const ComplementaryFilter& self); -void extract(Serializer& serializer, ComplementaryFilter& self); - -void insert(Serializer& serializer, const ComplementaryFilter::Response& self); -void extract(Serializer& serializer, ComplementaryFilter::Response& self); - TypedResult writeComplementaryFilter(C::mip_interface& device, bool pitchRollEnable, bool headingEnable, float pitchRollTimeConstant, float headingTimeConstant); TypedResult readComplementaryFilter(C::mip_interface& device, bool* pitchRollEnableOut, bool* headingEnableOut, float* pitchRollTimeConstantOut, float* headingTimeConstantOut); TypedResult saveComplementaryFilter(C::mip_interface& device); @@ -3812,7 +3948,7 @@ TypedResult defaultComplementaryFilter(C::mip_interface& de ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_sensor_range (0x0C,0x52) Sensor Range [CPP] +///@defgroup 3dm_sensor_range_cpp (0x0C,0x52) Sensor Range /// Changes the IMU sensor gain. /// /// This allows you to optimize the range to get the best accuracy and performance @@ -3826,31 +3962,25 @@ TypedResult defaultComplementaryFilter(C::mip_interface& de struct SensorRange { + /// Parameters FunctionSelector function = static_cast(0); SensorRangeType sensor = static_cast(0); ///< Which type of sensor will get the new range value. uint8_t setting = 0; ///< Use the 3DM Get Calibrated Sensor Ranges (0x0C,0x53) command to determine this value. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_SENSOR_RANGE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "SensorRange"; static constexpr const char* DOC_NAME = "Sensor Range"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8003; - static constexpr const uint32_t READ_PARAMS = 0x8001; - static constexpr const uint32_t SAVE_PARAMS = 0x8001; - static constexpr const uint32_t LOAD_PARAMS = 0x8001; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8001; - static constexpr const uint32_t ECHOED_PARAMS = 0x0001; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(sensor,setting); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(sensor),std::ref(setting)); } @@ -3863,32 +3993,40 @@ struct SensorRange return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + SensorRangeType sensor = static_cast(0); ///< Which type of sensor will get the new range value. + uint8_t setting = 0; ///< Use the 3DM Get Calibrated Sensor Ranges (0x0C,0x53) command to determine this value. + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_SENSOR_RANGE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "SensorRange::Response"; static constexpr const char* DOC_NAME = "Sensor Range Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0001; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - SensorRangeType sensor = static_cast(0); ///< Which type of sensor will get the new range value. - uint8_t setting = 0; ///< Use the 3DM Get Calibrated Sensor Ranges (0x0C,0x53) command to determine this value. - + auto asTuple() const + { + return std::make_tuple(sensor,setting); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(sensor),std::ref(setting)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const SensorRange& self); -void extract(Serializer& serializer, SensorRange& self); - -void insert(Serializer& serializer, const SensorRange::Response& self); -void extract(Serializer& serializer, SensorRange::Response& self); - TypedResult writeSensorRange(C::mip_interface& device, SensorRangeType sensor, uint8_t setting); TypedResult readSensorRange(C::mip_interface& device, SensorRangeType sensor, uint8_t* settingOut); TypedResult saveSensorRange(C::mip_interface& device, SensorRangeType sensor); @@ -3898,7 +4036,7 @@ TypedResult defaultSensorRange(C::mip_interface& device, SensorRang ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_calibrated_sensor_ranges (0x0C,0x53) Calibrated Sensor Ranges [CPP] +///@defgroup 3dm_calibrated_sensor_ranges_cpp (0x0C,0x53) Calibrated Sensor Ranges /// Returns the supported sensor ranges which may be used with the 3DM Sensor Range (0x0C,0x52) command. /// /// The response includes an array of (u8, float) pairs which map each allowed setting @@ -3910,67 +4048,77 @@ struct CalibratedSensorRanges { struct Entry { + /// Parameters uint8_t setting = 0; ///< The value used in the 3DM Sensor Range command and response. float range = 0; ///< The actual range value. Units depend on the sensor type. + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; + /// Parameters SensorRangeType sensor = static_cast(0); ///< The sensor to query. Cannot be ALL. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_CALIBRATED_RANGES; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "CalibratedSensorRanges"; static constexpr const char* DOC_NAME = "Get Calibrated Sensor Ranges"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0001; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(sensor); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(sensor)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + SensorRangeType sensor = static_cast(0); ///< The sensor type from the command. + uint8_t num_ranges = 0; ///< Number of supported ranges. + Entry ranges[50]; ///< List of possible range settings. + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_CALIBRATED_RANGES; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "CalibratedSensorRanges::Response"; static constexpr const char* DOC_NAME = "Get Calibrated Sensor Ranges Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0001; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000030; - SensorRangeType sensor = static_cast(0); ///< The sensor type from the command. - uint8_t num_ranges = 0; ///< Number of supported ranges. - Entry ranges[50]; ///< List of possible range settings. - + auto asTuple() const + { + return std::make_tuple(sensor,num_ranges,ranges); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(sensor),std::ref(num_ranges),std::ref(ranges)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const CalibratedSensorRanges& self); -void extract(Serializer& serializer, CalibratedSensorRanges& self); - -void insert(Serializer& serializer, const CalibratedSensorRanges::Entry& self); -void extract(Serializer& serializer, CalibratedSensorRanges::Entry& self); - -void insert(Serializer& serializer, const CalibratedSensorRanges::Response& self); -void extract(Serializer& serializer, CalibratedSensorRanges::Response& self); - TypedResult calibratedSensorRanges(C::mip_interface& device, SensorRangeType sensor, uint8_t* numRangesOut, uint8_t numRangesOutMax, CalibratedSensorRanges::Entry* rangesOut); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_3dm_lowpass_filter (0x0C,0x54) Lowpass Filter [CPP] +///@defgroup 3dm_lowpass_filter_cpp (0x0C,0x54) Lowpass Filter /// This command controls the low-pass anti-aliasing filter supported data quantities. /// /// See the device user manual for data quantities which support the anti-aliasing filter. @@ -3990,6 +4138,7 @@ TypedResult calibratedSensorRanges(C::mip_interface& dev struct LowpassFilter { + /// Parameters FunctionSelector function = static_cast(0); uint8_t desc_set = 0; ///< Descriptor set of the quantity to be filtered. uint8_t field_desc = 0; ///< Field descriptor of the quantity to be filtered. @@ -3997,27 +4146,20 @@ struct LowpassFilter bool manual = 0; ///< If false, the frequency parameter is ignored and the filter will track to half of the configured message format frequency. float frequency = 0; ///< Cutoff frequency in Hz. This will return the actual frequency when read out in automatic mode. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::CMD_LOWPASS_FILTER; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "LowpassFilter"; static constexpr const char* DOC_NAME = "Low-pass anti-aliasing filter"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x801F; - static constexpr const uint32_t READ_PARAMS = 0x8003; - static constexpr const uint32_t SAVE_PARAMS = 0x8003; - static constexpr const uint32_t LOAD_PARAMS = 0x8003; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8003; - static constexpr const uint32_t ECHOED_PARAMS = 0x0003; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(desc_set,field_desc,enable,manual,frequency); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(desc_set),std::ref(field_desc),std::ref(enable),std::ref(manual),std::ref(frequency)); } @@ -4031,35 +4173,43 @@ struct LowpassFilter return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { - static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; - static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_LOWPASS_FILTER; - static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; - static constexpr const char* NAME = "LowpassFilter::Response"; - static constexpr const char* DOC_NAME = "Low-pass anti-aliasing filter Response"; - - static constexpr const uint32_t ECHOED_PARAMS = 0x0003; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; + /// Parameters uint8_t desc_set = 0; ///< Descriptor set of the quantity to be filtered. uint8_t field_desc = 0; ///< Field descriptor of the quantity to be filtered. bool enable = 0; ///< The filter will be enabled if this is true. bool manual = 0; ///< If false, the frequency parameter is ignored and the filter will track to half of the configured message format frequency. float frequency = 0; ///< Cutoff frequency in Hz. This will return the actual frequency when read out in automatic mode. + /// Descriptors + static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_3dm::DESCRIPTOR_SET; + static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_3dm::REPLY_LOWPASS_FILTER; + static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; + static constexpr const char* NAME = "LowpassFilter::Response"; + static constexpr const char* DOC_NAME = "Low-pass anti-aliasing filter Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; + + auto asTuple() const + { + return std::make_tuple(desc_set,field_desc,enable,manual,frequency); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(desc_set),std::ref(field_desc),std::ref(enable),std::ref(manual),std::ref(frequency)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const LowpassFilter& self); -void extract(Serializer& serializer, LowpassFilter& self); - -void insert(Serializer& serializer, const LowpassFilter::Response& self); -void extract(Serializer& serializer, LowpassFilter::Response& self); - TypedResult writeLowpassFilter(C::mip_interface& device, uint8_t descSet, uint8_t fieldDesc, bool enable, bool manual, float frequency); TypedResult readLowpassFilter(C::mip_interface& device, uint8_t descSet, uint8_t fieldDesc, bool* enableOut, bool* manualOut, float* frequencyOut); TypedResult saveLowpassFilter(C::mip_interface& device, uint8_t descSet, uint8_t fieldDesc); diff --git a/src/cpp/mip/definitions/commands_aiding.cpp b/src/cpp/mip/definitions/commands_aiding.cpp new file mode 100644 index 000000000..77dd90c05 --- /dev/null +++ b/src/cpp/mip/definitions/commands_aiding.cpp @@ -0,0 +1,803 @@ + +#include "commands_aiding.hpp" + +#include +#include + +#include + + +namespace mip { +namespace C { +struct mip_interface; +} // namespace C + +namespace commands_aiding { + +using namespace ::mip::C; + +//////////////////////////////////////////////////////////////////////////////// +// Mip Fields +//////////////////////////////////////////////////////////////////////////////// + +void Time::insert(Serializer& serializer) const +{ + serializer.insert(timebase); + + serializer.insert(reserved); + + serializer.insert(nanoseconds); + +} +void Time::extract(Serializer& serializer) +{ + serializer.extract(timebase); + + serializer.extract(reserved); + + serializer.extract(nanoseconds); + +} + +void FrameConfig::insert(Serializer& serializer) const +{ + serializer.insert(function); + + serializer.insert(frame_id); + + if( function == FunctionSelector::WRITE || function == FunctionSelector::READ ) + { + serializer.insert(format); + + } + if( function == FunctionSelector::WRITE ) + { + serializer.insert(tracking_enabled); + + serializer.insert(translation); + + if( format == FrameConfig::Format::EULER ) + { + serializer.insert(rotation.euler); + + } + if( format == FrameConfig::Format::QUATERNION ) + { + serializer.insert(rotation.quaternion); + + } + } +} +void FrameConfig::extract(Serializer& serializer) +{ + serializer.extract(function); + + serializer.extract(frame_id); + + if( function == FunctionSelector::WRITE || function == FunctionSelector::READ ) + { + serializer.extract(format); + + } + if( function == FunctionSelector::WRITE ) + { + serializer.extract(tracking_enabled); + + serializer.extract(translation); + + if( format == FrameConfig::Format::EULER ) + { + serializer.extract(rotation.euler); + + } + if( format == FrameConfig::Format::QUATERNION ) + { + serializer.extract(rotation.quaternion); + + } + } +} + +void FrameConfig::Response::insert(Serializer& serializer) const +{ + serializer.insert(frame_id); + + serializer.insert(format); + + serializer.insert(tracking_enabled); + + serializer.insert(translation); + + if( format == FrameConfig::Format::EULER ) + { + serializer.insert(rotation.euler); + + } + if( format == FrameConfig::Format::QUATERNION ) + { + serializer.insert(rotation.quaternion); + + } +} +void FrameConfig::Response::extract(Serializer& serializer) +{ + serializer.extract(frame_id); + + serializer.extract(format); + + serializer.extract(tracking_enabled); + + serializer.extract(translation); + + if( format == FrameConfig::Format::EULER ) + { + serializer.extract(rotation.euler); + + } + if( format == FrameConfig::Format::QUATERNION ) + { + serializer.extract(rotation.quaternion); + + } +} + +TypedResult writeFrameConfig(C::mip_interface& device, uint8_t frameId, FrameConfig::Format format, bool trackingEnabled, const float* translation, const FrameConfig::Rotation& rotation) +{ + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + Serializer serializer(buffer, sizeof(buffer)); + + serializer.insert(FunctionSelector::WRITE); + serializer.insert(frameId); + + serializer.insert(format); + + serializer.insert(trackingEnabled); + + assert(translation); + for(unsigned int i=0; i < 3; i++) + serializer.insert(translation[i]); + + if( format == FrameConfig::Format::EULER ) + { + serializer.insert(rotation.euler); + + } + if( format == FrameConfig::Format::QUATERNION ) + { + serializer.insert(rotation.quaternion); + + } + assert(serializer.isOk()); + + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_FRAME_CONFIG, buffer, (uint8_t)serializer.usedLength()); +} +TypedResult readFrameConfig(C::mip_interface& device, uint8_t frameId, FrameConfig::Format format, bool* trackingEnabledOut, float* translationOut, FrameConfig::Rotation* rotationOut) +{ + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + Serializer serializer(buffer, sizeof(buffer)); + + serializer.insert(FunctionSelector::READ); + serializer.insert(frameId); + + serializer.insert(format); + + assert(serializer.isOk()); + + uint8_t responseLength = sizeof(buffer); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_FRAME_CONFIG, buffer, (uint8_t)serializer.usedLength(), REPLY_FRAME_CONFIG, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + Serializer deserializer(buffer, responseLength); + + deserializer.extract(frameId); + + deserializer.extract(format); + + assert(trackingEnabledOut); + deserializer.extract(*trackingEnabledOut); + + assert(translationOut); + for(unsigned int i=0; i < 3; i++) + deserializer.extract(translationOut[i]); + + if( format == FrameConfig::Format::EULER ) + { + deserializer.extract(rotationOut->euler); + + } + if( format == FrameConfig::Format::QUATERNION ) + { + deserializer.extract(rotationOut->quaternion); + + } + if( deserializer.remaining() != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +TypedResult saveFrameConfig(C::mip_interface& device, uint8_t frameId) +{ + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + Serializer serializer(buffer, sizeof(buffer)); + + serializer.insert(FunctionSelector::SAVE); + serializer.insert(frameId); + + assert(serializer.isOk()); + + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_FRAME_CONFIG, buffer, (uint8_t)serializer.usedLength()); +} +TypedResult loadFrameConfig(C::mip_interface& device, uint8_t frameId) +{ + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + Serializer serializer(buffer, sizeof(buffer)); + + serializer.insert(FunctionSelector::LOAD); + serializer.insert(frameId); + + assert(serializer.isOk()); + + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_FRAME_CONFIG, buffer, (uint8_t)serializer.usedLength()); +} +TypedResult defaultFrameConfig(C::mip_interface& device, uint8_t frameId) +{ + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + Serializer serializer(buffer, sizeof(buffer)); + + serializer.insert(FunctionSelector::RESET); + serializer.insert(frameId); + + assert(serializer.isOk()); + + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_FRAME_CONFIG, buffer, (uint8_t)serializer.usedLength()); +} +void EchoControl::insert(Serializer& serializer) const +{ + serializer.insert(function); + + if( function == FunctionSelector::WRITE ) + { + serializer.insert(mode); + + } +} +void EchoControl::extract(Serializer& serializer) +{ + serializer.extract(function); + + if( function == FunctionSelector::WRITE ) + { + serializer.extract(mode); + + } +} + +void EchoControl::Response::insert(Serializer& serializer) const +{ + serializer.insert(mode); + +} +void EchoControl::Response::extract(Serializer& serializer) +{ + serializer.extract(mode); + +} + +TypedResult writeEchoControl(C::mip_interface& device, EchoControl::Mode mode) +{ + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + Serializer serializer(buffer, sizeof(buffer)); + + serializer.insert(FunctionSelector::WRITE); + serializer.insert(mode); + + assert(serializer.isOk()); + + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ECHO_CONTROL, buffer, (uint8_t)serializer.usedLength()); +} +TypedResult readEchoControl(C::mip_interface& device, EchoControl::Mode* modeOut) +{ + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + Serializer serializer(buffer, sizeof(buffer)); + + serializer.insert(FunctionSelector::READ); + assert(serializer.isOk()); + + uint8_t responseLength = sizeof(buffer); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_ECHO_CONTROL, buffer, (uint8_t)serializer.usedLength(), REPLY_ECHO_CONTROL, buffer, &responseLength); + + if( result == MIP_ACK_OK ) + { + Serializer deserializer(buffer, responseLength); + + assert(modeOut); + deserializer.extract(*modeOut); + + if( deserializer.remaining() != 0 ) + result = MIP_STATUS_ERROR; + } + return result; +} +TypedResult saveEchoControl(C::mip_interface& device) +{ + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + Serializer serializer(buffer, sizeof(buffer)); + + serializer.insert(FunctionSelector::SAVE); + assert(serializer.isOk()); + + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ECHO_CONTROL, buffer, (uint8_t)serializer.usedLength()); +} +TypedResult loadEchoControl(C::mip_interface& device) +{ + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + Serializer serializer(buffer, sizeof(buffer)); + + serializer.insert(FunctionSelector::LOAD); + assert(serializer.isOk()); + + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ECHO_CONTROL, buffer, (uint8_t)serializer.usedLength()); +} +TypedResult defaultEchoControl(C::mip_interface& device) +{ + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + Serializer serializer(buffer, sizeof(buffer)); + + serializer.insert(FunctionSelector::RESET); + assert(serializer.isOk()); + + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ECHO_CONTROL, buffer, (uint8_t)serializer.usedLength()); +} +void PosEcef::insert(Serializer& serializer) const +{ + serializer.insert(time); + + serializer.insert(frame_id); + + serializer.insert(position); + + serializer.insert(uncertainty); + + serializer.insert(valid_flags); + +} +void PosEcef::extract(Serializer& serializer) +{ + serializer.extract(time); + + serializer.extract(frame_id); + + serializer.extract(position); + + serializer.extract(uncertainty); + + serializer.extract(valid_flags); + +} + +TypedResult posEcef(C::mip_interface& device, const Time& time, uint8_t frameId, const double* position, const float* uncertainty, PosEcef::ValidFlags validFlags) +{ + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + Serializer serializer(buffer, sizeof(buffer)); + + serializer.insert(time); + + serializer.insert(frameId); + + assert(position); + for(unsigned int i=0; i < 3; i++) + serializer.insert(position[i]); + + assert(uncertainty); + for(unsigned int i=0; i < 3; i++) + serializer.insert(uncertainty[i]); + + serializer.insert(validFlags); + + assert(serializer.isOk()); + + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_POS_ECEF, buffer, (uint8_t)serializer.usedLength()); +} +void PosLlh::insert(Serializer& serializer) const +{ + serializer.insert(time); + + serializer.insert(frame_id); + + serializer.insert(latitude); + + serializer.insert(longitude); + + serializer.insert(height); + + serializer.insert(uncertainty); + + serializer.insert(valid_flags); + +} +void PosLlh::extract(Serializer& serializer) +{ + serializer.extract(time); + + serializer.extract(frame_id); + + serializer.extract(latitude); + + serializer.extract(longitude); + + serializer.extract(height); + + serializer.extract(uncertainty); + + serializer.extract(valid_flags); + +} + +TypedResult posLlh(C::mip_interface& device, const Time& time, uint8_t frameId, double latitude, double longitude, double height, const float* uncertainty, PosLlh::ValidFlags validFlags) +{ + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + Serializer serializer(buffer, sizeof(buffer)); + + serializer.insert(time); + + serializer.insert(frameId); + + serializer.insert(latitude); + + serializer.insert(longitude); + + serializer.insert(height); + + assert(uncertainty); + for(unsigned int i=0; i < 3; i++) + serializer.insert(uncertainty[i]); + + serializer.insert(validFlags); + + assert(serializer.isOk()); + + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_POS_LLH, buffer, (uint8_t)serializer.usedLength()); +} +void HeightAboveEllipsoid::insert(Serializer& serializer) const +{ + serializer.insert(time); + + serializer.insert(frame_id); + + serializer.insert(height); + + serializer.insert(uncertainty); + + serializer.insert(valid_flags); + +} +void HeightAboveEllipsoid::extract(Serializer& serializer) +{ + serializer.extract(time); + + serializer.extract(frame_id); + + serializer.extract(height); + + serializer.extract(uncertainty); + + serializer.extract(valid_flags); + +} + +TypedResult heightAboveEllipsoid(C::mip_interface& device, const Time& time, uint8_t frameId, float height, float uncertainty, uint16_t validFlags) +{ + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + Serializer serializer(buffer, sizeof(buffer)); + + serializer.insert(time); + + serializer.insert(frameId); + + serializer.insert(height); + + serializer.insert(uncertainty); + + serializer.insert(validFlags); + + assert(serializer.isOk()); + + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_HEIGHT_ABOVE_ELLIPSOID, buffer, (uint8_t)serializer.usedLength()); +} +void VelEcef::insert(Serializer& serializer) const +{ + serializer.insert(time); + + serializer.insert(frame_id); + + serializer.insert(velocity); + + serializer.insert(uncertainty); + + serializer.insert(valid_flags); + +} +void VelEcef::extract(Serializer& serializer) +{ + serializer.extract(time); + + serializer.extract(frame_id); + + serializer.extract(velocity); + + serializer.extract(uncertainty); + + serializer.extract(valid_flags); + +} + +TypedResult velEcef(C::mip_interface& device, const Time& time, uint8_t frameId, const float* velocity, const float* uncertainty, VelEcef::ValidFlags validFlags) +{ + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + Serializer serializer(buffer, sizeof(buffer)); + + serializer.insert(time); + + serializer.insert(frameId); + + assert(velocity); + for(unsigned int i=0; i < 3; i++) + serializer.insert(velocity[i]); + + assert(uncertainty); + for(unsigned int i=0; i < 3; i++) + serializer.insert(uncertainty[i]); + + serializer.insert(validFlags); + + assert(serializer.isOk()); + + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_VEL_ECEF, buffer, (uint8_t)serializer.usedLength()); +} +void VelNed::insert(Serializer& serializer) const +{ + serializer.insert(time); + + serializer.insert(frame_id); + + serializer.insert(velocity); + + serializer.insert(uncertainty); + + serializer.insert(valid_flags); + +} +void VelNed::extract(Serializer& serializer) +{ + serializer.extract(time); + + serializer.extract(frame_id); + + serializer.extract(velocity); + + serializer.extract(uncertainty); + + serializer.extract(valid_flags); + +} + +TypedResult velNed(C::mip_interface& device, const Time& time, uint8_t frameId, const float* velocity, const float* uncertainty, VelNed::ValidFlags validFlags) +{ + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + Serializer serializer(buffer, sizeof(buffer)); + + serializer.insert(time); + + serializer.insert(frameId); + + assert(velocity); + for(unsigned int i=0; i < 3; i++) + serializer.insert(velocity[i]); + + assert(uncertainty); + for(unsigned int i=0; i < 3; i++) + serializer.insert(uncertainty[i]); + + serializer.insert(validFlags); + + assert(serializer.isOk()); + + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_VEL_NED, buffer, (uint8_t)serializer.usedLength()); +} +void VelBodyFrame::insert(Serializer& serializer) const +{ + serializer.insert(time); + + serializer.insert(frame_id); + + serializer.insert(velocity); + + serializer.insert(uncertainty); + + serializer.insert(valid_flags); + +} +void VelBodyFrame::extract(Serializer& serializer) +{ + serializer.extract(time); + + serializer.extract(frame_id); + + serializer.extract(velocity); + + serializer.extract(uncertainty); + + serializer.extract(valid_flags); + +} + +TypedResult velBodyFrame(C::mip_interface& device, const Time& time, uint8_t frameId, const float* velocity, const float* uncertainty, VelBodyFrame::ValidFlags validFlags) +{ + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + Serializer serializer(buffer, sizeof(buffer)); + + serializer.insert(time); + + serializer.insert(frameId); + + assert(velocity); + for(unsigned int i=0; i < 3; i++) + serializer.insert(velocity[i]); + + assert(uncertainty); + for(unsigned int i=0; i < 3; i++) + serializer.insert(uncertainty[i]); + + serializer.insert(validFlags); + + assert(serializer.isOk()); + + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_VEL_BODY_FRAME, buffer, (uint8_t)serializer.usedLength()); +} +void HeadingTrue::insert(Serializer& serializer) const +{ + serializer.insert(time); + + serializer.insert(frame_id); + + serializer.insert(heading); + + serializer.insert(uncertainty); + + serializer.insert(valid_flags); + +} +void HeadingTrue::extract(Serializer& serializer) +{ + serializer.extract(time); + + serializer.extract(frame_id); + + serializer.extract(heading); + + serializer.extract(uncertainty); + + serializer.extract(valid_flags); + +} + +TypedResult headingTrue(C::mip_interface& device, const Time& time, uint8_t frameId, float heading, float uncertainty, uint16_t validFlags) +{ + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + Serializer serializer(buffer, sizeof(buffer)); + + serializer.insert(time); + + serializer.insert(frameId); + + serializer.insert(heading); + + serializer.insert(uncertainty); + + serializer.insert(validFlags); + + assert(serializer.isOk()); + + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_HEADING_TRUE, buffer, (uint8_t)serializer.usedLength()); +} +void MagneticField::insert(Serializer& serializer) const +{ + serializer.insert(time); + + serializer.insert(frame_id); + + serializer.insert(magnetic_field); + + serializer.insert(uncertainty); + + serializer.insert(valid_flags); + +} +void MagneticField::extract(Serializer& serializer) +{ + serializer.extract(time); + + serializer.extract(frame_id); + + serializer.extract(magnetic_field); + + serializer.extract(uncertainty); + + serializer.extract(valid_flags); + +} + +TypedResult magneticField(C::mip_interface& device, const Time& time, uint8_t frameId, const float* magneticField, const float* uncertainty, MagneticField::ValidFlags validFlags) +{ + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + Serializer serializer(buffer, sizeof(buffer)); + + serializer.insert(time); + + serializer.insert(frameId); + + assert(magneticField); + for(unsigned int i=0; i < 3; i++) + serializer.insert(magneticField[i]); + + assert(uncertainty); + for(unsigned int i=0; i < 3; i++) + serializer.insert(uncertainty[i]); + + serializer.insert(validFlags); + + assert(serializer.isOk()); + + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAGNETIC_FIELD, buffer, (uint8_t)serializer.usedLength()); +} +void Pressure::insert(Serializer& serializer) const +{ + serializer.insert(time); + + serializer.insert(frame_id); + + serializer.insert(pressure); + + serializer.insert(uncertainty); + + serializer.insert(valid_flags); + +} +void Pressure::extract(Serializer& serializer) +{ + serializer.extract(time); + + serializer.extract(frame_id); + + serializer.extract(pressure); + + serializer.extract(uncertainty); + + serializer.extract(valid_flags); + +} + +TypedResult pressure(C::mip_interface& device, const Time& time, uint8_t frameId, float pressure, float uncertainty, uint16_t validFlags) +{ + uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; + Serializer serializer(buffer, sizeof(buffer)); + + serializer.insert(time); + + serializer.insert(frameId); + + serializer.insert(pressure); + + serializer.insert(uncertainty); + + serializer.insert(validFlags); + + assert(serializer.isOk()); + + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_PRESSURE, buffer, (uint8_t)serializer.usedLength()); +} + +} // namespace commands_aiding +} // namespace mip + diff --git a/src/mip/definitions/commands_aiding.hpp b/src/cpp/mip/definitions/commands_aiding.hpp similarity index 81% rename from src/mip/definitions/commands_aiding.hpp rename to src/cpp/mip/definitions/commands_aiding.hpp index 3987d1c12..59f523cd1 100644 --- a/src/mip/definitions/commands_aiding.hpp +++ b/src/cpp/mip/definitions/commands_aiding.hpp @@ -1,16 +1,14 @@ #pragma once -#include "common.h" -#include "descriptors.h" -#include "../mip_result.h" +#include +#include +#include +#include #include #include -#include namespace mip { -class Serializer; - namespace C { struct mip_interface; } // namespace C @@ -18,9 +16,9 @@ struct mip_interface; namespace commands_aiding { //////////////////////////////////////////////////////////////////////////////// -///@addtogroup MipCommands_cpp MIP Commands [CPP] +///@addtogroup MipCommands_cpp ///@{ -///@defgroup aiding_commands_cpp Aiding Commands [CPP] +///@defgroup aiding_commands_cpp Aiding Commands /// ///@{ @@ -68,23 +66,26 @@ struct Time TIME_OF_ARRIVAL = 3, ///< Timestamp provided is a fixed latency relative to time of message arrival. }; + /// Parameters Timebase timebase = static_cast(0); ///< Timebase reference, e.g. internal, external, GPS, UTC, etc. uint8_t reserved = 0; ///< Reserved, set to 0x01. uint64_t nanoseconds = 0; ///< Nanoseconds since the timebase epoch. + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const Time& self); -void extract(Serializer& serializer, Time& self); - //////////////////////////////////////////////////////////////////////////////// // Mip Fields //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_aiding_frame_config (0x13,0x01) Frame Config [CPP] -/// Defines an aiding frame associated with a specific sensor frame ID. The frame ID used in this command -/// should mirror the frame ID used in the aiding command (if that aiding measurement is measured in this reference frame) +///@defgroup aiding_frame_config_cpp (0x13,0x01) Frame Config +/// Defines an aiding frame associated with a specific sensor frame ID. +/// The frame ID used in this command should mirror the frame ID used in the aiding command +/// (if that aiding measurement is measured in this reference frame). /// /// This transform satisfies the following relationship: /// @@ -120,11 +121,12 @@ struct FrameConfig union Rotation { - Rotation() {} Vector3f euler; Quatf quaternion; + + Rotation() {} }; - + /// Parameters FunctionSelector function = static_cast(0); uint8_t frame_id = 0; ///< Reference frame number. Limit 4. Format format = static_cast(0); ///< Format of the transformation. @@ -132,27 +134,20 @@ struct FrameConfig Vector3f translation; ///< Translation X, Y, and Z. Rotation rotation; ///< Rotation as specified by format. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_aiding::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_aiding::CMD_FRAME_CONFIG; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "FrameConfig"; static constexpr const char* DOC_NAME = "Frame Configuration"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x801F; - static constexpr const uint32_t READ_PARAMS = 0x8003; - static constexpr const uint32_t SAVE_PARAMS = 0x8001; - static constexpr const uint32_t LOAD_PARAMS = 0x8001; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8001; - static constexpr const uint32_t ECHOED_PARAMS = 0x0003; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(frame_id,format,tracking_enabled,translation,rotation); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(frame_id),std::ref(format),std::ref(tracking_enabled),std::ref(translation),std::ref(rotation)); } @@ -165,35 +160,43 @@ struct FrameConfig return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { - static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_aiding::DESCRIPTOR_SET; - static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_aiding::REPLY_FRAME_CONFIG; - static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; - static constexpr const char* NAME = "FrameConfig::Response"; - static constexpr const char* DOC_NAME = "Frame Configuration Response"; - - static constexpr const uint32_t ECHOED_PARAMS = 0x0003; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; + /// Parameters uint8_t frame_id = 0; ///< Reference frame number. Limit 4. Format format = static_cast(0); ///< Format of the transformation. bool tracking_enabled = 0; ///< If enabled, the Kalman filter will track errors. Vector3f translation; ///< Translation X, Y, and Z. Rotation rotation; ///< Rotation as specified by format. + /// Descriptors + static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_aiding::DESCRIPTOR_SET; + static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_aiding::REPLY_FRAME_CONFIG; + static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; + static constexpr const char* NAME = "FrameConfig::Response"; + static constexpr const char* DOC_NAME = "Frame Configuration Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; + + auto asTuple() const + { + return std::make_tuple(frame_id,format,tracking_enabled,translation,rotation); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(frame_id),std::ref(format),std::ref(tracking_enabled),std::ref(translation),std::ref(rotation)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const FrameConfig& self); -void extract(Serializer& serializer, FrameConfig& self); - -void insert(Serializer& serializer, const FrameConfig::Response& self); -void extract(Serializer& serializer, FrameConfig::Response& self); - TypedResult writeFrameConfig(C::mip_interface& device, uint8_t frameId, FrameConfig::Format format, bool trackingEnabled, const float* translation, const FrameConfig::Rotation& rotation); TypedResult readFrameConfig(C::mip_interface& device, uint8_t frameId, FrameConfig::Format format, bool* trackingEnabledOut, float* translationOut, FrameConfig::Rotation* rotationOut); TypedResult saveFrameConfig(C::mip_interface& device, uint8_t frameId); @@ -203,7 +206,7 @@ TypedResult defaultFrameConfig(C::mip_interface& device, uint8_t fr ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_aiding_echo_control (0x13,0x1F) Echo Control [CPP] +///@defgroup aiding_echo_control_cpp (0x13,0x1F) Echo Control /// Controls command response behavior to external aiding commands /// ///@{ @@ -217,30 +220,24 @@ struct EchoControl RESPONSE = 2, ///< Echo the data back as a response. }; + /// Parameters FunctionSelector function = static_cast(0); Mode mode = static_cast(0); ///< Controls data echoing. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_aiding::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_aiding::CMD_ECHO_CONTROL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "EchoControl"; static constexpr const char* DOC_NAME = "Aiding Command Echo Control"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8001; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(mode); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(mode)); } @@ -252,31 +249,39 @@ struct EchoControl return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + Mode mode = static_cast(0); ///< Controls data echoing. + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_aiding::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_aiding::REPLY_ECHO_CONTROL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "EchoControl::Response"; static constexpr const char* DOC_NAME = "Aiding Command Echo Control Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - Mode mode = static_cast(0); ///< Controls data echoing. - + auto asTuple() const + { + return std::make_tuple(mode); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(mode)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const EchoControl& self); -void extract(Serializer& serializer, EchoControl& self); - -void insert(Serializer& serializer, const EchoControl::Response& self); -void extract(Serializer& serializer, EchoControl::Response& self); - TypedResult writeEchoControl(C::mip_interface& device, EchoControl::Mode mode); TypedResult readEchoControl(C::mip_interface& device, EchoControl::Mode* modeOut); TypedResult saveEchoControl(C::mip_interface& device); @@ -286,7 +291,7 @@ TypedResult defaultEchoControl(C::mip_interface& device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_aiding_pos_ecef (0x13,0x21) Pos Ecef [CPP] +///@defgroup aiding_pos_ecef_cpp (0x13,0x21) Pos Ecef /// Cartesian vector position aiding command. Coordinates are given in the WGS84 ECEF system. /// ///@{ @@ -295,6 +300,7 @@ struct PosEcef { struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -314,52 +320,53 @@ struct PosEcef ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool x() const { return (value & X) > 0; } - void x(bool val) { if(val) value |= X; else value &= ~X; } + void x(bool val) { value &= ~X; if(val) value |= X; } bool y() const { return (value & Y) > 0; } - void y(bool val) { if(val) value |= Y; else value &= ~Y; } + void y(bool val) { value &= ~Y; if(val) value |= Y; } bool z() const { return (value & Z) > 0; } - void z(bool val) { if(val) value |= Z; else value &= ~Z; } - + void z(bool val) { value &= ~Z; if(val) value |= Z; } bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters Time time; ///< Timestamp of the measurement. uint8_t frame_id = 0; ///< Source ID for this estimate (source_id == 0 indicates this sensor, source_id > 0 indicates an external estimate). Vector3d position; ///< ECEF position [m]. Vector3f uncertainty; ///< ECEF position uncertainty [m]. Cannot be 0 unless the corresponding valid flags are 0. ValidFlags valid_flags; ///< Valid flags. Axes with 0 will be completely ignored. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_aiding::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_aiding::CMD_POS_ECEF; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "PosEcef"; static constexpr const char* DOC_NAME = "ECEF Position"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(time,frame_id,position,uncertainty,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(time),std::ref(frame_id),std::ref(position),std::ref(uncertainty),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + typedef void Response; }; -void insert(Serializer& serializer, const PosEcef& self); -void extract(Serializer& serializer, PosEcef& self); - TypedResult posEcef(C::mip_interface& device, const Time& time, uint8_t frameId, const double* position, const float* uncertainty, PosEcef::ValidFlags validFlags); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_aiding_pos_llh (0x13,0x22) Pos Llh [CPP] -/// Geodetic position aiding command. Coordinates are given in WGS84 geodetic latitude, longitude, and height above the ellipsoid. +///@defgroup aiding_pos_llh_cpp (0x13,0x22) Pos Llh +/// Geodetic position aiding command. +/// Coordinates are given in WGS84 geodetic latitude, longitude, and height above the ellipsoid. /// Uncertainty is given in NED coordinates, which are parallel to incremental changes in latitude, longitude, and height. /// ///@{ @@ -368,6 +375,7 @@ struct PosLlh { struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -387,16 +395,15 @@ struct PosLlh ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool latitude() const { return (value & LATITUDE) > 0; } - void latitude(bool val) { if(val) value |= LATITUDE; else value &= ~LATITUDE; } + void latitude(bool val) { value &= ~LATITUDE; if(val) value |= LATITUDE; } bool longitude() const { return (value & LONGITUDE) > 0; } - void longitude(bool val) { if(val) value |= LONGITUDE; else value &= ~LONGITUDE; } + void longitude(bool val) { value &= ~LONGITUDE; if(val) value |= LONGITUDE; } bool height() const { return (value & HEIGHT) > 0; } - void height(bool val) { if(val) value |= HEIGHT; else value &= ~HEIGHT; } - + void height(bool val) { value &= ~HEIGHT; if(val) value |= HEIGHT; } bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters Time time; ///< Timestamp of the measurement. uint8_t frame_id = 0; ///< Source ID for this estimate (source_id == 0 indicates this sensor, source_id > 0 indicates an external estimate). double latitude = 0; ///< [deg] @@ -405,76 +412,79 @@ struct PosLlh Vector3f uncertainty; ///< NED position uncertainty. Cannot be 0 unless the corresponding valid flags are 0. ValidFlags valid_flags; ///< Valid flags. Axes with 0 will be completely ignored. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_aiding::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_aiding::CMD_POS_LLH; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "PosLlh"; static constexpr const char* DOC_NAME = "LLH Position"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(time,frame_id,latitude,longitude,height,uncertainty,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(time),std::ref(frame_id),std::ref(latitude),std::ref(longitude),std::ref(height),std::ref(uncertainty),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + typedef void Response; }; -void insert(Serializer& serializer, const PosLlh& self); -void extract(Serializer& serializer, PosLlh& self); - TypedResult posLlh(C::mip_interface& device, const Time& time, uint8_t frameId, double latitude, double longitude, double height, const float* uncertainty, PosLlh::ValidFlags validFlags); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_aiding_height_above_ellipsoid (0x13,0x23) Height Above Ellipsoid [CPP] +///@defgroup aiding_height_above_ellipsoid_cpp (0x13,0x23) Height Above Ellipsoid /// Estimated value of the height above ellipsoid. /// ///@{ struct HeightAboveEllipsoid { + /// Parameters Time time; ///< Timestamp of the measurement. uint8_t frame_id = 0; ///< Source ID for this estimate (source_id == 0 indicates this sensor, source_id > 0 indicates an external estimate). float height = 0; ///< [m] float uncertainty = 0; ///< [m] uint16_t valid_flags = 0; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_aiding::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_aiding::CMD_HEIGHT_ABOVE_ELLIPSOID; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "HeightAboveEllipsoid"; static constexpr const char* DOC_NAME = "Height Above Ellipsoid"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(time,frame_id,height,uncertainty,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(time),std::ref(frame_id),std::ref(height),std::ref(uncertainty),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + typedef void Response; }; -void insert(Serializer& serializer, const HeightAboveEllipsoid& self); -void extract(Serializer& serializer, HeightAboveEllipsoid& self); - TypedResult heightAboveEllipsoid(C::mip_interface& device, const Time& time, uint8_t frameId, float height, float uncertainty, uint16_t validFlags); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_aiding_vel_ecef (0x13,0x28) Vel Ecef [CPP] +///@defgroup aiding_vel_ecef_cpp (0x13,0x28) Vel Ecef /// ECEF velocity aiding command. Coordinates are given in the WGS84 ECEF frame. /// ///@{ @@ -483,6 +493,7 @@ struct VelEcef { struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -502,51 +513,51 @@ struct VelEcef ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool x() const { return (value & X) > 0; } - void x(bool val) { if(val) value |= X; else value &= ~X; } + void x(bool val) { value &= ~X; if(val) value |= X; } bool y() const { return (value & Y) > 0; } - void y(bool val) { if(val) value |= Y; else value &= ~Y; } + void y(bool val) { value &= ~Y; if(val) value |= Y; } bool z() const { return (value & Z) > 0; } - void z(bool val) { if(val) value |= Z; else value &= ~Z; } - + void z(bool val) { value &= ~Z; if(val) value |= Z; } bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters Time time; ///< Timestamp of the measurement. uint8_t frame_id = 0; ///< Source ID for this estimate (source_id == 0 indicates this sensor, source_id > 0 indicates an external estimate). Vector3f velocity; ///< ECEF velocity [m/s]. Vector3f uncertainty; ///< ECEF velocity uncertainty [m/s]. Cannot be 0 unless the corresponding valid flags are 0. ValidFlags valid_flags; ///< Valid flags. Axes with 0 will be completely ignored. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_aiding::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_aiding::CMD_VEL_ECEF; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "VelEcef"; static constexpr const char* DOC_NAME = "ECEF Velocity"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(time,frame_id,velocity,uncertainty,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(time),std::ref(frame_id),std::ref(velocity),std::ref(uncertainty),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + typedef void Response; }; -void insert(Serializer& serializer, const VelEcef& self); -void extract(Serializer& serializer, VelEcef& self); - TypedResult velEcef(C::mip_interface& device, const Time& time, uint8_t frameId, const float* velocity, const float* uncertainty, VelEcef::ValidFlags validFlags); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_aiding_vel_ned (0x13,0x29) Vel Ned [CPP] +///@defgroup aiding_vel_ned_cpp (0x13,0x29) Vel Ned /// NED velocity aiding command. Coordinates are given in the local North-East-Down frame. /// ///@{ @@ -555,6 +566,7 @@ struct VelNed { struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -574,53 +586,52 @@ struct VelNed ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool x() const { return (value & X) > 0; } - void x(bool val) { if(val) value |= X; else value &= ~X; } + void x(bool val) { value &= ~X; if(val) value |= X; } bool y() const { return (value & Y) > 0; } - void y(bool val) { if(val) value |= Y; else value &= ~Y; } + void y(bool val) { value &= ~Y; if(val) value |= Y; } bool z() const { return (value & Z) > 0; } - void z(bool val) { if(val) value |= Z; else value &= ~Z; } - + void z(bool val) { value &= ~Z; if(val) value |= Z; } bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters Time time; ///< Timestamp of the measurement. uint8_t frame_id = 0; ///< Source ID for this estimate (source_id == 0 indicates this sensor, source_id > 0 indicates an external estimate). Vector3f velocity; ///< NED velocity [m/s]. Vector3f uncertainty; ///< NED velocity uncertainty [m/s]. Cannot be 0 unless the corresponding valid flags are 0. ValidFlags valid_flags; ///< Valid flags. Axes with 0 will be completely ignored. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_aiding::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_aiding::CMD_VEL_NED; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "VelNed"; static constexpr const char* DOC_NAME = "NED Velocity"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(time,frame_id,velocity,uncertainty,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(time),std::ref(frame_id),std::ref(velocity),std::ref(uncertainty),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + typedef void Response; }; -void insert(Serializer& serializer, const VelNed& self); -void extract(Serializer& serializer, VelNed& self); - TypedResult velNed(C::mip_interface& device, const Time& time, uint8_t frameId, const float* velocity, const float* uncertainty, VelNed::ValidFlags validFlags); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_aiding_vel_body_frame (0x13,0x2A) Vel Body Frame [CPP] -/// Estimate of velocity of the vehicle in the frame associated -/// with the given sensor ID, relative to the vehicle frame. +///@defgroup aiding_vel_body_frame_cpp (0x13,0x2A) Vel Body Frame +/// Estimated of velocity of the vehicle in the frame associated with the given sensor ID, relative to the vehicle frame. /// ///@{ @@ -628,6 +639,7 @@ struct VelBodyFrame { struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -647,91 +659,93 @@ struct VelBodyFrame ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool x() const { return (value & X) > 0; } - void x(bool val) { if(val) value |= X; else value &= ~X; } + void x(bool val) { value &= ~X; if(val) value |= X; } bool y() const { return (value & Y) > 0; } - void y(bool val) { if(val) value |= Y; else value &= ~Y; } + void y(bool val) { value &= ~Y; if(val) value |= Y; } bool z() const { return (value & Z) > 0; } - void z(bool val) { if(val) value |= Z; else value &= ~Z; } - + void z(bool val) { value &= ~Z; if(val) value |= Z; } bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters Time time; ///< Timestamp of the measurement. uint8_t frame_id = 0; ///< Source ID for this estimate (source_id == 0 indicates this sensor, source_id > 0 indicates an external estimate). Vector3f velocity; ///< [m/s] Vector3f uncertainty; ///< [m/s] 1-sigma uncertainty. Cannot be 0 unless the corresponding valid flags are 0. ValidFlags valid_flags; ///< Valid flags. Axes with 0 will be completely ignored. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_aiding::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_aiding::CMD_VEL_BODY_FRAME; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "VelBodyFrame"; static constexpr const char* DOC_NAME = "Body Frame Velocity"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(time,frame_id,velocity,uncertainty,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(time),std::ref(frame_id),std::ref(velocity),std::ref(uncertainty),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + typedef void Response; }; -void insert(Serializer& serializer, const VelBodyFrame& self); -void extract(Serializer& serializer, VelBodyFrame& self); - TypedResult velBodyFrame(C::mip_interface& device, const Time& time, uint8_t frameId, const float* velocity, const float* uncertainty, VelBodyFrame::ValidFlags validFlags); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_aiding_heading_true (0x13,0x31) Heading True [CPP] +///@defgroup aiding_heading_true_cpp (0x13,0x31) Heading True /// ///@{ struct HeadingTrue { + /// Parameters Time time; ///< Timestamp of the measurement. uint8_t frame_id = 0; ///< Source ID for this estimate (source_id == 0 indicates this sensor, source_id > 0 indicates an external estimate). float heading = 0; ///< Heading [radians]. Range +/- Pi. float uncertainty = 0; ///< Cannot be 0 unless the valid flags are 0. uint16_t valid_flags = 0; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_aiding::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_aiding::CMD_HEADING_TRUE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "HeadingTrue"; static constexpr const char* DOC_NAME = "True Heading"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(time,frame_id,heading,uncertainty,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(time),std::ref(frame_id),std::ref(heading),std::ref(uncertainty),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + typedef void Response; }; -void insert(Serializer& serializer, const HeadingTrue& self); -void extract(Serializer& serializer, HeadingTrue& self); - TypedResult headingTrue(C::mip_interface& device, const Time& time, uint8_t frameId, float heading, float uncertainty, uint16_t validFlags); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_aiding_magnetic_field (0x13,0x32) Magnetic Field [CPP] +///@defgroup aiding_magnetic_field_cpp (0x13,0x32) Magnetic Field /// Estimate of magnetic field in the frame associated with the given sensor ID. /// ///@{ @@ -740,6 +754,7 @@ struct MagneticField { struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -759,86 +774,88 @@ struct MagneticField ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool x() const { return (value & X) > 0; } - void x(bool val) { if(val) value |= X; else value &= ~X; } + void x(bool val) { value &= ~X; if(val) value |= X; } bool y() const { return (value & Y) > 0; } - void y(bool val) { if(val) value |= Y; else value &= ~Y; } + void y(bool val) { value &= ~Y; if(val) value |= Y; } bool z() const { return (value & Z) > 0; } - void z(bool val) { if(val) value |= Z; else value &= ~Z; } - + void z(bool val) { value &= ~Z; if(val) value |= Z; } bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters Time time; ///< Timestamp of the measurement. uint8_t frame_id = 0; ///< Source ID for this estimate (source_id == 0 indicates this sensor, source_id > 0 indicates an external estimate). Vector3f magnetic_field; ///< [G] Vector3f uncertainty; ///< [G] 1-sigma uncertainty. Cannot be 0 unless the corresponding valid flags are 0. ValidFlags valid_flags; ///< Valid flags. Axes with 0 will be completely ignored. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_aiding::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_aiding::CMD_MAGNETIC_FIELD; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "MagneticField"; static constexpr const char* DOC_NAME = "Magnetic Field"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(time,frame_id,magnetic_field,uncertainty,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(time),std::ref(frame_id),std::ref(magnetic_field),std::ref(uncertainty),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + typedef void Response; }; -void insert(Serializer& serializer, const MagneticField& self); -void extract(Serializer& serializer, MagneticField& self); - TypedResult magneticField(C::mip_interface& device, const Time& time, uint8_t frameId, const float* magneticField, const float* uncertainty, MagneticField::ValidFlags validFlags); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_aiding_pressure (0x13,0x33) Pressure [CPP] +///@defgroup aiding_pressure_cpp (0x13,0x33) Pressure /// Estimated value of air pressure. /// ///@{ struct Pressure { + /// Parameters Time time; ///< Timestamp of the measurement. uint8_t frame_id = 0; ///< Source ID for this estimate (source_id == 0 indicates this sensor, source_id > 0 indicates an external estimate). float pressure = 0; ///< [mbar] float uncertainty = 0; ///< [mbar] 1-sigma uncertainty. Cannot be 0 unless the valid flags are 0. uint16_t valid_flags = 0; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_aiding::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_aiding::CMD_PRESSURE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "Pressure"; static constexpr const char* DOC_NAME = "Pressure"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(time,frame_id,pressure,uncertainty,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(time),std::ref(frame_id),std::ref(pressure),std::ref(uncertainty),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + typedef void Response; }; -void insert(Serializer& serializer, const Pressure& self); -void extract(Serializer& serializer, Pressure& self); - TypedResult pressure(C::mip_interface& device, const Time& time, uint8_t frameId, float pressure, float uncertainty, uint16_t validFlags); ///@} diff --git a/src/mip/definitions/commands_base.cpp b/src/cpp/mip/definitions/commands_base.cpp similarity index 54% rename from src/mip/definitions/commands_base.cpp rename to src/cpp/mip/definitions/commands_base.cpp index 35965b4cb..07dbc036d 100644 --- a/src/mip/definitions/commands_base.cpp +++ b/src/cpp/mip/definitions/commands_base.cpp @@ -1,124 +1,109 @@ #include "commands_base.hpp" -#include "../utils/serialization.h" -#include "../mip_interface.h" +#include +#include #include namespace mip { -class Serializer; - namespace C { struct mip_interface; } // namespace C namespace commands_base { -using ::mip::insert; -using ::mip::extract; using namespace ::mip::C; //////////////////////////////////////////////////////////////////////////////// -// Shared Type Definitions +// Mip Fields //////////////////////////////////////////////////////////////////////////////// -void insert(Serializer& serializer, const BaseDeviceInfo& self) +void BaseDeviceInfo::insert(Serializer& serializer) const { - insert(serializer, self.firmware_version); + serializer.insert(firmware_version); for(unsigned int i=0; i < 16; i++) - insert(serializer, self.model_name[i]); + serializer.insert(model_name[i]); for(unsigned int i=0; i < 16; i++) - insert(serializer, self.model_number[i]); + serializer.insert(model_number[i]); for(unsigned int i=0; i < 16; i++) - insert(serializer, self.serial_number[i]); + serializer.insert(serial_number[i]); for(unsigned int i=0; i < 16; i++) - insert(serializer, self.lot_number[i]); + serializer.insert(lot_number[i]); for(unsigned int i=0; i < 16; i++) - insert(serializer, self.device_options[i]); + serializer.insert(device_options[i]); } -void extract(Serializer& serializer, BaseDeviceInfo& self) +void BaseDeviceInfo::extract(Serializer& serializer) { - extract(serializer, self.firmware_version); + serializer.extract(firmware_version); for(unsigned int i=0; i < 16; i++) - extract(serializer, self.model_name[i]); + serializer.extract(model_name[i]); for(unsigned int i=0; i < 16; i++) - extract(serializer, self.model_number[i]); + serializer.extract(model_number[i]); for(unsigned int i=0; i < 16; i++) - extract(serializer, self.serial_number[i]); + serializer.extract(serial_number[i]); for(unsigned int i=0; i < 16; i++) - extract(serializer, self.lot_number[i]); + serializer.extract(lot_number[i]); for(unsigned int i=0; i < 16; i++) - extract(serializer, self.device_options[i]); + serializer.extract(device_options[i]); } - -//////////////////////////////////////////////////////////////////////////////// -// Mip Fields -//////////////////////////////////////////////////////////////////////////////// - -void insert(Serializer& serializer, const Ping& self) +void Ping::insert(Serializer& serializer) const { (void)serializer; - (void)self; } -void extract(Serializer& serializer, Ping& self) +void Ping::extract(Serializer& serializer) { (void)serializer; - (void)self; } TypedResult ping(C::mip_interface& device) { return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_PING, NULL, 0); } -void insert(Serializer& serializer, const SetIdle& self) +void SetIdle::insert(Serializer& serializer) const { (void)serializer; - (void)self; } -void extract(Serializer& serializer, SetIdle& self) +void SetIdle::extract(Serializer& serializer) { (void)serializer; - (void)self; } TypedResult setIdle(C::mip_interface& device) { return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SET_TO_IDLE, NULL, 0); } -void insert(Serializer& serializer, const GetDeviceInfo& self) +void GetDeviceInfo::insert(Serializer& serializer) const { (void)serializer; - (void)self; } -void extract(Serializer& serializer, GetDeviceInfo& self) +void GetDeviceInfo::extract(Serializer& serializer) { (void)serializer; - (void)self; } -void insert(Serializer& serializer, const GetDeviceInfo::Response& self) +void GetDeviceInfo::Response::insert(Serializer& serializer) const { - insert(serializer, self.device_info); + serializer.insert(device_info); } -void extract(Serializer& serializer, GetDeviceInfo::Response& self) +void GetDeviceInfo::Response::extract(Serializer& serializer) { - extract(serializer, self.device_info); + serializer.extract(device_info); } @@ -134,34 +119,32 @@ TypedResult getDeviceInfo(C::mip_interface& device, BaseDeviceInf Serializer deserializer(buffer, responseLength); assert(deviceInfoOut); - extract(deserializer, *deviceInfoOut); + deserializer.extract(*deviceInfoOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; } return result; } -void insert(Serializer& serializer, const GetDeviceDescriptors& self) +void GetDeviceDescriptors::insert(Serializer& serializer) const { (void)serializer; - (void)self; } -void extract(Serializer& serializer, GetDeviceDescriptors& self) +void GetDeviceDescriptors::extract(Serializer& serializer) { (void)serializer; - (void)self; } -void insert(Serializer& serializer, const GetDeviceDescriptors::Response& self) +void GetDeviceDescriptors::Response::insert(Serializer& serializer) const { - for(unsigned int i=0; i < self.descriptors_count; i++) - insert(serializer, self.descriptors[i]); + for(unsigned int i=0; i < descriptors_count; i++) + serializer.insert(descriptors[i]); } -void extract(Serializer& serializer, GetDeviceDescriptors::Response& self) +void GetDeviceDescriptors::Response::extract(Serializer& serializer) { - for(self.descriptors_count = 0; (self.descriptors_count < sizeof(self.descriptors)/sizeof(self.descriptors[0])) && (serializer.remaining() > 0); (self.descriptors_count)++) - extract(serializer, self.descriptors[self.descriptors_count]); + for(descriptors_count = 0; (descriptors_count < sizeof(descriptors)/sizeof(descriptors[0])) && (serializer.remaining() > 0); (descriptors_count)++) + serializer.extract(descriptors[descriptors_count]); } @@ -177,32 +160,30 @@ TypedResult getDeviceDescriptors(C::mip_interface& device, Serializer deserializer(buffer, responseLength); for(*descriptorsOutCount = 0; (*descriptorsOutCount < descriptorsOutMax) && (deserializer.remaining() > 0); (*descriptorsOutCount)++) - extract(deserializer, descriptorsOut[*descriptorsOutCount]); + deserializer.extract(descriptorsOut[*descriptorsOutCount]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; } return result; } -void insert(Serializer& serializer, const BuiltInTest& self) +void BuiltInTest::insert(Serializer& serializer) const { (void)serializer; - (void)self; } -void extract(Serializer& serializer, BuiltInTest& self) +void BuiltInTest::extract(Serializer& serializer) { (void)serializer; - (void)self; } -void insert(Serializer& serializer, const BuiltInTest::Response& self) +void BuiltInTest::Response::insert(Serializer& serializer) const { - insert(serializer, self.result); + serializer.insert(result); } -void extract(Serializer& serializer, BuiltInTest::Response& self) +void BuiltInTest::Response::extract(Serializer& serializer) { - extract(serializer, self.result); + serializer.extract(result); } @@ -218,49 +199,45 @@ TypedResult builtInTest(C::mip_interface& device, uint32_t* resultO Serializer deserializer(buffer, responseLength); assert(resultOut); - extract(deserializer, *resultOut); + deserializer.extract(*resultOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; } return result; } -void insert(Serializer& serializer, const Resume& self) +void Resume::insert(Serializer& serializer) const { (void)serializer; - (void)self; } -void extract(Serializer& serializer, Resume& self) +void Resume::extract(Serializer& serializer) { (void)serializer; - (void)self; } TypedResult resume(C::mip_interface& device) { return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_RESUME, NULL, 0); } -void insert(Serializer& serializer, const GetExtendedDescriptors& self) +void GetExtendedDescriptors::insert(Serializer& serializer) const { (void)serializer; - (void)self; } -void extract(Serializer& serializer, GetExtendedDescriptors& self) +void GetExtendedDescriptors::extract(Serializer& serializer) { (void)serializer; - (void)self; } -void insert(Serializer& serializer, const GetExtendedDescriptors::Response& self) +void GetExtendedDescriptors::Response::insert(Serializer& serializer) const { - for(unsigned int i=0; i < self.descriptors_count; i++) - insert(serializer, self.descriptors[i]); + for(unsigned int i=0; i < descriptors_count; i++) + serializer.insert(descriptors[i]); } -void extract(Serializer& serializer, GetExtendedDescriptors::Response& self) +void GetExtendedDescriptors::Response::extract(Serializer& serializer) { - for(self.descriptors_count = 0; (self.descriptors_count < sizeof(self.descriptors)/sizeof(self.descriptors[0])) && (serializer.remaining() > 0); (self.descriptors_count)++) - extract(serializer, self.descriptors[self.descriptors_count]); + for(descriptors_count = 0; (descriptors_count < sizeof(descriptors)/sizeof(descriptors[0])) && (serializer.remaining() > 0); (descriptors_count)++) + serializer.extract(descriptors[descriptors_count]); } @@ -276,34 +253,32 @@ TypedResult getExtendedDescriptors(C::mip_interface& dev Serializer deserializer(buffer, responseLength); for(*descriptorsOutCount = 0; (*descriptorsOutCount < descriptorsOutMax) && (deserializer.remaining() > 0); (*descriptorsOutCount)++) - extract(deserializer, descriptorsOut[*descriptorsOutCount]); + deserializer.extract(descriptorsOut[*descriptorsOutCount]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; } return result; } -void insert(Serializer& serializer, const ContinuousBit& self) +void ContinuousBit::insert(Serializer& serializer) const { (void)serializer; - (void)self; } -void extract(Serializer& serializer, ContinuousBit& self) +void ContinuousBit::extract(Serializer& serializer) { (void)serializer; - (void)self; } -void insert(Serializer& serializer, const ContinuousBit::Response& self) +void ContinuousBit::Response::insert(Serializer& serializer) const { for(unsigned int i=0; i < 16; i++) - insert(serializer, self.result[i]); + serializer.insert(result[i]); } -void extract(Serializer& serializer, ContinuousBit::Response& self) +void ContinuousBit::Response::extract(Serializer& serializer) { for(unsigned int i=0; i < 16; i++) - extract(serializer, self.result[i]); + serializer.extract(result[i]); } @@ -318,52 +293,52 @@ TypedResult continuousBit(C::mip_interface& device, uint8_t* resu { Serializer deserializer(buffer, responseLength); - assert(resultOut || (16 == 0)); + assert(resultOut); for(unsigned int i=0; i < 16; i++) - extract(deserializer, resultOut[i]); + deserializer.extract(resultOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; } return result; } -void insert(Serializer& serializer, const CommSpeed& self) +void CommSpeed::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - insert(serializer, self.port); + serializer.insert(port); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.baud); + serializer.insert(baud); } } -void extract(Serializer& serializer, CommSpeed& self) +void CommSpeed::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - extract(serializer, self.port); + serializer.extract(port); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.baud); + serializer.extract(baud); } } -void insert(Serializer& serializer, const CommSpeed::Response& self) +void CommSpeed::Response::insert(Serializer& serializer) const { - insert(serializer, self.port); + serializer.insert(port); - insert(serializer, self.baud); + serializer.insert(baud); } -void extract(Serializer& serializer, CommSpeed::Response& self) +void CommSpeed::Response::extract(Serializer& serializer) { - extract(serializer, self.port); + serializer.extract(port); - extract(serializer, self.baud); + serializer.extract(baud); } @@ -372,36 +347,36 @@ TypedResult writeCommSpeed(C::mip_interface& device, uint8_t port, ui uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, port); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(port); - insert(serializer, baud); + serializer.insert(baud); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_COMM_SPEED, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_COMM_SPEED, buffer, (uint8_t)serializer.usedLength()); } TypedResult readCommSpeed(C::mip_interface& device, uint8_t port, uint32_t* baudOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); - insert(serializer, port); + serializer.insert(FunctionSelector::READ); + serializer.insert(port); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_COMM_SPEED, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_COMM_SPEED, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_COMM_SPEED, buffer, (uint8_t)serializer.usedLength(), REPLY_COMM_SPEED, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - extract(deserializer, port); + deserializer.extract(port); assert(baudOut); - extract(deserializer, *baudOut); + deserializer.extract(*baudOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -413,58 +388,58 @@ TypedResult saveCommSpeed(C::mip_interface& device, uint8_t port) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); - insert(serializer, port); + serializer.insert(FunctionSelector::SAVE); + serializer.insert(port); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_COMM_SPEED, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_COMM_SPEED, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadCommSpeed(C::mip_interface& device, uint8_t port) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); - insert(serializer, port); + serializer.insert(FunctionSelector::LOAD); + serializer.insert(port); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_COMM_SPEED, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_COMM_SPEED, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultCommSpeed(C::mip_interface& device, uint8_t port) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); - insert(serializer, port); + serializer.insert(FunctionSelector::RESET); + serializer.insert(port); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_COMM_SPEED, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_COMM_SPEED, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const GpsTimeUpdate& self) +void GpsTimeUpdate::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.field_id); + serializer.insert(field_id); - insert(serializer, self.value); + serializer.insert(value); } } -void extract(Serializer& serializer, GpsTimeUpdate& self) +void GpsTimeUpdate::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.field_id); + serializer.extract(field_id); - extract(serializer, self.value); + serializer.extract(value); } } @@ -474,24 +449,22 @@ TypedResult writeGpsTimeUpdate(C::mip_interface& device, GpsTimeU uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, fieldId); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(fieldId); - insert(serializer, value); + serializer.insert(value); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GPS_TIME_UPDATE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GPS_TIME_UPDATE, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const SoftReset& self) +void SoftReset::insert(Serializer& serializer) const { (void)serializer; - (void)self; } -void extract(Serializer& serializer, SoftReset& self) +void SoftReset::extract(Serializer& serializer) { (void)serializer; - (void)self; } TypedResult softReset(C::mip_interface& device) diff --git a/src/mip/definitions/commands_base.hpp b/src/cpp/mip/definitions/commands_base.hpp similarity index 73% rename from src/mip/definitions/commands_base.hpp rename to src/cpp/mip/definitions/commands_base.hpp index 65a17e7e4..6d9b3d992 100644 --- a/src/mip/definitions/commands_base.hpp +++ b/src/cpp/mip/definitions/commands_base.hpp @@ -1,16 +1,14 @@ #pragma once -#include "common.h" -#include "descriptors.h" -#include "../mip_result.h" +#include +#include +#include +#include #include #include -#include namespace mip { -class Serializer; - namespace C { struct mip_interface; } // namespace C @@ -18,9 +16,9 @@ struct mip_interface; namespace commands_base { //////////////////////////////////////////////////////////////////////////////// -///@addtogroup MipCommands_cpp MIP Commands [CPP] +///@addtogroup MipCommands_cpp ///@{ -///@defgroup base_commands_cpp Base Commands [CPP] +///@defgroup base_commands_cpp Base Commands /// ///@{ @@ -60,6 +58,7 @@ enum struct BaseDeviceInfo { + /// Parameters uint16_t firmware_version = 0; char model_name[16] = {0}; char model_number[16] = {0}; @@ -67,10 +66,11 @@ struct BaseDeviceInfo char lot_number[16] = {0}; char device_options[16] = {0}; + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const BaseDeviceInfo& self); -void extract(Serializer& serializer, BaseDeviceInfo& self); - enum class TimeFormat : uint8_t { GPS = 1, ///< GPS time, a = week number since 1980, b = time of week in milliseconds. @@ -78,6 +78,7 @@ enum class TimeFormat : uint8_t struct CommandedTestBitsGq7 : Bitfield { + typedef uint32_t Type; enum _enumType : uint32_t { NONE = 0x00000000, @@ -121,71 +122,69 @@ struct CommandedTestBitsGq7 : Bitfield CommandedTestBitsGq7& operator&=(uint32_t val) { return *this = value & val; } bool generalHardwareFault() const { return (value & GENERAL_HARDWARE_FAULT) > 0; } - void generalHardwareFault(bool val) { if(val) value |= GENERAL_HARDWARE_FAULT; else value &= ~GENERAL_HARDWARE_FAULT; } + void generalHardwareFault(bool val) { value &= ~GENERAL_HARDWARE_FAULT; if(val) value |= GENERAL_HARDWARE_FAULT; } bool generalFirmwareFault() const { return (value & GENERAL_FIRMWARE_FAULT) > 0; } - void generalFirmwareFault(bool val) { if(val) value |= GENERAL_FIRMWARE_FAULT; else value &= ~GENERAL_FIRMWARE_FAULT; } + void generalFirmwareFault(bool val) { value &= ~GENERAL_FIRMWARE_FAULT; if(val) value |= GENERAL_FIRMWARE_FAULT; } bool timingOverload() const { return (value & TIMING_OVERLOAD) > 0; } - void timingOverload(bool val) { if(val) value |= TIMING_OVERLOAD; else value &= ~TIMING_OVERLOAD; } + void timingOverload(bool val) { value &= ~TIMING_OVERLOAD; if(val) value |= TIMING_OVERLOAD; } bool bufferOverrun() const { return (value & BUFFER_OVERRUN) > 0; } - void bufferOverrun(bool val) { if(val) value |= BUFFER_OVERRUN; else value &= ~BUFFER_OVERRUN; } + void bufferOverrun(bool val) { value &= ~BUFFER_OVERRUN; if(val) value |= BUFFER_OVERRUN; } uint32_t reserved() const { return (value & RESERVED) >> 4; } void reserved(uint32_t val) { value = (value & ~RESERVED) | (val << 4); } bool ipcImuFault() const { return (value & IPC_IMU_FAULT) > 0; } - void ipcImuFault(bool val) { if(val) value |= IPC_IMU_FAULT; else value &= ~IPC_IMU_FAULT; } + void ipcImuFault(bool val) { value &= ~IPC_IMU_FAULT; if(val) value |= IPC_IMU_FAULT; } bool ipcNavFault() const { return (value & IPC_NAV_FAULT) > 0; } - void ipcNavFault(bool val) { if(val) value |= IPC_NAV_FAULT; else value &= ~IPC_NAV_FAULT; } + void ipcNavFault(bool val) { value &= ~IPC_NAV_FAULT; if(val) value |= IPC_NAV_FAULT; } bool ipcGnssFault() const { return (value & IPC_GNSS_FAULT) > 0; } - void ipcGnssFault(bool val) { if(val) value |= IPC_GNSS_FAULT; else value &= ~IPC_GNSS_FAULT; } + void ipcGnssFault(bool val) { value &= ~IPC_GNSS_FAULT; if(val) value |= IPC_GNSS_FAULT; } bool commsFault() const { return (value & COMMS_FAULT) > 0; } - void commsFault(bool val) { if(val) value |= COMMS_FAULT; else value &= ~COMMS_FAULT; } + void commsFault(bool val) { value &= ~COMMS_FAULT; if(val) value |= COMMS_FAULT; } bool imuAccelFault() const { return (value & IMU_ACCEL_FAULT) > 0; } - void imuAccelFault(bool val) { if(val) value |= IMU_ACCEL_FAULT; else value &= ~IMU_ACCEL_FAULT; } + void imuAccelFault(bool val) { value &= ~IMU_ACCEL_FAULT; if(val) value |= IMU_ACCEL_FAULT; } bool imuGyroFault() const { return (value & IMU_GYRO_FAULT) > 0; } - void imuGyroFault(bool val) { if(val) value |= IMU_GYRO_FAULT; else value &= ~IMU_GYRO_FAULT; } + void imuGyroFault(bool val) { value &= ~IMU_GYRO_FAULT; if(val) value |= IMU_GYRO_FAULT; } bool imuMagFault() const { return (value & IMU_MAG_FAULT) > 0; } - void imuMagFault(bool val) { if(val) value |= IMU_MAG_FAULT; else value &= ~IMU_MAG_FAULT; } + void imuMagFault(bool val) { value &= ~IMU_MAG_FAULT; if(val) value |= IMU_MAG_FAULT; } bool imuPressFault() const { return (value & IMU_PRESS_FAULT) > 0; } - void imuPressFault(bool val) { if(val) value |= IMU_PRESS_FAULT; else value &= ~IMU_PRESS_FAULT; } + void imuPressFault(bool val) { value &= ~IMU_PRESS_FAULT; if(val) value |= IMU_PRESS_FAULT; } uint32_t imuReserved() const { return (value & IMU_RESERVED) >> 16; } void imuReserved(uint32_t val) { value = (value & ~IMU_RESERVED) | (val << 16); } bool imuCalError() const { return (value & IMU_CAL_ERROR) > 0; } - void imuCalError(bool val) { if(val) value |= IMU_CAL_ERROR; else value &= ~IMU_CAL_ERROR; } + void imuCalError(bool val) { value &= ~IMU_CAL_ERROR; if(val) value |= IMU_CAL_ERROR; } bool imuGeneralFault() const { return (value & IMU_GENERAL_FAULT) > 0; } - void imuGeneralFault(bool val) { if(val) value |= IMU_GENERAL_FAULT; else value &= ~IMU_GENERAL_FAULT; } + void imuGeneralFault(bool val) { value &= ~IMU_GENERAL_FAULT; if(val) value |= IMU_GENERAL_FAULT; } uint32_t filtReserved() const { return (value & FILT_RESERVED) >> 20; } void filtReserved(uint32_t val) { value = (value & ~FILT_RESERVED) | (val << 20); } bool filtSolutionFault() const { return (value & FILT_SOLUTION_FAULT) > 0; } - void filtSolutionFault(bool val) { if(val) value |= FILT_SOLUTION_FAULT; else value &= ~FILT_SOLUTION_FAULT; } + void filtSolutionFault(bool val) { value &= ~FILT_SOLUTION_FAULT; if(val) value |= FILT_SOLUTION_FAULT; } bool filtGeneralFault() const { return (value & FILT_GENERAL_FAULT) > 0; } - void filtGeneralFault(bool val) { if(val) value |= FILT_GENERAL_FAULT; else value &= ~FILT_GENERAL_FAULT; } + void filtGeneralFault(bool val) { value &= ~FILT_GENERAL_FAULT; if(val) value |= FILT_GENERAL_FAULT; } bool gnssReceiver1Fault() const { return (value & GNSS_RECEIVER1_FAULT) > 0; } - void gnssReceiver1Fault(bool val) { if(val) value |= GNSS_RECEIVER1_FAULT; else value &= ~GNSS_RECEIVER1_FAULT; } + void gnssReceiver1Fault(bool val) { value &= ~GNSS_RECEIVER1_FAULT; if(val) value |= GNSS_RECEIVER1_FAULT; } bool gnssAntenna1Fault() const { return (value & GNSS_ANTENNA1_FAULT) > 0; } - void gnssAntenna1Fault(bool val) { if(val) value |= GNSS_ANTENNA1_FAULT; else value &= ~GNSS_ANTENNA1_FAULT; } + void gnssAntenna1Fault(bool val) { value &= ~GNSS_ANTENNA1_FAULT; if(val) value |= GNSS_ANTENNA1_FAULT; } bool gnssReceiver2Fault() const { return (value & GNSS_RECEIVER2_FAULT) > 0; } - void gnssReceiver2Fault(bool val) { if(val) value |= GNSS_RECEIVER2_FAULT; else value &= ~GNSS_RECEIVER2_FAULT; } + void gnssReceiver2Fault(bool val) { value &= ~GNSS_RECEIVER2_FAULT; if(val) value |= GNSS_RECEIVER2_FAULT; } bool gnssAntenna2Fault() const { return (value & GNSS_ANTENNA2_FAULT) > 0; } - void gnssAntenna2Fault(bool val) { if(val) value |= GNSS_ANTENNA2_FAULT; else value &= ~GNSS_ANTENNA2_FAULT; } + void gnssAntenna2Fault(bool val) { value &= ~GNSS_ANTENNA2_FAULT; if(val) value |= GNSS_ANTENNA2_FAULT; } bool gnssRtcmFailure() const { return (value & GNSS_RTCM_FAILURE) > 0; } - void gnssRtcmFailure(bool val) { if(val) value |= GNSS_RTCM_FAILURE; else value &= ~GNSS_RTCM_FAILURE; } + void gnssRtcmFailure(bool val) { value &= ~GNSS_RTCM_FAILURE; if(val) value |= GNSS_RTCM_FAILURE; } bool gnssRtkFault() const { return (value & GNSS_RTK_FAULT) > 0; } - void gnssRtkFault(bool val) { if(val) value |= GNSS_RTK_FAULT; else value &= ~GNSS_RTK_FAULT; } + void gnssRtkFault(bool val) { value &= ~GNSS_RTK_FAULT; if(val) value |= GNSS_RTK_FAULT; } bool gnssSolutionFault() const { return (value & GNSS_SOLUTION_FAULT) > 0; } - void gnssSolutionFault(bool val) { if(val) value |= GNSS_SOLUTION_FAULT; else value &= ~GNSS_SOLUTION_FAULT; } + void gnssSolutionFault(bool val) { value &= ~GNSS_SOLUTION_FAULT; if(val) value |= GNSS_SOLUTION_FAULT; } bool gnssGeneralFault() const { return (value & GNSS_GENERAL_FAULT) > 0; } - void gnssGeneralFault(bool val) { if(val) value |= GNSS_GENERAL_FAULT; else value &= ~GNSS_GENERAL_FAULT; } - + void gnssGeneralFault(bool val) { value &= ~GNSS_GENERAL_FAULT; if(val) value |= GNSS_GENERAL_FAULT; } bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - //////////////////////////////////////////////////////////////////////////////// // Mip Fields //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_base_ping (0x01,0x01) Ping [CPP] +///@defgroup base_ping_cpp (0x01,0x01) Ping /// Test Communications with a device. /// /// The Device will respond with an ACK, if present and operating correctly. @@ -196,36 +195,36 @@ struct CommandedTestBitsGq7 : Bitfield struct Ping { - + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_base::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_base::CMD_PING; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "Ping"; static constexpr const char* DOC_NAME = "Ping"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(); } - auto as_tuple() + auto asTuple() { return std::make_tuple(); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + typedef void Response; }; -void insert(Serializer& serializer, const Ping& self); -void extract(Serializer& serializer, Ping& self); - TypedResult ping(C::mip_interface& device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_base_set_idle (0x01,0x02) Set Idle [CPP] +///@defgroup base_set_idle_cpp (0x01,0x02) Set Idle /// Turn off all device data streams. /// /// The Device will respond with an ACK, if present and operating correctly. @@ -236,93 +235,99 @@ TypedResult ping(C::mip_interface& device); struct SetIdle { - + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_base::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_base::CMD_SET_TO_IDLE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "SetIdle"; static constexpr const char* DOC_NAME = "Set to idle"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(); } - auto as_tuple() + auto asTuple() { return std::make_tuple(); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + typedef void Response; }; -void insert(Serializer& serializer, const SetIdle& self); -void extract(Serializer& serializer, SetIdle& self); - TypedResult setIdle(C::mip_interface& device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_base_get_device_info (0x01,0x03) Get Device Info [CPP] +///@defgroup base_get_device_info_cpp (0x01,0x03) Get Device Info /// Get the device ID strings and firmware version number. /// ///@{ struct GetDeviceInfo { - + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_base::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_base::CMD_GET_DEVICE_INFO; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GetDeviceInfo"; static constexpr const char* DOC_NAME = "Get device information"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(); } - auto as_tuple() + auto asTuple() { return std::make_tuple(); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + BaseDeviceInfo device_info; + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_base::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_base::REPLY_DEVICE_INFO; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GetDeviceInfo::Response"; static constexpr const char* DOC_NAME = "Get device information Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - BaseDeviceInfo device_info; - + auto asTuple() const + { + return std::make_tuple(device_info); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(device_info)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const GetDeviceInfo& self); -void extract(Serializer& serializer, GetDeviceInfo& self); - -void insert(Serializer& serializer, const GetDeviceInfo::Response& self); -void extract(Serializer& serializer, GetDeviceInfo::Response& self); - TypedResult getDeviceInfo(C::mip_interface& device, BaseDeviceInfo* deviceInfoOut); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_base_get_device_descriptors (0x01,0x04) Get Device Descriptors [CPP] +///@defgroup base_get_device_descriptors_cpp (0x01,0x04) Get Device Descriptors /// Get the command and data descriptors supported by the device. /// /// Reply has two fields: "ACK/NACK" and "Descriptors". The "Descriptors" field is an array of 16 bit values. @@ -332,58 +337,64 @@ TypedResult getDeviceInfo(C::mip_interface& device, BaseDeviceInf struct GetDeviceDescriptors { - + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_base::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_base::CMD_GET_DEVICE_DESCRIPTORS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GetDeviceDescriptors"; static constexpr const char* DOC_NAME = "Get device descriptors"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(); } - auto as_tuple() + auto asTuple() { return std::make_tuple(); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint16_t descriptors[253] = {0}; + uint8_t descriptors_count = 0; + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_base::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_base::REPLY_DEVICE_DESCRIPTORS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GetDeviceDescriptors::Response"; static constexpr const char* DOC_NAME = "Get device descriptors Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000001; - uint16_t descriptors[253] = {0}; - uint8_t descriptors_count = 0; - + auto asTuple() const + { + return std::make_tuple(descriptors,descriptors_count); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(descriptors),std::ref(descriptors_count)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const GetDeviceDescriptors& self); -void extract(Serializer& serializer, GetDeviceDescriptors& self); - -void insert(Serializer& serializer, const GetDeviceDescriptors::Response& self); -void extract(Serializer& serializer, GetDeviceDescriptors::Response& self); - TypedResult getDeviceDescriptors(C::mip_interface& device, uint16_t* descriptorsOut, size_t descriptorsOutMax, uint8_t* descriptorsOutCount); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_base_built_in_test (0x01,0x05) Built In Test [CPP] +///@defgroup base_built_in_test_cpp (0x01,0x05) Built In Test /// Run the device Built-In Test (BIT). /// /// The Built-In Test command always returns a 32 bit value. @@ -395,57 +406,63 @@ TypedResult getDeviceDescriptors(C::mip_interface& device, struct BuiltInTest { - + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_base::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_base::CMD_BUILT_IN_TEST; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "BuiltInTest"; static constexpr const char* DOC_NAME = "Built in test"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(); } - auto as_tuple() + auto asTuple() { return std::make_tuple(); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint32_t result = 0; + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_base::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_base::REPLY_BUILT_IN_TEST; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "BuiltInTest::Response"; static constexpr const char* DOC_NAME = "Built in test Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - uint32_t result = 0; - + auto asTuple() const + { + return std::make_tuple(result); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(result)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const BuiltInTest& self); -void extract(Serializer& serializer, BuiltInTest& self); - -void insert(Serializer& serializer, const BuiltInTest::Response& self); -void extract(Serializer& serializer, BuiltInTest::Response& self); - TypedResult builtInTest(C::mip_interface& device, uint32_t* resultOut); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_base_resume (0x01,0x06) Resume [CPP] +///@defgroup base_resume_cpp (0x01,0x06) Resume /// Take the device out of idle mode. /// /// The device responds with ACK upon success. @@ -454,36 +471,36 @@ TypedResult builtInTest(C::mip_interface& device, uint32_t* resultO struct Resume { - + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_base::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_base::CMD_RESUME; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "Resume"; static constexpr const char* DOC_NAME = "Resume"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(); } - auto as_tuple() + auto asTuple() { return std::make_tuple(); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + typedef void Response; }; -void insert(Serializer& serializer, const Resume& self); -void extract(Serializer& serializer, Resume& self); - TypedResult resume(C::mip_interface& device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_base_get_extended_descriptors (0x01,0x07) Get Extended Descriptors [CPP] +///@defgroup base_get_extended_descriptors_cpp (0x01,0x07) Get Extended Descriptors /// Get the command and data descriptors supported by the device. /// /// Reply has two fields: "ACK/NACK" and "Descriptors". The "Descriptors" field is an array of 16 bit values. @@ -493,58 +510,64 @@ TypedResult resume(C::mip_interface& device); struct GetExtendedDescriptors { - + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_base::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_base::CMD_GET_EXTENDED_DESCRIPTORS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GetExtendedDescriptors"; static constexpr const char* DOC_NAME = "Get device descriptors (extended)"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(); } - auto as_tuple() + auto asTuple() { return std::make_tuple(); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint16_t descriptors[253] = {0}; + uint8_t descriptors_count = 0; + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_base::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_base::REPLY_GET_EXTENDED_DESCRIPTORS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GetExtendedDescriptors::Response"; static constexpr const char* DOC_NAME = "Get device descriptors (extended) Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000001; - uint16_t descriptors[253] = {0}; - uint8_t descriptors_count = 0; - + auto asTuple() const + { + return std::make_tuple(descriptors,descriptors_count); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(descriptors),std::ref(descriptors_count)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const GetExtendedDescriptors& self); -void extract(Serializer& serializer, GetExtendedDescriptors& self); - -void insert(Serializer& serializer, const GetExtendedDescriptors::Response& self); -void extract(Serializer& serializer, GetExtendedDescriptors::Response& self); - TypedResult getExtendedDescriptors(C::mip_interface& device, uint16_t* descriptorsOut, size_t descriptorsOutMax, uint8_t* descriptorsOutCount); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_base_continuous_bit (0x01,0x08) Continuous Bit [CPP] +///@defgroup base_continuous_bit_cpp (0x01,0x08) Continuous Bit /// Report result of continuous built-in test. /// /// This test is non-disruptive but is not as thorough as the commanded BIT. @@ -553,57 +576,63 @@ TypedResult getExtendedDescriptors(C::mip_interface& dev struct ContinuousBit { - + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_base::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_base::CMD_CONTINUOUS_BIT; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ContinuousBit"; static constexpr const char* DOC_NAME = "Continuous built-in test"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(); } - auto as_tuple() + auto asTuple() { return std::make_tuple(); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint8_t result[16] = {0}; ///< Device-specific bitfield (128 bits). See device user manual. Bits are least-significant-byte first. For example, bit 0 is located at bit 0 of result[0], bit 1 is located at bit 1 of result[0], bit 8 is located at bit 0 of result[1], and bit 127 is located at bit 7 of result[15]. + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_base::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_base::REPLY_CONTINUOUS_BIT; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ContinuousBit::Response"; static constexpr const char* DOC_NAME = "Continuous built-in test Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - uint8_t result[16] = {0}; ///< Device-specific bitfield (128 bits). See device user manual. Bits are least-significant-byte first. For example, bit 0 is located at bit 0 of result[0], bit 1 is located at bit 1 of result[0], bit 8 is located at bit 0 of result[1], and bit 127 is located at bit 7 of result[15]. - + auto asTuple() const + { + return std::make_tuple(result); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(result)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const ContinuousBit& self); -void extract(Serializer& serializer, ContinuousBit& self); - -void insert(Serializer& serializer, const ContinuousBit::Response& self); -void extract(Serializer& serializer, ContinuousBit::Response& self); - TypedResult continuousBit(C::mip_interface& device, uint8_t* resultOut); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_base_comm_speed (0x01,0x09) Comm Speed [CPP] +///@defgroup base_comm_speed_cpp (0x01,0x09) Comm Speed /// Controls the baud rate of a specific port on the device. /// /// Please see the device user manual for supported baud rates on each port. @@ -624,31 +653,25 @@ TypedResult continuousBit(C::mip_interface& device, uint8_t* resu struct CommSpeed { static constexpr const uint32_t ALL_PORTS = 0; + /// Parameters FunctionSelector function = static_cast(0); uint8_t port = 0; ///< Port ID number, starting with 1. When function is SAVE, LOAD, or DEFAULT, this can be 0 to apply to all ports. See the device user manual for details. uint32_t baud = 0; ///< Port baud rate. Must be a supported rate. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_base::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_base::CMD_COMM_SPEED; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "CommSpeed"; static constexpr const char* DOC_NAME = "Comm Port Speed"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8003; - static constexpr const uint32_t READ_PARAMS = 0x8001; - static constexpr const uint32_t SAVE_PARAMS = 0x8001; - static constexpr const uint32_t LOAD_PARAMS = 0x8001; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8001; - static constexpr const uint32_t ECHOED_PARAMS = 0x0001; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(port,baud); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(port),std::ref(baud)); } @@ -661,32 +684,40 @@ struct CommSpeed return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint8_t port = 0; ///< Port ID number, starting with 1. When function is SAVE, LOAD, or DEFAULT, this can be 0 to apply to all ports. See the device user manual for details. + uint32_t baud = 0; ///< Port baud rate. Must be a supported rate. + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_base::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_base::REPLY_COMM_SPEED; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "CommSpeed::Response"; static constexpr const char* DOC_NAME = "Comm Port Speed Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0001; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - uint8_t port = 0; ///< Port ID number, starting with 1. When function is SAVE, LOAD, or DEFAULT, this can be 0 to apply to all ports. See the device user manual for details. - uint32_t baud = 0; ///< Port baud rate. Must be a supported rate. - + auto asTuple() const + { + return std::make_tuple(port,baud); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(port),std::ref(baud)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const CommSpeed& self); -void extract(Serializer& serializer, CommSpeed& self); - -void insert(Serializer& serializer, const CommSpeed::Response& self); -void extract(Serializer& serializer, CommSpeed::Response& self); - TypedResult writeCommSpeed(C::mip_interface& device, uint8_t port, uint32_t baud); TypedResult readCommSpeed(C::mip_interface& device, uint8_t port, uint32_t* baudOut); TypedResult saveCommSpeed(C::mip_interface& device, uint8_t port); @@ -696,7 +727,7 @@ TypedResult defaultCommSpeed(C::mip_interface& device, uint8_t port); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_base_gps_time_update (0x01,0x72) Gps Time Update [CPP] +///@defgroup base_gps_time_update_cpp (0x01,0x72) Gps Time Update /// Set device internal GPS time /// When combined with a PPS input signal applied to the I/O connector, this command enables complete synchronization of data outputs /// with an external time base, such as GPS system time. Since the hardware PPS synchronization can only detect the fractional number of seconds when pulses arrive, @@ -712,30 +743,25 @@ struct GpsTimeUpdate TIME_OF_WEEK = 2, ///< Time of week in seconds. }; + /// Parameters FunctionSelector function = static_cast(0); FieldId field_id = static_cast(0); ///< Determines how to interpret value. uint32_t value = 0; ///< Week number or time of week, depending on the field_id. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_base::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_base::CMD_GPS_TIME_UPDATE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GpsTimeUpdate"; static constexpr const char* DOC_NAME = "GPS Time Update Command"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8003; - static constexpr const uint32_t READ_PARAMS = 0x0000; - static constexpr const uint32_t SAVE_PARAMS = 0x0000; - static constexpr const uint32_t LOAD_PARAMS = 0x0000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(field_id,value); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(field_id),std::ref(value)); } @@ -747,17 +773,18 @@ struct GpsTimeUpdate return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + typedef void Response; }; -void insert(Serializer& serializer, const GpsTimeUpdate& self); -void extract(Serializer& serializer, GpsTimeUpdate& self); - TypedResult writeGpsTimeUpdate(C::mip_interface& device, GpsTimeUpdate::FieldId fieldId, uint32_t value); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_base_soft_reset (0x01,0x7E) Soft Reset [CPP] +///@defgroup base_soft_reset_cpp (0x01,0x7E) Soft Reset /// Resets the device. /// /// Device responds with ACK and immediately resets. @@ -766,30 +793,30 @@ TypedResult writeGpsTimeUpdate(C::mip_interface& device, GpsTimeU struct SoftReset { - + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_base::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_base::CMD_SOFT_RESET; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "SoftReset"; static constexpr const char* DOC_NAME = "Reset device"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(); } - auto as_tuple() + auto asTuple() { return std::make_tuple(); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + typedef void Response; }; -void insert(Serializer& serializer, const SoftReset& self); -void extract(Serializer& serializer, SoftReset& self); - TypedResult softReset(C::mip_interface& device); ///@} diff --git a/src/mip/definitions/commands_filter.cpp b/src/cpp/mip/definitions/commands_filter.cpp similarity index 53% rename from src/mip/definitions/commands_filter.cpp rename to src/cpp/mip/definitions/commands_filter.cpp index 7792142bf..e4a477435 100644 --- a/src/mip/definitions/commands_filter.cpp +++ b/src/cpp/mip/definitions/commands_filter.cpp @@ -1,65 +1,54 @@ #include "commands_filter.hpp" -#include "../utils/serialization.h" -#include "../mip_interface.h" +#include +#include #include namespace mip { -class Serializer; - namespace C { struct mip_interface; } // namespace C namespace commands_filter { -using ::mip::insert; -using ::mip::extract; using namespace ::mip::C; -//////////////////////////////////////////////////////////////////////////////// -// Shared Type Definitions -//////////////////////////////////////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////////////////////// // Mip Fields //////////////////////////////////////////////////////////////////////////////// -void insert(Serializer& serializer, const Reset& self) +void Reset::insert(Serializer& serializer) const { (void)serializer; - (void)self; } -void extract(Serializer& serializer, Reset& self) +void Reset::extract(Serializer& serializer) { (void)serializer; - (void)self; } TypedResult reset(C::mip_interface& device) { return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_RESET_FILTER, NULL, 0); } -void insert(Serializer& serializer, const SetInitialAttitude& self) +void SetInitialAttitude::insert(Serializer& serializer) const { - insert(serializer, self.roll); + serializer.insert(roll); - insert(serializer, self.pitch); + serializer.insert(pitch); - insert(serializer, self.heading); + serializer.insert(heading); } -void extract(Serializer& serializer, SetInitialAttitude& self) +void SetInitialAttitude::extract(Serializer& serializer) { - extract(serializer, self.roll); + serializer.extract(roll); - extract(serializer, self.pitch); + serializer.extract(pitch); - extract(serializer, self.heading); + serializer.extract(heading); } @@ -68,45 +57,45 @@ TypedResult setInitialAttitude(C::mip_interface& device, flo uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, roll); + serializer.insert(roll); - insert(serializer, pitch); + serializer.insert(pitch); - insert(serializer, heading); + serializer.insert(heading); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SET_INITIAL_ATTITUDE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SET_INITIAL_ATTITUDE, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const EstimationControl& self) +void EstimationControl::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.enable); + serializer.insert(enable); } } -void extract(Serializer& serializer, EstimationControl& self) +void EstimationControl::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.enable); + serializer.extract(enable); } } -void insert(Serializer& serializer, const EstimationControl::Response& self) +void EstimationControl::Response::insert(Serializer& serializer) const { - insert(serializer, self.enable); + serializer.insert(enable); } -void extract(Serializer& serializer, EstimationControl::Response& self) +void EstimationControl::Response::extract(Serializer& serializer) { - extract(serializer, self.enable); + serializer.extract(enable); } @@ -115,30 +104,30 @@ TypedResult writeEstimationControl(C::mip_interface& device, uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, enable); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(enable); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ESTIMATION_CONTROL_FLAGS, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ESTIMATION_CONTROL_FLAGS, buffer, (uint8_t)serializer.usedLength()); } TypedResult readEstimationControl(C::mip_interface& device, EstimationControl::EnableFlags* enableOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_ESTIMATION_CONTROL_FLAGS, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_ESTIMATION_CONTROL_FLAGS, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_ESTIMATION_CONTROL_FLAGS, buffer, (uint8_t)serializer.usedLength(), REPLY_ESTIMATION_CONTROL_FLAGS, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(enableOut); - extract(deserializer, *enableOut); + deserializer.extract(*enableOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -150,73 +139,67 @@ TypedResult saveEstimationControl(C::mip_interface& device) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ESTIMATION_CONTROL_FLAGS, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ESTIMATION_CONTROL_FLAGS, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadEstimationControl(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ESTIMATION_CONTROL_FLAGS, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ESTIMATION_CONTROL_FLAGS, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultEstimationControl(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ESTIMATION_CONTROL_FLAGS, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ESTIMATION_CONTROL_FLAGS, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const ExternalGnssUpdate& self) +void ExternalGnssUpdate::insert(Serializer& serializer) const { - insert(serializer, self.gps_time); + serializer.insert(gps_time); - insert(serializer, self.gps_week); + serializer.insert(gps_week); - insert(serializer, self.latitude); + serializer.insert(latitude); - insert(serializer, self.longitude); + serializer.insert(longitude); - insert(serializer, self.height); + serializer.insert(height); - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.velocity[i]); + serializer.insert(velocity); - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.pos_uncertainty[i]); + serializer.insert(pos_uncertainty); - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.vel_uncertainty[i]); + serializer.insert(vel_uncertainty); } -void extract(Serializer& serializer, ExternalGnssUpdate& self) +void ExternalGnssUpdate::extract(Serializer& serializer) { - extract(serializer, self.gps_time); + serializer.extract(gps_time); - extract(serializer, self.gps_week); + serializer.extract(gps_week); - extract(serializer, self.latitude); + serializer.extract(latitude); - extract(serializer, self.longitude); + serializer.extract(longitude); - extract(serializer, self.height); + serializer.extract(height); - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.velocity[i]); + serializer.extract(velocity); - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.pos_uncertainty[i]); + serializer.extract(pos_uncertainty); - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.vel_uncertainty[i]); + serializer.extract(vel_uncertainty); } @@ -225,48 +208,48 @@ TypedResult externalGnssUpdate(C::mip_interface& device, dou uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, gpsTime); + serializer.insert(gpsTime); - insert(serializer, gpsWeek); + serializer.insert(gpsWeek); - insert(serializer, latitude); + serializer.insert(latitude); - insert(serializer, longitude); + serializer.insert(longitude); - insert(serializer, height); + serializer.insert(height); - assert(velocity || (3 == 0)); + assert(velocity); for(unsigned int i=0; i < 3; i++) - insert(serializer, velocity[i]); + serializer.insert(velocity[i]); - assert(posUncertainty || (3 == 0)); + assert(posUncertainty); for(unsigned int i=0; i < 3; i++) - insert(serializer, posUncertainty[i]); + serializer.insert(posUncertainty[i]); - assert(velUncertainty || (3 == 0)); + assert(velUncertainty); for(unsigned int i=0; i < 3; i++) - insert(serializer, velUncertainty[i]); + serializer.insert(velUncertainty[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_EXTERNAL_GNSS_UPDATE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_EXTERNAL_GNSS_UPDATE, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const ExternalHeadingUpdate& self) +void ExternalHeadingUpdate::insert(Serializer& serializer) const { - insert(serializer, self.heading); + serializer.insert(heading); - insert(serializer, self.heading_uncertainty); + serializer.insert(heading_uncertainty); - insert(serializer, self.type); + serializer.insert(type); } -void extract(Serializer& serializer, ExternalHeadingUpdate& self) +void ExternalHeadingUpdate::extract(Serializer& serializer) { - extract(serializer, self.heading); + serializer.extract(heading); - extract(serializer, self.heading_uncertainty); + serializer.extract(heading_uncertainty); - extract(serializer, self.type); + serializer.extract(type); } @@ -275,40 +258,40 @@ TypedResult externalHeadingUpdate(C::mip_interface& devic uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, heading); + serializer.insert(heading); - insert(serializer, headingUncertainty); + serializer.insert(headingUncertainty); - insert(serializer, type); + serializer.insert(type); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_EXTERNAL_HEADING_UPDATE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_EXTERNAL_HEADING_UPDATE, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const ExternalHeadingUpdateWithTime& self) +void ExternalHeadingUpdateWithTime::insert(Serializer& serializer) const { - insert(serializer, self.gps_time); + serializer.insert(gps_time); - insert(serializer, self.gps_week); + serializer.insert(gps_week); - insert(serializer, self.heading); + serializer.insert(heading); - insert(serializer, self.heading_uncertainty); + serializer.insert(heading_uncertainty); - insert(serializer, self.type); + serializer.insert(type); } -void extract(Serializer& serializer, ExternalHeadingUpdateWithTime& self) +void ExternalHeadingUpdateWithTime::extract(Serializer& serializer) { - extract(serializer, self.gps_time); + serializer.extract(gps_time); - extract(serializer, self.gps_week); + serializer.extract(gps_week); - extract(serializer, self.heading); + serializer.extract(heading); - extract(serializer, self.heading_uncertainty); + serializer.extract(heading_uncertainty); - extract(serializer, self.type); + serializer.extract(type); } @@ -317,49 +300,49 @@ TypedResult externalHeadingUpdateWithTime(C::mip_ uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, gpsTime); + serializer.insert(gpsTime); - insert(serializer, gpsWeek); + serializer.insert(gpsWeek); - insert(serializer, heading); + serializer.insert(heading); - insert(serializer, headingUncertainty); + serializer.insert(headingUncertainty); - insert(serializer, type); + serializer.insert(type); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_EXTERNAL_HEADING_UPDATE_WITH_TIME, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_EXTERNAL_HEADING_UPDATE_WITH_TIME, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const TareOrientation& self) +void TareOrientation::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.axes); + serializer.insert(axes); } } -void extract(Serializer& serializer, TareOrientation& self) +void TareOrientation::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.axes); + serializer.extract(axes); } } -void insert(Serializer& serializer, const TareOrientation::Response& self) +void TareOrientation::Response::insert(Serializer& serializer) const { - insert(serializer, self.axes); + serializer.insert(axes); } -void extract(Serializer& serializer, TareOrientation::Response& self) +void TareOrientation::Response::extract(Serializer& serializer) { - extract(serializer, self.axes); + serializer.extract(axes); } @@ -368,30 +351,30 @@ TypedResult writeTareOrientation(C::mip_interface& device, Tare uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, axes); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(axes); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_TARE_ORIENTATION, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_TARE_ORIENTATION, buffer, (uint8_t)serializer.usedLength()); } TypedResult readTareOrientation(C::mip_interface& device, TareOrientation::MipTareAxes* axesOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_TARE_ORIENTATION, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_TARE_ORIENTATION, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_TARE_ORIENTATION, buffer, (uint8_t)serializer.usedLength(), REPLY_TARE_ORIENTATION, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(axesOut); - extract(deserializer, *axesOut); + deserializer.extract(*axesOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -403,60 +386,60 @@ TypedResult saveTareOrientation(C::mip_interface& device) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_TARE_ORIENTATION, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_TARE_ORIENTATION, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadTareOrientation(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_TARE_ORIENTATION, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_TARE_ORIENTATION, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultTareOrientation(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_TARE_ORIENTATION, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_TARE_ORIENTATION, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const VehicleDynamicsMode& self) +void VehicleDynamicsMode::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.mode); + serializer.insert(mode); } } -void extract(Serializer& serializer, VehicleDynamicsMode& self) +void VehicleDynamicsMode::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.mode); + serializer.extract(mode); } } -void insert(Serializer& serializer, const VehicleDynamicsMode::Response& self) +void VehicleDynamicsMode::Response::insert(Serializer& serializer) const { - insert(serializer, self.mode); + serializer.insert(mode); } -void extract(Serializer& serializer, VehicleDynamicsMode::Response& self) +void VehicleDynamicsMode::Response::extract(Serializer& serializer) { - extract(serializer, self.mode); + serializer.extract(mode); } @@ -465,30 +448,30 @@ TypedResult writeVehicleDynamicsMode(C::mip_interface& devi uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, mode); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(mode); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_VEHICLE_DYNAMICS_MODE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_VEHICLE_DYNAMICS_MODE, buffer, (uint8_t)serializer.usedLength()); } TypedResult readVehicleDynamicsMode(C::mip_interface& device, VehicleDynamicsMode::DynamicsMode* modeOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_VEHICLE_DYNAMICS_MODE, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_VEHICLE_DYNAMICS_MODE, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_VEHICLE_DYNAMICS_MODE, buffer, (uint8_t)serializer.usedLength(), REPLY_VEHICLE_DYNAMICS_MODE, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(modeOut); - extract(deserializer, *modeOut); + deserializer.extract(*modeOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -500,76 +483,76 @@ TypedResult saveVehicleDynamicsMode(C::mip_interface& devic uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_VEHICLE_DYNAMICS_MODE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_VEHICLE_DYNAMICS_MODE, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadVehicleDynamicsMode(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_VEHICLE_DYNAMICS_MODE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_VEHICLE_DYNAMICS_MODE, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultVehicleDynamicsMode(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_VEHICLE_DYNAMICS_MODE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_VEHICLE_DYNAMICS_MODE, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const SensorToVehicleRotationEuler& self) +void SensorToVehicleRotationEuler::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.roll); + serializer.insert(roll); - insert(serializer, self.pitch); + serializer.insert(pitch); - insert(serializer, self.yaw); + serializer.insert(yaw); } } -void extract(Serializer& serializer, SensorToVehicleRotationEuler& self) +void SensorToVehicleRotationEuler::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.roll); + serializer.extract(roll); - extract(serializer, self.pitch); + serializer.extract(pitch); - extract(serializer, self.yaw); + serializer.extract(yaw); } } -void insert(Serializer& serializer, const SensorToVehicleRotationEuler::Response& self) +void SensorToVehicleRotationEuler::Response::insert(Serializer& serializer) const { - insert(serializer, self.roll); + serializer.insert(roll); - insert(serializer, self.pitch); + serializer.insert(pitch); - insert(serializer, self.yaw); + serializer.insert(yaw); } -void extract(Serializer& serializer, SensorToVehicleRotationEuler::Response& self) +void SensorToVehicleRotationEuler::Response::extract(Serializer& serializer) { - extract(serializer, self.roll); + serializer.extract(roll); - extract(serializer, self.pitch); + serializer.extract(pitch); - extract(serializer, self.yaw); + serializer.extract(yaw); } @@ -578,40 +561,40 @@ TypedResult writeSensorToVehicleRotationEuler(C::m uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, roll); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(roll); - insert(serializer, pitch); + serializer.insert(pitch); - insert(serializer, yaw); + serializer.insert(yaw); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_ROTATION_EULER, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_ROTATION_EULER, buffer, (uint8_t)serializer.usedLength()); } TypedResult readSensorToVehicleRotationEuler(C::mip_interface& device, float* rollOut, float* pitchOut, float* yawOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_ROTATION_EULER, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_SENSOR2VEHICLE_ROTATION_EULER, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_ROTATION_EULER, buffer, (uint8_t)serializer.usedLength(), REPLY_SENSOR2VEHICLE_ROTATION_EULER, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(rollOut); - extract(deserializer, *rollOut); + deserializer.extract(*rollOut); assert(pitchOut); - extract(deserializer, *pitchOut); + deserializer.extract(*pitchOut); assert(yawOut); - extract(deserializer, *yawOut); + deserializer.extract(*yawOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -623,64 +606,60 @@ TypedResult saveSensorToVehicleRotationEuler(C::mi uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_ROTATION_EULER, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_ROTATION_EULER, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadSensorToVehicleRotationEuler(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_ROTATION_EULER, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_ROTATION_EULER, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultSensorToVehicleRotationEuler(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_ROTATION_EULER, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_ROTATION_EULER, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const SensorToVehicleRotationDcm& self) +void SensorToVehicleRotationDcm::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 9; i++) - insert(serializer, self.dcm[i]); + serializer.insert(dcm); } } -void extract(Serializer& serializer, SensorToVehicleRotationDcm& self) +void SensorToVehicleRotationDcm::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 9; i++) - extract(serializer, self.dcm[i]); + serializer.extract(dcm); } } -void insert(Serializer& serializer, const SensorToVehicleRotationDcm::Response& self) +void SensorToVehicleRotationDcm::Response::insert(Serializer& serializer) const { - for(unsigned int i=0; i < 9; i++) - insert(serializer, self.dcm[i]); + serializer.insert(dcm); } -void extract(Serializer& serializer, SensorToVehicleRotationDcm::Response& self) +void SensorToVehicleRotationDcm::Response::extract(Serializer& serializer) { - for(unsigned int i=0; i < 9; i++) - extract(serializer, self.dcm[i]); + serializer.extract(dcm); } @@ -689,33 +668,33 @@ TypedResult writeSensorToVehicleRotationDcm(C::mip_i uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - assert(dcm || (9 == 0)); + serializer.insert(FunctionSelector::WRITE); + assert(dcm); for(unsigned int i=0; i < 9; i++) - insert(serializer, dcm[i]); + serializer.insert(dcm[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_ROTATION_DCM, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_ROTATION_DCM, buffer, (uint8_t)serializer.usedLength()); } TypedResult readSensorToVehicleRotationDcm(C::mip_interface& device, float* dcmOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_ROTATION_DCM, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_SENSOR2VEHICLE_ROTATION_DCM, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_ROTATION_DCM, buffer, (uint8_t)serializer.usedLength(), REPLY_SENSOR2VEHICLE_ROTATION_DCM, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - assert(dcmOut || (9 == 0)); + assert(dcmOut); for(unsigned int i=0; i < 9; i++) - extract(deserializer, dcmOut[i]); + deserializer.extract(dcmOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -727,64 +706,60 @@ TypedResult saveSensorToVehicleRotationDcm(C::mip_in uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_ROTATION_DCM, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_ROTATION_DCM, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadSensorToVehicleRotationDcm(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_ROTATION_DCM, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_ROTATION_DCM, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultSensorToVehicleRotationDcm(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_ROTATION_DCM, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_ROTATION_DCM, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const SensorToVehicleRotationQuaternion& self) +void SensorToVehicleRotationQuaternion::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 4; i++) - insert(serializer, self.quat[i]); + serializer.insert(quat); } } -void extract(Serializer& serializer, SensorToVehicleRotationQuaternion& self) +void SensorToVehicleRotationQuaternion::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 4; i++) - extract(serializer, self.quat[i]); + serializer.extract(quat); } } -void insert(Serializer& serializer, const SensorToVehicleRotationQuaternion::Response& self) +void SensorToVehicleRotationQuaternion::Response::insert(Serializer& serializer) const { - for(unsigned int i=0; i < 4; i++) - insert(serializer, self.quat[i]); + serializer.insert(quat); } -void extract(Serializer& serializer, SensorToVehicleRotationQuaternion::Response& self) +void SensorToVehicleRotationQuaternion::Response::extract(Serializer& serializer) { - for(unsigned int i=0; i < 4; i++) - extract(serializer, self.quat[i]); + serializer.extract(quat); } @@ -793,33 +768,33 @@ TypedResult writeSensorToVehicleRotationQuate uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - assert(quat || (4 == 0)); + serializer.insert(FunctionSelector::WRITE); + assert(quat); for(unsigned int i=0; i < 4; i++) - insert(serializer, quat[i]); + serializer.insert(quat[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_ROTATION_QUATERNION, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_ROTATION_QUATERNION, buffer, (uint8_t)serializer.usedLength()); } TypedResult readSensorToVehicleRotationQuaternion(C::mip_interface& device, float* quatOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_ROTATION_QUATERNION, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_SENSOR2VEHICLE_ROTATION_QUATERNION, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_ROTATION_QUATERNION, buffer, (uint8_t)serializer.usedLength(), REPLY_SENSOR2VEHICLE_ROTATION_QUATERNION, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - assert(quatOut || (4 == 0)); + assert(quatOut); for(unsigned int i=0; i < 4; i++) - extract(deserializer, quatOut[i]); + deserializer.extract(quatOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -831,64 +806,60 @@ TypedResult saveSensorToVehicleRotationQuater uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_ROTATION_QUATERNION, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_ROTATION_QUATERNION, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadSensorToVehicleRotationQuaternion(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_ROTATION_QUATERNION, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_ROTATION_QUATERNION, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultSensorToVehicleRotationQuaternion(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_ROTATION_QUATERNION, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_ROTATION_QUATERNION, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const SensorToVehicleOffset& self) +void SensorToVehicleOffset::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.offset[i]); + serializer.insert(offset); } } -void extract(Serializer& serializer, SensorToVehicleOffset& self) +void SensorToVehicleOffset::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.offset[i]); + serializer.extract(offset); } } -void insert(Serializer& serializer, const SensorToVehicleOffset::Response& self) +void SensorToVehicleOffset::Response::insert(Serializer& serializer) const { - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.offset[i]); + serializer.insert(offset); } -void extract(Serializer& serializer, SensorToVehicleOffset::Response& self) +void SensorToVehicleOffset::Response::extract(Serializer& serializer) { - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.offset[i]); + serializer.extract(offset); } @@ -897,33 +868,33 @@ TypedResult writeSensorToVehicleOffset(C::mip_interface& uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - assert(offset || (3 == 0)); + serializer.insert(FunctionSelector::WRITE); + assert(offset); for(unsigned int i=0; i < 3; i++) - insert(serializer, offset[i]); + serializer.insert(offset[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_OFFSET, buffer, (uint8_t)serializer.usedLength()); } TypedResult readSensorToVehicleOffset(C::mip_interface& device, float* offsetOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_SENSOR2VEHICLE_OFFSET, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_OFFSET, buffer, (uint8_t)serializer.usedLength(), REPLY_SENSOR2VEHICLE_OFFSET, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - assert(offsetOut || (3 == 0)); + assert(offsetOut); for(unsigned int i=0; i < 3; i++) - extract(deserializer, offsetOut[i]); + deserializer.extract(offsetOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -935,64 +906,60 @@ TypedResult saveSensorToVehicleOffset(C::mip_interface& d uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_OFFSET, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadSensorToVehicleOffset(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_OFFSET, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultSensorToVehicleOffset(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SENSOR2VEHICLE_OFFSET, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const AntennaOffset& self) +void AntennaOffset::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.offset[i]); + serializer.insert(offset); } } -void extract(Serializer& serializer, AntennaOffset& self) +void AntennaOffset::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.offset[i]); + serializer.extract(offset); } } -void insert(Serializer& serializer, const AntennaOffset::Response& self) +void AntennaOffset::Response::insert(Serializer& serializer) const { - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.offset[i]); + serializer.insert(offset); } -void extract(Serializer& serializer, AntennaOffset::Response& self) +void AntennaOffset::Response::extract(Serializer& serializer) { - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.offset[i]); + serializer.extract(offset); } @@ -1001,33 +968,33 @@ TypedResult writeAntennaOffset(C::mip_interface& device, const fl uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - assert(offset || (3 == 0)); + serializer.insert(FunctionSelector::WRITE); + assert(offset); for(unsigned int i=0; i < 3; i++) - insert(serializer, offset[i]); + serializer.insert(offset[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ANTENNA_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ANTENNA_OFFSET, buffer, (uint8_t)serializer.usedLength()); } TypedResult readAntennaOffset(C::mip_interface& device, float* offsetOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_ANTENNA_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_ANTENNA_OFFSET, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_ANTENNA_OFFSET, buffer, (uint8_t)serializer.usedLength(), REPLY_ANTENNA_OFFSET, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - assert(offsetOut || (3 == 0)); + assert(offsetOut); for(unsigned int i=0; i < 3; i++) - extract(deserializer, offsetOut[i]); + deserializer.extract(offsetOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -1039,60 +1006,60 @@ TypedResult saveAntennaOffset(C::mip_interface& device) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ANTENNA_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ANTENNA_OFFSET, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadAntennaOffset(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ANTENNA_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ANTENNA_OFFSET, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultAntennaOffset(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ANTENNA_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ANTENNA_OFFSET, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const GnssSource& self) +void GnssSource::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.source); + serializer.insert(source); } } -void extract(Serializer& serializer, GnssSource& self) +void GnssSource::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.source); + serializer.extract(source); } } -void insert(Serializer& serializer, const GnssSource::Response& self) +void GnssSource::Response::insert(Serializer& serializer) const { - insert(serializer, self.source); + serializer.insert(source); } -void extract(Serializer& serializer, GnssSource::Response& self) +void GnssSource::Response::extract(Serializer& serializer) { - extract(serializer, self.source); + serializer.extract(source); } @@ -1101,30 +1068,30 @@ TypedResult writeGnssSource(C::mip_interface& device, GnssSource::So uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, source); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(source); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_SOURCE_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_SOURCE_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult readGnssSource(C::mip_interface& device, GnssSource::Source* sourceOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_GNSS_SOURCE_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_GNSS_SOURCE_CONTROL, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_GNSS_SOURCE_CONTROL, buffer, (uint8_t)serializer.usedLength(), REPLY_GNSS_SOURCE_CONTROL, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(sourceOut); - extract(deserializer, *sourceOut); + deserializer.extract(*sourceOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -1136,60 +1103,60 @@ TypedResult saveGnssSource(C::mip_interface& device) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_SOURCE_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_SOURCE_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadGnssSource(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_SOURCE_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_SOURCE_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultGnssSource(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_SOURCE_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GNSS_SOURCE_CONTROL, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const HeadingSource& self) +void HeadingSource::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.source); + serializer.insert(source); } } -void extract(Serializer& serializer, HeadingSource& self) +void HeadingSource::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.source); + serializer.extract(source); } } -void insert(Serializer& serializer, const HeadingSource::Response& self) +void HeadingSource::Response::insert(Serializer& serializer) const { - insert(serializer, self.source); + serializer.insert(source); } -void extract(Serializer& serializer, HeadingSource::Response& self) +void HeadingSource::Response::extract(Serializer& serializer) { - extract(serializer, self.source); + serializer.extract(source); } @@ -1198,30 +1165,30 @@ TypedResult writeHeadingSource(C::mip_interface& device, HeadingS uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, source); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(source); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_HEADING_UPDATE_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_HEADING_UPDATE_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult readHeadingSource(C::mip_interface& device, HeadingSource::Source* sourceOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_HEADING_UPDATE_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_HEADING_UPDATE_CONTROL, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_HEADING_UPDATE_CONTROL, buffer, (uint8_t)serializer.usedLength(), REPLY_HEADING_UPDATE_CONTROL, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(sourceOut); - extract(deserializer, *sourceOut); + deserializer.extract(*sourceOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -1233,60 +1200,60 @@ TypedResult saveHeadingSource(C::mip_interface& device) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_HEADING_UPDATE_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_HEADING_UPDATE_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadHeadingSource(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_HEADING_UPDATE_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_HEADING_UPDATE_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultHeadingSource(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_HEADING_UPDATE_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_HEADING_UPDATE_CONTROL, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const AutoInitControl& self) +void AutoInitControl::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.enable); + serializer.insert(enable); } } -void extract(Serializer& serializer, AutoInitControl& self) +void AutoInitControl::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.enable); + serializer.extract(enable); } } -void insert(Serializer& serializer, const AutoInitControl::Response& self) +void AutoInitControl::Response::insert(Serializer& serializer) const { - insert(serializer, self.enable); + serializer.insert(enable); } -void extract(Serializer& serializer, AutoInitControl::Response& self) +void AutoInitControl::Response::extract(Serializer& serializer) { - extract(serializer, self.enable); + serializer.extract(enable); } @@ -1295,30 +1262,30 @@ TypedResult writeAutoInitControl(C::mip_interface& device, uint uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, enable); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(enable); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_AUTOINIT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_AUTOINIT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult readAutoInitControl(C::mip_interface& device, uint8_t* enableOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_AUTOINIT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_AUTOINIT_CONTROL, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_AUTOINIT_CONTROL, buffer, (uint8_t)serializer.usedLength(), REPLY_AUTOINIT_CONTROL, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(enableOut); - extract(deserializer, *enableOut); + deserializer.extract(*enableOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -1330,64 +1297,60 @@ TypedResult saveAutoInitControl(C::mip_interface& device) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_AUTOINIT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_AUTOINIT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadAutoInitControl(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_AUTOINIT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_AUTOINIT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultAutoInitControl(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_AUTOINIT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_AUTOINIT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const AccelNoise& self) +void AccelNoise::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.noise[i]); + serializer.insert(noise); } } -void extract(Serializer& serializer, AccelNoise& self) +void AccelNoise::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.noise[i]); + serializer.extract(noise); } } -void insert(Serializer& serializer, const AccelNoise::Response& self) +void AccelNoise::Response::insert(Serializer& serializer) const { - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.noise[i]); + serializer.insert(noise); } -void extract(Serializer& serializer, AccelNoise::Response& self) +void AccelNoise::Response::extract(Serializer& serializer) { - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.noise[i]); + serializer.extract(noise); } @@ -1396,33 +1359,33 @@ TypedResult writeAccelNoise(C::mip_interface& device, const float* n uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - assert(noise || (3 == 0)); + serializer.insert(FunctionSelector::WRITE); + assert(noise); for(unsigned int i=0; i < 3; i++) - insert(serializer, noise[i]); + serializer.insert(noise[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ACCEL_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ACCEL_NOISE, buffer, (uint8_t)serializer.usedLength()); } TypedResult readAccelNoise(C::mip_interface& device, float* noiseOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_ACCEL_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_ACCEL_NOISE, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_ACCEL_NOISE, buffer, (uint8_t)serializer.usedLength(), REPLY_ACCEL_NOISE, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - assert(noiseOut || (3 == 0)); + assert(noiseOut); for(unsigned int i=0; i < 3; i++) - extract(deserializer, noiseOut[i]); + deserializer.extract(noiseOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -1434,64 +1397,60 @@ TypedResult saveAccelNoise(C::mip_interface& device) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ACCEL_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ACCEL_NOISE, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadAccelNoise(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ACCEL_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ACCEL_NOISE, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultAccelNoise(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ACCEL_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ACCEL_NOISE, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const GyroNoise& self) +void GyroNoise::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.noise[i]); + serializer.insert(noise); } } -void extract(Serializer& serializer, GyroNoise& self) +void GyroNoise::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.noise[i]); + serializer.extract(noise); } } -void insert(Serializer& serializer, const GyroNoise::Response& self) +void GyroNoise::Response::insert(Serializer& serializer) const { - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.noise[i]); + serializer.insert(noise); } -void extract(Serializer& serializer, GyroNoise::Response& self) +void GyroNoise::Response::extract(Serializer& serializer) { - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.noise[i]); + serializer.extract(noise); } @@ -1500,33 +1459,33 @@ TypedResult writeGyroNoise(C::mip_interface& device, const float* noi uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - assert(noise || (3 == 0)); + serializer.insert(FunctionSelector::WRITE); + assert(noise); for(unsigned int i=0; i < 3; i++) - insert(serializer, noise[i]); + serializer.insert(noise[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GYRO_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GYRO_NOISE, buffer, (uint8_t)serializer.usedLength()); } TypedResult readGyroNoise(C::mip_interface& device, float* noiseOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_GYRO_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_GYRO_NOISE, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_GYRO_NOISE, buffer, (uint8_t)serializer.usedLength(), REPLY_GYRO_NOISE, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - assert(noiseOut || (3 == 0)); + assert(noiseOut); for(unsigned int i=0; i < 3; i++) - extract(deserializer, noiseOut[i]); + deserializer.extract(noiseOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -1538,76 +1497,68 @@ TypedResult saveGyroNoise(C::mip_interface& device) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GYRO_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GYRO_NOISE, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadGyroNoise(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GYRO_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GYRO_NOISE, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultGyroNoise(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GYRO_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GYRO_NOISE, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const AccelBiasModel& self) +void AccelBiasModel::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.beta[i]); + serializer.insert(beta); - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.noise[i]); + serializer.insert(noise); } } -void extract(Serializer& serializer, AccelBiasModel& self) +void AccelBiasModel::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.beta[i]); + serializer.extract(beta); - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.noise[i]); + serializer.extract(noise); } } -void insert(Serializer& serializer, const AccelBiasModel::Response& self) +void AccelBiasModel::Response::insert(Serializer& serializer) const { - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.beta[i]); + serializer.insert(beta); - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.noise[i]); + serializer.insert(noise); } -void extract(Serializer& serializer, AccelBiasModel::Response& self) +void AccelBiasModel::Response::extract(Serializer& serializer) { - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.beta[i]); + serializer.extract(beta); - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.noise[i]); + serializer.extract(noise); } @@ -1616,41 +1567,41 @@ TypedResult writeAccelBiasModel(C::mip_interface& device, const uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - assert(beta || (3 == 0)); + serializer.insert(FunctionSelector::WRITE); + assert(beta); for(unsigned int i=0; i < 3; i++) - insert(serializer, beta[i]); + serializer.insert(beta[i]); - assert(noise || (3 == 0)); + assert(noise); for(unsigned int i=0; i < 3; i++) - insert(serializer, noise[i]); + serializer.insert(noise[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ACCEL_BIAS_MODEL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ACCEL_BIAS_MODEL, buffer, (uint8_t)serializer.usedLength()); } TypedResult readAccelBiasModel(C::mip_interface& device, float* betaOut, float* noiseOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_ACCEL_BIAS_MODEL, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_ACCEL_BIAS_MODEL, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_ACCEL_BIAS_MODEL, buffer, (uint8_t)serializer.usedLength(), REPLY_ACCEL_BIAS_MODEL, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - assert(betaOut || (3 == 0)); + assert(betaOut); for(unsigned int i=0; i < 3; i++) - extract(deserializer, betaOut[i]); + deserializer.extract(betaOut[i]); - assert(noiseOut || (3 == 0)); + assert(noiseOut); for(unsigned int i=0; i < 3; i++) - extract(deserializer, noiseOut[i]); + deserializer.extract(noiseOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -1662,76 +1613,68 @@ TypedResult saveAccelBiasModel(C::mip_interface& device) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ACCEL_BIAS_MODEL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ACCEL_BIAS_MODEL, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadAccelBiasModel(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ACCEL_BIAS_MODEL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ACCEL_BIAS_MODEL, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultAccelBiasModel(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ACCEL_BIAS_MODEL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ACCEL_BIAS_MODEL, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const GyroBiasModel& self) +void GyroBiasModel::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.beta[i]); + serializer.insert(beta); - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.noise[i]); + serializer.insert(noise); } } -void extract(Serializer& serializer, GyroBiasModel& self) +void GyroBiasModel::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.beta[i]); + serializer.extract(beta); - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.noise[i]); + serializer.extract(noise); } } -void insert(Serializer& serializer, const GyroBiasModel::Response& self) +void GyroBiasModel::Response::insert(Serializer& serializer) const { - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.beta[i]); + serializer.insert(beta); - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.noise[i]); + serializer.insert(noise); } -void extract(Serializer& serializer, GyroBiasModel::Response& self) +void GyroBiasModel::Response::extract(Serializer& serializer) { - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.beta[i]); + serializer.extract(beta); - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.noise[i]); + serializer.extract(noise); } @@ -1740,41 +1683,41 @@ TypedResult writeGyroBiasModel(C::mip_interface& device, const fl uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - assert(beta || (3 == 0)); + serializer.insert(FunctionSelector::WRITE); + assert(beta); for(unsigned int i=0; i < 3; i++) - insert(serializer, beta[i]); + serializer.insert(beta[i]); - assert(noise || (3 == 0)); + assert(noise); for(unsigned int i=0; i < 3; i++) - insert(serializer, noise[i]); + serializer.insert(noise[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GYRO_BIAS_MODEL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GYRO_BIAS_MODEL, buffer, (uint8_t)serializer.usedLength()); } TypedResult readGyroBiasModel(C::mip_interface& device, float* betaOut, float* noiseOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_GYRO_BIAS_MODEL, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_GYRO_BIAS_MODEL, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_GYRO_BIAS_MODEL, buffer, (uint8_t)serializer.usedLength(), REPLY_GYRO_BIAS_MODEL, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - assert(betaOut || (3 == 0)); + assert(betaOut); for(unsigned int i=0; i < 3; i++) - extract(deserializer, betaOut[i]); + deserializer.extract(betaOut[i]); - assert(noiseOut || (3 == 0)); + assert(noiseOut); for(unsigned int i=0; i < 3; i++) - extract(deserializer, noiseOut[i]); + deserializer.extract(noiseOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -1786,60 +1729,60 @@ TypedResult saveGyroBiasModel(C::mip_interface& device) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GYRO_BIAS_MODEL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GYRO_BIAS_MODEL, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadGyroBiasModel(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GYRO_BIAS_MODEL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GYRO_BIAS_MODEL, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultGyroBiasModel(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GYRO_BIAS_MODEL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GYRO_BIAS_MODEL, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const AltitudeAiding& self) +void AltitudeAiding::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.selector); + serializer.insert(selector); } } -void extract(Serializer& serializer, AltitudeAiding& self) +void AltitudeAiding::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.selector); + serializer.extract(selector); } } -void insert(Serializer& serializer, const AltitudeAiding::Response& self) +void AltitudeAiding::Response::insert(Serializer& serializer) const { - insert(serializer, self.selector); + serializer.insert(selector); } -void extract(Serializer& serializer, AltitudeAiding::Response& self) +void AltitudeAiding::Response::extract(Serializer& serializer) { - extract(serializer, self.selector); + serializer.extract(selector); } @@ -1848,30 +1791,30 @@ TypedResult writeAltitudeAiding(C::mip_interface& device, Altitu uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, selector); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(selector); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ALTITUDE_AIDING_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ALTITUDE_AIDING_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult readAltitudeAiding(C::mip_interface& device, AltitudeAiding::AidingSelector* selectorOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_ALTITUDE_AIDING_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_ALTITUDE_AIDING_CONTROL, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_ALTITUDE_AIDING_CONTROL, buffer, (uint8_t)serializer.usedLength(), REPLY_ALTITUDE_AIDING_CONTROL, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(selectorOut); - extract(deserializer, *selectorOut); + deserializer.extract(*selectorOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -1883,60 +1826,60 @@ TypedResult saveAltitudeAiding(C::mip_interface& device) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ALTITUDE_AIDING_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ALTITUDE_AIDING_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadAltitudeAiding(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ALTITUDE_AIDING_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ALTITUDE_AIDING_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultAltitudeAiding(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ALTITUDE_AIDING_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ALTITUDE_AIDING_CONTROL, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const PitchRollAiding& self) +void PitchRollAiding::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.source); + serializer.insert(source); } } -void extract(Serializer& serializer, PitchRollAiding& self) +void PitchRollAiding::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.source); + serializer.extract(source); } } -void insert(Serializer& serializer, const PitchRollAiding::Response& self) +void PitchRollAiding::Response::insert(Serializer& serializer) const { - insert(serializer, self.source); + serializer.insert(source); } -void extract(Serializer& serializer, PitchRollAiding::Response& self) +void PitchRollAiding::Response::extract(Serializer& serializer) { - extract(serializer, self.source); + serializer.extract(source); } @@ -1945,30 +1888,30 @@ TypedResult writePitchRollAiding(C::mip_interface& device, Pitc uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, source); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(source); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SECONDARY_PITCH_ROLL_AIDING_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SECONDARY_PITCH_ROLL_AIDING_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult readPitchRollAiding(C::mip_interface& device, PitchRollAiding::AidingSource* sourceOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_SECONDARY_PITCH_ROLL_AIDING_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_SECONDARY_PITCH_ROLL_AIDING_CONTROL, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_SECONDARY_PITCH_ROLL_AIDING_CONTROL, buffer, (uint8_t)serializer.usedLength(), REPLY_SECONDARY_PITCH_ROLL_AIDING_CONTROL, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(sourceOut); - extract(deserializer, *sourceOut); + deserializer.extract(*sourceOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -1980,68 +1923,68 @@ TypedResult savePitchRollAiding(C::mip_interface& device) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SECONDARY_PITCH_ROLL_AIDING_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SECONDARY_PITCH_ROLL_AIDING_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadPitchRollAiding(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SECONDARY_PITCH_ROLL_AIDING_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SECONDARY_PITCH_ROLL_AIDING_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultPitchRollAiding(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SECONDARY_PITCH_ROLL_AIDING_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SECONDARY_PITCH_ROLL_AIDING_CONTROL, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const AutoZupt& self) +void AutoZupt::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.enable); + serializer.insert(enable); - insert(serializer, self.threshold); + serializer.insert(threshold); } } -void extract(Serializer& serializer, AutoZupt& self) +void AutoZupt::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.enable); + serializer.extract(enable); - extract(serializer, self.threshold); + serializer.extract(threshold); } } -void insert(Serializer& serializer, const AutoZupt::Response& self) +void AutoZupt::Response::insert(Serializer& serializer) const { - insert(serializer, self.enable); + serializer.insert(enable); - insert(serializer, self.threshold); + serializer.insert(threshold); } -void extract(Serializer& serializer, AutoZupt::Response& self) +void AutoZupt::Response::extract(Serializer& serializer) { - extract(serializer, self.enable); + serializer.extract(enable); - extract(serializer, self.threshold); + serializer.extract(threshold); } @@ -2050,35 +1993,35 @@ TypedResult writeAutoZupt(C::mip_interface& device, uint8_t enable, fl uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, enable); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(enable); - insert(serializer, threshold); + serializer.insert(threshold); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ZUPT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ZUPT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult readAutoZupt(C::mip_interface& device, uint8_t* enableOut, float* thresholdOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_ZUPT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_ZUPT_CONTROL, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_ZUPT_CONTROL, buffer, (uint8_t)serializer.usedLength(), REPLY_ZUPT_CONTROL, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(enableOut); - extract(deserializer, *enableOut); + deserializer.extract(*enableOut); assert(thresholdOut); - extract(deserializer, *thresholdOut); + deserializer.extract(*thresholdOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -2090,68 +2033,68 @@ TypedResult saveAutoZupt(C::mip_interface& device) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ZUPT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ZUPT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadAutoZupt(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ZUPT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ZUPT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultAutoZupt(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ZUPT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ZUPT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const AutoAngularZupt& self) +void AutoAngularZupt::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.enable); + serializer.insert(enable); - insert(serializer, self.threshold); + serializer.insert(threshold); } } -void extract(Serializer& serializer, AutoAngularZupt& self) +void AutoAngularZupt::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.enable); + serializer.extract(enable); - extract(serializer, self.threshold); + serializer.extract(threshold); } } -void insert(Serializer& serializer, const AutoAngularZupt::Response& self) +void AutoAngularZupt::Response::insert(Serializer& serializer) const { - insert(serializer, self.enable); + serializer.insert(enable); - insert(serializer, self.threshold); + serializer.insert(threshold); } -void extract(Serializer& serializer, AutoAngularZupt::Response& self) +void AutoAngularZupt::Response::extract(Serializer& serializer) { - extract(serializer, self.enable); + serializer.extract(enable); - extract(serializer, self.threshold); + serializer.extract(threshold); } @@ -2160,35 +2103,35 @@ TypedResult writeAutoAngularZupt(C::mip_interface& device, uint uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, enable); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(enable); - insert(serializer, threshold); + serializer.insert(threshold); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ANGULAR_ZUPT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ANGULAR_ZUPT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult readAutoAngularZupt(C::mip_interface& device, uint8_t* enableOut, float* thresholdOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_ANGULAR_ZUPT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_ANGULAR_ZUPT_CONTROL, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_ANGULAR_ZUPT_CONTROL, buffer, (uint8_t)serializer.usedLength(), REPLY_ANGULAR_ZUPT_CONTROL, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(enableOut); - extract(deserializer, *enableOut); + deserializer.extract(*enableOut); assert(thresholdOut); - extract(deserializer, *thresholdOut); + deserializer.extract(*thresholdOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -2200,69 +2143,65 @@ TypedResult saveAutoAngularZupt(C::mip_interface& device) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ANGULAR_ZUPT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ANGULAR_ZUPT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadAutoAngularZupt(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ANGULAR_ZUPT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ANGULAR_ZUPT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultAutoAngularZupt(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ANGULAR_ZUPT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ANGULAR_ZUPT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const CommandedZupt& self) +void CommandedZupt::insert(Serializer& serializer) const { (void)serializer; - (void)self; } -void extract(Serializer& serializer, CommandedZupt& self) +void CommandedZupt::extract(Serializer& serializer) { (void)serializer; - (void)self; } TypedResult commandedZupt(C::mip_interface& device) { return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_COMMANDED_ZUPT, NULL, 0); } -void insert(Serializer& serializer, const CommandedAngularZupt& self) +void CommandedAngularZupt::insert(Serializer& serializer) const { (void)serializer; - (void)self; } -void extract(Serializer& serializer, CommandedAngularZupt& self) +void CommandedAngularZupt::extract(Serializer& serializer) { (void)serializer; - (void)self; } TypedResult commandedAngularZupt(C::mip_interface& device) { return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_COMMANDED_ANGULAR_ZUPT, NULL, 0); } -void insert(Serializer& serializer, const MagCaptureAutoCal& self) +void MagCaptureAutoCal::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); } -void extract(Serializer& serializer, MagCaptureAutoCal& self) +void MagCaptureAutoCal::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); } @@ -2271,54 +2210,50 @@ TypedResult writeMagCaptureAutoCal(C::mip_interface& device) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); + serializer.insert(FunctionSelector::WRITE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAG_CAPTURE_AUTO_CALIBRATION, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAG_CAPTURE_AUTO_CALIBRATION, buffer, (uint8_t)serializer.usedLength()); } TypedResult saveMagCaptureAutoCal(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAG_CAPTURE_AUTO_CALIBRATION, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAG_CAPTURE_AUTO_CALIBRATION, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const GravityNoise& self) +void GravityNoise::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.noise[i]); + serializer.insert(noise); } } -void extract(Serializer& serializer, GravityNoise& self) +void GravityNoise::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.noise[i]); + serializer.extract(noise); } } -void insert(Serializer& serializer, const GravityNoise::Response& self) +void GravityNoise::Response::insert(Serializer& serializer) const { - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.noise[i]); + serializer.insert(noise); } -void extract(Serializer& serializer, GravityNoise::Response& self) +void GravityNoise::Response::extract(Serializer& serializer) { - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.noise[i]); + serializer.extract(noise); } @@ -2327,33 +2262,33 @@ TypedResult writeGravityNoise(C::mip_interface& device, const floa uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - assert(noise || (3 == 0)); + serializer.insert(FunctionSelector::WRITE); + assert(noise); for(unsigned int i=0; i < 3; i++) - insert(serializer, noise[i]); + serializer.insert(noise[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GRAVITY_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GRAVITY_NOISE, buffer, (uint8_t)serializer.usedLength()); } TypedResult readGravityNoise(C::mip_interface& device, float* noiseOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_GRAVITY_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_GRAVITY_NOISE, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_GRAVITY_NOISE, buffer, (uint8_t)serializer.usedLength(), REPLY_GRAVITY_NOISE, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - assert(noiseOut || (3 == 0)); + assert(noiseOut); for(unsigned int i=0; i < 3; i++) - extract(deserializer, noiseOut[i]); + deserializer.extract(noiseOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -2365,60 +2300,60 @@ TypedResult saveGravityNoise(C::mip_interface& device) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GRAVITY_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GRAVITY_NOISE, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadGravityNoise(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GRAVITY_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GRAVITY_NOISE, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultGravityNoise(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GRAVITY_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GRAVITY_NOISE, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const PressureAltitudeNoise& self) +void PressureAltitudeNoise::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.noise); + serializer.insert(noise); } } -void extract(Serializer& serializer, PressureAltitudeNoise& self) +void PressureAltitudeNoise::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.noise); + serializer.extract(noise); } } -void insert(Serializer& serializer, const PressureAltitudeNoise::Response& self) +void PressureAltitudeNoise::Response::insert(Serializer& serializer) const { - insert(serializer, self.noise); + serializer.insert(noise); } -void extract(Serializer& serializer, PressureAltitudeNoise::Response& self) +void PressureAltitudeNoise::Response::extract(Serializer& serializer) { - extract(serializer, self.noise); + serializer.extract(noise); } @@ -2427,30 +2362,30 @@ TypedResult writePressureAltitudeNoise(C::mip_interface& uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, noise); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(noise); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_PRESSURE_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_PRESSURE_NOISE, buffer, (uint8_t)serializer.usedLength()); } TypedResult readPressureAltitudeNoise(C::mip_interface& device, float* noiseOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_PRESSURE_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_PRESSURE_NOISE, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_PRESSURE_NOISE, buffer, (uint8_t)serializer.usedLength(), REPLY_PRESSURE_NOISE, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(noiseOut); - extract(deserializer, *noiseOut); + deserializer.extract(*noiseOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -2462,64 +2397,60 @@ TypedResult savePressureAltitudeNoise(C::mip_interface& d uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_PRESSURE_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_PRESSURE_NOISE, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadPressureAltitudeNoise(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_PRESSURE_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_PRESSURE_NOISE, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultPressureAltitudeNoise(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_PRESSURE_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_PRESSURE_NOISE, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const HardIronOffsetNoise& self) +void HardIronOffsetNoise::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.noise[i]); + serializer.insert(noise); } } -void extract(Serializer& serializer, HardIronOffsetNoise& self) +void HardIronOffsetNoise::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.noise[i]); + serializer.extract(noise); } } -void insert(Serializer& serializer, const HardIronOffsetNoise::Response& self) +void HardIronOffsetNoise::Response::insert(Serializer& serializer) const { - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.noise[i]); + serializer.insert(noise); } -void extract(Serializer& serializer, HardIronOffsetNoise::Response& self) +void HardIronOffsetNoise::Response::extract(Serializer& serializer) { - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.noise[i]); + serializer.extract(noise); } @@ -2528,33 +2459,33 @@ TypedResult writeHardIronOffsetNoise(C::mip_interface& devi uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - assert(noise || (3 == 0)); + serializer.insert(FunctionSelector::WRITE); + assert(noise); for(unsigned int i=0; i < 3; i++) - insert(serializer, noise[i]); + serializer.insert(noise[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_HARD_IRON_OFFSET_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_HARD_IRON_OFFSET_NOISE, buffer, (uint8_t)serializer.usedLength()); } TypedResult readHardIronOffsetNoise(C::mip_interface& device, float* noiseOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_HARD_IRON_OFFSET_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_HARD_IRON_OFFSET_NOISE, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_HARD_IRON_OFFSET_NOISE, buffer, (uint8_t)serializer.usedLength(), REPLY_HARD_IRON_OFFSET_NOISE, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - assert(noiseOut || (3 == 0)); + assert(noiseOut); for(unsigned int i=0; i < 3; i++) - extract(deserializer, noiseOut[i]); + deserializer.extract(noiseOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -2566,64 +2497,60 @@ TypedResult saveHardIronOffsetNoise(C::mip_interface& devic uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_HARD_IRON_OFFSET_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_HARD_IRON_OFFSET_NOISE, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadHardIronOffsetNoise(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_HARD_IRON_OFFSET_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_HARD_IRON_OFFSET_NOISE, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultHardIronOffsetNoise(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_HARD_IRON_OFFSET_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_HARD_IRON_OFFSET_NOISE, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const SoftIronMatrixNoise& self) +void SoftIronMatrixNoise::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 9; i++) - insert(serializer, self.noise[i]); + serializer.insert(noise); } } -void extract(Serializer& serializer, SoftIronMatrixNoise& self) +void SoftIronMatrixNoise::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 9; i++) - extract(serializer, self.noise[i]); + serializer.extract(noise); } } -void insert(Serializer& serializer, const SoftIronMatrixNoise::Response& self) +void SoftIronMatrixNoise::Response::insert(Serializer& serializer) const { - for(unsigned int i=0; i < 9; i++) - insert(serializer, self.noise[i]); + serializer.insert(noise); } -void extract(Serializer& serializer, SoftIronMatrixNoise::Response& self) +void SoftIronMatrixNoise::Response::extract(Serializer& serializer) { - for(unsigned int i=0; i < 9; i++) - extract(serializer, self.noise[i]); + serializer.extract(noise); } @@ -2632,33 +2559,33 @@ TypedResult writeSoftIronMatrixNoise(C::mip_interface& devi uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - assert(noise || (9 == 0)); + serializer.insert(FunctionSelector::WRITE); + assert(noise); for(unsigned int i=0; i < 9; i++) - insert(serializer, noise[i]); + serializer.insert(noise[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SOFT_IRON_MATRIX_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SOFT_IRON_MATRIX_NOISE, buffer, (uint8_t)serializer.usedLength()); } TypedResult readSoftIronMatrixNoise(C::mip_interface& device, float* noiseOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_SOFT_IRON_MATRIX_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_SOFT_IRON_MATRIX_NOISE, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_SOFT_IRON_MATRIX_NOISE, buffer, (uint8_t)serializer.usedLength(), REPLY_SOFT_IRON_MATRIX_NOISE, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - assert(noiseOut || (9 == 0)); + assert(noiseOut); for(unsigned int i=0; i < 9; i++) - extract(deserializer, noiseOut[i]); + deserializer.extract(noiseOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -2670,64 +2597,60 @@ TypedResult saveSoftIronMatrixNoise(C::mip_interface& devic uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SOFT_IRON_MATRIX_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SOFT_IRON_MATRIX_NOISE, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadSoftIronMatrixNoise(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SOFT_IRON_MATRIX_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SOFT_IRON_MATRIX_NOISE, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultSoftIronMatrixNoise(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SOFT_IRON_MATRIX_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SOFT_IRON_MATRIX_NOISE, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const MagNoise& self) +void MagNoise::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.noise[i]); + serializer.insert(noise); } } -void extract(Serializer& serializer, MagNoise& self) +void MagNoise::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.noise[i]); + serializer.extract(noise); } } -void insert(Serializer& serializer, const MagNoise::Response& self) +void MagNoise::Response::insert(Serializer& serializer) const { - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.noise[i]); + serializer.insert(noise); } -void extract(Serializer& serializer, MagNoise::Response& self) +void MagNoise::Response::extract(Serializer& serializer) { - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.noise[i]); + serializer.extract(noise); } @@ -2736,33 +2659,33 @@ TypedResult writeMagNoise(C::mip_interface& device, const float* noise uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - assert(noise || (3 == 0)); + serializer.insert(FunctionSelector::WRITE); + assert(noise); for(unsigned int i=0; i < 3; i++) - insert(serializer, noise[i]); + serializer.insert(noise[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAG_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAG_NOISE, buffer, (uint8_t)serializer.usedLength()); } TypedResult readMagNoise(C::mip_interface& device, float* noiseOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_MAG_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_MAG_NOISE, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_MAG_NOISE, buffer, (uint8_t)serializer.usedLength(), REPLY_MAG_NOISE, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - assert(noiseOut || (3 == 0)); + assert(noiseOut); for(unsigned int i=0; i < 3; i++) - extract(deserializer, noiseOut[i]); + deserializer.extract(noiseOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -2774,68 +2697,68 @@ TypedResult saveMagNoise(C::mip_interface& device) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAG_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAG_NOISE, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadMagNoise(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAG_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAG_NOISE, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultMagNoise(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAG_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAG_NOISE, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const InclinationSource& self) +void InclinationSource::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.source); + serializer.insert(source); - insert(serializer, self.inclination); + serializer.insert(inclination); } } -void extract(Serializer& serializer, InclinationSource& self) +void InclinationSource::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.source); + serializer.extract(source); - extract(serializer, self.inclination); + serializer.extract(inclination); } } -void insert(Serializer& serializer, const InclinationSource::Response& self) +void InclinationSource::Response::insert(Serializer& serializer) const { - insert(serializer, self.source); + serializer.insert(source); - insert(serializer, self.inclination); + serializer.insert(inclination); } -void extract(Serializer& serializer, InclinationSource::Response& self) +void InclinationSource::Response::extract(Serializer& serializer) { - extract(serializer, self.source); + serializer.extract(source); - extract(serializer, self.inclination); + serializer.extract(inclination); } @@ -2844,35 +2767,35 @@ TypedResult writeInclinationSource(C::mip_interface& device, uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, source); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(source); - insert(serializer, inclination); + serializer.insert(inclination); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_INCLINATION_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_INCLINATION_SOURCE, buffer, (uint8_t)serializer.usedLength()); } TypedResult readInclinationSource(C::mip_interface& device, FilterMagParamSource* sourceOut, float* inclinationOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_INCLINATION_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_INCLINATION_SOURCE, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_INCLINATION_SOURCE, buffer, (uint8_t)serializer.usedLength(), REPLY_INCLINATION_SOURCE, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(sourceOut); - extract(deserializer, *sourceOut); + deserializer.extract(*sourceOut); assert(inclinationOut); - extract(deserializer, *inclinationOut); + deserializer.extract(*inclinationOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -2884,68 +2807,68 @@ TypedResult saveInclinationSource(C::mip_interface& device) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_INCLINATION_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_INCLINATION_SOURCE, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadInclinationSource(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_INCLINATION_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_INCLINATION_SOURCE, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultInclinationSource(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_INCLINATION_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_INCLINATION_SOURCE, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const MagneticDeclinationSource& self) +void MagneticDeclinationSource::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.source); + serializer.insert(source); - insert(serializer, self.declination); + serializer.insert(declination); } } -void extract(Serializer& serializer, MagneticDeclinationSource& self) +void MagneticDeclinationSource::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.source); + serializer.extract(source); - extract(serializer, self.declination); + serializer.extract(declination); } } -void insert(Serializer& serializer, const MagneticDeclinationSource::Response& self) +void MagneticDeclinationSource::Response::insert(Serializer& serializer) const { - insert(serializer, self.source); + serializer.insert(source); - insert(serializer, self.declination); + serializer.insert(declination); } -void extract(Serializer& serializer, MagneticDeclinationSource::Response& self) +void MagneticDeclinationSource::Response::extract(Serializer& serializer) { - extract(serializer, self.source); + serializer.extract(source); - extract(serializer, self.declination); + serializer.extract(declination); } @@ -2954,35 +2877,35 @@ TypedResult writeMagneticDeclinationSource(C::mip_int uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, source); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(source); - insert(serializer, declination); + serializer.insert(declination); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_DECLINATION_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_DECLINATION_SOURCE, buffer, (uint8_t)serializer.usedLength()); } TypedResult readMagneticDeclinationSource(C::mip_interface& device, FilterMagParamSource* sourceOut, float* declinationOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_DECLINATION_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_DECLINATION_SOURCE, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_DECLINATION_SOURCE, buffer, (uint8_t)serializer.usedLength(), REPLY_DECLINATION_SOURCE, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(sourceOut); - extract(deserializer, *sourceOut); + deserializer.extract(*sourceOut); assert(declinationOut); - extract(deserializer, *declinationOut); + deserializer.extract(*declinationOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -2994,68 +2917,68 @@ TypedResult saveMagneticDeclinationSource(C::mip_inte uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_DECLINATION_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_DECLINATION_SOURCE, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadMagneticDeclinationSource(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_DECLINATION_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_DECLINATION_SOURCE, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultMagneticDeclinationSource(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_DECLINATION_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_DECLINATION_SOURCE, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const MagFieldMagnitudeSource& self) +void MagFieldMagnitudeSource::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.source); + serializer.insert(source); - insert(serializer, self.magnitude); + serializer.insert(magnitude); } } -void extract(Serializer& serializer, MagFieldMagnitudeSource& self) +void MagFieldMagnitudeSource::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.source); + serializer.extract(source); - extract(serializer, self.magnitude); + serializer.extract(magnitude); } } -void insert(Serializer& serializer, const MagFieldMagnitudeSource::Response& self) +void MagFieldMagnitudeSource::Response::insert(Serializer& serializer) const { - insert(serializer, self.source); + serializer.insert(source); - insert(serializer, self.magnitude); + serializer.insert(magnitude); } -void extract(Serializer& serializer, MagFieldMagnitudeSource::Response& self) +void MagFieldMagnitudeSource::Response::extract(Serializer& serializer) { - extract(serializer, self.source); + serializer.extract(source); - extract(serializer, self.magnitude); + serializer.extract(magnitude); } @@ -3064,35 +2987,35 @@ TypedResult writeMagFieldMagnitudeSource(C::mip_interfa uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, source); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(source); - insert(serializer, magnitude); + serializer.insert(magnitude); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAGNETIC_MAGNITUDE_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAGNETIC_MAGNITUDE_SOURCE, buffer, (uint8_t)serializer.usedLength()); } TypedResult readMagFieldMagnitudeSource(C::mip_interface& device, FilterMagParamSource* sourceOut, float* magnitudeOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_MAGNETIC_MAGNITUDE_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_MAGNETIC_MAGNITUDE_SOURCE, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_MAGNETIC_MAGNITUDE_SOURCE, buffer, (uint8_t)serializer.usedLength(), REPLY_MAGNETIC_MAGNITUDE_SOURCE, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(sourceOut); - extract(deserializer, *sourceOut); + deserializer.extract(*sourceOut); assert(magnitudeOut); - extract(deserializer, *magnitudeOut); + deserializer.extract(*magnitudeOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -3104,84 +3027,84 @@ TypedResult saveMagFieldMagnitudeSource(C::mip_interfac uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAGNETIC_MAGNITUDE_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAGNETIC_MAGNITUDE_SOURCE, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadMagFieldMagnitudeSource(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAGNETIC_MAGNITUDE_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAGNETIC_MAGNITUDE_SOURCE, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultMagFieldMagnitudeSource(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAGNETIC_MAGNITUDE_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAGNETIC_MAGNITUDE_SOURCE, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const ReferencePosition& self) +void ReferencePosition::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.enable); + serializer.insert(enable); - insert(serializer, self.latitude); + serializer.insert(latitude); - insert(serializer, self.longitude); + serializer.insert(longitude); - insert(serializer, self.altitude); + serializer.insert(altitude); } } -void extract(Serializer& serializer, ReferencePosition& self) +void ReferencePosition::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.enable); + serializer.extract(enable); - extract(serializer, self.latitude); + serializer.extract(latitude); - extract(serializer, self.longitude); + serializer.extract(longitude); - extract(serializer, self.altitude); + serializer.extract(altitude); } } -void insert(Serializer& serializer, const ReferencePosition::Response& self) +void ReferencePosition::Response::insert(Serializer& serializer) const { - insert(serializer, self.enable); + serializer.insert(enable); - insert(serializer, self.latitude); + serializer.insert(latitude); - insert(serializer, self.longitude); + serializer.insert(longitude); - insert(serializer, self.altitude); + serializer.insert(altitude); } -void extract(Serializer& serializer, ReferencePosition::Response& self) +void ReferencePosition::Response::extract(Serializer& serializer) { - extract(serializer, self.enable); + serializer.extract(enable); - extract(serializer, self.latitude); + serializer.extract(latitude); - extract(serializer, self.longitude); + serializer.extract(longitude); - extract(serializer, self.altitude); + serializer.extract(altitude); } @@ -3190,45 +3113,45 @@ TypedResult writeReferencePosition(C::mip_interface& device, uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, enable); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(enable); - insert(serializer, latitude); + serializer.insert(latitude); - insert(serializer, longitude); + serializer.insert(longitude); - insert(serializer, altitude); + serializer.insert(altitude); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_REFERENCE_POSITION, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_REFERENCE_POSITION, buffer, (uint8_t)serializer.usedLength()); } TypedResult readReferencePosition(C::mip_interface& device, bool* enableOut, double* latitudeOut, double* longitudeOut, double* altitudeOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_REFERENCE_POSITION, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_REFERENCE_POSITION, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_REFERENCE_POSITION, buffer, (uint8_t)serializer.usedLength(), REPLY_REFERENCE_POSITION, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(enableOut); - extract(deserializer, *enableOut); + deserializer.extract(*enableOut); assert(latitudeOut); - extract(deserializer, *latitudeOut); + deserializer.extract(*latitudeOut); assert(longitudeOut); - extract(deserializer, *longitudeOut); + deserializer.extract(*longitudeOut); assert(altitudeOut); - extract(deserializer, *altitudeOut); + deserializer.extract(*altitudeOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -3240,108 +3163,108 @@ TypedResult saveReferencePosition(C::mip_interface& device) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_REFERENCE_POSITION, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_REFERENCE_POSITION, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadReferencePosition(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_REFERENCE_POSITION, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_REFERENCE_POSITION, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultReferencePosition(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_REFERENCE_POSITION, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_REFERENCE_POSITION, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const AccelMagnitudeErrorAdaptiveMeasurement& self) +void AccelMagnitudeErrorAdaptiveMeasurement::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.adaptive_measurement); + serializer.insert(adaptive_measurement); - insert(serializer, self.frequency); + serializer.insert(frequency); - insert(serializer, self.low_limit); + serializer.insert(low_limit); - insert(serializer, self.high_limit); + serializer.insert(high_limit); - insert(serializer, self.low_limit_uncertainty); + serializer.insert(low_limit_uncertainty); - insert(serializer, self.high_limit_uncertainty); + serializer.insert(high_limit_uncertainty); - insert(serializer, self.minimum_uncertainty); + serializer.insert(minimum_uncertainty); } } -void extract(Serializer& serializer, AccelMagnitudeErrorAdaptiveMeasurement& self) +void AccelMagnitudeErrorAdaptiveMeasurement::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.adaptive_measurement); + serializer.extract(adaptive_measurement); - extract(serializer, self.frequency); + serializer.extract(frequency); - extract(serializer, self.low_limit); + serializer.extract(low_limit); - extract(serializer, self.high_limit); + serializer.extract(high_limit); - extract(serializer, self.low_limit_uncertainty); + serializer.extract(low_limit_uncertainty); - extract(serializer, self.high_limit_uncertainty); + serializer.extract(high_limit_uncertainty); - extract(serializer, self.minimum_uncertainty); + serializer.extract(minimum_uncertainty); } } -void insert(Serializer& serializer, const AccelMagnitudeErrorAdaptiveMeasurement::Response& self) +void AccelMagnitudeErrorAdaptiveMeasurement::Response::insert(Serializer& serializer) const { - insert(serializer, self.adaptive_measurement); + serializer.insert(adaptive_measurement); - insert(serializer, self.frequency); + serializer.insert(frequency); - insert(serializer, self.low_limit); + serializer.insert(low_limit); - insert(serializer, self.high_limit); + serializer.insert(high_limit); - insert(serializer, self.low_limit_uncertainty); + serializer.insert(low_limit_uncertainty); - insert(serializer, self.high_limit_uncertainty); + serializer.insert(high_limit_uncertainty); - insert(serializer, self.minimum_uncertainty); + serializer.insert(minimum_uncertainty); } -void extract(Serializer& serializer, AccelMagnitudeErrorAdaptiveMeasurement::Response& self) +void AccelMagnitudeErrorAdaptiveMeasurement::Response::extract(Serializer& serializer) { - extract(serializer, self.adaptive_measurement); + serializer.extract(adaptive_measurement); - extract(serializer, self.frequency); + serializer.extract(frequency); - extract(serializer, self.low_limit); + serializer.extract(low_limit); - extract(serializer, self.high_limit); + serializer.extract(high_limit); - extract(serializer, self.low_limit_uncertainty); + serializer.extract(low_limit_uncertainty); - extract(serializer, self.high_limit_uncertainty); + serializer.extract(high_limit_uncertainty); - extract(serializer, self.minimum_uncertainty); + serializer.extract(minimum_uncertainty); } @@ -3350,60 +3273,60 @@ TypedResult writeAccelMagnitudeErrorAdap uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, adaptiveMeasurement); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(adaptiveMeasurement); - insert(serializer, frequency); + serializer.insert(frequency); - insert(serializer, lowLimit); + serializer.insert(lowLimit); - insert(serializer, highLimit); + serializer.insert(highLimit); - insert(serializer, lowLimitUncertainty); + serializer.insert(lowLimitUncertainty); - insert(serializer, highLimitUncertainty); + serializer.insert(highLimitUncertainty); - insert(serializer, minimumUncertainty); + serializer.insert(minimumUncertainty); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ACCEL_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ACCEL_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult readAccelMagnitudeErrorAdaptiveMeasurement(C::mip_interface& device, FilterAdaptiveMeasurement* adaptiveMeasurementOut, float* frequencyOut, float* lowLimitOut, float* highLimitOut, float* lowLimitUncertaintyOut, float* highLimitUncertaintyOut, float* minimumUncertaintyOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_ACCEL_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_ACCEL_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_ACCEL_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)serializer.usedLength(), REPLY_ACCEL_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(adaptiveMeasurementOut); - extract(deserializer, *adaptiveMeasurementOut); + deserializer.extract(*adaptiveMeasurementOut); assert(frequencyOut); - extract(deserializer, *frequencyOut); + deserializer.extract(*frequencyOut); assert(lowLimitOut); - extract(deserializer, *lowLimitOut); + deserializer.extract(*lowLimitOut); assert(highLimitOut); - extract(deserializer, *highLimitOut); + deserializer.extract(*highLimitOut); assert(lowLimitUncertaintyOut); - extract(deserializer, *lowLimitUncertaintyOut); + deserializer.extract(*lowLimitUncertaintyOut); assert(highLimitUncertaintyOut); - extract(deserializer, *highLimitUncertaintyOut); + deserializer.extract(*highLimitUncertaintyOut); assert(minimumUncertaintyOut); - extract(deserializer, *minimumUncertaintyOut); + deserializer.extract(*minimumUncertaintyOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -3415,108 +3338,108 @@ TypedResult saveAccelMagnitudeErrorAdapt uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ACCEL_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ACCEL_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadAccelMagnitudeErrorAdaptiveMeasurement(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ACCEL_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ACCEL_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultAccelMagnitudeErrorAdaptiveMeasurement(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ACCEL_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ACCEL_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const MagMagnitudeErrorAdaptiveMeasurement& self) +void MagMagnitudeErrorAdaptiveMeasurement::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.adaptive_measurement); + serializer.insert(adaptive_measurement); - insert(serializer, self.frequency); + serializer.insert(frequency); - insert(serializer, self.low_limit); + serializer.insert(low_limit); - insert(serializer, self.high_limit); + serializer.insert(high_limit); - insert(serializer, self.low_limit_uncertainty); + serializer.insert(low_limit_uncertainty); - insert(serializer, self.high_limit_uncertainty); + serializer.insert(high_limit_uncertainty); - insert(serializer, self.minimum_uncertainty); + serializer.insert(minimum_uncertainty); } } -void extract(Serializer& serializer, MagMagnitudeErrorAdaptiveMeasurement& self) +void MagMagnitudeErrorAdaptiveMeasurement::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.adaptive_measurement); + serializer.extract(adaptive_measurement); - extract(serializer, self.frequency); + serializer.extract(frequency); - extract(serializer, self.low_limit); + serializer.extract(low_limit); - extract(serializer, self.high_limit); + serializer.extract(high_limit); - extract(serializer, self.low_limit_uncertainty); + serializer.extract(low_limit_uncertainty); - extract(serializer, self.high_limit_uncertainty); + serializer.extract(high_limit_uncertainty); - extract(serializer, self.minimum_uncertainty); + serializer.extract(minimum_uncertainty); } } -void insert(Serializer& serializer, const MagMagnitudeErrorAdaptiveMeasurement::Response& self) +void MagMagnitudeErrorAdaptiveMeasurement::Response::insert(Serializer& serializer) const { - insert(serializer, self.adaptive_measurement); + serializer.insert(adaptive_measurement); - insert(serializer, self.frequency); + serializer.insert(frequency); - insert(serializer, self.low_limit); + serializer.insert(low_limit); - insert(serializer, self.high_limit); + serializer.insert(high_limit); - insert(serializer, self.low_limit_uncertainty); + serializer.insert(low_limit_uncertainty); - insert(serializer, self.high_limit_uncertainty); + serializer.insert(high_limit_uncertainty); - insert(serializer, self.minimum_uncertainty); + serializer.insert(minimum_uncertainty); } -void extract(Serializer& serializer, MagMagnitudeErrorAdaptiveMeasurement::Response& self) +void MagMagnitudeErrorAdaptiveMeasurement::Response::extract(Serializer& serializer) { - extract(serializer, self.adaptive_measurement); + serializer.extract(adaptive_measurement); - extract(serializer, self.frequency); + serializer.extract(frequency); - extract(serializer, self.low_limit); + serializer.extract(low_limit); - extract(serializer, self.high_limit); + serializer.extract(high_limit); - extract(serializer, self.low_limit_uncertainty); + serializer.extract(low_limit_uncertainty); - extract(serializer, self.high_limit_uncertainty); + serializer.extract(high_limit_uncertainty); - extract(serializer, self.minimum_uncertainty); + serializer.extract(minimum_uncertainty); } @@ -3525,60 +3448,60 @@ TypedResult writeMagMagnitudeErrorAdaptive uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, adaptiveMeasurement); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(adaptiveMeasurement); - insert(serializer, frequency); + serializer.insert(frequency); - insert(serializer, lowLimit); + serializer.insert(lowLimit); - insert(serializer, highLimit); + serializer.insert(highLimit); - insert(serializer, lowLimitUncertainty); + serializer.insert(lowLimitUncertainty); - insert(serializer, highLimitUncertainty); + serializer.insert(highLimitUncertainty); - insert(serializer, minimumUncertainty); + serializer.insert(minimumUncertainty); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAG_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAG_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult readMagMagnitudeErrorAdaptiveMeasurement(C::mip_interface& device, FilterAdaptiveMeasurement* adaptiveMeasurementOut, float* frequencyOut, float* lowLimitOut, float* highLimitOut, float* lowLimitUncertaintyOut, float* highLimitUncertaintyOut, float* minimumUncertaintyOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_MAG_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_MAG_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_MAG_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)serializer.usedLength(), REPLY_MAG_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(adaptiveMeasurementOut); - extract(deserializer, *adaptiveMeasurementOut); + deserializer.extract(*adaptiveMeasurementOut); assert(frequencyOut); - extract(deserializer, *frequencyOut); + deserializer.extract(*frequencyOut); assert(lowLimitOut); - extract(deserializer, *lowLimitOut); + deserializer.extract(*lowLimitOut); assert(highLimitOut); - extract(deserializer, *highLimitOut); + deserializer.extract(*highLimitOut); assert(lowLimitUncertaintyOut); - extract(deserializer, *lowLimitUncertaintyOut); + deserializer.extract(*lowLimitUncertaintyOut); assert(highLimitUncertaintyOut); - extract(deserializer, *highLimitUncertaintyOut); + deserializer.extract(*highLimitUncertaintyOut); assert(minimumUncertaintyOut); - extract(deserializer, *minimumUncertaintyOut); + deserializer.extract(*minimumUncertaintyOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -3590,92 +3513,92 @@ TypedResult saveMagMagnitudeErrorAdaptiveM uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAG_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAG_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadMagMagnitudeErrorAdaptiveMeasurement(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAG_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAG_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultMagMagnitudeErrorAdaptiveMeasurement(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAG_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAG_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const MagDipAngleErrorAdaptiveMeasurement& self) +void MagDipAngleErrorAdaptiveMeasurement::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.enable); + serializer.insert(enable); - insert(serializer, self.frequency); + serializer.insert(frequency); - insert(serializer, self.high_limit); + serializer.insert(high_limit); - insert(serializer, self.high_limit_uncertainty); + serializer.insert(high_limit_uncertainty); - insert(serializer, self.minimum_uncertainty); + serializer.insert(minimum_uncertainty); } } -void extract(Serializer& serializer, MagDipAngleErrorAdaptiveMeasurement& self) +void MagDipAngleErrorAdaptiveMeasurement::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.enable); + serializer.extract(enable); - extract(serializer, self.frequency); + serializer.extract(frequency); - extract(serializer, self.high_limit); + serializer.extract(high_limit); - extract(serializer, self.high_limit_uncertainty); + serializer.extract(high_limit_uncertainty); - extract(serializer, self.minimum_uncertainty); + serializer.extract(minimum_uncertainty); } } -void insert(Serializer& serializer, const MagDipAngleErrorAdaptiveMeasurement::Response& self) +void MagDipAngleErrorAdaptiveMeasurement::Response::insert(Serializer& serializer) const { - insert(serializer, self.enable); + serializer.insert(enable); - insert(serializer, self.frequency); + serializer.insert(frequency); - insert(serializer, self.high_limit); + serializer.insert(high_limit); - insert(serializer, self.high_limit_uncertainty); + serializer.insert(high_limit_uncertainty); - insert(serializer, self.minimum_uncertainty); + serializer.insert(minimum_uncertainty); } -void extract(Serializer& serializer, MagDipAngleErrorAdaptiveMeasurement::Response& self) +void MagDipAngleErrorAdaptiveMeasurement::Response::extract(Serializer& serializer) { - extract(serializer, self.enable); + serializer.extract(enable); - extract(serializer, self.frequency); + serializer.extract(frequency); - extract(serializer, self.high_limit); + serializer.extract(high_limit); - extract(serializer, self.high_limit_uncertainty); + serializer.extract(high_limit_uncertainty); - extract(serializer, self.minimum_uncertainty); + serializer.extract(minimum_uncertainty); } @@ -3684,50 +3607,50 @@ TypedResult writeMagDipAngleErrorAdaptiveMe uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, enable); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(enable); - insert(serializer, frequency); + serializer.insert(frequency); - insert(serializer, highLimit); + serializer.insert(highLimit); - insert(serializer, highLimitUncertainty); + serializer.insert(highLimitUncertainty); - insert(serializer, minimumUncertainty); + serializer.insert(minimumUncertainty); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAG_DIP_ANGLE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAG_DIP_ANGLE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult readMagDipAngleErrorAdaptiveMeasurement(C::mip_interface& device, bool* enableOut, float* frequencyOut, float* highLimitOut, float* highLimitUncertaintyOut, float* minimumUncertaintyOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_MAG_DIP_ANGLE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_MAG_DIP_ANGLE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_MAG_DIP_ANGLE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)serializer.usedLength(), REPLY_MAG_DIP_ANGLE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(enableOut); - extract(deserializer, *enableOut); + deserializer.extract(*enableOut); assert(frequencyOut); - extract(deserializer, *frequencyOut); + deserializer.extract(*frequencyOut); assert(highLimitOut); - extract(deserializer, *highLimitOut); + deserializer.extract(*highLimitOut); assert(highLimitUncertaintyOut); - extract(deserializer, *highLimitUncertaintyOut); + deserializer.extract(*highLimitUncertaintyOut); assert(minimumUncertaintyOut); - extract(deserializer, *minimumUncertaintyOut); + deserializer.extract(*minimumUncertaintyOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -3739,68 +3662,68 @@ TypedResult saveMagDipAngleErrorAdaptiveMea uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAG_DIP_ANGLE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAG_DIP_ANGLE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadMagDipAngleErrorAdaptiveMeasurement(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAG_DIP_ANGLE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAG_DIP_ANGLE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultMagDipAngleErrorAdaptiveMeasurement(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAG_DIP_ANGLE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAG_DIP_ANGLE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const AidingMeasurementEnable& self) +void AidingMeasurementEnable::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - insert(serializer, self.aiding_source); + serializer.insert(aiding_source); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.enable); + serializer.insert(enable); } } -void extract(Serializer& serializer, AidingMeasurementEnable& self) +void AidingMeasurementEnable::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - extract(serializer, self.aiding_source); + serializer.extract(aiding_source); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.enable); + serializer.extract(enable); } } -void insert(Serializer& serializer, const AidingMeasurementEnable::Response& self) +void AidingMeasurementEnable::Response::insert(Serializer& serializer) const { - insert(serializer, self.aiding_source); + serializer.insert(aiding_source); - insert(serializer, self.enable); + serializer.insert(enable); } -void extract(Serializer& serializer, AidingMeasurementEnable::Response& self) +void AidingMeasurementEnable::Response::extract(Serializer& serializer) { - extract(serializer, self.aiding_source); + serializer.extract(aiding_source); - extract(serializer, self.enable); + serializer.extract(enable); } @@ -3809,36 +3732,36 @@ TypedResult writeAidingMeasurementEnable(C::mip_interfa uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, aidingSource); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(aidingSource); - insert(serializer, enable); + serializer.insert(enable); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_AIDING_MEASUREMENT_ENABLE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_AIDING_MEASUREMENT_ENABLE, buffer, (uint8_t)serializer.usedLength()); } TypedResult readAidingMeasurementEnable(C::mip_interface& device, AidingMeasurementEnable::AidingSource aidingSource, bool* enableOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); - insert(serializer, aidingSource); + serializer.insert(FunctionSelector::READ); + serializer.insert(aidingSource); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_AIDING_MEASUREMENT_ENABLE, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_AIDING_MEASUREMENT_ENABLE, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_AIDING_MEASUREMENT_ENABLE, buffer, (uint8_t)serializer.usedLength(), REPLY_AIDING_MEASUREMENT_ENABLE, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - extract(deserializer, aidingSource); + deserializer.extract(aidingSource); assert(enableOut); - extract(deserializer, *enableOut); + deserializer.extract(*enableOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -3850,97 +3773,95 @@ TypedResult saveAidingMeasurementEnable(C::mip_interfac uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); - insert(serializer, aidingSource); + serializer.insert(FunctionSelector::SAVE); + serializer.insert(aidingSource); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_AIDING_MEASUREMENT_ENABLE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_AIDING_MEASUREMENT_ENABLE, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadAidingMeasurementEnable(C::mip_interface& device, AidingMeasurementEnable::AidingSource aidingSource) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); - insert(serializer, aidingSource); + serializer.insert(FunctionSelector::LOAD); + serializer.insert(aidingSource); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_AIDING_MEASUREMENT_ENABLE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_AIDING_MEASUREMENT_ENABLE, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultAidingMeasurementEnable(C::mip_interface& device, AidingMeasurementEnable::AidingSource aidingSource) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); - insert(serializer, aidingSource); + serializer.insert(FunctionSelector::RESET); + serializer.insert(aidingSource); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_AIDING_MEASUREMENT_ENABLE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_AIDING_MEASUREMENT_ENABLE, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const Run& self) +void Run::insert(Serializer& serializer) const { (void)serializer; - (void)self; } -void extract(Serializer& serializer, Run& self) +void Run::extract(Serializer& serializer) { (void)serializer; - (void)self; } TypedResult run(C::mip_interface& device) { return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_RUN, NULL, 0); } -void insert(Serializer& serializer, const KinematicConstraint& self) +void KinematicConstraint::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.acceleration_constraint_selection); + serializer.insert(acceleration_constraint_selection); - insert(serializer, self.velocity_constraint_selection); + serializer.insert(velocity_constraint_selection); - insert(serializer, self.angular_constraint_selection); + serializer.insert(angular_constraint_selection); } } -void extract(Serializer& serializer, KinematicConstraint& self) +void KinematicConstraint::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.acceleration_constraint_selection); + serializer.extract(acceleration_constraint_selection); - extract(serializer, self.velocity_constraint_selection); + serializer.extract(velocity_constraint_selection); - extract(serializer, self.angular_constraint_selection); + serializer.extract(angular_constraint_selection); } } -void insert(Serializer& serializer, const KinematicConstraint::Response& self) +void KinematicConstraint::Response::insert(Serializer& serializer) const { - insert(serializer, self.acceleration_constraint_selection); + serializer.insert(acceleration_constraint_selection); - insert(serializer, self.velocity_constraint_selection); + serializer.insert(velocity_constraint_selection); - insert(serializer, self.angular_constraint_selection); + serializer.insert(angular_constraint_selection); } -void extract(Serializer& serializer, KinematicConstraint::Response& self) +void KinematicConstraint::Response::extract(Serializer& serializer) { - extract(serializer, self.acceleration_constraint_selection); + serializer.extract(acceleration_constraint_selection); - extract(serializer, self.velocity_constraint_selection); + serializer.extract(velocity_constraint_selection); - extract(serializer, self.angular_constraint_selection); + serializer.extract(angular_constraint_selection); } @@ -3949,40 +3870,40 @@ TypedResult writeKinematicConstraint(C::mip_interface& devi uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, accelerationConstraintSelection); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(accelerationConstraintSelection); - insert(serializer, velocityConstraintSelection); + serializer.insert(velocityConstraintSelection); - insert(serializer, angularConstraintSelection); + serializer.insert(angularConstraintSelection); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_KINEMATIC_CONSTRAINT, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_KINEMATIC_CONSTRAINT, buffer, (uint8_t)serializer.usedLength()); } TypedResult readKinematicConstraint(C::mip_interface& device, uint8_t* accelerationConstraintSelectionOut, uint8_t* velocityConstraintSelectionOut, uint8_t* angularConstraintSelectionOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_KINEMATIC_CONSTRAINT, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_KINEMATIC_CONSTRAINT, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_KINEMATIC_CONSTRAINT, buffer, (uint8_t)serializer.usedLength(), REPLY_KINEMATIC_CONSTRAINT, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(accelerationConstraintSelectionOut); - extract(deserializer, *accelerationConstraintSelectionOut); + deserializer.extract(*accelerationConstraintSelectionOut); assert(velocityConstraintSelectionOut); - extract(deserializer, *velocityConstraintSelectionOut); + deserializer.extract(*velocityConstraintSelectionOut); assert(angularConstraintSelectionOut); - extract(deserializer, *angularConstraintSelectionOut); + deserializer.extract(*angularConstraintSelectionOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -3994,132 +3915,124 @@ TypedResult saveKinematicConstraint(C::mip_interface& devic uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_KINEMATIC_CONSTRAINT, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_KINEMATIC_CONSTRAINT, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadKinematicConstraint(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_KINEMATIC_CONSTRAINT, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_KINEMATIC_CONSTRAINT, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultKinematicConstraint(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_KINEMATIC_CONSTRAINT, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_KINEMATIC_CONSTRAINT, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const InitializationConfiguration& self) +void InitializationConfiguration::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.wait_for_run_command); + serializer.insert(wait_for_run_command); - insert(serializer, self.initial_cond_src); + serializer.insert(initial_cond_src); - insert(serializer, self.auto_heading_alignment_selector); + serializer.insert(auto_heading_alignment_selector); - insert(serializer, self.initial_heading); + serializer.insert(initial_heading); - insert(serializer, self.initial_pitch); + serializer.insert(initial_pitch); - insert(serializer, self.initial_roll); + serializer.insert(initial_roll); - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.initial_position[i]); + serializer.insert(initial_position); - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.initial_velocity[i]); + serializer.insert(initial_velocity); - insert(serializer, self.reference_frame_selector); + serializer.insert(reference_frame_selector); } } -void extract(Serializer& serializer, InitializationConfiguration& self) +void InitializationConfiguration::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.wait_for_run_command); + serializer.extract(wait_for_run_command); - extract(serializer, self.initial_cond_src); + serializer.extract(initial_cond_src); - extract(serializer, self.auto_heading_alignment_selector); + serializer.extract(auto_heading_alignment_selector); - extract(serializer, self.initial_heading); + serializer.extract(initial_heading); - extract(serializer, self.initial_pitch); + serializer.extract(initial_pitch); - extract(serializer, self.initial_roll); + serializer.extract(initial_roll); - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.initial_position[i]); + serializer.extract(initial_position); - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.initial_velocity[i]); + serializer.extract(initial_velocity); - extract(serializer, self.reference_frame_selector); + serializer.extract(reference_frame_selector); } } -void insert(Serializer& serializer, const InitializationConfiguration::Response& self) +void InitializationConfiguration::Response::insert(Serializer& serializer) const { - insert(serializer, self.wait_for_run_command); + serializer.insert(wait_for_run_command); - insert(serializer, self.initial_cond_src); + serializer.insert(initial_cond_src); - insert(serializer, self.auto_heading_alignment_selector); + serializer.insert(auto_heading_alignment_selector); - insert(serializer, self.initial_heading); + serializer.insert(initial_heading); - insert(serializer, self.initial_pitch); + serializer.insert(initial_pitch); - insert(serializer, self.initial_roll); + serializer.insert(initial_roll); - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.initial_position[i]); + serializer.insert(initial_position); - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.initial_velocity[i]); + serializer.insert(initial_velocity); - insert(serializer, self.reference_frame_selector); + serializer.insert(reference_frame_selector); } -void extract(Serializer& serializer, InitializationConfiguration::Response& self) +void InitializationConfiguration::Response::extract(Serializer& serializer) { - extract(serializer, self.wait_for_run_command); + serializer.extract(wait_for_run_command); - extract(serializer, self.initial_cond_src); + serializer.extract(initial_cond_src); - extract(serializer, self.auto_heading_alignment_selector); + serializer.extract(auto_heading_alignment_selector); - extract(serializer, self.initial_heading); + serializer.extract(initial_heading); - extract(serializer, self.initial_pitch); + serializer.extract(initial_pitch); - extract(serializer, self.initial_roll); + serializer.extract(initial_roll); - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.initial_position[i]); + serializer.extract(initial_position); - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.initial_velocity[i]); + serializer.extract(initial_velocity); - extract(serializer, self.reference_frame_selector); + serializer.extract(reference_frame_selector); } @@ -4128,76 +4041,76 @@ TypedResult writeInitializationConfiguration(C::mip uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, waitForRunCommand); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(waitForRunCommand); - insert(serializer, initialCondSrc); + serializer.insert(initialCondSrc); - insert(serializer, autoHeadingAlignmentSelector); + serializer.insert(autoHeadingAlignmentSelector); - insert(serializer, initialHeading); + serializer.insert(initialHeading); - insert(serializer, initialPitch); + serializer.insert(initialPitch); - insert(serializer, initialRoll); + serializer.insert(initialRoll); - assert(initialPosition || (3 == 0)); + assert(initialPosition); for(unsigned int i=0; i < 3; i++) - insert(serializer, initialPosition[i]); + serializer.insert(initialPosition[i]); - assert(initialVelocity || (3 == 0)); + assert(initialVelocity); for(unsigned int i=0; i < 3; i++) - insert(serializer, initialVelocity[i]); + serializer.insert(initialVelocity[i]); - insert(serializer, referenceFrameSelector); + serializer.insert(referenceFrameSelector); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_INITIALIZATION_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_INITIALIZATION_CONFIGURATION, buffer, (uint8_t)serializer.usedLength()); } TypedResult readInitializationConfiguration(C::mip_interface& device, uint8_t* waitForRunCommandOut, InitializationConfiguration::InitialConditionSource* initialCondSrcOut, InitializationConfiguration::AlignmentSelector* autoHeadingAlignmentSelectorOut, float* initialHeadingOut, float* initialPitchOut, float* initialRollOut, float* initialPositionOut, float* initialVelocityOut, FilterReferenceFrame* referenceFrameSelectorOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_INITIALIZATION_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_INITIALIZATION_CONFIGURATION, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_INITIALIZATION_CONFIGURATION, buffer, (uint8_t)serializer.usedLength(), REPLY_INITIALIZATION_CONFIGURATION, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(waitForRunCommandOut); - extract(deserializer, *waitForRunCommandOut); + deserializer.extract(*waitForRunCommandOut); assert(initialCondSrcOut); - extract(deserializer, *initialCondSrcOut); + deserializer.extract(*initialCondSrcOut); assert(autoHeadingAlignmentSelectorOut); - extract(deserializer, *autoHeadingAlignmentSelectorOut); + deserializer.extract(*autoHeadingAlignmentSelectorOut); assert(initialHeadingOut); - extract(deserializer, *initialHeadingOut); + deserializer.extract(*initialHeadingOut); assert(initialPitchOut); - extract(deserializer, *initialPitchOut); + deserializer.extract(*initialPitchOut); assert(initialRollOut); - extract(deserializer, *initialRollOut); + deserializer.extract(*initialRollOut); - assert(initialPositionOut || (3 == 0)); + assert(initialPositionOut); for(unsigned int i=0; i < 3; i++) - extract(deserializer, initialPositionOut[i]); + deserializer.extract(initialPositionOut[i]); - assert(initialVelocityOut || (3 == 0)); + assert(initialVelocityOut); for(unsigned int i=0; i < 3; i++) - extract(deserializer, initialVelocityOut[i]); + deserializer.extract(initialVelocityOut[i]); assert(referenceFrameSelectorOut); - extract(deserializer, *referenceFrameSelectorOut); + deserializer.extract(*referenceFrameSelectorOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -4209,68 +4122,68 @@ TypedResult saveInitializationConfiguration(C::mip_ uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_INITIALIZATION_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_INITIALIZATION_CONFIGURATION, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadInitializationConfiguration(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_INITIALIZATION_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_INITIALIZATION_CONFIGURATION, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultInitializationConfiguration(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_INITIALIZATION_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_INITIALIZATION_CONFIGURATION, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const AdaptiveFilterOptions& self) +void AdaptiveFilterOptions::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.level); + serializer.insert(level); - insert(serializer, self.time_limit); + serializer.insert(time_limit); } } -void extract(Serializer& serializer, AdaptiveFilterOptions& self) +void AdaptiveFilterOptions::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.level); + serializer.extract(level); - extract(serializer, self.time_limit); + serializer.extract(time_limit); } } -void insert(Serializer& serializer, const AdaptiveFilterOptions::Response& self) +void AdaptiveFilterOptions::Response::insert(Serializer& serializer) const { - insert(serializer, self.level); + serializer.insert(level); - insert(serializer, self.time_limit); + serializer.insert(time_limit); } -void extract(Serializer& serializer, AdaptiveFilterOptions::Response& self) +void AdaptiveFilterOptions::Response::extract(Serializer& serializer) { - extract(serializer, self.level); + serializer.extract(level); - extract(serializer, self.time_limit); + serializer.extract(time_limit); } @@ -4279,35 +4192,35 @@ TypedResult writeAdaptiveFilterOptions(C::mip_interface& uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, level); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(level); - insert(serializer, timeLimit); + serializer.insert(timeLimit); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ADAPTIVE_FILTER_OPTIONS, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ADAPTIVE_FILTER_OPTIONS, buffer, (uint8_t)serializer.usedLength()); } TypedResult readAdaptiveFilterOptions(C::mip_interface& device, uint8_t* levelOut, uint16_t* timeLimitOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_ADAPTIVE_FILTER_OPTIONS, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_ADAPTIVE_FILTER_OPTIONS, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_ADAPTIVE_FILTER_OPTIONS, buffer, (uint8_t)serializer.usedLength(), REPLY_ADAPTIVE_FILTER_OPTIONS, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(levelOut); - extract(deserializer, *levelOut); + deserializer.extract(*levelOut); assert(timeLimitOut); - extract(deserializer, *timeLimitOut); + deserializer.extract(*timeLimitOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -4319,72 +4232,68 @@ TypedResult saveAdaptiveFilterOptions(C::mip_interface& d uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ADAPTIVE_FILTER_OPTIONS, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ADAPTIVE_FILTER_OPTIONS, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadAdaptiveFilterOptions(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ADAPTIVE_FILTER_OPTIONS, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ADAPTIVE_FILTER_OPTIONS, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultAdaptiveFilterOptions(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ADAPTIVE_FILTER_OPTIONS, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ADAPTIVE_FILTER_OPTIONS, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const MultiAntennaOffset& self) +void MultiAntennaOffset::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - insert(serializer, self.receiver_id); + serializer.insert(receiver_id); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.antenna_offset[i]); + serializer.insert(antenna_offset); } } -void extract(Serializer& serializer, MultiAntennaOffset& self) +void MultiAntennaOffset::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - extract(serializer, self.receiver_id); + serializer.extract(receiver_id); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.antenna_offset[i]); + serializer.extract(antenna_offset); } } -void insert(Serializer& serializer, const MultiAntennaOffset::Response& self) +void MultiAntennaOffset::Response::insert(Serializer& serializer) const { - insert(serializer, self.receiver_id); + serializer.insert(receiver_id); - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.antenna_offset[i]); + serializer.insert(antenna_offset); } -void extract(Serializer& serializer, MultiAntennaOffset::Response& self) +void MultiAntennaOffset::Response::extract(Serializer& serializer) { - extract(serializer, self.receiver_id); + serializer.extract(receiver_id); - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.antenna_offset[i]); + serializer.extract(antenna_offset); } @@ -4393,39 +4302,39 @@ TypedResult writeMultiAntennaOffset(C::mip_interface& device uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, receiverId); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(receiverId); - assert(antennaOffset || (3 == 0)); + assert(antennaOffset); for(unsigned int i=0; i < 3; i++) - insert(serializer, antennaOffset[i]); + serializer.insert(antennaOffset[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MULTI_ANTENNA_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MULTI_ANTENNA_OFFSET, buffer, (uint8_t)serializer.usedLength()); } TypedResult readMultiAntennaOffset(C::mip_interface& device, uint8_t receiverId, float* antennaOffsetOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); - insert(serializer, receiverId); + serializer.insert(FunctionSelector::READ); + serializer.insert(receiverId); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_MULTI_ANTENNA_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_MULTI_ANTENNA_OFFSET, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_MULTI_ANTENNA_OFFSET, buffer, (uint8_t)serializer.usedLength(), REPLY_MULTI_ANTENNA_OFFSET, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - extract(deserializer, receiverId); + deserializer.extract(receiverId); - assert(antennaOffsetOut || (3 == 0)); + assert(antennaOffsetOut); for(unsigned int i=0; i < 3; i++) - extract(deserializer, antennaOffsetOut[i]); + deserializer.extract(antennaOffsetOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -4437,86 +4346,82 @@ TypedResult saveMultiAntennaOffset(C::mip_interface& device, uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); - insert(serializer, receiverId); + serializer.insert(FunctionSelector::SAVE); + serializer.insert(receiverId); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MULTI_ANTENNA_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MULTI_ANTENNA_OFFSET, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadMultiAntennaOffset(C::mip_interface& device, uint8_t receiverId) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); - insert(serializer, receiverId); + serializer.insert(FunctionSelector::LOAD); + serializer.insert(receiverId); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MULTI_ANTENNA_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MULTI_ANTENNA_OFFSET, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultMultiAntennaOffset(C::mip_interface& device, uint8_t receiverId) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); - insert(serializer, receiverId); + serializer.insert(FunctionSelector::RESET); + serializer.insert(receiverId); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MULTI_ANTENNA_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MULTI_ANTENNA_OFFSET, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const RelPosConfiguration& self) +void RelPosConfiguration::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.source); + serializer.insert(source); - insert(serializer, self.reference_frame_selector); + serializer.insert(reference_frame_selector); - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.reference_coordinates[i]); + serializer.insert(reference_coordinates); } } -void extract(Serializer& serializer, RelPosConfiguration& self) +void RelPosConfiguration::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.source); + serializer.extract(source); - extract(serializer, self.reference_frame_selector); + serializer.extract(reference_frame_selector); - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.reference_coordinates[i]); + serializer.extract(reference_coordinates); } } -void insert(Serializer& serializer, const RelPosConfiguration::Response& self) +void RelPosConfiguration::Response::insert(Serializer& serializer) const { - insert(serializer, self.source); + serializer.insert(source); - insert(serializer, self.reference_frame_selector); + serializer.insert(reference_frame_selector); - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.reference_coordinates[i]); + serializer.insert(reference_coordinates); } -void extract(Serializer& serializer, RelPosConfiguration::Response& self) +void RelPosConfiguration::Response::extract(Serializer& serializer) { - extract(serializer, self.source); + serializer.extract(source); - extract(serializer, self.reference_frame_selector); + serializer.extract(reference_frame_selector); - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.reference_coordinates[i]); + serializer.extract(reference_coordinates); } @@ -4525,43 +4430,43 @@ TypedResult writeRelPosConfiguration(C::mip_interface& devi uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, source); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(source); - insert(serializer, referenceFrameSelector); + serializer.insert(referenceFrameSelector); - assert(referenceCoordinates || (3 == 0)); + assert(referenceCoordinates); for(unsigned int i=0; i < 3; i++) - insert(serializer, referenceCoordinates[i]); + serializer.insert(referenceCoordinates[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_REL_POS_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_REL_POS_CONFIGURATION, buffer, (uint8_t)serializer.usedLength()); } TypedResult readRelPosConfiguration(C::mip_interface& device, uint8_t* sourceOut, FilterReferenceFrame* referenceFrameSelectorOut, double* referenceCoordinatesOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_REL_POS_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_REL_POS_CONFIGURATION, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_REL_POS_CONFIGURATION, buffer, (uint8_t)serializer.usedLength(), REPLY_REL_POS_CONFIGURATION, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(sourceOut); - extract(deserializer, *sourceOut); + deserializer.extract(*sourceOut); assert(referenceFrameSelectorOut); - extract(deserializer, *referenceFrameSelectorOut); + deserializer.extract(*referenceFrameSelectorOut); - assert(referenceCoordinatesOut || (3 == 0)); + assert(referenceCoordinatesOut); for(unsigned int i=0; i < 3; i++) - extract(deserializer, referenceCoordinatesOut[i]); + deserializer.extract(referenceCoordinatesOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -4573,72 +4478,68 @@ TypedResult saveRelPosConfiguration(C::mip_interface& devic uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_REL_POS_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_REL_POS_CONFIGURATION, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadRelPosConfiguration(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_REL_POS_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_REL_POS_CONFIGURATION, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultRelPosConfiguration(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_REL_POS_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_REL_POS_CONFIGURATION, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const RefPointLeverArm& self) +void RefPointLeverArm::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.ref_point_sel); + serializer.insert(ref_point_sel); - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.lever_arm_offset[i]); + serializer.insert(lever_arm_offset); } } -void extract(Serializer& serializer, RefPointLeverArm& self) +void RefPointLeverArm::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.ref_point_sel); + serializer.extract(ref_point_sel); - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.lever_arm_offset[i]); + serializer.extract(lever_arm_offset); } } -void insert(Serializer& serializer, const RefPointLeverArm::Response& self) +void RefPointLeverArm::Response::insert(Serializer& serializer) const { - insert(serializer, self.ref_point_sel); + serializer.insert(ref_point_sel); - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.lever_arm_offset[i]); + serializer.insert(lever_arm_offset); } -void extract(Serializer& serializer, RefPointLeverArm::Response& self) +void RefPointLeverArm::Response::extract(Serializer& serializer) { - extract(serializer, self.ref_point_sel); + serializer.extract(ref_point_sel); - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.lever_arm_offset[i]); + serializer.extract(lever_arm_offset); } @@ -4647,38 +4548,38 @@ TypedResult writeRefPointLeverArm(C::mip_interface& device, Re uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, refPointSel); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(refPointSel); - assert(leverArmOffset || (3 == 0)); + assert(leverArmOffset); for(unsigned int i=0; i < 3; i++) - insert(serializer, leverArmOffset[i]); + serializer.insert(leverArmOffset[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_REF_POINT_LEVER_ARM, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_REF_POINT_LEVER_ARM, buffer, (uint8_t)serializer.usedLength()); } TypedResult readRefPointLeverArm(C::mip_interface& device, RefPointLeverArm::ReferencePointSelector* refPointSelOut, float* leverArmOffsetOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_REF_POINT_LEVER_ARM, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_REF_POINT_LEVER_ARM, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_REF_POINT_LEVER_ARM, buffer, (uint8_t)serializer.usedLength(), REPLY_REF_POINT_LEVER_ARM, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(refPointSelOut); - extract(deserializer, *refPointSelOut); + deserializer.extract(*refPointSelOut); - assert(leverArmOffsetOut || (3 == 0)); + assert(leverArmOffsetOut); for(unsigned int i=0; i < 3; i++) - extract(deserializer, leverArmOffsetOut[i]); + deserializer.extract(leverArmOffsetOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -4690,51 +4591,51 @@ TypedResult saveRefPointLeverArm(C::mip_interface& device) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_REF_POINT_LEVER_ARM, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_REF_POINT_LEVER_ARM, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadRefPointLeverArm(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_REF_POINT_LEVER_ARM, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_REF_POINT_LEVER_ARM, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultRefPointLeverArm(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_REF_POINT_LEVER_ARM, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_REF_POINT_LEVER_ARM, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const SpeedMeasurement& self) +void SpeedMeasurement::insert(Serializer& serializer) const { - insert(serializer, self.source); + serializer.insert(source); - insert(serializer, self.time_of_week); + serializer.insert(time_of_week); - insert(serializer, self.speed); + serializer.insert(speed); - insert(serializer, self.speed_uncertainty); + serializer.insert(speed_uncertainty); } -void extract(Serializer& serializer, SpeedMeasurement& self) +void SpeedMeasurement::extract(Serializer& serializer) { - extract(serializer, self.source); + serializer.extract(source); - extract(serializer, self.time_of_week); + serializer.extract(time_of_week); - extract(serializer, self.speed); + serializer.extract(speed); - extract(serializer, self.speed_uncertainty); + serializer.extract(speed_uncertainty); } @@ -4743,59 +4644,55 @@ TypedResult speedMeasurement(C::mip_interface& device, uint8_t uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, source); + serializer.insert(source); - insert(serializer, timeOfWeek); + serializer.insert(timeOfWeek); - insert(serializer, speed); + serializer.insert(speed); - insert(serializer, speedUncertainty); + serializer.insert(speedUncertainty); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SPEED_MEASUREMENT, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SPEED_MEASUREMENT, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const SpeedLeverArm& self) +void SpeedLeverArm::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - insert(serializer, self.source); + serializer.insert(source); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.lever_arm_offset[i]); + serializer.insert(lever_arm_offset); } } -void extract(Serializer& serializer, SpeedLeverArm& self) +void SpeedLeverArm::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - extract(serializer, self.source); + serializer.extract(source); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.lever_arm_offset[i]); + serializer.extract(lever_arm_offset); } } -void insert(Serializer& serializer, const SpeedLeverArm::Response& self) +void SpeedLeverArm::Response::insert(Serializer& serializer) const { - insert(serializer, self.source); + serializer.insert(source); - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.lever_arm_offset[i]); + serializer.insert(lever_arm_offset); } -void extract(Serializer& serializer, SpeedLeverArm::Response& self) +void SpeedLeverArm::Response::extract(Serializer& serializer) { - extract(serializer, self.source); + serializer.extract(source); - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.lever_arm_offset[i]); + serializer.extract(lever_arm_offset); } @@ -4804,39 +4701,39 @@ TypedResult writeSpeedLeverArm(C::mip_interface& device, uint8_t uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, source); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(source); - assert(leverArmOffset || (3 == 0)); + assert(leverArmOffset); for(unsigned int i=0; i < 3; i++) - insert(serializer, leverArmOffset[i]); + serializer.insert(leverArmOffset[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SPEED_LEVER_ARM, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SPEED_LEVER_ARM, buffer, (uint8_t)serializer.usedLength()); } TypedResult readSpeedLeverArm(C::mip_interface& device, uint8_t source, float* leverArmOffsetOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); - insert(serializer, source); + serializer.insert(FunctionSelector::READ); + serializer.insert(source); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_SPEED_LEVER_ARM, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_SPEED_LEVER_ARM, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_SPEED_LEVER_ARM, buffer, (uint8_t)serializer.usedLength(), REPLY_SPEED_LEVER_ARM, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); - extract(deserializer, source); + deserializer.extract(source); - assert(leverArmOffsetOut || (3 == 0)); + assert(leverArmOffsetOut); for(unsigned int i=0; i < 3; i++) - extract(deserializer, leverArmOffsetOut[i]); + deserializer.extract(leverArmOffsetOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -4848,66 +4745,66 @@ TypedResult saveSpeedLeverArm(C::mip_interface& device, uint8_t s uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); - insert(serializer, source); + serializer.insert(FunctionSelector::SAVE); + serializer.insert(source); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SPEED_LEVER_ARM, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SPEED_LEVER_ARM, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadSpeedLeverArm(C::mip_interface& device, uint8_t source) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); - insert(serializer, source); + serializer.insert(FunctionSelector::LOAD); + serializer.insert(source); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SPEED_LEVER_ARM, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SPEED_LEVER_ARM, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultSpeedLeverArm(C::mip_interface& device, uint8_t source) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); - insert(serializer, source); + serializer.insert(FunctionSelector::RESET); + serializer.insert(source); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SPEED_LEVER_ARM, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SPEED_LEVER_ARM, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const WheeledVehicleConstraintControl& self) +void WheeledVehicleConstraintControl::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.enable); + serializer.insert(enable); } } -void extract(Serializer& serializer, WheeledVehicleConstraintControl& self) +void WheeledVehicleConstraintControl::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.enable); + serializer.extract(enable); } } -void insert(Serializer& serializer, const WheeledVehicleConstraintControl::Response& self) +void WheeledVehicleConstraintControl::Response::insert(Serializer& serializer) const { - insert(serializer, self.enable); + serializer.insert(enable); } -void extract(Serializer& serializer, WheeledVehicleConstraintControl::Response& self) +void WheeledVehicleConstraintControl::Response::extract(Serializer& serializer) { - extract(serializer, self.enable); + serializer.extract(enable); } @@ -4916,30 +4813,30 @@ TypedResult writeWheeledVehicleConstraintContro uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, enable); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(enable); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_VEHICLE_CONSTRAINT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_VEHICLE_CONSTRAINT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult readWheeledVehicleConstraintControl(C::mip_interface& device, uint8_t* enableOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_VEHICLE_CONSTRAINT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_VEHICLE_CONSTRAINT_CONTROL, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_VEHICLE_CONSTRAINT_CONTROL, buffer, (uint8_t)serializer.usedLength(), REPLY_VEHICLE_CONSTRAINT_CONTROL, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(enableOut); - extract(deserializer, *enableOut); + deserializer.extract(*enableOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -4951,60 +4848,60 @@ TypedResult saveWheeledVehicleConstraintControl uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_VEHICLE_CONSTRAINT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_VEHICLE_CONSTRAINT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadWheeledVehicleConstraintControl(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_VEHICLE_CONSTRAINT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_VEHICLE_CONSTRAINT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultWheeledVehicleConstraintControl(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_VEHICLE_CONSTRAINT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_VEHICLE_CONSTRAINT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const VerticalGyroConstraintControl& self) +void VerticalGyroConstraintControl::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.enable); + serializer.insert(enable); } } -void extract(Serializer& serializer, VerticalGyroConstraintControl& self) +void VerticalGyroConstraintControl::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.enable); + serializer.extract(enable); } } -void insert(Serializer& serializer, const VerticalGyroConstraintControl::Response& self) +void VerticalGyroConstraintControl::Response::insert(Serializer& serializer) const { - insert(serializer, self.enable); + serializer.insert(enable); } -void extract(Serializer& serializer, VerticalGyroConstraintControl::Response& self) +void VerticalGyroConstraintControl::Response::extract(Serializer& serializer) { - extract(serializer, self.enable); + serializer.extract(enable); } @@ -5013,30 +4910,30 @@ TypedResult writeVerticalGyroConstraintControl(C: uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, enable); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(enable); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GYRO_CONSTRAINT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GYRO_CONSTRAINT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult readVerticalGyroConstraintControl(C::mip_interface& device, uint8_t* enableOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_GYRO_CONSTRAINT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_GYRO_CONSTRAINT_CONTROL, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_GYRO_CONSTRAINT_CONTROL, buffer, (uint8_t)serializer.usedLength(), REPLY_GYRO_CONSTRAINT_CONTROL, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(enableOut); - extract(deserializer, *enableOut); + deserializer.extract(*enableOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -5048,68 +4945,68 @@ TypedResult saveVerticalGyroConstraintControl(C:: uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GYRO_CONSTRAINT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GYRO_CONSTRAINT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadVerticalGyroConstraintControl(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GYRO_CONSTRAINT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GYRO_CONSTRAINT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultVerticalGyroConstraintControl(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GYRO_CONSTRAINT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_GYRO_CONSTRAINT_CONTROL, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const GnssAntennaCalControl& self) +void GnssAntennaCalControl::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.enable); + serializer.insert(enable); - insert(serializer, self.max_offset); + serializer.insert(max_offset); } } -void extract(Serializer& serializer, GnssAntennaCalControl& self) +void GnssAntennaCalControl::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.enable); + serializer.extract(enable); - extract(serializer, self.max_offset); + serializer.extract(max_offset); } } -void insert(Serializer& serializer, const GnssAntennaCalControl::Response& self) +void GnssAntennaCalControl::Response::insert(Serializer& serializer) const { - insert(serializer, self.enable); + serializer.insert(enable); - insert(serializer, self.max_offset); + serializer.insert(max_offset); } -void extract(Serializer& serializer, GnssAntennaCalControl::Response& self) +void GnssAntennaCalControl::Response::extract(Serializer& serializer) { - extract(serializer, self.enable); + serializer.extract(enable); - extract(serializer, self.max_offset); + serializer.extract(max_offset); } @@ -5118,35 +5015,35 @@ TypedResult writeGnssAntennaCalControl(C::mip_interface& uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, enable); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(enable); - insert(serializer, maxOffset); + serializer.insert(maxOffset); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ANTENNA_CALIBRATION_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ANTENNA_CALIBRATION_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult readGnssAntennaCalControl(C::mip_interface& device, uint8_t* enableOut, float* maxOffsetOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_ANTENNA_CALIBRATION_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_ANTENNA_CALIBRATION_CONTROL, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_ANTENNA_CALIBRATION_CONTROL, buffer, (uint8_t)serializer.usedLength(), REPLY_ANTENNA_CALIBRATION_CONTROL, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(enableOut); - extract(deserializer, *enableOut); + deserializer.extract(*enableOut); assert(maxOffsetOut); - extract(deserializer, *maxOffsetOut); + deserializer.extract(*maxOffsetOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -5158,39 +5055,39 @@ TypedResult saveGnssAntennaCalControl(C::mip_interface& d uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ANTENNA_CALIBRATION_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ANTENNA_CALIBRATION_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadGnssAntennaCalControl(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ANTENNA_CALIBRATION_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ANTENNA_CALIBRATION_CONTROL, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultGnssAntennaCalControl(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ANTENNA_CALIBRATION_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ANTENNA_CALIBRATION_CONTROL, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const SetInitialHeading& self) +void SetInitialHeading::insert(Serializer& serializer) const { - insert(serializer, self.heading); + serializer.insert(heading); } -void extract(Serializer& serializer, SetInitialHeading& self) +void SetInitialHeading::extract(Serializer& serializer) { - extract(serializer, self.heading); + serializer.extract(heading); } @@ -5199,11 +5096,11 @@ TypedResult setInitialHeading(C::mip_interface& device, float uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, heading); + serializer.insert(heading); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SET_INITIAL_HEADING, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SET_INITIAL_HEADING, buffer, (uint8_t)serializer.usedLength()); } } // namespace commands_filter diff --git a/src/mip/definitions/commands_filter.hpp b/src/cpp/mip/definitions/commands_filter.hpp similarity index 76% rename from src/mip/definitions/commands_filter.hpp rename to src/cpp/mip/definitions/commands_filter.hpp index 3e4b5ce68..1104d1a52 100644 --- a/src/mip/definitions/commands_filter.hpp +++ b/src/cpp/mip/definitions/commands_filter.hpp @@ -1,16 +1,14 @@ #pragma once -#include "common.h" -#include "descriptors.h" -#include "../mip_result.h" +#include +#include +#include +#include #include #include -#include namespace mip { -class Serializer; - namespace C { struct mip_interface; } // namespace C @@ -18,9 +16,9 @@ struct mip_interface; namespace commands_filter { //////////////////////////////////////////////////////////////////////////////// -///@addtogroup MipCommands_cpp MIP Commands [CPP] +///@addtogroup MipCommands_cpp ///@{ -///@defgroup filter_commands_cpp Filter Commands [CPP] +///@defgroup filter_commands_cpp Filter Commands /// ///@{ @@ -181,7 +179,7 @@ enum class FilterAdaptiveMeasurement : uint8_t //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_reset (0x0D,0x01) Reset [CPP] +///@defgroup filter_reset_cpp (0x0D,0x01) Reset /// Resets the filter to the initialization state. /// /// If the auto-initialization feature is disabled, the initial attitude or heading must be set in @@ -191,36 +189,36 @@ enum class FilterAdaptiveMeasurement : uint8_t struct Reset { - + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_RESET_FILTER; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "Reset"; static constexpr const char* DOC_NAME = "Reset Navigation Filter"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(); } - auto as_tuple() + auto asTuple() { return std::make_tuple(); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + typedef void Response; }; -void insert(Serializer& serializer, const Reset& self); -void extract(Serializer& serializer, Reset& self); - TypedResult reset(C::mip_interface& device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_set_initial_attitude (0x0D,0x02) Set Initial Attitude [CPP] +///@defgroup filter_set_initial_attitude_cpp (0x0D,0x02) Set Initial Attitude /// Set the sensor initial attitude. /// /// This command can only be issued in the "Init" state and should be used with a good @@ -238,39 +236,41 @@ TypedResult reset(C::mip_interface& device); struct SetInitialAttitude { + /// Parameters float roll = 0; ///< [radians] float pitch = 0; ///< [radians] float heading = 0; ///< [radians] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_SET_INITIAL_ATTITUDE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "SetInitialAttitude"; static constexpr const char* DOC_NAME = "Set Initial Attitude"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(roll,pitch,heading); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(roll),std::ref(pitch),std::ref(heading)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + typedef void Response; }; -void insert(Serializer& serializer, const SetInitialAttitude& self); -void extract(Serializer& serializer, SetInitialAttitude& self); - TypedResult setInitialAttitude(C::mip_interface& device, float roll, float pitch, float heading); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_estimation_control (0x0D,0x14) Estimation Control [CPP] +///@defgroup filter_estimation_control_cpp (0x0D,0x14) Estimation Control /// Estimation Control Flags /// /// Controls which parameters are estimated by the Kalman Filter. @@ -289,6 +289,7 @@ struct EstimationControl { struct EnableFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -312,48 +313,40 @@ struct EstimationControl EnableFlags& operator&=(uint16_t val) { return *this = value & val; } bool gyroBias() const { return (value & GYRO_BIAS) > 0; } - void gyroBias(bool val) { if(val) value |= GYRO_BIAS; else value &= ~GYRO_BIAS; } + void gyroBias(bool val) { value &= ~GYRO_BIAS; if(val) value |= GYRO_BIAS; } bool accelBias() const { return (value & ACCEL_BIAS) > 0; } - void accelBias(bool val) { if(val) value |= ACCEL_BIAS; else value &= ~ACCEL_BIAS; } + void accelBias(bool val) { value &= ~ACCEL_BIAS; if(val) value |= ACCEL_BIAS; } bool gyroScaleFactor() const { return (value & GYRO_SCALE_FACTOR) > 0; } - void gyroScaleFactor(bool val) { if(val) value |= GYRO_SCALE_FACTOR; else value &= ~GYRO_SCALE_FACTOR; } + void gyroScaleFactor(bool val) { value &= ~GYRO_SCALE_FACTOR; if(val) value |= GYRO_SCALE_FACTOR; } bool accelScaleFactor() const { return (value & ACCEL_SCALE_FACTOR) > 0; } - void accelScaleFactor(bool val) { if(val) value |= ACCEL_SCALE_FACTOR; else value &= ~ACCEL_SCALE_FACTOR; } + void accelScaleFactor(bool val) { value &= ~ACCEL_SCALE_FACTOR; if(val) value |= ACCEL_SCALE_FACTOR; } bool antennaOffset() const { return (value & ANTENNA_OFFSET) > 0; } - void antennaOffset(bool val) { if(val) value |= ANTENNA_OFFSET; else value &= ~ANTENNA_OFFSET; } + void antennaOffset(bool val) { value &= ~ANTENNA_OFFSET; if(val) value |= ANTENNA_OFFSET; } bool autoMagHardIron() const { return (value & AUTO_MAG_HARD_IRON) > 0; } - void autoMagHardIron(bool val) { if(val) value |= AUTO_MAG_HARD_IRON; else value &= ~AUTO_MAG_HARD_IRON; } + void autoMagHardIron(bool val) { value &= ~AUTO_MAG_HARD_IRON; if(val) value |= AUTO_MAG_HARD_IRON; } bool autoMagSoftIron() const { return (value & AUTO_MAG_SOFT_IRON) > 0; } - void autoMagSoftIron(bool val) { if(val) value |= AUTO_MAG_SOFT_IRON; else value &= ~AUTO_MAG_SOFT_IRON; } - + void autoMagSoftIron(bool val) { value &= ~AUTO_MAG_SOFT_IRON; if(val) value |= AUTO_MAG_SOFT_IRON; } bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters FunctionSelector function = static_cast(0); EnableFlags enable; ///< See above + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_ESTIMATION_CONTROL_FLAGS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "EstimationControl"; static constexpr const char* DOC_NAME = "Estimation Control Flags"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8001; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(enable); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(enable)); } @@ -365,31 +358,39 @@ struct EstimationControl return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + EnableFlags enable; ///< See above + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_ESTIMATION_CONTROL_FLAGS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "EstimationControl::Response"; static constexpr const char* DOC_NAME = "Estimation Control Flags Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - EnableFlags enable; ///< See above - + auto asTuple() const + { + return std::make_tuple(enable); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(enable)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const EstimationControl& self); -void extract(Serializer& serializer, EstimationControl& self); - -void insert(Serializer& serializer, const EstimationControl::Response& self); -void extract(Serializer& serializer, EstimationControl::Response& self); - TypedResult writeEstimationControl(C::mip_interface& device, EstimationControl::EnableFlags enable); TypedResult readEstimationControl(C::mip_interface& device, EstimationControl::EnableFlags* enableOut); TypedResult saveEstimationControl(C::mip_interface& device); @@ -399,7 +400,7 @@ TypedResult defaultEstimationControl(C::mip_interface& device ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_external_gnss_update (0x0D,0x16) External Gnss Update [CPP] +///@defgroup filter_external_gnss_update_cpp (0x0D,0x16) External Gnss Update /// Provide a filter measurement from an external GNSS /// /// The GNSS source control must be set to "external" for this command to succeed, otherwise it will be NACK'd. @@ -410,6 +411,7 @@ TypedResult defaultEstimationControl(C::mip_interface& device struct ExternalGnssUpdate { + /// Parameters double gps_time = 0; ///< [seconds] uint16_t gps_week = 0; ///< [GPS week number, not modulus 1024] double latitude = 0; ///< [degrees] @@ -419,35 +421,36 @@ struct ExternalGnssUpdate Vector3f pos_uncertainty; ///< NED Frame, 1-sigma [meters] Vector3f vel_uncertainty; ///< NED Frame, 1-sigma [meters/second] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_EXTERNAL_GNSS_UPDATE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ExternalGnssUpdate"; static constexpr const char* DOC_NAME = "External GNSS Update"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(gps_time,gps_week,latitude,longitude,height,velocity,pos_uncertainty,vel_uncertainty); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(gps_time),std::ref(gps_week),std::ref(latitude),std::ref(longitude),std::ref(height),std::ref(velocity),std::ref(pos_uncertainty),std::ref(vel_uncertainty)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + typedef void Response; }; -void insert(Serializer& serializer, const ExternalGnssUpdate& self); -void extract(Serializer& serializer, ExternalGnssUpdate& self); - TypedResult externalGnssUpdate(C::mip_interface& device, double gpsTime, uint16_t gpsWeek, double latitude, double longitude, double height, const float* velocity, const float* posUncertainty, const float* velUncertainty); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_external_heading_update (0x0D,0x17) External Heading Update [CPP] +///@defgroup filter_external_heading_update_cpp (0x0D,0x17) External Heading Update /// Provide a filter measurement from an external heading source /// /// The heading must be the sensor frame with respect to the NED frame. @@ -466,39 +469,41 @@ TypedResult externalGnssUpdate(C::mip_interface& device, dou struct ExternalHeadingUpdate { + /// Parameters float heading = 0; ///< Bounded by +-PI [radians] float heading_uncertainty = 0; ///< 1-sigma [radians] uint8_t type = 0; ///< 1 - True, 2 - Magnetic + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_EXTERNAL_HEADING_UPDATE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ExternalHeadingUpdate"; static constexpr const char* DOC_NAME = "External Heading Update"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(heading,heading_uncertainty,type); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(heading),std::ref(heading_uncertainty),std::ref(type)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + typedef void Response; }; -void insert(Serializer& serializer, const ExternalHeadingUpdate& self); -void extract(Serializer& serializer, ExternalHeadingUpdate& self); - TypedResult externalHeadingUpdate(C::mip_interface& device, float heading, float headingUncertainty, uint8_t type); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_external_heading_update_with_time (0x0D,0x1F) External Heading Update With Time [CPP] +///@defgroup filter_external_heading_update_with_time_cpp (0x0D,0x1F) External Heading Update With Time /// Provide a filter measurement from an external heading source at a specific GPS time /// /// This is more accurate than the External Heading Update (0x0D, 0x17) and should be used in applications @@ -521,41 +526,43 @@ TypedResult externalHeadingUpdate(C::mip_interface& devic struct ExternalHeadingUpdateWithTime { + /// Parameters double gps_time = 0; ///< [seconds] uint16_t gps_week = 0; ///< [GPS week number, not modulus 1024] float heading = 0; ///< Relative to true north, bounded by +-PI [radians] float heading_uncertainty = 0; ///< 1-sigma [radians] uint8_t type = 0; ///< 1 - True, 2 - Magnetic + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_EXTERNAL_HEADING_UPDATE_WITH_TIME; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ExternalHeadingUpdateWithTime"; static constexpr const char* DOC_NAME = "External Heading Update With Time"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(gps_time,gps_week,heading,heading_uncertainty,type); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(gps_time),std::ref(gps_week),std::ref(heading),std::ref(heading_uncertainty),std::ref(type)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + typedef void Response; }; -void insert(Serializer& serializer, const ExternalHeadingUpdateWithTime& self); -void extract(Serializer& serializer, ExternalHeadingUpdateWithTime& self); - TypedResult externalHeadingUpdateWithTime(C::mip_interface& device, double gpsTime, uint16_t gpsWeek, float heading, float headingUncertainty, uint8_t type); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_tare_orientation (0x0D,0x21) Tare Orientation [CPP] +///@defgroup filter_tare_orientation_cpp (0x0D,0x21) Tare Orientation /// Tare the device orientation. /// /// This function uses the current device orientation relative to the NED frame as the current sensor to vehicle transformation. @@ -568,6 +575,7 @@ struct TareOrientation { struct MipTareAxes : Bitfield { + typedef uint8_t Type; enum _enumType : uint8_t { NONE = 0x0, @@ -587,40 +595,32 @@ struct TareOrientation MipTareAxes& operator&=(uint8_t val) { return *this = value & val; } bool roll() const { return (value & ROLL) > 0; } - void roll(bool val) { if(val) value |= ROLL; else value &= ~ROLL; } + void roll(bool val) { value &= ~ROLL; if(val) value |= ROLL; } bool pitch() const { return (value & PITCH) > 0; } - void pitch(bool val) { if(val) value |= PITCH; else value &= ~PITCH; } + void pitch(bool val) { value &= ~PITCH; if(val) value |= PITCH; } bool yaw() const { return (value & YAW) > 0; } - void yaw(bool val) { if(val) value |= YAW; else value &= ~YAW; } - + void yaw(bool val) { value &= ~YAW; if(val) value |= YAW; } bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters FunctionSelector function = static_cast(0); MipTareAxes axes; ///< Axes to tare + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_TARE_ORIENTATION; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "TareOrientation"; static constexpr const char* DOC_NAME = "Tare Sensor Orientation"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8001; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(axes); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(axes)); } @@ -632,31 +632,39 @@ struct TareOrientation return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + MipTareAxes axes; ///< Axes to tare + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_TARE_ORIENTATION; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "TareOrientation::Response"; static constexpr const char* DOC_NAME = "Tare Sensor Orientation Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - MipTareAxes axes; ///< Axes to tare - + auto asTuple() const + { + return std::make_tuple(axes); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(axes)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const TareOrientation& self); -void extract(Serializer& serializer, TareOrientation& self); - -void insert(Serializer& serializer, const TareOrientation::Response& self); -void extract(Serializer& serializer, TareOrientation::Response& self); - TypedResult writeTareOrientation(C::mip_interface& device, TareOrientation::MipTareAxes axes); TypedResult readTareOrientation(C::mip_interface& device, TareOrientation::MipTareAxes* axesOut); TypedResult saveTareOrientation(C::mip_interface& device); @@ -666,7 +674,7 @@ TypedResult defaultTareOrientation(C::mip_interface& device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_vehicle_dynamics_mode (0x0D,0x10) Vehicle Dynamics Mode [CPP] +///@defgroup filter_vehicle_dynamics_mode_cpp (0x0D,0x10) Vehicle Dynamics Mode /// Controls the vehicle dynamics mode. /// ///@{ @@ -681,30 +689,24 @@ struct VehicleDynamicsMode AIRBORNE_HIGH_G = 4, ///< }; + /// Parameters FunctionSelector function = static_cast(0); DynamicsMode mode = static_cast(0); + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_VEHICLE_DYNAMICS_MODE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "VehicleDynamicsMode"; static constexpr const char* DOC_NAME = "Vehicle Dynamics Mode"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8001; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(mode); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(mode)); } @@ -716,31 +718,39 @@ struct VehicleDynamicsMode return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + DynamicsMode mode = static_cast(0); + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_VEHICLE_DYNAMICS_MODE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "VehicleDynamicsMode::Response"; static constexpr const char* DOC_NAME = "Vehicle Dynamics Mode Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - DynamicsMode mode = static_cast(0); - + auto asTuple() const + { + return std::make_tuple(mode); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(mode)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const VehicleDynamicsMode& self); -void extract(Serializer& serializer, VehicleDynamicsMode& self); - -void insert(Serializer& serializer, const VehicleDynamicsMode::Response& self); -void extract(Serializer& serializer, VehicleDynamicsMode::Response& self); - TypedResult writeVehicleDynamicsMode(C::mip_interface& device, VehicleDynamicsMode::DynamicsMode mode); TypedResult readVehicleDynamicsMode(C::mip_interface& device, VehicleDynamicsMode::DynamicsMode* modeOut); TypedResult saveVehicleDynamicsMode(C::mip_interface& device); @@ -750,7 +760,7 @@ TypedResult defaultVehicleDynamicsMode(C::mip_interface& de ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_sensor_to_vehicle_rotation_euler (0x0D,0x11) Sensor To Vehicle Rotation Euler [CPP] +///@defgroup filter_sensor_to_vehicle_rotation_euler_cpp (0x0D,0x11) Sensor To Vehicle Rotation Euler /// Set the sensor to vehicle frame rotation using Yaw, Pitch, Roll Euler angles. /// /// Note: This is the rotation, the inverse of the transformation. @@ -779,32 +789,26 @@ TypedResult defaultVehicleDynamicsMode(C::mip_interface& de struct SensorToVehicleRotationEuler { + /// Parameters FunctionSelector function = static_cast(0); float roll = 0; ///< [radians] float pitch = 0; ///< [radians] float yaw = 0; ///< [radians] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_SENSOR2VEHICLE_ROTATION_EULER; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "SensorToVehicleRotationEuler"; static constexpr const char* DOC_NAME = "Sensor to Vehicle Frame Rotation Euler"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8007; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(roll,pitch,yaw); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(roll),std::ref(pitch),std::ref(yaw)); } @@ -816,33 +820,41 @@ struct SensorToVehicleRotationEuler return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + float roll = 0; ///< [radians] + float pitch = 0; ///< [radians] + float yaw = 0; ///< [radians] + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_SENSOR2VEHICLE_ROTATION_EULER; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "SensorToVehicleRotationEuler::Response"; static constexpr const char* DOC_NAME = "Sensor to Vehicle Frame Rotation Euler Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - float roll = 0; ///< [radians] - float pitch = 0; ///< [radians] - float yaw = 0; ///< [radians] - + auto asTuple() const + { + return std::make_tuple(roll,pitch,yaw); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(roll),std::ref(pitch),std::ref(yaw)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const SensorToVehicleRotationEuler& self); -void extract(Serializer& serializer, SensorToVehicleRotationEuler& self); - -void insert(Serializer& serializer, const SensorToVehicleRotationEuler::Response& self); -void extract(Serializer& serializer, SensorToVehicleRotationEuler::Response& self); - TypedResult writeSensorToVehicleRotationEuler(C::mip_interface& device, float roll, float pitch, float yaw); TypedResult readSensorToVehicleRotationEuler(C::mip_interface& device, float* rollOut, float* pitchOut, float* yawOut); TypedResult saveSensorToVehicleRotationEuler(C::mip_interface& device); @@ -852,7 +864,7 @@ TypedResult defaultSensorToVehicleRotationEuler(C: ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_sensor_to_vehicle_rotation_dcm (0x0D,0x4E) Sensor To Vehicle Rotation Dcm [CPP] +///@defgroup filter_sensor_to_vehicle_rotation_dcm_cpp (0x0D,0x4E) Sensor To Vehicle Rotation Dcm /// Set the sensor to vehicle frame rotation using a row-major direction cosine matrix. /// /// Note: This is the rotation, the inverse of the transformation. @@ -864,7 +876,7 @@ TypedResult defaultSensorToVehicleRotationEuler(C: ///
/// Matrix element order:

/// -/// EQSTART T_{SEN}^{VEH} = \begin{bmatrix} 0 & 1 & 2\\ 3 & 4 & 5\\ 6 & 7 & 8 \end{bmatrix} EQEND +/// EQSTART T_{SEN}^{VEH} = \\begin{bmatrix} 0 & 1 & 2\\\\ 3 & 4 & 5\\\\ 6 & 7 & 8 \\end{bmatrix} EQEND /// ///

/// This rotation affects the following output quantities:

@@ -887,30 +899,24 @@ TypedResult defaultSensorToVehicleRotationEuler(C: struct SensorToVehicleRotationDcm { + /// Parameters FunctionSelector function = static_cast(0); Matrix3f dcm; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_SENSOR2VEHICLE_ROTATION_DCM; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "SensorToVehicleRotationDcm"; static constexpr const char* DOC_NAME = "Sensor to Vehicle Frame Rotation DCM"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8001; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(dcm); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(dcm)); } @@ -922,31 +928,39 @@ struct SensorToVehicleRotationDcm return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + Matrix3f dcm; + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_SENSOR2VEHICLE_ROTATION_DCM; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "SensorToVehicleRotationDcm::Response"; static constexpr const char* DOC_NAME = "Sensor to Vehicle Frame Rotation DCM Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - Matrix3f dcm; - + auto asTuple() const + { + return std::make_tuple(dcm); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(dcm)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const SensorToVehicleRotationDcm& self); -void extract(Serializer& serializer, SensorToVehicleRotationDcm& self); - -void insert(Serializer& serializer, const SensorToVehicleRotationDcm::Response& self); -void extract(Serializer& serializer, SensorToVehicleRotationDcm::Response& self); - TypedResult writeSensorToVehicleRotationDcm(C::mip_interface& device, const float* dcm); TypedResult readSensorToVehicleRotationDcm(C::mip_interface& device, float* dcmOut); TypedResult saveSensorToVehicleRotationDcm(C::mip_interface& device); @@ -956,7 +970,7 @@ TypedResult defaultSensorToVehicleRotationDcm(C::mip ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_sensor_to_vehicle_rotation_quaternion (0x0D,0x4F) Sensor To Vehicle Rotation Quaternion [CPP] +///@defgroup filter_sensor_to_vehicle_rotation_quaternion_cpp (0x0D,0x4F) Sensor To Vehicle Rotation Quaternion /// Set the sensor to vehicle frame rotation using a quaternion. /// /// Note: This is the rotation, the inverse of the transformation. @@ -968,7 +982,7 @@ TypedResult defaultSensorToVehicleRotationDcm(C::mip ///
/// Quaternion element definition:

///
-/// EQSTART Q_{SEN}^{VEH} = \begin{bmatrix} q_{0} & q_{1}*i & q_{2}*j & q_{3}*k \end{bmatrix} EQEND +/// EQSTART Q_{SEN}^{VEH} = \\begin{bmatrix} q_{0} & q_{1}*i & q_{2}*j & q_{3}*k \\end{bmatrix} EQEND ///

/// This rotation affects the following output quantities:

/// IMU:
@@ -990,30 +1004,24 @@ TypedResult defaultSensorToVehicleRotationDcm(C::mip struct SensorToVehicleRotationQuaternion { + /// Parameters FunctionSelector function = static_cast(0); Quatf quat; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_SENSOR2VEHICLE_ROTATION_QUATERNION; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "SensorToVehicleRotationQuaternion"; static constexpr const char* DOC_NAME = "Sensor to Vehicle Frame Rotation Quaternion"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8001; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(quat); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(quat)); } @@ -1025,31 +1033,39 @@ struct SensorToVehicleRotationQuaternion return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + Quatf quat; + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_SENSOR2VEHICLE_ROTATION_QUATERNION; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "SensorToVehicleRotationQuaternion::Response"; static constexpr const char* DOC_NAME = "Sensor to Vehicle Frame Rotation Quaternion Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - Quatf quat; - + auto asTuple() const + { + return std::make_tuple(quat); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(quat)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const SensorToVehicleRotationQuaternion& self); -void extract(Serializer& serializer, SensorToVehicleRotationQuaternion& self); - -void insert(Serializer& serializer, const SensorToVehicleRotationQuaternion::Response& self); -void extract(Serializer& serializer, SensorToVehicleRotationQuaternion::Response& self); - TypedResult writeSensorToVehicleRotationQuaternion(C::mip_interface& device, const float* quat); TypedResult readSensorToVehicleRotationQuaternion(C::mip_interface& device, float* quatOut); TypedResult saveSensorToVehicleRotationQuaternion(C::mip_interface& device); @@ -1059,7 +1075,7 @@ TypedResult defaultSensorToVehicleRotationQua ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_sensor_to_vehicle_offset (0x0D,0x12) Sensor To Vehicle Offset [CPP] +///@defgroup filter_sensor_to_vehicle_offset_cpp (0x0D,0x12) Sensor To Vehicle Offset /// Set the sensor to vehicle frame offset, expressed in the sensor frame. /// /// This is a simple offset, not a lever arm. It does not compensate for inertial effects experienced from being offset from the center of gravity/rotation of the vehicle. @@ -1074,30 +1090,24 @@ TypedResult defaultSensorToVehicleRotationQua struct SensorToVehicleOffset { + /// Parameters FunctionSelector function = static_cast(0); Vector3f offset; ///< [meters] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_SENSOR2VEHICLE_OFFSET; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "SensorToVehicleOffset"; static constexpr const char* DOC_NAME = "Sensor to Vehicle Frame Offset"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8001; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(offset); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(offset)); } @@ -1109,31 +1119,39 @@ struct SensorToVehicleOffset return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + Vector3f offset; ///< [meters] + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_SENSOR2VEHICLE_OFFSET; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "SensorToVehicleOffset::Response"; static constexpr const char* DOC_NAME = "Sensor to Vehicle Frame Offset Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - Vector3f offset; ///< [meters] - + auto asTuple() const + { + return std::make_tuple(offset); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(offset)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const SensorToVehicleOffset& self); -void extract(Serializer& serializer, SensorToVehicleOffset& self); - -void insert(Serializer& serializer, const SensorToVehicleOffset::Response& self); -void extract(Serializer& serializer, SensorToVehicleOffset::Response& self); - TypedResult writeSensorToVehicleOffset(C::mip_interface& device, const float* offset); TypedResult readSensorToVehicleOffset(C::mip_interface& device, float* offsetOut); TypedResult saveSensorToVehicleOffset(C::mip_interface& device); @@ -1143,10 +1161,14 @@ TypedResult defaultSensorToVehicleOffset(C::mip_interface ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_antenna_offset (0x0D,0x13) Antenna Offset [CPP] -/// Set the sensor to GNSS antenna offset. +///@defgroup filter_antenna_offset_cpp (0x0D,0x13) Antenna Offset +/// Configure the GNSS antenna offset. +/// +/// For 5-series products, this is expressed in the sensor frame, from the sensor origin to the GNSS antenna RF center. +/// +/// For 7-series products, this is expressed in the vehicle frame, from the sensor origin to the GNSS antenna RF center. /// -/// This is expressed in the sensor frame, from the sensor origin to the GNSS antenna RF center. +/// This command should also be used for CV7 / GV7-INS NMEA Input over GPIO. /// /// The magnitude of the offset vector is limited to 10 meters /// @@ -1155,30 +1177,24 @@ TypedResult defaultSensorToVehicleOffset(C::mip_interface struct AntennaOffset { + /// Parameters FunctionSelector function = static_cast(0); Vector3f offset; ///< [meters] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_ANTENNA_OFFSET; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "AntennaOffset"; static constexpr const char* DOC_NAME = "GNSS Antenna Offset Control"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8001; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(offset); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(offset)); } @@ -1190,31 +1206,39 @@ struct AntennaOffset return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + Vector3f offset; ///< [meters] + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_ANTENNA_OFFSET; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "AntennaOffset::Response"; static constexpr const char* DOC_NAME = "GNSS Antenna Offset Control Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - Vector3f offset; ///< [meters] - + auto asTuple() const + { + return std::make_tuple(offset); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(offset)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const AntennaOffset& self); -void extract(Serializer& serializer, AntennaOffset& self); - -void insert(Serializer& serializer, const AntennaOffset::Response& self); -void extract(Serializer& serializer, AntennaOffset::Response& self); - TypedResult writeAntennaOffset(C::mip_interface& device, const float* offset); TypedResult readAntennaOffset(C::mip_interface& device, float* offsetOut); TypedResult saveAntennaOffset(C::mip_interface& device); @@ -1224,7 +1248,7 @@ TypedResult defaultAntennaOffset(C::mip_interface& device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_gnss_source (0x0D,0x15) Gnss Source [CPP] +///@defgroup filter_gnss_source_cpp (0x0D,0x15) Gnss Source /// Control the source of GNSS information used to update the Kalman Filter. /// /// Changing the GNSS source while the sensor is in the "running" state may temporarily place @@ -1243,30 +1267,24 @@ struct GnssSource INT_2 = 4, ///< Internal GNSS Receiver 2 only }; + /// Parameters FunctionSelector function = static_cast(0); Source source = static_cast(0); + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_GNSS_SOURCE_CONTROL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GnssSource"; static constexpr const char* DOC_NAME = "GNSS Aiding Source Control"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8001; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(source); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(source)); } @@ -1278,31 +1296,39 @@ struct GnssSource return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + Source source = static_cast(0); + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_GNSS_SOURCE_CONTROL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GnssSource::Response"; static constexpr const char* DOC_NAME = "GNSS Aiding Source Control Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - Source source = static_cast(0); - + auto asTuple() const + { + return std::make_tuple(source); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(source)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const GnssSource& self); -void extract(Serializer& serializer, GnssSource& self); - -void insert(Serializer& serializer, const GnssSource::Response& self); -void extract(Serializer& serializer, GnssSource::Response& self); - TypedResult writeGnssSource(C::mip_interface& device, GnssSource::Source source); TypedResult readGnssSource(C::mip_interface& device, GnssSource::Source* sourceOut); TypedResult saveGnssSource(C::mip_interface& device); @@ -1312,7 +1338,7 @@ TypedResult defaultGnssSource(C::mip_interface& device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_heading_source (0x0D,0x18) Heading Source [CPP] +///@defgroup filter_heading_source_cpp (0x0D,0x18) Heading Source /// Control the source of heading information used to update the Kalman Filter. /// /// 1. To use internal GNSS velocity vector for heading updates, the target application @@ -1342,30 +1368,24 @@ struct HeadingSource GNSS_VEL_AND_MAG_AND_EXTERNAL = 7, ///< }; + /// Parameters FunctionSelector function = static_cast(0); Source source = static_cast(0); + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_HEADING_UPDATE_CONTROL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "HeadingSource"; static constexpr const char* DOC_NAME = "Heading Aiding Source Control"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8001; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(source); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(source)); } @@ -1377,31 +1397,39 @@ struct HeadingSource return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + Source source = static_cast(0); + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_HEADING_UPDATE_CONTROL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "HeadingSource::Response"; static constexpr const char* DOC_NAME = "Heading Aiding Source Control Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - Source source = static_cast(0); - + auto asTuple() const + { + return std::make_tuple(source); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(source)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const HeadingSource& self); -void extract(Serializer& serializer, HeadingSource& self); - -void insert(Serializer& serializer, const HeadingSource::Response& self); -void extract(Serializer& serializer, HeadingSource::Response& self); - TypedResult writeHeadingSource(C::mip_interface& device, HeadingSource::Source source); TypedResult readHeadingSource(C::mip_interface& device, HeadingSource::Source* sourceOut); TypedResult saveHeadingSource(C::mip_interface& device); @@ -1411,7 +1439,7 @@ TypedResult defaultHeadingSource(C::mip_interface& device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_auto_init_control (0x0D,0x19) Auto Init Control [CPP] +///@defgroup filter_auto_init_control_cpp (0x0D,0x19) Auto Init Control /// Filter Auto-initialization Control /// /// Enable/Disable automatic initialization upon device startup. @@ -1426,30 +1454,24 @@ TypedResult defaultHeadingSource(C::mip_interface& device); struct AutoInitControl { + /// Parameters FunctionSelector function = static_cast(0); uint8_t enable = 0; ///< See above + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_AUTOINIT_CONTROL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "AutoInitControl"; static constexpr const char* DOC_NAME = "Auto-initialization Control"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8001; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(enable); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(enable)); } @@ -1461,31 +1483,39 @@ struct AutoInitControl return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint8_t enable = 0; ///< See above + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_AUTOINIT_CONTROL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "AutoInitControl::Response"; static constexpr const char* DOC_NAME = "Auto-initialization Control Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - uint8_t enable = 0; ///< See above - + auto asTuple() const + { + return std::make_tuple(enable); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(enable)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const AutoInitControl& self); -void extract(Serializer& serializer, AutoInitControl& self); - -void insert(Serializer& serializer, const AutoInitControl::Response& self); -void extract(Serializer& serializer, AutoInitControl::Response& self); - TypedResult writeAutoInitControl(C::mip_interface& device, uint8_t enable); TypedResult readAutoInitControl(C::mip_interface& device, uint8_t* enableOut); TypedResult saveAutoInitControl(C::mip_interface& device); @@ -1495,7 +1525,7 @@ TypedResult defaultAutoInitControl(C::mip_interface& device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_accel_noise (0x0D,0x1A) Accel Noise [CPP] +///@defgroup filter_accel_noise_cpp (0x0D,0x1A) Accel Noise /// Accelerometer Noise Standard Deviation /// /// Each of the noise values must be greater than 0.0. @@ -1508,30 +1538,24 @@ TypedResult defaultAutoInitControl(C::mip_interface& device); struct AccelNoise { + /// Parameters FunctionSelector function = static_cast(0); Vector3f noise; ///< Accel Noise 1-sigma [meters/second^2] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_ACCEL_NOISE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "AccelNoise"; static constexpr const char* DOC_NAME = "Accelerometer Noise Standard Deviation"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8001; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(noise); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(noise)); } @@ -1543,31 +1567,39 @@ struct AccelNoise return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + Vector3f noise; ///< Accel Noise 1-sigma [meters/second^2] + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_ACCEL_NOISE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "AccelNoise::Response"; static constexpr const char* DOC_NAME = "Accelerometer Noise Standard Deviation Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - Vector3f noise; ///< Accel Noise 1-sigma [meters/second^2] - + auto asTuple() const + { + return std::make_tuple(noise); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(noise)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const AccelNoise& self); -void extract(Serializer& serializer, AccelNoise& self); - -void insert(Serializer& serializer, const AccelNoise::Response& self); -void extract(Serializer& serializer, AccelNoise::Response& self); - TypedResult writeAccelNoise(C::mip_interface& device, const float* noise); TypedResult readAccelNoise(C::mip_interface& device, float* noiseOut); TypedResult saveAccelNoise(C::mip_interface& device); @@ -1577,7 +1609,7 @@ TypedResult defaultAccelNoise(C::mip_interface& device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_gyro_noise (0x0D,0x1B) Gyro Noise [CPP] +///@defgroup filter_gyro_noise_cpp (0x0D,0x1B) Gyro Noise /// Gyroscope Noise Standard Deviation /// /// Each of the noise values must be greater than 0.0 @@ -1590,30 +1622,24 @@ TypedResult defaultAccelNoise(C::mip_interface& device); struct GyroNoise { + /// Parameters FunctionSelector function = static_cast(0); Vector3f noise; ///< Gyro Noise 1-sigma [rad/second] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_GYRO_NOISE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GyroNoise"; static constexpr const char* DOC_NAME = "Gyroscope Noise Standard Deviation"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8001; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(noise); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(noise)); } @@ -1625,31 +1651,39 @@ struct GyroNoise return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + Vector3f noise; ///< Gyro Noise 1-sigma [rad/second] + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_GYRO_NOISE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GyroNoise::Response"; static constexpr const char* DOC_NAME = "Gyroscope Noise Standard Deviation Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - Vector3f noise; ///< Gyro Noise 1-sigma [rad/second] - + auto asTuple() const + { + return std::make_tuple(noise); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(noise)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const GyroNoise& self); -void extract(Serializer& serializer, GyroNoise& self); - -void insert(Serializer& serializer, const GyroNoise::Response& self); -void extract(Serializer& serializer, GyroNoise::Response& self); - TypedResult writeGyroNoise(C::mip_interface& device, const float* noise); TypedResult readGyroNoise(C::mip_interface& device, float* noiseOut); TypedResult saveGyroNoise(C::mip_interface& device); @@ -1659,7 +1693,7 @@ TypedResult defaultGyroNoise(C::mip_interface& device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_accel_bias_model (0x0D,0x1C) Accel Bias Model [CPP] +///@defgroup filter_accel_bias_model_cpp (0x0D,0x1C) Accel Bias Model /// Accelerometer Bias Model Parameters /// /// Noise values must be greater than 0.0 @@ -1669,31 +1703,25 @@ TypedResult defaultGyroNoise(C::mip_interface& device); struct AccelBiasModel { + /// Parameters FunctionSelector function = static_cast(0); Vector3f beta; ///< Accel Bias Beta [1/second] Vector3f noise; ///< Accel Noise 1-sigma [meters/second^2] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_ACCEL_BIAS_MODEL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "AccelBiasModel"; static constexpr const char* DOC_NAME = "Accelerometer Bias Model Parameters"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8003; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(beta,noise); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(beta),std::ref(noise)); } @@ -1705,32 +1733,40 @@ struct AccelBiasModel return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + Vector3f beta; ///< Accel Bias Beta [1/second] + Vector3f noise; ///< Accel Noise 1-sigma [meters/second^2] + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_ACCEL_BIAS_MODEL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "AccelBiasModel::Response"; static constexpr const char* DOC_NAME = "Accelerometer Bias Model Parameters Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - Vector3f beta; ///< Accel Bias Beta [1/second] - Vector3f noise; ///< Accel Noise 1-sigma [meters/second^2] - + auto asTuple() const + { + return std::make_tuple(beta,noise); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(beta),std::ref(noise)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const AccelBiasModel& self); -void extract(Serializer& serializer, AccelBiasModel& self); - -void insert(Serializer& serializer, const AccelBiasModel::Response& self); -void extract(Serializer& serializer, AccelBiasModel::Response& self); - TypedResult writeAccelBiasModel(C::mip_interface& device, const float* beta, const float* noise); TypedResult readAccelBiasModel(C::mip_interface& device, float* betaOut, float* noiseOut); TypedResult saveAccelBiasModel(C::mip_interface& device); @@ -1740,7 +1776,7 @@ TypedResult defaultAccelBiasModel(C::mip_interface& device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_gyro_bias_model (0x0D,0x1D) Gyro Bias Model [CPP] +///@defgroup filter_gyro_bias_model_cpp (0x0D,0x1D) Gyro Bias Model /// Gyroscope Bias Model Parameters /// /// Noise values must be greater than 0.0 @@ -1750,31 +1786,25 @@ TypedResult defaultAccelBiasModel(C::mip_interface& device); struct GyroBiasModel { + /// Parameters FunctionSelector function = static_cast(0); Vector3f beta; ///< Gyro Bias Beta [1/second] Vector3f noise; ///< Gyro Noise 1-sigma [rad/second] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_GYRO_BIAS_MODEL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GyroBiasModel"; static constexpr const char* DOC_NAME = "Gyroscope Bias Model Parameters"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8003; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(beta,noise); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(beta),std::ref(noise)); } @@ -1786,32 +1816,40 @@ struct GyroBiasModel return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + Vector3f beta; ///< Gyro Bias Beta [1/second] + Vector3f noise; ///< Gyro Noise 1-sigma [rad/second] + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_GYRO_BIAS_MODEL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GyroBiasModel::Response"; static constexpr const char* DOC_NAME = "Gyroscope Bias Model Parameters Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - Vector3f beta; ///< Gyro Bias Beta [1/second] - Vector3f noise; ///< Gyro Noise 1-sigma [rad/second] - + auto asTuple() const + { + return std::make_tuple(beta,noise); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(beta),std::ref(noise)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const GyroBiasModel& self); -void extract(Serializer& serializer, GyroBiasModel& self); - -void insert(Serializer& serializer, const GyroBiasModel::Response& self); -void extract(Serializer& serializer, GyroBiasModel::Response& self); - TypedResult writeGyroBiasModel(C::mip_interface& device, const float* beta, const float* noise); TypedResult readGyroBiasModel(C::mip_interface& device, float* betaOut, float* noiseOut); TypedResult saveGyroBiasModel(C::mip_interface& device); @@ -1821,7 +1859,7 @@ TypedResult defaultGyroBiasModel(C::mip_interface& device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_altitude_aiding (0x0D,0x47) Altitude Aiding [CPP] +///@defgroup filter_altitude_aiding_cpp (0x0D,0x47) Altitude Aiding /// Select altitude input for absolute altitude and/or vertical velocity. The primary altitude reading is always GNSS. /// Aiding inputs are used to improve GNSS altitude readings when GNSS is available and to backup GNSS during outages. /// @@ -1838,30 +1876,24 @@ struct AltitudeAiding PRESURE = 1, ///< Enable pressure sensor aiding }; + /// Parameters FunctionSelector function = static_cast(0); AidingSelector selector = static_cast(0); ///< See above + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_ALTITUDE_AIDING_CONTROL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "AltitudeAiding"; static constexpr const char* DOC_NAME = "Altitude Aiding Control"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8001; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(selector); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(selector)); } @@ -1873,31 +1905,39 @@ struct AltitudeAiding return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + AidingSelector selector = static_cast(0); ///< See above + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_ALTITUDE_AIDING_CONTROL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "AltitudeAiding::Response"; static constexpr const char* DOC_NAME = "Altitude Aiding Control Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - AidingSelector selector = static_cast(0); ///< See above - + auto asTuple() const + { + return std::make_tuple(selector); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(selector)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const AltitudeAiding& self); -void extract(Serializer& serializer, AltitudeAiding& self); - -void insert(Serializer& serializer, const AltitudeAiding::Response& self); -void extract(Serializer& serializer, AltitudeAiding::Response& self); - TypedResult writeAltitudeAiding(C::mip_interface& device, AltitudeAiding::AidingSelector selector); TypedResult readAltitudeAiding(C::mip_interface& device, AltitudeAiding::AidingSelector* selectorOut); TypedResult saveAltitudeAiding(C::mip_interface& device); @@ -1907,7 +1947,7 @@ TypedResult defaultAltitudeAiding(C::mip_interface& device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_pitch_roll_aiding (0x0D,0x4B) Pitch Roll Aiding [CPP] +///@defgroup filter_pitch_roll_aiding_cpp (0x0D,0x4B) Pitch Roll Aiding /// Select pitch/roll aiding input. Pitch/roll reading is always derived from GNSS corrected inertial solution. /// Aiding inputs are used to improve that solution during periods of low dynamics and GNSS outages. /// @@ -1921,30 +1961,24 @@ struct PitchRollAiding GRAVITY_VEC = 1, ///< Enable gravity vector aiding }; + /// Parameters FunctionSelector function = static_cast(0); AidingSource source = static_cast(0); ///< Controls the aiding source + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_SECONDARY_PITCH_ROLL_AIDING_CONTROL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "PitchRollAiding"; static constexpr const char* DOC_NAME = "Pitch/Roll Aiding Control"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8001; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(source); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(source)); } @@ -1956,31 +1990,39 @@ struct PitchRollAiding return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + AidingSource source = static_cast(0); ///< Controls the aiding source + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_SECONDARY_PITCH_ROLL_AIDING_CONTROL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "PitchRollAiding::Response"; static constexpr const char* DOC_NAME = "Pitch/Roll Aiding Control Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - AidingSource source = static_cast(0); ///< Controls the aiding source - + auto asTuple() const + { + return std::make_tuple(source); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(source)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const PitchRollAiding& self); -void extract(Serializer& serializer, PitchRollAiding& self); - -void insert(Serializer& serializer, const PitchRollAiding::Response& self); -void extract(Serializer& serializer, PitchRollAiding::Response& self); - TypedResult writePitchRollAiding(C::mip_interface& device, PitchRollAiding::AidingSource source); TypedResult readPitchRollAiding(C::mip_interface& device, PitchRollAiding::AidingSource* sourceOut); TypedResult savePitchRollAiding(C::mip_interface& device); @@ -1990,7 +2032,7 @@ TypedResult defaultPitchRollAiding(C::mip_interface& device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_auto_zupt (0x0D,0x1E) Auto Zupt [CPP] +///@defgroup filter_auto_zupt_cpp (0x0D,0x1E) Auto Zupt /// The ZUPT is triggered when the scalar magnitude of the GNSS reported velocity vector is equal-to or less than the threshold value. /// The device will NACK threshold values that are less than zero (i.e.negative.) /// @@ -1998,31 +2040,25 @@ TypedResult defaultPitchRollAiding(C::mip_interface& device); struct AutoZupt { + /// Parameters FunctionSelector function = static_cast(0); uint8_t enable = 0; ///< 0 - Disable, 1 - Enable float threshold = 0; ///< [meters/second] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_ZUPT_CONTROL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "AutoZupt"; static constexpr const char* DOC_NAME = "Zero Velocity Update Control"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8003; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(enable,threshold); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(enable),std::ref(threshold)); } @@ -2034,32 +2070,40 @@ struct AutoZupt return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint8_t enable = 0; ///< 0 - Disable, 1 - Enable + float threshold = 0; ///< [meters/second] + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_ZUPT_CONTROL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "AutoZupt::Response"; static constexpr const char* DOC_NAME = "Zero Velocity Update Control Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - uint8_t enable = 0; ///< 0 - Disable, 1 - Enable - float threshold = 0; ///< [meters/second] - + auto asTuple() const + { + return std::make_tuple(enable,threshold); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(enable),std::ref(threshold)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const AutoZupt& self); -void extract(Serializer& serializer, AutoZupt& self); - -void insert(Serializer& serializer, const AutoZupt::Response& self); -void extract(Serializer& serializer, AutoZupt::Response& self); - TypedResult writeAutoZupt(C::mip_interface& device, uint8_t enable, float threshold); TypedResult readAutoZupt(C::mip_interface& device, uint8_t* enableOut, float* thresholdOut); TypedResult saveAutoZupt(C::mip_interface& device); @@ -2069,7 +2113,7 @@ TypedResult defaultAutoZupt(C::mip_interface& device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_auto_angular_zupt (0x0D,0x20) Auto Angular Zupt [CPP] +///@defgroup filter_auto_angular_zupt_cpp (0x0D,0x20) Auto Angular Zupt /// Zero Angular Rate Update /// The ZUPT is triggered when the scalar magnitude of the angular rate vector is equal-to or less than the threshold value. /// The device will NACK threshold values that are less than zero (i.e.negative.) @@ -2078,31 +2122,25 @@ TypedResult defaultAutoZupt(C::mip_interface& device); struct AutoAngularZupt { + /// Parameters FunctionSelector function = static_cast(0); uint8_t enable = 0; ///< 0 - Disable, 1 - Enable float threshold = 0; ///< [radians/second] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_ANGULAR_ZUPT_CONTROL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "AutoAngularZupt"; static constexpr const char* DOC_NAME = "Zero Angular Rate Update Control"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8003; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(enable,threshold); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(enable),std::ref(threshold)); } @@ -2114,32 +2152,40 @@ struct AutoAngularZupt return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint8_t enable = 0; ///< 0 - Disable, 1 - Enable + float threshold = 0; ///< [radians/second] + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_ANGULAR_ZUPT_CONTROL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "AutoAngularZupt::Response"; static constexpr const char* DOC_NAME = "Zero Angular Rate Update Control Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - uint8_t enable = 0; ///< 0 - Disable, 1 - Enable - float threshold = 0; ///< [radians/second] - + auto asTuple() const + { + return std::make_tuple(enable,threshold); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(enable),std::ref(threshold)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const AutoAngularZupt& self); -void extract(Serializer& serializer, AutoAngularZupt& self); - -void insert(Serializer& serializer, const AutoAngularZupt::Response& self); -void extract(Serializer& serializer, AutoAngularZupt::Response& self); - TypedResult writeAutoAngularZupt(C::mip_interface& device, uint8_t enable, float threshold); TypedResult readAutoAngularZupt(C::mip_interface& device, uint8_t* enableOut, float* thresholdOut); TypedResult saveAutoAngularZupt(C::mip_interface& device); @@ -2149,79 +2195,79 @@ TypedResult defaultAutoAngularZupt(C::mip_interface& device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_commanded_zupt (0x0D,0x22) Commanded Zupt [CPP] +///@defgroup filter_commanded_zupt_cpp (0x0D,0x22) Commanded Zupt /// Please see the device user manual for the maximum rate of this message. /// ///@{ struct CommandedZupt { - + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_COMMANDED_ZUPT; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "CommandedZupt"; static constexpr const char* DOC_NAME = "Commanded Zero Velocity Update"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(); } - auto as_tuple() + auto asTuple() { return std::make_tuple(); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + typedef void Response; }; -void insert(Serializer& serializer, const CommandedZupt& self); -void extract(Serializer& serializer, CommandedZupt& self); - TypedResult commandedZupt(C::mip_interface& device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_commanded_angular_zupt (0x0D,0x23) Commanded Angular Zupt [CPP] +///@defgroup filter_commanded_angular_zupt_cpp (0x0D,0x23) Commanded Angular Zupt /// Please see the device user manual for the maximum rate of this message. /// ///@{ struct CommandedAngularZupt { - + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_COMMANDED_ANGULAR_ZUPT; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "CommandedAngularZupt"; static constexpr const char* DOC_NAME = "Commanded Zero Angular Rate Update"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(); } - auto as_tuple() + auto asTuple() { return std::make_tuple(); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + typedef void Response; }; -void insert(Serializer& serializer, const CommandedAngularZupt& self); -void extract(Serializer& serializer, CommandedAngularZupt& self); - TypedResult commandedAngularZupt(C::mip_interface& device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_mag_capture_auto_cal (0x0D,0x27) Mag Capture Auto Cal [CPP] +///@defgroup filter_mag_capture_auto_cal_cpp (0x0D,0x27) Mag Capture Auto Cal /// This command captures the current value of the auto-calibration, applies it to the current fixed hard and soft iron calibration coefficients, and replaces the current fixed hard and soft iron calibration coefficients with the new values. /// This may be used in place of (or in addition to) a manual hard and soft iron calibration utility. This command also resets the auto-calibration coefficients. /// Function selector SAVE is the same as issuing the 0x0C, 0x3A and 0x0C, 0x3B commands with the SAVE function selector. @@ -2230,28 +2276,23 @@ TypedResult commandedAngularZupt(C::mip_interface& device) struct MagCaptureAutoCal { + /// Parameters FunctionSelector function = static_cast(0); + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_MAG_CAPTURE_AUTO_CALIBRATION; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "MagCaptureAutoCal"; static constexpr const char* DOC_NAME = "Magnetometer Capture Auto Calibration"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8000; - static constexpr const uint32_t READ_PARAMS = 0x0000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x0000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(); } - auto as_tuple() + auto asTuple() { return std::make_tuple(); } @@ -2263,18 +2304,19 @@ struct MagCaptureAutoCal return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + typedef void Response; }; -void insert(Serializer& serializer, const MagCaptureAutoCal& self); -void extract(Serializer& serializer, MagCaptureAutoCal& self); - TypedResult writeMagCaptureAutoCal(C::mip_interface& device); TypedResult saveMagCaptureAutoCal(C::mip_interface& device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_gravity_noise (0x0D,0x28) Gravity Noise [CPP] +///@defgroup filter_gravity_noise_cpp (0x0D,0x28) Gravity Noise /// Set the expected gravity noise 1-sigma values. This function can be used to tune the filter performance in the target application. /// /// Note: Noise values must be greater than 0.0 @@ -2286,30 +2328,24 @@ TypedResult saveMagCaptureAutoCal(C::mip_interface& device); struct GravityNoise { + /// Parameters FunctionSelector function = static_cast(0); Vector3f noise; ///< Gravity Noise 1-sigma [gauss] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_GRAVITY_NOISE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GravityNoise"; static constexpr const char* DOC_NAME = "Gravity Noise Standard Deviation"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8001; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(noise); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(noise)); } @@ -2321,31 +2357,39 @@ struct GravityNoise return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + Vector3f noise; ///< Gravity Noise 1-sigma [gauss] + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_GRAVITY_NOISE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GravityNoise::Response"; static constexpr const char* DOC_NAME = "Gravity Noise Standard Deviation Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - Vector3f noise; ///< Gravity Noise 1-sigma [gauss] - + auto asTuple() const + { + return std::make_tuple(noise); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(noise)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const GravityNoise& self); -void extract(Serializer& serializer, GravityNoise& self); - -void insert(Serializer& serializer, const GravityNoise::Response& self); -void extract(Serializer& serializer, GravityNoise::Response& self); - TypedResult writeGravityNoise(C::mip_interface& device, const float* noise); TypedResult readGravityNoise(C::mip_interface& device, float* noiseOut); TypedResult saveGravityNoise(C::mip_interface& device); @@ -2355,7 +2399,7 @@ TypedResult defaultGravityNoise(C::mip_interface& device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_pressure_altitude_noise (0x0D,0x29) Pressure Altitude Noise [CPP] +///@defgroup filter_pressure_altitude_noise_cpp (0x0D,0x29) Pressure Altitude Noise /// Set the expected pressure altitude noise 1-sigma values. This function can be used to tune the filter performance in the target application. /// /// The noise value must be greater than 0.0 @@ -2367,30 +2411,24 @@ TypedResult defaultGravityNoise(C::mip_interface& device); struct PressureAltitudeNoise { + /// Parameters FunctionSelector function = static_cast(0); float noise = 0; ///< Pressure Altitude Noise 1-sigma [m] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_PRESSURE_NOISE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "PressureAltitudeNoise"; static constexpr const char* DOC_NAME = "Pressure Altitude Noise Standard Deviation"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8001; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(noise); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(noise)); } @@ -2402,31 +2440,39 @@ struct PressureAltitudeNoise return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + float noise = 0; ///< Pressure Altitude Noise 1-sigma [m] + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_PRESSURE_NOISE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "PressureAltitudeNoise::Response"; static constexpr const char* DOC_NAME = "Pressure Altitude Noise Standard Deviation Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - float noise = 0; ///< Pressure Altitude Noise 1-sigma [m] - + auto asTuple() const + { + return std::make_tuple(noise); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(noise)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const PressureAltitudeNoise& self); -void extract(Serializer& serializer, PressureAltitudeNoise& self); - -void insert(Serializer& serializer, const PressureAltitudeNoise::Response& self); -void extract(Serializer& serializer, PressureAltitudeNoise::Response& self); - TypedResult writePressureAltitudeNoise(C::mip_interface& device, float noise); TypedResult readPressureAltitudeNoise(C::mip_interface& device, float* noiseOut); TypedResult savePressureAltitudeNoise(C::mip_interface& device); @@ -2436,7 +2482,7 @@ TypedResult defaultPressureAltitudeNoise(C::mip_interface ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_hard_iron_offset_noise (0x0D,0x2B) Hard Iron Offset Noise [CPP] +///@defgroup filter_hard_iron_offset_noise_cpp (0x0D,0x2B) Hard Iron Offset Noise /// Set the expected hard iron offset noise 1-sigma values. This function can be used to tune the filter performance in the target application. /// /// This function can be used to tune the filter performance in the target application. @@ -2450,30 +2496,24 @@ TypedResult defaultPressureAltitudeNoise(C::mip_interface struct HardIronOffsetNoise { + /// Parameters FunctionSelector function = static_cast(0); Vector3f noise; ///< Hard Iron Offset Noise 1-sigma [gauss] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_HARD_IRON_OFFSET_NOISE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "HardIronOffsetNoise"; static constexpr const char* DOC_NAME = "Hard Iron Offset Process Noise"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8001; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(noise); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(noise)); } @@ -2485,31 +2525,39 @@ struct HardIronOffsetNoise return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + Vector3f noise; ///< Hard Iron Offset Noise 1-sigma [gauss] + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_HARD_IRON_OFFSET_NOISE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "HardIronOffsetNoise::Response"; static constexpr const char* DOC_NAME = "Hard Iron Offset Process Noise Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - Vector3f noise; ///< Hard Iron Offset Noise 1-sigma [gauss] - + auto asTuple() const + { + return std::make_tuple(noise); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(noise)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const HardIronOffsetNoise& self); -void extract(Serializer& serializer, HardIronOffsetNoise& self); - -void insert(Serializer& serializer, const HardIronOffsetNoise::Response& self); -void extract(Serializer& serializer, HardIronOffsetNoise::Response& self); - TypedResult writeHardIronOffsetNoise(C::mip_interface& device, const float* noise); TypedResult readHardIronOffsetNoise(C::mip_interface& device, float* noiseOut); TypedResult saveHardIronOffsetNoise(C::mip_interface& device); @@ -2519,7 +2567,7 @@ TypedResult defaultHardIronOffsetNoise(C::mip_interface& de ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_soft_iron_matrix_noise (0x0D,0x2C) Soft Iron Matrix Noise [CPP] +///@defgroup filter_soft_iron_matrix_noise_cpp (0x0D,0x2C) Soft Iron Matrix Noise /// Set the expected soft iron matrix noise 1-sigma values. /// This function can be used to tune the filter performance in the target application. /// @@ -2532,30 +2580,24 @@ TypedResult defaultHardIronOffsetNoise(C::mip_interface& de struct SoftIronMatrixNoise { + /// Parameters FunctionSelector function = static_cast(0); Matrix3f noise; ///< Soft Iron Matrix Noise 1-sigma [dimensionless] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_SOFT_IRON_MATRIX_NOISE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "SoftIronMatrixNoise"; static constexpr const char* DOC_NAME = "Soft Iron Offset Process Noise"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8001; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(noise); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(noise)); } @@ -2567,31 +2609,39 @@ struct SoftIronMatrixNoise return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + Matrix3f noise; ///< Soft Iron Matrix Noise 1-sigma [dimensionless] + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_SOFT_IRON_MATRIX_NOISE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "SoftIronMatrixNoise::Response"; static constexpr const char* DOC_NAME = "Soft Iron Offset Process Noise Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - Matrix3f noise; ///< Soft Iron Matrix Noise 1-sigma [dimensionless] - + auto asTuple() const + { + return std::make_tuple(noise); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(noise)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const SoftIronMatrixNoise& self); -void extract(Serializer& serializer, SoftIronMatrixNoise& self); - -void insert(Serializer& serializer, const SoftIronMatrixNoise::Response& self); -void extract(Serializer& serializer, SoftIronMatrixNoise::Response& self); - TypedResult writeSoftIronMatrixNoise(C::mip_interface& device, const float* noise); TypedResult readSoftIronMatrixNoise(C::mip_interface& device, float* noiseOut); TypedResult saveSoftIronMatrixNoise(C::mip_interface& device); @@ -2601,7 +2651,7 @@ TypedResult defaultSoftIronMatrixNoise(C::mip_interface& de ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_mag_noise (0x0D,0x42) Mag Noise [CPP] +///@defgroup filter_mag_noise_cpp (0x0D,0x42) Mag Noise /// Set the expected magnetometer noise 1-sigma values. /// This function can be used to tune the filter performance in the target application. /// @@ -2614,30 +2664,24 @@ TypedResult defaultSoftIronMatrixNoise(C::mip_interface& de struct MagNoise { + /// Parameters FunctionSelector function = static_cast(0); Vector3f noise; ///< Mag Noise 1-sigma [gauss] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_MAG_NOISE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "MagNoise"; static constexpr const char* DOC_NAME = "Magnetometer Noise Standard Deviation"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8001; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(noise); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(noise)); } @@ -2649,31 +2693,39 @@ struct MagNoise return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + Vector3f noise; ///< Mag Noise 1-sigma [gauss] + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_MAG_NOISE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "MagNoise::Response"; static constexpr const char* DOC_NAME = "Magnetometer Noise Standard Deviation Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - Vector3f noise; ///< Mag Noise 1-sigma [gauss] - + auto asTuple() const + { + return std::make_tuple(noise); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(noise)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const MagNoise& self); -void extract(Serializer& serializer, MagNoise& self); - -void insert(Serializer& serializer, const MagNoise::Response& self); -void extract(Serializer& serializer, MagNoise::Response& self); - TypedResult writeMagNoise(C::mip_interface& device, const float* noise); TypedResult readMagNoise(C::mip_interface& device, float* noiseOut); TypedResult saveMagNoise(C::mip_interface& device); @@ -2683,7 +2735,7 @@ TypedResult defaultMagNoise(C::mip_interface& device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_inclination_source (0x0D,0x4C) Inclination Source [CPP] +///@defgroup filter_inclination_source_cpp (0x0D,0x4C) Inclination Source /// Set/Get the local magnetic field inclination angle source. /// /// This can be used to correct for the local value of inclination (dip angle) of the earthmagnetic field. @@ -2694,31 +2746,25 @@ TypedResult defaultMagNoise(C::mip_interface& device); struct InclinationSource { + /// Parameters FunctionSelector function = static_cast(0); FilterMagParamSource source = static_cast(0); ///< Inclination Source float inclination = 0; ///< Inclination angle [radians] (only required if source = MANUAL) + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_INCLINATION_SOURCE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "InclinationSource"; static constexpr const char* DOC_NAME = "Inclination Source"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8003; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(source,inclination); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(source),std::ref(inclination)); } @@ -2730,32 +2776,40 @@ struct InclinationSource return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + FilterMagParamSource source = static_cast(0); ///< Inclination Source + float inclination = 0; ///< Inclination angle [radians] (only required if source = MANUAL) + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_INCLINATION_SOURCE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "InclinationSource::Response"; static constexpr const char* DOC_NAME = "Inclination Source Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - FilterMagParamSource source = static_cast(0); ///< Inclination Source - float inclination = 0; ///< Inclination angle [radians] (only required if source = MANUAL) - + auto asTuple() const + { + return std::make_tuple(source,inclination); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(source),std::ref(inclination)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const InclinationSource& self); -void extract(Serializer& serializer, InclinationSource& self); - -void insert(Serializer& serializer, const InclinationSource::Response& self); -void extract(Serializer& serializer, InclinationSource::Response& self); - TypedResult writeInclinationSource(C::mip_interface& device, FilterMagParamSource source, float inclination); TypedResult readInclinationSource(C::mip_interface& device, FilterMagParamSource* sourceOut, float* inclinationOut); TypedResult saveInclinationSource(C::mip_interface& device); @@ -2765,7 +2819,7 @@ TypedResult defaultInclinationSource(C::mip_interface& device ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_magnetic_declination_source (0x0D,0x43) Magnetic Declination Source [CPP] +///@defgroup filter_magnetic_declination_source_cpp (0x0D,0x43) Magnetic Declination Source /// Set/Get the local magnetic field declination angle source. /// /// This can be used to correct for the local value of declination of the earthmagnetic field. @@ -2776,31 +2830,25 @@ TypedResult defaultInclinationSource(C::mip_interface& device struct MagneticDeclinationSource { + /// Parameters FunctionSelector function = static_cast(0); FilterMagParamSource source = static_cast(0); ///< Magnetic field declination angle source float declination = 0; ///< Declination angle [radians] (only required if source = MANUAL) + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_DECLINATION_SOURCE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "MagneticDeclinationSource"; static constexpr const char* DOC_NAME = "Magnetic Field Declination Source Control"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8003; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(source,declination); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(source),std::ref(declination)); } @@ -2812,32 +2860,40 @@ struct MagneticDeclinationSource return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + FilterMagParamSource source = static_cast(0); ///< Magnetic field declination angle source + float declination = 0; ///< Declination angle [radians] (only required if source = MANUAL) + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_DECLINATION_SOURCE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "MagneticDeclinationSource::Response"; static constexpr const char* DOC_NAME = "Magnetic Field Declination Source Control Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - FilterMagParamSource source = static_cast(0); ///< Magnetic field declination angle source - float declination = 0; ///< Declination angle [radians] (only required if source = MANUAL) - + auto asTuple() const + { + return std::make_tuple(source,declination); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(source),std::ref(declination)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const MagneticDeclinationSource& self); -void extract(Serializer& serializer, MagneticDeclinationSource& self); - -void insert(Serializer& serializer, const MagneticDeclinationSource::Response& self); -void extract(Serializer& serializer, MagneticDeclinationSource::Response& self); - TypedResult writeMagneticDeclinationSource(C::mip_interface& device, FilterMagParamSource source, float declination); TypedResult readMagneticDeclinationSource(C::mip_interface& device, FilterMagParamSource* sourceOut, float* declinationOut); TypedResult saveMagneticDeclinationSource(C::mip_interface& device); @@ -2847,7 +2903,7 @@ TypedResult defaultMagneticDeclinationSource(C::mip_i ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_mag_field_magnitude_source (0x0D,0x4D) Mag Field Magnitude Source [CPP] +///@defgroup filter_mag_field_magnitude_source_cpp (0x0D,0x4D) Mag Field Magnitude Source /// Set/Get the local magnetic field magnitude source. /// /// This is used to specify the local magnitude of the earth's magnetic field. @@ -2857,31 +2913,25 @@ TypedResult defaultMagneticDeclinationSource(C::mip_i struct MagFieldMagnitudeSource { + /// Parameters FunctionSelector function = static_cast(0); FilterMagParamSource source = static_cast(0); ///< Magnetic Field Magnitude Source float magnitude = 0; ///< Magnitude [gauss] (only required if source = MANUAL) + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_MAGNETIC_MAGNITUDE_SOURCE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "MagFieldMagnitudeSource"; static constexpr const char* DOC_NAME = "Magnetic Field Magnitude Source"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8003; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(source,magnitude); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(source),std::ref(magnitude)); } @@ -2893,32 +2943,40 @@ struct MagFieldMagnitudeSource return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + FilterMagParamSource source = static_cast(0); ///< Magnetic Field Magnitude Source + float magnitude = 0; ///< Magnitude [gauss] (only required if source = MANUAL) + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_MAGNETIC_MAGNITUDE_SOURCE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "MagFieldMagnitudeSource::Response"; static constexpr const char* DOC_NAME = "Magnetic Field Magnitude Source Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - FilterMagParamSource source = static_cast(0); ///< Magnetic Field Magnitude Source - float magnitude = 0; ///< Magnitude [gauss] (only required if source = MANUAL) - + auto asTuple() const + { + return std::make_tuple(source,magnitude); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(source),std::ref(magnitude)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const MagFieldMagnitudeSource& self); -void extract(Serializer& serializer, MagFieldMagnitudeSource& self); - -void insert(Serializer& serializer, const MagFieldMagnitudeSource::Response& self); -void extract(Serializer& serializer, MagFieldMagnitudeSource::Response& self); - TypedResult writeMagFieldMagnitudeSource(C::mip_interface& device, FilterMagParamSource source, float magnitude); TypedResult readMagFieldMagnitudeSource(C::mip_interface& device, FilterMagParamSource* sourceOut, float* magnitudeOut); TypedResult saveMagFieldMagnitudeSource(C::mip_interface& device); @@ -2928,7 +2986,7 @@ TypedResult defaultMagFieldMagnitudeSource(C::mip_inter ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_reference_position (0x0D,0x26) Reference Position [CPP] +///@defgroup filter_reference_position_cpp (0x0D,0x26) Reference Position /// Set the Lat/Long/Alt reference position for the sensor. /// /// This position is used by the sensor to calculate the WGS84 gravity and WMM2015 magnetic field parameters. @@ -2938,33 +2996,27 @@ TypedResult defaultMagFieldMagnitudeSource(C::mip_inter struct ReferencePosition { + /// Parameters FunctionSelector function = static_cast(0); bool enable = 0; ///< enable/disable double latitude = 0; ///< [degrees] double longitude = 0; ///< [degrees] double altitude = 0; ///< [meters] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_REFERENCE_POSITION; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ReferencePosition"; static constexpr const char* DOC_NAME = "Set Reference Position"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x800F; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(enable,latitude,longitude,altitude); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(enable),std::ref(latitude),std::ref(longitude),std::ref(altitude)); } @@ -2976,34 +3028,42 @@ struct ReferencePosition return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + bool enable = 0; ///< enable/disable + double latitude = 0; ///< [degrees] + double longitude = 0; ///< [degrees] + double altitude = 0; ///< [meters] + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_REFERENCE_POSITION; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ReferencePosition::Response"; static constexpr const char* DOC_NAME = "Set Reference Position Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - bool enable = 0; ///< enable/disable - double latitude = 0; ///< [degrees] - double longitude = 0; ///< [degrees] - double altitude = 0; ///< [meters] - + auto asTuple() const + { + return std::make_tuple(enable,latitude,longitude,altitude); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(enable),std::ref(latitude),std::ref(longitude),std::ref(altitude)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const ReferencePosition& self); -void extract(Serializer& serializer, ReferencePosition& self); - -void insert(Serializer& serializer, const ReferencePosition::Response& self); -void extract(Serializer& serializer, ReferencePosition::Response& self); - TypedResult writeReferencePosition(C::mip_interface& device, bool enable, double latitude, double longitude, double altitude); TypedResult readReferencePosition(C::mip_interface& device, bool* enableOut, double* latitudeOut, double* longitudeOut, double* altitudeOut); TypedResult saveReferencePosition(C::mip_interface& device); @@ -3013,7 +3073,7 @@ TypedResult defaultReferencePosition(C::mip_interface& device ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_accel_magnitude_error_adaptive_measurement (0x0D,0x44) Accel Magnitude Error Adaptive Measurement [CPP] +///@defgroup filter_accel_magnitude_error_adaptive_measurement_cpp (0x0D,0x44) Accel Magnitude Error Adaptive Measurement /// Enable or disable the gravity magnitude error adaptive measurement. /// This function can be used to tune the filter performance in the target application /// @@ -3033,6 +3093,7 @@ TypedResult defaultReferencePosition(C::mip_interface& device struct AccelMagnitudeErrorAdaptiveMeasurement { + /// Parameters FunctionSelector function = static_cast(0); FilterAdaptiveMeasurement adaptive_measurement = static_cast(0); ///< Adaptive measurement selector float frequency = 0; ///< Low-pass filter curoff frequency [hertz] @@ -3042,27 +3103,20 @@ struct AccelMagnitudeErrorAdaptiveMeasurement float high_limit_uncertainty = 0; ///< 1-Sigma [meters/second^2] float minimum_uncertainty = 0; ///< 1-Sigma [meters/second^2] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_ACCEL_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "AccelMagnitudeErrorAdaptiveMeasurement"; static constexpr const char* DOC_NAME = "Gravity Magnitude Error Adaptive Measurement"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x807F; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(adaptive_measurement,frequency,low_limit,high_limit,low_limit_uncertainty,high_limit_uncertainty,minimum_uncertainty); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(adaptive_measurement),std::ref(frequency),std::ref(low_limit),std::ref(high_limit),std::ref(low_limit_uncertainty),std::ref(high_limit_uncertainty),std::ref(minimum_uncertainty)); } @@ -3074,16 +3128,13 @@ struct AccelMagnitudeErrorAdaptiveMeasurement return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { - static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; - static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_ACCEL_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL; - static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; - static constexpr const char* NAME = "AccelMagnitudeErrorAdaptiveMeasurement::Response"; - static constexpr const char* DOC_NAME = "Gravity Magnitude Error Adaptive Measurement Response"; - - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; + /// Parameters FilterAdaptiveMeasurement adaptive_measurement = static_cast(0); ///< Adaptive measurement selector float frequency = 0; ///< Low-pass filter curoff frequency [hertz] float low_limit = 0; ///< [meters/second^2] @@ -3092,19 +3143,30 @@ struct AccelMagnitudeErrorAdaptiveMeasurement float high_limit_uncertainty = 0; ///< 1-Sigma [meters/second^2] float minimum_uncertainty = 0; ///< 1-Sigma [meters/second^2] + /// Descriptors + static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; + static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_ACCEL_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL; + static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; + static constexpr const char* NAME = "AccelMagnitudeErrorAdaptiveMeasurement::Response"; + static constexpr const char* DOC_NAME = "Gravity Magnitude Error Adaptive Measurement Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; + + auto asTuple() const + { + return std::make_tuple(adaptive_measurement,frequency,low_limit,high_limit,low_limit_uncertainty,high_limit_uncertainty,minimum_uncertainty); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(adaptive_measurement),std::ref(frequency),std::ref(low_limit),std::ref(high_limit),std::ref(low_limit_uncertainty),std::ref(high_limit_uncertainty),std::ref(minimum_uncertainty)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const AccelMagnitudeErrorAdaptiveMeasurement& self); -void extract(Serializer& serializer, AccelMagnitudeErrorAdaptiveMeasurement& self); - -void insert(Serializer& serializer, const AccelMagnitudeErrorAdaptiveMeasurement::Response& self); -void extract(Serializer& serializer, AccelMagnitudeErrorAdaptiveMeasurement::Response& self); - TypedResult writeAccelMagnitudeErrorAdaptiveMeasurement(C::mip_interface& device, FilterAdaptiveMeasurement adaptiveMeasurement, float frequency, float lowLimit, float highLimit, float lowLimitUncertainty, float highLimitUncertainty, float minimumUncertainty); TypedResult readAccelMagnitudeErrorAdaptiveMeasurement(C::mip_interface& device, FilterAdaptiveMeasurement* adaptiveMeasurementOut, float* frequencyOut, float* lowLimitOut, float* highLimitOut, float* lowLimitUncertaintyOut, float* highLimitUncertaintyOut, float* minimumUncertaintyOut); TypedResult saveAccelMagnitudeErrorAdaptiveMeasurement(C::mip_interface& device); @@ -3114,7 +3176,7 @@ TypedResult defaultAccelMagnitudeErrorAd ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_mag_magnitude_error_adaptive_measurement (0x0D,0x45) Mag Magnitude Error Adaptive Measurement [CPP] +///@defgroup filter_mag_magnitude_error_adaptive_measurement_cpp (0x0D,0x45) Mag Magnitude Error Adaptive Measurement /// Enable or disable the magnetometer magnitude error adaptive measurement. /// This feature will reject magnetometer readings that are out of range of the thresholds specified (fixed adaptive) or calculated internally (auto-adaptive). /// @@ -3129,6 +3191,7 @@ TypedResult defaultAccelMagnitudeErrorAd struct MagMagnitudeErrorAdaptiveMeasurement { + /// Parameters FunctionSelector function = static_cast(0); FilterAdaptiveMeasurement adaptive_measurement = static_cast(0); ///< Adaptive measurement selector float frequency = 0; ///< Low-pass filter curoff frequency [hertz] @@ -3138,27 +3201,20 @@ struct MagMagnitudeErrorAdaptiveMeasurement float high_limit_uncertainty = 0; ///< 1-Sigma [meters/second^2] float minimum_uncertainty = 0; ///< 1-Sigma [meters/second^2] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_MAG_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "MagMagnitudeErrorAdaptiveMeasurement"; static constexpr const char* DOC_NAME = "Magnetometer Magnitude Error Adaptive Measurement"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x807F; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(adaptive_measurement,frequency,low_limit,high_limit,low_limit_uncertainty,high_limit_uncertainty,minimum_uncertainty); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(adaptive_measurement),std::ref(frequency),std::ref(low_limit),std::ref(high_limit),std::ref(low_limit_uncertainty),std::ref(high_limit_uncertainty),std::ref(minimum_uncertainty)); } @@ -3170,16 +3226,13 @@ struct MagMagnitudeErrorAdaptiveMeasurement return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { - static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; - static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_MAG_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL; - static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; - static constexpr const char* NAME = "MagMagnitudeErrorAdaptiveMeasurement::Response"; - static constexpr const char* DOC_NAME = "Magnetometer Magnitude Error Adaptive Measurement Response"; - - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; + /// Parameters FilterAdaptiveMeasurement adaptive_measurement = static_cast(0); ///< Adaptive measurement selector float frequency = 0; ///< Low-pass filter curoff frequency [hertz] float low_limit = 0; ///< [meters/second^2] @@ -3188,19 +3241,30 @@ struct MagMagnitudeErrorAdaptiveMeasurement float high_limit_uncertainty = 0; ///< 1-Sigma [meters/second^2] float minimum_uncertainty = 0; ///< 1-Sigma [meters/second^2] + /// Descriptors + static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; + static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_MAG_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL; + static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; + static constexpr const char* NAME = "MagMagnitudeErrorAdaptiveMeasurement::Response"; + static constexpr const char* DOC_NAME = "Magnetometer Magnitude Error Adaptive Measurement Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - auto as_tuple() + auto asTuple() const + { + return std::make_tuple(adaptive_measurement,frequency,low_limit,high_limit,low_limit_uncertainty,high_limit_uncertainty,minimum_uncertainty); + } + + auto asTuple() { return std::make_tuple(std::ref(adaptive_measurement),std::ref(frequency),std::ref(low_limit),std::ref(high_limit),std::ref(low_limit_uncertainty),std::ref(high_limit_uncertainty),std::ref(minimum_uncertainty)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const MagMagnitudeErrorAdaptiveMeasurement& self); -void extract(Serializer& serializer, MagMagnitudeErrorAdaptiveMeasurement& self); - -void insert(Serializer& serializer, const MagMagnitudeErrorAdaptiveMeasurement::Response& self); -void extract(Serializer& serializer, MagMagnitudeErrorAdaptiveMeasurement::Response& self); - TypedResult writeMagMagnitudeErrorAdaptiveMeasurement(C::mip_interface& device, FilterAdaptiveMeasurement adaptiveMeasurement, float frequency, float lowLimit, float highLimit, float lowLimitUncertainty, float highLimitUncertainty, float minimumUncertainty); TypedResult readMagMagnitudeErrorAdaptiveMeasurement(C::mip_interface& device, FilterAdaptiveMeasurement* adaptiveMeasurementOut, float* frequencyOut, float* lowLimitOut, float* highLimitOut, float* lowLimitUncertaintyOut, float* highLimitUncertaintyOut, float* minimumUncertaintyOut); TypedResult saveMagMagnitudeErrorAdaptiveMeasurement(C::mip_interface& device); @@ -3210,7 +3274,7 @@ TypedResult defaultMagMagnitudeErrorAdapti ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_mag_dip_angle_error_adaptive_measurement (0x0D,0x46) Mag Dip Angle Error Adaptive Measurement [CPP] +///@defgroup filter_mag_dip_angle_error_adaptive_measurement_cpp (0x0D,0x46) Mag Dip Angle Error Adaptive Measurement /// Enable or disable the magnetometer dip angle error adaptive measurement. /// This function can be used to tune the filter performance in the target application /// @@ -3227,6 +3291,7 @@ TypedResult defaultMagMagnitudeErrorAdapti struct MagDipAngleErrorAdaptiveMeasurement { + /// Parameters FunctionSelector function = static_cast(0); bool enable = 0; ///< Enable/Disable float frequency = 0; ///< Low-pass filter curoff frequency [hertz] @@ -3234,27 +3299,20 @@ struct MagDipAngleErrorAdaptiveMeasurement float high_limit_uncertainty = 0; ///< 1-Sigma [meters/second^2] float minimum_uncertainty = 0; ///< 1-Sigma [meters/second^2] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_MAG_DIP_ANGLE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "MagDipAngleErrorAdaptiveMeasurement"; static constexpr const char* DOC_NAME = "Magnetometer Dig Angle Error Adaptive Measurement"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x801F; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(enable,frequency,high_limit,high_limit_uncertainty,minimum_uncertainty); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(enable),std::ref(frequency),std::ref(high_limit),std::ref(high_limit_uncertainty),std::ref(minimum_uncertainty)); } @@ -3266,35 +3324,43 @@ struct MagDipAngleErrorAdaptiveMeasurement return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { - static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; - static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_MAG_DIP_ANGLE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL; - static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; - static constexpr const char* NAME = "MagDipAngleErrorAdaptiveMeasurement::Response"; - static constexpr const char* DOC_NAME = "Magnetometer Dig Angle Error Adaptive Measurement Response"; - - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; + /// Parameters bool enable = 0; ///< Enable/Disable float frequency = 0; ///< Low-pass filter curoff frequency [hertz] float high_limit = 0; ///< [meters/second^2] float high_limit_uncertainty = 0; ///< 1-Sigma [meters/second^2] float minimum_uncertainty = 0; ///< 1-Sigma [meters/second^2] + /// Descriptors + static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; + static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_MAG_DIP_ANGLE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL; + static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; + static constexpr const char* NAME = "MagDipAngleErrorAdaptiveMeasurement::Response"; + static constexpr const char* DOC_NAME = "Magnetometer Dig Angle Error Adaptive Measurement Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; + + auto asTuple() const + { + return std::make_tuple(enable,frequency,high_limit,high_limit_uncertainty,minimum_uncertainty); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(enable),std::ref(frequency),std::ref(high_limit),std::ref(high_limit_uncertainty),std::ref(minimum_uncertainty)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const MagDipAngleErrorAdaptiveMeasurement& self); -void extract(Serializer& serializer, MagDipAngleErrorAdaptiveMeasurement& self); - -void insert(Serializer& serializer, const MagDipAngleErrorAdaptiveMeasurement::Response& self); -void extract(Serializer& serializer, MagDipAngleErrorAdaptiveMeasurement::Response& self); - TypedResult writeMagDipAngleErrorAdaptiveMeasurement(C::mip_interface& device, bool enable, float frequency, float highLimit, float highLimitUncertainty, float minimumUncertainty); TypedResult readMagDipAngleErrorAdaptiveMeasurement(C::mip_interface& device, bool* enableOut, float* frequencyOut, float* highLimitOut, float* highLimitUncertaintyOut, float* minimumUncertaintyOut); TypedResult saveMagDipAngleErrorAdaptiveMeasurement(C::mip_interface& device); @@ -3304,7 +3370,7 @@ TypedResult defaultMagDipAngleErrorAdaptive ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_aiding_measurement_enable (0x0D,0x50) Aiding Measurement Enable [CPP] +///@defgroup filter_aiding_measurement_enable_cpp (0x0D,0x50) Aiding Measurement Enable /// Enables / disables the specified aiding measurement source. /// /// @@ -3327,31 +3393,25 @@ struct AidingMeasurementEnable ALL = 65535, ///< Save/load/reset all options }; + /// Parameters FunctionSelector function = static_cast(0); AidingSource aiding_source = static_cast(0); ///< Aiding measurement source bool enable = 0; ///< Controls the aiding source + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_AIDING_MEASUREMENT_ENABLE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "AidingMeasurementEnable"; static constexpr const char* DOC_NAME = "Aiding Measurement Control"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8003; - static constexpr const uint32_t READ_PARAMS = 0x8001; - static constexpr const uint32_t SAVE_PARAMS = 0x8001; - static constexpr const uint32_t LOAD_PARAMS = 0x8001; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8001; - static constexpr const uint32_t ECHOED_PARAMS = 0x0001; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(aiding_source,enable); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(aiding_source),std::ref(enable)); } @@ -3364,32 +3424,40 @@ struct AidingMeasurementEnable return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + AidingSource aiding_source = static_cast(0); ///< Aiding measurement source + bool enable = 0; ///< Controls the aiding source + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_AIDING_MEASUREMENT_ENABLE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "AidingMeasurementEnable::Response"; static constexpr const char* DOC_NAME = "Aiding Measurement Control Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0001; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - AidingSource aiding_source = static_cast(0); ///< Aiding measurement source - bool enable = 0; ///< Controls the aiding source - + auto asTuple() const + { + return std::make_tuple(aiding_source,enable); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(aiding_source),std::ref(enable)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const AidingMeasurementEnable& self); -void extract(Serializer& serializer, AidingMeasurementEnable& self); - -void insert(Serializer& serializer, const AidingMeasurementEnable::Response& self); -void extract(Serializer& serializer, AidingMeasurementEnable::Response& self); - TypedResult writeAidingMeasurementEnable(C::mip_interface& device, AidingMeasurementEnable::AidingSource aidingSource, bool enable); TypedResult readAidingMeasurementEnable(C::mip_interface& device, AidingMeasurementEnable::AidingSource aidingSource, bool* enableOut); TypedResult saveAidingMeasurementEnable(C::mip_interface& device, AidingMeasurementEnable::AidingSource aidingSource); @@ -3399,7 +3467,7 @@ TypedResult defaultAidingMeasurementEnable(C::mip_inter ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_run (0x0D,0x05) Run [CPP] +///@defgroup filter_run_cpp (0x0D,0x05) Run /// Manual run command. /// /// If the initialization configuration has the "wait_for_run_command" option enabled, the filter will wait until it receives this command before commencing integration and enabling the Kalman filter. Prior to the receipt of this command, the filter will remain in the filter initialization mode. @@ -3408,36 +3476,36 @@ TypedResult defaultAidingMeasurementEnable(C::mip_inter struct Run { - + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_RUN; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "Run"; static constexpr const char* DOC_NAME = "Run Navigation Filter"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(); } - auto as_tuple() + auto asTuple() { return std::make_tuple(); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + typedef void Response; }; -void insert(Serializer& serializer, const Run& self); -void extract(Serializer& serializer, Run& self); - TypedResult run(C::mip_interface& device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_kinematic_constraint (0x0D,0x51) Kinematic Constraint [CPP] +///@defgroup filter_kinematic_constraint_cpp (0x0D,0x51) Kinematic Constraint /// Controls kinematic constraint model selection for the navigation filter. /// /// See manual for explanation of how the kinematic constraints are applied. @@ -3446,32 +3514,26 @@ TypedResult run(C::mip_interface& device); struct KinematicConstraint { + /// Parameters FunctionSelector function = static_cast(0); uint8_t acceleration_constraint_selection = 0; ///< Acceleration constraint:
0=None (default),
1=Zero-acceleration. uint8_t velocity_constraint_selection = 0; ///< 0=None (default),
1=Zero-velocity,
2=Wheeled-vehicle.
uint8_t angular_constraint_selection = 0; ///< 0=None (default), 1=Zero-angular rate (ZUPT). + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_KINEMATIC_CONSTRAINT; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "KinematicConstraint"; static constexpr const char* DOC_NAME = "Kinematic Constraint Control"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8007; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(acceleration_constraint_selection,velocity_constraint_selection,angular_constraint_selection); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(acceleration_constraint_selection),std::ref(velocity_constraint_selection),std::ref(angular_constraint_selection)); } @@ -3483,33 +3545,41 @@ struct KinematicConstraint return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint8_t acceleration_constraint_selection = 0; ///< Acceleration constraint:
0=None (default),
1=Zero-acceleration. + uint8_t velocity_constraint_selection = 0; ///< 0=None (default),
1=Zero-velocity,
2=Wheeled-vehicle.
+ uint8_t angular_constraint_selection = 0; ///< 0=None (default), 1=Zero-angular rate (ZUPT). + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_KINEMATIC_CONSTRAINT; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "KinematicConstraint::Response"; static constexpr const char* DOC_NAME = "Kinematic Constraint Control Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - uint8_t acceleration_constraint_selection = 0; ///< Acceleration constraint:
0=None (default),
1=Zero-acceleration. - uint8_t velocity_constraint_selection = 0; ///< 0=None (default),
1=Zero-velocity,
2=Wheeled-vehicle.
- uint8_t angular_constraint_selection = 0; ///< 0=None (default), 1=Zero-angular rate (ZUPT). - + auto asTuple() const + { + return std::make_tuple(acceleration_constraint_selection,velocity_constraint_selection,angular_constraint_selection); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(acceleration_constraint_selection),std::ref(velocity_constraint_selection),std::ref(angular_constraint_selection)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const KinematicConstraint& self); -void extract(Serializer& serializer, KinematicConstraint& self); - -void insert(Serializer& serializer, const KinematicConstraint::Response& self); -void extract(Serializer& serializer, KinematicConstraint::Response& self); - TypedResult writeKinematicConstraint(C::mip_interface& device, uint8_t accelerationConstraintSelection, uint8_t velocityConstraintSelection, uint8_t angularConstraintSelection); TypedResult readKinematicConstraint(C::mip_interface& device, uint8_t* accelerationConstraintSelectionOut, uint8_t* velocityConstraintSelectionOut, uint8_t* angularConstraintSelectionOut); TypedResult saveKinematicConstraint(C::mip_interface& device); @@ -3519,7 +3589,7 @@ TypedResult defaultKinematicConstraint(C::mip_interface& de ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_initialization_configuration (0x0D,0x52) Initialization Configuration [CPP] +///@defgroup filter_initialization_configuration_cpp (0x0D,0x52) Initialization Configuration /// Controls the source and values used for initial conditions of the navigation solution. /// /// Notes: Initial conditions are the position, velocity, and attitude of the platform used when the filter starts running or is reset. @@ -3532,6 +3602,7 @@ struct InitializationConfiguration { struct AlignmentSelector : Bitfield { + typedef uint8_t Type; enum _enumType : uint8_t { NONE = 0x00, @@ -3552,18 +3623,16 @@ struct InitializationConfiguration AlignmentSelector& operator&=(uint8_t val) { return *this = value & val; } bool dualAntenna() const { return (value & DUAL_ANTENNA) > 0; } - void dualAntenna(bool val) { if(val) value |= DUAL_ANTENNA; else value &= ~DUAL_ANTENNA; } + void dualAntenna(bool val) { value &= ~DUAL_ANTENNA; if(val) value |= DUAL_ANTENNA; } bool kinematic() const { return (value & KINEMATIC) > 0; } - void kinematic(bool val) { if(val) value |= KINEMATIC; else value &= ~KINEMATIC; } + void kinematic(bool val) { value &= ~KINEMATIC; if(val) value |= KINEMATIC; } bool magnetometer() const { return (value & MAGNETOMETER) > 0; } - void magnetometer(bool val) { if(val) value |= MAGNETOMETER; else value &= ~MAGNETOMETER; } + void magnetometer(bool val) { value &= ~MAGNETOMETER; if(val) value |= MAGNETOMETER; } bool external() const { return (value & EXTERNAL) > 0; } - void external(bool val) { if(val) value |= EXTERNAL; else value &= ~EXTERNAL; } - + void external(bool val) { value &= ~EXTERNAL; if(val) value |= EXTERNAL; } bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - enum class InitialConditionSource : uint8_t { AUTO_POS_VEL_ATT = 0, ///< Automatic position, velocity and attitude @@ -3572,6 +3641,7 @@ struct InitializationConfiguration MANUAL = 3, ///< User-specified position, velocity, and attitude. }; + /// Parameters FunctionSelector function = static_cast(0); uint8_t wait_for_run_command = 0; ///< Initialize filter only after receiving "run" command InitialConditionSource initial_cond_src = static_cast(0); ///< Initial condition source: @@ -3583,27 +3653,20 @@ struct InitializationConfiguration Vector3f initial_velocity; ///< User-specified initial platform velocity (units determined by reference frame selector, see note.) FilterReferenceFrame reference_frame_selector = static_cast(0); ///< User-specified initial position/velocity reference frames + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_INITIALIZATION_CONFIGURATION; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "InitializationConfiguration"; static constexpr const char* DOC_NAME = "Navigation Filter Initialization"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x81FF; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(wait_for_run_command,initial_cond_src,auto_heading_alignment_selector,initial_heading,initial_pitch,initial_roll,initial_position,initial_velocity,reference_frame_selector); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(wait_for_run_command),std::ref(initial_cond_src),std::ref(auto_heading_alignment_selector),std::ref(initial_heading),std::ref(initial_pitch),std::ref(initial_roll),std::ref(initial_position),std::ref(initial_velocity),std::ref(reference_frame_selector)); } @@ -3615,16 +3678,13 @@ struct InitializationConfiguration return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { - static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; - static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_INITIALIZATION_CONFIGURATION; - static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; - static constexpr const char* NAME = "InitializationConfiguration::Response"; - static constexpr const char* DOC_NAME = "Navigation Filter Initialization Response"; - - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; + /// Parameters uint8_t wait_for_run_command = 0; ///< Initialize filter only after receiving "run" command InitialConditionSource initial_cond_src = static_cast(0); ///< Initial condition source: AlignmentSelector auto_heading_alignment_selector; ///< Bitfield specifying the allowed automatic heading alignment methods for automatic initial conditions. Bits are set to 1 to enable, and the correspond to the following:
@@ -3635,19 +3695,30 @@ struct InitializationConfiguration Vector3f initial_velocity; ///< User-specified initial platform velocity (units determined by reference frame selector, see note.) FilterReferenceFrame reference_frame_selector = static_cast(0); ///< User-specified initial position/velocity reference frames + /// Descriptors + static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; + static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_INITIALIZATION_CONFIGURATION; + static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; + static constexpr const char* NAME = "InitializationConfiguration::Response"; + static constexpr const char* DOC_NAME = "Navigation Filter Initialization Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; + + auto asTuple() const + { + return std::make_tuple(wait_for_run_command,initial_cond_src,auto_heading_alignment_selector,initial_heading,initial_pitch,initial_roll,initial_position,initial_velocity,reference_frame_selector); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(wait_for_run_command),std::ref(initial_cond_src),std::ref(auto_heading_alignment_selector),std::ref(initial_heading),std::ref(initial_pitch),std::ref(initial_roll),std::ref(initial_position),std::ref(initial_velocity),std::ref(reference_frame_selector)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const InitializationConfiguration& self); -void extract(Serializer& serializer, InitializationConfiguration& self); - -void insert(Serializer& serializer, const InitializationConfiguration::Response& self); -void extract(Serializer& serializer, InitializationConfiguration::Response& self); - TypedResult writeInitializationConfiguration(C::mip_interface& device, uint8_t waitForRunCommand, InitializationConfiguration::InitialConditionSource initialCondSrc, InitializationConfiguration::AlignmentSelector autoHeadingAlignmentSelector, float initialHeading, float initialPitch, float initialRoll, const float* initialPosition, const float* initialVelocity, FilterReferenceFrame referenceFrameSelector); TypedResult readInitializationConfiguration(C::mip_interface& device, uint8_t* waitForRunCommandOut, InitializationConfiguration::InitialConditionSource* initialCondSrcOut, InitializationConfiguration::AlignmentSelector* autoHeadingAlignmentSelectorOut, float* initialHeadingOut, float* initialPitchOut, float* initialRollOut, float* initialPositionOut, float* initialVelocityOut, FilterReferenceFrame* referenceFrameSelectorOut); TypedResult saveInitializationConfiguration(C::mip_interface& device); @@ -3657,38 +3728,32 @@ TypedResult defaultInitializationConfiguration(C::m ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_adaptive_filter_options (0x0D,0x53) Adaptive Filter Options [CPP] +///@defgroup filter_adaptive_filter_options_cpp (0x0D,0x53) Adaptive Filter Options /// Configures the basic setup for auto-adaptive filtering. See product manual for a detailed description of this feature. /// ///@{ struct AdaptiveFilterOptions { + /// Parameters FunctionSelector function = static_cast(0); uint8_t level = 0; ///< Auto-adaptive operating level:
0=Off,
1=Conservative,
2=Moderate (default),
3=Aggressive. uint16_t time_limit = 0; ///< Maximum duration of measurement rejection before entering recovery mode (ms) + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_ADAPTIVE_FILTER_OPTIONS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "AdaptiveFilterOptions"; static constexpr const char* DOC_NAME = "Adaptive Filter Control"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8003; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(level,time_limit); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(level),std::ref(time_limit)); } @@ -3700,32 +3765,40 @@ struct AdaptiveFilterOptions return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint8_t level = 0; ///< Auto-adaptive operating level:
0=Off,
1=Conservative,
2=Moderate (default),
3=Aggressive. + uint16_t time_limit = 0; ///< Maximum duration of measurement rejection before entering recovery mode (ms) + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_ADAPTIVE_FILTER_OPTIONS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "AdaptiveFilterOptions::Response"; static constexpr const char* DOC_NAME = "Adaptive Filter Control Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - uint8_t level = 0; ///< Auto-adaptive operating level:
0=Off,
1=Conservative,
2=Moderate (default),
3=Aggressive. - uint16_t time_limit = 0; ///< Maximum duration of measurement rejection before entering recovery mode (ms) - + auto asTuple() const + { + return std::make_tuple(level,time_limit); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(level),std::ref(time_limit)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const AdaptiveFilterOptions& self); -void extract(Serializer& serializer, AdaptiveFilterOptions& self); - -void insert(Serializer& serializer, const AdaptiveFilterOptions::Response& self); -void extract(Serializer& serializer, AdaptiveFilterOptions::Response& self); - TypedResult writeAdaptiveFilterOptions(C::mip_interface& device, uint8_t level, uint16_t timeLimit); TypedResult readAdaptiveFilterOptions(C::mip_interface& device, uint8_t* levelOut, uint16_t* timeLimitOut); TypedResult saveAdaptiveFilterOptions(C::mip_interface& device); @@ -3735,7 +3808,7 @@ TypedResult defaultAdaptiveFilterOptions(C::mip_interface ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_multi_antenna_offset (0x0D,0x54) Multi Antenna Offset [CPP] +///@defgroup filter_multi_antenna_offset_cpp (0x0D,0x54) Multi Antenna Offset /// Set the antenna lever arm. /// /// This command works with devices that utilize multiple antennas. @@ -3745,31 +3818,25 @@ TypedResult defaultAdaptiveFilterOptions(C::mip_interface struct MultiAntennaOffset { + /// Parameters FunctionSelector function = static_cast(0); uint8_t receiver_id = 0; ///< Receiver: 1, 2, etc... Vector3f antenna_offset; ///< Antenna lever arm offset vector in the vehicle frame (m) + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_MULTI_ANTENNA_OFFSET; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "MultiAntennaOffset"; static constexpr const char* DOC_NAME = "GNSS Multi-Antenna Offset Control"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8003; - static constexpr const uint32_t READ_PARAMS = 0x8001; - static constexpr const uint32_t SAVE_PARAMS = 0x8001; - static constexpr const uint32_t LOAD_PARAMS = 0x8001; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8001; - static constexpr const uint32_t ECHOED_PARAMS = 0x0001; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(receiver_id,antenna_offset); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(receiver_id),std::ref(antenna_offset)); } @@ -3782,32 +3849,40 @@ struct MultiAntennaOffset return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint8_t receiver_id = 0; + Vector3f antenna_offset; + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_MULTI_ANTENNA_OFFSET; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "MultiAntennaOffset::Response"; static constexpr const char* DOC_NAME = "GNSS Multi-Antenna Offset Control Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0001; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - uint8_t receiver_id = 0; - Vector3f antenna_offset; - + auto asTuple() const + { + return std::make_tuple(receiver_id,antenna_offset); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(receiver_id),std::ref(antenna_offset)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const MultiAntennaOffset& self); -void extract(Serializer& serializer, MultiAntennaOffset& self); - -void insert(Serializer& serializer, const MultiAntennaOffset::Response& self); -void extract(Serializer& serializer, MultiAntennaOffset::Response& self); - TypedResult writeMultiAntennaOffset(C::mip_interface& device, uint8_t receiverId, const float* antennaOffset); TypedResult readMultiAntennaOffset(C::mip_interface& device, uint8_t receiverId, float* antennaOffsetOut); TypedResult saveMultiAntennaOffset(C::mip_interface& device, uint8_t receiverId); @@ -3817,39 +3892,33 @@ TypedResult defaultMultiAntennaOffset(C::mip_interface& devi ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_rel_pos_configuration (0x0D,0x55) Rel Pos Configuration [CPP] +///@defgroup filter_rel_pos_configuration_cpp (0x0D,0x55) Rel Pos Configuration /// Configure the reference location for filter relative positioning outputs /// ///@{ struct RelPosConfiguration { + /// Parameters FunctionSelector function = static_cast(0); uint8_t source = 0; ///< 0 - auto (RTK base station), 1 - manual FilterReferenceFrame reference_frame_selector = static_cast(0); ///< ECEF or LLH Vector3d reference_coordinates; ///< reference coordinates, units determined by source selection + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_REL_POS_CONFIGURATION; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "RelPosConfiguration"; static constexpr const char* DOC_NAME = "Relative Position Configuration"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8007; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(source,reference_frame_selector,reference_coordinates); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(source),std::ref(reference_frame_selector),std::ref(reference_coordinates)); } @@ -3861,33 +3930,41 @@ struct RelPosConfiguration return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint8_t source = 0; ///< 0 - auto (RTK base station), 1 - manual + FilterReferenceFrame reference_frame_selector = static_cast(0); ///< ECEF or LLH + Vector3d reference_coordinates; ///< reference coordinates, units determined by source selection + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_REL_POS_CONFIGURATION; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "RelPosConfiguration::Response"; static constexpr const char* DOC_NAME = "Relative Position Configuration Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - uint8_t source = 0; ///< 0 - auto (RTK base station), 1 - manual - FilterReferenceFrame reference_frame_selector = static_cast(0); ///< ECEF or LLH - Vector3d reference_coordinates; ///< reference coordinates, units determined by source selection - + auto asTuple() const + { + return std::make_tuple(source,reference_frame_selector,reference_coordinates); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(source),std::ref(reference_frame_selector),std::ref(reference_coordinates)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const RelPosConfiguration& self); -void extract(Serializer& serializer, RelPosConfiguration& self); - -void insert(Serializer& serializer, const RelPosConfiguration::Response& self); -void extract(Serializer& serializer, RelPosConfiguration::Response& self); - TypedResult writeRelPosConfiguration(C::mip_interface& device, uint8_t source, FilterReferenceFrame referenceFrameSelector, const double* referenceCoordinates); TypedResult readRelPosConfiguration(C::mip_interface& device, uint8_t* sourceOut, FilterReferenceFrame* referenceFrameSelectorOut, double* referenceCoordinatesOut); TypedResult saveRelPosConfiguration(C::mip_interface& device); @@ -3897,7 +3974,7 @@ TypedResult defaultRelPosConfiguration(C::mip_interface& de ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_ref_point_lever_arm (0x0D,0x56) Ref Point Lever Arm [CPP] +///@defgroup filter_ref_point_lever_arm_cpp (0x0D,0x56) Ref Point Lever Arm /// Lever arm offset with respect to the sensor for the indicated point of reference. /// This is used to change the location of the indicated point of reference, and will affect filter position and velocity outputs. /// Changing this setting from default will result in a global position offset that depends on vehicle attitude, @@ -3916,31 +3993,25 @@ struct RefPointLeverArm VEH = 1, ///< Defines the origin of the vehicle }; + /// Parameters FunctionSelector function = static_cast(0); ReferencePointSelector ref_point_sel = static_cast(0); ///< Reserved, must be 1 Vector3f lever_arm_offset; ///< [m] Lever arm offset vector in the vehicle's reference frame. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_REF_POINT_LEVER_ARM; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "RefPointLeverArm"; static constexpr const char* DOC_NAME = "Reference point lever arm"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8003; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(ref_point_sel,lever_arm_offset); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(ref_point_sel),std::ref(lever_arm_offset)); } @@ -3952,32 +4023,40 @@ struct RefPointLeverArm return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + ReferencePointSelector ref_point_sel = static_cast(0); ///< Reserved, must be 1 + Vector3f lever_arm_offset; ///< [m] Lever arm offset vector in the vehicle's reference frame. + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_REF_POINT_LEVER_ARM; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "RefPointLeverArm::Response"; static constexpr const char* DOC_NAME = "Reference point lever arm Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - ReferencePointSelector ref_point_sel = static_cast(0); ///< Reserved, must be 1 - Vector3f lever_arm_offset; ///< [m] Lever arm offset vector in the vehicle's reference frame. - + auto asTuple() const + { + return std::make_tuple(ref_point_sel,lever_arm_offset); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(ref_point_sel),std::ref(lever_arm_offset)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const RefPointLeverArm& self); -void extract(Serializer& serializer, RefPointLeverArm& self); - -void insert(Serializer& serializer, const RefPointLeverArm::Response& self); -void extract(Serializer& serializer, RefPointLeverArm::Response& self); - TypedResult writeRefPointLeverArm(C::mip_interface& device, RefPointLeverArm::ReferencePointSelector refPointSel, const float* leverArmOffset); TypedResult readRefPointLeverArm(C::mip_interface& device, RefPointLeverArm::ReferencePointSelector* refPointSelOut, float* leverArmOffsetOut); TypedResult saveRefPointLeverArm(C::mip_interface& device); @@ -3987,7 +4066,7 @@ TypedResult defaultRefPointLeverArm(C::mip_interface& device); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_speed_measurement (0x0D,0x60) Speed Measurement [CPP] +///@defgroup filter_speed_measurement_cpp (0x0D,0x60) Speed Measurement /// Speed aiding measurement, where speed is defined as rate of motion along the vehicle's x-axis direction. /// Can be used by an external odometer/speedometer, for example. /// This command cannot be used if the internal odometer is configured. @@ -3996,40 +4075,42 @@ TypedResult defaultRefPointLeverArm(C::mip_interface& device); struct SpeedMeasurement { + /// Parameters uint8_t source = 0; ///< Reserved, must be 1. float time_of_week = 0; ///< GPS time of week when speed was sampled float speed = 0; ///< Estimated speed along vehicle's x-axis (may be positive or negative) [meters/second] float speed_uncertainty = 0; ///< Estimated uncertainty in the speed measurement (1-sigma value) [meters/second] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_SPEED_MEASUREMENT; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "SpeedMeasurement"; static constexpr const char* DOC_NAME = "Input speed measurement"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(source,time_of_week,speed,speed_uncertainty); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(source),std::ref(time_of_week),std::ref(speed),std::ref(speed_uncertainty)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + typedef void Response; }; -void insert(Serializer& serializer, const SpeedMeasurement& self); -void extract(Serializer& serializer, SpeedMeasurement& self); - TypedResult speedMeasurement(C::mip_interface& device, uint8_t source, float timeOfWeek, float speed, float speedUncertainty); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_speed_lever_arm (0x0D,0x61) Speed Lever Arm [CPP] +///@defgroup filter_speed_lever_arm_cpp (0x0D,0x61) Speed Lever Arm /// Lever arm offset for speed measurements. /// This is used to compensate for an off-center measurement point /// having a different speed due to rotation of the vehicle. @@ -4042,31 +4123,25 @@ TypedResult speedMeasurement(C::mip_interface& device, uint8_t struct SpeedLeverArm { + /// Parameters FunctionSelector function = static_cast(0); uint8_t source = 0; ///< Reserved, must be 1. Vector3f lever_arm_offset; ///< [m] Lever arm offset vector in the vehicle's reference frame. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_SPEED_LEVER_ARM; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "SpeedLeverArm"; static constexpr const char* DOC_NAME = "Measurement speed lever arm"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8003; - static constexpr const uint32_t READ_PARAMS = 0x8001; - static constexpr const uint32_t SAVE_PARAMS = 0x8001; - static constexpr const uint32_t LOAD_PARAMS = 0x8001; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8001; - static constexpr const uint32_t ECHOED_PARAMS = 0x0001; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(source,lever_arm_offset); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(source),std::ref(lever_arm_offset)); } @@ -4079,32 +4154,40 @@ struct SpeedLeverArm return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint8_t source = 0; ///< Reserved, must be 1. + Vector3f lever_arm_offset; ///< [m] Lever arm offset vector in the vehicle's reference frame. + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_SPEED_LEVER_ARM; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "SpeedLeverArm::Response"; static constexpr const char* DOC_NAME = "Measurement speed lever arm Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0001; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - uint8_t source = 0; ///< Reserved, must be 1. - Vector3f lever_arm_offset; ///< [m] Lever arm offset vector in the vehicle's reference frame. - + auto asTuple() const + { + return std::make_tuple(source,lever_arm_offset); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(source),std::ref(lever_arm_offset)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const SpeedLeverArm& self); -void extract(Serializer& serializer, SpeedLeverArm& self); - -void insert(Serializer& serializer, const SpeedLeverArm::Response& self); -void extract(Serializer& serializer, SpeedLeverArm::Response& self); - TypedResult writeSpeedLeverArm(C::mip_interface& device, uint8_t source, const float* leverArmOffset); TypedResult readSpeedLeverArm(C::mip_interface& device, uint8_t source, float* leverArmOffsetOut); TypedResult saveSpeedLeverArm(C::mip_interface& device, uint8_t source); @@ -4114,7 +4197,7 @@ TypedResult defaultSpeedLeverArm(C::mip_interface& device, uint8_ ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_wheeled_vehicle_constraint_control (0x0D,0x63) Wheeled Vehicle Constraint Control [CPP] +///@defgroup filter_wheeled_vehicle_constraint_control_cpp (0x0D,0x63) Wheeled Vehicle Constraint Control /// Configure the wheeled vehicle kinematic constraint. /// /// When enabled, the filter uses the assumption that velocity is constrained to the primary vehicle axis. @@ -4127,30 +4210,24 @@ TypedResult defaultSpeedLeverArm(C::mip_interface& device, uint8_ struct WheeledVehicleConstraintControl { + /// Parameters FunctionSelector function = static_cast(0); uint8_t enable = 0; ///< 0 - Disable, 1 - Enable + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_VEHICLE_CONSTRAINT_CONTROL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "WheeledVehicleConstraintControl"; static constexpr const char* DOC_NAME = "Wheeled Vehicle Constraint Control"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8001; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(enable); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(enable)); } @@ -4162,31 +4239,39 @@ struct WheeledVehicleConstraintControl return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint8_t enable = 0; ///< 0 - Disable, 1 - Enable + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_VEHICLE_CONSTRAINT_CONTROL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "WheeledVehicleConstraintControl::Response"; static constexpr const char* DOC_NAME = "Wheeled Vehicle Constraint Control Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - uint8_t enable = 0; ///< 0 - Disable, 1 - Enable - + auto asTuple() const + { + return std::make_tuple(enable); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(enable)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const WheeledVehicleConstraintControl& self); -void extract(Serializer& serializer, WheeledVehicleConstraintControl& self); - -void insert(Serializer& serializer, const WheeledVehicleConstraintControl::Response& self); -void extract(Serializer& serializer, WheeledVehicleConstraintControl::Response& self); - TypedResult writeWheeledVehicleConstraintControl(C::mip_interface& device, uint8_t enable); TypedResult readWheeledVehicleConstraintControl(C::mip_interface& device, uint8_t* enableOut); TypedResult saveWheeledVehicleConstraintControl(C::mip_interface& device); @@ -4196,7 +4281,7 @@ TypedResult defaultWheeledVehicleConstraintCont ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_vertical_gyro_constraint_control (0x0D,0x62) Vertical Gyro Constraint Control [CPP] +///@defgroup filter_vertical_gyro_constraint_control_cpp (0x0D,0x62) Vertical Gyro Constraint Control /// Configure the vertical gyro kinematic constraint. /// /// When enabled and no valid GNSS measurements are available, the filter uses the accelerometers to track pitch @@ -4207,30 +4292,24 @@ TypedResult defaultWheeledVehicleConstraintCont struct VerticalGyroConstraintControl { + /// Parameters FunctionSelector function = static_cast(0); uint8_t enable = 0; ///< 0 - Disable, 1 - Enable + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_GYRO_CONSTRAINT_CONTROL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "VerticalGyroConstraintControl"; static constexpr const char* DOC_NAME = "Vertical Gyro Constraint Control"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8001; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(enable); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(enable)); } @@ -4242,31 +4321,39 @@ struct VerticalGyroConstraintControl return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint8_t enable = 0; ///< 0 - Disable, 1 - Enable + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_GYRO_CONSTRAINT_CONTROL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "VerticalGyroConstraintControl::Response"; static constexpr const char* DOC_NAME = "Vertical Gyro Constraint Control Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - uint8_t enable = 0; ///< 0 - Disable, 1 - Enable - + auto asTuple() const + { + return std::make_tuple(enable); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(enable)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const VerticalGyroConstraintControl& self); -void extract(Serializer& serializer, VerticalGyroConstraintControl& self); - -void insert(Serializer& serializer, const VerticalGyroConstraintControl::Response& self); -void extract(Serializer& serializer, VerticalGyroConstraintControl::Response& self); - TypedResult writeVerticalGyroConstraintControl(C::mip_interface& device, uint8_t enable); TypedResult readVerticalGyroConstraintControl(C::mip_interface& device, uint8_t* enableOut); TypedResult saveVerticalGyroConstraintControl(C::mip_interface& device); @@ -4276,7 +4363,7 @@ TypedResult defaultVerticalGyroConstraintControl( ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_gnss_antenna_cal_control (0x0D,0x64) Gnss Antenna Cal Control [CPP] +///@defgroup filter_gnss_antenna_cal_control_cpp (0x0D,0x64) Gnss Antenna Cal Control /// Configure the GNSS antenna lever arm calibration. /// /// When enabled, the filter will enable lever arm error tracking, up to the maximum offset specified. @@ -4285,31 +4372,25 @@ TypedResult defaultVerticalGyroConstraintControl( struct GnssAntennaCalControl { + /// Parameters FunctionSelector function = static_cast(0); uint8_t enable = 0; ///< 0 - Disable, 1 - Enable float max_offset = 0; ///< Maximum absolute value of lever arm offset error in the vehicle frame [meters]. See device user manual for the valid range of this parameter. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_ANTENNA_CALIBRATION_CONTROL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GnssAntennaCalControl"; static constexpr const char* DOC_NAME = "GNSS Antenna Offset Calibration Control"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8003; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(enable,max_offset); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(enable),std::ref(max_offset)); } @@ -4321,32 +4402,40 @@ struct GnssAntennaCalControl return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint8_t enable = 0; ///< 0 - Disable, 1 - Enable + float max_offset = 0; ///< Maximum absolute value of lever arm offset error in the vehicle frame [meters]. See device user manual for the valid range of this parameter. + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::REPLY_ANTENNA_CALIBRATION_CONTROL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GnssAntennaCalControl::Response"; static constexpr const char* DOC_NAME = "GNSS Antenna Offset Calibration Control Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - uint8_t enable = 0; ///< 0 - Disable, 1 - Enable - float max_offset = 0; ///< Maximum absolute value of lever arm offset error in the vehicle frame [meters]. See device user manual for the valid range of this parameter. - + auto asTuple() const + { + return std::make_tuple(enable,max_offset); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(enable),std::ref(max_offset)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const GnssAntennaCalControl& self); -void extract(Serializer& serializer, GnssAntennaCalControl& self); - -void insert(Serializer& serializer, const GnssAntennaCalControl::Response& self); -void extract(Serializer& serializer, GnssAntennaCalControl::Response& self); - TypedResult writeGnssAntennaCalControl(C::mip_interface& device, uint8_t enable, float maxOffset); TypedResult readGnssAntennaCalControl(C::mip_interface& device, uint8_t* enableOut, float* maxOffsetOut); TypedResult saveGnssAntennaCalControl(C::mip_interface& device); @@ -4356,7 +4445,7 @@ TypedResult defaultGnssAntennaCalControl(C::mip_interface ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_set_initial_heading (0x0D,0x03) Set Initial Heading [CPP] +///@defgroup filter_set_initial_heading_cpp (0x0D,0x03) Set Initial Heading /// Set the initial heading angle. /// /// The estimation filter will reset the heading estimate to provided value. If the product supports magnetometer aiding and this feature has been enabled, the heading @@ -4366,31 +4455,33 @@ TypedResult defaultGnssAntennaCalControl(C::mip_interface struct SetInitialHeading { + /// Parameters float heading = 0; ///< Initial heading in radians [-pi, pi] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_filter::CMD_SET_INITIAL_HEADING; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "SetInitialHeading"; static constexpr const char* DOC_NAME = "Set Initial Heading Control"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(heading); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(heading)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + typedef void Response; }; -void insert(Serializer& serializer, const SetInitialHeading& self); -void extract(Serializer& serializer, SetInitialHeading& self); - TypedResult setInitialHeading(C::mip_interface& device, float heading); ///@} diff --git a/src/mip/definitions/commands_gnss.cpp b/src/cpp/mip/definitions/commands_gnss.cpp similarity index 51% rename from src/mip/definitions/commands_gnss.cpp rename to src/cpp/mip/definitions/commands_gnss.cpp index f980f2e9c..0daf3cf77 100644 --- a/src/mip/definitions/commands_gnss.cpp +++ b/src/cpp/mip/definitions/commands_gnss.cpp @@ -1,79 +1,68 @@ #include "commands_gnss.hpp" -#include "../utils/serialization.h" -#include "../mip_interface.h" +#include +#include #include namespace mip { -class Serializer; - namespace C { struct mip_interface; } // namespace C namespace commands_gnss { -using ::mip::insert; -using ::mip::extract; using namespace ::mip::C; -//////////////////////////////////////////////////////////////////////////////// -// Shared Type Definitions -//////////////////////////////////////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////////////////////// // Mip Fields //////////////////////////////////////////////////////////////////////////////// -void insert(Serializer& serializer, const ReceiverInfo& self) +void ReceiverInfo::Info::insert(Serializer& serializer) const { - (void)serializer; - (void)self; + serializer.insert(receiver_id); + + serializer.insert(mip_data_descriptor_set); + + for(unsigned int i=0; i < 32; i++) + serializer.insert(description[i]); + } -void extract(Serializer& serializer, ReceiverInfo& self) +void ReceiverInfo::Info::extract(Serializer& serializer) { - (void)serializer; - (void)self; + serializer.extract(receiver_id); + + serializer.extract(mip_data_descriptor_set); + + for(unsigned int i=0; i < 32; i++) + serializer.extract(description[i]); + } -void insert(Serializer& serializer, const ReceiverInfo::Response& self) +void ReceiverInfo::insert(Serializer& serializer) const { - insert(serializer, self.num_receivers); - - for(unsigned int i=0; i < self.num_receivers; i++) - insert(serializer, self.receiver_info[i]); - + (void)serializer; } -void extract(Serializer& serializer, ReceiverInfo::Response& self) +void ReceiverInfo::extract(Serializer& serializer) { - C::extract_count(&serializer, &self.num_receivers, sizeof(self.receiver_info)/sizeof(self.receiver_info[0])); - for(unsigned int i=0; i < self.num_receivers; i++) - extract(serializer, self.receiver_info[i]); - + (void)serializer; } -void insert(Serializer& serializer, const ReceiverInfo::Info& self) +void ReceiverInfo::Response::insert(Serializer& serializer) const { - insert(serializer, self.receiver_id); - - insert(serializer, self.mip_data_descriptor_set); + serializer.insert(num_receivers); - for(unsigned int i=0; i < 32; i++) - insert(serializer, self.description[i]); + for(unsigned int i=0; i < num_receivers; i++) + serializer.insert(receiver_info[i]); } -void extract(Serializer& serializer, ReceiverInfo::Info& self) +void ReceiverInfo::Response::extract(Serializer& serializer) { - extract(serializer, self.receiver_id); - - extract(serializer, self.mip_data_descriptor_set); - - for(unsigned int i=0; i < 32; i++) - extract(serializer, self.description[i]); + serializer.extract_count(num_receivers, sizeof(receiver_info)/sizeof(receiver_info[0])); + for(unsigned int i=0; i < num_receivers; i++) + serializer.extract(receiver_info[i]); } @@ -88,81 +77,81 @@ TypedResult receiverInfo(C::mip_interface& device, uint8_t* numRec { Serializer deserializer(buffer, responseLength); - C::extract_count(&deserializer, numReceiversOut, numReceiversOutMax); + deserializer.extract_count(*numReceiversOut, numReceiversOutMax); assert(receiverInfoOut || (numReceiversOut == 0)); for(unsigned int i=0; i < *numReceiversOut; i++) - extract(deserializer, receiverInfoOut[i]); + deserializer.extract(receiverInfoOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; } return result; } -void insert(Serializer& serializer, const SignalConfiguration& self) +void SignalConfiguration::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.gps_enable); + serializer.insert(gps_enable); - insert(serializer, self.glonass_enable); + serializer.insert(glonass_enable); - insert(serializer, self.galileo_enable); + serializer.insert(galileo_enable); - insert(serializer, self.beidou_enable); + serializer.insert(beidou_enable); for(unsigned int i=0; i < 4; i++) - insert(serializer, self.reserved[i]); + serializer.insert(reserved[i]); } } -void extract(Serializer& serializer, SignalConfiguration& self) +void SignalConfiguration::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.gps_enable); + serializer.extract(gps_enable); - extract(serializer, self.glonass_enable); + serializer.extract(glonass_enable); - extract(serializer, self.galileo_enable); + serializer.extract(galileo_enable); - extract(serializer, self.beidou_enable); + serializer.extract(beidou_enable); for(unsigned int i=0; i < 4; i++) - extract(serializer, self.reserved[i]); + serializer.extract(reserved[i]); } } -void insert(Serializer& serializer, const SignalConfiguration::Response& self) +void SignalConfiguration::Response::insert(Serializer& serializer) const { - insert(serializer, self.gps_enable); + serializer.insert(gps_enable); - insert(serializer, self.glonass_enable); + serializer.insert(glonass_enable); - insert(serializer, self.galileo_enable); + serializer.insert(galileo_enable); - insert(serializer, self.beidou_enable); + serializer.insert(beidou_enable); for(unsigned int i=0; i < 4; i++) - insert(serializer, self.reserved[i]); + serializer.insert(reserved[i]); } -void extract(Serializer& serializer, SignalConfiguration::Response& self) +void SignalConfiguration::Response::extract(Serializer& serializer) { - extract(serializer, self.gps_enable); + serializer.extract(gps_enable); - extract(serializer, self.glonass_enable); + serializer.extract(glonass_enable); - extract(serializer, self.galileo_enable); + serializer.extract(galileo_enable); - extract(serializer, self.beidou_enable); + serializer.extract(beidou_enable); for(unsigned int i=0; i < 4; i++) - extract(serializer, self.reserved[i]); + serializer.extract(reserved[i]); } @@ -171,53 +160,53 @@ TypedResult writeSignalConfiguration(C::mip_interface& devi uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, gpsEnable); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(gpsEnable); - insert(serializer, glonassEnable); + serializer.insert(glonassEnable); - insert(serializer, galileoEnable); + serializer.insert(galileoEnable); - insert(serializer, beidouEnable); + serializer.insert(beidouEnable); - assert(reserved || (4 == 0)); + assert(reserved); for(unsigned int i=0; i < 4; i++) - insert(serializer, reserved[i]); + serializer.insert(reserved[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SIGNAL_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SIGNAL_CONFIGURATION, buffer, (uint8_t)serializer.usedLength()); } TypedResult readSignalConfiguration(C::mip_interface& device, uint8_t* gpsEnableOut, uint8_t* glonassEnableOut, uint8_t* galileoEnableOut, uint8_t* beidouEnableOut, uint8_t* reservedOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_SIGNAL_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_SIGNAL_CONFIGURATION, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_SIGNAL_CONFIGURATION, buffer, (uint8_t)serializer.usedLength(), REPLY_SIGNAL_CONFIGURATION, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(gpsEnableOut); - extract(deserializer, *gpsEnableOut); + deserializer.extract(*gpsEnableOut); assert(glonassEnableOut); - extract(deserializer, *glonassEnableOut); + deserializer.extract(*glonassEnableOut); assert(galileoEnableOut); - extract(deserializer, *galileoEnableOut); + deserializer.extract(*galileoEnableOut); assert(beidouEnableOut); - extract(deserializer, *beidouEnableOut); + deserializer.extract(*beidouEnableOut); - assert(reservedOut || (4 == 0)); + assert(reservedOut); for(unsigned int i=0; i < 4; i++) - extract(deserializer, reservedOut[i]); + deserializer.extract(reservedOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -229,72 +218,72 @@ TypedResult saveSignalConfiguration(C::mip_interface& devic uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SIGNAL_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SIGNAL_CONFIGURATION, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadSignalConfiguration(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SIGNAL_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SIGNAL_CONFIGURATION, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultSignalConfiguration(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SIGNAL_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_SIGNAL_CONFIGURATION, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const RtkDongleConfiguration& self) +void RtkDongleConfiguration::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.enable); + serializer.insert(enable); for(unsigned int i=0; i < 3; i++) - insert(serializer, self.reserved[i]); + serializer.insert(reserved[i]); } } -void extract(Serializer& serializer, RtkDongleConfiguration& self) +void RtkDongleConfiguration::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.enable); + serializer.extract(enable); for(unsigned int i=0; i < 3; i++) - extract(serializer, self.reserved[i]); + serializer.extract(reserved[i]); } } -void insert(Serializer& serializer, const RtkDongleConfiguration::Response& self) +void RtkDongleConfiguration::Response::insert(Serializer& serializer) const { - insert(serializer, self.enable); + serializer.insert(enable); for(unsigned int i=0; i < 3; i++) - insert(serializer, self.reserved[i]); + serializer.insert(reserved[i]); } -void extract(Serializer& serializer, RtkDongleConfiguration::Response& self) +void RtkDongleConfiguration::Response::extract(Serializer& serializer) { - extract(serializer, self.enable); + serializer.extract(enable); for(unsigned int i=0; i < 3; i++) - extract(serializer, self.reserved[i]); + serializer.extract(reserved[i]); } @@ -303,38 +292,38 @@ TypedResult writeRtkDongleConfiguration(C::mip_interface uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, enable); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(enable); - assert(reserved || (3 == 0)); + assert(reserved); for(unsigned int i=0; i < 3; i++) - insert(serializer, reserved[i]); + serializer.insert(reserved[i]); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_RTK_DONGLE_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_RTK_DONGLE_CONFIGURATION, buffer, (uint8_t)serializer.usedLength()); } TypedResult readRtkDongleConfiguration(C::mip_interface& device, uint8_t* enableOut, uint8_t* reservedOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_RTK_DONGLE_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_RTK_DONGLE_CONFIGURATION, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_RTK_DONGLE_CONFIGURATION, buffer, (uint8_t)serializer.usedLength(), REPLY_RTK_DONGLE_CONFIGURATION, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(enableOut); - extract(deserializer, *enableOut); + deserializer.extract(*enableOut); - assert(reservedOut || (3 == 0)); + assert(reservedOut); for(unsigned int i=0; i < 3; i++) - extract(deserializer, reservedOut[i]); + deserializer.extract(reservedOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -346,30 +335,30 @@ TypedResult saveRtkDongleConfiguration(C::mip_interface& uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_RTK_DONGLE_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_RTK_DONGLE_CONFIGURATION, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadRtkDongleConfiguration(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_RTK_DONGLE_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_RTK_DONGLE_CONFIGURATION, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultRtkDongleConfiguration(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_RTK_DONGLE_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_RTK_DONGLE_CONFIGURATION, buffer, (uint8_t)serializer.usedLength()); } } // namespace commands_gnss diff --git a/src/mip/definitions/commands_gnss.hpp b/src/cpp/mip/definitions/commands_gnss.hpp similarity index 75% rename from src/mip/definitions/commands_gnss.hpp rename to src/cpp/mip/definitions/commands_gnss.hpp index 7f3471d7d..27a1f922b 100644 --- a/src/mip/definitions/commands_gnss.hpp +++ b/src/cpp/mip/definitions/commands_gnss.hpp @@ -1,16 +1,14 @@ #pragma once -#include "common.h" -#include "descriptors.h" -#include "../mip_result.h" +#include +#include +#include +#include #include #include -#include namespace mip { -class Serializer; - namespace C { struct mip_interface; } // namespace C @@ -18,9 +16,9 @@ struct mip_interface; namespace commands_gnss { //////////////////////////////////////////////////////////////////////////////// -///@addtogroup MipCommands_cpp MIP Commands [CPP] +///@addtogroup MipCommands_cpp ///@{ -///@defgroup gnss_commands_cpp Gnss Commands [CPP] +///@defgroup gnss_commands_cpp Gnss Commands /// ///@{ @@ -47,19 +45,22 @@ enum static constexpr const uint16_t GNSS_GPS_ENABLE_L1CA = 0x0001; static constexpr const uint16_t GNSS_GPS_ENABLE_L2C = 0x0002; +static constexpr const uint16_t GNSS_GPS_ENABLE_L5 = 0x0004; static constexpr const uint16_t GNSS_GLONASS_ENABLE_L1OF = 0x0001; static constexpr const uint16_t GNSS_GLONASS_ENABLE_L2OF = 0x0002; static constexpr const uint16_t GNSS_GALILEO_ENABLE_E1 = 0x0001; static constexpr const uint16_t GNSS_GALILEO_ENABLE_E5B = 0x0002; +static constexpr const uint16_t GNSS_GALILEO_ENABLE_E5A = 0x0004; static constexpr const uint16_t GNSS_BEIDOU_ENABLE_B1 = 0x0001; static constexpr const uint16_t GNSS_BEIDOU_ENABLE_B2 = 0x0002; +static constexpr const uint16_t GNSS_BEIDOU_ENABLE_B2A = 0x0004; //////////////////////////////////////////////////////////////////////////////// // Mip Fields //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_gnss_receiver_info (0x0E,0x01) Receiver Info [CPP] +///@defgroup gnss_receiver_info_cpp (0x0E,0x01) Receiver Info /// Return information about the GNSS receivers in the device. /// /// @@ -69,66 +70,74 @@ struct ReceiverInfo { struct Info { + /// Parameters uint8_t receiver_id = 0; ///< Receiver id: e.g. 1, 2, etc. uint8_t mip_data_descriptor_set = 0; ///< MIP descriptor set associated with this receiver char description[32] = {0}; ///< Ascii description of receiver. Contains the following info (comma-delimited):
Module name/model
Firmware version info + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; - + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_gnss::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_gnss::CMD_LIST_RECEIVERS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ReceiverInfo"; static constexpr const char* DOC_NAME = "ReceiverInfo"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(); } - auto as_tuple() + auto asTuple() { return std::make_tuple(); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint8_t num_receivers = 0; ///< Number of physical receivers in the device + Info receiver_info[5]; + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_gnss::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_gnss::REPLY_LIST_RECEIVERS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ReceiverInfo::Response"; static constexpr const char* DOC_NAME = "ReceiverInfo Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x0000000C; - uint8_t num_receivers = 0; ///< Number of physical receivers in the device - Info receiver_info[5]; - + auto asTuple() const + { + return std::make_tuple(num_receivers,receiver_info); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(num_receivers),std::ref(receiver_info)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const ReceiverInfo& self); -void extract(Serializer& serializer, ReceiverInfo& self); - -void insert(Serializer& serializer, const ReceiverInfo::Info& self); -void extract(Serializer& serializer, ReceiverInfo::Info& self); - -void insert(Serializer& serializer, const ReceiverInfo::Response& self); -void extract(Serializer& serializer, ReceiverInfo::Response& self); - TypedResult receiverInfo(C::mip_interface& device, uint8_t* numReceiversOut, uint8_t numReceiversOutMax, ReceiverInfo::Info* receiverInfoOut); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_gnss_signal_configuration (0x0E,0x02) Signal Configuration [CPP] +///@defgroup gnss_signal_configuration_cpp (0x0E,0x02) Signal Configuration /// Configure the GNSS signals used by the device. /// /// @@ -136,34 +145,28 @@ TypedResult receiverInfo(C::mip_interface& device, uint8_t* numRec struct SignalConfiguration { + /// Parameters FunctionSelector function = static_cast(0); - uint8_t gps_enable = 0; ///< Bitfield 0: Enable L1CA, 1: Enable L2C + uint8_t gps_enable = 0; ///< Bitfield 0: Enable L1CA, 1: Enable L2C, 2: Enable L5 uint8_t glonass_enable = 0; ///< Bitfield 0: Enable L1OF, 1: Enable L2OF - uint8_t galileo_enable = 0; ///< Bitfield 0: Enable E1, 1: Enable E5B - uint8_t beidou_enable = 0; ///< Bitfield 0: Enable B1, 1: Enable B2 + uint8_t galileo_enable = 0; ///< Bitfield 0: Enable E1, 1: Enable E5B, 2: Enable E5A + uint8_t beidou_enable = 0; ///< Bitfield 0: Enable B1, 1: Enable B2, 2: Enable B2A uint8_t reserved[4] = {0}; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_gnss::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_gnss::CMD_SIGNAL_CONFIGURATION; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "SignalConfiguration"; static constexpr const char* DOC_NAME = "SignalConfiguration"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x801F; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(gps_enable,glonass_enable,galileo_enable,beidou_enable,reserved); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(gps_enable),std::ref(glonass_enable),std::ref(galileo_enable),std::ref(beidou_enable),std::ref(reserved)); } @@ -175,35 +178,43 @@ struct SignalConfiguration return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint8_t gps_enable = 0; ///< Bitfield 0: Enable L1CA, 1: Enable L2C, 2: Enable L5 + uint8_t glonass_enable = 0; ///< Bitfield 0: Enable L1OF, 1: Enable L2OF + uint8_t galileo_enable = 0; ///< Bitfield 0: Enable E1, 1: Enable E5B, 2: Enable E5A + uint8_t beidou_enable = 0; ///< Bitfield 0: Enable B1, 1: Enable B2, 2: Enable B2A + uint8_t reserved[4] = {0}; + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_gnss::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_gnss::REPLY_SIGNAL_CONFIGURATION; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "SignalConfiguration::Response"; static constexpr const char* DOC_NAME = "SignalConfiguration Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - uint8_t gps_enable = 0; ///< Bitfield 0: Enable L1CA, 1: Enable L2C - uint8_t glonass_enable = 0; ///< Bitfield 0: Enable L1OF, 1: Enable L2OF - uint8_t galileo_enable = 0; ///< Bitfield 0: Enable E1, 1: Enable E5B - uint8_t beidou_enable = 0; ///< Bitfield 0: Enable B1, 1: Enable B2 - uint8_t reserved[4] = {0}; - + auto asTuple() const + { + return std::make_tuple(gps_enable,glonass_enable,galileo_enable,beidou_enable,reserved); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(gps_enable),std::ref(glonass_enable),std::ref(galileo_enable),std::ref(beidou_enable),std::ref(reserved)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const SignalConfiguration& self); -void extract(Serializer& serializer, SignalConfiguration& self); - -void insert(Serializer& serializer, const SignalConfiguration::Response& self); -void extract(Serializer& serializer, SignalConfiguration::Response& self); - TypedResult writeSignalConfiguration(C::mip_interface& device, uint8_t gpsEnable, uint8_t glonassEnable, uint8_t galileoEnable, uint8_t beidouEnable, const uint8_t* reserved); TypedResult readSignalConfiguration(C::mip_interface& device, uint8_t* gpsEnableOut, uint8_t* glonassEnableOut, uint8_t* galileoEnableOut, uint8_t* beidouEnableOut, uint8_t* reservedOut); TypedResult saveSignalConfiguration(C::mip_interface& device); @@ -213,7 +224,7 @@ TypedResult defaultSignalConfiguration(C::mip_interface& de ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_gnss_rtk_dongle_configuration (0x0E,0x10) Rtk Dongle Configuration [CPP] +///@defgroup gnss_rtk_dongle_configuration_cpp (0x0E,0x10) Rtk Dongle Configuration /// Configure the communications with the RTK Dongle connected to the device. /// /// @@ -221,31 +232,25 @@ TypedResult defaultSignalConfiguration(C::mip_interface& de struct RtkDongleConfiguration { + /// Parameters FunctionSelector function = static_cast(0); uint8_t enable = 0; ///< 0 - Disabled, 1- Enabled uint8_t reserved[3] = {0}; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_gnss::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_gnss::CMD_RTK_DONGLE_CONFIGURATION; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "RtkDongleConfiguration"; static constexpr const char* DOC_NAME = "RtkDongleConfiguration"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8003; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(enable,reserved); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(enable),std::ref(reserved)); } @@ -257,32 +262,40 @@ struct RtkDongleConfiguration return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint8_t enable = 0; + uint8_t reserved[3] = {0}; + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_gnss::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_gnss::REPLY_RTK_DONGLE_CONFIGURATION; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "RtkDongleConfiguration::Response"; static constexpr const char* DOC_NAME = "RtkDongleConfiguration Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - uint8_t enable = 0; - uint8_t reserved[3] = {0}; - + auto asTuple() const + { + return std::make_tuple(enable,reserved); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(enable),std::ref(reserved)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const RtkDongleConfiguration& self); -void extract(Serializer& serializer, RtkDongleConfiguration& self); - -void insert(Serializer& serializer, const RtkDongleConfiguration::Response& self); -void extract(Serializer& serializer, RtkDongleConfiguration::Response& self); - TypedResult writeRtkDongleConfiguration(C::mip_interface& device, uint8_t enable, const uint8_t* reserved); TypedResult readRtkDongleConfiguration(C::mip_interface& device, uint8_t* enableOut, uint8_t* reservedOut); TypedResult saveRtkDongleConfiguration(C::mip_interface& device); diff --git a/src/mip/definitions/commands_rtk.cpp b/src/cpp/mip/definitions/commands_rtk.cpp similarity index 57% rename from src/mip/definitions/commands_rtk.cpp rename to src/cpp/mip/definitions/commands_rtk.cpp index 2ec4b6dd2..72e2ee86e 100644 --- a/src/mip/definitions/commands_rtk.cpp +++ b/src/cpp/mip/definitions/commands_rtk.cpp @@ -1,53 +1,42 @@ #include "commands_rtk.hpp" -#include "../utils/serialization.h" -#include "../mip_interface.h" +#include +#include #include namespace mip { -class Serializer; - namespace C { struct mip_interface; } // namespace C namespace commands_rtk { -using ::mip::insert; -using ::mip::extract; using namespace ::mip::C; -//////////////////////////////////////////////////////////////////////////////// -// Shared Type Definitions -//////////////////////////////////////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////////////////////// // Mip Fields //////////////////////////////////////////////////////////////////////////////// -void insert(Serializer& serializer, const GetStatusFlags& self) +void GetStatusFlags::insert(Serializer& serializer) const { (void)serializer; - (void)self; } -void extract(Serializer& serializer, GetStatusFlags& self) +void GetStatusFlags::extract(Serializer& serializer) { (void)serializer; - (void)self; } -void insert(Serializer& serializer, const GetStatusFlags::Response& self) +void GetStatusFlags::Response::insert(Serializer& serializer) const { - insert(serializer, self.flags); + serializer.insert(flags); } -void extract(Serializer& serializer, GetStatusFlags::Response& self) +void GetStatusFlags::Response::extract(Serializer& serializer) { - extract(serializer, self.flags); + serializer.extract(flags); } @@ -63,34 +52,32 @@ TypedResult getStatusFlags(C::mip_interface& device, GetStatusFl Serializer deserializer(buffer, responseLength); assert(flagsOut); - extract(deserializer, *flagsOut); + deserializer.extract(*flagsOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; } return result; } -void insert(Serializer& serializer, const GetImei& self) +void GetImei::insert(Serializer& serializer) const { (void)serializer; - (void)self; } -void extract(Serializer& serializer, GetImei& self) +void GetImei::extract(Serializer& serializer) { (void)serializer; - (void)self; } -void insert(Serializer& serializer, const GetImei::Response& self) +void GetImei::Response::insert(Serializer& serializer) const { for(unsigned int i=0; i < 32; i++) - insert(serializer, self.IMEI[i]); + serializer.insert(IMEI[i]); } -void extract(Serializer& serializer, GetImei::Response& self) +void GetImei::Response::extract(Serializer& serializer) { for(unsigned int i=0; i < 32; i++) - extract(serializer, self.IMEI[i]); + serializer.extract(IMEI[i]); } @@ -105,36 +92,34 @@ TypedResult getImei(C::mip_interface& device, char* imeiOut) { Serializer deserializer(buffer, responseLength); - assert(imeiOut || (32 == 0)); + assert(imeiOut); for(unsigned int i=0; i < 32; i++) - extract(deserializer, imeiOut[i]); + deserializer.extract(imeiOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; } return result; } -void insert(Serializer& serializer, const GetImsi& self) +void GetImsi::insert(Serializer& serializer) const { (void)serializer; - (void)self; } -void extract(Serializer& serializer, GetImsi& self) +void GetImsi::extract(Serializer& serializer) { (void)serializer; - (void)self; } -void insert(Serializer& serializer, const GetImsi::Response& self) +void GetImsi::Response::insert(Serializer& serializer) const { for(unsigned int i=0; i < 32; i++) - insert(serializer, self.IMSI[i]); + serializer.insert(IMSI[i]); } -void extract(Serializer& serializer, GetImsi::Response& self) +void GetImsi::Response::extract(Serializer& serializer) { for(unsigned int i=0; i < 32; i++) - extract(serializer, self.IMSI[i]); + serializer.extract(IMSI[i]); } @@ -149,36 +134,34 @@ TypedResult getImsi(C::mip_interface& device, char* imsiOut) { Serializer deserializer(buffer, responseLength); - assert(imsiOut || (32 == 0)); + assert(imsiOut); for(unsigned int i=0; i < 32; i++) - extract(deserializer, imsiOut[i]); + deserializer.extract(imsiOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; } return result; } -void insert(Serializer& serializer, const GetIccid& self) +void GetIccid::insert(Serializer& serializer) const { (void)serializer; - (void)self; } -void extract(Serializer& serializer, GetIccid& self) +void GetIccid::extract(Serializer& serializer) { (void)serializer; - (void)self; } -void insert(Serializer& serializer, const GetIccid::Response& self) +void GetIccid::Response::insert(Serializer& serializer) const { for(unsigned int i=0; i < 32; i++) - insert(serializer, self.ICCID[i]); + serializer.insert(ICCID[i]); } -void extract(Serializer& serializer, GetIccid::Response& self) +void GetIccid::Response::extract(Serializer& serializer) { for(unsigned int i=0; i < 32; i++) - extract(serializer, self.ICCID[i]); + serializer.extract(ICCID[i]); } @@ -193,44 +176,44 @@ TypedResult getIccid(C::mip_interface& device, char* iccidOut) { Serializer deserializer(buffer, responseLength); - assert(iccidOut || (32 == 0)); + assert(iccidOut); for(unsigned int i=0; i < 32; i++) - extract(deserializer, iccidOut[i]); + deserializer.extract(iccidOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; } return result; } -void insert(Serializer& serializer, const ConnectedDeviceType& self) +void ConnectedDeviceType::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.devType); + serializer.insert(devType); } } -void extract(Serializer& serializer, ConnectedDeviceType& self) +void ConnectedDeviceType::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.devType); + serializer.extract(devType); } } -void insert(Serializer& serializer, const ConnectedDeviceType::Response& self) +void ConnectedDeviceType::Response::insert(Serializer& serializer) const { - insert(serializer, self.devType); + serializer.insert(devType); } -void extract(Serializer& serializer, ConnectedDeviceType::Response& self) +void ConnectedDeviceType::Response::extract(Serializer& serializer) { - extract(serializer, self.devType); + serializer.extract(devType); } @@ -239,30 +222,30 @@ TypedResult writeConnectedDeviceType(C::mip_interface& devi uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, devtype); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(devtype); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_CONNECTED_DEVICE_TYPE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_CONNECTED_DEVICE_TYPE, buffer, (uint8_t)serializer.usedLength()); } TypedResult readConnectedDeviceType(C::mip_interface& device, ConnectedDeviceType::Type* devtypeOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_CONNECTED_DEVICE_TYPE, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_CONNECTED_DEVICE_TYPE, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_CONNECTED_DEVICE_TYPE, buffer, (uint8_t)serializer.usedLength(), REPLY_CONNECTED_DEVICE_TYPE, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(devtypeOut); - extract(deserializer, *devtypeOut); + deserializer.extract(*devtypeOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -274,52 +257,50 @@ TypedResult saveConnectedDeviceType(C::mip_interface& devic uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::SAVE); + serializer.insert(FunctionSelector::SAVE); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_CONNECTED_DEVICE_TYPE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_CONNECTED_DEVICE_TYPE, buffer, (uint8_t)serializer.usedLength()); } TypedResult loadConnectedDeviceType(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::LOAD); + serializer.insert(FunctionSelector::LOAD); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_CONNECTED_DEVICE_TYPE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_CONNECTED_DEVICE_TYPE, buffer, (uint8_t)serializer.usedLength()); } TypedResult defaultConnectedDeviceType(C::mip_interface& device) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_CONNECTED_DEVICE_TYPE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_CONNECTED_DEVICE_TYPE, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const GetActCode& self) +void GetActCode::insert(Serializer& serializer) const { (void)serializer; - (void)self; } -void extract(Serializer& serializer, GetActCode& self) +void GetActCode::extract(Serializer& serializer) { (void)serializer; - (void)self; } -void insert(Serializer& serializer, const GetActCode::Response& self) +void GetActCode::Response::insert(Serializer& serializer) const { for(unsigned int i=0; i < 32; i++) - insert(serializer, self.ActivationCode[i]); + serializer.insert(ActivationCode[i]); } -void extract(Serializer& serializer, GetActCode::Response& self) +void GetActCode::Response::extract(Serializer& serializer) { for(unsigned int i=0; i < 32; i++) - extract(serializer, self.ActivationCode[i]); + serializer.extract(ActivationCode[i]); } @@ -334,36 +315,34 @@ TypedResult getActCode(C::mip_interface& device, char* activationcod { Serializer deserializer(buffer, responseLength); - assert(activationcodeOut || (32 == 0)); + assert(activationcodeOut); for(unsigned int i=0; i < 32; i++) - extract(deserializer, activationcodeOut[i]); + deserializer.extract(activationcodeOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; } return result; } -void insert(Serializer& serializer, const GetModemFirmwareVersion& self) +void GetModemFirmwareVersion::insert(Serializer& serializer) const { (void)serializer; - (void)self; } -void extract(Serializer& serializer, GetModemFirmwareVersion& self) +void GetModemFirmwareVersion::extract(Serializer& serializer) { (void)serializer; - (void)self; } -void insert(Serializer& serializer, const GetModemFirmwareVersion::Response& self) +void GetModemFirmwareVersion::Response::insert(Serializer& serializer) const { for(unsigned int i=0; i < 32; i++) - insert(serializer, self.ModemFirmwareVersion[i]); + serializer.insert(ModemFirmwareVersion[i]); } -void extract(Serializer& serializer, GetModemFirmwareVersion::Response& self) +void GetModemFirmwareVersion::Response::extract(Serializer& serializer) { for(unsigned int i=0; i < 32; i++) - extract(serializer, self.ModemFirmwareVersion[i]); + serializer.extract(ModemFirmwareVersion[i]); } @@ -378,42 +357,40 @@ TypedResult getModemFirmwareVersion(C::mip_interface& d { Serializer deserializer(buffer, responseLength); - assert(modemfirmwareversionOut || (32 == 0)); + assert(modemfirmwareversionOut); for(unsigned int i=0; i < 32; i++) - extract(deserializer, modemfirmwareversionOut[i]); + deserializer.extract(modemfirmwareversionOut[i]); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; } return result; } -void insert(Serializer& serializer, const GetRssi& self) +void GetRssi::insert(Serializer& serializer) const { (void)serializer; - (void)self; } -void extract(Serializer& serializer, GetRssi& self) +void GetRssi::extract(Serializer& serializer) { (void)serializer; - (void)self; } -void insert(Serializer& serializer, const GetRssi::Response& self) +void GetRssi::Response::insert(Serializer& serializer) const { - insert(serializer, self.valid); + serializer.insert(valid); - insert(serializer, self.rssi); + serializer.insert(rssi); - insert(serializer, self.signalQuality); + serializer.insert(signalQuality); } -void extract(Serializer& serializer, GetRssi::Response& self) +void GetRssi::Response::extract(Serializer& serializer) { - extract(serializer, self.valid); + serializer.extract(valid); - extract(serializer, self.rssi); + serializer.extract(rssi); - extract(serializer, self.signalQuality); + serializer.extract(signalQuality); } @@ -429,54 +406,54 @@ TypedResult getRssi(C::mip_interface& device, bool* validOut, int32_t* Serializer deserializer(buffer, responseLength); assert(validOut); - extract(deserializer, *validOut); + deserializer.extract(*validOut); assert(rssiOut); - extract(deserializer, *rssiOut); + deserializer.extract(*rssiOut); assert(signalqualityOut); - extract(deserializer, *signalqualityOut); + deserializer.extract(*signalqualityOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; } return result; } -void insert(Serializer& serializer, const ServiceStatus& self) +void ServiceStatus::insert(Serializer& serializer) const { - insert(serializer, self.reserved1); + serializer.insert(reserved1); - insert(serializer, self.reserved2); + serializer.insert(reserved2); } -void extract(Serializer& serializer, ServiceStatus& self) +void ServiceStatus::extract(Serializer& serializer) { - extract(serializer, self.reserved1); + serializer.extract(reserved1); - extract(serializer, self.reserved2); + serializer.extract(reserved2); } -void insert(Serializer& serializer, const ServiceStatus::Response& self) +void ServiceStatus::Response::insert(Serializer& serializer) const { - insert(serializer, self.flags); + serializer.insert(flags); - insert(serializer, self.receivedBytes); + serializer.insert(receivedBytes); - insert(serializer, self.lastBytes); + serializer.insert(lastBytes); - insert(serializer, self.lastBytesTime); + serializer.insert(lastBytesTime); } -void extract(Serializer& serializer, ServiceStatus::Response& self) +void ServiceStatus::Response::extract(Serializer& serializer) { - extract(serializer, self.flags); + serializer.extract(flags); - extract(serializer, self.receivedBytes); + serializer.extract(receivedBytes); - extract(serializer, self.lastBytes); + serializer.extract(lastBytes); - extract(serializer, self.lastBytesTime); + serializer.extract(lastBytesTime); } @@ -485,44 +462,44 @@ TypedResult serviceStatus(C::mip_interface& device, uint32_t rese uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, reserved1); + serializer.insert(reserved1); - insert(serializer, reserved2); + serializer.insert(reserved2); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_SERVICE_STATUS, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_SERVICE_STATUS, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_SERVICE_STATUS, buffer, (uint8_t)serializer.usedLength(), REPLY_SERVICE_STATUS, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(flagsOut); - extract(deserializer, *flagsOut); + deserializer.extract(*flagsOut); assert(receivedbytesOut); - extract(deserializer, *receivedbytesOut); + deserializer.extract(*receivedbytesOut); assert(lastbytesOut); - extract(deserializer, *lastbytesOut); + deserializer.extract(*lastbytesOut); assert(lastbytestimeOut); - extract(deserializer, *lastbytestimeOut); + deserializer.extract(*lastbytestimeOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; } return result; } -void insert(Serializer& serializer, const ProdEraseStorage& self) +void ProdEraseStorage::insert(Serializer& serializer) const { - insert(serializer, self.media); + serializer.insert(media); } -void extract(Serializer& serializer, ProdEraseStorage& self) +void ProdEraseStorage::extract(Serializer& serializer) { - extract(serializer, self.media); + serializer.extract(media); } @@ -531,36 +508,36 @@ TypedResult prodEraseStorage(C::mip_interface& device, MediaSe uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, media); + serializer.insert(media); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_PROD_ERASE_STORAGE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_PROD_ERASE_STORAGE, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const LedControl& self) +void LedControl::insert(Serializer& serializer) const { for(unsigned int i=0; i < 3; i++) - insert(serializer, self.primaryColor[i]); + serializer.insert(primaryColor[i]); for(unsigned int i=0; i < 3; i++) - insert(serializer, self.altColor[i]); + serializer.insert(altColor[i]); - insert(serializer, self.act); + serializer.insert(act); - insert(serializer, self.period); + serializer.insert(period); } -void extract(Serializer& serializer, LedControl& self) +void LedControl::extract(Serializer& serializer) { for(unsigned int i=0; i < 3; i++) - extract(serializer, self.primaryColor[i]); + serializer.extract(primaryColor[i]); for(unsigned int i=0; i < 3; i++) - extract(serializer, self.altColor[i]); + serializer.extract(altColor[i]); - extract(serializer, self.act); + serializer.extract(act); - extract(serializer, self.period); + serializer.extract(period); } @@ -569,31 +546,29 @@ TypedResult ledControl(C::mip_interface& device, const uint8_t* prim uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - assert(primarycolor || (3 == 0)); + assert(primarycolor); for(unsigned int i=0; i < 3; i++) - insert(serializer, primarycolor[i]); + serializer.insert(primarycolor[i]); - assert(altcolor || (3 == 0)); + assert(altcolor); for(unsigned int i=0; i < 3; i++) - insert(serializer, altcolor[i]); + serializer.insert(altcolor[i]); - insert(serializer, act); + serializer.insert(act); - insert(serializer, period); + serializer.insert(period); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_CONTROL, buffer, (uint8_t)serializer.usedLength()); } -void insert(Serializer& serializer, const ModemHardReset& self) +void ModemHardReset::insert(Serializer& serializer) const { (void)serializer; - (void)self; } -void extract(Serializer& serializer, ModemHardReset& self) +void ModemHardReset::extract(Serializer& serializer) { (void)serializer; - (void)self; } TypedResult modemHardReset(C::mip_interface& device) diff --git a/src/mip/definitions/commands_rtk.hpp b/src/cpp/mip/definitions/commands_rtk.hpp similarity index 76% rename from src/mip/definitions/commands_rtk.hpp rename to src/cpp/mip/definitions/commands_rtk.hpp index 5ee697759..5550ceded 100644 --- a/src/mip/definitions/commands_rtk.hpp +++ b/src/cpp/mip/definitions/commands_rtk.hpp @@ -1,16 +1,14 @@ #pragma once -#include "common.h" -#include "descriptors.h" -#include "../mip_result.h" +#include +#include +#include +#include #include #include -#include namespace mip { -class Serializer; - namespace C { struct mip_interface; } // namespace C @@ -18,9 +16,9 @@ struct mip_interface; namespace commands_rtk { //////////////////////////////////////////////////////////////////////////////// -///@addtogroup MipCommands_cpp MIP Commands [CPP] +///@addtogroup MipCommands_cpp ///@{ -///@defgroup rtk_commands_cpp Rtk Commands [CPP] +///@defgroup rtk_commands_cpp Rtk Commands /// ///@{ @@ -79,7 +77,7 @@ enum class LedAction : uint8_t //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_rtk_get_status_flags (0x0F,0x01) Get Status Flags [CPP] +///@defgroup rtk_get_status_flags_cpp (0x0F,0x01) Get Status Flags /// ///@{ @@ -87,6 +85,7 @@ struct GetStatusFlags { struct StatusFlagsLegacy : Bitfield { + typedef uint32_t Type; enum _enumType : uint32_t { NONE = 0x00000000, @@ -135,13 +134,12 @@ struct GetStatusFlags void rsrq(uint32_t val) { value = (value & ~RSRQ) | (val << 28); } uint32_t sinr() const { return (value & SINR) >> 30; } void sinr(uint32_t val) { value = (value & ~SINR) | (val << 30); } - bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - struct StatusFlags : Bitfield { + typedef uint32_t Type; enum _enumType : uint32_t { NONE = 0x00000000, @@ -180,243 +178,265 @@ struct GetStatusFlags uint32_t towerChangeIndicator() const { return (value & TOWER_CHANGE_INDICATOR) >> 20; } void towerChangeIndicator(uint32_t val) { value = (value & ~TOWER_CHANGE_INDICATOR) | (val << 20); } bool nmeaTimeout() const { return (value & NMEA_TIMEOUT) > 0; } - void nmeaTimeout(bool val) { if(val) value |= NMEA_TIMEOUT; else value &= ~NMEA_TIMEOUT; } + void nmeaTimeout(bool val) { value &= ~NMEA_TIMEOUT; if(val) value |= NMEA_TIMEOUT; } bool serverTimeout() const { return (value & SERVER_TIMEOUT) > 0; } - void serverTimeout(bool val) { if(val) value |= SERVER_TIMEOUT; else value &= ~SERVER_TIMEOUT; } + void serverTimeout(bool val) { value &= ~SERVER_TIMEOUT; if(val) value |= SERVER_TIMEOUT; } bool correctionsTimeout() const { return (value & CORRECTIONS_TIMEOUT) > 0; } - void correctionsTimeout(bool val) { if(val) value |= CORRECTIONS_TIMEOUT; else value &= ~CORRECTIONS_TIMEOUT; } + void correctionsTimeout(bool val) { value &= ~CORRECTIONS_TIMEOUT; if(val) value |= CORRECTIONS_TIMEOUT; } bool deviceOutOfRange() const { return (value & DEVICE_OUT_OF_RANGE) > 0; } - void deviceOutOfRange(bool val) { if(val) value |= DEVICE_OUT_OF_RANGE; else value &= ~DEVICE_OUT_OF_RANGE; } + void deviceOutOfRange(bool val) { value &= ~DEVICE_OUT_OF_RANGE; if(val) value |= DEVICE_OUT_OF_RANGE; } bool correctionsUnavailable() const { return (value & CORRECTIONS_UNAVAILABLE) > 0; } - void correctionsUnavailable(bool val) { if(val) value |= CORRECTIONS_UNAVAILABLE; else value &= ~CORRECTIONS_UNAVAILABLE; } + void correctionsUnavailable(bool val) { value &= ~CORRECTIONS_UNAVAILABLE; if(val) value |= CORRECTIONS_UNAVAILABLE; } bool reserved() const { return (value & RESERVED) > 0; } - void reserved(bool val) { if(val) value |= RESERVED; else value &= ~RESERVED; } + void reserved(bool val) { value &= ~RESERVED; if(val) value |= RESERVED; } uint32_t version() const { return (value & VERSION) >> 30; } void version(uint32_t val) { value = (value & ~VERSION) | (val << 30); } - bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - - + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_rtk::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_rtk::CMD_GET_STATUS_FLAGS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GetStatusFlags"; static constexpr const char* DOC_NAME = "Get RTK Device Status Flags"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(); } - auto as_tuple() + auto asTuple() { return std::make_tuple(); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + StatusFlags flags; ///< Model number dependent. See above structures. + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_rtk::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_rtk::REPLY_GET_STATUS_FLAGS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GetStatusFlags::Response"; static constexpr const char* DOC_NAME = "Get RTK Device Status Flags Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - StatusFlags flags; ///< Model number dependent. See above structures. - + auto asTuple() const + { + return std::make_tuple(flags); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const GetStatusFlags& self); -void extract(Serializer& serializer, GetStatusFlags& self); - -void insert(Serializer& serializer, const GetStatusFlags::Response& self); -void extract(Serializer& serializer, GetStatusFlags::Response& self); - TypedResult getStatusFlags(C::mip_interface& device, GetStatusFlags::StatusFlags* flagsOut); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_rtk_get_imei (0x0F,0x02) Get Imei [CPP] +///@defgroup rtk_get_imei_cpp (0x0F,0x02) Get Imei /// ///@{ struct GetImei { - + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_rtk::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_rtk::CMD_GET_IMEI; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GetImei"; static constexpr const char* DOC_NAME = "Get RTK Device IMEI (International Mobile Equipment Identifier)"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(); } - auto as_tuple() + auto asTuple() { return std::make_tuple(); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + char IMEI[32] = {0}; + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_rtk::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_rtk::REPLY_GET_IMEI; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GetImei::Response"; static constexpr const char* DOC_NAME = "Get RTK Device IMEI (International Mobile Equipment Identifier) Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - char IMEI[32] = {0}; - + auto asTuple() const + { + return std::make_tuple(IMEI); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(IMEI)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const GetImei& self); -void extract(Serializer& serializer, GetImei& self); - -void insert(Serializer& serializer, const GetImei::Response& self); -void extract(Serializer& serializer, GetImei::Response& self); - TypedResult getImei(C::mip_interface& device, char* imeiOut); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_rtk_get_imsi (0x0F,0x03) Get Imsi [CPP] +///@defgroup rtk_get_imsi_cpp (0x0F,0x03) Get Imsi /// ///@{ struct GetImsi { - + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_rtk::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_rtk::CMD_GET_IMSI; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GetImsi"; static constexpr const char* DOC_NAME = "Get RTK Device IMSI (International Mobile Subscriber Identifier)"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(); } - auto as_tuple() + auto asTuple() { return std::make_tuple(); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + char IMSI[32] = {0}; + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_rtk::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_rtk::REPLY_GET_IMSI; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GetImsi::Response"; static constexpr const char* DOC_NAME = "Get RTK Device IMSI (International Mobile Subscriber Identifier) Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - char IMSI[32] = {0}; - + auto asTuple() const + { + return std::make_tuple(IMSI); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(IMSI)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const GetImsi& self); -void extract(Serializer& serializer, GetImsi& self); - -void insert(Serializer& serializer, const GetImsi::Response& self); -void extract(Serializer& serializer, GetImsi::Response& self); - TypedResult getImsi(C::mip_interface& device, char* imsiOut); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_rtk_get_iccid (0x0F,0x04) Get Iccid [CPP] +///@defgroup rtk_get_iccid_cpp (0x0F,0x04) Get Iccid /// ///@{ struct GetIccid { - + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_rtk::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_rtk::CMD_GET_ICCID; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GetIccid"; static constexpr const char* DOC_NAME = "Get RTK Device ICCID (Integrated Circuit Card Identification [SIM Number])"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(); } - auto as_tuple() + auto asTuple() { return std::make_tuple(); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + char ICCID[32] = {0}; + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_rtk::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_rtk::REPLY_GET_ICCID; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GetIccid::Response"; static constexpr const char* DOC_NAME = "Get RTK Device ICCID (Integrated Circuit Card Identification [SIM Number]) Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - char ICCID[32] = {0}; - + auto asTuple() const + { + return std::make_tuple(ICCID); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(ICCID)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const GetIccid& self); -void extract(Serializer& serializer, GetIccid& self); - -void insert(Serializer& serializer, const GetIccid::Response& self); -void extract(Serializer& serializer, GetIccid::Response& self); - TypedResult getIccid(C::mip_interface& device, char* iccidOut); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_rtk_connected_device_type (0x0F,0x06) Connected Device Type [CPP] +///@defgroup rtk_connected_device_type_cpp (0x0F,0x06) Connected Device Type /// ///@{ @@ -428,30 +448,24 @@ struct ConnectedDeviceType GQ7 = 1, ///< }; + /// Parameters FunctionSelector function = static_cast(0); Type devType = static_cast(0); + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_rtk::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_rtk::CMD_CONNECTED_DEVICE_TYPE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ConnectedDeviceType"; static constexpr const char* DOC_NAME = "Configure or read the type of the connected device"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8001; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x8000; - static constexpr const uint32_t LOAD_PARAMS = 0x8000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(devType); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(devType)); } @@ -463,31 +477,39 @@ struct ConnectedDeviceType return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + Type devType = static_cast(0); + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_rtk::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_rtk::REPLY_CONNECTED_DEVICE_TYPE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ConnectedDeviceType::Response"; static constexpr const char* DOC_NAME = "Configure or read the type of the connected device Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - Type devType = static_cast(0); - + auto asTuple() const + { + return std::make_tuple(devType); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(devType)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const ConnectedDeviceType& self); -void extract(Serializer& serializer, ConnectedDeviceType& self); - -void insert(Serializer& serializer, const ConnectedDeviceType::Response& self); -void extract(Serializer& serializer, ConnectedDeviceType::Response& self); - TypedResult writeConnectedDeviceType(C::mip_interface& device, ConnectedDeviceType::Type devtype); TypedResult readConnectedDeviceType(C::mip_interface& device, ConnectedDeviceType::Type* devtypeOut); TypedResult saveConnectedDeviceType(C::mip_interface& device); @@ -497,178 +519,196 @@ TypedResult defaultConnectedDeviceType(C::mip_interface& de ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_rtk_get_act_code (0x0F,0x07) Get Act Code [CPP] +///@defgroup rtk_get_act_code_cpp (0x0F,0x07) Get Act Code /// ///@{ struct GetActCode { - + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_rtk::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_rtk::CMD_GET_ACT_CODE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GetActCode"; static constexpr const char* DOC_NAME = "Get RTK Device Activation Code"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(); } - auto as_tuple() + auto asTuple() { return std::make_tuple(); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + char ActivationCode[32] = {0}; + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_rtk::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_rtk::REPLY_GET_ACT_CODE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GetActCode::Response"; static constexpr const char* DOC_NAME = "Get RTK Device Activation Code Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - char ActivationCode[32] = {0}; - + auto asTuple() const + { + return std::make_tuple(ActivationCode); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(ActivationCode)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const GetActCode& self); -void extract(Serializer& serializer, GetActCode& self); - -void insert(Serializer& serializer, const GetActCode::Response& self); -void extract(Serializer& serializer, GetActCode::Response& self); - TypedResult getActCode(C::mip_interface& device, char* activationcodeOut); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_rtk_get_modem_firmware_version (0x0F,0x08) Get Modem Firmware Version [CPP] +///@defgroup rtk_get_modem_firmware_version_cpp (0x0F,0x08) Get Modem Firmware Version /// ///@{ struct GetModemFirmwareVersion { - + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_rtk::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_rtk::CMD_GET_MODEM_FIRMWARE_VERSION; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GetModemFirmwareVersion"; static constexpr const char* DOC_NAME = "Get RTK Device's Cell Modem Firmware version number"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(); } - auto as_tuple() + auto asTuple() { return std::make_tuple(); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + char ModemFirmwareVersion[32] = {0}; + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_rtk::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_rtk::REPLY_GET_MODEM_FIRMWARE_VERSION; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GetModemFirmwareVersion::Response"; static constexpr const char* DOC_NAME = "Get RTK Device's Cell Modem Firmware version number Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - char ModemFirmwareVersion[32] = {0}; - + auto asTuple() const + { + return std::make_tuple(ModemFirmwareVersion); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(ModemFirmwareVersion)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const GetModemFirmwareVersion& self); -void extract(Serializer& serializer, GetModemFirmwareVersion& self); - -void insert(Serializer& serializer, const GetModemFirmwareVersion::Response& self); -void extract(Serializer& serializer, GetModemFirmwareVersion::Response& self); - TypedResult getModemFirmwareVersion(C::mip_interface& device, char* modemfirmwareversionOut); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_rtk_get_rssi (0x0F,0x05) Get Rssi [CPP] +///@defgroup rtk_get_rssi_cpp (0x0F,0x05) Get Rssi /// Get the RSSI and connected/disconnected status of modem /// ///@{ struct GetRssi { - + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_rtk::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_rtk::CMD_GET_RSSI; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GetRssi"; static constexpr const char* DOC_NAME = "GetRssi"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(); } - auto as_tuple() + auto asTuple() { return std::make_tuple(); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + bool valid = 0; + int32_t rssi = 0; + int32_t signalQuality = 0; + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_rtk::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_rtk::REPLY_GET_RSSI; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GetRssi::Response"; static constexpr const char* DOC_NAME = "GetRssi Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - bool valid = 0; - int32_t rssi = 0; - int32_t signalQuality = 0; - + auto asTuple() const + { + return std::make_tuple(valid,rssi,signalQuality); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(valid),std::ref(rssi),std::ref(signalQuality)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const GetRssi& self); -void extract(Serializer& serializer, GetRssi& self); - -void insert(Serializer& serializer, const GetRssi::Response& self); -void extract(Serializer& serializer, GetRssi::Response& self); - TypedResult getRssi(C::mip_interface& device, bool* validOut, int32_t* rssiOut, int32_t* signalqualityOut); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_rtk_service_status (0x0F,0x0A) Service Status [CPP] +///@defgroup rtk_service_status_cpp (0x0F,0x0A) Service Status /// The 3DMRTK will send this message to the server to indicate that the connection should remain open. The Server will respond with information and status. /// ///@{ @@ -677,6 +717,7 @@ struct ServiceStatus { struct ServiceFlags : Bitfield { + typedef uint8_t Type; enum _enumType : uint8_t { NONE = 0x00, @@ -696,72 +737,78 @@ struct ServiceStatus ServiceFlags& operator&=(uint8_t val) { return *this = value & val; } bool throttle() const { return (value & THROTTLE) > 0; } - void throttle(bool val) { if(val) value |= THROTTLE; else value &= ~THROTTLE; } + void throttle(bool val) { value &= ~THROTTLE; if(val) value |= THROTTLE; } bool correctionsUnavailable() const { return (value & CORRECTIONS_UNAVAILABLE) > 0; } - void correctionsUnavailable(bool val) { if(val) value |= CORRECTIONS_UNAVAILABLE; else value &= ~CORRECTIONS_UNAVAILABLE; } + void correctionsUnavailable(bool val) { value &= ~CORRECTIONS_UNAVAILABLE; if(val) value |= CORRECTIONS_UNAVAILABLE; } uint8_t reserved() const { return (value & RESERVED) >> 2; } void reserved(uint8_t val) { value = (value & ~RESERVED) | (val << 2); } - bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters uint32_t reserved1 = 0; uint32_t reserved2 = 0; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_rtk::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_rtk::CMD_SERVICE_STATUS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ServiceStatus"; static constexpr const char* DOC_NAME = "ServiceStatus"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(reserved1,reserved2); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(reserved1),std::ref(reserved2)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + ServiceFlags flags; + uint32_t receivedBytes = 0; + uint32_t lastBytes = 0; + uint64_t lastBytesTime = 0; + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_rtk::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_rtk::REPLY_SERVICE_STATUS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ServiceStatus::Response"; static constexpr const char* DOC_NAME = "ServiceStatus Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - ServiceFlags flags; - uint32_t receivedBytes = 0; - uint32_t lastBytes = 0; - uint64_t lastBytesTime = 0; - + auto asTuple() const + { + return std::make_tuple(flags,receivedBytes,lastBytes,lastBytesTime); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(flags),std::ref(receivedBytes),std::ref(lastBytes),std::ref(lastBytesTime)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const ServiceStatus& self); -void extract(Serializer& serializer, ServiceStatus& self); - -void insert(Serializer& serializer, const ServiceStatus::Response& self); -void extract(Serializer& serializer, ServiceStatus::Response& self); - TypedResult serviceStatus(C::mip_interface& device, uint32_t reserved1, uint32_t reserved2, ServiceStatus::ServiceFlags* flagsOut, uint32_t* receivedbytesOut, uint32_t* lastbytesOut, uint64_t* lastbytestimeOut); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_rtk_prod_erase_storage (0x0F,0x20) Prod Erase Storage [CPP] +///@defgroup rtk_prod_erase_storage_cpp (0x0F,0x20) Prod Erase Storage /// This command will erase the selected media to a raw and uninitialized state. ALL DATA WILL BE LOST. /// This command is only available in calibration mode. /// @@ -769,77 +816,81 @@ TypedResult serviceStatus(C::mip_interface& device, uint32_t rese struct ProdEraseStorage { + /// Parameters MediaSelector media = static_cast(0); + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_rtk::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_rtk::CMD_PROD_ERASE_STORAGE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ProdEraseStorage"; static constexpr const char* DOC_NAME = "ProdEraseStorage"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(media); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(media)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + typedef void Response; }; -void insert(Serializer& serializer, const ProdEraseStorage& self); -void extract(Serializer& serializer, ProdEraseStorage& self); - TypedResult prodEraseStorage(C::mip_interface& device, MediaSelector media); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_rtk_led_control (0x0F,0x21) Led Control [CPP] +///@defgroup rtk_led_control_cpp (0x0F,0x21) Led Control /// This command allows direct control of the LED on the 3DM RTK. This command is only available in calibration mode or Production Test Mode. /// ///@{ struct LedControl { + /// Parameters uint8_t primaryColor[3] = {0}; uint8_t altColor[3] = {0}; LedAction act = static_cast(0); uint32_t period = 0; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_rtk::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_rtk::CMD_CONTROL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "LedControl"; static constexpr const char* DOC_NAME = "LedControl"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(primaryColor,altColor,act,period); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(primaryColor),std::ref(altColor),std::ref(act),std::ref(period)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + typedef void Response; }; -void insert(Serializer& serializer, const LedControl& self); -void extract(Serializer& serializer, LedControl& self); - TypedResult ledControl(C::mip_interface& device, const uint8_t* primarycolor, const uint8_t* altcolor, LedAction act, uint32_t period); ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_rtk_modem_hard_reset (0x0F,0x22) Modem Hard Reset [CPP] +///@defgroup rtk_modem_hard_reset_cpp (0x0F,0x22) Modem Hard Reset /// This command will clear the modem flash. THIS MUST NOT BE DONE OFTEN AS IT CAN DAMAGE THE FLASH! /// This command is only available in calibration mode. /// @@ -847,30 +898,30 @@ TypedResult ledControl(C::mip_interface& device, const uint8_t* prim struct ModemHardReset { - + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_rtk::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_rtk::CMD_MODEM_HARD_RESET; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ModemHardReset"; static constexpr const char* DOC_NAME = "ModemHardReset"; - static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(); } - auto as_tuple() + auto asTuple() { return std::make_tuple(); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + typedef void Response; }; -void insert(Serializer& serializer, const ModemHardReset& self); -void extract(Serializer& serializer, ModemHardReset& self); - TypedResult modemHardReset(C::mip_interface& device); ///@} diff --git a/src/mip/definitions/commands_system.cpp b/src/cpp/mip/definitions/commands_system.cpp similarity index 56% rename from src/mip/definitions/commands_system.cpp rename to src/cpp/mip/definitions/commands_system.cpp index 748a9c184..5746e54a3 100644 --- a/src/mip/definitions/commands_system.cpp +++ b/src/cpp/mip/definitions/commands_system.cpp @@ -1,63 +1,54 @@ #include "commands_system.hpp" -#include "../utils/serialization.h" -#include "../mip_interface.h" +#include +#include #include namespace mip { -class Serializer; - namespace C { struct mip_interface; } // namespace C namespace commands_system { -using ::mip::insert; -using ::mip::extract; using namespace ::mip::C; -//////////////////////////////////////////////////////////////////////////////// -// Shared Type Definitions -//////////////////////////////////////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////////////////////// // Mip Fields //////////////////////////////////////////////////////////////////////////////// -void insert(Serializer& serializer, const CommMode& self) +void CommMode::insert(Serializer& serializer) const { - insert(serializer, self.function); + serializer.insert(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - insert(serializer, self.mode); + serializer.insert(mode); } } -void extract(Serializer& serializer, CommMode& self) +void CommMode::extract(Serializer& serializer) { - extract(serializer, self.function); + serializer.extract(function); - if( self.function == FunctionSelector::WRITE ) + if( function == FunctionSelector::WRITE ) { - extract(serializer, self.mode); + serializer.extract(mode); } } -void insert(Serializer& serializer, const CommMode::Response& self) +void CommMode::Response::insert(Serializer& serializer) const { - insert(serializer, self.mode); + serializer.insert(mode); } -void extract(Serializer& serializer, CommMode::Response& self) +void CommMode::Response::extract(Serializer& serializer) { - extract(serializer, self.mode); + serializer.extract(mode); } @@ -66,30 +57,30 @@ TypedResult writeCommMode(C::mip_interface& device, uint8_t mode) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::WRITE); - insert(serializer, mode); + serializer.insert(FunctionSelector::WRITE); + serializer.insert(mode); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_COM_MODE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_COM_MODE, buffer, (uint8_t)serializer.usedLength()); } TypedResult readCommMode(C::mip_interface& device, uint8_t* modeOut) { uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::READ); + serializer.insert(FunctionSelector::READ); assert(serializer.isOk()); uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_COM_MODE, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_COM_MODE, buffer, &responseLength); + TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_COM_MODE, buffer, (uint8_t)serializer.usedLength(), REPLY_COM_MODE, buffer, &responseLength); if( result == MIP_ACK_OK ) { Serializer deserializer(buffer, responseLength); assert(modeOut); - extract(deserializer, *modeOut); + deserializer.extract(*modeOut); if( deserializer.remaining() != 0 ) result = MIP_STATUS_ERROR; @@ -101,10 +92,10 @@ TypedResult defaultCommMode(C::mip_interface& device) uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; Serializer serializer(buffer, sizeof(buffer)); - insert(serializer, FunctionSelector::RESET); + serializer.insert(FunctionSelector::RESET); assert(serializer.isOk()); - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_COM_MODE, buffer, (uint8_t)mip_serializer_length(&serializer)); + return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_COM_MODE, buffer, (uint8_t)serializer.usedLength()); } } // namespace commands_system diff --git a/src/mip/definitions/commands_system.hpp b/src/cpp/mip/definitions/commands_system.hpp similarity index 76% rename from src/mip/definitions/commands_system.hpp rename to src/cpp/mip/definitions/commands_system.hpp index 90b1e88fa..b3d1303eb 100644 --- a/src/mip/definitions/commands_system.hpp +++ b/src/cpp/mip/definitions/commands_system.hpp @@ -1,16 +1,14 @@ #pragma once -#include "common.h" -#include "descriptors.h" -#include "../mip_result.h" +#include +#include +#include +#include #include #include -#include namespace mip { -class Serializer; - namespace C { struct mip_interface; } // namespace C @@ -18,9 +16,9 @@ struct mip_interface; namespace commands_system { //////////////////////////////////////////////////////////////////////////////// -///@addtogroup MipCommands_cpp MIP Commands [CPP] +///@addtogroup MipCommands_cpp ///@{ -///@defgroup system_commands_cpp System Commands [CPP] +///@defgroup system_commands_cpp System Commands /// ///@{ @@ -56,7 +54,7 @@ static constexpr const uint8_t MIP_SYSTEM_COMMAND_COMM_MODE_GPS = 0x03; //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_system_comm_mode (0x7F,0x10) Comm Mode [CPP] +///@defgroup system_comm_mode_cpp (0x7F,0x10) Comm Mode /// Advanced specialized communication modes. /// /// This command allows the user to communicate directly with various subsystems which may be present in MIP devices (i.e. IMU, GNSS, etc.) @@ -71,30 +69,24 @@ static constexpr const uint8_t MIP_SYSTEM_COMMAND_COMM_MODE_GPS = 0x03; struct CommMode { + /// Parameters FunctionSelector function = static_cast(0); uint8_t mode = 0; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_system::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_system::CMD_COM_MODE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "CommMode"; static constexpr const char* DOC_NAME = "CommMode"; - static constexpr const bool HAS_FUNCTION_SELECTOR = true; - static constexpr const uint32_t WRITE_PARAMS = 0x8001; - static constexpr const uint32_t READ_PARAMS = 0x8000; - static constexpr const uint32_t SAVE_PARAMS = 0x0000; - static constexpr const uint32_t LOAD_PARAMS = 0x0000; - static constexpr const uint32_t DEFAULT_PARAMS = 0x8000; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - auto as_tuple() const + auto asTuple() const { return std::make_tuple(mode); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(mode)); } @@ -106,31 +98,39 @@ struct CommMode return cmd; } + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + struct Response { + /// Parameters + uint8_t mode = 0; + + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::commands_system::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::commands_system::REPLY_COM_MODE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "CommMode::Response"; static constexpr const char* DOC_NAME = "CommMode Response"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - static constexpr const uint32_t ECHOED_PARAMS = 0x0000; - static constexpr const uint32_t COUNTER_PARAMS = 0x00000000; - uint8_t mode = 0; - + auto asTuple() const + { + return std::make_tuple(mode); + } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(mode)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; }; -void insert(Serializer& serializer, const CommMode& self); -void extract(Serializer& serializer, CommMode& self); - -void insert(Serializer& serializer, const CommMode::Response& self); -void extract(Serializer& serializer, CommMode::Response& self); - TypedResult writeCommMode(C::mip_interface& device, uint8_t mode); TypedResult readCommMode(C::mip_interface& device, uint8_t* modeOut); TypedResult defaultCommMode(C::mip_interface& device); diff --git a/src/mip/definitions/common.h b/src/cpp/mip/definitions/common.hpp similarity index 64% rename from src/mip/definitions/common.h rename to src/cpp/mip/definitions/common.hpp index 9f287ad9a..dd8de08c1 100644 --- a/src/mip/definitions/common.h +++ b/src/cpp/mip/definitions/common.hpp @@ -1,161 +1,137 @@ -#pragma once - -#include -#include -#include -#include "../utils/serialization.h" - -#ifdef __cplusplus - -#include -#include -#include - -namespace mip { -namespace C { -extern "C" { -#endif // __cplusplus - - -typedef struct mip_descriptor_rate -{ - uint8_t descriptor; - uint16_t decimation; -} mip_descriptor_rate; - -void insert_mip_descriptor_rate(mip_serializer* serializer, const mip_descriptor_rate* self); -void extract_mip_descriptor_rate(mip_serializer* serializer, mip_descriptor_rate* self); - -#define DECLARE_MIP_VECTOR_TYPE(n,type,name) \ -typedef type name[n]; \ -\ -void insert_##name(mip_serializer* serializer, const name self); \ -void extract_##name(mip_serializer* serializer, name self); - -DECLARE_MIP_VECTOR_TYPE(3, float, mip_vector3f) -DECLARE_MIP_VECTOR_TYPE(4, float, mip_vector4f) -DECLARE_MIP_VECTOR_TYPE(9, float, mip_matrix3f) -DECLARE_MIP_VECTOR_TYPE(3, double, mip_vector3d) -DECLARE_MIP_VECTOR_TYPE(4, double, mip_vector4d) -DECLARE_MIP_VECTOR_TYPE(9, double, mip_matrix3d) -DECLARE_MIP_VECTOR_TYPE(4, float, mip_quatf) - -#undef DECLARE_MIP_VECTOR_TYPE - - -#ifdef __cplusplus - -} // extern "C" -} // namespace "C" - - -using DescriptorRate = C::mip_descriptor_rate; - -inline void insert(Serializer& serializer, const DescriptorRate& self) { return C::insert_mip_descriptor_rate(&serializer, &self); } -inline void extract(Serializer& serializer, DescriptorRate& self) { return C::extract_mip_descriptor_rate(&serializer, &self); } - - -////////////////////////////////////////////////////////////////////////////////// -///@brief Vector is a wrapper around an array of some type T, usually float or double. -/// -/// Implicit conversion to/from C-style pointers is provided to allow simple -/// integration with code using plain arrays. -/// -template -struct Vector -{ - /// Default constructor, no initialization. - Vector() {} - - /// Set all elements to this value (typically 0). - ///@param value - template - Vector(U value) { fill(value); } - - /// Construct from a C array of known size. - ///@param ptr - template - Vector(const U (&ptr)[N]) { copyFrom(ptr, N); } - - /// Construct from a C array of different size (smaller or larger vector). - ///@param ptr - template - explicit Vector(const U (&ptr)[M]) { static_assert(M>=N, "Input array is too small"); copyFrom(ptr, M); } - - /// Construct from a pointer and size. - ///@param ptr Pointer to data to copy. Can be NULL if n==0. - ///@param n Number of elements to copy. Clamped to N. - template - explicit Vector(const U* ptr, size_t n) { copyFrom(ptr, n); } - - /// Construct from individual elements or a braced init list. - ///@param u The first value (typically X). - ///@param v The value value (typically Y). - ///@param rest Additional optional values (typically none, Z, or Z and W). - template - Vector(U u, V v, Rest... rest) : m_data{u, v, rest...} {} - - /// Copy constructor. - Vector(const Vector&) = default; - - /// Assignment operator. - Vector& operator=(const Vector&) = default; - - /// Assignment operator from different type (e.g. float to double). - template - Vector& operator=(const Vector& other) { copyFrom(other, N); return *this; } - - - typedef T Array[N]; - -#if _MSC_VER < 1930 - // MSVC 2017 has a bug which causes operator[] to be ambiguous. - // See https://stackoverflow.com/questions/48250560/msvc-error-c2593-when-overloading-const-and-non-const-conversion-operator-return - operator T*() { return m_data; } - operator const T*() const { return m_data; } -#else - /// Implicitly convert to a C-style array (rather than a pointer) so size information is preserved. - operator Array&() { return m_data; } - operator const Array&() const { return m_data; } -#endif - - /// Explicitly convert to a C-style array. - Array& data() { return m_data; } - const Array& data() const { return m_data; } - - /// Fill all elements with a given value. - template - void fill(U value) { for(size_t i=0; i - void copyFrom(const U* ptr, size_t n) { if(n>N) n=N; for(size_t i=0; i; -using Vector4f = Vector; -using Matrix3f = Vector; -using Vector3d = Vector; -using Vector4d = Vector; -using Matrix3d = Vector; - -using Quatf = Vector4f; - -template -void insert(Serializer& serializer, const Vector& v) { for(size_t i=0; i -void extract(Serializer& serializer, Vector& v) { for(size_t i=0; i + +//////////////////////////////////////////////////////////////////////////////// +///@addtogroup mip_cpp +///@{ +/// +///@defgroup MipCommands_cpp Mip Commands +///@brief Contains all MIP command definitions. +/// +///@defgroup MipData_cpp Mip Data +///@brief Contains all MIP data definitions. +/// +///@} +//////////////////////////////////////////////////////////////////////////////// + + +namespace mip +{ +//////////////////////////////////////////////////////////////////////////////// +///@addtogroup mip_cpp +///@{ + +struct DescriptorRate +{ + uint8_t descriptor; + uint16_t decimation; + + size_t insert(Serializer& buffer) const { return buffer.insert(descriptor, decimation); } + size_t extract(Serializer& buffer) { return buffer.extract(descriptor, decimation); } +}; + + +////////////////////////////////////////////////////////////////////////////////// +///@brief Vector is a wrapper around an array of some type T, usually float or double. +/// +/// Implicit conversion to/from C-style pointers is provided to allow simple +/// integration with code using plain arrays. +/// +template +struct Vector +{ + /// Default constructor, no initialization. + Vector() {} + + /// Set all elements to this value (typically 0). + ///@param value + template + Vector(U value) { fill(value); } + + /// Construct from a C array of known size. + ///@param ptr + template + Vector(const U (&ptr)[N]) { copyFrom(ptr, N); } + + /// Construct from a C array of different size (smaller or larger vector). + ///@param ptr + template + explicit Vector(const U (&ptr)[M]) { static_assert(M>=N, "Input array is too small"); copyFrom(ptr, M); } + + /// Construct from a pointer and size. + ///@param ptr Pointer to data to copy. Can be NULL if n==0. + ///@param n Number of elements to copy. Clamped to N. + template + explicit Vector(const U* ptr, size_t n) { copyFrom(ptr, n); } + + /// Construct from individual elements or a braced init list. + ///@param u The first value (typically X). + ///@param v The value value (typically Y). + ///@param rest Additional optional values (typically none, Z, or Z and W). + template + Vector(U u, V v, Rest... rest) : m_data{u, v, rest...} {} + + /// Copy constructor. + Vector(const Vector&) = default; + + /// Assignment operator. + Vector& operator=(const Vector&) = default; + + /// Assignment operator from different type (e.g. float to double). + template + Vector& operator=(const Vector& other) { copyFrom(other, N); return *this; } + + + typedef T Array[N]; + +#if _MSC_VER < 1930 + // MSVC 2017 has a bug which causes operator[] to be ambiguous. + // See https://stackoverflow.com/questions/48250560/msvc-error-c2593-when-overloading-const-and-non-const-conversion-operator-return + operator T*() { return m_data; } + operator const T*() const { return m_data; } +#else + /// Implicitly convert to a C-style array (rather than a pointer) so size information is preserved. + operator Array&() { return m_data; } + operator const Array&() const { return m_data; } +#endif + + /// Explicitly convert to a C-style array. + Array& data() { return m_data; } + const Array& data() const { return m_data; } + + /// Fill all elements with a given value. + template + void fill(U value) { for(size_t i=0; i + void copyFrom(const U* ptr, size_t n) { if(n>N) n=N; for(size_t i=0; i; +using Vector4f = Vector; +using Matrix3f = Vector; +using Vector3d = Vector; +using Vector4d = Vector; +using Matrix3d = Vector; + +using Quatf = Vector4f; + +template +size_t insert(Serializer& serializer, const Vector& v) { return serializer.insert(v.data()); } + +template +size_t extract(Serializer& serializer, Vector& v) { return serializer.extract(v.data()); } + +///@} +//////////////////////////////////////////////////////////////////////////////// +} // namespace mip diff --git a/src/cpp/mip/definitions/data_filter.cpp b/src/cpp/mip/definitions/data_filter.cpp new file mode 100644 index 000000000..9141e7bce --- /dev/null +++ b/src/cpp/mip/definitions/data_filter.cpp @@ -0,0 +1,1055 @@ + +#include "data_filter.hpp" + +#include +#include + +#include + + +namespace mip { +namespace C { +struct mip_interface; +} // namespace C + +namespace data_filter { + +using namespace ::mip::C; + +//////////////////////////////////////////////////////////////////////////////// +// Mip Fields +//////////////////////////////////////////////////////////////////////////////// + +void PositionLlh::insert(Serializer& serializer) const +{ + serializer.insert(latitude); + + serializer.insert(longitude); + + serializer.insert(ellipsoid_height); + + serializer.insert(valid_flags); + +} +void PositionLlh::extract(Serializer& serializer) +{ + serializer.extract(latitude); + + serializer.extract(longitude); + + serializer.extract(ellipsoid_height); + + serializer.extract(valid_flags); + +} + +void VelocityNed::insert(Serializer& serializer) const +{ + serializer.insert(north); + + serializer.insert(east); + + serializer.insert(down); + + serializer.insert(valid_flags); + +} +void VelocityNed::extract(Serializer& serializer) +{ + serializer.extract(north); + + serializer.extract(east); + + serializer.extract(down); + + serializer.extract(valid_flags); + +} + +void AttitudeQuaternion::insert(Serializer& serializer) const +{ + serializer.insert(q); + + serializer.insert(valid_flags); + +} +void AttitudeQuaternion::extract(Serializer& serializer) +{ + serializer.extract(q); + + serializer.extract(valid_flags); + +} + +void AttitudeDcm::insert(Serializer& serializer) const +{ + serializer.insert(dcm); + + serializer.insert(valid_flags); + +} +void AttitudeDcm::extract(Serializer& serializer) +{ + serializer.extract(dcm); + + serializer.extract(valid_flags); + +} + +void EulerAngles::insert(Serializer& serializer) const +{ + serializer.insert(roll); + + serializer.insert(pitch); + + serializer.insert(yaw); + + serializer.insert(valid_flags); + +} +void EulerAngles::extract(Serializer& serializer) +{ + serializer.extract(roll); + + serializer.extract(pitch); + + serializer.extract(yaw); + + serializer.extract(valid_flags); + +} + +void GyroBias::insert(Serializer& serializer) const +{ + serializer.insert(bias); + + serializer.insert(valid_flags); + +} +void GyroBias::extract(Serializer& serializer) +{ + serializer.extract(bias); + + serializer.extract(valid_flags); + +} + +void AccelBias::insert(Serializer& serializer) const +{ + serializer.insert(bias); + + serializer.insert(valid_flags); + +} +void AccelBias::extract(Serializer& serializer) +{ + serializer.extract(bias); + + serializer.extract(valid_flags); + +} + +void PositionLlhUncertainty::insert(Serializer& serializer) const +{ + serializer.insert(north); + + serializer.insert(east); + + serializer.insert(down); + + serializer.insert(valid_flags); + +} +void PositionLlhUncertainty::extract(Serializer& serializer) +{ + serializer.extract(north); + + serializer.extract(east); + + serializer.extract(down); + + serializer.extract(valid_flags); + +} + +void VelocityNedUncertainty::insert(Serializer& serializer) const +{ + serializer.insert(north); + + serializer.insert(east); + + serializer.insert(down); + + serializer.insert(valid_flags); + +} +void VelocityNedUncertainty::extract(Serializer& serializer) +{ + serializer.extract(north); + + serializer.extract(east); + + serializer.extract(down); + + serializer.extract(valid_flags); + +} + +void EulerAnglesUncertainty::insert(Serializer& serializer) const +{ + serializer.insert(roll); + + serializer.insert(pitch); + + serializer.insert(yaw); + + serializer.insert(valid_flags); + +} +void EulerAnglesUncertainty::extract(Serializer& serializer) +{ + serializer.extract(roll); + + serializer.extract(pitch); + + serializer.extract(yaw); + + serializer.extract(valid_flags); + +} + +void GyroBiasUncertainty::insert(Serializer& serializer) const +{ + serializer.insert(bias_uncert); + + serializer.insert(valid_flags); + +} +void GyroBiasUncertainty::extract(Serializer& serializer) +{ + serializer.extract(bias_uncert); + + serializer.extract(valid_flags); + +} + +void AccelBiasUncertainty::insert(Serializer& serializer) const +{ + serializer.insert(bias_uncert); + + serializer.insert(valid_flags); + +} +void AccelBiasUncertainty::extract(Serializer& serializer) +{ + serializer.extract(bias_uncert); + + serializer.extract(valid_flags); + +} + +void Timestamp::insert(Serializer& serializer) const +{ + serializer.insert(tow); + + serializer.insert(week_number); + + serializer.insert(valid_flags); + +} +void Timestamp::extract(Serializer& serializer) +{ + serializer.extract(tow); + + serializer.extract(week_number); + + serializer.extract(valid_flags); + +} + +void Status::insert(Serializer& serializer) const +{ + serializer.insert(filter_state); + + serializer.insert(dynamics_mode); + + serializer.insert(status_flags); + +} +void Status::extract(Serializer& serializer) +{ + serializer.extract(filter_state); + + serializer.extract(dynamics_mode); + + serializer.extract(status_flags); + +} + +void LinearAccel::insert(Serializer& serializer) const +{ + serializer.insert(accel); + + serializer.insert(valid_flags); + +} +void LinearAccel::extract(Serializer& serializer) +{ + serializer.extract(accel); + + serializer.extract(valid_flags); + +} + +void GravityVector::insert(Serializer& serializer) const +{ + serializer.insert(gravity); + + serializer.insert(valid_flags); + +} +void GravityVector::extract(Serializer& serializer) +{ + serializer.extract(gravity); + + serializer.extract(valid_flags); + +} + +void CompAccel::insert(Serializer& serializer) const +{ + serializer.insert(accel); + + serializer.insert(valid_flags); + +} +void CompAccel::extract(Serializer& serializer) +{ + serializer.extract(accel); + + serializer.extract(valid_flags); + +} + +void CompAngularRate::insert(Serializer& serializer) const +{ + serializer.insert(gyro); + + serializer.insert(valid_flags); + +} +void CompAngularRate::extract(Serializer& serializer) +{ + serializer.extract(gyro); + + serializer.extract(valid_flags); + +} + +void QuaternionAttitudeUncertainty::insert(Serializer& serializer) const +{ + serializer.insert(q); + + serializer.insert(valid_flags); + +} +void QuaternionAttitudeUncertainty::extract(Serializer& serializer) +{ + serializer.extract(q); + + serializer.extract(valid_flags); + +} + +void Wgs84GravityMag::insert(Serializer& serializer) const +{ + serializer.insert(magnitude); + + serializer.insert(valid_flags); + +} +void Wgs84GravityMag::extract(Serializer& serializer) +{ + serializer.extract(magnitude); + + serializer.extract(valid_flags); + +} + +void HeadingUpdateState::insert(Serializer& serializer) const +{ + serializer.insert(heading); + + serializer.insert(heading_1sigma); + + serializer.insert(source); + + serializer.insert(valid_flags); + +} +void HeadingUpdateState::extract(Serializer& serializer) +{ + serializer.extract(heading); + + serializer.extract(heading_1sigma); + + serializer.extract(source); + + serializer.extract(valid_flags); + +} + +void MagneticModel::insert(Serializer& serializer) const +{ + serializer.insert(intensity_north); + + serializer.insert(intensity_east); + + serializer.insert(intensity_down); + + serializer.insert(inclination); + + serializer.insert(declination); + + serializer.insert(valid_flags); + +} +void MagneticModel::extract(Serializer& serializer) +{ + serializer.extract(intensity_north); + + serializer.extract(intensity_east); + + serializer.extract(intensity_down); + + serializer.extract(inclination); + + serializer.extract(declination); + + serializer.extract(valid_flags); + +} + +void AccelScaleFactor::insert(Serializer& serializer) const +{ + serializer.insert(scale_factor); + + serializer.insert(valid_flags); + +} +void AccelScaleFactor::extract(Serializer& serializer) +{ + serializer.extract(scale_factor); + + serializer.extract(valid_flags); + +} + +void AccelScaleFactorUncertainty::insert(Serializer& serializer) const +{ + serializer.insert(scale_factor_uncert); + + serializer.insert(valid_flags); + +} +void AccelScaleFactorUncertainty::extract(Serializer& serializer) +{ + serializer.extract(scale_factor_uncert); + + serializer.extract(valid_flags); + +} + +void GyroScaleFactor::insert(Serializer& serializer) const +{ + serializer.insert(scale_factor); + + serializer.insert(valid_flags); + +} +void GyroScaleFactor::extract(Serializer& serializer) +{ + serializer.extract(scale_factor); + + serializer.extract(valid_flags); + +} + +void GyroScaleFactorUncertainty::insert(Serializer& serializer) const +{ + serializer.insert(scale_factor_uncert); + + serializer.insert(valid_flags); + +} +void GyroScaleFactorUncertainty::extract(Serializer& serializer) +{ + serializer.extract(scale_factor_uncert); + + serializer.extract(valid_flags); + +} + +void MagBias::insert(Serializer& serializer) const +{ + serializer.insert(bias); + + serializer.insert(valid_flags); + +} +void MagBias::extract(Serializer& serializer) +{ + serializer.extract(bias); + + serializer.extract(valid_flags); + +} + +void MagBiasUncertainty::insert(Serializer& serializer) const +{ + serializer.insert(bias_uncert); + + serializer.insert(valid_flags); + +} +void MagBiasUncertainty::extract(Serializer& serializer) +{ + serializer.extract(bias_uncert); + + serializer.extract(valid_flags); + +} + +void StandardAtmosphere::insert(Serializer& serializer) const +{ + serializer.insert(geometric_altitude); + + serializer.insert(geopotential_altitude); + + serializer.insert(standard_temperature); + + serializer.insert(standard_pressure); + + serializer.insert(standard_density); + + serializer.insert(valid_flags); + +} +void StandardAtmosphere::extract(Serializer& serializer) +{ + serializer.extract(geometric_altitude); + + serializer.extract(geopotential_altitude); + + serializer.extract(standard_temperature); + + serializer.extract(standard_pressure); + + serializer.extract(standard_density); + + serializer.extract(valid_flags); + +} + +void PressureAltitude::insert(Serializer& serializer) const +{ + serializer.insert(pressure_altitude); + + serializer.insert(valid_flags); + +} +void PressureAltitude::extract(Serializer& serializer) +{ + serializer.extract(pressure_altitude); + + serializer.extract(valid_flags); + +} + +void DensityAltitude::insert(Serializer& serializer) const +{ + serializer.insert(density_altitude); + + serializer.insert(valid_flags); + +} +void DensityAltitude::extract(Serializer& serializer) +{ + serializer.extract(density_altitude); + + serializer.extract(valid_flags); + +} + +void AntennaOffsetCorrection::insert(Serializer& serializer) const +{ + serializer.insert(offset); + + serializer.insert(valid_flags); + +} +void AntennaOffsetCorrection::extract(Serializer& serializer) +{ + serializer.extract(offset); + + serializer.extract(valid_flags); + +} + +void AntennaOffsetCorrectionUncertainty::insert(Serializer& serializer) const +{ + serializer.insert(offset_uncert); + + serializer.insert(valid_flags); + +} +void AntennaOffsetCorrectionUncertainty::extract(Serializer& serializer) +{ + serializer.extract(offset_uncert); + + serializer.extract(valid_flags); + +} + +void MultiAntennaOffsetCorrection::insert(Serializer& serializer) const +{ + serializer.insert(receiver_id); + + serializer.insert(offset); + + serializer.insert(valid_flags); + +} +void MultiAntennaOffsetCorrection::extract(Serializer& serializer) +{ + serializer.extract(receiver_id); + + serializer.extract(offset); + + serializer.extract(valid_flags); + +} + +void MultiAntennaOffsetCorrectionUncertainty::insert(Serializer& serializer) const +{ + serializer.insert(receiver_id); + + serializer.insert(offset_uncert); + + serializer.insert(valid_flags); + +} +void MultiAntennaOffsetCorrectionUncertainty::extract(Serializer& serializer) +{ + serializer.extract(receiver_id); + + serializer.extract(offset_uncert); + + serializer.extract(valid_flags); + +} + +void MagnetometerOffset::insert(Serializer& serializer) const +{ + serializer.insert(hard_iron); + + serializer.insert(valid_flags); + +} +void MagnetometerOffset::extract(Serializer& serializer) +{ + serializer.extract(hard_iron); + + serializer.extract(valid_flags); + +} + +void MagnetometerMatrix::insert(Serializer& serializer) const +{ + serializer.insert(soft_iron); + + serializer.insert(valid_flags); + +} +void MagnetometerMatrix::extract(Serializer& serializer) +{ + serializer.extract(soft_iron); + + serializer.extract(valid_flags); + +} + +void MagnetometerOffsetUncertainty::insert(Serializer& serializer) const +{ + serializer.insert(hard_iron_uncertainty); + + serializer.insert(valid_flags); + +} +void MagnetometerOffsetUncertainty::extract(Serializer& serializer) +{ + serializer.extract(hard_iron_uncertainty); + + serializer.extract(valid_flags); + +} + +void MagnetometerMatrixUncertainty::insert(Serializer& serializer) const +{ + serializer.insert(soft_iron_uncertainty); + + serializer.insert(valid_flags); + +} +void MagnetometerMatrixUncertainty::extract(Serializer& serializer) +{ + serializer.extract(soft_iron_uncertainty); + + serializer.extract(valid_flags); + +} + +void MagnetometerCovarianceMatrix::insert(Serializer& serializer) const +{ + serializer.insert(covariance); + + serializer.insert(valid_flags); + +} +void MagnetometerCovarianceMatrix::extract(Serializer& serializer) +{ + serializer.extract(covariance); + + serializer.extract(valid_flags); + +} + +void MagnetometerResidualVector::insert(Serializer& serializer) const +{ + serializer.insert(residual); + + serializer.insert(valid_flags); + +} +void MagnetometerResidualVector::extract(Serializer& serializer) +{ + serializer.extract(residual); + + serializer.extract(valid_flags); + +} + +void ClockCorrection::insert(Serializer& serializer) const +{ + serializer.insert(receiver_id); + + serializer.insert(bias); + + serializer.insert(bias_drift); + + serializer.insert(valid_flags); + +} +void ClockCorrection::extract(Serializer& serializer) +{ + serializer.extract(receiver_id); + + serializer.extract(bias); + + serializer.extract(bias_drift); + + serializer.extract(valid_flags); + +} + +void ClockCorrectionUncertainty::insert(Serializer& serializer) const +{ + serializer.insert(receiver_id); + + serializer.insert(bias_uncertainty); + + serializer.insert(bias_drift_uncertainty); + + serializer.insert(valid_flags); + +} +void ClockCorrectionUncertainty::extract(Serializer& serializer) +{ + serializer.extract(receiver_id); + + serializer.extract(bias_uncertainty); + + serializer.extract(bias_drift_uncertainty); + + serializer.extract(valid_flags); + +} + +void GnssPosAidStatus::insert(Serializer& serializer) const +{ + serializer.insert(receiver_id); + + serializer.insert(time_of_week); + + serializer.insert(status); + + for(unsigned int i=0; i < 8; i++) + serializer.insert(reserved[i]); + +} +void GnssPosAidStatus::extract(Serializer& serializer) +{ + serializer.extract(receiver_id); + + serializer.extract(time_of_week); + + serializer.extract(status); + + for(unsigned int i=0; i < 8; i++) + serializer.extract(reserved[i]); + +} + +void GnssAttAidStatus::insert(Serializer& serializer) const +{ + serializer.insert(time_of_week); + + serializer.insert(status); + + for(unsigned int i=0; i < 8; i++) + serializer.insert(reserved[i]); + +} +void GnssAttAidStatus::extract(Serializer& serializer) +{ + serializer.extract(time_of_week); + + serializer.extract(status); + + for(unsigned int i=0; i < 8; i++) + serializer.extract(reserved[i]); + +} + +void HeadAidStatus::insert(Serializer& serializer) const +{ + serializer.insert(time_of_week); + + serializer.insert(type); + + for(unsigned int i=0; i < 2; i++) + serializer.insert(reserved[i]); + +} +void HeadAidStatus::extract(Serializer& serializer) +{ + serializer.extract(time_of_week); + + serializer.extract(type); + + for(unsigned int i=0; i < 2; i++) + serializer.extract(reserved[i]); + +} + +void RelPosNed::insert(Serializer& serializer) const +{ + serializer.insert(relative_position); + + serializer.insert(valid_flags); + +} +void RelPosNed::extract(Serializer& serializer) +{ + serializer.extract(relative_position); + + serializer.extract(valid_flags); + +} + +void EcefPos::insert(Serializer& serializer) const +{ + serializer.insert(position_ecef); + + serializer.insert(valid_flags); + +} +void EcefPos::extract(Serializer& serializer) +{ + serializer.extract(position_ecef); + + serializer.extract(valid_flags); + +} + +void EcefVel::insert(Serializer& serializer) const +{ + serializer.insert(velocity_ecef); + + serializer.insert(valid_flags); + +} +void EcefVel::extract(Serializer& serializer) +{ + serializer.extract(velocity_ecef); + + serializer.extract(valid_flags); + +} + +void EcefPosUncertainty::insert(Serializer& serializer) const +{ + serializer.insert(pos_uncertainty); + + serializer.insert(valid_flags); + +} +void EcefPosUncertainty::extract(Serializer& serializer) +{ + serializer.extract(pos_uncertainty); + + serializer.extract(valid_flags); + +} + +void EcefVelUncertainty::insert(Serializer& serializer) const +{ + serializer.insert(vel_uncertainty); + + serializer.insert(valid_flags); + +} +void EcefVelUncertainty::extract(Serializer& serializer) +{ + serializer.extract(vel_uncertainty); + + serializer.extract(valid_flags); + +} + +void AidingMeasurementSummary::insert(Serializer& serializer) const +{ + serializer.insert(time_of_week); + + serializer.insert(source); + + serializer.insert(type); + + serializer.insert(indicator); + +} +void AidingMeasurementSummary::extract(Serializer& serializer) +{ + serializer.extract(time_of_week); + + serializer.extract(source); + + serializer.extract(type); + + serializer.extract(indicator); + +} + +void OdometerScaleFactorError::insert(Serializer& serializer) const +{ + serializer.insert(scale_factor_error); + + serializer.insert(valid_flags); + +} +void OdometerScaleFactorError::extract(Serializer& serializer) +{ + serializer.extract(scale_factor_error); + + serializer.extract(valid_flags); + +} + +void OdometerScaleFactorErrorUncertainty::insert(Serializer& serializer) const +{ + serializer.insert(scale_factor_error_uncertainty); + + serializer.insert(valid_flags); + +} +void OdometerScaleFactorErrorUncertainty::extract(Serializer& serializer) +{ + serializer.extract(scale_factor_error_uncertainty); + + serializer.extract(valid_flags); + +} + +void GnssDualAntennaStatus::insert(Serializer& serializer) const +{ + serializer.insert(time_of_week); + + serializer.insert(heading); + + serializer.insert(heading_unc); + + serializer.insert(fix_type); + + serializer.insert(status_flags); + + serializer.insert(valid_flags); + +} +void GnssDualAntennaStatus::extract(Serializer& serializer) +{ + serializer.extract(time_of_week); + + serializer.extract(heading); + + serializer.extract(heading_unc); + + serializer.extract(fix_type); + + serializer.extract(status_flags); + + serializer.extract(valid_flags); + +} + +void AidingFrameConfigError::insert(Serializer& serializer) const +{ + serializer.insert(frame_id); + + serializer.insert(translation); + + serializer.insert(attitude); + +} +void AidingFrameConfigError::extract(Serializer& serializer) +{ + serializer.extract(frame_id); + + serializer.extract(translation); + + serializer.extract(attitude); + +} + +void AidingFrameConfigErrorUncertainty::insert(Serializer& serializer) const +{ + serializer.insert(frame_id); + + serializer.insert(translation_unc); + + serializer.insert(attitude_unc); + +} +void AidingFrameConfigErrorUncertainty::extract(Serializer& serializer) +{ + serializer.extract(frame_id); + + serializer.extract(translation_unc); + + serializer.extract(attitude_unc); + +} + + +} // namespace data_filter +} // namespace mip + diff --git a/src/mip/definitions/data_filter.hpp b/src/cpp/mip/definitions/data_filter.hpp similarity index 76% rename from src/mip/definitions/data_filter.hpp rename to src/cpp/mip/definitions/data_filter.hpp index 96ab927e2..833653706 100644 --- a/src/mip/definitions/data_filter.hpp +++ b/src/cpp/mip/definitions/data_filter.hpp @@ -1,16 +1,14 @@ #pragma once -#include "common.h" -#include "descriptors.h" -#include "../mip_result.h" +#include +#include +#include +#include #include #include -#include namespace mip { -class Serializer; - namespace C { struct mip_interface; } // namespace C @@ -18,9 +16,9 @@ struct mip_interface; namespace data_filter { //////////////////////////////////////////////////////////////////////////////// -///@addtogroup MipData_cpp MIP Data [CPP] +///@addtogroup MipData_cpp ///@{ -///@defgroup filter_data_cpp Filter Data [CPP] +///@defgroup filter_data_cpp Filter Data /// ///@{ @@ -123,6 +121,7 @@ enum class FilterDynamicsMode : uint16_t struct FilterStatusFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -167,66 +166,64 @@ struct FilterStatusFlags : Bitfield FilterStatusFlags& operator&=(uint16_t val) { return *this = value & val; } bool gx5InitNoAttitude() const { return (value & GX5_INIT_NO_ATTITUDE) > 0; } - void gx5InitNoAttitude(bool val) { if(val) value |= GX5_INIT_NO_ATTITUDE; else value &= ~GX5_INIT_NO_ATTITUDE; } + void gx5InitNoAttitude(bool val) { value &= ~GX5_INIT_NO_ATTITUDE; if(val) value |= GX5_INIT_NO_ATTITUDE; } bool gx5InitNoPositionVelocity() const { return (value & GX5_INIT_NO_POSITION_VELOCITY) > 0; } - void gx5InitNoPositionVelocity(bool val) { if(val) value |= GX5_INIT_NO_POSITION_VELOCITY; else value &= ~GX5_INIT_NO_POSITION_VELOCITY; } + void gx5InitNoPositionVelocity(bool val) { value &= ~GX5_INIT_NO_POSITION_VELOCITY; if(val) value |= GX5_INIT_NO_POSITION_VELOCITY; } bool gx5RunImuUnavailable() const { return (value & GX5_RUN_IMU_UNAVAILABLE) > 0; } - void gx5RunImuUnavailable(bool val) { if(val) value |= GX5_RUN_IMU_UNAVAILABLE; else value &= ~GX5_RUN_IMU_UNAVAILABLE; } + void gx5RunImuUnavailable(bool val) { value &= ~GX5_RUN_IMU_UNAVAILABLE; if(val) value |= GX5_RUN_IMU_UNAVAILABLE; } bool gx5RunGpsUnavailable() const { return (value & GX5_RUN_GPS_UNAVAILABLE) > 0; } - void gx5RunGpsUnavailable(bool val) { if(val) value |= GX5_RUN_GPS_UNAVAILABLE; else value &= ~GX5_RUN_GPS_UNAVAILABLE; } + void gx5RunGpsUnavailable(bool val) { value &= ~GX5_RUN_GPS_UNAVAILABLE; if(val) value |= GX5_RUN_GPS_UNAVAILABLE; } bool gx5RunMatrixSingularity() const { return (value & GX5_RUN_MATRIX_SINGULARITY) > 0; } - void gx5RunMatrixSingularity(bool val) { if(val) value |= GX5_RUN_MATRIX_SINGULARITY; else value &= ~GX5_RUN_MATRIX_SINGULARITY; } + void gx5RunMatrixSingularity(bool val) { value &= ~GX5_RUN_MATRIX_SINGULARITY; if(val) value |= GX5_RUN_MATRIX_SINGULARITY; } bool gx5RunPositionCovarianceWarning() const { return (value & GX5_RUN_POSITION_COVARIANCE_WARNING) > 0; } - void gx5RunPositionCovarianceWarning(bool val) { if(val) value |= GX5_RUN_POSITION_COVARIANCE_WARNING; else value &= ~GX5_RUN_POSITION_COVARIANCE_WARNING; } + void gx5RunPositionCovarianceWarning(bool val) { value &= ~GX5_RUN_POSITION_COVARIANCE_WARNING; if(val) value |= GX5_RUN_POSITION_COVARIANCE_WARNING; } bool gx5RunVelocityCovarianceWarning() const { return (value & GX5_RUN_VELOCITY_COVARIANCE_WARNING) > 0; } - void gx5RunVelocityCovarianceWarning(bool val) { if(val) value |= GX5_RUN_VELOCITY_COVARIANCE_WARNING; else value &= ~GX5_RUN_VELOCITY_COVARIANCE_WARNING; } + void gx5RunVelocityCovarianceWarning(bool val) { value &= ~GX5_RUN_VELOCITY_COVARIANCE_WARNING; if(val) value |= GX5_RUN_VELOCITY_COVARIANCE_WARNING; } bool gx5RunAttitudeCovarianceWarning() const { return (value & GX5_RUN_ATTITUDE_COVARIANCE_WARNING) > 0; } - void gx5RunAttitudeCovarianceWarning(bool val) { if(val) value |= GX5_RUN_ATTITUDE_COVARIANCE_WARNING; else value &= ~GX5_RUN_ATTITUDE_COVARIANCE_WARNING; } + void gx5RunAttitudeCovarianceWarning(bool val) { value &= ~GX5_RUN_ATTITUDE_COVARIANCE_WARNING; if(val) value |= GX5_RUN_ATTITUDE_COVARIANCE_WARNING; } bool gx5RunNanInSolutionWarning() const { return (value & GX5_RUN_NAN_IN_SOLUTION_WARNING) > 0; } - void gx5RunNanInSolutionWarning(bool val) { if(val) value |= GX5_RUN_NAN_IN_SOLUTION_WARNING; else value &= ~GX5_RUN_NAN_IN_SOLUTION_WARNING; } + void gx5RunNanInSolutionWarning(bool val) { value &= ~GX5_RUN_NAN_IN_SOLUTION_WARNING; if(val) value |= GX5_RUN_NAN_IN_SOLUTION_WARNING; } bool gx5RunGyroBiasEstHighWarning() const { return (value & GX5_RUN_GYRO_BIAS_EST_HIGH_WARNING) > 0; } - void gx5RunGyroBiasEstHighWarning(bool val) { if(val) value |= GX5_RUN_GYRO_BIAS_EST_HIGH_WARNING; else value &= ~GX5_RUN_GYRO_BIAS_EST_HIGH_WARNING; } + void gx5RunGyroBiasEstHighWarning(bool val) { value &= ~GX5_RUN_GYRO_BIAS_EST_HIGH_WARNING; if(val) value |= GX5_RUN_GYRO_BIAS_EST_HIGH_WARNING; } bool gx5RunAccelBiasEstHighWarning() const { return (value & GX5_RUN_ACCEL_BIAS_EST_HIGH_WARNING) > 0; } - void gx5RunAccelBiasEstHighWarning(bool val) { if(val) value |= GX5_RUN_ACCEL_BIAS_EST_HIGH_WARNING; else value &= ~GX5_RUN_ACCEL_BIAS_EST_HIGH_WARNING; } + void gx5RunAccelBiasEstHighWarning(bool val) { value &= ~GX5_RUN_ACCEL_BIAS_EST_HIGH_WARNING; if(val) value |= GX5_RUN_ACCEL_BIAS_EST_HIGH_WARNING; } bool gx5RunGyroScaleFactorEstHighWarning() const { return (value & GX5_RUN_GYRO_SCALE_FACTOR_EST_HIGH_WARNING) > 0; } - void gx5RunGyroScaleFactorEstHighWarning(bool val) { if(val) value |= GX5_RUN_GYRO_SCALE_FACTOR_EST_HIGH_WARNING; else value &= ~GX5_RUN_GYRO_SCALE_FACTOR_EST_HIGH_WARNING; } + void gx5RunGyroScaleFactorEstHighWarning(bool val) { value &= ~GX5_RUN_GYRO_SCALE_FACTOR_EST_HIGH_WARNING; if(val) value |= GX5_RUN_GYRO_SCALE_FACTOR_EST_HIGH_WARNING; } bool gx5RunAccelScaleFactorEstHighWarning() const { return (value & GX5_RUN_ACCEL_SCALE_FACTOR_EST_HIGH_WARNING) > 0; } - void gx5RunAccelScaleFactorEstHighWarning(bool val) { if(val) value |= GX5_RUN_ACCEL_SCALE_FACTOR_EST_HIGH_WARNING; else value &= ~GX5_RUN_ACCEL_SCALE_FACTOR_EST_HIGH_WARNING; } + void gx5RunAccelScaleFactorEstHighWarning(bool val) { value &= ~GX5_RUN_ACCEL_SCALE_FACTOR_EST_HIGH_WARNING; if(val) value |= GX5_RUN_ACCEL_SCALE_FACTOR_EST_HIGH_WARNING; } bool gx5RunMagBiasEstHighWarning() const { return (value & GX5_RUN_MAG_BIAS_EST_HIGH_WARNING) > 0; } - void gx5RunMagBiasEstHighWarning(bool val) { if(val) value |= GX5_RUN_MAG_BIAS_EST_HIGH_WARNING; else value &= ~GX5_RUN_MAG_BIAS_EST_HIGH_WARNING; } + void gx5RunMagBiasEstHighWarning(bool val) { value &= ~GX5_RUN_MAG_BIAS_EST_HIGH_WARNING; if(val) value |= GX5_RUN_MAG_BIAS_EST_HIGH_WARNING; } bool gx5RunAntOffsetCorrectionEstHighWarning() const { return (value & GX5_RUN_ANT_OFFSET_CORRECTION_EST_HIGH_WARNING) > 0; } - void gx5RunAntOffsetCorrectionEstHighWarning(bool val) { if(val) value |= GX5_RUN_ANT_OFFSET_CORRECTION_EST_HIGH_WARNING; else value &= ~GX5_RUN_ANT_OFFSET_CORRECTION_EST_HIGH_WARNING; } + void gx5RunAntOffsetCorrectionEstHighWarning(bool val) { value &= ~GX5_RUN_ANT_OFFSET_CORRECTION_EST_HIGH_WARNING; if(val) value |= GX5_RUN_ANT_OFFSET_CORRECTION_EST_HIGH_WARNING; } bool gx5RunMagHardIronEstHighWarning() const { return (value & GX5_RUN_MAG_HARD_IRON_EST_HIGH_WARNING) > 0; } - void gx5RunMagHardIronEstHighWarning(bool val) { if(val) value |= GX5_RUN_MAG_HARD_IRON_EST_HIGH_WARNING; else value &= ~GX5_RUN_MAG_HARD_IRON_EST_HIGH_WARNING; } + void gx5RunMagHardIronEstHighWarning(bool val) { value &= ~GX5_RUN_MAG_HARD_IRON_EST_HIGH_WARNING; if(val) value |= GX5_RUN_MAG_HARD_IRON_EST_HIGH_WARNING; } bool gx5RunMagSoftIronEstHighWarning() const { return (value & GX5_RUN_MAG_SOFT_IRON_EST_HIGH_WARNING) > 0; } - void gx5RunMagSoftIronEstHighWarning(bool val) { if(val) value |= GX5_RUN_MAG_SOFT_IRON_EST_HIGH_WARNING; else value &= ~GX5_RUN_MAG_SOFT_IRON_EST_HIGH_WARNING; } + void gx5RunMagSoftIronEstHighWarning(bool val) { value &= ~GX5_RUN_MAG_SOFT_IRON_EST_HIGH_WARNING; if(val) value |= GX5_RUN_MAG_SOFT_IRON_EST_HIGH_WARNING; } uint16_t gq7FilterCondition() const { return (value & GQ7_FILTER_CONDITION) >> 0; } void gq7FilterCondition(uint16_t val) { value = (value & ~GQ7_FILTER_CONDITION) | (val << 0); } bool gq7RollPitchWarning() const { return (value & GQ7_ROLL_PITCH_WARNING) > 0; } - void gq7RollPitchWarning(bool val) { if(val) value |= GQ7_ROLL_PITCH_WARNING; else value &= ~GQ7_ROLL_PITCH_WARNING; } + void gq7RollPitchWarning(bool val) { value &= ~GQ7_ROLL_PITCH_WARNING; if(val) value |= GQ7_ROLL_PITCH_WARNING; } bool gq7HeadingWarning() const { return (value & GQ7_HEADING_WARNING) > 0; } - void gq7HeadingWarning(bool val) { if(val) value |= GQ7_HEADING_WARNING; else value &= ~GQ7_HEADING_WARNING; } + void gq7HeadingWarning(bool val) { value &= ~GQ7_HEADING_WARNING; if(val) value |= GQ7_HEADING_WARNING; } bool gq7PositionWarning() const { return (value & GQ7_POSITION_WARNING) > 0; } - void gq7PositionWarning(bool val) { if(val) value |= GQ7_POSITION_WARNING; else value &= ~GQ7_POSITION_WARNING; } + void gq7PositionWarning(bool val) { value &= ~GQ7_POSITION_WARNING; if(val) value |= GQ7_POSITION_WARNING; } bool gq7VelocityWarning() const { return (value & GQ7_VELOCITY_WARNING) > 0; } - void gq7VelocityWarning(bool val) { if(val) value |= GQ7_VELOCITY_WARNING; else value &= ~GQ7_VELOCITY_WARNING; } + void gq7VelocityWarning(bool val) { value &= ~GQ7_VELOCITY_WARNING; if(val) value |= GQ7_VELOCITY_WARNING; } bool gq7ImuBiasWarning() const { return (value & GQ7_IMU_BIAS_WARNING) > 0; } - void gq7ImuBiasWarning(bool val) { if(val) value |= GQ7_IMU_BIAS_WARNING; else value &= ~GQ7_IMU_BIAS_WARNING; } + void gq7ImuBiasWarning(bool val) { value &= ~GQ7_IMU_BIAS_WARNING; if(val) value |= GQ7_IMU_BIAS_WARNING; } bool gq7GnssClkWarning() const { return (value & GQ7_GNSS_CLK_WARNING) > 0; } - void gq7GnssClkWarning(bool val) { if(val) value |= GQ7_GNSS_CLK_WARNING; else value &= ~GQ7_GNSS_CLK_WARNING; } + void gq7GnssClkWarning(bool val) { value &= ~GQ7_GNSS_CLK_WARNING; if(val) value |= GQ7_GNSS_CLK_WARNING; } bool gq7AntennaLeverArmWarning() const { return (value & GQ7_ANTENNA_LEVER_ARM_WARNING) > 0; } - void gq7AntennaLeverArmWarning(bool val) { if(val) value |= GQ7_ANTENNA_LEVER_ARM_WARNING; else value &= ~GQ7_ANTENNA_LEVER_ARM_WARNING; } + void gq7AntennaLeverArmWarning(bool val) { value &= ~GQ7_ANTENNA_LEVER_ARM_WARNING; if(val) value |= GQ7_ANTENNA_LEVER_ARM_WARNING; } bool gq7MountingTransformWarning() const { return (value & GQ7_MOUNTING_TRANSFORM_WARNING) > 0; } - void gq7MountingTransformWarning(bool val) { if(val) value |= GQ7_MOUNTING_TRANSFORM_WARNING; else value &= ~GQ7_MOUNTING_TRANSFORM_WARNING; } + void gq7MountingTransformWarning(bool val) { value &= ~GQ7_MOUNTING_TRANSFORM_WARNING; if(val) value |= GQ7_MOUNTING_TRANSFORM_WARNING; } bool gq7TimeSyncWarning() const { return (value & GQ7_TIME_SYNC_WARNING) > 0; } - void gq7TimeSyncWarning(bool val) { if(val) value |= GQ7_TIME_SYNC_WARNING; else value &= ~GQ7_TIME_SYNC_WARNING; } + void gq7TimeSyncWarning(bool val) { value &= ~GQ7_TIME_SYNC_WARNING; if(val) value |= GQ7_TIME_SYNC_WARNING; } uint16_t gq7SolutionError() const { return (value & GQ7_SOLUTION_ERROR) >> 12; } void gq7SolutionError(uint16_t val) { value = (value & ~GQ7_SOLUTION_ERROR) | (val << 12); } - bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - enum class FilterAidingMeasurementType : uint8_t { GNSS = 1, ///< @@ -248,6 +245,7 @@ enum class FilterAidingMeasurementType : uint8_t struct FilterMeasurementIndicator : Bitfield { + typedef uint8_t Type; enum _enumType : uint8_t { NONE = 0x00, @@ -270,24 +268,23 @@ struct FilterMeasurementIndicator : Bitfield FilterMeasurementIndicator& operator&=(uint8_t val) { return *this = value & val; } bool enabled() const { return (value & ENABLED) > 0; } - void enabled(bool val) { if(val) value |= ENABLED; else value &= ~ENABLED; } + void enabled(bool val) { value &= ~ENABLED; if(val) value |= ENABLED; } bool used() const { return (value & USED) > 0; } - void used(bool val) { if(val) value |= USED; else value &= ~USED; } + void used(bool val) { value &= ~USED; if(val) value |= USED; } bool residualHighWarning() const { return (value & RESIDUAL_HIGH_WARNING) > 0; } - void residualHighWarning(bool val) { if(val) value |= RESIDUAL_HIGH_WARNING; else value &= ~RESIDUAL_HIGH_WARNING; } + void residualHighWarning(bool val) { value &= ~RESIDUAL_HIGH_WARNING; if(val) value |= RESIDUAL_HIGH_WARNING; } bool sampleTimeWarning() const { return (value & SAMPLE_TIME_WARNING) > 0; } - void sampleTimeWarning(bool val) { if(val) value |= SAMPLE_TIME_WARNING; else value &= ~SAMPLE_TIME_WARNING; } + void sampleTimeWarning(bool val) { value &= ~SAMPLE_TIME_WARNING; if(val) value |= SAMPLE_TIME_WARNING; } bool configurationError() const { return (value & CONFIGURATION_ERROR) > 0; } - void configurationError(bool val) { if(val) value |= CONFIGURATION_ERROR; else value &= ~CONFIGURATION_ERROR; } + void configurationError(bool val) { value &= ~CONFIGURATION_ERROR; if(val) value |= CONFIGURATION_ERROR; } bool maxNumMeasExceeded() const { return (value & MAX_NUM_MEAS_EXCEEDED) > 0; } - void maxNumMeasExceeded(bool val) { if(val) value |= MAX_NUM_MEAS_EXCEEDED; else value &= ~MAX_NUM_MEAS_EXCEEDED; } - + void maxNumMeasExceeded(bool val) { value &= ~MAX_NUM_MEAS_EXCEEDED; if(val) value |= MAX_NUM_MEAS_EXCEEDED; } bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - struct GnssAidStatusFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -320,121 +317,127 @@ struct GnssAidStatusFlags : Bitfield GnssAidStatusFlags& operator&=(uint16_t val) { return *this = value & val; } bool tightCoupling() const { return (value & TIGHT_COUPLING) > 0; } - void tightCoupling(bool val) { if(val) value |= TIGHT_COUPLING; else value &= ~TIGHT_COUPLING; } + void tightCoupling(bool val) { value &= ~TIGHT_COUPLING; if(val) value |= TIGHT_COUPLING; } bool differential() const { return (value & DIFFERENTIAL) > 0; } - void differential(bool val) { if(val) value |= DIFFERENTIAL; else value &= ~DIFFERENTIAL; } + void differential(bool val) { value &= ~DIFFERENTIAL; if(val) value |= DIFFERENTIAL; } bool integerFix() const { return (value & INTEGER_FIX) > 0; } - void integerFix(bool val) { if(val) value |= INTEGER_FIX; else value &= ~INTEGER_FIX; } + void integerFix(bool val) { value &= ~INTEGER_FIX; if(val) value |= INTEGER_FIX; } bool gpsL1() const { return (value & GPS_L1) > 0; } - void gpsL1(bool val) { if(val) value |= GPS_L1; else value &= ~GPS_L1; } + void gpsL1(bool val) { value &= ~GPS_L1; if(val) value |= GPS_L1; } bool gpsL2() const { return (value & GPS_L2) > 0; } - void gpsL2(bool val) { if(val) value |= GPS_L2; else value &= ~GPS_L2; } + void gpsL2(bool val) { value &= ~GPS_L2; if(val) value |= GPS_L2; } bool gpsL5() const { return (value & GPS_L5) > 0; } - void gpsL5(bool val) { if(val) value |= GPS_L5; else value &= ~GPS_L5; } + void gpsL5(bool val) { value &= ~GPS_L5; if(val) value |= GPS_L5; } bool gloL1() const { return (value & GLO_L1) > 0; } - void gloL1(bool val) { if(val) value |= GLO_L1; else value &= ~GLO_L1; } + void gloL1(bool val) { value &= ~GLO_L1; if(val) value |= GLO_L1; } bool gloL2() const { return (value & GLO_L2) > 0; } - void gloL2(bool val) { if(val) value |= GLO_L2; else value &= ~GLO_L2; } + void gloL2(bool val) { value &= ~GLO_L2; if(val) value |= GLO_L2; } bool galE1() const { return (value & GAL_E1) > 0; } - void galE1(bool val) { if(val) value |= GAL_E1; else value &= ~GAL_E1; } + void galE1(bool val) { value &= ~GAL_E1; if(val) value |= GAL_E1; } bool galE5() const { return (value & GAL_E5) > 0; } - void galE5(bool val) { if(val) value |= GAL_E5; else value &= ~GAL_E5; } + void galE5(bool val) { value &= ~GAL_E5; if(val) value |= GAL_E5; } bool galE6() const { return (value & GAL_E6) > 0; } - void galE6(bool val) { if(val) value |= GAL_E6; else value &= ~GAL_E6; } + void galE6(bool val) { value &= ~GAL_E6; if(val) value |= GAL_E6; } bool beiB1() const { return (value & BEI_B1) > 0; } - void beiB1(bool val) { if(val) value |= BEI_B1; else value &= ~BEI_B1; } + void beiB1(bool val) { value &= ~BEI_B1; if(val) value |= BEI_B1; } bool beiB2() const { return (value & BEI_B2) > 0; } - void beiB2(bool val) { if(val) value |= BEI_B2; else value &= ~BEI_B2; } + void beiB2(bool val) { value &= ~BEI_B2; if(val) value |= BEI_B2; } bool beiB3() const { return (value & BEI_B3) > 0; } - void beiB3(bool val) { if(val) value |= BEI_B3; else value &= ~BEI_B3; } + void beiB3(bool val) { value &= ~BEI_B3; if(val) value |= BEI_B3; } bool noFix() const { return (value & NO_FIX) > 0; } - void noFix(bool val) { if(val) value |= NO_FIX; else value &= ~NO_FIX; } + void noFix(bool val) { value &= ~NO_FIX; if(val) value |= NO_FIX; } bool configError() const { return (value & CONFIG_ERROR) > 0; } - void configError(bool val) { if(val) value |= CONFIG_ERROR; else value &= ~CONFIG_ERROR; } - + void configError(bool val) { value &= ~CONFIG_ERROR; if(val) value |= CONFIG_ERROR; } bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - //////////////////////////////////////////////////////////////////////////////// // Mip Fields //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_position_llh (0x82,0x01) Position Llh [CPP] +///@defgroup filter_position_llh_cpp (0x82,0x01) Position Llh /// Filter reported position in the WGS84 geodetic frame. /// ///@{ struct PositionLlh { + /// Parameters double latitude = 0; ///< [degrees] double longitude = 0; ///< [degrees] double ellipsoid_height = 0; ///< [meters] uint16_t valid_flags = 0; ///< 0 - Invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_POS_LLH; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "PositionLlh"; static constexpr const char* DOC_NAME = "LLH Position"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(latitude,longitude,ellipsoid_height,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(latitude),std::ref(longitude),std::ref(ellipsoid_height),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const PositionLlh& self); -void extract(Serializer& serializer, PositionLlh& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_velocity_ned (0x82,0x02) Velocity Ned [CPP] +///@defgroup filter_velocity_ned_cpp (0x82,0x02) Velocity Ned /// Filter reported velocity in the NED local-level frame. /// ///@{ struct VelocityNed { + /// Parameters float north = 0; ///< [meters/second] float east = 0; ///< [meters/second] float down = 0; ///< [meters/second] uint16_t valid_flags = 0; ///< 0 - Invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_VEL_NED; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "VelocityNed"; static constexpr const char* DOC_NAME = "VelocityNed"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(north,east,down,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(north),std::ref(east),std::ref(down),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const VelocityNed& self); -void extract(Serializer& serializer, VelocityNed& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_attitude_quaternion (0x82,0x03) Attitude Quaternion [CPP] +///@defgroup filter_attitude_quaternion_cpp (0x82,0x03) Attitude Quaternion /// 4x1 vector representation of the quaternion describing the orientation of the device with respect to the NED local-level frame. /// This quaternion satisfies the following relationship: /// @@ -449,34 +452,38 @@ void extract(Serializer& serializer, VelocityNed& self); struct AttitudeQuaternion { + /// Parameters Quatf q; ///< Quaternion elements EQSTART q = (q_w, q_x, q_y, q_z) EQEND uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_ATT_QUATERNION; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "AttitudeQuaternion"; static constexpr const char* DOC_NAME = "AttitudeQuaternion"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(q[0],q[1],q[2],q[3],valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(q[0]),std::ref(q[1]),std::ref(q[2]),std::ref(q[3]),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const AttitudeQuaternion& self); -void extract(Serializer& serializer, AttitudeQuaternion& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_attitude_dcm (0x82,0x04) Attitude Dcm [CPP] +///@defgroup filter_attitude_dcm_cpp (0x82,0x04) Attitude Dcm /// 3x3 Direction Cosine Matrix EQSTART M_{ned}^{veh} EQEND describing the orientation of the device with respect to the NED local-level frame. /// This matrix satisfies the following relationship: /// @@ -487,40 +494,44 @@ void extract(Serializer& serializer, AttitudeQuaternion& self); /// EQSTART v^{ned} EQEND is a 3-element vector expressed in the NED frame.
/// EQSTART v^{veh} EQEND is the same 3-element vector expressed in the vehicle frame.
///
-/// The matrix elements are stored is row-major order: EQSTART M_{ned}^{veh} = \begin{bmatrix} M_{11}, M_{12}, M_{13}, M_{21}, M_{22}, M_{23}, M_{31}, M_{32}, M_{33} \end{bmatrix} EQEND +/// The matrix elements are stored is row-major order: EQSTART M_{ned}^{veh} = \\begin{bmatrix} M_{11}, M_{12}, M_{13}, M_{21}, M_{22}, M_{23}, M_{31}, M_{32}, M_{33} \\end{bmatrix} EQEND /// ///@{ struct AttitudeDcm { + /// Parameters Matrix3f dcm; ///< Matrix elements in row-major order. uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_ATT_MATRIX; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "AttitudeDcm"; static constexpr const char* DOC_NAME = "AttitudeDcm"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(dcm[0],dcm[1],dcm[2],dcm[3],dcm[4],dcm[5],dcm[6],dcm[7],dcm[8],valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(dcm[0]),std::ref(dcm[1]),std::ref(dcm[2]),std::ref(dcm[3]),std::ref(dcm[4]),std::ref(dcm[5]),std::ref(dcm[6]),std::ref(dcm[7]),std::ref(dcm[8]),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const AttitudeDcm& self); -void extract(Serializer& serializer, AttitudeDcm& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_euler_angles (0x82,0x05) Euler Angles [CPP] +///@defgroup filter_euler_angles_cpp (0x82,0x05) Euler Angles /// Filter reported Euler angles describing the orientation of the device with respect to the NED local-level frame. /// The Euler angles are reported in 3-2-1 (Yaw-Pitch-Roll, AKA Aircraft) order. /// @@ -528,176 +539,196 @@ void extract(Serializer& serializer, AttitudeDcm& self); struct EulerAngles { + /// Parameters float roll = 0; ///< [radians] float pitch = 0; ///< [radians] float yaw = 0; ///< [radians] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_ATT_EULER_ANGLES; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "EulerAngles"; static constexpr const char* DOC_NAME = "EulerAngles"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(roll,pitch,yaw,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(roll),std::ref(pitch),std::ref(yaw),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const EulerAngles& self); -void extract(Serializer& serializer, EulerAngles& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_gyro_bias (0x82,0x06) Gyro Bias [CPP] +///@defgroup filter_gyro_bias_cpp (0x82,0x06) Gyro Bias /// Filter reported gyro bias expressed in the sensor frame. /// ///@{ struct GyroBias { + /// Parameters Vector3f bias; ///< (x, y, z) [radians/second] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_GYRO_BIAS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GyroBias"; static constexpr const char* DOC_NAME = "GyroBias"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(bias[0],bias[1],bias[2],valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(bias[0]),std::ref(bias[1]),std::ref(bias[2]),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const GyroBias& self); -void extract(Serializer& serializer, GyroBias& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_accel_bias (0x82,0x07) Accel Bias [CPP] +///@defgroup filter_accel_bias_cpp (0x82,0x07) Accel Bias /// Filter reported accelerometer bias expressed in the sensor frame. /// ///@{ struct AccelBias { + /// Parameters Vector3f bias; ///< (x, y, z) [meters/second^2] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_ACCEL_BIAS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "AccelBias"; static constexpr const char* DOC_NAME = "AccelBias"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(bias[0],bias[1],bias[2],valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(bias[0]),std::ref(bias[1]),std::ref(bias[2]),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const AccelBias& self); -void extract(Serializer& serializer, AccelBias& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_position_llh_uncertainty (0x82,0x08) Position Llh Uncertainty [CPP] +///@defgroup filter_position_llh_uncertainty_cpp (0x82,0x08) Position Llh Uncertainty /// Filter reported 1-sigma position uncertainty in the NED local-level frame. /// ///@{ struct PositionLlhUncertainty { + /// Parameters float north = 0; ///< [meters] float east = 0; ///< [meters] float down = 0; ///< [meters] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_POS_UNCERTAINTY; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "PositionLlhUncertainty"; static constexpr const char* DOC_NAME = "LLH Position Uncertainty"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(north,east,down,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(north),std::ref(east),std::ref(down),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const PositionLlhUncertainty& self); -void extract(Serializer& serializer, PositionLlhUncertainty& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_velocity_ned_uncertainty (0x82,0x09) Velocity Ned Uncertainty [CPP] +///@defgroup filter_velocity_ned_uncertainty_cpp (0x82,0x09) Velocity Ned Uncertainty /// Filter reported 1-sigma velocity uncertainties in the NED local-level frame. /// ///@{ struct VelocityNedUncertainty { + /// Parameters float north = 0; ///< [meters/second] float east = 0; ///< [meters/second] float down = 0; ///< [meters/second] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_VEL_UNCERTAINTY; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "VelocityNedUncertainty"; static constexpr const char* DOC_NAME = "NED Velocity Uncertainty"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(north,east,down,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(north),std::ref(east),std::ref(down),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const VelocityNedUncertainty& self); -void extract(Serializer& serializer, VelocityNedUncertainty& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_euler_angles_uncertainty (0x82,0x0A) Euler Angles Uncertainty [CPP] +///@defgroup filter_euler_angles_uncertainty_cpp (0x82,0x0A) Euler Angles Uncertainty /// Filter reported 1-sigma Euler angle uncertainties. /// The uncertainties are reported in 3-2-1 (Yaw-Pitch-Roll, AKA Aircraft) order. /// @@ -705,104 +736,116 @@ void extract(Serializer& serializer, VelocityNedUncertainty& self); struct EulerAnglesUncertainty { + /// Parameters float roll = 0; ///< [radians] float pitch = 0; ///< [radians] float yaw = 0; ///< [radians] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_ATT_UNCERTAINTY_EULER; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "EulerAnglesUncertainty"; static constexpr const char* DOC_NAME = "EulerAnglesUncertainty"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(roll,pitch,yaw,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(roll),std::ref(pitch),std::ref(yaw),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const EulerAnglesUncertainty& self); -void extract(Serializer& serializer, EulerAnglesUncertainty& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_gyro_bias_uncertainty (0x82,0x0B) Gyro Bias Uncertainty [CPP] +///@defgroup filter_gyro_bias_uncertainty_cpp (0x82,0x0B) Gyro Bias Uncertainty /// Filter reported 1-sigma gyro bias uncertainties expressed in the sensor frame. /// ///@{ struct GyroBiasUncertainty { + /// Parameters Vector3f bias_uncert; ///< (x,y,z) [radians/sec] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_GYRO_BIAS_UNCERTAINTY; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GyroBiasUncertainty"; static constexpr const char* DOC_NAME = "GyroBiasUncertainty"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(bias_uncert[0],bias_uncert[1],bias_uncert[2],valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(bias_uncert[0]),std::ref(bias_uncert[1]),std::ref(bias_uncert[2]),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const GyroBiasUncertainty& self); -void extract(Serializer& serializer, GyroBiasUncertainty& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_accel_bias_uncertainty (0x82,0x0C) Accel Bias Uncertainty [CPP] +///@defgroup filter_accel_bias_uncertainty_cpp (0x82,0x0C) Accel Bias Uncertainty /// Filter reported 1-sigma accelerometer bias uncertainties expressed in the sensor frame. /// ///@{ struct AccelBiasUncertainty { + /// Parameters Vector3f bias_uncert; ///< (x,y,z) [meters/second^2] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_ACCEL_BIAS_UNCERTAINTY; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "AccelBiasUncertainty"; static constexpr const char* DOC_NAME = "AccelBiasUncertainty"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(bias_uncert[0],bias_uncert[1],bias_uncert[2],valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(bias_uncert[0]),std::ref(bias_uncert[1]),std::ref(bias_uncert[2]),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const AccelBiasUncertainty& self); -void extract(Serializer& serializer, AccelBiasUncertainty& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_timestamp (0x82,0x11) Timestamp [CPP] +///@defgroup filter_timestamp_cpp (0x82,0x11) Timestamp /// GPS timestamp of the Filter data /// /// Should the PPS become unavailable, the device will revert to its internal clock, which will cause the reported time to drift from true GPS time. @@ -815,70 +858,78 @@ void extract(Serializer& serializer, AccelBiasUncertainty& self); struct Timestamp { + /// Parameters double tow = 0; ///< GPS Time of Week [seconds] uint16_t week_number = 0; ///< GPS Week Number since 1980 [weeks] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_FILTER_TIMESTAMP; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "Timestamp"; static constexpr const char* DOC_NAME = "Timestamp"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(tow,week_number,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(tow),std::ref(week_number),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const Timestamp& self); -void extract(Serializer& serializer, Timestamp& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_status (0x82,0x10) Status [CPP] +///@defgroup filter_status_cpp (0x82,0x10) Status /// Device-specific filter status indicators. /// ///@{ struct Status { + /// Parameters FilterMode filter_state = static_cast(0); ///< Device-specific filter state. Please consult the user manual for definition. FilterDynamicsMode dynamics_mode = static_cast(0); ///< Device-specific dynamics mode. Please consult the user manual for definition. FilterStatusFlags status_flags; ///< Device-specific status flags. Please consult the user manual for definition. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_FILTER_STATUS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "Status"; static constexpr const char* DOC_NAME = "Status"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(filter_state,dynamics_mode,status_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(filter_state),std::ref(dynamics_mode),std::ref(status_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const Status& self); -void extract(Serializer& serializer, Status& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_linear_accel (0x82,0x0D) Linear Accel [CPP] +///@defgroup filter_linear_accel_cpp (0x82,0x0D) Linear Accel /// Filter-compensated linear acceleration expressed in the vehicle frame. /// Note: The estimated gravity has been removed from this data leaving only linear acceleration. /// @@ -886,204 +937,228 @@ void extract(Serializer& serializer, Status& self); struct LinearAccel { + /// Parameters Vector3f accel; ///< (x,y,z) [meters/second^2] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_LINEAR_ACCELERATION; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "LinearAccel"; static constexpr const char* DOC_NAME = "LinearAccel"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(accel[0],accel[1],accel[2],valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(accel[0]),std::ref(accel[1]),std::ref(accel[2]),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const LinearAccel& self); -void extract(Serializer& serializer, LinearAccel& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_gravity_vector (0x82,0x13) Gravity Vector [CPP] +///@defgroup filter_gravity_vector_cpp (0x82,0x13) Gravity Vector /// Filter reported gravity vector expressed in the vehicle frame. /// ///@{ struct GravityVector { + /// Parameters Vector3f gravity; ///< (x, y, z) [meters/second^2] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_GRAVITY_VECTOR; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GravityVector"; static constexpr const char* DOC_NAME = "GravityVector"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(gravity[0],gravity[1],gravity[2],valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(gravity[0]),std::ref(gravity[1]),std::ref(gravity[2]),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const GravityVector& self); -void extract(Serializer& serializer, GravityVector& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_comp_accel (0x82,0x1C) Comp Accel [CPP] +///@defgroup filter_comp_accel_cpp (0x82,0x1C) Comp Accel /// Filter-compensated acceleration expressed in the vehicle frame. /// ///@{ struct CompAccel { + /// Parameters Vector3f accel; ///< (x,y,z) [meters/second^2] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_COMPENSATED_ACCELERATION; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "CompAccel"; static constexpr const char* DOC_NAME = "Compensated Acceleration"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(accel[0],accel[1],accel[2],valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(accel[0]),std::ref(accel[1]),std::ref(accel[2]),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const CompAccel& self); -void extract(Serializer& serializer, CompAccel& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_comp_angular_rate (0x82,0x0E) Comp Angular Rate [CPP] +///@defgroup filter_comp_angular_rate_cpp (0x82,0x0E) Comp Angular Rate /// Filter-compensated angular rate expressed in the vehicle frame. /// ///@{ struct CompAngularRate { + /// Parameters Vector3f gyro; ///< (x, y, z) [radians/second] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_COMPENSATED_ANGULAR_RATE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "CompAngularRate"; static constexpr const char* DOC_NAME = "CompAngularRate"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(gyro[0],gyro[1],gyro[2],valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(gyro[0]),std::ref(gyro[1]),std::ref(gyro[2]),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const CompAngularRate& self); -void extract(Serializer& serializer, CompAngularRate& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_quaternion_attitude_uncertainty (0x82,0x12) Quaternion Attitude Uncertainty [CPP] +///@defgroup filter_quaternion_attitude_uncertainty_cpp (0x82,0x12) Quaternion Attitude Uncertainty /// Filter reported quaternion uncertainties. /// ///@{ struct QuaternionAttitudeUncertainty { + /// Parameters Quatf q; ///< [dimensionless] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_ATT_UNCERTAINTY_QUATERNION; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "QuaternionAttitudeUncertainty"; static constexpr const char* DOC_NAME = "QuaternionAttitudeUncertainty"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(q[0],q[1],q[2],q[3],valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(q[0]),std::ref(q[1]),std::ref(q[2]),std::ref(q[3]),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const QuaternionAttitudeUncertainty& self); -void extract(Serializer& serializer, QuaternionAttitudeUncertainty& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_wgs84_gravity_mag (0x82,0x0F) Wgs84 Gravity Mag [CPP] +///@defgroup filter_wgs84_gravity_mag_cpp (0x82,0x0F) Wgs84 Gravity Mag /// Filter reported WGS84 gravity magnitude. /// ///@{ struct Wgs84GravityMag { + /// Parameters float magnitude = 0; ///< [meters/second^2] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_WGS84_GRAVITY; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "Wgs84GravityMag"; static constexpr const char* DOC_NAME = "Wgs84GravityMag"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(magnitude,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(magnitude),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const Wgs84GravityMag& self); -void extract(Serializer& serializer, Wgs84GravityMag& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_heading_update_state (0x82,0x14) Heading Update State [CPP] +///@defgroup filter_heading_update_state_cpp (0x82,0x14) Heading Update State /// Filter reported heading update state. /// /// Heading updates can be applied from the sources listed below. Note, some of these sources may be combined. @@ -1102,36 +1177,40 @@ struct HeadingUpdateState DUAL_ANTENNA = 8, ///< }; + /// Parameters float heading = 0; ///< [radians] float heading_1sigma = 0; ///< [radians] HeadingSource source = static_cast(0); uint16_t valid_flags = 0; ///< 1 if a valid heading update was received in 2 seconds, 0 otherwise. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_HEADING_UPDATE_STATE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "HeadingUpdateState"; static constexpr const char* DOC_NAME = "HeadingUpdateState"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(heading,heading_1sigma,source,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(heading),std::ref(heading_1sigma),std::ref(source),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const HeadingUpdateState& self); -void extract(Serializer& serializer, HeadingUpdateState& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_magnetic_model (0x82,0x15) Magnetic Model [CPP] +///@defgroup filter_magnetic_model_cpp (0x82,0x15) Magnetic Model /// The World Magnetic Model is used for this data. Please refer to the device user manual for the current version of the model. /// A valid GNSS location is required for the model to be valid. /// @@ -1139,6 +1218,7 @@ void extract(Serializer& serializer, HeadingUpdateState& self); struct MagneticModel { + /// Parameters float intensity_north = 0; ///< [Gauss] float intensity_east = 0; ///< [Gauss] float intensity_down = 0; ///< [Gauss] @@ -1146,235 +1226,262 @@ struct MagneticModel float declination = 0; ///< [radians] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_MAGNETIC_MODEL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "MagneticModel"; static constexpr const char* DOC_NAME = "MagneticModel"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(intensity_north,intensity_east,intensity_down,inclination,declination,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(intensity_north),std::ref(intensity_east),std::ref(intensity_down),std::ref(inclination),std::ref(declination),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const MagneticModel& self); -void extract(Serializer& serializer, MagneticModel& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_accel_scale_factor (0x82,0x17) Accel Scale Factor [CPP] +///@defgroup filter_accel_scale_factor_cpp (0x82,0x17) Accel Scale Factor /// Filter reported accelerometer scale factor expressed in the sensor frame. /// ///@{ struct AccelScaleFactor { + /// Parameters Vector3f scale_factor; ///< (x,y,z) [dimensionless] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_ACCEL_SCALE_FACTOR; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "AccelScaleFactor"; static constexpr const char* DOC_NAME = "AccelScaleFactor"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(scale_factor[0],scale_factor[1],scale_factor[2],valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(scale_factor[0]),std::ref(scale_factor[1]),std::ref(scale_factor[2]),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const AccelScaleFactor& self); -void extract(Serializer& serializer, AccelScaleFactor& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_accel_scale_factor_uncertainty (0x82,0x19) Accel Scale Factor Uncertainty [CPP] +///@defgroup filter_accel_scale_factor_uncertainty_cpp (0x82,0x19) Accel Scale Factor Uncertainty /// Filter reported 1-sigma accelerometer scale factor uncertainty expressed in the sensor frame. /// ///@{ struct AccelScaleFactorUncertainty { + /// Parameters Vector3f scale_factor_uncert; ///< (x,y,z) [dimensionless] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_ACCEL_SCALE_FACTOR_UNCERTAINTY; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "AccelScaleFactorUncertainty"; static constexpr const char* DOC_NAME = "AccelScaleFactorUncertainty"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(scale_factor_uncert[0],scale_factor_uncert[1],scale_factor_uncert[2],valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(scale_factor_uncert[0]),std::ref(scale_factor_uncert[1]),std::ref(scale_factor_uncert[2]),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const AccelScaleFactorUncertainty& self); -void extract(Serializer& serializer, AccelScaleFactorUncertainty& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_gyro_scale_factor (0x82,0x16) Gyro Scale Factor [CPP] +///@defgroup filter_gyro_scale_factor_cpp (0x82,0x16) Gyro Scale Factor /// Filter reported gyro scale factor expressed in the sensor frame. /// ///@{ struct GyroScaleFactor { + /// Parameters Vector3f scale_factor; ///< (x,y,z) [dimensionless] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_GYRO_SCALE_FACTOR; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GyroScaleFactor"; static constexpr const char* DOC_NAME = "GyroScaleFactor"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(scale_factor[0],scale_factor[1],scale_factor[2],valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(scale_factor[0]),std::ref(scale_factor[1]),std::ref(scale_factor[2]),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const GyroScaleFactor& self); -void extract(Serializer& serializer, GyroScaleFactor& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_gyro_scale_factor_uncertainty (0x82,0x18) Gyro Scale Factor Uncertainty [CPP] +///@defgroup filter_gyro_scale_factor_uncertainty_cpp (0x82,0x18) Gyro Scale Factor Uncertainty /// Filter reported 1-sigma gyro scale factor uncertainty expressed in the sensor frame. /// ///@{ struct GyroScaleFactorUncertainty { + /// Parameters Vector3f scale_factor_uncert; ///< (x,y,z) [dimensionless] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_GYRO_SCALE_FACTOR_UNCERTAINTY; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GyroScaleFactorUncertainty"; static constexpr const char* DOC_NAME = "GyroScaleFactorUncertainty"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(scale_factor_uncert[0],scale_factor_uncert[1],scale_factor_uncert[2],valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(scale_factor_uncert[0]),std::ref(scale_factor_uncert[1]),std::ref(scale_factor_uncert[2]),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const GyroScaleFactorUncertainty& self); -void extract(Serializer& serializer, GyroScaleFactorUncertainty& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_mag_bias (0x82,0x1A) Mag Bias [CPP] +///@defgroup filter_mag_bias_cpp (0x82,0x1A) Mag Bias /// Filter reported magnetometer bias expressed in the sensor frame. /// ///@{ struct MagBias { + /// Parameters Vector3f bias; ///< (x,y,z) [Gauss] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_MAG_BIAS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "MagBias"; static constexpr const char* DOC_NAME = "MagBias"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(bias[0],bias[1],bias[2],valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(bias[0]),std::ref(bias[1]),std::ref(bias[2]),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const MagBias& self); -void extract(Serializer& serializer, MagBias& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_mag_bias_uncertainty (0x82,0x1B) Mag Bias Uncertainty [CPP] +///@defgroup filter_mag_bias_uncertainty_cpp (0x82,0x1B) Mag Bias Uncertainty /// Filter reported 1-sigma magnetometer bias uncertainty expressed in the sensor frame. /// ///@{ struct MagBiasUncertainty { + /// Parameters Vector3f bias_uncert; ///< (x,y,z) [Gauss] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_MAG_BIAS_UNCERTAINTY; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "MagBiasUncertainty"; static constexpr const char* DOC_NAME = "MagBiasUncertainty"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(bias_uncert[0],bias_uncert[1],bias_uncert[2],valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(bias_uncert[0]),std::ref(bias_uncert[1]),std::ref(bias_uncert[2]),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const MagBiasUncertainty& self); -void extract(Serializer& serializer, MagBiasUncertainty& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_standard_atmosphere (0x82,0x20) Standard Atmosphere [CPP] +///@defgroup filter_standard_atmosphere_cpp (0x82,0x20) Standard Atmosphere /// Filter reported standard atmosphere parameters. /// /// The US 1976 Standard Atmosphere Model is used. A valid GNSS location is required for the model to be valid. @@ -1383,6 +1490,7 @@ void extract(Serializer& serializer, MagBiasUncertainty& self); struct StandardAtmosphere { + /// Parameters float geometric_altitude = 0; ///< Input into calculation [meters] float geopotential_altitude = 0; ///< [meters] float standard_temperature = 0; ///< [degC] @@ -1390,31 +1498,34 @@ struct StandardAtmosphere float standard_density = 0; ///< [kilogram/meter^3] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_STANDARD_ATMOSPHERE_DATA; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "StandardAtmosphere"; static constexpr const char* DOC_NAME = "StandardAtmosphere"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(geometric_altitude,geopotential_altitude,standard_temperature,standard_pressure,standard_density,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(geometric_altitude),std::ref(geopotential_altitude),std::ref(standard_temperature),std::ref(standard_pressure),std::ref(standard_density),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const StandardAtmosphere& self); -void extract(Serializer& serializer, StandardAtmosphere& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_pressure_altitude (0x82,0x21) Pressure Altitude [CPP] +///@defgroup filter_pressure_altitude_cpp (0x82,0x21) Pressure Altitude /// Filter reported pressure altitude. /// /// The US 1976 Standard Atmosphere Model is used to calculate the pressure altitude in meters. @@ -1425,67 +1536,75 @@ void extract(Serializer& serializer, StandardAtmosphere& self); struct PressureAltitude { + /// Parameters float pressure_altitude = 0; ///< [meters] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_PRESSURE_ALTITUDE_DATA; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "PressureAltitude"; static constexpr const char* DOC_NAME = "PressureAltitude"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(pressure_altitude,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(pressure_altitude),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const PressureAltitude& self); -void extract(Serializer& serializer, PressureAltitude& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_density_altitude (0x82,0x22) Density Altitude [CPP] +///@defgroup filter_density_altitude_cpp (0x82,0x22) Density Altitude /// ///@{ struct DensityAltitude { + /// Parameters float density_altitude = 0; ///< m uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_DENSITY_ALTITUDE_DATA; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "DensityAltitude"; static constexpr const char* DOC_NAME = "DensityAltitude"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(density_altitude,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(density_altitude),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const DensityAltitude& self); -void extract(Serializer& serializer, DensityAltitude& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_antenna_offset_correction (0x82,0x30) Antenna Offset Correction [CPP] +///@defgroup filter_antenna_offset_correction_cpp (0x82,0x30) Antenna Offset Correction /// Filter reported GNSS antenna offset in vehicle frame. /// /// This offset added to any previously stored offset vector to compensate for errors in definition. @@ -1494,68 +1613,76 @@ void extract(Serializer& serializer, DensityAltitude& self); struct AntennaOffsetCorrection { + /// Parameters Vector3f offset; ///< (x,y,z) [meters] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_ANTENNA_OFFSET_CORRECTION; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "AntennaOffsetCorrection"; static constexpr const char* DOC_NAME = "AntennaOffsetCorrection"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(offset[0],offset[1],offset[2],valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(offset[0]),std::ref(offset[1]),std::ref(offset[2]),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const AntennaOffsetCorrection& self); -void extract(Serializer& serializer, AntennaOffsetCorrection& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_antenna_offset_correction_uncertainty (0x82,0x31) Antenna Offset Correction Uncertainty [CPP] +///@defgroup filter_antenna_offset_correction_uncertainty_cpp (0x82,0x31) Antenna Offset Correction Uncertainty /// Filter reported 1-sigma GNSS antenna offset uncertainties in vehicle frame. /// ///@{ struct AntennaOffsetCorrectionUncertainty { + /// Parameters Vector3f offset_uncert; ///< (x,y,z) [meters] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_ANTENNA_OFFSET_CORRECTION_UNCERTAINTY; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "AntennaOffsetCorrectionUncertainty"; static constexpr const char* DOC_NAME = "AntennaOffsetCorrectionUncertainty"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(offset_uncert[0],offset_uncert[1],offset_uncert[2],valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(offset_uncert[0]),std::ref(offset_uncert[1]),std::ref(offset_uncert[2]),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const AntennaOffsetCorrectionUncertainty& self); -void extract(Serializer& serializer, AntennaOffsetCorrectionUncertainty& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_multi_antenna_offset_correction (0x82,0x34) Multi Antenna Offset Correction [CPP] +///@defgroup filter_multi_antenna_offset_correction_cpp (0x82,0x34) Multi Antenna Offset Correction /// Filter reported GNSS antenna offset in vehicle frame. /// /// This offset added to any previously stored offset vector to compensate for errors in definition. @@ -1564,70 +1691,78 @@ void extract(Serializer& serializer, AntennaOffsetCorrectionUncertainty& self); struct MultiAntennaOffsetCorrection { + /// Parameters uint8_t receiver_id = 0; ///< Receiver ID for the receiver to which the antenna is attached Vector3f offset; ///< (x,y,z) [meters] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_MULTI_ANTENNA_OFFSET_CORRECTION; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "MultiAntennaOffsetCorrection"; static constexpr const char* DOC_NAME = "MultiAntennaOffsetCorrection"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(receiver_id,offset[0],offset[1],offset[2],valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(receiver_id),std::ref(offset[0]),std::ref(offset[1]),std::ref(offset[2]),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const MultiAntennaOffsetCorrection& self); -void extract(Serializer& serializer, MultiAntennaOffsetCorrection& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_multi_antenna_offset_correction_uncertainty (0x82,0x35) Multi Antenna Offset Correction Uncertainty [CPP] +///@defgroup filter_multi_antenna_offset_correction_uncertainty_cpp (0x82,0x35) Multi Antenna Offset Correction Uncertainty /// Filter reported 1-sigma GNSS antenna offset uncertainties in vehicle frame. /// ///@{ struct MultiAntennaOffsetCorrectionUncertainty { + /// Parameters uint8_t receiver_id = 0; ///< Receiver ID for the receiver to which the antenna is attached Vector3f offset_uncert; ///< (x,y,z) [meters] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_MULTI_ANTENNA_OFFSET_CORRECTION_UNCERTAINTY; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "MultiAntennaOffsetCorrectionUncertainty"; static constexpr const char* DOC_NAME = "MultiAntennaOffsetCorrectionUncertainty"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(receiver_id,offset_uncert[0],offset_uncert[1],offset_uncert[2],valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(receiver_id),std::ref(offset_uncert[0]),std::ref(offset_uncert[1]),std::ref(offset_uncert[2]),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const MultiAntennaOffsetCorrectionUncertainty& self); -void extract(Serializer& serializer, MultiAntennaOffsetCorrectionUncertainty& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_magnetometer_offset (0x82,0x25) Magnetometer Offset [CPP] +///@defgroup filter_magnetometer_offset_cpp (0x82,0x25) Magnetometer Offset /// Filter reported magnetometer hard iron offset in sensor frame. /// /// This offset added to any previously stored hard iron offset vector to compensate for magnetometer in-run bias errors. @@ -1636,34 +1771,38 @@ void extract(Serializer& serializer, MultiAntennaOffsetCorrectionUncertainty& se struct MagnetometerOffset { + /// Parameters Vector3f hard_iron; ///< (x,y,z) [Gauss] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_MAG_COMPENSATION_OFFSET; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "MagnetometerOffset"; static constexpr const char* DOC_NAME = "MagnetometerOffset"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(hard_iron[0],hard_iron[1],hard_iron[2],valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(hard_iron[0]),std::ref(hard_iron[1]),std::ref(hard_iron[2]),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const MagnetometerOffset& self); -void extract(Serializer& serializer, MagnetometerOffset& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_magnetometer_matrix (0x82,0x26) Magnetometer Matrix [CPP] +///@defgroup filter_magnetometer_matrix_cpp (0x82,0x26) Magnetometer Matrix /// Filter reported magnetometer soft iron matrix in sensor frame. /// /// This matrix is post multiplied to any previously stored soft iron matrix to compensate for magnetometer in-run errors. @@ -1672,312 +1811,348 @@ void extract(Serializer& serializer, MagnetometerOffset& self); struct MagnetometerMatrix { + /// Parameters Matrix3f soft_iron; ///< Row-major [dimensionless] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_MAG_COMPENSATION_MATRIX; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "MagnetometerMatrix"; static constexpr const char* DOC_NAME = "MagnetometerMatrix"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(soft_iron[0],soft_iron[1],soft_iron[2],soft_iron[3],soft_iron[4],soft_iron[5],soft_iron[6],soft_iron[7],soft_iron[8],valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(soft_iron[0]),std::ref(soft_iron[1]),std::ref(soft_iron[2]),std::ref(soft_iron[3]),std::ref(soft_iron[4]),std::ref(soft_iron[5]),std::ref(soft_iron[6]),std::ref(soft_iron[7]),std::ref(soft_iron[8]),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const MagnetometerMatrix& self); -void extract(Serializer& serializer, MagnetometerMatrix& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_magnetometer_offset_uncertainty (0x82,0x28) Magnetometer Offset Uncertainty [CPP] +///@defgroup filter_magnetometer_offset_uncertainty_cpp (0x82,0x28) Magnetometer Offset Uncertainty /// Filter reported 1-sigma magnetometer hard iron offset uncertainties in sensor frame. /// ///@{ struct MagnetometerOffsetUncertainty { + /// Parameters Vector3f hard_iron_uncertainty; ///< (x,y,z) [Gauss] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_MAG_COMPENSATION_OFFSET_UNCERTAINTY; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "MagnetometerOffsetUncertainty"; static constexpr const char* DOC_NAME = "MagnetometerOffsetUncertainty"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(hard_iron_uncertainty[0],hard_iron_uncertainty[1],hard_iron_uncertainty[2],valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(hard_iron_uncertainty[0]),std::ref(hard_iron_uncertainty[1]),std::ref(hard_iron_uncertainty[2]),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const MagnetometerOffsetUncertainty& self); -void extract(Serializer& serializer, MagnetometerOffsetUncertainty& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_magnetometer_matrix_uncertainty (0x82,0x29) Magnetometer Matrix Uncertainty [CPP] +///@defgroup filter_magnetometer_matrix_uncertainty_cpp (0x82,0x29) Magnetometer Matrix Uncertainty /// Filter reported 1-sigma magnetometer soft iron matrix uncertainties in sensor frame. /// ///@{ struct MagnetometerMatrixUncertainty { + /// Parameters Matrix3f soft_iron_uncertainty; ///< Row-major [dimensionless] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_MAG_COMPENSATION_MATRIX_UNCERTAINTY; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "MagnetometerMatrixUncertainty"; static constexpr const char* DOC_NAME = "MagnetometerMatrixUncertainty"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(soft_iron_uncertainty[0],soft_iron_uncertainty[1],soft_iron_uncertainty[2],soft_iron_uncertainty[3],soft_iron_uncertainty[4],soft_iron_uncertainty[5],soft_iron_uncertainty[6],soft_iron_uncertainty[7],soft_iron_uncertainty[8],valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(soft_iron_uncertainty[0]),std::ref(soft_iron_uncertainty[1]),std::ref(soft_iron_uncertainty[2]),std::ref(soft_iron_uncertainty[3]),std::ref(soft_iron_uncertainty[4]),std::ref(soft_iron_uncertainty[5]),std::ref(soft_iron_uncertainty[6]),std::ref(soft_iron_uncertainty[7]),std::ref(soft_iron_uncertainty[8]),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const MagnetometerMatrixUncertainty& self); -void extract(Serializer& serializer, MagnetometerMatrixUncertainty& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_magnetometer_covariance_matrix (0x82,0x2A) Magnetometer Covariance Matrix [CPP] +///@defgroup filter_magnetometer_covariance_matrix_cpp (0x82,0x2A) Magnetometer Covariance Matrix /// ///@{ struct MagnetometerCovarianceMatrix { + /// Parameters Matrix3f covariance; uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_MAG_COVARIANCE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "MagnetometerCovarianceMatrix"; static constexpr const char* DOC_NAME = "MagnetometerCovarianceMatrix"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(covariance[0],covariance[1],covariance[2],covariance[3],covariance[4],covariance[5],covariance[6],covariance[7],covariance[8],valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(covariance[0]),std::ref(covariance[1]),std::ref(covariance[2]),std::ref(covariance[3]),std::ref(covariance[4]),std::ref(covariance[5]),std::ref(covariance[6]),std::ref(covariance[7]),std::ref(covariance[8]),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const MagnetometerCovarianceMatrix& self); -void extract(Serializer& serializer, MagnetometerCovarianceMatrix& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_magnetometer_residual_vector (0x82,0x2C) Magnetometer Residual Vector [CPP] +///@defgroup filter_magnetometer_residual_vector_cpp (0x82,0x2C) Magnetometer Residual Vector /// Filter reported magnetometer measurement residuals in vehicle frame. /// ///@{ struct MagnetometerResidualVector { + /// Parameters Vector3f residual; ///< (x,y,z) [Gauss] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_MAG_RESIDUAL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "MagnetometerResidualVector"; static constexpr const char* DOC_NAME = "MagnetometerResidualVector"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(residual[0],residual[1],residual[2],valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(residual[0]),std::ref(residual[1]),std::ref(residual[2]),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const MagnetometerResidualVector& self); -void extract(Serializer& serializer, MagnetometerResidualVector& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_clock_correction (0x82,0x32) Clock Correction [CPP] +///@defgroup filter_clock_correction_cpp (0x82,0x32) Clock Correction /// Filter reported GNSS receiver clock error parameters. /// ///@{ struct ClockCorrection { + /// Parameters uint8_t receiver_id = 0; ///< 1, 2, etc. float bias = 0; ///< [seconds] float bias_drift = 0; ///< [seconds/second] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_CLOCK_CORRECTION; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ClockCorrection"; static constexpr const char* DOC_NAME = "ClockCorrection"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(receiver_id,bias,bias_drift,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(receiver_id),std::ref(bias),std::ref(bias_drift),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const ClockCorrection& self); -void extract(Serializer& serializer, ClockCorrection& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_clock_correction_uncertainty (0x82,0x33) Clock Correction Uncertainty [CPP] +///@defgroup filter_clock_correction_uncertainty_cpp (0x82,0x33) Clock Correction Uncertainty /// Filter reported 1-sigma GNSS receiver clock error parameters. /// ///@{ struct ClockCorrectionUncertainty { + /// Parameters uint8_t receiver_id = 0; ///< 1, 2, etc. float bias_uncertainty = 0; ///< [seconds] float bias_drift_uncertainty = 0; ///< [seconds/second] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_CLOCK_CORRECTION_UNCERTAINTY; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ClockCorrectionUncertainty"; static constexpr const char* DOC_NAME = "ClockCorrectionUncertainty"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(receiver_id,bias_uncertainty,bias_drift_uncertainty,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(receiver_id),std::ref(bias_uncertainty),std::ref(bias_drift_uncertainty),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const ClockCorrectionUncertainty& self); -void extract(Serializer& serializer, ClockCorrectionUncertainty& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_gnss_pos_aid_status (0x82,0x43) Gnss Pos Aid Status [CPP] +///@defgroup filter_gnss_pos_aid_status_cpp (0x82,0x43) Gnss Pos Aid Status /// Filter reported GNSS position aiding status /// ///@{ struct GnssPosAidStatus { + /// Parameters uint8_t receiver_id = 0; float time_of_week = 0; ///< Last GNSS aiding measurement time of week [seconds] GnssAidStatusFlags status; ///< Aiding measurement status bitfield uint8_t reserved[8] = {0}; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_GNSS_POS_AID_STATUS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GnssPosAidStatus"; static constexpr const char* DOC_NAME = "GNSS Position Aiding Status"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(receiver_id,time_of_week,status,reserved); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(receiver_id),std::ref(time_of_week),std::ref(status),std::ref(reserved)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const GnssPosAidStatus& self); -void extract(Serializer& serializer, GnssPosAidStatus& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_gnss_att_aid_status (0x82,0x44) Gnss Att Aid Status [CPP] +///@defgroup filter_gnss_att_aid_status_cpp (0x82,0x44) Gnss Att Aid Status /// Filter reported dual antenna GNSS attitude aiding status /// ///@{ struct GnssAttAidStatus { + /// Parameters float time_of_week = 0; ///< Last valid aiding measurement time of week [seconds] [processed instead of measured?] GnssAidStatusFlags status; ///< Last valid aiding measurement status bitfield uint8_t reserved[8] = {0}; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_GNSS_ATT_AID_STATUS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GnssAttAidStatus"; static constexpr const char* DOC_NAME = "GNSS Attitude Aiding Status"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(time_of_week,status,reserved); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(time_of_week),std::ref(status),std::ref(reserved)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const GnssAttAidStatus& self); -void extract(Serializer& serializer, GnssAttAidStatus& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_head_aid_status (0x82,0x45) Head Aid Status [CPP] +///@defgroup filter_head_aid_status_cpp (0x82,0x45) Head Aid Status /// Filter reported GNSS heading aiding status /// ///@{ @@ -1990,309 +2165,345 @@ struct HeadAidStatus EXTERNAL_MESSAGE = 2, ///< }; + /// Parameters float time_of_week = 0; ///< Last valid aiding measurement time of week [seconds] [processed instead of measured?] HeadingAidType type = static_cast(0); ///< 1 - Dual antenna, 2 - External heading message (user supplied) float reserved[2] = {0}; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_HEAD_AID_STATUS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "HeadAidStatus"; static constexpr const char* DOC_NAME = "HeadAidStatus"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(time_of_week,type,reserved); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(time_of_week),std::ref(type),std::ref(reserved)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const HeadAidStatus& self); -void extract(Serializer& serializer, HeadAidStatus& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_rel_pos_ned (0x82,0x42) Rel Pos Ned [CPP] +///@defgroup filter_rel_pos_ned_cpp (0x82,0x42) Rel Pos Ned /// Filter reported relative position, with respect to configured reference position /// ///@{ struct RelPosNed { + /// Parameters Vector3d relative_position; ///< [meters, NED] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_REL_POS_NED; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "RelPosNed"; static constexpr const char* DOC_NAME = "NED Relative Position"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(relative_position[0],relative_position[1],relative_position[2],valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(relative_position[0]),std::ref(relative_position[1]),std::ref(relative_position[2]),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const RelPosNed& self); -void extract(Serializer& serializer, RelPosNed& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_ecef_pos (0x82,0x40) Ecef Pos [CPP] +///@defgroup filter_ecef_pos_cpp (0x82,0x40) Ecef Pos /// Filter reported ECEF position /// ///@{ struct EcefPos { + /// Parameters Vector3d position_ecef; ///< [meters, ECEF] uint16_t valid_flags = 0; ///< 0 - invalid, 1 valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_ECEF_POS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "EcefPos"; static constexpr const char* DOC_NAME = "ECEF Position"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(position_ecef[0],position_ecef[1],position_ecef[2],valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(position_ecef[0]),std::ref(position_ecef[1]),std::ref(position_ecef[2]),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const EcefPos& self); -void extract(Serializer& serializer, EcefPos& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_ecef_vel (0x82,0x41) Ecef Vel [CPP] +///@defgroup filter_ecef_vel_cpp (0x82,0x41) Ecef Vel /// Filter reported ECEF velocity /// ///@{ struct EcefVel { + /// Parameters Vector3f velocity_ecef; ///< [meters/second, ECEF] uint16_t valid_flags = 0; ///< 0 - invalid, 1 valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_ECEF_VEL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "EcefVel"; static constexpr const char* DOC_NAME = "ECEF Velocity"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(velocity_ecef[0],velocity_ecef[1],velocity_ecef[2],valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(velocity_ecef[0]),std::ref(velocity_ecef[1]),std::ref(velocity_ecef[2]),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const EcefVel& self); -void extract(Serializer& serializer, EcefVel& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_ecef_pos_uncertainty (0x82,0x36) Ecef Pos Uncertainty [CPP] +///@defgroup filter_ecef_pos_uncertainty_cpp (0x82,0x36) Ecef Pos Uncertainty /// Filter reported 1-sigma position uncertainty in the ECEF frame. /// ///@{ struct EcefPosUncertainty { + /// Parameters Vector3f pos_uncertainty; ///< [meters] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_ECEF_POS_UNCERTAINTY; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "EcefPosUncertainty"; static constexpr const char* DOC_NAME = "ECEF Position Uncertainty"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(pos_uncertainty[0],pos_uncertainty[1],pos_uncertainty[2],valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(pos_uncertainty[0]),std::ref(pos_uncertainty[1]),std::ref(pos_uncertainty[2]),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const EcefPosUncertainty& self); -void extract(Serializer& serializer, EcefPosUncertainty& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_ecef_vel_uncertainty (0x82,0x37) Ecef Vel Uncertainty [CPP] +///@defgroup filter_ecef_vel_uncertainty_cpp (0x82,0x37) Ecef Vel Uncertainty /// Filter reported 1-sigma velocity uncertainties in the ECEF frame. /// ///@{ struct EcefVelUncertainty { + /// Parameters Vector3f vel_uncertainty; ///< [meters/second] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_ECEF_VEL_UNCERTAINTY; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "EcefVelUncertainty"; static constexpr const char* DOC_NAME = "ECEF Velocity Uncertainty"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(vel_uncertainty[0],vel_uncertainty[1],vel_uncertainty[2],valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(vel_uncertainty[0]),std::ref(vel_uncertainty[1]),std::ref(vel_uncertainty[2]),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const EcefVelUncertainty& self); -void extract(Serializer& serializer, EcefVelUncertainty& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_aiding_measurement_summary (0x82,0x46) Aiding Measurement Summary [CPP] +///@defgroup filter_aiding_measurement_summary_cpp (0x82,0x46) Aiding Measurement Summary /// Filter reported aiding measurement summary. This message contains a summary of the specified aiding measurement over the previous measurement interval ending at the specified time. /// ///@{ struct AidingMeasurementSummary { + /// Parameters float time_of_week = 0; ///< [seconds] uint8_t source = 0; FilterAidingMeasurementType type = static_cast(0); ///< (see product manual for supported types) Note: values 0x20 and above correspond to commanded aiding measurements in the 0x13 Aiding command set. FilterMeasurementIndicator indicator; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_AID_MEAS_SUMMARY; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "AidingMeasurementSummary"; static constexpr const char* DOC_NAME = "AidingMeasurementSummary"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(time_of_week,source,type,indicator); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(time_of_week),std::ref(source),std::ref(type),std::ref(indicator)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const AidingMeasurementSummary& self); -void extract(Serializer& serializer, AidingMeasurementSummary& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_odometer_scale_factor_error (0x82,0x47) Odometer Scale Factor Error [CPP] +///@defgroup filter_odometer_scale_factor_error_cpp (0x82,0x47) Odometer Scale Factor Error /// Filter reported odometer scale factor error. The total scale factor estimate is the user indicated scale factor, plus the user indicated scale factor times the scale factor error. /// ///@{ struct OdometerScaleFactorError { + /// Parameters float scale_factor_error = 0; ///< [dimensionless] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_ODOMETER_SCALE_FACTOR_ERROR; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "OdometerScaleFactorError"; static constexpr const char* DOC_NAME = "Odometer Scale Factor Error"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(scale_factor_error,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(scale_factor_error),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const OdometerScaleFactorError& self); -void extract(Serializer& serializer, OdometerScaleFactorError& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_odometer_scale_factor_error_uncertainty (0x82,0x48) Odometer Scale Factor Error Uncertainty [CPP] +///@defgroup filter_odometer_scale_factor_error_uncertainty_cpp (0x82,0x48) Odometer Scale Factor Error Uncertainty /// Filter reported odometer scale factor error uncertainty. /// ///@{ struct OdometerScaleFactorErrorUncertainty { + /// Parameters float scale_factor_error_uncertainty = 0; ///< [dimensionless] uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_ODOMETER_SCALE_FACTOR_ERROR_UNCERTAINTY; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "OdometerScaleFactorErrorUncertainty"; static constexpr const char* DOC_NAME = "Odometer Scale Factor Error Uncertainty"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(scale_factor_error_uncertainty,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(scale_factor_error_uncertainty),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const OdometerScaleFactorErrorUncertainty& self); -void extract(Serializer& serializer, OdometerScaleFactorErrorUncertainty& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_gnss_dual_antenna_status (0x82,0x49) Gnss Dual Antenna Status [CPP] +///@defgroup filter_gnss_dual_antenna_status_cpp (0x82,0x49) Gnss Dual Antenna Status /// Summary information for status of GNSS dual antenna heading estimate. /// ///@{ @@ -2308,6 +2519,7 @@ struct GnssDualAntennaStatus struct DualAntennaStatusFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -2327,16 +2539,15 @@ struct GnssDualAntennaStatus DualAntennaStatusFlags& operator&=(uint16_t val) { return *this = value & val; } bool rcv1DataValid() const { return (value & RCV_1_DATA_VALID) > 0; } - void rcv1DataValid(bool val) { if(val) value |= RCV_1_DATA_VALID; else value &= ~RCV_1_DATA_VALID; } + void rcv1DataValid(bool val) { value &= ~RCV_1_DATA_VALID; if(val) value |= RCV_1_DATA_VALID; } bool rcv2DataValid() const { return (value & RCV_2_DATA_VALID) > 0; } - void rcv2DataValid(bool val) { if(val) value |= RCV_2_DATA_VALID; else value &= ~RCV_2_DATA_VALID; } + void rcv2DataValid(bool val) { value &= ~RCV_2_DATA_VALID; if(val) value |= RCV_2_DATA_VALID; } bool antennaOffsetsValid() const { return (value & ANTENNA_OFFSETS_VALID) > 0; } - void antennaOffsetsValid(bool val) { if(val) value |= ANTENNA_OFFSETS_VALID; else value &= ~ANTENNA_OFFSETS_VALID; } - + void antennaOffsetsValid(bool val) { value &= ~ANTENNA_OFFSETS_VALID; if(val) value |= ANTENNA_OFFSETS_VALID; } bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters float time_of_week = 0; ///< Last dual-antenna GNSS aiding measurement time of week [seconds] float heading = 0; ///< [radians] float heading_unc = 0; ///< [radians] @@ -2344,31 +2555,34 @@ struct GnssDualAntennaStatus DualAntennaStatusFlags status_flags; uint16_t valid_flags = 0; ///< 0 - invalid, 1 - valid + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_GNSS_DUAL_ANTENNA_STATUS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GnssDualAntennaStatus"; static constexpr const char* DOC_NAME = "GNSS Dual Antenna Status"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(time_of_week,heading,heading_unc,fix_type,status_flags,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(time_of_week),std::ref(heading),std::ref(heading_unc),std::ref(fix_type),std::ref(status_flags),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const GnssDualAntennaStatus& self); -void extract(Serializer& serializer, GnssDualAntennaStatus& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_aiding_frame_config_error (0x82,0x50) Aiding Frame Config Error [CPP] +///@defgroup filter_aiding_frame_config_error_cpp (0x82,0x50) Aiding Frame Config Error /// Filter reported aiding source frame configuration error /// /// These estimates are used to compensate for small errors to the user-supplied aiding frame configurations (set with (0x13, 0x01) command ). @@ -2377,35 +2591,39 @@ void extract(Serializer& serializer, GnssDualAntennaStatus& self); struct AidingFrameConfigError { + /// Parameters uint8_t frame_id = 0; ///< Frame ID for the receiver to which the antenna is attached Vector3f translation; ///< Translation config X, Y, and Z (m). Quatf attitude; ///< Attitude quaternion + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_FRAME_CONFIG_ERROR; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "AidingFrameConfigError"; static constexpr const char* DOC_NAME = "Aiding Frame Configuration Error"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(frame_id,translation[0],translation[1],translation[2],attitude[0],attitude[1],attitude[2],attitude[3]); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(frame_id),std::ref(translation[0]),std::ref(translation[1]),std::ref(translation[2]),std::ref(attitude[0]),std::ref(attitude[1]),std::ref(attitude[2]),std::ref(attitude[3])); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const AidingFrameConfigError& self); -void extract(Serializer& serializer, AidingFrameConfigError& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_filter_aiding_frame_config_error_uncertainty (0x82,0x51) Aiding Frame Config Error Uncertainty [CPP] +///@defgroup filter_aiding_frame_config_error_uncertainty_cpp (0x82,0x51) Aiding Frame Config Error Uncertainty /// Filter reported aiding source frame configuration error uncertainty /// /// These estimates are used to compensate for small errors to the user-supplied aiding frame configurations (set with (0x13, 0x01) command ). @@ -2414,30 +2632,34 @@ void extract(Serializer& serializer, AidingFrameConfigError& self); struct AidingFrameConfigErrorUncertainty { + /// Parameters uint8_t frame_id = 0; ///< Frame ID for the receiver to which the antenna is attached Vector3f translation_unc; ///< Translation uncertaint X, Y, and Z (m). Vector3f attitude_unc; ///< Attitude uncertainty, X, Y, and Z (radians). + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_filter::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_filter::DATA_FRAME_CONFIG_ERROR_UNCERTAINTY; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "AidingFrameConfigErrorUncertainty"; static constexpr const char* DOC_NAME = "Aiding Frame Configuration Error Uncertainty"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(frame_id,translation_unc[0],translation_unc[1],translation_unc[2],attitude_unc[0],attitude_unc[1],attitude_unc[2]); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(frame_id),std::ref(translation_unc[0]),std::ref(translation_unc[1]),std::ref(translation_unc[2]),std::ref(attitude_unc[0]),std::ref(attitude_unc[1]),std::ref(attitude_unc[2])); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const AidingFrameConfigErrorUncertainty& self); -void extract(Serializer& serializer, AidingFrameConfigErrorUncertainty& self); - ///@} /// diff --git a/src/cpp/mip/definitions/data_gnss.cpp b/src/cpp/mip/definitions/data_gnss.cpp new file mode 100644 index 000000000..707d4180b --- /dev/null +++ b/src/cpp/mip/definitions/data_gnss.cpp @@ -0,0 +1,1207 @@ + +#include "data_gnss.hpp" + +#include +#include + +#include + + +namespace mip { +namespace C { +struct mip_interface; +} // namespace C + +namespace data_gnss { + +using namespace ::mip::C; + +//////////////////////////////////////////////////////////////////////////////// +// Mip Fields +//////////////////////////////////////////////////////////////////////////////// + +void PosLlh::insert(Serializer& serializer) const +{ + serializer.insert(latitude); + + serializer.insert(longitude); + + serializer.insert(ellipsoid_height); + + serializer.insert(msl_height); + + serializer.insert(horizontal_accuracy); + + serializer.insert(vertical_accuracy); + + serializer.insert(valid_flags); + +} +void PosLlh::extract(Serializer& serializer) +{ + serializer.extract(latitude); + + serializer.extract(longitude); + + serializer.extract(ellipsoid_height); + + serializer.extract(msl_height); + + serializer.extract(horizontal_accuracy); + + serializer.extract(vertical_accuracy); + + serializer.extract(valid_flags); + +} + +void PosEcef::insert(Serializer& serializer) const +{ + serializer.insert(x); + + serializer.insert(x_accuracy); + + serializer.insert(valid_flags); + +} +void PosEcef::extract(Serializer& serializer) +{ + serializer.extract(x); + + serializer.extract(x_accuracy); + + serializer.extract(valid_flags); + +} + +void VelNed::insert(Serializer& serializer) const +{ + serializer.insert(v); + + serializer.insert(speed); + + serializer.insert(ground_speed); + + serializer.insert(heading); + + serializer.insert(speed_accuracy); + + serializer.insert(heading_accuracy); + + serializer.insert(valid_flags); + +} +void VelNed::extract(Serializer& serializer) +{ + serializer.extract(v); + + serializer.extract(speed); + + serializer.extract(ground_speed); + + serializer.extract(heading); + + serializer.extract(speed_accuracy); + + serializer.extract(heading_accuracy); + + serializer.extract(valid_flags); + +} + +void VelEcef::insert(Serializer& serializer) const +{ + serializer.insert(v); + + serializer.insert(v_accuracy); + + serializer.insert(valid_flags); + +} +void VelEcef::extract(Serializer& serializer) +{ + serializer.extract(v); + + serializer.extract(v_accuracy); + + serializer.extract(valid_flags); + +} + +void Dop::insert(Serializer& serializer) const +{ + serializer.insert(gdop); + + serializer.insert(pdop); + + serializer.insert(hdop); + + serializer.insert(vdop); + + serializer.insert(tdop); + + serializer.insert(ndop); + + serializer.insert(edop); + + serializer.insert(valid_flags); + +} +void Dop::extract(Serializer& serializer) +{ + serializer.extract(gdop); + + serializer.extract(pdop); + + serializer.extract(hdop); + + serializer.extract(vdop); + + serializer.extract(tdop); + + serializer.extract(ndop); + + serializer.extract(edop); + + serializer.extract(valid_flags); + +} + +void UtcTime::insert(Serializer& serializer) const +{ + serializer.insert(year); + + serializer.insert(month); + + serializer.insert(day); + + serializer.insert(hour); + + serializer.insert(min); + + serializer.insert(sec); + + serializer.insert(msec); + + serializer.insert(valid_flags); + +} +void UtcTime::extract(Serializer& serializer) +{ + serializer.extract(year); + + serializer.extract(month); + + serializer.extract(day); + + serializer.extract(hour); + + serializer.extract(min); + + serializer.extract(sec); + + serializer.extract(msec); + + serializer.extract(valid_flags); + +} + +void GpsTime::insert(Serializer& serializer) const +{ + serializer.insert(tow); + + serializer.insert(week_number); + + serializer.insert(valid_flags); + +} +void GpsTime::extract(Serializer& serializer) +{ + serializer.extract(tow); + + serializer.extract(week_number); + + serializer.extract(valid_flags); + +} + +void ClockInfo::insert(Serializer& serializer) const +{ + serializer.insert(bias); + + serializer.insert(drift); + + serializer.insert(accuracy_estimate); + + serializer.insert(valid_flags); + +} +void ClockInfo::extract(Serializer& serializer) +{ + serializer.extract(bias); + + serializer.extract(drift); + + serializer.extract(accuracy_estimate); + + serializer.extract(valid_flags); + +} + +void FixInfo::insert(Serializer& serializer) const +{ + serializer.insert(fix_type); + + serializer.insert(num_sv); + + serializer.insert(fix_flags); + + serializer.insert(valid_flags); + +} +void FixInfo::extract(Serializer& serializer) +{ + serializer.extract(fix_type); + + serializer.extract(num_sv); + + serializer.extract(fix_flags); + + serializer.extract(valid_flags); + +} + +void SvInfo::insert(Serializer& serializer) const +{ + serializer.insert(channel); + + serializer.insert(sv_id); + + serializer.insert(carrier_noise_ratio); + + serializer.insert(azimuth); + + serializer.insert(elevation); + + serializer.insert(sv_flags); + + serializer.insert(valid_flags); + +} +void SvInfo::extract(Serializer& serializer) +{ + serializer.extract(channel); + + serializer.extract(sv_id); + + serializer.extract(carrier_noise_ratio); + + serializer.extract(azimuth); + + serializer.extract(elevation); + + serializer.extract(sv_flags); + + serializer.extract(valid_flags); + +} + +void HwStatus::insert(Serializer& serializer) const +{ + serializer.insert(receiver_state); + + serializer.insert(antenna_state); + + serializer.insert(antenna_power); + + serializer.insert(valid_flags); + +} +void HwStatus::extract(Serializer& serializer) +{ + serializer.extract(receiver_state); + + serializer.extract(antenna_state); + + serializer.extract(antenna_power); + + serializer.extract(valid_flags); + +} + +void DgpsInfo::insert(Serializer& serializer) const +{ + serializer.insert(sv_id); + + serializer.insert(age); + + serializer.insert(range_correction); + + serializer.insert(range_rate_correction); + + serializer.insert(valid_flags); + +} +void DgpsInfo::extract(Serializer& serializer) +{ + serializer.extract(sv_id); + + serializer.extract(age); + + serializer.extract(range_correction); + + serializer.extract(range_rate_correction); + + serializer.extract(valid_flags); + +} + +void DgpsChannel::insert(Serializer& serializer) const +{ + serializer.insert(sv_id); + + serializer.insert(age); + + serializer.insert(range_correction); + + serializer.insert(range_rate_correction); + + serializer.insert(valid_flags); + +} +void DgpsChannel::extract(Serializer& serializer) +{ + serializer.extract(sv_id); + + serializer.extract(age); + + serializer.extract(range_correction); + + serializer.extract(range_rate_correction); + + serializer.extract(valid_flags); + +} + +void ClockInfo2::insert(Serializer& serializer) const +{ + serializer.insert(bias); + + serializer.insert(drift); + + serializer.insert(bias_accuracy_estimate); + + serializer.insert(drift_accuracy_estimate); + + serializer.insert(valid_flags); + +} +void ClockInfo2::extract(Serializer& serializer) +{ + serializer.extract(bias); + + serializer.extract(drift); + + serializer.extract(bias_accuracy_estimate); + + serializer.extract(drift_accuracy_estimate); + + serializer.extract(valid_flags); + +} + +void GpsLeapSeconds::insert(Serializer& serializer) const +{ + serializer.insert(leap_seconds); + + serializer.insert(valid_flags); + +} +void GpsLeapSeconds::extract(Serializer& serializer) +{ + serializer.extract(leap_seconds); + + serializer.extract(valid_flags); + +} + +void SbasInfo::insert(Serializer& serializer) const +{ + serializer.insert(time_of_week); + + serializer.insert(week_number); + + serializer.insert(sbas_system); + + serializer.insert(sbas_id); + + serializer.insert(count); + + serializer.insert(sbas_status); + + serializer.insert(valid_flags); + +} +void SbasInfo::extract(Serializer& serializer) +{ + serializer.extract(time_of_week); + + serializer.extract(week_number); + + serializer.extract(sbas_system); + + serializer.extract(sbas_id); + + serializer.extract(count); + + serializer.extract(sbas_status); + + serializer.extract(valid_flags); + +} + +void SbasCorrection::insert(Serializer& serializer) const +{ + serializer.insert(index); + + serializer.insert(count); + + serializer.insert(time_of_week); + + serializer.insert(week_number); + + serializer.insert(gnss_id); + + serializer.insert(sv_id); + + serializer.insert(udrei); + + serializer.insert(pseudorange_correction); + + serializer.insert(iono_correction); + + serializer.insert(valid_flags); + +} +void SbasCorrection::extract(Serializer& serializer) +{ + serializer.extract(index); + + serializer.extract(count); + + serializer.extract(time_of_week); + + serializer.extract(week_number); + + serializer.extract(gnss_id); + + serializer.extract(sv_id); + + serializer.extract(udrei); + + serializer.extract(pseudorange_correction); + + serializer.extract(iono_correction); + + serializer.extract(valid_flags); + +} + +void RfErrorDetection::insert(Serializer& serializer) const +{ + serializer.insert(rf_band); + + serializer.insert(jamming_state); + + serializer.insert(spoofing_state); + + for(unsigned int i=0; i < 4; i++) + serializer.insert(reserved[i]); + + serializer.insert(valid_flags); + +} +void RfErrorDetection::extract(Serializer& serializer) +{ + serializer.extract(rf_band); + + serializer.extract(jamming_state); + + serializer.extract(spoofing_state); + + for(unsigned int i=0; i < 4; i++) + serializer.extract(reserved[i]); + + serializer.extract(valid_flags); + +} + +void BaseStationInfo::insert(Serializer& serializer) const +{ + serializer.insert(time_of_week); + + serializer.insert(week_number); + + serializer.insert(ecef_pos); + + serializer.insert(height); + + serializer.insert(station_id); + + serializer.insert(indicators); + + serializer.insert(valid_flags); + +} +void BaseStationInfo::extract(Serializer& serializer) +{ + serializer.extract(time_of_week); + + serializer.extract(week_number); + + serializer.extract(ecef_pos); + + serializer.extract(height); + + serializer.extract(station_id); + + serializer.extract(indicators); + + serializer.extract(valid_flags); + +} + +void RtkCorrectionsStatus::insert(Serializer& serializer) const +{ + serializer.insert(time_of_week); + + serializer.insert(week_number); + + serializer.insert(epoch_status); + + serializer.insert(dongle_status); + + serializer.insert(gps_correction_latency); + + serializer.insert(glonass_correction_latency); + + serializer.insert(galileo_correction_latency); + + serializer.insert(beidou_correction_latency); + + for(unsigned int i=0; i < 4; i++) + serializer.insert(reserved[i]); + + serializer.insert(valid_flags); + +} +void RtkCorrectionsStatus::extract(Serializer& serializer) +{ + serializer.extract(time_of_week); + + serializer.extract(week_number); + + serializer.extract(epoch_status); + + serializer.extract(dongle_status); + + serializer.extract(gps_correction_latency); + + serializer.extract(glonass_correction_latency); + + serializer.extract(galileo_correction_latency); + + serializer.extract(beidou_correction_latency); + + for(unsigned int i=0; i < 4; i++) + serializer.extract(reserved[i]); + + serializer.extract(valid_flags); + +} + +void SatelliteStatus::insert(Serializer& serializer) const +{ + serializer.insert(index); + + serializer.insert(count); + + serializer.insert(time_of_week); + + serializer.insert(week_number); + + serializer.insert(gnss_id); + + serializer.insert(satellite_id); + + serializer.insert(elevation); + + serializer.insert(azimuth); + + serializer.insert(health); + + serializer.insert(valid_flags); + +} +void SatelliteStatus::extract(Serializer& serializer) +{ + serializer.extract(index); + + serializer.extract(count); + + serializer.extract(time_of_week); + + serializer.extract(week_number); + + serializer.extract(gnss_id); + + serializer.extract(satellite_id); + + serializer.extract(elevation); + + serializer.extract(azimuth); + + serializer.extract(health); + + serializer.extract(valid_flags); + +} + +void Raw::insert(Serializer& serializer) const +{ + serializer.insert(index); + + serializer.insert(count); + + serializer.insert(time_of_week); + + serializer.insert(week_number); + + serializer.insert(receiver_id); + + serializer.insert(tracking_channel); + + serializer.insert(gnss_id); + + serializer.insert(satellite_id); + + serializer.insert(signal_id); + + serializer.insert(signal_strength); + + serializer.insert(quality); + + serializer.insert(pseudorange); + + serializer.insert(carrier_phase); + + serializer.insert(doppler); + + serializer.insert(range_uncert); + + serializer.insert(phase_uncert); + + serializer.insert(doppler_uncert); + + serializer.insert(lock_time); + + serializer.insert(valid_flags); + +} +void Raw::extract(Serializer& serializer) +{ + serializer.extract(index); + + serializer.extract(count); + + serializer.extract(time_of_week); + + serializer.extract(week_number); + + serializer.extract(receiver_id); + + serializer.extract(tracking_channel); + + serializer.extract(gnss_id); + + serializer.extract(satellite_id); + + serializer.extract(signal_id); + + serializer.extract(signal_strength); + + serializer.extract(quality); + + serializer.extract(pseudorange); + + serializer.extract(carrier_phase); + + serializer.extract(doppler); + + serializer.extract(range_uncert); + + serializer.extract(phase_uncert); + + serializer.extract(doppler_uncert); + + serializer.extract(lock_time); + + serializer.extract(valid_flags); + +} + +void GpsEphemeris::insert(Serializer& serializer) const +{ + serializer.insert(index); + + serializer.insert(count); + + serializer.insert(time_of_week); + + serializer.insert(week_number); + + serializer.insert(satellite_id); + + serializer.insert(health); + + serializer.insert(iodc); + + serializer.insert(iode); + + serializer.insert(t_oc); + + serializer.insert(af0); + + serializer.insert(af1); + + serializer.insert(af2); + + serializer.insert(t_gd); + + serializer.insert(ISC_L1CA); + + serializer.insert(ISC_L2C); + + serializer.insert(t_oe); + + serializer.insert(a); + + serializer.insert(a_dot); + + serializer.insert(mean_anomaly); + + serializer.insert(delta_mean_motion); + + serializer.insert(delta_mean_motion_dot); + + serializer.insert(eccentricity); + + serializer.insert(argument_of_perigee); + + serializer.insert(omega); + + serializer.insert(omega_dot); + + serializer.insert(inclination); + + serializer.insert(inclination_dot); + + serializer.insert(c_ic); + + serializer.insert(c_is); + + serializer.insert(c_uc); + + serializer.insert(c_us); + + serializer.insert(c_rc); + + serializer.insert(c_rs); + + serializer.insert(valid_flags); + +} +void GpsEphemeris::extract(Serializer& serializer) +{ + serializer.extract(index); + + serializer.extract(count); + + serializer.extract(time_of_week); + + serializer.extract(week_number); + + serializer.extract(satellite_id); + + serializer.extract(health); + + serializer.extract(iodc); + + serializer.extract(iode); + + serializer.extract(t_oc); + + serializer.extract(af0); + + serializer.extract(af1); + + serializer.extract(af2); + + serializer.extract(t_gd); + + serializer.extract(ISC_L1CA); + + serializer.extract(ISC_L2C); + + serializer.extract(t_oe); + + serializer.extract(a); + + serializer.extract(a_dot); + + serializer.extract(mean_anomaly); + + serializer.extract(delta_mean_motion); + + serializer.extract(delta_mean_motion_dot); + + serializer.extract(eccentricity); + + serializer.extract(argument_of_perigee); + + serializer.extract(omega); + + serializer.extract(omega_dot); + + serializer.extract(inclination); + + serializer.extract(inclination_dot); + + serializer.extract(c_ic); + + serializer.extract(c_is); + + serializer.extract(c_uc); + + serializer.extract(c_us); + + serializer.extract(c_rc); + + serializer.extract(c_rs); + + serializer.extract(valid_flags); + +} + +void GalileoEphemeris::insert(Serializer& serializer) const +{ + serializer.insert(index); + + serializer.insert(count); + + serializer.insert(time_of_week); + + serializer.insert(week_number); + + serializer.insert(satellite_id); + + serializer.insert(health); + + serializer.insert(iodc); + + serializer.insert(iode); + + serializer.insert(t_oc); + + serializer.insert(af0); + + serializer.insert(af1); + + serializer.insert(af2); + + serializer.insert(t_gd); + + serializer.insert(ISC_L1CA); + + serializer.insert(ISC_L2C); + + serializer.insert(t_oe); + + serializer.insert(a); + + serializer.insert(a_dot); + + serializer.insert(mean_anomaly); + + serializer.insert(delta_mean_motion); + + serializer.insert(delta_mean_motion_dot); + + serializer.insert(eccentricity); + + serializer.insert(argument_of_perigee); + + serializer.insert(omega); + + serializer.insert(omega_dot); + + serializer.insert(inclination); + + serializer.insert(inclination_dot); + + serializer.insert(c_ic); + + serializer.insert(c_is); + + serializer.insert(c_uc); + + serializer.insert(c_us); + + serializer.insert(c_rc); + + serializer.insert(c_rs); + + serializer.insert(valid_flags); + +} +void GalileoEphemeris::extract(Serializer& serializer) +{ + serializer.extract(index); + + serializer.extract(count); + + serializer.extract(time_of_week); + + serializer.extract(week_number); + + serializer.extract(satellite_id); + + serializer.extract(health); + + serializer.extract(iodc); + + serializer.extract(iode); + + serializer.extract(t_oc); + + serializer.extract(af0); + + serializer.extract(af1); + + serializer.extract(af2); + + serializer.extract(t_gd); + + serializer.extract(ISC_L1CA); + + serializer.extract(ISC_L2C); + + serializer.extract(t_oe); + + serializer.extract(a); + + serializer.extract(a_dot); + + serializer.extract(mean_anomaly); + + serializer.extract(delta_mean_motion); + + serializer.extract(delta_mean_motion_dot); + + serializer.extract(eccentricity); + + serializer.extract(argument_of_perigee); + + serializer.extract(omega); + + serializer.extract(omega_dot); + + serializer.extract(inclination); + + serializer.extract(inclination_dot); + + serializer.extract(c_ic); + + serializer.extract(c_is); + + serializer.extract(c_uc); + + serializer.extract(c_us); + + serializer.extract(c_rc); + + serializer.extract(c_rs); + + serializer.extract(valid_flags); + +} + +void GloEphemeris::insert(Serializer& serializer) const +{ + serializer.insert(index); + + serializer.insert(count); + + serializer.insert(time_of_week); + + serializer.insert(week_number); + + serializer.insert(satellite_id); + + serializer.insert(freq_number); + + serializer.insert(tk); + + serializer.insert(tb); + + serializer.insert(sat_type); + + serializer.insert(gamma); + + serializer.insert(tau_n); + + serializer.insert(x); + + serializer.insert(v); + + serializer.insert(a); + + serializer.insert(health); + + serializer.insert(P); + + serializer.insert(NT); + + serializer.insert(delta_tau_n); + + serializer.insert(Ft); + + serializer.insert(En); + + serializer.insert(P1); + + serializer.insert(P2); + + serializer.insert(P3); + + serializer.insert(P4); + + serializer.insert(valid_flags); + +} +void GloEphemeris::extract(Serializer& serializer) +{ + serializer.extract(index); + + serializer.extract(count); + + serializer.extract(time_of_week); + + serializer.extract(week_number); + + serializer.extract(satellite_id); + + serializer.extract(freq_number); + + serializer.extract(tk); + + serializer.extract(tb); + + serializer.extract(sat_type); + + serializer.extract(gamma); + + serializer.extract(tau_n); + + serializer.extract(x); + + serializer.extract(v); + + serializer.extract(a); + + serializer.extract(health); + + serializer.extract(P); + + serializer.extract(NT); + + serializer.extract(delta_tau_n); + + serializer.extract(Ft); + + serializer.extract(En); + + serializer.extract(P1); + + serializer.extract(P2); + + serializer.extract(P3); + + serializer.extract(P4); + + serializer.extract(valid_flags); + +} + +void GpsIonoCorr::insert(Serializer& serializer) const +{ + serializer.insert(time_of_week); + + serializer.insert(week_number); + + for(unsigned int i=0; i < 4; i++) + serializer.insert(alpha[i]); + + for(unsigned int i=0; i < 4; i++) + serializer.insert(beta[i]); + + serializer.insert(valid_flags); + +} +void GpsIonoCorr::extract(Serializer& serializer) +{ + serializer.extract(time_of_week); + + serializer.extract(week_number); + + for(unsigned int i=0; i < 4; i++) + serializer.extract(alpha[i]); + + for(unsigned int i=0; i < 4; i++) + serializer.extract(beta[i]); + + serializer.extract(valid_flags); + +} + +void GalileoIonoCorr::insert(Serializer& serializer) const +{ + serializer.insert(time_of_week); + + serializer.insert(week_number); + + serializer.insert(alpha); + + serializer.insert(disturbance_flags); + + serializer.insert(valid_flags); + +} +void GalileoIonoCorr::extract(Serializer& serializer) +{ + serializer.extract(time_of_week); + + serializer.extract(week_number); + + serializer.extract(alpha); + + serializer.extract(disturbance_flags); + + serializer.extract(valid_flags); + +} + + +} // namespace data_gnss +} // namespace mip + diff --git a/src/mip/definitions/data_gnss.hpp b/src/cpp/mip/definitions/data_gnss.hpp similarity index 80% rename from src/mip/definitions/data_gnss.hpp rename to src/cpp/mip/definitions/data_gnss.hpp index 70b783529..24026d7e3 100644 --- a/src/mip/definitions/data_gnss.hpp +++ b/src/cpp/mip/definitions/data_gnss.hpp @@ -1,16 +1,14 @@ #pragma once -#include "common.h" -#include "descriptors.h" -#include "../mip_result.h" +#include +#include +#include +#include #include #include -#include namespace mip { -class Serializer; - namespace C { struct mip_interface; } // namespace C @@ -18,9 +16,9 @@ struct mip_interface; namespace data_gnss { //////////////////////////////////////////////////////////////////////////////// -///@addtogroup MipData_cpp MIP Data [CPP] +///@addtogroup MipData_cpp ///@{ -///@defgroup gnss_data_cpp Gnss Data [CPP] +///@defgroup gnss_data_cpp Gnss Data /// ///@{ @@ -59,7 +57,6 @@ enum DATA_GLONASS_EPHEMERIS = 0x62, DATA_GALILEO_EPHEMERIS = 0x63, DATA_GPS_IONO_CORR = 0x71, - DATA_GLONASS_IONO_CORR = 0x72, DATA_GALILEO_IONO_CORR = 0x73, }; @@ -150,6 +147,7 @@ enum class GnssSignalId : uint8_t BEIDOU_B2I = 166, ///< BEIDOU_B2Q = 167, ///< BEIDOU_B2IQ = 168, ///< + BEIDOU_B2A = 169, ///< }; enum class SbasSystem : uint8_t @@ -169,7 +167,7 @@ static constexpr const uint32_t GNSS_SV_INFO_MAX_SV_NUMBER = 32; //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_gnss_pos_llh (0x81,0x03) Pos Llh [CPP] +///@defgroup gnss_pos_llh_cpp (0x81,0x03) Pos Llh /// GNSS reported position in the WGS84 geodetic frame /// ///@{ @@ -178,6 +176,7 @@ struct PosLlh { struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -200,22 +199,21 @@ struct PosLlh ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool latLon() const { return (value & LAT_LON) > 0; } - void latLon(bool val) { if(val) value |= LAT_LON; else value &= ~LAT_LON; } + void latLon(bool val) { value &= ~LAT_LON; if(val) value |= LAT_LON; } bool ellipsoidHeight() const { return (value & ELLIPSOID_HEIGHT) > 0; } - void ellipsoidHeight(bool val) { if(val) value |= ELLIPSOID_HEIGHT; else value &= ~ELLIPSOID_HEIGHT; } + void ellipsoidHeight(bool val) { value &= ~ELLIPSOID_HEIGHT; if(val) value |= ELLIPSOID_HEIGHT; } bool mslHeight() const { return (value & MSL_HEIGHT) > 0; } - void mslHeight(bool val) { if(val) value |= MSL_HEIGHT; else value &= ~MSL_HEIGHT; } + void mslHeight(bool val) { value &= ~MSL_HEIGHT; if(val) value |= MSL_HEIGHT; } bool horizontalAccuracy() const { return (value & HORIZONTAL_ACCURACY) > 0; } - void horizontalAccuracy(bool val) { if(val) value |= HORIZONTAL_ACCURACY; else value &= ~HORIZONTAL_ACCURACY; } + void horizontalAccuracy(bool val) { value &= ~HORIZONTAL_ACCURACY; if(val) value |= HORIZONTAL_ACCURACY; } bool verticalAccuracy() const { return (value & VERTICAL_ACCURACY) > 0; } - void verticalAccuracy(bool val) { if(val) value |= VERTICAL_ACCURACY; else value &= ~VERTICAL_ACCURACY; } + void verticalAccuracy(bool val) { value &= ~VERTICAL_ACCURACY; if(val) value |= VERTICAL_ACCURACY; } uint16_t flags() const { return (value & FLAGS) >> 0; } void flags(uint16_t val) { value = (value & ~FLAGS) | (val << 0); } - bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters double latitude = 0; ///< [degrees] double longitude = 0; ///< [degrees] double ellipsoid_height = 0; ///< [meters] @@ -224,31 +222,34 @@ struct PosLlh float vertical_accuracy = 0; ///< [meters] ValidFlags valid_flags; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_gnss::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_gnss::DATA_POSITION_LLH; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "PosLlh"; static constexpr const char* DOC_NAME = "GNSS LLH Position"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(latitude,longitude,ellipsoid_height,msl_height,horizontal_accuracy,vertical_accuracy,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(latitude),std::ref(longitude),std::ref(ellipsoid_height),std::ref(msl_height),std::ref(horizontal_accuracy),std::ref(vertical_accuracy),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const PosLlh& self); -void extract(Serializer& serializer, PosLlh& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_gnss_pos_ecef (0x81,0x04) Pos Ecef [CPP] +///@defgroup gnss_pos_ecef_cpp (0x81,0x04) Pos Ecef /// GNSS reported position in the Earth-centered, Earth-Fixed (ECEF) frame /// ///@{ @@ -257,6 +258,7 @@ struct PosEcef { struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -276,45 +278,47 @@ struct PosEcef ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool position() const { return (value & POSITION) > 0; } - void position(bool val) { if(val) value |= POSITION; else value &= ~POSITION; } + void position(bool val) { value &= ~POSITION; if(val) value |= POSITION; } bool positionAccuracy() const { return (value & POSITION_ACCURACY) > 0; } - void positionAccuracy(bool val) { if(val) value |= POSITION_ACCURACY; else value &= ~POSITION_ACCURACY; } + void positionAccuracy(bool val) { value &= ~POSITION_ACCURACY; if(val) value |= POSITION_ACCURACY; } uint16_t flags() const { return (value & FLAGS) >> 0; } void flags(uint16_t val) { value = (value & ~FLAGS) | (val << 0); } - bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters Vector3d x; ///< [meters] float x_accuracy = 0; ///< [meters] ValidFlags valid_flags; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_gnss::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_gnss::DATA_POSITION_ECEF; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "PosEcef"; static constexpr const char* DOC_NAME = "GNSS ECEF Position"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(x[0],x[1],x[2],x_accuracy,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(x[0]),std::ref(x[1]),std::ref(x[2]),std::ref(x_accuracy),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const PosEcef& self); -void extract(Serializer& serializer, PosEcef& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_gnss_vel_ned (0x81,0x05) Vel Ned [CPP] +///@defgroup gnss_vel_ned_cpp (0x81,0x05) Vel Ned /// GNSS reported velocity in the NED frame /// ///@{ @@ -323,6 +327,7 @@ struct VelNed { struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -346,24 +351,23 @@ struct VelNed ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool velocity() const { return (value & VELOCITY) > 0; } - void velocity(bool val) { if(val) value |= VELOCITY; else value &= ~VELOCITY; } + void velocity(bool val) { value &= ~VELOCITY; if(val) value |= VELOCITY; } bool speed3d() const { return (value & SPEED_3D) > 0; } - void speed3d(bool val) { if(val) value |= SPEED_3D; else value &= ~SPEED_3D; } + void speed3d(bool val) { value &= ~SPEED_3D; if(val) value |= SPEED_3D; } bool groundSpeed() const { return (value & GROUND_SPEED) > 0; } - void groundSpeed(bool val) { if(val) value |= GROUND_SPEED; else value &= ~GROUND_SPEED; } + void groundSpeed(bool val) { value &= ~GROUND_SPEED; if(val) value |= GROUND_SPEED; } bool heading() const { return (value & HEADING) > 0; } - void heading(bool val) { if(val) value |= HEADING; else value &= ~HEADING; } + void heading(bool val) { value &= ~HEADING; if(val) value |= HEADING; } bool speedAccuracy() const { return (value & SPEED_ACCURACY) > 0; } - void speedAccuracy(bool val) { if(val) value |= SPEED_ACCURACY; else value &= ~SPEED_ACCURACY; } + void speedAccuracy(bool val) { value &= ~SPEED_ACCURACY; if(val) value |= SPEED_ACCURACY; } bool headingAccuracy() const { return (value & HEADING_ACCURACY) > 0; } - void headingAccuracy(bool val) { if(val) value |= HEADING_ACCURACY; else value &= ~HEADING_ACCURACY; } + void headingAccuracy(bool val) { value &= ~HEADING_ACCURACY; if(val) value |= HEADING_ACCURACY; } uint16_t flags() const { return (value & FLAGS) >> 0; } void flags(uint16_t val) { value = (value & ~FLAGS) | (val << 0); } - bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters Vector3f v; ///< [meters/second] float speed = 0; ///< [meters/second] float ground_speed = 0; ///< [meters/second] @@ -372,31 +376,34 @@ struct VelNed float heading_accuracy = 0; ///< [degrees] ValidFlags valid_flags; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_gnss::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_gnss::DATA_VELOCITY_NED; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "VelNed"; static constexpr const char* DOC_NAME = "NED Velocity"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(v[0],v[1],v[2],speed,ground_speed,heading,speed_accuracy,heading_accuracy,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(v[0]),std::ref(v[1]),std::ref(v[2]),std::ref(speed),std::ref(ground_speed),std::ref(heading),std::ref(speed_accuracy),std::ref(heading_accuracy),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const VelNed& self); -void extract(Serializer& serializer, VelNed& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_gnss_vel_ecef (0x81,0x06) Vel Ecef [CPP] +///@defgroup gnss_vel_ecef_cpp (0x81,0x06) Vel Ecef /// GNSS reported velocity in the Earth-centered, Earth-Fixed (ECEF) frame /// ///@{ @@ -405,6 +412,7 @@ struct VelEcef { struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -424,45 +432,47 @@ struct VelEcef ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool velocity() const { return (value & VELOCITY) > 0; } - void velocity(bool val) { if(val) value |= VELOCITY; else value &= ~VELOCITY; } + void velocity(bool val) { value &= ~VELOCITY; if(val) value |= VELOCITY; } bool velocityAccuracy() const { return (value & VELOCITY_ACCURACY) > 0; } - void velocityAccuracy(bool val) { if(val) value |= VELOCITY_ACCURACY; else value &= ~VELOCITY_ACCURACY; } + void velocityAccuracy(bool val) { value &= ~VELOCITY_ACCURACY; if(val) value |= VELOCITY_ACCURACY; } uint16_t flags() const { return (value & FLAGS) >> 0; } void flags(uint16_t val) { value = (value & ~FLAGS) | (val << 0); } - bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters Vector3f v; ///< [meters/second] float v_accuracy = 0; ///< [meters/second] ValidFlags valid_flags; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_gnss::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_gnss::DATA_VELOCITY_ECEF; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "VelEcef"; static constexpr const char* DOC_NAME = "GNSS ECEF Velocity"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(v[0],v[1],v[2],v_accuracy,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(v[0]),std::ref(v[1]),std::ref(v[2]),std::ref(v_accuracy),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const VelEcef& self); -void extract(Serializer& serializer, VelEcef& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_gnss_dop (0x81,0x07) Dop [CPP] +///@defgroup gnss_dop_cpp (0x81,0x07) Dop /// GNSS reported dilution of precision information. /// ///@{ @@ -471,6 +481,7 @@ struct Dop { struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -495,26 +506,25 @@ struct Dop ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool gdop() const { return (value & GDOP) > 0; } - void gdop(bool val) { if(val) value |= GDOP; else value &= ~GDOP; } + void gdop(bool val) { value &= ~GDOP; if(val) value |= GDOP; } bool pdop() const { return (value & PDOP) > 0; } - void pdop(bool val) { if(val) value |= PDOP; else value &= ~PDOP; } + void pdop(bool val) { value &= ~PDOP; if(val) value |= PDOP; } bool hdop() const { return (value & HDOP) > 0; } - void hdop(bool val) { if(val) value |= HDOP; else value &= ~HDOP; } + void hdop(bool val) { value &= ~HDOP; if(val) value |= HDOP; } bool vdop() const { return (value & VDOP) > 0; } - void vdop(bool val) { if(val) value |= VDOP; else value &= ~VDOP; } + void vdop(bool val) { value &= ~VDOP; if(val) value |= VDOP; } bool tdop() const { return (value & TDOP) > 0; } - void tdop(bool val) { if(val) value |= TDOP; else value &= ~TDOP; } + void tdop(bool val) { value &= ~TDOP; if(val) value |= TDOP; } bool ndop() const { return (value & NDOP) > 0; } - void ndop(bool val) { if(val) value |= NDOP; else value &= ~NDOP; } + void ndop(bool val) { value &= ~NDOP; if(val) value |= NDOP; } bool edop() const { return (value & EDOP) > 0; } - void edop(bool val) { if(val) value |= EDOP; else value &= ~EDOP; } + void edop(bool val) { value &= ~EDOP; if(val) value |= EDOP; } uint16_t flags() const { return (value & FLAGS) >> 0; } void flags(uint16_t val) { value = (value & ~FLAGS) | (val << 0); } - bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters float gdop = 0; ///< Geometric DOP float pdop = 0; ///< Position DOP float hdop = 0; ///< Horizontal DOP @@ -524,31 +534,34 @@ struct Dop float edop = 0; ///< Easting DOP ValidFlags valid_flags; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_gnss::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_gnss::DATA_DOP; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "Dop"; static constexpr const char* DOC_NAME = "Dop"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(gdop,pdop,hdop,vdop,tdop,ndop,edop,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(gdop),std::ref(pdop),std::ref(hdop),std::ref(vdop),std::ref(tdop),std::ref(ndop),std::ref(edop),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const Dop& self); -void extract(Serializer& serializer, Dop& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_gnss_utc_time (0x81,0x08) Utc Time [CPP] +///@defgroup gnss_utc_time_cpp (0x81,0x08) Utc Time /// GNSS reported Coordinated Universal Time /// ///@{ @@ -557,6 +570,7 @@ struct UtcTime { struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -576,16 +590,15 @@ struct UtcTime ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool gnssDateTime() const { return (value & GNSS_DATE_TIME) > 0; } - void gnssDateTime(bool val) { if(val) value |= GNSS_DATE_TIME; else value &= ~GNSS_DATE_TIME; } + void gnssDateTime(bool val) { value &= ~GNSS_DATE_TIME; if(val) value |= GNSS_DATE_TIME; } bool leapSecondsKnown() const { return (value & LEAP_SECONDS_KNOWN) > 0; } - void leapSecondsKnown(bool val) { if(val) value |= LEAP_SECONDS_KNOWN; else value &= ~LEAP_SECONDS_KNOWN; } + void leapSecondsKnown(bool val) { value &= ~LEAP_SECONDS_KNOWN; if(val) value |= LEAP_SECONDS_KNOWN; } uint16_t flags() const { return (value & FLAGS) >> 0; } void flags(uint16_t val) { value = (value & ~FLAGS) | (val << 0); } - bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters uint16_t year = 0; uint8_t month = 0; ///< Month (1-12) uint8_t day = 0; ///< Day (1-31) @@ -595,31 +608,34 @@ struct UtcTime uint32_t msec = 0; ///< Millisecond(0-999) ValidFlags valid_flags; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_gnss::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_gnss::DATA_UTC_TIME; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "UtcTime"; static constexpr const char* DOC_NAME = "UtcTime"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(year,month,day,hour,min,sec,msec,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(year),std::ref(month),std::ref(day),std::ref(hour),std::ref(min),std::ref(sec),std::ref(msec),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const UtcTime& self); -void extract(Serializer& serializer, UtcTime& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_gnss_gps_time (0x81,0x09) Gps Time [CPP] +///@defgroup gnss_gps_time_cpp (0x81,0x09) Gps Time /// GNSS reported GPS Time /// ///@{ @@ -628,6 +644,7 @@ struct GpsTime { struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -647,45 +664,47 @@ struct GpsTime ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool tow() const { return (value & TOW) > 0; } - void tow(bool val) { if(val) value |= TOW; else value &= ~TOW; } + void tow(bool val) { value &= ~TOW; if(val) value |= TOW; } bool weekNumber() const { return (value & WEEK_NUMBER) > 0; } - void weekNumber(bool val) { if(val) value |= WEEK_NUMBER; else value &= ~WEEK_NUMBER; } + void weekNumber(bool val) { value &= ~WEEK_NUMBER; if(val) value |= WEEK_NUMBER; } uint16_t flags() const { return (value & FLAGS) >> 0; } void flags(uint16_t val) { value = (value & ~FLAGS) | (val << 0); } - bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters double tow = 0; ///< GPS Time of week [seconds] uint16_t week_number = 0; ///< GPS Week since 1980 [weeks] ValidFlags valid_flags; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_gnss::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_gnss::DATA_GPS_TIME; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GpsTime"; static constexpr const char* DOC_NAME = "GpsTime"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(tow,week_number,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(tow),std::ref(week_number),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const GpsTime& self); -void extract(Serializer& serializer, GpsTime& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_gnss_clock_info (0x81,0x0A) Clock Info [CPP] +///@defgroup gnss_clock_info_cpp (0x81,0x0A) Clock Info /// GNSS reported receiver clock parameters /// ///@{ @@ -694,6 +713,7 @@ struct ClockInfo { struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -714,48 +734,50 @@ struct ClockInfo ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool bias() const { return (value & BIAS) > 0; } - void bias(bool val) { if(val) value |= BIAS; else value &= ~BIAS; } + void bias(bool val) { value &= ~BIAS; if(val) value |= BIAS; } bool drift() const { return (value & DRIFT) > 0; } - void drift(bool val) { if(val) value |= DRIFT; else value &= ~DRIFT; } + void drift(bool val) { value &= ~DRIFT; if(val) value |= DRIFT; } bool accuracyEstimate() const { return (value & ACCURACY_ESTIMATE) > 0; } - void accuracyEstimate(bool val) { if(val) value |= ACCURACY_ESTIMATE; else value &= ~ACCURACY_ESTIMATE; } + void accuracyEstimate(bool val) { value &= ~ACCURACY_ESTIMATE; if(val) value |= ACCURACY_ESTIMATE; } uint16_t flags() const { return (value & FLAGS) >> 0; } void flags(uint16_t val) { value = (value & ~FLAGS) | (val << 0); } - bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters double bias = 0; ///< [seconds] double drift = 0; ///< [seconds/second] double accuracy_estimate = 0; ///< [seconds] ValidFlags valid_flags; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_gnss::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_gnss::DATA_CLOCK_INFO; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ClockInfo"; static constexpr const char* DOC_NAME = "ClockInfo"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(bias,drift,accuracy_estimate,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(bias),std::ref(drift),std::ref(accuracy_estimate),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const ClockInfo& self); -void extract(Serializer& serializer, ClockInfo& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_gnss_fix_info (0x81,0x0B) Fix Info [CPP] +///@defgroup gnss_fix_info_cpp (0x81,0x0B) Fix Info /// GNSS reported position fix type /// ///@{ @@ -776,6 +798,7 @@ struct FixInfo struct FixFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -794,16 +817,15 @@ struct FixInfo FixFlags& operator&=(uint16_t val) { return *this = value & val; } bool sbasUsed() const { return (value & SBAS_USED) > 0; } - void sbasUsed(bool val) { if(val) value |= SBAS_USED; else value &= ~SBAS_USED; } + void sbasUsed(bool val) { value &= ~SBAS_USED; if(val) value |= SBAS_USED; } bool dgnssUsed() const { return (value & DGNSS_USED) > 0; } - void dgnssUsed(bool val) { if(val) value |= DGNSS_USED; else value &= ~DGNSS_USED; } - + void dgnssUsed(bool val) { value &= ~DGNSS_USED; if(val) value |= DGNSS_USED; } bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -824,48 +846,50 @@ struct FixInfo ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool fixType() const { return (value & FIX_TYPE) > 0; } - void fixType(bool val) { if(val) value |= FIX_TYPE; else value &= ~FIX_TYPE; } + void fixType(bool val) { value &= ~FIX_TYPE; if(val) value |= FIX_TYPE; } bool numSv() const { return (value & NUM_SV) > 0; } - void numSv(bool val) { if(val) value |= NUM_SV; else value &= ~NUM_SV; } + void numSv(bool val) { value &= ~NUM_SV; if(val) value |= NUM_SV; } bool fixFlags() const { return (value & FIX_FLAGS) > 0; } - void fixFlags(bool val) { if(val) value |= FIX_FLAGS; else value &= ~FIX_FLAGS; } + void fixFlags(bool val) { value &= ~FIX_FLAGS; if(val) value |= FIX_FLAGS; } uint16_t flags() const { return (value & FLAGS) >> 0; } void flags(uint16_t val) { value = (value & ~FLAGS) | (val << 0); } - bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters FixType fix_type = static_cast(0); uint8_t num_sv = 0; FixFlags fix_flags; ValidFlags valid_flags; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_gnss::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_gnss::DATA_FIX_INFO; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "FixInfo"; static constexpr const char* DOC_NAME = "FixInfo"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(fix_type,num_sv,fix_flags,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(fix_type),std::ref(num_sv),std::ref(fix_flags),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const FixInfo& self); -void extract(Serializer& serializer, FixInfo& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_gnss_sv_info (0x81,0x0C) Sv Info [CPP] +///@defgroup gnss_sv_info_cpp (0x81,0x0C) Sv Info /// GNSS reported space vehicle information /// /// When enabled, these fields will arrive in separate MIP packets @@ -876,6 +900,7 @@ struct SvInfo { struct SVFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -894,16 +919,15 @@ struct SvInfo SVFlags& operator&=(uint16_t val) { return *this = value & val; } bool usedForNavigation() const { return (value & USED_FOR_NAVIGATION) > 0; } - void usedForNavigation(bool val) { if(val) value |= USED_FOR_NAVIGATION; else value &= ~USED_FOR_NAVIGATION; } + void usedForNavigation(bool val) { value &= ~USED_FOR_NAVIGATION; if(val) value |= USED_FOR_NAVIGATION; } bool healthy() const { return (value & HEALTHY) > 0; } - void healthy(bool val) { if(val) value |= HEALTHY; else value &= ~HEALTHY; } - + void healthy(bool val) { value &= ~HEALTHY; if(val) value |= HEALTHY; } bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -927,24 +951,23 @@ struct SvInfo ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool channel() const { return (value & CHANNEL) > 0; } - void channel(bool val) { if(val) value |= CHANNEL; else value &= ~CHANNEL; } + void channel(bool val) { value &= ~CHANNEL; if(val) value |= CHANNEL; } bool svId() const { return (value & SV_ID) > 0; } - void svId(bool val) { if(val) value |= SV_ID; else value &= ~SV_ID; } + void svId(bool val) { value &= ~SV_ID; if(val) value |= SV_ID; } bool carrierNoiseRatio() const { return (value & CARRIER_NOISE_RATIO) > 0; } - void carrierNoiseRatio(bool val) { if(val) value |= CARRIER_NOISE_RATIO; else value &= ~CARRIER_NOISE_RATIO; } + void carrierNoiseRatio(bool val) { value &= ~CARRIER_NOISE_RATIO; if(val) value |= CARRIER_NOISE_RATIO; } bool azimuth() const { return (value & AZIMUTH) > 0; } - void azimuth(bool val) { if(val) value |= AZIMUTH; else value &= ~AZIMUTH; } + void azimuth(bool val) { value &= ~AZIMUTH; if(val) value |= AZIMUTH; } bool elevation() const { return (value & ELEVATION) > 0; } - void elevation(bool val) { if(val) value |= ELEVATION; else value &= ~ELEVATION; } + void elevation(bool val) { value &= ~ELEVATION; if(val) value |= ELEVATION; } bool svFlags() const { return (value & SV_FLAGS) > 0; } - void svFlags(bool val) { if(val) value |= SV_FLAGS; else value &= ~SV_FLAGS; } + void svFlags(bool val) { value &= ~SV_FLAGS; if(val) value |= SV_FLAGS; } uint16_t flags() const { return (value & FLAGS) >> 0; } void flags(uint16_t val) { value = (value & ~FLAGS) | (val << 0); } - bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters uint8_t channel = 0; ///< Receiver channel number uint8_t sv_id = 0; ///< GNSS Satellite ID uint16_t carrier_noise_ratio = 0; ///< [dBHz] @@ -953,31 +976,34 @@ struct SvInfo SVFlags sv_flags; ValidFlags valid_flags; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_gnss::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_gnss::DATA_SV_INFO; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "SvInfo"; static constexpr const char* DOC_NAME = "SvInfo"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(channel,sv_id,carrier_noise_ratio,azimuth,elevation,sv_flags,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(channel),std::ref(sv_id),std::ref(carrier_noise_ratio),std::ref(azimuth),std::ref(elevation),std::ref(sv_flags),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const SvInfo& self); -void extract(Serializer& serializer, SvInfo& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_gnss_hw_status (0x81,0x0D) Hw Status [CPP] +///@defgroup gnss_hw_status_cpp (0x81,0x0D) Hw Status /// GNSS reported hardware status /// ///@{ @@ -1009,6 +1035,7 @@ struct HwStatus struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -1029,48 +1056,50 @@ struct HwStatus ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool sensorState() const { return (value & SENSOR_STATE) > 0; } - void sensorState(bool val) { if(val) value |= SENSOR_STATE; else value &= ~SENSOR_STATE; } + void sensorState(bool val) { value &= ~SENSOR_STATE; if(val) value |= SENSOR_STATE; } bool antennaState() const { return (value & ANTENNA_STATE) > 0; } - void antennaState(bool val) { if(val) value |= ANTENNA_STATE; else value &= ~ANTENNA_STATE; } + void antennaState(bool val) { value &= ~ANTENNA_STATE; if(val) value |= ANTENNA_STATE; } bool antennaPower() const { return (value & ANTENNA_POWER) > 0; } - void antennaPower(bool val) { if(val) value |= ANTENNA_POWER; else value &= ~ANTENNA_POWER; } + void antennaPower(bool val) { value &= ~ANTENNA_POWER; if(val) value |= ANTENNA_POWER; } uint16_t flags() const { return (value & FLAGS) >> 0; } void flags(uint16_t val) { value = (value & ~FLAGS) | (val << 0); } - bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters ReceiverState receiver_state = static_cast(0); AntennaState antenna_state = static_cast(0); AntennaPower antenna_power = static_cast(0); ValidFlags valid_flags; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_gnss::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_gnss::DATA_HW_STATUS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "HwStatus"; static constexpr const char* DOC_NAME = "GNSS Hardware Status"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(receiver_state,antenna_state,antenna_power,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(receiver_state),std::ref(antenna_state),std::ref(antenna_power),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const HwStatus& self); -void extract(Serializer& serializer, HwStatus& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_gnss_dgps_info (0x81,0x0E) Dgps Info [CPP] +///@defgroup gnss_dgps_info_cpp (0x81,0x0E) Dgps Info /// GNSS reported DGNSS status /// ///
Possible Base Station Status Values:
@@ -1091,6 +1120,7 @@ struct DgpsInfo { struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -1112,51 +1142,53 @@ struct DgpsInfo ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool age() const { return (value & AGE) > 0; } - void age(bool val) { if(val) value |= AGE; else value &= ~AGE; } + void age(bool val) { value &= ~AGE; if(val) value |= AGE; } bool baseStationId() const { return (value & BASE_STATION_ID) > 0; } - void baseStationId(bool val) { if(val) value |= BASE_STATION_ID; else value &= ~BASE_STATION_ID; } + void baseStationId(bool val) { value &= ~BASE_STATION_ID; if(val) value |= BASE_STATION_ID; } bool baseStationStatus() const { return (value & BASE_STATION_STATUS) > 0; } - void baseStationStatus(bool val) { if(val) value |= BASE_STATION_STATUS; else value &= ~BASE_STATION_STATUS; } + void baseStationStatus(bool val) { value &= ~BASE_STATION_STATUS; if(val) value |= BASE_STATION_STATUS; } bool numChannels() const { return (value & NUM_CHANNELS) > 0; } - void numChannels(bool val) { if(val) value |= NUM_CHANNELS; else value &= ~NUM_CHANNELS; } + void numChannels(bool val) { value &= ~NUM_CHANNELS; if(val) value |= NUM_CHANNELS; } uint16_t flags() const { return (value & FLAGS) >> 0; } void flags(uint16_t val) { value = (value & ~FLAGS) | (val << 0); } - bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters uint8_t sv_id = 0; float age = 0; float range_correction = 0; float range_rate_correction = 0; ValidFlags valid_flags; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_gnss::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_gnss::DATA_DGPS_INFO; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "DgpsInfo"; static constexpr const char* DOC_NAME = "DgpsInfo"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(sv_id,age,range_correction,range_rate_correction,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(sv_id),std::ref(age),std::ref(range_correction),std::ref(range_rate_correction),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const DgpsInfo& self); -void extract(Serializer& serializer, DgpsInfo& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_gnss_dgps_channel (0x81,0x0F) Dgps Channel [CPP] +///@defgroup gnss_dgps_channel_cpp (0x81,0x0F) Dgps Channel /// GNSS reported DGPS Channel Status status /// /// When enabled, a separate field for each active space vehicle will be sent in the packet. @@ -1167,6 +1199,7 @@ struct DgpsChannel { struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -1188,51 +1221,53 @@ struct DgpsChannel ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool id() const { return (value & ID) > 0; } - void id(bool val) { if(val) value |= ID; else value &= ~ID; } + void id(bool val) { value &= ~ID; if(val) value |= ID; } bool age() const { return (value & AGE) > 0; } - void age(bool val) { if(val) value |= AGE; else value &= ~AGE; } + void age(bool val) { value &= ~AGE; if(val) value |= AGE; } bool rangeCorrection() const { return (value & RANGE_CORRECTION) > 0; } - void rangeCorrection(bool val) { if(val) value |= RANGE_CORRECTION; else value &= ~RANGE_CORRECTION; } + void rangeCorrection(bool val) { value &= ~RANGE_CORRECTION; if(val) value |= RANGE_CORRECTION; } bool rangeRateCorrection() const { return (value & RANGE_RATE_CORRECTION) > 0; } - void rangeRateCorrection(bool val) { if(val) value |= RANGE_RATE_CORRECTION; else value &= ~RANGE_RATE_CORRECTION; } + void rangeRateCorrection(bool val) { value &= ~RANGE_RATE_CORRECTION; if(val) value |= RANGE_RATE_CORRECTION; } uint16_t flags() const { return (value & FLAGS) >> 0; } void flags(uint16_t val) { value = (value & ~FLAGS) | (val << 0); } - bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters uint8_t sv_id = 0; float age = 0; ///< [s] float range_correction = 0; ///< [m] float range_rate_correction = 0; ///< [m/s] ValidFlags valid_flags; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_gnss::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_gnss::DATA_DGPS_CHANNEL_STATUS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "DgpsChannel"; static constexpr const char* DOC_NAME = "DgpsChannel"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(sv_id,age,range_correction,range_rate_correction,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(sv_id),std::ref(age),std::ref(range_correction),std::ref(range_rate_correction),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const DgpsChannel& self); -void extract(Serializer& serializer, DgpsChannel& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_gnss_clock_info_2 (0x81,0x10) Clock Info 2 [CPP] +///@defgroup gnss_clock_info_2_cpp (0x81,0x10) Clock Info 2 /// GNSS reported receiver clock parameters /// /// This supersedes MIP_DATA_DESC_GNSS_CLOCK_INFO with additional information. @@ -1243,6 +1278,7 @@ struct ClockInfo2 { struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -1264,51 +1300,53 @@ struct ClockInfo2 ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool bias() const { return (value & BIAS) > 0; } - void bias(bool val) { if(val) value |= BIAS; else value &= ~BIAS; } + void bias(bool val) { value &= ~BIAS; if(val) value |= BIAS; } bool drift() const { return (value & DRIFT) > 0; } - void drift(bool val) { if(val) value |= DRIFT; else value &= ~DRIFT; } + void drift(bool val) { value &= ~DRIFT; if(val) value |= DRIFT; } bool biasAccuracy() const { return (value & BIAS_ACCURACY) > 0; } - void biasAccuracy(bool val) { if(val) value |= BIAS_ACCURACY; else value &= ~BIAS_ACCURACY; } + void biasAccuracy(bool val) { value &= ~BIAS_ACCURACY; if(val) value |= BIAS_ACCURACY; } bool driftAccuracy() const { return (value & DRIFT_ACCURACY) > 0; } - void driftAccuracy(bool val) { if(val) value |= DRIFT_ACCURACY; else value &= ~DRIFT_ACCURACY; } + void driftAccuracy(bool val) { value &= ~DRIFT_ACCURACY; if(val) value |= DRIFT_ACCURACY; } uint16_t flags() const { return (value & FLAGS) >> 0; } void flags(uint16_t val) { value = (value & ~FLAGS) | (val << 0); } - bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters double bias = 0; double drift = 0; double bias_accuracy_estimate = 0; double drift_accuracy_estimate = 0; ValidFlags valid_flags; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_gnss::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_gnss::DATA_CLOCK_INFO_2; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ClockInfo2"; static constexpr const char* DOC_NAME = "ClockInfo2"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(bias,drift,bias_accuracy_estimate,drift_accuracy_estimate,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(bias),std::ref(drift),std::ref(bias_accuracy_estimate),std::ref(drift_accuracy_estimate),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const ClockInfo2& self); -void extract(Serializer& serializer, ClockInfo2& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_gnss_gps_leap_seconds (0x81,0x11) Gps Leap Seconds [CPP] +///@defgroup gnss_gps_leap_seconds_cpp (0x81,0x11) Gps Leap Seconds /// GNSS reported leap seconds (difference between GPS and UTC Time) /// ///@{ @@ -1317,6 +1355,7 @@ struct GpsLeapSeconds { struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -1334,40 +1373,42 @@ struct GpsLeapSeconds ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool leapSeconds() const { return (value & LEAP_SECONDS) > 0; } - void leapSeconds(bool val) { if(val) value |= LEAP_SECONDS; else value &= ~LEAP_SECONDS; } - + void leapSeconds(bool val) { value &= ~LEAP_SECONDS; if(val) value |= LEAP_SECONDS; } bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters uint8_t leap_seconds = 0; ///< [s] ValidFlags valid_flags; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_gnss::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_gnss::DATA_GPS_LEAP_SECONDS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GpsLeapSeconds"; static constexpr const char* DOC_NAME = "GpsLeapSeconds"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(leap_seconds,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(leap_seconds),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const GpsLeapSeconds& self); -void extract(Serializer& serializer, GpsLeapSeconds& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_gnss_sbas_info (0x81,0x12) Sbas Info [CPP] +///@defgroup gnss_sbas_info_cpp (0x81,0x12) Sbas Info /// GNSS SBAS status /// ///@{ @@ -1376,6 +1417,7 @@ struct SbasInfo { struct SbasStatus : Bitfield { + typedef uint8_t Type; enum _enumType : uint8_t { NONE = 0x00, @@ -1396,20 +1438,19 @@ struct SbasInfo SbasStatus& operator&=(uint8_t val) { return *this = value & val; } bool rangeAvailable() const { return (value & RANGE_AVAILABLE) > 0; } - void rangeAvailable(bool val) { if(val) value |= RANGE_AVAILABLE; else value &= ~RANGE_AVAILABLE; } + void rangeAvailable(bool val) { value &= ~RANGE_AVAILABLE; if(val) value |= RANGE_AVAILABLE; } bool correctionsAvailable() const { return (value & CORRECTIONS_AVAILABLE) > 0; } - void correctionsAvailable(bool val) { if(val) value |= CORRECTIONS_AVAILABLE; else value &= ~CORRECTIONS_AVAILABLE; } + void correctionsAvailable(bool val) { value &= ~CORRECTIONS_AVAILABLE; if(val) value |= CORRECTIONS_AVAILABLE; } bool integrityAvailable() const { return (value & INTEGRITY_AVAILABLE) > 0; } - void integrityAvailable(bool val) { if(val) value |= INTEGRITY_AVAILABLE; else value &= ~INTEGRITY_AVAILABLE; } + void integrityAvailable(bool val) { value &= ~INTEGRITY_AVAILABLE; if(val) value |= INTEGRITY_AVAILABLE; } bool testMode() const { return (value & TEST_MODE) > 0; } - void testMode(bool val) { if(val) value |= TEST_MODE; else value &= ~TEST_MODE; } - + void testMode(bool val) { value &= ~TEST_MODE; if(val) value |= TEST_MODE; } bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -1433,24 +1474,23 @@ struct SbasInfo ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool tow() const { return (value & TOW) > 0; } - void tow(bool val) { if(val) value |= TOW; else value &= ~TOW; } + void tow(bool val) { value &= ~TOW; if(val) value |= TOW; } bool weekNumber() const { return (value & WEEK_NUMBER) > 0; } - void weekNumber(bool val) { if(val) value |= WEEK_NUMBER; else value &= ~WEEK_NUMBER; } + void weekNumber(bool val) { value &= ~WEEK_NUMBER; if(val) value |= WEEK_NUMBER; } bool sbasSystem() const { return (value & SBAS_SYSTEM) > 0; } - void sbasSystem(bool val) { if(val) value |= SBAS_SYSTEM; else value &= ~SBAS_SYSTEM; } + void sbasSystem(bool val) { value &= ~SBAS_SYSTEM; if(val) value |= SBAS_SYSTEM; } bool sbasId() const { return (value & SBAS_ID) > 0; } - void sbasId(bool val) { if(val) value |= SBAS_ID; else value &= ~SBAS_ID; } + void sbasId(bool val) { value &= ~SBAS_ID; if(val) value |= SBAS_ID; } bool count() const { return (value & COUNT) > 0; } - void count(bool val) { if(val) value |= COUNT; else value &= ~COUNT; } + void count(bool val) { value &= ~COUNT; if(val) value |= COUNT; } bool sbasStatus() const { return (value & SBAS_STATUS) > 0; } - void sbasStatus(bool val) { if(val) value |= SBAS_STATUS; else value &= ~SBAS_STATUS; } + void sbasStatus(bool val) { value &= ~SBAS_STATUS; if(val) value |= SBAS_STATUS; } uint16_t flags() const { return (value & FLAGS) >> 0; } void flags(uint16_t val) { value = (value & ~FLAGS) | (val << 0); } - bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters double time_of_week = 0; ///< GPS Time of week [seconds] uint16_t week_number = 0; ///< GPS Week since 1980 [weeks] SbasSystem sbas_system = static_cast(0); ///< SBAS system id @@ -1459,31 +1499,34 @@ struct SbasInfo SbasStatus sbas_status; ///< Status of the SBAS service ValidFlags valid_flags; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_gnss::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_gnss::DATA_SBAS_INFO; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "SbasInfo"; static constexpr const char* DOC_NAME = "SbasInfo"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(time_of_week,week_number,sbas_system,sbas_id,count,sbas_status,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(time_of_week),std::ref(week_number),std::ref(sbas_system),std::ref(sbas_id),std::ref(count),std::ref(sbas_status),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const SbasInfo& self); -void extract(Serializer& serializer, SbasInfo& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_gnss_sbas_correction (0x81,0x13) Sbas Correction [CPP] +///@defgroup gnss_sbas_correction_cpp (0x81,0x13) Sbas Correction /// GNSS calculated SBAS Correction /// /// UDREI - the variance of a normal distribution associated with the user differential range errors for a @@ -1514,6 +1557,7 @@ struct SbasCorrection { struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -1534,18 +1578,17 @@ struct SbasCorrection ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool udrei() const { return (value & UDREI) > 0; } - void udrei(bool val) { if(val) value |= UDREI; else value &= ~UDREI; } + void udrei(bool val) { value &= ~UDREI; if(val) value |= UDREI; } bool pseudorangeCorrection() const { return (value & PSEUDORANGE_CORRECTION) > 0; } - void pseudorangeCorrection(bool val) { if(val) value |= PSEUDORANGE_CORRECTION; else value &= ~PSEUDORANGE_CORRECTION; } + void pseudorangeCorrection(bool val) { value &= ~PSEUDORANGE_CORRECTION; if(val) value |= PSEUDORANGE_CORRECTION; } bool ionoCorrection() const { return (value & IONO_CORRECTION) > 0; } - void ionoCorrection(bool val) { if(val) value |= IONO_CORRECTION; else value &= ~IONO_CORRECTION; } + void ionoCorrection(bool val) { value &= ~IONO_CORRECTION; if(val) value |= IONO_CORRECTION; } uint16_t flags() const { return (value & FLAGS) >> 0; } void flags(uint16_t val) { value = (value & ~FLAGS) | (val << 0); } - bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters uint8_t index = 0; ///< Index of this field in this epoch. uint8_t count = 0; ///< Total number of fields in this epoch. double time_of_week = 0; ///< GPS Time of week the message was received [seconds] @@ -1557,31 +1600,34 @@ struct SbasCorrection float iono_correction = 0; ///< Ionospheric correction [meters]. ValidFlags valid_flags; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_gnss::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_gnss::DATA_SBAS_CORRECTION; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "SbasCorrection"; static constexpr const char* DOC_NAME = "SbasCorrection"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(index,count,time_of_week,week_number,gnss_id,sv_id,udrei,pseudorange_correction,iono_correction,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(index),std::ref(count),std::ref(time_of_week),std::ref(week_number),std::ref(gnss_id),std::ref(sv_id),std::ref(udrei),std::ref(pseudorange_correction),std::ref(iono_correction),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const SbasCorrection& self); -void extract(Serializer& serializer, SbasCorrection& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_gnss_rf_error_detection (0x81,0x14) Rf Error Detection [CPP] +///@defgroup gnss_rf_error_detection_cpp (0x81,0x14) Rf Error Detection /// GNSS Error Detection subsystem status /// ///@{ @@ -1614,6 +1660,7 @@ struct RfErrorDetection struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -1634,49 +1681,51 @@ struct RfErrorDetection ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool rfBand() const { return (value & RF_BAND) > 0; } - void rfBand(bool val) { if(val) value |= RF_BAND; else value &= ~RF_BAND; } + void rfBand(bool val) { value &= ~RF_BAND; if(val) value |= RF_BAND; } bool jammingState() const { return (value & JAMMING_STATE) > 0; } - void jammingState(bool val) { if(val) value |= JAMMING_STATE; else value &= ~JAMMING_STATE; } + void jammingState(bool val) { value &= ~JAMMING_STATE; if(val) value |= JAMMING_STATE; } bool spoofingState() const { return (value & SPOOFING_STATE) > 0; } - void spoofingState(bool val) { if(val) value |= SPOOFING_STATE; else value &= ~SPOOFING_STATE; } + void spoofingState(bool val) { value &= ~SPOOFING_STATE; if(val) value |= SPOOFING_STATE; } uint16_t flags() const { return (value & FLAGS) >> 0; } void flags(uint16_t val) { value = (value & ~FLAGS) | (val << 0); } - bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters RFBand rf_band = static_cast(0); ///< RF Band of the reported information JammingState jamming_state = static_cast(0); ///< GNSS Jamming State (as reported by the GNSS module) SpoofingState spoofing_state = static_cast(0); ///< GNSS Spoofing State (as reported by the GNSS module) uint8_t reserved[4] = {0}; ///< Reserved for future use ValidFlags valid_flags; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_gnss::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_gnss::DATA_RF_ERROR_DETECTION; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "RfErrorDetection"; static constexpr const char* DOC_NAME = "RfErrorDetection"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(rf_band,jamming_state,spoofing_state,reserved,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(rf_band),std::ref(jamming_state),std::ref(spoofing_state),std::ref(reserved),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const RfErrorDetection& self); -void extract(Serializer& serializer, RfErrorDetection& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_gnss_base_station_info (0x81,0x30) Base Station Info [CPP] +///@defgroup gnss_base_station_info_cpp (0x81,0x30) Base Station Info /// RTCM reported base station information (sourced from RTCM Message 1005 or 1006) /// /// Valid Flag Mapping: @@ -1687,6 +1736,7 @@ struct BaseStationInfo { struct IndicatorFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -1712,30 +1762,29 @@ struct BaseStationInfo IndicatorFlags& operator&=(uint16_t val) { return *this = value & val; } bool gps() const { return (value & GPS) > 0; } - void gps(bool val) { if(val) value |= GPS; else value &= ~GPS; } + void gps(bool val) { value &= ~GPS; if(val) value |= GPS; } bool glonass() const { return (value & GLONASS) > 0; } - void glonass(bool val) { if(val) value |= GLONASS; else value &= ~GLONASS; } + void glonass(bool val) { value &= ~GLONASS; if(val) value |= GLONASS; } bool galileo() const { return (value & GALILEO) > 0; } - void galileo(bool val) { if(val) value |= GALILEO; else value &= ~GALILEO; } + void galileo(bool val) { value &= ~GALILEO; if(val) value |= GALILEO; } bool beidou() const { return (value & BEIDOU) > 0; } - void beidou(bool val) { if(val) value |= BEIDOU; else value &= ~BEIDOU; } + void beidou(bool val) { value &= ~BEIDOU; if(val) value |= BEIDOU; } bool refStation() const { return (value & REF_STATION) > 0; } - void refStation(bool val) { if(val) value |= REF_STATION; else value &= ~REF_STATION; } + void refStation(bool val) { value &= ~REF_STATION; if(val) value |= REF_STATION; } bool singleReceiver() const { return (value & SINGLE_RECEIVER) > 0; } - void singleReceiver(bool val) { if(val) value |= SINGLE_RECEIVER; else value &= ~SINGLE_RECEIVER; } + void singleReceiver(bool val) { value &= ~SINGLE_RECEIVER; if(val) value |= SINGLE_RECEIVER; } bool quarterCycleBit1() const { return (value & QUARTER_CYCLE_BIT1) > 0; } - void quarterCycleBit1(bool val) { if(val) value |= QUARTER_CYCLE_BIT1; else value &= ~QUARTER_CYCLE_BIT1; } + void quarterCycleBit1(bool val) { value &= ~QUARTER_CYCLE_BIT1; if(val) value |= QUARTER_CYCLE_BIT1; } bool quarterCycleBit2() const { return (value & QUARTER_CYCLE_BIT2) > 0; } - void quarterCycleBit2(bool val) { if(val) value |= QUARTER_CYCLE_BIT2; else value &= ~QUARTER_CYCLE_BIT2; } + void quarterCycleBit2(bool val) { value &= ~QUARTER_CYCLE_BIT2; if(val) value |= QUARTER_CYCLE_BIT2; } uint16_t quarterCycleBits() const { return (value & QUARTER_CYCLE_BITS) >> 6; } void quarterCycleBits(uint16_t val) { value = (value & ~QUARTER_CYCLE_BITS) | (val << 6); } - bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -1759,24 +1808,23 @@ struct BaseStationInfo ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool tow() const { return (value & TOW) > 0; } - void tow(bool val) { if(val) value |= TOW; else value &= ~TOW; } + void tow(bool val) { value &= ~TOW; if(val) value |= TOW; } bool weekNumber() const { return (value & WEEK_NUMBER) > 0; } - void weekNumber(bool val) { if(val) value |= WEEK_NUMBER; else value &= ~WEEK_NUMBER; } + void weekNumber(bool val) { value &= ~WEEK_NUMBER; if(val) value |= WEEK_NUMBER; } bool ecefPosition() const { return (value & ECEF_POSITION) > 0; } - void ecefPosition(bool val) { if(val) value |= ECEF_POSITION; else value &= ~ECEF_POSITION; } + void ecefPosition(bool val) { value &= ~ECEF_POSITION; if(val) value |= ECEF_POSITION; } bool height() const { return (value & HEIGHT) > 0; } - void height(bool val) { if(val) value |= HEIGHT; else value &= ~HEIGHT; } + void height(bool val) { value &= ~HEIGHT; if(val) value |= HEIGHT; } bool stationId() const { return (value & STATION_ID) > 0; } - void stationId(bool val) { if(val) value |= STATION_ID; else value &= ~STATION_ID; } + void stationId(bool val) { value &= ~STATION_ID; if(val) value |= STATION_ID; } bool indicators() const { return (value & INDICATORS) > 0; } - void indicators(bool val) { if(val) value |= INDICATORS; else value &= ~INDICATORS; } + void indicators(bool val) { value &= ~INDICATORS; if(val) value |= INDICATORS; } uint16_t flags() const { return (value & FLAGS) >> 0; } void flags(uint16_t val) { value = (value & ~FLAGS) | (val << 0); } - bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters double time_of_week = 0; ///< GPS Time of week the message was received [seconds] uint16_t week_number = 0; ///< GPS Week since 1980 [weeks] Vector3d ecef_pos; ///< Earth-centered, Earth-fixed [m] @@ -1785,31 +1833,34 @@ struct BaseStationInfo IndicatorFlags indicators; ///< Bitfield ValidFlags valid_flags; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_gnss::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_gnss::DATA_BASE_STATION_INFO; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "BaseStationInfo"; static constexpr const char* DOC_NAME = "BaseStationInfo"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(time_of_week,week_number,ecef_pos[0],ecef_pos[1],ecef_pos[2],height,station_id,indicators,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(time_of_week),std::ref(week_number),std::ref(ecef_pos[0]),std::ref(ecef_pos[1]),std::ref(ecef_pos[2]),std::ref(height),std::ref(station_id),std::ref(indicators),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const BaseStationInfo& self); -void extract(Serializer& serializer, BaseStationInfo& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_gnss_rtk_corrections_status (0x81,0x31) Rtk Corrections Status [CPP] +///@defgroup gnss_rtk_corrections_status_cpp (0x81,0x31) Rtk Corrections Status /// ///@{ @@ -1817,6 +1868,7 @@ struct RtkCorrectionsStatus { struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -1842,30 +1894,29 @@ struct RtkCorrectionsStatus ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool tow() const { return (value & TOW) > 0; } - void tow(bool val) { if(val) value |= TOW; else value &= ~TOW; } + void tow(bool val) { value &= ~TOW; if(val) value |= TOW; } bool weekNumber() const { return (value & WEEK_NUMBER) > 0; } - void weekNumber(bool val) { if(val) value |= WEEK_NUMBER; else value &= ~WEEK_NUMBER; } + void weekNumber(bool val) { value &= ~WEEK_NUMBER; if(val) value |= WEEK_NUMBER; } bool epochStatus() const { return (value & EPOCH_STATUS) > 0; } - void epochStatus(bool val) { if(val) value |= EPOCH_STATUS; else value &= ~EPOCH_STATUS; } + void epochStatus(bool val) { value &= ~EPOCH_STATUS; if(val) value |= EPOCH_STATUS; } bool dongleStatus() const { return (value & DONGLE_STATUS) > 0; } - void dongleStatus(bool val) { if(val) value |= DONGLE_STATUS; else value &= ~DONGLE_STATUS; } + void dongleStatus(bool val) { value &= ~DONGLE_STATUS; if(val) value |= DONGLE_STATUS; } bool gpsLatency() const { return (value & GPS_LATENCY) > 0; } - void gpsLatency(bool val) { if(val) value |= GPS_LATENCY; else value &= ~GPS_LATENCY; } + void gpsLatency(bool val) { value &= ~GPS_LATENCY; if(val) value |= GPS_LATENCY; } bool glonassLatency() const { return (value & GLONASS_LATENCY) > 0; } - void glonassLatency(bool val) { if(val) value |= GLONASS_LATENCY; else value &= ~GLONASS_LATENCY; } + void glonassLatency(bool val) { value &= ~GLONASS_LATENCY; if(val) value |= GLONASS_LATENCY; } bool galileoLatency() const { return (value & GALILEO_LATENCY) > 0; } - void galileoLatency(bool val) { if(val) value |= GALILEO_LATENCY; else value &= ~GALILEO_LATENCY; } + void galileoLatency(bool val) { value &= ~GALILEO_LATENCY; if(val) value |= GALILEO_LATENCY; } bool beidouLatency() const { return (value & BEIDOU_LATENCY) > 0; } - void beidouLatency(bool val) { if(val) value |= BEIDOU_LATENCY; else value &= ~BEIDOU_LATENCY; } + void beidouLatency(bool val) { value &= ~BEIDOU_LATENCY; if(val) value |= BEIDOU_LATENCY; } uint16_t flags() const { return (value & FLAGS) >> 0; } void flags(uint16_t val) { value = (value & ~FLAGS) | (val << 0); } - bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - struct EpochStatus : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -1891,28 +1942,27 @@ struct RtkCorrectionsStatus EpochStatus& operator&=(uint16_t val) { return *this = value & val; } bool antennaLocationReceived() const { return (value & ANTENNA_LOCATION_RECEIVED) > 0; } - void antennaLocationReceived(bool val) { if(val) value |= ANTENNA_LOCATION_RECEIVED; else value &= ~ANTENNA_LOCATION_RECEIVED; } + void antennaLocationReceived(bool val) { value &= ~ANTENNA_LOCATION_RECEIVED; if(val) value |= ANTENNA_LOCATION_RECEIVED; } bool antennaDescriptionReceived() const { return (value & ANTENNA_DESCRIPTION_RECEIVED) > 0; } - void antennaDescriptionReceived(bool val) { if(val) value |= ANTENNA_DESCRIPTION_RECEIVED; else value &= ~ANTENNA_DESCRIPTION_RECEIVED; } + void antennaDescriptionReceived(bool val) { value &= ~ANTENNA_DESCRIPTION_RECEIVED; if(val) value |= ANTENNA_DESCRIPTION_RECEIVED; } bool gpsReceived() const { return (value & GPS_RECEIVED) > 0; } - void gpsReceived(bool val) { if(val) value |= GPS_RECEIVED; else value &= ~GPS_RECEIVED; } + void gpsReceived(bool val) { value &= ~GPS_RECEIVED; if(val) value |= GPS_RECEIVED; } bool glonassReceived() const { return (value & GLONASS_RECEIVED) > 0; } - void glonassReceived(bool val) { if(val) value |= GLONASS_RECEIVED; else value &= ~GLONASS_RECEIVED; } + void glonassReceived(bool val) { value &= ~GLONASS_RECEIVED; if(val) value |= GLONASS_RECEIVED; } bool galileoReceived() const { return (value & GALILEO_RECEIVED) > 0; } - void galileoReceived(bool val) { if(val) value |= GALILEO_RECEIVED; else value &= ~GALILEO_RECEIVED; } + void galileoReceived(bool val) { value &= ~GALILEO_RECEIVED; if(val) value |= GALILEO_RECEIVED; } bool beidouReceived() const { return (value & BEIDOU_RECEIVED) > 0; } - void beidouReceived(bool val) { if(val) value |= BEIDOU_RECEIVED; else value &= ~BEIDOU_RECEIVED; } + void beidouReceived(bool val) { value &= ~BEIDOU_RECEIVED; if(val) value |= BEIDOU_RECEIVED; } bool usingGpsMsmMessages() const { return (value & USING_GPS_MSM_MESSAGES) > 0; } - void usingGpsMsmMessages(bool val) { if(val) value |= USING_GPS_MSM_MESSAGES; else value &= ~USING_GPS_MSM_MESSAGES; } + void usingGpsMsmMessages(bool val) { value &= ~USING_GPS_MSM_MESSAGES; if(val) value |= USING_GPS_MSM_MESSAGES; } bool usingGlonassMsmMessages() const { return (value & USING_GLONASS_MSM_MESSAGES) > 0; } - void usingGlonassMsmMessages(bool val) { if(val) value |= USING_GLONASS_MSM_MESSAGES; else value &= ~USING_GLONASS_MSM_MESSAGES; } + void usingGlonassMsmMessages(bool val) { value &= ~USING_GLONASS_MSM_MESSAGES; if(val) value |= USING_GLONASS_MSM_MESSAGES; } bool dongleStatusReadFailed() const { return (value & DONGLE_STATUS_READ_FAILED) > 0; } - void dongleStatusReadFailed(bool val) { if(val) value |= DONGLE_STATUS_READ_FAILED; else value &= ~DONGLE_STATUS_READ_FAILED; } - + void dongleStatusReadFailed(bool val) { value &= ~DONGLE_STATUS_READ_FAILED; if(val) value |= DONGLE_STATUS_READ_FAILED; } bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters double time_of_week = 0; ///< GPS Time of week [seconds] uint16_t week_number = 0; ///< GPS Week since 1980 [weeks] EpochStatus epoch_status; ///< Status of the corrections received during this epoch @@ -1924,31 +1974,34 @@ struct RtkCorrectionsStatus uint32_t reserved[4] = {0}; ///< Reserved for future use ValidFlags valid_flags; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_gnss::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_gnss::DATA_RTK_CORRECTIONS_STATUS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "RtkCorrectionsStatus"; static constexpr const char* DOC_NAME = "RtkCorrectionsStatus"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(time_of_week,week_number,epoch_status,dongle_status,gps_correction_latency,glonass_correction_latency,galileo_correction_latency,beidou_correction_latency,reserved,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(time_of_week),std::ref(week_number),std::ref(epoch_status),std::ref(dongle_status),std::ref(gps_correction_latency),std::ref(glonass_correction_latency),std::ref(galileo_correction_latency),std::ref(beidou_correction_latency),std::ref(reserved),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const RtkCorrectionsStatus& self); -void extract(Serializer& serializer, RtkCorrectionsStatus& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_gnss_satellite_status (0x81,0x20) Satellite Status [CPP] +///@defgroup gnss_satellite_status_cpp (0x81,0x20) Satellite Status /// Status information for a GNSS satellite. /// ///@{ @@ -1957,6 +2010,7 @@ struct SatelliteStatus { struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -1981,26 +2035,25 @@ struct SatelliteStatus ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool tow() const { return (value & TOW) > 0; } - void tow(bool val) { if(val) value |= TOW; else value &= ~TOW; } + void tow(bool val) { value &= ~TOW; if(val) value |= TOW; } bool weekNumber() const { return (value & WEEK_NUMBER) > 0; } - void weekNumber(bool val) { if(val) value |= WEEK_NUMBER; else value &= ~WEEK_NUMBER; } + void weekNumber(bool val) { value &= ~WEEK_NUMBER; if(val) value |= WEEK_NUMBER; } bool gnssId() const { return (value & GNSS_ID) > 0; } - void gnssId(bool val) { if(val) value |= GNSS_ID; else value &= ~GNSS_ID; } + void gnssId(bool val) { value &= ~GNSS_ID; if(val) value |= GNSS_ID; } bool satelliteId() const { return (value & SATELLITE_ID) > 0; } - void satelliteId(bool val) { if(val) value |= SATELLITE_ID; else value &= ~SATELLITE_ID; } + void satelliteId(bool val) { value &= ~SATELLITE_ID; if(val) value |= SATELLITE_ID; } bool elevation() const { return (value & ELEVATION) > 0; } - void elevation(bool val) { if(val) value |= ELEVATION; else value &= ~ELEVATION; } + void elevation(bool val) { value &= ~ELEVATION; if(val) value |= ELEVATION; } bool azimuth() const { return (value & AZIMUTH) > 0; } - void azimuth(bool val) { if(val) value |= AZIMUTH; else value &= ~AZIMUTH; } + void azimuth(bool val) { value &= ~AZIMUTH; if(val) value |= AZIMUTH; } bool health() const { return (value & HEALTH) > 0; } - void health(bool val) { if(val) value |= HEALTH; else value &= ~HEALTH; } + void health(bool val) { value &= ~HEALTH; if(val) value |= HEALTH; } uint16_t flags() const { return (value & FLAGS) >> 0; } void flags(uint16_t val) { value = (value & ~FLAGS) | (val << 0); } - bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters uint8_t index = 0; ///< Index of this field in this epoch. uint8_t count = 0; ///< Total number of fields in this epoch. double time_of_week = 0; ///< GPS Time of week [seconds] @@ -2012,31 +2065,34 @@ struct SatelliteStatus bool health = 0; ///< True if the satellite is healthy. ValidFlags valid_flags; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_gnss::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_gnss::DATA_SATELLITE_STATUS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "SatelliteStatus"; static constexpr const char* DOC_NAME = "SatelliteStatus"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(index,count,time_of_week,week_number,gnss_id,satellite_id,elevation,azimuth,health,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(index),std::ref(count),std::ref(time_of_week),std::ref(week_number),std::ref(gnss_id),std::ref(satellite_id),std::ref(elevation),std::ref(azimuth),std::ref(health),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const SatelliteStatus& self); -void extract(Serializer& serializer, SatelliteStatus& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_gnss_raw (0x81,0x22) Raw [CPP] +///@defgroup gnss_raw_cpp (0x81,0x22) Raw /// GNSS Raw observation. /// ///@{ @@ -2055,6 +2111,7 @@ struct Raw struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -2088,44 +2145,43 @@ struct Raw ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool tow() const { return (value & TOW) > 0; } - void tow(bool val) { if(val) value |= TOW; else value &= ~TOW; } + void tow(bool val) { value &= ~TOW; if(val) value |= TOW; } bool weekNumber() const { return (value & WEEK_NUMBER) > 0; } - void weekNumber(bool val) { if(val) value |= WEEK_NUMBER; else value &= ~WEEK_NUMBER; } + void weekNumber(bool val) { value &= ~WEEK_NUMBER; if(val) value |= WEEK_NUMBER; } bool receiverId() const { return (value & RECEIVER_ID) > 0; } - void receiverId(bool val) { if(val) value |= RECEIVER_ID; else value &= ~RECEIVER_ID; } + void receiverId(bool val) { value &= ~RECEIVER_ID; if(val) value |= RECEIVER_ID; } bool trackingChannel() const { return (value & TRACKING_CHANNEL) > 0; } - void trackingChannel(bool val) { if(val) value |= TRACKING_CHANNEL; else value &= ~TRACKING_CHANNEL; } + void trackingChannel(bool val) { value &= ~TRACKING_CHANNEL; if(val) value |= TRACKING_CHANNEL; } bool gnssId() const { return (value & GNSS_ID) > 0; } - void gnssId(bool val) { if(val) value |= GNSS_ID; else value &= ~GNSS_ID; } + void gnssId(bool val) { value &= ~GNSS_ID; if(val) value |= GNSS_ID; } bool satelliteId() const { return (value & SATELLITE_ID) > 0; } - void satelliteId(bool val) { if(val) value |= SATELLITE_ID; else value &= ~SATELLITE_ID; } + void satelliteId(bool val) { value &= ~SATELLITE_ID; if(val) value |= SATELLITE_ID; } bool signalId() const { return (value & SIGNAL_ID) > 0; } - void signalId(bool val) { if(val) value |= SIGNAL_ID; else value &= ~SIGNAL_ID; } + void signalId(bool val) { value &= ~SIGNAL_ID; if(val) value |= SIGNAL_ID; } bool signalStrength() const { return (value & SIGNAL_STRENGTH) > 0; } - void signalStrength(bool val) { if(val) value |= SIGNAL_STRENGTH; else value &= ~SIGNAL_STRENGTH; } + void signalStrength(bool val) { value &= ~SIGNAL_STRENGTH; if(val) value |= SIGNAL_STRENGTH; } bool quality() const { return (value & QUALITY) > 0; } - void quality(bool val) { if(val) value |= QUALITY; else value &= ~QUALITY; } + void quality(bool val) { value &= ~QUALITY; if(val) value |= QUALITY; } bool pseudorange() const { return (value & PSEUDORANGE) > 0; } - void pseudorange(bool val) { if(val) value |= PSEUDORANGE; else value &= ~PSEUDORANGE; } + void pseudorange(bool val) { value &= ~PSEUDORANGE; if(val) value |= PSEUDORANGE; } bool carrierPhase() const { return (value & CARRIER_PHASE) > 0; } - void carrierPhase(bool val) { if(val) value |= CARRIER_PHASE; else value &= ~CARRIER_PHASE; } + void carrierPhase(bool val) { value &= ~CARRIER_PHASE; if(val) value |= CARRIER_PHASE; } bool doppler() const { return (value & DOPPLER) > 0; } - void doppler(bool val) { if(val) value |= DOPPLER; else value &= ~DOPPLER; } + void doppler(bool val) { value &= ~DOPPLER; if(val) value |= DOPPLER; } bool rangeUncertainty() const { return (value & RANGE_UNCERTAINTY) > 0; } - void rangeUncertainty(bool val) { if(val) value |= RANGE_UNCERTAINTY; else value &= ~RANGE_UNCERTAINTY; } + void rangeUncertainty(bool val) { value &= ~RANGE_UNCERTAINTY; if(val) value |= RANGE_UNCERTAINTY; } bool carrierPhaseUncertainty() const { return (value & CARRIER_PHASE_UNCERTAINTY) > 0; } - void carrierPhaseUncertainty(bool val) { if(val) value |= CARRIER_PHASE_UNCERTAINTY; else value &= ~CARRIER_PHASE_UNCERTAINTY; } + void carrierPhaseUncertainty(bool val) { value &= ~CARRIER_PHASE_UNCERTAINTY; if(val) value |= CARRIER_PHASE_UNCERTAINTY; } bool dopplerUncertainty() const { return (value & DOPPLER_UNCERTAINTY) > 0; } - void dopplerUncertainty(bool val) { if(val) value |= DOPPLER_UNCERTAINTY; else value &= ~DOPPLER_UNCERTAINTY; } + void dopplerUncertainty(bool val) { value &= ~DOPPLER_UNCERTAINTY; if(val) value |= DOPPLER_UNCERTAINTY; } bool lockTime() const { return (value & LOCK_TIME) > 0; } - void lockTime(bool val) { if(val) value |= LOCK_TIME; else value &= ~LOCK_TIME; } + void lockTime(bool val) { value &= ~LOCK_TIME; if(val) value |= LOCK_TIME; } uint16_t flags() const { return (value & FLAGS) >> 0; } void flags(uint16_t val) { value = (value & ~FLAGS) | (val << 0); } - bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters uint8_t index = 0; ///< Index of this field in this epoch. uint8_t count = 0; ///< Total number of fields in this epoch. double time_of_week = 0; ///< GPS Time of week [seconds] @@ -2146,31 +2202,34 @@ struct Raw float lock_time = 0; ///< DOC Minimum carrier phase lock time [s]. Note: the maximum value is dependent on the receiver. ValidFlags valid_flags; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_gnss::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_gnss::DATA_RAW; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "Raw"; static constexpr const char* DOC_NAME = "Raw"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(index,count,time_of_week,week_number,receiver_id,tracking_channel,gnss_id,satellite_id,signal_id,signal_strength,quality,pseudorange,carrier_phase,doppler,range_uncert,phase_uncert,doppler_uncert,lock_time,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(index),std::ref(count),std::ref(time_of_week),std::ref(week_number),std::ref(receiver_id),std::ref(tracking_channel),std::ref(gnss_id),std::ref(satellite_id),std::ref(signal_id),std::ref(signal_strength),std::ref(quality),std::ref(pseudorange),std::ref(carrier_phase),std::ref(doppler),std::ref(range_uncert),std::ref(phase_uncert),std::ref(doppler_uncert),std::ref(lock_time),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const Raw& self); -void extract(Serializer& serializer, Raw& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_gnss_gps_ephemeris (0x81,0x61) Gps Ephemeris [CPP] +///@defgroup gnss_gps_ephemeris_cpp (0x81,0x61) Gps Ephemeris /// GPS Ephemeris Data /// ///@{ @@ -2179,13 +2238,15 @@ struct GpsEphemeris { struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, EPHEMERIS = 0x0001, ///< MODERN_DATA = 0x0002, ///< - FLAGS = 0x0003, ///< - ALL = 0x0003, + ISC_L5 = 0x0004, ///< + FLAGS = 0x0007, ///< + ALL = 0x0007, }; uint16_t value = NONE; @@ -2198,16 +2259,17 @@ struct GpsEphemeris ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool ephemeris() const { return (value & EPHEMERIS) > 0; } - void ephemeris(bool val) { if(val) value |= EPHEMERIS; else value &= ~EPHEMERIS; } + void ephemeris(bool val) { value &= ~EPHEMERIS; if(val) value |= EPHEMERIS; } bool modernData() const { return (value & MODERN_DATA) > 0; } - void modernData(bool val) { if(val) value |= MODERN_DATA; else value &= ~MODERN_DATA; } + void modernData(bool val) { value &= ~MODERN_DATA; if(val) value |= MODERN_DATA; } + bool iscL5() const { return (value & ISC_L5) > 0; } + void iscL5(bool val) { value &= ~ISC_L5; if(val) value |= ISC_L5; } uint16_t flags() const { return (value & FLAGS) >> 0; } void flags(uint16_t val) { value = (value & ~FLAGS) | (val << 0); } - bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters uint8_t index = 0; ///< Index of this field in this epoch. uint8_t count = 0; ///< Total number of fields in this epoch. double time_of_week = 0; ///< GPS Time of week [seconds] @@ -2221,8 +2283,8 @@ struct GpsEphemeris double af1 = 0; ///< Clock drift in [s/s]. double af2 = 0; ///< Clock drift rate in [s/s^2]. double t_gd = 0; ///< T Group Delay [s]. - double ISC_L1CA = 0; - double ISC_L2C = 0; + double ISC_L1CA = 0; ///< Inter-signal correction (L1). + double ISC_L2C = 0; ///< Inter-signal correction (L2, or L5 if isc_l5 flag is set). double t_oe = 0; ///< Reference time for ephemeris in [s]. double a = 0; ///< Semi-major axis [m]. double a_dot = 0; ///< Semi-major axis rate [m/s]. @@ -2243,31 +2305,34 @@ struct GpsEphemeris double c_rs = 0; ///< Harmonic Correction Term. ValidFlags valid_flags; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_gnss::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_gnss::DATA_GPS_EPHEMERIS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GpsEphemeris"; - static constexpr const char* DOC_NAME = "GpsEphemeris"; + static constexpr const char* DOC_NAME = "GPS Ephemeris"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(index,count,time_of_week,week_number,satellite_id,health,iodc,iode,t_oc,af0,af1,af2,t_gd,ISC_L1CA,ISC_L2C,t_oe,a,a_dot,mean_anomaly,delta_mean_motion,delta_mean_motion_dot,eccentricity,argument_of_perigee,omega,omega_dot,inclination,inclination_dot,c_ic,c_is,c_uc,c_us,c_rc,c_rs,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(index),std::ref(count),std::ref(time_of_week),std::ref(week_number),std::ref(satellite_id),std::ref(health),std::ref(iodc),std::ref(iode),std::ref(t_oc),std::ref(af0),std::ref(af1),std::ref(af2),std::ref(t_gd),std::ref(ISC_L1CA),std::ref(ISC_L2C),std::ref(t_oe),std::ref(a),std::ref(a_dot),std::ref(mean_anomaly),std::ref(delta_mean_motion),std::ref(delta_mean_motion_dot),std::ref(eccentricity),std::ref(argument_of_perigee),std::ref(omega),std::ref(omega_dot),std::ref(inclination),std::ref(inclination_dot),std::ref(c_ic),std::ref(c_is),std::ref(c_uc),std::ref(c_us),std::ref(c_rc),std::ref(c_rs),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const GpsEphemeris& self); -void extract(Serializer& serializer, GpsEphemeris& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_gnss_galileo_ephemeris (0x81,0x63) Galileo Ephemeris [CPP] +///@defgroup gnss_galileo_ephemeris_cpp (0x81,0x63) Galileo Ephemeris /// Galileo Ephemeris Data /// ///@{ @@ -2276,13 +2341,15 @@ struct GalileoEphemeris { struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, EPHEMERIS = 0x0001, ///< MODERN_DATA = 0x0002, ///< - FLAGS = 0x0003, ///< - ALL = 0x0003, + ISC_L5 = 0x0004, ///< + FLAGS = 0x0007, ///< + ALL = 0x0007, }; uint16_t value = NONE; @@ -2295,16 +2362,17 @@ struct GalileoEphemeris ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool ephemeris() const { return (value & EPHEMERIS) > 0; } - void ephemeris(bool val) { if(val) value |= EPHEMERIS; else value &= ~EPHEMERIS; } + void ephemeris(bool val) { value &= ~EPHEMERIS; if(val) value |= EPHEMERIS; } bool modernData() const { return (value & MODERN_DATA) > 0; } - void modernData(bool val) { if(val) value |= MODERN_DATA; else value &= ~MODERN_DATA; } + void modernData(bool val) { value &= ~MODERN_DATA; if(val) value |= MODERN_DATA; } + bool iscL5() const { return (value & ISC_L5) > 0; } + void iscL5(bool val) { value &= ~ISC_L5; if(val) value |= ISC_L5; } uint16_t flags() const { return (value & FLAGS) >> 0; } void flags(uint16_t val) { value = (value & ~FLAGS) | (val << 0); } - bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters uint8_t index = 0; ///< Index of this field in this epoch. uint8_t count = 0; ///< Total number of fields in this epoch. double time_of_week = 0; ///< GPS Time of week [seconds] @@ -2318,8 +2386,8 @@ struct GalileoEphemeris double af1 = 0; ///< Clock drift in [s/s]. double af2 = 0; ///< Clock drift rate in [s/s^2]. double t_gd = 0; ///< T Group Delay [s]. - double ISC_L1CA = 0; - double ISC_L2C = 0; + double ISC_L1CA = 0; ///< Inter-signal correction (L1). + double ISC_L2C = 0; ///< Inter-signal correction (L2, or L5 if isc_l5 flag is set). double t_oe = 0; ///< Reference time for ephemeris in [s]. double a = 0; ///< Semi-major axis [m]. double a_dot = 0; ///< Semi-major axis rate [m/s]. @@ -2340,31 +2408,34 @@ struct GalileoEphemeris double c_rs = 0; ///< Harmonic Correction Term. ValidFlags valid_flags; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_gnss::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_gnss::DATA_GALILEO_EPHEMERIS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GalileoEphemeris"; - static constexpr const char* DOC_NAME = "GalileoEphemeris"; + static constexpr const char* DOC_NAME = "Galileo Ephemeris"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(index,count,time_of_week,week_number,satellite_id,health,iodc,iode,t_oc,af0,af1,af2,t_gd,ISC_L1CA,ISC_L2C,t_oe,a,a_dot,mean_anomaly,delta_mean_motion,delta_mean_motion_dot,eccentricity,argument_of_perigee,omega,omega_dot,inclination,inclination_dot,c_ic,c_is,c_uc,c_us,c_rc,c_rs,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(index),std::ref(count),std::ref(time_of_week),std::ref(week_number),std::ref(satellite_id),std::ref(health),std::ref(iodc),std::ref(iode),std::ref(t_oc),std::ref(af0),std::ref(af1),std::ref(af2),std::ref(t_gd),std::ref(ISC_L1CA),std::ref(ISC_L2C),std::ref(t_oe),std::ref(a),std::ref(a_dot),std::ref(mean_anomaly),std::ref(delta_mean_motion),std::ref(delta_mean_motion_dot),std::ref(eccentricity),std::ref(argument_of_perigee),std::ref(omega),std::ref(omega_dot),std::ref(inclination),std::ref(inclination_dot),std::ref(c_ic),std::ref(c_is),std::ref(c_uc),std::ref(c_us),std::ref(c_rc),std::ref(c_rs),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const GalileoEphemeris& self); -void extract(Serializer& serializer, GalileoEphemeris& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_gnss_glo_ephemeris (0x81,0x62) Glo Ephemeris [CPP] +///@defgroup gnss_glo_ephemeris_cpp (0x81,0x62) Glo Ephemeris /// Glonass Ephemeris Data /// ///@{ @@ -2373,6 +2444,7 @@ struct GloEphemeris { struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -2391,14 +2463,13 @@ struct GloEphemeris ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool ephemeris() const { return (value & EPHEMERIS) > 0; } - void ephemeris(bool val) { if(val) value |= EPHEMERIS; else value &= ~EPHEMERIS; } + void ephemeris(bool val) { value &= ~EPHEMERIS; if(val) value |= EPHEMERIS; } bool flags() const { return (value & FLAGS) > 0; } - void flags(bool val) { if(val) value |= FLAGS; else value &= ~FLAGS; } - + void flags(bool val) { value &= ~FLAGS; if(val) value |= FLAGS; } bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters uint8_t index = 0; ///< Index of this field in this epoch. uint8_t count = 0; ///< Total number of fields in this epoch. double time_of_week = 0; ///< GPS Time of week [seconds] @@ -2425,31 +2496,34 @@ struct GloEphemeris uint8_t P4 = 0; ///< Flag indicating ephemeris parameters are present ValidFlags valid_flags; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_gnss::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_gnss::DATA_GLONASS_EPHEMERIS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GloEphemeris"; static constexpr const char* DOC_NAME = "Glonass Ephemeris"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(index,count,time_of_week,week_number,satellite_id,freq_number,tk,tb,sat_type,gamma,tau_n,x[0],x[1],x[2],v[0],v[1],v[2],a[0],a[1],a[2],health,P,NT,delta_tau_n,Ft,En,P1,P2,P3,P4,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(index),std::ref(count),std::ref(time_of_week),std::ref(week_number),std::ref(satellite_id),std::ref(freq_number),std::ref(tk),std::ref(tb),std::ref(sat_type),std::ref(gamma),std::ref(tau_n),std::ref(x[0]),std::ref(x[1]),std::ref(x[2]),std::ref(v[0]),std::ref(v[1]),std::ref(v[2]),std::ref(a[0]),std::ref(a[1]),std::ref(a[2]),std::ref(health),std::ref(P),std::ref(NT),std::ref(delta_tau_n),std::ref(Ft),std::ref(En),std::ref(P1),std::ref(P2),std::ref(P3),std::ref(P4),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const GloEphemeris& self); -void extract(Serializer& serializer, GloEphemeris& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_gnss_gps_iono_corr (0x81,0x71) Gps Iono Corr [CPP] +///@defgroup gnss_gps_iono_corr_cpp (0x81,0x71) Gps Iono Corr /// Ionospheric Correction Terms for GNSS /// ///@{ @@ -2458,6 +2532,7 @@ struct GpsIonoCorr { struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -2479,51 +2554,53 @@ struct GpsIonoCorr ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool tow() const { return (value & TOW) > 0; } - void tow(bool val) { if(val) value |= TOW; else value &= ~TOW; } + void tow(bool val) { value &= ~TOW; if(val) value |= TOW; } bool weekNumber() const { return (value & WEEK_NUMBER) > 0; } - void weekNumber(bool val) { if(val) value |= WEEK_NUMBER; else value &= ~WEEK_NUMBER; } + void weekNumber(bool val) { value &= ~WEEK_NUMBER; if(val) value |= WEEK_NUMBER; } bool alpha() const { return (value & ALPHA) > 0; } - void alpha(bool val) { if(val) value |= ALPHA; else value &= ~ALPHA; } + void alpha(bool val) { value &= ~ALPHA; if(val) value |= ALPHA; } bool beta() const { return (value & BETA) > 0; } - void beta(bool val) { if(val) value |= BETA; else value &= ~BETA; } + void beta(bool val) { value &= ~BETA; if(val) value |= BETA; } uint16_t flags() const { return (value & FLAGS) >> 0; } void flags(uint16_t val) { value = (value & ~FLAGS) | (val << 0); } - bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters double time_of_week = 0; ///< GPS Time of week [seconds] uint16_t week_number = 0; ///< GPS Week since 1980 [weeks] double alpha[4] = {0}; ///< Ionospheric Correction Terms. double beta[4] = {0}; ///< Ionospheric Correction Terms. ValidFlags valid_flags; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_gnss::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_gnss::DATA_GPS_IONO_CORR; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GpsIonoCorr"; static constexpr const char* DOC_NAME = "GPS Ionospheric Correction"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(time_of_week,week_number,alpha,beta,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(time_of_week),std::ref(week_number),std::ref(alpha),std::ref(beta),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const GpsIonoCorr& self); -void extract(Serializer& serializer, GpsIonoCorr& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_gnss_galileo_iono_corr (0x81,0x73) Galileo Iono Corr [CPP] +///@defgroup gnss_galileo_iono_corr_cpp (0x81,0x73) Galileo Iono Corr /// Ionospheric Correction Terms for Galileo /// ///@{ @@ -2532,6 +2609,7 @@ struct GalileoIonoCorr { struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -2553,46 +2631,48 @@ struct GalileoIonoCorr ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool tow() const { return (value & TOW) > 0; } - void tow(bool val) { if(val) value |= TOW; else value &= ~TOW; } + void tow(bool val) { value &= ~TOW; if(val) value |= TOW; } bool weekNumber() const { return (value & WEEK_NUMBER) > 0; } - void weekNumber(bool val) { if(val) value |= WEEK_NUMBER; else value &= ~WEEK_NUMBER; } + void weekNumber(bool val) { value &= ~WEEK_NUMBER; if(val) value |= WEEK_NUMBER; } bool alpha() const { return (value & ALPHA) > 0; } - void alpha(bool val) { if(val) value |= ALPHA; else value &= ~ALPHA; } + void alpha(bool val) { value &= ~ALPHA; if(val) value |= ALPHA; } bool disturbanceFlags() const { return (value & DISTURBANCE_FLAGS) > 0; } - void disturbanceFlags(bool val) { if(val) value |= DISTURBANCE_FLAGS; else value &= ~DISTURBANCE_FLAGS; } + void disturbanceFlags(bool val) { value &= ~DISTURBANCE_FLAGS; if(val) value |= DISTURBANCE_FLAGS; } uint16_t flags() const { return (value & FLAGS) >> 0; } void flags(uint16_t val) { value = (value & ~FLAGS) | (val << 0); } - bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters double time_of_week = 0; ///< GPS Time of week [seconds] uint16_t week_number = 0; ///< GPS Week since 1980 [weeks] Vector3d alpha; ///< Coefficients for the model. uint8_t disturbance_flags = 0; ///< Region disturbance flags (bits 1-5). ValidFlags valid_flags; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_gnss::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_gnss::DATA_GALILEO_IONO_CORR; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GalileoIonoCorr"; static constexpr const char* DOC_NAME = "Galileo Ionospheric Correction"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(time_of_week,week_number,alpha[0],alpha[1],alpha[2],disturbance_flags,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(time_of_week),std::ref(week_number),std::ref(alpha[0]),std::ref(alpha[1]),std::ref(alpha[2]),std::ref(disturbance_flags),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const GalileoIonoCorr& self); -void extract(Serializer& serializer, GalileoIonoCorr& self); - ///@} /// diff --git a/src/cpp/mip/definitions/data_sensor.cpp b/src/cpp/mip/definitions/data_sensor.cpp new file mode 100644 index 000000000..0ebb058b1 --- /dev/null +++ b/src/cpp/mip/definitions/data_sensor.cpp @@ -0,0 +1,317 @@ + +#include "data_sensor.hpp" + +#include +#include + +#include + + +namespace mip { +namespace C { +struct mip_interface; +} // namespace C + +namespace data_sensor { + +using namespace ::mip::C; + +//////////////////////////////////////////////////////////////////////////////// +// Mip Fields +//////////////////////////////////////////////////////////////////////////////// + +void RawAccel::insert(Serializer& serializer) const +{ + serializer.insert(raw_accel); + +} +void RawAccel::extract(Serializer& serializer) +{ + serializer.extract(raw_accel); + +} + +void RawGyro::insert(Serializer& serializer) const +{ + serializer.insert(raw_gyro); + +} +void RawGyro::extract(Serializer& serializer) +{ + serializer.extract(raw_gyro); + +} + +void RawMag::insert(Serializer& serializer) const +{ + serializer.insert(raw_mag); + +} +void RawMag::extract(Serializer& serializer) +{ + serializer.extract(raw_mag); + +} + +void RawPressure::insert(Serializer& serializer) const +{ + serializer.insert(raw_pressure); + +} +void RawPressure::extract(Serializer& serializer) +{ + serializer.extract(raw_pressure); + +} + +void ScaledAccel::insert(Serializer& serializer) const +{ + serializer.insert(scaled_accel); + +} +void ScaledAccel::extract(Serializer& serializer) +{ + serializer.extract(scaled_accel); + +} + +void ScaledGyro::insert(Serializer& serializer) const +{ + serializer.insert(scaled_gyro); + +} +void ScaledGyro::extract(Serializer& serializer) +{ + serializer.extract(scaled_gyro); + +} + +void ScaledMag::insert(Serializer& serializer) const +{ + serializer.insert(scaled_mag); + +} +void ScaledMag::extract(Serializer& serializer) +{ + serializer.extract(scaled_mag); + +} + +void ScaledPressure::insert(Serializer& serializer) const +{ + serializer.insert(scaled_pressure); + +} +void ScaledPressure::extract(Serializer& serializer) +{ + serializer.extract(scaled_pressure); + +} + +void DeltaTheta::insert(Serializer& serializer) const +{ + serializer.insert(delta_theta); + +} +void DeltaTheta::extract(Serializer& serializer) +{ + serializer.extract(delta_theta); + +} + +void DeltaVelocity::insert(Serializer& serializer) const +{ + serializer.insert(delta_velocity); + +} +void DeltaVelocity::extract(Serializer& serializer) +{ + serializer.extract(delta_velocity); + +} + +void CompOrientationMatrix::insert(Serializer& serializer) const +{ + serializer.insert(m); + +} +void CompOrientationMatrix::extract(Serializer& serializer) +{ + serializer.extract(m); + +} + +void CompQuaternion::insert(Serializer& serializer) const +{ + serializer.insert(q); + +} +void CompQuaternion::extract(Serializer& serializer) +{ + serializer.extract(q); + +} + +void CompEulerAngles::insert(Serializer& serializer) const +{ + serializer.insert(roll); + + serializer.insert(pitch); + + serializer.insert(yaw); + +} +void CompEulerAngles::extract(Serializer& serializer) +{ + serializer.extract(roll); + + serializer.extract(pitch); + + serializer.extract(yaw); + +} + +void CompOrientationUpdateMatrix::insert(Serializer& serializer) const +{ + serializer.insert(m); + +} +void CompOrientationUpdateMatrix::extract(Serializer& serializer) +{ + serializer.extract(m); + +} + +void OrientationRawTemp::insert(Serializer& serializer) const +{ + for(unsigned int i=0; i < 4; i++) + serializer.insert(raw_temp[i]); + +} +void OrientationRawTemp::extract(Serializer& serializer) +{ + for(unsigned int i=0; i < 4; i++) + serializer.extract(raw_temp[i]); + +} + +void InternalTimestamp::insert(Serializer& serializer) const +{ + serializer.insert(counts); + +} +void InternalTimestamp::extract(Serializer& serializer) +{ + serializer.extract(counts); + +} + +void PpsTimestamp::insert(Serializer& serializer) const +{ + serializer.insert(seconds); + + serializer.insert(useconds); + +} +void PpsTimestamp::extract(Serializer& serializer) +{ + serializer.extract(seconds); + + serializer.extract(useconds); + +} + +void GpsTimestamp::insert(Serializer& serializer) const +{ + serializer.insert(tow); + + serializer.insert(week_number); + + serializer.insert(valid_flags); + +} +void GpsTimestamp::extract(Serializer& serializer) +{ + serializer.extract(tow); + + serializer.extract(week_number); + + serializer.extract(valid_flags); + +} + +void TemperatureAbs::insert(Serializer& serializer) const +{ + serializer.insert(min_temp); + + serializer.insert(max_temp); + + serializer.insert(mean_temp); + +} +void TemperatureAbs::extract(Serializer& serializer) +{ + serializer.extract(min_temp); + + serializer.extract(max_temp); + + serializer.extract(mean_temp); + +} + +void UpVector::insert(Serializer& serializer) const +{ + serializer.insert(up); + +} +void UpVector::extract(Serializer& serializer) +{ + serializer.extract(up); + +} + +void NorthVector::insert(Serializer& serializer) const +{ + serializer.insert(north); + +} +void NorthVector::extract(Serializer& serializer) +{ + serializer.extract(north); + +} + +void OverrangeStatus::insert(Serializer& serializer) const +{ + serializer.insert(status); + +} +void OverrangeStatus::extract(Serializer& serializer) +{ + serializer.extract(status); + +} + +void OdometerData::insert(Serializer& serializer) const +{ + serializer.insert(speed); + + serializer.insert(uncertainty); + + serializer.insert(valid_flags); + +} +void OdometerData::extract(Serializer& serializer) +{ + serializer.extract(speed); + + serializer.extract(uncertainty); + + serializer.extract(valid_flags); + +} + + +} // namespace data_sensor +} // namespace mip + diff --git a/src/mip/definitions/data_sensor.hpp b/src/cpp/mip/definitions/data_sensor.hpp similarity index 75% rename from src/mip/definitions/data_sensor.hpp rename to src/cpp/mip/definitions/data_sensor.hpp index dde268718..bacb1c96b 100644 --- a/src/mip/definitions/data_sensor.hpp +++ b/src/cpp/mip/definitions/data_sensor.hpp @@ -1,16 +1,14 @@ #pragma once -#include "common.h" -#include "descriptors.h" -#include "../mip_result.h" +#include +#include +#include +#include #include #include -#include namespace mip { -class Serializer; - namespace C { struct mip_interface; } // namespace C @@ -18,9 +16,9 @@ struct mip_interface; namespace data_sensor { //////////////////////////////////////////////////////////////////////////////// -///@addtogroup MipData_cpp MIP Data [CPP] +///@addtogroup MipData_cpp ///@{ -///@defgroup sensor_data_cpp Sensor Data [CPP] +///@defgroup sensor_data_cpp Sensor Data /// ///@{ @@ -71,7 +69,7 @@ enum //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_sensor_raw_accel (0x80,0x01) Raw Accel [CPP] +///@defgroup sensor_raw_accel_cpp (0x80,0x01) Raw Accel /// Three element vector representing the sensed acceleration. /// This quantity is temperature compensated and expressed in the sensor body frame. /// @@ -79,33 +77,37 @@ enum struct RawAccel { + /// Parameters Vector3f raw_accel; ///< Native sensor counts + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_sensor::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_sensor::DATA_ACCEL_RAW; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "RawAccel"; static constexpr const char* DOC_NAME = "RawAccel"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(raw_accel[0],raw_accel[1],raw_accel[2]); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(raw_accel[0]),std::ref(raw_accel[1]),std::ref(raw_accel[2])); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const RawAccel& self); -void extract(Serializer& serializer, RawAccel& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_sensor_raw_gyro (0x80,0x02) Raw Gyro [CPP] +///@defgroup sensor_raw_gyro_cpp (0x80,0x02) Raw Gyro /// Three element vector representing the sensed angular rate. /// This quantity is temperature compensated and expressed in the sensor body frame. /// @@ -113,33 +115,37 @@ void extract(Serializer& serializer, RawAccel& self); struct RawGyro { + /// Parameters Vector3f raw_gyro; ///< Native sensor counts + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_sensor::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_sensor::DATA_GYRO_RAW; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "RawGyro"; static constexpr const char* DOC_NAME = "RawGyro"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(raw_gyro[0],raw_gyro[1],raw_gyro[2]); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(raw_gyro[0]),std::ref(raw_gyro[1]),std::ref(raw_gyro[2])); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const RawGyro& self); -void extract(Serializer& serializer, RawGyro& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_sensor_raw_mag (0x80,0x03) Raw Mag [CPP] +///@defgroup sensor_raw_mag_cpp (0x80,0x03) Raw Mag /// Three element vector representing the sensed magnetic field. /// This quantity is temperature compensated and expressed in the vehicle frame. /// @@ -147,33 +153,37 @@ void extract(Serializer& serializer, RawGyro& self); struct RawMag { + /// Parameters Vector3f raw_mag; ///< Native sensor counts + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_sensor::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_sensor::DATA_MAG_RAW; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "RawMag"; static constexpr const char* DOC_NAME = "RawMag"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(raw_mag[0],raw_mag[1],raw_mag[2]); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(raw_mag[0]),std::ref(raw_mag[1]),std::ref(raw_mag[2])); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const RawMag& self); -void extract(Serializer& serializer, RawMag& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_sensor_raw_pressure (0x80,0x16) Raw Pressure [CPP] +///@defgroup sensor_raw_pressure_cpp (0x80,0x16) Raw Pressure /// Scalar value representing the sensed ambient pressure. /// This quantity is temperature compensated. /// @@ -181,33 +191,37 @@ void extract(Serializer& serializer, RawMag& self); struct RawPressure { + /// Parameters float raw_pressure = 0; ///< Native sensor counts + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_sensor::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_sensor::DATA_PRESSURE_RAW; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "RawPressure"; static constexpr const char* DOC_NAME = "RawPressure"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(raw_pressure); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(raw_pressure)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const RawPressure& self); -void extract(Serializer& serializer, RawPressure& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_sensor_scaled_accel (0x80,0x04) Scaled Accel [CPP] +///@defgroup sensor_scaled_accel_cpp (0x80,0x04) Scaled Accel /// 3-element vector representing the sensed acceleration. /// This quantity is temperature compensated and expressed in the vehicle frame. /// @@ -215,33 +229,37 @@ void extract(Serializer& serializer, RawPressure& self); struct ScaledAccel { + /// Parameters Vector3f scaled_accel; ///< (x, y, z)[g] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_sensor::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_sensor::DATA_ACCEL_SCALED; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ScaledAccel"; static constexpr const char* DOC_NAME = "ScaledAccel"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(scaled_accel[0],scaled_accel[1],scaled_accel[2]); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(scaled_accel[0]),std::ref(scaled_accel[1]),std::ref(scaled_accel[2])); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const ScaledAccel& self); -void extract(Serializer& serializer, ScaledAccel& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_sensor_scaled_gyro (0x80,0x05) Scaled Gyro [CPP] +///@defgroup sensor_scaled_gyro_cpp (0x80,0x05) Scaled Gyro /// 3-element vector representing the sensed angular rate. /// This quantity is temperature compensated and expressed in the vehicle frame. /// @@ -249,33 +267,37 @@ void extract(Serializer& serializer, ScaledAccel& self); struct ScaledGyro { + /// Parameters Vector3f scaled_gyro; ///< (x, y, z) [radians/second] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_sensor::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_sensor::DATA_GYRO_SCALED; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ScaledGyro"; static constexpr const char* DOC_NAME = "ScaledGyro"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(scaled_gyro[0],scaled_gyro[1],scaled_gyro[2]); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(scaled_gyro[0]),std::ref(scaled_gyro[1]),std::ref(scaled_gyro[2])); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const ScaledGyro& self); -void extract(Serializer& serializer, ScaledGyro& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_sensor_scaled_mag (0x80,0x06) Scaled Mag [CPP] +///@defgroup sensor_scaled_mag_cpp (0x80,0x06) Scaled Mag /// 3-element vector representing the sensed magnetic field. /// This quantity is temperature compensated and expressed in the vehicle frame. /// @@ -283,66 +305,74 @@ void extract(Serializer& serializer, ScaledGyro& self); struct ScaledMag { + /// Parameters Vector3f scaled_mag; ///< (x, y, z) [Gauss] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_sensor::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_sensor::DATA_MAG_SCALED; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ScaledMag"; static constexpr const char* DOC_NAME = "ScaledMag"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(scaled_mag[0],scaled_mag[1],scaled_mag[2]); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(scaled_mag[0]),std::ref(scaled_mag[1]),std::ref(scaled_mag[2])); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const ScaledMag& self); -void extract(Serializer& serializer, ScaledMag& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_sensor_scaled_pressure (0x80,0x17) Scaled Pressure [CPP] +///@defgroup sensor_scaled_pressure_cpp (0x80,0x17) Scaled Pressure /// Scalar value representing the sensed ambient pressure. /// ///@{ struct ScaledPressure { + /// Parameters float scaled_pressure = 0; ///< [mBar] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_sensor::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_sensor::DATA_PRESSURE_SCALED; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ScaledPressure"; static constexpr const char* DOC_NAME = "ScaledPressure"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(scaled_pressure); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(scaled_pressure)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const ScaledPressure& self); -void extract(Serializer& serializer, ScaledPressure& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_sensor_delta_theta (0x80,0x07) Delta Theta [CPP] +///@defgroup sensor_delta_theta_cpp (0x80,0x07) Delta Theta /// 3-element vector representing the time integral of angular rate. /// This quantity is the integral of sensed angular rate over the period set by the IMU message format. It is expressed in the vehicle frame. /// @@ -350,33 +380,37 @@ void extract(Serializer& serializer, ScaledPressure& self); struct DeltaTheta { + /// Parameters Vector3f delta_theta; ///< (x, y, z) [radians] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_sensor::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_sensor::DATA_DELTA_THETA; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "DeltaTheta"; static constexpr const char* DOC_NAME = "DeltaTheta"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(delta_theta[0],delta_theta[1],delta_theta[2]); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(delta_theta[0]),std::ref(delta_theta[1]),std::ref(delta_theta[2])); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const DeltaTheta& self); -void extract(Serializer& serializer, DeltaTheta& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_sensor_delta_velocity (0x80,0x08) Delta Velocity [CPP] +///@defgroup sensor_delta_velocity_cpp (0x80,0x08) Delta Velocity /// 3-element vector representing the time integral of acceleration. /// This quantity is the integral of sensed acceleration over the period set by the IMU message format. It is expressed in the vehicle frame. /// @@ -384,33 +418,37 @@ void extract(Serializer& serializer, DeltaTheta& self); struct DeltaVelocity { + /// Parameters Vector3f delta_velocity; ///< (x, y, z) [g*sec] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_sensor::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_sensor::DATA_DELTA_VELOCITY; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "DeltaVelocity"; static constexpr const char* DOC_NAME = "DeltaVelocity"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(delta_velocity[0],delta_velocity[1],delta_velocity[2]); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(delta_velocity[0]),std::ref(delta_velocity[1]),std::ref(delta_velocity[2])); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const DeltaVelocity& self); -void extract(Serializer& serializer, DeltaVelocity& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_sensor_comp_orientation_matrix (0x80,0x09) Comp Orientation Matrix [CPP] +///@defgroup sensor_comp_orientation_matrix_cpp (0x80,0x09) Comp Orientation Matrix /// 3x3 Direction Cosine Matrix EQSTART M_{ned}^{veh} EQEND describing the orientation of the device with respect to the NED local-level frame. /// This matrix satisfies the following relationship: /// @@ -421,39 +459,43 @@ void extract(Serializer& serializer, DeltaVelocity& self); /// EQSTART v^{ned} EQEND is a 3-element vector expressed in the NED frame.
/// EQSTART v^{veh} EQEND is the same 3-element vector expressed in the vehicle frame.
///
-/// The matrix elements are stored is row-major order: EQSTART M = \begin{bmatrix} M_{11}, M_{12}, M_{13}, M_{21}, M_{22}, M_{23}, M_{31}, M_{32}, M_{33} \end{bmatrix} EQEND +/// The matrix elements are stored is row-major order: EQSTART M = \\begin{bmatrix} M_{11}, M_{12}, M_{13}, M_{21}, M_{22}, M_{23}, M_{31}, M_{32}, M_{33} \\end{bmatrix} EQEND /// ///@{ struct CompOrientationMatrix { + /// Parameters Matrix3f m; ///< Matrix elements in row-major order. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_sensor::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_sensor::DATA_COMP_ORIENTATION_MATRIX; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "CompOrientationMatrix"; static constexpr const char* DOC_NAME = "Complementary Filter Orientation Matrix"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(m[0],m[1],m[2],m[3],m[4],m[5],m[6],m[7],m[8]); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(m[0]),std::ref(m[1]),std::ref(m[2]),std::ref(m[3]),std::ref(m[4]),std::ref(m[5]),std::ref(m[6]),std::ref(m[7]),std::ref(m[8])); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const CompOrientationMatrix& self); -void extract(Serializer& serializer, CompOrientationMatrix& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_sensor_comp_quaternion (0x80,0x0A) Comp Quaternion [CPP] +///@defgroup sensor_comp_quaternion_cpp (0x80,0x0A) Comp Quaternion /// 4x1 vector representation of the quaternion describing the orientation of the device with respect to the NED local-level frame. /// This quaternion satisfies the following relationship: /// @@ -468,33 +510,37 @@ void extract(Serializer& serializer, CompOrientationMatrix& self); struct CompQuaternion { + /// Parameters Quatf q; ///< Quaternion elements EQSTART q = (q_w, q_x, q_y, q_z) EQEND + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_sensor::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_sensor::DATA_COMP_QUATERNION; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "CompQuaternion"; static constexpr const char* DOC_NAME = "Complementary Filter Quaternion"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(q[0],q[1],q[2],q[3]); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(q[0]),std::ref(q[1]),std::ref(q[2]),std::ref(q[3])); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const CompQuaternion& self); -void extract(Serializer& serializer, CompQuaternion& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_sensor_comp_euler_angles (0x80,0x0C) Comp Euler Angles [CPP] +///@defgroup sensor_comp_euler_angles_cpp (0x80,0x0C) Comp Euler Angles /// Euler angles describing the orientation of the device with respect to the NED local-level frame. /// The Euler angles are reported in 3-2-1 (Yaw-Pitch-Roll, AKA Aircraft) order. /// @@ -502,168 +548,188 @@ void extract(Serializer& serializer, CompQuaternion& self); struct CompEulerAngles { + /// Parameters float roll = 0; ///< [radians] float pitch = 0; ///< [radians] float yaw = 0; ///< [radians] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_sensor::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_sensor::DATA_COMP_EULER_ANGLES; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "CompEulerAngles"; static constexpr const char* DOC_NAME = "Complementary Filter Euler Angles"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(roll,pitch,yaw); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(roll),std::ref(pitch),std::ref(yaw)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const CompEulerAngles& self); -void extract(Serializer& serializer, CompEulerAngles& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_sensor_comp_orientation_update_matrix (0x80,0x0B) Comp Orientation Update Matrix [CPP] +///@defgroup sensor_comp_orientation_update_matrix_cpp (0x80,0x0B) Comp Orientation Update Matrix /// DEPRECATED! /// ///@{ struct CompOrientationUpdateMatrix { + /// Parameters Matrix3f m; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_sensor::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_sensor::DATA_COMP_ORIENTATION_UPDATE_MATRIX; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "CompOrientationUpdateMatrix"; static constexpr const char* DOC_NAME = "Complementary Filter Orientation Update Matrix"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(m[0],m[1],m[2],m[3],m[4],m[5],m[6],m[7],m[8]); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(m[0]),std::ref(m[1]),std::ref(m[2]),std::ref(m[3]),std::ref(m[4]),std::ref(m[5]),std::ref(m[6]),std::ref(m[7]),std::ref(m[8])); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const CompOrientationUpdateMatrix& self); -void extract(Serializer& serializer, CompOrientationUpdateMatrix& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_sensor_orientation_raw_temp (0x80,0x0D) Orientation Raw Temp [CPP] +///@defgroup sensor_orientation_raw_temp_cpp (0x80,0x0D) Orientation Raw Temp /// DEPRECATED! /// ///@{ struct OrientationRawTemp { + /// Parameters uint16_t raw_temp[4] = {0}; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_sensor::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_sensor::DATA_TEMPERATURE_RAW; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "OrientationRawTemp"; static constexpr const char* DOC_NAME = "OrientationRawTemp"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(raw_temp); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(raw_temp)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const OrientationRawTemp& self); -void extract(Serializer& serializer, OrientationRawTemp& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_sensor_internal_timestamp (0x80,0x0E) Internal Timestamp [CPP] +///@defgroup sensor_internal_timestamp_cpp (0x80,0x0E) Internal Timestamp /// DEPRECATED! /// ///@{ struct InternalTimestamp { + /// Parameters uint32_t counts = 0; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_sensor::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_sensor::DATA_TIME_STAMP_INTERNAL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "InternalTimestamp"; static constexpr const char* DOC_NAME = "InternalTimestamp"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(counts); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(counts)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const InternalTimestamp& self); -void extract(Serializer& serializer, InternalTimestamp& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_sensor_pps_timestamp (0x80,0x0F) Pps Timestamp [CPP] +///@defgroup sensor_pps_timestamp_cpp (0x80,0x0F) Pps Timestamp /// DEPRECATED! /// ///@{ struct PpsTimestamp { + /// Parameters uint32_t seconds = 0; uint32_t useconds = 0; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_sensor::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_sensor::DATA_TIME_STAMP_PPS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "PpsTimestamp"; static constexpr const char* DOC_NAME = "PPS Timestamp"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(seconds,useconds); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(seconds),std::ref(useconds)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const PpsTimestamp& self); -void extract(Serializer& serializer, PpsTimestamp& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_sensor_gps_timestamp (0x80,0x12) Gps Timestamp [CPP] +///@defgroup sensor_gps_timestamp_cpp (0x80,0x12) Gps Timestamp /// GPS timestamp of the SENSOR data /// /// Should the PPS become unavailable, the device will revert to its internal clock, which will cause the reported time to drift from true GPS time. @@ -678,6 +744,7 @@ struct GpsTimestamp { struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -699,49 +766,51 @@ struct GpsTimestamp ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool ppsValid() const { return (value & PPS_VALID) > 0; } - void ppsValid(bool val) { if(val) value |= PPS_VALID; else value &= ~PPS_VALID; } + void ppsValid(bool val) { value &= ~PPS_VALID; if(val) value |= PPS_VALID; } bool timeRefresh() const { return (value & TIME_REFRESH) > 0; } - void timeRefresh(bool val) { if(val) value |= TIME_REFRESH; else value &= ~TIME_REFRESH; } + void timeRefresh(bool val) { value &= ~TIME_REFRESH; if(val) value |= TIME_REFRESH; } bool timeInitialized() const { return (value & TIME_INITIALIZED) > 0; } - void timeInitialized(bool val) { if(val) value |= TIME_INITIALIZED; else value &= ~TIME_INITIALIZED; } + void timeInitialized(bool val) { value &= ~TIME_INITIALIZED; if(val) value |= TIME_INITIALIZED; } bool towValid() const { return (value & TOW_VALID) > 0; } - void towValid(bool val) { if(val) value |= TOW_VALID; else value &= ~TOW_VALID; } + void towValid(bool val) { value &= ~TOW_VALID; if(val) value |= TOW_VALID; } bool weekNumberValid() const { return (value & WEEK_NUMBER_VALID) > 0; } - void weekNumberValid(bool val) { if(val) value |= WEEK_NUMBER_VALID; else value &= ~WEEK_NUMBER_VALID; } - + void weekNumberValid(bool val) { value &= ~WEEK_NUMBER_VALID; if(val) value |= WEEK_NUMBER_VALID; } bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters double tow = 0; ///< GPS Time of Week [seconds] uint16_t week_number = 0; ///< GPS Week Number since 1980 [weeks] ValidFlags valid_flags; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_sensor::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_sensor::DATA_TIME_STAMP_GPS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GpsTimestamp"; static constexpr const char* DOC_NAME = "GpsTimestamp"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(tow,week_number,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(tow),std::ref(week_number),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const GpsTimestamp& self); -void extract(Serializer& serializer, GpsTimestamp& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_sensor_temperature_abs (0x80,0x14) Temperature Abs [CPP] +///@defgroup sensor_temperature_abs_cpp (0x80,0x14) Temperature Abs /// SENSOR reported temperature statistics /// /// Temperature may originate from the MEMS sensors, or be calculated in combination with board temperature sensors. @@ -752,35 +821,39 @@ void extract(Serializer& serializer, GpsTimestamp& self); struct TemperatureAbs { + /// Parameters float min_temp = 0; ///< [degC] float max_temp = 0; ///< [degC] float mean_temp = 0; ///< [degC] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_sensor::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_sensor::DATA_TEMPERATURE_ABS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "TemperatureAbs"; static constexpr const char* DOC_NAME = "Temperature Statistics"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(min_temp,max_temp,mean_temp); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(min_temp),std::ref(max_temp),std::ref(mean_temp)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const TemperatureAbs& self); -void extract(Serializer& serializer, TemperatureAbs& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_sensor_up_vector (0x80,0x11) Up Vector [CPP] +///@defgroup sensor_up_vector_cpp (0x80,0x11) Up Vector /// Gyro-stabilized 3-element vector representing the complementary filter's estimated vertical direction. /// This quantity is expressed in the vehicle frame. /// @@ -793,33 +866,37 @@ void extract(Serializer& serializer, TemperatureAbs& self); struct UpVector { + /// Parameters Vector3f up; ///< [Gs] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_sensor::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_sensor::DATA_STAB_ACCEL; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "UpVector"; static constexpr const char* DOC_NAME = "UpVector"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(up[0],up[1],up[2]); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(up[0]),std::ref(up[1]),std::ref(up[2])); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const UpVector& self); -void extract(Serializer& serializer, UpVector& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_sensor_north_vector (0x80,0x10) North Vector [CPP] +///@defgroup sensor_north_vector_cpp (0x80,0x10) North Vector /// Gyro-stabilized 3-element vector representing the complementary filter's estimate of magnetic north. /// This quantity is expressed in the vehicle frame. /// @@ -829,33 +906,37 @@ void extract(Serializer& serializer, UpVector& self); struct NorthVector { + /// Parameters Vector3f north; ///< [Gauss] + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_sensor::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_sensor::DATA_STAB_MAG; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "NorthVector"; static constexpr const char* DOC_NAME = "NorthVector"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(north[0],north[1],north[2]); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(north[0]),std::ref(north[1]),std::ref(north[2])); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const NorthVector& self); -void extract(Serializer& serializer, NorthVector& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_sensor_overrange_status (0x80,0x18) Overrange Status [CPP] +///@defgroup sensor_overrange_status_cpp (0x80,0x18) Overrange Status /// ///@{ @@ -863,6 +944,7 @@ struct OverrangeStatus { struct Status : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -889,86 +971,92 @@ struct OverrangeStatus Status& operator&=(uint16_t val) { return *this = value & val; } bool accelX() const { return (value & ACCEL_X) > 0; } - void accelX(bool val) { if(val) value |= ACCEL_X; else value &= ~ACCEL_X; } + void accelX(bool val) { value &= ~ACCEL_X; if(val) value |= ACCEL_X; } bool accelY() const { return (value & ACCEL_Y) > 0; } - void accelY(bool val) { if(val) value |= ACCEL_Y; else value &= ~ACCEL_Y; } + void accelY(bool val) { value &= ~ACCEL_Y; if(val) value |= ACCEL_Y; } bool accelZ() const { return (value & ACCEL_Z) > 0; } - void accelZ(bool val) { if(val) value |= ACCEL_Z; else value &= ~ACCEL_Z; } + void accelZ(bool val) { value &= ~ACCEL_Z; if(val) value |= ACCEL_Z; } bool gyroX() const { return (value & GYRO_X) > 0; } - void gyroX(bool val) { if(val) value |= GYRO_X; else value &= ~GYRO_X; } + void gyroX(bool val) { value &= ~GYRO_X; if(val) value |= GYRO_X; } bool gyroY() const { return (value & GYRO_Y) > 0; } - void gyroY(bool val) { if(val) value |= GYRO_Y; else value &= ~GYRO_Y; } + void gyroY(bool val) { value &= ~GYRO_Y; if(val) value |= GYRO_Y; } bool gyroZ() const { return (value & GYRO_Z) > 0; } - void gyroZ(bool val) { if(val) value |= GYRO_Z; else value &= ~GYRO_Z; } + void gyroZ(bool val) { value &= ~GYRO_Z; if(val) value |= GYRO_Z; } bool magX() const { return (value & MAG_X) > 0; } - void magX(bool val) { if(val) value |= MAG_X; else value &= ~MAG_X; } + void magX(bool val) { value &= ~MAG_X; if(val) value |= MAG_X; } bool magY() const { return (value & MAG_Y) > 0; } - void magY(bool val) { if(val) value |= MAG_Y; else value &= ~MAG_Y; } + void magY(bool val) { value &= ~MAG_Y; if(val) value |= MAG_Y; } bool magZ() const { return (value & MAG_Z) > 0; } - void magZ(bool val) { if(val) value |= MAG_Z; else value &= ~MAG_Z; } + void magZ(bool val) { value &= ~MAG_Z; if(val) value |= MAG_Z; } bool press() const { return (value & PRESS) > 0; } - void press(bool val) { if(val) value |= PRESS; else value &= ~PRESS; } - + void press(bool val) { value &= ~PRESS; if(val) value |= PRESS; } bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters Status status; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_sensor::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_sensor::DATA_OVERRANGE_STATUS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "OverrangeStatus"; static constexpr const char* DOC_NAME = "OverrangeStatus"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(status); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(status)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const OverrangeStatus& self); -void extract(Serializer& serializer, OverrangeStatus& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_sensor_odometer_data (0x80,0x40) Odometer Data [CPP] +///@defgroup sensor_odometer_data_cpp (0x80,0x40) Odometer Data /// ///@{ struct OdometerData { + /// Parameters float speed = 0; ///< Average speed over the time interval [m/s]. Can be negative for quadrature encoders. float uncertainty = 0; ///< Uncertainty of velocity [m/s]. uint16_t valid_flags = 0; ///< If odometer is configured, bit 0 will be set to 1. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_sensor::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_sensor::DATA_ODOMETER; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "OdometerData"; static constexpr const char* DOC_NAME = "OdometerData"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(speed,uncertainty,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(speed),std::ref(uncertainty),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const OdometerData& self); -void extract(Serializer& serializer, OdometerData& self); - ///@} /// diff --git a/src/cpp/mip/definitions/data_shared.cpp b/src/cpp/mip/definitions/data_shared.cpp new file mode 100644 index 000000000..f1661e76e --- /dev/null +++ b/src/cpp/mip/definitions/data_shared.cpp @@ -0,0 +1,141 @@ + +#include "data_shared.hpp" + +#include +#include + +#include + + +namespace mip { +namespace C { +struct mip_interface; +} // namespace C + +namespace data_shared { + +using namespace ::mip::C; + +//////////////////////////////////////////////////////////////////////////////// +// Mip Fields +//////////////////////////////////////////////////////////////////////////////// + +void EventSource::insert(Serializer& serializer) const +{ + serializer.insert(trigger_id); + +} +void EventSource::extract(Serializer& serializer) +{ + serializer.extract(trigger_id); + +} + +void Ticks::insert(Serializer& serializer) const +{ + serializer.insert(ticks); + +} +void Ticks::extract(Serializer& serializer) +{ + serializer.extract(ticks); + +} + +void DeltaTicks::insert(Serializer& serializer) const +{ + serializer.insert(ticks); + +} +void DeltaTicks::extract(Serializer& serializer) +{ + serializer.extract(ticks); + +} + +void GpsTimestamp::insert(Serializer& serializer) const +{ + serializer.insert(tow); + + serializer.insert(week_number); + + serializer.insert(valid_flags); + +} +void GpsTimestamp::extract(Serializer& serializer) +{ + serializer.extract(tow); + + serializer.extract(week_number); + + serializer.extract(valid_flags); + +} + +void DeltaTime::insert(Serializer& serializer) const +{ + serializer.insert(seconds); + +} +void DeltaTime::extract(Serializer& serializer) +{ + serializer.extract(seconds); + +} + +void ReferenceTimestamp::insert(Serializer& serializer) const +{ + serializer.insert(nanoseconds); + +} +void ReferenceTimestamp::extract(Serializer& serializer) +{ + serializer.extract(nanoseconds); + +} + +void ReferenceTimeDelta::insert(Serializer& serializer) const +{ + serializer.insert(dt_nanos); + +} +void ReferenceTimeDelta::extract(Serializer& serializer) +{ + serializer.extract(dt_nanos); + +} + +void ExternalTimestamp::insert(Serializer& serializer) const +{ + serializer.insert(nanoseconds); + + serializer.insert(valid_flags); + +} +void ExternalTimestamp::extract(Serializer& serializer) +{ + serializer.extract(nanoseconds); + + serializer.extract(valid_flags); + +} + +void ExternalTimeDelta::insert(Serializer& serializer) const +{ + serializer.insert(dt_nanos); + + serializer.insert(valid_flags); + +} +void ExternalTimeDelta::extract(Serializer& serializer) +{ + serializer.extract(dt_nanos); + + serializer.extract(valid_flags); + +} + + +} // namespace data_shared +} // namespace mip + diff --git a/src/mip/definitions/data_shared.hpp b/src/cpp/mip/definitions/data_shared.hpp similarity index 80% rename from src/mip/definitions/data_shared.hpp rename to src/cpp/mip/definitions/data_shared.hpp index 05df1eddf..5208a4122 100644 --- a/src/mip/definitions/data_shared.hpp +++ b/src/cpp/mip/definitions/data_shared.hpp @@ -1,16 +1,14 @@ #pragma once -#include "common.h" -#include "descriptors.h" -#include "../mip_result.h" +#include +#include +#include +#include #include #include -#include namespace mip { -class Serializer; - namespace C { struct mip_interface; } // namespace C @@ -18,9 +16,9 @@ struct mip_interface; namespace data_shared { //////////////////////////////////////////////////////////////////////////////// -///@addtogroup MipData_cpp MIP Data [CPP] +///@addtogroup MipData_cpp ///@{ -///@defgroup shared_data_cpp Shared Data [CPP] +///@defgroup shared_data_cpp Shared Data /// ///@{ @@ -56,7 +54,7 @@ static constexpr const uint8_t MIP_DATA_DESC_SHARED_START = 0xD0; //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_shared_event_source (0xFF,0xD0) Event Source [CPP] +///@defgroup shared_event_source_cpp (0xFF,0xD0) Event Source /// Identifies which event trigger caused this packet to be emitted. /// /// Generally this is used to determine whether a packet was emitted @@ -66,33 +64,37 @@ static constexpr const uint8_t MIP_DATA_DESC_SHARED_START = 0xD0; struct EventSource { + /// Parameters uint8_t trigger_id = 0; ///< Trigger ID number. If 0, this message was emitted due to being scheduled in the 3DM Message Format Command (0x0C,0x0F). + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_shared::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_shared::DATA_EVENT_SOURCE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "EventSource"; static constexpr const char* DOC_NAME = "EventSource"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(trigger_id); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(trigger_id)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const EventSource& self); -void extract(Serializer& serializer, EventSource& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_shared_ticks (0xFF,0xD1) Ticks [CPP] +///@defgroup shared_ticks_cpp (0xFF,0xD1) Ticks /// Time since powerup in multiples of the base rate. /// /// The counter will wrap around to 0 after approximately 50 days. @@ -102,33 +104,37 @@ void extract(Serializer& serializer, EventSource& self); struct Ticks { + /// Parameters uint32_t ticks = 0; ///< Ticks since powerup. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_shared::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_shared::DATA_TICKS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "Ticks"; static constexpr const char* DOC_NAME = "Ticks"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(ticks); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(ticks)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const Ticks& self); -void extract(Serializer& serializer, Ticks& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_shared_delta_ticks (0xFF,0xD2) Delta Ticks [CPP] +///@defgroup shared_delta_ticks_cpp (0xFF,0xD2) Delta Ticks /// Ticks since the last output of this field. /// /// This field can be used to track the amount of time passed between @@ -139,33 +145,37 @@ void extract(Serializer& serializer, Ticks& self); struct DeltaTicks { + /// Parameters uint32_t ticks = 0; ///< Ticks since last output. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_shared::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_shared::DATA_DELTA_TICKS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "DeltaTicks"; static constexpr const char* DOC_NAME = "DeltaTicks"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(ticks); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(ticks)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const DeltaTicks& self); -void extract(Serializer& serializer, DeltaTicks& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_shared_gps_timestamp (0xFF,0xD3) Gps Timestamp [CPP] +///@defgroup shared_gps_timestamp_cpp (0xFF,0xD3) Gps Timestamp /// Outputs the current GPS system time in time-of-week and week number format. /// /// For events, this is the time of the event trigger. @@ -177,6 +187,7 @@ struct GpsTimestamp { struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -196,45 +207,47 @@ struct GpsTimestamp ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool tow() const { return (value & TOW) > 0; } - void tow(bool val) { if(val) value |= TOW; else value &= ~TOW; } + void tow(bool val) { value &= ~TOW; if(val) value |= TOW; } bool weekNumber() const { return (value & WEEK_NUMBER) > 0; } - void weekNumber(bool val) { if(val) value |= WEEK_NUMBER; else value &= ~WEEK_NUMBER; } + void weekNumber(bool val) { value &= ~WEEK_NUMBER; if(val) value |= WEEK_NUMBER; } uint16_t timeValid() const { return (value & TIME_VALID) >> 0; } void timeValid(uint16_t val) { value = (value & ~TIME_VALID) | (val << 0); } - bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters double tow = 0; ///< GPS Time of Week [seconds] uint16_t week_number = 0; ///< GPS Week Number since 1980 [weeks] ValidFlags valid_flags; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_shared::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_shared::DATA_GPS_TIME; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GpsTimestamp"; static constexpr const char* DOC_NAME = "GpsTimestamp"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(tow,week_number,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(tow),std::ref(week_number),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const GpsTimestamp& self); -void extract(Serializer& serializer, GpsTimestamp& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_shared_delta_time (0xFF,0xD4) Delta Time [CPP] +///@defgroup shared_delta_time_cpp (0xFF,0xD4) Delta Time /// Time in the synchronized clock domain since the last output of this field within the same descriptor set and event instance. /// /// This can be used to track the amount of time passed between @@ -250,33 +263,37 @@ void extract(Serializer& serializer, GpsTimestamp& self); struct DeltaTime { + /// Parameters double seconds = 0; ///< Seconds since last output. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_shared::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_shared::DATA_DELTA_TIME; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "DeltaTime"; static constexpr const char* DOC_NAME = "DeltaTime"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(seconds); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(seconds)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const DeltaTime& self); -void extract(Serializer& serializer, DeltaTime& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_shared_reference_timestamp (0xFF,0xD5) Reference Timestamp [CPP] +///@defgroup shared_reference_timestamp_cpp (0xFF,0xD5) Reference Timestamp /// Internal reference timestamp. /// /// This timestamp represents the time at which the corresponding @@ -290,33 +307,37 @@ void extract(Serializer& serializer, DeltaTime& self); struct ReferenceTimestamp { + /// Parameters uint64_t nanoseconds = 0; ///< Nanoseconds since initialization. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_shared::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_shared::DATA_REFERENCE_TIME; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ReferenceTimestamp"; static constexpr const char* DOC_NAME = "ReferenceTimestamp"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(nanoseconds); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(nanoseconds)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const ReferenceTimestamp& self); -void extract(Serializer& serializer, ReferenceTimestamp& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_shared_reference_time_delta (0xFF,0xD6) Reference Time Delta [CPP] +///@defgroup shared_reference_time_delta_cpp (0xFF,0xD6) Reference Time Delta /// Delta time since the last packet. /// /// Difference between the time as reported by the shared reference time field, 0xD5, @@ -332,33 +353,37 @@ void extract(Serializer& serializer, ReferenceTimestamp& self); struct ReferenceTimeDelta { + /// Parameters uint64_t dt_nanos = 0; ///< Nanoseconds since the last occurrence of this field in a packet of the same descriptor set and event source. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_shared::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_shared::DATA_REF_TIME_DELTA; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ReferenceTimeDelta"; static constexpr const char* DOC_NAME = "ReferenceTimeDelta"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(dt_nanos); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(dt_nanos)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const ReferenceTimeDelta& self); -void extract(Serializer& serializer, ReferenceTimeDelta& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_shared_external_timestamp (0xFF,0xD7) External Timestamp [CPP] +///@defgroup shared_external_timestamp_cpp (0xFF,0xD7) External Timestamp /// External timestamp in nanoseconds. /// /// This timestamp represents the time at which the corresponding @@ -375,6 +400,7 @@ struct ExternalTimestamp { struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -392,40 +418,42 @@ struct ExternalTimestamp ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool nanoseconds() const { return (value & NANOSECONDS) > 0; } - void nanoseconds(bool val) { if(val) value |= NANOSECONDS; else value &= ~NANOSECONDS; } - + void nanoseconds(bool val) { value &= ~NANOSECONDS; if(val) value |= NANOSECONDS; } bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters uint64_t nanoseconds = 0; ValidFlags valid_flags; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_shared::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_shared::DATA_EXTERNAL_TIME; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ExternalTimestamp"; static constexpr const char* DOC_NAME = "ExternalTimestamp"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(nanoseconds,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(nanoseconds),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const ExternalTimestamp& self); -void extract(Serializer& serializer, ExternalTimestamp& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_shared_external_time_delta (0xFF,0xD8) External Time Delta [CPP] +///@defgroup shared_external_time_delta_cpp (0xFF,0xD8) External Time Delta /// Delta time since the last packet containing delta external (0xFF,0xD4) or delta gps time (0xFF,0xD8). /// /// Difference between the time as reported by the shared external time field, 0xD7, @@ -446,6 +474,7 @@ struct ExternalTimeDelta { struct ValidFlags : Bitfield { + typedef uint16_t Type; enum _enumType : uint16_t { NONE = 0x0000, @@ -463,35 +492,37 @@ struct ExternalTimeDelta ValidFlags& operator&=(uint16_t val) { return *this = value & val; } bool dtNanos() const { return (value & DT_NANOS) > 0; } - void dtNanos(bool val) { if(val) value |= DT_NANOS; else value &= ~DT_NANOS; } - + void dtNanos(bool val) { value &= ~DT_NANOS; if(val) value |= DT_NANOS; } bool allSet() const { return value == ALL; } void setAll() { value |= ALL; } }; - + /// Parameters uint64_t dt_nanos = 0; ///< Nanoseconds since the last occurrence of this field in a packet of the same descriptor set and event source. ValidFlags valid_flags; + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_shared::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_shared::DATA_SYS_TIME_DELTA; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "ExternalTimeDelta"; static constexpr const char* DOC_NAME = "ExternalTimeDelta"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(dt_nanos,valid_flags); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(dt_nanos),std::ref(valid_flags)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const ExternalTimeDelta& self); -void extract(Serializer& serializer, ExternalTimeDelta& self); - ///@} /// diff --git a/src/cpp/mip/definitions/data_system.cpp b/src/cpp/mip/definitions/data_system.cpp new file mode 100644 index 000000000..c11c1f4b3 --- /dev/null +++ b/src/cpp/mip/definitions/data_system.cpp @@ -0,0 +1,80 @@ + +#include "data_system.hpp" + +#include +#include + +#include + + +namespace mip { +namespace C { +struct mip_interface; +} // namespace C + +namespace data_system { + +using namespace ::mip::C; + +//////////////////////////////////////////////////////////////////////////////// +// Mip Fields +//////////////////////////////////////////////////////////////////////////////// + +void BuiltInTest::insert(Serializer& serializer) const +{ + for(unsigned int i=0; i < 16; i++) + serializer.insert(result[i]); + +} +void BuiltInTest::extract(Serializer& serializer) +{ + for(unsigned int i=0; i < 16; i++) + serializer.extract(result[i]); + +} + +void TimeSyncStatus::insert(Serializer& serializer) const +{ + serializer.insert(time_sync); + + serializer.insert(last_pps_rcvd); + +} +void TimeSyncStatus::extract(Serializer& serializer) +{ + serializer.extract(time_sync); + + serializer.extract(last_pps_rcvd); + +} + +void GpioState::insert(Serializer& serializer) const +{ + serializer.insert(states); + +} +void GpioState::extract(Serializer& serializer) +{ + serializer.extract(states); + +} + +void GpioAnalogValue::insert(Serializer& serializer) const +{ + serializer.insert(gpio_id); + + serializer.insert(value); + +} +void GpioAnalogValue::extract(Serializer& serializer) +{ + serializer.extract(gpio_id); + + serializer.extract(value); + +} + + +} // namespace data_system +} // namespace mip + diff --git a/src/mip/definitions/data_system.hpp b/src/cpp/mip/definitions/data_system.hpp similarity index 81% rename from src/mip/definitions/data_system.hpp rename to src/cpp/mip/definitions/data_system.hpp index 17170999f..8ddf5d150 100644 --- a/src/mip/definitions/data_system.hpp +++ b/src/cpp/mip/definitions/data_system.hpp @@ -1,16 +1,14 @@ #pragma once -#include "common.h" -#include "descriptors.h" -#include "../mip_result.h" +#include +#include +#include +#include #include #include -#include namespace mip { -class Serializer; - namespace C { struct mip_interface; } // namespace C @@ -18,9 +16,9 @@ struct mip_interface; namespace data_system { //////////////////////////////////////////////////////////////////////////////// -///@addtogroup MipData_cpp MIP Data [CPP] +///@addtogroup MipData_cpp ///@{ -///@defgroup system_data_cpp System Data [CPP] +///@defgroup system_data_cpp System Data /// ///@{ @@ -49,7 +47,7 @@ enum //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_system_built_in_test (0xA0,0x01) Built In Test [CPP] +///@defgroup system_built_in_test_cpp (0xA0,0x01) Built In Test /// Contains the continuous built-in-test (BIT) results. /// /// Due to the large size of this field, it is recommended to stream it at @@ -74,67 +72,75 @@ enum struct BuiltInTest { + /// Parameters uint8_t result[16] = {0}; ///< Device-specific bitfield (128 bits). See device user manual. Bits are least-significant-byte first. For example, bit 0 is located at bit 0 of result[0], bit 1 is located at bit 1 of result[0], bit 8 is located at bit 0 of result[1], and bit 127 is located at bit 7 of result[15]. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_system::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_system::DATA_BUILT_IN_TEST; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "BuiltInTest"; static constexpr const char* DOC_NAME = "BuiltInTest"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(result); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(result)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const BuiltInTest& self); -void extract(Serializer& serializer, BuiltInTest& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_system_time_sync_status (0xA0,0x02) Time Sync Status [CPP] +///@defgroup system_time_sync_status_cpp (0xA0,0x02) Time Sync Status /// Indicates whether a sync has been achieved using the PPS signal. /// ///@{ struct TimeSyncStatus { + /// Parameters bool time_sync = 0; ///< True if sync with the PPS signal is currently valid. False if PPS feature is disabled or a PPS signal is not detected. uint8_t last_pps_rcvd = 0; ///< Elapsed time in seconds since last PPS was received, with a maximum value of 255. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_system::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_system::DATA_TIME_SYNC_STATUS; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "TimeSyncStatus"; static constexpr const char* DOC_NAME = "TimeSyncStatus"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(time_sync,last_pps_rcvd); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(time_sync),std::ref(last_pps_rcvd)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const TimeSyncStatus& self); -void extract(Serializer& serializer, TimeSyncStatus& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_system_gpio_state (0xA0,0x03) Gpio State [CPP] +///@defgroup system_gpio_state_cpp (0xA0,0x03) Gpio State /// Indicates the state of all of the user GPIO pins. /// /// This message can be used to correlate external signals @@ -159,33 +165,37 @@ void extract(Serializer& serializer, TimeSyncStatus& self); struct GpioState { + /// Parameters uint8_t states = 0; ///< Bitfield containing the states for each GPIO pin.
Bit 0 (0x01): pin 1
Bit 1 (0x02): pin 2
Bit 2 (0x04): pin 3
Bit 3 (0x08): pin 4
Bits for pins that don't exist will read as 0. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_system::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_system::DATA_GPIO_STATE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GpioState"; static constexpr const char* DOC_NAME = "GpioState"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(states); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(states)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const GpioState& self); -void extract(Serializer& serializer, GpioState& self); - ///@} /// //////////////////////////////////////////////////////////////////////////////// -///@defgroup cpp_system_gpio_analog_value (0xA0,0x04) Gpio Analog Value [CPP] +///@defgroup system_gpio_analog_value_cpp (0xA0,0x04) Gpio Analog Value /// Indicates the analog value of the given user GPIO. /// The pin must be configured for analog input. /// @@ -193,29 +203,33 @@ void extract(Serializer& serializer, GpioState& self); struct GpioAnalogValue { + /// Parameters uint8_t gpio_id = 0; ///< GPIO pin number starting with 1. float value = 0; ///< Value of the GPIO line in scaled volts. + /// Descriptors static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_system::DESCRIPTOR_SET; static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_system::DATA_GPIO_ANALOG_VALUE; static constexpr const CompositeDescriptor DESCRIPTOR = {DESCRIPTOR_SET, FIELD_DESCRIPTOR}; static constexpr const char* NAME = "GpioAnalogValue"; static constexpr const char* DOC_NAME = "GpioAnalogValue"; + static constexpr const bool HAS_FUNCTION_SELECTOR = false; - - auto as_tuple() const + auto asTuple() const { return std::make_tuple(gpio_id,value); } - auto as_tuple() + auto asTuple() { return std::make_tuple(std::ref(gpio_id),std::ref(value)); } + + /// Serialization + void insert(Serializer& serializer) const; + void extract(Serializer& serializer); + }; -void insert(Serializer& serializer, const GpioAnalogValue& self); -void extract(Serializer& serializer, GpioAnalogValue& self); - ///@} /// diff --git a/src/cpp/mip/extras/CMakeLists.txt b/src/cpp/mip/extras/CMakeLists.txt new file mode 100644 index 000000000..679c89ac1 --- /dev/null +++ b/src/cpp/mip/extras/CMakeLists.txt @@ -0,0 +1,29 @@ +set(MIP_EXTRAS_LIBRARY "mip_extras" CACHE INTERNAL "Name of the MIP extras library") +mark_as_advanced(MIP_EXTRAS_LIBRARY) + +add_library(${MIP_EXTRAS_LIBRARY} + "${CMAKE_CURRENT_LIST_DIR}/composite_result.hpp" + "${CMAKE_CURRENT_LIST_DIR}/descriptor_id.hpp" + "${CMAKE_CURRENT_LIST_DIR}/firmware_version.cpp" + "${CMAKE_CURRENT_LIST_DIR}/firmware_version.hpp" +) + +target_compile_features(${MIP_EXTRAS_LIBRARY} PUBLIC cxx_std_11) + +target_link_libraries(${MIP_EXTRAS_LIBRARY} PUBLIC ${MIP_LIBRARY} ${MICROSTRAIN_EXTRAS_LIBRARY}) + +target_compile_definitions(${MIP_EXTRAS_LIBRARY} + PUBLIC "MIP_ENABLE_EXTRAS=1" + PRIVATE ${MICROSTRAIN_PRIVATE_COMPILE_DEFINITIONS} +) + +target_compile_options(${MIP_EXTRAS_LIBRARY} PRIVATE ${MICROSTRAIN_PRIVATE_COMPILE_OPTIONS}) + +set(MIP_LIBRARIES_TMP ${MIP_LIBRARIES_TMP} ${MIP_EXTRAS_LIBRARY} PARENT_SCOPE) + +# +# Installation +# + +include(microstrain_utilities) +microstrain_setup_library_install(${MIP_EXTRAS_LIBRARY} ${MICROSTRAIN_SRC_DIR}) diff --git a/src/mip/extras/composite_result.hpp b/src/cpp/mip/extras/composite_result.hpp similarity index 94% rename from src/mip/extras/composite_result.hpp rename to src/cpp/mip/extras/composite_result.hpp index 89729a049..26028725f 100644 --- a/src/mip/extras/composite_result.hpp +++ b/src/cpp/mip/extras/composite_result.hpp @@ -2,9 +2,9 @@ #include "descriptor_id.hpp" -#include "../mip_device.hpp" -#include "../mip_result.h" -#include "../definitions/descriptors.h" +#include +#include +#include #include @@ -27,6 +27,9 @@ namespace mip operator bool() const { return result; } bool operator!() const { return !result; } + bool operator==(mip::C::mip_cmd_result value) const { return result == value; } + bool operator!=(mip::C::mip_cmd_result value) const { return result != value; } + Entry(bool r, DescriptorId d={}) : result(r ? CmdResult::ACK_OK : CmdResult::STATUS_ERROR), descriptor(d) {} Entry(CmdResult r, DescriptorId d={}) : result(r), descriptor(d) {} Entry(C::mip_cmd_result r, DescriptorId d={}) : result(r), descriptor(d) {} @@ -120,7 +123,7 @@ namespace mip template - CompositeResult::Entry runCommandEx(DeviceInterface& device, const Cmd& cmd, Args&&... args) + CompositeResult::Entry runCommandEx(Interface& device, const Cmd& cmd, Args&&... args) { CmdResult result = device.runCommand(cmd, std::forward(args)...); diff --git a/src/mip/extras/descriptor_id.hpp b/src/cpp/mip/extras/descriptor_id.hpp similarity index 96% rename from src/mip/extras/descriptor_id.hpp rename to src/cpp/mip/extras/descriptor_id.hpp index 768f97045..ed27eaeea 100644 --- a/src/mip/extras/descriptor_id.hpp +++ b/src/cpp/mip/extras/descriptor_id.hpp @@ -1,8 +1,6 @@ #pragma once -#include "../definitions/descriptors.h" - -#include +#include namespace mip diff --git a/src/mip/extras/version.cpp b/src/cpp/mip/extras/firmware_version.cpp similarity index 98% rename from src/mip/extras/version.cpp rename to src/cpp/mip/extras/firmware_version.cpp index d5b63c57c..f59ef8e3d 100644 --- a/src/mip/extras/version.cpp +++ b/src/cpp/mip/extras/firmware_version.cpp @@ -1,5 +1,5 @@ -#include "version.hpp" +#include "firmware_version.hpp" #include diff --git a/src/mip/extras/version.hpp b/src/cpp/mip/extras/firmware_version.hpp similarity index 100% rename from src/mip/extras/version.hpp rename to src/cpp/mip/extras/firmware_version.hpp diff --git a/src/cpp/mip/extras/mip_extras_all.hpp b/src/cpp/mip/extras/mip_extras_all.hpp new file mode 100644 index 000000000..5f5f73979 --- /dev/null +++ b/src/cpp/mip/extras/mip_extras_all.hpp @@ -0,0 +1,6 @@ +#pragma once + +// MIP Extras Core +#include "composite_result.hpp" +#include "descriptor_id.hpp" +#include "firmware_version.hpp" diff --git a/src/cpp/mip/metadata/CMakeLists.txt b/src/cpp/mip/metadata/CMakeLists.txt new file mode 100644 index 000000000..a24f54e7e --- /dev/null +++ b/src/cpp/mip/metadata/CMakeLists.txt @@ -0,0 +1,46 @@ +set(MIP_METADATA_LIBRARY "mip_metadata" CACHE INTERNAL "Name of the MIP metadata library") +mark_as_advanced(MIP_METADATA_LIBRARY) + +# Get the mipdef list from the C version +get_target_property(MIP_DEFS ${MIP_LIBRARY} definitions) + +set(MIP_DEF_HEADERS ${MIP_DEFS}) +list(TRANSFORM MIP_DEF_HEADERS APPEND ".hpp") +list(TRANSFORM MIP_DEF_HEADERS PREPEND "${CMAKE_CURRENT_LIST_DIR}/definitions/") + +if(MICROSTRAIN_CMAKE_DEBUG) + set(INCLUDED_DEF_HEADERS ${MIP_DEF_HEADERS}) + list(TRANSFORM INCLUDED_DEF_HEADERS REPLACE "${CMAKE_CURRENT_LIST_DIR}/" "") + message("C++ metadata definitions = ${INCLUDED_DEF_HEADERS}") +endif() + +add_library(${MIP_METADATA_LIBRARY} + "${CMAKE_CURRENT_LIST_DIR}/mip_all_definitions.hpp" + "${CMAKE_CURRENT_LIST_DIR}/mip_definitions.hpp" + "${CMAKE_CURRENT_LIST_DIR}/mip_definitions.cpp" + "${CMAKE_CURRENT_LIST_DIR}/mip_metadata.hpp" + "${CMAKE_CURRENT_LIST_DIR}/mip_structures.hpp" + "${CMAKE_CURRENT_LIST_DIR}/mip_meta_utils.hpp" + "${CMAKE_CURRENT_LIST_DIR}/definitions/common.hpp" + ${MIP_DEF_HEADERS} +) + +target_compile_features(${MIP_METADATA_LIBRARY} PUBLIC cxx_std_20) + +target_link_libraries(${MIP_METADATA_LIBRARY} PUBLIC ${MIP_LIBRARY}) + +target_compile_definitions(${MIP_METADATA_LIBRARY} + PUBLIC "MIP_ENABLE_METADATA=1" + PRIVATE ${MICROSTRAIN_PRIVATE_COMPILE_DEFINITIONS} +) + +target_compile_options(${MIP_METADATA_LIBRARY} PRIVATE ${MICROSTRAIN_PRIVATE_COMPILE_OPTIONS}) + +set(MIP_LIBRARIES_TMP ${MIP_LIBRARIES_TMP} ${MIP_METADATA_LIBRARY} PARENT_SCOPE) + +# +# Installation +# + +include(microstrain_utilities) +microstrain_setup_library_install(${MIP_METADATA_LIBRARY} ${MICROSTRAIN_SRC_DIR}) diff --git a/src/cpp/mip/metadata/definitions/commands_3dm.hpp b/src/cpp/mip/metadata/definitions/commands_3dm.hpp new file mode 100644 index 000000000..abf2df659 --- /dev/null +++ b/src/cpp/mip/metadata/definitions/commands_3dm.hpp @@ -0,0 +1,4519 @@ +#pragma once + +#include + +#include + +#include + +namespace mip::metadata +{ + + +template<> +struct MetadataFor +{ + using type = commands_3dm::PollImuMessage; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "suppress_ack", + /* .docs = */ "Suppress the usual ACK/NACK reply.", + /* .type = */ {Type::BOOL, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "num_descriptors", + /* .docs = */ "Number of descriptors in the descriptor list.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "descriptors", + /* .docs = */ "Descriptor list.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ {83, microstrain::Index(1) /* num_descriptors */}, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::PollImuMessage", + /* .title = */ "poll_imu_message", + /* .docs = */ "Poll the device for an IMU message with the specified format\n\nThis function polls for an IMU message using the provided format. The resulting message\nwill maintain the order of descriptors sent in the command and any unrecognized\ndescriptors are ignored. If the format is not provided, the device will attempt to use the\nstored format (set with the Set IMU Message Format command.) If no format is provided\nand there is no stored format, the device will respond with a NACK. The reply packet contains\nan ACK/NACK field. The polled data packet is sent separately as an IMU Data packet.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::PollGnssMessage; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "suppress_ack", + /* .docs = */ "Suppress the usual ACK/NACK reply.", + /* .type = */ {Type::BOOL, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "num_descriptors", + /* .docs = */ "Number of descriptors in the descriptor list.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "descriptors", + /* .docs = */ "Descriptor list.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ {83, microstrain::Index(1) /* num_descriptors */}, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::PollGnssMessage", + /* .title = */ "poll_gnss_message", + /* .docs = */ "Poll the device for an GNSS message with the specified format\n\nThis function polls for a GNSS message using the provided format. The resulting message\nwill maintain the order of descriptors sent in the command and any unrecognized\ndescriptors are ignored. If the format is not provided, the device will attempt to use the\nstored format (set with the Set GNSS Message Format command.) If no format is provided\nand there is no stored format, the device will respond with a NACK. The reply packet contains\nan ACK/NACK field. The polled data packet is sent separately as a GNSS Data packet.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::PollFilterMessage; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "suppress_ack", + /* .docs = */ "Suppress the usual ACK/NACK reply.", + /* .type = */ {Type::BOOL, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "num_descriptors", + /* .docs = */ "Number of descriptors in the format list.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "descriptors", + /* .docs = */ "Descriptor format list.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ {83, microstrain::Index(1) /* num_descriptors */}, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::PollFilterMessage", + /* .title = */ "poll_filter_message", + /* .docs = */ "Poll the device for an Estimation Filter message with the specified format\n\nThis function polls for an Estimation Filter message using the provided format. The resulting message\nwill maintain the order of descriptors sent in the command and any unrecognized\ndescriptors are ignored. If the format is not provided, the device will attempt to use the\nstored format (set with the Set Estimation Filter Message Format command.) If no format is provided\nand there is no stored format, the device will respond with a NACK. The reply packet contains\nan ACK/NACK field. The polled data packet is sent separately as an Estimation Filter Data packet.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::ImuMessageFormat::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "num_descriptors", + /* .docs = */ "Number of descriptors", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "descriptors", + /* .docs = */ "Descriptor format list.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ {82, microstrain::Index(0) /* num_descriptors */}, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::ImuMessageFormat::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::ImuMessageFormat; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "num_descriptors", + /* .docs = */ "Number of descriptors", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "descriptors", + /* .docs = */ "Descriptor format list.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ {82, microstrain::Index(0) /* num_descriptors */}, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::ImuMessageFormat", + /* .title = */ "imu_message_format", + /* .docs = */ "Set, read, or save the format of the IMU data packet.\n\nThe resulting data messages will maintain the order of descriptors sent in the command.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::GpsMessageFormat::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "num_descriptors", + /* .docs = */ "Number of descriptors", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "descriptors", + /* .docs = */ "Descriptor format list.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ {82, microstrain::Index(0) /* num_descriptors */}, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::GpsMessageFormat::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::GpsMessageFormat; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "num_descriptors", + /* .docs = */ "Number of descriptors", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "descriptors", + /* .docs = */ "Descriptor format list.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ {82, microstrain::Index(0) /* num_descriptors */}, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::GpsMessageFormat", + /* .title = */ "gps_message_format", + /* .docs = */ "Set, read, or save the format of the GNSS data packet.\n\nThe resulting data messages will maintain the order of descriptors sent in the command.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::FilterMessageFormat::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "num_descriptors", + /* .docs = */ "Number of descriptors (limited by payload size)", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "descriptors", + /* .docs = */ "", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ {82, microstrain::Index(0) /* num_descriptors */}, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::FilterMessageFormat::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::FilterMessageFormat; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "num_descriptors", + /* .docs = */ "Number of descriptors (limited by payload size)", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "descriptors", + /* .docs = */ "", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ {82, microstrain::Index(0) /* num_descriptors */}, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::FilterMessageFormat", + /* .title = */ "filter_message_format", + /* .docs = */ "Set, read, or save the format of the Estimation Filter data packet.\n\nThe resulting data messages will maintain the order of descriptors sent in the command.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::ImuGetBaseRate::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "rate", + /* .docs = */ "[hz]", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::ImuGetBaseRate::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::ImuGetBaseRate; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::ImuGetBaseRate", + /* .title = */ "Get IMU Data Base Rate", + /* .docs = */ "Get the base rate for the IMU data in Hz\n\nThis is the fastest rate for this type of data available on the device.\nThis is used in conjunction with the IMU Message Format Command to set streaming data at a specified rate.", + /* .parameters = */ {}, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::GpsGetBaseRate::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "rate", + /* .docs = */ "[hz]", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::GpsGetBaseRate::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::GpsGetBaseRate; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::GpsGetBaseRate", + /* .title = */ "Get GNSS Data Base Rate", + /* .docs = */ "Get the base rate for the GNSS data in Hz\n\nThis is the fastest rate for this type of data available on the device.\nThis is used in conjunction with the GNSS Message Format Command to set streaming data at a specified rate.", + /* .parameters = */ {}, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::FilterGetBaseRate::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "rate", + /* .docs = */ "[hz]", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::FilterGetBaseRate::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::FilterGetBaseRate; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::FilterGetBaseRate", + /* .title = */ "Get Estimation Filter Data Base Rate", + /* .docs = */ "Get the base rate for the Estimation Filter data in Hz\n\nThis is the fastest rate for this type of data available on the device.\nThis is used in conjunction with the Estimation Filter Message Format Command to set streaming data at a specified rate.", + /* .parameters = */ {}, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::PollData; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "desc_set", + /* .docs = */ "Data descriptor set. Must be supported.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "suppress_ack", + /* .docs = */ "Suppress the usual ACK/NACK reply.", + /* .type = */ {Type::BOOL, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "num_descriptors", + /* .docs = */ "Number of descriptors in the format list.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "descriptors", + /* .docs = */ "Descriptor format list.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ {82, microstrain::Index(2) /* num_descriptors */}, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::PollData", + /* .title = */ "poll_data", + /* .docs = */ "Poll the device for a message with the specified descriptor set and format.\n\nThis function polls for a message using the provided format. The resulting message\nwill maintain the order of descriptors sent in the command and any unrecognized\ndescriptors are ignored. If the format is not provided, the device will attempt to use the\nstored format (set with the Set Message Format command.) If no format is provided\nand there is no stored format, the device will respond with a NACK. The reply packet contains\nan ACK/NACK field. The polled data packet is sent separately as a normal Data packet.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::GetBaseRate::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "desc_set", + /* .docs = */ "Echoes the parameter in the command.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "rate", + /* .docs = */ "Base rate in Hz (0 = variable, unknown, or user-defined rate. Data will be sent when received).", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::GetBaseRate::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::GetBaseRate; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "desc_set", + /* .docs = */ "This is the data descriptor set. It must be a supported descriptor.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::GetBaseRate", + /* .title = */ "Get Data Base Rate", + /* .docs = */ "Get the base rate for the specified descriptor set in Hz.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::MessageFormat::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "desc_set", + /* .docs = */ "Echoes the descriptor set from the command.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "num_descriptors", + /* .docs = */ "Number of descriptors in the list.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "descriptors", + /* .docs = */ "List of descriptors and decimations.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ {82, microstrain::Index(1) /* num_descriptors */}, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::MessageFormat::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::MessageFormat; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "desc_set", + /* .docs = */ "Data descriptor set. Must be supported. When function is SAVE, LOAD, or DEFAULT, can be 0 to apply to all descriptor sets.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, true, true, true, true, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "num_descriptors", + /* .docs = */ "Number of descriptors (limited by payload size)", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "descriptors", + /* .docs = */ "List of descriptors and decimations.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ {82, microstrain::Index(1) /* num_descriptors */}, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::MessageFormat", + /* .title = */ "message_format", + /* .docs = */ "Set, read, or save the format for a given data packet.\n\nThe resulting data messages will maintain the order of descriptors sent in the command.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::NmeaMessage::MessageID; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(1), "GGA", "GPS System Fix Data. Source can be the Filter or GNSS1/2 datasets." }, + { uint32_t(2), "GLL", "Geographic Position Lat/Lon. Source can be the Filter or GNSS1/2 datasets." }, + { uint32_t(3), "GSV", "GNSS Satellites in View. Source must be either GNSS1 or GNSS2 datasets. The talker ID must be set to IGNORED." }, + { uint32_t(4), "RMC", "Recommended Minimum Specific GNSS Data. Source can be the Filter or GNSS1/2 datasets." }, + { uint32_t(5), "VTG", "Course over Ground. Source can be the Filter or GNSS1/2 datasets." }, + { uint32_t(6), "HDT", "Heading, True. Source can be the Filter or GNSS1/2 datasets." }, + { uint32_t(7), "ZDA", "Time & Date. Source must be the GNSS1 or GNSS2 datasets." }, + { uint32_t(129), "MSRA", "MicroStrain proprietary Euler angles. Source must be the Filter dataset. The talker ID must be set to IGNORED." }, + { uint32_t(130), "MSRR", "MicroStrain proprietary Angular Rate/Acceleration. Source must be the Sensor dataset. The talker ID must be set to IGNORED." }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "MessageID", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::NmeaMessage::TalkerID; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "IGNORED", "Talker ID cannot be changed." }, + { uint32_t(1), "GNSS", "NMEA message will be produced with talker id 'GN'." }, + { uint32_t(2), "GPS", "NMEA message will be produced with talker id 'GP'." }, + { uint32_t(3), "GALILEO", "NMEA message will be produced with talker id 'GA'." }, + { uint32_t(4), "GLONASS", "NMEA message will be produced with talker id 'GL'." }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "TalkerID", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::NmeaMessage; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "message_id", + /* .docs = */ "NMEA sentence type.", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "talker_id", + /* .docs = */ "NMEA talker ID. Ignored for proprietary sentences.", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "source_desc_set", + /* .docs = */ "Data descriptor set where the data will be sourced. Available options depend on the sentence.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "decimation", + /* .docs = */ "Decimation from the base rate for source_desc_set. Frequency is limited to 10 Hz or the base rate, whichever is lower. Must be 0 when polling.", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline StructInfo value = { + /* .name = */ "NmeaMessage", + /* .title = */ "Nmeamessage", + /* .docs = */ "", + /* .parameters = */ parameters, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::NmeaPollData; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "suppress_ack", + /* .docs = */ "Suppress the usual ACK/NACK reply.", + /* .type = */ {Type::BOOL, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "count", + /* .docs = */ "Number of format entries (limited by payload size)", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "format_entries", + /* .docs = */ "List of format entries.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ {40, microstrain::Index(1) /* count */}, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::NmeaPollData", + /* .title = */ "nmea_poll_data", + /* .docs = */ "Poll the device for a NMEA message with the specified format.\n\nThis function polls for a NMEA message using the provided format.\nIf the format is not provided, the device will attempt to use the\nstored format (set with the Set NMEA Message Format command.) If no format is provided\nand there is no stored format, the device will respond with a NACK. The reply packet contains\nan ACK/NACK field. The polled data packet is sent separately as normal NMEA messages.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::NmeaMessageFormat::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "count", + /* .docs = */ "Number of format entries (limited by payload size)", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "format_entries", + /* .docs = */ "List of format entries.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ {40, microstrain::Index(0) /* count */}, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::NmeaMessageFormat::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::NmeaMessageFormat; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "count", + /* .docs = */ "Number of format entries (limited by payload size)", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "format_entries", + /* .docs = */ "List of format entries.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ {40, microstrain::Index(0) /* count */}, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::NmeaMessageFormat", + /* .title = */ "nmea_message_format", + /* .docs = */ "Set, read, or save the NMEA message format.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::DeviceSettings; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::DeviceSettings", + /* .title = */ "device_settings", + /* .docs = */ "Save, Load, or Reset to Default the values for all device settings.\n\nWhen a save current settings command is issued, a brief data disturbance may occur while all settings are written to non-volatile memory.\n\nThis command should have a long timeout as it may take up to 1 second to complete.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {false, false, true, true, true}, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::UartBaudrate::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "baud", + /* .docs = */ "", + /* .type = */ {Type::U32, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::UartBaudrate::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::UartBaudrate; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "baud", + /* .docs = */ "", + /* .type = */ {Type::U32, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::UartBaudrate", + /* .title = */ "uart_baudrate", + /* .docs = */ "Read, Save, Load, or Reset to Default the baud rate of the main communication channel.\n\nFor all functions except 0x01 (use new settings), the new baud rate value is ignored.\nPlease see the device user manual for supported baud rates.\n\nThe device will wait until all incoming and outgoing data has been sent, up\nto a maximum of 250 ms, before applying any change.\n\nNo guarantee is provided as to what happens to commands issued during this\ndelay period; They may or may not be processed and any responses aren't\nguaranteed to be at one rate or the other. The same applies to data packets.\n\nIt is highly recommended that the device be idle before issuing this command\nand that it be issued in its own packet. Users should wait 250 ms after\nsending this command before further interaction.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::FactoryStreaming::Action; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "OVERWRITE", "Replaces the message format(s), removing any existing descriptors." }, + { uint32_t(1), "MERGE", "Merges support descriptors into existing format(s). May reorder descriptors." }, + { uint32_t(2), "ADD", "Adds descriptors to the current message format(s) without changing existing descriptors. May result in duplicates." }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "Action", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::FactoryStreaming; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "action", + /* .docs = */ "", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "reserved", + /* .docs = */ "Reserved. Set to 0x00.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::FactoryStreaming", + /* .title = */ "factory_streaming", + /* .docs = */ "Configures the device for recording data for technical support.\n\nThis command will configure all available data streams to predefined\nformats designed to be used with technical support.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::DatastreamControl::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "desc_set", + /* .docs = */ "", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "enabled", + /* .docs = */ "", + /* .type = */ {Type::BOOL, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::DatastreamControl::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::DatastreamControl; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "desc_set", + /* .docs = */ "The descriptor set of the stream to control. When function is SAVE, LOAD, or DEFAULT, can be ALL_STREAMS(0) to apply to all descriptor sets.\nOn Generation 5 products, this must be one of the above legacy constants.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, true, true, true, true, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "enable", + /* .docs = */ "True or false to enable or disable the stream.", + /* .type = */ {Type::BOOL, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::DatastreamControl", + /* .title = */ "datastream_control", + /* .docs = */ "Enable/disable the selected data stream.\n\nEach data stream (descriptor set) can be enabled or disabled.\nThe default for the device is all streams enabled.\nFor all functions except 0x01 (use new setting),\nthe new enable flag value is ignored and can be omitted.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::ConstellationSettings::ConstellationId; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "GPS", "GPS (G1-G32)" }, + { uint32_t(1), "SBAS", "SBAS (S120-S158)" }, + { uint32_t(2), "GALILEO", "GALILEO (E1-E36)" }, + { uint32_t(3), "BeiDou", "BeiDou (B1-B37)" }, + { uint32_t(5), "QZSS", "QZSS (Q1-Q5)" }, + { uint32_t(6), "GLONASS", "GLONASS (R1-R32)" }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "ConstellationId", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::ConstellationSettings::OptionFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "L1SAIF", "Available only for QZSS" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "OptionFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::ConstellationSettings::Settings; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "constellation_id", + /* .docs = */ "Constellation ID", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "enable", + /* .docs = */ "Enable/Disable constellation", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "reserved_channels", + /* .docs = */ "Minimum number of channels reserved for this constellation", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "max_channels", + /* .docs = */ "Maximum number of channels to use for this constallation", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "option_flags", + /* .docs = */ "Constellation option Flags", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline StructInfo value = { + /* .name = */ "Settings", + /* .title = */ "Settings", + /* .docs = */ "", + /* .parameters = */ parameters, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::ConstellationSettings::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "max_channels_available", + /* .docs = */ "Maximum channels available", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "max_channels_use", + /* .docs = */ "Maximum channels to use", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "config_count", + /* .docs = */ "Number of constellation configurations", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "settings", + /* .docs = */ "Constellation Settings", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ {0, microstrain::Index(2) /* config_count */}, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::ConstellationSettings::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::ConstellationSettings; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "max_channels", + /* .docs = */ "", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "config_count", + /* .docs = */ "", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "settings", + /* .docs = */ "", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ {0, microstrain::Index(1) /* config_count */}, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::ConstellationSettings", + /* .title = */ "constellation_settings", + /* .docs = */ "This command configures which satellite constellations are enabled and how many channels are dedicated to tracking each constellation.\n\nMaximum number of tracking channels to use (total for all constellations):\n0 to max_channels_available (from reply message)\n\nFor each constellation you wish to use, include a ConstellationSettings struct. Note the following:\n\nTotal number of tracking channels (sum of 'reserved_channels' for all constellations) must be <= 32:\n0 -> 32 Number of reserved channels\n0 -> 32 Max number of channels (>= reserved channels)\n\nThe factory default setting is: GPS and GLONASS enabled. Min/Max for GPS = 8/16, GLONASS = 8/14, SBAS = 1/3, QZSS = 0/3.\n\nWarning: SBAS functionality shall not be used in 'safety of life' applications!\nWarning: Any setting that causes the total reserved channels to exceed 32 will result in a NACK.\nWarning: You cannot enable GLONASS and BeiDou at the same time.\nNote: Enabling SBAS and QZSS augments GPS accuracy.\nNote: It is recommended to disable GLONASS and BeiDou if a GPS-only antenna or GPS-only SAW filter is used.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::GnssSbasSettings::SBASOptions; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "enable_ranging", "Use SBAS pseudo-ranges in position solution" }, + { uint32_t(2), "enable_corrections", "Use SBAS differential corrections" }, + { uint32_t(4), "apply_integrity", "Use SBAS integrity information. If enabled, only GPS satellites for which integrity information is available will be used." }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "SBASOptions", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::GnssSbasSettings::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "enable_sbas", + /* .docs = */ "0 - SBAS Disabled, 1 - SBAS enabled", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "sbas_options", + /* .docs = */ "SBAS options, see definition", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "num_included_prns", + /* .docs = */ "Number of SBAS PRNs to include in search (0 = include all)", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "included_prns", + /* .docs = */ "List of specific SBAS PRNs to search for", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ {39, microstrain::Index(2) /* num_included_prns */}, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::GnssSbasSettings::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::GnssSbasSettings; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "enable_sbas", + /* .docs = */ "0 - SBAS Disabled, 1 - SBAS enabled", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "sbas_options", + /* .docs = */ "SBAS options, see definition", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "num_included_prns", + /* .docs = */ "Number of SBAS PRNs to include in search (0 = include all)", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "included_prns", + /* .docs = */ "List of specific SBAS PRNs to search for", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ {39, microstrain::Index(2) /* num_included_prns */}, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::GnssSbasSettings", + /* .title = */ "SBAS Settings", + /* .docs = */ "Configure the SBAS subsystem\n\n\n", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::GnssAssistedFix::AssistedFixOption; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "NONE", "No assisted fix (default)" }, + { uint32_t(1), "ENABLED", "Enable assisted fix" }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "AssistedFixOption", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::GnssAssistedFix::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "option", + /* .docs = */ "Assisted fix options", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "flags", + /* .docs = */ "Assisted fix flags (set to 0xFF)", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::GnssAssistedFix::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::GnssAssistedFix; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "option", + /* .docs = */ "Assisted fix options", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "flags", + /* .docs = */ "Assisted fix flags (set to 0xFF)", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::GnssAssistedFix", + /* .title = */ "GNSS Assisted Fix Settings", + /* .docs = */ "Set the options for assisted GNSS fix.\n\nDevices that implement this command have a dedicated GNSS flash memory and a non-volatile FRAM.\nThese storage mechanisms are used to retain information about the last good GNSS fix. This can greatly reduces the TTFF (Time To First Fix) depending on the age of the stored information.\nThe TTFF can be as low as one second, or up to the equivalent of a cold start. There is a small increase in power used when enabling assisted fix.\n\nThe fastest fix will be obtained by supplying the device with a GNSS Assist Time Update message containing the current GPS time immediately after subsequent power up.\nThis allows the device to determine if the last GNSS information saved is still fresh enough to improve the TTFF.\n\nNOTE: Non-volatile GNSS memory is cleared when going from an enabled state to a disabled state.\nWARNING: The clearing operation results in an erase operation on the GNSS Flash. The flash has a limited durability of 100,000 write/erase cycles", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::GnssTimeAssistance::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "tow", + /* .docs = */ "GPS Time of week [seconds]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "week_number", + /* .docs = */ "GPS Weeks since 1980 [weeks]", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "accuracy", + /* .docs = */ "Accuracy of time information [seconds]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::GnssTimeAssistance::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::GnssTimeAssistance; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "tow", + /* .docs = */ "GPS Time of week [seconds]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "week_number", + /* .docs = */ "GPS Weeks since 1980 [weeks]", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "accuracy", + /* .docs = */ "Accuracy of time information [seconds]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::GnssTimeAssistance", + /* .title = */ "gnss_time_assistance", + /* .docs = */ "Provide the GNSS subsystem with initial time information.\n\nThis message is required immediately after power up if GNSS Assist was enabled when the device was powered off.\nThis will initialize the subsystem clock to help reduce the time to first fix (TTFF).", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, false, false, false}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::ImuLowpassFilter::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "target_descriptor", + /* .docs = */ "", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "enable", + /* .docs = */ "True if the filter is currently enabled.", + /* .type = */ {Type::BOOL, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "manual", + /* .docs = */ "True if the filter cutoff was manually configured.", + /* .type = */ {Type::BOOL, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "frequency", + /* .docs = */ "The cutoff frequency of the filter. If the filter is in\nauto mode, this value is unspecified.", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "reserved", + /* .docs = */ "Reserved and must be ignored.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::ImuLowpassFilter::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::ImuLowpassFilter; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "target_descriptor", + /* .docs = */ "Field descriptor of filtered quantity within the Sensor data set.\nSupported values are accel (0x04), gyro (0x05), mag (0x06), and\npressure (0x17), provided the data is supported by the device.\nExcept with the READ function selector, this can be 0 to apply to all of the above quantities.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, true, true, true, true, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "enable", + /* .docs = */ "The target data will be filtered if this is true.", + /* .type = */ {Type::BOOL, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "manual", + /* .docs = */ "If false, the cutoff frequency is set to half of the\nstreaming rate as configured by the message format command.\nOtherwise, the cutoff frequency is set according to the\nfollowing 'frequency' parameter.", + /* .type = */ {Type::BOOL, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "frequency", + /* .docs = */ "-3dB cutoff frequency in Hz. Will not affect filtering if 'manual' is false.", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "reserved", + /* .docs = */ "Reserved, set to 0x00.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::ImuLowpassFilter", + /* .title = */ "Advanced Low-Pass Filter Settings", + /* .docs = */ "Advanced configuration for the IMU data quantity low-pass filters.\n\nDeprecated, use the lowpass filter (0x0C,0x54) command instead.\n\nThe scaled data quantities are by default filtered through a single-pole IIR low-pass filter\nwhich is configured with a -3dB cutoff frequency of half the reporting frequency (set by\ndecimation factor in the IMU Message Format command) to prevent aliasing on a per data\nquantity basis. This advanced configuration command allows for the cutoff frequency to\nbe configured independently of the data reporting frequency as well as allowing for a\ncomplete bypass of the digital low-pass filter.\n\nPossible data descriptors:\n0x04 - Scaled accelerometer data\n0x05 - Scaled gyro data\n0x06 - Scaled magnetometer data (if applicable)\n0x17 - Scaled pressure data (if applicable)", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::PpsSource::Source; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "DISABLED", "PPS output is disabled. Not valid for PPS source command." }, + { uint32_t(1), "RECEIVER_1", "PPS is provided by GNSS receiver 1." }, + { uint32_t(2), "RECEIVER_2", "PPS is provided by GNSS receiver 2." }, + { uint32_t(3), "GPIO", "PPS is provided to an external GPIO pin. Use the GPIO Setup command to choose and configure the pin." }, + { uint32_t(4), "GENERATED", "PPS is generated from the system oscillator." }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "Source", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::PpsSource::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "source", + /* .docs = */ "", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::PpsSource::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::PpsSource; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "source", + /* .docs = */ "", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::PpsSource", + /* .title = */ "pps_source", + /* .docs = */ "Controls the Pulse Per Second (PPS) source.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::GpioConfig::Feature; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "UNUSED", "The pin is not used. It may be technically possible to read the pin state in this mode, but this is not guaranteed to be true of all devices or pins." }, + { uint32_t(1), "GPIO", "General purpose input or output. Use this for direct control of pin output state or to stream the state of the pin." }, + { uint32_t(2), "PPS", "Pulse per second input or output." }, + { uint32_t(3), "ENCODER", "Motor encoder/odometer input." }, + { uint32_t(4), "TIMESTAMP", "Precision Timestamping. Use with Event Trigger Configuration (0x0C,0x2E)." }, + { uint32_t(5), "UART", "UART data or control lines." }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "Feature", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::GpioConfig::Behavior; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "UNUSED", "Use 0 unless otherwise specified." }, + { uint32_t(1), "GPIO_INPUT", "Pin will be an input. This can be used to stream or poll the value and is the default setting." }, + { uint32_t(2), "GPIO_OUTPUT_LOW", "Pin is an output initially in the LOW state. This state will be restored during system startup if the configuration is saved." }, + { uint32_t(3), "GPIO_OUTPUT_HIGH", "Pin is an output initially in the HIGH state. This state will be restored during system startup if the configuration is saved." }, + { uint32_t(1), "PPS_INPUT", "Pin will receive the pulse-per-second signal. Only one pin can have this behavior. This will only work if the PPS Source command is configured to GPIO." }, + { uint32_t(2), "PPS_OUTPUT", "Pin will transmit the pulse-per-second signal from the device." }, + { uint32_t(1), "ENCODER_A", "Encoder 'A' quadrature input. Only one pin can have this behavior. The last command to set this behavior will take precedence." }, + { uint32_t(2), "ENCODER_B", "Encoder 'B' quadrature input. Only one pin can have this behavior. The last command to set this behavior will take precedence." }, + { uint32_t(1), "TIMESTAMP_RISING", "Rising edges will be timestamped." }, + { uint32_t(2), "TIMESTAMP_FALLING", "Falling edges will be timestamped." }, + { uint32_t(3), "TIMESTAMP_EITHER", "Both rising and falling edges will be timestamped." }, + { uint32_t(33), "UART_PORT2_TX", "(0x21) UART port 2 transmit." }, + { uint32_t(34), "UART_PORT2_RX", "(0x22) UART port 2 receive." }, + { uint32_t(49), "UART_PORT3_TX", "(0x31) UART port 3 transmit." }, + { uint32_t(50), "UART_PORT3_RX", "(0x32) UART port 3 receive." }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "Behavior", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::GpioConfig::PinMode; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "open_drain", "The pin will be an open-drain output. The state will be either LOW or FLOATING instead of LOW or HIGH, respectively. This is used to connect multiple open-drain outputs from several devices. An internal or external pull-up resistor is typically used in combination. The maximum voltage of an open drain output is subject to the device maximum input voltage range found in the specifications." }, + { uint32_t(2), "pulldown", "The pin will have an internal pull-down resistor enabled. This is useful for connecting inputs to signals which can only be pulled high such as mechanical switches. Cannot be used in combination with pull-up. See the device specifications for the resistance value." }, + { uint32_t(4), "pullup", "The pin will have an internal pull-up resistor enabled. Useful for connecting inputs to signals which can only be pulled low such as mechanical switches, or in combination with an open drain output. Cannot be used in combination with pull-down. See the device specifications for the resistance value. Use of this mode may restrict the maximum allowed input voltage. See the device datasheet for details." }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "PinMode", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::GpioConfig::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "pin", + /* .docs = */ "GPIO pin number counting from 1. For save, load, and default function selectors, this can be 0 to select all pins.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, true, true, true, true, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "feature", + /* .docs = */ "Determines how the pin will be used.", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "behavior", + /* .docs = */ "Select an appropriate value from the enumeration based on the selected feature (e.g. for PPS, select one of the values prefixed with PPS_.)", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "pin_mode", + /* .docs = */ "GPIO configuration. May be restricted depending on device, pin, feature, and behavior. See device user manual.", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::GpioConfig::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::GpioConfig; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "pin", + /* .docs = */ "GPIO pin number counting from 1. For save, load, and default function selectors, this can be 0 to select all pins.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, true, true, true, true, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "feature", + /* .docs = */ "Determines how the pin will be used.", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "behavior", + /* .docs = */ "Select an appropriate value from the enumeration based on the selected feature (e.g. for PPS, select one of the values prefixed with PPS_.)", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "pin_mode", + /* .docs = */ "GPIO configuration. May be restricted depending on device, pin, feature, and behavior. See device user manual.", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::GpioConfig", + /* .title = */ "GPIO Configuration", + /* .docs = */ "Configures the user GPIO pins on the connector for use with several built-in functions or for general input or output.\n\nGPIO pins are device-dependent. Some features are only available on\ncertain pins. Some behaviors require specific configurations.\nConsult the device user manual for restrictions and default settings.\n\nTo avoid glitches on GPIOs configured as an output in a mode other than\nGPIO, always configure the relevant function before setting up the pin\nwith this command. Otherwise, the pin state will be undefined between\nthis command and the one to set up the feature. For input pins, use\nthis command first so the state is well-defined when the feature is\ninitialized.\n\nSome configurations can only be active on one pin at a time. If such\nconfiguration is applied to a second pin, the second one will take\nprecedence and the original pin's configuration will be reset.\n", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::GpioState::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "pin", + /* .docs = */ "GPIO pin number counting from 1. Cannot be 0.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, true, false, false, false, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "state", + /* .docs = */ "The pin state.", + /* .type = */ {Type::BOOL, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::GpioState::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::GpioState; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "pin", + /* .docs = */ "GPIO pin number counting from 1. Cannot be 0.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, true, false, false, false, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "state", + /* .docs = */ "The pin state.", + /* .type = */ {Type::BOOL, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::GpioState", + /* .title = */ "GPIO State", + /* .docs = */ "Allows the state of the pin to be read or controlled.\n\nThis command serves two purposes: 1) To allow reading the state of a pin via command,\nrather than polling a data quantity, and 2) to provide a way to set the output state\nwithout also having to specify the operating mode.\n\nThe state read back from the pin is the physical state of the pin, rather than a\nconfiguration value. The state can be read regardless of its configuration as long as\nthe device supports GPIO input on that pin. If the pin is set to an output, the read\nvalue would match the output value.\n\nWhile the state of a pin can always be set, it will only have an observable effect if\nthe pin is set to output mode.\n\nThis command does not support saving, loading, or resetting the state. Instead, use the\nGPIO Configuration command, which allows the initial state to be configured.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, false, false, false}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::Odometer::Mode; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "DISABLED", "Encoder is disabled." }, + { uint32_t(2), "QUADRATURE", "Quadrature encoder mode." }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "Mode", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::Odometer::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "mode", + /* .docs = */ "Mode setting.", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "scaling", + /* .docs = */ "Encoder pulses per meter of distance traveled [pulses/m].\nDistance traveled is computed using the formula d = p / N * 2R * pi, where d is distance,\np is the number of pulses received, N is the encoder resolution, and R is the wheel radius.\nBy simplifying all of the parameters into one, the formula d = p / S is obtained, where s\nis the odometer scaling factor passed to this command. S is equivalent to N / (2R * pi) and\nhas units of pulses / meter. N is in units of 'A' pulses per revolution and R is in meters.\nMake this value negative if the odometer is mounted so that it rotates backwards.", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "uncertainty", + /* .docs = */ "Uncertainty in encoder counts to distance translation (1-sigma value) [m/m].", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::Odometer::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::Odometer; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "mode", + /* .docs = */ "Mode setting.", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "scaling", + /* .docs = */ "Encoder pulses per meter of distance traveled [pulses/m].\nDistance traveled is computed using the formula d = p / N * 2R * pi, where d is distance,\np is the number of pulses received, N is the encoder resolution, and R is the wheel radius.\nBy simplifying all of the parameters into one, the formula d = p / S is obtained, where s\nis the odometer scaling factor passed to this command. S is equivalent to N / (2R * pi) and\nhas units of pulses / meter. N is in units of 'A' pulses per revolution and R is in meters.\nMake this value negative if the odometer is mounted so that it rotates backwards.", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "uncertainty", + /* .docs = */ "Uncertainty in encoder counts to distance translation (1-sigma value) [m/m].", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::Odometer", + /* .title = */ "Odometer Settings", + /* .docs = */ "Configures the hardware odometer interface.\n", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::GetEventSupport::Query; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(1), "TRIGGER_TYPES", "Query the supported trigger types and max count for each." }, + { uint32_t(2), "ACTION_TYPES", "Query the supported action types and max count for each." }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "Query", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::GetEventSupport::Info; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "type", + /* .docs = */ "Trigger or action type, as defined in the respective setup command.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "count", + /* .docs = */ "This is the maximum number of instances supported for this type.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline StructInfo value = { + /* .name = */ "Info", + /* .title = */ "Info", + /* .docs = */ "", + /* .parameters = */ parameters, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::GetEventSupport::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "query", + /* .docs = */ "Query type specified in the command.", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "max_instances", + /* .docs = */ "Number of slots available. The 'instance' number for\nthe configuration or control commands must be between 1 and this value.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "num_entries", + /* .docs = */ "Number of supported types.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "entries", + /* .docs = */ "List of supported types.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ {0, microstrain::Index(2) /* num_entries */}, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::GetEventSupport::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::GetEventSupport; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "query", + /* .docs = */ "What type of information to retrieve.", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::GetEventSupport", + /* .title = */ "Get Supported Events", + /* .docs = */ "Lists the available trigger or action types.\n\nThere are a limited number of trigger and action slots available\nin the device. Up to M triggers and N actions can be configured at once\nin slots 1..M and 1..N respectively. M and N are identified by the\nmax_instances field in the response with the appropriate query selector.\n\nEach slot can be configured as one of a variety of different types of\ntriggers or actions. The supported types are enumerated in the response\nto this command. Additionally, there is a limit on the number of a given\ntype. In other words, while the device may support M triggers in total,\nonly a few of them maybe usable as a given type. This limit helps optimize\ndevice resources. The limit is identified in the count field.\n\nAll of the information in this command is available in the user manual.\nThis command provides a programmatic method for obtaining the information.\n", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::EventControl::Mode; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "DISABLED", "Trigger is disabled." }, + { uint32_t(1), "ENABLED", "Trigger is enabled and will work normally." }, + { uint32_t(2), "TEST", "Forces the trigger to the active state for testing purposes." }, + { uint32_t(3), "TEST_PULSE", "Trigger is forced to the active state for one event cycle only. After the test cycle, the mode reverts to the previous state (either enabled or disabled)." }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "Mode", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::EventControl::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "instance", + /* .docs = */ "Trigger instance to affect. 0 can be used to apply the mode to all\nconfigured triggers, except when the function selector is READ.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, true, true, true, true, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "mode", + /* .docs = */ "How to change the trigger state. Except when instance is 0, the\ncorresponding trigger must be configured, i.e. not have type 0.", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::EventControl::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::EventControl; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "instance", + /* .docs = */ "Trigger instance to affect. 0 can be used to apply the mode to all\nconfigured triggers, except when the function selector is READ.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, true, true, true, true, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "mode", + /* .docs = */ "How to change the trigger state. Except when instance is 0, the\ncorresponding trigger must be configured, i.e. not have type 0.", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::EventControl", + /* .title = */ "Event Control", + /* .docs = */ "Enables or disables event triggers.\n\nTriggers can be disabled, enabled, and tested. While disabled, a trigger will\nnot evaluate its logic and effective behave like no trigger is configured.\nA disabled trigger will not activate any actions. Triggers are disabled by default.\n\nUse this command to enable (or disable) a trigger, or to place it into a test mode.\nWhen in test mode, the trigger logic is disabled but the output is forced to\nthe active state, meaning that it will behave as if the trigger logic is satisfied\nand any associated actions will execute.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::GetEventTriggerStatus::Status; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "active", "True if the trigger is currently active (either due to its logic or being in test mode)." }, + { uint32_t(2), "enabled", "True if the trigger is enabled." }, + { uint32_t(4), "test", "True if the trigger is in test mode." }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "Status", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::GetEventTriggerStatus::Entry; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "type", + /* .docs = */ "Configured trigger type.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "status", + /* .docs = */ "Trigger status.", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline StructInfo value = { + /* .name = */ "Entry", + /* .title = */ "Entry", + /* .docs = */ "", + /* .parameters = */ parameters, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::GetEventTriggerStatus::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "count", + /* .docs = */ "Number of entries requested. If requested_count was 0, this is the number of supported trigger slots.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "triggers", + /* .docs = */ "A list of the configured triggers. Entries are in the order requested, or in increasing order if count was 0.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ {20, microstrain::Index(0) /* count */}, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::GetEventTriggerStatus::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::GetEventTriggerStatus; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "requested_count", + /* .docs = */ "Number of entries requested. If 0, requests all trigger slots.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "requested_instances", + /* .docs = */ "List of trigger instances to query.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ {20, microstrain::Index(0) /* requested_count */}, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::GetEventTriggerStatus", + /* .title = */ "Get Trigger Status", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::GetEventActionStatus::Entry; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "action_type", + /* .docs = */ "Configured action type.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "trigger_id", + /* .docs = */ "Associated trigger instance.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline StructInfo value = { + /* .name = */ "Entry", + /* .title = */ "Entry", + /* .docs = */ "", + /* .parameters = */ parameters, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::GetEventActionStatus::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "count", + /* .docs = */ "Number of entries requested. If requested_count was 0, this is the number of supported action slots.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "actions", + /* .docs = */ "A list of the configured actions. Entries are in the order requested, or in increasing order if count was 0.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ {20, microstrain::Index(0) /* count */}, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::GetEventActionStatus::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::GetEventActionStatus; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "requested_count", + /* .docs = */ "Number of entries requested. If 0, requests all action slots.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "requested_instances", + /* .docs = */ "List of action instances to query.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ {20, microstrain::Index(0) /* requested_count */}, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::GetEventActionStatus", + /* .title = */ "Get Action Status", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::EventTrigger::GpioParams::Mode; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "DISABLED", "The pin will have no effect and the trigger will never activate." }, + { uint32_t(1), "WHILE_HIGH", "The trigger will be active while the pin is high." }, + { uint32_t(2), "WHILE_LOW", "The trigger will be active while the pin is low." }, + { uint32_t(4), "EDGE", "Use if the pin is configured for timestamping via the 3DM Gpio Configuration command (0x0C41)." }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "Mode", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::EventTrigger::GpioParams; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "pin", + /* .docs = */ "GPIO pin number.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "mode", + /* .docs = */ "How the pin state affects the trigger.", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline StructInfo value = { + /* .name = */ "GpioParams", + /* .title = */ "Gpioparams", + /* .docs = */ "", + /* .parameters = */ parameters, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::EventTrigger::ThresholdParams::Type; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(1), "WINDOW", "Window comparison. Trigger is active if low_thres <= value <= high_thres. If the thresholds are reversed, the trigger is active when value < high_thres or value > low_thres." }, + { uint32_t(2), "INTERVAL", "Trigger at evenly-spaced intervals. Normally used with time fields to trigger periodically. Trigger is active when (value % interval) <= int_thres. If the thresholds are reversed (high_thres < low_thres) then the trigger is active when (value % low_thres) > high_thres." }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "Type", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::EventTrigger::ThresholdParams; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "desc_set", + /* .docs = */ "Descriptor set of target data quantity.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "field_desc", + /* .docs = */ "Field descriptor of target data quantity.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "param_id", + /* .docs = */ "1-based index of the target parameter within the MIP field. E.g. for Scaled Accel (0x80,0x04) a value of 2 would represent the Y axis.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "type", + /* .docs = */ "Determines the type of comparison.", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "low_thres", + /* .docs = */ "", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {ParameterInfo::Condition::Type::ENUM, microstrain::Index(3) /* type */, static_cast(commands_3dm::EventTrigger::ThresholdParams::Type::WINDOW)} /* type == WINDOW */, + }, + { + /* .name = */ "int_thres", + /* .docs = */ "", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {ParameterInfo::Condition::Type::ENUM, microstrain::Index(3) /* type */, static_cast(commands_3dm::EventTrigger::ThresholdParams::Type::INTERVAL)} /* type == INTERVAL */, + }, + { + /* .name = */ "high_thres", + /* .docs = */ "", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {ParameterInfo::Condition::Type::ENUM, microstrain::Index(3) /* type */, static_cast(commands_3dm::EventTrigger::ThresholdParams::Type::WINDOW)} /* type == WINDOW */, + }, + { + /* .name = */ "interval", + /* .docs = */ "", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {ParameterInfo::Condition::Type::ENUM, microstrain::Index(3) /* type */, static_cast(commands_3dm::EventTrigger::ThresholdParams::Type::INTERVAL)} /* type == INTERVAL */, + }, + }; + + static constexpr inline StructInfo value = { + /* .name = */ "ThresholdParams", + /* .title = */ "Thresholdparams", + /* .docs = */ "Comparison of a supported MIP field parameter against a set of thresholds.\n\nTriggers when a data quantity meets the comparison criteria. The comparison can be either\na window comparison with high and low thresholds or a periodic interval.\n\nThe data quantity is identified by the MIP descriptor set, field descriptor, and parameter number.\nE.g. Scaled acceleration in the Z direction is specified with desc_set=0x80 (sensor data),\nfield_desc=0x04 (scaled accel), and param_id=3 (the third parameter and Z axis).\n\nThe window comparison can be used for a variety of purposes, such as disabling\na robot's drive motors if it tips over. In this case, a window comparison could\nbe set up to monitor the roll angle, (0x80,0x0C,3). The lower threshold would be set\nto -pi/2 radians and the upper threshold to pi/2 radians.\n\nThe interval trigger can be used to perform an action periodically if used with\na time field. E.g. to execute the action every 16 ms, set an interval comparison on\nthe GPS time of week parameter (0x80,0xD3,1) with high_thres set to 0.016. The lower\nthreshold determines how long the trigger is active within the 16-ms period.\n\nEither comparison type can be inverted by reversing the threshold values; setting\nlow_thres > high_thres will result in the reverse condition.\n", + /* .parameters = */ parameters, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::EventTrigger::CombinationParams; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "logic_table", + /* .docs = */ "The last column of a truth table describing the output given the state of each input.", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "input_triggers", + /* .docs = */ "List of trigger IDs for inputs. Use 0 for unused inputs.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 4, + /* .condition = */ {}, + }, + }; + + static constexpr inline StructInfo value = { + /* .name = */ "CombinationParams", + /* .title = */ "Combinationparams", + /* .docs = */ "", + /* .parameters = */ parameters, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::EventTrigger::Type; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "NONE", "No trigger selected. The state will always be inactive." }, + { uint32_t(1), "GPIO", "Trigger based on the state of a GPIO pin. See GpioParams." }, + { uint32_t(2), "THRESHOLD", "Compare a data quantity against a high and low threshold. See ThresholdParams." }, + { uint32_t(3), "COMBINATION", "Logical combination of two or more triggers. See CombinationParams." }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "Type", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::EventTrigger::Parameters; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "gpio", + /* .docs = */ "", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {ParameterInfo::Condition::Type::ENUM, microstrain::Index(1) /* type */, static_cast(commands_3dm::EventTrigger::Type::GPIO)} /* type == GPIO */, + }, + { + /* .name = */ "threshold", + /* .docs = */ "", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {ParameterInfo::Condition::Type::ENUM, microstrain::Index(1) /* type */, static_cast(commands_3dm::EventTrigger::Type::THRESHOLD)} /* type == THRESHOLD */, + }, + { + /* .name = */ "combination", + /* .docs = */ "", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {ParameterInfo::Condition::Type::ENUM, microstrain::Index(1) /* type */, static_cast(commands_3dm::EventTrigger::Type::COMBINATION)} /* type == COMBINATION */, + }, + }; + + static constexpr inline StructInfo value = { + /* .name = */ "Parameters", + /* .title = */ "Parameters", + /* .docs = */ "", + /* .parameters = */ parameters, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::EventTrigger::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "instance", + /* .docs = */ "Trigger number. When function is SAVE, LOAD, or DEFAULT, this can be 0 to apply to all instances.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, true, true, true, true, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "type", + /* .docs = */ "Type of trigger to configure.", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "parameters", + /* .docs = */ "", + /* .type = */ {Type::UNION, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::EventTrigger::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::EventTrigger; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "instance", + /* .docs = */ "Trigger number. When function is SAVE, LOAD, or DEFAULT, this can be 0 to apply to all instances.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, true, true, true, true, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "type", + /* .docs = */ "Type of trigger to configure.", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "parameters", + /* .docs = */ "", + /* .type = */ {Type::UNION, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::EventTrigger", + /* .title = */ "Event Trigger Configuration", + /* .docs = */ "Configures various types of event triggers.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::EventAction::GpioParams::Mode; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "DISABLED", "Pin state will not be changed." }, + { uint32_t(1), "ACTIVE_HIGH", "Pin will be set high when the trigger is active and low otherwise." }, + { uint32_t(2), "ACTIVE_LOW", "Pin will be set low when the trigger is active and high otherwise." }, + { uint32_t(5), "ONESHOT_HIGH", "Pin will be set high each time the trigger activates. It will not be set low." }, + { uint32_t(6), "ONESHOT_LOW", "Pin will be set low each time the trigger activates. It will not be set high." }, + { uint32_t(7), "TOGGLE", "Pin will change to the opposite state each time the trigger activates." }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "Mode", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::EventAction::GpioParams; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "pin", + /* .docs = */ "GPIO pin number.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "mode", + /* .docs = */ "Behavior of the pin.", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline StructInfo value = { + /* .name = */ "GpioParams", + /* .title = */ "Gpioparams", + /* .docs = */ "", + /* .parameters = */ parameters, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::EventAction::MessageParams; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "desc_set", + /* .docs = */ "MIP data descriptor set.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "decimation", + /* .docs = */ "Decimation from the base rate.\nIf 0, a packet is emitted each time the trigger activates.\nOtherwise, packets will be streamed while the trigger is active.\nThe internal decimation counter is reset if the trigger deactivates.", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "num_fields", + /* .docs = */ "Number of mip fields in the packet. Limited to 12.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "descriptors", + /* .docs = */ "List of field descriptors.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ {20, microstrain::Index(2) /* num_fields */}, + /* .condition = */ {}, + }, + }; + + static constexpr inline StructInfo value = { + /* .name = */ "MessageParams", + /* .title = */ "Messageparams", + /* .docs = */ "", + /* .parameters = */ parameters, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::EventAction::Type; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "NONE", "No action. Parameters should be empty." }, + { uint32_t(1), "GPIO", "Control the state of a GPIO pin. See GpioParameters." }, + { uint32_t(2), "MESSAGE", "Output a data packet. See MessageParameters." }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "Type", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::EventAction::Parameters; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "gpio", + /* .docs = */ "Gpio parameters, if type == GPIO. Ignore otherwise.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {ParameterInfo::Condition::Type::ENUM, microstrain::Index(2) /* type */, static_cast(commands_3dm::EventAction::Type::GPIO)} /* type == GPIO */, + }, + { + /* .name = */ "message", + /* .docs = */ "Message parameters, if type == MESSAGE. Ignore otherwise.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {ParameterInfo::Condition::Type::ENUM, microstrain::Index(2) /* type */, static_cast(commands_3dm::EventAction::Type::MESSAGE)} /* type == MESSAGE */, + }, + }; + + static constexpr inline StructInfo value = { + /* .name = */ "Parameters", + /* .title = */ "Parameters", + /* .docs = */ "", + /* .parameters = */ parameters, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::EventAction::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "instance", + /* .docs = */ "Action number. When function is SAVE, LOAD, or DEFAULT, this can be 0 to apply to all instances.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, true, true, true, true, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "trigger", + /* .docs = */ "Trigger ID number.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "type", + /* .docs = */ "Type of action to configure.", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "parameters", + /* .docs = */ "", + /* .type = */ {Type::UNION, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::EventAction::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::EventAction; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "instance", + /* .docs = */ "Action number. When function is SAVE, LOAD, or DEFAULT, this can be 0 to apply to all instances.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, true, true, true, true, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "trigger", + /* .docs = */ "Trigger ID number.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "type", + /* .docs = */ "Type of action to configure.", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "parameters", + /* .docs = */ "", + /* .type = */ {Type::UNION, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::EventAction", + /* .title = */ "Event Action Configuration", + /* .docs = */ "Configures various types of event actions.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::AccelBias::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "bias", + /* .docs = */ "accelerometer bias in the sensor frame (x,y,z) [g]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::AccelBias::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::AccelBias; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "bias", + /* .docs = */ "accelerometer bias in the sensor frame (x,y,z) [g]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::AccelBias", + /* .title = */ "Configure Accel Bias", + /* .docs = */ "Configures the user specified accelerometer bias\n\nThe user specified bias is subtracted from the calibrated accelerometer output. Value is input in the sensor frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::GyroBias::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "bias", + /* .docs = */ "gyro bias in the sensor frame (x,y,z) [radians/second]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::GyroBias::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::GyroBias; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "bias", + /* .docs = */ "gyro bias in the sensor frame (x,y,z) [radians/second]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::GyroBias", + /* .title = */ "Configure Gyro Bias", + /* .docs = */ "Configures the user specified gyroscope bias\n\nThe user specified bias is subtracted from the calibrated angular rate output. Value is input in the sensor frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::CaptureGyroBias::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "bias", + /* .docs = */ "gyro bias in the sensor frame (x,y,z) [radians/second]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::CaptureGyroBias::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::CaptureGyroBias; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "averaging_time_ms", + /* .docs = */ "Averaging time [milliseconds]", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::CaptureGyroBias", + /* .title = */ "Capture Gyro Bias", + /* .docs = */ "Samples gyro for a specified time range and writes the averaged result to the Gyro Bias vector in RAM\n\nThe device will average the gyro output for the duration of 'averaging_time_ms.' To store the resulting vector\nin non-volatile memory, use the Set Gyro Bias command.\nIMPORTANT: The device must be stationary and experiencing minimum vibration for the duration of 'averaging_time_ms'\nAveraging Time range: 1000 to 30,000", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::MagHardIronOffset::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "offset", + /* .docs = */ "hard iron offset in the sensor frame (x,y,z) [Gauss]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::MagHardIronOffset::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::MagHardIronOffset; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "offset", + /* .docs = */ "hard iron offset in the sensor frame (x,y,z) [Gauss]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::MagHardIronOffset", + /* .title = */ "Magnetometer Hard Iron Offset", + /* .docs = */ "Configure the user specified magnetometer hard iron offset vector\n\nThe values for this offset are determined empirically by external software algorithms\nbased on calibration data taken after the device is installed in its application. These values\ncan be obtained and set by using Microstrain software tools.\nAlternatively, on some systems, the auto-mag calibration feature may be used to capture these values in-run.\nThe offset is applied to the scaled magnetometer vector prior to output.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::MagSoftIronMatrix::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "offset", + /* .docs = */ "soft iron matrix [dimensionless]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::MagSoftIronMatrix::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::MagSoftIronMatrix; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "offset", + /* .docs = */ "soft iron matrix [dimensionless]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::MagSoftIronMatrix", + /* .title = */ "Magnetometer Soft Iron Matrix", + /* .docs = */ "Configure the user specified magnetometer soft iron offset matrix\n\nThe values for this matrix are determined empirically by external software algorithms\nbased on calibration data taken after the device is installed in its application. These values\ncan be obtained and set by using Microstrain software tools.\nAlternatively, on some systems, the auto-mag calibration feature may be used to capture these values in-run.\nThe matrix is applied to the scaled magnetometer vector prior to output.\n\nThe matrix is in row major order:\nEQSTART M = \\begin{bmatrix} 0 & 1 & 2 \\\\ 3 & 4 & 5 \\\\ 6 & 7 & 8 \\end{bmatrix} EQEND\n", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::ConingScullingEnable::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "enable", + /* .docs = */ "If true, coning and sculling compensation is enabled.", + /* .type = */ {Type::BOOL, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::ConingScullingEnable::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::ConingScullingEnable; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "enable", + /* .docs = */ "If true, coning and sculling compensation is enabled.", + /* .type = */ {Type::BOOL, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::ConingScullingEnable", + /* .title = */ "Coning and Sculling Enable", + /* .docs = */ "Controls the Coning and Sculling Compenstation setting.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::Sensor2VehicleTransformEuler::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "roll", + /* .docs = */ "[radians]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "pitch", + /* .docs = */ "[radians]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "yaw", + /* .docs = */ "[radians]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::Sensor2VehicleTransformEuler::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::Sensor2VehicleTransformEuler; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "roll", + /* .docs = */ "[radians]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "pitch", + /* .docs = */ "[radians]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "yaw", + /* .docs = */ "[radians]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::Sensor2VehicleTransformEuler", + /* .title = */ "Sensor to Vehicle Frame Transformation Euler", + /* .docs = */ "Sets the sensor-to-vehicle frame transformation using Yaw, Pitch, Roll Euler angles.\nThese are the Yaw, Pitch, and Roll mounting angles of the sensor with respect to vehicle frame of reference,\nand describe the transformation of vectors from the sensor body frame to the vehicle frame.
\nNote: This is the transformation, the inverse of the rotation defined in our legacy products.
\nThe transformation may be stored in the device as a matrix or quaternion. When Euler angles are read back from the device, they may not\nbe exactly equal to the Euler angles used to set the transformation, but they are functionally equivalent, such that they result in the same transformation.
\n

\nThis transformation to the vehicle frame will be applied to the following output quantities:

\nIMU:
\nScaled Acceleration
\nScaled Gyro
\nScaled Magnetometer
\nDelta Theta
\nDelta Velocity
\nComplementary Filter Orientation
\n

\nEstimation Filter:
\nEstimated Orientation, Quaternion
\nEstimated Orientation, Matrix
\nEstimated Orientation, Euler Angles
\nEstimated Linear Acceleration
\nEstimated Angular Rate
\nEstimated Gravity Vector
\n
\nChanging this setting will force all low-pass filters, the complementary filter, and the estimation filter to reset.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::Sensor2VehicleTransformQuaternion::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "q", + /* .docs = */ "Unit length quaternion representing transform [w, i, j, k]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::Sensor2VehicleTransformQuaternion::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::Sensor2VehicleTransformQuaternion; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "q", + /* .docs = */ "Unit length quaternion representing transform [w, i, j, k]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::Sensor2VehicleTransformQuaternion", + /* .title = */ "Sensor to Vehicle Frame Transformation Quaternion", + /* .docs = */ "Set the sensor to vehicle frame transformation using unit length quaternion.\n\nNote: This is the transformation, the inverse of the rotation.\n\nThis quaternion describes the transformation of vectors from the sensor body frame to the vehicle frame of reference, and satisfies the following relationship:
\n\nEQSTART p^{veh} = q^{-1} p^{sen} q EQEND
\n\nWhere:
\nEQSTART q = (q_w, q_x, q_y, q_z) EQEND is the quaternion describing the transformation.
\nEQSTART p^{sen} = (0, v^{sen}_x, v^{sen}_y, v^{sen}_z) EQEND and EQSTART v^{sen} EQEND is a 3-element vector expressed in the sensor body frame.
\nEQSTART p^{veh} = (0, v^{veh}_x, v^{veh}_y, v^{veh}_z) EQEND and EQSTART v^{veh} EQEND is a 3-element vector expressed in the vehicle frame.
\n\nThe transformation may be stored in the device as a matrix or a quaternion. When the quaternion is read back from the device, it may not\nbe exactly equal to the quaternion used to set the transformation, but it is functionally equivalent.
\n

\nThis transformation affects the following output quantities:

\nIMU:
\nScaled Acceleration
\nScaled Gyro
\nScaled Magnetometer
\nDelta Theta
\nDelta Velocity
\n

\nEstimation Filter:
\nEstimated Orientation, Quaternion
\nEstimated Orientation, Matrix
\nEstimated Orientation, Euler Angles
\nEstimated Linear Acceleration
\nEstimated Angular Rate
\nEstimated Gravity Vector
\n
\nChanging this setting will force all low-pass filters, the complementary filter, and the estimation filter to reset.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::Sensor2VehicleTransformDcm::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "dcm", + /* .docs = */ "3 x 3 direction cosine matrix, stored in row-major order", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::Sensor2VehicleTransformDcm::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::Sensor2VehicleTransformDcm; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "dcm", + /* .docs = */ "3 x 3 direction cosine matrix, stored in row-major order", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::Sensor2VehicleTransformDcm", + /* .title = */ "Sensor to Vehicle Frame Transformation Direction Cosine Matrix", + /* .docs = */ "Set the sensor to vehicle frame transformation using a using a 3 x 3 direction cosine matrix EQSTART M_{ned}^{veh} EQEND, stored in row-major order in a 9-element array.\n\nThese angles define the transformation of vectors from the sensor body frame to the fixed vehicle frame, according to:
\nEQSTART v^{veh} = M_{sen}^{veh} v^{sen} EQEND
\n\nWhere:
\n\nEQSTART v^{sen} EQEND is a 3-element vector expressed in the sensor body frame.
\nEQSTART v^{veh} EQEND is the same 3-element vector expressed in the vehicle frame.
\n
\nThe matrix elements are stored is row-major order: EQSTART M_{sen}^{veh} = \\begin{bmatrix} M_{11}, M_{12}, M_{13}, M_{21}, M_{22}, M_{23}, M_{31}, M_{32}, M_{33} \\end{bmatrix} EQEND\nThe transformation may be stored in the device as a matrix or a quaternion. When EQSTART M_{sen}^{veh} EQEND is read back from the device, it may not\nbe exactly equal to array used to set the transformation, but it is functionally equivalent.
\n

\nThis transformation affects the following output quantities:

\nIMU:
\nScaled Acceleration
\nScaled Gyro
\nScaled Magnetometer
\nDelta Theta
\nDelta Velocity
\n

\nEstimation Filter:
\nEstimated Orientation, Quaternion
\nEstimated Orientation, Matrix
\nEstimated Orientation, Euler Angles
\nEstimated Linear Acceleration
\nEstimated Angular Rate
\nEstimated Gravity Vector
\n
\nChanging this setting will force all low-pass filters, the complementary filter, and the estimation filter to reset.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::ComplementaryFilter::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "pitch_roll_enable", + /* .docs = */ "Enable Pitch/Roll corrections", + /* .type = */ {Type::BOOL, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "heading_enable", + /* .docs = */ "Enable Heading corrections (only available on devices with magnetometer)", + /* .type = */ {Type::BOOL, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "pitch_roll_time_constant", + /* .docs = */ "Time constant associated with the pitch/roll corrections [s]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "heading_time_constant", + /* .docs = */ "Time constant associated with the heading corrections [s]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::ComplementaryFilter::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::ComplementaryFilter; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "pitch_roll_enable", + /* .docs = */ "Enable Pitch/Roll corrections", + /* .type = */ {Type::BOOL, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "heading_enable", + /* .docs = */ "Enable Heading corrections (only available on devices with magnetometer)", + /* .type = */ {Type::BOOL, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "pitch_roll_time_constant", + /* .docs = */ "Time constant associated with the pitch/roll corrections [s]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "heading_time_constant", + /* .docs = */ "Time constant associated with the heading corrections [s]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::ComplementaryFilter", + /* .title = */ "Complementary filter settings", + /* .docs = */ "Configure the settings for the complementary filter which produces the following (0x80) descriptor set values: attitude matrix (0x80,09), quaternion (0x80,0A), and Euler angle (0x80,0C) outputs.\n\nThe filter can be configured to correct for pitch and roll using the accelerometer (with the assumption that linear acceleration is minimal),\nand to correct for heading using the magnetometer (with the assumption that the local magnetic field is dominated by the Earth's own magnetic field).\nPitch/roll and heading corrections each have their own configurable time constants, with a valid range of 1-1000 seconds. The default time constant is 10 seconds.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::SensorRangeType; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "ALL", "Only allowed for SAVE, LOAD, and DEFAULT function selectors." }, + { uint32_t(1), "ACCEL", "Accelerometer. Range is specified in g." }, + { uint32_t(2), "GYRO", "Gyroscope. Range is specified in degrees/s." }, + { uint32_t(3), "MAG", "Magnetometer. Range is specified in Gauss." }, + { uint32_t(4), "PRESS", "Pressure sensor. Range is specified in hPa." }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "SensorRangeType", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::SensorRange::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "sensor", + /* .docs = */ "Which type of sensor will get the new range value.", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, true, true, true, true, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "setting", + /* .docs = */ "Use the 3DM Get Calibrated Sensor Ranges (0x0C,0x53) command to determine this value.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::SensorRange::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::SensorRange; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "sensor", + /* .docs = */ "Which type of sensor will get the new range value.", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, true, true, true, true, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "setting", + /* .docs = */ "Use the 3DM Get Calibrated Sensor Ranges (0x0C,0x53) command to determine this value.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::SensorRange", + /* .title = */ "Sensor Range", + /* .docs = */ "Changes the IMU sensor gain.\n\nThis allows you to optimize the range to get the best accuracy and performance\nwhile minimizing over-range events.\n\nUse the 3DM Get Calibrated Sensor Ranges (0x0C,0x53) command to determine\nthe appropriate setting value for your application. Using values other than\nthose specified may result in a NACK or inaccurate measurement data.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::CalibratedSensorRanges::Entry; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "setting", + /* .docs = */ "The value used in the 3DM Sensor Range command and response.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "range", + /* .docs = */ "The actual range value. Units depend on the sensor type.", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline StructInfo value = { + /* .name = */ "Entry", + /* .title = */ "Entry", + /* .docs = */ "", + /* .parameters = */ parameters, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::CalibratedSensorRanges::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "sensor", + /* .docs = */ "The sensor type from the command.", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "num_ranges", + /* .docs = */ "Number of supported ranges.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "ranges", + /* .docs = */ "List of possible range settings.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ {0, microstrain::Index(1) /* num_ranges */}, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::CalibratedSensorRanges::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::CalibratedSensorRanges; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "sensor", + /* .docs = */ "The sensor to query. Cannot be ALL.", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::CalibratedSensorRanges", + /* .title = */ "Get Calibrated Sensor Ranges", + /* .docs = */ "Returns the supported sensor ranges which may be used with the 3DM Sensor Range (0x0C,0x52) command.\n\nThe response includes an array of (u8, float) pairs which map each allowed setting\nto the corresponding maximum range in physical units. See SensorRangeType for units.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::LowpassFilter::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "desc_set", + /* .docs = */ "Descriptor set of the quantity to be filtered.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, true, true, true, true, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "field_desc", + /* .docs = */ "Field descriptor of the quantity to be filtered.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, true, true, true, true, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "enable", + /* .docs = */ "The filter will be enabled if this is true.", + /* .type = */ {Type::BOOL, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "manual", + /* .docs = */ "If false, the frequency parameter is ignored and the filter\nwill track to half of the configured message format frequency.", + /* .type = */ {Type::BOOL, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "frequency", + /* .docs = */ "Cutoff frequency in Hz. This will return the actual frequency\nwhen read out in automatic mode.", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::LowpassFilter::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_3dm::LowpassFilter; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "desc_set", + /* .docs = */ "Descriptor set of the quantity to be filtered.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, true, true, true, true, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "field_desc", + /* .docs = */ "Field descriptor of the quantity to be filtered.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, true, true, true, true, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "enable", + /* .docs = */ "The filter will be enabled if this is true.", + /* .type = */ {Type::BOOL, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "manual", + /* .docs = */ "If false, the frequency parameter is ignored and the filter\nwill track to half of the configured message format frequency.", + /* .type = */ {Type::BOOL, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "frequency", + /* .docs = */ "Cutoff frequency in Hz. This will return the actual frequency\nwhen read out in automatic mode.", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_3dm::LowpassFilter", + /* .title = */ "Low-pass anti-aliasing filter", + /* .docs = */ "This command controls the low-pass anti-aliasing filter supported data quantities.\n\nSee the device user manual for data quantities which support the anti-aliasing filter.\n\nIf set to automatic mode, the frequency will track half of the transmission rate\nof the target descriptor according to the configured message format (0x0C,0x0F).\nFor example, if scaled accel (0x80,0x04) is set to stream at 100 Hz, the filter would\nbe set to 50 Hz. Changing the message format to 200 Hz would automatically adjust the\nfilter to 100 Hz.\n\nFor WRITE, SAVE, LOAD, and DEFAULT function selectors, the descriptor set and/or field descriptor\nmay be 0x00 to set, save, load, or reset the setting for all supported descriptors. The\nfield descriptor must be 0x00 if the descriptor set is 0x00.\n", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + + +static constexpr inline std::initializer_list COMMANDS_3DM = { + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, +}; + + +} // namespace mip::metadata + diff --git a/src/cpp/mip/metadata/definitions/commands_aiding.hpp b/src/cpp/mip/metadata/definitions/commands_aiding.hpp new file mode 100644 index 000000000..474f72eec --- /dev/null +++ b/src/cpp/mip/metadata/definitions/commands_aiding.hpp @@ -0,0 +1,1081 @@ +#pragma once + +#include + +#include + +#include + +namespace mip::metadata +{ + + +template<> +struct MetadataFor +{ + using type = commands_aiding::FrameConfig::Format; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(1), "EULER", "Translation vector followed by euler angles (roll, pitch, yaw)." }, + { uint32_t(2), "QUATERNION", "Translation vector followed by quaternion (w, x, y, z)." }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "Format", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_aiding::FrameConfig::Rotation; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "euler", + /* .docs = */ "Rotation represented as euler angles in RPY format [rad]. Range +/- pi.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {ParameterInfo::Condition::Type::ENUM, microstrain::Index(1) /* format */, static_cast(commands_aiding::FrameConfig::Format::EULER)} /* format == EULER */, + }, + { + /* .name = */ "quaternion", + /* .docs = */ "Rotation represented as a quaternion in WXYZ format.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {ParameterInfo::Condition::Type::ENUM, microstrain::Index(1) /* format */, static_cast(commands_aiding::FrameConfig::Format::QUATERNION)} /* format == QUATERNION */, + }, + }; + + static constexpr inline StructInfo value = { + /* .name = */ "Rotation", + /* .title = */ "Rotation", + /* .docs = */ "", + /* .parameters = */ parameters, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_aiding::FrameConfig::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "frame_id", + /* .docs = */ "Reference frame number. Limit 4.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, true, true, true, true, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "format", + /* .docs = */ "Format of the transformation.", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, true, false, false, false, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "tracking_enabled", + /* .docs = */ "If enabled, the Kalman filter will track errors.", + /* .type = */ {Type::BOOL, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "translation", + /* .docs = */ "Translation X, Y, and Z.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "rotation", + /* .docs = */ "Rotation as specified by format.", + /* .type = */ {Type::UNION, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_aiding::FrameConfig::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_aiding::FrameConfig; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "frame_id", + /* .docs = */ "Reference frame number. Limit 4.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, true, true, true, true, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "format", + /* .docs = */ "Format of the transformation.", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, true, false, false, false, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "tracking_enabled", + /* .docs = */ "If enabled, the Kalman filter will track errors.", + /* .type = */ {Type::BOOL, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "translation", + /* .docs = */ "Translation X, Y, and Z.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "rotation", + /* .docs = */ "Rotation as specified by format.", + /* .type = */ {Type::UNION, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_aiding::FrameConfig", + /* .title = */ "Frame Configuration", + /* .docs = */ "Defines an aiding frame associated with a specific sensor frame ID.\nThe frame ID used in this command should mirror the frame ID used in the aiding command\n(if that aiding measurement is measured in this reference frame).\n\nThis transform satisfies the following relationship:\n\nEQSTART p^{veh} = R p^{sensor_frame} + t EQEND
\n\nWhere:
\nEQSTART R EQEND is rotation matrix defined by the rotation component and EQSTART t EQEND is the translation vector

\nEQSTART p^{sensor_frame} EQEND is a 3-element position vector expressed in the external sensor frame
\nEQSTART p^{veh} EQEND is a 3-element position vector expressed in the vehicle frame
\n\nRotation can be defined using Euler angles OR quaternions. If Format selector is set to Euler Angles, the fourth element\nin the rotation vector is ignored and should be set to 0.\n\nWhen the tracking_enabled flag is 1, the Kalman filter will track errors in the provided frame definition; when 0, no errors are tracked.\n\nExample: GNSS antenna lever arm\n\nFrame ID: 1\nFormat: 1 (Euler)\nTranslation: [0,1,] (GNSS with a 1 meter Y offset in the vehicle frame)\nRotation: [0,0,0,0] (Rotational component is not relevant for GNSS measurements, set to zero)\n", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_aiding::EchoControl::Mode; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "SUPPRESS_ACK", "Suppresses the usual command ack field for aiding messages." }, + { uint32_t(1), "STANDARD", "Normal ack/nack behavior." }, + { uint32_t(2), "RESPONSE", "Echo the data back as a response." }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "Mode", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_aiding::EchoControl::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "mode", + /* .docs = */ "Controls data echoing.", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_aiding::EchoControl::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_aiding::EchoControl; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "mode", + /* .docs = */ "Controls data echoing.", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_aiding::EchoControl", + /* .title = */ "Aiding Command Echo Control", + /* .docs = */ "Controls command response behavior to external aiding commands", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_aiding::Time::Timebase; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(1), "INTERNAL_REFERENCE", "Timestamp provided is with respect to internal clock." }, + { uint32_t(2), "EXTERNAL_TIME", "Timestamp provided is with respect to external clock, synced by PPS source." }, + { uint32_t(3), "TIME_OF_ARRIVAL", "Timestamp provided is a fixed latency relative to time of message arrival." }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "Timebase", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_aiding::Time; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "timebase", + /* .docs = */ "Timebase reference, e.g. internal, external, GPS, UTC, etc.", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "reserved", + /* .docs = */ "Reserved, set to 0x01.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "nanoseconds", + /* .docs = */ "Nanoseconds since the timebase epoch.", + /* .type = */ {Type::U64, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline StructInfo value = { + /* .name = */ "Time", + /* .title = */ "Time", + /* .docs = */ "", + /* .parameters = */ parameters, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_aiding::PosEcef::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "X", "" }, + { uint32_t(2), "Y", "" }, + { uint32_t(4), "Z", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_aiding::PosEcef; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "time", + /* .docs = */ "Timestamp of the measurement.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "frame_id", + /* .docs = */ "Source ID for this estimate (source_id == 0 indicates this sensor, source_id > 0 indicates an external estimate).", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "position", + /* .docs = */ "ECEF position [m].", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "uncertainty", + /* .docs = */ "ECEF position uncertainty [m]. Cannot be 0 unless the corresponding valid flags are 0.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "Valid flags. Axes with 0 will be completely ignored.", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_aiding::PosEcef", + /* .title = */ "ECEF Position", + /* .docs = */ "Cartesian vector position aiding command. Coordinates are given in the WGS84 ECEF system.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_aiding::PosLlh::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "Latitude", "" }, + { uint32_t(2), "Longitude", "" }, + { uint32_t(4), "Height", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_aiding::PosLlh; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "time", + /* .docs = */ "Timestamp of the measurement.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "frame_id", + /* .docs = */ "Source ID for this estimate (source_id == 0 indicates this sensor, source_id > 0 indicates an external estimate).", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "latitude", + /* .docs = */ "[deg]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "longitude", + /* .docs = */ "[deg]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "height", + /* .docs = */ "[m]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "uncertainty", + /* .docs = */ "NED position uncertainty. Cannot be 0 unless the corresponding valid flags are 0.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "Valid flags. Axes with 0 will be completely ignored.", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_aiding::PosLlh", + /* .title = */ "LLH Position", + /* .docs = */ "Geodetic position aiding command.\nCoordinates are given in WGS84 geodetic latitude, longitude, and height above the ellipsoid.\nUncertainty is given in NED coordinates, which are parallel to incremental changes in latitude, longitude, and height.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_aiding::HeightAboveEllipsoid; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "time", + /* .docs = */ "Timestamp of the measurement.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "frame_id", + /* .docs = */ "Source ID for this estimate (source_id == 0 indicates this sensor, source_id > 0 indicates an external estimate).", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "height", + /* .docs = */ "[m]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "uncertainty", + /* .docs = */ "[m]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_aiding::HeightAboveEllipsoid", + /* .title = */ "Height Above Ellipsoid", + /* .docs = */ "Estimated value of the height above ellipsoid.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_aiding::VelEcef::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "X", "" }, + { uint32_t(2), "Y", "" }, + { uint32_t(4), "Z", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_aiding::VelEcef; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "time", + /* .docs = */ "Timestamp of the measurement.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "frame_id", + /* .docs = */ "Source ID for this estimate (source_id == 0 indicates this sensor, source_id > 0 indicates an external estimate).", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "velocity", + /* .docs = */ "ECEF velocity [m/s].", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "uncertainty", + /* .docs = */ "ECEF velocity uncertainty [m/s]. Cannot be 0 unless the corresponding valid flags are 0.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "Valid flags. Axes with 0 will be completely ignored.", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_aiding::VelEcef", + /* .title = */ "ECEF Velocity", + /* .docs = */ "ECEF velocity aiding command. Coordinates are given in the WGS84 ECEF frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_aiding::VelNed::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "X", "" }, + { uint32_t(2), "Y", "" }, + { uint32_t(4), "Z", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_aiding::VelNed; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "time", + /* .docs = */ "Timestamp of the measurement.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "frame_id", + /* .docs = */ "Source ID for this estimate (source_id == 0 indicates this sensor, source_id > 0 indicates an external estimate).", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "velocity", + /* .docs = */ "NED velocity [m/s].", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "uncertainty", + /* .docs = */ "NED velocity uncertainty [m/s]. Cannot be 0 unless the corresponding valid flags are 0.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "Valid flags. Axes with 0 will be completely ignored.", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_aiding::VelNed", + /* .title = */ "NED Velocity", + /* .docs = */ "NED velocity aiding command. Coordinates are given in the local North-East-Down frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_aiding::VelBodyFrame::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "X", "" }, + { uint32_t(2), "Y", "" }, + { uint32_t(4), "Z", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_aiding::VelBodyFrame; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "time", + /* .docs = */ "Timestamp of the measurement.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "frame_id", + /* .docs = */ "Source ID for this estimate (source_id == 0 indicates this sensor, source_id > 0 indicates an external estimate).", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "velocity", + /* .docs = */ "[m/s]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "uncertainty", + /* .docs = */ "[m/s] 1-sigma uncertainty. Cannot be 0 unless the corresponding valid flags are 0.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "Valid flags. Axes with 0 will be completely ignored.", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_aiding::VelBodyFrame", + /* .title = */ "Body Frame Velocity", + /* .docs = */ "Estimated of velocity of the vehicle in the frame associated with the given sensor ID, relative to the vehicle frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_aiding::HeadingTrue; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "time", + /* .docs = */ "Timestamp of the measurement.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "frame_id", + /* .docs = */ "Source ID for this estimate (source_id == 0 indicates this sensor, source_id > 0 indicates an external estimate).", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "heading", + /* .docs = */ "Heading [radians]. Range +/- Pi.", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "uncertainty", + /* .docs = */ "Cannot be 0 unless the valid flags are 0.", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_aiding::HeadingTrue", + /* .title = */ "True Heading", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_aiding::MagneticField::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "X", "" }, + { uint32_t(2), "Y", "" }, + { uint32_t(4), "Z", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_aiding::MagneticField; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "time", + /* .docs = */ "Timestamp of the measurement.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "frame_id", + /* .docs = */ "Source ID for this estimate (source_id == 0 indicates this sensor, source_id > 0 indicates an external estimate).", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "magnetic_field", + /* .docs = */ "[G]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "uncertainty", + /* .docs = */ "[G] 1-sigma uncertainty. Cannot be 0 unless the corresponding valid flags are 0.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "Valid flags. Axes with 0 will be completely ignored.", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_aiding::MagneticField", + /* .title = */ "Magnetic Field", + /* .docs = */ "Estimate of magnetic field in the frame associated with the given sensor ID.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_aiding::Pressure; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "time", + /* .docs = */ "Timestamp of the measurement.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "frame_id", + /* .docs = */ "Source ID for this estimate (source_id == 0 indicates this sensor, source_id > 0 indicates an external estimate).", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "pressure", + /* .docs = */ "[mbar]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "uncertainty", + /* .docs = */ "[mbar] 1-sigma uncertainty. Cannot be 0 unless the valid flags are 0.", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_aiding::Pressure", + /* .title = */ "Pressure", + /* .docs = */ "Estimated value of air pressure.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + + +static constexpr inline std::initializer_list COMMANDS_AIDING = { + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, +}; + + +} // namespace mip::metadata + diff --git a/src/cpp/mip/metadata/definitions/commands_base.hpp b/src/cpp/mip/metadata/definitions/commands_base.hpp new file mode 100644 index 000000000..a8b12c207 --- /dev/null +++ b/src/cpp/mip/metadata/definitions/commands_base.hpp @@ -0,0 +1,557 @@ +#pragma once + +#include + +#include + +#include + +namespace mip::metadata +{ + + +template<> +struct MetadataFor +{ + using type = commands_base::Ping; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_base::Ping", + /* .title = */ "Ping", + /* .docs = */ "Test Communications with a device.\n\nThe Device will respond with an ACK, if present and operating correctly.\n\nIf the device is not in a normal operating mode, it may NACK.", + /* .parameters = */ {}, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_base::SetIdle; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_base::SetIdle", + /* .title = */ "Set to idle", + /* .docs = */ "Turn off all device data streams.\n\nThe Device will respond with an ACK, if present and operating correctly.\nThis command will suspend streaming (if enabled) or wake the device from sleep (if sleeping) to allow it to respond to status and setup commands.\nYou may restore the device mode by issuing the Resume command.", + /* .parameters = */ {}, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_base::BaseDeviceInfo; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "firmware_version", + /* .docs = */ "", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "model_name", + /* .docs = */ "", + /* .type = */ {Type::CHAR, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 16, + /* .condition = */ {}, + }, + { + /* .name = */ "model_number", + /* .docs = */ "", + /* .type = */ {Type::CHAR, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 16, + /* .condition = */ {}, + }, + { + /* .name = */ "serial_number", + /* .docs = */ "", + /* .type = */ {Type::CHAR, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 16, + /* .condition = */ {}, + }, + { + /* .name = */ "lot_number", + /* .docs = */ "", + /* .type = */ {Type::CHAR, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 16, + /* .condition = */ {}, + }, + { + /* .name = */ "device_options", + /* .docs = */ "", + /* .type = */ {Type::CHAR, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 16, + /* .condition = */ {}, + }, + }; + + static constexpr inline StructInfo value = { + /* .name = */ "BaseDeviceInfo", + /* .title = */ "Base Device Info", + /* .docs = */ "", + /* .parameters = */ parameters, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_base::GetDeviceInfo::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "device_info", + /* .docs = */ "", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_base::GetDeviceInfo::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_base::GetDeviceInfo; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_base::GetDeviceInfo", + /* .title = */ "Get device information", + /* .docs = */ "Get the device ID strings and firmware version number.", + /* .parameters = */ {}, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_base::GetDeviceDescriptors::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "descriptors", + /* .docs = */ "", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ {0, microstrain::Index(1) /* descriptors_count */}, + /* .condition = */ {}, + }, + { + /* .name = */ "descriptors_count", + /* .docs = */ "", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {false, false, false, false, false, /*echo*/false, /*virtual*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_base::GetDeviceDescriptors::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_base::GetDeviceDescriptors; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_base::GetDeviceDescriptors", + /* .title = */ "Get device descriptors", + /* .docs = */ "Get the command and data descriptors supported by the device.\n\nReply has two fields: 'ACK/NACK' and 'Descriptors'. The 'Descriptors' field is an array of 16 bit values.\nThe MSB specifies the descriptor set and the LSB specifies the descriptor.", + /* .parameters = */ {}, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_base::BuiltInTest::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "result", + /* .docs = */ "", + /* .type = */ {Type::U32, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_base::BuiltInTest::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_base::BuiltInTest; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_base::BuiltInTest", + /* .title = */ "Built in test", + /* .docs = */ "Run the device Built-In Test (BIT).\n\nThe Built-In Test command always returns a 32 bit value.\nA value of 0 means that all tests passed.\nA non-zero value indicates that not all tests passed.\nReference the device user manual to decode the result.", + /* .parameters = */ {}, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_base::Resume; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_base::Resume", + /* .title = */ "Resume", + /* .docs = */ "Take the device out of idle mode.\n\nThe device responds with ACK upon success.", + /* .parameters = */ {}, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_base::GetExtendedDescriptors::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "descriptors", + /* .docs = */ "", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ {0, microstrain::Index(1) /* descriptors_count */}, + /* .condition = */ {}, + }, + { + /* .name = */ "descriptors_count", + /* .docs = */ "", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {false, false, false, false, false, /*echo*/false, /*virtual*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_base::GetExtendedDescriptors::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_base::GetExtendedDescriptors; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_base::GetExtendedDescriptors", + /* .title = */ "Get device descriptors (extended)", + /* .docs = */ "Get the command and data descriptors supported by the device.\n\nReply has two fields: 'ACK/NACK' and 'Descriptors'. The 'Descriptors' field is an array of 16 bit values.\nThe MSB specifies the descriptor set and the LSB specifies the descriptor.", + /* .parameters = */ {}, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_base::ContinuousBit::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "result", + /* .docs = */ "Device-specific bitfield (128 bits). See device user manual.\nBits are least-significant-byte first. For example, bit 0 is\nlocated at bit 0 of result[0], bit 1 is located at bit 1 of result[0],\nbit 8 is located at bit 0 of result[1], and bit 127 is located at bit\n7 of result[15].", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 16, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_base::ContinuousBit::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_base::ContinuousBit; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_base::ContinuousBit", + /* .title = */ "Continuous built-in test", + /* .docs = */ "Report result of continuous built-in test.\n\nThis test is non-disruptive but is not as thorough as the commanded BIT.", + /* .parameters = */ {}, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_base::CommSpeed::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "port", + /* .docs = */ "Port ID number, starting with 1. When function is SAVE, LOAD, or DEFAULT, this can be 0 to apply to all ports. See the device user manual for details.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, true, true, true, true, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "baud", + /* .docs = */ "Port baud rate. Must be a supported rate.", + /* .type = */ {Type::U32, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_base::CommSpeed::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_base::CommSpeed; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "port", + /* .docs = */ "Port ID number, starting with 1. When function is SAVE, LOAD, or DEFAULT, this can be 0 to apply to all ports. See the device user manual for details.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, true, true, true, true, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "baud", + /* .docs = */ "Port baud rate. Must be a supported rate.", + /* .type = */ {Type::U32, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_base::CommSpeed", + /* .title = */ "Comm Port Speed", + /* .docs = */ "Controls the baud rate of a specific port on the device.\n\nPlease see the device user manual for supported baud rates on each port.\n\nThe device will wait until all incoming and outgoing data has been sent, up\nto a maximum of 250 ms, before applying any change.\n\nNo guarantee is provided as to what happens to commands issued during this\ndelay period; They may or may not be processed and any responses aren't\nguaranteed to be at one rate or the other. The same applies to data packets.\n\nIt is highly recommended that the device be idle before issuing this command\nand that it be issued in its own packet. Users should wait 250 ms after\nsending this command before further interaction.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_base::GpsTimeUpdate::FieldId; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(1), "WEEK_NUMBER", "Week number." }, + { uint32_t(2), "TIME_OF_WEEK", "Time of week in seconds." }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "field_id", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_base::GpsTimeUpdate; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "field_id", + /* .docs = */ "Determines how to interpret value.", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "value", + /* .docs = */ "Week number or time of week, depending on the field_id.", + /* .type = */ {Type::U32, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_base::GpsTimeUpdate", + /* .title = */ "GPS Time Update Command", + /* .docs = */ "Set device internal GPS time\nWhen combined with a PPS input signal applied to the I/O connector, this command enables complete synchronization of data outputs\nwith an external time base, such as GPS system time. Since the hardware PPS synchronization can only detect the fractional number of seconds when pulses arrive,\ncomplete synchronization requires that the user provide the whole number of seconds via this command. After achieving PPS synchronization, this command should be sent twice: once to set the time-of-week and once to set the week number. PPS synchronization can be verified by monitoring the time sync status message (0xA0, 0x02) or the valid flags of any shared external timestamp (0x--, D7) data field.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, false, false, false, false}, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_base::SoftReset; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_base::SoftReset", + /* .title = */ "Reset device", + /* .docs = */ "Resets the device.\n\nDevice responds with ACK and immediately resets.", + /* .parameters = */ {}, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + + +static constexpr inline std::initializer_list COMMANDS_BASE = { + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, +}; + + +} // namespace mip::metadata + diff --git a/src/cpp/mip/metadata/definitions/commands_filter.hpp b/src/cpp/mip/metadata/definitions/commands_filter.hpp new file mode 100644 index 000000000..006128be0 --- /dev/null +++ b/src/cpp/mip/metadata/definitions/commands_filter.hpp @@ -0,0 +1,4141 @@ +#pragma once + +#include + +#include + +#include + +namespace mip::metadata +{ + + +template<> +struct MetadataFor +{ + using type = commands_filter::Reset; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::Reset", + /* .title = */ "Reset Navigation Filter", + /* .docs = */ "Resets the filter to the initialization state.\n\nIf the auto-initialization feature is disabled, the initial attitude or heading must be set in\norder to enter the run state after a reset.", + /* .parameters = */ {}, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::SetInitialAttitude; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "roll", + /* .docs = */ "[radians]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "pitch", + /* .docs = */ "[radians]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "heading", + /* .docs = */ "[radians]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::SetInitialAttitude", + /* .title = */ "Set Initial Attitude", + /* .docs = */ "Set the sensor initial attitude.\n\nThis command can only be issued in the 'Init' state and should be used with a good\nestimate of the vehicle attitude. The Euler angles are the sensor body frame with respect\nto the NED frame.\n\nThe valid input ranges are as follows:\n\nRoll: [-pi, pi]\nPitch: [-pi/2, pi/2]\nHeading: [-pi, pi]\n", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::EstimationControl::EnableFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "gyro_bias", "" }, + { uint32_t(2), "accel_bias", "" }, + { uint32_t(4), "gyro_scale_factor", "" }, + { uint32_t(8), "accel_scale_factor", "" }, + { uint32_t(16), "antenna_offset", "" }, + { uint32_t(32), "auto_mag_hard_iron", "" }, + { uint32_t(64), "auto_mag_soft_iron", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "EnableFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::EstimationControl::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "enable", + /* .docs = */ "See above", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::EstimationControl::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::EstimationControl; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "enable", + /* .docs = */ "See above", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::EstimationControl", + /* .title = */ "Estimation Control Flags", + /* .docs = */ "Estimation Control Flags\n\nControls which parameters are estimated by the Kalman Filter.\n\nDesired settings should be logically ORed together.\n\nExamples:\n\n0x0001 - Enable Gyro Bias Estimation Only\n0x0063 - Enable Gyro Bias, Accel Bias, and Mag Auto Hard and Soft Iron Cal States Only\n", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::ExternalGnssUpdate; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "gps_time", + /* .docs = */ "[seconds]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "gps_week", + /* .docs = */ "[GPS week number, not modulus 1024]", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "latitude", + /* .docs = */ "[degrees]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "longitude", + /* .docs = */ "[degrees]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "height", + /* .docs = */ "Above WGS84 ellipsoid [meters]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "velocity", + /* .docs = */ "NED Frame [meters/second]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "pos_uncertainty", + /* .docs = */ "NED Frame, 1-sigma [meters]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "vel_uncertainty", + /* .docs = */ "NED Frame, 1-sigma [meters/second]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::ExternalGnssUpdate", + /* .title = */ "External GNSS Update", + /* .docs = */ "Provide a filter measurement from an external GNSS\n\nThe GNSS source control must be set to 'external' for this command to succeed, otherwise it will be NACK'd.\nPlease refer to your device user manual for information on the maximum rate of this message.\n", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::ExternalHeadingUpdate; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "heading", + /* .docs = */ "Bounded by +-PI [radians]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "heading_uncertainty", + /* .docs = */ "1-sigma [radians]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "type", + /* .docs = */ "1 - True, 2 - Magnetic", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::ExternalHeadingUpdate", + /* .title = */ "External Heading Update", + /* .docs = */ "Provide a filter measurement from an external heading source\n\nThe heading must be the sensor frame with respect to the NED frame.\n\nThe heading update control must be set to external for this command to update the filter; otherwise it is NACK'd.\nHeading angle uncertainties of <= 0.0 will be NACK'd\n\nPlease refer to your device user manual for information on the maximum rate of this message.\n\nOn -25 models, if the declination source (0x0D, 0x43) is not valid, true heading updates will be NACK'd.\nOn -45 models, if the declination source is invalid, magnetic heading updates will be NACK'd.\n\n", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::ExternalHeadingUpdateWithTime; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "gps_time", + /* .docs = */ "[seconds]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "gps_week", + /* .docs = */ "[GPS week number, not modulus 1024]", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "heading", + /* .docs = */ "Relative to true north, bounded by +-PI [radians]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "heading_uncertainty", + /* .docs = */ "1-sigma [radians]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "type", + /* .docs = */ "1 - True, 2 - Magnetic", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::ExternalHeadingUpdateWithTime", + /* .title = */ "External Heading Update With Time", + /* .docs = */ "Provide a filter measurement from an external heading source at a specific GPS time\n\nThis is more accurate than the External Heading Update (0x0D, 0x17) and should be used in applications\nwhere the rate of heading change will cause significant measurement error due to the sampling, transmission,\nand processing time required. Accurate time stamping of the heading information is important.\n\nThe heading must be the sensor frame with respect to the NED frame.\n\nThe heading update control must be set to external for this command to update the filter; otherwise it is NACK'd.\nHeading angle uncertainties of <= 0.0 will be NACK'd\n\nPlease refer to your device user manual for information on the maximum rate of this message.\n\nOn -25 models, if the declination source (0x0D, 0x43) is not valid, true heading updates will be NACK'd.\nOn -45 models, if the declination source is invalid, magnetic heading updates will be NACK'd.\n\n", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::TareOrientation::MipTareAxes; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "roll", "" }, + { uint32_t(2), "pitch", "" }, + { uint32_t(4), "yaw", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "MipTareAxes", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::TareOrientation::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "axes", + /* .docs = */ "Axes to tare", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::TareOrientation::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::TareOrientation; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "axes", + /* .docs = */ "Axes to tare", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::TareOrientation", + /* .title = */ "Tare Sensor Orientation", + /* .docs = */ "Tare the device orientation.\n\nThis function uses the current device orientation relative to the NED frame as the current sensor to vehicle transformation.\nThis command is provided as a convenient way to set the sensor to vehicle frame transformation.\nThe filter must be initialized and have a valid attitude output. If the attitude is not valid, an error will be returned.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::VehicleDynamicsMode::DynamicsMode; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(1), "PORTABLE", "" }, + { uint32_t(2), "AUTOMOTIVE", "" }, + { uint32_t(3), "AIRBORNE", "" }, + { uint32_t(4), "AIRBORNE_HIGH_G", "" }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "DynamicsMode", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::VehicleDynamicsMode::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "mode", + /* .docs = */ "", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::VehicleDynamicsMode::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::VehicleDynamicsMode; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "mode", + /* .docs = */ "", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::VehicleDynamicsMode", + /* .title = */ "Vehicle Dynamics Mode", + /* .docs = */ "Controls the vehicle dynamics mode.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::SensorToVehicleRotationEuler::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "roll", + /* .docs = */ "[radians]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "pitch", + /* .docs = */ "[radians]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "yaw", + /* .docs = */ "[radians]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::SensorToVehicleRotationEuler::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::SensorToVehicleRotationEuler; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "roll", + /* .docs = */ "[radians]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "pitch", + /* .docs = */ "[radians]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "yaw", + /* .docs = */ "[radians]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::SensorToVehicleRotationEuler", + /* .title = */ "Sensor to Vehicle Frame Rotation Euler", + /* .docs = */ "Set the sensor to vehicle frame rotation using Yaw, Pitch, Roll Euler angles.\n\nNote: This is the rotation, the inverse of the transformation.\nThese angles define the rotation from the sensor body frame to the fixed vehicle frame.
\nPlease reference the device Theory of Operation for more information.
\nThe rotation is stored in the device as a quaternion. When Euler angles are read back from the device, they may not\nbe equivalent in value to the Euler angles used to set the rotation, but they are functionally equivalent.
\n

\nThis rotation affects the following output quantities:

\nIMU:
\nScaled Acceleration
\nScaled Gyro
\nScaled Magnetometer
\nDelta Theta
\nDelta Velocity
\n

\nEstimation Filter:
\nEstimated Orientation, Quaternion
\nEstimated Orientation, Matrix
\nEstimated Orientation, Euler Angles
\nEstimated Linear Acceleration
\nEstimated Angular Rate
\nEstimated Gravity Vector
", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::SensorToVehicleRotationDcm::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "dcm", + /* .docs = */ "", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::SensorToVehicleRotationDcm::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::SensorToVehicleRotationDcm; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "dcm", + /* .docs = */ "", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::SensorToVehicleRotationDcm", + /* .title = */ "Sensor to Vehicle Frame Rotation DCM", + /* .docs = */ "Set the sensor to vehicle frame rotation using a row-major direction cosine matrix.\n\nNote: This is the rotation, the inverse of the transformation.\nThis matrix defines the rotation from the sensor body frame to the fixed vehicle frame.
\nPlease reference the device Theory of Operation for more information.
\nThe matrix must be orthonormal (tolerance 1e-3) or the device will NACK the command.\nThe rotation is stored in the device as a quaternion. When the DCM is read back from the device, the components may not\nbe exactly equivalent in value to the DCM used to set the rotation, but they are functionally equivalent.
\n
\nMatrix element order:

\n\nEQSTART T_{SEN}^{VEH} = \\begin{bmatrix} 0 & 1 & 2\\\\ 3 & 4 & 5\\\\ 6 & 7 & 8 \\end{bmatrix} EQEND\n\n

\nThis rotation affects the following output quantities:

\nIMU:
\nScaled Acceleration
\nScaled Gyro
\nScaled Magnetometer
\nDelta Theta
\nDelta Velocity
\n

\nEstimation Filter:
\nEstimated Orientation, Quaternion
\nEstimated Orientation, Matrix
\nEstimated Orientation, Euler Angles
\nEstimated Linear Acceleration
\nEstimated Angular Rate
\nEstimated Gravity Vector
", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::SensorToVehicleRotationQuaternion::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "quat", + /* .docs = */ "", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::SensorToVehicleRotationQuaternion::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::SensorToVehicleRotationQuaternion; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "quat", + /* .docs = */ "", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::SensorToVehicleRotationQuaternion", + /* .title = */ "Sensor to Vehicle Frame Rotation Quaternion", + /* .docs = */ "Set the sensor to vehicle frame rotation using a quaternion.\n\nNote: This is the rotation, the inverse of the transformation.\nThis quaternion defines the rotation from the sensor body frame to the fixed vehicle frame.
\nPlease reference the device Theory of Operation for more information.
\nThe quaternion must be unit length (tolerance 1e-3) or the device will NACK the command.\nThe rotation is stored in the device as a unit quaternion. When the quaternion elements are read back from the device, they may not\nbe equivalent in value to the quaternion used to set the rotation, due to normalization.
\n
\nQuaternion element definition:

\n
\nEQSTART Q_{SEN}^{VEH} = \\begin{bmatrix} q_{0} & q_{1}*i & q_{2}*j & q_{3}*k \\end{bmatrix} EQEND\n

\nThis rotation affects the following output quantities:

\nIMU:
\nScaled Acceleration
\nScaled Gyro
\nScaled Magnetometer
\nDelta Theta
\nDelta Velocity
\n

\nEstimation Filter:
\nEstimated Orientation, Quaternion
\nEstimated Orientation, Matrix
\nEstimated Orientation, Euler Angles
\nEstimated Linear Acceleration
\nEstimated Angular Rate
\nEstimated Gravity Vector
", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::SensorToVehicleOffset::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "offset", + /* .docs = */ "[meters]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::SensorToVehicleOffset::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::SensorToVehicleOffset; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "offset", + /* .docs = */ "[meters]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::SensorToVehicleOffset", + /* .title = */ "Sensor to Vehicle Frame Offset", + /* .docs = */ "Set the sensor to vehicle frame offset, expressed in the sensor frame.\n\nThis is a simple offset, not a lever arm. It does not compensate for inertial effects experienced from being offset from the center of gravity/rotation of the vehicle.\nIt simply adds the offset to the position output to express it in the origin of the user's vehicle frame.\n\nThis offset affects the following output quantities:\nEstimated LLH Position\n\nThe magnitude of the offset vector is limited to 10 meters", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::AntennaOffset::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "offset", + /* .docs = */ "[meters]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::AntennaOffset::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::AntennaOffset; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "offset", + /* .docs = */ "[meters]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::AntennaOffset", + /* .title = */ "GNSS Antenna Offset Control", + /* .docs = */ "Configure the GNSS antenna offset.\n\nFor 5-series products, this is expressed in the sensor frame, from the sensor origin to the GNSS antenna RF center.\n\nFor 7-series products, this is expressed in the vehicle frame, from the sensor origin to the GNSS antenna RF center.\n\nThis command should also be used for CV7 / GV7-INS NMEA Input over GPIO.\n\nThe magnitude of the offset vector is limited to 10 meters\n", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::GnssSource::Source; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(1), "ALL_INT", "All internal receivers" }, + { uint32_t(2), "EXT", "External GNSS messages provided by user" }, + { uint32_t(3), "INT_1", "Internal GNSS Receiver 1 only" }, + { uint32_t(4), "INT_2", "Internal GNSS Receiver 2 only" }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "Source", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::GnssSource::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "source", + /* .docs = */ "", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::GnssSource::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::GnssSource; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "source", + /* .docs = */ "", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::GnssSource", + /* .title = */ "GNSS Aiding Source Control", + /* .docs = */ "Control the source of GNSS information used to update the Kalman Filter.\n\nChanging the GNSS source while the sensor is in the 'running' state may temporarily place\nit back in the 'init' state until the new source of GNSS data is received.\n", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::HeadingSource::Source; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "NONE", "See note 3" }, + { uint32_t(1), "MAG", "" }, + { uint32_t(2), "GNSS_VEL", "See notes 1,2" }, + { uint32_t(3), "EXTERNAL", "" }, + { uint32_t(4), "GNSS_VEL_AND_MAG", "" }, + { uint32_t(5), "GNSS_VEL_AND_EXTERNAL", "" }, + { uint32_t(6), "MAG_AND_EXTERNAL", "" }, + { uint32_t(7), "GNSS_VEL_AND_MAG_AND_EXTERNAL", "" }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "Source", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::HeadingSource::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "source", + /* .docs = */ "", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::HeadingSource::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::HeadingSource; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "source", + /* .docs = */ "", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::HeadingSource", + /* .title = */ "Heading Aiding Source Control", + /* .docs = */ "Control the source of heading information used to update the Kalman Filter.\n\n1. To use internal GNSS velocity vector for heading updates, the target application\nmust have minimal (preferably no) side-slip. This option is good for wheeled vehicles.\n\n2. On some devices, when using GNSS velocity vector for heading updates, the X-axis of the device\nmust align with the direction of travel. Please reference the user guide for your particular device to\ndetermine if this limitation is applicable.\n\n3. When none is selected, the heading estimate can still converge if GNSS is available and sufficient dynamic motion\n(change in direction of travel and acceleration) is experienced. The heading may drift when: stationary, traveling\nat a constant speed, or during a constant course over ground.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::AutoInitControl::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "enable", + /* .docs = */ "See above", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::AutoInitControl::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::AutoInitControl; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "enable", + /* .docs = */ "See above", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::AutoInitControl", + /* .title = */ "Auto-initialization Control", + /* .docs = */ "Filter Auto-initialization Control\n\nEnable/Disable automatic initialization upon device startup.\n\nPossible enable values:\n\n0x00 - Disable auto-initialization\n0x01 - Enable auto-initialization\n", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::AccelNoise::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "noise", + /* .docs = */ "Accel Noise 1-sigma [meters/second^2]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::AccelNoise::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::AccelNoise; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "noise", + /* .docs = */ "Accel Noise 1-sigma [meters/second^2]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::AccelNoise", + /* .title = */ "Accelerometer Noise Standard Deviation", + /* .docs = */ "Accelerometer Noise Standard Deviation\n\nEach of the noise values must be greater than 0.0.\n\nThe noise value represents process noise in the Estimation Filter.\nChanging this value modifies how the filter responds to dynamic input and can be used to tune the performance of the filter.\nDefault values provide good performance for most laboratory conditions.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::GyroNoise::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "noise", + /* .docs = */ "Gyro Noise 1-sigma [rad/second]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::GyroNoise::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::GyroNoise; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "noise", + /* .docs = */ "Gyro Noise 1-sigma [rad/second]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::GyroNoise", + /* .title = */ "Gyroscope Noise Standard Deviation", + /* .docs = */ "Gyroscope Noise Standard Deviation\n\nEach of the noise values must be greater than 0.0\n\nThe noise value represents process noise in the Estimation Filter.\nChanging this value modifies how the filter responds to dynamic input and can be used to tune the performance of the filter.\nDefault values provide good performance for most laboratory conditions.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::AccelBiasModel::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "beta", + /* .docs = */ "Accel Bias Beta [1/second]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "noise", + /* .docs = */ "Accel Noise 1-sigma [meters/second^2]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::AccelBiasModel::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::AccelBiasModel; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "beta", + /* .docs = */ "Accel Bias Beta [1/second]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "noise", + /* .docs = */ "Accel Noise 1-sigma [meters/second^2]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::AccelBiasModel", + /* .title = */ "Accelerometer Bias Model Parameters", + /* .docs = */ "Accelerometer Bias Model Parameters\n\nNoise values must be greater than 0.0\n", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::GyroBiasModel::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "beta", + /* .docs = */ "Gyro Bias Beta [1/second]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "noise", + /* .docs = */ "Gyro Noise 1-sigma [rad/second]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::GyroBiasModel::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::GyroBiasModel; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "beta", + /* .docs = */ "Gyro Bias Beta [1/second]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "noise", + /* .docs = */ "Gyro Noise 1-sigma [rad/second]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::GyroBiasModel", + /* .title = */ "Gyroscope Bias Model Parameters", + /* .docs = */ "Gyroscope Bias Model Parameters\n\nNoise values must be greater than 0.0\n", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::AltitudeAiding::AidingSelector; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "NONE", "No altitude aiding" }, + { uint32_t(1), "PRESURE", "Enable pressure sensor aiding" }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "AidingSelector", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::AltitudeAiding::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "selector", + /* .docs = */ "See above", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::AltitudeAiding::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::AltitudeAiding; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "selector", + /* .docs = */ "See above", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::AltitudeAiding", + /* .title = */ "Altitude Aiding Control", + /* .docs = */ "Select altitude input for absolute altitude and/or vertical velocity. The primary altitude reading is always GNSS.\nAiding inputs are used to improve GNSS altitude readings when GNSS is available and to backup GNSS during outages.\n\nPressure altitude is based on 'instant sea level pressure' which is dependent on location and weather conditions and can vary by more than 40 meters.\n", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::PitchRollAiding::AidingSource; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "NONE", "No pitch/roll aiding" }, + { uint32_t(1), "GRAVITY_VEC", "Enable gravity vector aiding" }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "AidingSource", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::PitchRollAiding::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "source", + /* .docs = */ "Controls the aiding source", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::PitchRollAiding::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::PitchRollAiding; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "source", + /* .docs = */ "Controls the aiding source", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::PitchRollAiding", + /* .title = */ "Pitch/Roll Aiding Control", + /* .docs = */ "Select pitch/roll aiding input. Pitch/roll reading is always derived from GNSS corrected inertial solution.\nAiding inputs are used to improve that solution during periods of low dynamics and GNSS outages.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::AutoZupt::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "enable", + /* .docs = */ "0 - Disable, 1 - Enable", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "threshold", + /* .docs = */ "[meters/second]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::AutoZupt::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::AutoZupt; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "enable", + /* .docs = */ "0 - Disable, 1 - Enable", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "threshold", + /* .docs = */ "[meters/second]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::AutoZupt", + /* .title = */ "Zero Velocity Update Control", + /* .docs = */ "The ZUPT is triggered when the scalar magnitude of the GNSS reported velocity vector is equal-to or less than the threshold value.\nThe device will NACK threshold values that are less than zero (i.e.negative.)", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::AutoAngularZupt::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "enable", + /* .docs = */ "0 - Disable, 1 - Enable", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "threshold", + /* .docs = */ "[radians/second]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::AutoAngularZupt::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::AutoAngularZupt; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "enable", + /* .docs = */ "0 - Disable, 1 - Enable", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "threshold", + /* .docs = */ "[radians/second]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::AutoAngularZupt", + /* .title = */ "Zero Angular Rate Update Control", + /* .docs = */ "Zero Angular Rate Update\nThe ZUPT is triggered when the scalar magnitude of the angular rate vector is equal-to or less than the threshold value.\nThe device will NACK threshold values that are less than zero (i.e.negative.)", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::CommandedZupt; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::CommandedZupt", + /* .title = */ "Commanded Zero Velocity Update", + /* .docs = */ "Please see the device user manual for the maximum rate of this message.", + /* .parameters = */ {}, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::CommandedAngularZupt; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::CommandedAngularZupt", + /* .title = */ "Commanded Zero Angular Rate Update", + /* .docs = */ "Please see the device user manual for the maximum rate of this message.", + /* .parameters = */ {}, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::MagCaptureAutoCal; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::MagCaptureAutoCal", + /* .title = */ "Magnetometer Capture Auto Calibration", + /* .docs = */ "This command captures the current value of the auto-calibration, applies it to the current fixed hard and soft iron calibration coefficients, and replaces the current fixed hard and soft iron calibration coefficients with the new values.\nThis may be used in place of (or in addition to) a manual hard and soft iron calibration utility. This command also resets the auto-calibration coefficients.\nFunction selector SAVE is the same as issuing the 0x0C, 0x3A and 0x0C, 0x3B commands with the SAVE function selector.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, false, true, false, false}, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::GravityNoise::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "noise", + /* .docs = */ "Gravity Noise 1-sigma [gauss]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::GravityNoise::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::GravityNoise; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "noise", + /* .docs = */ "Gravity Noise 1-sigma [gauss]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::GravityNoise", + /* .title = */ "Gravity Noise Standard Deviation", + /* .docs = */ "Set the expected gravity noise 1-sigma values. This function can be used to tune the filter performance in the target application.\n\nNote: Noise values must be greater than 0.0\n\nThe noise value represents process noise in the Estimation Filter. Changing this value modifies how the filter responds to dynamic input and can be used to tune filter performance.\nDefault values provide good performance for most laboratory conditions.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::PressureAltitudeNoise::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "noise", + /* .docs = */ "Pressure Altitude Noise 1-sigma [m]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::PressureAltitudeNoise::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::PressureAltitudeNoise; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "noise", + /* .docs = */ "Pressure Altitude Noise 1-sigma [m]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::PressureAltitudeNoise", + /* .title = */ "Pressure Altitude Noise Standard Deviation", + /* .docs = */ "Set the expected pressure altitude noise 1-sigma values. This function can be used to tune the filter performance in the target application.\n\nThe noise value must be greater than 0.0\n\nThis noise value represents pressure altitude model noise in the Estimation Filter.\nA lower value will increase responsiveness of the sensor to pressure changes, however height estimates will be more susceptible to error from air pressure fluctuations not due to changes in altitude. Default values provide good performance for most laboratory conditions.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::HardIronOffsetNoise::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "noise", + /* .docs = */ "Hard Iron Offset Noise 1-sigma [gauss]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::HardIronOffsetNoise::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::HardIronOffsetNoise; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "noise", + /* .docs = */ "Hard Iron Offset Noise 1-sigma [gauss]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::HardIronOffsetNoise", + /* .title = */ "Hard Iron Offset Process Noise", + /* .docs = */ "Set the expected hard iron offset noise 1-sigma values. This function can be used to tune the filter performance in the target application.\n\nThis function can be used to tune the filter performance in the target application.\n\nNoise values must be greater than 0.0\n\nThe noise values represent process noise in the Estimation Filter.\nChanging this value modifies how the filter responds to dynamic input and can be used to tune the performance of the filter. Default values provide good performance for most laboratory conditions.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::SoftIronMatrixNoise::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "noise", + /* .docs = */ "Soft Iron Matrix Noise 1-sigma [dimensionless]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::SoftIronMatrixNoise::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::SoftIronMatrixNoise; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "noise", + /* .docs = */ "Soft Iron Matrix Noise 1-sigma [dimensionless]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::SoftIronMatrixNoise", + /* .title = */ "Soft Iron Offset Process Noise", + /* .docs = */ "Set the expected soft iron matrix noise 1-sigma values.\nThis function can be used to tune the filter performance in the target application.\n\nNoise values must be greater than 0.0\n\nThe noise value represents process noise in the Estimation Filter.\nChanging this value modifies how the filter responds to dynamic input and can be used to tune the performance of the filter. Default values provide good performance for most laboratory conditions.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::MagNoise::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "noise", + /* .docs = */ "Mag Noise 1-sigma [gauss]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::MagNoise::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::MagNoise; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "noise", + /* .docs = */ "Mag Noise 1-sigma [gauss]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::MagNoise", + /* .title = */ "Magnetometer Noise Standard Deviation", + /* .docs = */ "Set the expected magnetometer noise 1-sigma values.\nThis function can be used to tune the filter performance in the target application.\n\nNoise values must be greater than 0.0 (gauss)\n\nThe noise value represents process noise in the Estimation Filter.\nChanging this value modifies how the filter responds to dynamic input and can be used to tune the performance of the filter. Default values provide good performance for most laboratory conditions", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::FilterMagParamSource; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(1), "NONE", "No source. See command documentation for default behavior" }, + { uint32_t(2), "WMM", "Magnetic field is assumed to conform to the World Magnetic Model, calculated using current location estimate as an input to the model." }, + { uint32_t(3), "MANUAL", "Magnetic field is assumed to have the parameter specified by the user." }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "FilterMagParamSource", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::InclinationSource::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "source", + /* .docs = */ "Inclination Source", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "inclination", + /* .docs = */ "Inclination angle [radians] (only required if source = MANUAL)", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::InclinationSource::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::InclinationSource; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "source", + /* .docs = */ "Inclination Source", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "inclination", + /* .docs = */ "Inclination angle [radians] (only required if source = MANUAL)", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::InclinationSource", + /* .title = */ "Inclination Source", + /* .docs = */ "Set/Get the local magnetic field inclination angle source.\n\nThis can be used to correct for the local value of inclination (dip angle) of the earthmagnetic field.\nHaving a correct value is important for best performance of the auto-mag calibration feature. If you do not have an accurate inclination angle source, it is recommended that you leave the auto-mag calibration feature off.\n", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::MagneticDeclinationSource::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "source", + /* .docs = */ "Magnetic field declination angle source", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "declination", + /* .docs = */ "Declination angle [radians] (only required if source = MANUAL)", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::MagneticDeclinationSource::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::MagneticDeclinationSource; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "source", + /* .docs = */ "Magnetic field declination angle source", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "declination", + /* .docs = */ "Declination angle [radians] (only required if source = MANUAL)", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::MagneticDeclinationSource", + /* .title = */ "Magnetic Field Declination Source Control", + /* .docs = */ "Set/Get the local magnetic field declination angle source.\n\nThis can be used to correct for the local value of declination of the earthmagnetic field.\nHaving a correct value is important for best performance of the auto-mag calibration feature. If you do not have an accurate inclination angle source, it is recommended that you leave the auto-mag calibration feature off.\n", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::MagFieldMagnitudeSource::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "source", + /* .docs = */ "Magnetic Field Magnitude Source", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "magnitude", + /* .docs = */ "Magnitude [gauss] (only required if source = MANUAL)", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::MagFieldMagnitudeSource::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::MagFieldMagnitudeSource; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "source", + /* .docs = */ "Magnetic Field Magnitude Source", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "magnitude", + /* .docs = */ "Magnitude [gauss] (only required if source = MANUAL)", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::MagFieldMagnitudeSource", + /* .title = */ "Magnetic Field Magnitude Source", + /* .docs = */ "Set/Get the local magnetic field magnitude source.\n\nThis is used to specify the local magnitude of the earth's magnetic field.\nHaving a correct value for magnitude is important for best performance of the auto-mag calibration feature and for the magnetometer adaptive magnitude. If you do not have an accurate value for the local magnetic field magnitude, it is recommended that you leave the auto-mag calibration feature off.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::ReferencePosition::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "enable", + /* .docs = */ "enable/disable", + /* .type = */ {Type::BOOL, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "latitude", + /* .docs = */ "[degrees]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "longitude", + /* .docs = */ "[degrees]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "altitude", + /* .docs = */ "[meters]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::ReferencePosition::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::ReferencePosition; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "enable", + /* .docs = */ "enable/disable", + /* .type = */ {Type::BOOL, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "latitude", + /* .docs = */ "[degrees]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "longitude", + /* .docs = */ "[degrees]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "altitude", + /* .docs = */ "[meters]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::ReferencePosition", + /* .title = */ "Set Reference Position", + /* .docs = */ "Set the Lat/Long/Alt reference position for the sensor.\n\nThis position is used by the sensor to calculate the WGS84 gravity and WMM2015 magnetic field parameters.\n", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::FilterAdaptiveMeasurement; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "DISABLED", "No adaptive measurement" }, + { uint32_t(1), "FIXED", "Enable fixed adaptive measurement (use specified limits)" }, + { uint32_t(2), "AUTO", "Enable auto adaptive measurement" }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "FilterAdaptiveMeasurement", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::AccelMagnitudeErrorAdaptiveMeasurement::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "adaptive_measurement", + /* .docs = */ "Adaptive measurement selector", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "frequency", + /* .docs = */ "Low-pass filter curoff frequency [hertz]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "low_limit", + /* .docs = */ "[meters/second^2]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "high_limit", + /* .docs = */ "[meters/second^2]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "low_limit_uncertainty", + /* .docs = */ "1-Sigma [meters/second^2]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "high_limit_uncertainty", + /* .docs = */ "1-Sigma [meters/second^2]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "minimum_uncertainty", + /* .docs = */ "1-Sigma [meters/second^2]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::AccelMagnitudeErrorAdaptiveMeasurement::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::AccelMagnitudeErrorAdaptiveMeasurement; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "adaptive_measurement", + /* .docs = */ "Adaptive measurement selector", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "frequency", + /* .docs = */ "Low-pass filter curoff frequency [hertz]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "low_limit", + /* .docs = */ "[meters/second^2]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "high_limit", + /* .docs = */ "[meters/second^2]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "low_limit_uncertainty", + /* .docs = */ "1-Sigma [meters/second^2]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "high_limit_uncertainty", + /* .docs = */ "1-Sigma [meters/second^2]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "minimum_uncertainty", + /* .docs = */ "1-Sigma [meters/second^2]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::AccelMagnitudeErrorAdaptiveMeasurement", + /* .title = */ "Gravity Magnitude Error Adaptive Measurement", + /* .docs = */ "Enable or disable the gravity magnitude error adaptive measurement.\nThis function can be used to tune the filter performance in the target application\n\nPick values that give you the least occurrence of invalid EF attitude output.\nThe default values are good for standard low dynamics applications.\nIncrease values for higher dynamic conditions, lower values for lower dynamic.\nToo low a value will result in excessive heading errors.\nHigher values increase heading errors when undergoing magnetic field anomalies caused by DC currents, magnets, steel structures,etc.\n\nAdaptive measurements can be enabled/disabled without the need for providing the additional parameters.\nIn this case, only the function selector and enable value are required; all other parameters will remain at their previous values.\nWhen “auto-adaptive” is selected, the filter and limit parameters are ignored.\nInstead, aiding measurements which rely on the gravity vector will be automatically reweighted by the Kalman filter according to the perceived measurement quality.\n", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::MagMagnitudeErrorAdaptiveMeasurement::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "adaptive_measurement", + /* .docs = */ "Adaptive measurement selector", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "frequency", + /* .docs = */ "Low-pass filter curoff frequency [hertz]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "low_limit", + /* .docs = */ "[meters/second^2]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "high_limit", + /* .docs = */ "[meters/second^2]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "low_limit_uncertainty", + /* .docs = */ "1-Sigma [meters/second^2]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "high_limit_uncertainty", + /* .docs = */ "1-Sigma [meters/second^2]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "minimum_uncertainty", + /* .docs = */ "1-Sigma [meters/second^2]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::MagMagnitudeErrorAdaptiveMeasurement::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::MagMagnitudeErrorAdaptiveMeasurement; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "adaptive_measurement", + /* .docs = */ "Adaptive measurement selector", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "frequency", + /* .docs = */ "Low-pass filter curoff frequency [hertz]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "low_limit", + /* .docs = */ "[meters/second^2]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "high_limit", + /* .docs = */ "[meters/second^2]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "low_limit_uncertainty", + /* .docs = */ "1-Sigma [meters/second^2]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "high_limit_uncertainty", + /* .docs = */ "1-Sigma [meters/second^2]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "minimum_uncertainty", + /* .docs = */ "1-Sigma [meters/second^2]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::MagMagnitudeErrorAdaptiveMeasurement", + /* .title = */ "Magnetometer Magnitude Error Adaptive Measurement", + /* .docs = */ "Enable or disable the magnetometer magnitude error adaptive measurement.\nThis feature will reject magnetometer readings that are out of range of the thresholds specified (fixed adaptive) or calculated internally (auto-adaptive).\n\nPick values that give you the least occurrence of invalid EF attitude output.\nThe default values are good for standard low dynamics applications.\nIncrease values for higher dynamic conditions, lower values for lower dynamic.\nToo low a value will result in excessive heading errors.\nHigher values increase heading errors when undergoing magnetic field anomalies caused by DC currents, magnets, steel structures,etc.\n", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::MagDipAngleErrorAdaptiveMeasurement::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "enable", + /* .docs = */ "Enable/Disable", + /* .type = */ {Type::BOOL, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "frequency", + /* .docs = */ "Low-pass filter curoff frequency [hertz]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "high_limit", + /* .docs = */ "[meters/second^2]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "high_limit_uncertainty", + /* .docs = */ "1-Sigma [meters/second^2]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "minimum_uncertainty", + /* .docs = */ "1-Sigma [meters/second^2]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::MagDipAngleErrorAdaptiveMeasurement::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::MagDipAngleErrorAdaptiveMeasurement; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "enable", + /* .docs = */ "Enable/Disable", + /* .type = */ {Type::BOOL, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "frequency", + /* .docs = */ "Low-pass filter curoff frequency [hertz]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "high_limit", + /* .docs = */ "[meters/second^2]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "high_limit_uncertainty", + /* .docs = */ "1-Sigma [meters/second^2]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "minimum_uncertainty", + /* .docs = */ "1-Sigma [meters/second^2]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::MagDipAngleErrorAdaptiveMeasurement", + /* .title = */ "Magnetometer Dig Angle Error Adaptive Measurement", + /* .docs = */ "Enable or disable the magnetometer dip angle error adaptive measurement.\nThis function can be used to tune the filter performance in the target application\n\nPick values that give you the least occurrence of invalid EF attitude output.\nThe default values are good for standard low dynamics applications.\nIncrease values for higher dynamic conditions, lower values for lower dynamic.\nToo low a value will result in excessive heading errors.\nHigher values increase heading errors when undergoing magnetic field anomalies caused by DC currents, magnets, steel structures,etc.\n\nThe magnetometer dip angle adaptive measurement is ignored if the auto-adaptive magnetometer magnitude or auto-adaptive accel magnitude options are selected.\n", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::AidingMeasurementEnable::AidingSource; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "GNSS_POS_VEL", "GNSS Position and Velocity" }, + { uint32_t(1), "GNSS_HEADING", "GNSS Heading (dual antenna)" }, + { uint32_t(2), "ALTIMETER", "Pressure altimeter (built-in sensor)" }, + { uint32_t(3), "SPEED", "Speed sensor / Odometer" }, + { uint32_t(4), "MAGNETOMETER", "Magnetometer (built-in sensor)" }, + { uint32_t(5), "EXTERNAL_HEADING", "External heading input" }, + { uint32_t(6), "EXTERNAL_ALTIMETER", "External pressure altimeter input" }, + { uint32_t(7), "EXTERNAL_MAGNETOMETER", "External magnetomer input" }, + { uint32_t(8), "BODY_FRAME_VEL", "External body frame velocity input" }, + { uint32_t(65535), "ALL", "Save/load/reset all options" }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "AidingSource", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::AidingMeasurementEnable::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "aiding_source", + /* .docs = */ "Aiding measurement source", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, true, true, true, true, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "enable", + /* .docs = */ "Controls the aiding source", + /* .type = */ {Type::BOOL, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::AidingMeasurementEnable::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::AidingMeasurementEnable; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "aiding_source", + /* .docs = */ "Aiding measurement source", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, true, true, true, true, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "enable", + /* .docs = */ "Controls the aiding source", + /* .type = */ {Type::BOOL, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::AidingMeasurementEnable", + /* .title = */ "Aiding Measurement Control", + /* .docs = */ "Enables / disables the specified aiding measurement source.\n\n", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::Run; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::Run", + /* .title = */ "Run Navigation Filter", + /* .docs = */ "Manual run command.\n\nIf the initialization configuration has the 'wait_for_run_command' option enabled, the filter will wait until it receives this command before commencing integration and enabling the Kalman filter. Prior to the receipt of this command, the filter will remain in the filter initialization mode.", + /* .parameters = */ {}, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::KinematicConstraint::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "acceleration_constraint_selection", + /* .docs = */ "Acceleration constraint:
\n0=None (default),
\n1=Zero-acceleration.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "velocity_constraint_selection", + /* .docs = */ "0=None (default),
\n1=Zero-velocity,
\n2=Wheeled-vehicle.
", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "angular_constraint_selection", + /* .docs = */ "0=None (default),\n1=Zero-angular rate (ZUPT).", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::KinematicConstraint::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::KinematicConstraint; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "acceleration_constraint_selection", + /* .docs = */ "Acceleration constraint:
\n0=None (default),
\n1=Zero-acceleration.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "velocity_constraint_selection", + /* .docs = */ "0=None (default),
\n1=Zero-velocity,
\n2=Wheeled-vehicle.
", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "angular_constraint_selection", + /* .docs = */ "0=None (default),\n1=Zero-angular rate (ZUPT).", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::KinematicConstraint", + /* .title = */ "Kinematic Constraint Control", + /* .docs = */ "Controls kinematic constraint model selection for the navigation filter.\n\nSee manual for explanation of how the kinematic constraints are applied.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::FilterReferenceFrame; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(1), "ECEF", "WGS84 Earth-fixed, earth centered coordinates" }, + { uint32_t(2), "LLH", "WGS84 Latitude, longitude, and height above ellipsoid" }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "FilterReferenceFrame", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::InitializationConfiguration::AlignmentSelector; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "dual_antenna", "Dual-antenna GNSS alignment" }, + { uint32_t(2), "kinematic", "GNSS kinematic alignment (GNSS velocity determines initial heading)" }, + { uint32_t(4), "magnetometer", "Magnetometer heading alignment (Internal magnetometer determines initial heading)" }, + { uint32_t(8), "external", "External heading alignment (External heading input determines heading)" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "AlignmentSelector", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::InitializationConfiguration::InitialConditionSource; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "AUTO_POS_VEL_ATT", "Automatic position, velocity and attitude" }, + { uint32_t(1), "AUTO_POS_VEL_PITCH_ROLL", "Automatic position and velocity, automatic pitch and roll, and user-specified heading" }, + { uint32_t(2), "AUTO_POS_VEL", "Automatic position and velocity, with fully user-specified attitude" }, + { uint32_t(3), "MANUAL", "User-specified position, velocity, and attitude." }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "InitialConditionSource", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::InitializationConfiguration::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "wait_for_run_command", + /* .docs = */ "Initialize filter only after receiving 'run' command", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "initial_cond_src", + /* .docs = */ "Initial condition source:", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "auto_heading_alignment_selector", + /* .docs = */ "Bitfield specifying the allowed automatic heading alignment methods for automatic initial conditions. Bits are set to 1 to enable, and the correspond to the following:
", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "initial_heading", + /* .docs = */ "User-specified initial platform heading (degrees).", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "initial_pitch", + /* .docs = */ "User-specified initial platform pitch (degrees)", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "initial_roll", + /* .docs = */ "User-specified initial platform roll (degrees)", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "initial_position", + /* .docs = */ "User-specified initial platform position (units determined by reference frame selector, see note.)", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "initial_velocity", + /* .docs = */ "User-specified initial platform velocity (units determined by reference frame selector, see note.)", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "reference_frame_selector", + /* .docs = */ "User-specified initial position/velocity reference frames", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::InitializationConfiguration::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::InitializationConfiguration; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "wait_for_run_command", + /* .docs = */ "Initialize filter only after receiving 'run' command", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "initial_cond_src", + /* .docs = */ "Initial condition source:", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "auto_heading_alignment_selector", + /* .docs = */ "Bitfield specifying the allowed automatic heading alignment methods for automatic initial conditions. Bits are set to 1 to enable, and the correspond to the following:
", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "initial_heading", + /* .docs = */ "User-specified initial platform heading (degrees).", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "initial_pitch", + /* .docs = */ "User-specified initial platform pitch (degrees)", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "initial_roll", + /* .docs = */ "User-specified initial platform roll (degrees)", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "initial_position", + /* .docs = */ "User-specified initial platform position (units determined by reference frame selector, see note.)", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "initial_velocity", + /* .docs = */ "User-specified initial platform velocity (units determined by reference frame selector, see note.)", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "reference_frame_selector", + /* .docs = */ "User-specified initial position/velocity reference frames", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::InitializationConfiguration", + /* .title = */ "Navigation Filter Initialization", + /* .docs = */ "Controls the source and values used for initial conditions of the navigation solution.\n\nNotes: Initial conditions are the position, velocity, and attitude of the platform used when the filter starts running or is reset.\nFor the user specified position array, the units are meters if the ECEF frame is selected, and degrees latitude, degrees longitude, and meters above ellipsoid if the latitude/longitude/height frame is selected.\nFor the user specified velocity array, the units are meters per second, but the reference frame depends on the reference frame selector (ECEF or NED).", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::AdaptiveFilterOptions::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "level", + /* .docs = */ "Auto-adaptive operating level:
\n0=Off,
\n1=Conservative,
\n2=Moderate (default),
\n3=Aggressive.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "time_limit", + /* .docs = */ "Maximum duration of measurement rejection before entering recovery mode (ms)", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::AdaptiveFilterOptions::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::AdaptiveFilterOptions; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "level", + /* .docs = */ "Auto-adaptive operating level:
\n0=Off,
\n1=Conservative,
\n2=Moderate (default),
\n3=Aggressive.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "time_limit", + /* .docs = */ "Maximum duration of measurement rejection before entering recovery mode (ms)", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::AdaptiveFilterOptions", + /* .title = */ "Adaptive Filter Control", + /* .docs = */ "Configures the basic setup for auto-adaptive filtering. See product manual for a detailed description of this feature.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::MultiAntennaOffset::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "receiver_id", + /* .docs = */ "", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "antenna_offset", + /* .docs = */ "", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::MultiAntennaOffset::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::MultiAntennaOffset; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "receiver_id", + /* .docs = */ "Receiver: 1, 2, etc...", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, true, true, true, true, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "antenna_offset", + /* .docs = */ "Antenna lever arm offset vector in the vehicle frame (m)", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::MultiAntennaOffset", + /* .title = */ "GNSS Multi-Antenna Offset Control", + /* .docs = */ "Set the antenna lever arm.\n\nThis command works with devices that utilize multiple antennas.\n

Offset Limit: 10 m magnitude (default)", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::RelPosConfiguration::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "source", + /* .docs = */ "0 - auto (RTK base station), 1 - manual", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "reference_frame_selector", + /* .docs = */ "ECEF or LLH", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "reference_coordinates", + /* .docs = */ "reference coordinates, units determined by source selection", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::RelPosConfiguration::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::RelPosConfiguration; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "source", + /* .docs = */ "0 - auto (RTK base station), 1 - manual", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "reference_frame_selector", + /* .docs = */ "ECEF or LLH", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "reference_coordinates", + /* .docs = */ "reference coordinates, units determined by source selection", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::RelPosConfiguration", + /* .title = */ "Relative Position Configuration", + /* .docs = */ "Configure the reference location for filter relative positioning outputs", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::RefPointLeverArm::ReferencePointSelector; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(1), "VEH", "Defines the origin of the vehicle" }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "ReferencePointSelector", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::RefPointLeverArm::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "ref_point_sel", + /* .docs = */ "Reserved, must be 1", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "lever_arm_offset", + /* .docs = */ "[m] Lever arm offset vector in the vehicle's reference frame.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::RefPointLeverArm::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::RefPointLeverArm; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "ref_point_sel", + /* .docs = */ "Reserved, must be 1", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "lever_arm_offset", + /* .docs = */ "[m] Lever arm offset vector in the vehicle's reference frame.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::RefPointLeverArm", + /* .title = */ "Reference point lever arm", + /* .docs = */ "Lever arm offset with respect to the sensor for the indicated point of reference.\nThis is used to change the location of the indicated point of reference, and will affect filter position and velocity outputs.\nChanging this setting from default will result in a global position offset that depends on vehicle attitude,\nand a velocity offset that depends on vehicle attitude and angular rate.\n
The lever arm is defined by a 3-element vector that points from the sensor to the desired reference point, with (x,y,z) components given in the vehicle's reference frame.\n

Note, if the reference point selector is set to VEH (1), this setting will affect the following data fields: (0x82, 0x01), (0x82, 0x02), (0x82, 0x40), (0x82, 0x41), and (0x82, 42)\n

Offset Limits\n
Reference Point VEH (1): 10 m magnitude (default)", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::SpeedMeasurement; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "source", + /* .docs = */ "Reserved, must be 1.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "time_of_week", + /* .docs = */ "GPS time of week when speed was sampled", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "speed", + /* .docs = */ "Estimated speed along vehicle's x-axis (may be positive or negative) [meters/second]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "speed_uncertainty", + /* .docs = */ "Estimated uncertainty in the speed measurement (1-sigma value) [meters/second]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::SpeedMeasurement", + /* .title = */ "Input speed measurement", + /* .docs = */ "Speed aiding measurement, where speed is defined as rate of motion along the vehicle's x-axis direction.\nCan be used by an external odometer/speedometer, for example.\nThis command cannot be used if the internal odometer is configured.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::SpeedLeverArm::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "source", + /* .docs = */ "Reserved, must be 1.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, true, true, true, true, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "lever_arm_offset", + /* .docs = */ "[m] Lever arm offset vector in the vehicle's reference frame.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::SpeedLeverArm::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::SpeedLeverArm; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "source", + /* .docs = */ "Reserved, must be 1.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, true, true, true, true, /*echo*/true}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "lever_arm_offset", + /* .docs = */ "[m] Lever arm offset vector in the vehicle's reference frame.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::SpeedLeverArm", + /* .title = */ "Measurement speed lever arm", + /* .docs = */ "Lever arm offset for speed measurements.\nThis is used to compensate for an off-center measurement point\nhaving a different speed due to rotation of the vehicle.\nThe typical use case for this would be an odometer attached to a wheel\non a standard 4-wheeled vehicle. If the odometer is on the left wheel,\nit will report higher speed on right turns and lower speed on left turns.\nThis is because the outside edge of the curve is longer than the inside edge.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::WheeledVehicleConstraintControl::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "enable", + /* .docs = */ "0 - Disable, 1 - Enable", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::WheeledVehicleConstraintControl::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::WheeledVehicleConstraintControl; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "enable", + /* .docs = */ "0 - Disable, 1 - Enable", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::WheeledVehicleConstraintControl", + /* .title = */ "Wheeled Vehicle Constraint Control", + /* .docs = */ "Configure the wheeled vehicle kinematic constraint.\n\nWhen enabled, the filter uses the assumption that velocity is constrained to the primary vehicle axis.\nBy convention, the primary vehicle axis is the vehicle X-axis (note: the sensor may be physically installed in\nany orientation on the vehicle if the appropriate mounting transformation has been specified).\nThis constraint will typically improve heading estimates for vehicles where the assumption is valid, such\nas an automobile, particularly when GNSS coverage is intermittent.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::VerticalGyroConstraintControl::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "enable", + /* .docs = */ "0 - Disable, 1 - Enable", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::VerticalGyroConstraintControl::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::VerticalGyroConstraintControl; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "enable", + /* .docs = */ "0 - Disable, 1 - Enable", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::VerticalGyroConstraintControl", + /* .title = */ "Vertical Gyro Constraint Control", + /* .docs = */ "Configure the vertical gyro kinematic constraint.\n\nWhen enabled and no valid GNSS measurements are available, the filter uses the accelerometers to track pitch\nand roll under the assumption that the sensor platform is not undergoing linear acceleration.\nThis constraint is useful to maintain accurate pitch and roll during GNSS signal outages.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::GnssAntennaCalControl::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "enable", + /* .docs = */ "0 - Disable, 1 - Enable", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "max_offset", + /* .docs = */ "Maximum absolute value of lever arm offset error in the vehicle frame [meters]. See device user manual for the valid range of this parameter.", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::GnssAntennaCalControl::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::GnssAntennaCalControl; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "enable", + /* .docs = */ "0 - Disable, 1 - Enable", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "max_offset", + /* .docs = */ "Maximum absolute value of lever arm offset error in the vehicle frame [meters]. See device user manual for the valid range of this parameter.", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::GnssAntennaCalControl", + /* .title = */ "GNSS Antenna Offset Calibration Control", + /* .docs = */ "Configure the GNSS antenna lever arm calibration.\n\nWhen enabled, the filter will enable lever arm error tracking, up to the maximum offset specified.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_filter::SetInitialHeading; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "heading", + /* .docs = */ "Initial heading in radians [-pi, pi]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_filter::SetInitialHeading", + /* .title = */ "Set Initial Heading Control", + /* .docs = */ "Set the initial heading angle.\n\nThe estimation filter will reset the heading estimate to provided value. If the product supports magnetometer aiding and this feature has been enabled, the heading\nargument will be ignored and the filter will initialize using the inferred magnetic heading.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + + +static constexpr inline std::initializer_list COMMANDS_FILTER = { + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, +}; + + +} // namespace mip::metadata + diff --git a/src/cpp/mip/metadata/definitions/commands_gnss.hpp b/src/cpp/mip/metadata/definitions/commands_gnss.hpp new file mode 100644 index 000000000..33b422c95 --- /dev/null +++ b/src/cpp/mip/metadata/definitions/commands_gnss.hpp @@ -0,0 +1,331 @@ +#pragma once + +#include + +#include + +#include + +namespace mip::metadata +{ + + +template<> +struct MetadataFor +{ + using type = commands_gnss::ReceiverInfo::Info; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "receiver_id", + /* .docs = */ "Receiver id: e.g. 1, 2, etc.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "mip_data_descriptor_set", + /* .docs = */ "MIP descriptor set associated with this receiver", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "description", + /* .docs = */ "Ascii description of receiver. Contains the following info (comma-delimited):
\nModule name/model
\nFirmware version info", + /* .type = */ {Type::CHAR, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ NO_FUNCTIONS, + /* .count = */ 32, + /* .condition = */ {}, + }, + }; + + static constexpr inline StructInfo value = { + /* .name = */ "Info", + /* .title = */ "Info", + /* .docs = */ "", + /* .parameters = */ parameters, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_gnss::ReceiverInfo::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "num_receivers", + /* .docs = */ "Number of physical receivers in the device", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "receiver_info", + /* .docs = */ "", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ {5, microstrain::Index(0) /* num_receivers */}, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_gnss::ReceiverInfo::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_gnss::ReceiverInfo; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_gnss::ReceiverInfo", + /* .title = */ "receiver_info", + /* .docs = */ "Return information about the GNSS receivers in the device.\n", + /* .parameters = */ {}, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_gnss::SignalConfiguration::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "gps_enable", + /* .docs = */ "Bitfield 0: Enable L1CA, 1: Enable L2C, 2: Enable L5", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "glonass_enable", + /* .docs = */ "Bitfield 0: Enable L1OF, 1: Enable L2OF", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "galileo_enable", + /* .docs = */ "Bitfield 0: Enable E1, 1: Enable E5B, 2: Enable E5A", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "beidou_enable", + /* .docs = */ "Bitfield 0: Enable B1, 1: Enable B2, 2: Enable B2A", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "reserved", + /* .docs = */ "", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 4, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_gnss::SignalConfiguration::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_gnss::SignalConfiguration; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "gps_enable", + /* .docs = */ "Bitfield 0: Enable L1CA, 1: Enable L2C, 2: Enable L5", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "glonass_enable", + /* .docs = */ "Bitfield 0: Enable L1OF, 1: Enable L2OF", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "galileo_enable", + /* .docs = */ "Bitfield 0: Enable E1, 1: Enable E5B, 2: Enable E5A", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "beidou_enable", + /* .docs = */ "Bitfield 0: Enable B1, 1: Enable B2, 2: Enable B2A", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "reserved", + /* .docs = */ "", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 4, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_gnss::SignalConfiguration", + /* .title = */ "signal_configuration", + /* .docs = */ "Configure the GNSS signals used by the device.\n", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_gnss::RtkDongleConfiguration::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "enable", + /* .docs = */ "", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "reserved", + /* .docs = */ "", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 3, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_gnss::RtkDongleConfiguration::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_gnss::RtkDongleConfiguration; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "enable", + /* .docs = */ "0 - Disabled, 1- Enabled", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "reserved", + /* .docs = */ "", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 3, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_gnss::RtkDongleConfiguration", + /* .title = */ "rtk_dongle_configuration", + /* .docs = */ "Configure the communications with the RTK Dongle connected to the device.\n", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + + +static constexpr inline std::initializer_list COMMANDS_GNSS = { + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, +}; + + +} // namespace mip::metadata + diff --git a/src/cpp/mip/metadata/definitions/commands_rtk.hpp b/src/cpp/mip/metadata/definitions/commands_rtk.hpp new file mode 100644 index 000000000..ebc4e079e --- /dev/null +++ b/src/cpp/mip/metadata/definitions/commands_rtk.hpp @@ -0,0 +1,770 @@ +#pragma once + +#include + +#include + +#include + +namespace mip::metadata +{ + + +template<> +struct MetadataFor +{ + using type = commands_rtk::GetStatusFlags::StatusFlagsLegacy; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(7), "controllerState", "" }, + { uint32_t(248), "platformState", "" }, + { uint32_t(1792), "controllerStatusCode", "" }, + { uint32_t(14336), "platformStatusCode", "" }, + { uint32_t(49152), "resetCode", "" }, + { uint32_t(983040), "signalQuality", "" }, + { uint32_t(4293918720), "reserved", "" }, + { uint32_t(66060288), "rssi", "" }, + { uint32_t(201326592), "rsrp", "" }, + { uint32_t(805306368), "rsrq", "" }, + { uint32_t(3221225472), "sinr", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "StatusFlagsLegacy", + /* .docs = */ "", + /* .type = */ Type::U32, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_rtk::GetStatusFlags::StatusFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(15), "modem_state", "" }, + { uint32_t(240), "connection_type", "" }, + { uint32_t(65280), "rssi", "" }, + { uint32_t(983040), "signal_quality", "" }, + { uint32_t(15728640), "tower_change_indicator", "" }, + { uint32_t(16777216), "nmea_timeout", "" }, + { uint32_t(33554432), "server_timeout", "" }, + { uint32_t(67108864), "corrections_timeout", "" }, + { uint32_t(134217728), "device_out_of_range", "" }, + { uint32_t(268435456), "corrections_unavailable", "" }, + { uint32_t(536870912), "reserved", "" }, + { uint32_t(3221225472), "version", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "StatusFlags", + /* .docs = */ "", + /* .type = */ Type::U32, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_rtk::GetStatusFlags::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "flags", + /* .docs = */ "Model number dependent. See above structures.", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_rtk::GetStatusFlags::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_rtk::GetStatusFlags; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_rtk::GetStatusFlags", + /* .title = */ "Get RTK Device Status Flags", + /* .docs = */ "", + /* .parameters = */ {}, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_rtk::GetImei::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "IMEI", + /* .docs = */ "", + /* .type = */ {Type::CHAR, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 32, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_rtk::GetImei::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_rtk::GetImei; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_rtk::GetImei", + /* .title = */ "Get RTK Device IMEI (International Mobile Equipment Identifier)", + /* .docs = */ "", + /* .parameters = */ {}, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_rtk::GetImsi::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "IMSI", + /* .docs = */ "", + /* .type = */ {Type::CHAR, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 32, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_rtk::GetImsi::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_rtk::GetImsi; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_rtk::GetImsi", + /* .title = */ "Get RTK Device IMSI (International Mobile Subscriber Identifier)", + /* .docs = */ "", + /* .parameters = */ {}, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_rtk::GetIccid::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "ICCID", + /* .docs = */ "", + /* .type = */ {Type::CHAR, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 32, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_rtk::GetIccid::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_rtk::GetIccid; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_rtk::GetIccid", + /* .title = */ "Get RTK Device ICCID (Integrated Circuit Card Identification [SIM Number])", + /* .docs = */ "", + /* .parameters = */ {}, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_rtk::ConnectedDeviceType::Type; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "GENERIC", "" }, + { uint32_t(1), "GQ7", "" }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "Type", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_rtk::ConnectedDeviceType::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "devType", + /* .docs = */ "", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_rtk::ConnectedDeviceType::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_rtk::ConnectedDeviceType; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "devType", + /* .docs = */ "", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_rtk::ConnectedDeviceType", + /* .title = */ "Configure or read the type of the connected device", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, true, true, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_rtk::GetActCode::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "ActivationCode", + /* .docs = */ "", + /* .type = */ {Type::CHAR, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 32, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_rtk::GetActCode::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_rtk::GetActCode; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_rtk::GetActCode", + /* .title = */ "Get RTK Device Activation Code", + /* .docs = */ "", + /* .parameters = */ {}, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_rtk::GetModemFirmwareVersion::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "ModemFirmwareVersion", + /* .docs = */ "", + /* .type = */ {Type::CHAR, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 32, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_rtk::GetModemFirmwareVersion::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_rtk::GetModemFirmwareVersion; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_rtk::GetModemFirmwareVersion", + /* .title = */ "Get RTK Device's Cell Modem Firmware version number", + /* .docs = */ "", + /* .parameters = */ {}, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_rtk::GetRssi::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "valid", + /* .docs = */ "", + /* .type = */ {Type::BOOL, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "rssi", + /* .docs = */ "", + /* .type = */ {Type::S32, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "signalQuality", + /* .docs = */ "", + /* .type = */ {Type::S32, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_rtk::GetRssi::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_rtk::GetRssi; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_rtk::GetRssi", + /* .title = */ "get_rssi", + /* .docs = */ "Get the RSSI and connected/disconnected status of modem", + /* .parameters = */ {}, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_rtk::ServiceStatus::ServiceFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "throttle", "" }, + { uint32_t(2), "corrections_unavailable", "" }, + { uint32_t(252), "reserved", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ServiceFlags", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_rtk::ServiceStatus::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "flags", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "receivedBytes", + /* .docs = */ "", + /* .type = */ {Type::U32, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "lastBytes", + /* .docs = */ "", + /* .type = */ {Type::U32, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "lastBytesTime", + /* .docs = */ "", + /* .type = */ {Type::U64, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_rtk::ServiceStatus::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_rtk::ServiceStatus; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "reserved1", + /* .docs = */ "", + /* .type = */ {Type::U32, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "reserved2", + /* .docs = */ "", + /* .type = */ {Type::U32, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_rtk::ServiceStatus", + /* .title = */ "service_status", + /* .docs = */ "The 3DMRTK will send this message to the server to indicate that the connection should remain open. The Server will respond with information and status.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_rtk::MediaSelector; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "MEDIA_ExternalFlash", "" }, + { uint32_t(1), "MEDIA_SD", "" }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "MediaSelector", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_rtk::ProdEraseStorage; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "media", + /* .docs = */ "", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_rtk::ProdEraseStorage", + /* .title = */ "prod_erase_storage", + /* .docs = */ "This command will erase the selected media to a raw and uninitialized state. ALL DATA WILL BE LOST.\nThis command is only available in calibration mode.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_rtk::LedAction; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "LED_NONE", "" }, + { uint32_t(1), "LED_FLASH", "" }, + { uint32_t(2), "LED_PULSATE", "" }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "LedAction", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = commands_rtk::LedControl; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "primaryColor", + /* .docs = */ "", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 3, + /* .condition = */ {}, + }, + { + /* .name = */ "altColor", + /* .docs = */ "", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 3, + /* .condition = */ {}, + }, + { + /* .name = */ "act", + /* .docs = */ "", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "period", + /* .docs = */ "", + /* .type = */ {Type::U32, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_rtk::LedControl", + /* .title = */ "led_control", + /* .docs = */ "This command allows direct control of the LED on the 3DM RTK. This command is only available in calibration mode or Production Test Mode.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_rtk::ModemHardReset; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_rtk::ModemHardReset", + /* .title = */ "modem_hard_reset", + /* .docs = */ "This command will clear the modem flash. THIS MUST NOT BE DONE OFTEN AS IT CAN DAMAGE THE FLASH!\nThis command is only available in calibration mode.", + /* .parameters = */ {}, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + + +static constexpr inline std::initializer_list COMMANDS_RTK = { + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, +}; + + +} // namespace mip::metadata + diff --git a/src/cpp/mip/metadata/definitions/commands_system.hpp b/src/cpp/mip/metadata/definitions/commands_system.hpp new file mode 100644 index 000000000..1c3352eb5 --- /dev/null +++ b/src/cpp/mip/metadata/definitions/commands_system.hpp @@ -0,0 +1,80 @@ +#pragma once + +#include + +#include + +#include + +namespace mip::metadata +{ + + +template<> +struct MetadataFor +{ + using type = commands_system::CommMode::Response; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "mode", + /* .docs = */ "", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_system::CommMode::Response", + /* .title = */ "response", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = commands_system::CommMode; + + static constexpr inline ParameterInfo parameters[] = { + FUNCTION_SELECTOR_PARAM, + { + /* .name = */ "mode", + /* .docs = */ "", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "commands_system::CommMode", + /* .title = */ "comm_mode", + /* .docs = */ "Advanced specialized communication modes.\n\nThis command allows the user to communicate directly with various subsystems which may be present in MIP devices (i.e. IMU, GNSS, etc.)\nPlease see the specific device's user manual for possible modes.\n\nThis command responds with an ACK/NACK just prior to switching to the new protocol.\nFor all functions except 0x01 (use new settings), the new communications mode value is ignored.\n\n", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ {true, true, false, false, true}, + /* .proprietary = */ false, + /* .response = */ &MetadataFor::value, + }; +}; + + +static constexpr inline std::initializer_list COMMANDS_SYSTEM = { + &MetadataFor::value, + &MetadataFor::value, +}; + + +} // namespace mip::metadata + diff --git a/src/cpp/mip/metadata/definitions/common.hpp b/src/cpp/mip/metadata/definitions/common.hpp new file mode 100644 index 000000000..1d2dc2e6c --- /dev/null +++ b/src/cpp/mip/metadata/definitions/common.hpp @@ -0,0 +1,287 @@ +#pragma once + +#include +#include + +#include + + +namespace mip::metadata +{ + +template<> +struct MetadataFor +{ + using type = CmdResult; + + static constexpr inline EnumInfo::Entry entries[] = { + { + /*.value =*/ CmdResult::ACK_OK, + /*.name =*/ "OK", + /*.docs =*/ "Command completed successfully", + }, + { + /*.value =*/ CmdResult::NACK_COMMAND_UNKNOWN, + /*.name =*/ "Unknown Command", + /*.docs =*/ "The device did not recognize the command", + }, + { + /*.value =*/ CmdResult::NACK_INVALID_CHECKSUM, + /*.name =*/ "Invalid Checksum", + /*.docs =*/ "An packet with an invalid checksum was received by the device", + }, + { + /*.value =*/ CmdResult::NACK_INVALID_PARAM, + /*.name =*/ "Invalid Parameter", + /*.docs =*/ "One or more parameters to the command were not valid", + }, + { + /*.value =*/ CmdResult::NACK_COMMAND_FAILED, + /*.name =*/ "Command Failed", + /*.docs =*/ "The device could not complete the command", + }, + { + /*.value =*/ CmdResult::NACK_COMMAND_TIMEOUT, + /*.name =*/ "Device Timeout", + /*.docs =*/ "The device reported a timeout condition", + }, + // Status codes not represented here as they don't come from the device. + }; + + static constexpr inline EnumInfo value = { + /*.name =*/ "CmdResult", + /*.docs =*/ "Acknowledgement/reply code from the device after a command is issued", + /*.type =*/ Type::U8, + /*.entries =*/ entries, + }; +}; + +struct ReplyField +{ + static constexpr inline uint8_t FIELD_DESCRIPTOR = 0xF1; + static constexpr inline CompositeDescriptor DESCRIPTOR = {INVALID_DESCRIPTOR_SET, FIELD_DESCRIPTOR}; + + uint8_t cmd_field_desc; + CmdResult result; + + size_t insert(Serializer& buffer) const { return buffer.insert(cmd_field_desc, result.value); } + size_t extract(Serializer& buffer) { return buffer.extract(cmd_field_desc, result.value); } +}; + +template<> +struct MetadataFor +{ + using type = ReplyField; + + static constexpr inline ParameterInfo parameters[] = { + { + /*.name =*/ "cmd_field_desc", + /*.docs =*/ "The field descriptor of the command this field acknowledges.", + /*.type =*/ {Type::U8}, + /*.accessor =*/ nullptr, //utils::access, + /*.attributes =*/ NO_FUNCTIONS, + /*.count =*/ 1, + /*.condition =*/ {}, + }, + { + /*.name =*/ "result", + /*.docs =*/ "Result of the command.", + /*.type =*/ {Type::ENUM, &MetadataFor::value}, + /*.accessor =*/ nullptr, //utils::access, + /*.attributes =*/ NO_FUNCTIONS, + /*.count =*/ 1, + /*.condition =*/ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /*.name = */ "ReplyField", + /* .title = */ "Command Reply", + /* .docs = */ "Sent by the device to indicate the result of a command.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = DescriptorRate; + + static constexpr inline ParameterInfo parameters[] = { + { + /*.name =*/ "descriptor", + /*.docs =*/ "MIP data descriptor", + /*.type =*/ {Type::U8}, + /*.accessor =*/ nullptr, //utils::access, + /*.attributes =*/ NO_FUNCTIONS, + /*.count =*/ 1, + /*.condition =*/ {}, + }, + { + /*.name =*/ "decimation", + /*.docs =*/ "Decimation from the base rate", + /*.type =*/ {Type::U16}, + /*.accessor =*/ nullptr, //utils::access, + /*.attributes =*/ NO_FUNCTIONS, + /*.count =*/ 1, + /*.condition =*/ {}, + }, + }; + + static constexpr inline StructInfo value = { + /*.name =*/ "DescriptorRate", + /*.title =*/ "Descriptor Rate", + /*.docs =*/ "Descriptor rate information", + /*.parameters =*/ parameters, + }; +}; + + +template +struct MetadataFor> +{ + using type = Vector; + + static constexpr inline ParameterInfo parameters[] = { + { + /*.name =*/ "x", + /*.docs =*/ "X axis", + /*.type =*/ {utils::ParamType::value}, + /*.accessor =*/ nullptr, + /*.attributes =*/ NO_FUNCTIONS, + /*.count =*/ 1, + /*.condition =*/ {}, + }, + { + /*.name =*/ "y", + /*.docs =*/ "Y axis", + /*.type =*/ {utils::ParamType::value}, + /*.accessor =*/ nullptr, + /*.attributes =*/ NO_FUNCTIONS, + /*.count =*/ 1, + /*.condition =*/ {}, + }, + { + /*.name =*/ "z", + /*.docs =*/ "Z axis", + /*.type =*/ {utils::ParamType::value}, + /*.accessor =*/ nullptr, + /*.attributes =*/ NO_FUNCTIONS, + /*.count =*/ 1, + /*.condition =*/ {}, + }, + { + /*.name =*/ "w", + /*.docs =*/ "W axis", + /*.type =*/ {utils::ParamType::value}, + /*.accessor =*/ nullptr, + /*.attributes =*/ NO_FUNCTIONS, + /*.count =*/ 1, + /*.condition =*/ {}, + }, + }; + + + static constexpr inline StructInfo values_f[3] = { + { + /*.name =*/ "Vector2f", + /*.title =*/ "Vector2f", + /*.docs =*/ "2-dimensional vector of floats", + /*.parameters =*/ {parameters, 2} + }, + { + /*.name =*/ "Vector3f", + /*.title =*/ "Vector3f", + /*.docs =*/ "3-dimensional vector of floats", + /*.parameters =*/ {parameters, 3} + }, + { + /*.name =*/ "Vector4f", + /*.title =*/ "Vector4f", + /*.docs =*/ "4-dimensional vector of floats", + /*.parameters =*/ {parameters, 4} + }, + }; + static constexpr inline StructInfo values_d[3] = { + { + /*.name =*/ "Vector2d", + /*.title =*/ "Vector2d", + /*.docs =*/ "2-dimensional vector of doubles", + /*.parameters =*/ {parameters, 2} + }, + { + /*.name =*/ "Vector3d", + /*.title =*/ "Vector3d", + /*.docs =*/ "3-dimensional vector of doubles", + /*.parameters =*/ {parameters, 3} + }, + { + /*.name =*/ "Vector4d", + /*.title =*/ "Vector4d", + /*.docs =*/ "4-dimensional vector of doubles", + /*.parameters =*/ {parameters, 4} + }, + }; + + static_assert(std::is_floating_point::value, "Expected either float or double"); + static_assert(N >= 2 && N <= 4, "N should be in the range [2,4]."); + + static constexpr inline const StructInfo& value = std::is_same::value ? values_d[N-2] : values_f[N-2]; +}; + + +template<> +struct MetadataFor +{ + using type = Matrix3f; + + static constexpr inline ParameterInfo parameters[] = { + { + /*.name =*/ "m", + /*.docs =*/ "Matrix data", + /*.type =*/ {Type::FLOAT}, + /*.accessor =*/ nullptr, + /*.attributes =*/ NO_FUNCTIONS, + /*.count =*/ 3, + /*.condition =*/ {}, + }, + }; + + static constexpr inline StructInfo value = { + /*.name =*/ "Matrix3f", + /*.title =*/ "3x3 Float Matrix", + /*.docs =*/ "Represents a 3D matrix of floats.", + /*.parameters =*/ parameters, + }; +}; + +template<> +struct MetadataFor +{ + using type = Matrix3d; + + static constexpr inline ParameterInfo parameters[] = { + { + /*.name =*/ "m", + /*.docs =*/ "Matrix data", + /*.type =*/ {Type::DOUBLE}, + /*.accessor =*/ nullptr, + /*.attributes =*/ NO_FUNCTIONS, + /*.count =*/ 3, + /*.condition =*/ {}, + }, + }; + + static constexpr inline StructInfo value = { + /*.name =*/ "Matrix3f", + /*.title =*/ "3x3 Double Matrix", + /*.docs =*/ "Represents a 3D matrix of doubles.", + /*.parameters =*/ parameters, + }; +}; + +} // namespace mip::metadata diff --git a/src/cpp/mip/metadata/definitions/data_filter.hpp b/src/cpp/mip/metadata/definitions/data_filter.hpp new file mode 100644 index 000000000..59935548c --- /dev/null +++ b/src/cpp/mip/metadata/definitions/data_filter.hpp @@ -0,0 +1,2880 @@ +#pragma once + +#include + +#include + +#include + +namespace mip::metadata +{ + + +template<> +struct MetadataFor +{ + using type = data_filter::PositionLlh; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "latitude", + /* .docs = */ "[degrees]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "longitude", + /* .docs = */ "[degrees]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "ellipsoid_height", + /* .docs = */ "[meters]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - Invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::PositionLlh", + /* .title = */ "LLH Position", + /* .docs = */ "Filter reported position in the WGS84 geodetic frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::VelocityNed; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "north", + /* .docs = */ "[meters/second]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "east", + /* .docs = */ "[meters/second]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "down", + /* .docs = */ "[meters/second]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - Invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::VelocityNed", + /* .title = */ "velocity_ned", + /* .docs = */ "Filter reported velocity in the NED local-level frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::AttitudeQuaternion; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "q", + /* .docs = */ "Quaternion elements EQSTART q = (q_w, q_x, q_y, q_z) EQEND", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::AttitudeQuaternion", + /* .title = */ "attitude_quaternion", + /* .docs = */ "4x1 vector representation of the quaternion describing the orientation of the device with respect to the NED local-level frame.\nThis quaternion satisfies the following relationship:\n\nEQSTART p^{veh} = q^{-1} p^{ned} q EQEND
\n\nWhere:
\nEQSTART q = (q_w, q_x, q_y, q_z) EQEND is the quaternion describing the rotation.
\nEQSTART p^ned = (0, v^{ned}_x, v^{ned}_y, v^{ned}_z) EQEND and EQSTART v^{ned} EQEND is a 3-element vector expressed in the NED frame.
\nEQSTART p^veh = (0, v^{veh}_x, v^{veh}_y, v^{veh}_z) EQEND and EQSTART v^{veh} EQEND is a 3-element vector expressed in the vehicle frame.
", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::AttitudeDcm; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "dcm", + /* .docs = */ "Matrix elements in row-major order.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::AttitudeDcm", + /* .title = */ "attitude_dcm", + /* .docs = */ "3x3 Direction Cosine Matrix EQSTART M_{ned}^{veh} EQEND describing the orientation of the device with respect to the NED local-level frame.\nThis matrix satisfies the following relationship:\n\nEQSTART v^{veh} = M_{ned}^{veh} v^{ned} EQEND
\n\nWhere:
\n\nEQSTART v^{ned} EQEND is a 3-element vector expressed in the NED frame.
\nEQSTART v^{veh} EQEND is the same 3-element vector expressed in the vehicle frame.
\n
\nThe matrix elements are stored is row-major order: EQSTART M_{ned}^{veh} = \\begin{bmatrix} M_{11}, M_{12}, M_{13}, M_{21}, M_{22}, M_{23}, M_{31}, M_{32}, M_{33} \\end{bmatrix} EQEND", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::EulerAngles; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "roll", + /* .docs = */ "[radians]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "pitch", + /* .docs = */ "[radians]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "yaw", + /* .docs = */ "[radians]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::EulerAngles", + /* .title = */ "euler_angles", + /* .docs = */ "Filter reported Euler angles describing the orientation of the device with respect to the NED local-level frame.\nThe Euler angles are reported in 3-2-1 (Yaw-Pitch-Roll, AKA Aircraft) order.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::GyroBias; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "bias", + /* .docs = */ "(x, y, z) [radians/second]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::GyroBias", + /* .title = */ "gyro_bias", + /* .docs = */ "Filter reported gyro bias expressed in the sensor frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::AccelBias; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "bias", + /* .docs = */ "(x, y, z) [meters/second^2]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::AccelBias", + /* .title = */ "accel_bias", + /* .docs = */ "Filter reported accelerometer bias expressed in the sensor frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::PositionLlhUncertainty; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "north", + /* .docs = */ "[meters]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "east", + /* .docs = */ "[meters]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "down", + /* .docs = */ "[meters]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::PositionLlhUncertainty", + /* .title = */ "LLH Position Uncertainty", + /* .docs = */ "Filter reported 1-sigma position uncertainty in the NED local-level frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::VelocityNedUncertainty; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "north", + /* .docs = */ "[meters/second]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "east", + /* .docs = */ "[meters/second]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "down", + /* .docs = */ "[meters/second]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::VelocityNedUncertainty", + /* .title = */ "NED Velocity Uncertainty", + /* .docs = */ "Filter reported 1-sigma velocity uncertainties in the NED local-level frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::EulerAnglesUncertainty; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "roll", + /* .docs = */ "[radians]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "pitch", + /* .docs = */ "[radians]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "yaw", + /* .docs = */ "[radians]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::EulerAnglesUncertainty", + /* .title = */ "euler_angles_uncertainty", + /* .docs = */ "Filter reported 1-sigma Euler angle uncertainties.\nThe uncertainties are reported in 3-2-1 (Yaw-Pitch-Roll, AKA Aircraft) order.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::GyroBiasUncertainty; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "bias_uncert", + /* .docs = */ "(x,y,z) [radians/sec]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::GyroBiasUncertainty", + /* .title = */ "gyro_bias_uncertainty", + /* .docs = */ "Filter reported 1-sigma gyro bias uncertainties expressed in the sensor frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::AccelBiasUncertainty; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "bias_uncert", + /* .docs = */ "(x,y,z) [meters/second^2]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::AccelBiasUncertainty", + /* .title = */ "accel_bias_uncertainty", + /* .docs = */ "Filter reported 1-sigma accelerometer bias uncertainties expressed in the sensor frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::Timestamp; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "tow", + /* .docs = */ "GPS Time of Week [seconds]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "week_number", + /* .docs = */ "GPS Week Number since 1980 [weeks]", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::Timestamp", + /* .title = */ "timestamp", + /* .docs = */ "GPS timestamp of the Filter data\n\nShould the PPS become unavailable, the device will revert to its internal clock, which will cause the reported time to drift from true GPS time.\nUpon recovering from a PPS outage, the user should expect a jump in the reported GPS time due to the accumulation of internal clock error.\nIf synchronization to an external clock or onboard GNSS receiver (for products that have one) is disabled, this time is equivalent to internal system time.\n\nNote: this data field may be deprecated in the future. The more flexible shared data field (0x82, 0xD3) should be used instead.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::FilterMode; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "GX5_STARTUP", "" }, + { uint32_t(1), "GX5_INIT", "" }, + { uint32_t(2), "GX5_RUN_SOLUTION_VALID", "" }, + { uint32_t(3), "GX5_RUN_SOLUTION_ERROR", "" }, + { uint32_t(1), "INIT", "" }, + { uint32_t(2), "VERT_GYRO", "" }, + { uint32_t(3), "AHRS", "" }, + { uint32_t(4), "FULL_NAV", "" }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "FilterMode", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_filter::FilterDynamicsMode; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(1), "GX5_PORTABLE", "" }, + { uint32_t(2), "GX5_AUTOMOTIVE", "" }, + { uint32_t(3), "GX5_AIRBORNE", "" }, + { uint32_t(1), "GQ7_DEFAULT", "" }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "FilterDynamicsMode", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_filter::FilterStatusFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(4096), "gx5_init_no_attitude", "" }, + { uint32_t(8192), "gx5_init_no_position_velocity", "" }, + { uint32_t(1), "gx5_run_imu_unavailable", "" }, + { uint32_t(2), "gx5_run_gps_unavailable", "" }, + { uint32_t(8), "gx5_run_matrix_singularity", "" }, + { uint32_t(16), "gx5_run_position_covariance_warning", "" }, + { uint32_t(32), "gx5_run_velocity_covariance_warning", "" }, + { uint32_t(64), "gx5_run_attitude_covariance_warning", "" }, + { uint32_t(128), "gx5_run_nan_in_solution_warning", "" }, + { uint32_t(256), "gx5_run_gyro_bias_est_high_warning", "" }, + { uint32_t(512), "gx5_run_accel_bias_est_high_warning", "" }, + { uint32_t(1024), "gx5_run_gyro_scale_factor_est_high_warning", "" }, + { uint32_t(2048), "gx5_run_accel_scale_factor_est_high_warning", "" }, + { uint32_t(4096), "gx5_run_mag_bias_est_high_warning", "" }, + { uint32_t(8192), "gx5_run_ant_offset_correction_est_high_warning", "" }, + { uint32_t(16384), "gx5_run_mag_hard_iron_est_high_warning", "" }, + { uint32_t(32768), "gx5_run_mag_soft_iron_est_high_warning", "" }, + { uint32_t(3), "gq7_filter_condition", "" }, + { uint32_t(4), "gq7_roll_pitch_warning", "" }, + { uint32_t(8), "gq7_heading_warning", "" }, + { uint32_t(16), "gq7_position_warning", "" }, + { uint32_t(32), "gq7_velocity_warning", "" }, + { uint32_t(64), "gq7_imu_bias_warning", "" }, + { uint32_t(128), "gq7_gnss_clk_warning", "" }, + { uint32_t(256), "gq7_antenna_lever_arm_warning", "" }, + { uint32_t(512), "gq7_mounting_transform_warning", "" }, + { uint32_t(1024), "gq7_time_sync_warning", "No time synchronization pulse detected" }, + { uint32_t(61440), "gq7_solution_error", "Filter computation warning flags. If any bits 12-15 are set, and all filter outputs will be invalid." }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "FilterStatusFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_filter::Status; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "filter_state", + /* .docs = */ "Device-specific filter state. Please consult the user manual for definition.", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "dynamics_mode", + /* .docs = */ "Device-specific dynamics mode. Please consult the user manual for definition.", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "status_flags", + /* .docs = */ "Device-specific status flags. Please consult the user manual for definition.", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::Status", + /* .title = */ "status", + /* .docs = */ "Device-specific filter status indicators.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::LinearAccel; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "accel", + /* .docs = */ "(x,y,z) [meters/second^2]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::LinearAccel", + /* .title = */ "linear_accel", + /* .docs = */ "Filter-compensated linear acceleration expressed in the vehicle frame.\nNote: The estimated gravity has been removed from this data leaving only linear acceleration.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::GravityVector; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "gravity", + /* .docs = */ "(x, y, z) [meters/second^2]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::GravityVector", + /* .title = */ "gravity_vector", + /* .docs = */ "Filter reported gravity vector expressed in the vehicle frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::CompAccel; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "accel", + /* .docs = */ "(x,y,z) [meters/second^2]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::CompAccel", + /* .title = */ "Compensated Acceleration", + /* .docs = */ "Filter-compensated acceleration expressed in the vehicle frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::CompAngularRate; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "gyro", + /* .docs = */ "(x, y, z) [radians/second]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::CompAngularRate", + /* .title = */ "comp_angular_rate", + /* .docs = */ "Filter-compensated angular rate expressed in the vehicle frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::QuaternionAttitudeUncertainty; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "q", + /* .docs = */ "[dimensionless]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::QuaternionAttitudeUncertainty", + /* .title = */ "quaternion_attitude_uncertainty", + /* .docs = */ "Filter reported quaternion uncertainties.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::Wgs84GravityMag; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "magnitude", + /* .docs = */ "[meters/second^2]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::Wgs84GravityMag", + /* .title = */ "wgs84_gravity_mag", + /* .docs = */ "Filter reported WGS84 gravity magnitude.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::HeadingUpdateState::HeadingSource; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "NONE", "" }, + { uint32_t(1), "MAGNETOMETER", "" }, + { uint32_t(2), "GNSS_VELOCITY_VECTOR", "" }, + { uint32_t(4), "EXTERNAL", "" }, + { uint32_t(8), "DUAL_ANTENNA", "" }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "HeadingSource", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_filter::HeadingUpdateState; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "heading", + /* .docs = */ "[radians]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "heading_1sigma", + /* .docs = */ "[radians]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "source", + /* .docs = */ "", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "1 if a valid heading update was received in 2 seconds, 0 otherwise.", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::HeadingUpdateState", + /* .title = */ "heading_update_state", + /* .docs = */ "Filter reported heading update state.\n\nHeading updates can be applied from the sources listed below. Note, some of these sources may be combined.\nThe heading value is always relative to true north.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::MagneticModel; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "intensity_north", + /* .docs = */ "[Gauss]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "intensity_east", + /* .docs = */ "[Gauss]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "intensity_down", + /* .docs = */ "[Gauss]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "inclination", + /* .docs = */ "[radians]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "declination", + /* .docs = */ "[radians]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::MagneticModel", + /* .title = */ "magnetic_model", + /* .docs = */ "The World Magnetic Model is used for this data. Please refer to the device user manual for the current version of the model.\nA valid GNSS location is required for the model to be valid.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::AccelScaleFactor; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "scale_factor", + /* .docs = */ "(x,y,z) [dimensionless]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::AccelScaleFactor", + /* .title = */ "accel_scale_factor", + /* .docs = */ "Filter reported accelerometer scale factor expressed in the sensor frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::AccelScaleFactorUncertainty; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "scale_factor_uncert", + /* .docs = */ "(x,y,z) [dimensionless]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::AccelScaleFactorUncertainty", + /* .title = */ "accel_scale_factor_uncertainty", + /* .docs = */ "Filter reported 1-sigma accelerometer scale factor uncertainty expressed in the sensor frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::GyroScaleFactor; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "scale_factor", + /* .docs = */ "(x,y,z) [dimensionless]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::GyroScaleFactor", + /* .title = */ "gyro_scale_factor", + /* .docs = */ "Filter reported gyro scale factor expressed in the sensor frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::GyroScaleFactorUncertainty; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "scale_factor_uncert", + /* .docs = */ "(x,y,z) [dimensionless]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::GyroScaleFactorUncertainty", + /* .title = */ "gyro_scale_factor_uncertainty", + /* .docs = */ "Filter reported 1-sigma gyro scale factor uncertainty expressed in the sensor frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::MagBias; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "bias", + /* .docs = */ "(x,y,z) [Gauss]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::MagBias", + /* .title = */ "mag_bias", + /* .docs = */ "Filter reported magnetometer bias expressed in the sensor frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::MagBiasUncertainty; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "bias_uncert", + /* .docs = */ "(x,y,z) [Gauss]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::MagBiasUncertainty", + /* .title = */ "mag_bias_uncertainty", + /* .docs = */ "Filter reported 1-sigma magnetometer bias uncertainty expressed in the sensor frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::StandardAtmosphere; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "geometric_altitude", + /* .docs = */ "Input into calculation [meters]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "geopotential_altitude", + /* .docs = */ "[meters]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "standard_temperature", + /* .docs = */ "[degC]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "standard_pressure", + /* .docs = */ "[milliBar]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "standard_density", + /* .docs = */ "[kilogram/meter^3]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::StandardAtmosphere", + /* .title = */ "standard_atmosphere", + /* .docs = */ "Filter reported standard atmosphere parameters.\n\nThe US 1976 Standard Atmosphere Model is used. A valid GNSS location is required for the model to be valid.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::PressureAltitude; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "pressure_altitude", + /* .docs = */ "[meters]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::PressureAltitude", + /* .title = */ "pressure_altitude", + /* .docs = */ "Filter reported pressure altitude.\n\nThe US 1976 Standard Atmosphere Model is used to calculate the pressure altitude in meters.\nA valid pressure sensor reading is required for the pressure altitude to be valid.\nThe minimum pressure reading supported by the model is 0.0037 mBar, corresponding to an altitude of 84,852 meters.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::DensityAltitude; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "density_altitude", + /* .docs = */ "m", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::DensityAltitude", + /* .title = */ "density_altitude", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::AntennaOffsetCorrection; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "offset", + /* .docs = */ "(x,y,z) [meters]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::AntennaOffsetCorrection", + /* .title = */ "antenna_offset_correction", + /* .docs = */ "Filter reported GNSS antenna offset in vehicle frame.\n\nThis offset added to any previously stored offset vector to compensate for errors in definition.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::AntennaOffsetCorrectionUncertainty; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "offset_uncert", + /* .docs = */ "(x,y,z) [meters]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::AntennaOffsetCorrectionUncertainty", + /* .title = */ "antenna_offset_correction_uncertainty", + /* .docs = */ "Filter reported 1-sigma GNSS antenna offset uncertainties in vehicle frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::MultiAntennaOffsetCorrection; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "receiver_id", + /* .docs = */ "Receiver ID for the receiver to which the antenna is attached", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "offset", + /* .docs = */ "(x,y,z) [meters]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::MultiAntennaOffsetCorrection", + /* .title = */ "multi_antenna_offset_correction", + /* .docs = */ "Filter reported GNSS antenna offset in vehicle frame.\n\nThis offset added to any previously stored offset vector to compensate for errors in definition.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::MultiAntennaOffsetCorrectionUncertainty; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "receiver_id", + /* .docs = */ "Receiver ID for the receiver to which the antenna is attached", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "offset_uncert", + /* .docs = */ "(x,y,z) [meters]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::MultiAntennaOffsetCorrectionUncertainty", + /* .title = */ "multi_antenna_offset_correction_uncertainty", + /* .docs = */ "Filter reported 1-sigma GNSS antenna offset uncertainties in vehicle frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::MagnetometerOffset; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "hard_iron", + /* .docs = */ "(x,y,z) [Gauss]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::MagnetometerOffset", + /* .title = */ "magnetometer_offset", + /* .docs = */ "Filter reported magnetometer hard iron offset in sensor frame.\n\nThis offset added to any previously stored hard iron offset vector to compensate for magnetometer in-run bias errors.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::MagnetometerMatrix; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "soft_iron", + /* .docs = */ "Row-major [dimensionless]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::MagnetometerMatrix", + /* .title = */ "magnetometer_matrix", + /* .docs = */ "Filter reported magnetometer soft iron matrix in sensor frame.\n\nThis matrix is post multiplied to any previously stored soft iron matrix to compensate for magnetometer in-run errors.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::MagnetometerOffsetUncertainty; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "hard_iron_uncertainty", + /* .docs = */ "(x,y,z) [Gauss]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::MagnetometerOffsetUncertainty", + /* .title = */ "magnetometer_offset_uncertainty", + /* .docs = */ "Filter reported 1-sigma magnetometer hard iron offset uncertainties in sensor frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::MagnetometerMatrixUncertainty; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "soft_iron_uncertainty", + /* .docs = */ "Row-major [dimensionless]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::MagnetometerMatrixUncertainty", + /* .title = */ "magnetometer_matrix_uncertainty", + /* .docs = */ "Filter reported 1-sigma magnetometer soft iron matrix uncertainties in sensor frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::MagnetometerCovarianceMatrix; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "covariance", + /* .docs = */ "", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::MagnetometerCovarianceMatrix", + /* .title = */ "magnetometer_covariance_matrix", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::MagnetometerResidualVector; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "residual", + /* .docs = */ "(x,y,z) [Gauss]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::MagnetometerResidualVector", + /* .title = */ "magnetometer_residual_vector", + /* .docs = */ "Filter reported magnetometer measurement residuals in vehicle frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::ClockCorrection; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "receiver_id", + /* .docs = */ "1, 2, etc.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "bias", + /* .docs = */ "[seconds]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "bias_drift", + /* .docs = */ "[seconds/second]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::ClockCorrection", + /* .title = */ "clock_correction", + /* .docs = */ "Filter reported GNSS receiver clock error parameters.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::ClockCorrectionUncertainty; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "receiver_id", + /* .docs = */ "1, 2, etc.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "bias_uncertainty", + /* .docs = */ "[seconds]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "bias_drift_uncertainty", + /* .docs = */ "[seconds/second]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::ClockCorrectionUncertainty", + /* .title = */ "clock_correction_uncertainty", + /* .docs = */ "Filter reported 1-sigma GNSS receiver clock error parameters.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::GnssAidStatusFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "tight_coupling", "If 1, the Kalman filter is processing raw range information from this GNSS module" }, + { uint32_t(2), "differential", "If 1, the Kalman filter is processing RTK corrections from this GNSS module" }, + { uint32_t(4), "integer_fix", "If 1, the Kalman filter has an RTK integer fix from this GNSS module, indicating the best position performance possible" }, + { uint32_t(8), "GPS_L1", "If 1, the Kalman filter is using GPS L1 measurements" }, + { uint32_t(16), "GPS_L2", "If 1, the Kalman filter is using GPS L2 measurements" }, + { uint32_t(32), "GPS_L5", "If 1, the Kalman filter is using GPS L5 measurements (not available on the GQ7)" }, + { uint32_t(64), "GLO_L1", "If 1, the Kalman filter is using GLONASS L1 measurements" }, + { uint32_t(128), "GLO_L2", "If 1, the Kalman filter is using GLONASS L2 measurements" }, + { uint32_t(256), "GAL_E1", "If 1, the Kalman filter is using Galileo E1 measurements" }, + { uint32_t(512), "GAL_E5", "If 1, the Kalman filter is using Galileo E5 measurements" }, + { uint32_t(1024), "GAL_E6", "If 1, the Kalman filter is using Galileo E6 measurements" }, + { uint32_t(2048), "BEI_B1", "If 1, the Kalman filter is using Beidou B1 measurements (not enabled on GQ7 currently)" }, + { uint32_t(4096), "BEI_B2", "If 1, the Kalman filter is using Beidou B2 measurements (not enabled on GQ7 currently)" }, + { uint32_t(8192), "BEI_B3", "If 1, the Kalman filter is using Beidou B3 measurements (not available on the GQ7)" }, + { uint32_t(16384), "no_fix", "If 1, this GNSS module is reporting no position fix" }, + { uint32_t(32768), "config_error", "If 1, there is likely an issue with the antenna offset for this GNSS module" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "GnssAidStatusFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_filter::GnssPosAidStatus; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "receiver_id", + /* .docs = */ "", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "time_of_week", + /* .docs = */ "Last GNSS aiding measurement time of week [seconds]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "status", + /* .docs = */ "Aiding measurement status bitfield", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "reserved", + /* .docs = */ "", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 8, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::GnssPosAidStatus", + /* .title = */ "GNSS Position Aiding Status", + /* .docs = */ "Filter reported GNSS position aiding status", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::GnssAttAidStatus; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "time_of_week", + /* .docs = */ "Last valid aiding measurement time of week [seconds] [processed instead of measured?]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "status", + /* .docs = */ "Last valid aiding measurement status bitfield", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "reserved", + /* .docs = */ "", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 8, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::GnssAttAidStatus", + /* .title = */ "GNSS Attitude Aiding Status", + /* .docs = */ "Filter reported dual antenna GNSS attitude aiding status", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::HeadAidStatus::HeadingAidType; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(1), "DUAL_ANTENNA", "" }, + { uint32_t(2), "EXTERNAL_MESSAGE", "" }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "HeadingAidType", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_filter::HeadAidStatus; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "time_of_week", + /* .docs = */ "Last valid aiding measurement time of week [seconds] [processed instead of measured?]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "type", + /* .docs = */ "1 - Dual antenna, 2 - External heading message (user supplied)", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "reserved", + /* .docs = */ "", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 2, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::HeadAidStatus", + /* .title = */ "head_aid_status", + /* .docs = */ "Filter reported GNSS heading aiding status", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::RelPosNed; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "relative_position", + /* .docs = */ "[meters, NED]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::RelPosNed", + /* .title = */ "NED Relative Position", + /* .docs = */ "Filter reported relative position, with respect to configured reference position", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::EcefPos; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "position_ecef", + /* .docs = */ "[meters, ECEF]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::EcefPos", + /* .title = */ "ECEF Position", + /* .docs = */ "Filter reported ECEF position", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::EcefVel; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "velocity_ecef", + /* .docs = */ "[meters/second, ECEF]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::EcefVel", + /* .title = */ "ECEF Velocity", + /* .docs = */ "Filter reported ECEF velocity", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::EcefPosUncertainty; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "pos_uncertainty", + /* .docs = */ "[meters]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::EcefPosUncertainty", + /* .title = */ "ECEF Position Uncertainty", + /* .docs = */ "Filter reported 1-sigma position uncertainty in the ECEF frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::EcefVelUncertainty; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "vel_uncertainty", + /* .docs = */ "[meters/second]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::EcefVelUncertainty", + /* .title = */ "ECEF Velocity Uncertainty", + /* .docs = */ "Filter reported 1-sigma velocity uncertainties in the ECEF frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::FilterAidingMeasurementType; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(1), "GNSS", "" }, + { uint32_t(2), "DUAL_ANTENNA", "" }, + { uint32_t(3), "HEADING", "" }, + { uint32_t(4), "PRESSURE", "" }, + { uint32_t(5), "MAGNETOMETER", "" }, + { uint32_t(6), "SPEED", "" }, + { uint32_t(33), "AIDING_POS_ECEF", "" }, + { uint32_t(34), "AIDING_POS_LLH", "" }, + { uint32_t(35), "AIDING_HEIGHT_ABOVE_ELLIPSOID", "" }, + { uint32_t(40), "AIDING_VEL_ECEF", "" }, + { uint32_t(41), "AIDING_VEL_NED", "" }, + { uint32_t(42), "AIDING_VEL_BODY_FRAME", "" }, + { uint32_t(49), "AIDING_HEADING_TRUE", "" }, + { uint32_t(50), "AIDING_MAGNETIC_FIELD", "" }, + { uint32_t(51), "AIDING_PRESSURE", "" }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "FilterAidingMeasurementType", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_filter::FilterMeasurementIndicator; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "enabled", "" }, + { uint32_t(2), "used", "" }, + { uint32_t(4), "residual_high_warning", "" }, + { uint32_t(8), "sample_time_warning", "" }, + { uint32_t(16), "configuration_error", "" }, + { uint32_t(32), "max_num_meas_exceeded", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "FilterMeasurementIndicator", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_filter::AidingMeasurementSummary; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "time_of_week", + /* .docs = */ "[seconds]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "source", + /* .docs = */ "", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "type", + /* .docs = */ "(see product manual for supported types) Note: values 0x20 and above correspond to commanded aiding measurements in the 0x13 Aiding command set.", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "indicator", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::AidingMeasurementSummary", + /* .title = */ "aiding_measurement_summary", + /* .docs = */ "Filter reported aiding measurement summary. This message contains a summary of the specified aiding measurement over the previous measurement interval ending at the specified time.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::OdometerScaleFactorError; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "scale_factor_error", + /* .docs = */ "[dimensionless]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::OdometerScaleFactorError", + /* .title = */ "Odometer Scale Factor Error", + /* .docs = */ "Filter reported odometer scale factor error. The total scale factor estimate is the user indicated scale factor, plus the user indicated scale factor times the scale factor error.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::OdometerScaleFactorErrorUncertainty; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "scale_factor_error_uncertainty", + /* .docs = */ "[dimensionless]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::OdometerScaleFactorErrorUncertainty", + /* .title = */ "Odometer Scale Factor Error Uncertainty", + /* .docs = */ "Filter reported odometer scale factor error uncertainty.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::GnssDualAntennaStatus::FixType; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "FIX_NONE", "" }, + { uint32_t(1), "FIX_DA_FLOAT", "" }, + { uint32_t(2), "FIX_DA_FIXED", "" }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "FixType", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_filter::GnssDualAntennaStatus::DualAntennaStatusFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "rcv_1_data_valid", "" }, + { uint32_t(2), "rcv_2_data_valid", "" }, + { uint32_t(4), "antenna_offsets_valid", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "DualAntennaStatusFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_filter::GnssDualAntennaStatus; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "time_of_week", + /* .docs = */ "Last dual-antenna GNSS aiding measurement time of week [seconds]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "heading", + /* .docs = */ "[radians]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "heading_unc", + /* .docs = */ "[radians]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "fix_type", + /* .docs = */ "Fix type indicator", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "status_flags", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "0 - invalid, 1 - valid", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::GnssDualAntennaStatus", + /* .title = */ "GNSS Dual Antenna Status", + /* .docs = */ "Summary information for status of GNSS dual antenna heading estimate.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::AidingFrameConfigError; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "frame_id", + /* .docs = */ "Frame ID for the receiver to which the antenna is attached", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "translation", + /* .docs = */ "Translation config X, Y, and Z (m).", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "attitude", + /* .docs = */ "Attitude quaternion", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::AidingFrameConfigError", + /* .title = */ "Aiding Frame Configuration Error", + /* .docs = */ "Filter reported aiding source frame configuration error\n\nThese estimates are used to compensate for small errors to the user-supplied aiding frame configurations (set with (0x13, 0x01) command ).", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_filter::AidingFrameConfigErrorUncertainty; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "frame_id", + /* .docs = */ "Frame ID for the receiver to which the antenna is attached", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "translation_unc", + /* .docs = */ "Translation uncertaint X, Y, and Z (m).", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "attitude_unc", + /* .docs = */ "Attitude uncertainty, X, Y, and Z (radians).", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_filter::AidingFrameConfigErrorUncertainty", + /* .title = */ "Aiding Frame Configuration Error Uncertainty", + /* .docs = */ "Filter reported aiding source frame configuration error uncertainty\n\nThese estimates are used to compensate for small errors to the user-supplied aiding frame configurations (set with (0x13, 0x01) command ).", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + + +static constexpr inline std::initializer_list DATA_FILTER = { + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, +}; + + +} // namespace mip::metadata + diff --git a/src/cpp/mip/metadata/definitions/data_gnss.hpp b/src/cpp/mip/metadata/definitions/data_gnss.hpp new file mode 100644 index 000000000..ab0ca985e --- /dev/null +++ b/src/cpp/mip/metadata/definitions/data_gnss.hpp @@ -0,0 +1,3815 @@ +#pragma once + +#include + +#include + +#include + +namespace mip::metadata +{ + + +template<> +struct MetadataFor +{ + using type = data_gnss::PosLlh::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "lat_lon", "" }, + { uint32_t(2), "ellipsoid_height", "" }, + { uint32_t(4), "msl_height", "" }, + { uint32_t(8), "horizontal_accuracy", "" }, + { uint32_t(16), "vertical_accuracy", "" }, + { uint32_t(31), "flags", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::PosLlh; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "latitude", + /* .docs = */ "[degrees]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "longitude", + /* .docs = */ "[degrees]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "ellipsoid_height", + /* .docs = */ "[meters]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "msl_height", + /* .docs = */ "[meters]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "horizontal_accuracy", + /* .docs = */ "[meters]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "vertical_accuracy", + /* .docs = */ "[meters]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_gnss::PosLlh", + /* .title = */ "GNSS LLH Position", + /* .docs = */ "GNSS reported position in the WGS84 geodetic frame", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::PosEcef::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "position", "" }, + { uint32_t(2), "position_accuracy", "" }, + { uint32_t(3), "flags", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::PosEcef; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "x", + /* .docs = */ "[meters]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "x_accuracy", + /* .docs = */ "[meters]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_gnss::PosEcef", + /* .title = */ "GNSS ECEF Position", + /* .docs = */ "GNSS reported position in the Earth-centered, Earth-Fixed (ECEF) frame", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::VelNed::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "velocity", "" }, + { uint32_t(2), "speed_3d", "" }, + { uint32_t(4), "ground_speed", "" }, + { uint32_t(8), "heading", "" }, + { uint32_t(16), "speed_accuracy", "" }, + { uint32_t(32), "heading_accuracy", "" }, + { uint32_t(63), "flags", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::VelNed; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "v", + /* .docs = */ "[meters/second]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "speed", + /* .docs = */ "[meters/second]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "ground_speed", + /* .docs = */ "[meters/second]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "heading", + /* .docs = */ "[degrees]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "speed_accuracy", + /* .docs = */ "[meters/second]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "heading_accuracy", + /* .docs = */ "[degrees]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_gnss::VelNed", + /* .title = */ "NED Velocity", + /* .docs = */ "GNSS reported velocity in the NED frame", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::VelEcef::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "velocity", "" }, + { uint32_t(2), "velocity_accuracy", "" }, + { uint32_t(3), "flags", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::VelEcef; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "v", + /* .docs = */ "[meters/second]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "v_accuracy", + /* .docs = */ "[meters/second]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_gnss::VelEcef", + /* .title = */ "GNSS ECEF Velocity", + /* .docs = */ "GNSS reported velocity in the Earth-centered, Earth-Fixed (ECEF) frame", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::Dop::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "gdop", "" }, + { uint32_t(2), "pdop", "" }, + { uint32_t(4), "hdop", "" }, + { uint32_t(8), "vdop", "" }, + { uint32_t(16), "tdop", "" }, + { uint32_t(32), "ndop", "" }, + { uint32_t(64), "edop", "" }, + { uint32_t(127), "flags", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::Dop; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "gdop", + /* .docs = */ "Geometric DOP", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "pdop", + /* .docs = */ "Position DOP", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "hdop", + /* .docs = */ "Horizontal DOP", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "vdop", + /* .docs = */ "Vertical DOP", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "tdop", + /* .docs = */ "Time DOP", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "ndop", + /* .docs = */ "Northing DOP", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "edop", + /* .docs = */ "Easting DOP", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_gnss::Dop", + /* .title = */ "dop", + /* .docs = */ "GNSS reported dilution of precision information.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::UtcTime::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "gnss_date_time", "" }, + { uint32_t(2), "leap_seconds_known", "" }, + { uint32_t(3), "flags", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::UtcTime; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "year", + /* .docs = */ "", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "month", + /* .docs = */ "Month (1-12)", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "day", + /* .docs = */ "Day (1-31)", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "hour", + /* .docs = */ "Hour (0-23)", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "min", + /* .docs = */ "Minute (0-59)", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "sec", + /* .docs = */ "Second (0-59)", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "msec", + /* .docs = */ "Millisecond(0-999)", + /* .type = */ {Type::U32, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_gnss::UtcTime", + /* .title = */ "utc_time", + /* .docs = */ "GNSS reported Coordinated Universal Time", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::GpsTime::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "tow", "" }, + { uint32_t(2), "week_number", "" }, + { uint32_t(3), "flags", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::GpsTime; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "tow", + /* .docs = */ "GPS Time of week [seconds]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "week_number", + /* .docs = */ "GPS Week since 1980 [weeks]", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_gnss::GpsTime", + /* .title = */ "gps_time", + /* .docs = */ "GNSS reported GPS Time", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::ClockInfo::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "bias", "" }, + { uint32_t(2), "drift", "" }, + { uint32_t(4), "accuracy_estimate", "" }, + { uint32_t(7), "flags", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::ClockInfo; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "bias", + /* .docs = */ "[seconds]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "drift", + /* .docs = */ "[seconds/second]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "accuracy_estimate", + /* .docs = */ "[seconds]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_gnss::ClockInfo", + /* .title = */ "clock_info", + /* .docs = */ "GNSS reported receiver clock parameters", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::FixInfo::FixType; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "FIX_3D", "" }, + { uint32_t(1), "FIX_2D", "" }, + { uint32_t(2), "FIX_TIME_ONLY", "" }, + { uint32_t(3), "FIX_NONE", "" }, + { uint32_t(4), "FIX_INVALID", "" }, + { uint32_t(5), "FIX_RTK_FLOAT", "" }, + { uint32_t(6), "FIX_RTK_FIXED", "" }, + { uint32_t(7), "FIX_DIFFERENTIAL", "" }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "FixType", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::FixInfo::FixFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "sbas_used", "" }, + { uint32_t(2), "dgnss_used", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "FixFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::FixInfo::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "fix_type", "" }, + { uint32_t(2), "num_sv", "" }, + { uint32_t(4), "fix_flags", "" }, + { uint32_t(7), "flags", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::FixInfo; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "fix_type", + /* .docs = */ "", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "num_sv", + /* .docs = */ "", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "fix_flags", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_gnss::FixInfo", + /* .title = */ "fix_info", + /* .docs = */ "GNSS reported position fix type", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::SvInfo::SVFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "used_for_navigation", "" }, + { uint32_t(2), "healthy", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "SVFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::SvInfo::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "channel", "" }, + { uint32_t(2), "sv_id", "" }, + { uint32_t(4), "carrier_noise_ratio", "" }, + { uint32_t(8), "azimuth", "" }, + { uint32_t(16), "elevation", "" }, + { uint32_t(32), "sv_flags", "" }, + { uint32_t(63), "flags", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::SvInfo; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "channel", + /* .docs = */ "Receiver channel number", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "sv_id", + /* .docs = */ "GNSS Satellite ID", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "carrier_noise_ratio", + /* .docs = */ "[dBHz]", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "azimuth", + /* .docs = */ "[deg]", + /* .type = */ {Type::S16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "elevation", + /* .docs = */ "[deg]", + /* .type = */ {Type::S16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "sv_flags", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_gnss::SvInfo", + /* .title = */ "sv_info", + /* .docs = */ "GNSS reported space vehicle information\n\nWhen enabled, these fields will arrive in separate MIP packets", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::HwStatus::ReceiverState; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "OFF", "" }, + { uint32_t(1), "ON", "" }, + { uint32_t(2), "UNKNOWN", "" }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "ReceiverState", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::HwStatus::AntennaState; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(1), "INIT", "" }, + { uint32_t(2), "SHORT", "" }, + { uint32_t(3), "OPEN", "" }, + { uint32_t(4), "GOOD", "" }, + { uint32_t(5), "UNKNOWN", "" }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "AntennaState", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::HwStatus::AntennaPower; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "OFF", "" }, + { uint32_t(1), "ON", "" }, + { uint32_t(2), "UNKNOWN", "" }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "AntennaPower", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::HwStatus::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "sensor_state", "" }, + { uint32_t(2), "antenna_state", "" }, + { uint32_t(4), "antenna_power", "" }, + { uint32_t(7), "flags", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::HwStatus; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "receiver_state", + /* .docs = */ "", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "antenna_state", + /* .docs = */ "", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "antenna_power", + /* .docs = */ "", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_gnss::HwStatus", + /* .title = */ "GNSS Hardware Status", + /* .docs = */ "GNSS reported hardware status", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::DgpsInfo::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "age", "" }, + { uint32_t(2), "base_station_id", "" }, + { uint32_t(4), "base_station_status", "" }, + { uint32_t(8), "num_channels", "" }, + { uint32_t(15), "flags", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::DgpsInfo; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "sv_id", + /* .docs = */ "", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "age", + /* .docs = */ "", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "range_correction", + /* .docs = */ "", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "range_rate_correction", + /* .docs = */ "", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_gnss::DgpsInfo", + /* .title = */ "dgps_info", + /* .docs = */ "GNSS reported DGNSS status\n\n
Possible Base Station Status Values:
\n
  0 - UDRE Scale Factor = 1.0
\n
  1 - UDRE Scale Factor = 0.75
\n
  2 - UDRE Scale Factor = 0.5
\n
  3 - UDRE Scale Factor = 0.3
\n
  4 - UDRE Scale Factor = 0.2
\n
  5 - UDRE Scale Factor = 0.1
\n
  6 - Reference Station Transmission Not Monitored
\n
  7 - Reference Station Not Working
\n\n(UDRE = User Differential Range Error)", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::DgpsChannel::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "id", "" }, + { uint32_t(2), "age", "" }, + { uint32_t(4), "range_correction", "" }, + { uint32_t(8), "range_rate_correction", "" }, + { uint32_t(15), "flags", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::DgpsChannel; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "sv_id", + /* .docs = */ "", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "age", + /* .docs = */ "[s]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "range_correction", + /* .docs = */ "[m]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "range_rate_correction", + /* .docs = */ "[m/s]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_gnss::DgpsChannel", + /* .title = */ "dgps_channel", + /* .docs = */ "GNSS reported DGPS Channel Status status\n\nWhen enabled, a separate field for each active space vehicle will be sent in the packet.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::ClockInfo2::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "bias", "" }, + { uint32_t(2), "drift", "" }, + { uint32_t(4), "bias_accuracy", "" }, + { uint32_t(8), "drift_accuracy", "" }, + { uint32_t(15), "flags", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::ClockInfo2; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "bias", + /* .docs = */ "", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "drift", + /* .docs = */ "", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "bias_accuracy_estimate", + /* .docs = */ "", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "drift_accuracy_estimate", + /* .docs = */ "", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_gnss::ClockInfo2", + /* .title = */ "clock_info_2", + /* .docs = */ "GNSS reported receiver clock parameters\n\nThis supersedes MIP_DATA_DESC_GNSS_CLOCK_INFO with additional information.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::GpsLeapSeconds::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(2), "leap_seconds", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::GpsLeapSeconds; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "leap_seconds", + /* .docs = */ "[s]", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_gnss::GpsLeapSeconds", + /* .title = */ "gps_leap_seconds", + /* .docs = */ "GNSS reported leap seconds (difference between GPS and UTC Time)", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::SbasSystem; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "UNKNOWN", "" }, + { uint32_t(1), "WAAS", "" }, + { uint32_t(2), "EGNOS", "" }, + { uint32_t(3), "MSAS", "" }, + { uint32_t(4), "GAGAN", "" }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "SbasSystem", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::SbasInfo::SbasStatus; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "range_available", "" }, + { uint32_t(2), "corrections_available", "" }, + { uint32_t(4), "integrity_available", "" }, + { uint32_t(8), "test_mode", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "SbasStatus", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::SbasInfo::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "tow", "" }, + { uint32_t(2), "week_number", "" }, + { uint32_t(4), "sbas_system", "" }, + { uint32_t(8), "sbas_id", "" }, + { uint32_t(16), "count", "" }, + { uint32_t(32), "sbas_status", "" }, + { uint32_t(63), "flags", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::SbasInfo; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "time_of_week", + /* .docs = */ "GPS Time of week [seconds]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "week_number", + /* .docs = */ "GPS Week since 1980 [weeks]", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "sbas_system", + /* .docs = */ "SBAS system id", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "sbas_id", + /* .docs = */ "SBAS satellite id.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "count", + /* .docs = */ "Number of SBAS corrections", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "sbas_status", + /* .docs = */ "Status of the SBAS service", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_gnss::SbasInfo", + /* .title = */ "sbas_info", + /* .docs = */ "GNSS SBAS status", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::GnssConstellationId; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "UNKNOWN", "" }, + { uint32_t(1), "GPS", "" }, + { uint32_t(2), "GLONASS", "" }, + { uint32_t(3), "GALILEO", "" }, + { uint32_t(4), "BEIDOU", "" }, + { uint32_t(5), "SBAS", "" }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "GnssConstellationId", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::SbasCorrection::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "udrei", "" }, + { uint32_t(2), "pseudorange_correction", "" }, + { uint32_t(4), "iono_correction", "" }, + { uint32_t(7), "flags", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::SbasCorrection; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "index", + /* .docs = */ "Index of this field in this epoch.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "count", + /* .docs = */ "Total number of fields in this epoch.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "time_of_week", + /* .docs = */ "GPS Time of week the message was received [seconds]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "week_number", + /* .docs = */ "GPS Week since 1980 [weeks]", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "gnss_id", + /* .docs = */ "GNSS constellation id", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "sv_id", + /* .docs = */ "GNSS satellite id within the constellation.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "udrei", + /* .docs = */ "[See above 0-13 usable, 14 not monitored, 15 - do not use]", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "pseudorange_correction", + /* .docs = */ "Pseudo-range correction [meters].", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "iono_correction", + /* .docs = */ "Ionospheric correction [meters].", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_gnss::SbasCorrection", + /* .title = */ "sbas_correction", + /* .docs = */ "GNSS calculated SBAS Correction\n\nUDREI - the variance of a normal distribution associated with the user differential range errors for a\nsatellite after application of fast and long-term corrections, excluding atmospheric effects\n\n
UDREI  Variance
\n
-----------------------
\n
0      0.0520 m^2
\n
1      0.0924 m^2
\n
2      0.1444 m^2
\n
3      0.2830 m^2
\n
4      0.4678 m^2
\n
5      0.8315 m^2
\n
6      1.2992 m^2
\n
7      1.8709 m^2
\n
8      2.5465 m^2
\n
9      3.3260 m^2
\n
10     5.1968 m^2
\n
11     20.7870 m^2
\n
12     230.9661 m^2
\n
13     2078.695 m^2
\n
14     'Not Monitored'
\n
15     'Do Not Use'
", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::RfErrorDetection::RFBand; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "UNKNOWN", "" }, + { uint32_t(1), "L1", "" }, + { uint32_t(2), "L2", "" }, + { uint32_t(5), "L5", "" }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "RFBand", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::RfErrorDetection::JammingState; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "UNKNOWN", "" }, + { uint32_t(1), "NONE", "" }, + { uint32_t(2), "PARTIAL", "" }, + { uint32_t(3), "SIGNIFICANT", "" }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "JammingState", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::RfErrorDetection::SpoofingState; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "UNKNOWN", "" }, + { uint32_t(1), "NONE", "" }, + { uint32_t(2), "PARTIAL", "" }, + { uint32_t(3), "SIGNIFICANT", "" }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "SpoofingState", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::RfErrorDetection::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "rf_band", "" }, + { uint32_t(2), "jamming_state", "" }, + { uint32_t(4), "spoofing_state", "" }, + { uint32_t(7), "flags", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::RfErrorDetection; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "rf_band", + /* .docs = */ "RF Band of the reported information", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "jamming_state", + /* .docs = */ "GNSS Jamming State (as reported by the GNSS module)", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "spoofing_state", + /* .docs = */ "GNSS Spoofing State (as reported by the GNSS module)", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "reserved", + /* .docs = */ "Reserved for future use", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 4, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_gnss::RfErrorDetection", + /* .title = */ "rf_error_detection", + /* .docs = */ "GNSS Error Detection subsystem status", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::BaseStationInfo::IndicatorFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "gps", "" }, + { uint32_t(2), "glonass", "" }, + { uint32_t(4), "galileo", "" }, + { uint32_t(8), "beidou", "" }, + { uint32_t(16), "ref_station", "" }, + { uint32_t(32), "single_receiver", "" }, + { uint32_t(64), "quarter_cycle_bit1", "" }, + { uint32_t(128), "quarter_cycle_bit2", "" }, + { uint32_t(192), "quarter_cycle_bits", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "IndicatorFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::BaseStationInfo::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "tow", "" }, + { uint32_t(2), "week_number", "" }, + { uint32_t(4), "ecef_position", "" }, + { uint32_t(8), "height", "" }, + { uint32_t(16), "station_id", "" }, + { uint32_t(32), "indicators", "" }, + { uint32_t(63), "flags", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::BaseStationInfo; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "time_of_week", + /* .docs = */ "GPS Time of week the message was received [seconds]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "week_number", + /* .docs = */ "GPS Week since 1980 [weeks]", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "ecef_pos", + /* .docs = */ "Earth-centered, Earth-fixed [m]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "height", + /* .docs = */ "Antenna Height above the marker used in the survey [m]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "station_id", + /* .docs = */ "Range: 0-4095", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "indicators", + /* .docs = */ "Bitfield", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_gnss::BaseStationInfo", + /* .title = */ "base_station_info", + /* .docs = */ "RTCM reported base station information (sourced from RTCM Message 1005 or 1006)\n\nValid Flag Mapping:", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::RtkCorrectionsStatus::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "tow", "" }, + { uint32_t(2), "week_number", "" }, + { uint32_t(4), "epoch_status", "" }, + { uint32_t(8), "dongle_status", "" }, + { uint32_t(16), "gps_latency", "" }, + { uint32_t(32), "glonass_latency", "" }, + { uint32_t(64), "galileo_latency", "" }, + { uint32_t(128), "beidou_latency", "" }, + { uint32_t(255), "flags", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::RtkCorrectionsStatus::EpochStatus; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "antenna_location_received", "" }, + { uint32_t(2), "antenna_description_received", "" }, + { uint32_t(4), "gps_received", "" }, + { uint32_t(8), "glonass_received", "" }, + { uint32_t(16), "galileo_received", "" }, + { uint32_t(32), "beidou_received", "" }, + { uint32_t(64), "using_gps_msm_messages", "Using MSM messages for GPS corrections instead of RTCM messages 1001-1004" }, + { uint32_t(128), "using_glonass_msm_messages", "Using MSM messages for GLONASS corrections instead of RTCM messages 1009-1012" }, + { uint32_t(256), "dongle_status_read_failed", "A read of the dongle status was attempted, but failed" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "EpochStatus", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::RtkCorrectionsStatus; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "time_of_week", + /* .docs = */ "GPS Time of week [seconds]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "week_number", + /* .docs = */ "GPS Week since 1980 [weeks]", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "epoch_status", + /* .docs = */ "Status of the corrections received during this epoch", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "dongle_status", + /* .docs = */ "RTK Dongle Status Flags (valid only when using RTK dongle, see Get RTK Device Status Flags (0x0F,0x01) for details)", + /* .type = */ {Type::U32, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "gps_correction_latency", + /* .docs = */ "Latency of last GPS correction [seconds]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "glonass_correction_latency", + /* .docs = */ "Latency of last GLONASS correction [seconds]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "galileo_correction_latency", + /* .docs = */ "Latency of last Galileo correction [seconds]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "beidou_correction_latency", + /* .docs = */ "Latency of last Beidou correction [seconds]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "reserved", + /* .docs = */ "Reserved for future use", + /* .type = */ {Type::U32, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 4, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_gnss::RtkCorrectionsStatus", + /* .title = */ "rtk_corrections_status", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::SatelliteStatus::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "tow", "" }, + { uint32_t(2), "week_number", "" }, + { uint32_t(4), "gnss_id", "" }, + { uint32_t(8), "satellite_id", "" }, + { uint32_t(16), "elevation", "" }, + { uint32_t(32), "azimuth", "" }, + { uint32_t(64), "health", "" }, + { uint32_t(127), "flags", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::SatelliteStatus; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "index", + /* .docs = */ "Index of this field in this epoch.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "count", + /* .docs = */ "Total number of fields in this epoch.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "time_of_week", + /* .docs = */ "GPS Time of week [seconds]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "week_number", + /* .docs = */ "GPS Week since 1980 [weeks]", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "gnss_id", + /* .docs = */ "", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "satellite_id", + /* .docs = */ "GNSS satellite id within the constellation", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "elevation", + /* .docs = */ "Elevation of the satellite relative to the rover [degrees]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "azimuth", + /* .docs = */ "Azimuth of the satellite relative to the rover [degrees]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "health", + /* .docs = */ "True if the satellite is healthy.", + /* .type = */ {Type::BOOL, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_gnss::SatelliteStatus", + /* .title = */ "satellite_status", + /* .docs = */ "Status information for a GNSS satellite.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::GnssSignalId; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "UNKNOWN", "" }, + { uint32_t(1), "GPS_L1CA", "" }, + { uint32_t(2), "GPS_L1P", "" }, + { uint32_t(3), "GPS_L1Z", "" }, + { uint32_t(4), "GPS_L2CA", "" }, + { uint32_t(5), "GPS_L2P", "" }, + { uint32_t(6), "GPS_L2Z", "" }, + { uint32_t(7), "GPS_L2CL", "" }, + { uint32_t(8), "GPS_L2CM", "" }, + { uint32_t(9), "GPS_L2CML", "" }, + { uint32_t(10), "GPS_L5I", "" }, + { uint32_t(11), "GPS_L5Q", "" }, + { uint32_t(12), "GPS_L5IQ", "" }, + { uint32_t(13), "GPS_L1CD", "" }, + { uint32_t(14), "GPS_L1CP", "" }, + { uint32_t(15), "GPS_L1CDP", "" }, + { uint32_t(32), "GLONASS_G1CA", "" }, + { uint32_t(33), "GLONASS_G1P", "" }, + { uint32_t(34), "GLONASS_G2C", "" }, + { uint32_t(35), "GLONASS_G2P", "" }, + { uint32_t(64), "GALILEO_E1C", "" }, + { uint32_t(65), "GALILEO_E1A", "" }, + { uint32_t(66), "GALILEO_E1B", "" }, + { uint32_t(67), "GALILEO_E1BC", "" }, + { uint32_t(68), "GALILEO_E1ABC", "" }, + { uint32_t(69), "GALILEO_E6C", "" }, + { uint32_t(70), "GALILEO_E6A", "" }, + { uint32_t(71), "GALILEO_E6B", "" }, + { uint32_t(72), "GALILEO_E6BC", "" }, + { uint32_t(73), "GALILEO_E6ABC", "" }, + { uint32_t(74), "GALILEO_E5BI", "" }, + { uint32_t(75), "GALILEO_E5BQ", "" }, + { uint32_t(76), "GALILEO_E5BIQ", "" }, + { uint32_t(77), "GALILEO_E5ABI", "" }, + { uint32_t(78), "GALILEO_E5ABQ", "" }, + { uint32_t(79), "GALILEO_E5ABIQ", "" }, + { uint32_t(80), "GALILEO_E5AI", "" }, + { uint32_t(81), "GALILEO_E5AQ", "" }, + { uint32_t(82), "GALILEO_E5AIQ", "" }, + { uint32_t(96), "SBAS_L1CA", "" }, + { uint32_t(97), "SBAS_L5I", "" }, + { uint32_t(98), "SBAS_L5Q", "" }, + { uint32_t(99), "SBAS_L5IQ", "" }, + { uint32_t(128), "QZSS_L1CA", "" }, + { uint32_t(129), "QZSS_LEXS", "" }, + { uint32_t(130), "QZSS_LEXL", "" }, + { uint32_t(131), "QZSS_LEXSL", "" }, + { uint32_t(132), "QZSS_L2CM", "" }, + { uint32_t(133), "QZSS_L2CL", "" }, + { uint32_t(134), "QZSS_L2CML", "" }, + { uint32_t(135), "QZSS_L5I", "" }, + { uint32_t(136), "QZSS_L5Q", "" }, + { uint32_t(137), "QZSS_L5IQ", "" }, + { uint32_t(138), "QZSS_L1CD", "" }, + { uint32_t(139), "QZSS_L1CP", "" }, + { uint32_t(140), "QZSS_L1CDP", "" }, + { uint32_t(160), "BEIDOU_B1I", "" }, + { uint32_t(161), "BEIDOU_B1Q", "" }, + { uint32_t(162), "BEIDOU_B1IQ", "" }, + { uint32_t(163), "BEIDOU_B3I", "" }, + { uint32_t(164), "BEIDOU_B3Q", "" }, + { uint32_t(165), "BEIDOU_B3IQ", "" }, + { uint32_t(166), "BEIDOU_B2I", "" }, + { uint32_t(167), "BEIDOU_B2Q", "" }, + { uint32_t(168), "BEIDOU_B2IQ", "" }, + { uint32_t(169), "BEIDOU_B2A", "" }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "GnssSignalId", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::Raw::GnssSignalQuality; + + static constexpr inline EnumInfo::Entry entries[] = { + { uint32_t(0), "NONE", "" }, + { uint32_t(1), "SEARCHING", "" }, + { uint32_t(2), "ACQUIRED", "" }, + { uint32_t(3), "UNUSABLE", "" }, + { uint32_t(4), "TIME_LOCKED", "" }, + { uint32_t(5), "FULLY_LOCKED", "" }, + }; + + static constexpr inline EnumInfo value = { + /* .name = */ "GnssSignalQuality", + /* .docs = */ "", + /* .type = */ Type::U8, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::Raw::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "tow", "" }, + { uint32_t(2), "week_number", "" }, + { uint32_t(4), "receiver_id", "" }, + { uint32_t(8), "tracking_channel", "" }, + { uint32_t(16), "gnss_id", "" }, + { uint32_t(32), "satellite_id", "" }, + { uint32_t(64), "signal_id", "" }, + { uint32_t(128), "signal_strength", "" }, + { uint32_t(256), "quality", "" }, + { uint32_t(512), "pseudorange", "" }, + { uint32_t(1024), "carrier_phase", "" }, + { uint32_t(2048), "doppler", "" }, + { uint32_t(4096), "range_uncertainty", "" }, + { uint32_t(8192), "carrier_phase_uncertainty", "" }, + { uint32_t(16384), "doppler_uncertainty", "" }, + { uint32_t(32768), "lock_time", "" }, + { uint32_t(65535), "flags", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::Raw; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "index", + /* .docs = */ "Index of this field in this epoch.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "count", + /* .docs = */ "Total number of fields in this epoch.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "time_of_week", + /* .docs = */ "GPS Time of week [seconds]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "week_number", + /* .docs = */ "GPS Week since 1980 [weeks]", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "receiver_id", + /* .docs = */ "When the measurement comes from RTCM, this will be the reference station ID; otherwise, it's the receiver number (1,2,...)", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "tracking_channel", + /* .docs = */ "Channel the receiver is using to track this satellite.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "gnss_id", + /* .docs = */ "", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "satellite_id", + /* .docs = */ "GNSS satellite id within the constellation.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "signal_id", + /* .docs = */ "Signal identifier for the satellite.", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "signal_strength", + /* .docs = */ "Carrier to noise ratio [dBHz].", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "quality", + /* .docs = */ "Indicator of signal quality.", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "pseudorange", + /* .docs = */ "Pseudo-range measurement [meters].", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "carrier_phase", + /* .docs = */ "Carrier phase measurement [Carrier periods].", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "doppler", + /* .docs = */ "Measured doppler shift [Hz].", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "range_uncert", + /* .docs = */ "Uncertainty of the pseudo-range measurement [m].", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "phase_uncert", + /* .docs = */ "Uncertainty of the phase measurement [Carrier periods].", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "doppler_uncert", + /* .docs = */ "Uncertainty of the measured doppler shift [Hz].", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "lock_time", + /* .docs = */ "DOC\nMinimum carrier phase lock time [s]. Note: the maximum value is dependent on the receiver.", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_gnss::Raw", + /* .title = */ "raw", + /* .docs = */ "GNSS Raw observation.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::GpsEphemeris::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "ephemeris", "" }, + { uint32_t(2), "modern_data", "" }, + { uint32_t(4), "isc_l5", "" }, + { uint32_t(7), "flags", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::GpsEphemeris; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "index", + /* .docs = */ "Index of this field in this epoch.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "count", + /* .docs = */ "Total number of fields in this epoch.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "time_of_week", + /* .docs = */ "GPS Time of week [seconds]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "week_number", + /* .docs = */ "GPS Week since 1980 [weeks]", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "satellite_id", + /* .docs = */ "GNSS satellite id within the constellation.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "health", + /* .docs = */ "Satellite and signal health", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "iodc", + /* .docs = */ "Issue of Data Clock. This increments each time the data changes and\nrolls over at 4. It is used to make sure various raw data elements from\ndifferent sources line up correctly.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "iode", + /* .docs = */ "Issue of Data Ephemeris.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "t_oc", + /* .docs = */ "Reference time for clock data.", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "af0", + /* .docs = */ "Clock bias in [s].", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "af1", + /* .docs = */ "Clock drift in [s/s].", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "af2", + /* .docs = */ "Clock drift rate in [s/s^2].", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "t_gd", + /* .docs = */ "T Group Delay [s].", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "ISC_L1CA", + /* .docs = */ "Inter-signal correction (L1).", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "ISC_L2C", + /* .docs = */ "Inter-signal correction (L2, or L5 if isc_l5 flag is set).", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "t_oe", + /* .docs = */ "Reference time for ephemeris in [s].", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "a", + /* .docs = */ "Semi-major axis [m].", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "a_dot", + /* .docs = */ "Semi-major axis rate [m/s].", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "mean_anomaly", + /* .docs = */ "[rad].", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "delta_mean_motion", + /* .docs = */ "[rad].", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "delta_mean_motion_dot", + /* .docs = */ "[rad/s].", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "eccentricity", + /* .docs = */ "", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "argument_of_perigee", + /* .docs = */ "[rad].", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "omega", + /* .docs = */ "Longitude of Ascending Node [rad].", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "omega_dot", + /* .docs = */ "Rate of Right Ascension [rad/s].", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "inclination", + /* .docs = */ "Inclination angle [rad].", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "inclination_dot", + /* .docs = */ "Inclination angle rate of change [rad/s].", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "c_ic", + /* .docs = */ "Harmonic Correction Term.", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "c_is", + /* .docs = */ "Harmonic Correction Term.", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "c_uc", + /* .docs = */ "Harmonic Correction Term.", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "c_us", + /* .docs = */ "Harmonic Correction Term.", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "c_rc", + /* .docs = */ "Harmonic Correction Term.", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "c_rs", + /* .docs = */ "Harmonic Correction Term.", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_gnss::GpsEphemeris", + /* .title = */ "GPS Ephemeris", + /* .docs = */ "GPS Ephemeris Data", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::GalileoEphemeris::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "ephemeris", "" }, + { uint32_t(2), "modern_data", "" }, + { uint32_t(4), "isc_l5", "" }, + { uint32_t(7), "flags", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::GalileoEphemeris; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "index", + /* .docs = */ "Index of this field in this epoch.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "count", + /* .docs = */ "Total number of fields in this epoch.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "time_of_week", + /* .docs = */ "GPS Time of week [seconds]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "week_number", + /* .docs = */ "GPS Week since 1980 [weeks]", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "satellite_id", + /* .docs = */ "GNSS satellite id within the constellation.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "health", + /* .docs = */ "Satellite and signal health", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "iodc", + /* .docs = */ "Issue of Data Clock. This increments each time the data changes and\nrolls over at 4. It is used to make sure various raw data elements from\ndifferent sources line up correctly.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "iode", + /* .docs = */ "Issue of Data Ephemeris.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "t_oc", + /* .docs = */ "Reference time for clock data.", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "af0", + /* .docs = */ "Clock bias in [s].", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "af1", + /* .docs = */ "Clock drift in [s/s].", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "af2", + /* .docs = */ "Clock drift rate in [s/s^2].", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "t_gd", + /* .docs = */ "T Group Delay [s].", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "ISC_L1CA", + /* .docs = */ "Inter-signal correction (L1).", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "ISC_L2C", + /* .docs = */ "Inter-signal correction (L2, or L5 if isc_l5 flag is set).", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "t_oe", + /* .docs = */ "Reference time for ephemeris in [s].", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "a", + /* .docs = */ "Semi-major axis [m].", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "a_dot", + /* .docs = */ "Semi-major axis rate [m/s].", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "mean_anomaly", + /* .docs = */ "[rad].", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "delta_mean_motion", + /* .docs = */ "[rad].", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "delta_mean_motion_dot", + /* .docs = */ "[rad/s].", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "eccentricity", + /* .docs = */ "", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "argument_of_perigee", + /* .docs = */ "[rad].", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "omega", + /* .docs = */ "Longitude of Ascending Node [rad].", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "omega_dot", + /* .docs = */ "Rate of Right Ascension [rad/s].", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "inclination", + /* .docs = */ "Inclination angle [rad].", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "inclination_dot", + /* .docs = */ "Inclination angle rate of change [rad/s].", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "c_ic", + /* .docs = */ "Harmonic Correction Term.", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "c_is", + /* .docs = */ "Harmonic Correction Term.", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "c_uc", + /* .docs = */ "Harmonic Correction Term.", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "c_us", + /* .docs = */ "Harmonic Correction Term.", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "c_rc", + /* .docs = */ "Harmonic Correction Term.", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "c_rs", + /* .docs = */ "Harmonic Correction Term.", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_gnss::GalileoEphemeris", + /* .title = */ "Galileo Ephemeris", + /* .docs = */ "Galileo Ephemeris Data", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::GloEphemeris::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "ephemeris", "" }, + { uint32_t(1), "flags", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::GloEphemeris; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "index", + /* .docs = */ "Index of this field in this epoch.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "count", + /* .docs = */ "Total number of fields in this epoch.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "time_of_week", + /* .docs = */ "GPS Time of week [seconds]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "week_number", + /* .docs = */ "GPS Week since 1980 [weeks]", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "satellite_id", + /* .docs = */ "GNSS satellite id within the constellation.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "freq_number", + /* .docs = */ "GLONASS frequency number (-7 to 24)", + /* .type = */ {Type::S8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "tk", + /* .docs = */ "Frame start time within current day [seconds]", + /* .type = */ {Type::U32, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "tb", + /* .docs = */ "Ephemeris reference time [seconds]", + /* .type = */ {Type::U32, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "sat_type", + /* .docs = */ "Type of satellite (M) GLONASS = 0, GLONASS-M = 1", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "gamma", + /* .docs = */ "Relative deviation of carrier frequency from nominal [dimensionless]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "tau_n", + /* .docs = */ "Time correction relative to GLONASS Time [seconds]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "x", + /* .docs = */ "Satellite PE-90 position [m]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "v", + /* .docs = */ "Satellite PE-90 velocity [m/s]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "a", + /* .docs = */ "Satellite PE-90 acceleration due to perturbations [m/s^2]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "health", + /* .docs = */ "Satellite Health (Bn), Non-zero indicates satellite malfunction", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "P", + /* .docs = */ "Satellite operation mode (See GLONASS ICD)", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "NT", + /* .docs = */ "Day number within a 4 year period.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "delta_tau_n", + /* .docs = */ "Time difference between L1 and L2[m/s]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "Ft", + /* .docs = */ "User Range Accuracy (See GLONASS ICD)", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "En", + /* .docs = */ "Age of current information [days]", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "P1", + /* .docs = */ "Time interval between adjacent values of tb [minutes]", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "P2", + /* .docs = */ "Oddness '1' or evenness '0' of the value of tb.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "P3", + /* .docs = */ "Number of satellites in almanac for this frame", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "P4", + /* .docs = */ "Flag indicating ephemeris parameters are present", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_gnss::GloEphemeris", + /* .title = */ "Glonass Ephemeris", + /* .docs = */ "Glonass Ephemeris Data", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::GpsIonoCorr::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "tow", "" }, + { uint32_t(2), "week_number", "" }, + { uint32_t(4), "alpha", "" }, + { uint32_t(8), "beta", "" }, + { uint32_t(15), "flags", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::GpsIonoCorr; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "time_of_week", + /* .docs = */ "GPS Time of week [seconds]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "week_number", + /* .docs = */ "GPS Week since 1980 [weeks]", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "alpha", + /* .docs = */ "Ionospheric Correction Terms.", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 4, + /* .condition = */ {}, + }, + { + /* .name = */ "beta", + /* .docs = */ "Ionospheric Correction Terms.", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 4, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_gnss::GpsIonoCorr", + /* .title = */ "GPS Ionospheric Correction", + /* .docs = */ "Ionospheric Correction Terms for GNSS", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::GalileoIonoCorr::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "tow", "" }, + { uint32_t(2), "week_number", "" }, + { uint32_t(4), "alpha", "" }, + { uint32_t(8), "disturbance_flags", "" }, + { uint32_t(15), "flags", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_gnss::GalileoIonoCorr; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "time_of_week", + /* .docs = */ "GPS Time of week [seconds]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "week_number", + /* .docs = */ "GPS Week since 1980 [weeks]", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "alpha", + /* .docs = */ "Coefficients for the model.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "disturbance_flags", + /* .docs = */ "Region disturbance flags (bits 1-5).", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_gnss::GalileoIonoCorr", + /* .title = */ "Galileo Ionospheric Correction", + /* .docs = */ "Ionospheric Correction Terms for Galileo", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + + +static constexpr inline std::initializer_list DATA_GNSS = { + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, +}; + + +} // namespace mip::metadata + diff --git a/src/cpp/mip/metadata/definitions/data_sensor.hpp b/src/cpp/mip/metadata/definitions/data_sensor.hpp new file mode 100644 index 000000000..344f0ebd7 --- /dev/null +++ b/src/cpp/mip/metadata/definitions/data_sensor.hpp @@ -0,0 +1,839 @@ +#pragma once + +#include + +#include + +#include + +namespace mip::metadata +{ + + +template<> +struct MetadataFor +{ + using type = data_sensor::RawAccel; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "raw_accel", + /* .docs = */ "Native sensor counts", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_sensor::RawAccel", + /* .title = */ "raw_accel", + /* .docs = */ "Three element vector representing the sensed acceleration.\nThis quantity is temperature compensated and expressed in the sensor body frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_sensor::RawGyro; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "raw_gyro", + /* .docs = */ "Native sensor counts", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_sensor::RawGyro", + /* .title = */ "raw_gyro", + /* .docs = */ "Three element vector representing the sensed angular rate.\nThis quantity is temperature compensated and expressed in the sensor body frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_sensor::RawMag; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "raw_mag", + /* .docs = */ "Native sensor counts", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_sensor::RawMag", + /* .title = */ "raw_mag", + /* .docs = */ "Three element vector representing the sensed magnetic field.\nThis quantity is temperature compensated and expressed in the vehicle frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_sensor::RawPressure; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "raw_pressure", + /* .docs = */ "Native sensor counts", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_sensor::RawPressure", + /* .title = */ "raw_pressure", + /* .docs = */ "Scalar value representing the sensed ambient pressure.\nThis quantity is temperature compensated.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_sensor::ScaledAccel; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "scaled_accel", + /* .docs = */ "(x, y, z)[g]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_sensor::ScaledAccel", + /* .title = */ "scaled_accel", + /* .docs = */ "3-element vector representing the sensed acceleration.\nThis quantity is temperature compensated and expressed in the vehicle frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_sensor::ScaledGyro; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "scaled_gyro", + /* .docs = */ "(x, y, z) [radians/second]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_sensor::ScaledGyro", + /* .title = */ "scaled_gyro", + /* .docs = */ "3-element vector representing the sensed angular rate.\nThis quantity is temperature compensated and expressed in the vehicle frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_sensor::ScaledMag; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "scaled_mag", + /* .docs = */ "(x, y, z) [Gauss]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_sensor::ScaledMag", + /* .title = */ "scaled_mag", + /* .docs = */ "3-element vector representing the sensed magnetic field.\nThis quantity is temperature compensated and expressed in the vehicle frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_sensor::ScaledPressure; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "scaled_pressure", + /* .docs = */ "[mBar]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_sensor::ScaledPressure", + /* .title = */ "scaled_pressure", + /* .docs = */ "Scalar value representing the sensed ambient pressure.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_sensor::DeltaTheta; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "delta_theta", + /* .docs = */ "(x, y, z) [radians]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_sensor::DeltaTheta", + /* .title = */ "delta_theta", + /* .docs = */ "3-element vector representing the time integral of angular rate.\nThis quantity is the integral of sensed angular rate over the period set by the IMU message format. It is expressed in the vehicle frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_sensor::DeltaVelocity; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "delta_velocity", + /* .docs = */ "(x, y, z) [g*sec]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_sensor::DeltaVelocity", + /* .title = */ "delta_velocity", + /* .docs = */ "3-element vector representing the time integral of acceleration.\nThis quantity is the integral of sensed acceleration over the period set by the IMU message format. It is expressed in the vehicle frame.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_sensor::CompOrientationMatrix; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "m", + /* .docs = */ "Matrix elements in row-major order.", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_sensor::CompOrientationMatrix", + /* .title = */ "Complementary Filter Orientation Matrix", + /* .docs = */ "3x3 Direction Cosine Matrix EQSTART M_{ned}^{veh} EQEND describing the orientation of the device with respect to the NED local-level frame.\nThis matrix satisfies the following relationship:\n\nEQSTART v^{veh} = M_{ned}^{veh} v^{ned} EQEND
\n\nWhere:
\n\nEQSTART v^{ned} EQEND is a 3-element vector expressed in the NED frame.
\nEQSTART v^{veh} EQEND is the same 3-element vector expressed in the vehicle frame.
\n
\nThe matrix elements are stored is row-major order: EQSTART M = \\begin{bmatrix} M_{11}, M_{12}, M_{13}, M_{21}, M_{22}, M_{23}, M_{31}, M_{32}, M_{33} \\end{bmatrix} EQEND", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_sensor::CompQuaternion; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "q", + /* .docs = */ "Quaternion elements EQSTART q = (q_w, q_x, q_y, q_z) EQEND", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_sensor::CompQuaternion", + /* .title = */ "Complementary Filter Quaternion", + /* .docs = */ "4x1 vector representation of the quaternion describing the orientation of the device with respect to the NED local-level frame.\nThis quaternion satisfies the following relationship:\n\nEQSTART p^{veh} = q^{-1} p^{ned} q EQEND
\n\nWhere:
\nEQSTART q = (q_w, q_x, q_y, q_z) EQEND is the quaternion describing the rotation.
\nEQSTART p^ned = (0, v^{ned}_x, v^{ned}_y, v^{ned}_z) EQEND and EQSTART v^{ned} EQEND is a 3-element vector expressed in the NED frame.
\nEQSTART p^veh = (0, v^{veh}_x, v^{veh}_y, v^{veh}_z) EQEND and EQSTART v^{veh} EQEND is a 3-element vector expressed in the vehicle frame.
", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_sensor::CompEulerAngles; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "roll", + /* .docs = */ "[radians]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "pitch", + /* .docs = */ "[radians]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "yaw", + /* .docs = */ "[radians]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_sensor::CompEulerAngles", + /* .title = */ "Complementary Filter Euler Angles", + /* .docs = */ "Euler angles describing the orientation of the device with respect to the NED local-level frame.\nThe Euler angles are reported in 3-2-1 (Yaw-Pitch-Roll, AKA Aircraft) order.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_sensor::CompOrientationUpdateMatrix; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "m", + /* .docs = */ "", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_sensor::CompOrientationUpdateMatrix", + /* .title = */ "Complementary Filter Orientation Update Matrix", + /* .docs = */ "DEPRECATED!", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_sensor::OrientationRawTemp; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "raw_temp", + /* .docs = */ "", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 4, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_sensor::OrientationRawTemp", + /* .title = */ "orientation_raw_temp", + /* .docs = */ "DEPRECATED!", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_sensor::InternalTimestamp; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "counts", + /* .docs = */ "", + /* .type = */ {Type::U32, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_sensor::InternalTimestamp", + /* .title = */ "internal_timestamp", + /* .docs = */ "DEPRECATED!", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_sensor::PpsTimestamp; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "seconds", + /* .docs = */ "", + /* .type = */ {Type::U32, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "useconds", + /* .docs = */ "", + /* .type = */ {Type::U32, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_sensor::PpsTimestamp", + /* .title = */ "PPS Timestamp", + /* .docs = */ "DEPRECATED!", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_sensor::GpsTimestamp::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "pps_valid", "True when the PPS signal is present." }, + { uint32_t(2), "time_refresh", "Toggles each time the time is updated via internal GPS or the GPS Time Update command (0x01, 0x72)." }, + { uint32_t(4), "time_initialized", "True if the time has ever been set." }, + { uint32_t(8), "tow_valid", "True if the time of week is valid." }, + { uint32_t(16), "week_number_valid", "True if the week number is valid." }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_sensor::GpsTimestamp; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "tow", + /* .docs = */ "GPS Time of Week [seconds]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "week_number", + /* .docs = */ "GPS Week Number since 1980 [weeks]", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_sensor::GpsTimestamp", + /* .title = */ "gps_timestamp", + /* .docs = */ "GPS timestamp of the SENSOR data\n\nShould the PPS become unavailable, the device will revert to its internal clock, which will cause the reported time to drift from true GPS time.\nUpon recovering from a PPS outage, the user should expect a jump in the reported GPS time due to the accumulation of internal clock error.\nIf synchronization to an external clock or onboard GNSS receiver (for products that have one) is disabled, this time is equivalent to internal system time.\n\nNote: this data field may be deprecated in the future. The more flexible shared data field (0x80, 0xD3) should be used instead.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_sensor::TemperatureAbs; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "min_temp", + /* .docs = */ "[degC]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "max_temp", + /* .docs = */ "[degC]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "mean_temp", + /* .docs = */ "[degC]", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_sensor::TemperatureAbs", + /* .title = */ "Temperature Statistics", + /* .docs = */ "SENSOR reported temperature statistics\n\nTemperature may originate from the MEMS sensors, or be calculated in combination with board temperature sensors.\nAll quantities are calculated with respect to the last power on or reset, whichever is later.\n", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_sensor::UpVector; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "up", + /* .docs = */ "[Gs]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_sensor::UpVector", + /* .title = */ "up_vector", + /* .docs = */ "Gyro-stabilized 3-element vector representing the complementary filter's estimated vertical direction.\nThis quantity is expressed in the vehicle frame.\n\nThis quantity is sensitive to non-gravitational accelerations, which may cause notable deviations from the true vertical direction.\n\nFor legacy reasons, this vector is the inverse of the gravity vector.\n", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_sensor::NorthVector; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "north", + /* .docs = */ "[Gauss]", + /* .type = */ {Type::STRUCT, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_sensor::NorthVector", + /* .title = */ "north_vector", + /* .docs = */ "Gyro-stabilized 3-element vector representing the complementary filter's estimate of magnetic north.\nThis quantity is expressed in the vehicle frame.\n\nThis quantity is sensitive to local magnetic field perturbations, which may cause notable deviations from true magnetic north.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_sensor::OverrangeStatus::Status; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "accel_x", "" }, + { uint32_t(2), "accel_y", "" }, + { uint32_t(4), "accel_z", "" }, + { uint32_t(16), "gyro_x", "" }, + { uint32_t(32), "gyro_y", "" }, + { uint32_t(64), "gyro_z", "" }, + { uint32_t(256), "mag_x", "" }, + { uint32_t(512), "mag_y", "" }, + { uint32_t(1024), "mag_z", "" }, + { uint32_t(4096), "press", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "Status", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_sensor::OverrangeStatus; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "status", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_sensor::OverrangeStatus", + /* .title = */ "overrange_status", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_sensor::OdometerData; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "speed", + /* .docs = */ "Average speed over the time interval [m/s]. Can be negative for quadrature encoders.", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "uncertainty", + /* .docs = */ "Uncertainty of velocity [m/s].", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "If odometer is configured, bit 0 will be set to 1.", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_sensor::OdometerData", + /* .title = */ "odometer_data", + /* .docs = */ "", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + + +static constexpr inline std::initializer_list DATA_SENSOR = { + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, +}; + + +} // namespace mip::metadata + diff --git a/src/cpp/mip/metadata/definitions/data_shared.hpp b/src/cpp/mip/metadata/definitions/data_shared.hpp new file mode 100644 index 000000000..4122ba7d0 --- /dev/null +++ b/src/cpp/mip/metadata/definitions/data_shared.hpp @@ -0,0 +1,381 @@ +#pragma once + +#include + +#include + +#include + +namespace mip::metadata +{ + + +template<> +struct MetadataFor +{ + using type = data_shared::EventSource; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "trigger_id", + /* .docs = */ "Trigger ID number. If 0, this message was emitted due to being\nscheduled in the 3DM Message Format Command (0x0C,0x0F).", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_shared::EventSource", + /* .title = */ "event_source", + /* .docs = */ "Identifies which event trigger caused this packet to be emitted.\n\nGenerally this is used to determine whether a packet was emitted\ndue to scheduled streaming or due to an event.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_shared::Ticks; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "ticks", + /* .docs = */ "Ticks since powerup.", + /* .type = */ {Type::U32, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_shared::Ticks", + /* .title = */ "ticks", + /* .docs = */ "Time since powerup in multiples of the base rate.\n\nThe counter will wrap around to 0 after approximately 50 days.\nOne tick is equivalent to one base period (reciprocal of the base rate).", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_shared::DeltaTicks; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "ticks", + /* .docs = */ "Ticks since last output.", + /* .type = */ {Type::U32, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_shared::DeltaTicks", + /* .title = */ "delta_ticks", + /* .docs = */ "Ticks since the last output of this field.\n\nThis field can be used to track the amount of time passed between\nevent occurrences.\nOne tick is equivalent to one base period (reciprocal of the base rate).", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_shared::GpsTimestamp::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "tow", "Whole number seconds TOW has been set" }, + { uint32_t(2), "week_number", "Week number has been set" }, + { uint32_t(3), "time_valid", "Both TOW and Week Number have been set" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_shared::GpsTimestamp; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "tow", + /* .docs = */ "GPS Time of Week [seconds]", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "week_number", + /* .docs = */ "GPS Week Number since 1980 [weeks]", + /* .type = */ {Type::U16, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_shared::GpsTimestamp", + /* .title = */ "gps_timestamp", + /* .docs = */ "Outputs the current GPS system time in time-of-week and week number format.\n\nFor events, this is the time of the event trigger.\nIn order to be valid, a PPS signal needs to be present, and both a valid GPS time-of-week and week number command (0x0C, 0x72) need to be received after PPS sync has been achieved.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_shared::DeltaTime; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "seconds", + /* .docs = */ "Seconds since last output.", + /* .type = */ {Type::DOUBLE, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_shared::DeltaTime", + /* .title = */ "delta_time", + /* .docs = */ "Time in the synchronized clock domain since the last output of this field within the same descriptor set and event instance.\n\nThis can be used to track the amount of time passed between\nevent occurrences. See the manual page on delta time quantities.\n\nThis field contains the same value as the delta external time field, 0xD8,\nbut is expressed in seconds. Transmission of either of these fields\nrestarts a shared counter, so only one should be streamed at a time to\navoid confusion. The counter is not shared across descriptors sets or\nbetween event instances.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_shared::ReferenceTimestamp; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "nanoseconds", + /* .docs = */ "Nanoseconds since initialization.", + /* .type = */ {Type::U64, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_shared::ReferenceTimestamp", + /* .title = */ "reference_timestamp", + /* .docs = */ "Internal reference timestamp.\n\nThis timestamp represents the time at which the corresponding\ndata was sampled, according to the internal reference clock.\n\nThis is a monotonic clock which never jumps. The value is always valid.\n\nFor events, this is the time of the event trigger.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_shared::ReferenceTimeDelta; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "dt_nanos", + /* .docs = */ "Nanoseconds since the last occurrence of this field in a packet of the same descriptor set and event source.", + /* .type = */ {Type::U64, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_shared::ReferenceTimeDelta", + /* .title = */ "reference_time_delta", + /* .docs = */ "Delta time since the last packet.\n\nDifference between the time as reported by the shared reference time field, 0xD5,\nand the previous output of this delta quantity within the same descriptor set and event instance.\n\nThe delta is based on the reference time which never jumps. The value\nis always valid.\n\nThis can be used to track the amount of time passed between\nevent occurrences. See the manual page on delta time quantities.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_shared::ExternalTimestamp::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "nanoseconds", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_shared::ExternalTimestamp; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "nanoseconds", + /* .docs = */ "", + /* .type = */ {Type::U64, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_shared::ExternalTimestamp", + /* .title = */ "external_timestamp", + /* .docs = */ "External timestamp in nanoseconds.\n\nThis timestamp represents the time at which the corresponding\ndata was sampled in the external clock domain.\nEquivalent to the GPS Timestamp but in nanoseconds.\n\nFor events, this is the time of the event trigger.\n\nTo be valid, external clock sync must be achieved using the PPS input.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_shared::ExternalTimeDelta::ValidFlags; + + static constexpr inline BitfieldInfo::Entry entries[] = { + { uint32_t(1), "dt_nanos", "" }, + }; + + static constexpr inline BitfieldInfo value = { + /* .name = */ "ValidFlags", + /* .docs = */ "", + /* .type = */ Type::U16, + /* .entries = */ entries, + }; + +}; + +template<> +struct MetadataFor +{ + using type = data_shared::ExternalTimeDelta; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "dt_nanos", + /* .docs = */ "Nanoseconds since the last occurrence of this field in a packet of the same descriptor set and event source.", + /* .type = */ {Type::U64, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "valid_flags", + /* .docs = */ "", + /* .type = */ {Type::BITS, &MetadataFor::value}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_shared::ExternalTimeDelta", + /* .title = */ "external_time_delta", + /* .docs = */ "Delta time since the last packet containing delta external (0xFF,0xD4) or delta gps time (0xFF,0xD8).\n\nDifference between the time as reported by the shared external time field, 0xD7,\nand the previous output of this delta quantity within the same descriptor set and event instance.\n\nThis can be used to track the amount of time passed between\nevent occurrences. See the manual page on delta time quantities.\n\nThis field contains the same value as the delta gps time field, 0xD4,\nbut is expressed in nanoseconds. Transmission of either of these fields\nrestarts a shared counter, so only one should be streamed at a time to\navoid confusion. The counter is not shared across descriptors sets or\nbetween event instances.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + + +static constexpr inline std::initializer_list DATA_SHARED = { + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, +}; + + +} // namespace mip::metadata + diff --git a/src/cpp/mip/metadata/definitions/data_system.hpp b/src/cpp/mip/metadata/definitions/data_system.hpp new file mode 100644 index 000000000..70b21cfc4 --- /dev/null +++ b/src/cpp/mip/metadata/definitions/data_system.hpp @@ -0,0 +1,157 @@ +#pragma once + +#include + +#include + +#include + +namespace mip::metadata +{ + + +template<> +struct MetadataFor +{ + using type = data_system::BuiltInTest; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "result", + /* .docs = */ "Device-specific bitfield (128 bits). See device user manual.\nBits are least-significant-byte first. For example, bit 0 is\nlocated at bit 0 of result[0], bit 1 is located at bit 1 of result[0],\nbit 8 is located at bit 0 of result[1], and bit 127 is located at bit\n7 of result[15].", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 16, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_system::BuiltInTest", + /* .title = */ "built_in_test", + /* .docs = */ "Contains the continuous built-in-test (BIT) results.\n\nDue to the large size of this field, it is recommended to stream it at\na low rate or poll it on demand.\n\nThese bits are 'sticky' until the next output message. If a fault occurs\nin between scheduled messages or while the device is idle, the next\npacket with this field will have the corresponding flags set. The flag\nis then cleared unless the fault persists.\n\nUnlike the commanded BIT, some bits may be 1 in certain\nnon-fault situations, so simply checking if the result is all 0s is\nnot very useful. For example, on devices with a built-in GNSS receiver,\na 'solution fault' bit may be set before the receiver has obtained\na position fix. Consult the device manual to determine which bits are\nof interest for your application.\n\nAll unspecified bits are reserved for future use and must be ignored.\n", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_system::TimeSyncStatus; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "time_sync", + /* .docs = */ "True if sync with the PPS signal is currently valid. False if PPS\nfeature is disabled or a PPS signal is not detected.", + /* .type = */ {Type::BOOL, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "last_pps_rcvd", + /* .docs = */ "Elapsed time in seconds since last PPS was received, with a maximum\nvalue of 255.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_system::TimeSyncStatus", + /* .title = */ "time_sync_status", + /* .docs = */ "Indicates whether a sync has been achieved using the PPS signal.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_system::GpioState; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "states", + /* .docs = */ "Bitfield containing the states for each GPIO pin.
\nBit 0 (0x01): pin 1
\nBit 1 (0x02): pin 2
\nBit 2 (0x04): pin 3
\nBit 3 (0x08): pin 4
\nBits for pins that don't exist will read as 0.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_system::GpioState", + /* .title = */ "gpio_state", + /* .docs = */ "Indicates the state of all of the user GPIO pins.\n\nThis message can be used to correlate external signals\nwith the device time or other data quantities. It should\ngenerally be used with slow GPIO signals as brief pulses\nshorter than the scheduled data rate will be missed.\n\nTo synchronize with faster signals and pulses, or for more accurate timestamping,\nutilize the event system and set the GPIO feature to TIMESTAMP in the 3DM GPIO\nConfiguration command (0x0C,0x41).\n\nThese GPIO states are sampled within one base period\nof the system data descriptor set.\n\nTo obtain valid readings, the desired pin(s) must be configured to the GPIO feature\n(either input or output behavior) using the 3DM GPIO Configuration command\n(0x0C,0x41). Other gpio features may work on some devices but this is not guaranteed.\nConsult the factory before producing a design relying on reading pins configured\nto other feature types.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + +template<> +struct MetadataFor +{ + using type = data_system::GpioAnalogValue; + + static constexpr inline ParameterInfo parameters[] = { + { + /* .name = */ "gpio_id", + /* .docs = */ "GPIO pin number starting with 1.", + /* .type = */ {Type::U8, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + { + /* .name = */ "value", + /* .docs = */ "Value of the GPIO line in scaled volts.", + /* .type = */ {Type::FLOAT, nullptr}, + /* .accessor = */ nullptr, //utils::access, + /* .attributes = */ {true, false, false, false, false}, + /* .count = */ 1, + /* .condition = */ {}, + }, + }; + + static constexpr inline FieldInfo value = { + /* .name = */ "data_system::GpioAnalogValue", + /* .title = */ "gpio_analog_value", + /* .docs = */ "Indicates the analog value of the given user GPIO.\nThe pin must be configured for analog input.", + /* .parameters = */ parameters, + /* .descriptor = */ type::DESCRIPTOR, + /* .functions = */ NO_FUNCTIONS, + /* .proprietary = */ false, + /* .response = */ nullptr, + }; +}; + + +static constexpr inline std::initializer_list DATA_SYSTEM = { + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, + &MetadataFor::value, +}; + + +} // namespace mip::metadata + diff --git a/src/cpp/mip/metadata/mip_all_definitions.hpp b/src/cpp/mip/metadata/mip_all_definitions.hpp new file mode 100644 index 000000000..1c6ff9dc9 --- /dev/null +++ b/src/cpp/mip/metadata/mip_all_definitions.hpp @@ -0,0 +1,53 @@ + +#include "definitions/commands_3dm.hpp" +#include "definitions/commands_aiding.hpp" +#include "definitions/commands_base.hpp" +#include "definitions/commands_filter.hpp" +#include "definitions/commands_gnss.hpp" +#include "definitions/commands_rtk.hpp" +#include "definitions/commands_system.hpp" + +#include "definitions/data_filter.hpp" +#include "definitions/data_gnss.hpp" +#include "definitions/data_sensor.hpp" +#include "definitions/data_shared.hpp" +#include "definitions/data_system.hpp" + +namespace mip::metadata +{ + +static constexpr inline std::initializer_list< const std::initializer_list* > ALL_COMMANDS = { + &COMMANDS_3DM, + &COMMANDS_AIDING, + &COMMANDS_BASE, + &COMMANDS_FILTER, + &COMMANDS_GNSS, + &COMMANDS_RTK, + &COMMANDS_SYSTEM, +}; +static constexpr inline std::initializer_list< const std::initializer_list* > ALL_DATA = { + &DATA_FILTER, + &DATA_GNSS, + &DATA_SENSOR, + &DATA_SHARED, + &DATA_SYSTEM, +}; + +static constexpr inline std::initializer_list< const std::initializer_list< const FieldInfo* >* > ALL_FIELDS = { + // Commands + &COMMANDS_3DM, + &COMMANDS_AIDING, + &COMMANDS_BASE, + &COMMANDS_FILTER, + &COMMANDS_GNSS, + &COMMANDS_RTK, + &COMMANDS_SYSTEM, + // Data + &DATA_FILTER, + &DATA_GNSS, + &DATA_SENSOR, + &DATA_SHARED, + &DATA_SYSTEM, +}; + +} // namespace mip::metadata diff --git a/src/cpp/mip/metadata/mip_definitions.cpp b/src/cpp/mip/metadata/mip_definitions.cpp new file mode 100644 index 000000000..e48ef104e --- /dev/null +++ b/src/cpp/mip/metadata/mip_definitions.cpp @@ -0,0 +1,61 @@ + +#include "mip_definitions.hpp" + +#include +#include + +namespace mip::metadata +{ + +void Definitions::registerField(const mip::metadata::FieldInfo* field) +{ + mFields.insert(field); +} + +void Definitions::registerDefinitions(std::initializer_list fields) +{ + mFields.insert(fields); +} + +void Definitions::registerDefinitions( + const std::initializer_list< const std::initializer_list* >& fields) +{ + for(const auto* sublist : fields) + registerDefinitions(*sublist); +} + +//std::vector::const_iterator Definitions::findFieldIter(mip::CompositeDescriptor descriptor) const +//{ +// return std::lower_bound( +// mFields.begin(), mFields.end(), descriptor, +// [](const FieldInfo* info, CompositeDescriptor desc)->bool +// { +// return info->descriptor < desc; +// } +// ); +//} + +const FieldInfo* Definitions::findField(mip::CompositeDescriptor descriptor) const +{ + //auto it = findFieldIter(descriptor); + auto it = mFields.find(descriptor); + + if(it != mFields.end()) + return *it; + + // Check for shared data fields. + if(isDataDescriptorSet(descriptor.descriptorSet) && isSharedDataFieldDescriptor(descriptor.fieldDescriptor)) + { + it = mFields.find(CompositeDescriptor{data_shared::DESCRIPTOR_SET, descriptor.fieldDescriptor}); + + if(it != mFields.end()) + return *it; + } + // Reply descriptor? + else if(isCommandDescriptorSet(descriptor.descriptorSet) && isReplyFieldDescriptor(descriptor.fieldDescriptor)) + return &MetadataFor::value; + + return nullptr; +} + +} // namespace mip::metadata diff --git a/src/cpp/mip/metadata/mip_definitions.hpp b/src/cpp/mip/metadata/mip_definitions.hpp new file mode 100644 index 000000000..785236d57 --- /dev/null +++ b/src/cpp/mip/metadata/mip_definitions.hpp @@ -0,0 +1,53 @@ +#pragma once + +#include "mip_metadata.hpp" + +#include + +#include +#include + + +namespace mip::metadata +{ + +class Definitions +{ + struct Less + { + inline bool operator()(const FieldInfo *a, const FieldInfo *b) const + { + return a->descriptor < b->descriptor; + } + inline bool operator()(const FieldInfo *a, CompositeDescriptor desc) const + { + return a->descriptor < desc; + } + inline bool operator()(CompositeDescriptor desc, const FieldInfo *a) const + { + return desc < a->descriptor; + } + using is_transparent = void; + }; + + using Container = std::set; + +public: + Definitions() = default; + Definitions(const std::initializer_list*>& fields) { registerDefinitions(fields); } + + void registerField(const FieldInfo* field); + void registerDefinitions(std::initializer_list fields); + void registerDefinitions(const std::initializer_list*>& fields); + + const FieldInfo* findField(mip::CompositeDescriptor descriptor) const; + + +private: + Container mFields; +}; + + + + +} // namespace mip::metadata diff --git a/src/cpp/mip/metadata/mip_meta_utils.hpp b/src/cpp/mip/metadata/mip_meta_utils.hpp new file mode 100644 index 000000000..9d48d053c --- /dev/null +++ b/src/cpp/mip/metadata/mip_meta_utils.hpp @@ -0,0 +1,72 @@ +#pragma once + +#include "mip_structures.hpp" + + +namespace mip::metadata::utils +{ + +// +// Gets the "Type" enum value given a C++ template type. +// +template struct ParamType { static inline constexpr auto value = Type::NONE; }; + +template<> struct ParamType { static constexpr inline auto value = Type::CHAR; }; +template<> struct ParamType { static constexpr inline auto value = Type::BOOL; }; +template<> struct ParamType { static constexpr inline auto value = Type::U8; }; +template<> struct ParamType< int8_t, void> { static constexpr inline auto value = Type::S8; }; +template<> struct ParamType { static constexpr inline auto value = Type::U16; }; +template<> struct ParamType< int16_t, void> { static constexpr inline auto value = Type::S16; }; +template<> struct ParamType { static constexpr inline auto value = Type::U32; }; +template<> struct ParamType< int32_t, void> { static constexpr inline auto value = Type::S32; }; +template<> struct ParamType { static constexpr inline auto value = Type::U64; }; +template<> struct ParamType< int64_t, void> { static constexpr inline auto value = Type::S64; }; +template<> struct ParamType { static constexpr inline auto value = Type::FLOAT; }; +template<> struct ParamType { static constexpr inline auto value = Type::DOUBLE; }; +template struct ParamType, void> { static constexpr inline auto value = Type::BITS; }; +template struct ParamType::value, T>::type> { static constexpr inline auto value = Type::ENUM; }; +template struct ParamType::type> { static constexpr inline auto value = Type::STRUCT; }; +template struct ParamType::value, T>::type> { static constexpr inline auto value = Type::UNION; }; + + +// +// Gets the template type given a compile-time "Type" enum value. +// Note: this only works with basic/built-in/arithmetic types, not structs/enums/etc. +// +template +struct ParamEnum { using type = void; }; + +template<> struct ParamEnum { using type = char; }; +template<> struct ParamEnum { using type = bool; }; +template<> struct ParamEnum { using type = uint8_t; }; +template<> struct ParamEnum { using type = int8_t; }; +template<> struct ParamEnum { using type = uint16_t; }; +template<> struct ParamEnum { using type = int16_t; }; +template<> struct ParamEnum { using type = uint32_t; }; +template<> struct ParamEnum { using type = int32_t; }; +template<> struct ParamEnum { using type = uint64_t; }; +template<> struct ParamEnum { using type = int64_t; }; +template<> struct ParamEnum { using type = float; }; +template<> struct ParamEnum { using type = double; }; + + +// Gets a void pointer to the member identified by Ptr, given an +// instance of field passed by void pointer. +/*template +void* access(void* p) +{ + return &(static_cast(p)->*Ptr); +} + +template +void* access(void* p) +{ + Field* f = static_cast(p); + auto& param = f->*Ptr; + return ¶m; +}*/ + +template +void* access(void* p); + +} // namespace mip::metadata diff --git a/src/cpp/mip/metadata/mip_metadata.hpp b/src/cpp/mip/metadata/mip_metadata.hpp new file mode 100644 index 000000000..b48ee9b28 --- /dev/null +++ b/src/cpp/mip/metadata/mip_metadata.hpp @@ -0,0 +1,174 @@ +#pragma once + +#include "mip_structures.hpp" +#include "mip_meta_utils.hpp" + +#include +#include + + +namespace mip::metadata +{ + +// Type trait class to be specialized for each field/struct/etc. +template +struct MetadataFor; + + +template<> +struct MetadataFor +{ + using type = FunctionSelector; + + static constexpr EnumInfo::Entry entries[] = { + { (uint8_t)FunctionSelector::WRITE, "WRITE", "Applies a new setting." }, + { (uint8_t)FunctionSelector::READ, "READ", "Reads the current setting." }, + { (uint8_t)FunctionSelector::SAVE, "SAVE", "Saves the current setting as power-on setting." }, + { (uint8_t)FunctionSelector::LOAD, "LOAD", "Loads the power-on setting." }, + { (uint8_t)FunctionSelector::RESET, "DEFAULT", "Resets to the factory default setting." }, + }; + + static constexpr inline EnumInfo value = { + /*.name =*/ "FunctionSelector", + /*.docs =*/ "", + /*.type =*/ Type::U8, + /*.entries =*/ entries, + }; +}; + +inline void* accessFunctionSelector(void* p) { return static_cast(p); } + +static constexpr inline ParameterInfo FUNCTION_SELECTOR_PARAM = { + /* .name = */ "function", + /* .docs = */ "Standard MIP function selector", + /* .type = */ {Type::ENUM, &MetadataFor::value}, + /* .accessor = */ accessFunctionSelector, + /* .functions = */ {true,true,true,true,true}, + /* .count = */ 1, + /* .condition = */ {}, +}; + + + +// template struct ParamEnum; +// template<> struct ParamEnum : + + +///@brief Gets a reference to parameter 'I' in the struct for the given field. +/// +///@tparam I Index indicating which parameter to access. 0-based. +///@tparam FieldType Type of the MIP field struct. +/// +///@param field An instance of the field struct whose member variable will be accessed. +/// +///@returns A reference to member I of the given field. +/// +template +auto& get(typename EnableForFieldTypes::type& field) +{ + constexpr ParameterInfo& paramInfo = MetadataFor::PARAMETERS[I].type; + using T = typename utils::ParamEnum::type; + return *static_cast(paramInfo.accessor(&field)); +} + + +//template +//ParamType get(FieldType& field) +//{ +//} +// +//template +//auto get(FieldType& field) +//{ +// const ParameterInfo& paramInfo = MetadataFor::PARAMETERS[ParameterIndex]; +// +// +//} + + +//class Analyzer +//{ +//public: +// Analyzer(microstrain::Serializer serializer) : m_serializer(serializer) {} +// +// bool analyze(const StructInfo& info) +// { +// size_t nextOffsetEntry = 0; +// +// for(const ParameterInfo& param : info.parameters) +// { +// if(param.count.paramIdx.isValid(info.parameters.size())) +// { +// +// } +// } +// } +//private: +// size_t getOffsetForParameter(const ParameterInfo* parameters, size_t index) const +// { +// for(size_t i=0; i m_offsets; +//}; +// +// +// +//constexpr size_t getParameterOffset(microstrain::Serializer serializer, microstrain::Index parameterId) +//{ +// const auto& parameters = MetadataFor::parameters; +// if(parameterId.isValid(parameters.size())) +// return -1; +// +// size_t offset = 0; +// +// for(auto i=microstrain::Index(0); i +#include +#include + +#include + + +namespace mip::metadata +{ + template + using Span = microstrain::Span; + +//struct EnumInfo; +//struct BitfieldInfo; +//struct UnionInfo; +//struct StructInfo; +//struct FieldInfo; +//struct ParameterInfo; + + +enum class Type +{ + NONE = 0, ///< Invalid/unknown. + + CHAR, + BOOL, + U8, + S8, + U16, + S16, + U32, + S32, + U64, + S64, + FLOAT, + DOUBLE, + + ENUM, + BITS, + STRUCT, + UNION, +}; + +struct TypeInfo +{ + //template + //TypeInfo(T Field::*member); + + Type type = Type::NONE; + + const void* infoPtr = nullptr; + //union + //{ + // const StructInfo *si; + // const EnumInfo *ei; + // const BitfieldInfo *bi; + // const UnionInfo *ui; + //}; + + bool isBasicType() const { return type <= Type::DOUBLE; } +}; + +struct EnumInfo +{ + struct Entry + { + uint32_t value = 0; + const char* name = nullptr; + const char* docs = nullptr; + }; + + const char* name = nullptr; + const char* docs = nullptr; + Type type = Type::NONE; + + Span entries; +}; + +struct BitfieldInfo : public EnumInfo {}; + + +//struct ParameterInfo; // Defined below + +struct Attributes +{ + constexpr Attributes() = default; + constexpr Attributes(bool w, bool r, bool s, bool l, bool d, bool e=false, bool x=false) : bits(0x00) + { + setCanWrite(w); + setCanRead(r); + setCanSave(s); + setCanLoad(l); + setCanReset(d); + setNotSerialized(x); + setIsEchoed(e); + } + + constexpr bool any() const { return bits > 0; } + + constexpr bool canWrite() const { return bits & 0b00000001; } + constexpr bool canRead() const { return bits & 0b00000010; } + constexpr bool canSave() const { return bits & 0b00000100; } + constexpr bool canLoad() const { return bits & 0b00001000; } + constexpr bool canReset() const { return bits & 0b00010000; } + constexpr bool isNotSerialized() const { return bits & 0b01000000; } + constexpr bool isEchoed() const { return bits & 0b10000000; } + constexpr bool isSerialized() const { return !isNotSerialized(); } + + constexpr Attributes& setCanWrite (bool w) { bits = (bits & 0b11111110) | (uint8_t(w)<<0); return *this; } + constexpr Attributes& setCanRead (bool r) { bits = (bits & 0b11111101) | (uint8_t(r)<<1); return *this; } + constexpr Attributes& setCanSave (bool s) { bits = (bits & 0b11111011) | (uint8_t(s)<<2); return *this; } + constexpr Attributes& setCanLoad (bool l) { bits = (bits & 0b11110111) | (uint8_t(l)<<3); return *this; } + constexpr Attributes& setCanReset (bool d) { bits = (bits & 0b11101111) | (uint8_t(d)<<4); return *this; } + constexpr Attributes& setNotSerialized (bool x) { bits = (bits & 0b10111111) | (uint8_t(x)<<6); return *this; } + constexpr Attributes& setIsEchoed (bool e) { bits = (bits & 0b01111111) | (uint8_t(e)<<7); return *this; } + + constexpr bool has(mip::FunctionSelector function) const { return (bits >> (static_cast(function) - static_cast(mip::FunctionSelector::WRITE))) & 1; } + + uint8_t bits = 0x00; +}; +static constexpr inline Attributes ALL_FUNCTIONS = {true, true, true, true, true}; +static constexpr inline Attributes NO_FUNCTIONS = {false, false, false, false, false}; + + +struct ParameterInfo +{ + struct Count + { + constexpr Count() = default; + constexpr Count(uint8_t n) : count(n) {} + constexpr Count(uint8_t n, microstrain::Id id) : count(n), paramIdx(id) {} + + uint8_t count = 1; ///< Fixed size if paramIdx unassigned. + microstrain::Id paramIdx = {}; ///< If assigned, specifies parameter that holds the actual runtime count. + + constexpr bool isFixed() const { return count > 0 && !paramIdx.isAssigned(); } + constexpr bool hasCounter() const { return paramIdx.isAssigned(); } + }; + + struct Condition + { + enum class Type : uint8_t + { + NONE = 0, ///< No condition, member always valid + ENUM = 1, ///< Enum value selector (e.g. for parameters in unions) + //PRODUCT = 2, ///< Depends on product variant (TBD) + //OPTIONAL = 2, ///< Parameter can be omitted (TBD) + }; + + Type type = Type::NONE; ///< Type of condition. + microstrain::Id paramIdx = {}; ///< Index of enum parameter identifying whether this parameter is enabled. + uint16_t value = 0; ///< Value of the enum parameter which activates this parameter. + + constexpr bool hasCondition() const { return type != Type::NONE; } + }; + + using Accessor = void* (*)(void*); + + const char* name = nullptr; ///< Programmatic name (e.g. for printing or language bindings). + const char* docs = nullptr; ///< Human-readable documentation. + TypeInfo type; ///< Data type. + Accessor accessor = nullptr; ///< Obtains a reference to the member variable. + Attributes attributes; ///< This parameter is required for the specified function selectors. + Count count; ///< Number of instances for arrays. + Condition condition; ///< For conditionally-enabled parameters like those in unions. +}; + + +struct StructInfo +{ + const char* name = nullptr; + const char* title = nullptr; + const char* docs = nullptr; + + Span parameters; +}; + +struct UnionInfo : public StructInfo {}; + +struct FieldInfo : public StructInfo +{ + CompositeDescriptor descriptor = {0x00, 0x00}; + Attributes functions = {false, false, false, false, false}; + bool proprietary = false; + const FieldInfo* response = nullptr; +}; + + +///@brief Gets the size of a basic type (including bitfields and enums if class_ is not NULL). +/// +constexpr size_t sizeForBasicType(Type type, const void* info=nullptr) +{ + switch(type) + { + case Type::CHAR: + case Type::BOOL: + case Type::U8: + case Type::S8: + return 1; + case Type::U16: + case Type::S16: + return 2; + case Type::U32: + case Type::S32: + case Type::FLOAT: + return 4; + case Type::U64: + case Type::S64: + case Type::DOUBLE: + return 8; + + case Type::ENUM: + if(!info) + return 0; + return sizeForBasicType(static_cast(info)->type); + + case Type::BITS: + if(!info) + return 0; + return sizeForBasicType(static_cast(info)->type); + + default: + return 0; + } +} +constexpr size_t sizeForBasicType(const TypeInfo& type) { return sizeForBasicType(type.type, type.infoPtr); } + + +} // namespace mip::metadata diff --git a/src/cpp/mip/mip.hpp b/src/cpp/mip/mip.hpp new file mode 100644 index 000000000..7eef6f48d --- /dev/null +++ b/src/cpp/mip/mip.hpp @@ -0,0 +1,26 @@ +#pragma once + +#include "mip_interface.hpp" + +//////////////////////////////////////////////////////////////////////////////// +///@addtogroup mip +///@{ +/// +//////////////////////////////////////////////////////////////////////////////// +///@defgroup mip_cpp C++ API +/// +///@brief This module contains functions and classes for communicating with a +/// MIP device in C++. +/// +///@see mip namespace +/// +///@} + +//////////////////////////////////////////////////////////////////////////////// +///@brief A collection of C++ classes and functions covering the full mip api. +/// +///@see mip_cpp +/// +namespace mip +{ +} // namespace mip diff --git a/src/mip/mip_all.hpp b/src/cpp/mip/mip_all.hpp similarity index 58% rename from src/mip/mip_all.hpp rename to src/cpp/mip/mip_all.hpp index da6d5476b..749d26265 100644 --- a/src/mip/mip_all.hpp +++ b/src/cpp/mip/mip_all.hpp @@ -1,34 +1,29 @@ #pragma once -//MIP Core -#include "mip_cmdqueue.h" -#include "mip_dispatch.h" -#include "mip_field.h" -#include "mip_interface.h" -#include "mip_offsets.h" -#include "mip_packet.h" -#include "mip_parser.h" -#include "definitions/descriptors.h" +// mip_version from C +#include -//MIP Utils -#include "utils/serialization.h" +// MIP Core +#include "mip_cmdqueue.hpp" +#include "mip_descriptors.hpp" +#include "mip_field.hpp" +#include "mip_interface.hpp" +#include "mip_packet.hpp" +#include "mip_parser.hpp" +#include "mip_result.hpp" -//MIP Commands -#include "definitions/commands_base.hpp" +// MIP Commands #include "definitions/commands_3dm.hpp" +#include "definitions/commands_aiding.hpp" +#include "definitions/commands_base.hpp" #include "definitions/commands_filter.hpp" #include "definitions/commands_gnss.hpp" #include "definitions/commands_rtk.hpp" #include "definitions/commands_system.hpp" -#include "definitions/commands_aiding.hpp" -//MIP Data +// MIP Data +#include "definitions/data_filter.hpp" +#include "definitions/data_gnss.hpp" +#include "definitions/data_sensor.hpp" #include "definitions/data_shared.hpp" #include "definitions/data_system.hpp" -#include "definitions/data_sensor.hpp" -#include "definitions/data_gnss.hpp" -#include "definitions/data_filter.hpp" - -//MIP Helpers -#include "mip.hpp" -#include "mip_device.hpp" diff --git a/src/cpp/mip/mip_cmdqueue.hpp b/src/cpp/mip/mip_cmdqueue.hpp new file mode 100644 index 000000000..47ed7546d --- /dev/null +++ b/src/cpp/mip/mip_cmdqueue.hpp @@ -0,0 +1,114 @@ +#pragma once + +#include + +#include "mip_result.hpp" + +#include +#include + + +namespace mip +{ +//////////////////////////////////////////////////////////////////////////////// +///@addtogroup mip_cpp +///@{ + +//////////////////////////////////////////////////////////////////////////////// +///@brief C++ wrapper around a command queue. +/// +struct CmdQueue : public C::mip_cmd_queue +{ + CmdQueue(Timeout baseReplyTimeout=1000) { C::mip_cmd_queue_init(this, baseReplyTimeout); } + ~CmdQueue() { assert(_first_pending_cmd==nullptr); } + + CmdQueue(const CmdQueue&) = delete; + CmdQueue& operator=(const CmdQueue&) = delete; + + void enqueue(C::mip_pending_cmd& cmd) { C::mip_cmd_queue_enqueue(this, &cmd); } + void dequeue(C::mip_pending_cmd& cmd) { C::mip_cmd_queue_dequeue(this, &cmd); } + + void clear() { C::mip_cmd_queue_clear(this); } + + void update(Timestamp now) { C::mip_cmd_queue_update(this, now); } + + void setBaseReplyTimeout(Timeout timeout) { C::mip_cmd_queue_set_base_reply_timeout(this, timeout); } + Timeout baseReplyTimeout() const { return C::mip_cmd_queue_base_reply_timeout(this); } + + void processPacket(const C::mip_packet_view& packet, Timestamp timestamp) { C::mip_cmd_queue_process_packet(this, &packet, timestamp); } +}; +static_assert(sizeof(CmdQueue) == sizeof(C::mip_cmd_queue), "CmdQueue must not have additional data members."); + + +//////////////////////////////////////////////////////////////////////////////// +///@brief C++ class representing the state of a MIP command. +/// +struct PendingCmd : public C::mip_pending_cmd +{ + ///@brief Create a null pending command in the CmdResult::NONE state. + /// + PendingCmd() { std::memset(static_cast(this), 0, sizeof(C::mip_pending_cmd)); } + + ///@brief Create a pending command for the given descriptor pair. + /// + ///@param descriptorSet MIP descriptor set for the command. + ///@param fieldDescriptor MIP field descriptor for the command. + ///@param additionalTime Optional additional time to allow for the device to process the command. Default 0. + /// + PendingCmd(uint8_t descriptorSet, uint8_t fieldDescriptor, Timeout additionalTime=0) { C::mip_pending_cmd_init_with_timeout(this, descriptorSet, fieldDescriptor, additionalTime); } + + ///@brief Create a pending command with expected response. + /// + ///@param descriptorSet MIP descriptor set for the command. + ///@param fieldDescriptor MIP field descriptor for the command. + ///@param responseDescriptor MIP field descriptor for the response. + ///@param responseBuffer A buffer used for the command response data. Must be big enough for the expected response. You can reuse the buffer used to send the command. + ///@param responseBufferSize Length of responseBuffer in bytes. + ///@param additionalTime Optional additional time to allow for the device to process the command. Default 0. + /// + PendingCmd(uint8_t descriptorSet, uint8_t fieldDescriptor, uint8_t responseDescriptor, uint8_t* responseBuffer, uint8_t responseBufferSize, Timeout additionalTime) { C::mip_pending_cmd_init_full(this, descriptorSet, fieldDescriptor, responseDescriptor, responseBuffer, responseBufferSize, additionalTime); } + + ///@brief Create a pending command given the actual command struct. + /// + ///@param cmd The C++ command struct (this must be the C++ version of the struct, the C struct will not work). It need not be fully populated; this parameter is unused except for its type information. + ///@param additionalTime Optional additional time to allow for the device to process the command. Default 0. + /// + template + PendingCmd(const Cmd& cmd, Timeout additionalTime=0) : PendingCmd(cmd.descriptorSet, cmd.fieldDescriptor, additionalTime) {} + + ///@brief Create a pending command given the actual command struct and a response buffer. + /// + ///@param cmd The C++ command struct (this must be the C++ version of the struct, the C struct will not work). It need not be fully populated; this parameter is unused except for its type information. + ///@param responseBuffer A buffer used for the command response data. Must be big enough for the expected response. You can reuse the buffer used to send the command. + ///@param responseBufferSize Length of responseBuffer in bytes. + ///@param additionalTime Optional additional time to allow for the device to process the command. Default 0. + /// + template + PendingCmd(const Cmd& cmd, uint8_t* responseBuffer, uint8_t responseBufferSize, Timeout additionalTime=0) : PendingCmd(Cmd::DESCRIPTOR_SET, Cmd::FIELD_DESCRIPTOR, Cmd::Response::FIELD_DESCRIPTOR, responseBuffer, responseBufferSize, additionalTime) {} + + ///@brief Disable copying and moving. Once queued, a pending command must remain in the same memory location. + /// + PendingCmd(const PendingCmd&) = delete; + PendingCmd& operator=(const PendingCmd&) = delete; + + ///@brief Sanity check that the PendingCmd is not deallocated while still in the queue. + /// + ~PendingCmd() { CmdResult tmp = status(); assert(tmp.isFinished() || tmp==CmdResult::STATUS_NONE); (void)tmp; } + + ///@brief Gets the status of the pending command. + /// + CmdResult status() const { return C::mip_pending_cmd_status(this); } + + ///@copydoc mip::C::mip_pending_cmd_response_descriptor + uint8_t responseDescriptor() const { return C::mip_pending_cmd_response_descriptor(this); } + + ///@copydoc mip::C::mip_pending_cmd_response + const uint8_t* response() const { return C::mip_pending_cmd_response(this); } + + ///@copydoc mip::C::mip_pending_cmd_response_length + uint8_t responseLength() const { return C::mip_pending_cmd_response_length(this); } +}; + +///@} +//////////////////////////////////////////////////////////////////////////////// +} // namespace mip diff --git a/src/mip/definitions/descriptors.h b/src/cpp/mip/mip_descriptors.hpp similarity index 63% rename from src/mip/definitions/descriptors.h rename to src/cpp/mip/mip_descriptors.hpp index d2a01b23d..d09282095 100644 --- a/src/mip/definitions/descriptors.h +++ b/src/cpp/mip/mip_descriptors.hpp @@ -1,66 +1,20 @@ #pragma once -#include -#include -#include -#include "../utils/serialization.h" -#include "../mip_result.h" +#include "mip_result.hpp" +#include "mip_serialization.hpp" -#ifdef __cplusplus +#include #include #include #include -namespace mip { -namespace C { -extern "C" { -#endif // __cplusplus -enum { - MIP_INVALID_DESCRIPTOR_SET = 0x00, - MIP_DATA_DESCRIPTOR_SET_START = 0x80, - MIP_RESERVED_DESCRIPTOR_SET_START = 0xF0, - - MIP_INVALID_FIELD_DESCRIPTOR = 0x00, - MIP_REPLY_DESCRIPTOR = 0xF1, - MIP_RESERVED_DESCRIPTOR_START = 0xF0, - MIP_RESPONSE_DESCRIPTOR_START = 0x80, - - MIP_SHARED_DATA_FIELD_DESCRIPTOR_START = 0xD0, -}; - -bool mip_is_valid_descriptor_set(uint8_t descriptor_set); -bool mip_is_data_descriptor_set(uint8_t descriptor_set); -bool mip_is_cmd_descriptor_set(uint8_t descriptor_set); -bool mip_is_reserved_descriptor_set(uint8_t descriptor_set); -bool mip_is_gnss_data_descriptor_set(uint8_t descriptor_set); - -bool mip_is_valid_field_descriptor(uint8_t field_descriptor); -bool mip_is_cmd_field_descriptor(uint8_t field_descriptor); -bool mip_is_reply_field_descriptor(uint8_t field_descriptor); -bool mip_is_response_field_descriptor(uint8_t field_descriptor); -bool mip_is_reserved_cmd_field_descriptor(uint8_t field_descriptor); -bool mip_is_shared_data_field_descriptor(uint8_t field_descriptor); - -enum mip_function_selector +namespace mip { - MIP_FUNCTION_WRITE = 0x01, - MIP_FUNCTION_READ = 0x02, - MIP_FUNCTION_SAVE = 0x03, - MIP_FUNCTION_LOAD = 0x04, - MIP_FUNCTION_RESET = 0x05, -}; -typedef enum mip_function_selector mip_function_selector; -void insert_mip_function_selector(mip_serializer* serializer, enum mip_function_selector self); -void extract_mip_function_selector(mip_serializer* serializer, enum mip_function_selector* self); - - -#ifdef __cplusplus - -} // extern "C" -} // namespace "C" - +//////////////////////////////////////////////////////////////////////////////// +///@addtogroup mip_cpp +///@{ //////////////////////////////////////////////////////////////////////////////// ///@brief Convenience struct holding both descriptor set and field descriptor. @@ -85,12 +39,30 @@ struct CompositeDescriptor }; +// All MIP command/data fields should inherit this struct. +struct FieldStruct +{ + //static_assert(std::is_base_of, T>::value, "T must inherit from FieldStruct"); + +private: + // No direct instantiation, + // this class must be inherited. + FieldStruct() = default; +}; + +template +using isField = std::is_base_of; + +template +using EnableForFieldTypes = std::enable_if::value, T>; + + ///@brief A dummy struct which is used to mark bitfield objects. /// template struct Bitfield {}; -template void insert (Serializer& serializer, const Bitfield& bitfield) { insert(serializer, static_cast(bitfield).value); } -template void extract(Serializer& serializer, Bitfield& bitfield) { extract(serializer, static_cast(bitfield).value); } +template size_t insert (Serializer& serializer, const Bitfield& bitfield) { return insert(serializer, static_cast(bitfield).value); } +template size_t extract(Serializer& serializer, Bitfield& bitfield) { return extract(serializer, static_cast(bitfield).value); } enum class FunctionSelector : uint8_t @@ -141,6 +113,7 @@ struct TypedResult : public CmdResult constexpr CompositeDescriptor descriptor() const { return DESCRIPTOR; } }; +///@} +//////////////////////////////////////////////////////////////////////////////// } // namespace mip -#endif // __cplusplus diff --git a/src/cpp/mip/mip_field.hpp b/src/cpp/mip/mip_field.hpp new file mode 100644 index 000000000..ddc3332f3 --- /dev/null +++ b/src/cpp/mip/mip_field.hpp @@ -0,0 +1,109 @@ +#pragma once + +#include "mip_descriptors.hpp" +#include "mip_serialization.hpp" + +#include + +#include +#include + +#include + + +namespace mip +{ +//////////////////////////////////////////////////////////////////////////////// +///@addtogroup mip_cpp +///@{ + +//////////////////////////////////////////////////////////////////////////////// +///@brief C++ class representing a MIP field. +/// +/// This is a thin wrapper around the C mip_field struct. +/// +class FieldView : public C::mip_field_view +{ +public: + static constexpr size_t MAX_PAYLOAD_LENGTH = C::MIP_FIELD_PAYLOAD_LENGTH_MAX; + + /// Construct an empty MIP field. + FieldView() { C::mip_field_view::_payload=nullptr; C::mip_field_view::_payload_length=0; C::mip_field_view::_field_descriptor=0x00; C::mip_field_view::_descriptor_set=0x00; C::mip_field_view::_remaining_length=0; } + ///@copydoc mip_field_init() + FieldView(uint8_t descriptor_set, uint8_t field_descriptor, const uint8_t* payload, uint8_t payload_length) { C::mip_field_init(this, descriptor_set, field_descriptor, payload, payload_length); } + ///@copydoc mip_field_from_header_ptr() + FieldView(const uint8_t* header, uint8_t total_length, uint8_t descriptor_set) { *this = C::mip_field_from_header_ptr(header, total_length, descriptor_set); } + /// Creates a %Field class from the mip_field C struct. + FieldView(const C::mip_field_view& other) { std::memcpy(static_cast(this), &other, sizeof(C::mip_field_view)); } + + // + // C function wrappers + // + + ///@copydoc mip::C::mip_field_descriptor_set + uint8_t descriptorSet() const { return C::mip_field_descriptor_set(this); } + ///@copydoc mip::C::mip_field_field_descriptor + uint8_t fieldDescriptor() const { return C::mip_field_field_descriptor(this); } + ///@brief Returns the descriptor set and field descriptor. + CompositeDescriptor descriptor() const { return {descriptorSet(), fieldDescriptor()}; } + ///@copydoc mip::C::mip_field_payload_length + uint8_t payloadLength() const { return C::mip_field_payload_length(this); } + ///@copydoc mip::C::mip_field_payload + const uint8_t* payload() const { return C::mip_field_payload(this); } + + ///@brief Index the payload at the given location. + ///@param index + ///@returns payload byte + uint8_t payload(unsigned int index) const { return payload()[index]; } + + uint8_t operator[](unsigned int index) const { return payload(index); } + + microstrain::Span payloadSpan() const { return {payload(), payloadLength()}; } + + ///@copydoc mip::C::mip_field_is_valid + bool isValid() const { return C::mip_field_is_valid(this); } + + ///@copybrief mip::C::mip_field_next_after + FieldView nextAfter() const { return C::mip_field_next_after(this); } + ///@copybrief mip::C::mip_field_next + bool next() { return C::mip_field_next(this); } + + // + // Additional functions which have no C equivalent + // + + ///@brief Deserializes the field data to specific field struct. + /// + ///@tparam FieldType Any field class from a file in the mip/definitions directory. + /// + ///@param[out] field A reference to the field struct to be filled out. Valid + /// only if the function returns true. + ///@param exact_size If true, the function fails if any bytes remain after deserialization. + /// + ///@returns True if the field was successfully deserialized, or false if the field contains + /// too few bytes (or to many if exact_size is specified). The field data is not + /// valid unless this function returns true. + template + bool extract(FieldType& field, bool exact_size=true) const { return microstrain::extract(field, payload(), payloadLength(), 0, exact_size); } + + + ///@brief Determines if the field holds data (and not a command, reply, or response). + bool isData() const { return isDataDescriptorSet(descriptorSet()); } + + ///@brief Determines if the field is from a command descriptor set (a command, reply, or response field). + bool isCommandSet() const { return isCommandDescriptorSet(descriptorSet()); } + + ///@brief Determines if the field holds a command. + bool isCommand() const { return isCommandSet() && isCommandFieldDescriptor(fieldDescriptor()); } + + ///@brief Determines if the field holds an ack/nack reply code. + bool isReply() const { return isCommandSet() && isReplyFieldDescriptor(fieldDescriptor()) && payloadLength()==2; } + + ///@brief Determines if the field holds command response data (not an ack/nack reply). + bool isResponse() const { return isCommandSet() && isResponseFieldDescriptor(fieldDescriptor()); } +}; + + +///@} +//////////////////////////////////////////////////////////////////////////////// +} // namespace mip diff --git a/src/mip/mip_device.cpp b/src/cpp/mip/mip_interface.cpp similarity index 61% rename from src/mip/mip_device.cpp rename to src/cpp/mip/mip_interface.cpp index d1d47968a..f21627dea 100644 --- a/src/mip/mip_device.cpp +++ b/src/cpp/mip/mip_interface.cpp @@ -1,5 +1,8 @@ -#include "mip_device.hpp" +#include "mip_interface.hpp" + +#include + namespace mip { @@ -17,35 +20,38 @@ namespace mip { /// ///@brief Receives bytes from the device /// -///@param buffer Buffer to store the received data in -///@param max_length Max number of bytes that can be read. Should be at most the length of buffer. -///@param length_out Number of bytes actually read. -///@param timestamp Timestamp of when the data was received +///@param buffer Buffer to store the received data in +///@param max_length Max number of bytes that can be read. Should be at most the length of buffer. +///@param wait_time_ms Time to wait for data in milliseconds. +///@param length_out Number of bytes actually read. +///@param timestamp_out Timestamp of when the data was received //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// ///@brief Sets up the mip interface callbacks to point at this object. /// ///@note This sets the interface's user pointer to this connection object. /// ///@param device Device to configure. +///@param conn The connection to set /// -void Connection::connect_interface(C::mip_interface* device) +void connect_interface(mip::Interface& device, microstrain::Connection& conn) { + using microstrain::Connection; + auto send = [](C::mip_interface* device, const uint8_t* data, size_t length)->bool { return static_cast(C::mip_interface_user_pointer(device))->sendToDevice(data, length); }; auto recv = [](C::mip_interface* device, uint8_t* buffer, size_t max_length, C::mip_timeout wait_time, size_t* length_out, C::mip_timestamp* timestamp_out)->bool { - return static_cast(C::mip_interface_user_pointer(device))->recvFromDevice(buffer, max_length, wait_time, length_out, timestamp_out); + return static_cast(C::mip_interface_user_pointer(device))->recvFromDevice(buffer, max_length, static_cast(wait_time), length_out, timestamp_out); }; - C::mip_interface_set_user_pointer(device, this); + C::mip_interface_set_user_pointer(&device, &conn); - C::mip_interface_set_send_function(device, send); - C::mip_interface_set_recv_function(device, recv); + C::mip_interface_set_send_function(&device, send); + C::mip_interface_set_recv_function(&device, recv); } } // namespace mip diff --git a/src/mip/mip_device.hpp b/src/cpp/mip/mip_interface.hpp similarity index 66% rename from src/mip/mip_device.hpp rename to src/cpp/mip/mip_interface.hpp index 743186dd3..5b4f3de10 100644 --- a/src/mip/mip_device.hpp +++ b/src/cpp/mip/mip_interface.hpp @@ -1,19 +1,32 @@ #pragma once -#include "mip.hpp" -#include "mip_interface.h" +#include "mip_parser.hpp" +#include "mip_cmdqueue.hpp" -#include "definitions/descriptors.h" +#include +#include +#include #include -namespace mip + +namespace microstrain { + class Connection; +} +namespace mip +{ //////////////////////////////////////////////////////////////////////////////// ///@addtogroup mip_cpp ///@{ +class Interface; + +void connect_interface(mip::Interface& dev, microstrain::Connection& conn); + + + using DispatchHandler = C::mip_dispatch_handler; struct Dispatcher : public C::mip_dispatcher @@ -30,151 +43,16 @@ struct Dispatcher : public C::mip_dispatcher }; -//////////////////////////////////////////////////////////////////////////////// -///@brief C++ wrapper around a command queue. -/// -struct CmdQueue : public C::mip_cmd_queue -{ - CmdQueue(Timeout baseReplyTimeout=1000) { C::mip_cmd_queue_init(this, baseReplyTimeout); } - ~CmdQueue() { assert(_first_pending_cmd==nullptr); } - - CmdQueue(const CmdQueue&) = delete; - CmdQueue& operator=(const CmdQueue&) = delete; - - void enqueue(C::mip_pending_cmd& cmd) { C::mip_cmd_queue_enqueue(this, &cmd); } - void dequeue(C::mip_pending_cmd& cmd) { C::mip_cmd_queue_dequeue(this, &cmd); } - - void clear() { C::mip_cmd_queue_clear(this); } - - void update(Timestamp now) { C::mip_cmd_queue_update(this, now); } - - void setBaseReplyTimeout(Timeout timeout) { C::mip_cmd_queue_set_base_reply_timeout(this, timeout); } - Timeout baseReplyTimeout() const { return C::mip_cmd_queue_base_reply_timeout(this); } - - void processPacket(const C::mip_packet& packet, Timestamp timestamp) { C::mip_cmd_queue_process_packet(this, &packet, timestamp); } -}; -static_assert(sizeof(CmdQueue) == sizeof(C::mip_cmd_queue), "CmdQueue must not have additional data members."); - - -//////////////////////////////////////////////////////////////////////////////// -///@brief C++ class representing the state of a MIP command. -/// -struct PendingCmd : public C::mip_pending_cmd -{ - ///@brief Create a null pending command in the CmdResult::NONE state. - /// - PendingCmd() { std::memset(static_cast(this), 0, sizeof(C::mip_pending_cmd)); } - - ///@brief Create a pending command for the given descriptor pair. - /// - ///@param descriptorSet MIP descriptor set for the command. - ///@param fieldDescriptor MIP field descriptor for the command. - ///@param additionalTime Optional additional time to allow for the device to process the command. Default 0. - /// - PendingCmd(uint8_t descriptorSet, uint8_t fieldDescriptor, Timeout additionalTime=0) { C::mip_pending_cmd_init_with_timeout(this, descriptorSet, fieldDescriptor, additionalTime); } - - ///@brief Create a pending command with expected response. - /// - ///@param descriptorSet MIP descriptor set for the command. - ///@param fieldDescriptor MIP field descriptor for the command. - ///@param responseDescriptor MIP field descriptor for the response. - ///@param responseBuffer A buffer used for the command response data. Must be big enough for the expected response. You can reuse the buffer used to send the command. - ///@param responseBufferSize Length of responseBuffer in bytes. - ///@param additionalTime Optional additional time to allow for the device to process the command. Default 0. - /// - PendingCmd(uint8_t descriptorSet, uint8_t fieldDescriptor, uint8_t responseDescriptor, uint8_t* responseBuffer, uint8_t responseBufferSize, Timeout additionalTime) { C::mip_pending_cmd_init_full(this, descriptorSet, fieldDescriptor, responseDescriptor, responseBuffer, responseBufferSize, additionalTime); } - - ///@brief Create a pending command given the actual command struct. - /// - ///@param cmd The C++ command struct (this must be the C++ version of the struct, the C struct will not work). It need not be fully populated; this parameter is unused except for its type information. - ///@param additionalTime Optional additional time to allow for the device to process the command. Default 0. - /// - template - PendingCmd(const Cmd& cmd, Timeout additionalTime=0) : PendingCmd(cmd.descriptorSet, cmd.fieldDescriptor, additionalTime) {} - - ///@brief Create a pending command given the actual command struct and a response buffer. - /// - ///@param cmd The C++ command struct (this must be the C++ version of the struct, the C struct will not work). It need not be fully populated; this parameter is unused except for its type information. - ///@param responseBuffer A buffer used for the command response data. Must be big enough for the expected response. You can reuse the buffer used to send the command. - ///@param responseBufferSize Length of responseBuffer in bytes. - ///@param additionalTime Optional additional time to allow for the device to process the command. Default 0. - /// - template - PendingCmd(const Cmd& cmd, uint8_t* responseBuffer, uint8_t responseBufferSize, Timeout additionalTime=0) : PendingCmd(Cmd::DESCRIPTOR_SET, Cmd::FIELD_DESCRIPTOR, Cmd::Response::FIELD_DESCRIPTOR, responseBuffer, responseBufferSize, additionalTime) {} - - ///@brief Disable copying and moving. Once queued, a pending command must remain in the same memory location. - /// - PendingCmd(const PendingCmd&) = delete; - PendingCmd& operator=(const PendingCmd&) = delete; - - ///@brief Sanity check that the PendingCmd is not deallocated while still in the queue. - /// - ~PendingCmd() { CmdResult tmp = status(); assert(tmp.isFinished() || tmp==CmdResult::STATUS_NONE); (void)tmp; } - - ///@brief Gets the status of the pending command. - /// - CmdResult status() const { return C::mip_pending_cmd_status(this); } - - ///@copydoc mip::C::mip_pending_cmd_response_descriptor - uint8_t responseDescriptor() const { return C::mip_pending_cmd_response_descriptor(this); } - - ///@copydoc mip::C::mip_pending_cmd_response - const uint8_t* response() const { return C::mip_pending_cmd_response(this); } - - ///@copydoc mip::C::mip_pending_cmd_response_length - uint8_t responseLength() const { return C::mip_pending_cmd_response_length(this); } -}; - - - template CmdResult runCommand(C::mip_interface& device, const Cmd& cmd, Timeout additionalTime=0); template CmdResult runCommand(C::mip_interface& device, const Cmd& cmd, typename Cmd::Response& response, Timeout additionalTime=0); template CmdResult runCommand(C::mip_interface& device, const Args&&... args, Timeout additionalTime); template bool startCommand(C::mip_interface& device, C::mip_pending_cmd& pending, const Cmd& cmd, Timeout additionalTime); -//////////////////////////////////////////////////////////////////////////////// -///@brief Represents a type of connection to a MIP device. -/// -/// The following methods are pure virtual and must be implemented by a derived -/// class. These functions map to the corresponding C functions. -///@li `bool sendToDevice(const uint8_t* data, size_t length)` - corresponds to mip_interface_user_send_to_device. -///@li `bool recvFromDevice(uint8_t* buffer, size_t maxLength, size_t* lengthOut, Timestamp* timestampOut)` - corresponds to mip_interface_user_recv_from_device. -/// -class Connection -{ -public: - - static constexpr auto TYPE = "None"; - - Connection() { mType = TYPE; }; - virtual ~Connection() {} - - virtual bool sendToDevice(const uint8_t* data, size_t length) = 0; - virtual bool recvFromDevice(uint8_t* buffer, size_t max_length, Timeout wait_time, size_t* length_out, Timestamp* timestamp_out) = 0; - - virtual bool isConnected() const = 0; - virtual bool connect() = 0; - virtual bool disconnect() = 0; - - void connect_interface(C::mip_interface* device); - - const char* type() const { return mType; }; - - virtual const char* interfaceName() const = 0; - virtual uint32_t parameter() const = 0; - -protected: - - const char *mType; - -}; - - //////////////////////////////////////////////////////////////////////////////// ///@brief Represents a connected MIP device. /// -class DeviceInterface : public C::mip_interface +class Interface : public C::mip_interface { public: // @@ -183,24 +61,24 @@ class DeviceInterface : public C::mip_interface ///@copydoc mip::C::mip_interface_init /// The interface callbacks must be assigned separately (e.g. with Connection::connect_interface()) - DeviceInterface(uint8_t* parseBuffer, size_t parseBufferSize, Timeout parseTimeout, Timeout baseReplyTimeout) + Interface(uint8_t* parseBuffer, size_t parseBufferSize, Timeout parseTimeout, Timeout baseReplyTimeout) { C::mip_interface_init(this, parseBuffer, parseBufferSize, parseTimeout, baseReplyTimeout, nullptr, nullptr, &C::mip_interface_default_update, nullptr); } ///@copydoc mip::C::mip_interface_init - ///@param connection The connection object used to communicate with the device. This object must exist for the life of the DeviceInterface object - DeviceInterface(Connection* connection, uint8_t* parseBuffer, size_t parseBufferSize, Timeout parseTimeout, Timeout baseReplyTimeout) : - DeviceInterface(parseBuffer, parseBufferSize, parseTimeout, baseReplyTimeout) + ///@param connection The connection object used to communicate with the device. This object must exist for the life of the Interface object + Interface(microstrain::Connection* connection, uint8_t* parseBuffer, size_t parseBufferSize, Timeout parseTimeout, Timeout baseReplyTimeout) : + Interface(parseBuffer, parseBufferSize, parseTimeout, baseReplyTimeout) { if(connection) - connection->connect_interface(this); + connect_interface(*this, *connection); } - DeviceInterface(const DeviceInterface&) = delete; - DeviceInterface& operator=(const DeviceInterface&) = delete; + Interface(const Interface&) = delete; + Interface& operator=(const Interface&) = delete; - ~DeviceInterface() = default; + ~Interface() = default; // // Callback functions @@ -218,13 +96,13 @@ class DeviceInterface : public C::mip_interface // free/nonmember function callbacks - template + template void setSendFunction(); - template + template void setRecvFunction(); - template + template void setUpdateFunction(); // derived member function callbacks @@ -262,21 +140,21 @@ class DeviceInterface : public C::mip_interface Parser& parser() { return *static_cast(C::mip_interface_parser(this)); } CmdQueue& cmdQueue() { return *static_cast(C::mip_interface_cmd_queue(this)); } - const Parser& parser() const { return const_cast(this)->parser(); } - const CmdQueue& cmdQueue() const { return const_cast(this)->cmdQueue(); } + const Parser& parser() const { return const_cast(this)->parser(); } + const CmdQueue& cmdQueue() const { return const_cast(this)->cmdQueue(); } // // Communications // bool sendToDevice(const uint8_t* data, size_t length) { return C::mip_interface_send_to_device(this, data, length); } - bool sendToDevice(const C::mip_packet& packet) { return sendToDevice(C::mip_packet_pointer(&packet), C::mip_packet_total_length(&packet)); } + bool sendToDevice(const C::mip_packet_view& packet) { return sendToDevice(C::mip_packet_pointer(&packet), C::mip_packet_total_length(&packet)); } bool recvFromDevice(uint8_t* buffer, size_t max_length, Timeout wait_time, size_t* length_out, Timestamp* timestamp) { return C::mip_interface_recv_from_device(this, buffer, max_length, wait_time, length_out, timestamp); } bool update(Timeout wait_time=0) { return C::mip_interface_update(this, wait_time); } bool defaultUpdate(Timeout wait_time=0) { return C::mip_interface_default_update(this, wait_time); } size_t receiveBytes(const uint8_t* data, size_t length, Timestamp timestamp) { return C::mip_interface_receive_bytes(this, data, length, timestamp); } - void receivePacket(const C::mip_packet& packet, Timestamp timestamp) { C::mip_interface_receive_packet(this, &packet, timestamp); } + void receivePacket(const C::mip_packet_view& packet, Timestamp timestamp) { C::mip_interface_receive_packet(this, &packet, timestamp); } void processUnparsedPackets() { C::mip_interface_process_unparsed_packets(this); } CmdResult waitForReply(C::mip_pending_cmd& cmd) { return C::mip_interface_wait_for_reply(this, &cmd); } @@ -289,17 +167,17 @@ class DeviceInterface : public C::mip_interface void registerFieldCallback(C::mip_dispatch_handler& handler, uint8_t descriptorSet, uint8_t fieldDescriptor, C::mip_dispatch_field_callback callback, void* userData) { C::mip_interface_register_field_callback(this, &handler, descriptorSet, fieldDescriptor, callback, userData); } - template + template void registerPacketCallback(C::mip_dispatch_handler& handler, uint8_t descriptorSet, bool afterFields, void* userData=nullptr); - template + template void registerPacketCallback(C::mip_dispatch_handler& handler, uint8_t descriptorSet, bool afterFields, Object* object); - template + template void registerFieldCallback(C::mip_dispatch_handler& handler, uint8_t descriptorSet, uint8_t fieldDescriptor, void* userData=nullptr); - template + template void registerFieldCallback(C::mip_dispatch_handler& handler, uint8_t descriptorSet, uint8_t fieldDescriptor, Object* object); @@ -347,37 +225,37 @@ class DeviceInterface : public C::mip_interface /// ///@tparam Send A compile-time pointer to the callback function. /// -template -void DeviceInterface::setSendFunction() +template +void Interface::setSendFunction() { setSendFunction([](C::mip_interface* device, const uint8_t* data, size_t length){ - return (*Send)(*static_cast(device), data, length); + return (*Send)(*static_cast(device), data, length); }); } //////////////////////////////////////////////////////////////////////////////// ///@brief Sets the receive callback function (free function version). /// -///@tparam Send A compile-time pointer to the callback function. +///@tparam Recv A compile-time pointer to the callback function. /// -template -void DeviceInterface::setRecvFunction() +template +void Interface::setRecvFunction() { setRecvFunction([](C::mip_interface* device, uint8_t* buffer, size_t max_length, C::mip_timeout wait_time, size_t* length_out, C::mip_timestamp* timestamp_out){ - return (*Recv)(*static_cast(device), buffer, max_length, wait_time, length_out, timestamp_out); + return (*Recv)(*static_cast(device), buffer, max_length, wait_time, length_out, timestamp_out); }); } //////////////////////////////////////////////////////////////////////////////// ///@brief Sets the update callback function (free function version). /// -///@tparam Send A compile-time pointer to the callback function. +///@tparam Update A compile-time pointer to the callback function. /// -template -void DeviceInterface::setUpdateFunction() +template +void Interface::setUpdateFunction() { setUpdateFunction([](C::mip_interface* device, C::mip_timeout wait_time){ - return (*Update)(*static_cast(device), wait_time); + return (*Update)(*static_cast(device), wait_time); }); } @@ -385,11 +263,11 @@ void DeviceInterface::setUpdateFunction() //////////////////////////////////////////////////////////////////////////////// ///@brief Sets the send callback function (derived member function version). /// -///@tparam Derived Derived class type. Must inherit from DeviceInterface. +///@tparam Derived Derived class type. Must inherit from Interface. ///@tparam Send Compile-time pointer to member function of Derived. /// ///@code{.cpp} -/// class MyClass : public mip::DeviceInterface +/// class MyClass : public mip::Interface /// { /// bool sendToDevice(const uint8_t* data, size_t size); /// bool recvFromDevice(uint8_t* data, size_t max_length, Timeout wait_time, size_t* length_out, Timestamp* timestamp_out); @@ -404,7 +282,7 @@ void DeviceInterface::setUpdateFunction() /// template -void DeviceInterface::setSendFunction() +void Interface::setSendFunction() { static_assert(std::is_base_of::value, "Derived must be derived from C::mip_interface."); @@ -419,13 +297,13 @@ void DeviceInterface::setSendFunction() //////////////////////////////////////////////////////////////////////////////// ///@brief Sets the receive callback function (derived member function version). /// -///@tparam Derived Derived class type. Must inherit from DeviceInterface. +///@tparam Derived Derived class type. Must inherit from Interface. ///@tparam Recv Compile-time pointer to member function of Derived. /// -///@see DeviceInterface::setSendFunction() +///@see Interface::setSendFunction() /// template -void DeviceInterface::setRecvFunction() +void Interface::setRecvFunction() { static_assert(std::is_base_of::value, "Derived must be derived from C::mip_interface."); @@ -440,13 +318,13 @@ void DeviceInterface::setRecvFunction() //////////////////////////////////////////////////////////////////////////////// ///@brief Sets the update callback function (derived member function version). /// -///@tparam Derived Derived class type. Must inherit from DeviceInterface. +///@tparam Derived Derived class type. Must inherit from Interface. ///@tparam Update Compile-time pointer to member function of Derived. /// -///@see DeviceInterface::setSendFunction() +///@see Interface::setSendFunction() /// template -void DeviceInterface::setUpdateFunction() +void Interface::setUpdateFunction() { static_assert(std::is_base_of::value, "Derived must be derived from C::mip_interface."); @@ -491,7 +369,7 @@ void DeviceInterface::setUpdateFunction() /// }; /// /// DeviceConnection connection; -/// mip::DeviceInterface interface; +/// mip::Interface interface; /// /// interface.setCallbacks(&connection); ///@endcode @@ -502,7 +380,7 @@ template< bool (T::*Recv)(uint8_t*, size_t, Timeout, size_t*, Timestamp*), bool (T::*Update)(Timeout) > -void DeviceInterface::setCallbacks(T* object) +void Interface::setCallbacks(T* object) { auto send = [](C::mip_interface* device, const uint8_t* data, size_t size) { @@ -548,7 +426,7 @@ void DeviceInterface::setCallbacks(T* object) /// // Use the packet data /// } /// -/// DeviceInterface device; +/// Interface device; /// DispatchHandler handler; /// /// void setup() @@ -560,12 +438,13 @@ void DeviceInterface::setCallbacks(T* object) /// ///@endcode /// -template -void DeviceInterface::registerPacketCallback(C::mip_dispatch_handler& handler, uint8_t descriptorSet, bool afterFields, void* userData) +template +void Interface::registerPacketCallback(C::mip_dispatch_handler& handler, uint8_t descriptorSet, bool afterFields, void* userData) { - auto callback = [](void* context, const C::mip_packet* packet, Timestamp timestamp) + auto callback = [](void* context, const C::mip_packet_view* packet, Timestamp timestamp) { - Callback(context, PacketRef(*packet), timestamp); + PacketView packetView(*packet); + Callback(context, packetView, timestamp); }; registerPacketCallback(handler, descriptorSet, afterFields, callback, userData); @@ -597,18 +476,19 @@ void DeviceInterface::registerPacketCallback(C::mip_dispatch_handler& handler, u /// device.registerPacketHandler(packetHandler, descriptorSet, this); /// } /// -/// DeviceInterface device; +/// Interface device; /// DispatchHandler packetHandler; /// }; ///@endcode /// -template -void DeviceInterface::registerPacketCallback(C::mip_dispatch_handler& handler, uint8_t descriptorSet, bool afterFields, Object* object) +template +void Interface::registerPacketCallback(C::mip_dispatch_handler& handler, uint8_t descriptorSet, bool afterFields, Object* object) { - auto callback = [](void* pointer, const mip::C::mip_packet* packet, Timestamp timestamp) + auto callback = [](void* pointer, const mip::C::mip_packet_view* packet, Timestamp timestamp) { + PacketView packetView(*packet); Object* obj = static_cast(pointer); - (obj->*Callback)(PacketRef(*packet), timestamp); + (obj->*Callback)(packetView, timestamp); }; registerPacketCallback(handler, descriptorSet, afterFields, callback, object); @@ -633,7 +513,7 @@ void DeviceInterface::registerPacketCallback(C::mip_dispatch_handler& handler, u /// // Use the field data /// } /// -/// DeviceInterface device; +/// Interface device; /// DispatchHandler handler; /// /// void setup() @@ -645,12 +525,13 @@ void DeviceInterface::registerPacketCallback(C::mip_dispatch_handler& handler, u /// ///@endcode /// -template -void DeviceInterface::registerFieldCallback(C::mip_dispatch_handler& handler, uint8_t descriptorSet, uint8_t fieldDescriptor, void* userData) +template +void Interface::registerFieldCallback(C::mip_dispatch_handler& handler, uint8_t descriptorSet, uint8_t fieldDescriptor, void* userData) { - auto callback = [](void* context, const C::mip_field* field, Timestamp timestamp) + auto callback = [](void* context, const C::mip_field_view* field, Timestamp timestamp) { - Callback(context, Field(*field), timestamp); + FieldView fieldView(*field); + Callback(context, fieldView, timestamp); }; registerFieldCallback(handler, descriptorSet, fieldDescriptor, callback, userData); @@ -682,18 +563,19 @@ void DeviceInterface::registerFieldCallback(C::mip_dispatch_handler& handler, ui /// device.registerFieldHandler(fieldHandler, descriptorSet, fieldDescriptor, this); /// } /// -/// DeviceInterface device; +/// Interface device; /// DispatchHandler fieldHandler; /// }; ///@endcode /// -template -void DeviceInterface::registerFieldCallback(C::mip_dispatch_handler& handler, uint8_t descriptorSet, uint8_t fieldDescriptor, Object* object) +template +void Interface::registerFieldCallback(C::mip_dispatch_handler& handler, uint8_t descriptorSet, uint8_t fieldDescriptor, Object* object) { - auto callback = [](void* pointer, const C::mip_field* field, Timestamp timestamp) + auto callback = [](void* pointer, const C::mip_field_view* field, Timestamp timestamp) { + FieldView fieldView(*field); Object* obj = static_cast(pointer); - (obj->*Callback)(Field(*field), timestamp); + (obj->*Callback)(fieldView, timestamp); }; registerFieldCallback(handler, descriptorSet, fieldDescriptor, callback, object); @@ -706,14 +588,14 @@ void DeviceInterface::registerFieldCallback(C::mip_dispatch_handler& handler, ui /// function pointer. /// ///@param handler -/// This must exist as long as the hander remains registered. +/// This must exist as long as the handler remains registered. /// ///@param userData /// Optional data to pass to the callback function. /// ///@param descriptorSet /// If specified, overrides the descriptor set. Intended to be used with -/// with shared data quantities. +/// shared data quantities. /// /// Example usage: ///@code{.cpp} @@ -722,7 +604,7 @@ void DeviceInterface::registerFieldCallback(C::mip_dispatch_handler& handler, ui /// // Use the packet data /// } /// -/// DeviceInterface device; +/// Interface device; /// DispatchHandler handler; /// /// void setup() @@ -735,7 +617,7 @@ void DeviceInterface::registerFieldCallback(C::mip_dispatch_handler& handler, ui ///@endcode /// template -void DeviceInterface::registerDataCallback(C::mip_dispatch_handler& handler, void* userData, uint8_t descriptorSet) +void Interface::registerDataCallback(C::mip_dispatch_handler& handler, void* userData, uint8_t descriptorSet) { assert(descriptorSet != 0x00); if(descriptorSet == 0x00) @@ -745,11 +627,11 @@ void DeviceInterface::registerDataCallback(C::mip_dispatch_handler& handler, voi if(descriptorSet == 0xFF) return; - auto callback = [](void* context, const C::mip_field* field, Timestamp timestamp) + auto callback = [](void* context, const C::mip_field_view* field, Timestamp timestamp) { DataField data; - bool ok = Field(*field).extract(data); + bool ok = FieldView(*field).extract(data); assert(ok); (void)ok; Callback(context, data, timestamp); @@ -765,14 +647,14 @@ void DeviceInterface::registerDataCallback(C::mip_dispatch_handler& handler, voi /// function pointer. /// ///@param handler -/// This must exist as long as the hander remains registered. +/// This must exist as long as the handler remains registered. /// ///@param userData /// Optional data to pass to the callback function. /// ///@param descriptorSet /// If specified, overrides the descriptor set. Intended to be used with -/// with shared data quantities. +/// shared data quantities. /// /// Example usage: ///@code{.cpp} @@ -781,7 +663,7 @@ void DeviceInterface::registerDataCallback(C::mip_dispatch_handler& handler, voi /// // Use the packet data /// } /// -/// DeviceInterface device; +/// Interface device; /// DispatchHandler handler; /// /// void setup() @@ -794,7 +676,7 @@ void DeviceInterface::registerDataCallback(C::mip_dispatch_handler& handler, voi ///@endcode /// template -void DeviceInterface::registerDataCallback(C::mip_dispatch_handler& handler, void* userData, uint8_t descriptorSet) +void Interface::registerDataCallback(C::mip_dispatch_handler& handler, void* userData, uint8_t descriptorSet) { assert(descriptorSet != 0x00); if(descriptorSet == 0x00) @@ -804,11 +686,11 @@ void DeviceInterface::registerDataCallback(C::mip_dispatch_handler& handler, voi if(descriptorSet == 0xFF) return; - auto callback = [](void* context, const C::mip_field* field, Timestamp timestamp) + auto callback = [](void* context, const C::mip_field_view* field, Timestamp timestamp) { DataField data; - bool ok = Field(*field).extract(data); + bool ok = FieldView(*field).extract(data); assert(ok); (void)ok; Callback(context, data, mip_field_descriptor_set(field), timestamp); @@ -824,7 +706,7 @@ void DeviceInterface::registerDataCallback(C::mip_dispatch_handler& handler, voi /// member function pointer. /// ///@param handler -/// This must exist as long as the hander remains registered. +/// This must exist as long as the handler remains registered. /// ///@param object /// A pointer to the object. The object must exist while the handler @@ -832,7 +714,7 @@ void DeviceInterface::registerDataCallback(C::mip_dispatch_handler& handler, voi /// ///@param descriptorSet /// If specified, overrides the descriptor set. Intended to be used with -/// with shared data quantities. +/// shared data quantities. /// /// Example usage: ///@code{.cpp} @@ -848,13 +730,13 @@ void DeviceInterface::registerDataCallback(C::mip_dispatch_handler& handler, voi /// device.registerDataHandler(accelHandler, this); /// } /// -/// DeviceInterface device; +/// Interface device; /// DispatchHandler accelHandler; /// }; ///@endcode /// template -void DeviceInterface::registerDataCallback(C::mip_dispatch_handler& handler, Object* object, uint8_t descriptorSet) +void Interface::registerDataCallback(C::mip_dispatch_handler& handler, Object* object, uint8_t descriptorSet) { assert(descriptorSet != 0x00); if(descriptorSet == 0x00) @@ -864,11 +746,11 @@ void DeviceInterface::registerDataCallback(C::mip_dispatch_handler& handler, Obj if(descriptorSet == 0xFF) return; - auto callback = [](void* pointer, const C::mip_field* field, Timestamp timestamp) + auto callback = [](void* pointer, const C::mip_field_view* field, Timestamp timestamp) { DataField data; - bool ok = Field(*field).extract(data); + bool ok = FieldView(*field).extract(data); assert(ok); (void)ok; Object* obj = static_cast(pointer); @@ -885,7 +767,7 @@ void DeviceInterface::registerDataCallback(C::mip_dispatch_handler& handler, Obj /// member function pointer. /// ///@param handler -/// This must exist as long as the hander remains registered. +/// This must exist as long as the handler remains registered. /// ///@param object /// A pointer to the object. The object must exist while the handler @@ -893,7 +775,7 @@ void DeviceInterface::registerDataCallback(C::mip_dispatch_handler& handler, Obj /// ///@param descriptorSet /// If specified, overrides the descriptor set. Intended to be used with -/// with shared data quantities. +/// shared data quantities. /// /// Example usage: ///@code{.cpp} @@ -909,13 +791,13 @@ void DeviceInterface::registerDataCallback(C::mip_dispatch_handler& handler, Obj /// device.registerDataHandler(accelHandler, this); /// } /// -/// DeviceInterface device; +/// Interface device; /// DispatchHandler accelHandler; /// }; ///@endcode /// template -void DeviceInterface::registerDataCallback(C::mip_dispatch_handler& handler, Object* object, uint8_t descriptorSet) +void Interface::registerDataCallback(C::mip_dispatch_handler& handler, Object* object, uint8_t descriptorSet) { assert(descriptorSet != 0x00); if(descriptorSet == 0x00) @@ -925,11 +807,11 @@ void DeviceInterface::registerDataCallback(C::mip_dispatch_handler& handler, Obj if(descriptorSet == 0xFF) return; - auto callback = [](void* pointer, const C::mip_field* field, Timestamp timestamp) + auto callback = [](void* pointer, const C::mip_field_view* field, Timestamp timestamp) { DataField data; - bool ok = Field(*field).extract(data); + bool ok = FieldView(*field).extract(data); assert(ok); (void)ok; Object* obj = static_cast(pointer); @@ -941,11 +823,11 @@ void DeviceInterface::registerDataCallback(C::mip_dispatch_handler& handler, Obj template -void DeviceInterface::registerExtractor(C::mip_dispatch_handler& handler, DataField* field, uint8_t descriptorSet) +void Interface::registerExtractor(C::mip_dispatch_handler& handler, DataField* field, uint8_t descriptorSet) { - auto callback = [](void* pointer, const C::mip_field* field, Timestamp timestamp) + auto callback = [](void* pointer, const C::mip_field_view* field, Timestamp /*timestamp*/) { - Field(*field).extract( *static_cast(pointer) ); + FieldView(*field).extract( *static_cast(pointer) ); }; registerFieldCallback(handler, descriptorSet, DataField::FIELD_DESCRIPTOR, callback, field); @@ -1011,5 +893,4 @@ bool startCommand(C::mip_interface& device, C::mip_pending_cmd& pending, const C ///@} //////////////////////////////////////////////////////////////////////////////// - } // namespace mip diff --git a/src/cpp/mip/mip_packet.hpp b/src/cpp/mip/mip_packet.hpp new file mode 100644 index 000000000..cc3f9c4b4 --- /dev/null +++ b/src/cpp/mip/mip_packet.hpp @@ -0,0 +1,383 @@ +#pragma once + +#include "mip_field.hpp" + +#include +#include + +#include + +#include +#include + + +namespace mip +{ +//////////////////////////////////////////////////////////////////////////////// +///@addtogroup mip_cpp +///@{ + + +//////////////////////////////////////////////////////////////////////////////// +///@brief C++ class representing a view of a MIP packet. +/// +/// This is a thin wrapper around the mip_packet_view C structure. Like the C +/// version, it does not contain or own the data buffer. Any of the C functions +/// can be used with the C++ packet class because it inherits from the C struct. +/// +/// Fields may be iterated over using the C-style methods, with an iterator, or +/// with a range-based for loop: +///@code{.cpp} +/// for(PacketRef::Iterator iter = packet.begin(); iter != packet.end(); ++iter) { ... } +/// for(Field field : packet) { ... } +///@endcode +/// +class PacketView : public C::mip_packet_view +{ +public: + static constexpr size_t PAYLOAD_LENGTH_MAX = C::MIP_PACKET_PAYLOAD_LENGTH_MAX; + static constexpr size_t PACKET_SIZE_MIN = C::MIP_PACKET_LENGTH_MIN; + static constexpr size_t PACKET_SIZE_MAX = C::MIP_PACKET_LENGTH_MAX; + + class FieldIterator; + +public: + ///@copydoc mip::C::mip_packet_create + PacketView(uint8_t* buffer, size_t bufferSize, uint8_t descriptorSet) { C::mip_packet_create(this, buffer, bufferSize, descriptorSet); } + ///@copydoc mip::C::mip_packet_from_buffer + PacketView(const uint8_t* buffer, size_t length) { C::mip_packet_from_buffer(this, const_cast(buffer), length); } + /// Constructs a C++ %PacketRef class from the base C object. + PacketView(const C::mip_packet_view* other) { std::memcpy(static_cast(this), other, sizeof(*this)); } + /// Constructs a C++ %PacketRef class from the base C object. + PacketView(const C::mip_packet_view& other) { std::memcpy(static_cast(this), &other, sizeof(*this)); } + + ///@brief Create a new MIP packet in an existing buffer. + ///@param buffer Place to store the MIP packet bytes. + ///@param descriptorSet Initializes the packet to this descriptor set. + PacketView(microstrain::Span buffer, uint8_t descriptorSet) { C::mip_packet_create(this, buffer.data(), buffer.size(), descriptorSet); } + + ///@brief Create a reference to an existing MIP packet. + ///@param buffer Buffer containing an existing MIP packet. + ///@warning Do not call functions which modify the packet (addField, finalize, reset, etc) unless you know the buffer is not const. + PacketView(microstrain::Span buffer) { C::mip_packet_from_buffer(this, const_cast(buffer.data()), buffer.size()); } + + // + // C function wrappers + // + + uint8_t descriptorSet() const { return C::mip_packet_descriptor_set(this); } ///<@copydoc mip::C::mip_packet_descriptor_set + uint_least16_t totalLength() const { return C::mip_packet_total_length(this); } ///<@copydoc mip::C::mip_packet_total_length + uint8_t payloadLength() const { return C::mip_packet_payload_length(this); } ///<@copydoc mip::C::mip_packet_payload_length + + bool isData() const { return C::mip_packet_is_data(this); } + + const uint8_t* pointer() const { return C::mip_packet_pointer(this); } ///<@copydoc mip::C::mip_packet_pointer + const uint8_t* payload() const { return C::mip_packet_payload(this); } ///<@copydoc mip::C::mip_packet_payload + + uint16_t checksumValue() const { return C::mip_packet_checksum_value(this); } ///<@copydoc mip::C::mip_packet_checksum_value + uint16_t computeChecksum() const { return C::mip_packet_compute_checksum(this); } ///<@copydoc mip::C::mip_packet_compute_checksum + + bool isSane() const { return C::mip_packet_is_sane(this); } ///<@copydoc mip::C::mip_packet_is_sane + bool isValid() const { return C::mip_packet_is_valid(this); } ///<@copydoc mip::C::mip_packet_is_valid + bool isEmpty() const { return C::mip_packet_is_empty(this); } ///<@copydoc mip::C::mip_packet_is_empty + + uint_least16_t bufferSize() const { return C::mip_packet_buffer_size(this); } ///<@copydoc mip::C::mip_packet_buffer_size + int remainingSpace() const { return C::mip_packet_remaining_space(this); } ///<@copydoc mip::C::mip_packet_remaining_space + + bool addField(uint8_t fieldDescriptor, const uint8_t* payload, uint8_t payloadLength) { return C::mip_packet_add_field(this, fieldDescriptor, payload, payloadLength); } ///<@copydoc mip::C::mip_packet_add_field + Serializer createField(uint8_t fieldDescriptor, uint8_t length) { uint8_t * ptr; if(C::mip_packet_create_field(this, fieldDescriptor, length, &ptr) < 0) length =0; return Serializer{ptr, length}; } + //std::tuple createField(uint8_t fieldDescriptor) { uint8_t* ptr; int max_size = C::mip_packet_alloc_field(this, fieldDescriptor, 0, &ptr); return max_size >= 0 ? std::make_tuple(ptr, max_size) : std::make_tuple(nullptr, 0); } ///<@copydoc mip::C::mip_packet_alloc_field + //int finishLastField(uint8_t* payloadPtr, uint8_t newPayloadLength) { return C::mip_packet_realloc_last_field(this, payloadPtr, newPayloadLength); } ///<@copydoc mip::C::mip_packet_realloc_last_field + //int cancelLastField(uint8_t* payloadPtr) { return C::mip_packet_cancel_last_field(this, payloadPtr); } ///<@copydoc mip::C::mip_packet_cancel_last_field + + void finalize() { C::mip_packet_finalize(this); } ///<@copydoc mip::C::mip_packet_finalize + + void reset(uint8_t descSet) { C::mip_packet_reset(this, descSet); } ///<@copydoc mip::C::mip_packet_reset + void reset() { reset(descriptorSet()); } ///<@brief Resets the packet using the same descriptor set. + + // + // C++ additions + // + + ///@brief Gets a span over the whole packet. + /// + microstrain::Span totalSpan() const { return {pointer(), totalLength()}; } + + ///@brief Gets a span over just the payload. + /// + microstrain::Span payloadSpan() const { return {payload(), payloadLength()}; } + + + class AllocatedField : public Serializer + { + public: + AllocatedField(mip::PacketView& packet, uint8_t* buffer, size_t space) : Serializer(buffer, space), m_packet(packet) {} + //AllocatedField(const AllocatedField&) = delete; + AllocatedField& operator=(const AllocatedField&) = delete; + + bool commit() + { + assert(capacity() <= FIELD_PAYLOAD_LENGTH_MAX); + + bool ok = isOk(); + + if(ok) + ok &= C::mip_packet_update_last_field_length(&m_packet, basePointer(), (uint8_t) usedLength()) >= 0; + + if(!ok) + C::mip_packet_cancel_last_field(&m_packet, basePointer()); + + return ok; + } + + void cancel() { if(basePointer()) C::mip_packet_cancel_last_field(&m_packet, basePointer()); } + + private: + PacketView& m_packet; + }; + + AllocatedField createField(uint8_t fieldDescriptor) { uint8_t* ptr; size_t max_size = std::max(0, C::mip_packet_create_field(this, fieldDescriptor, 0, &ptr)); return {*this, ptr, max_size}; } + + uint8_t operator[](unsigned int index) const { return pointer()[index]; } + + // + // Additional functions which have no C equivalent + // + + /// Returns a forward iterator to the first field in the packet. + /// + FieldIterator begin() const { return firstField(); } + + /// Returns a sentry object representing the end of fields in the packet. + /// +#if __cpp_range_based_for >= 201603 + // After 201603, for loops allow different clases for begin and end. + // Using nullptr is simpler and more efficient than creating an end iterator. + std::nullptr_t end() const { return nullptr; } +#else + FieldIterator end() const { return FieldView(); } +#endif + + ///@brief Returns the first field in the packet. + /// + /// Subsequent fields can be obtained via the returned Field class, + /// but iteration is best done with begin()/end() or the range-based for loop. + /// + ///@note Packets can be empty, so make sure that the returned field is + /// valid before using it. + /// + ///@returns A Field instance representing the first field (if any). + /// + FieldView firstField() const { return FieldView(C::mip_field_first_from_packet(this)); } + + ///@brief Adds a field of the given type to the packet. + /// + ///@tparam FieldType Any field class from a file in the mip/definitions directory. + /// + ///@param field Instance of the field to add to the packet. + ///@param fieldDescriptor If specified, overrides the field descriptor. + /// + ///@returns True if the field was added, false if the packet has insufficient space. + /// + template + bool addField(const FieldType& field, uint8_t fieldDescriptor=INVALID_FIELD_DESCRIPTOR) + { + if( fieldDescriptor == INVALID_FIELD_DESCRIPTOR ) + fieldDescriptor = FieldType::FIELD_DESCRIPTOR; + + AllocatedField buffer = createField(fieldDescriptor); + buffer.insert(field); + return buffer.commit(); + } + + ///@brief Creates a new PacketRef containing a single MIP field from an instance of the field type. + /// + /// This works just like the addField() function but also initializes and finalizes the packet. + /// It is assumed that the field will fit in an empty packet; otherwise the field can't ever be used. + /// The field classes are predefined so this doesn't need runtime checking. + /// + ///@tparam FieldType Any field class from a file in the mip/definitions directory. + /// + ///@param buffer Buffer to hold the packet bytes. + ///@param bufferSize Size of buffer in bytes. + ///@param field Instance of the field to add to the packet. + ///@param fieldDescriptor If specified, overrides the field descriptor. + /// + ///@returns A PacketRef object containing the field. + /// + template + static PacketView createFromField(uint8_t* buffer, size_t bufferSize, const FieldType& field, uint8_t fieldDescriptor=INVALID_FIELD_DESCRIPTOR) + { + if( fieldDescriptor == INVALID_FIELD_DESCRIPTOR ) + fieldDescriptor = FieldType::FIELD_DESCRIPTOR; + PacketView packet(buffer, bufferSize, FieldType::DESCRIPTOR_SET); + packet.addField(field, fieldDescriptor); + packet.finalize(); + return packet; + } + + + /// Iterator class for use with the range-based for loop or iterators. + /// + /// You should generally use the begin()/end() functions on the PacketRef + /// class instead of using this class directly. + /// + class FieldIterator + { + public: + /// Empty iterator, which represents the "end" iterator of a packet. + FieldIterator() {} + + /// Create an iterator given the first field to iterate in a packet. + /// Technically this can be any field, not just the first field. + FieldIterator(const FieldView& first) : mField(first) {} + + /// Comparison between any two iterators. + /// This works even for iterators over different packets, which will + /// never be the same (except all null/end iterators are equivalent). + bool operator==(const FieldIterator& other) const { + // Required to make invalid fields equivalent for range-based for loop + if( !mField.isValid() && !other.mField.isValid() ) + return true; + return mField.descriptorSet() == other.mField.descriptorSet() && mField.fieldDescriptor() == other.mField.fieldDescriptor() && mField.payload() == other.mField.payload(); + } + bool operator!=(const FieldIterator& other) const { return !(*this == other); } + + /// Comparison with std::nullptr is checking if the iterator points to + /// a valid field (i.e. not the end). + bool operator==(std::nullptr_t) const { return !mField.isValid(); } + bool operator!=(std::nullptr_t) const { return mField.isValid(); } + + /// Dereference the iterator as a Field instance. + const FieldView& operator*() const { return mField; } + + /// Advance to the next field. + FieldIterator& operator++() { mField.next(); return *this; } + + private: + FieldView mField; + }; + + ///@brief Copies this packet to an external buffer. + /// + /// This packet must be sane (see isSane()). Undefined behavior otherwise due to lookup of totalLength(). + /// + ///@param buffer Data is copied into this location. + ///@param maxLength Maximum number of bytes to copy. + /// + ///@returns true if successful. + ///@returns false if maxLength is too short. + /// + bool copyPacketTo(uint8_t* buffer, size_t maxLength) { assert(isSane()); size_t copyLength = this->totalLength(); if(copyLength > maxLength) return false; std::memcpy(buffer, pointer(), copyLength); return true; } + + ///@brief Copies this packet to an external buffer (span version). + /// + /// This packet must be sane (see isSane()). Undefined behavior otherwise due to lookup of totalLength(). + /// + ///@param buffer Data is copied to this buffer. + /// + ///@returns true if successful. + ///@returns false if maxLength is too short. + /// + bool copyPacketTo(microstrain::Span buffer) { return copyPacketTo(buffer.data(), buffer.size()); } +}; + + +//////////////////////////////////////////////////////////////////////////////// +///@brief A mip packet with a self-contained buffer (useful with std::vector). +/// +template +class SizedPacketBuf : public PacketView +{ + static_assert(BufferSize >= PACKET_LENGTH_MIN, "BufferSize must be at least PACKET_LENGTH_MIN bytes"); + +public: + SizedPacketBuf(uint8_t descriptorSet=INVALID_DESCRIPTOR_SET) : PacketView(mData, sizeof(mData), descriptorSet) {} + + ///@brief Creates a PacketBuf by copying existing data. + /// + explicit SizedPacketBuf(const uint8_t* data, size_t length) : PacketView(mData, sizeof(mData)) { copyFrom(data, length); } + explicit SizedPacketBuf(const PacketView& packet) : PacketView(mData, sizeof(mData)) { copyFrom(packet); } + + ///@brief Construct from a span. + explicit SizedPacketBuf(microstrain::Span data) : SizedPacketBuf(data.data(), data.size()) {} + + ///@brief Copy constructor + SizedPacketBuf(const SizedPacketBuf& other) : PacketView(mData, sizeof(mData)) { copyFrom(other); } + + + ///@brief Copy constructor (required to insert packets into std::vector in some cases). + template + explicit SizedPacketBuf(const SizedPacketBuf& other) : PacketView(mData, sizeof(mData)) { copyFrom(other); }; + + ///@brief Copy assignment operator + SizedPacketBuf& operator=(const SizedPacketBuf& other) { copyFrom(other); return *this; } + + ///@brief Assignment operator, copies data from another buffer to this one. + template + SizedPacketBuf& operator=(const SizedPacketBuf& other) { copyFrom(other); return *this; } + + ///@brief Create a packet containing just the given field. + /// + ///@tparam FieldType Type of the MIP field. This can't be explicitly specified due to being a constructor. + /// + ///@param field The field object to serialize. + ///@param fieldDescriptor If specified (not INVALID_FIELD_DESCRIPTOR), overrides the field descriptor. + /// + template + SizedPacketBuf( + const FieldType& field, + uint8_t fieldDescriptor=INVALID_FIELD_DESCRIPTOR, + typename std::enable_if::value, void>::type* = nullptr + ) : PacketView(mData, sizeof(mData)) + { + createFromField(mData, sizeof(mData), field, fieldDescriptor); + } + + + ///@brief Explicitly obtains a reference to the packet data. + /// + PacketView ref() { return *this; } + + ///@brief Explicitly obtains a const reference to the packet data. + /// + const PacketView& ref() const { return *this; } + + ///@brief Returns a pointer to the underlying buffer. + /// This is technically the same as PacketRef::pointer but is writable. + uint8_t* buffer() { return mData; } + + ///@brief Returns a Span covering the entire buffer. + /// + microstrain::Span bufferSpan() { return microstrain::Span{buffer(), BufferSize}; } + + ///@brief Copies the data from the pointer to this buffer. The data is not inspected. + /// + ///@param data Pointer to the start of the packet. + ///@param length Total length of the packet. + /// + void copyFrom(const uint8_t* data, size_t length) { assert(length <= sizeof(mData)); std::memcpy(mData, data, length); } + + ///@brief Copies an existing packet. The packet is assumed to be valid (undefined behavior otherwise). + /// + ///@param packet A "sane" (isSane()) mip packet. + /// + void copyFrom(const PacketView& packet) { assert(packet.isSane()); copyFrom(packet.pointer(), packet.totalLength()); } + +private: + uint8_t mData[BufferSize]; +}; + +//////////////////////////////////////////////////////////////////////////////// +///@brief Typedef for SizedPacketBuf of max possible size. +/// +/// Generally you should use this instead of SizedPacketBuf directly, unless you +/// know the maximum size of your packet will be less than PACKET_LENGTH_MAX. +/// +typedef SizedPacketBuf PacketBuf; + + + +///@} +//////////////////////////////////////////////////////////////////////////////// +} // namespace mip diff --git a/src/cpp/mip/mip_parser.hpp b/src/cpp/mip/mip_parser.hpp new file mode 100644 index 000000000..f3bb86b1a --- /dev/null +++ b/src/cpp/mip/mip_parser.hpp @@ -0,0 +1,122 @@ +#pragma once + +#include "mip_packet.hpp" + +#include + + +namespace mip +{ +//////////////////////////////////////////////////////////////////////////////// +///@addtogroup mip_cpp +///@{ + +//////////////////////////////////////////////////////////////////////////////// +///@brief C++ class representing a MIP parser. +/// +/// See @ref parsing_packets +/// +class Parser : public C::mip_parser +{ +public: + ///@copydoc mip::C::mip_parser_init + Parser(uint8_t* buffer, size_t bufferSize, C::mip_packet_callback callback, void* callbackObject, Timeout timeout) { C::mip_parser_init(this, buffer, bufferSize, callback, callbackObject, timeout); } + ///@copydoc mip::C::mip_parser_init + Parser(uint8_t* buffer, size_t bufferSize, bool (*callback)(void*,const PacketView*,Timestamp), void* callbackObject, Timeout timeout) { C::mip_parser_init(this, buffer, bufferSize, (C::mip_packet_callback)callback, callbackObject, timeout); } + + Parser(uint8_t* buffer, size_t bufferSize, Timeout timeout) { C::mip_parser_init(this, buffer, bufferSize, nullptr, nullptr, timeout); } + + template + void setCallback(T& object); + + ///@copydoc mip::C::mip_parser_reset + void reset() { C::mip_parser_reset(this); } + + ///@copydoc mip::C::mip_parser_parse + size_t parse(const uint8_t* inputBuffer, size_t inputCount, Timestamp timestamp, unsigned int maxPackets=0) { return C::mip_parser_parse(this, inputBuffer, inputCount, timestamp, maxPackets); } + + ///@copydoc mip::C::mip_parser_timeout + Timeout timeout() const { return C::mip_parser_timeout(this); } + ///@copydoc mip::C::mip_parser_set_timeout + void setTimeout(Timeout timeout) { return C::mip_parser_set_timeout(this, timeout); } +}; + + +//////////////////////////////////////////////////////////////////////////////// +///@brief Initializes the MIP Parser +/// +/// This version allows binding a member function instead of a C-style callback. +/// Example: +///@code{.cpp} +/// struct MyClass +/// { +/// void handlePacket(const PacketRef& packet, Timeout timeout); +/// }; +/// MyClass myInstance; +/// Parser parser(myInstance); +///@endcode +/// +///@tparam T Class type containing the member function to be called. +///@tparam Callback A pointer to a member function on a T to be called when a +/// packet is parsed. +/// +///@param object +/// Instance of T to call the callback. +/// +template +void Parser::setCallback(T& object) +{ + C::mip_packet_callback callback = [](void* obj, const C::mip_packet_view* pkt, Timestamp timestamp)->bool + { + return (static_cast(obj)->*Callback)(PacketView(pkt), timestamp); + }; + + C::mip_parser_set_callback(this, callback, &object); +} + +//////////////////////////////////////////////////////////////////////////////// +///@brief Read data from a source into the internal parsing buffer. +/// +///@tparam Function +/// A function-like object with the following signature: +/// `bool read(size_t maxCount, size_t* count_out, Timestamp* timestamp_out);` +/// The parameters are as follows: +/// @li buffer - Buffer into which to write data. +/// @li maxCount - The maximum number of bytes to read. +/// @li count_out - Updated with the number of bytes actually read. +/// @li timestamp_out - Updated with the timestamp of the data. +/// +///@param parser +/// +///@param reader +/// A callback function, lambda, or similar which will read data into the +/// buffer and capture the timestamp. It should return true if successful +/// or false otherwise. If it returns false, parsing is skipped. The read +/// function may also throw an exception instead of returning false. +/// +///@param maxPackets +/// Maximum number of packets to parse, just like for Parser::parse(). +/// +///@return Same as the return value of reader. +/// +template +bool parseMipDataFromSource(C::mip_parser& parser, Function reader, size_t maxPackets) +{ + uint8_t* ptr; + size_t maxCount = C::mip_parser_get_write_ptr(&parser, &ptr); + + size_t count; + Timestamp timestamp; + if( !reader(ptr, maxCount, &count, ×tamp) ) + return false; + + assert(count <= maxCount); + + C::mip_parser_process_written(&parser, count, timestamp, maxPackets); + + return true; +} + +///@} +//////////////////////////////////////////////////////////////////////////////// +} // namespace mip diff --git a/src/mip/mip_result.h b/src/cpp/mip/mip_result.hpp similarity index 61% rename from src/mip/mip_result.h rename to src/cpp/mip/mip_result.hpp index c08dce000..886ae3faf 100644 --- a/src/mip/mip_result.h +++ b/src/cpp/mip/mip_result.hpp @@ -1,65 +1,10 @@ #pragma once -#include -#include +#include -#ifdef __cplusplus -namespace mip { -namespace C { -extern "C" { -#endif // __cplusplus - -//////////////////////////////////////////////////////////////////////////////// -///@addtogroup mip_c -///@{ - -//////////////////////////////////////////////////////////////////////////////// -///@brief Represents the status of a MIP command. -/// -/// Values that start with MIP_STATUS are status codes from this library. -/// Values that start with MIP_(N)ACK represent replies from the device. -/// Values at or below MIP_STATUS_USER_START (negative values) are reserved for -/// status codes from user code. -/// -typedef enum mip_cmd_result +namespace mip { - MIP_STATUS_USER_START = -10, ///< Values defined by user code must be less than or equal to this value. - - // Status codes < 0 - MIP_STATUS_ERROR = -6, ///< Command could not be executed (error sending/receiving) - MIP_STATUS_CANCELLED = -5, ///< Command was canceled in software. - MIP_STATUS_TIMEDOUT = -4, ///< Reply was not received before timeout expired. - MIP_STATUS_WAITING = -3, ///< Waiting for command reply (timeout timer has started). - MIP_STATUS_PENDING = -2, ///< Command has been queued but the I/O update hasn't run yet. - MIP_STATUS_NONE = -1, ///< Command has been initialized but not queued yet. - - // Device replies >= 0 - MIP_ACK_OK = 0x00, ///< Command completed successfully. - MIP_NACK_COMMAND_UNKNOWN = 0x01, ///< Command not supported. - MIP_NACK_INVALID_CHECKSUM = 0x02, ///< Reserved. - MIP_NACK_INVALID_PARAM = 0x03, ///< A parameter was not a supported value. - MIP_NACK_COMMAND_FAILED = 0x04, ///< The device could not complete the command. - MIP_NACK_COMMAND_TIMEOUT = 0x05, ///< Internal device timeout. Use MIP_STATUS_TIMEDOUT for command timeouts. -} mip_cmd_result; - -const char* mip_cmd_result_to_string(enum mip_cmd_result result); - -bool mip_cmd_result_is_finished(enum mip_cmd_result result); - -bool mip_cmd_result_is_reply(enum mip_cmd_result result); -bool mip_cmd_result_is_status(enum mip_cmd_result result); -bool mip_cmd_result_is_user(enum mip_cmd_result result); - -bool mip_cmd_result_is_ack(enum mip_cmd_result result); - -///@} -//////////////////////////////////////////////////////////////////////////////// - -#ifdef __cplusplus -} // extern "C" -} // namespace C - //////////////////////////////////////////////////////////////////////////////// ///@addtogroup mip_cpp ///@{ @@ -93,7 +38,7 @@ struct CmdResult static constexpr C::mip_cmd_result NACK_COMMAND_FAILED = C::MIP_NACK_COMMAND_FAILED; ///<@copydoc C::MIP_NACK_COMMAND_FAILED static constexpr C::mip_cmd_result NACK_COMMAND_TIMEOUT = C::MIP_NACK_COMMAND_TIMEOUT; ///<@copydoc C::MIP_NACK_COMMAND_TIMEOUT -#ifndef _WIN32 // Avoid name conflict with windows.h +#ifndef MICROSTRAIN_PLATFORM_WINDOWS // Avoid name conflict with windows.h static constexpr C::mip_cmd_result STATUS_PENDING = STATUS_QUEUED; #endif @@ -126,10 +71,6 @@ struct CmdResult bool isAck() const { return C::mip_cmd_result_is_ack(value); } }; -// using Ack = C::mip_ack; - ///@} //////////////////////////////////////////////////////////////////////////////// - } // namespace mip -#endif // __cplusplus diff --git a/src/cpp/mip/mip_serialization.hpp b/src/cpp/mip/mip_serialization.hpp new file mode 100644 index 000000000..002c26cd4 --- /dev/null +++ b/src/cpp/mip/mip_serialization.hpp @@ -0,0 +1,43 @@ +#pragma once + +#include + +#include +#include + + +namespace mip +{ + +using Serializer = microstrain::BigEndianSerializer; + +namespace serialization +{ + using namespace microstrain::serialization; + using namespace microstrain::serialization::big_endian; + +} // namespace serialization + +using microstrain::insert; +using microstrain::extract; + +// Explicitly overload insert/extract versions that take raw buffers +// since the endianness can't be deduced from the arguments. + +template +inline bool extract(T& object, const uint8_t* buffer, size_t bufferLength, size_t offset=0, bool exactSize=false) +{ + using namespace microstrain::serialization; + return extract(object, buffer, bufferLength, offset, exactSize); +} + +template +inline bool insert(const T& object, uint8_t* buffer, size_t bufferLength, size_t offset=0) +{ + using namespace microstrain::serialization; + return insert(object, buffer, bufferLength, offset); +} + + +} // namespace mip + diff --git a/src/mip/definitions/commands_3dm.c b/src/mip/definitions/commands_3dm.c deleted file mode 100644 index 8e5708e96..000000000 --- a/src/mip/definitions/commands_3dm.c +++ /dev/null @@ -1,5277 +0,0 @@ - -#include "commands_3dm.h" - -#include "../utils/serialization.h" -#include "../mip_interface.h" - -#include - - -#ifdef __cplusplus -namespace mip { -namespace C { -extern "C" { - -#endif // __cplusplus -struct mip_interface; -struct mip_serializer; -struct mip_field; - - -//////////////////////////////////////////////////////////////////////////////// -// Shared Type Definitions -//////////////////////////////////////////////////////////////////////////////// - -void insert_mip_nmea_message(mip_serializer* serializer, const mip_nmea_message* self) -{ - insert_mip_nmea_message_message_id(serializer, self->message_id); - - insert_mip_nmea_message_talker_id(serializer, self->talker_id); - - insert_u8(serializer, self->source_desc_set); - - insert_u16(serializer, self->decimation); - -} -void extract_mip_nmea_message(mip_serializer* serializer, mip_nmea_message* self) -{ - extract_mip_nmea_message_message_id(serializer, &self->message_id); - - extract_mip_nmea_message_talker_id(serializer, &self->talker_id); - - extract_u8(serializer, &self->source_desc_set); - - extract_u16(serializer, &self->decimation); - -} - -void insert_mip_nmea_message_message_id(struct mip_serializer* serializer, const mip_nmea_message_message_id self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_nmea_message_message_id(struct mip_serializer* serializer, mip_nmea_message_message_id* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -void insert_mip_nmea_message_talker_id(struct mip_serializer* serializer, const mip_nmea_message_talker_id self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_nmea_message_talker_id(struct mip_serializer* serializer, mip_nmea_message_talker_id* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -void insert_mip_sensor_range_type(struct mip_serializer* serializer, const mip_sensor_range_type self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_sensor_range_type(struct mip_serializer* serializer, mip_sensor_range_type* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - - -//////////////////////////////////////////////////////////////////////////////// -// Mip Fields -//////////////////////////////////////////////////////////////////////////////// - -void insert_mip_3dm_poll_imu_message_command(mip_serializer* serializer, const mip_3dm_poll_imu_message_command* self) -{ - insert_bool(serializer, self->suppress_ack); - - insert_u8(serializer, self->num_descriptors); - - - for(unsigned int i=0; i < self->num_descriptors; i++) - insert_mip_descriptor_rate(serializer, &self->descriptors[i]); - -} -void extract_mip_3dm_poll_imu_message_command(mip_serializer* serializer, mip_3dm_poll_imu_message_command* self) -{ - extract_bool(serializer, &self->suppress_ack); - - assert(self->num_descriptors); - extract_count(serializer, &self->num_descriptors, sizeof(self->descriptors)/sizeof(self->descriptors[0])); - - for(unsigned int i=0; i < self->num_descriptors; i++) - extract_mip_descriptor_rate(serializer, &self->descriptors[i]); - -} - -mip_cmd_result mip_3dm_poll_imu_message(struct mip_interface* device, bool suppress_ack, uint8_t num_descriptors, const mip_descriptor_rate* descriptors) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_bool(&serializer, suppress_ack); - - insert_u8(&serializer, num_descriptors); - - assert(descriptors || (num_descriptors == 0)); - for(unsigned int i=0; i < num_descriptors; i++) - insert_mip_descriptor_rate(&serializer, &descriptors[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_POLL_IMU_MESSAGE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_3dm_poll_gnss_message_command(mip_serializer* serializer, const mip_3dm_poll_gnss_message_command* self) -{ - insert_bool(serializer, self->suppress_ack); - - insert_u8(serializer, self->num_descriptors); - - - for(unsigned int i=0; i < self->num_descriptors; i++) - insert_mip_descriptor_rate(serializer, &self->descriptors[i]); - -} -void extract_mip_3dm_poll_gnss_message_command(mip_serializer* serializer, mip_3dm_poll_gnss_message_command* self) -{ - extract_bool(serializer, &self->suppress_ack); - - assert(self->num_descriptors); - extract_count(serializer, &self->num_descriptors, sizeof(self->descriptors)/sizeof(self->descriptors[0])); - - for(unsigned int i=0; i < self->num_descriptors; i++) - extract_mip_descriptor_rate(serializer, &self->descriptors[i]); - -} - -mip_cmd_result mip_3dm_poll_gnss_message(struct mip_interface* device, bool suppress_ack, uint8_t num_descriptors, const mip_descriptor_rate* descriptors) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_bool(&serializer, suppress_ack); - - insert_u8(&serializer, num_descriptors); - - assert(descriptors || (num_descriptors == 0)); - for(unsigned int i=0; i < num_descriptors; i++) - insert_mip_descriptor_rate(&serializer, &descriptors[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_POLL_GNSS_MESSAGE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_3dm_poll_filter_message_command(mip_serializer* serializer, const mip_3dm_poll_filter_message_command* self) -{ - insert_bool(serializer, self->suppress_ack); - - insert_u8(serializer, self->num_descriptors); - - - for(unsigned int i=0; i < self->num_descriptors; i++) - insert_mip_descriptor_rate(serializer, &self->descriptors[i]); - -} -void extract_mip_3dm_poll_filter_message_command(mip_serializer* serializer, mip_3dm_poll_filter_message_command* self) -{ - extract_bool(serializer, &self->suppress_ack); - - assert(self->num_descriptors); - extract_count(serializer, &self->num_descriptors, sizeof(self->descriptors)/sizeof(self->descriptors[0])); - - for(unsigned int i=0; i < self->num_descriptors; i++) - extract_mip_descriptor_rate(serializer, &self->descriptors[i]); - -} - -mip_cmd_result mip_3dm_poll_filter_message(struct mip_interface* device, bool suppress_ack, uint8_t num_descriptors, const mip_descriptor_rate* descriptors) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_bool(&serializer, suppress_ack); - - insert_u8(&serializer, num_descriptors); - - assert(descriptors || (num_descriptors == 0)); - for(unsigned int i=0; i < num_descriptors; i++) - insert_mip_descriptor_rate(&serializer, &descriptors[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_POLL_FILTER_MESSAGE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_3dm_imu_message_format_command(mip_serializer* serializer, const mip_3dm_imu_message_format_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_u8(serializer, self->num_descriptors); - - - for(unsigned int i=0; i < self->num_descriptors; i++) - insert_mip_descriptor_rate(serializer, &self->descriptors[i]); - - } -} -void extract_mip_3dm_imu_message_format_command(mip_serializer* serializer, mip_3dm_imu_message_format_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - assert(self->num_descriptors); - extract_count(serializer, &self->num_descriptors, sizeof(self->descriptors)/sizeof(self->descriptors[0])); - - for(unsigned int i=0; i < self->num_descriptors; i++) - extract_mip_descriptor_rate(serializer, &self->descriptors[i]); - - } -} - -void insert_mip_3dm_imu_message_format_response(mip_serializer* serializer, const mip_3dm_imu_message_format_response* self) -{ - insert_u8(serializer, self->num_descriptors); - - - for(unsigned int i=0; i < self->num_descriptors; i++) - insert_mip_descriptor_rate(serializer, &self->descriptors[i]); - -} -void extract_mip_3dm_imu_message_format_response(mip_serializer* serializer, mip_3dm_imu_message_format_response* self) -{ - assert(self->num_descriptors); - extract_count(serializer, &self->num_descriptors, sizeof(self->descriptors)/sizeof(self->descriptors[0])); - - for(unsigned int i=0; i < self->num_descriptors; i++) - extract_mip_descriptor_rate(serializer, &self->descriptors[i]); - -} - -mip_cmd_result mip_3dm_write_imu_message_format(struct mip_interface* device, uint8_t num_descriptors, const mip_descriptor_rate* descriptors) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_u8(&serializer, num_descriptors); - - assert(descriptors || (num_descriptors == 0)); - for(unsigned int i=0; i < num_descriptors; i++) - insert_mip_descriptor_rate(&serializer, &descriptors[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_IMU_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_read_imu_message_format(struct mip_interface* device, uint8_t* num_descriptors_out, uint8_t num_descriptors_out_max, mip_descriptor_rate* descriptors_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_IMU_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_IMU_MESSAGE_FORMAT, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(num_descriptors_out); - extract_count(&deserializer, num_descriptors_out, num_descriptors_out_max); - - assert(descriptors_out || (num_descriptors_out == 0)); - for(unsigned int i=0; i < *num_descriptors_out; i++) - extract_mip_descriptor_rate(&deserializer, &descriptors_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_3dm_save_imu_message_format(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_IMU_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_load_imu_message_format(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_IMU_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_default_imu_message_format(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_IMU_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_3dm_gps_message_format_command(mip_serializer* serializer, const mip_3dm_gps_message_format_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_u8(serializer, self->num_descriptors); - - - for(unsigned int i=0; i < self->num_descriptors; i++) - insert_mip_descriptor_rate(serializer, &self->descriptors[i]); - - } -} -void extract_mip_3dm_gps_message_format_command(mip_serializer* serializer, mip_3dm_gps_message_format_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - assert(self->num_descriptors); - extract_count(serializer, &self->num_descriptors, sizeof(self->descriptors)/sizeof(self->descriptors[0])); - - for(unsigned int i=0; i < self->num_descriptors; i++) - extract_mip_descriptor_rate(serializer, &self->descriptors[i]); - - } -} - -void insert_mip_3dm_gps_message_format_response(mip_serializer* serializer, const mip_3dm_gps_message_format_response* self) -{ - insert_u8(serializer, self->num_descriptors); - - - for(unsigned int i=0; i < self->num_descriptors; i++) - insert_mip_descriptor_rate(serializer, &self->descriptors[i]); - -} -void extract_mip_3dm_gps_message_format_response(mip_serializer* serializer, mip_3dm_gps_message_format_response* self) -{ - assert(self->num_descriptors); - extract_count(serializer, &self->num_descriptors, sizeof(self->descriptors)/sizeof(self->descriptors[0])); - - for(unsigned int i=0; i < self->num_descriptors; i++) - extract_mip_descriptor_rate(serializer, &self->descriptors[i]); - -} - -mip_cmd_result mip_3dm_write_gps_message_format(struct mip_interface* device, uint8_t num_descriptors, const mip_descriptor_rate* descriptors) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_u8(&serializer, num_descriptors); - - assert(descriptors || (num_descriptors == 0)); - for(unsigned int i=0; i < num_descriptors; i++) - insert_mip_descriptor_rate(&serializer, &descriptors[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_read_gps_message_format(struct mip_interface* device, uint8_t* num_descriptors_out, uint8_t num_descriptors_out_max, mip_descriptor_rate* descriptors_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_GNSS_MESSAGE_FORMAT, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(num_descriptors_out); - extract_count(&deserializer, num_descriptors_out, num_descriptors_out_max); - - assert(descriptors_out || (num_descriptors_out == 0)); - for(unsigned int i=0; i < *num_descriptors_out; i++) - extract_mip_descriptor_rate(&deserializer, &descriptors_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_3dm_save_gps_message_format(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_load_gps_message_format(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_default_gps_message_format(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_3dm_filter_message_format_command(mip_serializer* serializer, const mip_3dm_filter_message_format_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_u8(serializer, self->num_descriptors); - - - for(unsigned int i=0; i < self->num_descriptors; i++) - insert_mip_descriptor_rate(serializer, &self->descriptors[i]); - - } -} -void extract_mip_3dm_filter_message_format_command(mip_serializer* serializer, mip_3dm_filter_message_format_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - assert(self->num_descriptors); - extract_count(serializer, &self->num_descriptors, sizeof(self->descriptors)/sizeof(self->descriptors[0])); - - for(unsigned int i=0; i < self->num_descriptors; i++) - extract_mip_descriptor_rate(serializer, &self->descriptors[i]); - - } -} - -void insert_mip_3dm_filter_message_format_response(mip_serializer* serializer, const mip_3dm_filter_message_format_response* self) -{ - insert_u8(serializer, self->num_descriptors); - - - for(unsigned int i=0; i < self->num_descriptors; i++) - insert_mip_descriptor_rate(serializer, &self->descriptors[i]); - -} -void extract_mip_3dm_filter_message_format_response(mip_serializer* serializer, mip_3dm_filter_message_format_response* self) -{ - assert(self->num_descriptors); - extract_count(serializer, &self->num_descriptors, sizeof(self->descriptors)/sizeof(self->descriptors[0])); - - for(unsigned int i=0; i < self->num_descriptors; i++) - extract_mip_descriptor_rate(serializer, &self->descriptors[i]); - -} - -mip_cmd_result mip_3dm_write_filter_message_format(struct mip_interface* device, uint8_t num_descriptors, const mip_descriptor_rate* descriptors) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_u8(&serializer, num_descriptors); - - assert(descriptors || (num_descriptors == 0)); - for(unsigned int i=0; i < num_descriptors; i++) - insert_mip_descriptor_rate(&serializer, &descriptors[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_FILTER_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_read_filter_message_format(struct mip_interface* device, uint8_t* num_descriptors_out, uint8_t num_descriptors_out_max, mip_descriptor_rate* descriptors_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_FILTER_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_FILTER_MESSAGE_FORMAT, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(num_descriptors_out); - extract_count(&deserializer, num_descriptors_out, num_descriptors_out_max); - - assert(descriptors_out || (num_descriptors_out == 0)); - for(unsigned int i=0; i < *num_descriptors_out; i++) - extract_mip_descriptor_rate(&deserializer, &descriptors_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_3dm_save_filter_message_format(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_FILTER_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_load_filter_message_format(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_FILTER_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_default_filter_message_format(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_FILTER_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_imu_get_base_rate(struct mip_interface* device, uint16_t* rate_out) -{ - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - uint8_t responseLength = sizeof(buffer); - - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GET_IMU_BASE_RATE, NULL, 0, MIP_REPLY_DESC_3DM_IMU_BASE_RATE, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(rate_out); - extract_u16(&deserializer, rate_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_3dm_gps_get_base_rate(struct mip_interface* device, uint16_t* rate_out) -{ - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - uint8_t responseLength = sizeof(buffer); - - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GET_GNSS_BASE_RATE, NULL, 0, MIP_REPLY_DESC_3DM_GNSS_BASE_RATE, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(rate_out); - extract_u16(&deserializer, rate_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_3dm_filter_get_base_rate(struct mip_interface* device, uint16_t* rate_out) -{ - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - uint8_t responseLength = sizeof(buffer); - - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GET_FILTER_BASE_RATE, NULL, 0, MIP_REPLY_DESC_3DM_FILTER_BASE_RATE, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(rate_out); - extract_u16(&deserializer, rate_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -void insert_mip_3dm_poll_data_command(mip_serializer* serializer, const mip_3dm_poll_data_command* self) -{ - insert_u8(serializer, self->desc_set); - - insert_bool(serializer, self->suppress_ack); - - insert_u8(serializer, self->num_descriptors); - - - for(unsigned int i=0; i < self->num_descriptors; i++) - insert_u8(serializer, self->descriptors[i]); - -} -void extract_mip_3dm_poll_data_command(mip_serializer* serializer, mip_3dm_poll_data_command* self) -{ - extract_u8(serializer, &self->desc_set); - - extract_bool(serializer, &self->suppress_ack); - - assert(self->num_descriptors); - extract_count(serializer, &self->num_descriptors, sizeof(self->descriptors)/sizeof(self->descriptors[0])); - - for(unsigned int i=0; i < self->num_descriptors; i++) - extract_u8(serializer, &self->descriptors[i]); - -} - -mip_cmd_result mip_3dm_poll_data(struct mip_interface* device, uint8_t desc_set, bool suppress_ack, uint8_t num_descriptors, const uint8_t* descriptors) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_u8(&serializer, desc_set); - - insert_bool(&serializer, suppress_ack); - - insert_u8(&serializer, num_descriptors); - - assert(descriptors || (num_descriptors == 0)); - for(unsigned int i=0; i < num_descriptors; i++) - insert_u8(&serializer, descriptors[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_POLL_DATA, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_3dm_get_base_rate_command(mip_serializer* serializer, const mip_3dm_get_base_rate_command* self) -{ - insert_u8(serializer, self->desc_set); - -} -void extract_mip_3dm_get_base_rate_command(mip_serializer* serializer, mip_3dm_get_base_rate_command* self) -{ - extract_u8(serializer, &self->desc_set); - -} - -void insert_mip_3dm_get_base_rate_response(mip_serializer* serializer, const mip_3dm_get_base_rate_response* self) -{ - insert_u8(serializer, self->desc_set); - - insert_u16(serializer, self->rate); - -} -void extract_mip_3dm_get_base_rate_response(mip_serializer* serializer, mip_3dm_get_base_rate_response* self) -{ - extract_u8(serializer, &self->desc_set); - - extract_u16(serializer, &self->rate); - -} - -mip_cmd_result mip_3dm_get_base_rate(struct mip_interface* device, uint8_t desc_set, uint16_t* rate_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_u8(&serializer, desc_set); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GET_BASE_RATE, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_BASE_RATE, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - extract_u8(&deserializer, &desc_set); - - assert(rate_out); - extract_u16(&deserializer, rate_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -void insert_mip_3dm_message_format_command(mip_serializer* serializer, const mip_3dm_message_format_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - insert_u8(serializer, self->desc_set); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_u8(serializer, self->num_descriptors); - - - for(unsigned int i=0; i < self->num_descriptors; i++) - insert_mip_descriptor_rate(serializer, &self->descriptors[i]); - - } -} -void extract_mip_3dm_message_format_command(mip_serializer* serializer, mip_3dm_message_format_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - extract_u8(serializer, &self->desc_set); - - if( self->function == MIP_FUNCTION_WRITE ) - { - assert(self->num_descriptors); - extract_count(serializer, &self->num_descriptors, sizeof(self->descriptors)/sizeof(self->descriptors[0])); - - for(unsigned int i=0; i < self->num_descriptors; i++) - extract_mip_descriptor_rate(serializer, &self->descriptors[i]); - - } -} - -void insert_mip_3dm_message_format_response(mip_serializer* serializer, const mip_3dm_message_format_response* self) -{ - insert_u8(serializer, self->desc_set); - - insert_u8(serializer, self->num_descriptors); - - - for(unsigned int i=0; i < self->num_descriptors; i++) - insert_mip_descriptor_rate(serializer, &self->descriptors[i]); - -} -void extract_mip_3dm_message_format_response(mip_serializer* serializer, mip_3dm_message_format_response* self) -{ - extract_u8(serializer, &self->desc_set); - - assert(self->num_descriptors); - extract_count(serializer, &self->num_descriptors, sizeof(self->descriptors)/sizeof(self->descriptors[0])); - - for(unsigned int i=0; i < self->num_descriptors; i++) - extract_mip_descriptor_rate(serializer, &self->descriptors[i]); - -} - -mip_cmd_result mip_3dm_write_message_format(struct mip_interface* device, uint8_t desc_set, uint8_t num_descriptors, const mip_descriptor_rate* descriptors) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_u8(&serializer, desc_set); - - insert_u8(&serializer, num_descriptors); - - assert(descriptors || (num_descriptors == 0)); - for(unsigned int i=0; i < num_descriptors; i++) - insert_mip_descriptor_rate(&serializer, &descriptors[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_read_message_format(struct mip_interface* device, uint8_t desc_set, uint8_t* num_descriptors_out, uint8_t num_descriptors_out_max, mip_descriptor_rate* descriptors_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - insert_u8(&serializer, desc_set); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_MESSAGE_FORMAT, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - extract_u8(&deserializer, &desc_set); - - assert(num_descriptors_out); - extract_count(&deserializer, num_descriptors_out, num_descriptors_out_max); - - assert(descriptors_out || (num_descriptors_out == 0)); - for(unsigned int i=0; i < *num_descriptors_out; i++) - extract_mip_descriptor_rate(&deserializer, &descriptors_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_3dm_save_message_format(struct mip_interface* device, uint8_t desc_set) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - insert_u8(&serializer, desc_set); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_load_message_format(struct mip_interface* device, uint8_t desc_set) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - insert_u8(&serializer, desc_set); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_default_message_format(struct mip_interface* device, uint8_t desc_set) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - insert_u8(&serializer, desc_set); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_3dm_nmea_poll_data_command(mip_serializer* serializer, const mip_3dm_nmea_poll_data_command* self) -{ - insert_bool(serializer, self->suppress_ack); - - insert_u8(serializer, self->count); - - - for(unsigned int i=0; i < self->count; i++) - insert_mip_nmea_message(serializer, &self->format_entries[i]); - -} -void extract_mip_3dm_nmea_poll_data_command(mip_serializer* serializer, mip_3dm_nmea_poll_data_command* self) -{ - extract_bool(serializer, &self->suppress_ack); - - assert(self->count); - extract_count(serializer, &self->count, sizeof(self->format_entries)/sizeof(self->format_entries[0])); - - for(unsigned int i=0; i < self->count; i++) - extract_mip_nmea_message(serializer, &self->format_entries[i]); - -} - -mip_cmd_result mip_3dm_nmea_poll_data(struct mip_interface* device, bool suppress_ack, uint8_t count, const mip_nmea_message* format_entries) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_bool(&serializer, suppress_ack); - - insert_u8(&serializer, count); - - assert(format_entries || (count == 0)); - for(unsigned int i=0; i < count; i++) - insert_mip_nmea_message(&serializer, &format_entries[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_POLL_NMEA_MESSAGE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_3dm_nmea_message_format_command(mip_serializer* serializer, const mip_3dm_nmea_message_format_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_u8(serializer, self->count); - - - for(unsigned int i=0; i < self->count; i++) - insert_mip_nmea_message(serializer, &self->format_entries[i]); - - } -} -void extract_mip_3dm_nmea_message_format_command(mip_serializer* serializer, mip_3dm_nmea_message_format_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - assert(self->count); - extract_count(serializer, &self->count, sizeof(self->format_entries)/sizeof(self->format_entries[0])); - - for(unsigned int i=0; i < self->count; i++) - extract_mip_nmea_message(serializer, &self->format_entries[i]); - - } -} - -void insert_mip_3dm_nmea_message_format_response(mip_serializer* serializer, const mip_3dm_nmea_message_format_response* self) -{ - insert_u8(serializer, self->count); - - - for(unsigned int i=0; i < self->count; i++) - insert_mip_nmea_message(serializer, &self->format_entries[i]); - -} -void extract_mip_3dm_nmea_message_format_response(mip_serializer* serializer, mip_3dm_nmea_message_format_response* self) -{ - assert(self->count); - extract_count(serializer, &self->count, sizeof(self->format_entries)/sizeof(self->format_entries[0])); - - for(unsigned int i=0; i < self->count; i++) - extract_mip_nmea_message(serializer, &self->format_entries[i]); - -} - -mip_cmd_result mip_3dm_write_nmea_message_format(struct mip_interface* device, uint8_t count, const mip_nmea_message* format_entries) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_u8(&serializer, count); - - assert(format_entries || (count == 0)); - for(unsigned int i=0; i < count; i++) - insert_mip_nmea_message(&serializer, &format_entries[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_NMEA_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_read_nmea_message_format(struct mip_interface* device, uint8_t* count_out, uint8_t count_out_max, mip_nmea_message* format_entries_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_NMEA_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_NMEA_MESSAGE_FORMAT, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(count_out); - extract_count(&deserializer, count_out, count_out_max); - - assert(format_entries_out || (count_out == 0)); - for(unsigned int i=0; i < *count_out; i++) - extract_mip_nmea_message(&deserializer, &format_entries_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_3dm_save_nmea_message_format(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_NMEA_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_load_nmea_message_format(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_NMEA_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_default_nmea_message_format(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_NMEA_MESSAGE_FORMAT, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_3dm_device_settings_command(mip_serializer* serializer, const mip_3dm_device_settings_command* self) -{ - insert_mip_function_selector(serializer, self->function); - -} -void extract_mip_3dm_device_settings_command(mip_serializer* serializer, mip_3dm_device_settings_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - -} - -mip_cmd_result mip_3dm_save_device_settings(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_DEVICE_STARTUP_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_load_device_settings(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_DEVICE_STARTUP_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_default_device_settings(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_DEVICE_STARTUP_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_3dm_uart_baudrate_command(mip_serializer* serializer, const mip_3dm_uart_baudrate_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_u32(serializer, self->baud); - - } -} -void extract_mip_3dm_uart_baudrate_command(mip_serializer* serializer, mip_3dm_uart_baudrate_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_u32(serializer, &self->baud); - - } -} - -void insert_mip_3dm_uart_baudrate_response(mip_serializer* serializer, const mip_3dm_uart_baudrate_response* self) -{ - insert_u32(serializer, self->baud); - -} -void extract_mip_3dm_uart_baudrate_response(mip_serializer* serializer, mip_3dm_uart_baudrate_response* self) -{ - extract_u32(serializer, &self->baud); - -} - -mip_cmd_result mip_3dm_write_uart_baudrate(struct mip_interface* device, uint32_t baud) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_u32(&serializer, baud); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_UART_BAUDRATE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_read_uart_baudrate(struct mip_interface* device, uint32_t* baud_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_UART_BAUDRATE, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_UART_BAUDRATE, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(baud_out); - extract_u32(&deserializer, baud_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_3dm_save_uart_baudrate(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_UART_BAUDRATE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_load_uart_baudrate(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_UART_BAUDRATE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_default_uart_baudrate(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_UART_BAUDRATE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_3dm_factory_streaming_command(mip_serializer* serializer, const mip_3dm_factory_streaming_command* self) -{ - insert_mip_3dm_factory_streaming_command_action(serializer, self->action); - - insert_u8(serializer, self->reserved); - -} -void extract_mip_3dm_factory_streaming_command(mip_serializer* serializer, mip_3dm_factory_streaming_command* self) -{ - extract_mip_3dm_factory_streaming_command_action(serializer, &self->action); - - extract_u8(serializer, &self->reserved); - -} - -void insert_mip_3dm_factory_streaming_command_action(struct mip_serializer* serializer, const mip_3dm_factory_streaming_command_action self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_3dm_factory_streaming_command_action(struct mip_serializer* serializer, mip_3dm_factory_streaming_command_action* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -mip_cmd_result mip_3dm_factory_streaming(struct mip_interface* device, mip_3dm_factory_streaming_command_action action, uint8_t reserved) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_3dm_factory_streaming_command_action(&serializer, action); - - insert_u8(&serializer, reserved); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_CONFIGURE_FACTORY_STREAMING, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_3dm_datastream_control_command(mip_serializer* serializer, const mip_3dm_datastream_control_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - insert_u8(serializer, self->desc_set); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_bool(serializer, self->enable); - - } -} -void extract_mip_3dm_datastream_control_command(mip_serializer* serializer, mip_3dm_datastream_control_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - extract_u8(serializer, &self->desc_set); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_bool(serializer, &self->enable); - - } -} - -void insert_mip_3dm_datastream_control_response(mip_serializer* serializer, const mip_3dm_datastream_control_response* self) -{ - insert_u8(serializer, self->desc_set); - - insert_bool(serializer, self->enabled); - -} -void extract_mip_3dm_datastream_control_response(mip_serializer* serializer, mip_3dm_datastream_control_response* self) -{ - extract_u8(serializer, &self->desc_set); - - extract_bool(serializer, &self->enabled); - -} - -mip_cmd_result mip_3dm_write_datastream_control(struct mip_interface* device, uint8_t desc_set, bool enable) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_u8(&serializer, desc_set); - - insert_bool(&serializer, enable); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_CONTROL_DATA_STREAM, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_read_datastream_control(struct mip_interface* device, uint8_t desc_set, bool* enabled_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - insert_u8(&serializer, desc_set); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_CONTROL_DATA_STREAM, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_DATASTREAM_ENABLE, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - extract_u8(&deserializer, &desc_set); - - assert(enabled_out); - extract_bool(&deserializer, enabled_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_3dm_save_datastream_control(struct mip_interface* device, uint8_t desc_set) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - insert_u8(&serializer, desc_set); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_CONTROL_DATA_STREAM, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_load_datastream_control(struct mip_interface* device, uint8_t desc_set) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - insert_u8(&serializer, desc_set); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_CONTROL_DATA_STREAM, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_default_datastream_control(struct mip_interface* device, uint8_t desc_set) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - insert_u8(&serializer, desc_set); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_CONTROL_DATA_STREAM, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_3dm_constellation_settings_command(mip_serializer* serializer, const mip_3dm_constellation_settings_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_u16(serializer, self->max_channels); - - insert_u8(serializer, self->config_count); - - - for(unsigned int i=0; i < self->config_count; i++) - insert_mip_3dm_constellation_settings_command_settings(serializer, &self->settings[i]); - - } -} -void extract_mip_3dm_constellation_settings_command(mip_serializer* serializer, mip_3dm_constellation_settings_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_u16(serializer, &self->max_channels); - - assert(self->config_count); - extract_count(serializer, &self->config_count, sizeof(self->settings)/sizeof(self->settings[0])); - - for(unsigned int i=0; i < self->config_count; i++) - extract_mip_3dm_constellation_settings_command_settings(serializer, &self->settings[i]); - - } -} - -void insert_mip_3dm_constellation_settings_response(mip_serializer* serializer, const mip_3dm_constellation_settings_response* self) -{ - insert_u16(serializer, self->max_channels_available); - - insert_u16(serializer, self->max_channels_use); - - insert_u8(serializer, self->config_count); - - - for(unsigned int i=0; i < self->config_count; i++) - insert_mip_3dm_constellation_settings_command_settings(serializer, &self->settings[i]); - -} -void extract_mip_3dm_constellation_settings_response(mip_serializer* serializer, mip_3dm_constellation_settings_response* self) -{ - extract_u16(serializer, &self->max_channels_available); - - extract_u16(serializer, &self->max_channels_use); - - assert(self->config_count); - extract_count(serializer, &self->config_count, sizeof(self->settings)/sizeof(self->settings[0])); - - for(unsigned int i=0; i < self->config_count; i++) - extract_mip_3dm_constellation_settings_command_settings(serializer, &self->settings[i]); - -} - -void insert_mip_3dm_constellation_settings_command_constellation_id(struct mip_serializer* serializer, const mip_3dm_constellation_settings_command_constellation_id self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_3dm_constellation_settings_command_constellation_id(struct mip_serializer* serializer, mip_3dm_constellation_settings_command_constellation_id* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -void insert_mip_3dm_constellation_settings_command_option_flags(struct mip_serializer* serializer, const mip_3dm_constellation_settings_command_option_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_3dm_constellation_settings_command_option_flags(struct mip_serializer* serializer, mip_3dm_constellation_settings_command_option_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_3dm_constellation_settings_command_settings(mip_serializer* serializer, const mip_3dm_constellation_settings_command_settings* self) -{ - insert_mip_3dm_constellation_settings_command_constellation_id(serializer, self->constellation_id); - - insert_u8(serializer, self->enable); - - insert_u8(serializer, self->reserved_channels); - - insert_u8(serializer, self->max_channels); - - insert_mip_3dm_constellation_settings_command_option_flags(serializer, self->option_flags); - -} -void extract_mip_3dm_constellation_settings_command_settings(mip_serializer* serializer, mip_3dm_constellation_settings_command_settings* self) -{ - extract_mip_3dm_constellation_settings_command_constellation_id(serializer, &self->constellation_id); - - extract_u8(serializer, &self->enable); - - extract_u8(serializer, &self->reserved_channels); - - extract_u8(serializer, &self->max_channels); - - extract_mip_3dm_constellation_settings_command_option_flags(serializer, &self->option_flags); - -} - -mip_cmd_result mip_3dm_write_constellation_settings(struct mip_interface* device, uint16_t max_channels, uint8_t config_count, const mip_3dm_constellation_settings_command_settings* settings) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_u16(&serializer, max_channels); - - insert_u8(&serializer, config_count); - - assert(settings || (config_count == 0)); - for(unsigned int i=0; i < config_count; i++) - insert_mip_3dm_constellation_settings_command_settings(&serializer, &settings[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_CONSTELLATION_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_read_constellation_settings(struct mip_interface* device, uint16_t* max_channels_available_out, uint16_t* max_channels_use_out, uint8_t* config_count_out, uint8_t config_count_out_max, mip_3dm_constellation_settings_command_settings* settings_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_CONSTELLATION_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_GNSS_CONSTELLATION_SETTINGS, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(max_channels_available_out); - extract_u16(&deserializer, max_channels_available_out); - - assert(max_channels_use_out); - extract_u16(&deserializer, max_channels_use_out); - - assert(config_count_out); - extract_count(&deserializer, config_count_out, config_count_out_max); - - assert(settings_out || (config_count_out == 0)); - for(unsigned int i=0; i < *config_count_out; i++) - extract_mip_3dm_constellation_settings_command_settings(&deserializer, &settings_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_3dm_save_constellation_settings(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_CONSTELLATION_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_load_constellation_settings(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_CONSTELLATION_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_default_constellation_settings(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_CONSTELLATION_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_3dm_gnss_sbas_settings_command(mip_serializer* serializer, const mip_3dm_gnss_sbas_settings_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_u8(serializer, self->enable_sbas); - - insert_mip_3dm_gnss_sbas_settings_command_sbasoptions(serializer, self->sbas_options); - - insert_u8(serializer, self->num_included_prns); - - - for(unsigned int i=0; i < self->num_included_prns; i++) - insert_u16(serializer, self->included_prns[i]); - - } -} -void extract_mip_3dm_gnss_sbas_settings_command(mip_serializer* serializer, mip_3dm_gnss_sbas_settings_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_u8(serializer, &self->enable_sbas); - - extract_mip_3dm_gnss_sbas_settings_command_sbasoptions(serializer, &self->sbas_options); - - assert(self->num_included_prns); - extract_count(serializer, &self->num_included_prns, sizeof(self->included_prns)/sizeof(self->included_prns[0])); - - for(unsigned int i=0; i < self->num_included_prns; i++) - extract_u16(serializer, &self->included_prns[i]); - - } -} - -void insert_mip_3dm_gnss_sbas_settings_response(mip_serializer* serializer, const mip_3dm_gnss_sbas_settings_response* self) -{ - insert_u8(serializer, self->enable_sbas); - - insert_mip_3dm_gnss_sbas_settings_command_sbasoptions(serializer, self->sbas_options); - - insert_u8(serializer, self->num_included_prns); - - - for(unsigned int i=0; i < self->num_included_prns; i++) - insert_u16(serializer, self->included_prns[i]); - -} -void extract_mip_3dm_gnss_sbas_settings_response(mip_serializer* serializer, mip_3dm_gnss_sbas_settings_response* self) -{ - extract_u8(serializer, &self->enable_sbas); - - extract_mip_3dm_gnss_sbas_settings_command_sbasoptions(serializer, &self->sbas_options); - - assert(self->num_included_prns); - extract_count(serializer, &self->num_included_prns, sizeof(self->included_prns)/sizeof(self->included_prns[0])); - - for(unsigned int i=0; i < self->num_included_prns; i++) - extract_u16(serializer, &self->included_prns[i]); - -} - -void insert_mip_3dm_gnss_sbas_settings_command_sbasoptions(struct mip_serializer* serializer, const mip_3dm_gnss_sbas_settings_command_sbasoptions self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_3dm_gnss_sbas_settings_command_sbasoptions(struct mip_serializer* serializer, mip_3dm_gnss_sbas_settings_command_sbasoptions* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -mip_cmd_result mip_3dm_write_gnss_sbas_settings(struct mip_interface* device, uint8_t enable_sbas, mip_3dm_gnss_sbas_settings_command_sbasoptions sbas_options, uint8_t num_included_prns, const uint16_t* included_prns) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_u8(&serializer, enable_sbas); - - insert_mip_3dm_gnss_sbas_settings_command_sbasoptions(&serializer, sbas_options); - - insert_u8(&serializer, num_included_prns); - - assert(included_prns || (num_included_prns == 0)); - for(unsigned int i=0; i < num_included_prns; i++) - insert_u16(&serializer, included_prns[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_SBAS_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_read_gnss_sbas_settings(struct mip_interface* device, uint8_t* enable_sbas_out, mip_3dm_gnss_sbas_settings_command_sbasoptions* sbas_options_out, uint8_t* num_included_prns_out, uint8_t num_included_prns_out_max, uint16_t* included_prns_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_SBAS_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_GNSS_SBAS_SETTINGS, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(enable_sbas_out); - extract_u8(&deserializer, enable_sbas_out); - - assert(sbas_options_out); - extract_mip_3dm_gnss_sbas_settings_command_sbasoptions(&deserializer, sbas_options_out); - - assert(num_included_prns_out); - extract_count(&deserializer, num_included_prns_out, num_included_prns_out_max); - - assert(included_prns_out || (num_included_prns_out == 0)); - for(unsigned int i=0; i < *num_included_prns_out; i++) - extract_u16(&deserializer, &included_prns_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_3dm_save_gnss_sbas_settings(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_SBAS_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_load_gnss_sbas_settings(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_SBAS_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_default_gnss_sbas_settings(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_SBAS_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_3dm_gnss_assisted_fix_command(mip_serializer* serializer, const mip_3dm_gnss_assisted_fix_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_mip_3dm_gnss_assisted_fix_command_assisted_fix_option(serializer, self->option); - - insert_u8(serializer, self->flags); - - } -} -void extract_mip_3dm_gnss_assisted_fix_command(mip_serializer* serializer, mip_3dm_gnss_assisted_fix_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_mip_3dm_gnss_assisted_fix_command_assisted_fix_option(serializer, &self->option); - - extract_u8(serializer, &self->flags); - - } -} - -void insert_mip_3dm_gnss_assisted_fix_response(mip_serializer* serializer, const mip_3dm_gnss_assisted_fix_response* self) -{ - insert_mip_3dm_gnss_assisted_fix_command_assisted_fix_option(serializer, self->option); - - insert_u8(serializer, self->flags); - -} -void extract_mip_3dm_gnss_assisted_fix_response(mip_serializer* serializer, mip_3dm_gnss_assisted_fix_response* self) -{ - extract_mip_3dm_gnss_assisted_fix_command_assisted_fix_option(serializer, &self->option); - - extract_u8(serializer, &self->flags); - -} - -void insert_mip_3dm_gnss_assisted_fix_command_assisted_fix_option(struct mip_serializer* serializer, const mip_3dm_gnss_assisted_fix_command_assisted_fix_option self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_3dm_gnss_assisted_fix_command_assisted_fix_option(struct mip_serializer* serializer, mip_3dm_gnss_assisted_fix_command_assisted_fix_option* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -mip_cmd_result mip_3dm_write_gnss_assisted_fix(struct mip_interface* device, mip_3dm_gnss_assisted_fix_command_assisted_fix_option option, uint8_t flags) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_mip_3dm_gnss_assisted_fix_command_assisted_fix_option(&serializer, option); - - insert_u8(&serializer, flags); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_ASSISTED_FIX_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_read_gnss_assisted_fix(struct mip_interface* device, mip_3dm_gnss_assisted_fix_command_assisted_fix_option* option_out, uint8_t* flags_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_ASSISTED_FIX_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_GNSS_ASSISTED_FIX_SETTINGS, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(option_out); - extract_mip_3dm_gnss_assisted_fix_command_assisted_fix_option(&deserializer, option_out); - - assert(flags_out); - extract_u8(&deserializer, flags_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_3dm_save_gnss_assisted_fix(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_ASSISTED_FIX_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_load_gnss_assisted_fix(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_ASSISTED_FIX_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_default_gnss_assisted_fix(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_ASSISTED_FIX_SETTINGS, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_3dm_gnss_time_assistance_command(mip_serializer* serializer, const mip_3dm_gnss_time_assistance_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_double(serializer, self->tow); - - insert_u16(serializer, self->week_number); - - insert_float(serializer, self->accuracy); - - } -} -void extract_mip_3dm_gnss_time_assistance_command(mip_serializer* serializer, mip_3dm_gnss_time_assistance_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_double(serializer, &self->tow); - - extract_u16(serializer, &self->week_number); - - extract_float(serializer, &self->accuracy); - - } -} - -void insert_mip_3dm_gnss_time_assistance_response(mip_serializer* serializer, const mip_3dm_gnss_time_assistance_response* self) -{ - insert_double(serializer, self->tow); - - insert_u16(serializer, self->week_number); - - insert_float(serializer, self->accuracy); - -} -void extract_mip_3dm_gnss_time_assistance_response(mip_serializer* serializer, mip_3dm_gnss_time_assistance_response* self) -{ - extract_double(serializer, &self->tow); - - extract_u16(serializer, &self->week_number); - - extract_float(serializer, &self->accuracy); - -} - -mip_cmd_result mip_3dm_write_gnss_time_assistance(struct mip_interface* device, double tow, uint16_t week_number, float accuracy) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_double(&serializer, tow); - - insert_u16(&serializer, week_number); - - insert_float(&serializer, accuracy); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_TIME_ASSISTANCE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_read_gnss_time_assistance(struct mip_interface* device, double* tow_out, uint16_t* week_number_out, float* accuracy_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GNSS_TIME_ASSISTANCE, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_GNSS_TIME_ASSISTANCE, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(tow_out); - extract_double(&deserializer, tow_out); - - assert(week_number_out); - extract_u16(&deserializer, week_number_out); - - assert(accuracy_out); - extract_float(&deserializer, accuracy_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -void insert_mip_3dm_imu_lowpass_filter_command(mip_serializer* serializer, const mip_3dm_imu_lowpass_filter_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - insert_u8(serializer, self->target_descriptor); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_bool(serializer, self->enable); - - insert_bool(serializer, self->manual); - - insert_u16(serializer, self->frequency); - - insert_u8(serializer, self->reserved); - - } -} -void extract_mip_3dm_imu_lowpass_filter_command(mip_serializer* serializer, mip_3dm_imu_lowpass_filter_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - extract_u8(serializer, &self->target_descriptor); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_bool(serializer, &self->enable); - - extract_bool(serializer, &self->manual); - - extract_u16(serializer, &self->frequency); - - extract_u8(serializer, &self->reserved); - - } -} - -void insert_mip_3dm_imu_lowpass_filter_response(mip_serializer* serializer, const mip_3dm_imu_lowpass_filter_response* self) -{ - insert_u8(serializer, self->target_descriptor); - - insert_bool(serializer, self->enable); - - insert_bool(serializer, self->manual); - - insert_u16(serializer, self->frequency); - - insert_u8(serializer, self->reserved); - -} -void extract_mip_3dm_imu_lowpass_filter_response(mip_serializer* serializer, mip_3dm_imu_lowpass_filter_response* self) -{ - extract_u8(serializer, &self->target_descriptor); - - extract_bool(serializer, &self->enable); - - extract_bool(serializer, &self->manual); - - extract_u16(serializer, &self->frequency); - - extract_u8(serializer, &self->reserved); - -} - -mip_cmd_result mip_3dm_write_imu_lowpass_filter(struct mip_interface* device, uint8_t target_descriptor, bool enable, bool manual, uint16_t frequency, uint8_t reserved) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_u8(&serializer, target_descriptor); - - insert_bool(&serializer, enable); - - insert_bool(&serializer, manual); - - insert_u16(&serializer, frequency); - - insert_u8(&serializer, reserved); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_IMU_LOWPASS_FILTER, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_read_imu_lowpass_filter(struct mip_interface* device, uint8_t target_descriptor, bool* enable_out, bool* manual_out, uint16_t* frequency_out, uint8_t* reserved_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - insert_u8(&serializer, target_descriptor); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_IMU_LOWPASS_FILTER, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_ADVANCED_DATA_FILTER, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - extract_u8(&deserializer, &target_descriptor); - - assert(enable_out); - extract_bool(&deserializer, enable_out); - - assert(manual_out); - extract_bool(&deserializer, manual_out); - - assert(frequency_out); - extract_u16(&deserializer, frequency_out); - - assert(reserved_out); - extract_u8(&deserializer, reserved_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_3dm_save_imu_lowpass_filter(struct mip_interface* device, uint8_t target_descriptor) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - insert_u8(&serializer, target_descriptor); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_IMU_LOWPASS_FILTER, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_load_imu_lowpass_filter(struct mip_interface* device, uint8_t target_descriptor) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - insert_u8(&serializer, target_descriptor); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_IMU_LOWPASS_FILTER, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_default_imu_lowpass_filter(struct mip_interface* device, uint8_t target_descriptor) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - insert_u8(&serializer, target_descriptor); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_IMU_LOWPASS_FILTER, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_3dm_pps_source_command(mip_serializer* serializer, const mip_3dm_pps_source_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_mip_3dm_pps_source_command_source(serializer, self->source); - - } -} -void extract_mip_3dm_pps_source_command(mip_serializer* serializer, mip_3dm_pps_source_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_mip_3dm_pps_source_command_source(serializer, &self->source); - - } -} - -void insert_mip_3dm_pps_source_response(mip_serializer* serializer, const mip_3dm_pps_source_response* self) -{ - insert_mip_3dm_pps_source_command_source(serializer, self->source); - -} -void extract_mip_3dm_pps_source_response(mip_serializer* serializer, mip_3dm_pps_source_response* self) -{ - extract_mip_3dm_pps_source_command_source(serializer, &self->source); - -} - -void insert_mip_3dm_pps_source_command_source(struct mip_serializer* serializer, const mip_3dm_pps_source_command_source self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_3dm_pps_source_command_source(struct mip_serializer* serializer, mip_3dm_pps_source_command_source* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -mip_cmd_result mip_3dm_write_pps_source(struct mip_interface* device, mip_3dm_pps_source_command_source source) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_mip_3dm_pps_source_command_source(&serializer, source); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_PPS_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_read_pps_source(struct mip_interface* device, mip_3dm_pps_source_command_source* source_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_PPS_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_PPS_SOURCE, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(source_out); - extract_mip_3dm_pps_source_command_source(&deserializer, source_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_3dm_save_pps_source(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_PPS_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_load_pps_source(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_PPS_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_default_pps_source(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_PPS_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_3dm_gpio_config_command(mip_serializer* serializer, const mip_3dm_gpio_config_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - insert_u8(serializer, self->pin); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_mip_3dm_gpio_config_command_feature(serializer, self->feature); - - insert_mip_3dm_gpio_config_command_behavior(serializer, self->behavior); - - insert_mip_3dm_gpio_config_command_pin_mode(serializer, self->pin_mode); - - } -} -void extract_mip_3dm_gpio_config_command(mip_serializer* serializer, mip_3dm_gpio_config_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - extract_u8(serializer, &self->pin); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_mip_3dm_gpio_config_command_feature(serializer, &self->feature); - - extract_mip_3dm_gpio_config_command_behavior(serializer, &self->behavior); - - extract_mip_3dm_gpio_config_command_pin_mode(serializer, &self->pin_mode); - - } -} - -void insert_mip_3dm_gpio_config_response(mip_serializer* serializer, const mip_3dm_gpio_config_response* self) -{ - insert_u8(serializer, self->pin); - - insert_mip_3dm_gpio_config_command_feature(serializer, self->feature); - - insert_mip_3dm_gpio_config_command_behavior(serializer, self->behavior); - - insert_mip_3dm_gpio_config_command_pin_mode(serializer, self->pin_mode); - -} -void extract_mip_3dm_gpio_config_response(mip_serializer* serializer, mip_3dm_gpio_config_response* self) -{ - extract_u8(serializer, &self->pin); - - extract_mip_3dm_gpio_config_command_feature(serializer, &self->feature); - - extract_mip_3dm_gpio_config_command_behavior(serializer, &self->behavior); - - extract_mip_3dm_gpio_config_command_pin_mode(serializer, &self->pin_mode); - -} - -void insert_mip_3dm_gpio_config_command_feature(struct mip_serializer* serializer, const mip_3dm_gpio_config_command_feature self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_3dm_gpio_config_command_feature(struct mip_serializer* serializer, mip_3dm_gpio_config_command_feature* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -void insert_mip_3dm_gpio_config_command_behavior(struct mip_serializer* serializer, const mip_3dm_gpio_config_command_behavior self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_3dm_gpio_config_command_behavior(struct mip_serializer* serializer, mip_3dm_gpio_config_command_behavior* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -void insert_mip_3dm_gpio_config_command_pin_mode(struct mip_serializer* serializer, const mip_3dm_gpio_config_command_pin_mode self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_3dm_gpio_config_command_pin_mode(struct mip_serializer* serializer, mip_3dm_gpio_config_command_pin_mode* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -mip_cmd_result mip_3dm_write_gpio_config(struct mip_interface* device, uint8_t pin, mip_3dm_gpio_config_command_feature feature, mip_3dm_gpio_config_command_behavior behavior, mip_3dm_gpio_config_command_pin_mode pin_mode) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_u8(&serializer, pin); - - insert_mip_3dm_gpio_config_command_feature(&serializer, feature); - - insert_mip_3dm_gpio_config_command_behavior(&serializer, behavior); - - insert_mip_3dm_gpio_config_command_pin_mode(&serializer, pin_mode); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GPIO_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_read_gpio_config(struct mip_interface* device, uint8_t pin, mip_3dm_gpio_config_command_feature* feature_out, mip_3dm_gpio_config_command_behavior* behavior_out, mip_3dm_gpio_config_command_pin_mode* pin_mode_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - insert_u8(&serializer, pin); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GPIO_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_GPIO_CONFIG, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - extract_u8(&deserializer, &pin); - - assert(feature_out); - extract_mip_3dm_gpio_config_command_feature(&deserializer, feature_out); - - assert(behavior_out); - extract_mip_3dm_gpio_config_command_behavior(&deserializer, behavior_out); - - assert(pin_mode_out); - extract_mip_3dm_gpio_config_command_pin_mode(&deserializer, pin_mode_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_3dm_save_gpio_config(struct mip_interface* device, uint8_t pin) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - insert_u8(&serializer, pin); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GPIO_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_load_gpio_config(struct mip_interface* device, uint8_t pin) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - insert_u8(&serializer, pin); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GPIO_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_default_gpio_config(struct mip_interface* device, uint8_t pin) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - insert_u8(&serializer, pin); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GPIO_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_3dm_gpio_state_command(mip_serializer* serializer, const mip_3dm_gpio_state_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE || self->function == MIP_FUNCTION_READ ) - { - insert_u8(serializer, self->pin); - - } - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_bool(serializer, self->state); - - } -} -void extract_mip_3dm_gpio_state_command(mip_serializer* serializer, mip_3dm_gpio_state_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE || self->function == MIP_FUNCTION_READ ) - { - extract_u8(serializer, &self->pin); - - } - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_bool(serializer, &self->state); - - } -} - -void insert_mip_3dm_gpio_state_response(mip_serializer* serializer, const mip_3dm_gpio_state_response* self) -{ - insert_u8(serializer, self->pin); - - insert_bool(serializer, self->state); - -} -void extract_mip_3dm_gpio_state_response(mip_serializer* serializer, mip_3dm_gpio_state_response* self) -{ - extract_u8(serializer, &self->pin); - - extract_bool(serializer, &self->state); - -} - -mip_cmd_result mip_3dm_write_gpio_state(struct mip_interface* device, uint8_t pin, bool state) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_u8(&serializer, pin); - - insert_bool(&serializer, state); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GPIO_STATE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_read_gpio_state(struct mip_interface* device, uint8_t pin, bool* state_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - insert_u8(&serializer, pin); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GPIO_STATE, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_GPIO_STATE, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - extract_u8(&deserializer, &pin); - - assert(state_out); - extract_bool(&deserializer, state_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -void insert_mip_3dm_odometer_command(mip_serializer* serializer, const mip_3dm_odometer_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_mip_3dm_odometer_command_mode(serializer, self->mode); - - insert_float(serializer, self->scaling); - - insert_float(serializer, self->uncertainty); - - } -} -void extract_mip_3dm_odometer_command(mip_serializer* serializer, mip_3dm_odometer_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_mip_3dm_odometer_command_mode(serializer, &self->mode); - - extract_float(serializer, &self->scaling); - - extract_float(serializer, &self->uncertainty); - - } -} - -void insert_mip_3dm_odometer_response(mip_serializer* serializer, const mip_3dm_odometer_response* self) -{ - insert_mip_3dm_odometer_command_mode(serializer, self->mode); - - insert_float(serializer, self->scaling); - - insert_float(serializer, self->uncertainty); - -} -void extract_mip_3dm_odometer_response(mip_serializer* serializer, mip_3dm_odometer_response* self) -{ - extract_mip_3dm_odometer_command_mode(serializer, &self->mode); - - extract_float(serializer, &self->scaling); - - extract_float(serializer, &self->uncertainty); - -} - -void insert_mip_3dm_odometer_command_mode(struct mip_serializer* serializer, const mip_3dm_odometer_command_mode self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_3dm_odometer_command_mode(struct mip_serializer* serializer, mip_3dm_odometer_command_mode* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -mip_cmd_result mip_3dm_write_odometer(struct mip_interface* device, mip_3dm_odometer_command_mode mode, float scaling, float uncertainty) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_mip_3dm_odometer_command_mode(&serializer, mode); - - insert_float(&serializer, scaling); - - insert_float(&serializer, uncertainty); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_ODOMETER_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_read_odometer(struct mip_interface* device, mip_3dm_odometer_command_mode* mode_out, float* scaling_out, float* uncertainty_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_ODOMETER_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_ODOMETER_CONFIG, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(mode_out); - extract_mip_3dm_odometer_command_mode(&deserializer, mode_out); - - assert(scaling_out); - extract_float(&deserializer, scaling_out); - - assert(uncertainty_out); - extract_float(&deserializer, uncertainty_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_3dm_save_odometer(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_ODOMETER_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_load_odometer(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_ODOMETER_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_default_odometer(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_ODOMETER_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_3dm_get_event_support_command(mip_serializer* serializer, const mip_3dm_get_event_support_command* self) -{ - insert_mip_3dm_get_event_support_command_query(serializer, self->query); - -} -void extract_mip_3dm_get_event_support_command(mip_serializer* serializer, mip_3dm_get_event_support_command* self) -{ - extract_mip_3dm_get_event_support_command_query(serializer, &self->query); - -} - -void insert_mip_3dm_get_event_support_response(mip_serializer* serializer, const mip_3dm_get_event_support_response* self) -{ - insert_mip_3dm_get_event_support_command_query(serializer, self->query); - - insert_u8(serializer, self->max_instances); - - insert_u8(serializer, self->num_entries); - - - for(unsigned int i=0; i < self->num_entries; i++) - insert_mip_3dm_get_event_support_command_info(serializer, &self->entries[i]); - -} -void extract_mip_3dm_get_event_support_response(mip_serializer* serializer, mip_3dm_get_event_support_response* self) -{ - extract_mip_3dm_get_event_support_command_query(serializer, &self->query); - - extract_u8(serializer, &self->max_instances); - - assert(self->num_entries); - extract_count(serializer, &self->num_entries, sizeof(self->entries)/sizeof(self->entries[0])); - - for(unsigned int i=0; i < self->num_entries; i++) - extract_mip_3dm_get_event_support_command_info(serializer, &self->entries[i]); - -} - -void insert_mip_3dm_get_event_support_command_query(struct mip_serializer* serializer, const mip_3dm_get_event_support_command_query self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_3dm_get_event_support_command_query(struct mip_serializer* serializer, mip_3dm_get_event_support_command_query* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -void insert_mip_3dm_get_event_support_command_info(mip_serializer* serializer, const mip_3dm_get_event_support_command_info* self) -{ - insert_u8(serializer, self->type); - - insert_u8(serializer, self->count); - -} -void extract_mip_3dm_get_event_support_command_info(mip_serializer* serializer, mip_3dm_get_event_support_command_info* self) -{ - extract_u8(serializer, &self->type); - - extract_u8(serializer, &self->count); - -} - -mip_cmd_result mip_3dm_get_event_support(struct mip_interface* device, mip_3dm_get_event_support_command_query query, uint8_t* max_instances_out, uint8_t* num_entries_out, uint8_t num_entries_out_max, mip_3dm_get_event_support_command_info* entries_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_3dm_get_event_support_command_query(&serializer, query); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_SUPPORT, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_EVENT_SUPPORT, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - extract_mip_3dm_get_event_support_command_query(&deserializer, &query); - - assert(max_instances_out); - extract_u8(&deserializer, max_instances_out); - - assert(num_entries_out); - extract_count(&deserializer, num_entries_out, num_entries_out_max); - - assert(entries_out || (num_entries_out == 0)); - for(unsigned int i=0; i < *num_entries_out; i++) - extract_mip_3dm_get_event_support_command_info(&deserializer, &entries_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -void insert_mip_3dm_event_control_command(mip_serializer* serializer, const mip_3dm_event_control_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - insert_u8(serializer, self->instance); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_mip_3dm_event_control_command_mode(serializer, self->mode); - - } -} -void extract_mip_3dm_event_control_command(mip_serializer* serializer, mip_3dm_event_control_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - extract_u8(serializer, &self->instance); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_mip_3dm_event_control_command_mode(serializer, &self->mode); - - } -} - -void insert_mip_3dm_event_control_response(mip_serializer* serializer, const mip_3dm_event_control_response* self) -{ - insert_u8(serializer, self->instance); - - insert_mip_3dm_event_control_command_mode(serializer, self->mode); - -} -void extract_mip_3dm_event_control_response(mip_serializer* serializer, mip_3dm_event_control_response* self) -{ - extract_u8(serializer, &self->instance); - - extract_mip_3dm_event_control_command_mode(serializer, &self->mode); - -} - -void insert_mip_3dm_event_control_command_mode(struct mip_serializer* serializer, const mip_3dm_event_control_command_mode self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_3dm_event_control_command_mode(struct mip_serializer* serializer, mip_3dm_event_control_command_mode* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -mip_cmd_result mip_3dm_write_event_control(struct mip_interface* device, uint8_t instance, mip_3dm_event_control_command_mode mode) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_u8(&serializer, instance); - - insert_mip_3dm_event_control_command_mode(&serializer, mode); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_read_event_control(struct mip_interface* device, uint8_t instance, mip_3dm_event_control_command_mode* mode_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - insert_u8(&serializer, instance); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_EVENT_CONTROL, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - extract_u8(&deserializer, &instance); - - assert(mode_out); - extract_mip_3dm_event_control_command_mode(&deserializer, mode_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_3dm_save_event_control(struct mip_interface* device, uint8_t instance) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - insert_u8(&serializer, instance); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_load_event_control(struct mip_interface* device, uint8_t instance) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - insert_u8(&serializer, instance); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_default_event_control(struct mip_interface* device, uint8_t instance) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - insert_u8(&serializer, instance); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_3dm_get_event_trigger_status_command(mip_serializer* serializer, const mip_3dm_get_event_trigger_status_command* self) -{ - insert_u8(serializer, self->requested_count); - - - for(unsigned int i=0; i < self->requested_count; i++) - insert_u8(serializer, self->requested_instances[i]); - -} -void extract_mip_3dm_get_event_trigger_status_command(mip_serializer* serializer, mip_3dm_get_event_trigger_status_command* self) -{ - assert(self->requested_count); - extract_count(serializer, &self->requested_count, sizeof(self->requested_instances)/sizeof(self->requested_instances[0])); - - for(unsigned int i=0; i < self->requested_count; i++) - extract_u8(serializer, &self->requested_instances[i]); - -} - -void insert_mip_3dm_get_event_trigger_status_response(mip_serializer* serializer, const mip_3dm_get_event_trigger_status_response* self) -{ - insert_u8(serializer, self->count); - - - for(unsigned int i=0; i < self->count; i++) - insert_mip_3dm_get_event_trigger_status_command_entry(serializer, &self->triggers[i]); - -} -void extract_mip_3dm_get_event_trigger_status_response(mip_serializer* serializer, mip_3dm_get_event_trigger_status_response* self) -{ - assert(self->count); - extract_count(serializer, &self->count, sizeof(self->triggers)/sizeof(self->triggers[0])); - - for(unsigned int i=0; i < self->count; i++) - extract_mip_3dm_get_event_trigger_status_command_entry(serializer, &self->triggers[i]); - -} - -void insert_mip_3dm_get_event_trigger_status_command_status(struct mip_serializer* serializer, const mip_3dm_get_event_trigger_status_command_status self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_3dm_get_event_trigger_status_command_status(struct mip_serializer* serializer, mip_3dm_get_event_trigger_status_command_status* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -void insert_mip_3dm_get_event_trigger_status_command_entry(mip_serializer* serializer, const mip_3dm_get_event_trigger_status_command_entry* self) -{ - insert_u8(serializer, self->type); - - insert_mip_3dm_get_event_trigger_status_command_status(serializer, self->status); - -} -void extract_mip_3dm_get_event_trigger_status_command_entry(mip_serializer* serializer, mip_3dm_get_event_trigger_status_command_entry* self) -{ - extract_u8(serializer, &self->type); - - extract_mip_3dm_get_event_trigger_status_command_status(serializer, &self->status); - -} - -mip_cmd_result mip_3dm_get_event_trigger_status(struct mip_interface* device, uint8_t requested_count, const uint8_t* requested_instances, uint8_t* count_out, uint8_t count_out_max, mip_3dm_get_event_trigger_status_command_entry* triggers_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_u8(&serializer, requested_count); - - assert(requested_instances || (requested_count == 0)); - for(unsigned int i=0; i < requested_count; i++) - insert_u8(&serializer, requested_instances[i]); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_TRIGGER_STATUS, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_EVENT_TRIGGER_STATUS, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(count_out); - extract_count(&deserializer, count_out, count_out_max); - - assert(triggers_out || (count_out == 0)); - for(unsigned int i=0; i < *count_out; i++) - extract_mip_3dm_get_event_trigger_status_command_entry(&deserializer, &triggers_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -void insert_mip_3dm_get_event_action_status_command(mip_serializer* serializer, const mip_3dm_get_event_action_status_command* self) -{ - insert_u8(serializer, self->requested_count); - - - for(unsigned int i=0; i < self->requested_count; i++) - insert_u8(serializer, self->requested_instances[i]); - -} -void extract_mip_3dm_get_event_action_status_command(mip_serializer* serializer, mip_3dm_get_event_action_status_command* self) -{ - assert(self->requested_count); - extract_count(serializer, &self->requested_count, sizeof(self->requested_instances)/sizeof(self->requested_instances[0])); - - for(unsigned int i=0; i < self->requested_count; i++) - extract_u8(serializer, &self->requested_instances[i]); - -} - -void insert_mip_3dm_get_event_action_status_response(mip_serializer* serializer, const mip_3dm_get_event_action_status_response* self) -{ - insert_u8(serializer, self->count); - - - for(unsigned int i=0; i < self->count; i++) - insert_mip_3dm_get_event_action_status_command_entry(serializer, &self->actions[i]); - -} -void extract_mip_3dm_get_event_action_status_response(mip_serializer* serializer, mip_3dm_get_event_action_status_response* self) -{ - assert(self->count); - extract_count(serializer, &self->count, sizeof(self->actions)/sizeof(self->actions[0])); - - for(unsigned int i=0; i < self->count; i++) - extract_mip_3dm_get_event_action_status_command_entry(serializer, &self->actions[i]); - -} - -void insert_mip_3dm_get_event_action_status_command_entry(mip_serializer* serializer, const mip_3dm_get_event_action_status_command_entry* self) -{ - insert_u8(serializer, self->action_type); - - insert_u8(serializer, self->trigger_id); - -} -void extract_mip_3dm_get_event_action_status_command_entry(mip_serializer* serializer, mip_3dm_get_event_action_status_command_entry* self) -{ - extract_u8(serializer, &self->action_type); - - extract_u8(serializer, &self->trigger_id); - -} - -mip_cmd_result mip_3dm_get_event_action_status(struct mip_interface* device, uint8_t requested_count, const uint8_t* requested_instances, uint8_t* count_out, uint8_t count_out_max, mip_3dm_get_event_action_status_command_entry* actions_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_u8(&serializer, requested_count); - - assert(requested_instances || (requested_count == 0)); - for(unsigned int i=0; i < requested_count; i++) - insert_u8(&serializer, requested_instances[i]); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_ACTION_STATUS, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_EVENT_ACTION_STATUS, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(count_out); - extract_count(&deserializer, count_out, count_out_max); - - assert(actions_out || (count_out == 0)); - for(unsigned int i=0; i < *count_out; i++) - extract_mip_3dm_get_event_action_status_command_entry(&deserializer, &actions_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -void insert_mip_3dm_event_trigger_command(mip_serializer* serializer, const mip_3dm_event_trigger_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - insert_u8(serializer, self->instance); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_mip_3dm_event_trigger_command_type(serializer, self->type); - - if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_GPIO ) - { - insert_mip_3dm_event_trigger_command_gpio_params(serializer, &self->parameters.gpio); - - } - if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_THRESHOLD ) - { - insert_mip_3dm_event_trigger_command_threshold_params(serializer, &self->parameters.threshold); - - } - if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_COMBINATION ) - { - insert_mip_3dm_event_trigger_command_combination_params(serializer, &self->parameters.combination); - - } - } -} -void extract_mip_3dm_event_trigger_command(mip_serializer* serializer, mip_3dm_event_trigger_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - extract_u8(serializer, &self->instance); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_mip_3dm_event_trigger_command_type(serializer, &self->type); - - if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_GPIO ) - { - extract_mip_3dm_event_trigger_command_gpio_params(serializer, &self->parameters.gpio); - - } - if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_THRESHOLD ) - { - extract_mip_3dm_event_trigger_command_threshold_params(serializer, &self->parameters.threshold); - - } - if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_COMBINATION ) - { - extract_mip_3dm_event_trigger_command_combination_params(serializer, &self->parameters.combination); - - } - } -} - -void insert_mip_3dm_event_trigger_response(mip_serializer* serializer, const mip_3dm_event_trigger_response* self) -{ - insert_u8(serializer, self->instance); - - insert_mip_3dm_event_trigger_command_type(serializer, self->type); - - if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_GPIO ) - { - insert_mip_3dm_event_trigger_command_gpio_params(serializer, &self->parameters.gpio); - - } - if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_THRESHOLD ) - { - insert_mip_3dm_event_trigger_command_threshold_params(serializer, &self->parameters.threshold); - - } - if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_COMBINATION ) - { - insert_mip_3dm_event_trigger_command_combination_params(serializer, &self->parameters.combination); - - } -} -void extract_mip_3dm_event_trigger_response(mip_serializer* serializer, mip_3dm_event_trigger_response* self) -{ - extract_u8(serializer, &self->instance); - - extract_mip_3dm_event_trigger_command_type(serializer, &self->type); - - if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_GPIO ) - { - extract_mip_3dm_event_trigger_command_gpio_params(serializer, &self->parameters.gpio); - - } - if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_THRESHOLD ) - { - extract_mip_3dm_event_trigger_command_threshold_params(serializer, &self->parameters.threshold); - - } - if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_COMBINATION ) - { - extract_mip_3dm_event_trigger_command_combination_params(serializer, &self->parameters.combination); - - } -} - -void insert_mip_3dm_event_trigger_command_gpio_params(mip_serializer* serializer, const mip_3dm_event_trigger_command_gpio_params* self) -{ - insert_u8(serializer, self->pin); - - insert_mip_3dm_event_trigger_command_gpio_params_mode(serializer, self->mode); - -} -void extract_mip_3dm_event_trigger_command_gpio_params(mip_serializer* serializer, mip_3dm_event_trigger_command_gpio_params* self) -{ - extract_u8(serializer, &self->pin); - - extract_mip_3dm_event_trigger_command_gpio_params_mode(serializer, &self->mode); - -} - -void insert_mip_3dm_event_trigger_command_gpio_params_mode(struct mip_serializer* serializer, const mip_3dm_event_trigger_command_gpio_params_mode self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_3dm_event_trigger_command_gpio_params_mode(struct mip_serializer* serializer, mip_3dm_event_trigger_command_gpio_params_mode* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -void insert_mip_3dm_event_trigger_command_threshold_params(mip_serializer* serializer, const mip_3dm_event_trigger_command_threshold_params* self) -{ - insert_u8(serializer, self->desc_set); - - insert_u8(serializer, self->field_desc); - - insert_u8(serializer, self->param_id); - - insert_mip_3dm_event_trigger_command_threshold_params_type(serializer, self->type); - - if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_THRESHOLD_PARAMS_TYPE_WINDOW ) - { - insert_double(serializer, self->low_thres); - - } - if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_THRESHOLD_PARAMS_TYPE_INTERVAL ) - { - insert_double(serializer, self->int_thres); - - } - if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_THRESHOLD_PARAMS_TYPE_WINDOW ) - { - insert_double(serializer, self->high_thres); - - } - if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_THRESHOLD_PARAMS_TYPE_INTERVAL ) - { - insert_double(serializer, self->interval); - - } -} -void extract_mip_3dm_event_trigger_command_threshold_params(mip_serializer* serializer, mip_3dm_event_trigger_command_threshold_params* self) -{ - extract_u8(serializer, &self->desc_set); - - extract_u8(serializer, &self->field_desc); - - extract_u8(serializer, &self->param_id); - - extract_mip_3dm_event_trigger_command_threshold_params_type(serializer, &self->type); - - if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_THRESHOLD_PARAMS_TYPE_WINDOW ) - { - extract_double(serializer, &self->low_thres); - - } - if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_THRESHOLD_PARAMS_TYPE_INTERVAL ) - { - extract_double(serializer, &self->int_thres); - - } - if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_THRESHOLD_PARAMS_TYPE_WINDOW ) - { - extract_double(serializer, &self->high_thres); - - } - if( self->type == MIP_3DM_EVENT_TRIGGER_COMMAND_THRESHOLD_PARAMS_TYPE_INTERVAL ) - { - extract_double(serializer, &self->interval); - - } -} - -void insert_mip_3dm_event_trigger_command_threshold_params_type(struct mip_serializer* serializer, const mip_3dm_event_trigger_command_threshold_params_type self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_3dm_event_trigger_command_threshold_params_type(struct mip_serializer* serializer, mip_3dm_event_trigger_command_threshold_params_type* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -void insert_mip_3dm_event_trigger_command_combination_params(mip_serializer* serializer, const mip_3dm_event_trigger_command_combination_params* self) -{ - insert_u16(serializer, self->logic_table); - - for(unsigned int i=0; i < 4; i++) - insert_u8(serializer, self->input_triggers[i]); - -} -void extract_mip_3dm_event_trigger_command_combination_params(mip_serializer* serializer, mip_3dm_event_trigger_command_combination_params* self) -{ - extract_u16(serializer, &self->logic_table); - - for(unsigned int i=0; i < 4; i++) - extract_u8(serializer, &self->input_triggers[i]); - -} - -void insert_mip_3dm_event_trigger_command_type(struct mip_serializer* serializer, const mip_3dm_event_trigger_command_type self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_3dm_event_trigger_command_type(struct mip_serializer* serializer, mip_3dm_event_trigger_command_type* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -mip_cmd_result mip_3dm_write_event_trigger(struct mip_interface* device, uint8_t instance, mip_3dm_event_trigger_command_type type, const mip_3dm_event_trigger_command_parameters* parameters) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_u8(&serializer, instance); - - insert_mip_3dm_event_trigger_command_type(&serializer, type); - - if( type == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_GPIO ) - { - insert_mip_3dm_event_trigger_command_gpio_params(&serializer, ¶meters->gpio); - - } - if( type == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_THRESHOLD ) - { - insert_mip_3dm_event_trigger_command_threshold_params(&serializer, ¶meters->threshold); - - } - if( type == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_COMBINATION ) - { - insert_mip_3dm_event_trigger_command_combination_params(&serializer, ¶meters->combination); - - } - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_TRIGGER_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_read_event_trigger(struct mip_interface* device, uint8_t instance, mip_3dm_event_trigger_command_type* type_out, mip_3dm_event_trigger_command_parameters* parameters_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - insert_u8(&serializer, instance); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_TRIGGER_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_EVENT_TRIGGER_CONFIG, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - extract_u8(&deserializer, &instance); - - assert(type_out); - extract_mip_3dm_event_trigger_command_type(&deserializer, type_out); - - if( *type_out == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_GPIO ) - { - extract_mip_3dm_event_trigger_command_gpio_params(&deserializer, ¶meters_out->gpio); - - } - if( *type_out == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_THRESHOLD ) - { - extract_mip_3dm_event_trigger_command_threshold_params(&deserializer, ¶meters_out->threshold); - - } - if( *type_out == MIP_3DM_EVENT_TRIGGER_COMMAND_TYPE_COMBINATION ) - { - extract_mip_3dm_event_trigger_command_combination_params(&deserializer, ¶meters_out->combination); - - } - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_3dm_save_event_trigger(struct mip_interface* device, uint8_t instance) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - insert_u8(&serializer, instance); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_TRIGGER_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_load_event_trigger(struct mip_interface* device, uint8_t instance) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - insert_u8(&serializer, instance); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_TRIGGER_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_default_event_trigger(struct mip_interface* device, uint8_t instance) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - insert_u8(&serializer, instance); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_TRIGGER_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_3dm_event_action_command(mip_serializer* serializer, const mip_3dm_event_action_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - insert_u8(serializer, self->instance); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_u8(serializer, self->trigger); - - insert_mip_3dm_event_action_command_type(serializer, self->type); - - if( self->type == MIP_3DM_EVENT_ACTION_COMMAND_TYPE_GPIO ) - { - insert_mip_3dm_event_action_command_gpio_params(serializer, &self->parameters.gpio); - - } - if( self->type == MIP_3DM_EVENT_ACTION_COMMAND_TYPE_MESSAGE ) - { - insert_mip_3dm_event_action_command_message_params(serializer, &self->parameters.message); - - } - } -} -void extract_mip_3dm_event_action_command(mip_serializer* serializer, mip_3dm_event_action_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - extract_u8(serializer, &self->instance); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_u8(serializer, &self->trigger); - - extract_mip_3dm_event_action_command_type(serializer, &self->type); - - if( self->type == MIP_3DM_EVENT_ACTION_COMMAND_TYPE_GPIO ) - { - extract_mip_3dm_event_action_command_gpio_params(serializer, &self->parameters.gpio); - - } - if( self->type == MIP_3DM_EVENT_ACTION_COMMAND_TYPE_MESSAGE ) - { - extract_mip_3dm_event_action_command_message_params(serializer, &self->parameters.message); - - } - } -} - -void insert_mip_3dm_event_action_response(mip_serializer* serializer, const mip_3dm_event_action_response* self) -{ - insert_u8(serializer, self->instance); - - insert_u8(serializer, self->trigger); - - insert_mip_3dm_event_action_command_type(serializer, self->type); - - if( self->type == MIP_3DM_EVENT_ACTION_COMMAND_TYPE_GPIO ) - { - insert_mip_3dm_event_action_command_gpio_params(serializer, &self->parameters.gpio); - - } - if( self->type == MIP_3DM_EVENT_ACTION_COMMAND_TYPE_MESSAGE ) - { - insert_mip_3dm_event_action_command_message_params(serializer, &self->parameters.message); - - } -} -void extract_mip_3dm_event_action_response(mip_serializer* serializer, mip_3dm_event_action_response* self) -{ - extract_u8(serializer, &self->instance); - - extract_u8(serializer, &self->trigger); - - extract_mip_3dm_event_action_command_type(serializer, &self->type); - - if( self->type == MIP_3DM_EVENT_ACTION_COMMAND_TYPE_GPIO ) - { - extract_mip_3dm_event_action_command_gpio_params(serializer, &self->parameters.gpio); - - } - if( self->type == MIP_3DM_EVENT_ACTION_COMMAND_TYPE_MESSAGE ) - { - extract_mip_3dm_event_action_command_message_params(serializer, &self->parameters.message); - - } -} - -void insert_mip_3dm_event_action_command_gpio_params(mip_serializer* serializer, const mip_3dm_event_action_command_gpio_params* self) -{ - insert_u8(serializer, self->pin); - - insert_mip_3dm_event_action_command_gpio_params_mode(serializer, self->mode); - -} -void extract_mip_3dm_event_action_command_gpio_params(mip_serializer* serializer, mip_3dm_event_action_command_gpio_params* self) -{ - extract_u8(serializer, &self->pin); - - extract_mip_3dm_event_action_command_gpio_params_mode(serializer, &self->mode); - -} - -void insert_mip_3dm_event_action_command_gpio_params_mode(struct mip_serializer* serializer, const mip_3dm_event_action_command_gpio_params_mode self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_3dm_event_action_command_gpio_params_mode(struct mip_serializer* serializer, mip_3dm_event_action_command_gpio_params_mode* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -void insert_mip_3dm_event_action_command_message_params(mip_serializer* serializer, const mip_3dm_event_action_command_message_params* self) -{ - insert_u8(serializer, self->desc_set); - - insert_u16(serializer, self->decimation); - - insert_u8(serializer, self->num_fields); - - - for(unsigned int i=0; i < self->num_fields; i++) - insert_u8(serializer, self->descriptors[i]); - -} -void extract_mip_3dm_event_action_command_message_params(mip_serializer* serializer, mip_3dm_event_action_command_message_params* self) -{ - extract_u8(serializer, &self->desc_set); - - extract_u16(serializer, &self->decimation); - - assert(self->num_fields); - extract_count(serializer, &self->num_fields, sizeof(self->descriptors)/sizeof(self->descriptors[0])); - - for(unsigned int i=0; i < self->num_fields; i++) - extract_u8(serializer, &self->descriptors[i]); - -} - -void insert_mip_3dm_event_action_command_type(struct mip_serializer* serializer, const mip_3dm_event_action_command_type self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_3dm_event_action_command_type(struct mip_serializer* serializer, mip_3dm_event_action_command_type* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -mip_cmd_result mip_3dm_write_event_action(struct mip_interface* device, uint8_t instance, uint8_t trigger, mip_3dm_event_action_command_type type, const mip_3dm_event_action_command_parameters* parameters) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_u8(&serializer, instance); - - insert_u8(&serializer, trigger); - - insert_mip_3dm_event_action_command_type(&serializer, type); - - if( type == MIP_3DM_EVENT_ACTION_COMMAND_TYPE_GPIO ) - { - insert_mip_3dm_event_action_command_gpio_params(&serializer, ¶meters->gpio); - - } - if( type == MIP_3DM_EVENT_ACTION_COMMAND_TYPE_MESSAGE ) - { - insert_mip_3dm_event_action_command_message_params(&serializer, ¶meters->message); - - } - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_ACTION_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_read_event_action(struct mip_interface* device, uint8_t instance, uint8_t* trigger_out, mip_3dm_event_action_command_type* type_out, mip_3dm_event_action_command_parameters* parameters_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - insert_u8(&serializer, instance); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_ACTION_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_EVENT_ACTION_CONFIG, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - extract_u8(&deserializer, &instance); - - assert(trigger_out); - extract_u8(&deserializer, trigger_out); - - assert(type_out); - extract_mip_3dm_event_action_command_type(&deserializer, type_out); - - if( *type_out == MIP_3DM_EVENT_ACTION_COMMAND_TYPE_GPIO ) - { - extract_mip_3dm_event_action_command_gpio_params(&deserializer, ¶meters_out->gpio); - - } - if( *type_out == MIP_3DM_EVENT_ACTION_COMMAND_TYPE_MESSAGE ) - { - extract_mip_3dm_event_action_command_message_params(&deserializer, ¶meters_out->message); - - } - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_3dm_save_event_action(struct mip_interface* device, uint8_t instance) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - insert_u8(&serializer, instance); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_ACTION_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_load_event_action(struct mip_interface* device, uint8_t instance) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - insert_u8(&serializer, instance); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_ACTION_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_default_event_action(struct mip_interface* device, uint8_t instance) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - insert_u8(&serializer, instance); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_EVENT_ACTION_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_3dm_accel_bias_command(mip_serializer* serializer, const mip_3dm_accel_bias_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->bias[i]); - - } -} -void extract_mip_3dm_accel_bias_command(mip_serializer* serializer, mip_3dm_accel_bias_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->bias[i]); - - } -} - -void insert_mip_3dm_accel_bias_response(mip_serializer* serializer, const mip_3dm_accel_bias_response* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->bias[i]); - -} -void extract_mip_3dm_accel_bias_response(mip_serializer* serializer, mip_3dm_accel_bias_response* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->bias[i]); - -} - -mip_cmd_result mip_3dm_write_accel_bias(struct mip_interface* device, const float* bias) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - assert(bias || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_float(&serializer, bias[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_ACCEL_BIAS, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_read_accel_bias(struct mip_interface* device, float* bias_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_ACCEL_BIAS, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_ACCEL_BIAS_VECTOR, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(bias_out || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - extract_float(&deserializer, &bias_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_3dm_save_accel_bias(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_ACCEL_BIAS, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_load_accel_bias(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_ACCEL_BIAS, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_default_accel_bias(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_ACCEL_BIAS, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_3dm_gyro_bias_command(mip_serializer* serializer, const mip_3dm_gyro_bias_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->bias[i]); - - } -} -void extract_mip_3dm_gyro_bias_command(mip_serializer* serializer, mip_3dm_gyro_bias_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->bias[i]); - - } -} - -void insert_mip_3dm_gyro_bias_response(mip_serializer* serializer, const mip_3dm_gyro_bias_response* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->bias[i]); - -} -void extract_mip_3dm_gyro_bias_response(mip_serializer* serializer, mip_3dm_gyro_bias_response* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->bias[i]); - -} - -mip_cmd_result mip_3dm_write_gyro_bias(struct mip_interface* device, const float* bias) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - assert(bias || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_float(&serializer, bias[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GYRO_BIAS, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_read_gyro_bias(struct mip_interface* device, float* bias_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GYRO_BIAS, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_GYRO_BIAS_VECTOR, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(bias_out || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - extract_float(&deserializer, &bias_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_3dm_save_gyro_bias(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GYRO_BIAS, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_load_gyro_bias(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GYRO_BIAS, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_default_gyro_bias(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_GYRO_BIAS, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_3dm_capture_gyro_bias_command(mip_serializer* serializer, const mip_3dm_capture_gyro_bias_command* self) -{ - insert_u16(serializer, self->averaging_time_ms); - -} -void extract_mip_3dm_capture_gyro_bias_command(mip_serializer* serializer, mip_3dm_capture_gyro_bias_command* self) -{ - extract_u16(serializer, &self->averaging_time_ms); - -} - -void insert_mip_3dm_capture_gyro_bias_response(mip_serializer* serializer, const mip_3dm_capture_gyro_bias_response* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->bias[i]); - -} -void extract_mip_3dm_capture_gyro_bias_response(mip_serializer* serializer, mip_3dm_capture_gyro_bias_response* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->bias[i]); - -} - -mip_cmd_result mip_3dm_capture_gyro_bias(struct mip_interface* device, uint16_t averaging_time_ms, float* bias_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_u16(&serializer, averaging_time_ms); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_CAPTURE_GYRO_BIAS, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_GYRO_BIAS_VECTOR, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(bias_out || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - extract_float(&deserializer, &bias_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -void insert_mip_3dm_mag_hard_iron_offset_command(mip_serializer* serializer, const mip_3dm_mag_hard_iron_offset_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->offset[i]); - - } -} -void extract_mip_3dm_mag_hard_iron_offset_command(mip_serializer* serializer, mip_3dm_mag_hard_iron_offset_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->offset[i]); - - } -} - -void insert_mip_3dm_mag_hard_iron_offset_response(mip_serializer* serializer, const mip_3dm_mag_hard_iron_offset_response* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->offset[i]); - -} -void extract_mip_3dm_mag_hard_iron_offset_response(mip_serializer* serializer, mip_3dm_mag_hard_iron_offset_response* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->offset[i]); - -} - -mip_cmd_result mip_3dm_write_mag_hard_iron_offset(struct mip_interface* device, const float* offset) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - assert(offset || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_float(&serializer, offset[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_HARD_IRON_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_read_mag_hard_iron_offset(struct mip_interface* device, float* offset_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_HARD_IRON_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_HARD_IRON_OFFSET_VECTOR, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(offset_out || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - extract_float(&deserializer, &offset_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_3dm_save_mag_hard_iron_offset(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_HARD_IRON_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_load_mag_hard_iron_offset(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_HARD_IRON_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_default_mag_hard_iron_offset(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_HARD_IRON_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_3dm_mag_soft_iron_matrix_command(mip_serializer* serializer, const mip_3dm_mag_soft_iron_matrix_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 9; i++) - insert_float(serializer, self->offset[i]); - - } -} -void extract_mip_3dm_mag_soft_iron_matrix_command(mip_serializer* serializer, mip_3dm_mag_soft_iron_matrix_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 9; i++) - extract_float(serializer, &self->offset[i]); - - } -} - -void insert_mip_3dm_mag_soft_iron_matrix_response(mip_serializer* serializer, const mip_3dm_mag_soft_iron_matrix_response* self) -{ - for(unsigned int i=0; i < 9; i++) - insert_float(serializer, self->offset[i]); - -} -void extract_mip_3dm_mag_soft_iron_matrix_response(mip_serializer* serializer, mip_3dm_mag_soft_iron_matrix_response* self) -{ - for(unsigned int i=0; i < 9; i++) - extract_float(serializer, &self->offset[i]); - -} - -mip_cmd_result mip_3dm_write_mag_soft_iron_matrix(struct mip_interface* device, const float* offset) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - assert(offset || (9 == 0)); - for(unsigned int i=0; i < 9; i++) - insert_float(&serializer, offset[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SOFT_IRON_MATRIX, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_read_mag_soft_iron_matrix(struct mip_interface* device, float* offset_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SOFT_IRON_MATRIX, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_SOFT_IRON_COMP_MATRIX, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(offset_out || (9 == 0)); - for(unsigned int i=0; i < 9; i++) - extract_float(&deserializer, &offset_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_3dm_save_mag_soft_iron_matrix(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SOFT_IRON_MATRIX, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_load_mag_soft_iron_matrix(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SOFT_IRON_MATRIX, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_default_mag_soft_iron_matrix(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SOFT_IRON_MATRIX, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_3dm_coning_sculling_enable_command(mip_serializer* serializer, const mip_3dm_coning_sculling_enable_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_bool(serializer, self->enable); - - } -} -void extract_mip_3dm_coning_sculling_enable_command(mip_serializer* serializer, mip_3dm_coning_sculling_enable_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_bool(serializer, &self->enable); - - } -} - -void insert_mip_3dm_coning_sculling_enable_response(mip_serializer* serializer, const mip_3dm_coning_sculling_enable_response* self) -{ - insert_bool(serializer, self->enable); - -} -void extract_mip_3dm_coning_sculling_enable_response(mip_serializer* serializer, mip_3dm_coning_sculling_enable_response* self) -{ - extract_bool(serializer, &self->enable); - -} - -mip_cmd_result mip_3dm_write_coning_sculling_enable(struct mip_interface* device, bool enable) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_bool(&serializer, enable); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_CONING_AND_SCULLING_ENABLE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_read_coning_sculling_enable(struct mip_interface* device, bool* enable_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_CONING_AND_SCULLING_ENABLE, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_CONING_AND_SCULLING_ENABLE, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(enable_out); - extract_bool(&deserializer, enable_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_3dm_save_coning_sculling_enable(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_CONING_AND_SCULLING_ENABLE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_load_coning_sculling_enable(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_CONING_AND_SCULLING_ENABLE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_default_coning_sculling_enable(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_CONING_AND_SCULLING_ENABLE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_3dm_sensor_2_vehicle_transform_euler_command(mip_serializer* serializer, const mip_3dm_sensor_2_vehicle_transform_euler_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_float(serializer, self->roll); - - insert_float(serializer, self->pitch); - - insert_float(serializer, self->yaw); - - } -} -void extract_mip_3dm_sensor_2_vehicle_transform_euler_command(mip_serializer* serializer, mip_3dm_sensor_2_vehicle_transform_euler_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_float(serializer, &self->roll); - - extract_float(serializer, &self->pitch); - - extract_float(serializer, &self->yaw); - - } -} - -void insert_mip_3dm_sensor_2_vehicle_transform_euler_response(mip_serializer* serializer, const mip_3dm_sensor_2_vehicle_transform_euler_response* self) -{ - insert_float(serializer, self->roll); - - insert_float(serializer, self->pitch); - - insert_float(serializer, self->yaw); - -} -void extract_mip_3dm_sensor_2_vehicle_transform_euler_response(mip_serializer* serializer, mip_3dm_sensor_2_vehicle_transform_euler_response* self) -{ - extract_float(serializer, &self->roll); - - extract_float(serializer, &self->pitch); - - extract_float(serializer, &self->yaw); - -} - -mip_cmd_result mip_3dm_write_sensor_2_vehicle_transform_euler(struct mip_interface* device, float roll, float pitch, float yaw) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_float(&serializer, roll); - - insert_float(&serializer, pitch); - - insert_float(&serializer, yaw); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_EUL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_read_sensor_2_vehicle_transform_euler(struct mip_interface* device, float* roll_out, float* pitch_out, float* yaw_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_EUL, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_EUL, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(roll_out); - extract_float(&deserializer, roll_out); - - assert(pitch_out); - extract_float(&deserializer, pitch_out); - - assert(yaw_out); - extract_float(&deserializer, yaw_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_3dm_save_sensor_2_vehicle_transform_euler(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_EUL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_load_sensor_2_vehicle_transform_euler(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_EUL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_default_sensor_2_vehicle_transform_euler(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_EUL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_3dm_sensor_2_vehicle_transform_quaternion_command(mip_serializer* serializer, const mip_3dm_sensor_2_vehicle_transform_quaternion_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 4; i++) - insert_float(serializer, self->q[i]); - - } -} -void extract_mip_3dm_sensor_2_vehicle_transform_quaternion_command(mip_serializer* serializer, mip_3dm_sensor_2_vehicle_transform_quaternion_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 4; i++) - extract_float(serializer, &self->q[i]); - - } -} - -void insert_mip_3dm_sensor_2_vehicle_transform_quaternion_response(mip_serializer* serializer, const mip_3dm_sensor_2_vehicle_transform_quaternion_response* self) -{ - for(unsigned int i=0; i < 4; i++) - insert_float(serializer, self->q[i]); - -} -void extract_mip_3dm_sensor_2_vehicle_transform_quaternion_response(mip_serializer* serializer, mip_3dm_sensor_2_vehicle_transform_quaternion_response* self) -{ - for(unsigned int i=0; i < 4; i++) - extract_float(serializer, &self->q[i]); - -} - -mip_cmd_result mip_3dm_write_sensor_2_vehicle_transform_quaternion(struct mip_interface* device, const float* q) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - assert(q || (4 == 0)); - for(unsigned int i=0; i < 4; i++) - insert_float(&serializer, q[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_QUAT, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_read_sensor_2_vehicle_transform_quaternion(struct mip_interface* device, float* q_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_QUAT, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_QUAT, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(q_out || (4 == 0)); - for(unsigned int i=0; i < 4; i++) - extract_float(&deserializer, &q_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_3dm_save_sensor_2_vehicle_transform_quaternion(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_QUAT, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_load_sensor_2_vehicle_transform_quaternion(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_QUAT, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_default_sensor_2_vehicle_transform_quaternion(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_QUAT, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_3dm_sensor_2_vehicle_transform_dcm_command(mip_serializer* serializer, const mip_3dm_sensor_2_vehicle_transform_dcm_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 9; i++) - insert_float(serializer, self->dcm[i]); - - } -} -void extract_mip_3dm_sensor_2_vehicle_transform_dcm_command(mip_serializer* serializer, mip_3dm_sensor_2_vehicle_transform_dcm_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 9; i++) - extract_float(serializer, &self->dcm[i]); - - } -} - -void insert_mip_3dm_sensor_2_vehicle_transform_dcm_response(mip_serializer* serializer, const mip_3dm_sensor_2_vehicle_transform_dcm_response* self) -{ - for(unsigned int i=0; i < 9; i++) - insert_float(serializer, self->dcm[i]); - -} -void extract_mip_3dm_sensor_2_vehicle_transform_dcm_response(mip_serializer* serializer, mip_3dm_sensor_2_vehicle_transform_dcm_response* self) -{ - for(unsigned int i=0; i < 9; i++) - extract_float(serializer, &self->dcm[i]); - -} - -mip_cmd_result mip_3dm_write_sensor_2_vehicle_transform_dcm(struct mip_interface* device, const float* dcm) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - assert(dcm || (9 == 0)); - for(unsigned int i=0; i < 9; i++) - insert_float(&serializer, dcm[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_DCM, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_read_sensor_2_vehicle_transform_dcm(struct mip_interface* device, float* dcm_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_DCM, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_DCM, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(dcm_out || (9 == 0)); - for(unsigned int i=0; i < 9; i++) - extract_float(&deserializer, &dcm_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_3dm_save_sensor_2_vehicle_transform_dcm(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_DCM, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_load_sensor_2_vehicle_transform_dcm(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_DCM, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_default_sensor_2_vehicle_transform_dcm(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR2VEHICLE_TRANSFORM_DCM, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_3dm_complementary_filter_command(mip_serializer* serializer, const mip_3dm_complementary_filter_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_bool(serializer, self->pitch_roll_enable); - - insert_bool(serializer, self->heading_enable); - - insert_float(serializer, self->pitch_roll_time_constant); - - insert_float(serializer, self->heading_time_constant); - - } -} -void extract_mip_3dm_complementary_filter_command(mip_serializer* serializer, mip_3dm_complementary_filter_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_bool(serializer, &self->pitch_roll_enable); - - extract_bool(serializer, &self->heading_enable); - - extract_float(serializer, &self->pitch_roll_time_constant); - - extract_float(serializer, &self->heading_time_constant); - - } -} - -void insert_mip_3dm_complementary_filter_response(mip_serializer* serializer, const mip_3dm_complementary_filter_response* self) -{ - insert_bool(serializer, self->pitch_roll_enable); - - insert_bool(serializer, self->heading_enable); - - insert_float(serializer, self->pitch_roll_time_constant); - - insert_float(serializer, self->heading_time_constant); - -} -void extract_mip_3dm_complementary_filter_response(mip_serializer* serializer, mip_3dm_complementary_filter_response* self) -{ - extract_bool(serializer, &self->pitch_roll_enable); - - extract_bool(serializer, &self->heading_enable); - - extract_float(serializer, &self->pitch_roll_time_constant); - - extract_float(serializer, &self->heading_time_constant); - -} - -mip_cmd_result mip_3dm_write_complementary_filter(struct mip_interface* device, bool pitch_roll_enable, bool heading_enable, float pitch_roll_time_constant, float heading_time_constant) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_bool(&serializer, pitch_roll_enable); - - insert_bool(&serializer, heading_enable); - - insert_float(&serializer, pitch_roll_time_constant); - - insert_float(&serializer, heading_time_constant); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_LEGACY_COMP_FILTER, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_read_complementary_filter(struct mip_interface* device, bool* pitch_roll_enable_out, bool* heading_enable_out, float* pitch_roll_time_constant_out, float* heading_time_constant_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_LEGACY_COMP_FILTER, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_LEGACY_COMP_FILTER, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(pitch_roll_enable_out); - extract_bool(&deserializer, pitch_roll_enable_out); - - assert(heading_enable_out); - extract_bool(&deserializer, heading_enable_out); - - assert(pitch_roll_time_constant_out); - extract_float(&deserializer, pitch_roll_time_constant_out); - - assert(heading_time_constant_out); - extract_float(&deserializer, heading_time_constant_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_3dm_save_complementary_filter(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_LEGACY_COMP_FILTER, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_load_complementary_filter(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_LEGACY_COMP_FILTER, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_default_complementary_filter(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_LEGACY_COMP_FILTER, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_3dm_sensor_range_command(mip_serializer* serializer, const mip_3dm_sensor_range_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - insert_mip_sensor_range_type(serializer, self->sensor); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_u8(serializer, self->setting); - - } -} -void extract_mip_3dm_sensor_range_command(mip_serializer* serializer, mip_3dm_sensor_range_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - extract_mip_sensor_range_type(serializer, &self->sensor); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_u8(serializer, &self->setting); - - } -} - -void insert_mip_3dm_sensor_range_response(mip_serializer* serializer, const mip_3dm_sensor_range_response* self) -{ - insert_mip_sensor_range_type(serializer, self->sensor); - - insert_u8(serializer, self->setting); - -} -void extract_mip_3dm_sensor_range_response(mip_serializer* serializer, mip_3dm_sensor_range_response* self) -{ - extract_mip_sensor_range_type(serializer, &self->sensor); - - extract_u8(serializer, &self->setting); - -} - -mip_cmd_result mip_3dm_write_sensor_range(struct mip_interface* device, mip_sensor_range_type sensor, uint8_t setting) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_mip_sensor_range_type(&serializer, sensor); - - insert_u8(&serializer, setting); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR_RANGE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_read_sensor_range(struct mip_interface* device, mip_sensor_range_type sensor, uint8_t* setting_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - insert_mip_sensor_range_type(&serializer, sensor); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR_RANGE, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_SENSOR_RANGE, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - extract_mip_sensor_range_type(&deserializer, &sensor); - - assert(setting_out); - extract_u8(&deserializer, setting_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_3dm_save_sensor_range(struct mip_interface* device, mip_sensor_range_type sensor) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - insert_mip_sensor_range_type(&serializer, sensor); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR_RANGE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_load_sensor_range(struct mip_interface* device, mip_sensor_range_type sensor) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - insert_mip_sensor_range_type(&serializer, sensor); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR_RANGE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_default_sensor_range(struct mip_interface* device, mip_sensor_range_type sensor) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - insert_mip_sensor_range_type(&serializer, sensor); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_SENSOR_RANGE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_3dm_calibrated_sensor_ranges_command(mip_serializer* serializer, const mip_3dm_calibrated_sensor_ranges_command* self) -{ - insert_mip_sensor_range_type(serializer, self->sensor); - -} -void extract_mip_3dm_calibrated_sensor_ranges_command(mip_serializer* serializer, mip_3dm_calibrated_sensor_ranges_command* self) -{ - extract_mip_sensor_range_type(serializer, &self->sensor); - -} - -void insert_mip_3dm_calibrated_sensor_ranges_response(mip_serializer* serializer, const mip_3dm_calibrated_sensor_ranges_response* self) -{ - insert_mip_sensor_range_type(serializer, self->sensor); - - insert_u8(serializer, self->num_ranges); - - - for(unsigned int i=0; i < self->num_ranges; i++) - insert_mip_3dm_calibrated_sensor_ranges_command_entry(serializer, &self->ranges[i]); - -} -void extract_mip_3dm_calibrated_sensor_ranges_response(mip_serializer* serializer, mip_3dm_calibrated_sensor_ranges_response* self) -{ - extract_mip_sensor_range_type(serializer, &self->sensor); - - assert(self->num_ranges); - extract_count(serializer, &self->num_ranges, sizeof(self->ranges)/sizeof(self->ranges[0])); - - for(unsigned int i=0; i < self->num_ranges; i++) - extract_mip_3dm_calibrated_sensor_ranges_command_entry(serializer, &self->ranges[i]); - -} - -void insert_mip_3dm_calibrated_sensor_ranges_command_entry(mip_serializer* serializer, const mip_3dm_calibrated_sensor_ranges_command_entry* self) -{ - insert_u8(serializer, self->setting); - - insert_float(serializer, self->range); - -} -void extract_mip_3dm_calibrated_sensor_ranges_command_entry(mip_serializer* serializer, mip_3dm_calibrated_sensor_ranges_command_entry* self) -{ - extract_u8(serializer, &self->setting); - - extract_float(serializer, &self->range); - -} - -mip_cmd_result mip_3dm_calibrated_sensor_ranges(struct mip_interface* device, mip_sensor_range_type sensor, uint8_t* num_ranges_out, uint8_t num_ranges_out_max, mip_3dm_calibrated_sensor_ranges_command_entry* ranges_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_sensor_range_type(&serializer, sensor); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_CALIBRATED_RANGES, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_CALIBRATED_RANGES, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - extract_mip_sensor_range_type(&deserializer, &sensor); - - assert(num_ranges_out); - extract_count(&deserializer, num_ranges_out, num_ranges_out_max); - - assert(ranges_out || (num_ranges_out == 0)); - for(unsigned int i=0; i < *num_ranges_out; i++) - extract_mip_3dm_calibrated_sensor_ranges_command_entry(&deserializer, &ranges_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -void insert_mip_3dm_lowpass_filter_command(mip_serializer* serializer, const mip_3dm_lowpass_filter_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - insert_u8(serializer, self->desc_set); - - insert_u8(serializer, self->field_desc); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_bool(serializer, self->enable); - - insert_bool(serializer, self->manual); - - insert_float(serializer, self->frequency); - - } -} -void extract_mip_3dm_lowpass_filter_command(mip_serializer* serializer, mip_3dm_lowpass_filter_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - extract_u8(serializer, &self->desc_set); - - extract_u8(serializer, &self->field_desc); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_bool(serializer, &self->enable); - - extract_bool(serializer, &self->manual); - - extract_float(serializer, &self->frequency); - - } -} - -void insert_mip_3dm_lowpass_filter_response(mip_serializer* serializer, const mip_3dm_lowpass_filter_response* self) -{ - insert_u8(serializer, self->desc_set); - - insert_u8(serializer, self->field_desc); - - insert_bool(serializer, self->enable); - - insert_bool(serializer, self->manual); - - insert_float(serializer, self->frequency); - -} -void extract_mip_3dm_lowpass_filter_response(mip_serializer* serializer, mip_3dm_lowpass_filter_response* self) -{ - extract_u8(serializer, &self->desc_set); - - extract_u8(serializer, &self->field_desc); - - extract_bool(serializer, &self->enable); - - extract_bool(serializer, &self->manual); - - extract_float(serializer, &self->frequency); - -} - -mip_cmd_result mip_3dm_write_lowpass_filter(struct mip_interface* device, uint8_t desc_set, uint8_t field_desc, bool enable, bool manual, float frequency) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_u8(&serializer, desc_set); - - insert_u8(&serializer, field_desc); - - insert_bool(&serializer, enable); - - insert_bool(&serializer, manual); - - insert_float(&serializer, frequency); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_LOWPASS_FILTER, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_read_lowpass_filter(struct mip_interface* device, uint8_t desc_set, uint8_t field_desc, bool* enable_out, bool* manual_out, float* frequency_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - insert_u8(&serializer, desc_set); - - insert_u8(&serializer, field_desc); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_LOWPASS_FILTER, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_3DM_LOWPASS_FILTER, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - extract_u8(&deserializer, &desc_set); - - extract_u8(&deserializer, &field_desc); - - assert(enable_out); - extract_bool(&deserializer, enable_out); - - assert(manual_out); - extract_bool(&deserializer, manual_out); - - assert(frequency_out); - extract_float(&deserializer, frequency_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_3dm_save_lowpass_filter(struct mip_interface* device, uint8_t desc_set, uint8_t field_desc) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - insert_u8(&serializer, desc_set); - - insert_u8(&serializer, field_desc); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_LOWPASS_FILTER, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_load_lowpass_filter(struct mip_interface* device, uint8_t desc_set, uint8_t field_desc) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - insert_u8(&serializer, desc_set); - - insert_u8(&serializer, field_desc); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_LOWPASS_FILTER, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_3dm_default_lowpass_filter(struct mip_interface* device, uint8_t desc_set, uint8_t field_desc) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - insert_u8(&serializer, desc_set); - - insert_u8(&serializer, field_desc); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_3DM_CMD_DESC_SET, MIP_CMD_DESC_3DM_LOWPASS_FILTER, buffer, (uint8_t)mip_serializer_length(&serializer)); -} - -#ifdef __cplusplus -} // namespace C -} // namespace mip -} // extern "C" -#endif // __cplusplus - diff --git a/src/mip/definitions/commands_aiding.c b/src/mip/definitions/commands_aiding.c deleted file mode 100644 index dcd292f3d..000000000 --- a/src/mip/definitions/commands_aiding.c +++ /dev/null @@ -1,978 +0,0 @@ - -#include "commands_aiding.h" - -#include "../utils/serialization.h" -#include "../mip_interface.h" - -#include - - -#ifdef __cplusplus -namespace mip { -namespace C { -extern "C" { - -#endif // __cplusplus -struct mip_interface; -struct mip_serializer; -struct mip_field; - - -//////////////////////////////////////////////////////////////////////////////// -// Shared Type Definitions -//////////////////////////////////////////////////////////////////////////////// - -void insert_mip_time(mip_serializer* serializer, const mip_time* self) -{ - insert_mip_time_timebase(serializer, self->timebase); - - insert_u8(serializer, self->reserved); - - insert_u64(serializer, self->nanoseconds); - -} -void extract_mip_time(mip_serializer* serializer, mip_time* self) -{ - extract_mip_time_timebase(serializer, &self->timebase); - - extract_u8(serializer, &self->reserved); - - extract_u64(serializer, &self->nanoseconds); - -} - -void insert_mip_time_timebase(struct mip_serializer* serializer, const mip_time_timebase self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_time_timebase(struct mip_serializer* serializer, mip_time_timebase* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - - -//////////////////////////////////////////////////////////////////////////////// -// Mip Fields -//////////////////////////////////////////////////////////////////////////////// - -void insert_mip_aiding_frame_config_command(mip_serializer* serializer, const mip_aiding_frame_config_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - insert_u8(serializer, self->frame_id); - - if( self->function == MIP_FUNCTION_WRITE || self->function == MIP_FUNCTION_READ ) - { - insert_mip_aiding_frame_config_command_format(serializer, self->format); - - } - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_bool(serializer, self->tracking_enabled); - - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->translation[i]); - - if( self->format == MIP_AIDING_FRAME_CONFIG_COMMAND_FORMAT_EULER ) - { - insert_mip_vector3f(serializer, self->rotation.euler); - - } - if( self->format == MIP_AIDING_FRAME_CONFIG_COMMAND_FORMAT_QUATERNION ) - { - insert_mip_quatf(serializer, self->rotation.quaternion); - - } - } -} -void extract_mip_aiding_frame_config_command(mip_serializer* serializer, mip_aiding_frame_config_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - extract_u8(serializer, &self->frame_id); - - if( self->function == MIP_FUNCTION_WRITE || self->function == MIP_FUNCTION_READ ) - { - extract_mip_aiding_frame_config_command_format(serializer, &self->format); - - } - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_bool(serializer, &self->tracking_enabled); - - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->translation[i]); - - if( self->format == MIP_AIDING_FRAME_CONFIG_COMMAND_FORMAT_EULER ) - { - extract_mip_vector3f(serializer, self->rotation.euler); - - } - if( self->format == MIP_AIDING_FRAME_CONFIG_COMMAND_FORMAT_QUATERNION ) - { - extract_mip_quatf(serializer, self->rotation.quaternion); - - } - } -} - -void insert_mip_aiding_frame_config_response(mip_serializer* serializer, const mip_aiding_frame_config_response* self) -{ - insert_u8(serializer, self->frame_id); - - insert_mip_aiding_frame_config_command_format(serializer, self->format); - - insert_bool(serializer, self->tracking_enabled); - - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->translation[i]); - - if( self->format == MIP_AIDING_FRAME_CONFIG_COMMAND_FORMAT_EULER ) - { - insert_mip_vector3f(serializer, self->rotation.euler); - - } - if( self->format == MIP_AIDING_FRAME_CONFIG_COMMAND_FORMAT_QUATERNION ) - { - insert_mip_quatf(serializer, self->rotation.quaternion); - - } -} -void extract_mip_aiding_frame_config_response(mip_serializer* serializer, mip_aiding_frame_config_response* self) -{ - extract_u8(serializer, &self->frame_id); - - extract_mip_aiding_frame_config_command_format(serializer, &self->format); - - extract_bool(serializer, &self->tracking_enabled); - - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->translation[i]); - - if( self->format == MIP_AIDING_FRAME_CONFIG_COMMAND_FORMAT_EULER ) - { - extract_mip_vector3f(serializer, self->rotation.euler); - - } - if( self->format == MIP_AIDING_FRAME_CONFIG_COMMAND_FORMAT_QUATERNION ) - { - extract_mip_quatf(serializer, self->rotation.quaternion); - - } -} - -void insert_mip_aiding_frame_config_command_format(struct mip_serializer* serializer, const mip_aiding_frame_config_command_format self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_aiding_frame_config_command_format(struct mip_serializer* serializer, mip_aiding_frame_config_command_format* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -mip_cmd_result mip_aiding_write_frame_config(struct mip_interface* device, uint8_t frame_id, mip_aiding_frame_config_command_format format, bool tracking_enabled, const float* translation, const mip_aiding_frame_config_command_rotation* rotation) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_u8(&serializer, frame_id); - - insert_mip_aiding_frame_config_command_format(&serializer, format); - - insert_bool(&serializer, tracking_enabled); - - assert(translation || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_float(&serializer, translation[i]); - - if( format == MIP_AIDING_FRAME_CONFIG_COMMAND_FORMAT_EULER ) - { - insert_mip_vector3f(&serializer, rotation->euler); - - } - if( format == MIP_AIDING_FRAME_CONFIG_COMMAND_FORMAT_QUATERNION ) - { - insert_mip_quatf(&serializer, rotation->quaternion); - - } - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_FRAME_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_aiding_read_frame_config(struct mip_interface* device, uint8_t frame_id, mip_aiding_frame_config_command_format format, bool* tracking_enabled_out, float* translation_out, mip_aiding_frame_config_command_rotation* rotation_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - insert_u8(&serializer, frame_id); - - insert_mip_aiding_frame_config_command_format(&serializer, format); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_FRAME_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_AIDING_FRAME_CONFIG, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - extract_u8(&deserializer, &frame_id); - - extract_mip_aiding_frame_config_command_format(&deserializer, &format); - - assert(tracking_enabled_out); - extract_bool(&deserializer, tracking_enabled_out); - - assert(translation_out || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - extract_float(&deserializer, &translation_out[i]); - - if( format == MIP_AIDING_FRAME_CONFIG_COMMAND_FORMAT_EULER ) - { - extract_mip_vector3f(&deserializer, rotation_out->euler); - - } - if( format == MIP_AIDING_FRAME_CONFIG_COMMAND_FORMAT_QUATERNION ) - { - extract_mip_quatf(&deserializer, rotation_out->quaternion); - - } - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_aiding_save_frame_config(struct mip_interface* device, uint8_t frame_id) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - insert_u8(&serializer, frame_id); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_FRAME_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_aiding_load_frame_config(struct mip_interface* device, uint8_t frame_id) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - insert_u8(&serializer, frame_id); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_FRAME_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_aiding_default_frame_config(struct mip_interface* device, uint8_t frame_id) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - insert_u8(&serializer, frame_id); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_FRAME_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_aiding_echo_control_command(mip_serializer* serializer, const mip_aiding_echo_control_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_mip_aiding_echo_control_command_mode(serializer, self->mode); - - } -} -void extract_mip_aiding_echo_control_command(mip_serializer* serializer, mip_aiding_echo_control_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_mip_aiding_echo_control_command_mode(serializer, &self->mode); - - } -} - -void insert_mip_aiding_echo_control_response(mip_serializer* serializer, const mip_aiding_echo_control_response* self) -{ - insert_mip_aiding_echo_control_command_mode(serializer, self->mode); - -} -void extract_mip_aiding_echo_control_response(mip_serializer* serializer, mip_aiding_echo_control_response* self) -{ - extract_mip_aiding_echo_control_command_mode(serializer, &self->mode); - -} - -void insert_mip_aiding_echo_control_command_mode(struct mip_serializer* serializer, const mip_aiding_echo_control_command_mode self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_aiding_echo_control_command_mode(struct mip_serializer* serializer, mip_aiding_echo_control_command_mode* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -mip_cmd_result mip_aiding_write_echo_control(struct mip_interface* device, mip_aiding_echo_control_command_mode mode) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_mip_aiding_echo_control_command_mode(&serializer, mode); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_ECHO_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_aiding_read_echo_control(struct mip_interface* device, mip_aiding_echo_control_command_mode* mode_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_ECHO_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_AIDING_ECHO_CONTROL, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(mode_out); - extract_mip_aiding_echo_control_command_mode(&deserializer, mode_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_aiding_save_echo_control(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_ECHO_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_aiding_load_echo_control(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_ECHO_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_aiding_default_echo_control(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_ECHO_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_aiding_pos_ecef_command(mip_serializer* serializer, const mip_aiding_pos_ecef_command* self) -{ - insert_mip_time(serializer, &self->time); - - insert_u8(serializer, self->frame_id); - - for(unsigned int i=0; i < 3; i++) - insert_double(serializer, self->position[i]); - - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->uncertainty[i]); - - insert_mip_aiding_pos_ecef_command_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_aiding_pos_ecef_command(mip_serializer* serializer, mip_aiding_pos_ecef_command* self) -{ - extract_mip_time(serializer, &self->time); - - extract_u8(serializer, &self->frame_id); - - for(unsigned int i=0; i < 3; i++) - extract_double(serializer, &self->position[i]); - - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->uncertainty[i]); - - extract_mip_aiding_pos_ecef_command_valid_flags(serializer, &self->valid_flags); - -} - -void insert_mip_aiding_pos_ecef_command_valid_flags(struct mip_serializer* serializer, const mip_aiding_pos_ecef_command_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_aiding_pos_ecef_command_valid_flags(struct mip_serializer* serializer, mip_aiding_pos_ecef_command_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -mip_cmd_result mip_aiding_pos_ecef(struct mip_interface* device, const mip_time* time, uint8_t frame_id, const double* position, const float* uncertainty, mip_aiding_pos_ecef_command_valid_flags valid_flags) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - assert(time); - insert_mip_time(&serializer, time); - - insert_u8(&serializer, frame_id); - - assert(position || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_double(&serializer, position[i]); - - assert(uncertainty || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_float(&serializer, uncertainty[i]); - - insert_mip_aiding_pos_ecef_command_valid_flags(&serializer, valid_flags); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_POS_ECEF, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_aiding_pos_llh_command(mip_serializer* serializer, const mip_aiding_pos_llh_command* self) -{ - insert_mip_time(serializer, &self->time); - - insert_u8(serializer, self->frame_id); - - insert_double(serializer, self->latitude); - - insert_double(serializer, self->longitude); - - insert_double(serializer, self->height); - - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->uncertainty[i]); - - insert_mip_aiding_pos_llh_command_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_aiding_pos_llh_command(mip_serializer* serializer, mip_aiding_pos_llh_command* self) -{ - extract_mip_time(serializer, &self->time); - - extract_u8(serializer, &self->frame_id); - - extract_double(serializer, &self->latitude); - - extract_double(serializer, &self->longitude); - - extract_double(serializer, &self->height); - - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->uncertainty[i]); - - extract_mip_aiding_pos_llh_command_valid_flags(serializer, &self->valid_flags); - -} - -void insert_mip_aiding_pos_llh_command_valid_flags(struct mip_serializer* serializer, const mip_aiding_pos_llh_command_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_aiding_pos_llh_command_valid_flags(struct mip_serializer* serializer, mip_aiding_pos_llh_command_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -mip_cmd_result mip_aiding_pos_llh(struct mip_interface* device, const mip_time* time, uint8_t frame_id, double latitude, double longitude, double height, const float* uncertainty, mip_aiding_pos_llh_command_valid_flags valid_flags) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - assert(time); - insert_mip_time(&serializer, time); - - insert_u8(&serializer, frame_id); - - insert_double(&serializer, latitude); - - insert_double(&serializer, longitude); - - insert_double(&serializer, height); - - assert(uncertainty || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_float(&serializer, uncertainty[i]); - - insert_mip_aiding_pos_llh_command_valid_flags(&serializer, valid_flags); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_POS_LLH, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_aiding_height_above_ellipsoid_command(mip_serializer* serializer, const mip_aiding_height_above_ellipsoid_command* self) -{ - insert_mip_time(serializer, &self->time); - - insert_u8(serializer, self->frame_id); - - insert_float(serializer, self->height); - - insert_float(serializer, self->uncertainty); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_aiding_height_above_ellipsoid_command(mip_serializer* serializer, mip_aiding_height_above_ellipsoid_command* self) -{ - extract_mip_time(serializer, &self->time); - - extract_u8(serializer, &self->frame_id); - - extract_float(serializer, &self->height); - - extract_float(serializer, &self->uncertainty); - - extract_u16(serializer, &self->valid_flags); - -} - -mip_cmd_result mip_aiding_height_above_ellipsoid(struct mip_interface* device, const mip_time* time, uint8_t frame_id, float height, float uncertainty, uint16_t valid_flags) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - assert(time); - insert_mip_time(&serializer, time); - - insert_u8(&serializer, frame_id); - - insert_float(&serializer, height); - - insert_float(&serializer, uncertainty); - - insert_u16(&serializer, valid_flags); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_HEIGHT_ABOVE_ELLIPSOID, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_aiding_vel_ecef_command(mip_serializer* serializer, const mip_aiding_vel_ecef_command* self) -{ - insert_mip_time(serializer, &self->time); - - insert_u8(serializer, self->frame_id); - - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->velocity[i]); - - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->uncertainty[i]); - - insert_mip_aiding_vel_ecef_command_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_aiding_vel_ecef_command(mip_serializer* serializer, mip_aiding_vel_ecef_command* self) -{ - extract_mip_time(serializer, &self->time); - - extract_u8(serializer, &self->frame_id); - - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->velocity[i]); - - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->uncertainty[i]); - - extract_mip_aiding_vel_ecef_command_valid_flags(serializer, &self->valid_flags); - -} - -void insert_mip_aiding_vel_ecef_command_valid_flags(struct mip_serializer* serializer, const mip_aiding_vel_ecef_command_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_aiding_vel_ecef_command_valid_flags(struct mip_serializer* serializer, mip_aiding_vel_ecef_command_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -mip_cmd_result mip_aiding_vel_ecef(struct mip_interface* device, const mip_time* time, uint8_t frame_id, const float* velocity, const float* uncertainty, mip_aiding_vel_ecef_command_valid_flags valid_flags) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - assert(time); - insert_mip_time(&serializer, time); - - insert_u8(&serializer, frame_id); - - assert(velocity || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_float(&serializer, velocity[i]); - - assert(uncertainty || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_float(&serializer, uncertainty[i]); - - insert_mip_aiding_vel_ecef_command_valid_flags(&serializer, valid_flags); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_VEL_ECEF, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_aiding_vel_ned_command(mip_serializer* serializer, const mip_aiding_vel_ned_command* self) -{ - insert_mip_time(serializer, &self->time); - - insert_u8(serializer, self->frame_id); - - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->velocity[i]); - - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->uncertainty[i]); - - insert_mip_aiding_vel_ned_command_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_aiding_vel_ned_command(mip_serializer* serializer, mip_aiding_vel_ned_command* self) -{ - extract_mip_time(serializer, &self->time); - - extract_u8(serializer, &self->frame_id); - - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->velocity[i]); - - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->uncertainty[i]); - - extract_mip_aiding_vel_ned_command_valid_flags(serializer, &self->valid_flags); - -} - -void insert_mip_aiding_vel_ned_command_valid_flags(struct mip_serializer* serializer, const mip_aiding_vel_ned_command_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_aiding_vel_ned_command_valid_flags(struct mip_serializer* serializer, mip_aiding_vel_ned_command_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -mip_cmd_result mip_aiding_vel_ned(struct mip_interface* device, const mip_time* time, uint8_t frame_id, const float* velocity, const float* uncertainty, mip_aiding_vel_ned_command_valid_flags valid_flags) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - assert(time); - insert_mip_time(&serializer, time); - - insert_u8(&serializer, frame_id); - - assert(velocity || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_float(&serializer, velocity[i]); - - assert(uncertainty || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_float(&serializer, uncertainty[i]); - - insert_mip_aiding_vel_ned_command_valid_flags(&serializer, valid_flags); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_VEL_NED, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_aiding_vel_body_frame_command(mip_serializer* serializer, const mip_aiding_vel_body_frame_command* self) -{ - insert_mip_time(serializer, &self->time); - - insert_u8(serializer, self->frame_id); - - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->velocity[i]); - - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->uncertainty[i]); - - insert_mip_aiding_vel_body_frame_command_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_aiding_vel_body_frame_command(mip_serializer* serializer, mip_aiding_vel_body_frame_command* self) -{ - extract_mip_time(serializer, &self->time); - - extract_u8(serializer, &self->frame_id); - - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->velocity[i]); - - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->uncertainty[i]); - - extract_mip_aiding_vel_body_frame_command_valid_flags(serializer, &self->valid_flags); - -} - -void insert_mip_aiding_vel_body_frame_command_valid_flags(struct mip_serializer* serializer, const mip_aiding_vel_body_frame_command_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_aiding_vel_body_frame_command_valid_flags(struct mip_serializer* serializer, mip_aiding_vel_body_frame_command_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -mip_cmd_result mip_aiding_vel_body_frame(struct mip_interface* device, const mip_time* time, uint8_t frame_id, const float* velocity, const float* uncertainty, mip_aiding_vel_body_frame_command_valid_flags valid_flags) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - assert(time); - insert_mip_time(&serializer, time); - - insert_u8(&serializer, frame_id); - - assert(velocity || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_float(&serializer, velocity[i]); - - assert(uncertainty || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_float(&serializer, uncertainty[i]); - - insert_mip_aiding_vel_body_frame_command_valid_flags(&serializer, valid_flags); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_VEL_BODY_FRAME, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_aiding_heading_true_command(mip_serializer* serializer, const mip_aiding_heading_true_command* self) -{ - insert_mip_time(serializer, &self->time); - - insert_u8(serializer, self->frame_id); - - insert_float(serializer, self->heading); - - insert_float(serializer, self->uncertainty); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_aiding_heading_true_command(mip_serializer* serializer, mip_aiding_heading_true_command* self) -{ - extract_mip_time(serializer, &self->time); - - extract_u8(serializer, &self->frame_id); - - extract_float(serializer, &self->heading); - - extract_float(serializer, &self->uncertainty); - - extract_u16(serializer, &self->valid_flags); - -} - -mip_cmd_result mip_aiding_heading_true(struct mip_interface* device, const mip_time* time, uint8_t frame_id, float heading, float uncertainty, uint16_t valid_flags) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - assert(time); - insert_mip_time(&serializer, time); - - insert_u8(&serializer, frame_id); - - insert_float(&serializer, heading); - - insert_float(&serializer, uncertainty); - - insert_u16(&serializer, valid_flags); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_HEADING_TRUE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_aiding_magnetic_field_command(mip_serializer* serializer, const mip_aiding_magnetic_field_command* self) -{ - insert_mip_time(serializer, &self->time); - - insert_u8(serializer, self->frame_id); - - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->magnetic_field[i]); - - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->uncertainty[i]); - - insert_mip_aiding_magnetic_field_command_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_aiding_magnetic_field_command(mip_serializer* serializer, mip_aiding_magnetic_field_command* self) -{ - extract_mip_time(serializer, &self->time); - - extract_u8(serializer, &self->frame_id); - - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->magnetic_field[i]); - - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->uncertainty[i]); - - extract_mip_aiding_magnetic_field_command_valid_flags(serializer, &self->valid_flags); - -} - -void insert_mip_aiding_magnetic_field_command_valid_flags(struct mip_serializer* serializer, const mip_aiding_magnetic_field_command_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_aiding_magnetic_field_command_valid_flags(struct mip_serializer* serializer, mip_aiding_magnetic_field_command_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -mip_cmd_result mip_aiding_magnetic_field(struct mip_interface* device, const mip_time* time, uint8_t frame_id, const float* magnetic_field, const float* uncertainty, mip_aiding_magnetic_field_command_valid_flags valid_flags) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - assert(time); - insert_mip_time(&serializer, time); - - insert_u8(&serializer, frame_id); - - assert(magnetic_field || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_float(&serializer, magnetic_field[i]); - - assert(uncertainty || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_float(&serializer, uncertainty[i]); - - insert_mip_aiding_magnetic_field_command_valid_flags(&serializer, valid_flags); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_MAGNETIC_FIELD, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_aiding_pressure_command(mip_serializer* serializer, const mip_aiding_pressure_command* self) -{ - insert_mip_time(serializer, &self->time); - - insert_u8(serializer, self->frame_id); - - insert_float(serializer, self->pressure); - - insert_float(serializer, self->uncertainty); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_aiding_pressure_command(mip_serializer* serializer, mip_aiding_pressure_command* self) -{ - extract_mip_time(serializer, &self->time); - - extract_u8(serializer, &self->frame_id); - - extract_float(serializer, &self->pressure); - - extract_float(serializer, &self->uncertainty); - - extract_u16(serializer, &self->valid_flags); - -} - -mip_cmd_result mip_aiding_pressure(struct mip_interface* device, const mip_time* time, uint8_t frame_id, float pressure, float uncertainty, uint16_t valid_flags) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - assert(time); - insert_mip_time(&serializer, time); - - insert_u8(&serializer, frame_id); - - insert_float(&serializer, pressure); - - insert_float(&serializer, uncertainty); - - insert_u16(&serializer, valid_flags); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_AIDING_CMD_DESC_SET, MIP_CMD_DESC_AIDING_PRESSURE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} - -#ifdef __cplusplus -} // namespace C -} // namespace mip -} // extern "C" -#endif // __cplusplus - diff --git a/src/mip/definitions/commands_aiding.cpp b/src/mip/definitions/commands_aiding.cpp deleted file mode 100644 index b7e1b106b..000000000 --- a/src/mip/definitions/commands_aiding.cpp +++ /dev/null @@ -1,838 +0,0 @@ - -#include "commands_aiding.hpp" - -#include "../utils/serialization.h" -#include "../mip_interface.h" - -#include - - -namespace mip { -class Serializer; - -namespace C { -struct mip_interface; -} // namespace C - -namespace commands_aiding { - -using ::mip::insert; -using ::mip::extract; -using namespace ::mip::C; - -//////////////////////////////////////////////////////////////////////////////// -// Shared Type Definitions -//////////////////////////////////////////////////////////////////////////////// - -void insert(Serializer& serializer, const Time& self) -{ - insert(serializer, self.timebase); - - insert(serializer, self.reserved); - - insert(serializer, self.nanoseconds); - -} -void extract(Serializer& serializer, Time& self) -{ - extract(serializer, self.timebase); - - extract(serializer, self.reserved); - - extract(serializer, self.nanoseconds); - -} - - -//////////////////////////////////////////////////////////////////////////////// -// Mip Fields -//////////////////////////////////////////////////////////////////////////////// - -void insert(Serializer& serializer, const FrameConfig& self) -{ - insert(serializer, self.function); - - insert(serializer, self.frame_id); - - if( self.function == FunctionSelector::WRITE || self.function == FunctionSelector::READ ) - { - insert(serializer, self.format); - - } - if( self.function == FunctionSelector::WRITE ) - { - insert(serializer, self.tracking_enabled); - - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.translation[i]); - - if( self.format == FrameConfig::Format::EULER ) - { - insert(serializer, self.rotation.euler); - - } - if( self.format == FrameConfig::Format::QUATERNION ) - { - insert(serializer, self.rotation.quaternion); - - } - } -} -void extract(Serializer& serializer, FrameConfig& self) -{ - extract(serializer, self.function); - - extract(serializer, self.frame_id); - - if( self.function == FunctionSelector::WRITE || self.function == FunctionSelector::READ ) - { - extract(serializer, self.format); - - } - if( self.function == FunctionSelector::WRITE ) - { - extract(serializer, self.tracking_enabled); - - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.translation[i]); - - if( self.format == FrameConfig::Format::EULER ) - { - extract(serializer, self.rotation.euler); - - } - if( self.format == FrameConfig::Format::QUATERNION ) - { - extract(serializer, self.rotation.quaternion); - - } - } -} - -void insert(Serializer& serializer, const FrameConfig::Response& self) -{ - insert(serializer, self.frame_id); - - insert(serializer, self.format); - - insert(serializer, self.tracking_enabled); - - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.translation[i]); - - if( self.format == FrameConfig::Format::EULER ) - { - insert(serializer, self.rotation.euler); - - } - if( self.format == FrameConfig::Format::QUATERNION ) - { - insert(serializer, self.rotation.quaternion); - - } -} -void extract(Serializer& serializer, FrameConfig::Response& self) -{ - extract(serializer, self.frame_id); - - extract(serializer, self.format); - - extract(serializer, self.tracking_enabled); - - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.translation[i]); - - if( self.format == FrameConfig::Format::EULER ) - { - extract(serializer, self.rotation.euler); - - } - if( self.format == FrameConfig::Format::QUATERNION ) - { - extract(serializer, self.rotation.quaternion); - - } -} - -TypedResult writeFrameConfig(C::mip_interface& device, uint8_t frameId, FrameConfig::Format format, bool trackingEnabled, const float* translation, const FrameConfig::Rotation& rotation) -{ - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - Serializer serializer(buffer, sizeof(buffer)); - - insert(serializer, FunctionSelector::WRITE); - insert(serializer, frameId); - - insert(serializer, format); - - insert(serializer, trackingEnabled); - - assert(translation || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert(serializer, translation[i]); - - if( format == FrameConfig::Format::EULER ) - { - insert(serializer, rotation.euler); - - } - if( format == FrameConfig::Format::QUATERNION ) - { - insert(serializer, rotation.quaternion); - - } - assert(serializer.isOk()); - - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_FRAME_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -TypedResult readFrameConfig(C::mip_interface& device, uint8_t frameId, FrameConfig::Format format, bool* trackingEnabledOut, float* translationOut, FrameConfig::Rotation* rotationOut) -{ - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - Serializer serializer(buffer, sizeof(buffer)); - - insert(serializer, FunctionSelector::READ); - insert(serializer, frameId); - - insert(serializer, format); - - assert(serializer.isOk()); - - uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_FRAME_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_FRAME_CONFIG, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - Serializer deserializer(buffer, responseLength); - - extract(deserializer, frameId); - - extract(deserializer, format); - - assert(trackingEnabledOut); - extract(deserializer, *trackingEnabledOut); - - assert(translationOut || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - extract(deserializer, translationOut[i]); - - if( format == FrameConfig::Format::EULER ) - { - extract(deserializer, rotationOut->euler); - - } - if( format == FrameConfig::Format::QUATERNION ) - { - extract(deserializer, rotationOut->quaternion); - - } - if( deserializer.remaining() != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -TypedResult saveFrameConfig(C::mip_interface& device, uint8_t frameId) -{ - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - Serializer serializer(buffer, sizeof(buffer)); - - insert(serializer, FunctionSelector::SAVE); - insert(serializer, frameId); - - assert(serializer.isOk()); - - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_FRAME_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -TypedResult loadFrameConfig(C::mip_interface& device, uint8_t frameId) -{ - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - Serializer serializer(buffer, sizeof(buffer)); - - insert(serializer, FunctionSelector::LOAD); - insert(serializer, frameId); - - assert(serializer.isOk()); - - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_FRAME_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -TypedResult defaultFrameConfig(C::mip_interface& device, uint8_t frameId) -{ - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - Serializer serializer(buffer, sizeof(buffer)); - - insert(serializer, FunctionSelector::RESET); - insert(serializer, frameId); - - assert(serializer.isOk()); - - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_FRAME_CONFIG, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert(Serializer& serializer, const EchoControl& self) -{ - insert(serializer, self.function); - - if( self.function == FunctionSelector::WRITE ) - { - insert(serializer, self.mode); - - } -} -void extract(Serializer& serializer, EchoControl& self) -{ - extract(serializer, self.function); - - if( self.function == FunctionSelector::WRITE ) - { - extract(serializer, self.mode); - - } -} - -void insert(Serializer& serializer, const EchoControl::Response& self) -{ - insert(serializer, self.mode); - -} -void extract(Serializer& serializer, EchoControl::Response& self) -{ - extract(serializer, self.mode); - -} - -TypedResult writeEchoControl(C::mip_interface& device, EchoControl::Mode mode) -{ - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - Serializer serializer(buffer, sizeof(buffer)); - - insert(serializer, FunctionSelector::WRITE); - insert(serializer, mode); - - assert(serializer.isOk()); - - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ECHO_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -TypedResult readEchoControl(C::mip_interface& device, EchoControl::Mode* modeOut) -{ - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - Serializer serializer(buffer, sizeof(buffer)); - - insert(serializer, FunctionSelector::READ); - assert(serializer.isOk()); - - uint8_t responseLength = sizeof(buffer); - TypedResult result = mip_interface_run_command_with_response(&device, DESCRIPTOR_SET, CMD_ECHO_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer), REPLY_ECHO_CONTROL, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - Serializer deserializer(buffer, responseLength); - - assert(modeOut); - extract(deserializer, *modeOut); - - if( deserializer.remaining() != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -TypedResult saveEchoControl(C::mip_interface& device) -{ - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - Serializer serializer(buffer, sizeof(buffer)); - - insert(serializer, FunctionSelector::SAVE); - assert(serializer.isOk()); - - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ECHO_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -TypedResult loadEchoControl(C::mip_interface& device) -{ - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - Serializer serializer(buffer, sizeof(buffer)); - - insert(serializer, FunctionSelector::LOAD); - assert(serializer.isOk()); - - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ECHO_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -TypedResult defaultEchoControl(C::mip_interface& device) -{ - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - Serializer serializer(buffer, sizeof(buffer)); - - insert(serializer, FunctionSelector::RESET); - assert(serializer.isOk()); - - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_ECHO_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert(Serializer& serializer, const PosEcef& self) -{ - insert(serializer, self.time); - - insert(serializer, self.frame_id); - - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.position[i]); - - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.uncertainty[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, PosEcef& self) -{ - extract(serializer, self.time); - - extract(serializer, self.frame_id); - - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.position[i]); - - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.uncertainty[i]); - - extract(serializer, self.valid_flags); - -} - -TypedResult posEcef(C::mip_interface& device, const Time& time, uint8_t frameId, const double* position, const float* uncertainty, PosEcef::ValidFlags validFlags) -{ - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - Serializer serializer(buffer, sizeof(buffer)); - - insert(serializer, time); - - insert(serializer, frameId); - - assert(position || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert(serializer, position[i]); - - assert(uncertainty || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert(serializer, uncertainty[i]); - - insert(serializer, validFlags); - - assert(serializer.isOk()); - - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_POS_ECEF, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert(Serializer& serializer, const PosLlh& self) -{ - insert(serializer, self.time); - - insert(serializer, self.frame_id); - - insert(serializer, self.latitude); - - insert(serializer, self.longitude); - - insert(serializer, self.height); - - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.uncertainty[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, PosLlh& self) -{ - extract(serializer, self.time); - - extract(serializer, self.frame_id); - - extract(serializer, self.latitude); - - extract(serializer, self.longitude); - - extract(serializer, self.height); - - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.uncertainty[i]); - - extract(serializer, self.valid_flags); - -} - -TypedResult posLlh(C::mip_interface& device, const Time& time, uint8_t frameId, double latitude, double longitude, double height, const float* uncertainty, PosLlh::ValidFlags validFlags) -{ - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - Serializer serializer(buffer, sizeof(buffer)); - - insert(serializer, time); - - insert(serializer, frameId); - - insert(serializer, latitude); - - insert(serializer, longitude); - - insert(serializer, height); - - assert(uncertainty || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert(serializer, uncertainty[i]); - - insert(serializer, validFlags); - - assert(serializer.isOk()); - - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_POS_LLH, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert(Serializer& serializer, const HeightAboveEllipsoid& self) -{ - insert(serializer, self.time); - - insert(serializer, self.frame_id); - - insert(serializer, self.height); - - insert(serializer, self.uncertainty); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, HeightAboveEllipsoid& self) -{ - extract(serializer, self.time); - - extract(serializer, self.frame_id); - - extract(serializer, self.height); - - extract(serializer, self.uncertainty); - - extract(serializer, self.valid_flags); - -} - -TypedResult heightAboveEllipsoid(C::mip_interface& device, const Time& time, uint8_t frameId, float height, float uncertainty, uint16_t validFlags) -{ - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - Serializer serializer(buffer, sizeof(buffer)); - - insert(serializer, time); - - insert(serializer, frameId); - - insert(serializer, height); - - insert(serializer, uncertainty); - - insert(serializer, validFlags); - - assert(serializer.isOk()); - - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_HEIGHT_ABOVE_ELLIPSOID, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert(Serializer& serializer, const VelEcef& self) -{ - insert(serializer, self.time); - - insert(serializer, self.frame_id); - - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.velocity[i]); - - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.uncertainty[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, VelEcef& self) -{ - extract(serializer, self.time); - - extract(serializer, self.frame_id); - - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.velocity[i]); - - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.uncertainty[i]); - - extract(serializer, self.valid_flags); - -} - -TypedResult velEcef(C::mip_interface& device, const Time& time, uint8_t frameId, const float* velocity, const float* uncertainty, VelEcef::ValidFlags validFlags) -{ - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - Serializer serializer(buffer, sizeof(buffer)); - - insert(serializer, time); - - insert(serializer, frameId); - - assert(velocity || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert(serializer, velocity[i]); - - assert(uncertainty || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert(serializer, uncertainty[i]); - - insert(serializer, validFlags); - - assert(serializer.isOk()); - - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_VEL_ECEF, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert(Serializer& serializer, const VelNed& self) -{ - insert(serializer, self.time); - - insert(serializer, self.frame_id); - - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.velocity[i]); - - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.uncertainty[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, VelNed& self) -{ - extract(serializer, self.time); - - extract(serializer, self.frame_id); - - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.velocity[i]); - - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.uncertainty[i]); - - extract(serializer, self.valid_flags); - -} - -TypedResult velNed(C::mip_interface& device, const Time& time, uint8_t frameId, const float* velocity, const float* uncertainty, VelNed::ValidFlags validFlags) -{ - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - Serializer serializer(buffer, sizeof(buffer)); - - insert(serializer, time); - - insert(serializer, frameId); - - assert(velocity || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert(serializer, velocity[i]); - - assert(uncertainty || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert(serializer, uncertainty[i]); - - insert(serializer, validFlags); - - assert(serializer.isOk()); - - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_VEL_NED, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert(Serializer& serializer, const VelBodyFrame& self) -{ - insert(serializer, self.time); - - insert(serializer, self.frame_id); - - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.velocity[i]); - - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.uncertainty[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, VelBodyFrame& self) -{ - extract(serializer, self.time); - - extract(serializer, self.frame_id); - - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.velocity[i]); - - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.uncertainty[i]); - - extract(serializer, self.valid_flags); - -} - -TypedResult velBodyFrame(C::mip_interface& device, const Time& time, uint8_t frameId, const float* velocity, const float* uncertainty, VelBodyFrame::ValidFlags validFlags) -{ - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - Serializer serializer(buffer, sizeof(buffer)); - - insert(serializer, time); - - insert(serializer, frameId); - - assert(velocity || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert(serializer, velocity[i]); - - assert(uncertainty || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert(serializer, uncertainty[i]); - - insert(serializer, validFlags); - - assert(serializer.isOk()); - - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_VEL_BODY_FRAME, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert(Serializer& serializer, const HeadingTrue& self) -{ - insert(serializer, self.time); - - insert(serializer, self.frame_id); - - insert(serializer, self.heading); - - insert(serializer, self.uncertainty); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, HeadingTrue& self) -{ - extract(serializer, self.time); - - extract(serializer, self.frame_id); - - extract(serializer, self.heading); - - extract(serializer, self.uncertainty); - - extract(serializer, self.valid_flags); - -} - -TypedResult headingTrue(C::mip_interface& device, const Time& time, uint8_t frameId, float heading, float uncertainty, uint16_t validFlags) -{ - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - Serializer serializer(buffer, sizeof(buffer)); - - insert(serializer, time); - - insert(serializer, frameId); - - insert(serializer, heading); - - insert(serializer, uncertainty); - - insert(serializer, validFlags); - - assert(serializer.isOk()); - - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_HEADING_TRUE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert(Serializer& serializer, const MagneticField& self) -{ - insert(serializer, self.time); - - insert(serializer, self.frame_id); - - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.magnetic_field[i]); - - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.uncertainty[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, MagneticField& self) -{ - extract(serializer, self.time); - - extract(serializer, self.frame_id); - - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.magnetic_field[i]); - - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.uncertainty[i]); - - extract(serializer, self.valid_flags); - -} - -TypedResult magneticField(C::mip_interface& device, const Time& time, uint8_t frameId, const float* magneticField, const float* uncertainty, MagneticField::ValidFlags validFlags) -{ - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - Serializer serializer(buffer, sizeof(buffer)); - - insert(serializer, time); - - insert(serializer, frameId); - - assert(magneticField || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert(serializer, magneticField[i]); - - assert(uncertainty || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert(serializer, uncertainty[i]); - - insert(serializer, validFlags); - - assert(serializer.isOk()); - - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_MAGNETIC_FIELD, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert(Serializer& serializer, const Pressure& self) -{ - insert(serializer, self.time); - - insert(serializer, self.frame_id); - - insert(serializer, self.pressure); - - insert(serializer, self.uncertainty); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, Pressure& self) -{ - extract(serializer, self.time); - - extract(serializer, self.frame_id); - - extract(serializer, self.pressure); - - extract(serializer, self.uncertainty); - - extract(serializer, self.valid_flags); - -} - -TypedResult pressure(C::mip_interface& device, const Time& time, uint8_t frameId, float pressure, float uncertainty, uint16_t validFlags) -{ - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - Serializer serializer(buffer, sizeof(buffer)); - - insert(serializer, time); - - insert(serializer, frameId); - - insert(serializer, pressure); - - insert(serializer, uncertainty); - - insert(serializer, validFlags); - - assert(serializer.isOk()); - - return mip_interface_run_command(&device, DESCRIPTOR_SET, CMD_PRESSURE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} - -} // namespace commands_aiding -} // namespace mip - diff --git a/src/mip/definitions/commands_base.c b/src/mip/definitions/commands_base.c deleted file mode 100644 index fd72ea2fa..000000000 --- a/src/mip/definitions/commands_base.c +++ /dev/null @@ -1,396 +0,0 @@ - -#include "commands_base.h" - -#include "../utils/serialization.h" -#include "../mip_interface.h" - -#include - - -#ifdef __cplusplus -namespace mip { -namespace C { -extern "C" { - -#endif // __cplusplus -struct mip_interface; -struct mip_serializer; -struct mip_field; - - -//////////////////////////////////////////////////////////////////////////////// -// Shared Type Definitions -//////////////////////////////////////////////////////////////////////////////// - -void insert_mip_base_device_info(mip_serializer* serializer, const mip_base_device_info* self) -{ - insert_u16(serializer, self->firmware_version); - - for(unsigned int i=0; i < 16; i++) - insert_char(serializer, self->model_name[i]); - - for(unsigned int i=0; i < 16; i++) - insert_char(serializer, self->model_number[i]); - - for(unsigned int i=0; i < 16; i++) - insert_char(serializer, self->serial_number[i]); - - for(unsigned int i=0; i < 16; i++) - insert_char(serializer, self->lot_number[i]); - - for(unsigned int i=0; i < 16; i++) - insert_char(serializer, self->device_options[i]); - -} -void extract_mip_base_device_info(mip_serializer* serializer, mip_base_device_info* self) -{ - extract_u16(serializer, &self->firmware_version); - - for(unsigned int i=0; i < 16; i++) - extract_char(serializer, &self->model_name[i]); - - for(unsigned int i=0; i < 16; i++) - extract_char(serializer, &self->model_number[i]); - - for(unsigned int i=0; i < 16; i++) - extract_char(serializer, &self->serial_number[i]); - - for(unsigned int i=0; i < 16; i++) - extract_char(serializer, &self->lot_number[i]); - - for(unsigned int i=0; i < 16; i++) - extract_char(serializer, &self->device_options[i]); - -} - -void insert_mip_time_format(struct mip_serializer* serializer, const mip_time_format self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_time_format(struct mip_serializer* serializer, mip_time_format* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -void insert_mip_commanded_test_bits_gq7(struct mip_serializer* serializer, const mip_commanded_test_bits_gq7 self) -{ - insert_u32(serializer, (uint32_t)(self)); -} -void extract_mip_commanded_test_bits_gq7(struct mip_serializer* serializer, mip_commanded_test_bits_gq7* self) -{ - uint32_t tmp = 0; - extract_u32(serializer, &tmp); - *self = tmp; -} - - -//////////////////////////////////////////////////////////////////////////////// -// Mip Fields -//////////////////////////////////////////////////////////////////////////////// - -mip_cmd_result mip_base_ping(struct mip_interface* device) -{ - return mip_interface_run_command(device, MIP_BASE_CMD_DESC_SET, MIP_CMD_DESC_BASE_PING, NULL, 0); -} -mip_cmd_result mip_base_set_idle(struct mip_interface* device) -{ - return mip_interface_run_command(device, MIP_BASE_CMD_DESC_SET, MIP_CMD_DESC_BASE_SET_TO_IDLE, NULL, 0); -} -mip_cmd_result mip_base_get_device_info(struct mip_interface* device, mip_base_device_info* device_info_out) -{ - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - uint8_t responseLength = sizeof(buffer); - - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_BASE_CMD_DESC_SET, MIP_CMD_DESC_BASE_GET_DEVICE_INFO, NULL, 0, MIP_REPLY_DESC_BASE_DEVICE_INFO, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(device_info_out); - extract_mip_base_device_info(&deserializer, device_info_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_base_get_device_descriptors(struct mip_interface* device, uint16_t* descriptors_out, size_t descriptors_out_max, uint8_t* descriptors_out_count) -{ - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - uint8_t responseLength = sizeof(buffer); - - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_BASE_CMD_DESC_SET, MIP_CMD_DESC_BASE_GET_DEVICE_DESCRIPTORS, NULL, 0, MIP_REPLY_DESC_BASE_DEVICE_DESCRIPTORS, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - for(*descriptors_out_count = 0; (*descriptors_out_count < descriptors_out_max) && (mip_serializer_remaining(&deserializer) > 0); (*descriptors_out_count)++) - extract_u16(&deserializer, &descriptors_out[*descriptors_out_count]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_base_built_in_test(struct mip_interface* device, uint32_t* result_out) -{ - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - uint8_t responseLength = sizeof(buffer); - - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_BASE_CMD_DESC_SET, MIP_CMD_DESC_BASE_BUILT_IN_TEST, NULL, 0, MIP_REPLY_DESC_BASE_BUILT_IN_TEST, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(result_out); - extract_u32(&deserializer, result_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_base_resume(struct mip_interface* device) -{ - return mip_interface_run_command(device, MIP_BASE_CMD_DESC_SET, MIP_CMD_DESC_BASE_RESUME, NULL, 0); -} -mip_cmd_result mip_base_get_extended_descriptors(struct mip_interface* device, uint16_t* descriptors_out, size_t descriptors_out_max, uint8_t* descriptors_out_count) -{ - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - uint8_t responseLength = sizeof(buffer); - - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_BASE_CMD_DESC_SET, MIP_CMD_DESC_BASE_GET_EXTENDED_DESCRIPTORS, NULL, 0, MIP_REPLY_DESC_BASE_GET_EXTENDED_DESCRIPTORS, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - for(*descriptors_out_count = 0; (*descriptors_out_count < descriptors_out_max) && (mip_serializer_remaining(&deserializer) > 0); (*descriptors_out_count)++) - extract_u16(&deserializer, &descriptors_out[*descriptors_out_count]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_base_continuous_bit(struct mip_interface* device, uint8_t* result_out) -{ - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - uint8_t responseLength = sizeof(buffer); - - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_BASE_CMD_DESC_SET, MIP_CMD_DESC_BASE_CONTINUOUS_BIT, NULL, 0, MIP_REPLY_DESC_BASE_CONTINUOUS_BIT, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(result_out || (16 == 0)); - for(unsigned int i=0; i < 16; i++) - extract_u8(&deserializer, &result_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -void insert_mip_base_comm_speed_command(mip_serializer* serializer, const mip_base_comm_speed_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - insert_u8(serializer, self->port); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_u32(serializer, self->baud); - - } -} -void extract_mip_base_comm_speed_command(mip_serializer* serializer, mip_base_comm_speed_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - extract_u8(serializer, &self->port); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_u32(serializer, &self->baud); - - } -} - -void insert_mip_base_comm_speed_response(mip_serializer* serializer, const mip_base_comm_speed_response* self) -{ - insert_u8(serializer, self->port); - - insert_u32(serializer, self->baud); - -} -void extract_mip_base_comm_speed_response(mip_serializer* serializer, mip_base_comm_speed_response* self) -{ - extract_u8(serializer, &self->port); - - extract_u32(serializer, &self->baud); - -} - -mip_cmd_result mip_base_write_comm_speed(struct mip_interface* device, uint8_t port, uint32_t baud) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_u8(&serializer, port); - - insert_u32(&serializer, baud); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_BASE_CMD_DESC_SET, MIP_CMD_DESC_BASE_COMM_SPEED, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_base_read_comm_speed(struct mip_interface* device, uint8_t port, uint32_t* baud_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - insert_u8(&serializer, port); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_BASE_CMD_DESC_SET, MIP_CMD_DESC_BASE_COMM_SPEED, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_BASE_COMM_SPEED, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - extract_u8(&deserializer, &port); - - assert(baud_out); - extract_u32(&deserializer, baud_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_base_save_comm_speed(struct mip_interface* device, uint8_t port) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - insert_u8(&serializer, port); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_BASE_CMD_DESC_SET, MIP_CMD_DESC_BASE_COMM_SPEED, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_base_load_comm_speed(struct mip_interface* device, uint8_t port) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - insert_u8(&serializer, port); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_BASE_CMD_DESC_SET, MIP_CMD_DESC_BASE_COMM_SPEED, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_base_default_comm_speed(struct mip_interface* device, uint8_t port) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - insert_u8(&serializer, port); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_BASE_CMD_DESC_SET, MIP_CMD_DESC_BASE_COMM_SPEED, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_base_gps_time_update_command(mip_serializer* serializer, const mip_base_gps_time_update_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_mip_base_gps_time_update_command_field_id(serializer, self->field_id); - - insert_u32(serializer, self->value); - - } -} -void extract_mip_base_gps_time_update_command(mip_serializer* serializer, mip_base_gps_time_update_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_mip_base_gps_time_update_command_field_id(serializer, &self->field_id); - - extract_u32(serializer, &self->value); - - } -} - -void insert_mip_base_gps_time_update_command_field_id(struct mip_serializer* serializer, const mip_base_gps_time_update_command_field_id self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_base_gps_time_update_command_field_id(struct mip_serializer* serializer, mip_base_gps_time_update_command_field_id* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -mip_cmd_result mip_base_write_gps_time_update(struct mip_interface* device, mip_base_gps_time_update_command_field_id field_id, uint32_t value) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_mip_base_gps_time_update_command_field_id(&serializer, field_id); - - insert_u32(&serializer, value); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_BASE_CMD_DESC_SET, MIP_CMD_DESC_BASE_GPS_TIME_UPDATE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_base_soft_reset(struct mip_interface* device) -{ - return mip_interface_run_command(device, MIP_BASE_CMD_DESC_SET, MIP_CMD_DESC_BASE_SOFT_RESET, NULL, 0); -} - -#ifdef __cplusplus -} // namespace C -} // namespace mip -} // extern "C" -#endif // __cplusplus - diff --git a/src/mip/definitions/commands_filter.c b/src/mip/definitions/commands_filter.c deleted file mode 100644 index 7cc6aed8f..000000000 --- a/src/mip/definitions/commands_filter.c +++ /dev/null @@ -1,5794 +0,0 @@ - -#include "commands_filter.h" - -#include "../utils/serialization.h" -#include "../mip_interface.h" - -#include - - -#ifdef __cplusplus -namespace mip { -namespace C { -extern "C" { - -#endif // __cplusplus -struct mip_interface; -struct mip_serializer; -struct mip_field; - - -//////////////////////////////////////////////////////////////////////////////// -// Shared Type Definitions -//////////////////////////////////////////////////////////////////////////////// - -void insert_mip_filter_reference_frame(struct mip_serializer* serializer, const mip_filter_reference_frame self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_filter_reference_frame(struct mip_serializer* serializer, mip_filter_reference_frame* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -void insert_mip_filter_mag_param_source(struct mip_serializer* serializer, const mip_filter_mag_param_source self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_filter_mag_param_source(struct mip_serializer* serializer, mip_filter_mag_param_source* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -void insert_mip_filter_adaptive_measurement(struct mip_serializer* serializer, const mip_filter_adaptive_measurement self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_filter_adaptive_measurement(struct mip_serializer* serializer, mip_filter_adaptive_measurement* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - - -//////////////////////////////////////////////////////////////////////////////// -// Mip Fields -//////////////////////////////////////////////////////////////////////////////// - -mip_cmd_result mip_filter_reset(struct mip_interface* device) -{ - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_RESET_FILTER, NULL, 0); -} -void insert_mip_filter_set_initial_attitude_command(mip_serializer* serializer, const mip_filter_set_initial_attitude_command* self) -{ - insert_float(serializer, self->roll); - - insert_float(serializer, self->pitch); - - insert_float(serializer, self->heading); - -} -void extract_mip_filter_set_initial_attitude_command(mip_serializer* serializer, mip_filter_set_initial_attitude_command* self) -{ - extract_float(serializer, &self->roll); - - extract_float(serializer, &self->pitch); - - extract_float(serializer, &self->heading); - -} - -mip_cmd_result mip_filter_set_initial_attitude(struct mip_interface* device, float roll, float pitch, float heading) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_float(&serializer, roll); - - insert_float(&serializer, pitch); - - insert_float(&serializer, heading); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SET_INITIAL_ATTITUDE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_estimation_control_command(mip_serializer* serializer, const mip_filter_estimation_control_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_mip_filter_estimation_control_command_enable_flags(serializer, self->enable); - - } -} -void extract_mip_filter_estimation_control_command(mip_serializer* serializer, mip_filter_estimation_control_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_mip_filter_estimation_control_command_enable_flags(serializer, &self->enable); - - } -} - -void insert_mip_filter_estimation_control_response(mip_serializer* serializer, const mip_filter_estimation_control_response* self) -{ - insert_mip_filter_estimation_control_command_enable_flags(serializer, self->enable); - -} -void extract_mip_filter_estimation_control_response(mip_serializer* serializer, mip_filter_estimation_control_response* self) -{ - extract_mip_filter_estimation_control_command_enable_flags(serializer, &self->enable); - -} - -void insert_mip_filter_estimation_control_command_enable_flags(struct mip_serializer* serializer, const mip_filter_estimation_control_command_enable_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_filter_estimation_control_command_enable_flags(struct mip_serializer* serializer, mip_filter_estimation_control_command_enable_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -mip_cmd_result mip_filter_write_estimation_control(struct mip_interface* device, mip_filter_estimation_control_command_enable_flags enable) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_mip_filter_estimation_control_command_enable_flags(&serializer, enable); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ESTIMATION_CONTROL_FLAGS, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_estimation_control(struct mip_interface* device, mip_filter_estimation_control_command_enable_flags* enable_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ESTIMATION_CONTROL_FLAGS, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_ESTIMATION_CONTROL_FLAGS, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(enable_out); - extract_mip_filter_estimation_control_command_enable_flags(&deserializer, enable_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_estimation_control(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ESTIMATION_CONTROL_FLAGS, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_estimation_control(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ESTIMATION_CONTROL_FLAGS, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_estimation_control(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ESTIMATION_CONTROL_FLAGS, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_external_gnss_update_command(mip_serializer* serializer, const mip_filter_external_gnss_update_command* self) -{ - insert_double(serializer, self->gps_time); - - insert_u16(serializer, self->gps_week); - - insert_double(serializer, self->latitude); - - insert_double(serializer, self->longitude); - - insert_double(serializer, self->height); - - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->velocity[i]); - - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->pos_uncertainty[i]); - - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->vel_uncertainty[i]); - -} -void extract_mip_filter_external_gnss_update_command(mip_serializer* serializer, mip_filter_external_gnss_update_command* self) -{ - extract_double(serializer, &self->gps_time); - - extract_u16(serializer, &self->gps_week); - - extract_double(serializer, &self->latitude); - - extract_double(serializer, &self->longitude); - - extract_double(serializer, &self->height); - - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->velocity[i]); - - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->pos_uncertainty[i]); - - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->vel_uncertainty[i]); - -} - -mip_cmd_result mip_filter_external_gnss_update(struct mip_interface* device, double gps_time, uint16_t gps_week, double latitude, double longitude, double height, const float* velocity, const float* pos_uncertainty, const float* vel_uncertainty) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_double(&serializer, gps_time); - - insert_u16(&serializer, gps_week); - - insert_double(&serializer, latitude); - - insert_double(&serializer, longitude); - - insert_double(&serializer, height); - - assert(velocity || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_float(&serializer, velocity[i]); - - assert(pos_uncertainty || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_float(&serializer, pos_uncertainty[i]); - - assert(vel_uncertainty || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_float(&serializer, vel_uncertainty[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_EXTERNAL_GNSS_UPDATE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_external_heading_update_command(mip_serializer* serializer, const mip_filter_external_heading_update_command* self) -{ - insert_float(serializer, self->heading); - - insert_float(serializer, self->heading_uncertainty); - - insert_u8(serializer, self->type); - -} -void extract_mip_filter_external_heading_update_command(mip_serializer* serializer, mip_filter_external_heading_update_command* self) -{ - extract_float(serializer, &self->heading); - - extract_float(serializer, &self->heading_uncertainty); - - extract_u8(serializer, &self->type); - -} - -mip_cmd_result mip_filter_external_heading_update(struct mip_interface* device, float heading, float heading_uncertainty, uint8_t type) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_float(&serializer, heading); - - insert_float(&serializer, heading_uncertainty); - - insert_u8(&serializer, type); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_EXTERNAL_HEADING_UPDATE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_external_heading_update_with_time_command(mip_serializer* serializer, const mip_filter_external_heading_update_with_time_command* self) -{ - insert_double(serializer, self->gps_time); - - insert_u16(serializer, self->gps_week); - - insert_float(serializer, self->heading); - - insert_float(serializer, self->heading_uncertainty); - - insert_u8(serializer, self->type); - -} -void extract_mip_filter_external_heading_update_with_time_command(mip_serializer* serializer, mip_filter_external_heading_update_with_time_command* self) -{ - extract_double(serializer, &self->gps_time); - - extract_u16(serializer, &self->gps_week); - - extract_float(serializer, &self->heading); - - extract_float(serializer, &self->heading_uncertainty); - - extract_u8(serializer, &self->type); - -} - -mip_cmd_result mip_filter_external_heading_update_with_time(struct mip_interface* device, double gps_time, uint16_t gps_week, float heading, float heading_uncertainty, uint8_t type) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_double(&serializer, gps_time); - - insert_u16(&serializer, gps_week); - - insert_float(&serializer, heading); - - insert_float(&serializer, heading_uncertainty); - - insert_u8(&serializer, type); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_EXTERNAL_HEADING_UPDATE_WITH_TIME, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_tare_orientation_command(mip_serializer* serializer, const mip_filter_tare_orientation_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_mip_filter_tare_orientation_command_mip_tare_axes(serializer, self->axes); - - } -} -void extract_mip_filter_tare_orientation_command(mip_serializer* serializer, mip_filter_tare_orientation_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_mip_filter_tare_orientation_command_mip_tare_axes(serializer, &self->axes); - - } -} - -void insert_mip_filter_tare_orientation_response(mip_serializer* serializer, const mip_filter_tare_orientation_response* self) -{ - insert_mip_filter_tare_orientation_command_mip_tare_axes(serializer, self->axes); - -} -void extract_mip_filter_tare_orientation_response(mip_serializer* serializer, mip_filter_tare_orientation_response* self) -{ - extract_mip_filter_tare_orientation_command_mip_tare_axes(serializer, &self->axes); - -} - -void insert_mip_filter_tare_orientation_command_mip_tare_axes(struct mip_serializer* serializer, const mip_filter_tare_orientation_command_mip_tare_axes self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_filter_tare_orientation_command_mip_tare_axes(struct mip_serializer* serializer, mip_filter_tare_orientation_command_mip_tare_axes* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -mip_cmd_result mip_filter_write_tare_orientation(struct mip_interface* device, mip_filter_tare_orientation_command_mip_tare_axes axes) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_mip_filter_tare_orientation_command_mip_tare_axes(&serializer, axes); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_TARE_ORIENTATION, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_tare_orientation(struct mip_interface* device, mip_filter_tare_orientation_command_mip_tare_axes* axes_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_TARE_ORIENTATION, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_TARE_ORIENTATION, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(axes_out); - extract_mip_filter_tare_orientation_command_mip_tare_axes(&deserializer, axes_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_tare_orientation(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_TARE_ORIENTATION, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_tare_orientation(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_TARE_ORIENTATION, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_tare_orientation(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_TARE_ORIENTATION, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_vehicle_dynamics_mode_command(mip_serializer* serializer, const mip_filter_vehicle_dynamics_mode_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_mip_filter_vehicle_dynamics_mode_command_dynamics_mode(serializer, self->mode); - - } -} -void extract_mip_filter_vehicle_dynamics_mode_command(mip_serializer* serializer, mip_filter_vehicle_dynamics_mode_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_mip_filter_vehicle_dynamics_mode_command_dynamics_mode(serializer, &self->mode); - - } -} - -void insert_mip_filter_vehicle_dynamics_mode_response(mip_serializer* serializer, const mip_filter_vehicle_dynamics_mode_response* self) -{ - insert_mip_filter_vehicle_dynamics_mode_command_dynamics_mode(serializer, self->mode); - -} -void extract_mip_filter_vehicle_dynamics_mode_response(mip_serializer* serializer, mip_filter_vehicle_dynamics_mode_response* self) -{ - extract_mip_filter_vehicle_dynamics_mode_command_dynamics_mode(serializer, &self->mode); - -} - -void insert_mip_filter_vehicle_dynamics_mode_command_dynamics_mode(struct mip_serializer* serializer, const mip_filter_vehicle_dynamics_mode_command_dynamics_mode self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_filter_vehicle_dynamics_mode_command_dynamics_mode(struct mip_serializer* serializer, mip_filter_vehicle_dynamics_mode_command_dynamics_mode* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -mip_cmd_result mip_filter_write_vehicle_dynamics_mode(struct mip_interface* device, mip_filter_vehicle_dynamics_mode_command_dynamics_mode mode) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_mip_filter_vehicle_dynamics_mode_command_dynamics_mode(&serializer, mode); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_VEHICLE_DYNAMICS_MODE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_vehicle_dynamics_mode(struct mip_interface* device, mip_filter_vehicle_dynamics_mode_command_dynamics_mode* mode_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_VEHICLE_DYNAMICS_MODE, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_VEHICLE_DYNAMICS_MODE, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(mode_out); - extract_mip_filter_vehicle_dynamics_mode_command_dynamics_mode(&deserializer, mode_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_vehicle_dynamics_mode(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_VEHICLE_DYNAMICS_MODE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_vehicle_dynamics_mode(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_VEHICLE_DYNAMICS_MODE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_vehicle_dynamics_mode(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_VEHICLE_DYNAMICS_MODE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_sensor_to_vehicle_rotation_euler_command(mip_serializer* serializer, const mip_filter_sensor_to_vehicle_rotation_euler_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_float(serializer, self->roll); - - insert_float(serializer, self->pitch); - - insert_float(serializer, self->yaw); - - } -} -void extract_mip_filter_sensor_to_vehicle_rotation_euler_command(mip_serializer* serializer, mip_filter_sensor_to_vehicle_rotation_euler_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_float(serializer, &self->roll); - - extract_float(serializer, &self->pitch); - - extract_float(serializer, &self->yaw); - - } -} - -void insert_mip_filter_sensor_to_vehicle_rotation_euler_response(mip_serializer* serializer, const mip_filter_sensor_to_vehicle_rotation_euler_response* self) -{ - insert_float(serializer, self->roll); - - insert_float(serializer, self->pitch); - - insert_float(serializer, self->yaw); - -} -void extract_mip_filter_sensor_to_vehicle_rotation_euler_response(mip_serializer* serializer, mip_filter_sensor_to_vehicle_rotation_euler_response* self) -{ - extract_float(serializer, &self->roll); - - extract_float(serializer, &self->pitch); - - extract_float(serializer, &self->yaw); - -} - -mip_cmd_result mip_filter_write_sensor_to_vehicle_rotation_euler(struct mip_interface* device, float roll, float pitch, float yaw) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_float(&serializer, roll); - - insert_float(&serializer, pitch); - - insert_float(&serializer, yaw); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_ROTATION_EULER, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_sensor_to_vehicle_rotation_euler(struct mip_interface* device, float* roll_out, float* pitch_out, float* yaw_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_ROTATION_EULER, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_SENSOR2VEHICLE_ROTATION_EULER, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(roll_out); - extract_float(&deserializer, roll_out); - - assert(pitch_out); - extract_float(&deserializer, pitch_out); - - assert(yaw_out); - extract_float(&deserializer, yaw_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_sensor_to_vehicle_rotation_euler(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_ROTATION_EULER, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_sensor_to_vehicle_rotation_euler(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_ROTATION_EULER, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_sensor_to_vehicle_rotation_euler(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_ROTATION_EULER, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_sensor_to_vehicle_rotation_dcm_command(mip_serializer* serializer, const mip_filter_sensor_to_vehicle_rotation_dcm_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 9; i++) - insert_float(serializer, self->dcm[i]); - - } -} -void extract_mip_filter_sensor_to_vehicle_rotation_dcm_command(mip_serializer* serializer, mip_filter_sensor_to_vehicle_rotation_dcm_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 9; i++) - extract_float(serializer, &self->dcm[i]); - - } -} - -void insert_mip_filter_sensor_to_vehicle_rotation_dcm_response(mip_serializer* serializer, const mip_filter_sensor_to_vehicle_rotation_dcm_response* self) -{ - for(unsigned int i=0; i < 9; i++) - insert_float(serializer, self->dcm[i]); - -} -void extract_mip_filter_sensor_to_vehicle_rotation_dcm_response(mip_serializer* serializer, mip_filter_sensor_to_vehicle_rotation_dcm_response* self) -{ - for(unsigned int i=0; i < 9; i++) - extract_float(serializer, &self->dcm[i]); - -} - -mip_cmd_result mip_filter_write_sensor_to_vehicle_rotation_dcm(struct mip_interface* device, const float* dcm) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - assert(dcm || (9 == 0)); - for(unsigned int i=0; i < 9; i++) - insert_float(&serializer, dcm[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_ROTATION_DCM, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_sensor_to_vehicle_rotation_dcm(struct mip_interface* device, float* dcm_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_ROTATION_DCM, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_SENSOR2VEHICLE_ROTATION_DCM, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(dcm_out || (9 == 0)); - for(unsigned int i=0; i < 9; i++) - extract_float(&deserializer, &dcm_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_sensor_to_vehicle_rotation_dcm(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_ROTATION_DCM, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_sensor_to_vehicle_rotation_dcm(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_ROTATION_DCM, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_sensor_to_vehicle_rotation_dcm(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_ROTATION_DCM, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_sensor_to_vehicle_rotation_quaternion_command(mip_serializer* serializer, const mip_filter_sensor_to_vehicle_rotation_quaternion_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 4; i++) - insert_float(serializer, self->quat[i]); - - } -} -void extract_mip_filter_sensor_to_vehicle_rotation_quaternion_command(mip_serializer* serializer, mip_filter_sensor_to_vehicle_rotation_quaternion_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 4; i++) - extract_float(serializer, &self->quat[i]); - - } -} - -void insert_mip_filter_sensor_to_vehicle_rotation_quaternion_response(mip_serializer* serializer, const mip_filter_sensor_to_vehicle_rotation_quaternion_response* self) -{ - for(unsigned int i=0; i < 4; i++) - insert_float(serializer, self->quat[i]); - -} -void extract_mip_filter_sensor_to_vehicle_rotation_quaternion_response(mip_serializer* serializer, mip_filter_sensor_to_vehicle_rotation_quaternion_response* self) -{ - for(unsigned int i=0; i < 4; i++) - extract_float(serializer, &self->quat[i]); - -} - -mip_cmd_result mip_filter_write_sensor_to_vehicle_rotation_quaternion(struct mip_interface* device, const float* quat) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - assert(quat || (4 == 0)); - for(unsigned int i=0; i < 4; i++) - insert_float(&serializer, quat[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_ROTATION_QUATERNION, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_sensor_to_vehicle_rotation_quaternion(struct mip_interface* device, float* quat_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_ROTATION_QUATERNION, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_SENSOR2VEHICLE_ROTATION_QUATERNION, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(quat_out || (4 == 0)); - for(unsigned int i=0; i < 4; i++) - extract_float(&deserializer, &quat_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_sensor_to_vehicle_rotation_quaternion(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_ROTATION_QUATERNION, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_sensor_to_vehicle_rotation_quaternion(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_ROTATION_QUATERNION, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_sensor_to_vehicle_rotation_quaternion(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_ROTATION_QUATERNION, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_sensor_to_vehicle_offset_command(mip_serializer* serializer, const mip_filter_sensor_to_vehicle_offset_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->offset[i]); - - } -} -void extract_mip_filter_sensor_to_vehicle_offset_command(mip_serializer* serializer, mip_filter_sensor_to_vehicle_offset_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->offset[i]); - - } -} - -void insert_mip_filter_sensor_to_vehicle_offset_response(mip_serializer* serializer, const mip_filter_sensor_to_vehicle_offset_response* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->offset[i]); - -} -void extract_mip_filter_sensor_to_vehicle_offset_response(mip_serializer* serializer, mip_filter_sensor_to_vehicle_offset_response* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->offset[i]); - -} - -mip_cmd_result mip_filter_write_sensor_to_vehicle_offset(struct mip_interface* device, const float* offset) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - assert(offset || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_float(&serializer, offset[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_sensor_to_vehicle_offset(struct mip_interface* device, float* offset_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_SENSOR2VEHICLE_OFFSET, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(offset_out || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - extract_float(&deserializer, &offset_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_sensor_to_vehicle_offset(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_sensor_to_vehicle_offset(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_sensor_to_vehicle_offset(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SENSOR2VEHICLE_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_antenna_offset_command(mip_serializer* serializer, const mip_filter_antenna_offset_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->offset[i]); - - } -} -void extract_mip_filter_antenna_offset_command(mip_serializer* serializer, mip_filter_antenna_offset_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->offset[i]); - - } -} - -void insert_mip_filter_antenna_offset_response(mip_serializer* serializer, const mip_filter_antenna_offset_response* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->offset[i]); - -} -void extract_mip_filter_antenna_offset_response(mip_serializer* serializer, mip_filter_antenna_offset_response* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->offset[i]); - -} - -mip_cmd_result mip_filter_write_antenna_offset(struct mip_interface* device, const float* offset) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - assert(offset || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_float(&serializer, offset[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ANTENNA_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_antenna_offset(struct mip_interface* device, float* offset_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ANTENNA_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_ANTENNA_OFFSET, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(offset_out || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - extract_float(&deserializer, &offset_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_antenna_offset(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ANTENNA_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_antenna_offset(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ANTENNA_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_antenna_offset(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ANTENNA_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_gnss_source_command(mip_serializer* serializer, const mip_filter_gnss_source_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_mip_filter_gnss_source_command_source(serializer, self->source); - - } -} -void extract_mip_filter_gnss_source_command(mip_serializer* serializer, mip_filter_gnss_source_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_mip_filter_gnss_source_command_source(serializer, &self->source); - - } -} - -void insert_mip_filter_gnss_source_response(mip_serializer* serializer, const mip_filter_gnss_source_response* self) -{ - insert_mip_filter_gnss_source_command_source(serializer, self->source); - -} -void extract_mip_filter_gnss_source_response(mip_serializer* serializer, mip_filter_gnss_source_response* self) -{ - extract_mip_filter_gnss_source_command_source(serializer, &self->source); - -} - -void insert_mip_filter_gnss_source_command_source(struct mip_serializer* serializer, const mip_filter_gnss_source_command_source self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_filter_gnss_source_command_source(struct mip_serializer* serializer, mip_filter_gnss_source_command_source* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -mip_cmd_result mip_filter_write_gnss_source(struct mip_interface* device, mip_filter_gnss_source_command_source source) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_mip_filter_gnss_source_command_source(&serializer, source); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GNSS_SOURCE_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_gnss_source(struct mip_interface* device, mip_filter_gnss_source_command_source* source_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GNSS_SOURCE_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_GNSS_SOURCE_CONTROL, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(source_out); - extract_mip_filter_gnss_source_command_source(&deserializer, source_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_gnss_source(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GNSS_SOURCE_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_gnss_source(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GNSS_SOURCE_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_gnss_source(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GNSS_SOURCE_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_heading_source_command(mip_serializer* serializer, const mip_filter_heading_source_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_mip_filter_heading_source_command_source(serializer, self->source); - - } -} -void extract_mip_filter_heading_source_command(mip_serializer* serializer, mip_filter_heading_source_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_mip_filter_heading_source_command_source(serializer, &self->source); - - } -} - -void insert_mip_filter_heading_source_response(mip_serializer* serializer, const mip_filter_heading_source_response* self) -{ - insert_mip_filter_heading_source_command_source(serializer, self->source); - -} -void extract_mip_filter_heading_source_response(mip_serializer* serializer, mip_filter_heading_source_response* self) -{ - extract_mip_filter_heading_source_command_source(serializer, &self->source); - -} - -void insert_mip_filter_heading_source_command_source(struct mip_serializer* serializer, const mip_filter_heading_source_command_source self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_filter_heading_source_command_source(struct mip_serializer* serializer, mip_filter_heading_source_command_source* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -mip_cmd_result mip_filter_write_heading_source(struct mip_interface* device, mip_filter_heading_source_command_source source) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_mip_filter_heading_source_command_source(&serializer, source); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_HEADING_UPDATE_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_heading_source(struct mip_interface* device, mip_filter_heading_source_command_source* source_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_HEADING_UPDATE_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_HEADING_UPDATE_CONTROL, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(source_out); - extract_mip_filter_heading_source_command_source(&deserializer, source_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_heading_source(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_HEADING_UPDATE_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_heading_source(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_HEADING_UPDATE_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_heading_source(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_HEADING_UPDATE_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_auto_init_control_command(mip_serializer* serializer, const mip_filter_auto_init_control_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_u8(serializer, self->enable); - - } -} -void extract_mip_filter_auto_init_control_command(mip_serializer* serializer, mip_filter_auto_init_control_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_u8(serializer, &self->enable); - - } -} - -void insert_mip_filter_auto_init_control_response(mip_serializer* serializer, const mip_filter_auto_init_control_response* self) -{ - insert_u8(serializer, self->enable); - -} -void extract_mip_filter_auto_init_control_response(mip_serializer* serializer, mip_filter_auto_init_control_response* self) -{ - extract_u8(serializer, &self->enable); - -} - -mip_cmd_result mip_filter_write_auto_init_control(struct mip_interface* device, uint8_t enable) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_u8(&serializer, enable); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_AUTOINIT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_auto_init_control(struct mip_interface* device, uint8_t* enable_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_AUTOINIT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_AUTOINIT_CONTROL, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(enable_out); - extract_u8(&deserializer, enable_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_auto_init_control(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_AUTOINIT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_auto_init_control(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_AUTOINIT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_auto_init_control(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_AUTOINIT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_accel_noise_command(mip_serializer* serializer, const mip_filter_accel_noise_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->noise[i]); - - } -} -void extract_mip_filter_accel_noise_command(mip_serializer* serializer, mip_filter_accel_noise_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->noise[i]); - - } -} - -void insert_mip_filter_accel_noise_response(mip_serializer* serializer, const mip_filter_accel_noise_response* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->noise[i]); - -} -void extract_mip_filter_accel_noise_response(mip_serializer* serializer, mip_filter_accel_noise_response* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->noise[i]); - -} - -mip_cmd_result mip_filter_write_accel_noise(struct mip_interface* device, const float* noise) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - assert(noise || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_float(&serializer, noise[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ACCEL_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_accel_noise(struct mip_interface* device, float* noise_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ACCEL_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_ACCEL_NOISE, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(noise_out || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - extract_float(&deserializer, &noise_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_accel_noise(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ACCEL_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_accel_noise(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ACCEL_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_accel_noise(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ACCEL_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_gyro_noise_command(mip_serializer* serializer, const mip_filter_gyro_noise_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->noise[i]); - - } -} -void extract_mip_filter_gyro_noise_command(mip_serializer* serializer, mip_filter_gyro_noise_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->noise[i]); - - } -} - -void insert_mip_filter_gyro_noise_response(mip_serializer* serializer, const mip_filter_gyro_noise_response* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->noise[i]); - -} -void extract_mip_filter_gyro_noise_response(mip_serializer* serializer, mip_filter_gyro_noise_response* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->noise[i]); - -} - -mip_cmd_result mip_filter_write_gyro_noise(struct mip_interface* device, const float* noise) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - assert(noise || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_float(&serializer, noise[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GYRO_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_gyro_noise(struct mip_interface* device, float* noise_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GYRO_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_GYRO_NOISE, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(noise_out || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - extract_float(&deserializer, &noise_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_gyro_noise(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GYRO_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_gyro_noise(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GYRO_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_gyro_noise(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GYRO_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_accel_bias_model_command(mip_serializer* serializer, const mip_filter_accel_bias_model_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->beta[i]); - - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->noise[i]); - - } -} -void extract_mip_filter_accel_bias_model_command(mip_serializer* serializer, mip_filter_accel_bias_model_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->beta[i]); - - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->noise[i]); - - } -} - -void insert_mip_filter_accel_bias_model_response(mip_serializer* serializer, const mip_filter_accel_bias_model_response* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->beta[i]); - - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->noise[i]); - -} -void extract_mip_filter_accel_bias_model_response(mip_serializer* serializer, mip_filter_accel_bias_model_response* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->beta[i]); - - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->noise[i]); - -} - -mip_cmd_result mip_filter_write_accel_bias_model(struct mip_interface* device, const float* beta, const float* noise) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - assert(beta || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_float(&serializer, beta[i]); - - assert(noise || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_float(&serializer, noise[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ACCEL_BIAS_MODEL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_accel_bias_model(struct mip_interface* device, float* beta_out, float* noise_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ACCEL_BIAS_MODEL, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_ACCEL_BIAS_MODEL, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(beta_out || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - extract_float(&deserializer, &beta_out[i]); - - assert(noise_out || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - extract_float(&deserializer, &noise_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_accel_bias_model(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ACCEL_BIAS_MODEL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_accel_bias_model(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ACCEL_BIAS_MODEL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_accel_bias_model(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ACCEL_BIAS_MODEL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_gyro_bias_model_command(mip_serializer* serializer, const mip_filter_gyro_bias_model_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->beta[i]); - - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->noise[i]); - - } -} -void extract_mip_filter_gyro_bias_model_command(mip_serializer* serializer, mip_filter_gyro_bias_model_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->beta[i]); - - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->noise[i]); - - } -} - -void insert_mip_filter_gyro_bias_model_response(mip_serializer* serializer, const mip_filter_gyro_bias_model_response* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->beta[i]); - - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->noise[i]); - -} -void extract_mip_filter_gyro_bias_model_response(mip_serializer* serializer, mip_filter_gyro_bias_model_response* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->beta[i]); - - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->noise[i]); - -} - -mip_cmd_result mip_filter_write_gyro_bias_model(struct mip_interface* device, const float* beta, const float* noise) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - assert(beta || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_float(&serializer, beta[i]); - - assert(noise || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_float(&serializer, noise[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GYRO_BIAS_MODEL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_gyro_bias_model(struct mip_interface* device, float* beta_out, float* noise_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GYRO_BIAS_MODEL, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_GYRO_BIAS_MODEL, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(beta_out || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - extract_float(&deserializer, &beta_out[i]); - - assert(noise_out || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - extract_float(&deserializer, &noise_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_gyro_bias_model(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GYRO_BIAS_MODEL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_gyro_bias_model(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GYRO_BIAS_MODEL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_gyro_bias_model(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GYRO_BIAS_MODEL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_altitude_aiding_command(mip_serializer* serializer, const mip_filter_altitude_aiding_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_mip_filter_altitude_aiding_command_aiding_selector(serializer, self->selector); - - } -} -void extract_mip_filter_altitude_aiding_command(mip_serializer* serializer, mip_filter_altitude_aiding_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_mip_filter_altitude_aiding_command_aiding_selector(serializer, &self->selector); - - } -} - -void insert_mip_filter_altitude_aiding_response(mip_serializer* serializer, const mip_filter_altitude_aiding_response* self) -{ - insert_mip_filter_altitude_aiding_command_aiding_selector(serializer, self->selector); - -} -void extract_mip_filter_altitude_aiding_response(mip_serializer* serializer, mip_filter_altitude_aiding_response* self) -{ - extract_mip_filter_altitude_aiding_command_aiding_selector(serializer, &self->selector); - -} - -void insert_mip_filter_altitude_aiding_command_aiding_selector(struct mip_serializer* serializer, const mip_filter_altitude_aiding_command_aiding_selector self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_filter_altitude_aiding_command_aiding_selector(struct mip_serializer* serializer, mip_filter_altitude_aiding_command_aiding_selector* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -mip_cmd_result mip_filter_write_altitude_aiding(struct mip_interface* device, mip_filter_altitude_aiding_command_aiding_selector selector) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_mip_filter_altitude_aiding_command_aiding_selector(&serializer, selector); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ALTITUDE_AIDING_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_altitude_aiding(struct mip_interface* device, mip_filter_altitude_aiding_command_aiding_selector* selector_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ALTITUDE_AIDING_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_ALTITUDE_AIDING_CONTROL, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(selector_out); - extract_mip_filter_altitude_aiding_command_aiding_selector(&deserializer, selector_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_altitude_aiding(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ALTITUDE_AIDING_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_altitude_aiding(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ALTITUDE_AIDING_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_altitude_aiding(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ALTITUDE_AIDING_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_pitch_roll_aiding_command(mip_serializer* serializer, const mip_filter_pitch_roll_aiding_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_mip_filter_pitch_roll_aiding_command_aiding_source(serializer, self->source); - - } -} -void extract_mip_filter_pitch_roll_aiding_command(mip_serializer* serializer, mip_filter_pitch_roll_aiding_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_mip_filter_pitch_roll_aiding_command_aiding_source(serializer, &self->source); - - } -} - -void insert_mip_filter_pitch_roll_aiding_response(mip_serializer* serializer, const mip_filter_pitch_roll_aiding_response* self) -{ - insert_mip_filter_pitch_roll_aiding_command_aiding_source(serializer, self->source); - -} -void extract_mip_filter_pitch_roll_aiding_response(mip_serializer* serializer, mip_filter_pitch_roll_aiding_response* self) -{ - extract_mip_filter_pitch_roll_aiding_command_aiding_source(serializer, &self->source); - -} - -void insert_mip_filter_pitch_roll_aiding_command_aiding_source(struct mip_serializer* serializer, const mip_filter_pitch_roll_aiding_command_aiding_source self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_filter_pitch_roll_aiding_command_aiding_source(struct mip_serializer* serializer, mip_filter_pitch_roll_aiding_command_aiding_source* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -mip_cmd_result mip_filter_write_pitch_roll_aiding(struct mip_interface* device, mip_filter_pitch_roll_aiding_command_aiding_source source) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_mip_filter_pitch_roll_aiding_command_aiding_source(&serializer, source); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SECONDARY_PITCH_ROLL_AIDING_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_pitch_roll_aiding(struct mip_interface* device, mip_filter_pitch_roll_aiding_command_aiding_source* source_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SECONDARY_PITCH_ROLL_AIDING_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_SECONDARY_PITCH_ROLL_AIDING_CONTROL, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(source_out); - extract_mip_filter_pitch_roll_aiding_command_aiding_source(&deserializer, source_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_pitch_roll_aiding(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SECONDARY_PITCH_ROLL_AIDING_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_pitch_roll_aiding(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SECONDARY_PITCH_ROLL_AIDING_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_pitch_roll_aiding(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SECONDARY_PITCH_ROLL_AIDING_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_auto_zupt_command(mip_serializer* serializer, const mip_filter_auto_zupt_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_u8(serializer, self->enable); - - insert_float(serializer, self->threshold); - - } -} -void extract_mip_filter_auto_zupt_command(mip_serializer* serializer, mip_filter_auto_zupt_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_u8(serializer, &self->enable); - - extract_float(serializer, &self->threshold); - - } -} - -void insert_mip_filter_auto_zupt_response(mip_serializer* serializer, const mip_filter_auto_zupt_response* self) -{ - insert_u8(serializer, self->enable); - - insert_float(serializer, self->threshold); - -} -void extract_mip_filter_auto_zupt_response(mip_serializer* serializer, mip_filter_auto_zupt_response* self) -{ - extract_u8(serializer, &self->enable); - - extract_float(serializer, &self->threshold); - -} - -mip_cmd_result mip_filter_write_auto_zupt(struct mip_interface* device, uint8_t enable, float threshold) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_u8(&serializer, enable); - - insert_float(&serializer, threshold); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ZUPT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_auto_zupt(struct mip_interface* device, uint8_t* enable_out, float* threshold_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ZUPT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_ZUPT_CONTROL, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(enable_out); - extract_u8(&deserializer, enable_out); - - assert(threshold_out); - extract_float(&deserializer, threshold_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_auto_zupt(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ZUPT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_auto_zupt(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ZUPT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_auto_zupt(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ZUPT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_auto_angular_zupt_command(mip_serializer* serializer, const mip_filter_auto_angular_zupt_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_u8(serializer, self->enable); - - insert_float(serializer, self->threshold); - - } -} -void extract_mip_filter_auto_angular_zupt_command(mip_serializer* serializer, mip_filter_auto_angular_zupt_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_u8(serializer, &self->enable); - - extract_float(serializer, &self->threshold); - - } -} - -void insert_mip_filter_auto_angular_zupt_response(mip_serializer* serializer, const mip_filter_auto_angular_zupt_response* self) -{ - insert_u8(serializer, self->enable); - - insert_float(serializer, self->threshold); - -} -void extract_mip_filter_auto_angular_zupt_response(mip_serializer* serializer, mip_filter_auto_angular_zupt_response* self) -{ - extract_u8(serializer, &self->enable); - - extract_float(serializer, &self->threshold); - -} - -mip_cmd_result mip_filter_write_auto_angular_zupt(struct mip_interface* device, uint8_t enable, float threshold) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_u8(&serializer, enable); - - insert_float(&serializer, threshold); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ANGULAR_ZUPT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_auto_angular_zupt(struct mip_interface* device, uint8_t* enable_out, float* threshold_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ANGULAR_ZUPT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_ANGULAR_ZUPT_CONTROL, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(enable_out); - extract_u8(&deserializer, enable_out); - - assert(threshold_out); - extract_float(&deserializer, threshold_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_auto_angular_zupt(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ANGULAR_ZUPT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_auto_angular_zupt(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ANGULAR_ZUPT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_auto_angular_zupt(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ANGULAR_ZUPT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_commanded_zupt(struct mip_interface* device) -{ - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_COMMANDED_ZUPT, NULL, 0); -} -mip_cmd_result mip_filter_commanded_angular_zupt(struct mip_interface* device) -{ - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_COMMANDED_ANGULAR_ZUPT, NULL, 0); -} -void insert_mip_filter_mag_capture_auto_cal_command(mip_serializer* serializer, const mip_filter_mag_capture_auto_cal_command* self) -{ - insert_mip_function_selector(serializer, self->function); - -} -void extract_mip_filter_mag_capture_auto_cal_command(mip_serializer* serializer, mip_filter_mag_capture_auto_cal_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - -} - -mip_cmd_result mip_filter_write_mag_capture_auto_cal(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAG_CAPTURE_AUTO_CALIBRATION, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_save_mag_capture_auto_cal(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAG_CAPTURE_AUTO_CALIBRATION, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_gravity_noise_command(mip_serializer* serializer, const mip_filter_gravity_noise_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->noise[i]); - - } -} -void extract_mip_filter_gravity_noise_command(mip_serializer* serializer, mip_filter_gravity_noise_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->noise[i]); - - } -} - -void insert_mip_filter_gravity_noise_response(mip_serializer* serializer, const mip_filter_gravity_noise_response* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->noise[i]); - -} -void extract_mip_filter_gravity_noise_response(mip_serializer* serializer, mip_filter_gravity_noise_response* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->noise[i]); - -} - -mip_cmd_result mip_filter_write_gravity_noise(struct mip_interface* device, const float* noise) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - assert(noise || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_float(&serializer, noise[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GRAVITY_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_gravity_noise(struct mip_interface* device, float* noise_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GRAVITY_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_GRAVITY_NOISE, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(noise_out || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - extract_float(&deserializer, &noise_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_gravity_noise(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GRAVITY_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_gravity_noise(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GRAVITY_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_gravity_noise(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_GRAVITY_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_pressure_altitude_noise_command(mip_serializer* serializer, const mip_filter_pressure_altitude_noise_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_float(serializer, self->noise); - - } -} -void extract_mip_filter_pressure_altitude_noise_command(mip_serializer* serializer, mip_filter_pressure_altitude_noise_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_float(serializer, &self->noise); - - } -} - -void insert_mip_filter_pressure_altitude_noise_response(mip_serializer* serializer, const mip_filter_pressure_altitude_noise_response* self) -{ - insert_float(serializer, self->noise); - -} -void extract_mip_filter_pressure_altitude_noise_response(mip_serializer* serializer, mip_filter_pressure_altitude_noise_response* self) -{ - extract_float(serializer, &self->noise); - -} - -mip_cmd_result mip_filter_write_pressure_altitude_noise(struct mip_interface* device, float noise) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_float(&serializer, noise); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_PRESSURE_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_pressure_altitude_noise(struct mip_interface* device, float* noise_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_PRESSURE_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_PRESSURE_NOISE, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(noise_out); - extract_float(&deserializer, noise_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_pressure_altitude_noise(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_PRESSURE_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_pressure_altitude_noise(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_PRESSURE_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_pressure_altitude_noise(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_PRESSURE_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_hard_iron_offset_noise_command(mip_serializer* serializer, const mip_filter_hard_iron_offset_noise_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->noise[i]); - - } -} -void extract_mip_filter_hard_iron_offset_noise_command(mip_serializer* serializer, mip_filter_hard_iron_offset_noise_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->noise[i]); - - } -} - -void insert_mip_filter_hard_iron_offset_noise_response(mip_serializer* serializer, const mip_filter_hard_iron_offset_noise_response* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->noise[i]); - -} -void extract_mip_filter_hard_iron_offset_noise_response(mip_serializer* serializer, mip_filter_hard_iron_offset_noise_response* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->noise[i]); - -} - -mip_cmd_result mip_filter_write_hard_iron_offset_noise(struct mip_interface* device, const float* noise) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - assert(noise || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_float(&serializer, noise[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_HARD_IRON_OFFSET_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_hard_iron_offset_noise(struct mip_interface* device, float* noise_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_HARD_IRON_OFFSET_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_HARD_IRON_OFFSET_NOISE, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(noise_out || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - extract_float(&deserializer, &noise_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_hard_iron_offset_noise(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_HARD_IRON_OFFSET_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_hard_iron_offset_noise(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_HARD_IRON_OFFSET_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_hard_iron_offset_noise(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_HARD_IRON_OFFSET_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_soft_iron_matrix_noise_command(mip_serializer* serializer, const mip_filter_soft_iron_matrix_noise_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 9; i++) - insert_float(serializer, self->noise[i]); - - } -} -void extract_mip_filter_soft_iron_matrix_noise_command(mip_serializer* serializer, mip_filter_soft_iron_matrix_noise_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 9; i++) - extract_float(serializer, &self->noise[i]); - - } -} - -void insert_mip_filter_soft_iron_matrix_noise_response(mip_serializer* serializer, const mip_filter_soft_iron_matrix_noise_response* self) -{ - for(unsigned int i=0; i < 9; i++) - insert_float(serializer, self->noise[i]); - -} -void extract_mip_filter_soft_iron_matrix_noise_response(mip_serializer* serializer, mip_filter_soft_iron_matrix_noise_response* self) -{ - for(unsigned int i=0; i < 9; i++) - extract_float(serializer, &self->noise[i]); - -} - -mip_cmd_result mip_filter_write_soft_iron_matrix_noise(struct mip_interface* device, const float* noise) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - assert(noise || (9 == 0)); - for(unsigned int i=0; i < 9; i++) - insert_float(&serializer, noise[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SOFT_IRON_MATRIX_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_soft_iron_matrix_noise(struct mip_interface* device, float* noise_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SOFT_IRON_MATRIX_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_SOFT_IRON_MATRIX_NOISE, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(noise_out || (9 == 0)); - for(unsigned int i=0; i < 9; i++) - extract_float(&deserializer, &noise_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_soft_iron_matrix_noise(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SOFT_IRON_MATRIX_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_soft_iron_matrix_noise(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SOFT_IRON_MATRIX_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_soft_iron_matrix_noise(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SOFT_IRON_MATRIX_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_mag_noise_command(mip_serializer* serializer, const mip_filter_mag_noise_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->noise[i]); - - } -} -void extract_mip_filter_mag_noise_command(mip_serializer* serializer, mip_filter_mag_noise_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->noise[i]); - - } -} - -void insert_mip_filter_mag_noise_response(mip_serializer* serializer, const mip_filter_mag_noise_response* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->noise[i]); - -} -void extract_mip_filter_mag_noise_response(mip_serializer* serializer, mip_filter_mag_noise_response* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->noise[i]); - -} - -mip_cmd_result mip_filter_write_mag_noise(struct mip_interface* device, const float* noise) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - assert(noise || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_float(&serializer, noise[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAG_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_mag_noise(struct mip_interface* device, float* noise_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAG_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_MAG_NOISE, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(noise_out || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - extract_float(&deserializer, &noise_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_mag_noise(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAG_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_mag_noise(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAG_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_mag_noise(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAG_NOISE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_inclination_source_command(mip_serializer* serializer, const mip_filter_inclination_source_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_mip_filter_mag_param_source(serializer, self->source); - - insert_float(serializer, self->inclination); - - } -} -void extract_mip_filter_inclination_source_command(mip_serializer* serializer, mip_filter_inclination_source_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_mip_filter_mag_param_source(serializer, &self->source); - - extract_float(serializer, &self->inclination); - - } -} - -void insert_mip_filter_inclination_source_response(mip_serializer* serializer, const mip_filter_inclination_source_response* self) -{ - insert_mip_filter_mag_param_source(serializer, self->source); - - insert_float(serializer, self->inclination); - -} -void extract_mip_filter_inclination_source_response(mip_serializer* serializer, mip_filter_inclination_source_response* self) -{ - extract_mip_filter_mag_param_source(serializer, &self->source); - - extract_float(serializer, &self->inclination); - -} - -mip_cmd_result mip_filter_write_inclination_source(struct mip_interface* device, mip_filter_mag_param_source source, float inclination) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_mip_filter_mag_param_source(&serializer, source); - - insert_float(&serializer, inclination); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_INCLINATION_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_inclination_source(struct mip_interface* device, mip_filter_mag_param_source* source_out, float* inclination_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_INCLINATION_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_INCLINATION_SOURCE, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(source_out); - extract_mip_filter_mag_param_source(&deserializer, source_out); - - assert(inclination_out); - extract_float(&deserializer, inclination_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_inclination_source(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_INCLINATION_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_inclination_source(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_INCLINATION_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_inclination_source(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_INCLINATION_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_magnetic_declination_source_command(mip_serializer* serializer, const mip_filter_magnetic_declination_source_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_mip_filter_mag_param_source(serializer, self->source); - - insert_float(serializer, self->declination); - - } -} -void extract_mip_filter_magnetic_declination_source_command(mip_serializer* serializer, mip_filter_magnetic_declination_source_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_mip_filter_mag_param_source(serializer, &self->source); - - extract_float(serializer, &self->declination); - - } -} - -void insert_mip_filter_magnetic_declination_source_response(mip_serializer* serializer, const mip_filter_magnetic_declination_source_response* self) -{ - insert_mip_filter_mag_param_source(serializer, self->source); - - insert_float(serializer, self->declination); - -} -void extract_mip_filter_magnetic_declination_source_response(mip_serializer* serializer, mip_filter_magnetic_declination_source_response* self) -{ - extract_mip_filter_mag_param_source(serializer, &self->source); - - extract_float(serializer, &self->declination); - -} - -mip_cmd_result mip_filter_write_magnetic_declination_source(struct mip_interface* device, mip_filter_mag_param_source source, float declination) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_mip_filter_mag_param_source(&serializer, source); - - insert_float(&serializer, declination); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_DECLINATION_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_magnetic_declination_source(struct mip_interface* device, mip_filter_mag_param_source* source_out, float* declination_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_DECLINATION_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_DECLINATION_SOURCE, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(source_out); - extract_mip_filter_mag_param_source(&deserializer, source_out); - - assert(declination_out); - extract_float(&deserializer, declination_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_magnetic_declination_source(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_DECLINATION_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_magnetic_declination_source(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_DECLINATION_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_magnetic_declination_source(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_DECLINATION_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_mag_field_magnitude_source_command(mip_serializer* serializer, const mip_filter_mag_field_magnitude_source_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_mip_filter_mag_param_source(serializer, self->source); - - insert_float(serializer, self->magnitude); - - } -} -void extract_mip_filter_mag_field_magnitude_source_command(mip_serializer* serializer, mip_filter_mag_field_magnitude_source_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_mip_filter_mag_param_source(serializer, &self->source); - - extract_float(serializer, &self->magnitude); - - } -} - -void insert_mip_filter_mag_field_magnitude_source_response(mip_serializer* serializer, const mip_filter_mag_field_magnitude_source_response* self) -{ - insert_mip_filter_mag_param_source(serializer, self->source); - - insert_float(serializer, self->magnitude); - -} -void extract_mip_filter_mag_field_magnitude_source_response(mip_serializer* serializer, mip_filter_mag_field_magnitude_source_response* self) -{ - extract_mip_filter_mag_param_source(serializer, &self->source); - - extract_float(serializer, &self->magnitude); - -} - -mip_cmd_result mip_filter_write_mag_field_magnitude_source(struct mip_interface* device, mip_filter_mag_param_source source, float magnitude) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_mip_filter_mag_param_source(&serializer, source); - - insert_float(&serializer, magnitude); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAGNETIC_MAGNITUDE_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_mag_field_magnitude_source(struct mip_interface* device, mip_filter_mag_param_source* source_out, float* magnitude_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAGNETIC_MAGNITUDE_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_MAGNETIC_MAGNITUDE_SOURCE, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(source_out); - extract_mip_filter_mag_param_source(&deserializer, source_out); - - assert(magnitude_out); - extract_float(&deserializer, magnitude_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_mag_field_magnitude_source(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAGNETIC_MAGNITUDE_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_mag_field_magnitude_source(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAGNETIC_MAGNITUDE_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_mag_field_magnitude_source(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAGNETIC_MAGNITUDE_SOURCE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_reference_position_command(mip_serializer* serializer, const mip_filter_reference_position_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_bool(serializer, self->enable); - - insert_double(serializer, self->latitude); - - insert_double(serializer, self->longitude); - - insert_double(serializer, self->altitude); - - } -} -void extract_mip_filter_reference_position_command(mip_serializer* serializer, mip_filter_reference_position_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_bool(serializer, &self->enable); - - extract_double(serializer, &self->latitude); - - extract_double(serializer, &self->longitude); - - extract_double(serializer, &self->altitude); - - } -} - -void insert_mip_filter_reference_position_response(mip_serializer* serializer, const mip_filter_reference_position_response* self) -{ - insert_bool(serializer, self->enable); - - insert_double(serializer, self->latitude); - - insert_double(serializer, self->longitude); - - insert_double(serializer, self->altitude); - -} -void extract_mip_filter_reference_position_response(mip_serializer* serializer, mip_filter_reference_position_response* self) -{ - extract_bool(serializer, &self->enable); - - extract_double(serializer, &self->latitude); - - extract_double(serializer, &self->longitude); - - extract_double(serializer, &self->altitude); - -} - -mip_cmd_result mip_filter_write_reference_position(struct mip_interface* device, bool enable, double latitude, double longitude, double altitude) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_bool(&serializer, enable); - - insert_double(&serializer, latitude); - - insert_double(&serializer, longitude); - - insert_double(&serializer, altitude); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_REFERENCE_POSITION, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_reference_position(struct mip_interface* device, bool* enable_out, double* latitude_out, double* longitude_out, double* altitude_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_REFERENCE_POSITION, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_REFERENCE_POSITION, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(enable_out); - extract_bool(&deserializer, enable_out); - - assert(latitude_out); - extract_double(&deserializer, latitude_out); - - assert(longitude_out); - extract_double(&deserializer, longitude_out); - - assert(altitude_out); - extract_double(&deserializer, altitude_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_reference_position(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_REFERENCE_POSITION, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_reference_position(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_REFERENCE_POSITION, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_reference_position(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_REFERENCE_POSITION, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_accel_magnitude_error_adaptive_measurement_command(mip_serializer* serializer, const mip_filter_accel_magnitude_error_adaptive_measurement_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_mip_filter_adaptive_measurement(serializer, self->adaptive_measurement); - - insert_float(serializer, self->frequency); - - insert_float(serializer, self->low_limit); - - insert_float(serializer, self->high_limit); - - insert_float(serializer, self->low_limit_uncertainty); - - insert_float(serializer, self->high_limit_uncertainty); - - insert_float(serializer, self->minimum_uncertainty); - - } -} -void extract_mip_filter_accel_magnitude_error_adaptive_measurement_command(mip_serializer* serializer, mip_filter_accel_magnitude_error_adaptive_measurement_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_mip_filter_adaptive_measurement(serializer, &self->adaptive_measurement); - - extract_float(serializer, &self->frequency); - - extract_float(serializer, &self->low_limit); - - extract_float(serializer, &self->high_limit); - - extract_float(serializer, &self->low_limit_uncertainty); - - extract_float(serializer, &self->high_limit_uncertainty); - - extract_float(serializer, &self->minimum_uncertainty); - - } -} - -void insert_mip_filter_accel_magnitude_error_adaptive_measurement_response(mip_serializer* serializer, const mip_filter_accel_magnitude_error_adaptive_measurement_response* self) -{ - insert_mip_filter_adaptive_measurement(serializer, self->adaptive_measurement); - - insert_float(serializer, self->frequency); - - insert_float(serializer, self->low_limit); - - insert_float(serializer, self->high_limit); - - insert_float(serializer, self->low_limit_uncertainty); - - insert_float(serializer, self->high_limit_uncertainty); - - insert_float(serializer, self->minimum_uncertainty); - -} -void extract_mip_filter_accel_magnitude_error_adaptive_measurement_response(mip_serializer* serializer, mip_filter_accel_magnitude_error_adaptive_measurement_response* self) -{ - extract_mip_filter_adaptive_measurement(serializer, &self->adaptive_measurement); - - extract_float(serializer, &self->frequency); - - extract_float(serializer, &self->low_limit); - - extract_float(serializer, &self->high_limit); - - extract_float(serializer, &self->low_limit_uncertainty); - - extract_float(serializer, &self->high_limit_uncertainty); - - extract_float(serializer, &self->minimum_uncertainty); - -} - -mip_cmd_result mip_filter_write_accel_magnitude_error_adaptive_measurement(struct mip_interface* device, mip_filter_adaptive_measurement adaptive_measurement, float frequency, float low_limit, float high_limit, float low_limit_uncertainty, float high_limit_uncertainty, float minimum_uncertainty) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_mip_filter_adaptive_measurement(&serializer, adaptive_measurement); - - insert_float(&serializer, frequency); - - insert_float(&serializer, low_limit); - - insert_float(&serializer, high_limit); - - insert_float(&serializer, low_limit_uncertainty); - - insert_float(&serializer, high_limit_uncertainty); - - insert_float(&serializer, minimum_uncertainty); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ACCEL_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_accel_magnitude_error_adaptive_measurement(struct mip_interface* device, mip_filter_adaptive_measurement* adaptive_measurement_out, float* frequency_out, float* low_limit_out, float* high_limit_out, float* low_limit_uncertainty_out, float* high_limit_uncertainty_out, float* minimum_uncertainty_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ACCEL_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_ACCEL_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(adaptive_measurement_out); - extract_mip_filter_adaptive_measurement(&deserializer, adaptive_measurement_out); - - assert(frequency_out); - extract_float(&deserializer, frequency_out); - - assert(low_limit_out); - extract_float(&deserializer, low_limit_out); - - assert(high_limit_out); - extract_float(&deserializer, high_limit_out); - - assert(low_limit_uncertainty_out); - extract_float(&deserializer, low_limit_uncertainty_out); - - assert(high_limit_uncertainty_out); - extract_float(&deserializer, high_limit_uncertainty_out); - - assert(minimum_uncertainty_out); - extract_float(&deserializer, minimum_uncertainty_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_accel_magnitude_error_adaptive_measurement(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ACCEL_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_accel_magnitude_error_adaptive_measurement(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ACCEL_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_accel_magnitude_error_adaptive_measurement(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ACCEL_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_mag_magnitude_error_adaptive_measurement_command(mip_serializer* serializer, const mip_filter_mag_magnitude_error_adaptive_measurement_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_mip_filter_adaptive_measurement(serializer, self->adaptive_measurement); - - insert_float(serializer, self->frequency); - - insert_float(serializer, self->low_limit); - - insert_float(serializer, self->high_limit); - - insert_float(serializer, self->low_limit_uncertainty); - - insert_float(serializer, self->high_limit_uncertainty); - - insert_float(serializer, self->minimum_uncertainty); - - } -} -void extract_mip_filter_mag_magnitude_error_adaptive_measurement_command(mip_serializer* serializer, mip_filter_mag_magnitude_error_adaptive_measurement_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_mip_filter_adaptive_measurement(serializer, &self->adaptive_measurement); - - extract_float(serializer, &self->frequency); - - extract_float(serializer, &self->low_limit); - - extract_float(serializer, &self->high_limit); - - extract_float(serializer, &self->low_limit_uncertainty); - - extract_float(serializer, &self->high_limit_uncertainty); - - extract_float(serializer, &self->minimum_uncertainty); - - } -} - -void insert_mip_filter_mag_magnitude_error_adaptive_measurement_response(mip_serializer* serializer, const mip_filter_mag_magnitude_error_adaptive_measurement_response* self) -{ - insert_mip_filter_adaptive_measurement(serializer, self->adaptive_measurement); - - insert_float(serializer, self->frequency); - - insert_float(serializer, self->low_limit); - - insert_float(serializer, self->high_limit); - - insert_float(serializer, self->low_limit_uncertainty); - - insert_float(serializer, self->high_limit_uncertainty); - - insert_float(serializer, self->minimum_uncertainty); - -} -void extract_mip_filter_mag_magnitude_error_adaptive_measurement_response(mip_serializer* serializer, mip_filter_mag_magnitude_error_adaptive_measurement_response* self) -{ - extract_mip_filter_adaptive_measurement(serializer, &self->adaptive_measurement); - - extract_float(serializer, &self->frequency); - - extract_float(serializer, &self->low_limit); - - extract_float(serializer, &self->high_limit); - - extract_float(serializer, &self->low_limit_uncertainty); - - extract_float(serializer, &self->high_limit_uncertainty); - - extract_float(serializer, &self->minimum_uncertainty); - -} - -mip_cmd_result mip_filter_write_mag_magnitude_error_adaptive_measurement(struct mip_interface* device, mip_filter_adaptive_measurement adaptive_measurement, float frequency, float low_limit, float high_limit, float low_limit_uncertainty, float high_limit_uncertainty, float minimum_uncertainty) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_mip_filter_adaptive_measurement(&serializer, adaptive_measurement); - - insert_float(&serializer, frequency); - - insert_float(&serializer, low_limit); - - insert_float(&serializer, high_limit); - - insert_float(&serializer, low_limit_uncertainty); - - insert_float(&serializer, high_limit_uncertainty); - - insert_float(&serializer, minimum_uncertainty); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAG_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_mag_magnitude_error_adaptive_measurement(struct mip_interface* device, mip_filter_adaptive_measurement* adaptive_measurement_out, float* frequency_out, float* low_limit_out, float* high_limit_out, float* low_limit_uncertainty_out, float* high_limit_uncertainty_out, float* minimum_uncertainty_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAG_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_MAG_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(adaptive_measurement_out); - extract_mip_filter_adaptive_measurement(&deserializer, adaptive_measurement_out); - - assert(frequency_out); - extract_float(&deserializer, frequency_out); - - assert(low_limit_out); - extract_float(&deserializer, low_limit_out); - - assert(high_limit_out); - extract_float(&deserializer, high_limit_out); - - assert(low_limit_uncertainty_out); - extract_float(&deserializer, low_limit_uncertainty_out); - - assert(high_limit_uncertainty_out); - extract_float(&deserializer, high_limit_uncertainty_out); - - assert(minimum_uncertainty_out); - extract_float(&deserializer, minimum_uncertainty_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_mag_magnitude_error_adaptive_measurement(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAG_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_mag_magnitude_error_adaptive_measurement(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAG_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_mag_magnitude_error_adaptive_measurement(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAG_MAGNITUDE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_mag_dip_angle_error_adaptive_measurement_command(mip_serializer* serializer, const mip_filter_mag_dip_angle_error_adaptive_measurement_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_bool(serializer, self->enable); - - insert_float(serializer, self->frequency); - - insert_float(serializer, self->high_limit); - - insert_float(serializer, self->high_limit_uncertainty); - - insert_float(serializer, self->minimum_uncertainty); - - } -} -void extract_mip_filter_mag_dip_angle_error_adaptive_measurement_command(mip_serializer* serializer, mip_filter_mag_dip_angle_error_adaptive_measurement_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_bool(serializer, &self->enable); - - extract_float(serializer, &self->frequency); - - extract_float(serializer, &self->high_limit); - - extract_float(serializer, &self->high_limit_uncertainty); - - extract_float(serializer, &self->minimum_uncertainty); - - } -} - -void insert_mip_filter_mag_dip_angle_error_adaptive_measurement_response(mip_serializer* serializer, const mip_filter_mag_dip_angle_error_adaptive_measurement_response* self) -{ - insert_bool(serializer, self->enable); - - insert_float(serializer, self->frequency); - - insert_float(serializer, self->high_limit); - - insert_float(serializer, self->high_limit_uncertainty); - - insert_float(serializer, self->minimum_uncertainty); - -} -void extract_mip_filter_mag_dip_angle_error_adaptive_measurement_response(mip_serializer* serializer, mip_filter_mag_dip_angle_error_adaptive_measurement_response* self) -{ - extract_bool(serializer, &self->enable); - - extract_float(serializer, &self->frequency); - - extract_float(serializer, &self->high_limit); - - extract_float(serializer, &self->high_limit_uncertainty); - - extract_float(serializer, &self->minimum_uncertainty); - -} - -mip_cmd_result mip_filter_write_mag_dip_angle_error_adaptive_measurement(struct mip_interface* device, bool enable, float frequency, float high_limit, float high_limit_uncertainty, float minimum_uncertainty) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_bool(&serializer, enable); - - insert_float(&serializer, frequency); - - insert_float(&serializer, high_limit); - - insert_float(&serializer, high_limit_uncertainty); - - insert_float(&serializer, minimum_uncertainty); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAG_DIP_ANGLE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_mag_dip_angle_error_adaptive_measurement(struct mip_interface* device, bool* enable_out, float* frequency_out, float* high_limit_out, float* high_limit_uncertainty_out, float* minimum_uncertainty_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAG_DIP_ANGLE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_MAG_DIP_ANGLE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(enable_out); - extract_bool(&deserializer, enable_out); - - assert(frequency_out); - extract_float(&deserializer, frequency_out); - - assert(high_limit_out); - extract_float(&deserializer, high_limit_out); - - assert(high_limit_uncertainty_out); - extract_float(&deserializer, high_limit_uncertainty_out); - - assert(minimum_uncertainty_out); - extract_float(&deserializer, minimum_uncertainty_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_mag_dip_angle_error_adaptive_measurement(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAG_DIP_ANGLE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_mag_dip_angle_error_adaptive_measurement(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAG_DIP_ANGLE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_mag_dip_angle_error_adaptive_measurement(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MAG_DIP_ANGLE_ERROR_ADAPTIVE_MEASUREMENT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_aiding_measurement_enable_command(mip_serializer* serializer, const mip_filter_aiding_measurement_enable_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - insert_mip_filter_aiding_measurement_enable_command_aiding_source(serializer, self->aiding_source); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_bool(serializer, self->enable); - - } -} -void extract_mip_filter_aiding_measurement_enable_command(mip_serializer* serializer, mip_filter_aiding_measurement_enable_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - extract_mip_filter_aiding_measurement_enable_command_aiding_source(serializer, &self->aiding_source); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_bool(serializer, &self->enable); - - } -} - -void insert_mip_filter_aiding_measurement_enable_response(mip_serializer* serializer, const mip_filter_aiding_measurement_enable_response* self) -{ - insert_mip_filter_aiding_measurement_enable_command_aiding_source(serializer, self->aiding_source); - - insert_bool(serializer, self->enable); - -} -void extract_mip_filter_aiding_measurement_enable_response(mip_serializer* serializer, mip_filter_aiding_measurement_enable_response* self) -{ - extract_mip_filter_aiding_measurement_enable_command_aiding_source(serializer, &self->aiding_source); - - extract_bool(serializer, &self->enable); - -} - -void insert_mip_filter_aiding_measurement_enable_command_aiding_source(struct mip_serializer* serializer, const mip_filter_aiding_measurement_enable_command_aiding_source self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_filter_aiding_measurement_enable_command_aiding_source(struct mip_serializer* serializer, mip_filter_aiding_measurement_enable_command_aiding_source* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -mip_cmd_result mip_filter_write_aiding_measurement_enable(struct mip_interface* device, mip_filter_aiding_measurement_enable_command_aiding_source aiding_source, bool enable) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_mip_filter_aiding_measurement_enable_command_aiding_source(&serializer, aiding_source); - - insert_bool(&serializer, enable); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_AIDING_MEASUREMENT_ENABLE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_aiding_measurement_enable(struct mip_interface* device, mip_filter_aiding_measurement_enable_command_aiding_source aiding_source, bool* enable_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - insert_mip_filter_aiding_measurement_enable_command_aiding_source(&serializer, aiding_source); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_AIDING_MEASUREMENT_ENABLE, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_AIDING_MEASUREMENT_ENABLE, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - extract_mip_filter_aiding_measurement_enable_command_aiding_source(&deserializer, &aiding_source); - - assert(enable_out); - extract_bool(&deserializer, enable_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_aiding_measurement_enable(struct mip_interface* device, mip_filter_aiding_measurement_enable_command_aiding_source aiding_source) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - insert_mip_filter_aiding_measurement_enable_command_aiding_source(&serializer, aiding_source); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_AIDING_MEASUREMENT_ENABLE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_aiding_measurement_enable(struct mip_interface* device, mip_filter_aiding_measurement_enable_command_aiding_source aiding_source) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - insert_mip_filter_aiding_measurement_enable_command_aiding_source(&serializer, aiding_source); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_AIDING_MEASUREMENT_ENABLE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_aiding_measurement_enable(struct mip_interface* device, mip_filter_aiding_measurement_enable_command_aiding_source aiding_source) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - insert_mip_filter_aiding_measurement_enable_command_aiding_source(&serializer, aiding_source); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_AIDING_MEASUREMENT_ENABLE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_run(struct mip_interface* device) -{ - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_RUN, NULL, 0); -} -void insert_mip_filter_kinematic_constraint_command(mip_serializer* serializer, const mip_filter_kinematic_constraint_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_u8(serializer, self->acceleration_constraint_selection); - - insert_u8(serializer, self->velocity_constraint_selection); - - insert_u8(serializer, self->angular_constraint_selection); - - } -} -void extract_mip_filter_kinematic_constraint_command(mip_serializer* serializer, mip_filter_kinematic_constraint_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_u8(serializer, &self->acceleration_constraint_selection); - - extract_u8(serializer, &self->velocity_constraint_selection); - - extract_u8(serializer, &self->angular_constraint_selection); - - } -} - -void insert_mip_filter_kinematic_constraint_response(mip_serializer* serializer, const mip_filter_kinematic_constraint_response* self) -{ - insert_u8(serializer, self->acceleration_constraint_selection); - - insert_u8(serializer, self->velocity_constraint_selection); - - insert_u8(serializer, self->angular_constraint_selection); - -} -void extract_mip_filter_kinematic_constraint_response(mip_serializer* serializer, mip_filter_kinematic_constraint_response* self) -{ - extract_u8(serializer, &self->acceleration_constraint_selection); - - extract_u8(serializer, &self->velocity_constraint_selection); - - extract_u8(serializer, &self->angular_constraint_selection); - -} - -mip_cmd_result mip_filter_write_kinematic_constraint(struct mip_interface* device, uint8_t acceleration_constraint_selection, uint8_t velocity_constraint_selection, uint8_t angular_constraint_selection) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_u8(&serializer, acceleration_constraint_selection); - - insert_u8(&serializer, velocity_constraint_selection); - - insert_u8(&serializer, angular_constraint_selection); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_KINEMATIC_CONSTRAINT, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_kinematic_constraint(struct mip_interface* device, uint8_t* acceleration_constraint_selection_out, uint8_t* velocity_constraint_selection_out, uint8_t* angular_constraint_selection_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_KINEMATIC_CONSTRAINT, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_KINEMATIC_CONSTRAINT, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(acceleration_constraint_selection_out); - extract_u8(&deserializer, acceleration_constraint_selection_out); - - assert(velocity_constraint_selection_out); - extract_u8(&deserializer, velocity_constraint_selection_out); - - assert(angular_constraint_selection_out); - extract_u8(&deserializer, angular_constraint_selection_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_kinematic_constraint(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_KINEMATIC_CONSTRAINT, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_kinematic_constraint(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_KINEMATIC_CONSTRAINT, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_kinematic_constraint(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_KINEMATIC_CONSTRAINT, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_initialization_configuration_command(mip_serializer* serializer, const mip_filter_initialization_configuration_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_u8(serializer, self->wait_for_run_command); - - insert_mip_filter_initialization_configuration_command_initial_condition_source(serializer, self->initial_cond_src); - - insert_mip_filter_initialization_configuration_command_alignment_selector(serializer, self->auto_heading_alignment_selector); - - insert_float(serializer, self->initial_heading); - - insert_float(serializer, self->initial_pitch); - - insert_float(serializer, self->initial_roll); - - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->initial_position[i]); - - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->initial_velocity[i]); - - insert_mip_filter_reference_frame(serializer, self->reference_frame_selector); - - } -} -void extract_mip_filter_initialization_configuration_command(mip_serializer* serializer, mip_filter_initialization_configuration_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_u8(serializer, &self->wait_for_run_command); - - extract_mip_filter_initialization_configuration_command_initial_condition_source(serializer, &self->initial_cond_src); - - extract_mip_filter_initialization_configuration_command_alignment_selector(serializer, &self->auto_heading_alignment_selector); - - extract_float(serializer, &self->initial_heading); - - extract_float(serializer, &self->initial_pitch); - - extract_float(serializer, &self->initial_roll); - - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->initial_position[i]); - - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->initial_velocity[i]); - - extract_mip_filter_reference_frame(serializer, &self->reference_frame_selector); - - } -} - -void insert_mip_filter_initialization_configuration_response(mip_serializer* serializer, const mip_filter_initialization_configuration_response* self) -{ - insert_u8(serializer, self->wait_for_run_command); - - insert_mip_filter_initialization_configuration_command_initial_condition_source(serializer, self->initial_cond_src); - - insert_mip_filter_initialization_configuration_command_alignment_selector(serializer, self->auto_heading_alignment_selector); - - insert_float(serializer, self->initial_heading); - - insert_float(serializer, self->initial_pitch); - - insert_float(serializer, self->initial_roll); - - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->initial_position[i]); - - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->initial_velocity[i]); - - insert_mip_filter_reference_frame(serializer, self->reference_frame_selector); - -} -void extract_mip_filter_initialization_configuration_response(mip_serializer* serializer, mip_filter_initialization_configuration_response* self) -{ - extract_u8(serializer, &self->wait_for_run_command); - - extract_mip_filter_initialization_configuration_command_initial_condition_source(serializer, &self->initial_cond_src); - - extract_mip_filter_initialization_configuration_command_alignment_selector(serializer, &self->auto_heading_alignment_selector); - - extract_float(serializer, &self->initial_heading); - - extract_float(serializer, &self->initial_pitch); - - extract_float(serializer, &self->initial_roll); - - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->initial_position[i]); - - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->initial_velocity[i]); - - extract_mip_filter_reference_frame(serializer, &self->reference_frame_selector); - -} - -void insert_mip_filter_initialization_configuration_command_alignment_selector(struct mip_serializer* serializer, const mip_filter_initialization_configuration_command_alignment_selector self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_filter_initialization_configuration_command_alignment_selector(struct mip_serializer* serializer, mip_filter_initialization_configuration_command_alignment_selector* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -void insert_mip_filter_initialization_configuration_command_initial_condition_source(struct mip_serializer* serializer, const mip_filter_initialization_configuration_command_initial_condition_source self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_filter_initialization_configuration_command_initial_condition_source(struct mip_serializer* serializer, mip_filter_initialization_configuration_command_initial_condition_source* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -mip_cmd_result mip_filter_write_initialization_configuration(struct mip_interface* device, uint8_t wait_for_run_command, mip_filter_initialization_configuration_command_initial_condition_source initial_cond_src, mip_filter_initialization_configuration_command_alignment_selector auto_heading_alignment_selector, float initial_heading, float initial_pitch, float initial_roll, const float* initial_position, const float* initial_velocity, mip_filter_reference_frame reference_frame_selector) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_u8(&serializer, wait_for_run_command); - - insert_mip_filter_initialization_configuration_command_initial_condition_source(&serializer, initial_cond_src); - - insert_mip_filter_initialization_configuration_command_alignment_selector(&serializer, auto_heading_alignment_selector); - - insert_float(&serializer, initial_heading); - - insert_float(&serializer, initial_pitch); - - insert_float(&serializer, initial_roll); - - assert(initial_position || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_float(&serializer, initial_position[i]); - - assert(initial_velocity || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_float(&serializer, initial_velocity[i]); - - insert_mip_filter_reference_frame(&serializer, reference_frame_selector); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_INITIALIZATION_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_initialization_configuration(struct mip_interface* device, uint8_t* wait_for_run_command_out, mip_filter_initialization_configuration_command_initial_condition_source* initial_cond_src_out, mip_filter_initialization_configuration_command_alignment_selector* auto_heading_alignment_selector_out, float* initial_heading_out, float* initial_pitch_out, float* initial_roll_out, float* initial_position_out, float* initial_velocity_out, mip_filter_reference_frame* reference_frame_selector_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_INITIALIZATION_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_INITIALIZATION_CONFIGURATION, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(wait_for_run_command_out); - extract_u8(&deserializer, wait_for_run_command_out); - - assert(initial_cond_src_out); - extract_mip_filter_initialization_configuration_command_initial_condition_source(&deserializer, initial_cond_src_out); - - assert(auto_heading_alignment_selector_out); - extract_mip_filter_initialization_configuration_command_alignment_selector(&deserializer, auto_heading_alignment_selector_out); - - assert(initial_heading_out); - extract_float(&deserializer, initial_heading_out); - - assert(initial_pitch_out); - extract_float(&deserializer, initial_pitch_out); - - assert(initial_roll_out); - extract_float(&deserializer, initial_roll_out); - - assert(initial_position_out || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - extract_float(&deserializer, &initial_position_out[i]); - - assert(initial_velocity_out || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - extract_float(&deserializer, &initial_velocity_out[i]); - - assert(reference_frame_selector_out); - extract_mip_filter_reference_frame(&deserializer, reference_frame_selector_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_initialization_configuration(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_INITIALIZATION_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_initialization_configuration(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_INITIALIZATION_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_initialization_configuration(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_INITIALIZATION_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_adaptive_filter_options_command(mip_serializer* serializer, const mip_filter_adaptive_filter_options_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_u8(serializer, self->level); - - insert_u16(serializer, self->time_limit); - - } -} -void extract_mip_filter_adaptive_filter_options_command(mip_serializer* serializer, mip_filter_adaptive_filter_options_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_u8(serializer, &self->level); - - extract_u16(serializer, &self->time_limit); - - } -} - -void insert_mip_filter_adaptive_filter_options_response(mip_serializer* serializer, const mip_filter_adaptive_filter_options_response* self) -{ - insert_u8(serializer, self->level); - - insert_u16(serializer, self->time_limit); - -} -void extract_mip_filter_adaptive_filter_options_response(mip_serializer* serializer, mip_filter_adaptive_filter_options_response* self) -{ - extract_u8(serializer, &self->level); - - extract_u16(serializer, &self->time_limit); - -} - -mip_cmd_result mip_filter_write_adaptive_filter_options(struct mip_interface* device, uint8_t level, uint16_t time_limit) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_u8(&serializer, level); - - insert_u16(&serializer, time_limit); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ADAPTIVE_FILTER_OPTIONS, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_adaptive_filter_options(struct mip_interface* device, uint8_t* level_out, uint16_t* time_limit_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ADAPTIVE_FILTER_OPTIONS, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_ADAPTIVE_FILTER_OPTIONS, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(level_out); - extract_u8(&deserializer, level_out); - - assert(time_limit_out); - extract_u16(&deserializer, time_limit_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_adaptive_filter_options(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ADAPTIVE_FILTER_OPTIONS, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_adaptive_filter_options(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ADAPTIVE_FILTER_OPTIONS, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_adaptive_filter_options(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_ADAPTIVE_FILTER_OPTIONS, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_multi_antenna_offset_command(mip_serializer* serializer, const mip_filter_multi_antenna_offset_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - insert_u8(serializer, self->receiver_id); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->antenna_offset[i]); - - } -} -void extract_mip_filter_multi_antenna_offset_command(mip_serializer* serializer, mip_filter_multi_antenna_offset_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - extract_u8(serializer, &self->receiver_id); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->antenna_offset[i]); - - } -} - -void insert_mip_filter_multi_antenna_offset_response(mip_serializer* serializer, const mip_filter_multi_antenna_offset_response* self) -{ - insert_u8(serializer, self->receiver_id); - - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->antenna_offset[i]); - -} -void extract_mip_filter_multi_antenna_offset_response(mip_serializer* serializer, mip_filter_multi_antenna_offset_response* self) -{ - extract_u8(serializer, &self->receiver_id); - - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->antenna_offset[i]); - -} - -mip_cmd_result mip_filter_write_multi_antenna_offset(struct mip_interface* device, uint8_t receiver_id, const float* antenna_offset) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_u8(&serializer, receiver_id); - - assert(antenna_offset || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_float(&serializer, antenna_offset[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MULTI_ANTENNA_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_multi_antenna_offset(struct mip_interface* device, uint8_t receiver_id, float* antenna_offset_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - insert_u8(&serializer, receiver_id); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MULTI_ANTENNA_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_MULTI_ANTENNA_OFFSET, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - extract_u8(&deserializer, &receiver_id); - - assert(antenna_offset_out || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - extract_float(&deserializer, &antenna_offset_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_multi_antenna_offset(struct mip_interface* device, uint8_t receiver_id) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - insert_u8(&serializer, receiver_id); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MULTI_ANTENNA_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_multi_antenna_offset(struct mip_interface* device, uint8_t receiver_id) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - insert_u8(&serializer, receiver_id); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MULTI_ANTENNA_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_multi_antenna_offset(struct mip_interface* device, uint8_t receiver_id) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - insert_u8(&serializer, receiver_id); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_MULTI_ANTENNA_OFFSET, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_rel_pos_configuration_command(mip_serializer* serializer, const mip_filter_rel_pos_configuration_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_u8(serializer, self->source); - - insert_mip_filter_reference_frame(serializer, self->reference_frame_selector); - - for(unsigned int i=0; i < 3; i++) - insert_double(serializer, self->reference_coordinates[i]); - - } -} -void extract_mip_filter_rel_pos_configuration_command(mip_serializer* serializer, mip_filter_rel_pos_configuration_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_u8(serializer, &self->source); - - extract_mip_filter_reference_frame(serializer, &self->reference_frame_selector); - - for(unsigned int i=0; i < 3; i++) - extract_double(serializer, &self->reference_coordinates[i]); - - } -} - -void insert_mip_filter_rel_pos_configuration_response(mip_serializer* serializer, const mip_filter_rel_pos_configuration_response* self) -{ - insert_u8(serializer, self->source); - - insert_mip_filter_reference_frame(serializer, self->reference_frame_selector); - - for(unsigned int i=0; i < 3; i++) - insert_double(serializer, self->reference_coordinates[i]); - -} -void extract_mip_filter_rel_pos_configuration_response(mip_serializer* serializer, mip_filter_rel_pos_configuration_response* self) -{ - extract_u8(serializer, &self->source); - - extract_mip_filter_reference_frame(serializer, &self->reference_frame_selector); - - for(unsigned int i=0; i < 3; i++) - extract_double(serializer, &self->reference_coordinates[i]); - -} - -mip_cmd_result mip_filter_write_rel_pos_configuration(struct mip_interface* device, uint8_t source, mip_filter_reference_frame reference_frame_selector, const double* reference_coordinates) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_u8(&serializer, source); - - insert_mip_filter_reference_frame(&serializer, reference_frame_selector); - - assert(reference_coordinates || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_double(&serializer, reference_coordinates[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_REL_POS_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_rel_pos_configuration(struct mip_interface* device, uint8_t* source_out, mip_filter_reference_frame* reference_frame_selector_out, double* reference_coordinates_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_REL_POS_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_REL_POS_CONFIGURATION, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(source_out); - extract_u8(&deserializer, source_out); - - assert(reference_frame_selector_out); - extract_mip_filter_reference_frame(&deserializer, reference_frame_selector_out); - - assert(reference_coordinates_out || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - extract_double(&deserializer, &reference_coordinates_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_rel_pos_configuration(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_REL_POS_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_rel_pos_configuration(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_REL_POS_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_rel_pos_configuration(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_REL_POS_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_ref_point_lever_arm_command(mip_serializer* serializer, const mip_filter_ref_point_lever_arm_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_mip_filter_ref_point_lever_arm_command_reference_point_selector(serializer, self->ref_point_sel); - - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->lever_arm_offset[i]); - - } -} -void extract_mip_filter_ref_point_lever_arm_command(mip_serializer* serializer, mip_filter_ref_point_lever_arm_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_mip_filter_ref_point_lever_arm_command_reference_point_selector(serializer, &self->ref_point_sel); - - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->lever_arm_offset[i]); - - } -} - -void insert_mip_filter_ref_point_lever_arm_response(mip_serializer* serializer, const mip_filter_ref_point_lever_arm_response* self) -{ - insert_mip_filter_ref_point_lever_arm_command_reference_point_selector(serializer, self->ref_point_sel); - - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->lever_arm_offset[i]); - -} -void extract_mip_filter_ref_point_lever_arm_response(mip_serializer* serializer, mip_filter_ref_point_lever_arm_response* self) -{ - extract_mip_filter_ref_point_lever_arm_command_reference_point_selector(serializer, &self->ref_point_sel); - - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->lever_arm_offset[i]); - -} - -void insert_mip_filter_ref_point_lever_arm_command_reference_point_selector(struct mip_serializer* serializer, const mip_filter_ref_point_lever_arm_command_reference_point_selector self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_filter_ref_point_lever_arm_command_reference_point_selector(struct mip_serializer* serializer, mip_filter_ref_point_lever_arm_command_reference_point_selector* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -mip_cmd_result mip_filter_write_ref_point_lever_arm(struct mip_interface* device, mip_filter_ref_point_lever_arm_command_reference_point_selector ref_point_sel, const float* lever_arm_offset) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_mip_filter_ref_point_lever_arm_command_reference_point_selector(&serializer, ref_point_sel); - - assert(lever_arm_offset || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_float(&serializer, lever_arm_offset[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_REF_POINT_LEVER_ARM, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_ref_point_lever_arm(struct mip_interface* device, mip_filter_ref_point_lever_arm_command_reference_point_selector* ref_point_sel_out, float* lever_arm_offset_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_REF_POINT_LEVER_ARM, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_REF_POINT_LEVER_ARM, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(ref_point_sel_out); - extract_mip_filter_ref_point_lever_arm_command_reference_point_selector(&deserializer, ref_point_sel_out); - - assert(lever_arm_offset_out || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - extract_float(&deserializer, &lever_arm_offset_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_ref_point_lever_arm(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_REF_POINT_LEVER_ARM, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_ref_point_lever_arm(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_REF_POINT_LEVER_ARM, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_ref_point_lever_arm(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_REF_POINT_LEVER_ARM, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_speed_measurement_command(mip_serializer* serializer, const mip_filter_speed_measurement_command* self) -{ - insert_u8(serializer, self->source); - - insert_float(serializer, self->time_of_week); - - insert_float(serializer, self->speed); - - insert_float(serializer, self->speed_uncertainty); - -} -void extract_mip_filter_speed_measurement_command(mip_serializer* serializer, mip_filter_speed_measurement_command* self) -{ - extract_u8(serializer, &self->source); - - extract_float(serializer, &self->time_of_week); - - extract_float(serializer, &self->speed); - - extract_float(serializer, &self->speed_uncertainty); - -} - -mip_cmd_result mip_filter_speed_measurement(struct mip_interface* device, uint8_t source, float time_of_week, float speed, float speed_uncertainty) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_u8(&serializer, source); - - insert_float(&serializer, time_of_week); - - insert_float(&serializer, speed); - - insert_float(&serializer, speed_uncertainty); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SPEED_MEASUREMENT, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_speed_lever_arm_command(mip_serializer* serializer, const mip_filter_speed_lever_arm_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - insert_u8(serializer, self->source); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->lever_arm_offset[i]); - - } -} -void extract_mip_filter_speed_lever_arm_command(mip_serializer* serializer, mip_filter_speed_lever_arm_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - extract_u8(serializer, &self->source); - - if( self->function == MIP_FUNCTION_WRITE ) - { - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->lever_arm_offset[i]); - - } -} - -void insert_mip_filter_speed_lever_arm_response(mip_serializer* serializer, const mip_filter_speed_lever_arm_response* self) -{ - insert_u8(serializer, self->source); - - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->lever_arm_offset[i]); - -} -void extract_mip_filter_speed_lever_arm_response(mip_serializer* serializer, mip_filter_speed_lever_arm_response* self) -{ - extract_u8(serializer, &self->source); - - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->lever_arm_offset[i]); - -} - -mip_cmd_result mip_filter_write_speed_lever_arm(struct mip_interface* device, uint8_t source, const float* lever_arm_offset) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_u8(&serializer, source); - - assert(lever_arm_offset || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_float(&serializer, lever_arm_offset[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SPEED_LEVER_ARM, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_speed_lever_arm(struct mip_interface* device, uint8_t source, float* lever_arm_offset_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - insert_u8(&serializer, source); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SPEED_LEVER_ARM, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_FILTER_SPEED_LEVER_ARM, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - extract_u8(&deserializer, &source); - - assert(lever_arm_offset_out || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - extract_float(&deserializer, &lever_arm_offset_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_speed_lever_arm(struct mip_interface* device, uint8_t source) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - insert_u8(&serializer, source); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SPEED_LEVER_ARM, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_speed_lever_arm(struct mip_interface* device, uint8_t source) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - insert_u8(&serializer, source); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SPEED_LEVER_ARM, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_speed_lever_arm(struct mip_interface* device, uint8_t source) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - insert_u8(&serializer, source); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SPEED_LEVER_ARM, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_wheeled_vehicle_constraint_control_command(mip_serializer* serializer, const mip_filter_wheeled_vehicle_constraint_control_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_u8(serializer, self->enable); - - } -} -void extract_mip_filter_wheeled_vehicle_constraint_control_command(mip_serializer* serializer, mip_filter_wheeled_vehicle_constraint_control_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_u8(serializer, &self->enable); - - } -} - -void insert_mip_filter_wheeled_vehicle_constraint_control_response(mip_serializer* serializer, const mip_filter_wheeled_vehicle_constraint_control_response* self) -{ - insert_u8(serializer, self->enable); - -} -void extract_mip_filter_wheeled_vehicle_constraint_control_response(mip_serializer* serializer, mip_filter_wheeled_vehicle_constraint_control_response* self) -{ - extract_u8(serializer, &self->enable); - -} - -mip_cmd_result mip_filter_write_wheeled_vehicle_constraint_control(struct mip_interface* device, uint8_t enable) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_u8(&serializer, enable); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_WHEELED_VEHICLE_CONSTRAINT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_wheeled_vehicle_constraint_control(struct mip_interface* device, uint8_t* enable_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_WHEELED_VEHICLE_CONSTRAINT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_WHEELED_VEHICLE_CONSTRAINT_CONTROL, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(enable_out); - extract_u8(&deserializer, enable_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_wheeled_vehicle_constraint_control(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_WHEELED_VEHICLE_CONSTRAINT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_wheeled_vehicle_constraint_control(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_WHEELED_VEHICLE_CONSTRAINT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_wheeled_vehicle_constraint_control(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_WHEELED_VEHICLE_CONSTRAINT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_vertical_gyro_constraint_control_command(mip_serializer* serializer, const mip_filter_vertical_gyro_constraint_control_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_u8(serializer, self->enable); - - } -} -void extract_mip_filter_vertical_gyro_constraint_control_command(mip_serializer* serializer, mip_filter_vertical_gyro_constraint_control_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_u8(serializer, &self->enable); - - } -} - -void insert_mip_filter_vertical_gyro_constraint_control_response(mip_serializer* serializer, const mip_filter_vertical_gyro_constraint_control_response* self) -{ - insert_u8(serializer, self->enable); - -} -void extract_mip_filter_vertical_gyro_constraint_control_response(mip_serializer* serializer, mip_filter_vertical_gyro_constraint_control_response* self) -{ - extract_u8(serializer, &self->enable); - -} - -mip_cmd_result mip_filter_write_vertical_gyro_constraint_control(struct mip_interface* device, uint8_t enable) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_u8(&serializer, enable); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_VERTICAL_GYRO_CONSTRAINT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_vertical_gyro_constraint_control(struct mip_interface* device, uint8_t* enable_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_VERTICAL_GYRO_CONSTRAINT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_VERTICAL_GYRO_CONSTRAINT_CONTROL, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(enable_out); - extract_u8(&deserializer, enable_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_vertical_gyro_constraint_control(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_VERTICAL_GYRO_CONSTRAINT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_vertical_gyro_constraint_control(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_VERTICAL_GYRO_CONSTRAINT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_vertical_gyro_constraint_control(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_VERTICAL_GYRO_CONSTRAINT_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_gnss_antenna_cal_control_command(mip_serializer* serializer, const mip_filter_gnss_antenna_cal_control_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_u8(serializer, self->enable); - - insert_float(serializer, self->max_offset); - - } -} -void extract_mip_filter_gnss_antenna_cal_control_command(mip_serializer* serializer, mip_filter_gnss_antenna_cal_control_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_u8(serializer, &self->enable); - - extract_float(serializer, &self->max_offset); - - } -} - -void insert_mip_filter_gnss_antenna_cal_control_response(mip_serializer* serializer, const mip_filter_gnss_antenna_cal_control_response* self) -{ - insert_u8(serializer, self->enable); - - insert_float(serializer, self->max_offset); - -} -void extract_mip_filter_gnss_antenna_cal_control_response(mip_serializer* serializer, mip_filter_gnss_antenna_cal_control_response* self) -{ - extract_u8(serializer, &self->enable); - - extract_float(serializer, &self->max_offset); - -} - -mip_cmd_result mip_filter_write_gnss_antenna_cal_control(struct mip_interface* device, uint8_t enable, float max_offset) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_u8(&serializer, enable); - - insert_float(&serializer, max_offset); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_GNSS_ANTENNA_CALIBRATION_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_read_gnss_antenna_cal_control(struct mip_interface* device, uint8_t* enable_out, float* max_offset_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_GNSS_ANTENNA_CALIBRATION_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_GNSS_ANTENNA_CALIBRATION_CONTROL, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(enable_out); - extract_u8(&deserializer, enable_out); - - assert(max_offset_out); - extract_float(&deserializer, max_offset_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_filter_save_gnss_antenna_cal_control(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_GNSS_ANTENNA_CALIBRATION_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_load_gnss_antenna_cal_control(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_GNSS_ANTENNA_CALIBRATION_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_filter_default_gnss_antenna_cal_control(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_GNSS_ANTENNA_CALIBRATION_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_filter_set_initial_heading_command(mip_serializer* serializer, const mip_filter_set_initial_heading_command* self) -{ - insert_float(serializer, self->heading); - -} -void extract_mip_filter_set_initial_heading_command(mip_serializer* serializer, mip_filter_set_initial_heading_command* self) -{ - extract_float(serializer, &self->heading); - -} - -mip_cmd_result mip_filter_set_initial_heading(struct mip_interface* device, float heading) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_float(&serializer, heading); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_FILTER_CMD_DESC_SET, MIP_CMD_DESC_FILTER_SET_INITIAL_HEADING, buffer, (uint8_t)mip_serializer_length(&serializer)); -} - -#ifdef __cplusplus -} // namespace C -} // namespace mip -} // extern "C" -#endif // __cplusplus - diff --git a/src/mip/definitions/commands_gnss.c b/src/mip/definitions/commands_gnss.c deleted file mode 100644 index cb41c03a3..000000000 --- a/src/mip/definitions/commands_gnss.c +++ /dev/null @@ -1,376 +0,0 @@ - -#include "commands_gnss.h" - -#include "../utils/serialization.h" -#include "../mip_interface.h" - -#include - - -#ifdef __cplusplus -namespace mip { -namespace C { -extern "C" { - -#endif // __cplusplus -struct mip_interface; -struct mip_serializer; -struct mip_field; - - -//////////////////////////////////////////////////////////////////////////////// -// Shared Type Definitions -//////////////////////////////////////////////////////////////////////////////// - - -//////////////////////////////////////////////////////////////////////////////// -// Mip Fields -//////////////////////////////////////////////////////////////////////////////// - -void insert_mip_gnss_receiver_info_command_info(mip_serializer* serializer, const mip_gnss_receiver_info_command_info* self) -{ - insert_u8(serializer, self->receiver_id); - - insert_u8(serializer, self->mip_data_descriptor_set); - - for(unsigned int i=0; i < 32; i++) - insert_char(serializer, self->description[i]); - -} -void extract_mip_gnss_receiver_info_command_info(mip_serializer* serializer, mip_gnss_receiver_info_command_info* self) -{ - extract_u8(serializer, &self->receiver_id); - - extract_u8(serializer, &self->mip_data_descriptor_set); - - for(unsigned int i=0; i < 32; i++) - extract_char(serializer, &self->description[i]); - -} - -mip_cmd_result mip_gnss_receiver_info(struct mip_interface* device, uint8_t* num_receivers_out, uint8_t num_receivers_out_max, mip_gnss_receiver_info_command_info* receiver_info_out) -{ - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - uint8_t responseLength = sizeof(buffer); - - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_GNSS_CMD_DESC_SET, MIP_CMD_DESC_GNSS_LIST_RECEIVERS, NULL, 0, MIP_REPLY_DESC_GNSS_LIST_RECEIVERS, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(num_receivers_out); - extract_count(&deserializer, num_receivers_out, num_receivers_out_max); - - assert(receiver_info_out || (num_receivers_out == 0)); - for(unsigned int i=0; i < *num_receivers_out; i++) - extract_mip_gnss_receiver_info_command_info(&deserializer, &receiver_info_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -void insert_mip_gnss_signal_configuration_command(mip_serializer* serializer, const mip_gnss_signal_configuration_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_u8(serializer, self->gps_enable); - - insert_u8(serializer, self->glonass_enable); - - insert_u8(serializer, self->galileo_enable); - - insert_u8(serializer, self->beidou_enable); - - for(unsigned int i=0; i < 4; i++) - insert_u8(serializer, self->reserved[i]); - - } -} -void extract_mip_gnss_signal_configuration_command(mip_serializer* serializer, mip_gnss_signal_configuration_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_u8(serializer, &self->gps_enable); - - extract_u8(serializer, &self->glonass_enable); - - extract_u8(serializer, &self->galileo_enable); - - extract_u8(serializer, &self->beidou_enable); - - for(unsigned int i=0; i < 4; i++) - extract_u8(serializer, &self->reserved[i]); - - } -} - -void insert_mip_gnss_signal_configuration_response(mip_serializer* serializer, const mip_gnss_signal_configuration_response* self) -{ - insert_u8(serializer, self->gps_enable); - - insert_u8(serializer, self->glonass_enable); - - insert_u8(serializer, self->galileo_enable); - - insert_u8(serializer, self->beidou_enable); - - for(unsigned int i=0; i < 4; i++) - insert_u8(serializer, self->reserved[i]); - -} -void extract_mip_gnss_signal_configuration_response(mip_serializer* serializer, mip_gnss_signal_configuration_response* self) -{ - extract_u8(serializer, &self->gps_enable); - - extract_u8(serializer, &self->glonass_enable); - - extract_u8(serializer, &self->galileo_enable); - - extract_u8(serializer, &self->beidou_enable); - - for(unsigned int i=0; i < 4; i++) - extract_u8(serializer, &self->reserved[i]); - -} - -mip_cmd_result mip_gnss_write_signal_configuration(struct mip_interface* device, uint8_t gps_enable, uint8_t glonass_enable, uint8_t galileo_enable, uint8_t beidou_enable, const uint8_t* reserved) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_u8(&serializer, gps_enable); - - insert_u8(&serializer, glonass_enable); - - insert_u8(&serializer, galileo_enable); - - insert_u8(&serializer, beidou_enable); - - assert(reserved || (4 == 0)); - for(unsigned int i=0; i < 4; i++) - insert_u8(&serializer, reserved[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_GNSS_CMD_DESC_SET, MIP_CMD_DESC_GNSS_SIGNAL_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_gnss_read_signal_configuration(struct mip_interface* device, uint8_t* gps_enable_out, uint8_t* glonass_enable_out, uint8_t* galileo_enable_out, uint8_t* beidou_enable_out, uint8_t* reserved_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_GNSS_CMD_DESC_SET, MIP_CMD_DESC_GNSS_SIGNAL_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_GNSS_SIGNAL_CONFIGURATION, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(gps_enable_out); - extract_u8(&deserializer, gps_enable_out); - - assert(glonass_enable_out); - extract_u8(&deserializer, glonass_enable_out); - - assert(galileo_enable_out); - extract_u8(&deserializer, galileo_enable_out); - - assert(beidou_enable_out); - extract_u8(&deserializer, beidou_enable_out); - - assert(reserved_out || (4 == 0)); - for(unsigned int i=0; i < 4; i++) - extract_u8(&deserializer, &reserved_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_gnss_save_signal_configuration(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_GNSS_CMD_DESC_SET, MIP_CMD_DESC_GNSS_SIGNAL_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_gnss_load_signal_configuration(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_GNSS_CMD_DESC_SET, MIP_CMD_DESC_GNSS_SIGNAL_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_gnss_default_signal_configuration(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_GNSS_CMD_DESC_SET, MIP_CMD_DESC_GNSS_SIGNAL_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_gnss_rtk_dongle_configuration_command(mip_serializer* serializer, const mip_gnss_rtk_dongle_configuration_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_u8(serializer, self->enable); - - for(unsigned int i=0; i < 3; i++) - insert_u8(serializer, self->reserved[i]); - - } -} -void extract_mip_gnss_rtk_dongle_configuration_command(mip_serializer* serializer, mip_gnss_rtk_dongle_configuration_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_u8(serializer, &self->enable); - - for(unsigned int i=0; i < 3; i++) - extract_u8(serializer, &self->reserved[i]); - - } -} - -void insert_mip_gnss_rtk_dongle_configuration_response(mip_serializer* serializer, const mip_gnss_rtk_dongle_configuration_response* self) -{ - insert_u8(serializer, self->enable); - - for(unsigned int i=0; i < 3; i++) - insert_u8(serializer, self->reserved[i]); - -} -void extract_mip_gnss_rtk_dongle_configuration_response(mip_serializer* serializer, mip_gnss_rtk_dongle_configuration_response* self) -{ - extract_u8(serializer, &self->enable); - - for(unsigned int i=0; i < 3; i++) - extract_u8(serializer, &self->reserved[i]); - -} - -mip_cmd_result mip_gnss_write_rtk_dongle_configuration(struct mip_interface* device, uint8_t enable, const uint8_t* reserved) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_u8(&serializer, enable); - - assert(reserved || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_u8(&serializer, reserved[i]); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_GNSS_CMD_DESC_SET, MIP_CMD_DESC_GNSS_RTK_DONGLE_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_gnss_read_rtk_dongle_configuration(struct mip_interface* device, uint8_t* enable_out, uint8_t* reserved_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_GNSS_CMD_DESC_SET, MIP_CMD_DESC_GNSS_RTK_DONGLE_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_GNSS_RTK_DONGLE_CONFIGURATION, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(enable_out); - extract_u8(&deserializer, enable_out); - - assert(reserved_out || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - extract_u8(&deserializer, &reserved_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_gnss_save_rtk_dongle_configuration(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_GNSS_CMD_DESC_SET, MIP_CMD_DESC_GNSS_RTK_DONGLE_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_gnss_load_rtk_dongle_configuration(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_GNSS_CMD_DESC_SET, MIP_CMD_DESC_GNSS_RTK_DONGLE_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_gnss_default_rtk_dongle_configuration(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_GNSS_CMD_DESC_SET, MIP_CMD_DESC_GNSS_RTK_DONGLE_CONFIGURATION, buffer, (uint8_t)mip_serializer_length(&serializer)); -} - -#ifdef __cplusplus -} // namespace C -} // namespace mip -} // extern "C" -#endif // __cplusplus - diff --git a/src/mip/definitions/commands_rtk.c b/src/mip/definitions/commands_rtk.c deleted file mode 100644 index d1d1c153d..000000000 --- a/src/mip/definitions/commands_rtk.c +++ /dev/null @@ -1,512 +0,0 @@ - -#include "commands_rtk.h" - -#include "../utils/serialization.h" -#include "../mip_interface.h" - -#include - - -#ifdef __cplusplus -namespace mip { -namespace C { -extern "C" { - -#endif // __cplusplus -struct mip_interface; -struct mip_serializer; -struct mip_field; - - -//////////////////////////////////////////////////////////////////////////////// -// Shared Type Definitions -//////////////////////////////////////////////////////////////////////////////// - -void insert_mip_media_selector(struct mip_serializer* serializer, const mip_media_selector self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_media_selector(struct mip_serializer* serializer, mip_media_selector* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -void insert_mip_led_action(struct mip_serializer* serializer, const mip_led_action self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_led_action(struct mip_serializer* serializer, mip_led_action* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - - -//////////////////////////////////////////////////////////////////////////////// -// Mip Fields -//////////////////////////////////////////////////////////////////////////////// - -void insert_mip_rtk_get_status_flags_command_status_flags_legacy(struct mip_serializer* serializer, const mip_rtk_get_status_flags_command_status_flags_legacy self) -{ - insert_u32(serializer, (uint32_t)(self)); -} -void extract_mip_rtk_get_status_flags_command_status_flags_legacy(struct mip_serializer* serializer, mip_rtk_get_status_flags_command_status_flags_legacy* self) -{ - uint32_t tmp = 0; - extract_u32(serializer, &tmp); - *self = tmp; -} - -void insert_mip_rtk_get_status_flags_command_status_flags(struct mip_serializer* serializer, const mip_rtk_get_status_flags_command_status_flags self) -{ - insert_u32(serializer, (uint32_t)(self)); -} -void extract_mip_rtk_get_status_flags_command_status_flags(struct mip_serializer* serializer, mip_rtk_get_status_flags_command_status_flags* self) -{ - uint32_t tmp = 0; - extract_u32(serializer, &tmp); - *self = tmp; -} - -mip_cmd_result mip_rtk_get_status_flags(struct mip_interface* device, mip_rtk_get_status_flags_command_status_flags* flags_out) -{ - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - uint8_t responseLength = sizeof(buffer); - - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_RTK_CMD_DESC_SET, MIP_CMD_DESC_RTK_GET_STATUS_FLAGS, NULL, 0, MIP_REPLY_DESC_RTK_GET_STATUS_FLAGS, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(flags_out); - extract_mip_rtk_get_status_flags_command_status_flags(&deserializer, flags_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_rtk_get_imei(struct mip_interface* device, char* imei_out) -{ - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - uint8_t responseLength = sizeof(buffer); - - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_RTK_CMD_DESC_SET, MIP_CMD_DESC_RTK_GET_IMEI, NULL, 0, MIP_REPLY_DESC_RTK_GET_IMEI, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(imei_out || (32 == 0)); - for(unsigned int i=0; i < 32; i++) - extract_char(&deserializer, &imei_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_rtk_get_imsi(struct mip_interface* device, char* imsi_out) -{ - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - uint8_t responseLength = sizeof(buffer); - - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_RTK_CMD_DESC_SET, MIP_CMD_DESC_RTK_GET_IMSI, NULL, 0, MIP_REPLY_DESC_RTK_GET_IMSI, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(imsi_out || (32 == 0)); - for(unsigned int i=0; i < 32; i++) - extract_char(&deserializer, &imsi_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_rtk_get_iccid(struct mip_interface* device, char* iccid_out) -{ - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - uint8_t responseLength = sizeof(buffer); - - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_RTK_CMD_DESC_SET, MIP_CMD_DESC_RTK_GET_ICCID, NULL, 0, MIP_REPLY_DESC_RTK_GET_ICCID, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(iccid_out || (32 == 0)); - for(unsigned int i=0; i < 32; i++) - extract_char(&deserializer, &iccid_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -void insert_mip_rtk_connected_device_type_command(mip_serializer* serializer, const mip_rtk_connected_device_type_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_mip_rtk_connected_device_type_command_type(serializer, self->devType); - - } -} -void extract_mip_rtk_connected_device_type_command(mip_serializer* serializer, mip_rtk_connected_device_type_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_mip_rtk_connected_device_type_command_type(serializer, &self->devType); - - } -} - -void insert_mip_rtk_connected_device_type_response(mip_serializer* serializer, const mip_rtk_connected_device_type_response* self) -{ - insert_mip_rtk_connected_device_type_command_type(serializer, self->devType); - -} -void extract_mip_rtk_connected_device_type_response(mip_serializer* serializer, mip_rtk_connected_device_type_response* self) -{ - extract_mip_rtk_connected_device_type_command_type(serializer, &self->devType); - -} - -void insert_mip_rtk_connected_device_type_command_type(struct mip_serializer* serializer, const mip_rtk_connected_device_type_command_type self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_rtk_connected_device_type_command_type(struct mip_serializer* serializer, mip_rtk_connected_device_type_command_type* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -mip_cmd_result mip_rtk_write_connected_device_type(struct mip_interface* device, mip_rtk_connected_device_type_command_type dev_type) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_mip_rtk_connected_device_type_command_type(&serializer, dev_type); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_RTK_CMD_DESC_SET, MIP_CMD_DESC_RTK_CONNECTED_DEVICE_TYPE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_rtk_read_connected_device_type(struct mip_interface* device, mip_rtk_connected_device_type_command_type* dev_type_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_RTK_CMD_DESC_SET, MIP_CMD_DESC_RTK_CONNECTED_DEVICE_TYPE, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_RTK_CONNECTED_DEVICE_TYPE, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(dev_type_out); - extract_mip_rtk_connected_device_type_command_type(&deserializer, dev_type_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_rtk_save_connected_device_type(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_SAVE); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_RTK_CMD_DESC_SET, MIP_CMD_DESC_RTK_CONNECTED_DEVICE_TYPE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_rtk_load_connected_device_type(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_LOAD); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_RTK_CMD_DESC_SET, MIP_CMD_DESC_RTK_CONNECTED_DEVICE_TYPE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_rtk_default_connected_device_type(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_RTK_CMD_DESC_SET, MIP_CMD_DESC_RTK_CONNECTED_DEVICE_TYPE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_rtk_get_act_code(struct mip_interface* device, char* activation_code_out) -{ - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - uint8_t responseLength = sizeof(buffer); - - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_RTK_CMD_DESC_SET, MIP_CMD_DESC_RTK_GET_ACT_CODE, NULL, 0, MIP_REPLY_DESC_RTK_GET_ACT_CODE, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(activation_code_out || (32 == 0)); - for(unsigned int i=0; i < 32; i++) - extract_char(&deserializer, &activation_code_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_rtk_get_modem_firmware_version(struct mip_interface* device, char* modem_firmware_version_out) -{ - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - uint8_t responseLength = sizeof(buffer); - - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_RTK_CMD_DESC_SET, MIP_CMD_DESC_RTK_GET_MODEM_FIRMWARE_VERSION, NULL, 0, MIP_REPLY_DESC_RTK_GET_MODEM_FIRMWARE_VERSION, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(modem_firmware_version_out || (32 == 0)); - for(unsigned int i=0; i < 32; i++) - extract_char(&deserializer, &modem_firmware_version_out[i]); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_rtk_get_rssi(struct mip_interface* device, bool* valid_out, int32_t* rssi_out, int32_t* signal_quality_out) -{ - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - uint8_t responseLength = sizeof(buffer); - - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_RTK_CMD_DESC_SET, MIP_CMD_DESC_RTK_GET_RSSI, NULL, 0, MIP_REPLY_DESC_RTK_GET_RSSI, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(valid_out); - extract_bool(&deserializer, valid_out); - - assert(rssi_out); - extract_s32(&deserializer, rssi_out); - - assert(signal_quality_out); - extract_s32(&deserializer, signal_quality_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -void insert_mip_rtk_service_status_command(mip_serializer* serializer, const mip_rtk_service_status_command* self) -{ - insert_u32(serializer, self->reserved1); - - insert_u32(serializer, self->reserved2); - -} -void extract_mip_rtk_service_status_command(mip_serializer* serializer, mip_rtk_service_status_command* self) -{ - extract_u32(serializer, &self->reserved1); - - extract_u32(serializer, &self->reserved2); - -} - -void insert_mip_rtk_service_status_response(mip_serializer* serializer, const mip_rtk_service_status_response* self) -{ - insert_mip_rtk_service_status_command_service_flags(serializer, self->flags); - - insert_u32(serializer, self->receivedBytes); - - insert_u32(serializer, self->lastBytes); - - insert_u64(serializer, self->lastBytesTime); - -} -void extract_mip_rtk_service_status_response(mip_serializer* serializer, mip_rtk_service_status_response* self) -{ - extract_mip_rtk_service_status_command_service_flags(serializer, &self->flags); - - extract_u32(serializer, &self->receivedBytes); - - extract_u32(serializer, &self->lastBytes); - - extract_u64(serializer, &self->lastBytesTime); - -} - -void insert_mip_rtk_service_status_command_service_flags(struct mip_serializer* serializer, const mip_rtk_service_status_command_service_flags self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_rtk_service_status_command_service_flags(struct mip_serializer* serializer, mip_rtk_service_status_command_service_flags* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -mip_cmd_result mip_rtk_service_status(struct mip_interface* device, uint32_t reserved1, uint32_t reserved2, mip_rtk_service_status_command_service_flags* flags_out, uint32_t* received_bytes_out, uint32_t* last_bytes_out, uint64_t* last_bytes_time_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_u32(&serializer, reserved1); - - insert_u32(&serializer, reserved2); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_RTK_CMD_DESC_SET, MIP_CMD_DESC_RTK_SERVICE_STATUS, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_RTK_SERVICE_STATUS, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(flags_out); - extract_mip_rtk_service_status_command_service_flags(&deserializer, flags_out); - - assert(received_bytes_out); - extract_u32(&deserializer, received_bytes_out); - - assert(last_bytes_out); - extract_u32(&deserializer, last_bytes_out); - - assert(last_bytes_time_out); - extract_u64(&deserializer, last_bytes_time_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -void insert_mip_rtk_prod_erase_storage_command(mip_serializer* serializer, const mip_rtk_prod_erase_storage_command* self) -{ - insert_mip_media_selector(serializer, self->media); - -} -void extract_mip_rtk_prod_erase_storage_command(mip_serializer* serializer, mip_rtk_prod_erase_storage_command* self) -{ - extract_mip_media_selector(serializer, &self->media); - -} - -mip_cmd_result mip_rtk_prod_erase_storage(struct mip_interface* device, mip_media_selector media) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_media_selector(&serializer, media); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_RTK_CMD_DESC_SET, MIP_CMD_DESC_RTK_PROD_ERASE_STORAGE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -void insert_mip_rtk_led_control_command(mip_serializer* serializer, const mip_rtk_led_control_command* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_u8(serializer, self->primaryColor[i]); - - for(unsigned int i=0; i < 3; i++) - insert_u8(serializer, self->altColor[i]); - - insert_mip_led_action(serializer, self->act); - - insert_u32(serializer, self->period); - -} -void extract_mip_rtk_led_control_command(mip_serializer* serializer, mip_rtk_led_control_command* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_u8(serializer, &self->primaryColor[i]); - - for(unsigned int i=0; i < 3; i++) - extract_u8(serializer, &self->altColor[i]); - - extract_mip_led_action(serializer, &self->act); - - extract_u32(serializer, &self->period); - -} - -mip_cmd_result mip_rtk_led_control(struct mip_interface* device, const uint8_t* primary_color, const uint8_t* alt_color, mip_led_action act, uint32_t period) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - assert(primary_color || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_u8(&serializer, primary_color[i]); - - assert(alt_color || (3 == 0)); - for(unsigned int i=0; i < 3; i++) - insert_u8(&serializer, alt_color[i]); - - insert_mip_led_action(&serializer, act); - - insert_u32(&serializer, period); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_RTK_CMD_DESC_SET, MIP_CMD_DESC_LED_CONTROL, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_rtk_modem_hard_reset(struct mip_interface* device) -{ - return mip_interface_run_command(device, MIP_RTK_CMD_DESC_SET, MIP_CMD_DESC_RTK_MODEM_HARD_RESET, NULL, 0); -} - -#ifdef __cplusplus -} // namespace C -} // namespace mip -} // extern "C" -#endif // __cplusplus - diff --git a/src/mip/definitions/commands_system.c b/src/mip/definitions/commands_system.c deleted file mode 100644 index e20d55a67..000000000 --- a/src/mip/definitions/commands_system.c +++ /dev/null @@ -1,120 +0,0 @@ - -#include "commands_system.h" - -#include "../utils/serialization.h" -#include "../mip_interface.h" - -#include - - -#ifdef __cplusplus -namespace mip { -namespace C { -extern "C" { - -#endif // __cplusplus -struct mip_interface; -struct mip_serializer; -struct mip_field; - - -//////////////////////////////////////////////////////////////////////////////// -// Shared Type Definitions -//////////////////////////////////////////////////////////////////////////////// - - -//////////////////////////////////////////////////////////////////////////////// -// Mip Fields -//////////////////////////////////////////////////////////////////////////////// - -void insert_mip_system_comm_mode_command(mip_serializer* serializer, const mip_system_comm_mode_command* self) -{ - insert_mip_function_selector(serializer, self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - insert_u8(serializer, self->mode); - - } -} -void extract_mip_system_comm_mode_command(mip_serializer* serializer, mip_system_comm_mode_command* self) -{ - extract_mip_function_selector(serializer, &self->function); - - if( self->function == MIP_FUNCTION_WRITE ) - { - extract_u8(serializer, &self->mode); - - } -} - -void insert_mip_system_comm_mode_response(mip_serializer* serializer, const mip_system_comm_mode_response* self) -{ - insert_u8(serializer, self->mode); - -} -void extract_mip_system_comm_mode_response(mip_serializer* serializer, mip_system_comm_mode_response* self) -{ - extract_u8(serializer, &self->mode); - -} - -mip_cmd_result mip_system_write_comm_mode(struct mip_interface* device, uint8_t mode) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_WRITE); - - insert_u8(&serializer, mode); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_SYSTEM_CMD_DESC_SET, MIP_CMD_DESC_SYSTEM_COM_MODE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} -mip_cmd_result mip_system_read_comm_mode(struct mip_interface* device, uint8_t* mode_out) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_READ); - - assert(mip_serializer_is_ok(&serializer)); - - uint8_t responseLength = sizeof(buffer); - mip_cmd_result result = mip_interface_run_command_with_response(device, MIP_SYSTEM_CMD_DESC_SET, MIP_CMD_DESC_SYSTEM_COM_MODE, buffer, (uint8_t)mip_serializer_length(&serializer), MIP_REPLY_DESC_SYSTEM_COM_MODE, buffer, &responseLength); - - if( result == MIP_ACK_OK ) - { - mip_serializer deserializer; - mip_serializer_init_insertion(&deserializer, buffer, responseLength); - - assert(mode_out); - extract_u8(&deserializer, mode_out); - - if( mip_serializer_remaining(&deserializer) != 0 ) - result = MIP_STATUS_ERROR; - } - return result; -} -mip_cmd_result mip_system_default_comm_mode(struct mip_interface* device) -{ - mip_serializer serializer; - uint8_t buffer[MIP_FIELD_PAYLOAD_LENGTH_MAX]; - mip_serializer_init_insertion(&serializer, buffer, sizeof(buffer)); - - insert_mip_function_selector(&serializer, MIP_FUNCTION_RESET); - - assert(mip_serializer_is_ok(&serializer)); - - return mip_interface_run_command(device, MIP_SYSTEM_CMD_DESC_SET, MIP_CMD_DESC_SYSTEM_COM_MODE, buffer, (uint8_t)mip_serializer_length(&serializer)); -} - -#ifdef __cplusplus -} // namespace C -} // namespace mip -} // extern "C" -#endif // __cplusplus - diff --git a/src/mip/definitions/common.c b/src/mip/definitions/common.c deleted file mode 100644 index 686d4885a..000000000 --- a/src/mip/definitions/common.c +++ /dev/null @@ -1,39 +0,0 @@ - -#include "common.h" - -#include "../utils/serialization.h" - - -void insert_mip_descriptor_rate(mip_serializer* serializer, const mip_descriptor_rate* self) -{ - insert_u8(serializer, self->descriptor); - insert_u16(serializer, self->decimation); -} - -void extract_mip_descriptor_rate(mip_serializer* serializer, mip_descriptor_rate* self) -{ - extract_u8(serializer, &self->descriptor); - extract_u16(serializer, &self->decimation); -} - -#define IMPLEMENT_MIP_VECTOR_FUNCTIONS(n,type,name) \ -void insert_##name(mip_serializer* serializer, const name self) \ -{ \ - for(unsigned int i=0; i - - -#ifdef __cplusplus -namespace mip { -namespace C { -extern "C" { - -#endif // __cplusplus -struct mip_interface; -struct mip_serializer; -struct mip_field; - - -//////////////////////////////////////////////////////////////////////////////// -// Shared Type Definitions -//////////////////////////////////////////////////////////////////////////////// - -void insert_mip_filter_mode(struct mip_serializer* serializer, const mip_filter_mode self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_filter_mode(struct mip_serializer* serializer, mip_filter_mode* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_filter_dynamics_mode(struct mip_serializer* serializer, const mip_filter_dynamics_mode self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_filter_dynamics_mode(struct mip_serializer* serializer, mip_filter_dynamics_mode* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_filter_status_flags(struct mip_serializer* serializer, const mip_filter_status_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_filter_status_flags(struct mip_serializer* serializer, mip_filter_status_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_filter_aiding_measurement_type(struct mip_serializer* serializer, const mip_filter_aiding_measurement_type self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_filter_aiding_measurement_type(struct mip_serializer* serializer, mip_filter_aiding_measurement_type* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -void insert_mip_filter_measurement_indicator(struct mip_serializer* serializer, const mip_filter_measurement_indicator self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_filter_measurement_indicator(struct mip_serializer* serializer, mip_filter_measurement_indicator* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_aid_status_flags(struct mip_serializer* serializer, const mip_gnss_aid_status_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_gnss_aid_status_flags(struct mip_serializer* serializer, mip_gnss_aid_status_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - - -//////////////////////////////////////////////////////////////////////////////// -// Mip Fields -//////////////////////////////////////////////////////////////////////////////// - -void insert_mip_filter_position_llh_data(mip_serializer* serializer, const mip_filter_position_llh_data* self) -{ - insert_double(serializer, self->latitude); - - insert_double(serializer, self->longitude); - - insert_double(serializer, self->ellipsoid_height); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_position_llh_data(mip_serializer* serializer, mip_filter_position_llh_data* self) -{ - extract_double(serializer, &self->latitude); - - extract_double(serializer, &self->longitude); - - extract_double(serializer, &self->ellipsoid_height); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_position_llh_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_position_llh_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_position_llh_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_velocity_ned_data(mip_serializer* serializer, const mip_filter_velocity_ned_data* self) -{ - insert_float(serializer, self->north); - - insert_float(serializer, self->east); - - insert_float(serializer, self->down); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_velocity_ned_data(mip_serializer* serializer, mip_filter_velocity_ned_data* self) -{ - extract_float(serializer, &self->north); - - extract_float(serializer, &self->east); - - extract_float(serializer, &self->down); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_velocity_ned_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_velocity_ned_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_velocity_ned_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_attitude_quaternion_data(mip_serializer* serializer, const mip_filter_attitude_quaternion_data* self) -{ - for(unsigned int i=0; i < 4; i++) - insert_float(serializer, self->q[i]); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_attitude_quaternion_data(mip_serializer* serializer, mip_filter_attitude_quaternion_data* self) -{ - for(unsigned int i=0; i < 4; i++) - extract_float(serializer, &self->q[i]); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_attitude_quaternion_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_attitude_quaternion_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_attitude_quaternion_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_attitude_dcm_data(mip_serializer* serializer, const mip_filter_attitude_dcm_data* self) -{ - for(unsigned int i=0; i < 9; i++) - insert_float(serializer, self->dcm[i]); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_attitude_dcm_data(mip_serializer* serializer, mip_filter_attitude_dcm_data* self) -{ - for(unsigned int i=0; i < 9; i++) - extract_float(serializer, &self->dcm[i]); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_attitude_dcm_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_attitude_dcm_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_attitude_dcm_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_euler_angles_data(mip_serializer* serializer, const mip_filter_euler_angles_data* self) -{ - insert_float(serializer, self->roll); - - insert_float(serializer, self->pitch); - - insert_float(serializer, self->yaw); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_euler_angles_data(mip_serializer* serializer, mip_filter_euler_angles_data* self) -{ - extract_float(serializer, &self->roll); - - extract_float(serializer, &self->pitch); - - extract_float(serializer, &self->yaw); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_euler_angles_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_euler_angles_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_euler_angles_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_gyro_bias_data(mip_serializer* serializer, const mip_filter_gyro_bias_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->bias[i]); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_gyro_bias_data(mip_serializer* serializer, mip_filter_gyro_bias_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->bias[i]); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_gyro_bias_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_gyro_bias_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_gyro_bias_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_accel_bias_data(mip_serializer* serializer, const mip_filter_accel_bias_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->bias[i]); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_accel_bias_data(mip_serializer* serializer, mip_filter_accel_bias_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->bias[i]); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_accel_bias_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_accel_bias_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_accel_bias_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_position_llh_uncertainty_data(mip_serializer* serializer, const mip_filter_position_llh_uncertainty_data* self) -{ - insert_float(serializer, self->north); - - insert_float(serializer, self->east); - - insert_float(serializer, self->down); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_position_llh_uncertainty_data(mip_serializer* serializer, mip_filter_position_llh_uncertainty_data* self) -{ - extract_float(serializer, &self->north); - - extract_float(serializer, &self->east); - - extract_float(serializer, &self->down); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_position_llh_uncertainty_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_position_llh_uncertainty_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_position_llh_uncertainty_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_velocity_ned_uncertainty_data(mip_serializer* serializer, const mip_filter_velocity_ned_uncertainty_data* self) -{ - insert_float(serializer, self->north); - - insert_float(serializer, self->east); - - insert_float(serializer, self->down); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_velocity_ned_uncertainty_data(mip_serializer* serializer, mip_filter_velocity_ned_uncertainty_data* self) -{ - extract_float(serializer, &self->north); - - extract_float(serializer, &self->east); - - extract_float(serializer, &self->down); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_velocity_ned_uncertainty_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_velocity_ned_uncertainty_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_velocity_ned_uncertainty_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_euler_angles_uncertainty_data(mip_serializer* serializer, const mip_filter_euler_angles_uncertainty_data* self) -{ - insert_float(serializer, self->roll); - - insert_float(serializer, self->pitch); - - insert_float(serializer, self->yaw); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_euler_angles_uncertainty_data(mip_serializer* serializer, mip_filter_euler_angles_uncertainty_data* self) -{ - extract_float(serializer, &self->roll); - - extract_float(serializer, &self->pitch); - - extract_float(serializer, &self->yaw); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_euler_angles_uncertainty_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_euler_angles_uncertainty_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_euler_angles_uncertainty_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_gyro_bias_uncertainty_data(mip_serializer* serializer, const mip_filter_gyro_bias_uncertainty_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->bias_uncert[i]); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_gyro_bias_uncertainty_data(mip_serializer* serializer, mip_filter_gyro_bias_uncertainty_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->bias_uncert[i]); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_gyro_bias_uncertainty_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_gyro_bias_uncertainty_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_gyro_bias_uncertainty_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_accel_bias_uncertainty_data(mip_serializer* serializer, const mip_filter_accel_bias_uncertainty_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->bias_uncert[i]); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_accel_bias_uncertainty_data(mip_serializer* serializer, mip_filter_accel_bias_uncertainty_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->bias_uncert[i]); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_accel_bias_uncertainty_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_accel_bias_uncertainty_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_accel_bias_uncertainty_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_timestamp_data(mip_serializer* serializer, const mip_filter_timestamp_data* self) -{ - insert_double(serializer, self->tow); - - insert_u16(serializer, self->week_number); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_timestamp_data(mip_serializer* serializer, mip_filter_timestamp_data* self) -{ - extract_double(serializer, &self->tow); - - extract_u16(serializer, &self->week_number); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_timestamp_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_timestamp_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_timestamp_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_status_data(mip_serializer* serializer, const mip_filter_status_data* self) -{ - insert_mip_filter_mode(serializer, self->filter_state); - - insert_mip_filter_dynamics_mode(serializer, self->dynamics_mode); - - insert_mip_filter_status_flags(serializer, self->status_flags); - -} -void extract_mip_filter_status_data(mip_serializer* serializer, mip_filter_status_data* self) -{ - extract_mip_filter_mode(serializer, &self->filter_state); - - extract_mip_filter_dynamics_mode(serializer, &self->dynamics_mode); - - extract_mip_filter_status_flags(serializer, &self->status_flags); - -} -bool extract_mip_filter_status_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_status_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_status_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_linear_accel_data(mip_serializer* serializer, const mip_filter_linear_accel_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->accel[i]); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_linear_accel_data(mip_serializer* serializer, mip_filter_linear_accel_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->accel[i]); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_linear_accel_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_linear_accel_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_linear_accel_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_gravity_vector_data(mip_serializer* serializer, const mip_filter_gravity_vector_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->gravity[i]); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_gravity_vector_data(mip_serializer* serializer, mip_filter_gravity_vector_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->gravity[i]); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_gravity_vector_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_gravity_vector_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_gravity_vector_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_comp_accel_data(mip_serializer* serializer, const mip_filter_comp_accel_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->accel[i]); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_comp_accel_data(mip_serializer* serializer, mip_filter_comp_accel_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->accel[i]); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_comp_accel_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_comp_accel_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_comp_accel_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_comp_angular_rate_data(mip_serializer* serializer, const mip_filter_comp_angular_rate_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->gyro[i]); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_comp_angular_rate_data(mip_serializer* serializer, mip_filter_comp_angular_rate_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->gyro[i]); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_comp_angular_rate_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_comp_angular_rate_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_comp_angular_rate_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_quaternion_attitude_uncertainty_data(mip_serializer* serializer, const mip_filter_quaternion_attitude_uncertainty_data* self) -{ - for(unsigned int i=0; i < 4; i++) - insert_float(serializer, self->q[i]); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_quaternion_attitude_uncertainty_data(mip_serializer* serializer, mip_filter_quaternion_attitude_uncertainty_data* self) -{ - for(unsigned int i=0; i < 4; i++) - extract_float(serializer, &self->q[i]); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_quaternion_attitude_uncertainty_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_quaternion_attitude_uncertainty_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_quaternion_attitude_uncertainty_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_wgs84_gravity_mag_data(mip_serializer* serializer, const mip_filter_wgs84_gravity_mag_data* self) -{ - insert_float(serializer, self->magnitude); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_wgs84_gravity_mag_data(mip_serializer* serializer, mip_filter_wgs84_gravity_mag_data* self) -{ - extract_float(serializer, &self->magnitude); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_wgs84_gravity_mag_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_wgs84_gravity_mag_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_wgs84_gravity_mag_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_heading_update_state_data(mip_serializer* serializer, const mip_filter_heading_update_state_data* self) -{ - insert_float(serializer, self->heading); - - insert_float(serializer, self->heading_1sigma); - - insert_mip_filter_heading_update_state_data_heading_source(serializer, self->source); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_heading_update_state_data(mip_serializer* serializer, mip_filter_heading_update_state_data* self) -{ - extract_float(serializer, &self->heading); - - extract_float(serializer, &self->heading_1sigma); - - extract_mip_filter_heading_update_state_data_heading_source(serializer, &self->source); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_heading_update_state_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_heading_update_state_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_heading_update_state_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_heading_update_state_data_heading_source(struct mip_serializer* serializer, const mip_filter_heading_update_state_data_heading_source self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_filter_heading_update_state_data_heading_source(struct mip_serializer* serializer, mip_filter_heading_update_state_data_heading_source* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_filter_magnetic_model_data(mip_serializer* serializer, const mip_filter_magnetic_model_data* self) -{ - insert_float(serializer, self->intensity_north); - - insert_float(serializer, self->intensity_east); - - insert_float(serializer, self->intensity_down); - - insert_float(serializer, self->inclination); - - insert_float(serializer, self->declination); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_magnetic_model_data(mip_serializer* serializer, mip_filter_magnetic_model_data* self) -{ - extract_float(serializer, &self->intensity_north); - - extract_float(serializer, &self->intensity_east); - - extract_float(serializer, &self->intensity_down); - - extract_float(serializer, &self->inclination); - - extract_float(serializer, &self->declination); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_magnetic_model_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_magnetic_model_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_magnetic_model_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_accel_scale_factor_data(mip_serializer* serializer, const mip_filter_accel_scale_factor_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->scale_factor[i]); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_accel_scale_factor_data(mip_serializer* serializer, mip_filter_accel_scale_factor_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->scale_factor[i]); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_accel_scale_factor_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_accel_scale_factor_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_accel_scale_factor_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_accel_scale_factor_uncertainty_data(mip_serializer* serializer, const mip_filter_accel_scale_factor_uncertainty_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->scale_factor_uncert[i]); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_accel_scale_factor_uncertainty_data(mip_serializer* serializer, mip_filter_accel_scale_factor_uncertainty_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->scale_factor_uncert[i]); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_accel_scale_factor_uncertainty_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_accel_scale_factor_uncertainty_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_accel_scale_factor_uncertainty_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_gyro_scale_factor_data(mip_serializer* serializer, const mip_filter_gyro_scale_factor_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->scale_factor[i]); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_gyro_scale_factor_data(mip_serializer* serializer, mip_filter_gyro_scale_factor_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->scale_factor[i]); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_gyro_scale_factor_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_gyro_scale_factor_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_gyro_scale_factor_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_gyro_scale_factor_uncertainty_data(mip_serializer* serializer, const mip_filter_gyro_scale_factor_uncertainty_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->scale_factor_uncert[i]); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_gyro_scale_factor_uncertainty_data(mip_serializer* serializer, mip_filter_gyro_scale_factor_uncertainty_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->scale_factor_uncert[i]); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_gyro_scale_factor_uncertainty_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_gyro_scale_factor_uncertainty_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_gyro_scale_factor_uncertainty_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_mag_bias_data(mip_serializer* serializer, const mip_filter_mag_bias_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->bias[i]); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_mag_bias_data(mip_serializer* serializer, mip_filter_mag_bias_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->bias[i]); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_mag_bias_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_mag_bias_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_mag_bias_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_mag_bias_uncertainty_data(mip_serializer* serializer, const mip_filter_mag_bias_uncertainty_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->bias_uncert[i]); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_mag_bias_uncertainty_data(mip_serializer* serializer, mip_filter_mag_bias_uncertainty_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->bias_uncert[i]); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_mag_bias_uncertainty_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_mag_bias_uncertainty_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_mag_bias_uncertainty_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_standard_atmosphere_data(mip_serializer* serializer, const mip_filter_standard_atmosphere_data* self) -{ - insert_float(serializer, self->geometric_altitude); - - insert_float(serializer, self->geopotential_altitude); - - insert_float(serializer, self->standard_temperature); - - insert_float(serializer, self->standard_pressure); - - insert_float(serializer, self->standard_density); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_standard_atmosphere_data(mip_serializer* serializer, mip_filter_standard_atmosphere_data* self) -{ - extract_float(serializer, &self->geometric_altitude); - - extract_float(serializer, &self->geopotential_altitude); - - extract_float(serializer, &self->standard_temperature); - - extract_float(serializer, &self->standard_pressure); - - extract_float(serializer, &self->standard_density); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_standard_atmosphere_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_standard_atmosphere_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_standard_atmosphere_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_pressure_altitude_data(mip_serializer* serializer, const mip_filter_pressure_altitude_data* self) -{ - insert_float(serializer, self->pressure_altitude); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_pressure_altitude_data(mip_serializer* serializer, mip_filter_pressure_altitude_data* self) -{ - extract_float(serializer, &self->pressure_altitude); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_pressure_altitude_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_pressure_altitude_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_pressure_altitude_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_density_altitude_data(mip_serializer* serializer, const mip_filter_density_altitude_data* self) -{ - insert_float(serializer, self->density_altitude); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_density_altitude_data(mip_serializer* serializer, mip_filter_density_altitude_data* self) -{ - extract_float(serializer, &self->density_altitude); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_density_altitude_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_density_altitude_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_density_altitude_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_antenna_offset_correction_data(mip_serializer* serializer, const mip_filter_antenna_offset_correction_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->offset[i]); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_antenna_offset_correction_data(mip_serializer* serializer, mip_filter_antenna_offset_correction_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->offset[i]); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_antenna_offset_correction_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_antenna_offset_correction_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_antenna_offset_correction_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_antenna_offset_correction_uncertainty_data(mip_serializer* serializer, const mip_filter_antenna_offset_correction_uncertainty_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->offset_uncert[i]); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_antenna_offset_correction_uncertainty_data(mip_serializer* serializer, mip_filter_antenna_offset_correction_uncertainty_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->offset_uncert[i]); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_antenna_offset_correction_uncertainty_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_antenna_offset_correction_uncertainty_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_antenna_offset_correction_uncertainty_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_multi_antenna_offset_correction_data(mip_serializer* serializer, const mip_filter_multi_antenna_offset_correction_data* self) -{ - insert_u8(serializer, self->receiver_id); - - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->offset[i]); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_multi_antenna_offset_correction_data(mip_serializer* serializer, mip_filter_multi_antenna_offset_correction_data* self) -{ - extract_u8(serializer, &self->receiver_id); - - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->offset[i]); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_multi_antenna_offset_correction_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_multi_antenna_offset_correction_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_multi_antenna_offset_correction_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_multi_antenna_offset_correction_uncertainty_data(mip_serializer* serializer, const mip_filter_multi_antenna_offset_correction_uncertainty_data* self) -{ - insert_u8(serializer, self->receiver_id); - - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->offset_uncert[i]); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_multi_antenna_offset_correction_uncertainty_data(mip_serializer* serializer, mip_filter_multi_antenna_offset_correction_uncertainty_data* self) -{ - extract_u8(serializer, &self->receiver_id); - - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->offset_uncert[i]); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_multi_antenna_offset_correction_uncertainty_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_multi_antenna_offset_correction_uncertainty_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_multi_antenna_offset_correction_uncertainty_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_magnetometer_offset_data(mip_serializer* serializer, const mip_filter_magnetometer_offset_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->hard_iron[i]); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_magnetometer_offset_data(mip_serializer* serializer, mip_filter_magnetometer_offset_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->hard_iron[i]); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_magnetometer_offset_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_magnetometer_offset_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_magnetometer_offset_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_magnetometer_matrix_data(mip_serializer* serializer, const mip_filter_magnetometer_matrix_data* self) -{ - for(unsigned int i=0; i < 9; i++) - insert_float(serializer, self->soft_iron[i]); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_magnetometer_matrix_data(mip_serializer* serializer, mip_filter_magnetometer_matrix_data* self) -{ - for(unsigned int i=0; i < 9; i++) - extract_float(serializer, &self->soft_iron[i]); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_magnetometer_matrix_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_magnetometer_matrix_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_magnetometer_matrix_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_magnetometer_offset_uncertainty_data(mip_serializer* serializer, const mip_filter_magnetometer_offset_uncertainty_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->hard_iron_uncertainty[i]); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_magnetometer_offset_uncertainty_data(mip_serializer* serializer, mip_filter_magnetometer_offset_uncertainty_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->hard_iron_uncertainty[i]); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_magnetometer_offset_uncertainty_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_magnetometer_offset_uncertainty_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_magnetometer_offset_uncertainty_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_magnetometer_matrix_uncertainty_data(mip_serializer* serializer, const mip_filter_magnetometer_matrix_uncertainty_data* self) -{ - for(unsigned int i=0; i < 9; i++) - insert_float(serializer, self->soft_iron_uncertainty[i]); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_magnetometer_matrix_uncertainty_data(mip_serializer* serializer, mip_filter_magnetometer_matrix_uncertainty_data* self) -{ - for(unsigned int i=0; i < 9; i++) - extract_float(serializer, &self->soft_iron_uncertainty[i]); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_magnetometer_matrix_uncertainty_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_magnetometer_matrix_uncertainty_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_magnetometer_matrix_uncertainty_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_magnetometer_covariance_matrix_data(mip_serializer* serializer, const mip_filter_magnetometer_covariance_matrix_data* self) -{ - for(unsigned int i=0; i < 9; i++) - insert_float(serializer, self->covariance[i]); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_magnetometer_covariance_matrix_data(mip_serializer* serializer, mip_filter_magnetometer_covariance_matrix_data* self) -{ - for(unsigned int i=0; i < 9; i++) - extract_float(serializer, &self->covariance[i]); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_magnetometer_covariance_matrix_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_magnetometer_covariance_matrix_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_magnetometer_covariance_matrix_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_magnetometer_residual_vector_data(mip_serializer* serializer, const mip_filter_magnetometer_residual_vector_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->residual[i]); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_magnetometer_residual_vector_data(mip_serializer* serializer, mip_filter_magnetometer_residual_vector_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->residual[i]); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_magnetometer_residual_vector_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_magnetometer_residual_vector_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_magnetometer_residual_vector_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_clock_correction_data(mip_serializer* serializer, const mip_filter_clock_correction_data* self) -{ - insert_u8(serializer, self->receiver_id); - - insert_float(serializer, self->bias); - - insert_float(serializer, self->bias_drift); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_clock_correction_data(mip_serializer* serializer, mip_filter_clock_correction_data* self) -{ - extract_u8(serializer, &self->receiver_id); - - extract_float(serializer, &self->bias); - - extract_float(serializer, &self->bias_drift); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_clock_correction_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_clock_correction_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_clock_correction_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_clock_correction_uncertainty_data(mip_serializer* serializer, const mip_filter_clock_correction_uncertainty_data* self) -{ - insert_u8(serializer, self->receiver_id); - - insert_float(serializer, self->bias_uncertainty); - - insert_float(serializer, self->bias_drift_uncertainty); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_clock_correction_uncertainty_data(mip_serializer* serializer, mip_filter_clock_correction_uncertainty_data* self) -{ - extract_u8(serializer, &self->receiver_id); - - extract_float(serializer, &self->bias_uncertainty); - - extract_float(serializer, &self->bias_drift_uncertainty); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_clock_correction_uncertainty_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_clock_correction_uncertainty_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_clock_correction_uncertainty_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_gnss_pos_aid_status_data(mip_serializer* serializer, const mip_filter_gnss_pos_aid_status_data* self) -{ - insert_u8(serializer, self->receiver_id); - - insert_float(serializer, self->time_of_week); - - insert_mip_gnss_aid_status_flags(serializer, self->status); - - for(unsigned int i=0; i < 8; i++) - insert_u8(serializer, self->reserved[i]); - -} -void extract_mip_filter_gnss_pos_aid_status_data(mip_serializer* serializer, mip_filter_gnss_pos_aid_status_data* self) -{ - extract_u8(serializer, &self->receiver_id); - - extract_float(serializer, &self->time_of_week); - - extract_mip_gnss_aid_status_flags(serializer, &self->status); - - for(unsigned int i=0; i < 8; i++) - extract_u8(serializer, &self->reserved[i]); - -} -bool extract_mip_filter_gnss_pos_aid_status_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_gnss_pos_aid_status_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_gnss_pos_aid_status_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_gnss_att_aid_status_data(mip_serializer* serializer, const mip_filter_gnss_att_aid_status_data* self) -{ - insert_float(serializer, self->time_of_week); - - insert_mip_gnss_aid_status_flags(serializer, self->status); - - for(unsigned int i=0; i < 8; i++) - insert_u8(serializer, self->reserved[i]); - -} -void extract_mip_filter_gnss_att_aid_status_data(mip_serializer* serializer, mip_filter_gnss_att_aid_status_data* self) -{ - extract_float(serializer, &self->time_of_week); - - extract_mip_gnss_aid_status_flags(serializer, &self->status); - - for(unsigned int i=0; i < 8; i++) - extract_u8(serializer, &self->reserved[i]); - -} -bool extract_mip_filter_gnss_att_aid_status_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_gnss_att_aid_status_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_gnss_att_aid_status_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_head_aid_status_data(mip_serializer* serializer, const mip_filter_head_aid_status_data* self) -{ - insert_float(serializer, self->time_of_week); - - insert_mip_filter_head_aid_status_data_heading_aid_type(serializer, self->type); - - for(unsigned int i=0; i < 2; i++) - insert_float(serializer, self->reserved[i]); - -} -void extract_mip_filter_head_aid_status_data(mip_serializer* serializer, mip_filter_head_aid_status_data* self) -{ - extract_float(serializer, &self->time_of_week); - - extract_mip_filter_head_aid_status_data_heading_aid_type(serializer, &self->type); - - for(unsigned int i=0; i < 2; i++) - extract_float(serializer, &self->reserved[i]); - -} -bool extract_mip_filter_head_aid_status_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_head_aid_status_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_head_aid_status_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_head_aid_status_data_heading_aid_type(struct mip_serializer* serializer, const mip_filter_head_aid_status_data_heading_aid_type self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_filter_head_aid_status_data_heading_aid_type(struct mip_serializer* serializer, mip_filter_head_aid_status_data_heading_aid_type* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -void insert_mip_filter_rel_pos_ned_data(mip_serializer* serializer, const mip_filter_rel_pos_ned_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_double(serializer, self->relative_position[i]); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_rel_pos_ned_data(mip_serializer* serializer, mip_filter_rel_pos_ned_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_double(serializer, &self->relative_position[i]); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_rel_pos_ned_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_rel_pos_ned_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_rel_pos_ned_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_ecef_pos_data(mip_serializer* serializer, const mip_filter_ecef_pos_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_double(serializer, self->position_ecef[i]); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_ecef_pos_data(mip_serializer* serializer, mip_filter_ecef_pos_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_double(serializer, &self->position_ecef[i]); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_ecef_pos_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_ecef_pos_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_ecef_pos_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_ecef_vel_data(mip_serializer* serializer, const mip_filter_ecef_vel_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->velocity_ecef[i]); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_ecef_vel_data(mip_serializer* serializer, mip_filter_ecef_vel_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->velocity_ecef[i]); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_ecef_vel_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_ecef_vel_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_ecef_vel_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_ecef_pos_uncertainty_data(mip_serializer* serializer, const mip_filter_ecef_pos_uncertainty_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->pos_uncertainty[i]); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_ecef_pos_uncertainty_data(mip_serializer* serializer, mip_filter_ecef_pos_uncertainty_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->pos_uncertainty[i]); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_ecef_pos_uncertainty_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_ecef_pos_uncertainty_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_ecef_pos_uncertainty_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_ecef_vel_uncertainty_data(mip_serializer* serializer, const mip_filter_ecef_vel_uncertainty_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->vel_uncertainty[i]); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_ecef_vel_uncertainty_data(mip_serializer* serializer, mip_filter_ecef_vel_uncertainty_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->vel_uncertainty[i]); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_ecef_vel_uncertainty_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_ecef_vel_uncertainty_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_ecef_vel_uncertainty_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_aiding_measurement_summary_data(mip_serializer* serializer, const mip_filter_aiding_measurement_summary_data* self) -{ - insert_float(serializer, self->time_of_week); - - insert_u8(serializer, self->source); - - insert_mip_filter_aiding_measurement_type(serializer, self->type); - - insert_mip_filter_measurement_indicator(serializer, self->indicator); - -} -void extract_mip_filter_aiding_measurement_summary_data(mip_serializer* serializer, mip_filter_aiding_measurement_summary_data* self) -{ - extract_float(serializer, &self->time_of_week); - - extract_u8(serializer, &self->source); - - extract_mip_filter_aiding_measurement_type(serializer, &self->type); - - extract_mip_filter_measurement_indicator(serializer, &self->indicator); - -} -bool extract_mip_filter_aiding_measurement_summary_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_aiding_measurement_summary_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_aiding_measurement_summary_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_odometer_scale_factor_error_data(mip_serializer* serializer, const mip_filter_odometer_scale_factor_error_data* self) -{ - insert_float(serializer, self->scale_factor_error); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_odometer_scale_factor_error_data(mip_serializer* serializer, mip_filter_odometer_scale_factor_error_data* self) -{ - extract_float(serializer, &self->scale_factor_error); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_odometer_scale_factor_error_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_odometer_scale_factor_error_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_odometer_scale_factor_error_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_odometer_scale_factor_error_uncertainty_data(mip_serializer* serializer, const mip_filter_odometer_scale_factor_error_uncertainty_data* self) -{ - insert_float(serializer, self->scale_factor_error_uncertainty); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_odometer_scale_factor_error_uncertainty_data(mip_serializer* serializer, mip_filter_odometer_scale_factor_error_uncertainty_data* self) -{ - extract_float(serializer, &self->scale_factor_error_uncertainty); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_odometer_scale_factor_error_uncertainty_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_odometer_scale_factor_error_uncertainty_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_odometer_scale_factor_error_uncertainty_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_gnss_dual_antenna_status_data(mip_serializer* serializer, const mip_filter_gnss_dual_antenna_status_data* self) -{ - insert_float(serializer, self->time_of_week); - - insert_float(serializer, self->heading); - - insert_float(serializer, self->heading_unc); - - insert_mip_filter_gnss_dual_antenna_status_data_fix_type(serializer, self->fix_type); - - insert_mip_filter_gnss_dual_antenna_status_data_dual_antenna_status_flags(serializer, self->status_flags); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_filter_gnss_dual_antenna_status_data(mip_serializer* serializer, mip_filter_gnss_dual_antenna_status_data* self) -{ - extract_float(serializer, &self->time_of_week); - - extract_float(serializer, &self->heading); - - extract_float(serializer, &self->heading_unc); - - extract_mip_filter_gnss_dual_antenna_status_data_fix_type(serializer, &self->fix_type); - - extract_mip_filter_gnss_dual_antenna_status_data_dual_antenna_status_flags(serializer, &self->status_flags); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_filter_gnss_dual_antenna_status_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_gnss_dual_antenna_status_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_gnss_dual_antenna_status_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_gnss_dual_antenna_status_data_fix_type(struct mip_serializer* serializer, const mip_filter_gnss_dual_antenna_status_data_fix_type self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_filter_gnss_dual_antenna_status_data_fix_type(struct mip_serializer* serializer, mip_filter_gnss_dual_antenna_status_data_fix_type* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -void insert_mip_filter_gnss_dual_antenna_status_data_dual_antenna_status_flags(struct mip_serializer* serializer, const mip_filter_gnss_dual_antenna_status_data_dual_antenna_status_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_filter_gnss_dual_antenna_status_data_dual_antenna_status_flags(struct mip_serializer* serializer, mip_filter_gnss_dual_antenna_status_data_dual_antenna_status_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_filter_aiding_frame_config_error_data(mip_serializer* serializer, const mip_filter_aiding_frame_config_error_data* self) -{ - insert_u8(serializer, self->frame_id); - - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->translation[i]); - - for(unsigned int i=0; i < 4; i++) - insert_float(serializer, self->attitude[i]); - -} -void extract_mip_filter_aiding_frame_config_error_data(mip_serializer* serializer, mip_filter_aiding_frame_config_error_data* self) -{ - extract_u8(serializer, &self->frame_id); - - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->translation[i]); - - for(unsigned int i=0; i < 4; i++) - extract_float(serializer, &self->attitude[i]); - -} -bool extract_mip_filter_aiding_frame_config_error_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_aiding_frame_config_error_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_aiding_frame_config_error_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_filter_aiding_frame_config_error_uncertainty_data(mip_serializer* serializer, const mip_filter_aiding_frame_config_error_uncertainty_data* self) -{ - insert_u8(serializer, self->frame_id); - - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->translation_unc[i]); - - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->attitude_unc[i]); - -} -void extract_mip_filter_aiding_frame_config_error_uncertainty_data(mip_serializer* serializer, mip_filter_aiding_frame_config_error_uncertainty_data* self) -{ - extract_u8(serializer, &self->frame_id); - - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->translation_unc[i]); - - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->attitude_unc[i]); - -} -bool extract_mip_filter_aiding_frame_config_error_uncertainty_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_filter_aiding_frame_config_error_uncertainty_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_filter_aiding_frame_config_error_uncertainty_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - - -#ifdef __cplusplus -} // namespace C -} // namespace mip -} // extern "C" -#endif // __cplusplus - diff --git a/src/mip/definitions/data_filter.cpp b/src/mip/definitions/data_filter.cpp deleted file mode 100644 index 50e8ae9ba..000000000 --- a/src/mip/definitions/data_filter.cpp +++ /dev/null @@ -1,1136 +0,0 @@ - -#include "data_filter.hpp" - -#include "../utils/serialization.h" -#include "../mip_interface.h" - -#include - - -namespace mip { -class Serializer; - -namespace C { -struct mip_interface; -} // namespace C - -namespace data_filter { - -using ::mip::insert; -using ::mip::extract; -using namespace ::mip::C; - -//////////////////////////////////////////////////////////////////////////////// -// Shared Type Definitions -//////////////////////////////////////////////////////////////////////////////// - - -//////////////////////////////////////////////////////////////////////////////// -// Mip Fields -//////////////////////////////////////////////////////////////////////////////// - -void insert(Serializer& serializer, const PositionLlh& self) -{ - insert(serializer, self.latitude); - - insert(serializer, self.longitude); - - insert(serializer, self.ellipsoid_height); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, PositionLlh& self) -{ - extract(serializer, self.latitude); - - extract(serializer, self.longitude); - - extract(serializer, self.ellipsoid_height); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const VelocityNed& self) -{ - insert(serializer, self.north); - - insert(serializer, self.east); - - insert(serializer, self.down); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, VelocityNed& self) -{ - extract(serializer, self.north); - - extract(serializer, self.east); - - extract(serializer, self.down); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const AttitudeQuaternion& self) -{ - for(unsigned int i=0; i < 4; i++) - insert(serializer, self.q[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, AttitudeQuaternion& self) -{ - for(unsigned int i=0; i < 4; i++) - extract(serializer, self.q[i]); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const AttitudeDcm& self) -{ - for(unsigned int i=0; i < 9; i++) - insert(serializer, self.dcm[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, AttitudeDcm& self) -{ - for(unsigned int i=0; i < 9; i++) - extract(serializer, self.dcm[i]); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const EulerAngles& self) -{ - insert(serializer, self.roll); - - insert(serializer, self.pitch); - - insert(serializer, self.yaw); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, EulerAngles& self) -{ - extract(serializer, self.roll); - - extract(serializer, self.pitch); - - extract(serializer, self.yaw); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const GyroBias& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.bias[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, GyroBias& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.bias[i]); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const AccelBias& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.bias[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, AccelBias& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.bias[i]); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const PositionLlhUncertainty& self) -{ - insert(serializer, self.north); - - insert(serializer, self.east); - - insert(serializer, self.down); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, PositionLlhUncertainty& self) -{ - extract(serializer, self.north); - - extract(serializer, self.east); - - extract(serializer, self.down); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const VelocityNedUncertainty& self) -{ - insert(serializer, self.north); - - insert(serializer, self.east); - - insert(serializer, self.down); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, VelocityNedUncertainty& self) -{ - extract(serializer, self.north); - - extract(serializer, self.east); - - extract(serializer, self.down); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const EulerAnglesUncertainty& self) -{ - insert(serializer, self.roll); - - insert(serializer, self.pitch); - - insert(serializer, self.yaw); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, EulerAnglesUncertainty& self) -{ - extract(serializer, self.roll); - - extract(serializer, self.pitch); - - extract(serializer, self.yaw); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const GyroBiasUncertainty& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.bias_uncert[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, GyroBiasUncertainty& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.bias_uncert[i]); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const AccelBiasUncertainty& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.bias_uncert[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, AccelBiasUncertainty& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.bias_uncert[i]); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const Timestamp& self) -{ - insert(serializer, self.tow); - - insert(serializer, self.week_number); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, Timestamp& self) -{ - extract(serializer, self.tow); - - extract(serializer, self.week_number); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const Status& self) -{ - insert(serializer, self.filter_state); - - insert(serializer, self.dynamics_mode); - - insert(serializer, self.status_flags); - -} -void extract(Serializer& serializer, Status& self) -{ - extract(serializer, self.filter_state); - - extract(serializer, self.dynamics_mode); - - extract(serializer, self.status_flags); - -} - -void insert(Serializer& serializer, const LinearAccel& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.accel[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, LinearAccel& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.accel[i]); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const GravityVector& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.gravity[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, GravityVector& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.gravity[i]); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const CompAccel& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.accel[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, CompAccel& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.accel[i]); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const CompAngularRate& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.gyro[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, CompAngularRate& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.gyro[i]); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const QuaternionAttitudeUncertainty& self) -{ - for(unsigned int i=0; i < 4; i++) - insert(serializer, self.q[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, QuaternionAttitudeUncertainty& self) -{ - for(unsigned int i=0; i < 4; i++) - extract(serializer, self.q[i]); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const Wgs84GravityMag& self) -{ - insert(serializer, self.magnitude); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, Wgs84GravityMag& self) -{ - extract(serializer, self.magnitude); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const HeadingUpdateState& self) -{ - insert(serializer, self.heading); - - insert(serializer, self.heading_1sigma); - - insert(serializer, self.source); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, HeadingUpdateState& self) -{ - extract(serializer, self.heading); - - extract(serializer, self.heading_1sigma); - - extract(serializer, self.source); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const MagneticModel& self) -{ - insert(serializer, self.intensity_north); - - insert(serializer, self.intensity_east); - - insert(serializer, self.intensity_down); - - insert(serializer, self.inclination); - - insert(serializer, self.declination); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, MagneticModel& self) -{ - extract(serializer, self.intensity_north); - - extract(serializer, self.intensity_east); - - extract(serializer, self.intensity_down); - - extract(serializer, self.inclination); - - extract(serializer, self.declination); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const AccelScaleFactor& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.scale_factor[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, AccelScaleFactor& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.scale_factor[i]); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const AccelScaleFactorUncertainty& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.scale_factor_uncert[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, AccelScaleFactorUncertainty& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.scale_factor_uncert[i]); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const GyroScaleFactor& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.scale_factor[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, GyroScaleFactor& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.scale_factor[i]); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const GyroScaleFactorUncertainty& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.scale_factor_uncert[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, GyroScaleFactorUncertainty& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.scale_factor_uncert[i]); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const MagBias& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.bias[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, MagBias& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.bias[i]); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const MagBiasUncertainty& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.bias_uncert[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, MagBiasUncertainty& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.bias_uncert[i]); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const StandardAtmosphere& self) -{ - insert(serializer, self.geometric_altitude); - - insert(serializer, self.geopotential_altitude); - - insert(serializer, self.standard_temperature); - - insert(serializer, self.standard_pressure); - - insert(serializer, self.standard_density); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, StandardAtmosphere& self) -{ - extract(serializer, self.geometric_altitude); - - extract(serializer, self.geopotential_altitude); - - extract(serializer, self.standard_temperature); - - extract(serializer, self.standard_pressure); - - extract(serializer, self.standard_density); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const PressureAltitude& self) -{ - insert(serializer, self.pressure_altitude); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, PressureAltitude& self) -{ - extract(serializer, self.pressure_altitude); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const DensityAltitude& self) -{ - insert(serializer, self.density_altitude); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, DensityAltitude& self) -{ - extract(serializer, self.density_altitude); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const AntennaOffsetCorrection& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.offset[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, AntennaOffsetCorrection& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.offset[i]); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const AntennaOffsetCorrectionUncertainty& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.offset_uncert[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, AntennaOffsetCorrectionUncertainty& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.offset_uncert[i]); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const MultiAntennaOffsetCorrection& self) -{ - insert(serializer, self.receiver_id); - - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.offset[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, MultiAntennaOffsetCorrection& self) -{ - extract(serializer, self.receiver_id); - - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.offset[i]); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const MultiAntennaOffsetCorrectionUncertainty& self) -{ - insert(serializer, self.receiver_id); - - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.offset_uncert[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, MultiAntennaOffsetCorrectionUncertainty& self) -{ - extract(serializer, self.receiver_id); - - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.offset_uncert[i]); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const MagnetometerOffset& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.hard_iron[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, MagnetometerOffset& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.hard_iron[i]); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const MagnetometerMatrix& self) -{ - for(unsigned int i=0; i < 9; i++) - insert(serializer, self.soft_iron[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, MagnetometerMatrix& self) -{ - for(unsigned int i=0; i < 9; i++) - extract(serializer, self.soft_iron[i]); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const MagnetometerOffsetUncertainty& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.hard_iron_uncertainty[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, MagnetometerOffsetUncertainty& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.hard_iron_uncertainty[i]); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const MagnetometerMatrixUncertainty& self) -{ - for(unsigned int i=0; i < 9; i++) - insert(serializer, self.soft_iron_uncertainty[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, MagnetometerMatrixUncertainty& self) -{ - for(unsigned int i=0; i < 9; i++) - extract(serializer, self.soft_iron_uncertainty[i]); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const MagnetometerCovarianceMatrix& self) -{ - for(unsigned int i=0; i < 9; i++) - insert(serializer, self.covariance[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, MagnetometerCovarianceMatrix& self) -{ - for(unsigned int i=0; i < 9; i++) - extract(serializer, self.covariance[i]); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const MagnetometerResidualVector& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.residual[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, MagnetometerResidualVector& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.residual[i]); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const ClockCorrection& self) -{ - insert(serializer, self.receiver_id); - - insert(serializer, self.bias); - - insert(serializer, self.bias_drift); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, ClockCorrection& self) -{ - extract(serializer, self.receiver_id); - - extract(serializer, self.bias); - - extract(serializer, self.bias_drift); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const ClockCorrectionUncertainty& self) -{ - insert(serializer, self.receiver_id); - - insert(serializer, self.bias_uncertainty); - - insert(serializer, self.bias_drift_uncertainty); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, ClockCorrectionUncertainty& self) -{ - extract(serializer, self.receiver_id); - - extract(serializer, self.bias_uncertainty); - - extract(serializer, self.bias_drift_uncertainty); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const GnssPosAidStatus& self) -{ - insert(serializer, self.receiver_id); - - insert(serializer, self.time_of_week); - - insert(serializer, self.status); - - for(unsigned int i=0; i < 8; i++) - insert(serializer, self.reserved[i]); - -} -void extract(Serializer& serializer, GnssPosAidStatus& self) -{ - extract(serializer, self.receiver_id); - - extract(serializer, self.time_of_week); - - extract(serializer, self.status); - - for(unsigned int i=0; i < 8; i++) - extract(serializer, self.reserved[i]); - -} - -void insert(Serializer& serializer, const GnssAttAidStatus& self) -{ - insert(serializer, self.time_of_week); - - insert(serializer, self.status); - - for(unsigned int i=0; i < 8; i++) - insert(serializer, self.reserved[i]); - -} -void extract(Serializer& serializer, GnssAttAidStatus& self) -{ - extract(serializer, self.time_of_week); - - extract(serializer, self.status); - - for(unsigned int i=0; i < 8; i++) - extract(serializer, self.reserved[i]); - -} - -void insert(Serializer& serializer, const HeadAidStatus& self) -{ - insert(serializer, self.time_of_week); - - insert(serializer, self.type); - - for(unsigned int i=0; i < 2; i++) - insert(serializer, self.reserved[i]); - -} -void extract(Serializer& serializer, HeadAidStatus& self) -{ - extract(serializer, self.time_of_week); - - extract(serializer, self.type); - - for(unsigned int i=0; i < 2; i++) - extract(serializer, self.reserved[i]); - -} - -void insert(Serializer& serializer, const RelPosNed& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.relative_position[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, RelPosNed& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.relative_position[i]); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const EcefPos& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.position_ecef[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, EcefPos& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.position_ecef[i]); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const EcefVel& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.velocity_ecef[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, EcefVel& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.velocity_ecef[i]); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const EcefPosUncertainty& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.pos_uncertainty[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, EcefPosUncertainty& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.pos_uncertainty[i]); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const EcefVelUncertainty& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.vel_uncertainty[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, EcefVelUncertainty& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.vel_uncertainty[i]); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const AidingMeasurementSummary& self) -{ - insert(serializer, self.time_of_week); - - insert(serializer, self.source); - - insert(serializer, self.type); - - insert(serializer, self.indicator); - -} -void extract(Serializer& serializer, AidingMeasurementSummary& self) -{ - extract(serializer, self.time_of_week); - - extract(serializer, self.source); - - extract(serializer, self.type); - - extract(serializer, self.indicator); - -} - -void insert(Serializer& serializer, const OdometerScaleFactorError& self) -{ - insert(serializer, self.scale_factor_error); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, OdometerScaleFactorError& self) -{ - extract(serializer, self.scale_factor_error); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const OdometerScaleFactorErrorUncertainty& self) -{ - insert(serializer, self.scale_factor_error_uncertainty); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, OdometerScaleFactorErrorUncertainty& self) -{ - extract(serializer, self.scale_factor_error_uncertainty); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const GnssDualAntennaStatus& self) -{ - insert(serializer, self.time_of_week); - - insert(serializer, self.heading); - - insert(serializer, self.heading_unc); - - insert(serializer, self.fix_type); - - insert(serializer, self.status_flags); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, GnssDualAntennaStatus& self) -{ - extract(serializer, self.time_of_week); - - extract(serializer, self.heading); - - extract(serializer, self.heading_unc); - - extract(serializer, self.fix_type); - - extract(serializer, self.status_flags); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const AidingFrameConfigError& self) -{ - insert(serializer, self.frame_id); - - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.translation[i]); - - for(unsigned int i=0; i < 4; i++) - insert(serializer, self.attitude[i]); - -} -void extract(Serializer& serializer, AidingFrameConfigError& self) -{ - extract(serializer, self.frame_id); - - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.translation[i]); - - for(unsigned int i=0; i < 4; i++) - extract(serializer, self.attitude[i]); - -} - -void insert(Serializer& serializer, const AidingFrameConfigErrorUncertainty& self) -{ - insert(serializer, self.frame_id); - - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.translation_unc[i]); - - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.attitude_unc[i]); - -} -void extract(Serializer& serializer, AidingFrameConfigErrorUncertainty& self) -{ - extract(serializer, self.frame_id); - - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.translation_unc[i]); - - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.attitude_unc[i]); - -} - - -} // namespace data_filter -} // namespace mip - diff --git a/src/mip/definitions/data_gnss.c b/src/mip/definitions/data_gnss.c deleted file mode 100644 index 2213a4bd9..000000000 --- a/src/mip/definitions/data_gnss.c +++ /dev/null @@ -1,1949 +0,0 @@ - -#include "data_gnss.h" - -#include "../utils/serialization.h" -#include "../mip_interface.h" - -#include - - -#ifdef __cplusplus -namespace mip { -namespace C { -extern "C" { - -#endif // __cplusplus -struct mip_interface; -struct mip_serializer; -struct mip_field; - - -//////////////////////////////////////////////////////////////////////////////// -// Shared Type Definitions -//////////////////////////////////////////////////////////////////////////////// - -void insert_mip_gnss_constellation_id(struct mip_serializer* serializer, const mip_gnss_constellation_id self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_gnss_constellation_id(struct mip_serializer* serializer, mip_gnss_constellation_id* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_signal_id(struct mip_serializer* serializer, const mip_gnss_signal_id self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_gnss_signal_id(struct mip_serializer* serializer, mip_gnss_signal_id* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -void insert_mip_sbas_system(struct mip_serializer* serializer, const mip_sbas_system self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_sbas_system(struct mip_serializer* serializer, mip_sbas_system* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - - -//////////////////////////////////////////////////////////////////////////////// -// Mip Fields -//////////////////////////////////////////////////////////////////////////////// - -void insert_mip_gnss_pos_llh_data(mip_serializer* serializer, const mip_gnss_pos_llh_data* self) -{ - insert_double(serializer, self->latitude); - - insert_double(serializer, self->longitude); - - insert_double(serializer, self->ellipsoid_height); - - insert_double(serializer, self->msl_height); - - insert_float(serializer, self->horizontal_accuracy); - - insert_float(serializer, self->vertical_accuracy); - - insert_mip_gnss_pos_llh_data_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_gnss_pos_llh_data(mip_serializer* serializer, mip_gnss_pos_llh_data* self) -{ - extract_double(serializer, &self->latitude); - - extract_double(serializer, &self->longitude); - - extract_double(serializer, &self->ellipsoid_height); - - extract_double(serializer, &self->msl_height); - - extract_float(serializer, &self->horizontal_accuracy); - - extract_float(serializer, &self->vertical_accuracy); - - extract_mip_gnss_pos_llh_data_valid_flags(serializer, &self->valid_flags); - -} -bool extract_mip_gnss_pos_llh_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_gnss_pos_llh_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_gnss_pos_llh_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_gnss_pos_llh_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_pos_llh_data_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_gnss_pos_llh_data_valid_flags(struct mip_serializer* serializer, mip_gnss_pos_llh_data_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_pos_ecef_data(mip_serializer* serializer, const mip_gnss_pos_ecef_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_double(serializer, self->x[i]); - - insert_float(serializer, self->x_accuracy); - - insert_mip_gnss_pos_ecef_data_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_gnss_pos_ecef_data(mip_serializer* serializer, mip_gnss_pos_ecef_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_double(serializer, &self->x[i]); - - extract_float(serializer, &self->x_accuracy); - - extract_mip_gnss_pos_ecef_data_valid_flags(serializer, &self->valid_flags); - -} -bool extract_mip_gnss_pos_ecef_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_gnss_pos_ecef_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_gnss_pos_ecef_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_gnss_pos_ecef_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_pos_ecef_data_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_gnss_pos_ecef_data_valid_flags(struct mip_serializer* serializer, mip_gnss_pos_ecef_data_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_vel_ned_data(mip_serializer* serializer, const mip_gnss_vel_ned_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->v[i]); - - insert_float(serializer, self->speed); - - insert_float(serializer, self->ground_speed); - - insert_float(serializer, self->heading); - - insert_float(serializer, self->speed_accuracy); - - insert_float(serializer, self->heading_accuracy); - - insert_mip_gnss_vel_ned_data_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_gnss_vel_ned_data(mip_serializer* serializer, mip_gnss_vel_ned_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->v[i]); - - extract_float(serializer, &self->speed); - - extract_float(serializer, &self->ground_speed); - - extract_float(serializer, &self->heading); - - extract_float(serializer, &self->speed_accuracy); - - extract_float(serializer, &self->heading_accuracy); - - extract_mip_gnss_vel_ned_data_valid_flags(serializer, &self->valid_flags); - -} -bool extract_mip_gnss_vel_ned_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_gnss_vel_ned_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_gnss_vel_ned_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_gnss_vel_ned_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_vel_ned_data_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_gnss_vel_ned_data_valid_flags(struct mip_serializer* serializer, mip_gnss_vel_ned_data_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_vel_ecef_data(mip_serializer* serializer, const mip_gnss_vel_ecef_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->v[i]); - - insert_float(serializer, self->v_accuracy); - - insert_mip_gnss_vel_ecef_data_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_gnss_vel_ecef_data(mip_serializer* serializer, mip_gnss_vel_ecef_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->v[i]); - - extract_float(serializer, &self->v_accuracy); - - extract_mip_gnss_vel_ecef_data_valid_flags(serializer, &self->valid_flags); - -} -bool extract_mip_gnss_vel_ecef_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_gnss_vel_ecef_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_gnss_vel_ecef_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_gnss_vel_ecef_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_vel_ecef_data_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_gnss_vel_ecef_data_valid_flags(struct mip_serializer* serializer, mip_gnss_vel_ecef_data_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_dop_data(mip_serializer* serializer, const mip_gnss_dop_data* self) -{ - insert_float(serializer, self->gdop); - - insert_float(serializer, self->pdop); - - insert_float(serializer, self->hdop); - - insert_float(serializer, self->vdop); - - insert_float(serializer, self->tdop); - - insert_float(serializer, self->ndop); - - insert_float(serializer, self->edop); - - insert_mip_gnss_dop_data_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_gnss_dop_data(mip_serializer* serializer, mip_gnss_dop_data* self) -{ - extract_float(serializer, &self->gdop); - - extract_float(serializer, &self->pdop); - - extract_float(serializer, &self->hdop); - - extract_float(serializer, &self->vdop); - - extract_float(serializer, &self->tdop); - - extract_float(serializer, &self->ndop); - - extract_float(serializer, &self->edop); - - extract_mip_gnss_dop_data_valid_flags(serializer, &self->valid_flags); - -} -bool extract_mip_gnss_dop_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_gnss_dop_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_gnss_dop_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_gnss_dop_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_dop_data_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_gnss_dop_data_valid_flags(struct mip_serializer* serializer, mip_gnss_dop_data_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_utc_time_data(mip_serializer* serializer, const mip_gnss_utc_time_data* self) -{ - insert_u16(serializer, self->year); - - insert_u8(serializer, self->month); - - insert_u8(serializer, self->day); - - insert_u8(serializer, self->hour); - - insert_u8(serializer, self->min); - - insert_u8(serializer, self->sec); - - insert_u32(serializer, self->msec); - - insert_mip_gnss_utc_time_data_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_gnss_utc_time_data(mip_serializer* serializer, mip_gnss_utc_time_data* self) -{ - extract_u16(serializer, &self->year); - - extract_u8(serializer, &self->month); - - extract_u8(serializer, &self->day); - - extract_u8(serializer, &self->hour); - - extract_u8(serializer, &self->min); - - extract_u8(serializer, &self->sec); - - extract_u32(serializer, &self->msec); - - extract_mip_gnss_utc_time_data_valid_flags(serializer, &self->valid_flags); - -} -bool extract_mip_gnss_utc_time_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_gnss_utc_time_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_gnss_utc_time_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_gnss_utc_time_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_utc_time_data_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_gnss_utc_time_data_valid_flags(struct mip_serializer* serializer, mip_gnss_utc_time_data_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_gps_time_data(mip_serializer* serializer, const mip_gnss_gps_time_data* self) -{ - insert_double(serializer, self->tow); - - insert_u16(serializer, self->week_number); - - insert_mip_gnss_gps_time_data_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_gnss_gps_time_data(mip_serializer* serializer, mip_gnss_gps_time_data* self) -{ - extract_double(serializer, &self->tow); - - extract_u16(serializer, &self->week_number); - - extract_mip_gnss_gps_time_data_valid_flags(serializer, &self->valid_flags); - -} -bool extract_mip_gnss_gps_time_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_gnss_gps_time_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_gnss_gps_time_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_gnss_gps_time_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_gps_time_data_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_gnss_gps_time_data_valid_flags(struct mip_serializer* serializer, mip_gnss_gps_time_data_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_clock_info_data(mip_serializer* serializer, const mip_gnss_clock_info_data* self) -{ - insert_double(serializer, self->bias); - - insert_double(serializer, self->drift); - - insert_double(serializer, self->accuracy_estimate); - - insert_mip_gnss_clock_info_data_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_gnss_clock_info_data(mip_serializer* serializer, mip_gnss_clock_info_data* self) -{ - extract_double(serializer, &self->bias); - - extract_double(serializer, &self->drift); - - extract_double(serializer, &self->accuracy_estimate); - - extract_mip_gnss_clock_info_data_valid_flags(serializer, &self->valid_flags); - -} -bool extract_mip_gnss_clock_info_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_gnss_clock_info_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_gnss_clock_info_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_gnss_clock_info_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_clock_info_data_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_gnss_clock_info_data_valid_flags(struct mip_serializer* serializer, mip_gnss_clock_info_data_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_fix_info_data(mip_serializer* serializer, const mip_gnss_fix_info_data* self) -{ - insert_mip_gnss_fix_info_data_fix_type(serializer, self->fix_type); - - insert_u8(serializer, self->num_sv); - - insert_mip_gnss_fix_info_data_fix_flags(serializer, self->fix_flags); - - insert_mip_gnss_fix_info_data_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_gnss_fix_info_data(mip_serializer* serializer, mip_gnss_fix_info_data* self) -{ - extract_mip_gnss_fix_info_data_fix_type(serializer, &self->fix_type); - - extract_u8(serializer, &self->num_sv); - - extract_mip_gnss_fix_info_data_fix_flags(serializer, &self->fix_flags); - - extract_mip_gnss_fix_info_data_valid_flags(serializer, &self->valid_flags); - -} -bool extract_mip_gnss_fix_info_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_gnss_fix_info_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_gnss_fix_info_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_gnss_fix_info_data_fix_type(struct mip_serializer* serializer, const mip_gnss_fix_info_data_fix_type self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_gnss_fix_info_data_fix_type(struct mip_serializer* serializer, mip_gnss_fix_info_data_fix_type* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_fix_info_data_fix_flags(struct mip_serializer* serializer, const mip_gnss_fix_info_data_fix_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_gnss_fix_info_data_fix_flags(struct mip_serializer* serializer, mip_gnss_fix_info_data_fix_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_fix_info_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_fix_info_data_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_gnss_fix_info_data_valid_flags(struct mip_serializer* serializer, mip_gnss_fix_info_data_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_sv_info_data(mip_serializer* serializer, const mip_gnss_sv_info_data* self) -{ - insert_u8(serializer, self->channel); - - insert_u8(serializer, self->sv_id); - - insert_u16(serializer, self->carrier_noise_ratio); - - insert_s16(serializer, self->azimuth); - - insert_s16(serializer, self->elevation); - - insert_mip_gnss_sv_info_data_svflags(serializer, self->sv_flags); - - insert_mip_gnss_sv_info_data_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_gnss_sv_info_data(mip_serializer* serializer, mip_gnss_sv_info_data* self) -{ - extract_u8(serializer, &self->channel); - - extract_u8(serializer, &self->sv_id); - - extract_u16(serializer, &self->carrier_noise_ratio); - - extract_s16(serializer, &self->azimuth); - - extract_s16(serializer, &self->elevation); - - extract_mip_gnss_sv_info_data_svflags(serializer, &self->sv_flags); - - extract_mip_gnss_sv_info_data_valid_flags(serializer, &self->valid_flags); - -} -bool extract_mip_gnss_sv_info_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_gnss_sv_info_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_gnss_sv_info_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_gnss_sv_info_data_svflags(struct mip_serializer* serializer, const mip_gnss_sv_info_data_svflags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_gnss_sv_info_data_svflags(struct mip_serializer* serializer, mip_gnss_sv_info_data_svflags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_sv_info_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_sv_info_data_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_gnss_sv_info_data_valid_flags(struct mip_serializer* serializer, mip_gnss_sv_info_data_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_hw_status_data(mip_serializer* serializer, const mip_gnss_hw_status_data* self) -{ - insert_mip_gnss_hw_status_data_receiver_state(serializer, self->receiver_state); - - insert_mip_gnss_hw_status_data_antenna_state(serializer, self->antenna_state); - - insert_mip_gnss_hw_status_data_antenna_power(serializer, self->antenna_power); - - insert_mip_gnss_hw_status_data_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_gnss_hw_status_data(mip_serializer* serializer, mip_gnss_hw_status_data* self) -{ - extract_mip_gnss_hw_status_data_receiver_state(serializer, &self->receiver_state); - - extract_mip_gnss_hw_status_data_antenna_state(serializer, &self->antenna_state); - - extract_mip_gnss_hw_status_data_antenna_power(serializer, &self->antenna_power); - - extract_mip_gnss_hw_status_data_valid_flags(serializer, &self->valid_flags); - -} -bool extract_mip_gnss_hw_status_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_gnss_hw_status_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_gnss_hw_status_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_gnss_hw_status_data_receiver_state(struct mip_serializer* serializer, const mip_gnss_hw_status_data_receiver_state self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_gnss_hw_status_data_receiver_state(struct mip_serializer* serializer, mip_gnss_hw_status_data_receiver_state* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_hw_status_data_antenna_state(struct mip_serializer* serializer, const mip_gnss_hw_status_data_antenna_state self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_gnss_hw_status_data_antenna_state(struct mip_serializer* serializer, mip_gnss_hw_status_data_antenna_state* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_hw_status_data_antenna_power(struct mip_serializer* serializer, const mip_gnss_hw_status_data_antenna_power self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_gnss_hw_status_data_antenna_power(struct mip_serializer* serializer, mip_gnss_hw_status_data_antenna_power* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_hw_status_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_hw_status_data_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_gnss_hw_status_data_valid_flags(struct mip_serializer* serializer, mip_gnss_hw_status_data_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_dgps_info_data(mip_serializer* serializer, const mip_gnss_dgps_info_data* self) -{ - insert_u8(serializer, self->sv_id); - - insert_float(serializer, self->age); - - insert_float(serializer, self->range_correction); - - insert_float(serializer, self->range_rate_correction); - - insert_mip_gnss_dgps_info_data_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_gnss_dgps_info_data(mip_serializer* serializer, mip_gnss_dgps_info_data* self) -{ - extract_u8(serializer, &self->sv_id); - - extract_float(serializer, &self->age); - - extract_float(serializer, &self->range_correction); - - extract_float(serializer, &self->range_rate_correction); - - extract_mip_gnss_dgps_info_data_valid_flags(serializer, &self->valid_flags); - -} -bool extract_mip_gnss_dgps_info_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_gnss_dgps_info_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_gnss_dgps_info_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_gnss_dgps_info_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_dgps_info_data_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_gnss_dgps_info_data_valid_flags(struct mip_serializer* serializer, mip_gnss_dgps_info_data_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_dgps_channel_data(mip_serializer* serializer, const mip_gnss_dgps_channel_data* self) -{ - insert_u8(serializer, self->sv_id); - - insert_float(serializer, self->age); - - insert_float(serializer, self->range_correction); - - insert_float(serializer, self->range_rate_correction); - - insert_mip_gnss_dgps_channel_data_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_gnss_dgps_channel_data(mip_serializer* serializer, mip_gnss_dgps_channel_data* self) -{ - extract_u8(serializer, &self->sv_id); - - extract_float(serializer, &self->age); - - extract_float(serializer, &self->range_correction); - - extract_float(serializer, &self->range_rate_correction); - - extract_mip_gnss_dgps_channel_data_valid_flags(serializer, &self->valid_flags); - -} -bool extract_mip_gnss_dgps_channel_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_gnss_dgps_channel_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_gnss_dgps_channel_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_gnss_dgps_channel_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_dgps_channel_data_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_gnss_dgps_channel_data_valid_flags(struct mip_serializer* serializer, mip_gnss_dgps_channel_data_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_clock_info_2_data(mip_serializer* serializer, const mip_gnss_clock_info_2_data* self) -{ - insert_double(serializer, self->bias); - - insert_double(serializer, self->drift); - - insert_double(serializer, self->bias_accuracy_estimate); - - insert_double(serializer, self->drift_accuracy_estimate); - - insert_mip_gnss_clock_info_2_data_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_gnss_clock_info_2_data(mip_serializer* serializer, mip_gnss_clock_info_2_data* self) -{ - extract_double(serializer, &self->bias); - - extract_double(serializer, &self->drift); - - extract_double(serializer, &self->bias_accuracy_estimate); - - extract_double(serializer, &self->drift_accuracy_estimate); - - extract_mip_gnss_clock_info_2_data_valid_flags(serializer, &self->valid_flags); - -} -bool extract_mip_gnss_clock_info_2_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_gnss_clock_info_2_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_gnss_clock_info_2_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_gnss_clock_info_2_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_clock_info_2_data_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_gnss_clock_info_2_data_valid_flags(struct mip_serializer* serializer, mip_gnss_clock_info_2_data_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_gps_leap_seconds_data(mip_serializer* serializer, const mip_gnss_gps_leap_seconds_data* self) -{ - insert_u8(serializer, self->leap_seconds); - - insert_mip_gnss_gps_leap_seconds_data_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_gnss_gps_leap_seconds_data(mip_serializer* serializer, mip_gnss_gps_leap_seconds_data* self) -{ - extract_u8(serializer, &self->leap_seconds); - - extract_mip_gnss_gps_leap_seconds_data_valid_flags(serializer, &self->valid_flags); - -} -bool extract_mip_gnss_gps_leap_seconds_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_gnss_gps_leap_seconds_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_gnss_gps_leap_seconds_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_gnss_gps_leap_seconds_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_gps_leap_seconds_data_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_gnss_gps_leap_seconds_data_valid_flags(struct mip_serializer* serializer, mip_gnss_gps_leap_seconds_data_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_sbas_info_data(mip_serializer* serializer, const mip_gnss_sbas_info_data* self) -{ - insert_double(serializer, self->time_of_week); - - insert_u16(serializer, self->week_number); - - insert_mip_sbas_system(serializer, self->sbas_system); - - insert_u8(serializer, self->sbas_id); - - insert_u8(serializer, self->count); - - insert_mip_gnss_sbas_info_data_sbas_status(serializer, self->sbas_status); - - insert_mip_gnss_sbas_info_data_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_gnss_sbas_info_data(mip_serializer* serializer, mip_gnss_sbas_info_data* self) -{ - extract_double(serializer, &self->time_of_week); - - extract_u16(serializer, &self->week_number); - - extract_mip_sbas_system(serializer, &self->sbas_system); - - extract_u8(serializer, &self->sbas_id); - - extract_u8(serializer, &self->count); - - extract_mip_gnss_sbas_info_data_sbas_status(serializer, &self->sbas_status); - - extract_mip_gnss_sbas_info_data_valid_flags(serializer, &self->valid_flags); - -} -bool extract_mip_gnss_sbas_info_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_gnss_sbas_info_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_gnss_sbas_info_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_gnss_sbas_info_data_sbas_status(struct mip_serializer* serializer, const mip_gnss_sbas_info_data_sbas_status self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_gnss_sbas_info_data_sbas_status(struct mip_serializer* serializer, mip_gnss_sbas_info_data_sbas_status* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_sbas_info_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_sbas_info_data_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_gnss_sbas_info_data_valid_flags(struct mip_serializer* serializer, mip_gnss_sbas_info_data_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_sbas_correction_data(mip_serializer* serializer, const mip_gnss_sbas_correction_data* self) -{ - insert_u8(serializer, self->index); - - insert_u8(serializer, self->count); - - insert_double(serializer, self->time_of_week); - - insert_u16(serializer, self->week_number); - - insert_mip_gnss_constellation_id(serializer, self->gnss_id); - - insert_u8(serializer, self->sv_id); - - insert_u8(serializer, self->udrei); - - insert_float(serializer, self->pseudorange_correction); - - insert_float(serializer, self->iono_correction); - - insert_mip_gnss_sbas_correction_data_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_gnss_sbas_correction_data(mip_serializer* serializer, mip_gnss_sbas_correction_data* self) -{ - extract_u8(serializer, &self->index); - - extract_u8(serializer, &self->count); - - extract_double(serializer, &self->time_of_week); - - extract_u16(serializer, &self->week_number); - - extract_mip_gnss_constellation_id(serializer, &self->gnss_id); - - extract_u8(serializer, &self->sv_id); - - extract_u8(serializer, &self->udrei); - - extract_float(serializer, &self->pseudorange_correction); - - extract_float(serializer, &self->iono_correction); - - extract_mip_gnss_sbas_correction_data_valid_flags(serializer, &self->valid_flags); - -} -bool extract_mip_gnss_sbas_correction_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_gnss_sbas_correction_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_gnss_sbas_correction_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_gnss_sbas_correction_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_sbas_correction_data_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_gnss_sbas_correction_data_valid_flags(struct mip_serializer* serializer, mip_gnss_sbas_correction_data_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_rf_error_detection_data(mip_serializer* serializer, const mip_gnss_rf_error_detection_data* self) -{ - insert_mip_gnss_rf_error_detection_data_rfband(serializer, self->rf_band); - - insert_mip_gnss_rf_error_detection_data_jamming_state(serializer, self->jamming_state); - - insert_mip_gnss_rf_error_detection_data_spoofing_state(serializer, self->spoofing_state); - - for(unsigned int i=0; i < 4; i++) - insert_u8(serializer, self->reserved[i]); - - insert_mip_gnss_rf_error_detection_data_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_gnss_rf_error_detection_data(mip_serializer* serializer, mip_gnss_rf_error_detection_data* self) -{ - extract_mip_gnss_rf_error_detection_data_rfband(serializer, &self->rf_band); - - extract_mip_gnss_rf_error_detection_data_jamming_state(serializer, &self->jamming_state); - - extract_mip_gnss_rf_error_detection_data_spoofing_state(serializer, &self->spoofing_state); - - for(unsigned int i=0; i < 4; i++) - extract_u8(serializer, &self->reserved[i]); - - extract_mip_gnss_rf_error_detection_data_valid_flags(serializer, &self->valid_flags); - -} -bool extract_mip_gnss_rf_error_detection_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_gnss_rf_error_detection_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_gnss_rf_error_detection_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_gnss_rf_error_detection_data_rfband(struct mip_serializer* serializer, const mip_gnss_rf_error_detection_data_rfband self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_gnss_rf_error_detection_data_rfband(struct mip_serializer* serializer, mip_gnss_rf_error_detection_data_rfband* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_rf_error_detection_data_jamming_state(struct mip_serializer* serializer, const mip_gnss_rf_error_detection_data_jamming_state self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_gnss_rf_error_detection_data_jamming_state(struct mip_serializer* serializer, mip_gnss_rf_error_detection_data_jamming_state* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_rf_error_detection_data_spoofing_state(struct mip_serializer* serializer, const mip_gnss_rf_error_detection_data_spoofing_state self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_gnss_rf_error_detection_data_spoofing_state(struct mip_serializer* serializer, mip_gnss_rf_error_detection_data_spoofing_state* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_rf_error_detection_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_rf_error_detection_data_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_gnss_rf_error_detection_data_valid_flags(struct mip_serializer* serializer, mip_gnss_rf_error_detection_data_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_base_station_info_data(mip_serializer* serializer, const mip_gnss_base_station_info_data* self) -{ - insert_double(serializer, self->time_of_week); - - insert_u16(serializer, self->week_number); - - for(unsigned int i=0; i < 3; i++) - insert_double(serializer, self->ecef_pos[i]); - - insert_float(serializer, self->height); - - insert_u16(serializer, self->station_id); - - insert_mip_gnss_base_station_info_data_indicator_flags(serializer, self->indicators); - - insert_mip_gnss_base_station_info_data_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_gnss_base_station_info_data(mip_serializer* serializer, mip_gnss_base_station_info_data* self) -{ - extract_double(serializer, &self->time_of_week); - - extract_u16(serializer, &self->week_number); - - for(unsigned int i=0; i < 3; i++) - extract_double(serializer, &self->ecef_pos[i]); - - extract_float(serializer, &self->height); - - extract_u16(serializer, &self->station_id); - - extract_mip_gnss_base_station_info_data_indicator_flags(serializer, &self->indicators); - - extract_mip_gnss_base_station_info_data_valid_flags(serializer, &self->valid_flags); - -} -bool extract_mip_gnss_base_station_info_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_gnss_base_station_info_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_gnss_base_station_info_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_gnss_base_station_info_data_indicator_flags(struct mip_serializer* serializer, const mip_gnss_base_station_info_data_indicator_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_gnss_base_station_info_data_indicator_flags(struct mip_serializer* serializer, mip_gnss_base_station_info_data_indicator_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_base_station_info_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_base_station_info_data_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_gnss_base_station_info_data_valid_flags(struct mip_serializer* serializer, mip_gnss_base_station_info_data_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_rtk_corrections_status_data(mip_serializer* serializer, const mip_gnss_rtk_corrections_status_data* self) -{ - insert_double(serializer, self->time_of_week); - - insert_u16(serializer, self->week_number); - - insert_mip_gnss_rtk_corrections_status_data_epoch_status(serializer, self->epoch_status); - - insert_u32(serializer, self->dongle_status); - - insert_float(serializer, self->gps_correction_latency); - - insert_float(serializer, self->glonass_correction_latency); - - insert_float(serializer, self->galileo_correction_latency); - - insert_float(serializer, self->beidou_correction_latency); - - for(unsigned int i=0; i < 4; i++) - insert_u32(serializer, self->reserved[i]); - - insert_mip_gnss_rtk_corrections_status_data_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_gnss_rtk_corrections_status_data(mip_serializer* serializer, mip_gnss_rtk_corrections_status_data* self) -{ - extract_double(serializer, &self->time_of_week); - - extract_u16(serializer, &self->week_number); - - extract_mip_gnss_rtk_corrections_status_data_epoch_status(serializer, &self->epoch_status); - - extract_u32(serializer, &self->dongle_status); - - extract_float(serializer, &self->gps_correction_latency); - - extract_float(serializer, &self->glonass_correction_latency); - - extract_float(serializer, &self->galileo_correction_latency); - - extract_float(serializer, &self->beidou_correction_latency); - - for(unsigned int i=0; i < 4; i++) - extract_u32(serializer, &self->reserved[i]); - - extract_mip_gnss_rtk_corrections_status_data_valid_flags(serializer, &self->valid_flags); - -} -bool extract_mip_gnss_rtk_corrections_status_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_gnss_rtk_corrections_status_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_gnss_rtk_corrections_status_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_gnss_rtk_corrections_status_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_rtk_corrections_status_data_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_gnss_rtk_corrections_status_data_valid_flags(struct mip_serializer* serializer, mip_gnss_rtk_corrections_status_data_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_rtk_corrections_status_data_epoch_status(struct mip_serializer* serializer, const mip_gnss_rtk_corrections_status_data_epoch_status self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_gnss_rtk_corrections_status_data_epoch_status(struct mip_serializer* serializer, mip_gnss_rtk_corrections_status_data_epoch_status* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_satellite_status_data(mip_serializer* serializer, const mip_gnss_satellite_status_data* self) -{ - insert_u8(serializer, self->index); - - insert_u8(serializer, self->count); - - insert_double(serializer, self->time_of_week); - - insert_u16(serializer, self->week_number); - - insert_mip_gnss_constellation_id(serializer, self->gnss_id); - - insert_u8(serializer, self->satellite_id); - - insert_float(serializer, self->elevation); - - insert_float(serializer, self->azimuth); - - insert_bool(serializer, self->health); - - insert_mip_gnss_satellite_status_data_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_gnss_satellite_status_data(mip_serializer* serializer, mip_gnss_satellite_status_data* self) -{ - extract_u8(serializer, &self->index); - - extract_u8(serializer, &self->count); - - extract_double(serializer, &self->time_of_week); - - extract_u16(serializer, &self->week_number); - - extract_mip_gnss_constellation_id(serializer, &self->gnss_id); - - extract_u8(serializer, &self->satellite_id); - - extract_float(serializer, &self->elevation); - - extract_float(serializer, &self->azimuth); - - extract_bool(serializer, &self->health); - - extract_mip_gnss_satellite_status_data_valid_flags(serializer, &self->valid_flags); - -} -bool extract_mip_gnss_satellite_status_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_gnss_satellite_status_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_gnss_satellite_status_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_gnss_satellite_status_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_satellite_status_data_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_gnss_satellite_status_data_valid_flags(struct mip_serializer* serializer, mip_gnss_satellite_status_data_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_raw_data(mip_serializer* serializer, const mip_gnss_raw_data* self) -{ - insert_u8(serializer, self->index); - - insert_u8(serializer, self->count); - - insert_double(serializer, self->time_of_week); - - insert_u16(serializer, self->week_number); - - insert_u16(serializer, self->receiver_id); - - insert_u8(serializer, self->tracking_channel); - - insert_mip_gnss_constellation_id(serializer, self->gnss_id); - - insert_u8(serializer, self->satellite_id); - - insert_mip_gnss_signal_id(serializer, self->signal_id); - - insert_float(serializer, self->signal_strength); - - insert_mip_gnss_raw_data_gnss_signal_quality(serializer, self->quality); - - insert_double(serializer, self->pseudorange); - - insert_double(serializer, self->carrier_phase); - - insert_float(serializer, self->doppler); - - insert_float(serializer, self->range_uncert); - - insert_float(serializer, self->phase_uncert); - - insert_float(serializer, self->doppler_uncert); - - insert_float(serializer, self->lock_time); - - insert_mip_gnss_raw_data_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_gnss_raw_data(mip_serializer* serializer, mip_gnss_raw_data* self) -{ - extract_u8(serializer, &self->index); - - extract_u8(serializer, &self->count); - - extract_double(serializer, &self->time_of_week); - - extract_u16(serializer, &self->week_number); - - extract_u16(serializer, &self->receiver_id); - - extract_u8(serializer, &self->tracking_channel); - - extract_mip_gnss_constellation_id(serializer, &self->gnss_id); - - extract_u8(serializer, &self->satellite_id); - - extract_mip_gnss_signal_id(serializer, &self->signal_id); - - extract_float(serializer, &self->signal_strength); - - extract_mip_gnss_raw_data_gnss_signal_quality(serializer, &self->quality); - - extract_double(serializer, &self->pseudorange); - - extract_double(serializer, &self->carrier_phase); - - extract_float(serializer, &self->doppler); - - extract_float(serializer, &self->range_uncert); - - extract_float(serializer, &self->phase_uncert); - - extract_float(serializer, &self->doppler_uncert); - - extract_float(serializer, &self->lock_time); - - extract_mip_gnss_raw_data_valid_flags(serializer, &self->valid_flags); - -} -bool extract_mip_gnss_raw_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_gnss_raw_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_gnss_raw_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_gnss_raw_data_gnss_signal_quality(struct mip_serializer* serializer, const mip_gnss_raw_data_gnss_signal_quality self) -{ - insert_u8(serializer, (uint8_t)(self)); -} -void extract_mip_gnss_raw_data_gnss_signal_quality(struct mip_serializer* serializer, mip_gnss_raw_data_gnss_signal_quality* self) -{ - uint8_t tmp = 0; - extract_u8(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_raw_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_raw_data_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_gnss_raw_data_valid_flags(struct mip_serializer* serializer, mip_gnss_raw_data_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_gps_ephemeris_data(mip_serializer* serializer, const mip_gnss_gps_ephemeris_data* self) -{ - insert_u8(serializer, self->index); - - insert_u8(serializer, self->count); - - insert_double(serializer, self->time_of_week); - - insert_u16(serializer, self->week_number); - - insert_u8(serializer, self->satellite_id); - - insert_u8(serializer, self->health); - - insert_u8(serializer, self->iodc); - - insert_u8(serializer, self->iode); - - insert_double(serializer, self->t_oc); - - insert_double(serializer, self->af0); - - insert_double(serializer, self->af1); - - insert_double(serializer, self->af2); - - insert_double(serializer, self->t_gd); - - insert_double(serializer, self->ISC_L1CA); - - insert_double(serializer, self->ISC_L2C); - - insert_double(serializer, self->t_oe); - - insert_double(serializer, self->a); - - insert_double(serializer, self->a_dot); - - insert_double(serializer, self->mean_anomaly); - - insert_double(serializer, self->delta_mean_motion); - - insert_double(serializer, self->delta_mean_motion_dot); - - insert_double(serializer, self->eccentricity); - - insert_double(serializer, self->argument_of_perigee); - - insert_double(serializer, self->omega); - - insert_double(serializer, self->omega_dot); - - insert_double(serializer, self->inclination); - - insert_double(serializer, self->inclination_dot); - - insert_double(serializer, self->c_ic); - - insert_double(serializer, self->c_is); - - insert_double(serializer, self->c_uc); - - insert_double(serializer, self->c_us); - - insert_double(serializer, self->c_rc); - - insert_double(serializer, self->c_rs); - - insert_mip_gnss_gps_ephemeris_data_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_gnss_gps_ephemeris_data(mip_serializer* serializer, mip_gnss_gps_ephemeris_data* self) -{ - extract_u8(serializer, &self->index); - - extract_u8(serializer, &self->count); - - extract_double(serializer, &self->time_of_week); - - extract_u16(serializer, &self->week_number); - - extract_u8(serializer, &self->satellite_id); - - extract_u8(serializer, &self->health); - - extract_u8(serializer, &self->iodc); - - extract_u8(serializer, &self->iode); - - extract_double(serializer, &self->t_oc); - - extract_double(serializer, &self->af0); - - extract_double(serializer, &self->af1); - - extract_double(serializer, &self->af2); - - extract_double(serializer, &self->t_gd); - - extract_double(serializer, &self->ISC_L1CA); - - extract_double(serializer, &self->ISC_L2C); - - extract_double(serializer, &self->t_oe); - - extract_double(serializer, &self->a); - - extract_double(serializer, &self->a_dot); - - extract_double(serializer, &self->mean_anomaly); - - extract_double(serializer, &self->delta_mean_motion); - - extract_double(serializer, &self->delta_mean_motion_dot); - - extract_double(serializer, &self->eccentricity); - - extract_double(serializer, &self->argument_of_perigee); - - extract_double(serializer, &self->omega); - - extract_double(serializer, &self->omega_dot); - - extract_double(serializer, &self->inclination); - - extract_double(serializer, &self->inclination_dot); - - extract_double(serializer, &self->c_ic); - - extract_double(serializer, &self->c_is); - - extract_double(serializer, &self->c_uc); - - extract_double(serializer, &self->c_us); - - extract_double(serializer, &self->c_rc); - - extract_double(serializer, &self->c_rs); - - extract_mip_gnss_gps_ephemeris_data_valid_flags(serializer, &self->valid_flags); - -} -bool extract_mip_gnss_gps_ephemeris_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_gnss_gps_ephemeris_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_gnss_gps_ephemeris_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_gnss_gps_ephemeris_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_gps_ephemeris_data_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_gnss_gps_ephemeris_data_valid_flags(struct mip_serializer* serializer, mip_gnss_gps_ephemeris_data_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_galileo_ephemeris_data(mip_serializer* serializer, const mip_gnss_galileo_ephemeris_data* self) -{ - insert_u8(serializer, self->index); - - insert_u8(serializer, self->count); - - insert_double(serializer, self->time_of_week); - - insert_u16(serializer, self->week_number); - - insert_u8(serializer, self->satellite_id); - - insert_u8(serializer, self->health); - - insert_u8(serializer, self->iodc); - - insert_u8(serializer, self->iode); - - insert_double(serializer, self->t_oc); - - insert_double(serializer, self->af0); - - insert_double(serializer, self->af1); - - insert_double(serializer, self->af2); - - insert_double(serializer, self->t_gd); - - insert_double(serializer, self->ISC_L1CA); - - insert_double(serializer, self->ISC_L2C); - - insert_double(serializer, self->t_oe); - - insert_double(serializer, self->a); - - insert_double(serializer, self->a_dot); - - insert_double(serializer, self->mean_anomaly); - - insert_double(serializer, self->delta_mean_motion); - - insert_double(serializer, self->delta_mean_motion_dot); - - insert_double(serializer, self->eccentricity); - - insert_double(serializer, self->argument_of_perigee); - - insert_double(serializer, self->omega); - - insert_double(serializer, self->omega_dot); - - insert_double(serializer, self->inclination); - - insert_double(serializer, self->inclination_dot); - - insert_double(serializer, self->c_ic); - - insert_double(serializer, self->c_is); - - insert_double(serializer, self->c_uc); - - insert_double(serializer, self->c_us); - - insert_double(serializer, self->c_rc); - - insert_double(serializer, self->c_rs); - - insert_mip_gnss_galileo_ephemeris_data_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_gnss_galileo_ephemeris_data(mip_serializer* serializer, mip_gnss_galileo_ephemeris_data* self) -{ - extract_u8(serializer, &self->index); - - extract_u8(serializer, &self->count); - - extract_double(serializer, &self->time_of_week); - - extract_u16(serializer, &self->week_number); - - extract_u8(serializer, &self->satellite_id); - - extract_u8(serializer, &self->health); - - extract_u8(serializer, &self->iodc); - - extract_u8(serializer, &self->iode); - - extract_double(serializer, &self->t_oc); - - extract_double(serializer, &self->af0); - - extract_double(serializer, &self->af1); - - extract_double(serializer, &self->af2); - - extract_double(serializer, &self->t_gd); - - extract_double(serializer, &self->ISC_L1CA); - - extract_double(serializer, &self->ISC_L2C); - - extract_double(serializer, &self->t_oe); - - extract_double(serializer, &self->a); - - extract_double(serializer, &self->a_dot); - - extract_double(serializer, &self->mean_anomaly); - - extract_double(serializer, &self->delta_mean_motion); - - extract_double(serializer, &self->delta_mean_motion_dot); - - extract_double(serializer, &self->eccentricity); - - extract_double(serializer, &self->argument_of_perigee); - - extract_double(serializer, &self->omega); - - extract_double(serializer, &self->omega_dot); - - extract_double(serializer, &self->inclination); - - extract_double(serializer, &self->inclination_dot); - - extract_double(serializer, &self->c_ic); - - extract_double(serializer, &self->c_is); - - extract_double(serializer, &self->c_uc); - - extract_double(serializer, &self->c_us); - - extract_double(serializer, &self->c_rc); - - extract_double(serializer, &self->c_rs); - - extract_mip_gnss_galileo_ephemeris_data_valid_flags(serializer, &self->valid_flags); - -} -bool extract_mip_gnss_galileo_ephemeris_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_gnss_galileo_ephemeris_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_gnss_galileo_ephemeris_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_gnss_galileo_ephemeris_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_galileo_ephemeris_data_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_gnss_galileo_ephemeris_data_valid_flags(struct mip_serializer* serializer, mip_gnss_galileo_ephemeris_data_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_glo_ephemeris_data(mip_serializer* serializer, const mip_gnss_glo_ephemeris_data* self) -{ - insert_u8(serializer, self->index); - - insert_u8(serializer, self->count); - - insert_double(serializer, self->time_of_week); - - insert_u16(serializer, self->week_number); - - insert_u8(serializer, self->satellite_id); - - insert_s8(serializer, self->freq_number); - - insert_u32(serializer, self->tk); - - insert_u32(serializer, self->tb); - - insert_u8(serializer, self->sat_type); - - insert_double(serializer, self->gamma); - - insert_double(serializer, self->tau_n); - - for(unsigned int i=0; i < 3; i++) - insert_double(serializer, self->x[i]); - - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->v[i]); - - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->a[i]); - - insert_u8(serializer, self->health); - - insert_u8(serializer, self->P); - - insert_u8(serializer, self->NT); - - insert_float(serializer, self->delta_tau_n); - - insert_u8(serializer, self->Ft); - - insert_u8(serializer, self->En); - - insert_u8(serializer, self->P1); - - insert_u8(serializer, self->P2); - - insert_u8(serializer, self->P3); - - insert_u8(serializer, self->P4); - - insert_mip_gnss_glo_ephemeris_data_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_gnss_glo_ephemeris_data(mip_serializer* serializer, mip_gnss_glo_ephemeris_data* self) -{ - extract_u8(serializer, &self->index); - - extract_u8(serializer, &self->count); - - extract_double(serializer, &self->time_of_week); - - extract_u16(serializer, &self->week_number); - - extract_u8(serializer, &self->satellite_id); - - extract_s8(serializer, &self->freq_number); - - extract_u32(serializer, &self->tk); - - extract_u32(serializer, &self->tb); - - extract_u8(serializer, &self->sat_type); - - extract_double(serializer, &self->gamma); - - extract_double(serializer, &self->tau_n); - - for(unsigned int i=0; i < 3; i++) - extract_double(serializer, &self->x[i]); - - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->v[i]); - - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->a[i]); - - extract_u8(serializer, &self->health); - - extract_u8(serializer, &self->P); - - extract_u8(serializer, &self->NT); - - extract_float(serializer, &self->delta_tau_n); - - extract_u8(serializer, &self->Ft); - - extract_u8(serializer, &self->En); - - extract_u8(serializer, &self->P1); - - extract_u8(serializer, &self->P2); - - extract_u8(serializer, &self->P3); - - extract_u8(serializer, &self->P4); - - extract_mip_gnss_glo_ephemeris_data_valid_flags(serializer, &self->valid_flags); - -} -bool extract_mip_gnss_glo_ephemeris_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_gnss_glo_ephemeris_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_gnss_glo_ephemeris_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_gnss_glo_ephemeris_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_glo_ephemeris_data_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_gnss_glo_ephemeris_data_valid_flags(struct mip_serializer* serializer, mip_gnss_glo_ephemeris_data_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_gps_iono_corr_data(mip_serializer* serializer, const mip_gnss_gps_iono_corr_data* self) -{ - insert_double(serializer, self->time_of_week); - - insert_u16(serializer, self->week_number); - - for(unsigned int i=0; i < 4; i++) - insert_double(serializer, self->alpha[i]); - - for(unsigned int i=0; i < 4; i++) - insert_double(serializer, self->beta[i]); - - insert_mip_gnss_gps_iono_corr_data_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_gnss_gps_iono_corr_data(mip_serializer* serializer, mip_gnss_gps_iono_corr_data* self) -{ - extract_double(serializer, &self->time_of_week); - - extract_u16(serializer, &self->week_number); - - for(unsigned int i=0; i < 4; i++) - extract_double(serializer, &self->alpha[i]); - - for(unsigned int i=0; i < 4; i++) - extract_double(serializer, &self->beta[i]); - - extract_mip_gnss_gps_iono_corr_data_valid_flags(serializer, &self->valid_flags); - -} -bool extract_mip_gnss_gps_iono_corr_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_gnss_gps_iono_corr_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_gnss_gps_iono_corr_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_gnss_gps_iono_corr_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_gps_iono_corr_data_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_gnss_gps_iono_corr_data_valid_flags(struct mip_serializer* serializer, mip_gnss_gps_iono_corr_data_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_gnss_galileo_iono_corr_data(mip_serializer* serializer, const mip_gnss_galileo_iono_corr_data* self) -{ - insert_double(serializer, self->time_of_week); - - insert_u16(serializer, self->week_number); - - for(unsigned int i=0; i < 3; i++) - insert_double(serializer, self->alpha[i]); - - insert_u8(serializer, self->disturbance_flags); - - insert_mip_gnss_galileo_iono_corr_data_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_gnss_galileo_iono_corr_data(mip_serializer* serializer, mip_gnss_galileo_iono_corr_data* self) -{ - extract_double(serializer, &self->time_of_week); - - extract_u16(serializer, &self->week_number); - - for(unsigned int i=0; i < 3; i++) - extract_double(serializer, &self->alpha[i]); - - extract_u8(serializer, &self->disturbance_flags); - - extract_mip_gnss_galileo_iono_corr_data_valid_flags(serializer, &self->valid_flags); - -} -bool extract_mip_gnss_galileo_iono_corr_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_gnss_galileo_iono_corr_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_gnss_galileo_iono_corr_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_gnss_galileo_iono_corr_data_valid_flags(struct mip_serializer* serializer, const mip_gnss_galileo_iono_corr_data_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_gnss_galileo_iono_corr_data_valid_flags(struct mip_serializer* serializer, mip_gnss_galileo_iono_corr_data_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - - -#ifdef __cplusplus -} // namespace C -} // namespace mip -} // extern "C" -#endif // __cplusplus - diff --git a/src/mip/definitions/data_gnss.cpp b/src/mip/definitions/data_gnss.cpp deleted file mode 100644 index 2511644c5..000000000 --- a/src/mip/definitions/data_gnss.cpp +++ /dev/null @@ -1,1232 +0,0 @@ - -#include "data_gnss.hpp" - -#include "../utils/serialization.h" -#include "../mip_interface.h" - -#include - - -namespace mip { -class Serializer; - -namespace C { -struct mip_interface; -} // namespace C - -namespace data_gnss { - -using ::mip::insert; -using ::mip::extract; -using namespace ::mip::C; - -//////////////////////////////////////////////////////////////////////////////// -// Shared Type Definitions -//////////////////////////////////////////////////////////////////////////////// - - -//////////////////////////////////////////////////////////////////////////////// -// Mip Fields -//////////////////////////////////////////////////////////////////////////////// - -void insert(Serializer& serializer, const PosLlh& self) -{ - insert(serializer, self.latitude); - - insert(serializer, self.longitude); - - insert(serializer, self.ellipsoid_height); - - insert(serializer, self.msl_height); - - insert(serializer, self.horizontal_accuracy); - - insert(serializer, self.vertical_accuracy); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, PosLlh& self) -{ - extract(serializer, self.latitude); - - extract(serializer, self.longitude); - - extract(serializer, self.ellipsoid_height); - - extract(serializer, self.msl_height); - - extract(serializer, self.horizontal_accuracy); - - extract(serializer, self.vertical_accuracy); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const PosEcef& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.x[i]); - - insert(serializer, self.x_accuracy); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, PosEcef& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.x[i]); - - extract(serializer, self.x_accuracy); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const VelNed& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.v[i]); - - insert(serializer, self.speed); - - insert(serializer, self.ground_speed); - - insert(serializer, self.heading); - - insert(serializer, self.speed_accuracy); - - insert(serializer, self.heading_accuracy); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, VelNed& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.v[i]); - - extract(serializer, self.speed); - - extract(serializer, self.ground_speed); - - extract(serializer, self.heading); - - extract(serializer, self.speed_accuracy); - - extract(serializer, self.heading_accuracy); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const VelEcef& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.v[i]); - - insert(serializer, self.v_accuracy); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, VelEcef& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.v[i]); - - extract(serializer, self.v_accuracy); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const Dop& self) -{ - insert(serializer, self.gdop); - - insert(serializer, self.pdop); - - insert(serializer, self.hdop); - - insert(serializer, self.vdop); - - insert(serializer, self.tdop); - - insert(serializer, self.ndop); - - insert(serializer, self.edop); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, Dop& self) -{ - extract(serializer, self.gdop); - - extract(serializer, self.pdop); - - extract(serializer, self.hdop); - - extract(serializer, self.vdop); - - extract(serializer, self.tdop); - - extract(serializer, self.ndop); - - extract(serializer, self.edop); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const UtcTime& self) -{ - insert(serializer, self.year); - - insert(serializer, self.month); - - insert(serializer, self.day); - - insert(serializer, self.hour); - - insert(serializer, self.min); - - insert(serializer, self.sec); - - insert(serializer, self.msec); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, UtcTime& self) -{ - extract(serializer, self.year); - - extract(serializer, self.month); - - extract(serializer, self.day); - - extract(serializer, self.hour); - - extract(serializer, self.min); - - extract(serializer, self.sec); - - extract(serializer, self.msec); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const GpsTime& self) -{ - insert(serializer, self.tow); - - insert(serializer, self.week_number); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, GpsTime& self) -{ - extract(serializer, self.tow); - - extract(serializer, self.week_number); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const ClockInfo& self) -{ - insert(serializer, self.bias); - - insert(serializer, self.drift); - - insert(serializer, self.accuracy_estimate); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, ClockInfo& self) -{ - extract(serializer, self.bias); - - extract(serializer, self.drift); - - extract(serializer, self.accuracy_estimate); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const FixInfo& self) -{ - insert(serializer, self.fix_type); - - insert(serializer, self.num_sv); - - insert(serializer, self.fix_flags); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, FixInfo& self) -{ - extract(serializer, self.fix_type); - - extract(serializer, self.num_sv); - - extract(serializer, self.fix_flags); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const SvInfo& self) -{ - insert(serializer, self.channel); - - insert(serializer, self.sv_id); - - insert(serializer, self.carrier_noise_ratio); - - insert(serializer, self.azimuth); - - insert(serializer, self.elevation); - - insert(serializer, self.sv_flags); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, SvInfo& self) -{ - extract(serializer, self.channel); - - extract(serializer, self.sv_id); - - extract(serializer, self.carrier_noise_ratio); - - extract(serializer, self.azimuth); - - extract(serializer, self.elevation); - - extract(serializer, self.sv_flags); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const HwStatus& self) -{ - insert(serializer, self.receiver_state); - - insert(serializer, self.antenna_state); - - insert(serializer, self.antenna_power); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, HwStatus& self) -{ - extract(serializer, self.receiver_state); - - extract(serializer, self.antenna_state); - - extract(serializer, self.antenna_power); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const DgpsInfo& self) -{ - insert(serializer, self.sv_id); - - insert(serializer, self.age); - - insert(serializer, self.range_correction); - - insert(serializer, self.range_rate_correction); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, DgpsInfo& self) -{ - extract(serializer, self.sv_id); - - extract(serializer, self.age); - - extract(serializer, self.range_correction); - - extract(serializer, self.range_rate_correction); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const DgpsChannel& self) -{ - insert(serializer, self.sv_id); - - insert(serializer, self.age); - - insert(serializer, self.range_correction); - - insert(serializer, self.range_rate_correction); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, DgpsChannel& self) -{ - extract(serializer, self.sv_id); - - extract(serializer, self.age); - - extract(serializer, self.range_correction); - - extract(serializer, self.range_rate_correction); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const ClockInfo2& self) -{ - insert(serializer, self.bias); - - insert(serializer, self.drift); - - insert(serializer, self.bias_accuracy_estimate); - - insert(serializer, self.drift_accuracy_estimate); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, ClockInfo2& self) -{ - extract(serializer, self.bias); - - extract(serializer, self.drift); - - extract(serializer, self.bias_accuracy_estimate); - - extract(serializer, self.drift_accuracy_estimate); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const GpsLeapSeconds& self) -{ - insert(serializer, self.leap_seconds); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, GpsLeapSeconds& self) -{ - extract(serializer, self.leap_seconds); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const SbasInfo& self) -{ - insert(serializer, self.time_of_week); - - insert(serializer, self.week_number); - - insert(serializer, self.sbas_system); - - insert(serializer, self.sbas_id); - - insert(serializer, self.count); - - insert(serializer, self.sbas_status); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, SbasInfo& self) -{ - extract(serializer, self.time_of_week); - - extract(serializer, self.week_number); - - extract(serializer, self.sbas_system); - - extract(serializer, self.sbas_id); - - extract(serializer, self.count); - - extract(serializer, self.sbas_status); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const SbasCorrection& self) -{ - insert(serializer, self.index); - - insert(serializer, self.count); - - insert(serializer, self.time_of_week); - - insert(serializer, self.week_number); - - insert(serializer, self.gnss_id); - - insert(serializer, self.sv_id); - - insert(serializer, self.udrei); - - insert(serializer, self.pseudorange_correction); - - insert(serializer, self.iono_correction); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, SbasCorrection& self) -{ - extract(serializer, self.index); - - extract(serializer, self.count); - - extract(serializer, self.time_of_week); - - extract(serializer, self.week_number); - - extract(serializer, self.gnss_id); - - extract(serializer, self.sv_id); - - extract(serializer, self.udrei); - - extract(serializer, self.pseudorange_correction); - - extract(serializer, self.iono_correction); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const RfErrorDetection& self) -{ - insert(serializer, self.rf_band); - - insert(serializer, self.jamming_state); - - insert(serializer, self.spoofing_state); - - for(unsigned int i=0; i < 4; i++) - insert(serializer, self.reserved[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, RfErrorDetection& self) -{ - extract(serializer, self.rf_band); - - extract(serializer, self.jamming_state); - - extract(serializer, self.spoofing_state); - - for(unsigned int i=0; i < 4; i++) - extract(serializer, self.reserved[i]); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const BaseStationInfo& self) -{ - insert(serializer, self.time_of_week); - - insert(serializer, self.week_number); - - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.ecef_pos[i]); - - insert(serializer, self.height); - - insert(serializer, self.station_id); - - insert(serializer, self.indicators); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, BaseStationInfo& self) -{ - extract(serializer, self.time_of_week); - - extract(serializer, self.week_number); - - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.ecef_pos[i]); - - extract(serializer, self.height); - - extract(serializer, self.station_id); - - extract(serializer, self.indicators); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const RtkCorrectionsStatus& self) -{ - insert(serializer, self.time_of_week); - - insert(serializer, self.week_number); - - insert(serializer, self.epoch_status); - - insert(serializer, self.dongle_status); - - insert(serializer, self.gps_correction_latency); - - insert(serializer, self.glonass_correction_latency); - - insert(serializer, self.galileo_correction_latency); - - insert(serializer, self.beidou_correction_latency); - - for(unsigned int i=0; i < 4; i++) - insert(serializer, self.reserved[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, RtkCorrectionsStatus& self) -{ - extract(serializer, self.time_of_week); - - extract(serializer, self.week_number); - - extract(serializer, self.epoch_status); - - extract(serializer, self.dongle_status); - - extract(serializer, self.gps_correction_latency); - - extract(serializer, self.glonass_correction_latency); - - extract(serializer, self.galileo_correction_latency); - - extract(serializer, self.beidou_correction_latency); - - for(unsigned int i=0; i < 4; i++) - extract(serializer, self.reserved[i]); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const SatelliteStatus& self) -{ - insert(serializer, self.index); - - insert(serializer, self.count); - - insert(serializer, self.time_of_week); - - insert(serializer, self.week_number); - - insert(serializer, self.gnss_id); - - insert(serializer, self.satellite_id); - - insert(serializer, self.elevation); - - insert(serializer, self.azimuth); - - insert(serializer, self.health); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, SatelliteStatus& self) -{ - extract(serializer, self.index); - - extract(serializer, self.count); - - extract(serializer, self.time_of_week); - - extract(serializer, self.week_number); - - extract(serializer, self.gnss_id); - - extract(serializer, self.satellite_id); - - extract(serializer, self.elevation); - - extract(serializer, self.azimuth); - - extract(serializer, self.health); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const Raw& self) -{ - insert(serializer, self.index); - - insert(serializer, self.count); - - insert(serializer, self.time_of_week); - - insert(serializer, self.week_number); - - insert(serializer, self.receiver_id); - - insert(serializer, self.tracking_channel); - - insert(serializer, self.gnss_id); - - insert(serializer, self.satellite_id); - - insert(serializer, self.signal_id); - - insert(serializer, self.signal_strength); - - insert(serializer, self.quality); - - insert(serializer, self.pseudorange); - - insert(serializer, self.carrier_phase); - - insert(serializer, self.doppler); - - insert(serializer, self.range_uncert); - - insert(serializer, self.phase_uncert); - - insert(serializer, self.doppler_uncert); - - insert(serializer, self.lock_time); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, Raw& self) -{ - extract(serializer, self.index); - - extract(serializer, self.count); - - extract(serializer, self.time_of_week); - - extract(serializer, self.week_number); - - extract(serializer, self.receiver_id); - - extract(serializer, self.tracking_channel); - - extract(serializer, self.gnss_id); - - extract(serializer, self.satellite_id); - - extract(serializer, self.signal_id); - - extract(serializer, self.signal_strength); - - extract(serializer, self.quality); - - extract(serializer, self.pseudorange); - - extract(serializer, self.carrier_phase); - - extract(serializer, self.doppler); - - extract(serializer, self.range_uncert); - - extract(serializer, self.phase_uncert); - - extract(serializer, self.doppler_uncert); - - extract(serializer, self.lock_time); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const GpsEphemeris& self) -{ - insert(serializer, self.index); - - insert(serializer, self.count); - - insert(serializer, self.time_of_week); - - insert(serializer, self.week_number); - - insert(serializer, self.satellite_id); - - insert(serializer, self.health); - - insert(serializer, self.iodc); - - insert(serializer, self.iode); - - insert(serializer, self.t_oc); - - insert(serializer, self.af0); - - insert(serializer, self.af1); - - insert(serializer, self.af2); - - insert(serializer, self.t_gd); - - insert(serializer, self.ISC_L1CA); - - insert(serializer, self.ISC_L2C); - - insert(serializer, self.t_oe); - - insert(serializer, self.a); - - insert(serializer, self.a_dot); - - insert(serializer, self.mean_anomaly); - - insert(serializer, self.delta_mean_motion); - - insert(serializer, self.delta_mean_motion_dot); - - insert(serializer, self.eccentricity); - - insert(serializer, self.argument_of_perigee); - - insert(serializer, self.omega); - - insert(serializer, self.omega_dot); - - insert(serializer, self.inclination); - - insert(serializer, self.inclination_dot); - - insert(serializer, self.c_ic); - - insert(serializer, self.c_is); - - insert(serializer, self.c_uc); - - insert(serializer, self.c_us); - - insert(serializer, self.c_rc); - - insert(serializer, self.c_rs); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, GpsEphemeris& self) -{ - extract(serializer, self.index); - - extract(serializer, self.count); - - extract(serializer, self.time_of_week); - - extract(serializer, self.week_number); - - extract(serializer, self.satellite_id); - - extract(serializer, self.health); - - extract(serializer, self.iodc); - - extract(serializer, self.iode); - - extract(serializer, self.t_oc); - - extract(serializer, self.af0); - - extract(serializer, self.af1); - - extract(serializer, self.af2); - - extract(serializer, self.t_gd); - - extract(serializer, self.ISC_L1CA); - - extract(serializer, self.ISC_L2C); - - extract(serializer, self.t_oe); - - extract(serializer, self.a); - - extract(serializer, self.a_dot); - - extract(serializer, self.mean_anomaly); - - extract(serializer, self.delta_mean_motion); - - extract(serializer, self.delta_mean_motion_dot); - - extract(serializer, self.eccentricity); - - extract(serializer, self.argument_of_perigee); - - extract(serializer, self.omega); - - extract(serializer, self.omega_dot); - - extract(serializer, self.inclination); - - extract(serializer, self.inclination_dot); - - extract(serializer, self.c_ic); - - extract(serializer, self.c_is); - - extract(serializer, self.c_uc); - - extract(serializer, self.c_us); - - extract(serializer, self.c_rc); - - extract(serializer, self.c_rs); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const GalileoEphemeris& self) -{ - insert(serializer, self.index); - - insert(serializer, self.count); - - insert(serializer, self.time_of_week); - - insert(serializer, self.week_number); - - insert(serializer, self.satellite_id); - - insert(serializer, self.health); - - insert(serializer, self.iodc); - - insert(serializer, self.iode); - - insert(serializer, self.t_oc); - - insert(serializer, self.af0); - - insert(serializer, self.af1); - - insert(serializer, self.af2); - - insert(serializer, self.t_gd); - - insert(serializer, self.ISC_L1CA); - - insert(serializer, self.ISC_L2C); - - insert(serializer, self.t_oe); - - insert(serializer, self.a); - - insert(serializer, self.a_dot); - - insert(serializer, self.mean_anomaly); - - insert(serializer, self.delta_mean_motion); - - insert(serializer, self.delta_mean_motion_dot); - - insert(serializer, self.eccentricity); - - insert(serializer, self.argument_of_perigee); - - insert(serializer, self.omega); - - insert(serializer, self.omega_dot); - - insert(serializer, self.inclination); - - insert(serializer, self.inclination_dot); - - insert(serializer, self.c_ic); - - insert(serializer, self.c_is); - - insert(serializer, self.c_uc); - - insert(serializer, self.c_us); - - insert(serializer, self.c_rc); - - insert(serializer, self.c_rs); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, GalileoEphemeris& self) -{ - extract(serializer, self.index); - - extract(serializer, self.count); - - extract(serializer, self.time_of_week); - - extract(serializer, self.week_number); - - extract(serializer, self.satellite_id); - - extract(serializer, self.health); - - extract(serializer, self.iodc); - - extract(serializer, self.iode); - - extract(serializer, self.t_oc); - - extract(serializer, self.af0); - - extract(serializer, self.af1); - - extract(serializer, self.af2); - - extract(serializer, self.t_gd); - - extract(serializer, self.ISC_L1CA); - - extract(serializer, self.ISC_L2C); - - extract(serializer, self.t_oe); - - extract(serializer, self.a); - - extract(serializer, self.a_dot); - - extract(serializer, self.mean_anomaly); - - extract(serializer, self.delta_mean_motion); - - extract(serializer, self.delta_mean_motion_dot); - - extract(serializer, self.eccentricity); - - extract(serializer, self.argument_of_perigee); - - extract(serializer, self.omega); - - extract(serializer, self.omega_dot); - - extract(serializer, self.inclination); - - extract(serializer, self.inclination_dot); - - extract(serializer, self.c_ic); - - extract(serializer, self.c_is); - - extract(serializer, self.c_uc); - - extract(serializer, self.c_us); - - extract(serializer, self.c_rc); - - extract(serializer, self.c_rs); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const GloEphemeris& self) -{ - insert(serializer, self.index); - - insert(serializer, self.count); - - insert(serializer, self.time_of_week); - - insert(serializer, self.week_number); - - insert(serializer, self.satellite_id); - - insert(serializer, self.freq_number); - - insert(serializer, self.tk); - - insert(serializer, self.tb); - - insert(serializer, self.sat_type); - - insert(serializer, self.gamma); - - insert(serializer, self.tau_n); - - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.x[i]); - - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.v[i]); - - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.a[i]); - - insert(serializer, self.health); - - insert(serializer, self.P); - - insert(serializer, self.NT); - - insert(serializer, self.delta_tau_n); - - insert(serializer, self.Ft); - - insert(serializer, self.En); - - insert(serializer, self.P1); - - insert(serializer, self.P2); - - insert(serializer, self.P3); - - insert(serializer, self.P4); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, GloEphemeris& self) -{ - extract(serializer, self.index); - - extract(serializer, self.count); - - extract(serializer, self.time_of_week); - - extract(serializer, self.week_number); - - extract(serializer, self.satellite_id); - - extract(serializer, self.freq_number); - - extract(serializer, self.tk); - - extract(serializer, self.tb); - - extract(serializer, self.sat_type); - - extract(serializer, self.gamma); - - extract(serializer, self.tau_n); - - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.x[i]); - - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.v[i]); - - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.a[i]); - - extract(serializer, self.health); - - extract(serializer, self.P); - - extract(serializer, self.NT); - - extract(serializer, self.delta_tau_n); - - extract(serializer, self.Ft); - - extract(serializer, self.En); - - extract(serializer, self.P1); - - extract(serializer, self.P2); - - extract(serializer, self.P3); - - extract(serializer, self.P4); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const GpsIonoCorr& self) -{ - insert(serializer, self.time_of_week); - - insert(serializer, self.week_number); - - for(unsigned int i=0; i < 4; i++) - insert(serializer, self.alpha[i]); - - for(unsigned int i=0; i < 4; i++) - insert(serializer, self.beta[i]); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, GpsIonoCorr& self) -{ - extract(serializer, self.time_of_week); - - extract(serializer, self.week_number); - - for(unsigned int i=0; i < 4; i++) - extract(serializer, self.alpha[i]); - - for(unsigned int i=0; i < 4; i++) - extract(serializer, self.beta[i]); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const GalileoIonoCorr& self) -{ - insert(serializer, self.time_of_week); - - insert(serializer, self.week_number); - - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.alpha[i]); - - insert(serializer, self.disturbance_flags); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, GalileoIonoCorr& self) -{ - extract(serializer, self.time_of_week); - - extract(serializer, self.week_number); - - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.alpha[i]); - - extract(serializer, self.disturbance_flags); - - extract(serializer, self.valid_flags); - -} - - -} // namespace data_gnss -} // namespace mip - diff --git a/src/mip/definitions/data_sensor.c b/src/mip/definitions/data_sensor.c deleted file mode 100644 index 03c7de2c8..000000000 --- a/src/mip/definitions/data_sensor.c +++ /dev/null @@ -1,582 +0,0 @@ - -#include "data_sensor.h" - -#include "../utils/serialization.h" -#include "../mip_interface.h" - -#include - - -#ifdef __cplusplus -namespace mip { -namespace C { -extern "C" { - -#endif // __cplusplus -struct mip_interface; -struct mip_serializer; -struct mip_field; - - -//////////////////////////////////////////////////////////////////////////////// -// Shared Type Definitions -//////////////////////////////////////////////////////////////////////////////// - - -//////////////////////////////////////////////////////////////////////////////// -// Mip Fields -//////////////////////////////////////////////////////////////////////////////// - -void insert_mip_sensor_raw_accel_data(mip_serializer* serializer, const mip_sensor_raw_accel_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->raw_accel[i]); - -} -void extract_mip_sensor_raw_accel_data(mip_serializer* serializer, mip_sensor_raw_accel_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->raw_accel[i]); - -} -bool extract_mip_sensor_raw_accel_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_sensor_raw_accel_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_sensor_raw_accel_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_sensor_raw_gyro_data(mip_serializer* serializer, const mip_sensor_raw_gyro_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->raw_gyro[i]); - -} -void extract_mip_sensor_raw_gyro_data(mip_serializer* serializer, mip_sensor_raw_gyro_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->raw_gyro[i]); - -} -bool extract_mip_sensor_raw_gyro_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_sensor_raw_gyro_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_sensor_raw_gyro_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_sensor_raw_mag_data(mip_serializer* serializer, const mip_sensor_raw_mag_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->raw_mag[i]); - -} -void extract_mip_sensor_raw_mag_data(mip_serializer* serializer, mip_sensor_raw_mag_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->raw_mag[i]); - -} -bool extract_mip_sensor_raw_mag_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_sensor_raw_mag_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_sensor_raw_mag_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_sensor_raw_pressure_data(mip_serializer* serializer, const mip_sensor_raw_pressure_data* self) -{ - insert_float(serializer, self->raw_pressure); - -} -void extract_mip_sensor_raw_pressure_data(mip_serializer* serializer, mip_sensor_raw_pressure_data* self) -{ - extract_float(serializer, &self->raw_pressure); - -} -bool extract_mip_sensor_raw_pressure_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_sensor_raw_pressure_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_sensor_raw_pressure_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_sensor_scaled_accel_data(mip_serializer* serializer, const mip_sensor_scaled_accel_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->scaled_accel[i]); - -} -void extract_mip_sensor_scaled_accel_data(mip_serializer* serializer, mip_sensor_scaled_accel_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->scaled_accel[i]); - -} -bool extract_mip_sensor_scaled_accel_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_sensor_scaled_accel_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_sensor_scaled_accel_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_sensor_scaled_gyro_data(mip_serializer* serializer, const mip_sensor_scaled_gyro_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->scaled_gyro[i]); - -} -void extract_mip_sensor_scaled_gyro_data(mip_serializer* serializer, mip_sensor_scaled_gyro_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->scaled_gyro[i]); - -} -bool extract_mip_sensor_scaled_gyro_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_sensor_scaled_gyro_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_sensor_scaled_gyro_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_sensor_scaled_mag_data(mip_serializer* serializer, const mip_sensor_scaled_mag_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->scaled_mag[i]); - -} -void extract_mip_sensor_scaled_mag_data(mip_serializer* serializer, mip_sensor_scaled_mag_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->scaled_mag[i]); - -} -bool extract_mip_sensor_scaled_mag_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_sensor_scaled_mag_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_sensor_scaled_mag_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_sensor_scaled_pressure_data(mip_serializer* serializer, const mip_sensor_scaled_pressure_data* self) -{ - insert_float(serializer, self->scaled_pressure); - -} -void extract_mip_sensor_scaled_pressure_data(mip_serializer* serializer, mip_sensor_scaled_pressure_data* self) -{ - extract_float(serializer, &self->scaled_pressure); - -} -bool extract_mip_sensor_scaled_pressure_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_sensor_scaled_pressure_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_sensor_scaled_pressure_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_sensor_delta_theta_data(mip_serializer* serializer, const mip_sensor_delta_theta_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->delta_theta[i]); - -} -void extract_mip_sensor_delta_theta_data(mip_serializer* serializer, mip_sensor_delta_theta_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->delta_theta[i]); - -} -bool extract_mip_sensor_delta_theta_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_sensor_delta_theta_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_sensor_delta_theta_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_sensor_delta_velocity_data(mip_serializer* serializer, const mip_sensor_delta_velocity_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->delta_velocity[i]); - -} -void extract_mip_sensor_delta_velocity_data(mip_serializer* serializer, mip_sensor_delta_velocity_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->delta_velocity[i]); - -} -bool extract_mip_sensor_delta_velocity_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_sensor_delta_velocity_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_sensor_delta_velocity_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_sensor_comp_orientation_matrix_data(mip_serializer* serializer, const mip_sensor_comp_orientation_matrix_data* self) -{ - for(unsigned int i=0; i < 9; i++) - insert_float(serializer, self->m[i]); - -} -void extract_mip_sensor_comp_orientation_matrix_data(mip_serializer* serializer, mip_sensor_comp_orientation_matrix_data* self) -{ - for(unsigned int i=0; i < 9; i++) - extract_float(serializer, &self->m[i]); - -} -bool extract_mip_sensor_comp_orientation_matrix_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_sensor_comp_orientation_matrix_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_sensor_comp_orientation_matrix_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_sensor_comp_quaternion_data(mip_serializer* serializer, const mip_sensor_comp_quaternion_data* self) -{ - for(unsigned int i=0; i < 4; i++) - insert_float(serializer, self->q[i]); - -} -void extract_mip_sensor_comp_quaternion_data(mip_serializer* serializer, mip_sensor_comp_quaternion_data* self) -{ - for(unsigned int i=0; i < 4; i++) - extract_float(serializer, &self->q[i]); - -} -bool extract_mip_sensor_comp_quaternion_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_sensor_comp_quaternion_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_sensor_comp_quaternion_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_sensor_comp_euler_angles_data(mip_serializer* serializer, const mip_sensor_comp_euler_angles_data* self) -{ - insert_float(serializer, self->roll); - - insert_float(serializer, self->pitch); - - insert_float(serializer, self->yaw); - -} -void extract_mip_sensor_comp_euler_angles_data(mip_serializer* serializer, mip_sensor_comp_euler_angles_data* self) -{ - extract_float(serializer, &self->roll); - - extract_float(serializer, &self->pitch); - - extract_float(serializer, &self->yaw); - -} -bool extract_mip_sensor_comp_euler_angles_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_sensor_comp_euler_angles_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_sensor_comp_euler_angles_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_sensor_comp_orientation_update_matrix_data(mip_serializer* serializer, const mip_sensor_comp_orientation_update_matrix_data* self) -{ - for(unsigned int i=0; i < 9; i++) - insert_float(serializer, self->m[i]); - -} -void extract_mip_sensor_comp_orientation_update_matrix_data(mip_serializer* serializer, mip_sensor_comp_orientation_update_matrix_data* self) -{ - for(unsigned int i=0; i < 9; i++) - extract_float(serializer, &self->m[i]); - -} -bool extract_mip_sensor_comp_orientation_update_matrix_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_sensor_comp_orientation_update_matrix_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_sensor_comp_orientation_update_matrix_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_sensor_orientation_raw_temp_data(mip_serializer* serializer, const mip_sensor_orientation_raw_temp_data* self) -{ - for(unsigned int i=0; i < 4; i++) - insert_u16(serializer, self->raw_temp[i]); - -} -void extract_mip_sensor_orientation_raw_temp_data(mip_serializer* serializer, mip_sensor_orientation_raw_temp_data* self) -{ - for(unsigned int i=0; i < 4; i++) - extract_u16(serializer, &self->raw_temp[i]); - -} -bool extract_mip_sensor_orientation_raw_temp_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_sensor_orientation_raw_temp_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_sensor_orientation_raw_temp_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_sensor_internal_timestamp_data(mip_serializer* serializer, const mip_sensor_internal_timestamp_data* self) -{ - insert_u32(serializer, self->counts); - -} -void extract_mip_sensor_internal_timestamp_data(mip_serializer* serializer, mip_sensor_internal_timestamp_data* self) -{ - extract_u32(serializer, &self->counts); - -} -bool extract_mip_sensor_internal_timestamp_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_sensor_internal_timestamp_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_sensor_internal_timestamp_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_sensor_pps_timestamp_data(mip_serializer* serializer, const mip_sensor_pps_timestamp_data* self) -{ - insert_u32(serializer, self->seconds); - - insert_u32(serializer, self->useconds); - -} -void extract_mip_sensor_pps_timestamp_data(mip_serializer* serializer, mip_sensor_pps_timestamp_data* self) -{ - extract_u32(serializer, &self->seconds); - - extract_u32(serializer, &self->useconds); - -} -bool extract_mip_sensor_pps_timestamp_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_sensor_pps_timestamp_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_sensor_pps_timestamp_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_sensor_gps_timestamp_data(mip_serializer* serializer, const mip_sensor_gps_timestamp_data* self) -{ - insert_double(serializer, self->tow); - - insert_u16(serializer, self->week_number); - - insert_mip_sensor_gps_timestamp_data_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_sensor_gps_timestamp_data(mip_serializer* serializer, mip_sensor_gps_timestamp_data* self) -{ - extract_double(serializer, &self->tow); - - extract_u16(serializer, &self->week_number); - - extract_mip_sensor_gps_timestamp_data_valid_flags(serializer, &self->valid_flags); - -} -bool extract_mip_sensor_gps_timestamp_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_sensor_gps_timestamp_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_sensor_gps_timestamp_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_sensor_gps_timestamp_data_valid_flags(struct mip_serializer* serializer, const mip_sensor_gps_timestamp_data_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_sensor_gps_timestamp_data_valid_flags(struct mip_serializer* serializer, mip_sensor_gps_timestamp_data_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_sensor_temperature_abs_data(mip_serializer* serializer, const mip_sensor_temperature_abs_data* self) -{ - insert_float(serializer, self->min_temp); - - insert_float(serializer, self->max_temp); - - insert_float(serializer, self->mean_temp); - -} -void extract_mip_sensor_temperature_abs_data(mip_serializer* serializer, mip_sensor_temperature_abs_data* self) -{ - extract_float(serializer, &self->min_temp); - - extract_float(serializer, &self->max_temp); - - extract_float(serializer, &self->mean_temp); - -} -bool extract_mip_sensor_temperature_abs_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_sensor_temperature_abs_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_sensor_temperature_abs_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_sensor_up_vector_data(mip_serializer* serializer, const mip_sensor_up_vector_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->up[i]); - -} -void extract_mip_sensor_up_vector_data(mip_serializer* serializer, mip_sensor_up_vector_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->up[i]); - -} -bool extract_mip_sensor_up_vector_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_sensor_up_vector_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_sensor_up_vector_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_sensor_north_vector_data(mip_serializer* serializer, const mip_sensor_north_vector_data* self) -{ - for(unsigned int i=0; i < 3; i++) - insert_float(serializer, self->north[i]); - -} -void extract_mip_sensor_north_vector_data(mip_serializer* serializer, mip_sensor_north_vector_data* self) -{ - for(unsigned int i=0; i < 3; i++) - extract_float(serializer, &self->north[i]); - -} -bool extract_mip_sensor_north_vector_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_sensor_north_vector_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_sensor_north_vector_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_sensor_overrange_status_data(mip_serializer* serializer, const mip_sensor_overrange_status_data* self) -{ - insert_mip_sensor_overrange_status_data_status(serializer, self->status); - -} -void extract_mip_sensor_overrange_status_data(mip_serializer* serializer, mip_sensor_overrange_status_data* self) -{ - extract_mip_sensor_overrange_status_data_status(serializer, &self->status); - -} -bool extract_mip_sensor_overrange_status_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_sensor_overrange_status_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_sensor_overrange_status_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_sensor_overrange_status_data_status(struct mip_serializer* serializer, const mip_sensor_overrange_status_data_status self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_sensor_overrange_status_data_status(struct mip_serializer* serializer, mip_sensor_overrange_status_data_status* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_sensor_odometer_data_data(mip_serializer* serializer, const mip_sensor_odometer_data_data* self) -{ - insert_float(serializer, self->speed); - - insert_float(serializer, self->uncertainty); - - insert_u16(serializer, self->valid_flags); - -} -void extract_mip_sensor_odometer_data_data(mip_serializer* serializer, mip_sensor_odometer_data_data* self) -{ - extract_float(serializer, &self->speed); - - extract_float(serializer, &self->uncertainty); - - extract_u16(serializer, &self->valid_flags); - -} -bool extract_mip_sensor_odometer_data_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_sensor_odometer_data_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_sensor_odometer_data_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - - -#ifdef __cplusplus -} // namespace C -} // namespace mip -} // extern "C" -#endif // __cplusplus - diff --git a/src/mip/definitions/data_sensor.cpp b/src/mip/definitions/data_sensor.cpp deleted file mode 100644 index 78af4a4e1..000000000 --- a/src/mip/definitions/data_sensor.cpp +++ /dev/null @@ -1,352 +0,0 @@ - -#include "data_sensor.hpp" - -#include "../utils/serialization.h" -#include "../mip_interface.h" - -#include - - -namespace mip { -class Serializer; - -namespace C { -struct mip_interface; -} // namespace C - -namespace data_sensor { - -using ::mip::insert; -using ::mip::extract; -using namespace ::mip::C; - -//////////////////////////////////////////////////////////////////////////////// -// Shared Type Definitions -//////////////////////////////////////////////////////////////////////////////// - - -//////////////////////////////////////////////////////////////////////////////// -// Mip Fields -//////////////////////////////////////////////////////////////////////////////// - -void insert(Serializer& serializer, const RawAccel& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.raw_accel[i]); - -} -void extract(Serializer& serializer, RawAccel& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.raw_accel[i]); - -} - -void insert(Serializer& serializer, const RawGyro& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.raw_gyro[i]); - -} -void extract(Serializer& serializer, RawGyro& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.raw_gyro[i]); - -} - -void insert(Serializer& serializer, const RawMag& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.raw_mag[i]); - -} -void extract(Serializer& serializer, RawMag& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.raw_mag[i]); - -} - -void insert(Serializer& serializer, const RawPressure& self) -{ - insert(serializer, self.raw_pressure); - -} -void extract(Serializer& serializer, RawPressure& self) -{ - extract(serializer, self.raw_pressure); - -} - -void insert(Serializer& serializer, const ScaledAccel& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.scaled_accel[i]); - -} -void extract(Serializer& serializer, ScaledAccel& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.scaled_accel[i]); - -} - -void insert(Serializer& serializer, const ScaledGyro& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.scaled_gyro[i]); - -} -void extract(Serializer& serializer, ScaledGyro& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.scaled_gyro[i]); - -} - -void insert(Serializer& serializer, const ScaledMag& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.scaled_mag[i]); - -} -void extract(Serializer& serializer, ScaledMag& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.scaled_mag[i]); - -} - -void insert(Serializer& serializer, const ScaledPressure& self) -{ - insert(serializer, self.scaled_pressure); - -} -void extract(Serializer& serializer, ScaledPressure& self) -{ - extract(serializer, self.scaled_pressure); - -} - -void insert(Serializer& serializer, const DeltaTheta& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.delta_theta[i]); - -} -void extract(Serializer& serializer, DeltaTheta& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.delta_theta[i]); - -} - -void insert(Serializer& serializer, const DeltaVelocity& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.delta_velocity[i]); - -} -void extract(Serializer& serializer, DeltaVelocity& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.delta_velocity[i]); - -} - -void insert(Serializer& serializer, const CompOrientationMatrix& self) -{ - for(unsigned int i=0; i < 9; i++) - insert(serializer, self.m[i]); - -} -void extract(Serializer& serializer, CompOrientationMatrix& self) -{ - for(unsigned int i=0; i < 9; i++) - extract(serializer, self.m[i]); - -} - -void insert(Serializer& serializer, const CompQuaternion& self) -{ - for(unsigned int i=0; i < 4; i++) - insert(serializer, self.q[i]); - -} -void extract(Serializer& serializer, CompQuaternion& self) -{ - for(unsigned int i=0; i < 4; i++) - extract(serializer, self.q[i]); - -} - -void insert(Serializer& serializer, const CompEulerAngles& self) -{ - insert(serializer, self.roll); - - insert(serializer, self.pitch); - - insert(serializer, self.yaw); - -} -void extract(Serializer& serializer, CompEulerAngles& self) -{ - extract(serializer, self.roll); - - extract(serializer, self.pitch); - - extract(serializer, self.yaw); - -} - -void insert(Serializer& serializer, const CompOrientationUpdateMatrix& self) -{ - for(unsigned int i=0; i < 9; i++) - insert(serializer, self.m[i]); - -} -void extract(Serializer& serializer, CompOrientationUpdateMatrix& self) -{ - for(unsigned int i=0; i < 9; i++) - extract(serializer, self.m[i]); - -} - -void insert(Serializer& serializer, const OrientationRawTemp& self) -{ - for(unsigned int i=0; i < 4; i++) - insert(serializer, self.raw_temp[i]); - -} -void extract(Serializer& serializer, OrientationRawTemp& self) -{ - for(unsigned int i=0; i < 4; i++) - extract(serializer, self.raw_temp[i]); - -} - -void insert(Serializer& serializer, const InternalTimestamp& self) -{ - insert(serializer, self.counts); - -} -void extract(Serializer& serializer, InternalTimestamp& self) -{ - extract(serializer, self.counts); - -} - -void insert(Serializer& serializer, const PpsTimestamp& self) -{ - insert(serializer, self.seconds); - - insert(serializer, self.useconds); - -} -void extract(Serializer& serializer, PpsTimestamp& self) -{ - extract(serializer, self.seconds); - - extract(serializer, self.useconds); - -} - -void insert(Serializer& serializer, const GpsTimestamp& self) -{ - insert(serializer, self.tow); - - insert(serializer, self.week_number); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, GpsTimestamp& self) -{ - extract(serializer, self.tow); - - extract(serializer, self.week_number); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const TemperatureAbs& self) -{ - insert(serializer, self.min_temp); - - insert(serializer, self.max_temp); - - insert(serializer, self.mean_temp); - -} -void extract(Serializer& serializer, TemperatureAbs& self) -{ - extract(serializer, self.min_temp); - - extract(serializer, self.max_temp); - - extract(serializer, self.mean_temp); - -} - -void insert(Serializer& serializer, const UpVector& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.up[i]); - -} -void extract(Serializer& serializer, UpVector& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.up[i]); - -} - -void insert(Serializer& serializer, const NorthVector& self) -{ - for(unsigned int i=0; i < 3; i++) - insert(serializer, self.north[i]); - -} -void extract(Serializer& serializer, NorthVector& self) -{ - for(unsigned int i=0; i < 3; i++) - extract(serializer, self.north[i]); - -} - -void insert(Serializer& serializer, const OverrangeStatus& self) -{ - insert(serializer, self.status); - -} -void extract(Serializer& serializer, OverrangeStatus& self) -{ - extract(serializer, self.status); - -} - -void insert(Serializer& serializer, const OdometerData& self) -{ - insert(serializer, self.speed); - - insert(serializer, self.uncertainty); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, OdometerData& self) -{ - extract(serializer, self.speed); - - extract(serializer, self.uncertainty); - - extract(serializer, self.valid_flags); - -} - - -} // namespace data_sensor -} // namespace mip - diff --git a/src/mip/definitions/data_shared.c b/src/mip/definitions/data_shared.c deleted file mode 100644 index 268c34a78..000000000 --- a/src/mip/definitions/data_shared.c +++ /dev/null @@ -1,265 +0,0 @@ - -#include "data_shared.h" - -#include "../utils/serialization.h" -#include "../mip_interface.h" - -#include - - -#ifdef __cplusplus -namespace mip { -namespace C { -extern "C" { - -#endif // __cplusplus -struct mip_interface; -struct mip_serializer; -struct mip_field; - - -//////////////////////////////////////////////////////////////////////////////// -// Shared Type Definitions -//////////////////////////////////////////////////////////////////////////////// - - -//////////////////////////////////////////////////////////////////////////////// -// Mip Fields -//////////////////////////////////////////////////////////////////////////////// - -void insert_mip_shared_event_source_data(mip_serializer* serializer, const mip_shared_event_source_data* self) -{ - insert_u8(serializer, self->trigger_id); - -} -void extract_mip_shared_event_source_data(mip_serializer* serializer, mip_shared_event_source_data* self) -{ - extract_u8(serializer, &self->trigger_id); - -} -bool extract_mip_shared_event_source_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_shared_event_source_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_shared_event_source_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_shared_ticks_data(mip_serializer* serializer, const mip_shared_ticks_data* self) -{ - insert_u32(serializer, self->ticks); - -} -void extract_mip_shared_ticks_data(mip_serializer* serializer, mip_shared_ticks_data* self) -{ - extract_u32(serializer, &self->ticks); - -} -bool extract_mip_shared_ticks_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_shared_ticks_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_shared_ticks_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_shared_delta_ticks_data(mip_serializer* serializer, const mip_shared_delta_ticks_data* self) -{ - insert_u32(serializer, self->ticks); - -} -void extract_mip_shared_delta_ticks_data(mip_serializer* serializer, mip_shared_delta_ticks_data* self) -{ - extract_u32(serializer, &self->ticks); - -} -bool extract_mip_shared_delta_ticks_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_shared_delta_ticks_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_shared_delta_ticks_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_shared_gps_timestamp_data(mip_serializer* serializer, const mip_shared_gps_timestamp_data* self) -{ - insert_double(serializer, self->tow); - - insert_u16(serializer, self->week_number); - - insert_mip_shared_gps_timestamp_data_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_shared_gps_timestamp_data(mip_serializer* serializer, mip_shared_gps_timestamp_data* self) -{ - extract_double(serializer, &self->tow); - - extract_u16(serializer, &self->week_number); - - extract_mip_shared_gps_timestamp_data_valid_flags(serializer, &self->valid_flags); - -} -bool extract_mip_shared_gps_timestamp_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_shared_gps_timestamp_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_shared_gps_timestamp_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_shared_gps_timestamp_data_valid_flags(struct mip_serializer* serializer, const mip_shared_gps_timestamp_data_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_shared_gps_timestamp_data_valid_flags(struct mip_serializer* serializer, mip_shared_gps_timestamp_data_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_shared_delta_time_data(mip_serializer* serializer, const mip_shared_delta_time_data* self) -{ - insert_double(serializer, self->seconds); - -} -void extract_mip_shared_delta_time_data(mip_serializer* serializer, mip_shared_delta_time_data* self) -{ - extract_double(serializer, &self->seconds); - -} -bool extract_mip_shared_delta_time_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_shared_delta_time_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_shared_delta_time_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_shared_reference_timestamp_data(mip_serializer* serializer, const mip_shared_reference_timestamp_data* self) -{ - insert_u64(serializer, self->nanoseconds); - -} -void extract_mip_shared_reference_timestamp_data(mip_serializer* serializer, mip_shared_reference_timestamp_data* self) -{ - extract_u64(serializer, &self->nanoseconds); - -} -bool extract_mip_shared_reference_timestamp_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_shared_reference_timestamp_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_shared_reference_timestamp_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_shared_reference_time_delta_data(mip_serializer* serializer, const mip_shared_reference_time_delta_data* self) -{ - insert_u64(serializer, self->dt_nanos); - -} -void extract_mip_shared_reference_time_delta_data(mip_serializer* serializer, mip_shared_reference_time_delta_data* self) -{ - extract_u64(serializer, &self->dt_nanos); - -} -bool extract_mip_shared_reference_time_delta_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_shared_reference_time_delta_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_shared_reference_time_delta_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_shared_external_timestamp_data(mip_serializer* serializer, const mip_shared_external_timestamp_data* self) -{ - insert_u64(serializer, self->nanoseconds); - - insert_mip_shared_external_timestamp_data_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_shared_external_timestamp_data(mip_serializer* serializer, mip_shared_external_timestamp_data* self) -{ - extract_u64(serializer, &self->nanoseconds); - - extract_mip_shared_external_timestamp_data_valid_flags(serializer, &self->valid_flags); - -} -bool extract_mip_shared_external_timestamp_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_shared_external_timestamp_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_shared_external_timestamp_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_shared_external_timestamp_data_valid_flags(struct mip_serializer* serializer, const mip_shared_external_timestamp_data_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_shared_external_timestamp_data_valid_flags(struct mip_serializer* serializer, mip_shared_external_timestamp_data_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - -void insert_mip_shared_external_time_delta_data(mip_serializer* serializer, const mip_shared_external_time_delta_data* self) -{ - insert_u64(serializer, self->dt_nanos); - - insert_mip_shared_external_time_delta_data_valid_flags(serializer, self->valid_flags); - -} -void extract_mip_shared_external_time_delta_data(mip_serializer* serializer, mip_shared_external_time_delta_data* self) -{ - extract_u64(serializer, &self->dt_nanos); - - extract_mip_shared_external_time_delta_data_valid_flags(serializer, &self->valid_flags); - -} -bool extract_mip_shared_external_time_delta_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_shared_external_time_delta_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_shared_external_time_delta_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_shared_external_time_delta_data_valid_flags(struct mip_serializer* serializer, const mip_shared_external_time_delta_data_valid_flags self) -{ - insert_u16(serializer, (uint16_t)(self)); -} -void extract_mip_shared_external_time_delta_data_valid_flags(struct mip_serializer* serializer, mip_shared_external_time_delta_data_valid_flags* self) -{ - uint16_t tmp = 0; - extract_u16(serializer, &tmp); - *self = tmp; -} - - -#ifdef __cplusplus -} // namespace C -} // namespace mip -} // extern "C" -#endif // __cplusplus - diff --git a/src/mip/definitions/data_shared.cpp b/src/mip/definitions/data_shared.cpp deleted file mode 100644 index 248e8f0a5..000000000 --- a/src/mip/definitions/data_shared.cpp +++ /dev/null @@ -1,150 +0,0 @@ - -#include "data_shared.hpp" - -#include "../utils/serialization.h" -#include "../mip_interface.h" - -#include - - -namespace mip { -class Serializer; - -namespace C { -struct mip_interface; -} // namespace C - -namespace data_shared { - -using ::mip::insert; -using ::mip::extract; -using namespace ::mip::C; - -//////////////////////////////////////////////////////////////////////////////// -// Shared Type Definitions -//////////////////////////////////////////////////////////////////////////////// - - -//////////////////////////////////////////////////////////////////////////////// -// Mip Fields -//////////////////////////////////////////////////////////////////////////////// - -void insert(Serializer& serializer, const EventSource& self) -{ - insert(serializer, self.trigger_id); - -} -void extract(Serializer& serializer, EventSource& self) -{ - extract(serializer, self.trigger_id); - -} - -void insert(Serializer& serializer, const Ticks& self) -{ - insert(serializer, self.ticks); - -} -void extract(Serializer& serializer, Ticks& self) -{ - extract(serializer, self.ticks); - -} - -void insert(Serializer& serializer, const DeltaTicks& self) -{ - insert(serializer, self.ticks); - -} -void extract(Serializer& serializer, DeltaTicks& self) -{ - extract(serializer, self.ticks); - -} - -void insert(Serializer& serializer, const GpsTimestamp& self) -{ - insert(serializer, self.tow); - - insert(serializer, self.week_number); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, GpsTimestamp& self) -{ - extract(serializer, self.tow); - - extract(serializer, self.week_number); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const DeltaTime& self) -{ - insert(serializer, self.seconds); - -} -void extract(Serializer& serializer, DeltaTime& self) -{ - extract(serializer, self.seconds); - -} - -void insert(Serializer& serializer, const ReferenceTimestamp& self) -{ - insert(serializer, self.nanoseconds); - -} -void extract(Serializer& serializer, ReferenceTimestamp& self) -{ - extract(serializer, self.nanoseconds); - -} - -void insert(Serializer& serializer, const ReferenceTimeDelta& self) -{ - insert(serializer, self.dt_nanos); - -} -void extract(Serializer& serializer, ReferenceTimeDelta& self) -{ - extract(serializer, self.dt_nanos); - -} - -void insert(Serializer& serializer, const ExternalTimestamp& self) -{ - insert(serializer, self.nanoseconds); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, ExternalTimestamp& self) -{ - extract(serializer, self.nanoseconds); - - extract(serializer, self.valid_flags); - -} - -void insert(Serializer& serializer, const ExternalTimeDelta& self) -{ - insert(serializer, self.dt_nanos); - - insert(serializer, self.valid_flags); - -} -void extract(Serializer& serializer, ExternalTimeDelta& self) -{ - extract(serializer, self.dt_nanos); - - extract(serializer, self.valid_flags); - -} - - -} // namespace data_shared -} // namespace mip - diff --git a/src/mip/definitions/data_system.c b/src/mip/definitions/data_system.c deleted file mode 100644 index d661dfb1c..000000000 --- a/src/mip/definitions/data_system.c +++ /dev/null @@ -1,126 +0,0 @@ - -#include "data_system.h" - -#include "../utils/serialization.h" -#include "../mip_interface.h" - -#include - - -#ifdef __cplusplus -namespace mip { -namespace C { -extern "C" { - -#endif // __cplusplus -struct mip_interface; -struct mip_serializer; -struct mip_field; - - -//////////////////////////////////////////////////////////////////////////////// -// Shared Type Definitions -//////////////////////////////////////////////////////////////////////////////// - - -//////////////////////////////////////////////////////////////////////////////// -// Mip Fields -//////////////////////////////////////////////////////////////////////////////// - -void insert_mip_system_built_in_test_data(mip_serializer* serializer, const mip_system_built_in_test_data* self) -{ - for(unsigned int i=0; i < 16; i++) - insert_u8(serializer, self->result[i]); - -} -void extract_mip_system_built_in_test_data(mip_serializer* serializer, mip_system_built_in_test_data* self) -{ - for(unsigned int i=0; i < 16; i++) - extract_u8(serializer, &self->result[i]); - -} -bool extract_mip_system_built_in_test_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_system_built_in_test_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_system_built_in_test_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_system_time_sync_status_data(mip_serializer* serializer, const mip_system_time_sync_status_data* self) -{ - insert_bool(serializer, self->time_sync); - - insert_u8(serializer, self->last_pps_rcvd); - -} -void extract_mip_system_time_sync_status_data(mip_serializer* serializer, mip_system_time_sync_status_data* self) -{ - extract_bool(serializer, &self->time_sync); - - extract_u8(serializer, &self->last_pps_rcvd); - -} -bool extract_mip_system_time_sync_status_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_system_time_sync_status_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_system_time_sync_status_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_system_gpio_state_data(mip_serializer* serializer, const mip_system_gpio_state_data* self) -{ - insert_u8(serializer, self->states); - -} -void extract_mip_system_gpio_state_data(mip_serializer* serializer, mip_system_gpio_state_data* self) -{ - extract_u8(serializer, &self->states); - -} -bool extract_mip_system_gpio_state_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_system_gpio_state_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_system_gpio_state_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - -void insert_mip_system_gpio_analog_value_data(mip_serializer* serializer, const mip_system_gpio_analog_value_data* self) -{ - insert_u8(serializer, self->gpio_id); - - insert_float(serializer, self->value); - -} -void extract_mip_system_gpio_analog_value_data(mip_serializer* serializer, mip_system_gpio_analog_value_data* self) -{ - extract_u8(serializer, &self->gpio_id); - - extract_float(serializer, &self->value); - -} -bool extract_mip_system_gpio_analog_value_data_from_field(const mip_field* field, void* ptr) -{ - assert(ptr); - mip_system_gpio_analog_value_data* self = ptr; - struct mip_serializer serializer; - mip_serializer_init_from_field(&serializer, field); - extract_mip_system_gpio_analog_value_data(&serializer, self); - return mip_serializer_is_complete(&serializer); -} - - -#ifdef __cplusplus -} // namespace C -} // namespace mip -} // extern "C" -#endif // __cplusplus - diff --git a/src/mip/definitions/data_system.cpp b/src/mip/definitions/data_system.cpp deleted file mode 100644 index ee243ac31..000000000 --- a/src/mip/definitions/data_system.cpp +++ /dev/null @@ -1,89 +0,0 @@ - -#include "data_system.hpp" - -#include "../utils/serialization.h" -#include "../mip_interface.h" - -#include - - -namespace mip { -class Serializer; - -namespace C { -struct mip_interface; -} // namespace C - -namespace data_system { - -using ::mip::insert; -using ::mip::extract; -using namespace ::mip::C; - -//////////////////////////////////////////////////////////////////////////////// -// Shared Type Definitions -//////////////////////////////////////////////////////////////////////////////// - - -//////////////////////////////////////////////////////////////////////////////// -// Mip Fields -//////////////////////////////////////////////////////////////////////////////// - -void insert(Serializer& serializer, const BuiltInTest& self) -{ - for(unsigned int i=0; i < 16; i++) - insert(serializer, self.result[i]); - -} -void extract(Serializer& serializer, BuiltInTest& self) -{ - for(unsigned int i=0; i < 16; i++) - extract(serializer, self.result[i]); - -} - -void insert(Serializer& serializer, const TimeSyncStatus& self) -{ - insert(serializer, self.time_sync); - - insert(serializer, self.last_pps_rcvd); - -} -void extract(Serializer& serializer, TimeSyncStatus& self) -{ - extract(serializer, self.time_sync); - - extract(serializer, self.last_pps_rcvd); - -} - -void insert(Serializer& serializer, const GpioState& self) -{ - insert(serializer, self.states); - -} -void extract(Serializer& serializer, GpioState& self) -{ - extract(serializer, self.states); - -} - -void insert(Serializer& serializer, const GpioAnalogValue& self) -{ - insert(serializer, self.gpio_id); - - insert(serializer, self.value); - -} -void extract(Serializer& serializer, GpioAnalogValue& self) -{ - extract(serializer, self.gpio_id); - - extract(serializer, self.value); - -} - - -} // namespace data_system -} // namespace mip - diff --git a/src/mip/extras/scope_helper.cpp b/src/mip/extras/scope_helper.cpp deleted file mode 100644 index 75c574262..000000000 --- a/src/mip/extras/scope_helper.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "scope_helper.hpp" - -namespace mip -{ - namespace extras - { - ScopeHelper::ScopeHelper(std::function scopeFunction) : - m_outOfScopeFunction(scopeFunction), - m_canceled(false) - { - } - - ScopeHelper::~ScopeHelper() - { - if (!m_canceled) - { - m_outOfScopeFunction(); - } - } - - void ScopeHelper::cancel() - { - m_canceled = true; - } - } //namespace extras -} //namespace mip \ No newline at end of file diff --git a/src/mip/extras/scope_helper.hpp b/src/mip/extras/scope_helper.hpp deleted file mode 100644 index ab2386a8d..000000000 --- a/src/mip/extras/scope_helper.hpp +++ /dev/null @@ -1,45 +0,0 @@ -#pragma once - -#include -#include - -namespace mip -{ - namespace extras - { - //Class: ScopeHelper - // Class that allows a function to be run when this object goes out of scope. - class ScopeHelper - { - private: - //Variable: m_outOfScopeFunction - // The function to run when the ScopeHelper goes out of scope. - std::function m_outOfScopeFunction; - - //Variable: m_canceled - // Whether the scope function has been canceled or not. - bool m_canceled; - - ScopeHelper(); //default constructor disabled - ScopeHelper(const ScopeHelper&); //copy constructor disabled - ScopeHelper& operator=(const ScopeHelper&); //assignment operator disabled - - public: - //Constructor: ScopeHelper - // Creates a ScopeHelper object. - // - //Parameters: - // scopeFunction - The function to run when the ScopeHelper object is destroyed. - ScopeHelper(std::function scopeFunction); - - //Destructor: ScopeHelper - // Runs whatever function was assigned in the creation of the ScopeHelper. - ~ScopeHelper(); - - //Function: cancel - // Sets a flag that indicates the originally set function should NOT be run when - // the ScopeHelper is destroyed. - void cancel(); - }; - } //namespace extras -} //namespace mip \ No newline at end of file diff --git a/src/mip/mip.hpp b/src/mip/mip.hpp deleted file mode 100644 index 637fe2168..000000000 --- a/src/mip/mip.hpp +++ /dev/null @@ -1,506 +0,0 @@ -#pragma once - -#include - -#include -#include - -#include "mip_packet.h" -#include "mip_field.h" -#include "mip_parser.h" -#include "mip_offsets.h" -#include "definitions/descriptors.h" -#include "mip_types.h" - -#include - -//////////////////////////////////////////////////////////////////////////////// -///@defgroup mip_cpp MIP C++ API -/// -///@brief This module contains functions and classes for communicating with a -/// MIP device in C++. -/// -///@see mip namespace -/// - -//////////////////////////////////////////////////////////////////////////////// -///@brief A collection of C++ classes and functions covering the full mip api. -/// -///@see mip_cpp -/// -namespace mip -{ - -template struct MipFieldInfo; - -//////////////////////////////////////////////////////////////////////////////// -///@addtogroup mip_cpp -///@{ - -//////////////////////////////////////////////////////////////////////////////// -///@brief C++ class representing a MIP field. -/// -/// This is a thin wrapper around the C mip_field struct. -/// -class Field : public C::mip_field -{ -public: - /// Construct an empty MIP field. - Field() { C::mip_field::_payload=nullptr; C::mip_field::_payload_length=0; C::mip_field::_field_descriptor=0x00; C::mip_field::_descriptor_set=0x00; C::mip_field::_remaining_length=0; } - ///@copydoc mip_field_init() - Field(uint8_t descriptor_set, uint8_t field_descriptor, const uint8_t* payload, uint8_t payload_length) { C::mip_field_init(this, descriptor_set, field_descriptor, payload, payload_length); } - ///@copydoc mip_field_from_header_ptr() - Field(const uint8_t* header, uint8_t total_length, uint8_t descriptor_set) { *this = C::mip_field_from_header_ptr(header, total_length, descriptor_set); } - /// Creates a %Field class from the mip_field C struct. - Field(const C::mip_field& other) { std::memcpy(static_cast(this), &other, sizeof(C::mip_field)); } - - // - // C function wrappers - // - - ///@copydoc mip_field_descriptor_set - uint8_t descriptorSet() const { return C::mip_field_descriptor_set(this); } - ///@copydoc mip_field_field_descriptor - uint8_t fieldDescriptor() const { return C::mip_field_field_descriptor(this); } - ///@brief Returns the descriptor set and field descriptor. - CompositeDescriptor descriptor() const { return {descriptorSet(), fieldDescriptor()}; } - ///@copydoc mip_field_payload_length - uint8_t payloadLength() const { return C::mip_field_payload_length(this); } - ///@copydoc mip_field_payload - const uint8_t* payload() const { return C::mip_field_payload(this); } - - ///@brief Index the payload at the given location. - ///@param index - ///@returns payload byte - uint8_t payload(unsigned int index) const { return payload()[index]; } - - uint8_t operator[](unsigned int index) const { return payload(index); } - - ///@copydoc mip_field_is_valid - bool isValid() const { return C::mip_field_is_valid(this); } - - ///@copydoc mip_field_next_after - Field nextAfter() const { return C::mip_field_next_after(this); } - ///@copydoc mip_field_next - bool next() { return C::mip_field_next(this); } - - // - // Additional functions which have no C equivalent - // - - ///@brief Deserializes the field data to specific field struct. - /// - ///@tparam FieldType Any field class from a file in the mip/definitions directory. - /// - ///@param[out] field A reference to the field struct to be filled out. Valid - /// only if the function returns true. - ///@param exact_size If true, the function fails if any bytes remain after deserialization. - /// - ///@returns True if the field was successfully deserialized, or false if the field contains - /// too few bytes (or to many if exact_size is specified). The field data is not - /// valid unless this function returns true. - template - bool extract(FieldType& field, bool exact_size=true) const { return mip::extract(field, payload(), payloadLength(), 0, exact_size); } - - - ///@brief Determines if the field holds data (and not a command, reply, or response). - bool isData() const { return isDataDescriptorSet(descriptorSet()); } - - ///@brief Determines if the field is from a command descriptor set (a command, reply, or response field). - bool isCommandSet() const { return isCommandDescriptorSet(descriptorSet()); } - - ///@brief Determines if the field holds a command. - bool isCommand() const { return isCommandSet() && isCommandFieldDescriptor(fieldDescriptor()); } - - ///@brief Determines if the field holds an ack/nack reply code. - bool isReply() const { return isCommandSet() && isReplyFieldDescriptor(fieldDescriptor()) && payloadLength()==2; } - - ///@brief Determines if the field holds command response data (not an ack/nack reply). - bool isResponse() const { return isCommandSet() && isResponseFieldDescriptor(fieldDescriptor()); } -}; - - -//////////////////////////////////////////////////////////////////////////////// -///@brief C++ class representing a MIP PacketRef. -/// -/// This is a thin wrapper around the mip_packet C structure. Like the C -/// version, it does not contain or own the data buffer. Any of the C functions -/// can be used with the C++ packet class because it inherits from the C struct. -/// -/// Fields may be iterated over using the C-style methods, with an iterator, or -/// with a range-based for loop: -///@code{.cpp} -/// for(PacketRef::Iterator iter = packet.begin(); iter != packet.end(); ++iter) { ... } -/// for(Field field : packet) { ... } -///@endcode -/// -class PacketRef : public C::mip_packet -{ -public: - class FieldIterator; - -public: - ///@copydoc mip::C::mip_packet_create - PacketRef(uint8_t* buffer, size_t bufferSize, uint8_t descriptorSet) { C::mip_packet_create(this, buffer, bufferSize, descriptorSet); } - ///@copydoc mip_packet_from_buffer - PacketRef(uint8_t* buffer, size_t length) { C::mip_packet_from_buffer(this, buffer, length); } - /// Constructs a C++ %PacketRef class from the base C object. - PacketRef(const C::mip_packet* other) { std::memcpy(static_cast(this), other, sizeof(*this)); } - /// Constructs a C++ %PacketRef class from the base C object. - PacketRef(const C::mip_packet& other) { std::memcpy(static_cast(this), &other, sizeof(*this)); } - - - // - // C function wrappers - // - - uint8_t descriptorSet() const { return C::mip_packet_descriptor_set(this); } ///<@copydoc mip::C::mip_packet_descriptor_set - uint_least16_t totalLength() const { return C::mip_packet_total_length(this); } ///<@copydoc mip::C::mip_packet_total_length - uint8_t payloadLength() const { return C::mip_packet_payload_length(this); } ///<@copydoc mip::C::mip_packet_payload_length - - bool isData() const { return C::mip_packet_is_data(this); } - - const uint8_t* pointer() const { return C::mip_packet_pointer(this); } ///<@copydoc mip::C::mip_packet_pointer - const uint8_t* payload() const { return C::mip_packet_payload(this); } ///<@copydoc mip::C::mip_packet_payload - - uint16_t checksumValue() const { return C::mip_packet_checksum_value(this); } ///<@copydoc mip::C::mip_packet_checksum_value - uint16_t computeChecksum() const { return C::mip_packet_compute_checksum(this); } ///<@copydoc mip::C::mip_packet_compute_checksum - - bool isSane() const { return C::mip_packet_is_sane(this); } ///<@copydoc mip::C::mip_packet_is_sane - bool isValid() const { return C::mip_packet_is_valid(this); } ///<@copydoc mip::C::mip_packet_is_valid - bool isEmpty() const { return C::mip_packet_is_empty(this); } ///<@copydoc mip::C::mip_packet_is_empty - - uint_least16_t bufferSize() const { return C::mip_packet_buffer_size(this); } ///<@copydoc mip::C::mip_packet_buffer_size - int remainingSpace() const { return C::mip_packet_remaining_space(this); } ///<@copydoc mip::C::mip_packet_remaining_space - - bool addField(uint8_t fieldDescriptor, const uint8_t* payload, uint8_t payloadLength) { return C::mip_packet_add_field(this, fieldDescriptor, payload, payloadLength); } ///<@copydoc mip::C::mip_packet_add_field - int allocField(uint8_t fieldDescriptor, uint8_t payloadLength, uint8_t** payloadPtr_out) { return C::mip_packet_alloc_field(this, fieldDescriptor, payloadLength, payloadPtr_out); } ///<@copydoc mip::C::mip_packet_alloc_field - int reallocLastField(uint8_t* payloadPtr, uint8_t newPayloadLength) { return C::mip_packet_realloc_last_field(this, payloadPtr, newPayloadLength); } ///<@copydoc mip::C::mip_packet_realloc_last_field - int cancelLastField(uint8_t* payloadPtr) { return C::mip_packet_cancel_last_field(this, payloadPtr); } ///<@copydoc mip::C::mip_packet_cancel_last_field - - void finalize() { C::mip_packet_finalize(this); } ///<@copydoc mip::C::mip_packet_finalize - - void reset(uint8_t descSet) { C::mip_packet_reset(this, descSet); } ///<@copydoc mip::C::mip_packet_reset - void reset() { reset(descriptorSet()); } ///<@brief Resets the packet using the same descriptor set. - - uint8_t operator[](unsigned int index) const { return pointer()[index]; } - - // - // Additional functions which have no C equivalent - // - - /// Returns a forward iterator to the first field in the packet. - /// - FieldIterator begin() const { return firstField(); } - - /// Returns a sentry object representing the end of fields in the packet. - /// -#if __cpp_range_based_for >= 201603 - // After 201603, for loops allow different clases for begin and end. - // Using nullptr is simpler and more efficient than creating an end iterator. - std::nullptr_t end() const { return nullptr; } -#else - FieldIterator end() const { return Field(); } -#endif - - ///@brief Returns the first field in the packet. - /// - /// Subsequent fields can be obtained via the returned Field class, - /// but iteration is best done with begin()/end() or the range-based for loop. - /// - ///@note Packets can be empty, so make sure that the returned field is - /// valid before using it. - /// - ///@returns A Field instance representing the first field (if any). - /// - Field firstField() const { return Field(C::mip_field_first_from_packet(this)); } - - ///@brief Adds a field of the given type to the packet. - /// - ///@tparam FieldType Any field class from a file in the mip/definitions directory. - /// - ///@param field Instance of the field to add to the packet. - ///@param fieldDescriptor If specified, overrides the field descriptor. - /// - ///@returns True if the field was added, false if the packet has insufficient space. - /// - template - bool addField(const FieldType& field, uint8_t fieldDescriptor=INVALID_FIELD_DESCRIPTOR) - { - if( fieldDescriptor == INVALID_FIELD_DESCRIPTOR ) - fieldDescriptor = FieldType::FIELD_DESCRIPTOR; - Serializer serializer(*this, fieldDescriptor); - insert(serializer, field); - C::mip_serializer_finish_new_field(&serializer, this); - return serializer.isOk(); - } - - ///@brief Creates a new PacketRef containing a single MIP field from an instance of the field type. - /// - /// This works just like the addField() function but also initializes and finalizes the packet. - /// It is assumed that the field will fit in an empty packet; otherwise the field can't ever be used. - /// The field classes are predefined so this doesn't need runtime checking. - /// - ///@tparam FieldType Any field class from a file in the mip/definitions directory. - /// - ///@param buffer Buffer to hold the packet bytes. - ///@param bufferSize Size of buffer in bytes. - ///@param field Instance of the field to add to the packet. - ///@param fieldDescriptor If specified, overrides the field descriptor. - /// - ///@returns A PacketRef object containing the field. - /// - template - static PacketRef createFromField(uint8_t* buffer, size_t bufferSize, const FieldType& field, uint8_t fieldDescriptor=INVALID_FIELD_DESCRIPTOR) - { - if( fieldDescriptor == INVALID_FIELD_DESCRIPTOR ) - fieldDescriptor = FieldType::FIELD_DESCRIPTOR; - PacketRef packet(buffer, bufferSize, FieldType::DESCRIPTOR_SET); - packet.addField(field, fieldDescriptor); - packet.finalize(); - return packet; - } - - - /// Iterator class for use with the range-based for loop or iterators. - /// - /// You should generally use the begin()/end() functions on the PacketRef - /// class instead of using this class directly. - /// - class FieldIterator - { - public: - /// Empty iterator, which represents the "end" iterator of a packet. - FieldIterator() {} - - /// Create an iterator given the first field to iterate in a packet. - /// Technically this can be any field, not just the first field. - FieldIterator(const Field& first) : mField(first) {} - - /// Comparison between any two iterators. - /// This works even for iterators over different packets, which will - /// never be the same (except all null/end iterators are equivalent). - bool operator==(const FieldIterator& other) const { - // Required to make invalid fields equivalent for range-based for loop - if( !mField.isValid() && !other.mField.isValid() ) - return true; - return mField.descriptorSet() == other.mField.descriptorSet() && mField.fieldDescriptor() == other.mField.fieldDescriptor() && mField.payload() == other.mField.payload(); - } - bool operator!=(const FieldIterator& other) const { return !(*this == other); } - - /// Comparison with std::nullptr is checking if the iterator points to - /// a valid field (i.e. not the end). - bool operator==(std::nullptr_t) const { return !mField.isValid(); } - bool operator!=(std::nullptr_t) const { return mField.isValid(); } - - /// Dereference the iterator as a Field instance. - const Field& operator*() const { return mField; } - - /// Advance to the next field. - FieldIterator& operator++() { mField.next(); return *this; } - - private: - Field mField; - }; - -}; - - -//////////////////////////////////////////////////////////////////////////////// -///@brief A mip packet with a self-contained buffer (useful with std::vector). -/// -template -class SizedPacketBuf : public PacketRef -{ -public: - SizedPacketBuf(uint8_t descriptorSet=INVALID_DESCRIPTOR_SET) : PacketRef(mData, sizeof(mData), descriptorSet) {} - - ///@brief Creates a PacketBuf by copying existing data. - /// - explicit SizedPacketBuf(const uint8_t* data, size_t length) : PacketRef(mData, sizeof(mData)) { copyFrom(data, length); } - explicit SizedPacketBuf(const PacketRef& packet) : PacketRef(mData, sizeof(mData)) { copyFrom(packet); } - - ///@brief Copy constructor - SizedPacketBuf(const SizedPacketBuf& other) : PacketRef(mData, sizeof(mData)) { copyFrom(other); } - - ///@brief Copy constructor (required to put packets into std::vector in some cases). - template - explicit SizedPacketBuf(const SizedPacketBuf& other) : PacketRef(mData, sizeof(mData)) { copyFrom(other); }; - - ///@brief Copy assignment operator - SizedPacketBuf& operator=(const SizedPacketBuf& other) { copyFrom(other); return *this; } - - ///@brief Assignment operator, copies data from another buffer to this one. - template - SizedPacketBuf& operator=(const SizedPacketBuf& other) { copyFrom(other); return *this; } - - ///@brief Create a packet containing just the given field. - /// - ///@tparam FieldType Type of the MIP field. This can't be explicitly specified due to being a constructor. - /// - ///@param field The field object to serialize. - ///@param fieldDescriptor If specified (not INVALID_FIELD_DESCRIPTOR), overrides the field descriptor. - /// - template - SizedPacketBuf(const FieldType& field, uint8_t fieldDescriptor=INVALID_FIELD_DESCRIPTOR) : PacketRef(mData, sizeof(mData)) { createFromField(mData, sizeof(mData), field, fieldDescriptor); } - - - ///@brief Explicitly obtains a reference to the packet data. - /// - PacketRef ref() { return *this; } - - ///@brief Explicitly obtains a const reference to the packet data. - /// - const PacketRef& ref() const { return *this; } - - ///@brief Returns a pointer to the underlying buffer. - /// This is technically the same as PacketRef::pointer but is writable. - uint8_t* buffer() { return mData; } - - ///@brief Copies the data from the pointer to this buffer. The data is not inspected. - /// - ///@param data Pointer to the start of the packet. - ///@param length Total length of the packet. - /// - void copyFrom(const uint8_t* data, size_t length) { assert(length <= sizeof(mData)); std::memcpy(mData, data, length); } - - ///@brief Copies an existing packet. The packet is assumed to be valid (undefined behavior otherwise). - /// - ///@param packet A "sane" (isSane()) mip packet. - /// - void copyFrom(const PacketRef& packet) { assert(packet.isSane()); copyFrom(packet.pointer(), packet.totalLength()); } - - ///@brief Copies this packet to an external buffer. - /// - /// This packet must be sane (see isSane()). Undefined behavior otherwise due to lookup of totalLength(). - /// - ///@param buffer Data is copied into this location. - ///@param maxLength Maximum number of bytes to copy. - /// - ///@returns true if successful. - ///@returns false if maxLength is too short. - /// - bool copyTo(uint8_t* buffer, size_t maxLength) { assert(isSane()); size_t copyLength = this->totalLength(); if(copyLength > maxLength) return false; std::memcpy(buffer, mData, copyLength); return true; } - -private: - uint8_t mData[BufferSize]; -}; - -//////////////////////////////////////////////////////////////////////////////// -///@brief Typedef for SizedPacketBuf of max possible size. -/// -/// Generally you should use this instead of SizedPacketBuf directly, unless you -/// know the maximum size of your packet will be less than PACKET_LENGTH_MAX. -/// -typedef SizedPacketBuf PacketBuf; - - -//////////////////////////////////////////////////////////////////////////////// -///@brief C++ class representing a MIP parser. -/// -/// See @ref parsing_packets -/// -class Parser : public C::mip_parser -{ -public: - ///@copydoc mip::C::mip_parser_init - Parser(uint8_t* buffer, size_t bufferSize, C::mip_packet_callback callback, void* callbackObject, Timeout timeout) { C::mip_parser_init(this, buffer, bufferSize, callback, callbackObject, timeout); } - ///@copydoc mip::C::mip_parser_init - Parser(uint8_t* buffer, size_t bufferSize, bool (*callback)(void*,const PacketRef*,Timestamp), void* callbackObject, Timeout timeout) { C::mip_parser_init(this, buffer, bufferSize, (C::mip_packet_callback)callback, callbackObject, timeout); } - - Parser(uint8_t* buffer, size_t bufferSize, Timeout timeout) { C::mip_parser_init(this, buffer, bufferSize, nullptr, nullptr, timeout); } - - template - void setCallback(T& object); - - ///@copydoc mip::C::mip_parser_reset - void reset() { C::mip_parser_reset(this); } - - ///@copydoc mip::C::mip_parser_parse - size_t parse(const uint8_t* inputBuffer, size_t inputCount, Timestamp timestamp, unsigned int maxPackets=0) { return C::mip_parser_parse(this, inputBuffer, inputCount, timestamp, maxPackets); } - - ///@copydoc mip::C::mip_parser_timeout - Timeout timeout() const { return C::mip_parser_timeout(this); } - ///@copydoc mip::C::mip_parser_set_timeout - void setTimeout(Timeout timeout) { return C::mip_parser_set_timeout(this, timeout); } -}; - - -///@brief Initializes the MIP Parser -/// -/// This version allows binding a member function instead of a C-style callback. -/// Example: -///@code{.cpp} -/// struct MyClass -/// { -/// void handlePacket(const PacketRef& packet, Timeout timeout); -/// }; -/// MyClass myInstance; -/// Parser parser(myInstance); -///@endcode -/// -///@tparam T Class type containing the member function to be called. -///@tparam Callback A pointer to a member function on a T to be called when a -/// packet is parsed. -/// -///@param object -/// Instance of T to call the callback. -/// -template -void Parser::setCallback(T& object) -{ - C::mip_packet_callback callback = [](void* obj, const C::mip_packet* pkt, Timestamp timestamp)->bool - { - return (static_cast(obj)->*Callback)(PacketRef(pkt), timestamp); - }; - - C::mip_parser_set_callback(this, callback, &object); -} - -//////////////////////////////////////////////////////////////////////////////// -///@brief Read data from a source into the internal parsing buffer. -/// -///@tparam Function -/// A function-like object with the following signature: -/// `bool read(size_t maxCount, size_t* count_out, Timestamp* timestamp_out);` -/// The parameters are as follows: -/// @li buffer - Buffer into which to write data. -/// @li maxCount - The maximum number of bytes to read. -/// @li count_out - Updated with the number of bytes actually read. -/// @li timestamp_out - Updated with the timestamp of the data. -/// -///@param parser -/// -///@param reader -/// A callback function, lambda, or similar which will read data into the -/// buffer and capture the timestamp. It should return true if successful -/// or false otherwise. If it returns false, parsing is skipped. The read -/// function may also throw an exception instead of returning false. -/// -///@param maxPackets -/// Maximum number of packets to parse, just like for Parser::parse(). -/// -///@return Same as the return value of reader. -/// -template -bool parseMipDataFromSource(C::mip_parser& parser, Function reader, size_t maxPackets) -{ - uint8_t* ptr; - size_t maxCount = C::mip_parser_get_write_ptr(&parser, &ptr); - - size_t count; - Timestamp timestamp; - if( !reader(ptr, maxCount, &count, ×tamp) ) - return false; - - assert(count <= maxCount); - - C::mip_parser_process_written(&parser, count, timestamp, maxPackets); - - return true; -} - -///@} -//////////////////////////////////////////////////////////////////////////////// - -} // namespace mip diff --git a/src/mip/mip_logging.h b/src/mip/mip_logging.h deleted file mode 100644 index b847b729a..000000000 --- a/src/mip/mip_logging.h +++ /dev/null @@ -1,141 +0,0 @@ -#pragma once - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -//////////////////////////////////////////////////////////////////////////////// -///@addtogroup mip_c -///@{ -//////////////////////////////////////////////////////////////////////////////// -///@defgroup mip_logging Mip Logging [C] -/// -///@brief High-level C functions for logging information from within the MIP SDK -/// -/// This module contains functions that allow the MIP SDK to log information -/// and allows users to override the logging functions -/// -///@{ - -//////////////////////////////////////////////////////////////////////////////// -///@brief Logging level enum -/// -typedef uint8_t mip_log_level; -#define MIP_LOG_LEVEL_OFF 0 ///< Signifies that the log is turned off -#define MIP_LOG_LEVEL_FATAL 1 ///< Fatal logs are logged when an unrecoverable error occurs -#define MIP_LOG_LEVEL_ERROR 2 ///< Error logs are logged when an error occurs -#define MIP_LOG_LEVEL_WARN 3 ///< Warning logs are logged when something concerning happens that may or not be a mistake -#define MIP_LOG_LEVEL_INFO 4 ///< Info logs are logged when some general info needs to be conveyed to the user -#define MIP_LOG_LEVEL_DEBUG 5 ///< Debug logs are logged for debug purposes. -#define MIP_LOG_LEVEL_TRACE 6 ///< Trace logs are logged in similar cases to debug logs but can be logged in tight loops - -//////////////////////////////////////////////////////////////////////////////// -///@brief Callback function typedef for custom logging behavior. -/// -///@param level The log level that this log should be logged at -///@param fmt printf style format string -///@param ... Variadic args used to populate the fmt string -/// -typedef void (*mip_log_callback)(void* user, mip_log_level level, const char* fmt, va_list args); - -void mip_logging_init(mip_log_callback callback, mip_log_level level, void* user); - -mip_log_callback mip_logging_callback(); -mip_log_level mip_logging_level(); -void* mip_logging_user_data(); - -void mip_logging_log(mip_log_level level, const char* fmt, ...); - -//////////////////////////////////////////////////////////////////////////////// -///@brief Helper macro used to initialize the MIP logger. -/// This function does not need to be called unless the user wants logging -/// -///@param callback The callback to execute when there is data to log -///@param level The level that the MIP SDK should log at -///@param user User data that will be passed to the callback every time it is excuted -/// -#ifdef MIP_ENABLE_LOGGING -#define MIP_LOG_INIT(callback, level, user) mip_logging_init(callback, level, user) -#else -#define MIP_LOG_INIT(callback, level, user) (void)0 -#endif - -//////////////////////////////////////////////////////////////////////////////// -///@brief Helper macro used to log data inside the MIP SDK. Prefer specific -/// log level functions like MIP_LOG_INFO, etc. when possible. -///@copydetails mip::C::mip_log_callback -/// -#ifdef MIP_ENABLE_LOGGING -#define MIP_LOG_LOG(level, ...) mip_logging_log(level, __VA_ARGS__) -#else -#define MIP_LOG_LOG(level, ...) (void)0 -#endif - -//////////////////////////////////////////////////////////////////////////////// -///@brief Helper macro used to log data inside the MIP SDK at fatal level -/// -///@param context Context of what called this function. Could be a MIP device, serial connection, etc. -///@param fmt printf style format string -///@param ... Variadic args used to populate the fmt string -/// -#if !defined(MIP_LOGGING_MAX_LEVEL) || MIP_LOGGING_MAX_LEVEL >= MIP_LOG_LEVEL_FATAL -#define MIP_LOG_FATAL(...) MIP_LOG_LOG(MIP_LOG_LEVEL_FATAL, __VA_ARGS__) -#else -#define MIP_LOG_FATAL(...) (void)0 -#endif - -//////////////////////////////////////////////////////////////////////////////// -///@brief Helper macro used to log data inside the MIP SDK at error level -///@copydetails mip::C::MIP_LOG_FATAL -#if !defined(MIP_LOGGING_MAX_LEVEL) || MIP_LOGGING_MAX_LEVEL >= MIP_LOG_LEVEL_ERROR -#define MIP_LOG_ERROR(...) MIP_LOG_LOG(MIP_LOG_LEVEL_ERROR, __VA_ARGS__) -#else -#define MIP_LOG_ERROR(...) (void)0 -#endif - -//////////////////////////////////////////////////////////////////////////////// -///@brief Helper macro used to log data inside the MIP SDK at warn level -///@copydetails mip::C::MIP_LOG_FATAL -#if !defined(MIP_LOGGING_MAX_LEVEL) || MIP_LOGGING_MAX_LEVEL >= MIP_LOG_LEVEL_WARN -#define MIP_LOG_WARN(...) MIP_LOG_LOG(MIP_LOG_LEVEL_WARN, __VA_ARGS__) -#else -#define MIP_LOG_WARN(...) (void)0 -#endif - -//////////////////////////////////////////////////////////////////////////////// -///@brief Helper macro used to log data inside the MIP SDK at info level -///@copydetails mip::C::MIP_LOG_FATAL -#if !defined(MIP_LOGGING_MAX_LEVEL) || MIP_LOGGING_MAX_LEVEL >= MIP_LOG_LEVEL_INFO -#define MIP_LOG_INFO(...) MIP_LOG_LOG(MIP_LOG_LEVEL_INFO, __VA_ARGS__) -#else -#define MIP_LOG_INFO(...) (void)0 -#endif - -//////////////////////////////////////////////////////////////////////////////// -///@brief Helper macro used to log data inside the MIP SDK at debug level -///@copydetails mip::C::MIP_LOG_FATAL -#if !defined(MIP_LOGGING_MAX_LEVEL) || MIP_LOGGING_MAX_LEVEL >= MIP_LOG_LEVEL_DEBUG -#define MIP_LOG_DEBUG(...) MIP_LOG_LOG(MIP_LOG_LEVEL_DEBUG, __VA_ARGS__) -#else -#define MIP_LOG_DEBUG(...) (void)0 -#endif - -//////////////////////////////////////////////////////////////////////////////// -///@brief Helper macro used to log data inside the MIP SDK at trace level -///@copydetails mip::C::MIP_LOG_FATAL -#if !defined(MIP_LOGGING_MAX_LEVEL) || MIP_LOGGING_MAX_LEVEL >= MIP_LOG_LEVEL_TRACE -#define MIP_LOG_TRACE(...) MIP_LOG_LOG(MIP_LOG_LEVEL_TRACE, __VA_ARGS__) -#else -#define MIP_LOG_TRACE(...) (void)0 -#endif - -///@} -///@} -//////////////////////////////////////////////////////////////////////////////// - -#ifdef __cplusplus -} // extern "C" -#endif \ No newline at end of file diff --git a/src/mip/mip_packet.h b/src/mip/mip_packet.h deleted file mode 100644 index e98287fcb..000000000 --- a/src/mip/mip_packet.h +++ /dev/null @@ -1,113 +0,0 @@ -#pragma once - -#include "mip_types.h" - -#ifdef __cplusplus -namespace mip{ -namespace C { -extern "C" { -#endif - - -//////////////////////////////////////////////////////////////////////////////// -///@addtogroup mip_c -///@{ - -//////////////////////////////////////////////////////////////////////////////// -///@defgroup mip_packet_c Mip Packet [C] -/// -///@brief Functions for handling MIP packets. -/// -/// A MIP Packet is represented by the mip_packet struct. -/// -///~~~ -/// +-------+-------+------+------+------------+-----/ /----+------------+---- -/// | SYNC1 | SYNC2 | DESC | PLEN | Field | ... | Checksum | remaining buffer space... -/// +-------+-------+------+------+------------+-----/ /----+------------+---- -///~~~ -/// -///@{ - - -//////////////////////////////////////////////////////////////////////////////// -///@brief Structure representing a MIP Packet. -/// -/// Use to inspect received packets or construct new ones. -/// -///@note This should be considered an "opaque" structure; its members should be -/// considered an internal implementation detail. Avoid accessing them directly -/// as they are subject to change in future versions of this software. -/// -typedef struct mip_packet -{ - uint8_t* _buffer; ///<@private Pointer to the packet data. - uint_least16_t _buffer_length; ///<@private Length of the buffer (NOT the packet length!). -} mip_packet; - - -//////////////////////////////////////////////////////////////////////////////// -///@defgroup PacketBuilding Packet Building [C] -/// -///@brief Functions for building new MIP packets. -/// -/// Use these functions to create a new packet, add fields, and write the -/// checksum. -/// -///@{ - -void mip_packet_create(mip_packet* packet, uint8_t* buffer, size_t buffer_size, uint8_t descriptor_set); - -bool mip_packet_add_field(mip_packet* packet, uint8_t field_descriptor, const uint8_t* payload, uint8_t payload_length); -int mip_packet_alloc_field(mip_packet* packet, uint8_t field_descriptor, uint8_t payload_length, uint8_t** payload_ptr_out); -int mip_packet_realloc_last_field(mip_packet* packet, uint8_t* payload_ptr, uint8_t new_payload_length); -int mip_packet_cancel_last_field(mip_packet* packet, uint8_t* payload_ptr); - -void mip_packet_finalize(mip_packet* packet); - -void mip_packet_reset(mip_packet* packet, uint8_t descriptor_set); - -///@} -//////////////////////////////////////////////////////////////////////////////// -///@defgroup Accessors Accessors - Functions for accessing information about an existing MIP packet. -/// -/// Use these functions to get information about a MIP packet after it has been -/// parsed. Generally, first the descriptor set would be inspected followed by -/// iterating the fields using the MipFieldIteration functions. -/// -/// With the exception of mip_packet_checksum_value() (and any function which -/// calls it, e.g. mip_packet_is_valid()), these functions may also be used on -/// packets which are under construction via the PacketBuilding functions. -/// -///@{ - -void mip_packet_from_buffer(mip_packet* packet, uint8_t* buffer, size_t length); - -uint8_t mip_packet_descriptor_set(const mip_packet* packet); -uint_least16_t mip_packet_total_length(const mip_packet* packet); -uint8_t mip_packet_payload_length(const mip_packet* packet); -uint8_t* mip_packet_buffer(mip_packet* packet); -const uint8_t* mip_packet_pointer(const mip_packet* packet); -const uint8_t* mip_packet_payload(const mip_packet* packet); -uint16_t mip_packet_checksum_value(const mip_packet* packet); -uint16_t mip_packet_compute_checksum(const mip_packet* packet); - - -bool mip_packet_is_sane(const mip_packet* packet); -bool mip_packet_is_valid(const mip_packet* packet); -bool mip_packet_is_empty(const mip_packet* packet); - -uint_least16_t mip_packet_buffer_size(const mip_packet* packet); -int mip_packet_remaining_space(const mip_packet* packet); - -bool mip_packet_is_data(const mip_packet* packet); - -///@} -///@} -///@} -//////////////////////////////////////////////////////////////////////////////// - -#ifdef __cplusplus -} // namespace mip -} // namespace C -} // extern "C" -#endif diff --git a/src/mip/mip_types.h b/src/mip/mip_types.h deleted file mode 100644 index 3fb409544..000000000 --- a/src/mip/mip_types.h +++ /dev/null @@ -1,61 +0,0 @@ -#pragma once - -#include -#include -#include - -#ifdef __cplusplus -namespace mip { -namespace C { -extern "C" { -#endif - - - -///@brief Type used for packet timestamps and timeouts. -/// -/// Timestamps must be monotonic except for overflow at the maximum value back to 0. -/// The units can be anything, but typically are milliseconds. Choose a long enough -/// unit so that consecutive calls to the parser will not exceed half of the maximum -/// value for this type. For milliseconds, the time to overflow is approximately 50 -/// days, so the parser should be invoked at least every 25 days. Failure to observe -/// this requirement may result in false timeouts or delays in getting parsed packets. -/// -#ifdef MIP_TIMESTAMP_TYPE - typedef MIP_TIMESTAMP_TYPE mip_timestamp; - static_assert( sizeof(mip_timestamp) >= 8 || mip_timestamp(-1) > 0, "MIP_TIMESTAMP_TYPE must be unsigned unless 64 bits."); -#else - typedef uint64_t mip_timestamp; -#endif - -typedef mip_timestamp mip_timeout; - - -#ifdef MIP_ENABLE_DIAGNOSTICS - -// Saturating addition -#define MIP_DIAG_INC(counter, amount) do { if (counter + amount < counter) counter = -1; else counter += amount; } while(false) - -#define MIP_DIAG_ZERO(counter) counter = 0 - -#else // MIP_ENABLE_DIAGNOSTICS - -// Do nothing if diagnostic counters diabled. Cast amount to void to avoid "unused local variable" warnings. -#define MIP_DIAG_INC(counter, amount) (void)amount - -#define MIP_DIAG_ZERO(counter) (void)0 - -#endif // MIP_ENABLE_DIAGNOSTICS - - -#ifdef __cplusplus - -} // extern "C" -} // namespace C - -using Timestamp = C::mip_timestamp; -using Timeout = C::mip_timeout; - -} // namespace mip - -#endif diff --git a/src/mip/utils/serialization.h b/src/mip/utils/serialization.h deleted file mode 100644 index d0b03f6b0..000000000 --- a/src/mip/utils/serialization.h +++ /dev/null @@ -1,282 +0,0 @@ -#pragma once - -#include -#include - -#include "../mip_field.h" -#include "../mip_packet.h" -#include "../mip_types.h" - -//////////////////////////////////////////////////////////////////////////////// -///@defgroup mip_serialization MIP Serialization -/// -///@brief Serialization Functions for reading and writing to byte buffers. -///@{ -///@defgroup mip_serialization_c MIP Serialization [C] -///@defgroup mip_serialization_cpp MIP Serialization [CPP] -///@} - -#ifdef __cplusplus -#include - -namespace mip { -namespace C { -extern "C" { -#endif // __cplusplus - - - -//////////////////////////////////////////////////////////////////////////////// -///@addtogroup mip_serialization_c -/// -///@brief (De)serialization in C. -/// -///@{ - - -//////////////////////////////////////////////////////////////////////////////// -///@brief Structure used for serialization. -/// -///@note This should be considered an "opaque" structure; its members should be -/// considered an internal implementation detail. Avoid accessing them directly -/// as they are subject to change in future versions of this software. -/// -/// -typedef struct mip_serializer -{ - uint8_t* _buffer; ///<@private Pointer to data for serialization. - size_t _buffer_size; ///<@private Size of the buffer. - size_t _offset; ///<@private Current offset into the buffer (can exceed buffer_size!). -} mip_serializer; - -void mip_serializer_init_insertion(mip_serializer* serializer, uint8_t* buffer, size_t buffer_size); -void mip_serializer_init_extraction(mip_serializer* serializer, const uint8_t* buffer, size_t buffer_size); -void mip_serializer_init_new_field(mip_serializer* serializer, mip_packet* packet, uint8_t field_descriptor); -void mip_serializer_finish_new_field(const mip_serializer* serializer, mip_packet* packet); -void mip_serializer_init_from_field(mip_serializer* serializer, const mip_field* field); - -size_t mip_serializer_capacity(const mip_serializer* serializer); -size_t mip_serializer_length(const mip_serializer* serializer); -int mip_serializer_remaining(const mip_serializer* serializer); - -bool mip_serializer_is_ok(const mip_serializer* serializer); -bool mip_serializer_is_complete(const mip_serializer* serializer); - - -void insert_bool(mip_serializer* serializer, bool value); -void insert_char(mip_serializer* serializer, char value); - -void insert_u8 (mip_serializer* serializer, uint8_t value); -void insert_u16(mip_serializer* serializer, uint16_t value); -void insert_u32(mip_serializer* serializer, uint32_t value); -void insert_u64(mip_serializer* serializer, uint64_t value); - -void insert_s8 (mip_serializer* serializer, int8_t value); -void insert_s16(mip_serializer* serializer, int16_t value); -void insert_s32(mip_serializer* serializer, int32_t value); -void insert_s64(mip_serializer* serializer, int64_t value); - -void insert_float (mip_serializer* serializer, float value); -void insert_double(mip_serializer* serializer, double value); - - -void extract_bool(mip_serializer* serializer, bool* value); -void extract_char(mip_serializer* serializer, char* value); - -void extract_u8 (mip_serializer* serializer, uint8_t* value); -void extract_u16(mip_serializer* serializer, uint16_t* value); -void extract_u32(mip_serializer* serializer, uint32_t* value); -void extract_u64(mip_serializer* serializer, uint64_t* value); - -void extract_s8 (mip_serializer* serializer, int8_t* value); -void extract_s16(mip_serializer* serializer, int16_t* value); -void extract_s32(mip_serializer* serializer, int32_t* value); -void extract_s64(mip_serializer* serializer, int64_t* value); - -void extract_float (mip_serializer* serializer, float* value); -void extract_double(mip_serializer* serializer, double* value); - -void extract_count(mip_serializer* serializer, uint8_t* count_out, uint8_t max_count); - -///@} -//////////////////////////////////////////////////////////////////////////////// - -#ifdef __cplusplus -} // extern "C" -} // namespace C - -//////////////////////////////////////////////////////////////////////////////// -///@addtogroup mip_cpp -///@{ - -//////////////////////////////////////////////////////////////////////////////// -///@addtogroup mip_serialization_cpp -/// -///@brief (De)serialization in C++. -/// -/// There are two overloaded functions defined in the mip namespace, insert and -/// extract. The signature for each is as follows: -///@code{.cpp} -/// void mip::insert(Serializer& serializer, Type value); -/// voie mip::extract(Serializer& serializer, Type value); -///@endcode -/// Where `Type` is a struct or numeric type. -/// -/// There are overloads for all of the MIP definition types: -///@li Command, response, and data fields -///@li Enums, bitfields, and nested structs for commands -/// -/// Additionally, there are overloads with a different signature which allow -/// one to avoid creating a Serializer object every time. These overloads -/// create a serializer internally and pass it on to the regular version. -///@code{.cpp} -/// template bool mip::insert(const T& value, uint8_t* buffer, size_t bufferSize); -/// template bool mip::Field::extract(T& value); -///@endcode -/// This makes it easy to extract data from a field: -///@code{.cpp} -/// data_sensor::ScaledAccel accel; -/// MipField field(...); -/// if( field.extract(accel) ) -/// { -/// // Do something with accel data -/// printf("Accel X=%f\n", accel.scaled_accel[0]); -/// } -///@endcode -/// -///@{ - -//////////////////////////////////////////////////////////////////////////////// -///@brief Serialization class. -/// -class Serializer : public C::mip_serializer -{ -public: - Serializer(C::mip_packet& packet, uint8_t newFieldDescriptor) { C::mip_serializer_init_new_field(this, &packet, newFieldDescriptor); } - Serializer(uint8_t* buffer, size_t size, size_t offset=0) { C::mip_serializer_init_insertion(this, buffer, size); this->_offset = offset; } - Serializer(const uint8_t* buffer, size_t size, size_t offset=0) { C::mip_serializer_init_extraction(this, const_cast(buffer), size); this->_offset = offset; } - - size_t capacity() const { return C::mip_serializer_capacity(this); } - size_t length() const { return C::mip_serializer_length(this); } - int remaining() const { return C::mip_serializer_remaining(this); } - - bool isOk() const { return C::mip_serializer_is_ok(this); } - bool isComplete() const { return C::mip_serializer_is_complete(this); } - - operator const void*() const { return isOk() ? this : nullptr; } - bool operator!() const { return !isOk(); } -}; - - - -inline void insert(Serializer& serializer, bool value) { return C::insert_bool (&serializer, value); } -inline void insert(Serializer& serializer, char value) { return C::insert_char (&serializer, value); } -inline void insert(Serializer& serializer, uint8_t value) { return C::insert_u8 (&serializer, value); } -inline void insert(Serializer& serializer, uint16_t value) { return C::insert_u16 (&serializer, value); } -inline void insert(Serializer& serializer, uint32_t value) { return C::insert_u32 (&serializer, value); } -inline void insert(Serializer& serializer, uint64_t value) { return C::insert_u64 (&serializer, value); } -inline void insert(Serializer& serializer, int8_t value) { return C::insert_s8 (&serializer, value); } -inline void insert(Serializer& serializer, int16_t value) { return C::insert_s16 (&serializer, value); } -inline void insert(Serializer& serializer, int32_t value) { return C::insert_s32 (&serializer, value); } -inline void insert(Serializer& serializer, int64_t value) { return C::insert_s64 (&serializer, value); } -inline void insert(Serializer& serializer, float value) { return C::insert_float (&serializer, value); } -inline void insert(Serializer& serializer, double value) { return C::insert_double(&serializer, value); } - -//////////////////////////////////////////////////////////////////////////////// -///@brief Inserts an enum into the buffer. -/// -///@tparam Enum The type of the enum to serialize. Must be a c++ typed enum. -/// -///@param serializer The serialization instance. -///@param value The enum to insert. -/// -template -typename std::enable_if< std::is_enum::value, void>::type -/*void*/ insert(Serializer& serializer, Enum value) { return insert(serializer, static_cast< typename std::underlying_type::type >(value) ); } - -//////////////////////////////////////////////////////////////////////////////// -///@brief Insert the given value into the buffer. -/// -/// If the buffer has insufficient space, this function returns false and the -/// contents of buffer may be partially modified. -/// -///@param value Value to insert. -///@param buffer Buffer to udpate with the value. -///@param bufferSize Size of the buffer. -///@param offset Starting offset into the buffer. -/// -///@returns true if sufficient space was available, false otherwise. -/// -template -bool insert(const T& value, uint8_t* buffer, size_t bufferSize, size_t offset=0) -{ - Serializer serializer(buffer, bufferSize, offset); - insert(serializer, value); - return !!serializer; -} - -inline void extract(Serializer& serializer, bool& value) { return C::extract_bool (&serializer, &value); } -inline void extract(Serializer& serializer, char& value) { return C::extract_char (&serializer, &value); } -inline void extract(Serializer& serializer, uint8_t& value) { return C::extract_u8 (&serializer, &value); } -inline void extract(Serializer& serializer, uint16_t& value) { return C::extract_u16 (&serializer, &value); } -inline void extract(Serializer& serializer, uint32_t& value) { return C::extract_u32 (&serializer, &value); } -inline void extract(Serializer& serializer, uint64_t& value) { return C::extract_u64 (&serializer, &value); } -inline void extract(Serializer& serializer, int8_t& value) { return C::extract_s8 (&serializer, &value); } -inline void extract(Serializer& serializer, int16_t& value) { return C::extract_s16 (&serializer, &value); } -inline void extract(Serializer& serializer, int32_t& value) { return C::extract_s32 (&serializer, &value); } -inline void extract(Serializer& serializer, int64_t& value) { return C::extract_s64 (&serializer, &value); } -inline void extract(Serializer& serializer, float& value) { return C::extract_float (&serializer, &value); } -inline void extract(Serializer& serializer, double& value) { return C::extract_double(&serializer, &value); } - -//////////////////////////////////////////////////////////////////////////////// -///@brief Extract an enum from the buffer. -/// -///@tparam Enum The type of the enum to deserialize. Must be a c++ typed enum. -/// -///@param serializer The serialization instance. -///@param[out] value The enum to populate. -/// -template -typename std::enable_if< std::is_enum::value, void>::type -/*void*/ extract(Serializer& serializer, Enum& value) { - typename std::underlying_type::type tmp; - extract(serializer, tmp); - value = static_cast(tmp); -} - -//////////////////////////////////////////////////////////////////////////////// -///@brief Extract the value given a buffer, size, and starting offset. -/// -///@param[out] value_out -/// This parameter will be filled with the extracted value. -///@param buffer -/// A pointer to the raw data. -///@param bufferSize -/// Length of the buffer, or the relevant data within the buffer. -///@param offset -/// Start reading from this offset in the buffer. Default 0. -///@param exact_size -/// If true, exactly bufferSize bytes must be used in order for the return -/// value to be true. -/// -///@returns True if the extraction was successful, false otherwise. "Success" -/// means the supplied data was sufficient. If exact_size is true, then -/// this function only returns true if exactly bufferSize bytes were -/// consumed. -/// -template -bool extract(T& value_out, const uint8_t* buffer, size_t bufferSize, size_t offset=0, bool exact_size=false) -{ - Serializer serializer(buffer, bufferSize, offset); - extract(serializer, value_out); - return exact_size ? serializer.isComplete() : serializer.isOk(); -} - -///@} -///@} -//////////////////////////////////////////////////////////////////////////////// - -} // namespace mip -#endif // __cplusplus - -//////////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 14d2eb56a..6169a59a2 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,30 +1,32 @@ - set(TEST_DIR "${CMAKE_CURRENT_LIST_DIR}") +add_library(MicrostrainTest "${TEST_DIR}/test.h" "${TEST_DIR}/test.c") + # # MIP # macro(add_mip_test name sources command) - add_executable(${name} ${sources}) - target_link_libraries(${name} mip) + target_include_directories(${name} PRIVATE ${CMAKE_CURRENT_LIST_DIR} ${MICROSTRAIN_SRC_DIR}) + target_link_libraries(${name} MicrostrainTest ${MIP_LIBRARY}) add_test(${name} ${command} ${ARGN}) - endmacro() -add_mip_test(TestMipPacketBuilding "${TEST_DIR}/mip/test_mip_packet_builder.c" TestMipPacketBuilding) -add_mip_test(TestMipParsing "${TEST_DIR}/mip/test_mip_parser.c" TestMipParsing "${TEST_DIR}/data/mip_data.bin") -add_mip_test(TestMipRandom "${TEST_DIR}/mip/test_mip_random.c" TestMipRandom) -add_mip_test(TestMipFields "${TEST_DIR}/mip/test_mip_fields.c" TestMipFields) -add_mip_test(TestMipCpp "${TEST_DIR}/mip/test_mip.cpp" TestMipCpp) -add_mip_test(TestMipPerf "${TEST_DIR}/mip/mip_parser_performance.cpp" TestMipPerf) - -if(WITH_SERIAL) - add_executable(TestSerial "${TEST_DIR}/test_serial.cpp") - target_include_directories(TestSerial PUBLIC "${SERIAL_INCLUDE_DIRS}") - target_link_libraries(TestSerial PUBLIC "serial") - add_test(TestSerial TestSerial) -endif() +add_mip_test(TestMipPacketBuilding "${TEST_DIR}/c/mip/test_mip_packet_builder.c" TestMipPacketBuilding) +add_mip_test(TestMipParsing "${TEST_DIR}/c/mip/test_mip_parser.c" TestMipParsing "${TEST_DIR}/data/mip_data.bin") +add_mip_test(TestMipRandom "${TEST_DIR}/c/mip/test_mip_random.c" TestMipRandom) +add_mip_test(TestMipFields "${TEST_DIR}/c/mip/test_mip_fields.c" TestMipFields) +add_mip_test(TestMipCpp "${TEST_DIR}/cpp/mip/test_mip.cpp" TestMipCpp) +add_mip_test(TestMipPerf "${TEST_DIR}/cpp/mip/mip_parser_performance.cpp" TestMipPerf) +add_mip_test(TestMipPacket "${TEST_DIR}/cpp/mip/test_packet_interface.cpp" TestMipPacket) + +#if(MICROSTRAIN_BUILD_EXAMPLES) +# set(OUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/MipPacketExampleOutput.txt") +# add_test( +# NAME TestMipPacketExample +# COMMAND diff -u "${CMAKE_CURRENT_LIST_DIR}/data/packet_example_cpp_check.txt" <(examples/MipPacketExample) +# ) +#endif() diff --git a/test/mip/test_mip_fields.c b/test/c/mip/test_mip_fields.c similarity index 92% rename from test/mip/test_mip_fields.c rename to test/c/mip/test_mip_fields.c index 156c7a4be..9fa409197 100644 --- a/test/mip/test_mip_fields.c +++ b/test/c/mip/test_mip_fields.c @@ -8,9 +8,9 @@ uint8_t packet_buffer[MIP_PACKET_LENGTH_MAX]; -struct mip_packet packet; +struct mip_packet_view packet; -struct mip_field fields[MIP_PACKET_PAYLOAD_LENGTH_MAX / MIP_FIELD_LENGTH_MIN]; +struct mip_field_view fields[MIP_PACKET_PAYLOAD_LENGTH_MAX / MIP_FIELD_LENGTH_MIN]; unsigned int num_fields = 0; @@ -20,7 +20,7 @@ bool add_random_field() const uint8_t field_desc = (rand() % 255) + 1; uint8_t* payload; - if( !mip_packet_alloc_field(&packet, field_desc, length, &payload) ) + if( !mip_packet_create_field(&packet, field_desc, length, &payload) ) return false; for(unsigned int i=0; i #include + #include #include #include @@ -9,60 +12,10 @@ #define EXTRA 1 uint8_t buffer[MIP_PACKET_LENGTH_MAX+EXTRA]; -int num_errors = 0; - -void print_buffer(FILE* file) -{ - for(unsigned int i=0; i(v) += 1; return true; diff --git a/test/mip/test_mip.cpp b/test/cpp/mip/test_mip.cpp similarity index 81% rename from test/mip/test_mip.cpp rename to test/cpp/mip/test_mip.cpp index 84aeb0e40..bda31a9ab 100644 --- a/test/mip/test_mip.cpp +++ b/test/cpp/mip/test_mip.cpp @@ -14,7 +14,7 @@ using namespace mip::C; uint8_t packetBuffer[PACKET_LENGTH_MAX]; uint8_t parseBuffer[1024]; -Field fields[MIP_PACKET_PAYLOAD_LENGTH_MAX / MIP_FIELD_LENGTH_MIN]; +FieldView fields[(unsigned int)MIP_PACKET_PAYLOAD_LENGTH_MAX / (unsigned int)MIP_FIELD_LENGTH_MIN]; unsigned int numFields = 0; unsigned int numErrors = 0; @@ -23,11 +23,11 @@ int main(int argc, const char* argv[]) { srand(0); - auto callback = [](void*, const PacketRef* parsedPacket, Timestamp timestamp)->bool + auto callback = [](void*, const PacketView* parsedPacket, Timestamp timestamp)->bool { unsigned int parsedFields = 0; bool error = false; - for(Field field : *parsedPacket) + for(FieldView field : *parsedPacket) { if( field.descriptorSet() != fields[parsedFields].descriptorSet() ) { @@ -78,23 +78,28 @@ int main(int argc, const char* argv[]) for(unsigned int i=0; i +#include + +#include +#include +#include + +// A ping command +const uint8_t PING[] = { 0x75, 0x65, 0x01, 0x02, 0x02, 0x01, 0xE0, 0xC6 }; +// Sample data field +const mip::data_sensor::ScaledAccel ACCEL_FIELD = { {1.f, 2.f, -3.f} }; +const uint8_t ACCEL_PKT[] = { 0x75, 0x65, 0x80, 0x0e, 0x0e, 0x04, 0x3f, 0x80, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0xC0, 0x40, 0x00, 0x00, 0x79, 0xed }; +//const mip::data_shared::ReferenceTimestamp REFTIME = { 1'234'567'890 }; + +void print_packet(const mip::PacketView& packet) +{ + print_buffer(stderr, packet.pointer(), packet.totalLength()); +} + +bool checkPacketView(const mip::PacketView& packet, microstrain::Span compare, const char* method) +{ + bool ok = true; + + ok &= check(packet.isSane(), "Insane packet from %s", method); + ok &= check(packet.descriptorSet() == compare[mip::C::MIP_INDEX_DESCSET], "Wrong descriptor set from %s", method); + ok &= check(packet.payloadLength() == compare[mip::C::MIP_INDEX_LENGTH], "Wrong payload length from %s", method); + ok &= check(packet.totalLength() == packet.payloadLength()+mip::C::MIP_PACKET_LENGTH_MIN, "Wrong total length from %s", method); + ok &= check_equal(packet.payload(), packet.pointer() + mip::C::MIP_INDEX_PAYLOAD, "Wrong payload pointer from %s", method); + ok &= check(packet.pointer() != nullptr, "PacketRef shouldn't have NULL pointer from %s", method); + ok &= check_equal(packet.totalSpan().data(), packet.pointer(), "totalSpan().data() should match pointer()"); + ok &= check_equal(packet.totalSpan().size(), packet.totalLength(), "totalSpan().size() should match totalLength()"); + ok &= check_equal(packet.payloadSpan().data(), packet.payload(), "payloadSpan().data() should match payload()"); + ok &= check_equal(packet.payloadSpan().size(), packet.payloadLength(), "payloadSpan().size() should match payloadLength()"); + ok &= check_equal(packet.remainingSpace(), packet.bufferSize()-packet.totalLength(), "remainingSpace() is wrong"); + + if(std::memcmp(packet.pointer(), compare.data(), compare.size()) != 0) + { + fprintf(stderr, "Data mismatch from %s:\n", method); + print_packet(packet); + print_buffer(stderr, compare.data(), compare.size()); + ok = false; + } + + return ok; +} + +template +bool checkPacketBuf(mip::SizedPacketBuf& packet, microstrain::Span compare, const char* method) +{ + bool ok = checkPacketView(packet, compare, method); + + ok &= check(packet.buffer() != nullptr, "NULL buffer from %s", method); + ok &= check_equal(packet.bufferSize(), Size, "bufferSize() should match templated size from %s", method); + ok &= check_equal(packet.pointer(), packet.buffer(), "Packet buffer/pointer mismatch from %s", method); + ok &= check(packet.pointer() != compare.data(), "PacketBuf shouldn't point to original data buffer from %s", method); + ok &= check_equal(packet.bufferSpan().data(), packet.buffer(), "BufferSpan().data() doesn't match .buffer()"); + ok &= check(packet.bufferSpan().size() == Size, "BufferSpan().data() doesn't match .buffer()"); + + return ok; +} + +bool checkPingPacketView(const mip::PacketView& packet, const char* method) +{ + return checkPacketView(packet, microstrain::Span(PING), method); +} + +template +bool checkPingPacketBuf(mip::SizedPacketBuf& packet, const char* method) +{ + return checkPacketBuf(packet, microstrain::Span(PING), method); +} + + +void testPacketView() +{ + // + // Construction + // + + uint8_t buffer[mip::PACKET_LENGTH_MAX]; + + mip::PacketView packet1(buffer, sizeof(buffer), mip::commands_base::DESCRIPTOR_SET); + checkPacketView(packet1, buffer, "PacketView initializing constructor"); + check(packet1.isEmpty(), "Packet should be empty after packetView initializing constructor"); + check_equal(packet1.bufferSize(), sizeof(buffer), "Wrong buffer size from PacketView initializing constructor"); + check_equal(packet1.remainingSpace(), mip::C::MIP_PACKET_PAYLOAD_LENGTH_MAX, "remainingSpace wrong after PacketView initializing constructor"); + //bool ok = packet1.addField(mip::commands_base::Ping::FIELD_DESCRIPTOR, nullptr, 0); + //check(ok, "Failed to add field to packet1"); + //check_equal(packet1.remainingSpace(), mip::C::MIP_PACKET_PAYLOAD_LENGTH_MAX-2, "remainingSpace wrong after adding Ping command to packet1"); + //check_equal(packet1.bufferSize(), sizeof(buffer), "Wrong buffer size after adding Ping command to packet1"); + packet1.finalize(); + if(!check(packet1.isValid(), "Packet1 not valid after finalization")) + print_packet(packet1); + + mip::PacketView packet2(PING, sizeof(PING)); + checkPingPacketView(packet2, "PacketView existing constructor"); + + mip::C::mip_packet_view packet3c; + mip::C::mip_packet_from_buffer(&packet3c, PING, sizeof(PING)); + mip::PacketView packet3(packet3c); + checkPingPacketView(packet3, "PacketView C constructor"); + + mip::PacketView packet4(microstrain::Span(buffer), mip::commands_base::DESCRIPTOR_SET); + checkPacketView(packet4, buffer, "PacketView initializing constructor (span version)"); + + mip::PacketView packet5(microstrain::Span(PING, sizeof(PING))); + checkPingPacketView(packet5, "PacketView existing constructor (span version)"); + + +} + +void testPacketBuf() +{ + // + // Construction + // + + // Default constructor + mip::PacketBuf packet1; + check( !mip::isValidDescriptorSet(packet1.descriptorSet()), "PacketBuf should default-construct to invalid descriptor set"); + + // Specify descriptor set + mip::PacketBuf packet2(mip::data_sensor::DESCRIPTOR_SET); + check( packet2.descriptorSet() == mip::data_sensor::DESCRIPTOR_SET, "PacketBuf constructor with descriptor set doesn't work"); + + // Construct from raw buffer, span, or existing view. + mip::PacketBuf packet3(PING, sizeof(PING)); + mip::PacketBuf packet4(microstrain::Span(PING, sizeof(PING))); + mip::PacketBuf packet5(mip::PacketView(const_cast(PING), sizeof(PING))); + + checkPingPacketBuf(packet3, "PacketBuf raw buffer constructor"); + checkPingPacketBuf(packet4, "PacketBuf span constructor"); + checkPingPacketBuf(packet5, "PacketBuf PacketView constructor"); + + // Regular copy constructor + mip::PacketBuf packet6(packet5); + checkPingPacketBuf(packet6, "PacketBuf copy constructor"); + check(packet6.buffer() != packet5.buffer(), "Packet6 shouldn't point to packet5's data buffer from copy constructor"); + + // Construct from SizedPacketBuf of differing size + mip::SizedPacketBuf<8> packet7(packet5); + checkPingPacketView(packet7, "SizedPacketBuf<8> copy constructor"); + + // Construction from PacketView + mip::PacketBuf packet8(packet5.ref()); + checkPingPacketBuf(packet8, "PacketBuf copy constructor (PacketView)"); + check(packet8.buffer() != packet5.buffer(), "Packet6 shouldn't point to packet5's data buffer from copy constructor"); + + // Assignment + mip::PacketBuf packet9; + packet9 = packet5; + checkPingPacketBuf(packet9, "PacketBuf operator="); + check(packet9.buffer() != packet5.buffer(), "Packet9 shouldn't point to packet5's data buffer from operator="); + + // Create from field + mip::PacketBuf packet10(ACCEL_FIELD); + checkPacketBuf(packet10, ACCEL_PKT, "PacketBuf field constructor"); + + // .ref() already tested + // .buffer() already tested + // .bufferSpan() already tested + // .copyFrom tested by constructors + + // Test copying to destination + uint8_t tmp[sizeof(PING)]; + packet5.copyPacketTo(tmp); + check(std::memcmp(PING, tmp, sizeof(PING))==0, "Temporary buffer doesn't match after calling packet.copyPacketTo"); + + std::memset(tmp, 0x00, sizeof(tmp)); + packet5.copyPacketTo(microstrain::Span(tmp)); + check(std::memcmp(PING, tmp, sizeof(PING))==0, "Temporary buffer doesn't match after calling packet.copyPacketTo (span version)"); + +} + + +int main() +{ + testPacketView(); + testPacketBuf(); + + return num_errors; +} diff --git a/test/data/packet_example_cpp_check.txt b/test/data/packet_example_cpp_check.txt new file mode 100644 index 000000000..d64ecc668 --- /dev/null +++ b/test/data/packet_example_cpp_check.txt @@ -0,0 +1,48 @@ + +Create packet from scratch +Empty, un-finalized packet: desc_set=0x01 tot_len=6 pay_len=0 chk=invalid [756501000000] +Empty packet with checksum: desc_set=0x01 tot_len=6 pay_len=0 chk=valid [75650100DB05] +Unfinished packet with 2 fields: desc_set=0x01 tot_len=16 pay_len=10 chk=invalid [7565010A0201080901010001C2000000] + (01,01): payload=[] + (01,09): payload=[01010001C200] +Unfinished packet with 3 fields: desc_set=0x01 tot_len=24 pay_len=18 chk=invalid [756501120201080901010001C200080901010001C2000000] + (01,01): payload=[] + (01,09): payload=[01010001C200] + (01,09): payload=[01010001C200] +Finished packet with 4 fields: desc_set=0x01 tot_len=32 pay_len=26 chk=valid [7565011A0201080901010001C200080901010001C200080901010001C2007A91] + (01,01): payload=[] + (01,09): payload=[01010001C200] + (01,09): payload=[01010001C200] + (01,09): payload=[01010001C200] +Empty packet after reset: desc_set=0x0C tot_len=6 pay_len=0 chk=invalid [75650C000201] +3DM Message Format command: desc_set=0x0C tot_len=20 pay_len=14 chk=valid [75650C0E0E0F018003D5000A04000A05000A91CE] + (0C,0F): payload=[018003D5000A04000A05000A] +3DM Poll Data command: desc_set=0x0C tot_len=14 pay_len=8 chk=valid [75650C08080D008003D504056446] + (0C,0D): payload=[008003D50405] + +Create packet from buffer +Packet from buffer: desc_set=0x80 tot_len=82 pay_len=76 chk=valid [7565804C0AD5000000055EE67CC00AD6000000014E434A000E043D9EE88D387FDB00BF7AAF030E05BB0C1E30BB572E68BBAA24AE0E07BC8AAC80BC72C50EBCC4E2C10E083EEE3D9FBD66DADDC0AFDEF59196] + (80,D5): payload=[000000055EE67CC0] + (80,D6): payload=[000000014E434A00] + (80,04): payload=[3D9EE88D387FDB00BF7AAF03] + (80,05): payload=[BB0C1E30BB572E68BBAA24AE] + (80,07): payload=[BC8AAC80BC72C50EBCC4E2C1] + (80,08): payload=[3EEE3D9FBD66DADDC0AFDEF5] +Packet from span: desc_set=0x80 tot_len=82 pay_len=76 chk=valid [7565804C0AD5000000055EE67CC00AD6000000014E434A000E043D9EE88D387FDB00BF7AAF030E05BB0C1E30BB572E68BBAA24AE0E07BC8AAC80BC72C50EBCC4E2C10E083EEE3D9FBD66DADDC0AFDEF59196] + (80,D5): payload=[000000055EE67CC0] + (80,D6): payload=[000000014E434A00] + (80,04): payload=[3D9EE88D387FDB00BF7AAF03] + (80,05): payload=[BB0C1E30BB572E68BBAA24AE] + (80,07): payload=[BC8AAC80BC72C50EBCC4E2C1] + (80,08): payload=[3EEE3D9FBD66DADDC0AFDEF5] +Packet from C packet: desc_set=0x80 tot_len=82 pay_len=76 chk=valid [7565804C0AD5000000055EE67CC00AD6000000014E434A000E043D9EE88D387FDB00BF7AAF030E05BB0C1E30BB572E68BBAA24AE0E07BC8AAC80BC72C50EBCC4E2C10E083EEE3D9FBD66DADDC0AFDEF59196] + (80,D5): payload=[000000055EE67CC0] + (80,D6): payload=[000000014E434A00] + (80,04): payload=[3D9EE88D387FDB00BF7AAF03] + (80,05): payload=[BB0C1E30BB572E68BBAA24AE] + (80,07): payload=[BC8AAC80BC72C50EBCC4E2C1] + (80,08): payload=[3EEE3D9FBD66DADDC0AFDEF5] +Sensor Data packet: + Ref Time = 23067000000 + Scaled Accel = (0.077592, 0.000061, -0.979233) + Scaled Gyro = (-0.002138, -0.003283, -0.005192) diff --git a/test/test.c b/test/test.c new file mode 100644 index 000000000..2a3158411 --- /dev/null +++ b/test/test.c @@ -0,0 +1,56 @@ + +#include "test.h" + +#include +#include + + +unsigned int num_errors = 0; + +void print_buffer(FILE* file, const uint8_t* buffer, size_t length) +{ + for(unsigned int i=0; i +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +extern unsigned int num_errors; + +void print_buffer(FILE* file, const uint8_t* buffer, size_t length); + +bool check(bool value, const char* fmt, ...); +bool check_equal(int a, int b, const char* fmt, ...); + + +#ifdef __cplusplus +} // extern "C" + +void printT(FILE* file, int value) { fprintf(file, "%d", value); } +void printT(FILE* file, unsigned int value) { fprintf(file, "%u", value); } +void printT(FILE* file, size_t value) { fprintf(file, "%zu", value); } +void printT(FILE* file, const void* value) { fprintf(file, "%p", value); } + +template +bool check_equal(A a, B b, const char* fmt, ...) +{ + if( a == b ) + return true; + + va_list argptr; + va_start(argptr, fmt); + vfprintf(stderr, fmt, argptr); + va_end(argptr); + + fprintf(stderr, "( "); + printT(stderr, a); + fprintf(stderr, " != "); + printT(stderr, b); + fprintf(stderr, ")\n"); + + num_errors++; + return false; +} + +#endif diff --git a/test/test_serial.cpp b/test/test_serial.cpp index b01796417..ea806ec1e 100644 --- a/test/test_serial.cpp +++ b/test/test_serial.cpp @@ -1,7 +1,9 @@ -#include +#include +#include #include +#include int main(int argc, const char* argv[]) @@ -11,7 +13,7 @@ int main(int argc, const char* argv[]) if( argc == 1 ) { printf("Available serial ports:\n"); - std::vector ports = serial::list_ports(); + std::vector ports = serial::list_ports(); for(const serial::PortInfo& port : ports) {