#ifndef APP_UART_PARSE_
#define APP_UART_PARSE_

#include "uart_dev.h"

/* 功能码 */
typedef enum {
   SL_Function_Code_Read_Register           =   0x30,   /* 读寄存器数据 */
   SL_Function_Code_Write_Register          =   0x10,   /* 写寄存器数据 */
   SL_Function_Code_Distribution_Profile    =   0xD0,   /* 配置文件下发 */
   SL_Function_Code_Read_Profile            =   0xD1,   /* 配置文件读取 */
}SL_MsgFunctionCode;

/* 寄存器地址 */
typedef enum {
    GW_Register_WorkCurrent         = 0x0000,
    GW_Register_WorkVoltage         = 0x0001,
    GW_Register_Temperature         = 0x0002,
    GW_Register_Port1_Power         = 0x0003,
    GW_Register_Port2_Power         = 0x0004,
    GW_Register_Port3_Power         = 0x0005,
    GW_Register_Port4_Power         = 0x0006,
    GW_Register_Port5_Power         = 0x0007,
    GW_Register_Port6_Power         = 0x0008,
    GW_Register_Port7_Power         = 0x0009,
    GW_Register_Port8_Power         = 0x000A,
    GW_Register_Port9_Power         = 0x000B,
}SL_GateWay_MsgRegister;

uint16_t checkModebusCrc(uint8_t *arr_buff, uint8_t len);
void upwardUartDataAnalysis(device_handle device);

#endif