增加设置心率周期检测AT
authorCaisking <3449750381@qq.com>
Mon, 1 Jul 2024 11:49:55 +0000 (19:49 +0800)
committerCaisking <3449750381@qq.com>
Mon, 1 Jul 2024 11:49:55 +0000 (19:49 +0800)
code/sdk/drivers/peripheral/config/src/ConfigModel.cpp
code/sdk/drivers/peripheral/utils/custom_utils_at_cmd.c

index 407f918..ace4e6b 100644 (file)
@@ -1460,6 +1460,11 @@ int get_wake_up_time_from_config_model(void)
     wake_up_time = OHOS::ConfigModel::GetInstance()->get_configData_int(OHOS::ConfigModel::CONFIGMODEL_ITEM_SLEEP_GET_UP);
     return wake_up_time;
 }
+void set_config_heart(int heartRateDetectionFreq)
+{
+     // 设置心率检测频率
+    OHOS::ConfigModel::GetInstance()->set_condigData_Int(OHOS::ConfigModel::CONFIGMODEL_ITEM_HEARTRATE_DETECTED, heartRateDetectionFreq);
+}
 #ifdef __cplusplus
 #if __cplusplus
 }
index 01f3818..03f5954 100644 (file)
@@ -8,6 +8,7 @@
 #include "debug_print.h"
 #include "custom_runtime.h"
 #include "lwip/altcp_tls.h"
+#include "ConfigModelC.h"
 
 #define ARRAY_COUNT(array) (sizeof(array) / sizeof(array[0]))
 #define CUSTOM_UTILS_MAX_ARGC            8
@@ -690,6 +691,52 @@ static uint32_t custom_mem_debug(uint8_t *para, uint32_t paraLen, char *strCommo
 
     return ERRCODE_SUCC;
 }
+    /*恢复出厂设置*/
+    static uint32_t custom_restore_factory_settings(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
+    {
+        UNUSED(para);
+        UNUSED(paraLen);
+        UNUSED(strCommonCmd);
+
+        // 执行恢复出厂设置的操作
+        uapi_restore_factory_setting();
+
+        PRINT("Restoring Factory Settings...\n");
+        return ERRCODE_SUCC;
+    }
+
+#if 1
+    /*设置心率检测频率*/
+    static uint32_t custom_set_heart(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
+    {
+        UNUSED(strCommonCmd);
+
+        uint8_t argv[CUSTOM_UTILS_MAX_ARGC][CUSTOM_UTILS_MAX_ARGV_LEN] = {0};
+        uint32_t argc = 0;
+
+        int ret = ConvertCmdToParam(para, paraLen, argv, &argc);
+        if (ret != CUSTOM_UTILS_SUCCESS)
+        {
+            PRINT("CUSTOM_UTILSTEST ATCMD Convert Command Failed\n");
+            return ERRCODE_FAIL;
+        }
+
+        if (argc != 1)
+        {
+            PRINT("CUSTOM_UTILSTEST power_test ATCMD Set Parameter Failed argc %d\r\n");
+            return ERRCODE_FAIL;
+        }
+        int heartRateDetectionFreq = atol((char *)argv[0]);
+
+        // 设置心率检测频率
+        set_config_heart(heartRateDetectionFreq);
+
+        PRINT("heartRateDetectionFreq is %d\n", heartRateDetectionFreq);
+        return ERRCODE_SUCC;
+    }
+#endif
+
+ 
 static const at_cmd_table_t g_custom_utils_cmd[] = {
     { (char *)"AT^CUSTOM_SN",      custom_utils_setsn, (char *)"123456789ABCDEF2345678" },
     { (char *)"AT^CUSTOM_SN_REQ",  custom_utils_getsn, (char *)" " },
@@ -740,7 +787,9 @@ static const at_cmd_table_t g_custom_utils_cmd[] = {
     { (char *)"AT^EFUSEWRITE",      custom_uapi_efuse_test_write, (char *)" " },
     { (char *)"AT^SCHEDDEBUG",      custom_task_sched_debug, (char *)" " },
     { (char *)"AT^MEMDEBUG",      custom_mem_debug, (char *)" " },
-
+    
+    {(char *)"AT^RESTORE", custom_restore_factory_settings, (char *)" "},
+    {(char *)"AT^SETHEART", custom_set_heart, (char *)" "},
 };