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

📄 mmipins.c

📁 GSM手机设计软件代码
💻 C
📖 第 1 页 / 共 5 页
字号:
      win_delete (data->pin_win);
	  pin_windows = 0;
	  FREE_MEMORY((void *)data,(sizeof(T_pin)));
	 }
  }
}


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

 $Function:	pin_win_cb

 $Description:	Callback function for windows
 $Returns:		Status int
 $Arguments:	window handler event, window
 
*******************************************************************************/
static int pin_win_cb (T_MFW_EVENT event, T_MFW_WIN * win)
{ char debug[50];

	sprintf(debug, "pin_win_cb: %d", event);

  TRACE_FUNCTION(debug);
  if (event EQ MfwWinVisible)
  {
    dspl_ClearAll();
	return 1;
  }
  return 0;
}




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

 $Function:	sim_event_cb_main

 $Description:	PURPOSE : SIM event handler for Pins
 $Returns:		Status int
 $Arguments:	window handler event, sim status
 
*******************************************************************************/
int sim_event_cb_main (T_MFW_EVENT event, T_MFW_HND para)
{
/**********************/
#define NO_ACTION	0

BYTE reconf_handling = NO_ACTION;
BYTE reconf_defreeze_display = 1;
/*********************/

	T_MFW_SIM_STATUS * status;
	UBYTE limited;

    T_MFW_HND win = mfw_parent(mfw_header());


	T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;

	T_pin * pin_data = (T_pin *)win_data->user;
	char debug[50];

	status = (T_MFW_SIM_STATUS *)para;

    limited = TRUE;			/* initial limited mode     */
	sprintf(debug, "sim event handler,event:%d, status:%d, proc:%d",event, status->sim_status, status->sim_procedure);
	TRACE_FUNCTION(debug);
 switch(event)
 {
	case E_SIM_INSERTED:	/*  there not handled */
	    return 0;		/* (handled in sim_rem dialog, commented out currently */


	//GW-SPR#1035-Added STK Changes
	case E_SIM_RESET:	
	    TRACE_FUNCTION("E_SIM_RESET");
		/*NM, 110702
			the MM-entity initated the de-registration already (MMI dont have to do it); 
			after this event we should avoid any cases to access the SIM
			(e.g. reading phonebook, reading sms....)
			
			- how to do it ???
			->  unset the "sms_initialised" flag to FALSE

			- when does it set back to TRUE ???
			-> the flag will be set after the event "E_SMS_READY"
		*/	
			smsidle_unset_ready_state ();
			info_screen(0, TxtSimNot, TxtReady, NULL); 
		/*NM, 110702 END*/
	    return 0;		
	    

	case E_SIM_STATUS:
	  /*
	   * check whether decoded message is available
	   */
		if( para EQ (T_MFW_SIM_STATUS *)NULL )
		   return MFW_RES_ILL_HND;

		status = (T_MFW_SIM_STATUS *)para;


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


		 switch (status->sim_procedure)
		 {
		/*
		 * Initial activation of the SIM card
		 */
			case MFW_SIM_ACTIVATION:
		  /*
		   * check the result of activation
		   */
			  switch (status->sim_status)
			  {
			/*
			 * PIN 1 must be entered
			 */
					case MFW_SIM_PIN_REQ:
						if(status->sim_pin_retries < PIN_ENTRY_MAX)
						{
							TRACE_FUNCTION("sim_event_cb_main:PIN1 req-retr");
							pin_data->pin_retries = status->sim_pin_retries;/* number of retries */
							SEND_EVENT(pin_data->pin_win,PIN1_REQ_ATT,0,pin_data);
						}
						else
						{

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

							TRACE_FUNCTION("sim_event_cb_main:PIN1 req");
							SEND_EVENT(pin_data->pin_win,PIN1_REQ,0,pin_data);
						}
						break;

			/*
			 * SIM card is blocked, PUK 1 is needed
			 */
					case MFW_SIM_PUK_REQ:
							TRACE_FUNCTION("sim_event_cb_main:PUK1 req");
							SEND_EVENT(pin_data->pin_win,PUK1_REQ_ACT_INFO,0,pin_data);
						break;

			/*
			 * no PIN is needed
			 */
					case MFW_SIM_NO_PIN:
						limited = FALSE;
						TRACE_FUNCTION("sim_event_cb_main:no Pin");
						mmi_cphs_refresh();
						SEND_EVENT(pin_data->pin_win,PIN_OK, 0, NULL);//back to idle
						break;

			/*
			 * SIM card is broken
			 */
					case MFW_SIM_INVALID_CARD:
						TRACE_FUNCTION("sim_event_cb_main: invalid card");
						SEND_EVENT(pin_data->pin_win,INVALID_CARD, 0, pin_data);
						break;

			/*
			 * No SIM card is inserted
			 */
					case MFW_SIM_NO_SIM_CARD:
						TRACE_FUNCTION("sim_event_cb_main: no SIM Card");
						SEND_EVENT(pin_data->pin_win,NO_SIM_CARD, 0, pin_data);
						break;
					default:
						return 0;
			  }
		  /*
		   * start limited or full service */

			  if (limited)
			  {
			/*
			 * limited shall be the requested service
			 * if no service is reached, the limited
			 * service is requested*/

					if (nm_reg_status() EQ NOT_PRESENT_8BIT
						AND
						status->sim_procedure EQ MFW_SIM_ACTIVATION)
						{
							TRACE_FUNCTION("registration in limited mode ");
							nm_registration (NM_AUTOMATIC, 0, TRUE);
						}
			  }
			break;
			case MFW_SIM_VERIFY:
		  /*
		   * check the result of verify
		   */
			  switch (status->sim_status)
			  {
			/*
			 * PIN 1 must be entered
			 */
					case MFW_SIM_PIN_REQ:
					if(status->sim_pin_retries < PIN_ENTRY_MAX)
					{
							TRACE_FUNCTION("sim_event_cb_main:Ver:PIN1 req-retr");
							pin_data->pin_retries = status->sim_pin_retries;
							SEND_EVENT(pin_data->pin_win,PIN1_REQ_ATT,0,pin_data);
					}
					else
					{
							TRACE_FUNCTION("SimEventPins:V:PIN1 req");
							SEND_EVENT(pin_data->pin_win,PIN1_REQ,0,pin_data);
					}
					break;
			/*
			 * SIM card is blocked, PUK 1 is needed
			 */
					case MFW_SIM_PUK_REQ:
						TRACE_FUNCTION("SimEventPins:V:PUK1 req");
						SEND_EVENT(pin_data->pin_win,PUK1_REQ_VER_INFO,0,pin_data);
						break;

			/*
			 * PIN entering successfull
			 */
					case MFW_SIM_NO_PIN:
						TRACE_FUNCTION("sim_event_cb_main:PIN ok without sim unlock");
						mmi_cphs_refresh();
						pin_data->pin_case = PIN_OK_INFO;
						if (pin_data->set_state == PIN2_CHECK)
						{
							set_mode_fdn_adn(win,pin_data);
						}
						SEND_EVENT(pin_data->pin_win,PIN_OK_INFO,0,pin_data);
						break;
			/*
			 * SIM card is broken
			 */
					case MFW_SIM_INVALID_CARD:
						TRACE_FUNCTION("sim_event_cb_main: invalid card");
						SEND_EVENT(pin_data->pin_win,INVALID_CARD, 0, pin_data);
						break;

			/*
			 * No SIM card is inserted
			 */
					case MFW_SIM_NO_SIM_CARD:
						TRACE_FUNCTION("sim_event_cb_main: no SIM Card");
						SEND_EVENT(pin_data->pin_win,NO_SIM_CARD, 0, pin_data);
						break;
					default:
						return 0;
			  }
			break;
			/*
			 * response to PUK entering
			 */
			case MFW_SIM_UNBLOCK:
			  switch (status->sim_status)
			  {
				case MFW_SIM_PUK_REQ:
					TRACE_FUNCTION("sim_event_cb_main:unblock failure");
					SEND_EVENT(pin_data->pin_win,PUK1_UNBL_FAIL_INFO,0,pin_data);
					break;
				case MFW_SIM_SUCCESS:
					TRACE_FUNCTION("sim_event_cb_main:unblock success");
					mmi_cphs_refresh();
					SEND_EVENT(pin_data->pin_win,PUK1_UNBL_SUCC,0,pin_data);
					break;
				case MFW_SIM_FAILURE:
					TRACE_FUNCTION("sim_event_cb_main:unblock fatal error");
					SEND_EVENT(pin_data->pin_win,PUK1_UNBL_FATAL_ERROR,0,pin_data);
					break;				
				case MFW_SIM_INVALID_CARD:
					TRACE_FUNCTION("sim_event_cb_main:unblock failed, no more retries");
					SEND_EVENT(pin_data->pin_win,INVALID_CARD,0,pin_data);
					break;
				default:
					return 0;
			  }
			break;

			case MFW_SIM_REMOVED:/*  there not handled */
				return 0;	 /* (handled in sim_rem dialog, commented out currently */
			default:
				return 0;
		 }

	return 1;
	#ifdef BMI_TEST_MC_SIM_EVENT
	break;
	case BMI_TEST_MC_SIM_EVENT:
	{
		T_MFW_READ_CALLBACK* sim_read_data;

		sim_read_data = (T_MFW_READ_CALLBACK*)para;

		TRACE_EVENT_P3("SIM READ Error: %d, %x%x", sim_read_data->error_code,
			sim_read_data->read_buffer[0], sim_read_data->read_buffer[1]);
	}
	break;
	#endif
  }
}


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

 $Function:	pin_main

 $Description:	PIN MAIN Dialog Handling function
 $Returns:		void
 $Arguments:	window, window handler event, value, parameters
 
