Pārlūkot izejas kodu

2022-10-03 / Simon Xue [DD360UCar]

Action:
1. [Modify] Remove Charging Fee item in UI.

Files
As the following commit history files

Image Version: V2.10.XX.XXXX.XX
Simon Xue 2 gadi atpakaļ
vecāks
revīzija
024a56ae13

+ 3 - 3
EVSE/Projects/DD360UCar/Apps/CSU/main.c

@@ -82,8 +82,8 @@ uint8_t bd0_2_status = 0;
 uint8_t bd1_1_status = 0;
 uint8_t bd1_2_status = 0;
 
-char *fwVersion = "V2.09.00.0000.00"; // Phihong version
-char* DebugVersion = "V2.09.02";      // Software debug version
+char *fwVersion = "V2.10.00.0000.00"; // Phihong version
+char* DebugVersion = "V2.10.00";      // Software debug version
 //sqlite3 *localDb;
 bool isDb_ready;
 
@@ -4357,7 +4357,7 @@ CheckStatus:
 
                 if (ShmPsuData->SystemPresentPsuQuantity > 0 &&
                         ShmPsuData->SystemAvailablePower > 10 &&
-                        GetTimeoutValue(pDcChargingInfo->ConnectorTimeout) >= 1000000) {
+                        GetTimeoutValue(pDcChargingInfo->ConnectorTimeout) >= 3000000) {
                     setChargerMode(gunIndex, MODE_PREPARE_FOR_EV);
                 }
 

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 452 - 452
EVSE/Projects/DD360UCar/Apps/Define/define.h


+ 4 - 1
EVSE/Projects/DD360UCar/Apps/ModuleChkSysTask/Module_ChkSysTask.c

@@ -24,6 +24,7 @@ struct ChargingInfoData *pAcChargingInfo = NULL;
 static struct ChargingInfoData *pDcChargingInfo = NULL;
 struct SysConfigAndInfo         *ShmSysConfigAndInfo;
 struct StatusCodeData           *ShmStatusCodeData;
+static DcCommonInfo* ShmDcCommonData = NULL;
 
 bool Taskconutstring(char *src, char *taskname)
 {
@@ -232,6 +233,8 @@ void main(void)
     ShmSysConfigAndInfo = (struct SysConfigAndInfo *)GetShmSysConfigAndInfo();
     ShmStatusCodeData = (struct StatusCodeData *)GetShmStatusCodeData();
 	ShmOCPP16Data = (struct OCPP16Data*)GetShmOCPP16Data();
+	ShmDcCommonData = (DcCommonInfo*)GetShmDcCommonData();
+
     MappingGunChargingInfo("CheckSystem Task");
 
 	ShmOCPP16Data->CsMsg.bits[0].ChangeAvailabilityReq = YES;
@@ -240,7 +243,7 @@ void main(void)
     {
       	for (uint8_t gun = 0; gun < pSysConfig->TotalConnectorCount; gun++) {
     		pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(gun);
-			if (pDcChargingInfo->SystemStatus == SYS_MODE_UPDATE )
+			if (pDcChargingInfo->SystemStatus == SYS_MODE_UPDATE || ShmDcCommonData->DebugFlag)
 				continue;
 		}
 		CheckSystemTaskAlive();

+ 4 - 3
EVSE/Projects/DD360UCar/Apps/ModuleLcmCtrl/Module_LcmControl.c

@@ -1031,14 +1031,15 @@ void ShowSummaryPage()
     pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(pSysInfo->CurGunSelected);
 
     // Show Money
-    if (ShmDcCommonData->pGunInfo[pSysInfo->CurGunSelected].finalcost_flag) {
+    if (ShmDcCommonData->pGunInfo[pSysInfo->CurGunSelected].finalcost_flag &&
+        ShmSelectGunInfo->PricesInfo[pSysInfo->CurGunSelected].RemainAmount > 0) {
         ShowSummaryMoney(_Summary_total_money, (int)ShmSelectGunInfo->PricesInfo[pSysInfo->CurGunSelected].RemainAmount);
-        ShowSummaryMoney(_Summary_cal_Total_money, (int)pDcChargingInfo->ChargingFee);
+        //ShowSummaryMoney(_Summary_cal_Total_money, (int)pDcChargingInfo->ChargingFee);
         ShowSummaryMoney(_Summary_cal_discount, (int)ShmSelectGunInfo->PricesInfo[pSysInfo->CurGunSelected].Discount);
     } else {
         // 未收到Final cost
         ShowSummaryMoneyDash(_Summary_total_money);
-        ShowSummaryMoneyDash(_Summary_cal_Total_money);
+        //ShowSummaryMoneyDash(_Summary_cal_Total_money);
         ShowSummaryMoneyDash(_Summary_cal_discount);
     }
     /*

+ 759 - 447
EVSE/Projects/DD360UCar/Apps/Module_LcmControl_Wistron/LcmCommandDriver.c

@@ -1,447 +1,759 @@
-/*
- * LcmCommandDriver.c
- *
- *  Created on: 2022/3/31
- *      Author: folus
- */
-
-#include "Module_LcmControl_Wistron.h"
-
-/**
- *
- * @param mosq
- * @param topic
- * @param outputStr
- * @return
- */
-int publish_data(struct mosquitto *mosq, char *topic, char *outputStr)
-{
-	int result;
-
-	result = mosquitto_publish(mosq, NULL, topic, strlen(outputStr), outputStr, QOS_ENSURE_BROKER, RETAIN_NO);
-
-	if(result != MOSQ_ERR_SUCCESS)DEBUG_ERROR("Publish %s error publishing: %s\n", topic, mosquitto_strerror(result));
-
-	return (result != MOSQ_ERR_SUCCESS)?FAIL:PASS;
-}
-
-/**
- *
- * @param mosq
- */
-int publish_profile(struct mosquitto *mosq, char *parameter, char *value)
-{
-	json_object *payload = json_object_new_object();
-	char outputStr[2048]={0};
-
-	json_object_object_add(payload, parameter, json_object_new_string(value));
-
-	sprintf(outputStr, "%s", json_object_to_json_string_ext(payload, JSON_C_TO_STRING_PLAIN));
-	json_object_put(payload);
-
-	return publish_data(mosq, "client/profile", outputStr);
-}
-
-/**
- *
- * @param mosq
- */
-int publish_upgrade(struct mosquitto *mosq, char *otaType, char *url, char *checksum, char *verInfo)
-{
-	json_object *payload = json_object_new_object();
-	char outputStr[2048]={0};
-
-	json_object_object_add(payload, "task_name", json_object_new_string(otaType));
-
-	if((strstr(otaType, OTA_TYPE_APK) != NULL) || (strstr(otaType, OTA_TYPE_UI) != NULL))
-		json_object_object_add(payload, "ftp server", json_object_new_string(url));
-
-	if(strstr(otaType, OTA_TYPE_UI) != NULL)
-	{
-		json_object_object_add(payload, "file_checksum", json_object_new_string(checksum));
-		json_object_object_add(payload, "version_info", json_object_new_string(verInfo));
-	}
-
-	sprintf(outputStr, "%s", json_object_to_json_string_ext(payload, JSON_C_TO_STRING_PLAIN));
-	json_object_put(payload);
-
-	return publish_data(mosq, "client/command", outputStr);
-}
-
-/**
- *
- * @param mosq
- */
-int publish_restart(struct mosquitto *mosq, uint8_t isHardReset)
-{
-	json_object *payload = json_object_new_object();
-	char outputStr[2048]={0};
-
-	json_object_object_add(payload, "task_name", json_object_new_string(isHardReset?"restart":"reset"));
-
-	sprintf(outputStr, "%s", json_object_to_json_string_ext(payload, JSON_C_TO_STRING_PLAIN));
-	json_object_put(payload);
-
-	return publish_data(mosq, "client/command", outputStr);
-}
-
-/**
- *
- * @param mosq
- */
-int publish_power_saving(struct mosquitto *mosq, uint8_t isSleep)
-{
-	if(isSleep)
-	{
-		json_object *payload = json_object_new_object();
-		char outputStr[2048]={0};
-
-		json_object_object_add(payload, "task_name", json_object_new_string("power_saving"));
-		json_object_object_add(payload, "mode", json_object_new_string(isSleep?"1":"0"));
-
-		sprintf(outputStr, "%s", json_object_to_json_string_ext(payload, JSON_C_TO_STRING_PLAIN));
-		json_object_put(payload);
-
-		return publish_data(mosq, "client/command", outputStr);
-	}
-	else
-	{
-		char cmd[64];
-		sprintf(cmd, "/usr/sbin/ether-wake -i eth0 %s", clientInfo.macAddr);
-		system(cmd);
-
-		return PASS;
-	}
-}
-
-/**
- *
- * @param mosq
- */
-int publish_back_dimming(struct mosquitto *mosq, uint8_t lightLevel)
-{
-	json_object *payload = json_object_new_object();
-	char outputStr[2048]={0};
-	char buf[8];
-
-	json_object_object_add(payload, "task_name", json_object_new_string("backlight"));
-
-	sprintf(buf, "%d", lightLevel);
-	json_object_object_add(payload, "brightness", json_object_new_string(buf));
-
-	sprintf(outputStr, "%s", json_object_to_json_string_ext(payload, JSON_C_TO_STRING_PLAIN));
-	json_object_put(payload);
-
-	return publish_data(mosq, "client/command", outputStr);
-}
-
-/**
- *
- * @param mosq
- */
-int publish_audio_volume(struct mosquitto *mosq, uint8_t volume)
-{
-	json_object *payload = json_object_new_object();
-	char outputStr[2048]={0};
-	char buf[8];
-
-	json_object_object_add(payload, "task_name", json_object_new_string("audio_volume"));
-
-	sprintf(buf, "%d", volume);
-	json_object_object_add(payload, "volume", json_object_new_string(buf));
-
-	sprintf(outputStr, "%s", json_object_to_json_string_ext(payload, JSON_C_TO_STRING_PLAIN));
-	json_object_put(payload);
-
-	return publish_data(mosq, "client/command", outputStr);
-}
-
-/**
- *
- * @param mosq
- */
-int publish_trigger_report_status(struct mosquitto *mosq)
-{
-	json_object *payload = json_object_new_object();
-	char outputStr[2048]={0};
-
-	json_object_object_add(payload, "task_name", json_object_new_string("report_status"));
-
-	sprintf(outputStr, "%s", json_object_to_json_string_ext(payload, JSON_C_TO_STRING_PLAIN));
-	json_object_put(payload);
-
-	return publish_data(mosq, "client/command", outputStr);
-}
-
-/**
- *
- * @param mosq
- */
-int publish_timesync(struct mosquitto *mosq)
-{
-	char outputStr[64]={0};
-	time_t CurrentTime;
-	struct tm *tm;
-	struct timeval tv;
-
-	CurrentTime = time(NULL);
-	tm=localtime(&CurrentTime);
-	gettimeofday(&tv, NULL); // get microseconds, 10^-6
-
-	sprintf(outputStr,"%04d-%02d-%02dT%02d:%02d:%02d+00:00", tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec);
-
-	return publish_data(mosq, "client/timesync", outputStr);
-}
-
-/**
- *
- * @param mosq
- */
-int publish_textview_add(struct mosquitto *mosq, Text_List *textList, uint8_t listCount)
-{
-	json_object *payload = json_object_new_array();
-	char outputStr[2048]={0};
-
-	for(int idx=0;idx<listCount;idx++)
-	{
-		json_object *textview = json_object_new_object();
-		char buf[32];
-
-		sprintf(buf, "%d", textList[idx].textviewIndex);
-		json_object_object_add(textview, "textviewIndex", json_object_new_string(buf));
-
-		json_object_object_add(textview, "textString", json_object_new_string(textList[idx].textString));
-		json_object_object_add(textview, "textFont", json_object_new_string(textList[idx].textFont));
-		json_object_object_add(textview, "textStyle", json_object_new_string(textList[idx].textStyle));
-
-		sprintf(buf, "%d", textList[idx].textSize);
-		json_object_object_add(textview, "textSize", json_object_new_string(buf));
-		sprintf(buf, "%d", textList[idx].layout_x);
-		json_object_object_add(textview, "layout_x", json_object_new_string(buf));
-		sprintf(buf, "%d", textList[idx].layout_y);
-		json_object_object_add(textview, "layout_y", json_object_new_string(buf));
-
-		json_object_array_add(payload, textview);
-	}
-
-	sprintf(outputStr, "%s", json_object_to_json_string_ext(payload, JSON_C_TO_STRING_PLAIN));
-	json_object_put(payload);
-
-	return publish_data(mosq, "client/layout/textview", outputStr);
-}
-
-/**
- *
- * @param mosq
- */
-int publish_imageview_add(struct mosquitto *mosq, Image_List *imageList, uint8_t listCount)
-{
-	json_object *payload = json_object_new_array();
-	char outputStr[2048]={0};
-
-	for(int idx=0;idx<listCount;idx++)
-	{
-		json_object *imageview = json_object_new_object();
-		char buf[32];
-
-		sprintf(buf, "%d", imageList[idx].imageviewIndex);
-		json_object_object_add(imageview, "imageviewIndex", json_object_new_string(buf));
-
-		sprintf(buf, "%d", imageList[idx].imgsrc_addr);
-		json_object_object_add(imageview, "imgsrc_addr", json_object_new_string(buf));
-
-		sprintf(buf, "%d", imageList[idx].layout_x);
-		json_object_object_add(imageview, "layout_x", json_object_new_string(buf));
-
-		sprintf(buf, "%d", imageList[idx].layout_y);
-		json_object_object_add(imageview, "layout_y", json_object_new_string(buf));
-
-		sprintf(buf, "%d", imageList[idx].width);
-		json_object_object_add(imageview, "width", json_object_new_string(buf));
-
-		sprintf(buf, "%d", imageList[idx].height);
-		json_object_object_add(imageview, "height", json_object_new_string(buf));
-
-		json_object_array_add(payload, imageview);
-	}
-
-	sprintf(outputStr, "%s", json_object_to_json_string_ext(payload, JSON_C_TO_STRING_PLAIN));
-	json_object_put(payload);
-
-	return publish_data(mosq, "client/layout/imageview", outputStr);
-}
-
-/**
- *
- * @param mosq
- */
-int publish_videoview_add(struct mosquitto *mosq, Video_List *videoList, uint8_t listCount)
-{
-	json_object *payload = json_object_new_array();
-	char outputStr[2048]={0};
-
-	for(int idx=0;idx<listCount;idx++)
-	{
-		json_object *imageview = json_object_new_object();
-		char buf[32];
-
-		sprintf(buf, "%d", videoList[idx].videoviewIndex);
-		json_object_object_add(imageview, "videoviewIndex", json_object_new_string(buf));
-
-		sprintf(buf, "%d", videoList[idx].videosrc_addr);
-		json_object_object_add(imageview, "videoSrc_addr", json_object_new_string(buf));
-
-		sprintf(buf, "%d", videoList[idx].layout_x);
-		json_object_object_add(imageview, "layout_x", json_object_new_string(buf));
-
-		sprintf(buf, "%d", videoList[idx].layout_y);
-		json_object_object_add(imageview, "layout_y", json_object_new_string(buf));
-
-		sprintf(buf, "%d", videoList[idx].width);
-		json_object_object_add(imageview, "width", json_object_new_string(buf));
-
-		sprintf(buf, "%d", videoList[idx].height);
-		json_object_object_add(imageview, "height", json_object_new_string(buf));
-
-		json_object_array_add(payload, imageview);
-	}
-
-	sprintf(outputStr, "%s", json_object_to_json_string_ext(payload, JSON_C_TO_STRING_PLAIN));
-	json_object_put(payload);
-
-	return publish_data(mosq, "client/layout/videoview", outputStr);
-}
-
-/**
- *
- * @param mosq
- */
-int publish_qrcodeimage_add(struct mosquitto *mosq, QrCode_List *qrCodeList, uint8_t listCount)
-{
-	json_object *payload = json_object_new_array();
-	char outputStr[2048]={0};
-
-	for(int idx=0;idx<listCount;idx++)
-	{
-		json_object *qrcodeImage = json_object_new_object();
-		char buf[32];
-
-		sprintf(buf, "%d", qrCodeList[idx].qrCodeIndex);
-		json_object_object_add(qrcodeImage, "qrCodeIndex", json_object_new_string(buf));
-
-		sprintf(buf, "%s", qrCodeList[idx].qrCodeContent);
-		json_object_object_add(qrcodeImage, "qrCodeContent", json_object_new_string(buf));
-
-		sprintf(buf, "%s", qrCodeList[idx].errorCorrection);
-		json_object_object_add(qrcodeImage, "errorCorrection", json_object_new_string(buf));
-
-		sprintf(buf, "%d", qrCodeList[idx].layout_x);
-		json_object_object_add(qrcodeImage, "layout_x", json_object_new_string(buf));
-
-		sprintf(buf, "%d", qrCodeList[idx].layout_y);
-		json_object_object_add(qrcodeImage, "layout_y", json_object_new_string(buf));
-
-		sprintf(buf, "%d", qrCodeList[idx].width);
-		json_object_object_add(qrcodeImage, "width", json_object_new_string(buf));
-
-		sprintf(buf, "%d", qrCodeList[idx].height);
-		json_object_object_add(qrcodeImage, "height", json_object_new_string(buf));
-
-		json_object_array_add(payload, qrcodeImage);
-	}
-
-	sprintf(outputStr, "%s", json_object_to_json_string_ext(payload, JSON_C_TO_STRING_PLAIN));
-	json_object_put(payload);
-
-	return publish_data(mosq, "client/layout/qrcodeview", outputStr);
-}
-
-/**
- *
- * @param mosq
- */
-int publish_view_remove(struct mosquitto *mosq, Text_List *textList, uint8_t textListCount,
-												Image_List *imageList, uint8_t imageListCount,
-												Video_List *videoList, uint8_t videoListCount,
-												QrCode_List *qrCodeList, uint8_t qrCodeListCount)
-{
-	json_object *payload = json_object_new_object();
-	json_object *text = json_object_new_array();
-	json_object *image = json_object_new_array();
-	json_object *video = json_object_new_array();
-	json_object *qrCode = json_object_new_array();
-
-	char outputStr[2048]={0};
-
-	// Remove text view
-	for(int idx=0;idx<textListCount;idx++)
-	{
-		json_object *textview = json_object_new_object();
-		char buf[8];
-		sprintf(buf, "%d", textList[idx].textviewIndex);
-		json_object_object_add(textview, "textviewIndex", json_object_new_string(buf));
-
-		json_object_array_add(text, textview);
-	}
-	json_object_object_add(payload, "rm_textview_list", text);
-
-	// Remove image view
-	for(int idx=0;idx<imageListCount;idx++)
-	{
-		json_object *imageview = json_object_new_object();
-		char buf[8];
-		sprintf(buf, "%d", imageList[idx].imageviewIndex);
-		json_object_object_add(imageview, "imageviewIndex", json_object_new_string(buf));
-
-		json_object_array_add(image, imageview);
-	}
-	json_object_object_add(payload, "rm_imageview_list", image);
-
-	// Remove video view
-	for(int idx=0;idx<videoListCount;idx++)
-	{
-		json_object *videoview = json_object_new_object();
-		char buf[8];
-		sprintf(buf, "%d", videoList[idx].videoviewIndex);
-		json_object_object_add(videoview, "videoviewIndex", json_object_new_string(buf));
-
-		json_object_array_add(video, videoview);
-	}
-	json_object_object_add(payload, "rm_videoview_list", video);
-
-	// Remove qrCode view
-	for(int idx=0;idx<qrCodeListCount;idx++)
-	{
-		json_object *qrCodeview = json_object_new_object();
-		char buf[8];
-		sprintf(buf, "%d", qrCodeList[idx].qrCodeIndex);
-		json_object_object_add(qrCodeview, "qrCodeIndex", json_object_new_string(buf));
-
-		json_object_array_add(qrCode, qrCodeview);
-	}
-	json_object_object_add(payload, "rm_qrcode_list", qrCode);
-
-	sprintf(outputStr, "%s", json_object_to_json_string_ext(payload, JSON_C_TO_STRING_PLAIN));
-	json_object_put(payload);
-
-	return publish_data(mosq, "client/layout/remove", outputStr);
-}
-
-/**
- *
- * @param mosq
- */
-int publish_clear_screen(struct mosquitto *mosq)
-{
-	json_object *payload = json_object_new_object();
-	char outputStr[2048]={0};
-
-	json_object_object_add(payload, "task_name", json_object_new_string("clear_screen"));
-
-	sprintf(outputStr, "%s", json_object_to_json_string_ext(payload, JSON_C_TO_STRING_PLAIN));
-	json_object_put(payload);
-
-	return publish_data(mosq, "client/command", outputStr);
-}
-
-
+/*
+ * LcmCommandDriver.c
+ *
+ *  Created on: 2022/3/31
+ *      Author: folus
+ */
+
+#include "Module_LcmControl_Wistron.h"
+#include "../Config.h"
+Text_List TextList[100];
+int TextIndex = 0;
+Image_List ImageList[100];
+int ImageIndex = 0;
+APNG_List ApngList[5];
+int ApngIndex = 0;
+QrCode_List QRCodeList[5];
+int QRCodeIndex = 0;
+TextScroll_List TextScrollList[5];
+int TextScrollIndex = 0;
+/**
+ *
+ * @param mosq
+ * @param topic
+ * @param outputStr
+ * @return
+ */
+int publish_data(struct mosquitto *mosq, char *topic, char *outputStr)
+{
+	int result;
+
+	result = mosquitto_publish(mosq, NULL, topic, strlen(outputStr), outputStr, QOS_ENSURE_BROKER, RETAIN_NO);
+
+	if(result != MOSQ_ERR_SUCCESS)DEBUG_ERROR("Publish %s error publishing: %s\n", topic, mosquitto_strerror(result));
+
+	return (result != MOSQ_ERR_SUCCESS)?FAIL:PASS;
+}
+
+/**
+ *
+ * @param mosq
+ */
+int publish_profile(struct mosquitto *mosq, char *parameter, char *value)
+{
+	json_object *payload = json_object_new_object();
+	char outputStr[2048]={0};
+
+	json_object_object_add(payload, parameter, json_object_new_string(value));
+
+	sprintf(outputStr, "%s", json_object_to_json_string_ext(payload, JSON_C_TO_STRING_PLAIN));
+	json_object_put(payload);
+
+	return publish_data(mosq, "client/profile", outputStr);
+}
+
+/**
+ *
+ * @param mosq
+ */
+int publish_upgrade(struct mosquitto *mosq, char *otaType, char *url, char *checksum, char *verInfo)
+{
+	json_object *payload = json_object_new_object();
+	char outputStr[2048]={0};
+
+	json_object_object_add(payload, "task_name", json_object_new_string(otaType));
+
+	if((strstr(otaType, OTA_TYPE_APK) != NULL) || (strstr(otaType, OTA_TYPE_UI) != NULL))
+		json_object_object_add(payload, "ftp server", json_object_new_string(url));
+
+	if(strstr(otaType, OTA_TYPE_UI) != NULL)
+	{
+		json_object_object_add(payload, "file_checksum", json_object_new_string(checksum));
+		json_object_object_add(payload, "version_info", json_object_new_string(verInfo));
+	}
+
+	sprintf(outputStr, "%s", json_object_to_json_string_ext(payload, JSON_C_TO_STRING_PLAIN));
+	json_object_put(payload);
+
+	return publish_data(mosq, "client/command", outputStr);
+}
+
+/**
+ *
+ * @param mosq
+ */
+int publish_restart(struct mosquitto *mosq, uint8_t isHardReset)
+{
+	json_object *payload = json_object_new_object();
+	char outputStr[2048]={0};
+
+	json_object_object_add(payload, "task_name", json_object_new_string(isHardReset?"restart":"reset"));
+
+	sprintf(outputStr, "%s", json_object_to_json_string_ext(payload, JSON_C_TO_STRING_PLAIN));
+	json_object_put(payload);
+
+	return publish_data(mosq, "client/command", outputStr);
+}
+
+/**
+ *
+ * @param mosq
+ */
+int publish_power_saving(struct mosquitto *mosq, uint8_t isSleep,char* mac)
+{
+	if(isSleep)
+	{
+		json_object *payload = json_object_new_object();
+		char outputStr[2048]={0};
+
+		json_object_object_add(payload, "task_name", json_object_new_string("power_saving"));
+		json_object_object_add(payload, "mode", json_object_new_string(isSleep?"1":"0"));
+
+		sprintf(outputStr, "%s", json_object_to_json_string_ext(payload, JSON_C_TO_STRING_PLAIN));
+		json_object_put(payload);
+
+		return publish_data(mosq, "client/command", outputStr);
+	}
+	else
+	{
+		char cmd[64];
+		sprintf(cmd, "/usr/sbin/ether-wake -i eth1 %s\n",mac);
+		system(cmd);
+		DEBUG_INFO("MAC:%s\n", mac);
+		return PASS;
+	}
+}
+
+/**
+ *
+ * @param mosq
+ */
+int publish_back_dimming(struct mosquitto *mosq, uint8_t lightLevel)
+{
+	json_object *payload = json_object_new_object();
+	char outputStr[2048]={0};
+	char buf[8];
+
+	json_object_object_add(payload, "task_name", json_object_new_string("backlight"));
+
+	sprintf(buf, "%d", lightLevel);
+	json_object_object_add(payload, "brightness", json_object_new_string(buf));
+
+	sprintf(outputStr, "%s", json_object_to_json_string_ext(payload, JSON_C_TO_STRING_PLAIN));
+	json_object_put(payload);
+
+	return publish_data(mosq, "client/command", outputStr);
+}
+
+/**
+ *
+ * @param mosq
+ */
+int publish_audio_volume(struct mosquitto *mosq, uint8_t volume)
+{
+	json_object *payload = json_object_new_object();
+	char outputStr[2048]={0};
+	char buf[8];
+
+	json_object_object_add(payload, "task_name", json_object_new_string("audio_volume"));
+
+	sprintf(buf, "%d", volume);
+	json_object_object_add(payload, "volume", json_object_new_string(buf));
+
+	sprintf(outputStr, "%s", json_object_to_json_string_ext(payload, JSON_C_TO_STRING_PLAIN));
+	json_object_put(payload);
+
+	return publish_data(mosq, "client/command", outputStr);
+}
+
+/**
+ *
+ * @param mosq
+ */
+int publish_trigger_report_status(struct mosquitto *mosq)
+{
+	json_object *payload = json_object_new_object();
+	char outputStr[2048]={0};
+
+	json_object_object_add(payload, "task_name", json_object_new_string("report_status"));
+
+	sprintf(outputStr, "%s", json_object_to_json_string_ext(payload, JSON_C_TO_STRING_PLAIN));
+	json_object_put(payload);
+
+	return publish_data(mosq, "client/command", outputStr);
+}
+
+/**
+ *
+ * @param mosq
+ */
+int publish_timesync(struct mosquitto *mosq)
+{
+	char outputStr[64]={0};
+	time_t CurrentTime;
+	struct tm *tm;
+	struct timeval tv;
+
+	CurrentTime = time(NULL);
+	tm=localtime(&CurrentTime);
+	gettimeofday(&tv, NULL); // get microseconds, 10^-6
+
+	sprintf(outputStr,"%04d-%02d-%02dT%02d:%02d:%02d+00:00", tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec);
+
+	return publish_data(mosq, "client/timesync", outputStr);
+}
+
+/**
+ *
+ * @param mosq
+ */
+int	publish_textview_add(struct mosquitto* mosq, Text_List* textList, uint8_t listCount)
+{
+	int cmpIndex = 0;
+	for(int idx=0;idx<listCount;idx++)
+	{
+		if (TextIndex >= 100) {
+			DEBUG_INFO("OVER TEXT LIST BUFFER SIZE");
+			break;
+		}
+		if (TextIndex < 100) {
+			for (cmpIndex = 0; cmpIndex < TextIndex; cmpIndex++) {
+				if (TextList[cmpIndex].textviewIndex == textList[idx].textviewIndex)
+					break;
+			}
+			if (TextList[cmpIndex].textviewIndex != textList[idx].textviewIndex) {
+				memcpy(&TextList[TextIndex],textList[idx],sizeof(Text_List));
+				DEBUG_INFO("Push TextIndex[%d] into Buffer(%d)",textList[idx].textviewIndex,TextIndex);
+				TextIndex++;
+			}
+		}
+	}
+	return TextIndex;
+}
+int	publish_textview_push(struct mosquitto* mosq)
+{
+	json_object *payload = json_object_new_array();
+	char outputStr[250*100]={0};
+	int cmpIndex = 0;
+	for(int idx=0;idx<TextIndex;idx++)
+	{
+		json_object *textview = json_object_new_object();
+		char buf[32];
+
+		sprintf(buf, "%d", TextList[idx].textviewIndex);
+		json_object_object_add(textview, "textviewIndex", json_object_new_string(buf));
+
+		json_object_object_add(textview, "textString", json_object_new_string(TextList[idx].textString));
+		json_object_object_add(textview, "textFont", json_object_new_string(TextList[idx].textFont));
+		json_object_object_add(textview, "textStyle", json_object_new_string(TextList[idx].textStyle));
+
+		sprintf(buf, "%d", TextList[idx].textSize);
+		json_object_object_add(textview, "textSize", json_object_new_string(buf));
+		sprintf(buf, "%d", TextList[idx].layout_x);
+		json_object_object_add(textview, "layout_x", json_object_new_string(buf));
+		sprintf(buf, "%d", TextList[idx].layout_y);
+		json_object_object_add(textview, "layout_y", json_object_new_string(buf));
+		sprintf(buf, "%d", TextList[idx].width);
+		json_object_object_add(textview, "width", json_object_new_string(buf));
+		sprintf(buf, "%d", TextList[idx].color_r);
+		json_object_object_add(textview, "color_r", json_object_new_string(buf));
+		sprintf(buf, "%d", TextList[idx].color_g);
+		json_object_object_add(textview, "color_g", json_object_new_string(buf));
+		sprintf(buf, "%d", TextList[idx].color_b);
+		json_object_object_add(textview, "color_b", json_object_new_string(buf));
+		sprintf(buf, "%d", TextList[idx].alignment);
+		json_object_object_add(textview, "alignment", json_object_new_string(buf));
+		json_object_array_add(payload, textview);
+	}
+
+	sprintf(outputStr, "%s", json_object_to_json_string_ext(payload, JSON_C_TO_STRING_PLAIN));
+	json_object_put(payload);
+	return publish_data(mosq, "client/layout/textview", outputStr);
+}
+/**
+ *
+ * @param mosq
+ */
+int	publish_textscroll_add(struct mosquitto* mosq, TextScroll_List* textList, uint8_t listCount)
+{
+	int cmpIndex = 0;
+	for(int idx=0;idx<listCount;idx++)
+	{
+		if (TextScrollIndex >= 100) {
+			DEBUG_INFO("OVER TEXT LIST BUFFER SIZE");
+			break;
+		}
+		if (TextScrollIndex < 100) {
+			for (cmpIndex = 0; cmpIndex < TextScrollIndex; cmpIndex++) {
+				if (TextScrollList[cmpIndex].textscrollIndex == textList[idx].textscrollIndex)
+					break;
+			}
+			if (TextScrollList[cmpIndex].textscrollIndex != textList[idx].textscrollIndex) {
+				memcpy(&TextScrollList[TextScrollIndex],textList[idx],sizeof(TextScroll_List));
+				DEBUG_INFO("Push TextScrollIndex[%d] into Buffer(%d)",TextScrollList[idx].textscrollIndex,TextScrollIndex);
+				TextScrollIndex++;
+			}
+		}
+	}
+	return TextScrollIndex;
+}
+int	publish_textscroll_push(struct mosquitto* mosq)
+{
+	json_object *payload = json_object_new_array();
+	char outputStr[250*100]={0};
+	int cmpIndex = 0;
+	for(int idx=0;idx<TextScrollIndex;idx++)
+	{
+		json_object *textscroll = json_object_new_object();
+		char buf[32];
+
+		sprintf(buf, "%d", TextScrollList[idx].textscrollIndex);
+		json_object_object_add(textscroll, "textscrollIndex", json_object_new_string(buf));
+
+		json_object_object_add(textscroll, "textString", json_object_new_string(TextScrollList[idx].textString));
+		json_object_object_add(textscroll, "textFont", json_object_new_string(TextScrollList[idx].textFont));
+		json_object_object_add(textscroll, "textStyle", json_object_new_string(TextScrollList[idx].textStyle));
+
+		sprintf(buf, "%d", TextScrollList[idx].textSize);
+		json_object_object_add(textscroll, "textSize", json_object_new_string(buf));
+		sprintf(buf, "%d", TextScrollList[idx].layout_x);
+		json_object_object_add(textscroll, "layout_x", json_object_new_string(buf));
+		sprintf(buf, "%d", TextScrollList[idx].layout_y);
+		json_object_object_add(textscroll, "layout_y", json_object_new_string(buf));
+		sprintf(buf, "%d", TextScrollList[idx].width);
+		json_object_object_add(textscroll, "width", json_object_new_string(buf));
+		sprintf(buf, "%d", TextScrollList[idx].color_r);
+		json_object_object_add(textscroll, "color_r", json_object_new_string(buf));
+		sprintf(buf, "%d", TextScrollList[idx].color_g);
+		json_object_object_add(textscroll, "color_g", json_object_new_string(buf));
+		sprintf(buf, "%d", TextScrollList[idx].color_b);
+		json_object_object_add(textscroll, "color_b", json_object_new_string(buf));
+		sprintf(buf, "%d", TextScrollList[idx].direction);
+		json_object_object_add(textscroll, "direction", json_object_new_string(buf));
+		json_object_array_add(payload, textscroll);
+	}
+
+	sprintf(outputStr, "%s", json_object_to_json_string_ext(payload, JSON_C_TO_STRING_PLAIN));
+	json_object_put(payload);
+	return publish_data(mosq, "client/layout/textscroll", outputStr);
+}
+
+/**
+ *
+ * @param mosq
+ */
+int publish_imageview_add(struct mosquitto *mosq, Image_List *imageList, uint8_t listCount)
+{
+	int cmpIndex = 0;
+	for(int idx=0;idx<listCount;idx++)
+	{
+		if (ImageIndex >= 100) {
+			DEBUG_INFO("OVER TEXT LIST BUFFER SIZE");
+			break;
+		}
+
+		for (cmpIndex = 0; cmpIndex < ImageIndex; cmpIndex++) {
+			if (ImageList[cmpIndex].imageviewIndex == imageList[idx].imageviewIndex)
+				break;
+		}
+		if (ImageList[cmpIndex] != imageList[idx].imageviewIndex) {
+			memcpy(&ImageList[ImageIndex],&imageList[idx],sizeof(Image_List));
+			DEBUG_INFO("Push ImageIndex[%d] into Buffer(%d)",imageList[idx].imageviewIndex,ImageIndex);
+			ImageIndex++;
+		}
+	}
+
+	return ImageIndex;
+}
+
+int publish_imageview_push(struct mosquitto *mosq)
+{
+	json_object *payload = json_object_new_array();
+	char outputStr[250*100]={0};
+	int cmpIndex = 0;
+	for(int idx=0;idx<ImageIndex;idx++)
+	{
+		json_object *imageview = json_object_new_object();
+		char buf[32];
+
+		sprintf(buf, "%d", ImageList[idx].imageviewIndex);
+		json_object_object_add(imageview, "imageviewIndex", json_object_new_string(buf));
+
+		sprintf(buf, "%d", ImageList[idx].imgsrc_addr);
+		json_object_object_add(imageview, "imgsrc_addr", json_object_new_string(buf));
+
+		sprintf(buf, "%d", ImageList[idx].layout_x);
+		json_object_object_add(imageview, "layout_x", json_object_new_string(buf));
+
+		sprintf(buf, "%d", ImageList[idx].layout_y);
+		json_object_object_add(imageview, "layout_y", json_object_new_string(buf));
+
+		sprintf(buf, "%d", ImageList[idx].width);
+		json_object_object_add(imageview, "width", json_object_new_string(buf));
+
+		sprintf(buf, "%d", ImageList[idx].height);
+		json_object_object_add(imageview, "height", json_object_new_string(buf));
+
+		json_object_array_add(payload, imageview);
+	}
+
+	sprintf(outputStr, "%s", json_object_to_json_string_ext(payload, JSON_C_TO_STRING_PLAIN));
+	json_object_put(payload);
+
+	return publish_data(mosq, "client/layout/imageview", outputStr);
+}
+
+
+/**
+ *
+ * @param mosq
+ */
+int publish_apngview_add(struct mosquitto *mosq, APNG_List *apngList, uint8_t listCount)
+{
+	int cmpIndex = 0;
+	for(int idx=0;idx<listCount;idx++)
+	{
+		if (ApngIndex >= 5) {
+			DEBUG_INFO("OVER APNG LIST BUFFER SIZE");
+			break;
+		}
+
+		for (cmpIndex = 0; cmpIndex < listCount; cmpIndex++) {
+			if (ApngList[cmpIndex].apngIndex == apngList[idx].apngIndex)
+				break;
+		}
+		if (ApngList[cmpIndex] != apngList[idx].apngIndex) {
+			memcpy(&ApngList[ApngIndex],&apngList[idx],sizeof(APNG_List));
+			DEBUG_INFO("Push ApngIndex[%d] into Buffer(%d)",apngList[idx].apngIndex,ApngIndex);
+			ApngIndex++;
+		}
+	}
+
+	return ApngIndex;
+}
+
+int publish_apngview_push(struct mosquitto *mosq)
+{
+	json_object *payload = json_object_new_array();
+	char outputStr[250*100]={0};
+	int cmpIndex = 0;
+	for(int idx=0;idx<ApngIndex;idx++)
+	{
+		json_object *apngview = json_object_new_object();
+		char buf[32];
+
+		sprintf(buf, "%d", ApngList[idx].apngIndex);
+		json_object_object_add(apngview, "apngIndex", json_object_new_string(buf));
+
+		sprintf(buf, "%d", ApngList[idx].imgsrc_addr);
+		json_object_object_add(apngview, "apngsrc_addr", json_object_new_string(buf));
+
+		sprintf(buf, "%d", ApngList[idx].layout_x);
+		json_object_object_add(apngview, "layout_x", json_object_new_string(buf));
+
+		sprintf(buf, "%d", ApngList[idx].layout_y);
+		json_object_object_add(apngview, "layout_y", json_object_new_string(buf));
+
+		sprintf(buf, "%d", ApngList[idx].width);
+		json_object_object_add(apngview, "width", json_object_new_string(buf));
+
+		sprintf(buf, "%d", ApngList[idx].height);
+		json_object_object_add(apngview, "height", json_object_new_string(buf));
+
+		sprintf(buf, "%d", ApngList[idx].Loop);
+		json_object_object_add(apngview, "Loop", json_object_new_string(buf));
+
+		json_object_array_add(payload, apngview);
+	}
+
+	sprintf(outputStr, "%s", json_object_to_json_string_ext(payload, JSON_C_TO_STRING_PLAIN));
+	json_object_put(payload);
+
+	return publish_data(mosq, "client/layout/apngview", outputStr);
+}
+
+/**
+ *
+ * @param mosq
+ */
+int publish_videoview_add_push(struct mosquitto *mosq, Video_List *videoList, uint8_t listCount)
+{
+	json_object *payload = json_object_new_array();
+	char outputStr[2048]={0};
+
+	for(int idx=0;idx<listCount;idx++)
+	{
+		json_object *imageview = json_object_new_object();
+		char buf[32];
+
+		sprintf(buf, "%d", videoList[idx].videoviewIndex);
+		json_object_object_add(imageview, "videoviewIndex", json_object_new_string(buf));
+
+		sprintf(buf, "%d", videoList[idx].videosrc_addr);
+		json_object_object_add(imageview, "videoSrc_addr", json_object_new_string(buf));
+
+		sprintf(buf, "%d", videoList[idx].layout_x);
+		json_object_object_add(imageview, "layout_x", json_object_new_string(buf));
+
+		sprintf(buf, "%d", videoList[idx].layout_y);
+		json_object_object_add(imageview, "layout_y", json_object_new_string(buf));
+
+		sprintf(buf, "%d", videoList[idx].width);
+		json_object_object_add(imageview, "width", json_object_new_string(buf));
+
+		sprintf(buf, "%d", videoList[idx].height);
+		json_object_object_add(imageview, "height", json_object_new_string(buf));
+
+		json_object_array_add(payload, imageview);
+	}
+
+	sprintf(outputStr, "%s", json_object_to_json_string_ext(payload, JSON_C_TO_STRING_PLAIN));
+	json_object_put(payload);
+
+	return publish_data(mosq, "client/layout/videoview", outputStr);
+}
+
+/**
+ *
+ * @param mosq
+ */
+int publish_qrcodeimage_add(struct mosquitto *mosq, QrCode_List *qrCodeList, uint8_t listCount)
+{
+	int cmpIndex = 0;
+	for(int idx=0;idx<listCount;idx++)
+	{
+		if (QRCodeIndex >= 5) {
+			DEBUG_INFO("OVER APNG LIST BUFFER SIZE");
+			break;
+		}
+
+		for (cmpIndex = 0; cmpIndex < listCount; cmpIndex++) {
+			if (QRCodeList[cmpIndex].qrCodeIndex == qrCodeList[idx].qrCodeIndex)
+				break;
+		}
+		if (QRCodeList[cmpIndex] != qrCodeList[idx].qrCodeIndex) {
+			memcpy(&QRCodeList[QRCodeIndex],&qrCodeList[idx],sizeof(QrCode_List));
+			DEBUG_INFO("Push QRCodeList[%d] into Buffer(%d)",QRCodeList[idx].qrCodeList,qrCodeIndex);
+			QRCodeIndex++;
+		}
+	}
+
+	return QRCodeIndex;
+}
+/**
+ *
+ * @param mosq
+ */
+int publish_qrcodeimage_push(struct mosquitto *mosq)
+{
+	json_object *payload = json_object_new_array();
+	char outputStr[2048]={0};
+	int cmpIndex = 0;
+	for(int idx=0;idx<QRCodeIndex;idx++)
+	{
+		json_object *qrcodeImage = json_object_new_object();
+		char buf[32];
+
+		sprintf(buf, "%d", QRCodeList[idx].qrCodeIndex);
+		json_object_object_add(qrcodeImage, "qrCodeIndex", json_object_new_string(buf));
+
+		sprintf(buf, "%s", QRCodeList[idx].qrCodeContent);
+		json_object_object_add(qrcodeImage, "qrCodeContent", json_object_new_string(buf));
+
+		sprintf(buf, "%s", QRCodeList[idx].errorCorrection);
+		json_object_object_add(qrcodeImage, "errorCorrection", json_object_new_string(buf));
+
+		sprintf(buf, "%d", QRCodeList[idx].layout_x);
+		json_object_object_add(qrcodeImage, "layout_x", json_object_new_string(buf));
+
+		sprintf(buf, "%d", QRCodeList[idx].layout_y);
+		json_object_object_add(qrcodeImage, "layout_y", json_object_new_string(buf));
+
+		sprintf(buf, "%d", QRCodeList[idx].width);
+		json_object_object_add(qrcodeImage, "width", json_object_new_string(buf));
+
+		sprintf(buf, "%d", QRCodeList[idx].height);
+		json_object_object_add(qrcodeImage, "height", json_object_new_string(buf));
+
+		json_object_array_add(payload, qrcodeImage);
+	}
+
+	sprintf(outputStr, "%s", json_object_to_json_string_ext(payload, JSON_C_TO_STRING_PLAIN));
+	json_object_put(payload);
+
+	return publish_data(mosq, "client/layout/qrcodeview", outputStr);
+}
+
+
+
+int publish_view_remove_all(struct mosquitto* mosq)
+{
+	json_object* payload = json_object_new_object();
+	json_object* text = json_object_new_array();
+	json_object* image = json_object_new_array();
+	json_object* video = json_object_new_array();
+	json_object* qrCode = json_object_new_array();
+	json_object* apng = json_object_new_array();
+	json_object* textscroll = json_object_new_array();
+
+	char outputStr[2048] = { 0 };
+
+	// Remove text view
+	//for(int idx=0;idx<textListCount;idx++)
+	for (int idx = 0; idx < TextIndex; idx++)
+	{
+		json_object* textview = json_object_new_object();
+		char buf[8];
+		//sprintf(buf, "%d", textList[idx].textviewIndex);
+		sprintf(buf, "%d", TextList[idx].textviewIndex);
+		json_object_object_add(textview, "textviewIndex", json_object_new_string(buf));
+
+		json_object_array_add(text, textview);
+		//DEBUG_INFO("Remove Text[%d]:%d", idx, TextList[idx]);
+	}
+	json_object_object_add(payload, "rm_textview_list", text);
+
+	// Remove image view
+	//for(int idx=0;idx<imageListCount;idx++)
+	for (int idx = 0; idx < ImageIndex; idx++)
+	{
+		json_object* imageview = json_object_new_object();
+		char buf[8];
+		//sprintf(buf, "%d", imageList[idx].imageviewIndex);
+		sprintf(buf, "%d", ImageList[idx].imageviewIndex);
+		json_object_object_add(imageview, "imageviewIndex", json_object_new_string(buf));
+
+		json_object_array_add(image, imageview);
+		//DEBUG_INFO("Remove Image[%d]:%d", idx, ImageList[idx]);
+	}
+	json_object_object_add(payload, "rm_imageview_list", image);
+
+	// Remove video view
+
+	for (int idx = 0; idx < 1; idx++)
+	{
+		json_object* videoview = json_object_new_object();
+		char buf[8];
+		sprintf(buf, "0");
+		json_object_object_add(videoview, "videoviewIndex", json_object_new_string(buf));
+
+		json_object_array_add(video, videoview);
+	}
+	json_object_object_add(payload, "rm_videoview_list", video);
+
+	// Remove qrCode view
+	//for(int idx=0;idx<qrCodeListCount;idx++)
+	for (int idx = 0; idx < QRCodeIndex; idx++)
+	{
+		json_object* qrCodeview = json_object_new_object();
+		char buf[8];
+		//sprintf(buf, "%d", qrCodeList[idx].qrCodeIndex);
+		sprintf(buf, "%d", QRCodeList[idx].qrCodeIndex);
+		json_object_object_add(qrCodeview, "qrCodeIndex", json_object_new_string(buf));
+
+		json_object_array_add(qrCode, qrCodeview);
+		//DEBUG_INFO("Remove QRCODE[%d]:%d", idx, QRCodeList[idx]);
+	}
+	json_object_object_add(payload, "rm_qrcode_list", qrCode);
+
+	sprintf(outputStr, "%s", json_object_to_json_string_ext(payload, JSON_C_TO_STRING_PLAIN));
+	json_object_put(payload);
+	memset(TextList, 0, sizeof(TextList));
+	memset(ImageList, 0, sizeof(ImageList));
+	memset(QRCodeList, 0, sizeof(QRCodeList));
+	TextIndex = 0;
+	ImageIndex = 0;
+	QRCodeIndex = 0;
+	return publish_data(mosq, "client/layout/remove", outputStr);
+}
+
+
+/**
+ *
+ * @param mosq
+ */
+int publish_view_remove(struct mosquitto *mosq, Text_List *textList, uint8_t textListCount,
+												Image_List *imageList, uint8_t imageListCount,
+												Video_List *videoList, uint8_t videoListCount,
+												QrCode_List *qrCodeList, uint8_t qrCodeListCount)
+{
+	json_object *payload = json_object_new_object();
+	json_object *text = json_object_new_array();
+	json_object *image = json_object_new_array();
+	json_object *video = json_object_new_array();
+	json_object *qrCode = json_object_new_array();
+
+	char outputStr[2048]={0};
+
+	// Remove text view
+	for(int idx=0;idx<textListCount;idx++)
+	{
+		json_object *textview = json_object_new_object();
+		char buf[8];
+		sprintf(buf, "%d", textList[idx].textviewIndex);
+		json_object_object_add(textview, "textviewIndex", json_object_new_string(buf));
+
+		json_object_array_add(text, textview);
+	}
+	json_object_object_add(payload, "rm_textview_list", text);
+
+	// Remove image view
+	for(int idx=0;idx<imageListCount;idx++)
+	{
+		json_object *imageview = json_object_new_object();
+		char buf[8];
+		sprintf(buf, "%d", imageList[idx].imageviewIndex);
+		json_object_object_add(imageview, "imageviewIndex", json_object_new_string(buf));
+
+		json_object_array_add(image, imageview);
+	}
+	json_object_object_add(payload, "rm_imageview_list", image);
+
+	// Remove video view
+	for(int idx=0;idx<videoListCount;idx++)
+	{
+		json_object *videoview = json_object_new_object();
+		char buf[8];
+		sprintf(buf, "%d", videoList[idx].videoviewIndex);
+		json_object_object_add(videoview, "videoviewIndex", json_object_new_string(buf));
+
+		json_object_array_add(video, videoview);
+	}
+	json_object_object_add(payload, "rm_videoview_list", video);
+
+	// Remove qrCode view
+	for(int idx=0;idx<qrCodeListCount;idx++)
+	{
+		json_object *qrCodeview = json_object_new_object();
+		char buf[8];
+		sprintf(buf, "%d", qrCodeList[idx].qrCodeIndex);
+		json_object_object_add(qrCodeview, "qrCodeIndex", json_object_new_string(buf));
+
+		json_object_array_add(qrCode, qrCodeview);
+	}
+	json_object_object_add(payload, "rm_qrcode_list", qrCode);
+
+	sprintf(outputStr, "%s", json_object_to_json_string_ext(payload, JSON_C_TO_STRING_PLAIN));
+	json_object_put(payload);
+
+	return publish_data(mosq, "client/layout/remove", outputStr);
+}
+
+/**
+ *
+ * @param mosq
+ */
+int publish_clear_screen(struct mosquitto *mosq)
+{
+	json_object *payload = json_object_new_object();
+	char outputStr[2048]={0};
+
+	json_object_object_add(payload, "task_name", json_object_new_string("clear_screen"));
+
+	sprintf(outputStr, "%s", json_object_to_json_string_ext(payload, JSON_C_TO_STRING_PLAIN));
+	json_object_put(payload);
+
+	return publish_data(mosq, "client/command", outputStr);
+}
+
+

+ 1956 - 1179
EVSE/Projects/DD360UCar/Apps/Module_LcmControl_Wistron/Module_LcmControl_Wistron.c

@@ -1,1179 +1,1956 @@
-/*
- * Module_LcmControl_Wistron.c
- *
- *  Created on: 2021/11/6
- *      Author: folus
- */
-
-#include "Module_LcmControl_Wistron.h"
-#include "../Log/log.h"
-#include "../ShareMemory/shmMem.h"
-#include "../Define/define.h"
-#include "../Config.h"
-#include "../SelectGun/SelectGun.h"
-#include "main.h"
-
-struct SysConfigAndInfo			*ShmSysConfigAndInfo;
-struct StatusCodeData 			*ShmStatusCodeData;
-struct OCPP16Data				*ShmOCPP16Data;
-struct OCPP20Data				*ShmOCPP20Data;
-
-//ParsingRatedCur modelnameInfo	= {0};
-uint8_t gunType[4] 				= {0};
-
-struct timespec					timer[TMR_IDX_CNT];
-
-/**
- *
- * @param fmt
- * @return
- */
-/*
-int StoreLogMsg(const char *fmt, ...)
-{
-	char Buf[4096+256];
-	char buffer[4096];
-	time_t CurrentTime;
-	struct tm *tm;
-	struct timeval tv;
-	va_list args;
-
-	va_start(args, fmt);
-	int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
-	va_end(args);
-
-	memset(Buf,0,sizeof(Buf));
-	CurrentTime = time(NULL);
-	tm=localtime(&CurrentTime);
-	gettimeofday(&tv, NULL); // get microseconds, 10^-6
-
-	sprintf(Buf,"echo -n \'[%04d.%02d.%02d %02d:%02d:%02d.%03ld]%s\' >>  /Storage/SystemLog/[%04d.%02d]Module_LcmControl_Wistron_Log",
-			tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,(tv.tv_usec/1000),
-			buffer,
-			tm->tm_year+1900,tm->tm_mon+1);
-
-#ifdef SystemLogMessage
-	system((const char*)Buf);
-#endif
-
-#ifdef ConsloePrintLog
-	printf("[%04d.%02d.%02d %02d:%02d:%02d.%03ld]%s", tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,(tv.tv_usec/1000), buffer);
-#endif
-
-	return rc;
-}
-*/
-/**
- *
- * @param data
- * @param length
- * @return
- */
-uint32_t crc32(uint8_t *data, uint32_t length)
-{
-	uint32_t crc=0xFFFFFFFF;
-
-	for(size_t i=0;i<length;i++)
-	{
-		char ch=data[i];
-		for(size_t j=0;j<8;j++)
-		{
-			uint32_t b=(ch^crc)&1;
-
-			crc>>=1;
-
-			if(b) crc=crc^0xEDB88320;
-
-			ch>>=1;
-		}
-	}
-
-	return ~crc;
-}
-
-/**
- *
- * @param filename
- * @return
- */
-uint32_t getFileCrc32(char *filename)
-{
-	uint32_t result = 0;
-
-	int fd = open(filename, O_RDONLY);
-    if(fd < 0)
-    {
-        DEBUG_ERROR("Can not open file %s\n", filename);
-    }
-    else
-    {
-    	struct stat st;
-		stat(filename, &st);
-		uint8_t *data;
-		data = malloc(st.st_size);
-
-		if(read(fd,data,st.st_size) == st.st_size)
-		{
-			result = crc32(data, st.st_size);
-			close(fd);
-		} else {
-			DEBUG_ERROR("Read file Error %d\n", st.st_size);
-		}
-
-		free(data);
-    }
-
-	return result;
-}
-
-/**
- *
- * @param timer
- */
-void refreshStartTimer(struct timespec *timer)
-{
-	clock_gettime(CLOCK_MONOTONIC, timer);
-}
-
-/**
- *
- * @param timer
- * @return
- */
-int getDiffSecNow(struct timespec timer)
-{
-	struct timespec timerNow;
-
-	clock_gettime(CLOCK_MONOTONIC, &timerNow);
-
-	return (int)((((unsigned long)(timerNow.tv_sec - timer.tv_sec) * 1000) + ((unsigned long)((timerNow.tv_nsec / 1000000) - (timer.tv_nsec / 1000000))))/1000);
-}
-
-/**
- *
- * @return
- */
-/*
-int InitShareMemory()
-{
-	int result = PASS;
-	int MeterSMId;
-
-	//Initial ShmSysConfigAndInfo
-	if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo), 0777)) < 0)
-    {
-		DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
-		result = FAIL;
-	}
-    else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1)
-    {
-    	DEBUG_ERROR("shmat ShmSysConfigAndInfo NG\n");
-    	result = FAIL;
-   	}
-    else
-    {}
-
-   	// Initial ShmStatusCodeData
-   	if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData), 0777)) < 0)
-    {
-   		DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
-   		result = FAIL;
-	}
-    else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
-    {
-    	DEBUG_ERROR("shmat ShmStatusCodeData NG\n");
-    	result = FAIL;
-   	}
-    else
-    {}
-
-	// Initial ShmOCPP16Data
-	if ((MeterSMId = shmget(ShmOcppModuleKey, sizeof(struct OCPP16Data), 0777)) < 0)
-	{
-		DEBUG_ERROR("shmget ShmOCPP16Data NG\n");
-		result = FAIL;
-	}
-	else if ((ShmOCPP16Data = shmat(MeterSMId, NULL, 0)) == (void *) -1)
-	{
-		DEBUG_ERROR("shmat ShmOCPP16Data NG\n");
-		result = FAIL;
-	}
-	else
-	{}
-
-	// Initial ShmOCPP20Data
-	if ((MeterSMId = shmget(ShmOcpp20ModuleKey, sizeof(struct OCPP20Data), 0777)) < 0)
-	{
-		DEBUG_ERROR("shmget ShmOCPP20Data NG\n");
-		result = FAIL;
-	}
-	else if ((ShmOCPP20Data = shmat(MeterSMId, NULL, 0)) == (void *) -1)
-	{
-		DEBUG_ERROR("shmat ShmOCPP20Data NG\n");
-		result = FAIL;
-	}
-	else
-	{}
-
-	// Parsing model name to get related info about charger
-	if(RatedCurrentParsing((char*)ShmSysConfigAndInfo->SysConfig.ModelName, &modelnameInfo) != -1)
-	{
-		DEBUG_INFO("Model name rated power: %d\n", modelnameInfo.ratedPower);
-		if((ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D') &&
-		   ((ShmSysConfigAndInfo->SysConfig.ModelName[1]=='B') ||
-			(ShmSysConfigAndInfo->SysConfig.ModelName[1]=='K') ||
-			(ShmSysConfigAndInfo->SysConfig.ModelName[1]=='O'))
-		   ) // 'D' means DC
-		{
-			// DO series
-			for(int gun_index=0; gun_index<GENERAL_GUN_QUANTITY ; gun_index++)
-			{
-				gunType[gun_index] = GUN_TYPE_DO;
-
-				switch(modelnameInfo.ParsingInfo[gun_index].GunType)
-				{
-					case Gun_Type_Chademo:
-						DEBUG_INFO("Gun-%02d type: Cabinet CHAdeMO\n", gun_index);
-						break;
-					case Gun_Type_CCS_2:
-						DEBUG_INFO("Gun-%02d type: Cabinet CCS\n", gun_index);
-						break;
-					case Gun_Type_GB:
-						DEBUG_INFO("Gun-%02d type: Cabinet GBT\n", gun_index);
-						break;
-					case Gun_Type_AC:
-						DEBUG_INFO("Gun-%02d type: Cabinet AC\n", gun_index);
-						break;
-					default:
-						DEBUG_WARN("Gun-%02d type: Cabinet unknown\n", gun_index);
-						break;
-				}
-			}
-		}
-		else
-		{
-			for(int gun_index=0;gun_index<modelnameInfo.GetGunCount;gun_index++)
-			{
-				switch(modelnameInfo.ParsingInfo[gun_index].GunType)
-				{
-					case Gun_Type_Chademo:
-						gunType[gun_index] = GUN_TYPE_CHAdeMO;
-						DEBUG_INFO("Gun-%02d type: CHAdeMO\n", gun_index);
-						break;
-					case Gun_Type_CCS_2:
-						gunType[gun_index] = GUN_TYPE_CCS;
-						DEBUG_INFO("Gun-%02d type: CCS\n", gun_index);
-						break;
-					case Gun_Type_GB:
-						gunType[gun_index] = GUN_TYPE_GBT;
-						DEBUG_INFO("Gun-%02d type: GBT\n", gun_index);
-						break;
-					case Gun_Type_AC:
-						gunType[gun_index] = GUN_TYPE_AC;
-						DEBUG_INFO("Gun-%02d type: AC\n", gun_index);
-						break;
-					default:
-						DEBUG_WARN("Gun-%02d type: Unknown\n", gun_index);
-						break;
-				}
-			}
-		}
-	}
-	else
-	{
-		DEBUG_ERROR("Model name parsing fail.\n");
-		result = FAIL;
-	}
-
-	// Initial all timer
-	for(uint8_t idxTmr=0;idxTmr<TMR_IDX_CNT;idxTmr++)
-	{
-		refreshStartTimer(&timer[idxTmr]);
-	}
-
-    return result;
-}
-*/
-/**
- *
- * @param mosq
- * @param userdata
- * @param msg
- * @return
- */
-int on_message(struct mosquitto *mosq, void *userdata, const struct mosquitto_message *msg)
-{
-	json_object *payload;
-
-	payload = json_tokener_parse(msg->payload);
-	if(!is_error(payload))
-	{
-		/*
-		 *	TODO:
-		 *		1. Process message depend on receive topic
-		 *		2. Message maybe could define as JSON format
-		 */
-		if(strstr(msg->topic, "client/connect"))
-		{
-			sprintf((char*)clientInfo.verHW, "%s", json_object_get_string(json_object_object_get(payload, "HW_version")));
-			sprintf((char*)clientInfo.verFW_OS, "%s", json_object_get_string(json_object_object_get(payload, "FW_version_OS")));
-			sprintf((char*)clientInfo.verFW_APK, "%s", json_object_get_string(json_object_object_get(payload, "FW_version_APK")));
-			sprintf((char*)clientInfo.verFW_UI, "%s", json_object_get_string(json_object_object_get(payload, "FW_version_UI")));
-			sprintf((char*)clientInfo.macAddr, "%s", json_object_get_string(json_object_object_get(payload, "MAC_addr")));
-			sprintf((char*)clientInfo.orientation, "%s", json_object_get_string(json_object_object_get(payload, "Orientation")));
-
-			DEBUG_INFO("HW_version: %s\n", clientInfo.verHW);
-			DEBUG_INFO("FW_version_OS: %s\n", clientInfo.verFW_OS);
-			DEBUG_INFO("FW_version_APK: %s\n", clientInfo.verFW_APK);
-			DEBUG_INFO("FW_version_UI: %s\n", clientInfo.verFW_UI);
-			DEBUG_INFO("MAC_addr: %s\n", clientInfo.macAddr);
-			DEBUG_INFO("Orientation: %s\n", clientInfo.orientation);
-		}
-		else if(strstr(msg->topic, "client/touch"))
-		{
-			if(json_object_object_get(payload, "touchlist") != NULL)
-			{
-				for(int idx=0;idx<json_object_array_length(json_object_object_get(payload, "touchlist"));idx++)
-				{
-					DEBUG_INFO("Touch point-%d(%s-%s)=> x: %s, y: %s\n", idx,
-																  json_object_get_string(json_object_object_get(json_object_array_get_idx(json_object_object_get(payload, "touchlist"), idx), "obj_type")),
-																  json_object_get_string(json_object_object_get(json_object_array_get_idx(json_object_object_get(payload, "touchlist"), idx), "obj_onClick")),
-																  json_object_get_string(json_object_object_get(json_object_array_get_idx(json_object_object_get(payload, "touchlist"), idx), "touch_point_x")),
-																  json_object_get_string(json_object_object_get(json_object_array_get_idx(json_object_object_get(payload, "touchlist"), idx), "touch_point_y")));
-				}
-			}
-		}
-		else if(strstr(msg->topic, "client/info"))
-		{
-			if(json_object_object_get(payload, "status") != NULL)
-			{
-				switch(atoi(json_object_get_string(json_object_object_get(payload, "status"))))
-				{
-					case 1:
-						DEBUG_INFO("Status normal.\n");
-						break;
-					case 2:
-						DEBUG_INFO("Status downloading.\n");
-						break;
-					case 3:
-						DEBUG_INFO("Status uploading.\n");
-						break;
-					case 4:
-						DEBUG_INFO("Status reboot.\n");
-						break;
-					case 5:
-						DEBUG_INFO("Status reset.\n");
-						break;
-					case 6:
-						DEBUG_INFO("Status sleep.\n");
-						break;
-					case 255:
-						DEBUG_INFO("Status fault.\n");
-						break;
-					default:
-						DEBUG_INFO("Unknown status.\n");
-						break;
-				}
-			}
-
-			if(json_object_object_get(payload, "temperature") != NULL)
-			{
-				DEBUG_INFO("Temperature: %s.\n", json_object_get_string(json_object_object_get(payload, "temperature")));
-			}
-
-			if(json_object_object_get(payload, "cpu_temperatue") != NULL)
-			{
-				DEBUG_INFO("CPU temperature: %s.\n", json_object_get_string(json_object_object_get(payload, "cpu_temperatue")));
-			}
-		}
-		else if(strstr(msg->topic, "client/profile") ||
-				strstr(msg->topic, "client/command") ||
-				strstr(msg->topic, "client/timesync") ||
-				strstr(msg->topic, "client/layout/textview") ||
-				strstr(msg->topic, "client/layout/imageview") ||
-				strstr(msg->topic, "client/layout/videoview") ||
-				strstr(msg->topic, "client/layout/remove"))
-		{
-			// Skip topic publish from CSU
-		}
-		else
-		{
-			DEBUG_INFO("Unknown topic: %s\n", msg->topic);
-			DEBUG_INFO("Unknown payload: %s\n", msg->payload);
-		}
-	}
-	else
-	{
-		DEBUG_WARN("Payload is not JSON format.\n");
-	}
-	json_object_put(payload);
-
-	return 0;
-}
-
-/**
- *
- * @param mosq
- * @param obj
- * @param reason_code
- */
-void on_connect(struct mosquitto *mosq, void *obj, int reason_code)
-{
-	DEBUG_INFO("on_connect: %s\n", mosquitto_connack_string(reason_code));
-	if(reason_code != 0)mosquitto_disconnect(mosq);
-}
-
-/**
- *
- * @param mosq
- * @param obj
- * @param reason_code
- */
-void on_disconnect(struct mosquitto *mosq, void *obj, int reason_code)
-{
-	DEBUG_INFO("on_disconnect: %s\n", mosquitto_connack_string(reason_code));
-	if(reason_code != 0)mosquitto_disconnect(mosq);
-}
-
-/**
- *
- * @param mosq
- * @param obj
- * @param mid
- */
-void on_publish(struct mosquitto *mosq, void *obj, int mid)
-{}
-
-//==========================================================================
-// Page routine
-//==========================================================================
-/**
- *
- * @param targetChargingInfoData
- */
-void page_Booting(struct ChargingInfoData *targetChargingInfoData)
-{
-	/*
-	 * 	TODO:
-	 * 	1. Page content
-	 */
-}
-
-/**
- *
- * @param targetChargingInfoData
- */
-void page_Idle(struct ChargingInfoData *targetChargingInfoData)
-{
-	/*
-	 * 	TODO:
-	 * 	1. Page content
-	 */
-}
-
-/**
- *
- * @param targetChargingInfoData
- */
-void page_Authorizing(struct ChargingInfoData *targetChargingInfoData)
-{
-	/*
-	 * 	TODO:
-	 * 	1. Page content
-	 */
-
-}
-
-/**
- *
- * @param targetChargingInfoData
- */
-void page_Preparing(struct ChargingInfoData *targetChargingInfoData)
-{
-	/*
-	 * 	TODO:
-	 * 	1. Page content
-	 */
-}
-
-/**
- *
- * @param targetChargingInfoData
- */
-void page_Charging(struct ChargingInfoData *targetChargingInfoData)
-{
-	/*
-	 * 	TODO:
-	 * 	1. Page content
-	 */
-}
-
-/**
- *
- * @param targetChargingInfoData
- */
-void page_Terminating(struct ChargingInfoData *targetChargingInfoData)
-{
-	/*
-	 * 	TODO:
-	 * 	1. Page content
-	 */
-}
-
-/**
- *
- * @param targetChargingInfoData
- */
-void page_Complete(struct ChargingInfoData *targetChargingInfoData)
-{
-	/*
-	 * 	TODO:
-	 * 	1. Page content
-	 */
-}
-
-/**
- *
- * @param targetChargingInfoData
- */
-void page_Reservation(struct ChargingInfoData *targetChargingInfoData)
-{
-	/*
-	 * 	TODO:
-	 * 	1. Page content
-	 */
-}
-
-/**
- *
- * @param targetChargingInfoData
- */
-void page_Maintain(struct ChargingInfoData *targetChargingInfoData)
-{
-	/*
-	 * 	TODO:
-	 * 	1. Page content
-	 */
-}
-
-/**
- *
- * @param targetChargingInfoData
- */
-void page_Update(struct ChargingInfoData *targetChargingInfoData)
-{
-	/*
-	 * 	TODO:
-	 * 	1. Page content
-	 */
-}
-
-/**
- *
- * @param targetChargingInfoData
- */
-void page_AlarmFault(struct ChargingInfoData *targetChargingInfoData)
-{
-	/*
-	 * 	TODO:
-	 * 	1. Page content
-	 */
-}
-
-/**
- *
- * @param targetChargingInfoData
- */
-void page_Unknown(struct ChargingInfoData *targetChargingInfoData)
-{
-	/*
-	 * 	TODO:
-	 * 	1. Page content
-	 */
-}
-
-//==========================================================================
-// Command publish sample routine
-//==========================================================================
-/**
- *
- * @param mosq
- */
-int publish_profile_sample(struct mosquitto *mosq)
-{
-	return publish_profile(mosq, PROFILE_CONNECT_TIMEOUT, "10000");
-}
-
-/**
- *
- * @param mosq
- */
-int publish_upgrade_sample(struct mosquitto *mosq)
-{
-	char url[300];
-	char chkCrc32[16];
-
-	sprintf(url, "ftp://ftpuser:ftppasswd@%s/mnt/img.zip", BROKER_ADDRESS);
-	sprintf(chkCrc32, "0x%08X", getFileCrc32("/mnt/img.zip"));
-	DEBUG_INFO("image file crc32: %s\n", chkCrc32);
-	DEBUG_INFO("url : %s\n", url);
-	return publish_upgrade(mosq, OTA_TYPE_APK, url, chkCrc32, "V0.01");
-}
-
-/**
- *
- * @param mosq
- */
-int publish_restart_sample(struct mosquitto *mosq)
-{
-	return publish_restart(mosq, FALSE);
-}
-
-/**
- *
- * @param mosq
- */
-int publish_power_saving_sample(struct mosquitto *mosq)
-{
-	return publish_power_saving(mosq, TRUE);
-}
-
-/**
- *
- * @param mosq
- */
-int publish_back_dimming_sample(struct mosquitto *mosq)
-{
-	int i;
-	for (i = 0; i <= BRIGHTNESS_LEVEL_AUTO; i++) {
-		publish_back_dimming(mosq, i);
-		sleep(3);
-	}
-	return publish_back_dimming(mosq, BRIGHTNESS_LEVEL_AUTO);
-}
-
-/**
- *
- * @param mosq
- */
-int publish_timesync_sample(struct mosquitto *mosq)
-{
-	return publish_timesync(mosq);
-}
-
-/**
- *
- * @param mosq
- */
-int publish_textview_add_sample(struct mosquitto *mosq)
-{
-	Text_List textList[2] = {0};
-
-	for(int idx=0;idx<ARRAY_SIZE(textList);idx++)
-	{
-		if (idx == 0) {
-			textList[idx].layout_x = 10;//(rand()%800+100);
-			textList[idx].layout_y = 10;//(rand()%800+100);
-		} else {
-			textList[idx].layout_x = (rand() % 800 + 100);;//(rand()%800+100);
-			textList[idx].layout_y = (rand() % 800 + 100);;//(rand()%800+100);
-		}
-		textList[idx].textviewIndex = idx;
-		sprintf(textList[idx].textString, "%08d", (rand() % 99999999 + 10000000));
-		sprintf(textList[idx].textFont, FONT_ARIAL);
-		sprintf(textList[idx].textStyle, FONT_STYLE_NORMAL);
-		textList[idx].textSize = FONT_SIZE_20PX;
-	}
-
-	return publish_textview_add(mosq, textList, ARRAY_SIZE(textList));
-}
-
-/**
- *
- * @param mosq
- */
-int publish_imageview_add_sample(struct mosquitto *mosq)
-{
-	Image_List imageList[15] = {0};
-
-	for(int idx=0;idx<ARRAY_SIZE(imageList);idx++)
-	{
-		imageList[idx].imageviewIndex = idx;
-		imageList[idx].imgsrc_addr = idx;
-		imageList[idx].layout_x = (rand()%800+100);
-		imageList[idx].layout_y = (rand()%800+100);
-		imageList[idx].width = (rand()%100+150);
-		imageList[idx].height = (rand()%100+150);
-
-	}
-
-	return publish_imageview_add(mosq, imageList, ARRAY_SIZE(imageList));
-}
-
-/**
- *
- * @param mosq
- */
-int publish_videoview_add_sample(struct mosquitto *mosq)
-{
-	Video_List videoList[2] = {0};
-
-	for(int idx=0;idx<ARRAY_SIZE(videoList);idx++)
-	{
-		videoList[idx].videoviewIndex = idx;
-		videoList[idx].videosrc_addr = 11;//(rand()%10+0);
-		videoList[idx].layout_x = 100;//(rand()%800+100);
-		videoList[idx].layout_y = 100;//(rand()%800+100);
-		videoList[idx].width = 900;//(rand()%800+100);
-		videoList[idx].height = 600;//(rand()%800+100);
-	}
-
-	return publish_videoview_add(mosq, videoList, ARRAY_SIZE(videoList));
-}
-
-/**
- *
- * @param mosq
- */
-int publish_qr_code_image(struct mosquitto *mosq)
-{
-	QrCode_List qrCodeList[2] = {0};
-
-	for(int idx=0;idx<ARRAY_SIZE(qrCodeList);idx++)
-	{
-		qrCodeList[idx].qrCodeIndex = idx;
-		sprintf((char*)qrCodeList[idx].qrCodeContent, "djsalkdjskjslkdjsalkdjslkdjsalkdjsal");
-		sprintf((char*)qrCodeList[idx].errorCorrection, "M");
-		qrCodeList[idx].layout_x = 100;//(rand()%800+100);
-		qrCodeList[idx].layout_y = 100;//(rand()%800+100);
-		qrCodeList[idx].width = (rand()%800+100);
-		qrCodeList[idx].height = (rand()%800+100);
-	}
-
-	return publish_qrcodeimage_add(mosq, qrCodeList, ARRAY_SIZE(qrCodeList));
-}
-
-/**
- *
- * @param mosq
- */
-int publish_view_remove_sample(struct mosquitto *mosq)
-{
-	Text_List textList[2] = {0};
-	Image_List imageList[2] = {0};
-	Video_List videoList[2] = {0};
-	QrCode_List qrCodeList[2] = {0};
-
-	// Remove text view
-	for(int idx=0;idx<ARRAY_SIZE(textList);idx++)
-	{
-		textList[idx].textviewIndex = idx;
-	}
-
-	// Remove image view
-	for(int idx=0;idx<ARRAY_SIZE(imageList);idx++)
-	{
-		imageList[idx].imageviewIndex = idx;
-	}
-
-	// Remove video view
-	for(int idx=0;idx<ARRAY_SIZE(videoList);idx++)
-	{
-		videoList[idx].videoviewIndex = idx;
-	}
-
-	// Remove qrCode view
-	for(int idx=0;idx<ARRAY_SIZE(qrCodeList);idx++)
-	{
-		qrCodeList[idx].qrCodeIndex = idx;
-	}
-
-	return publish_view_remove(mosq, textList, ARRAY_SIZE(textList), imageList, ARRAY_SIZE(imageList), videoList, ARRAY_SIZE(videoList), qrCodeList, ARRAY_SIZE(qrCodeList));
-}
-
-/**
- *
- * @param mosq
- */
-int publish_clear_screen_sample(struct mosquitto *mosq)
-{
-	return publish_clear_screen(mosq);
-}
-
-/**
- *
- * @param mosq
- * @return
- */
-int publish_audio_volume_sample(struct mosquitto *mosq)
-{
-	return publish_audio_volume(mosq, 50);
-}
-
-/**
- *
- * @param mosq
- * @return
- */
-int publish_trigger_report_status_sample(struct mosquitto *mosq)
-{
-	return publish_trigger_report_status(mosq);
-}
-
-/**
- *
- * @return
- */
-int main(void)
-{
-	struct mosquitto *mosq;
-	int result;
-
-	//===========================================
-	// Initial share memory
-	//===========================================
-	if(CreateAllCsuShareMemory() == FAIL)
-	{
-		DEBUG_ERROR("CreateAllCsuShareMemory NG\n");
-
-		sleep(5);
-		return FAIL;
-	}
-	else
-	{
-		DEBUG_INFO("Share memory initial OK.\n");
-	}
-
-	MappingGunChargingInfo("LCM Wistron Control Task");
-
-	//===========================================
-	// Start mosquitto broker
-	//===========================================
-	system("killall mosquitto");
-	sleep(1);
-	system("/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf -d");
-	DEBUG_INFO("Broker target: %s:%d\n", BROKER_ADDRESS, BROKER_PORT);
-
-	//===========================================
-	// Initialize mosquitto library
-	//===========================================
-	mosquitto_lib_init();
-
-	//===========================================
-	// Initialize subscriber callback
-	//===========================================
-	if(fork())
-	{
-		DEBUG_INFO("Initialize subscribe callback function.\n");
-		result = mosquitto_subscribe_callback(on_message,
-											  NULL,
-											  "client/#",
-											  QOS_ENSURE_BROKER,
-											  BROKER_ADDRESS,
-											  BROKER_PORT,
-											  NULL,
-											  TIMEOUT_KEEPALIVE,
-											  true,
-											  LOGIN_USER,
-											  LOGIN_PASSWD,
-											  NULL,
-											  NULL);
-		if(result)DEBUG_ERROR("Subscribe initialization error: %s\n", mosquitto_strerror(result));
-
-		return -1;
-	}
-
-	//===========================================
-	// Initialize publisher client instance
-	//===========================================
-	DEBUG_INFO("Initialize publisher from host side.\n");
-	mosq = mosquitto_new(NULL, true, NULL);
-	if(mosq == NULL)
-	{
-		DEBUG_ERROR("Publisher initialization error: Out of memory.\n");
-		return -1;
-	}
-	mosquitto_connect_callback_set(mosq, on_connect);
-	mosquitto_disconnect_callback_set(mosq, on_disconnect);
-	mosquitto_publish_callback_set(mosq, on_publish);
-
-	//===========================================
-	// Publisher connect to broker
-	//===========================================
-	DEBUG_INFO("Publisher connect to broker.\n");
-	result = mosquitto_connect(mosq, BROKER_ADDRESS, BROKER_PORT, TIMEOUT_KEEPALIVE);
-	if(result != MOSQ_ERR_SUCCESS)
-	{
-		mosquitto_destroy(mosq);
-		DEBUG_ERROR("Connect broker error: %s\n", mosquitto_strerror(result));
-		return -1;
-	}
-
-	//===========================================
-	// Publisher start loop
-	//===========================================
-	DEBUG_INFO("Publisher loop start.\n");
-	result = mosquitto_loop_start(mosq);
-	if(result != MOSQ_ERR_SUCCESS)
-	{
-		mosquitto_destroy(mosq);
-		DEBUG_ERROR("MQTT loop start initialization error: %s\n", mosquitto_strerror(result));
-		return -1;
-	}
-
-	DEBUG_INFO("Module_LcmControl_Wistron initialized.\n");
-	system("ifconfig lo up&");
-	//===========================================
-	// Main loop
-	//===========================================
-	for(;;)
-	{
-#ifndef TEST_MODE
-		struct ChargingInfoData *targetChargingInfoData;
-		uint8_t tempIndex;
-		static struct PREVIOUS_DATA
-		{
-			uint8_t gun_selected;
-			uint8_t SystemStatus;
-		}previousData;
-
-		// Get selected gun info
-		switch(gunType[ShmSysConfigAndInfo->SysInfo.CurGunSelected])
-		{
-			case GUN_TYPE_CHAdeMO:
-				if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
-				{
-					tempIndex = ((ShmSysConfigAndInfo->SysInfo.CurGunSelected==2) ? 1: 0);
-				}
-				else
-				{
-					tempIndex = ShmSysConfigAndInfo->SysInfo.CurGunSelected;
-				}
-
-				for (int index = 0; index < CHAdeMO_QUANTITY; index++)
-				{
-					if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
-					{
-						targetChargingInfoData = &ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index];
-					}
-				}
-				break;
-
-			case GUN_TYPE_CCS:
-				if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
-				{
-					tempIndex = ((ShmSysConfigAndInfo->SysInfo.CurGunSelected==2) ? 1: 0);
-				}
-				else
-				{
-					tempIndex = ShmSysConfigAndInfo->SysInfo.CurGunSelected;
-				}
-
-				for (int index = 0; index < CCS_QUANTITY; index++)
-				{
-					if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
-					{
-						targetChargingInfoData = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[index];
-					}
-				}
-				break;
-
-			case GUN_TYPE_GBT:
-				if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
-				{
-					tempIndex = ((ShmSysConfigAndInfo->SysInfo.CurGunSelected==2) ? 1: 0);
-				}
-				else
-				{
-					tempIndex = ShmSysConfigAndInfo->SysInfo.CurGunSelected;
-				}
-
-				for (int index = 0; index < GB_QUANTITY; index++)
-				{
-					if(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
-					{
-						targetChargingInfoData = &ShmSysConfigAndInfo->SysInfo.GbChargingData[index];
-					}
-				}
-				break;
-
-			case GUN_TYPE_DO:
-				tempIndex = ShmSysConfigAndInfo->SysInfo.CurGunSelected;
-
-				for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
-				{
-					if(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
-					{
-						targetChargingInfoData = &ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData;
-					}
-				}
-				break;
-
-			case GUN_TYPE_AC:
-				if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
-				{
-					tempIndex = 2;
-				}
-				else
-				{
-					tempIndex = ShmSysConfigAndInfo->SysInfo.CurGunSelected;
-				}
-
-				for (int index = 0; index < AC_QUANTITY; index++)
-				{
-					if(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
-					{
-						targetChargingInfoData = &ShmSysConfigAndInfo->SysInfo.AcChargingData[index];
-					}
-				}
-
-				break;
-
-			case GUN_TYPE_UNKNOWN:
-			default:
-				break;
-		}
-
-		// If selected gun or system status changed, clear page all content
-		if((previousData.gun_selected != ShmSysConfigAndInfo->SysInfo.CurGunSelected) ||
-		   (previousData.SystemStatus != targetChargingInfoData->SystemStatus))
-		{
-			publish_clear_screen(mosq);
-			previousData.gun_selected = ShmSysConfigAndInfo->SysInfo.CurGunSelected;
-			previousData.SystemStatus = targetChargingInfoData->SystemStatus;
-		}
-
-		// Display page content depend on selected gun system status
-		switch(targetChargingInfoData->SystemStatus)
-		{
-			case SYS_MODE_BOOTING:
-				page_Booting(targetChargingInfoData);
-
-				break;
-
-			case SYS_MODE_IDLE:
-				page_Idle(targetChargingInfoData);
-
-				break;
-
-			case SYS_MODE_AUTHORIZING:
-				page_Authorizing(targetChargingInfoData);
-
-				break;
-
-			case SYS_MODE_PREPARING:
-				page_Preparing(targetChargingInfoData);
-				break;
-
-			case SYS_MODE_CHARGING:
-				page_Charging(targetChargingInfoData);
-				break;
-
-			case SYS_MODE_TERMINATING:
-				page_Terminating(targetChargingInfoData);
-				break;
-
-			case SYS_MODE_COMPLETE:
-				page_Complete(targetChargingInfoData);
-				break;
-
-			case SYS_MODE_RESERVATION:
-				page_Reservation(targetChargingInfoData);
-				break;
-
-			case SYS_MODE_MAINTAIN:
-				page_Maintain(targetChargingInfoData);
-				break;
-
-			case SYS_MODE_UPDATE:
-				page_Update(targetChargingInfoData);
-				break;
-
-			case SYS_MODE_ALARM:
-			case SYS_MODE_FAULT:
-				page_AlarmFault(targetChargingInfoData);
-				break;
-
-			default:
-				page_Unknown(targetChargingInfoData);
-				break;
-		}
-#else
-		// For test command
-		char cmd[128];
-
-		system("clear");
-		memset(cmd, 0x00, ARRAY_SIZE(cmd));
-		printf("\n ===== main menu ==================================");
-		printf("\n  1: publish_profile_sample.");
-		printf("\n  2: publish_upgrade_sample.");
-		printf("\n  3: publish_restart_sample.");
-		printf("\n  4: publish_power_saving_sample.");
-		printf("\n  5: publish_back_dimming_sample.");
-		printf("\n  6: publish_timesync.");
-		printf("\n  7: publish_textview_add_sample.");
-		printf("\n  8: publish_imageview_add_sample.");
-		printf("\n  9: publish_videoview_add_sample.");
-		printf("\n  10: publish_view_remove_sample.");
-		printf("\n  11: publish_clear_screen.");
-		printf("\n  12: publish_audio_volume.");
-		printf("\n  13: publish_trigger_report_status.");
-		printf("\n  14: publish_qr_code_image.");
-		printf("\n ==================================================");
-		printf("\n  Please input item to test: ");
-		scanf("%s", &cmd[0]);
-
-		switch(atoi(cmd))
-		{
-			case 1:
-				publish_profile_sample(mosq);
-				break;
-			case 2:
-				publish_upgrade_sample(mosq);
-				break;
-			case 3:
-				publish_restart_sample(mosq);
-				break;
-			case 4:
-				publish_power_saving_sample(mosq);
-				break;
-			case 5:
-				publish_back_dimming_sample(mosq);
-				break;
-			case 6:
-				publish_timesync_sample(mosq);
-				break;
-			case 7:
-				publish_textview_add_sample(mosq);
-				break;
-			case 8:
-				publish_imageview_add_sample(mosq);
-				break;
-			case 9:
-				publish_videoview_add_sample(mosq);
-				break;
-			case 10:
-				publish_view_remove_sample(mosq);
-				break;
-			case 11:
-				publish_clear_screen_sample(mosq);
-				break;
-			case 12:
-				publish_audio_volume_sample(mosq);
-				break;
-			case 13:
-				publish_trigger_report_status_sample(mosq);
-				break;
-			case 14:
-				publish_qr_code_image(mosq);
-				break;
-		}
-#endif
-
-		usleep(500000);
-	}
-
-	mosquitto_lib_cleanup();
-
-	return -1;
-}
+/*
+ * Module_LcmControl_Wistron.c
+ *
+ *  Created on: 2022/07/01
+ *      Author: folus
+ */
+
+#include "Module_LcmControl_Wistron.h"
+#include "../Log/log.h"
+#include "../ShareMemory/shmMem.h"
+#include "../Define/define.h"
+#include "../Config.h"
+#include "../SelectGun/SelectGun.h"
+#include "../timeout.h"
+#include "../CSU/main.h"
+
+#define UI_FW_VERSION "v0.0.1"
+
+static struct SysConfigData* pSysConfig = NULL;
+static struct SysInfoData* pSysInfo = NULL;
+static struct WARNING_CODE_INFO* pSysWarning = NULL;
+
+static struct FanModuleData* ShmFanModuleData;
+static struct PrimaryMcuData* ShmPrimaryMcuData;
+static SelectGunInfo* ShmSelectGunInfo = NULL;
+static struct ChargingInfoData* pDcChargingInfo = NULL;
+static DcCommonInfo* ShmDcCommonData = NULL;
+uint8_t currentPage;
+//ParsingRatedCur modelnameInfo	= {0};
+uint8_t gunType[4] 				= {0};
+uint8_t lang_select;
+struct timespec	timer[TMR_IDX_CNT];
+uint8_t left_status, right_status;
+bool is_update = FALSE;
+int is_change = FALSE;
+uint8_t is_plug0, is_plug1;
+int backlight = BRIGHTNESS_LEVEL_11;
+uint8_t lcm_status = 0;
+unsigned long GetTimeoutValue(struct timespec _start_time)
+{
+	struct timespec ts_end;
+	unsigned long ret = 0;
+
+	clock_gettime(CLOCK_MONOTONIC, &ts_end);
+
+	ret = ((unsigned long)(ts_end.tv_sec - _start_time.tv_sec) * 1000000) + ((unsigned long)((ts_end.tv_nsec / 1000) - (_start_time.tv_nsec / 1000)));
+
+	return ret;
+}
+
+/**
+ *
+ * @param data
+ * @param length
+ * @return
+ */
+uint32_t crc32(uint8_t *data, uint32_t length)
+{
+	uint32_t crc=0xFFFFFFFF;
+
+	for(size_t i=0;i<length;i++)
+	{
+		char ch=data[i];
+		for(size_t j=0;j<8;j++)
+		{
+			uint32_t b=(ch^crc)&1;
+
+			crc>>=1;
+
+			if(b) crc=crc^0xEDB88320;
+
+			ch>>=1;
+		}
+	}
+
+	return ~crc;
+}
+static bool canStartCharging(void)
+{
+	uint8_t index = 0;
+	char buf2[16] = "";
+	memset(buf2, 0, ARRAY_SIZE(buf2));
+	struct OCPP16Data* ShmOCPP16Data = (struct OCPP16Data*)GetShmOCPP16Data();
+
+	for (index = 0; index < strlen((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status); index++) {
+		sprintf(buf2 + (index - 1) * 2, "%02X", ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status[index]);
+	}
+	sprintf(buf2, "%s", ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status);
+
+	// 因為無法得知實際的長度,所以只能用搜尋的方式
+	if (strcmp(buf2, "Accepted") == EQUAL) {
+		return true;
+	}
+
+	return false;
+}
+/**
+ *
+ * @param filename
+ * @return
+ */
+uint32_t getFileCrc32(char *filename)
+{
+	uint32_t result = 0;
+
+	int fd = open(filename, O_RDONLY);
+    if(fd < 0)
+    {
+        DEBUG_ERROR("Can not open file %s\n", filename);
+    }
+    else
+    {
+    	struct stat st;
+		stat(filename, &st);
+		uint8_t *data;
+		data = malloc(st.st_size);
+
+		if(read(fd,data,st.st_size) == st.st_size)
+		{
+			result = crc32(data, st.st_size);
+			close(fd);
+		} else {
+			DEBUG_ERROR("Read file Error %d\n", st.st_size);
+		}
+
+		free(data);
+    }
+
+	return result;
+}
+
+/**
+ *
+ * @param timer
+ */
+void refreshStartTimer(struct timespec *timer)
+{
+	clock_gettime(CLOCK_MONOTONIC, timer);
+}
+
+void string2ByteArray(uint8_t* input, uint8_t* output)
+{
+	int loop;
+	int i;
+
+	loop = 0;
+	i = 0;
+
+	while (input[loop] != '\0') {
+		output[i++] = input[loop++];
+	}
+	output[loop] = '\0';
+}
+void clearWarmingCode(struct mosquitto* mosq,int count)
+{
+	Image_List imageList[5] = { 0 };
+	Text_List textList[5] = { 0 };
+	Video_List videoList[1] = { 0 };
+	QrCode_List qrCodeList[1] = { 0 };
+	for (int i = count; i < 5; i++) {
+		imageList[i].imageviewIndex = _icon_warming + ICON_INDEX_SHIFT + i;
+		textList[i].textviewIndex = _text_warming0 + i;
+		publish_view_remove(mosq, textList, ARRAY_SIZE(textList), imageList, ARRAY_SIZE(imageList), videoList, ARRAY_SIZE(videoList), qrCodeList, ARRAY_SIZE(qrCodeList));
+		//publish_view_remove(mosq);
+	}
+}
+void ChangeWarningFunc(struct mosquitto* mosq)
+{
+	uint8_t cmd[7] = { 0 };
+	uint8_t i = 0;
+	Image_List imageList[5] = { 0 };
+	Text_List textList[5] = { 0 };
+	//uint8_t j = 0;
+	//log_info("ChangeWarningFunc ");
+	// 最多一次五筆
+	//clearWarmingCode(mosq, 5);
+	//log_info("LCM PageIndex = %d ", pSysWarning->PageIndex);
+	//log_info("WarningCount = %d ", pSysWarning->WarningCount);
+	for (i = 0; (i + pSysWarning->PageIndex * 5) < pSysWarning->WarningCount; i++) {
+		//log_info("Warming Code[%d]:%s", i, &pSysWarning->WarningCode[i][0]);
+		memset(cmd, 0x00, sizeof(cmd));
+		if ((i) >= 5) {
+			break;
+		}
+		//error code
+		string2ByteArray(&pSysWarning->WarningCode[i + pSysWarning->PageIndex * 5][0], cmd);
+
+		imageList[i].imgsrc_addr = _icon_warming;
+		imageList[i].imageviewIndex = _icon_warming+ ICON_INDEX_SHIFT+i;
+		imageList[i].layout_x = 30 + i * 100;
+		imageList[i].layout_y = 626;
+		imageList[i].width = 21;
+		imageList[i].height = 18;
+
+		textList[i].textviewIndex = _text_warming0 + i;
+		textList[i].layout_x = 45 + i * 100;
+		textList[i].layout_y = 622;
+		textList[i].color_r = 0;
+		textList[i].color_g = 0;
+		textList[i].color_b = 0;
+		textList[i].width = 80;
+		textList[i].alignment = ALIGNMENT_CENTER;
+		sprintf(textList[i].textString, cmd);
+		sprintf(textList[i].textFont, FONT_ARIAL);
+		sprintf(textList[i].textStyle, FONT_STYLE_BOLD);
+		textList[i].textSize = 12;
+
+	}
+	publish_imageview_add(mosq, imageList, ARRAY_SIZE(imageList));
+	publish_textview_add(mosq, textList, ARRAY_SIZE(textList));
+	for (; i < 5; i++) {
+		clearWarmingCode(mosq, i);
+	}
+}
+
+/**
+ *
+ * @param timer
+ * @return
+ */
+int getDiffSecNow(struct timespec timer)
+{
+	struct timespec timerNow;
+
+	clock_gettime(CLOCK_MONOTONIC, &timerNow);
+
+	return (int)((((unsigned long)(timerNow.tv_sec - timer.tv_sec) * 1000) + ((unsigned long)((timerNow.tv_nsec / 1000000) - (timer.tv_nsec / 1000000))))/1000);
+}
+void SetIDLE(int gunIndex)
+{
+	log_info("Set Gun%d to IDLE", gunIndex);
+	pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(gunIndex);
+	pDcChargingInfo->SystemStatus = S_IDLE;
+	strcpy((char*)pSysConfig->UserId, "");
+	StopSystemTimeoutDet();
+	pSysInfo->SystemPage = _PAGE_VIEW;
+}
+void GetClockTime(struct timespec* _now_time, void* null)
+{
+	clock_gettime(CLOCK_MONOTONIC, _now_time);
+}
+void StartSystemTimeoutDet(uint8_t flag)
+{
+	if (pSysInfo->SystemTimeoutFlag != flag) {
+		//log_info("Set System Timeout Flag %d", flag);
+		GetClockTime(&pSysInfo->SystemTimeoutTimer, NULL);
+	}
+	pSysInfo->SystemTimeoutFlag = flag;
+}
+void StopSystemTimeoutDet(void)
+{
+	GetClockTime(&pSysInfo->SystemTimeoutTimer, NULL);
+	pSysInfo->SystemTimeoutFlag = Timeout_None;
+}
+void confirmSelGun(uint8_t selGun)
+{
+	if (selGun == LEFT_GUN_NUM) {
+		ShmSelectGunInfo->SelGunInfo.LeftGun = SEL_GUN_CONFIRM;
+		//printf("confirmSelGun left");
+	} else if (selGun == RIGHT_GUN_NUM) {
+		ShmSelectGunInfo->SelGunInfo.RightGun = SEL_GUN_CONFIRM;
+		//printf("confirmSelGun right");
+	}
+}
+void ClearDetectPluginFlag(int gunIndex)
+{
+	pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(gunIndex);
+
+	if (pDcChargingInfo->RemoteStartFlag == YES) {
+		pDcChargingInfo->RemoteStartFlag = NO;
+	}
+	ShmDcCommonData->pGunInfo[gunIndex].WaitForPlugit = NO;
+
+
+	if (pSysInfo->OrderCharging != NO_DEFINE) {
+		pSysInfo->OrderCharging = NO_DEFINE;
+	}
+}
+void LeftBtnPress()
+{
+	switch (pSysInfo->SystemPage) {
+	case _PAGE_VIEW:
+		pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(LEFT_GUN_NUM);
+
+		switch (pDcChargingInfo->SystemStatus) {
+		case S_IDLE:
+			ClearDetectPluginFlag(LEFT_GUN_NUM);
+			strcpy((char*)pSysConfig->UserId, "");
+			pSysInfo->SystemPage = _PAGE_SELECT_PAY;
+			pSysInfo->CurGunSelected = LEFT_GUN_NUM;
+			confirmSelGun(LEFT_GUN_NUM);
+			pDcChargingInfo->SystemStatus = S_AUTHORIZING;
+			break;
+		case S_AUTHORIZING:
+			if (ShmDcCommonData->pGunInfo[LEFT_GUN_NUM].WaitForPlugit) {
+				pDcChargingInfo->SystemStatus = S_IDLE;
+			}
+			break;
+		case S_REASSIGN_CHECK:
+		case S_REASSIGN:
+		case S_PREPARNING:
+		case S_PREPARING_FOR_EV:
+		case S_PREPARING_FOR_EVSE:
+		case S_CCS_PRECHARGE_ST0:
+		case S_CCS_PRECHARGE_ST1:
+		case S_CHARGING:
+			if (pSysConfig->StopChargingByButton) {
+				pDcChargingInfo->SystemStatus = S_TERMINATING;
+			} else {
+				pSysInfo->CurGunSelected = LEFT_GUN_NUM;
+				pSysInfo->SystemPage = _PAGE_STOP_CHARGING;
+				strcpy((char*)pSysConfig->UserId, "");
+				StartSystemTimeoutDet(Timeout_ReturnViewPage);
+			}
+			break;
+		case S_TERMINATING:
+		case S_COMPLETE:
+		case S_ALARM:
+			pSysInfo->CurGunSelected = LEFT_GUN_NUM;
+			pSysInfo->SystemPage = _PAGE_SUMMARY;
+			break;
+		}
+		break;
+	case _PAGE_LANGUAGE:
+		if (ShmDcCommonData->language > 0)
+			ShmDcCommonData->language--;
+		else {
+			ShmDcCommonData->language = 0;
+		}
+		break;
+	case _PAGE_AUTHORIZE_FAIL:
+		SetIDLE(pSysInfo->CurGunSelected);
+
+		break;
+	case _PAGE_HELP:
+		log_info("Change Help Page to %d", ShmDcCommonData->previousPage);
+		pSysInfo->SystemPage = ShmDcCommonData->previousPage;
+		StopSystemTimeoutDet();
+		break;
+	case _PAGE_ALARM:
+		pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(pSysInfo->CurGunSelected);
+		if (!pDcChargingInfo->ConnectorPlugIn) {
+			SetIDLE(pSysInfo->CurGunSelected);
+		} else {
+			pSysInfo->SystemPage = _PAGE_VIEW;
+		}
+		break;
+	case _PAGE_SUMMARY:
+		pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(pSysInfo->CurGunSelected);
+		if (!pDcChargingInfo->ConnectorPlugIn) {
+			SetIDLE(pSysInfo->CurGunSelected);
+		} else {
+			pSysInfo->SystemPage = _PAGE_VIEW;
+		}
+		break;
+	case _PAGE_STOP_CHARGING:
+		pSysInfo->SystemPage = _PAGE_VIEW;
+		StopSystemTimeoutDet();
+		break;
+	case _PAGE_PLUGIN_FAIL:
+		SetIDLE(pSysInfo->CurGunSelected);
+		break;
+	}
+}
+void RightBtnPress()
+{
+	switch (pSysInfo->SystemPage) {
+	case _PAGE_VIEW:
+		pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(RIGHT_GUN_NUM);
+		switch (pDcChargingInfo->SystemStatus) {
+		case S_IDLE:
+			pSysInfo->SystemPage = _PAGE_SELECT_PAY;
+			pSysInfo->CurGunSelected = RIGHT_GUN_NUM;
+			strcpy((char*)pSysConfig->UserId, "");
+			confirmSelGun(RIGHT_GUN_NUM);
+			pDcChargingInfo->SystemStatus = S_AUTHORIZING;
+			break;
+		case S_AUTHORIZING:
+			if (ShmDcCommonData->pGunInfo[RIGHT_GUN_NUM].WaitForPlugit) {
+				pDcChargingInfo->SystemStatus = S_IDLE;
+			}
+			break;
+		case S_REASSIGN_CHECK:
+		case S_REASSIGN:
+		case S_PREPARNING:
+		case S_PREPARING_FOR_EV:
+		case S_PREPARING_FOR_EVSE:
+		case S_CCS_PRECHARGE_ST0:
+		case S_CCS_PRECHARGE_ST1:
+		case S_CHARGING:
+			if (pSysConfig->StopChargingByButton) {
+				pDcChargingInfo->SystemStatus = S_TERMINATING;
+			} else {
+				pSysInfo->CurGunSelected = RIGHT_GUN_NUM;
+				pSysInfo->SystemPage = _PAGE_STOP_CHARGING;
+				strcpy((char*)pSysConfig->UserId, "");
+				StartSystemTimeoutDet(Timeout_ReturnViewPage);
+			}
+			break;
+		case S_TERMINATING:
+		case S_COMPLETE:
+		case S_ALARM:
+			pSysInfo->CurGunSelected = RIGHT_GUN_NUM;
+			pSysInfo->SystemPage = _PAGE_SUMMARY;
+			break;
+		}
+		break;
+	case _PAGE_LANGUAGE:
+		if (ShmDcCommonData->language < 5 )
+			ShmDcCommonData->language++;
+		else {
+			ShmDcCommonData->language = 5;
+		}
+		break;
+	case _PAGE_SELECT_PAY:
+		SetIDLE(pSysInfo->CurGunSelected);
+		break;
+	}
+}
+void CenterBtnPress()
+{
+	int is_idle = TRUE;
+	for (int i = 0; i < pSysConfig->TotalConnectorCount; i++) {
+		pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(i);
+		if (pDcChargingInfo->SystemStatus != S_IDLE)
+			is_idle = FALSE;
+	}
+	if (pSysInfo->SystemPage != _PAGE_LANGUAGE && pSysInfo->SystemPage != _PAGE_SELECT_PAY)
+		StartSystemTimeoutDet(Timeout_helpPage);
+
+	switch (pSysInfo->SystemPage) {
+	case _PAGE_VIEW:
+		if (is_idle) {
+			pSysInfo->SystemPage = _PAGE_LANGUAGE;
+			StartSystemTimeoutDet(Timeout_LanguagePage);
+		} else
+			pSysInfo->SystemPage = _PAGE_HELP;
+		break;
+	case _PAGE_SELECT_PAY:
+		pSysInfo->SystemPage = _PAGE_LANGUAGE;
+		StartSystemTimeoutDet(Timeout_LanguagePage);
+		break;
+	case _PAGE_LANGUAGE:
+		StopSystemTimeoutDet();
+		if (is_idle)
+			pSysInfo->SystemPage = _PAGE_VIEW;
+		else
+			pSysInfo->SystemPage = _PAGE_SELECT_PAY;
+		break;
+	case _PAGE_AUTHORIZE_FAIL:
+		pSysInfo->SystemPage = _PAGE_HELP;
+		break;
+	}
+}
+
+
+void CheckTouch(char* Type,int TouchIdx)
+{
+	int BTN = _BTN_NONE;
+	//log_info("Touch Type:%s Touch ID:%d",Type,TouchIdx);
+
+	if ( strcmp(Type,"text") == EQUAL ) {
+		// Left Button
+		if (TouchIdx == _text_leftbtn) {
+			BTN = _LEFT_BTN_PRESS;
+		}
+		// Center Button
+		if (TouchIdx == _text_centerbtn) {
+			BTN = _CENTER_BTN_PRESS;
+		}
+		// Right Button
+		if (TouchIdx == _text_rightbtn) {
+			BTN = _RIGHT_BTN_PRESS;
+		}
+		if (pSysInfo->SystemPage == _PAGE_LANGUAGE) {
+			if (TouchIdx >= _text_language0 && (TouchIdx <= (_text_language0 + 5))) {
+				BTN = _LANGUAGE0_PRESS + (TouchIdx - _text_language0);
+			}
+		}
+	} else if (strcmp(Type, "image") == EQUAL) {
+		// Left Button
+		if (TouchIdx == _icon_left_gun_CCS1 ||
+			TouchIdx == _icon_left_gun_CCS2 ||
+			TouchIdx == _icon_left_gun_CHAdeMo ||
+			TouchIdx == _btn_left_gun ||
+			TouchIdx == _btn_home ||
+			TouchIdx == _btn_return ||
+			TouchIdx == _btn_leftstop) {
+			BTN = _LEFT_BTN_PRESS;
+		}
+		// Center Button
+		if (TouchIdx == _btn_center ||
+			TouchIdx == _btn_language ||
+			TouchIdx == _btn_select) {
+			BTN = _CENTER_BTN_PRESS;
+		}
+		// Right Button
+		if (TouchIdx == _icon_right_gun_CCS1 ||
+			TouchIdx == _icon_right_gun_CCS2 ||
+			TouchIdx == _icon_right_gun_CHAdeMo ||
+			TouchIdx == _btn_right_gun ||
+			TouchIdx == _btn_cancel ||
+			TouchIdx == _btn_rightstop) {
+			BTN = _RIGHT_BTN_PRESS;
+		}
+		if (pSysInfo->SystemPage == _PAGE_LANGUAGE) {
+			if (TouchIdx >= _icon_lang_select && (TouchIdx <= (_icon_lang_select + 5))) {
+				BTN = _LANGUAGE0_PRESS + (TouchIdx - _icon_lang_select);
+			}
+		}
+		if (pSysInfo->SystemPage == _PAGE_MAINTAIN) {
+			if (TouchIdx == _icon_fix)
+				ShmDcCommonData->SDUPATENUM++;
+			else
+				ShmDcCommonData->SDUPATENUM = 0;
+			//log_info("SDUPATENUM:%d", ShmDcCommonData->SDUPATENUM);
+		}
+	}
+
+	if (BTN == _BTN_NONE) {
+		return;
+	}
+	if (pSysInfo->SystemPage == _PAGE_LANGUAGE) {
+		StopSystemTimeoutDet();
+		StartSystemTimeoutDet(Timeout_LanguagePage);
+	}
+
+
+	switch (BTN) {
+	case _LEFT_BTN_PRESS:
+		log_info("left button press ............");
+		LeftBtnPress();
+		break;
+	case _RIGHT_BTN_PRESS:
+		log_info("right button press ............");
+		RightBtnPress();
+		break;
+	case _CENTER_BTN_PRESS:
+		log_info("center button press ............");
+		CenterBtnPress();
+		break;
+	case _LANGUAGE0_PRESS:
+	case _LANGUAGE1_PRESS:
+	case _LANGUAGE2_PRESS:
+	case _LANGUAGE3_PRESS:
+	case _LANGUAGE4_PRESS:
+	case _LANGUAGE5_PRESS:
+		log_info("language%d button press ............", BTN - _LANGUAGE0_PRESS);
+		ShmDcCommonData->language = BTN - _LANGUAGE0_PRESS;
+		break;
+	}
+}
+
+/**
+ *
+ * @param mosq
+ * @param userdata
+ * @param msg
+ * @return
+ */
+int on_message(struct mosquitto *mosq, void *userdata, const struct mosquitto_message *msg)
+{
+	json_object *payload;
+	int touch_idx;
+	char touch_type[10];
+	payload = json_tokener_parse(msg->payload);
+	struct StatusCodeData* ShmStatusCodeData = (struct StatusCodeData*)GetShmStatusCodeData();
+	ShmDcCommonData = (DcCommonInfo*)GetShmDcCommonData();
+	if(!is_error(payload))
+	{
+		/*
+		 *	TODO:
+		 *		1. Process message depend on receive topic
+		 *		2. Message maybe could define as JSON format
+		 */
+		if (strstr(msg->topic, "client/connect"))
+		{
+			sprintf((char*)clientInfo.verHW, "%s", json_object_get_string(json_object_object_get(payload, "HW_version")));
+			sprintf((char*)clientInfo.verFW_OS, "%s", json_object_get_string(json_object_object_get(payload, "FW_version_OS")));
+			sprintf((char*)clientInfo.verFW_APK, "%s", json_object_get_string(json_object_object_get(payload, "FW_version_APK")));
+			sprintf((char*)clientInfo.verFW_UI, "%s", json_object_get_string(json_object_object_get(payload, "FW_version_UI")));
+			sprintf((char*)clientInfo.macAddr, "%s", json_object_get_string(json_object_object_get(payload, "MAC_addr")));
+			//sprintf((char*)clientInfo.orientation, "%s", json_object_get_string(json_object_object_get(payload, "Orientation")));
+
+			DEBUG_INFO("HW_version: %s\n", clientInfo.verHW);
+			DEBUG_INFO("FW_version_OS: %s\n", clientInfo.verFW_OS);
+			DEBUG_INFO("FW_version_APK: %s\n", clientInfo.verFW_APK);
+			DEBUG_INFO("FW_version_UI: %s\n", clientInfo.verFW_UI);
+			DEBUG_INFO("MAC_addr: %s\n", clientInfo.macAddr);
+			strcpy((char*)ShmDcCommonData->lcmmacAddr, (char*)clientInfo.macAddr);
+			//DEBUG_INFO("Orientation: %s\n", clientInfo.orientation);
+			strcpy((char*)pSysInfo->LcmHwRev, clientInfo.verFW_APK);
+		}
+		else if(strstr(msg->topic, "client/touch"))
+		{
+			if(json_object_object_get(payload, "touchlist") != NULL)
+			{
+				for(int idx=0;idx<json_object_array_length(json_object_object_get(payload, "touchlist"));idx++)
+				{
+					/*
+					DEBUG_INFO("Touch point-%d(%s-%s)=> x: %s, y: %s\n", idx,
+																  json_object_get_string(json_object_object_get(json_object_array_get_idx(json_object_object_get(payload, "touchlist"), idx), "obj_type")),
+																  json_object_get_string(json_object_object_get(json_object_array_get_idx(json_object_object_get(payload, "touchlist"), idx), "obj_onClick")),
+																  json_object_get_string(json_object_object_get(json_object_array_get_idx(json_object_object_get(payload, "touchlist"), idx), "touch_point_x")),
+																  json_object_get_string(json_object_object_get(json_object_array_get_idx(json_object_object_get(payload, "touchlist"), idx), "touch_point_y")));
+					*/
+					if (idx == 0) {
+						sprintf(touch_type, "%s", json_object_get_string(json_object_object_get(json_object_array_get_idx(json_object_object_get(payload, "touchlist"), idx), "obj_type")));
+
+						touch_idx = atoi(json_object_get_string(json_object_object_get(json_object_array_get_idx(json_object_object_get(payload, "touchlist"), idx), "obj_onClick")));
+						CheckTouch(touch_type, touch_idx);
+						ShmDcCommonData->SleepTimer = time((time_t*)NULL);
+						if (ShmDcCommonData->BlackLight != BRIGHTNESS_LEVEL_11) {
+							ShmDcCommonData->BlackLight = BRIGHTNESS_LEVEL_11;
+							publish_back_dimming(mosq, ShmDcCommonData->BlackLight);
+						}
+					}
+				}
+			}
+		}
+		else if(strstr(msg->topic, "client/info"))
+		{
+			if(json_object_object_get(payload, "status") != NULL)
+			{
+				if (lcm_status != atoi(json_object_get_string(json_object_object_get(payload, "status")))) {
+					lcm_status = atoi(json_object_get_string(json_object_object_get(payload, "status")));
+					log_info("LCM status is [%d]", lcm_status);
+				}
+
+				switch(atoi(json_object_get_string(json_object_object_get(payload, "status"))))
+				{
+					case 1:
+						//DEBUG_INFO("Status normal.\n");
+						ShmDcCommonData->lcmwatchdog = time((time_t*)NULL);
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.LcmModuleCommFail = false;
+						break;
+					case 2:
+						//DEBUG_INFO("Status downloading.\n");
+						ShmDcCommonData->_upgrade_lcm_result = _LCM_UPGRADE_RESULT_WAIT;
+
+						break;
+					case 3:
+						//DEBUG_INFO("Status uploading.\n");
+						break;
+					case 4:
+						//DEBUG_INFO("Status reboot.\n");
+						break;
+					case 5:
+						//DEBUG_INFO("Status reset.\n");
+						break;
+					case 6:
+						//DEBUG_INFO("Status sleep.\n");
+						break;
+					case 255:
+						//DEBUG_INFO("Status fault.\n");
+						if (ShmDcCommonData->_upgrade_lcm_flag || ShmDcCommonData->_upgrade_lcm_apk_flag) {
+							ShmDcCommonData->_upgrade_lcm_result = _LCM_UPGRADE_RESULT_FAIL;
+						}
+						break;
+					default:
+						//DEBUG_INFO("Unknown status.\n");
+						break;
+				}
+			}
+
+			if(json_object_object_get(payload, "temperature") != NULL)
+			{
+				DEBUG_INFO("Temperature: %s.\n", json_object_get_string(json_object_object_get(payload, "temperature")));
+			}
+
+			if(json_object_object_get(payload, "cpu_temperature") != NULL)
+			{
+				if(atof(json_object_get_string(json_object_object_get(payload, "cpu_temperature"))) > 70)
+					DEBUG_INFO("CPU temperature: %s.\n", json_object_get_string(json_object_object_get(payload, "cpu_temperature")));
+			}
+			if(json_object_object_get(payload, "ambient_light") != NULL)
+			{
+				DEBUG_INFO("Ambient Light: %s lux\n", json_object_get_string(json_object_object_get(payload, "ambient_light")));
+			}
+		}
+		else if(strstr(msg->topic, "client/profile") ||
+				strstr(msg->topic, "client/command") ||
+				strstr(msg->topic, "client/timesync") ||
+				strstr(msg->topic, "client/layout/textview") ||
+				strstr(msg->topic, "client/layout/imageview") ||
+				strstr(msg->topic, "client/layout/videoview") ||
+			    strstr(msg->topic, "client/layout/qrcodeview") ||
+				strstr(msg->topic, "client/layout/textscroll") ||
+				strstr(msg->topic, "client/layout/remove"))
+		{
+			// Skip topic publish from CSU
+		}
+		else
+		{
+			DEBUG_INFO("Unknown topic: %s\n", msg->topic);
+			DEBUG_INFO("Unknown payload: %s\n", msg->payload);
+		}
+	}
+	else
+	{
+		DEBUG_WARN("Payload is not JSON format.\n");
+	}
+	json_object_put(payload);
+	//usleep(10000);
+	return 0;
+}
+
+/**
+ *
+ * @param mosq
+ * @param obj
+ * @param reason_code
+ */
+void on_connect(struct mosquitto *mosq, void *obj, int reason_code)
+{
+	DEBUG_INFO("on_connect: %s\n", mosquitto_connack_string(reason_code));
+	if(reason_code != 0)mosquitto_disconnect(mosq);
+}
+
+/**
+ *
+ * @param mosq
+ * @param obj
+ * @param reason_code
+ */
+void on_disconnect(struct mosquitto *mosq, void *obj, int reason_code)
+{
+	DEBUG_INFO("on_disconnect: %s\n", mosquitto_connack_string(reason_code));
+	if(reason_code != 0)mosquitto_disconnect(mosq);
+}
+
+/**
+ *
+ * @param mosq
+ * @param obj
+ * @param mid
+ */
+void on_publish(struct mosquitto *mosq, void *obj, int mid)
+{}
+
+
+//==========================================================================
+// Command publish sample routine
+//==========================================================================
+/**
+ *
+ * @param mosq
+ */
+int publish_profile_sample(struct mosquitto *mosq)
+{
+	return publish_profile(mosq, PROFILE_CONNECT_TIMEOUT, "10000");
+}
+
+/**
+ *
+ * @param mosq
+ */
+int publish_upgrade_sample(struct mosquitto *mosq)
+{
+	char url[300];
+	char chkCrc32[16];
+	
+	sprintf(url, "ftp://ftpuser:ftppasswd@%s/mnt/UI_img.zip", BROKER_ADDRESS);
+	sprintf(chkCrc32, "0x%08X", getFileCrc32("/mnt/UI_img.zip"));
+	DEBUG_INFO("image file crc32: %s\n", chkCrc32);
+	DEBUG_INFO("url : %s\n", url);
+	
+	return publish_upgrade(mosq, OTA_TYPE_SDCARD, url, chkCrc32, UI_FW_VERSION);
+}
+int upgrade_lcm_ui(struct mosquitto* mosq)
+{
+	char url[300];
+	char chkCrc32[16];
+
+	sprintf(url, "ftp://ftpuser:ftppasswd@%s/mnt/BUFFER.zip", BROKER_ADDRESS);
+	sprintf(chkCrc32, "0x%08X", getFileCrc32("/mnt/BUFFER.zip"));
+	DEBUG_INFO("image file crc32: %s\n", chkCrc32);
+	DEBUG_INFO("url : %s\n", url);
+
+	return publish_upgrade(mosq, OTA_TYPE_UI, url, chkCrc32, UI_FW_VERSION);
+}
+int upgrade_lcm_apk(struct mosquitto* mosq)
+{
+	char url[300];
+	char chkCrc32[16];
+
+	sprintf(url, "ftp://ftpuser:ftppasswd@%s/mnt/evcharging.apk", BROKER_ADDRESS);
+	sprintf(chkCrc32, "0x%08X", getFileCrc32("/mnt/evcharging.apk"));
+	DEBUG_INFO("image file crc32: %s\n", chkCrc32);
+	DEBUG_INFO("url : %s\n", url);
+
+	return publish_upgrade(mosq, OTA_TYPE_APK, url, chkCrc32, UI_FW_VERSION);
+}
+int upgrade_lcm_sdcard(struct mosquitto* mosq)
+{
+	
+	char url[300];
+	char chkCrc32[16];
+	/*
+	sprintf(url, "ftp://ftpuser:ftppasswd@%s/mnt/evcharging.apk", BROKER_ADDRESS);
+	sprintf(chkCrc32, "0x%08X", getFileCrc32("/mnt/evcharging.apk"));
+	DEBUG_INFO("image file crc32: %s\n", chkCrc32);
+	DEBUG_INFO("url : %s\n", url);
+	*/
+	return publish_upgrade(mosq, OTA_TYPE_SDCARD, url, chkCrc32, UI_FW_VERSION);
+}
+/**
+ *
+ * @param mosq
+ */
+int publish_restart_sample(struct mosquitto *mosq)
+{
+	return publish_restart(mosq, TRUE);
+}
+
+/**
+ *
+ * @param mosq
+ */
+int publish_power_saving_sample(struct mosquitto *mosq)
+{
+	/*
+	publish_power_saving(mosq, TRUE, ShmDcCommonData->lcmmacAddr);
+	sleep(5);
+	publish_power_saving(mosq, FALSE, ShmDcCommonData->lcmmacAddr);
+	*/
+	return publish_power_saving(mosq, TRUE, ShmDcCommonData->lcmmacAddr);
+}
+int publish_power_saving_wake(struct mosquitto *mosq)
+{
+	/*
+	publish_power_saving(mosq, TRUE, ShmDcCommonData->lcmmacAddr);
+	sleep(5);
+	publish_power_saving(mosq, FALSE, ShmDcCommonData->lcmmacAddr);
+	*/
+	return publish_power_saving(mosq, FALSE, ShmDcCommonData->lcmmacAddr);
+}
+
+/**
+ *
+ * @param mosq
+ */
+int publish_back_dimming_sample(struct mosquitto *mosq)
+{
+	int i;
+	for (i = 0; i <= BRIGHTNESS_LEVEL_AUTO; i++) {
+		publish_back_dimming(mosq, i);
+		sleep(3);
+	}
+	return publish_back_dimming(mosq, BRIGHTNESS_LEVEL_AUTO);
+}
+
+/**
+ *
+ * @param mosq
+ */
+int publish_timesync_sample(struct mosquitto *mosq)
+{
+	return publish_timesync(mosq);
+}
+
+/**
+ *
+ * @param mosq
+ */
+int publish_textview_add_sample(struct mosquitto *mosq)
+{
+	Text_List textList[25] = { 0 };
+	//for (int i = 0; i < 10; i++) {
+		for (int idx = 0; idx < ARRAY_SIZE(textList); idx++) {
+			textList[idx].textviewIndex = idx;
+			textList[idx].layout_x = 100;
+			textList[idx].layout_y = 100 + idx * 20;
+			textList[idx].color_r = rand() % 256;
+			textList[idx].color_g = rand() % 256;
+			textList[idx].color_b = rand() % 256;
+			textList[idx].width = 200;
+			textList[idx].alignment = ALIGNMENT_LEFT;
+			sprintf(textList[idx].textString, "%d/kWh", rand() % 9999);
+			sprintf(textList[idx].textStyle, FONT_STYLE_NORMAL);
+			sprintf(textList[idx].textFont, FONT_MS2);
+			textList[idx].textSize = FONT_SIZE_14PX;
+		}
+		publish_textview_add(mosq, textList, ARRAY_SIZE(textList));
+
+	//}
+	return 0;
+
+}
+
+/**
+ *
+ * @param mosq
+ */
+int publish_imageview_add_sample(struct mosquitto *mosq)
+{
+	Image_List imageList[25] = {0};
+
+	for(int idx=0;idx<ARRAY_SIZE(imageList);idx++)
+	{
+		imageList[idx].imageviewIndex = idx;
+		imageList[idx].imgsrc_addr = idx;
+		imageList[idx].layout_x = (rand()%800+100);
+		imageList[idx].layout_y = (rand()%800+100);
+		imageList[idx].width = (rand()%100+150);
+		imageList[idx].height = (rand()%100+150);
+
+	}
+
+	return publish_imageview_add(mosq, imageList, ARRAY_SIZE(imageList));
+}
+
+/**
+ *
+ * @param mosq
+ */
+int publish_videoview_add_sample(struct mosquitto *mosq)
+{
+	Video_List videoList[1] = {0};
+
+	for(int idx=0;idx<ARRAY_SIZE(videoList);idx++)
+	{
+		videoList[idx].videoviewIndex = 12;
+		videoList[idx].videosrc_addr = 12;//(rand()%10+0);
+		videoList[idx].layout_x = 0;//(rand()%800+100);
+		videoList[idx].layout_y = 0;//(rand()%800+100);
+		videoList[idx].width = 900;//(rand()%800+100);
+		videoList[idx].height = 600;//(rand()%800+100);
+	}
+
+	return publish_videoview_add(mosq, videoList, ARRAY_SIZE(videoList));
+}
+
+/**
+ *
+ * @param mosq
+ */
+int publish_qr_code_image(struct mosquitto *mosq)
+{
+	QrCode_List qrCodeList[2] = {0};
+
+	for(int idx=0;idx<ARRAY_SIZE(qrCodeList);idx++)
+	{
+		qrCodeList[idx].qrCodeIndex = idx;
+		sprintf((char*)qrCodeList[idx].qrCodeContent, "djsalkdjskjslkdjsalkdjslkdjsalkdjsal");
+		sprintf((char*)qrCodeList[idx].errorCorrection, "M");
+		qrCodeList[idx].layout_x = 100;//(rand()%800+100);
+		qrCodeList[idx].layout_y = 100;//(rand()%800+100);
+		qrCodeList[idx].width = (rand()%800+100);
+		qrCodeList[idx].height = (rand()%800+100);
+	}
+
+	return publish_qrcodeimage_add(mosq, qrCodeList, ARRAY_SIZE(qrCodeList));
+}
+
+/**
+ *
+ * @param mosq
+ */
+int publish_view_remove_sample(struct mosquitto *mosq)
+{
+	Text_List textList[2] = {0};
+	Image_List imageList[2] = {0};
+	Video_List videoList[2] = {0};
+	QrCode_List qrCodeList[2] = {0};
+
+	// Remove text view
+	for(int idx=0;idx<ARRAY_SIZE(textList);idx++)
+	{
+		textList[idx].textviewIndex = idx;
+	}
+
+	// Remove image view
+	for(int idx=0;idx<ARRAY_SIZE(imageList);idx++)
+	{
+		imageList[idx].imageviewIndex = idx;
+	}
+
+	// Remove video view
+	for(int idx=0;idx<ARRAY_SIZE(videoList);idx++)
+	{
+		videoList[idx].videoviewIndex = idx;
+	}
+
+	// Remove qrCode view
+	for(int idx=0;idx<ARRAY_SIZE(qrCodeList);idx++)
+	{
+		qrCodeList[idx].qrCodeIndex = idx;
+	}
+
+	return publish_view_remove_all(mosq);//publish_view_remove(mosq, textList, ARRAY_SIZE(textList), imageList, ARRAY_SIZE(imageList), videoList, ARRAY_SIZE(videoList), qrCodeList, ARRAY_SIZE(qrCodeList));
+}
+
+/**
+ *
+ * @param mosq
+ */
+int publish_clear_screen_sample(struct mosquitto *mosq)
+{
+	return publish_clear_screen(mosq);
+}
+
+/**
+ *
+ * @param mosq
+ * @return
+ */
+int publish_audio_volume_sample(struct mosquitto *mosq)
+{
+	return publish_audio_volume(mosq, 50);
+}
+
+/**
+ *
+ * @param mosq
+ * @return
+ */
+int publish_trigger_report_status_sample(struct mosquitto *mosq)
+{
+	return publish_trigger_report_status(mosq);
+}
+void ProcessGunIdle(int gunIndex)
+{
+	if (gunIndex == LEFT_GUN_NUM) {
+		showTextLeftGunIdle();
+		showLeftGunIcon();
+		showLeftBtn();
+	} else if (gunIndex == RIGHT_GUN_NUM) {
+		showTextRightGunIdle();
+		showRightGunIcon();
+		showRightBtn();
+	}
+}
+
+void show_PAGE_VIEW()
+{
+	//uint8_t left_status, right_status;
+	int is_idle = TRUE;
+	int is_help = FALSE;
+	int gunIndex;
+	//int test_status;
+	for (gunIndex = 0; gunIndex < pSysConfig->TotalConnectorCount; gunIndex++) {
+		pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(gunIndex);
+		if (pDcChargingInfo->SystemStatus != S_IDLE)
+			is_idle = FALSE;
+		if (ShmDcCommonData->pGunInfo[gunIndex].WaitForPlugit) {
+			is_help = TRUE;
+		} else if (pDcChargingInfo->SystemStatus == S_CHARGING) {
+			is_help = TRUE;
+		}
+	}
+
+	if (is_idle) {
+		// Show Button
+		showLeftBtn();
+		showRightBtn();
+		showCenterBtn(is_help);
+		// Show Icon
+		showLeftGunIcon();
+		showRightGunIcon();
+		// Show Text
+		showTextWelcome();
+		return;
+	}
+
+	if (is_help) {
+		showCenterBtn(is_help);
+	}
+
+	for (gunIndex = 0; gunIndex < pSysConfig->TotalConnectorCount; gunIndex++) {
+		pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(gunIndex);
+		switch (pDcChargingInfo->SystemStatus) {
+		case S_IDLE:
+			ProcessGunIdle(gunIndex);
+			break;
+		case S_AUTHORIZING:
+			if (ShmDcCommonData->pGunInfo[gunIndex].WaitForPlugit) {
+				if (gunIndex == LEFT_GUN_NUM) {
+					showLeftGunIcon();
+					showTextLeftGunPlugin();
+					showLeftBtn();
+					//showLeftChargeInfo();
+					showGunChargeInfo(gunIndex);
+				} else if (gunIndex == RIGHT_GUN_NUM) {
+					showRightGunIcon();
+					showTextRightGunPlugin();
+					showRightBtn();
+					//showRightChargeInfo();
+				}
+				showGunChargeInfo(gunIndex);
+				//showGunBattery(gunIndex, 0);
+				showTextChargingInfo(gunIndex);
+
+			}
+			break;
+		case S_REASSIGN_CHECK:
+		case S_REASSIGN:
+		case S_PREPARNING:
+		case S_PREPARING_FOR_EV:
+		case S_PREPARING_FOR_EVSE:
+		case S_CCS_PRECHARGE_ST0:
+		case S_CCS_PRECHARGE_ST1:
+			showTextPrechargingTitle(gunIndex);
+			//showGunBattery(gunIndex, 0);
+			if (gunIndex == LEFT_GUN_NUM) {
+				showLeftGunIcon();
+				showLeftBtn();
+				//showLeftChargeInfo();
+			} else if (gunIndex == RIGHT_GUN_NUM) {
+				showRightGunIcon();
+				showRightBtn();
+				//showRightChargeInfo();
+			}
+			showGunChargeInfo(gunIndex);
+			showTextChargingInfo(gunIndex);
+
+			break;
+		case S_CHARGING:
+			showTextChargingTitle(gunIndex);
+
+			if (gunIndex == LEFT_GUN_NUM) {
+				showLeftGunIcon();
+				showLeftBtn();
+			} else if (gunIndex == RIGHT_GUN_NUM) {
+				showRightGunIcon();
+				showRightBtn();
+			}
+			showGunChargeInfo(gunIndex);
+			showGunBattery(gunIndex, pDcChargingInfo->EvBatterySoc);
+			break;
+		case S_TERMINATING:
+		case S_COMPLETE:
+
+			showTextCompleteCharging(gunIndex);
+			if (gunIndex == LEFT_GUN_NUM) {
+				showLeftGunIcon();
+				showLeftBtn();
+				//showLeftChargeInfo();
+			} else if (gunIndex == RIGHT_GUN_NUM) {
+				showRightGunIcon();
+				//showRightChargeInfo();
+				showRightBtn();
+			}
+			showGunChargeInfo(gunIndex);
+			if (!pDcChargingInfo->ConnectorPlugIn )
+				showGunBattery(gunIndex, pDcChargingInfo->EvBatterySoc);
+			break;
+		case S_ALARM:
+			if (gunIndex == LEFT_GUN_NUM) {
+				showLeftGunIcon();
+
+				if (pDcChargingInfo->Replug_flag) {
+					showTextReOperate(gunIndex);
+					showTextChargingInfo(gunIndex);
+				} else {
+					showTextCompleteCharging(gunIndex);
+					//showLeftChargeInfo();
+					showLeftBtn();
+				}
+			} else if (gunIndex == RIGHT_GUN_NUM) {
+				showRightGunIcon();
+				if (pDcChargingInfo->Replug_flag) {
+					showTextReOperate(gunIndex);
+				} else {
+					showTextCompleteCharging(gunIndex);
+					//showRightChargeInfo();
+					showRightBtn();
+				}
+			}
+			showGunChargeInfo(gunIndex);
+			if (!pDcChargingInfo->ConnectorPlugIn)
+				showGunBattery(gunIndex, pDcChargingInfo->EvBatterySoc);
+			break;
+		case S_FAULT:
+		case S_MAINTAIN:
+		case S_RESERVATION:
+			if (gunIndex == LEFT_GUN_NUM) {
+				showLeftGunIcon();
+			} else {
+				showRightGunIcon();
+			}
+			break;
+
+		}
+	}
+}
+void show_PAGE_LANGUAGE()
+{
+	// Show Button
+	showLeftBtn();
+	showRightBtn();
+	showCenterBtn(FALSE);
+	showLanguageFrame(ShmDcCommonData->language);
+
+}
+void show_PAGE_SELECT_PAY()
+{
+	// Show Button
+	showCenterBtn(FALSE);
+	showRightBtn();
+	// Show Icon
+	showSelectPayContect();
+
+	showTextSelectPay();
+	showTextAuthSelectGun();
+}
+void show_PAGE_AUTHORIZING()
+{
+	showIconAuthorizing();
+	showTextAuthorizing();
+	//showTextAuthSelectGun();
+	return;
+}
+void show_PAGE_AUTHORIZE_COMPLETE()
+{
+	showIconAuthorizeComplete();
+	showTextAuthorizeComplete();
+	//showTextAuthSelectGun();
+}
+void show_PAGE_AUTHORIZE_FAIL()
+{
+	showLeftBtn();
+	showCenterBtn(TRUE);
+	showIconAuthorizeFail();
+	showTextAuthorizeFail();
+	//showTextAuthSelectGun();
+}
+void show_PAGE_HELP()
+{
+	showHelpContect();
+	showLeftBtn();
+}
+
+void show_PAGE_PLUGIN_FAIL()
+{
+	showPlugoutContect();
+	showLeftBtn();
+}
+
+void show_PAGE_WARMING_INFO()
+{
+	showAlarmCode_QRURL(pSysInfo->CurGunSelected);
+	showLeftBtn();
+}
+void show_PAGE_SUMMARY()
+{
+	showSummaryChargeInfo();
+	showLeftBtn();
+}
+void show_PAGE_STOP()
+{
+	pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(pSysInfo->CurGunSelected);
+	StartSystemTimeoutDet(Timeout_ReturnViewPage);
+	if (pDcChargingInfo->isRemoteStart) {
+		showStopChargingByAPP();
+	} else {
+		showStopChargingByRFID();
+	}
+	showLeftBtn();
+}
+void show_PAGE_MAINTAIN()
+{
+	showFixContect();
+}
+void show_PAGE_EMG_BTN()
+{
+	showEMGContect();
+}
+void showPageContent()
+{
+	switch (pSysInfo->SystemPage) {
+	
+	case _PAGE_VIEW:
+		show_PAGE_VIEW();
+		break;
+	case _PAGE_LANGUAGE:
+		show_PAGE_LANGUAGE();
+		break;
+	case _PAGE_SELECT_PAY:
+		show_PAGE_SELECT_PAY();
+		break;
+	case _PAGE_AUTHORIZING:
+		show_PAGE_AUTHORIZING();
+		break;
+	case _PAGE_AUTHORIZE_COMPLETE:
+		show_PAGE_AUTHORIZE_COMPLETE();
+		break;
+	case _PAGE_AUTHORIZE_FAIL:
+		show_PAGE_AUTHORIZE_FAIL();
+		break;
+	case _PAGE_HELP:
+		show_PAGE_HELP();
+		break;
+	case _PAGE_PLUGIN_FAIL:
+		show_PAGE_PLUGIN_FAIL();
+		break;
+	case _PAGE_ALARM:
+		show_PAGE_WARMING_INFO();
+		break;
+	case _PAGE_STOP_CHARGING:
+		show_PAGE_STOP();
+		break;
+	case _PAGE_SUMMARY:
+		show_PAGE_SUMMARY();
+		break;
+	case _PAGE_MAINTAIN:
+		show_PAGE_MAINTAIN();
+		break;
+	case _PAGE_EMG_BTN:
+		show_PAGE_EMG_BTN();
+		break;
+	default:
+		log_info("Show Error Page%d", pSysInfo->SystemPage);
+	}
+}
+void flashPage()
+{
+	showbackground();
+	showMoneySymbolIcon();
+}
+
+int showVideo(struct mosquitto* mosq, uint8_t _show)
+{
+	if (_show) {
+		Video_List videoList[1] = { 0 };
+
+		for (int idx = 0; idx < ARRAY_SIZE(videoList); idx++)
+		{
+			videoList[idx].videoviewIndex = 99;
+			videoList[idx].videosrc_addr = 99;//(rand()%10+0);
+			videoList[idx].layout_x = 0;//(rand()%800+100);
+			videoList[idx].layout_y = 0;//(rand()%800+100);
+			videoList[idx].width = 1080;//(rand()%800+100);
+			videoList[idx].height = 606;//(rand()%800+100);
+		}
+		return publish_videoview_add(mosq, videoList, ARRAY_SIZE(videoList));
+	} else {
+		Image_List imageList[1] = { 0 };
+		Text_List textList[1] = { 0 };
+		Video_List videoList[1] = { 0 };
+		QrCode_List qrCodeList[1] = { 0 };
+
+		videoList[0].videoviewIndex = 99;
+		videoList[0].videosrc_addr = 99;
+		return publish_view_remove(mosq, textList, ARRAY_SIZE(textList), imageList, ARRAY_SIZE(imageList), videoList, ARRAY_SIZE(videoList), qrCodeList, ARRAY_SIZE(qrCodeList));
+	}
+}
+
+void ChangeCurPage(struct mosquitto* mosq)
+{
+	int is_idle = TRUE;
+	int gunIndex;
+	int test_status;
+	for (gunIndex = 0; gunIndex < pSysConfig->TotalConnectorCount; gunIndex++) {
+		pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(gunIndex);
+
+		if (gunIndex == LEFT_GUN_NUM) {
+			if (pDcChargingInfo->SystemStatus != left_status) {
+				if (isPrecharging(left_status) && isPrecharging(pDcChargingInfo->SystemStatus)) {
+					is_change = FALSE;
+				} else {
+					is_change = TRUE;
+				}
+				log_info("Left Gun status from %d to %d", left_status, pDcChargingInfo->SystemStatus);
+				left_status = pDcChargingInfo->SystemStatus;
+			} else if (is_plug0 != pDcChargingInfo->ConnectorPlugIn && is_chargingend(pDcChargingInfo->SystemStatus)) {
+				is_change = TRUE;
+				is_plug0 = pDcChargingInfo->ConnectorPlugIn;
+			}
+		}
+		if (gunIndex == RIGHT_GUN_NUM) {
+			if (pDcChargingInfo->SystemStatus != right_status) {
+				if (isPrecharging(right_status) && isPrecharging(pDcChargingInfo->SystemStatus)) {
+					is_change = FALSE;
+				} else {
+					is_change = TRUE;
+				}
+				log_info("Right Gun status from %d to %d", right_status, pDcChargingInfo->SystemStatus);
+				right_status = pDcChargingInfo->SystemStatus;
+			} else if (is_plug1 != pDcChargingInfo->ConnectorPlugIn && is_chargingend(pDcChargingInfo->SystemStatus)) {
+				is_change = TRUE;
+				is_plug1 = pDcChargingInfo->ConnectorPlugIn;
+			}
+		}
+	}
+	if (ShmPrimaryMcuData->InputDet.bits.EmergencyButton ||
+		ShmDcCommonData->PowerAlarmState.StatusBit.EmergencyStop) {
+		pSysInfo->SystemPage = _PAGE_EMG_BTN;
+	}
+	if (lang_select != ShmDcCommonData->language) {
+		//log_info("Change Language to :%d", ShmDcCommonData->language);
+		is_change = TRUE;
+		lang_select = ShmDcCommonData->language;
+		DB_Set_Language(ShmDcCommonData->language);
+	}
+	if (is_change || currentPage != pSysInfo->SystemPage) {
+		is_change = FALSE;
+		log_info("Page%d change to Page%d", currentPage, pSysInfo->SystemPage);
+		ShmDcCommonData->previousPage = currentPage;
+		currentPage = pSysInfo->SystemPage;
+		if (pSysInfo->SystemPage) {
+			ShmDcCommonData->SDUPATENUM = 0;
+		}
+		// Show BackGroud
+		//publish_clear_screen(mosq);
+		publish_view_remove_all(mosq);
+		usleep(100);
+		flashPage();
+		// Show Each Page contect
+		showPageContent();
+		ChangeWarningFunc(mosq);
+		showlocaltime(mosq);
+		showStatus(mosq);
+
+		// Push Buffer data to LCM by MQTT
+	}
+}
+
+void ProcessGunPlugIn(int gunIndex)
+{
+	pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(gunIndex);
+	showTextPluginCntDown(gunIndex, (GetTimeoutValue(pDcChargingInfo->ConnectorTimeout) / uSEC_VAL));
+	/*
+	if (ShmSelectGunInfo->PricesInfo[gunIndex].UserPrices > 0)
+		showGunUserPrice(gunIndex, ShmSelectGunInfo->PricesInfo[gunIndex].UserPrices);
+	else
+		showGunUserPrice(gunIndex, ShmDcCommonData->ChargingRate);
+	*/
+}
+void ProcessPrecharge(int gunIndex)
+{
+	//showGunBattery(gunIndex, pDcChargingInfo->EvBatterySoc);
+	if (ShmSelectGunInfo->PricesInfo[gunIndex].UserPrices > 0)
+		showGunUserPrice(gunIndex, ShmSelectGunInfo->PricesInfo[gunIndex].UserPrices);
+	else
+		showGunUserPrice(gunIndex, ShmDcCommonData->ChargingRate);
+}
+void ProcessCharging(int gunIndex)
+{
+	pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(gunIndex);
+	showTextChargingInfo(gunIndex);
+	showGunBattery(gunIndex, pDcChargingInfo->EvBatterySoc);
+	if (ShmSelectGunInfo->PricesInfo[gunIndex].UserPrices > 0)
+		showGunUserPrice(gunIndex, ShmSelectGunInfo->PricesInfo[gunIndex].UserPrices);
+	else
+		showGunUserPrice(gunIndex, ShmDcCommonData->ChargingRate);
+}
+void ProcessComplete(int gunIndex)
+{
+	showTextChargingInfo(gunIndex);
+	if (ShmSelectGunInfo->PricesInfo[gunIndex].UserPrices > 0)
+		showGunUserPrice(gunIndex, ShmSelectGunInfo->PricesInfo[gunIndex].UserPrices);
+	else
+		showGunUserPrice(gunIndex, ShmDcCommonData->ChargingRate);
+}
+void ProcessSummary(int gunIndex)
+{
+	//pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(gunIndex);
+	//showTextChargingInfo(gunIndex);
+
+}
+void ProcessViewPage()
+{
+	int gunIndex;
+	int i = 0;
+	for (gunIndex = 0; gunIndex < pSysConfig->TotalConnectorCount; gunIndex++) {
+		pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(gunIndex);
+		
+		//ShmDcCommonData->pGunInfo[gunIndex].WaitForPlugit = TRUE;
+		switch (pDcChargingInfo->SystemStatus) {
+		case S_IDLE:
+			/*
+			if (left_status != S_IDLE || right_status != S_IDLE)
+				ProcessGunIdle(gunIndex);
+				*/
+			/*
+			i = 0;
+			while (i <= 100) {
+				showGunBattery(gunIndex, i);
+				sleep(3);
+				i += 5;
+			};
+			*/
+			break;
+		case S_AUTHORIZING:
+			if (ShmDcCommonData->pGunInfo[gunIndex].WaitForPlugit) {
+				ProcessGunPlugIn(gunIndex);
+			} else {
+				pDcChargingInfo->SystemStatus = S_IDLE;
+			}
+			break;
+		case S_REASSIGN_CHECK:
+		case S_REASSIGN:
+		case S_PREPARNING:
+		case S_PREPARING_FOR_EV:
+		case S_PREPARING_FOR_EVSE:
+		case S_CCS_PRECHARGE_ST0:
+		case S_CCS_PRECHARGE_ST1:
+			ProcessPrecharge(gunIndex);
+			break;
+		case S_CHARGING:
+			ProcessCharging(gunIndex);
+			break;
+		case S_TERMINATING:
+		case S_COMPLETE:
+			ProcessComplete(gunIndex);
+			break;
+		case S_ALARM:
+			if (!pDcChargingInfo->Replug_flag)
+				ProcessComplete(gunIndex);
+			break;
+		case S_FAULT:
+			break;
+		}
+	}
+}
+void showlocaltime(struct mosquitto* mosq)
+{
+	struct timeb SeqEndTime;
+	struct tm* tm;
+	char _date[20];
+	char _time[20];
+	char _am_pm[10];
+	char cmd[30];
+
+	ftime(&SeqEndTime);
+	SeqEndTime.time = time(NULL);
+
+	tm = localtime(&SeqEndTime.time);
+
+	sprintf(cmd, "%04d/%02d/%02d ",
+		tm->tm_year + 1900,
+		tm->tm_mon + 1,
+		tm->tm_mday);
+
+	if (tm->tm_hour >= 12) {
+		sprintf(_am_pm, "p.m.");
+		sprintf(_time, "%02d:%02d ",
+			tm->tm_hour - 12,
+			tm->tm_min);
+	} else {
+		sprintf(_am_pm, "a.m.");
+		sprintf(_time, "%02d:%02d ",
+			tm->tm_hour,
+			tm->tm_min);
+	}
+	strcat(cmd, _time);
+	strcat(cmd, _am_pm);
+	Text_List textList[1] = { 0 };
+	textList[0].textviewIndex = _text_localtime;
+	textList[0].layout_x = 700;
+	textList[0].layout_y = 622;
+	textList[0].color_r = 0;
+	textList[0].color_g = 85;
+	textList[0].color_b = 184;
+	textList[0].width = 500;
+	textList[0].alignment = ALIGNMENT_LEFT;
+	sprintf(textList[0].textString, cmd);
+	sprintf(textList[0].textFont, FONT_ARIAL);
+	sprintf(textList[0].textStyle, FONT_STYLE_BOLD);
+	textList[0].textSize = 15;
+	publish_textview_add(mosq, textList, ARRAY_SIZE(textList));
+}
+void ProcessPageInfo()
+{
+
+	switch (pSysInfo->SystemPage) {
+	case _PAGE_VIEW:
+		ProcessViewPage();
+		break;
+		/*
+	case _PAGE_LANGUAGE:
+		// Show Icon
+		if (lang_select != ShmDcCommonData->language) {
+			showLanguageFrame(ShmDcCommonData->language);
+			lang_select = ShmDcCommonData->language;
+		}
+		break;
+		*/
+	case _PAGE_SUMMARY:
+		ProcessSummary(pSysInfo->CurGunSelected);
+		break;
+	}
+}
+
+void showNetWork(struct mosquitto* mosq)
+{
+	Image_List imageList[4];
+	if (ShmSelectGunInfo->EthDevStatus.Ethernet == 1) {
+		imageList[0].imgsrc_addr = _icon_eth_connect;
+	} else {
+		imageList[0].imgsrc_addr = _icon_eth_disconnect;
+	}
+	imageList[0].imageviewIndex = _icon_eth_connect;
+	imageList[0].layout_x = 926;
+	imageList[0].layout_y = 624;
+	imageList[0].width = 25;
+	imageList[0].height = 25;
+	////////////////////////////////
+	if (ShmSelectGunInfo->EthDevStatus.Wifi == 1) {
+		imageList[1].imgsrc_addr = _icon_wifi_connect;
+	} else {
+		imageList[1].imgsrc_addr = _icon_wifi_disconnect;
+	}
+
+	imageList[1].imageviewIndex = _icon_wifi_connect;
+	imageList[1].layout_x = 991;
+	imageList[1].layout_y = 624;
+	imageList[1].width = 25;
+	imageList[1].height = 25;
+	////////////////////////////////
+	if (ShmSelectGunInfo->EthDevStatus.Backend == 1) {
+		imageList[2].imgsrc_addr = _icon_backend_connect;
+	} else {
+		imageList[2].imgsrc_addr = _icon_backend_disconnect;
+	}
+	imageList[2].imageviewIndex = _icon_backend_connect;
+	imageList[2].layout_x = 960;
+	imageList[2].layout_y = 624;
+	imageList[2].width = 25;
+	imageList[2].height = 25;
+	////////////////////////////////
+	if (ShmSelectGunInfo->EthDevStatus.FourG == 1) {
+		imageList[3].imgsrc_addr = _icon_4G_connect;
+	} else {
+		imageList[3].imgsrc_addr = _icon_4G_disconnect;
+	}
+	imageList[3].imageviewIndex = _icon_4G_connect;
+	imageList[3].layout_x = 1020;
+	imageList[3].layout_y = 624;
+	imageList[3].width = 25;
+	imageList[3].height = 25;
+	////////////////////////////////
+	publish_imageview_add(mosq, imageList, ARRAY_SIZE(imageList));
+}
+void showStatus(struct mosquitto* mosq)
+{
+	showNetWork(mosq);
+	showTextDefaultPrice(ShmDcCommonData->ChargingRate);
+}
+
+bool checkUpdate(struct mosquitto* mosq)
+{
+	bool isUpdate = false;
+	// 更新
+	if (ShmDcCommonData->_upgrade_lcm_flag) {
+		if (!is_update) {
+			is_update = TRUE;
+			log_info("Start update LCM UI");
+			upgrade_lcm_ui(mosq);
+		}
+		isUpdate = true;
+	} else if (ShmDcCommonData->_upgrade_lcm_apk_flag) {
+		if (!is_update) {
+			is_update = TRUE;
+			log_info("Start update LCM APK");
+			upgrade_lcm_apk(mosq);
+		}
+		isUpdate = true;
+	} else if (ShmDcCommonData->SDUPATENUM >= 10 && pSysInfo->SystemPage == _PAGE_MAINTAIN) {
+		log_info("Start update LCM SDCARD");
+		ShmDcCommonData->SDUPATENUM = 0;
+		upgrade_lcm_sdcard(mosq);
+		isUpdate = true;
+	}
+	return isUpdate;
+}
+
+/**
+ *
+ * @return
+ */
+int main(void)
+{
+	struct mosquitto *mosq;
+	int result;
+	uint8_t curWarningCount = 0;
+	uint8_t changeWarningPriority = 0;
+	//===========================================
+	// Initial share memory
+	//===========================================
+	if(CreateAllCsuShareMemory() == FAIL)
+	{
+		DEBUG_ERROR("CreateAllCsuShareMemory NG\n");
+
+		sleep(5);
+		return FAIL;
+	}
+	else
+	{
+		DEBUG_INFO("Share memory initial OK.\n");
+	}
+
+	MappingGunChargingInfo("LCM Wistron Control Task");
+
+	pSysConfig = (struct SysConfigData*)GetShmSysConfigData();
+	pSysInfo = (struct SysInfoData*)GetShmSysInfoData();
+	pSysWarning = (struct WARNING_CODE_INFO*)GetShmSysWarningInfo();
+	ShmFanModuleData = (struct FanModuleData*)GetShmFanModuleData();;
+	ShmPrimaryMcuData = (struct PrimaryMcuData*)GetShmPrimaryMcuData();
+	ShmSelectGunInfo = (SelectGunInfo*)GetShmSelectGunInfo();
+	ShmDcCommonData = (DcCommonInfo*)GetShmDcCommonData();
+	struct StatusCodeData* ShmStatusCodeData = (struct StatusCodeData*)GetShmStatusCodeData();
+	time_t SecCount = time((time_t*)NULL);
+	time_t WatchDogCount = time((time_t*)NULL);
+	time_t VideoCount = time((time_t*)NULL);
+	currentPage = 0;
+	system("ifconfig lo up");
+	//int rebootLcmCnt = 0;
+	//===========================================
+	// Start mosquitto broker
+	//===========================================
+	system("killall mosquitto");
+	sleep(1);
+	system("/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf -d");
+	DEBUG_INFO("Broker target: %s:%d\n", BROKER_ADDRESS, BROKER_PORT);
+
+	//===========================================
+	// Initialize mosquitto library
+	//===========================================
+	mosquitto_lib_init();
+
+	//===========================================
+	// Initialize subscriber callback
+	//===========================================
+	if(fork())
+	{
+		DEBUG_INFO("Initialize subscribe callback function.\n");
+		result = mosquitto_subscribe_callback(on_message,
+											  NULL,
+											  "client/#",
+											  QOS_ENSURE_BROKER,
+											  BROKER_ADDRESS,
+											  BROKER_PORT,
+											  NULL,
+											  TIMEOUT_KEEPALIVE,
+											  true,
+											  LOGIN_USER,
+											  LOGIN_PASSWD,
+											  NULL,
+											  NULL);
+		if(result)DEBUG_ERROR("Subscribe initialization error: %s\n", mosquitto_strerror(result));
+
+		return -1;
+	}
+
+	//===========================================
+	// Initialize publisher client instance
+	//===========================================
+	DEBUG_INFO("Initialize publisher from host side.\n");
+	mosq = mosquitto_new(NULL, true, NULL);
+	if(mosq == NULL)
+	{
+		DEBUG_ERROR("Publisher initialization error: Out of memory.\n");
+		return -1;
+	}
+	mosquitto_connect_callback_set(mosq, on_connect);
+	mosquitto_disconnect_callback_set(mosq, on_disconnect);
+	mosquitto_publish_callback_set(mosq, on_publish);
+
+	//===========================================
+	// Publisher connect to broker
+	//===========================================
+
+	DEBUG_INFO("Publisher connect to broker.\n");
+	result = mosquitto_connect(mosq, BROKER_ADDRESS, BROKER_PORT, TIMEOUT_KEEPALIVE);
+	if(result != MOSQ_ERR_SUCCESS)
+	{
+		mosquitto_destroy(mosq);
+		DEBUG_ERROR("Connect broker error: %s\n", mosquitto_strerror(result));
+		return -1;
+	}
+
+	//===========================================
+	// Publisher start loop
+	//===========================================
+	DEBUG_INFO("Publisher loop start.\n");
+	result = mosquitto_loop_start(mosq);
+	if(result != MOSQ_ERR_SUCCESS)
+	{
+		mosquitto_destroy(mosq);
+		DEBUG_ERROR("MQTT loop start initialization error: %s\n", mosquitto_strerror(result));
+		return -1;
+	}
+
+	DEBUG_INFO("Module_LcmControl_Wistron initialized.\n");
+
+	//===========================================
+	// Main loop
+	//===========================================
+
+	ItemListGetMem(mosq);
+	//publish_upgrade_sample(mosq);
+	lang_select = DB_Get_Language();
+	DB_Set_Language(ShmDcCommonData->language);
+ReStart_LCM:
+	sleep(1);
+	publish_clear_screen(mosq);
+	showVideo(mosq,TRUE);
+	pSysInfo->SystemPage = _PAGE_VIEW;
+	pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(LEFT_GUN_NUM);
+	is_plug0 = pDcChargingInfo->ConnectorPlugIn;
+	pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(RIGHT_GUN_NUM);
+	is_plug1 = pDcChargingInfo->ConnectorPlugIn;
+	ShmDcCommonData->BlackLight = BRIGHTNESS_LEVEL_11;
+	publish_back_dimming(mosq, ShmDcCommonData->BlackLight);
+	ShmDcCommonData->SleepTimer = time((time_t*)NULL);
+	ShmDcCommonData->lcmwatchdog = time((time_t*)NULL);
+	publish_timesync(mosq);
+	ChangeCurPage(mosq);
+	for(;;)
+	{
+		if (!ShmDcCommonData->lcmtest) {
+			// 連線檢查
+			if ((time((time_t*)NULL) - ShmDcCommonData->lcmwatchdog) >= 10 &&
+				(pDcChargingInfo->SystemStatus != S_UPDATE) ||
+				strcmp((char*)pSysInfo->LcmHwRev, " ") == EQUAL) {
+				sprintf((char*)pSysInfo->LcmHwRev, " ");
+				ShmStatusCodeData->AlarmCode.AlarmEvents.bits.LcmModuleCommFail = true;
+				is_change = TRUE;
+				usleep(500000);
+				goto ReStart_LCM;
+			}
+			// 檢查更新
+			if (checkUpdate(mosq)) {
+				sleep(1);
+				continue;
+			}
+			if ((time((time_t*)NULL) - ShmDcCommonData->SleepTimer) >= 180 &&
+				ShmDcCommonData->BlackLight != BRIGHTNESS_LEVEL_1) {
+				ShmDcCommonData->BlackLight = BRIGHTNESS_LEVEL_1;
+				log_info("Enter Sleeping....%d", ShmDcCommonData->BlackLight);
+				publish_back_dimming(mosq, ShmDcCommonData->BlackLight);
+			}
+			// Charging system
+			ChangeCurPage(mosq);
+
+			// Check Warming code
+			// Warning 處理
+			if (curWarningCount != pSysWarning->WarningCount) {
+				changeWarningPriority = 0;
+				pSysWarning->PageIndex = 0;
+				curWarningCount = pSysWarning->WarningCount;
+				ChangeWarningFunc(mosq);
+			} else if (pSysWarning->WarningCount > 5 && changeWarningPriority == 0) {
+				// 當有兩頁 Warning 則每隔三秒改變一次
+				if (pSysWarning->PageIndex == 0) {
+					pSysWarning->PageIndex = 1;
+				} else {
+					pSysWarning->PageIndex = 0;
+				}
+				ChangeWarningFunc(mosq);
+			}
+			
+			if ((time((time_t*)NULL) - SecCount) >= 1) {
+				SecCount = time((time_t*)NULL);
+				ProcessPageInfo();
+			}
+			if ((time((time_t*)NULL) - WatchDogCount) >= 3) {
+				WatchDogCount = time((time_t*)NULL);
+				showlocaltime(mosq);
+				showStatus(mosq);
+				publish_trigger_report_status_sample(mosq);
+			}
+			if ((time((time_t*)NULL) - VideoCount) >= 28800) {
+				// 6小時重啟影片一次
+				showVideo(mosq, FALSE);
+				showVideo(mosq, TRUE);
+				VideoCount = time((time_t*)NULL);
+			}
+			changeWarningPriority >= 30 ? changeWarningPriority = 0 : changeWarningPriority++;
+		} else {
+			// For test command
+			char cmd[128];
+
+			system("clear");
+			memset(cmd, 0x00, ARRAY_SIZE(cmd));
+			printf("\n ===== main menu ==================================");
+			printf("\n  1: publish_profile_sample.");
+			printf("\n  2: publish_upgrade_sample.");
+			printf("\n  3: publish_restart_sample.");
+			printf("\n  4: publish_power_saving_sample.");
+			printf("\n  5: publish_back_dimming_sample.");
+			printf("\n  6: publish_timesync.");
+			printf("\n  7: publish_textview_add_sample.");
+			printf("\n  8: publish_imageview_add_sample.");
+			printf("\n  9: publish_videoview_add_sample.");
+			printf("\n  10: publish_view_remove_sample.");
+			printf("\n  11: publish_clear_screen.");
+			printf("\n  12: publish_audio_volume.");
+			printf("\n  13: publish_trigger_report_status.");
+			printf("\n  14: publish_qr_code_image.");
+			printf("\n  15: publish_power_saving_wake");
+			printf("\n ==================================================");
+			printf("\n  Please input item to test: ");
+			scanf("%s", &cmd[0]);
+
+			switch (atoi(cmd))
+			{
+			case 1:
+				publish_profile_sample(mosq);
+				break;
+			case 2:
+				publish_upgrade_sample(mosq);
+				break;
+			case 3:
+				publish_restart_sample(mosq);
+				break;
+			case 4:
+				publish_power_saving_sample(mosq);
+				break;
+			case 5:
+				publish_back_dimming_sample(mosq);
+				break;
+			case 6:
+				publish_timesync_sample(mosq);
+				break;
+			case 7:
+				publish_textview_add_sample(mosq);
+				break;
+			case 8:
+				publish_imageview_add_sample(mosq);
+				break;
+			case 9:
+				//publish_videoview_add_sample(mosq);
+				showVideo(mosq, TRUE);
+				break;
+			case 10:
+				//publish_view_remove_sample(mosq);
+				showVideo(mosq, FALSE);
+				break;
+			case 11:
+				publish_clear_screen_sample(mosq);
+				break;
+			case 12:
+				publish_audio_volume_sample(mosq);
+				break;
+			case 13:
+				publish_trigger_report_status_sample(mosq);
+				break;
+			case 14:
+				publish_qr_code_image(mosq);
+				break;
+			case 15:
+				publish_power_saving_wake(mosq);
+				break;
+			}
+		}
+
+		usleep(100000);
+	}
+
+	mosquitto_lib_cleanup();
+
+	return -1;
+}

+ 593 - 232
EVSE/Projects/DD360UCar/Apps/Module_LcmControl_Wistron/Module_LcmControl_Wistron.h

@@ -1,232 +1,593 @@
-/*
- * Module_MqttClient.h
- *
- *  Created on: 2021/11/6
- *      Author: folus
- */
-
-#ifndef MODULE_MQTTCLIENT_H_
-#define MODULE_MQTTCLIENT_H_
-#include    <sys/types.h>
-#include    <sys/stat.h>
-#include 	<sys/time.h>
-#include 	<sys/timeb.h>
-#include 	<sys/types.h>
-#include 	<sys/ioctl.h>
-#include 	<sys/socket.h>
-#include 	<sys/ipc.h>
-#include 	<sys/shm.h>
-#include 	<sys/mman.h>
-#include 	<linux/wireless.h>
-#include 	<arpa/inet.h>
-#include 	<netinet/in.h>
-#include	<dirent.h>
-#include 	<sys/prctl.h>
-#include 	<unistd.h>
-#include 	<stdarg.h>
-#include    <stdio.h>
-#include    <stdlib.h>
-#include    <unistd.h>
-#include    <fcntl.h>
-#include    <termios.h>
-#include    <errno.h>
-#include 	<errno.h>
-#include 	<string.h>
-#include	<time.h>
-#include	<ctype.h>
-#include 	<ifaddrs.h>
-#include	<stdbool.h>
-#include	<stddef.h>
-#include	<stdint.h>
-#include 	<signal.h>
-#include	"json-c/json.h"
-#include 	"mosquitto.h"
-
-#define TEST_MODE
-
-#define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)), __LINE__, __FUNCTION__, ##args)
-#define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)), __LINE__, __FUNCTION__, ##args)
-#define DEBUG_ERROR(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)), __LINE__, __FUNCTION__, ##args)
-
-enum TIMER_IDX
-{
-	TMR_IDX_0=0,
-	TMR_IDX_1,
-	TMR_IDX_2,
-	TMR_IDX_3,
-	TMR_IDX_4,
-	TMR_IDX_5,
-	TMR_IDX_CNT
-};
-
-enum GUN_TYPE
-{
-	GUN_TYPE_UNKNOWN=0,
-	GUN_TYPE_CHAdeMO,
-	GUN_TYPE_CCS,
-	GUN_TYPE_GBT,
-	GUN_TYPE_DO,
-	GUN_TYPE_AC
-};
-
-enum SWITCH_STS
-{
-	OFF=0,
-	ON
-};
-
-enum BOOLEAN_STS
-{
-	NO=0,
-	YES
-};
-
-enum QOS_TYPE
-{
-	QOS_ONLY_TX=0,
-	QOS_ENSURE_BROKER,
-	QOS_ENSURE_SUBSCRIBE
-};
-
-enum RETAIN_TYPE
-{
-	RETAIN_NO=0,
-	RETAIN_YES
-};
-
-typedef struct TEXT_LIST
-{
-	uint16_t	textviewIndex;
-	char		textString[256];
-	char		textFont[32];
-	char		textStyle[32];
-	uint8_t		textSize;
-	uint16_t	layout_x;
-	uint16_t	layout_y;
-
-}Text_List;
-
-typedef struct IMAGE_LIST
-{
-	uint16_t	imageviewIndex;
-	uint16_t	imgsrc_addr;
-	uint16_t	layout_x;
-	uint16_t	layout_y;
-	uint16_t	width;
-	uint16_t	height;
-
-}Image_List;
-
-typedef struct VIDEO_LIST
-{
-	uint16_t	videoviewIndex;
-	uint16_t	videosrc_addr;
-	uint16_t	layout_x;
-	uint16_t	layout_y;
-	uint16_t	width;
-	uint16_t	height;
-
-}Video_List;
-
-typedef struct QRCODE_LIST
-{
-	uint16_t	qrCodeIndex;
-	int8_t		qrCodeContent[512];
-	int8_t		errorCorrection[8];
-	uint16_t	layout_x;
-	uint16_t	layout_y;
-	uint16_t	width;
-	uint16_t	height;
-
-}QrCode_List;
-
-#define ARRAY_SIZE(A)				(sizeof(A) / sizeof(A[0]))
-#define is_error(ptr) 				((unsigned long)ptr > (unsigned long)-4000L)
-
-#define BROKER_PORT					1883
-#define BROKER_ADDRESS				"192.168.0.10"
-#define TIMEOUT_KEEPALIVE			60
-#define LOGIN_USER					NULL
-#define LOGIN_PASSWD				NULL
-
-#define PASS						1
-#define FAIL						-1
-
-
-#define PROFILE_CONNECT_TIMEOUT		"connect_timeout"
-
-#define OTA_TYPE_UI					"ota_ui"
-#define OTA_TYPE_APK				"ota_apk"
-#define OTA_TYPE_SDCARD				"ota_sdcard"
-
-#define FONT_STYLE_NORMAL			"normal"
-#define FONT_STYLE_BOLD				"bold"
-#define FONT_STYLE_ITALIC			"italic"
-#define FONT_STYLE_BOLD_ITALIC		"bold_italic"
-
-#define FONT_ARIAL					"Arial"
-#define FON_MS                      "·L³n¥¿¶ÂÅé"
-
-enum BRIGHTNESS_LEVEL
-{
-	BRIGHTNESS_LEVEL_0=0,
-	BRIGHTNESS_LEVEL_1,
-	BRIGHTNESS_LEVEL_2,
-	BRIGHTNESS_LEVEL_3,
-	BRIGHTNESS_LEVEL_4,
-	BRIGHTNESS_LEVEL_5,
-	BRIGHTNESS_LEVEL_6,
-	BRIGHTNESS_LEVEL_7,
-	BRIGHTNESS_LEVEL_8,
-	BRIGHTNESS_LEVEL_9,
-	BRIGHTNESS_LEVEL_10,
-	BRIGHTNESS_LEVEL_11,
-	BRIGHTNESS_LEVEL_AUTO,
-};
-
-enum FONT_SIZE
-{
-	FONT_SIZE_8PX=8,
-	FONT_SIZE_10PX=10,
-	FONT_SIZE_12PX=12,
-	FONT_SIZE_14PX=14,
-	FONT_SIZE_16PX=16,
-	FONT_SIZE_20PX=20,
-	FONT_SIZE_24PX=24,
-	FONT_SIZE_34PX=34,
-	FONT_SIZE_48PX=48,
-	FONT_SIZE_60PX=60,
-	FONT_SIZE_96PX=96,
-};
-
-struct ClientInfo
-{
-	int8_t verHW[32];
-	int8_t verFW_OS[32];
-	int8_t verFW_APK[32];
-	int8_t verFW_UI[32];
-	int8_t macAddr[32];
-	int8_t orientation[32];
-}clientInfo;
-
-extern int StoreLogMsg(const char *fmt, ...);
-extern int publish_data(struct mosquitto *mosq, char *topic, char *outputStr);
-extern int publish_profile(struct mosquitto *mosq, char *parameter, char *value);
-extern int publish_upgrade(struct mosquitto *mosq, char *otaType, char *url, char *checksum, char *verInfo);
-extern int publish_restart(struct mosquitto *mosq, uint8_t isHardReset);
-extern int publish_power_saving(struct mosquitto *mosq, uint8_t isSleep);
-extern int publish_back_dimming(struct mosquitto *mosq, uint8_t lightLevel);
-extern int publish_timesync(struct mosquitto *mosq);
-extern int publish_textview_add(struct mosquitto *mosq, Text_List *textList, uint8_t listCount);
-extern int publish_imageview_add(struct mosquitto *mosq, Image_List *imageList, uint8_t listCount);
-extern int publish_videoview_add(struct mosquitto *mosq, Video_List *videoList, uint8_t listCount);
-extern int publish_qrcodeimage_add(struct mosquitto *mosq, QrCode_List *qrCodeList, uint8_t listCount);
-extern int publish_view_remove(struct mosquitto *mosq, Text_List *textList, uint8_t textListCount,
-													   Image_List *imageList, uint8_t imageListCount,
-													   Video_List *videoList, uint8_t videoListCount,
-													   QrCode_List *qrCodeList, uint8_t qrCodeListCount);
-extern int publish_clear_screen(struct mosquitto *mosq);
-extern int publish_audio_volume(struct mosquitto *mosq, uint8_t volume);
-extern int publish_trigger_report_status(struct mosquitto *mosq);
-
-#endif /* MODULE_MQTTCLIENT_H_ */
+/*
+ * Module_MqttClient.h
+ *
+ *  Created on: 2021/11/6
+ *      Author: folus
+ */
+
+#ifndef MODULE_MQTTCLIENT_H_
+#define MODULE_MQTTCLIENT_H_
+#include    <sys/types.h>
+#include    <sys/stat.h>
+#include 	<sys/time.h>
+#include 	<sys/timeb.h>
+#include 	<sys/types.h>
+#include 	<sys/ioctl.h>
+#include 	<sys/socket.h>
+#include 	<sys/ipc.h>
+#include 	<sys/shm.h>
+#include 	<sys/mman.h>
+#include 	<linux/wireless.h>
+#include 	<arpa/inet.h>
+#include 	<netinet/in.h>
+#include	<dirent.h>
+#include 	<sys/prctl.h>
+#include 	<unistd.h>
+#include 	<stdarg.h>
+#include    <stdio.h>
+#include    <stdlib.h>
+#include    <unistd.h>
+#include    <fcntl.h>
+#include    <termios.h>
+#include    <errno.h>
+#include 	<errno.h>
+#include 	<string.h>
+#include	<time.h>
+#include	<ctype.h>
+#include 	<ifaddrs.h>
+#include	<stdbool.h>
+#include	<stddef.h>
+#include	<stdint.h>
+#include 	<signal.h>
+#include	"json-c/json.h"
+#include 	"mosquitto.h"
+
+//#define TEST_MODE
+#define LANGUAGE_NUM 6
+#define ICON_INDEX_SHIFT 200
+#define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)), __LINE__, __FUNCTION__, ##args)
+#define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)), __LINE__, __FUNCTION__, ##args)
+#define DEBUG_ERROR(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)), __LINE__, __FUNCTION__, ##args)
+
+enum TIMER_IDX
+{
+	TMR_IDX_0=0,
+	TMR_IDX_1,
+	TMR_IDX_2,
+	TMR_IDX_3,
+	TMR_IDX_4,
+	TMR_IDX_5,
+	TMR_IDX_CNT
+};
+
+enum GUN_TYPE
+{
+	GUN_TYPE_UNKNOWN=0,
+	GUN_TYPE_CHAdeMO,
+	GUN_TYPE_CCS,
+	GUN_TYPE_GBT,
+	GUN_TYPE_DO,
+	GUN_TYPE_AC
+};
+
+enum SWITCH_STS
+{
+	OFF=0,
+	ON
+};
+
+enum BOOLEAN_STS
+{
+	NO=0,
+	YES
+};
+
+enum QOS_TYPE
+{
+	QOS_ONLY_TX=0,
+	QOS_ENSURE_BROKER,
+	QOS_ENSURE_SUBSCRIBE
+};
+
+enum RETAIN_TYPE
+{
+	RETAIN_NO=0,
+	RETAIN_YES
+};
+
+typedef struct TEXT_LIST
+{
+	uint16_t	textviewIndex;
+	char		textString[256];
+	char		textFont[32];
+	char		textStyle[32];
+	uint8_t		textSize;
+	uint16_t	layout_x;
+	uint16_t	layout_y;
+	uint16_t    width;
+	uint8_t     color_r;
+	uint8_t     color_g;
+	uint8_t     color_b;
+	uint8_t     alignment;
+}Text_List;
+
+typedef struct TEXTSCROLL_LIST
+{
+	uint16_t	textscrollIndex;
+	char		textString[256];
+	char		textFont[32];
+	char		textStyle[32];
+	uint8_t		textSize;
+	uint16_t	layout_x;
+	uint16_t	layout_y;
+	uint16_t    width;
+	uint8_t     color_r;
+	uint8_t     color_g;
+	uint8_t     color_b;
+	uint8_t     direction;
+}TextScroll_List;
+
+typedef struct IMAGE_LIST
+{
+	uint16_t	imageviewIndex;
+	uint16_t	imgsrc_addr;
+	uint16_t	layout_x;
+	uint16_t	layout_y;
+	uint16_t	width;
+	uint16_t	height;
+}Image_List;
+
+typedef struct APNG_LIST
+{
+	uint16_t	apngIndex;
+	uint16_t	apngsrc_addr;
+	uint16_t	layout_x;
+	uint16_t	layout_y;
+	uint16_t	width;
+	uint16_t	height;
+	uint8_t		Loop;
+}APNG_List;
+
+typedef struct VIDEO_LIST
+{
+	uint16_t	videoviewIndex;
+	uint16_t	videosrc_addr;
+	uint16_t	layout_x;
+	uint16_t	layout_y;
+	uint16_t	width;
+	uint16_t	height;
+
+}Video_List;
+
+typedef struct QRCODE_LIST
+{
+	uint16_t	qrCodeIndex;
+	int8_t		qrCodeContent[512];
+	int8_t		errorCorrection[8];
+	uint16_t	layout_x;
+	uint16_t	layout_y;
+	uint16_t	width;
+	uint16_t	height;
+
+}QrCode_List;
+
+#define ARRAY_SIZE(A)				(sizeof(A) / sizeof(A[0]))
+#define is_error(ptr) 				((unsigned long)ptr > (unsigned long)-4000L)
+
+#define BROKER_PORT					1883
+#define BROKER_ADDRESS				"192.168.0.10"
+#define TIMEOUT_KEEPALIVE			60
+#define LOGIN_USER					NULL
+#define LOGIN_PASSWD				NULL
+
+//#define PASS						1
+//#define FAIL						-1
+
+
+#define PROFILE_CONNECT_TIMEOUT		"connect_timeout"
+
+#define OTA_TYPE_UI					"ota_ui"
+#define OTA_TYPE_APK				"ota_apk"
+#define OTA_TYPE_SDCARD				"ota_sdcard"
+
+#define FONT_STYLE_NORMAL			"normal"
+#define FONT_STYLE_BOLD				"bold"
+#define FONT_STYLE_ITALIC			"italic"
+#define FONT_STYLE_BOLD_ITALIC		"bold_italic"
+
+#define FONT_ARIAL					"Arial"
+#define FONT_CENTURY_GOTHIC			"Century Gothic"
+#define FONT_MS1                    "微軟正黑體"
+#define FONT_MS2                    "標楷體"
+#define FONT_MS3                    "新細明體"
+
+char _lang_String[100][200];
+char _lang_List[10][20];
+char _lang_Name[10][20];
+
+enum BRIGHTNESS_LEVEL
+{
+	BRIGHTNESS_LEVEL_0=0,
+	BRIGHTNESS_LEVEL_1,
+	BRIGHTNESS_LEVEL_2,
+	BRIGHTNESS_LEVEL_3,
+	BRIGHTNESS_LEVEL_4,
+	BRIGHTNESS_LEVEL_5,
+	BRIGHTNESS_LEVEL_6,
+	BRIGHTNESS_LEVEL_7,
+	BRIGHTNESS_LEVEL_8,
+	BRIGHTNESS_LEVEL_9,
+	BRIGHTNESS_LEVEL_10,
+	BRIGHTNESS_LEVEL_11,
+	BRIGHTNESS_LEVEL_AUTO,
+};
+
+enum FONT_SIZE
+{
+	FONT_SIZE_8PX=8,
+	FONT_SIZE_10PX=10,
+	FONT_SIZE_12PX=12,
+	FONT_SIZE_14PX=14,
+	FONT_SIZE_16PX=16,
+	FONT_SIZE_20PX=20,
+	FONT_SIZE_24PX=24,
+	FONT_SIZE_34PX=34,
+	FONT_SIZE_48PX=48,
+	FONT_SIZE_60PX=60,
+	FONT_SIZE_96PX=96,
+};
+enum ALIGNMENT_INDEX
+{
+	ALIGNMENT_LEFT,
+	ALIGNMENT_CENTER,
+	ALIGNMENT_RIGHT,
+};
+
+enum SCROLL_INDEX
+{
+	DIRECTION_RIGHT,
+	DIRECTION_LEFT,
+};
+
+struct ClientInfo
+{
+	int8_t verHW[32];
+	int8_t verFW_OS[32];
+	int8_t verFW_APK[32];
+	int8_t verFW_UI[32];
+	int8_t macAddr[32];
+	int8_t orientation[32];
+}clientInfo;
+
+extern int StoreLogMsg(const char *fmt, ...);
+extern int publish_data(struct mosquitto *mosq, char *topic, char *outputStr);
+extern int publish_profile(struct mosquitto *mosq, char *parameter, char *value);
+extern int publish_upgrade(struct mosquitto *mosq, char *otaType, char *url, char *checksum, char *verInfo);
+extern int publish_restart(struct mosquitto *mosq, uint8_t isHardReset);
+extern int publish_power_saving(struct mosquitto *mosq, uint8_t isSleep,char* mac);
+extern int publish_back_dimming(struct mosquitto *mosq, uint8_t lightLevel);
+extern int publish_timesync(struct mosquitto *mosq);
+extern int publish_textview_add(struct mosquitto *mosq, Text_List *textList, uint8_t listCount);
+extern int publish_textview_push(struct mosquitto *mosq);
+extern int publish_textscroll_add(struct mosquitto* mosq, TextScroll_List* textList, uint8_t listCount);
+extern int publish_textscroll_push(struct mosquitto* mosq);
+extern int publish_imageview_add(struct mosquitto *mosq, Image_List *imageList, uint8_t listCount);
+extern int publish_imageview_push(struct mosquitto *mosq);
+extern int publish_apngview_add(struct mosquitto *mosq, APNG_List *apngList, uint8_t listCount);
+extern int publish_apngview_push(struct mosquitto *mosq);
+extern int publish_videoview_add_push(struct mosquitto *mosq, Video_List *videoList, uint8_t listCount);
+extern int publish_qrcodeimage_add(struct mosquitto *mosq, QrCode_List *qrCodeList, uint8_t listCount);
+extern int publish_qrcodeimage_push(struct mosquitto *mosq);
+extern int publish_view_remove(struct mosquitto *mosq, Text_List* textList, uint8_t textListCount,
+													   Image_List *imageList, uint8_t imageListCount,
+													   Video_List *videoList, uint8_t videoListCount,
+													   QrCode_List *qrCodeList, uint8_t qrCodeListCount);
+extern int publish_view_remove_all(struct mosquitto* mosq);
+extern int publish_clear_screen(struct mosquitto *mosq);
+extern int publish_audio_volume(struct mosquitto *mosq, uint8_t volume);
+extern int publish_trigger_report_status(struct mosquitto *mosq);
+extern void ItemListGetMem(struct mosquitto* _mosq);
+extern bool isPrecharging(uint8_t status);
+extern bool is_chargingend(int status);
+extern void showbackground();
+// VIEW PAGE
+extern void showLeftBtn();
+extern void showRightBtn();
+extern void showCenterBtn(int is_help);
+extern void showLeftGunIcon();
+extern void showRightGunIcon();
+extern void showMoneySymbolIcon();
+extern void showTextWelcome();
+extern void showTextDefaultPrice(float price);
+extern void showTextLeftBtn();
+extern void showTextRightBtn();
+extern void showTextCenterBtn(int is_help);
+// Select Pay
+extern void showSelectPayContect();
+extern void showTextSelectPay();
+extern void showTextAuthSelectGun();
+// Authroizing
+extern void showIconAuthorizing();
+extern void showTextAuthorizing();
+// Authroize Complete
+extern void showIconAuthorizeComplete();
+extern void showTextAuthorizeComplete();
+// Authorize Failure
+extern void showIconAuthorizeFail();
+extern void showTextAuthorizeFail();
+// Select Language
+extern void showLanguageFrame(int sel);
+extern void showTextLanguageItem(int sel);
+// View 
+extern void showTextLeftGunIdle();
+extern void showTextRightGunIdle();
+// plugin
+extern void showTextLeftGunPlugin();
+extern void showTextPluginCntDown(int gunIndex,int cntdown);
+extern void showTextRightGunPlugin();
+extern void showTextPrechargingTitle(int gunIndex);
+extern void showTextChargingTitle(int gunIndex);
+extern void showTextCompleteCharging(int gunIndex);
+extern void showTextReOperate(int gunIndex);
+extern void showGunBattery(int gunIndex,int percent);
+extern void showGunChargeInfo(int gunIndex);
+extern void showTextChargingInfo(int gunIndex);
+// Summary
+extern void showSummaryChargeInfo();
+// Alarm Code
+extern void showAlarmCode_QRURL(int gunIndex);
+// Maintain
+extern void showFixContect();
+// Plug in fail
+extern void showPlugoutContect();
+// EMG
+extern void showEMGContect();
+// Stop Charging
+extern void showStopChargingByRFID();
+extern void showStopChargingByAPP();
+extern void showHelpContect();
+extern void showGunUserPrice(int gunIndex, float money);
+extern int DB_Set_Language(int sel);
+extern int DB_Get_Language();
+
+enum _SUPPORT_LANGUAGE {
+	_SUPPORT_ZH_TW,
+	_SUPPORT_EN_US,
+	_SUPPORT_JA_JP,
+	_SUUPORT_TR_TR,
+	_SUPPORT_KO_KR,
+};
+enum TOUCH_PRESS {
+	_BTN_NONE,
+	_LEFT_BTN_PRESS,
+	_CENTER_BTN_PRESS,
+	_RIGHT_BTN_PRESS,
+	_LANGUAGE0_PRESS,
+	_LANGUAGE1_PRESS,
+	_LANGUAGE2_PRESS,
+	_LANGUAGE3_PRESS,
+	_LANGUAGE4_PRESS,
+	_LANGUAGE5_PRESS,
+	_SDUPDATE,
+};
+enum _PHIHONG_WISTRON_BG_ {
+	_background = 001,
+};
+
+enum _PHIHONG_WISTRON_BTN_ {
+	_btn_left_gun = 002,
+	_btn_right_gun,
+	_btn_center,
+	_btn_cancel,
+	_btn_home,
+	_btn_return,
+	_btn_leftstop,
+	_btn_rightstop,
+	_btn_language,
+	_btn_select,
+	_icon_qr,
+};
+
+enum _PHIHONG_WISTRON_ICON_ {
+	_icon_eth_connect = 100,
+	_icon_eth_disconnect,
+	_icon_wifi_connect,
+	_icon_wifi_disconnect,
+	_icon_backend_connect,
+	_icon_backend_disconnect,
+	_icon_4G_connect,
+	_icon_4G_disconnect,
+	_icon_money,
+	_icon_warming,
+	_icon_left_gun_CCS1,
+	_icon_left_gun_CCS2,
+	_icon_left_gun_CHAdeMo,
+	_icon_right_gun_CCS1,
+	_icon_right_gun_CCS2,
+	_icon_right_gun_CHAdeMo,
+	_icon_lang_select,
+	_icon_lang_nonselect,
+	_icon_line_symbol,
+	_icon_credit_card,
+	_icon_card_symbol,
+	_icon_RFID_ipass,
+	_icon_sensing_symbol,
+	_icon_QR_code,
+	_icon_authorizing,
+	_icon_authFail,
+	_icon_authComplete,
+	_icon_help,
+	_icon_exclamation,
+	_icon_left_gun_CCS1_non,
+	_icon_left_gun_CCS2_non,
+	_icon_left_gun_CHAdeMo_non,
+	_icon_right_gun_CCS1_non,
+	_icon_right_gun_CCS2_non,
+	_icon_right_gun_CHAdeMo_non,
+	// Need Index shift
+	_icon_prepare_bg,
+	_icon_charge_engergy,
+	_icon_charge_cost,
+	_icon_charge_time,
+	_icon_charge_parkingfee,
+	_icon_charge_totalcost,
+	_icon_charge_remainamount,
+	_icon_charge_bg,
+	_icon_plugout,
+	//////////////////////
+	_icon_app_stop,
+	_icon_rfid_stop,
+	_icon_summary_engergy,
+	_icon_summary_money,
+	_icon_summary_time,
+	_icon_summary_parkingfee,
+	_icon_summary_totalcost,
+	_icon_summary_remainamount,
+	_icon_info_qr,
+	_icon_alarm_bg,
+	_icon_fix,
+	_icon_phone,
+	_icon_EMG,
+	_icon_left_gun_GBT,
+	_icon_right_gun_GBT,
+	_icon_left_gun_GBT_non,
+	_icon_right_gun_GBT_non,
+	_icon_plugin,
+	_icon_userprice_bg,
+	_icon_endcharing_bg,
+	_icon_chargingLine,
+};
+
+enum _PHIHONG_LANGUAGE_INDEX {
+	_lang_allIdleTitle = 1,
+	_lang_allIdleScript,
+	_lang_LanguageSelect,
+	_lang_leftgunCharge,
+	_lang_rightgunCharge,
+	_lang_langitem,
+	_lang_previous,
+	_lang_next,
+	_lang_confirm,
+	_lang_selectpayTitle,
+	_lang_selectpayScript,
+	_lang_leftGun,
+	_lang_rightGun,
+	_lang_selectpayrfid,
+	_lang_selectpaycreditcard,
+	_lang_selectpayqrcode,
+	_lang_cancel,
+	_lang_authingTitle,
+	_lang_authingScript,
+	_lang_authcompleteTitle,
+	_lang_authcompleteScript,
+	_lang_authFailTitle,
+	_lang_authFailScript,
+	_lang_home,
+	_lang_return,
+	_lang_help,
+	_lang_leftidleTitle,
+	_lang_idleScript,
+	_lang_rightidleTitle,
+	_lang_leftstop,
+	_lang_rightstop,
+	_lang_pluginTitle,
+	_lang_leftpluginScript,
+	_lang_rightpluginScript,
+	_lang_prechargingTitle,
+	_lang_chargingTitle,
+	_lang_engergy,
+	_lang_ChargingFee,
+	_lang_time,
+	_lang_ParkingFee,
+	_lang_TotalCost,
+	_lang_RemainAmount,
+	_lang_StopChargingTitlte,
+	_lang_StopChargingScript,
+	_lang_ReOperateTitlte,
+	_lang_ReOperateScript,
+	_lang_alarmcode,
+	_lang_alarmTitle,
+	_lang_alarmScript,
+	_lang_fixTitle,
+	_lang_fixScript,
+	_lang_plugout,
+	_lang_EMGTitle,
+	_lang_EMGScript,
+	_lang_stoprfidTitle,
+	_lang_stoprfidScript,
+	_lang_stopappTitle,
+	_lang_stopappScript,
+	_lang_HelpAuthFailTitle,
+	_lang_HelpAuthFailScript,
+	_lang_HelpPlugInTitle,
+	_lang_HelpPlugInScript,
+	_lang_HelpChargingTitle,
+	_lang_HelpChargingScript,
+	_lang_bill,
+	_lang_UserPriceScript,
+};
+
+enum _PHIHONG_TEXT_INDEX {
+	_text_systemTitle = 1,
+	_text_systemScript,
+	_text_Price,
+	_text_currency,
+	_text_leftbtn,
+	_text_rightbtn,
+	_text_centerbtn,
+	_text_language0,
+	_text_language1,
+	_text_language2,
+	_text_language3,
+	_text_language4,
+	_text_language5,
+	_text_warming0,
+	_text_warming1,
+	_text_warming2,
+	_text_warming3,
+	_text_warming4,
+
+
+	_text_leftTitle,
+	_text_leftScript,
+	_text_rightTitle,
+	_text_rightScript,
+
+	_text_selectpaygun,
+	_text_selectpayrfid,
+	_text_selectpaycreditcard,
+	_text_QRCode,
+
+	_text_leftplugincntdown,
+	_text_rightplugincntdown,
+
+	_text_leftType,
+	_text_leftBattery,
+	_text_leftBattery_sig,
+
+	_text_leftEngergyScript,
+	_text_leftChargingFeeScript,
+	_text_leftTimeScript,
+	_text_leftParkingFeeScript,
+	_text_leftTotalCostScript,
+	_text_leftRemainAmountScript,
+
+	_text_leftUserPriceValue,
+	_text_leftCurrency,
+	_text_leftEngergyValue,
+	_text_leftChargingFeeValue,
+	_text_leftTimeValue,
+	_text_leftParkingFeeValue,
+	_text_leftTotalCostValue,
+	_text_leftRemainAmountValue,
+	_text_leftPowerValue,
+
+	_text_rightType,
+
+	_text_rightPowerValue,
+
+	_text_alarmcode,
+	_text_fixphone,
+	_text_localtime,
+};
+#endif /* MODULE_MQTTCLIENT_H_ */

+ 2542 - 17
EVSE/Projects/DD360UCar/Apps/Module_LcmControl_Wistron/Module_LcmItemList.c

@@ -1,17 +1,2542 @@
-/*
- * Module_LcmItemList.c
- *
- *  Created on: 2022/3/31
- *      Author: folus
- */
-#include "Module_LcmControl_Wistron.h"
-
-void showbackground(Image_List* imageList, int idx)
-{
-	imageList->imageviewIndex = idx;
-	imageList->imgsrc_addr = _background;
-	imageList->layout_x = 0;
-	imageList->layout_y = 607;
-	imageList->width = 1080;
-	imageList->height = 1313;
-}
+/*
+ * Module_LcmItemList.c
+ *
+ *  Created on: 2022/7/20
+ *      Author: Simon
+ */
+#include "Module_LcmControl_Wistron.h"
+#include "../Log/log.h"
+#include "../Define/define.h"
+#include "../Config.h"
+#include "../SelectGun/SelectGun.h"
+#include "../timeout.h"
+#include "../CSU/main.h"
+
+#define DB_FILE		"/root/Language.db"
+
+char* _lang_default_list[66] = { "","歡迎使用!" ,"請點選下方螢幕選擇槍種" ,"語言選擇" ,"左槍充電", "右槍充電","繁體中文","上一個","下一個","選擇","請選擇付款方式" ,
+								"啟動中,請下列方式擇一付款" ,"左槍", "右槍","請於下方靠卡感應","請於下方靠卡感應、刷卡、插入卡片","請掃描QR Code","取消","驗證中", "驗證完成",
+								"付款驗證完成", "驗證失敗", "付款驗證失敗", "首頁","返回","幫助","點選左側","進行充電","點選右側","左槍停止充電",
+								"右槍停止充電", "等待插槍","請於    秒內將左槍插入車端","請於    秒內將右槍插入車端","確認中! 請稍後...","充電中","充電瓦數","充電費用","充電時間","停車費用",
+								"總費用","餘額","停止充電","請拔除充電槍以完成充電","確認失敗","請拔除充電槍,回到首頁重新操作","錯誤代碼","1. 連線失敗,請重新操作", "2. 或掃描QR Code查詢錯誤原因","維修中",
+								"請聯絡管理員","逾時操作,請重新操作", "緊急停止", "旋轉紅色按鈕,回到操作畫面", "使用RFID", "請刷卡停止充電","使用APP","請使用APP停止充電", "1. 請檢察您的卡片是否失效","2. 請確認是否餘額充足",
+								"1. 請取槍並插入槍車充電端", "2. 若插完槍未進入下個步驟,請重新插槍","停止充電","請點選停止充電,將轉至APP、刷卡提醒或結束畫面","充電訊息","目前充電費率", };
+char* _lang_default = "zh_TW";
+
+char* _ALARMQRCODEURL = "https://evsc.phihong.com.tw/StatusCode";
+char* _phone = "08000000000";
+
+static struct mosquitto* mosq;
+static DcCommonInfo* ShmDcCommonData = NULL;
+static struct SysConfigData* pSysConfig = NULL;
+static struct SysInfoData* pSysInfo = NULL;
+
+int DB_Get_Language()
+{
+	static sqlite3* localDb;
+	int result = PASS;
+	char* errMsg = NULL;
+	char sqlStr[1024];
+	char** rs;
+	int  rows, cols;
+	char dbstring[1024];
+	int idxRow;
+
+	ShmDcCommonData->language = 0;
+	if (sqlite3_open(DB_FILE, &localDb)) {
+		result = FAIL;
+		log_info("Can't open database: %s", sqlite3_errmsg(localDb));
+		sqlite3_close(localDb);
+	} else {
+		
+		sqlite3_free_table(rs);
+
+		sprintf(sqlStr, "select * from SupportLanguage;");
+		sqlite3_get_table(localDb, sqlStr, &rs, &rows, &cols, &errMsg);
+		//log_info("SupportLanguage database open successfully rows:%d cols:%d", rows, cols);
+		if (rows > 0) {
+			for (idxRow = 1; idxRow <= rows; idxRow++) {
+				sprintf((char*)&_lang_List[idxRow - 1], (char*)rs[(idxRow * cols)+1]);
+				sprintf((char*)&_lang_Name[idxRow - 1], (char*)rs[(idxRow * cols) + 2]);
+				if (atoi(rs[(idxRow * cols) + 3]) == 1) {
+					ShmDcCommonData->language = idxRow - 1;
+					log_info("Get Default Language [%s]", _lang_List[idxRow - 1]);
+				} else {
+					//log_info("List[%d]: NULL", idxRow);
+				}
+			}
+		} else {
+			log_info("Get Language List fail");
+			result = FAIL;
+		}
+		sqlite3_free_table(rs);
+	}
+	return ShmDcCommonData->language;
+}
+
+
+int DB_Set_Language(int sel)
+{
+	static sqlite3* localDb;
+	int result = PASS;
+	char* errMsg = NULL;
+	char sqlStr[1024];
+	char** rs;
+	int  rows, cols;
+	char dbstring[1024];
+	int idxRow;
+	char LangSelect[10];
+
+	if (sqlite3_open(DB_FILE, &localDb)) {
+		result = FAIL;
+		log_info("Can't open database: %s", sqlite3_errmsg(localDb));
+		sqlite3_close(localDb);
+	} else {
+		// 更新資料庫內選擇語系
+		sprintf(sqlStr, "update SupportLanguage set LanguageSet = '0' ;"); 
+
+		if (sqlite3_exec(localDb, sqlStr, 0, 0, &errMsg) != SQLITE_OK) {
+			result = FAIL;
+			log_info("update config error message: %s", errMsg);
+		}
+		sprintf(sqlStr, "update SupportLanguage set LanguageSet = '1' where LanguageIndex = '%d' ; " , sel +1 ); 
+		if (sqlite3_exec(localDb, sqlStr, 0, 0, &errMsg) != SQLITE_OK) {
+			result = FAIL;
+			log_info("update config error message: %s", errMsg);
+		}
+		//獲取各語系的字串資料
+		if (strlen(_lang_List[sel]) > 0) {
+			sprintf(sqlStr, "select * from %s;", _lang_List[sel]);
+			sqlite3_get_table(localDb, sqlStr, &rs, &rows, &cols, &errMsg);
+			log_info("%s database open successfully rows:%d cols:%d", _lang_List[sel], rows, cols);
+			if (rows > 0) {
+				for (idxRow = 1; idxRow <= rows; idxRow++) {
+					sprintf((char*)&_lang_String[idxRow], (char*)rs[(idxRow * cols) + 1]);
+					//log_info("Set %s String[%d]:[%s]", LangSelect, idxRow, _lang_String[idxRow]);
+				}
+			} else {
+				log_info("Get Language List fail");
+				result = FAIL;
+			}
+		} else {
+			result = FAIL;
+		}
+
+
+		sqlite3_free_table(rs);
+		sqlite3_close(localDb);
+	}
+
+	if (result == FAIL) {
+		log_info("Set Language as default Chinese");
+		ShmDcCommonData->language = 0;
+		sprintf((char*)&_lang_List[0], (char*)_lang_default);
+		for (idxRow = 0; idxRow < 66; idxRow++) {
+			sprintf((char*)&_lang_String[idxRow], (char*)_lang_default_list[idxRow]);
+			//log_info("List[%d]: [%s] [%s]", idxRow, _lang_String[idxRow], _lang_default_list[idxRow]);
+		}
+	}
+
+	return result;
+}
+
+void ItemListGetMem(struct mosquitto* _mosq)
+{
+	if (_mosq == NULL) {
+		log_error("Not Get MQTT struct");
+	}
+	mosq = _mosq;
+	ShmDcCommonData = (DcCommonInfo*)GetShmDcCommonData();
+	pSysConfig = (struct SysConfigData*)GetShmSysConfigData();
+	pSysInfo = (struct SysInfoData*)GetShmSysInfoData();
+
+}
+bool is_chargingend(int status) {
+	if (status == S_TERMINATING || status == S_COMPLETE || status == S_ALARM) {
+		return TRUE;
+	}
+	return FALSE;
+}
+bool isPrecharging(uint8_t status)
+{
+	if ((status >= S_REASSIGN_CHECK && status <= S_PREPARING_FOR_EVSE) ||
+		status == S_CCS_PRECHARGE_ST0 || status == S_CCS_PRECHARGE_ST1) {
+		return TRUE;
+	} else {
+		return FALSE;
+	}
+}
+
+void showbackground()
+{
+	Image_List imageList;
+	imageList.imageviewIndex = _background;
+	imageList.imgsrc_addr = _background;
+	imageList.layout_x = 0;
+	imageList.layout_y = 606;
+	imageList.width = 1079;
+	imageList.height = 1313;
+	publish_imageview_add(mosq, &imageList, 1);
+	return;
+}
+
+void showTextWelcome()
+{
+	Text_List textList[2];
+	textList[0].textviewIndex = _text_systemTitle;
+	textList[0].layout_x = 0;
+	textList[0].layout_y = 807;
+	textList[0].color_r = 0;
+	textList[0].color_g = 85;
+	textList[0].color_b = 184;
+	textList[0].width = 1080;
+	textList[0].alignment = ALIGNMENT_CENTER;
+	sprintf(textList[0].textString, _lang_String[_lang_allIdleTitle]);
+	sprintf(textList[0].textFont, FONT_ARIAL);
+	sprintf(textList[0].textStyle, FONT_STYLE_BOLD);
+	textList[0].textSize = 40;
+
+	textList[1].textviewIndex = _text_systemScript;
+	textList[1].layout_x = 0;
+	textList[1].layout_y = 887;
+	textList[1].color_r = 0;
+	textList[1].color_g = 0;
+	textList[1].color_b = 0;
+	textList[1].width = 1080;
+	textList[1].alignment = ALIGNMENT_CENTER;
+	sprintf(textList[1].textString, _lang_String[_lang_allIdleScript]);
+
+	sprintf(textList[1].textFont, FONT_ARIAL);
+	sprintf(textList[1].textStyle, FONT_STYLE_NORMAL);
+	textList[1].textSize = 30;
+	publish_textview_add(mosq, textList, ARRAY_SIZE(textList));
+}
+
+void showTextDefaultPrice(float price)
+{
+	TextScroll_List textscrollList[1];
+	textscrollList[0].textviewIndex = _text_Price;
+	textscrollList[0].layout_x = 106;
+	textscrollList[0].layout_y = 655;
+	textscrollList[0].color_r = 0;
+	textscrollList[0].color_g = 0;
+	textscrollList[0].color_b = 0;
+	textscrollList[0].width = 100;
+	textscrollList[0].direction = DIRECTION_LEFT;
+	sprintf(textscrollList[0].textString, "%.2f", price);
+	//sprintf(textList[0].textString, "Test");
+	sprintf(textscrollList[0].textFont, FONT_ARIAL);
+	sprintf(textscrollList[0].textStyle, FONT_STYLE_BOLD);
+	textscrollList[0].textSize = 18;
+	publish_textscroll_add(mosq, textscrollList, ARRAY_SIZE(textscrollList));
+	
+	Text_List textList[1];
+	char* currency = (uint8_t*)GetCurrency(pSysConfig->BillingData.Currency);
+	char cur[20] = { 0 };
+	*(currency + 3) = '\0';
+	textList[0].textviewIndex = _text_currency;
+	textList[0].layout_x = 106;
+	textList[0].layout_y = 690;
+	textList[0].color_r = 0;
+	textList[0].color_g = 0;
+	textList[0].color_b = 0;
+	textList[0].width = 200;
+	textList[0].alignment = ALIGNMENT_LEFT;
+	sprintf(textList[0].textString, "%s/kWh", currency);
+	sprintf(textList[0].textFont, FONT_ARIAL);
+	sprintf(textList[0].textStyle, FONT_STYLE_NORMAL);
+	textList[0].textSize = 10;
+	
+	publish_textview_add(mosq, textList, ARRAY_SIZE(textList));
+}
+
+void showTextLeftBtn()
+{
+	struct ChargingInfoData* pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(LEFT_GUN_NUM);
+	Text_List textList;
+	textList.textviewIndex = _text_leftbtn;
+	textList.layout_x = 110;
+	textList.layout_y = 1828;
+	textList.color_r = 255;
+	textList.color_g = 255;
+	textList.color_b = 255;
+	textList.width = 200;
+	textList.alignment = ALIGNMENT_CENTER;
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_NORMAL);
+	textList.textSize = 20;
+
+	switch (pSysInfo->SystemPage) {
+	case _PAGE_VIEW:
+		if ((ShmDcCommonData->pGunInfo[LEFT_GUN_NUM].WaitForPlugit && pDcChargingInfo->SystemStatus == S_AUTHORIZING) ||
+			((pDcChargingInfo->SystemStatus >= S_AUTHORIZING && pDcChargingInfo->SystemStatus <= S_CHARGING) ||
+				(pDcChargingInfo->SystemStatus >= S_CCS_PRECHARGE_ST0 && pDcChargingInfo->SystemStatus <= S_CCS_PRECHARGE_ST1))) {
+			sprintf(textList.textString, _lang_String[_lang_leftstop]);
+
+		} else if (pDcChargingInfo->SystemStatus == S_TERMINATING || pDcChargingInfo->SystemStatus == S_COMPLETE ||
+			pDcChargingInfo->SystemStatus == S_ALARM) {
+			sprintf(textList.textString, _lang_String[_lang_bill]);
+			
+		} else {
+			sprintf(textList.textString, _lang_String[_lang_leftgunCharge]);
+		}
+		break;
+	case _PAGE_LANGUAGE:
+		sprintf(textList.textString, _lang_String[_lang_previous]);
+		break;
+	case _PAGE_AUTHORIZE_FAIL:
+	case _PAGE_ALARM:
+	case _PAGE_PLUGIN_FAIL:
+		sprintf(textList.textString, _lang_String[_lang_home]);
+		break;
+	case _PAGE_SUMMARY:
+		pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(pSysInfo->CurGunSelected);
+		if (pDcChargingInfo->ConnectorPlugIn) {
+			sprintf(textList.textString, _lang_String[_lang_return]);
+		} else {
+			sprintf(textList.textString, _lang_String[_lang_home]);
+		}
+		break;
+	case _PAGE_STOP_CHARGING:
+	case _PAGE_HELP:
+		sprintf(textList.textString, _lang_String[_lang_return]);
+		break;
+	default:
+		sprintf(textList.textString, _lang_String[_lang_leftgunCharge]);
+	}
+
+	publish_textview_add(mosq, &textList, 1);
+}
+void showTextRightBtn()
+{
+	struct ChargingInfoData* pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(RIGHT_GUN_NUM);
+	Text_List textList;
+	textList.textviewIndex = _text_rightbtn;
+	textList.layout_x = 765;
+	textList.layout_y = 1828;
+	textList.color_r = 255;
+	textList.color_g = 255;
+	textList.color_b = 255;
+	textList.width = 200;
+	textList.alignment = ALIGNMENT_CENTER;
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_NORMAL);
+	textList.textSize = 20;
+	switch (pSysInfo->SystemPage) {
+	case _PAGE_VIEW:
+		if ((ShmDcCommonData->pGunInfo[RIGHT_GUN_NUM].WaitForPlugit && pDcChargingInfo->SystemStatus == S_AUTHORIZING) ||
+			((pDcChargingInfo->SystemStatus >= S_AUTHORIZING && pDcChargingInfo->SystemStatus <= S_CHARGING) ||
+				(pDcChargingInfo->SystemStatus >= S_CCS_PRECHARGE_ST0 && pDcChargingInfo->SystemStatus <= S_CCS_PRECHARGE_ST1))) {
+			sprintf(textList.textString, _lang_String[_lang_rightstop]);
+
+		} else if (pDcChargingInfo->SystemStatus == S_TERMINATING || pDcChargingInfo->SystemStatus == S_COMPLETE ||
+			pDcChargingInfo->SystemStatus == S_ALARM) {
+			sprintf(textList.textString, _lang_String[_lang_bill]);
+
+		} else {
+			sprintf(textList.textString, _lang_String[_lang_rightgunCharge]);
+		}
+		break;
+	case _PAGE_LANGUAGE:
+		sprintf(textList.textString, _lang_String[_lang_next]);
+		break;
+	case _PAGE_SELECT_PAY:
+		sprintf(textList.textString, _lang_String[_lang_cancel]);
+		break;
+	default:
+		sprintf(textList.textString, _lang_String[_lang_rightgunCharge]);
+	}
+
+	publish_textview_add(mosq, &textList, 1);
+}
+void showTextCenterBtn(int is_help)
+{
+
+	Text_List textList;
+	if (is_help) {
+		sprintf(textList.textString, _lang_String[_lang_help]);
+	} else {
+		switch (pSysInfo->SystemPage) {
+		case _PAGE_VIEW:
+		case _PAGE_SELECT_PAY:
+			sprintf(textList.textString, _lang_String[_lang_LanguageSelect]);
+			break;
+		case _PAGE_LANGUAGE:
+			sprintf(textList.textString, _lang_String[_lang_confirm]);
+			break;
+		case _PAGE_AUTHORIZE_FAIL:
+			sprintf(textList.textString, _lang_String[_lang_help]);
+			break;
+		}
+	}
+
+	textList.textviewIndex = _text_centerbtn;
+	textList.layout_x = 455;
+	textList.layout_y = 1828;
+	textList.color_r = 255;
+	textList.color_g = 255;
+	textList.color_b = 255;
+	textList.width = 200;
+	textList.alignment = ALIGNMENT_CENTER;
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_NORMAL);
+	textList.textSize = FONT_SIZE_24PX;
+	publish_textview_add(mosq, &textList, 1);
+}
+void showLeftBtn()
+{
+	struct ChargingInfoData* pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(LEFT_GUN_NUM);
+	if (!pDcChargingInfo->IsAvailable)
+		return;
+	Image_List imageList;
+	switch (pSysInfo->SystemPage) {
+	case _PAGE_AUTHORIZE_FAIL:
+	case _PAGE_ALARM:
+	case _PAGE_PLUGIN_FAIL:
+	case _PAGE_SUMMARY:
+		imageList.imageviewIndex = _btn_left_gun;
+		imageList.imgsrc_addr = _btn_home;
+		break;
+	case _PAGE_VIEW:
+		if ((ShmDcCommonData->pGunInfo[LEFT_GUN_NUM].WaitForPlugit && pDcChargingInfo->SystemStatus == S_AUTHORIZING) ||
+			((pDcChargingInfo->SystemStatus >= S_AUTHORIZING && pDcChargingInfo->SystemStatus <= S_CHARGING) ||
+				(pDcChargingInfo->SystemStatus >= S_CCS_PRECHARGE_ST0 && pDcChargingInfo->SystemStatus <= S_CCS_PRECHARGE_ST1))) {
+			imageList.imageviewIndex = _btn_left_gun;
+			imageList.imgsrc_addr = _btn_leftstop;
+		} else {
+			imageList.imageviewIndex = _btn_left_gun;
+			imageList.imgsrc_addr = _btn_left_gun;
+		}
+		break;
+	case _PAGE_STOP_CHARGING:
+	case _PAGE_HELP:
+		imageList.imageviewIndex = _btn_left_gun;
+		imageList.imgsrc_addr = _btn_return;
+		break;
+	default:
+		imageList.imageviewIndex = _btn_left_gun;
+		imageList.imgsrc_addr = _btn_left_gun;
+	}
+	imageList.layout_x = 0;
+	imageList.layout_y = 1784;
+	imageList.width = 352;
+	imageList.height = 136;
+	publish_imageview_add(mosq, &imageList, 1);
+	showTextLeftBtn();
+}
+
+void showRightBtn()
+{
+	struct ChargingInfoData* pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(RIGHT_GUN_NUM);
+	if (!pDcChargingInfo->IsAvailable)
+		return;
+	Image_List imageList;
+	switch (pSysInfo->SystemPage) {
+	case _PAGE_SELECT_PAY:
+		imageList.imageviewIndex = _btn_right_gun;
+		imageList.imgsrc_addr = _btn_cancel;
+		break;
+	case _PAGE_VIEW:
+		if ((ShmDcCommonData->pGunInfo[RIGHT_GUN_NUM].WaitForPlugit && pDcChargingInfo->SystemStatus == S_AUTHORIZING) ||
+			((pDcChargingInfo->SystemStatus >= S_AUTHORIZING && pDcChargingInfo->SystemStatus <= S_CHARGING) ||
+				(pDcChargingInfo->SystemStatus >= S_CCS_PRECHARGE_ST0 && pDcChargingInfo->SystemStatus <= S_CCS_PRECHARGE_ST1))) {
+			imageList.imageviewIndex = _btn_right_gun;
+			imageList.imgsrc_addr = _btn_rightstop;
+		} else {
+			imageList.imageviewIndex = _btn_right_gun;
+			imageList.imgsrc_addr = _btn_right_gun;
+		}
+		break;
+	default:
+		imageList.imageviewIndex = _btn_right_gun;
+		imageList.imgsrc_addr = _btn_right_gun;
+	}
+
+	imageList.layout_x = 730;
+	imageList.layout_y = 1784;
+	imageList.width = 352;
+	imageList.height = 136;
+	publish_imageview_add(mosq, &imageList, 1);
+	showTextRightBtn();
+}
+
+void showCenterBtn(int is_help)
+{
+	Image_List imageList;
+	bool is_idle = TRUE;
+	struct ChargingInfoData* pDcChargingInfo;
+	for (int i = 0; i < pSysConfig->TotalConnectorCount; i++) {
+		pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(i);
+		if (pDcChargingInfo->SystemStatus != S_IDLE) {
+			is_idle = FALSE;
+		}
+	}
+	if ((pSysInfo->SystemPage == _PAGE_VIEW && is_idle ) ||
+		pSysInfo->SystemPage == _PAGE_SELECT_PAY ){
+		imageList.imageviewIndex = _btn_center;
+		imageList.imgsrc_addr = _btn_language;
+	} else if (pSysInfo->SystemPage == _PAGE_LANGUAGE) {
+		imageList.imageviewIndex = _btn_center;
+		imageList.imgsrc_addr = _btn_select;
+	} else {
+		imageList.imageviewIndex = _btn_center;
+		imageList.imgsrc_addr = _btn_center;
+	}
+
+	imageList.layout_x = 365;
+	imageList.layout_y = 1784;
+	imageList.width = 350;
+	imageList.height = 136;
+	publish_imageview_add(mosq, &imageList, 1);
+	showTextCenterBtn(is_help);
+}
+
+void showIconType(int gunIndex)
+{
+	struct ChargingInfoData* pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(gunIndex);
+	Text_List textList;
+	char GunType[30];
+	if (gunIndex == LEFT_GUN_NUM) {
+		textList.textviewIndex = _text_leftType;
+		textList.layout_x = 190;
+	} else {
+		textList.textviewIndex = _text_rightType;
+		textList.layout_x = 730;
+	}
+	textList.layout_y = 1115;
+	if (is_chargingend(pDcChargingInfo->SystemStatus)) {
+		textList.color_r = 255;
+		textList.color_g = 255;
+		textList.color_b = 255;
+	} else {
+		textList.color_r = 0;
+		textList.color_g = 85;
+		textList.color_b = 184;
+	}
+	textList.alignment = ALIGNMENT_CENTER;
+	textList.width = 141;
+
+	switch (pDcChargingInfo->Type) {
+	case _Type_Chademo:
+		strcpy(GunType, "CHAdeMo");
+		break;
+	case _Type_CCS_2:
+		strcpy(GunType, (pDcChargingInfo->CCSGunType <= _TYPE_CCS1_Liquid) ? "CCS1" : "CCS2");
+		break;
+	case _Type_GB:
+		strcpy(GunType, "GBT");
+		break;
+	}
+	sprintf(textList.textString, "%s", GunType);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_BOLD);
+	textList.textSize = 15;
+	publish_textview_add(mosq, &textList, 1);
+}
+
+void showGunBattery(int gunIndex,int percent)
+{
+	struct ChargingInfoData* pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(gunIndex);
+
+	Text_List textList[2];
+	char cmd[10];
+
+	int x_axis = 160;
+	int y_axis = 1180;
+	int x_shift = 237;
+	int y_shift = 45;
+	int idxShift = 0;
+	int gun_shift = 0;
+	if (gunIndex == RIGHT_GUN_NUM) {
+		idxShift = ICON_INDEX_SHIFT;
+		gun_shift = 540;
+	}
+
+	textList[0].textviewIndex = _text_leftBattery + idxShift;
+	textList[0].layout_x = x_axis+ gun_shift;
+
+	textList[0].layout_y = y_axis;
+	if (is_chargingend(pDcChargingInfo->SystemStatus)) {
+		textList[0].color_r = 255;
+		textList[0].color_g = 255;
+		textList[0].color_b = 255;
+	} else {
+		textList[0].color_r = 0;
+		textList[0].color_g = 85;
+		textList[0].color_b = 184;
+	}
+	textList[0].alignment = ALIGNMENT_CENTER;
+	textList[0].width = 200;
+	sprintf(cmd, "%d", percent);
+	sprintf(textList[0].textString, "%s", cmd);
+	sprintf(textList[0].textFont, FONT_ARIAL);
+	sprintf(textList[0].textStyle, FONT_STYLE_BOLD);
+	textList[0].textSize = 60;
+
+
+	textList[1].textviewIndex = _text_leftBattery_sig + idxShift;
+	textList[1].layout_x = x_axis + gun_shift;
+	textList[1].layout_y = y_axis + y_shift;
+	if (is_chargingend(pDcChargingInfo->SystemStatus)) {
+		textList[1].color_r = 255;
+		textList[1].color_g = 255;
+		textList[1].color_b = 255;
+	} else {
+		textList[1].color_r = 0;
+		textList[1].color_g = 85;
+		textList[1].color_b = 184;
+	}
+	textList[1].alignment = ALIGNMENT_RIGHT;
+	textList[1].width = 200;
+	sprintf(cmd, "%%");
+	sprintf(textList[1].textString, "%s", cmd);
+	sprintf(textList[1].textFont, FONT_ARIAL);
+	sprintf(textList[1].textStyle, FONT_STYLE_BOLD);
+	textList[1].textSize = 25;
+
+	publish_textview_add(mosq, textList, 2);
+}
+
+
+
+/*
+void showGunBattery(int gunIndex, int percent)
+{
+	struct ChargingInfoData* pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(gunIndex);
+	int x_axis = 0;
+	if (gunIndex == LEFT_GUN_NUM)
+		x_axis = 20;
+	else 
+		x_axis = 560;
+	int y_axis = 1015;
+	// 
+	int y_shift = 360 - ((345 / 100) * percent);
+	Image_List imageList[2];
+	imageList[0].imageviewIndex = _icon_chargewave;
+	imageList[0].imgsrc_addr = _icon_chargewave;
+	imageList[0].layout_x = x_axis+50;
+	imageList[0].layout_y = y_axis + y_shift;// -(int)(64 / 380 * percent);
+	imageList[0].width = 400;
+	imageList[0].height = 400;
+
+	imageList[1].imageviewIndex = _icon_chargewave_bg;
+	imageList[1].imgsrc_addr = _icon_chargewave_bg;
+	imageList[1].layout_x = x_axis;
+	imageList[1].layout_y = y_axis;
+	imageList[1].width = 500;
+	imageList[1].height = 750;
+	publish_imageview_add(mosq, imageList, ARRAY_SIZE(imageList));
+
+	// 內容
+	Text_List textList[2];
+	char cmd[10];
+	if (gunIndex == LEFT_GUN_NUM) {
+		textList[0].textviewIndex = _text_leftBattery;
+		textList[0].layout_x = 178;
+	} else {
+		textList[0].textviewIndex = _text_rightBattery;
+		textList[0].layout_x = 675;
+	}
+	textList[0].layout_y = 1180;
+	if (is_chargingend(pDcChargingInfo->SystemStatus)) {
+		textList[0].color_r = 255;
+		textList[0].color_g = 255;
+		textList[0].color_b = 255;
+	} else if (pDcChargingInfo->SystemStatus == S_CHARGING) {
+		textList[0].color_r = 0;
+		textList[0].color_g = 0;
+		textList[0].color_b = 0;
+	} else {
+		textList[0].color_r = 0;
+		textList[0].color_g = 85;
+		textList[0].color_b = 184;
+	}
+	textList[0].alignment = ALIGNMENT_CENTER;
+	textList[0].width = 200;
+	sprintf(cmd, "%d", percent);
+	sprintf(textList[0].textString, "%s", cmd);
+	sprintf(textList[0].textFont, FONT_ARIAL);
+	sprintf(textList[0].textStyle, FONT_STYLE_BOLD);
+	textList[0].textSize = 50;
+
+	if (gunIndex == LEFT_GUN_NUM) {
+		textList[1].textviewIndex = _text_leftBattery_sig;
+		textList[1].layout_x = 178;
+	} else {
+		textList[1].textviewIndex = _text_rightBattery_sig;
+		textList[1].layout_x = 675;
+	}
+	textList[1].layout_y = 1215;
+	if (is_chargingend(pDcChargingInfo->SystemStatus)) {
+		textList[1].color_r = 255;
+		textList[1].color_g = 255;
+		textList[1].color_b = 255;
+	} else if (pDcChargingInfo->SystemStatus == S_CHARGING) {
+		textList[1].color_r = 0;
+		textList[1].color_g = 0;
+		textList[1].color_b = 0;
+	} else {
+		textList[1].color_r = 0;
+		textList[1].color_g = 85;
+		textList[1].color_b = 184;
+	}
+	textList[1].alignment = ALIGNMENT_RIGHT;
+	textList[1].width = 200;
+	sprintf(cmd, "%%");
+	sprintf(textList[1].textString, "%s", cmd);
+	sprintf(textList[1].textFont, FONT_ARIAL);
+	sprintf(textList[1].textStyle, FONT_STYLE_BOLD);
+	textList[1].textSize = 25;
+
+	publish_textview_add(mosq, textList, 2);
+}
+*/
+
+void showGunUserPrice(int gunIndex, float money)
+{
+	Text_List textList;
+	char cmd[10];
+
+	int x_axis = 232;
+	int y_axis = 955;
+	int x_shift = 86;
+	int y_shift = 15;
+	int idxShift = 0;
+	int gun_shift = 0;
+	if (gunIndex == RIGHT_GUN_NUM) {
+		idxShift = ICON_INDEX_SHIFT;
+		gun_shift = 540;
+	}
+
+	textList.textviewIndex = _text_leftUserPriceValue + idxShift;
+	textList.layout_x = x_axis + gun_shift;
+
+	textList.layout_y = y_axis;
+	textList.color_r = 255;
+	textList.color_g = 255;
+	textList.color_b = 255;
+	textList.alignment = ALIGNMENT_LEFT;
+	textList.width = 200;
+	sprintf(cmd, "%.02f", money);
+	sprintf(textList.textString, "%s", cmd);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_BOLD);
+	textList.textSize = 20;
+	publish_textview_add(mosq, &textList, 1);
+
+	char* currency = (uint8_t*)GetCurrency(pSysConfig->BillingData.Currency);
+	char cur[20] = { 0 };
+	*(currency + 3) = '\0';
+
+	textList.textviewIndex = _text_leftCurrency + idxShift;
+	textList.layout_x = x_axis + x_shift + gun_shift;
+
+	textList.layout_y = y_axis + y_shift;
+	textList.color_r = 255;
+	textList.color_g = 255;
+	textList.color_b = 255;
+	textList.width = 200;
+	textList.alignment = ALIGNMENT_LEFT;
+	sprintf(textList.textString, "%s/kWh", currency);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_BOLD);
+	textList.textSize = 10;
+	publish_textview_add(mosq, &textList, 1);
+}
+
+void showLeftGunIcon()
+{
+	struct ChargingInfoData* pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(LEFT_GUN_NUM);
+	Image_List imageList;
+	if (pDcChargingInfo->SystemStatus == S_AUTHORIZING) {
+		imageList.imageviewIndex = _icon_plugin;
+		imageList.imgsrc_addr = _icon_plugin;
+	} else if (isPrecharging(pDcChargingInfo->SystemStatus)) {
+		imageList.imageviewIndex = _icon_prepare_bg;
+		imageList.imgsrc_addr = _icon_prepare_bg;
+	} else if (pDcChargingInfo->SystemStatus == S_CHARGING) {
+		imageList.imageviewIndex = _icon_charge_bg ;
+		imageList.imgsrc_addr = _icon_charge_bg;
+	} else if (pDcChargingInfo->SystemStatus >= S_TERMINATING && pDcChargingInfo->SystemStatus <= S_ALARM) {
+		if (pDcChargingInfo->ConnectorPlugIn) {
+			imageList.imageviewIndex = _icon_plugout;
+			imageList.imgsrc_addr = _icon_plugout;
+		} else {
+			imageList.imageviewIndex = _icon_endcharing_bg;
+			imageList.imgsrc_addr = _icon_endcharing_bg;
+		}
+	} else {
+		switch (pDcChargingInfo->Type) {
+		case _Type_Chademo:
+			imageList.imageviewIndex = _icon_left_gun_CHAdeMo;
+			if (pDcChargingInfo->IsAvailable &&
+				(pDcChargingInfo->SystemStatus == S_IDLE || pDcChargingInfo->SystemStatus == S_RESERVATION))
+				imageList.imgsrc_addr = _icon_left_gun_CHAdeMo;
+			else
+				imageList.imgsrc_addr = _icon_left_gun_CHAdeMo_non;
+			break;
+		case _Type_CCS_2:
+			imageList.imageviewIndex = (pDcChargingInfo->CCSGunType <= _TYPE_CCS1_Liquid) ? _icon_left_gun_CCS1 : _icon_left_gun_CCS2;
+			if (pDcChargingInfo->IsAvailable &&
+				(pDcChargingInfo->SystemStatus == S_IDLE || pDcChargingInfo->SystemStatus == S_RESERVATION))
+				imageList.imgsrc_addr = (pDcChargingInfo->CCSGunType <= _TYPE_CCS1_Liquid) ? _icon_left_gun_CCS1 : _icon_left_gun_CCS2;
+			else
+				imageList.imgsrc_addr = (pDcChargingInfo->CCSGunType <= _TYPE_CCS1_Liquid) ? _icon_left_gun_CCS1_non : _icon_left_gun_CCS2_non;
+			break;
+		case _Type_GB:
+			imageList.imageviewIndex = _icon_left_gun_GBT;
+			if (pDcChargingInfo->IsAvailable &&
+				(pDcChargingInfo->SystemStatus == S_IDLE || pDcChargingInfo->SystemStatus == S_RESERVATION))
+				imageList.imgsrc_addr = _icon_left_gun_GBT;
+			else
+				imageList.imgsrc_addr = _icon_left_gun_GBT_non;
+			break;
+		}
+	}
+	imageList.layout_x = 70;
+	imageList.layout_y = 1015;
+	imageList.width = 400;
+	imageList.height = 400;
+	publish_imageview_add(mosq, &imageList, 1);
+	if (!isPrecharging(pDcChargingInfo->SystemStatus) && 
+		pDcChargingInfo->SystemStatus != S_CHARGING &&
+		pDcChargingInfo->SystemStatus != S_IDLE &&
+		pDcChargingInfo->SystemStatus != S_RESERVATION &&
+		pDcChargingInfo->SystemStatus != S_MAINTAIN &&
+		pDcChargingInfo->SystemStatus != S_FAULT) {
+		showIconType(LEFT_GUN_NUM);
+	}
+}
+
+void showRightGunIcon()
+{
+	struct ChargingInfoData* pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(RIGHT_GUN_NUM);
+	Image_List imageList;
+	if (pDcChargingInfo->SystemStatus == S_AUTHORIZING) {
+		imageList.imageviewIndex = _icon_plugin + ICON_INDEX_SHIFT;
+		imageList.imgsrc_addr = _icon_plugin;
+	} else if (isPrecharging(pDcChargingInfo->SystemStatus)) {
+		imageList.imageviewIndex = _icon_prepare_bg + ICON_INDEX_SHIFT;
+		imageList.imgsrc_addr = _icon_prepare_bg;
+	} else if (pDcChargingInfo->SystemStatus == S_CHARGING) {
+		imageList.imageviewIndex = _icon_charge_bg+ ICON_INDEX_SHIFT;
+		imageList.imgsrc_addr = _icon_charge_bg;
+	} else if (pDcChargingInfo->SystemStatus >= S_TERMINATING && pDcChargingInfo->SystemStatus <= S_ALARM) {
+		if (pDcChargingInfo->ConnectorPlugIn) {
+			imageList.imageviewIndex = _icon_plugout+ ICON_INDEX_SHIFT;
+			imageList.imgsrc_addr = _icon_plugout;
+		} else {
+			imageList.imageviewIndex = _icon_endcharing_bg + ICON_INDEX_SHIFT;
+			imageList.imgsrc_addr = _icon_endcharing_bg;
+		}
+	} else {
+		switch (pDcChargingInfo->Type) {
+		case _Type_Chademo:
+			imageList.imageviewIndex = _icon_right_gun_CHAdeMo;
+			if (pDcChargingInfo->IsAvailable &&
+				(pDcChargingInfo->SystemStatus == S_IDLE || pDcChargingInfo->SystemStatus == S_RESERVATION))
+				imageList.imgsrc_addr = _icon_right_gun_CHAdeMo;
+			else
+				imageList.imgsrc_addr = _icon_right_gun_CHAdeMo_non;
+			break;
+		case _Type_CCS_2:
+			imageList.imageviewIndex = (pDcChargingInfo->CCSGunType <= _TYPE_CCS1_Liquid) ? _icon_right_gun_CCS1 : _icon_right_gun_CCS2;
+			if (pDcChargingInfo->IsAvailable &&
+				(pDcChargingInfo->SystemStatus == S_IDLE || pDcChargingInfo->SystemStatus == S_RESERVATION))
+				imageList.imgsrc_addr = (pDcChargingInfo->CCSGunType <= _TYPE_CCS1_Liquid) ? _icon_right_gun_CCS1 : _icon_right_gun_CCS2;
+			else
+				imageList.imgsrc_addr = (pDcChargingInfo->CCSGunType <= _TYPE_CCS1_Liquid) ? _icon_right_gun_CCS1_non : _icon_right_gun_CCS2_non;
+			break;
+		case _Type_GB:
+			imageList.imageviewIndex = _icon_right_gun_CHAdeMo;
+			if (pDcChargingInfo->IsAvailable &&
+				(pDcChargingInfo->SystemStatus == S_IDLE || pDcChargingInfo->SystemStatus == S_RESERVATION))
+				imageList.imgsrc_addr = _icon_right_gun_GBT;
+			else
+				imageList.imgsrc_addr = _icon_right_gun_GBT_non;
+			break;
+		}
+	}
+	imageList.layout_x = 610;
+	imageList.layout_y = 1015;
+	imageList.width = 400;
+	imageList.height = 400;
+	publish_imageview_add(mosq, &imageList, 1);
+	if (!isPrecharging(pDcChargingInfo->SystemStatus) &&
+		pDcChargingInfo->SystemStatus != S_CHARGING &&
+		pDcChargingInfo->SystemStatus != S_IDLE &&
+		pDcChargingInfo->SystemStatus != S_RESERVATION &&
+		pDcChargingInfo->SystemStatus != S_MAINTAIN &&
+		pDcChargingInfo->SystemStatus != S_FAULT) {
+		showIconType(RIGHT_GUN_NUM);
+	}
+}
+
+void showMoneySymbolIcon()
+{
+	Image_List imageList;
+	imageList.imageviewIndex = _icon_money;
+	imageList.imgsrc_addr = _icon_money;
+	imageList.layout_x = 40;
+	imageList.layout_y = 665;
+	imageList.width = 60;
+	imageList.height = 40;
+	publish_imageview_add(mosq, &imageList, 1);
+}
+
+
+void showSelectPayContect()
+{
+	Image_List imageList[7];
+	// RFID
+	imageList[0].imageviewIndex = _icon_sensing_symbol;
+	imageList[0].imgsrc_addr = _icon_sensing_symbol;
+	imageList[0].layout_x = 170;
+	imageList[0].layout_y = 1000;
+	imageList[0].width = 154;
+	imageList[0].height = 166;
+	imageList[1].imageviewIndex = _icon_RFID_ipass;
+	imageList[1].imgsrc_addr = _icon_RFID_ipass;
+	imageList[1].layout_x = 450;
+	imageList[1].layout_y = 1040;
+	imageList[1].width = 240;
+	imageList[1].height = 43;
+	// Credit Card
+	imageList[2].imageviewIndex = _icon_card_symbol;
+	imageList[2].imgsrc_addr = _icon_card_symbol;
+	imageList[2].layout_x = 170;
+	imageList[2].layout_y = 1260;
+	imageList[2].width = 174;
+	imageList[2].height = 157;
+	imageList[3].imageviewIndex = _icon_credit_card;
+	imageList[3].imgsrc_addr = _icon_credit_card;
+	imageList[3].layout_x = 450;
+	imageList[3].layout_y = 1300;
+	imageList[3].width = 482;
+	imageList[3].height = 42;
+	// QR Code
+	imageList[4].imageviewIndex = _icon_QR_code;
+	imageList[4].imgsrc_addr = _icon_QR_code;
+	imageList[4].layout_x = 170;
+	imageList[4].layout_y = 1530;
+	imageList[4].width = 170;
+	imageList[4].height = 171;
+	// Line Symbol
+	imageList[5].imageviewIndex = _icon_line_symbol - 1;
+	imageList[5].imgsrc_addr = _icon_line_symbol;
+	imageList[5].layout_x = 145;
+	imageList[5].layout_y = 1225;
+	imageList[5].width = 786;
+	imageList[5].height = 3;
+	imageList[6].imageviewIndex = _icon_line_symbol;
+	imageList[6].imgsrc_addr = _icon_line_symbol;
+	imageList[6].layout_x = 145;
+	imageList[6].layout_y = 1480;
+	imageList[6].width = 786;
+	imageList[6].height = 3;
+	publish_imageview_add(mosq, imageList, ARRAY_SIZE(imageList));
+
+	QrCode_List qrCodeList[1] = { 0 };
+
+	for (int idx = 0; idx < ARRAY_SIZE(qrCodeList); idx++)
+	{
+		qrCodeList[idx].qrCodeIndex = _icon_qr;
+		sprintf((char*)qrCodeList[idx].qrCodeContent, (char*)ShmDcCommonData->QRCodeString);
+		sprintf((char*)qrCodeList[idx].errorCorrection, "M");
+		qrCodeList[idx].layout_x = 180;//(rand()%800+100);
+		qrCodeList[idx].layout_y = 1540;//(rand()%800+100);
+		qrCodeList[idx].width = 150;
+		qrCodeList[idx].height = 150;
+	}
+
+	publish_qrcodeimage_add(mosq, qrCodeList, ARRAY_SIZE(qrCodeList));
+}
+
+// Authrozing Page
+void showIconAuthorizing()
+{
+	Image_List imageList;
+	imageList.imageviewIndex = _icon_authorizing;
+	imageList.imgsrc_addr = _icon_authorizing;
+	imageList.layout_x = 290;
+	imageList.layout_y = 950;
+	imageList.width = 500;
+	imageList.height = 500;
+	publish_imageview_add(mosq, &imageList, 1);
+}
+void showTextAuthorizing()
+{
+	// Title
+	Text_List textList;
+	textList.textviewIndex = _text_systemTitle;
+	textList.layout_x = 0;
+	textList.layout_y = 807;
+	textList.color_r = 0;
+	textList.color_g = 85;
+	textList.color_b = 184;
+	textList.width = 1080;
+	textList.alignment = ALIGNMENT_CENTER;
+	sprintf(textList.textString, _lang_String[_lang_authingTitle]);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_BOLD);
+	textList.textSize = 30;
+	publish_textview_add(mosq, &textList, 1);
+	// Script
+	textList.textviewIndex = _text_systemScript;
+	textList.layout_x = 0;
+	textList.layout_y = 867;
+	textList.color_r = 0;
+	textList.color_g = 0;
+	textList.color_b = 0;
+	textList.width = 1080;
+	textList.alignment = ALIGNMENT_CENTER;
+	sprintf(textList.textString, _lang_String[_lang_authingScript]);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_NORMAL);
+	textList.textSize = 20;
+	publish_textview_add(mosq, &textList, 1);
+}
+
+// Authrozing Complete Page
+void showIconAuthorizeComplete()
+{
+	Image_List imageList;
+	imageList.imageviewIndex = _icon_authComplete;
+	imageList.imgsrc_addr = _icon_authComplete;
+	imageList.layout_x = 290;
+	imageList.layout_y = 950;
+	imageList.width = 500;
+	imageList.height = 500;
+	publish_imageview_add(mosq, &imageList, 1);
+}
+void showTextAuthorizeComplete()
+{
+	// Title
+	Text_List textList;
+	textList.textviewIndex = _text_systemTitle;
+	textList.layout_x = 0;
+	textList.layout_y = 807;
+	textList.color_r = 0;
+	textList.color_g = 85;
+	textList.color_b = 184;
+	textList.width = 1080;
+	textList.alignment = ALIGNMENT_CENTER;
+	sprintf(textList.textString, _lang_String[_lang_authcompleteTitle]);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_BOLD);
+	textList.textSize = 30;
+	publish_textview_add(mosq, &textList, 1);
+	// Script
+	textList.textviewIndex = _text_systemScript;
+	textList.layout_x = 0;
+	textList.layout_y = 867;
+	textList.color_r = 0;
+	textList.color_g = 0;
+	textList.color_b = 0;
+	textList.width = 1080;
+	textList.alignment = ALIGNMENT_CENTER;
+	sprintf(textList.textString, _lang_String[_lang_authcompleteScript]);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_NORMAL);
+	textList.textSize = 20;
+	publish_textview_add(mosq, &textList, 1);
+}
+
+// Authrozing Fail Page
+void showIconAuthorizeFail()
+{
+	Image_List imageList;
+	imageList.imageviewIndex = _icon_authFail;
+	imageList.imgsrc_addr = _icon_authFail;
+	imageList.layout_x = 290;
+	imageList.layout_y = 950;
+	imageList.width = 500;
+	imageList.height = 500;
+	publish_imageview_add(mosq, &imageList, 1);
+}
+void showTextAuthorizeFail()
+{
+	// Title
+	Text_List textList;
+	textList.textviewIndex = _text_systemTitle;
+	textList.layout_x = 0;
+	textList.layout_y = 807;
+	textList.color_r = 0;
+	textList.color_g = 85;
+	textList.color_b = 184;
+	textList.width = 1080;
+	textList.alignment = ALIGNMENT_CENTER;
+	sprintf(textList.textString, _lang_String[_lang_authFailTitle]);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_BOLD);
+	textList.textSize = 30;
+	publish_textview_add(mosq, &textList, 1);
+	// Script
+	textList.textviewIndex = _text_systemScript;
+	textList.layout_x = 0;
+	textList.layout_y = 867;
+	textList.color_r = 0;
+	textList.color_g = 0;
+	textList.color_b = 0;
+	textList.width = 1080;
+	textList.alignment = ALIGNMENT_CENTER;
+	sprintf(textList.textString, _lang_String[_lang_authFailScript]);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_NORMAL);
+	textList.textSize = 20;
+	publish_textview_add(mosq, &textList, 1);
+}
+// Select Language Page
+void showLanguageFrame(int sel)
+{
+	Image_List imageList[10] = {0};
+	for (int i = 0; i < 10; i++) {
+		if (strlen(_lang_List[i]) > 0) {
+			imageList[i].imageviewIndex = _icon_lang_select + i;
+			if (i == sel) {
+				imageList[i].imgsrc_addr = _icon_lang_select;
+			} else {
+				imageList[i].imgsrc_addr = _icon_lang_nonselect;
+			}
+			imageList[i].layout_x = 30 + (i % 3) * 354;
+			imageList[i].layout_y = 769 + (i / 3) * 246;
+			imageList[i].width = 313;
+			imageList[i].height = 212;
+		}
+	}
+	publish_imageview_add(mosq, imageList, ARRAY_SIZE(imageList));
+	showTextLanguageItem(sel);
+}
+void showTextLanguageItem(int sel)
+{
+	Text_List textList[10];
+	for (int i = 0; i < 10; i++) {
+		if (strlen(_lang_List[i]) > 0) {
+			textList[i].textviewIndex = _text_language0 + i;
+			textList[i].layout_x = 30 + (i % 3) * 354;
+			textList[i].layout_y = 857 + (i / 3) * 246;
+			if (i == sel) {
+				textList[i].color_r = 255;
+				textList[i].color_g = 255;
+				textList[i].color_b = 255;
+			} else {
+				textList[i].color_r = 0;
+				textList[i].color_g = 85;
+				textList[i].color_b = 184;
+			}
+			textList[i].width = 313;
+			textList[i].alignment = ALIGNMENT_CENTER;
+			sprintf(textList[i].textString, _lang_Name[i]);
+			sprintf(textList[i].textFont, FONT_ARIAL);
+			sprintf(textList[i].textStyle, FONT_STYLE_NORMAL);
+			textList[i].textSize = FONT_SIZE_24PX;
+		}
+	}
+	publish_textview_add(mosq, textList, ARRAY_SIZE(textList));
+}
+void showTextSelectPay()
+{
+	// Title
+	Text_List textList[5];
+	textList[0].textviewIndex = _text_systemTitle;
+	textList[0].layout_x = 0;
+	textList[0].layout_y = 807;
+	textList[0].color_r = 0;
+	textList[0].color_g = 85;
+	textList[0].color_b = 184;
+	textList[0].width = 1080;
+	textList[0].alignment = ALIGNMENT_CENTER;
+	sprintf(textList[0].textString, _lang_String[_lang_selectpayTitle]);
+	sprintf(textList[0].textFont, FONT_ARIAL);
+	sprintf(textList[0].textStyle, FONT_STYLE_BOLD);
+	textList[0].textSize = 30;
+
+	// Script
+	textList[1].textviewIndex = _text_systemScript;
+	textList[1].layout_x = 0;
+	textList[1].layout_y = 867;
+	textList[1].color_r = 0;
+	textList[1].color_g = 0;
+	textList[1].color_b = 0;
+	textList[1].width = 1080;
+	textList[1].alignment = ALIGNMENT_CENTER;
+	sprintf(textList[1].textString, _lang_String[_lang_selectpayScript]);
+	sprintf(textList[1].textFont, FONT_ARIAL);
+	sprintf(textList[1].textStyle, FONT_STYLE_NORMAL);
+	textList[1].textSize = 20;
+
+	// RFID 
+	textList[2].textviewIndex = _text_selectpayrfid;
+	textList[2].layout_x = 450;
+	textList[2].layout_y = 1100;
+	textList[2].color_r = 0;
+	textList[2].color_g = 0;
+	textList[2].color_b = 0;
+	textList[2].width = 1080;
+	textList[2].alignment = ALIGNMENT_LEFT;
+	sprintf(textList[2].textString, _lang_String[_lang_selectpayrfid]);
+	sprintf(textList[2].textFont, FONT_ARIAL);
+	sprintf(textList[2].textStyle, FONT_STYLE_NORMAL);
+	textList[2].textSize = 20;
+	// Credit Card
+	textList[3].textviewIndex = _text_selectpaycreditcard;
+	textList[3].layout_x = 450;
+	textList[3].layout_y = 1360;
+	textList[3].color_r = 0;
+	textList[3].color_g = 0;
+	textList[3].color_b = 0;
+	textList[3].width = 1080;
+	textList[3].alignment = ALIGNMENT_LEFT;
+	sprintf(textList[3].textString, _lang_String[_lang_selectpaycreditcard]);
+	sprintf(textList[3].textFont, FONT_ARIAL);
+	sprintf(textList[3].textStyle, FONT_STYLE_NORMAL);
+	textList[3].textSize = 20;
+	// QR Code
+	textList[4].textviewIndex = _text_QRCode;
+	textList[4].layout_x = 450;
+	textList[4].layout_y = 1590;
+	textList[4].color_r = 0;
+	textList[4].color_g = 0;
+	textList[4].color_b = 0;
+	textList[4].width = 1080;
+	textList[4].alignment = ALIGNMENT_LEFT;
+	sprintf(textList[4].textString, _lang_String[_lang_selectpayqrcode]);
+	sprintf(textList[4].textFont, FONT_ARIAL);
+	sprintf(textList[4].textStyle, FONT_STYLE_NORMAL);
+	textList[4].textSize = 20;
+	publish_textview_add(mosq, textList, ARRAY_SIZE(textList));
+}
+void showTextAuthSelectGun()
+{
+	struct ChargingInfoData* pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(pSysInfo->CurGunSelected);
+	Text_List textList;
+	char GunType[30];
+	textList.textviewIndex = _text_selectpaygun;
+	textList.layout_x = 0;
+	textList.layout_y = 867;
+	textList.color_r = 42;
+	textList.color_g = 161;
+	textList.color_b = 252;
+
+	textList.alignment = ALIGNMENT_RIGHT;
+	switch (pSysInfo->SystemPage) {
+	case _PAGE_SELECT_PAY:
+		textList.width = 350;
+		break;
+	case _PAGE_AUTHORIZING:
+		textList.width = 450;
+		break;
+	case _PAGE_AUTHORIZE_COMPLETE:
+	case _PAGE_AUTHORIZE_FAIL:
+		textList.width = 510;
+		break;
+	}
+	strcpy(GunType, pSysInfo->CurGunSelected == LEFT_GUN_NUM ? _lang_String[_lang_leftGun] : _lang_String[_lang_rightGun]);
+	switch (pDcChargingInfo->Type) {
+	case _Type_Chademo:
+		strcat(GunType, "CHAdeMo ");
+		break;
+	case _Type_CCS_2:
+		strcat(GunType, (pDcChargingInfo->CCSGunType <= _TYPE_CCS1_Liquid) ? "CCS1 " : "CCS2 ");
+		break;
+	case _Type_GB:
+		strcat(GunType, "GBT ");
+		break;
+	}
+	sprintf(textList.textString, "%s",GunType);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_NORMAL);
+	textList.textSize = 20;
+	publish_textview_add(mosq, &textList, 1);
+}
+void showTextLeftGunIdle()
+{
+	struct ChargingInfoData* pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(LEFT_GUN_NUM);
+	if (!pDcChargingInfo->IsAvailable)
+		return;
+	Text_List textList;
+	char GunType[30];
+	textList.textviewIndex = _text_leftTitle;
+	textList.layout_x = 0;
+	textList.layout_y = 789;
+	textList.color_r = 0;
+	textList.color_g = 85;
+	textList.color_b = 184;
+	textList.alignment = ALIGNMENT_CENTER;
+	textList.width = 540;
+	strcpy(GunType, _lang_String[_lang_leftidleTitle]);
+	/*
+	switch (pDcChargingInfo->Type) {
+	case _Type_Chademo:
+		strcat(GunType, "CHAdeMo");
+		break;
+	case _Type_CCS_2:
+		strcat(GunType, (pDcChargingInfo->CCSGunType <= _TYPE_CCS1_Liquid) ? "CCS1" : "CCS2");
+		break;
+	case _Type_GB:
+		strcat(GunType, "GBT");
+		break;
+	}
+	*/
+	sprintf(textList.textString, "%s", GunType);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_BOLD);
+	textList.textSize = 25;
+	publish_textview_add(mosq, &textList, 1);
+	/*
+	// Script
+	textList.textviewIndex = _text_leftScript;
+	textList.layout_x = 188;
+	textList.layout_y = 850;
+	textList.color_r = 0;
+	textList.color_g = 85;
+	textList.color_b = 184;
+	textList.width = 200;
+	textList.alignment = ALIGNMENT_LEFT;
+	sprintf(textList.textString, _lang_String[_lang_idleScript]);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_BOLD);
+	textList.textSize = 25;
+	publish_textview_add(mosq, &textList, 1);
+	*/
+}
+void showTextRightGunIdle()
+{
+	struct ChargingInfoData* pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(RIGHT_GUN_NUM);
+	if (!pDcChargingInfo->IsAvailable)
+		return;
+	Text_List textList;
+	char GunType[30];
+	textList.textviewIndex = _text_rightTitle;
+	textList.layout_x = 540;
+	textList.layout_y = 789;
+	textList.color_r = 0;
+	textList.color_g = 85;
+	textList.color_b = 184;
+	textList.alignment = ALIGNMENT_CENTER;
+	textList.width = 540;
+	strcpy(GunType, _lang_String[_lang_rightidleTitle]);
+	/*
+	switch (pDcChargingInfo->Type) {
+	case _Type_Chademo:
+		strcat(GunType, "CHAdeMo");
+		break;
+	case _Type_CCS_2:
+		strcat(GunType, (pDcChargingInfo->CCSGunType <= _TYPE_CCS1_Liquid) ? "CCS1" : "CCS2");
+		break;
+	case _Type_GB:
+		strcat(GunType, "GBT");
+		break;
+	}
+	*/
+	sprintf(textList.textString, "%s", GunType);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_BOLD);
+	textList.textSize = 25;
+	publish_textview_add(mosq, &textList, 1);
+	/*
+	// Script
+	textList.textviewIndex = _text_rightScript;
+	textList.layout_x = 726;
+	textList.layout_y = 850;
+	textList.color_r = 0;
+	textList.color_g = 85;
+	textList.color_b = 184;
+	textList.width = 200;
+	textList.alignment = ALIGNMENT_LEFT;
+	sprintf(textList.textString, _lang_String[_lang_idleScript]);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_BOLD);
+	textList.textSize = 25;
+	publish_textview_add(mosq, &textList, 1);
+	*/
+}
+
+void showTextLeftGunPlugin()
+{
+	struct ChargingInfoData* pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(LEFT_GUN_NUM);
+	Text_List textList;
+	char GunType[30];
+	textList.textviewIndex = _text_leftTitle;
+	textList.layout_x = 0;
+	textList.layout_y = 809;
+	textList.color_r = 0;
+	textList.color_g = 85;
+	textList.color_b = 184;
+	textList.alignment = ALIGNMENT_CENTER;
+	textList.width = 540;
+	/*
+	strcpy(GunType, _lang_String[_lang_leftGun]);
+	switch (pDcChargingInfo->Type) {
+	case _Type_Chademo:
+		strcat(GunType, "CHAdeMo");
+		break;
+	case _Type_CCS_2:
+		strcat(GunType, (pDcChargingInfo->CCSGunType <= _TYPE_CCS1_Liquid) ? "CCS1" : "CCS2");
+		break;
+	case _Type_GB:
+		strcat(GunType, "GBT");
+		break;
+	}
+	*/
+	strcpy(GunType, _lang_String[_lang_pluginTitle]);
+	sprintf(textList.textString, "%s", GunType);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_BOLD);
+	textList.textSize = 25;
+	publish_textview_add(mosq, &textList, 1);
+
+	// Script
+	textList.textviewIndex = _text_leftScript;
+	textList.layout_x = 0;
+	textList.layout_y = 870;
+	textList.color_r = 0;
+	textList.color_g = 0;
+	textList.color_b = 0;
+	textList.width = 540;
+	textList.alignment = ALIGNMENT_CENTER;
+	sprintf(textList.textString, _lang_String[_lang_leftpluginScript]);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_BOLD);
+	textList.textSize = 20;
+	publish_textview_add(mosq, &textList, 1);
+}
+
+void CheckConnectionTimeout(void)
+{
+	SelectGunInfo* ShmSelectGunInfo = (SelectGunInfo*)GetShmSelectGunInfo();
+	if (ShmSelectGunInfo->RemoteSetup.ConnectionTimeout != 0) { //Jerry add
+		_connectionTimeout = ShmSelectGunInfo->RemoteSetup.ConnectionTimeout;
+	} else {
+		_connectionTimeout = CONN_PLUG_TIMEOUT;
+	}
+	return;
+}
+
+void showTextPluginCntDown(int gunIndex,int cntdown)
+{
+	CheckConnectionTimeout();
+	cntdown = _connectionTimeout - cntdown;
+	// CountDown
+	Text_List textList;
+	if (gunIndex == LEFT_GUN_NUM) {
+		textList.textviewIndex = _text_leftplugincntdown;
+		textList.layout_x = 129;
+	} else {
+		textList.textviewIndex = _text_rightplugincntdown;
+		textList.layout_x = 665;
+	}
+	textList.layout_y = 862;
+	textList.color_r = 42;
+	textList.color_g = 161;
+	textList.color_b = 252;
+	textList.width = 75;
+	textList.alignment = ALIGNMENT_CENTER;
+	sprintf(textList.textString, "%d", cntdown);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_BOLD);
+	textList.textSize = 28;
+	publish_textview_add(mosq, &textList, 1);
+}
+
+void showTextRightGunPlugin()
+{
+	struct ChargingInfoData* pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(RIGHT_GUN_NUM);
+	Text_List textList;
+	char GunType[30];
+	textList.textviewIndex = _text_rightTitle;
+	textList.layout_x = 540;
+	textList.layout_y = 809;
+	textList.color_r = 0;
+	textList.color_g = 85;
+	textList.color_b = 184;
+	textList.alignment = ALIGNMENT_CENTER;
+	textList.width = 540;
+	/*
+	strcpy(GunType, _lang_String[_lang_rightGun]);
+	switch (pDcChargingInfo->Type) {
+	case _Type_Chademo:
+		strcat(GunType, "CHAdeMo");
+		break;
+	case _Type_CCS_2:
+		strcat(GunType, (pDcChargingInfo->CCSGunType <= _TYPE_CCS1_Liquid) ? "CCS1" : "CCS2");
+		break;
+	case _Type_GB:
+		strcat(GunType, "GBT");
+		break;
+	}
+	*/
+	strcpy(GunType, _lang_String[_lang_pluginTitle]);
+	sprintf(textList.textString, "%s", GunType);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_BOLD);
+	textList.textSize = 25;
+	publish_textview_add(mosq, &textList, 1);
+
+	// Script
+	textList.textviewIndex = _text_rightScript;
+	textList.layout_x = 540;
+	textList.layout_y = 870;
+	textList.color_r = 0;
+	textList.color_g = 0;
+	textList.color_b = 0;
+	textList.width = 540;
+	textList.alignment = ALIGNMENT_CENTER;
+	sprintf(textList.textString, _lang_String[_lang_rightpluginScript]);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_BOLD);
+	textList.textSize = 20;
+	publish_textview_add(mosq, &textList, 1);
+
+}
+
+
+void showGunChargeInfo(int gunIndex)
+{
+	struct ChargingInfoData* pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(gunIndex);
+	int x_axis = 100;
+	int y_axis = 1405;
+	int x_shift = 155;
+	int y_shift = 98;
+	int idxShift = 0;
+	int gun_shift = 0;
+	if (gunIndex == RIGHT_GUN_NUM) {
+		idxShift = ICON_INDEX_SHIFT;
+		gun_shift = 540;
+	}
+	Image_List imageList[5] = { 0 };
+	imageList[0].imageviewIndex = _icon_chargingLine + idxShift;
+
+	imageList[0].imgsrc_addr = _icon_chargingLine;
+
+	imageList[0].layout_x = x_axis + gun_shift+ 55;
+	imageList[0].layout_y = y_axis + 45;
+	imageList[0].width = 311;
+	imageList[0].height = 283;
+
+	for (int i = 1; i <= 3; i++) {
+		switch (i) {
+		case 1:
+			imageList[i].imageviewIndex = _icon_summary_engergy + idxShift;
+			imageList[i].imgsrc_addr = _icon_summary_engergy;
+			break;
+		case 2:
+			imageList[i].imageviewIndex = _icon_summary_time + idxShift;
+			imageList[i].imgsrc_addr = _icon_summary_time;
+			break;
+		case 3:
+			imageList[i].imageviewIndex = _icon_summary_money + idxShift;
+			imageList[i].imgsrc_addr = _icon_summary_money;
+			break;
+		}
+		imageList[i].layout_x = x_axis + gun_shift;
+		imageList[i].layout_y = y_axis + ((i-1) % 3) * y_shift;
+		imageList[i].width = 40;
+		imageList[i].height = 40;
+	}
+
+	if (pDcChargingInfo->SystemStatus != S_AUTHORIZING &&
+		!is_chargingend(pDcChargingInfo->SystemStatus)) {
+		imageList[4].imageviewIndex = _icon_userprice_bg + idxShift;
+
+		imageList[4].imgsrc_addr = _icon_userprice_bg;
+
+		imageList[4].layout_x = x_axis + 72 + gun_shift;
+		imageList[4].layout_y = y_axis - 455;
+		imageList[4].width = 256;
+		imageList[4].height = 50;
+	}
+	publish_imageview_add(mosq, imageList, ARRAY_SIZE(imageList));
+
+	Text_List textList[6];
+	for (int i = 0; i < 3; i++) {
+		textList[i].textviewIndex = _text_leftEngergyScript + i + idxShift;
+		textList[i].layout_x = x_axis+ 55  + gun_shift;
+		textList[i].layout_y = y_axis + ((i % 3) * y_shift) - 20;
+		textList[i].color_r = 0;
+		textList[i].color_g = 0;
+		textList[i].color_b = 0;
+		textList[i].width = 200;
+		textList[i].alignment = ALIGNMENT_LEFT;
+		switch (i) {
+		case 0:
+			sprintf(textList[i].textString, _lang_String[_lang_engergy]);
+			break;
+		case 1:
+			sprintf(textList[i].textString, _lang_String[_lang_time]);
+			break;
+		case 2:
+			sprintf(textList[i].textString, _lang_String[_lang_ChargingFee]);
+			break;
+
+		}
+		sprintf(textList[i].textFont, FONT_ARIAL);
+		sprintf(textList[i].textStyle, FONT_STYLE_BOLD);
+		textList[i].textSize = 10;
+	}
+
+	for (int i = 0; i < 3; i++) {
+		textList[i+3].textviewIndex = _text_leftParkingFeeScript + i + idxShift;
+		textList[i+3].layout_x = x_axis + (i % 3) * x_shift + gun_shift;
+		textList[i+3].layout_y = y_axis + y_shift*3 -20;
+		textList[i+3].color_r = 0;
+		textList[i+3].color_g = 0;
+		textList[i+3].color_b = 0;
+		textList[i+3].width = 200;
+		textList[i+3].alignment = ALIGNMENT_LEFT;
+		switch (i) {
+		case 0:
+			sprintf(textList[i+3].textString, _lang_String[_lang_ParkingFee]);
+			break;
+		case 1:
+			sprintf(textList[i+3].textString, _lang_String[_lang_TotalCost]);
+			break;
+		case 2:
+			sprintf(textList[i+3].textString, _lang_String[_lang_RemainAmount]);
+			break;
+
+		}
+		sprintf(textList[i+3].textFont, FONT_ARIAL);
+		sprintf(textList[i+3].textStyle, FONT_STYLE_BOLD);
+		textList[i+3].textSize = 10;
+	}
+
+	publish_textview_add(mosq, textList, ARRAY_SIZE(textList));
+
+}
+
+void showSummaryChargeInfo()
+{
+	Image_List imageList[7];
+	for (int i = 0; i < 6; i++) {
+		imageList[i].imageviewIndex = _icon_summary_engergy + i;
+
+		imageList[i].imgsrc_addr = _icon_summary_engergy + i;;
+
+		imageList[i].layout_x = 441 + (i / 3) * 342;
+		imageList[i].layout_y = 1044 + (i % 3) * 120;
+		imageList[i].width = 65;
+		imageList[i].height = 65;
+	}
+	imageList[6].imageviewIndex = _icon_info_qr;
+	imageList[6].imgsrc_addr = _icon_info_qr;
+	imageList[6].layout_x = 70;
+	imageList[6].layout_y = 1052;
+	imageList[6].width = 268;
+	imageList[6].height = 268;
+
+	publish_imageview_add(mosq, imageList, ARRAY_SIZE(imageList));
+
+	Text_List textList[6];
+	for (int i = 0; i < 6; i++) {
+		textList[i].textviewIndex = _text_leftEngergyScript + i;
+		textList[i].layout_x = 531 + (i / 3) * 342;
+		textList[i].layout_y = 1049 + (i % 3) * 120;
+		textList[i].color_r = 0;
+		textList[i].color_g = 85;
+		textList[i].color_b = 184;
+		textList[i].width = 200;
+		textList[i].alignment = ALIGNMENT_LEFT;
+		switch (i) {
+		case 0:
+			sprintf(textList[i].textString, _lang_String[_lang_engergy]);
+			break;
+		case 1:
+			sprintf(textList[i].textString, _lang_String[_lang_ChargingFee]);
+			break;
+		case 2:
+			sprintf(textList[i].textString, _lang_String[_lang_time]);
+			break;
+		case 3:
+			sprintf(textList[i].textString, _lang_String[_lang_ParkingFee]);
+			break;
+		case 4:
+			sprintf(textList[i].textString, _lang_String[_lang_TotalCost]);
+			break;
+		case 5:
+			sprintf(textList[i].textString, _lang_String[_lang_RemainAmount]);
+			break;
+		}
+
+		sprintf(textList[i].textFont, FONT_ARIAL);
+		sprintf(textList[i].textStyle, FONT_STYLE_BOLD);
+		textList[i].textSize = 13;
+	}
+	publish_textview_add(mosq, textList, ARRAY_SIZE(textList));
+
+
+	struct ChargingInfoData* pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(pSysInfo->CurGunSelected);
+	SelectGunInfo* ShmSelectGunInfo = (SelectGunInfo*)GetShmSelectGunInfo();
+
+	float energy = pDcChargingInfo->PresentChargedEnergy;
+	float chargingfee = ShmSelectGunInfo->PricesInfo[pSysInfo->CurGunSelected].EnergyCost;
+	int sec = pDcChargingInfo->PresentChargedDuration;
+	float parkingfee = ShmSelectGunInfo->PricesInfo[pSysInfo->CurGunSelected].ParkingFee;
+	float totalcost = pDcChargingInfo->ChargingFee;
+	float remainamount = ShmSelectGunInfo->PricesInfo[pSysInfo->CurGunSelected].RemainAmount;
+
+	/////////////////////////////////////////////////////////////
+	if (energy < 0)
+		energy = 0;
+	textList[0].textviewIndex = _text_leftEngergyValue;
+	textList[0].layout_x = 531;
+	textList[0].layout_y = 1075;
+	textList[0].color_r = 0;
+	textList[0].color_g = 85;
+	textList[0].color_b = 184;
+	sprintf(textList[0].textStyle, FONT_STYLE_BOLD);
+
+	textList[0].textSize = 15;
+	textList[0].width = 200;
+	textList[0].alignment = ALIGNMENT_LEFT;
+	sprintf(textList[0].textString, "%.4f", energy);
+	sprintf(textList[0].textFont, FONT_ARIAL);
+	/////////////////////////////////////////////////////////////
+	if (chargingfee < 0)
+		chargingfee = 0;
+
+	textList[1].textviewIndex = _text_leftChargingFeeValue;
+	textList[1].layout_x = 531;
+	textList[1].layout_y = 1075 + 120;
+	textList[1].color_r = 0;
+	textList[1].color_g = 85;
+	textList[1].color_b = 184;
+	sprintf(textList[1].textStyle, FONT_STYLE_BOLD);
+
+	textList[1].width = 200;
+	textList[1].alignment = ALIGNMENT_LEFT;
+	sprintf(textList[1].textString, "%.4f", chargingfee);
+	sprintf(textList[1].textFont, FONT_ARIAL);
+	textList[1].textSize = 15;
+	/////////////////////////////////////////////////////////////
+	if (sec < 0)
+		sec = 0;
+	char time[20] = { 0 };
+	sprintf(time, "%02d:%02d:%02d", sec / 3600, (sec % 3600) / 60, sec % 60);
+
+	textList[2].textviewIndex = _text_leftTimeValue;
+	textList[2].layout_x = 531;
+	textList[2].layout_y = 1075 + 120 * 2;
+	textList[2].color_r = 0;
+	textList[2].color_g = 85;
+	textList[2].color_b = 184;
+	sprintf(textList[2].textStyle, FONT_STYLE_BOLD);
+
+	textList[2].width = 200;
+	textList[2].alignment = ALIGNMENT_LEFT;
+	sprintf(textList[2].textString, time);
+	sprintf(textList[2].textFont, FONT_ARIAL);
+	textList[2].textSize = 15;
+	/////////////////////////////////////////////////////////////
+	if (parkingfee < 0)
+		parkingfee = 0;
+	textList[3].textviewIndex = _text_leftParkingFeeValue;
+	textList[3].layout_x = 531 + 342;
+	textList[3].layout_y = 1075;
+	textList[3].color_r = 0;
+	textList[3].color_g = 85;
+	textList[3].color_b = 184;
+	sprintf(textList[3].textString, "%.2f", parkingfee);
+	textList[3].textSize = 15;
+	sprintf(textList[3].textStyle, FONT_STYLE_BOLD);
+	/////////////////////////////////////////////////////////////
+	if (totalcost < 0)
+		totalcost = 0;
+
+	textList[4].textviewIndex = _text_leftTotalCostValue;
+	textList[4].layout_x = 531 + 342;
+	textList[4].layout_y = 1075 + 120;
+	textList[4].color_r = 0;
+	textList[4].color_g = 85;
+	textList[4].color_b = 184;
+	sprintf(textList[4].textStyle, FONT_STYLE_BOLD);
+
+	textList[4].width = 200;
+	textList[4].alignment = ALIGNMENT_LEFT;
+	sprintf(textList[4].textString, "%.2f", totalcost);
+	sprintf(textList[4].textFont, FONT_ARIAL);
+	textList[4].textSize = 15;
+	/////////////////////////////////////////////////////////////
+	if (remainamount < 0)
+		remainamount = 0;
+
+	textList[5].textviewIndex = _text_leftRemainAmountValue;
+	textList[5].layout_x = 531 + 342;
+	textList[5].layout_y = 1075 + 120 * 2;
+	textList[5].color_r = 0;
+	textList[5].color_g = 85;
+	textList[5].color_b = 184;
+	sprintf(textList[5].textStyle, FONT_STYLE_BOLD);
+
+	textList[5].width = 200;
+	textList[5].alignment = ALIGNMENT_LEFT;
+	sprintf(textList[5].textString, "%.2f", remainamount);
+	sprintf(textList[5].textFont, FONT_ARIAL);
+	textList[5].textSize = 15;
+
+	publish_textview_add(mosq, textList, ARRAY_SIZE(textList));
+
+	if (strcmp(ShmDcCommonData->pGunInfo[pSysInfo->CurGunSelected].ReceiptInfo, "") != EQUAL) {
+		QrCode_List qrCodeList = { 0 };
+
+		qrCodeList.qrCodeIndex = _icon_qr;
+		sprintf((char*)qrCodeList.qrCodeContent, (char*)ShmDcCommonData->pGunInfo[pSysInfo->CurGunSelected].ReceiptInfo);
+		sprintf((char*)qrCodeList.errorCorrection, "M");
+		qrCodeList.layout_x = 84;//(rand()%800+100);
+		qrCodeList.layout_y = 1066;//(rand()%800+100);
+		qrCodeList.width = 240;
+		qrCodeList.height = 240;
+
+		publish_qrcodeimage_add(mosq, &qrCodeList, 1);
+	}
+
+}
+void showTextChargingInfo(int gunIndex)
+{
+	struct ChargingInfoData* pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(gunIndex);
+	SelectGunInfo* ShmSelectGunInfo = (SelectGunInfo*)GetShmSelectGunInfo();
+
+	float energy = pDcChargingInfo->PresentChargedEnergy;
+	float chargingfee = ShmSelectGunInfo->PricesInfo[gunIndex].EnergyCost;
+	int sec = pDcChargingInfo->PresentChargedDuration;
+	float parkingfee = ShmSelectGunInfo->PricesInfo[gunIndex].ParkingFee;
+	float totalcost = pDcChargingInfo->ChargingFee;
+	float remainamount = ShmSelectGunInfo->PricesInfo[gunIndex].RemainAmount;
+	float power = pDcChargingInfo->PresentChargingPower;
+
+	int x_axis = 100;
+	int y_axis = 1405;
+	int x_shift = 155;
+	int y_shift = 98;
+	int idxShift = 0;
+	int gun_shift = 0;
+	if (gunIndex == RIGHT_GUN_NUM) {
+		idxShift = ICON_INDEX_SHIFT;
+		gun_shift = 540;
+	}
+	/////////////////////////////////////////////////////////////
+	if (energy < 0)
+		energy = 0;
+	Text_List textList[7];
+
+	textList[0].textviewIndex = _text_leftEngergyValue + idxShift;
+	textList[0].layout_x = x_axis + 55 + gun_shift;
+	textList[0].layout_y = y_axis + (0 % 3) * y_shift;;
+	textList[0].color_r = 0;
+	textList[0].color_g = 85;
+	textList[0].color_b = 184;
+	sprintf(textList[0].textStyle, FONT_STYLE_NORMAL);
+
+	textList[0].textSize = 20;
+	textList[0].width = 200;
+	textList[0].alignment = ALIGNMENT_LEFT;
+	sprintf(textList[0].textString, "%.4f", energy);
+	sprintf(textList[0].textFont, FONT_ARIAL);
+	/////////////////////////////////////////////////////////////
+	if (chargingfee < 0)
+		chargingfee = 0;
+
+	textList[1].textviewIndex = _text_leftChargingFeeValue + idxShift;;
+	textList[1].layout_x = x_axis + 55 + gun_shift;
+	textList[1].layout_y = y_axis + (2 % 3) * y_shift;;
+
+	textList[1].color_r = 0;
+	textList[1].color_g = 85;
+	textList[1].color_b = 184;
+	sprintf(textList[1].textStyle, FONT_STYLE_NORMAL);
+
+	textList[1].width = 200;
+	textList[1].alignment = ALIGNMENT_LEFT;
+	sprintf(textList[1].textString, "%.4f", chargingfee);
+	sprintf(textList[1].textFont, FONT_ARIAL);
+	textList[1].textSize = 20;
+	/////////////////////////////////////////////////////////////
+	if (sec < 0)
+		sec = 0;
+	char time[20] = { 0 };
+	sprintf(time, "%02d:%02d:%02d", sec / 3600, (sec % 3600) / 60, sec % 60);
+
+	textList[2].textviewIndex = _text_leftTimeValue + idxShift;
+	textList[2].layout_x = x_axis + 55 + gun_shift;
+	textList[2].layout_y = y_axis + (1 % 3) * y_shift;;
+
+	textList[2].color_r = 0;
+	textList[2].color_g = 85;
+	textList[2].color_b = 184;
+	sprintf(textList[2].textStyle, FONT_STYLE_NORMAL);
+
+	textList[2].width = 200;
+	textList[2].alignment = ALIGNMENT_LEFT;
+	sprintf(textList[2].textString, time);
+	sprintf(textList[2].textFont, FONT_ARIAL);
+	textList[2].textSize = 20;
+	/////////////////////////////////////////////////////////////
+	if (parkingfee < 0)
+		parkingfee = 0;
+	textList[3].textviewIndex = _text_leftParkingFeeValue + idxShift;
+	textList[3].layout_x = x_axis + (3 % 3) * x_shift + gun_shift;
+	textList[3].layout_y = y_axis + y_shift * 3;
+	textList[3].color_r = 0;
+	textList[3].color_g = 85;
+	textList[3].color_b = 184;
+	sprintf(textList[3].textStyle, FONT_STYLE_NORMAL);
+	textList[3].width = 200;
+	textList[3].alignment = ALIGNMENT_LEFT;
+	sprintf(textList[3].textString, "%.2f", parkingfee);
+	sprintf(textList[3].textFont, FONT_ARIAL);
+	textList[3].textSize = 15;
+	/////////////////////////////////////////////////////////////
+	if (totalcost < 0)
+		totalcost = 0;
+
+	textList[4].textviewIndex = _text_leftTotalCostValue + idxShift;
+	textList[4].layout_x = x_axis + (4 % 3) * x_shift + gun_shift;
+	textList[4].layout_y = y_axis + y_shift * 3 ;
+	textList[4].color_r = 0;
+	textList[4].color_g = 85;
+	textList[4].color_b = 184;
+	sprintf(textList[4].textStyle, FONT_STYLE_NORMAL);
+
+	textList[4].width = 200;
+	textList[4].alignment = ALIGNMENT_LEFT;
+	sprintf(textList[4].textString, "%.2f", totalcost);
+	sprintf(textList[4].textFont, FONT_ARIAL);
+	textList[4].textSize = 15;
+	/////////////////////////////////////////////////////////////
+	if (remainamount < 0)
+		remainamount = 0;
+
+	textList[5].textviewIndex = _text_leftRemainAmountValue + idxShift;
+	textList[5].layout_x = x_axis + (5 % 3) * x_shift + gun_shift;
+	textList[5].layout_y = y_axis + y_shift * 3 ;
+
+	textList[5].color_r = 0;
+	textList[5].color_g = 85;
+	textList[5].color_b = 184;
+	sprintf(textList[5].textStyle, FONT_STYLE_NORMAL);
+
+	textList[5].width = 200;
+	textList[5].alignment = ALIGNMENT_LEFT;
+	sprintf(textList[5].textString, "%.2f", remainamount);
+	sprintf(textList[5].textFont, FONT_ARIAL);
+	textList[5].textSize = 15;
+
+	/////////////////////////////////////////////////////////////
+	if (power < 0)
+		power = 0;
+	if (pDcChargingInfo->SystemStatus == S_CHARGING) {
+		if (gunIndex == LEFT_GUN_NUM) {
+			textList[6].textviewIndex = _text_leftPowerValue;
+			textList[6].layout_x = 250;
+
+		} else {
+			textList[6].textviewIndex = _text_rightPowerValue;
+			textList[6].layout_x = 790;
+		}
+		textList[6].layout_y = 1140;
+		textList[6].color_r = 0;
+		textList[6].color_g = 85;
+		textList[6].color_b = 184;
+		sprintf(textList[6].textStyle, FONT_STYLE_NORMAL);
+	}
+	textList[6].width = 200;
+	textList[6].alignment = ALIGNMENT_LEFT;
+	if (power > 100)
+		sprintf(textList[6].textString, "%d kW", (int)power);
+	else if (power > 10)
+		sprintf(textList[6].textString, "%.1f kW", power);
+	else
+		sprintf(textList[6].textString, "%.2f kW", power);
+	sprintf(textList[6].textFont, FONT_ARIAL);
+	textList[6].textSize = 15;
+
+	publish_textview_add(mosq, textList, ARRAY_SIZE(textList));
+
+}
+
+void showTextPrechargingTitle(int gunIndex)
+{
+	struct ChargingInfoData* pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(gunIndex);
+	Text_List textList;
+	char GunType[30] = {0};
+	if (gunIndex == LEFT_GUN_NUM) {
+		textList.textviewIndex = _text_leftTitle;
+		textList.layout_x = 0;
+	} else {
+		textList.textviewIndex = _text_rightTitle;
+		textList.layout_x = 540;
+	}
+	textList.layout_y = 809;
+	textList.color_r = 0;
+	textList.color_g = 85;
+	textList.color_b = 184;
+	textList.alignment = ALIGNMENT_CENTER;
+	textList.width = 540;
+
+	strcat(GunType, _lang_String[_lang_prechargingTitle]);
+	sprintf(textList.textString, "%s", GunType);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_BOLD);
+	textList.textSize = 25;
+	publish_textview_add(mosq, &textList, 1);
+
+
+	if (gunIndex == LEFT_GUN_NUM) {
+		textList.layout_x = 0;
+		textList.textviewIndex = _text_leftScript;
+	} else {
+		textList.layout_x = 540;
+
+		textList.textviewIndex = _text_rightScript;
+	}
+	textList.layout_y = 920;
+	textList.color_r = 0;
+	textList.color_g = 85;
+	textList.color_b = 184;
+	textList.width = 540;
+	textList.alignment = ALIGNMENT_CENTER;
+	sprintf(textList.textString, _lang_String[_lang_UserPriceScript]);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_BOLD);
+	textList.textSize = 15;
+	publish_textview_add(mosq, &textList, 1);
+}
+
+void showTextChargingTitle(int gunIndex)
+{
+	struct ChargingInfoData* pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(gunIndex);
+	Text_List textList;
+	char GunType[30];
+	if (gunIndex == LEFT_GUN_NUM) {
+		textList.textviewIndex = _text_leftTitle;
+		textList.layout_x = 0;
+	} else {
+		textList.textviewIndex = _text_rightTitle;
+		textList.layout_x = 540;
+	}
+	textList.layout_y = 809;
+	textList.color_r = 0;
+	textList.color_g = 85;
+	textList.color_b = 184;
+	textList.alignment = ALIGNMENT_CENTER;
+	textList.width = 540;
+	strcpy(GunType, gunIndex == LEFT_GUN_NUM ? _lang_String[_lang_leftGun] : _lang_String[_lang_rightGun]);
+	/*
+	switch (pDcChargingInfo->Type) {
+	case _Type_Chademo:
+		strcat(GunType, "CHAdeMo");
+		break;
+	case _Type_CCS_2:
+		strcat(GunType, (pDcChargingInfo->CCSGunType <= _TYPE_CCS1_Liquid) ? "CCS1" : "CCS2");
+		break;
+	case _Type_GB:
+		strcat(GunType, "GBT");
+		break;
+	}
+	*/
+	strcat(GunType, _lang_String[_lang_chargingTitle]);
+	sprintf(textList.textString, "%s", GunType);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_BOLD);
+	textList.textSize = 25;
+	publish_textview_add(mosq, &textList, 1);
+
+
+	if (gunIndex == LEFT_GUN_NUM) {
+		textList.layout_x = 0;
+		textList.textviewIndex = _text_leftScript;
+	} else {
+		textList.layout_x = 540;
+
+		textList.textviewIndex = _text_rightScript;
+	}
+	textList.layout_y = 920;
+	textList.color_r = 0;
+	textList.color_g = 85;
+	textList.color_b = 184;
+	textList.width = 540;
+	textList.alignment = ALIGNMENT_CENTER;
+	sprintf(textList.textString, _lang_String[_lang_UserPriceScript]);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_BOLD);
+	textList.textSize = 15;
+	publish_textview_add(mosq, &textList, 1);
+}
+
+void showTextCompleteCharging(int gunIndex)
+{
+	struct ChargingInfoData* pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(gunIndex);
+	Text_List textList;
+	char GunType[30];
+	if (gunIndex == LEFT_GUN_NUM) {
+		textList.textviewIndex = _text_leftTitle;
+		textList.layout_x = 0;
+		textList.layout_y = 809;
+	} else {
+		textList.textviewIndex = _text_rightTitle;
+		textList.layout_x = 540;
+		textList.layout_y = 809;
+	}
+	textList.color_r = 0;
+	textList.color_g = 85;
+	textList.color_b = 184;
+	textList.alignment = ALIGNMENT_CENTER;
+	textList.width = 540;
+	strcpy(GunType, gunIndex == LEFT_GUN_NUM ? _lang_String[_lang_leftGun] : _lang_String[_lang_rightGun]);
+	/*
+	switch (pDcChargingInfo->Type) {
+	case _Type_Chademo:
+		strcat(GunType, "CHAdeMo");
+		break;
+	case _Type_CCS_2:
+		strcat(GunType, (pDcChargingInfo->CCSGunType <= _TYPE_CCS1_Liquid) ? "CCS1" : "CCS2");
+		break;
+	case _Type_GB:
+		strcat(GunType, "GBT");
+		break;
+	}
+	*/
+	strcat(GunType, _lang_String[_lang_StopChargingTitlte]);
+	sprintf(textList.textString, "%s", GunType);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_BOLD);
+	textList.textSize = 25;
+	publish_textview_add(mosq, &textList, 1);
+
+	// Script
+
+	if (gunIndex == LEFT_GUN_NUM) {
+		textList.textviewIndex = _text_leftScript;
+		textList.layout_x = 0;
+		textList.layout_y = 870;
+	} else {
+		textList.textviewIndex = _text_rightScript;
+		textList.layout_x = 540;
+		textList.layout_y = 870;
+	}
+	textList.color_r = 0;
+	textList.color_g = 0;
+	textList.color_b = 0;
+	textList.width = 540;
+	textList.alignment = ALIGNMENT_CENTER;
+	sprintf(textList.textString, _lang_String[_lang_StopChargingScript]);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_NORMAL);
+	textList.textSize = 20;
+	publish_textview_add(mosq, &textList, 1);
+}
+
+void showTextReOperate(int gunIndex)
+{
+	struct ChargingInfoData* pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(gunIndex);
+	Text_List textList;
+	char GunType[30];
+	if (gunIndex == LEFT_GUN_NUM) {
+		textList.textviewIndex = _text_leftTitle;
+		textList.layout_x = 0;
+		textList.layout_y = 809;
+	} else {
+		textList.textviewIndex = _text_rightTitle;
+		textList.layout_x = 540;
+		textList.layout_y = 809;
+	}
+	textList.color_r = 0;
+	textList.color_g = 85;
+	textList.color_b = 184;
+	textList.alignment = ALIGNMENT_CENTER;
+	textList.width = 540;
+	strcpy(GunType, _lang_String[_lang_ReOperateTitlte]);
+	sprintf(textList.textString, "%s", GunType);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_BOLD);
+	textList.textSize = 25;
+	publish_textview_add(mosq, &textList, 1);
+
+	// Script
+
+	if (gunIndex == LEFT_GUN_NUM) {
+		textList.textviewIndex = _text_leftScript;
+		textList.layout_x = 0;
+		textList.layout_y = 870;
+	} else {
+		textList.textviewIndex = _text_rightScript;
+		textList.layout_x = 540;
+		textList.layout_y = 870;
+	}
+	textList.color_r = 0;
+	textList.color_g = 0;
+	textList.color_b = 0;
+	textList.width = 540;
+	textList.alignment = ALIGNMENT_CENTER;
+	sprintf(textList.textString, _lang_String[_lang_ReOperateScript]);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_NORMAL);
+	textList.textSize = 20;
+	publish_textview_add(mosq, &textList, 1);
+}
+
+void showAlarmCode_QRURL(int gunIndex)
+{
+	char cmd[30] = { 0 };
+	struct ChargingInfoData* pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(gunIndex);
+
+	Image_List imageList[2];
+	imageList[0].imageviewIndex = _icon_alarm_bg;
+	imageList[0].imgsrc_addr = _icon_alarm_bg;
+	imageList[0].layout_x = 441;
+	imageList[0].layout_y = 1094;
+	imageList[0].width = 362;
+	imageList[0].height = 52;
+
+	imageList[1].imageviewIndex = _icon_info_qr;
+	imageList[1].imgsrc_addr = _icon_info_qr;
+	imageList[1].layout_x = 70;
+	imageList[1].layout_y = 1052;
+	imageList[1].width = 268;
+	imageList[1].height = 268;
+	publish_imageview_add(mosq, imageList, ARRAY_SIZE(imageList));
+
+	Text_List textList[3];
+	textList[0].textviewIndex = _text_alarmcode;
+	textList[0].layout_x = 441;
+	textList[0].layout_y = 1099;
+	textList[0].color_r = 255;
+	textList[0].color_g = 255;
+	textList[0].color_b = 255;
+	textList[0].width = 362;
+	textList[0].alignment = ALIGNMENT_CENTER;
+	strcpy(cmd, _lang_String[_lang_alarmcode]);
+	//sprintf(pDcChargingInfo->EvConnAlarmCode, "012304");
+	strcat(cmd, pDcChargingInfo->EvConnAlarmCode);
+	sprintf(textList[0].textString, "%s",cmd);
+	sprintf(textList[0].textFont, FONT_ARIAL);
+	sprintf(textList[0].textStyle, FONT_STYLE_BOLD);
+	textList[0].textSize = 20;
+	
+	textList[1].textviewIndex = _text_systemTitle;
+	textList[1].layout_x = 450;
+	textList[1].layout_y = 1200;
+	textList[1].color_r = 0;
+	textList[1].color_g = 0;
+	textList[1].color_b = 0;
+	textList[1].width = 500;
+	textList[1].alignment = ALIGNMENT_LEFT;
+	strcpy(textList[1].textString, _lang_String[_lang_alarmTitle]);
+	sprintf(textList[1].textFont, FONT_ARIAL);
+	sprintf(textList[1].textStyle, FONT_STYLE_NORMAL);
+	textList[1].textSize = 20;
+
+	textList[2].textviewIndex = _text_systemScript;
+	textList[2].layout_x = 450;
+	textList[2].layout_y = 1240;
+	textList[2].color_r = 0;
+	textList[2].color_g = 0;
+	textList[2].color_b = 0;
+	textList[2].width = 500;
+	textList[2].alignment = ALIGNMENT_LEFT;
+	strcpy(textList[2].textString, _lang_String[_lang_alarmScript]);
+	sprintf(textList[2].textFont, FONT_ARIAL);
+	sprintf(textList[2].textStyle, FONT_STYLE_NORMAL);
+	textList[2].textSize = 20;
+	publish_textview_add(mosq, textList, ARRAY_SIZE(textList));
+
+	QrCode_List qrCodeList;
+	qrCodeList.qrCodeIndex = _icon_qr;
+	sprintf((char*)qrCodeList.qrCodeContent, _ALARMQRCODEURL);
+	sprintf((char*)qrCodeList.errorCorrection, "M");
+	qrCodeList.layout_x = 74;//(rand()%800+100);
+	qrCodeList.layout_y = 1056;//(rand()%800+100);
+	qrCodeList.width = 260;
+	qrCodeList.height = 260;
+
+	publish_qrcodeimage_add(mosq, &qrCodeList, 1);
+
+}
+
+void showFixContect()
+{
+	Image_List imageList[2];
+	imageList[0].imageviewIndex = _icon_fix;
+	imageList[0].imgsrc_addr = _icon_fix;
+	imageList[0].layout_x = 392;
+	imageList[0].layout_y = 1094;
+	imageList[0].width = 296;
+	imageList[0].height = 267;
+
+	imageList[1].imageviewIndex = _icon_phone;
+	imageList[1].imgsrc_addr = _icon_phone;
+	imageList[1].layout_x = 455;
+	imageList[1].layout_y = 927;
+	imageList[1].width = 35;
+	imageList[1].height = 34;
+	publish_imageview_add(mosq, imageList, ARRAY_SIZE(imageList));
+
+	// Title
+	Text_List textList;
+	textList.textviewIndex = _text_systemTitle;
+	textList.layout_x = 0;
+	textList.layout_y = 807;
+	textList.color_r = 0;
+	textList.color_g = 85;
+	textList.color_b = 184;
+	textList.width = 1080;
+	textList.alignment = ALIGNMENT_CENTER;
+	sprintf(textList.textString, _lang_String[_lang_fixTitle]);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_BOLD);
+	textList.textSize = 30;
+	publish_textview_add(mosq, &textList, 1);
+	// Script
+	textList.textviewIndex = _text_systemScript;
+	textList.layout_x = 0;
+	textList.layout_y = 867;
+	textList.color_r = 0;
+	textList.color_g = 0;
+	textList.color_b = 0;
+	textList.width = 1080;
+	textList.alignment = ALIGNMENT_CENTER;
+	sprintf(textList.textString, _lang_String[_lang_fixScript]);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_NORMAL);
+	textList.textSize = 20;
+	publish_textview_add(mosq, &textList, 1);
+
+	// Script
+	textList.textviewIndex = _text_fixphone;
+	textList.layout_x = 500;
+	textList.layout_y = 922;
+	textList.color_r = 0;
+	textList.color_g = 0;
+	textList.color_b = 0;
+	textList.width = 540;
+	textList.alignment = ALIGNMENT_LEFT;
+	sprintf(textList.textString, _phone);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_NORMAL);
+	textList.textSize = 20;
+	publish_textview_add(mosq, &textList, 1);
+}
+
+void showPlugoutContect()
+{
+	Image_List imageList[1];
+	imageList[0].imageviewIndex = _icon_exclamation;
+	imageList[0].imgsrc_addr = _icon_exclamation;
+	imageList[0].layout_x = 392;
+	imageList[0].layout_y = 837;
+	imageList[0].width = 296;
+	imageList[0].height = 267;
+	publish_imageview_add(mosq, imageList, ARRAY_SIZE(imageList));
+
+	// Title
+	Text_List textList;
+	textList.textviewIndex = _text_systemTitle;
+	textList.layout_x = 0;
+	textList.layout_y = 1194;
+	textList.color_r = 0;
+	textList.color_g = 85;
+	textList.color_b = 184;
+	textList.width = 1080;
+	textList.alignment = ALIGNMENT_CENTER;
+	sprintf(textList.textString, _lang_String[_lang_plugout]);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_BOLD);
+	textList.textSize = 30;
+	publish_textview_add(mosq, &textList, 1);
+
+}
+void showHelpContect()
+{
+	Image_List imageList[1];
+	imageList[0].imageviewIndex = _icon_help;
+	imageList[0].imgsrc_addr = _icon_help;
+	imageList[0].layout_x = 392;
+	imageList[0].layout_y = 837;
+	imageList[0].width = 296;
+	imageList[0].height = 267;
+	publish_imageview_add(mosq, imageList, ARRAY_SIZE(imageList));
+	
+	// Title
+	Text_List textList[2];
+
+	textList[0].textviewIndex = _text_systemTitle;
+	textList[0].layout_x = 0;
+	textList[0].layout_y = 1194;
+	textList[0].color_r = 0;
+	textList[0].color_g = 0;
+	textList[0].color_b = 0;
+	textList[0].width = 1080;
+	textList[0].alignment = ALIGNMENT_CENTER;
+	if (ShmDcCommonData->previousPage == _PAGE_AUTHORIZE_FAIL) {
+		sprintf(textList[0].textString, _lang_String[_lang_HelpAuthFailTitle]);
+	} else {
+		if (ShmDcCommonData->pGunInfo[0].WaitForPlugit ||
+			ShmDcCommonData->pGunInfo[1].WaitForPlugit) {
+			sprintf(textList[0].textString, _lang_String[_lang_HelpPlugInTitle]);
+		} else {
+			sprintf(textList[0].textString, _lang_String[_lang_HelpChargingTitle]);
+			textList[0].color_r = 0;
+			textList[0].color_g = 85;
+			textList[0].color_b = 184;
+		}
+
+	}
+	sprintf(textList[0].textFont, FONT_ARIAL);
+	sprintf(textList[0].textStyle, FONT_STYLE_NORMAL);
+	textList[0].textSize = 20;
+
+
+	textList[1].textviewIndex = _text_systemScript;
+	textList[1].layout_x = 0;
+	textList[1].layout_y = 1244;
+	textList[1].color_r = 0;
+	textList[1].color_g = 0;
+	textList[1].color_b = 0;
+	textList[1].width = 1080;
+	textList[1].alignment = ALIGNMENT_CENTER;
+	if (ShmDcCommonData->previousPage == _PAGE_AUTHORIZE_FAIL) {
+		sprintf(textList[1].textString, _lang_String[_lang_HelpAuthFailScript]);
+	} else {
+		if (ShmDcCommonData->pGunInfo[0].WaitForPlugit ||
+			ShmDcCommonData->pGunInfo[1].WaitForPlugit) {
+			sprintf(textList[1].textString, _lang_String[_lang_HelpPlugInScript]);
+		} else {
+			sprintf(textList[1].textString, _lang_String[_lang_HelpChargingScript]);
+		}
+
+	}
+	sprintf(textList[1].textFont, FONT_ARIAL);
+	sprintf(textList[1].textStyle, FONT_STYLE_NORMAL);
+	textList[1].textSize = 20;
+	publish_textview_add(mosq, textList, ARRAY_SIZE(textList));
+	
+
+}
+void showEMGContect()
+{
+	Image_List imageList;
+	imageList.imageviewIndex = _icon_EMG;
+	imageList.imgsrc_addr = _icon_EMG;
+	imageList.layout_x = 200;
+	imageList.layout_y = 1050;
+	imageList.width = 723;
+	imageList.height = 766;
+	publish_imageview_add(mosq, &imageList, 1);
+
+	// Title
+	Text_List textList;
+	textList.textviewIndex = _text_systemTitle;
+	textList.layout_x = 0;
+	textList.layout_y = 807;
+	textList.color_r = 0;
+	textList.color_g = 85;
+	textList.color_b = 184;
+	textList.width = 1080;
+	textList.alignment = ALIGNMENT_CENTER;
+	sprintf(textList.textString, _lang_String[_lang_EMGTitle]);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_BOLD);
+	textList.textSize = 30;
+	publish_textview_add(mosq, &textList, 1);
+	// Script
+	textList.textviewIndex = _text_systemScript;
+	textList.layout_x = 0;
+	textList.layout_y = 867;
+	textList.color_r = 0;
+	textList.color_g = 0;
+	textList.color_b = 0;
+	textList.width = 1080;
+	textList.alignment = ALIGNMENT_CENTER;
+	sprintf(textList.textString, _lang_String[_lang_EMGScript]);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_NORMAL);
+	textList.textSize = 20;
+	publish_textview_add(mosq, &textList, 1);
+
+}
+
+void showStopChargingByRFID()
+{
+	Image_List imageList;
+	imageList.imageviewIndex = _icon_rfid_stop;
+	imageList.imgsrc_addr = _icon_rfid_stop;
+	imageList.layout_x = 397;
+	imageList.layout_y = 1050;
+	imageList.width = 323;
+	imageList.height = 259;
+	publish_imageview_add(mosq, &imageList, 1);
+
+	// Title
+	Text_List textList;
+	textList.textviewIndex = _text_systemTitle;
+	textList.layout_x = 0;
+	textList.layout_y = 807;
+	textList.color_r = 0;
+	textList.color_g = 85;
+	textList.color_b = 184;
+	textList.width = 1080;
+	textList.alignment = ALIGNMENT_CENTER;
+	sprintf(textList.textString, _lang_String[_lang_stoprfidTitle]);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_BOLD);
+	textList.textSize = 30;
+	publish_textview_add(mosq, &textList, 1);
+	// Script
+	textList.textviewIndex = _text_systemScript;
+	textList.layout_x = 0;
+	textList.layout_y = 867;
+	textList.color_r = 0;
+	textList.color_g = 0;
+	textList.color_b = 0;
+	textList.width = 1080;
+	textList.alignment = ALIGNMENT_CENTER;
+	sprintf(textList.textString, _lang_String[_lang_stoprfidScript]);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_NORMAL);
+	textList.textSize = 20;
+	publish_textview_add(mosq, &textList, 1);
+
+}
+
+void showStopChargingByAPP()
+{
+	Image_List imageList;
+	imageList.imageviewIndex = _icon_app_stop;
+	imageList.imgsrc_addr = _icon_app_stop;
+	imageList.layout_x = 434;
+	imageList.layout_y = 1050;
+	imageList.width = 212;
+	imageList.height = 269;
+	publish_imageview_add(mosq, &imageList, 1);
+
+	// Title
+	Text_List textList;
+	textList.textviewIndex = _text_systemTitle;
+	textList.layout_x = 0;
+	textList.layout_y = 807;
+	textList.color_r = 0;
+	textList.color_g = 85;
+	textList.color_b = 184;
+	textList.width = 1080;
+	textList.alignment = ALIGNMENT_CENTER;
+	sprintf(textList.textString, _lang_String[_lang_stopappTitle]);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_BOLD);
+	textList.textSize = 30;
+	publish_textview_add(mosq, &textList, 1);
+	// Script
+	textList.textviewIndex = _text_systemScript;
+	textList.layout_x = 0;
+	textList.layout_y = 867;
+	textList.color_r = 0;
+	textList.color_g = 0;
+	textList.color_b = 0;
+	textList.width = 1080;
+	textList.alignment = ALIGNMENT_CENTER;
+	sprintf(textList.textString, _lang_String[_lang_stopappScript]);
+	sprintf(textList.textFont, FONT_ARIAL);
+	sprintf(textList.textStyle, FONT_STYLE_NORMAL);
+	textList.textSize = 20;
+	publish_textview_add(mosq, &textList, 1);
+
+}

BIN
EVSE/Projects/DD360UCar/Apps/UnsafetyOutputTask


BIN
EVSE/Projects/DD360UCar/Images/ramdisk.gz


BIN
EVSE/Projects/DD360UCar/output/FactoryConfig


BIN
EVSE/Projects/DD360UCar/output/Module_ChkSysTask


BIN
EVSE/Projects/DD360UCar/output/Module_DoComm


BIN
EVSE/Projects/DD360UCar/output/Module_EvComm


BIN
EVSE/Projects/DD360UCar/output/Module_EventLogging


BIN
EVSE/Projects/DD360UCar/output/Module_InternalComm


BIN
EVSE/Projects/DD360UCar/output/Module_LcmControl


BIN
EVSE/Projects/DD360UCar/output/Module_PrimaryComm


BIN
EVSE/Projects/DD360UCar/output/Module_UpdateFW


BIN
EVSE/Projects/DD360UCar/output/ReadCmdline


BIN
EVSE/Projects/DD360UCar/output/UnsafetyOutputTask


BIN
EVSE/Projects/DD360UCar/output/main


Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels