/* VectorNav HSI Calibration Library v1.0.0.2
 *
 * Copyright (c) 2018 VectorNav Technologies, LLC
 *
 * This source code is proprietary to and copyrighted by VectorNav Technologies, LLC and is
 * available solely under license from VectorNav. All rights reserved. If you do not have a
 * license to use this source code from VectorNav, any use hereof is strictly prohibited by
 * U.S. law and other applicable law. This source code is restricted for use solely with the
 * products of VectorNav and as otherwise set forth in any agreement with VectorNav. Any
 * disclosure of this source code to the public or to any third party is also prohibited.
 */
#ifndef _VNSENSORS_H_
#define _VNSENSORS_H_

#include <stddef.h>
#include "vnenum.h"
#include "vnbool.h"
#include "vnupack.h"
#include "vnupackf.h"
#include "vnserialport.h"
#include "vnevent.h"
#include "vnmatrix.h"
#include "vnsensorregisters.h"

typedef void (*VnSensor_PacketFoundHandler)(void *userData, struct VnUartPacket *packet, size_t runningIndex);

#if defined(_MSC_VER)
  #pragma warning(push)
  #pragma warning(disable:4820)   /* Not concerned with tight data structure packing on Windows. */
#endif

/** \brief Helpful structure for working with VectorNav sensors. */
struct VnSensor
{
  struct VnSerialPort serialPort;
  enum VnErrorDetectionMode sendErrorDetectionMode; /**< Error detection mode to use for outgoing packets. */
  uint16_t responseTimeoutMs;                       /**< Timeout duration for waiting for a response from the sensor. */
  uint16_t retransmitDelayMs;                       /**< Delay between retransmitting commands. */
  struct VnCriticalSection transactionCS;
  struct VnEvent newResponsesEvent;
  bool waitingForResponse;                          /**< Indicates if the transaction function is waiting for a response. */
  bool responseWaitingForProcessing;                /**< Indicates if a response is waiting for processing by the transaction functions. */
  size_t runningDataIndex;
  struct VnUartPacketFinder packetFinder;
  VnSensor_PacketFoundHandler asyncPacketFoundHandler;
  void *asyncPacketFoundHandlerUserData;
  VnSensor_PacketFoundHandler errorMessageReceivedHandler;
  void *errorMessageReceivedHandlerUserData;
  size_t responseLength;
  char response[0x100];                             /**< Holds any received response from the sensor for processing in our transaction functions. */
};

#if defined(_MSC_VER)
  #pragma warning(pop)
#endif

#ifndef _cplusplus
typedef struct VnSensor VnSensor_t;
#endif

/**\brief Initializes a <c>VnSensor</c> structure.
 * \param[out] sensor The structure to initialize.
 * \return Any errors encountered. */
enum VnError
VnSensor_initialize(
    struct VnSensor *sensor);

/**\brief Initializes a <c>VnSensor</c> structure with the serial port provided.
 * \param[out] sensor The structure to initialize.
 * \param[in] serialPort Initialized <c>VnSerialPort</c> to use for communications. 
 * \return Any errors encountered. */
enum VnError
VnSensor_initialize_sp(
    struct VnSensor *sensor,
    struct VnSerialPort *serialPort);

/**\brief Connects to a VectorNav sensor.
 * \param[in] sensor The VnSensor structure.
 * \param[in] portName The name of the serial port to connect to.
 * \param[in] baudrate The baudrate to connect at.
 * \return Any errors encountered. */
enum VnError
VnSensor_connect(
    struct VnSensor *sensor,
    const char *portName,
    uint32_t baudrate);

/**\brief Disconnects from a VectorNav sensor.
 * \param[in] sensor The associated sensor.
 * \return Any errors encountered. */
enum VnError
VnSensor_disconnect(
    struct VnSensor *sensor);

/**\brief Issues a change baudrate to the VectorNav sensor and then reconnects
 *     the attached serial port at the new baudrate.
 * \param[in] sensor The VnSensor structure.
 * \param[in] baudrate The new sensor baudrate.
 * \return Any errors encountered. */
enum VnError
VnSensor_changeBaudrate(
    struct VnSensor *sensor,
    uint32_t baudrate);

/**\brief Changes the underlying serial port baudrate without issuing a sensor
 *     command.
 * \param[in] sensor The VnSensor structure.
 * \param[in] baudrate The new sensor baudrate.
 * \return Any errors encountered. */
enum VnError
VnSensor_changeBaudrate_noSensorCommand(
    struct VnSensor *sensor,
    uint32_t baudrate);

/**\brief Sends the provided command and returns the response from the sensor.
 *
 * If the command does not have an asterisk '*', the a checksum will be performed
 * and appended based on the current error detection mode. Also, if the line-ending
 * \\r\\n is not present, these will be added also.
 *
 * \param[in] sensor The associated VnSensor.
 * \param[in] toSend The command to send to the sensor.
 * \param[in] toSendLength The number of bytes provided in the toSend buffer.
 * \param[out] response The response received from the sensor.
 * \param[in,out] responseLength The size of the provided response buffer and will be
 *     set with the returned response length.
 * \return Any errors encountered. */
enum VnError
VnSensor_transaction(
    struct VnSensor *sensor,
    uint8_t *toSend,
    size_t toSendLength,
    uint8_t *response,
    size_t *responseLength);

/**\brief Indicates if the VnSensor is connected.
 *
 * \param[in] sensor The associated VnSensor.
 * \return <c>true</c> if the VnSensor is connected; otherwise <c>false</c>. */
bool
VnSensor_isConnected(
    struct VnSensor *sensor);

/**\brief Issues a Write Settings command to the VectorNav Sensor.
 * \param[in] sensor The associated VnSensor.
 * \param[in] waitForReply Indicates if the method should wait for a response
 *     from the sensor.
 * \return Any errors encountered. */
enum VnError
VnSensor_writeSettings(
    struct VnSensor *sensor,
    bool waitForReply);

/**\brief Issues a Restore Factory Settings command to the VectorNav sensor.
 * \param[in] sensor The associated VnSensor.
 * \param[in] waitForReply Indicates if the method should wait for a response
 *     from the sensor.
 * \return Any errors encountered. */
enum VnError
VnSensor_restoreFactorySettings(
    struct VnSensor *sensor,
    bool waitForReply);

