#include "DialModelSteps.h"
#include "DialModelCalorie.h"
#include "DialModelDistance.h"
+#include "DialModelStepgoal.h"
#include "cywee_service.h"
#include "custom_runtime.h"
#include "goal/include/goalmodel.h"
OHOS::ActivityModel::GetInstance()->ReviseStepCounter(counter);
OHOS::DialModelSteps::GetInstance() ->UpdateSteps(counter);//更新表盘步数
+ OHOS::DialModelStepgoal::GetInstance() ->UpdateStepgoal(counter);//更新表盘目标
OHOS::DialModelDistance::GetInstance() ->UpdateDistance(get_distance_data());//更新表盘距离
OHOS::DialModelCalorie::GetInstance() ->UpdateCalorie(get_calories_data());//更新表盘卡路里
char* getstandnew();
void updata();
void GoalModelInitdata();
+ uint32_t getstepgoaldata();
uint8_t get_step_goal_show()
{
#include "ConfigModel.h"
#include "cywee_hal.h"
#include "goal_notification.h"
+
namespace OHOS
{
}
return value;
}
+ uint32_t GoalModel::getstepgoaldata()
+ {
+ return step;
+ }
char stepgoalstr[20];
char *GoalModel::getstepGoal()
{
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2023. All rights reserved.
+ * Description: DialModelStepgoal
+ * Author:
+ * Create: 2023-12
+ */
+
+#ifndef DIAL_MODEL_Stepgoal_H
+#define DIAL_MODEL_Stepgoal_H
+
+#include "DialBaseModel.h"
+
+namespace OHOS {
+class DialModelStepgoal : public DialBaseModel {
+public:
+ DialModelStepgoal() {}
+ ~DialModelStepgoal() override {}
+ static DialModelStepgoal *GetInstance() {
+ static DialModelStepgoal instance;
+ return &instance;
+ }
+ bool GetDialFloatData(DialDataType &type, float &out) override;
+ void UpdateStepgoal(uint32_t Stepgoal);
+
+private:
+ float stepgoal_ = 0; // 11520.0: default step value as reference
+};
+} // namespace OHOS
+#endif
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2023. All rights reserved.
+ * Description: DialModelSteps
+ * Author:
+ * Create: 2023-12
+ */
+
+#include "DialModelStepgoal.h"
+#include "DialBoxProgressView.h"
+#include "RegisterDialModel.h"
+#include "goal/include/goalmodel.h"
+
+REGIST_DIAL_MODULE(DialDataType::DATA_TYPE_STEPS_GOAL,
+ OHOS::DialModelStepgoal::GetInstance());
+
+namespace OHOS {
+bool DialModelStepgoal::GetDialFloatData(DialDataType &type, float &out) {
+ (void)type;
+ out = DialBoxProgressView::GetInstance()->ConvertToRequiredFormat(
+ DialBoxDataType::STEP_TARGET, stepgoal_);
+ return true;
+}
+
+void DialModelStepgoal::UpdateStepgoal(uint32_t steps) {
+ uint32_t step_ = static_cast<float>(steps);
+ uint32_t goal = GoalModel::GetInstance().getstepgoaldata();
+ if (goal > 0) {
+ stepgoal_ = (static_cast<float>(step_) / goal) * 100;
+ if (stepgoal_ > 100)
+ stepgoal_ = 100;
+ stepgoal_ = DialBoxProgressView::GetInstance()->ConvertToRequiredFormat(
+ DialBoxDataType::STEP_TARGET, stepgoal_);
+ }
+ if (onChangeListener_ != nullptr) {
+ onChangeListener_->OnDialFloatDataUpdate(DialDataType::DATA_TYPE_STEPS_GOAL,
+ stepgoal_);
+ }
+}
+} // namespace OHOS