From: SnickerSun Date: Sat, 7 Sep 2024 08:22:49 +0000 (+0800) Subject: ble连接状态同步到runtime,并在4G开启时开启sntp X-Git-Tag: release_V1.2.70_20241020_135402~518^2~9^2~3 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=5b11126ec2e1afd5cfea0f31eaee337a9101ffe0;p=mirrors%2FFD230.git ble连接状态同步到runtime,并在4G开启时开启sntp --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingModel.cpp index 0926b4809..9854fed19 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingModel.cpp @@ -1,8 +1,8 @@ /* * @Author: luozheng 1732036298@qq.com * @Date: 2024-02-18 09:09:13 - * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-09-05 18:32:45 + * @LastEditors: SnickerSun snickersun@163.com + * @LastEditTime: 2024-09-07 15:17:50 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingModel.cpp */ #include "settings/include/SettingModel.h" @@ -11,6 +11,10 @@ #include "classicbluetooth/include/BluetoothServiceOptionsView.h" #include "player/include/PlayersView.h" #include "player/include/PlayersModel.h" +extern "C" { + +#include "custom_runtime.h" +} namespace OHOS { SettingModel::SettingModel() {} @@ -77,6 +81,12 @@ namespace OHOS { PullUpDownView::GetInstance()->UpdatePhoneStatus(status); } + //更新系统全局状态 + if (status) + uapi_dev_runtime_set_ble_connect_stat(1); + else + uapi_dev_runtime_set_ble_connect_stat(0); + } // 更新耳机连接状态 diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp index 6461b4e06..7f59e17ff 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp @@ -1244,13 +1244,14 @@ static int udp_packet_parse(char *rx_buffer, int len) restart_time_sync(); cat1_getsignal(); - // if(sntp_enabled()==0) - // { - // sntp_init(); - // }else{ - // sntp_stop(); - // sntp_init(); - // } + if(sntp_enabled()==0) + { + sntp_init(); + } + else{ + sntp_stop(); + sntp_init(); + } if(g_msg_format_type == 0) break; //下面指令只有新格式才支持,因此返回 int stateOld = get_dmp_change_mode_old(); diff --git a/code/sdk/open_source/openharmony/third_party/lwip/port/lwip-2.1/porting/include/lwip/lwipopts.h b/code/sdk/open_source/openharmony/third_party/lwip/port/lwip-2.1/porting/include/lwip/lwipopts.h index d8e4d7c69..4a360d9bc 100644 --- a/code/sdk/open_source/openharmony/third_party/lwip/port/lwip-2.1/porting/include/lwip/lwipopts.h +++ b/code/sdk/open_source/openharmony/third_party/lwip/port/lwip-2.1/porting/include/lwip/lwipopts.h @@ -275,6 +275,13 @@ #define LWIP_HTTPC_HAVE_FILE_IO 1 #define HTTPC_DEBUG_REQUEST 1 +#if 1 +#define LWIP_DHCP_MAX_NTP_SERVERS 1 +#define SNTP_SERVER_DNS 1 +#if SNTP_SERVER_DNS +#define SNTP_SERVER_ADDRESS "pool.ntp.org" //"pool.ntp.org" +#endif +#else #define LWIP_DHCP_MAX_NTP_SERVERS 3 #define SNTP_SERVER_DNS 1 #if SNTP_SERVER_DNS @@ -282,6 +289,9 @@ #define SNTP_SERVER_ADDRESS2 "ntp1.aliyun.com" //"pool.ntp.org" #define SNTP_SERVER_ADDRESS3 "pool.ntp.org" //"pool.ntp.org" #endif +#endif + + #define SNTP_CHECK_RESPONSE 2 #define SNTP_SET_SYSTEM_TIME(sec) uaip_sntp_set_time_utc(sec) diff --git a/code/sdk/open_source/openharmony/third_party/lwip/src/apps/sntp/sntp.c b/code/sdk/open_source/openharmony/third_party/lwip/src/apps/sntp/sntp.c index 3e4ede567..5b58a15ab 100644 --- a/code/sdk/open_source/openharmony/third_party/lwip/src/apps/sntp/sntp.c +++ b/code/sdk/open_source/openharmony/third_party/lwip/src/apps/sntp/sntp.c @@ -608,10 +608,14 @@ static void sntp_request(void *arg) { ip_addr_t sntp_server_address; - err_t err; - + err_t err; LWIP_UNUSED_ARG(arg); - + if (uapi_dev_runtime_get_ble_connect_stat()) + { + LWIP_DEBUGF(SNTP_DEBUG_STATE, ("ble connected, skip sntp_request.\n")); + return; + } + uapi_cat1_wakeup_cat1(1); /* initialize SNTP server address */ #if SNTP_SERVER_DNS if (sntp_servers[sntp_current_server].name) { @@ -622,6 +626,7 @@ sntp_request(void *arg) if (err == ERR_INPROGRESS) { /* DNS request sent, wait for sntp_dns_found being called */ LWIP_DEBUGF(SNTP_DEBUG_STATE, ("sntp_request: Waiting for server address to be resolved.\n")); + uapi_cat1_wakeup_cat1(0); return; } else if (err == ERR_OK) { sntp_servers[sntp_current_server].addr = sntp_server_address; @@ -643,6 +648,7 @@ sntp_request(void *arg) sys_untimeout(sntp_try_next_server, NULL); sys_timeout((u32_t)SNTP_RETRY_TIMEOUT, sntp_try_next_server, NULL); } + uapi_cat1_wakeup_cat1(0); } /**