static PRESULT atnsetm_item_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2)
{
	PRESULT ret = PROC_PASS;
	VACTION unact;
	UINT8 bID;
	UINT8 back_saved;
	win_popup_choice_t choice;
	UINT32 i,n;
	S_NODE s_node;
	POBJECT_HEAD submenu;
	BOOL b;
	
	bID = OSD_GetObjID(pObj);
	
	switch(event)
	{
	case EVN_UNKNOWN_ACTION:
		unact = (VACTION)(param1>>16);
		if(unact == VACT_ENTER)
		{
			if(bID == MOTORSET_ID || bID == LIMIT_SETUP)
			{
				b = win_atnsetm_check_save_motor_antenna_setting();
				if(!b)
				{
					win_compopup_init(WIN_POPUP_TYPE_OK);
					win_compopup_set_msg(NULL, NULL, RS_MSG_OUT_RANGE);
					win_compopup_open_ext(&back_saved);
					ret = PROC_LOOP;
					break;
				}
			}
			
				
			if(bID == RESETPOS_ID)
			{
				win_compopup_init(WIN_POPUP_TYPE_OKNO);
				win_compopup_set_msg(NULL, NULL, RS_ARE_YOU_SURE_CLEAR_SET_SATE_POSITON);
				//choice = win_compopup_open_ext(&back_saved);
				choice = win_compopup_open_enh((POBJECT_HEAD)&g_win_antenna_set_motor, 1, C_DRAW_SIGN_EVN_FLG | C_UPDATE_ALL);

				if(choice != WIN_POP_CHOICE_YES)
					break;

				/* Reset all satellite's position of current tuner to 0*/				
				n = get_sat_num(VIEW_ALL);
				recreate_sat_view(VIEW_ALL,0);
				for(i=0;i<n;i++)
				{ 
					get_sat_at(i,VIEW_ALL,&s_node);

					if( (antset_cur_tuner == 0 && s_node.position!= 0)
						|| (antset_cur_tuner == 10 && s_node.tuner2_antena.position!= 0) )
					{
						if(antset_cur_tuner == 0)
							s_node.position = 0;
						else
							s_node.tuner2_antena.position = 0;	
						modify_sat(s_node.sat_id,&s_node);							
					}
				}
				update_data();
			}
			else if(bID == MOTORSET_ID)
			{
				submenu = (POBJECT_HEAD)&g_win_motorset;
				if(OSD_ObjOpen(submenu, MENU_OPEN_TYPE_MENU | bID) != PROC_LEAVE)
					menu_stack_push(submenu);					
					
			}
			else if(bID == LIMIT_SETUP)
			{
				submenu = (POBJECT_HEAD)&g_win_motor_limitsetup;
				if(OSD_ObjOpen(submenu, MENU_OPEN_TYPE_MENU | bID) != PROC_LEAVE)
					menu_stack_push(submenu);					
			}
		}
	}

	return ret;
}
Exemple #2
0
static PRESULT factoryset_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2)
{
	PRESULT ret = PROC_PASS;
	CONTAINER* cont = (CONTAINER*)pObj;
	UINT8	id = OSD_GetObjID(pObj);
	UINT16 sat_idx,sat_cnt;//-a by wangyang 2011-11-03 for factory set del sat program
	UINT16 i;
	UINT8 flag;
	S_NODE s_node;

	switch(event)
	{
		case EVN_PRE_OPEN:
			//OSD_SetContainerFocus(cont, 1);
//-a by wangyang 2011-11-03 for factory set del sat program{{
		sat_idx = 0;
		if(sys_data_get_cur_satidx() == (UINT16)(~0))
			sat_idx = win_load_default_satidx();
		else
			sat_idx = sys_data_get_cur_satidx();
		
		recreate_sat_view(VIEW_ALL, 0);

#if (defined(SUPPORT_TWO_TUNER) || !defined(SELECT_SAT_ONLY))				
		for(i=0;i<get_sat_num(VIEW_ALL);i++)
		{
			get_sat_at((UINT16)i,VIEW_ALL,&s_node);

			flag = s_node.tuner1_valid | s_node.tuner2_valid;

			if(s_node.selected_flag != flag)
			{
				s_node.selected_flag = flag;
				modify_sat(s_node.sat_id, &s_node);
			}				
		}
#endif				
		
		//msel = satsrch_sels[SAT_ID - 1];
		sat_cnt = get_tuner_sat_cnt(TUNER_EITHER_SELECT);
		OSD_SetMultiselCount(&factoryset_sel5, sat_cnt);
		/*if(sat_idx >= sat_cnt)//albert.li del 2011.7.6
		{
			sat_idx = 0;
		}
		OSD_SetMultiselSel(msel,sat_idx);*/
		//sat_idx=get_sat_idx_in_selected_sats2(sat_cnt);//albert.li add 2011.7.6
		OSD_SetMultiselSel(&factoryset_sel5,sat_idx);
//-a by wangyang 2011-11-03 for factory set del sat program}}			
		wincom_open_subtitle((POBJECT_HEAD)&win_factoryset_con,RS_TOOLS_FACTORY_SETTING, 0);
			break;
			
		case EVN_POST_OPEN:
			break;
		
		case EVN_PRE_CLOSE:
		/* 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;
}
Exemple #3
0
static PRESULT satsrch_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2)
{
	PRESULT ret = PROC_PASS;
	MULTISEL* msel;
	UINT16 title_id,sat_idx,sat_cnt;
	OSD_RECT rect;
	POBJECT_HEAD lastitem;
	SYSTEM_DATA* sys_data = sys_data_get();
	UINT16 i;
	UINT8 flag;
	S_NODE s_node;
	
	switch(event)
	{
	case EVN_PRE_OPEN:
		sat_idx = 0;
		if(!single_multi_srch_flag)
		{
			if(sys_data_get_cur_satidx() == (UINT16)(~0))
				sat_idx = win_load_default_satidx();
			else
				sat_idx = sys_data_get_cur_satidx();
		}
		
		recreate_sat_view(VIEW_ALL, 0);

#if (defined(SUPPORT_TWO_TUNER) || !defined(SELECT_SAT_ONLY))				
		for(i=0;i<get_sat_num(VIEW_ALL);i++)
		{
			get_sat_at((UINT16)i,VIEW_ALL,&s_node);

			flag = s_node.tuner1_valid | s_node.tuner2_valid;

			if(s_node.selected_flag != flag)
			{
				s_node.selected_flag = flag;
				modify_sat(s_node.sat_id, &s_node);
			}				
		}
#endif				
		
		msel = satsrch_sels[SAT_ID - 1];
		sat_cnt = get_tuner_sat_cnt(TUNER_EITHER_SELECT);
		OSD_SetMultiselCount(msel, sat_cnt);		
		if(sat_idx >= sat_cnt)
		{
			sat_idx = 0;
		}
		OSD_SetMultiselSel(msel,sat_idx);
		if(single_multi_srch_flag)
			title_id = RS_INSTALLATION_MULTI_SEARCH;
		else
			title_id = RS_INSTALLATION_SINGLE_SEARCH;
		wincom_open_subtitle(pObj,title_id,0);

		/*lastitem = (POBJECT_HEAD)&satsrch_item7;
		if(single_multi_srch_flag)
			OSD_SetObjpNext(lastitem, &satsrch_multisats_back);
			//OSD_SetObjpNext(lastitem, NULL);
		else
			OSD_SetObjpNext(lastitem, NULL);*/
		
		win_satsrch_set_nitactive(FALSE);
		set_container_active(&satsrch_item6, C_ATTR_INACTIVE);
		get_sat_at(sat_idx,SET_SELECTED,&s_node);
		if(sys_data->antenna_connect_type == ANTENNA_CONNECT_DUAL_DIFF)
		{
		#ifdef SUPPORT_SELECT_SAME_SAT
			OSD_SetTextFieldContent(&satsrch_txt6_note , STRING_ID, ((s_node.reserve_1 == 0)? RS_LNB1 : RS_LNB2));
		#else
			OSD_SetTextFieldContent(&satsrch_txt6_note , STRING_ID, (s_node.tuner1_valid ? RS_LNB1 : RS_LNB2));		
		#endif
		}
		else
		{
			OSD_SetTextFieldContent(&satsrch_txt6_note , STRING_ID, RS_LNB1);
		}
		OSD_DrawObject((POBJECT_HEAD)&satsrch_txt6_note, C_UPDATE_ALL);
#ifndef SUPPORT_TWO_TUNER
             remove_menu_item(&g_win_sat_srchset,(POBJECT_HEAD)&satsrch_item6,(CON_H + CON_GAP));     //guop add  
#endif
		break;
	case EVN_POST_OPEN:
	    if(single_multi_srch_flag == 1)
		{
			OSD_DrawObject((POBJECT_HEAD)&satsrch_split,C_UPDATE_ALL);
	    }
		win_satsrch_set_drawselectsats();
		break;
	case EVN_PRE_CLOSE:
		/* 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;
}
Exemple #4
0
static PRESULT satsrch_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2)
{
    PRESULT ret = PROC_PASS;
    MULTISEL* msel;
    UINT16 title_id,sat_idx,sat_cnt;
    OSD_RECT rect;
    POBJECT_HEAD lastitem;
    SYSTEM_DATA* sys_data = sys_data_get();
    UINT16 i;
    UINT8 flag;
    S_NODE s_node;

    switch(event)
    {
    case EVN_PRE_OPEN:

#ifdef EXIT_KEY_EXIT_ALL_MENU
        exit_key_flag =  FALSE;
#endif

        sat_idx = 0;
        if(!single_multi_srch_flag)
        {
            if(sys_data_get_cur_satidx() == (UINT16)(~0))
                sat_idx = win_load_default_satidx();
            else
                sat_idx = sys_data_get_cur_satidx();
        }

        recreate_sat_view(VIEW_ALL, 0);

#if (defined(SUPPORT_TWO_TUNER) || !defined(SELECT_SAT_ONLY))
        for(i=0; i<get_sat_num(VIEW_ALL); i++)
        {
            get_sat_at((UINT16)i,VIEW_ALL,&s_node);

            flag = s_node.tuner1_valid | s_node.tuner2_valid;

            if(s_node.selected_flag != flag)
            {
                s_node.selected_flag = flag;
                modify_sat(s_node.sat_id, &s_node);
            }
        }
#endif

        msel = satsrch_sels[SAT_ID - 1];
        sat_cnt = get_tuner_sat_cnt(TUNER_EITHER_SELECT);
        OSD_SetMultiselCount(msel, sat_cnt);
        /*if(sat_idx >= sat_cnt)//albert.li del 2011.7.6
        {
        	sat_idx = 0;
        }
        OSD_SetMultiselSel(msel,sat_idx);*/
        sat_idx=get_sat_idx_in_selected_sats(sat_cnt);//albert.li add 2011.7.6
        OSD_SetMultiselSel(msel,sat_idx);

        if(single_multi_srch_flag)
            title_id = RS_INSTALLATION_MULTI_SEARCH;
        else
            title_id = RS_INSTALLATION_SINGLE_SEARCH;
        //wincom_open_subtitle(pObj,title_id,0);
        wincom_open_subtitle_ex(pObj,title_id,0,-15,0,-10);//albert.li add 2011.6.21

        /*lastitem = (POBJECT_HEAD)&satsrch_item7;
        if(single_multi_srch_flag)
        	OSD_SetObjpNext(lastitem, &satsrch_multisats_back);
        	//OSD_SetObjpNext(lastitem, NULL);
        else
        	OSD_SetObjpNext(lastitem, NULL);*/

        win_satsrch_set_nitactive(FALSE);
        set_container_active(&satsrch_item6, C_ATTR_INACTIVE);
        get_sat_at(sat_idx,SET_SELECTED,&s_node);
        if(sys_data->antenna_connect_type == ANTENNA_CONNECT_DUAL_DIFF)
        {
#ifdef SUPPORT_SELECT_SAME_SAT
            OSD_SetTextFieldContent(&satsrch_txt6_note , STRING_ID, ((s_node.reserve_1 == 0)? RS_LNB1 : RS_LNB2));
#else
            OSD_SetTextFieldContent(&satsrch_txt6_note , STRING_ID, (s_node.tuner1_valid ? RS_LNB1 : RS_LNB2));
#endif
        }
        else
        {
            OSD_SetTextFieldContent(&satsrch_txt6_note , STRING_ID, RS_LNB1);
        }
        OSD_DrawObject((POBJECT_HEAD)&satsrch_txt6_note, C_UPDATE_ALL);
#ifndef SUPPORT_TWO_TUNER
        remove_menu_item(&g_win_sat_srchset,(POBJECT_HEAD)&satsrch_item6,(CON_H + CON_GAP));     //guop add
#endif
        break;
    case EVN_POST_OPEN:
        //wincom_open_help(pObj,search_set_helpinfo, HELP_CNT);
        wincom_open_commen_help(pObj);

        if(single_multi_srch_flag == 1)
        {
            OSD_DrawObject((POBJECT_HEAD)&satsrch_split,C_UPDATE_ALL);
        }

        sat_cnt = get_tuner_sat_cnt(TUNER_EITHER_SELECT);

        if(sat_cnt <=(SELSAT_ROW_CNT*2))
            win_satsrch_set_fix_drawselectsats();
        else
        {
            start_scroll_sat_id=0;
            //api_stop_timer(&sat_display_scroll);
            sat_display_scroll = api_start_timer("SATDISP",500,(OSAL_T_TIMER_FUNC_PTR)sat_search_scroll_disp_handler);
        }

        break;
    case EVN_PRE_CLOSE:
        /* Make OSD not flickering */
        *((UINT32*)param2) &= ~C_CLOSE_CLRBACK_FLG;
        break;
    case EVN_POST_CLOSE:

        api_stop_timer(&sat_display_scroll);

        wincom_close_subtitle();
        OSD_ClearObject((POBJECT_HEAD)&g_win_sat_srchset,C_UPDATE_ALL);//albert.li add
        //OSD_TrackObject( (POBJECT_HEAD) &g_win_submenu/*g_win_mainmenu*/, C_UPDATE_ALL);

#ifdef EXIT_KEY_EXIT_ALL_MENU
        if( exit_key_flag == TRUE)
        {
            exit_key_flag =FALSE;
            mm_leave_all_menu();
        }
#endif
        break;
    case EVN_MSG_GOT:
        if(param1 == CTRL_MSG_SUBTYPE_CMD_SAT_SCROLL_DISP)
        {
            start_scroll_sat_id=win_satsrch_set_scroll_drawselectsats(start_scroll_sat_id);

            if(sat_display_scroll!=OSAL_INVALID_ID)
            {
                api_stop_timer(&sat_display_scroll);
                sat_display_scroll = api_start_timer("SATDISP",500,(OSAL_T_TIMER_FUNC_PTR)sat_search_scroll_disp_handler);
            }
        }
        break;
    }

    return ret;
}
Exemple #5
0
static PRESULT satlst_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2)
{
	PRESULT ret = PROC_PASS;

	switch(event)
	{
	case EVN_PRE_OPEN:
		win_init_pstring(30);
		win_satlist_check_focusID(1);
		win_satlist_load_sat_select();
		wincom_open_subtitle(pObj,RS_SATELLITE_LIST,0);
		break;
	case EVN_POST_OPEN:
		wincom_open_help_1(pObj,satlist_helpinfo , HELP_CNT);
		break;
	case EVN_PRE_CLOSE:
		win_satlist_save_sat_select();
		/* Make OSD not flickering */
		*((UINT32*)param2) &= ~C_CLOSE_CLRBACK_FLG;	
		break;
	case EVN_POST_CLOSE:
		wincom_close_subtitle();
		wincom_close_help();
		OSD_TrackObject( (POBJECT_HEAD) &g_win_mainmenu, C_UPDATE_ALL);
		sys_data_check_channel_groups();
		break;
		
	case EVN_MSG_GOT:
		{
 //added by Eric.Ren, 接收control task 的消息,处理kingofsat  更新,2010.7.30
#ifdef KINGOFSAT_SUPPORT
			OBJLIST* ol;
			UINT16 sel;
			S_NODE s_node;
			INT32 kingofsat_tp_num = 0;  //可更新的TP个数
			UINT8 back_saved;
			
			if(param1 == CTRL_MSG_SUBTYPE_STATUS_DOWNLOAD_FINISH)
			{
				if((INT32)param2 < 0)
				{
					win_compopup_smsg_restoreback();

					win_compopup_init(WIN_POPUP_TYPE_SMSG);                        
					win_compopup_set_frame(MSG_POPUP_LAYER_L, MSG_POPUP_LAYER_T, MSG_POPUP_LAYER_W, MSG_POPUP_LAYER_H);
					win_compopup_set_msg("Downloading error,Try again!", NULL, 0);
					win_compopup_open_ext(&back_saved);			

					osal_task_sleep(2000);
					win_compopup_smsg_restoreback();
					
					break ;
				}
				ol = &satlist_olist;
				sel = OSD_GetObjListCurPoint(ol);
				get_sat_at(sel,VIEW_ALL,&s_node);

				//判断是有可更新的TP 数据
				kingofsat_get_tp_num(&kingofsat_tp_num);
				if(kingofsat_tp_num == 0)
				{
					win_compopup_smsg_restoreback();
					win_compopup_init(WIN_POPUP_TYPE_SMSG);                        
					win_compopup_set_frame(MSG_POPUP_LAYER_L, MSG_POPUP_LAYER_T, MSG_POPUP_LAYER_W, MSG_POPUP_LAYER_H);
					win_compopup_set_msg("NO TP in downloading data!", NULL, 0);
					win_compopup_open_ext(&back_saved);
					osal_task_sleep(1000);
					win_compopup_smsg_restoreback();
					
					break;
				}
				
				kingofsat_parse();		//解析下载数据
				recreate_tp_view(VIEW_SINGLE_SAT, s_node.sat_id);//创建TP view
				kingofsat_update(s_node.sat_id);	//更新数据
				kingofsat_destroy();	//释放资源

				OSD_TrackObject( (POBJECT_HEAD)&g_win_satlist, C_DRAW_SIGN_EVN_FLG | C_UPDATE_ALL);

				recreate_sat_view(VIEW_ALL, 0); //创建SAT view
			}

#endif
			break;
		}

	default:
		break;		
		
	}

	return ret;
}
static void win_antcnt_save_setting(void)
{
	SYSTEM_DATA* sys_data;
	MULTISEL* msel;
	UINT32 antenna_connect_type,tuner_lnb_type[2],i,n;
	S_NODE s_node;
	UINT8 back_saved;
	win_popup_choice_t choice;
	
	sys_data = sys_data_get();

	/* Antenna connect */
	msel = antcnt_msels[0];
	antenna_connect_type = msel->nSel;
	
	/* LNB1 */
	msel = antcnt_msels[1];
	tuner_lnb_type[0] = msel->nSel;
		
	/* LNB2 */
	msel = antcnt_msels[2];
	tuner_lnb_type[1] = msel->nSel;

#if 0
	if(sys_data->antenna_connect_type != antenna_connect_type
		&& ( antenna_connect_type == ANTENNA_CONNECT_SINGLE
			|| sys_data->antenna_connect_type == ANTENNA_CONNECT_SINGLE) )
	{
		win_compopup_init(WIN_POPUP_TYPE_OKNO);
		win_compopup_set_msg("This change will delete all channels, continue?",NULL,0);
		choice = win_compopup_open_ext(&back_saved);		
		if(choice != WIN_POP_CHOICE_YES)
			return;
		
		n = get_sat_num(VIEW_ALL);
		recreate_sat_view(VIEW_ALL,0);
		for(i=0;i<n;i++)
		{ 
			get_sat_at(i,VIEW_ALL,&s_node);
			if(s_node.tuner1_valid != 0 || s_node.tuner2_valid!=0)
			{
				s_node.tuner1_valid = s_node.tuner2_valid = 0;
				modify_sat(s_node.sat_id,&s_node);
			} 		
		}
		update_data();

		recreate_prog_view(VIEW_ALL | PROG_TVRADIO_MODE ,0);
		for(i=0;i<n;i++)
		{ 
			get_sat_at(i,VIEW_ALL,&s_node);
			del_child_prog(TYPE_SAT_NODE, s_node.sat_id);
		}
		update_data();
		
		sys_data_check_channel_groups();
	}
#endif

	sys_data->antenna_connect_type = antenna_connect_type;	
    UINT32 lnb_type,lnb_freq1,lnb_freq2;

    get_lnb_type_setting(get_universal_lnb_index(),&lnb_type,&lnb_freq1,&lnb_freq2);
    for(i=0;i<2;i++)
    {
        if(sys_data->tuner_lnb_type[i] != tuner_lnb_type[i])
        {
            sys_data->tuner_lnb_type[i] = tuner_lnb_type[i];
            sys_data->tuner_lnb_antenna[i].motor_type = LNB_MOTOR_DISEQC12;
            sys_data->tuner_lnb_antenna[i].lnb_type = lnb_type;
            sys_data->tuner_lnb_antenna[i].lnb_low  = lnb_freq1;
            sys_data->tuner_lnb_antenna[i].lnb_high = lnb_freq2;            
        }
    }

	sys_data->tuner_lnb_type[0] = tuner_lnb_type[0];
	sys_data->tuner_lnb_type[1] = tuner_lnb_type[1];	

	set_chchg_local_postion();//lib_nimng_init(antenna_connect_type);

}
Exemple #7
0
static PRESULT motorset_itembtn_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2)
{
	PRESULT ret = PROC_PASS;
	VACTION unact;
	UINT8 bID;
	UINT8 back_saved;
	win_popup_choice_t choice;
	UINT32 position,sat_pos;
	struct nim_device *nim_dev;
	S_NODE s_node;

	nim_dev = antset_cur_tuner==0? g_nim_dev : g_nim_dev2;
	

	bID = OSD_GetObjID(pObj);

	switch(event)
	{
	case EVN_UNKNOWN_ACTION:
		unact = (VACTION)(param1>>16);

		if(unact == VACT_MOVE_WEST || unact == VACT_MOVE_EAST)
		{
			if(bID != MOVESAVE_ID)	break;

			if(diskmotor_move_state == 0 )
			{
				if(unact == VACT_MOVE_WEST)
				{
#ifdef FIRST_MOVE_BY_STEP				
					api_diseqc_drive_motor_west_by_steps(nim_dev,1,0);
					diskmotor_move_step = 0;
#else
					api_diseqc_drive_motor_west(nim_dev,0);
#endif
					diskmotor_move_state = 1;
				}
				else	//VACT_MOVE_EAST
				{
#ifdef FIRST_MOVE_BY_STEP				
					api_diseqc_drive_motor_east_by_steps(nim_dev,1,0);
					diskmotor_move_step = 0;
#else
					api_diseqc_drive_motor_east(nim_dev,0);
#endif					
					diskmotor_move_state = 2;				
				}

				api_stop_timer(&diskmove_timer_id);
                osal_task_sleep(100);
				DBG_PRINTF("Start move %d\n",diskmotor_move_state);
				diskmove_timer_id = api_start_timer(MOVE_TIERR_NAME, MOVE_TIERR_TIME,win_disk_move_handler);
				

SET_MOVE_DISPLAY:
				win_motorset_draw_info(diskmotor_move_state);
				win_motorset_movebtn_setstr(1);
				win_motorset_movebtn_draw(1);				
			}
			else
			{
				if( (diskmotor_move_state == 1 && unact == VACT_MOVE_WEST)
					|| (diskmotor_move_state ==2 && unact == VACT_MOVE_EAST))
				{	
					/* Continue move West or East*/
					DBG_PRINTF("Continue move %d\n",diskmotor_move_state);

#ifdef FIRST_MOVE_BY_STEP
					api_stop_timer(&diskmove_timer_id);
					if(diskmotor_move_step == 0)
					{
						osal_task_sleep(100);
						if(diskmotor_move_state== 1)
							api_diseqc_drive_motor_west(nim_dev,0);
						else
							api_diseqc_drive_motor_east(nim_dev,0);
						diskmotor_move_step = 1;
						DBG_PRINTF("First time continue move\n");
					}
                    //else
					//    DBG_PRINTF("Continue move %d\n",diskmotor_move_state);
#endif
					osal_task_sleep(100);
					diskmove_timer_id = api_start_timer(MOVE_TIERR_NAME, MOVE_TIERR_TIME,win_disk_move_handler);
				
				}
				else
					goto STOP_MOVE;
			}
			
		}
		else if(unact == VACT_ENTER)
		{			
			if(bID == MOVESAVE_ID)
			{
				if(diskmotor_move_state != 0)
					goto STOP_MOVE;
				else
				{
					/* Save current postion */
					OSD_GetEditFieldIntValue(&motorset_edf3,&position);

					get_tuner_sat(antset_cur_tuner,SAT_IDX,&s_node);
					if(position<=MAX_POSNUM)
					{
						sat_pos = antset_cur_tuner==0? s_node.position : s_node.tuner2_antena.position;

						if(sat_pos == position && position== 0)
						{
							win_compopup_init(WIN_POPUP_TYPE_OK);
							win_compopup_set_msg("Position not specified (1~63)", NULL, 0);
							win_compopup_open_ext(&back_saved);
							break;
						}
					
						win_compopup_init(WIN_POPUP_TYPE_OKNO);
						if(position == 0)
							win_compopup_set_msg("Are you sure to clear this satellite's position?", NULL, 0);
						else
							win_compopup_set_msg("Are you sure to change this satellite's position?", NULL, 0);							
						choice = win_compopup_open_ext(&back_saved);
						if(choice == WIN_POP_CHOICE_YES)
						{
							if(sat_pos != position)
							{
								recreate_sat_view(VIEW_ALL,0);
								if(antset_cur_tuner == 0)
									s_node.position = position;
								else
									s_node.tuner2_antena.position = position;
								modify_sat(s_node.sat_id, &s_node);
								update_data();
							}

							if(position != 0)
								api_diseqc_store_satellite_position(nim_dev, (UINT8)position,0);
						}
					}
					else
					{
						
					}
				}
			}
			else if(bID == GOTONN_ID)
			{
			
				position = (UINT32)win_motorset_gotonn_sub_list();
				if(position <= MAX_POSNUM)
				{
					if(position == 0)
						api_diseqc_goto_reference(nim_dev,0);
					else
						api_diseqc_goto_satellite_position(nim_dev,position,0);
					win_compopup_init(WIN_POPUP_TYPE_OK);
					win_compopup_set_msg("Wait to move the position!", NULL, 0);
                    win_compopup_set_btnstr(0, RS_DISEQC12_MOVEMENT_STOP);
					win_compopup_open_ext(&back_saved);
					api_diseqc_halt_motor(nim_dev,0);					
				}
				
			}
			else if(bID == RECACULATE_ID)
			{
				get_tuner_sat(antset_cur_tuner,SAT_IDX,&s_node);

				if(s_node.position==0)
				{
					win_compopup_init(WIN_POPUP_TYPE_SMSG);
					win_compopup_set_msg("Position is NULL", NULL,0);
					win_compopup_open_ext(&back_saved);
					osal_task_sleep(500);
					win_compopup_smsg_restoreback();
				}

				win_compopup_init(WIN_POPUP_TYPE_OKNO);
				win_compopup_set_msg("Are you sure re-calulate all satellite positions?", NULL, 0);
				choice = win_compopup_open_ext(&back_saved);
				if(choice == WIN_POP_CHOICE_YES)
					api_diseqc_calculate_satellite_position(nim_dev,s_node.position,0,0, 0);
			}
				
		}
		
		break;
	case EVN_UNKNOWNKEY_GOT:

		//if(bID == MOVESAVE_ID)
		if(diskmotor_move_state)
		{
STOP_MOVE:
			DBG_PRINTF("Stoped\n");
			api_stop_timer(&diskmove_timer_id);
			osal_task_sleep(50);
			api_diseqc_halt_motor(nim_dev,0);
			diskmotor_move_state = 0;

			win_motorset_draw_info(diskmotor_move_state);
			win_motorset_movebtn_setstr(0);
			win_motorset_movebtn_draw(1);
		}
		
		break;
	}
	return ret;
}
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			
		}