XmlStbInfo.c
上传用户:fy98168
上传日期:2015-06-26
资源大小:13771k
文件大小:28k
- #include "XmlStbInfo.h"
- //#define NULL 0
- static KB_MovieInfoNode *gXmlMovieInfo = NULL;
- static KB_WeatherInfoNode *gXmlWeatherInfo = NULL;
- static KB_BulletinInfoNode *gXmlBulletinInfo = NULL;
- static kb_xml_serviceInfoNode_t *s_kb_xml_ServiceInfo = NULL;
- static void AddMovieNodeValue(char *item, char *value, KB_MovieInfoNode *pXmlNodeInfo);
- static void AddWeatherNodeValue(char *item, char *value, KB_WeatherInfoNode *pXmlNodeInfo);
- static void AddBulletinNodeValue(char *item, char *value, KB_BulletinInfoNode *pXmlNodeInfo);
- static void AddVoteNodeValue(char *item, char *value, kb_vote_node_t*pVoteNodeInfo);
- void ReleaseXmlServiceInfo(void)
- {
- kb_xml_serviceInfoNode_t *pHead_Service = NULL;
- kb_xml_serviceInfoNode_t *pTail_Service = NULL;
- kb_xml_serviceInfoNode_t *p_Service = NULL;
-
- p_Service = s_kb_xml_ServiceInfo;
- if (NULL != p_Service)
- {
- pHead_Service = p_Service;
- pTail_Service = p_Service;
- while (pTail_Service != NULL)
- {
- pTail_Service = pHead_Service->m_pNext;
- mb_free(pHead_Service);
- pHead_Service = pTail_Service;
- }
- s_kb_xml_ServiceInfo = NULL;
- }
- return;
- }
- void ResetXmlStbInfo(void)
- {
- KB_MovieInfoNode *pHead_Movie = NULL;
- KB_MovieInfoNode *pTail_Movie = NULL;
- KB_MovieInfoNode *p_Movie = NULL;
- KB_WeatherInfoNode *pHead_Weather = NULL;
- KB_WeatherInfoNode *pTail_Weather = NULL;
- KB_WeatherInfoNode *p_Weather = NULL;
- KB_BulletinInfoNode *pHead_Bulletin = NULL;
- KB_BulletinInfoNode *pTail_Bulletin = NULL;
- KB_BulletinInfoNode *p_Bulletin = NULL;
- kb_vote_node_t *pHead_Vote = NULL;
- kb_vote_node_t *pTail_Vote = NULL;
- kb_vote_node_t *p_Vote = NULL;
- unsigned char index=0;
-
- //test by steven
- #if 1
- gXmlMovieInfo = NULL;
- #else
- //清空影片信息
- p_Movie = gXmlMovieInfo;
- if (NULL != p_Movie)
- {
- pHead_Movie = p_Movie;
- pTail_Movie = p_Movie;
- while (pTail_Movie != NULL)
- {
- pTail_Movie = pHead_Movie->m_pNext;
- if(pHead_Movie->st_MovieInfo.m_pData!=NULL)
- {
- KB_OSPFree(pHead_Movie->st_MovieInfo.m_pData);
- pHead_Movie->st_MovieInfo.m_pData=NULL;
- }
- KB_OSPFree(pHead_Movie);
- pHead_Movie = pTail_Movie;
- }
- gXmlMovieInfo = NULL;
- }
- #endif
- //清空天气信息
- p_Weather = gXmlWeatherInfo;
- if (NULL != p_Weather)
- {
- pHead_Weather = p_Weather;
- pTail_Weather = p_Weather;
- while (pTail_Weather != NULL)
- {
- pTail_Weather = pHead_Weather->m_pNext;
- KB_OSPFree(pHead_Weather);
- pHead_Weather = pTail_Weather;
- }
- gXmlWeatherInfo = NULL;
- }
- //清空政府公告信息
- p_Bulletin = gXmlBulletinInfo;
- if (NULL != p_Bulletin)
- {
- pHead_Bulletin = p_Bulletin;
- pTail_Bulletin = p_Bulletin;
- while (pTail_Bulletin != NULL)
- {
- pHead_Bulletin->st_BulletinInfo.titleLen = 0;
- pHead_Bulletin->st_BulletinInfo.contentLen = 0;
- if (pHead_Bulletin->st_BulletinInfo.title != NULL)
- {
- KB_OSPFree(pHead_Bulletin->st_BulletinInfo.title);
- pHead_Bulletin->st_BulletinInfo.title = NULL;
- }
- if (pHead_Bulletin->st_BulletinInfo.content != NULL)
- {
- KB_OSPFree(pHead_Bulletin->st_BulletinInfo.content);
- pHead_Bulletin->st_BulletinInfo.content = NULL;
- }
-
- pTail_Bulletin = pHead_Bulletin->m_pNext;
- KB_OSPFree(pHead_Bulletin);
- pHead_Bulletin = pTail_Bulletin;
- }
- gXmlBulletinInfo = NULL;
- }
- for(index=0;index<kb_vote_service_last;index++)
- {
- p_Vote = g_kb_vote_service[index];
- if (NULL != p_Vote)
- {
- pHead_Vote = p_Vote;
- pTail_Vote = p_Vote;
- while (pTail_Vote != NULL)
- {
- if (pHead_Vote->voteService.name!= NULL)
- {
- KB_OSPFree(pHead_Vote->voteService.name);
- pHead_Vote->voteService.name = NULL;
- }
- if (pHead_Vote->voteService.item!= NULL)
- {
- KB_OSPFree(pHead_Vote->voteService.item);
- pHead_Vote->voteService.item = NULL;
- }
-
- pTail_Vote = pHead_Vote->pNext;
- KB_OSPFree(pHead_Vote );
- pHead_Vote = pTail_Vote;
- }
- g_kb_vote_service[index] = NULL;
- }
- }
-
- return;
- }
- KB_MovieInfoNode *KB_GetXmlMovieInfoHead(void)
- {
- return gXmlMovieInfo;
- }
- KB_WeatherInfoNode *KB_GetXmlWeatherInfoHead(void)
- {
- return gXmlWeatherInfo;
- }
- KB_BulletinInfoNode *KB_GetXmlBulletinInfoHead(void)
- {
- return gXmlBulletinInfo;
- }
- kb_xml_serviceInfoNode_t *KB_Xml_GetServiceInfoHead(void)
- {
- return s_kb_xml_ServiceInfo;
- }
- void *LinkNewXmlInfoNode(char *pNode, KB_DC_TYPE *pDcType)
- {
- KB_MovieInfoNode *pMovieInfo = NULL;
- KB_MovieInfoNode *pTmp_Movie = NULL;
- KB_WeatherInfoNode *pWeatherInfo = NULL;
- KB_WeatherInfoNode *pTmp_Weather = NULL;
- KB_BulletinInfoNode *pBulletinInfo = NULL;
- KB_BulletinInfoNode *pTmp_Bulletin = NULL;
- kb_vote_node_t *pVoteInfo=NULL;
- kb_xml_serviceInfoNode_t *pServiceInfo = NULL;
- kb_xml_serviceInfoNode_t *pTmp_Service = NULL;
- if (NULL == pNode || NULL == pDcType)
- {
- printf("nLinkNewXmlInfoNode::input pointer pNode(0x%x) or pDcType(0x%x) NULL",
- pNode, pDcType);
- *pDcType = DC_TYPE_MAX;
- return NULL;
- }
- //先置为无效值
- *pDcType = DC_TYPE_MAX;
-
- if (!strcmp(pNode, "nodeMInfo"))
- {
- *pDcType = MOVIE_INFO;
- pMovieInfo = (KB_MovieInfoNode *)KB_OSPMalloc(sizeof(KB_MovieInfoNode));
- if (NULL == pMovieInfo)
- {
- printf("nGetXmlStbInfoNode::KB_OSPMalloc KB_MovieInfoNode fail");
- return NULL;
- }
- pMovieInfo->st_MovieInfo.m_pData = NULL;
- pMovieInfo->m_pNext = NULL;
-
- pTmp_Movie = gXmlMovieInfo;
-
- if (NULL == pTmp_Movie)
- {
- gXmlMovieInfo = pMovieInfo;
- gXmlMovieInfo->m_pNext = NULL;
- }
- else
- {
- while (pTmp_Movie->m_pNext != NULL)
- {
- pTmp_Movie = pTmp_Movie->m_pNext;
- }
- pTmp_Movie->m_pNext = pMovieInfo;
- pMovieInfo->m_pNext = NULL;
- }
- //printf("nGetXmlStbInfoNode:: nodeMInfo");
- return (void*)pMovieInfo;
- }
- else if (!strcmp(pNode, "nodeWeather"))
- {
- *pDcType = WEATHER_INFO;
- pWeatherInfo = (KB_WeatherInfoNode *)KB_OSPMalloc(sizeof(KB_WeatherInfoNode));
- if (NULL == pWeatherInfo)
- {
- printf("nGetXmlStbInfoNode::KB_OSPMalloc KB_WeatherInfoNode fail");
- return NULL;
- }
- pWeatherInfo->m_pNext = NULL;
-
- pTmp_Weather = gXmlWeatherInfo;
-
- if (NULL == pTmp_Weather)
- {
- gXmlWeatherInfo = pWeatherInfo;
- gXmlWeatherInfo->m_pNext = NULL;
- }
- else
- {
- while (pTmp_Weather->m_pNext != NULL)
- {
- pTmp_Weather = pTmp_Weather->m_pNext;
- }
- pTmp_Weather->m_pNext = pWeatherInfo;
- pWeatherInfo->m_pNext = NULL;
- }
- //printf("nGetXmlStbInfoNode:: nodeWeather");
- return (void*)pWeatherInfo;
- }
- else if (!strcmp(pNode, "nodeBulletin"))
- {
- *pDcType = BULLETIN_INFO;
- pBulletinInfo = (KB_BulletinInfoNode *)KB_OSPMalloc(sizeof(KB_BulletinInfoNode));
- if (NULL == pBulletinInfo)
- {
- printf("nGetXmlStbInfoNode::KB_OSPMalloc KB_BulletinInfoNode fail");
- return NULL;
- }
- pBulletinInfo->st_BulletinInfo.titleLen = 0;
- pBulletinInfo->st_BulletinInfo.title = NULL;
- pBulletinInfo->st_BulletinInfo.contentLen = 0;
- pBulletinInfo->st_BulletinInfo.content = NULL;
- pBulletinInfo->m_pNext = NULL;
-
- pTmp_Bulletin = gXmlBulletinInfo;
-
- if (NULL == pTmp_Bulletin)
- {
- gXmlBulletinInfo = pBulletinInfo;
- gXmlBulletinInfo->m_pNext = NULL;
- }
- else
- {
- while (pTmp_Bulletin->m_pNext != NULL)
- {
- pTmp_Bulletin = pTmp_Bulletin->m_pNext;
- }
- pTmp_Bulletin->m_pNext = pBulletinInfo;
- pBulletinInfo->m_pNext = NULL;
- }
- //printf("nGetXmlStbInfoNode:: nodeBulletin");
- return (void*)pBulletinInfo;
- }
- else if (!strcmp(pNode, "nodeVote"))
- {
- *pDcType = VOTE_INFO;
- pVoteInfo = (kb_vote_node_t*)KB_OSPMalloc(sizeof(kb_vote_node_t));
- if (NULL == pVoteInfo)
- {
- printf("nGetXmlStbInfoNode::KB_OSPMalloc pVoteInfo fail");
- return NULL;
- }
- pVoteInfo->voteService.nameLen=0;
- pVoteInfo->voteService.name=NULL;
- pVoteInfo->voteService.itemLen=0;
- pVoteInfo->voteService.item=NULL;
- pVoteInfo->voteService.itemIndex=0;
- pVoteInfo->voteService.itemCount=0;
- pVoteInfo->pNext=NULL;
- return (void*)pVoteInfo;
- }
- else if (!strcmp(pNode, "service"))
- {
- *pDcType = SERVICE_INFO;
- pServiceInfo = (kb_xml_serviceInfoNode_t *)KB_OSPMalloc(sizeof(kb_xml_serviceInfoNode_t));
- if (NULL == pServiceInfo)
- {
- printf("nGetXmlStbInfoNode::mb_malloc kb_xml_serviceInfoNode_t fail");
- return NULL;
- }
- pServiceInfo->m_pNext = NULL;
-
- pTmp_Service = s_kb_xml_ServiceInfo;
-
- if (NULL == pTmp_Service)
- {
- s_kb_xml_ServiceInfo = pServiceInfo;
- s_kb_xml_ServiceInfo->m_pNext = NULL;
- }
- else
- {
- while (pTmp_Service->m_pNext != NULL)
- {
- pTmp_Service = pTmp_Service->m_pNext;
- }
- pTmp_Service->m_pNext = pServiceInfo;
- pServiceInfo->m_pNext = NULL;
- }
- //printf("nGetXmlStbInfoNode:: nodeWeather");
- return (void*)pServiceInfo;
- }
- printf("nLinkNewXmlInfoNode::Node_Head_identifier(%s) error", pNode);
-
- return NULL;
- }
- static void kb_xml_addServiceNodeValue(char *item, char *value, kb_xml_serviceInfoNode_t *pXmlNodeInfo)
- {
- if (NULL == item || NULL == pXmlNodeInfo)
- {
- printf("nAddWeatherNodeValue::input para item(0x%x), pXmlNodeInfo(0x%x)",
- item, pXmlNodeInfo);
- return;
- }
- if (!strcmp(item, "fre"))
- {
- pXmlNodeInfo->st_ServiceInfo.m_freq = atoi(value);
- }
- else if (!strcmp(item, "pid"))
- {
- pXmlNodeInfo->st_ServiceInfo.m_nPid = atoi(value);
- }
- else if (!strcmp(item, "transactionsId"))
- {
- pXmlNodeInfo->st_ServiceInfo.m_transactionsId = atoi(value);
- }
- else if (!strcmp(item, "string"))
- {
- strcpy(pXmlNodeInfo->st_ServiceInfo.m_string, value);
- }
- else if (!strcmp(item, "type"))
- {
- pXmlNodeInfo->st_ServiceInfo.m_type = atoi(value);
- }
- return;
- }
- void AddXmlNodeValue(char *item,
- char *value,
- void *pXmlNodeInfo,
- KB_DC_TYPE DcType)
- {
- if (NULL == item || NULL == pXmlNodeInfo)
- {
- printf("nAddXmlNodeValue::input para item(0x%x), pXmlNodeInfo(0x%x)",
- item, pXmlNodeInfo);
- return;
- }
- switch (DcType)
- {
- case MOVIE_INFO:
- AddMovieNodeValue(item, value, (KB_MovieInfoNode*)pXmlNodeInfo);
- break;
- case WEATHER_INFO:
- AddWeatherNodeValue(item, value, (KB_WeatherInfoNode*)pXmlNodeInfo);
- break;
- case BULLETIN_INFO:
- AddBulletinNodeValue(item, value, (KB_BulletinInfoNode*)pXmlNodeInfo);
- break;
- case VOTE_INFO:
- AddVoteNodeValue(item, value, (kb_vote_node_t*)pXmlNodeInfo);
- break;
- case SERVICE_INFO:
- kb_xml_addServiceNodeValue(item, value, (kb_xml_serviceInfoNode_t*)pXmlNodeInfo);
- break;
- default:
- mb_free((void*)pXmlNodeInfo);
- printf("nAddXmlNodeValue::DcType(%d) error", DcType);
- break;
- }
- return;
- }
- static void AddMovieNodeValue(char *item, char *value, KB_MovieInfoNode *pXmlNodeInfo)
- {
- if (NULL == item || NULL == pXmlNodeInfo)
- {
- printf("nAddMovieNodeValue::input para item(0x%x), pXmlNodeInfo(0x%x)",
- item, pXmlNodeInfo);
- return;
- }
- //使用strcpy始终不是安全的做法...
- if(!strcmp(item, "FType"))
- {
- pXmlNodeInfo->st_MovieInfo.m_cfgType=atoi(value);
- }
- else if (!strcmp(item, "MType"))
- {
- pXmlNodeInfo->st_MovieInfo.m_type = atoi(value);
- }
- else if (!strcmp(item, "MName"))
- {
- strcpy(pXmlNodeInfo->st_MovieInfo.m_strName, value);
- }
- else if (!strcmp(item, "MSize"))
- {
- pXmlNodeInfo->st_MovieInfo.m_nSize = atoi(value);
- }
- else if (!strcmp(item, "MTSID"))
- {
- pXmlNodeInfo->st_MovieInfo.m_tsID = atoi(value);
- }
- else if (!strcmp(item, "MServiceID"))
- {
- pXmlNodeInfo->st_MovieInfo.m_serviceID = atoi(value);
- }
- else if (!strcmp(item, "MStartTime"))
- {
- /*if(pXmlNodeInfo->st_MovieInfo.m_type==2)
- pXmlNodeInfo->st_MovieInfo.m_nStartTime=0;
- else*/
- pXmlNodeInfo->st_MovieInfo.m_nStartTime = atoi(value);
- }
- else if (!strcmp(item, "MDuration"))
- {
- pXmlNodeInfo->st_MovieInfo.m_nDuration = atoi(value);
- }
- else if (!strcmp(item, "MDCPID"))
- {
- pXmlNodeInfo->st_MovieInfo.m_nPid = atoi(value);
- }
- else if (!strcmp(item, "MDCModuleID"))
- {
- pXmlNodeInfo->st_MovieInfo.m_nFirstModuleId = atoi(value);
- }
- else if (!strcmp(item, "MDCTimesPlayed"))
- {
- pXmlNodeInfo->st_MovieInfo.m_nTimesPlayed = atoi(value);
- }
- else if (!strcmp(item, "MDCTimeStep"))
- {
- pXmlNodeInfo->st_MovieInfo.m_nTimeStep = atoi(value);
- }
- else if (!strcmp(item, "MSerial"))
- {
- strcpy(pXmlNodeInfo->st_MovieInfo.m_serial, value);
- }
- else if (!strcmp(item, "MReserve1"))
- {
- pXmlNodeInfo->st_MovieInfo.m_reserve1=atoi(value);
- }
- else if (!strcmp(item, "MReserve2"))
- {
- pXmlNodeInfo->st_MovieInfo.m_reserve2=atoi(value);
- }
- else if (!strcmp(item, "MReserve3"))
- {
- pXmlNodeInfo->st_MovieInfo.m_reserve3=atoi(value);
- }
- else if (!strcmp(item, "MReserve4"))
- {
- pXmlNodeInfo->st_MovieInfo.m_reserve4=atoi(value);
- }
- pXmlNodeInfo->st_MovieInfo.m_dataGet=kb_dc_data_no;
- pXmlNodeInfo->st_MovieInfo.m_pData=NULL;
- return;
- }
- static void AddWeatherNodeValue(char *item, char *value, KB_WeatherInfoNode *pXmlNodeInfo)
- {
- if (NULL == item || NULL == pXmlNodeInfo)
- {
- printf("nAddWeatherNodeValue::input para item(0x%x), pXmlNodeInfo(0x%x)",
- item, pXmlNodeInfo);
- return;
- }
- if (!strcmp(item, "WCity"))
- {
- strcpy(pXmlNodeInfo->st_WeatherInfo.city, value);
- }
- else if (!strcmp(item, "WTodayDate"))
- {
- strcpy(pXmlNodeInfo->st_WeatherInfo.today.date, value);
- }
- else if (!strcmp(item, "WTodayWeather"))
- {
- pXmlNodeInfo->st_WeatherInfo.today.weather = atoi(value);
- }
- else if (!strcmp(item, "WTodayTemperature"))
- {
- strcpy(pXmlNodeInfo->st_WeatherInfo.today.temperature , value);
- }
- else if (!strcmp(item, "WTodayWeatherDes"))
- {
- strcpy(pXmlNodeInfo->st_WeatherInfo.today.weatherDes, value);
- }
- else if (!strcmp(item, "WTomorrowDate"))
- {
- strcpy(pXmlNodeInfo->st_WeatherInfo.tomorrow.date, value);
- }
- else if (!strcmp(item, "WTomorrowWeather"))
- {
- pXmlNodeInfo->st_WeatherInfo.tomorrow.weather = atoi(value);
- }
- else if (!strcmp(item, "WTomorrowTemperature"))
- {
- strcpy(pXmlNodeInfo->st_WeatherInfo.tomorrow.temperature, value);
- }
- else if (!strcmp(item, "WTomorrowWeatherDes"))
- {
- strcpy(pXmlNodeInfo->st_WeatherInfo.tomorrow.weatherDes, value);
- }
- else if (!strcmp(item, "WAfterTomorrowDate"))
- {
- strcpy(pXmlNodeInfo->st_WeatherInfo.afTomorrow.date, value);
- }
- else if (!strcmp(item, "WAfterTomorrowWeather"))
- {
- pXmlNodeInfo->st_WeatherInfo.afTomorrow.weather = atoi(value);
- }
- else if (!strcmp(item, "WAfterTomorrowTemperature"))
- {
- strcpy(pXmlNodeInfo->st_WeatherInfo.afTomorrow.temperature, value);
- }
- else if (!strcmp(item, "WAfterTomorrowWeatherDes"))
- {
- strcpy(pXmlNodeInfo->st_WeatherInfo.afTomorrow.weatherDes, value);
- }
- return;
- }
- static void AddBulletinNodeValue(char *item, char *value, KB_BulletinInfoNode *pXmlNodeInfo)
- {
- if (NULL == item || NULL == pXmlNodeInfo)
- {
- printf("nAddWeatherNodeValue::input para item(0x%x), pXmlNodeInfo(0x%x)",
- item, pXmlNodeInfo);
- return;
- }
- if (!strcmp(item, "BTitleLen"))
- {
- pXmlNodeInfo->st_BulletinInfo.titleLen = atoi(value);
- }
- else if (!strcmp(item, "BTitle"))
- {
- if (pXmlNodeInfo->st_BulletinInfo.title != NULL)
- {
- KB_OSPFree(pXmlNodeInfo->st_BulletinInfo.title);
- pXmlNodeInfo->st_BulletinInfo.title = NULL;
- }
- if (0 == pXmlNodeInfo->st_BulletinInfo.titleLen)
- {
- printf("nAddBulletinNodeValue::st_BulletinInfo.titleLen is 0!");
- return;
- }
- // +1 for ' '
- pXmlNodeInfo->st_BulletinInfo.title = (unsigned char *)KB_OSPMalloc(pXmlNodeInfo->st_BulletinInfo.titleLen + 1);
- if (NULL == pXmlNodeInfo->st_BulletinInfo.title)
- {
- printf("nAddBulletinNodeValue::malloc st_BulletinInfo.title fail!");
- }
- else
- {
- strcpy(pXmlNodeInfo->st_BulletinInfo.title, value);
- }
- }
- else if (!strcmp(item, "BContentLen"))
- {
- pXmlNodeInfo->st_BulletinInfo.contentLen = atoi(value);
- }
- else if (!strcmp(item, "BContent"))
- {
- if (pXmlNodeInfo->st_BulletinInfo.content != NULL)
- {
- KB_OSPFree(pXmlNodeInfo->st_BulletinInfo.content);
- pXmlNodeInfo->st_BulletinInfo.content = NULL;
- }
- if (0 == pXmlNodeInfo->st_BulletinInfo.contentLen)
- {
- printf("nAddBulletinNodeValue::st_BulletinInfo.contentLen is 0!");
- return;
- }
- // +1 for ' '
- pXmlNodeInfo->st_BulletinInfo.content = (unsigned char *)KB_OSPMalloc(pXmlNodeInfo->st_BulletinInfo.contentLen + 1);
- if (NULL == pXmlNodeInfo->st_BulletinInfo.content)
- {
- printf("nAddBulletinNodeValue::malloc st_BulletinInfo.content fail!");
- }
- else
- {
- strcpy(pXmlNodeInfo->st_BulletinInfo.content, value);
- }
- }
- return;
- }
- static void AddVoteNodeValue(char *item, char *value, kb_vote_node_t*pVoteNodeInfo)
- {
- kb_vote_node_t *pTemp=NULL;
-
- if(NULL==item||NULL==pVoteNodeInfo)
- {
- printf("nAddVoteNodeValue::input para item(0x%x), pVoteNodeInfo(0x%x)",
- item, pVoteNodeInfo);
- return;
- }
- if(!strcmp(item,"VService"))
- {
- pVoteNodeInfo->voteService.type=atoi(value);
- }
- else if(!strcmp(item,"VNameLen"))
- {
- pVoteNodeInfo->voteService.nameLen=atoi(value);
- }
- else if(!strcmp(item,"VName"))
- {
- if(pVoteNodeInfo->voteService.name!=NULL)
- mb_free(pVoteNodeInfo->voteService.name);
- pVoteNodeInfo->voteService.name=(unsigned char*)mb_malloc(pVoteNodeInfo->voteService.nameLen);
- if(pVoteNodeInfo->voteService.name!=NULL)
- strcpy(pVoteNodeInfo->voteService.name,value);
- }
- else if(!strcmp(item,"VItemLen"))
- {
- pVoteNodeInfo->voteService.itemLen=atoi(value);
- }
- else if(!strcmp(item,"VItem"))
- {
- if(pVoteNodeInfo->voteService.item!=NULL)
- mb_free(pVoteNodeInfo->voteService.item);
- pVoteNodeInfo->voteService.item=(unsigned char*)mb_malloc(pVoteNodeInfo->voteService.itemLen);
- if(pVoteNodeInfo->voteService.item!=NULL)
- strcpy(pVoteNodeInfo->voteService.item,value);
- }
- else if(!strcmp(item,"VItemIndex"))
- {
- pVoteNodeInfo->voteService.itemIndex=atoi(value);
- }
- else if(!strcmp(item,"VItemCount"))
- {
- pVoteNodeInfo->voteService.itemCount=atoi(value);
- }
- //确保只在解析第一个节点时插入链表
- if(!strcmp(item,"VService"))
- {
- pTemp=g_kb_vote_service[pVoteNodeInfo->voteService.type];
-
- if(pTemp==NULL)
- {
- g_kb_vote_service[pVoteNodeInfo->voteService.type]=pVoteNodeInfo;
- g_kb_vote_service[pVoteNodeInfo->voteService.type]->pNext=NULL;
- }
- else
- {
- while(pTemp->pNext!=NULL)
- {
- pTemp=pTemp->pNext;
- }
- pTemp->pNext=pVoteNodeInfo;
- pVoteNodeInfo->pNext=NULL;
- }
- }
- return;
- }
- void PrintXMLMovieInfo(void)
- {
- KB_MovieInfoNode *pMovieInfo = NULL;
- int cnt = 0;
-
- pMovieInfo = gXmlMovieInfo;
- if (NULL == pMovieInfo)
- {
- printf("nPrintXMLMovieInfo::gXmlMovieInfo is NULL");
- return;
- }
- //FType="" MType="" MName="" MSize="" MTSID="" MServiceID="" MStartTime=""
- //MDuration="" MDCPID="" MDCModuleID="" MDCTimesPlayed="" MDCTimeStep=""
- //MSerial="" MReserve1="" MReserve2="" MReserve3="" MReserve4=""
- printf("n*********---MovieInfo---Begin---***********");
- while (pMovieInfo != NULL)
- {
- printf("nn----------%d-----------", cnt);
- printf("nFType : %d", pMovieInfo->st_MovieInfo.m_cfgType);
- printf("nMType : %d", pMovieInfo->st_MovieInfo.m_type);
- printf("nMName : %s", pMovieInfo->st_MovieInfo.m_strName);
- printf("nMTSID : %d", pMovieInfo->st_MovieInfo.m_tsID);
- printf("nMServiceID : %d", pMovieInfo->st_MovieInfo.m_serviceID);
- printf("nMStartTime : %d", pMovieInfo->st_MovieInfo.m_nStartTime);
- printf("nMDuration : %d", pMovieInfo->st_MovieInfo.m_nDuration);
- printf("nMDCTimeStep : %d", pMovieInfo->st_MovieInfo.m_nTimeStep);
- printf("nm_nTimesPlayed : %d", pMovieInfo->st_MovieInfo.m_nTimesPlayed);
- printf("nMDCPID : %d", pMovieInfo->st_MovieInfo.m_nPid);
- printf("nMDCModuleID : %d", pMovieInfo->st_MovieInfo.m_nFirstModuleId);
- //printf("nMSerial : %s", pMovieInfo->st_MovieInfo.m_serial);
- //printf("nMReserve1 : %d", pMovieInfo->st_MovieInfo.m_reserve1);
- //printf("nMReserve2 : %d", pMovieInfo->st_MovieInfo.m_reserve2);
- //printf("nMReserve3 : %d", pMovieInfo->st_MovieInfo.m_reserve3);
- //printf("nMReserve4 : %d", pMovieInfo->st_MovieInfo.m_reserve4);
- cnt++;
- pMovieInfo = pMovieInfo->m_pNext;
- }
- printf("n*********---MovieInfo---Over---***********");
- }
- void PrintXMLWeatherInfo(void)
- {
- KB_WeatherInfoNode *pWeatherInfo = NULL;
- int cnt = 0;
-
- pWeatherInfo = gXmlWeatherInfo;
- if (NULL == pWeatherInfo)
- {
- printf("nPrintXMLWeatherInfo::gXmlWeatherInfo is NULL");
- return;
- }
- printf("n*********---WeatherInfo---Begin---***********");
- while (pWeatherInfo != NULL)
- {
- printf("nn----------%d-----------", cnt);
- printf("ncity: %s", pWeatherInfo->st_WeatherInfo.city);
- printf("nToday:");
- printf("ndate : %s", pWeatherInfo->st_WeatherInfo.today.date);
- printf("nweather : %d", pWeatherInfo->st_WeatherInfo.today.weather);
- printf("ntemperature : %s", pWeatherInfo->st_WeatherInfo.today.temperature);
- printf("nweatherDes : %s", pWeatherInfo->st_WeatherInfo.today.weatherDes);
- printf("nTomorrow:");
- printf("ndate : %s", pWeatherInfo->st_WeatherInfo.tomorrow.date);
- printf("nweather : %d", pWeatherInfo->st_WeatherInfo.tomorrow.weather);
- printf("ntemperature : %s", pWeatherInfo->st_WeatherInfo.tomorrow.temperature);
- printf("nweatherDes : %s", pWeatherInfo->st_WeatherInfo.tomorrow.weatherDes);
- printf("nThe D-A-Tomorrow:");
- printf("ndate : %s", pWeatherInfo->st_WeatherInfo.afTomorrow.date);
- printf("nweather : %d", pWeatherInfo->st_WeatherInfo.afTomorrow.weather);
- printf("ntemperature : %s", pWeatherInfo->st_WeatherInfo.afTomorrow.temperature);
- printf("nweatherDes : %s", pWeatherInfo->st_WeatherInfo.afTomorrow.weatherDes);
- cnt++;
- pWeatherInfo = pWeatherInfo->m_pNext;
- }
- printf("n*********---WeatherInfo---Over---***********");
- }
- void PrintXMLBulletinInfo(void)
- {
- KB_BulletinInfoNode *pBulletinInfo = NULL;
- int cnt = 0;
-
- pBulletinInfo = gXmlBulletinInfo;
- if (NULL == pBulletinInfo)
- {
- printf("nPrintXMLMovieInfo::gXmlBulletinInfo is NULL");
- return;
- }
- printf("n*********---BulletinInfo---Begin---***********");
- while (pBulletinInfo != NULL)
- {
- printf("nn----------%d-----------", cnt);
- printf("ntitleLen : %d", pBulletinInfo->st_BulletinInfo.titleLen);
- printf("ntitle : %s", pBulletinInfo->st_BulletinInfo.title);
- printf("ncontentLen : %d", pBulletinInfo->st_BulletinInfo.contentLen);
- printf("ncontent : %s", pBulletinInfo->st_BulletinInfo.content);
- cnt++;
- pBulletinInfo = pBulletinInfo->m_pNext;
- }
- printf("n*********---BulletinInfo---OVER---***********");
- }
- void PrintXMLVoteInfo(void)
- {
- kb_vote_node_t *pVoteInfo=NULL;
- unsigned short index=0;
- printf("n*********---VoteInfo---Begin---***********");
- for(index=0;index<kb_vote_service_last;index++)
- {
- pVoteInfo=g_kb_vote_service[index];
- while(pVoteInfo!=NULL)
- {
- printf("ntype : %d",pVoteInfo->voteService.type);
- printf("nname : %s",pVoteInfo->voteService.name);
- printf("nitem : %s",pVoteInfo->voteService.item);
- printf("nindex : %d",pVoteInfo->voteService.itemIndex);
- printf("ncount : %d",pVoteInfo->voteService.itemCount);
- pVoteInfo=pVoteInfo->pNext;
- }
- }
- printf("n*********---VoteInfo---OVER---***********");
- }
- void kb_xml_printServiceInfo(void)
- {
- kb_xml_serviceInfoNode_t *pServiceInfo = NULL;
- int cnt = 0;
-
- pServiceInfo = s_kb_xml_ServiceInfo;
- if (NULL == pServiceInfo)
- {
- printf("nkb_xml_printServiceInfo::s_kb_xml_ServiceInfo is NULL");
- return;
- }
- printf("n*********---ServiceInfo---Begin---***********");
- while (pServiceInfo != NULL)
- {
- printf("nn----------%d-----------", cnt);
- printf("nfre: %ld", pServiceInfo->st_ServiceInfo.m_freq);
- printf("ndate : %ld", pServiceInfo->st_ServiceInfo.m_nPid);
- printf("nweather : %s", pServiceInfo->st_ServiceInfo.m_string);
- printf("ntemperature : %ld", pServiceInfo->st_ServiceInfo.m_transactionsId);
- printf("nweatherDes : %d", pServiceInfo->st_ServiceInfo.m_type);
- cnt++;
- pServiceInfo = pServiceInfo->m_pNext;
- }
- printf("n*********---WeatherInfo---Over---***********");
- }
- //
- // 取得所有影片中最大影片的大小值
- // add by shriek 2008.2.13
- unsigned long GetXMLMovieMaxSize(void)
- {
- KB_MovieInfoNode *pMovieInfo = NULL;
- unsigned long max_size=0;
-
- pMovieInfo = gXmlMovieInfo;
- if (NULL == pMovieInfo)
- {
- printf("n GetXMLMovieMaxSize::gXmlMovieInfo is NULL");
- return;
- }
- while (pMovieInfo != NULL)
- {
- printf("nSize : %d", pMovieInfo->st_MovieInfo.m_nSize);
- if(max_size < pMovieInfo->st_MovieInfo.m_nSize)
- max_size = pMovieInfo->st_MovieInfo.m_nSize;
- pMovieInfo = pMovieInfo->m_pNext;
- }
- printf("n ==GetXMLMovieMaxSize: maxsize=%d", max_size);
- return max_size;
- }