⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mosaic_ui.c

📁 c语言编的
💻 C
📖 第 1 页 / 共 5 页
字号:
			}/*end of the while-loop*/
		}
		else
			return error;
	}	
	if(current_active_cell_info->cell_possible_link.action_type == 0x01)
	{
		/*select the program linked the cell*/
		network_index = db_get_current_network_index();
		on_id = current_active_cell_info->cell_possible_link.possible_cell_link.service_data.link_on_id;
		ts_id = current_active_cell_info->cell_possible_link.possible_cell_link.service_data.link_ts_id;
		service_id = current_active_cell_info->cell_possible_link.possible_cell_link.service_data.link_service_id;
		
		error = db_query_service_by_ids(global_db_client/*ss_control->db_client*/, 
										&db_service, 
										network_index,
										on_id,
										ts_id,
										service_id);
		if(error != SUCCESS)
		{
			APP_TRACE("\n no this network_index[%d], on[%d], ts[%d], service[%d] in the data base", 
			          network_index,
					  on_id,
					  ts_id,
					  service_id);
			return error;
		}
		error = mosaic_app_exit(current_active_cell_info);
		APP_TRACE("\n mosaic_test_exit \n");/**/
		
		APP_TRACE("on_id=[%d], ts_id=[%d], service_id=[%d]\n",on_id, ts_id, service_id);
		
		sprintf(buffer, 
				"net%d://%d.%d.%d -m",
				network_index, 
				on_id, 
				ts_id, 
				service_id);
				
		APP_TRACE(buffer);
		APP_TRACE("\n");
		
		message.event = EV_SYS_EXIT_AND_SELECT_SERVICE;
		strcpy((char *)message.private, buffer);
		app_exit_with_message(&message);
	}
	
	if(current_active_cell_info->cell_possible_link.action_type == 0x02)
	{
		/*select the application linked the cell "not complete"*/
		APP_TRACE("select the application linked the cell\n");
		
		org_id = current_active_cell_info->cell_possible_link.possible_cell_link.app_data.link_org_id;
		app_id = current_active_cell_info->cell_possible_link.possible_cell_link.app_data.link_app_id;
		
		message.event = EV_SYS_KEYBOARD;
		if(org_id == 0x4D)/*BGCTV private*/
		{
			if(app_id == 0x02)/*EPG*/
			{
				message.wparam = VK_EPG;
			}
			if(app_id == 0x03)/*stock*/
			{
				/*there is no the app of this cell linked
				ms_error_dialog(res_string(RES_STRING_USER_NO_RIGHT));*/
				
				error = mosaic_app_exit(current_active_cell_info);
				
				message.event = EV_SYS_EXIT_AND_START_APPLICATION;
				strcpy((char *)message.private, "stock");
				app_exit_with_message(&message);
				
				return error;
			}
			if(app_id == 0x04)/*NVOD*/
			{
				message.wparam = VK_NVOD;
			}
			if(app_id == 0x05)/*games*/
			{
				error = mosaic_app_exit(current_active_cell_info);
				
				message.event = EV_SYS_EXIT_AND_START_APPLICATION;
				strcpy((char *)message.private, "games");
				app_exit_with_message(&message);
			}
			if(app_id == 0x09)/*system setting*/
			{
				message.wparam = VK_MENU;
			}
			error = mosaic_app_exit(current_active_cell_info);
			app_exit_with_message(&message);
		}
		
		error = db_find_app(org_id, app_id, &ait_info);
		if(error == ERROR_MOSAIC_CELL_NO_APP)
		{
			/*there is no the app of this cell linked*/
			ms_error_dialog(res_string(RES_STRING_USER_NO_RIGHT));
			return error;
		}
		
		service_type = ait_info.service_type;		
		on_id = ait_info.original_network_id;
		ts_id = ait_info.transport_stream_id;
		service_id = ait_info.service_id;
		network_index = db_get_current_network_index();
		
		/*app_mem_deallocate(ait_info);*/
		
		APP_TRACE("the purpose application is org_id=[%lx],app_id=[%lx],service_type[%1x]\n", 
				  org_id, app_id, service_type);
		switch(service_type)
		{			
			case BGCTV_CHANGHONG_STOCK_SERVICE_TYPE:		/*0xf0*/
				
				break;
			
			case BGCTV_HTML_BROWSER_SERVICE_TYPE:			/*0xf1*/
				
				error = mosaic_app_exit(current_active_cell_info);
				
				sprintf(buffer, 
						"net%d://%d.%d.%d",
						network_index, 
						on_id, 
						ts_id, 
						service_id);
				message.event = EV_SYS_EXIT_AND_SELECT_SERVICE;
				strcpy((char *)message.private, buffer);
				app_exit_with_message(&message);
				break;
			
			case BGCTV_CANAL_PLUS_GAME_SERVICE_TYPE:		/*0xf2*/
				
				break;
			
			case BGCTV_BGCTV_GAME_SERVICE_TYPE:			    /*0xf3*/
				
				error = mosaic_app_exit(current_active_cell_info);
				
				message.event = EV_SYS_EXIT_AND_START_APPLICATION;
				strcpy((char *)message.private, "games");
				app_exit_with_message(&message);
				break;
			
			case BGCTV_EPG_SERVICE_TYPE:					/*0xf4*/
				message.wparam = VK_EPG;
				break;
			
			case BGCTV_SYSTEM_SETTING_SERVICE_TYPE:		    /*0xf5*/
				message.wparam = VK_MENU;
				break;
			
			case BGCTV_NVOD_SERVICE_TYPE:					/*0xf6*/
				message.wparam = VK_NVOD;
				break;			
			
			case BGCTV_SOFTWARE_UPGRADE_SERVICE_TYPE:		/*0xf7*/
				break;
		}
		error = mosaic_app_exit(current_active_cell_info);
		app_exit_with_message(&message);
	}
	return SUCCESS;
}


