/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.6 */

#ifndef PB_LO2HI_PB_H_INCLUDED
#define PB_LO2HI_PB_H_INCLUDED
#include <everest/3rd_party/nanopb/pb.h>

#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif

/* Enum definitions */
typedef enum _Event_InterfaceEvent { 
    Event_InterfaceEvent_A = 0, 
    Event_InterfaceEvent_B = 1, 
    Event_InterfaceEvent_C = 2, 
    Event_InterfaceEvent_D = 3, 
    Event_InterfaceEvent_E = 4, 
    Event_InterfaceEvent_F = 5, 
    Event_InterfaceEvent_EF = 6, 
    Event_InterfaceEvent_DISCONNECTED = 8, 
    Event_InterfaceEvent_ERROR_RELAIS = 9, 
    Event_InterfaceEvent_RELAIS_ON = 10, 
    Event_InterfaceEvent_RELAIS_OFF = 11 
} Event_InterfaceEvent;

/* Struct definitions */
typedef struct _ResetDone { 
    char dummy_field;
} ResetDone;

typedef struct _Event { 
    Event_InterfaceEvent type;
} Event;

typedef struct _KeepAliveLo { 
    uint32_t time_stamp;
    uint32_t hw_type;
    uint32_t hw_revision;
    uint32_t protocol_version_major;
    uint32_t protocol_version_minor;
    char sw_version_string[51];
    float hwcap_max_current;
    float hwcap_min_current;
    uint32_t hwcap_max_phase_count;
    uint32_t hwcap_min_phase_count;
    bool supports_changing_phases_during_charging;
} KeepAliveLo;

typedef struct _Measurements { 
    float pwmDutyCycle;
    float evse_pwm_voltage_hi;
    float evse_pwm_voltage_lo;
    bool evse_pwm_running;
    uint32_t relais_on;
} Measurements;

/* This container message is send from Lo Level to Hi level and may contain any allowed message in that direction. */
typedef struct _LoToHi { 
    pb_size_t which_payload;
    union {
        /* Common Packets */
        KeepAliveLo keep_alive;
        /* HIL packets */
        Measurements measurements;
        /* Packets only available in control_mode = 2 (low level control) */
        Event event;
        ResetDone reset_done;
    } payload;
} LoToHi;


/* Helper constants for enums */
#define _Event_InterfaceEvent_MIN Event_InterfaceEvent_A
#define _Event_InterfaceEvent_MAX Event_InterfaceEvent_RELAIS_OFF
#define _Event_InterfaceEvent_ARRAYSIZE ((Event_InterfaceEvent)(Event_InterfaceEvent_RELAIS_OFF+1))


