YAACC - UPNP Client and Server
Loading...
Searching...
No Matches
de.yaacc.snapcast.SnapcastSelectedServers Class Reference

Remembers the servers that hold a selected Snapcast group, so that the selection survives an app restart even when the server was only discovered (a typed-in server is remembered by the manual list). More...

Collaboration diagram for de.yaacc.snapcast.SnapcastSelectedServers:
Collaboration graph

Public Member Functions

 SnapcastSelectedServers (StringStore storage, SnapcastDirectory directory)
 
void restore ()
 Lists the remembered servers in the directory (at start-up, before anything else asks for a group).
 
List< ServerEndpoint > list ()
 
void selectionChanged (Collection< String > receiverIds)
 The selection changed: remember the listed servers that hold a selected group, forget the others.
 
void forget (ServerKey key)
 Forgets one server: its endpoint leaves the store and its remembered flag goes.
 

Detailed Description

Remembers the servers that hold a selected Snapcast group, so that the selection survives an app restart even when the server was only discovered (a typed-in server is remembered by the manual list).

Without it the directory is empty after a restart, the group could not be resolved, and the stored selection would be dropped before the receivers page had a chance to discover the server again.

What is stored is the same plain text as the manual list: one host:port per line, an address that was seen on the network and passed the range filter, nothing else (no service name, no group id, no credentials). It is read strictly (every line is parsed again and filtered again, at most {@value SnapcastDirectory.MAX_SERVERS}), and handed to the directory as remembered servers, which the directory lists without any scan. A server leaves the store as soon as no selected group refers to it. Pure Java; the storage is injected. Thread safe.

Member Function Documentation

◆ forget()

void de.yaacc.snapcast.SnapcastSelectedServers.forget ( ServerKey key)

Forgets one server: its endpoint leaves the store and its remembered flag goes.

For "remove server" when the stored selection can not be read; the other remembered servers are left alone.

Here is the call graph for this function:

◆ list()

List< ServerEndpoint > de.yaacc.snapcast.SnapcastSelectedServers.list ( )
Returns
the servers in the store

◆ selectionChanged()

void de.yaacc.snapcast.SnapcastSelectedServers.selectionChanged ( Collection< String > receiverIds)

The selection changed: remember the listed servers that hold a selected group, forget the others.

A manual server is left to the manual list.

Parameters
receiverIdsthe ids of the selected receivers (any kind; only snapcast: ids count); may be null
Here is the call graph for this function:

The documentation for this class was generated from the following file: