forked from xiaozhi/xiaozhi-esp32
MQTT会话超时与网络错误处理
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include <cJSON.h>
|
||||
#include <string>
|
||||
#include <functional>
|
||||
#include <chrono>
|
||||
|
||||
struct BinaryProtocol3 {
|
||||
uint8_t type;
|
||||
@@ -60,9 +61,13 @@ protected:
|
||||
std::function<void(const std::string& message)> on_network_error_;
|
||||
|
||||
int server_sample_rate_ = 16000;
|
||||
bool error_occurred_ = false;
|
||||
std::string session_id_;
|
||||
std::chrono::time_point<std::chrono::steady_clock> last_incoming_time_;
|
||||
|
||||
virtual void SendText(const std::string& text) = 0;
|
||||
virtual void SetError(const std::string& message);
|
||||
virtual bool IsTimeout() const;
|
||||
};
|
||||
|
||||
#endif // PROTOCOL_H
|
||||
|
||||
Reference in New Issue
Block a user