From 371496ffb05598a77eb36189a710ce6cd6254d0a Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Mon, 11 Nov 2024 11:21:13 +0800 Subject: [PATCH] =?utf8?q?=E5=A2=9E=E5=8A=A0autoota=E5=B1=8F=E8=94=BD?= =?utf8?q?=E6=AD=A3=E5=B8=B8=E6=A8=A1=E5=BC=8Fbr=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/bluetooth/src/BluetoothModel.cpp | 13 ++++++++++++- .../src/SafeModeManagerPresenter.cpp | 1 + code/sdk/drivers/peripheral/utils/custom_runtime.c | 12 ++++++++++++ code/sdk/drivers/peripheral/utils/custom_runtime.h | 5 +++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothModel.cpp index ac80b05da..9b5af9ea5 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothModel.cpp @@ -799,6 +799,11 @@ void BtGapPairStatusChangedCallback(const bd_addr_t *bdAddr, int status) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BtGapPairStatusChangedCallback addr: ****%02x%02x%02x%02x status: %d\n", bdAddr->addr[3], bdAddr->addr[2], bdAddr->addr[1], bdAddr->addr[0], status); /* addr下标 0 1 2 3 */ + if(uapi_dev_runtime_get_atuoota_status()) + { + return; + } + if ((gap_get_device_class(bdAddr) & 0x200) != 0) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BtGapPairStatusChangedCallback: Mobile Phone Device"); @@ -1084,7 +1089,13 @@ void GapAclStateChangedCallback(const bd_addr_t *bdAddr, gap_acl_state_t state, WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "addr: %02x%02x%02x%02x%02x%02x", bdAddr->addr[5], bdAddr->addr[4], bdAddr->addr[3], /* mac下标 0 1 2 3 4 5 */ bdAddr->addr[2], bdAddr->addr[1], bdAddr->addr[0]); /* mac下标 0 1 2 3 4 5 */ - //效果不好 + + if(uapi_dev_runtime_get_atuoota_status()) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "bt GapAclStateChangedCallback state %d, reason %x succ or err", state, reason); + return; + } + if(!uapi_dev_runtime_get_bt_powerstat()) { gap_disconnect_remote_device(bdAddr); diff --git a/code/sdk/application/wearable/fd230app/nativeui/safemodemanager/src/SafeModeManagerPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/safemodemanager/src/SafeModeManagerPresenter.cpp index 95e7e2ecf..5c0f6a3e9 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/safemodemanager/src/SafeModeManagerPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/safemodemanager/src/SafeModeManagerPresenter.cpp @@ -101,6 +101,7 @@ bool SafeModeManagerPresenter::OnClick(UIView &view, const ClickEvent &event) { if (sppinit == 0) { BtInitSpp(); + uapi_dev_runtime_atuoota_status_status(1); sppinit = 1; } } diff --git a/code/sdk/drivers/peripheral/utils/custom_runtime.c b/code/sdk/drivers/peripheral/utils/custom_runtime.c index 006fff13e..94d95fada 100644 --- a/code/sdk/drivers/peripheral/utils/custom_runtime.c +++ b/code/sdk/drivers/peripheral/utils/custom_runtime.c @@ -103,6 +103,8 @@ typedef struct uint8_t wear_status; uint8_t shutting_down_status;//是否处于关机状态 uint8_t transmitting_status;//是否处于ble传输状态 + + uint8_t atuoota_status;//是否处于自动ota状态 } runtime_status_t; @@ -112,6 +114,16 @@ static runtime_status_t g_runtime={0}; // return &g_runtime; // } +void uapi_dev_runtime_atuoota_status_status(uint8_t data) +{ + g_runtime.atuoota_status=data; +} + + +uint8_t uapi_dev_runtime_get_atuoota_status(void) +{ + return g_runtime.atuoota_status; +} void uapi_dev_runtime_set_transmitting_status(uint8_t data) { diff --git a/code/sdk/drivers/peripheral/utils/custom_runtime.h b/code/sdk/drivers/peripheral/utils/custom_runtime.h index ba7141322..ba4028c84 100644 --- a/code/sdk/drivers/peripheral/utils/custom_runtime.h +++ b/code/sdk/drivers/peripheral/utils/custom_runtime.h @@ -308,6 +308,11 @@ void uapi_dev_runtime_set_transmitting_status(uint8_t data); uint8_t uapi_dev_runtime_get_transmitting_status(void); + +void uapi_dev_runtime_atuoota_status_status(uint8_t data); + +uint8_t uapi_dev_runtime_get_atuoota_status(void); + #ifdef __cplusplus #if __cplusplus } -- 2.17.1