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

📄 mfw_ss.c

📁 是一个手机功能的模拟程序
💻 C
📖 第 1 页 / 共 5 页
字号:
/*
+--------------------------------------------------------------------+
| PROJECT: MMI-Framework (8417)         $Workfile:: mfw_ss.c        $|
| $Author: zhenggl $Revision: 1.2 $|
| CREATED: 25.1.99                      $Modtime:: 24.03.00 9:48    $|
| STATE  : code                                                      |
+--------------------------------------------------------------------+

   MODULE  : MFW_SS

   PURPOSE : This modul contains the functions for supplementary management.


   $History:: mfw_ss.c                                              $
 *
 * *****************  Version 24  *****************
 * User: Vo           Date: 24.03.00   Time: 10:18
 * Updated in $/GSM/Condat/MS/SRC/MFW
 * Bug fix: result of IMEI
 * New: notice PIN type of SS string for PIN change/PIN unblock
 *
 * *****************  Version 23  *****************
 * User: Vo           Date: 10.01.00   Time: 16:09
 * Updated in $/GSM/Condat/MS/SRC/MFW
 * new function ss_exit()
 *
 * *****************  Version 22  *****************
 * User: Vo           Date: 10.01.00   Time: 13:32
 * Updated in $/GSM/Condat/MS/SRC/MFW
 *
 * *****************  Version 21  *****************
 * User: Ak           Date: 10.01.00   Time: 13:14
 * Updated in $/GSM/Condat/MS/SRC/MFW
 *
 * *****************  Version 20  *****************
 * User: Ak           Date: 21.10.99   Time: 11:56
 * Updated in $/GSM/Condat/MS/SRC/MFW
 * Why: Improvement
 * What: Passing of network basic service codes instead of GSM 2.30
 * codes for SS control string results and invocations
 *
 * *****************  Version 19  *****************
 * User: Ak           Date: 29.09.99   Time: 8:37
 * Updated in $/GSM/DEV/MS/SRC/MFW
 * Why: bug fix
 * What: strcpy do not check a NULL pointer argument, corrected
 *
 * *****************  Version 18  *****************
 * User: Ak           Date: 28.09.99   Time: 14:16
 * Updated in $/GSM/DEV/MS/SRC/MFW
 * Why: bug fix
 * What: strcpy do not check a NULL pointer argument, corrected
 *
 * *****************  Version 17  *****************
 * User: Es           Date: 16.09.99   Time: 17:25
 * Updated in $/GSM/DEV/MS/SRC/MFW
 * include SENSEI patch 13/09/99
 * two minor fixes
 *
 * *****************  Version 16  *****************
 * User: Vo           Date: 12.09.99   Time: 14:16
 * Updated in $/GSM/DEV/MS/SRC/MFW
 * New: USSD handle
 *
 * *****************  Version 15  *****************
 * User: Vo           Date: 30.08.99   Time: 12:08
 * Updated in $/GSM/DEV/MS/SRC/MFW
 * SS string for PIN unblock
 *
 * *****************  Version 14  *****************
 * User: Vo           Date: 9.08.99    Time: 16:53
 * Updated in $/GSM/DEV/MS/SRC/MFW
 * SS result from network
 * present IMEI
 * different handling of network password and PIN1/PIN2 password
 *
 * *****************  Version 13  *****************
 * User: Vo           Date: 21.07.99   Time: 14:44
 * Updated in $/GSM/DEV/MS/SRC/MFW
 *
 * *****************  Version 12  *****************
 * User: Vo           Date: 16.07.99   Time: 10:39
 * Updated in $/GSM/DEV/MS/SRC/MFW
 *
 * *****************  Version 11  *****************
 * User: Vo           Date: 9.07.99    Time: 14:56
 * Updated in $/GSM/DEV/MS/SRC/MFW
 *
 * *****************  Version 1  *****************
 * User: Vo           Date: 10.02.99   Time: 12:41
 * Created in $/GSM/DEV/MS/SRC/MFW

*/
#define ENTITY_MFW

#include <string.h>
#include <stdio.h>
#include <stdlib.h>

#if defined (NEW_FRAME)

#include "typedefs.h"
#include "vsi.h"
#include "custom.h"
#include "gsm.h"

#else

#include "stddefs.h"
#include "custom.h"
#include "gsm.h"
#include "vsi.h"

#endif

#include "message.h"
#include "prim.h"
#include "aci_cmh.h"

#include "cus_aci.h"
#include "ksd.h"
#include "p_sim.h"
#include "pcm.h"

#include "psa.h"
#include "psa_sim.h"

#include "mfw_mfw.h"
#include "mfw_nm.h"
#include "mfw_sim.h"
#include "mfw_sima.h"
#include "mfw_nmi.h"
#include "mfw_simi.h"
#include "mfw_nma.h"
#include "mfw_phb.h"
#include "mfw_cm.h"
#include "mfw_cmi.h"
#include "mfw_ss.h"
#include "mfw_ssi.h"
#include "mfw_win.h"
#include "mfw_phbi.h"

#include <string.h>


/*************** Variables ******************************************/
static T_MFW_SS_SUPORT    ss_suport;
static T_MFW_SS_NOTIFY    notify;
static T_MFW_SS_CF_CNF    cf_cnf;
static T_MFW_SS_CB_CNF    cb_cnf;
static T_MFW_SS_CLI_CNF   cli_cnf;
static T_MFW_SS_CW_CNF    cw_cnf;
static T_MFW_SS_PW_CNF    pw_cnf;
static T_MFW_SS_RES       ss_res;
static T_MFW_IMEI		  imei_info;
static T_MFW_SS_USSD      ussd_info;

static U8                 clip_status;
static U8                 colp_status;
static U8                 clir_status;
static U8                 clir_prefix;
static U8                 colr_status;
static U8                 clck_flag;
static U8				  pwd_flag;   /* 1 for change PIN */



#define CF_LST_SIZE (sizeof(T_MFW_FEATURE)  *MFW_MAX_FEAT_NR)
#define CB_LST_SIZE (sizeof(T_MFW_TELECOM)  *MFW_MAX_TELE_NR)
#define CW_LST_SIZE (sizeof(T_MFW_SRV_GROUP)*MFW_MAX_SRV_NR)

#define MAX_LST_BUF (MAXIMUM(MAXIMUM(CF_LST_SIZE,\
                                     CB_LST_SIZE),\
                             CW_LST_SIZE))
/* glowing,2004-06-10, import from TCS2112 */
#define LANG_RESET "*#0" /*mc, SPR 1111 beginning of language reset pseudo-SS string*/
#define TTY_NEXTCALL_ON "*55#" /* SPR#1352 - SH - Pseudo-SS string to switch on TTY on next call */
#define TTY_NEXTCALL_OFF "#55#" /* SPR#1352 - SH - Pseudo-SS string to switch off TTY on next call */
/* glowing,2004-06-10, end of import */
static ULONG ssLstBuf[MAX_LST_BUF/sizeof(ULONG)];
EXTERN MfwHdr * current_mfw_elem;

/*
+--------------------------------------------------------------------+
| PROJECT: MMI-Framework (8417)         MODULE: MFW_SS               |
| STATE  : code                         ROUTINE: ss_mfw_init         |
+--------------------------------------------------------------------+


   PURPOSE :

*/

void ss_mfw_init(void)
{
  EF_MSCAP mscap;
  EF_MSSUP mssup;
  EF_MSSET msset;
  UBYTE    version;

  /* Read the Mobile Capabilities from EEPROM */

  if (pcm_ReadFile((UBYTE *)EF_MSCAP_ID,
	               SIZE_EF_MSCAP,
				   (UBYTE *)&mscap,
				   &version) EQ PCM_OK)
  {
    ss_suport.speech = (UBYTE)FldGet(mscap.chnMode,spchSupV1);
    ss_suport.data   = (UBYTE)FldGet(mscap.datCap1,datSup);
    ss_suport.asyn   = (UBYTE)FldGet(mscap.datCap1,AsySup);
    ss_suport.syn    = (UBYTE)FldGet(mscap.datCap1,NTSynSup);
  }

  if (pcm_ReadFile((UBYTE *)EF_MSSUP_ID,
	               SIZE_EF_MSSUP,
				   (UBYTE *)&mssup,
				   &version) EQ PCM_OK)
  {
    ss_suport.aoc    = (UBYTE)FldGet(mssup.feat1,AoC);
    ss_suport.dtmf   = (UBYTE)FldGet(mssup.feat1,DTMF);
    ss_suport.cf     = (UBYTE)FldGet(mssup.feat1,CF);
    ss_suport.cb     = (UBYTE)FldGet(mssup.feat1,CB);
    ss_suport.ussd   = (UBYTE)FldGet(mssup.feat1,USSD);
    ss_suport.etc    = (UBYTE)FldGet(mssup.feat1,ETC);
  }

  if (pcm_ReadFile((UBYTE *)EF_MSSET_ID,
	               SIZE_EF_MSSET,
				   (UBYTE *)&msset,
				   &version) EQ PCM_OK)
  {
    ss_suport.clire   = (UBYTE)FldGet(msset.misc,clir);
    ss_suport.clipr   = (UBYTE)FldGet(msset.misc,clip);
  }

  pwd_flag = 0;
}

/*
+--------------------------------------------------------------------+
| PROJECT: MMI-Framework (8417)         MODULE: MFW_SS               |
| STATE  : code                         ROUTINE: ss_exit             |
+--------------------------------------------------------------------+


   PURPOSE :

*/

void ss_exit(void)
{
  TRACE_FUNCTION("ss_exit()");
}

/*
+--------------------------------------------------------------------+
| PROJECT: MMI-Framework (8417)         MODULE: MFW_SS               |
| STATE  : code                         ROUTINE: ss_create           |
+--------------------------------------------------------------------+


   PURPOSE :  create event for supplementary management

*/

T_MFW_HND ss_create(T_MFW_HND hWin, T_MFW_EVENT event, T_MFW_CB cbfunc)
{
  T_MFW_HDR *hdr;
  T_MFW_SS  *ss_para;
  MfwHdr * insert_status =0;
  
  TRACE_FUNCTION("ss_create()");

  hdr      = (T_MFW_HDR *) mfwAlloc(sizeof (T_MFW_HDR));
  ss_para  = (T_MFW_SS *) mfwAlloc(sizeof (T_MFW_SS));

  if (!hdr OR !ss_para)
  	{
    	TRACE_ERROR("ERROR: ss_create() Mem Alloc Failed.");
			
	   	if(hdr)
   			mfwFree((U8*)hdr,sizeof(MfwHdr));

   		if(ss_para)
   			mfwFree((U8*)ss_para,sizeof(T_MFW_SS));
   		
	   	return FALSE;
    }
  
  /*
   * initialisation of the handler
   */
  ss_para->emask   = event;
  ss_para->handler = cbfunc;

  hdr->data = ss_para;                           /* store parameter in node     */
  hdr->type = MFW_TYP_SS;                   /* store type of event handler */

  /*
   * installation of the handler
   */
  insert_status = mfwInsert((T_MFW_HDR *)hWin, hdr);
  
  if(!insert_status)
  	{
  		TRACE_ERROR("ERROR: ss_create() Failed to Install Handler. ");
   		mfwFree((U8*)hdr,sizeof(MfwHdr));
   		mfwFree((U8*)ss_para,sizeof(T_MFW_SS)); 	
		return 0;
  	}
    return insert_status;
}


/*
+--------------------------------------------------------------------+
| PROJECT: MMI-Framework (8417)         MODULE: MFW_SS               |
| STATE  : code                         ROUTINE: ss_delete           |
+--------------------------------------------------------------------+


   PURPOSE :   delete a event for supplementary management

*/

T_MFW_RES ss_delete(T_MFW_HND h)
{
  TRACE_FUNCTION("ss_delete()");

  if (!h OR !((T_MFW_HDR *)h)->data)
    return MFW_RES_ILL_HND;

  if (!mfwRemove((T_MFW_HDR *)h))
    return MFW_RES_ILL_HND;

  mfwFree((U8 *)(((T_MFW_HDR *) h)->data),sizeof(T_MFW_SS));
  mfwFree((U8 *)h,sizeof(T_MFW_HDR));

  return MFW_RES_OK;
}


/*
+--------------------------------------------------------------------+
| PROJECT: MMI-Framework (8417)         MODULE: MFW_SS               |
| STATE  : code                         ROUTINE: ss_sign_exec        |
+--------------------------------------------------------------------+


   PURPOSE : Send a signal if SS management handler.

*/

BOOL ss_sign_exec (T_MFW_HDR * cur_elem, T_MFW_EVENT event, T_MFW_SS_PARA * para)
{
  TRACE_FUNCTION ("ss_sign_exec()");

  while (cur_elem)
  {
    /*
     * event handler is available
     */
    if (cur_elem->type EQ MFW_TYP_SS)
    {
      T_MFW_SS * ss_data;
      /*
       * handler is SS management handler
       */
      ss_data = (T_MFW_SS *)cur_elem->data;
      if (ss_data->emask & event)
      {
        /*
         * event is expected by the call back function
         */
        ss_data->event = event;
        switch (event)
        {
          case E_SS_NOTIFY:
            memcpy (&ss_data->para.notify, para, sizeof (T_MFW_SS_NOTIFY));
            break;

          case E_SS_CF_CNF:
            memcpy (&ss_data->para.cf_cnf, para, sizeof (T_MFW_SS_CF_CNF));
            break;

          case E_SS_CB_CNF:
            memcpy (&ss_data->para.cb_cnf, para, sizeof (T_MFW_SS_CB_CNF));
            break;

          case E_SS_CW_CNF:
            memcpy (&ss_data->para.cw_cnf, para, sizeof (T_MFW_SS_CW_CNF));
            break;

          case E_SS_CLI_CNF:
            memcpy (&ss_data->para.cli_cnf, para, sizeof (T_MFW_SS_CLI_CNF));
            break;

          case E_SS_RES:
            memcpy (&ss_data->para.ss_res, para, sizeof (T_MFW_SS_RES));
            break;

          case E_SS_GET_PW:
            memcpy (&ss_data->para.pw_cnf, para, sizeof (T_MFW_SS_PW_CNF));
            break;

		  case E_SS_IMEI:
            memcpy (&ss_data->para.imei_info, para, sizeof (T_MFW_IMEI));
            break;

⌨️ 快捷键说明

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