/* MDNS MODULE Copyright (C) 2017-2019 by Xose PĂ©rez */ // ----------------------------------------------------------------------------- // mDNS Server // ----------------------------------------------------------------------------- #include "mdns.h" #include "mqtt.h" #include "utils.h" #if MDNS_SERVER_SUPPORT #include #if MQTT_SUPPORT void _mdnsFindMQTT() { int count = MDNS.queryService("mqtt", "tcp"); DEBUG_MSG_P(PSTR("[MQTT] MQTT brokers found: %d\n"), count); for (int i=0; i(WEB_PORT))); done = true; } #endif #if TELNET_SUPPORT { MDNS.addService("telnet", "tcp", TELNET_PORT); done = true; } #endif #if OTA_ARDUINOOTA_SUPPORT { MDNS.addServiceTxt("arduino", "tcp", "app_name", APP_NAME); MDNS.addServiceTxt("arduino", "tcp", "app_version", getVersion()); MDNS.addServiceTxt("arduino", "tcp", "build_date", buildTime()); MDNS.addServiceTxt("arduino", "tcp", "mac", WiFi.macAddress()); MDNS.addServiceTxt("arduino", "tcp", "target_board", getBoardName()); MDNS.addServiceTxt("arduino", "tcp", "mem_size", String(static_cast(ESP.getFlashChipRealSize() / 1024), 10)); MDNS.addServiceTxt("arduino", "tcp", "sdk_size", String(static_cast(ESP.getFlashChipSize() / 1024), 10)); MDNS.addServiceTxt("arduino", "tcp", "free_space", String(static_cast(ESP.getFreeSketchSpace() / 1024), 10)); done = true; } #endif if (!done) { return; } wifiRegister([](justwifi_messages_t code, char * parameter) { if (code == MESSAGE_CONNECTED) { _mdnsServerStart(); #if MQTT_SUPPORT _mdnsFindMQTT(); #endif } if (code == MESSAGE_ACCESSPOINT_CREATED) { _mdnsServerStart(); } }); } #endif // MDNS_SERVER_SUPPORT