示例#1
0
static PRESULT	win_motorset_message_proc(UINT32 msg_type, UINT32 msg_code)
{
	struct nim_device *nim_dev;
	UINT8 level,quality,lock;
	SYSTEM_DATA* sys_data;
	static UINT32 interval;

	sys_data = sys_data_get();

	nim_dev = antset_cur_tuner==0? g_nim_dev : g_nim_dev2;

	switch(msg_type)
	{
	case CTRL_MSG_SUBTYPE_STATUS_TIMEOUT:
		if(diskmotor_move_state)
		{
			DBG_PRINTF("Move time out\n");
            UINT32 count;
            for (count = 0; count < 4; count++)
            {
			    api_diseqc_halt_motor(nim_dev,0);
                osal_task_sleep(50);
            }
			diskmotor_move_state = 0;

			win_motorset_draw_info(diskmotor_move_state);
			win_motorset_movebtn_setstr(0);
			win_motorset_movebtn_draw(1);
            DBG_PRINTF("Move time out. Stopped\n");
		}

		break;
	case CTRL_MSG_SUBTYPE_STATUS_SIGNAL:
		win_signal_refresh();
		//win_signal_update();		

#ifdef ANTENNA_INSTALL_BEEP			
		if(sys_data->install_beep)
		{
			level   = (UINT8)(msg_code>>16);
			quality = (UINT8)(msg_code>>8);
			lock    = (UINT8)(msg_code>>0);
		#if(defined(DVBT_BEE_TONE) && ANTENNA_INSTALL_BEEP == 1)			
			if(quality<20)
	          	level = 0;
	        else if(quality<40)
	            level = 1;
	        else if(quality<55)
	            level = 3;
	        else if(quality <70)
	            level = 5;
	        else
	            level = 7;
			api_audio_gen_tonevoice(level, tone_voice_init);
		#elif (defined(AUDIO_SPECIAL_EFFECT) && ANTENNA_INSTALL_BEEP == 2)
			if(lock)
				level = 100;
			else
				level = 1;		
			if(!tone_voice_init || level!=interval)
			{
				if(!tone_voice_init)
					api_audio_beep_start(beep_bin_array,beep_bin_array_size);
				interval = level;
				api_audio_beep_set_interval(interval);					
			}
		#endif			
			tone_voice_init = 1;
		}
#endif			
		break;
	}
static PRESULT atnsetf_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2)
{
	PRESULT ret = PROC_PASS;
	UINT8 level,quality,lock;
	UINT16 default_satidx;
	UINT32 sat_cnt;
	static UINT8 tone_voice_init;
	SYSTEM_DATA* sys_data;
	static UINT32 interval;
	MULTISEL* msel;
	VACTION unact;

	sys_data = sys_data_get();
	switch(event)
	{
	case EVN_PRE_OPEN:
		if(sys_data_get_cur_satidx() == (UINT16)(~0))
		{//sat_idx have been modified in other page
			default_satidx = win_load_default_satidx();
		}
		else
		{//do not modified yet,load default playing programme satellite
			default_satidx = sys_data_get_cur_satidx();
		}
		recreate_sat_view(VIEW_ALL, 0);
		win_atnsetf_load_tuner_configuration();
		sat_cnt = win_atnsetf_load_sat_cnt(FALSE);
		if(sat_cnt == 0)
		{
			ret = PROC_LEAVE;
		}
		else
		{
			/*Sat Name*/
			if(default_satidx >= sat_cnt)
				default_satidx = 0;
			msel = anesetf_msels[SAT_ID - 1];
			OSD_SetMultiselCount(msel, sat_cnt);
			OSD_SetMultiselSel(msel,default_satidx);
			win_atnsetf_load_sat_setting(default_satidx,FALSE);
		}
		
		if(ret != PROC_LEAVE)
			wincom_open_subtitle(pObj,RS_INSTALLATION_ANTENNA_SETUP,0);
		break;
	case EVN_POST_OPEN:
		tone_voice_init = 0;
		//win_signal_open(pObj);
#if 1//def SUPPORT_TWO_TUNER
		win_signal_open_ex(pObj,pObj->frame.uLeft+20,pObj->frame.uTop + 7 * (CON_H + CON_GAP) + 50);
#else
		win_signal_open_ex(pObj,pObj->frame.uLeft+20,pObj->frame.uTop + 6 * (CON_H + CON_GAP) + 50);
#endif
              wincom_open_help(pObj,antenna_setup_helpinfo , HELP_CNT);
		win_atnsetf_tuner_frontend();
		win_signal_refresh();
		//win_signal_update();
		break;
	case EVN_PRE_CLOSE:
		if(check_node_modified(TYPE_SAT_NODE) )
		{
			UINT8	back_saved;
			win_compopup_init(WIN_POPUP_TYPE_SMSG);
			win_compopup_set_msg(NULL, NULL, RS_MSG_SAVING_DATA);
			win_compopup_open_ext(&back_saved);
			update_data(TYPE_SAT_NODE);
			osal_task_sleep(500);
			win_compopup_smsg_restoreback();
		}
		/* Make OSD not flickering */
		*((UINT32*)param2) &= ~C_CLOSE_CLRBACK_FLG;	
		break;
	case EVN_POST_CLOSE:
		win_signal_close();
		sys_data_save(1);
		wincom_close_help();
		wincom_close_subtitle();
		OSD_TrackObject( (POBJECT_HEAD) &g_win_mainmenu, C_UPDATE_ALL);
#ifdef ANTENNA_INSTALL_BEEP	
		if(sys_data->install_beep)
		{
		#if(defined(DVBT_BEE_TONE) && ANTENNA_INSTALL_BEEP == 1)
			api_audio_stop_tonevoice();
		#elif (defined(AUDIO_SPECIAL_EFFECT) && ANTENNA_INSTALL_BEEP == 2)
			api_audio_beep_stop();
		#endif
		}
#endif
		break;
	case EVN_MSG_GOT:
		if(param1 == CTRL_MSG_SUBTYPE_STATUS_SIGNAL)
		{
			win_signal_refresh();
			//win_signal_update();		

#ifdef ANTENNA_INSTALL_BEEP				
			if(sys_data->install_beep)
			{
				level   = (UINT8)(param2>>16);
				quality = (UINT8)(param2>>8);
				lock    = (UINT8)(param2>>0);
			#if(defined(DVBT_BEE_TONE) && ANTENNA_INSTALL_BEEP == 1)	
				if(quality<20)
	              level = 0;
	            else if(quality<40)
	                level = 1;
	            else if(quality<55)
	                level = 3;
	            else if(quality <70)
	                level = 5;
	            else
	                level = 7;
				api_audio_gen_tonevoice(level, tone_voice_init);				
			#elif (defined(AUDIO_SPECIAL_EFFECT) && ANTENNA_INSTALL_BEEP == 2)
				if(lock)
					level = 100;//100/quality;
				else
					level = 1;//100/quality;				
				if(!tone_voice_init || level!=interval)
				{
					if(!tone_voice_init)
						api_audio_beep_start(beep_bin_array,beep_bin_array_size);
					interval = level;
					api_audio_beep_set_interval(interval);					
				}
			#endif
				tone_voice_init = 1;
			}
#endif			
		}