/* Change group index */ INT32 sys_data_change_group(UINT8 group_idx) { UINT8 group_type, group_pos; S_NODE s_node; UINT16 cur_channel; SYSTEM_DATA * psys_data = sys_data_get(); BOOL b = sys_data_get_cur_mode_group_infor(group_idx, &group_type, &group_pos, &cur_channel); if (b) { if (group_type == ALL_GROUP_TYPE) { sys_data_set_cur_intgroup_index(0); return recreate_prog_view(VIEW_ALL | CUR_CHAN_MODE, 0); } else if (group_type == DATA_GROUP_TYPE) { sys_data_set_cur_intgroup_index(group_pos); return recreate_prog_view(VIEW_ALL|PROG_DATA_MODE , 0); SYS_PRINTF("========Change to DATA_GROUP_TYPE(%d)\n", group_pos); } else if (group_type == NVOD_GROUP_TYPE) { sys_data_set_cur_intgroup_index(group_pos); return recreate_prog_view(VIEW_ALL | PROG_NVOD_MODE, 0); SYS_PRINTF("========Change to NVOD_GROUP_TYPE(%d)\n", group_pos); } else if (group_type == LOCAL_GROUP_TYPE) { /*we change to the specified local group*/ sys_data_set_cur_intgroup_index(group_pos); return recreate_prog_view(VIEW_BOUQUIT_ID|CUR_CHAN_MODE, psys_data->local_group_id[group_pos-1]); SYS_PRINTF("========Change to LOCAL_GROUP_TYPE(%d,%s)\n", group_pos-1, psys_data->local_group_name[group_pos-1]); } else if (group_type == FAV_GROUP_TYPE) { sys_data_set_cur_intgroup_index(group_pos); return recreate_prog_view(VIEW_FAV_GROUP | CUR_CHAN_MODE, group_pos-MAX_GROUP_NUM); } } else { sys_data_set_cur_intgroup_index(0); return recreate_prog_view(VIEW_ALL|CUR_CHAN_MODE,0); } return E_FAILURE; }
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; }