forked from xiaozhi/xiaozhi-esp32
修复唤醒后亮红灯不说话的bug
This commit is contained in:
@@ -154,6 +154,7 @@ bool MqttProtocol::OpenAudioChannel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
session_id_ = "";
|
session_id_ = "";
|
||||||
|
xEventGroupClearBits(event_group_handle_, MQTT_PROTOCOL_SERVER_HELLO_EVENT);
|
||||||
|
|
||||||
// 发送 hello 消息申请 UDP 通道
|
// 发送 hello 消息申请 UDP 通道
|
||||||
std::string message = "{";
|
std::string message = "{";
|
||||||
@@ -234,6 +235,7 @@ void MqttProtocol::ParseServerHello(const cJSON* root) {
|
|||||||
auto session_id = cJSON_GetObjectItem(root, "session_id");
|
auto session_id = cJSON_GetObjectItem(root, "session_id");
|
||||||
if (session_id != nullptr) {
|
if (session_id != nullptr) {
|
||||||
session_id_ = session_id->valuestring;
|
session_id_ = session_id->valuestring;
|
||||||
|
ESP_LOGI(TAG, "Session ID: %s", session_id_.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get sample rate from hello message
|
// Get sample rate from hello message
|
||||||
|
|||||||
@@ -30,6 +30,9 @@ public:
|
|||||||
inline int server_sample_rate() const {
|
inline int server_sample_rate() const {
|
||||||
return server_sample_rate_;
|
return server_sample_rate_;
|
||||||
}
|
}
|
||||||
|
inline const std::string& session_id() const {
|
||||||
|
return session_id_;
|
||||||
|
}
|
||||||
|
|
||||||
void OnIncomingAudio(std::function<void(std::vector<uint8_t>&& data)> callback);
|
void OnIncomingAudio(std::function<void(std::vector<uint8_t>&& data)> callback);
|
||||||
void OnIncomingJson(std::function<void(const cJSON* root)> callback);
|
void OnIncomingJson(std::function<void(const cJSON* root)> callback);
|
||||||
|
|||||||
Reference in New Issue
Block a user