/**\brief Issues a Reset command to the VectorNav sensor.
 * \param[in] sensor The associated VnSensor.
 * \param[in] waitForReply Indicates if the method should wait for a response
 *     from the sensor.
* \return Any errors encountered. */
enum VnError
VnSensor_reset(
    struct VnSensor *sensor,
    bool waitForReply);

/**\brief Issues a tare command to the VectorNav Sensor.
 * \param[in] sensor The associated VnSensor.
 * \param[in] waitForReply Indicates if the method should wait for a response
 *     from the sensor.
 * \return Any errors encountered. */
enum VnError
VnSensor_tare(
    struct VnSensor *sensor,
    bool waitForReply);

/**\brief Issues a command to the VectorNav Sensor to set the Gyro's bias.
 * \param[in] sensor The associated VnSensor.
 * \param[in] waitForReply Indicates if the method should wait for a response
 *     from the sensor.
 * \return Any errors encountered. */
enum VnError
VnSensor_setGyroBias(
    struct VnSensor *sensor,
    bool waitForReply);

/**\brief Command to inform the VectorNav Sensor if there is a magnetic disturbance present.
 * \param[in] sensor The associated VnSensor.
 * \param[in] disturbancePresent Indicates the presense of a disturbance.
 * \param[in] waitForReply Indicates if the method should wait for a response
 *     from the sensor.
 * \return Any errors encountered. */
enum VnError
VnSensor_magneticDisturbancePresent(
    struct VnSensor *sensor,
    bool disturbancePresent,
    bool waitForReply);

/**\brief Command to inform the VectorNav Sensor if there is an acceleration disturbance present.
 * \param[in] sensor The associated VnSensor.
 * \param[in] disturbancePresent Indicates the presense of a disturbance.
 * \param[in] waitForReply Indicates if the method should wait for a response
 *     from the sensor.
 * \return Any errors encountered. */
enum VnError
VnSensor_accelerationDisturbancePresent(
    struct VnSensor *sensor,
    bool disturbancePresent,
    bool waitForReply);

/**\brief Checks if we are able to send and receive communication with a sensor.
 * \param[in] sensor The associated sensor.
 * \return <c>true</c> if we can communicate with a sensor; otherwise <c>false</c>. */
bool
VnSensor_verifySensorConnectivity(
    struct VnSensor *sensor);

/**\brief Returns the current response timeout value in milliseconds used for
 *     communication with a sensor.
 *
 * The response timeout is used on commands that require a response to be
 * received from the sensor. If a response has not been received from the sensor
 * in the amount of time specified by this value, the called function will
 * return an E_TIMEOUT error.
 *
 * \param[in] sensor The associated VnSensor.
 * \return The current response timeout value in milliseconds. */
uint16_t
VnSensor_getResponseTimeoutMs(
    struct VnSensor *sensor);

/**\brief Sets the current response timeout value in milliseconds used for
 *     communication with a sensor.
 *
 * The response timeout is used on commands that require a response to be
 * received from the sensor. If a response has not been received from the sensor
 * in the amount of time specified by this value, the called function will
 * return an E_TIMEOUT error.
 *
 * \param[in] sensor The associated VnSensor.
 * \param[in] responseTimeoutMs The new value for the response timeout in milliseconds.
 * \return Any errors encountered. */
enum VnError
VnSensor_setResponseTimeoutMs(
    struct VnSensor *sensor,
    uint16_t reponseTimeoutMs);

/**\brief Gets the current retransmit delay used for communication with a sensor.
 *
 * During the time that the VnSensor is awaiting a response from a sensor, the
 * command will be retransmitted to the sensor at the interval specified by this
 * value.
 *
 * \param[in] sensor The associated VnSensor.
 * \return The current retransmit delay value in milliseconds. */
uint16_t
VnSensor_getRetransmitDelayMs(
    struct VnSensor *sensor);

/**\brief Sets the current retransmit delay used for communication with a sensor.
 *
 * During the time that the VnSensor is awaiting a response from a sensor, the
 * command will be retransmitted to the sensor at the interval specified by this
 * value.
 *
 * \param[in] sensor The associated VnSensor.
 * \param[in] retransmitDelayMs The new value for the retransmit delay in milliseconds.
 * \return Any errors encountered. */
enum VnError
VnSensor_setRetransmitDelayMs(
    struct VnSensor *sensor,
    uint16_t retransmitDelayMs);

/**\brief Allows registering a callback for notification of when an asynchronous data packet is received.
 *
 * \param[in] sensor The associated VnSensor.
 * \param[in] handler The callback handler.
 * \param[in] userData Data which will be provided with all callbacks.
 * \return Any errors encountered. */
enum VnError
VnSensor_registerAsyncPacketReceivedHandler(
    struct VnSensor *sensor,
    VnSensor_PacketFoundHandler handler,
    void *userData);

/**\brief Allows unregistering from callback notifications when asynchronous data packets are received.
 *
 * \param[in] sensor The associated sensor. */
enum VnError
VnSensor_unregisterAsyncPacketReceivedHandler(
    struct VnSensor *sensor);

/**\brief Allows registering a callback for notification of when a sensor error message is received.
 *
 * \param[in] sensor The associated VnSensor.
 * \param[in] handler The callback handler.
 * \param[in] userData Data which will be provided with all callbacks.
 * \return Any errors encountered. */
enum VnError
VnSensor_registerErrorPacketReceivedHandler(
    struct VnSensor *sensor,
    VnSensor_PacketFoundHandler handler,
    void *userData);

/**\brief Allows unregistering callbacks for notifications of when a sensor error message is recieved.
 *
 * \param[in] sensor The associated VnSensor.
 * \return Any errors encountered. */
enum VnError
VnSensor_unregisterErrorPacketReceivedHandler(
    struct VnSensor *sensor);

/**\defgroup registerAccessMethods Register Access Methods
 * \brief This group of methods provide access to read and write to the
 * sensor's registers.
 *
 * \{ */

/**\brief Reads the Binary Output 1 register.
 * \param[in] sensor The associated VnSensor.
 * \param[in] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readBinaryOutput1(
    struct VnSensor *sensor,
    struct VnBinaryOutputRegister *fields);

/**\brief Writes to the Binary Output 1 register.
 * \param[in] sensor The associated VnSensor.
 * \param[in] fields The register's fields.
 * \param[in] waitForReply Indicates if the method should wait for a response from the sensor.
 * \return Any errors encountered. */
