mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-30 20:09:14 +03:00
ESP32 SSDP
This commit is contained in:
@@ -2,6 +2,8 @@
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include "Global.h"
|
#include "Global.h"
|
||||||
|
|
||||||
|
uint32_t ESP_getChipId();
|
||||||
|
|
||||||
const String getChipId();
|
const String getChipId();
|
||||||
|
|
||||||
void setLedStatus(LedStatus_t status);
|
void setLedStatus(LedStatus_t status);
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ lib_deps =
|
|||||||
AsyncTCP
|
AsyncTCP
|
||||||
ESP32Servo
|
ESP32Servo
|
||||||
LITTLEFS
|
LITTLEFS
|
||||||
|
luc-github/ESP32SSDP
|
||||||
monitor_filters = esp32_exception_decoder
|
monitor_filters = esp32_exception_decoder
|
||||||
;upload_speed = 921600
|
;upload_speed = 921600
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ void SsdpInit() {
|
|||||||
ssdpDescription += xmlNode(F("modelURL"), F("https://github.com/IoTManagerProject/IoTManager/wiki"));
|
ssdpDescription += xmlNode(F("modelURL"), F("https://github.com/IoTManagerProject/IoTManager/wiki"));
|
||||||
ssdpDescription += xmlNode(F("manufacturer"), F("Borisenko Dmitry"));
|
ssdpDescription += xmlNode(F("manufacturer"), F("Borisenko Dmitry"));
|
||||||
ssdpDescription += xmlNode(F("manufacturerURL"), F("https://github.com/IoTManagerProject/IoTManager"));
|
ssdpDescription += xmlNode(F("manufacturerURL"), F("https://github.com/IoTManagerProject/IoTManager"));
|
||||||
ssdpDescription += xmlNode(F("UDN"), "uuid:38323636-4558-4dda-9188-cda0e6" + decToHex(ESP.getChipId(), 6));
|
ssdpDescription += xmlNode(F("UDN"), "uuid:38323636-4558-4dda-9188-cda0e6" + decToHex(ESP_getChipId(), 6));
|
||||||
ssdpDescription = xmlNode("device", ssdpDescription);
|
ssdpDescription = xmlNode("device", ssdpDescription);
|
||||||
ssdpHeder += ssdpDescription;
|
ssdpHeder += ssdpDescription;
|
||||||
ssdpSend += ssdpHeder;
|
ssdpSend += ssdpHeder;
|
||||||
|
|||||||
@@ -3,23 +3,34 @@
|
|||||||
#include "Global.h"
|
#include "Global.h"
|
||||||
#include "Utils/PrintMessage.h"
|
#include "Utils/PrintMessage.h"
|
||||||
|
|
||||||
|
|
||||||
const String getUniqueId(const char* name) {
|
const String getUniqueId(const char* name) {
|
||||||
return String(name) + getMacAddress();
|
return String(name) + getMacAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
const String getChipId() {
|
uint32_t ESP_getChipId(void) {
|
||||||
String res;
|
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
char buf[32] = {0};
|
uint32_t id = 0;
|
||||||
uint32_t mac = ESP.getEfuseMac();
|
for (uint32_t i = 0; i < 17; i = i + 8) {
|
||||||
sprintf(buf, "%0X", mac);
|
id |= ((ESP.getEfuseMac() >> (40 - i)) & 0xff) << i;
|
||||||
res = String(buf);
|
}
|
||||||
|
return id;
|
||||||
|
#else
|
||||||
|
return ESP.getChipId();
|
||||||
#endif
|
#endif
|
||||||
#ifdef ESP8266
|
}
|
||||||
res = String(ESP.getChipId()) + "-" + String(ESP.getFlashChipId());
|
|
||||||
|
uint32_t ESP_getFlashChipId(void) {
|
||||||
|
#ifdef ESP32
|
||||||
|
// Нет аналогичной (без доп.кода) функций в 32
|
||||||
|
// надо использовать другой id - варианты есть
|
||||||
|
return ESP_getChipId();
|
||||||
|
#else
|
||||||
|
return ESP.getFlashChipId();
|
||||||
#endif
|
#endif
|
||||||
return res;
|
}
|
||||||
|
|
||||||
|
const String getChipId() {
|
||||||
|
return String(ESP_getChipId()) + "-" + String(ESP_getFlashChipId());
|
||||||
}
|
}
|
||||||
|
|
||||||
void setChipId() {
|
void setChipId() {
|
||||||
|
|||||||
Reference in New Issue
Block a user