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; }
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; }
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; }
static PRESULT satsrch_item_sel_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2) { PRESULT ret = PROC_PASS; VACTION unact; UINT32 sel; UINT8 bID; char str[10]; UINT16 * Uni_str; UINT8* pstr; UINT16 cur_idx; COM_POP_LIST_TYPE_T list_type; OSD_RECT rect; COM_POP_LIST_PARAM_T param; UINT16 i,n = 0; S_NODE s_node; UINT32 flag; bID = OSD_GetObjID(pObj); switch(event) { case EVN_PRE_CHANGE: sel = *((UINT32*)param1); break; case EVN_POST_CHANGE: sel = param1; if(bID == MODE_ID) win_satsrch_set_nitactive(TRUE); if(bID == SAT_ID) { get_sat_at(sel,SET_SELECTED,&s_node); #ifdef SUPPORT_TWO_TUNER //guop modify #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 OSD_DrawObject((POBJECT_HEAD)&satsrch_txt6_note, C_UPDATE_ALL); #endif } break; case EVN_REQUEST_STRING: sel = param1; Uni_str= (UINT16*)param2; if(bID == SAT_ID) { get_tuner_sat_name(2,sel,Uni_str); sys_data_set_cur_satidx(sel); } break; case EVN_UNKNOWN_ACTION: unact = (VACTION)(param1>>16); if(unact == VACT_POP_UP) { OSD_SetRect2(&rect,&pObj->frame); switch(bID) { case SAT_ID: rect.uLeft -= 80; rect.uWidth += 80; list_type = POP_LIST_TYPE_SAT; rect.uHeight = 300; param.id = TUNER_EITHER; param.cur = SATSRCH_SAT_IDX; if(single_multi_srch_flag == 0) param.selecttype = POP_LIST_SINGLESELECT; else { MEMSET(sat_select,0,sizeof(sat_select)); n = get_tuner_sat_cnt(TUNER_EITHER); if(n == 0) { list_type = 0xFF; break; } for(i=0;i<n;i++) { get_tuner_sat(TUNER_EITHER,i,&s_node); if(s_node.selected_flag) sat_select[i] = 1; } #if (defined(SUPPORT_TWO_TUNER) || !defined(SELECT_SAT_ONLY)) param.selecttype = POP_LIST_MULTISELECT; #else param.selecttype = POP_LIST_SINGLESELECT; #endif param.select_array = sat_select; } break; default: list_type = 0xFF; } if(list_type == 0xFF) break; cur_idx = win_com_open_sub_list(list_type,&rect,¶m); if(single_multi_srch_flag == 0) { if(cur_idx == LIST_INVALID_SEL_IDX || cur_idx == param.cur) break; } else { /* Check the select satellite */ #if (defined(SUPPORT_TWO_TUNER) || !defined(SELECT_SAT_ONLY)) for(i=0;i<n;i++) { if(win_comlist_ext_check_item_sel(i)) flag = 1; else flag = 0; get_tuner_sat(TUNER_EITHER,i,&s_node); if(s_node.selected_flag != flag) { s_node.selected_flag = flag; modify_sat(s_node.sat_id, &s_node); } } update_data(TYPE_SAT_NODE); #endif } if(single_multi_srch_flag == 0) SATSRCH_SAT_IDX = cur_idx; get_sat_at(cur_idx,SET_SELECTED,&s_node); #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 OSD_DrawObject((POBJECT_HEAD)&satsrch_txt6_note, C_UPDATE_ALL); OSD_TrackObject((POBJECT_HEAD)&satsrch_item1, C_DRAW_SIGN_EVN_FLG | C_UPDATE_ALL); if(single_multi_srch_flag) { /* TODO : Draw the select satellites name */ win_satsrch_set_drawselectsats(); } } break; } return ret; }
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; }
static void win_satlist_set_display(void) { UINT32 i,j,n,lnb_cnt; S_NODE s_node; OBJLIST* ol; UINT16 top,cnt,page,index,curitem; UINT32 valid_idx,sat_longitude,ew_flag; CONTAINER* item; TEXT_FIELD* txt; char str[30]; UINT16 icon_id; BITMAP* bmp; SYSTEM_DATA* sys_data; UINT8 hl_idx; sys_data = sys_data_get(); #ifdef SUPPORT_TWO_TUNER if(sys_data->antenna_connect_type == ANTENNA_CONNECT_DUAL_DIFF) lnb_cnt = 2; else lnb_cnt = 1; #endif ol = &satlist_olist; cnt = OSD_GetObjListCount(ol); page = OSD_GetObjListPage(ol); top = OSD_GetObjListTop(ol); curitem = OSD_GetObjListNewPoint(ol); for(i=0;i<page;i++) { item = (CONTAINER*)satlist_items[i]; index = top + i; if(index< cnt) valid_idx = 1; else valid_idx = 0; if(valid_idx) get_sat_at(index,VIEW_ALL,&s_node); /* Sat IDX */ txt = (PTEXT_FIELD)OSD_GetContainerNextObj(item); if(valid_idx) OSD_SetTextFieldContent(txt, STRING_NUMBER, (UINT32) (index + 1)); else OSD_SetTextFieldContent(txt, STRING_ANSI, (UINT32)""); /* Sat Name*/ txt = (PTEXT_FIELD)OSD_GetObjpNext(txt); if(valid_idx) #ifdef DB_USE_UNICODE_STRING OSD_SetTextFieldContent(txt, STRING_UNICODE,(UINT32)s_node.sat_name); #else OSD_SetTextFieldContent(txt, STRING_ANSI,(UINT32),s_node.sat_name); #endif else OSD_SetTextFieldContent(txt, STRING_ANSI, (UINT32)""); /* Sat Orbit*/ txt = (PTEXT_FIELD)OSD_GetObjpNext(txt); if(valid_idx) { sat_longitude = s_node.sat_orbit; if(sat_longitude>1800) { sat_longitude = 3600 - sat_longitude; ew_flag = 0; } else ew_flag = 1; sprintf(str,"%s %d.%d",ew_flag? "E" : "W", sat_longitude/10, sat_longitude%10); OSD_SetTextFieldContent(txt, STRING_ANSI, (UINT32)str); } else OSD_SetTextFieldContent(txt, STRING_ANSI, (UINT32)""); #ifdef SUPPORT_TWO_TUNER for(j=0;j<lnb_cnt;j++) { icon_id = 0; if(valid_idx) { if((j==0 && s_node.tuner1_valid) || (j==1 && s_node.tuner2_valid)) { #ifndef SUPPORT_SELECT_SAME_SAT if(s_node.tuner1_valid && s_node.tuner2_valid) { s_node.tuner2_valid = 0; modify_sat(s_node.sat_id, &s_node); } #endif /* #if0 */ icon_id = IM_TV_FAVORITE; } } bmp = sat_lnb_sel_bmps[i][j]; OSD_SetBitmapContent(bmp, icon_id); hl_idx = BMP_HL_IDX; if(index == curitem) { if(OSD_GetFocusObject((POBJECT_HEAD)item) == (POBJECT_HEAD)bmp) hl_idx = BMP_HLEDIT_IDX; } bmp->head.style.bHLIdx = hl_idx; } #endif }
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); }
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_item_sel_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2) { PRESULT ret = PROC_PASS; VACTION unact; UINT32 sel; UINT8 bID; char str[30]; UINT16 * Uni_str; UINT8* pstr; SYSTEM_DATA* sys_data; POBJECT_HEAD other_antset_menu,item; S_NODE s_node; UINT16 cur_idx; COM_POP_LIST_TYPE_T list_type; OSD_RECT rect; COM_POP_LIST_PARAM_T param; MULTISEL* msel; sys_data = sys_data_get(); bID = OSD_GetObjID(pObj); switch(event) { case EVN_PRE_CHANGE: sel = *((UINT32*)param1); if(bID == TUNER_ID) { if(TUNER_CNT < 2) break; /* Check tuner : sel has selected satellite or not.*/ if(get_tuner_sat_cnt(sel) == 0) { UINT8 back_saved; win_compopup_init(WIN_POPUP_TYPE_OK); win_compopup_set_msg(NULL,NULL, RS_TUNER_HAS_NO_SATE_SEL); win_compopup_open_ext(&back_saved); antset_cur_tuner = (sel == 0)? 1: 0; win_atnsetf_load_sat_cnt(FALSE); ret = PROC_LOOP; } else { antset_cur_tuner = sel; cur_tuner_idx = antset_cur_tuner; } } break; case EVN_POST_CHANGE: sel = param1; if(bID == LNB_ID) { win_atnsetf_load_22k_action(TRUE); #ifdef SUPPORT_UNICABLE if(win_unicable_setting_open(LNB_IDX)) OSD_TrackObject((POBJECT_HEAD)&g_win_antenna_set_fixed, C_DRAW_SIGN_EVN_FLG | C_UPDATE_ALL); #endif } if(bID == TUNER_ID) { if(sys_data->tuner_lnb_type[sel] != LNB_FIXED) { /* Need to change : Motor antenna setting menu. */ other_antset_menu = (POBJECT_HEAD)&g_win_antenna_set_motor; if(OSD_ObjOpen(other_antset_menu, MENU_OPEN_TYPE_MENU + bID) != PROC_LEAVE) { win_signal_close(); menu_stack_pop(); menu_stack_push(other_antset_menu); } ret = PROC_LOOP; } else { win_atnsetf_load_sat_cnt(TRUE); win_atnsetf_load_sat_setting(0,TRUE); } } else if(bID == SAT_ID) win_atnsetf_load_sat_setting(sel,TRUE); else if(bID != TP_ID) { win_atnsetf_modify_sat_setting(SAT_IDX); } if(ret != PROC_LOOP) { api_stop_timer(&set_frontend); set_frontend = api_start_timer("SETANT",600,(OSAL_T_TIMER_FUNC_PTR)atnsetf_set_frontend_handler); } break; case EVN_REQUEST_STRING: sel = param1; Uni_str= (UINT16*)param2; if(bID == SAT_ID) { get_tuner_sat_name(antset_cur_tuner,sel,Uni_str); sys_data_set_cur_satidx(sel); } else if(bID == TP_ID) { get_tuner_sat(antset_cur_tuner,SAT_IDX,&s_node); get_tp_name(s_node.sat_id,sel,Uni_str); #ifdef SUPPORT_SELECT_SAME_SAT s_node.reserve_1 = antset_cur_tuner; modify_sat(s_node.sat_id, &s_node); update_data(); #endif } else if(bID == LNB_ID) get_lnb_name(sel,Uni_str); else if(bID == DISEQC11_ID) get_diseqc11_name(sel,Uni_str); else if(bID == IF_CHANNEL_ID) get_IF_channel_name(sel,Uni_str); else if(bID == CENTRE_FREQ_ID) get_centre_freqs_name(sel,Uni_str); break; case EVN_UNKNOWN_ACTION: unact = (VACTION)(param1>>16); if(unact == VACT_POP_UP) { OSD_SetRect2(&rect,&pObj->frame); /*Patch: For solve pop-up windows show bugs,for example: Universal(5150-10600) can not be all show*/ OSD_SetRect(&rect, rect.uLeft, rect.uTop, (rect.uWidth + 10), rect.uHeight); param.selecttype = POP_LIST_SINGLESELECT; switch(bID) { case SAT_ID: rect.uLeft -= 40; rect.uWidth += 40; list_type = POP_LIST_TYPE_SAT; rect.uHeight = 300; param.id = antset_cur_tuner; param.cur = SAT_IDX; break; case LNB_ID: list_type = POP_LIST_TYPE_LNB; rect.uHeight = 300; param.cur = LNB_IDX; break; case TP_ID: list_type = POP_LIST_TYPE_TP; rect.uHeight = 340; get_tuner_sat(antset_cur_tuner,SAT_IDX,&s_node); param.id = s_node.sat_id; param.cur = TP_IDX; break; case DISEQC10_ID: list_type = POP_LIST_TYPE_DISEQC10; rect.uHeight = 280; param.cur = DISEQC10_IDX; break; case DISEQC11_ID: list_type = POP_LIST_TYPE_DISEQC11; rect.uHeight = 240; param.cur = DISEQC11_IDX; break; case IF_CHANNEL_ID: list_type = POP_LIST_TYPE_IF_CHANNEL; rect.uHeight = 200; param.cur = IF_CHANNEL_IDX; break; case CENTRE_FREQ_ID: list_type = POP_LIST_TYPE_CENTRE_FREQ; rect.uHeight = 200; param.cur = CENTRE_FREQ_IDX; break; default: list_type = 0xFF; break; } if(list_type == 0xFF) break; cur_idx = win_com_open_sub_list(list_type,&rect,¶m); if(cur_idx == LIST_INVALID_SEL_IDX || cur_idx == param.cur) break; item = anesetf_items[bID - 1]; msel = anesetf_msels[bID - 1]; switch(bID) { case SAT_ID: SAT_IDX = cur_idx; OSD_TrackObject(item, C_DRAW_SIGN_EVN_FLG | C_UPDATE_ALL); win_atnsetf_load_sat_setting((UINT32)cur_idx, TRUE); break; case LNB_ID: LNB_IDX = cur_idx; OSD_TrackObject(item, C_DRAW_SIGN_EVN_FLG | C_UPDATE_ALL); win_atnsetf_load_22k_action(TRUE); #ifdef SUPPORT_UNICABLE if(win_unicable_setting_open(LNB_IDX)) OSD_TrackObject((POBJECT_HEAD)&g_win_antenna_set_fixed, C_DRAW_SIGN_EVN_FLG | C_UPDATE_ALL); #endif break; /* case TP_ID: TP_IDX = cur_idx; OSD_TrackObject(item, C_DRAW_SIGN_EVN_FLG | C_UPDATE_ALL); break; case DISEQC10_ID: DISEQC10_IDX = cur_idx; OSD_TrackObject(item, C_DRAW_SIGN_EVN_FLG | C_UPDATE_ALL); break; case DISEQC11_ID: DISEQC11_IDX = cur_idx; OSD_TrackObject(item, C_DRAW_SIGN_EVN_FLG | C_UPDATE_ALL); break; case IF_CHANNEL_ID: IF_CHANNEL_IDX= cur_idx; OSD_TrackObject(item, C_DRAW_SIGN_EVN_FLG | C_UPDATE_ALL); break; case CENTRE_FREQ_ID: CENTRE_FREQ_IDX= cur_idx; OSD_TrackObject(item, C_DRAW_SIGN_EVN_FLG | C_UPDATE_ALL); break; */ default: msel->nSel = cur_idx; OSD_TrackObject(item, C_DRAW_SIGN_EVN_FLG | C_UPDATE_ALL); break; } if(bID != SAT_ID && bID != TP_ID) win_atnsetf_modify_sat_setting(SAT_IDX); api_stop_timer(&set_frontend); set_frontend = api_start_timer("SETANT",500,(OSAL_T_TIMER_FUNC_PTR)atnsetf_set_frontend_handler); } break; } return ret; }