enum VnError
VnSensor_writeBinaryOutput1(
    struct VnSensor *sensor,
    struct VnBinaryOutputRegister *fields,
    bool waitForReply);

/**\brief Reads the Binary Output 2 register.
 * \param[in] sensor The associated VnSensor.
 * \param[in] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readBinaryOutput2(
    struct VnSensor *sensor,
    struct VnBinaryOutputRegister *fields);

/**\brief Writes to the Binary Output 2 register.
 * \param[in] sensor The associated VnSensor.
 * \param[in] fields The register's fields.
 * \param[in] waitForReply Indicates if the method should wait for a response from the sensor.
 * \return Any errors encountered. */
enum VnError
VnSensor_writeBinaryOutput2(
    struct VnSensor *sensor,
    struct VnBinaryOutputRegister *fields,
    bool waitForReply);

/**\brief Reads the Binary Output 3 register.
 * \param[in] sensor The associated VnSensor.
 * \param[in] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readBinaryOutput3(
    struct VnSensor *sensor,
    struct VnBinaryOutputRegister *fields);

/**\brief Writes to the Binary Output 3 register.
 * \param[in] sensor The associated VnSensor.
 * \param[in] fields The register's fields.
 * \param[in] waitForReply Indicates if the method should wait for a response from the sensor.
 * \return Any errors encountered. */
enum VnError
VnSensor_writeBinaryOutput3(
    struct VnSensor *sensor,
    struct VnBinaryOutputRegister *fields,
    bool waitForReply);

/**\brief Reads the User Tag register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] tagBuffer Buffer to place the read register value.
 * \param[in] tagBufferLength Length of the provided buffer.
 * \return Any errors encountered. */
enum VnError
VnSensor_readUserTag(
    struct VnSensor *sensor,
    char *tagBuffer,
    size_t tagBufferLength);

/**\brief Writes to the User Tag register.
 * \param[in] sensor The associated VnSensor.
 * \param[in] tag The value to write to the register.
 * \param[in] waitForReply Set to <c>true</c> to wait for a response from the sensor; otherwise set to <c>false</c> to just immediately send the command and return.
 * \return Any errors encountered. */
enum VnError
VnSensor_writeUserTag(
    struct VnSensor *sensor,
    char* tag,
    bool waitForReply);

/**\brief Reads the Model Number register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] productNameBuffer Buffer to place the read register value.
 * \param[in] productNameBufferLength Length of the provided buffer.
 * \return Any errors encountered. */
enum VnError
VnSensor_readModelNumber(
    struct VnSensor *sensor,
    char *productNameBuffer,
    size_t productNameBufferLength);

/**\brief Reads the Hardware Revision register.
 * \param[in] sensor The associated VnSensor.
 * \return Any errors encountered. */
enum VnError
VnSensor_readHardwareRevision(
    struct VnSensor *sensor,
    uint32_t *revision);

/**\brief Reads the Serial Number register.
 * \param[in] sensor The associated VnSensor.
 * \return Any errors encountered. */
enum VnError
VnSensor_readSerialNumber(
    struct VnSensor *sensor,
    uint32_t *serialNum);

/**\brief Reads the Firmware Version register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] firmwareVersionBuffer Buffer to place the read register value.
 * \param[in] firmwareVersionBufferLength Length of the provided buffer.
 * \return Any errors encountered. */
enum VnError
VnSensor_readFirmwareVersion(
    struct VnSensor *sensor,
    char *firmwareVersionBuffer,
    size_t firmwareVersionBufferLength);

/**\brief Reads the Serial Baud Rate register.
 * \param[in] sensor The associated VnSensor.
 * \return Any errors encountered. */
enum VnError
VnSensor_readSerialBaudRate(
    struct VnSensor *sensor,
    uint32_t *baudrate);

/**\brief Writes to the Serial Baud Rate register.
 * \param[in] sensor The associated VnSensor.
 * \param[in] baudrate The value to write to the register.
 * \param[in] waitForReply Set to <c>true</c> to wait for a response from the sensor; otherwise set to <c>false</c> to just immediately send the command and return.
 * \return Any errors encountered. */
enum VnError
VnSensor_writeSerialBaudRate(
    struct VnSensor *sensor,
    uint32_t baudrate,
    bool waitForReply);

/**\brief Reads the Async Data Output Type register.
 * \param[in] sensor The associated VnSensor.
 * \return Any errors encountered. */
enum VnError
VnSensor_readAsyncDataOutputType(
    struct VnSensor *sensor,
    enum VnAsciiAsync *ador);

/**\brief Writes to the Async Data Output Type register.
 * \param[in] sensor The associated VnSensor.
 * \param[in] ador The value to write to the register.
 * \param[in] waitForReply Set to <c>true</c> to wait for a response from the sensor; otherwise set to <c>false</c> to just immediately send the command and return.
 * \return Any errors encountered. */
enum VnError
VnSensor_writeAsyncDataOutputType(
    struct VnSensor *sensor,
    enum VnAsciiAsync ador,
    bool waitForReply);

/**\brief Reads the Async Data Output Frequency register.
 * \param[in] sensor The associated VnSensor.
 * \return Any errors encountered. */
enum VnError
VnSensor_readAsyncDataOutputFrequency(
    struct VnSensor *sensor,
    uint32_t *adof);

/**\brief Writes to the Async Data Output Frequency register.
 * \param[in] sensor The associated VnSensor.
 * \param[in] adof The value to write to the register.
 * \param[in] waitForReply Set to <c>true</c> to wait for a response from the sensor; otherwise set to <c>false</c> to just immediately send the command and return.
 * \return Any errors encountered. */
enum VnError
VnSensor_writeAsyncDataOutputFrequency(
    struct VnSensor *sensor,
    uint32_t adof,
    bool waitForReply);

/**\brief Reads the Yaw Pitch Roll register.
 * \param[in] sensor The associated VnSensor.
 * \return Any errors encountered. */
enum VnError
VnSensor_readYawPitchRoll(
    struct VnSensor *sensor,
    union vn_vec3f *yawPitchRoll);

/**\brief Reads the Attitude Quaternion register.
 * \param[in] sensor The associated VnSensor.
 * \return Any errors encountered. */
enum VnError
VnSensor_readAttitudeQuaternion(
    struct VnSensor *sensor,
    union vn_vec4f *quat);

/**\brief Reads the Quaternion, Magnetic, Acceleration and Angular Rates register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readQuaternionMagneticAccelerationAndAngularRates(
    struct VnSensor *sensor,
    struct VnQuaternionMagneticAccelerationAndAngularRatesRegister *fields);

/**\brief Reads the Magnetic Measurements register.
 * \param[in] sensor The associated VnSensor.
 * \return Any errors encountered. */
enum VnError
VnSensor_readMagneticMeasurements(
    struct VnSensor *sensor,
    union vn_vec3f *mag);

/**\brief Reads the Acceleration Measurements register.
 * \param[in] sensor The associated VnSensor.
 * \return Any errors encountered. */
enum VnError
VnSensor_readAccelerationMeasurements(
    struct VnSensor *sensor,
    union vn_vec3f *accel);

/**\brief Reads the Angular Rate Measurements register.
 * \param[in] sensor The associated VnSensor.
 * \return Any errors encountered. */
enum VnError
VnSensor_readAngularRateMeasurements(
    struct VnSensor *sensor,
    union vn_vec3f *gyro);

/**\brief Reads the Magnetic, Acceleration and Angular Rates register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readMagneticAccelerationAndAngularRates(
    struct VnSensor *sensor,
    struct VnMagneticAccelerationAndAngularRatesRegister *fields);

/**\brief Reads the Magnetic and Gravity Reference Vectors register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readMagneticAndGravityReferenceVectors(
    struct VnSensor *sensor,
    struct VnMagneticAndGravityReferenceVectorsRegister *fields);

/**\brief Writes to the Magnetic and Gravity Reference Vectors register.
 * \param[in] sensor The associated VnSensor.
 * \param[in] fields The values to write to the register.
 * \param[in] waitForReply Set to <c>true</c> to wait for a response from the sensor; otherwise set to <c>false</c> to just immediately send the command and return.
 * \return Any errors encountered. */
enum VnError
VnSensor_writeMagneticAndGravityReferenceVectors(
    struct VnSensor *sensor,
    struct VnMagneticAndGravityReferenceVectorsRegister fields,
    bool waitForReply);

/**\brief Reads the Magnetometer Compensation register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readMagnetometerCompensation(
    struct VnSensor *sensor,
    struct VnMagnetometerCompensationRegister *fields);

/**\brief Writes to the Magnetometer Compensation register.
 * \param[in] sensor The associated VnSensor.
 * \param[in] fields The values to write to the register.
 * \param[in] waitForReply Set to <c>true</c> to wait for a response from the sensor; otherwise set to <c>false</c> to just immediately send the command and return.
 * \return Any errors encountered. */
enum VnError
VnSensor_writeMagnetometerCompensation(
    struct VnSensor *sensor,
    struct VnMagnetometerCompensationRegister fields,
    bool waitForReply);

/**\brief Reads the Acceleration Compensation register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readAccelerationCompensation(
    struct VnSensor *sensor,
    struct VnAccelerationCompensationRegister *fields);

/**\brief Writes to the Acceleration Compensation register.
 * \param[in] sensor The associated VnSensor.
 * \param[in] fields The values to write to the register.
 * \param[in] waitForReply Set to <c>true</c> to wait for a response from the sensor; otherwise set to <c>false</c> to just immediately send the command and return.
 * \return Any errors encountered. */
enum VnError
VnSensor_writeAccelerationCompensation(
    struct VnSensor *sensor,
    struct VnAccelerationCompensationRegister fields,
    bool waitForReply);

/**\brief Reads the Reference Frame Rotation register.
 * \param[in] sensor The associated VnSensor.
 * \return Any errors encountered. */
enum VnError
VnSensor_readReferenceFrameRotation(
    struct VnSensor *sensor,
    union vn_mat3f *c);

/**\brief Writes to the Reference Frame Rotation register.
 * \param[in] sensor The associated VnSensor.
 * \param[in] c The value to write to the register.
 * \param[in] waitForReply Set to <c>true</c> to wait for a response from the sensor; otherwise set to <c>false</c> to just immediately send the command and return.
 * \return Any errors encountered. */
enum VnError
VnSensor_writeReferenceFrameRotation(
    struct VnSensor *sensor,
    union vn_mat3f c,
    bool waitForReply);

/**\brief Reads the Yaw, Pitch, Roll, Magnetic, Acceleration and Angular Rates register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readYawPitchRollMagneticAccelerationAndAngularRates(
    struct VnSensor *sensor,
    struct VnYawPitchRollMagneticAccelerationAndAngularRatesRegister *fields);

/**\brief Reads the Communication Protocol Control register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readCommunicationProtocolControl(
    struct VnSensor *sensor,
    struct VnCommunicationProtocolControlRegister *fields);

/**\brief Writes to the Communication Protocol Control register.
 * \param[in] sensor The associated VnSensor.
 * \param[in] fields The values to write to the register.
 * \param[in] waitForReply Set to <c>true</c> to wait for a response from the sensor; otherwise set to <c>false</c> to just immediately send the command and return.
 * \return Any errors encountered. */
enum VnError
VnSensor_writeCommunicationProtocolControl(
    struct VnSensor *sensor,
    struct VnCommunicationProtocolControlRegister fields,
    bool waitForReply);

/**\brief Reads the Synchronization Control register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readSynchronizationControl(
    struct VnSensor *sensor,
    struct VnSynchronizationControlRegister *fields);

/**\brief Writes to the Synchronization Control register.
 * \param[in] sensor The associated VnSensor.
 * \param[in] fields The values to write to the register.
 * \param[in] waitForReply Set to <c>true</c> to wait for a response from the sensor; otherwise set to <c>false</c> to just immediately send the command and return.
 * \return Any errors encountered. */
enum VnError
VnSensor_writeSynchronizationControl(
    struct VnSensor *sensor,
    struct VnSynchronizationControlRegister fields,
    bool waitForReply);

/**\brief Reads the Synchronization Status register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readSynchronizationStatus(
    struct VnSensor *sensor,
    struct VnSynchronizationStatusRegister *fields);

/**\brief Writes to the Synchronization Status register.
 * \param[in] sensor The associated VnSensor.
 * \param[in] fields The values to write to the register.
 * \param[in] waitForReply Set to <c>true</c> to wait for a response from the sensor; otherwise set to <c>false</c> to just immediately send the command and return.
 * \return Any errors encountered. */
