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
6623f97f
Commit
6623f97f
authored
May 06, 2024
by
薛小虎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: 验证连接ble问题
parent
148e4eb0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
gatts_table_creat_demo.c
qianjiang/main/gatts_table_creat_demo.c
+9
-1
No files found.
qianjiang/main/gatts_table_creat_demo.c
View file @
6623f97f
...
@@ -151,6 +151,9 @@ uint8_t BT_Device_Name[14] = "QianJiangViva";
...
@@ -151,6 +151,9 @@ uint8_t BT_Device_Name[14] = "QianJiangViva";
#define SVC_INST_ID 0
#define SVC_INST_ID 0
#define SVC_INST_ID1 1
#define SVC_INST_ID1 1
esp_bd_addr_t
rand_addr
=
{
0xC0
,
0x30
,
0x05
,
0x70
,
0x09
,
0xFA
};
/* The max length of characteristic value. When the GATT client performs a write or prepare write operation,
/* The max length of characteristic value. When the GATT client performs a write or prepare write operation,
* the data length must be less than GATTS_DEMO_CHAR_VAL_LEN_MAX.
* the data length must be less than GATTS_DEMO_CHAR_VAL_LEN_MAX.
*/
*/
...
@@ -237,7 +240,7 @@ static esp_ble_adv_params_t adv_params = {
...
@@ -237,7 +240,7 @@ static esp_ble_adv_params_t adv_params = {
.
adv_int_min
=
0x20
,
.
adv_int_min
=
0x20
,
.
adv_int_max
=
0x40
,
.
adv_int_max
=
0x40
,
.
adv_type
=
ADV_TYPE_IND
,
.
adv_type
=
ADV_TYPE_IND
,
.
own_addr_type
=
BLE_ADDR_TYPE_
PUBLIC
,
.
own_addr_type
=
BLE_ADDR_TYPE_
RANDOM
,
.
channel_map
=
ADV_CHNL_ALL
,
.
channel_map
=
ADV_CHNL_ALL
,
.
adv_filter_policy
=
ADV_FILTER_ALLOW_SCAN_ANY_CON_ANY
,
.
adv_filter_policy
=
ADV_FILTER_ALLOW_SCAN_ANY_CON_ANY
,
};
};
...
@@ -530,12 +533,16 @@ static void gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param
...
@@ -530,12 +533,16 @@ static void gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param
adv_config_done
&=
(
~
ADV_CONFIG_FLAG
);
adv_config_done
&=
(
~
ADV_CONFIG_FLAG
);
if
(
adv_config_done
==
0
){
if
(
adv_config_done
==
0
){
esp_ble_gap_start_advertising
(
&
adv_params
);
esp_ble_gap_start_advertising
(
&
adv_params
);
printf
(
"adv 1
\r\n
"
);
}
}
break
;
break
;
case
ESP_GAP_BLE_SCAN_RSP_DATA_RAW_SET_COMPLETE_EVT
:
case
ESP_GAP_BLE_SCAN_RSP_DATA_RAW_SET_COMPLETE_EVT
:
adv_config_done
&=
(
~
SCAN_RSP_CONFIG_FLAG
);
adv_config_done
&=
(
~
SCAN_RSP_CONFIG_FLAG
);
if
(
adv_config_done
==
0
){
if
(
adv_config_done
==
0
){
esp_ble_gap_start_advertising
(
&
adv_params
);
esp_ble_gap_start_advertising
(
&
adv_params
);
printf
(
"adv 2
\r\n
"
);
}
}
break
;
break
;
#else
#else
...
@@ -647,6 +654,7 @@ static void gatts_profile_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_
...
@@ -647,6 +654,7 @@ static void gatts_profile_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_
{
{
switch
(
event
)
{
switch
(
event
)
{
case
ESP_GATTS_REG_EVT
:{
case
ESP_GATTS_REG_EVT
:{
esp_ble_gap_set_rand_addr
(
rand_addr
);
esp_err_t
set_dev_name_ret
=
esp_ble_gap_set_device_name
((
const
char
*
)
BT_Device_Name
);
esp_err_t
set_dev_name_ret
=
esp_ble_gap_set_device_name
((
const
char
*
)
BT_Device_Name
);
if
(
set_dev_name_ret
){
if
(
set_dev_name_ret
){
ESP_LOGE
(
GATTS_TABLE_TAG
,
"set device name failed, error code = %x"
,
set_dev_name_ret
);
ESP_LOGE
(
GATTS_TABLE_TAG
,
"set device name failed, error code = %x"
,
set_dev_name_ret
);
...
...
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