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.

43 lines
1.1 KiB

6 years ago
  1. /*
  2. SSDP MODULE
  3. Copyright (C) 2017-2018 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. request->send(200, "application/xml", schema.c_str());
  23. });
  24. #endif
  25. // Register loop
  26. espurnaRegisterLoop(ssdpLoop);
  27. }
  28. void ssdpLoop() {
  29. SSDPDevice.handleClient();
  30. }
  31. #endif // SSDP_SUPPORT