-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathssdpresolverdemo.cpp
54 lines (42 loc) · 1.24 KB
/
ssdpresolverdemo.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* QtNetworkCrumbs - Some networking toys for Qt
* Copyright (C) 2019-2024 Mathias Hasselmann
*/
// QtNetworkCrumbs headers
#include "literals.h"
#include "ssdpresolver.h"
// Qt headers
#include <QCoreApplication>
#include <QLoggingCategory>
#include <QUuid>
namespace qnc::ssdp::demo {
namespace {
Q_LOGGING_CATEGORY(lcDemo, "ssdp.demo.resolver", QtInfoMsg)
class ResolverDemo : public QCoreApplication
{
public:
using QCoreApplication::QCoreApplication;
int run()
{
const auto resolver = new Resolver{this};
connect(resolver, &Resolver::serviceFound,
this, [](const auto &service) {
qCInfo(lcDemo).verbosity(QDebug::MinimumVerbosity)
<< "service resolved:"
<< service;
});
connect(resolver, &Resolver::serviceLost,
this, [](const auto &serviceName) {
qCInfo(lcDemo).verbosity(QDebug::MinimumVerbosity)
<< "service lost:"
<< serviceName;
});
resolver->lookupService("ssdp:all"_L1);
return exec();
}
};
} // namespace
} // namespace qnc::ssdp::demo
int main(int argc, char *argv[])
{
return qnc::ssdp::demo::ResolverDemo{argc, argv}.run();
}