#define CLASSIC_BLUETOOTH_MODEL_H\r
\r
#include "wearable_log.h"\r
-\r
+#include "config/include/ConfigModel.h"\r
namespace OHOS\r
{\r
class ClassicBlueToothModel\r
\r
namespace OHOS\r
{\r
- ClassicBlueToothModel::ClassicBlueToothModel() {}\r
+ ClassicBlueToothModel::ClassicBlueToothModel()\r
+ {\r
+ ConfigModel *p_ConfigModel = ConfigModel::GetInstance();\r
+ TradionalBlueToothToggleButtonState = (p_ConfigModel->ReadJsonData<bool>(p_ConfigModel->GetcJSON(), "TradionalBlueToothToggleButtonState"));\r
+ }\r
\r
ClassicBlueToothModel::~ClassicBlueToothModel() {}\r
\r
if (state == true)\r
{\r
ClassicBlueToothModel::GetInstance()->MarkTradionalBlueToothToggleButtonStatus(true);\r
+ ConfigModel::GetInstance()->WriteJsonData(ConfigModel::GetInstance()->GetcJSON(), "TradionalBlueToothToggleButtonState", true);\r
+ }\r
+ else\r
+ {\r
+ ClassicBlueToothModel::GetInstance()->MarkTradionalBlueToothToggleButtonStatus(false);\r
+ ConfigModel::GetInstance()->WriteJsonData(ConfigModel::GetInstance()->GetcJSON(), "TradionalBlueToothToggleButtonState", false);\r
}\r
\r
delete Title;\r
{
- "RaiseToBrightnessCheckBoxButtonState":true
+ "RaiseToBrightnessCheckBoxButtonState": false,
+ "ScreenBrightnessValue": 255,
+ "ScreenDurationRadioButtonSlectValue": 1,
+ "TradionalBlueToothToggleButtonState": false,
+ "HeartRateOrBloodOxygenQuickAccessSwitch": 0
}
\ No newline at end of file
}
cJSON *data_obj = cJSON_CreateNull();
- if constexpr (std::is_same<T, int>::value || std::is_same<T, long>::value || std::is_same<T, long long>::value)
+ if constexpr (std::is_same<T, int>::value || std::is_same<T, unsigned char>::value || std::is_same<T, unsigned int>::value)
{
data_obj = cJSON_CreateNumber(static_cast<double>(data));
}
FILE *file = fopen(filePath.c_str(), "wb");
if (file)
{
- //fputs(jsonString, file);
- fwrite(jsonString, 1, strlen(jsonString), file); // 将 JSON 字符串写入文件
+ fputs(jsonString, file);
+ //fwrite(jsonString, 1, strlen(jsonString), file); // 将 JSON 字符串写入文件
fclose(file);
}
free(jsonString);
}
else
{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Open JSON filePath fail!");
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "jsonString is nullptr");
+ return;
}
}
}
#ifndef DISPLAY_BRIGHTNESS_MODEL_H_\r
#define DISPLAY_BRIGHTNESS_MODEL_H_\r
\r
+#include "config/include/ConfigModel.h"\r
namespace OHOS\r
{\r
class DisplayBrightnessModel\r
\r
unsigned char value = BrightnessControlViewSlider->GetValue();\r
DisplayBrightnessModel::GetInstance()->KeepScreenBrightnessValues(value);\r
+ ConfigModel::GetInstance()->WriteJsonData(ConfigModel::GetInstance()->GetcJSON(),"ScreenBrightnessValue",value);\r
\r
delete BrightnessControlViewSlider;\r
BrightnessControlViewSlider = nullptr;\r
#include "displaybrightness/include/DisplayBrightnessModel.h"
#include "displaybrightness/include/DisplayBrightnessPresenter.h"
-#include "config/include/ConfigModel.h"
#include "wearable_log.h"
namespace OHOS
{
{
ConfigModel *p_ConfigModel = ConfigModel::GetInstance();
RaiseToBrightnessCheckBoxButtonState = p_ConfigModel->ReadJsonData<bool>(p_ConfigModel->GetcJSON(), "RaiseToBrightnessCheckBoxButtonState");
+ ScreenBrightnessValue = static_cast<unsigned char>(p_ConfigModel->ReadJsonData<int>(p_ConfigModel->GetcJSON(), "ScreenBrightnessValue"));
+ ScreenDurationRadioButtonSlectValue = static_cast<unsigned char>(p_ConfigModel->ReadJsonData<int>(p_ConfigModel->GetcJSON(), "ScreenDurationRadioButtonSlectValue"));
}
DisplayBrightnessModel::~DisplayBrightnessModel() {}
}\r
}\r
DisplayBrightnessModel::GetInstance()->KeepScreenDurationRadioButtonSlectStatus(i);\r
+ ConfigModel::GetInstance()->WriteJsonData(ConfigModel::GetInstance()->GetcJSON(),"ScreenDurationRadioButtonSlectValue",i);\r
\r
delete ScreenDurationTitleLabel;\r
ScreenDurationTitleLabel = nullptr;\r
#ifndef SECONDARY_FUNCTION_MODEL_H
#define SECONDARY_FUNCTION_MODEL_H
+#include "config/include/ConfigModel.h"
namespace OHOS
{
class SecondaryFunctionModel
bool HeartRateOrBloodOxygenQuickAccessRadioButtonSelectStateInit(void);
bool GetHeartRateOrBloodOxygenQuickAccessSwitch(void);
private:
- SecondaryFunctionModel() {}
- ~SecondaryFunctionModel() {}
+ SecondaryFunctionModel();
+ ~SecondaryFunctionModel();
SecondaryFunctionModel(const SecondaryFunctionModel &);
SecondaryFunctionModel &operator=(const SecondaryFunctionModel &);
if (QuickAccessRadioButton[0]->GetState() == UICheckBox::SELECTED)\r
{\r
SecondaryFunctionModel::GetInstance()->KeepHeartRateOrBloodOxygenQuickAccessRadioButtonSelectState(0);\r
+ ConfigModel::GetInstance()->WriteJsonData(ConfigModel::GetInstance()->GetcJSON(), "HeartRateOrBloodOxygenQuickAccessSwitch", 0);\r
}\r
else if (QuickAccessRadioButton[1]->GetState() == UICheckBox::SELECTED)\r
{\r
SecondaryFunctionModel::GetInstance()->KeepHeartRateOrBloodOxygenQuickAccessRadioButtonSelectState(1);\r
+ ConfigModel::GetInstance()->WriteJsonData(ConfigModel::GetInstance()->GetcJSON(), "HeartRateOrBloodOxygenQuickAccessSwitch", 1);\r
}\r
\r
// 循环删除 UIImageView 和 UIRadioButton指针数组\r
namespace OHOS
{
+ SecondaryFunctionModel::SecondaryFunctionModel()
+ {
+ ConfigModel *p_ConfigModel = ConfigModel::GetInstance();
+ HeartRateOrBloodOxygenQuickAccessSwitch = (p_ConfigModel->ReadJsonData<bool>(p_ConfigModel->GetcJSON(), "HeartRateOrBloodOxygenQuickAccessSwitch"));
+ }
+ SecondaryFunctionModel::~SecondaryFunctionModel() {}
+
SecondaryFunctionModel *SecondaryFunctionModel::GetInstance(void)
{
static SecondaryFunctionModel instacne;
{
- "RaiseToBrightnessCheckBoxButtonState":true
+ "RaiseToBrightnessCheckBoxButtonState": false,
+ "ScreenBrightnessValue": 255,
+ "ScreenDurationRadioButtonSlectValue": 1,
+ "TradionalBlueToothToggleButtonState": false,
+ "HeartRateOrBloodOxygenQuickAccessSwitch": 0
}
\ No newline at end of file