forked from xiaozhi/xiaozhi-esp32
使用原始字符串字面量代替转义,提高可读性 (#861)
* 使用原始字符串字面量代替转义,提高可读性 * 使用原始字符串字面量代替转义,提高可读性 * 增加一个使用ESP-IDF Monitor作为输出显示内容的类 * 修改代码风格
This commit is contained in:
44
main/display/esplog_display.cc
Normal file
44
main/display/esplog_display.cc
Normal file
@@ -0,0 +1,44 @@
|
||||
#include "esplog_display.h"
|
||||
|
||||
#include "esp_log.h"
|
||||
|
||||
#define TAG "EspLogDisplay"
|
||||
|
||||
|
||||
EspLogDisplay::EspLogDisplay()
|
||||
{}
|
||||
|
||||
EspLogDisplay::~EspLogDisplay()
|
||||
{}
|
||||
|
||||
void EspLogDisplay::SetStatus(const char* status)
|
||||
{
|
||||
ESP_LOGW(TAG, "SetStatus: %s", status);
|
||||
}
|
||||
|
||||
void EspLogDisplay::ShowNotification(const char* notification, int duration_ms)
|
||||
{
|
||||
ESP_LOGW(TAG, "ShowNotification: %s", notification);
|
||||
}
|
||||
void EspLogDisplay::ShowNotification(const std::string ¬ification, int duration_ms)
|
||||
{
|
||||
ShowNotification(notification.c_str(), duration_ms);
|
||||
}
|
||||
|
||||
|
||||
void EspLogDisplay::SetEmotion(const char* emotion)
|
||||
{
|
||||
ESP_LOGW(TAG, "SetEmotion: %s", emotion);
|
||||
}
|
||||
|
||||
void EspLogDisplay::SetIcon(const char* icon)
|
||||
{
|
||||
ESP_LOGW(TAG, "SetIcon: %s", icon);
|
||||
}
|
||||
|
||||
void EspLogDisplay::SetChatMessage(const char* role, const char* content)
|
||||
{
|
||||
ESP_LOGW(TAG, "Role:%s", role);
|
||||
ESP_LOGW(TAG, " %s", content);
|
||||
}
|
||||
|
||||
28
main/display/esplog_display.h
Normal file
28
main/display/esplog_display.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef ESPLOG_DISPLAY_H_
|
||||
#define ESPLOG_DISPLAY_H_
|
||||
|
||||
#include "display.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
class EspLogDisplay : public Display {
|
||||
public:
|
||||
EspLogDisplay();
|
||||
~EspLogDisplay();
|
||||
|
||||
virtual void SetStatus(const char* status);
|
||||
virtual void ShowNotification(const char* notification, int duration_ms = 3000);
|
||||
virtual void ShowNotification(const std::string ¬ification, int duration_ms = 3000);
|
||||
virtual void SetEmotion(const char* emotion) override;
|
||||
virtual void SetChatMessage(const char* role, const char* content) override;
|
||||
virtual void SetIcon(const char* icon) override;
|
||||
virtual inline void SetPreviewImage(const lv_img_dsc_t* image) override {}
|
||||
virtual inline void SetTheme(const std::string& theme_name) override {}
|
||||
virtual inline void UpdateStatusBAR(bool update_all = false) override {}
|
||||
|
||||
protected:
|
||||
virtual inline bool Lock(int timeout_ms = 0) override { return true; }
|
||||
virtual inline void Unlock() override {}
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user