Пример #1
0
static PRESULT time_con_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2)
{
    PRESULT ret = PROC_PASS;
    UINT32 i;
    UINT8	unact;
    CONTAINER* cont = (CONTAINER*)pObj;
    UINT8	id = OSD_GetObjID(pObj);
    SYSTEM_DATA* p_sys_data;
    p_sys_data=sys_data_get();

    switch(event)
    {
    case EVN_PRE_OPEN:
        wincom_open_subtitle((POBJECT_HEAD)&win_time_con,RS_SYS_LOCAL_TIMER_SET/*RS_SYSTEM_TIME*/, 0);
        win_time_set_GMT_enable_string(p_sys_data->local_time.buseGMT);
        win_time_set_Summer_string(p_sys_data->local_time.SummerTime);
        win_time_set_Display_string(p_sys_data->local_time.TimeDisplay);
        win_time_set_GMT_Offset_string(p_sys_data->local_time.GMToffset_count);
        get_local_time(&win_time_local_time);
        set_time_data();
        set_time_clock();
        win_time_switch_GMT_Type(p_sys_data->local_time.buseGMT);
        win_time_set_time_zone_citys(FALSE);
        OSD_SetContainerFocus((CONTAINER*)pObj,1);
        break;

    case EVN_POST_OPEN:
        break;

    case EVN_PRE_CLOSE:
        sys_data_save(1);
        enable_summer_time(p_sys_data->local_time.buseGMT && p_sys_data->local_time.SummerTime);
        /* Make OSD not flickering */
        *((UINT32*)param2) &= ~C_CLOSE_CLRBACK_FLG;
        break;

    case EVN_POST_CLOSE:
        wincom_close_subtitle();
        OSD_TrackObject( (POBJECT_HEAD) &g_win_mainmenu, C_UPDATE_ALL);
        break;
    }
    return ret;
}
Пример #2
0
void win_time_right_key(POBJECT_HEAD pObj,UINT8 id)
{
    INT32 hoffset, moffset;
    SYSTEM_DATA* p_sys_data=sys_data_get();
    switch(id)
    {
    case MENU_TIMESET_GMT_ENABLE:
        p_sys_data->local_time.buseGMT=1-p_sys_data->local_time.buseGMT;
        win_time_set_GMT_enable_string(p_sys_data->local_time.buseGMT);
        OSD_TrackObject(pObj,C_UPDATE_ALL);
        win_time_switch_GMT_Type(p_sys_data->local_time.buseGMT);
        if(p_sys_data->local_time.buseGMT)
        {
            get_UTC(&win_time_local_time);
            set_STC_time(&win_time_local_time);
            set_time_data();
            set_time_clock();
        }
        else
        {
            p_sys_data->local_time.GMToffset_count = 23;
            win_time_set_GMT_Offset_string(p_sys_data->local_time.GMToffset_count);
            p_sys_data->local_time.SummerTime=0;
            enable_summer_time(0);
            win_time_set_Summer_string(p_sys_data->local_time.SummerTime);
        }
        OSD_DrawObject((POBJECT_HEAD )&time_item_con2,C_UPDATE_ALL);
        OSD_DrawObject((POBJECT_HEAD )&time_item_con3,C_UPDATE_ALL);
        OSD_DrawObject((POBJECT_HEAD )&time_item_con4,C_UPDATE_ALL);
        OSD_DrawObject((POBJECT_HEAD )&time_item_con5,C_UPDATE_ALL);
        win_time_set_time_zone_citys(TRUE);
        break;
    case MENU_TIMESET_SUMMER:
        p_sys_data->local_time.SummerTime=1-p_sys_data->local_time.SummerTime;
        win_time_set_Summer_string(p_sys_data->local_time.SummerTime);
        OSD_TrackObject(pObj,C_UPDATE_ALL);
        enable_summer_time(p_sys_data->local_time.buseGMT && p_sys_data->local_time.SummerTime);
        get_local_time(&win_time_local_time);
        set_time_data();
        set_time_clock();
        OSD_DrawObject((POBJECT_HEAD )&time_item_con4,C_UPDATE_ALL);
        OSD_DrawObject((POBJECT_HEAD )&time_item_con5,C_UPDATE_ALL);
        break;
    case MENU_TIMESET_DISPLAY:
        p_sys_data->local_time.TimeDisplay=1-p_sys_data->local_time.TimeDisplay;
        win_time_set_Display_string(p_sys_data->local_time.TimeDisplay);
        OSD_TrackObject(pObj,C_UPDATE_ALL);
        break;
    case MENU_TIMESET_GMT_OFFESET:
        if(p_sys_data->local_time.GMToffset_count==47)
        {
            p_sys_data->local_time.GMToffset_count=0;
        }
        else
        {
            p_sys_data->local_time.GMToffset_count++;
        }
        win_time_set_GMT_Offset_string(p_sys_data->local_time.GMToffset_count);
        OSD_TrackObject(pObj,C_UPDATE_ALL);

        sys_data_gmtoffset_2_hmoffset(&hoffset, &moffset);
        set_STC_offset( hoffset, moffset, 0);
        get_local_time(&win_time_local_time);
        set_time_data();
        set_time_clock();
        OSD_DrawObject((POBJECT_HEAD )&time_item_con4,C_UPDATE_ALL);
        OSD_DrawObject((POBJECT_HEAD )&time_item_con5,C_UPDATE_ALL);

        win_time_set_time_zone_citys(TRUE);
        break;
    }
}
Пример #3
0
void sys_data_load(void)
{
	AV_Set *av_set;
	//	tDspMode 			aspect_mode;
	BOOL create_view, grp_exst;
	S_NODE s_node;
	UINT8 group_idx, group_type, group_pos;
	UINT16 channel;
	UINT16 langclass;
	INT32 hoffset, moffset;
	UINT8 GMTOffset;
	date_time dt;
	enum TVSystem eTVSys;
	prog_id_t *prog_id;
	UINT8 av_mode;
	UINT8 pre_chan_mode, boot_chan_node;
	UINT16 chan_idx[2], boot_group_idx;

	
	/* Load data here */
	if(load_tmp_data((UINT8*)&system_config,sizeof(system_config))!=SUCCESS)
	{
		osal_task_sleep(50);
		if(load_tmp_data((UINT8*)&system_config,sizeof(system_config))!=SUCCESS)
		{
			osal_task_sleep(50);
			erase_tmp_sector();
			//if load tmp data fail, set to default 
			sys_data_factroy_init();
			save_tmp_data((UINT8*)&system_config,sizeof(system_config));
		}
	}

#ifdef NVOD_FEATURE
	nvod_release();
	nvod_init(system_config.main_frequency, system_config.main_symbol, system_config.main_qam);
#endif
	//SetNvodScanOverFlag(FALSE);
  
	if (CUR_CHAN_MODE > TV_CHAN)
		CUR_CHAN_MODE = TV_CHAN;

	if (get_prog_num(VIEW_ALL | CUR_CHAN_MODE, 0) != 0)
		create_view = TRUE;
	else
		create_view = FALSE;

	if (system_config.startup_switch && system_config.startup_mode <= 2)
	{
		boot_chan_node = pre_chan_mode = CUR_CHAN_MODE;
		if (system_config.startup_mode == RADIO_CHAN)
		{
			CUR_CHAN_MODE = RADIO_CHAN;
			pre_chan_mode = CUR_CHAN_MODE;
		}
		else if (system_config.startup_mode == TV_CHAN)
		{
			CUR_CHAN_MODE = TV_CHAN;
			pre_chan_mode = CUR_CHAN_MODE;
		}
		
		if (CUR_CHAN_GROUP_INDEX >= MAX_GROUP_NUM+MAX_FAVGROUP_NUM)
			CUR_CHAN_GROUP_INDEX = 0;
		boot_group_idx = CUR_CHAN_GROUP_INDEX;

		CUR_CHAN_GROUP_INDEX = 0;/* Force to all sate group*/

		if ( system_config.startup_mode == RADIO_CHAN
		        || system_config.startup_mode == 2 ) //both
		{

			sys_data_set_cur_chan_mode(RADIO_CHAN);
			recreate_prog_view(VIEW_ALL | RADIO_CHAN, 0);
			prog_id = &system_config.statup_chsid[0];
			//chan_idx[0] = get_prog_pos_ext(prog_id->sat_id,prog_id->tp_id,prog_id->prog_number);
			if (get_prog_num(VIEW_ALL | RADIO_CHAN, 0) > 0)
				chan_idx[0] = 0;
			else
				chan_idx[0] = 0xFFFF;
			if (chan_idx[0] != P_INVALID_ID)
				system_config.cur_chan_group[CUR_CHAN_GROUP_INDEX].radio_channel = chan_idx[0];
		}

		if ( system_config.startup_mode == TV_CHAN
		        || system_config.startup_mode == 2 ) //both

		{
			sys_data_set_cur_chan_mode(TV_CHAN);
			recreate_prog_view(VIEW_ALL | TV_CHAN, 0);
			prog_id = &system_config.statup_chsid[1];
			//chan_idx[1]  = get_prog_pos_ext(prog_id->sat_id,prog_id->tp_id,prog_id->prog_number);
			if (get_prog_num(VIEW_ALL | TV_CHAN, 0) > 0)
				chan_idx[0] = 0;
			else
				chan_idx[0] = 0xFFFF;
			if (chan_idx[1] != P_INVALID_ID)
				system_config.cur_chan_group[CUR_CHAN_GROUP_INDEX].tv_channel = chan_idx[1];
		}

		if (chan_idx[pre_chan_mode] != P_INVALID_ID)
		{
			sys_data_set_cur_chan_mode(pre_chan_mode);
			//recreate_prog_view(CREATE_VIEW_ALL_SAT,0);
			create_view = TRUE;
		}
		else
		{
			CUR_CHAN_GROUP_INDEX = boot_group_idx;
			sys_data_set_cur_chan_mode(boot_chan_node);
			system_config.startup_switch = 0;
		}

	}

	api_feed_power_onoff(system_config.feed_power);

	sys_data_set_cur_chan_mode(CUR_CHAN_MODE);

	if (CUR_CHAN_GROUP_INDEX >= MAX_GROUP_NUM+MAX_FAVGROUP_NUM)
		CUR_CHAN_GROUP_INDEX = 0;

	sys_data_check_channel_groups();

	group_idx = sys_data_get_cur_group_index();
	if (group_idx >= sys_data_get_group_num()&&group_idx<MAX_GROUP_NUM)//当group_idx为fav的时候不需要重新设置为0
		sys_data_set_cur_group_index(0);

	if (sys_data_get_group_num() > 0)
		create_view = TRUE;

	if (create_view)
	{
		group_idx = sys_data_get_cur_group_index();

		grp_exst = sys_data_get_cur_mode_group_infor(group_idx, &group_type, &group_pos, &channel);

		if (!grp_exst)
		{
			CUR_CHAN_GROUP_INDEX = 0;
			group_type = ALL_GROUP_TYPE;
		}

		if (group_type == ALL_GROUP_TYPE)
		{
			recreate_prog_view(VIEW_ALL | CUR_CHAN_MODE, 0);
		}
/*
		else if (group_type == SATE_GROUP_TYPE)
		{
			get_sat_at(group_pos, VIEW_ALL, &s_node);
			recreate_prog_view(VIEW_SINGLE_SAT | CUR_CHAN_MODE, s_node.sat_id);
		}
*/
		else
		{
			recreate_prog_view(VIEW_FAV_GROUP | CUR_CHAN_MODE, group_pos);
		}

	}

	MEMCPY(&system_config_bak, &system_config, sizeof(system_config));

    /*display effect setting*/
    sys_data_load_display_effect(TRUE);
	
	/* Load system time*/
	dt = system_config.sys_dt;
	if ( dt.year < 1900 || dt.year > 2100 || dt.month < 1 || dt.month > 12 || dt.day < 1 || dt.day > 31
	        || dt.hour > 23 || dt.min > 59 || dt.sec > 59 )
	{
		/* If system is invalid,set system to initial time*/
		dt.year = DEFAULT_YEAR;
		dt.month = DEFAULT_MONTH;
		dt.day = DEFAULT_DAY;
		dt.hour = 0;
		dt.min = 0;
		dt.sec = 0;
	}
	set_STC_time(&dt);
	init_UTC(&dt);

	if (system_config.local_time.buseGMT)
	{
		sys_data_gmtoffset_2_hmoffset(&hoffset, &moffset);
		set_STC_offset(hoffset, moffset, 0);
		enable_summer_time(system_config.local_time.SummerTime);
	}
	else
	{

		disable_time_parse();
	}

	/* Video Setting */
	av_set = &system_config.avset;
	//	if ( !firsttime )
	api_video_set_tvout(av_set->tv_mode);

	sys_data_set_display_mode(av_set);
    #if(SYS_DEFINE_NULL != SYS_RFM_MODULE)
	sys_data_set_rf(av_set->rf_mode, av_set->rf_channel);
    #endif


	/* Audio Setting */
	api_audio_set_volume(system_config.volume);


	OSD_SetLangEnvironment(system_config.lang.OSD_lang);
	sys_data_select_audio_language(system_config.lang.Audio_lang_1, system_config.lang.Audio_lang_2);

	sys_data_set_palette(0);

	if (system_config.rcupos > MAX_RCU_POSNUM)
		system_config.rcupos = 0;


#ifdef CHANCHG_VIDEOTYPE_SUPPORT
	UIChChgSetVideoType(system_config.chchgvideo_type);
#endif

}