*******************************************************************************/
static void pin_main(T_MFW_HND win, USHORT event, SHORT value, void * parameter)
{
	T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
	T_pin * pin_data = (T_pin *)win_data->user;//pin main data
	T_pin_mess * mess_data = (T_pin_mess *) parameter;//pin message data
	T_pin_edt * edt_data = (T_pin_edt *) parameter;//pin editor data
	char debug[20];

#ifdef NEW_EDITOR
	T_AUI_EDITOR_DATA editor_data;	/* SPR#1428 - SH - New Editor data */
#else
	T_EDITOR_DATA	editor_data;
#endif

	sprintf(debug,"MmiPins:pin_main: %d", event);
	TRACE_FUNCTION(debug);

	 switch(event)
	 {

		  case PIN1_STATUS:		    //Text "Pin disabled" or "enabled"
		  case PIN1_REQ_ATT:		    //info screen "xx attempts "
		  case PUK1_REQ_ACT_INFO:	    //info screen "SIM blocked "
		  
		  case GSM_FAIL:		    // gsm not allowed
		  case NEW_PIN_FAIL:		    // new pin failed
		  case PUK1_REQ_VER_INFO:	    // Text "Pin blocked "
		  case PUK1_UNBL_FAIL_INFO:	    // unblock error - new puk requ
		  case PUK1_UNBL_FATAL_ERROR:
		  
		 
		  case SIM_UNLOCK_OK:		    //Text "Unlock ok "
		  case SIM_LOCK_ERR:
				   main_call_mess(win,event);
				   break; 
			case PUK1_REQ:			  //Text "Enter Puk "
				//clear the editor-buffer
				memset(pin_data->edtbuf,'\0',sizeof(pin_data->edtbuf));

			/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
				pins_loadEditDefault (&editor_data, TxtEnterPuk1, PUK1_REQ);
				AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, (UBYTE *)pin_data->edtbuf, MAX_PIN+1);
				pin_editor_window = AUI_pin_Start(win, &editor_data);
#else /*NEW_EDITOR */
				pins_loadEditDefault (&editor_data);

				editor_data.editor_attr.text	= pin_data->edtbuf;  /* buffer to be edited */
				editor_data.editor_attr.size	= MAX_PIN + 1;	 /* limit to 8 digits */
				editor_data.LeftSoftKey 		= TxtSoftOK;	    
				editor_data.RightSoftKey		= TxtDelete;
				editor_data.TextId				= TxtEnterPuk1;
				editor_data.Identifier			= PUK1_REQ;  
				editor_data.min_enter		    = 4;
				editor_data.hide			    = TRUE;

				/* create the dialog handler */
				pin_editor_window = editor_start(win, &editor_data);  /* start the editor */
#endif	/*NEW_EDITOR */
			break;			

			case INPUT_NEW_PIN:
				//clear the editor-buffer
				memset(pin_data->edtbuf,'\0',sizeof(pin_data->edtbuf));

			/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
				pins_loadEditDefault (&editor_data, TxtEnterNewPin, INPUT_NEW_PIN);
				AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, (UBYTE *)pin_data->edtbuf, MAX_PIN+1);
				pin_editor_window = AUI_pin_Start(win, &editor_data);
