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

📄 auiwap.c

📁 GSM手机设计软件代码
💻 C
📖 第 1 页 / 共 5 页
字号:
	return data->win;
}


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

 $Function:    	AUI_wap_data

 $Description:	Returns the WAP data pointer
 
 $Returns:		Pointer to WAP data

 $Arguments:	None
 
*******************************************************************************/

T_WAP_DATA *AUI_wap_data (void)
{
	T_MFW_WIN *win_data;
	T_WAP_DATA *data;

	if (wap_main_window==NULL)
	{
		TRACE_EVENT("** WAP not active **");
		return NULL;
	}

	win_data	= ((T_MFW_HDR *)wap_main_window)->data;
	data		= (T_WAP_DATA *)win_data->user;	

	return data;
}


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

 $Function:    	AUI_destroy

 $Description:	Destroys the specified WAP windows and their data
 
 $Returns:		void

 $Arguments:	win			- pointer to the browser window
 				windows		- determines which windows will be destroyed.
 				(e.g. LIST_WIN | EDIT_WIN | OPTIONS_WIN | WAP_WIN)
 
*******************************************************************************/

void AUI_destroy (T_MFW_HND win, USHORT windows)
{
	T_WAP_DATA *data = AUI_wap_data();
	USHORT entryIndex;
	
#ifdef TRACE_AUIWAP
	TRACE_FUNCTION("AUI_destroy");
#endif
    
	if (data==NULL)
	{
		TRACE_EVENT("*** Could not destroy data ***");
		return;
	}
	
	/* If we are closing the browser or exiting WAP, disconnect the call */

	if ((windows & WAP_WIN) || (windows==RETURN_TO_MENU))
	{
		if (data->View)
		{
			AUI_wap_end_call(data->View->cId);
		}
		else
		{
			AUI_wap_end_call(0);
		}
	}
		
	/* Check to see if WAP Browser Window should be destroyed */
	
	if ((windows & BROWSER_WIN) && (data->browser_win != NULL))
	{
#ifdef TRACE_AUIWAP
		TRACE_FUNCTION("AUI_destroy browser");
#endif

		/* Destroy the browser window */
		
		AUI_win_destroy(data->browser_win);
		data->browser_win = NULL;
		 
		/* Write history list to FFS */
		
		ATB_wap_profile_save(data->View);
	}

	/* Check to see if Connection Dialog should be destroyed */
    	
	if ((windows & CONNECT_WIN) && (data->connect_win != NULL))
	{
		SEND_EVENT(data->connect_win,DIALOG_DESTROY,0,0);
		data->connect_win = NULL;
	}

	/* Check to see if WAP Main Menu should be destroyed */
		
	if ((windows & MENU_WIN) && (data->menu_win != NULL))
	{
#ifdef TRACE_AUIWAP
		TRACE_FUNCTION("AUI_destroy menu");
#endif
		bookMenuDestroy(data->menu_win);
		data->menu_win = NULL;
	}

	/* Check to see if Options Menu should be destroyed */
	
	if ((windows & OPTIONSMENU_WIN) && (data->optionsmenu_win != NULL))
	{
#ifdef TRACE_AUIWAP
		TRACE_FUNCTION("AUI_destroy optionsmenu");
#endif
		/* WAP page can now update */

		data->update_forbid = FALSE;
		
		/* Remove all options list entries */
		
		for (entryIndex=0; entryIndex<(data->OptionsList->no_of_entries); entryIndex++)
		{
			if (data->OptionsList->Entry[entryIndex]!=NULL)
			{
				AUI_wap_memory_free((UBYTE *)data->OptionsList->Entry[entryIndex], (SOFTKEY_MAX_LEN+1)*sizeof(USHORT));
				data->OptionsList->Entry[entryIndex] = NULL;
			}
		}

		/* Destroy the list itself */
		
		if (data->optionsmenu_data)
		{
			AUI_wap_memory_free((UBYTE *)data->optionsmenu_data->List, (data->optionsmenu_data->ListLength)*sizeof(T_MFW_MNU_ITEM)); 
			AUI_wap_memory_free((UBYTE *)data->optionsmenu_data, sizeof(ListMenuData));
			data->optionsmenu_data = NULL;
		}
		
		listsDestroy(data->optionsmenu_win);
		data->optionsmenu_win = NULL;
	}

	/* Check to see if List Window should be destroyed */
	
	if ((windows & LIST_WIN) && (data->list_win != NULL))
	{
#ifdef TRACE_AUIWAP
		TRACE_FUNCTION("AUI_destroy list");
#endif
		if (data->list_data)
	{
			AUI_wap_memory_free((UBYTE *)data->list_data->List, (data->list_data->ListLength)*sizeof(T_MFW_MNU_ITEM));
			AUI_wap_memory_free((UBYTE *)data->list_data, sizeof(ListMenuData));
			data->list_data = NULL;
		}
		listsDestroy(data->list_win);
		data->list_win = NULL;
	}

	/* Check to see if Options Window should be destroyed */
		
	if ((windows & OPTIONS_WIN) && (data->options_win != NULL))
	{
#ifdef TRACE_AUIWAP
		TRACE_EVENT("AUI_destroy options");
#endif
		bookMenuDestroy(data->options_win);
		data->options_win = NULL;
	}

	/* Check to see if Editor should be destroyed */
		
	if ((windows & EDIT_WIN) && (data->edit_win != NULL))
	{
#ifdef TRACE_AUIWAP
		TRACE_EVENT("AUI_destroy editor");
#endif

#ifdef NEW_EDITOR
		AUI_edit_Destroy(data->edit_win);
#else
		editor_destroy(data->edit_win);
#endif /* NEW_EDITOR */
		data->edit_win = NULL;
	}

	/* Check to see if WAP Application should be destroyed */
		
	if (windows & WAP_WIN)
	{
#ifdef TRACE_AUIWAP
		TRACE_EVENT("AUI_destroy WAP");
#endif
		/* Destroy the error dialog if it exists */

		if (data->error_win)
		{
			SEND_EVENT(data->error_win, DIALOG_DESTROY, 0, 0);
			data->error_win = NULL;
		}
		
		/* Display "Please wait" dialog; WAP destroy will complete on callback */

		if (!data->temp_win)
		{
			data->temp_win = AUI_please_wait(data->win);
		}
		
		/* If there's a view around, prepare the cache to shut down */

		if (data->View)
		{
			/* Set status to shutting down */
			ATB_wap_status_change(data->View, ATB_WAP_SHUTTING_DOWN);
			ATB_wap_cache_prepare();
		}
		else /* No view exists, destroy WAP straight away */
		{
			ATB_wap_destroy();
		}
	}

	/* If all windows have been destroyed except main window,
	 * recreate menu */
	 
	if (windows==RETURN_TO_MENU)
	{
		AUI_wap_new_view_done();
	}
	
#ifdef TRACE_AUIWAP
	TRACE_EVENT("AUI_destroy end");
#endif

	return;
}


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

 $Function:    	AUI_wap_cache_prepare_done

 $Description:	Cache is prepared for WAP_TERMINATE
 				
 $Returns:		void

 $Arguments:	None
 
*******************************************************************************/

void AUI_wap_cache_prepare_done(void)
{
	T_WAP_DATA *data = AUI_wap_data();

	TRACE_FUNCTION("AUI_wap_cache_prepare_done()");

	if (!data)
	{
		return;
	}
	
	/* If we're shutting down, continue the process */

	if (ATB_wap_status_get(data->View, ATB_WAP_SHUTTING_DOWN))
	{
		TRACE_EVENT("We are shutting down");
		ATB_wap_destroy();
	}
	else
	{
		/* Otherwise, the cache is being resized */
		TRACE_EVENT("*** CACHE RESIZE ***");
	}

	return;
}


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

 $Function:    	AUI_wap_close_view_done

 $Description:	Called when a view has been closed
 				
 $Returns:		void

 $Arguments:	None
 
*******************************************************************************/

void AUI_wap_close_view_done(void)
{
#ifdef TRACE_AUIWAP
	TRACE_FUNCTION("AUI_wap_close_view_done");
#endif

	ATB_wap_destroy();
}


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

 $Function:    	AUI_wap_terminate_done

 $Description:	Called when a WAP termination is complete
 				
 $Returns:		void

 $Arguments:	None
 
*******************************************************************************/

void AUI_wap_terminate_done(void)
{
	T_WAP_DATA *data = AUI_wap_data();

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

	if (!data)
	{
		return;
	}

	if (data!=NULL)
	{
		if (data->temp_win)
		{
			SEND_EVENT(data->temp_win, DIALOG_DESTROY, NULL, NULL);
			data->temp_win = NULL;
		}

		/* Free memory for some message strings */
		
		AUI_wap_memory_free ((UBYTE *)data->Buffer, (INPUT_MAX_LEN+1)*sizeof(USHORT));	/* Delete input buffer 1 */
		AUI_wap_memory_free ((UBYTE *)data->Buffer2, (INPUT_MAX_LEN+1)*sizeof(USHORT));	/* Delete input buffer 2 */
		AUI_wap_string_free(&data->Message);		/* Delete output buffer */
		AUI_wap_memory_free ((UBYTE *)data->LeftSoftKey, (SOFTKEY_MAX_LEN+2)*sizeof(USHORT));  /* Delete left softkey text */
		AUI_wap_memory_free ((UBYTE *)data->RightSoftKey, (SOFTKEY_MAX_LEN+2)*sizeof(USHORT)); /* Delete right softkey text */

		/* Destroy options menu list */
		
		ATB_wap_entry_list_destroy(data->OptionsList);

		/* Destroy the WAP data window */

		win_delete(data->win);
        wap_main_window = 0;
		AUI_wap_memory_free ((UBYTE *)data, sizeof (T_WAP_DATA));
	}

#ifdef TRACE_MEMALLOC
{
UBYTE	trackIndex;
	for (trackIndex = 0; trackIndex<110; trackIndex++)
	{
		TRACE_EVENT_P2("TRACKINDEX %d is %d", trackIndex, memTracker[trackIndex]);
	}
}
#endif

	return;
}


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

 $Function:    	AUI_cb

 $Description:	Callback function for WAP data window.  This window displays "not
 				connected", since its appearance means a connection failure has
 				occurred.  Apart from this, all information to be displayed should be
 				in the other WAP windows (browser window, options window etc).
 
 $Returns:		void

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

