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

📄 si_wtaia.c

📁 是一个手机功能的模拟程序
💻 C
字号:
/*
 * Copyright (C) Ericsson Mobile Communications AB, 2000.
 * Licensed to AU-System AB.
 * All rights reserved.
 *
 * This software is covered by the license agreement between
 * the end user and AU-System AB, and may be used and copied
 * only in accordance with the terms of the said agreement.
 *
 * Neither Ericsson Mobile Communications AB nor AU-System AB
 * assumes any responsibility or liability for any errors or inaccuracies in
 * this software, or any consequential, incidental or indirect damage arising
 * out of the use of the Generic WAP Client software.
 */
/*========================================================================

	WAP WTA Implementation Project

==========================================================================

	File: si_wtaia.c

	Description: Public wtai script functions. Implementation file.


=========================================================================*/

#include "si_wtaia.h"
#include "aapiwta.h"
#include "capiwta.h"
#include "wmlelm.h"
#include "xml_conv.h"
#include "wmlif.h"


#ifdef USE_WIP_MALLOC
	#include "wip_mem.h"
#endif

/* {Function Name, Finish Function Name, Time Cost, Nbr of Arguments} */
const structWTAILibCall arrayScriptwtaiPUB[1][3] =
{
	/* Public */
	{ 
		{WTAI_PUB_publicMakeCall, WTAI_PUB_publicMakeCallFinish, 1, 1},
		{WTAI_PUB_publicSendDTMF, WTAI_PUB_publicSendDTMFFinish, 1, 1},
		{WTAI_PUB_publicAddPBEntry, WTAI_PUB_publicAddPBEntryFinish, 1, 2},
	},


};


/*========================================================================
==========================================================================
	EXTERNAL FUNCTIONS
==========================================================================
=========================================================================*/

/* WTAPublic.makeCall(number); */
enumErrorCode 
WTAI_PUB_publicMakeCall (pstructOpS OpS, pWTACONTROL pWTAControlStruct, UINT8 iObjectID)
{
	BYTE* pbStr=NULL;
	pWTAControlStruct = pWTAControlStruct; /* Getting rid of warning */

	if (OpS!=NULL)
	{
		BOOL fOverflow=FALSE;
		enumErrorCode eResult=ERR_WAE_WMLS_NONE;

		/* Get parameters from Opstack NOTE! The "popping"-order is 
		   important */
		pstructVar pNumber=OpS_Pop(OpS);

		/* Check if the number parameter is a string. */
		if ((Var_Convert( pNumber, typeString )==VCR_OK))
		{
			/* Convert to CHAR */
	   		pbStr = wip_wchar2byte( pNumber->val.theString, &fOverflow );
			if (! fOverflow)
			{
				/* Call wtai function */
				WTAIa_publicMakeCall ( iObjectID,(CHAR*)pbStr);
				eResult=WTAI_SCRIPT_FUNCTION_CALLED;
			}
			DEALLOC( &pbStr );
		}

		Var_Delete( &pNumber );
	
		return eResult;
	}

	return ERR_WAE_WMLS_LIB;
}

/* WTAPublic.sendDTMF(dtmf); */
enumErrorCode 
WTAI_PUB_publicSendDTMF (pstructOpS OpS, pWTACONTROL pWTAControlStruct, UINT8 iObjectID)
{
	BYTE* pbStr=NULL;
	pWTAControlStruct = pWTAControlStruct; /* Getting rid of warning */

	if (OpS!=NULL)
	{
		BOOL fOverflow=FALSE;
		enumErrorCode eResult=ERR_WAE_WMLS_NONE;

		/* Get parameters from Opstack NOTE! The "popping"-order is 
		   important */
		pstructVar pDtmf=OpS_Pop(OpS);

		/* Check if the number parameter is a string and the mode parameter 
		   is an integer. */
		if ((Var_Convert( pDtmf, typeString )==VCR_OK))
		{
			/* Convert to CHAR */
	   		pbStr = wip_wchar2byte( pDtmf->val.theString, &fOverflow );
			if (! fOverflow)
			{
				/* Call wtai function */
				WTAIa_publicSendDTMF ( iObjectID,(CHAR*)pbStr);
				eResult=WTAI_SCRIPT_FUNCTION_CALLED;
			}
			DEALLOC( &pbStr );
		}

		Var_Delete( &pDtmf );
	
		return eResult;
	}

	return ERR_WAE_WMLS_LIB;
}

/* WTAPublic.addPBEntry(number, name); */
enumErrorCode 
WTAI_PUB_publicAddPBEntry (pstructOpS OpS, pWTACONTROL pWTAControlStruct, UINT8 iObjectID)
{
	BYTE* pbStr=NULL;
	pWTAControlStruct = pWTAControlStruct; /* Getting rid of warning */

	if (OpS!=NULL)
	{
		BOOL fOverflow=FALSE;
		enumErrorCode eResult=ERR_WAE_WMLS_NONE;

		/* Get parameters from Opstack NOTE! The "popping"-order is 
		   important */
        pstructVar pName=OpS_Pop(OpS);
		pstructVar pNumber=OpS_Pop(OpS);

		/* Check if the number parameter is a string and the mode parameter 
		   is an integer. */
		if ((Var_Convert( pNumber, typeString )==VCR_OK)&&
			(Var_Convert( pName, typeString )==VCR_OK))
		{
			/* Convert to CHAR */
	   		pbStr = wip_wchar2byte( pNumber->val.theString, &fOverflow );
			
			if (! fOverflow)
			{
				/* Call wtai function */
				WTAIa_publicAddPBEntry ( iObjectID,(CHAR*)pbStr,
													(WCHAR*)pName->val.theString);
				eResult=WTAI_SCRIPT_FUNCTION_CALLED;
			}
			DEALLOC( &pbStr );
		}


		Var_Delete( &pName );
		Var_Delete( &pNumber );
	
		return eResult;
	}

	return ERR_WAE_WMLS_LIB;
}


enumErrorCode 
WTAI_PUB_publicMakeCallFinish (pstructOpS OpS,
						 pWTACONTROL pWTAControlStruct,
						 int iResult,
						 WCHAR* pwcFieldValue)
{
	pWTAControlStruct = pWTAControlStruct;	/* Getting rid of warning */
	pwcFieldValue = pwcFieldValue;			/* Getting rid of warning */

	if (OpS!=NULL)
	{
		pstructVar pResult=Var_New();

		/* If no handle, return invalid */
		if ( iResult == WTA_SUCCESS)
		{
			Var_NewString( pResult, 0 ); /* Create an empty string */
		}
		else if ( iResult == WTA_INVALID )
		{
			Var_AssignInvalid(pResult);
		}
		else
		{
			Var_AssignInt(pResult, iResult);
		}
		OpS_Push(OpS, &pResult);
		return ERR_WAE_WMLS_NONE;
	}
	return ERR_WAE_WMLS_LIB;
}

enumErrorCode 
WTAI_PUB_publicSendDTMFFinish (pstructOpS OpS,
						 pWTACONTROL pWTAControlStruct,
						 int iResult,
						 WCHAR* pwcFieldValue)
{
	pWTAControlStruct = pWTAControlStruct;	/* Getting rid of warning */
	pwcFieldValue = pwcFieldValue;			/* Getting rid of warning */

	if (OpS!=NULL)
	{
		pstructVar pResult=Var_New();

		/* If no handle, return invalid */
		if ( iResult == WTA_SUCCESS)
		{
			Var_NewString( pResult, 0 ); /* Create an empty string */
		}
		else if ( iResult == WTA_INVALID )
		{
			Var_AssignInvalid(pResult);
		}
		else
		{
			Var_AssignInt(pResult, iResult);
		}
		OpS_Push(OpS, &pResult);
		return ERR_WAE_WMLS_NONE;
	}
	return ERR_WAE_WMLS_LIB;
}

enumErrorCode 
WTAI_PUB_publicAddPBEntryFinish (pstructOpS OpS,
						 pWTACONTROL pWTAControlStruct,
						 int iResult,
						 WCHAR* pwcFieldValue)
{
	pWTAControlStruct = pWTAControlStruct;	/* Getting rid of warning */
	pwcFieldValue = pwcFieldValue;			/* Getting rid of warning */

	if (OpS!=NULL)
	{
		pstructVar pResult=Var_New();

		/* If no handle, return invalid */
		if ( iResult == WTA_SUCCESS)
		{
			Var_NewString( pResult, 0 ); /* Create an empty string */
		}
		else if ( iResult == WTA_INVALID )
		{
			Var_AssignInvalid(pResult);
		}
		else
		{
			Var_AssignInt(pResult, iResult);
		}
		OpS_Push(OpS, &pResult);
		return ERR_WAE_WMLS_NONE;
	}
	return ERR_WAE_WMLS_LIB;
}

⌨️ 快捷键说明

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