Commit ce75bad9 authored by chen's avatar chen

fix: 修改了蓝牙电话的逻辑

parent d4311824
......@@ -350,7 +350,7 @@ void Uart_Send_Id01_Pro(void)
void Uart_Send_Id02_Pro(void)
{
uint8_t ID02[1] = {0x00};
ID02[0] = BT_User.Call_Sts;
ID02[0] = BT_User.Call_Fitter_sts;
Protocol_Send(0x02, ID02, 1);
}
......
......@@ -36,6 +36,8 @@ typedef struct
uint8_t HF_Ctrl;
char Number[11];
char CCLC[11];
char Get_Call_Num;
char Call_Fitter_sts;
}BT_User_Control_Struct;
extern BT_User_Control_Struct BT_User;
......
......@@ -332,13 +332,13 @@ void bt_app_hf_client_cb(esp_hf_client_cb_event_t event, esp_hf_client_cb_param_
ESP_LOGI(BT_HF_TAG, "--Call indicator %s",
c_call_str[param->call.status]);
if((param->call.status == 0) && ((BT_User.Call_Sts == Call_InProcess) || (BT_User.Call_Sts == Call_OutCalling) || (BT_User.Call_Sts == Call_IncomeCalling)))
if(param->call.status == 0)
{
BT_User.Call_Sts = Call_Idle;
call_timer = 0;
printf("call Hangup\r\n");
}
else if((param->call.status == 1) && ((BT_User.Call_Sts == Call_OutCalling) || (BT_User.Call_Sts == Call_IncomeCalling) || (BT_User.Call_Sts == Call_InProcess)))
else if(param->call.status == 1)
{
BT_User.Call_Sts = Call_InProcess;
printf("call Call_InProcess\r\n");
......@@ -348,43 +348,44 @@ void bt_app_hf_client_cb(esp_hf_client_cb_event_t event, esp_hf_client_cb_param_
case ESP_HF_CLIENT_CIND_CALL_SETUP_EVT:
{
// ESP_LOGI(BT_HF_TAG, "--Call setup indicator %s",
// c_call_setup_str[param->call_setup.status]);
ESP_LOGI(BT_HF_TAG, "--Call setup indicator %s",
c_call_setup_str[param->call_setup.status]);
// switch(param->call_setup.status)
// {
// case 0:
// {
if(param->call_setup.status == 0 && (BT_User.Call_Sts == Call_IncomeCalling ))
{
BT_User.Call_Sts = Call_Idle;
switch(param->call_setup.status)
{
case 0:
{
if(BT_User.Call_Sts == Call_IncomeCalling || BT_User.Call_Sts == Call_OutCalling)
{
BT_User.Call_Sts = Call_Idle;
}
// BT_User.Call_Sts = Call_Idle;
call_timer = 0;
printf("call Miss\r\n");
}
// break;
// }
// case 1:
// {
// BT_User.Call_Sts = Call_IncomeCalling;
break;
}
case 1:
{
BT_User.Call_Sts = Call_IncomeCalling;
// printf("call income\r\n");
// break;
// }
// case 2:
// {
// BT_User.Call_Sts = Call_OutCalling;
// printf("call outcall\r\n");
// break;
// }
// case 3:
// {
// BT_User.Call_Sts = Call_OutCalling;
// printf("call outcall\r\n");
// break;
// }
// }
printf("call income\r\n");
break;
}
case 2:
{
BT_User.Call_Sts = Call_OutCalling;
printf("call outcall\r\n");
break;
}
case 3:
{
BT_User.Call_Sts = Call_OutCalling;
printf("call outcall\r\n");
break;
}
}
// if(param->call_setup.status == 0)
if(param->call_setup.status == 0)
break;
}
......@@ -406,18 +407,18 @@ void bt_app_hf_client_cb(esp_hf_client_cb_event_t event, esp_hf_client_cb_param_
{
ESP_LOGI(BT_HF_TAG, "--clip number %s",
(param->clip.number == NULL) ? "NULL" : (param->clip.number));
if(param->clip.number != NULL)
{
for(int i = 0 ; i < 11 ; i++)
{
BT_User.Number[i] = param->clip.number[i];
}
}
if(BT_User.Call_Sts != Call_InProcess)
BT_User.Call_Sts = Call_IncomeCalling;
printf("call income\r\n");
printf("%s\n",param->clip.number);
// printf("1\n");
// if(param->clip.number != NULL)
// {
// for(int i = 0 ; i < 11 ; i++)
// {
// BT_User.Number[i] = param->clip.number[i];
// }
// }
// if(BT_User.Call_Sts != Call_InProcess)
// BT_User.Call_Sts = Call_IncomeCalling;
// printf("call income\r\n");
// printf("%s\n",param->clip.number);
// // printf("1\n");
break;
}
......@@ -436,25 +437,29 @@ void bt_app_hf_client_cb(esp_hf_client_cb_event_t event, esp_hf_client_cb_param_
c_call_state_str[param->clcc.status],
c_call_mpty_type_str[param->clcc.mpty],
(param->clcc.number == NULL) ? "NULL" : (param->clcc.number));
if((strstr(param->clcc.number,"10000000") == NULL) && (BT_User.Call_Sts != Call_IncomeCalling) && (BT_User.Call_Sts != Call_InProcess))
{
if(call_timer == 7)
{
BT_User.Call_Sts = Call_OutCalling;
printf("call outcall\r\n");
printf("%s\n",param->clcc.number);
}
else
{
call_timer ++;
}
// call_timer ++;
}
else
// if((strstr(param->clcc.number,"10000000") == NULL) && (BT_User.Call_Sts != Call_IncomeCalling) && (BT_User.Call_Sts != Call_InProcess))
// {
// if(call_timer == 7)
// {
// BT_User.Call_Sts = Call_OutCalling;
// printf("call outcall\r\n");
// printf("%s\n",param->clcc.number);
// }
// else
// {
// call_timer ++;
// }
// // call_timer ++;
// }
// else
// {
// call_timer = 0;
// }
// break;
if(strstr(param->clcc.number,"10000000") == NULL)
{
call_timer = 0;
BT_User.Get_Call_Num = 1;
}
break;
}
case ESP_HF_CLIENT_VOLUME_CONTROL_EVT:
......@@ -504,6 +509,26 @@ void bt_app_hf_client_cb(esp_hf_client_cb_event_t event, esp_hf_client_cb_param_
}
}
void Get_Iphone_Fitter_callsts(void )
{
if(BT_User.Call_Sts == Call_Idle)
{
BT_User.Get_Call_Num = 0;
BT_User.Call_Fitter_sts = BT_User.Call_Sts;
}
else
{
if(BT_User.Get_Call_Num == 1)
{
BT_User.Call_Fitter_sts = BT_User.Call_Sts;
}
else
{
BT_User.Call_Fitter_sts = Call_Idle;
}
}
printf("%d\n",BT_User.Call_Fitter_sts);
}
......
......@@ -18,7 +18,7 @@
*/
void bt_app_hf_client_cb(esp_hf_client_cb_event_t event, esp_hf_client_cb_param_t *param);
void Get_Iphone_Fitter_callsts(void );
int hf_conn_handler(void );
int hf_disc_handler(void );
......@@ -35,4 +35,5 @@ int hf_stop_vr_handler(void );
int hf_query_call_handler(void );
#endif /* __BT_APP_HF_H__*/
......@@ -82,6 +82,7 @@ static void Sys_Run_Tasks(void *arg)
if(SYS_RUN_TASK_100MS)
{
Get_Iphone_Fitter_callsts();
Ble_MsgRec_Navi_Timeout();
esp_hf_client_query_current_calls();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment