diff --git a/main/iot/thing.cc b/main/iot/thing.cc index 88e4fc75..56a88a41 100644 --- a/main/iot/thing.cc +++ b/main/iot/thing.cc @@ -8,22 +8,30 @@ namespace iot { +#if CONFIG_IOT_PROTOCOL_XIAOZHI static std::map>* thing_creators = nullptr; +#endif void RegisterThing(const std::string& type, std::function creator) { +#if CONFIG_IOT_PROTOCOL_XIAOZHI if (thing_creators == nullptr) { thing_creators = new std::map>(); } (*thing_creators)[type] = creator; +#endif } Thing* CreateThing(const std::string& type) { +#if CONFIG_IOT_PROTOCOL_XIAOZHI auto creator = thing_creators->find(type); if (creator == thing_creators->end()) { ESP_LOGE(TAG, "Thing type not found: %s", type.c_str()); return nullptr; } return creator->second(); +#else + return nullptr; +#endif } std::string Thing::GetDescriptorJson() { diff --git a/main/mcp_server.cc b/main/mcp_server.cc index feece557..0e86ae39 100644 --- a/main/mcp_server.cc +++ b/main/mcp_server.cc @@ -30,7 +30,7 @@ void McpServer::AddCommonTools() { return Board::GetInstance().GetDeviceStatusJson(); }); - AddTool("self.speaker.set_volume", + AddTool("self.audio_speaker.set_volume", "Set the volume of the audio speaker. If the current volume is unknown, you must call `self.get_device_status` tool first and then call this tool.", PropertyList({ Property("volume", kPropertyTypeInteger, 0, 100)