From 255c51174a0571340ef470184064a5c75d261d27 Mon Sep 17 00:00:00 2001 From: WXK <287788329@qq.com> Date: 星期三, 22 一月 2025 15:06:27 +0800 Subject: [PATCH] 加入一开始不广播升级 中断触发gpio后广播升级 10分钟自动退出 --- 01_SDK/nimble/samples/bluetooth/ble_central_periph_ota/src/app_ble_periph.c | 30 +++++++++++++++++++++++++++++- 1 files changed, 29 insertions(+), 1 deletions(-) diff --git a/01_SDK/nimble/samples/bluetooth/ble_central_periph_ota/src/app_ble_periph.c b/01_SDK/nimble/samples/bluetooth/ble_central_periph_ota/src/app_ble_periph.c index 99e1a39..a4983d1 100644 --- a/01_SDK/nimble/samples/bluetooth/ble_central_periph_ota/src/app_ble_periph.c +++ b/01_SDK/nimble/samples/bluetooth/ble_central_periph_ota/src/app_ble_periph.c @@ -19,7 +19,7 @@ static uint16_t conn_handle = 0xFFFF; /**@brief BLE device name. */ -static const char *device_name = "pan_ble_cent_periph"; +static const char *device_name = "HX_SHENGJI_TAG"; /**@brief Heart-rate data send timer. */ static struct ble_npl_callout hr_tx_timer; @@ -237,6 +237,34 @@ APP_LOG_INFO("Adv Start...\n"); } +//void shengji_start(void) +//{ +// struct ble_gap_adv_params adv_params; +// int rc; +// +// /* Figure out address to use while advertising (no privacy for now) */ +// uint8_t own_addr_type = 0; +// rc = ble_hs_id_infer_auto(0, &own_addr_type); +// if (rc != 0) { +// APP_LOG_ERR("error determining address type; rc=%d\n", rc); +// return; +// } + +// /* Start Adv */ +// memset(&adv_params, 0, sizeof(adv_params)); +// adv_params.conn_mode = BLE_GAP_CONN_MODE_UND; +// adv_params.disc_mode = BLE_GAP_DISC_MODE_GEN; + +// rc = ble_gap_adv_start(own_addr_type, NULL, BLE_HS_FOREVER, &adv_params, +// app_ble_periph_gap_event_cb, NULL); +// if (rc != 0) { +// APP_LOG_ERR("error enabling advertisement; rc=%d\n", rc); +// return; +// } +// +// APP_LOG_INFO("Adv Start...\n"); +//} + void app_ble_periph_init(void) { -- Gitblit v1.9.3