Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Q
QJ_500-7c
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
时昊
QJ_500-7c
Commits
00c58b72
Commit
00c58b72
authored
Apr 30, 2024
by
薛小虎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 添加电话状态
parent
ac9f975a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
82 additions
and
4 deletions
+82
-4
app_BT_User.c
qianjiang/main/app_BT_User.c
+21
-0
app_BT_User.h
qianjiang/main/app_BT_User.h
+2
-3
bt_app_hf.c
qianjiang/main/bt_app_hf.c
+59
-1
No files found.
qianjiang/main/app_BT_User.c
View file @
00c58b72
#include "app_BT_User.h"
#include <stdio.h>
#define TAG "APP_BLE_USER"
...
...
@@ -8,6 +9,26 @@ BT_User_Control_Struct BT_User;
void
BT_Connect_Event_Pro
(
void
)
{
BT_User
.
BT_Sts
=
BT_Conn
;
BT_User
.
Call_Sts
=
Call_Idle
;
printf
(
"TB CONN
\r\n
"
);
}
void
BT_DisConnect_Event_Pro
(
void
)
{
BT_User
.
BT_Sts
=
BT_Idle
;
BT_User
.
Call_Sts
=
Call_Idle
;
printf
(
"TB DISCONN
\r\n
"
);
}
...
...
qianjiang/main/app_BT_User.h
View file @
00c58b72
...
...
@@ -8,8 +8,6 @@ typedef enum
{
BT_Idle
=
0
,
BT_Conn
,
BT_Pair
,
BT_Authr
,
}
BT_Sts_Enum
;
...
...
@@ -18,13 +16,14 @@ typedef enum
Call_Idle
=
0
,
Call_OutCalling
,
Call_IncomeCalling
,
Call_InProcess
,
Call_Authr
,
}
Call_Sts_Enum
;
typedef
struct
{
uint8_t
BT_Sts
;
uint8_t
Call_Sts
;
}
BT_User_Control_Struct
;
extern
BT_User_Control_Struct
BT_User
;
...
...
qianjiang/main/bt_app_hf.c
View file @
00c58b72
...
...
@@ -7,10 +7,10 @@
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include "esp_log.h"
#include "bt_app_core.h"
#include "bt_app_hf.h"
#include "esp_bt_main.h"
...
...
@@ -26,6 +26,8 @@
#include "sys/time.h"
#include "sdkconfig.h"
#include "app_BT_User.h"
const
char
*
c_hf_evt_str
[]
=
{
"CONNECTION_STATE_EVT"
,
/*!< connection state changed event */
"AUDIO_STATE_EVT"
,
/*!< audio connection state change event */
...
...
@@ -243,6 +245,15 @@ void bt_app_hf_client_cb(esp_hf_client_cb_event_t event, esp_hf_client_cb_param_
param
->
conn_stat
.
peer_feat
,
param
->
conn_stat
.
chld_feat
);
memcpy
(
peer_addr
,
param
->
conn_stat
.
remote_bda
,
ESP_BD_ADDR_LEN
);
if
(
param
->
conn_stat
.
state
==
0
)
{
BT_User
.
BT_Sts
=
BT_Conn
;
}
else
if
(
param
->
conn_stat
.
state
==
2
)
{
BT_User
.
BT_Sts
=
BT_Idle
;
}
break
;
}
...
...
@@ -309,6 +320,18 @@ 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_Idle
;
printf
(
"call over
\r\n
"
);
}
else
if
(
param
->
call
.
status
==
1
)
{
BT_User
.
Call_Sts
=
Call_InProcess
;
printf
(
"call Call_InProcess
\r\n
"
);
}
break
;
}
...
...
@@ -316,6 +339,41 @@ void bt_app_hf_client_cb(esp_hf_client_cb_event_t event, esp_hf_client_cb_param_
{
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
(
BT_User
.
Call_Sts
==
Call_IncomeCalling
||
BT_User
.
Call_Sts
==
Call_OutCalling
)
{
BT_User
.
Call_Sts
=
Call_Idle
;
printf
(
"call idle
\r\n
"
);
}
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
;
}
}
if
(
param
->
call_setup
.
status
==
0
)
break
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment