#ifdef SUPPORT_CAT1_HFP_AG_SERV
#include "phoneservice/include/PhoneAGService.h"
#endif
+
#include "goal/include/goalmodel.h"
#include "goal/include/goalview.h"
#include "goal/include/goalother.h"
+
#include "ConfigModel.h"
#include "PlayersModelC.h"
#include "PlayersModel.h"
+
#include "main/include/PullUpDownView.h"
+
+
#include "custom_save_runtime.h"
#include "transmitting.h"
#include "charge_notification.h"
#include "drinkReminder_notification.h"
#include "sleep_notification.h"
#include "sleep/include/SleepModel.h"
+#include "health/health_service/health_service.h"
+#include "player/include/PlayersModelC.h"
+#include "system/include/SystemLogModelC.h"
+
+#include "bloodoxygen/include/BloodOxygenModel.h"
+#include "heartrate/include/HeartModel.h"
+#include "saveele/include/SaveEleModel.h"
+#include "respiratorytraining/include/RespiratoryTrainingModel.h"
#include "custom_utilscpp.h"
#include "custom_utils.h"
* Create: 2021-11-11
*/
-#include <cstdio>
-#include "securec.h"
-#include "adapter.h"
-#include "ohos_init.h"
-#include "samgr_lite.h"
-#include "memory_adapter.h"
-#include "wearable_log.h"
-#include "service_id_define.h"
-#include "broadcast_service.h"
-#include "alarm/include/AlarmClockModel.h"
-#include "AlarmPopUpPresenter.h"
-#include "CallerLogModel.h"
-#include "notification_manager.h"
-#include "NativeAbility.h"
-#include "abilityms_slite_client.h"
-#include "element_name.h"
-#include "want.h"
-#include "msg_center.h"
-#include "msg_center_msg.h"
-#include "msg_center_protocol.h"
-#include "xiaodu_navi_vector.h"
-#include "baidumap.h"
-#include "common_def.h"
-#include "keyinput.h"
-#include "KeyInputListener.h"
-#include "VolumeSettingView.h"
-#include "VolumeSettingPresenter.h"
-#include "VolumeSettingView.h"
-
-#define DIALDATASET 1
-
-#ifdef SUPPORT_BLE_SERVICE
-#include "bleInstruct.h"
-#endif
-
-#ifdef CUSTOM_ZHIHUI
-
-#ifdef SUPPORT_CAT1_HFP_AG_SERV
-#include "phoneservice/include/PhoneAGService.h"
-#endif
-
-#include "ConfigModel.h"
-#include "PlayersModelC.h"
-#include "PlayersModel.h"
-#include "main/include/PullUpDownView.h"
-#include "custom_save_runtime.h"
-#include "transmitting.h"
-#include "charge_notification.h"
-#include "motion_recognition_notification.h"
-#include "sedentaryReminder_notification.h"
-#include "findwatch_notification.h"
-#include "debug_output_notification/debug_output_notification.h"
-#include "pairing_notification.h"
-#include "phone_crt.h"
-#include "main/include/dial/DialModelChargeC.h"
-#include "saveele/include/SaveEleModel.h"
-#include "testchangingC.h"
-#include "custom_runtime.h"
-#include "message_notification.h"
-#include "goal_notification.h"
-#include "drinkReminder_notification.h"
-#include "sleep_notification.h"
-#include "sleep/include/SleepModel.h"
-
-#include "custom_utilscpp.h"
-#include "custom_utils.h"
-#ifdef SUPPORT_POWER_MANAGER
-#include "power_display_service.h"
-#endif
-#endif
-
-#ifdef SUPPORT_CYWEE_SERVICE
-#include "cywee_hal.h"
-#include "cywee_data.h"
-#include "cywee_service.h"
-#endif
-
-#include "cat1_pub_api.h"
-#include "uiservice/include/ui_service.h"
-
-namespace OHOS {
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* 订阅事件设定优先级 */
-const PriorityMapper PRI_MAPPER[] = {
- {TOPIC_EVENT_ALARM_RING, PRIORITY_ONE},
- {TOPIC_EVENT_NEXTDAY_UPDATE, PRIORITY_TWO},
- {TOPIC_EVENT_HFP_INCOMMING, PRIORITY_ONE},
- {TOPIC_EVENT_HFP_FINISHED, PRIORITY_ONE},
- {TOPIC_EVENT_HFP_PHONE_ACTIVE, PRIORITY_ONE},
- {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},
- {TOPIC_EVENT_CAT1_CALLENDED, PRIORITY_ONE},
- {TOPIC_EVENT_CAT1_CALLDIAL,PRIORITY_ONE},
- {TOPIC_EVENT_CAT1_SIGNAL_UPDATE, PRIORITY_ONE},
- {TOPIC_EVENT_CAT1_POWER_ON, PRIORITY_ONE},
- {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},
-
-#ifdef SUPPORT_CYWEE_SERVICE
- // {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}
-
-#endif
- {TOPIC_EVENT_GOAL_SHOW_VIEW,PRIORITY_TWO},
- {TOPIC_EVENT_BLE_TRAINING,PRIORITY_TWO},
- {TOPIC_EVENT_BLE_TRANSMIT,PRIORITY_ONE},
-
- {TOPIC_EVENT_CHARGE_PLUG, PRIORITY_TWO},
- {TOPIC_EVENT_CHARGE_UNPLUG, PRIORITY_TWO},
- {TOPIC_EVENT_LOWPOWER_ALARM,PRIORITY_TWO},
-
- {TOPIC_EVENT_DEVICE_BIND, PRIORITY_ONE},
- {TOPIC_EVENT_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;
-bool g_longPressFlag = false;
-
-static bool CheckPriority(const Topic topic)
-{
- uint16_t mapperSize = sizeof(PRI_MAPPER) / sizeof(PRI_MAPPER[0]);
- for (uint16_t i = 0; i < mapperSize; i++) {
- if (topic == PRI_MAPPER[i].topicId) {
- if (PRI_MAPPER[i].prId <= OHOS::NativeAbility::GetInstance().GetCurSlicePriority() &&
- PRI_MAPPER[i].prId <= OHOS::NotificationManager::GetInstance()->GetNotifyPriority()) {
- return true;
- } else {
- return false;
- }
- }
- }
- return false;
-}
-
-/* 订阅事件可定制 */
-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_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);
- MsgCenterSubscribeTopic(TOPIC_EVENT_GOAL_SHOW_VIEW);
- MsgCenterSubscribeTopic(TOPIC_EVENT_CHARGE_PLUG);
- MsgCenterSubscribeTopic(TOPIC_EVENT_CHARGE_UNPLUG);
- MsgCenterSubscribeTopic(TOPIC_EVENT_LOWPOWER_ALARM);
-#ifdef SUPPORT_CAT1_MODEM
- MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_INCOMMING);
- MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_CALLCONNTED);
- MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_CALLENDED);
- MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_CALLDIAL);
- // MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_SIGNAL_UPDATE);
- // MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_POWER_ON);
- // MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_POWER_OFF);
- MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_CALL_FAIL);
-
-#endif
- MsgCenterSubscribeTopic(TOPIC_EVENT_DEVICE_BIND);
- MsgCenterSubscribeTopic(TOPIC_EVENT_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)
-{
- return OHOS::CreateAlarmView();
-}
-
-static OHOS::UIViewGroup* ShowPhoneCallNotify(void)
-{
- return OHOS::CreatePhoneCallView();
-}
-
-static OHOS::UIViewGroup* ShowCallingNotify(void)
-{
- return OHOS::CreateCallingView();
-}
-
-static OHOS::UIViewGroup* ShowMultiPhoneCallNotify(void)
-{
- return OHOS::CreateMultiplePhoneView();
-}
-
-
-/*显示绑定通知*/
-static OHOS::UIViewGroup* showDeviceBindingNotify(void)
-{
- return OHOS::CreateDeviceBindingView();
-}
-
-/*显示解绑通知*/
-static OHOS::UIViewGroup* showDeviceUnBindingNotify(void)
-{
- return OHOS::CreateDeviceUnBindingView();
-}
-
-/*显示解除绑定请求(与新设备连接)通知*/
-static OHOS::UIViewGroup* showDeviceUnbindingRequestNotify(void)
-{
- return OHOS::CreateDeviceUnbindingRequestGroupView();
-}
-
-/*显示低电量通知*/
-static OHOS::UIViewGroup* showlowpowerNotify(void)
-{
- return OHOS::lowPowerShow();
-}
-
-static OHOS::UIViewGroup* ShowChargeingNotify(void)
-{
- return OHOS::ShowChargeingView();
-}
-
-
-static OHOS::UIViewGroup* showFindWatchNotify(void)
-{
- return OHOS::CreateFindWatchView();
-}
-
-/*显示喝水提醒视图*/
-static OHOS::UIViewGroup* showDrinkReminderNotify(void)
-{
- return OHOS::CreateDrinkReminderView();
-}
-
-/*显示久坐提醒视图*/
-static OHOS::UIViewGroup* showSedentaryReminderNotify(void)
-{
- return OHOS::CreateSedentaryReminderView();
-}
-
-/*显示运动识别视图*/
-static OHOS::UIViewGroup* showMotionRecognitionNotify(void)
-{
- return OHOS::CreateMotionRecognitionView();
-}
-
-/*显示传输中*/
-static OHOS::UIViewGroup* showtransmitNotify(void)
-{
- return OHOS::transmittingShow();
-}
-
-//关机动画
-static OHOS::UIViewGroup* showShutdownAnimatorNotify(void)
-{
- return OHOS::showShutDownAnimation();
-}
-//无法呼叫sos
-static OHOS::UIViewGroup* showSOSNotify(void)
-{
- 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)
-{
- return OHOS::CALL_INCOMING_HINT();
-}
-
-static OHOS::UIViewGroup* showDebugOutputNotify(void)
-{
- return OHOS::CreateDebugOutputMainView();
-}
-
-
-static OHOS::UIViewGroup* showcallfailNotify(void)
-{
- return OHOS::CALL_FAIL_HINT();
-}
-
-static OHOS::UIViewGroup* showCat1UpdataNotify(void)
-{
- // return OHOS::Cat1PythonUpdataShow();
-}
-
-
-void MsgCenterNotifyAlarmProc(const Topic topic, Request* req)
-{
- unused(req);
- // The alarm notification is not displayed if the incoming call notification is already being processed
- if (CheckPriority(topic)) {
- // AlarmClockModel::GetInstance()->PopInterPlayMusic();
- // AlarmViewEventListener::GetInstance()->PopAlarmRing();
- NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
- NotificationManager::GetInstance()->ShowNotify(ShowAlarmNotify, static_cast<uint16_t>(topic), true);
- } else {
- // just delay the alarm
- WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "just delay the alarm");
- // AlarmClockModel::GetInstance()->AlarmGetClockNum();
- // AlarmPopUpPresenter::GetInstance()->DelayAlarmRing();
- AlarmViewEventListener::GetInstance()->DelayAlarmRing();
- }
-}
-/*NextDay*/
-void MsgCenterNotifyNextDayProc(const Topic topic, Request *req)
-{
- unused(topic);
- unused(req);
- AlarmClockModel::GetInstance()->NextDayNotify();
- // 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()));
- }
- 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");
- /* ---------------------------------- 呼吸训练相关 ---------------------------------- */
- RespiratoryTrainingModel::GetInstance().ClearTotalRespiratoryTrainingTime();
-
- // 存储nextday执行日志
- start_report_nextday_log_end();
- // 清除popup_windows日志
- nextday_clear_popup_windows_log();
-
- printf("******nextday is end******\r\n");
-#endif
-#ifdef SUPPORT_CYWEE_SERVICE
- /* --------------------------------- 每日目标相关 --------------------------------- */
- cywee_reset_history_daily_data(); //清除运动相关数据
-
- // 午夜清除运动数据
- for(int i=1;i<6;i++)
- {
- set_Is_show_flag(1,i);
- }
-
-
- do_cywee_service_check_msg(CYWEE_SERVICE_CMD_RESET_DAILY_DATA, NULL);
-
- // SendMsgToUIService(UI_UPDATE_GOAL, 0, nullptr, 0);
- printf("sport end\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);
- AlarmClockEventData* time=(AlarmClockEventData*)req->data;
-#ifdef SUPPORT_CYWEE_SERVICE
- cywee_save_data();
-
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存每小时步数");
- cywee_step_history_save(time->value);
-
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存每小时站立数据");
- if(cywee_get_stand_flag())
- cywee_stand_history_save(time->value);
-
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存每小时卡路里数据");
- cywee_calories_history_save(time->value);
-
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存每小时距离数据");
- cywee_distances_history_save(time->value);
+ #include <cstdio>
+ #include "securec.h"
+ #include "adapter.h"
+ #include "ohos_init.h"
+ #include "samgr_lite.h"
+ #include "memory_adapter.h"
+ #include "wearable_log.h"
+ #include "service_id_define.h"
+ #include "broadcast_service.h"
+ #include "alarm/include/AlarmClockModel.h"
+ #include "AlarmPopUpPresenter.h"
+ #include "CallerLogModel.h"
+ #include "notification_manager.h"
+ #include "NativeAbility.h"
+ #include "abilityms_slite_client.h"
+ #include "element_name.h"
+ #include "want.h"
+ #include "msg_center.h"
+ #include "msg_center_msg.h"
+ #include "msg_center_protocol.h"
+ #include "xiaodu_navi_vector.h"
+ #include "baidumap.h"
+ #include "common_def.h"
+ #include "keyinput.h"
+ #include "KeyInputListener.h"
+ #include "VolumeSettingView.h"
+ #include "VolumeSettingPresenter.h"
+ #include "VolumeSettingView.h"
+
+ #define DIALDATASET 1
+
+ #ifdef SUPPORT_BLE_SERVICE
+ #include "bleInstruct.h"
+ #endif
+
+ #ifdef CUSTOM_ZHIHUI
+
+ #ifdef SUPPORT_CAT1_HFP_AG_SERV
+ #include "phoneservice/include/PhoneAGService.h"
+ #endif
+
+ #include "goal/include/goalmodel.h"
+ #include "goal/include/goalview.h"
+ #include "goal/include/goalother.h"
+
+ #include "ConfigModel.h"
+ #include "PlayersModelC.h"
+ #include "PlayersModel.h"
+
+ #include "main/include/PullUpDownView.h"
+
+
+ #include "custom_save_runtime.h"
+ #include "transmitting.h"
+ #include "charge_notification.h"
+ #include "motion_recognition_notification.h"
+ #include "sedentaryReminder_notification.h"
+ #include "findwatch_notification.h"
+ #include "debug_output_notification/debug_output_notification.h"
+ #include "pairing_notification.h"
+ #include "phone_crt.h"
+ #include "main/include/dial/DialModelChargeC.h"
+ #include "saveele/include/SaveEleModel.h"
+ #include "testchangingC.h"
+ #include "custom_runtime.h"
+ #include "message_notification.h"
+ #include "goal_notification.h"
+ #include "drinkReminder_notification.h"
+ #include "sleep_notification.h"
+ #include "sleep/include/SleepModel.h"
+ #include "health/health_service/health_service.h"
+ #include "player/include/PlayersModelC.h"
+ #include "system/include/SystemLogModelC.h"
+
+ #include "bloodoxygen/include/BloodOxygenModel.h"
+ #include "heartrate/include/HeartModel.h"
+ #include "saveele/include/SaveEleModel.h"
+ #include "respiratorytraining/include/RespiratoryTrainingModel.h"
+
+ #include "custom_utilscpp.h"
+ #include "custom_utils.h"
+ #ifdef SUPPORT_POWER_MANAGER
+ #include "power_display_service.h"
+ #endif
+ #endif
+
+ #ifdef SUPPORT_CYWEE_SERVICE
+ #include "cywee_hal.h"
+ #include "cywee_data.h"
+ #include "cywee_service.h"
+ #endif
+
+ #include "cat1_pub_api.h"
+ #include "uiservice/include/ui_service.h"
+
+ #include "goal_notification.h"
+ namespace OHOS {
+
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+
+ /* 订阅事件设定优先级 */
+ const PriorityMapper PRI_MAPPER[] = {
+ {TOPIC_EVENT_ALARM_RING, PRIORITY_ONE},
+ {TOPIC_EVENT_NEXTDAY_UPDATE, PRIORITY_TWO},
+ {TOPIC_EVENT_HFP_INCOMMING, PRIORITY_ONE},
+ {TOPIC_EVENT_HFP_FINISHED, PRIORITY_ONE},
+ {TOPIC_EVENT_HFP_PHONE_ACTIVE, PRIORITY_ONE},
+ {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},
+ {TOPIC_EVENT_CAT1_CALLENDED, PRIORITY_ONE},
+ {TOPIC_EVENT_CAT1_CALLDIAL,PRIORITY_ONE},
+ {TOPIC_EVENT_CAT1_SIGNAL_UPDATE, PRIORITY_ONE},
+ {TOPIC_EVENT_CAT1_POWER_ON, PRIORITY_ONE},
+ {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},
+
+ #ifdef SUPPORT_CYWEE_SERVICE
+ // {TOPIC_EVENT_ACTIVITY_UPDATE,PRIORITY_TWO},
+ // {TOPIC_EVENT_ACTIVITY_EXTRA_INFO_UPDATE,PRIORITY_TWO},
+ {TOPIC_EVENT_AR_ALERT_TYPE_UPDATE,PRIORITY_TWO},
+ {TOPIC_EVENT_INACTIVITY_UPDATE,PRIORITY_TWO},
+ // {TOPIC_EVENT_INACTIVITY_ACCUMULATE_TIME_UPDATE,PRIORITY_TWO},
+ #endif
+ {TOPIC_EVENT_GOAL_SHOW_VIEW,PRIORITY_TWO},
+ {TOPIC_EVENT_STEPDATA_UPDATE,PRIORITY_TWO},
+
+
+ {TOPIC_EVENT_BLE_TRAINING,PRIORITY_TWO},
+ {TOPIC_EVENT_BLE_TRANSMIT,PRIORITY_ONE},
+
+ {TOPIC_EVENT_CHARGE_PLUG, PRIORITY_TWO},
+ {TOPIC_EVENT_CHARGE_UNPLUG, PRIORITY_TWO},
+ {TOPIC_EVENT_LOWPOWER_ALARM,PRIORITY_TWO},
+
+ {TOPIC_EVENT_DEVICE_BIND, PRIORITY_ONE},
+ {TOPIC_EVENT_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;
+ bool g_longPressFlag = false;
+
+ static bool CheckPriority(const Topic topic)
+ {
+ uint16_t mapperSize = sizeof(PRI_MAPPER) / sizeof(PRI_MAPPER[0]);
+ for (uint16_t i = 0; i < mapperSize; i++) {
+ if (topic == PRI_MAPPER[i].topicId) {
+ if (PRI_MAPPER[i].prId <= OHOS::NativeAbility::GetInstance().GetCurSlicePriority() &&
+ PRI_MAPPER[i].prId <= OHOS::NotificationManager::GetInstance()->GetNotifyPriority()) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ }
+ return false;
+ }
+
+ /* 订阅事件可定制 */
+ 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_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);
+ MsgCenterSubscribeTopic(TOPIC_EVENT_GOAL_SHOW_VIEW);
+ MsgCenterSubscribeTopic(TOPIC_EVENT_CHARGE_PLUG);
+ MsgCenterSubscribeTopic(TOPIC_EVENT_CHARGE_UNPLUG);
+ MsgCenterSubscribeTopic(TOPIC_EVENT_LOWPOWER_ALARM);
+ #ifdef SUPPORT_CAT1_MODEM
+ MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_INCOMMING);
+ MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_CALLCONNTED);
+ MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_CALLENDED);
+ MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_CALLDIAL);
+ // MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_SIGNAL_UPDATE);
+ // MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_POWER_ON);
+ // MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_POWER_OFF);
+ MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_CALL_FAIL);
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存每小时燃脂数据");
- cywee_fat_history_save(time->value);
-#endif
- // 保存完增加一次读取数据
- SendMsgToUIService(UI_UPDATE_GOAL, 0, nullptr, 0);
-}
-//设备绑定通知
-void MsgCenterNotifyDeviceBindProc(const Topic topic, Request* req)
-{
- #ifdef SUPPORT_BLE_SERVICE
- //unused(req);
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyBindProc Bind!");
- // 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();
- // }
- uint8_t* data=(uint8_t*)req->data;
- /* 安全:固定上限 + 显式终止 */
- const size_t kMaxDevName = 64;
- char devname[kMaxDevName + 1] = {0};
- if (data != NULL && req->len >= 2)
- {
- switch(data[0])
- {
- case DEVICEBIND:
- NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
- {
- /* 设备名在 payload[2..],长度为 req->len-2,做边界裁剪并追加'\0' */
- size_t name_len = (req->len > 2) ? (size_t)req->len - 2 : 0;
- if (name_len > 0)
- {
- size_t copy_len = (name_len > kMaxDevName) ? kMaxDevName : name_len;
- (void)memcpy_s(devname, sizeof(devname), (const char*)req->data + 2, copy_len);
- devname[copy_len] = '\0';
- PairingViewEventListener::GetInstance().SetDeviceName(devname);
- }
- else
- {
- PairingViewEventListener::GetInstance().SetDeviceName(NULL);
- }
- }
- if(NotificationManager::GetInstance()->HasNotifyShowing())
- {
- NotificationManager::GetInstance()->StopNotify();
- }
- NotificationManager::GetInstance()->ShowNotify(showDeviceBindingNotify, (uint16_t)topic, true);
- break;
- case DEVICEUNBIND:
-
- NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
- {
- size_t name_len = (req->len > 2) ? (size_t)req->len - 2 : 0;
- if (name_len > 0)
- {
- size_t copy_len = (name_len > kMaxDevName) ? kMaxDevName : name_len;
- (void)memcpy_s(devname, sizeof(devname), (const char*)req->data + 2, copy_len);
- devname[copy_len] = '\0';
- PairingViewEventListener::GetInstance().SetDeviceName(devname);
- }
- else
- {
- PairingViewEventListener::GetInstance().SetDeviceName(NULL);
- }
- }
- NotificationManager::GetInstance()->ShowNotify(showDeviceUnBindingNotify, (uint16_t)topic, true);
- break;
- case DeviceUnBindingRequest:
- NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
- NotificationManager::GetInstance()->ShowNotify(showDeviceUnbindingRequestNotify, (uint16_t)topic, true);
- break;
- case SHUTDOWN:
- 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_play(true);
- break;
- case REBOOT:
- 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_play(false);
- break;
-
- default:
- break;
- }
-
- }
- #endif
-}
-
-
-
-void MsgCenterNotifybleTransmit(const Topic topic, Request* req)
-{
- #ifdef SUPPORT_BLE_SERVICE
- unused(topic);
- uint8_t* data=(uint8_t*)req->data;
-
+ #endif
+ MsgCenterSubscribeTopic(TOPIC_EVENT_DEVICE_BIND);
+ MsgCenterSubscribeTopic(TOPIC_EVENT_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)
+ {
+ return OHOS::CreateAlarmView();
+ }
+
+ static OHOS::UIViewGroup* ShowPhoneCallNotify(void)
+ {
+ return OHOS::CreatePhoneCallView();
+ }
+
+ static OHOS::UIViewGroup* ShowCallingNotify(void)
+ {
+ return OHOS::CreateCallingView();
+ }
+
+ static OHOS::UIViewGroup* ShowMultiPhoneCallNotify(void)
+ {
+ return OHOS::CreateMultiplePhoneView();
+ }
+
+
+ /*显示绑定通知*/
+ static OHOS::UIViewGroup* showDeviceBindingNotify(void)
+ {
+ return OHOS::CreateDeviceBindingView();
+ }
+
+ /*显示解绑通知*/
+ static OHOS::UIViewGroup* showDeviceUnBindingNotify(void)
+ {
+ return OHOS::CreateDeviceUnBindingView();
+ }
+
+ /*显示解除绑定请求(与新设备连接)通知*/
+ static OHOS::UIViewGroup* showDeviceUnbindingRequestNotify(void)
+ {
+ return OHOS::CreateDeviceUnbindingRequestGroupView();
+ }
+
+ /*显示低电量通知*/
+ static OHOS::UIViewGroup* showlowpowerNotify(void)
+ {
+ return OHOS::lowPowerShow();
+ }
+
+ static OHOS::UIViewGroup* ShowChargeingNotify(void)
+ {
+ return OHOS::ShowChargeingView();
+ }
+
+
+ static OHOS::UIViewGroup* showFindWatchNotify(void)
+ {
+ return OHOS::CreateFindWatchView();
+ }
+
+ /*显示喝水提醒视图*/
+ static OHOS::UIViewGroup* showDrinkReminderNotify(void)
+ {
+ return OHOS::CreateDrinkReminderView();
+ }
+
+ /*显示久坐提醒视图*/
+ static OHOS::UIViewGroup* showSedentaryReminderNotify(void)
+ {
+ return OHOS::CreateSedentaryReminderView();
+ }
+
+ /*显示运动识别视图*/
+ static OHOS::UIViewGroup* showMotionRecognitionNotify(void)
+ {
+ return OHOS::CreateMotionRecognitionView();
+ }
+
+ /*显示传输中*/
+ static OHOS::UIViewGroup* showtransmitNotify(void)
+ {
+ return OHOS::transmittingShow();
+ }
+
+ //关机动画
+ static OHOS::UIViewGroup* showShutdownAnimatorNotify(void)
+ {
+ return OHOS::showShutDownAnimation();
+ }
+ //无法呼叫sos
+ static OHOS::UIViewGroup* showSOSNotify(void)
+ {
+ 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)
+ {
+ return OHOS::CALL_INCOMING_HINT();
+ }
+
+ static OHOS::UIViewGroup* showDebugOutputNotify(void)
+ {
+ return OHOS::CreateDebugOutputMainView();
+ }
+
+
+ static OHOS::UIViewGroup* showcallfailNotify(void)
+ {
+ return OHOS::CALL_FAIL_HINT();
+ }
+
+ static OHOS::UIViewGroup* showCat1UpdataNotify(void)
+ {
+ // return OHOS::Cat1PythonUpdataShow();
+ }
+
+
+ void MsgCenterNotifyAlarmProc(const Topic topic, Request* req)
+ {
+ unused(req);
+ // The alarm notification is not displayed if the incoming call notification is already being processed
+ if (CheckPriority(topic)) {
+ // AlarmClockModel::GetInstance()->PopInterPlayMusic();
+ // AlarmViewEventListener::GetInstance()->PopAlarmRing();
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
+ NotificationManager::GetInstance()->ShowNotify(ShowAlarmNotify, static_cast<uint16_t>(topic), true);
+ } else {
+ // just delay the alarm
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "just delay the alarm");
+ // AlarmClockModel::GetInstance()->AlarmGetClockNum();
+ // AlarmPopUpPresenter::GetInstance()->DelayAlarmRing();
+ AlarmViewEventListener::GetInstance()->DelayAlarmRing();
+ }
+ }
+ /*NextDay*/
+ void MsgCenterNotifyNextDayProc(const Topic topic, Request *req)
+ {
+ unused(topic);
+ unused(req);
+ AlarmClockModel::GetInstance()->NextDayNotify();
+ // current_year = 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()));
+ }
+ 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");
+ /* ---------------------------------- 呼吸训练相关 ---------------------------------- */
+ RespiratoryTrainingModel::GetInstance().ClearTotalRespiratoryTrainingTime();
+
+ // 存储nextday执行日志
+ start_report_nextday_log_end();
+ // 清除popup_windows日志
+ nextday_clear_popup_windows_log();
+
+ printf("******nextday is end******\r\n");
+ #ifdef SUPPORT_CYWEE_SERVICE
+ /* --------------------------------- 每日目标相关 --------------------------------- */
+ cywee_reset_history_daily_data(); //清除运动相关数据
+
+ // 午夜清除运动数据
+ for(int i=1;i<6;i++)
+ {
+ set_Is_show_flag(1,i);
+ }
- if(data[0]==TRANS_FREE)
- {
- if(transmittingISShow())
- NotificationManager::GetInstance()->StopNotify();
- }
- else if (data[0]==IS_NEED_CAT1_OTA)
- {
-
- NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
-
- // NotificationManager::GetInstance()->ShowNotify(showCat1UpdataNotify, (uint16_t)topic, true);
- }
- else if (data[0]==FILE_IS_DONE)
- {
- set_transmittingShow_falg(data[0]);
- }
- else
- {
- set_transmittingShow_falg(data[0]);
+ do_cywee_service_check_msg(CYWEE_SERVICE_CMD_RESET_DAILY_DATA, NULL);
+
+ // SendMsgToUIService(UI_UPDATE_GOAL, 0, nullptr, 0);
+ printf("sport end\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);
+ AlarmClockEventData* time=(AlarmClockEventData*)req->data;
+ #ifdef SUPPORT_CYWEE_SERVICE
+
+ cywee_save_data(); //暂时没有这个函数
+
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存每小时步数");
+ cywee_step_history_save(time->value);
+
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存每小时站立数据");
+ if(cywee_get_stand_flag())
+ cywee_stand_history_save(time->value);
+
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存每小时卡路里数据");
+ cywee_calories_history_save(time->value);
+
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存每小时距离数据");
+ cywee_distances_history_save(time->value);
+
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存每小时燃脂数据");
+ cywee_fat_history_save(time->value);
+ // 保存完增加一次读取数据
+ SendMsgToUIService(UI_UPDATE_GOAL, 0, nullptr, 0);
+ #endif
+ }
+ //设备绑定通知
+ void MsgCenterNotifyDeviceBindProc(const Topic topic, Request* req)
+ {
+ #ifdef SUPPORT_BLE_SERVICE
+ //unused(req);
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyBindProc Bind!");
+ // 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();
+ // }
+ uint8_t* data=(uint8_t*)req->data;
+ /* 安全:固定上限 + 显式终止 */
+ const size_t kMaxDevName = 64;
+ char devname[kMaxDevName + 1] = {0};
+ if (data != NULL && req->len >= 2)
+ {
+ switch(data[0])
+ {
+ case DEVICEBIND:
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
+ {
+ /* 设备名在 payload[2..],长度为 req->len-2,做边界裁剪并追加'\0' */
+ size_t name_len = (req->len > 2) ? (size_t)req->len - 2 : 0;
+ if (name_len > 0)
+ {
+ size_t copy_len = (name_len > kMaxDevName) ? kMaxDevName : name_len;
+ (void)memcpy_s(devname, sizeof(devname), (const char*)req->data + 2, copy_len);
+ devname[copy_len] = '\0';
+ PairingViewEventListener::GetInstance().SetDeviceName(devname);
+ }
+ else
+ {
+ PairingViewEventListener::GetInstance().SetDeviceName(NULL);
+ }
+ }
+ if(NotificationManager::GetInstance()->HasNotifyShowing())
+ {
+ NotificationManager::GetInstance()->StopNotify();
+ }
+ NotificationManager::GetInstance()->ShowNotify(showDeviceBindingNotify, (uint16_t)topic, true);
+ break;
+ case DEVICEUNBIND:
+
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
+ {
+ size_t name_len = (req->len > 2) ? (size_t)req->len - 2 : 0;
+ if (name_len > 0)
+ {
+ size_t copy_len = (name_len > kMaxDevName) ? kMaxDevName : name_len;
+ (void)memcpy_s(devname, sizeof(devname), (const char*)req->data + 2, copy_len);
+ devname[copy_len] = '\0';
+ PairingViewEventListener::GetInstance().SetDeviceName(devname);
+ }
+ else
+ {
+ PairingViewEventListener::GetInstance().SetDeviceName(NULL);
+ }
+ }
+ NotificationManager::GetInstance()->ShowNotify(showDeviceUnBindingNotify, (uint16_t)topic, true);
+ break;
+ case DeviceUnBindingRequest:
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
+ NotificationManager::GetInstance()->ShowNotify(showDeviceUnbindingRequestNotify, (uint16_t)topic, true);
+ break;
+ case SHUTDOWN:
+ 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_play(true);
+ break;
+ case REBOOT:
+ 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_play(false);
+ break;
+
+ default:
+ break;
+ }
- NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
-
- NotificationManager::GetInstance()->ShowNotify(showtransmitNotify, (uint16_t)topic, true);
- }
- // unused(req);
- #endif
-}
-
-void MsgCenterNotifyChargePlugProc(const Topic topic, Request* req)
-{
- #ifdef SUPPORT_BATTERY_SERVICE
- unused(req);
- WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyProc:: CHarger Plug !");
-#ifdef SYSTEM_LOG_SERVICE
- uapi_save_runtime_log(RUNTIME_LOG_CHARGE_START);//充电开始事件
-#endif
- 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();
- }
-
- if(PullUpDownView::GetInstance())
- {
- GraphicService::GetInstance()->PostGraphicEvent(std::bind(&OHOS::PullUpDownView::UpdateBatteryProcess, OHOS::PullUpDownView::GetInstance() ));
- }
-#if DIALDATASET
- // DialModelCharge::GetInstance()->UpdatechargeStatus(1);
- setChargeStatus(1);
-#endif
- SaveEleModel::GetInstance()->SetChargeStatus(true);
-
- if (uapi_dev_runtime_get_train_status())
- {
- WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyProc:: CHarger Plug ! but train status is true");
- return ;
- }
-
+ }
+ #endif
+ }
+
+
+
+ void MsgCenterNotifybleTransmit(const Topic topic, Request* req)
+ {
+ #ifdef SUPPORT_BLE_SERVICE
+ unused(topic);
+ uint8_t* data=(uint8_t*)req->data;
- if(IsTestCHANGINGViewCreated())
- {
- ChangeViewcolorC(1);
- }
- else
- {
- if (CheckPriority(topic) && !uapi_dev_runtime_get_factory_test_status_flag()) //产测模式不弹充电弹窗
- {
- NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
- NotificationManager::GetInstance()->ShowNotify(ShowChargeingNotify, (uint16_t)topic, true);
- }
- }
- #endif
-}
-
-/*充电器已拔掉*/
-void MsgCenterNotifyChargeUnPlugProc(const Topic topic, Request* req)
-{
- #ifdef SUPPORT_BATTERY_SERVICE
- unused(req);
- unused(topic);
- WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyProc:: CHarger UnPlug !");
-#ifdef SYSTEM_LOG_SERVICE
- //充电停止事件
- uapi_save_runtime_log(RUNTIME_LOG_CHARGE_STOP);//TOOD*
-#endif
- if(PullUpDownView::GetInstance())
- {
- GraphicService::GetInstance()->PostGraphicEvent(std::bind(&OHOS::PullUpDownView::UpdateBatteryProcess, OHOS::PullUpDownView::GetInstance() ));
- }
-#if DIALDATASET
- // DialModelCharge::GetInstance()->UpdatechargeStatus(0);
- setChargeStatus(0);
-#endif
- SaveEleModel::GetInstance()->SetChargeStatus(false);
-
-
- if(IsTestCHANGINGViewCreated())
- {
- ChangeViewcolorC(0);
- }
- else
- {
- if(is_UIViewGroup_charge())
- {
- NotificationManager::GetInstance()->StopNotify();
- }
- }
-#endif
-}
-
-/*低电量提醒*/
-void MsgCenterNotifyLowPowerAlarmProc(const Topic topic, Request* req)
-{
- WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyProc:: LowPower Alarm !");
- #if 0
- uint8 *x= (uint8 *)(req->data);
- const power_display_svr_api_t *display_api = power_display_svr_get_api();
-
- if(*x==3)
- {
- if (display_api->get_screen_state() != SCREEN_ON)
- {
- display_api->turn_on_screen();
- }
- display_api->set_screen_set_keepon_timeout(1000*5);
- //倒计时结束后,直接执行关机动画
- low_power_play();
- }
- else if(*x==0)
- {
- //提醒低电充电
+
+ if(data[0]==TRANS_FREE)
+ {
+ if(transmittingISShow())
+ NotificationManager::GetInstance()->StopNotify();
+ }
+ else if (data[0]==IS_NEED_CAT1_OTA)
+ {
+
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
+
+ // NotificationManager::GetInstance()->ShowNotify(showCat1UpdataNotify, (uint16_t)topic, true);
+ }
+ else if (data[0]==FILE_IS_DONE)
+ {
+ set_transmittingShow_falg(data[0]);
+ }
+ else
+ {
+ set_transmittingShow_falg(data[0]);
+
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
+
+ NotificationManager::GetInstance()->ShowNotify(showtransmitNotify, (uint16_t)topic, true);
+ }
+ // unused(req);
+ #endif
+ }
+
+ void MsgCenterNotifyChargePlugProc(const Topic topic, Request* req)
+ {
+ #ifdef SUPPORT_BATTERY_SERVICE
+ unused(req);
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyProc:: CHarger Plug !");
+ #ifdef SYSTEM_LOG_SERVICE
+ uapi_save_runtime_log(RUNTIME_LOG_CHARGE_START);//充电开始事件
+ #endif
+ 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();
+ }
+
+ if(PullUpDownView::GetInstance())
+ {
+ GraphicService::GetInstance()->PostGraphicEvent(std::bind(&OHOS::PullUpDownView::UpdateBatteryProcess, OHOS::PullUpDownView::GetInstance() ));
+ }
+ #if DIALDATASET
+ // DialModelCharge::GetInstance()->UpdatechargeStatus(1);
+ setChargeStatus(1);
+ #endif
+ SaveEleModel::GetInstance()->SetChargeStatus(true);
+
+ if (uapi_dev_runtime_get_train_status())
+ {
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyProc:: CHarger Plug ! but train status is true");
+ return ;
+ }
+
+
+ if(IsTestCHANGINGViewCreated())
+ {
+ ChangeViewcolorC(1);
+ }
+ else
+ {
+ if (CheckPriority(topic) && !uapi_dev_runtime_get_factory_test_status_flag()) //产测模式不弹充电弹窗
+ {
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
+ NotificationManager::GetInstance()->ShowNotify(ShowChargeingNotify, (uint16_t)topic, true);
+ }
+ }
+ #endif
+ }
+
+ /*充电器已拔掉*/
+ void MsgCenterNotifyChargeUnPlugProc(const Topic topic, Request* req)
+ {
+ #ifdef SUPPORT_BATTERY_SERVICE
+ unused(req);
+ unused(topic);
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyProc:: CHarger UnPlug !");
+ #ifdef SYSTEM_LOG_SERVICE
+ //充电停止事件
+ uapi_save_runtime_log(RUNTIME_LOG_CHARGE_STOP);//TOOD*
+ #endif
+ if(PullUpDownView::GetInstance())
+ {
+ GraphicService::GetInstance()->PostGraphicEvent(std::bind(&OHOS::PullUpDownView::UpdateBatteryProcess, OHOS::PullUpDownView::GetInstance() ));
+ }
+ #if DIALDATASET
+ // DialModelCharge::GetInstance()->UpdatechargeStatus(0);
+ setChargeStatus(0);
+ #endif
+ SaveEleModel::GetInstance()->SetChargeStatus(false);
+
+
+ if(IsTestCHANGINGViewCreated())
+ {
+ ChangeViewcolorC(0);
+ }
+ else
+ {
+ if(is_UIViewGroup_charge())
+ {
+ NotificationManager::GetInstance()->StopNotify();
+ }
+ }
+ #endif
+ }
+
+ /*低电量提醒*/
+ void MsgCenterNotifyLowPowerAlarmProc(const Topic topic, Request* req)
+ {
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyProc:: LowPower Alarm !");
+ #if 0
+ uint8 *x= (uint8 *)(req->data);
+ const power_display_svr_api_t *display_api = power_display_svr_get_api();
+
+ if(*x==3)
+ {
if (display_api->get_screen_state() != SCREEN_ON)
- {
- display_api->turn_on_screen();
- }
- display_api->set_screen_set_keepon_timeout(1000*5);
-
- set_lowpower_falg(0);
- if (CheckPriority(topic))
- {
- NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
- NotificationManager::GetInstance()->ShowNotify(showlowpowerNotify, (uint16_t)topic, true);
- }
- }
- else
- {
- //电量过低,直接提醒关机
- if (display_api->get_screen_state() != SCREEN_ON)
- {
- display_api->turn_on_screen();
- }
- display_api->set_screen_set_keepon_timeout(1000*10);
-
- set_lowpower_falg(1);
- if (NotificationManager::GetInstance()->HasNotifyShowing())
- NotificationManager::GetInstance()->StopNotify();
- if (CheckPriority(topic))
- {
- NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
- NotificationManager::GetInstance()->ShowNotify(showlowpowerNotify, (uint16_t)topic, true);
- }
- }
-
- #endif
- }
- //TODO: 亮屏弹窗倒计时5秒关机(不需要取消,强制关机)
- // DialModelCharge::GetInstance()->UpdatechargeStatus(0);
- // SaveEleModel::GetInstance()->SetChargeStatus(0);
-
- // testCHANINGView *t=testCHANINGView::GetInstance();
- // if(t!=NULL)
- // {
- // t->ChangeViewcolor(false);
- // }
-
-#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<uint16_t>(topic), true);
- } else {
- NotificationManager::GetInstance()->ShowNotify(ShowCallingNotify, static_cast<uint16_t>(topic), true);
- }
- NotificationManager::GetInstance()->SetWatchCallStatus(true);
- }
-}
-
-void MsgCenterNotifyHfpWatchHintProc(const Topic topic, Request* req)
-{
- unused(req);
-
- phone_VibratorFunc();
-
- if(NotificationManager::GetInstance()->HasNotifyShowing())
- NotificationManager::GetInstance()->StopNotify();
-
- NotificationManager::GetInstance()->ShowNotify(showcallhintNotify,
- static_cast<uint16_t>(topic), true);
-}
-
-//来电处理函数
-void MsgCenterNotifyCatIncomingCallProc(const Topic topic, Request* req)
-{
- unused(topic);
- unused(topic);
- if (req == NULL) return ;
- char* call_data = (char*)malloc(req->len);
- if(call_data==NULL)
- {
- return;
- }
- int32 ret = memcpy_s(call_data, req->len, 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.
-
- if(NotificationManager::GetInstance()->GetWatchCallStatus() &&
- (CallerLogModel::GetInstance()->GetCallSource()==CallerLogModel::CallSourceCat1))
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OPERATE_WATCH_REJECT %s!=%s??",call_data,CallerLogModel::GetInstance()->GetPhoneNumber().c_str());
- CallerLogModel::GetInstance()->tempSetoperateNumberCAT1END(call_data,req->len);
- cat1_phone_state_change_cb(OPERATE_WATCH_REJECT);
- free(call_data);
- return;
- }
-
- if((NotificationManager::GetInstance()->GetWatchCallStatus() &&
- (CallerLogModel::GetInstance()->GetCallSource()==CallerLogModel::CallSourcePhone)) || uapi_dev_runtime_get_train_status() || transmittingISShow())
- {
-
- CallerLogModel::GetInstance()->tempSetoperateNumberCAT1(call_data,req->len);
- cat1_phone_state_change_cb(OPERATE_WAITING);
- free(call_data);
- return;
- }
-
- stopPlayingMusic();
- PlayersModel::GetInstance()->HandPausePhoneMusic(); // 暂停手机音乐
- uapi_set_screen_on_api();
- phone_paly_ring();
-
- CallerLogModel::GetInstance()->SetoperateNumber(call_data,strlen(call_data));
+ {
+ display_api->turn_on_screen();
+ }
+ display_api->set_screen_set_keepon_timeout(1000*5);
+ //倒计时结束后,直接执行关机动画
+ low_power_play();
+ }
+ else if(*x==0)
+ {
+ //提醒低电充电
+ if (display_api->get_screen_state() != SCREEN_ON)
+ {
+ display_api->turn_on_screen();
+ }
+ display_api->set_screen_set_keepon_timeout(1000*5);
+
+ set_lowpower_falg(0);
+ if (CheckPriority(topic))
+ {
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
+ NotificationManager::GetInstance()->ShowNotify(showlowpowerNotify, (uint16_t)topic, true);
+ }
+ }
+ else
+ {
+ //电量过低,直接提醒关机
+ if (display_api->get_screen_state() != SCREEN_ON)
+ {
+ display_api->turn_on_screen();
+ }
+ display_api->set_screen_set_keepon_timeout(1000*10);
+
+ set_lowpower_falg(1);
+ if (NotificationManager::GetInstance()->HasNotifyShowing())
+ NotificationManager::GetInstance()->StopNotify();
+ if (CheckPriority(topic))
+ {
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
+ NotificationManager::GetInstance()->ShowNotify(showlowpowerNotify, (uint16_t)topic, true);
+ }
+ }
+
+ #endif
+ }
+ //TODO: 亮屏弹窗倒计时5秒关机(不需要取消,强制关机)
+ // DialModelCharge::GetInstance()->UpdatechargeStatus(0);
+ // SaveEleModel::GetInstance()->SetChargeStatus(0);
+
+ // testCHANINGView *t=testCHANINGView::GetInstance();
+ // if(t!=NULL)
+ // {
+ // t->ChangeViewcolor(false);
+ // }
+
+ #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<uint16_t>(topic), true);
+ } else {
+ NotificationManager::GetInstance()->ShowNotify(ShowCallingNotify, static_cast<uint16_t>(topic), true);
+ }
+ NotificationManager::GetInstance()->SetWatchCallStatus(true);
+ }
+ }
+
+ void MsgCenterNotifyHfpWatchHintProc(const Topic topic, Request* req)
+ {
+ unused(req);
+
+ phone_VibratorFunc();
+
+ if(NotificationManager::GetInstance()->HasNotifyShowing())
+ NotificationManager::GetInstance()->StopNotify();
+
+ NotificationManager::GetInstance()->ShowNotify(showcallhintNotify,
+ static_cast<uint16_t>(topic), true);
+ }
+
+ //来电处理函数
+ void MsgCenterNotifyCatIncomingCallProc(const Topic topic, Request* req)
+ {
+ unused(topic);
+ unused(topic);
+ if (req == NULL) return ;
+ char* call_data = (char*)malloc(req->len);
+ if(call_data==NULL)
+ {
+ return;
+ }
+ int32 ret = memcpy_s(call_data, req->len, 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.
+
+ if(NotificationManager::GetInstance()->GetWatchCallStatus() &&
+ (CallerLogModel::GetInstance()->GetCallSource()==CallerLogModel::CallSourceCat1))
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OPERATE_WATCH_REJECT %s!=%s??",call_data,CallerLogModel::GetInstance()->GetPhoneNumber().c_str());
+ CallerLogModel::GetInstance()->tempSetoperateNumberCAT1END(call_data,req->len);
+ cat1_phone_state_change_cb(OPERATE_WATCH_REJECT);
+ free(call_data);
+ return;
+ }
- cat1_phone_state_change_cb(OPERATE_INCOMING);
+ if((NotificationManager::GetInstance()->GetWatchCallStatus() &&
+ (CallerLogModel::GetInstance()->GetCallSource()==CallerLogModel::CallSourcePhone)) || uapi_dev_runtime_get_train_status() || transmittingISShow())
+ {
+
+ CallerLogModel::GetInstance()->tempSetoperateNumberCAT1(call_data,req->len);
+ cat1_phone_state_change_cb(OPERATE_WAITING);
+ free(call_data);
+ return;
+ }
+
+ stopPlayingMusic();
+ PlayersModel::GetInstance()->HandPausePhoneMusic(); // 暂停手机音乐
+ uapi_set_screen_on_api();
+ phone_paly_ring();
- }
- free(call_data);
-
-}
-//开始通话处理函数
-void MsgCenterNotifyCat1CallConnectedProc(const Topic topic, Request* req)
-{
- unused(topic);
- unused(req);
-
- if (req == NULL) return ;
- if(!NotificationManager::GetInstance()->GetWatchCallStatus())
- {
- return;
- }
- AlarmClockModel::GetInstance()->AlarmPlayerStop();
- #ifdef SUPPORT_CAT1_HFP_AG_SERV
- if(uapi_dev_runtime_get_earphone_connect_stat())
- {
+ CallerLogModel::GetInstance()->SetoperateNumber(call_data,strlen(call_data));
- if(headset_Is_connect())
- {
- if(headset_SCO_Is_connect()==false)
- {
- cat1_ag_send_call_event(TOPIC_EVENT_CAT1_INCOMMING,CallerLogModel::GetInstance()->GetPhoneNumber().c_str());
- }
- else
- {
- if(cat1_api_get_cat1_volte_voice_state()==0)
- do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT_HFP_SCO_AUDIO_START, nullptr, 0);
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "headset_Is_connect is false");
- }
+ cat1_phone_state_change_cb(OPERATE_INCOMING);
- }
- else
- {
- do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CONNECT_AG, nullptr, 0);
- }
- cat1_ag_send_call_event(TOPIC_EVENT_CAT1_CALLCONNTED,NULL);
- }
- else
- #endif
- {
- do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT1_AUDIO_START, nullptr, 0);
- }
- SetMicMutecat1(false);
- cat1_phone_state_change_cb(OPERATE_WATCH_ACTIVE);
-
-}
-#include "BluetoothModelC.h"
-#include "audio_manager_c_wrapper.h"
-#include "PhoneService.h"
-//拨号处理函数
-void MsgCenterNotifyCat1dialProc(const Topic topic, Request* req)
-{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MsgCenterNotify MsgCenterNotifyCat1dialProc");
- unused(topic);
- unused(req);
+ }
+ free(call_data);
+
+ }
+ //开始通话处理函数
+ void MsgCenterNotifyCat1CallConnectedProc(const Topic topic, Request* req)
+ {
+ unused(topic);
+ unused(req);
+
if (req == NULL) return ;
- char* call_data = (char*)malloc(req->len);
- if(call_data==NULL) return;
- int32 ret = memcpy_s(call_data, req->len, req->data, req->len);
- if (ret != EOK) {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MsgCenterNotify memcpy_s request data fail!");
- } else {
-
- // int ret = PlayersModel::GetInstance()->PlayerStop();
- stopPlayingMusic();
-
- if(strcmp(call_data,"SOS")==0)
- {
- free(call_data);
- NotificationManager::GetInstance()->ShowNotify(showSOSNotify, (uint16_t)topic, true);
- return;
- }
-
- cat1_cmd_send(CMD_4G_MAKE_CALL,call_data,strlen(call_data));
-
- CallerLogModel::GetInstance()->SetoperateNumber(call_data,req->len);
- cat1_phone_state_change_cb(OPERATE_DIALING);
-
- #ifdef SUPPORT_CAT1_HFP_AG_SERV
- if(uapi_dev_runtime_get_earphone_connect_stat())
- {
- if(headset_Is_connect())
- {
- cat1_ag_send_call_event(TOPIC_EVENT_CAT1_CALLDIAL,NULL);
-
- if(headset_SCO_Is_connect())
- {
- if(cat1_api_get_cat1_volte_voice_state()==0)
- do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT_HFP_SCO_AUDIO_START, nullptr, 0);
- }
- }
- else
- {
- do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CONNECT_AG, nullptr, 0);
- }
- }
- else
- #endif
- {
- do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT1_AUDIO_START, nullptr, 0);
- }
-
- }
- free(call_data);
-}
-//电话结束处理函数
-void MsgCenterNotifyCat1CallEndedProc(const Topic topic, Request* req)
-{
- unused(topic);
- unused(req);
-
- // just stop the notify
- AlarmClockModel::GetInstance()->AlarmPlayerStop();
-
-
- if(!NotificationManager::GetInstance()->GetWatchCallStatus())
- {
- return;
- }
-
- if (req == NULL) return ;
- char* call_data = (char*)malloc(req->len);
-
- if(call_data==NULL)
- {
- return;
- }
- int32 ret = memcpy_s(call_data, req->len, req->data, req->len);
-
- if(strcmp("callfail",call_data)==0)
- {
-
- // cat1_call_hungup();
- cat1_phone_state_change_cb(OPERATE_WATCH_FINISH);
- CustomEventPublish(TOPIC_EVENT_CAT1_CALL_FAIL,NULL,0);
-
- free(call_data);
- return;
- }
-
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s %s",call_data,CallerLogModel::GetInstance()->GetPhoneNumber().c_str());
- uint8_t offset_watch =0;
- if(CallerLogModel::GetInstance()->GetPhoneNumber().c_str()[0]=='+')
- {
- offset_watch++;
- }
-
- uint8_t offset_call =0;
- if(call_data[0]=='+')
- {
- offset_call++;
- }
-
- if(strcmp(CallerLogModel::GetInstance()->GetPhoneNumber().c_str()+offset_watch,call_data+offset_call)!=0 &&
- CallerLogModel::GetInstance()->GetCallSource()==CallerLogModel::CallSourceCat1)
- {
-
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "no OPERATE_WATCH_FINISH");
- #ifdef SUPPORT_CAT1_HFP_AG_SERV
- cat1_ag_send_call_event(TOPIC_EVENT_CAT1_CALLENDED,NULL);
- #endif
- }
- else
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OPERATE_WATCH_FINISH");
- cat1_phone_state_change_cb(OPERATE_WATCH_FINISH);
- #ifdef SUPPORT_CAT1_HFP_AG_SERV
-
- #endif
- }
-
- free(call_data);
+ if(!NotificationManager::GetInstance()->GetWatchCallStatus())
+ {
+ return;
+ }
+ AlarmClockModel::GetInstance()->AlarmPlayerStop();
+ #ifdef SUPPORT_CAT1_HFP_AG_SERV
+ if(uapi_dev_runtime_get_earphone_connect_stat())
+ {
+
+ if(headset_Is_connect())
+ {
+ if(headset_SCO_Is_connect()==false)
+ {
+ cat1_ag_send_call_event(TOPIC_EVENT_CAT1_INCOMMING,CallerLogModel::GetInstance()->GetPhoneNumber().c_str());
+ }
+ else
+ {
+ if(cat1_api_get_cat1_volte_voice_state()==0)
+ do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT_HFP_SCO_AUDIO_START, nullptr, 0);
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "headset_Is_connect is false");
+ }
+
+ }
+ else
+ {
+ do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CONNECT_AG, nullptr, 0);
+ }
+ cat1_ag_send_call_event(TOPIC_EVENT_CAT1_CALLCONNTED,NULL);
+ }
+ else
+ #endif
+ {
+ do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT1_AUDIO_START, nullptr, 0);
+ }
+ SetMicMutecat1(false);
+ cat1_phone_state_change_cb(OPERATE_WATCH_ACTIVE);
+
+ }
+ #include "BluetoothModelC.h"
+ #include "audio_manager_c_wrapper.h"
+ #include "PhoneService.h"
+ //拨号处理函数
+ void MsgCenterNotifyCat1dialProc(const Topic topic, Request* req)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MsgCenterNotify MsgCenterNotifyCat1dialProc");
+ unused(topic);
+ unused(req);
+ if (req == NULL) return ;
+ char* call_data = (char*)malloc(req->len);
+ if(call_data==NULL) return;
+ int32 ret = memcpy_s(call_data, req->len, req->data, req->len);
+ if (ret != EOK) {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MsgCenterNotify memcpy_s request data fail!");
+ } else {
+
+ // int ret = PlayersModel::GetInstance()->PlayerStop();
+ stopPlayingMusic();
+
+ if(strcmp(call_data,"SOS")==0)
+ {
+ free(call_data);
+ NotificationManager::GetInstance()->ShowNotify(showSOSNotify, (uint16_t)topic, true);
+ return;
+ }
+
+ cat1_cmd_send(CMD_4G_MAKE_CALL,call_data,strlen(call_data));
+
+ CallerLogModel::GetInstance()->SetoperateNumber(call_data,req->len);
+ cat1_phone_state_change_cb(OPERATE_DIALING);
+
+ #ifdef SUPPORT_CAT1_HFP_AG_SERV
+ if(uapi_dev_runtime_get_earphone_connect_stat())
+ {
+ if(headset_Is_connect())
+ {
+ cat1_ag_send_call_event(TOPIC_EVENT_CAT1_CALLDIAL,NULL);
+
+ if(headset_SCO_Is_connect())
+ {
+ if(cat1_api_get_cat1_volte_voice_state()==0)
+ do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT_HFP_SCO_AUDIO_START, nullptr, 0);
+ }
+ }
+ else
+ {
+ do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CONNECT_AG, nullptr, 0);
+ }
+ }
+ else
+ #endif
+ {
+ do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT1_AUDIO_START, nullptr, 0);
+ }
-}
-
-void MsgCenterNotifyCat1FailEProc(const Topic topic, Request* req)
-{
- unused(req);
-
- phone_VibratorFunc();
-
- if(NotificationManager::GetInstance()->HasNotifyShowing())
- NotificationManager::GetInstance()->StopNotify();
-
- NotificationManager::GetInstance()->ShowNotify(showcallfailNotify,
- static_cast<uint16_t>(topic), true);
-}
-#endif
-
-
-
-#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<uint16_t>(topic), true);
- }
- #endif
-
- }
+ }
+ free(call_data);
+ }
+ //电话结束处理函数
+ void MsgCenterNotifyCat1CallEndedProc(const Topic topic, Request* req)
+ {
+ unused(topic);
+ unused(req);
- }
- 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() ));
- }
-
- if(OHOS::GoalModel::GetInstance().getstepvalue()>=100)
- {
-
- 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);
- }
- }
- }
-
- 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(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);
- }
- }
- }
-
- 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
- }
-
-
-
- }
-
-#endif
-
-#ifdef SUPPORT_CYWEE_SERVICE
-
-// //每日训练数据刷新
-// 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);
-// }
+ // just stop the notify
+ AlarmClockModel::GetInstance()->AlarmPlayerStop();
+
+
+ if(!NotificationManager::GetInstance()->GetWatchCallStatus())
+ {
+ return;
+ }
+
+ if (req == NULL) return ;
+ char* call_data = (char*)malloc(req->len);
+
+ if(call_data==NULL)
+ {
+ return;
+ }
+ int32 ret = memcpy_s(call_data, req->len, req->data, req->len);
+
+ if(strcmp("callfail",call_data)==0)
+ {
+
+ // cat1_call_hungup();
+ cat1_phone_state_change_cb(OPERATE_WATCH_FINISH);
+ CustomEventPublish(TOPIC_EVENT_CAT1_CALL_FAIL,NULL,0);
+
+ free(call_data);
+ return;
+ }
+
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s %s",call_data,CallerLogModel::GetInstance()->GetPhoneNumber().c_str());
+ uint8_t offset_watch =0;
+ if(CallerLogModel::GetInstance()->GetPhoneNumber().c_str()[0]=='+')
+ {
+ offset_watch++;
+ }
+
+ uint8_t offset_call =0;
+ if(call_data[0]=='+')
+ {
+ offset_call++;
+ }
+
+ if(strcmp(CallerLogModel::GetInstance()->GetPhoneNumber().c_str()+offset_watch,call_data+offset_call)!=0 &&
+ CallerLogModel::GetInstance()->GetCallSource()==CallerLogModel::CallSourceCat1)
+ {
-// 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;
-// }
-
-/*运动识别*/
-void MsgCenterNotifyArAlertProc(const Topic topic, Request* req)
-{
- uint8_t* motionType=(uint8_t*)req->data;
- WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyArAlertProc,motionType = %d !",*motionType);
- MotionRecognitionViewEventListener::GetInstance().record_motion_recognition_log();
- if(*motionType > 5 || *motionType <1) //未知运动不弹窗
- {
- return;
- }
- if (CheckPriority(topic))
- {
- MotionRecognitionViewEventListener::GetInstance().SetMotionTypeId(*motionType);
- NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
- NotificationManager::GetInstance()->ShowNotify(showMotionRecognitionNotify, (uint16_t)topic, true);
- }
-
-}
-
-void MsgCenterNotifyInactivityProc(const Topic topic, Request *req)
-{
- WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyInactivityProc !");
- inact_result_t *cywee_Inactivity_Info = (inact_result_t *)malloc(req->len);
- if (!cywee_Inactivity_Info)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Memory allocation failure");
- return;
- }
-
- int rets = memcpy_s(cywee_Inactivity_Info, req->len, (inact_result_t*)req->data, req->len);
- if (rets != EOK)
- {
- free(cywee_Inactivity_Info);
- cywee_Inactivity_Info = NULL;
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "memcpy_s cywee_inactivity_result_t failed, ret = %d", rets);
- return;
- }
-
- WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "cywee_Inactivity_Info->output_number = %d", cywee_Inactivity_Info->output_number);
-
- switch (cywee_Inactivity_Info->output_number)
- {
- case INACTIVITY_MODE_SEDENTARY_OUTPUT:
- if(cywee_Inactivity_Info->status == 1)
- {
- SedentaryReminderViewEventListener::GetInstance().record_sedentary_reminder_log();
- if (CheckPriority(topic))
- {
- NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
- NotificationManager::GetInstance()->ShowNotify(showSedentaryReminderNotify, (uint16_t)topic, true);
- }
- }
- else if(cywee_Inactivity_Info->status==9)
- {
- cywee_set_stand_flag();
- }
- break;
- default:
- break;
- }
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "no OPERATE_WATCH_FINISH");
+ #ifdef SUPPORT_CAT1_HFP_AG_SERV
+ cat1_ag_send_call_event(TOPIC_EVENT_CAT1_CALLENDED,NULL);
+ #endif
+ }
+ else
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OPERATE_WATCH_FINISH");
+ cat1_phone_state_change_cb(OPERATE_WATCH_FINISH);
+ #ifdef SUPPORT_CAT1_HFP_AG_SERV
+
+ #endif
+ }
+
+ free(call_data);
+
+ }
+
+ void MsgCenterNotifyCat1FailEProc(const Topic topic, Request* req)
+ {
+ unused(req);
+
+ phone_VibratorFunc();
+
+ if(NotificationManager::GetInstance()->HasNotifyShowing())
+ NotificationManager::GetInstance()->StopNotify();
+
+ NotificationManager::GetInstance()->ShowNotify(showcallfailNotify,
+ static_cast<uint16_t>(topic), true);
+ }
+ #endif
+
+ //每日活动
+ void MsgCenterNotifygoalnotificationviewProc(const Topic topic, Request* req)
+ {
+ unused(req);
+ if (CheckPriority(topic)) {
+
+ uint8_t* data=(uint8_t*)req->data;
+
+ if(get_Is_show_flag(data[0]))
+ {
+ set_goal_flag_view(data[0]);
+ set_Is_show_flag(0,data[0]);
+
+ uapi_set_screen_on_api();
+
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
+ NotificationManager::GetInstance()->ShowNotify(ShowGoalNotify, static_cast<uint16_t>(topic), true);
+ }
+
+ }
+
+ }
+ 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;
+ }
+ // 计步数据累加
+
+ OHOS::GoalModel::GetInstance().show_data_step_refresh();
+ OHOS::GoalModel::GetInstance().show_data_calories_refresh();
+ OHOS::GoalModel::GetInstance().show_data_distance_refresh();
+
+ 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() ));
+ }
+
+ if(OHOS::GoalModel::GetInstance().getstepvalue()>=100)
+ {
+
+ 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);
+ }
+ }
+ }
+
+ 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(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);
+ }
+ }
+ }
+
+ 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
+ }
+
+
+
+ }
+ #ifdef SUPPORT_CYWEE_SERVICE
+ //每日训练数据刷新
+ // 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;
+ // }
+
+ /*运动识别*/
+ void MsgCenterNotifyArAlertProc(const Topic topic, Request* req)
+ {
+ uint8_t* motionType=(uint8_t*)req->data;
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyArAlertProc,motionType = %d !",*motionType);
+ MotionRecognitionViewEventListener::GetInstance().record_motion_recognition_log();
+ if(*motionType > 5 || *motionType <1) //未知运动不弹窗
+ {
+ return;
+ }
+ if (CheckPriority(topic))
+ {
+ MotionRecognitionViewEventListener::GetInstance().SetMotionTypeId(*motionType);
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
+ NotificationManager::GetInstance()->ShowNotify(showMotionRecognitionNotify, (uint16_t)topic, true);
+ }
- free(cywee_Inactivity_Info);
- cywee_Inactivity_Info = NULL;
-}
-
-#endif
-
-//查找手表通知
-void MsgCenterNotifyFindWatchProc(const Topic topic, Request* req)
-{
- WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyFindWatchProc !");
- if (CheckPriority(topic))
- {
- 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*
- } else {
- if (FindWatchViewEventListener::GetInstance().GetFindWatchNotifyFlag() == true) {
- NotificationManager::GetInstance()->StopNotify();
- }
- FindWatchViewEventListener::GetInstance().SetFindWatchNotifyFlag(false);
- }
- } else {
- WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "NotifyPriority = %d ",NotificationManager::GetInstance()->GetNotifyPriority());
- }
-}
-
-void MsgCenterNotifyDebugOutProc(const Topic topic, Request *req)
-{
- unused(req);
- WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyDebugOutProc !");
- if (CheckPriority(topic))
- {
- NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
- NotificationManager::GetInstance()->ShowNotify(showDebugOutputNotify, (uint16_t)topic, true);
- }
-}
-void MsgCenterNotifyGoalShowViewProc(const Topic topic, Request* req)
-{
- unused(req);
- if (CheckPriority(topic))
- {
- uint8_t* data=(uint8_t*)req->data;
- 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();
-
- uapi_set_screen_on_api();
-
- NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
- NotificationManager::GetInstance()->ShowNotify(ShowGoalNotify, static_cast<uint16_t>(topic), true);
- }
- }
-}
-//喝水提醒通知
-void MsgCenterNotifyDrinkReminderProc(const Topic topic, Request *req)
-{
- // unused(topic);
- unused(req);
- WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyDrinkReminderProc !");
- // DrinkReminderViewEventListener::GetInstance().set_screen_on_and_vibration();
- DrinkReminderViewEventListener::GetInstance().record_drink_reminder_log();
- if (CheckPriority(topic))
- {
- NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
- 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)
-{
+ }
+
+ void MsgCenterNotifyInactivityProc(const Topic topic, Request *req)
+ {
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyInactivityProc !");
+ inact_result_t *cywee_Inactivity_Info = (inact_result_t *)malloc(req->len);
+ if (!cywee_Inactivity_Info)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Memory allocation failure");
+ return;
+ }
+
+ int rets = memcpy_s(cywee_Inactivity_Info, req->len, (inact_result_t*)req->data, req->len);
+ if (rets != EOK)
+ {
+ free(cywee_Inactivity_Info);
+ cywee_Inactivity_Info = NULL;
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "memcpy_s cywee_inactivity_result_t failed, ret = %d", rets);
+ return;
+ }
+
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "cywee_Inactivity_Info->output_number = %d", cywee_Inactivity_Info->output_number);
+
+ switch (cywee_Inactivity_Info->output_number)
+ {
+ case INACTIVITY_MODE_SEDENTARY_OUTPUT:
+ if(cywee_Inactivity_Info->status == 1)
+ {
+ SedentaryReminderViewEventListener::GetInstance().record_sedentary_reminder_log();
+ if (CheckPriority(topic))
+ {
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
+ NotificationManager::GetInstance()->ShowNotify(showSedentaryReminderNotify, (uint16_t)topic, true);
+ }
+ }
+ else if(cywee_Inactivity_Info->status==9)
+ {
+ cywee_set_stand_flag();
+ }
+ break;
+ default:
+ break;
+ }
+
+ free(cywee_Inactivity_Info);
+ cywee_Inactivity_Info = NULL;
+ }
+
+ #endif
+
+ //查找手表通知
+ void MsgCenterNotifyFindWatchProc(const Topic topic, Request* req)
+ {
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyFindWatchProc !");
+ if (CheckPriority(topic))
+ {
+ 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*
+ } else {
+ if (FindWatchViewEventListener::GetInstance().GetFindWatchNotifyFlag() == true) {
+ NotificationManager::GetInstance()->StopNotify();
+ }
+ FindWatchViewEventListener::GetInstance().SetFindWatchNotifyFlag(false);
+ }
+ } else {
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "NotifyPriority = %d ",NotificationManager::GetInstance()->GetNotifyPriority());
+ }
+ }
+
+ void MsgCenterNotifyDebugOutProc(const Topic topic, Request *req)
+ {
+ unused(req);
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyDebugOutProc !");
+ if (CheckPriority(topic))
+ {
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
+ NotificationManager::GetInstance()->ShowNotify(showDebugOutputNotify, (uint16_t)topic, true);
+ }
+ }
+ void MsgCenterNotifyGoalShowViewProc(const Topic topic, Request* req)
+ {
+ unused(req);
+ if (CheckPriority(topic))
+ {
+ uint8_t* data=(uint8_t*)req->data;
+ 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();
+
+ uapi_set_screen_on_api();
+
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
+ NotificationManager::GetInstance()->ShowNotify(ShowGoalNotify, static_cast<uint16_t>(topic), true);
+ }
+ }
+ }
+ //喝水提醒通知
+ void MsgCenterNotifyDrinkReminderProc(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)
-{
- unused(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);
- }
-
- NotificationManager::GetInstance()->ShowNotify(showSleepNotify, (uint16_t)topic, true);
- }
-
-}
-
-void MsgCenterNotifyInactivityAccumulateTimeProc(const Topic topic, Request* req)
-{
- unused(topic);
- #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 CUSTOM_ZHIHUI
- 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);
+ unused(req);
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyDrinkReminderProc !");
+ // DrinkReminderViewEventListener::GetInstance().set_screen_on_and_vibration();
+ DrinkReminderViewEventListener::GetInstance().record_drink_reminder_log();
+ if (CheckPriority(topic))
+ {
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
+ NotificationManager::GetInstance()->ShowNotify(showDrinkReminderNotify, (uint16_t)topic, true);
+ }
+ }
+ //关机动画
+ void MsgCenterNotifyShutDownAnimatorProc(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},
-
-#ifdef SUPPORT_CYWEE_SERVICE
- // {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},
-#endif
- {TOPIC_EVENT_BLE_TRAINING, MsgCenterNotifybleAPPtraining},
- // {TOPIC_EVENT_GOAL_SHOW_VIEW, MsgCenterNotifygoalnotificationviewProc},//编译不过
-
- {TOPIC_EVENT_BLE_TRANSMIT, MsgCenterNotifybleTransmit},
-
- {TOPIC_EVENT_CHARGE_PLUG, MsgCenterNotifyChargePlugProc},
- {TOPIC_EVENT_CHARGE_UNPLUG, MsgCenterNotifyChargeUnPlugProc},
- {TOPIC_EVENT_LOWPOWER_ALARM, MsgCenterNotifyLowPowerAlarmProc},
+ 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)
+ {
+ unused(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);
+ }
-#ifdef SUPPORT_CAT1_MODEM
- {TOPIC_EVENT_CAT1_INCOMMING, MsgCenterNotifyCatIncomingCallProc},
- {TOPIC_EVENT_CAT1_CALLCONNTED, MsgCenterNotifyCat1CallConnectedProc},
- {TOPIC_EVENT_CAT1_CALLENDED, MsgCenterNotifyCat1CallEndedProc},
- {TOPIC_EVENT_CAT1_CALLDIAL, MsgCenterNotifyCat1dialProc},
-
- // {TOPIC_EVENT_CAT1_SIGNAL_UPDATE, MsgCenterNotifyCat1SignalUpdateProc},
- // {TOPIC_EVENT_CAT1_POWER_ON, MsgCenterNotifyCat1PowerOnProc},
- // {TOPIC_EVENT_CAT1_POWER_OFF, MsgCenterNotifyCat1PowerOffProc},
- {TOPIC_EVENT_CAT1_CALL_FAIL, MsgCenterNotifyCat1FailEProc},
-#endif
- {TOPIC_EVENT_DEVICE_BIND, MsgCenterNotifyDeviceBindProc},
- {TOPIC_EVENT_FIND_WATCH,MsgCenterNotifyFindWatchProc},
- {TOPIC_EVENT_DRINKREMINDER,MsgCenterNotifyDrinkReminderProc},
- {TOPIC_EVENT_MESSAGENOTE,MsgCenterNotifyMessageProc},
- {TOPIC_EVENT_SLEEPNOTE,MsgCenterNotifySleepProc},
- {TOPIC_EVENT_DEBUGOUTPUT,MsgCenterNotifyDebugOutProc},
- {TOPIC_EVENT_SHUTDOWN_ANIMATIOR,MsgCenterNotifyShutDownAnimatorProc},
-};
-
-static MsgCenterNotifyTable *MsgCenterGetNotifyTblCb(uint8_t idx)
-{
- return &g_msgCenterNotifyTable[idx];
-}
-
-static uint8_t MsgCenterGetNotifyTblSize(void)
-{
- return sizeof(g_msgCenterNotifyTable) / sizeof(g_msgCenterNotifyTable[0]);
-}
-
-static void CallVolumeDipSwitchControl(uint16_t notifyId, uint8_t states)
-{
- VolumeSliderEventListener *volumeSliderEventListener = nullptr;
- if (notifyId == TOPIC_EVENT_HFP_WATCH_ACTIVE ||
- notifyId == TOPIC_EVENT_HFP_PHONE_TO_WATCH) {
- if (NotificationManager::GetInstance()->GetVolumeScreenStatus()) {
- VolumeSettingView *settingView = GetvolumeSetting();
- if (settingView == nullptr) {
- return;
- }
- volumeSliderEventListener = settingView->GetVolumeEventListener();
- if (volumeSliderEventListener == nullptr) {
- return;
- }
- volumeSliderEventListener->ChangeVolume(static_cast<VolumeChangeStatus>(states));
- } else {
- HonrsViewChange();
- NotificationManager::GetInstance()->SetVolumeScreenStatus(true);
- }
- }
- return;
-}
-
-static void OnKeyLongPress(uint16_t keyID)
-{
- g_longPressFlag = true; // Long press the logo
- if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_POWER)) { // Power button
- // After StopNotify, a restart card will pop up first
- uint16_t notifyId = NotificationManager::GetInstance()->GetShowingNotifyId();
- if(notifyId == TOPIC_EVENT_ALARM_RING) {
- NativeAbility::GetInstance().ChangeSlice(VIEW_REBOOT);
- NotificationManager::GetInstance()->SetNativeUIRunning(true);
- NotificationManager::GetInstance()->StopNotify();
- }
- } else if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_FUNC)) { // Function buttons
- // Switch to user configured shortcut card
- }
- return;
-}
-
-static void HandleKeyPress(uint16_t notifyId)
-{
- if (notifyId == TOPIC_EVENT_ALARM_RING) {
- AlarmClockModel::GetInstance()->AlarmGetClockNum();
- AlarmPopUpPresenter::GetInstance()->DelayAlarmRing();
- NotificationManager::GetInstance()->StopNotify();
- }
-}
-
-static bool PressKeyEvent(uint16_t keyID, uint8_t state)
-{
- switch (state) {
- case InputDevice::STATE_PRESS:
- g_pressFlag = true;
- return true;
- case InputDevice::STATE_LONG_PRESS:
- OnKeyLongPress(keyID);
- return true;
- case InputDevice::STATE_RELEASE:
- if (g_longPressFlag) {
- g_pressFlag = false;
- g_longPressFlag = false;
- return true;
- }
- break;
- default:
- break;
- }
- return false;
-}
-
-static bool KeyNotifyCallback(uint16_t keyID, uint8_t state)
-{
- if (!OHOS::NotificationManager::GetInstance()->HasNotifyShowing()) {
- WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "Notify does not exist!");
- OHOS::ACELite::KeyInputModule::SetNotifyKeyListener(nullptr);
- g_pressFlag = false;
- g_longPressFlag = false;
- return false;
- }
- if (PressKeyEvent(keyID, state)) {
- return true;
- }
- uint16_t notifyId = NotificationManager::GetInstance()->GetShowingNotifyId();
- if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_POWER)) { // Power button
- if (NotificationManager::GetInstance()->GetWatchCallStatus()) { // Volume card
- // volume+
- CallVolumeDipSwitchControl(notifyId, VOLUMEUP);
- } else {
- HandleKeyPress(notifyId);
- }
- }
- else if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_FUNC)) { // Function buttons
- if (NotificationManager::GetInstance()->GetWatchCallStatus()) { // Volume card
- // volume-
- CallVolumeDipSwitchControl(notifyId, VOLUMEDOWN);
- } else {
- // Switch to user configured shortcut card
- }
- }
- g_pressFlag = false;
- g_longPressFlag = false;
- return true;
-}
-
-bool MsgCenterNotifyProc(const Topic topic, Request* req)
-{
- uint8_t i;
- uint8_t tblSize = MsgCenterGetNotifyTblSize();
- OHOS::ACELite::KeyInputModule::SetNotifyKeyListener(KeyNotifyCallback);
- for (i = 0; i < tblSize; i++) {
- MsgCenterNotifyTable *item = MsgCenterGetNotifyTblCb(i);
- if (item != nullptr && item->topic == topic && item->cb != nullptr) {
- item->cb(topic, req);
- return true;
- }
- }
-
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyProc:: Can not find the cb!");
- return false;
-}
-
-#ifdef JS_ENABLE
-void StartJsApp(char *bundleName)
-{
- ElementName* topAbility = OHOS::AbilityMsClient::GetInstance().GetTopAbility();
- if (topAbility == nullptr) {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "topAbility is null");
- return;
- }
-
- if (strcmp(topAbility->bundleName, bundleName) == 0) {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s is active", bundleName);
- FreeElement(topAbility);
- return;
- }
- FreeElement(topAbility);
- // If the alarm notification is being processed, we need to disable the alarm notification first.
- if (OHOS::NotificationManager::GetInstance()->GetNotifyPriority() == PRIORITY_TWO &&
- OHOS::NotificationManager::GetInstance()->HasNotifyShowing()) {
- WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "Alarm notification needs to be disabled first.");
- AlarmClockModel::GetInstance()->AlarmGetClockNum();
- OHOS::AlarmPopUpPresenter::GetInstance()->DelayAlarmRing();
- OHOS::NotificationManager::GetInstance()->StopNotify();
- }
- Want *want = new Want();
- memset_s(want, sizeof(Want), 0, sizeof(Want));
-
- ElementName startElement = {};
- startElement.abilityName = (char *)"default";
- startElement.bundleName = bundleName;
- startElement.deviceId = nullptr;
- SetWantElement(want, startElement);
-
- StartAbility(want);
- ClearWant(want);
- delete want;
-}
-
-void StopJsApp(char *bundleName)
-{
- ElementName* topAbility = OHOS::AbilityMsClient::GetInstance().GetTopAbility();
- if (topAbility == nullptr) {
- WEARABLE_LOGE(HILOG_MODULE_AAFWK, "topAbility is null");
- return;
- }
-
- if (strcmp(topAbility->bundleName, bundleName) != 0) {
- WEARABLE_LOGE(HILOG_MODULE_AAFWK, "%s is not top active", bundleName);
- FreeElement(topAbility);
- return;
- }
- FreeElement(topAbility);
- int token = 0;
- OHOS::AbilityMsClient::GetInstance().TerminateAbility(token);
-}
-
-void MsgCenterReportBtStatusToJS(uint16_t msgId)
-{
- ElementName *elementName = OHOS::AbilityMsClient::GetInstance().GetTopAbility();
- if (!(elementName != nullptr && strcmp(elementName->bundleName, "com.huawei.launcher") != 0)) {
- WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "JS is not on top, ignore report");
- FreeElement(elementName);
- return;
- }
- FreeElement(elementName);
- if (msgId == BT_DISCONNECTED_TO_MSGCENTER) {
- BaidumapSendMsgToJS("0", MSGCENTER_TYPE_ID_VECTOR_NAVI_BT_DISCONNECTED);
- } else if (msgId == BT_CONNECTED_TO_MSGCENTER) {
- BaidumapSendMsgToJS("1", MSGCENTER_TYPE_ID_VECTOR_NAVI_BT_CONNECTED);
- } else {
- WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "unexpected msgId %d", msgId);
- }
-}
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-}
\ No newline at end of file
+ NotificationManager::GetInstance()->ShowNotify(showSleepNotify, (uint16_t)topic, true);
+ }
+
+ }
+
+ void MsgCenterNotifyInactivityAccumulateTimeProc(const Topic topic, Request* req)
+ {
+ unused(topic);
+ #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 CUSTOM_ZHIHUI
+ 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_STEPDATA_UPDATE, MsgCenterNotifystepProc},
+
+ {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},
+
+ #ifdef SUPPORT_CYWEE_SERVICE
+ // {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},
+ #endif
+ // {TOPIC_EVENT_GOAL_SHOW_VIEW, MsgCenterNotifygoalnotificationviewProc},//编译不过
+ {TOPIC_EVENT_BLE_TRANSMIT, MsgCenterNotifybleTransmit},
+
+ {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},
+ {TOPIC_EVENT_CAT1_CALLENDED, MsgCenterNotifyCat1CallEndedProc},
+ {TOPIC_EVENT_CAT1_CALLDIAL, MsgCenterNotifyCat1dialProc},
+
+ // {TOPIC_EVENT_CAT1_SIGNAL_UPDATE, MsgCenterNotifyCat1SignalUpdateProc},
+ // {TOPIC_EVENT_CAT1_POWER_ON, MsgCenterNotifyCat1PowerOnProc},
+ // {TOPIC_EVENT_CAT1_POWER_OFF, MsgCenterNotifyCat1PowerOffProc},
+ {TOPIC_EVENT_CAT1_CALL_FAIL, MsgCenterNotifyCat1FailEProc},
+ #endif
+ {TOPIC_EVENT_DEVICE_BIND, MsgCenterNotifyDeviceBindProc},
+ {TOPIC_EVENT_FIND_WATCH,MsgCenterNotifyFindWatchProc},
+ {TOPIC_EVENT_DRINKREMINDER,MsgCenterNotifyDrinkReminderProc},
+ {TOPIC_EVENT_MESSAGENOTE,MsgCenterNotifyMessageProc},
+ {TOPIC_EVENT_SLEEPNOTE,MsgCenterNotifySleepProc},
+ {TOPIC_EVENT_DEBUGOUTPUT,MsgCenterNotifyDebugOutProc},
+ {TOPIC_EVENT_SHUTDOWN_ANIMATIOR,MsgCenterNotifyShutDownAnimatorProc},
+ };
+
+ static MsgCenterNotifyTable *MsgCenterGetNotifyTblCb(uint8_t idx)
+ {
+ return &g_msgCenterNotifyTable[idx];
+ }
+
+ static uint8_t MsgCenterGetNotifyTblSize(void)
+ {
+ return sizeof(g_msgCenterNotifyTable) / sizeof(g_msgCenterNotifyTable[0]);
+ }
+
+ static void CallVolumeDipSwitchControl(uint16_t notifyId, uint8_t states)
+ {
+ VolumeSliderEventListener *volumeSliderEventListener = nullptr;
+ if (notifyId == TOPIC_EVENT_HFP_WATCH_ACTIVE ||
+ notifyId == TOPIC_EVENT_HFP_PHONE_TO_WATCH) {
+ if (NotificationManager::GetInstance()->GetVolumeScreenStatus()) {
+ VolumeSettingView *settingView = GetvolumeSetting();
+ if (settingView == nullptr) {
+ return;
+ }
+ volumeSliderEventListener = settingView->GetVolumeEventListener();
+ if (volumeSliderEventListener == nullptr) {
+ return;
+ }
+ volumeSliderEventListener->ChangeVolume(static_cast<VolumeChangeStatus>(states));
+ } else {
+ HonrsViewChange();
+ NotificationManager::GetInstance()->SetVolumeScreenStatus(true);
+ }
+ }
+ return;
+ }
+
+ static void OnKeyLongPress(uint16_t keyID)
+ {
+ g_longPressFlag = true; // Long press the logo
+ if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_POWER)) { // Power button
+ // After StopNotify, a restart card will pop up first
+ uint16_t notifyId = NotificationManager::GetInstance()->GetShowingNotifyId();
+ if(notifyId == TOPIC_EVENT_ALARM_RING) {
+ NativeAbility::GetInstance().ChangeSlice(VIEW_REBOOT);
+ NotificationManager::GetInstance()->SetNativeUIRunning(true);
+ NotificationManager::GetInstance()->StopNotify();
+ }
+ } else if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_FUNC)) { // Function buttons
+ // Switch to user configured shortcut card
+ }
+ return;
+ }
+
+ static void HandleKeyPress(uint16_t notifyId)
+ {
+ if (notifyId == TOPIC_EVENT_ALARM_RING) {
+ AlarmClockModel::GetInstance()->AlarmGetClockNum();
+ AlarmPopUpPresenter::GetInstance()->DelayAlarmRing();
+ NotificationManager::GetInstance()->StopNotify();
+ }
+ }
+
+ static bool PressKeyEvent(uint16_t keyID, uint8_t state)
+ {
+ switch (state) {
+ case InputDevice::STATE_PRESS:
+ g_pressFlag = true;
+ return true;
+ case InputDevice::STATE_LONG_PRESS:
+ OnKeyLongPress(keyID);
+ return true;
+ case InputDevice::STATE_RELEASE:
+ if (g_longPressFlag) {
+ g_pressFlag = false;
+ g_longPressFlag = false;
+ return true;
+ }
+ break;
+ default:
+ break;
+ }
+ return false;
+ }
+
+ static bool KeyNotifyCallback(uint16_t keyID, uint8_t state)
+ {
+ if (!OHOS::NotificationManager::GetInstance()->HasNotifyShowing()) {
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "Notify does not exist!");
+ OHOS::ACELite::KeyInputModule::SetNotifyKeyListener(nullptr);
+ g_pressFlag = false;
+ g_longPressFlag = false;
+ return false;
+ }
+ if (PressKeyEvent(keyID, state)) {
+ return true;
+ }
+ uint16_t notifyId = NotificationManager::GetInstance()->GetShowingNotifyId();
+ if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_POWER)) { // Power button
+ if (NotificationManager::GetInstance()->GetWatchCallStatus()) { // Volume card
+ // volume+
+ CallVolumeDipSwitchControl(notifyId, VOLUMEUP);
+ } else {
+ HandleKeyPress(notifyId);
+ }
+ }
+ else if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_FUNC)) { // Function buttons
+ if (NotificationManager::GetInstance()->GetWatchCallStatus()) { // Volume card
+ // volume-
+ CallVolumeDipSwitchControl(notifyId, VOLUMEDOWN);
+ } else {
+ // Switch to user configured shortcut card
+ }
+ }
+ g_pressFlag = false;
+ g_longPressFlag = false;
+ return true;
+ }
+
+ bool MsgCenterNotifyProc(const Topic topic, Request* req)
+ {
+ uint8_t i;
+ uint8_t tblSize = MsgCenterGetNotifyTblSize();
+ OHOS::ACELite::KeyInputModule::SetNotifyKeyListener(KeyNotifyCallback);
+ for (i = 0; i < tblSize; i++) {
+ MsgCenterNotifyTable *item = MsgCenterGetNotifyTblCb(i);
+ if (item != nullptr && item->topic == topic && item->cb != nullptr) {
+ item->cb(topic, req);
+ return true;
+ }
+ }
+
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyProc:: Can not find the cb!");
+ return false;
+ }
+
+ #ifdef JS_ENABLE
+ void StartJsApp(char *bundleName)
+ {
+ ElementName* topAbility = OHOS::AbilityMsClient::GetInstance().GetTopAbility();
+ if (topAbility == nullptr) {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "topAbility is null");
+ return;
+ }
+
+ if (strcmp(topAbility->bundleName, bundleName) == 0) {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s is active", bundleName);
+ FreeElement(topAbility);
+ return;
+ }
+ FreeElement(topAbility);
+ // If the alarm notification is being processed, we need to disable the alarm notification first.
+ if (OHOS::NotificationManager::GetInstance()->GetNotifyPriority() == PRIORITY_TWO &&
+ OHOS::NotificationManager::GetInstance()->HasNotifyShowing()) {
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "Alarm notification needs to be disabled first.");
+ AlarmClockModel::GetInstance()->AlarmGetClockNum();
+ OHOS::AlarmPopUpPresenter::GetInstance()->DelayAlarmRing();
+ OHOS::NotificationManager::GetInstance()->StopNotify();
+ }
+ Want *want = new Want();
+ memset_s(want, sizeof(Want), 0, sizeof(Want));
+
+ ElementName startElement = {};
+ startElement.abilityName = (char *)"default";
+ startElement.bundleName = bundleName;
+ startElement.deviceId = nullptr;
+ SetWantElement(want, startElement);
+
+ StartAbility(want);
+ ClearWant(want);
+ delete want;
+ }
+
+ void StopJsApp(char *bundleName)
+ {
+ ElementName* topAbility = OHOS::AbilityMsClient::GetInstance().GetTopAbility();
+ if (topAbility == nullptr) {
+ WEARABLE_LOGE(HILOG_MODULE_AAFWK, "topAbility is null");
+ return;
+ }
+
+ if (strcmp(topAbility->bundleName, bundleName) != 0) {
+ WEARABLE_LOGE(HILOG_MODULE_AAFWK, "%s is not top active", bundleName);
+ FreeElement(topAbility);
+ return;
+ }
+ FreeElement(topAbility);
+ int token = 0;
+ OHOS::AbilityMsClient::GetInstance().TerminateAbility(token);
+ }
+
+ void MsgCenterReportBtStatusToJS(uint16_t msgId)
+ {
+ ElementName *elementName = OHOS::AbilityMsClient::GetInstance().GetTopAbility();
+ if (!(elementName != nullptr && strcmp(elementName->bundleName, "com.huawei.launcher") != 0)) {
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "JS is not on top, ignore report");
+ FreeElement(elementName);
+ return;
+ }
+ FreeElement(elementName);
+ if (msgId == BT_DISCONNECTED_TO_MSGCENTER) {
+ BaidumapSendMsgToJS("0", MSGCENTER_TYPE_ID_VECTOR_NAVI_BT_DISCONNECTED);
+ } else if (msgId == BT_CONNECTED_TO_MSGCENTER) {
+ BaidumapSendMsgToJS("1", MSGCENTER_TYPE_ID_VECTOR_NAVI_BT_CONNECTED);
+ } else {
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "unexpected msgId %d", msgId);
+ }
+ }
+ #endif
+
+ #ifdef __cplusplus
+ }
+ #endif
+ }
\ No newline at end of file
* Create: 2021-11-11
*/
-#include <cstdio>
-#include "securec.h"
-#include "adapter.h"
-#include "ohos_init.h"
-#include "samgr_lite.h"
-#include "memory_adapter.h"
-#include "wearable_log.h"
-#include "service_id_define.h"
-#include "broadcast_service.h"
-#include "alarm/include/AlarmClockModel.h"
-#include "AlarmPopUpPresenter.h"
-#include "CallerLogModel.h"
-#include "notification_manager.h"
-#include "NativeAbility.h"
-#include "abilityms_slite_client.h"
-#include "element_name.h"
-#include "want.h"
-#include "msg_center.h"
-#include "msg_center_msg.h"
-#include "msg_center_protocol.h"
-#include "xiaodu_navi_vector.h"
-#include "baidumap.h"
-#include "common_def.h"
-#include "keyinput.h"
-#include "KeyInputListener.h"
-#include "VolumeSettingView.h"
-#include "VolumeSettingPresenter.h"
-#include "VolumeSettingView.h"
-
-#define DIALDATASET 1
-
-#ifdef SUPPORT_BLE_SERVICE
-#include "bleInstruct.h"
-#endif
-
-#ifdef CUSTOM_ZHIHUI
-
-#ifdef SUPPORT_CAT1_HFP_AG_SERV
-#include "phoneservice/include/PhoneAGService.h"
-#endif
-
-#include "ConfigModel.h"
-#include "PlayersModelC.h"
-#include "PlayersModel.h"
-#include "main/include/PullUpDownView.h"
-#include "custom_save_runtime.h"
-#include "transmitting.h"
-#include "charge_notification.h"
-#include "motion_recognition_notification.h"
-#include "sedentaryReminder_notification.h"
-#include "findwatch_notification.h"
-#include "debug_output_notification/debug_output_notification.h"
-#include "pairing_notification.h"
-#include "phone_crt.h"
-#include "main/include/dial/DialModelChargeC.h"
-#include "saveele/include/SaveEleModel.h"
-#include "testchangingC.h"
-#include "custom_runtime.h"
-#include "message_notification.h"
-#include "goal_notification.h"
-#include "drinkReminder_notification.h"
-#include "sleep_notification.h"
-#include "sleep/include/SleepModel.h"
-
-#include "custom_utilscpp.h"
-#include "custom_utils.h"
-#ifdef SUPPORT_POWER_MANAGER
-#include "power_display_service.h"
-#endif
-#endif
-
-#ifdef SUPPORT_CYWEE_SERVICE
-#include "cywee_hal.h"
-#include "cywee_data.h"
-#include "cywee_service.h"
-#endif
-
-#include "cat1_pub_api.h"
-#include "uiservice/include/ui_service.h"
-
-namespace OHOS {
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* 订阅事件设定优先级 */
-const PriorityMapper PRI_MAPPER[] = {
- {TOPIC_EVENT_ALARM_RING, PRIORITY_ONE},
- {TOPIC_EVENT_NEXTDAY_UPDATE, PRIORITY_TWO},
- {TOPIC_EVENT_HFP_INCOMMING, PRIORITY_ONE},
- {TOPIC_EVENT_HFP_FINISHED, PRIORITY_ONE},
- {TOPIC_EVENT_HFP_PHONE_ACTIVE, PRIORITY_ONE},
- {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},
- {TOPIC_EVENT_CAT1_CALLENDED, PRIORITY_ONE},
- {TOPIC_EVENT_CAT1_CALLDIAL,PRIORITY_ONE},
- {TOPIC_EVENT_CAT1_SIGNAL_UPDATE, PRIORITY_ONE},
- {TOPIC_EVENT_CAT1_POWER_ON, PRIORITY_ONE},
- {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},
-
-#ifdef SUPPORT_CYWEE_SERVICE
- // {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},
-#endif
- {TOPIC_EVENT_GOAL_SHOW_VIEW,PRIORITY_TWO},
- {TOPIC_EVENT_BLE_TRAINING,PRIORITY_TWO},
- {TOPIC_EVENT_BLE_TRANSMIT,PRIORITY_ONE},
-
- {TOPIC_EVENT_CHARGE_PLUG, PRIORITY_TWO},
- {TOPIC_EVENT_CHARGE_UNPLUG, PRIORITY_TWO},
- {TOPIC_EVENT_LOWPOWER_ALARM,PRIORITY_TWO},
-
- {TOPIC_EVENT_DEVICE_BIND, PRIORITY_ONE},
- {TOPIC_EVENT_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;
-bool g_longPressFlag = false;
-
-static bool CheckPriority(const Topic topic)
-{
- uint16_t mapperSize = sizeof(PRI_MAPPER) / sizeof(PRI_MAPPER[0]);
- for (uint16_t i = 0; i < mapperSize; i++) {
- if (topic == PRI_MAPPER[i].topicId) {
- if (PRI_MAPPER[i].prId <= OHOS::NativeAbility::GetInstance().GetCurSlicePriority() &&
- PRI_MAPPER[i].prId <= OHOS::NotificationManager::GetInstance()->GetNotifyPriority()) {
- return true;
- } else {
- return false;
- }
- }
- }
- return false;
-}
-
-/* 订阅事件可定制 */
-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_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);
- MsgCenterSubscribeTopic(TOPIC_EVENT_GOAL_SHOW_VIEW);
- MsgCenterSubscribeTopic(TOPIC_EVENT_CHARGE_PLUG);
- MsgCenterSubscribeTopic(TOPIC_EVENT_CHARGE_UNPLUG);
- MsgCenterSubscribeTopic(TOPIC_EVENT_LOWPOWER_ALARM);
-#ifdef SUPPORT_CAT1_MODEM
- MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_INCOMMING);
- MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_CALLCONNTED);
- MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_CALLENDED);
- MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_CALLDIAL);
- // MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_SIGNAL_UPDATE);
- // MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_POWER_ON);
- // MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_POWER_OFF);
- MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_CALL_FAIL);
-
-#endif
- MsgCenterSubscribeTopic(TOPIC_EVENT_DEVICE_BIND);
- MsgCenterSubscribeTopic(TOPIC_EVENT_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)
-{
- return OHOS::CreateAlarmView();
-}
-
-static OHOS::UIViewGroup* ShowPhoneCallNotify(void)
-{
- return OHOS::CreatePhoneCallView();
-}
-
-static OHOS::UIViewGroup* ShowCallingNotify(void)
-{
- return OHOS::CreateCallingView();
-}
-
-static OHOS::UIViewGroup* ShowMultiPhoneCallNotify(void)
-{
- return OHOS::CreateMultiplePhoneView();
-}
-
-
-/*显示绑定通知*/
-static OHOS::UIViewGroup* showDeviceBindingNotify(void)
-{
- return OHOS::CreateDeviceBindingView();
-}
-
-/*显示解绑通知*/
-static OHOS::UIViewGroup* showDeviceUnBindingNotify(void)
-{
- return OHOS::CreateDeviceUnBindingView();
-}
-
-/*显示解除绑定请求(与新设备连接)通知*/
-static OHOS::UIViewGroup* showDeviceUnbindingRequestNotify(void)
-{
- return OHOS::CreateDeviceUnbindingRequestGroupView();
-}
-
-/*显示低电量通知*/
-static OHOS::UIViewGroup* showlowpowerNotify(void)
-{
- return OHOS::lowPowerShow();
-}
-
-static OHOS::UIViewGroup* ShowChargeingNotify(void)
-{
- return OHOS::ShowChargeingView();
-}
-
-
-static OHOS::UIViewGroup* showFindWatchNotify(void)
-{
- return OHOS::CreateFindWatchView();
-}
-
-/*显示喝水提醒视图*/
-static OHOS::UIViewGroup* showDrinkReminderNotify(void)
-{
- return OHOS::CreateDrinkReminderView();
-}
-
-/*显示久坐提醒视图*/
-static OHOS::UIViewGroup* showSedentaryReminderNotify(void)
-{
- return OHOS::CreateSedentaryReminderView();
-}
-
-/*显示运动识别视图*/
-static OHOS::UIViewGroup* showMotionRecognitionNotify(void)
-{
- return OHOS::CreateMotionRecognitionView();
-}
-
-/*显示传输中*/
-static OHOS::UIViewGroup* showtransmitNotify(void)
-{
- return OHOS::transmittingShow();
-}
-
-//关机动画
-static OHOS::UIViewGroup* showShutdownAnimatorNotify(void)
-{
- return OHOS::showShutDownAnimation();
-}
-//无法呼叫sos
-static OHOS::UIViewGroup* showSOSNotify(void)
-{
- 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)
-{
- return OHOS::CALL_INCOMING_HINT();
-}
-
-static OHOS::UIViewGroup* showDebugOutputNotify(void)
-{
- return OHOS::CreateDebugOutputMainView();
-}
-
-
-static OHOS::UIViewGroup* showcallfailNotify(void)
-{
- return OHOS::CALL_FAIL_HINT();
-}
-
-static OHOS::UIViewGroup* showCat1UpdataNotify(void)
-{
- // return OHOS::Cat1PythonUpdataShow();
-}
-
-
-void MsgCenterNotifyAlarmProc(const Topic topic, Request* req)
-{
- unused(req);
- // The alarm notification is not displayed if the incoming call notification is already being processed
- if (CheckPriority(topic)) {
- // AlarmClockModel::GetInstance()->PopInterPlayMusic();
- // AlarmViewEventListener::GetInstance()->PopAlarmRing();
- NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
- NotificationManager::GetInstance()->ShowNotify(ShowAlarmNotify, static_cast<uint16_t>(topic), true);
- } else {
- // just delay the alarm
- WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "just delay the alarm");
- // AlarmClockModel::GetInstance()->AlarmGetClockNum();
- // AlarmPopUpPresenter::GetInstance()->DelayAlarmRing();
- AlarmViewEventListener::GetInstance()->DelayAlarmRing();
- }
-}
-/*NextDay*/
-void MsgCenterNotifyNextDayProc(const Topic topic, Request *req)
-{
- unused(topic);
- unused(req);
- AlarmClockModel::GetInstance()->NextDayNotify();
- // 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()));
- }
- 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");
- /* ---------------------------------- 呼吸训练相关 ---------------------------------- */
- RespiratoryTrainingModel::GetInstance().ClearTotalRespiratoryTrainingTime();
-
- // 存储nextday执行日志
- start_report_nextday_log_end();
- // 清除popup_windows日志
- nextday_clear_popup_windows_log();
-
- printf("******nextday is end******\r\n");
-#endif
-#ifdef SUPPORT_CYWEE_SERVICE
- /* --------------------------------- 每日目标相关 --------------------------------- */
- cywee_reset_history_daily_data(); //清除运动相关数据
-
- // 午夜清除运动数据
- for(int i=1;i<6;i++)
- {
- set_Is_show_flag(1,i);
- }
-
-
- do_cywee_service_check_msg(CYWEE_SERVICE_CMD_RESET_DAILY_DATA, NULL);
-
- // SendMsgToUIService(UI_UPDATE_GOAL, 0, nullptr, 0);
- printf("sport end\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);
- AlarmClockEventData* time=(AlarmClockEventData*)req->data;
-#ifdef SUPPORT_CYWEE_SERVICE
- cywee_save_data();
-
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存每小时步数");
- cywee_step_history_save(time->value);
-
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存每小时站立数据");
- if(cywee_get_stand_flag())
- cywee_stand_history_save(time->value);
-
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存每小时卡路里数据");
- cywee_calories_history_save(time->value);
-
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存每小时距离数据");
- cywee_distances_history_save(time->value);
+ #include <cstdio>
+ #include "securec.h"
+ #include "adapter.h"
+ #include "ohos_init.h"
+ #include "samgr_lite.h"
+ #include "memory_adapter.h"
+ #include "wearable_log.h"
+ #include "service_id_define.h"
+ #include "broadcast_service.h"
+ #include "alarm/include/AlarmClockModel.h"
+ #include "AlarmPopUpPresenter.h"
+ #include "CallerLogModel.h"
+ #include "notification_manager.h"
+ #include "NativeAbility.h"
+ #include "abilityms_slite_client.h"
+ #include "element_name.h"
+ #include "want.h"
+ #include "msg_center.h"
+ #include "msg_center_msg.h"
+ #include "msg_center_protocol.h"
+ #include "xiaodu_navi_vector.h"
+ #include "baidumap.h"
+ #include "common_def.h"
+ #include "keyinput.h"
+ #include "KeyInputListener.h"
+ #include "VolumeSettingView.h"
+ #include "VolumeSettingPresenter.h"
+ #include "VolumeSettingView.h"
+
+ #define DIALDATASET 1
+
+ #ifdef SUPPORT_BLE_SERVICE
+ #include "bleInstruct.h"
+ #endif
+
+ #ifdef CUSTOM_ZHIHUI
+
+ #ifdef SUPPORT_CAT1_HFP_AG_SERV
+ #include "phoneservice/include/PhoneAGService.h"
+ #endif
+
+ #include "goal/include/goalmodel.h"
+ #include "goal/include/goalview.h"
+ #include "goal/include/goalother.h"
+
+ #include "ConfigModel.h"
+ #include "PlayersModelC.h"
+ #include "PlayersModel.h"
+
+ #include "main/include/PullUpDownView.h"
+
+
+ #include "custom_save_runtime.h"
+ #include "transmitting.h"
+ #include "charge_notification.h"
+ #include "motion_recognition_notification.h"
+ #include "sedentaryReminder_notification.h"
+ #include "findwatch_notification.h"
+ #include "debug_output_notification/debug_output_notification.h"
+ #include "pairing_notification.h"
+ #include "phone_crt.h"
+ #include "main/include/dial/DialModelChargeC.h"
+ #include "saveele/include/SaveEleModel.h"
+ #include "testchangingC.h"
+ #include "custom_runtime.h"
+ #include "message_notification.h"
+ #include "goal_notification.h"
+ #include "drinkReminder_notification.h"
+ #include "sleep_notification.h"
+ #include "sleep/include/SleepModel.h"
+ #include "health/health_service/health_service.h"
+ #include "player/include/PlayersModelC.h"
+ #include "system/include/SystemLogModelC.h"
+
+ #include "bloodoxygen/include/BloodOxygenModel.h"
+ #include "heartrate/include/HeartModel.h"
+ #include "saveele/include/SaveEleModel.h"
+ #include "respiratorytraining/include/RespiratoryTrainingModel.h"
+
+ #include "custom_utilscpp.h"
+ #include "custom_utils.h"
+ #ifdef SUPPORT_POWER_MANAGER
+ #include "power_display_service.h"
+ #endif
+ #endif
+
+ #ifdef SUPPORT_CYWEE_SERVICE
+ #include "cywee_hal.h"
+ #include "cywee_data.h"
+ #include "cywee_service.h"
+ #endif
+
+ #include "cat1_pub_api.h"
+ #include "uiservice/include/ui_service.h"
+
+ #include "goal_notification.h"
+ namespace OHOS {
+
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+
+ /* 订阅事件设定优先级 */
+ const PriorityMapper PRI_MAPPER[] = {
+ {TOPIC_EVENT_ALARM_RING, PRIORITY_ONE},
+ {TOPIC_EVENT_NEXTDAY_UPDATE, PRIORITY_TWO},
+ {TOPIC_EVENT_HFP_INCOMMING, PRIORITY_ONE},
+ {TOPIC_EVENT_HFP_FINISHED, PRIORITY_ONE},
+ {TOPIC_EVENT_HFP_PHONE_ACTIVE, PRIORITY_ONE},
+ {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},
+ {TOPIC_EVENT_CAT1_CALLENDED, PRIORITY_ONE},
+ {TOPIC_EVENT_CAT1_CALLDIAL,PRIORITY_ONE},
+ {TOPIC_EVENT_CAT1_SIGNAL_UPDATE, PRIORITY_ONE},
+ {TOPIC_EVENT_CAT1_POWER_ON, PRIORITY_ONE},
+ {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},
+
+ #ifdef SUPPORT_CYWEE_SERVICE
+ // {TOPIC_EVENT_ACTIVITY_UPDATE,PRIORITY_TWO},
+ // {TOPIC_EVENT_ACTIVITY_EXTRA_INFO_UPDATE,PRIORITY_TWO},
+ {TOPIC_EVENT_AR_ALERT_TYPE_UPDATE,PRIORITY_TWO},
+ {TOPIC_EVENT_INACTIVITY_UPDATE,PRIORITY_TWO},
+ // {TOPIC_EVENT_INACTIVITY_ACCUMULATE_TIME_UPDATE,PRIORITY_TWO},
+ #endif
+ {TOPIC_EVENT_GOAL_SHOW_VIEW,PRIORITY_TWO},
+ {TOPIC_EVENT_STEPDATA_UPDATE,PRIORITY_TWO},
+
+
+ {TOPIC_EVENT_BLE_TRAINING,PRIORITY_TWO},
+ {TOPIC_EVENT_BLE_TRANSMIT,PRIORITY_ONE},
+
+ {TOPIC_EVENT_CHARGE_PLUG, PRIORITY_TWO},
+ {TOPIC_EVENT_CHARGE_UNPLUG, PRIORITY_TWO},
+ {TOPIC_EVENT_LOWPOWER_ALARM,PRIORITY_TWO},
+
+ {TOPIC_EVENT_DEVICE_BIND, PRIORITY_ONE},
+ {TOPIC_EVENT_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;
+ bool g_longPressFlag = false;
+
+ static bool CheckPriority(const Topic topic)
+ {
+ uint16_t mapperSize = sizeof(PRI_MAPPER) / sizeof(PRI_MAPPER[0]);
+ for (uint16_t i = 0; i < mapperSize; i++) {
+ if (topic == PRI_MAPPER[i].topicId) {
+ if (PRI_MAPPER[i].prId <= OHOS::NativeAbility::GetInstance().GetCurSlicePriority() &&
+ PRI_MAPPER[i].prId <= OHOS::NotificationManager::GetInstance()->GetNotifyPriority()) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ }
+ return false;
+ }
+
+ /* 订阅事件可定制 */
+ 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_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);
+ MsgCenterSubscribeTopic(TOPIC_EVENT_GOAL_SHOW_VIEW);
+ MsgCenterSubscribeTopic(TOPIC_EVENT_CHARGE_PLUG);
+ MsgCenterSubscribeTopic(TOPIC_EVENT_CHARGE_UNPLUG);
+ MsgCenterSubscribeTopic(TOPIC_EVENT_LOWPOWER_ALARM);
+ #ifdef SUPPORT_CAT1_MODEM
+ MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_INCOMMING);
+ MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_CALLCONNTED);
+ MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_CALLENDED);
+ MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_CALLDIAL);
+ // MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_SIGNAL_UPDATE);
+ // MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_POWER_ON);
+ // MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_POWER_OFF);
+ MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_CALL_FAIL);
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存每小时燃脂数据");
- cywee_fat_history_save(time->value);
- // 保存完增加一次读取数据
-#endif
- SendMsgToUIService(UI_UPDATE_GOAL, 0, nullptr, 0);
-}
-//设备绑定通知
-void MsgCenterNotifyDeviceBindProc(const Topic topic, Request* req)
-{
- #ifdef SUPPORT_BLE_SERVICE
- //unused(req);
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyBindProc Bind!");
- // 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();
- // }
- uint8_t* data=(uint8_t*)req->data;
- /* 安全:固定上限 + 显式终止 */
- const size_t kMaxDevName = 64;
- char devname[kMaxDevName + 1] = {0};
- if (data != NULL && req->len >= 2)
- {
- switch(data[0])
- {
- case DEVICEBIND:
- NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
- {
- /* 设备名在 payload[2..],长度为 req->len-2,做边界裁剪并追加'\0' */
- size_t name_len = (req->len > 2) ? (size_t)req->len - 2 : 0;
- if (name_len > 0)
- {
- size_t copy_len = (name_len > kMaxDevName) ? kMaxDevName : name_len;
- (void)memcpy_s(devname, sizeof(devname), (const char*)req->data + 2, copy_len);
- devname[copy_len] = '\0';
- PairingViewEventListener::GetInstance().SetDeviceName(devname);
- }
- else
- {
- PairingViewEventListener::GetInstance().SetDeviceName(NULL);
- }
- }
- if(NotificationManager::GetInstance()->HasNotifyShowing())
- {
- NotificationManager::GetInstance()->StopNotify();
- }
- NotificationManager::GetInstance()->ShowNotify(showDeviceBindingNotify, (uint16_t)topic, true);
- break;
- case DEVICEUNBIND:
-
- NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
- {
- size_t name_len = (req->len > 2) ? (size_t)req->len - 2 : 0;
- if (name_len > 0)
- {
- size_t copy_len = (name_len > kMaxDevName) ? kMaxDevName : name_len;
- (void)memcpy_s(devname, sizeof(devname), (const char*)req->data + 2, copy_len);
- devname[copy_len] = '\0';
- PairingViewEventListener::GetInstance().SetDeviceName(devname);
- }
- else
- {
- PairingViewEventListener::GetInstance().SetDeviceName(NULL);
- }
- }
- NotificationManager::GetInstance()->ShowNotify(showDeviceUnBindingNotify, (uint16_t)topic, true);
- break;
- case DeviceUnBindingRequest:
- NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
- NotificationManager::GetInstance()->ShowNotify(showDeviceUnbindingRequestNotify, (uint16_t)topic, true);
- break;
- case SHUTDOWN:
- 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_play(true);
- break;
- case REBOOT:
- 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_play(false);
- break;
-
- default:
- break;
- }
-
- }
- #endif
-}
-
-
-
-void MsgCenterNotifybleTransmit(const Topic topic, Request* req)
-{
- #ifdef SUPPORT_BLE_SERVICE
- unused(topic);
- uint8_t* data=(uint8_t*)req->data;
-
+ #endif
+ MsgCenterSubscribeTopic(TOPIC_EVENT_DEVICE_BIND);
+ MsgCenterSubscribeTopic(TOPIC_EVENT_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)
+ {
+ return OHOS::CreateAlarmView();
+ }
+
+ static OHOS::UIViewGroup* ShowPhoneCallNotify(void)
+ {
+ return OHOS::CreatePhoneCallView();
+ }
+
+ static OHOS::UIViewGroup* ShowCallingNotify(void)
+ {
+ return OHOS::CreateCallingView();
+ }
+
+ static OHOS::UIViewGroup* ShowMultiPhoneCallNotify(void)
+ {
+ return OHOS::CreateMultiplePhoneView();
+ }
+
+
+ /*显示绑定通知*/
+ static OHOS::UIViewGroup* showDeviceBindingNotify(void)
+ {
+ return OHOS::CreateDeviceBindingView();
+ }
+
+ /*显示解绑通知*/
+ static OHOS::UIViewGroup* showDeviceUnBindingNotify(void)
+ {
+ return OHOS::CreateDeviceUnBindingView();
+ }
+
+ /*显示解除绑定请求(与新设备连接)通知*/
+ static OHOS::UIViewGroup* showDeviceUnbindingRequestNotify(void)
+ {
+ return OHOS::CreateDeviceUnbindingRequestGroupView();
+ }
+
+ /*显示低电量通知*/
+ static OHOS::UIViewGroup* showlowpowerNotify(void)
+ {
+ return OHOS::lowPowerShow();
+ }
+
+ static OHOS::UIViewGroup* ShowChargeingNotify(void)
+ {
+ return OHOS::ShowChargeingView();
+ }
+
+
+ static OHOS::UIViewGroup* showFindWatchNotify(void)
+ {
+ return OHOS::CreateFindWatchView();
+ }
+
+ /*显示喝水提醒视图*/
+ static OHOS::UIViewGroup* showDrinkReminderNotify(void)
+ {
+ return OHOS::CreateDrinkReminderView();
+ }
+
+ /*显示久坐提醒视图*/
+ static OHOS::UIViewGroup* showSedentaryReminderNotify(void)
+ {
+ return OHOS::CreateSedentaryReminderView();
+ }
+
+ /*显示运动识别视图*/
+ static OHOS::UIViewGroup* showMotionRecognitionNotify(void)
+ {
+ return OHOS::CreateMotionRecognitionView();
+ }
+
+ /*显示传输中*/
+ static OHOS::UIViewGroup* showtransmitNotify(void)
+ {
+ return OHOS::transmittingShow();
+ }
+
+ //关机动画
+ static OHOS::UIViewGroup* showShutdownAnimatorNotify(void)
+ {
+ return OHOS::showShutDownAnimation();
+ }
+ //无法呼叫sos
+ static OHOS::UIViewGroup* showSOSNotify(void)
+ {
+ 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)
+ {
+ return OHOS::CALL_INCOMING_HINT();
+ }
+
+ static OHOS::UIViewGroup* showDebugOutputNotify(void)
+ {
+ return OHOS::CreateDebugOutputMainView();
+ }
+
+
+ static OHOS::UIViewGroup* showcallfailNotify(void)
+ {
+ return OHOS::CALL_FAIL_HINT();
+ }
+
+ static OHOS::UIViewGroup* showCat1UpdataNotify(void)
+ {
+ // return OHOS::Cat1PythonUpdataShow();
+ }
+
+
+ void MsgCenterNotifyAlarmProc(const Topic topic, Request* req)
+ {
+ unused(req);
+ // The alarm notification is not displayed if the incoming call notification is already being processed
+ if (CheckPriority(topic)) {
+ // AlarmClockModel::GetInstance()->PopInterPlayMusic();
+ // AlarmViewEventListener::GetInstance()->PopAlarmRing();
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
+ NotificationManager::GetInstance()->ShowNotify(ShowAlarmNotify, static_cast<uint16_t>(topic), true);
+ } else {
+ // just delay the alarm
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "just delay the alarm");
+ // AlarmClockModel::GetInstance()->AlarmGetClockNum();
+ // AlarmPopUpPresenter::GetInstance()->DelayAlarmRing();
+ AlarmViewEventListener::GetInstance()->DelayAlarmRing();
+ }
+ }
+ /*NextDay*/
+ void MsgCenterNotifyNextDayProc(const Topic topic, Request *req)
+ {
+ unused(topic);
+ unused(req);
+ AlarmClockModel::GetInstance()->NextDayNotify();
+ // current_year = 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()));
+ }
+ 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");
+ /* ---------------------------------- 呼吸训练相关 ---------------------------------- */
+ RespiratoryTrainingModel::GetInstance().ClearTotalRespiratoryTrainingTime();
+
+ // 存储nextday执行日志
+ start_report_nextday_log_end();
+ // 清除popup_windows日志
+ nextday_clear_popup_windows_log();
+
+ printf("******nextday is end******\r\n");
+ #ifdef SUPPORT_CYWEE_SERVICE
+ /* --------------------------------- 每日目标相关 --------------------------------- */
+ cywee_reset_history_daily_data(); //清除运动相关数据
+
+ // 午夜清除运动数据
+ for(int i=1;i<6;i++)
+ {
+ set_Is_show_flag(1,i);
+ }
- if(data[0]==TRANS_FREE)
- {
- if(transmittingISShow())
- NotificationManager::GetInstance()->StopNotify();
- }
- else if (data[0]==IS_NEED_CAT1_OTA)
- {
-
- NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
-
- // NotificationManager::GetInstance()->ShowNotify(showCat1UpdataNotify, (uint16_t)topic, true);
- }
- else if (data[0]==FILE_IS_DONE)
- {
- set_transmittingShow_falg(data[0]);
- }
- else
- {
- set_transmittingShow_falg(data[0]);
+ do_cywee_service_check_msg(CYWEE_SERVICE_CMD_RESET_DAILY_DATA, NULL);
+
+ // SendMsgToUIService(UI_UPDATE_GOAL, 0, nullptr, 0);
+ printf("sport end\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);
+ AlarmClockEventData* time=(AlarmClockEventData*)req->data;
+ #ifdef SUPPORT_CYWEE_SERVICE
+
+ cywee_save_data(); //暂时没有这个函数
+
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存每小时步数");
+ cywee_step_history_save(time->value);
+
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存每小时站立数据");
+ if(cywee_get_stand_flag())
+ cywee_stand_history_save(time->value);
+
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存每小时卡路里数据");
+ cywee_calories_history_save(time->value);
+
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存每小时距离数据");
+ cywee_distances_history_save(time->value);
+
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存每小时燃脂数据");
+ cywee_fat_history_save(time->value);
+ // 保存完增加一次读取数据
+ SendMsgToUIService(UI_UPDATE_GOAL, 0, nullptr, 0);
+ #endif
+ }
+ //设备绑定通知
+ void MsgCenterNotifyDeviceBindProc(const Topic topic, Request* req)
+ {
+ #ifdef SUPPORT_BLE_SERVICE
+ //unused(req);
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyBindProc Bind!");
+ // 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();
+ // }
+ uint8_t* data=(uint8_t*)req->data;
+ /* 安全:固定上限 + 显式终止 */
+ const size_t kMaxDevName = 64;
+ char devname[kMaxDevName + 1] = {0};
+ if (data != NULL && req->len >= 2)
+ {
+ switch(data[0])
+ {
+ case DEVICEBIND:
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
+ {
+ /* 设备名在 payload[2..],长度为 req->len-2,做边界裁剪并追加'\0' */
+ size_t name_len = (req->len > 2) ? (size_t)req->len - 2 : 0;
+ if (name_len > 0)
+ {
+ size_t copy_len = (name_len > kMaxDevName) ? kMaxDevName : name_len;
+ (void)memcpy_s(devname, sizeof(devname), (const char*)req->data + 2, copy_len);
+ devname[copy_len] = '\0';
+ PairingViewEventListener::GetInstance().SetDeviceName(devname);
+ }
+ else
+ {
+ PairingViewEventListener::GetInstance().SetDeviceName(NULL);
+ }
+ }
+ if(NotificationManager::GetInstance()->HasNotifyShowing())
+ {
+ NotificationManager::GetInstance()->StopNotify();
+ }
+ NotificationManager::GetInstance()->ShowNotify(showDeviceBindingNotify, (uint16_t)topic, true);
+ break;
+ case DEVICEUNBIND:
+
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
+ {
+ size_t name_len = (req->len > 2) ? (size_t)req->len - 2 : 0;
+ if (name_len > 0)
+ {
+ size_t copy_len = (name_len > kMaxDevName) ? kMaxDevName : name_len;
+ (void)memcpy_s(devname, sizeof(devname), (const char*)req->data + 2, copy_len);
+ devname[copy_len] = '\0';
+ PairingViewEventListener::GetInstance().SetDeviceName(devname);
+ }
+ else
+ {
+ PairingViewEventListener::GetInstance().SetDeviceName(NULL);
+ }
+ }
+ NotificationManager::GetInstance()->ShowNotify(showDeviceUnBindingNotify, (uint16_t)topic, true);
+ break;
+ case DeviceUnBindingRequest:
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
+ NotificationManager::GetInstance()->ShowNotify(showDeviceUnbindingRequestNotify, (uint16_t)topic, true);
+ break;
+ case SHUTDOWN:
+ 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_play(true);
+ break;
+ case REBOOT:
+ 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_play(false);
+ break;
+
+ default:
+ break;
+ }
- NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
-
- NotificationManager::GetInstance()->ShowNotify(showtransmitNotify, (uint16_t)topic, true);
- }
- // unused(req);
- #endif
-}
-
-void MsgCenterNotifyChargePlugProc(const Topic topic, Request* req)
-{
- #ifdef SUPPORT_BATTERY_SERVICE
- unused(req);
- WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyProc:: CHarger Plug !");
-#ifdef SYSTEM_LOG_SERVICE
- uapi_save_runtime_log(RUNTIME_LOG_CHARGE_START);//充电开始事件
-#endif
- 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();
- }
-
- if(PullUpDownView::GetInstance())
- {
- GraphicService::GetInstance()->PostGraphicEvent(std::bind(&OHOS::PullUpDownView::UpdateBatteryProcess, OHOS::PullUpDownView::GetInstance() ));
- }
-#if DIALDATASET
- // DialModelCharge::GetInstance()->UpdatechargeStatus(1);
- setChargeStatus(1);
-#endif
- SaveEleModel::GetInstance()->SetChargeStatus(true);
-
- if (uapi_dev_runtime_get_train_status())
- {
- WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyProc:: CHarger Plug ! but train status is true");
- return ;
- }
-
+ }
+ #endif
+ }
+
+
+
+ void MsgCenterNotifybleTransmit(const Topic topic, Request* req)
+ {
+ #ifdef SUPPORT_BLE_SERVICE
+ unused(topic);
+ uint8_t* data=(uint8_t*)req->data;
- if(IsTestCHANGINGViewCreated())
- {
- ChangeViewcolorC(1);
- }
- else
- {
- if (CheckPriority(topic) && !uapi_dev_runtime_get_factory_test_status_flag()) //产测模式不弹充电弹窗
- {
- NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
- NotificationManager::GetInstance()->ShowNotify(ShowChargeingNotify, (uint16_t)topic, true);
- }
- }
- #endif
-}
-
-/*充电器已拔掉*/
-void MsgCenterNotifyChargeUnPlugProc(const Topic topic, Request* req)
-{
- #ifdef SUPPORT_BATTERY_SERVICE
- unused(req);
- unused(topic);
- WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyProc:: CHarger UnPlug !");
-#ifdef SYSTEM_LOG_SERVICE
- //充电停止事件
- uapi_save_runtime_log(RUNTIME_LOG_CHARGE_STOP);//TOOD*
-#endif
- if(PullUpDownView::GetInstance())
- {
- GraphicService::GetInstance()->PostGraphicEvent(std::bind(&OHOS::PullUpDownView::UpdateBatteryProcess, OHOS::PullUpDownView::GetInstance() ));
- }
-#if DIALDATASET
- // DialModelCharge::GetInstance()->UpdatechargeStatus(0);
- setChargeStatus(0);
-#endif
- SaveEleModel::GetInstance()->SetChargeStatus(false);
-
-
- if(IsTestCHANGINGViewCreated())
- {
- ChangeViewcolorC(0);
- }
- else
- {
- if(is_UIViewGroup_charge())
- {
- NotificationManager::GetInstance()->StopNotify();
- }
- }
-#endif
-}
-
-/*低电量提醒*/
-void MsgCenterNotifyLowPowerAlarmProc(const Topic topic, Request* req)
-{
- WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyProc:: LowPower Alarm !");
- #if 0
- uint8 *x= (uint8 *)(req->data);
- const power_display_svr_api_t *display_api = power_display_svr_get_api();
-
- if(*x==3)
- {
- if (display_api->get_screen_state() != SCREEN_ON)
- {
- display_api->turn_on_screen();
- }
- display_api->set_screen_set_keepon_timeout(1000*5);
- //倒计时结束后,直接执行关机动画
- low_power_play();
- }
- else if(*x==0)
- {
- //提醒低电充电
+
+ if(data[0]==TRANS_FREE)
+ {
+ if(transmittingISShow())
+ NotificationManager::GetInstance()->StopNotify();
+ }
+ else if (data[0]==IS_NEED_CAT1_OTA)
+ {
+
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
+
+ // NotificationManager::GetInstance()->ShowNotify(showCat1UpdataNotify, (uint16_t)topic, true);
+ }
+ else if (data[0]==FILE_IS_DONE)
+ {
+ set_transmittingShow_falg(data[0]);
+ }
+ else
+ {
+ set_transmittingShow_falg(data[0]);
+
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
+
+ NotificationManager::GetInstance()->ShowNotify(showtransmitNotify, (uint16_t)topic, true);
+ }
+ // unused(req);
+ #endif
+ }
+
+ void MsgCenterNotifyChargePlugProc(const Topic topic, Request* req)
+ {
+ #ifdef SUPPORT_BATTERY_SERVICE
+ unused(req);
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyProc:: CHarger Plug !");
+ #ifdef SYSTEM_LOG_SERVICE
+ uapi_save_runtime_log(RUNTIME_LOG_CHARGE_START);//充电开始事件
+ #endif
+ 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();
+ }
+
+ if(PullUpDownView::GetInstance())
+ {
+ GraphicService::GetInstance()->PostGraphicEvent(std::bind(&OHOS::PullUpDownView::UpdateBatteryProcess, OHOS::PullUpDownView::GetInstance() ));
+ }
+ #if DIALDATASET
+ // DialModelCharge::GetInstance()->UpdatechargeStatus(1);
+ setChargeStatus(1);
+ #endif
+ SaveEleModel::GetInstance()->SetChargeStatus(true);
+
+ if (uapi_dev_runtime_get_train_status())
+ {
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyProc:: CHarger Plug ! but train status is true");
+ return ;
+ }
+
+
+ if(IsTestCHANGINGViewCreated())
+ {
+ ChangeViewcolorC(1);
+ }
+ else
+ {
+ if (CheckPriority(topic) && !uapi_dev_runtime_get_factory_test_status_flag()) //产测模式不弹充电弹窗
+ {
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
+ NotificationManager::GetInstance()->ShowNotify(ShowChargeingNotify, (uint16_t)topic, true);
+ }
+ }
+ #endif
+ }
+
+ /*充电器已拔掉*/
+ void MsgCenterNotifyChargeUnPlugProc(const Topic topic, Request* req)
+ {
+ #ifdef SUPPORT_BATTERY_SERVICE
+ unused(req);
+ unused(topic);
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyProc:: CHarger UnPlug !");
+ #ifdef SYSTEM_LOG_SERVICE
+ //充电停止事件
+ uapi_save_runtime_log(RUNTIME_LOG_CHARGE_STOP);//TOOD*
+ #endif
+ if(PullUpDownView::GetInstance())
+ {
+ GraphicService::GetInstance()->PostGraphicEvent(std::bind(&OHOS::PullUpDownView::UpdateBatteryProcess, OHOS::PullUpDownView::GetInstance() ));
+ }
+ #if DIALDATASET
+ // DialModelCharge::GetInstance()->UpdatechargeStatus(0);
+ setChargeStatus(0);
+ #endif
+ SaveEleModel::GetInstance()->SetChargeStatus(false);
+
+
+ if(IsTestCHANGINGViewCreated())
+ {
+ ChangeViewcolorC(0);
+ }
+ else
+ {
+ if(is_UIViewGroup_charge())
+ {
+ NotificationManager::GetInstance()->StopNotify();
+ }
+ }
+ #endif
+ }
+
+ /*低电量提醒*/
+ void MsgCenterNotifyLowPowerAlarmProc(const Topic topic, Request* req)
+ {
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyProc:: LowPower Alarm !");
+ #if 0
+ uint8 *x= (uint8 *)(req->data);
+ const power_display_svr_api_t *display_api = power_display_svr_get_api();
+
+ if(*x==3)
+ {
if (display_api->get_screen_state() != SCREEN_ON)
- {
- display_api->turn_on_screen();
- }
- display_api->set_screen_set_keepon_timeout(1000*5);
-
- set_lowpower_falg(0);
- if (CheckPriority(topic))
- {
- NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
- NotificationManager::GetInstance()->ShowNotify(showlowpowerNotify, (uint16_t)topic, true);
- }
- }
- else
- {
- //电量过低,直接提醒关机
- if (display_api->get_screen_state() != SCREEN_ON)
- {
- display_api->turn_on_screen();
- }
- display_api->set_screen_set_keepon_timeout(1000*10);
-
- set_lowpower_falg(1);
- if (NotificationManager::GetInstance()->HasNotifyShowing())
- NotificationManager::GetInstance()->StopNotify();
- if (CheckPriority(topic))
- {
- NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
- NotificationManager::GetInstance()->ShowNotify(showlowpowerNotify, (uint16_t)topic, true);
- }
- }
-
- #endif
- }
- //TODO: 亮屏弹窗倒计时5秒关机(不需要取消,强制关机)
- // DialModelCharge::GetInstance()->UpdatechargeStatus(0);
- // SaveEleModel::GetInstance()->SetChargeStatus(0);
-
- // testCHANINGView *t=testCHANINGView::GetInstance();
- // if(t!=NULL)
- // {
- // t->ChangeViewcolor(false);
- // }
-
-#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<uint16_t>(topic), true);
- } else {
- NotificationManager::GetInstance()->ShowNotify(ShowCallingNotify, static_cast<uint16_t>(topic), true);
- }
- NotificationManager::GetInstance()->SetWatchCallStatus(true);
- }
-}
-
-void MsgCenterNotifyHfpWatchHintProc(const Topic topic, Request* req)
-{
- unused(req);
-
- phone_VibratorFunc();
-
- if(NotificationManager::GetInstance()->HasNotifyShowing())
- NotificationManager::GetInstance()->StopNotify();
-
- NotificationManager::GetInstance()->ShowNotify(showcallhintNotify,
- static_cast<uint16_t>(topic), true);
-}
-
-//来电处理函数
-void MsgCenterNotifyCatIncomingCallProc(const Topic topic, Request* req)
-{
- unused(topic);
- unused(topic);
- if (req == NULL) return ;
- char* call_data = (char*)malloc(req->len);
- if(call_data==NULL)
- {
- return;
- }
- int32 ret = memcpy_s(call_data, req->len, 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.
-
- if(NotificationManager::GetInstance()->GetWatchCallStatus() &&
- (CallerLogModel::GetInstance()->GetCallSource()==CallerLogModel::CallSourceCat1))
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OPERATE_WATCH_REJECT %s!=%s??",call_data,CallerLogModel::GetInstance()->GetPhoneNumber().c_str());
- CallerLogModel::GetInstance()->tempSetoperateNumberCAT1END(call_data,req->len);
- cat1_phone_state_change_cb(OPERATE_WATCH_REJECT);
- free(call_data);
- return;
- }
-
- if((NotificationManager::GetInstance()->GetWatchCallStatus() &&
- (CallerLogModel::GetInstance()->GetCallSource()==CallerLogModel::CallSourcePhone)) || uapi_dev_runtime_get_train_status() || transmittingISShow())
- {
-
- CallerLogModel::GetInstance()->tempSetoperateNumberCAT1(call_data,req->len);
- cat1_phone_state_change_cb(OPERATE_WAITING);
- free(call_data);
- return;
- }
-
- stopPlayingMusic();
- PlayersModel::GetInstance()->HandPausePhoneMusic(); // 暂停手机音乐
- uapi_set_screen_on_api();
- phone_paly_ring();
-
- CallerLogModel::GetInstance()->SetoperateNumber(call_data,strlen(call_data));
+ {
+ display_api->turn_on_screen();
+ }
+ display_api->set_screen_set_keepon_timeout(1000*5);
+ //倒计时结束后,直接执行关机动画
+ low_power_play();
+ }
+ else if(*x==0)
+ {
+ //提醒低电充电
+ if (display_api->get_screen_state() != SCREEN_ON)
+ {
+ display_api->turn_on_screen();
+ }
+ display_api->set_screen_set_keepon_timeout(1000*5);
+
+ set_lowpower_falg(0);
+ if (CheckPriority(topic))
+ {
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
+ NotificationManager::GetInstance()->ShowNotify(showlowpowerNotify, (uint16_t)topic, true);
+ }
+ }
+ else
+ {
+ //电量过低,直接提醒关机
+ if (display_api->get_screen_state() != SCREEN_ON)
+ {
+ display_api->turn_on_screen();
+ }
+ display_api->set_screen_set_keepon_timeout(1000*10);
+
+ set_lowpower_falg(1);
+ if (NotificationManager::GetInstance()->HasNotifyShowing())
+ NotificationManager::GetInstance()->StopNotify();
+ if (CheckPriority(topic))
+ {
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
+ NotificationManager::GetInstance()->ShowNotify(showlowpowerNotify, (uint16_t)topic, true);
+ }
+ }
+
+ #endif
+ }
+ //TODO: 亮屏弹窗倒计时5秒关机(不需要取消,强制关机)
+ // DialModelCharge::GetInstance()->UpdatechargeStatus(0);
+ // SaveEleModel::GetInstance()->SetChargeStatus(0);
+
+ // testCHANINGView *t=testCHANINGView::GetInstance();
+ // if(t!=NULL)
+ // {
+ // t->ChangeViewcolor(false);
+ // }
+
+ #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<uint16_t>(topic), true);
+ } else {
+ NotificationManager::GetInstance()->ShowNotify(ShowCallingNotify, static_cast<uint16_t>(topic), true);
+ }
+ NotificationManager::GetInstance()->SetWatchCallStatus(true);
+ }
+ }
+
+ void MsgCenterNotifyHfpWatchHintProc(const Topic topic, Request* req)
+ {
+ unused(req);
+
+ phone_VibratorFunc();
+
+ if(NotificationManager::GetInstance()->HasNotifyShowing())
+ NotificationManager::GetInstance()->StopNotify();
+
+ NotificationManager::GetInstance()->ShowNotify(showcallhintNotify,
+ static_cast<uint16_t>(topic), true);
+ }
+
+ //来电处理函数
+ void MsgCenterNotifyCatIncomingCallProc(const Topic topic, Request* req)
+ {
+ unused(topic);
+ unused(topic);
+ if (req == NULL) return ;
+ char* call_data = (char*)malloc(req->len);
+ if(call_data==NULL)
+ {
+ return;
+ }
+ int32 ret = memcpy_s(call_data, req->len, 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.
+
+ if(NotificationManager::GetInstance()->GetWatchCallStatus() &&
+ (CallerLogModel::GetInstance()->GetCallSource()==CallerLogModel::CallSourceCat1))
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OPERATE_WATCH_REJECT %s!=%s??",call_data,CallerLogModel::GetInstance()->GetPhoneNumber().c_str());
+ CallerLogModel::GetInstance()->tempSetoperateNumberCAT1END(call_data,req->len);
+ cat1_phone_state_change_cb(OPERATE_WATCH_REJECT);
+ free(call_data);
+ return;
+ }
- cat1_phone_state_change_cb(OPERATE_INCOMING);
+ if((NotificationManager::GetInstance()->GetWatchCallStatus() &&
+ (CallerLogModel::GetInstance()->GetCallSource()==CallerLogModel::CallSourcePhone)) || uapi_dev_runtime_get_train_status() || transmittingISShow())
+ {
+
+ CallerLogModel::GetInstance()->tempSetoperateNumberCAT1(call_data,req->len);
+ cat1_phone_state_change_cb(OPERATE_WAITING);
+ free(call_data);
+ return;
+ }
+
+ stopPlayingMusic();
+ PlayersModel::GetInstance()->HandPausePhoneMusic(); // 暂停手机音乐
+ uapi_set_screen_on_api();
+ phone_paly_ring();
- }
- free(call_data);
-
-}
-//开始通话处理函数
-void MsgCenterNotifyCat1CallConnectedProc(const Topic topic, Request* req)
-{
- unused(topic);
- unused(req);
-
- if (req == NULL) return ;
- if(!NotificationManager::GetInstance()->GetWatchCallStatus())
- {
- return;
- }
- AlarmClockModel::GetInstance()->AlarmPlayerStop();
- #ifdef SUPPORT_CAT1_HFP_AG_SERV
- if(uapi_dev_runtime_get_earphone_connect_stat())
- {
+ CallerLogModel::GetInstance()->SetoperateNumber(call_data,strlen(call_data));
- if(headset_Is_connect())
- {
- if(headset_SCO_Is_connect()==false)
- {
- cat1_ag_send_call_event(TOPIC_EVENT_CAT1_INCOMMING,CallerLogModel::GetInstance()->GetPhoneNumber().c_str());
- }
- else
- {
- if(cat1_api_get_cat1_volte_voice_state()==0)
- do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT_HFP_SCO_AUDIO_START, nullptr, 0);
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "headset_Is_connect is false");
- }
+ cat1_phone_state_change_cb(OPERATE_INCOMING);
- }
- else
- {
- do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CONNECT_AG, nullptr, 0);
- }
- cat1_ag_send_call_event(TOPIC_EVENT_CAT1_CALLCONNTED,NULL);
- }
- else
- #endif
- {
- do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT1_AUDIO_START, nullptr, 0);
- }
- SetMicMutecat1(false);
- cat1_phone_state_change_cb(OPERATE_WATCH_ACTIVE);
-
-}
-#include "BluetoothModelC.h"
-#include "audio_manager_c_wrapper.h"
-#include "PhoneService.h"
-//拨号处理函数
-void MsgCenterNotifyCat1dialProc(const Topic topic, Request* req)
-{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MsgCenterNotify MsgCenterNotifyCat1dialProc");
- unused(topic);
- unused(req);
+ }
+ free(call_data);
+
+ }
+ //开始通话处理函数
+ void MsgCenterNotifyCat1CallConnectedProc(const Topic topic, Request* req)
+ {
+ unused(topic);
+ unused(req);
+
if (req == NULL) return ;
- char* call_data = (char*)malloc(req->len);
- if(call_data==NULL) return;
- int32 ret = memcpy_s(call_data, req->len, req->data, req->len);
- if (ret != EOK) {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MsgCenterNotify memcpy_s request data fail!");
- } else {
-
- // int ret = PlayersModel::GetInstance()->PlayerStop();
- stopPlayingMusic();
-
- if(strcmp(call_data,"SOS")==0)
- {
- free(call_data);
- NotificationManager::GetInstance()->ShowNotify(showSOSNotify, (uint16_t)topic, true);
- return;
- }
-
- cat1_cmd_send(CMD_4G_MAKE_CALL,call_data,strlen(call_data));
-
- CallerLogModel::GetInstance()->SetoperateNumber(call_data,req->len);
- cat1_phone_state_change_cb(OPERATE_DIALING);
-
- #ifdef SUPPORT_CAT1_HFP_AG_SERV
- if(uapi_dev_runtime_get_earphone_connect_stat())
- {
- if(headset_Is_connect())
- {
- cat1_ag_send_call_event(TOPIC_EVENT_CAT1_CALLDIAL,NULL);
-
- if(headset_SCO_Is_connect())
- {
- if(cat1_api_get_cat1_volte_voice_state()==0)
- do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT_HFP_SCO_AUDIO_START, nullptr, 0);
- }
- }
- else
- {
- do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CONNECT_AG, nullptr, 0);
- }
- }
- else
- #endif
- {
- do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT1_AUDIO_START, nullptr, 0);
- }
-
- }
- free(call_data);
-}
-//电话结束处理函数
-void MsgCenterNotifyCat1CallEndedProc(const Topic topic, Request* req)
-{
- unused(topic);
- unused(req);
-
- // just stop the notify
- AlarmClockModel::GetInstance()->AlarmPlayerStop();
-
-
- if(!NotificationManager::GetInstance()->GetWatchCallStatus())
- {
- return;
- }
-
- if (req == NULL) return ;
- char* call_data = (char*)malloc(req->len);
-
- if(call_data==NULL)
- {
- return;
- }
- int32 ret = memcpy_s(call_data, req->len, req->data, req->len);
-
- if(strcmp("callfail",call_data)==0)
- {
-
- // cat1_call_hungup();
- cat1_phone_state_change_cb(OPERATE_WATCH_FINISH);
- CustomEventPublish(TOPIC_EVENT_CAT1_CALL_FAIL,NULL,0);
-
- free(call_data);
- return;
- }
-
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s %s",call_data,CallerLogModel::GetInstance()->GetPhoneNumber().c_str());
- uint8_t offset_watch =0;
- if(CallerLogModel::GetInstance()->GetPhoneNumber().c_str()[0]=='+')
- {
- offset_watch++;
- }
-
- uint8_t offset_call =0;
- if(call_data[0]=='+')
- {
- offset_call++;
- }
-
- if(strcmp(CallerLogModel::GetInstance()->GetPhoneNumber().c_str()+offset_watch,call_data+offset_call)!=0 &&
- CallerLogModel::GetInstance()->GetCallSource()==CallerLogModel::CallSourceCat1)
- {
-
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "no OPERATE_WATCH_FINISH");
- #ifdef SUPPORT_CAT1_HFP_AG_SERV
- cat1_ag_send_call_event(TOPIC_EVENT_CAT1_CALLENDED,NULL);
- #endif
- }
- else
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OPERATE_WATCH_FINISH");
- cat1_phone_state_change_cb(OPERATE_WATCH_FINISH);
- #ifdef SUPPORT_CAT1_HFP_AG_SERV
-
- #endif
- }
-
- free(call_data);
+ if(!NotificationManager::GetInstance()->GetWatchCallStatus())
+ {
+ return;
+ }
+ AlarmClockModel::GetInstance()->AlarmPlayerStop();
+ #ifdef SUPPORT_CAT1_HFP_AG_SERV
+ if(uapi_dev_runtime_get_earphone_connect_stat())
+ {
+
+ if(headset_Is_connect())
+ {
+ if(headset_SCO_Is_connect()==false)
+ {
+ cat1_ag_send_call_event(TOPIC_EVENT_CAT1_INCOMMING,CallerLogModel::GetInstance()->GetPhoneNumber().c_str());
+ }
+ else
+ {
+ if(cat1_api_get_cat1_volte_voice_state()==0)
+ do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT_HFP_SCO_AUDIO_START, nullptr, 0);
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "headset_Is_connect is false");
+ }
+
+ }
+ else
+ {
+ do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CONNECT_AG, nullptr, 0);
+ }
+ cat1_ag_send_call_event(TOPIC_EVENT_CAT1_CALLCONNTED,NULL);
+ }
+ else
+ #endif
+ {
+ do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT1_AUDIO_START, nullptr, 0);
+ }
+ SetMicMutecat1(false);
+ cat1_phone_state_change_cb(OPERATE_WATCH_ACTIVE);
+
+ }
+ #include "BluetoothModelC.h"
+ #include "audio_manager_c_wrapper.h"
+ #include "PhoneService.h"
+ //拨号处理函数
+ void MsgCenterNotifyCat1dialProc(const Topic topic, Request* req)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MsgCenterNotify MsgCenterNotifyCat1dialProc");
+ unused(topic);
+ unused(req);
+ if (req == NULL) return ;
+ char* call_data = (char*)malloc(req->len);
+ if(call_data==NULL) return;
+ int32 ret = memcpy_s(call_data, req->len, req->data, req->len);
+ if (ret != EOK) {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MsgCenterNotify memcpy_s request data fail!");
+ } else {
+
+ // int ret = PlayersModel::GetInstance()->PlayerStop();
+ stopPlayingMusic();
+
+ if(strcmp(call_data,"SOS")==0)
+ {
+ free(call_data);
+ NotificationManager::GetInstance()->ShowNotify(showSOSNotify, (uint16_t)topic, true);
+ return;
+ }
+
+ cat1_cmd_send(CMD_4G_MAKE_CALL,call_data,strlen(call_data));
+
+ CallerLogModel::GetInstance()->SetoperateNumber(call_data,req->len);
+ cat1_phone_state_change_cb(OPERATE_DIALING);
+
+ #ifdef SUPPORT_CAT1_HFP_AG_SERV
+ if(uapi_dev_runtime_get_earphone_connect_stat())
+ {
+ if(headset_Is_connect())
+ {
+ cat1_ag_send_call_event(TOPIC_EVENT_CAT1_CALLDIAL,NULL);
+
+ if(headset_SCO_Is_connect())
+ {
+ if(cat1_api_get_cat1_volte_voice_state()==0)
+ do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT_HFP_SCO_AUDIO_START, nullptr, 0);
+ }
+ }
+ else
+ {
+ do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CONNECT_AG, nullptr, 0);
+ }
+ }
+ else
+ #endif
+ {
+ do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT1_AUDIO_START, nullptr, 0);
+ }
-}
-
-void MsgCenterNotifyCat1FailEProc(const Topic topic, Request* req)
-{
- unused(req);
-
- phone_VibratorFunc();
-
- if(NotificationManager::GetInstance()->HasNotifyShowing())
- NotificationManager::GetInstance()->StopNotify();
-
- NotificationManager::GetInstance()->ShowNotify(showcallfailNotify,
- static_cast<uint16_t>(topic), true);
-}
-#endif
-
-
-
-#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<uint16_t>(topic), true);
- }
- #endif
-
- }
+ }
+ free(call_data);
+ }
+ //电话结束处理函数
+ void MsgCenterNotifyCat1CallEndedProc(const Topic topic, Request* req)
+ {
+ unused(topic);
+ unused(req);
- }
- 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() ));
- }
-
- if(OHOS::GoalModel::GetInstance().getstepvalue()>=100)
- {
-
- 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);
- }
- }
- }
-
- 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(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);
- }
- }
- }
-
- 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
- }
-
- }
-
-#endif
-
-#ifdef SUPPORT_CYWEE_SERVICE
-
- // //每日训练数据刷新
- // 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);
- // }
+ // just stop the notify
+ AlarmClockModel::GetInstance()->AlarmPlayerStop();
+
+
+ if(!NotificationManager::GetInstance()->GetWatchCallStatus())
+ {
+ return;
+ }
+
+ if (req == NULL) return ;
+ char* call_data = (char*)malloc(req->len);
+
+ if(call_data==NULL)
+ {
+ return;
+ }
+ int32 ret = memcpy_s(call_data, req->len, req->data, req->len);
+
+ if(strcmp("callfail",call_data)==0)
+ {
+
+ // cat1_call_hungup();
+ cat1_phone_state_change_cb(OPERATE_WATCH_FINISH);
+ CustomEventPublish(TOPIC_EVENT_CAT1_CALL_FAIL,NULL,0);
+
+ free(call_data);
+ return;
+ }
+
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s %s",call_data,CallerLogModel::GetInstance()->GetPhoneNumber().c_str());
+ uint8_t offset_watch =0;
+ if(CallerLogModel::GetInstance()->GetPhoneNumber().c_str()[0]=='+')
+ {
+ offset_watch++;
+ }
+
+ uint8_t offset_call =0;
+ if(call_data[0]=='+')
+ {
+ offset_call++;
+ }
+
+ if(strcmp(CallerLogModel::GetInstance()->GetPhoneNumber().c_str()+offset_watch,call_data+offset_call)!=0 &&
+ CallerLogModel::GetInstance()->GetCallSource()==CallerLogModel::CallSourceCat1)
+ {
- // 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;
- // }
-
-/*运动识别*/
-void MsgCenterNotifyArAlertProc(const Topic topic, Request* req)
-{
- uint8_t* motionType=(uint8_t*)req->data;
- WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyArAlertProc,motionType = %d !",*motionType);
- MotionRecognitionViewEventListener::GetInstance().record_motion_recognition_log();
- if(*motionType > 5 || *motionType <1) //未知运动不弹窗
- {
- return;
- }
- if (CheckPriority(topic))
- {
- MotionRecognitionViewEventListener::GetInstance().SetMotionTypeId(*motionType);
- NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
- NotificationManager::GetInstance()->ShowNotify(showMotionRecognitionNotify, (uint16_t)topic, true);
- }
-
-}
-
-void MsgCenterNotifyInactivityProc(const Topic topic, Request *req)
-{
- WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyInactivityProc !");
-
- inact_result_t *cywee_Inactivity_Info = (inact_result_t *)malloc(req->len);
- if (!cywee_Inactivity_Info)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Memory allocation failure");
- return;
- }
-
- int rets = memcpy_s(cywee_Inactivity_Info, req->len, (inact_result_t*)req->data, req->len);
- if (rets != EOK)
- {
- free(cywee_Inactivity_Info);
- cywee_Inactivity_Info = NULL;
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "memcpy_s cywee_inactivity_result_t failed, ret = %d", rets);
- return;
- }
-
- WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "cywee_Inactivity_Info->output_number = %d", cywee_Inactivity_Info->output_number);
-
- switch (cywee_Inactivity_Info->output_number)
- {
- case INACTIVITY_MODE_SEDENTARY_OUTPUT:
- if(cywee_Inactivity_Info->status == 1)
- {
- SedentaryReminderViewEventListener::GetInstance().record_sedentary_reminder_log();
- if (CheckPriority(topic))
- {
- NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
- NotificationManager::GetInstance()->ShowNotify(showSedentaryReminderNotify, (uint16_t)topic, true);
- }
- }
- else if(cywee_Inactivity_Info->status==9)
- {
- cywee_set_stand_flag();
- }
- break;
- default:
- break;
- }
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "no OPERATE_WATCH_FINISH");
+ #ifdef SUPPORT_CAT1_HFP_AG_SERV
+ cat1_ag_send_call_event(TOPIC_EVENT_CAT1_CALLENDED,NULL);
+ #endif
+ }
+ else
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OPERATE_WATCH_FINISH");
+ cat1_phone_state_change_cb(OPERATE_WATCH_FINISH);
+ #ifdef SUPPORT_CAT1_HFP_AG_SERV
+
+ #endif
+ }
+
+ free(call_data);
+
+ }
+
+ void MsgCenterNotifyCat1FailEProc(const Topic topic, Request* req)
+ {
+ unused(req);
+
+ phone_VibratorFunc();
+
+ if(NotificationManager::GetInstance()->HasNotifyShowing())
+ NotificationManager::GetInstance()->StopNotify();
+
+ NotificationManager::GetInstance()->ShowNotify(showcallfailNotify,
+ static_cast<uint16_t>(topic), true);
+ }
+ #endif
+
+ //每日活动
+ void MsgCenterNotifygoalnotificationviewProc(const Topic topic, Request* req)
+ {
+ unused(req);
+ if (CheckPriority(topic)) {
+
+ uint8_t* data=(uint8_t*)req->data;
+
+ if(get_Is_show_flag(data[0]))
+ {
+ set_goal_flag_view(data[0]);
+ set_Is_show_flag(0,data[0]);
+
+ uapi_set_screen_on_api();
+
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
+ NotificationManager::GetInstance()->ShowNotify(ShowGoalNotify, static_cast<uint16_t>(topic), true);
+ }
+
+ }
+
+ }
+ 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;
+ }
+ // 计步数据累加
+
+ OHOS::GoalModel::GetInstance().show_data_step_refresh();
+ OHOS::GoalModel::GetInstance().show_data_calories_refresh();
+ OHOS::GoalModel::GetInstance().show_data_distance_refresh();
+
+ 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() ));
+ }
+
+ if(OHOS::GoalModel::GetInstance().getstepvalue()>=100)
+ {
+
+ 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);
+ }
+ }
+ }
+
+ 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(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);
+ }
+ }
+ }
+
+ 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
+ }
+
+
+
+ }
+ #ifdef SUPPORT_CYWEE_SERVICE
+ //每日训练数据刷新
+ // 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;
+ // }
+
+ /*运动识别*/
+ void MsgCenterNotifyArAlertProc(const Topic topic, Request* req)
+ {
+ uint8_t* motionType=(uint8_t*)req->data;
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyArAlertProc,motionType = %d !",*motionType);
+ MotionRecognitionViewEventListener::GetInstance().record_motion_recognition_log();
+ if(*motionType > 5 || *motionType <1) //未知运动不弹窗
+ {
+ return;
+ }
+ if (CheckPriority(topic))
+ {
+ MotionRecognitionViewEventListener::GetInstance().SetMotionTypeId(*motionType);
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
+ NotificationManager::GetInstance()->ShowNotify(showMotionRecognitionNotify, (uint16_t)topic, true);
+ }
- free(cywee_Inactivity_Info);
- cywee_Inactivity_Info = NULL;
-}
-
-#endif
-
-//查找手表通知
-void MsgCenterNotifyFindWatchProc(const Topic topic, Request* req)
-{
- WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyFindWatchProc !");
- if (CheckPriority(topic))
- {
- 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*
- } else {
- if (FindWatchViewEventListener::GetInstance().GetFindWatchNotifyFlag() == true) {
- NotificationManager::GetInstance()->StopNotify();
- }
- FindWatchViewEventListener::GetInstance().SetFindWatchNotifyFlag(false);
- }
- } else {
- WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "NotifyPriority = %d ",NotificationManager::GetInstance()->GetNotifyPriority());
- }
-}
-
-void MsgCenterNotifyDebugOutProc(const Topic topic, Request *req)
-{
- unused(req);
- WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyDebugOutProc !");
- if (CheckPriority(topic))
- {
- NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
- NotificationManager::GetInstance()->ShowNotify(showDebugOutputNotify, (uint16_t)topic, true);
- }
-}
-void MsgCenterNotifyGoalShowViewProc(const Topic topic, Request* req)
-{
- unused(req);
- if (CheckPriority(topic))
- {
- uint8_t* data=(uint8_t*)req->data;
- 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();
-
- uapi_set_screen_on_api();
-
- NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
- NotificationManager::GetInstance()->ShowNotify(ShowGoalNotify, static_cast<uint16_t>(topic), true);
- }
- }
-}
-//喝水提醒通知
-void MsgCenterNotifyDrinkReminderProc(const Topic topic, Request *req)
-{
- // unused(topic);
- unused(req);
- WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyDrinkReminderProc !");
- // DrinkReminderViewEventListener::GetInstance().set_screen_on_and_vibration();
- DrinkReminderViewEventListener::GetInstance().record_drink_reminder_log();
- if (CheckPriority(topic))
- {
- NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
- 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)
-{
+ }
+
+ void MsgCenterNotifyInactivityProc(const Topic topic, Request *req)
+ {
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyInactivityProc !");
+ inact_result_t *cywee_Inactivity_Info = (inact_result_t *)malloc(req->len);
+ if (!cywee_Inactivity_Info)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Memory allocation failure");
+ return;
+ }
+
+ int rets = memcpy_s(cywee_Inactivity_Info, req->len, (inact_result_t*)req->data, req->len);
+ if (rets != EOK)
+ {
+ free(cywee_Inactivity_Info);
+ cywee_Inactivity_Info = NULL;
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "memcpy_s cywee_inactivity_result_t failed, ret = %d", rets);
+ return;
+ }
+
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "cywee_Inactivity_Info->output_number = %d", cywee_Inactivity_Info->output_number);
+
+ switch (cywee_Inactivity_Info->output_number)
+ {
+ case INACTIVITY_MODE_SEDENTARY_OUTPUT:
+ if(cywee_Inactivity_Info->status == 1)
+ {
+ SedentaryReminderViewEventListener::GetInstance().record_sedentary_reminder_log();
+ if (CheckPriority(topic))
+ {
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
+ NotificationManager::GetInstance()->ShowNotify(showSedentaryReminderNotify, (uint16_t)topic, true);
+ }
+ }
+ else if(cywee_Inactivity_Info->status==9)
+ {
+ cywee_set_stand_flag();
+ }
+ break;
+ default:
+ break;
+ }
+
+ free(cywee_Inactivity_Info);
+ cywee_Inactivity_Info = NULL;
+ }
+
+ #endif
+
+ //查找手表通知
+ void MsgCenterNotifyFindWatchProc(const Topic topic, Request* req)
+ {
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyFindWatchProc !");
+ if (CheckPriority(topic))
+ {
+ 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*
+ } else {
+ if (FindWatchViewEventListener::GetInstance().GetFindWatchNotifyFlag() == true) {
+ NotificationManager::GetInstance()->StopNotify();
+ }
+ FindWatchViewEventListener::GetInstance().SetFindWatchNotifyFlag(false);
+ }
+ } else {
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "NotifyPriority = %d ",NotificationManager::GetInstance()->GetNotifyPriority());
+ }
+ }
+
+ void MsgCenterNotifyDebugOutProc(const Topic topic, Request *req)
+ {
+ unused(req);
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyDebugOutProc !");
+ if (CheckPriority(topic))
+ {
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
+ NotificationManager::GetInstance()->ShowNotify(showDebugOutputNotify, (uint16_t)topic, true);
+ }
+ }
+ void MsgCenterNotifyGoalShowViewProc(const Topic topic, Request* req)
+ {
+ unused(req);
+ if (CheckPriority(topic))
+ {
+ uint8_t* data=(uint8_t*)req->data;
+ 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();
+
+ uapi_set_screen_on_api();
+
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
+ NotificationManager::GetInstance()->ShowNotify(ShowGoalNotify, static_cast<uint16_t>(topic), true);
+ }
+ }
+ }
+ //喝水提醒通知
+ void MsgCenterNotifyDrinkReminderProc(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)
-{
- unused(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);
- }
-
- NotificationManager::GetInstance()->ShowNotify(showSleepNotify, (uint16_t)topic, true);
- }
-
-}
-
-void MsgCenterNotifyInactivityAccumulateTimeProc(const Topic topic, Request* req)
-{
- unused(topic);
- #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 CUSTOM_ZHIHUI
- 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);
+ unused(req);
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyDrinkReminderProc !");
+ // DrinkReminderViewEventListener::GetInstance().set_screen_on_and_vibration();
+ DrinkReminderViewEventListener::GetInstance().record_drink_reminder_log();
+ if (CheckPriority(topic))
+ {
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
+ NotificationManager::GetInstance()->ShowNotify(showDrinkReminderNotify, (uint16_t)topic, true);
+ }
+ }
+ //关机动画
+ void MsgCenterNotifyShutDownAnimatorProc(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},
-
-#ifdef SUPPORT_CYWEE_SERVICE
- // {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},
-#endif
-
- // {TOPIC_EVENT_GOAL_SHOW_VIEW, MsgCenterNotifygoalnotificationviewProc}, //编译不过
-
- {TOPIC_EVENT_BLE_TRAINING, MsgCenterNotifybleAPPtraining},
- {TOPIC_EVENT_BLE_TRANSMIT, MsgCenterNotifybleTransmit},
-
- {TOPIC_EVENT_CHARGE_PLUG, MsgCenterNotifyChargePlugProc},
- {TOPIC_EVENT_CHARGE_UNPLUG, MsgCenterNotifyChargeUnPlugProc},
- {TOPIC_EVENT_LOWPOWER_ALARM, MsgCenterNotifyLowPowerAlarmProc},
+ 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)
+ {
+ unused(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);
+ }
-#ifdef SUPPORT_CAT1_MODEM
- {TOPIC_EVENT_CAT1_INCOMMING, MsgCenterNotifyCatIncomingCallProc},
- {TOPIC_EVENT_CAT1_CALLCONNTED, MsgCenterNotifyCat1CallConnectedProc},
- {TOPIC_EVENT_CAT1_CALLENDED, MsgCenterNotifyCat1CallEndedProc},
- {TOPIC_EVENT_CAT1_CALLDIAL, MsgCenterNotifyCat1dialProc},
-
- // {TOPIC_EVENT_CAT1_SIGNAL_UPDATE, MsgCenterNotifyCat1SignalUpdateProc},
- // {TOPIC_EVENT_CAT1_POWER_ON, MsgCenterNotifyCat1PowerOnProc},
- // {TOPIC_EVENT_CAT1_POWER_OFF, MsgCenterNotifyCat1PowerOffProc},
- {TOPIC_EVENT_CAT1_CALL_FAIL, MsgCenterNotifyCat1FailEProc},
-#endif
- {TOPIC_EVENT_DEVICE_BIND, MsgCenterNotifyDeviceBindProc},
- {TOPIC_EVENT_FIND_WATCH,MsgCenterNotifyFindWatchProc},
- {TOPIC_EVENT_DRINKREMINDER,MsgCenterNotifyDrinkReminderProc},
- {TOPIC_EVENT_MESSAGENOTE,MsgCenterNotifyMessageProc},
- {TOPIC_EVENT_SLEEPNOTE,MsgCenterNotifySleepProc},
- {TOPIC_EVENT_DEBUGOUTPUT,MsgCenterNotifyDebugOutProc},
- {TOPIC_EVENT_SHUTDOWN_ANIMATIOR,MsgCenterNotifyShutDownAnimatorProc},
-};
-
-static MsgCenterNotifyTable *MsgCenterGetNotifyTblCb(uint8_t idx)
-{
- return &g_msgCenterNotifyTable[idx];
-}
-
-static uint8_t MsgCenterGetNotifyTblSize(void)
-{
- return sizeof(g_msgCenterNotifyTable) / sizeof(g_msgCenterNotifyTable[0]);
-}
-
-static void CallVolumeDipSwitchControl(uint16_t notifyId, uint8_t states)
-{
- VolumeSliderEventListener *volumeSliderEventListener = nullptr;
- if (notifyId == TOPIC_EVENT_HFP_WATCH_ACTIVE ||
- notifyId == TOPIC_EVENT_HFP_PHONE_TO_WATCH) {
- if (NotificationManager::GetInstance()->GetVolumeScreenStatus()) {
- VolumeSettingView *settingView = GetvolumeSetting();
- if (settingView == nullptr) {
- return;
- }
- volumeSliderEventListener = settingView->GetVolumeEventListener();
- if (volumeSliderEventListener == nullptr) {
- return;
- }
- volumeSliderEventListener->ChangeVolume(static_cast<VolumeChangeStatus>(states));
- } else {
- HonrsViewChange();
- NotificationManager::GetInstance()->SetVolumeScreenStatus(true);
- }
- }
- return;
-}
-
-static void OnKeyLongPress(uint16_t keyID)
-{
- g_longPressFlag = true; // Long press the logo
- if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_POWER)) { // Power button
- // After StopNotify, a restart card will pop up first
- uint16_t notifyId = NotificationManager::GetInstance()->GetShowingNotifyId();
- if(notifyId == TOPIC_EVENT_ALARM_RING) {
- NativeAbility::GetInstance().ChangeSlice(VIEW_REBOOT);
- NotificationManager::GetInstance()->SetNativeUIRunning(true);
- NotificationManager::GetInstance()->StopNotify();
- }
- } else if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_FUNC)) { // Function buttons
- // Switch to user configured shortcut card
- }
- return;
-}
-
-static void HandleKeyPress(uint16_t notifyId)
-{
- if (notifyId == TOPIC_EVENT_ALARM_RING) {
- AlarmClockModel::GetInstance()->AlarmGetClockNum();
- AlarmPopUpPresenter::GetInstance()->DelayAlarmRing();
- NotificationManager::GetInstance()->StopNotify();
- }
-}
-
-static bool PressKeyEvent(uint16_t keyID, uint8_t state)
-{
- switch (state) {
- case InputDevice::STATE_PRESS:
- g_pressFlag = true;
- return true;
- case InputDevice::STATE_LONG_PRESS:
- OnKeyLongPress(keyID);
- return true;
- case InputDevice::STATE_RELEASE:
- if (g_longPressFlag) {
- g_pressFlag = false;
- g_longPressFlag = false;
- return true;
- }
- break;
- default:
- break;
- }
- return false;
-}
-
-static bool KeyNotifyCallback(uint16_t keyID, uint8_t state)
-{
- if (!OHOS::NotificationManager::GetInstance()->HasNotifyShowing()) {
- WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "Notify does not exist!");
- OHOS::ACELite::KeyInputModule::SetNotifyKeyListener(nullptr);
- g_pressFlag = false;
- g_longPressFlag = false;
- return false;
- }
- if (PressKeyEvent(keyID, state)) {
- return true;
- }
- uint16_t notifyId = NotificationManager::GetInstance()->GetShowingNotifyId();
- if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_POWER)) { // Power button
- if (NotificationManager::GetInstance()->GetWatchCallStatus()) { // Volume card
- // volume+
- CallVolumeDipSwitchControl(notifyId, VOLUMEUP);
- } else {
- HandleKeyPress(notifyId);
- }
- }
- else if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_FUNC)) { // Function buttons
- if (NotificationManager::GetInstance()->GetWatchCallStatus()) { // Volume card
- // volume-
- CallVolumeDipSwitchControl(notifyId, VOLUMEDOWN);
- } else {
- // Switch to user configured shortcut card
- }
- }
- g_pressFlag = false;
- g_longPressFlag = false;
- return true;
-}
-
-bool MsgCenterNotifyProc(const Topic topic, Request* req)
-{
- uint8_t i;
- uint8_t tblSize = MsgCenterGetNotifyTblSize();
- OHOS::ACELite::KeyInputModule::SetNotifyKeyListener(KeyNotifyCallback);
- for (i = 0; i < tblSize; i++) {
- MsgCenterNotifyTable *item = MsgCenterGetNotifyTblCb(i);
- if (item != nullptr && item->topic == topic && item->cb != nullptr) {
- item->cb(topic, req);
- return true;
- }
- }
-
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyProc:: Can not find the cb!");
- return false;
-}
-
-#ifdef JS_ENABLE
-void StartJsApp(char *bundleName)
-{
- ElementName* topAbility = OHOS::AbilityMsClient::GetInstance().GetTopAbility();
- if (topAbility == nullptr) {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "topAbility is null");
- return;
- }
-
- if (strcmp(topAbility->bundleName, bundleName) == 0) {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s is active", bundleName);
- FreeElement(topAbility);
- return;
- }
- FreeElement(topAbility);
- // If the alarm notification is being processed, we need to disable the alarm notification first.
- if (OHOS::NotificationManager::GetInstance()->GetNotifyPriority() == PRIORITY_TWO &&
- OHOS::NotificationManager::GetInstance()->HasNotifyShowing()) {
- WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "Alarm notification needs to be disabled first.");
- AlarmClockModel::GetInstance()->AlarmGetClockNum();
- OHOS::AlarmPopUpPresenter::GetInstance()->DelayAlarmRing();
- OHOS::NotificationManager::GetInstance()->StopNotify();
- }
- Want *want = new Want();
- memset_s(want, sizeof(Want), 0, sizeof(Want));
-
- ElementName startElement = {};
- startElement.abilityName = (char *)"default";
- startElement.bundleName = bundleName;
- startElement.deviceId = nullptr;
- SetWantElement(want, startElement);
-
- StartAbility(want);
- ClearWant(want);
- delete want;
-}
-
-void StopJsApp(char *bundleName)
-{
- ElementName* topAbility = OHOS::AbilityMsClient::GetInstance().GetTopAbility();
- if (topAbility == nullptr) {
- WEARABLE_LOGE(HILOG_MODULE_AAFWK, "topAbility is null");
- return;
- }
-
- if (strcmp(topAbility->bundleName, bundleName) != 0) {
- WEARABLE_LOGE(HILOG_MODULE_AAFWK, "%s is not top active", bundleName);
- FreeElement(topAbility);
- return;
- }
- FreeElement(topAbility);
- int token = 0;
- OHOS::AbilityMsClient::GetInstance().TerminateAbility(token);
-}
-
-void MsgCenterReportBtStatusToJS(uint16_t msgId)
-{
- ElementName *elementName = OHOS::AbilityMsClient::GetInstance().GetTopAbility();
- if (!(elementName != nullptr && strcmp(elementName->bundleName, "com.huawei.launcher") != 0)) {
- WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "JS is not on top, ignore report");
- FreeElement(elementName);
- return;
- }
- FreeElement(elementName);
- if (msgId == BT_DISCONNECTED_TO_MSGCENTER) {
- BaidumapSendMsgToJS("0", MSGCENTER_TYPE_ID_VECTOR_NAVI_BT_DISCONNECTED);
- } else if (msgId == BT_CONNECTED_TO_MSGCENTER) {
- BaidumapSendMsgToJS("1", MSGCENTER_TYPE_ID_VECTOR_NAVI_BT_CONNECTED);
- } else {
- WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "unexpected msgId %d", msgId);
- }
-}
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-}
\ No newline at end of file
+ NotificationManager::GetInstance()->ShowNotify(showSleepNotify, (uint16_t)topic, true);
+ }
+
+ }
+
+ void MsgCenterNotifyInactivityAccumulateTimeProc(const Topic topic, Request* req)
+ {
+ unused(topic);
+ #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 CUSTOM_ZHIHUI
+ 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_STEPDATA_UPDATE, MsgCenterNotifystepProc},
+
+ {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},
+
+ #ifdef SUPPORT_CYWEE_SERVICE
+ // {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},
+ #endif
+ // {TOPIC_EVENT_GOAL_SHOW_VIEW, MsgCenterNotifygoalnotificationviewProc},//编译不过
+ {TOPIC_EVENT_BLE_TRANSMIT, MsgCenterNotifybleTransmit},
+
+ {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},
+ {TOPIC_EVENT_CAT1_CALLENDED, MsgCenterNotifyCat1CallEndedProc},
+ {TOPIC_EVENT_CAT1_CALLDIAL, MsgCenterNotifyCat1dialProc},
+
+ // {TOPIC_EVENT_CAT1_SIGNAL_UPDATE, MsgCenterNotifyCat1SignalUpdateProc},
+ // {TOPIC_EVENT_CAT1_POWER_ON, MsgCenterNotifyCat1PowerOnProc},
+ // {TOPIC_EVENT_CAT1_POWER_OFF, MsgCenterNotifyCat1PowerOffProc},
+ {TOPIC_EVENT_CAT1_CALL_FAIL, MsgCenterNotifyCat1FailEProc},
+ #endif
+ {TOPIC_EVENT_DEVICE_BIND, MsgCenterNotifyDeviceBindProc},
+ {TOPIC_EVENT_FIND_WATCH,MsgCenterNotifyFindWatchProc},
+ {TOPIC_EVENT_DRINKREMINDER,MsgCenterNotifyDrinkReminderProc},
+ {TOPIC_EVENT_MESSAGENOTE,MsgCenterNotifyMessageProc},
+ {TOPIC_EVENT_SLEEPNOTE,MsgCenterNotifySleepProc},
+ {TOPIC_EVENT_DEBUGOUTPUT,MsgCenterNotifyDebugOutProc},
+ {TOPIC_EVENT_SHUTDOWN_ANIMATIOR,MsgCenterNotifyShutDownAnimatorProc},
+ };
+
+ static MsgCenterNotifyTable *MsgCenterGetNotifyTblCb(uint8_t idx)
+ {
+ return &g_msgCenterNotifyTable[idx];
+ }
+
+ static uint8_t MsgCenterGetNotifyTblSize(void)
+ {
+ return sizeof(g_msgCenterNotifyTable) / sizeof(g_msgCenterNotifyTable[0]);
+ }
+
+ static void CallVolumeDipSwitchControl(uint16_t notifyId, uint8_t states)
+ {
+ VolumeSliderEventListener *volumeSliderEventListener = nullptr;
+ if (notifyId == TOPIC_EVENT_HFP_WATCH_ACTIVE ||
+ notifyId == TOPIC_EVENT_HFP_PHONE_TO_WATCH) {
+ if (NotificationManager::GetInstance()->GetVolumeScreenStatus()) {
+ VolumeSettingView *settingView = GetvolumeSetting();
+ if (settingView == nullptr) {
+ return;
+ }
+ volumeSliderEventListener = settingView->GetVolumeEventListener();
+ if (volumeSliderEventListener == nullptr) {
+ return;
+ }
+ volumeSliderEventListener->ChangeVolume(static_cast<VolumeChangeStatus>(states));
+ } else {
+ HonrsViewChange();
+ NotificationManager::GetInstance()->SetVolumeScreenStatus(true);
+ }
+ }
+ return;
+ }
+
+ static void OnKeyLongPress(uint16_t keyID)
+ {
+ g_longPressFlag = true; // Long press the logo
+ if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_POWER)) { // Power button
+ // After StopNotify, a restart card will pop up first
+ uint16_t notifyId = NotificationManager::GetInstance()->GetShowingNotifyId();
+ if(notifyId == TOPIC_EVENT_ALARM_RING) {
+ NativeAbility::GetInstance().ChangeSlice(VIEW_REBOOT);
+ NotificationManager::GetInstance()->SetNativeUIRunning(true);
+ NotificationManager::GetInstance()->StopNotify();
+ }
+ } else if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_FUNC)) { // Function buttons
+ // Switch to user configured shortcut card
+ }
+ return;
+ }
+
+ static void HandleKeyPress(uint16_t notifyId)
+ {
+ if (notifyId == TOPIC_EVENT_ALARM_RING) {
+ AlarmClockModel::GetInstance()->AlarmGetClockNum();
+ AlarmPopUpPresenter::GetInstance()->DelayAlarmRing();
+ NotificationManager::GetInstance()->StopNotify();
+ }
+ }
+
+ static bool PressKeyEvent(uint16_t keyID, uint8_t state)
+ {
+ switch (state) {
+ case InputDevice::STATE_PRESS:
+ g_pressFlag = true;
+ return true;
+ case InputDevice::STATE_LONG_PRESS:
+ OnKeyLongPress(keyID);
+ return true;
+ case InputDevice::STATE_RELEASE:
+ if (g_longPressFlag) {
+ g_pressFlag = false;
+ g_longPressFlag = false;
+ return true;
+ }
+ break;
+ default:
+ break;
+ }
+ return false;
+ }
+
+ static bool KeyNotifyCallback(uint16_t keyID, uint8_t state)
+ {
+ if (!OHOS::NotificationManager::GetInstance()->HasNotifyShowing()) {
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "Notify does not exist!");
+ OHOS::ACELite::KeyInputModule::SetNotifyKeyListener(nullptr);
+ g_pressFlag = false;
+ g_longPressFlag = false;
+ return false;
+ }
+ if (PressKeyEvent(keyID, state)) {
+ return true;
+ }
+ uint16_t notifyId = NotificationManager::GetInstance()->GetShowingNotifyId();
+ if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_POWER)) { // Power button
+ if (NotificationManager::GetInstance()->GetWatchCallStatus()) { // Volume card
+ // volume+
+ CallVolumeDipSwitchControl(notifyId, VOLUMEUP);
+ } else {
+ HandleKeyPress(notifyId);
+ }
+ }
+ else if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_FUNC)) { // Function buttons
+ if (NotificationManager::GetInstance()->GetWatchCallStatus()) { // Volume card
+ // volume-
+ CallVolumeDipSwitchControl(notifyId, VOLUMEDOWN);
+ } else {
+ // Switch to user configured shortcut card
+ }
+ }
+ g_pressFlag = false;
+ g_longPressFlag = false;
+ return true;
+ }
+
+ bool MsgCenterNotifyProc(const Topic topic, Request* req)
+ {
+ uint8_t i;
+ uint8_t tblSize = MsgCenterGetNotifyTblSize();
+ OHOS::ACELite::KeyInputModule::SetNotifyKeyListener(KeyNotifyCallback);
+ for (i = 0; i < tblSize; i++) {
+ MsgCenterNotifyTable *item = MsgCenterGetNotifyTblCb(i);
+ if (item != nullptr && item->topic == topic && item->cb != nullptr) {
+ item->cb(topic, req);
+ return true;
+ }
+ }
+
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyProc:: Can not find the cb!");
+ return false;
+ }
+
+ #ifdef JS_ENABLE
+ void StartJsApp(char *bundleName)
+ {
+ ElementName* topAbility = OHOS::AbilityMsClient::GetInstance().GetTopAbility();
+ if (topAbility == nullptr) {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "topAbility is null");
+ return;
+ }
+
+ if (strcmp(topAbility->bundleName, bundleName) == 0) {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s is active", bundleName);
+ FreeElement(topAbility);
+ return;
+ }
+ FreeElement(topAbility);
+ // If the alarm notification is being processed, we need to disable the alarm notification first.
+ if (OHOS::NotificationManager::GetInstance()->GetNotifyPriority() == PRIORITY_TWO &&
+ OHOS::NotificationManager::GetInstance()->HasNotifyShowing()) {
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "Alarm notification needs to be disabled first.");
+ AlarmClockModel::GetInstance()->AlarmGetClockNum();
+ OHOS::AlarmPopUpPresenter::GetInstance()->DelayAlarmRing();
+ OHOS::NotificationManager::GetInstance()->StopNotify();
+ }
+ Want *want = new Want();
+ memset_s(want, sizeof(Want), 0, sizeof(Want));
+
+ ElementName startElement = {};
+ startElement.abilityName = (char *)"default";
+ startElement.bundleName = bundleName;
+ startElement.deviceId = nullptr;
+ SetWantElement(want, startElement);
+
+ StartAbility(want);
+ ClearWant(want);
+ delete want;
+ }
+
+ void StopJsApp(char *bundleName)
+ {
+ ElementName* topAbility = OHOS::AbilityMsClient::GetInstance().GetTopAbility();
+ if (topAbility == nullptr) {
+ WEARABLE_LOGE(HILOG_MODULE_AAFWK, "topAbility is null");
+ return;
+ }
+
+ if (strcmp(topAbility->bundleName, bundleName) != 0) {
+ WEARABLE_LOGE(HILOG_MODULE_AAFWK, "%s is not top active", bundleName);
+ FreeElement(topAbility);
+ return;
+ }
+ FreeElement(topAbility);
+ int token = 0;
+ OHOS::AbilityMsClient::GetInstance().TerminateAbility(token);
+ }
+
+ void MsgCenterReportBtStatusToJS(uint16_t msgId)
+ {
+ ElementName *elementName = OHOS::AbilityMsClient::GetInstance().GetTopAbility();
+ if (!(elementName != nullptr && strcmp(elementName->bundleName, "com.huawei.launcher") != 0)) {
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "JS is not on top, ignore report");
+ FreeElement(elementName);
+ return;
+ }
+ FreeElement(elementName);
+ if (msgId == BT_DISCONNECTED_TO_MSGCENTER) {
+ BaidumapSendMsgToJS("0", MSGCENTER_TYPE_ID_VECTOR_NAVI_BT_DISCONNECTED);
+ } else if (msgId == BT_CONNECTED_TO_MSGCENTER) {
+ BaidumapSendMsgToJS("1", MSGCENTER_TYPE_ID_VECTOR_NAVI_BT_CONNECTED);
+ } else {
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "unexpected msgId %d", msgId);
+ }
+ }
+ #endif
+
+ #ifdef __cplusplus
+ }
+ #endif
+ }
\ No newline at end of file
#include "producttest/include/testPresenterC.h"
#include "ConfigModelC.h"
#else
-// void ble_SOS_data_init(void){}
-// uint8_t read_jsonHistory_weather(void){return 0;}
-// void ota_updata_init(void){}
-// void start_report_log(void){}
-// void stop_report_log(void){}
-// void resume_report_log(void){}
-// void update_version_report_log(void){}
-// void start_report_nextday_log_start(void){}
-// void start_report_nextday_log_end(void){}
-// void nextday_clear_popup_windows_log(void){}
-// void save_popup_windows_log_c(int type){}
-// void system_init_uart(void){}
+void ble_SOS_data_init(void){}
+uint8_t read_jsonHistory_weather(void){return 0;}
+void ota_updata_init(void){}
+void start_report_log(void){}
+void stop_report_log(void){}
+void resume_report_log(void){}
+void update_version_report_log(void){}
+void start_report_nextday_log_start(void){}
+void start_report_nextday_log_end(void){}
+void nextday_clear_popup_windows_log(void){}
+void save_popup_windows_log_c(int type){}
+void system_init_uart(void){}
#endif
#include <stdio.h>
#include <stdlib.h>