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

📄 wap_frame.c

📁 是一个手机功能的模拟程序
💻 C
字号:
/*
+-----------------------------------------------------------------------------
|  File     : wap_frame.h
+-----------------------------------------------------------------------------
|                 Copyright Condat AG 1999-2001, Berlin
|                 All rights reserved.
|
|                 This file is confidential and a trade secret of Condat AG
|                 The receipt of or possession of this file does not convey
|                 any rights to reproduce or disclose its contents or to
|                 manufacture, use, or sell anything it may describe, in
|                 whole, or in part, without the specific written consent of
|                 Condat AG.
+-----------------------------------------------------------------------------
|  Purpose  : This module is part of the entity WAP and implements frame-
|             related adapter functions for the AUS WAP browser
|  History   : 15/05/2003 - SPR#1983 - SH - Updated to latest from 1.6.3 version.
+-----------------------------------------------------------------------------
*/

#ifndef WAP_FRAME    
#define WAP_FRAME    _C
#endif

#define ENTITY_WAP

/*
 * INCLUDES
 */
#if defined (NEW_FRAME)

#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include <stddef.h>
#include "typedefs.h"
#include "pcm.h"
#include "pconst.cdg"
#include "mconst.cdg"
#include "message.h"
#include "ccdapi.h"
#include "vsi.h"
#include "custom.h"
#include "gsm.h"
#include "prim.h"
#include "cnf_wap.h"
#include "mon_wap.h"
#include "pei.h"
#include "tok.h"
#include "dti.h"      /* functionality of the dti library */

#else

#include <stdarg.h>
#include <string.h>
#include "stddefs.h"
#include "pconst.cdg"
#include "message.h"
#include "ccdapi.h"
#include "custom.h"
#include "gsm.h"
#include "cnf_wap.h"
#include "cus_wap.h"
#include "mon_wap.h"
#include "prim.h"
#include "vsi.h"
#include "pei.h"
#include "tok.h"

#endif

#include "wap.h"
#include "aapiclnt.h"
#include "capiclnt.h"
#include "wap_types.h"
#include "wap_wapmmi.h"

/*
 * VAR LOCAL 
 */ 

#define MAX_TRACE_LENGTH 50

#define AUS_BROWSER_TRACE



#ifdef AUS_BROWSER_TRACE
char log_buffer[MAX_TRACE_LENGTH];
#endif

/* TRUE if WAP browser startup has failed */
extern UBYTE startup_failed;

/*
 * FUNCTIONS
 */ 


/*
+--------------------------------------------------------------------+
| PROJECT : GSM-WAP (8444)             MODULE  : WAP_FRAME           |
| STATE   : code                       ROUTINE : CLNTa_currentTime   |
+--------------------------------------------------------------------+

  PURPOSE : The function returns seconds ellapsed since 1997-01-01
            00.00.00. The time can be of any format GMT as well as
            local time
*/
GLOBAL ULONG CLNTa_currentTime (void)
{
  ULONG RetVal;

#ifdef TRACE_WAP_FRAME
  TRACE_EVENT ("CLNTa_currentTime()");
#endif

  if (VSI_OK == vsi_t_time(VSI_CALLER &RetVal))  /*Time in milliseconds */
  {
#ifdef TRACE_WAP_FRAME
    TRACE_EVENT_P1("time : %d",(RetVal/1000));
#endif
	return (RetVal/1000); /* Time returned in seconds */
  }
  else 
  {
	TRACE_EVENT("0");
    return 0;
  }
}


/*
+--------------------------------------------------------------------+
| PROJECT : GSM-WAP (8444)             MODULE  : WAP_FRAME           |
| STATE   : code                       ROUTINE : CLNTa_setTimer      |
+--------------------------------------------------------------------+

  PURPOSE : the function is called when a timer shall be started 

  timeInterval -> The time is given as an interval of 100 millisecond units, e.g.,
    if a timer shall expire in one second an interval of 10 is given.
*/
GLOBAL void CLNTa_setTimer (ULONG timeInterval)
{
#ifdef TRACE_WAP_FRAME
  TRACE_EVENT_P1("CLNTa_setTimer() %d",(int)timeInterval);
#endif

  wap_start_timer (timeInterval);
}


/*
+--------------------------------------------------------------------+
| PROJECT : GSM-WAP (8444)             MODULE  : WAP_FRAME           |
| STATE   : code                       ROUTINE : CLNTa_resetTimer    |
+--------------------------------------------------------------------+

  PURPOSE : The function is called when a timer shall be aborted.
            The timerId is to be an id that has been used in a
            previous call to CLNTa_setTimer.
 */

GLOBAL void CLNTa_resetTimer()
{
#ifdef TRACE_WAP_FRAME
  TRACE_EVENT("CLNTa_resetTimer");
#endif
  wap_stop_timer();
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-WAP (8444)             MODULE  : WAP_FRAME           |
| STATE   : code                       ROUTINE : CLNTa_error         |
+--------------------------------------------------------------------+

  PURPOSE : the AUS WAP Browser calls the function when an error
            occurred during an operation from the view identified by
            viewId. If the view id is equal to 0, the error is general
            for all views. The error number gives what kind of error
            it is.
*/
GLOBAL void CLNTa_error (unsigned char viewId,
                         short errorNo,
                         unsigned char errorType)
{
	T_WAP_MMI_CONTROL_IND parameter;
	
   TRACE_EVENT_P3("CLNTa_error() - View %d, No %d, Type %d",
                 viewId,errorNo, errorType);      

	parameter.object_id = viewId;
	parameter.status_code = 0;
	parameter.error_code = errorNo;
	parameter.play_standard_click = TRUE;
	W_WAP_MMI_CONTROL_IND(&parameter);				/* Send error code to MMI task */

	/* If we get a memory full error, startup has failed */
	
	if (parameter.error_code==8002)
	{
		startup_failed = TRUE;
	}
	
	return;
}


/*
+--------------------------------------------------------------------+
| PROJECT : GSM-WAP (8444)             MODULE  : WAP_FRAME           |
| STATE   : code                       ROUTINE : CLNTa_log           |
+--------------------------------------------------------------------+

  PURPOSE : The AUS WAP Browser calls the function when log or debug
            information about the system is to be given. The view the
            information is for is given in viewId. If the view id is
            equal to 0, the log is general for all views. The log
            number gives what kind of operation it is. The next part
            of the function equals in functionality with ANSI C printf().
      ... done by TRACE_EVENT ...
*/
GLOBAL void CLNTa_log (unsigned char viewId,
                       short logNo,
                       const char *format,
                       ...)
{

#ifdef AUS_BROWSER_TRACE

    va_list varpars;
    int format_substring_offset;
	char *format_substring_begin;
	char *format_substring_end;
    int format_offset;
    int format_length;

	
	TRACE_FUNCTION("***** AUS CLNTa_log()  BEGINNING ****");

    
    /*Initialisation of the string variables. "format" is too big for the Condat traces  */
    /* and therefore some substrings are needed */
    
    format_substring_begin = (char*)format;
    format_substring_end = (char*)format;
    format_substring_offset=0;
    format_length = strlen(format);
    format_offset = 0;


    va_start(varpars,format);

    /*This loop will scrool "format" looking for variables. When they are found, 
    they will traced out in a different line. The loop will also split every AUS trace into
    different lines, due to the limit in size of the Condat traces.
    The maximum length of every line of trace will be MAX_TRACE_LENGTH.
    */
    while (format_offset<=format_length)
    {
        BOOL trace_substring=FALSE;
        char current_character = *format_substring_end;
        BOOL format_substring_too_big = (format_substring_offset >= (MAX_TRACE_LENGTH-1));
        BOOL next_character_a_variable = (current_character == '%');
        BOOL current_character_last_in_format = (format_offset == format_length);       
        BOOL current_character_first_in_substring = (!format_substring_offset);

        if (current_character_first_in_substring&&next_character_a_variable)
        {
            char* string_var;
            int string_var_length;
            
            /*Go to next character */
            format_substring_end++;            
            format_substring_offset++; 
            current_character = *format_substring_end;
            /*Decode variable*/
            switch (current_character)
            {
				case 's':
				case 'S':
					string_var = va_arg(varpars, char *);
					string_var_length = strlen(string_var);
            		if (string_var_length<MAX_TRACE_LENGTH)
               		{
        				TRACE_EVENT_P1("= %s", string_var);
        			}
        		    else
                    {
                        int string_var_offset = 0;
                        do
                        {
                            strncpy(log_buffer, (char*)&string_var[string_var_offset],MAX_TRACE_LENGTH);
                            TRACE_EVENT(log_buffer);                                 
                            string_var_offset+=MAX_TRACE_LENGTH;                           
                        }
                        while (string_var_offset<string_var_length);
					}
           	    break;
				case 'u': case 'x': case 'X': case 'o':
					TRACE_EVENT_P1("= %u", va_arg(varpars, unsigned int));
					break;
				case 'd': case 'i':
					TRACE_EVENT_P1("= %d", va_arg(varpars, int));
					break;
				case 'c':
					TRACE_EVENT_P1("= %c", va_arg(varpars, char));
					break;
				default:
					TRACE_EVENT("AUS>>Unknown type");
					break;
            }
            
        }
        else if ((format_substring_too_big)||
                (next_character_a_variable)||
                (current_character_last_in_format))
        {
            strncpy(log_buffer,format_substring_begin,format_substring_offset);
            log_buffer[format_substring_offset-1] = '\0';
            trace_substring = TRUE;
        }

        if (trace_substring)
        {
            TRACE_EVENT(log_buffer);
            format_substring_begin = format_substring_end;
            format_substring_offset = 0;
        }
        else
        {
            format_substring_offset++;
            format_substring_end++;
            format_offset++;
        }
    if   (current_character_last_in_format)
        format_offset++;        
    }

    va_end(varpars);
    
	TRACE_FUNCTION("***** AUS CLNTa_log()    END    *****");

#endif

}

GLOBAL xxmonPID (char* format, short pid)
{
}

GLOBAL  xxmonhexasc (char std,char* string1, char* string2, void* pdata, int len)
{
}

⌨️ 快捷键说明

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