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

📄 atbwapaci.c

📁 是一个手机功能的模拟程序
💻 C
📖 第 1 页 / 共 4 页
字号:
	{
		parameter->title_length = CARD_TITLE_MAX_LEN;
		parameter->Title[CARD_TITLE_MAX_LEN] = NULL;
	}

	if (parameter->title_length == 0)
	{
		temp = MmiRsrcGetText(Txtnotitle);  //zhaowm 2003.0305 
		if (temp[0] == 0x80)
		  {
		   parameter->title_length = 3;
           wstrncpy(View->Title, temp, wstrlen(temp));
		   }
		else
		  {
		   parameter->title_length = 8;
		   strcpy(View->Title, temp);	
		   }


	}
    else
       {
	    temp1 = (char *)AUI_wap_memory_alloc(((CARD_TITLE_MAX_LEN)*2+3)*sizeof(char)); 
		ATB_ushort2char(temp1, parameter->Title, parameter->title_length);
        truncateString(View->Title,(char *)temp1,10,1,".");
        AUI_wap_memory_free((UBYTE *)temp1, ((CARD_TITLE_MAX_LEN)*2+3)*sizeof(char));    
        }

	// Make sure URL is not too long

	if (parameter->url_length > URL_MAX_LEN)
	{
		parameter->url_length = URL_MAX_LEN;
		*(parameter->Url+URL_MAX_LEN) = NULL;
	}
	strncpy(View->URL, parameter->Url, URL_MAX_LEN);

	// Add card name & URL to top of history list

	if (View->Status & WAP_STATUS_SAVEHISTORY)
	{
		ATB_wap_entry_insert(WAP_HISTORY_LIST, View->History, View->Title, 0);	// Add as entry 0 (last entry lost)
		ATB_wap_entry_insert(WAP_URL_LIST, View->HistoryURL, View->URL, 0);
		ATB_wap_profile_save(View);												// Save change to flash
	}

	// Check to see if user can go back from this card

	if (historyPointer != 0)
	{
		View->CanGoBack = TRUE;
	}
	else
	{
		View->CanGoBack = FALSE;
	}
	
	View->CustSoftKeys = FALSE;					// Default softkeys
	
	/* SPR#1575 - SH - New card is being read in */
	ATB_wap_status_change(View, ATB_WAP_CARD_READING);

	return;
}


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


 $Function:    	M_WAP_MMI_DRAW_CARD_IND
 
 $Description:	Tell MMI to draw the card.
 
 $Returns:		None.

 $Arguments:	parameter - data block
 
*******************************************************************************/

void M_WAP_MMI_DRAW_CARD_IND(T_WAP_MMI_DRAW_CARD_IND *parameter)
{
	T_WAP_VIEW	*View;
	
#ifdef TRACE_ATBWAPACI
	TRACE_FUNCTION("M_WAP_MMI_DRAW_CARD_IND");
	TRACE_EVENT_P1("object ID: %d",parameter->object_id);
	TRACE_EVENT_P2("contentWidth: %d, contentHeight: %d",parameter->contentWidth, parameter->contentHeight);
	TRACE_EVENT_P2("contentPosX: %d, contentPosY: %d",parameter->contentPosX, parameter->contentPosY);
#endif

	if (!(View = ATB_wap_get_view(parameter->object_id)))
		return;

	View->cardWidth		= parameter->contentWidth;
	View->cardHeight	= parameter->contentHeight;
	View->cardXPosition	= parameter->contentPosX;
	View->cardYPosition	= parameter->contentPosY;

	View->acceptUpdate	= FALSE;
	// Set to FALSE as default, to ignore any attempts to redraw parts of the card
	// rather than the whole card (e.g. when selecting an option).  Only allows a card
	// to be updated if M_WAP_MMI_CLEAR_CARD_IND is called.
}


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

 $Function:    	M_WAP_MMI_CLEAR_CARD_IND

 $Description:	Clear the card display.  Allows card to be updated.
 
 $Returns:		None.

 $Arguments:	parameter - data block
 
*******************************************************************************/

void M_WAP_MMI_CLEAR_CARD_IND(T_WAP_MMI_CLEAR_CARD_IND *parameter)
{
	T_WAP_VIEW *View;
	
#ifdef TRACE_ATBWAPACI
	TRACE_FUNCTION("M_WAP_MMI_CLEAR_CARD_IND");
	TRACE_EVENT_P1("MMI object ID: %d",parameter->object_id);
#endif

	if (!(View = ATB_wap_get_view(parameter->object_id)))
		return;

	View->acceptUpdate = TRUE;

	// Clearing the card means we're going to update the whole thing, so this update
	// is permitted (see M_WAP_MMI_DRAW_CARD_IND).
	
	return;
}


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


 $Function:    	M_WAP_MMI_SEND_TEXT_IND

 
 $Description:	
 
 $Returns:		

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

void M_WAP_MMI_SEND_TEXT_IND(T_WAP_MMI_SEND_TEXT_IND *parameter)
{
	T_WAP_VIEW					*View;
	T_WAP_ELEMENT				*Element;
	T_WAP_MMI_SEND_TEXT_IND		*copy;

#ifdef TRACE_ATBWAPACI
	TRACE_FUNCTION("M_WAP_MMI_SEND_TEXT_IND");
	ATB_trace_ushort_string(parameter->Text, parameter->text_length);
	ATB_trace_ushort_string(parameter->Formatstring, parameter->formatstring_length);
#endif

	if (!(View = ATB_wap_get_view(parameter->object_id)))
		return;
	
	// If an update is forbidden, ignore this event

	if (!View->acceptUpdate)
		return;
			
	// Allocate memory and copy the data
	
 	Element = ATB_wap_buffer_add_element(parameter->object_id, WAP_TEXT);
 
	copy = (T_WAP_MMI_SEND_TEXT_IND *)AUI_wap_memory_alloc(sizeof(T_WAP_MMI_SEND_TEXT_IND));
	memcpy((void *)copy, (void *)parameter, sizeof(T_WAP_MMI_SEND_TEXT_IND));

	if (parameter->text_length != 0)
	{
		copy->Text 			= (USHORT *)AUI_wap_memory_alloc(parameter->text_length*sizeof(USHORT));
		memcpy((void *)copy->Text, (void *)parameter->Text, parameter->text_length*sizeof(USHORT));
	}
	if (parameter->formatstring_length != 0)
	{
		copy->Formatstring 	=  (USHORT *)AUI_wap_memory_alloc(parameter->formatstring_length*sizeof(USHORT));
		memcpy((void *)copy->Formatstring, (void *)parameter->Text, parameter->formatstring_length*sizeof(USHORT));
	}
	
	Element->data = (void *)copy;

	return;
}


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



























































 $Function:    	M_WAP_MMI_SEND_IMAGE_IND

 
 $Description:	
 
 $Returns:		

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

void M_WAP_MMI_SEND_IMAGE_IND(T_WAP_MMI_SEND_IMAGE_IND *parameter)
{
	T_WAP_VIEW					*View;
	T_WAP_ELEMENT				*Element;
	T_WAP_MMI_SEND_IMAGE_IND	*copy;
	
#ifdef TRACE_ATBWAPACI
	TRACE_FUNCTION("M_WAP_MMI_SEND_IMAGE_IND");
	TRACE_EVENT_P1("MMI object ID: %d",parameter->object_id);
#endif

	if (!(View = ATB_wap_get_view(parameter->object_id)))
		return;

	// If an update is forbidden, ignore this event

	if (!View->acceptUpdate)
		return;

	Element = ATB_wap_buffer_add_element(parameter->object_id, WAP_IMAGE);
 
	copy = (T_WAP_MMI_SEND_IMAGE_IND *)AUI_wap_memory_alloc(sizeof(T_WAP_MMI_SEND_IMAGE_IND));
	memcpy((void *)copy, (void *)parameter, sizeof(T_WAP_MMI_SEND_IMAGE_IND));

	if (parameter->image_length != 0)
	{
		copy->Image 		= (UBYTE *)AUI_wap_memory_alloc(parameter->image_length*sizeof(UBYTE));
		memcpy((void *)copy->Image, (void *)parameter->Image, parameter->image_length*sizeof(UBYTE));
	}
	
	Element->data = (void *)copy;
	
	return;
}


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


 $Function:    	M_WAP_MMI_SEND_TABLE_IND

 
 $Description:	
 
 $Returns:		

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

void M_WAP_MMI_SEND_TABLE_IND(T_WAP_MMI_SEND_TABLE_IND *parameter)
{
	T_WAP_VIEW					*View;
	T_WAP_ELEMENT				*Element;
	T_WAP_MMI_SEND_TABLE_IND	*copy;
	
#ifdef TRACE_ATBWAPACI
	TRACE_FUNCTION("M_WAP_MMI_SEND_TABLE_IND");
	TRACE_EVENT_P1("object ID: %d",parameter->object_id);
	TRACE_EVENT_P2("Columns: %d, Rows: %d",parameter->cols_length, parameter->rows_length);
	TRACE_EVENT_P4("pX: %d, pY: %d, pWidth: %d, pHeight: %d",parameter->pX, parameter->pY, parameter->pWidth, parameter->pHeight);
	WAP_trace_ushort_string(parameter->Title, parameter->title_length);
#endif

	if (!(View = ATB_wap_get_view(parameter->object_id)))
		return;

// If an update is forbidden, ignore this event

	if (!View->acceptUpdate)
		return;
	
	// Allocate memory and copy the data
	
 	Element = ATB_wap_buffer_add_element(parameter->object_id, WAP_TABLE);
 
	copy = (T_WAP_MMI_SEND_TABLE_IND *)AUI_wap_memory_alloc(sizeof(T_WAP_MMI_SEND_TABLE_IND));
	memcpy((void *)copy, (void *)parameter, sizeof(T_WAP_MMI_SEND_TABLE_IND));

	if (parameter->title_length != 0)
	{
		copy->Title = (USHORT *)AUI_wap_memory_alloc(parameter->title_length*sizeof(USHORT));
		memcpy((void *)copy->Title, (void *)parameter->Title, parameter->title_length*sizeof(USHORT));
	}
	if (parameter->cols_length != 0)
	{
		copy->ColWidth = (SHORT *)AUI_wap_memory_alloc(parameter->cols_length*sizeof(SHORT));
		memcpy((void *)copy->ColWidth, (void *)parameter->ColWidth, parameter->cols_length*sizeof(SHORT));
	}
	if (parameter->rows_length != 0)
	{
		copy->RowHeight = (SHORT *)AUI_wap_memory_alloc(parameter->rows_length*sizeof(SHORT));
		memcpy((void *)copy->RowHeight, (void *)parameter->RowHeight, parameter->rows_length*sizeof(SHORT));
	}
	Element->data = (void *)copy;

	return;
}


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


 $Function:    	M_WAP_MMI_CARD_DRAW_COMPLETED_IND

 
 $Description:	
 
 $Returns:		

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

void M_WAP_MMI_CARD_DRAW_COMPLETED_IND(T_WAP_MMI_CARD_DRAW_COMPLETED_IND *parameter)
{
	T_WAP_VIEW *View;

	UBYTE temp;

	if (!(View = ATB_wap_get_view(parameter->object_id)))
		return;
	
	temp = dspl_Enable(0);

#ifdef TRACE_ATBWAPACI
	TRACE_FUNCTION("M_WAP_MMI_CARD_DRAW_COMPLETED_IND");
	TRACE_EVENT_P1("MMI object ID: %d",parameter->object_id);
#endif

	// If an update is forbidden, ignore this event

	if (!View->acceptUpdate)
	{
		dspl_Enable(temp);
		return;
	}
	
	// Destroy the current card, and make the new buffered card the current card
	
	ATB_wap_buffer_clear(View);
	View->ElementHeader = View->NewElementHeader;
	View->NewElementHeader = NULL;
		
	AUI_wap_card_show_req(View);
	dspl_Enable(temp);
	return;
}


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


 $Function:    	M_WAP_MMI_CONNECT_REQ
 
 $Description:	The connection (GSM or GPRS) can now be made
 				SPR#1575 - SH - Split the GPRS part of this function into two.
 				The GPRS attachment is made in this function.  Once GPRS is
 				attached, the connection proceeds in function connect_gprs() below.
 
 $Returns:		None.

 $Arguments:	parameter - the appropriate data type for the WAP_MMI_CONNECT_REQ
 				event.
 
*******************************************************************************/

void M_WAP_MMI_CONNECT_REQ(T_WAP_MMI_CONNECT_REQ *parameter)
{
	T_WAP_VIEW *View;
	char temp[NUMBER_MAX_LEN+1];
	
#ifdef TRACE_ATBWAPACI
	TRACE_FUNCTION("M_WAP_MMI_CONNECT_REQ");
	TRACE_EVENT_P1("MMI object ID: %d",parameter->object_id);
#endif

WAP_TRACE_EVENT(("objectid: %d",parameter->object_id));
if (!(View = ATB_wap_get_view(parameter->object_id)))
	return;

switch (View->Profile->AccessType)
{
	case WAP_CS_DATA:
		//robert chen modified, to adapte new ACI API, 2004-08-10
		//sAT_PercentPPP(0,1,View->Profile->Username, View->Profile->Password);
		sAT_PercentPPP(0,1,View->Profile->Username, View->Profile->Password,USE_NO_PPP_FOR_AAA);
		sAT_PercentWAP(0,0);
		sAT_PercentWAP(0,1);
		sprintf(temp, "=%s", View->Profile->DialupNumber);
		atD(temp,CMD_SRC_ATI_1);	
	break;

⌨️ 快捷键说明

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