#ifndef SERVICE_SPORT_H #define SERVICE_SPORT_H #include #include #include #ifdef __cplusplus #if __cplusplus extern "C" { #endif #endif typedef enum { HrStart, HrStop, HrGetStatus, }SportingHrAction; typedef struct SportingData { uint8_t heartRate; uint32_t exerciseDuration; uint32_t steps; uint32_t calories; uint32_t distance; } SportingData_t; typedef enum ServiceSportType { SPORT_TYPE_1, // 有数据:心率、距离、时间、步数、热量的运动类别显示此页面 SPORT_TYPE_2, // 有数据:心率、距离、时间、热量的运动类别显示此页面 SPORT_TYPE_3, // 有数据:心率、时间、热量的运动类别显示此页面 SPORT_TYPE_MAX }SportType_E; typedef enum { SPORT_MSG_TYPE_DISTANCE, //距离提醒 SPORT_MSG_TYPE_TIME, //时间提醒 SPORT_MSG_TYPE_CALORIE, //卡路里提醒 SPORT_MSG_TYPE_DISTANCE_REMIND, //单段距离提醒 SPORT_MSG_TYPE_TIME_REMIND, //单段时间提醒 SPORT_MSG_TYPE_HEART_RATE_1, //心率区间1提醒 SPORT_MSG_TYPE_HEART_RATE_2, //心率区间2提醒 SPORT_MSG_TYPE_HEART_RATE_3, //心率区间3提醒 SPORT_MSG_TYPE_HEART_RATE_4, //心率区间4提醒 SPORT_MSG_TYPE_END_30_MIN_REMIND, //30分钟结束提醒 SPORT_MSG_TYPE__END_50_MIN_REMIND, //50分钟结束提醒 SPORT_MSG_TYPE__END_60_MIN_REMIND, //60分钟结束提醒 SPORT_MSG_TYPE__END_65_MIN_REMIND, //65分钟结束提醒 SPORT_MSG_TYPE__END_70_MIN_REMIND, //70分钟结束提醒 SPORT_MSG_TYPE_NONE, } SportMsgType; typedef enum { PRIORITY_GOAL = 0, // 目标提醒 PRIORITY_HEART_RATE, // 心率提醒 PRIORITY_DISTANCE, // 单段距离提醒 PRIORITY_TIME, // 时间提醒 PRIORITY_SPORT_END //结束提醒 } ReminderPriority; typedef struct { SportMsgType msgType; ReminderPriority priority; uint32_t value; // 提醒的具体数值,用于累加显示 bool isGoalReached; // 是否达到目标 char *content; // 提醒内容 } Reminder; typedef struct { _Atomic uint32_t steps; _Atomic uint32_t calories; _Atomic uint32_t distance; } SportData; extern bool if_popup;//记录是否已经弹窗 void tjd_service_sport_open(void); void tjd_service_sport_close(void); void publish_reminder(Reminder *reminder); extern bool tjd_get_service_if_open(void); int tjd_sql_sport_get_data(SportData *sportData); SportingData_t tjd_service_sport_get_data(void); bool tjd_service_sport_get_if_suspend(void); void tjd_service_sport_set_if_suspend(bool state); void tjd_service_sport_set_if_popup(bool state); void tjd_service_sport_set_end_remind_type(uint8_t type); SportMsgType tjd_service_sport_get_end_remind_type(void); static void tjd_service_sport_set_screen_on(int32_t timeout); SportType_E tjd_service_sport_get_sport_type(void) ; void tjd_service_sport_set_sport_type(uint8_t type) ; void update_exercise_duration(uint64_t current_ms_time_stamp); void pause_exercise(void); void resume_exercise(void); uint8_t getmotion_recognition_entry(void); void setmotion_recognition_entry(uint8_t motion); void set_movement_force_remind_need_trigger(uint8_t state); void set_movement_auto_end_need_trigger(uint8_t state); extern pthread_mutex_t data_mutex; void service_set_cur_sport_type(uint8_t type); void service_reset_sport_pop_up_flag(void); void service_set_pop_up_flag(uint8_t index, bool value); void service_set_sport_goal_time(int timestamp); int service_get_sport_goal_time(void); double service_get_goal_sport_dist(void); void service_set_goal_sport_dist(double value); int service_get_goal_sport_calorie(void); void service_set_goal_sport_calorie(int value); #ifdef __cplusplus #if __cplusplus } #endif #endif #endif