#pragma once

#include "myBase.h"


#define IEC_START 0x68
#define IEC_TAIL 0x16


enum
{
    ERR_FRAME = 0,
    I_FRAME,
    S_FRAME,
    U_FRAME,
};

// APCI帧结构
#pragma pack(1)
typedef struct
{
    uint8_t start;
    uint8_t len;
    uint8_t ctrl1;
    uint8_t ctrl2;
    uint8_t ctrl3;
    uint8_t ctrl4;
    uint8_t data[0];
}stru_iec104_apci;
#pragma pack()

// ASDU帧结构
#pragma pack(1)
typedef struct
{
    uint8_t ti;
    uint8_t vsq;
    uint16_t cot;
    uint16_t asdu_addr;
    uint8_t inf[3];
    uint8_t data[0];
}stru_iec104_asdu;
#pragma pack()

