/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.9-dev */

#ifndef PB_LOTOHI_PB_H_INCLUDED
#define PB_LOTOHI_PB_H_INCLUDED
#include <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 _CpState {
    CpState_EVSE_STATE_A = 0,
    CpState_EVSE_STATE_B1 = 1,
    CpState_EVSE_STATE_B2 = 2,
    CpState_EVSE_STATE_C1 = 3,
    CpState_EVSE_STATE_C2 = 4,
    CpState_EVSE_STATE_D1 = 5,
    CpState_EVSE_STATE_D2 = 6,
    CpState_EVSE_STATE_E = 7,
    CpState_EVSE_STATE_F = 8
} CpState;

typedef enum _PpState {
    PpState_STATE_NC = 0,
    PpState_STATE_13A = 1,
    PpState_STATE_20A = 2,
    PpState_STATE_32A = 3,
    PpState_STATE_70A = 4,
    PpState_STATE_FAULT = 5
} PpState;

typedef enum _LockState {
    LockState_UNDEFINED = 0,
    LockState_UNLOCKED = 1,
    LockState_LOCKED = 2
} LockState;

/* Struct definitions */
typedef struct _ErrorFlags {
    bool diode_fault;
    bool rcd_selftest_failed;
    bool rcd_triggered;
    bool ventilation_not_available;
    bool connector_lock_failed;
    bool cp_signal_fault;
} ErrorFlags;

typedef struct _PowerMeter {
    uint32_t time_stamp;
    float vrmsL1;
    float vrmsL2;
    float vrmsL3;
    float irmsL1;
    float irmsL2;
    float irmsL3;
    float irmsN;
    float wattHrL1;
    float wattHrL2;
    float wattHrL3;
    float totalWattHr;
    float tempL1;
    float tempL2;
    float tempL3;
    float tempN;
    float wattL1;
    float wattL2;
    float wattL3;
    float freqL1;
    float freqL2;
    float freqL3;
    bool phaseSeqError;
} PowerMeter;

/* This container message is send from Lo To Hi and may contain any allowed message in that direction. */
typedef struct _LoToHi {
    pb_size_t which_payload;
    union {
        uint32_t time_stamp;
        bool relais_state; /* false: relais are off, true: relais are on */
        ErrorFlags error_flags;
        CpState cp_state;
        PpState pp_state;
        uint32_t max_charging_current;
        uint32_t max_grid_current;
        LockState lock_state;
        PowerMeter power_meter;
    } payload;
} LoToHi;