enum VnError
VnSensor_writeSynchronizationStatus(
    struct VnSensor *sensor,
    struct VnSynchronizationStatusRegister fields,
    bool waitForReply);

/**\brief Reads the VPE Basic Control register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readVpeBasicControl(
    struct VnSensor *sensor,
    struct VnVpeBasicControlRegister *fields);

/**\brief Writes to the VPE Basic Control register.
 * \param[in] sensor The associated VnSensor.
 * \param[in] fields The values to write to the register.
 * \param[in] waitForReply Set to <c>true</c> to wait for a response from the sensor; otherwise set to <c>false</c> to just immediately send the command and return.
 * \return Any errors encountered. */
enum VnError
VnSensor_writeVpeBasicControl(
    struct VnSensor *sensor,
    struct VnVpeBasicControlRegister fields,
    bool waitForReply);

/**\brief Reads the VPE Magnetometer Basic Tuning register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readVpeMagnetometerBasicTuning(
    struct VnSensor *sensor,
    struct VnVpeMagnetometerBasicTuningRegister *fields);

/**\brief Writes to the VPE Magnetometer Basic Tuning register.
 * \param[in] sensor The associated VnSensor.
 * \param[in] fields The values to write to the register.
 * \param[in] waitForReply Set to <c>true</c> to wait for a response from the sensor; otherwise set to <c>false</c> to just immediately send the command and return.
 * \return Any errors encountered. */
enum VnError
VnSensor_writeVpeMagnetometerBasicTuning(
    struct VnSensor *sensor,
    struct VnVpeMagnetometerBasicTuningRegister fields,
    bool waitForReply);

/**\brief Reads the VPE Accelerometer Basic Tuning register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readVpeAccelerometerBasicTuning(
    struct VnSensor *sensor,
    struct VnVpeAccelerometerBasicTuningRegister *fields);

/**\brief Writes to the VPE Accelerometer Basic Tuning register.
 * \param[in] sensor The associated VnSensor.
 * \param[in] fields The values to write to the register.
 * \param[in] waitForReply Set to <c>true</c> to wait for a response from the sensor; otherwise set to <c>false</c> to just immediately send the command and return.
 * \return Any errors encountered. */
enum VnError
VnSensor_writeVpeAccelerometerBasicTuning(
    struct VnSensor *sensor,
    struct VnVpeAccelerometerBasicTuningRegister fields,
    bool waitForReply);

/**\brief Reads the Magnetometer Calibration Control register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readMagnetometerCalibrationControl(
    struct VnSensor *sensor,
    struct VnMagnetometerCalibrationControlRegister *fields);

/**\brief Writes to the Magnetometer Calibration Control register.
 * \param[in] sensor The associated VnSensor.
 * \param[in] fields The values to write to the register.
 * \param[in] waitForReply Set to <c>true</c> to wait for a response from the sensor; otherwise set to <c>false</c> to just immediately send the command and return.
 * \return Any errors encountered. */
enum VnError
VnSensor_writeMagnetometerCalibrationControl(
    struct VnSensor *sensor,
    struct VnMagnetometerCalibrationControlRegister fields,
    bool waitForReply);

/**\brief Reads the Calculated Magnetometer Calibration register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readCalculatedMagnetometerCalibration(
    struct VnSensor *sensor,
    struct VnCalculatedMagnetometerCalibrationRegister *fields);

/**\brief Reads the Velocity Compensation Measurement register.
 * \param[in] sensor The associated VnSensor.
 * \return Any errors encountered. */
enum VnError
VnSensor_readVelocityCompensationMeasurement(
    struct VnSensor *sensor,
    union vn_vec3f *velocity);

/**\brief Writes to the Velocity Compensation Measurement register.
 * \param[in] sensor The associated VnSensor.
 * \param[in] velocity The value to write to the register.
 * \param[in] waitForReply Set to <c>true</c> to wait for a response from the sensor; otherwise set to <c>false</c> to just immediately send the command and return.
 * \return Any errors encountered. */
enum VnError
VnSensor_writeVelocityCompensationMeasurement(
    struct VnSensor *sensor,
    union vn_vec3f velocity,
    bool waitForReply);

/**\brief Reads the Velocity Compensation Control register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readVelocityCompensationControl(
    struct VnSensor *sensor,
    struct VnVelocityCompensationControlRegister *fields);

/**\brief Writes to the Velocity Compensation Control register.
 * \param[in] sensor The associated VnSensor.
 * \param[in] fields The values to write to the register.
 * \param[in] waitForReply Set to <c>true</c> to wait for a response from the sensor; otherwise set to <c>false</c> to just immediately send the command and return.
 * \return Any errors encountered. */
enum VnError
VnSensor_writeVelocityCompensationControl(
    struct VnSensor *sensor,
    struct VnVelocityCompensationControlRegister fields,
    bool waitForReply);

/**\brief Reads the IMU Measurements register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readImuMeasurements(
    struct VnSensor *sensor,
    struct VnImuMeasurementsRegister *fields);

/**\brief Reads the GPS Configuration register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readGpsConfiguration(
    struct VnSensor *sensor,
    struct VnGpsConfigurationRegister *fields);

/**\brief Writes to the GPS Configuration register.
 * \param[in] sensor The associated VnSensor.
 * \param[in] fields The values to write to the register.
 * \param[in] waitForReply Set to <c>true</c> to wait for a response from the sensor; otherwise set to <c>false</c> to just immediately send the command and return.
 * \return Any errors encountered. */
enum VnError
VnSensor_writeGpsConfiguration(
    struct VnSensor *sensor,
    struct VnGpsConfigurationRegister fields,
    bool waitForReply);

/**\brief Reads the GPS Antenna Offset register.
 * \param[in] sensor The associated VnSensor.
 * \return Any errors encountered. */
enum VnError
VnSensor_readGpsAntennaOffset(
    struct VnSensor *sensor,
    union vn_vec3f *position);

/**\brief Writes to the GPS Antenna Offset register.
 * \param[in] sensor The associated VnSensor.
 * \param[in] position The value to write to the register.
 * \param[in] waitForReply Set to <c>true</c> to wait for a response from the sensor; otherwise set to <c>false</c> to just immediately send the command and return.
 * \return Any errors encountered. */
enum VnError
VnSensor_writeGpsAntennaOffset(
    struct VnSensor *sensor,
    union vn_vec3f position,
    bool waitForReply);

/**\brief Reads the GPS Solution - LLA register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readGpsSolutionLla(
    struct VnSensor *sensor,
    struct VnGpsSolutionLlaRegister *fields);

/**\brief Reads the GPS Solution - ECEF register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readGpsSolutionEcef(
    struct VnSensor *sensor,
    struct VnGpsSolutionEcefRegister *fields);

/**\brief Reads the INS Solution - LLA register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readInsSolutionLla(
    struct VnSensor *sensor,
    struct VnInsSolutionLlaRegister *fields);

/**\brief Reads the INS Solution - ECEF register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readInsSolutionEcef(
    struct VnSensor *sensor,
    struct VnInsSolutionEcefRegister *fields);

/**\brief Reads the INS Basic Configuration register for a VN-200 sensor.
 * \param[in] sensor The associated VnSensor.
 * \param[out] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readInsBasicConfigurationVn200(
    struct VnSensor *sensor,
    struct VnInsBasicConfigurationRegisterVn200 *fields);

/**\brief Writes to the INS Basic Configuration register for a VN-200 sensor.
 * \param[in] sensor The associated VnSensor.
 * \param[in] fields The values to write to the register.
 * \param[in] waitForReply Set to <c>true</c> to wait for a response from the sensor; otherwise set to <c>false</c> to just immediately send the command and return.
 * \return Any errors encountered. */
enum VnError
VnSensor_writeInsBasicConfigurationVn200(
    struct VnSensor *sensor,
    struct VnInsBasicConfigurationRegisterVn200 fields,
    bool waitForReply);

/**\brief Reads the INS Basic Configuration register for a VN-300 sensor.
 * \param[in] sensor The associated VnSensor.
 * \param[out] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readInsBasicConfigurationVn300(
    struct VnSensor *sensor,
    struct VnInsBasicConfigurationRegisterVn300 *fields);

/**\brief Writes to the INS Basic Configuration register for a VN-300 sensor.
 * \param[in] sensor The associated VnSensor.
 * \param[in] fields The values to write to the register.
 * \param[in] waitForReply Set to <c>true</c> to wait for a response from the sensor; otherwise set to <c>false</c> to just immediately send the command and return.
 * \return Any errors encountered. */
enum VnError
VnSensor_writeInsBasicConfigurationVn300(
    struct VnSensor *sensor,
    struct VnInsBasicConfigurationRegisterVn300 fields,
    bool waitForReply);

/**\brief Reads the INS State - LLA register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readInsStateLla(
    struct VnSensor *sensor,
    struct VnInsStateLlaRegister *fields);

/**\brief Reads the INS State - ECEF register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readInsStateEcef(
    struct VnSensor *sensor,
    struct VnInsStateEcefRegister *fields);

/**\brief Reads the Startup Filter Bias Estimate register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readStartupFilterBiasEstimate(
    struct VnSensor *sensor,
    struct VnStartupFilterBiasEstimateRegister *fields);

/**\brief Writes to the Startup Filter Bias Estimate register.
 * \param[in] sensor The associated VnSensor.
 * \param[in] fields The values to write to the register.
 * \param[in] waitForReply Set to <c>true</c> to wait for a response from the sensor; otherwise set to <c>false</c> to just immediately send the command and return.
 * \return Any errors encountered. */
enum VnError
VnSensor_writeStartupFilterBiasEstimate(
    struct VnSensor *sensor,
    struct VnStartupFilterBiasEstimateRegister fields,
    bool waitForReply);

/**\brief Reads the Delta Theta and Delta Velocity register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readDeltaThetaAndDeltaVelocity(
    struct VnSensor *sensor,
    struct VnDeltaThetaAndDeltaVelocityRegister *fields);

/**\brief Reads the Delta Theta and Delta Velocity Configuration register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readDeltaThetaAndDeltaVelocityConfiguration(
    struct VnSensor *sensor,
    struct VnDeltaThetaAndDeltaVelocityConfigurationRegister *fields);

/**\brief Writes to the Delta Theta and Delta Velocity Configuration register.
 * \param[in] sensor The associated VnSensor.
 * \param[in] fields The values to write to the register.
 * \param[in] waitForReply Set to <c>true</c> to wait for a response from the sensor; otherwise set to <c>false</c> to just immediately send the command and return.
 * \return Any errors encountered. */
enum VnError
VnSensor_writeDeltaThetaAndDeltaVelocityConfiguration(
    struct VnSensor *sensor,
    struct VnDeltaThetaAndDeltaVelocityConfigurationRegister fields,
    bool waitForReply);

/**\brief Reads the Reference Vector Configuration register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readReferenceVectorConfiguration(
    struct VnSensor *sensor,
    struct VnReferenceVectorConfigurationRegister *fields);

/**\brief Writes to the Reference Vector Configuration register.
 * \param[in] sensor The associated VnSensor.
 * \param[in] fields The values to write to the register.
 * \param[in] waitForReply Set to <c>true</c> to wait for a response from the sensor; otherwise set to <c>false</c> to just immediately send the command and return.
 * \return Any errors encountered. */
enum VnError
VnSensor_writeReferenceVectorConfiguration(
    struct VnSensor *sensor,
    struct VnReferenceVectorConfigurationRegister fields,
    bool waitForReply);

/**\brief Reads the Gyro Compensation register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readGyroCompensation(
    struct VnSensor *sensor,
    struct VnGyroCompensationRegister *fields);

/**\brief Writes to the Gyro Compensation register.
 * \param[in] sensor The associated VnSensor.
 * \param[in] fields The values to write to the register.
 * \param[in] waitForReply Set to <c>true</c> to wait for a response from the sensor; otherwise set to <c>false</c> to just immediately send the command and return.
 * \return Any errors encountered. */
enum VnError
VnSensor_writeGyroCompensation(
    struct VnSensor *sensor,
    struct VnGyroCompensationRegister fields,
    bool waitForReply);

/**\brief Reads the IMU Filtering Configuration register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readImuFilteringConfiguration(
    struct VnSensor *sensor,
    struct VnImuFilteringConfigurationRegister *fields);

/**\brief Writes to the IMU Filtering Configuration register.
 * \param[in] sensor The associated VnSensor.
 * \param[in] fields The values to write to the register.
 * \param[in] waitForReply Set to <c>true</c> to wait for a response from the sensor; otherwise set to <c>false</c> to just immediately send the command and return.
 * \return Any errors encountered. */
