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

📄 auiwap.c

📁 是一个手机功能的模拟程序
💻 C
📖 第 1 页 / 共 5 页
字号:
				information to WAP gateway)
				SPR#1574 - SH - Added parameter so dialog can show different messages.
				Currently, shows "Connecting..." message when GPRS is attaching, followed
				by "Logging on".
 
 $Returns:		Window handler

 $Arguments:	win		- pointer to the WAP data window
 
*******************************************************************************/

//T_MFW_HND AUI_connecting_dialog (T_MFW_HND win, ULONG status)
static int AUI_connecting_dialog (T_MFW_HND win, ULONG status)	  //zhaowm 2003/1/11
{
	T_MFW_WIN           *win_data   = ((T_MFW_HDR *)win)->data;
	T_WAP_DATA          *data       = (T_WAP_DATA *)win_data->user;				// WAP data
	T_DISPLAY_DATA      display_info;

#ifdef TRACE_AUIWAP		
	WAP_TRACE_EVENT(("AUI_connecting_dialog: %d",status) );
#endif

	switch (status)
	{
	case ATB_WAP_LOGGING_IN:
		//dlg_initDisplayData_TextId( &display_info, TxtNull, TxtCancel,TxtLoggingIn , TxtNull);/*2003/12/13, wangyan modify*/
		dialog_info_init(&display_info);
		display_info.RightSoftKey=TxtCancel;
		display_info.TextId         = TxtLoggingIn;
		display_info.TextString2    = data->View->Profile->Title;			// Show Profile name
		break;

	case ATB_WAP_ATTACHING:
		//dlg_initDisplayData_TextId( &display_info, TxtNull, TxtCancel,TxtConnecting , TxtNull);
		dialog_info_init(&display_info);
		display_info.RightSoftKey=TxtCancel;
		display_info.TextId         = TxtConnecting;
		display_info.TextString2    = data->View->Profile->Title;			// Show Profile name
		break;

	case ATB_WAP_CARD_READING:
		//dlg_initDisplayData_TextId( &display_info, TxtNull, TxtCancel,TxtDownloading , TxtNull);
		dialog_info_init(&display_info);
		display_info.RightSoftKey=TxtCancel;
		display_info.TextId         = TxtDownloading;
		display_info.TextString2    = data->View->Title;			// Show name of card being read
		break;

	case ATB_WAP_CONNECTING:
		//dlg_initDisplayData_TextId( &display_info, TxtNull, TxtCancel,TxtLoggingIn , TxtNull);
		dialog_info_init(&display_info);
		display_info.RightSoftKey=TxtCancel;
		display_info.TextId         = TxtLoggingIn;
		display_info.TextString2    = data->View->Profile->Title;			// Show Profile name
		break;

	case ATB_WAP_PLEASE_WAIT:
	default:
		//dlg_initDisplayData_TextId(&display_info, TxtNull, TxtCancel,TxtNull , TxtPleaseWait);
		dialog_info_init(&display_info);
		display_info.RightSoftKey=TxtCancel;
		display_info.TextId2        = TxtPleaseWait;
		break;
	}

	/* Destroy any previous dialog */

	AUI_destroy(data->win, CONNECT_WIN);

	/* Create new dialog */
	display_info.Callback= (T_VOID_FUNC)AUI_connecting_dialog_cb;
	display_info.Time           = FOREVER;
	display_info.KeyEvents=KEY_CLEAR | KEY_RIGHT;

//	dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)AUI_connecting_dialog_cb, FOREVER, KEY_CLEAR | KEY_RIGHT );
	display_info.iconindex      = REMIND_WAP;
	data->connect_win           = info_dialog(win, &display_info);
	/* Create new dialog */
	//dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)AUI_connecting_dialog_cb, FOREVER, KEY_CLEAR | KEY_RIGHT );

	//return info_dialog(win, &display_info);
	return 1;

}


/*******************************************************************************

 $Function:    	AUI_connecting_dialog_cb

 $Description:	Callback function for connecting dialog
 
 $Returns:		void

 $Arguments:	win			- pointer to the WAP data window
				identifier	- identifies function that has called callback
				reason		- reason for callback
 
*******************************************************************************/

void AUI_connecting_dialog_cb (T_MFW_HND win, UBYTE identifier, UBYTE reason)
{
	T_MFW_WIN   *win_data   = ((T_MFW_HDR *)win)->data;
	T_WAP_DATA  *data       = (T_WAP_DATA *)win_data->user;						// WAP data

#ifdef TRACE_AUIWAP
	TRACE_FUNCTION("AUI_connecting_dialog_cb");
#endif

	/* SPR#1739 - SH - This should be set to NULL in all cases */

	data->connect_win = NULL;
	switch (reason)
	{
	case INFO_KCD_HUP:
	case INFO_KCD_RIGHT:													// "Cancel" exits WAP
		/* SPR#1189 - SH - If browser is active, completely exit WAP.
		 * Otherwise, just return to last menu. */

		if (data->browser_win)
		{
			AUI_destroy(win, ALL_WIN);
		}
		else
		{
			/* Cancel any pending operation */
			ATB_wap_stop_download(data->View);
			/* End the call */
			AUI_end_call();
			/* Indicate we're no longer connected */
			ATB_wap_status_change(data->View, ATB_WAP_ONLINE_CONNECTION_CLOSED);
		}
		break;

	default:
		break;
	}
	return;
}


