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

📄 mmipins.c

📁 是一个手机功能的模拟程序
💻 C
📖 第 1 页 / 共 5 页
字号:

            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[100];

    T_EDITOR_DATA   editor_data;

    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 PUK1_REQ:		      //Text "Enter Puk "

    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:
        //begin of xsf add 2002.08.21          (1)
    case PUK1_REQ:              //Text "Enter Puk "
    case INPUT_NEW_PIN:
    case INPUT_NEW_PIN_AGAIN:
    case PIN1_REQ:            //Text "Enter Pin "
#ifdef _M188_    
    case NO_SIM_CARD:         //Text "No Sim Card "
#endif    
        //end of xsf add 2002.08.21
#ifdef _PINAUTOINPUT_
        if ( event==PIN1_REQ )
        {
            if ( IsReset()&&(IsFirstPinReq)&&(GetPinData(pin_data->old_pin)) )
            {
                IsFirstPinReq=0;
                //GetPinData(pin_data->old_pin); //ganchunhui move to the before
                winShow(pin_data->pin_win);  //xsf add for big capacity simcard(such as STK card) 12.25
                sim_verify_pin(MFW_SIM_PIN1,(char*)pin_data->old_pin);/* verification pin1 */
            }

            else
            {
                IsFirstPinReq=0;    //disable to get the pin from RAM
                main_call_mess(win,event);   
            }
        }
        else
        {
#endif
            IsFirstPinReq=0;    //disable to get the pin from RAM
            main_call_mess(win,event);
#ifdef _PINAUTOINPUT_
        }
#endif
        break; 
#if 0
    case PUK1_REQ:            //Text "Enter Puk "
        pins_loadEditDefault (&editor_data);

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

        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_edit_windows = editor_start(win, &editor_data);  /* start the editor */ 
        break;          

    case INPUT_NEW_PIN:
        pins_loadEditDefault (&editor_data);

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

        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_edit_windows = editor_start(win, &editor_data);  /* start the editor */ 
        break;          

    case INPUT_NEW_PIN_AGAIN:
        pins_loadEditDefault (&editor_data);

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

        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_edit_windows = editor_start(win, &editor_data);  /* start the editor */ 
        break;
    case PIN1_REQ:            //Text "Enter Pin "

        pins_loadEditDefault (&editor_data);

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

        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              = TxtEnterPin1;
        editor_data.Identifier          = PIN1_REQ;  
        editor_data.min_enter           = 4;
        editor_data.hide                = TRUE;

        /* create the dialog handler */
        pin_edit_windows = editor_start(win, &editor_data);  /* start the editor */ 
        break;

    case NO_SIM_CARD:         //Text "No Sim Card "

        pins_loadEditDefault (&editor_data);

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

        editor_data.editor_attr.text    = pin_data->edtbuf;  /* buffer to be edited */
        editor_data.editor_attr.size    = MIN_PIN;   /* limit to 3 digits */
        editor_data.LeftSoftKey         = TxtNull;      
        editor_data.RightSoftKey        = TxtDelete;
        editor_data.TextId              = TxtNoCard;
        editor_data.Identifier          = INSERT_CARD;  
        editor_data.min_enter           = 3;
        editor_data.destroyEditor       = FALSE;

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

#ifndef _M188_    
    case NO_SIM_CARD:         //Text "No Sim Card "
#endif    
    case INVALID_CARD:            //Text "Invalid SIM card " zy 0902 change

        pins_loadEditDefault (&editor_data);

        //clear the editor-buffer
        memset(pin_data->edtbuf,'\0',sizeof(pin_data->edtbuf));
#if(MAIN_LCD_SIZE==4)
        editor_data.editor_attr.win.px   = 10;  //xsf changed 6 to 10 2002.10.24 
        editor_data.editor_attr.win.py   = 124;  //30;	/* 2004/06/08 sunsj modify */
        editor_data.editor_attr.win.sx   = 90;  //108+4;
        editor_data.editor_attr.win.sy   = 18;  //60+10;	/* 2004/07/13 sunsj modify */
#elif(MAIN_LCD_SIZE==3)
		editor_data.editor_attr.win.px   = 10;  //xsf changed 6 to 10 2002.10.24 
        editor_data.editor_attr.win.py   = 90;  //30;	/* 2004/06/08 sunsj modify */
        editor_data.editor_attr.win.sx   = 90;  //108+4;
        editor_data.editor_attr.win.sy   = 18;  //60+10;	/* 2004/07/13 sunsj modify */
#endif
        editor_data.editor_attr.text    = pin_data->edtbuf;  // buffer to be edited 
        editor_data.editor_attr.size    = MAX_DIG;   // limit to 3 digits 
        editor_data.LeftSoftKey         = TxtNull;      
        editor_data.RightSoftKey        = TxtDelete;
        editor_data.TextId              = 0;//TxtInvalidCard; //2004-03-10 Sunny modified
        editor_data.Identifier          = CARD_REJECTED;  
        editor_data.min_enter           = 1;
        editor_data.destroyEditor       = FALSE;
        editor_data.edtInPbk            = 0;
        // create the dialog handler 
        MmiTrace("pin_main_timcreat");
        gtimeBlink=timCreate(win, 2000, (MfwCb)pin_charger_tim_cb);

        pin_edit_windows = editor_start(win, &editor_data);  // start the editor  

        break;


    case TXT_SIM_PLOCK:
        pin_data->pin_case = SIM_PLOCK;
        main_call_edit(win,SIM_PLOCK);             // Start: enter P unlock
        break;
    case TXT_SIM_SPLOCK:
        pin_data->pin_case = SIM_SPLOCK;
        main_call_edit(win,SIM_SPLOCK);            // Start: enter SP unlock
        break;
    case TXT_SIM_NLOCK:
        pin_data->pin_case = SIM_NLOCK;
        main_call_edit(win,SIM_NLOCK);             // Start: enter N unlock
        break;
    case TXT_SIM_CLOCK:
        pin_data->pin_case = SIM_CLOCK;
        main_call_edit(win,SIM_CLOCK);             // Start: enter C unlock
        break;
    case TXT_SIM_NSLOCK:
        pin_data->pin_case = SIM_NSLOCK;
        main_call_edit(win,SIM_NSLOCK);            // Start: enter NS unlock
        break;
        //begin of xsf add 2002.08.21   (2)
    case TXT_INVALID_CARD:
        pin_data->pin_case = CARD_REJECTED;
        main_call_edit(win,CARD_REJECTED);             // Start: enter only emerg call
        break;
    case TXT_NO_CARD:
        pin_data->pin_case = INSERT_CARD;
        main_call_edit(win,INSERT_CARD);           // Start: enter only emerg call
        break;
    case TXT_ENTER_PIN1:
        pin_data->pin_case = INPUT_PIN1;//enter PIN1 start
        main_call_edit(win,INPUT_PIN1);
        break;
    case TXT_ENTER_PUK1:
        pin_data->pin_case = INPUT_PUK1;//enter PUK1 start
        main_call_edit(win,INPUT_PUK1);
        break;
    case TXT_ENTER_NEW_PIN:
        pin_data->pin_case = INPUT_NEW_PIN;//enter new PIN start
        main_call_edit(win,INPUT_NEW_PIN);
        break;
    case TXT_ENTER_NEW_PIN_AGAIN:
        pin_data->pin_case = INPUT_NEW_PIN_AGAIN;
        main_call_edit(win,INPUT_NEW_PIN_AGAIN);// Start: enter New PIN1 again
        break;

    case PIN1_END:     //xsf (3)
        winShow(pin_data->pin_win);  //xsf add for big capacity simcard(such as STK card) 12.25

        sim_verify_pin(MFW_SIM_PIN1,(char*)pin_data->old_pin);/* verification pin1 */
        break;
    case NEW_PIN_END:
        sim_unblock_pin(MFW_SIM_PUK1, (char*)pin_data->puk, (char*)pin_data->new_pin);/* unblock pin1 */
        break;
        //end of xsf add 2002.08.21 case NEW_PIN_FAIL:

//		  case TXT_INVALID_CARD:
//				   pin_data->pin_case = CARD_REJECTED;
//				   main_call_edit(win,CARD_REJECTED);		      // Start: enter only emerg call
//				   break;
//		  case TXT_NO_CARD:
//				   pin_data->pin_case = INSERT_CARD;
//				   main_call_edit(win,INSERT_CARD);		      // Start: enter only emerg call
//				   break;



//		  case PIN1_END:
//				   winShow(pin_data->parent_win);
//				   sim_verify_pin(MFW_SIM_PIN1,(char*)pin_data->pin);	 /*verification pin1 */
//				   break;

    }

    switch ( event )
    {
    case PIN_OK_INFO: // PIN was needed
    case PIN_OK:      // PIN wasn't needed
        check_plock_to_clock(win,event);/* start sim lock procedure   */
        break;
    case PIN_OK_END:  // PIN was needed and pin1 entered correctly
        //U8 uMode;
        // registration in full service mode case: PIN was  necessary
        //uMode = dspl_Enable(0);
        vSavePinData(pin_data->old_pin);   //save data in the ram 2003/3/21
        TRACE_EVENT("xsfxsf pin_destroy 2");
#ifdef _PINAUTOINPUT_
        if ( (!IsReset())&&(CheckPassWord(PRO_ON) || CheckPassWord(PRO_SIMLOCK)) )
#else
        if ( (CheckPassWord(PRO_ON) || CheckPassWord(PRO_SIMLOCK)) )
#endif
        {
            if ( CheckPassWord(PRO_ON) )
            {
                hostkey_init(0);    //xsf 2002.05.15
            }
            else if ( CheckPassWord(PRO_SIMLOCK) )
            {
                if ( FlashHostkeyData.SimLockFlag==0 )
                {
                    showwelcome(idle_get_window());
                    //Pin1OKOrNoPin1();  //xsf add 2002.10.09
                    //network_start_full_service ();
                    ReadSimIMSI();
                }
                else
                    JudgeSim();            
            }
        }
        else
        {
            /* SH - show welcome screen */
            TRACE_EVENT("xsfxsf pin_main():showwelcome()");
            showwelcome(idle_get_window());
            //Pin1OKOrNoPin1();  //xsf add 2002.10.09
            //network_start_full_service ();
        }
/* NM, 110702
   this destroy the only ONE SIM-handler which we have 
   after switching on !!
   It should be at least one SIM-handler activ all the  time 
                pin_destroy(pin_data->pin_win);// finish main pin dialog
*/

        //windowsUpdate();
        //dspl_Enable(uMode);			    		
        break;
        //begin of xsf add 2002.08.21
    case SETT_ABORT:
        dspl_ClearAll();
        pin_destroy(pin_data->pin_win);// destroy pin settings dialog
        break;
        //end of xsf add 2002.08.21
//nm insert new one
    case PIN1_STATUS_END:
        pin_destroy(pin_data->pin_win);// finish main pin dialog
        TRACE_EVENT("pin_destroy 3");
        break;
//nm		       
    case TXT_SIM_LOCK_ALL:
        pin_destroy(pin_data->pin_win);// finish main pin dialog
        TRACE_EVENT("pin_destroy 4");
        break;
    case PUK1_UNBL_SUCC:
        if ( (pin_data->pin_case EQ PUK1_END) || (pin_data->gsm_state && (pin_data->pin_case EQ INPUT_PUK1)) )
        /*	 sim lock check only after power on and puk verified */
        /* by PUK (normal way) or by gsm unblock string */
        {
            check_plock_to_clock(win,event);
        }
        else
        {

            main_call_mess(win,event);         

        }
        break;

⌨️ 快捷键说明

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