#include "takephotos/include/TakephotosModel.h"
#include "message/include/MessageModel.h"
#include "assistant/include/AssistantModel.h"
+#ifdef SUPPORT_BATTERY_SERVICE
#include "battery_hal.h"
+#endif
#include "main/include/dial/DialModelCharge.h"
#include "schedule/include/ScheduleModel.h"
#include "sleep/include/SleepModel.h"
RebootAndShutdownModel::GetInstance().RegisterAllKeyEvents();
// 开机检测充电状态
+ #ifdef SUPPORT_BATTERY_SERVICE
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "get_charge_stat is %d", get_charge_stat());
if (get_charge_stat())
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Power is Charging!");
DialModelCharge::GetInstance()->UpdatechargeStatus(1);
}
+ #endif
/*开机读取天气历史数据*/
C_ScheduleDataReadFromFile();
#include "NativeRegisterManager.h"
#include "health/health_service/health_service.h"
+#ifdef SUPPORT_BATTERY_SERVICE
#include "battery_hal.h"
+#endif
#include "ConfigModelC.h"
#include "ConfigModel.h"
#include <custom_utils.h>
if (viewId < VIEW_MAX_INTER_APP)
{
/*心率Slice需要增加特殊配置*/
- bool isCharging = get_charge_stat(); // 获取充电状态
+ bool isCharging = false;
+ #ifdef SUPPORT_BATTERY_SERVICE
+ isCharging = get_charge_stat(); // 获取充电状态
+ #endif
if (isCharging && viewId == VIEW_HEART_CHART)
{
HealthState highHealthState;
#include "ConfigModel.h"
#include "main/include/MainViewSample.h"
#include "NativeAbility.h"
+#ifdef SUPPORT_BATTERY_SERVICE
#include "battery_hal.h"
+#endif
#include "health/BloodCardView.h"
#include <custom_save_runtime.h>
void BloodOxygenModel::Blood_Control(BloodState state) {
if (state == BloodState::End && startspo2 == true) {
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "startspo2 End");
- uint16_t md = PPG_SERVICE_CMD_TYPE_STOP_SPO2_TEST;
#ifdef SUPPORT_PPG_SERVICE
+ uint16_t md = PPG_SERVICE_CMD_TYPE_STOP_SPO2_TEST;
send_ppg_cmd_msg(md);
#endif
startspo2 = false;
blood_stop_data_timer();
} else if (state == BloodState::Start && startspo2 == false) {
/*充电状态下不进行检测*/
- bool isCharging = get_charge_stat(); // 获取充电状态
+ bool isCharging =false;
+ #ifdef SUPPORT_BATTERY_SERVICE
+ isCharging = get_charge_stat(); // 获取充电状态
+ #endif
if (isCharging) {
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "充电不能检测");
return;
}
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "startspo2 Start");
- uint16_t md = PPG_SERVICE_CMD_TYPE_DO_SPO2_TEST;
#ifdef SUPPORT_PPG_SERVICE
+ uint16_t md = PPG_SERVICE_CMD_TYPE_DO_SPO2_TEST;
send_ppg_cmd_msg(md);
#endif
startspo2 = true;
#include "cywee_service.h"
#endif
+#ifdef SUPPORT_BATTERY_SERVICE
#include "battery_hal.h"
+#endif
#include "health/health_service/health_service.h"
if (strcmp(view.GetViewId(), CLICK_BLOOD) == 0)
{
// 如果正在充电进入提醒界面
- if (get_charge_stat())
+ bool isCharging = false;
+ #ifdef SUPPORT_BATTERY_SERVICE
+ isCharging = get_charge_stat();
+ #endif
+ if (isCharging)
{
HealthState highHealthState;
highHealthState.checkType = CHARGE;
#include "main/include/MainModel.h"
#include "main/include/MainPresenterSample.h"
#include "set_dial/include/SetDialModel.h"
-#include "battery_hal.h"
#include "common/image_cache_manager.h"
#include "components/ui_label.h"
#include "custom_runtime.h"
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>
-
- #include "battery_hal.h"
- extern uint8_t battery_get_voltage(float *voltage);
+#ifdef SUPPORT_BATTERY_SERVICE
+#include "battery_hal.h"
+extern uint8_t battery_get_voltage(float *voltage);
+#endif
#define TIMEVIEW_UP 0
#define TIMEVIEW_DOWN 1
UpdateBatteryColor();
- float voltage = 0.0F;
- int power = battery_get_voltage(&voltage);
+ float voltage = 0.0F;
+ int power = 0;
+ #ifdef SUPPORT_BATTERY_SERVICE
+ power = battery_get_voltage(&voltage);
+ #endif
if (power == power_)
return;
void MainClockView::UpdateBatteryColor(void)
{
- bool isCharging = get_charge_stat(); // 获取充电状态
-
+ bool isCharging = false;
+ #ifdef SUPPORT_BATTERY_SERVICE
+ isCharging = get_charge_stat(); // 获取充电状态
+ #endif
+
if (isCharging)
{
if (!isBatteryIconVisible)
#include "main/include/MainModel.h"
#include "health/health_service/health_service.h"
+#ifdef SUPPORT_BATTERY_SERVICE
#include "battery_hal.h"
+#endif
#include "NativeRegisterManager.h"
if (strcmp(view.GetViewId(), CLICK_BLOOD_RE) == 0)
{
// 检测过程中充电 失败可以弹窗
- bool isCharging = get_charge_stat(); // 获取充电状态
+ bool isCharging = false;
+ #ifdef SUPPORT_BATTERY_SERVICE
+ isCharging = get_charge_stat(); // 获取充电状态
+ #endif
if (isCharging)
{
#include "key/include/KeyInputListener.h"
#include "common/key_code.h"
+#ifdef SUPPORT_BATTERY_SERVICE
#include "battery_hal.h"
+#endif
#include "heartrate/include/HeartResultView.h"
#include <sys/stat.h>\r
#include <unistd.h>\r
\r
+#ifdef SUPPORT_BATTERY_SERVICE\r
#include "battery_hal.h"\r
+#endif\r
\r
#include "languagecode/LanguageInit.h"\r
#include "uiservice/include/ui_service.h"\r
heart_stop_data_timer(); //关闭数据获取\r
} else if (state == HeartState::Start && heartstate == false) {\r
/*充电状态下不进行检测*/\r
- bool isCharging = get_charge_stat(); // 获取充电状态\r
+ bool isCharging = false;\r
+ #ifdef SUPPORT_BATTERY_SERVICE\r
+ isCharging = get_charge_stat(); // 获取充电状态\r
+ #endif\r
if (isCharging) {\r
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "充电不能检测");\r
return;\r
#include "cywee_service.h"
#endif
+#ifdef SUPPORT_BATTERY_SERVICE
#include "battery_hal.h"
+#endif
#include "health/health_service/health_service.h"
#include "NativeRegisterManager.h"
if (strcmp(view.GetViewId(), CLICK_HEART) == 0)
{
// 如果正在充电进入提醒界面
- bool isCharging = get_charge_stat();
+ bool isCharging = false;
+ #ifdef SUPPORT_BATTERY_SERVICE
+ isCharging = get_charge_stat();
+ #endif
// bool isCharging = false;
if (isCharging)
{
MainModel::GetInstance().SetFromSetCardView(true);
MainModel::GetInstance().SetFromCardId(BLOODOXGEN);
// 如果正在充电进入提醒界面
- if (get_charge_stat())
+ bool isCharging = false;
+ #ifdef SUPPORT_BATTERY_SERVICE
+ isCharging = get_charge_stat();
+ #endif
+ if (isCharging)
{
HealthState highHealthState;
highHealthState.checkType = CHARGE;
#include "main/include/dial/DialBoxProgressView.h"
#include "wearable_log.h"
+#ifdef SUPPORT_BATTERY_SERVICE
#include "battery_hal.h"
+#endif
extern uint8_t battery_get_voltage(float *voltage);
// 定义电量宏
void DialBoxProgressModel::UpdateBatteryColor( float value_) {
- bool isCharging = get_charge_stat(); // 获取充电状态
+ bool isCharging = false;
+ #ifdef SUPPORT_BATTERY_SERVICE
+ isCharging = get_charge_stat(); // 获取充电状态
+ #endif
if (isCharging) {
SetViewColor(Color::Green().full); // 充电状态为绿色
#include <string>
#include "wearable_log.h"
+#ifdef SUPPORT_BATTERY_SERVICE
#include "battery_hal.h"
+#endif
extern uint8_t battery_get_voltage(float *voltage);
REGIST_DIAL_MODULE(OHOS::DialDataType::BATTERY, OHOS::DialModelPower::GetInstance());
(void)type;
float voltage = 0.0F;
+ power_ = 0;
+ #ifdef SUPPORT_BATTERY_SERVICE
power_ = battery_get_voltage(&voltage);
+ #endif
out = static_cast<float>(power_);
return true;
}
#include "wearable_log.h"
#include <string>
+#ifdef SUPPORT_BATTERY_SERVICE
#include "battery_hal.h"
+#endif
extern uint8_t battery_get_voltage(float *voltage);
REGIST_DIAL_MODULE(OHOS::DialDataType::BATTERY_LEVEL,
bool DialModelPowerMapper::GetDialFloatData(DialDataType &type, float &out) {
(void)type;
float voltage = 0.0F;
+ powermapper_ = 0;
+ #ifdef SUPPORT_BATTERY_SERVICE
powermapper_ = battery_get_voltage(&voltage);
+ #endif
//电量0~100
//映射0~1
powermapper_ = static_cast<float>(powermapper_) / 100.0f;
#include "wearable_log.h"
#include <string>
+#ifdef SUPPORT_BATTERY_SERVICE
#include "battery_hal.h"
+#endif
+
extern uint8_t battery_get_voltage(float *voltage);
REGIST_DIAL_MODULE(OHOS::DialDataType::POWER_STANDBY,
#if 1
(void)type;
float voltage = 0.0F;
+ PowerStanby_ = 0;
+ #ifdef SUPPORT_BATTERY_SERVICE
PowerStanby_ = battery_get_voltage(&voltage);
+ #endif
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Battery voltage obtained: %.2f",
voltage);
#include "main/include/dial/DialModelPowerStr.h"
#include "main/include/dial/RegisterDialModel.h"
#include "wearable_log.h"
+#ifdef SUPPORT_BATTERY_SERVICE
#include "battery_hal.h"
+#endif
extern uint8_t battery_get_voltage(float *voltage);
namespace OHOS
{
(void)type;
float voltage = 0.0F;
- uint8_t power_ = battery_get_voltage(&voltage);
+ uint8_t power_ = 0;
+ #ifdef SUPPORT_BATTERY_SERVICE
+ power_ = battery_get_voltage(&voltage);
+ #endif
dialPowerStr_ = std::to_string(power_) + "%";
out = &dialPowerStr_;
strNum = 1;
#include "NativeAbility.h"\r
#include "common/key_code.h"\r
#include "cmsis_os.h"\r
+#ifdef SUPPORT_BATTERY_SERVICE\r
#include "battery_hal.h"\r
+#endif\r
#include "custom_utils.h"\r
#include "saveele/include/SaveBatPresenter.h"\r
#include "saveele/include/SaveBatView.h"\r
#include <iostream>\r
#include <chrono>\r
#include <thread>\r
+#ifdef SUPPORT_BATTERY_SERVICE\r
#include "battery_hal.h"\r
+#endif\r
#include "string"\r
#include "custom_utils.h"\r
#include "UiConfig.h"\r
\r
// 获取电量值\r
float voltage = 0.0F;\r
- uint8_t value = battery_get_voltage(&voltage);\r
+ uint8_t value = 0;\r
+ #ifdef SUPPORT_BATTERY_SERVICE\r
+ value = battery_get_voltage(&voltage);\r
+ #endif\r
\r
// 更新界面组件\r
timelabel->SetText(stringtime.c_str());\r
#include "bleService.h"\r
#endif\r
\r
+#ifdef SUPPORT_BATTERY_SERVICE\r
#include "battery_hal.h"\r
+#endif\r
\r
#include "UiConfig.h"\r
#include "common/screen.h"\r
}
/*发送实时数据*/
void TraingModel::SendLiveData() {
+ #ifdef SUPPORT_BLE_SERVICE
msg_get_train_data_info_t data;
memset(&data, 0, sizeof(msg_get_train_data_info_t));
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "sportdata->starttime %d \r\n",
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SendLiveData Begin!");
sendtraningdata(&data); // 发送数据函数
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SendLiveData Stop!");
+ #endif
}
/* -------------------------------- 运动识别发起处理
* -------------------------------- */
${ROOT_DIR}/middleware/services/gui/uikit/utils/interfaces/kits/gfx_utils
${ROOT_DIR}/include/middleware/services/bts/br
${ROOT_DIR}/include/middleware/services/bts/common
+ ${ROOT_DIR}/zhihui/services/ble_service/transspecard/
)
set(SOURCES
#ifdef __cplusplus\r
extern "C" {\r
#endif\r
-#include "transspecard.h"\r
\r
#define HOSTENT_TIMEOUT 2000\r
#define TCP_CONNECT_TIMEOUT 2000\r
uint32_t g_tcp_fd = 0;\r
uint8_t g_netstatus = 0;\r
\r
+#ifdef SUPPORT_BLE_SERVICE\r
#define ALIPAY_TRANSSPECARD_SUPPORT_BLE 1\r
+#include "transspecard.h"\r
+#endif\r
void msg_center_alipay_reply_ack(uint8_t cmd_id, uint8_t type)\r
{\r
uint8_t ack = 1; /* 与手机APK侧约定 */\r
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
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 !");
NotificationManager::GetInstance()->StopNotify();
}
}
+ #endif
}
/*低电量提醒*/
#include "components/ui_label.h"
#include "components/ui_label_ext.h"
#include "components/ui_label_button_ext.h"
+#ifdef SUPPORT_BATTERY_SERVICE
#include "battery_service.h"
+#include "battery_hal.h"
+#endif
#include "NativeAbility.h"
#include "custom_utils.h"
#include "cmsis_os2.h"
#include "linux/delay.h"
#include "components/ui_circle_progress.h"
-#include "battery_hal.h"
#include "uicomponents/UIComponents.h"
#include "charge_notification.h"
}
float voltage = 0.0F;
- uint8_t power = battery_get_voltage(&voltage);
+ uint8_t power = 0;
+ #ifdef SUPPORT_BATTERY_SERVICE
+ power = battery_get_voltage(&voltage);
+ #endif
// 使用 std::to_string 生成电池电量字符串
std::string powerstr = std::to_string(power) + "%";
float voltage = 0.0F;
uint8_t power = 0;
+ #ifdef SUPPORT_BATTERY_SERVICE
power = battery_get_voltage(&voltage);
+ #endif
char buf[16]={0};
sprintf(buf,"%d%c",power,'%');
if(timer_falg_low_power==0)
{
alarm_UILabel->SetVisible(false);
+ #ifdef SUPPORT_BATTERY_SERVICE
low_power_play_toUI(3);
+ #endif
}
}
return ;
}
ShutDownImageAnimatorView->Start();
+ #ifdef SUPPORT_BATTERY_SERVICE
set_lowpower_show(1,0);
+ #endif
UIViewGroup *lowPowerShow()
{
-
+
if (UIViewGroup_lowpower == nullptr) {
UIViewGroup_lowpower = new UIViewGroup();
UIViewGroup_lowpower->SetPosition(0, 0, 466, 466);
alarm_UILabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
alarm_UILabel->SetRollSpeed(0);
alarm_UILabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+ #ifdef SUPPORT_BATTERY_SERVICE
set_lowpower_show(0,0);
+ #endif
}
// Set additional property
if(battery_falg==1)
#include "bleInstruct.h"
#endif
+#ifdef SUPPORT_BATTERY_SERVICE
#include "battery_hal.h"
#include "battery_service.h"
+#endif
#ifdef SUPPORT_CAT1_SERVICE
#include "cat1_tcpServer.h"
static std::string getCurrentWatchadvdata()
{
+ #ifdef SUPPORT_BLE_SERVICE
uint32_t len = 64;
char *buf_advdata = (char *)malloc(len);
free(buf_advdata);
return (str);
+ #endif
+ return "bt service not support";
}
std::string DebugOutputViewEventListener::get_bt_runtime_status_t(void)
{
+ #ifdef SUPPORT_BLE_SERVICE
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DebugOutputViewEventListener::get_bt_runtime_status_t");
std::string result = "bt_powerOn:" + std::to_string(uapi_dev_runtime_get_bt_powerstat()) + " ";
result += "bt_ble_connectstat:" + std::to_string(get_ble_connect()) + " ";
// 蓝牙ble广播开关,基础信息如,地址,广播状态
return result;
+ #endif
+ return "bt service not support";
}
std::string DebugOutputViewEventListener::get_cat1_runtime_status_t(void)
// 获取电池相关信息
std::string DebugOutputViewEventListener::get_battery_info()
{
+ #ifdef SUPPORT_BATTERY_SERVICE
// 获取电池温度
float bat_temp = 0.0f;
batteryservice_get_battery_temp(&bat_temp);
<< "Charge: " << (isCharging ? "Yes" : "No");
return oss.str();
+ #endif
+ return "battery service not support";
}
// 获取死机列表
// 获取电池状态
std::string DebugOutputViewEventListener::get_battery_percent(void)
{
+ #ifdef SUPPORT_BATTERY_SERVICE
std::string result;
std::string charge_stat;
int index = 0;
}
free(data);
return result; // 返回结果字符串
+ #endif
+ return "battery service not support";
}
// 获取系统free内存
{
// if (BluetoothModel::GetInstance()->GetAdvStartState() == false) // 如果广播是关的就去开启广播
// BleAdvStart();
-
+ #ifdef SUPPORT_BLE_SERVICE
svr_ble_adv_start();
+ #endif
return true;
}
else if (viewId == DEBUGOUTPUTLABELBUTTON) // 点击的是刷新按钮
{
// toggleButton->SetState(false);
SystemLogModel::GetInstance()->set_uart_status(false);
+ #ifdef SUPPORT_CAT1_SERVICE
remove_debug_vote(); // 关闭uart的同时也取消 debug的投票,保证关闭开关后可以正常休眠
+ #endif
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "uart_at_set false");
}
else
{
if (toggleButtonOffline->GetState() == false)
{
+ #ifdef SUPPORT_PPG_SERVICE
send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_CLOSE_HRS_BLE);
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "hrs_ble_switch false");
+ #endif
}
else
{
+ #ifdef SUPPORT_PPG_SERVICE
send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_OPEN_HRS_BLE);
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "hrs_ble_switch true");
+ #endif
}
}
else
}
else if (viewId == "CAT1_UPDATA")
{
+ #ifdef SUPPORT_CAT1_SERVICE
Cat1_OTA(CAT1_TCP_START_OTA);
+ #endif
}
else if (viewId == NEXTORPREPAGELABELBUTTON)
{
#include <iostream>
#include "uiservice/include/ui_service.h"
#include <graphic_service.h>
-#include "bleEvent.h"
#include <UiConfig.h>
#include <power_display_service.h>
#include "ConfigModel.h"
#include <custom_save_runtime.h>
#include "findwatch_notification.h"
+#ifdef SUPPORT_BLE_SERVICE
+#include "bleEvent.h"
+#endif
namespace OHOS
{
UIViewGroup *FindWatchGroupView{nullptr};
#include "ConfigModel.h"
#include "uicomponents/UIComponents.h"
+#ifdef SUPPORT_BATTERY_SERVICE
#include "battery_service.h"
+#endif
#include "upg.h"
#include "custom_runtime.h"
#include "vibrator/service/vibrator_service.h"
virtual uint16_t GetScreenWidth()
{
- return width_;
+ // return width_;
+ return HORIZONTAL_RESOLUTION;
}
virtual uint16_t GetScreenHeight()
{
- return height_;
+ // return height_;
+ return VERTICAL_RESOLUTION;
}
virtual void SetScreenShape(ScreenShape screenShape)
#include "stdbool.h"
#include "bts_def.h"
#include "errcode.h"
-#include <bleEvent.h>
+#ifdef SUPPORT_BLE_SERVICE
+#include "bleEvent.h"
+#endif
#define ALIPAY_TRANSSPECARD 0x09
}
// uapi_save_runtime_log(RUNTIME_LOG_CAT1_4G_OPEN);
+ #ifdef SUPPORT_CAT1_SERVICE
power_on_cat1();
+ #endif
// if(!uapi_dev_runtime_get_saveele_status())
{
uapi_dev_runtime_set_cat1_powerstat(1);
return;
}
// uapi_save_runtime_log(RUNTIME_LOG_CAT1_4G_CLOSE);
+ #ifdef SUPPORT_CAT1_SERVICE
power_off_cat1();
+ #endif
// if(!uapi_dev_runtime_get_saveele_status())
{
uapi_dev_runtime_set_cat1_powerstat(0);
//关闭cat1
if(uapi_dev_runtime_get_cat1_powerstat())
{
+ #ifdef SUPPORT_CAT1_SERVICE
uapi_set4GCapability(false);
+ #endif
}
//停止心率周期检测
//进入normal模式
+ #ifdef SUPPORT_CYWEE_SERVICE
do_cywee_service_check_msg(CYWEE_SERVICE_CMD_NORMAL_MODE,NULL);
//关闭运动识别
if(uapi_dev_runtime_get_motion_recognition_status())
+ {
do_cywee_service_check_msg(CYWEE_SERVICE_CMD_CLOSE_AR_ALERT,NULL);
+ }
+ #endif
//关闭音乐
mmi_stop_music_play();
//开启心率周期检测(runtime)
+ #ifdef SUPPORT_CYWEE_SERVICE
//开启运动识别
if(uapi_dev_runtime_get_motion_recognition_status())
+ {
do_cywee_service_check_msg(CYWEE_SERVICE_CMD_OPEN_AR_ALERT,NULL);
+ }
+ #endif
//配置runtime
uapi_dev_runtime_set_saveele_status(0);