Fork of the espurna firmware for `mhsw` switches
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.1 KiB

  1. /*
  2. SSDP MODULE
  3. Copyright (C) 2017 by Xose Pérez <xose dot perez at gmail dot com>
  4. Uses SSDP library by PawelDino (https://github.com/PawelDino)
  5. https://github.com/esp8266/Arduino/issues/2283#issuecomment-299635604
  6. */
  7. #if SSDP_SUPPORT
  8. #include <libs/SSDPDevice.h>
  9. void ssdpSetup() {
  10. SSDPDevice.setName(getSetting("hostname"));
  11. SSDPDevice.setDeviceType("urn:schemas-upnp-org:device:BinaryLight:1");
  12. SSDPDevice.setSchemaURL("description.xml");
  13. SSDPDevice.setSerialNumber(ESP.getChipId());
  14. SSDPDevice.setURL("/");
  15. SSDPDevice.setModelName(DEVICE);
  16. SSDPDevice.setModelNumber("");
  17. SSDPDevice.setManufacturer(MANUFACTURER);
  18. #if WEB_SUPPORT
  19. webServer()->on("/description.xml", HTTP_GET, [](AsyncWebServerRequest *request) {
  20. DEBUG_MSG_P(PSTR("[SSDP] Schema request\n"));
  21. String schema = SSDPDevice.schema();
  22. Serial.println(schema);
  23. request->send(200, "application/xml", schema.c_str());
  24. });
  25. #endif
  26. }
  27. void ssdpLoop() {
  28. SSDPDevice.handleClient();
  29. }
  30. #endif // SSDP_SUPPORT