bool LoadRemindersFromFile();
std::string GetReminderFilePath() const;
uint32_t GenerateReminderId();
+
+ // 对话文本管理函数
+ std::string GetTextStr();
+ void SetTextStr(const char *textId);
+ void ClearTextStr();
+ size_t GetTextLength() const;
+ bool IsTextEmpty() const;
private:
ThunderBirdModel();
// 提醒数据存储
std::vector<ReminderData> m_reminders;
uint32_t m_nextReminderId;
+ std::string m_currentTimeStr;
};
}
#include "wearable_log.h"
#include <sys/time.h>
#include <service/graphic_service.h>
- #include "wearable_log.h"
#include "custom_utils.h"
#include <string.h>
#include <algorithm>
return "模拟对话文本"; // 模拟返回
}
- bool ThunderBirdModel::EndConversation()
- {
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::EndConversation");
-
- // TODO: 实现结束对话逻辑
- // 1. 清理对话状态
- // 2. 保存对话记录
- // 3. 释放相关资源
-
- return true; // 模拟成功
- }
+ bool ThunderBirdModel::EndConversation()
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::EndConversation");
+
+ // 清理对话状态
+ ClearTextStr();
+
+ // TODO: 实现其他结束对话逻辑
+ // 1. 保存对话记录
+ // 2. 释放相关资源
+ // 3. 重置对话状态
+
+ return true; // 模拟成功
+ }
// ==================== 哄睡模式相关函数 ====================
bool ThunderBirdModel::StartLullabyMode()
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Loaded %u reminders from file", static_cast<uint32_t>(m_reminders.size()));
return true;
}
+
+ // ==================== 对话文本管理函数 ====================
+ std::string ThunderBirdModel::GetTextStr()
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::GetTextStr, length: %zu", m_currentTimeStr.length());
+ return m_currentTimeStr;
+ }
+
+ void ThunderBirdModel::SetTextStr(const char *textId)
+ {
+ if (textId == nullptr) {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SetTextStr: textId is null");
+ return;
+ }
+
+ // 添加文本内容
+ m_currentTimeStr += textId;
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SetTextStr: added text, current length: %zu", m_currentTimeStr.length());
+ }
+
+ void ThunderBirdModel::ClearTextStr()
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ClearTextStr: clearing text, previous length: %zu", m_currentTimeStr.length());
+ m_currentTimeStr.clear();
+ }
+
+ size_t ThunderBirdModel::GetTextLength() const
+ {
+ return m_currentTimeStr.length();
+ }
+
+ bool ThunderBirdModel::IsTextEmpty() const
+ {
+ return m_currentTimeStr.empty();
+ }
/*
1、新手引导