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

📄 mmiaoc.c

📁 GSM手机设计软件代码
💻 C
📖 第 1 页 / 共 3 页
字号:
/*******************************************************************************

					CONDAT (UK)

********************************************************************************                                                                              

 This software product is the property of Condat (UK) Ltd and may not be
 disclosed to any third party without the express permission of the owner.                                 
                                                                              
********************************************************************************

 $Project name:	Basic MMI                                                      
 $Project code:	BMI (6349)                                                           
 $Module:		Advice of Charge
 $File:		    MmiVoiceMemo.c
 $Revision:		1.0                                                       
                                                                              
 $Author:		Condat(UK)                                                         
 $Date:		    09/04/01                                                      
                                                                               
********************************************************************************
                                                                              
 Description:

    This provides the start code for the MMI
                        
********************************************************************************
 $History: MmiAoc.c

	09/04/01			Original Condat(UK) BMI version.	
	   
 $End

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




/*******************************************************************************
                                                                              
                                Include files
                                                                              
*******************************************************************************/

#define ENTITY_MFW

/* includes */
#include <string.h>
#include <stdio.h>
#include <stdlib.h>

#if defined (NEW_FRAME)

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

#else

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

#endif
#include "mfw_sys.h"

#include "p_sim.h"
#include "cus_aci.h"

#include "mfw_mfw.h"
#include "mfw_win.h"
#include "mfw_kbd.h"
/* SPR#1428 - SH - New Editor changes */
#ifndef NEW_EDITOR
#include "mfw_edt.h"
#endif
#include "mfw_lng.h"
#include "mfw_tim.h"
#include "mfw_icn.h"
#include "mfw_mnu.h"
#include "mfw_phb.h"
#include "mfw_cm.h"
#include "mfw_sim.h"
#include "mfw_nm.h"
#include "mfw_sat.h"
#include "mfw_ss.h" /*for convert*/
#include "mfw_phb.h"
#include "ksd.h"
#include "psa.h"
#include "mfw_sms.h"
#include "mfw_cphs.h"
#include "mfw_sat.h"

#include "dspl.h"


#include "MmiMmi.h"
#include "MmiDummy.h"
#include "MmiDialogs.h"
/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
#include "ATBCommon.h"
#include "ATBDisplay.h"
#include "ATBEditor.h"
#include "AUIEditor.h"
#else /* NEW_EDITOR */
#include "MmiEditor.h"
#endif /* NEW_EDITOR */
#include "MmiLists.h"
#include "MmiIdle.h"
#include "MmiSoftkeys.h"
#include "MmiIcons.h"
#include "MmiMenu.h"
#include "MmiMain.h"
#include "MmiStart.h"
#include "MmiPins.h"

#include "mmicolours.h"




/*******************************************************************************
	Local Data
 
*******************************************************************************/
#define	PIN_REQUEST_FOR_RATE			700
#define	SERVICES_ENTER_CURRENCY			701
#define	SERVICES_ONE_UNIT				702
#define	SERVICES_RATE_CHANGED			703
#define	SERVICES_CREDIT_REMAINING		704
#define	PIN_REQUEST_FOR_LIMIT_CHANGE	705
#define	PIN_REQUEST_FOR_LIMIT_CANCEL	706
#define	SERVICES_LIMIT_VIEW				707
#define	SERVICES_LIMIT_CHANGE			708
#define	SERVICES_LIMIT_CANCEL			709
#define	SERVICES_LIMIT_CHANGED			710
#define	SERVICES_LAST_CHARGE			711
#define	SERVICES_TOTAL_CHARGE			712
#define	SERVICES_RESET_CHARGE			713
#define	SERVICES_CHARGE_CHANGED			714
#define	SERVICES_OUT_OF_RANGE			715
#define	SERVICES_AOC_NOT_SUPPORTED		716
#define PIN_REQUEST_FOR_RESET_CHARGE  717


/* Max. Enter of Character   */
#define MAX_ENTER_LIMIT      7
#define MAX_ENTER_CURRENCY   4
#define MAX_ENTER_UNIT       6
/*    */



typedef struct
{
	T_MMI_CONTROL			mmi_control;
	T_MFW_HND				service_win;        /* MFW win handler      */
	T_MFW_CM_AOC_INFO		aocInfo;
	USHORT					Identifier;
	char					edt_Buf[30]; 	  /* Editor buffer       */
} T_SERVICES;