static int AUI_cb (T_MFW_EVENT event, T_MFW_WIN * win)
{
#ifdef TRACE_AUIWAP
	TRACE_FUNCTION("AUI_cb");
#endif

    switch (event)
	{
		case E_WIN_VISIBLE:
		   	if (win->flags & E_WIN_VISIBLE)
			{
		    	dspl_ClearAll();
				/* If this screen is displayed, the connection has been
				 * terminated, so display 'Not Connected' */
		    	PROMPT(4,12,0, TxtNotConnected);
				displaySoftKeys(TxtReload,TxtExit);
   			}
		break;
	}
	return;
}


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

 $Function:    	AUI_main_kbd_cb

 $Description:	Cope with a keypress from the "Not Connected" screen.
 
 $Returns:		MFW_EVENT_CONSUMED

 $Arguments:	event, keyboard - standard keyboard callback arguments
 				
*******************************************************************************/

static int AUI_main_kbd_cb(T_MFW_EVENT event, T_MFW_KBD *keyboard)
{
	T_WAP_DATA *data = AUI_wap_data();

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

	if (!data)
	{
		return;
	}

	switch (keyboard->code)
	{
		case KCD_HUP:															
		case KCD_RIGHT:															
			AUI_destroy(data->win, RETURN_TO_MENU);
      		break;

      	case KCD_LEFT:
      		AUI_connect_URL(data->win, data->View->URL);
      		break;
      		
		default:
			break;
	}
	
	return MFW_EVENT_CONSUMED;
}


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

 $Function:    	AUI_control

 $Description:	Dialog function for WAP data window.  Since this window only
 				displays the "not connected" message, currently this function can
 				only show the window.
 
 $Returns:		void

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

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

void AUI_control (T_MFW_HND win, USHORT event, SHORT value, void * parameter)
{
#ifdef TRACE_AUIWAP
	TRACE_FUNCTION("AUI_control");
#endif

	switch (event)
	{
		case WAP_INIT:
			win_show(win);
			break;
	}
	
	return;
}


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

 $Function:    	AUI_connecting_dialog

 $Description:	Show "Connecting..." dialog (displayed while sending configuration
 				information to WAP gateway)
 
 $Returns:		Window handler

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

T_MFW_HND AUI_connecting_dialog (T_MFW_HND win, ULONG status)
{
	T_WAP_DATA *data	= AUI_wap_data();
	T_DISPLAY_DATA		display_info;
	int					timer;
	T_MFW_EVENT			keyEvents;
	
#ifdef TRACE_AUIWAP		
	TRACE_FUNCTION("AUI_connecting_dialog");
#endif

	if (!data)

⌨️ 快捷键说明

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