mt2503 (MMI_part)蓝牙重启,进入BTDialer连接,显示“正在初始化”
时间:10-02
整理:3721RD
点击:
[DESCRIPTION]
蓝牙重启,当MMI再次进入BT Dialer时,显示“正在初始化......”
BT 重启代码为:panic 19
[SOLUTION]
MMI层修改3个file.
\plutommi\mtkApp\Connectivity\ConnectivitySrc\BtCommon\BTConnScr.c
\plutommi\Service\DialerSrv\BTDialerSrv.c
\plutommi\Service\MapcSrv\MapcSrv.c
具体如下:
1. \plutommi\MtkApp\Connectivity\ConnectivitySrc\BtCommon\BTConnScr.c
修改mmi_bt_dialor_callback()的实现
void mmi_bt_dialor_callback(srv_bt_cm_connection_type conn_type, MMI_BOOL result,MMI_BOOL is_connect)
{
******************************************************
if (callback_item != NULL)
{
MMI_TRACE(MMI_CONN_TRC_G7_BT, MMI_BT_CONN_CBITEM_NULL);
if (is_connect)
{
if (callback_item->conn != NULL)
{
MMI_TRACE(MMI_CONN_TRC_G7_BT, MMI_BT_CONN_CBITEM_CONN_NULL);
g_bt_dialer_connecting |=1<<callback_item->indx;
callback_item->conn(&dev_p->bd_addr,mmi_bt_dialor_callback);
MMI_TRACE(MMI_CONN_TRC_G7_BT, MMI_BT_CONN_CONNECTING_STATUS, g_bt_dialer_connecting);
}
***********************************************************
}
2.\plutommi\Service\DialerSrv\BTDialerSrv.c
(1)修改srv_bt_dialer_connect_cnf_hdlr()如下:
MMI_BOOL srv_bt_dialer_connect_cnf_hdlr(void *msg)
{
**********************************
if(rsp->result != 0)
{
SRV_BT_DIALER_LOG(SRV_BT_DIALER_CONNECT_CNF_FAIL);
if (g_bt_dialer_cntx->state == SRV_BT_DIALER_STATE_CONNECTING)
{
SRV_BT_DIALER_STATE_TRANS(SRV_BT_DIALER_STATE_ACTIVATED);
}
srv_bt_cm_stop_conn(SRV_BT_DIALER_GET_CM_CONN_ID);
SRV_BT_DIALER_SET_CM_CONN_ID(MMI_HF_INVALID_CONN_ID);
if(g_bt_dialer_cntx->cm_cb)
{
g_bt_dialer_cntx->cm_cb(SRV_BT_CM_HSP_CONNECTION,(MMI_BOOL)rsp->result,MMI_TRUE);
}
return MMI_FALSE;
}
*****************
}
(2)修改srv_bt_dialer_connect_cnf_hdlr()如下:
MMI_BOOL srv_bt_dialer_disconnect_ind(void* msg)
{
**************************************
ASSERT(disc_ind);
SRV_BT_DIALER_LOG(SRV_BT_DIALER_DISCONNECT_IND);
if (disc_ind->connection_id == SRV_BT_DIALER_GET_CONN_ID)
{
if (g_bt_dialer_cntx->state == SRV_BT_DIALER_STATE_CONNECTED)
{
SRV_BT_DIALER_STATE_TRANS(SRV_BT_DIALER_STATE_DISCONNECTED);
}
***************************************
}
3. \plutommi\Service\MapcSrv\MapcSrv.c
(1)修改srv_bt_mapc_deinit()如下:
void srv_bt_mapc_deinit(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
srv_bt_mapc_notify_cb mapc_cb;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MMI_TRACE(MMI_MAPC_TRC_CLASS,SRV_MAPC_DEINIT);
// Don't reset this callback, it only registered at bootup stage.
mapc_cb = gmap_CLIent_cntx_p->srv_map_callback;
mEMSet(gmap_client_cntx_p, 0,sizeof(srv_map_client_cntx_struct));
gmap_client_cntx_p->mas_id= -1;
gmap_client_cntx_p->srv_hd= -1;
gmap_client_cntx_p->srv_map_callback = mapc_cb;
MMI_MAPC_STATE_TRANS(SRV_MAPC_STATE_INIT);
}
以下从(2)~(6)都加入了状态判断if(gmap_client_cntx_p->state xxxxxxx),具体改法如下:
(2)修改srv_bt_mapc_connect_req()如下:
void srv_bt_mapc_connect_req(srv_bt_cm_bt_addr dev_addr)
{
*****************************************
if(gmap_client_cntx_p->mas_id<0)
{
if (gmap_client_cntx_p->state >= SRV_MAPC_STATE_ACTIVATED)
{
MMI_MAPC_STATE_TRANS(SRV_MAPC_STATE_ACTIVATED);
}
*****************************************
}
(3)修改srv_bt_mapc_connect_cnf()如下:
void srv_bt_mapc_connect_cnf(void *msg)
{
*********************************************
if((msg_p != NULL ) && (msg_p->result == SRV_BT_MAPC_SUCCESS))
{
***********************************************
}
else
{
if (gmap_client_cntx_p->state >= SRV_MAPC_STATE_ACTIVATED)
{
MMI_MAPC_STATE_TRANS(SRV_MAPC_STATE_ACTIVATED);
}
*****************************************************
}
(4).若版本为BT Dialer V2.2,请修改srv_bt_mapc_spp_connect_cnf()如下:
void srv_bt_mapc_spp_connect_cnf(void *msg)
{
**************************************
if((msg_p != NULL ) && (msg_p->result == SRV_BT_MAPC_SUCCESS))
{
*************************************
}
else
{
if (gmap_client_cntx_p->state >= SRV_MAPC_STATE_ACTIVATED)
{
MMI_MAPC_STATE_TRANS(SRV_MAPC_STATE_ACTIVATED);
}
}
}
(5)修改srv_bt_mapc_disconnect_ind()实现如下:
void srv_bt_mapc_disconnect_ind(void *msg)
{
******************************************
if((gmap_client_cntx_p->mas_id== msg_p->mas_id))
{
*****************************************
gmap_client_cntx_p->bd_addr.nap = 0;
if (gmap_client_cntx_p->state >= SRV_MAPC_STATE_ACTIVATED)
{
MMI_MAPC_STATE_TRANS(SRV_MAPC_STATE_ACTIVATED);
}
******************************************
}
(6).修改void srv_bt_mapc_disconnect_cnf(void *msg)实作:
{
********************************
switch (gmap_client_cntx_p->state)
{
********************************
default:
{
*******************************
if((msg_w != NULL )&& (gmap_client_cntx_p->mas_id== msg_w->mas_id) &&
(msg_u.Error==SRV_BT_MAPC_SUCCESS))
{
********************************
if (gmap_client_cntx_p->state >= SRV_MAPC_STATE_ACTIVATED)
{
MMI_MAPC_STATE_TRANS(SRV_MAPC_STATE_ACTIVATED);
}
}
蓝牙重启,当MMI再次进入BT Dialer时,显示“正在初始化......”
BT 重启代码为:panic 19
[SOLUTION]
MMI层修改3个file.
\plutommi\mtkApp\Connectivity\ConnectivitySrc\BtCommon\BTConnScr.c
\plutommi\Service\DialerSrv\BTDialerSrv.c
\plutommi\Service\MapcSrv\MapcSrv.c
具体如下:
1. \plutommi\MtkApp\Connectivity\ConnectivitySrc\BtCommon\BTConnScr.c
修改mmi_bt_dialor_callback()的实现
void mmi_bt_dialor_callback(srv_bt_cm_connection_type conn_type, MMI_BOOL result,MMI_BOOL is_connect)
{
******************************************************
if (callback_item != NULL)
{
MMI_TRACE(MMI_CONN_TRC_G7_BT, MMI_BT_CONN_CBITEM_NULL);
if (is_connect)
{
if (callback_item->conn != NULL)
{
MMI_TRACE(MMI_CONN_TRC_G7_BT, MMI_BT_CONN_CBITEM_CONN_NULL);
g_bt_dialer_connecting |=1<<callback_item->indx;
callback_item->conn(&dev_p->bd_addr,mmi_bt_dialor_callback);
MMI_TRACE(MMI_CONN_TRC_G7_BT, MMI_BT_CONN_CONNECTING_STATUS, g_bt_dialer_connecting);
}
***********************************************************
}
2.\plutommi\Service\DialerSrv\BTDialerSrv.c
(1)修改srv_bt_dialer_connect_cnf_hdlr()如下:
MMI_BOOL srv_bt_dialer_connect_cnf_hdlr(void *msg)
{
**********************************
if(rsp->result != 0)
{
SRV_BT_DIALER_LOG(SRV_BT_DIALER_CONNECT_CNF_FAIL);
if (g_bt_dialer_cntx->state == SRV_BT_DIALER_STATE_CONNECTING)
{
SRV_BT_DIALER_STATE_TRANS(SRV_BT_DIALER_STATE_ACTIVATED);
}
srv_bt_cm_stop_conn(SRV_BT_DIALER_GET_CM_CONN_ID);
SRV_BT_DIALER_SET_CM_CONN_ID(MMI_HF_INVALID_CONN_ID);
if(g_bt_dialer_cntx->cm_cb)
{
g_bt_dialer_cntx->cm_cb(SRV_BT_CM_HSP_CONNECTION,(MMI_BOOL)rsp->result,MMI_TRUE);
}
return MMI_FALSE;
}
*****************
}
(2)修改srv_bt_dialer_connect_cnf_hdlr()如下:
MMI_BOOL srv_bt_dialer_disconnect_ind(void* msg)
{
**************************************
ASSERT(disc_ind);
SRV_BT_DIALER_LOG(SRV_BT_DIALER_DISCONNECT_IND);
if (disc_ind->connection_id == SRV_BT_DIALER_GET_CONN_ID)
{
if (g_bt_dialer_cntx->state == SRV_BT_DIALER_STATE_CONNECTED)
{
SRV_BT_DIALER_STATE_TRANS(SRV_BT_DIALER_STATE_DISCONNECTED);
}
***************************************
}
3. \plutommi\Service\MapcSrv\MapcSrv.c
(1)修改srv_bt_mapc_deinit()如下:
void srv_bt_mapc_deinit(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
srv_bt_mapc_notify_cb mapc_cb;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MMI_TRACE(MMI_MAPC_TRC_CLASS,SRV_MAPC_DEINIT);
// Don't reset this callback, it only registered at bootup stage.
mapc_cb = gmap_CLIent_cntx_p->srv_map_callback;
mEMSet(gmap_client_cntx_p, 0,sizeof(srv_map_client_cntx_struct));
gmap_client_cntx_p->mas_id= -1;
gmap_client_cntx_p->srv_hd= -1;
gmap_client_cntx_p->srv_map_callback = mapc_cb;
MMI_MAPC_STATE_TRANS(SRV_MAPC_STATE_INIT);
}
以下从(2)~(6)都加入了状态判断if(gmap_client_cntx_p->state xxxxxxx),具体改法如下:
(2)修改srv_bt_mapc_connect_req()如下:
void srv_bt_mapc_connect_req(srv_bt_cm_bt_addr dev_addr)
{
*****************************************
if(gmap_client_cntx_p->mas_id<0)
{
if (gmap_client_cntx_p->state >= SRV_MAPC_STATE_ACTIVATED)
{
MMI_MAPC_STATE_TRANS(SRV_MAPC_STATE_ACTIVATED);
}
*****************************************
}
(3)修改srv_bt_mapc_connect_cnf()如下:
void srv_bt_mapc_connect_cnf(void *msg)
{
*********************************************
if((msg_p != NULL ) && (msg_p->result == SRV_BT_MAPC_SUCCESS))
{
***********************************************
}
else
{
if (gmap_client_cntx_p->state >= SRV_MAPC_STATE_ACTIVATED)
{
MMI_MAPC_STATE_TRANS(SRV_MAPC_STATE_ACTIVATED);
}
*****************************************************
}
(4).若版本为BT Dialer V2.2,请修改srv_bt_mapc_spp_connect_cnf()如下:
void srv_bt_mapc_spp_connect_cnf(void *msg)
{
**************************************
if((msg_p != NULL ) && (msg_p->result == SRV_BT_MAPC_SUCCESS))
{
*************************************
}
else
{
if (gmap_client_cntx_p->state >= SRV_MAPC_STATE_ACTIVATED)
{
MMI_MAPC_STATE_TRANS(SRV_MAPC_STATE_ACTIVATED);
}
}
}
(5)修改srv_bt_mapc_disconnect_ind()实现如下:
void srv_bt_mapc_disconnect_ind(void *msg)
{
******************************************
if((gmap_client_cntx_p->mas_id== msg_p->mas_id))
{
*****************************************
gmap_client_cntx_p->bd_addr.nap = 0;
if (gmap_client_cntx_p->state >= SRV_MAPC_STATE_ACTIVATED)
{
MMI_MAPC_STATE_TRANS(SRV_MAPC_STATE_ACTIVATED);
}
******************************************
}
(6).修改void srv_bt_mapc_disconnect_cnf(void *msg)实作:
{
********************************
switch (gmap_client_cntx_p->state)
{
********************************
default:
{
*******************************
if((msg_w != NULL )&& (gmap_client_cntx_p->mas_id== msg_w->mas_id) &&
(msg_u.Error==SRV_BT_MAPC_SUCCESS))
{
********************************
if (gmap_client_cntx_p->state >= SRV_MAPC_STATE_ACTIVATED)
{
MMI_MAPC_STATE_TRANS(SRV_MAPC_STATE_ACTIVATED);
}
}