3131#include < QSplitter>
3232#include < QTableWidget>
3333#include < QTableWidgetItem>
34+ #include < QTimeZone>
3435#include < QtXml/QDomDocument>
3536#include < QUrl>
3637#include < QUuid>
@@ -49,8 +50,7 @@ static constexpr quint16 WSD_PORT = 3702;
4950 * — none of our authored payloads contain bare ampersands. */
5051static QByteArray sanitizeXmlAmpersands (const QByteArray &xml)
5152{
52- static const QRegularExpression re (QStringLiteral (
53- " &(?!(?:amp|lt|gt|quot|apos|#[0-9]+|#x[0-9a-fA-F]+);)" ));
53+ static const QRegularExpression re (QStringLiteral (" &(?!(?:amp|lt|gt|quot|apos|#[0-9]+|#x[0-9a-fA-F]+);)" ));
5454 QString s = QString::fromUtf8 (xml);
5555 s.replace (re, " &" );
5656 return s.toUtf8 ();
@@ -94,8 +94,7 @@ void OnvifDiscovery::start(int timeoutMs)
9494 * unicast responses sent back to our source port. ShareAddress lets
9595 * multiple processes on the host discover concurrently. */
9696 if (m_socket.state () != QAbstractSocket::BoundState) {
97- if (!m_socket.bind (QHostAddress::AnyIPv4, 0 ,
98- QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint)) {
97+ if (!m_socket.bind (QHostAddress::AnyIPv4, 0 , QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint)) {
9998 emit errorOccurred (m_socket.errorString ());
10099 m_running = false ;
101100 emit finished ();
@@ -208,8 +207,8 @@ void OnvifDiscovery::parseProbeMatch(const QByteArray &payload, const QHostAddre
208207 * even when reached via NAT or a different subnet), keep
209208 * the first XAddr's path but rewrite its host to the
210209 * responder. ODM and most other ONVIF clients do this. */
211- QStringList urls = xaddrs. at ( 0 ). toElement (). text (). split ( QRegularExpression ( " \\ s+ " ),
212- Qt::SkipEmptyParts);
210+ QStringList urls =
211+ xaddrs. at ( 0 ). toElement (). text (). split ( QRegularExpression ( " \\ s+ " ), Qt::SkipEmptyParts);
213212 QString chosen;
214213 for (const auto &u : urls) {
215214 QUrl url (u);
@@ -235,13 +234,13 @@ void OnvifDiscovery::parseProbeMatch(const QByteArray &payload, const QHostAddre
235234
236235 auto typesEl = m.elementsByTagNameNS (nsDisco, " Types" );
237236 if (typesEl.length () > 0 )
238- info.types = typesEl. at ( 0 ). toElement (). text (). split ( QRegularExpression ( " \\ s+ " ),
239- Qt::SkipEmptyParts);
237+ info.types =
238+ typesEl. at ( 0 ). toElement (). text (). split ( QRegularExpression ( " \\ s+ " ), Qt::SkipEmptyParts);
240239
241240 auto scopesEl = m.elementsByTagNameNS (nsDisco, " Scopes" );
242241 if (scopesEl.length () > 0 )
243- info.scopes = scopesEl. at ( 0 ). toElement (). text (). split ( QRegularExpression ( " \\ s+ " ),
244- Qt::SkipEmptyParts);
242+ info.scopes =
243+ scopesEl. at ( 0 ). toElement (). text (). split ( QRegularExpression ( " \\ s+ " ), Qt::SkipEmptyParts);
245244
246245 /* Extract manufacturer / model / name / location from scopes.
247246 * Scopes look like onvif://www.onvif.org/hardware/MODEL or
@@ -299,8 +298,8 @@ QString envelope(const QString &security, const QString &action, const QString &
299298 " </s:Header>"
300299 " <s:Body>%10</s:Body>"
301300 " </s:Envelope>" )
302- .arg (kNsSoap , kNsAddrSoap , kNsWsse , kNsWsu , kNsOnvifDevice , kNsOnvifMedia ,
303- kNsOnvifSchema , action, security, body);
301+ .arg (kNsSoap , kNsAddrSoap , kNsWsse , kNsWsu , kNsOnvifDevice , kNsOnvifMedia , kNsOnvifSchema , action,
302+ security, body);
304303}
305304} // namespace
306305
@@ -392,8 +391,8 @@ void OnvifMediaProbe::requestSystemDateAndTime()
392391{
393392 /* Unauthenticated per spec; gives us the camera's clock for the rest
394393 * of the probe's WS-Security timestamps. */
395- sendRequest (m_deviceXAddr, kNsOnvifDevice + " /GetSystemDateAndTime" ,
396- " <tds:GetSystemDateAndTime/> " , /* authenticated=*/ false );
394+ sendRequest (m_deviceXAddr, kNsOnvifDevice + " /GetSystemDateAndTime" , " <tds:GetSystemDateAndTime/> " ,
395+ /* authenticated=*/ false );
397396}
398397
399398void OnvifMediaProbe::requestCapabilities ()
@@ -415,14 +414,13 @@ void OnvifMediaProbe::requestNextStreamUri()
415414 return ;
416415 }
417416 const QString token = m_profileTokens.at (m_profileIdx);
418- const QString body = QStringLiteral (
419- " <trt:GetStreamUri>"
420- " <trt:StreamSetup>"
421- " <tt:Stream>RTP-Unicast</tt:Stream>"
422- " <tt:Transport><tt:Protocol>RTSP</tt:Protocol></tt:Transport>"
423- " </trt:StreamSetup>"
424- " <trt:ProfileToken>%1</trt:ProfileToken>"
425- " </trt:GetStreamUri>" )
417+ const QString body = QStringLiteral (" <trt:GetStreamUri>"
418+ " <trt:StreamSetup>"
419+ " <tt:Stream>RTP-Unicast</tt:Stream>"
420+ " <tt:Transport><tt:Protocol>RTSP</tt:Protocol></tt:Transport>"
421+ " </trt:StreamSetup>"
422+ " <trt:ProfileToken>%1</trt:ProfileToken>"
423+ " </trt:GetStreamUri>" )
426424 .arg (token);
427425 sendRequest (m_mediaXAddr, kNsOnvifMedia + " /GetStreamUri" , body, /* authenticated=*/ true );
428426}
@@ -512,7 +510,11 @@ void OnvifMediaProbe::onReplyFinished(QNetworkReply *reply)
512510 int h = timeEl.firstChildElement (" Hour" , kNsOnvifSchema ).text ().toInt ();
513511 int mi = timeEl.firstChildElement (" Minute" , kNsOnvifSchema ).text ().toInt ();
514512 int se = timeEl.firstChildElement (" Second" , kNsOnvifSchema ).text ().toInt ();
515- QDateTime cameraTime (QDate (y, mo, d), QTime (h, mi, se), Qt::UTC );
513+ /* See PTZOnvif::handleGetSystemDateAndTimeResponse — the
514+ * (date, time, Qt::TimeSpec) constructor is deprecated
515+ * in Qt 6.5. */
516+ QDateTime cameraTime (QDate (y, mo, d), QTime (h, mi, se));
517+ cameraTime.setTimeZone (QTimeZone::utc ());
516518 if (cameraTime.isValid ())
517519 m_timeOffsetSecs = QDateTime::currentDateTimeUtc ().secsTo (cameraTime);
518520 }
0 commit comments