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

📄 mmipins.c

📁 是一个手机功能的模拟程序
💻 C
📖 第 1 页 / 共 5 页
字号:
    pin_windows = data->pin_win;
    pin_edit_windows = NULL;
    pin_mess_windows = NULL;

    TRACE_FUNCTION("MmiPins:pin_create");

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

    /*
     * Create window handler
     */
    data->mmi_control.dialog    = (T_DIALOG_FUNC)pin_main;/* dialog main function    */
    data->mmi_control.data      = data;
    data->parent_win = parent_window;
    win                 = ((T_MFW_HDR *)data->pin_win)->data;
    win->user           = (void *) data;


    /*
     * Create any other handler
     */

    data->sim_handle = sim_create(data->pin_win,E_SIM_ALL_SERVICES,(MfwCb)sim_event_cb_main);

    /*
     * return window handle
     */

    mfwSetSignallingMethod(1);//mfw focus handling
    winShow(data->pin_win);


    return data->pin_win;
}


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

 $Function:	pin_destroy

 $Description:	Destroy the pin dialog.
 $Returns:		None

 $Arguments:	window
 
*******************************************************************************/
void pin_destroy  (T_MFW_HND own_window)
{

    T_pin *      data;
    T_MFW_WIN *   win;

    TRACE_FUNCTION("MmiPins:pin_destroy");

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

        if ( data )
        {
            /*
             * Exit SIM and Delete SIM Handler
             */
            sim_delete (data->sim_handle);

            /*
             * Delete WIN Handler
             */
            win_delete (data->pin_win);
            pin_windows = 0;
            // + KGT 19.7.2000
            //mfwFree((U8 *)data,(sizeof(T_pin)));
            FREE_MEMORY((void *)data,(sizeof(T_pin)));
            // - KGT 19.7.2000
        }
    }
}


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

 $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)
{ 
    if ( event EQ MfwWinVisible )
    {   
#if(MAIN_LCD_SIZE==4)
		DRAW_ICON_SEL(ICON_SWITCHON, 0);
#endif
    	//dspl_BitBlt(0, 0, 102, 80, 0, (void*)pin_wait, 0);*///jhxu720 delete
        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_EVENT(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_EVENT("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, TxtSim, TxtNotReady, NULL,REMIND_NORECORD); 
        /*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_EVENT("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_EVENT("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_EVENT("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_EVENT("sim_event_cb_main:no Pin");
                mmi_cphs_refresh();
                if ( sim_pin_count(MFW_SIM_PIN1) EQ 0 ) //xsf add 2003.04.11
                    SEND_EVENT(pin_data->pin_win,PUK1_REQ_ACT_INFO,0,pin_data);
                else
                    SEND_EVENT(pin_data->pin_win,PIN_OK, 0, NULL);//back to idle
                break;

                /*
                 * SIM card is broken
                 */
            case MFW_SIM_INVALID_CARD:
                TRACE_EVENT("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_EVENT("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_EVENT("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_EVENT("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_EVENT("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_EVENT("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_EVENT("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_EVENT("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_EVENT("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_EVENT("sim_event_cb_main:unblock failure");
                SEND_EVENT(pin_data->pin_win,PUK1_UNBL_FAIL_INFO,0,pin_data);
                break;
            case MFW_SIM_SUCCESS:
                vSavePinData(pin_data->new_pin);   //save data in the RAM  GANCHH 2003/3/21
                TRACE_EVENT("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_EVENT("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_EVENT("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;

⌨️ 快捷键说明

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