/* SSDP MODULE Copyright (C) 2017-2018 by Xose PĂ©rez Uses SSDP library by PawelDino (https://github.com/PawelDino) https://github.com/esp8266/Arduino/issues/2283#issuecomment-299635604 Module key prefix: ssdp */ #if SSDP_SUPPORT #include const char _ssdp_template[] PROGMEM = "" "" "" "1" "0" "" "http://%s:%u/" "" "%s" "%s" "/" "%u" "%s" "%s" "%s" "%s" "%s" "uuid:38323636-4558-4dda-9188-cda0e6%06x" "" "\r\n" "\r\n"; void ssdpSetup() { webServer()->on("/description.xml", HTTP_GET, [](AsyncWebServerRequest *request) { DEBUG_MSG_P(PSTR("[SSDP] Schema request\n")); IPAddress ip = WiFi.localIP(); uint32_t chipId = ESP.getChipId(); char response[strlen_P(_ssdp_template) + 100]; snprintf_P(response, sizeof(response), _ssdp_template, WiFi.localIP().toString().c_str(), // ip webPort(), // port SSDP_DEVICE_TYPE, // device type getHostname().c_str(), // friendlyName chipId, // serialNumber APP_NAME, // modelName APP_VERSION, // modelNumber APP_WEBSITE, // modelURL getDevice(), // manufacturer "", // manufacturerURL chipId // UUID ); request->send(200, "text/xml", response); }); SSDP.setSchemaURL("description.xml"); SSDP.setHTTPPort(webPort()); SSDP.setDeviceType(SSDP_DEVICE_TYPE); //https://github.com/esp8266/Arduino/issues/2283 SSDP.setName(getHostname()); SSDP.setSerialNumber(String(ESP.getChipId())); SSDP.setModelName(APP_NAME); SSDP.setModelNumber(APP_VERSION); SSDP.setModelURL(APP_WEBSITE); SSDP.setManufacturer(DEVICE_NAME); SSDP.setManufacturerURL(""); SSDP.setURL("/"); SSDP.begin(); DEBUG_MSG_P(PSTR("[SSDP] Started\n")); } #endif // SSDP_SUPPORT