#ifndef __MX_UART_H
#define __MX_UART_H
#ifdef __cplusplus
 extern "C" {
#endif
//#include "uart.h"
#include <stdio.h>
#include <stdint.h>


//A27项目界面所需结构体
typedef struct
{
	uint16_t  ucYear;
	uint8_t   ucMonth;
    uint8_t   ucDate;
	uint8_t   ucHour;
	uint8_t   ucMinute;
    uint8_t   ucSecond;
}STime_t, *pSTime;

typedef struct
{
	uint8_t  mEngine;			//发动机故障
	uint8_t  mEngineOil;	    //机油报警
	uint8_t  mAbs;			    //abs防抱死
	uint8_t  mTcs;			    //tcs牵引力系统
	uint8_t  mFan;			    //风扇
	uint8_t  mNeutralGear;	    //空挡
	uint8_t  mWaterTemper;      //水温故障
	uint8_t  mBrakesFault;      //刹车故障
}ErrorCode_t, *pErrCode;

typedef struct
{
    uint8_t  mFactorySet;       //出厂设置
	uint8_t  mLanguage;			//语言
	uint8_t  mDisplayUint;		//单位
	uint8_t  mTheme;			//当前主题
	uint8_t  mThemeState;		//主题状态
	uint8_t  mLightValue;		//亮度
	uint8_t  mBT_OnOff;			//蓝牙
	uint8_t  mBT_State;			//状态
	uint8_t  mGearPos;			//档位
	uint16_t  mFuel;			//油量
	uint32_t  mTotalMile;		//里程数
}SaveData_t, *pSaveData;

typedef struct
{
    uint8_t   mSoftMainVersion;	       //主版本号
	uint8_t   mSoftSubVersion;	       //次版本号
	//uint8_t bt_name[BT_NAME_MAX_LEN];
	uint8_t   mSetMode;                //高字节 SET 1 为短按 2为长按  低字节 MODE 1 为短按 2为长按
	uint16_t  mSpeed;                  //速度信息
	uint8_t   mGearInfo;               //档位信息
	uint32_t  mTotalMile;              //总计里程
    uint32_t  mTripMile;               //单次行驶里程
    uint8_t   mMileClearTags;          //小计里程清零标志
	uint8_t   mWifi;				   //WIFI
	uint8_t   mBlueTooth;              //蓝牙
	uint8_t   mTurn;				   //转向 	0-无 1-左转 2-右转
	uint8_t   mTurnPrompt;			   //转向提示	0无 1左 2右
    uint8_t   mTurnLight;              //转向灯  0-无 1-左转向灯 2-右转向灯
    uint8_t   mBeamLight;              //灯光	0-无灯光 1-远光 2-近光 3-自动大灯
    uint8_t   mSideMarkerLight;        //示宽灯 0-无灯光 1-示宽灯
    uint8_t   mFanLight;               //风扇灯 0-无灯光 1-灯亮
    uint8_t   mABSLight;               //0-无灯光 1-灯亮
    uint8_t   mOilPressLight;          //机油压力报警灯 0-无灯光 1-灯亮
    uint8_t   mEngineLight;            //0-无灯光 1-灯亮
    uint8_t   mRefreshTags;            //0-无刷新 1-油量/水温/电池电压刷新标志

    uint8_t   mLightValue;             //灯光亮度,具体的light_value值
	uint8_t   mSelfCheck;	           //开机自检
	uint8_t   mLightSensingVolt;       //光感电压值 （暂定范围0-3300）

	char mUuid[32];
	char mBT_name[32];
	uint16_t  mCurrentFaultCode;		//当前故障码
	uint16_t  mHistoryFaultCode;		//历史故障码

	uint8_t   mBTData_Inherit;          //继承的蓝牙数据(保留)
	uint8_t   mTtrb;					//开机检测是否获取到时间的标志
	uint8_t   mTtrb_Time;				//设施时间后检测是否正常设置时间的标志
	uint8_t   mOdo_Reset;				//小计里程清零后检测是否正常设置时间的标志
	uint8_t   mDemo_Position;			//是否在demo展示界面的标志
	ErrorCode_t     mErr;               //告警错误
	SaveData_t  mSaveData;              //保存数据
	STime_t     mTime;                  //时间变量

	uint16_t  mPlan;		//总进度标志
	uint16_t  mPace;		//分进度标志
	uint8_t   mUpGrade;	    //内存拷贝标志

	//电摩专用属性
	uint8_t  mBatteryRatio;      //电池电量占比  1个字节（eg100% 传输64）
	uint8_t  mBatteryVoltage;    //电池电压 （eg3.3V 传输3300）

    //油摩专用属性
    uint16_t  mEspeed;            //转速信息
	uint8_t   mFuel;              //油量指示
	uint8_t   mWaterTemper;       //水温指示
	uint8_t   mAccumulatorVolt;   //电瓶电压

}Store_t, *pStore;

void Storeinit(Store_t* store);
void store_init(void);

Store_t *store_get(void);
void store_set(Store_t store);

ErrorCode_t *error_code_get(void);
void error_code_set(ErrorCode_t error);

#ifdef __cplusplus
}
#endif
#endif
