
/**************INCLUDE BLOCK**************/


/***********INCLUDE BLOCK END*************/


/***** Data Type, Constant, and Macro Definitions *****/

/* Constant DATA */

#define Main_Button 0x1040
#define Authentication_RFid_Button 0x1041
#define Admin_Password_Button 0x1042
#define Admin_Menu_Button 0x1043
#define OCPP_Button 0x1044
#define Network_Button 0x1045
#define Protection_Button 0x1046
#define Gun_reading_Button 0x1047
#define Password_setting_Button 0x1048
#define RTC_Button 0x1049
#define select_charging_Button 0x104a
#define charging_setting_Button 0x104b
#define Billing_Button 0x104c
#define history_Button 0x104d
#define rfid_scan 0x104e
#define fwupgrade_Button 0x104f
#define production_Button 0x1050
///////////v4G changes//////////////
#define production_Button 0x1050
#define GSM_Button 0x1051
#define ethernet_button 0x1052
#define wifi_button 0x1053
#define congifmenu_button 0x1054

#define Home_Icon 0x1030
#define Ocpp_Icon 0x1031
#define Wifi_Icon 0x1032
#define Gun1_Icon 0x1033
#define Gun2_Icon 0x1034
#define Gun3_Icon 0x1035
#define OCPP_E_D_Icon 0x2FFF
#define cp_config 0x1055

/////////////v4G changes////////
#define GSM_E_D_Icon 0x24FF
#define ETHERNET_E_D_Icon 0x24FE
#define wifi_E_D_Icon 0x24FD
////////////////////////////////
/////////V4.x.6 changes///
#define ipv4sec_Icon 0x25FF
#define ipv6sec_Icon 0x25FE
#define ipv4v6sec_Icon 0x25FD
////////////////////////////////
//////////V4.1.0_changes///////
#define lclauthOffline_enable_icon 0x24FC
#define ENofflinetranstwithunknID_icon 0x24FB
#define preauthorization_icon 0x24FA
#define chargeravailable_icon 0x24F9
#define stopchargingInternetLoss_icon 0x24F8
#define firmwareVersion 0x24F1
/////////////////////////////
#define alarm_icon 0x1037
////////////////////////////////////
//V501change

/* enum struct parameters */

typedef enum
{
	welcome_screen=0,
	Main_screen,
	Authentication_screen,
	Admin_Password_screen =5,
	Admin_Menu_screen,
	OCPP_screen = 8,
	Network_screen,
	Protection_screen = 12,
	Gun_Reading_screen,
	Password_setting_screen,

	RTC_screen = 16,
	Select_Charging_Screen,
	Charging_Setting_screen,
	Billing_screen,
	History_screen,
	rfid_screen = 24,

	Authentication_screen_G2=31,
	Authentication_screen_G3,

	Gun_Reading_screen_G2=29,
	Gun_Reading_screen_G3,

	Select_Charging_Screen_G2=27,
	Select_Charging_Screen_G3,

	Billing_screen_G2=33,
	Billing_screen_G3,
	Firmware_upgrade_screen=35,
	production_screen= 37,
	////v4G changes////////
	network_select_screen,
	GSM_screen=40,
	ethernet_screen=42,
	wifi_screen=44,
	///////////////////////
	///////V4.1.0//////////
	configmenu_screen=46,
	//////////////////////
//V501change
	cpconfig_screen=48,
//V501change
	Back_screen = 71

}HMI_PAGE;
typedef enum
{
	Back = 1,
	Save,
	stop,
	enter,
	exit_b,
	clear,
	up = 7,
	down = 8,
	ocpp,
	Gun1,
	Gun2,
	Gun3,
	Automatic,
	Network_tb,
	Rfid_tb,
	Ocpp_tb,
	History_tb,
	Pricing_setting_tb,
	Protection_tb,
	Set_Password_tb,
	RTC_tb,
	Admin_page,
	Firmware_upgrade_tb,
	Firmware_upgrade,
	////v4G changes////////
	Ethernet_tb,
	Wifi_tb,
	GSM_tb,
	GSM_ENABLE,
	ethernet_enable,
	wifi_enable,
	////////////////////
	////v4.1.0 CHANGES////
	lclauthOffline_enable,
	ENofflinetranstwithunknID_enable,  	//allow offline transaction with unkown ID
	preauthorization_enable,
	chargeravailable_enable,
	stopchargingInternetLoss_enable,
	//////////////////////
	/////v4.x.6////changes here
	ipv4selen,
	ipv6selen,
	ipv4v6selen,
	///////////////////////
	///////////////////////
	alarmbutton //v5.0.0A
}HMI_Button;
typedef enum
{
	gun1_not_connect =54,
	gun1_charging,
	gun1_fault,

	gun2_not_connect,
	gun2_charging,
	gun2_fault,

	gun3_not_connect,
	gun3_charging,
	gun3_fault,

	gun1_connect,
	gun2_connect,
	gun3_connect

}GUN_Status;
typedef enum
{
	Rfid1_Add=3,
	Rfid1_Remove,
	Rfid2_Add,
	Rfid2_Remove,
	Rfid3_Add,
	Rfid3_Remove,
	Rfid4_Add,
	Rfid4_Remove,
	Rfid5_Add,
	Rfid5_Remove,
}RFID;
enum
{
	no_alarm = 0,
	activealarm,
	mutealarm,
}alarmstatus;

