From: 胡传军 <1224667075@qq.com> Date: Thu, 18 Apr 2024 04:04:53 +0000 (+0000) Subject: Merge #39 into xts_origin from refs/changes/39/head X-Git-Tag: release_V1.2.70_20241020_135402~1162^2~11^2 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=9dab9d84dc4b26f184e52e6d3da9af0ef1963589;p=mirrors%2FFD230.git Merge #39 into xts_origin from refs/changes/39/head Code review from 胡传军 * refs/changes/39/head: (6 commits squashed) - 多包数据发送修改及通讯录AT指令添加修改 - 修改编译错误 - Merge branch 'xts_origin' of codeup.aliyun.com:64191456b9581d62e8f81ac0/FD230 into xts_origin - Merge branch 'xts_origin' of codeup.aliyun.com:64191456b9581d62e8f81ac0/FD230 into xts_origin - Merge branch 'xts_origin' of codeup.aliyun.com:64191456b9581d62e8f81ac0/FD230 into xts_origin - 蓝牙设置语言及关机重启 Signed-off-by: aliyun8003852482 <1224667075@qq.com> Reviewed-by: snickersun@163.com Merged-by: snickersun@163.com CR-link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/39 --- diff --git a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h index e5f438867..49bf3e6ee 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h @@ -26,6 +26,15 @@ enum PAIRING REBOOT, SHUTDOWN }; + +enum TRANING +{ + START=0, + STOP, + RECOVER, + END +}; + void set_weather_now_data(int humidity, char* windScale, char* textNight,int uvIndex,int temp,int iconNight); void set_weather_address_data(int lat, char* atm, char* city,char* subLocality,int lon); diff --git a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c index b3fb0d9c6..c4e7ba1ae 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c @@ -234,6 +234,7 @@ static cJSON *cjson_json_tmp = NULL; errcode_t sendBleData(uint8_t *buf,uint16_t len) { errcode_t ret = ERRCODE_FAIL; + printf("bigDataBufState:%d and sendbigDataBufState %d\r\n",bigDataBufState,sendbigDataBufState); if(bigDataBufState == true || sendbigDataBufState == true)return ERRCODE_FAIL; //在手表发送分包数据时 手表不允许发指令给app for(uint16_t i = 0;ivalueint; - uint8_t vale=cJSON_GetObjectItem(heart_data_item,"oxygen_value")->valueint; + uint8_t vale=cJSON_GetObjectItem(heart_data_item,"heart_value")->valueint; + printf("heart_value :%d\r\n",vale); + printf("timestamp :%d\r\n",timestamp); memcpy(send_buf+send_len,×tamp,4); send_len+=4; memcpy(send_buf+send_len,&vale,1); send_len+=1; - if((i%96==0 && i!=0) || (item_num-1==i)) + if(((i+1)%num==0 && i!=0) || (item_num-1==i)) { //发送数据 if(item_num-1==i) { + printf("sendbuf :%s sendbuf_len%d\r\n",send_buf,send_len); send_big_data(0,send_buf,send_len,item_num*5,Packet_id,packet_total,0x40); free(send_buf); sendbigDataBufState=false; @@ -3918,9 +3940,10 @@ void Read_spo2_file_buf_Data(uint8_t id) free(send_buf); send_buf=(char *)malloc(sizeof(char)*HEART_DATA_LEN); send_len=0; + Packet_id++; } } - send_buf=realloc(send_buf,i*5+5); + send_buf=realloc(send_buf,i*5+10); } cJSON_free(heart_data); @@ -3935,6 +3958,7 @@ void Read_heart_file_buf_Data(uint8_t num) FILE *fp= fopen(path,"r+"); if(fp==NULL) { + send_big_data(0,NULL,0,0,1,1,0x40); return; } int ret=fread(buf,1,512,fp); @@ -3994,6 +4018,7 @@ void Read_heart_file_buf_Data(uint8_t num) free(send_buf); send_buf=(char *)malloc(sizeof(char)*HEART_DATA_LEN); send_len=0; + Packet_id++; } } send_buf=realloc(send_buf,i*5+10); @@ -4013,7 +4038,9 @@ void readDevDataBle(uint8_t *crcnum,uint16_t len,uint8_t crcvalue) { case 0x40://同步心率历史数据 EACH_DATA_LEN = HEART_DATA_LEN; - Read_heart_file_buf_Data(3); + int num=(ble_nus_max_data_len-18)/HEART_DATA_LEN; + printf("同步心率数据,每包最多:%d 条数据\r\n",num); + Read_heart_file_buf_Data(num); break; case 0x41://同步血氧历史数据 printf("同步血氧数据\r\n"); diff --git a/code/sdk/application/wearable/service/broadcast/include/broadcast_feature.h b/code/sdk/application/wearable/service/broadcast/include/broadcast_feature.h index 141ccf71f..ac9ec75a5 100755 --- a/code/sdk/application/wearable/service/broadcast/include/broadcast_feature.h +++ b/code/sdk/application/wearable/service/broadcast/include/broadcast_feature.h @@ -48,6 +48,7 @@ typedef enum { #ifdef CYWEE_SPORT TOPIC_EVENT_ACTIVITY_UPDATE, TOPIC_EVENT_INACTIVITY_UPDATE, + TOPIC_EVENT_BLE_TRAINING, #endif #ifdef SUPPORT_CHARGER_PLUG_DETECTION_NOTIFICATION TOPIC_EVENT_CHARGE_PLUG, @@ -78,6 +79,7 @@ typedef enum { TOPIC_EVENT_DEVICE_UNBIND, TOPIC_EVENT_DEVICE_UNBINDING_REQUEST, #endif + TOPIC_EVENT_FIND_WATCH, //查找手表 TOPIC_EVENT_CANCEL_FIND_WATCH,//取消查找 TOPIC_END_NUM = 20000, diff --git a/code/sdk/application/wearable/service/msg_center/include/notify/charge_notification.h b/code/sdk/application/wearable/service/msg_center/include/notify/charge_notification.h index 357ed567f..a2709247c 100644 --- a/code/sdk/application/wearable/service/msg_center/include/notify/charge_notification.h +++ b/code/sdk/application/wearable/service/msg_center/include/notify/charge_notification.h @@ -8,9 +8,9 @@ namespace OHOS // UIView *view_ = nullptr; UIViewGroup* lowPowerShow(void); - void set_lowpower_falg(bool falg); + void set_lowpower_falg(uint8_t falg); void FreelowPower(void); - void low_power_paly(bool); + void low_power_paly(); class lowppowrAnimatorStopListener :public OHOS::UIImageAnimatorView::AnimatorStopListener { diff --git a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp index feeab27aa..208226f06 100755 --- a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp @@ -41,6 +41,8 @@ #include "ConfigModel.h" #include "power_display_service.h" #include "bletest.h" +//#include "TraingCardPresenter.h" + //#include "Systemupgrade.h" namespace OHOS { @@ -54,6 +56,7 @@ const PriorityMapper g_pri_mapper[] = { {TOPIC_EVENT_NEXTDAY_UPDATE, PRIORITY_TWO}, {TOPIC_EVENT_ACTIVITY_UPDATE,PRIORITY_TWO}, {TOPIC_EVENT_INACTIVITY_UPDATE,PRIORITY_TWO}, + {TOPIC_EVENT_BLE_TRAINING,PRIORITY_TWO}, #ifdef SUPPORT_CHARGER_PLUG_DETECTION_NOTIFICATION {TOPIC_EVENT_CHARGE_PLUG, PRIORITY_TWO}, {TOPIC_EVENT_CHARGE_UNPLUG, PRIORITY_TWO}, @@ -124,6 +127,7 @@ void MsgCenterSubscribe() #ifdef CYWEE_SPORT MsgCenterSubscribeTopic(TOPIC_EVENT_ACTIVITY_UPDATE); MsgCenterSubscribeTopic(TOPIC_EVENT_INACTIVITY_UPDATE); + MsgCenterSubscribeTopic(TOPIC_EVENT_BLE_TRAINING); #endif #ifdef SUPPORT_CHARGER_PLUG_DETECTION_NOTIFICATION @@ -279,12 +283,12 @@ void MsgCenterNotifyLowPowerAlarmProc(const Topic topic, Request* req) if(*x==3) { //倒计时结束后,直接执行关机动画 - low_power_paly(true); + low_power_paly(); } else if(*x==0) { //提醒低电充电 - set_lowpower_falg(false); + set_lowpower_falg(0); if (NotificationManager::GetInstance()->hasNotifyShowing()) NotificationManager::GetInstance()->StopNotify(); NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO); @@ -293,7 +297,7 @@ void MsgCenterNotifyLowPowerAlarmProc(const Topic topic, Request* req) else { //电量过低,直接提醒关机 - set_lowpower_falg(true); + set_lowpower_falg(1); if (NotificationManager::GetInstance()->hasNotifyShowing()) NotificationManager::GetInstance()->StopNotify(); NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO); @@ -363,54 +367,7 @@ void MsgCenterNotifyHfpWatchProc(const Topic topic, Request* req) NotificationManager::GetInstance()->ShowNotify(showCallingNotify, (uint16_t)topic, true); } } -//一般模式 -void MsgCenterNotifyNormalProc(const Topic topic, Request* req) -{ - unused(topic); - unused(req); -} -//跑步机模式 -void MsgCenterNotifyTreadmillProc(const Topic topic, Request* req) -{ - unused(topic); - unused(req); -} -//户外跑步模式 -void MsgCenterNotifyOutdoorRunningProc(const Topic topic, Request* req) -{ - unused(topic); - unused(req); -} -//室内跑步模式 -void MsgCenterNotifyIndoorRunningProc(const Topic topic, Request* req) -{ - unused(topic); - unused(req); -} -//防误触计步 -void MsgCenterNotifyFitnessPedometerProc(const Topic topic, Request* req) -{ - unused(topic); - unused(req); -} -//自由运动模式 -void MsgCenterNotifyFreeTrainingProc(const Topic topic, Request* req) -{ - unused(topic); - unused(req); -} -//长时间动作侦测模式 -void MsgCenterNotifyArAlertProc(const Topic topic, Request* req) -{ - unused(topic); - unused(req); -} -void MsgCenterNotifyExtraInfoProc(const Topic topic, Request* req) -{ - unused(topic); - unused(req); -} #ifdef SUPPORT_SPO2_NOTIFICATION_TEST uint32_t md = PPG_SERVICE_CMD_TYPE_DO_PPG_TEST; //灰卡测试 @@ -755,6 +712,7 @@ void MsgCenterNotifyDeviceBindProc(const Topic topic, Request* req) display_api->turn_on_screen(); } uint8_t* data=(uint8_t*)req->data; + if(data!=NULL && req->len>=2) { switch (data[0]) @@ -772,16 +730,24 @@ void MsgCenterNotifyDeviceBindProc(const Topic topic, Request* req) NotificationManager::GetInstance()->ShowNotify(showDeviceUnbindingRequestNotify, (uint16_t)topic, true); break; case SHUTDOWN: - set_lowpower_falg(true); + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, " SHUTDOWN"); + set_lowpower_falg(3); + if (NotificationManager::GetInstance()->hasNotifyShowing()) + NotificationManager::GetInstance()->StopNotify(); + NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO); + NotificationManager::GetInstance()->ShowNotify(showlowpowerNotify, (uint16_t)topic, true); - low_power_paly(true); + //low_power_paly(true); break; case REBOOT: - set_lowpower_falg(true); + set_lowpower_falg(4); + if (NotificationManager::GetInstance()->hasNotifyShowing()) + NotificationManager::GetInstance()->StopNotify(); + NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO); NotificationManager::GetInstance()->ShowNotify(showlowpowerNotify, (uint16_t)topic, true); - low_power_paly(false); + //low_power_paly(false); break; default: @@ -854,6 +820,33 @@ void MsgCenterNotifyInactivityProc(const Topic topic, Request* req) { unused(topic); unused(req); +} +//APP运动相关 +void MsgCenterNotifybleAPPtraining(const Topic topic, Request* req) +{ + unused(topic); + uint8_t* data=(uint8_t*)req->data; + if(data!=NULL && req->len>=2) + { + switch (data[1]) + { + case START://运动开始 + + break; + case STOP://运动暂停 + + break; + case RECOVER://运动恢复 + + break; + + case END://运动结束 + break; + } + } + + // unused(req); + } /* 订阅事件通知逻辑可定制 */ static msg_center_notify_table_t g_msg_center_notify_table[] = { @@ -867,8 +860,11 @@ static msg_center_notify_table_t g_msg_center_notify_table[] = { {TOPIC_EVENT_HFP_PHONE_TO_WATCH, MsgCenterNotifyHfpWatchProc}, {TOPIC_EVENT_FIND_WATCH,MsgCenterNotifyFindWatchProc}, {TOPIC_EVENT_CANCEL_FIND_WATCH,MsgCenterNotifyCanCelFindWatchProc}, + #ifdef CYWEE_SPORT {TOPIC_EVENT_ACTIVITY_UPDATE, MsgCenterNotifyActivityProc}, {TOPIC_EVENT_INACTIVITY_UPDATE, MsgCenterNotifyInactivityProc}, + {TOPIC_EVENT_BLE_TRAINING, MsgCenterNotifybleAPPtraining}, +#endif #ifdef SUPPORT_CHARGER_PLUG_DETECTION_NOTIFICATION {TOPIC_EVENT_CHARGE_PLUG, MsgCenterNotifyChargePlugProc}, {TOPIC_EVENT_CHARGE_UNPLUG, MsgCenterNotifyChargeUnPlugProc}, diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/charge_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/charge_notification.cpp index f2c2a9b1d..c057d456d 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/charge_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/charge_notification.cpp @@ -110,8 +110,8 @@ namespace OHOS return group; } - static bool battery_falg=false; - void set_lowpower_falg(bool falg) + static uint8_t battery_falg=0; + void set_lowpower_falg(uint8_t falg) { battery_falg=falg; } @@ -175,11 +175,12 @@ namespace OHOS } } - bool poweroff_flag=true; - void low_power_paly(bool falg) + + void low_power_paly() { //uapi_poweroff_device(); // 关机 - poweroff_flag=falg; + + //osTimerStop(low_power_timer); group->SetVisible(true); UIImageAnimatorView::AnimatorStopListener *stoplistener = static_cast(lowppowrAnimatorStopListener::GetInstance()); ShutDownImageAnimatorView->SetAnimatorStopListener(stoplistener); @@ -226,7 +227,7 @@ namespace OHOS alarm_UILabel->SetStyle(STYLE_TEXT_FONT, 33); // Set additional property - if(battery_falg==false) + if(battery_falg==0) { alarm_UILabel->SetText("请及时连接充电器"); alarm_UILabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); @@ -235,7 +236,7 @@ namespace OHOS alarm_UILabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 33); } // Set additional property - if(battery_falg==true) + if(battery_falg==1) { alarm_UILabel->SetPosition(50, 215); alarm_UILabel->SetText("电量过低5s后将自动关机"); @@ -288,6 +289,18 @@ namespace OHOS ShowUpShutDownAnimatorView(); if(group) UIViewGroup_lowpower->Add(group); + if(battery_falg>=3) + { + group->SetVisible(true); + UIImageAnimatorView::AnimatorStopListener *stoplistener = static_cast(lowppowrAnimatorStopListener::GetInstance()); + ShutDownImageAnimatorView->SetAnimatorStopListener(stoplistener); + if (stoplistener == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Failed to Create stoplistener!!"); + return NULL; + } + ShutDownImageAnimatorView->Start(); + } return UIViewGroup_lowpower; } @@ -315,7 +328,7 @@ namespace OHOS if(battery_falg) { osTimerStop(low_power_timer); - low_power_paly(true); + low_power_paly(); } else @@ -332,10 +345,10 @@ namespace OHOS { //UNUSED(view); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "xxxxxxxxxxxxxxxxxxxxOnAnimatorStop"); - if(poweroff_flag) - uapi_poweroff_device(); // 关机 - else + if(battery_falg==4) uapi_reboot_device(); + else + uapi_poweroff_device(); // 关机 //NotificationManager::GetInstance()->StopNotify(); // // if(strcmp(view.GetViewId(),LOW_POWER_BUTTON)!=0)