/*****************************************************************************
* FUNCTION
* srv_bt_cm_get_existed_conn_info
* DESCRIPTION
* This function is to get existed connection info
* PARAMETERS
* index [IN] existed connection index
* RETURNS
* srv_bt_cm_connect_struct existed connection info
*****************************************************************************/
srv_bt_cm_connect_struct *srv_bt_cm_get_existed_conn_info(U16 index)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MMI_BT_ASSERT(index == 0 || index < g_srv_bt_cm_cntx.existed_conn_num);
return &(g_srv_bt_cm_cntx.existed_conn[index]);
}
/*****************************************************************************
* FUNCTION
* srv_bt_cm_is_profile_connected
* DESCRIPTION
* This function is to check if XXX profile connected
* PARAMETERS
* conn_type [IN] to check if conn_type is connected, conn_type is defind in srv_bt_cm_connection_type
* RETURNS
* MMI_BOOL TRUE : the profile is connected
* FALSE : the profile is not connected
*****************************************************************************/
MMI_BOOL srv_bt_cm_is_profile_connected(srv_bt_cm_connection_type conn_type)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U32 i = 0;
U8 act_con_num = 0;
srv_bt_cm_connect_struct *conn_p = NULL;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
act_con_num = srv_bt_cm_get_existed_conn_num();
/* get index of existed_conn */
for (i = 0; i < act_con_num; i++)
{
conn_p = srv_bt_cm_get_existed_conn_info((U16) i);
if (conn_p->conn_type == conn_type && conn_p->active == MMI_TRUE)
{
MMI_TRACE(MMI_CONN_TRC_G7_BT, MMI_BT_G7_SRV_BT_CM_IS_PROFILE_CONNECTED, conn_type, MMI_TRUE);
return MMI_TRUE;
}
}
MMI_TRACE(MMI_CONN_TRC_G7_BT, MMI_BT_G7_SRV_BT_CM_IS_PROFILE_CONNECTED, conn_type, MMI_FALSE);
return MMI_FALSE;
}
/*****************************************************************************
* FUNCTION
* srv_bt_cm_is_profile_connected_type
* DESCRIPTION
* This function is to check if BT connected
* PARAMETERS
* NULL
* RETURNS
* MMI_BOOL TRUE : the profile is connected
* FALSE : the profile is not connected
*****************************************************************************/
MMI_BOOL srv_bt_cm_is_profile_connected_type(void)
{
if ((srv_bt_cm_is_profile_connected(SRV_BT_CM_HFP_CONNECTION) &&
!srv_bt_cm_is_profile_connected(SRV_BT_CM_HSP_CONNECTION)))//蓝牙
{
return MMI_TRUE;
}
return MMI_FALSE;
}