enum VnError
VnSensor_writeImuFilteringConfiguration(
    struct VnSensor *sensor,
    struct VnImuFilteringConfigurationRegister fields,
    bool waitForReply);

/**\brief Reads the GPS Compass Baseline register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readGpsCompassBaseline(
    struct VnSensor *sensor,
    struct VnGpsCompassBaselineRegister *fields);

/**\brief Writes to the GPS Compass Baseline register.
 * \param[in] sensor The associated VnSensor.
 * \param[in] fields The values to write to the register.
 * \param[in] waitForReply Set to <c>true</c> to wait for a response from the sensor; otherwise set to <c>false</c> to just immediately send the command and return.
 * \return Any errors encountered. */
enum VnError
VnSensor_writeGpsCompassBaseline(
    struct VnSensor *sensor,
    struct VnGpsCompassBaselineRegister fields,
    bool waitForReply);

/**\brief Reads the GPS Compass Estimated Baseline register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readGpsCompassEstimatedBaseline(
    struct VnSensor *sensor,
    struct VnGpsCompassEstimatedBaselineRegister *fields);

/**\brief Reads the Yaw, Pitch, Roll, True Body Acceleration and Angular Rates register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readYawPitchRollTrueBodyAccelerationAndAngularRates(
    struct VnSensor *sensor,
    struct VnYawPitchRollTrueBodyAccelerationAndAngularRatesRegister *fields);

/**\brief Reads the Yaw, Pitch, Roll, True Inertial Acceleration and Angular Rates register.
 * \param[in] sensor The associated VnSensor.
 * \param[out] fields The register's values.
 * \return Any errors encountered. */
enum VnError
VnSensor_readYawPitchRollTrueInertialAccelerationAndAngularRates(
    struct VnSensor *sensor,
    struct VnYawPitchRollTrueInertialAccelerationAndAngularRatesRegister *fields);

/** \} */

/**\brief Converts a <c>SENSORERROR</c> to a string.
 * \param[out] out The char buffer to output the result to.
 * \param[in] outSize Size of the buffer <c>out</c>.
 * \param[in] v The <c>SENSORERROR</c> to convert.
 * \return Any errors encountered. */
enum VnError
to_string_SENSORERROR(
    char *out,
    size_t outSize,
    enum SENSORERROR val);

/**\brief Converts a <c>VnSyncInMode</c> to a string.
 * \param[out] out The char buffer to output the result to.
 * \param[in[ outSize Size of the buffer <c>out</c>.
 * \param[in] val The <c>VnSyncInMode</c> value to convert to string.
 * \return Any errors encountered. */
enum VnError
to_string_VnSyncInMode(
    char *out,
    size_t outSize,
    enum VnSyncInMode val);

/**\brief Converts a <c>VnSyncInEdge</c> to a string.
 * \param[out] out The char buffer to output the result to.
 * \param[in[ outSize Size of the buffer <c>out</c>.
 * \param[in] val The <c>VnSyncInEdge</c> value to convert to string.
 * \return Any errors encountered. */
enum VnError
to_string_VnSyncInEdge(
    char *out,
    size_t outSize,
    enum VnSyncInEdge val);

/**\brief Converts a <c>VnSyncOutMode</c> to a string.
 * \param[out] out The char buffer to output the result to.
 * \param[in[ outSize Size of the buffer <c>out</c>.
 * \param[in] val The <c>VnSyncOutMode</c> value to convert to string.
 * \return Any errors encountered. */
enum VnError
to_string_VnSyncOutMode(
    char *out,
    size_t outSize,
    enum VnSyncOutMode val);

/**\brief Converts a <c>VnSyncOutPolarity</c> to a string.
 * \param[out] out The char buffer to output the result to.
 * \param[in[ outSize Size of the buffer <c>out</c>.
 * \param[in] val The <c>VnSyncOutPolarity</c> value to convert to string.
 * \return Any errors encountered. */
enum VnError
to_string_VnSyncOutPolarity(
    char *out,
    size_t outSize,
    enum VnSyncOutPolarity val);

/**\brief Converts a <c>VnCountMode</c> to a string.
 * \param[out] out The char buffer to output the result to.
 * \param[in[ outSize Size of the buffer <c>out</c>.
 * \param[in] val The <c>VnCountMode</c> value to convert to string.
 * \return Any errors encountered. */
enum VnError
to_string_VnCountMode(
    char *out,
    size_t outSize,
    enum VnCountMode val);

/**\brief Converts a <c>VnStatusMode</c> to a string.
 * \param[out] out The char buffer to output the result to.
 * \param[in[ outSize Size of the buffer <c>out</c>.
 * \param[in] val The <c>VnStatusMode</c> value to convert to string.
 * \return Any errors encountered. */
enum VnError
to_string_VnStatusMode(
    char *out,
    size_t outSize,
    enum VnStatusMode val);

/**\brief Converts a <c>VnChecksumMode</c> to a string.
 * \param[out] out The char buffer to output the result to.
 * \param[in[ outSize Size of the buffer <c>out</c>.
 * \param[in] val The <c>VnChecksumMode</c> value to convert to string.
 * \return Any errors encountered. */
enum VnError
to_string_VnChecksumMode(
    char *out,
    size_t outSize,
    enum VnChecksumMode val);

/**\brief Converts a <c>VnErrorMode</c> to a string.
 * \param[out] out The char buffer to output the result to.
 * \param[in[ outSize Size of the buffer <c>out</c>.
 * \param[in] val The <c>VnErrorMode</c> value to convert to string.
 * \return Any errors encountered. */
enum VnError
to_string_VnErrorMode(
    char *out,
    size_t outSize,
    enum VnErrorMode val);

/**\brief Converts a <c>VnFilterMode</c> to a string.
 * \param[out] out The char buffer to output the result to.
 * \param[in[ outSize Size of the buffer <c>out</c>.
 * \param[in] val The <c>VnFilterMode</c> value to convert to string.
 * \return Any errors encountered. */
enum VnError
to_string_VnFilterMode(
    char *out,
    size_t outSize,
    enum VnFilterMode val);