LONG acm_last_call = 0; //accumulated call meter  from the last call
//later the value should save and read again from PCM


/*******************************************************************************
	Local prototypes
 
*******************************************************************************/
T_MFW_HND	service_Init		(T_MFW_HND parent_window);
void		service_Exit		(T_MFW_HND own_window);
T_MFW_HND	service_create		(T_MFW_HND parent_window);
void		service_destroy		(T_MFW_HND own_window);
static int	service_win_cb		(T_MFW_EVENT event, T_MFW_WIN * win);
void		service_dialog_cb	(T_MFW_HND win, USHORT identifier, UBYTE reason);
void		service				(T_MFW_HND win, USHORT event, SHORT value, void * parameter);
/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
void		service_loadEditDefault (T_AUI_EDITOR_DATA *editor_data);
#else /* NEW_EDITOR */
void		service_loadEditDefault (T_EDITOR_DATA *editor_data);
#endif /* NEW_EDITOR */
void		service_calc_balance   (T_MFW_HND win,char* line);
void		service_calculate	(T_MFW_HND win, char* line, long value);
USHORT		service_check_pin_for_aoc (void);

/*******************************************************************************
	Functions
 
*******************************************************************************/

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

 $Function:    	aoc_credit_remaining

 $Description:	
            
 $Returns:		

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

int aoc_credit_remaining (MfwMnu* m, MfwMnuItem* i)
{
     T_MFW_HND win = mfw_parent(mfw_header());

	TRACE_FUNCTION("aoc_credit_remaining")

	// create new dynamic dialog for the AOC
    SEND_EVENT (service_Init (win), SERVICES_CREDIT_REMAINING, 0, 0);


	return 0;
}



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

 $Function:    	aoc_charge_rate

 $Description:	A security code editing screen is opened and Pin 2 requested.
				Once entered successfully, an alpha. editor is opened with the 
				title "Enter currency".Once entered, an numeric editor is opened
				with the title "Enter price p. unit". When the user has finished 
				entry the information screen " Rate changed" is displayed for 
				3 second and the phone returns to the previous sub-menu
 $Returns:		

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


int aoc_charge_rate (MfwMnu* m, MfwMnuItem* i)
{
    T_MFW_HND win = mfw_parent(mfw_header());

	TRACE_FUNCTION("aoc_charge_rate")

	switch (service_check_pin_for_aoc ())
	{
		case MFW_SIM_PIN2_REQ:	
			// create new dynamic dialog for the AOC
		    SEND_EVENT (service_Init (win), PIN_REQUEST_FOR_RATE, 0, 0);
			break;	

		case MFW_SIM_PIN_REQ:
		case MFW_SIM_NO_PIN:
			//pin 1 or no pin required, open now the editor for entering the currency
			SEND_EVENT (service_Init (win),  SERVICES_ENTER_CURRENCY, 0, 0);
			break;

	}
			
	return 0;
}



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

 $Function:    	aoc_view_limit

 $Description:	
            
 $Returns:		

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


int aoc_view_limit (MfwMnu* m, MfwMnuItem* i)
{
    T_MFW_HND win = mfw_parent(mfw_header());

	TRACE_FUNCTION("aoc_charge_rate")

	// create new dynamic dialog for the AOC
    SEND_EVENT (service_Init (win), SERVICES_LIMIT_VIEW, 0, 0);

	return 0;
}


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

 $Function:    	aoc_change_limit

 $Description:	
            
 $Returns:		

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


int aoc_change_limit (MfwMnu* m, MfwMnuItem* i)
{
    T_MFW_HND win = mfw_parent(mfw_header());

	TRACE_FUNCTION("aoc_charge_rate")

	// create new dynamic dialog for the AOC
    SEND_EVENT (service_Init (win), PIN_REQUEST_FOR_LIMIT_CHANGE, 0, 0);


	return 0;
}


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

 $Function:    	aoc_cancel_limit

 $Description:	
            
 $Returns:		

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


