forked from external-repos/ESP32-CAM-ONVIF
Bug fix
This commit is contained in:
@@ -43,6 +43,25 @@ String getDeviceInfoResponse() {
|
||||
"</SOAP-ENV:Envelope>";
|
||||
}
|
||||
|
||||
String getStreamUriResponse() {
|
||||
String ip = WiFi.localIP().toString();
|
||||
return
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
|
||||
"<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://www.w3.org/2003/05/soap-envelope\" "
|
||||
"xmlns:trt=\"http://www.onvif.org/ver10/media/wsdl\">"
|
||||
"<SOAP-ENV:Body>"
|
||||
"<trt:GetStreamUriResponse>"
|
||||
"<trt:MediaUri>"
|
||||
"<tt:Uri>rtsp://" + ip + ":554/mjpeg/1</tt:Uri>"
|
||||
"<tt:InvalidAfterConnect>false</tt:InvalidAfterConnect>"
|
||||
"<tt:InvalidAfterReboot>false</tt:InvalidAfterReboot>"
|
||||
"<tt:Timeout>PT0S</tt:Timeout>"
|
||||
"</trt:MediaUri>"
|
||||
"</trt:GetStreamUriResponse>"
|
||||
"</SOAP-ENV:Body>"
|
||||
"</SOAP-ENV:Envelope>";
|
||||
}
|
||||
|
||||
void handle_onvif_soap() {
|
||||
String req = onvifServer.arg(0);
|
||||
if (req.indexOf("GetCapabilities") > 0) {
|
||||
@@ -93,7 +112,7 @@ void handle_onvif_discovery() {
|
||||
void onvif_server_start() {
|
||||
onvifServer.on("/onvif/device_service", HTTP_POST, handle_onvif_soap);
|
||||
onvifServer.begin();
|
||||
onvifUDP.beginMulticast(WiFi.localIP(), IPAddress(239,255,255,250), 3702);
|
||||
onvifUDP.beginMulticast(IPAddress(239,255,255,250), 3702); // Fixed: use only 2 args
|
||||
Serial.println("[INFO] ONVIF server started.");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
#include <WiFi.h>
|
||||
#include <WiFiUdp.h>
|
||||
#include <WebServer.h>
|
||||
|
||||
void onvif_server_start();
|
||||
void onvif_server_loop();
|
||||
|
||||
@@ -31,7 +31,9 @@ void web_config_start() {
|
||||
return;
|
||||
}
|
||||
// Protect static files with authentication
|
||||
webConfigServer.serveStatic("/", SPIFFS, "/").setDefaultFile("index.html").setAuthentication(WEB_USER, WEB_PASS);
|
||||
webConfigServer.serveStatic("/", SPIFFS, "/");
|
||||
webConfigServer.setDefaultFile("index.html");
|
||||
webConfigServer.setAuthentication(WEB_USER, WEB_PASS);
|
||||
|
||||
// === API ENDPOINTS ===
|
||||
webConfigServer.on("/api/status", HTTP_GET, []() {
|
||||
@@ -77,10 +79,10 @@ void web_config_start() {
|
||||
if (doc.containsKey("awb")) s->set_whitebal(s, doc["awb"]);
|
||||
if (doc.containsKey("awb_gain")) s->set_awb_gain(s, doc["awb_gain"]);
|
||||
if (doc.containsKey("wb_mode")) s->set_wb_mode(s, doc["wb_mode"]);
|
||||
if (doc.containsKey("aec")) s->set_aec(s, doc["aec"]);
|
||||
if (doc.containsKey("aec")) s->set_aec2(s, doc["aec"]);
|
||||
if (doc.containsKey("aec2")) s->set_aec2(s, doc["aec2"]);
|
||||
if (doc.containsKey("ae_level")) s->set_ae_level(s, doc["ae_level"]);
|
||||
if (doc.containsKey("agc")) s->set_agc(s, doc["agc"]);
|
||||
if (doc.containsKey("agc")) s->set_gain_ctrl(s, doc["agc"]);
|
||||
if (doc.containsKey("gainceiling")) s->set_gainceiling(s, doc["gainceiling"]);
|
||||
if (doc.containsKey("bpc")) s->set_bpc(s, doc["bpc"]);
|
||||
if (doc.containsKey("wpc")) s->set_wpc(s, doc["wpc"]);
|
||||
|
||||
Reference in New Issue
Block a user