static INT32 ConvertDateTimeToString(date_time *dt, UINT8* str) { UINT8 hour,min; INT32 hour_off,min_off,sec_off; date_time tmp; SYSTEM_DATA * sys_data; get_STC_offset(&hour_off,&min_off,&sec_off); convert_time_by_offset(&tmp, dt, hour_off, min_off); hour = tmp.hour; min = tmp.min; sprintf(str, "%02d:%02d",hour, min); return 5; }
static eit_event_info_t* epg_get_schdedule_event(eit_service_info_t *eit_service_header,date_time *sch_time,INT32* event_number) { date_time cur_time,day_start,day_end,tmp,tmp_start,tmp_end; eit_event_info_t *start_evt=NULL,*ep=NULL, *tmp_ep=NULL; int i=0,day; INT32 hoff,moff,soff; SYSTEM_DATA* sys_data; UINT8 sch_day; #ifdef GET_TOTAL_SCH_EPG //only changed for shenzhou,do not filter the event UI wanted ep=eit_service_header->sch_event_header[0]; while (ep!=NULL) { if (eit_compare_time(&ep->start_time,sch_time)>=0 && // eit_compare_time(&ep->end_time,sch_time)<0) break; else if(eit_compare_time(&ep->start_time,sch_time)<=0) break; ep=ep->next; } start_evt=ep; while (ep!=NULL ) { ep=ep->next; i++; } *event_number=i; return start_evt; #endif sys_data = sys_data_get(); //if (is_time_inited()==FALSE) // eit_get_schedule_time(&cur_time); //else { if(sys_data->local_time.buseGMT) { get_UTC(&cur_time); get_STC_offset(&hoff,&moff,&soff); } else { get_STC_time(&cur_time); hoff=moff=soff=0; } } /*change sch_time -> UTC time*/ tmp=*sch_time; if (eit_compare_time(&tmp,&cur_time)>0) return NULL; day=relative_day(&cur_time, &tmp); if (day>=0 && day < SCHEDULE_DAY) { sch_day = day/4; ep=eit_service_header->sch_event_header[day/4]; if((sch_day+1) < SCHEDULE_TABLE_ID_NUM) { tmp_ep = ep; while(tmp_ep!=NULL) { if((tmp_ep->next)==NULL) break; tmp_ep = tmp_ep->next; } sch_next_event_header_addr = tmp_ep->next=eit_service_header->sch_event_header[sch_day+1]; } } else { return NULL; } convert_time_by_offset(&day_start, &tmp, hoff, moff); day_end = day_start; day_end.hour = 23; day_end.min = 59; #ifndef EPG_SHOW_BYTIME day_start.hour = 0; day_start.min = 0; #endif //soc_printf(" date_start:%04d/%02d/%02d %02d:%02d \n",day_start.year,day_start.month,day_start.day,day_start.hour,day_start.min); //soc_printf(" day_end:%04d/%02d/%02d %02d:%02d \n",day_end.year,day_end.month,day_end.day,day_end.hour,day_end.min); while(ep!=NULL) { convert_time_by_offset(&tmp_start, &(ep->start_time), hoff, moff); convert_time_by_offset(&tmp_end,&(ep->end_time), hoff, moff); //soc_printf(" tmp_start:%04d/%02d/%02d %02d:%02d \n",tmp_start.year,tmp_start.month,tmp_start.day,tmp_start.hour,tmp_start.min); //soc_printf(" tmp_end:%04d/%02d/%02d %02d:%02d \n",tmp_end.year,tmp_end.month,tmp_end.day,tmp_end.hour,tmp_end.min); if ((eit_compare_time(&tmp_start,&day_start)<=0) && (eit_compare_time(&tmp_end,&day_end)>0)) break; ep=ep->next; } start_evt=ep; while(ep!=NULL) { convert_time_by_offset(&tmp_start,&(ep->start_time), hoff, moff); //soc_printf(" !!!!tmp_start:%04d/%02d/%02d %02d:%02d \n",tmp_start.year,tmp_start.month,tmp_start.day,tmp_start.hour,tmp_start.min); if (eit_compare_time(&tmp_start,&day_end)<0) break; ep=ep->next; i++; } //convert_time_by_offset(&tmp_start,&(ep->start_time), hoff, moff); //soc_printf(" !!!!next_start:%04d/%02d/%02d %02d:%02d \n",tmp_start.year,tmp_start.month,tmp_start.day,tmp_start.hour,tmp_start.min); *event_number=i; tmp_ep->next = NULL; return start_evt; }
INT32 win_progname_set_info(void) { UINT16 group_name[MAX_SERVICE_NAME_LENGTH + 1+10]; UINT8 group_type, av_mode; UINT16 cur_channel; P_NODE p_node; S_NODE s_node; char string[100]; char prog_name[MAX_SERVICE_NAME_LENGTH + 1]; INT32 ret, len; UINT32 i, j; UINT16 icon; date_time dt; eit_event_info_t *pe = NULL, *fe = NULL; UINT8 *s1 = NULL, *s2 = NULL; INT32 strlen; struct ACTIVE_SERVICE_INFO service; UINT8 *src; UINT8 *src8; date_time start_time, end_time, local_time; INT32 day, h, m, sec, timeLen, timePassed, progProcessLen; UINT32 fav_mask; struct t_ttx_lang *ttx_lang_list; UINT8 ttx_lang_num; struct t_subt_lang* sub_lang_list; UINT8 sub_lang_num; fav_mask = 0; for (i = 0; i < MAX_FAVGROUP_NUM; i++) fav_mask |= (0x01 << i); get_STC_offset(&h, &m, &sec); av_mode = sys_data_get_cur_chan_mode(); cur_channel = sys_data_get_cur_group_cur_mode_channel(); ret = get_prog_at(cur_channel, &p_node); if(ret != SUCCESS) return -1; get_sat_by_id(p_node.sat_id, &s_node); get_cur_group_name((char*)group_name, &group_type); get_local_time(&dt); service.tp_id = p_node.tp_id; service.service_id = p_node.prog_number; epg_set_active_service(&service, 1); /* Get current next epg info */ pe = epg_get_cur_service_event((INT32)cur_channel, PRESENT_EVENT, NULL, NULL, NULL, event_update); fe = epg_get_cur_service_event((INT32)cur_channel, FOLLOWING_EVENT, NULL, NULL, NULL, FALSE); s1 = (UINT8*)epg_get_event_name(pe, present_name, 32); s2 = (UINT8*)epg_get_event_name(fe, following_name, 32); #ifdef TTX_ON TTXEng_GetInitLang(&ttx_lang_list, &ttx_lang_num); #endif #ifdef SUBTITLE_ON subt_get_language(&sub_lang_list ,&sub_lang_num); #endif #ifdef TTX_ON if(sub_lang_num == 0) TTXEng_GetSubtLang(&ttx_lang_list,&sub_lang_num); #endif /* Set bmp content */ if (av_mode == TV_CHAN) icon = IM_PAY; else icon = IM_INFORMATION_RADIO; OSD_SetBitmapContent(&prog_bmp, icon); #ifdef TTX_ON if(ttx_lang_num>0) icon = IM_INFORMATION_ICON_TTX; else icon = INVALID_ID; //soc_printf("ttx icon id:%x, ", icon); OSD_SetBitmapContent(&prog_name_ttx, icon); //OSD_SetRect(&bmp->head.frame, p_prog_bmp->left, p_prog_bmp->top, p_prog_bmp->width,p_prog_bmp->height); OSD_DrawObject( (OBJECT_HEAD*) (&prog_name_ttx), C_UPDATE_ALL); #endif #ifdef SUBTITLE_ON if(sub_lang_num>0) icon = IM_INFORMATION_ICON_SUBTITLE; else icon = INVALID_ID; //soc_printf("subt icon id:%x\n", icon); OSD_SetBitmapContent(&prog_name_subt, icon); OSD_DrawObject( (OBJECT_HEAD*) (&prog_name_subt), C_UPDATE_ALL); #endif /* Init display strings */ for (i=0; i<7; i++) MEMSET(display_strs[20+i], 0, 2*MAX_DISP_STR_LEN); /* Set prog_name content */ MEMSET(string, 0, sizeof(string)); if (p_node.ca_mode == 0) STRCPY(string, ""); else STRCPY(string, "$"); ComAscStr2Uni(string, display_strs[20]); strlen = ComUniStrLen(display_strs[20]); ComUniStrCopyChar((UINT8*) &display_strs[20][strlen], p_node.service_name); /* Set prog_time content */ MEMSET(string, 0, sizeof(string)); sprintf(string, "%4d.%02d.%02d ", dt.year, dt.month, dt.day); ComAscStr2Uni(string, display_strs[21]); strlen = ComUniStrLen(display_strs[21]); src = OSD_GetUnicodeString(weekday_id[dt.weekday%7]); ComUniStrCopyChar((UINT8*) &display_strs[21][strlen], src); /* Set prog_num content */ MEMSET(string, 0, sizeof(string)); sprintf(string, "%03d", cur_channel + 1); ComAscStr2Uni(string, display_strs[22]); /* Set epg_time_now, epg_now, prog_process content */ if (s1) { MEMSET(string, 0, sizeof(string)); get_STC_offset(&h, &m, &sec); get_event_start_time(pe, &start_time); get_event_end_time(pe, &end_time); convert_time_by_offset(&start_time, &start_time, h, m); convert_time_by_offset(&end_time, &end_time, h, m); sprintf(string, "%02d:%02d~%02d:%02d ", start_time.hour, start_time.min, \ end_time.hour, end_time.min); ComAscStr2Uni(string, (UINT16*)display_strs[23]); ComUniStrCopyChar((UINT8*) &display_strs[24][0], s1); //draw prog process get_local_time(&local_time); get_time_offset(&start_time, &end_time, &day, &h, &m, &sec); timeLen = day * 24 * 60+h * 60+m; get_time_offset(&start_time, &local_time, &day, &h, &m, &sec); timePassed = day * 24 * 60+h * 60+m; if ((timeLen <= 0) || (timePassed <= 0)) progProcessLen = 0; else progProcessLen = timePassed * PROG_PROCESS_W / timeLen; if (progProcessLen > PROG_PROCESS_W) progProcessLen = PROG_PROCESS_W; ///prog_process.head.frame.uWidth = progProcessLen; } else { MEMSET(string, 0, sizeof(string)); src8 = OSD_GetUnicodeString(RS_EPG_NO_INFORMATION); ComUniStrCopyChar((UINT8*) &display_strs[23][0], src8); sprintf(string, " "); ComAscStr2Uni(string, (UINT16*)display_strs[24]); } /* Set epg_time_next, epg_next content */ if (s2) { MEMSET(string, 0, sizeof(string)); get_STC_offset(&h, &m, &sec); get_event_start_time(fe, &start_time); get_event_end_time(fe, &end_time); convert_time_by_offset(&start_time, &start_time, h, m); convert_time_by_offset(&end_time, &end_time, h, m); sprintf(string, "%02d:%02d~%02d:%02d ", start_time.hour, start_time.min, \ end_time.hour, end_time.min); ComAscStr2Uni(string, display_strs[25]); ComUniStrCopyChar((UINT8*) &display_strs[26][0], s2); } else { MEMSET(string, 0, sizeof(string)); sprintf(string, " "); ComAscStr2Uni(string, (UINT16*)display_strs[25]); ComAscStr2Uni(string, (UINT16*)display_strs[26]); } return 0; }