/*******************************************************************************

 $Function:    	AUI_connect_URL

 $Description:	Connects to WAP gateway (if required) and starts to download URL
 
 $Returns:		void

 $Arguments:	win		- pointer to the WAP data window
				URL		- URL to connect to
 
*******************************************************************************/

void AUI_connect_URL (T_MFW_HND win, char *URL)
{
	T_MFW_WIN   *win_data       = ((T_MFW_HDR *)win)->data;
	T_WAP_DATA  *data           = (T_WAP_DATA *)win_data->user;					// WAP data
	T_WAP_VIEW  *View               = data->View;
	T_MMI_WAP_DOWNLOAD_URL_IND              DownloadURL;

#ifdef TRACE_AUIWAP
	TRACE_FUNCTION("AUI_connect_URL");
#endif

	/* SPR#1739 - SH - If the browser is already visible, we can destroy the other windows */

	if (data->browser_win)
	{
		AUI_destroy(data->win, LIST_WIN | MENU_WIN | OPTIONSMENU_WIN | EDIT_WIN | OPTIONS_WIN | OTHER_MENU_WIN);
	}

	/* Display "Please Wait" to cover delay until call dialog is displayed */
	/* SPR#1739 - SH - Only display "Please Wait" if browser window is
	   not open. */

	if (!data->browser_win || !data->connected)
	{
		ATB_wap_status_change(data->View, ATB_WAP_PLEASE_WAIT);
	}
	if (!data->connected)													// If we're not already connected
	{
		ATB_wap_profile_send(View);											// Send configuration data
	}

	strcpy(View->URL, URL);													// Store URL

	// Send event requesting URL download

	DownloadURL.object_id = View->object_id;
	DownloadURL.url_length = strlen(URL)+1;									// Include final NULL
	DownloadURL.Url = URL;
	DownloadURL.reload = TRUE;												// Do not fetch from cache
	ATB_wap_download_url(&DownloadURL);										// Tell ATB to download URL

	/* Destroy some windows for now; we want to return to the list win
	 * if the connection is cancelled */

	AUI_destroy(data->win, OPTIONS_WIN | EDIT_WIN);						/* SPR#1189 - SH - Now only destroy options & edit windows */

	return;
}


/*******************************************************************************

 $Function:    	AUI_win_create

 $Description:	Create the WAP card browser window
 
 $Returns:		void

 $Arguments:	parent_win			- Pointer to the WAP data window

*******************************************************************************/

T_MFW_HND AUI_win_create (T_MFW_HND parent_win)
{
	T_MFW_WIN           *win_data;
	T_WAP_BROWSER       *data = (T_WAP_BROWSER *)AUI_wap_memory_alloc(sizeof(T_WAP_BROWSER));	// WAP browser data

#ifdef TRACE_AUIWAP
	TRACE_FUNCTION("AUI_win_create");
#endif

	data->win = win_create(parent_win,0,E_WIN_VISIBLE, (T_MFW_CB)AUI_win_cb);	// Create the browser window

	// Create keyboard handler
	data->kbd       = kbd_create (data->win, KEY_ALL, (T_MFW_CB)AUI_kbd_cb);
	data->kbd_long  = kbd_create (data->win, KEY_ALL|KEY_LONG, (T_MFW_CB)AUI_kbd_long_cb);

	// Create window handler

	data->mmi_control.dialog    = (T_DIALOG_FUNC)AUI_win_control;
	data->mmi_control.data      = (void *)data;
	data->parent_win            = parent_win;
	win_data                    = ((T_MFW_HDR *)data->win)->data;
	win_data->user              = (void *)data;									// Attach browser data to window

	return data->win;
}


/*******************************************************************************

 $Function:    	AUI_win_destroy

 $Description:	Destroy the WAP card browser window
 
 $Returns:		void

 $Arguments:	win				- Pointer to the WAP browser window

*******************************************************************************/

int AUI_win_destroy (T_MFW_HND win)
{

	T_MFW_WIN           *win_data   = ((T_MFW_HDR *)win)->data;
	T_WAP_BROWSER       *data       = (T_WAP_BROWSER *)win_data->user;			// WAP browser data

#ifdef TRACE_AUIWAP
	TRACE_FUNCTION("AUI_win_destroy");
#endif

	kbd_delete(data->kbd);														// Delete keyboard handlers
	kbd_delete(data->kbd_long);

	win_delete(win);															// Delete window
	AUI_wap_memory_free((UBYTE *)data, sizeof(T_WAP_BROWSER));					// Destroy data structure

	return 1;
}


