/**
 * The MIT License (MIT)
 *
 * Copyright (c) 2018-2019 Erik Moqvist
 *
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use, copy,
 * modify, merge, publish, distribute, sublicense, and/or sell copies
 * of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

/**
 * This file was generated by cantools version 36.5.0 Sat Nov 13 00:14:30 2021.
 */

#ifndef ECARX_LOC_H
#define ECARX_LOC_H

#ifdef __cplusplus
extern "C" {
#endif

#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>

#ifndef EINVAL
#    define EINVAL 22
#endif

/* Frame ids. */
#define ECARX_LOC_LOCALIZATION_RESULT_STD_STS_FRAME_ID (0x402u)
#define ECARX_LOC_LOCALIZATION_RESULT_FRAME_ID (0x401u)
#define ECARX_LOC_LOCALIZATION_TIMESTAMP_FRAME_ID (0x400u)
#define ECARX_LOC_ASDM_CAN_FD2_TIME_SYNCH_FR_FRAME_ID (0x21u)

/* Frame lengths in bytes. */
#define ECARX_LOC_LOCALIZATION_RESULT_STD_STS_LENGTH (64u)
#define ECARX_LOC_LOCALIZATION_RESULT_LENGTH (64u)
#define ECARX_LOC_LOCALIZATION_TIMESTAMP_LENGTH (64u)
#define ECARX_LOC_ASDM_CAN_FD2_TIME_SYNCH_FR_LENGTH (8u)

/* Extended or standard frame types. */
#define ECARX_LOC_LOCALIZATION_RESULT_STD_STS_IS_EXTENDED (0)
#define ECARX_LOC_LOCALIZATION_RESULT_IS_EXTENDED (0)
#define ECARX_LOC_LOCALIZATION_TIMESTAMP_IS_EXTENDED (0)
#define ECARX_LOC_ASDM_CAN_FD2_TIME_SYNCH_FR_IS_EXTENDED (0)

/* Frame cycle times in milliseconds. */


/* Signal choices. */


/**
 * Signals in message localization_result_std_sts.
 *
 * All signal values are as on the CAN bus.
 */
struct ecarx_loc_localization_result_std_sts_t {
    /**
     * Range: -32768..32767 (-32.768..32.767 m/s^2)
     * Scale: 0.001
     * Offset: 0
     */
    int16_t localization_acceleration_std;

    /**
     * Range: -32768..32767 (-327.68..327.67 m)
     * Scale: 0.01
     * Offset: 0
     */
    int16_t localization_altitude_std;

    /**
     * 0 : initial SUCCESS
     * 1 : not start to initial;
     * 2 : initial FAILURE caused by gnss;
     * 3 : initial FAILURE caused by camera;
     * 4 : initial FAILURE caused by map-off;
     * 5 : unknown
     *
     * Range: 0..255 (0..255 -)
     * Scale: 1
     * Offset: 0
     */
    uint8_t localization_init_status;

    /**
     * 0 : stable;
     * 1 : unstable caused by camera;
     * 2 : unstable caused by gnss;
     * 3 : unstable caused by map-off;
     * 4 : unknown;
     *
     * Range: 0..255 (0..255 -)
     * Scale: 1
     * Offset: 0
     */
    uint8_t localization_status;

    /**
     * Range: -2147483648..2147483647 (-214.7483648..214.7483647 deg)
     * Scale: 1e-07
     * Offset: 0
     */
    int32_t localization_latitude_std;

    /**
     * Range: -2147483648..2147483647 (-214.7483648..214.7483647 deg)
     * Scale: 1e-07
     * Offset: 0
     */
    int32_t localization_longitude_std;

    /**
     * Range: -32768..32767 (-32.768..32.767 rad)
     * Scale: 0.001
     * Offset: 0
     */
    int16_t localization_pitch_std;

    /**
     * Range: -32768..32767 (-32.768..32.767 rad)
     * Scale: 0.001
     * Offset: 0
     */
    int16_t localization_roll_std;

    /**
     * 0 : initial SUCCESS
     * 1 : not start to initial;
     * 2 : initial FAILURE caused by gnss;
     * 3 : initial FAILURE caused by camera;
     * 4 : initial FAILURE caused by map-off;
     * 5 : unknown
     *
     * Range: 0..65535 (0..655.35 m/s)
     * Scale: 0.01
     * Offset: 0
     */
    uint16_t localization_velocity_std;

    /**
     * Range: -32768..32767 (-32.768..32.767 rad)
     * Scale: 0.001
     * Offset: 0
     */
    int16_t localization_yaw_std;
};

/**
 * Signals in message localization_result.
 *
 * All signal values are as on the CAN bus.
 */
struct ecarx_loc_localization_result_t {
    /**
     * Range: -32768..32767 (-32.768..32.767 m/s)
     * Scale: 0.001
     * Offset: 0
     */
    int16_t localization_acceleration;

    /**
     * Range: -2147483648..2147483647 (-2147483.648..2147483.647 m)
     * Scale: 0.001
     * Offset: 0
     */
    int32_t localization_altitude;

    /**
     * Range: 0..255 (0..2.55 -)
     * Scale: 0.01
     * Offset: 0
     */
    uint8_t localization_confidence;

    /**
     * Range: -140737488355328..140737488355327 (-1407374.88355328..1407374.88355327 deg)
     * Scale: 1e-08
     * Offset: 0
     */
    int64_t localization_latitude;

    /**
     * Range: -140737488355328..140737488355327 (-1407374.88355328..1407374.88355327 deg)
     * Scale: 1e-08
     * Offset: 0
     */
    int64_t localization_longitude;

    /**
     * Range: -32768..32767 (-32.768..32.767 rad)
     * Scale: 0.001
     * Offset: 0
     */
    int16_t localization_pitch;

    /**
     * Range: -32768..32767 (-32.768..32.767 rad)
     * Scale: 0.001
     * Offset: 0
     */
    int16_t localization_roll;

    /**
     * 0 : initial SUCCESS
     * 1 : not start to initial;
     * 2 : initial FAILURE caused by gnss;
     * 3 : initial FAILURE caused by camera;
     * 4 : initial FAILURE caused by map-off;
     * 5 : unknown
     *
     * Range: 0..65535 (0..655.35 m/s)
     * Scale: 0.01
     * Offset: 0
     */
    uint16_t localization_velocity;

    /**
     * Range: -32768..32767 (-32.768..32.767 rad)
     * Scale: 0.001
     * Offset: 0
     */
    int16_t localization_yaw;
};

/**
 * Signals in message localization_timestamp.
 *
 * All signal values are as on the CAN bus.
 */
struct ecarx_loc_localization_timestamp_t {
    /**
     * 0 : initial SUCCESS
     * 1 : not start to initial;
     * 2 : initial FAILURE caused by gnss;
     * 3 : initial FAILURE caused by camera;
     * 4 : initial FAILURE caused by map-off;
     * 5 : unknown
     *
     * Range: 0..18446744073709600000 (0..1.84467440737096E+17 s)
     * Scale: 0.01
     * Offset: 0
     */
    uint64_t localization_timestamp;
};

/**
 * Signals in message ASDMCanFD2TimeSynchFr.
 *
 * All signal values are as on the CAN bus.
 */
struct ecarx_loc_asdm_can_fd2_time_synch_fr_t {
    /**
     * Dummy signal in empty message.
     */
    uint8_t dummy;
};

/**
 * Pack message localization_result_std_sts.
 *
 * @param[out] dst_p Buffer to pack the message into.
 * @param[in] src_p Data to pack.
 * @param[in] size Size of dst_p.
 *
 * @return Size of packed data, or negative error code.
 */
int ecarx_loc_localization_result_std_sts_pack(
    uint8_t *dst_p,
    const struct ecarx_loc_localization_result_std_sts_t *src_p,
    size_t size);

/**
 * Unpack message localization_result_std_sts.
 *
 * @param[out] dst_p Object to unpack the message into.
 * @param[in] src_p Message to unpack.
 * @param[in] size Size of src_p.
 *
 * @return zero(0) or negative error code.
 */
int ecarx_loc_localization_result_std_sts_unpack(
    struct ecarx_loc_localization_result_std_sts_t *dst_p,
    const uint8_t *src_p,
    size_t size);

/**
 * Encode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to encode.
 *
 * @return Encoded signal.
 */
int16_t ecarx_loc_localization_result_std_sts_localization_acceleration_std_encode(double value);

/**
 * Decode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to decode.
 *
 * @return Decoded signal.
 */
double ecarx_loc_localization_result_std_sts_localization_acceleration_std_decode(int16_t value);

/**
 * Check that given signal is in allowed range.
 *
 * @param[in] value Signal to check.
 *
 * @return true if in range, false otherwise.
 */
bool ecarx_loc_localization_result_std_sts_localization_acceleration_std_is_in_range(int16_t value);

/**
 * Encode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to encode.
 *
 * @return Encoded signal.
 */
int16_t ecarx_loc_localization_result_std_sts_localization_altitude_std_encode(double value);

/**
 * Decode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to decode.
 *
 * @return Decoded signal.
 */
double ecarx_loc_localization_result_std_sts_localization_altitude_std_decode(int16_t value);

/**
 * Check that given signal is in allowed range.
 *
 * @param[in] value Signal to check.
 *
 * @return true if in range, false otherwise.
 */
bool ecarx_loc_localization_result_std_sts_localization_altitude_std_is_in_range(int16_t value);

/**
 * Encode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to encode.
 *
 * @return Encoded signal.
 */
uint8_t ecarx_loc_localization_result_std_sts_localization_init_status_encode(double value);

/**
 * Decode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to decode.
 *
 * @return Decoded signal.
 */
double ecarx_loc_localization_result_std_sts_localization_init_status_decode(uint8_t value);

/**
 * Check that given signal is in allowed range.
 *
 * @param[in] value Signal to check.
 *
 * @return true if in range, false otherwise.
 */
bool ecarx_loc_localization_result_std_sts_localization_init_status_is_in_range(uint8_t value);

/**
 * Encode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to encode.
 *
 * @return Encoded signal.
 */
uint8_t ecarx_loc_localization_result_std_sts_localization_status_encode(double value);

/**
 * Decode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to decode.
 *
 * @return Decoded signal.
 */
double ecarx_loc_localization_result_std_sts_localization_status_decode(uint8_t value);

/**
 * Check that given signal is in allowed range.
 *
 * @param[in] value Signal to check.
 *
 * @return true if in range, false otherwise.
 */
bool ecarx_loc_localization_result_std_sts_localization_status_is_in_range(uint8_t value);

/**
 * Encode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to encode.
 *
 * @return Encoded signal.
 */
int32_t ecarx_loc_localization_result_std_sts_localization_latitude_std_encode(double value);

/**
 * Decode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to decode.
 *
 * @return Decoded signal.
 */
double ecarx_loc_localization_result_std_sts_localization_latitude_std_decode(int32_t value);

/**
 * Check that given signal is in allowed range.
 *
 * @param[in] value Signal to check.
 *
 * @return true if in range, false otherwise.
 */
bool ecarx_loc_localization_result_std_sts_localization_latitude_std_is_in_range(int32_t value);

/**
 * Encode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to encode.
 *
 * @return Encoded signal.
 */
int32_t ecarx_loc_localization_result_std_sts_localization_longitude_std_encode(double value);

/**
 * Decode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to decode.
 *
 * @return Decoded signal.
 */
double ecarx_loc_localization_result_std_sts_localization_longitude_std_decode(int32_t value);

/**
 * Check that given signal is in allowed range.
 *
 * @param[in] value Signal to check.
 *
 * @return true if in range, false otherwise.
 */
bool ecarx_loc_localization_result_std_sts_localization_longitude_std_is_in_range(int32_t value);

/**
 * Encode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to encode.
 *
 * @return Encoded signal.
 */
int16_t ecarx_loc_localization_result_std_sts_localization_pitch_std_encode(double value);

/**
 * Decode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to decode.
 *
 * @return Decoded signal.
 */
double ecarx_loc_localization_result_std_sts_localization_pitch_std_decode(int16_t value);

/**
 * Check that given signal is in allowed range.
 *
 * @param[in] value Signal to check.
 *
 * @return true if in range, false otherwise.
 */
bool ecarx_loc_localization_result_std_sts_localization_pitch_std_is_in_range(int16_t value);

/**
 * Encode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to encode.
 *
 * @return Encoded signal.
 */
int16_t ecarx_loc_localization_result_std_sts_localization_roll_std_encode(double value);

/**
 * Decode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to decode.
 *
 * @return Decoded signal.
 */
double ecarx_loc_localization_result_std_sts_localization_roll_std_decode(int16_t value);

/**
 * Check that given signal is in allowed range.
 *
 * @param[in] value Signal to check.
 *
 * @return true if in range, false otherwise.
 */
bool ecarx_loc_localization_result_std_sts_localization_roll_std_is_in_range(int16_t value);

/**
 * Encode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to encode.
 *
 * @return Encoded signal.
 */
uint16_t ecarx_loc_localization_result_std_sts_localization_velocity_std_encode(double value);

/**
 * Decode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to decode.
 *
 * @return Decoded signal.
 */
double ecarx_loc_localization_result_std_sts_localization_velocity_std_decode(uint16_t value);

/**
 * Check that given signal is in allowed range.
 *
 * @param[in] value Signal to check.
 *
 * @return true if in range, false otherwise.
 */
bool ecarx_loc_localization_result_std_sts_localization_velocity_std_is_in_range(uint16_t value);

/**
 * Encode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to encode.
 *
 * @return Encoded signal.
 */
int16_t ecarx_loc_localization_result_std_sts_localization_yaw_std_encode(double value);

/**
 * Decode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to decode.
 *
 * @return Decoded signal.
 */
double ecarx_loc_localization_result_std_sts_localization_yaw_std_decode(int16_t value);

/**
 * Check that given signal is in allowed range.
 *
 * @param[in] value Signal to check.
 *
 * @return true if in range, false otherwise.
 */
bool ecarx_loc_localization_result_std_sts_localization_yaw_std_is_in_range(int16_t value);

/**
 * Pack message localization_result.
 *
 * @param[out] dst_p Buffer to pack the message into.
 * @param[in] src_p Data to pack.
 * @param[in] size Size of dst_p.
 *
 * @return Size of packed data, or negative error code.
 */
int ecarx_loc_localization_result_pack(
    uint8_t *dst_p,
    const struct ecarx_loc_localization_result_t *src_p,
    size_t size);

/**
 * Unpack message localization_result.
 *
 * @param[out] dst_p Object to unpack the message into.
 * @param[in] src_p Message to unpack.
 * @param[in] size Size of src_p.
 *
 * @return zero(0) or negative error code.
 */
int ecarx_loc_localization_result_unpack(
    struct ecarx_loc_localization_result_t *dst_p,
    const uint8_t *src_p,
    size_t size);

/**
 * Encode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to encode.
 *
 * @return Encoded signal.
 */
int16_t ecarx_loc_localization_result_localization_acceleration_encode(double value);

/**
 * Decode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to decode.
 *
 * @return Decoded signal.
 */
double ecarx_loc_localization_result_localization_acceleration_decode(int16_t value);

/**
 * Check that given signal is in allowed range.
 *
 * @param[in] value Signal to check.
 *
 * @return true if in range, false otherwise.
 */
bool ecarx_loc_localization_result_localization_acceleration_is_in_range(int16_t value);

/**
 * Encode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to encode.
 *
 * @return Encoded signal.
 */
int32_t ecarx_loc_localization_result_localization_altitude_encode(double value);

/**
 * Decode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to decode.
 *
 * @return Decoded signal.
 */
double ecarx_loc_localization_result_localization_altitude_decode(int32_t value);

/**
 * Check that given signal is in allowed range.
 *
 * @param[in] value Signal to check.
 *
 * @return true if in range, false otherwise.
 */
bool ecarx_loc_localization_result_localization_altitude_is_in_range(int32_t value);

/**
 * Encode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to encode.
 *
 * @return Encoded signal.
 */
uint8_t ecarx_loc_localization_result_localization_confidence_encode(double value);

/**
 * Decode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to decode.
 *
 * @return Decoded signal.
 */
double ecarx_loc_localization_result_localization_confidence_decode(uint8_t value);

/**
 * Check that given signal is in allowed range.
 *
 * @param[in] value Signal to check.
 *
 * @return true if in range, false otherwise.
 */
bool ecarx_loc_localization_result_localization_confidence_is_in_range(uint8_t value);

/**
 * Encode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to encode.
 *
 * @return Encoded signal.
 */
int64_t ecarx_loc_localization_result_localization_latitude_encode(double value);

/**
 * Decode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to decode.
 *
 * @return Decoded signal.
 */
double ecarx_loc_localization_result_localization_latitude_decode(int64_t value);

/**
 * Check that given signal is in allowed range.
 *
 * @param[in] value Signal to check.
 *
 * @return true if in range, false otherwise.
 */
bool ecarx_loc_localization_result_localization_latitude_is_in_range(int64_t value);

/**
 * Encode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to encode.
 *
 * @return Encoded signal.
 */
int64_t ecarx_loc_localization_result_localization_longitude_encode(double value);

/**
 * Decode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to decode.
 *
 * @return Decoded signal.
 */
double ecarx_loc_localization_result_localization_longitude_decode(int64_t value);

/**
 * Check that given signal is in allowed range.
 *
 * @param[in] value Signal to check.
 *
 * @return true if in range, false otherwise.
 */
bool ecarx_loc_localization_result_localization_longitude_is_in_range(int64_t value);

/**
 * Encode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to encode.
 *
 * @return Encoded signal.
 */
int16_t ecarx_loc_localization_result_localization_pitch_encode(double value);

/**
 * Decode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to decode.
 *
 * @return Decoded signal.
 */
double ecarx_loc_localization_result_localization_pitch_decode(int16_t value);

/**
 * Check that given signal is in allowed range.
 *
 * @param[in] value Signal to check.
 *
 * @return true if in range, false otherwise.
 */
bool ecarx_loc_localization_result_localization_pitch_is_in_range(int16_t value);

/**
 * Encode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to encode.
 *
 * @return Encoded signal.
 */
int16_t ecarx_loc_localization_result_localization_roll_encode(double value);

/**
 * Decode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to decode.
 *
 * @return Decoded signal.
 */
double ecarx_loc_localization_result_localization_roll_decode(int16_t value);

/**
 * Check that given signal is in allowed range.
 *
 * @param[in] value Signal to check.
 *
 * @return true if in range, false otherwise.
 */
bool ecarx_loc_localization_result_localization_roll_is_in_range(int16_t value);

/**
 * Encode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to encode.
 *
 * @return Encoded signal.
 */
uint16_t ecarx_loc_localization_result_localization_velocity_encode(double value);

/**
 * Decode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to decode.
 *
 * @return Decoded signal.
 */
double ecarx_loc_localization_result_localization_velocity_decode(uint16_t value);

/**
 * Check that given signal is in allowed range.
 *
 * @param[in] value Signal to check.
 *
 * @return true if in range, false otherwise.
 */
bool ecarx_loc_localization_result_localization_velocity_is_in_range(uint16_t value);

/**
 * Encode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to encode.
 *
 * @return Encoded signal.
 */
int16_t ecarx_loc_localization_result_localization_yaw_encode(double value);

/**
 * Decode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to decode.
 *
 * @return Decoded signal.
 */
double ecarx_loc_localization_result_localization_yaw_decode(int16_t value);

/**
 * Check that given signal is in allowed range.
 *
 * @param[in] value Signal to check.
 *
 * @return true if in range, false otherwise.
 */
bool ecarx_loc_localization_result_localization_yaw_is_in_range(int16_t value);

/**
 * Pack message localization_timestamp.
 *
 * @param[out] dst_p Buffer to pack the message into.
 * @param[in] src_p Data to pack.
 * @param[in] size Size of dst_p.
 *
 * @return Size of packed data, or negative error code.
 */
int ecarx_loc_localization_timestamp_pack(
    uint8_t *dst_p,
    const struct ecarx_loc_localization_timestamp_t *src_p,
    size_t size);

/**
 * Unpack message localization_timestamp.
 *
 * @param[out] dst_p Object to unpack the message into.
 * @param[in] src_p Message to unpack.
 * @param[in] size Size of src_p.
 *
 * @return zero(0) or negative error code.
 */
int ecarx_loc_localization_timestamp_unpack(
    struct ecarx_loc_localization_timestamp_t *dst_p,
    const uint8_t *src_p,
    size_t size);

/**
 * Encode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to encode.
 *
 * @return Encoded signal.
 */
uint64_t ecarx_loc_localization_timestamp_localization_timestamp_encode(double value);

/**
 * Decode given signal by applying scaling and offset.
 *
 * @param[in] value Signal to decode.
 *
 * @return Decoded signal.
 */
double ecarx_loc_localization_timestamp_localization_timestamp_decode(uint64_t value);

/**
 * Check that given signal is in allowed range.
 *
 * @param[in] value Signal to check.
 *
 * @return true if in range, false otherwise.
 */
bool ecarx_loc_localization_timestamp_localization_timestamp_is_in_range(uint64_t value);

#ifdef __cplusplus
}
#endif

#endif