error_t ms_display_current_page_info(page_node_t *tag_page_node)
{
	uint8_t h_alignment, v_alignment, f_color, b_color;
	ui_rect_t rect;
	int16_t i;
	
	time_date_t ms_current_time;
	char current_date_str[30];
	char current_time_str[30];
	
	info_dis_area_data_t *tag_info_area;
	
	error_t error;
	
	for(i=0;i<(tag_page_node->page_data ->info_dis_area_num);i++)
	{
		APP_TRACE("\n ***** the page info_dis_area_num [%d] info_type in this page is [%d]", 
		          tag_page_node->page_data ->info_dis_area_num,
		          tag_page_node -> page_data -> info_position[ i ].dis_type);
		
		error = ms_find_info_area(tag_page_node -> page_data -> info_position[i].data_list,
			                      &tag_info_area);
		
		if(error != SUCCESS)
				break;
		
		if(tag_page_node -> page_data -> info_position[ i ].dis_type == 0x01)
		{
			/* display the current date on the screen */			
			if((tag_info_area->default_mask & 0x80 )== 0)
			{
				rect.x = tag_info_area->text_frame.x;
				rect.y = tag_info_area->text_frame.y;
				rect.w = tag_info_area->text_frame.w;
				rect.h = tag_info_area->text_frame.h;
				
				/*adjust the h min-size to 24 */
				if(rect.h < 24)
					rect.h = 24;
				
				ms_ui_clear_area(rect.x, rect.y, rect.w, rect.h);
				
				h_alignment = ms_get_display_alignment(tag_info_area->text_frame.h_alignment);
				v_alignment = ms_get_display_alignment(tag_info_area->text_frame.v_alignment);
				
				error = sys_get_current_time ( &ms_current_time );
				if( error != SUCCESS )
				{
					DB_TRACE("[DTV], fail to get current time!\n");
					return error;
				}
				
				memset( current_date_str, 0, 30 );
				sprintf( current_date_str, "%2d/%02d", 
			             /*ms_current_time . tm_year + 1900,*/
				         ms_current_time . tm_mon + 1,
					     ms_current_time . tm_mday);
				
				f_color = mosaic_get_color_index(tag_info_area->text_frame.foreground_color);
				b_color = mosaic_get_color_index(tag_info_area->text_frame.background_color);
				
				ms_STWTK_DynamicTextInRect(hitune_ui_draw_get_context(), 
				                        rect.x, 
				                        rect.y, 
				                        rect.w, 
				                        rect.h, 
				                        current_date_str, 
							            0, 0, 
							            h_alignment, v_alignment,
							            f_color/*UI_WHITE_COLOR*/,
	                        			b_color/*UI_TRANSPARENCY_COLOR*/);
			
			}
		}
		if(tag_page_node -> page_data -> info_position[ i ].dis_type == 0x02)
		{
			/* display the current time on the screen */			
			rect.x = tag_info_area->text_frame.x;
			rect.y = tag_info_area->text_frame.y;
			rect.w = tag_info_area->text_frame.w;
			rect.h = tag_info_area->text_frame.h;
			
			/*adjust the h min-size to 24 */
			if(rect.h < 24)
				rect.h = 24;
			
			ms_ui_clear_area(rect.x, rect.y, rect.w, rect.h);
			
			h_alignment = ms_get_display_alignment(tag_info_area->text_frame.h_alignment);
			v_alignment = ms_get_display_alignment(tag_info_area->text_frame.v_alignment);
			
			error = sys_get_current_time ( &ms_current_time );
			if( error != SUCCESS )
			{
				DB_TRACE("[DTV], fail to get current time!\n");
				return error;
			}
			
			memset( current_time_str, 0, 30 );
			sprintf(current_time_str, "%02d:%02d", 
				    ms_current_time . tm_hour, 
				    ms_current_time . tm_min );
			
			f_color = mosaic_get_color_index(tag_info_area->text_frame.foreground_color);
			b_color = mosaic_get_color_index(tag_info_area->text_frame.background_color);
			
			ms_STWTK_DynamicTextInRect(hitune_ui_draw_get_context(), 
			                        rect.x, 
			                        rect.y, 
			                        rect.w, 
			                        rect.h, 
			                        current_time_str, 
						            0, 0, 
						            h_alignment, v_alignment,
						            f_color,
	                        		b_color);
		
		}
	}/* end of the for-loop */
	return SUCCESS;
}


