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

A client known to several servers is listed once (task 12.12). More...

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

Classes

class  Server
 One known server: its key, the last status it delivered (null: none yet) and whether its control connection is up.
 

Public Member Functions

boolean isHidden (ServerKey key, String clientId)
 
SnapcastGroup visible (ServerKey key, SnapcastGroup group)
 
SnapcastServerStatus visible (ServerKey key, SnapcastServerStatus status)
 

Static Public Member Functions

static SnapcastMergedClients none ()
 Nothing is hidden.
 
static SnapcastMergedClients of (List< Server > servers)
 
static SnapcastMergedClients of (List< Server > servers, SnapcastOwnIds ownIds)
 As of(List), and the phone is one client (task 12.19): its legacy ids count as its current id, so the phone is shown once (connected wins, else the last seen; a tie goes to the current id, then to the known order) and every other copy is hidden, also on the same server.
 

Detailed Description

A client known to several servers is listed once (task 12.12).

Snapcast clients keep an entry on every server they ever connected to, so the phone (one client id for all servers) or a Raspberry Pi that moved shows up as an offline leftover on the old server next to its live entry on the new one. This is a filter over the statuses of all known servers, a view for the lists; nothing is changed or removed on a server, and the group keys stay.

The rule (one client id at a time):

  • the id is on one server only: shown there;
  • connected on a server: shown there, and not as a leftover on the others. A server whose control connection is down counts as "not connected" for this (its last status may still say "connected", which can not be true any more);
  • connected nowhere: shown on the server that saw it last (lastSeen; a missing one is 0, the oldest); a tie goes to the first server of the known order, the order of the list given to of;
  • connected on two or more servers at once (it should not happen: a client has one connection): shown on all of them, nothing is hidden among live entries; offline copies on yet other servers are hidden.

The phone is one client (task 12.19): with of(List, SnapcastOwnIds) the old per-server ids of this install count as the current id. The phone is shown once (connected wins, else the last seen, a tie goes to the current id), and every other copy of it, also one on the SAME server, is hidden; so the card of an old entry that was alone in its group is gone, and the others keep their title from their first shown member. Entries of other installs are ordinary clients.

Display only. visible(ServerKey, SnapcastGroup) and visible(ServerKey, SnapcastServerStatus) give what the lists show: the card (title from the first shown member), the member rows, the counts "x of y connected", the link picker. A group whose members are all hidden gives null (no card; a group that never had a member is kept). The control code must keep working on the full status of a fresh read: Group.SetClients takes the whole list of members, so a hidden member has to be in it, or the change would drop it from the group. Nothing here is used by that code.

Pure Java, immutable. Where nothing is hidden the very same objects come back.

Member Function Documentation

◆ isHidden()

boolean de.yaacc.snapcast.SnapcastMergedClients.isHidden ( ServerKey key,
String clientId )
Returns
true when the lists do not show this client of this server (it is shown on another server)

◆ of() [1/2]

static SnapcastMergedClients de.yaacc.snapcast.SnapcastMergedClients.of ( List< Server > servers)
static
Parameters
serversevery known server in the known order (the first one wins a tie); a server without a status is skipped

Referenced by de.yaacc.snapcast.SnapcastMergedClients.of().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ of() [2/2]

static SnapcastMergedClients de.yaacc.snapcast.SnapcastMergedClients.of ( List< Server > servers,
SnapcastOwnIds ownIds )
static

As of(List), and the phone is one client (task 12.19): its legacy ids count as its current id, so the phone is shown once (connected wins, else the last seen; a tie goes to the current id, then to the known order) and every other copy is hidden, also on the same server.

The ids of other installs are ordinary clients.

Parameters
ownIdsthe phone's ids; null or none merges nothing of the phone
Here is the call graph for this function:

◆ visible() [1/2]

SnapcastGroup de.yaacc.snapcast.SnapcastMergedClients.visible ( ServerKey key,
SnapcastGroup group )
Returns
the group as the lists show it: the members that are not hidden, in their order; the group itself when none is hidden; null for a null group and for a group whose members are all hidden

Referenced by de.yaacc.snapcast.SnapcastReceivers.describe(), de.yaacc.snapcast.SnapcastReceivers.findGroup(), de.yaacc.snapcast.SnapcastReceivers.groups(), de.yaacc.snapcast.SnapcastReceivers.stateOf(), and de.yaacc.snapcast.SnapcastMergedClients.visible().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ visible() [2/2]

SnapcastServerStatus de.yaacc.snapcast.SnapcastMergedClients.visible ( ServerKey key,
SnapcastServerStatus status )
Returns
the status as the lists show it: the visible groups (a group with no shown member is left out); the same status when nothing is hidden in it; null for null
Here is the call graph for this function:

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