JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
juce_NetworkServiceDiscovery.h
Go to the documentation of this file.
1 /*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 The code included in this file is provided under the terms of the ISC license
11 http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12 To use, copy, modify, and/or distribute this software for any purpose with or
13 without fee is hereby granted provided that the above copyright notice and
14 this permission notice appear in all copies.
15
16 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
18 DISCLAIMED.
19
20 ==============================================================================
21*/
22
23namespace juce
24{
25
26//==============================================================================
35{
44 struct Advertiser : private Thread
45 {
53 Advertiser (const String& serviceTypeUID,
55 int broadcastPort,
58
60 ~Advertiser() override;
61
62 private:
63 XmlElement message;
64 const int broadcastPort;
65 const RelativeTime minInterval;
66 DatagramSocket socket { true };
67
68 void run() override;
69 void sendBroadcast();
70 };
71
72 //==============================================================================
88
89 //==============================================================================
102 struct AvailableServiceList : private Thread,
103 private AsyncUpdater
104 {
111 AvailableServiceList (const String& serviceTypeUID, int broadcastPort);
112
114 ~AvailableServiceList() override;
115
118
121
122 private:
123 DatagramSocket socket { true };
124 String serviceTypeUID;
125 CriticalSection listLock;
126 std::vector<Service> services;
127
128 void run() override;
129 void handleAsyncUpdate() override;
130 void handleMessage (const XmlElement&);
131 void handleMessage (const Service&);
132 void removeTimedOutServices();
133
135 };
136};
137
138} // namespace juce
Has a callback method that is triggered asynchronously.
A wrapper for a datagram (UDP) socket.
Represents an IP address.
A relative measure of time.
static RelativeTime seconds(double seconds) noexcept
Creates a new RelativeTime object representing a number of seconds.
The JUCE String class!
Definition juce_String.h:53
Encapsulates a thread.
Definition juce_Thread.h:43
Holds an absolute date and time.
Definition juce_Time.h:37
Used to build a tree of elements representing an XML document.
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
This is a shorthand way of writing both a JUCE_DECLARE_NON_COPYABLE and JUCE_LEAK_DETECTOR macro for ...
JUCE Namespace.
String instanceID
A UUID that identifies the particular instance of the Advertiser class.
Time lastSeen
The time of the last ping received from the advertiser.
int port
The port number of the advertiser.
String description
The service description as sent by the Advertiser.
IPAddress address
The IP address of the advertiser.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
Definition juce_Memory.h:88
Contains classes that implement a simple protocol for broadcasting the availability and location of a...
Contains information about a service that has been found on the network.
An object which runs a thread to repeatedly broadcast the existence of a discoverable service.
Watches the network for broadcasts from Advertiser objects, and keeps a list of all the currently act...
std::function< void()> onChange
A lambda that can be set to receive a callback when the list changes.
std::vector< Service > getServices() const
Returns a list of the currently known services.