forked from xiaozhi/xiaozhi-esp32
add iot framework
This commit is contained in:
@@ -57,3 +57,14 @@ void Protocol::SendStopListening() {
|
||||
std::string message = "{\"session_id\":\"" + session_id_ + "\",\"type\":\"listen\",\"state\":\"stop\"}";
|
||||
SendText(message);
|
||||
}
|
||||
|
||||
void Protocol::SendIotDescriptors(const std::string& descriptors) {
|
||||
std::string message = "{\"session_id\":\"" + session_id_ + "\",\"type\":\"iot\",\"descriptors\":" + descriptors + "}";
|
||||
SendText(message);
|
||||
}
|
||||
|
||||
void Protocol::SendIotStates(const std::string& states) {
|
||||
std::string message = "{\"session_id\":\"" + session_id_ + "\",\"type\":\"iot\",\"states\":" + states + "}";
|
||||
SendText(message);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,8 @@ public:
|
||||
virtual void SendStartListening(ListeningMode mode);
|
||||
virtual void SendStopListening();
|
||||
virtual void SendAbortSpeaking(AbortReason reason);
|
||||
virtual void SendIotDescriptors(const std::string& descriptors);
|
||||
virtual void SendIotStates(const std::string& states);
|
||||
|
||||
protected:
|
||||
std::function<void(const cJSON* root)> on_incoming_json_;
|
||||
|
||||
Reference in New Issue
Block a user