From 26b27dce391ecaa4769dad8bbdb04858ce7f9f73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Buisson?= Date: Thu, 30 Dec 2021 00:18:53 +0100 Subject: [PATCH 1/2] Add missing parameters --- src/bin/calaos_server/IPCam/Foscam.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/bin/calaos_server/IPCam/Foscam.cpp b/src/bin/calaos_server/IPCam/Foscam.cpp index 386f1732..02651772 100644 --- a/src/bin/calaos_server/IPCam/Foscam.cpp +++ b/src/bin/calaos_server/IPCam/Foscam.cpp @@ -20,6 +20,7 @@ ******************************************************************************/ #include "Foscam.h" #include "IOFactory.h" +#include using namespace Calaos; @@ -30,9 +31,15 @@ Foscam::Foscam(Params &p): { ioDoc->descriptionBaseSet(_("Foscam IP Camera/Encoder. Camera can be viewed directly inside calaos and used in rules.")); ioDoc->paramAdd("ptz", _("Set to true if camera has PTZ support"), IODoc::TYPE_BOOL, false, "false"); + ioDoc->paramAdd("zoom_step", "", IODoc::TYPE_STRING, false,"1"); + ioDoc->paramAdd("username", _("Username for accessing the camera"), IODoc::TYPE_STRING, true); + ioDoc->paramAdd("password", _("Password for user"), IODoc::TYPE_STRING, true); + ioDoc->paramAdd("host", _("IP Address"), IODoc::TYPE_STRING, true); + ioDoc->paramAdd("port", _("Port number"), IODoc::TYPE_STRING, true,"88"); if (param["ptz"] == "1" || param["ptz"] == "true") caps.Add("ptz", "true"); + } std::string Foscam::getVideoUrl() @@ -95,12 +102,14 @@ void Foscam::activateCapabilities(std::string cap, std::string cmd, std::string urlStop = "http://" + param["host"] + ":" + param["port"]; urlStop += "/cgi-bin/CGIProxy.fcgi"; if (valcmd.compare(0, 4, "zoom") == 0) - urlStop += "?cmd=zoomstop" ; + urlStop += "?cmd=zoomStop" ; else urlStop += "?cmd=ptzStopRun"; urlStop += "&usr=" + param["username"] + "&pwd=" + param["password"]; - - Timer::singleShot(0.500, [=]() + + //Commande d'arrêt du mouvement pour simuler du pas à pas + float moveDelay = 0.100 * (1 + std::stoi(param["zoom_step"])); + Timer::singleShot(moveDelay, [=]() { UrlDownloader::get(urlStop); }); From 04719bee25e8a5649103ee8a4cc28cc963f37c79 Mon Sep 17 00:00:00 2001 From: Raoul Hecky Date: Sat, 1 Jan 2022 19:34:16 +0100 Subject: [PATCH 2/2] fix str to int conversion --- src/bin/calaos_server/IPCam/Foscam.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bin/calaos_server/IPCam/Foscam.cpp b/src/bin/calaos_server/IPCam/Foscam.cpp index 02651772..cdb6738b 100644 --- a/src/bin/calaos_server/IPCam/Foscam.cpp +++ b/src/bin/calaos_server/IPCam/Foscam.cpp @@ -20,7 +20,6 @@ ******************************************************************************/ #include "Foscam.h" #include "IOFactory.h" -#include using namespace Calaos; @@ -108,7 +107,9 @@ void Foscam::activateCapabilities(std::string cap, std::string cmd, std::string urlStop += "&usr=" + param["username"] + "&pwd=" + param["password"]; //Commande d'arrêt du mouvement pour simuler du pas à pas - float moveDelay = 0.100 * (1 + std::stoi(param["zoom_step"])); + int zstep = 0; + Utils::from_string(param["zoom_step"], zstep); + float moveDelay = 0.100 * (1 + zstep); Timer::singleShot(moveDelay, [=]() { UrlDownloader::get(urlStop);