File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 88
99namespace iot {
1010
11+ #if CONFIG_IOT_PROTOCOL_XIAOZHI
1112static std::map<std::string, std::function<Thing*()>>* thing_creators = nullptr ;
13+ #endif
1214
1315void RegisterThing (const std::string& type, std::function<Thing*()> creator) {
16+ #if CONFIG_IOT_PROTOCOL_XIAOZHI
1417 if (thing_creators == nullptr ) {
1518 thing_creators = new std::map<std::string, std::function<Thing*()>>();
1619 }
1720 (*thing_creators)[type] = creator;
21+ #endif
1822}
1923
2024Thing* CreateThing (const std::string& type) {
25+ #if CONFIG_IOT_PROTOCOL_XIAOZHI
2126 auto creator = thing_creators->find (type);
2227 if (creator == thing_creators->end ()) {
2328 ESP_LOGE (TAG, " Thing type not found: %s" , type.c_str ());
2429 return nullptr ;
2530 }
2631 return creator->second ();
32+ #else
33+ return nullptr ;
34+ #endif
2735}
2836
2937std::string Thing::GetDescriptorJson () {
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ void McpServer::AddCommonTools() {
3030 return Board::GetInstance ().GetDeviceStatusJson ();
3131 });
3232
33- AddTool (" self.speaker .set_volume" ,
33+ AddTool (" self.audio_speaker .set_volume" ,
3434 " 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." ,
3535 PropertyList ({
3636 Property (" volume" , kPropertyTypeInteger , 0 , 100 )
You can’t perform that action at this time.
0 commit comments