static UINT16 get_sat_idx_in_selected_sats2(UINT16 sat_cnt_selected) { S_NODE s_node; UINT16 sat_id; INT16 ant_set_sat_id=get_ant_set_sat_idx(); UINT16 i,sat_idx; get_tuner_sat(antset_cur_tuner, ant_set_sat_id,&s_node); sat_id=s_node.sat_id; for(i=0;i<sat_cnt_selected;i++) { get_sat_at(i/*sel*/,SET_SELECTED,&s_node); if(s_node.sat_id==sat_id) break; } sat_idx=i; if(sat_idx >= sat_cnt_selected) sat_idx = 0; return sat_idx; #if 0 #ifdef SUPPORT_TWO_TUNER { UINT16 Uni_str[50]; S_NODE s_node; for(i=0;i<sat_cnt;i++) { get_tuner_sat_name(2,i,Uni_str); get_sat_at(i/*sel*/,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)); if(s_node.reserve_1==antset_cur_tuner) break; #else //OSD_SetTextFieldContent(&satsrch_txt6_note , STRING_ID, (s_node.tuner1_valid ? RS_LNB1 : RS_LNB2)); if(((s_node.tuner1_valid)&&(antset_cur_tuner==0)) ||((s_node.tuner2_valid)&&(antset_cur_tuner==1))) break; #endif } } sat_idx=i; #endif #endif }
void change_group(INT32 shift) { UINT8 cur_group,max_group; UINT16 cur_channel,max_channel; UINT8 group_type, group_pos; S_NODE s_node; P_NODE p_node; UINT32 n; SYSTEM_DATA* sys_data; UINT8 cur_chan_mode; sys_data = sys_data_get(); max_group = sys_data_get_group_num(); cur_group = sys_data_get_cur_group_index(); cur_group = (cur_group + shift + max_group) % max_group; sys_data_set_cur_group_index(cur_group); sys_data_get_cur_mode_group_infor(cur_group, &group_type, &group_pos,&cur_channel); cur_chan_mode = sys_data_get_cur_chan_mode(); if(group_type==ALL_SATE_GROUP_TYPE) { PRINTF("========Change to ALL_SATE_GROUP_TYPE\n"); 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); PRINTF("========Change to SATE_GROUP_TYPE(%d,%s)\n",group_pos,s_node.sat_name); } else { PRINTF("========Change to FAV_GROUP_TYPE(%d)\n",group_pos); recreate_prog_view(VIEW_FAV_GROUP|cur_chan_mode,group_pos); } max_channel = get_prog_num(VIEW_ALL|cur_chan_mode,0); if(cur_channel>= max_channel) cur_channel = 0; n = 0; get_prog_at(cur_channel, &p_node); while( (p_node.skip_flag || (sys_data->chan_sw==CHAN_SWITCH_FREE && p_node.ca_mode) || (sys_data->chan_sw==CHAN_SWITCH_SCRAMBLED && !p_node.ca_mode) ) && n!=max_channel) { cur_channel = (cur_channel + 1 + max_channel) % max_channel; get_prog_at(cur_channel, &p_node); n++; }; api_play_channel(cur_channel, TRUE, TRUE,FALSE); }
static PRESULT factoryset_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 == IDC_CON5) { get_sat_at(sel,SET_SELECTED,&s_node); } break; case EVN_REQUEST_STRING: sel = param1; Uni_str= (UINT16*)param2; if(bID == IDC_CON5) { get_sat_name_factory(2,sel,Uni_str); sys_data_set_cur_satidx(sel); } 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; }
UINT16 recall_play_channel(UINT8 index) { UINT8 group_type,group_pos = 0; UINT8 cur_mode,new_mode,cur_group_idx,cur_group_type,cur_group_pos; UINT8 int_group_idx; UINT16 cur_channel,playing_channel; S_NODE s_node; P_NODE *pnode; BOOL exit = FALSE; INT32 n; UINT8 mode_changed; playing_channel= sys_data_get_cur_group_cur_mode_channel(); cur_group_idx = sys_data_get_cur_group_index(); sys_data_get_cur_mode_group_infor(cur_group_idx,&cur_group_type, &cur_group_pos, &cur_channel); index = 0; cur_mode = sys_data_get_cur_chan_mode(); if(cur_mode != recent_channels[index].mode) { sys_data_set_cur_chan_mode(recent_channels[index].mode); mode_changed = 1; } else mode_changed = 0; int_group_idx = recent_channels[index].internal_group_idx; if(int_group_idx==0) { group_type = ALL_SATE_GROUP_TYPE; group_pos = 0; } else if( int_group_idx<= MAX_SAT_NUM ) { group_type = SATE_GROUP_TYPE; group_pos = int_group_idx - 1; } else { group_type = FAV_GROUP_TYPE; group_pos = int_group_idx - 1 - MAX_SAT_NUM; } cur_group_idx = sys_data_get_cur_group_index(); new_mode = sys_data_get_cur_chan_mode(); //printf("%d,%d,%d\n",cur_group_type,cur_group_pos,cur_channel); if(mode_changed || group_type != cur_group_type || (group_pos!=cur_group_pos && group_type!=ALL_SATE_GROUP_TYPE)) { RECREATE_PROG_VIEW: if(group_type==ALL_SATE_GROUP_TYPE) recreate_prog_view(VIEW_ALL | new_mode, 0); else if(group_type==SATE_GROUP_TYPE) { if( get_sat_at(group_pos,VIEW_ALL,&s_node) != SUCCESS) return P_INVALID_ID; recreate_prog_view(VIEW_SINGLE_SAT|new_mode,s_node.sat_id); } else recreate_prog_view(VIEW_FAV_GROUP|new_mode,group_pos); if(exit) { //printf("No this group,exit to previous group,int_group_idx%d\n",int_group_idx); return P_INVALID_ID; } if( get_prog_num(VIEW_ALL | new_mode, 0) >0 ) sys_data_set_cur_intgroup_index(int_group_idx); else { exit = TRUE; group_type = cur_group_type; group_pos = cur_group_pos; new_mode = cur_mode; sys_data_set_cur_chan_mode(cur_mode); goto RECREATE_PROG_VIEW; } mode_changed = 1;// re-using this variable }else { mode_changed = 0;// re-using this variable } cur_mode = sys_data_get_cur_chan_mode(); //cur_channel = get_prog_pos(&recent_channels[index].p_node); pnode = &recent_channels[index].p_node; cur_channel = get_prog_pos(pnode->prog_id); n= get_prog_num(VIEW_ALL | cur_mode, 0); if(cur_channel>= n) { if(n>0) cur_channel = n - 1; /* else { exit = TRUE; group_type = cur_group_type; group_pos = cur_group_pos; sys_data_set_cur_chan_mode(cur_mode); goto RECREATE_PROG_VIEW; } */ } if(0 == mode_changed && playing_channel == cur_channel) { cur_channel = P_INVALID_ID; } return cur_channel; }
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 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 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 factoryset_btn_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2) { PRESULT ret = PROC_PASS; VACTION unact; UINT8 bID,back_saved; UINT32 chunk_id, default_db_addr, default_db_len; S_NODE s_node; bID = OSD_GetObjID(pObj); INT16 i,n; UINT8 back_saved1; UINT16 sat_id;//-a by wangyang 2011-11-03 for factory set del sat program win_popup_choice_t choice = WIN_POP_CHOICE_NO; switch(event) { case EVN_UNKNOWN_ACTION: unact = (VACTION)(param1>>16); if(unact == VACT_ENTER) { switch(bID) { case IDC_CON1: win_compopup_init(WIN_POPUP_TYPE_OKNO); win_compopup_set_msg(NULL, NULL, RS_DISPLAY_SURE_TO_DELETE); win_compopup_set_default_choice(WIN_POP_CHOICE_NO); choice = win_compopup_open_ext(&back_saved1); if(choice == WIN_POP_CHOICE_YES) { win_compopup_init(WIN_POPUP_TYPE_SMSG); win_compopup_set_msg(NULL,NULL, RS_MSG_SAVING_DATA); win_compopup_open_ext(&back_saved); chunk_id = 0x03FC0100; api_get_chuck_addlen(chunk_id, &default_db_addr, &default_db_len); set_default_value(DEFAULT_ALL_PROG,default_db_addr + 16); sys_data_factroy_init(); sys_data_set_cur_chan_mode(TV_CHAN); sys_data_save(TRUE); sys_data_load(); if(GetMuteState()) SetMuteOnOff(FALSE); if(GetPauseState()) SetPauseOnOff(FALSE); win_compopup_smsg_restoreback(); #ifdef LOGO_IN_RAM api_show_Test_logo_2(MM_tool3,get_logo_h_file_size(3)); #endif OSD_TrackObject( (POBJECT_HEAD) &g_win_mainmenu, C_UPDATE_ALL); wincom_open_subtitle((POBJECT_HEAD)&win_factoryset_con,RS_TOOLS_FACTORY_SETTING, 0); OSD_TrackObject( (POBJECT_HEAD) &win_factoryset_con, C_UPDATE_ALL); #if defined(ORDER_GZ1010010)||defined(ORDER_GZ1011005)||defined(ORDER_GZ1104005) system_config.tv_scan_mode = 0; #endif // Restart the unit after Factory Default in any case osal_task_sleep(1200); power_off_process(); power_on_process(); } break; case IDC_CON2: win_compopup_init(WIN_POPUP_TYPE_OKNO); win_compopup_set_msg(NULL, NULL, RS_DISPLAY_SURE_TO_DELETE); win_compopup_set_default_choice(WIN_POP_CHOICE_NO); choice = win_compopup_open_ext(&back_saved1); if(choice == WIN_POP_CHOICE_YES) { win_compopup_init(WIN_POPUP_TYPE_SMSG); win_compopup_set_msg(NULL,NULL, RS_MSG_SAVING_DATA); win_compopup_open_ext(&back_saved); osal_task_sleep(1500); si_monitor_off(0xFFFFFFFF); n = get_sat_num(VIEW_ALL); recreate_prog_view(VIEW_ALL | PROG_TV_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(); win_compopup_smsg_restoreback(); // Restart the unit after Factory Default in any case osal_task_sleep(1200); power_off_process(); power_on_process(); } break; case IDC_CON3: win_compopup_init(WIN_POPUP_TYPE_OKNO); win_compopup_set_msg(NULL, NULL, RS_DISPLAY_SURE_TO_DELETE); win_compopup_set_default_choice(WIN_POP_CHOICE_NO); choice = win_compopup_open_ext(&back_saved1); if(choice == WIN_POP_CHOICE_YES) { win_compopup_init(WIN_POPUP_TYPE_SMSG); win_compopup_set_msg(NULL,NULL, RS_MSG_SAVING_DATA); win_compopup_open_ext(&back_saved); osal_task_sleep(1500); si_monitor_off(0xFFFFFFFF); n = get_sat_num(VIEW_ALL); recreate_prog_view(VIEW_ALL | PROG_RADIO_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(); win_compopup_smsg_restoreback(); // Restart the unit after Factory Default in any case osal_task_sleep(1200); power_off_process(); power_on_process(); } break; case IDC_CON4: win_compopup_init(WIN_POPUP_TYPE_OKNO); win_compopup_set_msg(NULL, NULL, RS_DISPLAY_SURE_TO_DELETE); win_compopup_set_default_choice(WIN_POP_CHOICE_NO); choice = win_compopup_open_ext(&back_saved1); if(choice == WIN_POP_CHOICE_YES) { win_compopup_init(WIN_POPUP_TYPE_SMSG); win_compopup_set_msg(NULL,NULL, RS_MSG_SAVING_DATA); win_compopup_open_ext(&back_saved); sys_data_factroy_init(); sys_data_set_cur_chan_mode(TV_CHAN); sys_data_save(TRUE); sys_data_load(); win_compopup_smsg_restoreback(); #ifdef LOGO_IN_RAM api_show_Test_logo_2(MM_tool3,get_logo_h_file_size(3)); #endif OSD_TrackObject( (POBJECT_HEAD) &g_win_mainmenu, C_UPDATE_ALL); wincom_open_subtitle((POBJECT_HEAD)&win_factoryset_con,RS_TOOLS_FACTORY_SETTING, 0); OSD_TrackObject( (POBJECT_HEAD) &win_factoryset_con, C_UPDATE_ALL); // Restart the unit after Factory Default in any case osal_task_sleep(1200); power_off_process(); power_on_process(); } break; //-a by wangyang 2011-11-03 for factory set del sat program{{ case IDC_CON5: if(OSD_GetMultiselCount(&factoryset_sel5)==0) { win_compopup_init(WIN_POPUP_TYPE_SMSG); win_compopup_set_msg(NULL,NULL, RS_MSG_NO_CHANNELS); win_compopup_open_ext(&back_saved1); osal_task_sleep(1000); win_compopup_smsg_restoreback(); } else { sat_id=OSD_GetMultiselSel(&factoryset_sel5); win_compopup_init(WIN_POPUP_TYPE_OKNO); win_compopup_set_msg(NULL, NULL, RS_DISPLAY_SURE_TO_DELETE); win_compopup_set_default_choice(WIN_POP_CHOICE_NO); choice = win_compopup_open_ext(&back_saved1); if(choice == WIN_POP_CHOICE_YES) { // mm_enter_stop_mode(FALSE); // api_show_menu_logo(); if(api_is_playing_tv() || api_is_playing_radio()) { api_stop_play(1); } win_compopup_init(WIN_POPUP_TYPE_SMSG); win_compopup_set_msg(NULL,NULL, RS_MSG_SAVING_DATA); win_compopup_open_ext(&back_saved); osal_task_sleep(1500); si_monitor_off(0xFFFFFFFF); //n = get_sat_num(VIEW_ALL); recreate_prog_view(VIEW_ALL | PROG_TVRADIO_MODE,0); //for(i=0;i<n;i++) { get_sat_at(sat_id, SET_SELECTED,&s_node); del_child_prog(TYPE_SAT_NODE, s_node.sat_id); } update_data(); sys_data_check_channel_groups(); win_compopup_smsg_restoreback(); // Restart the unit after Factory Default in any case osal_task_sleep(1200); power_off_process(); power_on_process(); } } break; //-a by wangyang 2011-11-03 for factory set del sat program}} default: break; } } 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 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); }
static PRESULT factoryset_btn_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2) { PRESULT ret = PROC_PASS; VACTION unact; UINT8 bID,back_saved; S_NODE s_node; P_NODE p_node; T_NODE t_node; bID = OSD_GetObjID(pObj); INT16 i=0; INT16 n =0; UINT16 prog_num =0; UINT8 av_flag = 0; switch(event) { case EVN_UNKNOWN_ACTION: unact = (VACTION)(param1>>16); if(unact == VACT_ENTER) { switch(bID) { case IDC_CON1: win_compopup_init(WIN_POPUP_TYPE_SMSG); win_compopup_set_msg(NULL,NULL, RS_MSG_SAVING_DATA); win_compopup_open_ext(&back_saved); osal_task_sleep(1500); si_monitor_off(0xFFFFFFFF); n = get_sat_num(VIEW_ALL); recreate_prog_view(VIEW_ALL | PROG_TV_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(); win_compopup_smsg_restoreback(); break; case IDC_CON2: win_compopup_init(WIN_POPUP_TYPE_SMSG); win_compopup_set_msg(NULL,NULL, RS_MSG_SAVING_DATA); win_compopup_open_ext(&back_saved); osal_task_sleep(1500); si_monitor_off(0xFFFFFFFF); n = get_sat_num(VIEW_ALL); recreate_prog_view(VIEW_ALL | PROG_RADIO_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(); win_compopup_smsg_restoreback(); break; case IDC_CON3: win_compopup_init(WIN_POPUP_TYPE_SMSG); win_compopup_set_msg(NULL,NULL, RS_MSG_SAVING_DATA); win_compopup_open_ext(&back_saved); osal_task_sleep(1500); sort_prog_node(PROG_FTA_SORT); av_flag = sys_data_get_cur_chan_mode(); prog_num = get_prog_num(VIEW_ALL | av_flag, 0); libc_printf("prog_num11111111==%d\n",prog_num); for(i=prog_num-1;i>=0;i--) { get_prog_at(i,&p_node); get_tp_by_id(p_node.tp_id, &t_node); get_sat_by_id(t_node.sat_id, &s_node); if(p_node.ca_mode == 0) { libc_printf("iiiiiiiiiiiiiiiiii====%d\n",i); del_prog_at((UINT16)i); } } update_data(); sys_data_check_channel_groups(); win_compopup_smsg_restoreback(); break; case IDC_CON4: win_compopup_init(WIN_POPUP_TYPE_SMSG); win_compopup_set_msg(NULL,NULL, RS_MSG_SAVING_DATA); win_compopup_open_ext(&back_saved); osal_task_sleep(1500); sort_prog_node(PROG_FTA_SORT_EXT); av_flag = sys_data_get_cur_chan_mode(); prog_num = get_prog_num(VIEW_ALL | av_flag, 0); libc_printf("prog_num222222222==%d\n",prog_num); for(i=prog_num-1;i>=0;i--) { get_prog_at(i,&p_node); get_tp_by_id(p_node.tp_id, &t_node); get_sat_by_id(t_node.sat_id, &s_node); if(p_node.ca_mode) { libc_printf("i===============%d\n",i); del_prog_at((UINT16)i); } } update_data(); sys_data_check_channel_groups(); win_compopup_smsg_restoreback(); break; default: break; } } break; } return ret; }
static PRESULT editchannel_con_item_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2) { PRESULT ret = PROC_PASS; UINT8 unact; UINT8 id = OSD_GetObjID(pObj) + sub_menu_desc->list_top; UINT8 back_saved; INT16 i,n,parent_id; S_NODE s_node; TIMER_SET_CONTENT* timer; SYSTEM_DATA* sys_data; switch(event) { case EVN_UNKNOWN_ACTION: unact = (VACTION)(param1>>16) ; if(unact == VACT_ENTER) { if(unact == VACT_ENTER) { if(id == CHLIST_DELETE_ALL_CHAN_ID) { //if(win_pwd_open(NULL,0)) { win_compopup_init(WIN_POPUP_TYPE_OKNO); win_compopup_set_msg(NULL,NULL,RS_POPUP_WARNING_DELETE_ALL_CHANNEL); win_compopup_set_default_choice(WIN_POP_CHOICE_NO); ret = win_compopup_open_ext(&back_saved); if(ret==WIN_POP_CHOICE_YES) { #ifdef NEW_DEMO_FRAME si_monitor_off(0xFFFFFFFF); #endif n = get_sat_num(VIEW_ALL); 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(); /*turn off all timer*/ sys_data = sys_data_get(); for(i=0;i<MAX_TIMER_NUM;i++) { timer = &sys_data->timer_set.TimerContent[i]; timer->timer_mode = TIMER_MODE_OFF; } ret = PROC_LEAVE; key_pan_display("noCH", 4); } } } else { enter_sub_menu(editchannel_sub_menus,id - 1); ret = PROC_LOOP; } } } } return ret; }