/**\brief Converts a <c>VnIntegrationFrame</c> to a string.
 * \param[out] out The char buffer to output the result to.
 * \param[in[ outSize Size of the buffer <c>out</c>.
 * \param[in] val The <c>VnIntegrationFrame</c> value to convert to string.
 * \return Any errors encountered. */
enum VnError
to_string_VnIntegrationFrame(
    char *out,
    size_t outSize,
    enum VnIntegrationFrame val);

/**\brief Converts a <c>VnCompensationMode</c> to a string.
 * \param[out] out The char buffer to output the result to.
 * \param[in[ outSize Size of the buffer <c>out</c>.
 * \param[in] val The <c>VnCompensationMode</c> value to convert to string.
 * \return Any errors encountered. */
enum VnError
to_string_VnCompensationMode(
    char *out,
    size_t outSize,
    enum VnCompensationMode val);

/**\brief Converts a <c>VnGpsFix</c> to a string.
 * \param[out] out The char buffer to output the result to.
 * \param[in[ outSize Size of the buffer <c>out</c>.
 * \param[in] val The <c>VnGpsFix</c> value to convert to string.
 * \return Any errors encountered. */
enum VnError
to_string_VnGpsFix(
    char *out,
    size_t outSize,
    enum VnGpsFix val);

/**\brief Converts a <c>VnGpsMode</c> to a string.
 * \param[out] out The char buffer to output the result to.
 * \param[in[ outSize Size of the buffer <c>out</c>.
 * \param[in] val The <c>VnGpsMode</c> value to convert to string.
 * \return Any errors encountered. */
enum VnError
to_string_VnGpsMode(
    char *out,
    size_t outSize,
    enum VnGpsMode val);

/**\brief Converts a <c>VnPpsSource</c> to a string.
 * \param[out] out The char buffer to output the result to.
 * \param[in[ outSize Size of the buffer <c>out</c>.
 * \param[in] val The <c>VnPpsSource</c> value to convert to string.
 * \return Any errors encountered. */
enum VnError
to_string_VnPpsSource(
    char *out,
    size_t outSize,
    enum VnPpsSource val);

/**\brief Converts a <c>VnVpeEnable</c> to a string.
 * \param[out] out The char buffer to output the result to.
 * \param[in[ outSize Size of the buffer <c>out</c>.
 * \param[in] val The <c>VnVpeEnable</c> value to convert to string.
 * \return Any errors encountered. */
enum VnError
to_string_VnVpeEnable(
    char *out,
    size_t outSize,
    enum VnVpeEnable val);

/**\brief Converts a <c>VnHeadingMode</c> to a string.
 * \param[out] out The char buffer to output the result to.
 * \param[in[ outSize Size of the buffer <c>out</c>.
 * \param[in] val The <c>VnHeadingMode</c> value to convert to string.
 * \return Any errors encountered. */
enum VnError
to_string_VnHeadingMode(
    char *out,
    size_t outSize,
    enum VnHeadingMode val);

/**\brief Converts a <c>VnVpeMode</c> to a string.
 * \param[out] out The char buffer to output the result to.
 * \param[in[ outSize Size of the buffer <c>out</c>.
 * \param[in] val The <c>VnVpeMode</c> value to convert to string.
 * \return Any errors encountered. */
enum VnError
to_string_VnVpeMode(
    char *out,
    size_t outSize,
    enum VnVpeMode val);

/**\brief Converts a <c>VnScenario</c> to a string.
 * \param[out] out The char buffer to output the result to.
 * \param[in[ outSize Size of the buffer <c>out</c>.
 * \param[in] val The <c>VnScenario</c> value to convert to string.
 * \return Any errors encountered. */
enum VnError
to_string_VnScenario(
    char *out,
    size_t outSize,
    enum VnScenario val);

/**\brief Converts a <c>VnHsiMode</c> to a string.
 * \param[out] out The char buffer to output the result to.
 * \param[in[ outSize Size of the buffer <c>out</c>.
 * \param[in] val The <c>VnHsiMode</c> value to convert to string.
 * \return Any errors encountered. */
enum VnError
to_string_VnHsiMode(
    char *out,
    size_t outSize,
    enum VnHsiMode val);

/**\brief Converts a <c>VnHsiOutput</c> to a string.
 * \param[out] out The char buffer to output the result to.
 * \param[in[ outSize Size of the buffer <c>out</c>.
 * \param[in] val The <c>VnHsiOutput</c> value to convert to string.
 * \return Any errors encountered. */
enum VnError
to_string_VnHsiOutput(
    char *out,
    size_t outSize,
    enum VnHsiOutput val);

/**\brief Converts a <c>VnVelocityCompensationMode</c> to a string.
 * \param[out] out The char buffer to output the result to.
 * \param[in[ outSize Size of the buffer <c>out</c>.
 * \param[in] val The <c>VnVelocityCompensationMode</c> value to convert to string.
 * \return Any errors encountered. */
enum VnError
to_string_VnVelocityCompensationMode(
    char *out,
    size_t outSize,
    enum VnVelocityCompensationMode val);

/**\brief Converts a <c>VnMagneticMode</c> to a string.
 * \param[out] out The char buffer to output the result to.
 * \param[in[ outSize Size of the buffer <c>out</c>.
 * \param[in] val The <c>VnMagneticMode</c> value to convert to string.
 * \return Any errors encountered. */
enum VnError
to_string_VnMagneticMode(
    char *out,
    size_t outSize,
    enum VnMagneticMode val);

/**\brief Converts a <c>VnExternalSensorMode</c> to a string.
 * \param[out] out The char buffer to output the result to.
 * \param[in[ outSize Size of the buffer <c>out</c>.
 * \param[in] val The <c>VnExternalSensorMode</c> value to convert to string.
 * \return Any errors encountered. */
enum VnError
to_string_VnExternalSensorMode(
    char *out,
    size_t outSize,
    enum VnExternalSensorMode val);

/**\brief Converts a <c>VnFoamInit</c> to a string.
 * \param[out] out The char buffer to output the result to.
 * \param[in[ outSize Size of the buffer <c>out</c>.
 * \param[in] val The <c>VnFoamInit</c> value to convert to string.
 * \return Any errors encountered. */
enum VnError
to_string_VnFoamInit(
    char *out,
    size_t outSize,
    enum VnFoamInit val);

#ifdef __cplusplus
}
#endif

#endif