/* Global variables*/

char OCPP_setting;
unsigned char Rfid_Add;
volatile char admin, history, mode, start=0, back_1, enter_1, Touch_Action, Clear_Register, back_page;
char current_page;
char otp[7],write_para;
char otp_ocpp[30],HMI_Password[5]="1234",New_Password[5],Re_Password[5];
uint16_t HMI_Page,admin_setting;
char Main_Page,Authentic_Page,Admin_Pass_Page,Admin_Setting_Page,OCPP_Page,WI_fi_Page,Protection_Page,GUN_Page,history_page;
char network_select_page,gsm_page,ethernet_page,wifi_page;
char configmenu_page;
char next_page,action_otp=0,write_touch=0,change_page=0,back_button,admin_page,next_page_bill;
unsigned char etherip[10],ethersm[10],ethergw[10],ssid[20],wifi_pass[20],ocpp_uri[100],ocpp_status;
uint8_t year,month,date,hour,min,sec;
uint16_t charge_by_time,charging_unit,automatic_charging,Total_time,Total_unit,Total_cost;
char Password_setting_Page,Rtc_Page,charging_setting_Page,pricing_setting_Page,Bill_Page,Billing_done,Gun_parameter,rfid_page;
uint8_t page=1,gun_3,gun_2,gun_1,gun,gun_stop,gun_start,clear_rfid;
char fw_Page,production_page;
char cpconfigmenu_page;

/* Extern Data Declarations */

extern uint8_t ocpp_boot_status;
extern uint8_t incorrect_rfid,correct_rfid;
//extern uint8_t WIFI_Setting;
char WIFI_Setting;
extern uint8_t hmi[25];
//extern uint8_t Emergency_stop;
extern uint8_t update_variable,billing_gun;
extern char rtc_ocpp_flag;
extern uint32_t byte_in;
extern uint32_t byte_out;
extern uint8_t erage_chip;
extern char internal_rtc_read;
extern uint8_t RTC_OCPP[14];
volatile extern uint8_t HMI_wifi_connect,HMI_wifi_disconnect;
extern char websocket_success,HMI_websocket_connect,HMI_websocket_disconnect;

/* Static Data Declarations */

uint8_t MAX_hmi = 15;
unsigned int queue_data_hmi[15];
int REAR_hmi  = -1;
int FRONT_hmi = -1;
uint8_t READ_TOUCH[110]={0x5A, 0xA5, 0x04, 0x83, 0x10, 0x00, 0x01};
uint8_t WRITE_TOUCH[110]={0x5A, 0xA5, 0x05, 0x82, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0, 0, 0, 0, 0, 0};
char OTP_SUCCESS[19]={0x5A, 0xA5, 0x14, 0x82, 0x10, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
char SET_TOUCH[10]={0x5A, 0xA5, 0x07, 0x82, 0x00, 0x84, 0x5a, 0x01, 0x00, 0x00};
char PIC_NOW[7]={0x5A, 0xA5, 0x04, 0x83, 0x00, 0x14, 0x01};
char RTC_READ[14] = {0x5A, 0xA5, 0x04, 0x83, 0x00, 0x10, 0x04};

/***** Data Type, Constant, and Macro Definitions END *****/

/***** Public Function Bodies *****/

void HMI_data(void);
extern void Write_Params(void);
///V3.3.1////////////////////////added
void enQueue_hmi(unsigned int);
unsigned int deQueue_hmi(void);
char isEmpty_hmi(void);
void display_hmi(void);
char isFull_hmi(void);
void peek_hmi(void);
extern void modbus_check(void);
uint8_t History(uint16_t page);
extern void RTC_HMI(uint8_t year, uint8_t month, uint8_t day,uint8_t hour, uint8_t min, uint8_t sec);

/***** Public Function Bodies END *****/