error_t ms_display_current_cell_info(cell_data_t *current_active_cell_info)
{
	int32_t logical_channel_number;
	service_t cell_link_servcie;
	
	db_service_t db_service;
	char *service_name = NULL;
	page_node_t *tag_page_node;
	page_node_ident_t page_node_identify;
	int16_t i = 0;
	ui_rect_t rect;
	uint8_t h_alignment, v_alignment, f_color, b_color;
	error_t error;
	
	info_dis_area_data_t *tag_info_area;
	char buffer[128];
	
	page_node_identify.page_id = current_active_cell_info -> page_id;
	error = mosaic_find_page_node(mosaic_tree_data_t,
    	       					  page_node_identify,
        	                      &tag_page_node);	
	
	for(i=0;i<(tag_page_node->page_data ->info_dis_area_num);i++)
	{
		error = ms_find_info_area(tag_page_node -> page_data -> info_position[ i ].data_list,
		                          &tag_info_area);
		
		if(error != SUCCESS)
				break;
		
		if(tag_page_node -> page_data -> info_position[ i ].dis_type == 0x03)
		{   
			/* 
			 * display the current service name on the screen 
			 */
			if((tag_info_area->default_mask & 0x80 )== 0)
			{
				rect.x = tag_info_area->text_frame.x;
				rect.y = tag_info_area->text_frame.y;
				rect.w = tag_info_area->text_frame.w;
				rect.h = tag_info_area->text_frame.h;
				
				/*adjust the h min-size to 24 */
				if(rect.h < 24)
					rect.h = 24;									
	
				/*if(current_active_cell_info -> cell_possible_link.action_type == 0x01)*/
				if((current_active_cell_info->activation_mask & 0x04) == 0x04)
				{
					cell_link_servcie.network_index = db_get_current_network_index(); 
					cell_link_servcie.original_network_id = current_active_cell_info->eit_ifo_data.link_on_id;
					cell_link_servcie.transport_stream_id = current_active_cell_info->eit_ifo_data.link_ts_id;
					cell_link_servcie.service_id = current_active_cell_info->eit_ifo_data.link_service_id;
					/* get service info from database */
					error = db_query_service_by_ids(global_db_client/*ss_control->db_client*/, 
													&db_service, 
													cell_link_servcie.network_index,
													cell_link_servcie.original_network_id,
													cell_link_servcie.transport_stream_id,
													cell_link_servcie.service_id);
				    if((error == SUCCESS)/*&&(service_name != NULL)*/)
				    {
						service_name = mstring_value(&(db_service.service_name));
						logical_channel_number = db_service.bgctv_logical_channel_number;
						
						sprintf(buffer,
								"%03d  %s",
								logical_channel_number,
								service_name);
					}
					else
					{
						error = ms_get_service_cell_name(cell_link_servcie, &service_name);
						
						sprintf(buffer,
								"%s",								
								service_name);
					}
					APP_TRACE("\nthe current cell service name is [%s]\n",
					          service_name);
										
					h_alignment = ms_get_display_alignment(tag_info_area->text_frame.h_alignment);
					v_alignment = ms_get_display_alignment(tag_info_area->text_frame.v_alignment);
					
					f_color = mosaic_get_color_index(tag_info_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -