${CMAKE_CURRENT_SOURCE_DIR}/nativeui/main/src/dial/DialModelCalorie.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/main/src/dial/DialModelWeekStr.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/main/src/dial/DialModelWeather.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/main/src/dial/DialModelWeatherStr.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/main/src/dial/DialModelDateStr.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/main/src/dial/DialModelHourTens.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/main/src/dial/DialModelHourUnits.cpp
#ifdef SUPPORT_ALIPAY_SEC
VIEW_MAIN_ALIPAY,
#endif
-
+ /*请在最末添加新的viewID*/
VIEW_MAX_INTER_APP, // 在此之前添加native应用ID.
VIEW_EXTERN_APP = 0xFFFE, // 三方应用
VIEW_INVALIDE_APP = 0xFFFF,
+
} AppViewId;
/*
DATA_TYPE_TEXT_BASE = 0x4fff, // 文本数据类型基值
DATA_TYPE_WEEK_STR, // 星期(string)
DATA_TYPE_DATE_STR, // 日期(string)
+ DATA_TYPE_WEATHER_STR, // 天气(string)
DATA_TYPE_MAX = 0x7fff, // 数据类型的最大值
};
+/*
+ * @Author: penglei 1624952103@qq.com
+ * @Date: 2024-06-07 11:18:25
+ * @LastEditors: penglei 1624952103@qq.com
+ * @LastEditTime: 2024-08-28 11:28:26
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/main/include/dial/DialModelWeather.h
+ * @Description:
+ *
+ * Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
+ */
/*
* Copyright (c) CompanyNameMagicTag 2023. All rights reserved.
* Description: DialModelWeather
}
bool GetDialFloatData(DialDataType &type, float &out) override;
void UpdateWeather(int16_t Weather);
+ void UpdateWeatherStr(std::string text);
int GetWeatherData(void);
private:
float Weather_ = 0; // 默认晴天
+ std::string Weather_Str = "25° 晴";
};
}
#endif
--- /dev/null
+/*
+ * @Author: penglei 1624952103@qq.com
+ * @Date: 2024-08-28 16:45:12
+ * @LastEditors: penglei 1624952103@qq.com
+ * @LastEditTime: 2024-08-28 16:55:58
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/main/include/dial/DialModelWeatherStr.h
+ * @Description:
+ *
+ * Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
+ */
+
+
+#ifndef DIAL_MODEL_WeatherStr_H
+#define DIAL_MODEL_WeatherStr_H
+
+#include "DialBaseModel.h"
+#include <cstdint>
+#include <string>
+
+namespace OHOS
+{
+ class DialModelWeatherStr : public DialBaseModel
+ {
+ public:
+ DialModelWeatherStr() {}
+ virtual ~DialModelWeatherStr() {}
+ static DialModelWeatherStr *GetInstance()
+ {
+ static DialModelWeatherStr instance;
+ return &instance;
+ }
+ bool GetDialTextData(DialDataType &type, std::string *&out, int16_t &strNum) override;
+ void UpdateWeatherStr(const std::string dialWeatherStr);
+
+ private:
+ std::string dialWeatherStr_;
+ };
+}
+#endif
\ No newline at end of file
--- /dev/null
+/*
+ * @Author: penglei 1624952103@qq.com
+ * @Date: 2024-08-23 10:50:37
+ * @LastEditors: penglei 1624952103@qq.com
+ * @LastEditTime: 2024-08-28 16:57:26
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialModelWeatherStr.cpp
+ * @Description:
+ *
+ * Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
+ */
+#include "RegisterDialModel.h"
+#include "DialModelWeatherStr.h"
+#include <string>
+#include <ctime>
+#include <time.h>
+#include "sys/time.h"
+#include "wearable_log.h"
+
+REGIST_DIAL_MODULE(DialDataType::DATA_TYPE_WEATHER_STR, OHOS::DialModelWeatherStr::GetInstance());
+namespace OHOS
+{
+
+ bool DialModelWeatherStr::GetDialTextData(DialDataType &type, std::string *&out, int16_t &strNum)
+ {
+ (void)type;
+
+ out = &dialWeatherStr_;
+ strNum = 1;
+ return true;
+ }
+
+ void DialModelWeatherStr::UpdateWeatherStr(const std::string dialWeatherStr)
+ {
+ dialWeatherStr_.clear();
+ dialWeatherStr_ = dialWeatherStr; // 更新字符串
+ if (onChangeListener_ != nullptr)
+ {
+ onChangeListener_->OnDialTextDataUpdate(DialDataType::DATA_TYPE_WEATHER_STR, &dialWeatherStr_, 1);
+ }
+ }
+}
\ No newline at end of file
} \r
display_api->set_auto_timeout_function(false);\r
\r
- uapi_cat1_power_on(1);\r
- uapi_cat1_reset(0);\r
+ uapi_set4GCapability(true);\r
\r
start_custom_ble_service();\r
}\r
/*
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-04-08 18:40:09
- * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-07-23 14:54:46
+ * @LastEditors: penglei 1624952103@qq.com
+ * @LastEditTime: 2024-08-28 17:12:21
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/weather/src/WeatherModel.cpp
*/
#include "weather/include/WeatherModel.h"
#include "weather/include/MainWeatherView.h"
#include "weather/include/WeatherControlView.h"
-
+#include "DialModelWeather.h"
+#include "DialModelWeatherStr.h"
namespace OHOS
{
#if __cplusplus
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "p_WeatherControlView");
p_WeatherControlView->UpdateWeatherControlViewVisibility();
}
+ if(DialModelWeather::GetInstance()){
+ DialModelWeather::GetInstance()->UpdateWeather(Weather_data_seven_data[0].iconDay); //更新主界面天气图标
+ // const std::string str = GetWeatherTemperature() + " "+GetWeatherDescription();
+ const std::string str = GetWeatherTemperature();
+ DialModelWeatherStr::GetInstance()->UpdateWeatherStr(str);
+ }
+
}
/*更新天气界面的时间显示*/
static void time_sync_func(void)
{
-
+ if(uapi_dev_runtime_get_saveele_status())
+ {
+ //省电模式直接返回
+ return;
+ }
// WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"time_sync_func\n");
if (uapi_cat1_get_power_stat() == false )
PRINT("start custom protocol classic bt ble service !\r\n");
bluetooth_enable_all();
#endif
+ if(!uapi_dev_runtime_get_saveele_status())
+ {
+ uapi_dev_runtime_set_bt_powerstat(1);
+ }
- uapi_dev_runtime_set_bt_powerstat(1);
return true;
}
PRINT("stop custom protocol classic bt ble service !\r\n");
bluetooth_close_all();
#endif
- uapi_dev_runtime_set_bt_powerstat(0);
+ if(!uapi_dev_runtime_get_saveele_status())
+ {
+ uapi_dev_runtime_set_bt_powerstat(0);
+ }
+
return true;
}
if(isopen)
{
power_on_cat1();
- uapi_dev_runtime_set_cat1_powerstat(1);
+ if(!uapi_dev_runtime_get_saveele_status())
+ {
+ uapi_dev_runtime_set_cat1_powerstat(1);
+ }
#ifdef SUPPORT_TCPIP
tcp_thread_id = tcp_get_thread_id();
ret = uapi_resume_thread(tcp_thread_id);
else
{
power_off_cat1();
- uapi_dev_runtime_set_cat1_powerstat(0);
+ if(!uapi_dev_runtime_get_saveele_status())
+ {
+ uapi_dev_runtime_set_cat1_powerstat(0);
+ }
+
#ifdef SUPPORT_TCPIP
tcp_thread_id = tcp_get_thread_id();
ret = uapi_suspend_thread(tcp_thread_id);
//关闭蓝牙
if(uapi_dev_runtime_get_bt_powerstat())
+ {
+
stop_custom_ble_service();
+ }
+
//关闭cat1
if(uapi_dev_runtime_get_cat1_powerstat())
+ {
uapi_set4GCapability(false);
+ }
+
//停止心率周期检测
//进入normal模式
void uapi_exit_power_saving_mode(void)
{
PRINT("Exit Power Saving Mode !!! \r\n");
- //配置runtime
- uapi_dev_runtime_set_saveele_status(0);
+
//打开蓝牙
if(uapi_dev_runtime_get_bt_powerstat())
//开启运动识别
if(uapi_dev_runtime_get_motion_recognition_status())
do_cywee_service_check_msg(CYWEE_SERVICE_CMD_OPEN_AR_ALERT,NULL);
+
+ //配置runtime
+ uapi_dev_runtime_set_saveele_status(0);
}
--- /dev/null
+<dial title="obsidianrhythm" description="黑曜律动" size="466 466" version="1.0" preview_img="./instance/114/obsidianrhythm.png">\r
+ <!-- 视频背景-->\r
+ <video id="video" rect="0 0 466 466" source="./instance/114/obsidianrhythm.mp4" color_key="0xff212324" preview_frame="./instance/114/preview_obsidianrhythm.png"></video>\r
+ \r
+ <!-- 动态背景 \r
+ <sequence_img img_names="./instance/114/background/1.png,./instance/114/background/2.png,./instance/114/background/3.png,./instance/114/background/4.png,./instance/114/background/5.png,./instance/114/background/6.png,./instance/114/background/7.png,./instance/114/background/8.png,./instance/114/background/9.png,./instance/114/background/10.png,./instance/114/background/11.png,./instance/114/background/12.png,./instance/114/background/13.png,./instance/114/background/14.png,./instance/114/background/15.png,./instance/114/background/16.png,./instance/114/background/17.png,./instance/114/background/18.png,./instance/114/background/19.png,./instance/114/background/20.png,./instance/114/background/21.png" position="0 0" repeat="true" interval="100"></sequence_img>\r
+ -->\r
+\r
+ <!-- 背景 -->\r
+ <static_img id="back_ground" position="0 0" img_name="./instance/114/MAIN_FACE_IMAGE.png"></static_img>\r
+\r
+ <!-- 天气显示 -->\r
+ <option_img position="201 69" img_names="./instance/114/weather/SUNNY.png,./instance/114/weather/SUNNY.png,./instance/114/weather/CLEAR_SUNNY.png,./instance/114/weather/SUNNY_CLOUDY.png,./instance/114/weather/CLEAR_CLOUDY.png,./instance/114/weather/OVERCAST.png,./instance/114/weather/RAIN.png,./instance/114/weather/THUNDERSHOWER.png,./instance/114/weather/SNOW.png,./instance/114/weather/FOGGY.png,./instance/114/weather/HAZE.png,./instance/114/weather/DUSTSTORM.png,./instance/114/weather/UNKNOWN.png" bind_data="24" ></option_img>\r
+ \r
+ <!-- 星期显示 -->\r
+ <option_img position="75 173" img_names="./instance/114/week/WEEK_SUN.png,./instance/114/week/WEEK_MON.png,./instance/114/week/WEEK_TUE.png,./instance/114/week/WEEK_WED.png,./instance/114/week/WEEK_THU.png,./instance/114/week/WEEK_FRI.png,./instance/114/week/WEEK_SAT.png" bind_data="17" period="10"></option_img>\r
+\r
+ <!-- 天气信息显示 -->\r
+ <label id="weather_label" color="0xFFFFFFFF" font="HarmonyOS_Sans_SC_Regular.ttf" break_mode="ellipsis" rect="83 134 300 30" text="%s" font_size="26" align="center" bind_data="20482" ></label>\r
+\r
+ <!-- 日期显示 -->\r
+ <label id="day_label" color="0xFFFFFFFF" font="HarmonyOS_Sans_SC_Regular.ttf" break_mode="adapt" rect="125 225 33 40" text="%2.0f" font_size="26" align="center" bind_data="16" period="10"></label>\r
+ \r
+ <!-- 心率显示 -->\r
+ <label id="heart_label" color="0xFFFFFFFF" font="HarmonyOS_Sans_SC_Regular.ttf" break_mode="ellipsis" rect="127 348 49 25" text="%3.0f" font_size="20" align="center" bind_data="2"></label>\r
+ <!-- 步数显示 -->\r
+ <label id="step_label" color="0xFFFFFFFF" font="HarmonyOS_Sans_SC_Regular.ttf" break_mode="ellipsis" rect="188 374 67 25" text="%5.0f" font_size="20" align="center" bind_data="1"></label>\r
+ <!-- 卡路里显示 -->\r
+ <label id="calories_label" color="0xFFFFFFFF" font="HarmonyOS_Sans_SC_Regular.ttf" break_mode="ellipsis" rect="282 348 45 25" text="%3.f" font_size="20" align="center" bind_data="3"></label>\r
+ \r
+ <!-- 心率icon显示 -->\r
+ <static_img position="144 315" img_name="./instance/114/module/heartrate.png"></static_img>\r
+ <!-- 步数icon显示 -->\r
+ <static_img position="220 341" img_name="./instance/114/module/step.png"></static_img>\r
+ <!-- 卡路里icon显示 -->\r
+ <static_img position="296 315" img_name="./instance/114/module/calories.png"></static_img>\r
+ <!-- 时间背景框icon显示 -->\r
+ <static_img position="300 213" img_name="./instance/114/module/ellipse.png"></static_img>\r
+\r
+ <!-- 小时显示 -->\r
+ <label id="hour_label" color="0xFFFFFFFF" font="HarmonyOS_Sans_SC_Regular.ttf" break_mode="adapt" rect="312 220 77 104" text="%02.0f" font_size="26" align="center" bind_data="15" period="10"></label>\r
+ <!-- 分号显示 -->\r
+ <label id="point_label" color="0xFFFFFFFF" font="HarmonyOS_Sans_SC_Regular.ttf" break_mode="adapt" rect="342 220 28 139" text=":" font_size="26" align="center"></label>\r
+ <!-- 分钟显示 -->\r
+ <label id="minute_label" color="0xFFFFFFFF" font="HarmonyOS_Sans_SC_Regular.ttf" break_mode="adapt" rect="350 220 77 104" text="%02.0f" font_size="26" align="center" bind_data="14" period="10"></label>\r
+\r
+ <!-- 小时 -->\r
+ <rotate_img id="hour" position="212 75" rotate_center="21.0 158.0" rotate_start="0" rotate_end="360" img_name="./instance/114/HOURHAND.png" bind_data="9" period="10"></rotate_img>\r
+ <!-- 分钟 -->\r
+ <rotate_img id="minute" position="218 23" rotate_center="15.0 210.0" rotate_start="0" rotate_end="360" img_name="./instance/114/MINUTEHAND.png" bind_data="10" period="10"></rotate_img>\r
+ <!-- 秒钟 -->\r
+ <rotate_img id="second" position="220 17" rotate_center="13.0 216.0" rotate_start="0" rotate_end="360" img_name="./instance/114/SECONDHAND.png" bind_data="12" period="60"></rotate_img>\r
+ \r
+ <!--通话\r
+ <click rect="0 193 80 80" action_slice="84"></click>\r
+ -->\r
+ <!--天气-->\r
+ <click rect="193 0 80 80" action_slice="13"></click>\r
+ <!--支付宝\r
+ <click rect="386 193 80 80" action_slice="98"></click>\r
+ -->\r
+ <!--每日活动-->\r
+ <click rect="193 396 80 80" action_slice="87"></click>\r
+</dial>\r