Major Changes:
- Merged latest Qt5 devel content from dlbo (292 files changed, 7 new dirs)
- Consolidated forward-declarations and include folders
- Removed unneeded modules per Niklas' repo check list
Build System Fixes:
- Fixed CMake VERSION_GREATER syntax in ParticipantManagement/CMakeLists.txt
- Added VLC packages (libvlc-dev, vlc-plugin-base) to docker_build.sh
- Added PostgreSQL dev packages (libpq-dev, postgresql-server-dev-all) to Dockerfile
- Fixed locale warnings (ANSI_X3.4-1968 → C.UTF-8)
- Fixed ArcGIS SDK path warnings when BUILD_ARCGIS=OFF
Code Generation Fixes:
- Fixed IDL enum collisions (PortType→CorePortType/DdsutPortType, PdmEventType)
- Fixed Grantlee template svc_translation.cpp.grantlee:
- Changed {{ idl_enum.name }}_def:: to {{ idl_enum.name }}::
- Fixed .underlying() calls for C++11 scoped enums (enum class)
- Removed generated files from repo (moc_*, *_dtc.h, *_ftc.h)
Validation:
- BUILD_RTI=ON: SUCCESS
- BUILD_RTI=OFF: SUCCESS
- C++17 standard maintained for RTI 7.7 compatibility
- Ubuntu 26.04 Docker environment verified
Remaining Warnings (expected):
- BgViewer, KDChart, KDReports, Poppler-Qt6 not found (optional features)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
130 lines
3.9 KiB
C++
130 lines
3.9 KiB
C++
/**
|
|
* @RDE_HEADER@
|
|
* VapixConfig configurates Axis Cameras through Axis HTTP API Vapix
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Terrell Scharfenberg, SLSE, 2016-05-27
|
|
*/
|
|
|
|
#include "vapixconfig.h"
|
|
|
|
#include "config.h"
|
|
#include "httprequesthandler.h"
|
|
#include "request.h"
|
|
#include <QDebug>
|
|
#include <QUrl>
|
|
|
|
namespace VapixConfig
|
|
{
|
|
VapixConfig::VapixConfig(QNetworkAccessManager *networkAccessManager, QObject *parent)
|
|
: QObject(parent)
|
|
, m_networkAccessManager(networkAccessManager)
|
|
, m_requestHandler(new HTTPRequestHandler)
|
|
, m_config(new Config)
|
|
{
|
|
// connect(m_networkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));
|
|
}
|
|
|
|
VapixConfig::~VapixConfig()
|
|
{
|
|
delete m_requestHandler;
|
|
delete m_config;
|
|
}
|
|
|
|
// Init is needed to set the required parameter like ip,password and username.
|
|
void VapixConfig::init(const QString &ip, const QString &password, const QString &username)
|
|
{
|
|
m_ip = ip;
|
|
m_password = password;
|
|
m_username = username;
|
|
|
|
m_requestHandler->init(ip, password, username);
|
|
|
|
connect(this, &VapixConfig::setConfigFinished, this, &VapixConfig::startNextRequest);
|
|
connect(this, &VapixConfig::setConfigError, this, &VapixConfig::configError);
|
|
}
|
|
// Gets the current configuration for initialized camera
|
|
void VapixConfig::getConfig()
|
|
{
|
|
const QVector<QString> tempList({QLatin1String("Image"),
|
|
QLatin1String("Motion"),
|
|
QLatin1String("EventServers"),
|
|
QLatin1String("Event"),
|
|
QLatin1String("Event.*.Actions")});
|
|
m_config->init();
|
|
for (const QString ¶mName : tempList)
|
|
{
|
|
const QVector<QMap<QString,QString>> paramList = m_requestHandler->getParams(paramName, m_networkAccessManager);
|
|
typedef QMap<QString,QString> strMap;
|
|
for (const strMap &map : paramList)
|
|
m_config->addElementToXml(map, paramName);
|
|
}
|
|
}
|
|
// to save the configuration to a XML
|
|
void VapixConfig::saveConfig(const QString &savePath)
|
|
{
|
|
m_config->saveConfig(savePath);
|
|
}
|
|
|
|
void VapixConfig::resetConfig()
|
|
{
|
|
const QVector<QString> paramList({QLatin1String("Motion"),
|
|
QLatin1String("EventServers.TCP"),
|
|
QLatin1String("Event")});
|
|
for (const QString ¶mName : paramList)
|
|
m_requestHandler->removeParams(paramName, m_networkAccessManager);
|
|
qDebug() << "Parameter resetted!";
|
|
}
|
|
|
|
//Configurates initialized camera
|
|
//TO-DO: Need to check for the right Event-ID for "Action"
|
|
bool VapixConfig::setConfig(const QString &xmlString)
|
|
{
|
|
int ID = 0;
|
|
if (!m_config->processConfig(xmlString))
|
|
{
|
|
emit setConfigError(QLatin1String("+++Error while setting config+++"));
|
|
return false;
|
|
}
|
|
// fill queue with urls
|
|
for (const auto &map : m_config->getImageList())
|
|
m_requestQueue.enqueue(Request::updateImageParams(map, m_ip));
|
|
for (const auto &map : m_config->getServerList())
|
|
m_requestQueue.enqueue(Request::addEventServer(map, m_ip));
|
|
for (const auto &map : m_config->getWindowList())
|
|
m_requestQueue.enqueue(Request::addMotionWindow(map, m_ip));
|
|
for (const auto &map : m_config->getEventList())
|
|
m_requestQueue.enqueue(Request::addEvent(map, m_ip));
|
|
for (const auto &map : m_config->getActionList())
|
|
m_requestQueue.enqueue(Request::addActionToEvent(map, ID, m_ip));
|
|
return true;
|
|
}
|
|
// dequeues the QQueue and send requests to camera in this recursive method
|
|
void VapixConfig::startNextRequest()
|
|
{
|
|
if (m_requestQueue.isEmpty())
|
|
{
|
|
qDebug() << "All requests done!";
|
|
emit requestsFinished();
|
|
return;
|
|
}
|
|
QUrl requestUrl;
|
|
requestUrl.setUrl(m_requestQueue.dequeue());
|
|
requestUrl.setUserName(m_username);
|
|
requestUrl.setPassword(m_password);
|
|
m_requestHandler->sendRequest(requestUrl, m_networkAccessManager);
|
|
startNextRequest();
|
|
|
|
}
|
|
void VapixConfig::startRequests()
|
|
{
|
|
emit setConfigFinished();
|
|
}
|
|
|
|
void VapixConfig::configError(const QString &error)
|
|
{
|
|
qDebug() << error;
|
|
}
|
|
} // namespace VapixConfig
|