#ifdef __cplusplus
extern "C" {
#endif

/* Helper constants for enums */
#define _CpState_MIN CpState_EVSE_STATE_A
#define _CpState_MAX CpState_EVSE_STATE_F
#define _CpState_ARRAYSIZE ((CpState)(CpState_EVSE_STATE_F+1))

#define _PpState_MIN PpState_STATE_NC
#define _PpState_MAX PpState_STATE_FAULT
#define _PpState_ARRAYSIZE ((PpState)(PpState_STATE_FAULT+1))

#define _LockState_MIN LockState_UNDEFINED
#define _LockState_MAX LockState_LOCKED
#define _LockState_ARRAYSIZE ((LockState)(LockState_LOCKED+1))

#define LoToHi_payload_cp_state_ENUMTYPE CpState
#define LoToHi_payload_pp_state_ENUMTYPE PpState
#define LoToHi_payload_lock_state_ENUMTYPE LockState




/* Initializer values for message structs */
#define LoToHi_init_default                      {0, {0}}
#define ErrorFlags_init_default                  {0, 0, 0, 0, 0, 0}
#define PowerMeter_init_default                  {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
#define LoToHi_init_zero                         {0, {0}}
#define ErrorFlags_init_zero                     {0, 0, 0, 0, 0, 0}
#define PowerMeter_init_zero                     {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}

/* Field tags (for use in manual encoding/decoding) */
#define ErrorFlags_diode_fault_tag               1
#define ErrorFlags_rcd_selftest_failed_tag       2
#define ErrorFlags_rcd_triggered_tag             3
#define ErrorFlags_ventilation_not_available_tag 4
#define ErrorFlags_connector_lock_failed_tag     5
#define ErrorFlags_cp_signal_fault_tag           6
#define PowerMeter_time_stamp_tag                1
#define PowerMeter_vrmsL1_tag                    2
#define PowerMeter_vrmsL2_tag                    3
#define PowerMeter_vrmsL3_tag                    4
#define PowerMeter_irmsL1_tag                    5
#define PowerMeter_irmsL2_tag                    6
#define PowerMeter_irmsL3_tag                    7
#define PowerMeter_irmsN_tag                     8
#define PowerMeter_wattHrL1_tag                  9
#define PowerMeter_wattHrL2_tag                  10
#define PowerMeter_wattHrL3_tag                  11
#define PowerMeter_totalWattHr_tag               12
#define PowerMeter_tempL1_tag                    13
#define PowerMeter_tempL2_tag                    14
#define PowerMeter_tempL3_tag                    15
#define PowerMeter_tempN_tag                     16
#define PowerMeter_wattL1_tag                    17
#define PowerMeter_wattL2_tag                    18
#define PowerMeter_wattL3_tag                    19
#define PowerMeter_freqL1_tag                    20
#define PowerMeter_freqL2_tag                    21
#define PowerMeter_freqL3_tag                    22
#define PowerMeter_phaseSeqError_tag             23
#define LoToHi_time_stamp_tag                    1
#define LoToHi_relais_state_tag                  2
#define LoToHi_error_flags_tag                   3
#define LoToHi_cp_state_tag                      4
#define LoToHi_pp_state_tag                      5
#define LoToHi_max_charging_current_tag          6
#define LoToHi_max_grid_current_tag              7
#define LoToHi_lock_state_tag                    8
#define LoToHi_power_meter_tag                   9

/* Struct field encoding specification for nanopb */
#define LoToHi_FIELDLIST(X, a) \
X(a, STATIC,   ONEOF,    UINT32,   (payload,time_stamp,payload.time_stamp),   1) \
X(a, STATIC,   ONEOF,    BOOL,     (payload,relais_state,payload.relais_state),   2) \
X(a, STATIC,   ONEOF,    MESSAGE,  (payload,error_flags,payload.error_flags),   3) \
X(a, STATIC,   ONEOF,    UENUM,    (payload,cp_state,payload.cp_state),   4) \
X(a, STATIC,   ONEOF,    UENUM,    (payload,pp_state,payload.pp_state),   5) \
X(a, STATIC,   ONEOF,    UINT32,   (payload,max_charging_current,payload.max_charging_current),   6) \
X(a, STATIC,   ONEOF,    UINT32,   (payload,max_grid_current,payload.max_grid_current),   7) \
X(a, STATIC,   ONEOF,    UENUM,    (payload,lock_state,payload.lock_state),   8) \
X(a, STATIC,   ONEOF,    MESSAGE,  (payload,power_meter,payload.power_meter),   9)
#define LoToHi_CALLBACK NULL
#define LoToHi_DEFAULT NULL
#define LoToHi_payload_error_flags_MSGTYPE ErrorFlags
#define LoToHi_payload_power_meter_MSGTYPE PowerMeter

#define ErrorFlags_FIELDLIST(X, a) \
X(a, STATIC,   SINGULAR, BOOL,     diode_fault,       1) \
X(a, STATIC,   SINGULAR, BOOL,     rcd_selftest_failed,   2) \
X(a, STATIC,   SINGULAR, BOOL,     rcd_triggered,     3) \
X(a, STATIC,   SINGULAR, BOOL,     ventilation_not_available,   4) \
X(a, STATIC,   SINGULAR, BOOL,     connector_lock_failed,   5) \
X(a, STATIC,   SINGULAR, BOOL,     cp_signal_fault,   6)
#define ErrorFlags_CALLBACK NULL
#define ErrorFlags_DEFAULT NULL

#define PowerMeter_FIELDLIST(X, a) \
X(a, STATIC,   SINGULAR, UINT32,   time_stamp,        1) \
X(a, STATIC,   SINGULAR, FLOAT,    vrmsL1,            2) \
X(a, STATIC,   SINGULAR, FLOAT,    vrmsL2,            3) \
X(a, STATIC,   SINGULAR, FLOAT,    vrmsL3,            4) \
X(a, STATIC,   SINGULAR, FLOAT,    irmsL1,            5) \
X(a, STATIC,   SINGULAR, FLOAT,    irmsL2,            6) \
X(a, STATIC,   SINGULAR, FLOAT,    irmsL3,            7) \
X(a, STATIC,   SINGULAR, FLOAT,    irmsN,             8) \
X(a, STATIC,   SINGULAR, FLOAT,    wattHrL1,          9) \
X(a, STATIC,   SINGULAR, FLOAT,    wattHrL2,         10) \
X(a, STATIC,   SINGULAR, FLOAT,    wattHrL3,         11) \
X(a, STATIC,   SINGULAR, FLOAT,    totalWattHr,      12) \
X(a, STATIC,   SINGULAR, FLOAT,    tempL1,           13) \
X(a, STATIC,   SINGULAR, FLOAT,    tempL2,           14) \
X(a, STATIC,   SINGULAR, FLOAT,    tempL3,           15) \
X(a, STATIC,   SINGULAR, FLOAT,    tempN,            16) \
X(a, STATIC,   SINGULAR, FLOAT,    wattL1,           17) \
X(a, STATIC,   SINGULAR, FLOAT,    wattL2,           18) \
X(a, STATIC,   SINGULAR, FLOAT,    wattL3,           19) \
X(a, STATIC,   SINGULAR, FLOAT,    freqL1,           20) \
X(a, STATIC,   SINGULAR, FLOAT,    freqL2,           21) \
X(a, STATIC,   SINGULAR, FLOAT,    freqL3,           22) \
X(a, STATIC,   SINGULAR, BOOL,     phaseSeqError,    23)
#define PowerMeter_CALLBACK NULL
#define PowerMeter_DEFAULT NULL

extern const pb_msgdesc_t LoToHi_msg;
extern const pb_msgdesc_t ErrorFlags_msg;
extern const pb_msgdesc_t PowerMeter_msg;

/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
#define LoToHi_fields &LoToHi_msg
#define ErrorFlags_fields &ErrorFlags_msg
#define PowerMeter_fields &PowerMeter_msg

/* Maximum encoded size of messages (where known) */
#define ErrorFlags_size                          12
#define LOTOHI_PB_H_MAX_SIZE                     LoToHi_size
#define LoToHi_size                              123
#define PowerMeter_size                          121

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

#endif
