ToolX 1.11.1 [e3f477f]
A GUI debug tool chain for diagnosing GVA systems
Loading...
Searching...
No Matches
sap_manager.h
Go to the documentation of this file.
1//
2// Copyright (c) 2026, Astute Systems PTY LTD
3//
4// This file is part of the VivoeX project developed by Astute Systems.
5//
6// License. See the LICENSE file in the project root for full license details.
7//
13
14#ifndef STREAMS_SAP_MANAGER_H
15#define STREAMS_SAP_MANAGER_H
16
17#include <memory>
18#include <functional>
19#include <optional>
20
21#include <QSap>
22#include <QObject>
23#include <QDialog>
24#include <QTimer>
25#include <QDate>
26#include <QStatusBar>
27#include "../ui_toolx.h"
29
30class SapManager : public QObject
31{
32 Q_OBJECT
33
34public:
39 explicit SapManager(Ui::Dialog &ui, QLabel *sap_live, StreamGenerator::EncoderType *decoder,
40 QWidget *parent = nullptr);
41
46 ~SapManager() final;
47
54 static bool isGigE(const ::mediax::sap::SdpMessage &message);
55
58 std::function<std::optional<StreamGenerator::EncoderType>(const QString &, int)>;
59
69 void setLocalEncoderLookup(EncoderLookup lookup) { m_local_encoder = std::move(lookup); }
70
71signals:
78 void gigeSap(const QString name, const ::mediax::sap::SdpMessage message);
79
80public slots:
86 void newSap(const QString name, const ::mediax::sap::SdpMessage message);
87
92 void updateLive();
93
94private:
101 StreamGenerator::EncoderType decoderFor(const ::mediax::sap::SdpMessage &message) const;
102
108 void updateTable(const ::mediax::sap::SdpMessage &message);
109
115 void PrintSap(const ::mediax::sap::SdpMessage &message) const;
116
118 std::map<int, std::shared_ptr<::mediax::sap::SdpMessage>, std::less<>> m_messages;
119 std::map<int, std::shared_ptr<::mediax::sap::SdpMessage>, std::less<>> m_messages_all;
121 std::map<int, QDateTime> m_lastSeen;
123 mediax::qt6::QtSapListener m_listener;
125 QDialog *m_dialogue;
127 Ui::Dialog &m_ui;
131 QDateTime m_clear_before;
133 QLabel *m_sap_live;
142 QWidget *m_parent = nullptr;
143};
144
145#endif // STREAMS_SAP_MANAGER_H
SapManager(Ui::Dialog &ui, QLabel *sap_live, StreamGenerator::EncoderType *decoder, QWidget *parent=nullptr)
Construct a new Sap Manager object.
Definition sap_manager.cpp:23
~SapManager() final
Destroy the Sap Manager object.
Definition sap_manager.cpp:142
void updateTable(const ::mediax::sap::SdpMessage &message)
Update the SAP/SDP table.
Definition sap_manager.cpp:186
std::map< int, QDateTime > m_lastSeen
SAP session last seen timestamp map.
Definition sap_manager.h:121
void setLocalEncoderLookup(EncoderLookup lookup)
Play streams sent by this tool with the decoder that matches their encoder.
Definition sap_manager.h:69
QLabel * m_sap_live
The status bar.
Definition sap_manager.h:133
StreamGenerator::EncoderType decoderFor(const ::mediax::sap::SdpMessage &message) const
The H.264 decoder to play a stream with.
Definition sap_manager.cpp:130
void PrintSap(const ::mediax::sap::SdpMessage &message) const
Print the recieved SAP/SDP message.
Definition sap_manager.cpp:308
Ui::Dialog & m_ui
The GUI.
Definition sap_manager.h:127
QTimer m_liveTimer
The live timer for updating the live feed.
Definition sap_manager.h:129
std::map< int, std::shared_ptr<::mediax::sap::SdpMessage >, std::less<> > m_messages
Map of received messages.
Definition sap_manager.h:118
void updateLive()
Update the live feed.
Definition sap_manager.cpp:221
QDateTime m_clear_before
Time to clear messages before.
Definition sap_manager.h:131
QLabel * m_rtp_streams
The RTP streams text (count).
Definition sap_manager.h:135
mediax::qt6::QtSapListener m_listener
The SAP/SDP listener.
Definition sap_manager.h:123
QLabel * m_sap_enabled
SAP enabled text.
Definition sap_manager.h:137
void gigeSap(const QString name, const ::mediax::sap::SdpMessage message)
A GigE Vision device SAP announcement was received.
static bool isGigE(const ::mediax::sap::SdpMessage &message)
Check if an SDP message describes a GigE Vision device.
Definition sap_manager.cpp:147
QWidget * m_parent
Parent widget for player dialogs.
Definition sap_manager.h:142
EncoderLookup m_local_encoder
Finds the encoder of a stream sent by this tool.
Definition sap_manager.h:140
QDialog * m_dialogue
The Qt dialogue.
Definition sap_manager.h:125
void newSap(const QString name, const ::mediax::sap::SdpMessage message)
New frame signal.
Definition sap_manager.cpp:152
std::function< std::optional< StreamGenerator::EncoderType >(const QString &, int)> EncoderLookup
Finds the H.264 encoder of a stream sent by this tool from its address and port.
Definition sap_manager.h:57
EncoderType
The encoder type.
Definition stream_generator.h:36
Session Announcement Protocol (SDP) implementation for listening to announcements of stream data....