--- /dev/null
+/***
+ * @Date: 2024-06-17 15:17:33
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-06-17 15:19:22
+ * @FilePath: /XTS_FD230/FD230/code/sdk/application/wearable/fd230app/nativeui/rtcservice/include/rtc_at_cmd.h
+ */
+
+#ifndef RTCTEST_AT_CMD_H
+#define RTCTEST_AT_CMD_H
+
+#include <stdint.h>
+#include <stdio.h>
+#include "errcode.h"
+#include "soc_osal.h"
+#include "at_cmd_api.h"
+
+#ifdef __cplusplus
+#if __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+#endif /* __cplusplus */
+
+ at_cmd_table_t *get_rtc_cmd_table(uint32_t *cmd_count);
+
+#ifdef __cplusplus
+#if __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* __cplusplus */
+
+#endif
--- /dev/null
+#ifdef __cplusplus
+#if __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+#endif /* __cplusplus */
+
+#include "at_cmd_api.h"
+#include "pm_control.h"
+#include "debug_print.h"
+#include "RtcService.h"
+#include "string.h"
+#include "rtc_at_cmd.h"
+#include "graphic_service_wrapper.h"
+
+#define ARRAY_COUNT(array) (sizeof(array) / sizeof(array[0]))
+#define RTCTEST_MAX_ARGC 8
+#define RTCTEST_MAX_ARGV_LEN 64
+
+#define RTCTEST_SUCCESS 0
+#define RTCTEST_FAILED (-1)
+
+ // bool is_rtc_print_enabled = true;
+ static int ConvertCmdToParam(uint8_t *para, uint32_t paraLen,
+ uint8_t argv[RTCTEST_MAX_ARGC][RTCTEST_MAX_ARGV_LEN], uint32_t *argc)
+ {
+ uint32_t pos = 0;
+ *argc = 0;
+
+ for (uint32_t i = 0; i < paraLen; i++)
+ {
+ if ((para[i] == ' ' || para[i] == '\n') && pos != 0)
+ {
+ argv[*argc][pos] = '\0';
+ *argc += 1;
+ pos = 0;
+ if (*argc >= RTCTEST_MAX_ARGC)
+ {
+ return RTCTEST_FAILED;
+ }
+ }
+ else
+ {
+ argv[*argc][pos] = para[i];
+ pos++;
+ if (pos >= RTCTEST_MAX_ARGV_LEN)
+ {
+ return RTCTEST_FAILED;
+ }
+ }
+ }
+ if (pos != 0)
+ {
+ *argc += 1;
+ }
+
+ return RTCTEST_SUCCESS;
+ }
+
+ static uint32_t rtc_do_test(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
+ {
+ UNUSED(strCommonCmd);
+ uint8_t argv[RTCTEST_MAX_ARGC][RTCTEST_MAX_ARGV_LEN] = {0};
+ uint32_t argc = 0;
+
+ int ret = ConvertCmdToParam(para, paraLen, argv, &argc);
+ if (ret != RTCTEST_SUCCESS)
+ {
+ PRINT("RTCTESTTEST ATCMD Convert Command Failed\n");
+ return ERRCODE_FAIL;
+ }
+
+ if (argc != 1)
+ {
+ PRINT("RTCTESTTEST ATCMD Set Parameter Failed\n");
+ return ERRCODE_FAIL;
+ }
+ char *mode = (char *)argv[0];
+
+ PRINT("RTCTESTTEST ATCMD %s\n", mode);
+
+ if (strcmp(mode, "enable") == 0)
+ {
+ printf("rtc cmd enable\r\n");
+ set_printf(true);
+ }
+ else if (strcmp(mode, "disable") == 0)
+ {
+ printf("rtc cmd disable\r\n");
+ set_printf(false);
+ }
+ return ERRCODE_SUCC;
+ }
+
+ static const at_cmd_table_t g_rtc_cmd[] = {
+ {(char *)"AT^RTCTEST", rtc_do_test, (char *)"enable"},
+ {(char *)"AT^RTCTEST", rtc_do_test, (char *)"disable"},
+ };
+
+ at_cmd_table_t *get_rtc_cmd_table(uint32_t *cmd_count)
+ {
+ *cmd_count = ARRAY_COUNT(g_rtc_cmd);
+ return (at_cmd_table_t *)g_rtc_cmd;
+ }
+
+#ifdef __cplusplus
+#if __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* __cplusplus */
\ No newline at end of file
#endif
+// 全局变量,用于标记刷新操作是否执行
+bool refresh_executed = false;
+bool printf_set = false;
+
+void set_printf(bool set)
+{
+ printf("set_printf %d\r\n",set);
+ printf_set = set;
+}
+
static void UikitRTCCallBack(uintptr_t data)
{
(void)(data);
if (!g_initialized || !g_isScreenOn) {
return;
}
+ if(printf_set)
+ {
+ printf("[refresh_executed is %d g_rtcHandle is %d g_timeInterval is %d ]\r\n",refresh_executed,g_rtcHandle,g_timeInterval);
+ }
uapi_rtc_start(g_rtcHandle, g_timeInterval, UikitRTCCallBack, 0);
GraphicService::GetInstance()->UpdateGraphicEvent();
+
+ // 标记刷新操作已执行
+ refresh_executed = true;
}
void SetFrequenceInner(int freq)