/*******************************************************************************

 $Function:    	AUI_win_control

 $Description:	Dialog function for WAP Browser window
 
 $Returns:		void

 $Arguments:	win			- WAP card browser window
				event		- Window handle event
				value		- not used
				parameter	- not used

*******************************************************************************/

void AUI_win_control (T_MFW_HND win, USHORT event, SHORT value, void * parameter)
{
	T_MFW_WIN       *win_data           = ((T_MFW_HDR *)win)->data;
	T_WAP_BROWSER   *data               = (T_WAP_BROWSER *)win_data->user;		// WAP Browser data

#ifdef TRACE_AUIWAP
	TRACE_FUNCTION("AUI_win_control");
#endif

	switch (event)
	{
	case WAP_INIT:															// Currently does nothing
		break;

	case WAP_SHOW_CARD:														// Show the current card
		data->TextId1       = NULL;
		data->TextId2       = NULL;
		data->TextString1   = NULL;
		data->TextString2   = NULL;
		win_show(win);
		break;
	}
	return;
}


/*******************************************************************************

 $Function:    	AUI_win_cb

 $Description:	Callback function for browser window
 
 $Returns:		void

 $Arguments:	event		- window handle event
				win			- WAP browser window
				
*******************************************************************************/

static int AUI_win_cb (T_MFW_EVENT event, T_MFW_WIN * win)
{
	T_WAP_BROWSER   *BrowserData    = (T_WAP_BROWSER *)win->user;				// WAP browser data
	T_MFW_HND       parent_win      = BrowserData->parent_win;
	T_MFW_WIN       *win_data       = ((T_MFW_HDR *)parent_win)->data;
	T_WAP_DATA      *data           = (T_WAP_DATA *)win_data->user;				// WAP data
	char            *LeftSoftKey;
	char            *RightSoftKey;

#ifdef TRACE_AUIWAP
	TRACE_FUNCTION("AUI_win_cb");
#endif

	if (data==NULL)
		return NULL;
	if (optiongoback)	  //2002.12.12 zhaowm for temp
	{
		if (data->update_forbid)
			return NULL;
	}
	optiongoback = 0; 
	switch (event)
	{
	case E_WIN_VISIBLE:
		if (win->flags & E_WIN_VISIBLE)
		{
			dspl_ClearAll();												// Clear the browser are
			ATB_wap_buffer_display(data->View);								// Display the buffered page


			/* SPR#1575 - SH - Display "Cancel" when downloading or reading in a card */
			if (ATB_wap_status_get(data->View, ATB_WAP_DOWNLOADING)
				|| ATB_wap_status_get(data->View, ATB_WAP_CARD_READING))
			{
				displaySoftKeys(TxtNull, TxtCancel);
				//displaySoftKeys(TxtNull, TxtSoftOptions);
			}
			else
			{
				if (data->View->CustSoftKeys)
					displaySoftKeys(TxtSoftOptions, Txtfunction);	// Show customised keys
				else
					//	{
					/*
					if (data->View->CanGoBack)
						displaySoftKeys(TxtSoftOptions, TxtSoftBack);		// Show "options" and "back"
					else
						displaySoftKeys(TxtSoftOptions, TxtNull);			// Only show "options" if we can't go back
					*/
					displaySoftKeys(TxtSoftSelect, Txtfunction);			//zhaowm 2002/10/21 using leftsoftkey go to the next URL
				//displaySoftKeys(TxtSoftSelect, TxtSoftOptions);			//zhaowm 2002/10/21 using leftsoftkey go to the next URL
				//	}
			}
		}
		break;

	default:
		return 0;
	}
	return 1;
}



/*******************************************************************************

 $Function:    	AUI_kbd_cb

 $Description:	Keyboard event handler for browser window

 $Returns:		status int

 $Arguments:	event			- window handle event
				keyboard		- keyboard control block

*******************************************************************************/

static int AUI_kbd_cb (T_MFW_EVENT event, T_MFW_KBD *keyboard)
{   
	T_MFW_HND       win                 = mfwParent( mfw_header());				// parent_win = WAP menu window
	T_MFW_WIN       *win_data           = ((T_MFW_HDR *)win)->data;
	T_WAP_BROWSER   *BrowserData        = (T_WAP_BROWSER *)win_data->user;		// WAP browser data
	T_MFW_HND       parent_win          = BrowserData->parent_win;
	T_MFW_WIN       *parent_win_data    = ((T_MFW_HDR *)parent_win)->data;
	T_WAP_DATA      *data               = (T_WAP_DATA *)parent_win_data->user;	// WAP data
	T_WAP_VIEW      *View               = data->View;

⌨️ 快捷键说明

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