int aoc_cancel_limit (MfwMnu* m, MfwMnuItem* i)
{
    T_MFW_HND win = mfw_parent(mfw_header());

	TRACE_FUNCTION("aoc_charge_rate")

	// create new dynamic dialog for the AOC
    SEND_EVENT (service_Init (win), PIN_REQUEST_FOR_LIMIT_CANCEL, 0, 0);


	return 0;
}

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

 $Function:    	aoc_last_charge

 $Description:	Dispays the charge for the last call in the currency or in units
                if no currency information has been entered
            
 $Returns:		

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


int aoc_last_charge (MfwMnu* m, MfwMnuItem* i)
{
    T_MFW_HND win = mfw_parent(mfw_header());

	TRACE_FUNCTION("aoc_charge_rate")

	// create new dynamic dialog for the AOC
    SEND_EVENT (service_Init (win), SERVICES_LAST_CHARGE, 0, 0);


	return 0;
}

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

 $Function:    	aoc_total_charge

 $Description:	Displays the charge for all calls since the chage counter was last reset
            
 $Returns:		

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


int aoc_total_charge (MfwMnu* m, MfwMnuItem* i)
{
    T_MFW_HND win = mfw_parent(mfw_header());

	TRACE_FUNCTION("aoc_charge_rate")

	// create new dynamic dialog for the AOC
    SEND_EVENT (service_Init (win), SERVICES_TOTAL_CHARGE, 0, 0);


	return 0;
}
/*******************************************************************************

 $Function:    	aoc_reset_charge

 $Description:	Resets the charge counter for all calls
            
 $Returns:		

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


int aoc_reset_charge (MfwMnu* m, MfwMnuItem* i)
{
    T_MFW_HND win = mfw_parent(mfw_header());

	TRACE_FUNCTION("aoc_charge_rate")

  switch (service_check_pin_for_aoc ())
  {
    case MFW_SIM_PIN2_REQ:
      // create new dynamic dialog for the AOC
        SEND_EVENT (service_Init (win), PIN_REQUEST_FOR_RESET_CHARGE, 0, 0);
      break;

    case MFW_SIM_PIN_REQ:
    case MFW_SIM_NO_PIN:
      //pin 1 or no pin required, open now the editor for entering the currency
    SEND_EVENT (service_Init (win), SERVICES_RESET_CHARGE, 0, 0);

      break;
  }

	return 0;
}






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

 $Function:    	service_Init

 $Description:	

 $Returns:		

 $Arguments:	
 
*******************************************************************************/
T_MFW_HND service_Init (T_MFW_HND parent_window)
{
  return (service_create (parent_window));
}


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

 $Function:    	service_Exit

 $Description:	

 $Returns:		

 $Arguments:	
 
*******************************************************************************/
void service_Exit (T_MFW_HND own_window)
{

    T_MFW_WIN   * win_data     = ((T_MFW_HDR *)own_window)->data;
    T_SERVICES     * data         = (T_SERVICES *)win_data->user;

  service_destroy (data->service_win);
}

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

 $Function:    	service_create

 $Description:	

 $Returns:		

 $Arguments:	
 
*******************************************************************************/
T_MFW_HND service_create (T_MFW_HND parent_window)
{
  T_SERVICES *  data = (T_SERVICES *)ALLOC_MEMORY (sizeof (T_SERVICES));
  T_MFW_WIN   * win;


  TRACE_FUNCTION ("service_create()");

  data->service_win = win_create (parent_window, 0, 0, (T_MFW_CB)service_win_cb);

  if (data->service_win EQ 0)
    return 0;

  /*
   * Create window handler
   */
  data->mmi_control.dialog =  (T_DIALOG_FUNC)service;
  data->mmi_control.data   = data;
  win                      = ((T_MFW_HDR *)data->service_win)->data;
  win->user                = (void *) data;

 
  winShow(data->service_win);
  /*
   * return window handle
   */
  return data->service_win;
}

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

 $Function:    	service_destroy

 $Description:	

 $Returns:		

 $Arguments:	
 
*******************************************************************************/
void service_destroy (T_MFW_HND own_window)
{
  T_MFW_WIN   * win;
  T_SERVICES * data;

  TRACE_FUNCTION ("service_destroy()");

  if (own_window)
  {
    win  = ((T_MFW_HDR *)own_window)->data;
    data = (T_SERVICES *)win->user;

    if (data)
    {

      /*
       * Delete WIN handler

⌨️ 快捷键说明

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