示例#1
0
/* For BT2.0 and 2.1 SIMAP Usage */
void mmi_bth_simap_authorize_ind(void* msg)
{
    /* In this case: it is applied for after BT Profile v2.1 and is requested by operator */
    bt_simap_auth_req_struct* bt_simap_auth_req = (bt_simap_auth_req_struct*)msg;
    U8* name = NULL;
	U8 bd_addr[6];
    S32 conn_id;

    MMI_TRACE(MMI_CONN_TRC_G7_BT, MMI_SIMAP_AUTHORIZE_IND, g_mmi_simap_cntx_p->state);
    switch (g_mmi_simap_cntx_p->state)
    {
        case MMI_BTH_SIMAP_STAT_ACTIVATE:
        {
            if (!srv_ucm_is_any_call() && srv_sim_ctrl_any_sim_is_available())
    		{
				g_mmi_simap_cntx_p->used_sim_id = 0;
                g_mmi_simap_cntx_p->bt_addr.lap = bt_simap_auth_req->lap;
                g_mmi_simap_cntx_p->bt_addr.uap = bt_simap_auth_req->uap;
                g_mmi_simap_cntx_p->bt_addr.nap = bt_simap_auth_req->nap;

				CONVERT_BDADDR2ARRAY(bd_addr, bt_simap_auth_req->lap, bt_simap_auth_req->uap, bt_simap_auth_req->nap);
    			name = BTBMGetLocalStoredName(bd_addr);
				
                conn_id = srv_bt_cm_start_conn(MMI_TRUE, SRV_BT_CM_SIM_ACCESS_PROFILE_UUID, &g_mmi_simap_cntx_p->bt_addr, (CHAR* )name);
		        if (conn_id < 0)
		        {
		            mmi_bt_simap_authorize_rsp(&g_mmi_simap_cntx_p->bt_addr, (U32)SRV_BT_CM_SIM_ACCESS_PROFILE_UUID, MMI_FALSE);
		            return;
		        }
                g_mmi_simap_cntx_p->cmgr_id = conn_id;
                g_mmi_simap_cntx_p->state = MMI_BTH_SIMAP_STAT_AUTHORIZING;

        		mmi_bt_authorize_ind_notify(
					name, 
					&g_mmi_simap_cntx_p->bt_addr,
					SRV_BT_CM_SIM_ACCESS_PROFILE_UUID,
					(void *)mmi_bt_simap_authorize_rsp
					);
    		}
    		else
                mmi_bt_simap_authorize_rsp(&g_mmi_simap_cntx_p->bt_addr, (U32)SRV_BT_CM_SIM_ACCESS_PROFILE_UUID, MMI_FALSE);
            break;
        }
        default:
            mmi_bt_simap_authorize_rsp(&g_mmi_simap_cntx_p->bt_addr, (U32)SRV_BT_CM_SIM_ACCESS_PROFILE_UUID, MMI_FALSE);
            break;
    }
}
示例#2
0
/*****************************************************************************
* FUNCTION
*  mmi_bth_simap_connect_ind_hdler
* DESCRIPTION
*   This function is to 
*
* PARAMETERS
*  a  IN/OUT      first variable, used as returns
*  b  IN       second variable
* RETURNS
*  NONE.
* GLOBALS AFFECTED
*   external_global
*****************************************************************************/
void mmi_bth_simap_connect_ind_hdler(void *msg)
{
    bt_simap_connect_ind_struct *msg_p = (bt_simap_connect_ind_struct *)msg;
	kal_uint8 i;
       kal_uint8 bd_addr[6];
	kal_uint8* name = NULL;

	for(i = 0; i < MMI_BTH_SIMAP_MAX_CONNECTION; i++)
	{
	    if(g_mmi_simap_cntx[i].state == MMI_BTH_SIMAP_STAT_ACTIVATE)
	    {
	        g_mmi_simap_cntx[i].state = MMI_BTH_SIMAP_STAT_CONNECT;
		    g_mmi_simap_cntx[i].connect_id = msg_p->cid;
  		    g_mmi_simap_cntx[i].lap = msg_p->lap;
		    g_mmi_simap_cntx[i].uap = msg_p->uap;
		    g_mmi_simap_cntx[i].nap = msg_p->nap;
		    break;
	    }

	}

       CONVERT_BDADDR2ARRAY(bd_addr, msg_p->lap, msg_p->uap, msg_p->nap);
	name = BTBMGetLocalStoredName(bd_addr);
       //PRINT_INFORMATION("mmi_bth_spp_connect_ind_hdler(): get device name=%s",name);     
   
	
	/* inform CM connect result */
	mmi_bth_connect_ind_hdler(  
		msg_p->lap,
		msg_p->uap,
		msg_p->nap,
		name,
		MMI_BTH_SIM_ACCESS_PROFILE_UUID,
		msg_p->cid);
	/* callback user profiles */


}