#else /*NEW_EDITOR */
				pins_loadEditDefault (&editor_data);

				editor_data.editor_attr.text	= pin_data->edtbuf;  /* buffer to be edited */
				editor_data.editor_attr.size	= MAX_PIN + 1;	 /* limit to 8 digits */
				editor_data.LeftSoftKey 		= TxtSoftOK;	    
				editor_data.RightSoftKey		= TxtDelete;
				editor_data.TextId				= TxtEnterNewPin;
				editor_data.Identifier			= INPUT_NEW_PIN;  
				editor_data.min_enter		    = 4;
				editor_data.hide			    = TRUE;

				/* create the dialog handler */
				pin_editor_window = editor_start(win, &editor_data);  /* start the editor */ 
#endif /*NEW_EDITOR */
			break;			

			case INPUT_NEW_PIN_AGAIN:
				//clear the editor-buffer
				memset(pin_data->edtbuf,'\0',sizeof(pin_data->edtbuf));
				/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
				pins_loadEditDefault (&editor_data, TxtConfPin, INPUT_NEW_PIN_AGAIN);

				AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, (UBYTE *)pin_data->edtbuf, MAX_PIN+1);
				pin_editor_window = AUI_pin_Start(win, &editor_data);
#else /*NEW_EDITOR */
				pins_loadEditDefault (&editor_data);
				
				editor_data.editor_attr.text	= pin_data->edtbuf;  /* buffer to be edited */
				editor_data.editor_attr.size	= MAX_PIN + 1;	 /* limit to 8 digits */
				editor_data.LeftSoftKey 		= TxtSoftOK;	    
				editor_data.RightSoftKey		= TxtDelete;
				editor_data.TextId				= TxtConfPin;
				editor_data.Identifier			= INPUT_NEW_PIN_AGAIN;	
				editor_data.min_enter		    = 4;
				editor_data.hide			    = TRUE;

				/* create the dialog handler */
				pin_editor_window = editor_start(win, &editor_data);  /* start the editor */ 
#endif /* NEW_EDITOR */
				break;
				
		  case PIN1_REQ:		    //Text "Enter Pin "
				TRACE_FUNCTION("PIN1_REQ");
				//clear the editor-buffer
				memset(pin_data->edtbuf,'\0',sizeof(pin_data->edtbuf));
				/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
				pins_loadEditDefault (&editor_data, TxtEnterPin1, PIN1_REQ);

⌨️ 快捷键说明

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