From 6a43691a93e33ef3c5ab8fb6a1cbcccedb5dc3d2 Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Thu, 28 Aug 2025 12:32:14 +0800 Subject: [PATCH] =?utf8?q?=E6=97=A5=E7=A8=8B=E5=90=8C=E6=AD=A5=E4=BF=AE?= =?utf8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/schedule/include/ScheduleModel.h | 24 ++++++ .../nativeui/schedule/src/ScheduleModel.cpp | 84 +++++++++++++++++++ .../ble_service/blemoder/bleInstruct.cpp | 3 + .../blemoder/ble_instruct_init.cpp | 2 + 4 files changed, 113 insertions(+) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/schedule/include/ScheduleModel.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/schedule/include/ScheduleModel.h index 3e028f7e5..9f8b7e0a1 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/schedule/include/ScheduleModel.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/schedule/include/ScheduleModel.h @@ -6,6 +6,30 @@ #include "schedule/include/ScheduleListItem.h" #include "schedule/include/ScheduleData.h" +#ifdef BLE_INSTRUCT + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif /* __cplusplus */ +#endif /* __cplusplus */ + + +#include "bleEvent.h" +#include "bleInstruct.h" + +void ble_Schedule_init(); + +#ifdef __cplusplus +#if __cplusplus +} +#endif /* __cplusplus */ +#endif /* __cplusplus */ + + +#endif + + namespace OHOS { diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/schedule/src/ScheduleModel.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/schedule/src/ScheduleModel.cpp index fcfd984eb..b77acdc46 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/schedule/src/ScheduleModel.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/schedule/src/ScheduleModel.cpp @@ -297,3 +297,87 @@ int C_ScheduleDataWriteToFile(void) WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[%d]:C_ScheduleDataWriteToFile", __LINE__); return OHOS::ScheduleModel::GetInstance().ScheduleDataWriteToFile(); } + + +#ifdef BLE_INSTRUCT + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif /* __cplusplus */ +#endif /* __cplusplus */ + + +#include "bleEvent.h" +#include "bleInstruct.h" + + +bool Ble_Set_ScheduleInfo_(uint8_t id,uint32_t timetamp_begin,uint32_t timetamp_end,char *title,char *data,bool is_end) +{ + + // OHOS::ScheduleRevData info_; + ScheduleRevData info_; + + info_.topic.clear(); + info_.content.clear(); + info_.topic.append(title,strlen(title)); + info_.content.append(data,strlen(data)); + + time_t currtime=timetamp_begin; + struct tm *timeinfo; + timeinfo = localtime(&currtime); + + int y=timeinfo->tm_year+ 1900; + int m=timeinfo->tm_mon+1; + int d=timeinfo->tm_mday; + int h=timeinfo->tm_hour; + int min=timeinfo->tm_min; + char day_buf[24]={0}; + sprintf_s(day_buf,24,"%d/%d",m,d); + info_.date.clear(); + info_.date.append(day_buf,strlen(day_buf)); + + currtime=timetamp_end; + timeinfo = localtime(&currtime); + + int h_=timeinfo->tm_hour; + int min_=timeinfo->tm_min; + char time_buf[24]={0}; + sprintf_s(time_buf,24,"%02d:%02d-%02d:%02d",h,min,h_,min_); + info_.time.clear(); + info_.time.append(time_buf,strlen(time_buf)); + + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"///////////////////日程数据////////////////////\r\n"); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"date:%s\r\n",info_.date.c_str()); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"time:%s\r\n",info_.time.c_str()); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"titel:%s\r\n",info_.topic.c_str()); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"content:%s\r\n",info_.content.c_str()); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"//////////////////////////////////////////////\r\n"); + // WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"delete_before_file now day%d %d %d\r\n ",y,m,d); + + // OHOS::C_ScheduleSetByApp(&info_, id - 1, is_end); + C_ScheduleSetByApp(&info_, id-1, is_end); + + if(is_end) + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"////////////////////结束///////////////////\r\n"); + return true; +} + + + +extern bleInstruct_t_ bleInstruct_t; + +void ble_Schedule_init() +{ + bleInstruct_t.Ble_Set_ScheduleInfo_cb=Ble_Set_ScheduleInfo_; +} + + +#ifdef __cplusplus +#if __cplusplus +} +#endif /* __cplusplus */ +#endif /* __cplusplus */ + + +#endif diff --git a/code/sdk/zhihui/services/ble_service/blemoder/bleInstruct.cpp b/code/sdk/zhihui/services/ble_service/blemoder/bleInstruct.cpp index b92fcd044..8751029b7 100644 --- a/code/sdk/zhihui/services/ble_service/blemoder/bleInstruct.cpp +++ b/code/sdk/zhihui/services/ble_service/blemoder/bleInstruct.cpp @@ -1253,6 +1253,7 @@ cJSON* ble_app_list(void) cJSON* ble_get_watch_msg(void) { + return bleInstruct_t.ble_get_watch_msg(); } @@ -1264,3 +1265,5 @@ cJSON* ble_get_watch_msg(void) } #endif /* __cplusplus */ #endif /* __cplusplus */ + + diff --git a/code/sdk/zhihui/services/ble_service/blemoder/ble_instruct_init.cpp b/code/sdk/zhihui/services/ble_service/blemoder/ble_instruct_init.cpp index 690c28bec..70ab3e5ed 100644 --- a/code/sdk/zhihui/services/ble_service/blemoder/ble_instruct_init.cpp +++ b/code/sdk/zhihui/services/ble_service/blemoder/ble_instruct_init.cpp @@ -15,6 +15,8 @@ void ble_instruct_init(void) { + ble_Schedule_init(); + ble_dial_init(); ble_alarm_init(); -- 2.17.1