/* * 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); } int publish_textview_add(struct mosquitto* mosq, Text_List* textList, uint8_t listCount) { json_object *payload = json_object_new_array(); char outputStr[250*100]={0}; for(int idx=0;idx= 9999) { continue; } 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) { json_object *payload = json_object_new_array(); char outputStr[250*100]={0}; for(int idx=0;idx= 9999) { continue; } json_object *textscroll = json_object_new_object(); char buf[32]; sprintf(buf, "%d", textList[idx].textscrollIndex); json_object_object_add(textscroll, "textscrollIndex", json_object_new_string(buf)); json_object_object_add(textscroll, "textString", json_object_new_string(textList[idx].textString)); json_object_object_add(textscroll, "textFont", json_object_new_string(textList[idx].textFont)); json_object_object_add(textscroll, "textStyle", json_object_new_string(textList[idx].textStyle)); sprintf(buf, "%d", textList[idx].textSize); json_object_object_add(textscroll, "textSize", json_object_new_string(buf)); sprintf(buf, "%d", textList[idx].layout_x); json_object_object_add(textscroll, "layout_x", json_object_new_string(buf)); sprintf(buf, "%d", textList[idx].layout_y); json_object_object_add(textscroll, "layout_y", json_object_new_string(buf)); sprintf(buf, "%d", textList[idx].width); json_object_object_add(textscroll, "width", json_object_new_string(buf)); sprintf(buf, "%d", textList[idx].color_r); json_object_object_add(textscroll, "color_r", json_object_new_string(buf)); sprintf(buf, "%d", textList[idx].color_g); json_object_object_add(textscroll, "color_g", json_object_new_string(buf)); sprintf(buf, "%d", textList[idx].color_b); json_object_object_add(textscroll, "color_b", json_object_new_string(buf)); sprintf(buf, "%d", textList[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) { json_object *payload = json_object_new_array(); char outputStr[250*100]={0}; for(int idx=0;idx= 9999) { continue; } 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) { json_object *payload = json_object_new_array(); char outputStr[250*100]={0}; for(int idx=0;idx= 9999) { continue; } 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].apngsrc_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(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= 9999) { continue; } 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= 9999) { continue; } json_object *textview = json_object_new_object(); 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/page/storetext", outputStr); } /** * * @param mosq */ int publish_textscroll_store(struct mosquitto* mosq,uint8_t page) { json_object *payload = json_object_new_array(); char outputStr[250*100]={0}; char buf[32]; int listCount = TextScrollIndex; if (listCount <= 0 ) return FAIL; json_object *pageView = json_object_new_object(); sprintf(buf, "%d", page); json_object_object_add(pageView, "PageIndex", json_object_new_string(buf)); json_object_array_add(payload, pageView); for(int idx=0;idx= 9999) { continue; } json_object *textscroll = json_object_new_object(); 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/page/storetextscroll", outputStr); } /** * * @param mosq */ int publish_imageview_store(struct mosquitto *mosq,uint8_t page) { json_object *payload = json_object_new_array(); char outputStr[250*100]={0}; char buf[32]; int listCount = ImageIndex; if (listCount <= 0 ) return FAIL; json_object *pageView = json_object_new_object(); sprintf(buf, "%d", page); json_object_object_add(pageView, "PageIndex", json_object_new_string(buf)); json_object_array_add(payload, pageView); for(int idx=0;idx= 9999) { continue; } json_object *imageview = json_object_new_object(); 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/page/storeimg", outputStr); } /** * * @param mosq */ int publish_apngview_store(struct mosquitto *mosq,uint8_t page) { json_object *payload = json_object_new_array(); char outputStr[250*100]={0}; char buf[32]; int listCount = ApngIndex; if (listCount <= 0 ) return FAIL; json_object *pageView = json_object_new_object(); sprintf(buf, "%d", page); json_object_object_add(pageView, "PageIndex", json_object_new_string(buf)); json_object_array_add(payload, pageView); for(int idx=0;idx= 9999) { continue; } json_object *apngview = json_object_new_object(); sprintf(buf, "%d", ApngList[idx].apngIndex); json_object_object_add(apngview, "apngIndex", json_object_new_string(buf)); sprintf(buf, "%d", ApngList[idx].apngsrc_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/page/apngview", outputStr); } //////////////////////////////////////////////////////////////////////////// int publish_textview_push(Text_List* textList, uint8_t listCount) { int cmpIndex = 0; for(int idx=0;idx= 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_textscroll_push(TextScroll_List* textList, uint8_t listCount) { int cmpIndex = 0; for(int idx=0;idx= 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_imageview_push(Image_List *imageList, uint8_t listCount) { int cmpIndex = 0; for(int idx=0;idx= 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].imageviewIndex != 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_apngview_push( APNG_List *apngList, uint8_t listCount) { int cmpIndex = 0; for(int idx=0;idx= 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].apngIndex != 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; } void clearPushBuffer() { memset(TextList, 0, sizeof(TextList)); memset(ImageList, 0, sizeof(ImageList)); memset(ApngList, 0, sizeof(ApngList)); memset(QRCodeList, 0, sizeof(QRCodeList)); memset(TextScrollList, 0, sizeof(TextScrollList)); TextIndex = 0; ImageIndex = 0; QRCodeIndex = 0; TextScrollIndex = 0; ApngIndex = 0; } void PushPageInfoToLcm(struct mosquitto *mosq,int page) { //DEBUG_INFO("Push Page%d to LCM",page); publish_textview_store(mosq,page); publish_textscroll_store(mosq,page); publish_imageview_store(mosq,page); publish_apngview_store(mosq,page); clearPushBuffer(); } int publish_apng_remove(struct mosquitto *mosq, APNG_List *apngList, uint8_t apngListCount) { json_object *payload = json_object_new_object(); json_object *image = json_object_new_array(); char outputStr[2048]={0}; // Remove image view for(int idx=0;idx