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

📄 wap_mmip.c

📁 是一个手机功能的模拟程序
💻 C
字号:
/*
+-----------------------------------------------------------------------------
|  File     : wap_mmip.c
+-----------------------------------------------------------------------------
|                 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 Modul defines the functions for processing
|             of incomming primitives for the component AUS WAP Browser
|             of the mobile station
+-----------------------------------------------------------------------------
*/

#ifndef WAP_MMIP_C
#define WAP_MMIP_C
#endif


/*
 * XXX END
 */ 
#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 <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 "mon_wap.h"
#include "prim.h"
#include "vsi.h"
#include "pei.h"
#include "tok.h"

#endif

#include "dti.h"
#include "wap.h"
#include "cus_wap.h"
#include "capigle.h"
#include "wap_codec.h"
#include "Tapimmi.h"
#include "capiclnt.h"

/****                     ***/

/*==== CONST =======================================================*/

/*==== TYPES =======================================================*/

/*==== VAR EXPORT ==================================================*/

/*==== VAR LOCAL ===================================================*/

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

//#define TRACE_WAP_MMIP

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

  PURPOSE : Process primitive MMI_WAP_IND received from  MMI
*/

GLOBAL const void   mmi_wap_ind (
                                  T_MMI_WAP_IND *mmi_wap_ind
                                )
{
  PACCESS(mmi_wap_ind);

#ifdef TRACE_WAP_MMIP
  TRACE_EVENT("mmi_wap_ind()");
#endif

{
  UBYTE *event_store;
  USHORT total_size;
  
#ifdef TRACE_WAP_MMIP
  UBYTE offsetIndex;
  char temp[50];
  sprintf(temp,"mmi_wap_ind->event_id %d",mmi_wap_ind->event_id);
  TRACE_EVENT(temp);  
  sprintf(temp,"mmi_wap_ind->sdu.l_buf %d",mmi_wap_ind->sdu.l_buf);
  TRACE_EVENT(temp);
#endif

  total_size = mmi_wap_ind->sdu.l_buf/8;
  event_store = (UBYTE*)mmi_wap_ind->sdu.buf;

#ifdef TRACE_WAP_MMIP
     // Memory dump, REMOVE
  TRACE_EVENT("WAP memory dump, received event");
  for (offsetIndex = 0; (offsetIndex<total_size && offsetIndex<80); offsetIndex++)
    {
    sprintf(temp,"%8x %2x %3d %c", event_store+offsetIndex, *(event_store+offsetIndex), *(event_store+offsetIndex), *(event_store+offsetIndex));
    TRACE_EVENT(temp);
    }
//   End of memory dump 
#endif
}

#ifdef MFW
  wap_decoder(mmi_wap_ind->event_id, (void*)mmi_wap_ind->sdu.buf);
#endif /* MFW */
  
  PFREE(mmi_wap_ind);
}


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

  PURPOSE : Process primitive MMI_WAP_REQ received from  MMI
*/

GLOBAL const void   mmi_wap_req (
                                  T_MMI_WAP_REQ *mmi_wap_req
                                )
{
  PACCESS(mmi_wap_req);
  TRACE_FUNCTION("mmi_wap_req()");

  /*
   * XXX  do stuff ... XXX
   */ 
  
  PFREE(mmi_wap_req);
}


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

  PURPOSE : Process primitive MMI_WAP_CNF received from  MMI
*/

GLOBAL const void   mmi_wap_cnf (
                                  T_MMI_WAP_CNF *mmi_wap_cnf
                                )
{
  PACCESS(mmi_wap_cnf);
  TRACE_FUNCTION("mmi_wap_cnf()");

  /*
   * XXX  do stuff ... XXX
   */ 
  
  PFREE(mmi_wap_cnf);
}


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

  PURPOSE : Process primitive WAP_DTI_REQ received from  MMI
            Depending on the dti_conn parameter wap is to connect
            or disconnect a dti channel
*/

GLOBAL const void mmi_wap_dti_req (
                                  T_WAP_DTI_REQ *wap_dti_req
                                )
{
  UBYTE isOK;
  TRACE_FUNCTION("mmi_wap_dti_req()");
  PACCESS(wap_dti_req);
  
  switch (wap_dti_req->dti_conn)
  {
    case WAP_CONNECT_DTI:
    {
      TRACE_EVENT("WAP: received DTI from ACI");

      if (wap_data->dti_state NEQ DTI_CLOSED)
      {
        dti_close
        (
          wap_hDTI,
          WAP_DTI_DN_DEF_INSTANCE,
          WAP_DTI_DN_INTERFACE,
          WAP_DTI_DN_CHANNEL,
          FALSE
        );
      }

      /*
       * open new dti library communication channel
       */
      wap_data->dti_state = DTI_SETUP;
      isOK = dti_open(wap_hDTI,
                      WAP_DTI_DN_DEF_INSTANCE,
                      WAP_DTI_DN_INTERFACE,
                      WAP_DTI_DN_CHANNEL,
                      DTI_QUEUE_DISABLED, /* with buffering: 
                                        * DTI_QUEUE_UNLIMITED
                                        */
                      wap_dti_req->dti_direction,
                      FLOW_CNTRL_ENABLED,
                      DTI_VERSION_10,
                      (U8*)wap_dti_req->entity_name,
                      wap_dti_req->link_id);
      if(!isOK)
      {
        /* dti_open failed */
        wap_data->dti_state = DTI_CLOSED;
        break;
      }

      /* dti_open succeeded 
         - acknowledge in sig_dti_udp_connection_opened_ind */
      PFREE(wap_dti_req);
      /*
       * WAP_DTI_CNF will be sent in sig_dti_udp_connection_opened_ind
       */
      return;
    }

    case WAP_DISCONNECT_DTI:
    {
      TRACE_EVENT("WAP: DTI snatched away by ACI");

      if (wap_data->dti_state NEQ DTI_CLOSED)
        dti_close
        (
          wap_hDTI,
          WAP_DTI_DN_DEF_INSTANCE,
          WAP_DTI_DN_INTERFACE,
          WAP_DTI_DN_CHANNEL,
          FALSE
        );
      break;
    }
    default:
    {
      TRACE_EVENT("WAP: unknown dti_conn parameter!");
      return;
    }
  }

  /*
   * set CLOSED and send acknowledgement
   */
  wap_data->dti_state = DTI_CLOSED;
  {
    PALLOC (wap_dti_cnf, WAP_DTI_CNF);
    wap_dti_cnf->dti_conn = WAP_DISCONNECT_DTI;
    PSENDX (ACI, wap_dti_cnf)
  }
  PFREE(wap_dti_req);
}

⌨️ 快捷键说明

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