#ifndef NOVATEL_H /* prevent circular inclusions */
#define NOVATEL_H /* by using protection macros */

void novatel_task();

extern uint32_t utc_time;


#define PWRPAK_MSG_ID_TIME		101
#define PWRPAK_MSG_ID_INSPVAS	508

#pragma pack(push, 1)
typedef struct {
    uint32_t sync : 24;
    uint32_t hdr_length : 8;
    uint16_t msg_id;
    uint8_t  msg_type;
    uint8_t  port_addr;
    uint16_t msg_length;
    uint16_t sequence;
    uint8_t  idle_time;
    uint8_t  time_status;
    uint16_t week;
    uint32_t ms;
    uint32_t reciver_status;
    uint16_t reserved;
    uint16_t receiver_sw_version;
} NovatelLogHdrType;

typedef struct {
    uint32_t sync : 24;
    uint8_t  msg_length;
    uint16_t msg_id;
    uint16_t week;
    uint32_t ms;
} NovatelLogShortHdrType;

typedef struct {
	NovatelLogShortHdrType hdr;
    uint32_t ins_status;
    uint32_t pos_type;
    double   lla[3];
    float    undulation;
    double   vel_neu[3];
    double   att[3];
    float    sig_lla[3];
    float    sig_vel[3];
    float    sig_att[3];
    uint32_t ext_sol_status;
    uint16_t time_since_update;
    uint32_t crc;
} NovatelInspvaxType;

typedef struct {
	NovatelLogShortHdrType hdr;
    uint32_t week;
    double   seconds;
    double   lla[3];
    double   vel_neu[3];
    double   rpy[3];
    uint32_t status;
    uint32_t crc;
} NovatelInspvasType;

typedef struct {
	NovatelLogHdrType hdr;
    uint32_t clock_status;
    double   offset;
    double   offset_std_dev;
    double   utc_offset;
    uint32_t utc_year;
    uint8_t  utc_month;
    uint8_t  utc_day;
    uint8_t  utc_hour;
    uint8_t  utc_min;
    uint32_t utc_ms;
    uint32_t utc_status;
    uint32_t crc;
} NovatelTimeType;

#pragma pack(pop)

#endif /* end of protection macro */
