From: Caisking Date: Wed, 10 Sep 2025 11:24:09 +0000 (+0800) Subject: 合并602的notify弹窗, X-Git-Tag: leiniao_debug_1.0.0_20250922_020716~104 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=8f1db4ed220d3031a8a332d9c70649354cbd0351;p=mirrors%2FFD230.git 合并602的notify弹窗, --- diff --git a/code/sdk/application/wearable/fd230/service/broadcast/include/broadcast_feature.h b/code/sdk/application/wearable/fd230/service/broadcast/include/broadcast_feature.h index 649e91033..ce6030c7b 100644 --- a/code/sdk/application/wearable/fd230/service/broadcast/include/broadcast_feature.h +++ b/code/sdk/application/wearable/fd230/service/broadcast/include/broadcast_feature.h @@ -64,15 +64,6 @@ typedef enum { TOPIC_EVENT_CHARGE_PLUG, TOPIC_EVENT_CHARGE_UNPLUG, TOPIC_EVENT_LOWPOWER_ALARM, -#ifdef SUPPORT_SPO2_NOTIFICATION - TOPIC_EVENT_SPO2_UPDATE, - TOPIC_EVENT_START_HRS_MONITORING, - TOPIC_EVENT_STOP_HRS_MONITORING, - TOPIC_EVENT_START_SPO2_MONITORING, - TOPIC_EVENT_STOP_SPO2_MONITORING, - TOPIC_EVENT_GRAYCARD_UPDATA, - TOPIC_EVENT_LEAKLIGHT_UPDATA, -#endif #ifdef SUPPORT_CAT1_MODEM TOPIC_EVENT_CAT1_INCOMMING, TOPIC_EVENT_CAT1_CALLCONNTED, diff --git a/code/sdk/application/wearable/fd230/service/broadcast/src/broadcast_implement.c b/code/sdk/application/wearable/fd230/service/broadcast/src/broadcast_implement.c index bc4e7be3e..b8a697902 100644 --- a/code/sdk/application/wearable/fd230/service/broadcast/src/broadcast_implement.c +++ b/code/sdk/application/wearable/fd230/service/broadcast/src/broadcast_implement.c @@ -27,35 +27,52 @@ static const TopicToCore topicToCoreArray[] = { {TOPIC_EVENT_STEPDATA_UPDATE, A_CORE_MASK, 1}, {TOPIC_EVENT_SHUTDOWN, A_CORE_MASK, 1}, {TOPIC_EVENT_HEARTRATE_UPDATA, A_CORE_MASK, 1}, + {TOPIC_EVENT_STATIC_HEARTRATE_UPDATA, A_CORE_MASK, 1}, +#ifdef CYWEE_SPORT + {TOPIC_EVENT_ACTIVITY_UPDATE, A_CORE_MASK, 1}, + {TOPIC_EVENT_ACTIVITY_EXTRA_INFO_UPDATE, A_CORE_MASK, 1}, + {TOPIC_EVENT_AR_ALERT_TYPE_UPDATE, A_CORE_MASK, 1}, + {TOPIC_EVENT_INACTIVITY_UPDATE, A_CORE_MASK, 1}, + {TOPIC_EVENT_INACTIVITY_ACCUMULATE_TIME_UPDATE, A_CORE_MASK, 1}, + {TOPIC_EVENT_BLE_TRAINING,A_CORE_MASK,1}, + {TOPIC_EVENT_BLE_TRANSMIT,A_CORE_MASK,1}, + {TOPIC_EVENT_GOAL_SHOW_VIEW,A_CORE_MASK,1}, + +#endif +#ifdef SUPPORT_SPO2_NOTIFICATION + {TOPIC_EVENT_SPO2_UPDATE, A_CORE_MASK, 1}, + {TOPIC_EVENT_START_HRS_MONITORING, A_CORE_MASK, 1}, + {TOPIC_EVENT_STOP_HRS_MONITORING, A_CORE_MASK, 1}, + {TOPIC_EVENT_START_SPO2_MONITORING, A_CORE_MASK, 1}, + {TOPIC_EVENT_STOP_SPO2_MONITORING, A_CORE_MASK, 1}, + {TOPIC_EVENT_GRAYCARD_UPDATA, A_CORE_MASK, 1}, + {TOPIC_EVENT_LEAKLIGHT_UPDATA, A_CORE_MASK, 1}, +#endif {TOPIC_EVENT_HFP_INCOMMING, A_CORE_MASK, 1}, {TOPIC_EVENT_HFP_PHONE_ACTIVE, A_CORE_MASK, 1}, {TOPIC_EVENT_HFP_WATCH_ACTIVE, A_CORE_MASK, 1}, {TOPIC_EVENT_HFP_FINISHED, A_CORE_MASK, 1}, {TOPIC_EVENT_HFP_PHONE_TO_WATCH, A_CORE_MASK, 1}, {TOPIC_EVENT_HFP_WATCH_TO_PHONE, A_CORE_MASK, 1}, - {TOPIC_EVENT_BLOODOXYGEN_UPDATA, A_CORE_MASK, 1}, - {TOPIC_EVENT_SPORT_DISTANCE, A_CORE_MASK, 1}, - {TOPIC_EVENT_LOCATION, A_CORE_MASK, 1}, - {TOPIC_EVENT_DEVICE_BIND, A_CORE_MASK, 1}, - {TOPIC_EVENT_BLE_TRANSMIT, A_CORE_MASK, 1}, + {TOPIC_EVENT_HFP_HINT, A_CORE_MASK, 1}, + +#ifdef SUPPORT_CHARGER_PLUG_DETECTION_NOTIFICATION {TOPIC_EVENT_CHARGE_PLUG, A_CORE_MASK, 1}, {TOPIC_EVENT_CHARGE_UNPLUG, A_CORE_MASK, 1}, {TOPIC_EVENT_LOWPOWER_ALARM, A_CORE_MASK, 1}, - {TOPIC_EVENT_AR_ALERT_TYPE_UPDATE, A_CORE_MASK, 1}, - {TOPIC_EVENT_INACTIVITY_UPDATE, A_CORE_MASK, 1}, - {TOPIC_EVENT_FIND_WATCH, A_CORE_MASK, 1}, //查找手表 - {TOPIC_EVENT_DEBUGOUTPUT, A_CORE_MASK, 1}, - {TOPIC_EVENT_GOAL_SHOW_VIEW, A_CORE_MASK, 1}, - {TOPIC_EVENT_DRINKREMINDER, A_CORE_MASK, 1}, - {TOPIC_EVENT_SLEEPNOTE, A_CORE_MASK, 1}, - {TOPIC_EVENT_ENTER_CMAERA,A_CORE_MASK, 1}, //遥控拍照 - {TOPIC_EVENT_CANCEL_CMAERA,A_CORE_MASK, 1}, //取消遥控拍照 - {TOPIC_EVENT_ASSISTANT_NOTE,A_CORE_MASK, 1}, //语音助手 +#endif + {TOPIC_EVENT_DEVICE_BIND,A_CORE_MASK, 1}, + {TOPIC_EVENT_ENTER_CMAERA,A_CORE_MASK, 1},//遥控拍照 + {TOPIC_EVENT_ASSISTANT_NOTE,A_CORE_MASK, 1},//语音助手 + {TOPIC_EVENT_CANCEL_CMAERA,A_CORE_MASK, 1}, + {TOPIC_EVENT_FIND_WATCH,A_CORE_MASK, 1},//查找手表 + {TOPIC_EVENT_CANCEL_FIND_WATCH,A_CORE_MASK, 1}, + {TOPIC_EVENT_DRINKREMINDER,A_CORE_MASK, 1}, {TOPIC_EVENT_MESSAGENOTE,A_CORE_MASK, 1}, {TOPIC_EVENT_MESSAGE_UPDATA,A_CORE_MASK, 1}, + {TOPIC_EVENT_SLEEPNOTE,A_CORE_MASK, 1}, + {TOPIC_EVENT_DEBUGOUTPUT,A_CORE_MASK, 1}, {TOPIC_EVENT_SHUTDOWN_ANIMATIOR,A_CORE_MASK, 1}, - {TOPIC_EVENT_HFP_HINT,A_CORE_MASK, 1}, - #ifdef SUPPORT_CAT1_MODEM {TOPIC_EVENT_CAT1_INCOMMING, A_CORE_MASK, 1}, {TOPIC_EVENT_CAT1_CALLCONNTED, A_CORE_MASK, 1}, diff --git a/code/sdk/application/wearable/fd230/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/fd230/service/msg_center/src/msg_center_customer.cpp index 62376637a..429483f96 100644 --- a/code/sdk/application/wearable/fd230/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/fd230/service/msg_center/src/msg_center_customer.cpp @@ -81,7 +81,7 @@ namespace OHOS { #ifdef __cplusplus extern "C" { -#endif +#endif /* 订阅事件设定优先级 */ const PriorityMapper PRI_MAPPER[] = { @@ -93,7 +93,7 @@ const PriorityMapper PRI_MAPPER[] = { {TOPIC_EVENT_HFP_WATCH_ACTIVE, PRIORITY_ONE}, {TOPIC_EVENT_HFP_WATCH_TO_PHONE, PRIORITY_ONE}, {TOPIC_EVENT_HFP_PHONE_TO_WATCH, PRIORITY_ONE}, - + #ifdef SUPPORT_CAT1_MODEM {TOPIC_EVENT_CAT1_INCOMMING, PRIORITY_ONE}, {TOPIC_EVENT_CAT1_CALLCONNTED, PRIORITY_ONE}, @@ -104,28 +104,35 @@ const PriorityMapper PRI_MAPPER[] = { {TOPIC_EVENT_CAT1_POWER_OFF, PRIORITY_ONE}, {TOPIC_EVENT_CAT1_CALL_FAIL,PRIORITY_ONE}, {TOPIC_EVENT_HFP_HINT,PRIORITY_ONE}, - +#endif + {TOPIC_EVENT_ON_TIME,PRIORITY_TWO}, + +#if 0 + {TOPIC_EVENT_ACTIVITY_UPDATE,PRIORITY_TWO}, + {TOPIC_EVENT_ACTIVITY_EXTRA_INFO_UPDATE,PRIORITY_TWO}, + {TOPIC_EVENT_AR_ALERT_TYPE_UPDATE,PRIORITY_TWO}, + {TOPIC_EVENT_STEPDATA_UPDATE,PRIORITY_TWO}, + {TOPIC_EVENT_INACTIVITY_UPDATE,PRIORITY_TWO}, + {TOPIC_EVENT_INACTIVITY_ACCUMULATE_TIME_UPDATE,PRIORITY_TWO}, + {TOPIC_EVENT_GOAL_SHOW_VIEW,PRIORITY_TWO}, #endif - {TOPIC_EVENT_DEVICE_BIND, PRIORITY_ONE}, + {TOPIC_EVENT_BLE_TRAINING,PRIORITY_TWO}, {TOPIC_EVENT_BLE_TRANSMIT,PRIORITY_ONE}, - // #ifdef SUPPORT_CHARGER_PLUG_DETECTION_NOTIFICATION + {TOPIC_EVENT_CHARGE_PLUG, PRIORITY_TWO}, {TOPIC_EVENT_CHARGE_UNPLUG, PRIORITY_TWO}, {TOPIC_EVENT_LOWPOWER_ALARM,PRIORITY_TWO}, - // #endif - // #ifdef SUPPORT_CYWEE_SERVICE - {TOPIC_EVENT_AR_ALERT_TYPE_UPDATE, PRIORITY_TWO}, - {TOPIC_EVENT_INACTIVITY_UPDATE, PRIORITY_TWO}, - // #endif - {TOPIC_EVENT_FIND_WATCH,PRIORITY_TWO}, // 查找找手表 - {TOPIC_EVENT_DEBUGOUTPUT,PRIORITY_ONE}, // 开发调试专用窗口 - {TOPIC_EVENT_GOAL_SHOW_VIEW,PRIORITY_TWO}, // 训练目标弹窗 - {TOPIC_EVENT_DRINKREMINDER,PRIORITY_TWO}, // 喝水提醒弹窗 - {TOPIC_EVENT_SLEEPNOTE,PRIORITY_TWO}, // 睡眠提醒弹窗 - {TOPIC_EVENT_SHUTDOWN_ANIMATIOR,PRIORITY_ONE}, // 关机动画弹窗 - + {TOPIC_EVENT_DEVICE_BIND, PRIORITY_ONE}, + {TOPIC_EVENT_FIND_WATCH,PRIORITY_TWO},// 找手表 [2] + {TOPIC_EVENT_CANCEL_FIND_WATCH,PRIORITY_TWO},// 取消找手表 [2] + {TOPIC_EVENT_DRINKREMINDER,PRIORITY_TWO},//喝水提醒 [2] + {TOPIC_EVENT_MESSAGENOTE,PRIORITY_THREE},//消息提醒 [3] + {TOPIC_EVENT_MESSAGE_UPDATA,PRIORITY_TWO},//消息更新提醒 [3] + {TOPIC_EVENT_SLEEPNOTE,PRIORITY_THREE},//睡眠弹窗 [3] + {TOPIC_EVENT_DEBUGOUTPUT,PRIORITY_ONE},//开发调试专用窗口 + {TOPIC_EVENT_SHUTDOWN_ANIMATIOR,PRIORITY_ONE},//关机动画 }; bool g_pressFlag = false; @@ -152,31 +159,26 @@ void MsgCenterSubscribe() { MsgCenterSubscribeTopic(TOPIC_EVENT_ALARM_RING); MsgCenterSubscribeTopic(TOPIC_EVENT_NEXTDAY_UPDATE); + MsgCenterSubscribeTopic(TOPIC_EVENT_ON_TIME); + MsgCenterSubscribeTopic(TOPIC_EVENT_STEPDATA_UPDATE); MsgCenterSubscribeTopic(TOPIC_EVENT_HFP_INCOMMING); MsgCenterSubscribeTopic(TOPIC_EVENT_HFP_PHONE_ACTIVE); MsgCenterSubscribeTopic(TOPIC_EVENT_HFP_WATCH_ACTIVE); MsgCenterSubscribeTopic(TOPIC_EVENT_HFP_FINISHED); MsgCenterSubscribeTopic(TOPIC_EVENT_HFP_PHONE_TO_WATCH); MsgCenterSubscribeTopic(TOPIC_EVENT_HFP_WATCH_TO_PHONE); - MsgCenterSubscribeTopic(TOPIC_EVENT_DEVICE_BIND); + MsgCenterSubscribeTopic(TOPIC_EVENT_HFP_HINT); + MsgCenterSubscribeTopic(TOPIC_EVENT_ACTIVITY_UPDATE); + MsgCenterSubscribeTopic(TOPIC_EVENT_ACTIVITY_EXTRA_INFO_UPDATE); + MsgCenterSubscribeTopic(TOPIC_EVENT_AR_ALERT_TYPE_UPDATE); + MsgCenterSubscribeTopic(TOPIC_EVENT_INACTIVITY_UPDATE); + MsgCenterSubscribeTopic(TOPIC_EVENT_INACTIVITY_ACCUMULATE_TIME_UPDATE); + MsgCenterSubscribeTopic(TOPIC_EVENT_BLE_TRAINING); MsgCenterSubscribeTopic(TOPIC_EVENT_BLE_TRANSMIT); - // #ifdef SUPPORT_CHARGER_PLUG_DETECTION_NOTIFICATION + MsgCenterSubscribeTopic(TOPIC_EVENT_GOAL_SHOW_VIEW); MsgCenterSubscribeTopic(TOPIC_EVENT_CHARGE_PLUG); MsgCenterSubscribeTopic(TOPIC_EVENT_CHARGE_UNPLUG); MsgCenterSubscribeTopic(TOPIC_EVENT_LOWPOWER_ALARM); - // #endif - // #ifdef SUPPORT_CYWEE_SERVICE - MsgCenterSubscribeTopic(TOPIC_EVENT_AR_ALERT_TYPE_UPDATE); - MsgCenterSubscribeTopic(TOPIC_EVENT_INACTIVITY_UPDATE); - // #endif - MsgCenterSubscribeTopic(TOPIC_EVENT_FIND_WATCH); - MsgCenterSubscribeTopic(TOPIC_EVENT_DEBUGOUTPUT); - MsgCenterSubscribeTopic(TOPIC_EVENT_GOAL_SHOW_VIEW); - MsgCenterSubscribeTopic(TOPIC_EVENT_DRINKREMINDER); - MsgCenterSubscribeTopic(TOPIC_EVENT_SLEEPNOTE); - MsgCenterSubscribeTopic(TOPIC_EVENT_SHUTDOWN_ANIMATIOR); - - MsgCenterSubscribeTopic(TOPIC_EVENT_HFP_HINT); #ifdef SUPPORT_CAT1_MODEM MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_INCOMMING); MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_CALLCONNTED); @@ -188,7 +190,19 @@ void MsgCenterSubscribe() MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_CALL_FAIL); #endif - + MsgCenterSubscribeTopic(TOPIC_EVENT_DEVICE_BIND); + MsgCenterSubscribeTopic(TOPIC_EVENT_FIND_WATCH); + MsgCenterSubscribeTopic(TOPIC_EVENT_CANCEL_FIND_WATCH); + MsgCenterSubscribeTopic(TOPIC_EVENT_DRINKREMINDER); + MsgCenterSubscribeTopic(TOPIC_EVENT_MESSAGENOTE); + MsgCenterSubscribeTopic(TOPIC_EVENT_SLEEPNOTE); + MsgCenterSubscribeTopic(TOPIC_EVENT_DEBUGOUTPUT); + MsgCenterSubscribeTopic(TOPIC_EVENT_SHUTDOWN_ANIMATIOR); +} + +static OHOS::UIViewGroup* ShowGoalNotify(void) +{ + return OHOS::GoalviewShow(); } static OHOS::UIViewGroup* ShowAlarmNotify(void) @@ -229,26 +243,28 @@ static OHOS::UIViewGroup* showDeviceUnbindingRequestNotify(void) { return OHOS::CreateDeviceUnbindingRequestGroupView(); } -static OHOS::UIViewGroup* showtransmitNotify(void) + +/*显示低电量通知*/ +static OHOS::UIViewGroup* showlowpowerNotify(void) { - return OHOS::transmittingShow(); + return OHOS::lowPowerShow(); } -//充电弹窗 + static OHOS::UIViewGroup* ShowChargeingNotify(void) { return OHOS::ShowChargeingView(); } -/*显示低电量通知*/ -static OHOS::UIViewGroup* showlowpowerNotify(void) + +static OHOS::UIViewGroup* showFindWatchNotify(void) { - return OHOS::lowPowerShow(); + return OHOS::CreateFindWatchView(); } -/*显示运动识别视图*/ -static OHOS::UIViewGroup* showMotionRecognitionNotify(void) +/*显示喝水提醒视图*/ +static OHOS::UIViewGroup* showDrinkReminderNotify(void) { - return OHOS::CreateMotionRecognitionView(); + return OHOS::CreateDrinkReminderView(); } /*显示久坐提醒视图*/ @@ -257,36 +273,40 @@ static OHOS::UIViewGroup* showSedentaryReminderNotify(void) return OHOS::CreateSedentaryReminderView(); } -//查找手表 -static OHOS::UIViewGroup* showFindWatchNotify(void) +/*显示运动识别视图*/ +static OHOS::UIViewGroup* showMotionRecognitionNotify(void) { - return OHOS::CreateFindWatchView(); + return OHOS::CreateMotionRecognitionView(); } -static OHOS::UIViewGroup* showDebugOutputNotify(void) +/*显示传输中*/ +static OHOS::UIViewGroup* showtransmitNotify(void) { - return OHOS::CreateDebugOutputMainView(); -} -/*显示消息提醒*/ -static OHOS::UIViewGroup *showMessageNotify(void) { - return OHOS::CreateMessageView(); + return OHOS::transmittingShow(); } -static OHOS::UIViewGroup* ShowGoalNotify(void) + +//关机动画 +static OHOS::UIViewGroup* showShutdownAnimatorNotify(void) { - return OHOS::GoalviewShow(); + return OHOS::showShutDownAnimation(); } -/*显示喝水提醒视图*/ -static OHOS::UIViewGroup* showDrinkReminderNotify(void) +//无法呼叫sos +static OHOS::UIViewGroup* showSOSNotify(void) { - return OHOS::CreateDrinkReminderView(); + return OHOS::SOS_cant_dial(); +} + +/*显示消息提醒*/ +static OHOS::UIViewGroup *showMessageNotify(void) { + OHOS::UIViewGroup *view = OHOS::CreateMessageView(); + printf("showMessageNotify %p",view); + return view; } /*显示睡眠提醒*/ static OHOS::UIViewGroup* showSleepNotify(void) { return OHOS::CreateSleepNotifyView(); } -//关机动画 - //显示新来电 static OHOS::UIViewGroup* showcallhintNotify(void) @@ -294,23 +314,23 @@ static OHOS::UIViewGroup* showcallhintNotify(void) return OHOS::CALL_INCOMING_HINT(); } +static OHOS::UIViewGroup* showDebugOutputNotify(void) +{ + return OHOS::CreateDebugOutputMainView(); +} + + static OHOS::UIViewGroup* showcallfailNotify(void) { return OHOS::CALL_FAIL_HINT(); } -//无法呼叫sos -static OHOS::UIViewGroup* showSOSNotify(void) +static OHOS::UIViewGroup* showCat1UpdataNotify(void) { - return OHOS::SOS_cant_dial(); + // return OHOS::Cat1PythonUpdataShow(); } - -static OHOS::UIViewGroup* showShutdownAnimatorNotify(void) -{ - return OHOS::showShutDownAnimation(); -} void MsgCenterNotifyAlarmProc(const Topic topic, Request* req) { unused(req); @@ -328,66 +348,91 @@ void MsgCenterNotifyAlarmProc(const Topic topic, Request* req) AlarmViewEventListener::GetInstance()->DelayAlarmRing(); } } - -void MsgCenterNotifyNextDayProc(const Topic topic, Request* req) +/*NextDay*/ +void MsgCenterNotifyNextDayProc(const Topic topic, Request *req) { unused(topic); unused(req); AlarmClockModel::GetInstance()->NextDayNotify(); -} - -void MsgCenterNotifyHfpIncomingProc(const Topic topic, Request* req) -{ - PhoneHfpCallInfo callData = {0}; - int32 ret = memcpy_s(&callData, sizeof(PhoneHfpCallInfo), req->data, req->len); - if (ret != EOK) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MsgCenterNotify memcpy_s request data fail!"); - } else { - // Prevent this from happening: - // When the incoming call view is displayed, the calling number is not set in CallerLogModel. - CallerLogModel::GetInstance()->SetoperateNumber(callData.number, callData.number_len); + // current_year = 0; +#if 0 + printf("******nextday is begin******\r\n"); + // 存储nextday执行日志 + start_report_nextday_log_start(); + /* ----------------------------------- 睡眠相关 ----------------------------------- */ + if (!ConfigModel::GetInstance()->get_configData_int(OHOS::ConfigModel::CONFIGMODEL_ITEM_SLEEP)) + { + // 未设置睡眠监控 nextday进行清除睡眠数据。 + SleepModel::GetInstance().DeleteSleepData(); + // 通知UI更新 + GraphicService::GetInstance()->PostGraphicEvent( + std::bind(&OHOS::SleepModel::UpdateSleepView, &OHOS::SleepModel::GetInstance())); } - NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE); - CallerLogModel::GetInstance()->SetNotifyFlag(true); - if (GetCurrCallNum() == 1) { - NotificationManager::GetInstance()->ShowNotify(ShowPhoneCallNotify, static_cast(topic), true); - } else { - EnableWaitingView(); + printf("sleep end\n"); + /* ---------------------------------- 健康数据相关 ---------------------------------- */ + // 清空当日的心率血氧数据 + HealthService::GetInstance()->CleanHealthData(); + // 通知UI更新 + GraphicService::GetInstance()->PostGraphicEvent( + std::bind(&OHOS::HeartModel::CleanAllData, OHOS::HeartModel::GetInstance())); + GraphicService::GetInstance()->PostGraphicEvent( + std::bind(&OHOS::BloodOxygenModel::CleanAllData, + OHOS::BloodOxygenModel::GetInstance())); + printf("health end\n"); + /* --------------------------------- 每日目标相关 --------------------------------- */ + cywee_reset_history_daily_data(); //清除运动相关数据 + + // 午夜清除运动数据 + for(int i=1;i<6;i++) + { + set_Is_show_flag(1,i); } - NotificationManager::GetInstance()->SetWatchCallStatus(true); -} + -void MsgCenterNotifyHfpPhoneProc(const Topic topic, Request* req) -{ - unused(req); - // finish a single-channel call, or switch to phone, stop the notify - if (CallerLogModel::GetInstance()->GetNotifyFlag()) { - DisableWatingView(); - if ((topic == TOPIC_EVENT_HFP_FINISHED && GetCurrCallNum() == 0) || - topic == TOPIC_EVENT_HFP_PHONE_ACTIVE || topic == TOPIC_EVENT_HFP_WATCH_TO_PHONE) { - NotificationManager::GetInstance()->StopNotify(); - NotificationManager::GetInstance()->SetWatchCallStatus(false); - } - } -} + do_cywee_service_check_msg(CYWEE_SERVICE_CMD_RESET_DAILY_DATA, NULL); -void MsgCenterNotifyHfpWatchProc(const Topic topic, Request* req) + // SendMsgToUIService(UI_UPDATE_GOAL, 0, nullptr, 0); + printf("sport end\n"); + /* ---------------------------------- 呼吸训练相关 ---------------------------------- */ + RespiratoryTrainingModel::GetInstance().ClearTotalRespiratoryTrainingTime(); + + // 存储nextday执行日志 + start_report_nextday_log_end(); + // 清除popup_windows日志 + nextday_clear_popup_windows_log(); + + printf("******nextday is end******\r\n"); +#endif +#if defined(BOARD_W9) + printf("******nextday is begin******\r\n"); + BPModel::GetInstance()->CleanBPData(); + printf("w9 nextday is end******\r\n"); +#endif +} +void MsgCenterNotifyONtimeProc(const Topic topic, Request* req) { unused(req); - if (CallerLogModel::GetInstance()->GetNotifyFlag()) { - NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE); - // default not mute - SetMicMute(false); - if (CallerLogModel::GetInstance()->IsMulitplePhoneStatus()) { - NotificationManager::GetInstance()->ShowNotify(ShowMultiPhoneCallNotify, - static_cast(topic), true); - } else { - NotificationManager::GetInstance()->ShowNotify(ShowCallingNotify, static_cast(topic), true); - } - NotificationManager::GetInstance()->SetWatchCallStatus(true); - } + AlarmClockEventData* time=(AlarmClockEventData*)req->data; + #ifdef SUPPORT_CYWEE_SERVICE +#if 0 + cywee_save_data(); //暂时没有这个函数 + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存每小时步数"); + step_history_save(time->value); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存每小时站立数据"); + if(get_stand_falg()) + stand_history_save(time->value); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存每小时卡路里数据"); + calories_history_save(time->value); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存每小时距离数据"); + distances_history_save(time->value); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存每小时燃脂数据"); + fat_history_save(time->value); + // 保存完增加一次读取数据 + SendMsgToUIService(UI_UPDATE_GOAL, 0, nullptr, 0); +#endif + #endif } -#ifdef FD230 +//设备绑定通知 void MsgCenterNotifyDeviceBindProc(const Topic topic, Request* req) { #ifdef SUPPORT_BLE_SERVICE @@ -521,7 +566,6 @@ void MsgCenterNotifyChargePlugProc(const Topic topic, Request* req) { GraphicService::GetInstance()->PostGraphicEvent(std::bind(&OHOS::PullUpDownView::UpdateBatteryProcess, OHOS::PullUpDownView::GetInstance() )); } - #if DIALDATASET // DialModelCharge::GetInstance()->UpdatechargeStatus(1); setChargeStatus(1); @@ -580,10 +624,10 @@ void MsgCenterNotifyChargeUnPlugProc(const Topic topic, Request* req) { if(is_UIViewGroup_charge()) { - NotificationManager::GetInstance()->StopNotify(); + NotificationManager::GetInstance()->StopNotify(); } } - #endif +#endif } /*低电量提醒*/ @@ -607,7 +651,7 @@ void MsgCenterNotifyLowPowerAlarmProc(const Topic topic, Request* req) else if(*x==0) { //提醒低电充电 - if (display_api->get_screen_state() != SCREEN_ON) + if (display_api->get_screen_state() != SCREEN_ON) { display_api->turn_on_screen(); } @@ -634,13 +678,13 @@ void MsgCenterNotifyLowPowerAlarmProc(const Topic topic, Request* req) NotificationManager::GetInstance()->StopNotify(); if (CheckPriority(topic)) { - NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE); - NotificationManager::GetInstance()->ShowNotify(showlowpowerNotify, (uint16_t)topic, true); + NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE); + NotificationManager::GetInstance()->ShowNotify(showlowpowerNotify, (uint16_t)topic, true); } - } - + } + #endif -} + } //TODO: 亮屏弹窗倒计时5秒关机(不需要取消,强制关机) // DialModelCharge::GetInstance()->UpdatechargeStatus(0); // SaveEleModel::GetInstance()->SetChargeStatus(0); @@ -652,6 +696,53 @@ void MsgCenterNotifyLowPowerAlarmProc(const Topic topic, Request* req) // } #ifdef SUPPORT_CAT1_MODEM +void MsgCenterNotifyHfpIncomingProc(const Topic topic, Request* req) +{ + hfp_hf_calls_info_t callData = {0}; + int32 ret = memcpy_s(&callData, sizeof(hfp_hf_calls_info_t), req->data, req->len); + if (ret != EOK) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MsgCenterNotify memcpy_s request data fail!"); + } else { + } + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyHfpIncomingProc"); + CallerLogModel::GetInstance()->SetoperateNumber(callData.number, callData.number_len); + CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourcePhone); + NotificationManager::GetInstance()->SetWatchCallStatus(true); + if (true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get())) + { + // ui_api_vibrate_once_func(); + } +} +void MsgCenterNotifyHfpPhoneProc(const Topic topic, Request* req) +{ + unused(req); + // finish a single-channel call, or switch to phone, stop the notify + if (CallerLogModel::GetInstance()->GetNotifyFlag()) { + DisableWatingView(); + if ((topic == TOPIC_EVENT_HFP_FINISHED && GetCurrCallNum() == 0) || + topic == TOPIC_EVENT_HFP_PHONE_ACTIVE || topic == TOPIC_EVENT_HFP_WATCH_TO_PHONE) { + NotificationManager::GetInstance()->StopNotify(); + NotificationManager::GetInstance()->SetWatchCallStatus(false); + } + } + } + +void MsgCenterNotifyHfpWatchProc(const Topic topic, Request* req) +{ + unused(req); + if (CallerLogModel::GetInstance()->GetNotifyFlag()) { + NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE); + // default not mute + SetMicMute(false); + if (CallerLogModel::GetInstance()->IsMulitplePhoneStatus()) { + NotificationManager::GetInstance()->ShowNotify(ShowMultiPhoneCallNotify, + static_cast(topic), true); + } else { + NotificationManager::GetInstance()->ShowNotify(ShowCallingNotify, static_cast(topic), true); + } + NotificationManager::GetInstance()->SetWatchCallStatus(true); + } +} void MsgCenterNotifyHfpWatchHintProc(const Topic topic, Request* req) { @@ -901,97 +992,233 @@ void MsgCenterNotifyCat1FailEProc(const Topic topic, Request* req) NotificationManager::GetInstance()->ShowNotify(showcallfailNotify, static_cast(topic), true); } - #endif -//每日训练数据刷新 -void MsgCenterNotifyActivityProc(const Topic topic, Request* req) -{ -// unused(topic); -// cywee_activity_result_t* c_activity_result_t = (cywee_activity_result_t *) malloc(req->len); -// if(c_activity_result_t==NULL) -// { -// WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Memory allocation failure"); -// return; -// } - -// int rets = memcpy_s(c_activity_result_t, req->len, (cywee_activity_result_t*)req->data, req->len); -// if (rets != EOK) -// { -// free(c_activity_result_t); -// c_activity_result_t = NULL; -// WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "memcpy_s c_activity_result_t failed, ret = %d", rets); -// return; -// } -// if(c_activity_result_t->activity_mode == SPORT_ACTIVE_MODE_NORMAL) -// { -// /*更新卡路里数据*/ -// //if(c_activity_result_t->calories!=0) -// { -// set_calories_data(c_activity_result_t->calories); -// #if DIALDATASET -// uint32_t calories= OHOS::GoalModel::GetInstance().show_data_calories_refresh(); - -// DialModelCalorie::GetInstance()->UpdateCalorie(calories); -// #endif -// } -// /*更新距离数据*/ -// //if(c_activity_result_t->distance != 0) -// { -// set_distance_data(c_activity_result_t->distance); -// #if DIALDATASET -// float distance= OHOS::GoalModel::GetInstance().show_data_distance_refresh(); -// DialModelDistance::GetInstance()->UpdateDistance(distance); -// #endif -// } -// } -// else if(c_activity_result_t->activity_mode == SPORT_ACTIVE_MODE_FREE_TRAINING && c_activity_result_t->MHR_zone >= 2) -// { -// /*更新燃脂时间数据*/ -// set_fat_time_data(1); -// } +#if 0 + //每日活动 + void MsgCenterNotifygoalnotificationviewProc(const Topic topic, Request* req) + { + unused(req); + if (CheckPriority(topic)) { + + uint8_t* data=(uint8_t*)req->data; + #if 0 + if(get_Is_show_flag(data[0])) + { + set_goal_flag_view(data[0]); + set_Is_show_flag(0,data[0]); + + const power_display_svr_api_t *display_api = power_display_svr_get_api(); + + if (display_api->get_screen_state() != SCREEN_ON) + { + display_api->turn_on_screen(); + } + + NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO); + NotificationManager::GetInstance()->ShowNotify(ShowGoalNotify, static_cast(topic), true); + } + #endif + + } -// free(c_activity_result_t); -// c_activity_result_t = NULL; -} + } + static uint8_t goal_type=0; + void MsgCenterNotifystepProc(const Topic topic, Request* req) + { + //unused(req); + if (req->msgId == TOPIC_EVENT_STEPDATA_UPDATE) + { + + #ifdef SUPPORT_CYWEE_SERVICE + if (req->data == nullptr) { + return; + } + // 计步数据累加 + uint32_t counter = 0; + // OHOS::ActivityModel::GetInstance()->GetStepCounter(); + counter = *(uint32_t *)req->data; + set_step_data(counter); + counter=OHOS::GoalModel::GetInstance().show_data_step_refresh(); + uint32_t calories= OHOS::GoalModel::GetInstance().show_data_calories_refresh(); + float distance= OHOS::GoalModel::GetInstance().show_data_distance_refresh(); + // OHOS::DialModelSteps::GetInstance() ->UpdateSteps(counter);//更新表盘步数 + // OHOS::DialModelStepgoal::GetInstance() ->UpdateStepgoal(counter);//更新表盘目标 + // OHOS::DialModelDistance::GetInstance() ->UpdateDistance(distance);//更新表盘距离 + // OHOS::DialModelCalorie::GetInstance() ->UpdateCalorie(calories);//更新表盘卡路里 + // OHOS::DialModelKcalgoalStr::GetInstance() ->UpdateKcalgoalStr(calories);//更新卡路里目标值 + // OHOS::DialModelKcalgoalValue::GetInstance() ->UpdateKcalgoalValue(calories);//更新卡路里int目标值 + // OHOS::DialModelStepgoalStr::GetInstance() ->UpdateStepgoalStr(counter);//更新步数目标值 + // OHOS::DialModelStepgoalValue::GetInstance() ->UpdateStepgoalValue(counter);//更新步数int目标值 + + if(OHOS::GoalView::GetInstance()) + { + GraphicService::GetInstance()->PostGraphicEvent( + std::bind(&OHOS::GoalView::GoalViewrefresh, OHOS::GoalView::GetInstance() )); + + // OHOS::GoalView::GetInstance()->GoalViewrefresh(); + } + if(OHOS::GoalotherView::GetInstance()) + { + //OHOS::GoalotherView::GetInstance()->GoalViewrefresh(); + GraphicService::GetInstance()->PostGraphicEvent( + std::bind(&OHOS::GoalotherView::GoalViewrefresh, OHOS::GoalotherView::GetInstance() )); + } -static int train_fat_time = 0; + if(OHOS::GoalModel::GetInstance().getstepvalue()>=100) + { -void MsgCenterNotifyActivityExtraInfoProc(const Topic topic, Request* req) -{ - // unused(topic); - // cywee_activity_result_extre_info_t* c_activity_result_extre_info_t = (cywee_activity_result_extre_info_t *) malloc(req->len); - // if(c_activity_result_extre_info_t==NULL) - // { - // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Memory allocation failure"); - // return; - // } + goal_type=GOAL_STEP; + if(get_Is_show_flag(goal_type)) + { + if(OHOS::GoalModel::GetInstance().get_step_goal_show()) + { + CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW,(uint8_t *)&goal_type,1); + } + } + } - // int rets = memcpy_s(c_activity_result_extre_info_t, req->len, (cywee_activity_result_extre_info_t*)req->data, req->len); - // if (rets != EOK) - // { - // free(c_activity_result_extre_info_t); - // c_activity_result_extre_info_t = NULL; - // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "memcpy_s c_activity_result_extre_info_t failed, ret = %d", rets); - // return; - // } + if(OHOS::GoalModel::GetInstance().is_goal_DISTANCE_done()) + { + goal_type=GOAL_DISTANCE; + if(get_Is_show_flag(goal_type)) + { + if(OHOS::GoalModel::GetInstance().get_other_goal_show()) + { + CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW,(uint8_t *)&goal_type,1); + } + + } + } - // if(uapi_dev_runtime_get_train_status() && c_activity_result_extre_info_t->ativity_zone_high_duration) - // { - // train_fat_time = c_activity_result_extre_info_t->ativity_zone_high_duration; - // } - // /*更新燃脂时间数据*/ - // else if(uapi_dev_runtime_get_train_status() == 0 && train_fat_time) - // { - // set_fat_time_data(train_fat_time); - // train_fat_time = 0; - // } + if(OHOS::GoalModel::GetInstance().is_goal_fatburning_done()) + { + goal_type=GOAL_FAT; + if(get_Is_show_flag(goal_type)) + { + if(OHOS::GoalModel::GetInstance().get_other_goal_show()) + { + CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW,(uint8_t *)&goal_type,1); + } + } + } - // free(c_activity_result_extre_info_t); - // c_activity_result_extre_info_t = NULL; -} + if(OHOS::GoalModel::GetInstance().is_goal_stand_done()) + { + goal_type=GOAL_STAND; + if(get_Is_show_flag(goal_type)) + { + if(OHOS::GoalModel::GetInstance().get_other_goal_show()) + { + CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW,(uint8_t *)&goal_type,1); + } + } + } + + if(OHOS::GoalModel::GetInstance().is_goal_calories_done()) + { + goal_type=GOAL_CALOREIE; + if(get_Is_show_flag(goal_type)) + { + if(OHOS::GoalModel::GetInstance().get_other_goal_show()) + { + CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW,(uint8_t *)&goal_type,1); + } + } + } + #endif + } + + + + } + //每日训练数据刷新 + void MsgCenterNotifyActivityProc(const Topic topic, Request* req) + { + unused(topic); + cywee_activity_result_t* c_activity_result_t = (cywee_activity_result_t *) malloc(req->len); + if(c_activity_result_t==NULL) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Memory allocation failure"); + return; + } + + int rets = memcpy_s(c_activity_result_t, req->len, (cywee_activity_result_t*)req->data, req->len); + if (rets != EOK) + { + free(c_activity_result_t); + c_activity_result_t = NULL; + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "memcpy_s c_activity_result_t failed, ret = %d", rets); + return; + } + if(c_activity_result_t->activity_mode == SPORT_ACTIVE_MODE_NORMAL) + { + /*更新卡路里数据*/ + //if(c_activity_result_t->calories!=0) + { + set_calories_data(c_activity_result_t->calories); + #if DIALDATASET + uint32_t calories= OHOS::GoalModel::GetInstance().show_data_calories_refresh(); + + DialModelCalorie::GetInstance()->UpdateCalorie(calories); + #endif + } + /*更新距离数据*/ + //if(c_activity_result_t->distance != 0) + { + set_distance_data(c_activity_result_t->distance); + #if DIALDATASET + float distance= OHOS::GoalModel::GetInstance().show_data_distance_refresh(); + DialModelDistance::GetInstance()->UpdateDistance(distance); + #endif + } + } + else if(c_activity_result_t->activity_mode == SPORT_ACTIVE_MODE_FREE_TRAINING && c_activity_result_t->MHR_zone >= 2) + { + /*更新燃脂时间数据*/ + set_fat_time_data(1); + } + + free(c_activity_result_t); + c_activity_result_t = NULL; + } + static int train_fat_time = 0; + void MsgCenterNotifyActivityExtraInfoProc(const Topic topic, Request* req) + { + unused(topic); + cywee_activity_result_extre_info_t* c_activity_result_extre_info_t = (cywee_activity_result_extre_info_t *) malloc(req->len); + if(c_activity_result_extre_info_t==NULL) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Memory allocation failure"); + return; + } + + int rets = memcpy_s(c_activity_result_extre_info_t, req->len, (cywee_activity_result_extre_info_t*)req->data, req->len); + if (rets != EOK) + { + free(c_activity_result_extre_info_t); + c_activity_result_extre_info_t = NULL; + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "memcpy_s c_activity_result_extre_info_t failed, ret = %d", rets); + return; + } + + if(uapi_dev_runtime_get_train_status() && c_activity_result_extre_info_t->ativity_zone_high_duration) + { + train_fat_time = c_activity_result_extre_info_t->ativity_zone_high_duration; + } + /*更新燃脂时间数据*/ + else if(uapi_dev_runtime_get_train_status() == 0 && train_fat_time) + { + set_fat_time_data(train_fat_time); + train_fat_time = 0; + } + + free(c_activity_result_extre_info_t); + c_activity_result_extre_info_t = NULL; + } +#endif /*运动识别*/ void MsgCenterNotifyArAlertProc(const Topic topic, Request* req) { @@ -1067,18 +1294,18 @@ void MsgCenterNotifyFindWatchProc(const Topic topic, Request* req) { uint8_t* type=(uint8_t*)req->data; if(*type == 1) - { - FindWatchViewEventListener::GetInstance().SetFindWatchNotifyFlag(true); - FindWatchViewEventListener::GetInstance().PopInterPlayMusic(nullptr);//播放铃声 - NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO); - NotificationManager::GetInstance()->ShowNotify(showFindWatchNotify, (uint16_t)topic, true); - //如果查找手表铃声播放成功,记录该事件 - uapi_save_runtime_log(RUNTIME_LOG_RING_PLAY_START_FINDWATCH);//TOOD* + { + FindWatchViewEventListener::GetInstance().SetFindWatchNotifyFlag(true); + FindWatchViewEventListener::GetInstance().PopInterPlayMusic(nullptr);//播放铃声 + NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO); + NotificationManager::GetInstance()->ShowNotify(showFindWatchNotify, (uint16_t)topic, true); + //如果查找手表铃声播放成功,记录该事件 + uapi_save_runtime_log(RUNTIME_LOG_RING_PLAY_START_FINDWATCH);//TOOD* } else { - if (FindWatchViewEventListener::GetInstance().GetFindWatchNotifyFlag() == true) { - NotificationManager::GetInstance()->StopNotify(); - } - FindWatchViewEventListener::GetInstance().SetFindWatchNotifyFlag(false); + if (FindWatchViewEventListener::GetInstance().GetFindWatchNotifyFlag() == true) { + NotificationManager::GetInstance()->StopNotify(); + } + FindWatchViewEventListener::GetInstance().SetFindWatchNotifyFlag(false); } } else { WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "NotifyPriority = %d ",NotificationManager::GetInstance()->GetNotifyPriority()); @@ -1129,6 +1356,32 @@ void MsgCenterNotifyDrinkReminderProc(const Topic topic, Request *req) NotificationManager::GetInstance()->ShowNotify(showDrinkReminderNotify, (uint16_t)topic, true); } } +//关机动画 +void MsgCenterNotifyShutDownAnimatorProc(const Topic topic, Request* req) +{ + unused(topic); + uint8_t* data=(uint8_t*)req->data; + set_shutDownAnimation_falg(data[0]); + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyShutDownAnimatorProc,shutdown_flag = %d",*data); + NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE); + NotificationManager::GetInstance()->ShowNotify(showShutdownAnimatorNotify, (uint16_t)topic, true); +} +//消息通知 +void MsgCenterNotifyMessageProc(const Topic topic, Request* req) +{ + // unused(topic); + unused(req); + // WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyMessageProc !"); + if (CheckPriority(topic)) { + // do_custom_fileoperate_service_check_msg(CUSTOM_FILEOPERATE_MSG_TYPE_MESSAGE_DATA_NOTIFY, + // nullptr, 0); + OHOS::NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_THREE); + OHOS::NotificationManager::GetInstance()->ShowNotify(OHOS::CreateMessageView, TOPIC_EVENT_MESSAGENOTE, true); + //进行消息显示记录 + uapi_save_runtime_log(RUNTIME_LOG_MSG_SHOW); + } +} + //睡眠提醒通知 void MsgCenterNotifySleepProc(const Topic topic, Request* req) { @@ -1136,55 +1389,149 @@ void MsgCenterNotifySleepProc(const Topic topic, Request* req) // unused(topic); if (CheckPriority(topic)) { - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifySleepProc %d!",SleepModel::GetInstance().get_sleep_state()); - /*早安闹钟*/ - if(SleepModel::GetInstance().get_sleep_state()==SLEEPSTATE::WAKE) - { - NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO); - SleepViewEventListener::GetInstance().PopInterPlayMusic(); - } - else - { - NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_THREE); - } - + + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifySleepProc %d!",SleepModel::GetInstance().get_sleep_state()); + + /*早安闹钟*/ + if(SleepModel::GetInstance().get_sleep_state()==SLEEPSTATE::WAKE) + { + NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO); + SleepViewEventListener::GetInstance().PopInterPlayMusic(); + } + else + { + NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_THREE); + } + NotificationManager::GetInstance()->ShowNotify(showSleepNotify, (uint16_t)topic, true); } } -//关机动画 -void MsgCenterNotifyShutDownAnimatorProc(const Topic topic, Request* req) + +void MsgCenterNotifyInactivityAccumulateTimeProc(const Topic topic, Request* req) { unused(topic); - uint8_t* data=(uint8_t*)req->data; - set_shutDownAnimation_falg(data[0]); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyShutDownAnimatorProc,shutdown_flag = %d",*data); - NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE); - NotificationManager::GetInstance()->ShowNotify(showShutdownAnimatorNotify, (uint16_t)topic, true); -} + #if 0 + if(uapi_dev_runtime_get_absolute_static_status()) + { + memset(&sleep_data,0,sizeof(SLEEP_T)); + state_num = 0; + //fall_asleep_state_num = 0; + uapi_dev_runtime_set_absolute_static_status(0); + return; + } + cywee_inactivity_accumulate_time_t *cywee_Inactivity_Accumulate_Time_Info = (cywee_inactivity_accumulate_time_t *)malloc(req->len); + if (!cywee_Inactivity_Accumulate_Time_Info) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Memory allocation failure"); + return; + } + + int rets = memcpy_s(cywee_Inactivity_Accumulate_Time_Info, req->len, (cywee_inactivity_accumulate_time_t*)req->data, req->len); + if (rets != EOK) + { + free(cywee_Inactivity_Accumulate_Time_Info); + cywee_Inactivity_Accumulate_Time_Info = NULL; + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "memcpy_s cywee_Inactivity_Accumulate_Time_Info failed, ret = %d", rets); + return; + } +#ifdef FD230 + if(cywee_Inactivity_Accumulate_Time_Info->output_number == INACTIVITY_MODE_NAP_ACCUMULATE_TIME_OUTPUT) + { + nap_data.total_time = cywee_Inactivity_Accumulate_Time_Info->total_time; + set_nap_data(&nap_data); + do_custom_fileoperate_service_check_msg( + CUSTOM_FILEOPERATE_MSG_TYPE_NAPDATA_SAVE, nullptr, 0); + memset(&nap_data,0,sizeof(NAP_T)); + } + else if(cywee_Inactivity_Accumulate_Time_Info->output_number == INACTIVITY_MODE_SLEEPING_ACCUMULATE_TIME_OUTPUT) + { + // if(sleep_data.fall_asleep_timestamp > sleep_data.wake_up_timestamp && sleep_data.wake_up_timestamp != 0) + // { + // sleep_data.fall_asleep_timestamp -= 24 * 60 * 60; + // sleep_data.sleep_status[fall_asleep_state_num].timestamp = sleep_data.fall_asleep_timestamp; + // } + + sleep_data.total_time = cywee_Inactivity_Accumulate_Time_Info->total_time; + sleep_data.total_deep_sleep_time = cywee_Inactivity_Accumulate_Time_Info->total_deep_sleep_time; + sleep_data.total_mild_sleep_time = cywee_Inactivity_Accumulate_Time_Info->total_mild_sleep_time; + sleep_data.total_wake_time = cywee_Inactivity_Accumulate_Time_Info->total_wake_time; + sleep_data.total_rem_sleep_time = cywee_Inactivity_Accumulate_Time_Info->total_rem_sleep_time; + sleep_data.status_num = state_num; + + set_sleep_data(&sleep_data); + do_custom_fileoperate_service_check_msg( + CUSTOM_FILEOPERATE_MSG_TYPE_SLEEPDATA_SAVE, nullptr, 0); + memset(&sleep_data,0,sizeof(SLEEP_T)); + state_num = 0; + //fall_asleep_state_num = 0; + } #endif + free(cywee_Inactivity_Accumulate_Time_Info); + cywee_Inactivity_Accumulate_Time_Info = NULL; + //uapi_dev_runtime_set_sleep_status(0); +#endif +} + +//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 MsgCenterNotifyTable g_msgCenterNotifyTable[] = { {TOPIC_EVENT_ALARM_RING, MsgCenterNotifyAlarmProc}, + {TOPIC_EVENT_ON_TIME, MsgCenterNotifyONtimeProc},//增加整点保存数据 {TOPIC_EVENT_NEXTDAY_UPDATE, MsgCenterNotifyNextDayProc}, + {TOPIC_EVENT_HFP_INCOMMING, MsgCenterNotifyHfpIncomingProc}, {TOPIC_EVENT_HFP_PHONE_ACTIVE, MsgCenterNotifyHfpPhoneProc}, {TOPIC_EVENT_HFP_FINISHED, MsgCenterNotifyHfpPhoneProc}, {TOPIC_EVENT_HFP_WATCH_TO_PHONE, MsgCenterNotifyHfpPhoneProc}, {TOPIC_EVENT_HFP_WATCH_ACTIVE, MsgCenterNotifyHfpWatchProc}, {TOPIC_EVENT_HFP_PHONE_TO_WATCH, MsgCenterNotifyHfpWatchProc}, - {TOPIC_EVENT_HFP_HINT, MsgCenterNotifyHfpWatchHintProc}, - {TOPIC_EVENT_BLE_TRANSMIT, MsgCenterNotifybleTransmit}, - {TOPIC_EVENT_DEVICE_BIND, MsgCenterNotifyDeviceBindProc}, - // #ifdef SUPPORT_CHARGER_PLUG_DETECTION_NOTIFICATION - {TOPIC_EVENT_CHARGE_PLUG, MsgCenterNotifyChargePlugProc}, - {TOPIC_EVENT_CHARGE_UNPLUG, MsgCenterNotifyChargeUnPlugProc}, - {TOPIC_EVENT_LOWPOWER_ALARM, MsgCenterNotifyLowPowerAlarmProc}, - // #endif - // #ifdef SUPPORT_CYWEE_SERVICE + {TOPIC_EVENT_HFP_HINT, MsgCenterNotifyHfpWatchHintProc}, + +#if 0 + {TOPIC_EVENT_ACTIVITY_UPDATE, MsgCenterNotifyActivityProc}, + {TOPIC_EVENT_ACTIVITY_EXTRA_INFO_UPDATE, MsgCenterNotifyActivityExtraInfoProc}, {TOPIC_EVENT_AR_ALERT_TYPE_UPDATE, MsgCenterNotifyArAlertProc}, + {TOPIC_EVENT_INACTIVITY_UPDATE, MsgCenterNotifyInactivityProc}, + {TOPIC_EVENT_INACTIVITY_ACCUMULATE_TIME_UPDATE, MsgCenterNotifyInactivityAccumulateTimeProc}, + {TOPIC_EVENT_BLE_TRAINING, MsgCenterNotifybleAPPtraining}, + {TOPIC_EVENT_BLE_TRANSMIT, MsgCenterNotifybleTransmit}, + {TOPIC_EVENT_GOAL_SHOW_VIEW, MsgCenterNotifygoalnotificationviewProc}, +#endif + + {TOPIC_EVENT_CHARGE_PLUG, MsgCenterNotifyChargePlugProc}, + {TOPIC_EVENT_CHARGE_UNPLUG, MsgCenterNotifyChargeUnPlugProc}, + {TOPIC_EVENT_LOWPOWER_ALARM, MsgCenterNotifyLowPowerAlarmProc}, + #ifdef SUPPORT_CAT1_MODEM {TOPIC_EVENT_CAT1_INCOMMING, MsgCenterNotifyCatIncomingCallProc}, {TOPIC_EVENT_CAT1_CALLCONNTED, MsgCenterNotifyCat1CallConnectedProc}, @@ -1196,13 +1543,12 @@ static MsgCenterNotifyTable g_msgCenterNotifyTable[] = { // {TOPIC_EVENT_CAT1_POWER_OFF, MsgCenterNotifyCat1PowerOffProc}, {TOPIC_EVENT_CAT1_CALL_FAIL, MsgCenterNotifyCat1FailEProc}, #endif - {TOPIC_EVENT_INACTIVITY_UPDATE, MsgCenterNotifyInactivityProc}, - // #endif + {TOPIC_EVENT_DEVICE_BIND, MsgCenterNotifyDeviceBindProc}, {TOPIC_EVENT_FIND_WATCH,MsgCenterNotifyFindWatchProc}, - {TOPIC_EVENT_DEBUGOUTPUT,MsgCenterNotifyDebugOutProc}, - {TOPIC_EVENT_GOAL_SHOW_VIEW,MsgCenterNotifyGoalShowViewProc}, {TOPIC_EVENT_DRINKREMINDER,MsgCenterNotifyDrinkReminderProc}, + {TOPIC_EVENT_MESSAGENOTE,MsgCenterNotifyMessageProc}, {TOPIC_EVENT_SLEEPNOTE,MsgCenterNotifySleepProc}, + {TOPIC_EVENT_DEBUGOUTPUT,MsgCenterNotifyDebugOutProc}, {TOPIC_EVENT_SHUTDOWN_ANIMATIOR,MsgCenterNotifyShutDownAnimatorProc}, };