#ifdef __cplusplus
extern "C" {
#endif

/* Initializer values for message structs */
#define LoToHi_init_default                      {0, {KeepAliveLo_init_default}}
#define Event_init_default                       {_Event_InterfaceEvent_MIN}
#define Measurements_init_default                {0, 0, 0, 0, 0}
#define KeepAliveLo_init_default                 {0, 0, 0, 0, 0, "", 0, 0, 0, 0, 0}
#define ResetDone_init_default                   {0}
#define LoToHi_init_zero                         {0, {KeepAliveLo_init_zero}}
#define Event_init_zero                          {_Event_InterfaceEvent_MIN}
#define Measurements_init_zero                   {0, 0, 0, 0, 0}
#define KeepAliveLo_init_zero                    {0, 0, 0, 0, 0, "", 0, 0, 0, 0, 0}
#define ResetDone_init_zero                      {0}

/* Field tags (for use in manual encoding/decoding) */
#define Event_type_tag                           1
#define KeepAliveLo_time_stamp_tag               1
#define KeepAliveLo_hw_type_tag                  2
#define KeepAliveLo_hw_revision_tag              3
#define KeepAliveLo_protocol_version_major_tag   4
#define KeepAliveLo_protocol_version_minor_tag   5
#define KeepAliveLo_sw_version_string_tag        6
#define KeepAliveLo_hwcap_max_current_tag        7
#define KeepAliveLo_hwcap_min_current_tag        8
#define KeepAliveLo_hwcap_max_phase_count_tag    9
#define KeepAliveLo_hwcap_min_phase_count_tag    10
#define KeepAliveLo_supports_changing_phases_during_charging_tag 11
#define Measurements_pwmDutyCycle_tag            1
#define Measurements_evse_pwm_voltage_hi_tag     2
#define Measurements_evse_pwm_voltage_lo_tag     3
#define Measurements_evse_pwm_running_tag        4
#define Measurements_relais_on_tag               5
#define LoToHi_keep_alive_tag                    3
#define LoToHi_measurements_tag                  5
#define LoToHi_event_tag                         6
#define LoToHi_reset_done_tag                    7

/* Struct field encoding specification for nanopb */
#define LoToHi_FIELDLIST(X, a) \
X(a, STATIC,   ONEOF,    MESSAGE,  (payload,keep_alive,payload.keep_alive),   3) \
X(a, STATIC,   ONEOF,    MESSAGE,  (payload,measurements,payload.measurements),   5) \
X(a, STATIC,   ONEOF,    MESSAGE,  (payload,event,payload.event),   6) \
X(a, STATIC,   ONEOF,    MESSAGE,  (payload,reset_done,payload.reset_done),   7)
#define LoToHi_CALLBACK NULL
#define LoToHi_DEFAULT NULL
#define LoToHi_payload_keep_alive_MSGTYPE KeepAliveLo
#define LoToHi_payload_measurements_MSGTYPE Measurements
#define LoToHi_payload_event_MSGTYPE Event
#define LoToHi_payload_reset_done_MSGTYPE ResetDone

#define Event_FIELDLIST(X, a) \
X(a, STATIC,   SINGULAR, UENUM,    type,              1)
#define Event_CALLBACK NULL
#define Event_DEFAULT NULL

#define Measurements_FIELDLIST(X, a) \
X(a, STATIC,   SINGULAR, FLOAT,    pwmDutyCycle,      1) \
X(a, STATIC,   SINGULAR, FLOAT,    evse_pwm_voltage_hi,   2) \
X(a, STATIC,   SINGULAR, FLOAT,    evse_pwm_voltage_lo,   3) \
X(a, STATIC,   SINGULAR, BOOL,     evse_pwm_running,   4) \
X(a, STATIC,   SINGULAR, UINT32,   relais_on,         5)
#define Measurements_CALLBACK NULL
#define Measurements_DEFAULT NULL

#define KeepAliveLo_FIELDLIST(X, a) \
X(a, STATIC,   SINGULAR, UINT32,   time_stamp,        1) \
X(a, STATIC,   SINGULAR, UINT32,   hw_type,           2) \
X(a, STATIC,   SINGULAR, UINT32,   hw_revision,       3) \
X(a, STATIC,   SINGULAR, UINT32,   protocol_version_major,   4) \
X(a, STATIC,   SINGULAR, UINT32,   protocol_version_minor,   5) \
X(a, STATIC,   SINGULAR, STRING,   sw_version_string,   6) \
X(a, STATIC,   SINGULAR, FLOAT,    hwcap_max_current,   7) \
X(a, STATIC,   SINGULAR, FLOAT,    hwcap_min_current,   8) \
X(a, STATIC,   SINGULAR, UINT32,   hwcap_max_phase_count,   9) \
X(a, STATIC,   SINGULAR, UINT32,   hwcap_min_phase_count,  10) \
X(a, STATIC,   SINGULAR, BOOL,     supports_changing_phases_during_charging,  11)
#define KeepAliveLo_CALLBACK NULL
#define KeepAliveLo_DEFAULT NULL

#define ResetDone_FIELDLIST(X, a) \

#define ResetDone_CALLBACK NULL
#define ResetDone_DEFAULT NULL

extern const pb_msgdesc_t LoToHi_msg;
extern const pb_msgdesc_t Event_msg;
extern const pb_msgdesc_t Measurements_msg;
extern const pb_msgdesc_t KeepAliveLo_msg;
extern const pb_msgdesc_t ResetDone_msg;

/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
#define LoToHi_fields &LoToHi_msg
#define Event_fields &Event_msg
#define Measurements_fields &Measurements_msg
#define KeepAliveLo_fields &KeepAliveLo_msg
#define ResetDone_fields &ResetDone_msg

/* Maximum encoded size of messages (where known) */
#define Event_size                               2
#define KeepAliveLo_size                         106
#define LoToHi_size                              108
#define Measurements_size                        23
#define ResetDone_size                           0

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif
